@aeriajs/types 0.0.134 → 0.0.135

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 (2) hide show
  1. package/dist/config.d.ts +7 -3
  2. package/package.json +1 -1
package/dist/config.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import type { RouteContext } from './context.js';
2
- import type { RouteUri } from './http.js';
2
+ import type { GenericRequest, GenericResponse, RouteUri } from './http.js';
3
3
  import type { RateLimitingParams } from './security.js';
4
4
  import type { CollectionItem } from './collection.js';
5
- import type { UserRole } from './token.js';
5
+ import type { Token, UserRole } from './token.js';
6
+ import type { Result } from './result.js';
6
7
  export type RolesHierarchy = Record<UserRole, readonly UserRole[] | boolean>;
8
+ export type GetTokenFunction = (request: GenericRequest, context: RouteContext) => Promise<Result.Either<unknown, Token>>;
9
+ export type CorsFunction = (req: GenericRequest, res: GenericResponse, config: CorsConfig) => Promise<null | undefined>;
7
10
  export type CorsConfig = {
8
11
  allowOrigin?: readonly string[];
9
12
  allowMethods?: readonly string[];
@@ -15,7 +18,8 @@ export type ServerOptions = {
15
18
  port?: number;
16
19
  enableLogging?: boolean;
17
20
  noWarmup?: boolean;
18
- cors?: CorsConfig | null;
21
+ cors?: null | CorsConfig | CorsFunction;
22
+ getToken?: GetTokenFunction;
19
23
  };
20
24
  export type ApiConfig = {
21
25
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.134",
3
+ "version": "0.0.135",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",