@webiny/handler 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.9bd236cf5e

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 (82) hide show
  1. package/Context.d.ts +4 -5
  2. package/Context.js +6 -12
  3. package/Context.js.map +1 -1
  4. package/PreHandler/IPreHandler.d.ts +9 -0
  5. package/PreHandler/IPreHandler.js +13 -0
  6. package/PreHandler/IPreHandler.js.map +1 -0
  7. package/PreHandler/IfNotOptionsRequest.d.ts +9 -0
  8. package/PreHandler/IfNotOptionsRequest.js +28 -0
  9. package/PreHandler/IfNotOptionsRequest.js.map +1 -0
  10. package/PreHandler/IfOptionsRequest.d.ts +9 -0
  11. package/PreHandler/IfOptionsRequest.js +28 -0
  12. package/PreHandler/IfOptionsRequest.js.map +1 -0
  13. package/PreHandler/PreHandler.d.ts +9 -0
  14. package/PreHandler/PreHandler.js +24 -0
  15. package/PreHandler/PreHandler.js.map +1 -0
  16. package/PreHandler/ProcessBeforeHandlerPlugins.d.ts +10 -0
  17. package/PreHandler/ProcessBeforeHandlerPlugins.js +31 -0
  18. package/PreHandler/ProcessBeforeHandlerPlugins.js.map +1 -0
  19. package/PreHandler/ProcessContextPlugins.d.ts +10 -0
  20. package/PreHandler/ProcessContextPlugins.js +31 -0
  21. package/PreHandler/ProcessContextPlugins.js.map +1 -0
  22. package/PreHandler/ProcessHandlerOnRequestPlugins.d.ts +10 -0
  23. package/PreHandler/ProcessHandlerOnRequestPlugins.js +33 -0
  24. package/PreHandler/ProcessHandlerOnRequestPlugins.js.map +1 -0
  25. package/PreHandler/SendEarlyOptionsResponse.d.ts +9 -0
  26. package/PreHandler/SendEarlyOptionsResponse.js +38 -0
  27. package/PreHandler/SendEarlyOptionsResponse.js.map +1 -0
  28. package/PreHandler/SetDefaultHeaders.d.ts +9 -0
  29. package/PreHandler/SetDefaultHeaders.js +64 -0
  30. package/PreHandler/SetDefaultHeaders.js.map +1 -0
  31. package/ResponseHeaders.d.ts +25 -0
  32. package/ResponseHeaders.js +46 -0
  33. package/ResponseHeaders.js.map +1 -0
  34. package/fastify.d.ts +6 -4
  35. package/fastify.js +159 -185
  36. package/fastify.js.map +1 -1
  37. package/index.d.ts +6 -0
  38. package/index.js +48 -1
  39. package/index.js.map +1 -1
  40. package/package.json +15 -23
  41. package/plugins/BeforeHandlerPlugin.d.ts +1 -1
  42. package/plugins/BeforeHandlerPlugin.js +4 -5
  43. package/plugins/BeforeHandlerPlugin.js.map +1 -1
  44. package/plugins/EventPlugin.d.ts +1 -1
  45. package/plugins/EventPlugin.js +4 -5
  46. package/plugins/EventPlugin.js.map +1 -1
  47. package/plugins/HandlerErrorPlugin.d.ts +6 -3
  48. package/plugins/HandlerErrorPlugin.js +4 -5
  49. package/plugins/HandlerErrorPlugin.js.map +1 -1
  50. package/plugins/HandlerOnRequestPlugin.d.ts +9 -8
  51. package/plugins/HandlerOnRequestPlugin.js +13 -7
  52. package/plugins/HandlerOnRequestPlugin.js.map +1 -1
  53. package/plugins/HandlerResultPlugin.d.ts +1 -1
  54. package/plugins/HandlerResultPlugin.js +4 -5
  55. package/plugins/HandlerResultPlugin.js.map +1 -1
  56. package/plugins/ModifyFastifyPlugin.d.ts +1 -1
  57. package/plugins/ModifyFastifyPlugin.js +4 -5
  58. package/plugins/ModifyFastifyPlugin.js.map +1 -1
  59. package/plugins/ModifyResponseHeadersPlugin.d.ts +14 -0
  60. package/plugins/ModifyResponseHeadersPlugin.js +24 -0
  61. package/plugins/ModifyResponseHeadersPlugin.js.map +1 -0
  62. package/plugins/OnRequestResponseSendPlugin.d.ts +26 -0
  63. package/plugins/OnRequestResponseSendPlugin.js +40 -0
  64. package/plugins/OnRequestResponseSendPlugin.js.map +1 -0
  65. package/plugins/OnRequestTimeoutPlugin.d.ts +12 -0
  66. package/plugins/OnRequestTimeoutPlugin.js +24 -0
  67. package/plugins/OnRequestTimeoutPlugin.js.map +1 -0
  68. package/plugins/RoutePlugin.d.ts +1 -1
  69. package/plugins/RoutePlugin.js +4 -5
  70. package/plugins/RoutePlugin.js.map +1 -1
  71. package/stringifyError.d.ts +5 -0
  72. package/stringifyError.js +27 -0
  73. package/stringifyError.js.map +1 -0
  74. package/suppressPunycodeWarnings.d.ts +4 -0
  75. package/suppressPunycodeWarnings.js +11 -0
  76. package/suppressPunycodeWarnings.js.map +1 -0
  77. package/types.d.ts +10 -13
  78. package/types.js +4 -7
  79. package/types.js.map +1 -1
  80. package/middleware.d.ts +0 -4
  81. package/middleware.js +0 -45
  82. package/middleware.js.map +0 -1
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import "./suppressPunycodeWarnings";
1
2
  export * from "./fastify";
