@webiny/handler-graphql 0.0.0-unstable.611c5af35e → 0.0.0-unstable.615a930a68

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 (41) hide show
  1. package/builtInTypes/AnyScalar.js +3 -0
  2. package/builtInTypes/AnyScalar.js.map +1 -1
  3. package/builtInTypes/DateScalar.js +7 -0
  4. package/builtInTypes/DateScalar.js.map +1 -1
  5. package/builtInTypes/DateTimeScalar.js +7 -0
  6. package/builtInTypes/DateTimeScalar.js.map +1 -1
  7. package/builtInTypes/DateTimeZScalar.js +13 -0
  8. package/builtInTypes/DateTimeZScalar.js.map +1 -1
  9. package/builtInTypes/JsonScalar.js +2 -0
  10. package/builtInTypes/JsonScalar.js.map +1 -1
  11. package/builtInTypes/LongScalar.js +2 -0
  12. package/builtInTypes/LongScalar.js.map +1 -1
  13. package/builtInTypes/NumberScalar.js +9 -0
  14. package/builtInTypes/NumberScalar.js.map +1 -1
  15. package/builtInTypes/RefInputScalar.js +11 -0
  16. package/builtInTypes/RefInputScalar.js.map +1 -1
  17. package/builtInTypes/TimeScalar.js +12 -0
  18. package/builtInTypes/TimeScalar.js.map +1 -1
  19. package/builtInTypes/index.js +18 -0
  20. package/builtInTypes/index.js.map +1 -1
  21. package/createGraphQLHandler.js +11 -0
  22. package/createGraphQLHandler.js.map +1 -1
  23. package/createGraphQLSchema.js +12 -2
  24. package/createGraphQLSchema.js.map +1 -1
  25. package/debugPlugins.js +9 -0
  26. package/debugPlugins.js.map +1 -1
  27. package/errors.js +5 -0
  28. package/errors.js.map +1 -1
  29. package/index.js +10 -0
  30. package/index.js.map +1 -1
  31. package/interceptConsole.js +10 -4
  32. package/interceptConsole.js.map +1 -1
  33. package/package.json +10 -10
  34. package/plugins/GraphQLSchemaPlugin.js +7 -0
  35. package/plugins/GraphQLSchemaPlugin.js.map +1 -1
  36. package/plugins/index.js +2 -0
  37. package/plugins/index.js.map +1 -1
  38. package/processRequestBody.js +7 -0
  39. package/processRequestBody.js.map +1 -1
  40. package/responses.js +24 -4
  41. package/responses.js.map +1 -1
@@ -4,10 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AnyScalar = void 0;
7
+
7
8
  var _graphql = require("graphql");
9
+
8
10
  const returnValue = value => {
9
11
  return value;
10
12
  };
