/** * 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 { FlowContext, FlowEngineContext } from '../flowContext'; import { BaseRecordResource } from './baseRecordResource'; type SQLRunOptions = { bind?: Record; type?: 'selectVar' | 'selectRow' | 'selectRows'; dataSourceKey?: string; filter?: Record; }; type SQLSaveOptions = { uid: string; sql: string; dataSourceKey?: string; }; export declare class FlowSQLRepository { protected ctx: FlowContext; constructor(ctx: FlowContext); run(sql: string, options?: SQLRunOptions): Promise; save(data: SQLSaveOptions): Promise; runById(uid: string, options?: SQLRunOptions): Promise; destroy(uid: string): Promise; } export declare class SQLResource extends BaseRecordResource { protected _data: { value: TData; }; protected _meta: { value: Record; }; private refreshTimer; private refreshWaiters; private _debugEnabled; private _sql; protected request: { method: string; params: Record; data: Record; headers: Record; }; get refreshActionName(): "run" | "runById"; get supportsFilter(): boolean; constructor(context: FlowEngineContext); protected buildURL(action?: string): string; setPage(page: number): this; getPage(): number; setPageSize(pageSize: number): this; setDebug(enabled: boolean): this; getPageSize(): number; next(): Promise; previous(): Promise; goto(page: number): Promise; setDataSourceKey(dataSourceKey: string): this; setSQLType(type: 'selectRows' | 'selectRow' | 'selectVar'): this; setSQL(sql: string): this; setFilterByTk(filterByTk: any): this; setFilter(filter: Record): this; setBind(bind: Record | Array): this; setLiquidContext(liquidContext: Record): this; run(): Promise; runBySQL(): Promise; runById(): Promise; /** * 在同一个事件循环内多次调用 refresh 方法时,只有最后一次调用会生效。避免触发多次相同的接口请求。 * @returns */ refresh(): Promise; } export {};