UNPKG

@cloud-copilot/iam-simulate

Version:
63 lines 1.89 kB
/** * The context metadata available in a request */ export interface RequestContext { /** * Check if a context key exists in a request * @param name the name of the context key to check for, case insensitive * @returns true if the context key exists, false otherwise */ contextKeyExists: (name: string) => boolean; /** * Get the value of a context key in a request * * @param name the name of the context key to get the value of, case insensitive * @returns the value of the context key */ contextKeyValue: (name: string) => ContextKey; } /** * A context key in a request */ export interface ContextKey { /** * The name of the context key */ name: string; /** * Check if the context key is a string value */ isStringValue(): this is StringContextKey; /** * Check if the context key is an array value */ isArrayValue(): this is ArrayContextKey; } export interface StringContextKey extends ContextKey { /** * The value of the context key if it is a string */ value: string; } export interface ArrayContextKey extends ContextKey { /** * The array of values of the context key if it is an array */ values: string[]; } export declare class RequestContextImpl implements RequestContext { private context; constructor(values: Record<string, string | string[]>); contextKeyExists(name: string): boolean; contextKeyValue(name: string): ContextKey; } export declare class ContextKeyImpl implements ContextKey, StringContextKey, ArrayContextKey { name: string; private _val; constructor(name: string, _val: string | string[]); isStringValue(): this is StringContextKey; isArrayValue(): this is ArrayContextKey; get values(): string[]; get value(): string; } //# sourceMappingURL=requestContext.d.ts.map