UNPKG

integreat

Version:
37 lines (36 loc) 1.4 kB
import type { Action, Ident } from '../../types.js'; import type { Access } from '../../schema/types.js'; import type Schema from '../../schema/Schema.js'; declare const authorizedByIntegreat: unique symbol; export declare const isAuthorizedAction: (action: Action & { meta?: { [authorizedByIntegreat]?: boolean; }; }) => boolean | undefined; export declare const setAuthorizedMark: (action: Action, isAuthorized?: boolean) => { meta: { [authorizedByIntegreat]: boolean; id?: string; cid?: string; gid?: string; ident?: Ident; dispatchedAt?: number; queue?: boolean | number; queuedAt?: number | Date; cache?: boolean; auth?: Record<string, unknown> | null; options?: import("../types.js").TransporterOptions; jobId?: string; stepId?: string; }; type: string; payload: import("../../types.js").Payload<unknown>; response?: import("../../types.js").Response<unknown> | undefined; }; export declare function validateRoleOrIdent(required?: string | string[], present?: string | string[]): boolean; export declare function authorizeByRoleOrIdent(access: Access, ident?: Ident): { reason: string; error: string; } | undefined; declare const _default: (schemas: Map<string, Schema>, requireAuth: boolean) => (action: Action) => Action; export default _default;