import { _Cond, _Record, _WhereCond } from '../../../types/types'; import { _IKAsyncEndpoint, _IKQuery, _IKSyncEndpoint } from './IObject'; import { AppCtx } from '../../../application/application'; import { BatchResult } from '../../../common/structs'; import { _IKQueryV3, _IKSyncEndpointV3 } from './IObjectV3'; /** * _KObject is kunlun object, every method new a _KQuery object to deal. */ export interface _KObject extends _KObjectSync, _KObjectAsync, _KObjectQuery { } export declare class _KObject { apiName: string; constructor(objectApiName: string, appCtx?: AppCtx); } /** * _KApplicationObject is open sdk object implement. */ export interface _KApplicationObject extends _KObjectSync, _KObjectQuery { } export declare class _KApplicationObject { apiName: string; appCtx: AppCtx; constructor(objectApiName: string, appCtx: AppCtx); } declare class _KObjectSync implements _IKSyncEndpoint, _IKSyncEndpointV3 { apiName: string; appCtx: AppCtx; authType: string; create(recordMap: _Cond): Promise<{ _id: number | string; }>; delete(recordID: number | string): Promise; delete(record: _Cond): Promise; private deleteV3; update(_id: number | string, recordMap: _Cond): Promise; update(recordMap: _Cond): Promise; private updateV3; batchCreate(recordMapList: _Cond[]): Promise; private batchCreateV3; batchDelete(recordIdList: string[]): Promise; batchDelete(recordIdList: number[]): Promise; batchDelete(recordList: _Cond[]): Promise; private batchDeleteV3; batchUpdate(recordMapList: _Cond[]): Promise; private batchUpdateV3; useUserAuth(): this; useSystemAuth(): this; } declare class _KObjectAsync implements _IKAsyncEndpoint { apiName: string; authType: string; batchCreateAsync(recordMapList: _Cond[]): Promise<{ taskID: number; }>; batchDeleteAsync(recordIDList: number[]): Promise<{ taskID: number; }>; batchDeleteAsync(recordList: _Cond[]): Promise<{ taskID: number; }>; batchUpdateAsync(recordMapList: _Cond[]): Promise<{ taskID: number; }>; useUserAuth(): this; useSystemAuth(): this; } declare class _KObjectQuery implements _IKQuery, _IKQueryV3 { apiName: string; appCtx: AppCtx; authType: string; find(): Promise<_Record[]>; findOne(): Promise<_Record>; findAll(): Promise<_Record[]>; findStream(handler: (records: object[]) => Promise): Promise; orderBy(fieldApiNames: K[]): _KQuery; orderBy(...fieldApiNames: K[]): _KQuery; orderByDesc(fieldApiNames: K[]): _KQuery; orderByDesc(...fieldApiNames: K[]): _KQuery; select(fieldApiNames: K[]): _KQuery; select(...fieldApiNames: K[]): _KQuery; where(conditionMap: _WhereCond): _KQuery; where(): _KQuery; fuzzySearch(keyword: string, fieldAPINames: string[]): _KQuery; limit(limit: number): _KQuery; offset(offset: number): _KQuery; count(): Promise; useSystemAuth(): this; useUserAuth(): this; } /** * _KQuery is kunlun query implement, implements ORM operations. */ declare class _KQuery implements _IKQuery, _IKQueryV3 { private authType; constructor(objectApiName: string, appCtx?: AppCtx, authType?: string); find(): Promise<_Record[]>; findOne(): Promise<_Record>; /** * @Deprecated Use FindStream instead. */ findAll(): Promise<_Record[]>; findStream(handler: (records: object[]) => Promise, pageLimit?: number): Promise; private walkRecordsByID; private walkRecordsByLimitOffset; private getRecordsByPage; orderBy(fieldApiNames: K[]): this; orderBy(...fieldApiNames: K[]): this; orderByDesc(fieldApiNames: K[]): this; orderByDesc(...fieldApiNames: K[]): this; select(fieldApiNames: K[]): this; select(...fieldApiNames: K[]): this; where(conditionMap: _WhereCond): this; where(): this; fuzzySearch(keyword: string, fieldAPINames: string[]): this; limit(limit: number): this; offset(offset: number): this; count(): Promise; private findV3; private findPreCheck; useSystemAuth(): this; useUserAuth(): this; } export {};