web-dc-api 0.0.69 → 0.0.71

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/index.d.ts CHANGED
@@ -26984,7 +26984,7 @@ interface IKeyValueOperations {
26984
26984
  * @param key 键名
26985
26985
  * @param writerPubkey 写入者的公钥,如果不指定,则获取所有用户写入的该key的最新值
26986
26986
  * @param vaccount 可选的虚拟账户
26987
- * @returns [值内容, 错误信息]
26987
+ * @returns [值内容, 错误信息] 值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
26988
26988
  */
26989
26989
  get(kvdb: KeyValueDB, key: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
26990
26990
  /**
@@ -26996,7 +26996,7 @@ interface IKeyValueOperations {
26996
26996
  * @param direction 查询方向
26997
26997
  * @param offset 结果偏移量
26998
26998
  * @param vaccount 可选的虚拟账户
26999
- * @returns [值列表生成的json字符串, 错误信息]
26999
+ * @returns [值列表生成的json字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
27000
27000
  */
27001
27001
  getValues(kvdb: KeyValueDB, key: string, options: {
27002
27002
  limit?: number;
@@ -27010,7 +27010,7 @@ interface IKeyValueOperations {
27010
27010
  * @param keys 多个键名,逗号分隔
27011
27011
  * @param writerPubkey 写入者的公钥,可选,默认为主题作者
27012
27012
  * @param vaccount 可选的虚拟账户
27013
- * @returns [JSON格式值内容, 错误信息]
27013
+ * @returns [JSON格式值内容, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
27014
27014
  */
27015
27015
  getBatch(kvdb: KeyValueDB, keys: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
27016
27016
  /**
@@ -27024,7 +27024,7 @@ interface IKeyValueOperations {
27024
27024
  * @param direction 查询方向 (Forward/Backward)
27025
27025
  * @param limit 返回结果数量限制
27026
27026
  * @param vaccount 可选的虚拟账户
27027
- * @returns [JSON格式查询结果, 错误信息]
27027
+ * @returns [JSON格式查询结果, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
27028
27028
  */
27029
27029
  getWithIndex(kvdb: KeyValueDB, indexKey: string, indexValue: string, options: {
27030
27030
  type?: string;
@@ -28076,6 +28076,14 @@ declare class KeyValueModule implements DCModule, IKeyValueOperations {
28076
28076
  getAuthList(kvdb: KeyValueDB, vaccount?: string): Promise<[ThemeAuthInfo[] | null, ThemeComment[] | null, Error | null]>;
28077
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
28078
28078
  vaccount?: string): Promise<[boolean | null, Error | null]>;
28079
+ /**
28080
+ * 获取指定键的元数据
28081
+ * @param kvdb
28082
+ * @param key
28083
+ * @param writerPubkey
28084
+ * @param vaccount
28085
+ * @returns [值, 错误信息],值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
28086
+ */
28079
28087
  get(kvdb: KeyValueDB, key: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
28080
28088
  /**
28081
28089
  * 获取指定键的值列表
@@ -28085,7 +28093,7 @@ declare class KeyValueModule implements DCModule, IKeyValueOperations {
28085
28093
  * @param seekKey 查询起始键,用于分页查询
28086
28094
  * @param offset 结果偏移量
28087
28095
  * @param vaccount 可选的虚拟账户
28088
- * @returns [值列表生成的json字符串, 错误信息]
28096
+ * @returns [值列表生成的json字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
28089
28097
  */
28090
28098
  getValues(kvdb: KeyValueDB, key: string, options: {
28091
28099
  limit?: number;
@@ -28093,7 +28101,27 @@ declare class KeyValueModule implements DCModule, IKeyValueOperations {
28093
28101
  direction?: Direction;
28094
28102
  offset?: number;
28095
28103
  }, vaccount?: string): Promise<[string | null, Error | null]>;
28104
+ /**
28105
+ * 批量获取指定键的值
28106
+ * @param kvdb KeyValueDB实例
28107
+ * @param keys 逗号分隔的键列表
28108
+ * @param writerPubkey 可选,指定写入者公钥
28109
+ * @param vaccount 可选的虚拟账户
28110
+ * @returns [值的JSON字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
28111
+ */
28096
28112
  getBatch(kvdb: KeyValueDB, keys: string, writerPubkey?: string, vaccount?: string): Promise<[string | null, Error | null]>;
28113
+ /**
28114
+ * 获取指定索引的值
28115
+ * @param kvdb KeyValueDB实例
28116
+ * @param indexKey 索引键名
28117
+ * @param indexValue 索引值
28118
+ * @param type 索引值类型
28119
+ * @param seekKey 查询起始键,用于分页查询
28120
+ * @param direction 查询方向
28121
+ * @param offset 结果偏移量
28122
+ * @param vaccount 可选的虚拟账户
28123
+ * @returns [值的JSON字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
28124
+ */
28097
28125
  getWithIndex(kvdb: KeyValueDB, indexKey: string, indexValue: string, options: {
28098
28126
  type?: string;
28099
28127
  limit?: number;
package/lib/dc.ts CHANGED
@@ -84,7 +84,7 @@ export class DC implements DCContext {
84
84
  this.dcChain = new ChainUtil();
85
85
  this.dcutil = new DcUtil(this.dcChain);
86
86
  // //todo 发布注释 remove
87
- // this.dcutil.defaultPeerId= "12D3KooWEGzh4AcbJrfZMfQb63wncBUpscMEEyiMemSWzEnjVCPf";
87
+ // this.dcutil.defaultPeerId= "12D3KooWEGzh4AcbJrfZMfQb63wncBUpscMEEyiMemSWzEnjVCPf";
88
88
  // //todo remove end
89
89
  this.appInfo = options.appInfo || ({} as APPInfo);
90
90
  this.accountInfo = {} as AccountInfo;
@@ -78,7 +78,7 @@ export interface IKeyValueOperations {
78
78
  * @param key 键名
79
79
  * @param writerPubkey 写入者的公钥,如果不指定,则获取所有用户写入的该key的最新值
80
80
  * @param vaccount 可选的虚拟账户
81
- * @returns [值内容, 错误信息]
81
+ * @returns [值内容, 错误信息] 值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
82
82
  */
83
83
  get(
84
84
  kvdb: KeyValueDB,
@@ -97,7 +97,7 @@ export interface IKeyValueOperations {
97
97
  * @param direction 查询方向
98
98
  * @param offset 结果偏移量
99
99
  * @param vaccount 可选的虚拟账户
100
- * @returns [值列表生成的json字符串, 错误信息]
100
+ * @returns [值列表生成的json字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
101
101
  */
102
102
  getValues(
103
103
  kvdb: KeyValueDB,
@@ -113,7 +113,7 @@ export interface IKeyValueOperations {
113
113
  * @param keys 多个键名,逗号分隔
114
114
  * @param writerPubkey 写入者的公钥,可选,默认为主题作者
115
115
  * @param vaccount 可选的虚拟账户
116
- * @returns [JSON格式值内容, 错误信息]
116
+ * @returns [JSON格式值内容, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
117
117
  */
118
118
  getBatch(
119
119
  kvdb: KeyValueDB,
@@ -133,7 +133,7 @@ export interface IKeyValueOperations {
133
133
  * @param direction 查询方向 (Forward/Backward)
134
134
  * @param limit 返回结果数量限制
135
135
  * @param vaccount 可选的虚拟账户
136
- * @returns [JSON格式查询结果, 错误信息]
136
+ * @returns [JSON格式查询结果, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
137
137
  */
138
138
  getWithIndex(
139
139
  kvdb: KeyValueDB,
@@ -193,7 +193,14 @@ export class KeyValueModule implements DCModule, IKeyValueOperations {
193
193
  }
194
194
  }
195
195
 
196
-
196
+ /**
197
+ * 获取指定键的元数据
198
+ * @param kvdb
199
+ * @param key
200
+ * @param writerPubkey
201
+ * @param vaccount
202
+ * @returns [值, 错误信息],值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
203
+ */
197
204
  async get(
198
205
  kvdb: KeyValueDB,
199
206
  key: string,
@@ -223,7 +230,7 @@ export class KeyValueModule implements DCModule, IKeyValueOperations {
223
230
  * @param seekKey 查询起始键,用于分页查询
224
231
  * @param offset 结果偏移量
225
232
  * @param vaccount 可选的虚拟账户
226
- * @returns [值列表生成的json字符串, 错误信息]
233
+ * @returns [值列表生成的json字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
227
234
  */
228
235
  async getValues(
229
236
  kvdb: KeyValueDB,
@@ -248,12 +255,20 @@ export class KeyValueModule implements DCModule, IKeyValueOperations {
248
255
  }
249
256
  }
250
257
 
258
+ /**
259
+ * 批量获取指定键的值
260
+ * @param kvdb KeyValueDB实例
261
+ * @param keys 逗号分隔的键列表
262
+ * @param writerPubkey 可选,指定写入者公钥
263
+ * @param vaccount 可选的虚拟账户
264
+ * @returns [值的JSON字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
265
+ */
251
266
  async getBatch(
252
267
  kvdb: KeyValueDB,
253
268
  keys: string,
254
269
  writerPubkey: string = "",
255
270
  vaccount: string = ""
256
- ): Promise<[string | null, Error | null]> {
271
+ ): Promise<[string | null, Error | null]> {
257
272
  const err = this.assertInitialized();
258
273
  if (err) {
259
274
  return [null, err];
@@ -268,6 +283,18 @@ export class KeyValueModule implements DCModule, IKeyValueOperations {
268
283
  }
269
284
  }
270
285
 
286
+ /**
287
+ * 获取指定索引的值
288
+ * @param kvdb KeyValueDB实例
289
+ * @param indexKey 索引键名
290
+ * @param indexValue 索引值
291
+ * @param type 索引值类型
292
+ * @param seekKey 查询起始键,用于分页查询
293
+ * @param direction 查询方向
294
+ * @param offset 结果偏移量
295
+ * @param vaccount 可选的虚拟账户
296
+ * @returns [值的JSON字符串, 错误信息] 每个值的格式: value$$$dckv_extra$$${'timestamp':'%d','opuser':'%s'}
297
+ */
271
298
  async getWithIndex(
272
299
  kvdb: KeyValueDB,
273
300
  indexKey:string,
@@ -915,6 +915,20 @@ message GetThemeAuthListReply{
915
915
  bytes authListCid = 2; //获取的授权列表结果集存入ipfs网络中后反馈的cid,客户端再通过 getFile获取,结果集是PublishCommentToThemeRequest的数组 json序列化
916
916
  }
917
917
 
918
+
919
+ message GetUserThemeConfigInfoRequest {
920
+ bytes theme = 1; //主题
921
+ bytes appId = 2; //应用标志
922
+ bytes themeAuthor = 3;//发布主题的的作者pubkey
923
+ bytes UserPubkey = 4;//申请访问配置的用户pubkey
924
+ bytes Vaccount = 5; //虚拟账号,可选,如果有虚拟账号
925
+ }
926
+
927
+ message GetUserThemeConfigInfoReply {
928
+ uint32 flag = 1;//获取结果 0:成功 1:权限不足 2:获取失败
929
+ bytes authInfo = 2; //获取的配置结果,返回请求用户的授权信息,userpubkey:permission:remark(remark可选,存放应用自定义的任何信息),userpubkey为用户的公钥16进制表示(all为特殊情况),permission为用户的权限,remark为备注信息,应用自定义
930
+ }
931
+
918
932
  message GetUserCommentsRequest{
919
933
  bytes appId = 1; //应用标志
920
934
  bytes UserPubkey = 2;//发布评论的用户pubkey
@@ -1483,6 +1497,9 @@ service Service {
1483
1497
  rpc GetThemeComments(GetThemeCommentsRequest) returns (GetThemeCommentsReply){}
1484
1498
 
1485
1499
 
1500
+ //获取用户主题配置的相关信息,包括用户的权限等
1501
+ rpc GetUserThemeConfigInfo(GetUserThemeConfigInfoRequest) returns (GetUserThemeConfigInfoReply) {}
1502
+
1486
1503
 
1487
1504
  //获取指定已开通对象的权限列表(对GetThemeComments进行包装,增加权限判断)//ok
1488
1505
  rpc GetThemeAuthList(GetThemeAuthListRequest) returns (GetThemeAuthListReply){}