当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.data.cloudExtension.d.ts 35.41 KB
一键复制 编辑 原始数据 按行查看 历史
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit ArkData
*/
import type rpc from './@ohos.rpc';
import type cloudData from './@ohos.data.cloudData';
import type relationalStore from './@ohos.data.relationalStore';
/**
* Provides interfaces to implement extended cloud capabilities.
*
* @namespace cloudExtension
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @since 11
*/
declare namespace cloudExtension {
/**
* Provides interface for managing cloud assets.
*
* @extends relationalStore.Asset
* @interface CloudAsset
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface CloudAsset extends relationalStore.Asset {
/**
* Asset ID.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
assetId: string;
/**
* Asset hash value.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
hash: string;
}
/**
* Indicates cloud assets in one column.
*
* @typedef { Array<CloudAsset> } CloudAssets
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
type CloudAssets = Array<CloudAsset>;
/**
* Indicates possible cloud types.
*
* @typedef { null | number | string | boolean | Uint8Array | CloudAsset | CloudAssets } CloudType
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
type CloudType = null | number | string | boolean | Uint8Array | CloudAsset | CloudAssets;
/**
* Defines cloud information.
*
* @interface CloudInfo
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface CloudInfo {
/**
* Cloud information. For details, see {@link ServiceInfo}.
*
* @type { ServiceInfo }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
cloudInfo: ServiceInfo;
/**
* Defines brief application information.
*
* @type { Record<string, AppBriefInfo> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
apps: Record<string, AppBriefInfo>;
}
/**
* Defines cloud service information.
*
* @interface ServiceInfo
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface ServiceInfo {
/**
* Whether cloud is enabled. The value <b>true</b> means cloud is enabled;
* the value <b>false</b> means the opposite.
*
* @type { boolean }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
enableCloud: boolean;
/**
* ID of the cloud account generated by using SHA-256.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
id: string;
/**
* Total space (in KB) of the account on the server.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
totalSpace: number;
/**
* Available space (in KB) of the account on the server.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
remainingSpace: number;
/**
* Current user of the device.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
user: number;
}
/**
* Defines the brief application information.
*
* @interface AppBriefInfo
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface AppBriefInfo {
/**
* ID of the application.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
appId: string;
/**
* Bundle name.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
bundleName: string;
/**
* Whether cloud is enabled for the application.
* The value <b>true</b> means the cloud is enabled; the <b>false</b> means
* the opposite.
*
* @type { boolean }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
cloudSwitch: boolean;
/**
* Application instance ID.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
instanceId: number;
}
/**
* Enumerates the field types.
*
* @enum { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export enum FieldType {
/**
* NULL.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
NULL = 0,
/**
* Number.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
NUMBER = 1,
/**
* Real.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
REAL = 2,
/**
* Text.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
TEXT = 3,
/**
* Boolean.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
BOOL = 4,
/**
* BLOB.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
BLOB = 5,
/**
* Asset. For details, see {@link relationalStore.Asset}.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
ASSET = 6,
/**
* Assets. For details, see {@link relationalStore.Assets}.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
ASSETS = 7
}
/**
* Defines the fields.
*
* @interface Field
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface Field {
/**
* Alias of the field on the server.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
alias: string;
/**
* Column name.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
colName: string;
/**
* Type of the field. For details, see {@link FieldType}.
*
* @type { FieldType }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
type: FieldType;
/**
* Whether the current column holds the primary key.
*
* @type { boolean }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
primary: boolean;
/**
* Whether the current column is nullable.
*
* @type { boolean }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
nullable: boolean;
}
/**
* Defines a table.
*
* @interface Table
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface Table {
/**
* Alias of the table on the server.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
alias: string;
/**
* Name of the table.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
name: string;
/**
* Fields in the table. For details, see {@link Field}.
*
* @type { Array<Field> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
fields: Array<Field>;
}
/**
* Defines a database.
*
* @interface Database
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface Database {
/**
* Name of the database.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
name: string;
/**
* Alias of the database on the server.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
alias: string;
/**
* Tables in the database. For details, see {@link Table}.
*
* @type { Array<Table> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
tables: Array<Table>;
}
/**
* Defines the application schema.
*
* @interface AppSchema
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface AppSchema {
/**
* Bundle name of the application.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
bundleName: string;
/**
* Schema version.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
version: number;
/**
* Databases {@link Database} of the application.
*
* @type { Array<Database> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
databases: Array<Database>;
}
/**
* Defines the data in the cloud.
*
* @interface CloudData
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface CloudData {
/**
* Next cursor for query.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
nextCursor: string;
/**
* Whether the server has more data to query {@link CloudDB.query()}.
*
* @type { boolean }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
hasMore: boolean;
/**
* Array of data queried, including the data values and extension
* values {@link ExtensionValue}.
*
* @type { Array<Record<string, CloudType>> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
values: Array<Record<string, CloudType>>;
}
/**
* Defines the subscription information.
*
* @interface SubscribeInfo
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface SubscribeInfo {
/**
* Subscription expiration time, in milliseconds.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
expirationTime: number;
/**
* Data to be observed.
*
* @type { Record<string, Array<SubscribeId>> }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
subscribe: Record<string, Array<SubscribeId>>;
}
/**
* Defines the subscription ID.
*
* @interface SubscribeId
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface SubscribeId {
/**
* Alias of the database on the server.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
databaseAlias: string;
/**
* Subscription ID generated by {@link CloudService.subscribe()}.
*
* @type { string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
id: string;
}
/**
* Enumerates the operations that can be performed on the database.
*
* @enum { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export enum Flag {
/**
* Insert data.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
INSERT = 0,
/**
* Update data.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
UPDATE = 1,
/**
* Delete data.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
DELETE = 2
}
/**
* Defines the extension values.
*
* @interface ExtensionValue
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface ExtensionValue {
/**
* ID generated by {@link CloudDB.insert()}.
* An ID is generated for each row when data is first inserted to the cloud.
* The ID must be unique for each table.
*
* @type { string }
* @readonly
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
readonly id: string;
/**
* Time when the row data was created.
*
* @type { number }
* @readonly
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
readonly createTime: number;
/**
* Time when the row data was last modified.
*
* @type { number }
* @readonly
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
readonly modifyTime: number;
/**
* Database operation.
*
* @type { Flag }
* @readonly
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
readonly operation: Flag;
}
/**
* Defines the lock information.
*
* @interface LockInfo
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface LockInfo {
/**
* Duration for which the cloud database is locked, in seconds.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
interval: number;
/**
* Lock ID for locking the cloud database.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
lockId: number;
}
/**
* Enumerates the error codes.
*
* @enum { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export enum ErrorCode {
/**
* Successful.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
SUCCESS = 0,
/**
* Unknown error.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
UNKNOWN_ERROR = 1,
/**
* Network error.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
NETWORK_ERROR = 2,
/**
* Cloud is disabled.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
CLOUD_DISABLED = 3,
/**
* The cloud database is locked by others.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
LOCKED_BY_OTHERS = 4,
/**
* The number of records exceeds the limit.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
RECORD_LIMIT_EXCEEDED = 5,
/**
* The cloud has no space for the asset.
*
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
NO_SPACE_FOR_ASSET = 6
}
/**
* Defines the result.
*
* @interface Result
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface Result<T> {
/**
* Error code.
*
* @type { number }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
code: number;
/**
* Error code description.
*
* @type { ?string }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
description?: string;
/**
* Result value.
*
* @type { ?T }
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
value?: T;
}
/**
* Creates a share service stub with the specified instance.
*
* @param { ShareCenter } instance - Indicates the <b>ShareCenter</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createShareServiceStub(instance: ShareCenter): Promise<rpc.RemoteObject>;
/**
* Creates a cloud service stub with the specified instance.
*
* @param { CloudService } instance - Indicates the <b>CloudService</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns the remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createCloudServiceStub(instance: CloudService): Promise<rpc.RemoteObject>;
/**
* Creates a cloud database stub with the specified instance.
*
* @param { CloudDB } instance - Indicates the <b>CloudDB</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns the remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createCloudDBStub(instance: CloudDB): Promise<rpc.RemoteObject>;
/**
* Creates an asset loader stub with the specified instance.
*
* @param { AssetLoader } instance - Indicates the <b>AssetLoader</b> instance.
* @returns { Promise<rpc.RemoteObject> } Returns remote object.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
function createAssetLoaderStub(instance: AssetLoader): Promise<rpc.RemoteObject>;
/**
* Provides interfaces for the operations on the cloud database.
*
* @interface CloudDB
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface CloudDB {
/**
* Generates the IDs of the rows of data to be inserted to the cloud.
* The IDs must be unique for each table.
*
* @param { number } count - Indicates the number of IDs to generate.
* @returns { Promise<Result<Array<string>>> } Returns the IDs generated.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
generateId(count: number): Promise<Result<Array<string>>>;
/**
* Inserts data to the cloud.
*
* @param { string } table - Indicates the table name.
* @param { Array<Record<string, CloudType>> } values - Indicates the data to insert.
* @param { Array<Record<string, CloudType>> } extensions - Indicates the extension
* values {@link ExtensionValue}.
* @returns { Promise<Array<Result<Record<string, CloudType>>>> } Returns the insert result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
insert(
table: string,
values: Array<Record<string, CloudType>>,
extensions: Array<Record<string, CloudType>>
): Promise<Array<Result<Record<string, CloudType>>>>;
/**
* Updates data in the cloud.
*
* @param { string } table - Indicates the table name.
* @param { Array<Record<string, CloudType>> } values - Indicates the new data.
* @param { Array<Record<string, CloudType>> } extensions - Indicates the extension
* values {@link ExtensionValue}.
* @returns { Promise<Array<Result<Record<string, CloudType>>>> } Returns the update result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
update(
table: string,
values: Array<Record<string, CloudType>>,
extensions: Array<Record<string, CloudType>>
): Promise<Array<Result<Record<string, CloudType>>>>;
/**
* Deletes data.
*
* @param { string } table - Indicates the table name.
* @param { Array<Record<string, CloudType>> } extensions - Indicates the extension
* values {@link ExtensionValue}.
* @returns { Promise<Array<Result<Record<string, CloudType>>>> } Returns the delete result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
delete(
table: string,
extensions: Array<Record<string, CloudType>>
): Promise<Array<Result<Record<string, CloudType>>>>;
/**
* Queries data.
*
* @param { string } table - Indicates the table name.
* @param { Array<string> } fields - Indicates the columns to query.
* @param { number } queryCount - Indicates the number of data records
* to query.
* @param { string } queryCursor - Indicates the cursor.
* @returns { Promise<Result<CloudData>> } Returns the query result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
query(table: string, fields: Array<string>, queryCount: number, queryCursor: string): Promise<Result<CloudData>>;
/**
* Locks the cloud database.
* The cloud database will be unlocked when the lock interval has expired.
* When the cloud database is locked, other devices cannot synchronize data
* with the cloud.
*
* @returns { Promise<Result<LockInfo>> } Returns the locked information.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
lock(): Promise<Result<LockInfo>>;
/**
* Uses the heartbeat to extend the lock interval if it is not enough.
*
* @param { number } lockId - Indicates the lock ID of the heartbeat.
* @returns { Promise<Result<LockInfo>> } Returns the time.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
heartbeat(lockId: number): Promise<Result<LockInfo>>;
/**
* Unlocks the cloud database.
*
* @param { number } lockId - Indicates the lock ID.
* @returns { Promise<Result<boolean>> } Returns the unlock result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
unlock(lockId: number): Promise<Result<boolean>>;
}
/**
* Provides interfaces for implementing the asset loader.
*
* @interface AssetLoader
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface AssetLoader {
/**
* Downloads assets.
*
* @param { string } table - Indicates the name of the table.
* @param { string } gid - Indicates the GID.
* @param { string } prefix - Indicates the prefix information.
* @param { Array<CloudAsset> } assets - Indicates the assets to download.
* @returns { Promise<Array<Result<CloudAsset>>> } Returns the asset download result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
download(table: string, gid: string, prefix: string, assets: Array<CloudAsset>): Promise<Array<Result<CloudAsset>>>;
/**
* Uploads assets.
*
* @param { string } table - Indicates the name of the table.
* @param { string } gid - Indicates the GID.
* @param { Array<CloudAsset> } assets - Indicates the assets to upload.
* @returns { Promise<Array<Result<CloudAsset>>> } Returns the asset upload result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
upload(table: string, gid: string, assets: Array<CloudAsset>): Promise<Array<Result<CloudAsset>>>;
}
/**
* Provides interfaces for implementing ShareCenter.
*
* @interface ShareCenter
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface ShareCenter {
/**
* Shares data with specific participants.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { Array<cloudData.sharing.Participant> } participants - Indicates the participant.
* @returns { Promise<Result<Array<Result<cloudData.sharing.Participant>>>> } Returns the sharing result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
share(
userId: number,
bundleName: string,
sharingResource: string,
participants: Array<cloudData.sharing.Participant>
): Promise<Result<Array<Result<cloudData.sharing.Participant>>>>;
/**
* UnShares data with specific participants.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { Array<cloudData.sharing.Participant> } participants - Indicates the participant.
* @returns { Promise<Result<Array<Result<cloudData.sharing.Participant>>>> } Returns the sharing result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
unshare(
userId: number,
bundleName: string,
sharingResource: string,
participants: Array<cloudData.sharing.Participant>
): Promise<Result<Array<Result<cloudData.sharing.Participant>>>>;
/**
* Exits the sharing.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @returns { Promise<Result<void>> } Returns the exit result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
exit(userId: number, bundleName: string, sharingResource: string): Promise<Result<void>>;
/**
* Changes privilege of the specific participants.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { Array<cloudData.sharing.Participant> } participants - Indicates the participant.
* @returns { Promise<Result<Array<Result<cloudData.sharing.Participant>>>> } Returns the changing result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
changePrivilege(
userId: number,
bundleName: string,
sharingResource: string,
participants: Array<cloudData.sharing.Participant>
): Promise<Result<Array<Result<cloudData.sharing.Participant>>>>;
/**
* Queries participants of the specific sharing resource.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @returns { Promise<Result<Array<cloudData.sharing.Participant>>> } Returns the query result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
queryParticipants(
userId: number,
bundleName: string,
sharingResource: string
): Promise<Result<Array<cloudData.sharing.Participant>>>;
/**
* Queries participants based on the specified invitation code.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } invitationCode - Indicates the invitation code.
* @returns { Promise<Result<Array<cloudData.sharing.Participant>>> } Returns the query result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
queryParticipantsByInvitation(
userId: number,
bundleName: string,
invitationCode: string
): Promise<Result<Array<cloudData.sharing.Participant>>>;
/**
* Confirms invitation.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } invitationCode - Indicates the invitation code.
* @param { cloudData.sharing.State } state - Indicates the state.
* @returns { Promise<Result<string>> } Returns the sharing resource.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
confirmInvitation(
userId: number,
bundleName: string,
invitationCode: string,
state: cloudData.sharing.State
): Promise<Result<string>>;
/**
* Changes confirmation.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @param { string } sharingResource - Indicates the sharing resource.
* @param { cloudData.sharing.State } state - Indicates the state.
* @returns { Promise<Result<void>> } Returns the change result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
changeConfirmation(
userId: number,
bundleName: string,
sharingResource: string,
state: cloudData.sharing.State
): Promise<Result<void>>;
}
/**
* Provides interfaces for implementing CloudService.
*
* @interface CloudService
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
export interface CloudService {
/**
* Obtains the service information.
*
* @returns { Promise<ServiceInfo> } Returns the service information obtained.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
getServiceInfo(): Promise<ServiceInfo>;
/**
* Obtains the brief application information.
*
* @returns { Promise<Record<string, AppBriefInfo>> }
* Returns the key-value pairs corresponding to <b>bundle</b> and
* <b>AppBriefInfo</b>.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
getAppBriefInfo(): Promise<Record<string, AppBriefInfo>>;
/**
* Obtains the application schema information.
*
* @param { string } bundleName - Indicates the bundle name of the application.
* @returns { Promise<Result<AppSchema>> } Returns <b>AppSchema</b>.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
getAppSchema(bundleName: string): Promise<Result<AppSchema>>;
/**
* Subscribes to data changes in the cloud.
* When the cloud server data is changed, the server notifies the device of
* the data change.
*
* @param { Record<string, Array<Database>> } subInfo - Indicates
* the data to be subscribed to, that is, the key-value pairs corresponding
* to an array of bundle names and databases.
* @param { number } expirationTime - Indicates the subscription expiration
* time.
* @returns { Promise<Result<SubscribeInfo>> } Returns <b>SubscribeInfo</b>.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
subscribe(
subInfo: Record<string, Array<Database>>,
expirationTime: number
): Promise<Result<SubscribeInfo>>;
/**
* Unsubscribes from the data changes in the cloud.
*
* @param { Record<string, Array<string>> } unsubscribeInfo - Indicates
* the data to be unsubscribe from, that is, the key-value pairs
* corresponding to an array of bundle names and databases.
* @returns { Promise<number> } Returns unsubscribeInfo result.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
unsubscribe(unsubscribeInfo: Record<string, Array<string>>): Promise<number>;
/**
* Connects to a database.
*
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { Database } database - Indicates the database to connect.
* @returns { Promise<rpc.RemoteObject> } Returns connectDB RemoteObject.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
connectDB(bundleName: string, database: Database): Promise<rpc.RemoteObject>;
/**
* Connects to an assetLoader.
*
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { Database } database - Indicates the database of bundle.
* @returns { Promise<rpc.RemoteObject> } Returns connectAssetLoader RemoteObject.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
connectAssetLoader(bundleName: string, database: Database): Promise<rpc.RemoteObject>;
/**
* Connects to a share center.
*
* @param { number } userId - Indicates the user ID.
* @param { string } bundleName - Indicates the bundle name.
* @returns { Promise<rpc.RemoteObject> } Returns shareCenter RemoteObject.
* @syscap SystemCapability.DistributedDataManager.CloudSync.Server
* @systemapi
* @since 11
*/
connectShareCenter(userId: number, bundleName: string): Promise<rpc.RemoteObject>;
}
}
export default cloudExtension;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助