@webiny/handler-graphql 0.0.0-unstable.aad28a72ae → 0.0.0-unstable.ac6ebf63c6

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 (104) hide show
  1. package/README.md +9 -5
  2. package/ResolverDecoration.d.ts +6 -0
  3. package/ResolverDecoration.js +19 -0
  4. package/ResolverDecoration.js.map +1 -0
  5. package/builtInTypes/AnyScalar.d.ts +1 -1
  6. package/builtInTypes/AnyScalar.js +4 -12
  7. package/builtInTypes/AnyScalar.js.map +1 -1
  8. package/builtInTypes/DateScalar.d.ts +1 -1
  9. package/builtInTypes/DateScalar.js +10 -20
  10. package/builtInTypes/DateScalar.js.map +1 -1
  11. package/builtInTypes/DateTimeScalar.d.ts +1 -1
  12. package/builtInTypes/DateTimeScalar.js +10 -20
  13. package/builtInTypes/DateTimeScalar.js.map +1 -1
  14. package/builtInTypes/DateTimeZScalar.d.ts +1 -1
  15. package/builtInTypes/DateTimeZScalar.js +10 -29
  16. package/builtInTypes/DateTimeZScalar.js.map +1 -1
  17. package/builtInTypes/IconScalar.d.ts +10 -0
  18. package/builtInTypes/IconScalar.js +93 -0
  19. package/builtInTypes/IconScalar.js.map +1 -0
  20. package/builtInTypes/JsonScalar.d.ts +1 -1
  21. package/builtInTypes/JsonScalar.js +3 -10
  22. package/builtInTypes/JsonScalar.js.map +1 -1
  23. package/builtInTypes/LongScalar.d.ts +2 -1
  24. package/builtInTypes/LongScalar.js +47 -9
  25. package/builtInTypes/LongScalar.js.map +1 -1
  26. package/builtInTypes/NumberScalar.d.ts +1 -1
  27. package/builtInTypes/NumberScalar.js +14 -30
  28. package/builtInTypes/NumberScalar.js.map +1 -1
  29. package/builtInTypes/RefInputScalar.d.ts +1 -1
  30. package/builtInTypes/RefInputScalar.js +40 -29
  31. package/builtInTypes/RefInputScalar.js.map +1 -1
  32. package/builtInTypes/TimeScalar.d.ts +1 -1
  33. package/builtInTypes/TimeScalar.js +11 -29
  34. package/builtInTypes/TimeScalar.js.map +1 -1
  35. package/builtInTypes/index.d.ts +10 -9
  36. package/builtInTypes/index.js +12 -122
  37. package/builtInTypes/index.js.map +1 -1
  38. package/createGraphQLHandler.d.ts +3 -3
  39. package/createGraphQLHandler.js +59 -48
  40. package/createGraphQLHandler.js.map +1 -1
  41. package/createGraphQLSchema.d.ts +4 -2
  42. package/createGraphQLSchema.js +76 -46
  43. package/createGraphQLSchema.js.map +1 -1
  44. package/createRequestBody.d.ts +2 -0
  45. package/createRequestBody.js +26 -0
  46. package/createRequestBody.js.map +1 -0
  47. package/createResolverDecorator.d.ts +2 -0
  48. package/createResolverDecorator.js +5 -0
  49. package/createResolverDecorator.js.map +1 -0
  50. package/debugPlugins.d.ts +2 -2
  51. package/debugPlugins.js +5 -19
  52. package/debugPlugins.js.map +1 -1
  53. package/errors.js +3 -14
  54. package/errors.js.map +1 -1
  55. package/exports/api/graphql.d.ts +2 -0
  56. package/exports/api/graphql.js +4 -0
  57. package/exports/api/graphql.js.map +1 -0
  58. package/features/GraphQLSchemaBuilder/GraphQLSchemaBuilder.d.ts +16 -0
  59. package/features/GraphQLSchemaBuilder/GraphQLSchemaBuilder.js +64 -0
  60. package/features/GraphQLSchemaBuilder/GraphQLSchemaBuilder.js.map +1 -0
  61. package/features/GraphQLSchemaBuilder/GraphQLSchemaComposer.d.ts +13 -0
  62. package/features/GraphQLSchemaBuilder/GraphQLSchemaComposer.js +29 -0
  63. package/features/GraphQLSchemaBuilder/GraphQLSchemaComposer.js.map +1 -0
  64. package/features/GraphQLSchemaBuilder/abstractions.d.ts +34 -0
  65. package/features/GraphQLSchemaBuilder/abstractions.js +5 -0
  66. package/features/GraphQLSchemaBuilder/abstractions.js.map +1 -0
  67. package/features/GraphQLSchemaBuilder/feature.d.ts +1 -0
  68. package/features/GraphQLSchemaBuilder/feature.js +10 -0
  69. package/features/GraphQLSchemaBuilder/feature.js.map +1 -0
  70. package/graphql/abstractions.core.d.ts +11 -0
  71. package/graphql/abstractions.core.js +10 -0
  72. package/graphql/abstractions.core.js.map +1 -0
  73. package/graphql/abstractions.d.ts +2 -0
  74. package/graphql/abstractions.js +4 -0
  75. package/graphql/abstractions.js.map +1 -0
  76. package/graphql/abstractions.public.d.ts +19 -0
  77. package/graphql/abstractions.public.js +12 -0
  78. package/graphql/abstractions.public.js.map +1 -0
  79. package/index.d.ts +10 -5
  80. package/index.js +13 -57
  81. package/index.js.map +1 -1
  82. package/interceptConsole.js +9 -20
  83. package/interceptConsole.js.map +1 -1
  84. package/package.json +23 -25
  85. package/plugins/GraphQLSchemaPlugin.d.ts +13 -5
  86. package/plugins/GraphQLSchemaPlugin.js +15 -20
  87. package/plugins/GraphQLSchemaPlugin.js.map +1 -1
  88. package/plugins/index.d.ts +1 -1
  89. package/plugins/index.js +2 -17
  90. package/plugins/index.js.map +1 -1
  91. package/processRequestBody.d.ts +4 -5
  92. package/processRequestBody.js +19 -23
  93. package/processRequestBody.js.map +1 -1
  94. package/responses.js +10 -51
  95. package/responses.js.map +1 -1
  96. package/types.d.ts +20 -13
  97. package/types.js +2 -4
  98. package/types.js.map +1 -1
  99. package/utils/index.d.ts +1 -0
  100. package/utils/index.js +3 -0
  101. package/utils/index.js.map +1 -0
  102. package/utils/resolve.d.ts +21 -0
  103. package/utils/resolve.js +19 -0
  104. package/utils/resolve.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"names":["parseValue","value","String","match","WebinyError","undefined","isNaN","parseFloat","NumberScalar","GraphQLScalarType","name","description","serialize","ex","console","log","message","code","data","parseLiteral","ast","kind","Kind","INT","Number","FLOAT","Error"],"sources":["NumberScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\nimport { Kind } from \"graphql/language\";\nimport WebinyError from \"@webiny/error\";\n\nconst parseValue = (value: any) => {\n if (String(value).match(/^0x/) !== null) {\n throw new WebinyError(\"Value sent must be a non-hex number.\", \"INVALID_VALUE\", {\n value\n });\n } else if (typeof value === \"number\") {\n return value;\n } else if (value === null || value === undefined) {\n return null;\n } else if (isNaN(value) === true) {\n throw new WebinyError(\"Value sent must be a number.\", \"INVALID_VALUE\", {\n value\n });\n }\n return parseFloat(value);\n};\n\nexport const NumberScalar = new GraphQLScalarType({\n name: \"Number\",\n description: \"A custom input type to be used with numbers. Supports Int and Float.\",\n serialize: (value: any) => {\n try {\n return parseValue(value);\n } catch (ex) {\n console.log({\n message: \"Value sent must be a number.\",\n code: \"INVALID_VALUE\",\n data: {\n value\n }\n });\n return null;\n }\n },\n parseValue,\n parseLiteral: ast => {\n const value = (ast as any).value;\n if (ast.kind === Kind.INT) {\n return Number(value);\n } else if (ast.kind === Kind.FLOAT) {\n return parseFloat(value);\n }\n throw new Error(`Expected type Number, found {${value}}`);\n }\n});\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,UAAU,GAAIC,KAAD,IAAgB;EAC/B,IAAIC,MAAM,CAACD,KAAD,CAAN,CAAcE,KAAd,CAAoB,KAApB,MAA+B,IAAnC,EAAyC;IACrC,MAAM,IAAIC,cAAJ,CAAgB,sCAAhB,EAAwD,eAAxD,EAAyE;MAC3EH;IAD2E,CAAzE,CAAN;EAGH,CAJD,MAIO,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAClC,OAAOA,KAAP;EACH,CAFM,MAEA,IAAIA,KAAK,KAAK,IAAV,IAAkBA,KAAK,KAAKI,SAAhC,EAA2C;IAC9C,OAAO,IAAP;EACH,CAFM,MAEA,IAAIC,KAAK,CAACL,KAAD,CAAL,KAAiB,IAArB,EAA2B;IAC9B,MAAM,IAAIG,cAAJ,CAAgB,8BAAhB,EAAgD,eAAhD,EAAiE;MACnEH;IADmE,CAAjE,CAAN;EAGH;;EACD,OAAOM,UAAU,CAACN,KAAD,CAAjB;AACH,CAfD;;AAiBO,MAAMO,YAAY,GAAG,IAAIC,0BAAJ,CAAsB;EAC9CC,IAAI,EAAE,QADwC;EAE9CC,WAAW,EAAE,sEAFiC;EAG9CC,SAAS,EAAGX,KAAD,IAAgB;IACvB,IAAI;MACA,OAAOD,UAAU,CAACC,KAAD,CAAjB;IACH,CAFD,CAEE,OAAOY,EAAP,EAAW;MACTC,OAAO,CAACC,GAAR,CAAY;QACRC,OAAO,EAAE,8BADD;QAERC,IAAI,EAAE,eAFE;QAGRC,IAAI,EAAE;UACFjB;QADE;MAHE,CAAZ;MAOA,OAAO,IAAP;IACH;EACJ,CAhB6C;EAiB9CD,UAjB8C;EAkB9CmB,YAAY,EAAEC,GAAG,IAAI;IACjB,MAAMnB,KAAK,GAAImB,GAAD,CAAanB,KAA3B;;IACA,IAAImB,GAAG,CAACC,IAAJ,KAAaC,cAAA,CAAKC,GAAtB,EAA2B;MACvB,OAAOC,MAAM,CAACvB,KAAD,CAAb;IACH,CAFD,MAEO,IAAImB,GAAG,CAACC,IAAJ,KAAaC,cAAA,CAAKG,KAAtB,EAA6B;MAChC,OAAOlB,UAAU,CAACN,KAAD,CAAjB;IACH;;IACD,MAAM,IAAIyB,KAAJ,CAAW,gCAA+BzB,KAAM,GAAhD,CAAN;EACH;AA1B6C,CAAtB,CAArB"}
