@technomoron/apicore-server 1.0.0-beta.1

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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/api-module.cjs +34 -0
  3. package/dist/cjs/api-module.d.ts +45 -0
  4. package/dist/cjs/apicore-server.cjs +1561 -0
  5. package/dist/cjs/apicore-server.d.ts +288 -0
  6. package/dist/cjs/auth-api/auth-module.cjs +1248 -0
  7. package/dist/cjs/auth-api/auth-module.d.ts +116 -0
  8. package/dist/cjs/auth-api/compat-auth-storage.cjs +128 -0
  9. package/dist/cjs/auth-api/compat-auth-storage.d.ts +57 -0
  10. package/dist/cjs/auth-api/mem-auth-store.cjs +121 -0
  11. package/dist/cjs/auth-api/mem-auth-store.d.ts +68 -0
  12. package/dist/cjs/auth-api/module.cjs +25 -0
  13. package/dist/cjs/auth-api/module.d.ts +20 -0
  14. package/dist/cjs/auth-api/schemas.cjs +171 -0
  15. package/dist/cjs/auth-api/schemas.d.ts +21 -0
  16. package/dist/cjs/auth-api/sql-auth-store.cjs +179 -0
  17. package/dist/cjs/auth-api/sql-auth-store.d.ts +87 -0
  18. package/dist/cjs/auth-api/storage.cjs +102 -0
  19. package/dist/cjs/auth-api/storage.d.ts +38 -0
  20. package/dist/cjs/auth-api/types.cjs +2 -0
  21. package/dist/cjs/auth-api/types.d.ts +34 -0
  22. package/dist/cjs/auth-api/user-id.cjs +47 -0
  23. package/dist/cjs/auth-api/user-id.d.ts +5 -0
  24. package/dist/cjs/auth-cookie-options.cjs +66 -0
  25. package/dist/cjs/auth-cookie-options.d.ts +13 -0
  26. package/dist/cjs/base/client-info.cjs +285 -0
  27. package/dist/cjs/base/client-info.d.ts +27 -0
  28. package/dist/cjs/base/error-utils.cjs +50 -0
  29. package/dist/cjs/base/error-utils.d.ts +16 -0
  30. package/dist/cjs/base/request-utils.cjs +27 -0
  31. package/dist/cjs/base/request-utils.d.ts +8 -0
  32. package/dist/cjs/index.cjs +51 -0
  33. package/dist/cjs/index.d.ts +34 -0
  34. package/dist/cjs/limiter/auth-rate-limiter.cjs +35 -0
  35. package/dist/cjs/limiter/auth-rate-limiter.d.ts +12 -0
  36. package/dist/cjs/limiter/fixed-window.cjs +41 -0
  37. package/dist/cjs/limiter/fixed-window.d.ts +11 -0
  38. package/dist/cjs/oauth/base.cjs +7 -0
  39. package/dist/cjs/oauth/base.d.ts +17 -0
  40. package/dist/cjs/oauth/memory.cjs +135 -0
  41. package/dist/cjs/oauth/memory.d.ts +22 -0
  42. package/dist/cjs/oauth/models.cjs +47 -0
  43. package/dist/cjs/oauth/models.d.ts +50 -0
  44. package/dist/cjs/oauth/sequelize.cjs +159 -0
  45. package/dist/cjs/oauth/sequelize.d.ts +30 -0
  46. package/dist/cjs/oauth/types.cjs +3 -0
  47. package/dist/cjs/oauth/types.d.ts +51 -0
  48. package/dist/cjs/passkey/base.cjs +7 -0
  49. package/dist/cjs/passkey/base.d.ts +28 -0
  50. package/dist/cjs/passkey/config.cjs +26 -0
  51. package/dist/cjs/passkey/config.d.ts +2 -0
  52. package/dist/cjs/passkey/memory.cjs +123 -0
  53. package/dist/cjs/passkey/memory.d.ts +34 -0
  54. package/dist/cjs/passkey/models.cjs +142 -0
  55. package/dist/cjs/passkey/models.d.ts +34 -0
  56. package/dist/cjs/passkey/sequelize.cjs +126 -0
  57. package/dist/cjs/passkey/sequelize.d.ts +42 -0
  58. package/dist/cjs/passkey/service.cjs +413 -0
  59. package/dist/cjs/passkey/service.d.ts +21 -0
  60. package/dist/cjs/passkey/types.cjs +2 -0
  61. package/dist/cjs/passkey/types.d.ts +84 -0
  62. package/dist/cjs/sequelize-utils.cjs +56 -0
  63. package/dist/cjs/sequelize-utils.d.ts +8 -0
  64. package/dist/cjs/token/base.cjs +120 -0
  65. package/dist/cjs/token/base.d.ts +46 -0
  66. package/dist/cjs/token/memory.cjs +234 -0
  67. package/dist/cjs/token/memory.d.ts +29 -0
  68. package/dist/cjs/token/sequelize.cjs +400 -0
  69. package/dist/cjs/token/sequelize.d.ts +58 -0
  70. package/dist/cjs/token/types.cjs +2 -0
  71. package/dist/cjs/token/types.d.ts +34 -0
  72. package/dist/cjs/upload/memory.cjs +92 -0
  73. package/dist/cjs/upload/memory.d.ts +17 -0
  74. package/dist/cjs/upload/tus-module.cjs +270 -0
  75. package/dist/cjs/upload/tus-module.d.ts +38 -0
  76. package/dist/cjs/upload/types.cjs +2 -0
  77. package/dist/cjs/upload/types.d.ts +28 -0
  78. package/dist/cjs/user/base.cjs +53 -0
  79. package/dist/cjs/user/base.d.ts +36 -0
  80. package/dist/cjs/user/memory.cjs +194 -0
  81. package/dist/cjs/user/memory.d.ts +37 -0
  82. package/dist/cjs/user/sequelize.cjs +194 -0
  83. package/dist/cjs/user/sequelize.d.ts +46 -0
  84. package/dist/cjs/user/types.cjs +2 -0
  85. package/dist/cjs/user/types.d.ts +11 -0
  86. package/dist/esm/api-module.d.ts +45 -0
  87. package/dist/esm/api-module.js +30 -0
  88. package/dist/esm/apicore-server.d.ts +288 -0
  89. package/dist/esm/apicore-server.js +1552 -0
  90. package/dist/esm/auth-api/auth-module.d.ts +116 -0
  91. package/dist/esm/auth-api/auth-module.js +1246 -0
  92. package/dist/esm/auth-api/compat-auth-storage.d.ts +57 -0
  93. package/dist/esm/auth-api/compat-auth-storage.js +124 -0
  94. package/dist/esm/auth-api/mem-auth-store.d.ts +68 -0
  95. package/dist/esm/auth-api/mem-auth-store.js +117 -0
  96. package/dist/esm/auth-api/module.d.ts +20 -0
  97. package/dist/esm/auth-api/module.js +21 -0
  98. package/dist/esm/auth-api/schemas.d.ts +21 -0
  99. package/dist/esm/auth-api/schemas.js +168 -0
  100. package/dist/esm/auth-api/sql-auth-store.d.ts +87 -0
  101. package/dist/esm/auth-api/sql-auth-store.js +175 -0
  102. package/dist/esm/auth-api/storage.d.ts +38 -0
  103. package/dist/esm/auth-api/storage.js +98 -0
  104. package/dist/esm/auth-api/types.d.ts +34 -0
  105. package/dist/esm/auth-api/types.js +1 -0
  106. package/dist/esm/auth-api/user-id.d.ts +5 -0
  107. package/dist/esm/auth-api/user-id.js +41 -0
  108. package/dist/esm/auth-cookie-options.d.ts +13 -0
  109. package/dist/esm/auth-cookie-options.js +63 -0
  110. package/dist/esm/base/client-info.d.ts +27 -0
  111. package/dist/esm/base/client-info.js +282 -0
  112. package/dist/esm/base/error-utils.d.ts +16 -0
  113. package/dist/esm/base/error-utils.js +44 -0
  114. package/dist/esm/base/request-utils.d.ts +8 -0
  115. package/dist/esm/base/request-utils.js +23 -0
  116. package/dist/esm/index.d.ts +34 -0
  117. package/dist/esm/index.js +21 -0
  118. package/dist/esm/limiter/auth-rate-limiter.d.ts +12 -0
  119. package/dist/esm/limiter/auth-rate-limiter.js +32 -0
  120. package/dist/esm/limiter/fixed-window.d.ts +11 -0
  121. package/dist/esm/limiter/fixed-window.js +37 -0
  122. package/dist/esm/oauth/base.d.ts +17 -0
  123. package/dist/esm/oauth/base.js +3 -0
  124. package/dist/esm/oauth/memory.d.ts +22 -0
  125. package/dist/esm/oauth/memory.js +128 -0
  126. package/dist/esm/oauth/models.d.ts +50 -0
  127. package/dist/esm/oauth/models.js +38 -0
  128. package/dist/esm/oauth/sequelize.d.ts +30 -0
  129. package/dist/esm/oauth/sequelize.js +148 -0
  130. package/dist/esm/oauth/types.d.ts +51 -0
  131. package/dist/esm/oauth/types.js +2 -0
  132. package/dist/esm/passkey/base.d.ts +28 -0
  133. package/dist/esm/passkey/base.js +3 -0
  134. package/dist/esm/passkey/config.d.ts +2 -0
  135. package/dist/esm/passkey/config.js +23 -0
  136. package/dist/esm/passkey/memory.d.ts +34 -0
  137. package/dist/esm/passkey/memory.js +119 -0
  138. package/dist/esm/passkey/models.d.ts +34 -0
  139. package/dist/esm/passkey/models.js +135 -0
  140. package/dist/esm/passkey/sequelize.d.ts +42 -0
  141. package/dist/esm/passkey/sequelize.js +122 -0
  142. package/dist/esm/passkey/service.d.ts +21 -0
  143. package/dist/esm/passkey/service.js +376 -0
  144. package/dist/esm/passkey/types.d.ts +84 -0
  145. package/dist/esm/passkey/types.js +1 -0
  146. package/dist/esm/sequelize-utils.d.ts +8 -0
  147. package/dist/esm/sequelize-utils.js +47 -0
  148. package/dist/esm/token/base.d.ts +46 -0
  149. package/dist/esm/token/base.js +113 -0
  150. package/dist/esm/token/memory.d.ts +29 -0
  151. package/dist/esm/token/memory.js +230 -0
  152. package/dist/esm/token/sequelize.d.ts +58 -0
  153. package/dist/esm/token/sequelize.js +396 -0
  154. package/dist/esm/token/types.d.ts +34 -0
  155. package/dist/esm/token/types.js +1 -0
  156. package/dist/esm/upload/memory.d.ts +17 -0
  157. package/dist/esm/upload/memory.js +86 -0
  158. package/dist/esm/upload/tus-module.d.ts +38 -0
  159. package/dist/esm/upload/tus-module.js +266 -0
  160. package/dist/esm/upload/types.d.ts +28 -0
  161. package/dist/esm/upload/types.js +1 -0
  162. package/dist/esm/user/base.d.ts +36 -0
  163. package/dist/esm/user/base.js +46 -0
  164. package/dist/esm/user/memory.d.ts +37 -0
  165. package/dist/esm/user/memory.js +190 -0
  166. package/dist/esm/user/sequelize.d.ts +46 -0
  167. package/dist/esm/user/sequelize.js +188 -0
  168. package/dist/esm/user/types.d.ts +11 -0
  169. package/dist/esm/user/types.js +1 -0
  170. package/docs/swagger/openapi.json +2162 -0
  171. package/package.json +131 -0
