@rvoh/psychic 2.3.9 → 3.0.0-alpha.2

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 (52) hide show
  1. package/dist/cjs/src/controller/helpers/logIfDevelopment.js +5 -5
  2. package/dist/cjs/src/controller/index.js +117 -40
  3. package/dist/cjs/src/devtools/helpers/launchDevServer.js +0 -1
  4. package/dist/cjs/src/error/router/cannot-commit-routes-without-koa-app.js +12 -0
  5. package/dist/cjs/src/helpers/toJson.js +2 -8
  6. package/dist/cjs/src/helpers/validateOpenApiSchema.js +1 -1
  7. package/dist/cjs/src/openapi-renderer/endpoint.js +3 -1
  8. package/dist/cjs/src/openapi-renderer/helpers/OpenapiPayloadValidator.js +75 -9
  9. package/dist/cjs/src/openapi-renderer/helpers/stringify-cache.js +55 -0
  10. package/dist/cjs/src/openapi-renderer/helpers/validator-cache.js +52 -0
  11. package/dist/cjs/src/psychic-app/helpers/import/importControllers.js +1 -1
  12. package/dist/cjs/src/psychic-app/index.js +4 -16
  13. package/dist/cjs/src/router/index.js +31 -25
  14. package/dist/cjs/src/server/helpers/startPsychicServer.js +6 -2
  15. package/dist/cjs/src/server/index.js +32 -35
  16. package/dist/cjs/src/session/index.js +9 -12
  17. package/dist/esm/src/controller/helpers/logIfDevelopment.js +5 -5
  18. package/dist/esm/src/controller/index.js +117 -40
  19. package/dist/esm/src/devtools/helpers/launchDevServer.js +0 -1
  20. package/dist/esm/src/error/router/cannot-commit-routes-without-koa-app.js +12 -0
  21. package/dist/esm/src/helpers/toJson.js +2 -8
  22. package/dist/esm/src/helpers/validateOpenApiSchema.js +1 -1
  23. package/dist/esm/src/openapi-renderer/endpoint.js +3 -1
  24. package/dist/esm/src/openapi-renderer/helpers/OpenapiPayloadValidator.js +75 -9
  25. package/dist/esm/src/openapi-renderer/helpers/stringify-cache.js +55 -0
  26. package/dist/esm/src/openapi-renderer/helpers/validator-cache.js +52 -0
  27. package/dist/esm/src/psychic-app/helpers/import/importControllers.js +1 -1
  28. package/dist/esm/src/psychic-app/index.js +4 -16
  29. package/dist/esm/src/router/index.js +31 -25
  30. package/dist/esm/src/server/helpers/startPsychicServer.js +6 -2
  31. package/dist/esm/src/server/index.js +32 -35
  32. package/dist/esm/src/session/index.js +9 -12
  33. package/dist/types/src/controller/helpers/logIfDevelopment.d.ts +3 -4
  34. package/dist/types/src/controller/index.d.ts +18 -7
  35. package/dist/types/src/error/router/cannot-commit-routes-without-koa-app.d.ts +3 -0
  36. package/dist/types/src/helpers/cookieMaxAgeFromCookieOpts.d.ts +1 -1
  37. package/dist/types/src/helpers/toJson.d.ts +1 -1
  38. package/dist/types/src/helpers/validateOpenApiSchema.d.ts +5 -1
  39. package/dist/types/src/openapi-renderer/endpoint.d.ts +7 -1
  40. package/dist/types/src/openapi-renderer/helpers/OpenapiPayloadValidator.d.ts +41 -0
  41. package/dist/types/src/openapi-renderer/helpers/stringify-cache.d.ts +34 -0
  42. package/dist/types/src/openapi-renderer/helpers/validator-cache.d.ts +35 -0
  43. package/dist/types/src/psychic-app/index.d.ts +11 -14
  44. package/dist/types/src/router/index.d.ts +17 -17
  45. package/dist/types/src/router/route-manager.d.ts +4 -3
  46. package/dist/types/src/server/helpers/startPsychicServer.d.ts +3 -3
  47. package/dist/types/src/server/index.d.ts +3 -3
  48. package/dist/types/src/session/index.d.ts +13 -5
  49. package/package.json +29 -18
  50. package/dist/cjs/src/error/router/cannot-commit-routes-without-express-app.js +0 -12
  51. package/dist/esm/src/error/router/cannot-commit-routes-without-express-app.js +0 -12
  52. package/dist/types/src/error/router/cannot-commit-routes-without-express-app.d.ts +0 -3
