/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */
import type { AstIdentifierBinding, AstIdentifierWrite, CtxApiAlias, CtxApiCapability, CtxApiResourceAliases, CtxApiResourceHandleAlias, CtxApiResourceMethodAlias, CtxLibAlias, CtxLibsRootAlias, CtxMethodAlias, CtxNonFunctionRootAlias, CtxRootAlias, RunJsAstInspection, StaticFilterValueBinding, StaticStringBinding } from '../internal-types';
export declare function collectCtxRootAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxRootAlias[];
export declare function collectCtxDefiniteRootAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxRootAlias[];
export declare function collectCtxNonFunctionRootAliasesFromAst(ast: any, source: string, ctxRootAliases: CtxRootAlias[], identifierBindings: AstIdentifierBinding[], modelUse?: string): CtxNonFunctionRootAlias[];
export declare function collectAstInvalidCtxNonFunctionCall(node: any, ctxRootAliases: CtxRootAlias[], ctxNonFunctionRootAliases: CtxNonFunctionRootAlias[], identifierBindings: AstIdentifierBinding[], modelUse?: string): RunJsAstInspection['invalidCtxNonFunctionCalls'];
export declare function collectCtxMethodAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxMethodAlias[];
export declare function collectCtxApiAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxApiAlias[];
export declare function collectCtxApiObjectPatternAliases(pattern: any, capability: CtxApiCapability | '', addAlias: (name: string, capability: CtxApiCapability, node?: any) => void): void;
export declare function trimCtxApiAliasesAfterWrites(aliases: CtxApiAlias[], writes: AstIdentifierWrite[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias[];
export declare function collectCtxLibsRootAliasesFromAst(ast: any, source: string, identifierBindings: AstIdentifierBinding[]): CtxLibsRootAlias[];
export declare function collectCtxLibAliasesFromAst(ast: any, source: string, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[]): CtxLibAlias[];
export declare function collectCtxLibObjectPatternAliases(pattern: any, sourceNode: any, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], addAlias: (name: string, alias: {
    capability: string;
    library: string;
}, node?: any) => void): void;
export declare function collectCtxApiResourceAliasesFromAst(ast: any, source: string, ctxApiAliases: CtxApiAlias[], stringBindings: StaticStringBinding[], staticFilterValueBindings: StaticFilterValueBinding[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceAliases;
export declare function collectAstInvalidApiResourceCall(node: any, aliases: CtxApiAlias[], resourceAliases: CtxApiResourceAliases, source: string, identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidApiResourceCalls'];
export declare function getCtxApiResourceChainedMethodFromAst(node: any, aliases: CtxApiAlias[], resourceAliases: CtxApiResourceAliases, source: string, identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidApiResourceCalls'][number] | undefined;
export declare function getWrappedCtxApiResourceChainedMethodFromAst(node: any, aliases: CtxApiAlias[], resourceAliases: CtxApiResourceAliases, source: string, identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidApiResourceCalls'][number] | undefined;
export declare function getCtxApiResourceHandleAliasFromAst(node: any, aliases: CtxApiResourceHandleAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceHandleAlias | undefined;
export declare function getCtxApiResourceMethodAliasFromAst(node: any, aliases: CtxApiResourceMethodAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceMethodAlias | undefined;
export declare function getMaybeCtxApiResourceHandleAliasFromAst(node: any, aliases: CtxApiResourceHandleAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceHandleAlias | undefined;
export declare function collectMaybeCtxApiResourceHandleAliasesFromAst(node: any, aliases: CtxApiResourceHandleAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceHandleAlias[];
export declare function getUniqueCtxApiResourceHandleAlias(aliases: CtxApiResourceHandleAlias[]): CtxApiResourceHandleAlias;
export declare function getCtxApiResourceHandleAliasIdentity(alias: CtxApiResourceHandleAlias): string;
export declare function getMaybeCtxApiResourceMethodAliasFromAst(node: any, aliases: CtxApiResourceMethodAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiResourceMethodAlias | undefined;
export declare function getCtxApiResourceCallFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): {
    args: any[];
    calleeSource: string;
    index: number;
} | undefined;
export declare function getCtxApiResourceCalleeFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): {
    index: number;
    source: string;
} | undefined;
export declare function getMaybeCtxApiResourceCallFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): {
    args: any[];
    calleeSource: string;
    index: number;
} | undefined;
export declare function collectMaybeCtxApiResourceCallsFromAst(node: any, aliases: CtxApiAlias[], source: string, identifierBindings: AstIdentifierBinding[]): Array<{
    args: any[];
    calleeSource: string;
    index: number;
}>;
export declare function getUniqueCtxApiResourceCall(calls: Array<{
    args: any[];
    calleeSource: string;
    index: number;
}>, source: string): {
    args: any[];
    calleeSource: string;
    index: number;
};
export declare function getCtxApiResourceCallIdentity(call: {
    args: any[];
    calleeSource: string;
    index: number;
}, source: string): string;
export declare function filterInvalidCtxApiMemberAccessesForResourceCalls(memberAccesses: RunJsAstInspection['invalidCtxApiMemberAccesses'], resourceCalls: RunJsAstInspection['invalidApiResourceCalls']): RunJsAstInspection['invalidCtxApiMemberAccesses'];
export declare function isCtxApiResourcePath(path: ReturnType<typeof getCtxApiMemberPathFromAst>): path is NonNullable<ReturnType<typeof getCtxApiMemberPathFromAst>>;
export declare function collectAstInvalidCtxLibPatternAccesses(ast: any, aliases: CtxLibAlias[], rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): RunJsAstInspection['invalidCtxLibMemberAccesses'];
export declare function collectInvalidCtxLibObjectPatternAccesses(pattern: any, sourcePath: NonNullable<ReturnType<typeof getCtxLibMemberPathFromAst>>): RunJsAstInspection['invalidCtxLibMemberAccesses'];
export declare function collectAstInvalidCtxLibMemberAccess(node: any, aliases: CtxLibAlias[], rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): RunJsAstInspection['invalidCtxLibMemberAccesses'][number] | undefined;
export declare function buildInvalidCtxLibMemberAccess(path: {
    library: string;
    members: Array<{
        accessKind: 'bracket' | 'destructure' | 'member';
        index: number;
        name: string;
    }>;
    rootCapability: string;
}): RunJsAstInspection['invalidCtxLibMemberAccesses'][number] | undefined;
export declare function getCtxLibMemberCapability(rootCapability: string, member: {
    accessKind: 'bracket' | 'destructure' | 'member';
    name: string;
}): string;
export declare function getSuggestedCtxLibMemberImport(library: string, member: string): string;
export declare function getCtxLibMemberPathFromAst(node: any, aliases: CtxLibAlias[], rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): {
    dynamicIndex: number;
    hasDynamicMember: boolean;
    library: string;
    libraryIndex: number;
    memberIndex: number;
    members: Array<{
        accessKind: 'bracket' | 'destructure' | 'member';
        index: number;
        name: string;
    }>;
    rootCapability: string;
} | undefined;
export declare function getDirectCtxLibPathFromAst(node: any, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[], source: string): ReturnType<typeof getCtxLibMemberPathFromAst>;
export declare function isCtxLibsRootFromAst(node: any, rootAliases: CtxLibsRootAlias[], identifierBindings: AstIdentifierBinding[]): boolean;
export declare function collectAstInvalidCtxApiPatternAccesses(ast: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidCtxApiMemberAccesses'];
export declare function getCtxApiCapabilityMemberPrefix(capability: CtxApiAlias['capability']): string[];
export declare function collectInvalidCtxApiObjectPatternAccesses(pattern: any, prefix: string[]): RunJsAstInspection['invalidCtxApiMemberAccesses'];
export declare function collectAstInvalidCtxApiMemberAccess(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[], source: string): RunJsAstInspection['invalidCtxApiMemberAccesses'][number] | undefined;
export declare function buildInvalidCtxApiMemberAccess(memberPath: string[], index: number, hasDynamicMember?: boolean): RunJsAstInspection['invalidCtxApiMemberAccesses'][number] | undefined;
export declare function collectAstInvalidCtxApiReadonlyWrites(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): RunJsAstInspection['invalidCtxApiMemberAccesses'];
export declare function collectAstWriteTargetNodes(node: any, visit: (node: any) => void): void;
export declare function getCtxApiMemberAccessFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): {
    dynamicIndex: number;
    hasDynamicMember: boolean;
    memberIndex: number;
    memberPath: string[];
} | undefined;
export declare function getCtxApiMemberPathFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): {
    dynamicIndex: number;
    hasDynamicMember: boolean;
    isCtxApi: true;
    memberIndex: number;
    members: Array<{
        index: number;
        name: string;
    }>;
} | undefined;
export declare function getCtxApiAliasMemberPath(alias: CtxApiAlias, index: number): Array<{
    index: number;
    name: string;
}>;
export declare function getCtxApiCapabilityMemberPath(capability: CtxApiAlias['capability'], index: number): Array<{
    index: number;
    name: string;
}>;
export declare function getCtxApiCapabilityFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias['capability'] | '';
export declare function getMaybeCtxApiCapabilityFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias['capability'] | '';
export declare function collectPossibleCtxApiCapabilitiesFromAst(node: any, aliases: CtxApiAlias[], identifierBindings: AstIdentifierBinding[]): CtxApiAlias['capability'][];
export declare function selectCtxApiCapability(capabilities: CtxApiAlias['capability'][]): CtxApiAlias['capability'] | '';
export declare function uniqueCtxApiCapabilities(capabilities: Array<CtxApiAlias['capability'] | ''>): CtxApiAlias['capability'][];
export declare function isCtxApiCapabilityDefinitelyTruthy(capability: CtxApiAlias['capability']): boolean;
