Observability Server

Functions

Functions

createApp

Signature:

createApp(): Promise<CreateAppResult>

Returns:

Promise<CreateAppResult> -

initDatabase

Signature:

initDatabase(dbName?: string): Promise<ObsDatabase>

Parameters:

ParameterTypeRequiredDescription
dbNamestringNo

Returns:

Promise<ObsDatabase> -

getDatabase

Signature:

getDatabase(): Promise<ObsDatabase>

Returns:

Promise<ObsDatabase> -

closeDatabase

Signature:

closeDatabase(): Promise<void>

Returns:

Promise<void> -

authenticateApiKey

API Key Authentication Middleware Validates X-API-Key header against configured API keys

Signature:

authenticateApiKey(req: Request<import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/express/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/qs/index").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction): Response<any, Record<string, any>> | undefined

Parameters:

ParameterTypeRequiredDescription
reqRequest<import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/express/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/qs/index").ParsedQs, Record<string, any>>Yes
resResponse<any, Record<string, any>>Yes
nextNextFunctionYes

Returns:

Response<any, Record<string, any>> \| undefined -

extractProjectFromApiKey

Optional: Extract project ID from API key for validation

Signature:

extractProjectFromApiKey(apiKey: string): string | null

Parameters:

ParameterTypeRequiredDescription
apiKeystringYes

Returns:

string \| null -

authorizeProject

Project Authorization Middleware Validates that the API key belongs to the queried project SECURITY: Prevents API keys from accessing data from other projects

Signature:

authorizeProject(req: Request<import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/express/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/qs/index").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: NextFunction): Response<any, Record<string, any>> | undefined

Parameters:

ParameterTypeRequiredDescription
reqRequest<import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/express/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, import("/Users/sthornock/code/epic/epic-flowstate/node_modules/@types/qs/index").ParsedQs, Record<string, any>>Yes
resResponse<any, Record<string, any>>Yes
nextNextFunctionYes

Returns:

Response<any, Record<string, any>> \| undefined -

createRateLimitMiddleware

Rate Limiting Middleware Uses the existing RateLimiter class to enforce rate limits per API key

Signature:

createRateLimitMiddleware(maxRequests?: number, windowMs?: number): (req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> | undefined

Parameters:

ParameterTypeRequiredDescription
maxRequestsnumberNo
windowMsnumberNo

Returns:

(req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> \| undefined -

validateQuery

Generic validation middleware factory

Signature:

validateQuery(schema: z.ZodType<any, z.ZodTypeDef, any>): (req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> | undefined

Parameters:

ParameterTypeRequiredDescription
schemaz.ZodType<any, z.ZodTypeDef, any>Yes

Returns:

(req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>> \| undefined -

Previous
Classes