@typerighter/rpc-client 0.0.0 → 0.1.0
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/LICENSE +674 -0
- package/package.json +10 -11
- package/src/typedown_server.d.ts +113 -0
- package/src/typedown_server.js +9 -0
- package/src/typedown_server_bg.js +732 -0
- package/src/typedown_server_bg.wasm +0 -0
- package/src/typedown_server_bg.wasm.d.ts +37 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@typerighter/rpc-client",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"description": "WASM RPC client for Typedown.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,18 +9,17 @@
|
|
|
9
9
|
"directory": "packages/rpc-client"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
|
-
"main": "./src/
|
|
13
|
-
"types": "./src/
|
|
12
|
+
"main": "./src/typedown_server.js",
|
|
13
|
+
"types": "./src/typedown_server.d.ts",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"types": "./src/
|
|
17
|
-
"import": "./src/
|
|
16
|
+
"types": "./src/typedown_server.d.ts",
|
|
17
|
+
"import": "./src/typedown_server.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "wasm-pack build ../../crates/tdr-server --target nodejs --out-dir ../../packages/rpc-client/src && rm src/package.json src/.gitignore",
|
|
22
|
-
"prepublishOnly": "pnpm build"
|
|
23
|
-
},
|
|
24
20
|
"author": "Huy-DNA <huydo862003@gmail.com>",
|
|
25
|
-
"license": "AGPL-3.0-only"
|
|
26
|
-
|
|
21
|
+
"license": "AGPL-3.0-only",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "wasm-pack build ../../crates/typedown-server --target bundler --out-dir ../../packages/rpc-client/src && rm -f src/package.json src/.gitignore"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Asset directory configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface TdAssetsDir {
|
|
7
|
+
/**
|
|
8
|
+
* \"local\" assets live in a subdirectory relative to each file
|
|
9
|
+
*/
|
|
10
|
+
mode: string;
|
|
11
|
+
/**
|
|
12
|
+
* Subdirectory name (default: \"assets\")
|
|
13
|
+
*/
|
|
14
|
+
path: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Content file event: A resource file was created, changed, or deleted
|
|
19
|
+
*/
|
|
20
|
+
export interface TdContentNotification {
|
|
21
|
+
content: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Lightweight summary of a content file (no body content)
|
|
26
|
+
*/
|
|
27
|
+
export interface TdContentSummary {
|
|
28
|
+
/**
|
|
29
|
+
* Path relative to the content directory
|
|
30
|
+
*/
|
|
31
|
+
path: string;
|
|
32
|
+
/**
|
|
33
|
+
* Schema type name
|
|
34
|
+
*/
|
|
35
|
+
schema: string;
|
|
36
|
+
/**
|
|
37
|
+
* Frontmatter header as JSON
|
|
38
|
+
*/
|
|
39
|
+
header: Record<string, any>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Schema file event: A schema file was created, changed, or deleted
|
|
44
|
+
*/
|
|
45
|
+
export interface TdSchemaNotification {
|
|
46
|
+
schema: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Schema metadata
|
|
51
|
+
*/
|
|
52
|
+
export interface TdSchemaInfo {
|
|
53
|
+
schema: string;
|
|
54
|
+
properties: Record<string, any>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Site-wide configuration derived from typedown.yaml
|
|
59
|
+
*/
|
|
60
|
+
export interface TdSiteConfig {
|
|
61
|
+
/**
|
|
62
|
+
* URL base path (e.g. \"/\" or \"/docs\")
|
|
63
|
+
*/
|
|
64
|
+
basePath: string;
|
|
65
|
+
/**
|
|
66
|
+
* Content directory path relative to the project root
|
|
67
|
+
*/
|
|
68
|
+
contentDir: string;
|
|
69
|
+
/**
|
|
70
|
+
* Asset directory configuration
|
|
71
|
+
*/
|
|
72
|
+
assetsDir: TdAssetsDir;
|
|
73
|
+
/**
|
|
74
|
+
* Site title from typedown.yaml
|
|
75
|
+
*/
|
|
76
|
+
siteTitle: string;
|
|
77
|
+
/**
|
|
78
|
+
* Site description from typedown.yaml
|
|
79
|
+
*/
|
|
80
|
+
siteDescription: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Structured build result: Header (frontmatter) and content (commonmark body)
|
|
85
|
+
*/
|
|
86
|
+
export interface TdBuiltResource {
|
|
87
|
+
schema: string;
|
|
88
|
+
header: Record<string, any>;
|
|
89
|
+
content: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export class RpcClient {
|
|
94
|
+
private constructor();
|
|
95
|
+
free(): void;
|
|
96
|
+
[Symbol.dispose](): void;
|
|
97
|
+
static connect(addr: string, port: number): Promise<RpcClient>;
|
|
98
|
+
getConfig(): Promise<TdSiteConfig>;
|
|
99
|
+
getSchema(schema: string): Promise<TdSchemaInfo>;
|
|
100
|
+
listFilesGroupedBySchema(): Promise<any>;
|
|
101
|
+
listSchemas(): Promise<string[]>;
|
|
102
|
+
listVault(): Promise<string[]>;
|
|
103
|
+
onConfigChanged(callback: Function): void;
|
|
104
|
+
onContentChanged(callback: Function): void;
|
|
105
|
+
onContentCreated(callback: Function): void;
|
|
106
|
+
onContentDeleted(callback: Function): void;
|
|
107
|
+
onDisconnect(callback: Function): void;
|
|
108
|
+
onSchemaChanged(callback: Function): void;
|
|
109
|
+
onSchemaCreated(callback: Function): void;
|
|
110
|
+
onSchemaDeleted(callback: Function): void;
|
|
111
|
+
requestFile(path: string): Promise<TdBuiltResource>;
|
|
112
|
+
requestFiles(paths: string[]): Promise<TdBuiltResource[]>;
|
|
113
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./typedown_server.d.ts" */
|
|
2
|
+
import * as wasm from "./typedown_server_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./typedown_server_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
RpcClient
|
|
9
|
+
} from "./typedown_server_bg.js";
|