@wetoria/siyuan-sdk 0.0.5 → 1.0.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/README.md +34 -25
- package/dist/api/_demo/index.d.ts +15 -0
- package/dist/api/_demo/index.d.ts.map +1 -0
- package/dist/api/_demo/index.js +5 -0
- package/dist/api/_demo/index.js.map +1 -0
- package/dist/api/account/index.d.ts +47 -0
- package/dist/api/account/index.d.ts.map +1 -0
- package/dist/api/account/index.js +18 -0
- package/dist/api/account/index.js.map +1 -0
- package/dist/api/ai/index.d.ts +26 -0
- package/dist/api/ai/index.d.ts.map +1 -0
- package/dist/api/ai/index.js +9 -0
- package/dist/api/ai/index.js.map +1 -0
- package/dist/api/archive/index.d.ts +10 -0
- package/dist/api/archive/index.d.ts.map +1 -1
- package/dist/api/archive/index.js +3 -0
- package/dist/api/archive/index.js.map +1 -1
- package/dist/api/asset/index.d.ts +161 -0
- package/dist/api/asset/index.d.ts.map +1 -1
- package/dist/api/asset/index.js +51 -0
- package/dist/api/asset/index.js.map +1 -1
- package/dist/api/attr/index.d.ts +15 -0
- package/dist/api/attr/index.d.ts.map +1 -1
- package/dist/api/attr/index.js +6 -0
- package/dist/api/attr/index.js.map +1 -1
- package/dist/api/av/index.d.ts +479 -0
- package/dist/api/av/index.d.ts.map +1 -0
- package/dist/api/av/index.js +110 -0
- package/dist/api/av/index.js.map +1 -0
- package/dist/api/av/types.d.ts +129 -0
- package/dist/api/av/types.d.ts.map +1 -0
- package/dist/api/av/types.js +2 -0
- package/dist/api/av/types.js.map +1 -0
- package/dist/api/bazaar/index.d.ts +293 -0
- package/dist/api/bazaar/index.d.ts.map +1 -0
- package/dist/api/bazaar/index.js +72 -0
- package/dist/api/bazaar/index.js.map +1 -0
- package/dist/api/block/index.d.ts +346 -0
- package/dist/api/block/index.d.ts.map +1 -1
- package/dist/api/block/index.js +118 -0
- package/dist/api/block/index.js.map +1 -1
- package/dist/api/bookmark/index.d.ts +30 -0
- package/dist/api/bookmark/index.d.ts.map +1 -0
- package/dist/api/bookmark/index.js +12 -0
- package/dist/api/bookmark/index.js.map +1 -0
- package/dist/api/broadcast/index.d.ts +54 -0
- package/dist/api/broadcast/index.d.ts.map +1 -0
- package/dist/api/broadcast/index.js +15 -0
- package/dist/api/broadcast/index.js.map +1 -0
- package/dist/api/clipboard/index.d.ts +12 -0
- package/dist/api/clipboard/index.d.ts.map +1 -0
- package/dist/api/clipboard/index.js +6 -0
- package/dist/api/clipboard/index.js.map +1 -0
- package/dist/api/cloud/index.d.ts +27 -0
- package/dist/api/cloud/index.d.ts.map +1 -0
- package/dist/api/cloud/index.js +6 -0
- package/dist/api/cloud/index.js.map +1 -0
- package/dist/api/export/index.d.ts +344 -4
- package/dist/api/export/index.d.ts.map +1 -1
- package/dist/api/export/index.js +83 -2
- package/dist/api/export/index.js.map +1 -1
- package/dist/api/extension/index.d.ts +12 -0
- package/dist/api/extension/index.d.ts.map +1 -0
- package/dist/api/extension/index.js +6 -0
- package/dist/api/extension/index.js.map +1 -0
- package/dist/api/file/index.d.ts +40 -0
- package/dist/api/file/index.d.ts.map +1 -1
- package/dist/api/file/index.js +12 -0
- package/dist/api/file/index.js.map +1 -1
- package/dist/api/filetree/index.d.ts +303 -0
- package/dist/api/filetree/index.d.ts.map +1 -1
- package/dist/api/filetree/index.js +69 -0
- package/dist/api/filetree/index.js.map +1 -1
- package/dist/api/format/index.d.ts +34 -0
- package/dist/api/format/index.d.ts.map +1 -0
- package/dist/api/format/index.js +12 -0
- package/dist/api/format/index.js.map +1 -0
- package/dist/api/graph/index.d.ts +59 -0
- package/dist/api/graph/index.d.ts.map +1 -0
- package/dist/api/graph/index.js +15 -0
- package/dist/api/graph/index.js.map +1 -0
- package/dist/api/history/index.d.ts +120 -0
- package/dist/api/history/index.d.ts.map +1 -0
- package/dist/api/history/index.js +30 -0
- package/dist/api/history/index.js.map +1 -0
- package/dist/api/icon/index.d.ts +23 -0
- package/dist/api/icon/index.d.ts.map +1 -0
- package/dist/api/icon/index.js +17 -0
- package/dist/api/icon/index.js.map +1 -0
- package/dist/api/import/index.d.ts +34 -0
- package/dist/api/import/index.d.ts.map +1 -0
- package/dist/api/import/index.js +21 -0
- package/dist/api/import/index.js.map +1 -0
- package/dist/api/inbox/index.d.ts +32 -0
- package/dist/api/inbox/index.d.ts.map +1 -0
- package/dist/api/inbox/index.js +12 -0
- package/dist/api/inbox/index.js.map +1 -0
- package/dist/api/index.d.ts +61 -3
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +30 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/lute/index.d.ts +42 -0
- package/dist/api/lute/index.d.ts.map +1 -0
- package/dist/api/lute/index.js +12 -0
- package/dist/api/lute/index.js.map +1 -0
- package/dist/api/notebook/index.d.ts +28 -0
- package/dist/api/notebook/index.d.ts.map +1 -1
- package/dist/api/notebook/index.js +9 -0
- package/dist/api/notebook/index.js.map +1 -1
- package/dist/api/outline/index.d.ts +18 -0
- package/dist/api/outline/index.d.ts.map +1 -0
- package/dist/api/outline/index.js +6 -0
- package/dist/api/outline/index.js.map +1 -0
- package/dist/api/petal/index.d.ts +29 -0
- package/dist/api/petal/index.d.ts.map +1 -0
- package/dist/api/petal/index.js +9 -0
- package/dist/api/petal/index.js.map +1 -0
- package/dist/api/{sql → query}/index.d.ts +3 -2
- package/dist/api/query/index.d.ts.map +1 -0
- package/dist/api/{sql → query}/index.js +1 -0
- package/dist/api/query/index.js.map +1 -0
- package/dist/api/ref/index.d.ts +108 -0
- package/dist/api/ref/index.d.ts.map +1 -0
- package/dist/api/ref/index.js +18 -0
- package/dist/api/ref/index.js.map +1 -0
- package/dist/api/repo/index.d.ts +212 -0
- package/dist/api/repo/index.d.ts.map +1 -0
- package/dist/api/repo/index.js +69 -0
- package/dist/api/repo/index.js.map +1 -0
- package/dist/api/riff/index.d.ts +218 -0
- package/dist/api/riff/index.d.ts.map +1 -0
- package/dist/api/riff/index.js +54 -0
- package/dist/api/riff/index.js.map +1 -0
- package/dist/api/search/index.d.ts +269 -0
- package/dist/api/search/index.d.ts.map +1 -0
- package/dist/api/search/index.js +45 -0
- package/dist/api/search/index.js.map +1 -0
- package/dist/api/setting/index.d.ts +150 -0
- package/dist/api/setting/index.d.ts.map +1 -0
- package/dist/api/setting/index.js +66 -0
- package/dist/api/setting/index.js.map +1 -0
- package/dist/api/snippet/index.d.ts +42 -0
- package/dist/api/snippet/index.d.ts.map +1 -0
- package/dist/api/snippet/index.js +12 -0
- package/dist/api/snippet/index.js.map +1 -0
- package/dist/api/storage/index.d.ts +122 -0
- package/dist/api/storage/index.d.ts.map +1 -0
- package/dist/api/storage/index.js +45 -0
- package/dist/api/storage/index.js.map +1 -0
- package/dist/api/sync/index.d.ts +176 -0
- package/dist/api/sync/index.d.ts.map +1 -0
- package/dist/api/sync/index.js +70 -0
- package/dist/api/sync/index.js.map +1 -0
- package/dist/api/system/index.d.ts +264 -4
- package/dist/api/system/index.d.ts.map +1 -1
- package/dist/api/system/index.js +109 -4
- package/dist/api/system/index.js.map +1 -1
- package/dist/api/tag/index.d.ts +37 -0
- package/dist/api/tag/index.d.ts.map +1 -0
- package/dist/api/tag/index.js +12 -0
- package/dist/api/tag/index.js.map +1 -0
- package/dist/api/template/index.d.ts +12 -0
- package/dist/api/template/index.d.ts.map +1 -1
- package/dist/api/template/index.js +3 -0
- package/dist/api/template/index.js.map +1 -1
- package/dist/api/transactions/index.d.ts +18 -0
- package/dist/api/transactions/index.d.ts.map +1 -0
- package/dist/api/transactions/index.js +6 -0
- package/dist/api/transactions/index.js.map +1 -0
- package/dist/api/ui/index.d.ts +44 -0
- package/dist/api/ui/index.d.ts.map +1 -0
- package/dist/api/ui/index.js +21 -0
- package/dist/api/ui/index.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -4
- package/dist/api/sql/index.d.ts.map +0 -1
- package/dist/api/sql/index.js.map +0 -1
- package/src/api/archive/index.ts +0 -26
- package/src/api/asset/index.ts +0 -26
- package/src/api/attr/index.ts +0 -72
- package/src/api/block/index.ts +0 -285
- package/src/api/convert/index.ts +0 -18
- package/src/api/export/index.ts +0 -36
- package/src/api/file/index.ts +0 -77
- package/src/api/filetree/index.ts +0 -129
- package/src/api/index.ts +0 -56
- package/src/api/network/index.ts +0 -32
- package/src/api/notebook/index.ts +0 -102
- package/src/api/notification/index.ts +0 -33
- package/src/api/sql/index.ts +0 -65
- package/src/api/sqlite/index.ts +0 -20
- package/src/api/system/index.ts +0 -46
- package/src/api/template/index.ts +0 -32
- package/src/core/index.ts +0 -287
- package/src/index.ts +0 -16
- package/src/types/index.ts +0 -201
- package/src/types/transaction/index.ts +0 -45
- package/src/utils/index.ts +0 -3
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { SyApiMethodResponse } from '../../core/index.js'
|
|
2
|
-
import type {
|
|
3
|
-
BlockId,
|
|
4
|
-
NotebookId,
|
|
5
|
-
} from '../../types/index.js'
|
|
6
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* File Tree API 类型定义
|
|
10
|
-
*/
|
|
11
|
-
export interface FileTreeAPI {
|
|
12
|
-
/**
|
|
13
|
-
* 创建日记
|
|
14
|
-
* @path /api/filetree/createDailyNote
|
|
15
|
-
*/
|
|
16
|
-
createDailyNote: (notebook: NotebookId) => SyApiMethodResponse<{
|
|
17
|
-
id: string
|
|
18
|
-
}>
|
|
19
|
-
/**
|
|
20
|
-
* 使用 Markdown 创建文档
|
|
21
|
-
* @path /api/filetree/createDocWithMd
|
|
22
|
-
*/
|
|
23
|
-
createDocWithMd: (
|
|
24
|
-
notebook: NotebookId,
|
|
25
|
-
path: string,
|
|
26
|
-
markdown: string
|
|
27
|
-
) => SyApiMethodResponse<string>
|
|
28
|
-
/**
|
|
29
|
-
* 重命名文档
|
|
30
|
-
* @path /api/filetree/renameDoc
|
|
31
|
-
*/
|
|
32
|
-
renameDoc: (
|
|
33
|
-
notebook: NotebookId,
|
|
34
|
-
path: string,
|
|
35
|
-
title: string
|
|
36
|
-
) => SyApiMethodResponse<string>
|
|
37
|
-
/**
|
|
38
|
-
* 删除文档
|
|
39
|
-
* @path /api/filetree/removeDoc
|
|
40
|
-
*/
|
|
41
|
-
removeDoc: (
|
|
42
|
-
notebook: NotebookId,
|
|
43
|
-
path: string
|
|
44
|
-
) => SyApiMethodResponse<any>
|
|
45
|
-
/**
|
|
46
|
-
* 移动文档
|
|
47
|
-
* @path /api/filetree/moveDocs
|
|
48
|
-
*/
|
|
49
|
-
moveDocs: (
|
|
50
|
-
fromPaths: string[],
|
|
51
|
-
toNotebook: NotebookId,
|
|
52
|
-
toPath: string
|
|
53
|
-
) => SyApiMethodResponse<any>
|
|
54
|
-
/**
|
|
55
|
-
* 根据路径获取人类可读路径
|
|
56
|
-
* @path /api/filetree/getHPathByPath
|
|
57
|
-
*/
|
|
58
|
-
getHPathByPath: (
|
|
59
|
-
notebook: NotebookId,
|
|
60
|
-
path: string
|
|
61
|
-
) => SyApiMethodResponse<string>
|
|
62
|
-
/**
|
|
63
|
-
* 根据块 ID 获取人类可读路径
|
|
64
|
-
* @path /api/filetree/getHPathByID
|
|
65
|
-
*/
|
|
66
|
-
getHPathByID: (id: BlockId) => SyApiMethodResponse<string>
|
|
67
|
-
/**
|
|
68
|
-
* 根据人类可读路径获取块 ID 列表
|
|
69
|
-
* @path /api/filetree/getIDsByHPath
|
|
70
|
-
*/
|
|
71
|
-
getIDsByHPath: (
|
|
72
|
-
notebook: NotebookId,
|
|
73
|
-
path: string
|
|
74
|
-
) => SyApiMethodResponse<string[]>
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
SiYuanAPI.prototype.createDailyNote = function (notebook: string) {
|
|
78
|
-
return this.request('/api/filetree/createDailyNote', { notebook })
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
SiYuanAPI.prototype.createDocWithMd = function (notebook: string, path: string, markdown: string) {
|
|
82
|
-
return this.request('/api/filetree/createDocWithMd', {
|
|
83
|
-
notebook,
|
|
84
|
-
path,
|
|
85
|
-
markdown,
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
SiYuanAPI.prototype.renameDoc = function (notebook: string, path: string, title: string) {
|
|
90
|
-
return this.request('/api/filetree/renameDoc', {
|
|
91
|
-
doc: notebook,
|
|
92
|
-
path,
|
|
93
|
-
title,
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
SiYuanAPI.prototype.removeDoc = function (notebook: string, path: string) {
|
|
98
|
-
return this.request('/api/filetree/removeDoc', {
|
|
99
|
-
notebook,
|
|
100
|
-
path,
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
SiYuanAPI.prototype.moveDocs = function (fromPaths: string[], toNotebook: string, toPath: string) {
|
|
105
|
-
return this.request('/api/filetree/moveDocs', {
|
|
106
|
-
fromPaths,
|
|
107
|
-
toNotebook,
|
|
108
|
-
toPath,
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
SiYuanAPI.prototype.getHPathByPath = function (notebook: string, path: string) {
|
|
113
|
-
return this.request('/api/filetree/getHPathByPath', {
|
|
114
|
-
notebook,
|
|
115
|
-
path,
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
SiYuanAPI.prototype.getHPathByID = function (id: string) {
|
|
120
|
-
return this.request('/api/filetree/getHPathByID', { id })
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
SiYuanAPI.prototype.getIDsByHPath = function (notebook: string, path: string) {
|
|
124
|
-
return this.request('/api/filetree/getIDsByHPath', {
|
|
125
|
-
notebook,
|
|
126
|
-
path,
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
|
package/src/api/index.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ArchiveAPI } from './archive/index.js'
|
|
2
|
-
import type { AssetAPI } from './asset/index.js'
|
|
3
|
-
import type { AttrAPI } from './attr/index.js'
|
|
4
|
-
import type { BlockAPI } from './block/index.js'
|
|
5
|
-
import type { ConvertAPI } from './convert/index.js'
|
|
6
|
-
import type { ExportAPI } from './export/index.js'
|
|
7
|
-
import type { FileAPI } from './file/index.js'
|
|
8
|
-
import type { FileTreeAPI } from './filetree/index.js'
|
|
9
|
-
import type { NetworkAPI } from './network/index.js'
|
|
10
|
-
import type { NotebookAPI } from './notebook/index.js'
|
|
11
|
-
import type { NotificationAPI } from './notification/index.js'
|
|
12
|
-
import type { SqlAPI } from './sql/index.js'
|
|
13
|
-
import type { SqliteAPI } from './sqlite/index.js'
|
|
14
|
-
import type { SystemAPI } from './system/index.js'
|
|
15
|
-
import type { TemplateAPI } from './template/index.js'
|
|
16
|
-
|
|
17
|
-
// 导入所有 API 实现
|
|
18
|
-
import './archive/index.js'
|
|
19
|
-
import './asset/index.js'
|
|
20
|
-
import './attr/index.js'
|
|
21
|
-
import './block/index.js'
|
|
22
|
-
import './convert/index.js'
|
|
23
|
-
import './export/index.js'
|
|
24
|
-
import './file/index.js'
|
|
25
|
-
import './filetree/index.js'
|
|
26
|
-
import './network/index.js'
|
|
27
|
-
import './notebook/index.js'
|
|
28
|
-
import './notification/index.js'
|
|
29
|
-
import './sql/index.js'
|
|
30
|
-
import './sqlite/index.js'
|
|
31
|
-
import './system/index.js'
|
|
32
|
-
import './template/index.js'
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Api types
|
|
36
|
-
*/
|
|
37
|
-
declare module '@wetoria/siyuan-sdk' {
|
|
38
|
-
interface SiYuanAPI
|
|
39
|
-
extends
|
|
40
|
-
ArchiveAPI,
|
|
41
|
-
AssetAPI,
|
|
42
|
-
AttrAPI,
|
|
43
|
-
BlockAPI,
|
|
44
|
-
ConvertAPI,
|
|
45
|
-
ExportAPI,
|
|
46
|
-
FileAPI,
|
|
47
|
-
FileTreeAPI,
|
|
48
|
-
NetworkAPI,
|
|
49
|
-
NotebookAPI,
|
|
50
|
-
NotificationAPI,
|
|
51
|
-
SqlAPI,
|
|
52
|
-
SqliteAPI,
|
|
53
|
-
SystemAPI,
|
|
54
|
-
TemplateAPI
|
|
55
|
-
{}
|
|
56
|
-
}
|
package/src/api/network/index.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { SyApiMethodResponse } from '../../core/index.js'
|
|
2
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Network API 类型定义
|
|
6
|
-
*/
|
|
7
|
-
export interface NetworkAPI {
|
|
8
|
-
/**
|
|
9
|
-
* 转发代理请求
|
|
10
|
-
* @path /api/network/forwardProxy
|
|
11
|
-
*/
|
|
12
|
-
forwardProxy: (
|
|
13
|
-
url: string,
|
|
14
|
-
method?: string,
|
|
15
|
-
payload?: any,
|
|
16
|
-
headers?: any[],
|
|
17
|
-
timeout?: number,
|
|
18
|
-
contentType?: string
|
|
19
|
-
) => SyApiMethodResponse<any>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
SiYuanAPI.prototype.forwardProxy = function (url: string, method: string = 'GET', payload: any = {}, headers: any[] = [], timeout: number = 7000, contentType: string = 'text/html') {
|
|
23
|
-
return this.request('/api/network/forwardProxy', {
|
|
24
|
-
url,
|
|
25
|
-
method,
|
|
26
|
-
timeout,
|
|
27
|
-
contentType,
|
|
28
|
-
headers,
|
|
29
|
-
payload,
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { SyApiMethodResponse } from '../../core/index.js'
|
|
2
|
-
import type {
|
|
3
|
-
Notebook,
|
|
4
|
-
NotebookId,
|
|
5
|
-
} from '../../types/index.js'
|
|
6
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface RespLsNotebooks {
|
|
10
|
-
notebooks: Notebook[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Notebook API 类型定义
|
|
15
|
-
*/
|
|
16
|
-
export interface NotebookAPI {
|
|
17
|
-
/**
|
|
18
|
-
* List all notebooks
|
|
19
|
-
* @path /api/notebook/lsNotebooks
|
|
20
|
-
* @returns - Promise<{ notebooks: Notebook[] }>
|
|
21
|
-
*/
|
|
22
|
-
lsNotebooks: () => SyApiMethodResponse<RespLsNotebooks>
|
|
23
|
-
/**
|
|
24
|
-
* 打开笔记本
|
|
25
|
-
* @path /api/notebook/openNotebook
|
|
26
|
-
*/
|
|
27
|
-
openNotebook: (notebook: NotebookId) => SyApiMethodResponse<any>
|
|
28
|
-
/**
|
|
29
|
-
* 关闭笔记本
|
|
30
|
-
* @path /api/notebook/closeNotebook
|
|
31
|
-
*/
|
|
32
|
-
closeNotebook: (notebook: NotebookId) => SyApiMethodResponse<any>
|
|
33
|
-
/**
|
|
34
|
-
* 重命名笔记本
|
|
35
|
-
* @path /api/notebook/renameNotebook
|
|
36
|
-
*/
|
|
37
|
-
renameNotebook: (
|
|
38
|
-
notebook: NotebookId,
|
|
39
|
-
name: string
|
|
40
|
-
) => SyApiMethodResponse<any>
|
|
41
|
-
/**
|
|
42
|
-
* 创建笔记本
|
|
43
|
-
* @path /api/notebook/createNotebook
|
|
44
|
-
*/
|
|
45
|
-
createNotebook: (name: string) => SyApiMethodResponse<any>
|
|
46
|
-
/**
|
|
47
|
-
* 删除笔记本
|
|
48
|
-
* @path /api/notebook/removeNotebook
|
|
49
|
-
*/
|
|
50
|
-
removeNotebook: (notebook: NotebookId) => SyApiMethodResponse<any>
|
|
51
|
-
/**
|
|
52
|
-
* 获取笔记本配置
|
|
53
|
-
* @path /api/notebook/getNotebookConf
|
|
54
|
-
*/
|
|
55
|
-
getNotebookConf: (notebook: NotebookId) => SyApiMethodResponse<any>
|
|
56
|
-
/**
|
|
57
|
-
* 设置笔记本配置
|
|
58
|
-
* @path /api/notebook/setNotebookConf
|
|
59
|
-
*/
|
|
60
|
-
setNotebookConf: (
|
|
61
|
-
notebook: NotebookId,
|
|
62
|
-
conf: any
|
|
63
|
-
) => SyApiMethodResponse<any>
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
SiYuanAPI.prototype.lsNotebooks = function () {
|
|
67
|
-
return this.request('/api/notebook/lsNotebooks', '')
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
SiYuanAPI.prototype.openNotebook = function (notebook: string) {
|
|
71
|
-
return this.request('/api/notebook/openNotebook', { notebook })
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
SiYuanAPI.prototype.closeNotebook = function (notebook: string) {
|
|
75
|
-
return this.request('/api/notebook/closeNotebook', { notebook })
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
SiYuanAPI.prototype.renameNotebook = function (notebook: string, name: string) {
|
|
79
|
-
return this.request('/api/notebook/renameNotebook', {
|
|
80
|
-
notebook,
|
|
81
|
-
name,
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
SiYuanAPI.prototype.createNotebook = function (name: string) {
|
|
86
|
-
return this.request('/api/notebook/createNotebook', { name })
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
SiYuanAPI.prototype.removeNotebook = function (notebook: string) {
|
|
90
|
-
return this.request('/api/notebook/removeNotebook', { notebook })
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
SiYuanAPI.prototype.getNotebookConf = function (notebook: string) {
|
|
94
|
-
return this.request('/api/notebook/getNotebookConf', { notebook })
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
SiYuanAPI.prototype.setNotebookConf = function (notebook: string, conf: any) {
|
|
98
|
-
return this.request('/api/notebook/setNotebookConf', {
|
|
99
|
-
notebook,
|
|
100
|
-
conf,
|
|
101
|
-
})
|
|
102
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { SyApiMethodResponse } from '../../core/index.js'
|
|
2
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Notification API 类型定义
|
|
6
|
-
*/
|
|
7
|
-
export interface NotificationAPI {
|
|
8
|
-
/**
|
|
9
|
-
* 推送消息通知
|
|
10
|
-
* @path /api/notification/pushMsg
|
|
11
|
-
*/
|
|
12
|
-
pushMsg: (msg: string, timeout?: number) => SyApiMethodResponse<any>
|
|
13
|
-
/**
|
|
14
|
-
* 推送错误消息通知
|
|
15
|
-
* @path /api/notification/pushErrMsg
|
|
16
|
-
*/
|
|
17
|
-
pushErrMsg: (msg: string, timeout?: number) => SyApiMethodResponse<any>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
SiYuanAPI.prototype.pushMsg = function (msg: string, timeout: number = 7000) {
|
|
21
|
-
return this.request('/api/notification/pushMsg', {
|
|
22
|
-
msg,
|
|
23
|
-
timeout,
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
SiYuanAPI.prototype.pushErrMsg = function (msg: string, timeout: number = 7000) {
|
|
28
|
-
return this.request('/api/notification/pushErrMsg', {
|
|
29
|
-
msg,
|
|
30
|
-
timeout,
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
package/src/api/sql/index.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Block,
|
|
3
|
-
BlockId,
|
|
4
|
-
} from '../../types/index.js'
|
|
5
|
-
import {
|
|
6
|
-
SiYuanAPI,
|
|
7
|
-
SyApiMethodResponse,
|
|
8
|
-
} from '../../core/index.js'
|
|
9
|
-
import { trimSqlBlank } from '../../utils/index.js'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* SQL API 类型定义
|
|
13
|
-
*/
|
|
14
|
-
export interface SqlAPI {
|
|
15
|
-
/**
|
|
16
|
-
* Execute SQL query
|
|
17
|
-
*
|
|
18
|
-
* @path /api/query/sql
|
|
19
|
-
* @param stmt - SQL statement to execute
|
|
20
|
-
* @param options - The options for the SQL query
|
|
21
|
-
* @param options.trim - Whether to trim the SQL string
|
|
22
|
-
* @default true
|
|
23
|
-
* @returns {T[]} result of the SQL query
|
|
24
|
-
*/
|
|
25
|
-
sql: <T = any>(
|
|
26
|
-
stmt: string,
|
|
27
|
-
options?: {
|
|
28
|
-
trim?: boolean
|
|
29
|
-
}
|
|
30
|
-
) => SyApiMethodResponse<T[]>
|
|
31
|
-
/**
|
|
32
|
-
* Get block by block_id (through SQL query)
|
|
33
|
-
*
|
|
34
|
-
* @path wrapper: uses sql
|
|
35
|
-
* @param {BlockId} blockId - block_id
|
|
36
|
-
* @returns {Block | null} block data - Block or null
|
|
37
|
-
*/
|
|
38
|
-
getBlockByID: (blockId: BlockId) => SyApiMethodResponse<Block | null>
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
SiYuanAPI.prototype.sql = function <T = any>(
|
|
43
|
-
stmt: string,
|
|
44
|
-
options: {
|
|
45
|
-
trim?: boolean
|
|
46
|
-
} = {},
|
|
47
|
-
): SyApiMethodResponse<T[]> {
|
|
48
|
-
const {
|
|
49
|
-
trim = true,
|
|
50
|
-
} = options
|
|
51
|
-
const finalStmt = trim ? trimSqlBlank(stmt) : stmt
|
|
52
|
-
return this.request('/api/query/sql', {
|
|
53
|
-
stmt: finalStmt,
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
SiYuanAPI.prototype.getBlockByID = async function (blockId: string) {
|
|
58
|
-
const res = await this.sql(`select * from blocks where id ='${blockId}'`)
|
|
59
|
-
return {
|
|
60
|
-
code: res.code,
|
|
61
|
-
msg: res.msg,
|
|
62
|
-
data: res.data?.[0] ?? null,
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
package/src/api/sqlite/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
SyApiMethodResponse,
|
|
3
|
-
} from '../../core/index.js'
|
|
4
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Sqlite API 类型定义
|
|
8
|
-
*/
|
|
9
|
-
export interface SqliteAPI {
|
|
10
|
-
/**
|
|
11
|
-
* 刷新事务
|
|
12
|
-
* @path /api/sqlite/flushTransaction
|
|
13
|
-
*/
|
|
14
|
-
flushTransactions: () => SyApiMethodResponse<any>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
SiYuanAPI.prototype.flushTransactions = function () {
|
|
18
|
-
return this.request('/api/sqlite/flushTransaction', {})
|
|
19
|
-
}
|
|
20
|
-
|
package/src/api/system/index.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { SyApiMethodResponse } from '../../core/index.js'
|
|
2
|
-
|
|
3
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* System API 类型定义
|
|
7
|
-
*/
|
|
8
|
-
export interface SystemAPI {
|
|
9
|
-
/**
|
|
10
|
-
* 获取启动进度
|
|
11
|
-
* @path /api/system/bootProgress
|
|
12
|
-
*/
|
|
13
|
-
bootProgress: () => SyApiMethodResponse<any>
|
|
14
|
-
/**
|
|
15
|
-
* 获取版本号
|
|
16
|
-
* @path /api/system/version
|
|
17
|
-
*/
|
|
18
|
-
version: () => SyApiMethodResponse<string>
|
|
19
|
-
/**
|
|
20
|
-
* 获取当前时间戳
|
|
21
|
-
* @path /api/system/currentTime
|
|
22
|
-
*/
|
|
23
|
-
currentTime: () => SyApiMethodResponse<number>
|
|
24
|
-
/**
|
|
25
|
-
* 执行同步
|
|
26
|
-
* @path /api/sync/performSync
|
|
27
|
-
*/
|
|
28
|
-
performSync: () => SyApiMethodResponse<number>
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
SiYuanAPI.prototype.bootProgress = function () {
|
|
32
|
-
return this.request('/api/system/bootProgress', {})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
SiYuanAPI.prototype.version = function () {
|
|
36
|
-
return this.request('/api/system/version', {})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
SiYuanAPI.prototype.currentTime = function () {
|
|
40
|
-
return this.request('/api/system/currentTime', {})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
SiYuanAPI.prototype.performSync = function () {
|
|
44
|
-
return this.request('/api/sync/performSync', {})
|
|
45
|
-
}
|
|
46
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { SyApiMethodResponse } from '../../core/index.js'
|
|
2
|
-
import type { DocumentId } from '../../types/index.js'
|
|
3
|
-
|
|
4
|
-
import { SiYuanAPI } from '../../core/index.js'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Template API 类型定义
|
|
8
|
-
*/
|
|
9
|
-
export interface TemplateAPI {
|
|
10
|
-
/**
|
|
11
|
-
* 渲染模板
|
|
12
|
-
* @path /api/template/render
|
|
13
|
-
*/
|
|
14
|
-
render: (id: DocumentId, path: string) => SyApiMethodResponse<any>
|
|
15
|
-
/**
|
|
16
|
-
* 渲染 Sprig 模板
|
|
17
|
-
* @path /api/template/renderSprig
|
|
18
|
-
*/
|
|
19
|
-
renderSprig: (template: string) => SyApiMethodResponse<string>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
SiYuanAPI.prototype.render = function (id: string, path: string) {
|
|
23
|
-
return this.request('/api/template/render', {
|
|
24
|
-
id,
|
|
25
|
-
path,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
SiYuanAPI.prototype.renderSprig = function (template: string) {
|
|
30
|
-
return this.request('/api/template/renderSprig', { template })
|
|
31
|
-
}
|
|
32
|
-
|