agentlang
Version:
The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans
82 lines • 4.46 kB
TypeScript
import { DataSource } from 'typeorm';
import { ResolverAuthInfo } from '../authinfo.js';
import { Environment } from '../../interpreter.js';
import { Instance, RbacSpecification, Relationship } from '../../module.js';
export declare let defaultDataSource: DataSource | undefined;
export declare class DbContext {
txnId: string | undefined;
authInfo: ResolverAuthInfo;
private inKernelMode;
resourceFqName: string;
activeEnv: Environment;
private needAuthCheckFlag;
rbacRules: RbacSpecification[] | undefined;
constructor(resourceFqName: string, authInfo: ResolverAuthInfo, activeEnv: Environment, txnId?: string, inKernelMode?: boolean, rbacRules?: RbacSpecification[]);
private static GlobalDbContext;
static getGlobalContext(): DbContext;
clone(): DbContext;
getUserId(): string;
isForDelete(): boolean;
isForUpdate(): boolean;
setResourceFqNameFrom(inst: Instance): DbContext;
setNeedAuthCheck(flag: boolean): DbContext;
switchAuthCheck(flag: boolean): boolean;
isPermitted(): boolean;
isInKernelMode(): boolean;
forceReadPermission(): boolean;
}
export type JoinOn = {
attributeName: string;
operator: string;
attributeValue: any;
};
export declare function makeJoinOn(attrName: string, attrValue: any, opr?: string): JoinOn;
export type JoinClause = {
tableName: string;
queryObject?: object;
queryValues?: object;
joinType?: string;
joinOn: JoinOn | JoinOn[];
};
export type DatabaseConfig = {
type: string;
host?: string;
username?: string;
password?: string;
dbname?: string;
port?: number;
};
export declare function isUsingSqlite(): boolean;
export declare function isUsingSqljs(): boolean;
export declare function isVectorStoreSupported(): boolean;
export declare function initDatabase(config: DatabaseConfig | undefined): Promise<void>;
export declare function resetDefaultDatabase(): Promise<void>;
export declare function addRowForFullTextSearch(tableName: string, id: string, vect: number[], ctx: DbContext): Promise<void>;
export declare function initVectorStore(tableNames: string[], ctx: DbContext): Promise<void>;
export declare function vectorStoreSearch(tableName: string, searchVec: number[], limit: number, ctx: DbContext): Promise<any>;
export declare function vectorStoreSearchEntryExists(tableName: string, id: string, ctx: DbContext): Promise<boolean>;
export declare function deleteFullTextSearchEntry(tableName: string, id: string, ctx: DbContext): Promise<void>;
export declare function insertRows(tableName: string, rows: object[], ctx: DbContext, doUpsert?: boolean): Promise<void>;
export declare function insertRow(tableName: string, row: object, ctx: DbContext, doUpsert: boolean): Promise<void>;
export declare function insertBetweenRow(n: string, a1: string, a2: string, node1: Instance, node2: Instance, relEntry: Relationship, ctx: DbContext): Promise<void>;
export declare function upsertRows(tableName: string, rows: object[], ctx: DbContext): Promise<void>;
export declare function upsertRow(tableName: string, row: object, ctx: DbContext): Promise<void>;
export declare function updateRow(tableName: string, queryObj: object, queryVals: object, updateObj: object, ctx: DbContext): Promise<boolean>;
type QueryObjectEntry = [string, any];
export type QueryObject = Array<QueryObjectEntry>;
export declare function hardDeleteRow(tableName: string, queryObject: QueryObject, ctx: DbContext): Promise<boolean>;
export declare function getMany(tableName: string, queryObj: object | undefined, queryVals: object | undefined, distinct: boolean, ctx: DbContext): Promise<any>;
export declare function getManyByJoin(tableName: string, queryObj: object | undefined, queryVals: object | undefined, joinClauses: JoinClause[], intoSpec: Map<string, string>, distinct: boolean, ctx: DbContext): Promise<any>;
export type BetweenConnectionInfo = {
connectionTable: string;
fromColumn: string;
fromValue: string;
toColumn: string;
toRef: string;
};
export declare function getAllConnected(tableName: string, queryObj: object, queryVals: object, connInfo: BetweenConnectionInfo, ctx: DbContext): Promise<any[]>;
export declare function startDbTransaction(): Promise<string>;
export declare function commitDbTransaction(txnId: string): Promise<void>;
export declare function rollbackDbTransaction(txnId: string): Promise<void>;
export {};
//# sourceMappingURL=database.d.ts.map