2
3
  export * from "./Context";
4
+ export * from "./ResponseHeaders";
3
5
  export * from "./plugins/EventPlugin";
4
6
  export * from "./plugins/RoutePlugin";
5
7
  export * from "./plugins/BeforeHandlerPlugin";
@@ -7,3 +9,7 @@ export * from "./plugins/HandlerErrorPlugin";
7
9
  export * from "./plugins/HandlerResultPlugin";
8
10
  export * from "./plugins/HandlerOnRequestPlugin";
9
11
  export * from "./plugins/ModifyFastifyPlugin";
12
+ export * from "./plugins/ModifyResponseHeadersPlugin";
13
+ export * from "./plugins/OnRequestResponseSendPlugin.js";
14
+ export * from "./plugins/OnRequestTimeoutPlugin.js";
15
+ export * from "./ResponseHeaders";
package/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ require("./suppressPunycodeWarnings");
6
7
  var _fastify = require("./fastify");
7
8
  Object.keys(_fastify).forEach(function (key) {
8
9
  if (key === "default" || key === "__esModule") return;
@@ -25,6 +26,17 @@ Object.keys(_Context).forEach(function (key) {
25
26
  }
26
27
  });
27
28
  });
29
+ var _ResponseHeaders = require("./ResponseHeaders");
30
+ Object.keys(_ResponseHeaders).forEach(function (key) {
31
+ if (key === "default" || key === "__esModule") return;
32
+ if (key in exports && exports[key] === _ResponseHeaders[key]) return;
33
+ Object.defineProperty(exports, key, {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _ResponseHeaders[key];
37
+ }
38
+ });
39
+ });
28
40
  var _EventPlugin = require("./plugins/EventPlugin");
29
41
  Object.keys(_EventPlugin).forEach(function (key) {
30
42
  if (key === "default" || key === "__esModule") return;
@@ -101,4 +113,39 @@ Object.keys(_ModifyFastifyPlugin).forEach(function (key) {
101
113
  return _ModifyFastifyPlugin[key];
102
114
  }
103
115
  });
104
- });
116
+ });
117
+ var _ModifyResponseHeadersPlugin = require("./plugins/ModifyResponseHeadersPlugin");
118
+ Object.keys(_ModifyResponseHeadersPlugin).forEach(function (key) {
119
+ if (key === "default" || key === "__esModule") return;
120
+ if (key in exports && exports[key] === _ModifyResponseHeadersPlugin[key]) return;
121
+ Object.defineProperty(exports, key, {
122
+ enumerable: true,
123
+ get: function () {
124
+ return _ModifyResponseHeadersPlugin[key];
125
+ }
126
+ });
127
+ });
128
+ var _OnRequestResponseSendPlugin = require("./plugins/OnRequestResponseSendPlugin.js");
129
+ Object.keys(_OnRequestResponseSendPlugin).forEach(function (key) {
130
+ if (key === "default" || key === "__esModule") return;
131
+ if (key in exports && exports[key] === _OnRequestResponseSendPlugin[key]) return;
132
+ Object.defineProperty(exports, key, {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _OnRequestResponseSendPlugin[key];
136
+ }
137
+ });
138
+ });
139
+ var _OnRequestTimeoutPlugin = require("./plugins/OnRequestTimeoutPlugin.js");
140
+ Object.keys(_OnRequestTimeoutPlugin).forEach(function (key) {
141
+ if (key === "default" || key === "__esModule") return;
142
+ if (key in exports && exports[key] === _OnRequestTimeoutPlugin[key]) return;
143
+ Object.defineProperty(exports, key, {
144
+ enumerable: true,
145
+ get: function () {
146
+ return _OnRequestTimeoutPlugin[key];
147
+ }
148
+ });
149
+ });
150
+
151
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"~/fastify\";\nexport * from \"~/Context\";\nexport * from \"~/plugins/EventPlugin\";\nexport * from \"~/plugins/RoutePlugin\";\nexport * from \"~/plugins/BeforeHandlerPlugin\";\nexport * from \"~/plugins/HandlerErrorPlugin\";\nexport * from \"~/plugins/HandlerResultPlugin\";\nexport * from \"~/plugins/HandlerOnRequestPlugin\";\nexport * from \"~/plugins/ModifyFastifyPlugin\";\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":["require","_fastify","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Context","_ResponseHeaders","_EventPlugin","_RoutePlugin","_BeforeHandlerPlugin","_HandlerErrorPlugin","_HandlerResultPlugin","_HandlerOnRequestPlugin","_ModifyFastifyPlugin","_ModifyResponseHeadersPlugin","_OnRequestResponseSendPlugin","_OnRequestTimeoutPlugin"],"sources":["index.ts"],"sourcesContent":["// Suppress punycode warnings. This is a known issue which we can't fix.\nimport \"./suppressPunycodeWarnings\";\n\nexport * from \"~/fastify\";\nexport * from \"~/Context\";\nexport * from \"~/ResponseHeaders\";\nexport * from \"~/plugins/EventPlugin\";\nexport * from \"~/plugins/RoutePlugin\";\nexport * from \"~/plugins/BeforeHandlerPlugin\";\nexport * from \"~/plugins/HandlerErrorPlugin\";\nexport * from \"~/plugins/HandlerResultPlugin\";\nexport * from \"~/plugins/HandlerOnRequestPlugin\";\nexport * from \"~/plugins/ModifyFastifyPlugin\";\nexport * from \"~/plugins/ModifyResponseHeadersPlugin\";\nexport * from \"~/plugins/OnRequestResponseSendPlugin.js\";\nexport * from \"~/plugins/OnRequestTimeoutPlugin.js\";\nexport * from \"./ResponseHeaders\";\n"],"mappings":";;;;;AACAA,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,QAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,QAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAR,QAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAV,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,gBAAA,GAAAX,OAAA;AAWAE,MAAA,CAAAC,IAAA,CAAAQ,gBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,I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,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAgB,uBAAA,CAAAhB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAY,uBAAA,CAAAhB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/handler",
3
- "version": "0.0.0-unstable.99666aeb00",
3
+ "version": "0.0.0-unstable.9bd236cf5e",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,35 +12,27 @@
12
12
  ],
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@babel/runtime": "7.20.13",
16
- "@fastify/compress": "6.2.0",
17
- "@fastify/cookie": "8.3.0",
18
- "@webiny/api": "0.0.0-unstable.99666aeb00",
19
- "@webiny/error": "0.0.0-unstable.99666aeb00",
20
- "@webiny/handler-client": "0.0.0-unstable.99666aeb00",
21
- "@webiny/plugins": "0.0.0-unstable.99666aeb00",
22
- "@webiny/utils": "0.0.0-unstable.99666aeb00",
23
- "fastify": "4.11.0"
15
+ "@fastify/compress": "7.0.3",
16
+ "@fastify/cookie": "9.4.0",
17
+ "@webiny/api": "0.0.0-unstable.9bd236cf5e",
18
+ "@webiny/error": "0.0.0-unstable.9bd236cf5e",
19
+ "@webiny/handler-client": "0.0.0-unstable.9bd236cf5e",
20
+ "@webiny/plugins": "0.0.0-unstable.9bd236cf5e",
21
+ "@webiny/utils": "0.0.0-unstable.9bd236cf5e",
22
+ "fastify": "4.29.1"
24
23
  },
