n8n
Version:
n8n Workflow Automation Tool
29 lines (28 loc) • 1.78 kB
TypeScript
import type { BooleanLicenseFeature } from '@n8n/constants';
import type { AuthenticatedRequest } from '@n8n/db';
import type { ApiKeyScope, Scope } from '@n8n/permissions';
import type express from 'express';
import type { NextFunction, Request, Response } from 'express';
export type ProjectScopeResource = 'workflow' | 'credential' | 'dataTable';
export declare const globalScope: (scopes: Scope | Scope[]) => (req: AuthenticatedRequest<{
id?: string;
dataTableId?: string;
}>, res: express.Response, next: express.NextFunction) => Promise<express.Response | void>;
export declare const projectScope: (scopes: Scope | Scope[], resource: ProjectScopeResource) => (req: AuthenticatedRequest<{
id?: string;
dataTableId?: string;
}>, res: express.Response, next: express.NextFunction) => Promise<express.Response | void>;
export declare const validCursor: (req: Request, res: express.Response, next: express.NextFunction) => express.Response | void;
export type ScopeTaggedMiddleware = Middleware & {
__apiKeyScope: ApiKeyScope;
};
export type Middleware = (req: Request, res: Response, next: NextFunction) => unknown;
export declare const publicApiScope: (apiKeyScope: ApiKeyScope) => ScopeTaggedMiddleware;
export declare const apiKeyHasScopeWithGlobalScopeFallback: (config: {
scope: ApiKeyScope & Scope;
} | {
apiKeyScope: ApiKeyScope;
globalScope: Scope;
}) => ScopeTaggedMiddleware;
export declare const validLicenseWithUserQuota: (_: express.Request, res: express.Response, next: express.NextFunction) => express.Response | void;
export declare const isLicensed: (feature: BooleanLicenseFeature) => (_: AuthenticatedRequest, res: express.Response, next: express.NextFunction) => Promise<void | express.Response<any, Record<string, any>>>;