gitlab-acebase
Version:
AceBase realtime database server (webserver endpoint to allow remote connections)
48 lines • 1.89 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="express" />
import type { HttpApp, HttpRouter, Request } from './http';
import type { AceBase, DataReference } from 'acebase';
import type { AceBaseServerConfig } from '../settings';
import type { DbUserAccountDetails } from '../schema/user';
import type { ConnectedClient } from './clients';
import type { DebugLogger, SimpleCache, Api } from 'acebase-core';
import type { OAuth2Provider } from '../oauth-providers/oauth-provider';
import type { Server as HttpServer } from 'http';
import type { Server as SecureHttpServer } from 'https';
import type { PathBasedRules } from '../rules';
import type { AceBaseServer } from '../server';
import { DatabaseLog } from '../logger';
export interface RouteInitEnvironment {
rootPath: string;
server: HttpServer | SecureHttpServer;
app: HttpApp;
router: HttpRouter;
config: AceBaseServerConfig;
db: AceBase & {
api: Api;
};
authDb: AceBase;
debug: DebugLogger;
securityRef: DataReference;
authRef: DataReference;
log: DatabaseLog;
tokenSalt: string;
clients: Map<string, ConnectedClient>;
authCache: SimpleCache<string, DbUserAccountDetails>;
authProviders: {
[providerName: string]: OAuth2Provider;
};
rules: PathBasedRules;
instance: AceBaseServer;
}
export interface RouteRequestEnvironment {
/** If the request has an Authentication: bearer token, the user will be bound to the incoming request */
user?: DbUserAccountDetails;
/** If context is sent through AceBase-Context header, it will be bound to the incoming request */
context: {
[key: string]: any;
};
}
export type RouteRequest<ReqQuery = any, ReqBody = any, ResBody = any> = Request<any, ResBody, ReqBody, ReqQuery> & RouteRequestEnvironment;
//# sourceMappingURL=env.d.ts.map