@@ -0,0 +1,288 @@
1
+ /**
2
+ * Copyright (c) 2025 Bjørn Erik Jacobsen / Technomoron
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type FastifyInstance, type FastifyReply, type FastifyRequest } from 'fastify';
8
+ import { ApiModule } from './api-module.js';
9
+ import { type ClientInfo } from './base/client-info.js';
10
+ import { TokenStore, type JwtDecodeResult, type JwtSignPayload, type JwtSignResult, type JwtVerifyResult } from './token/base.js';
11
+ import type { ApiAuthClass, ApiAuthType, ApiHandler, ApiKey } from './api-module.js';
12
+ import type { AuthProviderModule } from './auth-api/module.js';
13
+ import type { AuthAdapter, AuthIdentifier } from './auth-api/types.js';
14
+ import type { AuthCodeData, AuthCodeRequest, OAuthClient } from './oauth/types.js';
15
+ import type { PasskeyChallenge, PasskeyChallengeParams, StoredPasskeyCredential, PasskeyVerificationParams, PasskeyVerificationResult } from './passkey/types.js';
16
+ import type { Token } from './token/types.js';
17
+ import type { JwtPayload, SignOptions, VerifyOptions } from 'jsonwebtoken';
18
+ export type { JwtPayload, SignOptions, VerifyOptions } from 'jsonwebtoken';
19
+ export type { ClientAgentProfile, ClientInfo } from './base/client-info.js';
20
+ export interface ApiCookieOptions {
21
+ httpOnly?: boolean;
22
+ secure?: boolean;
23
+ sameSite?: 'lax' | 'strict' | 'none';
24
+ domain?: string;
25
+ path?: string;
26
+ maxAge?: number;
27
+ expires?: Date;
28
+ }
29
+ export interface ApiUploadedFile {
30
+ fieldname: string;
31
+ originalname: string;
32
+ encoding: string;
33
+ mimetype: string;
34
+ size?: number;
35
+ buffer?: Buffer;
36
+ filepath?: string;
37
+ }
38
+ export interface ExtendedReq {
39
+ method: string;
40
+ url: string;
41
+ originalUrl?: string;
42
+ headers: Record<string, string | string[] | undefined>;
43
+ query: Record<string, unknown>;
44
+ body: unknown;
45
+ params: Record<string, unknown>;
46
+ cookies?: Record<string, string>;
47
+ ip?: string;
48
+ ips?: string[];
49
+ socket?: {
50
+ remoteAddress?: string;
51
+ };
52
+ protocol?: string;
53
+ file?: ApiUploadedFile;
54
+ files?: ApiUploadedFile[] | Record<string, ApiUploadedFile[]>;
55
+ apiReq?: ApiRequest;
56
+ }
57
+ export interface ApiResponse {
58
+ locals: Record<string, unknown>;
59
+ headersSent: boolean;
60
+ status: (code: number) => ApiResponse;
61
+ json: (payload: unknown) => void;
62
+ send: (payload: unknown) => void;
63
+ cookie: (name: string, value: string, options?: ApiCookieOptions) => void;
64
+ clearCookie: (name: string, options?: ApiCookieOptions) => void;
65
+ }
66
+ export interface ApiTokenData extends JwtPayload, Partial<Token> {
67
+ uid: unknown;
68
+ iat?: number;
69
+ exp?: number;
70
+ }
71
+ export type ApiAuthMethod = 'bearer' | 'cookie' | 'param' | 'apikey' | null;
72
+ export interface ApiRequest {
73
+ server: ApiServer;
74
+ req: ExtendedReq;
75
+ res: ApiResponse;
76
+ tokenData?: ApiTokenData | null;
77
+ token?: string;
78
+ authToken?: Token | null;
79
+ apiKey?: ApiKey | null;
80
+ authMethod?: ApiAuthMethod;
81
+ clientInfo?: ClientInfo;
82
+ realUid?: AuthIdentifier | null;
83
+ getClientInfo: () => ClientInfo;
84
+ getClientIp: () => string | null;
85
+ getClientIpChain: () => string[];
86
+ getRealUid: () => AuthIdentifier | null;
87
+ isImpersonating: () => boolean;
88
+ }
89
+ export type ExpressApiRequest = ExtendedReq;
90
+ export interface ExpressApiLocals {
91
+ apiReq?: ApiRequest;
92
+ }
93
+ type CompatNext = (error?: unknown) => void;
94
+ type CompatRequestHandler = (req: ExtendedReq, res: ApiResponse, next: CompatNext) => unknown;
95
+ type CompatErrorHandler = (err: unknown, req: ExtendedReq, res: ApiResponse, next: CompatNext) => unknown;
96
+ export { ApiModule } from './api-module.js';
97
+ export type { ApiHandler, ApiAuthType, ApiAuthClass, ApiRoute, ApiKey } from './api-module.js';
98
+ export interface ApiErrorParams {
99
+ code?: number;
100
+ message?: unknown;
101
+ data?: unknown;
102
+ errors?: Record<string, string>;
103
+ }
104
+ export declare class ApiError extends Error {
105
+ code: number;
106
+ data: unknown;
107
+ errors: Record<string, string>;
108
+ constructor({ code, message, data, errors }: ApiErrorParams);
109
+ }
110
+ export interface ApiServerConf {
111
+ apiPort: number;
112
+ apiHost: string;
113
+ uploadPath: string;
114
+ uploadMax: number;
115
+ staticDirs?: Record<string, string>;
116
+ origins: string[];
117
+ debug: boolean;
118
+ apiBasePath: string;
119
+ swaggerEnabled?: boolean;
120
+ swaggerPath?: string;
121
+ accessSecret: string;
122
+ refreshSecret: string;
123
+ cookieDomain: string;
124
+ cookiePath?: string;
125
+ cookieSameSite?: 'lax' | 'strict' | 'none';
126
+ cookieSecure?: boolean | 'auto';
127
+ cookieHttpOnly?: boolean;
128
+ apiKeyPrefix: string;
129
+ apiKeyEnabled: boolean;
130
+ tokenParam: string;
131
+ tokenParamLocation: 'body' | 'query' | 'body-query';
132
+ accessCookie: string;
133
+ refreshCookie: string;
134
+ accessExpiry: number;
135
+ refreshExpiry: number;
136
+ sessionRefreshExpiry: number;
137
+ authApi: boolean;
138
+ devMode: boolean;
139
+ hydrateGetBody: boolean;
140
+ validateTokens: boolean;
141
+ refreshMaybe: boolean;
142
+ apiVersion: string;
143
+ minClientVersion: string;
144
+ tokenStore?: TokenStore;
145
+ onStartError?: (error: Error) => void;
146
+ /**
147
+ * Controls trust in proxy headers (X-Forwarded-For, Forwarded, X-Real-IP).
148
+ * - `true` (default): trust all forwarded headers
149
+ * - `false`: only use the socket address, ignore forwarded headers
150
+ * - number: trust that many rightmost forwarded entries (e.g., 1 = one reverse proxy)
151
+ */
152
+ trustProxy: boolean | number;
153
+ }
154
+ /** Core Fastify-based API server with module mounting and auth integration hooks. */
155
+ export declare class ApiServer {
156
+ readonly app: ((req: import('node:http').IncomingMessage, res: import('node:http').ServerResponse) => void) & {
157
+ listen: (...args: unknown[]) => import('node:http').Server;
158
+ };
159
+ readonly fastify: FastifyInstance;
160
+ readonly config: ApiServerConf;
161
+ readonly startedAt: number;
162
+ private readonly apiBasePath;
163
+ private finalized;
164
+ private storageAdapter;
165
+ private moduleAdapter;
166
+ private apiErrorHandlerInstalled;
167
+ private tokenStoreAdapter;
168
+ private readonly jwtHelper;
169
+ private compatGlobalErrorHandler;
170
+ private readonly readyPromise;
171
+ private currReqDeprecationWarned;
172
+ get currReq(): ApiRequest | null;
173
+ set currReq(_value: ApiRequest | null);
174
+ constructor(config?: Partial<ApiServerConf>);
175
+ private setupRuntime;
176
+ private readRawBody;
177
+ private parseRawBody;
178
+ private assertNotFinalized;
179
+ finalize(): this;
180
+ authStorage<UserRow, SafeUser>(storage: AuthAdapter<UserRow, SafeUser>): this;
181
+ useAuthStorage<UserRow, SafeUser>(storage: AuthAdapter<UserRow, SafeUser>): this;
182
+ authModule<UserRow>(module: AuthProviderModule<UserRow>): this;
183
+ useAuthModule<UserRow>(module: AuthProviderModule<UserRow>): this;
184
+ getAuthStorage<UserRow = unknown, SafeUser = unknown>(): AuthAdapter<UserRow, SafeUser>;
185
+ getAuthModule<UserRow = unknown>(): AuthProviderModule<UserRow>;
186
+ setTokenStore(store: TokenStore): this;
187
+ getTokenStore(): TokenStore | null;
188
+ listUserCredentials(userId: AuthIdentifier): Promise<StoredPasskeyCredential[]>;
189
+ deletePasskeyCredential(credentialId: Buffer | string): Promise<boolean>;
190
+ getUser(identifier: AuthIdentifier): Promise<unknown | null>;
191
+ getUserPasswordHash(user: unknown): string;
192
+ getUserId(user: unknown): AuthIdentifier;
193
+ filterUser(user: unknown): unknown;
194
+ verifyPassword(password: string, hash: string): Promise<boolean>;
195
+ storeToken(data: Token): Promise<void>;
196
+ getToken(query: Partial<Token> & {
197
+ userId?: AuthIdentifier;
198
+ ruid?: AuthIdentifier;
199
+ }, opts?: {
200
+ includeExpired?: boolean;
201
+ }): Promise<Token | null>;
202
+ deleteToken(query: Partial<Token> & {
203
+ userId?: AuthIdentifier;
204
+ ruid?: AuthIdentifier;
205
+ }): Promise<number>;
206
+ createPasskeyChallenge(params: PasskeyChallengeParams): Promise<PasskeyChallenge>;
207
+ verifyPasskeyResponse(params: PasskeyVerificationParams): Promise<PasskeyVerificationResult>;
208
+ getClient(clientId: string): Promise<OAuthClient | null>;
209
+ verifyClientSecret(client: OAuthClient, clientSecret: string | null): Promise<boolean>;
210
+ createAuthCode(request: AuthCodeRequest): Promise<AuthCodeData>;
211
+ consumeAuthCode(code: string, clientId: string): Promise<AuthCodeData | null>;
212
+ canImpersonate(params: {
213
+ realUserId: AuthIdentifier;
214
+ effectiveUserId: AuthIdentifier;
215
+ }): Promise<boolean>;
216
+ jwtSign(payload: JwtSignPayload, secret: string, expiresInSeconds: number, options?: SignOptions): JwtSignResult;
217
+ jwtVerify<T>(token: string, secret: string, options?: VerifyOptions): JwtVerifyResult<T>;
218
+ jwtDecode<T>(token: string, options?: import('jsonwebtoken').DecodeOptions): JwtDecodeResult<T>;
219
+ getApiKey<T = ApiKey>(token: string): Promise<T | null>;
220
+ authenticateUser(params: {
221
+ login: string;
222
+ password: string;
223
+ }): Promise<boolean>;
224
+ updateToken(updates: Partial<Token> & {
225
+ refreshToken: string;
226
+ }): Promise<boolean>;
227
+ guessExceptionText(error: unknown, defMsg?: string): string;
228
+ protected authorize(apiReq: ApiRequest, requiredClass: ApiAuthClass): Promise<void>;
229
+ /**
230
+ * Authenticate and authorise an incoming Fastify request outside of the
231
+ * standard `defineRoutes` pipeline (e.g. TUS upload routes that need full
232
+ * control over their own response format).
233
+ *
234
+ * Throws `ApiError` on auth failure — callers should catch it and respond
235
+ * with the appropriate HTTP status code.
236
+ */
237
+ resolveRequest(request: FastifyRequest, reply: FastifyReply, auth: {
238
+ type: ApiAuthType;
239
+ req?: ApiAuthClass;
240
+ }): Promise<ApiRequest>;
241
+ private installStaticDirs;
242
+ private installPingHandler;
243
+ private loadSwaggerSpec;
244
+ private readPackageVersion;
245
+ private installSwaggerHandler;
246
+ private normalizeApiBasePath;
247
+ private installApiNotFoundHandler;
248
+ private installApiErrorHandler;
249
+ start(): this;
250
+ private internalServerErrorMessage;
251
+ private logUnhandledError;
252
+ private verifyJWT;
253
+ private jwtCookieOptions;
254
+ private setAccessCookie;
255
+ private tryRefreshAccessToken;
256
+ private authenticate;
257
+ private tryAuthenticateApiKey;
258
+ private resolveTokenFromRequest;
259
+ private readNamedValue;
260
+ private requiresAuthToken;
261
+ private shouldValidateStoredToken;
262
+ private assertStoredAccessToken;
263
+ private normalizeAuthIdentifier;
264
+ private extractTokenUserId;
265
+ private resolveRealUserId;
266
+ private toExtendedReq;
267
+ private createApiRequest;
268
+ useExpress(path: string, ...handlers: Array<CompatRequestHandler | CompatErrorHandler>): this;
269
+ useExpress(...handlers: Array<CompatRequestHandler | CompatErrorHandler>): this;
270
+ private runCompatHandlers;
271
+ private runCompatErrorHandlers;
272
+ expressAuth(auth: {
273
+ type: ApiAuthType;
274
+ req: ApiAuthClass;
275
+ }): CompatRequestHandler;
276
+ expressErrorHandler(): CompatErrorHandler;
277
+ private handleRequest;
278
+ protected handle_request(handler: ApiHandler, auth: {
279
+ type: ApiAuthType;
280
+ req: ApiAuthClass;
281
+ }): (req: ExtendedReq, res: ApiResponse, next: (error?: unknown) => void) => Promise<void>;
282
+ api<T extends ApiModule<unknown>>(module: T): this;
283
+ private joinRoutePath;
284
+ dumpRequest(apiReq: ApiRequest): void;
285
+ private formatDebugValue;
286
+ dumpResponse(apiReq: ApiRequest, payload: unknown, status: number): void;
287
+ }
288
+ export default ApiServer;