1
+ {"version":3,"names":["GraphQLScalarType","Kind","WebinyError","parseValue","value","String","match","undefined","isNaN","parseFloat","NumberScalar","name","description","serialize","console","log","message","code","data","parseLiteral","ast","kind","INT","Number","FLOAT","Error"],"sources":["NumberScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\nimport { Kind } from \"graphql/language/index.js\";\nimport WebinyError from \"@webiny/error\";\n\nconst parseValue = (value: any) => {\n if (String(value).match(/^0x/) !== null) {\n throw new WebinyError(\"Value sent must be a non-hex number.\", \"INVALID_VALUE\", {\n value\n });\n } else if (typeof value === \"number\") {\n return value;\n } else if (value === null || value === undefined) {\n return null;\n } else if (isNaN(value) === true) {\n throw new WebinyError(\"Value sent must be a number.\", \"INVALID_VALUE\", {\n value\n });\n }\n return parseFloat(value);\n};\n\nexport const NumberScalar = new GraphQLScalarType({\n name: \"Number\",\n description: \"A custom input type to be used with numbers. Supports Int and Float.\",\n serialize: (value: any) => {\n try {\n return parseValue(value);\n } catch {\n console.log({\n message: \"Value sent must be a number.\",\n code: \"INVALID_VALUE\",\n data: {\n value\n }\n });\n return null;\n }\n },\n parseValue,\n parseLiteral: ast => {\n if (ast.kind === Kind.INT) {\n return Number(ast.value);\n } else if (ast.kind === Kind.FLOAT) {\n return parseFloat(ast.value);\n }\n throw new Error(`Expected type Number, found {${ast.kind}}`);\n }\n});\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,SAAS;AAC3C,SAASC,IAAI,QAAQ,2BAA2B;AAChD,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,UAAU,GAAIC,KAAU,IAAK;EAC/B,IAAIC,MAAM,CAACD,KAAK,CAAC,CAACE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;IACrC,MAAM,IAAIJ,WAAW,CAAC,sCAAsC,EAAE,eAAe,EAAE;MAC3EE;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAClC,OAAOA,KAAK;EAChB,CAAC,MAAM,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKG,SAAS,EAAE;IAC9C,OAAO,IAAI;EACf,CAAC,MAAM,IAAIC,KAAK,CAACJ,KAAK,CAAC,KAAK,IAAI,EAAE;IAC9B,MAAM,IAAIF,WAAW,CAAC,8BAA8B,EAAE,eAAe,EAAE;MACnEE;IACJ,CAAC,CAAC;EACN;EACA,OAAOK,UAAU,CAACL,KAAK,CAAC;AAC5B,CAAC;AAED,OAAO,MAAMM,YAAY,GAAG,IAAIV,iBAAiB,CAAC;EAC9CW,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,sEAAsE;EACnFC,SAAS,EAAGT,KAAU,IAAK;IACvB,IAAI;MACA,OAAOD,UAAU,CAACC,KAAK,CAAC;IAC5B,CAAC,CAAC,MAAM;MACJU,OAAO,CAACC,GAAG,CAAC;QACRC,OAAO,EAAE,8BAA8B;QACvCC,IAAI,EAAE,eAAe;QACrBC,IAAI,EAAE;UACFd;QACJ;MACJ,CAAC,CAAC;MACF,OAAO,IAAI;IACf;EACJ,CAAC;EACDD,UAAU;EACVgB,YAAY,EAAEC,GAAG,IAAI;IACjB,IAAIA,GAAG,CAACC,IAAI,KAAKpB,IAAI,CAACqB,GAAG,EAAE;MACvB,OAAOC,MAAM,CAACH,GAAG,CAAChB,KAAK,CAAC;IAC5B,CAAC,MAAM,IAAIgB,GAAG,CAACC,IAAI,KAAKpB,IAAI,CAACuB,KAAK,EAAE;MAChC,OAAOf,UAAU,CAACW,GAAG,CAAChB,KAAK,CAAC;IAChC;IACA,MAAM,IAAIqB,KAAK,CAAC,gCAAgCL,GAAG,CAACC,IAAI,GAAG,CAAC;EAChE;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
1
  import { GraphQLScalarType } from "graphql";
2
- export declare const RefInput: GraphQLScalarType;
2
+ export declare const RefInputScalar: GraphQLScalarType<string | null, any>;
@@ -1,65 +1,76 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RefInput = void 0;
7
-
8
- var _graphql = require("graphql");
9
-
10
- const isMongoId = value => {
11
- if (/^[0-9a-fA-F]{24}$/.test(value)) {
12
- return value;
1
+ import { GraphQLScalarType } from "graphql";
2
+ const tests = [{
3
+ re: /^([0-9a-zA-Z_-]+)$/,
4
+ message: "Must be a string matching a-z, A-Z, 0-9, underscore (_) or dash(-)!"
5
+ }, {
6
+ re: /^-/,
7
+ message: "Must not start with a dash (-)!"
8
+ }, {
9
+ re: /-$/,
10
+ message: "Must not end with a dash (-)!"
11
+ }, {
12
+ re: /^_/,
13
+ message: "Must not start with an underscore (_)!"
14
+ }, {
15
+ re: /_$/,
16
+ message: "Must not end with an underscore (_)!"
17
+ }];
18
+ const isValidId = value => {
19
+ if (typeof value !== "string" || value.length < 1) {
20
+ throw new Error("Must be a string with at least 1 character!");
13
21
  }
14
-
15
- throw new Error("Must be a valid Mongo ID!");
22
+ for (const test of tests) {
23
+ if (test.re.test(value) === null) {
24
+ throw new Error(test.message);
25
+ }
26
+ }
27
+ return value;
16
28
  };
17
-
18
- const RefInput = new _graphql.GraphQLScalarType({
29
+ export const RefInputScalar = new GraphQLScalarType({
19
30
  name: "RefInput",
20
31
  description: "A custom input type to be used with references. Supports plain ID and `{ id: ID }` Object literal.",
32
+ /**
33
+ * We can set value as any because we are handling it.
34
+ */
21
35
  serialize: value => {
22
36
  if (!value || value.id === null) {
23
37
  return null;
24
38
  }
25
-
26
39
  return typeof value === "string" ? value : value.id;
27
40
  },
41
+ /**
42
+ * We can set value as any because we are handling it.
43
+ */
28
44
  parseValue: value => {
29
45
  if (!value || value.id === null) {
30
46
  return null;
31
47
  }
32
-
33
48
  if (typeof value === "string") {
34
- return isMongoId(value);
49
+ return isValidId(value);
35
50
  }
36
-
37
51
  if ("id" in value) {
38
- return isMongoId(value.id);
52
+ return isValidId(value.id);
39
53
  }
40
-
41
54
  throw new Error("Invalid RefInput value!");
42
55
  },
43
56
  parseLiteral: ast => {
44
57
  if (ast.kind === "StringValue") {
45
- return isMongoId(ast.value);
58
+ return isValidId(ast.value);
46
59
  }
47
-
48
60
  if (ast.kind === "ObjectValue") {
49
61
  for (let i = 0; i < ast.fields.length; i++) {
50
62
  const {
51
63
  name,
52
64
  value
53
65
  } = ast.fields[i];
54
-
55
66
  if (name.value === "id") {
56
- // @ts-ignore
57
- return isMongoId(value.value);
67
+ // @ts-expect-error
68
+ return isValidId(value.value);
58
69
  }
59
70
  }
60
71
  }
61
-
62
72
  throw new Error("Invalid RefInput value!");
63
73
  }
64
74
  });
65
- exports.RefInput = RefInput;
75
+
76
+ //# sourceMappingURL=RefInputScalar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isMongoId","value","test","Error","RefInput","GraphQLScalarType","name","description","serialize","id","parseValue","parseLiteral","ast","kind","i","fields","length"],"sources":["RefInputScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\n\nconst isMongoId = (value: any): string => {\n if (/^[0-9a-fA-F]{24}$/.test(value)) {\n return value;\n }\n\n throw new Error(\"Must be a valid Mongo ID!\");\n};\n\nexport const RefInput = new GraphQLScalarType({\n name: \"RefInput\",\n description:\n \"A custom input type to be used with references. Supports plain ID and `{ id: ID }` Object literal.\",\n serialize: value => {\n if (!value || value.id === null) {\n return null;\n }\n\n return typeof value === \"string\" ? value : value.id;\n },\n parseValue: value => {\n if (!value || value.id === null) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return isMongoId(value);\n }\n\n if (\"id\" in value) {\n return isMongoId(value.id);\n }\n\n throw new Error(\"Invalid RefInput value!\");\n },\n parseLiteral: ast => {\n if (ast.kind === \"StringValue\") {\n return isMongoId(ast.value);\n }\n\n if (ast.kind === \"ObjectValue\") {\n for (let i = 0; i < ast.fields.length; i++) {\n const { name, value } = ast.fields[i];\n if (name.value === \"id\") {\n // @ts-ignore\n return isMongoId(value.value);\n }\n }\n }\n\n throw new Error(\"Invalid RefInput value!\");\n }\n});\n"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,SAAS,GAAIC,KAAD,IAAwB;EACtC,IAAI,oBAAoBC,IAApB,CAAyBD,KAAzB,CAAJ,EAAqC;IACjC,OAAOA,KAAP;EACH;;EAED,MAAM,IAAIE,KAAJ,CAAU,2BAAV,CAAN;AACH,CAND;;AAQO,MAAMC,QAAQ,GAAG,IAAIC,0BAAJ,CAAsB;EAC1CC,IAAI,EAAE,UADoC;EAE1CC,WAAW,EACP,oGAHsC;EAI1CC,SAAS,EAAEP,KAAK,IAAI;IAChB,IAAI,CAACA,KAAD,IAAUA,KAAK,CAACQ,EAAN,KAAa,IAA3B,EAAiC;MAC7B,OAAO,IAAP;IACH;;IAED,OAAO,OAAOR,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCA,KAAK,CAACQ,EAAjD;EACH,CAVyC;EAW1CC,UAAU,EAAET,KAAK,IAAI;IACjB,IAAI,CAACA,KAAD,IAAUA,KAAK,CAACQ,EAAN,KAAa,IAA3B,EAAiC;MAC7B,OAAO,IAAP;IACH;;IAED,IAAI,OAAOR,KAAP,KAAiB,QAArB,EAA+B;MAC3B,OAAOD,SAAS,CAACC,KAAD,CAAhB;IACH;;IAED,IAAI,QAAQA,KAAZ,EAAmB;MACf,OAAOD,SAAS,CAACC,KAAK,CAACQ,EAAP,CAAhB;IACH;;IAED,MAAM,IAAIN,KAAJ,CAAU,yBAAV,CAAN;EACH,CAzByC;EA0B1CQ,YAAY,EAAEC,GAAG,IAAI;IACjB,IAAIA,GAAG,CAACC,IAAJ,KAAa,aAAjB,EAAgC;MAC5B,OAAOb,SAAS,CAACY,GAAG,CAACX,KAAL,CAAhB;IACH;;IAED,IAAIW,GAAG,CAACC,IAAJ,KAAa,aAAjB,EAAgC;MAC5B,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,GAAG,CAACG,MAAJ,CAAWC,MAA/B,EAAuCF,CAAC,EAAxC,EAA4C;QACxC,MAAM;UAAER,IAAF;UAAQL;QAAR,IAAkBW,GAAG,CAACG,MAAJ,CAAWD,CAAX,CAAxB;;QACA,IAAIR,IAAI,CAACL,KAAL,KAAe,IAAnB,EAAyB;UACrB;UACA,OAAOD,SAAS,CAACC,KAAK,CAACA,KAAP,CAAhB;QACH;MACJ;IACJ;;IAED,MAAM,IAAIE,KAAJ,CAAU,yBAAV,CAAN;EACH;AA1CyC,CAAtB,CAAjB"}
1
+ {"version":3,"names":["GraphQLScalarType","tests","re","message","isValidId","value","length","Error","test","RefInputScalar","name","description","serialize","id","parseValue","parseLiteral","ast","kind","i","fields"],"sources":["RefInputScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\n\nconst tests = [\n {\n re: /^([0-9a-zA-Z_-]+)$/,\n message: \"Must be a string matching a-z, A-Z, 0-9, underscore (_) or dash(-)!\"\n },\n {\n re: /^-/,\n message: \"Must not start with a dash (-)!\"\n },\n {\n re: /-$/,\n message: \"Must not end with a dash (-)!\"\n },\n {\n re: /^_/,\n message: \"Must not start with an underscore (_)!\"\n },\n {\n re: /_$/,\n message: \"Must not end with an underscore (_)!\"\n }\n];\n\nconst isValidId = (value: any): string => {\n if (typeof value !== \"string\" || value.length < 1) {\n throw new Error(\"Must be a string with at least 1 character!\");\n }\n for (const test of tests) {\n if (test.re.test(value) === null) {\n throw new Error(test.message);\n }\n }\n return value;\n};\n\nexport const RefInputScalar = new GraphQLScalarType({\n name: \"RefInput\",\n description:\n \"A custom input type to be used with references. Supports plain ID and `{ id: ID }` Object literal.\",\n /**\n * We can set value as any because we are handling it.\n */\n serialize: (value: any) => {\n if (!value || value.id === null) {\n return null;\n }\n\n return typeof value === \"string\" ? value : value.id;\n },\n /**\n * We can set value as any because we are handling it.\n */\n parseValue: (value: any) => {\n if (!value || value.id === null) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return isValidId(value);\n }\n\n if (\"id\" in value) {\n return isValidId(value.id);\n }\n\n throw new Error(\"Invalid RefInput value!\");\n },\n parseLiteral: ast => {\n if (ast.kind === \"StringValue\") {\n return isValidId(ast.value);\n }\n\n if (ast.kind === \"ObjectValue\") {\n for (let i = 0; i < ast.fields.length; i++) {\n const { name, value } = ast.fields[i];\n if (name.value === \"id\") {\n // @ts-expect-error\n return isValidId(value.value);\n }\n }\n }\n\n throw new Error(\"Invalid RefInput value!\");\n }\n});\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,SAAS;AAE3C,MAAMC,KAAK,GAAG,CACV;EACIC,EAAE,EAAE,oBAAoB;EACxBC,OAAO,EAAE;AACb,CAAC,EACD;EACID,EAAE,EAAE,IAAI;EACRC,OAAO,EAAE;AACb,CAAC,EACD;EACID,EAAE,EAAE,IAAI;EACRC,OAAO,EAAE;AACb,CAAC,EACD;EACID,EAAE,EAAE,IAAI;EACRC,OAAO,EAAE;AACb,CAAC,E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AI,KAAK,aAAa,EAAE;MAC5B,OAAOb,SAAS,CAACY,GAAG,CAACX,KAAK,CAAC;IAC/B;IAEA,IAAIW,GAAG,CAACC,IAAI,KAAK,aAAa,EAAE;MAC5B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,CAACb,MAAM,EAAEY,CAAC,EAAE,EAAE;QACxC,MAAM;UAAER,IAAI;UAAEL;QAAM,CAAC,GAAGW,GAAG,CAACG,MAAM,CAACD,CAAC,CAAC;QACrC,IAAIR,IAAI,CAACL,KAAK,KAAK,IAAI,EAAE;UACrB;UACA,OAAOD,SAAS,CAACC,KAAK,CAACA,KAAK,CAAC;QACjC;MACJ;IACJ;IAEA,MAAM,IAAIE,KAAK,CAAC,yBAAyB,CAAC;EAC9C;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
1
  import { GraphQLScalarType } from "graphql";
2
- export declare const TimeScalar: GraphQLScalarType;
2
+ export declare const TimeScalar: GraphQLScalarType<string, string>;
@@ -1,56 +1,38 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.TimeScalar = void 0;
9
-
10
- var _graphql = require("graphql");
11
-
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
-
1
+ import { GraphQLScalarType } from "graphql";
2
+ import WebinyError from "@webiny/error";
14
3
  const re = /^([0-9]{2}):([0-9]{2})(:([0-9]{2}))?$/;
15
-
16
4
  const parseTime = value => {
17
- if (!value || value.match(re) === null) {
18
- throw new _error.default("Value does not look like time.", "TIME_VALIDATION_ERROR", {
5
+ if (typeof value !== "string" || !value || value.match(re) === null) {
6
+ throw new WebinyError("Value does not look like time.", "TIME_VALIDATION_ERROR", {
19
7
  value
20
8
  });
21
9
  }
22
-
23
10
  const parsed = value.split(":").map(Number);
24
-
25
11
  if (parsed.length < 2) {
26
- throw new _error.default(`Could not parse the value.`, "TIME_VALIDATION_ERROR", {
12
+ throw new WebinyError(`Could not parse the value.`, "TIME_VALIDATION_ERROR", {
27
13
  value
28
14
  });
29
15
  }
30
-
31
16
  const [hours, minutes, seconds = 0] = parsed;
32
-
33
17
  if (hours >= 24) {
34
- throw new _error.default(`There cannot be more than 24 hours.`, "TIME_VALIDATION_ERROR", {
18
+ throw new WebinyError(`There cannot be more than 24 hours.`, "TIME_VALIDATION_ERROR", {
35
19
  value
36
20
  });
37
21
  } else if (minutes >= 60) {
38
- throw new _error.default(`There cannot be more than 59 minutes.`, "TIME_VALIDATION_ERROR", {
22
+ throw new WebinyError(`There cannot be more than 59 minutes.`, "TIME_VALIDATION_ERROR", {
39
23
  value
40
24
  });
41
25
  } else if (seconds >= 60) {
42
- throw new _error.default(`There cannot be more than 59 seconds.`, "TIME_VALIDATION_ERROR", {
26
+ throw new WebinyError(`There cannot be more than 59 seconds.`, "TIME_VALIDATION_ERROR", {
43
27
  value
44
28
  });
45
29
  }
46
-
47
30
  return {
48
31
  hours,
49
32
  minutes,
50
33
  seconds
51
34
  };
52
35
  };
53
-
54
36
  const convertToTime = value => {
55
37
  const {
56
38
  hours,
@@ -59,8 +41,7 @@ const convertToTime = value => {
59
41
  } = parseTime(value);
60
42
  return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
61
43
  };
62
-
63
- const TimeScalar = new _graphql.GraphQLScalarType({
44
+ export const TimeScalar = new GraphQLScalarType({
64
45
  name: "Time",
65
46
  description: "A custom type to support time-only input.",
66
47
  // sending to client
@@ -68,4 +49,5 @@ const TimeScalar = new _graphql.GraphQLScalarType({
68
49
  // received from client
69
50
  parseValue: convertToTime
70
51
  });
71
- exports.TimeScalar = TimeScalar;
52
+
53
+ //# sourceMappingURL=TimeScalar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["re","parseTime","value","match","WebinyError","parsed","split","map","Number","length","hours","minutes","seconds","convertToTime","String","padStart","TimeScalar","GraphQLScalarType","name","description","serialize","parseValue"],"sources":["TimeScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\nimport WebinyError from \"@webiny/error\";\n\nconst re = /^([0-9]{2}):([0-9]{2})(:([0-9]{2}))?$/;\n\nconst parseTime = (value?: string) => {\n if (!value || value.match(re) === null) {\n throw new WebinyError(\"Value does not look like time.\", \"TIME_VALIDATION_ERROR\", { value });\n }\n const parsed = value.split(\":\").map(Number);\n if (parsed.length < 2) {\n throw new WebinyError(`Could not parse the value.`, \"TIME_VALIDATION_ERROR\", { value });\n }\n const [hours, minutes, seconds = 0] = parsed;\n if (hours >= 24) {\n throw new WebinyError(`There cannot be more than 24 hours.`, \"TIME_VALIDATION_ERROR\", {\n value\n });\n } else if (minutes >= 60) {\n throw new WebinyError(`There cannot be more than 59 minutes.`, \"TIME_VALIDATION_ERROR\", {\n value\n });\n } else if (seconds >= 60) {\n throw new WebinyError(`There cannot be more than 59 seconds.`, \"TIME_VALIDATION_ERROR\", {\n value\n });\n }\n return {\n hours,\n minutes,\n seconds\n };\n};\n\nconst convertToTime = (value: string): string => {\n const { hours, minutes, seconds } = parseTime(value);\n return `${String(hours).padStart(2, \"0\")}:${String(minutes).padStart(2, \"0\")}:${String(\n seconds\n ).padStart(2, \"0\")}`;\n};\n\nexport const TimeScalar = new GraphQLScalarType({\n name: \"Time\",\n description: \"A custom type to support time-only input.\",\n // sending to client\n serialize: convertToTime,\n // received from client\n parseValue: convertToTime\n});\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA,MAAMA,EAAE,GAAG,uCAAX;;AAEA,MAAMC,SAAS,GAAIC,KAAD,IAAoB;EAClC,IAAI,CAACA,KAAD,IAAUA,KAAK,CAACC,KAAN,CAAYH,EAAZ,MAAoB,IAAlC,EAAwC;IACpC,MAAM,IAAII,cAAJ,CAAgB,gCAAhB,EAAkD,uBAAlD,EAA2E;MAAEF;IAAF,CAA3E,CAAN;EACH;;EACD,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U,GAAG,IAAIC,0BAAJ,CAAsB;EAC5CC,IAAI,EAAE,MADsC;EAE5CC,WAAW,EAAE,2CAF+B;EAG5C;EACAC,SAAS,EAAEP,aAJiC;EAK5C;EACAQ,UAAU,EAAER;AANgC,CAAtB,CAAnB"}
1
+ {"version":3,"names":["GraphQLScalarType","WebinyError","re","parseTime","value","match","parsed","split","map","Number","length","hours","minutes","seconds","convertToTime","String","padStart","TimeScalar","name","description","serialize","parseValue"],"sources":["TimeScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\nimport WebinyError from \"@webiny/error\";\n\nconst re = /^([0-9]{2}):([0-9]{2})(:([0-9]{2}))?$/;\n\nconst parseTime = (value?: unknown) => {\n if (typeof value !== \"string\" || !value || value.match(re) === null) {\n throw new WebinyError(\"Value does not look like time.\", \"TIME_VALIDATION_ERROR\", { value });\n }\n const parsed = value.split(\":\").map(Number);\n if (parsed.length < 2) {\n throw new WebinyError(`Could not parse the value.`, \"TIME_VALIDATION_ERROR\", { value });\n }\n const [hours, minutes, seconds = 0] = parsed;\n if (hours >= 24) {\n throw new WebinyError(`There cannot be more than 24 hours.`, \"TIME_VALIDATION_ERROR\", {\n value\n });\n } else if (minutes >= 60) {\n throw new WebinyError(`There cannot be more than 59 minutes.`, \"TIME_VALIDATION_ERROR\", {\n value\n });\n } else if (seconds >= 60) {\n throw new WebinyError(`There cannot be more than 59 seconds.`, \"TIME_VALIDATION_ERROR\", {\n value\n });\n }\n return {\n hours,\n minutes,\n seconds\n };\n};\n\nconst convertToTime = (value: unknown): string => {\n const { hours, minutes, seconds } = parseTime(value);\n return `${String(hours).padStart(2, \"0\")}:${String(minutes).padStart(2, \"0\")}:${String(\n seconds\n ).padStart(2, \"0\")}`;\n};\n\nexport const TimeScalar = new GraphQLScalarType({\n name: \"Time\",\n description: \"A custom type to support time-only input.\",\n // sending to client\n serialize: convertToTime,\n // received from client\n parseValue: convertToTime\n});\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,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AAO,GAAGW,MAAM,CAACJ,KAAK,CAAC,CAACK,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAID,MAAM,CAACH,OAAO,CAAC,CAACI,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAID,MAAM,CAClFF,OACJ,CAAC,CAACG,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;AACxB,CAAC;AAED,OAAO,MAAMC,UAAU,GAAG,IAAIjB,iBAAiB,CAAC;EAC5CkB,IAAI,EAAE,MAAM;EACZC,WAAW,EAAE,2CAA2C;EACxD;EACAC,SAAS,EAAEN,aAAa;EACxB;EACAO,UAAU,EAAEP;AAChB,CAAC,CAAC","ignoreList":[]}
@@ -1,9 +1,10 @@
1
- export * from "./AnyScalar";
2
- export * from "./DateScalar";
3
- export * from "./DateTimeScalar";
4
- export * from "./DateTimeZScalar";
5
- export * from "./JsonScalar";
6
- export * from "./LongScalar";
7
- export * from "./NumberScalar";
8
- export * from "./RefInputScalar";
9
- export * from "./TimeScalar";
1
+ export * from "./AnyScalar.js";
2
+ export * from "./DateScalar.js";
3
+ export * from "./DateTimeScalar.js";
4
+ export * from "./DateTimeZScalar.js";
5
+ export * from "./JsonScalar.js";
6
+ export * from "./LongScalar.js";
7
+ export * from "./NumberScalar.js";
8
+ export * from "./RefInputScalar.js";
9
+ export * from "./TimeScalar.js";
10
+ export * from "./IconScalar.js";
@@ -1,122 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _AnyScalar = require("./AnyScalar");
8
-
9
- Object.keys(_AnyScalar).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _AnyScalar[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _AnyScalar[key];
16
- }
17
- });
18
- });
19
-
20
- var _DateScalar = require("./DateScalar");
21
-
22
- Object.keys(_DateScalar).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _DateScalar[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function () {
28
- return _DateScalar[key];
29
- }
30
- });
31
- });
32
-
33
- var _DateTimeScalar = require("./DateTimeScalar");
34
-
35
- Object.keys(_DateTimeScalar).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _DateTimeScalar[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _DateTimeScalar[key];
42
- }
43
- });
44
- });
45
-
46
- var _DateTimeZScalar = require("./DateTimeZScalar");
47
-
48
- Object.keys(_DateTimeZScalar).forEach(function (key) {
49
- if (key === "default" || key === "__esModule") return;
50
- if (key in exports && exports[key] === _DateTimeZScalar[key]) return;
51
- Object.defineProperty(exports, key, {
52
- enumerable: true,
53
- get: function () {
54
- return _DateTimeZScalar[key];
55
- }
56
- });
57
- });
58
-
59
- var _JsonScalar = require("./JsonScalar");
60
-
61
- Object.keys(_JsonScalar).forEach(function (key) {
62
- if (key === "default" || key === "__esModule") return;
63
- if (key in exports && exports[key] === _JsonScalar[key]) return;
64
- Object.defineProperty(exports, key, {
65
- enumerable: true,
66
- get: function () {
67
- return _JsonScalar[key];
68
- }
69
- });
70
- });
71
-
72
- var _LongScalar = require("./LongScalar");
73
-
74
- Object.keys(_LongScalar).forEach(function (key) {
75
- if (key === "default" || key === "__esModule") return;
76
- if (key in exports && exports[key] === _LongScalar[key]) return;
77
- Object.defineProperty(exports, key, {
78
- enumerable: true,
79
- get: function () {
80
- return _LongScalar[key];
81
- }
82
- });
83
- });
84
-
85
- var _NumberScalar = require("./NumberScalar");
86
-
87
- Object.keys(_NumberScalar).forEach(function (key) {
88
- if (key === "default" || key === "__esModule") return;
89
- if (key in exports && exports[key] === _NumberScalar[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function () {
93
- return _NumberScalar[key];
94
- }
95
- });
96
- });
97
-
98
- var _RefInputScalar = require("./RefInputScalar");
99
-
100
- Object.keys(_RefInputScalar).forEach(function (key) {
101
- if (key === "default" || key === "__esModule") return;
102
- if (key in exports && exports[key] === _RefInputScalar[key]) return;
103
- Object.defineProperty(exports, key, {
104
- enumerable: true,
105
- get: function () {
106
- return _RefInputScalar[key];
107
- }
108
- });
109
- });
110
-
111
- var _TimeScalar = require("./TimeScalar");
112
-
113
- Object.keys(_TimeScalar).forEach(function (key) {
114
- if (key === "default" || key === "__esModule") return;
115
- if (key in exports && exports[key] === _TimeScalar[key]) return;
116
- Object.defineProperty(exports, key, {
117
- enumerable: true,
118
- get: function () {
119
- return _TimeScalar[key];
120
- }
121
- });
122
- });
1
+ export * from "./AnyScalar.js";
2
+ export * from "./DateScalar.js";
3
+ export * from "./DateTimeScalar.js";
4
+ export * from "./DateTimeZScalar.js";
5
+ export * from "./JsonScalar.js";
6
+ export * from "./LongScalar.js";
7
+ export * from "./NumberScalar.js";
8
+ export * from "./RefInputScalar.js";
9
+ export * from "./TimeScalar.js";
10
+ export * from "./IconScalar.js";
11
+
12
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./AnyScalar\";\nexport * from \"./DateScalar\";\nexport * from \"./DateTimeScalar\";\nexport * from \"./DateTimeZScalar\";\nexport * from \"./JsonScalar\";\nexport * from \"./LongScalar\";\nexport * from \"./NumberScalar\";\nexport * from \"./RefInputScalar\";\nexport * from \"./TimeScalar\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./AnyScalar.js\";\nexport * from \"./DateScalar.js\";\nexport * from \"./DateTimeScalar.js\";\nexport * from \"./DateTimeZScalar.js\";\nexport * from \"./JsonScalar.js\";\nexport * from \"./LongScalar.js\";\nexport * from \"./NumberScalar.js\";\nexport * from \"./RefInputScalar.js\";\nexport * from \"./TimeScalar.js\";\nexport * from \"./IconScalar.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { PluginCollection } from "@webiny/plugins/types";
2
- import { HandlerGraphQLOptions } from "./types";
3
- declare const _default: (options?: HandlerGraphQLOptions) => PluginCollection;
1
+ import type { Plugin } from "@webiny/plugins/types.js";
2
+ import type { HandlerGraphQLOptions } from "./types.js";
3
+ declare const _default: (options?: HandlerGraphQLOptions) => Plugin[];
4
4
  export default _default;
@@ -1,55 +1,45 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _boolean = require("boolean");
11
-
12
- var _handler = require("@webiny/handler");
13
-
14
- var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
- var _createGraphQLSchema = require("./createGraphQLSchema");
17
-
18
- var _debugPlugins = _interopRequireDefault(require("./debugPlugins"));
19
-
20
- var _processRequestBody = _interopRequireDefault(require("./processRequestBody"));
21
-
1
+ import { boolean } from "boolean";
2
+ import { RoutePlugin } from "@webiny/handler";
3
+ import WebinyError from "@webiny/error";
4
+ import { createGraphQLSchema, getSchemaPlugins } from "./createGraphQLSchema.js";
5
+ import debugPlugins from "./debugPlugins.js";
6
+ import { processRequestBody } from "./processRequestBody.js";
7
+ import { createRequestBody } from "./createRequestBody.js";
22
8
  const DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year
23
9
 
24
- /**
25
- * TODO Until we figure out how to better convert incoming body, we will leave it as any.
26
- */
10
+ const createCacheKey = context => {
11
+ const plugins = getSchemaPlugins(context);
12
+ // TODO: in the near future, we have to assign a fixed name to every
13
+ // TODO: GraphQLSchema plugin, to be able to create a reliable cache key.
27
14
 
28
- const createRequestBody = body => {
29
- return typeof body === "string" ? JSON.parse(body) : body;
15
+ // TODO: `getCurrentTenant` should be injected as a parameter.
16
+ // @ts-expect-error TODO: We should not be accessing `context` like this here.
17
+ const tenant = context.tenancy?.getCurrentTenant();
18
+ return [tenant ? `tenant:${tenant.id}` : null, plugins.length.toString()].filter(Boolean).join("#");
30
19
  };
31
-
32
20
  const formatErrorPayload = error => {
33
- if (error instanceof _error.default) {
34
- return {
21
+ if (error instanceof WebinyError) {
22
+ return JSON.stringify({
23
+ type: "CoreGraphQLWebinyError",
35
24
  message: error.message,
36
25
  code: error.code,
37
- data: error.data
38
- };
26
+ data: error.data,
27
+ stack: error.stack
28
+ });
39
29
  }
40
-
41
- return {
30
+ return JSON.stringify({
31
+ type: "Error",
42
32
  name: error.name,
43
33
  message: error.message,
44
34
  stack: error.stack
45
- };
35
+ });
46
36
  };
47
-
48
- var _default = (options = {}) => {
37
+ export default (options = {}) => {
49
38
  let schema = undefined;
50
- const debug = (0, _boolean.boolean)(options.debug);
51
- const path = (options === null || options === void 0 ? void 0 : options.path) || "/graphql";
52
- const route = new _handler.RoutePlugin(async ({
39
+ let cacheKey = undefined;
40
+ const debug = boolean(options.debug);
41
+ const path = options?.path || "/graphql";
42
+ const route = new RoutePlugin(async ({
53
43
  onPost,
54
44
  onOptions,
55
45
  context
@@ -57,26 +47,47 @@ var _default = (options = {}) => {
57
47
  onOptions(path, async (_, reply) => {
58
48
  return reply.status(204).headers({
59
49
  "Cache-Control": `public, max-age=${DEFAULT_CACHE_MAX_AGE}`
60
- }).send({});
50
+ }).send({}).hijack();
61
51
  });
62
52
  onPost(path, async (request, reply) => {
63
- if (!schema) {
53
+ const contextCacheKey = createCacheKey(context);
54
+ if (!schema || cacheKey !== contextCacheKey) {
64
55
  try {
65
- schema = (0, _createGraphQLSchema.createGraphQLSchema)(context);
56
+ schema = await createGraphQLSchema(context);
57
+ cacheKey = contextCacheKey;
66
58
  } catch (ex) {
67
59
  return reply.code(500).send(formatErrorPayload(ex));
68
60
  }
69
61
  }
70
-
71
- const body = createRequestBody(request.body);
72
- const result = await (0, _processRequestBody.default)(body, schema, context);
73
- return reply.status(200).send(result);
62
+ let body;
63
+ try {
64
+ body = createRequestBody(request.body);
65
+ } catch (ex) {
66
+ console.error(`Error while creating the body request.`);
67
+ console.error(formatErrorPayload(ex));
68
+ throw ex;
69
+ }
70
+ try {
71
+ const result = await processRequestBody(body, schema, context);
72
+ /**
73
+ * IMPORTANT! Do not send anything if reply was already sent.
74
+ */
75
+ if (reply.sent) {
76
+ console.warn("Reply already sent, cannot send the result (handler-graphql).");
77
+ return reply;
78
+ }
79
+ return reply.status(200).send(result);
80
+ } catch (ex) {
81
+ console.error(`Error while processing the body request.`);
82
+ console.error(formatErrorPayload(ex));
83
+ throw ex;
84
+ }
74
85
  });
75
86
  });
76
87
  route.name = "handler.graphql.route.default";
77
- return [...(debug ? (0, _debugPlugins.default)() : []), {
88
+ return [...(debug ? debugPlugins() : []), {
78
89
  type: "wcp-telemetry-tracker"
79
90
  }, route];
80
91
  };
81
92
 
82
- exports.default = _default;
93
+ //# sourceMappingURL=createGraphQLHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_CACHE_MAX_AGE","createRequestBody","body","JSON","parse","formatErrorPayload","error","WebinyError","message","code","data","name","stack","options","schema","undefined","debug","boolean","path","route","RoutePlugin","onPost","onOptions","context","_","reply","status","headers","send","request","createGraphQLSchema","ex","result","processRequestBody","debugPlugins","type"],"sources":["createGraphQLHandler.ts"],"sourcesContent":["import { boolean } from \"boolean\";\nimport { GraphQLSchema } from \"graphql\";\nimport { RoutePlugin } from \"@webiny/handler\";\nimport WebinyError from \"@webiny/error\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport { HandlerGraphQLOptions } from \"./types\";\nimport { createGraphQLSchema } from \"./createGraphQLSchema\";\nimport debugPlugins from \"./debugPlugins\";\nimport processRequestBody from \"./processRequestBody\";\n\nconst DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year\n\n/**\n * TODO Until we figure out how to better convert incoming body, we will leave it as any.\n */\nconst createRequestBody = (body: any): any => {\n return typeof body === \"string\" ? JSON.parse(body) : body;\n};\n\nconst formatErrorPayload = (error: Error) => {\n if (error instanceof WebinyError) {\n return {\n message: error.message,\n code: error.code,\n data: error.data\n };\n }\n\n return {\n name: error.name,\n message: error.message,\n stack: error.stack\n };\n};\n\nexport default (options: HandlerGraphQLOptions = {}): PluginCollection => {\n let schema: GraphQLSchema | undefined = undefined;\n\n const debug = boolean(options.debug);\n\n const path = options?.path || \"/graphql\";\n\n const route = new RoutePlugin(async ({ onPost, onOptions, context }) => {\n onOptions(path, async (_, reply) => {\n return reply\n .status(204)\n .headers({\n \"Cache-Control\": `public, max-age=${DEFAULT_CACHE_MAX_AGE}`\n })\n .send({});\n });\n onPost(path, async (request, reply) => {\n if (!schema) {\n try {\n schema = createGraphQLSchema(context);\n } catch (ex) {\n return reply.code(500).send(formatErrorPayload(ex));\n }\n }\n const body = createRequestBody(request.body);\n const result = await processRequestBody(body, schema, context);\n return reply.status(200).send(result);\n });\n });\n\n route.name = \"handler.graphql.route.default\";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AAsB;MADrD,CAFN,EAKF4B,IALE,CAKG,EALH,CAAP;IAMH,CAPQ,CAAT;IAQAP,MAAM,CAACH,IAAD,EAAO,OAAOW,OAAP,EAAgBJ,KAAhB,KAA0B;MACnC,IAAI,CAACX,MAAL,EAAa;QACT,IAAI;UACAA,MAAM,GAAG,IAAAgB,wCAAA,EAAoBP,OAApB,CAAT;QACH,CAFD,CAEE,OAAOQ,EAAP,EAAW;UACT,OAAON,KAAK,CAAChB,IAAN,CAAW,GAAX,EAAgBmB,IAAhB,CAAqBvB,kBAAkB,CAAC0B,EAAD,CAAvC,CAAP;QACH;MACJ;;MACD,MAAM7B,IAAI,GAAGD,iBAAiB,CAAC4B,OAAO,CAAC3B,IAAT,CAA9B;MACA,MAAM8B,MAAM,GAAG,MAAM,IAAAC,2BAAA,EAAmB/B,IAAnB,EAAyBY,MAAzB,EAAiCS,OAAjC,CAArB;MACA,OAAOE,KAAK,CAACC,MAAN,CAAa,GAAb,EAAkBE,IAAlB,CAAuBI,MAAvB,CAAP;IACH,CAXK,CAAN;EAYH,CArBa,CAAd;EAuBAb,KAAK,CAACR,IAAN,GAAa,+BAAb;EAEA,OAAO,CACH,IAAIK,KAAK,GAAG,IAAAkB,qBAAA,GAAH,GAAoB,EAA7B,CADG,EAEH;IACIC,IAAI,EAAE;EADV,CAFG,EAKHhB,KALG,CAAP;AAOH,C"}
1
+ {"version":3,"names":["boolean","RoutePlugin","WebinyError","createGraphQLSchema","getSchemaPlugins","debugPlugins","processRequestBody","createRequestBody","DEFAULT_CACHE_MAX_AGE","createCacheKey","context","plugins","tenant","tenancy","getCurrentTenant","id","length","toString","filter","Boolean","join","formatErrorPayload","error","JSON","stringify","type","message","code","data","stack","name","options","schema","undefined","cacheKey","debug","path","route","onPost","onOptions","_","reply","status","headers","send","hijack","request","contextCacheKey","ex","body","console","result","sent","warn"],"sources":["createGraphQLHandler.ts"],"sourcesContent":["import { boolean } from \"boolean\";\nimport type { GraphQLSchema } from \"graphql\";\nimport type { Context } from \"@webiny/handler\";\nimport { RoutePlugin } from \"@webiny/handler\";\nimport WebinyError from \"@webiny/error\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport type { GraphQLRequestBody, HandlerGraphQLOptions } from \"./types.js\";\nimport { createGraphQLSchema, getSchemaPlugins } from \"./createGraphQLSchema.js\";\nimport debugPlugins from \"./debugPlugins.js\";\nimport { processRequestBody } from \"./processRequestBody.js\";\nimport { createRequestBody } from \"~/createRequestBody.js\";\n\nconst DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year\n\nconst createCacheKey = (context: Context) => {\n const plugins = getSchemaPlugins(context);\n // TODO: in the near future, we have to assign a fixed name to every\n // TODO: GraphQLSchema plugin, to be able to create a reliable cache key.\n\n // TODO: `getCurrentTenant` should be injected as a parameter.\n // @ts-expect-error TODO: We should not be accessing `context` like this here.\n const tenant = context.tenancy?.getCurrentTenant();\n\n return [tenant ? `tenant:${tenant.id}` : null, plugins.length.toString()]\n .filter(Boolean)\n .join(\"#\");\n};\n\nconst formatErrorPayload = (error: Error): string => {\n if (error instanceof WebinyError) {\n return JSON.stringify({\n type: \"CoreGraphQLWebinyError\",\n message: error.message,\n code: error.code,\n data: error.data,\n stack: error.stack\n });\n }\n\n return JSON.stringify({\n type: \"Error\",\n name: error.name,\n message: error.message,\n stack: error.stack\n });\n};\n\nexport default (options: HandlerGraphQLOptions = {}): Plugin[] => {\n let schema: GraphQLSchema | undefined = undefined;\n let cacheKey: string | undefined = undefined;\n\n const debug = boolean(options.debug);\n\n const path = options?.path || \"/graphql\";\n\n const route = new RoutePlugin(async ({ onPost, onOptions, context }) => {\n onOptions(path, async (_, reply) => {\n return reply\n .status(204)\n .headers({\n \"Cache-Control\": `public, max-age=${DEFAULT_CACHE_MAX_AGE}`\n })\n .send({})\n .hijack();\n });\n onPost(path, async (request, reply) => {\n const contextCacheKey = createCacheKey(context as Context);\n if (!schema || cacheKey !== contextCacheKey) {\n try {\n schema = await createGraphQLSchema(context);\n cacheKey = contextCacheKey;\n } catch (ex) {\n return reply.code(500).send(formatErrorPayload(ex));\n }\n }\n let body: GraphQLRequestBody | GraphQLRequestBody[];\n try {\n body = createRequestBody(request.body);\n } catch (ex) {\n console.error(`Error while creating the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n try {\n const result = await processRequestBody(body, schema, context);\n /**\n * IMPORTANT! Do not send anything if reply was already sent.\n */\n if (reply.sent) {\n console.warn(\"Reply already sent, cannot send the result (handler-graphql).\");\n return reply;\n }\n return reply.status(200).send(result);\n } catch (ex) {\n console.error(`Error while processing the body request.`);\n console.error(formatErrorPayload(ex));\n throw ex;\n }\n });\n });\n\n route.name = \"handler.graphql.route.default\";\n\n return [\n ...(debug ? debugPlugins() : []),\n {\n type: \"wcp-telemetry-tracker\"\n },\n route\n ];\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,SAAS;AAGjC,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,WAAW,MAAM,eAAe;AAGvC,SAASC,mBAAmB,EAAEC,gBAAgB;AAC9C,OAAOC,YAAY;AACnB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAE1B,MAAMC,qBAAqB,GAAG,QAAQ,CAAC,CAAC;;AAExC,MAAMC,cAAc,GAAIC,OAAgB,IAAK;EACzC,MAAMC,OAAO,GAAGP,gBAAgB,CAACM,OAAO,CAAC;EACzC;EACA;;EAEA;EACA;EACA,MAAME,MAAM,GAAGF,OAAO,CAACG,OAAO,EAAEC,gBAAgB,CAAC,CAAC;EAElD,OAAO,CAACF,MAAM,GAAG,UAAUA,MAAM,CAACG,EAAE,EAAE,GAAG,IAAI,EAAEJ,OAAO,CAACK,MAAM,CAACC,QAAQ,CAAC,CAAC,CAAC,CACpEC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC;AAED,MAAMC,kBAAkB,GAAIC,KAAY,IAAa;EACjD,IAAIA,KAAK,YAAYpB,WAAW,EAAE;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