@creator.co/wapi 1.5.9-alpha.3 → 1.5.9-alpha.4
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 +1 -1
- package/dist/src/BaseEvent/Transaction.d.ts +1 -1
- package/dist/src/Server/Router.d.ts +2 -2
- package/dist/src/Server/lib/Server.js +1 -0
- package/dist/src/Server/lib/Server.js.map +1 -1
- package/package.json +1 -1
- package/src/BaseEvent/Transaction.ts +1 -1
- package/src/Server/RouteResolver.ts +1 -1
- package/src/Server/Router.ts +3 -3
- package/src/Server/lib/Server.ts +2 -1
package/dist/package.json
CHANGED
|
@@ -36,7 +36,7 @@ export type StringMap = {
|
|
|
36
36
|
* @template ResponseInnerType - The type of the inner response data for the transaction.
|
|
37
37
|
* @template MiscRespType - The type of miscellaneous response data for the transaction.
|
|
38
38
|
*/
|
|
39
|
-
export default class Transaction<InputType =
|
|
39
|
+
export default class Transaction<InputType = never, ResponseInnerType = null, MiscRespType = never, PathParamsType = StringMap, QueryParamsType = StringMap> {
|
|
40
40
|
/**
|
|
41
41
|
* The instance of the DatabaseManager class used for managing the database.
|
|
42
42
|
*/
|
|
@@ -16,7 +16,7 @@ import Transaction, { TransactionConfig, TransactionExecution, StringMap } from
|
|
|
16
16
|
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[pathSchema] - The path schema for validating the path data.
|
|
17
17
|
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[querySchema] - The query schema for validating the query data.
|
|
18
18
|
*/
|
|
19
|
-
export interface Route<InputType =
|
|
19
|
+
export interface Route<InputType = never, OutputType = never, PathParamsType = StringMap, QueryParamsType = StringMap> {
|
|
20
20
|
/**
|
|
21
21
|
* Represents a file path as a string.
|
|
22
22
|
* @param {string} path - The file path.
|
|
@@ -33,7 +33,7 @@ export interface Route<InputType = any, OutputType = any, PathParamsType = Strin
|
|
|
33
33
|
* @param {Transaction<InputType, OutputType | ResponseErrorType, PathParamsType, QueryParamsType>} transaction - The transaction to execute.
|
|
34
34
|
* @param {OutputType | ResponseErrorType} - The output type or response error type of the transaction.
|
|
35
35
|
*/
|
|
36
|
-
handler: TransactionExecution<Transaction<InputType, OutputType | ResponseErrorType,
|
|
36
|
+
handler: TransactionExecution<Transaction<InputType, OutputType | ResponseErrorType, never, PathParamsType, QueryParamsType>, OutputType | ResponseErrorType>;
|
|
37
37
|
/**
|
|
38
38
|
* An optional input schema for validating the structure of the input data.
|
|
39
39
|
* Description placeholder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../../../../src/Server/lib/Server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAA6C;AAG7C,+CAAyC;AACzC,2DAAqD;AACrD,wDAAkD;AAElD,kDAA4C;AAE5C;;GAEG;AACH;IAcE;;;;OAIG;IACH,gBAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,CAAC,MAAM,CAAC,CAAA;IAChD,CAAC;IAED;;;OAGG;IACI,0BAAS,GAAhB;QACE,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9C,CAAC;IAED;;;;;OAKG;IACU,sCAAqB,GAAlC,UAAmC,KAA2B,EAAE,OAAgB;;;;;;oBAC9E,mBAAmB;oBACnB,qBAAM,IAAI,qBAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAM,WAAW;;;;;wCACpE,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA;wCAC7B,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;6CACjF,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,KAAK,CAAC,UAAU,EAAE;4CACd,cAAc,GAAG,mBAAS,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;4CAC1F,IAAI,cAAc,IAAI,cAAc,YAAY,kBAAQ;gDAAE,sBAAO,cAAc,EAAA;yCAChF;wCAIM,qBAAM,KAAK,CAAC,OAAO,CAAC,WAAkB,CAAC,EAAA;;oCAF9C,4BAA4B;oCAC5B,eAAe;oCACf,sBAAO,SAAuC,EAAA;;oCAEhD,mBAAmB;oCACnB,sBAAO,IAAI,kBAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC,EAAA;;;6BACtD,CAAC,EAAA;;wBAnCF,mBAAmB;wBACnB,SAkCE,CAAA;;;;;KACH;IAED;;;;;OAKG;IACK,gCAAe,GAAvB,UAAwB,GAA2B,EAAE,SAAiB;QACpE,IAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAA;QAC1B,IAAM,IAAI,GAAG,EAAE,CAAA;QACf,IAAM,MAAM,GAAG,IAAA,6BAAY,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvD,IAAI,MAAM;YAAE,GAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClD,CAAC;IACH,aAAC;AAAD,CAAC,AAzFD,IAyFC"}
|
package/package.json
CHANGED
|
@@ -51,7 +51,7 @@ export type StringMap = { [key: string]: string | null }
|
|
|
51
51
|
* @template MiscRespType - The type of miscellaneous response data for the transaction.
|
|
52
52
|
*/
|
|
53
53
|
export default class Transaction<
|
|
54
|
-
InputType =
|
|
54
|
+
InputType = never,
|
|
55
55
|
ResponseInnerType = null,
|
|
56
56
|
MiscRespType = never,
|
|
57
57
|
PathParamsType = StringMap,
|
|
@@ -59,7 +59,7 @@ class Routes {
|
|
|
59
59
|
* @param {string[]} parts - An array of route parts.
|
|
60
60
|
* @returns {Route} The resolved route.
|
|
61
61
|
*/
|
|
62
|
-
public resolveRoute(parts: string[]): Route<
|
|
62
|
+
public resolveRoute(parts: string[]): Route<never, never> | undefined {
|
|
63
63
|
const first = parts.shift()
|
|
64
64
|
if (first) {
|
|
65
65
|
if (first in this.next) {
|
package/src/Server/Router.ts
CHANGED
|
@@ -26,8 +26,8 @@ import Utils from '../Util/Utils'
|
|
|
26
26
|
* @property {?z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>}[querySchema] - The query schema for validating the query data.
|
|
27
27
|
*/
|
|
28
28
|
export interface Route<
|
|
29
|
-
InputType =
|
|
30
|
-
OutputType =
|
|
29
|
+
InputType = never,
|
|
30
|
+
OutputType = never,
|
|
31
31
|
PathParamsType = StringMap,
|
|
32
32
|
QueryParamsType = StringMap,
|
|
33
33
|
> {
|
|
@@ -54,7 +54,7 @@ export interface Route<
|
|
|
54
54
|
* @param {OutputType | ResponseErrorType} - The output type or response error type of the transaction.
|
|
55
55
|
*/
|
|
56
56
|
handler: TransactionExecution<
|
|
57
|
-
Transaction<InputType, OutputType | ResponseErrorType,
|
|
57
|
+
Transaction<InputType, OutputType | ResponseErrorType, never, PathParamsType, QueryParamsType>,
|
|
58
58
|
OutputType | ResponseErrorType
|
|
59
59
|
>
|
|
60
60
|
/**
|
package/src/Server/lib/Server.ts
CHANGED
|
@@ -80,7 +80,8 @@ export default class Server {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Continue to route handler
|
|
83
|
-
|
|
83
|
+
// TODO: fix me
|
|
84
|
+
return await route.handler(transaction as any)
|
|
84
85
|
}
|
|
85
86
|
//No route found :/
|
|
86
87
|
return new Response(404, { err: 'Route not found!' })
|