@webiny/handler 0.0.0-unstable.9bd236cf5e → 0.0.0-unstable.9f53ea597d

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 (94) hide show
  1. package/Context.d.ts +1 -1
  2. package/Context.js +10 -31
  3. package/Context.js.map +1 -1
  4. package/PreHandler/IPreHandler.d.ts +1 -1
  5. package/PreHandler/IPreHandler.js +5 -10
  6. package/PreHandler/IPreHandler.js.map +1 -1
  7. package/PreHandler/IfNotOptionsRequest.d.ts +3 -3
  8. package/PreHandler/IfNotOptionsRequest.js +12 -22
  9. package/PreHandler/IfNotOptionsRequest.js.map +1 -1
  10. package/PreHandler/IfOptionsRequest.d.ts +3 -3
  11. package/PreHandler/IfOptionsRequest.js +12 -22
  12. package/PreHandler/IfOptionsRequest.js.map +1 -1
  13. package/PreHandler/PreHandler.d.ts +3 -3
  14. package/PreHandler/PreHandler.js +11 -19
  15. package/PreHandler/PreHandler.js.map +1 -1
  16. package/PreHandler/ProcessBeforeHandlerPlugins.d.ts +4 -4
  17. package/PreHandler/ProcessBeforeHandlerPlugins.js +20 -26
  18. package/PreHandler/ProcessBeforeHandlerPlugins.js.map +1 -1
  19. package/PreHandler/ProcessContextPlugins.d.ts +4 -4
  20. package/PreHandler/ProcessContextPlugins.js +20 -26
  21. package/PreHandler/ProcessContextPlugins.js.map +1 -1
  22. package/PreHandler/ProcessHandlerOnRequestPlugins.d.ts +4 -4
  23. package/PreHandler/ProcessHandlerOnRequestPlugins.js +19 -27
  24. package/PreHandler/ProcessHandlerOnRequestPlugins.js.map +1 -1
  25. package/PreHandler/RegisterExtensions.d.ts +10 -0
  26. package/PreHandler/RegisterExtensions.js +13 -0
  27. package/PreHandler/RegisterExtensions.js.map +1 -0
  28. package/PreHandler/SendEarlyOptionsResponse.d.ts +3 -3
  29. package/PreHandler/SendEarlyOptionsResponse.js +21 -33
  30. package/PreHandler/SendEarlyOptionsResponse.js.map +1 -1
  31. package/PreHandler/SetDefaultHeaders.d.ts +3 -3
  32. package/PreHandler/SetDefaultHeaders.js +39 -57
  33. package/PreHandler/SetDefaultHeaders.js.map +1 -1
  34. package/README.md +10 -14
  35. package/ResponseHeaders.d.ts +0 -1
  36. package/ResponseHeaders.js +28 -38
  37. package/ResponseHeaders.js.map +1 -1
  38. package/abstractions/Reply.d.ts +5 -0
  39. package/abstractions/Reply.js +5 -0
  40. package/abstractions/Reply.js.map +1 -0
  41. package/abstractions/Request.d.ts +5 -0
  42. package/abstractions/Request.js +5 -0
  43. package/abstractions/Request.js.map +1 -0
  44. package/abstractions/Route.d.ts +25 -0
  45. package/abstractions/Route.js +30 -0
  46. package/abstractions/Route.js.map +1 -0
  47. package/exports/api.d.ts +1 -0
  48. package/exports/api.js +1 -0
  49. package/fastify.d.ts +5 -4
  50. package/fastify.js +308 -388
  51. package/fastify.js.map +1 -1
  52. package/index.d.ts +17 -13
  53. package/index.js +19 -151
  54. package/package.json +23 -20
  55. package/plugins/BeforeHandlerPlugin.d.ts +1 -1
  56. package/plugins/BeforeHandlerPlugin.js +14 -23
  57. package/plugins/BeforeHandlerPlugin.js.map +1 -1
  58. package/plugins/EventPlugin.d.ts +3 -3
  59. package/plugins/EventPlugin.js +11 -27
  60. package/plugins/EventPlugin.js.map +1 -1
  61. package/plugins/HandlerErrorPlugin.d.ts +1 -1
  62. package/plugins/HandlerErrorPlugin.js +14 -21
  63. package/plugins/HandlerErrorPlugin.js.map +1 -1
  64. package/plugins/HandlerOnRequestPlugin.d.ts +1 -1
  65. package/plugins/HandlerOnRequestPlugin.js +14 -28
  66. package/plugins/HandlerOnRequestPlugin.js.map +1 -1
  67. package/plugins/HandlerResultPlugin.d.ts +1 -1
  68. package/plugins/HandlerResultPlugin.js +14 -21
  69. package/plugins/HandlerResultPlugin.js.map +1 -1
  70. package/plugins/ModifyFastifyPlugin.d.ts +1 -1
  71. package/plugins/ModifyFastifyPlugin.js +14 -21
  72. package/plugins/ModifyFastifyPlugin.js.map +1 -1
  73. package/plugins/ModifyResponseHeadersPlugin.d.ts +3 -3
  74. package/plugins/ModifyResponseHeadersPlugin.js +14 -19
  75. package/plugins/ModifyResponseHeadersPlugin.js.map +1 -1
  76. package/plugins/OnRequestResponseSendPlugin.js +14 -37
  77. package/plugins/OnRequestResponseSendPlugin.js.map +1 -1
  78. package/plugins/OnRequestTimeoutPlugin.js +14 -21
  79. package/plugins/OnRequestTimeoutPlugin.js.map +1 -1
  80. package/plugins/RegisterExtensionPlugin.d.ts +12 -0
  81. package/plugins/RegisterExtensionPlugin.js +16 -0
  82. package/plugins/RegisterExtensionPlugin.js.map +1 -0
  83. package/plugins/RoutePlugin.d.ts +2 -2
  84. package/plugins/RoutePlugin.js +11 -18
  85. package/plugins/RoutePlugin.js.map +1 -1
  86. package/stringifyError.js +12 -24
  87. package/stringifyError.js.map +1 -1
  88. package/suppressPunycodeWarnings.d.ts +1 -4
  89. package/suppressPunycodeWarnings.js +3 -7
  90. package/suppressPunycodeWarnings.js.map +1 -1
  91. package/types.d.ts +3 -3
  92. package/types.js +1 -15
  93. package/index.js.map +0 -1
  94. package/types.js.map +0 -1
package/Context.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ContextParams as BaseContextParams, ContextPluginCallable as BaseContextPluginCallable } from "@webiny/api";
2
2
  import { Context as BaseContext, ContextPlugin as BaseContextPlugin } from "@webiny/api";
3
- import type { Context as ContextInterface } from "./types";
3
+ import type { Context as ContextInterface } from "./types.js";
4
4
  export interface ContextParams extends BaseContextParams {
5
5
  routes: ContextInterface["routes"];
6
6
  }
