@webiny/handler 6.0.0-alpha.5 → 6.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/Context.d.ts +1 -1
  2. package/Context.js +6 -14
  3. package/Context.js.map +1 -1
  4. package/PreHandler/IPreHandler.d.ts +1 -1
  5. package/PreHandler/IPreHandler.js +1 -7
  6. package/PreHandler/IPreHandler.js.map +1 -1
  7. package/PreHandler/IfNotOptionsRequest.d.ts +3 -3
  8. package/PreHandler/IfNotOptionsRequest.js +6 -13
  9. package/PreHandler/IfNotOptionsRequest.js.map +1 -1
  10. package/PreHandler/IfOptionsRequest.d.ts +3 -3
  11. package/PreHandler/IfOptionsRequest.js +6 -13
  12. package/PreHandler/IfOptionsRequest.js.map +1 -1
  13. package/PreHandler/PreHandler.d.ts +3 -3
  14. package/PreHandler/PreHandler.js +5 -12
  15. package/PreHandler/PreHandler.js.map +1 -1
  16. package/PreHandler/ProcessBeforeHandlerPlugins.d.ts +4 -4
  17. package/PreHandler/ProcessBeforeHandlerPlugins.js +5 -12
  18. package/PreHandler/ProcessBeforeHandlerPlugins.js.map +1 -1
  19. package/PreHandler/ProcessContextPlugins.d.ts +4 -4
  20. package/PreHandler/ProcessContextPlugins.js +5 -12
  21. package/PreHandler/ProcessContextPlugins.js.map +1 -1
  22. package/PreHandler/ProcessHandlerOnRequestPlugins.d.ts +4 -4
  23. package/PreHandler/ProcessHandlerOnRequestPlugins.js +6 -13
  24. package/PreHandler/ProcessHandlerOnRequestPlugins.js.map +1 -1
  25. package/PreHandler/SendEarlyOptionsResponse.d.ts +3 -3
  26. package/PreHandler/SendEarlyOptionsResponse.js +6 -13
  27. package/PreHandler/SendEarlyOptionsResponse.js.map +1 -1
  28. package/PreHandler/SetDefaultHeaders.d.ts +3 -3
  29. package/PreHandler/SetDefaultHeaders.js +8 -15
  30. package/PreHandler/SetDefaultHeaders.js.map +1 -1
  31. package/README.md +10 -14
  32. package/ResponseHeaders.d.ts +0 -1
  33. package/ResponseHeaders.js +1 -8
  34. package/ResponseHeaders.js.map +1 -1
  35. package/abstractions/Reply.d.ts +5 -0
  36. package/abstractions/Reply.js +4 -0
  37. package/abstractions/Reply.js.map +1 -0
  38. package/abstractions/Request.d.ts +5 -0
  39. package/abstractions/Request.js +4 -0
  40. package/abstractions/Request.js.map +1 -0
  41. package/fastify.d.ts +5 -4
  42. package/fastify.js +107 -65
  43. package/fastify.js.map +1 -1
  44. package/index.d.ts +15 -13
  45. package/index.js +18 -149
  46. package/index.js.map +1 -1
  47. package/package.json +16 -17
  48. package/plugins/BeforeHandlerPlugin.d.ts +1 -1
  49. package/plugins/BeforeHandlerPlugin.js +3 -11
  50. package/plugins/BeforeHandlerPlugin.js.map +1 -1
  51. package/plugins/EventPlugin.d.ts +3 -3
  52. package/plugins/EventPlugin.js +3 -12
  53. package/plugins/EventPlugin.js.map +1 -1
  54. package/plugins/HandlerErrorPlugin.d.ts +1 -1
  55. package/plugins/HandlerErrorPlugin.js +3 -11
  56. package/plugins/HandlerErrorPlugin.js.map +1 -1
  57. package/plugins/HandlerOnRequestPlugin.d.ts +1 -1
  58. package/plugins/HandlerOnRequestPlugin.js +3 -10
  59. package/plugins/HandlerOnRequestPlugin.js.map +1 -1
  60. package/plugins/HandlerResultPlugin.d.ts +1 -1
  61. package/plugins/HandlerResultPlugin.js +3 -11
  62. package/plugins/HandlerResultPlugin.js.map +1 -1
  63. package/plugins/ModifyFastifyPlugin.d.ts +1 -1
  64. package/plugins/ModifyFastifyPlugin.js +3 -11
  65. package/plugins/ModifyFastifyPlugin.js.map +1 -1
  66. package/plugins/ModifyResponseHeadersPlugin.d.ts +3 -3
  67. package/plugins/ModifyResponseHeadersPlugin.js +3 -11
  68. package/plugins/ModifyResponseHeadersPlugin.js.map +1 -1
  69. package/plugins/OnRequestResponseSendPlugin.js +3 -12
  70. package/plugins/OnRequestResponseSendPlugin.js.map +1 -1
  71. package/plugins/OnRequestTimeoutPlugin.js +3 -11
  72. package/plugins/OnRequestTimeoutPlugin.js.map +1 -1
  73. package/plugins/RoutePlugin.d.ts +2 -2
  74. package/plugins/RoutePlugin.js +3 -11
  75. package/plugins/RoutePlugin.js.map +1 -1
  76. package/stringifyError.js +1 -8
  77. package/stringifyError.js.map +1 -1
  78. package/suppressPunycodeWarnings.d.ts +1 -4
  79. package/suppressPunycodeWarnings.js +1 -2
  80. package/suppressPunycodeWarnings.js.map +1 -1
  81. package/types.d.ts +2 -2
  82. package/types.js +1 -13
  83. package/types.js.map +1 -1
@@ -1,10 +1,5 @@
1
- "use strict";
1
+ import { Plugin } from "@webiny/plugins";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createHandlerOnRequest = exports.HandlerOnRequestPlugin = void 0;
7
- var _plugins = require("@webiny/plugins");
8
3
  /**
9
4
  * If the execution of the callable returns false, no more plugins will be executed after the given one.
10
5
  * Nor it will execute our default OPTIONS code.
@@ -12,7 +7,7 @@ var _plugins = require("@webiny/plugins");
12
7
  * This way users can prevent stopping of the request on our built-in OPTIONS request.
13
8
  */
14
9
 
