@webiny/handler-graphql 0.0.0-mt-2 → 0.0.0-unstable.13771d80a8

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.
Files changed (55) hide show
  1. package/builtInTypes/AnyScalar.d.ts +1 -1
  2. package/builtInTypes/AnyScalar.js +3 -6
  3. package/builtInTypes/AnyScalar.js.map +1 -0
  4. package/builtInTypes/DateScalar.js +5 -16
  5. package/builtInTypes/DateScalar.js.map +1 -0
  6. package/builtInTypes/DateTimeScalar.js +3 -14
  7. package/builtInTypes/DateTimeScalar.js.map +1 -0
  8. package/builtInTypes/DateTimeZScalar.js +1 -14
  9. package/builtInTypes/DateTimeZScalar.js.map +1 -0
  10. package/builtInTypes/JsonScalar.js +0 -2
  11. package/builtInTypes/JsonScalar.js.map +1 -0
  12. package/builtInTypes/LongScalar.js +0 -2
  13. package/builtInTypes/LongScalar.js.map +1 -0
  14. package/builtInTypes/NumberScalar.d.ts +1 -1
  15. package/builtInTypes/NumberScalar.js +10 -15
  16. package/builtInTypes/NumberScalar.js.map +1 -0
  17. package/builtInTypes/RefInputScalar.d.ts +1 -1
  18. package/builtInTypes/RefInputScalar.js +3 -14
  19. package/builtInTypes/RefInputScalar.js.map +1 -0
  20. package/builtInTypes/TimeScalar.js +1 -13
  21. package/builtInTypes/TimeScalar.js.map +1 -0
  22. package/builtInTypes/index.js +0 -18
  23. package/builtInTypes/index.js.map +1 -0
  24. package/createGraphQLHandler.d.ts +1 -1
  25. package/createGraphQLHandler.js +65 -58
  26. package/createGraphQLHandler.js.map +1 -0
  27. package/createGraphQLSchema.d.ts +2 -3
  28. package/createGraphQLSchema.js +22 -22
  29. package/createGraphQLSchema.js.map +1 -0
  30. package/debugPlugins.d.ts +10 -8
  31. package/debugPlugins.js +16 -28
  32. package/debugPlugins.js.map +1 -0
  33. package/errors.d.ts +2 -2
  34. package/errors.js +1 -6
  35. package/errors.js.map +1 -0
  36. package/index.d.ts +1 -4
  37. package/index.js +16 -23
  38. package/index.js.map +1 -0
  39. package/interceptConsole.d.ts +5 -1
  40. package/interceptConsole.js +5 -7
  41. package/interceptConsole.js.map +1 -0
  42. package/package.json +19 -18
  43. package/plugins/GraphQLSchemaPlugin.d.ts +2 -2
  44. package/plugins/GraphQLSchemaPlugin.js +1 -8
  45. package/plugins/GraphQLSchemaPlugin.js.map +1 -0
  46. package/plugins/index.js +0 -2
  47. package/plugins/index.js.map +1 -0
  48. package/processRequestBody.d.ts +4 -1
  49. package/processRequestBody.js +6 -14
  50. package/processRequestBody.js.map +1 -0
  51. package/responses.d.ts +20 -18
  52. package/responses.js +22 -23
  53. package/responses.js.map +1 -0
  54. package/types.d.ts +7 -5
  55. package/types.js.map +1 -0
package/plugins/index.js CHANGED
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _GraphQLSchemaPlugin = require("./GraphQLSchemaPlugin");
8
-
9
7
  Object.keys(_GraphQLSchemaPlugin).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _GraphQLSchemaPlugin[key]) return;
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./GraphQLSchemaPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,2 +1,5 @@
1
- declare const _default: (requestBody: any, schema: any, context: any) => Promise<any>;
1
+ import { ExecutionResult, GraphQLSchema } from "graphql";
2
+ import { GraphQLRequestBody } from "./types";
3
+ import { Context } from "@webiny/api/types";
4
+ declare const _default: (requestBody: GraphQLRequestBody | GraphQLRequestBody[], schema: GraphQLSchema, context: Context) => Promise<ExecutionResult[] | ExecutionResult>;
2
5
  export default _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _graphql = require("graphql");
