web-dc-api 0.0.64 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dc.min.js +2 -2
- package/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +36 -10
- package/dist/index.esm.js +2 -2
- package/lib/common/dc-key/keyManager.ts +6 -6
- package/lib/implements/account/manager.ts +1 -1
- package/lib/implements/keyvalue/manager.ts +26 -2
- package/lib/implements/threaddb/core/core.ts +1 -1
- package/lib/implements/threaddb/dbmanager.ts +1 -1
- package/lib/implements/threaddb/net/net.ts +15 -14
- package/lib/interfaces/keyvalue-interface.ts +6 -11
- package/lib/modules/keyvalue-module.ts +37 -14
- package/lib/util/utils.ts +15 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3279,7 +3279,10 @@ interface INet {
|
|
|
3279
3279
|
token?: ThreadToken;
|
|
3280
3280
|
}): Promise<ThreadInfo>;
|
|
3281
3281
|
deleteThread(id: ThreadID, ...opts: any[]): Promise<void>;
|
|
3282
|
-
pullThread(id: ThreadID, timeout: number,
|
|
3282
|
+
pullThread(id: ThreadID, timeout: number, options: {
|
|
3283
|
+
token?: ThreadToken | undefined;
|
|
3284
|
+
multiPeersFlag?: boolean | undefined;
|
|
3285
|
+
}): Promise<void>;
|
|
3283
3286
|
getPbLogs(id: ThreadID): Promise<[net.pb.ILog[], IThreadInfo]>;
|
|
3284
3287
|
}
|
|
3285
3288
|
interface ICollectionConfig {
|
|
@@ -26970,7 +26973,7 @@ interface IKeyValueOperations {
|
|
|
26970
26973
|
* @param kvdb: KeyValueDB,
|
|
26971
26974
|
* @param key 键名
|
|
26972
26975
|
* @param value 值内容
|
|
26973
|
-
* @param indexs 索引列表,格式为"indexkey1:value
|
|
26976
|
+
* @param indexs 索引列表,格式为json字符串:[{key:"indexkey1",type:"string",value:"value"},{key:"indexkey2",type:"number", value:12}],设置索引后,后续查询可以通过索引快速定位
|
|
26974
26977
|
* @param vaccount 可选的虚拟账户
|
|
26975
26978
|
* @returns [是否设置成功, 错误信息]
|
|
26976
26979
|
*/
|
|
@@ -26979,13 +26982,13 @@ interface IKeyValueOperations {
|
|
|
26979
26982
|
* 获取指定键的值
|
|
26980
26983
|
* @param kvdb: KeyValueDB,
|
|
26981
26984
|
* @param key 键名
|
|
26982
|
-
* @param writerPubkey
|
|
26985
|
+
* @param writerPubkey 写入者的公钥,如果不指定,则获取所有用户写入的该key的最新值
|
|
26983
26986
|
* @param vaccount 可选的虚拟账户
|
|
26984
26987
|
* @returns [值内容, 错误信息]
|
|
26985
26988
|
*/
|
|
26986
26989
|
get(kvdb: KeyValueDB, key: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
26987
26990
|
/**
|
|
26988
|
-
*
|
|
26991
|
+
* 获取指定键的值列表,按key的字典序排序
|
|
26989
26992
|
* @param kvdb: KeyValueDB,
|
|
26990
26993
|
* @param key 键名
|
|
26991
26994
|
* @param limit 返回结果数量限制
|
|
@@ -26995,7 +26998,12 @@ interface IKeyValueOperations {
|
|
|
26995
26998
|
* @param vaccount 可选的虚拟账户
|
|
26996
26999
|
* @returns [值列表生成的json字符串, 错误信息]
|
|
26997
27000
|
*/
|
|
26998
|
-
getValues(kvdb: KeyValueDB, key: string,
|
|
27001
|
+
getValues(kvdb: KeyValueDB, key: string, options: {
|
|
27002
|
+
limit?: number;
|
|
27003
|
+
seekKey?: string;
|
|
27004
|
+
direction?: Direction;
|
|
27005
|
+
offset?: number;
|
|
27006
|
+
}, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
26999
27007
|
/**
|
|
27000
27008
|
* 批量获取多个键的值
|
|
27001
27009
|
* @param kvdb: KeyValueDB,
|
|
@@ -27010,6 +27018,7 @@ interface IKeyValueOperations {
|
|
|
27010
27018
|
* @param kvdb: KeyValueDB,
|
|
27011
27019
|
* @param indexKey 索引键名
|
|
27012
27020
|
* @param indexValue 索引值
|
|
27021
|
+
* @param type 索引值类型
|
|
27013
27022
|
* @param seekKey 查询起始键
|
|
27014
27023
|
* @param offset 结果偏移量
|
|
27015
27024
|
* @param direction 查询方向 (Forward/Backward)
|
|
@@ -27017,7 +27026,13 @@ interface IKeyValueOperations {
|
|
|
27017
27026
|
* @param vaccount 可选的虚拟账户
|
|
27018
27027
|
* @returns [JSON格式查询结果, 错误信息]
|
|
27019
27028
|
*/
|
|
27020
|
-
getWithIndex(kvdb: KeyValueDB, indexKey: string, indexValue: string,
|
|
27029
|
+
getWithIndex(kvdb: KeyValueDB, indexKey: string, indexValue: string, options: {
|
|
27030
|
+
type?: string;
|
|
27031
|
+
limit?: number;
|
|
27032
|
+
seekKey?: string;
|
|
27033
|
+
direction?: Direction;
|
|
27034
|
+
offset?: number;
|
|
27035
|
+
}, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
27021
27036
|
}
|
|
27022
27037
|
|
|
27023
27038
|
/**
|
|
@@ -28059,11 +28074,11 @@ declare class KeyValueModule implements DCModule, IKeyValueOperations {
|
|
|
28059
28074
|
getStore(appId: string, theme: string, themeAuthor: string): Promise<[KeyValueDB | null, Error | null]>;
|
|
28060
28075
|
configAuth(kvdb: KeyValueDB, authPubkey: string, permission: ThemePermission, remark: string, vaccount?: string): Promise<[number | null, Error | null]>;
|
|
28061
28076
|
getAuthList(kvdb: KeyValueDB, vaccount?: string): Promise<[ThemeAuthInfo[] | null, ThemeComment[] | null, Error | null]>;
|
|
28062
|
-
set(kvdb: KeyValueDB, key: string, value: string, indexs: string, //索引列表,格式为key1:value1$$$key2:value2
|
|
28077
|
+
set(kvdb: KeyValueDB, key: string, value: string, indexs: string, //索引列表,格式为json字符串:[{key:"indexkey1",type:"string",value:"value"},{key:"indexkey2",type:"number", value:12}],这里统一转换格式为key1:value1$$$key2:value2
|
|
28063
28078
|
vaccount?: string): Promise<[boolean | null, Error | null]>;
|
|
28064
28079
|
get(kvdb: KeyValueDB, key: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
28065
28080
|
/**
|
|
28066
|
-
*
|
|
28081
|
+
* 获取指定键的值列表
|
|
28067
28082
|
* @param kvdb: KeyValueDB,
|
|
28068
28083
|
* @param key 键名
|
|
28069
28084
|
* @param limit 返回结果数量限制
|
|
@@ -28072,9 +28087,20 @@ declare class KeyValueModule implements DCModule, IKeyValueOperations {
|
|
|
28072
28087
|
* @param vaccount 可选的虚拟账户
|
|
28073
28088
|
* @returns [值列表生成的json字符串, 错误信息]
|
|
28074
28089
|
*/
|
|
28075
|
-
getValues(kvdb: KeyValueDB, key: string,
|
|
28090
|
+
getValues(kvdb: KeyValueDB, key: string, options: {
|
|
28091
|
+
limit?: number;
|
|
28092
|
+
seekKey?: string;
|
|
28093
|
+
direction?: Direction;
|
|
28094
|
+
offset?: number;
|
|
28095
|
+
}, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
28076
28096
|
getBatch(kvdb: KeyValueDB, keys: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
28077
|
-
getWithIndex(kvdb: KeyValueDB, indexKey: string, indexValue: string,
|
|
28097
|
+
getWithIndex(kvdb: KeyValueDB, indexKey: string, indexValue: string, options: {
|
|
28098
|
+
type?: string;
|
|
28099
|
+
limit?: number;
|
|
28100
|
+
seekKey?: string;
|
|
28101
|
+
direction?: Direction;
|
|
28102
|
+
offset?: number;
|
|
28103
|
+
}, vaccount?: string): Promise<[string | null, Error | null]>;
|
|
28078
28104
|
/**
|
|
28079
28105
|
* 断言模块已初始化
|
|
28080
28106
|
*/
|