@creator.co/wapi 1.2.0-beta1 → 1.2.0-beta3
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/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ResponseErrorType } from "../API/Response";
|
|
3
3
|
import Transaction, { TransactionConfig, TransactionExecution } from "../BaseEvent/Transaction";
|
|
4
|
-
export interface Route<InputType =
|
|
4
|
+
export interface Route<InputType = any, OutputType = any> {
|
|
5
5
|
path: string;
|
|
6
6
|
method: string;
|
|
7
7
|
handler: TransactionExecution<Transaction<InputType>, OutputType | ResponseErrorType>;
|
|
@@ -79,7 +79,7 @@ var Server = /** @class */ (function () {
|
|
|
79
79
|
route = _b.value;
|
|
80
80
|
handler = this.routeMatches(route.path, route.method, event);
|
|
81
81
|
if (!handler) return [3 /*break*/, 3];
|
|
82
|
-
transaction.logger.log("Router accepted route:", route);
|
|
82
|
+
transaction.logger.log("Router accepted route:", route.path);
|
|
83
83
|
// Validate input
|
|
84
84
|
if (route.inputSchema) {
|
|
85
85
|
validationResp = Validator_1.default.validateSchema(transaction.request.getBody(), route.inputSchema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../../../../src/Server/lib/Server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAA8C;AAE9C,+CAAyC;AACzC,2DAAqD;AACrD,wDAAkD;AAGlD;IAEE,gBAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,0BAAS,GAAhB;QACE,OAAO,IAAI,CAAC,qBAAqB,CAAA;IACnC,CAAC;IAEY,sCAAqB,GAAlC,UACE,KAA2B,EAC3B,OAAgB;;;;;;oBAEhB,mBAAmB;oBACnB,qBAAM,IAAI,qBAAW,CAA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AAI,KAAK,CAAC,WAAW,EAAE;4CACf,cAAc,GAAG,mBAAS,CAAC,cAAc,CAC7C,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,EAC7B,KAAK,CAAC,WAAW,CAClB,CAAA;4CACD,IAAI,cAAc,IAAI,cAAc,YAAY,kBAAQ;gDACtD,sBAAO,cAAc,EAAA;yCACxB;wCAEM,qBAAM,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAA;;oCADvC,4BAA4B;oCAC5B,sBAAO,SAAgC,EAAA;;;;;;;;;;;;;;;;oCAG3C,mBAAmB;oCACnB,sBAAO,IAAI,kBAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC,EAAA;;;6BACtD,CACF,EAAA;;wBAxBD,mBAAmB;wBACnB,SAuBC,CAAA;;;;;KACF;IACD,iCAAiC;IACzB,6BAAY,GAApB,UACE,SAAiB,EACjB,WAAmB,EACnB,KAA2B;QAE3B,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACvB,IAAM,IAAI,GAAG,EAAE,CAAA;QACf,IAAM,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvD,IAAI,MAAM,EAAE;YACV,IAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAA;YAClC,IAAI,SAAS,CAAC,WAAW,EAAE,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE;gBACxD,OAAO,IAAI,CAAA;aACZ;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IACH,aAAC;AAAD,CAAC,AAzDD,IAyDC"}
|
package/package.json
CHANGED
package/src/Server/Router.ts
CHANGED
|
@@ -10,7 +10,7 @@ import Transaction, {
|
|
|
10
10
|
} from "../BaseEvent/Transaction"
|
|
11
11
|
|
|
12
12
|
// Route
|
|
13
|
-
export interface Route<InputType =
|
|
13
|
+
export interface Route<InputType = any, OutputType = any> {
|
|
14
14
|
path: string
|
|
15
15
|
method: string
|
|
16
16
|
handler: TransactionExecution<
|
package/src/Server/lib/Server.ts
CHANGED
|
@@ -27,7 +27,7 @@ export default class Server {
|
|
|
27
27
|
// Check for possible paths
|
|
28
28
|
const handler = this.routeMatches(route.path, route.method, event)
|
|
29
29
|
if (handler) {
|
|
30
|
-
transaction.logger.log("Router accepted route:", route)
|
|
30
|
+
transaction.logger.log("Router accepted route:", route.path)
|
|
31
31
|
// Validate input
|
|
32
32
|
if (route.inputSchema) {
|
|
33
33
|
const validationResp = Validator.validateSchema(
|