@@ -0,0 +1,35 @@
1
+ import { ValidateFunction } from 'ajv';
2
+ /**
3
+ * @internal
4
+ *
5
+ * Retrieves a cached validator function if it exists.
6
+ *
7
+ * @param cacheKey - The cache key identifying the validator
8
+ * @returns The cached validator function, or undefined if not found
9
+ */
10
+ export declare function getCachedValidator(cacheKey: string): ValidateFunction | undefined;
11
+ /**
12
+ * @internal
13
+ *
14
+ * Stores a compiled validator function in the cache.
15
+ *
16
+ * @param cacheKey - The cache key identifying the validator
17
+ * @param validator - The compiled AJV validator function to cache
18
+ */
19
+ export declare function cacheValidator(cacheKey: string, validator: ValidateFunction): void;
20
+ /**
21
+ * @internal
22
+ *
23
+ * Clears a specific validator from the cache.
24
+ * Used in test environments to ensure test isolation.
25
+ *
26
+ * @param cacheKey - The cache key identifying the validator to clear
27
+ */
28
+ export declare function _testOnlyClearValidator(cacheKey: string): void;
29
+ /**
30
+ * @internal
31
+ *
32
+ * Clears all validators from the cache.
33
+ * Used in test environments to ensure test isolation.
34
+ */
35
+ export declare function _testOnlyClearValidatorCache(): void;
@@ -1,11 +1,11 @@
1
+ import cors from '@koa/cors';
1
2
  import { DreamApp } from '@rvoh/dream';
2
3
  import { OpenapiSchemaBody } from '@rvoh/dream/openapi';
3
4
  import { DreamAppAllowedPackageManagersEnum } from '@rvoh/dream/system';
4
5
  import { DreamAppInitOptions, DreamLogLevel, DreamLogger, EncryptOptions } from '@rvoh/dream/types';
5
- import * as bodyParser from 'body-parser';
6
6
  import { Command } from 'commander';
7
- import { CorsOptions } from 'cors';
8
- import { Express, Request, RequestHandler, Response } from 'express';
7
+ import Koa from 'koa';
8
+ import bodyParser from 'koa-bodyparser';
9
9
  import * as http from 'node:http';
10
10
  import * as https from 'node:https';
11
11
  import { OpenapiValidateTarget } from '../openapi-renderer/defaults.js';
