@jaypie/express 1.1.16 → 1.1.18-rc.0

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 (65) hide show
  1. package/dist/cjs/__tests__/constants.spec.d.ts +1 -0
  2. package/dist/cjs/__tests__/cors.helper.spec.d.ts +1 -0
  3. package/dist/cjs/__tests__/cors.helper.supertest.spec.d.ts +1 -0
  4. package/dist/cjs/__tests__/decorateResponse.helper.spec.d.ts +1 -0
  5. package/dist/cjs/__tests__/echo.handler.spec.d.ts +1 -0
  6. package/dist/cjs/__tests__/expressHandler.spec.d.ts +1 -0
  7. package/dist/cjs/__tests__/getCurrentInvokeUuid.adapter.spec.d.ts +1 -0
  8. package/dist/cjs/__tests__/http.handler.spec.d.ts +1 -0
  9. package/dist/cjs/__tests__/index.spec.d.ts +1 -0
  10. package/dist/cjs/__tests__/routes.spec.d.ts +1 -0
  11. package/dist/cjs/__tests__/summarizeRequest.helper.spec.d.ts +1 -0
  12. package/dist/cjs/__tests__/summarizeResponse.helper.spec.d.ts +1 -0
  13. package/dist/cjs/__tests__/supertest.spec.d.ts +1 -0
  14. package/dist/cjs/constants.d.ts +8 -0
  15. package/dist/cjs/cors.helper.d.ts +9 -0
  16. package/dist/cjs/decorateResponse.helper.d.ts +7 -0
  17. package/dist/cjs/echo.handler.d.ts +8 -0
  18. package/dist/cjs/expressHandler.d.ts +14 -0
  19. package/dist/cjs/getCurrentInvokeUuid.adapter.d.ts +2 -0
  20. package/dist/cjs/http.handler.d.ts +4 -0
  21. package/dist/cjs/index.cjs +632 -0
  22. package/dist/cjs/index.cjs.map +1 -0
  23. package/{src/index.js → dist/cjs/index.d.ts} +2 -0
  24. package/dist/cjs/routes.d.ts +8 -0
  25. package/dist/cjs/summarizeRequest.helper.d.ts +11 -0
  26. package/dist/cjs/summarizeResponse.helper.d.ts +9 -0
  27. package/dist/esm/__tests__/constants.spec.d.ts +1 -0
  28. package/dist/esm/__tests__/cors.helper.spec.d.ts +1 -0
  29. package/dist/esm/__tests__/cors.helper.supertest.spec.d.ts +1 -0
  30. package/dist/esm/__tests__/decorateResponse.helper.spec.d.ts +1 -0
  31. package/dist/esm/__tests__/echo.handler.spec.d.ts +1 -0
  32. package/dist/esm/__tests__/expressHandler.spec.d.ts +1 -0
  33. package/dist/esm/__tests__/getCurrentInvokeUuid.adapter.spec.d.ts +1 -0
  34. package/dist/esm/__tests__/http.handler.spec.d.ts +1 -0
  35. package/dist/esm/__tests__/index.spec.d.ts +1 -0
  36. package/dist/esm/__tests__/routes.spec.d.ts +1 -0
  37. package/dist/esm/__tests__/summarizeRequest.helper.spec.d.ts +1 -0
  38. package/dist/esm/__tests__/summarizeResponse.helper.spec.d.ts +1 -0
  39. package/dist/esm/__tests__/supertest.spec.d.ts +1 -0
  40. package/dist/esm/constants.d.ts +8 -0
  41. package/dist/esm/cors.helper.d.ts +9 -0
  42. package/dist/esm/decorateResponse.helper.d.ts +7 -0
  43. package/dist/esm/echo.handler.d.ts +8 -0
  44. package/dist/esm/expressHandler.d.ts +14 -0
  45. package/dist/esm/getCurrentInvokeUuid.adapter.d.ts +2 -0
  46. package/dist/esm/http.handler.d.ts +4 -0
  47. package/dist/esm/index.d.ts +7 -0
  48. package/dist/esm/index.js +619 -0
  49. package/dist/esm/index.js.map +1 -0
  50. package/dist/esm/routes.d.ts +8 -0
  51. package/dist/esm/summarizeRequest.helper.d.ts +11 -0
  52. package/dist/esm/summarizeResponse.helper.d.ts +9 -0
  53. package/package.json +35 -25
  54. package/index.d.ts +0 -68
  55. package/rollup.config.mjs +0 -22
  56. package/src/constants.js +0 -12
  57. package/src/cors.helper.js +0 -110
  58. package/src/decorateResponse.helper.js +0 -90
  59. package/src/echo.handler.js +0 -31
  60. package/src/expressHandler.js +0 -346
  61. package/src/getCurrentInvokeUuid.adapter.js +0 -33
  62. package/src/http.handler.js +0 -73
  63. package/src/routes.js +0 -43
  64. package/src/summarizeRequest.helper.js +0 -28
  65. package/src/summarizeResponse.helper.js +0 -25
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare const EXPRESS: {
2
+ readonly PATH: {
3
+ readonly ANY: "*";
4
+ readonly ID: "/:id";
5
+ readonly ROOT: RegExp;
6
+ };
7
+ };
8
+ export type ExpressConstants = typeof EXPRESS;
@@ -0,0 +1,9 @@
1
+ import type { Request, Response, NextFunction } from "express";
2
+ export interface CorsConfig {
3
+ origin?: string | string[];
4
+ overrides?: Record<string, unknown>;
5
+ }
6
+ type CorsCallback = (err: Error | null, allow?: boolean) => void;
7
+ export declare const dynamicOriginCallbackHandler: (origin?: string | string[]) => ((requestOrigin: string | undefined, callback: CorsCallback) => void);
8
+ declare const _default: (config?: CorsConfig) => ((req: Request, res: Response, next: NextFunction) => void);
9
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type { Response } from "express";
2
+ interface DecorateResponseOptions {
3
+ handler?: string;
4
+ version?: string;
5
+ }
6
+ declare const decorateResponse: (res: Response, { handler, version, }?: DecorateResponseOptions) => void;
7
+ export default decorateResponse;
@@ -0,0 +1,8 @@
1
+ import type { Request, Response } from "express";
2
+ import { ExpressHandlerOptions } from "./expressHandler.js";
3
+ import summarizeRequest from "./summarizeRequest.helper.js";
4
+ export interface EchoResponse {
5
+ req: ReturnType<typeof summarizeRequest>;
6
+ }
7
+ declare const echoHandler: (context?: ExpressHandlerOptions) => ((req: Request, res: Response) => Promise<EchoResponse>);
8
+ export default echoHandler;
@@ -0,0 +1,14 @@
1
+ import type { Request, Response } from "express";
2
+ export interface ExpressHandlerOptions {
3
+ chaos?: string;
4
+ locals?: Record<string, unknown | ((req: Request, res: Response) => Promise<unknown>)>;
5
+ name?: string;
6
+ setup?: ((req: Request, res: Response) => Promise<void>)[] | ((req: Request, res: Response) => Promise<void>);
7
+ teardown?: ((req: Request, res: Response) => Promise<void>)[] | ((req: Request, res: Response) => Promise<void>);
8
+ unavailable?: boolean;
9
+ validate?: ((req: Request, res: Response) => Promise<boolean> | boolean)[] | ((req: Request, res: Response) => Promise<boolean> | boolean);
10
+ }
11
+ type ExpressHandler<T> = (req: Request, res: Response, ...params: unknown[]) => Promise<T>;
12
+ declare function expressHandler<T>(handler: ExpressHandler<T>, options?: ExpressHandlerOptions): ExpressHandler<T>;
13
+ declare function expressHandler<T>(options: ExpressHandlerOptions, handler: ExpressHandler<T>): ExpressHandler<T>;
14
+ export default expressHandler;
@@ -0,0 +1,2 @@
1
+ declare const getCurrentInvokeUuid: () => string | undefined;
2
+ export default getCurrentInvokeUuid;
@@ -0,0 +1,4 @@
1
+ import type { Request, Response } from "express";
2
+ import { ExpressHandlerOptions } from "./expressHandler.js";
3
+ declare const httpHandler: (statusCode?: number, context?: ExpressHandlerOptions) => ((req: Request, res: Response) => Promise<Record<string, unknown> | null>);
4
+ export default httpHandler;