@technomoron/api-server-base 2.0.0-beta.2 → 2.0.0-beta.21

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 (115) hide show
  1. package/README.txt +81 -28
  2. package/dist/cjs/api-module.cjs +9 -0
  3. package/dist/cjs/api-module.d.ts +7 -4
  4. package/dist/cjs/api-server-base.cjs +607 -99
  5. package/dist/cjs/api-server-base.d.ts +80 -23
  6. package/dist/cjs/auth-api/auth-module.d.ts +23 -3
  7. package/dist/cjs/auth-api/auth-module.js +320 -124
  8. package/dist/cjs/auth-api/compat-auth-storage.d.ts +7 -5
  9. package/dist/cjs/auth-api/compat-auth-storage.js +15 -3
  10. package/dist/cjs/auth-api/mem-auth-store.d.ts +5 -3
  11. package/dist/cjs/auth-api/mem-auth-store.js +14 -28
  12. package/dist/cjs/auth-api/module.d.ts +1 -1
  13. package/dist/cjs/auth-api/sql-auth-store.d.ts +16 -4
  14. package/dist/cjs/auth-api/sql-auth-store.js +43 -30
  15. package/dist/cjs/auth-api/storage.d.ts +6 -4
  16. package/dist/cjs/auth-api/storage.js +15 -5
  17. package/dist/cjs/auth-api/types.d.ts +7 -2
  18. package/dist/cjs/auth-api/user-id.d.ts +5 -0
  19. package/dist/cjs/auth-api/user-id.js +38 -0
  20. package/dist/cjs/auth-cookie-options.d.ts +11 -0
  21. package/dist/cjs/auth-cookie-options.js +66 -0
  22. package/dist/cjs/index.cjs +4 -14
  23. package/dist/cjs/index.d.ts +4 -9
  24. package/dist/cjs/oauth/memory.d.ts +6 -0
  25. package/dist/cjs/oauth/memory.js +44 -11
  26. package/dist/cjs/oauth/models.d.ts +7 -2
  27. package/dist/cjs/oauth/models.js +10 -21
  28. package/dist/cjs/oauth/sequelize.d.ts +10 -48
  29. package/dist/cjs/oauth/sequelize.js +44 -99
  30. package/dist/cjs/oauth/types.d.ts +1 -0
  31. package/dist/cjs/passkey/base.d.ts +2 -0
  32. package/dist/cjs/passkey/config.d.ts +2 -0
  33. package/dist/cjs/passkey/config.js +26 -0
  34. package/dist/cjs/passkey/memory.d.ts +8 -0
  35. package/dist/cjs/passkey/memory.js +57 -16
  36. package/dist/cjs/passkey/models.d.ts +13 -4
  37. package/dist/cjs/passkey/models.js +41 -14
  38. package/dist/cjs/passkey/sequelize.d.ts +13 -25
  39. package/dist/cjs/passkey/sequelize.js +68 -153
  40. package/dist/cjs/passkey/service.d.ts +6 -2
  41. package/dist/cjs/passkey/service.js +205 -27
  42. package/dist/cjs/passkey/types.d.ts +18 -9
  43. package/dist/cjs/sequelize-utils.d.ts +8 -0
  44. package/dist/cjs/sequelize-utils.js +57 -0
  45. package/dist/cjs/token/base.d.ts +2 -1
  46. package/dist/cjs/token/base.js +3 -1
  47. package/dist/cjs/token/memory.d.ts +10 -0
  48. package/dist/cjs/token/memory.js +122 -32
  49. package/dist/cjs/token/sequelize.d.ts +4 -4
  50. package/dist/cjs/token/sequelize.js +67 -85
  51. package/dist/cjs/token/types.d.ts +8 -1
  52. package/dist/cjs/user/base.d.ts +1 -0
  53. package/dist/cjs/user/base.js +11 -4
  54. package/dist/cjs/user/memory.d.ts +2 -0
  55. package/dist/cjs/user/memory.js +9 -10
  56. package/dist/cjs/user/sequelize.d.ts +7 -2
  57. package/dist/cjs/user/sequelize.js +19 -32
  58. package/dist/esm/api-module.d.ts +7 -4
  59. package/dist/esm/api-module.js +9 -0
  60. package/dist/esm/api-server-base.d.ts +80 -23
  61. package/dist/esm/api-server-base.js +608 -100
  62. package/dist/esm/auth-api/auth-module.d.ts +23 -3
  63. package/dist/esm/auth-api/auth-module.js +321 -125
  64. package/dist/esm/auth-api/compat-auth-storage.d.ts +7 -5
  65. package/dist/esm/auth-api/compat-auth-storage.js +13 -1
  66. package/dist/esm/auth-api/mem-auth-store.d.ts +5 -3
  67. package/dist/esm/auth-api/mem-auth-store.js +14 -28
  68. package/dist/esm/auth-api/module.d.ts +1 -1
  69. package/dist/esm/auth-api/sql-auth-store.d.ts +16 -4
  70. package/dist/esm/auth-api/sql-auth-store.js +43 -30
  71. package/dist/esm/auth-api/storage.d.ts +6 -4
  72. package/dist/esm/auth-api/storage.js +13 -3
  73. package/dist/esm/auth-api/types.d.ts +7 -2
  74. package/dist/esm/auth-api/user-id.d.ts +5 -0
  75. package/dist/esm/auth-api/user-id.js +32 -0
  76. package/dist/esm/auth-cookie-options.d.ts +11 -0
  77. package/dist/esm/auth-cookie-options.js +63 -0
  78. package/dist/esm/index.d.ts +4 -9
  79. package/dist/esm/index.js +2 -7
  80. package/dist/esm/oauth/memory.d.ts +6 -0
  81. package/dist/esm/oauth/memory.js +44 -11
  82. package/dist/esm/oauth/models.d.ts +7 -2
  83. package/dist/esm/oauth/models.js +6 -19
  84. package/dist/esm/oauth/sequelize.d.ts +10 -48
  85. package/dist/esm/oauth/sequelize.js +32 -87
  86. package/dist/esm/oauth/types.d.ts +1 -0
  87. package/dist/esm/passkey/base.d.ts +2 -0
  88. package/dist/esm/passkey/config.d.ts +2 -0
  89. package/dist/esm/passkey/config.js +23 -0
  90. package/dist/esm/passkey/memory.d.ts +8 -0
  91. package/dist/esm/passkey/memory.js +57 -16
  92. package/dist/esm/passkey/models.d.ts +13 -4
  93. package/dist/esm/passkey/models.js +39 -12
  94. package/dist/esm/passkey/sequelize.d.ts +13 -25
  95. package/dist/esm/passkey/sequelize.js +69 -154
  96. package/dist/esm/passkey/service.d.ts +6 -2
  97. package/dist/esm/passkey/service.js +173 -28
  98. package/dist/esm/passkey/types.d.ts +18 -9
  99. package/dist/esm/sequelize-utils.d.ts +8 -0
  100. package/dist/esm/sequelize-utils.js +48 -0
  101. package/dist/esm/token/base.d.ts +2 -1
  102. package/dist/esm/token/base.js +3 -1
  103. package/dist/esm/token/memory.d.ts +10 -0
  104. package/dist/esm/token/memory.js +122 -32
  105. package/dist/esm/token/sequelize.d.ts +4 -4
  106. package/dist/esm/token/sequelize.js +67 -85
  107. package/dist/esm/token/types.d.ts +8 -1
  108. package/dist/esm/user/base.d.ts +1 -0
  109. package/dist/esm/user/base.js +11 -4
  110. package/dist/esm/user/memory.d.ts +2 -0
  111. package/dist/esm/user/memory.js +9 -10
  112. package/dist/esm/user/sequelize.d.ts +7 -2
  113. package/dist/esm/user/sequelize.js +19 -32
  114. package/docs/swagger/openapi.json +1876 -0
  115. package/package.json +84 -34