15
- class HandlerOnRequestPlugin extends _plugins.Plugin {
10
+ export class HandlerOnRequestPlugin extends Plugin {
16
11
  static type = "handler.event.onRequest";
17
12
  constructor(cb) {
18
13
  super();
@@ -22,10 +17,8 @@ class HandlerOnRequestPlugin extends _plugins.Plugin {
22
17
  return this.cb(request, reply, context);
23
18
  }
24
19
  }
25
- exports.HandlerOnRequestPlugin = HandlerOnRequestPlugin;
26
- const createHandlerOnRequest = cb => {
20
+ export const createHandlerOnRequest = cb => {
27
21
  return new HandlerOnRequestPlugin(cb);
28
22
  };
29
- exports.createHandlerOnRequest = createHandlerOnRequest;
30
23
 
31
24
  //# sourceMappingURL=HandlerOnRequestPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","HandlerOnRequestPlugin","Plugin","type","constructor","cb","exec","request","reply","context","exports","createHandlerOnRequest"],"sources":["HandlerOnRequestPlugin.ts"],"sourcesContent":["import type { Context } from \"~/types\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { FastifyReply, FastifyRequest } from \"fastify\";\n\n/**\n * If the execution of the callable returns false, no more plugins will be executed after the given one.\n * Nor it will execute our default OPTIONS code.\n *\n * This way users can prevent stopping of the request on our built-in OPTIONS request.\n */\nexport type HandlerOnRequestPluginCallableResponse = false | undefined | null | void;\ninterface HandlerOnRequestPluginCallable<C extends Context = Context> {\n (\n request: FastifyRequest,\n reply: FastifyReply,\n context: C\n ): Promise<HandlerOnRequestPluginCallableResponse>;\n}\n\nexport class HandlerOnRequestPlugin<C extends Context = Context> extends Plugin {\n public static override type = \"handler.event.onRequest\";\n\n private readonly cb: HandlerOnRequestPluginCallable<C>;\n\n public constructor(cb: HandlerOnRequestPluginCallable<C>) {\n super();\n this.cb = cb;\n }\n\n public async exec(\n request: FastifyRequest,\n reply: FastifyReply,\n context: C\n ): Promise<HandlerOnRequestPluginCallableResponse> {\n return this.cb(request, reply, context);\n }\n}\n\nexport const createHandlerOnRequest = <C extends Context = Context>(\n cb: HandlerOnRequestPluginCallable<C>\n) => {\n return new HandlerOnRequestPlugin<C>(cb);\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;;AAUO,MAAMC,sBAAsB,SAAsCC,eAAM,CAAC;EAC5E,OAAuBC,IAAI,GAAG,yBAAyB;EAIhDC,WAAWA,CAACC,EAAqC,EAAE;IACtD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAIA,CACbC,OAAuB,EACvBC,KAAmB,EACnBC,OAAU,EACqC;IAC/C,OAAO,IAAI,CAACJ,EAAE,CAACE,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;EAC3C;AACJ;AAACC,OAAA,CAAAT,sBAAA,GAAAA,sBAAA;AAEM,MAAMU,sBAAsB,GAC/BN,EAAqC,IACpC;EACD,OAAO,IAAIJ,sBAAsB,CAAII,EAAE,CAAC;AAC5C,CAAC;AAACK,OAAA,CAAAC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","HandlerOnRequestPlugin","type","constructor","cb","exec","request","reply","context","createHandlerOnRequest"],"sources":["HandlerOnRequestPlugin.ts"],"sourcesContent":["import type { Context } from \"~/types.js\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { FastifyReply, FastifyRequest } from \"fastify\";\n\n/**\n * If the execution of the callable returns false, no more plugins will be executed after the given one.\n * Nor it will execute our default OPTIONS code.\n *\n * This way users can prevent stopping of the request on our built-in OPTIONS request.\n */\nexport type HandlerOnRequestPluginCallableResponse = false | undefined | null | void;\ninterface HandlerOnRequestPluginCallable<C extends Context = Context> {\n (\n request: FastifyRequest,\n reply: FastifyReply,\n context: C\n ): Promise<HandlerOnRequestPluginCallableResponse>;\n}\n\nexport class HandlerOnRequestPlugin<C extends Context = Context> extends Plugin {\n public static override type = \"handler.event.onRequest\";\n\n private readonly cb: HandlerOnRequestPluginCallable<C>;\n\n public constructor(cb: HandlerOnRequestPluginCallable<C>) {\n super();\n this.cb = cb;\n }\n\n public async exec(\n request: FastifyRequest,\n reply: FastifyReply,\n context: C\n ): Promise<HandlerOnRequestPluginCallableResponse> {\n return this.cb(request, reply, context);\n }\n}\n\nexport const createHandlerOnRequest = <C extends Context = Context>(\n cb: HandlerOnRequestPluginCallable<C>\n) => {\n return new HandlerOnRequestPlugin<C>(cb);\n};\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,iBAAiB;;AAGxC;AACA;AACA;AACA;AACA;AACA;;AAUA,OAAO,MAAMC,sBAAsB,SAAsCD,MAAM,CAAC;EAC5E,OAAuBE,IAAI,GAAG,yBAAyB;EAIhDC,WAAWA,CAACC,EAAqC,EAAE;IACtD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAIA,CACbC,OAAuB,EACvBC,KAAmB,EACnBC,OAAU,EACqC;IAC/C,OAAO,IAAI,CAACJ,EAAE,CAACE,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;EAC3C;AACJ;AAEA,OAAO,MAAMC,sBAAsB,GAC/BL,EAAqC,IACpC;EACD,OAAO,IAAIH,sBAAsB,CAAIG,EAAE,CAAC;AAC5C,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- import type { Context } from "../types";
2
+ import type { Context } from "../types.js";
3
3
  export interface HandlerResultCallable<T extends Context = Context> {
4
4
  (context: T, result: any): Promise<any>;
5
5
  }
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createHandlerResultPlugin = exports.HandlerResultPlugin = void 0;
7
- var _plugins = require("@webiny/plugins");
8
- class HandlerResultPlugin extends _plugins.Plugin {
1
+ import { Plugin } from "@webiny/plugins";
2
+ export class HandlerResultPlugin extends Plugin {
9
3
  static type = "handler-result";
10
4
  constructor(callable) {
11
5
  super();
@@ -15,10 +9,8 @@ class HandlerResultPlugin extends _plugins.Plugin {
15
9
  return this._callable(context, result);
16
10
  }
17
11
  }
18
- exports.HandlerResultPlugin = HandlerResultPlugin;
19
- const createHandlerResultPlugin = callable => {
12
+ export const createHandlerResultPlugin = callable => {
20
13
  return new HandlerResultPlugin(callable);
21
14
  };
22
- exports.createHandlerResultPlugin = createHandlerResultPlugin;
23
15
 
24
16
  //# sourceMappingURL=HandlerResultPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","HandlerResultPlugin","Plugin","type","constructor","callable","_callable","handle","context","result","exports","createHandlerResultPlugin"],"sources":["HandlerResultPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Context } from \"~/types\";\n\nexport interface HandlerResultCallable<T extends Context = Context> {\n (context: T, result: any): Promise<any>;\n}\n\nexport class HandlerResultPlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler-result\";\n\n private readonly _callable: HandlerResultCallable<T>;\n\n public constructor(callable: HandlerResultCallable<T>) {\n super();\n this._callable = callable;\n }\n\n public async handle(context: T, result: any): Promise<any> {\n return this._callable(context, result);\n }\n}\n\nexport const createHandlerResultPlugin = <T extends Context = Context>(\n callable: HandlerResultCallable<T>\n): HandlerResultPlugin<T> => {\n return new HandlerResultPlugin<T>(callable);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,mBAAmB,SAAsCC,eAAM,CAAC;EACzE,OAAgCC,IAAI,GAAW,gBAAgB;EAIxDC,WAAWA,CAACC,QAAkC,EAAE;IACnD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,MAAMA,CAACC,OAAU,EAAEC,MAAW,EAAgB;IACvD,OAAO,IAAI,CAACH,SAAS,CAACE,OAAO,EAAEC,MAAM,CAAC;EAC1C;AACJ;AAACC,OAAA,CAAAT,mBAAA,GAAAA,mBAAA;AAEM,MAAMU,yBAAyB,GAClCN,QAAkC,IACT;EACzB,OAAO,IAAIJ,mBAAmB,CAAII,QAAQ,CAAC;AAC/C,CAAC;AAACK,OAAA,CAAAC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","HandlerResultPlugin","type","constructor","callable","_callable","handle","context","result","createHandlerResultPlugin"],"sources":["HandlerResultPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Context } from \"~/types.js\";\n\nexport interface HandlerResultCallable<T extends Context = Context> {\n (context: T, result: any): Promise<any>;\n}\n\nexport class HandlerResultPlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler-result\";\n\n private readonly _callable: HandlerResultCallable<T>;\n\n public constructor(callable: HandlerResultCallable<T>) {\n super();\n this._callable = callable;\n }\n\n public async handle(context: T, result: any): Promise<any> {\n return this._callable(context, result);\n }\n}\n\nexport const createHandlerResultPlugin = <T extends Context = Context>(\n callable: HandlerResultCallable<T>\n): HandlerResultPlugin<T> => {\n return new HandlerResultPlugin<T>(callable);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAMC,mBAAmB,SAAsCD,MAAM,CAAC;EACzE,OAAgCE,IAAI,GAAW,gBAAgB;EAIxDC,WAAWA,CAACC,QAAkC,EAAE;IACnD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,MAAMA,CAACC,OAAU,EAAEC,MAAW,EAAgB;IACvD,OAAO,IAAI,CAACH,SAAS,CAACE,OAAO,EAAEC,MAAM,CAAC;EAC1C;AACJ;AAEA,OAAO,MAAMC,yBAAyB,GAClCL,QAAkC,IACT;EACzB,OAAO,IAAIH,mBAAmB,CAAIG,QAAQ,CAAC;AAC/C,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
2
  import type { FastifyInstance } from "fastify";
3
3
  interface ModifyFastifyPluginCallable {
4
4
  (app: FastifyInstance): void;
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createModifyFastifyPlugin = exports.ModifyFastifyPlugin = void 0;
7
- var _Plugin = require("@webiny/plugins/Plugin");
8
- class ModifyFastifyPlugin extends _Plugin.Plugin {
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ export class ModifyFastifyPlugin extends Plugin {
9
3
  static type = "handler.fastify.modify";
10
4
  constructor(cb) {
11
5
  super();
@@ -15,10 +9,8 @@ class ModifyFastifyPlugin extends _Plugin.Plugin {
15
9
  this.cb(app);
16
10
  }
17
11
  }
18
- exports.ModifyFastifyPlugin = ModifyFastifyPlugin;
19
- const createModifyFastifyPlugin = cb => {
12
+ export const createModifyFastifyPlugin = cb => {
20
13
  return new ModifyFastifyPlugin(cb);
21
14
  };
22
- exports.createModifyFastifyPlugin = createModifyFastifyPlugin;
23
15
 
24
16
  //# sourceMappingURL=ModifyFastifyPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Plugin","require","ModifyFastifyPlugin","Plugin","type","constructor","cb","modify","app","exports","createModifyFastifyPlugin"],"sources":["ModifyFastifyPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { FastifyInstance } from \"fastify\";\n\ninterface ModifyFastifyPluginCallable {\n (app: FastifyInstance): void;\n}\n\nexport class ModifyFastifyPlugin extends Plugin {\n public static override type = \"handler.fastify.modify\";\n\n private readonly cb: ModifyFastifyPluginCallable;\n\n public constructor(cb: ModifyFastifyPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public modify(app: FastifyInstance): void {\n this.cb(app);\n }\n}\n\nexport const createModifyFastifyPlugin = (cb: ModifyFastifyPluginCallable) => {\n return new ModifyFastifyPlugin(cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOO,MAAMC,mBAAmB,SAASC,cAAM,CAAC;EAC5C,OAAuBC,IAAI,GAAG,wBAAwB;EAI/CC,WAAWA,CAACC,EAA+B,EAAE;IAChD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACC,GAAoB,EAAQ;IACtC,IAAI,CAACF,EAAE,CAACE,GAAG,CAAC;EAChB;AACJ;AAACC,OAAA,CAAAP,mBAAA,GAAAA,mBAAA;AAEM,MAAMQ,yBAAyB,GAAIJ,EAA+B,IAAK;EAC1E,OAAO,IAAIJ,mBAAmB,CAACI,EAAE,CAAC;AACtC,CAAC;AAACG,OAAA,CAAAC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","ModifyFastifyPlugin","type","constructor","cb","modify","app","createModifyFastifyPlugin"],"sources":["ModifyFastifyPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { FastifyInstance } from \"fastify\";\n\ninterface ModifyFastifyPluginCallable {\n (app: FastifyInstance): void;\n}\n\nexport class ModifyFastifyPlugin extends Plugin {\n public static override type = \"handler.fastify.modify\";\n\n private readonly cb: ModifyFastifyPluginCallable;\n\n public constructor(cb: ModifyFastifyPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public modify(app: FastifyInstance): void {\n this.cb(app);\n }\n}\n\nexport const createModifyFastifyPlugin = (cb: ModifyFastifyPluginCallable) => {\n return new ModifyFastifyPlugin(cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,2BAA2B;AAOlD,OAAO,MAAMC,mBAAmB,SAASD,MAAM,CAAC;EAC5C,OAAuBE,IAAI,GAAG,wBAAwB;EAI/CC,WAAWA,CAACC,EAA+B,EAAE;IAChD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACC,GAAoB,EAAQ;IACtC,IAAI,CAACF,EAAE,CAACE,GAAG,CAAC;EAChB;AACJ;AAEA,OAAO,MAAMC,yBAAyB,GAAIH,EAA+B,IAAK;EAC1E,OAAO,IAAIH,mBAAmB,CAACG,EAAE,CAAC;AACtC,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import type { ResponseHeaders } from "../ResponseHeaders";
3
- import type { Request } from "../types";
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ import type { ResponseHeaders } from "../ResponseHeaders.js";
3
+ import type { Request } from "../types.js";
4
4
  interface ModifyResponseHeadersCallable {
5
5
  (request: Request, headers: ResponseHeaders): void;
6
6
  }
@@ -1,12 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ModifyResponseHeadersPlugin = void 0;
7
- exports.createModifyResponseHeaders = createModifyResponseHeaders;
8
- var _Plugin = require("@webiny/plugins/Plugin");
9
- class ModifyResponseHeadersPlugin extends _Plugin.Plugin {
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ export class ModifyResponseHeadersPlugin extends Plugin {
10
3
  static type = "handler.response.modifyHeaders";
11
4
  constructor(cb) {
12
5
  super();
@@ -16,8 +9,7 @@ class ModifyResponseHeadersPlugin extends _Plugin.Plugin {
16
9
  this.cb(request, headers);
17
10
  }
18
11
  }
19
- exports.ModifyResponseHeadersPlugin = ModifyResponseHeadersPlugin;
20
- function createModifyResponseHeaders(cb) {
12
+ export function createModifyResponseHeaders(cb) {
21
13
  return new ModifyResponseHeadersPlugin(cb);
22
14
  }
23
15
 
@@ -1 +1 @@
1
- {"version":3,"names":["_Plugin","require","ModifyResponseHeadersPlugin","Plugin","type","constructor","cb","modify","request","headers","exports","createModifyResponseHeaders"],"sources":["ModifyResponseHeadersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { ResponseHeaders } from \"~/ResponseHeaders\";\nimport type { Request } from \"~/types\";\n\ninterface ModifyResponseHeadersCallable {\n (request: Request, headers: ResponseHeaders): void;\n}\n\nexport class ModifyResponseHeadersPlugin extends Plugin {\n public static override type = \"handler.response.modifyHeaders\";\n private readonly cb: ModifyResponseHeadersCallable;\n\n constructor(cb: ModifyResponseHeadersCallable) {\n super();\n this.cb = cb;\n }\n\n modify(request: Request, headers: ResponseHeaders) {\n this.cb(request, headers);\n }\n}\n\nexport function createModifyResponseHeaders(cb: ModifyResponseHeadersCallable) {\n return new ModifyResponseHeadersPlugin(cb);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAQO,MAAMC,2BAA2B,SAASC,cAAM,CAAC;EACpD,OAAuBC,IAAI,GAAG,gCAAgC;EAG9DC,WAAWA,CAACC,EAAiC,EAAE;IAC3C,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEAC,MAAMA,CAACC,OAAgB,EAAEC,OAAwB,EAAE;IAC/C,IAAI,CAACH,EAAE,CAACE,OAAO,EAAEC,OAAO,CAAC;EAC7B;AACJ;AAACC,OAAA,CAAAR,2BAAA,GAAAA,2BAAA;AAEM,SAASS,2BAA2BA,CAACL,EAAiC,EAAE;EAC3E,OAAO,IAAIJ,2BAA2B,CAACI,EAAE,CAAC;AAC9C","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","ModifyResponseHeadersPlugin","type","constructor","cb","modify","request","headers","createModifyResponseHeaders"],"sources":["ModifyResponseHeadersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { ResponseHeaders } from \"~/ResponseHeaders.js\";\nimport type { Request } from \"~/types.js\";\n\ninterface ModifyResponseHeadersCallable {\n (request: Request, headers: ResponseHeaders): void;\n}\n\nexport class ModifyResponseHeadersPlugin extends Plugin {\n public static override type = \"handler.response.modifyHeaders\";\n private readonly cb: ModifyResponseHeadersCallable;\n\n constructor(cb: ModifyResponseHeadersCallable) {\n super();\n this.cb = cb;\n }\n\n modify(request: Request, headers: ResponseHeaders) {\n this.cb(request, headers);\n }\n}\n\nexport function createModifyResponseHeaders(cb: ModifyResponseHeadersCallable) {\n return new ModifyResponseHeadersPlugin(cb);\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,2BAA2B;AAQlD,OAAO,MAAMC,2BAA2B,SAASD,MAAM,CAAC;EACpD,OAAuBE,IAAI,GAAG,gCAAgC;EAG9DC,WAAWA,CAACC,EAAiC,EAAE;IAC3C,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEAC,MAAMA,CAACC,OAAgB,EAAEC,OAAwB,EAAE;IAC/C,IAAI,CAACH,EAAE,CAACE,OAAO,EAAEC,OAAO,CAAC;EAC7B;AACJ;AAEA,OAAO,SAASC,2BAA2BA,CAACJ,EAAiC,EAAE;EAC3E,OAAO,IAAIH,2BAA2B,CAACG,EAAE,CAAC;AAC9C","ignoreList":[]}
@@ -1,10 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createOnRequestResponseSend = exports.OnRequestResponseSendPlugin = void 0;
7
- var _plugins = require("@webiny/plugins");
8
1
  /**
9
2
  * !!!!!!!!!!!!!!
10
3
  * !!! DANGER !!!
@@ -13,11 +6,11 @@ var _plugins = require("@webiny/plugins");
13
6
  * Using this plugin can cause slowdowns in your application response times.
14
7
  * Also, if you do not return payload from the plugin callback, there will be nothing to send in the response.
15
8
  */
16
-
9
+ import { Plugin } from "@webiny/plugins";
17
10
  /**
18
11
  * @description Read info in the class file.
19
12
  */
20
- class OnRequestResponseSendPlugin extends _plugins.Plugin {
13
+ export class OnRequestResponseSendPlugin extends Plugin {
21
14
  static type = "handler.onRequestResponseSend";
22
15
  constructor(cb) {
23
16
  super();
@@ -31,10 +24,8 @@ class OnRequestResponseSendPlugin extends _plugins.Plugin {
31
24
  /**
32
25
  * @description Read info in the class file.
33
26
  */
34
- exports.OnRequestResponseSendPlugin = OnRequestResponseSendPlugin;
35
- const createOnRequestResponseSend = cb => {
27
+ export const createOnRequestResponseSend = cb => {
36
28
  return new OnRequestResponseSendPlugin(cb);
37
29
  };
38
- exports.createOnRequestResponseSend = createOnRequestResponseSend;
39
30
 
40
31
  //# sourceMappingURL=OnRequestResponseSendPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","OnRequestResponseSendPlugin","Plugin","type","constructor","cb","exec","request","reply","payload","exports","createOnRequestResponseSend"],"sources":["OnRequestResponseSendPlugin.ts"],"sourcesContent":["/**\n * !!!!!!!!!!!!!!\n * !!! DANGER !!!\n * !!!!!!!!!!!!!!\n *\n * Using this plugin can cause slowdowns in your application response times.\n * Also, if you do not return payload from the plugin callback, there will be nothing to send in the response.\n */\nimport { Plugin } from \"@webiny/plugins\";\nimport type { Reply as FastifyReply, Request as FastifyRequest } from \"~/types.js\";\n\nexport interface IOnResponseSendPluginCallable {\n <T = unknown>(request: FastifyRequest, reply: FastifyReply, payload: T): Promise<T>;\n}\n\n/**\n * @description Read info in the class file.\n */\nexport class OnRequestResponseSendPlugin extends Plugin {\n public static override type: string = \"handler.onRequestResponseSend\";\n\n private readonly cb: IOnResponseSendPluginCallable;\n\n public constructor(cb: IOnResponseSendPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public async exec<T = unknown>(\n request: FastifyRequest,\n reply: FastifyReply,\n payload: T\n ): Promise<unknown> {\n return await this.cb<T>(request, reply, payload);\n }\n}\n\n/**\n * @description Read info in the class file.\n */\nexport const createOnRequestResponseSend = (cb: IOnResponseSendPluginCallable) => {\n return new OnRequestResponseSendPlugin(cb);\n};\n"],"mappings":";;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACO,MAAMC,2BAA2B,SAASC,eAAM,CAAC;EACpD,OAAuBC,IAAI,GAAW,+BAA+B;EAI9DC,WAAWA,CAACC,EAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAIA,CACbC,OAAuB,EACvBC,KAAmB,EACnBC,OAAU,EACM;IAChB,OAAO,MAAM,IAAI,CAACJ,EAAE,CAAIE,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;EACpD;AACJ;;AAEA;AACA;AACA;AAFAC,OAAA,CAAAT,2BAAA,GAAAA,2BAAA;AAGO,MAAMU,2BAA2B,GAAIN,EAAiC,IAAK;EAC9E,OAAO,IAAIJ,2BAA2B,CAACI,EAAE,CAAC;AAC9C,CAAC;AAACK,OAAA,CAAAC,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","OnRequestResponseSendPlugin","type","constructor","cb","exec","request","reply","payload","createOnRequestResponseSend"],"sources":["OnRequestResponseSendPlugin.ts"],"sourcesContent":["/**\n * !!!!!!!!!!!!!!\n * !!! DANGER !!!\n * !!!!!!!!!!!!!!\n *\n * Using this plugin can cause slowdowns in your application response times.\n * Also, if you do not return payload from the plugin callback, there will be nothing to send in the response.\n */\nimport { Plugin } from \"@webiny/plugins\";\nimport type { Reply as FastifyReply, Request as FastifyRequest } from \"~/types.js\";\n\nexport interface IOnResponseSendPluginCallable {\n <T = unknown>(request: FastifyRequest, reply: FastifyReply, payload: T): Promise<T>;\n}\n\n/**\n * @description Read info in the class file.\n */\nexport class OnRequestResponseSendPlugin extends Plugin {\n public static override type: string = \"handler.onRequestResponseSend\";\n\n private readonly cb: IOnResponseSendPluginCallable;\n\n public constructor(cb: IOnResponseSendPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public async exec<T = unknown>(\n request: FastifyRequest,\n reply: FastifyReply,\n payload: T\n ): Promise<unknown> {\n return await this.cb<T>(request, reply, payload);\n }\n}\n\n/**\n * @description Read info in the class file.\n */\nexport const createOnRequestResponseSend = (cb: IOnResponseSendPluginCallable) => {\n return new OnRequestResponseSendPlugin(cb);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,SAASD,MAAM,CAAC;EACpD,OAAuBE,IAAI,GAAW,+BAA+B;EAI9DC,WAAWA,CAACC,EAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAIA,CACbC,OAAuB,EACvBC,KAAmB,EACnBC,OAAU,EACM;IAChB,OAAO,MAAM,IAAI,CAACJ,EAAE,CAAIE,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;EACpD;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,GAAIL,EAAiC,IAAK;EAC9E,OAAO,IAAIH,2BAA2B,CAACG,EAAE,CAAC;AAC9C,CAAC","ignoreList":[]}
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createOnRequestTimeout = exports.OnRequestTimeoutPlugin = void 0;
7
- var _plugins = require("@webiny/plugins");
8
- class OnRequestTimeoutPlugin extends _plugins.Plugin {
1
+ import { Plugin } from "@webiny/plugins";
2
+ export class OnRequestTimeoutPlugin extends Plugin {
9
3
  static type = "handler.onRequestTimeout";
10
4
  constructor(cb) {
11
5
  super();
@@ -15,10 +9,8 @@ class OnRequestTimeoutPlugin extends _plugins.Plugin {
15
9
  return await this.cb(request, reply);
16
10
  }
17
11
  }
18
- exports.OnRequestTimeoutPlugin = OnRequestTimeoutPlugin;
19
- const createOnRequestTimeout = cb => {
12
+ export const createOnRequestTimeout = cb => {
20
13
  return new OnRequestTimeoutPlugin(cb);
21
14
  };
22
- exports.createOnRequestTimeout = createOnRequestTimeout;
23
15
 
24
16
  //# sourceMappingURL=OnRequestTimeoutPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","OnRequestTimeoutPlugin","Plugin","type","constructor","cb","exec","request","reply","exports","createOnRequestTimeout"],"sources":["OnRequestTimeoutPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Reply as FastifyReply, Request as FastifyRequest } from \"~/types.js\";\n\nexport interface IOnRequestTimeoutPluginCallable {\n (request: FastifyRequest, reply: FastifyReply): Promise<unknown>;\n}\n\nexport class OnRequestTimeoutPlugin extends Plugin {\n public static override type: string = \"handler.onRequestTimeout\";\n\n private readonly cb: IOnRequestTimeoutPluginCallable;\n\n public constructor(cb: IOnRequestTimeoutPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public async exec(request: FastifyRequest, reply: FastifyReply): Promise<unknown> {\n return await this.cb(request, reply);\n }\n}\n\nexport const createOnRequestTimeout = (cb: IOnRequestTimeoutPluginCallable) => {\n return new OnRequestTimeoutPlugin(cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,sBAAsB,SAASC,eAAM,CAAC;EAC/C,OAAuBC,IAAI,GAAW,0BAA0B;EAIzDC,WAAWA,CAACC,EAAmC,EAAE;IACpD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAIA,CAACC,OAAuB,EAAEC,KAAmB,EAAoB;IAC9E,OAAO,MAAM,IAAI,CAACH,EAAE,CAACE,OAAO,EAAEC,KAAK,CAAC;EACxC;AACJ;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA;AAEM,MAAMS,sBAAsB,GAAIL,EAAmC,IAAK;EAC3E,OAAO,IAAIJ,sBAAsB,CAACI,EAAE,CAAC;AACzC,CAAC;AAACI,OAAA,CAAAC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","OnRequestTimeoutPlugin","type","constructor","cb","exec","request","reply","createOnRequestTimeout"],"sources":["OnRequestTimeoutPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Reply as FastifyReply, Request as FastifyRequest } from \"~/types.js\";\n\nexport interface IOnRequestTimeoutPluginCallable {\n (request: FastifyRequest, reply: FastifyReply): Promise<unknown>;\n}\n\nexport class OnRequestTimeoutPlugin extends Plugin {\n public static override type: string = \"handler.onRequestTimeout\";\n\n private readonly cb: IOnRequestTimeoutPluginCallable;\n\n public constructor(cb: IOnRequestTimeoutPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public async exec(request: FastifyRequest, reply: FastifyReply): Promise<unknown> {\n return await this.cb(request, reply);\n }\n}\n\nexport const createOnRequestTimeout = (cb: IOnRequestTimeoutPluginCallable) => {\n return new OnRequestTimeoutPlugin(cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAMC,sBAAsB,SAASD,MAAM,CAAC;EAC/C,OAAuBE,IAAI,GAAW,0BAA0B;EAIzDC,WAAWA,CAACC,EAAmC,EAAE;IACpD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAIA,CAACC,OAAuB,EAAEC,KAAmB,EAAoB;IAC9E,OAAO,MAAM,IAAI,CAACH,EAAE,CAACE,OAAO,EAAEC,KAAK,CAAC;EACxC;AACJ;AAEA,OAAO,MAAMC,sBAAsB,GAAIJ,EAAmC,IAAK;EAC3E,OAAO,IAAIH,sBAAsB,CAACG,EAAE,CAAC;AACzC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import type { Context, RouteMethod } from "../types";
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ import type { Context, RouteMethod } from "../types.js";
3
3
  interface RoutePluginCbParams<T extends Context> {
4
4
  context: T;
5
5
  onGet: RouteMethod;
@@ -1,21 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createRoute = exports.RoutePlugin = void 0;
7
- var _Plugin = require("@webiny/plugins/Plugin");
8
- class RoutePlugin extends _Plugin.Plugin {
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ export class RoutePlugin extends Plugin {
9
3
  static type = "handler.fastify.route";
10
4
  constructor(cb) {
11
5
  super();
12
6
  this.cb = cb;
13
7
  }
14
8
  }
15
- exports.RoutePlugin = RoutePlugin;
16
- const createRoute = cb => {
9
+ export const createRoute = cb => {
17
10
  return new RoutePlugin(cb);
18
11
  };
19
- exports.createRoute = createRoute;
20
12
 
21
13
  //# sourceMappingURL=RoutePlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Plugin","require","RoutePlugin","Plugin","type","constructor","cb","exports","createRoute"],"sources":["RoutePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { Context, RouteMethod } from \"~/types\";\n\ninterface RoutePluginCbParams<T extends Context> {\n context: T;\n onGet: RouteMethod;\n onPost: RouteMethod;\n onPut: RouteMethod;\n onPatch: RouteMethod;\n onDelete: RouteMethod;\n onOptions: RouteMethod;\n onAll: RouteMethod;\n onHead: RouteMethod;\n}\nexport interface RoutePluginCb<T extends Context> {\n (params: RoutePluginCbParams<T>): void;\n}\n\nexport class RoutePlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler.fastify.route\";\n\n public readonly cb: RoutePluginCb<T>;\n\n public constructor(cb: RoutePluginCb<T>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createRoute = <T extends Context = Context>(cb: RoutePluginCb<T>): RoutePlugin<T> => {\n return new RoutePlugin<T>(cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAkBO,MAAMC,WAAW,SAAsCC,cAAM,CAAC;EACjE,OAAgCC,IAAI,GAAW,uBAAuB;EAI/DC,WAAWA,CAACC,EAAoB,EAAE;IACrC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;AACJ;AAACC,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAEM,MAAMM,WAAW,GAAiCF,EAAoB,IAAqB;EAC9F,OAAO,IAAIJ,WAAW,CAAII,EAAE,CAAC;AACjC,CAAC;AAACC,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","RoutePlugin","type","constructor","cb","createRoute"],"sources":["RoutePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { Context, RouteMethod } from \"~/types.js\";\n\ninterface RoutePluginCbParams<T extends Context> {\n context: T;\n onGet: RouteMethod;\n onPost: RouteMethod;\n onPut: RouteMethod;\n onPatch: RouteMethod;\n onDelete: RouteMethod;\n onOptions: RouteMethod;\n onAll: RouteMethod;\n onHead: RouteMethod;\n}\nexport interface RoutePluginCb<T extends Context> {\n (params: RoutePluginCbParams<T>): void;\n}\n\nexport class RoutePlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler.fastify.route\";\n\n public readonly cb: RoutePluginCb<T>;\n\n public constructor(cb: RoutePluginCb<T>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createRoute = <T extends Context = Context>(cb: RoutePluginCb<T>): RoutePlugin<T> => {\n return new RoutePlugin<T>(cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,2BAA2B;AAkBlD,OAAO,MAAMC,WAAW,SAAsCD,MAAM,CAAC;EACjE,OAAgCE,IAAI,GAAW,uBAAuB;EAI/DC,WAAWA,CAACC,EAAoB,EAAE;IACrC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;AACJ;AAEA,OAAO,MAAMC,WAAW,GAAiCD,EAAoB,IAAqB;EAC9F,OAAO,IAAIH,WAAW,CAAIG,EAAE,CAAC;AACjC,CAAC","ignoreList":[]}
package/stringifyError.js CHANGED
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.stringifyError = void 0;
7
- const stringifyError = error => {
1
+ export const stringifyError = error => {
8
2
  const {
9
3
  name,
10
4
  message,
@@ -22,6 +16,5 @@ const stringifyError = error => {
22
16
  stack: process.env.DEBUG === "true" ? stack : "Turn on the debug flag to see the stack."
23
17
  });
24
18
  };
25
- exports.stringifyError = stringifyError;
26
19
 
27
20
  //# sourceMappingURL=stringifyError.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["stringifyError","error","name","message","code","stack","data","JSON","stringify","constructorName","constructor","process","env","DEBUG","exports"],"sources":["stringifyError.ts"],"sourcesContent":["export interface CustomError extends Error {\n code?: string;\n data?: Record<string, any>;\n}\n\nexport const stringifyError = (error: CustomError) => {\n const { name, message, code, stack, data } = error;\n return JSON.stringify({\n ...error,\n constructorName: error.constructor?.name || \"UnknownError\",\n name: name || \"No error name\",\n message: message || \"No error message\",\n code: code || \"NO_CODE\",\n data,\n stack: process.env.DEBUG === \"true\" ? stack : \"Turn on the debug flag to see the stack.\"\n });\n};\n"],"mappings":";;;;;;AAKO,MAAMA,cAAc,GAAIC,KAAkB,IAAK;EAClD,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGL,KAAK;EAClD,OAAOM,IAAI,CAACC,SAAS,CAAC;IAClB,GAAGP,KAAK;IACRQ,eAAe,EAAER,KAAK,CAACS,WAAW,EAAER,IAAI,IAAI,cAAc;IAC1DA,IAAI,EAAEA,IAAI,IAAI,eAAe;IAC7BC,OAAO,EAAEA,OAAO,IAAI,kBAAkB;IACtCC,IAAI,EAAEA,IAAI,IAAI,SAAS;IACvBE,IAAI;IACJD,KAAK,EAAEM,OAAO,CAACC,GAAG,CAACC,KAAK,KAAK,MAAM,GAAGR,KAAK,GAAG;EAClD,CAAC,CAAC;AACN,CAAC;AAACS,OAAA,CAAAd,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["stringifyError","error","name","message","code","stack","data","JSON","stringify","constructorName","constructor","process","env","DEBUG"],"sources":["stringifyError.ts"],"sourcesContent":["export interface CustomError extends Error {\n code?: string;\n data?: Record<string, any>;\n}\n\nexport const stringifyError = (error: CustomError) => {\n const { name, message, code, stack, data } = error;\n return JSON.stringify({\n ...error,\n constructorName: error.constructor?.name || \"UnknownError\",\n name: name || \"No error name\",\n message: message || \"No error message\",\n code: code || \"NO_CODE\",\n data,\n stack: process.env.DEBUG === \"true\" ? stack : \"Turn on the debug flag to see the stack.\"\n });\n};\n"],"mappings":"AAKA,OAAO,MAAMA,cAAc,GAAIC,KAAkB,IAAK;EAClD,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGL,KAAK;EAClD,OAAOM,IAAI,CAACC,SAAS,CAAC;IAClB,GAAGP,KAAK;IACRQ,eAAe,EAAER,KAAK,CAACS,WAAW,EAAER,IAAI,IAAI,cAAc;IAC1DA,IAAI,EAAEA,IAAI,IAAI,eAAe;IAC7BC,OAAO,EAAEA,OAAO,IAAI,kBAAkB;IACtCC,IAAI,EAAEA,IAAI,IAAI,SAAS;IACvBE,IAAI;IACJD,KAAK,EAAEM,OAAO,CAACC,GAAG,CAACC,KAAK,KAAK,MAAM,GAAGR,KAAK,GAAG;EAClD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,4 +1 @@
1
- declare const originalConsoleError: {
2
- (...data: any[]): void;
3
- (message?: any, ...optionalParams: any[]): void;
4
- };
1
+ export {};
@@ -1,5 +1,3 @@
1
- "use strict";
2
-
3
1
  const originalConsoleError = console.error;
4
2
  console.error = (message, ...args) => {
5
3
  if (typeof message === "string" && message.includes("punycode")) {
@@ -7,5 +5,6 @@ console.error = (message, ...args) => {
7
5
  }
8
6
  originalConsoleError.call(console, message, ...args);
9
7
  };
8
+ export {};
10
9
 
11
10
  //# sourceMappingURL=suppressPunycodeWarnings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["originalConsoleError","console","error","message","args","includes","call"],"sources":["suppressPunycodeWarnings.ts"],"sourcesContent":["const originalConsoleError = console.error;\nconsole.error = (message, ...args) => {\n if (typeof message === \"string\" && message.includes(\"punycode\")) {\n return;\n }\n originalConsoleError.call(console, message, ...args);\n};\n"],"mappings":";;AAAA,MAAMA,oBAAoB,GAAGC,OAAO,CAACC,KAAK;AAC1CD,OAAO,CAACC,KAAK,GAAG,CAACC,OAAO,EAAE,GAAGC,IAAI,KAAK;EAClC,IAAI,OAAOD,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACE,QAAQ,CAAC,UAAU,CAAC,EAAE;IAC7D;EACJ;EACAL,oBAAoB,CAACM,IAAI,CAACL,OAAO,EAAEE,OAAO,EAAE,GAAGC,IAAI,CAAC;AACxD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["originalConsoleError","console","error","message","args","includes","call"],"sources":["suppressPunycodeWarnings.ts"],"sourcesContent":["const originalConsoleError = console.error;\nconsole.error = (message, ...args) => {\n if (typeof message === \"string\" && message.includes(\"punycode\")) {\n return;\n }\n originalConsoleError.call(console, message, ...args);\n};\n\nexport {};\n"],"mappings":"AAAA,MAAMA,oBAAoB,GAAGC,OAAO,CAACC,KAAK;AAC1CD,OAAO,CAACC,KAAK,GAAG,CAACC,OAAO,EAAE,GAAGC,IAAI,KAAK;EAClC,IAAI,OAAOD,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACE,QAAQ,CAAC,UAAU,CAAC,EAAE;IAC7D;EACJ;EACAL,oBAAoB,CAACM,IAAI,CAACL,OAAO,EAAEE,OAAO,EAAE,GAAGC,IAAI,CAAC;AACxD,CAAC;AAED","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "@fastify/cookie";
2
2
  import type { FastifyRequest, FastifyReply, HTTPMethods as BaseHttpMethods, RouteHandlerMethod } from "fastify";
3
- export { FastifyInstance } from "fastify";
4
- import type { ClientContext } from "@webiny/handler-client/types";
3
+ export type { FastifyInstance } from "fastify";
4
+ import type { ClientContext } from "@webiny/handler-client/types.js";
5
5
  export interface RouteMethodOptions {
6
6
  override?: boolean;
7
7
  }
package/types.js CHANGED
@@ -1,15 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "FastifyInstance", {
7
- enumerable: true,
8
- get: function () {
9
- return _fastify.FastifyInstance;
10
- }
11
- });
12
- require("@fastify/cookie");
13
- var _fastify = require("fastify");
1
+ import "@fastify/cookie";
14
2
 
15
3
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["require","_fastify"],"sources":["types.ts"],"sourcesContent":["import \"@fastify/cookie\";\nimport type {\n FastifyRequest,\n FastifyReply,\n HTTPMethods as BaseHttpMethods,\n RouteHandlerMethod\n} from \"fastify\";\nexport { FastifyInstance } from \"fastify\";\nimport type { ClientContext } from \"@webiny/handler-client/types\";\n\nexport interface RouteMethodOptions {\n override?: boolean;\n}\n\nexport type RouteMethodPath = `/${string}` | \"*\";\nexport interface RouteMethod {\n (path: RouteMethodPath, handler: RouteHandlerMethod, options?: RouteMethodOptions): void;\n}\n\nexport type Request = FastifyRequest;\nexport type Reply = FastifyReply;\n\nexport type HTTPMethods = Uppercase<BaseHttpMethods>;\n\nexport type DefinedContextRoutes = Record<HTTPMethods, string[]>;\n\nexport interface ContextRoutes {\n defined: DefinedContextRoutes;\n onGet: RouteMethod;\n onPost: RouteMethod;\n onPut: RouteMethod;\n onPatch: RouteMethod;\n onDelete: RouteMethod;\n onOptions: RouteMethod;\n onAll: RouteMethod;\n onHead: RouteMethod;\n}\n\nexport interface Context extends ClientContext {\n /**\n * Current request. Must be set only once!\n */\n request: FastifyRequest;\n /**\n * Current reply. Must be set only once!\n */\n reply: FastifyReply;\n /**\n * @internal\n */\n routes: ContextRoutes;\n}\n\ndeclare module \"fastify\" {\n interface FastifyInstance {\n webiny: Context;\n __webiny_raw_result: any;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAAA,OAAA;AAOA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import \"@fastify/cookie\";\nimport type {\n FastifyRequest,\n FastifyReply,\n HTTPMethods as BaseHttpMethods,\n RouteHandlerMethod\n} from \"fastify\";\nexport type { FastifyInstance } from \"fastify\";\nimport type { ClientContext } from \"@webiny/handler-client/types.js\";\n\nexport interface RouteMethodOptions {\n override?: boolean;\n}\n\nexport type RouteMethodPath = `/${string}` | \"*\";\nexport interface RouteMethod {\n (path: RouteMethodPath, handler: RouteHandlerMethod, options?: RouteMethodOptions): void;\n}\n\nexport type Request = FastifyRequest;\nexport type Reply = FastifyReply;\n\nexport type HTTPMethods = Uppercase<BaseHttpMethods>;\n\nexport type DefinedContextRoutes = Record<HTTPMethods, string[]>;\n\nexport interface ContextRoutes {\n defined: DefinedContextRoutes;\n onGet: RouteMethod;\n onPost: RouteMethod;\n onPut: RouteMethod;\n onPatch: RouteMethod;\n onDelete: RouteMethod;\n onOptions: RouteMethod;\n onAll: RouteMethod;\n onHead: RouteMethod;\n}\n\nexport interface Context extends ClientContext {\n /**\n * Current request. Must be set only once!\n */\n request: FastifyRequest;\n /**\n * Current reply. Must be set only once!\n */\n reply: FastifyReply;\n /**\n * @internal\n */\n routes: ContextRoutes;\n}\n\ndeclare module \"fastify\" {\n interface FastifyInstance {\n webiny: Context;\n __webiny_raw_result: any;\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB","ignoreList":[]}