9
-
10
8
  const processRequestBody = async (body, schema, context) => {
11
9
  const {
12
10
  query,
@@ -29,21 +27,15 @@ const processRequestBody = async (body, schema, context) => {
29
27
  });
30
28
  return result;
31
29
  };
32
-
33
30
  var _default = async (requestBody, schema, context) => {
34
- let result;
35
-
36
31
  if (Array.isArray(requestBody)) {
37
- result = [];
38
-
39
- for (let i = 0; i < requestBody.length; i++) {
40
- result.push(await processRequestBody(requestBody[i], schema, context));
32
+ const results = [];
33
+ for (const body of requestBody) {
34
+ const result = await processRequestBody(body, schema, context);
35
+ results.push(result);
41
36
  }
42
- } else {
43
- result = await processRequestBody(requestBody, schema, context);
37
+ return results;
44
38
  }
45
-
46
- return result;
39
+ return await processRequestBody(requestBody, schema, context);
47
40
  };
48
-
49
41
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["processRequestBody","body","schema","context","query","variables","operationName","plugins","byType","forEach","pl","apply","result","graphql","requestBody","Array","isArray","results","push"],"sources":["processRequestBody.ts"],"sourcesContent":["import { ExecutionResult, graphql, GraphQLSchema } from \"graphql\";\nimport { GraphQLAfterQueryPlugin, GraphQLBeforeQueryPlugin, GraphQLRequestBody } from \"~/types\";\nimport { Context } from \"@webiny/api/types\";\n\nconst processRequestBody = async (\n body: GraphQLRequestBody,\n schema: GraphQLSchema,\n context: Context\n) => {\n const { query, variables, operationName } = body;\n\n context.plugins\n .byType<GraphQLBeforeQueryPlugin>(\"graphql-before-query\")\n .forEach(pl => pl.apply({ body, schema, context }));\n\n const result = await graphql(schema, query, {}, context, variables, operationName);\n\n context.plugins.byType<GraphQLAfterQueryPlugin>(\"graphql-after-query\").forEach(pl => {\n pl.apply({ result, body, schema, context });\n });\n\n return result;\n};\n\nexport default async (\n requestBody: GraphQLRequestBody | GraphQLRequestBody[],\n schema: GraphQLSchema,\n context: Context\n): Promise<ExecutionResult[] | ExecutionResult> => {\n if (Array.isArray(requestBody)) {\n const results: ExecutionResult[] = [];\n for (const body of requestBody) {\n const result = await processRequestBody(body, schema, context);\n results.push(result);\n }\n return results;\n }\n return await processRequestBody(requestBody, schema, context);\n};\n"],"mappings":";;;;;;AAAA;AAIA,MAAMA,kBAAkB,GAAG,OACvBC,IAAwB,EACxBC,MAAqB,EACrBC,OAAgB,KACf;EACD,MAAM;IAAEC,KAAK;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGL,IAAI;EAEhDE,OAAO,CAACI,OAAO,CACVC,MAAM,CAA2B,sBAAsB,CAAC,CACxDC,OAAO,CAACC,EAAE,IAAIA,EAAE,CAACC,KAAK,CAAC;IAAEV,IAAI;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC,CAAC;EAEvD,MAAMS,MAAM,GAAG,MAAM,IAAAC,gBAAO,EAACX,MAAM,EAAEE,KAAK,EAAE,CAAC,CAAC,EAAED,OAAO,EAAEE,SAAS,EAAEC,aAAa,CAAC;EAElFH,OAAO,CAACI,OAAO,CAACC,MAAM,CAA0B,qBAAqB,CAAC,CAACC,OAAO,CAACC,EAAE,IAAI;IACjFA,EAAE,CAACC,KAAK,CAAC;MAAEC,MAAM;MAAEX,IAAI;MAAEC,MAAM;MAAEC;IAAQ,CAAC,CAAC;EAC/C,CAAC,CAAC;EAEF,OAAOS,MAAM;AACjB,CAAC;AAAC,eAEa,OACXE,WAAsD,EACtDZ,MAAqB,EACrBC,OAAgB,KAC+B;EAC/C,IAAIY,KAAK,CAACC,OAAO,CAACF,WAAW,CAAC,EAAE;IAC5B,MAAMG,OAA0B,GAAG,EAAE;IACrC,KAAK,MAAMhB,IAAI,IAAIa,WAAW,EAAE;MAC5B,MAAMF,MAAM,GAAG,MAAMZ,kBAAkB,CAACC,IAAI,EAAEC,MAAM,EAAEC,OAAO,CAAC;MAC9Dc,OAAO,CAACC,IAAI,CAACN,MAAM,CAAC;IACxB;IACA,OAAOK,OAAO;EAClB;EACA,OAAO,MAAMjB,kBAAkB,CAACc,WAAW,EAAEZ,MAAM,EAAEC,OAAO,CAAC;AACjE,CAAC;AAAA"}
package/responses.d.ts CHANGED
@@ -1,14 +1,16 @@
1
- declare type ErrorResponseParams = {
1
+ export interface ErrorResponseParams {
2
+ message: string;
2
3
  code?: string;
3
- message?: string;
4
4
  data?: any;
5
- };
5
+ stack?: string | null;
6
+ }
6
7
  export declare class ErrorResponse {
7
- data: any;
8
- error: {
8
+ readonly data: null;
9
+ readonly error: {
9
10
  code: string;
10
11
  message: string;
11
- data?: any;
12
+ data: any;
13
+ stack: string | null;
12
14
  };
13
15
  constructor(params: ErrorResponseParams);
14
16
  }
@@ -16,24 +18,24 @@ export declare class NotFoundResponse extends ErrorResponse {
16
18
  constructor(message: string);
17
19
  }
18
20
  export declare class ListErrorResponse {
19
- data: null;
20
- meta: null;
21
- error: {
21
+ readonly data: null;
22
+ readonly meta: null;
23
+ readonly error: {
22
24
  code: string;
23
25
  message: string;
24
- data?: any;
26
+ data: any;
27
+ stack: string | null;
25
28
  };
26
29
  constructor(params: ErrorResponseParams);
27
30
  }
28
- export declare class Response<T extends any = any> {
29
- data: T;
30
- error: null;
31
+ export declare class Response<T = any> {
32
+ readonly data: T;
33
+ readonly error: null;
31
34
  constructor(data: T);
32
35
  }
33
- export declare class ListResponse<T extends any, M extends any> {
34
- data: Array<T>;
35
- meta: M;
36
- error: null;
36
+ export declare class ListResponse<T, M> {
37
+ readonly data: Array<T>;
38
+ readonly meta: M;
39
+ readonly error: null;
37
40
  constructor(data: Array<T>, meta?: M);
38
41
  }
39
- export {};
package/responses.js CHANGED
@@ -1,36 +1,38 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Response = exports.NotFoundResponse = exports.ListResponse = exports.ListErrorResponse = exports.ErrorResponse = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  const defaultParams = {
13
10
  code: "",
14
11
  message: "",
15
- data: null
12
+ data: null,
13
+ stack: null
16
14
  };
17
-
18
15
  class ErrorResponse {
19
16
  constructor(params) {
20
17
  (0, _defineProperty2.default)(this, "data", void 0);
21
18
  (0, _defineProperty2.default)(this, "error", void 0);
22
19
  this.data = null;
20
+ const debug = process.env.DEBUG === "true";
21
+
22
+ // Ensure `stack` is either `string` or `null`.
23
+ let stack = defaultParams.stack;
24
+ if (debug && params.stack) {
25
+ stack = params.stack;
26
+ }
23
27
  this.error = {
24
28
  code: params.code || defaultParams.code,
25
29
  message: params.message || defaultParams.message,
26
- data: params.data || defaultParams.data
30
+ data: params.data || defaultParams.data,
31
+ stack: stack
27
32
  };
28
33
  }
29
-
30
34
  }
31
-
32
35
  exports.ErrorResponse = ErrorResponse;
33
-
34
36
  class NotFoundResponse extends ErrorResponse {
35
37
  constructor(message) {
36
38
  super({
@@ -38,29 +40,31 @@ class NotFoundResponse extends ErrorResponse {
38
40
  message
39
41
  });
40
42
  }
41
-
42
43
  }
43
-
44
44
  exports.NotFoundResponse = NotFoundResponse;
45
-
46
45
  class ListErrorResponse {
47
46
  constructor(params) {
48
47
  (0, _defineProperty2.default)(this, "data", void 0);
49
48
  (0, _defineProperty2.default)(this, "meta", void 0);
50
49
  (0, _defineProperty2.default)(this, "error", void 0);
51
- this.data = null;
52
50
  this.meta = null;
51
+ this.data = null;
52
+ const debug = process.env.DEBUG === "true";
53
+
54
+ // Ensure `stack` is either `string` or `null`.
55
+ let stack = defaultParams.stack;
56
+ if (debug && params.stack) {
57
+ stack = params.stack;
58
+ }
53
59
  this.error = {
54
60
  code: params.code || defaultParams.code,
55
61
  message: params.message || defaultParams.message,
56
- data: params.data || defaultParams.data
62
+ data: params.data || defaultParams.data,
63
+ stack: stack
57
64
  };
58
65
  }
59
-
60
66
  }
61
-
62
67
  exports.ListErrorResponse = ListErrorResponse;
63
-
64
68
  class Response {
65
69
  constructor(data) {
66
70
  (0, _defineProperty2.default)(this, "data", void 0);
@@ -68,11 +72,8 @@ class Response {
68
72
  this.data = data;
69
73
  this.error = null;
70
74
  }
71
-
72
75
  }
73
-
74
76
  exports.Response = Response;
75
-
76
77
  class ListResponse {
77
78
  constructor(data, meta) {
78
79
  (0, _defineProperty2.default)(this, "data", void 0);
@@ -82,7 +83,5 @@ class ListResponse {
82
83
  this.meta = meta || {};
83
84
  this.error = null;
84
85
  }
85
-
86
86
  }
87
-
88
87
  exports.ListResponse = ListResponse;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["defaultParams","code","message","data","stack","ErrorResponse","constructor","params","debug","process","env","DEBUG","error","NotFoundResponse","ListErrorResponse","meta","Response","ListResponse","Array","isArray"],"sources":["responses.ts"],"sourcesContent":["export interface ErrorResponseParams {\n message: string;\n code?: string;\n data?: any;\n stack?: string | null;\n}\n\nconst defaultParams: Required<ErrorResponseParams> = {\n code: \"\",\n message: \"\",\n data: null,\n stack: null\n};\n\nexport class ErrorResponse {\n public readonly data: null;\n public readonly error: {\n code: string;\n message: string;\n data: any;\n stack: string | null;\n };\n\n constructor(params: ErrorResponseParams) {\n this.data = null;\n\n const debug = process.env.DEBUG === \"true\";\n\n // Ensure `stack` is either `string` or `null`.\n let stack = defaultParams.stack;\n if (debug && params.stack) {\n stack = params.stack;\n }\n\n this.error = {\n code: params.code || defaultParams.code,\n message: params.message || defaultParams.message,\n data: params.data || defaultParams.data,\n stack: stack\n };\n }\n}\n\nexport class NotFoundResponse extends ErrorResponse {\n constructor(message: string) {\n super({\n code: \"NOT_FOUND\",\n message\n });\n }\n}\n\nexport class ListErrorResponse {\n public readonly data: null;\n public readonly meta: null;\n public readonly error: {\n code: string;\n message: string;\n data: any;\n stack: string | null;\n };\n\n constructor(params: ErrorResponseParams) {\n this.meta = null;\n this.data = null;\n\n const debug = process.env.DEBUG === \"true\";\n\n // Ensure `stack` is either `string` or `null`.\n let stack = defaultParams.stack;\n if (debug && params.stack) {\n stack = params.stack;\n }\n\n this.error = {\n code: params.code || defaultParams.code,\n message: params.message || defaultParams.message,\n data: params.data || defaultParams.data,\n stack: stack\n };\n }\n}\n\nexport class Response<T = any> {\n public readonly data: T;\n public readonly error: null;\n\n constructor(data: T) {\n this.data = data;\n this.error = null;\n }\n}\n\nexport class ListResponse<T, M> {\n public readonly data: Array<T>;\n public readonly meta: M;\n public readonly error: null;\n\n constructor(data: Array<T>, meta?: M) {\n this.data = Array.isArray(data) ? data : [];\n this.meta = meta || ({} as M);\n this.error = null;\n }\n}\n"],"mappings":";;;;;;;;AAOA,MAAMA,aAA4C,GAAG;EACjDC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACX,CAAC;AAEM,MAAMC,aAAa,CAAC;EASvBC,WAAW,CAACC,MAA2B,EAAE;IAAA;IAAA;IACrC,IAAI,CAACJ,IAAI,GAAG,IAAI;IAEhB,MAAMK,KAAK,GAAGC,OAAO,CAACC,GAAG,CAACC,KAAK,KAAK,MAAM;;IAE1C;IACA,IAAIP,KAAK,GAAGJ,aAAa,CAACI,KAAK;IAC/B,IAAII,KAAK,IAAID,MAAM,CAACH,KAAK,EAAE;MACvBA,KAAK,GAAGG,MAAM,CAACH,KAAK;IACxB;IAEA,IAAI,CAACQ,KAAK,GAAG;MACTX,IAAI,EAAEM,MAAM,CAACN,IAAI,IAAID,aAAa,CAACC,IAAI;MACvCC,OAAO,EAAEK,MAAM,CAACL,OAAO,IAAIF,aAAa,CAACE,OAAO;MAChDC,IAAI,EAAEI,MAAM,CAACJ,IAAI,IAAIH,aAAa,CAACG,IAAI;MACvCC,KAAK,EAAEA;IACX,CAAC;EACL;AACJ;AAAC;AAEM,MAAMS,gBAAgB,SAASR,aAAa,CAAC;EAChDC,WAAW,CAACJ,OAAe,EAAE;IACzB,KAAK,CAAC;MACFD,IAAI,EAAE,WAAW;MACjBC;IACJ,CAAC,CAAC;EACN;AACJ;AAAC;AAEM,MAAMY,iBAAiB,CAAC;EAU3BR,WAAW,CAACC,MAA2B,EAAE;IAAA;IAAA;IAAA;IACrC,IAAI,CAACQ,IAAI,GAAG,IAAI;IAChB,IAAI,CAACZ,IAAI,GAAG,IAAI;IAEhB,MAAMK,KAAK,GAAGC,OAAO,CAACC,GAAG,CAACC,KAAK,KAAK,MAAM;;IAE1C;IACA,IAAIP,KAAK,GAAGJ,aAAa,CAACI,KAAK;IAC/B,IAAII,KAAK,IAAID,MAAM,CAACH,KAAK,EAAE;MACvBA,KAAK,GAAGG,MAAM,CAACH,KAAK;IACxB;IAEA,IAAI,CAACQ,KAAK,GAAG;MACTX,IAAI,EAAEM,MAAM,CAACN,IAAI,IAAID,aAAa,CAACC,IAAI;MACvCC,OAAO,EAAEK,MAAM,CAACL,OAAO,IAAIF,aAAa,CAACE,OAAO;MAChDC,IAAI,EAAEI,MAAM,CAACJ,IAAI,IAAIH,aAAa,CAACG,IAAI;MACvCC,KAAK,EAAEA;IACX,CAAC;EACL;AACJ;AAAC;AAEM,MAAMY,QAAQ,CAAU;EAI3BV,WAAW,CAACH,IAAO,EAAE;IAAA;IAAA;IACjB,IAAI,CAACA,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACS,KAAK,GAAG,IAAI;EACrB;AACJ;AAAC;AAEM,MAAMK,YAAY,CAAO;EAK5BX,WAAW,CAACH,IAAc,EAAEY,IAAQ,EAAE;IAAA;IAAA;IAAA;IAClC,IAAI,CAACZ,IAAI,GAAGe,KAAK,CAACC,OAAO,CAAChB,IAAI,CAAC,GAAGA,IAAI,GAAG,EAAE;IAC3C,IAAI,CAACY,IAAI,GAAGA,IAAI,IAAK,CAAC,CAAO;IAC7B,IAAI,CAACH,KAAK,GAAG,IAAI;EACrB;AACJ;AAAC"}
package/types.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import { GraphQLScalarType, GraphQLFieldResolver as BaseGraphQLFieldResolver, GraphQLSchema } from "graphql";
2
2
  import { Plugin } from "@webiny/plugins/types";
3
- import { ContextInterface } from "@webiny/handler/types";
3
+ import { Context } from "@webiny/api/types";
4
+ import { RouteMethodPath } from "@webiny/handler/types";
4
5
  export interface GraphQLScalarPlugin extends Plugin {
5
6
  type: "graphql-scalar";
6
7
  scalar: GraphQLScalarType;
7
8
  }
8
9
  export interface HandlerGraphQLOptions {
10
+ path?: RouteMethodPath;
9
11
  debug?: boolean | string;
10
12
  }
11
- export declare type GraphQLFieldResolver<TSource = any, TArgs = any, TContext = ContextInterface> = BaseGraphQLFieldResolver<TSource, TContext, TArgs>;
13
+ export declare type GraphQLFieldResolver<TSource = any, TArgs = any, TContext = Context> = BaseGraphQLFieldResolver<TSource, TContext, TArgs>;
12
14
  export declare type Types = string | (() => string | Promise<string>);
13
15
  export interface GraphQLSchemaPluginTypeArgs {
14
16
  context?: any;
@@ -22,7 +24,7 @@ export interface GraphQLSchemaDefinition<TContext> {
22
24
  typeDefs: Types;
23
25
  resolvers?: Resolvers<TContext>;
24
26
  }
25
- export interface GraphQLSchemaPlugin<TContext extends ContextInterface = ContextInterface> extends Plugin {
27
+ export interface GraphQLSchemaPlugin<TContext extends Context = Context> extends Plugin {
26
28
  type: "graphql-schema";
27
29
  schema: GraphQLSchemaDefinition<TContext>;
28
30
  }
@@ -31,7 +33,7 @@ export interface GraphQLRequestBody {
31
33
  variables: Record<string, any>;
32
34
  operationName: string;
33
35
  }
34
- export interface GraphQLBeforeQueryPlugin<TContext extends ContextInterface = ContextInterface> extends Plugin {
36
+ export interface GraphQLBeforeQueryPlugin<TContext extends Context = Context> extends Plugin {
35
37
  type: "graphql-before-query";
36
38
  apply(params: {
37
39
  body: GraphQLRequestBody;
@@ -39,7 +41,7 @@ export interface GraphQLBeforeQueryPlugin<TContext extends ContextInterface = Co
39
41
  context: TContext;
40
42
  }): void;
41
43
  }
42
- export interface GraphQLAfterQueryPlugin<TContext extends ContextInterface = ContextInterface> extends Plugin {
44
+ export interface GraphQLAfterQueryPlugin<TContext extends Context = Context> extends Plugin {
43
45
  type: "graphql-after-query";
44
46
  apply(params: {
45
47
  result: any;
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import {\n GraphQLScalarType,\n GraphQLFieldResolver as BaseGraphQLFieldResolver,\n GraphQLSchema\n} from \"graphql\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { Context } from \"@webiny/api/types\";\nimport { RouteMethodPath } from \"@webiny/handler/types\";\n\nexport interface GraphQLScalarPlugin extends Plugin {\n type: \"graphql-scalar\";\n scalar: GraphQLScalarType;\n}\n\nexport interface HandlerGraphQLOptions {\n path?: RouteMethodPath;\n debug?: boolean | string;\n}\n\nexport type GraphQLFieldResolver<\n TSource = any,\n TArgs = any,\n TContext = Context\n> = BaseGraphQLFieldResolver<TSource, TContext, TArgs>;\n\n// `GraphQLSchemaPlugin` types.\nexport type Types = string | (() => string | Promise<string>);\n\nexport interface GraphQLSchemaPluginTypeArgs {\n context?: any;\n args?: any;\n source?: any;\n}\n\nexport type Resolvers<TContext> =\n | GraphQLScalarType\n | GraphQLFieldResolver<any, Record<string, any>, TContext>\n | { [property: string]: Resolvers<TContext> };\n\nexport interface GraphQLSchemaDefinition<TContext> {\n typeDefs: Types;\n resolvers?: Resolvers<TContext>;\n}\n\nexport interface GraphQLSchemaPlugin<TContext extends Context = Context> extends Plugin {\n type: \"graphql-schema\";\n schema: GraphQLSchemaDefinition<TContext>;\n}\n\nexport interface GraphQLRequestBody {\n query: string;\n variables: Record<string, any>;\n operationName: string;\n}\n\nexport interface GraphQLBeforeQueryPlugin<TContext extends Context = Context> extends Plugin {\n type: \"graphql-before-query\";\n apply(params: { body: GraphQLRequestBody; schema: GraphQLSchema; context: TContext }): void;\n}\n\nexport interface GraphQLAfterQueryPlugin<TContext extends Context = Context> extends Plugin {\n type: \"graphql-after-query\";\n apply(params: {\n result: any;\n body: GraphQLRequestBody;\n schema: GraphQLSchema;\n context: TContext;\n }): void;\n}\n"],"mappings":""}