@@ -3,28 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SequelizeUserStore = exports.AuthUserModel = void 0;
4
4
  exports.initAuthUserModel = initAuthUserModel;
5
5
  const sequelize_1 = require("sequelize");
6
+ const user_id_js_1 = require("../auth-api/user-id.js");
7
+ const sequelize_utils_js_1 = require("../sequelize-utils.js");
6
8
  const base_js_1 = require("./base.js");
7
- const DIALECTS_SUPPORTING_UNSIGNED = new Set(['mysql', 'mariadb']);
8
- function integerIdType(sequelize) {
9
- return DIALECTS_SUPPORTING_UNSIGNED.has(sequelize.getDialect()) ? sequelize_1.DataTypes.INTEGER.UNSIGNED : sequelize_1.DataTypes.INTEGER;
10
- }
11
- function userTableOptions(sequelize) {
12
- const opts = {
13
- sequelize,
14
- tableName: 'users',
15
- timestamps: false
16
- };
17
- if (DIALECTS_SUPPORTING_UNSIGNED.has(sequelize.getDialect())) {
18
- opts.charset = 'utf8mb4';
19
- opts.collate = 'utf8mb4_unicode_ci';
20
- }
21
- return opts;
22
- }
23
9
  class AuthUserModel extends sequelize_1.Model {
24
10
  }
