web-dc-api 0.0.69 → 0.0.70

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/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){}