@webiny/handler 0.0.0-unstable.8c4d9f045a → 0.0.0-unstable.9609e4e0c9
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.
- package/README.md +10 -14
- package/ResponseHeaders.d.ts +24 -0
- package/ResponseHeaders.js +36 -0
- package/ResponseHeaders.js.map +1 -0
- package/abstractions/Reply.d.ts +5 -0
- package/abstractions/Reply.js +5 -0
- package/abstractions/Reply.js.map +1 -0
- package/abstractions/Request.d.ts +5 -0
- package/abstractions/Request.js +5 -0
- package/abstractions/Request.js.map +1 -0
- package/exports/api.d.ts +0 -0
- package/exports/api.js +0 -0
- package/index.d.ts +6 -8
- package/index.js +5 -109
- package/package.json +18 -28
- package/plugins/RegisterExtensionPlugin.d.ts +36 -0
- package/plugins/RegisterExtensionPlugin.js +38 -0
- package/plugins/RegisterExtensionPlugin.js.map +1 -0
- package/stringifyError.d.ts +5 -0
- package/stringifyError.js +15 -0
- package/stringifyError.js.map +1 -0
- package/types.d.ts +21 -43
- package/types.js +0 -19
- package/Context.d.ts +0 -13
- package/Context.js +0 -29
- package/Context.js.map +0 -1
- package/fastify.d.ts +0 -8
- package/fastify.js +0 -315
- package/fastify.js.map +0 -1
- package/index.js.map +0 -1
- package/middleware.d.ts +0 -4
- package/middleware.js +0 -51
- package/middleware.js.map +0 -1
- package/plugins/BeforeHandlerPlugin.d.ts +0 -12
- package/plugins/BeforeHandlerPlugin.js +0 -38
- package/plugins/BeforeHandlerPlugin.js.map +0 -1
- package/plugins/EventPlugin.d.ts +0 -25
- package/plugins/EventPlugin.js +0 -38
- package/plugins/EventPlugin.js.map +0 -1
- package/plugins/HandlerErrorPlugin.d.ts +0 -12
- package/plugins/HandlerErrorPlugin.js +0 -34
- package/plugins/HandlerErrorPlugin.js.map +0 -1
- package/plugins/HandlerResultPlugin.d.ts +0 -12
- package/plugins/HandlerResultPlugin.js +0 -34
- package/plugins/HandlerResultPlugin.js.map +0 -1
- package/plugins/RoutePlugin.d.ts +0 -23
- package/plugins/RoutePlugin.js +0 -30
- package/plugins/RoutePlugin.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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,mBAAN,SAA+DC,eAA/D,CAAsE;EAKlEC,WAAW,CAACC,QAAD,EAAqC;IACnD;IADmD;IAEnD,KAAKC,SAAL,GAAiBD,QAAjB;EACH;;EAEkB,MAANE,MAAM,CAACC,OAAD,EAAaC,MAAb,EAAwC;IACvD,OAAO,KAAKH,SAAL,CAAeE,OAAf,EAAwBC,MAAxB,CAAP;EACH;;AAZwE;;;8BAAhEP,mB,UACsC,gB;;AAc5C,MAAMQ,yBAAyB,GAClCL,QADqC,IAEZ;EACzB,OAAO,IAAIH,mBAAJ,CAA2BG,QAA3B,CAAP;AACH,CAJM"}
|
package/plugins/RoutePlugin.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "@webiny/plugins/Plugin";
|
|
2
|
-
import { Context, RouteMethod } from "../types";
|
|
3
|
-
interface RoutePluginCbParams<T extends Context> {
|
|
4
|
-
context: T;
|
|
5
|
-
onGet: RouteMethod;
|
|
6
|
-
onPost: RouteMethod;
|
|
7
|
-
onPut: RouteMethod;
|
|
8
|
-
onPatch: RouteMethod;
|
|
9
|
-
onDelete: RouteMethod;
|
|
10
|
-
onOptions: RouteMethod;
|
|
11
|
-
onAll: RouteMethod;
|
|
12
|
-
onHead: RouteMethod;
|
|
13
|
-
}
|
|
14
|
-
export interface RoutePluginCb<T extends Context> {
|
|
15
|
-
(params: RoutePluginCbParams<T>): void;
|
|
16
|
-
}
|
|
17
|
-
export declare class RoutePlugin<T extends Context = Context> extends Plugin {
|
|
18
|
-
static readonly type: string;
|
|
19
|
-
readonly cb: RoutePluginCb<T>;
|
|
20
|
-
constructor(cb: RoutePluginCb<T>);
|
|
21
|
-
}
|
|
22
|
-
export declare const createRoute: <T extends Context = Context>(cb: RoutePluginCb<T>) => RoutePlugin<T>;
|
|
23
|
-
export {};
|
package/plugins/RoutePlugin.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createRoute = exports.RoutePlugin = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _Plugin = require("@webiny/plugins/Plugin");
|
|
13
|
-
|
|
14
|
-
class RoutePlugin extends _Plugin.Plugin {
|
|
15
|
-
constructor(cb) {
|
|
16
|
-
super();
|
|
17
|
-
(0, _defineProperty2.default)(this, "cb", void 0);
|
|
18
|
-
this.cb = cb;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.RoutePlugin = RoutePlugin;
|
|
24
|
-
(0, _defineProperty2.default)(RoutePlugin, "type", "handler.fastify.route");
|
|
25
|
-
|
|
26
|
-
const createRoute = cb => {
|
|
27
|
-
return new RoutePlugin(cb);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.createRoute = createRoute;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RoutePlugin","Plugin","constructor","cb","createRoute"],"sources":["RoutePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { Context, RouteMethod } from \"~/types\";\n\ninterface RoutePluginCbParams<T extends Context> {\n context: T;\n onGet: RouteMethod;\n onPost: RouteMethod;\n onPut: RouteMethod;\n onPatch: RouteMethod;\n onDelete: RouteMethod;\n onOptions: RouteMethod;\n onAll: RouteMethod;\n onHead: RouteMethod;\n}\nexport interface RoutePluginCb<T extends Context> {\n (params: RoutePluginCbParams<T>): void;\n}\n\nexport class RoutePlugin<T extends Context = Context> extends Plugin {\n public static override readonly type: string = \"handler.fastify.route\";\n\n public readonly cb: RoutePluginCb<T>;\n\n public constructor(cb: RoutePluginCb<T>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createRoute = <T extends Context = Context>(cb: RoutePluginCb<T>): RoutePlugin<T> => {\n return new RoutePlugin<T>(cb);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAkBO,MAAMA,WAAN,SAAuDC,cAAvD,CAA8D;EAK1DC,WAAW,CAACC,EAAD,EAAuB;IACrC;IADqC;IAErC,KAAKA,EAAL,GAAUA,EAAV;EACH;;AARgE;;;8BAAxDH,W,UACsC,uB;;AAU5C,MAAMI,WAAW,GAAiCD,EAA9B,IAAuE;EAC9F,OAAO,IAAIH,WAAJ,CAAmBG,EAAnB,CAAP;AACH,CAFM"}
|
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import {\n FastifyInstance,\n FastifyRequest,\n FastifyReply,\n HTTPMethods,\n RouteHandlerMethod\n} from \"fastify\";\n\nexport { FastifyInstance, HTTPMethods } from \"fastify\";\nimport { ClientContext } from \"@webiny/handler-client/types\";\n\nexport type RouteTypes = HTTPMethods;\n\nexport interface RouteMethodOptions {\n override?: boolean;\n}\n\nexport type RouteMethodPath = `/${string}` | \"*\";\nexport interface RouteMethod {\n (path: RouteMethodPath, handler: RouteHandlerMethod, options?: RouteMethodOptions): void;\n}\n\nexport type Request = FastifyRequest;\nexport type Reply = FastifyReply;\n\nexport type DefinedContextRoutes = Record<RouteTypes, string[]>;\nexport interface ContextRoutes {\n defined: DefinedContextRoutes;\n onGet: RouteMethod;\n onPost: RouteMethod;\n onPut: RouteMethod;\n onPatch: RouteMethod;\n onDelete: RouteMethod;\n onOptions: RouteMethod;\n onAll: RouteMethod;\n onHead: RouteMethod;\n}\n\nexport interface Context extends ClientContext {\n /**\n * An instance of fastify server.\n * Use at your own risk.\n * @instance\n */\n server: FastifyInstance;\n /**\n * Current request. Must be set only once!\n */\n request: FastifyRequest;\n /**\n * @internal\n */\n routes: ContextRoutes;\n}\n\ndeclare module \"fastify\" {\n interface FastifyInstance {\n webiny: Context;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA"}
|