13
+
11
14
  const AnyScalar = new _graphql.GraphQLScalarType({
12
15
  name: "Any",
13
16
  description: `A scalar type that represents an ambiguous value.`,
@@ -1 +1 @@
1
- {"version":3,"names":["returnValue","value","AnyScalar","GraphQLScalarType","name","description","serialize","parseValue"],"sources":["AnyScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\n\nconst returnValue = (value: any): any => {\n return value;\n};\n\nexport const AnyScalar = new GraphQLScalarType({\n name: \"Any\",\n description: `A scalar type that represents an ambiguous value.`,\n serialize: returnValue,\n parseValue: returnValue\n});\n"],"mappings":";;;;;;AAAA;AAEA,MAAMA,WAAW,GAAIC,KAAU,IAAU;EACrC,OAAOA,KAAK;AAChB,CAAC;AAEM,MAAMC,SAAS,GAAG,IAAIC,0BAAiB,CAAC;EAC3CC,IAAI,EAAE,KAAK;EACXC,WAAW,EAAG,mDAAkD;EAChEC,SAAS,EAAEN,WAAW;EACtBO,UAAU,EAAEP;AAChB,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["returnValue","value","AnyScalar","GraphQLScalarType","name","description","serialize","parseValue"],"sources":["AnyScalar.ts"],"sourcesContent":["import { GraphQLScalarType } from \"graphql\";\n\nconst returnValue = (value: any): any => {\n return value;\n};\n\nexport const AnyScalar = new GraphQLScalarType({\n name: \"Any\",\n description: `A scalar type that represents an ambiguous value.`,\n serialize: returnValue,\n parseValue: returnValue\n});\n"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,WAAW,GAAIC,KAAD,IAAqB;EACrC,OAAOA,KAAP;AACH,CAFD;;AAIO,MAAMC,SAAS,GAAG,IAAIC,0BAAJ,CAAsB;EAC3CC,IAAI,EAAE,KADqC;EAE3CC,WAAW,EAAG,mDAF6B;EAG3CC,SAAS,EAAEN,WAHgC;EAI3CO,UAAU,EAAEP;AAJ+B,CAAtB,CAAlB"}
@@ -1,18 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.DateScalar = void 0;
9
+
8
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
9
12
  var _graphqlScalars = require("graphql-scalars");
13
+
10
14
  var _graphql = require("graphql");
15
+
11
16
  const DateScalar = new _graphql.GraphQLScalarType((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _graphqlScalars.DateResolver), {}, {
12
17
  serialize: value => {
13
18
  if (!value) {
14
19
  return null;
15
20
  }
21
+
16
22
  try {
17
23
  const date = new Date(value);
18
24
  return date.toISOString().slice(0, 10);
@@ -20,6 +26,7 @@ const DateScalar = new _graphql.GraphQLScalarType((0, _objectSpread2.default)((0
20
26
  if (value.toISOString) {
21
27
  return value.toISOString().slice(0, 10);
22
28
  }
29
+
23
30
  throw ex;
24
31
  }
25
32
  }
@@ -1 +1 @@
1
- {"version":3,"names":["DateScalar","GraphQLScalarType","DateResolver","serialize","value","date","Date","toISOString","slice","ex"],"sources":["DateScalar.ts"],"sourcesContent":["import { DateResolver } from \"graphql-scalars\";\nimport { GraphQLScalarType } from \"graphql\";\nexport const DateScalar = new GraphQLScalarType({\n ...DateResolver,\n serialize: value => {\n if (!value) {\n return null;\n }\n try {\n const date = new Date(value);\n return date.toISOString().slice(0, 10);\n } catch (ex) {\n if (value.toISOString) {\n return value.toISOString().slice(0, 10);\n }\n throw ex;\n }\n }\n});\n"],"mappings":";;;;;;;;AAAA;AACA;AACO,MAAMA,UAAU,GAAG,IAAIC,0BAAiB,6DACxCC,4BAAY;EACfC,SAAS,EAAEC,KAAK,IAAI;IAChB,IAAI,CAACA,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,IAAI;MACA,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACF,KAAK,CAAC;MAC5B,OAAOC,IAAI,CAACE,WAAW,EAAE,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1C,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,IAAIL,KAAK,CAACG,WAAW,EAAE;QACnB,OAAOH,KAAK,CAACG,WAAW,EAAE,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;MAC3C;MACA,MAAMC,EAAE;IACZ;EACJ;AAAC,GACH;AAAC"}
1
+ {"version":3,"names":["DateScalar","GraphQLScalarType","DateResolver","serialize","value","date","Date","toISOString","slice","ex"],"sources":["DateScalar.ts"],"sourcesContent":["import { DateResolver } from \"graphql-scalars\";\nimport { GraphQLScalarType } from \"graphql\";\nexport const DateScalar = new GraphQLScalarType({\n ...DateResolver,\n serialize: value => {\n if (!value) {\n return null;\n }\n try {\n const date = new Date(value);\n return date.toISOString().slice(0, 10);\n } catch (ex) {\n if (value.toISOString) {\n return value.toISOString().slice(0, 10);\n }\n throw ex;\n }\n }\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACO,MAAMA,UAAU,GAAG,IAAIC,0BAAJ,6DACnBC,4BADmB;EAEtBC,SAAS,EAAEC,KAAK,IAAI;IAChB,IAAI,CAACA,KAAL,EAAY;MACR,OAAO,IAAP;IACH;;IACD,IAAI;MACA,MAAMC,IAAI,GAAG,IAAIC,IAAJ,CAASF,KAAT,CAAb;MACA,OAAOC,IAAI,CAACE,WAAL,GAAmBC,KAAnB,CAAyB,CAAzB,EAA4B,EAA5B,CAAP;IACH,CAHD,CAGE,OAAOC,EAAP,EAAW;MACT,IAAIL,KAAK,CAACG,WAAV,EAAuB;QACnB,OAAOH,KAAK,CAACG,WAAN,GAAoBC,KAApB,CAA0B,CAA1B,EAA6B,EAA7B,CAAP;MACH;;MACD,MAAMC,EAAN;IACH;EACJ;AAfqB,GAAnB"}
@@ -1,18 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.DateTimeScalar = void 0;
9
+
8
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
9
12
  var _graphqlScalars = require("graphql-scalars");
13
+
10
14
  var _graphql = require("graphql");
15
+
11
16
  const DateTimeScalar = new _graphql.GraphQLScalarType((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _graphqlScalars.DateTimeResolver), {}, {
12
17
  serialize: value => {
13
18
  if (!value) {
14
19
  return null;
15
20
  }
21
+
16
22
  try {
17
23
  const date = new Date(value);
18
24
  return date.toISOString();
@@ -20,6 +26,7 @@ const DateTimeScalar = new _graphql.GraphQLScalarType((0, _objectSpread2.default
20
26
  if (value.toISOString) {
21
27
  return value.toISOString();
22
28
  }
29
+
23
30
  throw ex;
24
31
  }
25
32
  }
@@ -1 +1 @@
1
- {"version":3,"names":["DateTimeScalar","GraphQLScalarType","DateTimeResolver","serialize","value","date","Date","toISOString","ex"],"sources":["DateTimeScalar.ts"],"sourcesContent":["import { DateTimeResolver } from \"graphql-scalars\";\nimport { GraphQLScalarType } from \"graphql\";\nexport const DateTimeScalar = new GraphQLScalarType({\n ...DateTimeResolver,\n serialize: value => {\n if (!value) {\n return null;\n }\n try {\n const date = new Date(value);\n return date.toISOString();\n } catch (ex) {\n if (value.toISOString) {\n return value.toISOString();\n }\n throw ex;\n }\n }\n});\n"],"mappings":";;;;;;;;AAAA;AACA;AACO,MAAMA,cAAc,GAAG,IAAIC,0BAAiB,6DAC5CC,gCAAgB;EACnBC,SAAS,EAAEC,KAAK,IAAI;IAChB,IAAI,CAACA,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,IAAI;MACA,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACF,KAAK,CAAC;MAC5B,OAAOC,IAAI,CAACE,WAAW,EAAE;IAC7B,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,IAAIJ,KAAK,CAACG,WAAW,EAAE;QACnB,OAAOH,KAAK,CAACG,WAAW,EAAE;MAC9B;MACA,MAAMC,EAAE;IACZ;EACJ;AAAC,GACH;AAAC"}
1
+ {"version":3,"names":["DateTimeScalar","GraphQLScalarType","DateTimeResolver","serialize","value","date","Date","toISOString","ex"],"sources":["DateTimeScalar.ts"],"sourcesContent":["import { DateTimeResolver } from \"graphql-scalars\";\nimport { GraphQLScalarType } from \"graphql\";\nexport const DateTimeScalar = new GraphQLScalarType({\n ...DateTimeResolver,\n serialize: value => {\n if (!value) {\n return null;\n }\n try {\n const date = new Date(value);\n return date.toISOString();\n } catch (ex) {\n if (value.toISOString) {\n return value.toISOString();\n }\n throw ex;\n }\n }\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACO,MAAMA,cAAc,GAAG,IAAIC,0BAAJ,6DACvBC,gCADuB;EAE1BC,SAAS,EAAEC,KAAK,IAAI;IAChB,IAAI,CAACA,KAAL,EAAY;MACR,OAAO,IAAP;IACH;;IACD,IAAI;MACA,MAAMC,IAAI,GAAG,IAAIC,IAAJ,CAASF,KAAT,CAAb;MACA,OAAOC,IAAI,CAACE,WAAL,EAAP;IACH,CAHD,CAGE,OAAOC,EAAP,EAAW;MACT,IAAIJ,KAAK,CAACG,WAAV,EAAuB;QACnB,OAAOH,KAAK,CAACG,WAAN,EAAP;MACH;;MACD,MAAMC,EAAN;IACH;EACJ;AAfyB,GAAvB"}
@@ -1,29 +1,39 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.DateTimeZScalar = void 0;
9
+
8
10
  var _graphqlScalars = require("graphql-scalars");
11
+
9
12
  var _graphql = require("graphql");
13
+
10
14
  var _error = _interopRequireDefault(require("@webiny/error"));
15
+
11
16
  const validateTimeZone = value => {
12
17
  const timeWithTimezone = value.split("T")[1];
18
+
13
19
  if (!timeWithTimezone) {
14
20
  throw new _error.default("Could not extract time with timezone from value.", "DATE_TIME_TIMEZONE_ERROR", {
15
21
  value
16
22
  });
17
23
  }
24
+
18
25
  const separator = timeWithTimezone.includes("-") ? "-" : "+";
19
26
  const zone = timeWithTimezone.split(separator)[1];
27
+
20
28
  if (!zone) {
21
29
  throw new _error.default("Could not extract timezone from value.", "DATE_TIME_TIMEZONE_ERROR", {
22
30
  value: timeWithTimezone
23
31
  });
24
32
  }
33
+
25
34
  const hoursMinutes = zone.split(":");
26
35
  const [hours, minutes] = hoursMinutes;
36
+
27
37
  if (hours === undefined || minutes === undefined || hoursMinutes.length !== 2) {
28
38
  throw new _error.default("Could not extract hours or minutes from value.", "DATE_TIME_TIMEZONE_ERROR", {
29
39
  value: zone
@@ -34,12 +44,15 @@ const validateTimeZone = value => {
34
44
  * A custom type for dateTime with the timezone.
35
45
  * Must be in format "YYYY-MM-ddTHH:mm:ss+HH:mm".
36
46
  */
47
+
48
+
37
49
  const DateTimeZScalar = new _graphql.GraphQLScalarType({
38
50
  name: "DateTimeZ",
39
51
  description: "A custom type for dateTime with the timezone.",
40
52
  parseValue: value => {
41
53
  // this serves as validator
42
54
  _graphqlScalars.DateTimeResolver.parseValue(value);
55
+
43
56
  validateTimeZone(value);
44
57
  return value;
45
58
  },
@@ -1 +1 @@
1
- {"version":3,"names":["validateTimeZone","value","timeWithTimezone","split","WebinyError","separator","includes","zone","hoursMinutes","hours","minutes","undefined","length","DateTimeZScalar","GraphQLScalarType","name","description","parseValue","DateTimeResolver","serialize"],"sources":["DateTimeZScalar.ts"],"sourcesContent":["import { DateTimeResolver } from \"graphql-scalars\";\nimport { GraphQLScalarType } from \"graphql\";\nimport WebinyError from \"@webiny/error\";\n\nconst validateTimeZone = (value: string): void => {\n const timeWithTimezone = value.split(\"T\")[1];\n if (!timeWithTimezone) {\n throw new WebinyError(\n \"Could not extract time with timezone from value.\",\n \"DATE_TIME_TIMEZONE_ERROR\",\n {\n value\n }\n );\n }\n const separator = timeWithTimezone.includes(\"-\") ? \"-\" : \"+\";\n const zone = timeWithTimezone.split(separator)[1];\n if (!zone) {\n throw new WebinyError(\n \"Could not extract timezone from value.\",\n \"DATE_TIME_TIMEZONE_ERROR\",\n {\n value: timeWithTimezone\n }\n );\n }\n const hoursMinutes = zone.split(\":\");\n const [hours, minutes] = hoursMinutes;\n if (hours === undefined || minutes === undefined || hoursMinutes.length !== 2) {\n throw new WebinyError(\n \"Could not extract hours or minutes from value.\",\n \"DATE_TIME_TIMEZONE_ERROR\",\n {\n value: zone\n }\n );\n }\n};\n/**\n * A custom type for dateTime with the timezone.\n * Must be in format \"YYYY-MM-ddTHH:mm:ss+HH:mm\".\n */\nexport const DateTimeZScalar = new GraphQLScalarType({\n name: \"DateTimeZ\",\n description: \"A custom type for dateTime with the timezone.\",\n parseValue: value => {\n // this serves as validator\n DateTimeResolver.parseValue(value);\n validateTimeZone(value);\n return value;\n },\n serialize: value => {\n return value;\n }\n});\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA,MAAMA,gBAAgB,GAAIC,KAAa,IAAW;EAC9C,MAAMC,gBAAgB,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC5C,IAAI,CAACD,gBAAgB,EAAE;IACnB,MAAM,IAAIE,cAAW,CACjB,kDAAkD,EAClD,0BAA0B,EAC1B;MACIH;IACJ,CAAC,CACJ;EACL;EACA,MAAMI,SAAS,GAAGH,gBAAgB,CAACI,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG;EAC5D,MAAMC,IAAI,GAAGL,gBAAgB,CAACC,KAAK,CAACE,SAAS,CAAC,CAAC,CAAC,CAAC;EACjD,IAAI,CAACE,IAAI,EAAE;IACP,MAAM,IAAIH,cAAW,CACjB,wCAAwC,EACxC,0BAA0B,EAC1B;MACIH,KAAK,EAAEC;IACX,CAAC,CACJ;EACL;EACA,MAAMM,YAAY,GAAGD,IAAI,CAACJ,KAAK,CAAC,GAAG,CAAC;EACpC,MAAM,CAACM,KAAK,EAAEC,OAAO,CAAC,GAAGF,YAAY;EACrC,IAAIC,KAAK,KAAKE,SAAS,IAAID,OAAO,KAAKC,SAAS,IAAIH,YAAY,CAACI,MAAM,KAAK,CAAC,EAAE;IAC3E,MAAM,IAAIR,cAAW,CACjB,gDAAgD,EAChD,0BAA0B,EAC1B;MACIH,KAAK,EAAEM;IACX,CAAC,CACJ;EACL;AACJ,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMM,eAAe,GAAG,IAAIC,0BAAiB,CAAC;EACjDC,IAAI,EAAE,WAAW;EACjBC,WAAW,EAAE,+CAA+C;EAC5DC,UAAU,EAAEhB,KAAK,IAAI;IACjB;IACAiB,gCAAgB,CAACD,UAAU,CAAChB,KAAK,CAAC;IAClCD,gBAAgB,CAACC,KAAK,CAAC;IACvB,OAAOA,KAAK;EAChB,CAAC;EACDkB,SAAS,EAAElB,KAAK,IAAI;IAChB,OAAOA,KAAK;EAChB;AACJ,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["validateTimeZone","value","timeWithTimezone","split","WebinyError","separator","includes","zone","hoursMinutes","hours","minutes","undefined","length","DateTimeZScalar","GraphQLScalarType","name","description","parseValue","DateTimeResolver","serialize"],"sources":["DateTimeZScalar.ts"],"sourcesContent":["import { DateTimeResolver } from \"graphql-scalars\";\nimport { GraphQLScalarType } from \"graphql\";\nimport WebinyError from \"@webiny/error\";\n\nconst validateTimeZone = (value: string): void => {\n const timeWithTimezone = value.split(\"T\")[1];\n if (!timeWithTimezone) {\n throw new WebinyError(\n \"Could not extract time with timezone from value.\",\n \"DATE_TIME_TIMEZONE_ERROR\",\n {\n value\n }\n );\n }\n const separator = timeWithTimezone.includes(\"-\") ? \"-\" : \"+\";\n const zone = timeWithTimezone.split(separator)[1];\n if (!zone) {\n throw new WebinyError(\n \"Could not extract timezone from value.\",\n \"DATE_TIME_TIMEZONE_ERROR\",\n {\n value: timeWithTimezone\n }\n );\n }\n const hoursMinutes = zone.split(\":\");\n const [hours, minutes] = hoursMinutes;\n if (hours === undefined || minutes === undefined || hoursMinutes.length !== 2) {\n throw new WebinyError(\n \"Could not extract hours or minutes from value.\",\n \"DATE_TIME_TIMEZONE_ERROR\",\n {\n value: zone\n }\n );\n }\n};\n/**\n * A custom type for dateTime with the timezone.\n * Must be in format \"YYYY-MM-ddTHH:mm:ss+HH:mm\".\n */\nexport const DateTimeZScalar = new GraphQLScalarType({\n name: \"DateTimeZ\",\n description: \"A custom type for dateTime with the timezone.\",\n parseValue: value => {\n // this serves as validator\n DateTimeResolver.parseValue(value);\n validateTimeZone(value);\n return value;\n },\n serialize: value => {\n return value;\n }\n});\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,gBAAgB,GAAIC,KAAD,IAAyB;EAC9C,MAAMC,gBAAgB,GAAGD,KAAK,CAACE,KAAN,CAAY,GAAZ,EAAiB,CAAjB,CAAzB;;EACA,IAAI,CAACD,gBAAL,EAAuB;IACnB,MAAM,IAAIE,cAAJ,CACF,kDADE,EAEF,0BAFE,EAGF;MACIH;IADJ,CAHE,CAAN;EAOH;;EACD,MAAMI,SAAS,GAAGH,gBAAgB,CAACI,QAAjB,CAA0B,GAA1B,IAAiC,GAAjC,GAAuC,GAAzD;EACA,MAAMC,IAAI,GAAGL,gBAAgB,CAACC,KAAjB,CAAuBE,SAAvB,EAAkC,CAAlC,CAAb;;EACA,IAAI,CAACE,IAAL,EAAW;IACP,MAAM,IAAIH,cAAJ,CACF,wCADE,EAEF,0BAFE,EAGF;MACIH,KAAK,EAAEC;IADX,CAHE,CAAN;EAOH;;EACD,MAAMM,YAAY,GAAGD,IAAI,CAACJ,KAAL,CAAW,GAAX,CAArB;EACA,MAAM,CAACM,KAAD,EAAQC,OAAR,IAAmBF,YAAzB;;EACA,IAAIC,KAAK,KAAKE,SAAV,IAAuBD,OAAO,KAAKC,SAAnC,IAAgDH,YAAY,CAACI,MAAb,KAAwB,CAA5E,EAA+E;IAC3E,MAAM,IAAIR,cAAJ,CACF,gDADE,EAEF,0BAFE,EAGF;MACIH,KAAK,EAAEM;IADX,CAHE,CAAN;EAOH;AACJ,CAjCD;AAkCA;AACA;AACA;AACA;;;AACO,MAAMM,eAAe,GAAG,IAAIC,0BAAJ,CAAsB;EACjDC,IAAI,EAAE,WAD2C;EAEjDC,WAAW,EAAE,+CAFoC;EAGjDC,UAAU,EAAEhB,KAAK,IAAI;IACjB;IACAiB,gCAAA,CAAiBD,UAAjB,CAA4BhB,KAA5B;;IACAD,gBAAgB,CAACC,KAAD,CAAhB;IACA,OAAOA,KAAP;EACH,CARgD;EASjDkB,SAAS,EAAElB,KAAK,IAAI;IAChB,OAAOA,KAAP;EACH;AAXgD,CAAtB,CAAxB"}
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.JsonScalar = void 0;
7
+
7
8
  var _graphqlScalars = require("graphql-scalars");
9
+
8
10
  const JsonScalar = _graphqlScalars.JSONResolver;
9
11
  exports.JsonScalar = JsonScalar;
@@ -1 +1 @@
1
- {"version":3,"names":["JsonScalar","JSONResolver"],"sources":["JsonScalar.ts"],"sourcesContent":["import { JSONResolver } from \"graphql-scalars\";\nexport const JsonScalar = JSONResolver;\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,UAAU,GAAGC,4BAAY;AAAC"}
1
+ {"version":3,"names":["JsonScalar","JSONResolver"],"sources":["JsonScalar.ts"],"sourcesContent":["import { JSONResolver } from \"graphql-scalars\";\nexport const JsonScalar = JSONResolver;\n"],"mappings":";;;;;;;AAAA;;AACO,MAAMA,UAAU,GAAGC,4BAAnB"}
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.LongScalar = void 0;
7
+
7
8
  var _graphqlScalars = require("graphql-scalars");
9
+
8
10
  const LongScalar = _graphqlScalars.LongResolver;
9
11
  exports.LongScalar = LongScalar;
@@ -1 +1 @@
1
- {"version":3,"names":["LongScalar","LongResolver"],"sources":["LongScalar.ts"],"sourcesContent":["import { LongResolver } from \"graphql-scalars\";\nexport const LongScalar = LongResolver;\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,UAAU,GAAGC,4BAAY;AAAC"}
1
+ {"version":3,"names":["LongScalar","LongResolver"],"sources":["LongScalar.ts"],"sourcesContent":["import { LongResolver } from \"graphql-scalars\";\nexport const LongScalar = LongResolver;\n"],"mappings":";;;;;;;AAAA;;AACO,MAAMA,UAAU,GAAGC,4BAAnB"}
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.NumberScalar = void 0;
9
+
8
10
  var _graphql = require("graphql");
11
+
9
12
  var _language = require("graphql/language");
13
+
10
14
  var _error = _interopRequireDefault(require("@webiny/error"));
15
+
11
16
  const parseValue = value => {
12
17
  if (String(value).match(/^0x/) !== null) {
13
18
  throw new _error.default("Value sent must be a non-hex number.", "INVALID_VALUE", {
@@ -22,8 +27,10 @@ const parseValue = value => {
22
27
  value
23
28
  });
24
29
  }
30
+
25
31
  return parseFloat(value);
26
32
  };
33
+
27
34
  const NumberScalar = new _graphql.GraphQLScalarType({
28
35
  name: "Number",
29
36
  description: "A custom input type to be used with numbers. Supports Int and Float.",
@@ -44,11 +51,13 @@ const NumberScalar = new _graphql.GraphQLScalarType({
44
51
  parseValue,
45
52
  parseLiteral: ast => {
46
53
  const value = ast.value;
54
+
47
55
  if (ast.kind === _language.Kind.INT) {
48
56
  return Number(value);
49
57
  } else if (ast.kind === _language.Kind.FLOAT) {
50
58
  return parseFloat(value);
51
59
  }
60
+
52
61
  throw new Error(`Expected type Number, found {${value}}`);
53
62
  }
54
63
  });
@@ -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,KAAU,IAAK;EAC/B,IAAIC,MAAM,CAACD,KAAK,CAAC,CAACE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;IACrC,MAAM,IAAIC,cAAW,CAAC,sCAAsC,EAAE,eAAe,EAAE;MAC3EH;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAClC,OAAOA,KAAK;EAChB,CAAC,MAAM,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKI,SAAS,EAAE;IAC9C,OAAO,IAAI;EACf,CAAC,MAAM,IAAIC,KAAK,CAACL,KAAK,CAAC,KAAK,IAAI,EAAE;IAC9B,MAAM,IAAIG,cAAW,CAAC,8BAA8B,EAAE,eAAe,EAAE;MACnEH;IACJ,CAAC,CAAC;EACN;EACA,OAAOM,UAAU,CAACN,KAAK,CAAC;AAC5B,CAAC;AAEM,MAAMO,YAAY,GAAG,IAAIC,0BAAiB,CAAC;EAC9CC,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,sEAAsE;EACnFC,SAAS,EAAGX,KAAU,IAAK;IACvB,IAAI;MACA,OAAOD,UAAU,CAACC,KAAK,CAAC;IAC5B,CAAC,CAAC,OAAOY,EAAE,EAAE;MACTC,OAAO,CAACC,GAAG,CAAC;QACRC,OAAO,EAAE,8BAA8B;QACvCC,IAAI,EAAE,eAAe;QACrBC,IAAI,EAAE;UACFjB;QACJ;MACJ,CAAC,CAAC;MACF,OAAO,IAAI;IACf;EACJ,CAAC;EACDD,UAAU;EACVmB,YAAY,EAAEC,GAAG,IAAI;IACjB,MAAMnB,KAAK,GAAImB,GAAG,CAASnB,KAAK;IAChC,IAAImB,GAAG,CAACC,IAAI,KAAKC,cAAI,CAACC,GAAG,EAAE;MACvB,OAAOC,MAAM,CAACvB,KAAK,CAAC;IACxB,CAAC,MAAM,IAAImB,GAAG,CAACC,IAAI,KAAKC,cAAI,CAACG,KAAK,EAAE;MAChC,OAAOlB,UAAU,CAACN,KAAK,CAAC;IAC5B;IACA,MAAM,IAAIyB,KAAK,CAAE,gCAA+BzB,KAAM,GAAE,CAAC;EAC7D;AACJ,CAAC,CAAC;AAAC"}
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"}
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RefInput = void 0;
7
+
7
8
  var _graphql = require("graphql");
9
+
8
10
  const isMongoId = value => {
9
11
  if (/^[0-9a-fA-F]{24}$/.test(value)) {
10
12
  return value;
11
13
  }
14
+
12
15
  throw new Error("Must be a valid Mongo ID!");
13
16
  };
17
+
14
18
  const RefInput = new _graphql.GraphQLScalarType({
15
19
  name: "RefInput",
16
20
  description: "A custom input type to be used with references. Supports plain ID and `{ id: ID }` Object literal.",
@@ -18,36 +22,43 @@ const RefInput = new _graphql.GraphQLScalarType({
18
22
  if (!value || value.id === null) {
19
23
  return null;
20
24
  }
25
+
21
26
  return typeof value === "string" ? value : value.id;
22
27
  },
23
28
  parseValue: value => {
24
29
  if (!value || value.id === null) {
25
30
  return null;
26
31
  }
32
+
27
33
  if (typeof value === "string") {
28
34
  return isMongoId(value);
29
35
  }
36
+
30
37
  if ("id" in value) {
31
38
  return isMongoId(value.id);
32
39
  }
40
+
33
41
  throw new Error("Invalid RefInput value!");
34
42
  },
35
43
  parseLiteral: ast => {
36
44
  if (ast.kind === "StringValue") {
37
45
  return isMongoId(ast.value);
38
46
  }
47
+
39
48
  if (ast.kind === "ObjectValue") {
40
49
  for (let i = 0; i < ast.fields.length; i++) {
41
50
  const {
42
51
  name,
43
52
  value
44
53
  } = ast.fields[i];
54
+
45
55
  if (name.value === "id") {
46
56
  // @ts-ignore
47
57
  return isMongoId(value.value);
48
58
  }
49
59
  }
50
60
  }
61
+
51
62
  throw new Error("Invalid RefInput value!");
52
63
  }
53
64
  });
@@ -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,KAAU,IAAa;EACtC,IAAI,mBAAmB,CAACC,IAAI,CAACD,KAAK,CAAC,EAAE;IACjC,OAAOA,KAAK;EAChB;EAEA,MAAM,IAAIE,KAAK,CAAC,2BAA2B,CAAC;AAChD,CAAC;AAEM,MAAMC,QAAQ,GAAG,IAAIC,0BAAiB,CAAC;EAC1CC,IAAI,EAAE,UAAU;EAChBC,WAAW,EACP,oGAAoG;EACxGC,SAAS,EAAEP,KAAK,IAAI;IAChB,IAAI,CAACA,KAAK,IAAIA,KAAK,CAACQ,EAAE,KAAK,IAAI,EAAE;MAC7B,OAAO,IAAI;IACf;IAEA,OAAO,OAAOR,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGA,KAAK,CAACQ,EAAE;EACvD,CAAC;EACDC,UAAU,EAAET,KAAK,IAAI;IACjB,IAAI,CAACA,KAAK,IAAIA,KAAK,CAACQ,EAAE,KAAK,IAAI,EAAE;MAC7B,OAAO,IAAI;IACf;IAEA,IAAI,OAAOR,KAAK,KAAK,QAAQ,EAAE;MAC3B,OAAOD,SAAS,CAACC,KAAK,CAAC;IAC3B;IAEA,IAAI,IAAI,IAAIA,KAAK,EAAE;MACf,OAAOD,SAAS,CAACC,KAAK,CAACQ,EAAE,CAAC;IAC9B;IAEA,MAAM,IAAIN,KAAK,CAAC,yBAAyB,CAAC;EAC9C,CAAC;EACDQ,YAAY,EAAEC,GAAG,IAAI;IACjB,IAAIA,GAAG,CAACC,IAAI,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,CAACC,MAAM,EAAEF,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;AAAC"}
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,26 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.TimeScalar = void 0;
9
+
8
10
  var _graphql = require("graphql");
11
+
9
12
  var _error = _interopRequireDefault(require("@webiny/error"));
13
+
10
14
  const re = /^([0-9]{2}):([0-9]{2})(:([0-9]{2}))?$/;
15
+
11
16
  const parseTime = value => {
12
17
  if (!value || value.match(re) === null) {
13
18
  throw new _error.default("Value does not look like time.", "TIME_VALIDATION_ERROR", {
14
19
  value
15
20
  });
16
21
  }
22
+
17
23
  const parsed = value.split(":").map(Number);
24
+
18
25
  if (parsed.length < 2) {
19
26
  throw new _error.default(`Could not parse the value.`, "TIME_VALIDATION_ERROR", {
20
27
  value
21
28
  });
22
29
  }
30
+
23
31
  const [hours, minutes, seconds = 0] = parsed;
32
+
24
33
  if (hours >= 24) {
25
34
  throw new _error.default(`There cannot be more than 24 hours.`, "TIME_VALIDATION_ERROR", {
26
35
  value
@@ -34,12 +43,14 @@ const parseTime = value => {
34
43
  value
35
44
  });
36
45
  }
46
+
37
47
  return {
38
48
  hours,
39
49
  minutes,
40
50
  seconds
41
51
  };
42
52
  };
53
+
43
54
  const convertToTime = value => {
44
55
  const {
45
56
  hours,
@@ -48,6 +59,7 @@ const convertToTime = value => {
48
59
  } = parseTime(value);
49
60
  return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
50
61
  };
62
+
51
63
  const TimeScalar = new _graphql.GraphQLScalarType({
52
64
  name: "Time",
53
65
  description: "A custom type to support time-only input.",
@@ -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,uCAAuC;AAElD,MAAMC,SAAS,GAAIC,KAAc,IAAK;EAClC,IAAI,CAACA,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACH,EAAE,CAAC,KAAK,IAAI,EAAE;IACpC,MAAM,IAAII,cAAW,CAAC,gCAAgC,EAAE,uBAAuB,EAAE;MAAEF;IAAM,CAAC,CAAC;EAC/F;EACA,MAAMG,MAAM,GAAGH,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAC3C,IAAIH,MAAM,CAACI,MAAM,GAAG,CAAC,EAAE;IACnB,MAAM,IAAIL,cAAW,CAAE,4BAA2B,EAAE,uBAAuB,EAAE;MAAEF;IAAM,CAAC,CAAC;EAC3F;EACA,MAAM,CAACQ,KAAK,EAAEC,OAAO,EAAEC,OAAO,GAAG,CAAC,CAAC,GAAGP,MAAM;EAC5C,IAAIK,KAAK,IAAI,EAAE,EAAE;IACb,MAAM,IAAIN,cAAW,CAAE,qCAAoC,EAAE,uBAAuB,EAAE;MAClFF;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAIS,OAAO,IAAI,EAAE,EAAE;IACtB,MAAM,IAAIP,cAAW,CAAE,uCAAsC,EAAE,uBAAuB,EAAE;MACpFF;IACJ,CAAC,CAAC;EACN,CAAC,MAAM,IAAIU,OAAO,IAAI,EAAE,EAAE;IACtB,MAAM,IAAIR,cAAW,CAAE,uCAAsC,EAAE,uBAAuB,EAAE;MACpFF;IACJ,CAAC,CAAC;EACN;EACA,OAAO;IACHQ,KAAK;IACLC,OAAO;IACPC;EACJ,CAAC;AACL,CAAC;AAED,MAAMC,aAAa,GAAIX,KAAa,IAAa;EAC7C,MAAM;IAAEQ,KAAK;IAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAGX,SAAS,CAACC,KAAK,CAAC;EACpD,OAAQ,GAAEY,MAAM,CAACJ,KAAK,CAAC,CAACK,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAE,IAAGD,MAAM,CAACH,OAAO,CAAC,CAACI,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAE,IAAGD,MAAM,CAClFF,OAAO,CACV,CAACG,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAE,EAAC;AACxB,CAAC;AAEM,MAAMC,UAAU,GAAG,IAAIC,0BAAiB,CAAC;EAC5CC,IAAI,EAAE,MAAM;EACZC,WAAW,EAAE,2CAA2C;EACxD;EACAC,SAAS,EAAEP,aAAa;EACxB;EACAQ,UAAU,EAAER;AAChB,CAAC,CAAC;AAAC"}
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,MAAMG,MAAM,GAAGH,KAAK,CAACI,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,CAAqBC,MAArB,CAAf;;EACA,IAAIH,MAAM,CAACI,MAAP,GAAgB,CAApB,EAAuB;IACnB,MAAM,IAAIL,cAAJ,CAAiB,4BAAjB,EAA8C,uBAA9C,EAAuE;MAAEF;IAAF,CAAvE,CAAN;EACH;;EACD,MAAM,CAACQ,KAAD,EAAQC,OAAR,EAAiBC,OAAO,GAAG,CAA3B,IAAgCP,MAAtC;;EACA,IAAIK,KAAK,IAAI,EAAb,EAAiB;IACb,MAAM,IAAIN,cAAJ,CAAiB,qCAAjB,EAAuD,uBAAvD,EAAgF;MAClFF;IADkF,CAAhF,CAAN;EAGH,CAJD,MAIO,IAAIS,OAAO,IAAI,EAAf,EAAmB;IACtB,MAAM,IAAIP,cAAJ,CAAiB,uCAAjB,EAAyD,uBAAzD,EAAkF;MACpFF;IADoF,CAAlF,CAAN;EAGH,CAJM,MAIA,IAAIU,OAAO,IAAI,EAAf,EAAmB;IACtB,MAAM,IAAIR,cAAJ,CAAiB,uCAAjB,EAAyD,uBAAzD,EAAkF;MACpFF;IADoF,CAAlF,CAAN;EAGH;;EACD,OAAO;IACHQ,KADG;IAEHC,OAFG;IAGHC;EAHG,CAAP;AAKH,CA3BD;;AA6BA,MAAMC,aAAa,GAAIX,KAAD,IAA2B;EAC7C,MAAM;IAAEQ,KAAF;IAASC,OAAT;IAAkBC;EAAlB,IAA8BX,SAAS,CAACC,KAAD,CAA7C;EACA,OAAQ,GAAEY,MAAM,CAACJ,KAAD,CAAN,CAAcK,QAAd,CAAuB,CAAvB,EAA0B,GAA1B,CAA+B,IAAGD,MAAM,CAACH,OAAD,CAAN,CAAgBI,QAAhB,CAAyB,CAAzB,EAA4B,GAA5B,CAAiC,IAAGD,MAAM,CAClFF,OADkF,CAAN,CAE9EG,QAF8E,CAErE,CAFqE,EAElE,GAFkE,CAE7D,EAFnB;AAGH,CALD;;AAOO,MAAMC,UAAU,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"}
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+
6
7
  var _AnyScalar = require("./AnyScalar");
8
+
7
9
  Object.keys(_AnyScalar).forEach(function (key) {
8
10
  if (key === "default" || key === "__esModule") return;
9
11
  if (key in exports && exports[key] === _AnyScalar[key]) return;
@@ -14,7 +16,9 @@ Object.keys(_AnyScalar).forEach(function (key) {
14
16
  }
15
17
  });
16
18
  });
19
+
17
20
  var _DateScalar = require("./DateScalar");
21
+
18
22
  Object.keys(_DateScalar).forEach(function (key) {
19
23
  if (key === "default" || key === "__esModule") return;
20
24
  if (key in exports && exports[key] === _DateScalar[key]) return;
@@ -25,7 +29,9 @@ Object.keys(_DateScalar).forEach(function (key) {
25
29
  }
26
30
  });
27
31
  });
32
+
28
33
  var _DateTimeScalar = require("./DateTimeScalar");
34
+
29
35
  Object.keys(_DateTimeScalar).forEach(function (key) {
30
36
  if (key === "default" || key === "__esModule") return;
31
37
  if (key in exports && exports[key] === _DateTimeScalar[key]) return;
@@ -36,7 +42,9 @@ Object.keys(_DateTimeScalar).forEach(function (key) {
36
42
  }
37
43
  });
38
44
  });
45
+
39
46
  var _DateTimeZScalar = require("./DateTimeZScalar");
47
+
40
48
  Object.keys(_DateTimeZScalar).forEach(function (key) {
41
49
  if (key === "default" || key === "__esModule") return;
42
50
  if (key in exports && exports[key] === _DateTimeZScalar[key]) return;
@@ -47,7 +55,9 @@ Object.keys(_DateTimeZScalar).forEach(function (key) {
47
55
  }
48
56
  });
49
57
  });
58
+
50
59
  var _JsonScalar = require("./JsonScalar");
60
+
51
61
  Object.keys(_JsonScalar).forEach(function (key) {
52
62
  if (key === "default" || key === "__esModule") return;
53
63
  if (key in exports && exports[key] === _JsonScalar[key]) return;
@@ -58,7 +68,9 @@ Object.keys(_JsonScalar).forEach(function (key) {
58
68
  }
59
69
  });
60
70
  });
71
+
61
72
  var _LongScalar = require("./LongScalar");
73
+
62
74
  Object.keys(_LongScalar).forEach(function (key) {
63
75
  if (key === "default" || key === "__esModule") return;
64
76
  if (key in exports && exports[key] === _LongScalar[key]) return;
@@ -69,7 +81,9 @@ Object.keys(_LongScalar).forEach(function (key) {
69
81
  }
70
82
  });
71
83
  });
84
+
72
85
  var _NumberScalar = require("./NumberScalar");
86
+
73
87
  Object.keys(_NumberScalar).forEach(function (key) {
74
88
  if (key === "default" || key === "__esModule") return;
75
89
  if (key in exports && exports[key] === _NumberScalar[key]) return;
@@ -80,7 +94,9 @@ Object.keys(_NumberScalar).forEach(function (key) {
80
94
  }
81
95
  });
82
96
  });
97
+
83
98
  var _RefInputScalar = require("./RefInputScalar");
99
+
84
100
  Object.keys(_RefInputScalar).forEach(function (key) {
85
101
  if (key === "default" || key === "__esModule") return;
86
102
  if (key in exports && exports[key] === _RefInputScalar[key]) return;
@@ -91,7 +107,9 @@ Object.keys(_RefInputScalar).forEach(function (key) {
91
107
  }
92
108
  });
93
109
  });
110
+
94
111
  var _TimeScalar = require("./TimeScalar");
112
+
95
113
  Object.keys(_TimeScalar).forEach(function (key) {
96
114
  if (key === "default" || key === "__esModule") return;
97
115
  if (key in exports && exports[key] === _TimeScalar[key]) return;
@@ -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\";\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,23 +1,32 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _boolean = require("boolean");
11
+
9
12
  var _createGraphQLSchema = require("./createGraphQLSchema");
13
+
10
14
  var _debugPlugins = _interopRequireDefault(require("./debugPlugins"));
15
+
11
16
  var _processRequestBody = _interopRequireDefault(require("./processRequestBody"));
17
+
12
18
  var _handler = require("@webiny/handler");
19
+
13
20
  const DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year
14
21
 
15
22
  /**
16
23
  * TODO Until we figure out how to better convert incoming body, we will leave it as any.
17
24
  */
25
+
18
26
  const createRequestBody = body => {
19
27
  return typeof body === "string" ? JSON.parse(body) : body;
20
28
  };
29
+
21
30
  var _default = (options = {}) => {
22
31
  let schema = undefined;
23
32
  const debug = (0, _boolean.boolean)(options.debug);
@@ -36,6 +45,7 @@ var _default = (options = {}) => {
36
45
  if (!schema) {
37
46
  schema = (0, _createGraphQLSchema.createGraphQLSchema)(context);
38
47
  }
48
+
39
49
  const body = createRequestBody(request.body);
40
50
  const result = await (0, _processRequestBody.default)(body, schema, context);
41
51
  return reply.status(200).send(result);
@@ -46,4 +56,5 @@ var _default = (options = {}) => {
46
56
  type: "wcp-telemetry-tracker"
47
57
  }, route];
48
58
  };
59
+
49
60
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_CACHE_MAX_AGE","createRequestBody","body","JSON","parse","options","schema","undefined","debug","boolean","path","route","RoutePlugin","onPost","onOptions","context","_","reply","status","headers","send","request","createGraphQLSchema","result","processRequestBody","name","debugPlugins","type"],"sources":["createGraphQLHandler.ts"],"sourcesContent":["import { boolean } from \"boolean\";\nimport { HandlerGraphQLOptions } from \"./types\";\nimport { createGraphQLSchema } from \"./createGraphQLSchema\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport debugPlugins from \"./debugPlugins\";\nimport processRequestBody from \"./processRequestBody\";\nimport { GraphQLSchema } from \"graphql\";\nimport { RoutePlugin } from \"@webiny/handler\";\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\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 schema = createGraphQLSchema(context);\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\";\n\n return [\n ...(debug ? debugPlugins() : []),\n {\n type: \"wcp-telemetry-tracker\"\n },\n route\n ];\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAEA;AACA;AAEA;AAEA,MAAMA,qBAAqB,GAAG,QAAQ,CAAC,CAAC;;AAExC;AACA;AACA;AACA,MAAMC,iBAAiB,GAAIC,IAAS,IAAU;EAC1C,OAAO,OAAOA,IAAI,KAAK,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC,GAAGA,IAAI;AAC7D,CAAC;AAAC,eAEa,CAACG,OAA8B,GAAG,CAAC,CAAC,KAAuB;EACtE,IAAIC,MAAiC,GAAGC,SAAS;EAEjD,MAAMC,KAAK,GAAG,IAAAC,gBAAO,EAACJ,OAAO,CAACG,KAAK,CAAC;EAEpC,MAAME,IAAI,GAAG,CAAAL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,IAAI,KAAI,UAAU;EAExC,MAAMC,KAAK,GAAG,IAAIC,oBAAW,CAAC,OAAO;IAAEC,MAAM;IAAEC,SAAS;IAAEC;EAAQ,CAAC,KAAK;IACpED,SAAS,CAACJ,IAAI,EAAE,OAAOM,CAAC,EAAEC,KAAK,KAAK;MAChC,OAAOA,KAAK,CACPC,MAAM,CAAC,GAAG,CAAC,CACXC,OAAO,CAAC;QACL,eAAe,EAAG,mBAAkBnB,qBAAsB;MAC9D,CAAC,CAAC,CACDoB,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC;IACFP,MAAM,CAACH,IAAI,EAAE,OAAOW,OAAO,EAAEJ,KAAK,KAAK;MACnC,IAAI,CAACX,MAAM,EAAE;QACTA,MAAM,GAAG,IAAAgB,wCAAmB,EAACP,OAAO,CAAC;MACzC;MACA,MAAMb,IAAI,GAAGD,iBAAiB,CAACoB,OAAO,CAACnB,IAAI,CAAC;MAC5C,MAAMqB,MAAM,GAAG,MAAM,IAAAC,2BAAkB,EAACtB,IAAI,EAAEI,MAAM,EAAES,OAAO,CAAC;MAC9D,OAAOE,KAAK,CAACC,MAAM,CAAC,GAAG,CAAC,CAACE,IAAI,CAACG,MAAM,CAAC;IACzC,CAAC,CAAC;EACN,CAAC,CAAC;EAEFZ,KAAK,CAACc,IAAI,GAAG,+BAA+B;EAE5C,OAAO,CACH,IAAIjB,KAAK,GAAG,IAAAkB,qBAAY,GAAE,GAAG,EAAE,CAAC,EAChC;IACIC,IAAI,EAAE;EACV,CAAC,EACDhB,KAAK,CACR;AACL,CAAC;AAAA"}
1
+ {"version":3,"names":["DEFAULT_CACHE_MAX_AGE","createRequestBody","body","JSON","parse","options","schema","undefined","debug","boolean","path","route","RoutePlugin","onPost","onOptions","context","_","reply","status","headers","send","request","createGraphQLSchema","result","processRequestBody","name","debugPlugins","type"],"sources":["createGraphQLHandler.ts"],"sourcesContent":["import { boolean } from \"boolean\";\nimport { HandlerGraphQLOptions } from \"./types\";\nimport { createGraphQLSchema } from \"./createGraphQLSchema\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport debugPlugins from \"./debugPlugins\";\nimport processRequestBody from \"./processRequestBody\";\nimport { GraphQLSchema } from \"graphql\";\nimport { RoutePlugin } from \"@webiny/handler\";\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\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 schema = createGraphQLSchema(context);\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\";\n\n return [\n ...(debug ? debugPlugins() : []),\n {\n type: \"wcp-telemetry-tracker\"\n },\n route\n ];\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA,MAAMA,qBAAqB,GAAG,QAA9B,C,CAAwC;;AAExC;AACA;AACA;;AACA,MAAMC,iBAAiB,GAAIC,IAAD,IAAoB;EAC1C,OAAO,OAAOA,IAAP,KAAgB,QAAhB,GAA2BC,IAAI,CAACC,KAAL,CAAWF,IAAX,CAA3B,GAA8CA,IAArD;AACH,CAFD;;eAIe,CAACG,OAA8B,GAAG,EAAlC,KAA2D;EACtE,IAAIC,MAAiC,GAAGC,SAAxC;EAEA,MAAMC,KAAK,GAAG,IAAAC,gBAAA,EAAQJ,OAAO,CAACG,KAAhB,CAAd;EAEA,MAAME,IAAI,GAAG,CAAAL,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEK,IAAT,KAAiB,UAA9B;EAEA,MAAMC,KAAK,GAAG,IAAIC,oBAAJ,CAAgB,OAAO;IAAEC,MAAF;IAAUC,SAAV;IAAqBC;EAArB,CAAP,KAA0C;IACpED,SAAS,CAACJ,IAAD,EAAO,OAAOM,CAAP,EAAUC,KAAV,KAAoB;MAChC,OAAOA,KAAK,CACPC,MADE,CACK,GADL,EAEFC,OAFE,CAEM;QACL,iBAAkB,mBAAkBnB,qBAAsB;MADrD,CAFN,EAKFoB,IALE,CAKG,EALH,CAAP;IAMH,CAPQ,CAAT;IAQAP,MAAM,CAACH,IAAD,EAAO,OAAOW,OAAP,EAAgBJ,KAAhB,KAA0B;MACnC,IAAI,CAACX,MAAL,EAAa;QACTA,MAAM,GAAG,IAAAgB,wCAAA,EAAoBP,OAApB,CAAT;MACH;;MACD,MAAMb,IAAI,GAAGD,iBAAiB,CAACoB,OAAO,CAACnB,IAAT,CAA9B;MACA,MAAMqB,MAAM,GAAG,MAAM,IAAAC,2BAAA,EAAmBtB,IAAnB,EAAyBI,MAAzB,EAAiCS,OAAjC,CAArB;MACA,OAAOE,KAAK,CAACC,MAAN,CAAa,GAAb,EAAkBE,IAAlB,CAAuBG,MAAvB,CAAP;IACH,CAPK,CAAN;EAQH,CAjBa,CAAd;EAmBAZ,KAAK,CAACc,IAAN,GAAa,+BAAb;EAEA,OAAO,CACH,IAAIjB,KAAK,GAAG,IAAAkB,qBAAA,GAAH,GAAoB,EAA7B,CADG,EAEH;IACIC,IAAI,EAAE;EADV,CAFG,EAKHhB,KALG,CAAP;AAOH,C"}
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createGraphQLSchema = void 0;
9
+
8
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
9
12
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
13
+
10
14
  var _schema = require("@graphql-tools/schema");
15
+
11
16
  var _builtInTypes = require("./builtInTypes");
17
+
12
18
  const createGraphQLSchema = context => {
13
19
  const scalars = context.plugins.byType("graphql-scalar").map(item => item.scalar);
14
20
  const typeDefs = [(0, _graphqlTag.default)`
@@ -38,6 +44,7 @@ const createGraphQLSchema = context => {
38
44
  Time: _builtInTypes.TimeScalar
39
45
  })];
40
46
  const gqlPlugins = context.plugins.byType("graphql-schema");
47
+
41
48
  for (let i = 0; i < gqlPlugins.length; i++) {
42
49
  const plugin = gqlPlugins[i];
43
50
  /**
@@ -45,14 +52,17 @@ const createGraphQLSchema = context => {
45
52
  * Figure out correct types on typeDefs and resolvers
46
53
  */
47
54
  // @ts-ignore
48
- typeDefs.push(plugin.schema.typeDefs);
49
- // @ts-ignore
55
+
56
+ typeDefs.push(plugin.schema.typeDefs); // @ts-ignore
57
+
50
58
  resolvers.push(plugin.schema.resolvers);
51
59
  }
60
+
52
61
  return (0, _schema.makeExecutableSchema)({
53
62
  typeDefs,
54
63
  resolvers,
55
64
  inheritResolversFromInterfaces: true
56
65
  });
57
66
  };
67
+
58
68
  exports.createGraphQLSchema = createGraphQLSchema;
@@ -1 +1 @@
1
- {"version":3,"names":["createGraphQLSchema","context","scalars","plugins","byType","map","item","scalar","typeDefs","gql","name","join","resolvers","reduce","acc","s","JSON","JsonScalar","Long","LongScalar","RefInput","Number","NumberScalar","Any","AnyScalar","DateTime","DateTimeScalar","Date","DateScalar","Time","TimeScalar","gqlPlugins","i","length","plugin","push","schema","makeExecutableSchema","inheritResolversFromInterfaces"],"sources":["createGraphQLSchema.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { makeExecutableSchema } from \"@graphql-tools/schema\";\nimport { GraphQLScalarPlugin, GraphQLSchemaPlugin } from \"./types\";\nimport { Context } from \"@webiny/api/types\";\nimport {\n RefInput,\n NumberScalar,\n AnyScalar,\n DateScalar,\n DateTimeScalar,\n JsonScalar,\n TimeScalar,\n LongScalar\n} from \"./builtInTypes\";\nimport { GraphQLScalarType } from \"graphql/type/definition\";\n\nexport const createGraphQLSchema = (context: Context) => {\n const scalars = context.plugins\n .byType<GraphQLScalarPlugin>(\"graphql-scalar\")\n .map(item => item.scalar);\n\n const typeDefs = [\n gql`\n type Query\n type Mutation\n ${scalars.map(scalar => `scalar ${scalar.name}`).join(\" \")}\n scalar JSON\n scalar Long\n scalar RefInput\n scalar Number\n scalar Any\n scalar Date\n scalar DateTime\n scalar Time\n `\n ];\n\n const resolvers = [\n {\n ...scalars.reduce((acc, s) => {\n acc[s.name] = s;\n return acc;\n }, {} as Record<string, GraphQLScalarType>),\n JSON: JsonScalar,\n Long: LongScalar,\n RefInput,\n Number: NumberScalar,\n Any: AnyScalar,\n DateTime: DateTimeScalar,\n Date: DateScalar,\n Time: TimeScalar\n }\n ];\n\n const gqlPlugins = context.plugins.byType<GraphQLSchemaPlugin>(\"graphql-schema\");\n for (let i = 0; i < gqlPlugins.length; i++) {\n const plugin = gqlPlugins[i];\n /**\n * TODO @ts-refactor\n * Figure out correct types on typeDefs and resolvers\n */\n // @ts-ignore\n typeDefs.push(plugin.schema.typeDefs);\n // @ts-ignore\n resolvers.push(plugin.schema.resolvers);\n }\n\n return makeExecutableSchema({\n typeDefs,\n resolvers,\n inheritResolversFromInterfaces: true\n });\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AAGA;AAYO,MAAMA,mBAAmB,GAAIC,OAAgB,IAAK;EACrD,MAAMC,OAAO,GAAGD,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAsB,gBAAgB,CAAC,CAC7CC,GAAG,CAACC,IAAI,IAAIA,IAAI,CAACC,MAAM,CAAC;EAE7B,MAAMC,QAAQ,GAAG,CACb,IAAAC,mBAAG,CAAC;AACZ;AACA;AACA,cAAcP,OAAO,CAACG,GAAG,CAACE,MAAM,IAAK,UAASA,MAAM,CAACG,IAAK,EAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,CACJ;EAED,MAAMC,SAAS,GAAG,6DAEPV,OAAO,CAACW,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,KAAK;IAC1BD,GAAG,CAACC,CAAC,CAACL,IAAI,CAAC,GAAGK,CAAC;IACf,OAAOD,GAAG;EACd,CAAC,EAAE,CAAC,CAAC,CAAsC;IAC3CE,IAAI,EAAEC,wBAAU;IAChBC,IAAI,EAAEC,wBAAU;IAChBC,QAAQ,EAARA,sBAAQ;IACRC,MAAM,EAAEC,0BAAY;IACpBC,GAAG,EAAEC,uBAAS;IACdC,QAAQ,EAAEC,4BAAc;IACxBC,IAAI,EAAEC,wBAAU;IAChBC,IAAI,EAAEC;EAAU,GAEvB;EAED,MAAMC,UAAU,GAAG9B,OAAO,CAACE,OAAO,CAACC,MAAM,CAAsB,gBAAgB,CAAC;EAChF,KAAK,IAAI4B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,UAAU,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;IACxC,MAAME,MAAM,GAAGH,UAAU,CAACC,CAAC,CAAC;IAC5B;AACR;AACA;AACA;IACQ;IACAxB,QAAQ,CAAC2B,IAAI,CAACD,MAAM,CAACE,MAAM,CAAC5B,QAAQ,CAAC;IACrC;IACAI,SAAS,CAACuB,IAAI,CAACD,MAAM,CAACE,MAAM,CAACxB,SAAS,CAAC;EAC3C;EAEA,OAAO,IAAAyB,4BAAoB,EAAC;IACxB7B,QAAQ;IACRI,SAAS;IACT0B,8BAA8B,EAAE;EACpC,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["createGraphQLSchema","context","scalars","plugins","byType","map","item","scalar","typeDefs","gql","name","join","resolvers","reduce","acc","s","JSON","JsonScalar","Long","LongScalar","RefInput","Number","NumberScalar","Any","AnyScalar","DateTime","DateTimeScalar","Date","DateScalar","Time","TimeScalar","gqlPlugins","i","length","plugin","push","schema","makeExecutableSchema","inheritResolversFromInterfaces"],"sources":["createGraphQLSchema.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { makeExecutableSchema } from \"@graphql-tools/schema\";\nimport { GraphQLScalarPlugin, GraphQLSchemaPlugin } from \"./types\";\nimport { Context } from \"@webiny/api/types\";\nimport {\n RefInput,\n NumberScalar,\n AnyScalar,\n DateScalar,\n DateTimeScalar,\n JsonScalar,\n TimeScalar,\n LongScalar\n} from \"./builtInTypes\";\nimport { GraphQLScalarType } from \"graphql/type/definition\";\n\nexport const createGraphQLSchema = (context: Context) => {\n const scalars = context.plugins\n .byType<GraphQLScalarPlugin>(\"graphql-scalar\")\n .map(item => item.scalar);\n\n const typeDefs = [\n gql`\n type Query\n type Mutation\n ${scalars.map(scalar => `scalar ${scalar.name}`).join(\" \")}\n scalar JSON\n scalar Long\n scalar RefInput\n scalar Number\n scalar Any\n scalar Date\n scalar DateTime\n scalar Time\n `\n ];\n\n const resolvers = [\n {\n ...scalars.reduce((acc, s) => {\n acc[s.name] = s;\n return acc;\n }, {} as Record<string, GraphQLScalarType>),\n JSON: JsonScalar,\n Long: LongScalar,\n RefInput,\n Number: NumberScalar,\n Any: AnyScalar,\n DateTime: DateTimeScalar,\n Date: DateScalar,\n Time: TimeScalar\n }\n ];\n\n const gqlPlugins = context.plugins.byType<GraphQLSchemaPlugin>(\"graphql-schema\");\n for (let i = 0; i < gqlPlugins.length; i++) {\n const plugin = gqlPlugins[i];\n /**\n * TODO @ts-refactor\n * Figure out correct types on typeDefs and resolvers\n */\n // @ts-ignore\n typeDefs.push(plugin.schema.typeDefs);\n // @ts-ignore\n resolvers.push(plugin.schema.resolvers);\n }\n\n return makeExecutableSchema({\n typeDefs,\n resolvers,\n inheritResolversFromInterfaces: true\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAGA;;AAYO,MAAMA,mBAAmB,GAAIC,OAAD,IAAsB;EACrD,MAAMC,OAAO,GAAGD,OAAO,CAACE,OAAR,CACXC,MADW,CACiB,gBADjB,EAEXC,GAFW,CAEPC,IAAI,IAAIA,IAAI,CAACC,MAFN,CAAhB;EAIA,MAAMC,QAAQ,GAAG,CACb,IAAAC,mBAAA,CAAI;AACZ;AACA;AACA,cAAcP,OAAO,CAACG,GAAR,CAAYE,MAAM,IAAK,UAASA,MAAM,CAACG,IAAK,EAA5C,EAA+CC,IAA/C,CAAoD,GAApD,CAAyD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAbqB,CAAjB;EAgBA,MAAMC,SAAS,GAAG,6DAEPV,OAAO,CAACW,MAAR,CAAe,CAACC,GAAD,EAAMC,CAAN,KAAY;IAC1BD,GAAG,CAACC,CAAC,CAACL,IAAH,CAAH,GAAcK,CAAd;IACA,OAAOD,GAAP;EACH,CAHE,EAGA,EAHA,CAFO;IAMVE,IAAI,EAAEC,wBANI;IAOVC,IAAI,EAAEC,wBAPI;IAQVC,QAAQ,EAARA,sBARU;IASVC,MAAM,EAAEC,0BATE;IAUVC,GAAG,EAAEC,uBAVK;IAWVC,QAAQ,EAAEC,4BAXA;IAYVC,IAAI,EAAEC,wBAZI;IAaVC,IAAI,EAAEC;EAbI,GAAlB;EAiBA,MAAMC,UAAU,GAAG9B,OAAO,CAACE,OAAR,CAAgBC,MAAhB,CAA4C,gBAA5C,CAAnB;;EACA,KAAK,IAAI4B,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,UAAU,CAACE,MAA/B,EAAuCD,CAAC,EAAxC,EAA4C;IACxC,MAAME,MAAM,GAAGH,UAAU,CAACC,CAAD,CAAzB;IACA;AACR;AACA;AACA;IACQ;;IACAxB,QAAQ,CAAC2B,IAAT,CAAcD,MAAM,CAACE,MAAP,CAAc5B,QAA5B,EAPwC,CAQxC;;IACAI,SAAS,CAACuB,IAAV,CAAeD,MAAM,CAACE,MAAP,CAAcxB,SAA7B;EACH;;EAED,OAAO,IAAAyB,4BAAA,EAAqB;IACxB7B,QADwB;IAExBI,SAFwB;IAGxB0B,8BAA8B,EAAE;EAHR,CAArB,CAAP;AAKH,CAxDM"}
package/debugPlugins.js CHANGED
@@ -4,15 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _interceptConsole = require("./interceptConsole");
9
+
8
10
  var _api = require("@webiny/api");
11
+
9
12
  var _default = () => [new _api.ContextPlugin(async context => {
10
13
  if (!context.debug) {
11
14
  context.debug = {};
12
15
  }
16
+
13
17
  if (!context.debug.logs) {
14
18
  context.debug.logs = [];
15
19
  }
20
+
16
21
  (0, _interceptConsole.interceptConsole)((method, args) => {
17
22
  context.debug.logs.push({
18
23
  method,
@@ -21,6 +26,7 @@ var _default = () => [new _api.ContextPlugin(async context => {
21
26
  });
22
27
  }), {
23
28
  type: "graphql-after-query",
29
+
24
30
  apply({
25
31
  result,
26
32
  context
@@ -28,9 +34,12 @@ var _default = () => [new _api.ContextPlugin(async context => {
28
34
  result["extensions"] = {
29
35
  console: [...(context.debug.logs || [])]
30
36
  };
37
+
31
38
  if (context.debug.logs) {
32
39
  context.debug.logs.length = 0;
33
40
  }
34
41
  }
42
+
35
43
  }];
44
+
36
45
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["ContextPlugin","context","debug","logs","interceptConsole","method","args","push","type","apply","result","console","length"],"sources":["debugPlugins.ts"],"sourcesContent":["import { interceptConsole } from \"./interceptConsole\";\nimport { GraphQLAfterQueryPlugin } from \"./types\";\nimport { Context } from \"@webiny/api/types\";\nimport { ContextPlugin } from \"@webiny/api\";\n\ninterface Log {\n method: string;\n args: any;\n}\ninterface DebugContext extends Context {\n debug: {\n logs?: Log[];\n };\n}\n\nexport default () => [\n new ContextPlugin<DebugContext>(async context => {\n if (!context.debug) {\n context.debug = {};\n }\n\n if (!context.debug.logs) {\n context.debug.logs = [];\n }\n\n interceptConsole((method, args) => {\n (context.debug.logs as Log[]).push({ method, args });\n });\n }),\n {\n type: \"graphql-after-query\",\n apply({ result, context }) {\n result[\"extensions\"] = { console: [...(context.debug.logs || [])] };\n if (context.debug.logs) {\n context.debug.logs.length = 0;\n }\n }\n } as GraphQLAfterQueryPlugin<DebugContext>\n];\n"],"mappings":";;;;;;AAAA;AAGA;AAA4C,eAY7B,MAAM,CACjB,IAAIA,kBAAa,CAAe,MAAMC,OAAO,IAAI;EAC7C,IAAI,CAACA,OAAO,CAACC,KAAK,EAAE;IAChBD,OAAO,CAACC,KAAK,GAAG,CAAC,CAAC;EACtB;EAEA,IAAI,CAACD,OAAO,CAACC,KAAK,CAACC,IAAI,EAAE;IACrBF,OAAO,CAACC,KAAK,CAACC,IAAI,GAAG,EAAE;EAC3B;EAEA,IAAAC,kCAAgB,EAAC,CAACC,MAAM,EAAEC,IAAI,KAAK;IAC9BL,OAAO,CAACC,KAAK,CAACC,IAAI,CAAWI,IAAI,CAAC;MAAEF,MAAM;MAAEC;IAAK,CAAC,CAAC;EACxD,CAAC,CAAC;AACN,CAAC,CAAC,EACF;EACIE,IAAI,EAAE,qBAAqB;EAC3BC,KAAK,CAAC;IAAEC,MAAM;IAAET;EAAQ,CAAC,EAAE;IACvBS,MAAM,CAAC,YAAY,CAAC,GAAG;MAAEC,OAAO,EAAE,CAAC,IAAIV,OAAO,CAACC,KAAK,CAACC,IAAI,IAAI,EAAE,CAAC;IAAE,CAAC;IACnE,IAAIF,OAAO,CAACC,KAAK,CAACC,IAAI,EAAE;MACpBF,OAAO,CAACC,KAAK,CAACC,IAAI,CAACS,MAAM,GAAG,CAAC;IACjC;EACJ;AACJ,CAAC,CACJ;AAAA"}
1
+ {"version":3,"names":["ContextPlugin","context","debug","logs","interceptConsole","method","args","push","type","apply","result","console","length"],"sources":["debugPlugins.ts"],"sourcesContent":["import { interceptConsole } from \"./interceptConsole\";\nimport { GraphQLAfterQueryPlugin } from \"./types\";\nimport { Context } from \"@webiny/api/types\";\nimport { ContextPlugin } from \"@webiny/api\";\n\ninterface Log {\n method: string;\n args: any;\n}\ninterface DebugContext extends Context {\n debug: {\n logs?: Log[];\n };\n}\n\nexport default () => [\n new ContextPlugin<DebugContext>(async context => {\n if (!context.debug) {\n context.debug = {};\n }\n\n if (!context.debug.logs) {\n context.debug.logs = [];\n }\n\n interceptConsole((method, args) => {\n (context.debug.logs as Log[]).push({ method, args });\n });\n }),\n {\n type: \"graphql-after-query\",\n apply({ result, context }) {\n result[\"extensions\"] = { console: [...(context.debug.logs || [])] };\n if (context.debug.logs) {\n context.debug.logs.length = 0;\n }\n }\n } as GraphQLAfterQueryPlugin<DebugContext>\n];\n"],"mappings":";;;;;;;AAAA;;AAGA;;eAYe,MAAM,CACjB,IAAIA,kBAAJ,CAAgC,MAAMC,OAAN,IAAiB;EAC7C,IAAI,CAACA,OAAO,CAACC,KAAb,EAAoB;IAChBD,OAAO,CAACC,KAAR,GAAgB,EAAhB;EACH;;EAED,IAAI,CAACD,OAAO,CAACC,KAAR,CAAcC,IAAnB,EAAyB;IACrBF,OAAO,CAACC,KAAR,CAAcC,IAAd,GAAqB,EAArB;EACH;;EAED,IAAAC,kCAAA,EAAiB,CAACC,MAAD,EAASC,IAAT,KAAkB;IAC9BL,OAAO,CAACC,KAAR,CAAcC,IAAf,CAA8BI,IAA9B,CAAmC;MAAEF,MAAF;MAAUC;IAAV,CAAnC;EACH,CAFD;AAGH,CAZD,CADiB,EAcjB;EACIE,IAAI,EAAE,qBADV;;EAEIC,KAAK,CAAC;IAAEC,MAAF;IAAUT;EAAV,CAAD,EAAsB;IACvBS,MAAM,CAAC,YAAD,CAAN,GAAuB;MAAEC,OAAO,EAAE,CAAC,IAAIV,OAAO,CAACC,KAAR,CAAcC,IAAd,IAAsB,EAA1B,CAAD;IAAX,CAAvB;;IACA,IAAIF,OAAO,CAACC,KAAR,CAAcC,IAAlB,EAAwB;MACpBF,OAAO,CAACC,KAAR,CAAcC,IAAd,CAAmBS,MAAnB,GAA4B,CAA5B;IACH;EACJ;;AAPL,CAdiB,C"}
package/errors.js CHANGED
@@ -1,14 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.NotFoundError = void 0;
9
+
8
10
  var _error = _interopRequireDefault(require("@webiny/error"));
11
+
9
12
  class NotFoundError extends _error.default {
10
13
  constructor(message = "Not found.") {
11
14
  super(message, "NOT_FOUND");
12
15
  }
16
+
13
17
  }
18
+
14
19
  exports.NotFoundError = NotFoundError;
package/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["NotFoundError","WebinyError","constructor","message"],"sources":["errors.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nexport class NotFoundError extends WebinyError {\n constructor(message = \"Not found.\") {\n super(message, \"NOT_FOUND\");\n }\n}\n"],"mappings":";;;;;;;AAAA;AAEO,MAAMA,aAAa,SAASC,cAAW,CAAC;EAC3CC,WAAW,CAACC,OAAO,GAAG,YAAY,EAAE;IAChC,KAAK,CAACA,OAAO,EAAE,WAAW,CAAC;EAC/B;AACJ;AAAC"}
1
+ {"version":3,"names":["NotFoundError","WebinyError","constructor","message"],"sources":["errors.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nexport class NotFoundError extends WebinyError {\n constructor(message = \"Not found.\") {\n super(message, \"NOT_FOUND\");\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEO,MAAMA,aAAN,SAA4BC,cAA5B,CAAwC;EAC3CC,WAAW,CAACC,OAAO,GAAG,YAAX,EAAyB;IAChC,MAAMA,OAAN,EAAe,WAAf;EACH;;AAH0C"}
package/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  var _exportNames = {};
8
9
  exports.default = void 0;
10
+
9
11
  var _createGraphQLHandler = _interopRequireDefault(require("./createGraphQLHandler"));
12
+
10
13
  var _errors = require("./errors");
14
+
11
15
  Object.keys(_errors).forEach(function (key) {
12
16
  if (key === "default" || key === "__esModule") return;
13
17
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -19,7 +23,9 @@ Object.keys(_errors).forEach(function (key) {
19
23
  }
20
24
  });
21
25
  });
26
+
22
27
  var _responses = require("./responses");
28
+
23
29
  Object.keys(_responses).forEach(function (key) {
24
30
  if (key === "default" || key === "__esModule") return;
25
31
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -31,7 +37,9 @@ Object.keys(_responses).forEach(function (key) {
31
37
  }
32
38
  });
33
39
  });
40
+
34
41
  var _plugins = require("./plugins");
42
+
35
43
  Object.keys(_plugins).forEach(function (key) {
36
44
  if (key === "default" || key === "__esModule") return;
37
45
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -43,5 +51,7 @@ Object.keys(_plugins).forEach(function (key) {
43
51
  }
44
52
  });
45
53
  });
54
+
46
55
  var _default = (options = {}) => [(0, _createGraphQLHandler.default)(options)];
56
+
47
57
  exports.default = _default;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["options","createGraphQLHandler"],"sources":["index.ts"],"sourcesContent":["import { HandlerGraphQLOptions } from \"./types\";\nimport createGraphQLHandler from \"./createGraphQLHandler\";\n\nexport * from \"./errors\";\nexport * from \"./responses\";\nexport * from \"./plugins\";\n\nexport default (options: HandlerGraphQLOptions = {}) => [createGraphQLHandler(options)];\n"],"mappings":";;;;;;;;AACA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAA0B,eAEX,CAACA,OAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,IAAAC,6BAAoB,EAACD,OAAO,CAAC,CAAC;AAAA"}
1
+ {"version":3,"names":["options","createGraphQLHandler"],"sources":["index.ts"],"sourcesContent":["import { HandlerGraphQLOptions } from \"./types\";\nimport createGraphQLHandler from \"./createGraphQLHandler\";\n\nexport * from \"./errors\";\nexport * from \"./responses\";\nexport * from \"./plugins\";\n\nexport default (options: HandlerGraphQLOptions = {}) => [createGraphQLHandler(options)];\n"],"mappings":";;;;;;;;;;AACA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;eAEe,CAACA,OAA8B,GAAG,EAAlC,KAAyC,CAAC,IAAAC,6BAAA,EAAqBD,OAArB,CAAD,C"}
@@ -7,31 +7,37 @@ exports.interceptConsole = void 0;
7
7
  const consoleMethods = ["assert", "debug", "dir", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "table", "warn"];
8
8
  const originalMethods = {};
9
9
  const skipOriginal = ["table"];
10
+
10
11
  const restoreOriginalMethods = () => {
11
12
  for (const method of consoleMethods) {
12
13
  // @ts-ignore
13
14
  console[method] = originalMethods[method];
14
15
  }
15
16
  };
17
+
16
18
  const interceptConsole = callback => {
17
19
  // @ts-ignore
18
20
  if (console["__WEBINY__"] === true) {
19
21
  restoreOriginalMethods();
20
- }
22
+ } // @ts-ignore
23
+
21
24
 
22
- // @ts-ignore
23
25
  console["__WEBINY__"] = true;
26
+
24
27
  for (const method of consoleMethods) {
25
28
  // @ts-ignore
26
- originalMethods[method] = console[method];
27
- // @ts-ignore
29
+ originalMethods[method] = console[method]; // @ts-ignore
30
+
28
31
  console[method] = (...args) => {
29
32
  callback(method, args);
33
+
30
34
  if (skipOriginal.includes(method)) {
31
35
  return;
32
36
  }
37
+
33
38
  originalMethods[method](...args);
34
39
  };
35
40
  }
36
41
  };
42
+
37
43
  exports.interceptConsole = interceptConsole;
@@ -1 +1 @@
1
- {"version":3,"names":["consoleMethods","originalMethods","skipOriginal","restoreOriginalMethods","method","console","interceptConsole","callback","args","includes"],"sources":["interceptConsole.ts"],"sourcesContent":["const consoleMethods = [\n \"assert\",\n \"debug\",\n \"dir\",\n \"error\",\n \"group\",\n \"groupCollapsed\",\n \"groupEnd\",\n \"info\",\n \"log\",\n \"table\",\n \"warn\"\n];\n\nconst originalMethods: Record<string, any> = {};\nconst skipOriginal: string[] = [\"table\"];\n\nconst restoreOriginalMethods = () => {\n for (const method of consoleMethods) {\n // @ts-ignore\n console[method] = originalMethods[method];\n }\n};\n\ninterface InterceptConsoleCallable {\n (method: string, args: any[]): void;\n}\n\nexport const interceptConsole = (callback: InterceptConsoleCallable) => {\n // @ts-ignore\n if (console[\"__WEBINY__\"] === true) {\n restoreOriginalMethods();\n }\n\n // @ts-ignore\n console[\"__WEBINY__\"] = true;\n\n for (const method of consoleMethods) {\n // @ts-ignore\n originalMethods[method] = console[method];\n // @ts-ignore\n console[method] = (...args) => {\n callback(method, args);\n if (skipOriginal.includes(method)) {\n return;\n }\n originalMethods[method](...args);\n };\n }\n};\n"],"mappings":";;;;;;AAAA,MAAMA,cAAc,GAAG,CACnB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,CACT;AAED,MAAMC,eAAoC,GAAG,CAAC,CAAC;AAC/C,MAAMC,YAAsB,GAAG,CAAC,OAAO,CAAC;AAExC,MAAMC,sBAAsB,GAAG,MAAM;EACjC,KAAK,MAAMC,MAAM,IAAIJ,cAAc,EAAE;IACjC;IACAK,OAAO,CAACD,MAAM,CAAC,GAAGH,eAAe,CAACG,MAAM,CAAC;EAC7C;AACJ,CAAC;AAMM,MAAME,gBAAgB,GAAIC,QAAkC,IAAK;EACpE;EACA,IAAIF,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE;IAChCF,sBAAsB,EAAE;EAC5B;;EAEA;EACAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;EAE5B,KAAK,MAAMD,MAAM,IAAIJ,cAAc,EAAE;IACjC;IACAC,eAAe,CAACG,MAAM,CAAC,GAAGC,OAAO,CAACD,MAAM,CAAC;IACzC;IACAC,OAAO,CAACD,MAAM,CAAC,GAAG,CAAC,GAAGI,IAAI,KAAK;MAC3BD,QAAQ,CAACH,MAAM,EAAEI,IAAI,CAAC;MACtB,IAAIN,YAAY,CAACO,QAAQ,CAACL,MAAM,CAAC,EAAE;QAC/B;MACJ;MACAH,eAAe,CAACG,MAAM,CAAC,CAAC,GAAGI,IAAI,CAAC;IACpC,CAAC;EACL;AACJ,CAAC;AAAC"}
1
+ {"version":3,"names":["consoleMethods","originalMethods","skipOriginal","restoreOriginalMethods","method","console","interceptConsole","callback","args","includes"],"sources":["interceptConsole.ts"],"sourcesContent":["const consoleMethods = [\n \"assert\",\n \"debug\",\n \"dir\",\n \"error\",\n \"group\",\n \"groupCollapsed\",\n \"groupEnd\",\n \"info\",\n \"log\",\n \"table\",\n \"warn\"\n];\n\nconst originalMethods: Record<string, any> = {};\nconst skipOriginal: string[] = [\"table\"];\n\nconst restoreOriginalMethods = () => {\n for (const method of consoleMethods) {\n // @ts-ignore\n console[method] = originalMethods[method];\n }\n};\n\ninterface InterceptConsoleCallable {\n (method: string, args: any[]): void;\n}\n\nexport const interceptConsole = (callback: InterceptConsoleCallable) => {\n // @ts-ignore\n if (console[\"__WEBINY__\"] === true) {\n restoreOriginalMethods();\n }\n\n // @ts-ignore\n console[\"__WEBINY__\"] = true;\n\n for (const method of consoleMethods) {\n // @ts-ignore\n originalMethods[method] = console[method];\n // @ts-ignore\n console[method] = (...args) => {\n callback(method, args);\n if (skipOriginal.includes(method)) {\n return;\n }\n originalMethods[method](...args);\n };\n }\n};\n"],"mappings":";;;;;;AAAA,MAAMA,cAAc,GAAG,CACnB,QADmB,EAEnB,OAFmB,EAGnB,KAHmB,EAInB,OAJmB,EAKnB,OALmB,EAMnB,gBANmB,EAOnB,UAPmB,EAQnB,MARmB,EASnB,KATmB,EAUnB,OAVmB,EAWnB,MAXmB,CAAvB;AAcA,MAAMC,eAAoC,GAAG,EAA7C;AACA,MAAMC,YAAsB,GAAG,CAAC,OAAD,CAA/B;;AAEA,MAAMC,sBAAsB,GAAG,MAAM;EACjC,KAAK,MAAMC,MAAX,IAAqBJ,cAArB,EAAqC;IACjC;IACAK,OAAO,CAACD,MAAD,CAAP,GAAkBH,eAAe,CAACG,MAAD,CAAjC;EACH;AACJ,CALD;;AAWO,MAAME,gBAAgB,GAAIC,QAAD,IAAwC;EACpE;EACA,IAAIF,OAAO,CAAC,YAAD,CAAP,KAA0B,IAA9B,EAAoC;IAChCF,sBAAsB;EACzB,CAJmE,CAMpE;;;EACAE,OAAO,CAAC,YAAD,CAAP,GAAwB,IAAxB;;EAEA,KAAK,MAAMD,MAAX,IAAqBJ,cAArB,EAAqC;IACjC;IACAC,eAAe,CAACG,MAAD,CAAf,GAA0BC,OAAO,CAACD,MAAD,CAAjC,CAFiC,CAGjC;;IACAC,OAAO,CAACD,MAAD,CAAP,GAAkB,CAAC,GAAGI,IAAJ,KAAa;MAC3BD,QAAQ,CAACH,MAAD,EAASI,IAAT,CAAR;;MACA,IAAIN,YAAY,CAACO,QAAb,CAAsBL,MAAtB,CAAJ,EAAmC;QAC/B;MACH;;MACDH,eAAe,CAACG,MAAD,CAAf,CAAwB,GAAGI,IAA3B;IACH,CAND;EAOH;AACJ,CArBM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/handler-graphql",
3
- "version": "0.0.0-unstable.611c5af35e",
3
+ "version": "0.0.0-unstable.615a930a68",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,12 +14,12 @@
14
14
  "Adrian Smijulj <adrian@webiny.com>"
15
15
  ],
16
16
  "dependencies": {
17
- "@babel/runtime": "7.20.1",
17
+ "@babel/runtime": "7.19.0",
18
18
  "@graphql-tools/schema": "7.1.5",
19
- "@webiny/api": "0.0.0-unstable.611c5af35e",
20
- "@webiny/error": "0.0.0-unstable.611c5af35e",
21
- "@webiny/handler": "0.0.0-unstable.611c5af35e",
22
- "@webiny/plugins": "0.0.0-unstable.611c5af35e",
19
+ "@webiny/api": "0.0.0-unstable.615a930a68",
20
+ "@webiny/error": "0.0.0-unstable.615a930a68",
21
+ "@webiny/handler": "0.0.0-unstable.615a930a68",
22
+ "@webiny/plugins": "0.0.0-unstable.615a930a68",
23
23
  "boolean": "3.2.0",
24
24
  "graphql": "15.8.0",
25
25
  "graphql-scalars": "1.12.0",
@@ -29,9 +29,9 @@
29
29
  "@babel/cli": "^7.19.3",
30
30
  "@babel/core": "^7.19.3",
31
31
  "@babel/preset-env": "^7.19.4",
32
- "@webiny/cli": "^0.0.0-unstable.611c5af35e",
33
- "@webiny/handler-aws": "^0.0.0-unstable.611c5af35e",
34
- "@webiny/project-utils": "^0.0.0-unstable.611c5af35e",
32
+ "@webiny/cli": "^0.0.0-unstable.615a930a68",
33
+ "@webiny/handler-aws": "^0.0.0-unstable.615a930a68",
34
+ "@webiny/project-utils": "^0.0.0-unstable.615a930a68",
35
35
  "jest": "^28.1.0",
36
36
  "jest-mock-console": "^1.0.0",
37
37
  "rimraf": "^3.0.2",
@@ -45,5 +45,5 @@
45
45
  "build": "yarn webiny run build",
46
46
  "watch": "yarn webiny run watch"
47
47
  },
48
- "gitHead": "cdeed09317c2c0e07cb0d4d88f9ac38a214ddc22"
48
+ "gitHead": "615a930a68d692c832e4f100405eeb3f5a8874af"
49
49
  }
@@ -1,24 +1,31 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.GraphQLSchemaPlugin = void 0;
9
+
8
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
9
12
  var _plugins = require("@webiny/plugins");
13
+
10
14
  class GraphQLSchemaPlugin extends _plugins.Plugin {
11
15
  constructor(config) {
12
16
  super();
13
17
  (0, _defineProperty2.default)(this, "config", void 0);
14
18
  this.config = config;
15
19
  }
20
+
16
21
  get schema() {
17
22
  return {
18
23
  typeDefs: this.config.typeDefs || "",
19
24
  resolvers: this.config.resolvers
20
25
  };
21
26
  }
27
+
22
28
  }
29
+
23
30
  exports.GraphQLSchemaPlugin = GraphQLSchemaPlugin;
24
31
  (0, _defineProperty2.default)(GraphQLSchemaPlugin, "type", "graphql-schema");
@@ -1 +1 @@
1
- {"version":3,"names":["GraphQLSchemaPlugin","Plugin","constructor","config","schema","typeDefs","resolvers"],"sources":["GraphQLSchemaPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { GraphQLSchemaDefinition, Resolvers, Types } from \"~/types\";\nimport { Context } from \"@webiny/api/types\";\n\nexport interface GraphQLSchemaPluginConfig<TContext> {\n typeDefs?: Types;\n resolvers?: Resolvers<TContext>;\n}\n\nexport class GraphQLSchemaPlugin<TContext = Context> extends Plugin {\n public static override readonly type: string = \"graphql-schema\";\n private config: GraphQLSchemaPluginConfig<TContext>;\n\n constructor(config: GraphQLSchemaPluginConfig<TContext>) {\n super();\n this.config = config;\n }\n\n get schema(): GraphQLSchemaDefinition<TContext> {\n return {\n typeDefs: this.config.typeDefs || \"\",\n resolvers: this.config.resolvers\n };\n }\n}\n"],"mappings":";;;;;;;;AAAA;AASO,MAAMA,mBAAmB,SAA6BC,eAAM,CAAC;EAIhEC,WAAW,CAACC,MAA2C,EAAE;IACrD,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,IAAIC,MAAM,GAAsC;IAC5C,OAAO;MACHC,QAAQ,EAAE,IAAI,CAACF,MAAM,CAACE,QAAQ,IAAI,EAAE;MACpCC,SAAS,EAAE,IAAI,CAACH,MAAM,CAACG;IAC3B,CAAC;EACL;AACJ;AAAC;AAAA,8BAfYN,mBAAmB,UACmB,gBAAgB"}
1
+ {"version":3,"names":["GraphQLSchemaPlugin","Plugin","constructor","config","schema","typeDefs","resolvers"],"sources":["GraphQLSchemaPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { GraphQLSchemaDefinition, Resolvers, Types } from \"~/types\";\nimport { Context } from \"@webiny/api/types\";\n\nexport interface GraphQLSchemaPluginConfig<TContext> {\n typeDefs?: Types;\n resolvers?: Resolvers<TContext>;\n}\n\nexport class GraphQLSchemaPlugin<TContext = Context> extends Plugin {\n public static override readonly type: string = \"graphql-schema\";\n private config: GraphQLSchemaPluginConfig<TContext>;\n\n constructor(config: GraphQLSchemaPluginConfig<TContext>) {\n super();\n this.config = config;\n }\n\n get schema(): GraphQLSchemaDefinition<TContext> {\n return {\n typeDefs: this.config.typeDefs || \"\",\n resolvers: this.config.resolvers\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,mBAAN,SAAsDC,eAAtD,CAA6D;EAIhEC,WAAW,CAACC,MAAD,EAA8C;IACrD;IADqD;IAErD,KAAKA,MAAL,GAAcA,MAAd;EACH;;EAES,IAANC,MAAM,GAAsC;IAC5C,OAAO;MACHC,QAAQ,EAAE,KAAKF,MAAL,CAAYE,QAAZ,IAAwB,EAD/B;MAEHC,SAAS,EAAE,KAAKH,MAAL,CAAYG;IAFpB,CAAP;EAIH;;AAd+D;;;8BAAvDN,mB,UACsC,gB"}
package/plugins/index.js CHANGED
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+
6
7
  var _GraphQLSchemaPlugin = require("./GraphQLSchemaPlugin");
8
+
7
9
  Object.keys(_GraphQLSchemaPlugin).forEach(function (key) {
8
10
  if (key === "default" || key === "__esModule") return;
9
11
  if (key in exports && exports[key] === _GraphQLSchemaPlugin[key]) return;
@@ -1 +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
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./GraphQLSchemaPlugin\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _graphql = require("graphql");
9
+
8
10
  const processRequestBody = async (body, schema, context) => {
9
11
  const {
10
12
  query,
@@ -27,14 +29,19 @@ const processRequestBody = async (body, schema, context) => {
27
29
  });
28
30
  return result;
29
31
  };
32
+
30
33
  var _default = async (requestBody, schema, context) => {
31
34
  if (Array.isArray(requestBody) === true) {
32
35
  const result = [];
36
+
33
37
  for (let i = 0; i < requestBody.length; i++) {
34
38
  result.push(await processRequestBody(requestBody[i], schema, context));
35
39
  }
40
+
36
41
  return result;
37
42
  }
43
+
38
44
  return await processRequestBody(requestBody, schema, context);
39
45
  };
46
+
40
47
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["processRequestBody","body","schema","context","query","variables","operationName","plugins","byType","forEach","pl","apply","result","graphql","requestBody","Array","isArray","i","length","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) === true) {\n const result: ExecutionResult[] = [];\n for (let i = 0; i < (requestBody as GraphQLRequestBody[]).length; i++) {\n result.push(\n await processRequestBody((requestBody as GraphQLRequestBody[])[i], schema, context)\n );\n }\n return result;\n }\n return await processRequestBody(requestBody as GraphQLRequestBody, 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,KAAK,IAAI,EAAE;IACrC,MAAMF,MAAyB,GAAG,EAAE;IACpC,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAIH,WAAW,CAA0BI,MAAM,EAAED,CAAC,EAAE,EAAE;MACnEL,MAAM,CAACO,IAAI,CACP,MAAMnB,kBAAkB,CAAEc,WAAW,CAA0BG,CAAC,CAAC,EAAEf,MAAM,EAAEC,OAAO,CAAC,CACtF;IACL;IACA,OAAOS,MAAM;EACjB;EACA,OAAO,MAAMZ,kBAAkB,CAACc,WAAW,EAAwBZ,MAAM,EAAEC,OAAO,CAAC;AACvF,CAAC;AAAA"}
1
+ {"version":3,"names":["processRequestBody","body","schema","context","query","variables","operationName","plugins","byType","forEach","pl","apply","result","graphql","requestBody","Array","isArray","i","length","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) === true) {\n const result: ExecutionResult[] = [];\n for (let i = 0; i < (requestBody as GraphQLRequestBody[]).length; i++) {\n result.push(\n await processRequestBody((requestBody as GraphQLRequestBody[])[i], schema, context)\n );\n }\n return result;\n }\n return await processRequestBody(requestBody as GraphQLRequestBody, schema, context);\n};\n"],"mappings":";;;;;;;AAAA;;AAIA,MAAMA,kBAAkB,GAAG,OACvBC,IADuB,EAEvBC,MAFuB,EAGvBC,OAHuB,KAItB;EACD,MAAM;IAAEC,KAAF;IAASC,SAAT;IAAoBC;EAApB,IAAsCL,IAA5C;EAEAE,OAAO,CAACI,OAAR,CACKC,MADL,CACsC,sBADtC,EAEKC,OAFL,CAEaC,EAAE,IAAIA,EAAE,CAACC,KAAH,CAAS;IAAEV,IAAF;IAAQC,MAAR;IAAgBC;EAAhB,CAAT,CAFnB;EAIA,MAAMS,MAAM,GAAG,MAAM,IAAAC,gBAAA,EAAQX,MAAR,EAAgBE,KAAhB,EAAuB,EAAvB,EAA2BD,OAA3B,EAAoCE,SAApC,EAA+CC,aAA/C,CAArB;EAEAH,OAAO,CAACI,OAAR,CAAgBC,MAAhB,CAAgD,qBAAhD,EAAuEC,OAAvE,CAA+EC,EAAE,IAAI;IACjFA,EAAE,CAACC,KAAH,CAAS;MAAEC,MAAF;MAAUX,IAAV;MAAgBC,MAAhB;MAAwBC;IAAxB,CAAT;EACH,CAFD;EAIA,OAAOS,MAAP;AACH,CAlBD;;eAoBe,OACXE,WADW,EAEXZ,MAFW,EAGXC,OAHW,KAIoC;EAC/C,IAAIY,KAAK,CAACC,OAAN,CAAcF,WAAd,MAA+B,IAAnC,EAAyC;IACrC,MAAMF,MAAyB,GAAG,EAAlC;;IACA,KAAK,IAAIK,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAIH,WAAD,CAAsCI,MAA1D,EAAkED,CAAC,EAAnE,EAAuE;MACnEL,MAAM,CAACO,IAAP,CACI,MAAMnB,kBAAkB,CAAEc,WAAD,CAAsCG,CAAtC,CAAD,EAA2Cf,MAA3C,EAAmDC,OAAnD,CAD5B;IAGH;;IACD,OAAOS,MAAP;EACH;;EACD,OAAO,MAAMZ,kBAAkB,CAACc,WAAD,EAAoCZ,MAApC,EAA4CC,OAA5C,CAA/B;AACH,C"}
package/responses.js CHANGED
@@ -1,29 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.Response = exports.NotFoundResponse = exports.ListResponse = exports.ListErrorResponse = exports.ErrorResponse = void 0;
9
+
8
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
9
12
  const defaultParams = {
10
13
  code: "",
11
14
  message: "",
12
15
  data: null,
13
16
  stack: null
14
17
  };
18
+
15
19
  class ErrorResponse {
16
20
  constructor(params) {
17
21
  (0, _defineProperty2.default)(this, "data", void 0);
18
22
  (0, _defineProperty2.default)(this, "error", void 0);
19
23
  this.data = null;
20
- const debug = process.env.DEBUG === "true";
24
+ const debug = process.env.DEBUG === "true"; // Ensure `stack` is either `string` or `null`.
21
25
 
22
- // Ensure `stack` is either `string` or `null`.
23
26
  let stack = defaultParams.stack;
27
+
24
28
  if (debug && params.stack) {
25
29
  stack = params.stack;
26
30
  }
31
+
27
32
  this.error = {
28
33
  code: params.code || defaultParams.code,
29
34
  message: params.message || defaultParams.message,
@@ -31,8 +36,11 @@ class ErrorResponse {
31
36
  stack: stack
32
37
  };
33
38
  }
39
+
34
40
  }
41
+
35
42
  exports.ErrorResponse = ErrorResponse;
43
+
36
44
  class NotFoundResponse extends ErrorResponse {
37
45
  constructor(message) {
38
46
  super({
@@ -40,8 +48,11 @@ class NotFoundResponse extends ErrorResponse {
40
48
  message
41
49
  });
42
50
  }
51
+
43
52
  }
53
+
44
54
  exports.NotFoundResponse = NotFoundResponse;
55
+
45
56
  class ListErrorResponse {
46
57
  constructor(params) {
47
58
  (0, _defineProperty2.default)(this, "data", void 0);
@@ -49,13 +60,14 @@ class ListErrorResponse {
49
60
  (0, _defineProperty2.default)(this, "error", void 0);
50
61
  this.meta = null;
51
62
  this.data = null;
52
- const debug = process.env.DEBUG === "true";
63
+ const debug = process.env.DEBUG === "true"; // Ensure `stack` is either `string` or `null`.
53
64
 
54
- // Ensure `stack` is either `string` or `null`.
55
65
  let stack = defaultParams.stack;
66
+
56
67
  if (debug && params.stack) {
57
68
  stack = params.stack;
58
69
  }
70
+
59
71
  this.error = {
60
72
  code: params.code || defaultParams.code,
61
73
  message: params.message || defaultParams.message,
@@ -63,8 +75,11 @@ class ListErrorResponse {
63
75
  stack: stack
64
76
  };
65
77
  }
78
+
66
79
  }
80
+
67
81
  exports.ListErrorResponse = ListErrorResponse;
82
+
68
83
  class Response {
69
84
  constructor(data) {
70
85
  (0, _defineProperty2.default)(this, "data", void 0);
@@ -72,8 +87,11 @@ class Response {
72
87
  this.data = data;
73
88
  this.error = null;
74
89
  }
90
+
75
91
  }
92
+
76
93
  exports.Response = Response;
94
+
77
95
  class ListResponse {
78
96
  constructor(data, meta) {
79
97
  (0, _defineProperty2.default)(this, "data", void 0);
@@ -83,5 +101,7 @@ class ListResponse {
83
101
  this.meta = meta || {};
84
102
  this.error = null;
85
103
  }
104
+
86
105
  }
106
+
87
107
  exports.ListResponse = ListResponse;
package/responses.js.map CHANGED
@@ -1 +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"}
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,EAD2C;EAEjDC,OAAO,EAAE,EAFwC;EAGjDC,IAAI,EAAE,IAH2C;EAIjDC,KAAK,EAAE;AAJ0C,CAArD;;AAOO,MAAMC,aAAN,CAAoB;EASvBC,WAAW,CAACC,MAAD,EAA8B;IAAA;IAAA;IACrC,KAAKJ,IAAL,GAAY,IAAZ;IAEA,MAAMK,KAAK,GAAGC,OAAO,CAACC,GAAR,CAAYC,KAAZ,KAAsB,MAApC,CAHqC,CAKrC;;IACA,IAAIP,KAAK,GAAGJ,aAAa,CAACI,KAA1B;;IACA,IAAII,KAAK,IAAID,MAAM,CAACH,KAApB,EAA2B;MACvBA,KAAK,GAAGG,MAAM,CAACH,KAAf;IACH;;IAED,KAAKQ,KAAL,GAAa;MACTX,IAAI,EAAEM,MAAM,CAACN,IAAP,IAAeD,aAAa,CAACC,IAD1B;MAETC,OAAO,EAAEK,MAAM,CAACL,OAAP,IAAkBF,aAAa,CAACE,OAFhC;MAGTC,IAAI,EAAEI,MAAM,CAACJ,IAAP,IAAeH,aAAa,CAACG,IAH1B;MAITC,KAAK,EAAEA;IAJE,CAAb;EAMH;;AA1BsB;;;;AA6BpB,MAAMS,gBAAN,SAA+BR,aAA/B,CAA6C;EAChDC,WAAW,CAACJ,OAAD,EAAkB;IACzB,MAAM;MACFD,IAAI,EAAE,WADJ;MAEFC;IAFE,CAAN;EAIH;;AAN+C;;;;AAS7C,MAAMY,iBAAN,CAAwB;EAU3BR,WAAW,CAACC,MAAD,EAA8B;IAAA;IAAA;IAAA;IACrC,KAAKQ,IAAL,GAAY,IAAZ;IACA,KAAKZ,IAAL,GAAY,IAAZ;IAEA,MAAMK,KAAK,GAAGC,OAAO,CAACC,GAAR,CAAYC,KAAZ,KAAsB,MAApC,CAJqC,CAMrC;;IACA,IAAIP,KAAK,GAAGJ,aAAa,CAACI,KAA1B;;IACA,IAAII,KAAK,IAAID,MAAM,CAACH,KAApB,EAA2B;MACvBA,KAAK,GAAGG,MAAM,CAACH,KAAf;IACH;;IAED,KAAKQ,KAAL,GAAa;MACTX,IAAI,EAAEM,MAAM,CAACN,IAAP,IAAeD,aAAa,CAACC,IAD1B;MAETC,OAAO,EAAEK,MAAM,CAACL,OAAP,IAAkBF,aAAa,CAACE,OAFhC;MAGTC,IAAI,EAAEI,MAAM,CAACJ,IAAP,IAAeH,aAAa,CAACG,IAH1B;MAITC,KAAK,EAAEA;IAJE,CAAb;EAMH;;AA5B0B;;;;AA+BxB,MAAMY,QAAN,CAAwB;EAI3BV,WAAW,CAACH,IAAD,EAAU;IAAA;IAAA;IACjB,KAAKA,IAAL,GAAYA,IAAZ;IACA,KAAKS,KAAL,GAAa,IAAb;EACH;;AAP0B;;;;AAUxB,MAAMK,YAAN,CAAyB;EAK5BX,WAAW,CAACH,IAAD,EAAiBY,IAAjB,EAA2B;IAAA;IAAA;IAAA;IAClC,KAAKZ,IAAL,GAAYe,KAAK,CAACC,OAAN,CAAchB,IAAd,IAAsBA,IAAtB,GAA6B,EAAzC;IACA,KAAKY,IAAL,GAAYA,IAAI,IAAK,EAArB;IACA,KAAKH,KAAL,GAAa,IAAb;EACH;;AAT2B"}