web-dc-api 0.1.42 → 0.1.45

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
@@ -380,7 +380,10 @@ interface StoreunitInfo {
380
380
  }
381
381
  declare class ChainUtil {
382
382
  dcchainapi: ApiPromise | undefined;
383
+ private blockChainAddr;
384
+ private isReconnecting;
383
385
  create: (blockChainAddr: string) => Promise<boolean>;
386
+ reconnect: () => Promise<void>;
384
387
  getBlockHeight(): Promise<number>;
385
388
  getUserInfoWithAccount(account: string): Promise<User>;
386
389
  getUserInfoWithNftHex(nftHexAccount: string): Promise<User>;
@@ -3829,7 +3832,7 @@ interface IAuthOperations {
3829
3832
  * 账户登录通过钱包
3830
3833
  * @returns 是否登录成功
3831
3834
  */
3832
- accountLoginWithWallet(accountInfo?: AccountInfo): Promise<[Account | null, Error | null]>;
3835
+ accountLoginWithWallet(): Promise<[Account | null, Error | null]>;
3833
3836
  /**
3834
3837
  * 账户登录
3835
3838
  * @param nftAccount NFT账户
@@ -28171,10 +28174,11 @@ interface IMessageOperations {
28171
28174
  getMsgFromUserBox(limit?: number): Promise<[dcnet.pb.IUserMsg[] | null, Error | null]>;
28172
28175
  }
28173
28176
 
28174
- declare const walletOpenType: any;
28177
+ declare const isIframeOpen: () => boolean;
28175
28178
  declare const walletIframeOpenFlag: any;
28176
28179
  declare const walletOrigin: string;
28177
28180
  declare const walletUrl: string;
28181
+ declare const shouldReturnUserInfo: boolean;
28178
28182
  declare const walletWindowName = "walletWindow";
28179
28183
  declare const dc_protocol = "/dc/thread/0.0.1";
28180
28184
  declare const dial_timeout = 1000;
@@ -28340,6 +28344,29 @@ interface IKeyValueOperations {
28340
28344
  * @returns [是否设置成功, 时间戳, 错误信息]
28341
28345
  */
28342
28346
  set(kvdb: KeyValueDB, key: string, value: string, indexs: string, vaccount?: string): Promise<[boolean | null, number | null, Error | null]>;
28347
+ /**
28348
+ * 设置需要统计功能的键值对,调用本方法如果valueFlag为false时,会为key对应value中的指定字段进行加减操作,这时直接可以通过get方法传入key获取到最新的值内容
28349
+ * 也自动为DB全局的统计字段进行加减操作,如果valueFlag为true,则只为DB全局的统计字段进行加减操作,支持索引功能
28350
+ * @param kvdb: KeyValueDB,
28351
+ * @param key 键名
28352
+ * @param value 值内容,格式如下:{add:{"field1":10,"field2":5},sub:{"field1":10,"field2":-5},allflag:true,countdate:"2020-01-01",yearFlag:true,monthFlag:true,valueFlag:true,value:"value"}
28353
+ * 表示对field1进行加10,减10,对field2进行加5,减-5,allflag表示是不是累计到主题总计数上,如果为true,则同时更新主题的总计数,否则只更新当前key的统计值,countdate不为空表示统计
28354
+ * 到所有key累计的总的countdate日期上,yearFlag为true,表示统计值添加到所有key累计的总的按年统计,monthFlag为true,表示统计值添加到所有key累计的总的按月统计,valueFlag为true,表示同时设置该key的值为value字段指定的内容
28355
+ * @param indexs 索引列表,格式为json字符串:[{key:"indexkey1",type:"string",value:"value"},{key:"indexkey2",type:"number", value:12}],设置索引后,后续查询可以通过索引快速定位
28356
+ * @param vaccount 可选的虚拟账户
28357
+ * @returns [是否设置成功, 时间戳, 错误信息]
28358
+ */
28359
+ setWithCount(kvdb: KeyValueDB, key: string, value: string, indexs: string, vaccount?: string): Promise<[boolean | null, number | null, Error | null]>;
28360
+ /** 获取DB全局的统计数据,即所有key设置操作累计的的统计数据汇总
28361
+ * @param kvdb: KeyValueDB,
28362
+ * @param countType 统计类型,0:总计数,1:按天统计,2:按月统计,3:按年统计
28363
+ * @param typeStr 类型字符串,countType:0 时为空, countType:1时格式为"yyyy-MM-dd",countType:2时格式为"yyyy-MM",countType:3时格式为"yyyy"
28364
+ * @param vaccount 可选的虚拟账户
28365
+ * @returns [统计值json字符串格式{field1:10,field2:5}, 错误信息]
28366
+ */
28367
+ getDBCount(kvdb: KeyValueDB, countType: number, //统计类型,0:总计数,1:按天统计,2:按月统计,3:按年统计
28368
+ typeStr: string, //类型字符串,countType:0 时为空, countType:1时格式为"yyyy-MM-dd",countType:2时格式为"yyyy-MM",countType:3时格式为"yyyy"
28369
+ vaccount?: string): Promise<[string | null, Error | null]>;
28343
28370
  /**
28344
28371
  * 获取当前用户设置的指定键的元数据
28345
28372
  * @param kvdb
@@ -29068,7 +29095,7 @@ declare class AuthModule implements DCModule, IAuthOperations {
29068
29095
  * 账户登录(钱包登录)不抛出异常
29069
29096
  * @returns [账户信息, 错误信息]
29070
29097
  */
29071
- accountLoginWithWallet(accountInfo?: AccountInfo): Promise<[Account | null, Error | null]>;
29098
+ accountLoginWithWallet(): Promise<[Account | null, Error | null]>;
29072
29099
  exitLogin(): void;
29073
29100
  /**
29074
29101
  * 账户登录(钱包登录)不抛出异常
@@ -29527,6 +29554,29 @@ declare class KeyValueModule implements DCModule, IKeyValueOperations {
29527
29554
  GetUserAuth(kvdb: KeyValueDB, userPubkey: string, vaccount?: string): Promise<[ThemeAuthInfo | null, Error | null]>;
29528
29555
  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
29529
29556
  vaccount?: string): Promise<[boolean | null, number | null, Error | null]>;
29557
+ /**
29558
+ * 设置需要统计功能的键值对,调用本方法如果valueFlag为false时,会为key对应value中的指定字段进行加减操作,这时直接可以通过get方法传入key获取到最新的值内容
29559
+ * 也自动为DB全局的统计字段进行加减操作,如果valueFlag为true,则只为DB全局的统计字段进行加减操作,支持索引功能
29560
+ * @param kvdb: KeyValueDB,
29561
+ * @param key 键名
29562
+ * @param value 值内容,格式如下:{add:{"field1":10,"field2":5},sub:{"field1":10,"field2":-5},allflag:true,countdate:"2020-01-01",yearFlag:true,monthFlag:true,valueFlag:true,value:"value"}
29563
+ * 表示对field1进行加10,减10,对field2进行加5,减-5,allflag表示是不是累计到主题总计数上,如果为true,则同时更新主题的总计数,否则只更新当前key的统计值,countdate不为空表示统计
29564
+ * 到所有key累计的总的countdate日期上,yearFlag为true,表示统计值添加到所有key累计的总的按年统计,monthFlag为true,表示统计值添加到所有key累计的总的按月统计,valueFlag为true,表示同时设置该key的值为value字段指定的内容
29565
+ * @param indexs 索引列表,格式为json字符串:[{key:"indexkey1",type:"string",value:"value"},{key:"indexkey2",type:"number", value:12}],设置索引后,后续查询可以通过索引快速定位
29566
+ * @param vaccount 可选的虚拟账户
29567
+ * @returns [是否设置成功, 时间戳, 错误信息]
29568
+ */
29569
+ setWithCount(kvdb: KeyValueDB, key: string, value: string, indexs: string, vaccount?: string): Promise<[boolean | null, number | null, Error | null]>;
29570
+ /** 获取DB全局的统计数据,即所有key设置操作累计的的统计数据汇总
29571
+ * @param kvdb: KeyValueDB,
29572
+ * @param countType 统计类型,0:总计数,1:按天统计,2:按月统计,3:按年统计
29573
+ * @param typeStr 类型字符串,countType:0 时为空, countType:1时格式为"yyyy-MM-dd",countType:2时格式为"yyyy-MM",countType:3时格式为"yyyy"
29574
+ * @param vaccount 可选的虚拟账户
29575
+ * @returns [统计值json字符串格式{field1:10,field2:5}, 错误信息]
29576
+ */
29577
+ getDBCount(kvdb: KeyValueDB, countType: number, //统计类型,0:总计数,1:按天统计,2:按月统计,3:按年统计
29578
+ typeStr: string, //类型字符串,countType:0 时为空, countType:1时格式为"yyyy-MM-dd",countType:2时格式为"yyyy-MM",countType:3时格式为"yyyy"
29579
+ vaccount?: string): Promise<[string | null, Error | null]>;
29530
29580
  /**
29531
29581
  * 获取当前用户设置的指定键的元数据
29532
29582
  * @param kvdb
@@ -30111,6 +30161,11 @@ declare class EntityRepository<T extends BaseEntity> {
30111
30161
  findByIndex(indexKey: string, indexValue: string, options?: FindIndexOptions): Promise<T[]>;
30112
30162
  findOneByIndex(indexKey: string, indexValue: string, options?: Omit<FindIndexOptions, "limit">): Promise<T | null>;
30113
30163
  getValues(keyPrefix: string, options?: FindValuesOptions): Promise<T[]>;
30164
+ /** 断言仓储已初始化 */
30165
+ private assertInitialized;
30166
+ saveWithCount(entity: T, value: string, //value中可能包含valueFlag字段,表示是否需要合并entity.toJSON(),格式:{add:{"field1":10,"field2":5},sub:{"field2":5},allflag:true,countdate:"2020-01-01",yearFlag:true,monthFlag:true,valueFlag:true,value:"value"}
30167
+ indexs?: string, vaccount?: string): Promise<[boolean | null, number | null, Error | null]>;
30168
+ getDBCount(countType: number, typeStr: string, vaccount?: string): Promise<[string | null, Error | null]>;
30114
30169
  }
30115
30170
 
30116
30171
  type PrimitiveType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'binary';
@@ -30302,5 +30357,5 @@ declare global {
30302
30357
  }
30303
30358
  }
