web-dc-api 0.1.45 → 0.1.46
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Multiaddr } from '@multiformats/multiaddr';
|
|
2
2
|
import { ApiPromise } from '@polkadot/api';
|
|
3
3
|
import { Libp2p } from 'libp2p';
|
|
4
|
-
import { Blocks,
|
|
4
|
+
import { Blocks, Helia } from 'helia';
|
|
5
5
|
import { CID } from 'multiformats/cid';
|
|
6
6
|
import { MultihashDigest } from 'multiformats/hashes/interface';
|
|
7
7
|
import { Ed25519PublicKey, Ed25519PrivateKey, PrivateKey, PublicKey, PeerId, Libp2p as Libp2p$1 } from '@libp2p/interface';
|
|
@@ -415,7 +415,7 @@ interface CustomMessage {
|
|
|
415
415
|
declare class DcUtil {
|
|
416
416
|
dcChain: ChainUtil;
|
|
417
417
|
connectLength: number;
|
|
418
|
-
dcNodeClient:
|
|
418
|
+
dcNodeClient: Helia<Libp2p> | undefined;
|
|
419
419
|
defaultPeerId: string | undefined;
|
|
420
420
|
constructor(dcChain: ChainUtil);
|
|
421
421
|
_connectToObjNodes: (cid: string) => Promise<[Multiaddr | null, string[] | null]>;
|
|
@@ -424,7 +424,7 @@ declare class DcUtil {
|
|
|
424
424
|
connectToUserDcPeer: (account: Uint8Array) => Promise<Client | null>;
|
|
425
425
|
connectToUserAllDcPeers: (account: Uint8Array) => Promise<Client[] | null>;
|
|
426
426
|
_connectNodeAddrs: (peers: string[]) => Promise<Multiaddr | null>;
|
|
427
|
-
_createHeliaNode: () => Promise<
|
|
427
|
+
_createHeliaNode: () => Promise<Helia<Libp2p>>;
|
|
428
428
|
_getConnectedPeerId: () => Promise<string>;
|
|
429
429
|
_getNodeAddr: (peerId: string) => Promise<Multiaddr | undefined>;
|
|
430
430
|
getDefaultDcNodeAddr: () => Promise<Multiaddr | undefined>;
|
|
@@ -28813,7 +28813,7 @@ declare class DBManager {
|
|
|
28813
28813
|
* 定义所有模块可以访问的核心系统组件
|
|
28814
28814
|
*/
|
|
28815
28815
|
interface DCContext {
|
|
28816
|
-
dcNodeClient:
|
|
28816
|
+
dcNodeClient: Helia;
|
|
28817
28817
|
dcChain: ChainUtil;
|
|
28818
28818
|
dcutil: DcUtil;
|
|
28819
28819
|
swInited: boolean;
|
|
@@ -29946,7 +29946,7 @@ declare class DC implements DCContext {
|
|
|
29946
29946
|
blockChainAddr: string;
|
|
29947
29947
|
backChainAddr: string;
|
|
29948
29948
|
dcChain: ChainUtil;
|
|
29949
|
-
dcNodeClient:
|
|
29949
|
+
dcNodeClient: Helia<Libp2p$1>;
|
|
29950
29950
|
dcutil: DcUtil;
|
|
29951
29951
|
privateKey: Ed25519PrivKey | undefined | null;
|
|
29952
29952
|
publicKey: Ed25519PubKey | undefined;
|
|
@@ -30251,34 +30251,6 @@ declare function getEntityName(target: Function | object): string | undefined;
|
|
|
30251
30251
|
declare function getColumns(target: Function | object): ColumnMeta[];
|
|
30252
30252
|
declare function getIndexes(target: Function | object): IndexMeta[];
|
|
30253
30253
|
|
|
30254
|
-
type PrintableSchema = {
|
|
30255
|
-
entityName: string;
|
|
30256
|
-
namespace?: string;
|
|
30257
|
-
ttlSeconds?: number;
|
|
30258
|
-
versioned?: boolean;
|
|
30259
|
-
columns: Array<{
|
|
30260
|
-
name: string;
|
|
30261
|
-
type?: string;
|
|
30262
|
-
required?: boolean;
|
|
30263
|
-
unique?: boolean;
|
|
30264
|
-
index?: boolean;
|
|
30265
|
-
default?: unknown;
|
|
30266
|
-
}>;
|
|
30267
|
-
indexes: Array<{
|
|
30268
|
-
name: string;
|
|
30269
|
-
fields: Array<{
|
|
30270
|
-
field: string;
|
|
30271
|
-
order: "asc" | "desc";
|
|
30272
|
-
}>;
|
|
30273
|
-
unique?: boolean;
|
|
30274
|
-
ttlSeconds?: number;
|
|
30275
|
-
}>;
|
|
30276
|
-
};
|
|
30277
|
-
interface FileContentMap {
|
|
30278
|
-
[fileName: string]: string;
|
|
30279
|
-
}
|
|
30280
|
-
declare function extractSchemasFromSources(sources: FileContentMap): Promise<PrintableSchema[]>;
|
|
30281
|
-
|
|
30282
30254
|
/**
|
|
30283
30255
|
* 注册 Service Worker 并设置消息监听器
|
|
30284
30256
|
* @param fileOps 文件操作对象,用于处理IPFS请求
|
|
@@ -30357,5 +30329,5 @@ declare global {
|
|
|
30357
30329
|
}
|
|
30358
30330
|
}
|
|
30359
30331
|
|
|
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,
|
|
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,
|
|
30332
|
+
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, getColumns, getEntityName, getEntitySchema, getIndexes, isIframeOpen, isServiceWorkerActive, keyExpire, metadata, registerServiceWorker, shouldReturnUserInfo, updateServiceWorker, walletIframeOpenFlag, walletOrigin, walletUrl, walletWindowName };
|
|
30333
|
+
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, ProxyCallConfig, ResponseMessage, SendMessage, SignHandler, SignReqMessage, SignReqMessageData, SignResponseMessage, ThemeAuthInfo, ThemeComment, ThemeObj, ToolDefinition, User, UserProxyCallConfig };
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-dc-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"description": "一个革命性的去中心化 Web 开发 SDK,让您无需任何服务器即可构建完整的互联网应用",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"browser": "dist/dc.min.js",
|
|
7
6
|
"main": "dist/cjs/index.js",
|
|
8
7
|
"module": "dist/esm/index.js",
|
|
9
8
|
"types": "dist/index.d.ts",
|
|
@@ -11,8 +10,7 @@
|
|
|
11
10
|
".": {
|
|
12
11
|
"types": "./dist/index.d.ts",
|
|
13
12
|
"import": "./dist/esm/index.js",
|
|
14
|
-
"require": "./dist/cjs/index.js"
|
|
15
|
-
"browser": "./dist/dc.min.js"
|
|
13
|
+
"require": "./dist/cjs/index.js"
|
|
16
14
|
}
|
|
17
15
|
},
|
|
18
16
|
"repository": {
|
|
@@ -27,6 +25,7 @@
|
|
|
27
25
|
"build:w": "npx rollup -c -w",
|
|
28
26
|
"build": "NODE_ENV=production npx rollup -c",
|
|
29
27
|
"build:analyze": "npx rollup -c && npx webpack-bundle-analyzer dist/esm/chunks/*.js",
|
|
28
|
+
"fix:pb": "node scripts/fix-pb.cjs",
|
|
30
29
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
31
30
|
"dev": "nodemon --watch lib --ext ts,tsx,js,jsx,json --ignore 'src/**/*.test.ts' --exec 'npx yalc publish --push'"
|
|
32
31
|
},
|
|
@@ -34,18 +33,15 @@
|
|
|
34
33
|
"license": "ISC",
|
|
35
34
|
"keywords": [],
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@helia/
|
|
41
|
-
"@helia/dag-cbor": "^4.0.3",
|
|
42
|
-
"@helia/interface": "4.0.1",
|
|
43
|
-
"@helia/unixfs": "4.0.3",
|
|
36
|
+
"@helia/block-brokers": "^5.0.0",
|
|
37
|
+
"@helia/dag-cbor": "^5.0.0",
|
|
38
|
+
"@helia/interface": "^6.0.0",
|
|
39
|
+
"@helia/unixfs": "^7.0.0",
|
|
44
40
|
"@ipld/dag-cbor": "^9.2.2",
|
|
45
|
-
"@libp2p/crypto": "^5.0
|
|
46
|
-
"@libp2p/interface": "^
|
|
41
|
+
"@libp2p/crypto": "^5.1.0",
|
|
42
|
+
"@libp2p/interface": "^3.1.0",
|
|
47
43
|
"@libp2p/interface-keys": "^1.0.8",
|
|
48
|
-
"@libp2p/peer-id": "^
|
|
44
|
+
"@libp2p/peer-id": "^6.0.0",
|
|
49
45
|
"@multiformats/multiaddr": "^12.4.0",
|
|
50
46
|
"@noble/curves": "^1.6.0",
|
|
51
47
|
"@noble/hashes": "^2.0.1",
|
|
@@ -56,24 +52,16 @@
|
|
|
56
52
|
"@textile/threads-id": "^0.6.1",
|
|
57
53
|
"ajv": "^8.17.1",
|
|
58
54
|
"async-mutex": "^0.5.0",
|
|
59
|
-
"blockstore-idb": "^
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"google-protobuf": "~3.21.2",
|
|
64
|
-
"grpc-libp2p-client": "^0.0.29",
|
|
65
|
-
"helia": "5.3.0",
|
|
66
|
-
"it-to-buffer": "^4.0.7",
|
|
55
|
+
"blockstore-idb": "^3.0.1",
|
|
56
|
+
"datastore-idb": "^4.0.1",
|
|
57
|
+
"grpc-libp2p-client": "^0.0.31",
|
|
58
|
+
"helia": "^6.0.0",
|
|
67
59
|
"jose": "^6.0.8",
|
|
68
|
-
"jsbn": "^1.1.0",
|
|
69
|
-
"jscrypto": "^1.0.3",
|
|
70
60
|
"jwt-decode": "^4.0.0",
|
|
71
|
-
"libp2p": "^
|
|
61
|
+
"libp2p": "^3.1.3",
|
|
72
62
|
"lru-cache": "^11.1.0",
|
|
73
63
|
"multiformats": "^13.3.2",
|
|
74
|
-
"process": "^0.11.10",
|
|
75
64
|
"protobufjs": "^7.5.0",
|
|
76
|
-
"tweetnacl": "^1.0.3",
|
|
77
65
|
"uint8arrays": "^5.1.0",
|
|
78
66
|
"ulid": "^2.3.0"
|
|
79
67
|
},
|
|
@@ -82,7 +70,10 @@
|
|
|
82
70
|
},
|
|
83
71
|
"devDependencies": {
|
|
84
72
|
"@babel/core": "^7.27.4",
|
|
73
|
+
"@babel/parser": "^7.28.4",
|
|
85
74
|
"@babel/preset-env": "^7.27.2",
|
|
75
|
+
"@babel/traverse": "^7.28.4",
|
|
76
|
+
"@babel/types": "^7.28.4",
|
|
86
77
|
"@rollup/plugin-babel": "^6.0.4",
|
|
87
78
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
88
79
|
"@rollup/plugin-inject": "^5.0.5",
|
|
@@ -91,7 +82,6 @@
|
|
|
91
82
|
"@rollup/plugin-replace": "^6.0.2",
|
|
92
83
|
"@rollup/plugin-terser": "^0.4.4",
|
|
93
84
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
94
|
-
"@types/google-protobuf": "^3.15.12",
|
|
95
85
|
"@types/jsbn": "^1.2.33",
|
|
96
86
|
"cbor-x": "^1.6.0",
|
|
97
87
|
"core-js": "^3.43.0",
|
|
@@ -100,6 +90,7 @@
|
|
|
100
90
|
"lodash": "~4.17.0",
|
|
101
91
|
"mp4box": "^0.5.4",
|
|
102
92
|
"nodemon": "^3.1.9",
|
|
93
|
+
"process": "^0.11.10",
|
|
103
94
|
"rollup-plugin-dts": "^6.2.1",
|
|
104
95
|
"typescript": "^5.8.3",
|
|
105
96
|
"vite": "^7.1.2",
|