@creator.co/wapi 1.5.9-alpha.3 → 1.5.9-alpha.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@creator.co/wapi",
3
- "version": "1.5.8",
3
+ "version": "1.5.9-alpha.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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 = object, ResponseInnerType = null, MiscRespType = never, PathParamsType = StringMap, QueryParamsType = StringMap> {
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 = any, OutputType = any, PathParamsType = StringMap, QueryParamsType = StringMap> {
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, null, PathParamsType, QueryParamsType>, 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,KAAK,EAAL,wBAAK;wCACP,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;wCAC5D,iBAAiB;wCACjB,IAAI,KAAK,CAAC,WAAW,EAAE;4CACf,cAA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AAA;QACvD,IAAI,MAAM;YAAE,GAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClD,CAAC;IACH,aAAC;AAAD,CAAC,AA5FD,IA4FC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creator.co/wapi",
3
- "version": "1.5.9-alpha.3",
3
+ "version": "1.5.9-alpha.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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 = object,
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<any, any> | undefined {
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) {
@@ -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 = any,
30
- OutputType = any,
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, null, PathParamsType, QueryParamsType>,
57
+ Transaction<InputType, OutputType | ResponseErrorType, never, PathParamsType, QueryParamsType>,
58
58
  OutputType | ResponseErrorType
59
59
  >
60
60
  /**
@@ -2,8 +2,8 @@ import { APIGatewayProxyEvent, Context } from 'aws-lambda'
2
2
  import { pathToRegexp } from 'path-to-regexp'
3
3
 
4
4
  import Request from '../../API/Request'
5
- import Response from '../../API/Response'
6
- import Transaction from '../../BaseEvent/Transaction'
5
+ import Response, { ResponseErrorType } from '../../API/Response'
6
+ import Transaction, { StringMap } from '../../BaseEvent/Transaction'
7
7
  import Validator from '../../Validation/Validator'
8
8
  import { RouterConfig } from '../Router'
9
9
  import RouteResolver from '../RouteResolver'
@@ -51,7 +51,11 @@ export default class Server {
51
51
  */
52
52
  public async handleServerlessEvent(event: APIGatewayProxyEvent, context: Context) {
53
53
  // init transaction
54
- await new Transaction(event, context, this.config).execute(async transaction => {
54
+ await new Transaction<never, ResponseErrorType, never, StringMap, StringMap>(
55
+ event,
56
+ context,
57
+ this.config
58
+ ).execute(async transaction => {
55
59
  const request = transaction.request
56
60
  const route = this.routeResolver.resolveRoute(request.getMethod(), request.getPath())
57
61
  if (route) {
@@ -70,7 +70,7 @@ describe('Container server routing', () => {
70
70
  handler: async () => {
71
71
  return Response.SimpleResponse({ name: 'abc' })
72
72
  },
73
- },
73
+ } as any,
74
74
  ],
75
75
  })
76
76
  await server.start()
@@ -198,7 +198,7 @@ describe('Container server validation (body)', () => {
198
198
  handler: async () => {
199
199
  return Response.SimpleResponse({ name: 'abc' })
200
200
  },
201
- },
201
+ } as any,
202
202
  ],
203
203
  })
204
204
  await server.start()
@@ -221,7 +221,7 @@ describe('Container server validation (body)', () => {
221
221
  handler: async () => {
222
222
  return Response.SimpleResponse({ name: 'abc' })
223
223
  },
224
- },
224
+ } as any,
225
225
  ],
226
226
  })
227
227
  await server.start()
@@ -245,7 +245,7 @@ describe('Container server validation (body)', () => {
245
245
  handler: async () => {
246
246
  return Response.SimpleResponse({ name: 'abc' })
247
247
  },
248
- },
248
+ } as any,
249
249
  ],
250
250
  })
251
251
  await server.start()
@@ -269,7 +269,7 @@ describe('Container server validation (body)', () => {
269
269
  handler: async () => {
270
270
  return Response.SimpleResponse({ name: 'abc' })
271
271
  },
272
- },
272
+ } as any,
273
273
  ],
274
274
  })
275
275
  await server.start()
@@ -293,7 +293,7 @@ describe('Container server validation (body)', () => {
293
293
  handler: async () => {
294
294
  return Response.SimpleResponse({ name: 'abc' })
295
295
  },
296
- },
296
+ } as any,
297
297
  ],
298
298
  })
299
299
  await server.start()
@@ -317,7 +317,7 @@ describe('Container server validation (body)', () => {
317
317
  handler: async () => {
318
318
  return Response.SimpleResponse({ name: 'abc' })
319
319
  },
320
- },
320
+ } as any,
321
321
  ],
322
322
  })
323
323
  await server.start()
@@ -358,7 +358,7 @@ describe('Container server validation (query)', () => {
358
358
  handler: async () => {
359
359
  return Response.SimpleResponse({ name: 'abc' })
360
360
  },
361
- },
361
+ } as any,
362
362
  ],
363
363
  })
364
364
  await server.start()
@@ -444,7 +444,7 @@ describe('Container server validation (path)', () => {
444
444
  handler: async () => {
445
445
  return Response.SimpleResponse({ name: 'abc' })
446
446
  },
447
- },
447
+ } as any,
448
448
  ],
449
449
  })
450
450
  await server.start()
@@ -507,7 +507,7 @@ describe('Container server raw body', () => {
507
507
  raw = t.request.getBody(true)
508
508
  return Response.SimpleResponse(null)
509
509
  },
510
- },
510
+ } as any,
511
511
  ],
512
512
  })
513
513
  await server.start()