/* * CloudBeaver - Cloud Database Manager * Copyright (C) 2020-2021 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ import type { IExecutor } from '@cloudbeaver/core-executor'; import type { ResultDataFormat } from '@cloudbeaver/core-sdk'; import type { IDatabaseDataResult } from './IDatabaseDataResult'; import type { DatabaseDataAccessMode, IDatabaseDataSource, IRequestInfo } from './IDatabaseDataSource'; export interface IRequestEventData { type: 'before' | 'after'; } export interface IDatabaseDataModel { readonly id: string; readonly source: IDatabaseDataSource; readonly requestInfo: IRequestInfo; readonly supportedDataFormats: ResultDataFormat[]; readonly countGain: number; readonly onOptionsChange: IExecutor; readonly onRequest: IExecutor; isReadonly: () => boolean; isDisabled: (resultIndex: number) => boolean; isLoading: () => boolean; isDataAvailable: (offset: number, count: number) => boolean; getResult: (index: number) => TResult | null; setAccess: (access: DatabaseDataAccessMode) => this; setCountGain: (count: number) => this; setSlice: (offset: number, count?: number) => this; setOptions: (options: TOptions) => this; setDataFormat: (dataFormat: ResultDataFormat) => this; setSupportedDataFormats: (dataFormats: ResultDataFormat[]) => this; requestOptionsChange: () => Promise; requestDataAction: (action: () => Promise | void) => Promise; retry: () => Promise; save: (concurrent?: boolean) => Promise; refresh: () => Promise; reload: () => Promise; requestDataPortion: (offset: number, count: number) => Promise; requestData: () => Promise; cancel: () => Promise | void; resetData: () => void; dispose: () => Promise; }