@@ -35,7 +35,7 @@ export default class PsychicApp {
35
35
  /**
36
36
  * @internal
37
37
  */
38
- static getPsychicHttpInstance(app: Express, sslCredentials: PsychicSslCredentials | undefined): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
38
+ static getPsychicHttpInstance(app: Koa, sslCredentials: PsychicSslCredentials | undefined): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
39
39
  /**
40
40
  * Builds the routes cache if it does not already
41
41
  * exist. This is called during PsychicApp.init,
@@ -143,7 +143,7 @@ export default class PsychicApp {
143
143
  private _httpServerOptions;
144
144
  get httpServerOptions(): http.ServerOptions<typeof http.IncomingMessage, typeof http.ServerResponse> | https.ServerOptions<typeof http.IncomingMessage, typeof http.ServerResponse>;
145
145
  private _corsOptions;
146
- get corsOptions(): CorsOptions;
146
+ get corsOptions(): cors.Options;
147
147
  private _jsonOptions;
148
148
  get jsonOptions(): bodyParser.Options;
149
149
  private _cookieOptions;
@@ -156,8 +156,6 @@ export default class PsychicApp {
156
156
  get sslCredentials(): PsychicSslCredentials | undefined;
157
157
  private _saltRounds;
158
158
  get saltRounds(): number | undefined;
159
- private _sanitizeResponseJson;
160
- get sanitizeResponseJson(): boolean;
161
159
  private _packageManager;
162
160
  get packageManager(): "pnpm" | "yarn" | "npm";
163
161
  private _importExtension;
@@ -219,16 +217,15 @@ export default class PsychicApp {
219
217
  load<RT extends 'controllers' | 'services' | 'initializers'>(resourceType: RT, resourcePath: string, importCb: (path: string) => Promise<any>): Promise<void>;
220
218
  private booted;
221
219
  boot(force?: boolean): Promise<void>;
222
- use(on: PsychicUseEventType, handler: RequestHandler): void;
223
- use(handler: RequestHandler): void;
224
- use(handler: () => void): void;
220
+ use(on: PsychicUseEventType, handler: Koa.Middleware): void;
221
+ use(handler: Koa.Middleware): void;
225
222
  plugin(cb: (app: PsychicApp) => void | Promise<void>): void;
226
- on<T extends PsychicHookEventType>(hookEventType: T, cb: T extends 'server:error' ? (err: Error, req: Request, res: Response) => void | Promise<void> : T extends 'server:init:before-middleware' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:init:after-middleware' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:start' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:shutdown' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:init:after-routes' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'cli:start' ? (program: Command) => void | Promise<void> : T extends 'cli:sync' ? () => any : (conf: PsychicApp) => void | Promise<void>): void;
223
+ on<T extends PsychicHookEventType>(hookEventType: T, cb: T extends 'server:error' ? (err: Error, ctx: Koa.Context) => void | Promise<void> : T extends 'server:init:before-middleware' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:init:after-middleware' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:start' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:shutdown' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'server:init:after-routes' ? (psychicServer: PsychicServer) => void | Promise<void> : T extends 'cli:start' ? (program: Command) => void | Promise<void> : T extends 'cli:sync' ? () => any : (conf: PsychicApp) => void | Promise<void>): void;
227
224
  set(option: 'openapi', name: string, value: NamedPsychicOpenapiOptions): void;
228
- set<Opt extends PsychicAppOption>(option: Opt, value: Opt extends 'appName' ? string : Opt extends 'apiOnly' ? boolean : Opt extends 'defaultResponseHeaders' ? Record<string, string | null> : Opt extends 'httpServerOptions' ? http.ServerOptions | https.ServerOptions : Opt extends 'encryption' ? PsychicAppEncryptionOptions : Opt extends 'cors' ? CorsOptions : Opt extends 'cookie' ? CustomCookieOptions : Opt extends 'apiRoot' ? string : Opt extends 'importExtension' ? GeneratorImportStyle : Opt extends 'sessionCookieName' ? string : Opt extends 'json' ? bodyParser.Options : Opt extends 'logger' ? PsychicLogger : Opt extends 'ssl' ? PsychicSslCredentials : Opt extends 'openapi' ? DefaultPsychicOpenapiOptions : Opt extends 'paths' ? PsychicPathOptions : Opt extends 'port' ? number : Opt extends 'saltRounds' ? number : Opt extends 'sanitizeResponseJson' ? boolean : Opt extends 'packageManager' ? DreamAppAllowedPackageManagersEnum : Opt extends 'inflections' ? () => void | Promise<void> : Opt extends 'routes' ? (r: PsychicRouter) => void | Promise<void> : never): void;
225
+ set<Opt extends PsychicAppOption>(option: Opt, value: Opt extends 'appName' ? string : Opt extends 'apiOnly' ? boolean : Opt extends 'defaultResponseHeaders' ? Record<string, string | null> : Opt extends 'httpServerOptions' ? http.ServerOptions | https.ServerOptions : Opt extends 'encryption' ? PsychicAppEncryptionOptions : Opt extends 'cors' ? cors.Options : Opt extends 'cookie' ? CustomCookieOptions : Opt extends 'apiRoot' ? string : Opt extends 'importExtension' ? GeneratorImportStyle : Opt extends 'sessionCookieName' ? string : Opt extends 'json' ? bodyParser.Options : Opt extends 'logger' ? PsychicLogger : Opt extends 'ssl' ? PsychicSslCredentials : Opt extends 'openapi' ? DefaultPsychicOpenapiOptions : Opt extends 'paths' ? PsychicPathOptions : Opt extends 'port' ? number : Opt extends 'saltRounds' ? number : Opt extends 'packageManager' ? DreamAppAllowedPackageManagersEnum : Opt extends 'inflections' ? () => void | Promise<void> : Opt extends 'routes' ? (r: PsychicRouter) => void | Promise<void> : never): void;
229
226
  override<Override extends keyof PsychicAppOverrides>(override: Override, value: PsychicAppOverrides[Override]): void;
230
227
  }
231
- export type PsychicAppOption = 'appName' | 'apiOnly' | 'apiRoot' | 'httpServerOptions' | 'importExtension' | 'encryption' | 'sessionCookieName' | 'cookie' | 'cors' | 'defaultResponseHeaders' | 'inflections' | 'json' | 'logger' | 'openapi' | 'packageManager' | 'paths' | 'port' | 'routes' | 'saltRounds' | 'sanitizeResponseJson' | 'ssl';
228
+ export type PsychicAppOption = 'appName' | 'apiOnly' | 'apiRoot' | 'httpServerOptions' | 'importExtension' | 'encryption' | 'sessionCookieName' | 'cookie' | 'cors' | 'defaultResponseHeaders' | 'inflections' | 'json' | 'logger' | 'openapi' | 'packageManager' | 'paths' | 'port' | 'routes' | 'saltRounds' | 'ssl';
232
229
  export interface PsychicAppSpecialHooks {
233
230
  cliSync: (() => any)[];
234
231
  serverInitBeforeMiddleware: ((server: PsychicServer) => void | Promise<void>)[];
@@ -236,7 +233,7 @@ export interface PsychicAppSpecialHooks {
236
233
  serverInitAfterRoutes: ((server: PsychicServer) => void | Promise<void>)[];
237
234
  serverStart: ((server: PsychicServer) => void | Promise<void>)[];
238
235
  serverShutdown: ((server: PsychicServer) => void | Promise<void>)[];
239
- serverError: ((err: Error, req: Request, res: Response) => void | Promise<void>)[];
236
+ serverError: ((err: Error, ctx: Koa.Context) => void | Promise<void>)[];
240
237
  }
241
238
  export interface PsychicAppOverrides {
242
239
  ['server:start']: ((psychicServer: PsychicServer, opts: PsychicServerStartProviderOptions) => http.Server | Promise<http.Server>) | null;
@@ -1,37 +1,38 @@
1
- import { Application, Request, RequestHandler, Response, Router } from 'express';
1
+ import Koa from 'koa';
2
+ import KoaRouter from '@koa/router';
2
3
  import PsychicController from '../controller/index.js';
3
4
  import { NamespaceConfig, PsychicControllerActions } from '../router/helpers.js';
4
- import RouteManager from './route-manager.js';
5
+ import RouteManager, { KoaMiddleware } from './route-manager.js';
5
6
  import { HttpMethod, ResourcesOptions } from './types.js';
6
7
  export default class PsychicRouter {
7
- app: Application | null;
8
+ app: Koa | null;
8
9
  currentNamespaces: NamespaceConfig[];
9
10
  routeManager: RouteManager;
10
- constructor(app: Application | null);
11
+ constructor(app: Koa | null);
11
12
  get routes(): import("./route-manager.js").RouteConfig[];
12
13
  private get currentNamespacePaths();
13
14
  commit(): void;
14
15
  get(path: string): void;
15
- get(path: string, middleware: RequestHandler | RequestHandler[]): void;
16
+ get(path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
16
17
  get<T extends typeof PsychicController>(path: string, controller: T, action: PsychicControllerActions<T>): void;
17
18
  post(path: string): void;
18
- post(path: string, middleware: RequestHandler | RequestHandler[]): void;
19
+ post(path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
19
20
  post<T extends typeof PsychicController>(path: string, controller: T, action: PsychicControllerActions<T>): void;
20
21
  put(path: string): void;
21
- put(path: string, middleware: RequestHandler | RequestHandler[]): void;
22
+ put(path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
22
23
  put<T extends typeof PsychicController>(path: string, controller: T, action: PsychicControllerActions<T>): void;
23
24
  patch(path: string): void;
24
- patch(path: string, middleware: RequestHandler | RequestHandler[]): void;
25
+ patch(path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
25
26
  patch<T extends typeof PsychicController>(path: string, controller: T, action: PsychicControllerActions<T>): void;
26
27
  delete(path: string): void;
27
- delete(path: string, middleware: RequestHandler | RequestHandler[]): void;
28
+ delete(path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
28
29
  delete<T extends typeof PsychicController>(path: string, controller: T, action: PsychicControllerActions<T>): void;
29
30
  options(path: string): void;
30
- options(path: string, middleware: RequestHandler | RequestHandler[]): void;
31
+ options(path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
31
32
  options<T extends typeof PsychicController>(path: string, controller: T, action: PsychicControllerActions<T>): void;
32
33
  private prefixPathWithNamespaces;
33
34
  crud(httpMethod: HttpMethod, path: string): void;
34
- crud(httpMethod: HttpMethod, path: string, middleware: RequestHandler | RequestHandler[]): void;
35
+ crud(httpMethod: HttpMethod, path: string, middleware: KoaMiddleware | KoaMiddleware[]): void;
35
36
  crud(httpMethod: HttpMethod, path: string, controller: typeof PsychicController, action: string): void;
36
37
  private checkPathForInvalidChars;
37
38
  namespace(namespace: string, cb: (router: PsychicNestedRouter) => void): void;
@@ -62,15 +63,14 @@ export default class PsychicRouter {
62
63
  * By default, do not provide an attacker with any visibility into which layer
63
64
  * of the application rejected their request.
64
65
  */
65
- handle(controller: typeof PsychicController, action: string, { req, res, }: {
66
- req: Request;
67
- res: Response;
66
+ handle(controller: typeof PsychicController, action: string, { ctx, }: {
67
+ ctx: Koa.Context;
68
68
  }): Promise<void>;
69
- _initializeController(ControllerClass: typeof PsychicController, req: Request, res: Response, action: string): PsychicController;
69
+ _initializeController(ControllerClass: typeof PsychicController, ctx: Koa.Context, action: string): PsychicController;
70
70
  }
71
71
  export declare class PsychicNestedRouter extends PsychicRouter {
72
- router: Router;
73
- constructor(expressApp: Application | null, routeManager: RouteManager, { namespaces, }?: {
72
+ router: KoaRouter;
73
+ constructor(koaApp: Koa | null, routeManager: RouteManager, { namespaces, }?: {
74
74
  namespaces?: NamespaceConfig[];
75
75
  });
76
76
  }
@@ -1,6 +1,7 @@
1
- import { RequestHandler } from 'express';
1
+ import Koa from 'koa';
2
2
  import PsychicController from '../controller/index.js';
3
3
  import { HttpMethod } from './types.js';
4
+ export type KoaMiddleware = Koa.Middleware;
4
5
  export default class RouteManager {
5
6
  routes: RouteConfig[];
6
7
  addRoute({ httpMethod, path, controller, action, }: {
@@ -12,7 +13,7 @@ export default class RouteManager {
12
13
  addMiddleware({ httpMethod, path, middleware, }: {
13
14
  httpMethod: HttpMethod;
14
15
  path: string;
15
- middleware: RequestHandler | RequestHandler[];
16
+ middleware: KoaMiddleware | KoaMiddleware[];
16
17
  }): void;
17
18
  }
18
19
  export type RouteConfig = ControllerActionRouteConfig | MiddlewareRouteConfig;
@@ -25,6 +26,6 @@ export type ControllerActionRouteConfig = BaseRouteConfig & {
25
26
  action: string;
26
27
  };
27
28
  export type MiddlewareRouteConfig = BaseRouteConfig & {
28
- middleware: RequestHandler | RequestHandler[];
29
+ middleware: KoaMiddleware | KoaMiddleware[];
29
30
  };
30
31
  export {};
@@ -1,12 +1,12 @@
1
- import { Express } from 'express';
1
+ import Koa from 'koa';
2
2
  import * as http from 'node:http';
3
3
  import { Server } from 'node:http';
4
4
  import * as https from 'node:https';
5
5
  import { PsychicSslCredentials } from '../../psychic-app/index.js';
6
6
  export interface StartPsychicServerOptions {
7
- app: Express;
7
+ app: Koa;
8
8
  port: number;
9
9
  sslCredentials: PsychicSslCredentials | undefined;
10
10
  }
11
11
  export default function startPsychicServer({ app, port, sslCredentials, }: StartPsychicServerOptions): Promise<Server>;
12
- export declare function createPsychicHttpInstance(app: Express, sslCredentials: PsychicSslCredentials | undefined): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
12
+ export declare function createPsychicHttpInstance(app: Koa, sslCredentials: PsychicSslCredentials | undefined): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
@@ -1,11 +1,11 @@
1
- import { Express } from 'express';
1
+ import Koa from 'koa';
2
2
  import { Server } from 'node:http';
3
3
  import { PsychicSslCredentials } from '../psychic-app/index.js';
4
4
  import { StartPsychicServerOptions } from './helpers/startPsychicServer.js';
5
5
  export default class PsychicServer {
6
6
  static startPsychicServer(opts: StartPsychicServerOptions): Promise<Server>;
7
- static createPsychicHttpInstance(app: Express, sslCredentials: PsychicSslCredentials | undefined): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
8
- expressApp: Express;
7
+ static createPsychicHttpInstance(app: Koa, sslCredentials: PsychicSslCredentials | undefined): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
8
+ koaApp: Koa;
9
9
  httpServer: Server;
10
10
  private booted;
11
11
  constructor();
@@ -1,12 +1,20 @@
1
- import { CookieOptions, Request, Response } from 'express';
1
+ import Koa from 'koa';
2
2
  import { CustomCookieOptions } from '../psychic-app/index.js';
3
3
  export default class Session {
4
- private req;
5
- private res;
6
- constructor(req: Request, res: Response);
4
+ private ctx;
5
+ constructor(ctx: Koa.Context);
7
6
  getCookie(name: string): unknown;
8
7
  setCookie(name: string, data: string, opts?: CustomSessionCookieOptions): void;
9
8
  clearCookie(name: string): void;
10
9
  daysToMilliseconds(numDays: number): number;
11
10
  }
12
- export type CustomSessionCookieOptions = Omit<CookieOptions, 'maxAge'> & CustomCookieOptions;
11
+ export interface CustomSessionCookieOptions extends CustomCookieOptions {
12
+ secure?: boolean;
13
+ httpOnly?: boolean;
14
+ domain?: string;
15
+ path?: string;
16
+ sameSite?: 'strict' | 'lax' | 'none' | boolean;
17
+ expires?: Date;
18
+ signed?: boolean;
19
+ overwrite?: boolean;
20
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@rvoh/psychic",
4
4
  "description": "Typescript web framework",
5
- "version": "2.3.9",
5
+ "version": "3.0.0-alpha.2",
6
6
  "author": "RVOHealth",
7
7
  "repository": {
8
8
  "type": "git",
@@ -66,34 +66,41 @@
66
66
  "prepack": "pnpm build"
67
67
  },
68
68
  "dependencies": {
69
- "@types/cookie-parser": "^1.4.8",
70
- "@types/cors": "^2.8.17",
71
69
  "ajv": "^8.17.1",
72
70
  "ajv-formats": "^3.0.1",
73
- "body-parser": "^2.2.1",
74
71
  "commander": "^12.1.0",
75
- "cookie-parser": "^1.4.7",
76
- "cors": "^2.8.5",
77
72
  "dotenv": "^16.4.5",
73
+ "fast-json-stringify": "^6.3.0",
78
74
  "pluralize-esm": "^9.0.5",
79
75
  "yoctocolors": "^2.1.1"
80
76
  },
81
77
  "peerDependencies": {
82
- "@rvoh/dream": "^2.3.0",
83
- "@types/express": "^5.0.1",
78
+ "@koa/cors": "^5.0.0",
79
+ "@koa/router": "^15.3.0",
80
+ "@rvoh/dream": "^2.3.1",
81
+ "@types/koa": "^2.15.0",
82
+ "@types/koa__router": "^12.0.5",
84
83
  "commander": "^12.1.0",
85
- "express": "^5.2.1",
84
+ "koa": "^2.15.3",
85
+ "koa-bodyparser": "^4.4.1",
86
+ "koa-conditional-get": "^3.0.0",
87
+ "koa-etag": "^5.0.0",
86
88
  "openapi-typescript": "^7.8.0"
87
89
  },
88
90
  "devDependencies": {
89
91
  "@eslint/js": "^9.39.1",
90
- "@jest-mock/express": "^3.0.0",
91
- "@rvoh/dream": "^2.3.0",
92
+ "@koa/cors": "^5.0.0",
93
+ "@koa/router": "^15.3.0",
94
+ "@rvoh/dream": "^2.3.1",
92
95
  "@rvoh/dream-spec-helpers": "^2.1.1",
93
- "@rvoh/psychic-spec-helpers": "^2.0.0",
94
- "@types/body-parser": "^1.19.6",
95
- "@types/express": "^5.0.6",
96
- "@types/express-session": "^1.18.2",
96
+ "@rvoh/psychic-spec-helpers": "^3.0.0-alpha.1",
97
+ "@types/koa": "^2.15.0",
98
+ "@types/koa-bodyparser": "^4.3.12",
99
+ "@types/koa-conditional-get": "^2.0.3",
100
+ "@types/koa-etag": "^3.0.3",
101
+ "@types/koa-passport": "^6.0.3",
102
+ "@types/koa__cors": "^5.0.0",
103
+ "@types/koa__router": "^12.0.5",
97
104
  "@types/node": "^22.17.1",
98
105
  "@types/passport": "^0",
99
106
  "@types/passport-local": "^1",
@@ -102,9 +109,13 @@
102
109
  "@typescript-eslint/parser": "^8.48.1",
103
110
  "@typescript/analyze-trace": "^0.10.1",
104
111
  "eslint": "^9.39.1",
105
- "express": "^5.2.1",
106
- "express-session": "^1.18.2",
107
112
  "jsdom": "^26.1.0",
113
+ "koa": "^2.15.3",
114
+ "koa-bodyparser": "^4.4.1",
115
+ "koa-conditional-get": "^3.0.0",
116
+ "koa-etag": "^4.0.0",
117
+ "koa-passport": "^6.0.0",
118
+ "koa-session": "^7.0.2",
108
119
  "kysely": "^0.28.5",
109
120
  "kysely-codegen": "~0.19.0",
110
121
  "luxon-jest-matchers": "^0.1.14",
@@ -117,7 +128,7 @@
117
128
  "puppeteer": "^24.22.3",
118
129
  "supertest": "^7.1.4",
119
130
  "tslib": "^2.7.0",
120
- "tsx": "^4.19.3",
131
+ "tsx": "^4.21.0",
121
132
  "typedoc": "^0.26.6",
122
133
  "typescript": "^5.5.4",
123
134
  "typescript-eslint": "^8.48.1",
@@ -1,12 +0,0 @@
1
- export default class CannotCommitRoutesWithoutExpressApp extends Error {
2
- get message() {
3
- return `
4
- When instantiating a PsychicRouter, if no express app is provided as the
5
- first argument, you are not able to commit your routes. Make sure
6
- to provide an actual express app before commiting, like so:
7
-
8
- const app = express()
9
- new PsychicRouter(app, ...)
10
- `;
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- export default class CannotCommitRoutesWithoutExpressApp extends Error {
2
- get message() {
3
- return `
4
- When instantiating a PsychicRouter, if no express app is provided as the
5
- first argument, you are not able to commit your routes. Make sure
6
- to provide an actual express app before commiting, like so:
7
-
8
- const app = express()
9
- new PsychicRouter(app, ...)
10
- `;
11
- }
12
- }
@@ -1,3 +0,0 @@
1
- export default class CannotCommitRoutesWithoutExpressApp extends Error {
2
- get message(): string;
3
- }