30304
30359
 
30305
- export { AIProxyModule, AIStreamResponseFlag, AuthModule, BaseEntity, CacheModule, ClientModule, Column, CommentModule, CommentType, CoreModuleName, DC, DatabaseModule, Direction, Ed25519PrivKey, Ed25519PubKey, Entity, EntityRepository, Errors, FileModule, Index, KeyManager, KeyValueDB, KeyValueModule, LogLevel, MessageModule, ModuleSystem, NFTBindStatus, OffChainOpTimes, OffChainOpTimesLimit, OffChainSpaceLimit, PeerStatus, ThemePermission, UploadStatus, UtilModule, composeCompositeIndexValue, configureLogger, createLogger, dc_protocol, dial_timeout, extractSchemasFromSources, getColumns, getEntityName, getEntitySchema, getIndexes, isServiceWorkerActive, keyExpire, metadata, registerServiceWorker, updateServiceWorker, walletIframeOpenFlag, walletOpenType, walletOrigin, walletUrl, walletWindowName };
30360
+ export { AIProxyModule, AIStreamResponseFlag, AuthModule, BaseEntity, CacheModule, ClientModule, Column, CommentModule, CommentType, CoreModuleName, DC, DatabaseModule, Direction, Ed25519PrivKey, Ed25519PubKey, Entity, EntityRepository, Errors, FileModule, Index, KeyManager, KeyValueDB, KeyValueModule, LogLevel, MessageModule, ModuleSystem, NFTBindStatus, OffChainOpTimes, OffChainOpTimesLimit, OffChainSpaceLimit, PeerStatus, ThemePermission, UploadStatus, UtilModule, composeCompositeIndexValue, configureLogger, createLogger, dc_protocol, dial_timeout, extractSchemasFromSources, getColumns, getEntityName, getEntitySchema, getIndexes, isIframeOpen, isServiceWorkerActive, keyExpire, metadata, registerServiceWorker, shouldReturnUserInfo, updateServiceWorker, walletIframeOpenFlag, walletOrigin, walletUrl, walletWindowName };
30306
30361
  export type { AIChatMessage, AIChatMessageRequest, AIMessageContent, AIMessageMediaSource, AIProxyConfig, APPInfo, Account, AccountInfo, ColumnMeta, ColumnOptions, DCConnectInfo, DCContext, DCModule, EIP712SignReqMessage, EntityMeta, EntityOptions, FileTransmit, FindIndexOptions, FindValuesOptions, FunctionDef, GetUserAIProxyAuthParams, IAICallConfig, IAppInfo, IAuthOperations, ICacheOperations, IClientOperations, ICommentOperations, IDatabaseOperations, IFileOperations, IKeyValueOperations, IMessageOperations, IUtilOperations, IndexField, IndexMeta, IndexOptions, ModelConfig, NormalizedIndexField, OnStreamResponseType, PrimitiveType, PrintableSchema, ProxyCallConfig, ResponseMessage, SendMessage, SignHandler, SignReqMessage, SignReqMessageData, SignResponseMessage, ThemeAuthInfo, ThemeComment, ThemeObj, ToolDefinition, User, UserProxyCallConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-dc-api",
3
- "version": "0.1.42",
3
+ "version": "0.1.45",
4
4
  "description": "一个革命性的去中心化 Web 开发 SDK,让您无需任何服务器即可构建完整的互联网应用",
5
5
  "type": "module",
6
6
  "browser": "dist/dc.min.js",