package/Context.js CHANGED
@@ -1,34 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createContextPlugin = exports.ContextPlugin = exports.Context = void 0;
7
- var _api = require("@webiny/api");
8
- class Context extends _api.Context {
9
- // @ts-expect-error
10
-
11
- // @ts-expect-error
12
-
13
- // @ts-expect-error
14
-
15
- constructor(params) {
16
- super(params);
17
- this.routes = params.routes;
18
- }
1
+ import { Context, ContextPlugin, createContextPlugin } from "@webiny/api";
2
+ class Context_Context extends Context {
3
+ constructor(params){
4
+ super(params);
5
+ this.routes = params.routes;
6
+ }
19
7
  }
20
-
21
- /**
22
- * We need to extend and reexport the ContextPlugin, ContextPluginCallable and createContextPlugin to support extended context.
23
- *
24
- * This can be removed when we introduce the type augmentation.
25
- */
26
- exports.Context = Context;
27
- class ContextPlugin extends _api.ContextPlugin {}
28
- exports.ContextPlugin = ContextPlugin;
29
- const createContextPlugin = callable => {
30
- return (0, _api.createContextPlugin)(callable);
31
- };
32
- exports.createContextPlugin = createContextPlugin;
8
+ class Context_ContextPlugin extends ContextPlugin {
9
+ }
10
+ const Context_createContextPlugin = (callable)=>createContextPlugin(callable);
11
+ export { Context_Context as Context, Context_ContextPlugin as ContextPlugin, Context_createContextPlugin as createContextPlugin };
33
12
 
34
13
  //# sourceMappingURL=Context.js.map
package/Context.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_api","require","Context","BaseContext","constructor","params","routes","exports","ContextPlugin","BaseContextPlugin","createContextPlugin","callable","baseCreateContextPlugin"],"sources":["Context.ts"],"sourcesContent":["import type {\n ContextParams as BaseContextParams,\n ContextPluginCallable as BaseContextPluginCallable\n} from \"@webiny/api\";\nimport {\n Context as BaseContext,\n ContextPlugin as BaseContextPlugin,\n createContextPlugin as baseCreateContextPlugin\n} from \"@webiny/api\";\nimport type { Context as ContextInterface } from \"~/types\";\n\nexport interface ContextParams extends BaseContextParams {\n routes: ContextInterface[\"routes\"];\n}\n\nexport class Context extends BaseContext implements ContextInterface {\n public readonly routes: ContextInterface[\"routes\"];\n // @ts-expect-error\n public handlerClient: ContextInterface[\"handlerClient\"];\n // @ts-expect-error\n public request: ContextInterface[\"request\"];\n // @ts-expect-error\n public reply: ContextInterface[\"reply\"];\n\n public constructor(params: ContextParams) {\n super(params);\n this.routes = params.routes;\n }\n}\n\n/**\n * We need to extend and reexport the ContextPlugin, ContextPluginCallable and createContextPlugin to support extended context.\n *\n * This can be removed when we introduce the type augmentation.\n */\nexport type ContextPluginCallable<T extends ContextInterface = ContextInterface> =\n BaseContextPluginCallable<T>;\n\nexport class ContextPlugin<\n T extends ContextInterface = ContextInterface\n> extends BaseContextPlugin<T> {}\n\nexport const createContextPlugin = <T extends ContextInterface = ContextInterface>(\n callable: ContextPluginCallable<T>\n) => {\n return baseCreateContextPlugin<T>(callable);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,IAAA,GAAAC,OAAA;AAWO,MAAMC,OAAO,SAASC,YAAW,CAA6B;EAEjE;;EAEA;;EAEA;;EAGOC,WAAWA,CAACC,MAAqB,EAAE;IACtC,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;AACJ;;AAEA;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAL,OAAA,GAAAA,OAAA;AAQO,MAAMM,aAAa,SAEhBC,kBAAiB,CAAI;AAAEF,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAE1B,MAAME,mBAAmB,GAC5BC,QAAkC,IACjC;EACD,OAAO,IAAAC,wBAAuB,EAAID,QAAQ,CAAC;AAC/C,CAAC;AAACJ,OAAA,CAAAG,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Context.js","sources":["../src/Context.ts"],"sourcesContent":["import type {\n ContextParams as BaseContextParams,\n ContextPluginCallable as BaseContextPluginCallable\n} from \"@webiny/api\";\nimport {\n Context as BaseContext,\n ContextPlugin as BaseContextPlugin,\n createContextPlugin as baseCreateContextPlugin\n} from \"@webiny/api\";\nimport type { Context as ContextInterface } from \"~/types.js\";\n\nexport interface ContextParams extends BaseContextParams {\n routes: ContextInterface[\"routes\"];\n}\n\nexport class Context extends BaseContext implements ContextInterface {\n public readonly routes: ContextInterface[\"routes\"];\n // @ts-expect-error\n public handlerClient: ContextInterface[\"handlerClient\"];\n // @ts-expect-error\n public request: ContextInterface[\"request\"];\n // @ts-expect-error\n public reply: ContextInterface[\"reply\"];\n\n public constructor(params: ContextParams) {\n super(params);\n this.routes = params.routes;\n }\n}\n\n/**\n * We need to extend and reexport the ContextPlugin, ContextPluginCallable and createContextPlugin to support extended context.\n *\n * This can be removed when we introduce the type augmentation.\n */\nexport type ContextPluginCallable<T extends ContextInterface = ContextInterface> =\n BaseContextPluginCallable<T>;\n\nexport class ContextPlugin<\n T extends ContextInterface = ContextInterface\n> extends BaseContextPlugin<T> {}\n\nexport const createContextPlugin = <T extends ContextInterface = ContextInterface>(\n callable: ContextPluginCallable<T>\n) => {\n return baseCreateContextPlugin<T>(callable);\n};\n"],"names":["Context","BaseContext","params","ContextPlugin","BaseContextPlugin","createContextPlugin","callable","baseCreateContextPlugin"],"mappings":";AAeO,MAAMA,wBAAgBC;IASzB,YAAmBC,MAAqB,CAAE;QACtC,KAAK,CAACA;QACN,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;AACJ;AAUO,MAAMC,8BAEHC;AAAsB;AAEzB,MAAMC,8BAAsB,CAC/BC,WAEOC,oBAA2BD"}
@@ -1,5 +1,5 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { Context } from "../types";
2
+ import type { Context } from "../types.js";
3
3
  export declare enum Action {
4
4
  CONTINUE = "continue",
5
5
  DONE = "done"
@@ -1,13 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Action = void 0;
7
- let Action = exports.Action = /*#__PURE__*/function (Action) {
8
- Action["CONTINUE"] = "continue";
9
- Action["DONE"] = "done";
10
- return Action;
1
+ var IPreHandler_Action = /*#__PURE__*/ function(Action) {
2
+ Action["CONTINUE"] = "continue";
3
+ Action["DONE"] = "done";
4
+ return Action;
11
5
  }({});
6
+ export { IPreHandler_Action as Action };
12
7
 
13
8
  //# sourceMappingURL=IPreHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Action","exports"],"sources":["IPreHandler.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { Context } from \"~/types\";\n\nexport enum Action {\n CONTINUE = \"continue\",\n DONE = \"done\"\n}\n\nexport interface IPreHandler {\n execute(\n request: FastifyRequest,\n reply: FastifyReply,\n context: Context\n ): Promise<Action> | Action;\n}\n"],"mappings":";;;;;;IAGYA,MAAM,GAAAC,OAAA,CAAAD,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/IPreHandler.js","sources":["../../src/PreHandler/IPreHandler.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { Context } from \"~/types.js\";\n\nexport enum Action {\n CONTINUE = \"continue\",\n DONE = \"done\"\n}\n\nexport interface IPreHandler {\n execute(\n request: FastifyRequest,\n reply: FastifyReply,\n context: Context\n ): Promise<Action> | Action;\n}\n"],"names":["Action"],"mappings":"AAGO,IAAKA,qBAAMA,WAAAA,GAAAA,SAANA,MAAM;;;WAANA"}
@@ -1,7 +1,7 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { IPreHandler } from "./IPreHandler";
3
- import { Action } from "./IPreHandler";
4
- import type { Context } from "../types";
2
+ import type { IPreHandler } from "./IPreHandler.js";
3
+ import { Action } from "./IPreHandler.js";
4
+ import type { Context } from "../types.js";
5
5
  export declare class IfNotOptionsRequest implements IPreHandler {
6
6
  private readonly handlers;
7
7
  constructor(handlers: IPreHandler[]);
@@ -1,28 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.IfNotOptionsRequest = void 0;
7
- var _IPreHandler = require("./IPreHandler");
1
+ import { Action } from "./IPreHandler.js";
8
2
  class IfNotOptionsRequest {
9
- constructor(handlers) {
10
- this.handlers = handlers;
11
- }
12
- async execute(request, reply, context) {
13
- const isOptionsRequest = request.method === "OPTIONS";
14
- if (isOptionsRequest) {
15
- return _IPreHandler.Action.CONTINUE;
3
+ constructor(handlers){
4
+ this.handlers = handlers;
16
5
  }
17
- for (const handler of this.handlers) {
18
- const action = await handler.execute(request, reply, context);
19
- if (action === _IPreHandler.Action.DONE) {
20
- return _IPreHandler.Action.DONE;
21
- }
6
+ async execute(request, reply, context) {
7
+ const isOptionsRequest = "OPTIONS" === request.method;
8
+ if (isOptionsRequest) return Action.CONTINUE;
9
+ for (const handler of this.handlers){
10
+ const action = await handler.execute(request, reply, context);
11
+ if (action === Action.DONE) return Action.DONE;
12
+ }
13
+ return Action.CONTINUE;
22
14
  }
23
- return _IPreHandler.Action.CONTINUE;
24
- }
25
15
  }
26
- exports.IfNotOptionsRequest = IfNotOptionsRequest;
16
+ export { IfNotOptionsRequest };
27
17
 
28
18
  //# sourceMappingURL=IfNotOptionsRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_IPreHandler","require","IfNotOptionsRequest","constructor","handlers","execute","request","reply","context","isOptionsRequest","method","Action","CONTINUE","handler","action","DONE","exports"],"sources":["IfNotOptionsRequest.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"./IPreHandler\";\nimport { Action } from \"./IPreHandler\";\nimport type { Context } from \"~/types\";\n\nexport class IfNotOptionsRequest implements IPreHandler {\n private readonly handlers: IPreHandler[];\n\n constructor(handlers: IPreHandler[]) {\n this.handlers = handlers;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n const isOptionsRequest = request.method === \"OPTIONS\";\n if (isOptionsRequest) {\n return Action.CONTINUE;\n }\n\n for (const handler of this.handlers) {\n const action = await handler.execute(request, reply, context);\n if (action === Action.DONE) {\n return Action.DONE;\n }\n }\n\n return Action.CONTINUE;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAGO,MAAMC,mBAAmB,CAAwB;EAGpDC,WAAWA,CAACC,QAAuB,EAAE;IACjC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,OAAOA,CAACC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;IAC3F,MAAMC,gBAAgB,GAAGH,OAAO,CAACI,MAAM,KAAK,SAAS;IACrD,IAAID,gBAAgB,EAAE;MAClB,OAAOE,mBAAM,CAACC,QAAQ;IAC1B;IAEA,KAAK,MAAMC,OAAO,IAAI,IAAI,CAACT,QAAQ,EAAE;MACjC,MAAMU,MAAM,GAAG,MAAMD,OAAO,CAACR,OAAO,CAACC,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;MAC7D,IAAIM,MAAM,KAAKH,mBAAM,CAACI,IAAI,EAAE;QACxB,OAAOJ,mBAAM,CAACI,IAAI;MACtB;IACJ;IAEA,OAAOJ,mBAAM,CAACC,QAAQ;EAC1B;AACJ;AAACI,OAAA,CAAAd,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/IfNotOptionsRequest.js","sources":["../../src/PreHandler/IfNotOptionsRequest.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"./IPreHandler.js\";\nimport { Action } from \"./IPreHandler.js\";\nimport type { Context } from \"~/types.js\";\n\nexport class IfNotOptionsRequest implements IPreHandler {\n private readonly handlers: IPreHandler[];\n\n constructor(handlers: IPreHandler[]) {\n this.handlers = handlers;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n const isOptionsRequest = request.method === \"OPTIONS\";\n if (isOptionsRequest) {\n return Action.CONTINUE;\n }\n\n for (const handler of this.handlers) {\n const action = await handler.execute(request, reply, context);\n if (action === Action.DONE) {\n return Action.DONE;\n }\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["IfNotOptionsRequest","handlers","request","reply","context","isOptionsRequest","Action","handler","action"],"mappings":";AAKO,MAAMA;IAGT,YAAYC,QAAuB,CAAE;QACjC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,QAAQC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;QAC3F,MAAMC,mBAAmBH,AAAmB,cAAnBA,QAAQ,MAAM;QACvC,IAAIG,kBACA,OAAOC,OAAO,QAAQ;QAG1B,KAAK,MAAMC,WAAW,IAAI,CAAC,QAAQ,CAAE;YACjC,MAAMC,SAAS,MAAMD,QAAQ,OAAO,CAACL,SAASC,OAAOC;YACrD,IAAII,WAAWF,OAAO,IAAI,EACtB,OAAOA,OAAO,IAAI;QAE1B;QAEA,OAAOA,OAAO,QAAQ;IAC1B;AACJ"}
@@ -1,7 +1,7 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { IPreHandler } from "./IPreHandler";
3
- import { Action } from "./IPreHandler";
4
- import type { Context } from "../types";
2
+ import type { IPreHandler } from "./IPreHandler.js";
3
+ import { Action } from "./IPreHandler.js";
4
+ import type { Context } from "../types.js";
5
5
  export declare class IfOptionsRequest implements IPreHandler {
6
6
  private readonly handlers;
7
7
  constructor(handlers: IPreHandler[]);
@@ -1,28 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.IfOptionsRequest = void 0;
7
- var _IPreHandler = require("./IPreHandler");
1
+ import { Action } from "./IPreHandler.js";
8
2
  class IfOptionsRequest {
9
- constructor(handlers) {
10
- this.handlers = handlers;
11
- }
12
- async execute(request, reply, context) {
13
- const isOptionsRequest = request.method === "OPTIONS";
14
- if (!isOptionsRequest) {
15
- return _IPreHandler.Action.CONTINUE;
3
+ constructor(handlers){
4
+ this.handlers = handlers;
16
5
  }
17
- for (const handler of this.handlers) {
18
- const action = await handler.execute(request, reply, context);
19
- if (action === _IPreHandler.Action.DONE) {
20
- return _IPreHandler.Action.DONE;
21
- }
6
+ async execute(request, reply, context) {
7
+ const isOptionsRequest = "OPTIONS" === request.method;
8
+ if (!isOptionsRequest) return Action.CONTINUE;
9
+ for (const handler of this.handlers){
10
+ const action = await handler.execute(request, reply, context);
11
+ if (action === Action.DONE) return Action.DONE;
12
+ }
13
+ return Action.CONTINUE;
22
14
  }
23
- return _IPreHandler.Action.CONTINUE;
24
- }
25
15
  }
26
- exports.IfOptionsRequest = IfOptionsRequest;
16
+ export { IfOptionsRequest };
27
17
 
28
18
  //# sourceMappingURL=IfOptionsRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_IPreHandler","require","IfOptionsRequest","constructor","handlers","execute","request","reply","context","isOptionsRequest","method","Action","CONTINUE","handler","action","DONE","exports"],"sources":["IfOptionsRequest.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"./IPreHandler\";\nimport { Action } from \"./IPreHandler\";\nimport type { Context } from \"~/types\";\n\nexport class IfOptionsRequest implements IPreHandler {\n private readonly handlers: IPreHandler[];\n\n constructor(handlers: IPreHandler[]) {\n this.handlers = handlers;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n const isOptionsRequest = request.method === \"OPTIONS\";\n if (!isOptionsRequest) {\n return Action.CONTINUE;\n }\n\n for (const handler of this.handlers) {\n const action = await handler.execute(request, reply, context);\n if (action === Action.DONE) {\n return Action.DONE;\n }\n }\n\n return Action.CONTINUE;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAGO,MAAMC,gBAAgB,CAAwB;EAGjDC,WAAWA,CAACC,QAAuB,EAAE;IACjC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,OAAOA,CAACC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;IAC3F,MAAMC,gBAAgB,GAAGH,OAAO,CAACI,MAAM,KAAK,SAAS;IACrD,IAAI,CAACD,gBAAgB,EAAE;MACnB,OAAOE,mBAAM,CAACC,QAAQ;IAC1B;IAEA,KAAK,MAAMC,OAAO,IAAI,IAAI,CAACT,QAAQ,EAAE;MACjC,MAAMU,MAAM,GAAG,MAAMD,OAAO,CAACR,OAAO,CAACC,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;MAC7D,IAAIM,MAAM,KAAKH,mBAAM,CAACI,IAAI,EAAE;QACxB,OAAOJ,mBAAM,CAACI,IAAI;MACtB;IACJ;IAEA,OAAOJ,mBAAM,CAACC,QAAQ;EAC1B;AACJ;AAACI,OAAA,CAAAd,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/IfOptionsRequest.js","sources":["../../src/PreHandler/IfOptionsRequest.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"./IPreHandler.js\";\nimport { Action } from \"./IPreHandler.js\";\nimport type { Context } from \"~/types.js\";\n\nexport class IfOptionsRequest implements IPreHandler {\n private readonly handlers: IPreHandler[];\n\n constructor(handlers: IPreHandler[]) {\n this.handlers = handlers;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n const isOptionsRequest = request.method === \"OPTIONS\";\n if (!isOptionsRequest) {\n return Action.CONTINUE;\n }\n\n for (const handler of this.handlers) {\n const action = await handler.execute(request, reply, context);\n if (action === Action.DONE) {\n return Action.DONE;\n }\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["IfOptionsRequest","handlers","request","reply","context","isOptionsRequest","Action","handler","action"],"mappings":";AAKO,MAAMA;IAGT,YAAYC,QAAuB,CAAE;QACjC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,QAAQC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;QAC3F,MAAMC,mBAAmBH,AAAmB,cAAnBA,QAAQ,MAAM;QACvC,IAAI,CAACG,kBACD,OAAOC,OAAO,QAAQ;QAG1B,KAAK,MAAMC,WAAW,IAAI,CAAC,QAAQ,CAAE;YACjC,MAAMC,SAAS,MAAMD,QAAQ,OAAO,CAACL,SAASC,OAAOC;YACrD,IAAII,WAAWF,OAAO,IAAI,EACtB,OAAOA,OAAO,IAAI;QAE1B;QAEA,OAAOA,OAAO,QAAQ;IAC1B;AACJ"}
@@ -1,7 +1,7 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { IPreHandler } from "./IPreHandler";
3
- import { Action } from "./IPreHandler";
4
- import type { Context } from "../types";
2
+ import type { IPreHandler } from "../PreHandler/IPreHandler.js";
3
+ import { Action } from "../PreHandler/IPreHandler.js";
4
+ import type { Context } from "../types.js";
5
5
  export declare class PreHandler implements IPreHandler {
6
6
  private readonly handlers;
7
7
  constructor(handlers: IPreHandler[]);
@@ -1,24 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PreHandler = void 0;
7
- var _IPreHandler = require("./IPreHandler");
1
+ import { Action } from "./IPreHandler.js";
8
2
  class PreHandler {
9
- constructor(handlers) {
10
- this.handlers = handlers;
11
- }
12
- async execute(request, reply, context) {
13
- for (const handler of this.handlers) {
14
- const action = await handler.execute(request, reply, context);
15
- if (action === _IPreHandler.Action.DONE) {
16
- return _IPreHandler.Action.DONE;
17
- }
3
+ constructor(handlers){
4
+ this.handlers = handlers;
5
+ }
6
+ async execute(request, reply, context) {
7
+ for (const handler of this.handlers){
8
+ const action = await handler.execute(request, reply, context);
9
+ if (action === Action.DONE) return Action.DONE;
10
+ }
11
+ return Action.CONTINUE;
18
12
  }
19
- return _IPreHandler.Action.CONTINUE;
20
- }
21
13
  }
22
- exports.PreHandler = PreHandler;
14
+ export { PreHandler };
23
15
 
24
16
  //# sourceMappingURL=PreHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_IPreHandler","require","PreHandler","constructor","handlers","execute","request","reply","context","handler","action","Action","DONE","CONTINUE","exports"],"sources":["PreHandler.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"~/PreHandler/IPreHandler\";\nimport { Action } from \"~/PreHandler/IPreHandler\";\nimport type { Context } from \"~/types\";\n\nexport class PreHandler implements IPreHandler {\n private readonly handlers: IPreHandler[];\n\n constructor(handlers: IPreHandler[]) {\n this.handlers = handlers;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n for (const handler of this.handlers) {\n const action = await handler.execute(request, reply, context);\n if (action === Action.DONE) {\n return Action.DONE;\n }\n }\n\n return Action.CONTINUE;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAGO,MAAMC,UAAU,CAAwB;EAG3CC,WAAWA,CAACC,QAAuB,EAAE;IACjC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,OAAOA,CAACC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;IAC3F,KAAK,MAAMC,OAAO,IAAI,IAAI,CAACL,QAAQ,EAAE;MACjC,MAAMM,MAAM,GAAG,MAAMD,OAAO,CAACJ,OAAO,CAACC,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;MAC7D,IAAIE,MAAM,KAAKC,mBAAM,CAACC,IAAI,EAAE;QACxB,OAAOD,mBAAM,CAACC,IAAI;MACtB;IACJ;IAEA,OAAOD,mBAAM,CAACE,QAAQ;EAC1B;AACJ;AAACC,OAAA,CAAAZ,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/PreHandler.js","sources":["../../src/PreHandler/PreHandler.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"~/PreHandler/IPreHandler.js\";\nimport { Action } from \"~/PreHandler/IPreHandler.js\";\nimport type { Context } from \"~/types.js\";\n\nexport class PreHandler implements IPreHandler {\n private readonly handlers: IPreHandler[];\n\n constructor(handlers: IPreHandler[]) {\n this.handlers = handlers;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n for (const handler of this.handlers) {\n const action = await handler.execute(request, reply, context);\n if (action === Action.DONE) {\n return Action.DONE;\n }\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["PreHandler","handlers","request","reply","context","handler","action","Action"],"mappings":";AAKO,MAAMA;IAGT,YAAYC,QAAuB,CAAE;QACjC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,QAAQC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;QAC3F,KAAK,MAAMC,WAAW,IAAI,CAAC,QAAQ,CAAE;YACjC,MAAMC,SAAS,MAAMD,QAAQ,OAAO,CAACH,SAASC,OAAOC;YACrD,IAAIE,WAAWC,OAAO,IAAI,EACtB,OAAOA,OAAO,IAAI;QAE1B;QAEA,OAAOA,OAAO,QAAQ;IAC1B;AACJ"}
@@ -1,7 +1,7 @@
1
- import type { IPreHandler } from "./IPreHandler";
2
- import { Action } from "./IPreHandler";
3
- import type { Context } from "../types";
4
- import type { BeforeHandlerPlugin } from "../plugins/BeforeHandlerPlugin";
1
+ import type { IPreHandler } from "../PreHandler/IPreHandler.js";
2
+ import { Action } from "../PreHandler/IPreHandler.js";
3
+ import type { Context } from "../types.js";
4
+ import type { BeforeHandlerPlugin } from "../plugins/BeforeHandlerPlugin.js";
5
5
  export declare class ProcessBeforeHandlerPlugins implements IPreHandler {
6
6
  private readonly plugins;
7
7
  private readonly context;
@@ -1,31 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ProcessBeforeHandlerPlugins = void 0;
7
- var _IPreHandler = require("./IPreHandler");
8
- var _stringifyError = require("../stringifyError");
1
+ import { Action } from "./IPreHandler.js";
2
+ import { stringifyError } from "../stringifyError.js";
9
3
  class ProcessBeforeHandlerPlugins {
10
- constructor(context, plugins) {
11
- this.context = context;
12
- this.plugins = plugins;
13
- }
14
- async execute() {
15
- let name;
16
- try {
17
- for (const plugin of this.plugins) {
18
- name = plugin.name;
19
- await plugin.apply(this.context);
20
- }
21
- } catch (ex) {
22
- console.error(`Error running BeforeHandlerPlugin "${name}".`);
23
- console.error((0, _stringifyError.stringifyError)(ex));
24
- throw ex;
4
+ constructor(context, plugins){
5
+ this.context = context;
6
+ this.plugins = plugins;
7
+ }
8
+ async execute() {
9
+ let name;
10
+ try {
11
+ for (const plugin of this.plugins){
12
+ name = plugin.name;
13
+ await plugin.apply(this.context);
14
+ }
15
+ } catch (ex) {
16
+ console.error(`Error running BeforeHandlerPlugin "${name}".`);
17
+ console.error(stringifyError(ex));
18
+ throw ex;
19
+ }
20
+ return Action.CONTINUE;
25
21
  }
26
- return _IPreHandler.Action.CONTINUE;
27
- }
28
22
  }
29
- exports.ProcessBeforeHandlerPlugins = ProcessBeforeHandlerPlugins;
23
+ export { ProcessBeforeHandlerPlugins };
30
24
 
31
25
  //# sourceMappingURL=ProcessBeforeHandlerPlugins.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_IPreHandler","require","_stringifyError","ProcessBeforeHandlerPlugins","constructor","context","plugins","execute","name","plugin","apply","ex","console","error","stringifyError","Action","CONTINUE","exports"],"sources":["ProcessBeforeHandlerPlugins.ts"],"sourcesContent":["import type { IPreHandler } from \"~/PreHandler/IPreHandler\";\nimport { Action } from \"~/PreHandler/IPreHandler\";\nimport { stringifyError } from \"~/stringifyError\";\nimport type { Context } from \"~/types\";\nimport type { BeforeHandlerPlugin } from \"~/plugins/BeforeHandlerPlugin\";\n\nexport class ProcessBeforeHandlerPlugins implements IPreHandler {\n private readonly plugins: BeforeHandlerPlugin[];\n private readonly context: Context;\n\n constructor(context: Context, plugins: BeforeHandlerPlugin[]) {\n this.context = context;\n this.plugins = plugins;\n }\n\n async execute(): Promise<Action> {\n let name: string | undefined;\n try {\n for (const plugin of this.plugins) {\n name = plugin.name;\n await plugin.apply(this.context);\n }\n } catch (ex) {\n console.error(`Error running BeforeHandlerPlugin \"${name}\".`);\n console.error(stringifyError(ex));\n throw ex;\n }\n\n return Action.CONTINUE;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAIO,MAAME,2BAA2B,CAAwB;EAI5DC,WAAWA,CAACC,OAAgB,EAAEC,OAA8B,EAAE;IAC1D,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMC,OAAOA,CAAA,EAAoB;IAC7B,IAAIC,IAAwB;IAC5B,IAAI;MACA,KAAK,MAAMC,MAAM,IAAI,IAAI,CAACH,OAAO,EAAE;QAC/BE,IAAI,GAAGC,MAAM,CAACD,IAAI;QAClB,MAAMC,MAAM,CAACC,KAAK,CAAC,IAAI,CAACL,OAAO,CAAC;MACpC;IACJ,CAAC,CAAC,OAAOM,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CAAC,sCAAsCL,IAAI,IAAI,CAAC;MAC7DI,OAAO,CAACC,KAAK,CAAC,IAAAC,8BAAc,EAACH,EAAE,CAAC,CAAC;MACjC,MAAMA,EAAE;IACZ;IAEA,OAAOI,mBAAM,CAACC,QAAQ;EAC1B;AACJ;AAACC,OAAA,CAAAd,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/ProcessBeforeHandlerPlugins.js","sources":["../../src/PreHandler/ProcessBeforeHandlerPlugins.ts"],"sourcesContent":["import type { IPreHandler } from \"~/PreHandler/IPreHandler.js\";\nimport { Action } from \"~/PreHandler/IPreHandler.js\";\nimport { stringifyError } from \"~/stringifyError.js\";\nimport type { Context } from \"~/types.js\";\nimport type { BeforeHandlerPlugin } from \"~/plugins/BeforeHandlerPlugin.js\";\n\nexport class ProcessBeforeHandlerPlugins implements IPreHandler {\n private readonly plugins: BeforeHandlerPlugin[];\n private readonly context: Context;\n\n constructor(context: Context, plugins: BeforeHandlerPlugin[]) {\n this.context = context;\n this.plugins = plugins;\n }\n\n async execute(): Promise<Action> {\n let name: string | undefined;\n try {\n for (const plugin of this.plugins) {\n name = plugin.name;\n await plugin.apply(this.context);\n }\n } catch (ex) {\n console.error(`Error running BeforeHandlerPlugin \"${name}\".`);\n console.error(stringifyError(ex));\n throw ex;\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["ProcessBeforeHandlerPlugins","context","plugins","name","plugin","ex","console","stringifyError","Action"],"mappings":";;AAMO,MAAMA;IAIT,YAAYC,OAAgB,EAAEC,OAA8B,CAAE;QAC1D,IAAI,CAAC,OAAO,GAAGD;QACf,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,MAAM,UAA2B;QAC7B,IAAIC;QACJ,IAAI;YACA,KAAK,MAAMC,UAAU,IAAI,CAAC,OAAO,CAAE;gBAC/BD,OAAOC,OAAO,IAAI;gBAClB,MAAMA,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO;YACnC;QACJ,EAAE,OAAOC,IAAI;YACTC,QAAQ,KAAK,CAAC,CAAC,mCAAmC,EAAEH,KAAK,EAAE,CAAC;YAC5DG,QAAQ,KAAK,CAACC,eAAeF;YAC7B,MAAMA;QACV;QAEA,OAAOG,OAAO,QAAQ;IAC1B;AACJ"}
@@ -1,7 +1,7 @@
1
- import type { IPreHandler } from "./IPreHandler";
2
- import { Action } from "./IPreHandler";
3
- import type { ContextPlugin } from "../Context";
4
- import type { Context } from "../types";
1
+ import type { IPreHandler } from "../PreHandler/IPreHandler.js";
2
+ import { Action } from "../PreHandler/IPreHandler.js";
3
+ import type { ContextPlugin } from "../Context.js";
4
+ import type { Context } from "../types.js";
5
5
  export declare class ProcessContextPlugins implements IPreHandler {
6
6
  private readonly plugins;
7
7
  private readonly context;
@@ -1,31 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ProcessContextPlugins = void 0;
7
- var _IPreHandler = require("./IPreHandler");
8
- var _stringifyError = require("../stringifyError");
1
+ import { Action } from "./IPreHandler.js";
2
+ import { stringifyError } from "../stringifyError.js";
9
3
  class ProcessContextPlugins {
10
- constructor(context, plugins) {
11
- this.context = context;
12
- this.plugins = plugins;
13
- }
14
- async execute() {
15
- let name;
16
- try {
17
- for (const plugin of this.plugins) {
18
- name = plugin.name;
19
- await plugin.apply(this.context);
20
- }
21
- } catch (ex) {
22
- console.error(`Error running ContextPlugin "${name}".`);
23
- console.error((0, _stringifyError.stringifyError)(ex));
24
- throw ex;
4
+ constructor(context, plugins){
5
+ this.context = context;
6
+ this.plugins = plugins;
7
+ }
8
+ async execute() {
9
+ let name;
10
+ try {
11
+ for (const plugin of this.plugins){
12
+ name = plugin.name;
13
+ await plugin.apply(this.context);
14
+ }
15
+ } catch (ex) {
16
+ console.error(`Error running ContextPlugin "${name}".`);
17
+ console.error(stringifyError(ex));
18
+ throw ex;
19
+ }
20
+ return Action.CONTINUE;
25
21
  }
26
- return _IPreHandler.Action.CONTINUE;
27
- }
28
22
  }
29
- exports.ProcessContextPlugins = ProcessContextPlugins;
23
+ export { ProcessContextPlugins };
30
24
 
31
25
  //# sourceMappingURL=ProcessContextPlugins.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_IPreHandler","require","_stringifyError","ProcessContextPlugins","constructor","context","plugins","execute","name","plugin","apply","ex","console","error","stringifyError","Action","CONTINUE","exports"],"sources":["ProcessContextPlugins.ts"],"sourcesContent":["import type { IPreHandler } from \"~/PreHandler/IPreHandler\";\nimport { Action } from \"~/PreHandler/IPreHandler\";\nimport { stringifyError } from \"~/stringifyError\";\nimport type { ContextPlugin } from \"~/Context\";\nimport type { Context } from \"~/types\";\n\nexport class ProcessContextPlugins implements IPreHandler {\n private readonly plugins: ContextPlugin[];\n private readonly context: Context;\n\n constructor(context: Context, plugins: ContextPlugin[]) {\n this.context = context;\n this.plugins = plugins;\n }\n\n async execute(): Promise<Action> {\n let name: string | undefined;\n try {\n for (const plugin of this.plugins) {\n name = plugin.name;\n await plugin.apply(this.context);\n }\n } catch (ex) {\n console.error(`Error running ContextPlugin \"${name}\".`);\n console.error(stringifyError(ex));\n throw ex;\n }\n\n return Action.CONTINUE;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAIO,MAAME,qBAAqB,CAAwB;EAItDC,WAAWA,CAACC,OAAgB,EAAEC,OAAwB,EAAE;IACpD,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMC,OAAOA,CAAA,EAAoB;IAC7B,IAAIC,IAAwB;IAC5B,IAAI;MACA,KAAK,MAAMC,MAAM,IAAI,IAAI,CAACH,OAAO,EAAE;QAC/BE,IAAI,GAAGC,MAAM,CAACD,IAAI;QAClB,MAAMC,MAAM,CAACC,KAAK,CAAC,IAAI,CAACL,OAAO,CAAC;MACpC;IACJ,CAAC,CAAC,OAAOM,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CAAC,gCAAgCL,IAAI,IAAI,CAAC;MACvDI,OAAO,CAACC,KAAK,CAAC,IAAAC,8BAAc,EAACH,EAAE,CAAC,CAAC;MACjC,MAAMA,EAAE;IACZ;IAEA,OAAOI,mBAAM,CAACC,QAAQ;EAC1B;AACJ;AAACC,OAAA,CAAAd,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/ProcessContextPlugins.js","sources":["../../src/PreHandler/ProcessContextPlugins.ts"],"sourcesContent":["import type { IPreHandler } from \"~/PreHandler/IPreHandler.js\";\nimport { Action } from \"~/PreHandler/IPreHandler.js\";\nimport { stringifyError } from \"~/stringifyError.js\";\nimport type { ContextPlugin } from \"~/Context.js\";\nimport type { Context } from \"~/types.js\";\n\nexport class ProcessContextPlugins implements IPreHandler {\n private readonly plugins: ContextPlugin[];\n private readonly context: Context;\n\n constructor(context: Context, plugins: ContextPlugin[]) {\n this.context = context;\n this.plugins = plugins;\n }\n\n async execute(): Promise<Action> {\n let name: string | undefined;\n try {\n for (const plugin of this.plugins) {\n name = plugin.name;\n await plugin.apply(this.context);\n }\n } catch (ex) {\n console.error(`Error running ContextPlugin \"${name}\".`);\n console.error(stringifyError(ex));\n throw ex;\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["ProcessContextPlugins","context","plugins","name","plugin","ex","console","stringifyError","Action"],"mappings":";;AAMO,MAAMA;IAIT,YAAYC,OAAgB,EAAEC,OAAwB,CAAE;QACpD,IAAI,CAAC,OAAO,GAAGD;QACf,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,MAAM,UAA2B;QAC7B,IAAIC;QACJ,IAAI;YACA,KAAK,MAAMC,UAAU,IAAI,CAAC,OAAO,CAAE;gBAC/BD,OAAOC,OAAO,IAAI;gBAClB,MAAMA,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO;YACnC;QACJ,EAAE,OAAOC,IAAI;YACTC,QAAQ,KAAK,CAAC,CAAC,6BAA6B,EAAEH,KAAK,EAAE,CAAC;YACtDG,QAAQ,KAAK,CAACC,eAAeF;YAC7B,MAAMA;QACV;QAEA,OAAOG,OAAO,QAAQ;IAC1B;AACJ"}
@@ -1,8 +1,8 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { IPreHandler } from "./IPreHandler";
3
- import { Action } from "./IPreHandler";
4
- import type { HandlerOnRequestPlugin } from "../plugins/HandlerOnRequestPlugin";
5
- import type { Context } from "../types";
2
+ import type { IPreHandler } from "../PreHandler/IPreHandler.js";
3
+ import { Action } from "../PreHandler/IPreHandler.js";
4
+ import type { HandlerOnRequestPlugin } from "../plugins/HandlerOnRequestPlugin.js";
5
+ import type { Context } from "../types.js";
6
6
  export declare class ProcessHandlerOnRequestPlugins implements IPreHandler {
7
7
  private readonly plugins;
8
8
  constructor(plugins: HandlerOnRequestPlugin[]);
@@ -1,33 +1,25 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ProcessHandlerOnRequestPlugins = void 0;
7
- var _IPreHandler = require("./IPreHandler");
8
- var _stringifyError = require("../stringifyError");
1
+ import { Action } from "./IPreHandler.js";
2
+ import { stringifyError } from "../stringifyError.js";
9
3
  class ProcessHandlerOnRequestPlugins {
10
- constructor(plugins) {
11
- this.plugins = plugins;
12
- }
13
- async execute(request, reply, context) {
14
- let name;
15
- try {
16
- for (const plugin of this.plugins) {
17
- name = plugin.name;
18
- const result = await plugin.exec(request, reply, context);
19
- if (result === false) {
20
- return _IPreHandler.Action.DONE;
4
+ constructor(plugins){
5
+ this.plugins = plugins;
6
+ }
7
+ async execute(request, reply, context) {
8
+ let name;
9
+ try {
10
+ for (const plugin of this.plugins){
11
+ name = plugin.name;
12
+ const result = await plugin.exec(request, reply, context);
13
+ if (false === result) return Action.DONE;
14
+ }
15
+ } catch (ex) {
16
+ console.error(`Error while running the "HandlerOnRequestPlugin" ${name ? `(${name})` : ""} plugin in the onRequest hook.`);
17
+ console.error(stringifyError(ex));
18
+ throw ex;
21
19
  }
22
- }
23
- } catch (ex) {
24
- console.error(`Error while running the "HandlerOnRequestPlugin" ${name ? `(${name})` : ""} plugin in the onRequest hook.`);
25
- console.error((0, _stringifyError.stringifyError)(ex));
26
- throw ex;
20
+ return Action.CONTINUE;
27
21
  }
28
- return _IPreHandler.Action.CONTINUE;
29
- }
30
22
  }
31
- exports.ProcessHandlerOnRequestPlugins = ProcessHandlerOnRequestPlugins;
23
+ export { ProcessHandlerOnRequestPlugins };
32
24
 
33
25
  //# sourceMappingURL=ProcessHandlerOnRequestPlugins.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_IPreHandler","require","_stringifyError","ProcessHandlerOnRequestPlugins","constructor","plugins","execute","request","reply","context","name","plugin","result","exec","Action","DONE","ex","console","error","stringifyError","CONTINUE","exports"],"sources":["ProcessHandlerOnRequestPlugins.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"~/PreHandler/IPreHandler\";\nimport { Action } from \"~/PreHandler/IPreHandler\";\nimport type { HandlerOnRequestPlugin } from \"~/plugins/HandlerOnRequestPlugin\";\nimport { stringifyError } from \"~/stringifyError\";\nimport type { Context } from \"~/types\";\n\nexport class ProcessHandlerOnRequestPlugins implements IPreHandler {\n private readonly plugins: HandlerOnRequestPlugin[];\n\n constructor(plugins: HandlerOnRequestPlugin[]) {\n this.plugins = plugins;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n let name: string | undefined;\n try {\n for (const plugin of this.plugins) {\n name = plugin.name;\n const result = await plugin.exec(request, reply, context);\n if (result === false) {\n return Action.DONE;\n }\n }\n } catch (ex) {\n console.error(\n `Error while running the \"HandlerOnRequestPlugin\" ${\n name ? `(${name})` : \"\"\n } plugin in the onRequest hook.`\n );\n console.error(stringifyError(ex));\n throw ex;\n }\n\n return Action.CONTINUE;\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,8BAA8B,CAAwB;EAG/DC,WAAWA,CAACC,OAAiC,EAAE;IAC3C,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMC,OAAOA,CAACC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;IAC3F,IAAIC,IAAwB;IAC5B,IAAI;MACA,KAAK,MAAMC,MAAM,IAAI,IAAI,CAACN,OAAO,EAAE;QAC/BK,IAAI,GAAGC,MAAM,CAACD,IAAI;QAClB,MAAME,MAAM,GAAG,MAAMD,MAAM,CAACE,IAAI,CAACN,OAAO,EAAEC,KAAK,EAAEC,OAAO,CAAC;QACzD,IAAIG,MAAM,KAAK,KAAK,EAAE;UAClB,OAAOE,mBAAM,CAACC,IAAI;QACtB;MACJ;IACJ,CAAC,CAAC,OAAOC,EAAE,EAAE;MACTC,OAAO,CAACC,KAAK,CACT,oDACIR,IAAI,GAAG,IAAIA,IAAI,GAAG,GAAG,EAAE,gCAE/B,CAAC;MACDO,OAAO,CAACC,KAAK,CAAC,IAAAC,8BAAc,EAACH,EAAE,CAAC,CAAC;MACjC,MAAMA,EAAE;IACZ;IAEA,OAAOF,mBAAM,CAACM,QAAQ;EAC1B;AACJ;AAACC,OAAA,CAAAlB,8BAAA,GAAAA,8BAAA","ignoreList":[]}
1
+ {"version":3,"file":"PreHandler/ProcessHandlerOnRequestPlugins.js","sources":["../../src/PreHandler/ProcessHandlerOnRequestPlugins.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { IPreHandler } from \"~/PreHandler/IPreHandler.js\";\nimport { Action } from \"~/PreHandler/IPreHandler.js\";\nimport type { HandlerOnRequestPlugin } from \"~/plugins/HandlerOnRequestPlugin.js\";\nimport { stringifyError } from \"~/stringifyError.js\";\nimport type { Context } from \"~/types.js\";\n\nexport class ProcessHandlerOnRequestPlugins implements IPreHandler {\n private readonly plugins: HandlerOnRequestPlugin[];\n\n constructor(plugins: HandlerOnRequestPlugin[]) {\n this.plugins = plugins;\n }\n\n async execute(request: FastifyRequest, reply: FastifyReply, context: Context): Promise<Action> {\n let name: string | undefined;\n try {\n for (const plugin of this.plugins) {\n name = plugin.name;\n const result = await plugin.exec(request, reply, context);\n if (result === false) {\n return Action.DONE;\n }\n }\n } catch (ex) {\n console.error(\n `Error while running the \"HandlerOnRequestPlugin\" ${\n name ? `(${name})` : \"\"\n } plugin in the onRequest hook.`\n );\n console.error(stringifyError(ex));\n throw ex;\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["ProcessHandlerOnRequestPlugins","plugins","request","reply","context","name","plugin","result","Action","ex","console","stringifyError"],"mappings":";;AAOO,MAAMA;IAGT,YAAYC,OAAiC,CAAE;QAC3C,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,MAAM,QAAQC,OAAuB,EAAEC,KAAmB,EAAEC,OAAgB,EAAmB;QAC3F,IAAIC;QACJ,IAAI;YACA,KAAK,MAAMC,UAAU,IAAI,CAAC,OAAO,CAAE;gBAC/BD,OAAOC,OAAO,IAAI;gBAClB,MAAMC,SAAS,MAAMD,OAAO,IAAI,CAACJ,SAASC,OAAOC;gBACjD,IAAIG,AAAW,UAAXA,QACA,OAAOC,OAAO,IAAI;YAE1B;QACJ,EAAE,OAAOC,IAAI;YACTC,QAAQ,KAAK,CACT,CAAC,iDAAiD,EAC9CL,OAAO,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,GAAG,GACxB,8BAA8B,CAAC;YAEpCK,QAAQ,KAAK,CAACC,eAAeF;YAC7B,MAAMA;QACV;QAEA,OAAOD,OAAO,QAAQ;IAC1B;AACJ"}
@@ -0,0 +1,10 @@
1
+ import { FastifyRequest, FastifyReply } from "fastify";
2
+ import type { Context } from "../types.js";
3
+ import { Action } from "./IPreHandler.js";
4
+ import type { IPreHandler } from "./IPreHandler.js";
5
+ import { RegisterExtensionPlugin } from "../plugins/RegisterExtensionPlugin.js";
6
+ export declare class RegisterExtensions implements IPreHandler {
7
+ private readonly plugins;
8
+ constructor(plugins: RegisterExtensionPlugin[]);
9
+ execute<C extends Context = Context>(_: FastifyRequest, __: FastifyReply, context: C): Promise<Action>;
10
+ }
@@ -0,0 +1,13 @@
1
+ import { Action } from "./IPreHandler.js";
2
+ class RegisterExtensions {
3
+ constructor(plugins){
4
+ this.plugins = plugins;
5
+ }
6
+ async execute(_, __, context) {
7
+ for (const plugin of this.plugins)await plugin.apply(context);
8
+ return Action.CONTINUE;
9
+ }
10
+ }
11
+ export { RegisterExtensions };
12
+
13
+ //# sourceMappingURL=RegisterExtensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreHandler/RegisterExtensions.js","sources":["../../src/PreHandler/RegisterExtensions.ts"],"sourcesContent":["import { FastifyRequest, FastifyReply } from \"fastify\";\nimport type { Context } from \"~/types.js\";\nimport { Action } from \"./IPreHandler.js\";\nimport type { IPreHandler } from \"./IPreHandler.js\";\nimport { RegisterExtensionPlugin } from \"~/plugins/RegisterExtensionPlugin.js\";\n\nexport class RegisterExtensions implements IPreHandler {\n public constructor(private readonly plugins: RegisterExtensionPlugin[]) {}\n\n public async execute<C extends Context = Context>(\n _: FastifyRequest,\n __: FastifyReply,\n context: C\n ): Promise<Action> {\n for (const plugin of this.plugins) {\n await plugin.apply(context);\n }\n\n return Action.CONTINUE;\n }\n}\n"],"names":["RegisterExtensions","plugins","_","__","context","plugin","Action"],"mappings":";AAMO,MAAMA;IACT,YAAoCC,OAAkC,CAAE;aAApCA,OAAO,GAAPA;IAAqC;IAEzE,MAAa,QACTC,CAAiB,EACjBC,EAAgB,EAChBC,OAAU,EACK;QACf,KAAK,MAAMC,UAAU,IAAI,CAAC,OAAO,CAC7B,MAAMA,OAAO,KAAK,CAACD;QAGvB,OAAOE,OAAO,QAAQ;IAC1B;AACJ"}
@@ -1,7 +1,7 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { IPreHandler } from "./IPreHandler";
3
- import { Action } from "./IPreHandler";
4
- import type { ModifyResponseHeadersPlugin } from "../plugins/ModifyResponseHeadersPlugin";
2
+ import type { IPreHandler } from "../PreHandler/IPreHandler.js";
3
+ import { Action } from "../PreHandler/IPreHandler.js";
4
+ import type { ModifyResponseHeadersPlugin } from "../plugins/ModifyResponseHeadersPlugin.js";
5
5
  export declare class SendEarlyOptionsResponse implements IPreHandler {
6
6
  private readonly plugins;
7
7
  constructor(plugins: ModifyResponseHeadersPlugin[]);