25
24
  "devDependencies": {
26
- "@babel/cli": "7.20.7",
27
- "@babel/core": "7.20.12",
28
- "@babel/preset-env": "7.20.2",
29
- "@babel/preset-typescript": "7.18.6",
30
- "@webiny/cli": "0.0.0-unstable.99666aeb00",
31
- "@webiny/project-utils": "0.0.0-unstable.99666aeb00",
32
- "babel-plugin-lodash": "3.3.4",
33
- "rimraf": "3.0.2",
34
- "ttypescript": "1.5.15",
35
- "typescript": "4.7.4"
25
+ "@webiny/project-utils": "0.0.0-unstable.9bd236cf5e",
26
+ "rimraf": "6.0.1",
27
+ "typescript": "5.3.3"
36
28
  },
37
29
  "publishConfig": {
38
30
  "access": "public",
39
31
  "directory": "dist"
40
32
  },
41
33
  "scripts": {
42
- "build": "yarn webiny run build",
43
- "watch": "yarn webiny run watch"
34
+ "build": "node ../cli/bin.js run build",
35
+ "watch": "node ../cli/bin.js run watch"
44
36
  },
45
- "gitHead": "99666aeb00056c56292eeb5dbb6aba7fda2439e2"
37
+ "gitHead": "9bd236cf5e689f209a11bec089207dcc2d41a53c"
46
38
  }
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- import { Context } from "../types";
2
+ import type { Context } from "../types";
3
3
  export interface BeforeHandlerCallable<T extends Context = Context> {
4
4
  (context: T): void | Promise<void>;
5
5
  }
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createBeforeHandlerPlugin = exports.BeforeHandlerPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _plugins = require("@webiny/plugins");
10
8
  class BeforeHandlerPlugin extends _plugins.Plugin {
9
+ static type = "before-handler";
11
10
  constructor(callable) {
12
11
  super();
13
- (0, _defineProperty2.default)(this, "_callable", void 0);
14
12
  this._callable = callable;
15
13
  }
16
14
  async apply(context) {
@@ -21,8 +19,9 @@ class BeforeHandlerPlugin extends _plugins.Plugin {
21
19
  }
22
20
  }
23
21
  exports.BeforeHandlerPlugin = BeforeHandlerPlugin;
24
- (0, _defineProperty2.default)(BeforeHandlerPlugin, "type", "before-handler");
25
22
  const createBeforeHandlerPlugin = callable => {
26
23
  return new BeforeHandlerPlugin(callable);
27
24
  };
28
- exports.createBeforeHandlerPlugin = createBeforeHandlerPlugin;
25
+ exports.createBeforeHandlerPlugin = createBeforeHandlerPlugin;
26
+
27
+ //# sourceMappingURL=BeforeHandlerPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BeforeHandlerPlugin","Plugin","constructor","callable","_callable","apply","context","Error","createBeforeHandlerPlugin"],"sources":["BeforeHandlerPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { Context } from \"~/types\";\n\nexport interface BeforeHandlerCallable<T extends Context = Context> {\n (context: T): void | Promise<void>;\n}\n\nexport class BeforeHandlerPlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"before-handler\";\n private readonly _callable: BeforeHandlerCallable<T>;\n\n constructor(callable: BeforeHandlerCallable<T>) {\n super();\n this._callable = callable;\n }\n\n public async apply(context: T): Promise<void> {\n if (typeof this._callable !== \"function\") {\n throw Error(\n `Missing callable in BeforeHandlerPlugin! Either pass a callable to plugin constructor or extend the plugin and override the \"apply\" method.`\n );\n }\n\n return this._callable(context);\n }\n}\n\nexport const createBeforeHandlerPlugin = <T extends Context = Context>(\n callable: BeforeHandlerCallable<T>\n): BeforeHandlerPlugin<T> => {\n return new BeforeHandlerPlugin<T>(callable);\n};\n"],"mappings":";;;;;;;;AAAA;AAOO,MAAMA,mBAAmB,SAAsCC,eAAM,CAAC;EAIzEC,WAAW,CAACC,QAAkC,EAAE;IAC5C,KAAK,EAAE;IAAC;IACR,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,KAAK,CAACC,OAAU,EAAiB;IAC1C,IAAI,OAAO,IAAI,CAACF,SAAS,KAAK,UAAU,EAAE;MACtC,MAAMG,KAAK,CACN,6IAA4I,CAChJ;IACL;IAEA,OAAO,IAAI,CAACH,SAAS,CAACE,OAAO,CAAC;EAClC;AACJ;AAAC;AAAA,8BAlBYN,mBAAmB,UACmB,gBAAgB;AAmB5D,MAAMQ,yBAAyB,GAClCL,QAAkC,IACT;EACzB,OAAO,IAAIH,mBAAmB,CAAIG,QAAQ,CAAC;AAC/C,CAAC;AAAC"}
1
+ {"version":3,"names":["_plugins","require","BeforeHandlerPlugin","Plugin","type","constructor","callable","_callable","apply","context","Error","exports","createBeforeHandlerPlugin"],"sources":["BeforeHandlerPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Context } from \"~/types\";\n\nexport interface BeforeHandlerCallable<T extends Context = Context> {\n (context: T): void | Promise<void>;\n}\n\nexport class BeforeHandlerPlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"before-handler\";\n private readonly _callable: BeforeHandlerCallable<T>;\n\n constructor(callable: BeforeHandlerCallable<T>) {\n super();\n this._callable = callable;\n }\n\n public async apply(context: T): Promise<void> {\n if (typeof this._callable !== \"function\") {\n throw Error(\n `Missing callable in BeforeHandlerPlugin! Either pass a callable to plugin constructor or extend the plugin and override the \"apply\" method.`\n );\n }\n\n return this._callable(context);\n }\n}\n\nexport const createBeforeHandlerPlugin = <T extends Context = Context>(\n callable: BeforeHandlerCallable<T>\n): BeforeHandlerPlugin<T> => {\n return new BeforeHandlerPlugin<T>(callable);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,mBAAmB,SAAsCC,eAAM,CAAC;EACzE,OAAgCC,IAAI,GAAW,gBAAgB;EAG/DC,WAAWA,CAACC,QAAkC,EAAE;IAC5C,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,KAAKA,CAACC,OAAU,EAAiB;IAC1C,IAAI,OAAO,IAAI,CAACF,SAAS,KAAK,UAAU,EAAE;MACtC,MAAMG,KAAK,CACP,6IACJ,CAAC;IACL;IAEA,OAAO,IAAI,CAACH,SAAS,CAACE,OAAO,CAAC;EAClC;AACJ;AAACE,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":[]}
@@ -7,7 +7,7 @@
7
7
  * If more is needed, check ~/fastify.ts and implement that possibility.
8
8
  */
9
9
  import { Plugin } from "@webiny/plugins/Plugin";
10
- import { Request, Context as BaseContext, Reply } from "../types";
10
+ import type { Request, Context as BaseContext, Reply } from "../types";
11
11
  export interface EventPluginCallableParams<Payload, Context extends BaseContext> {
12
12
  context: Context;
13
13
  payload: Payload;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createEvent = exports.EventPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _Plugin = require("@webiny/plugins/Plugin");
10
8
  /**
11
9
  * EventPlugin must be handled in the package which implements fastify for certain cloud.
@@ -17,15 +15,16 @@ var _Plugin = require("@webiny/plugins/Plugin");
17
15
  */
18
16
 
19
17
  class EventPlugin extends _Plugin.Plugin {
18
+ static type = "handler.fastify.event";
20
19
  constructor(cb) {
21
20
  super();
22
- (0, _defineProperty2.default)(this, "cb", void 0);
23
21
  this.cb = cb;
24
22
  }
25
23
  }
26
24
  exports.EventPlugin = EventPlugin;
27
- (0, _defineProperty2.default)(EventPlugin, "type", "handler.fastify.event");
28
25
  const createEvent = cb => {
29
26
  return new EventPlugin(cb);
30
27
  };
31
- exports.createEvent = createEvent;
28
+ exports.createEvent = createEvent;
29
+
30
+ //# sourceMappingURL=EventPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["EventPlugin","Plugin","constructor","cb","createEvent"],"sources":["EventPlugin.ts"],"sourcesContent":["/**\n * EventPlugin must be handled in the package which implements fastify for certain cloud.\n * There is no standard input for AWS Lambda, Google Cloud Functions and MS Azure Functions so we let that\n * to be sorted out in the implementation package.\n *\n * Note that only one EventPlugin can be defined per fastify initialisation.\n * If more is needed, check ~/fastify.ts and implement that possibility.\n */\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport { Request, Context as BaseContext, Reply } from \"~/types\";\n\nexport interface EventPluginCallableParams<Payload, Context extends BaseContext> {\n context: Context;\n payload: Payload;\n request: Request;\n reply: Reply;\n}\n\nexport interface EventPluginCallable<Payload, Context extends BaseContext, Response> {\n (params: EventPluginCallableParams<Payload, Context>): Promise<Response | Reply>;\n}\n\nexport class EventPlugin<\n Payload = any,\n Context extends BaseContext = BaseContext,\n Response = any\n> extends Plugin {\n public static override type = \"handler.fastify.event\";\n\n public readonly cb: EventPluginCallable<Payload, Context, Response>;\n\n public constructor(cb: EventPluginCallable<Payload, Context, Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEvent = <\n Payload = any,\n Context extends BaseContext = BaseContext,\n Response = any\n>(\n cb: EventPluginCallable<Payload, Context, Response>\n) => {\n return new EventPlugin<Payload, Context, Response>(cb);\n};\n"],"mappings":";;;;;;;;AAQA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeO,MAAMA,WAAW,SAIdC,cAAM,CAAC;EAKNC,WAAW,CAACC,EAAmD,EAAE;IACpE,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;AACJ;AAAC;AAAA,8BAbYH,WAAW,UAKU,uBAAuB;AAUlD,MAAMI,WAAW,GAKpBD,EAAmD,IAClD;EACD,OAAO,IAAIH,WAAW,CAA6BG,EAAE,CAAC;AAC1D,CAAC;AAAC"}
1
+ {"version":3,"names":["_Plugin","require","EventPlugin","Plugin","type","constructor","cb","exports","createEvent"],"sources":["EventPlugin.ts"],"sourcesContent":["/**\n * EventPlugin must be handled in the package which implements fastify for certain cloud.\n * There is no standard input for AWS Lambda, Google Cloud Functions and MS Azure Functions so we let that\n * to be sorted out in the implementation package.\n *\n * Note that only one EventPlugin can be defined per fastify initialisation.\n * If more is needed, check ~/fastify.ts and implement that possibility.\n */\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { Request, Context as BaseContext, Reply } from \"~/types\";\n\nexport interface EventPluginCallableParams<Payload, Context extends BaseContext> {\n context: Context;\n payload: Payload;\n request: Request;\n reply: Reply;\n}\n\nexport interface EventPluginCallable<Payload, Context extends BaseContext, Response> {\n (params: EventPluginCallableParams<Payload, Context>): Promise<Response | Reply>;\n}\n\nexport class EventPlugin<\n Payload = any,\n Context extends BaseContext = BaseContext,\n Response = any\n> extends Plugin {\n public static override type = \"handler.fastify.event\";\n\n public readonly cb: EventPluginCallable<Payload, Context, Response>;\n\n public constructor(cb: EventPluginCallable<Payload, Context, Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEvent = <\n Payload = any,\n Context extends BaseContext = BaseContext,\n Response = any\n>(\n cb: EventPluginCallable<Payload, Context, Response>\n) => {\n return new EventPlugin<Payload, Context, Response>(cb);\n};\n"],"mappings":";;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeO,MAAMC,WAAW,SAIdC,cAAM,CAAC;EACb,OAAuBC,IAAI,GAAG,uBAAuB;EAI9CC,WAAWA,CAACC,EAAmD,EAAE;IACpE,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;AACJ;AAACC,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAEM,MAAMM,WAAW,GAKpBF,EAAmD,IAClD;EACD,OAAO,IAAIJ,WAAW,CAA6BI,EAAE,CAAC;AAC1D,CAAC;AAACC,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,12 +1,15 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- import { Context } from "../types";
2
+ import type { Context } from "../types";
3
+ export interface NextCallable {
4
+ (): Promise<any>;
5
+ }
3
6
  export interface HandlerErrorCallable<T extends Context = Context> {
4
- (context: T, error: Error, next: Function): Promise<any>;
7
+ (context: T, error: Error, next: NextCallable): Promise<any>;
5
8
  }
6
9
  export declare class HandlerErrorPlugin<T extends Context = Context> extends Plugin {
7
10
  static readonly type: string;
8
11
  private readonly _callable;
9
12
  constructor(callable: HandlerErrorCallable<T>);
10
- handle(context: T, error: Error, next: Function): Promise<any>;
13
+ handle(context: T, error: Error, next: NextCallable): Promise<any>;
11
14
  }
12
15
  export declare const createHandlerErrorPlugin: <T extends Context = Context>(callable: HandlerErrorCallable<T>) => HandlerErrorPlugin<T>;
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createHandlerErrorPlugin = exports.HandlerErrorPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _plugins = require("@webiny/plugins");
10
8
  class HandlerErrorPlugin extends _plugins.Plugin {
9
+ static type = "handler-error";
11
10
  constructor(callable) {
12
11
  super();
13
- (0, _defineProperty2.default)(this, "_callable", void 0);
14
12
  this._callable = callable;
15
13
  }
16
14
  async handle(context, error, next) {
@@ -18,8 +16,9 @@ class HandlerErrorPlugin extends _plugins.Plugin {
18
16
  }
19
17
  }
20
18
  exports.HandlerErrorPlugin = HandlerErrorPlugin;
21
- (0, _defineProperty2.default)(HandlerErrorPlugin, "type", "handler-error");
22
19
  const createHandlerErrorPlugin = callable => {
23
20
  return new HandlerErrorPlugin(callable);
24
21
  };
25
- exports.createHandlerErrorPlugin = createHandlerErrorPlugin;
22
+ exports.createHandlerErrorPlugin = createHandlerErrorPlugin;
23
+
24
+ //# sourceMappingURL=HandlerErrorPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HandlerErrorPlugin","Plugin","constructor","callable","_callable","handle","context","error","next","createHandlerErrorPlugin"],"sources":["HandlerErrorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { Context } from \"~/types\";\n\nexport interface HandlerErrorCallable<T extends Context = Context> {\n (context: T, error: Error, next: Function): Promise<any>;\n}\n\nexport class HandlerErrorPlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler-error\";\n\n private readonly _callable: HandlerErrorCallable<T>;\n\n public constructor(callable: HandlerErrorCallable<T>) {\n super();\n this._callable = callable;\n }\n\n public async handle(context: T, error: Error, next: Function): Promise<any> {\n return this._callable(context, error, next);\n }\n}\n\nexport const createHandlerErrorPlugin = <T extends Context = Context>(\n callable: HandlerErrorCallable<T>\n): HandlerErrorPlugin<T> => {\n return new HandlerErrorPlugin<T>(callable);\n};\n"],"mappings":";;;;;;;;AAAA;AAOO,MAAMA,kBAAkB,SAAsCC,eAAM,CAAC;EAKjEC,WAAW,CAACC,QAAiC,EAAE;IAClD,KAAK,EAAE;IAAC;IACR,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,MAAM,CAACC,OAAU,EAAEC,KAAY,EAAEC,IAAc,EAAgB;IACxE,OAAO,IAAI,CAACJ,SAAS,CAACE,OAAO,EAAEC,KAAK,EAAEC,IAAI,CAAC;EAC/C;AACJ;AAAC;AAAA,8BAbYR,kBAAkB,UACoB,eAAe;AAc3D,MAAMS,wBAAwB,GACjCN,QAAiC,IACT;EACxB,OAAO,IAAIH,kBAAkB,CAAIG,QAAQ,CAAC;AAC9C,CAAC;AAAC"}
1
+ {"version":3,"names":["_plugins","require","HandlerErrorPlugin","Plugin","type","constructor","callable","_callable","handle","context","error","next","exports","createHandlerErrorPlugin"],"sources":["HandlerErrorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Context } from \"~/types\";\n\nexport interface NextCallable {\n (): Promise<any>;\n}\n\nexport interface HandlerErrorCallable<T extends Context = Context> {\n (context: T, error: Error, next: NextCallable): Promise<any>;\n}\n\nexport class HandlerErrorPlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler-error\";\n\n private readonly _callable: HandlerErrorCallable<T>;\n\n public constructor(callable: HandlerErrorCallable<T>) {\n super();\n this._callable = callable;\n }\n\n public async handle(context: T, error: Error, next: NextCallable): Promise<any> {\n return this._callable(context, error, next);\n }\n}\n\nexport const createHandlerErrorPlugin = <T extends Context = Context>(\n callable: HandlerErrorCallable<T>\n): HandlerErrorPlugin<T> => {\n return new HandlerErrorPlugin<T>(callable);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAWO,MAAMC,kBAAkB,SAAsCC,eAAM,CAAC;EACxE,OAAgCC,IAAI,GAAW,eAAe;EAIvDC,WAAWA,CAACC,QAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,MAAMA,CAACC,OAAU,EAAEC,KAAY,EAAEC,IAAkB,EAAgB;IAC5E,OAAO,IAAI,CAACJ,SAAS,CAACE,OAAO,EAAEC,KAAK,EAAEC,IAAI,CAAC;EAC/C;AACJ;AAACC,OAAA,CAAAV,kBAAA,GAAAA,kBAAA;AAEM,MAAMW,wBAAwB,GACjCP,QAAiC,IACT;EACxB,OAAO,IAAIJ,kBAAkB,CAAII,QAAQ,CAAC;AAC9C,CAAC;AAACM,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,20 +1,21 @@
1
+ import type { Context } from "../types";
1
2
  import { Plugin } from "@webiny/plugins";
2
- import { FastifyReply, FastifyRequest } from "fastify";
3
+ import type { FastifyReply, FastifyRequest } from "fastify";
3
4
  /**
4
5
  * If the execution of the callable returns false, no more plugins will be executed after the given one.
5
6
  * Nor it will execute our default OPTIONS code.
6
7
  *
7
8
  * This way users can prevent stopping of the request on our built-in OPTIONS request.
8
9
  */
9
- export declare type HandlerOnRequestPluginCallableResponse = false | undefined | null | void;
10
- interface HandlerOnRequestPluginCallable {
11
- (request: FastifyRequest, reply: FastifyReply): Promise<HandlerOnRequestPluginCallableResponse>;
10
+ export type HandlerOnRequestPluginCallableResponse = false | undefined | null | void;
11
+ interface HandlerOnRequestPluginCallable<C extends Context = Context> {
12
+ (request: FastifyRequest, reply: FastifyReply, context: C): Promise<HandlerOnRequestPluginCallableResponse>;
12
13
  }
13
- export declare class HandlerOnRequestPlugin extends Plugin {
14
+ export declare class HandlerOnRequestPlugin<C extends Context = Context> extends Plugin {
14
15
  static type: string;
15
16
  private readonly cb;
16
- constructor(cb: HandlerOnRequestPluginCallable);
17
- exec(request: FastifyRequest, reply: FastifyReply): Promise<HandlerOnRequestPluginCallableResponse>;
17
+ constructor(cb: HandlerOnRequestPluginCallable<C>);
18
+ exec(request: FastifyRequest, reply: FastifyReply, context: C): Promise<HandlerOnRequestPluginCallableResponse>;
18
19
  }
19
- export declare const createHandlerOnRequest: (cb: HandlerOnRequestPluginCallable) => HandlerOnRequestPlugin;
20
+ export declare const createHandlerOnRequest: <C extends Context = Context>(cb: HandlerOnRequestPluginCallable<C>) => HandlerOnRequestPlugin<C>;
20
21
  export {};
@@ -1,25 +1,31 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createHandlerOnRequest = exports.HandlerOnRequestPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _plugins = require("@webiny/plugins");
8
+ /**
9
+ * If the execution of the callable returns false, no more plugins will be executed after the given one.
10
+ * Nor it will execute our default OPTIONS code.
11
+ *
12
+ * This way users can prevent stopping of the request on our built-in OPTIONS request.
13
+ */
14
+
10
15
  class HandlerOnRequestPlugin extends _plugins.Plugin {
16
+ static type = "handler.event.onRequest";
11
17
  constructor(cb) {
12
18
  super();
13
- (0, _defineProperty2.default)(this, "cb", void 0);
14
19
  this.cb = cb;
15
20
  }
16
- async exec(request, reply) {
17
- return this.cb(request, reply);
21
+ async exec(request, reply, context) {
22
+ return this.cb(request, reply, context);
18
23
  }
19
24
  }
20
25
  exports.HandlerOnRequestPlugin = HandlerOnRequestPlugin;
21
- (0, _defineProperty2.default)(HandlerOnRequestPlugin, "type", "handler.event.onRequest");
22
26
  const createHandlerOnRequest = cb => {
23
27
  return new HandlerOnRequestPlugin(cb);
24
28
  };
25
- exports.createHandlerOnRequest = createHandlerOnRequest;
29
+ exports.createHandlerOnRequest = createHandlerOnRequest;
30
+
31
+ //# sourceMappingURL=HandlerOnRequestPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HandlerOnRequestPlugin","Plugin","constructor","cb","exec","request","reply","createHandlerOnRequest"],"sources":["HandlerOnRequestPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { 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 {\n (request: FastifyRequest, reply: FastifyReply): Promise<HandlerOnRequestPluginCallableResponse>;\n}\n\nexport class HandlerOnRequestPlugin extends Plugin {\n public static override type = \"handler.event.onRequest\";\n\n private readonly cb: HandlerOnRequestPluginCallable;\n\n public constructor(cb: HandlerOnRequestPluginCallable) {\n super();\n this.cb = cb;\n }\n\n public async exec(\n request: FastifyRequest,\n reply: FastifyReply\n ): Promise<HandlerOnRequestPluginCallableResponse> {\n return this.cb(request, reply);\n }\n}\n\nexport const createHandlerOnRequest = (cb: HandlerOnRequestPluginCallable) => {\n return new HandlerOnRequestPlugin(cb);\n};\n"],"mappings":";;;;;;;;AAAA;AAcO,MAAMA,sBAAsB,SAASC,eAAM,CAAC;EAKxCC,WAAW,CAACC,EAAkC,EAAE;IACnD,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,IAAI,CACbC,OAAuB,EACvBC,KAAmB,EAC4B;IAC/C,OAAO,IAAI,CAACH,EAAE,CAACE,OAAO,EAAEC,KAAK,CAAC;EAClC;AACJ;AAAC;AAAA,8BAhBYN,sBAAsB,UACD,yBAAyB;AAiBpD,MAAMO,sBAAsB,GAAIJ,EAAkC,IAAK;EAC1E,OAAO,IAAIH,sBAAsB,CAACG,EAAE,CAAC;AACzC,CAAC;AAAC"}
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,5 +1,5 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- import { Context } from "../types";
2
+ import type { Context } from "../types";
3
3
  export interface HandlerResultCallable<T extends Context = Context> {
4
4
  (context: T, result: any): Promise<any>;
5
5
  }
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createHandlerResultPlugin = exports.HandlerResultPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _plugins = require("@webiny/plugins");
10
8
  class HandlerResultPlugin extends _plugins.Plugin {
9
+ static type = "handler-result";
11
10
  constructor(callable) {
12
11
  super();
13
- (0, _defineProperty2.default)(this, "_callable", void 0);
14
12
  this._callable = callable;
15
13
  }
16
14
  async handle(context, result) {
@@ -18,8 +16,9 @@ class HandlerResultPlugin extends _plugins.Plugin {
18
16
  }
19
17
  }
20
18
  exports.HandlerResultPlugin = HandlerResultPlugin;
21
- (0, _defineProperty2.default)(HandlerResultPlugin, "type", "handler-result");
22
19
  const createHandlerResultPlugin = callable => {
23
20
  return new HandlerResultPlugin(callable);
24
21
  };
25
- exports.createHandlerResultPlugin = createHandlerResultPlugin;
22
+ exports.createHandlerResultPlugin = createHandlerResultPlugin;
23
+
24
+ //# sourceMappingURL=HandlerResultPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HandlerResultPlugin","Plugin","constructor","callable","_callable","handle","context","result","createHandlerResultPlugin"],"sources":["HandlerResultPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { 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;AAOO,MAAMA,mBAAmB,SAAsCC,eAAM,CAAC;EAKlEC,WAAW,CAACC,QAAkC,EAAE;IACnD,KAAK,EAAE;IAAC;IACR,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEA,MAAaE,MAAM,CAACC,OAAU,EAAEC,MAAW,EAAgB;IACvD,OAAO,IAAI,CAACH,SAAS,CAACE,OAAO,EAAEC,MAAM,CAAC;EAC1C;AACJ;AAAC;AAAA,8BAbYP,mBAAmB,UACmB,gBAAgB;AAc5D,MAAMQ,yBAAyB,GAClCL,QAAkC,IACT;EACzB,OAAO,IAAIH,mBAAmB,CAAIG,QAAQ,CAAC;AAC/C,CAAC;AAAC"}
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,5 +1,5 @@
1
1
  import { Plugin } from "@webiny/plugins/Plugin";
2
- import { FastifyInstance } from "fastify";
2
+ import type { FastifyInstance } from "fastify";
3
3
  interface ModifyFastifyPluginCallable {
4
4
  (app: FastifyInstance): void;
5
5
  }
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createModifyFastifyPlugin = exports.ModifyFastifyPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _Plugin = require("@webiny/plugins/Plugin");
10
8
  class ModifyFastifyPlugin extends _Plugin.Plugin {
9
+ static type = "handler.fastify.modify";
11
10
  constructor(cb) {
12
11
  super();
13
- (0, _defineProperty2.default)(this, "cb", void 0);
14
12
  this.cb = cb;
15
13
  }
16
14
  modify(app) {
@@ -18,8 +16,9 @@ class ModifyFastifyPlugin extends _Plugin.Plugin {
18
16
  }
19
17
  }
20
18
  exports.ModifyFastifyPlugin = ModifyFastifyPlugin;
21
- (0, _defineProperty2.default)(ModifyFastifyPlugin, "type", "handler.fastify.modify");
22
19
  const createModifyFastifyPlugin = cb => {
23
20
  return new ModifyFastifyPlugin(cb);
24
21
  };
25
- exports.createModifyFastifyPlugin = createModifyFastifyPlugin;
22
+ exports.createModifyFastifyPlugin = createModifyFastifyPlugin;
23
+
24
+ //# sourceMappingURL=ModifyFastifyPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ModifyFastifyPlugin","Plugin","constructor","cb","modify","app","createModifyFastifyPlugin"],"sources":["ModifyFastifyPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { 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;AAOO,MAAMA,mBAAmB,SAASC,cAAM,CAAC;EAKrCC,WAAW,CAACC,EAA+B,EAAE;IAChD,KAAK,EAAE;IAAC;IACR,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAM,CAACC,GAAoB,EAAQ;IACtC,IAAI,CAACF,EAAE,CAACE,GAAG,CAAC;EAChB;AACJ;AAAC;AAAA,8BAbYL,mBAAmB,UACE,wBAAwB;AAcnD,MAAMM,yBAAyB,GAAIH,EAA+B,IAAK;EAC1E,OAAO,IAAIH,mBAAmB,CAACG,EAAE,CAAC;AACtC,CAAC;AAAC"}
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":[]}
@@ -0,0 +1,14 @@
1
+ import { Plugin } from "@webiny/plugins/Plugin";
2
+ import type { ResponseHeaders } from "../ResponseHeaders";
3
+ import type { Request } from "../types";
4
+ interface ModifyResponseHeadersCallable {
5
+ (request: Request, headers: ResponseHeaders): void;
6
+ }
7
+ export declare class ModifyResponseHeadersPlugin extends Plugin {
8
+ static type: string;
9
+ private readonly cb;
10
+ constructor(cb: ModifyResponseHeadersCallable);
11
+ modify(request: Request, headers: ResponseHeaders): void;
12
+ }
13
+ export declare function createModifyResponseHeaders(cb: ModifyResponseHeadersCallable): ModifyResponseHeadersPlugin;
14
+ export {};
@@ -0,0 +1,24 @@
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 {
10
+ static type = "handler.response.modifyHeaders";
11
+ constructor(cb) {
12
+ super();
13
+ this.cb = cb;
14
+ }
15
+ modify(request, headers) {
16
+ this.cb(request, headers);
17
+ }
18
+ }
19
+ exports.ModifyResponseHeadersPlugin = ModifyResponseHeadersPlugin;
20
+ function createModifyResponseHeaders(cb) {
21
+ return new ModifyResponseHeadersPlugin(cb);
22
+ }
23
+
24
+ //# sourceMappingURL=ModifyResponseHeadersPlugin.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * !!!!!!!!!!!!!!
3
+ * !!! DANGER !!!
4
+ * !!!!!!!!!!!!!!
5
+ *
6
+ * Using this plugin can cause slowdowns in your application response times.
7
+ * Also, if you do not return payload from the plugin callback, there will be nothing to send in the response.
8
+ */
9
+ import { Plugin } from "@webiny/plugins";
10
+ import type { Reply as FastifyReply, Request as FastifyRequest } from "../types.js";
11
+ export interface IOnResponseSendPluginCallable {
12
+ <T = unknown>(request: FastifyRequest, reply: FastifyReply, payload: T): Promise<T>;
13
+ }
14
+ /**
15
+ * @description Read info in the class file.
16
+ */
17
+ export declare class OnRequestResponseSendPlugin extends Plugin {
18
+ static type: string;
19
+ private readonly cb;
20
+ constructor(cb: IOnResponseSendPluginCallable);
21
+ exec<T = unknown>(request: FastifyRequest, reply: FastifyReply, payload: T): Promise<unknown>;
22
+ }
23
+ /**
24
+ * @description Read info in the class file.
25
+ */
26
+ export declare const createOnRequestResponseSend: (cb: IOnResponseSendPluginCallable) => OnRequestResponseSendPlugin;
@@ -0,0 +1,40 @@
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
+ /**
9
+ * !!!!!!!!!!!!!!
10
+ * !!! DANGER !!!
11
+ * !!!!!!!!!!!!!!
12
+ *
13
+ * Using this plugin can cause slowdowns in your application response times.
14
+ * Also, if you do not return payload from the plugin callback, there will be nothing to send in the response.
15
+ */
16
+
17
+ /**
18
+ * @description Read info in the class file.
19
+ */
20
+ class OnRequestResponseSendPlugin extends _plugins.Plugin {
21
+ static type = "handler.onRequestResponseSend";
22
+ constructor(cb) {
23
+ super();
24
+ this.cb = cb;
25
+ }
26
+ async exec(request, reply, payload) {
27
+ return await this.cb(request, reply, payload);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * @description Read info in the class file.
33
+ */
34
+ exports.OnRequestResponseSendPlugin = OnRequestResponseSendPlugin;
35
+ const createOnRequestResponseSend = cb => {
36
+ return new OnRequestResponseSendPlugin(cb);
37
+ };
38
+ exports.createOnRequestResponseSend = createOnRequestResponseSend;
39
+
40
+ //# sourceMappingURL=OnRequestResponseSendPlugin.js.map