From 31169079ba831e45a414add5f4894cb99d7d58c8 Mon Sep 17 00:00:00 2001 From: oh_ci Date: Thu, 4 Sep 2025 07:36:57 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!25271?= =?UTF-8?q?=20:=20feat:0728=20datashare=20ArkTS1.2=20=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...application.DataShareExtensionAbility.d.ts | 218 ++---------------- 1 file changed, 19 insertions(+), 199 deletions(-) diff --git a/api/@ohos.application.DataShareExtensionAbility.d.ts b/api/@ohos.application.DataShareExtensionAbility.d.ts index fe778a801c..177444235a 100644 --- a/api/@ohos.application.DataShareExtensionAbility.d.ts +++ b/api/@ohos.application.DataShareExtensionAbility.d.ts @@ -26,126 +26,16 @@ import { ValuesBucket } from './@ohos.data.ValuesBucket'; import dataShare from './@ohos.data.dataShare'; /** - * Struct for a batch update operation. - * - * @typedef { dataShare.UpdateOperation } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @stagemodelonly - * @since 12 - */ + * Struct for a batch update operation. + * + * @typedef { dataShare.UpdateOperation } + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @stagemodelonly + * @since 12 + */ type UpdateOperation = dataShare.UpdateOperation; -/** - * Called back when a datashare extension ability is started for initialization. - * - * @typedef { function } - * @param { Want } want - Indicates connection information about the datashare extension ability. - * @param { AsyncCallback } callback - callback function, no return value. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type OnCreateFn = (want: Want, callback: AsyncCallback) => void; - -/** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the position where the data is to insert. - * @param { ValuesBucket } valueBucket - Indicates the data to insert. - * @param { AsyncCallback } callback - Returns the index of the newly inserted data record. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type InsertFn = (uri: string, valueBucket: ValuesBucket, callback: AsyncCallback) => void; - -/** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the database table storing the data to update. - * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. If this parameter is - * null, all data records will be updated by default. - * @param { ValuesBucket } valueBucket - Indicates the data to update. This parameter can be null. - * @param { AsyncCallback } callback - Returns the number of data records updated. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type UpdateFn = ( - uri: string, - predicates: dataSharePredicates.DataSharePredicates, - valueBucket: ValuesBucket, - callback: AsyncCallback -) => void; - -/** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the database table storing the data to delete. - * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. If this parameter is - * null, all data records will be deleted by default. - * @param { AsyncCallback } callback - Returns the number of data records deleted. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type DeleteFn = ( - uri: string, - predicates: dataSharePredicates.DataSharePredicates, - callback: AsyncCallback -) => void; - -/** - * Queries one or more data records in the database. This method should be implemented by a data share. - * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. - * - * @typedef { function } - * @param { string } uri - Indicates the database table storing the data to query. - * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates filter criteria. If this parameter is - * null, all data records will be queried by default. - * @param { Array } columns - Indicates the columns to be queried, in array, for example, {"name","age"}. - * You should define the processing logic when this parameter is null. - * @param { AsyncCallback } callback - Returns the queried data, only support result set of rdb or kvstore. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type QueryFn = ( - uri: string, - predicates: dataSharePredicates.DataSharePredicates, - columns: Array, - callback: AsyncCallback -) => void; - -/** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @typedef { function } - * @param { string } uri - Indicates the position where the data is to insert. - * @param { Array } valueBuckets - Indicates the data to insert. - * @param { AsyncCallback } callback - Returns the number of data records inserted. - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ -type BatchInsertFn = (uri: string, valueBuckets: Array, callback: AsyncCallback) => void; - /** * This module provides data sharing and expansion capabilities. * @@ -155,7 +45,7 @@ type BatchInsertFn = (uri: string, valueBuckets: Array, callback: * @since arkts {'1.1':'9', '1.2':'20'} * @arkts 1.1&1.2 */ -declare class DataShareExtensionAbility { +export default class DataShareExtensionAbility { /** * Indicates datashare extension ability context. * @@ -176,22 +66,11 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ onCreate?(want: Want, callback: AsyncCallback): void; - /** - * Called back when a datashare extension ability is started for initialization. - * - * @type { ?OnCreateFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - onCreate?: OnCreateFn; - /** * Inserts a data record into the database. This method should be implemented by a data share. * @@ -205,18 +84,6 @@ declare class DataShareExtensionAbility { */ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback): void; - /** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @type { ?InsertFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - insert?: InsertFn; - /** * Updates one or more data records in the database. This method should be implemented by a data share. * @@ -228,7 +95,8 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ update?( uri: string, @@ -237,18 +105,6 @@ declare class DataShareExtensionAbility { callback: AsyncCallback ): void; - /** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @type { ?UpdateFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - update?: UpdateFn; - /** * Updates data records in the database. * @@ -274,22 +130,11 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - /** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @type { ?DeleteFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - delete?: DeleteFn; - /** * Queries one or more data records in the database. This method should be implemented by a data share. * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. @@ -303,7 +148,8 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ query?( uri: string, @@ -312,19 +158,6 @@ declare class DataShareExtensionAbility { callback: AsyncCallback ): void; - /** - * Queries one or more data records in the database. This method should be implemented by a data share. - * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. - * - * @type { ?QueryFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - query?: QueryFn; - /** * Inserts multiple data records into the database. This method should be implemented by a data share. * @@ -334,22 +167,11 @@ declare class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @StageModelOnly - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; - /** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @type { ?BatchInsertFn } - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi - * @StageModelOnly - * @since 20 - * @arkts 1.2 - */ - batchInsert?: BatchInsertFn; - /** * Converts the given {@code uri} that refer to the data share into a normalized URI. A normalized URI can be * used across devices, persisted, backed up, and restored. It can refer to the same item in the data share @@ -380,5 +202,3 @@ declare class DataShareExtensionAbility { */ denormalizeUri?(uri: string, callback: AsyncCallback): void; } - -export default DataShareExtensionAbility; -- Gitee