25
11
  exports.AuthUserModel = AuthUserModel;
26
- function initAuthUserModel(sequelize) {
27
- const idType = integerIdType(sequelize);
12
+ function initAuthUserModel(sequelize, options = {}) {
13
+ const idType = (0, sequelize_utils_js_1.integerIdType)(sequelize);
28
14
  AuthUserModel.init({
29
15
  user_id: {
30
16
  type: idType,
@@ -47,7 +33,7 @@ function initAuthUserModel(sequelize) {
47
33
  allowNull: false
48
34
  }
49
35
  }, {
50
- ...userTableOptions(sequelize)
36
+ ...(0, sequelize_utils_js_1.tableOptions)(sequelize, 'users', options.tablePrefix, { timestamps: false })
51
37
  });
52
38
  return AuthUserModel;
53
39
  }
@@ -63,7 +49,9 @@ class SequelizeUserStore extends base_js_1.UserStore {
63
49
  }
64
50
  this.Users = options.userModel
65
51
  ? options.userModel
66
- : (options.userModelFactory ?? initAuthUserModel)(options.sequelize);
52
+ : (options.userModelFactory ?? initAuthUserModel)(options.sequelize, {
53
+ tablePrefix: options.tablePrefix
54
+ });
67
55
  this.recordMapper =
68
56
  options.recordMapper ??
69
57
  ((model) => SequelizeUserStore.mapModelToUser(model));
@@ -112,11 +100,16 @@ class SequelizeUserStore extends base_js_1.UserStore {
112
100
  if (providedId !== undefined && providedId !== null && Number.isFinite(providedId)) {
113
101
  defaults.user_id = Number(providedId);
114
102
  }
115
- const [model] = await this.Users.findOrCreate({
116
- where: { login: rest.login },
117
- defaults: defaults
118
- });
119
- return this.toUserRecord(model);
103
+ try {
104
+ const model = await this.Users.create(defaults);
105
+ return this.toUserRecord(model);
106
+ }
107
+ catch (error) {
108
+ if (error instanceof sequelize_1.UniqueConstraintError) {
109
+ throw new Error(`User with login ${rest.login} or email ${rest.email} already exists`);
110
+ }
111
+ throw error;
112
+ }
120
113
  }
121
114
  async upsertUser(input) {
122
115
  const normalized = this.normalizeUserInput(input);
@@ -170,13 +163,7 @@ class SequelizeUserStore extends base_js_1.UserStore {
170
163
  };
171
164
  }
172
165
  normalizeUserId(identifier) {
173
- if (typeof identifier === 'number' && Number.isFinite(identifier)) {
174
- return identifier;
175
- }
176
- if (typeof identifier === 'string' && /^\d+$/.test(identifier)) {
177
- return Number(identifier);
178
- }
179
- throw new Error(`Unable to normalise user identifier: ${identifier}`);
166
+ return (0, user_id_js_1.normalizeNumericUserId)(identifier);
180
167
  }
181
168
  }
182
169
  exports.SequelizeUserStore = SequelizeUserStore;
@@ -1,12 +1,13 @@
1
1
  import type { ApiRequest } from './api-server-base.js';
2
- export type ApiHandler = (apiReq: ApiRequest) => Promise<[number] | [number, any] | [number, any, string]>;
2
+ export type ApiHandlerResult<Data = unknown> = [number] | [number, Data] | [number, Data, string];
3
+ export type ApiHandler<Data = unknown> = (apiReq: ApiRequest) => Promise<ApiHandlerResult<Data>>;
3
4
  export type ApiAuthType = 'none' | 'maybe' | 'yes' | 'strict' | 'apikey';
4
5
  export type ApiAuthClass = 'any' | 'admin';
5
6
  export interface ApiKey {
6
7
  uid: unknown;
7
8
  }
8
9
  export type ApiRoute = {
9
- method: 'get' | 'post' | 'put' | 'delete';
10
+ method: 'get' | 'post' | 'put' | 'patch' | 'delete';
10
11
  path: string;
11
12
  handler: ApiHandler;
12
13
  auth: {
@@ -14,8 +15,10 @@ export type ApiRoute = {
14
15
  req: ApiAuthClass;
15
16
  };
16
17
  };
17
- export declare class ApiModule<T> {
18
- server: T;
18
+ export declare class ApiModule<T = unknown> {
19
+ private _server?;
20
+ get server(): T;
21
+ set server(value: T);
19
22
  namespace: string;
20
23
  mountpath: string;
21
24
  static defaultNamespace: string;
@@ -1,4 +1,13 @@
1
1
  export class ApiModule {
2
+ get server() {
3
+ if (this._server === undefined) {
4
+ throw new Error('ApiModule.server is not set. Mount the module with ApiServer.api(...) before using it.');
5
+ }
6
+ return this._server;
7
+ }
8
+ set server(value) {
9
+ this._server = value;
10
+ }
2
11
  constructor(opts = {}) {
3
12
  this.mountpath = '';
4
13
  this.namespace = opts.namespace ?? this.constructor.defaultNamespace ?? '';
@@ -4,16 +4,16 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Application, Request, Response } from 'express';
7
+ import { Application, Request, Response, type ErrorRequestHandler, type RequestHandler } from 'express';
8
8
  import { ApiModule } from './api-module.js';
9
- import { TokenStore, type JwtDecodeResult, type JwtSignResult, type JwtVerifyResult } from './token/base.js';
10
- import type { ApiAuthClass, ApiKey } from './api-module.js';
9
+ import { TokenStore, type JwtDecodeResult, type JwtSignPayload, type JwtSignResult, type JwtVerifyResult } from './token/base.js';
10
+ import type { ApiAuthClass, ApiAuthType, ApiKey } from './api-module.js';
11
11
  import type { AuthProviderModule } from './auth-api/module.js';
12
- import type { AuthStorage, AuthIdentifier } from './auth-api/types.js';
12
+ import type { AuthAdapter, AuthIdentifier } from './auth-api/types.js';
13
13
  import type { OAuthStore } from './oauth/base.js';
14
14
  import type { AuthCodeData, AuthCodeRequest, OAuthClient } from './oauth/types.js';
15
15
  import type { PasskeyService } from './passkey/service.js';
16
- import type { PasskeyChallenge, PasskeyChallengeParams, PasskeyVerificationParams, PasskeyVerificationResult } from './passkey/types.js';
16
+ import type { PasskeyChallenge, PasskeyChallengeParams, StoredPasskeyCredential, PasskeyVerificationParams, PasskeyVerificationResult } from './passkey/types.js';
17
17
  import type { Token } from './token/types.js';
18
18
  import type { UserStore } from './user/base.js';
19
19
  import type { JwtPayload, SignOptions, VerifyOptions } from 'jsonwebtoken';
@@ -32,7 +32,7 @@ export interface ApiTokenData extends JwtPayload, Partial<Token> {
32
32
  exp?: number;
33
33
  }
34
34
  export interface ApiRequest {
35
- server: any;
35
+ server: ApiServer;
36
36
  req: ExtendedReq;
37
37
  res: Response;
38
38
  tokenData?: ApiTokenData | null;
@@ -47,6 +47,12 @@ export interface ApiRequest {
47
47
  getRealUid: () => AuthIdentifier | null;
48
48
  isImpersonating: () => boolean;
49
49
  }
50
+ export interface ExpressApiRequest extends ExtendedReq {
51
+ apiReq?: ApiRequest;
52
+ }
53
+ export interface ExpressApiLocals {
54
+ apiReq?: ApiRequest;
55
+ }
50
56
  export interface ClientAgentProfile {
51
57
  ua: string;
52
58
  browser: string;
@@ -58,7 +64,7 @@ export interface ClientInfo extends ClientAgentProfile {
58
64
  ipchain: string[];
59
65
  }
60
66
  export interface ApiServerAuthStores {
61
- userStore: UserStore<any, any>;
67
+ userStore: UserStore<unknown, unknown>;
62
68
  tokenStore: TokenStore;
63
69
  passkeyService?: PasskeyService;
64
70
  oauthStore?: OAuthStore;
@@ -71,13 +77,13 @@ export { ApiModule } from './api-module.js';
71
77
  export type { ApiHandler, ApiAuthType, ApiAuthClass, ApiRoute, ApiKey } from './api-module.js';
72
78
  export interface ApiErrorParams {
73
79
  code?: number;
74
- message?: any;
75
- data?: any;
80
+ message?: unknown;
81
+ data?: unknown;
76
82
  errors?: Record<string, string>;
77
83
  }
78
84
  export declare class ApiError extends Error {
79
85
  code: number;
80
- data: any;
86
+ data: unknown;
81
87
  errors: Record<string, string>;
82
88
  constructor({ code, message, data, errors }: ApiErrorParams);
83
89
  }
@@ -86,12 +92,29 @@ export interface ApiServerConf {
86
92
  apiHost: string;
87
93
  uploadPath: string;
88
94
  uploadMax: number;
95
+ staticDirs?: Record<string, string>;
89
96
  origins: string[];
90
97
  debug: boolean;
91
98
  apiBasePath: string;
99
+ swaggerEnabled?: boolean;
100
+ swaggerPath?: string;
92
101
  accessSecret: string;
93
102
  refreshSecret: string;
103
+ /** Cookie domain for auth cookies. Prefer leaving empty for localhost/development. */
94
104
  cookieDomain: string;
105
+ /** Cookie path for auth cookies. */
106
+ cookiePath?: string;
107
+ /** Cookie SameSite attribute for auth cookies. */
108
+ cookieSameSite?: 'lax' | 'strict' | 'none';
109
+ /**
110
+ * Cookie Secure attribute for auth cookies.
111
+ * - true: always secure
112
+ * - false: never secure
113
+ * - 'auto': secure when request is HTTPS (or forwarded as HTTPS)
114
+ */
115
+ cookieSecure?: boolean | 'auto';
116
+ /** Cookie HttpOnly attribute for auth cookies. */
117
+ cookieHttpOnly?: boolean;
95
118
  accessCookie: string;
96
119
  refreshCookie: string;
97
120
  accessExpiry: number;
@@ -101,49 +124,68 @@ export interface ApiServerConf {
101
124
  devMode: boolean;
102
125
  hydrateGetBody: boolean;
103
126
  validateTokens: boolean;
127
+ refreshMaybe: boolean;
104
128
  apiVersion: string;
105
129
  minClientVersion: string;
106
130
  tokenStore?: TokenStore;
107
131
  authStores?: ApiServerAuthStores;
132
+ onStartError?: (error: Error) => void;
108
133
  }
109
134
  export declare class ApiServer {
110
135
  app: Application;
111
- currReq: ApiRequest | null;
112
136
  readonly config: ApiServerConf;
113
137
  readonly startedAt: number;
114
138
  private readonly apiBasePath;
139
+ private readonly apiRouter;
140
+ private finalized;
115
141
  private storageAdapter;
116
142
  private moduleAdapter;
143
+ private serverAuthAdapter;
117
144
  private apiNotFoundHandler;
145
+ private apiErrorHandlerInstalled;
118
146
  private tokenStoreAdapter;
119
147
  private userStoreAdapter;
120
148
  private passkeyServiceAdapter;
121
149
  private oauthStoreAdapter;
122
150
  private canImpersonateAdapter;
123
151
  private readonly jwtHelper;
152
+ private currReqDeprecationWarned;
153
+ /**
154
+ * @deprecated ApiServer does not track a global "current request". This value is always null.
155
+ * Use the per-request ApiRequest passed to handlers, or `req.apiReq` / `res.locals.apiReq`
156
+ * when mounting raw Express endpoints.
157
+ */
158
+ get currReq(): ApiRequest | null;
159
+ set currReq(_value: ApiRequest | null);
124
160
  constructor(config?: Partial<ApiServerConf>);
125
- authStorage<UserRow, SafeUser>(storage: AuthStorage<UserRow, SafeUser>): this;
161
+ private assertNotFinalized;
162
+ private toApiRouterPath;
163
+ finalize(): this;
164
+ authStorage<UserRow, SafeUser>(storage: AuthAdapter<UserRow, SafeUser>): this;
126
165
  /**
127
166
  * @deprecated Use {@link ApiServer.authStorage} instead.
128
167
  */
129
- useAuthStorage<UserRow, SafeUser>(storage: AuthStorage<UserRow, SafeUser>): this;
168
+ useAuthStorage<UserRow, SafeUser>(storage: AuthAdapter<UserRow, SafeUser>): this;
130
169
  authModule<UserRow>(module: AuthProviderModule<UserRow>): this;
131
170
  /**
132
171
  * @deprecated Use {@link ApiServer.authModule} instead.
133
172
  */
134
173
  useAuthModule<UserRow>(module: AuthProviderModule<UserRow>): this;
135
- getAuthStorage(): AuthStorage<any, any>;
136
- getAuthModule(): AuthProviderModule<any>;
174
+ getAuthStorage<UserRow = unknown, SafeUser = unknown>(): AuthAdapter<UserRow, SafeUser>;
175
+ getAuthModule<UserRow = unknown>(): AuthProviderModule<UserRow>;
137
176
  setTokenStore(store: TokenStore): this;
138
177
  getTokenStore(): TokenStore | null;
139
178
  private ensureUserStore;
140
179
  private ensureTokenStore;
141
180
  private ensurePasskeyService;
181
+ listUserCredentials(userId: AuthIdentifier): Promise<StoredPasskeyCredential[]>;
182
+ deletePasskeyCredential(credentialId: Buffer | string): Promise<boolean>;
142
183
  private ensureOAuthStore;
143
- getUser(identifier: AuthIdentifier): Promise<any | null>;
144
- getUserPasswordHash(user: any): string;
145
- getUserId(user: any): AuthIdentifier;
146
- filterUser(user: any): any;
184
+ private getServerAuthAdapter;
185
+ getUser(identifier: AuthIdentifier): Promise<unknown | null>;
186
+ getUserPasswordHash(user: unknown): string;
187
+ getUserId(user: unknown): AuthIdentifier;
188
+ filterUser(user: unknown): unknown;
147
189
  verifyPassword(password: string, hash: string): Promise<boolean>;
148
190
  storeToken(data: Token): Promise<void>;
149
191
  getToken(query: Partial<Token> & {
@@ -166,7 +208,7 @@ export declare class ApiServer {
166
208
  realUserId: AuthIdentifier;
167
209
  effectiveUserId: AuthIdentifier;
168
210
  }): Promise<boolean>;
169
- jwtSign(payload: any, secret: string, expiresInSeconds: number, options?: SignOptions): JwtSignResult;
211
+ jwtSign(payload: JwtSignPayload, secret: string, expiresInSeconds: number, options?: SignOptions): JwtSignResult;
170
212
  jwtVerify<T>(token: string, secret: string, options?: VerifyOptions): JwtVerifyResult<T>;
171
213
  jwtDecode<T>(token: string, options?: import('jsonwebtoken').DecodeOptions): JwtDecodeResult<T>;
172
214
  getApiKey<T = ApiKey>(token: string): Promise<T | null>;
@@ -177,16 +219,23 @@ export declare class ApiServer {
177
219
  updateToken(updates: Partial<Token> & {
178
220
  refreshToken: string;
179
221
  }): Promise<boolean>;
180
- guessExceptionText(error: any, defMsg?: string): string;
222
+ guessExceptionText(error: unknown, defMsg?: string): string;
181
223
  protected authorize(apiReq: ApiRequest, requiredClass: ApiAuthClass): Promise<void>;
182
224
  private middlewares;
225
+ private installStaticDirs;
183
226
  private installPingHandler;
227
+ private loadSwaggerSpec;
228
+ private installSwaggerHandler;
184
229
  private normalizeApiBasePath;
185
230
  private installApiNotFoundHandler;
186
- private ensureApiNotFoundOrdering;
231
+ private installApiErrorHandler;
187
232
  private describeMissingEndpoint;
188
233
  start(): this;
234
+ private internalServerErrorMessage;
189
235
  private verifyJWT;
236
+ private jwtCookieOptions;
237
+ private setAccessCookie;
238
+ private tryRefreshAccessToken;
190
239
  private authenticate;
191
240
  private tryAuthenticateApiKey;
192
241
  private requiresAuthToken;
@@ -195,8 +244,16 @@ export declare class ApiServer {
195
244
  private normalizeAuthIdentifier;
196
245
  private extractTokenUserId;
197
246
  private resolveRealUserId;
247
+ useExpress(path: string, ...handlers: Array<RequestHandler | ErrorRequestHandler>): this;
248
+ useExpress(...handlers: Array<RequestHandler | ErrorRequestHandler>): this;
249
+ private createApiRequest;
250
+ expressAuth(auth: {
251
+ type: ApiAuthType;
252
+ req: ApiAuthClass;
253
+ }): RequestHandler;
254
+ expressErrorHandler(): ErrorRequestHandler;
198
255
  private handle_request;
199
- api<T extends ApiModule<any>>(module: T): this;
256
+ api<T extends ApiModule<unknown>>(module: T): this;
200
257
  dumpRequest(apiReq: ApiRequest): void;
201
258
  private formatDebugValue;
202
259
  dumpResponse(apiReq: ApiRequest, payload: unknown, status: number): void;