triliumnext-mcp 0.3.13 → 0.3.15
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 +91 -44
- package/package.json +5 -4
- package/build/index.d.ts +0 -3
- package/build/index.d.ts.map +0 -1
- package/build/index.js.map +0 -1
- package/build/modules/attributes/attributeListHandler.d.ts +0 -14
- package/build/modules/attributes/attributeListHandler.d.ts.map +0 -1
- package/build/modules/attributes/attributeListHandler.js +0 -35
- package/build/modules/attributes/attributeListHandler.js.map +0 -1
- package/build/modules/attributes/attributeManageHandler.d.ts +0 -16
- package/build/modules/attributes/attributeManageHandler.d.ts.map +0 -1
- package/build/modules/attributes/attributeManageHandler.js +0 -261
- package/build/modules/attributes/attributeManageHandler.js.map +0 -1
- package/build/modules/attributes/attributeManageManager.d.ts +0 -13
- package/build/modules/attributes/attributeManageManager.d.ts.map +0 -1
- package/build/modules/attributes/attributeManageManager.js +0 -520
- package/build/modules/attributes/attributeManageManager.js.map +0 -1
- package/build/modules/attributes/attributeReadHandler.d.ts +0 -16
- package/build/modules/attributes/attributeReadHandler.d.ts.map +0 -1
- package/build/modules/attributes/attributeReadHandler.js +0 -136
- package/build/modules/attributes/attributeReadHandler.js.map +0 -1
- package/build/modules/attributes/operations/attributeCreation.d.ts +0 -15
- package/build/modules/attributes/operations/attributeCreation.d.ts.map +0 -1
- package/build/modules/attributes/operations/attributeCreation.js +0 -238
- package/build/modules/attributes/operations/attributeCreation.js.map +0 -1
- package/build/modules/attributes/operations/attributeDeletion.d.ts +0 -11
- package/build/modules/attributes/operations/attributeDeletion.d.ts.map +0 -1
- package/build/modules/attributes/operations/attributeDeletion.js +0 -63
- package/build/modules/attributes/operations/attributeDeletion.js.map +0 -1
- package/build/modules/attributes/operations/attributeList.d.ts +0 -29
- package/build/modules/attributes/operations/attributeList.d.ts.map +0 -1
- package/build/modules/attributes/operations/attributeList.js +0 -148
- package/build/modules/attributes/operations/attributeList.js.map +0 -1
- package/build/modules/attributes/operations/attributeRead.d.ts +0 -13
- package/build/modules/attributes/operations/attributeRead.d.ts.map +0 -1
- package/build/modules/attributes/operations/attributeRead.js +0 -43
- package/build/modules/attributes/operations/attributeRead.js.map +0 -1
- package/build/modules/attributes/operations/attributeUpdate.d.ts +0 -11
- package/build/modules/attributes/operations/attributeUpdate.d.ts.map +0 -1
- package/build/modules/attributes/operations/attributeUpdate.js +0 -107
- package/build/modules/attributes/operations/attributeUpdate.js.map +0 -1
- package/build/modules/attributes/operations/batchOperations.d.ts +0 -18
- package/build/modules/attributes/operations/batchOperations.d.ts.map +0 -1
- package/build/modules/attributes/operations/batchOperations.js +0 -49
- package/build/modules/attributes/operations/batchOperations.js.map +0 -1
- package/build/modules/attributes/validation/attributeValidator.d.ts +0 -40
- package/build/modules/attributes/validation/attributeValidator.d.ts.map +0 -1
- package/build/modules/attributes/validation/attributeValidator.js +0 -84
- package/build/modules/attributes/validation/attributeValidator.js.map +0 -1
- package/build/modules/attributes/validation/containerProtection.d.ts +0 -14
- package/build/modules/attributes/validation/containerProtection.d.ts.map +0 -1
- package/build/modules/attributes/validation/containerProtection.js +0 -105
- package/build/modules/attributes/validation/containerProtection.js.map +0 -1
- package/build/modules/notes/crud/noteCreation.d.ts +0 -26
- package/build/modules/notes/crud/noteCreation.d.ts.map +0 -1
- package/build/modules/notes/crud/noteCreation.js +0 -206
- package/build/modules/notes/crud/noteCreation.js.map +0 -1
- package/build/modules/notes/crud/noteDeletion.d.ts +0 -10
- package/build/modules/notes/crud/noteDeletion.d.ts.map +0 -1
- package/build/modules/notes/crud/noteDeletion.js +0 -19
- package/build/modules/notes/crud/noteDeletion.js.map +0 -1
- package/build/modules/notes/crud/noteRetrieval.d.ts +0 -10
- package/build/modules/notes/crud/noteRetrieval.d.ts.map +0 -1
- package/build/modules/notes/crud/noteRetrieval.js +0 -64
- package/build/modules/notes/crud/noteRetrieval.js.map +0 -1
- package/build/modules/notes/crud/noteUpdate.d.ts +0 -10
- package/build/modules/notes/crud/noteUpdate.d.ts.map +0 -1
- package/build/modules/notes/crud/noteUpdate.js +0 -305
- package/build/modules/notes/crud/noteUpdate.js.map +0 -1
- package/build/modules/notes/noteHandler.d.ts +0 -51
- package/build/modules/notes/noteHandler.d.ts.map +0 -1
- package/build/modules/notes/noteHandler.js +0 -211
- package/build/modules/notes/noteHandler.js.map +0 -1
- package/build/modules/notes/noteManager.d.ts +0 -102
- package/build/modules/notes/noteManager.d.ts.map +0 -1
- package/build/modules/notes/noteManager.js +0 -20
- package/build/modules/notes/noteManager.js.map +0 -1
- package/build/modules/notes/operations/duplicateChecker.d.ts +0 -12
- package/build/modules/notes/operations/duplicateChecker.d.ts.map +0 -1
- package/build/modules/notes/operations/duplicateChecker.js +0 -43
- package/build/modules/notes/operations/duplicateChecker.js.map +0 -1
- package/build/modules/notes/operations/searchReplace.d.ts +0 -14
- package/build/modules/notes/operations/searchReplace.d.ts.map +0 -1
- package/build/modules/notes/operations/searchReplace.js +0 -206
- package/build/modules/notes/operations/searchReplace.js.map +0 -1
- package/build/modules/notes/validation/containerValidator.d.ts +0 -13
- package/build/modules/notes/validation/containerValidator.d.ts.map +0 -1
- package/build/modules/notes/validation/containerValidator.js +0 -87
- package/build/modules/notes/validation/containerValidator.js.map +0 -1
- package/build/modules/notes/validation/contentValidator.d.ts +0 -14
- package/build/modules/notes/validation/contentValidator.d.ts.map +0 -1
- package/build/modules/notes/validation/contentValidator.js +0 -12
- package/build/modules/notes/validation/contentValidator.js.map +0 -1
- package/build/modules/notes/validation/hashValidator.d.ts +0 -12
- package/build/modules/notes/validation/hashValidator.d.ts.map +0 -1
- package/build/modules/notes/validation/hashValidator.js +0 -24
- package/build/modules/notes/validation/hashValidator.js.map +0 -1
- package/build/modules/resolve/resolveHandler.d.ts +0 -6
- package/build/modules/resolve/resolveHandler.d.ts.map +0 -1
- package/build/modules/resolve/resolveHandler.js +0 -53
- package/build/modules/resolve/resolveHandler.js.map +0 -1
- package/build/modules/resolve/resolveManager.d.ts +0 -31
- package/build/modules/resolve/resolveManager.d.ts.map +0 -1
- package/build/modules/resolve/resolveManager.js +0 -145
- package/build/modules/resolve/resolveManager.js.map +0 -1
- package/build/modules/search/filtering/hierarchyFilter.d.ts +0 -35
- package/build/modules/search/filtering/hierarchyFilter.d.ts.map +0 -1
- package/build/modules/search/filtering/hierarchyFilter.js +0 -187
- package/build/modules/search/filtering/hierarchyFilter.js.map +0 -1
- package/build/modules/search/filtering/resultFilter.d.ts +0 -42
- package/build/modules/search/filtering/resultFilter.d.ts.map +0 -1
- package/build/modules/search/filtering/resultFilter.js +0 -132
- package/build/modules/search/filtering/resultFilter.js.map +0 -1
- package/build/modules/search/query/queryBuilder.d.ts +0 -19
- package/build/modules/search/query/queryBuilder.d.ts.map +0 -1
- package/build/modules/search/query/queryBuilder.js +0 -471
- package/build/modules/search/query/queryBuilder.js.map +0 -1
- package/build/modules/search/query/queryOptimizer.d.ts +0 -30
- package/build/modules/search/query/queryOptimizer.d.ts.map +0 -1
- package/build/modules/search/query/queryOptimizer.js +0 -133
- package/build/modules/search/query/queryOptimizer.js.map +0 -1
- package/build/modules/search/query/queryValidator.d.ts +0 -53
- package/build/modules/search/query/queryValidator.d.ts.map +0 -1
- package/build/modules/search/query/queryValidator.js +0 -157
- package/build/modules/search/query/queryValidator.js.map +0 -1
- package/build/modules/search/searchHandler.d.ts +0 -15
- package/build/modules/search/searchHandler.d.ts.map +0 -1
- package/build/modules/search/searchHandler.js +0 -36
- package/build/modules/search/searchHandler.js.map +0 -1
- package/build/modules/search/searchManager.d.ts +0 -33
- package/build/modules/search/searchManager.d.ts.map +0 -1
- package/build/modules/search/searchManager.js +0 -77
- package/build/modules/search/searchManager.js.map +0 -1
- package/build/modules/shared/index.d.ts +0 -18
- package/build/modules/shared/index.d.ts.map +0 -1
- package/build/modules/shared/index.js +0 -26
- package/build/modules/shared/index.js.map +0 -1
- package/build/modules/tools/definitions/attributeTools.d.ts +0 -13
- package/build/modules/tools/definitions/attributeTools.d.ts.map +0 -1
- package/build/modules/tools/definitions/attributeTools.js +0 -130
- package/build/modules/tools/definitions/attributeTools.js.map +0 -1
- package/build/modules/tools/definitions/readTools.d.ts +0 -9
- package/build/modules/tools/definitions/readTools.d.ts.map +0 -1
- package/build/modules/tools/definitions/readTools.js +0 -130
- package/build/modules/tools/definitions/readTools.js.map +0 -1
- package/build/modules/tools/definitions/writeTools.d.ts +0 -9
- package/build/modules/tools/definitions/writeTools.d.ts.map +0 -1
- package/build/modules/tools/definitions/writeTools.js +0 -177
- package/build/modules/tools/definitions/writeTools.js.map +0 -1
- package/build/modules/tools/toolDefinitions.d.ts +0 -26
- package/build/modules/tools/toolDefinitions.d.ts.map +0 -1
- package/build/modules/tools/toolDefinitions.js +0 -450
- package/build/modules/tools/toolDefinitions.js.map +0 -1
- package/build/modules/types/index.d.ts +0 -134
- package/build/modules/types/index.d.ts.map +0 -1
- package/build/modules/types/index.js +0 -2
- package/build/modules/types/index.js.map +0 -1
- package/build/modules/utils/attributes/attributeNameCleaner.d.ts +0 -54
- package/build/modules/utils/attributes/attributeNameCleaner.d.ts.map +0 -1
- package/build/modules/utils/attributes/attributeNameCleaner.js +0 -130
- package/build/modules/utils/attributes/attributeNameCleaner.js.map +0 -1
- package/build/modules/utils/attributes/attributeUtils.d.ts +0 -41
- package/build/modules/utils/attributes/attributeUtils.d.ts.map +0 -1
- package/build/modules/utils/attributes/attributeUtils.js +0 -116
- package/build/modules/utils/attributes/attributeUtils.js.map +0 -1
- package/build/modules/utils/attributes/index.d.ts +0 -7
- package/build/modules/utils/attributes/index.d.ts.map +0 -1
- package/build/modules/utils/attributes/index.js +0 -9
- package/build/modules/utils/attributes/index.js.map +0 -1
- package/build/modules/utils/content/contentProcessor.d.ts +0 -20
- package/build/modules/utils/content/contentProcessor.d.ts.map +0 -1
- package/build/modules/utils/content/contentProcessor.js +0 -186
- package/build/modules/utils/content/contentProcessor.js.map +0 -1
- package/build/modules/utils/content/index.d.ts +0 -7
- package/build/modules/utils/content/index.d.ts.map +0 -1
- package/build/modules/utils/content/index.js +0 -9
- package/build/modules/utils/content/index.js.map +0 -1
- package/build/modules/utils/content/templateMapper.d.ts +0 -63
- package/build/modules/utils/content/templateMapper.d.ts.map +0 -1
- package/build/modules/utils/content/templateMapper.js +0 -114
- package/build/modules/utils/content/templateMapper.js.map +0 -1
- package/build/modules/utils/formatting/index.d.ts +0 -7
- package/build/modules/utils/formatting/index.d.ts.map +0 -1
- package/build/modules/utils/formatting/index.js +0 -9
- package/build/modules/utils/formatting/index.js.map +0 -1
- package/build/modules/utils/formatting/noteBuilder.d.ts +0 -12
- package/build/modules/utils/formatting/noteBuilder.d.ts.map +0 -1
- package/build/modules/utils/formatting/noteBuilder.js +0 -18
- package/build/modules/utils/formatting/noteBuilder.js.map +0 -1
- package/build/modules/utils/formatting/noteFormatter.d.ts +0 -30
- package/build/modules/utils/formatting/noteFormatter.d.ts.map +0 -1
- package/build/modules/utils/formatting/noteFormatter.js +0 -59
- package/build/modules/utils/formatting/noteFormatter.js.map +0 -1
- package/build/modules/utils/recovery/index.d.ts +0 -6
- package/build/modules/utils/recovery/index.d.ts.map +0 -1
- package/build/modules/utils/recovery/index.js +0 -7
- package/build/modules/utils/recovery/index.js.map +0 -1
- package/build/modules/utils/recovery/noteRecovery.d.ts +0 -51
- package/build/modules/utils/recovery/noteRecovery.d.ts.map +0 -1
- package/build/modules/utils/recovery/noteRecovery.js +0 -195
- package/build/modules/utils/recovery/noteRecovery.js.map +0 -1
- package/build/modules/utils/system/errorUtils.d.ts +0 -34
- package/build/modules/utils/system/errorUtils.d.ts.map +0 -1
- package/build/modules/utils/system/errorUtils.js +0 -48
- package/build/modules/utils/system/errorUtils.js.map +0 -1
- package/build/modules/utils/system/index.d.ts +0 -8
- package/build/modules/utils/system/index.d.ts.map +0 -1
- package/build/modules/utils/system/index.js +0 -11
- package/build/modules/utils/system/index.js.map +0 -1
- package/build/modules/utils/system/permissionUtils.d.ts +0 -46
- package/build/modules/utils/system/permissionUtils.d.ts.map +0 -1
- package/build/modules/utils/system/permissionUtils.js +0 -56
- package/build/modules/utils/system/permissionUtils.js.map +0 -1
- package/build/modules/utils/system/verboseUtils.d.ts +0 -41
- package/build/modules/utils/system/verboseUtils.d.ts.map +0 -1
- package/build/modules/utils/system/verboseUtils.js +0 -102
- package/build/modules/utils/system/verboseUtils.js.map +0 -1
- package/build/modules/utils/validation/contentIntegrity.d.ts +0 -72
- package/build/modules/utils/validation/contentIntegrity.d.ts.map +0 -1
- package/build/modules/utils/validation/contentIntegrity.js +0 -160
- package/build/modules/utils/validation/contentIntegrity.js.map +0 -1
- package/build/modules/utils/validation/contentRules.d.ts +0 -53
- package/build/modules/utils/validation/contentRules.d.ts.map +0 -1
- package/build/modules/utils/validation/contentRules.js +0 -267
- package/build/modules/utils/validation/contentRules.js.map +0 -1
- package/build/modules/utils/validation/index.d.ts +0 -8
- package/build/modules/utils/validation/index.d.ts.map +0 -1
- package/build/modules/utils/validation/index.js +0 -11
- package/build/modules/utils/validation/index.js.map +0 -1
- package/build/modules/utils/validation/validationUtils.d.ts +0 -310
- package/build/modules/utils/validation/validationUtils.d.ts.map +0 -1
- package/build/modules/utils/validation/validationUtils.js +0 -199
- package/build/modules/utils/validation/validationUtils.js.map +0 -1
package/README.md
CHANGED
|
@@ -14,73 +14,120 @@ Make sure to set up your environment variables first:
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
### 1. Using with Claude Desktop
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
Below are the installation guide for this MCP on different MCP clients, such as Claude Desktop, Claude Code, Cursor, Cline, etc.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
<details>
|
|
21
|
+
<summary>Claude Desktop</summary>
|
|
22
|
+
|
|
23
|
+
Add to your Claude Desktop configuration:
|
|
22
24
|
|
|
23
25
|
```json
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"PERMISSIONS": "READ;WRITE"
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"triliumnext-mcp": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["triliumnext-mcp"],
|
|
31
|
+
"env": {
|
|
32
|
+
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
33
|
+
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
34
|
+
"PERMISSIONS": "READ;WRITE"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
```
|
|
40
|
+
</details>
|
|
41
|
+
|
|
42
|
+
<details>
|
|
43
|
+
<summary>Claude Code</summary>
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
claude mcp add triliumnext-mcp \
|
|
47
|
+
-e TRILIUM_API_URL=http://localhost:8080/etapi \
|
|
48
|
+
-e TRILIUM_API_TOKEN=<YOUR_TRILIUM_API_TOKEN> \
|
|
49
|
+
-e PERMISSIONS='READ;WRITE' \
|
|
50
|
+
-- npx triliumnext-mcp
|
|
51
|
+
```
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
Note: Increase the MCP startup timeout to 1 minutes and MCP tool execution timeout to about 5 minutes by updating `~\.claude\settings.json` as follows:
|
|
41
54
|
|
|
42
55
|
```json
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"triliumnext-mcp"
|
|
48
|
-
],
|
|
49
|
-
"env": {
|
|
50
|
-
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
51
|
-
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
52
|
-
"PERMISSIONS": "READ;WRITE"
|
|
56
|
+
{
|
|
57
|
+
"env": {
|
|
58
|
+
"MCP_TIMEOUT": "60000",
|
|
59
|
+
"MCP_TOOL_TIMEOUT": "300000"
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
</details>
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
<details>
|
|
67
|
+
<summary>Cursor</summary>
|
|
68
|
+
|
|
69
|
+
Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server
|
|
70
|
+
|
|
71
|
+
Pasting the following configuration into your Cursor ~/.cursor/mcp.json file is the recommended approach. You may also install in a specific project by creating .cursor/mcp.json in your project folder. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"triliumnext-mcp": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["triliumnext-mcp"],
|
|
79
|
+
"env": {
|
|
80
|
+
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
81
|
+
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
82
|
+
"PERMISSIONS": "READ;WRITE"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
62
87
|
```
|
|
88
|
+
</details>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
<details>
|
|
92
|
+
<summary>Cline</summary>
|
|
93
|
+
|
|
94
|
+
Cline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:
|
|
95
|
+
|
|
96
|
+
1. Open Cline and click on the MCP Servers icon in the top navigation bar.
|
|
97
|
+
2. Select the Installed tab, then click Advanced MCP Settings.
|
|
98
|
+
3. In the cline_mcp_settings.json file, add the following configuration:
|
|
63
99
|
|
|
100
|
+
(i) Using Google AI Studio Provider
|
|
64
101
|
```json
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"timeout": 300,
|
|
105
|
+
"type": "stdio",
|
|
106
|
+
"triliumnext-mcp": {
|
|
107
|
+
"command": "npx",
|
|
108
|
+
"args": ["triliumnext-mcp"],
|
|
109
|
+
"env": {
|
|
110
|
+
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
111
|
+
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
112
|
+
"PERMISSIONS": "READ;WRITE"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
75
115
|
}
|
|
76
116
|
}
|
|
77
117
|
```
|
|
118
|
+
</details>
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
<details>
|
|
78
122
|
|
|
79
|
-
|
|
80
|
-
- Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
81
|
-
- MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
123
|
+
<summary>Other MCP clients</summary>
|
|
82
124
|
|
|
83
|
-
|
|
125
|
+
The server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx triliumnext-mcp
|
|
129
|
+
```
|
|
130
|
+
</details>
|
|
84
131
|
|
|
85
132
|
## Available Tools
|
|
86
133
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "triliumnext-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "A model context protocol server for TriliumNext Notes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,13 +21,14 @@
|
|
|
21
21
|
"inspector": "npx @modelcontextprotocol/inspector build/index.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@modelcontextprotocol/sdk": "
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
25
25
|
"axios": "^1.8.3",
|
|
26
|
-
"marked": "^16.3.0"
|
|
26
|
+
"marked": "^16.3.0",
|
|
27
|
+
"mime-db": "^1.54.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/node": "^20.11.24",
|
|
30
31
|
"typescript": "^5.3.3",
|
|
31
32
|
"zod": "^3.24.1"
|
|
32
33
|
}
|
|
33
|
-
}
|
|
34
|
+
}
|
package/build/index.d.ts
DELETED
package/build/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA0JA,OAAO,EACL,eAAe,EAChB,MAAM,2CAA2C,CAAC"}
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,4BAA4B;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,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G;QACP,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;AACnC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,2CAA2C;AAC3C,OAAO,EACL,eAAe,EAChB,MAAM,2CAA2C,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribute List Handler Module
|
|
3
|
-
* Centralized request handling for attribute listing operations
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Handle list_attributes tool requests
|
|
7
|
-
*/
|
|
8
|
-
export declare function handleListAttributesRequest(args: any, axiosInstance: any, permissionChecker: any): Promise<{
|
|
9
|
-
content: {
|
|
10
|
-
type: string;
|
|
11
|
-
text: string;
|
|
12
|
-
}[];
|
|
13
|
-
}>;
|
|
14
|
-
//# sourceMappingURL=attributeListHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributeListHandler.d.ts","sourceRoot":"","sources":["../../../src/modules/attributes/attributeListHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG;;;;;GA0BtG"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribute List Handler Module
|
|
3
|
-
* Centralized request handling for attribute listing operations
|
|
4
|
-
*/
|
|
5
|
-
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
|
6
|
-
import { handleListAttributes } from "./operations/attributeList.js";
|
|
7
|
-
/**
|
|
8
|
-
* Handle list_attributes tool requests
|
|
9
|
-
*/
|
|
10
|
-
export async function handleListAttributesRequest(args, axiosInstance, permissionChecker) {
|
|
11
|
-
if (!permissionChecker.hasPermission("READ")) {
|
|
12
|
-
throw new McpError(ErrorCode.InvalidRequest, "Permission denied: Not authorized to list attributes.");
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const listOperation = {
|
|
16
|
-
noteId: args.noteId,
|
|
17
|
-
hierarchyLevel: args.hierarchyLevel || 'immediate',
|
|
18
|
-
limit: args.limit || 50
|
|
19
|
-
};
|
|
20
|
-
const result = await handleListAttributes(listOperation, axiosInstance);
|
|
21
|
-
return {
|
|
22
|
-
content: [{
|
|
23
|
-
type: "text",
|
|
24
|
-
text: JSON.stringify(result, null, 2)
|
|
25
|
-
}]
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
if (error instanceof McpError) {
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
throw new McpError(ErrorCode.InvalidParams, error instanceof Error ? error.message : String(error));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=attributeListHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributeListHandler.js","sourceRoot":"","sources":["../../../src/modules/attributes/attributeListHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,IAAS,EAAE,aAAkB,EAAE,iBAAsB;IACrG,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,uDAAuD,CAAC,CAAC;IACxG,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAG;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,WAAW;YAClD,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;SACxB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAExE,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC,CAAC;SACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtG,CAAC;AACH,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribute Manage Handler Module
|
|
3
|
-
* Processes MCP requests for attribute management operations
|
|
4
|
-
*/
|
|
5
|
-
import { AxiosInstance } from 'axios';
|
|
6
|
-
import { PermissionChecker } from '../shared/index.js';
|
|
7
|
-
import { ManageAttributesRequest } from '../shared/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Handle manage_attributes MCP request
|
|
10
|
-
*/
|
|
11
|
-
export declare function handleManageAttributes(args: ManageAttributesRequest, axiosInstance: AxiosInstance, permissionChecker: PermissionChecker): Promise<any>;
|
|
12
|
-
/**
|
|
13
|
-
* Get help text for attribute management
|
|
14
|
-
*/
|
|
15
|
-
export declare function get_manage_attributes_help(): string;
|
|
16
|
-
//# sourceMappingURL=attributeManageHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributeManageHandler.d.ts","sourceRoot":"","sources":["../../../src/modules/attributes/attributeManageHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,uBAAuB,EAC7B,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,GACnC,OAAO,CAAC,GAAG,CAAC,CA6Fd;AA0HD;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAsDnD"}
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribute Manage Handler Module
|
|
3
|
-
* Processes MCP requests for attribute management operations
|
|
4
|
-
*/
|
|
5
|
-
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import { manage_attributes } from './attributeManageManager.js';
|
|
7
|
-
import { format_attributes_for_display } from '../shared/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Handle manage_attributes MCP request
|
|
10
|
-
*/
|
|
11
|
-
export async function handleManageAttributes(args, axiosInstance, permissionChecker) {
|
|
12
|
-
try {
|
|
13
|
-
// Validate required parameters
|
|
14
|
-
if (!args.noteId) {
|
|
15
|
-
return {
|
|
16
|
-
content: [
|
|
17
|
-
{
|
|
18
|
-
type: "text",
|
|
19
|
-
text: "❌ Missing required parameter: noteId"
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
isError: true
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
if (!args.operation) {
|
|
26
|
-
return {
|
|
27
|
-
content: [
|
|
28
|
-
{
|
|
29
|
-
type: "text",
|
|
30
|
-
text: "❌ Missing required parameter: operation"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
isError: true
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
// Check WRITE permission for all manage_attributes operations
|
|
37
|
-
if (!permissionChecker.hasPermission("WRITE")) {
|
|
38
|
-
throw new McpError(ErrorCode.InvalidRequest, "Permission denied: Not authorized to manage attributes.");
|
|
39
|
-
}
|
|
40
|
-
// Validate operation
|
|
41
|
-
const validOperations = ["create", "update", "delete", "batch_create"];
|
|
42
|
-
if (!validOperations.includes(args.operation)) {
|
|
43
|
-
return {
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: "text",
|
|
47
|
-
text: `❌ Invalid operation: ${args.operation}. Valid operations are: ${validOperations.join(", ")}`
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
isError: true
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// Validate attributes for write operations
|
|
54
|
-
if (!args.attributes || !Array.isArray(args.attributes) || args.attributes.length === 0) {
|
|
55
|
-
return {
|
|
56
|
-
content: [
|
|
57
|
-
{
|
|
58
|
-
type: "text",
|
|
59
|
-
text: "❌ Missing or invalid required parameter: attributes (must be a non-empty array for write operations)"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
isError: true
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// For single operations, ensure only one attribute
|
|
66
|
-
if (["create", "update", "delete"].includes(args.operation) && args.attributes.length !== 1) {
|
|
67
|
-
return {
|
|
68
|
-
content: [
|
|
69
|
-
{
|
|
70
|
-
type: "text",
|
|
71
|
-
text: `❌ Operation '${args.operation}' requires exactly one attribute, but ${args.attributes.length} were provided`
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
isError: true
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
// Execute the attribute operation
|
|
78
|
-
const params = {
|
|
79
|
-
noteId: args.noteId,
|
|
80
|
-
operation: args.operation,
|
|
81
|
-
attributes: args.attributes
|
|
82
|
-
};
|
|
83
|
-
const result = await manage_attributes(params, axiosInstance);
|
|
84
|
-
return format_attribute_response(result, args.noteId, args.operation);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
return {
|
|
88
|
-
content: [
|
|
89
|
-
{
|
|
90
|
-
type: "text",
|
|
91
|
-
text: `❌ Attribute operation failed: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
isError: true
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Format attribute operation result for MCP response
|
|
100
|
-
*/
|
|
101
|
-
function format_attribute_response(result, noteId, operation) {
|
|
102
|
-
const content = [];
|
|
103
|
-
// Add status message
|
|
104
|
-
if (result.success) {
|
|
105
|
-
content.push({
|
|
106
|
-
type: "text",
|
|
107
|
-
text: `✅ ${result.message}`
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
content.push({
|
|
112
|
-
type: "text",
|
|
113
|
-
text: `❌ ${result.message}`
|
|
114
|
-
});
|
|
115
|
-
// Add error details if available
|
|
116
|
-
if (result.errors && result.errors.length > 0) {
|
|
117
|
-
content.push({
|
|
118
|
-
type: "text",
|
|
119
|
-
text: `📋 Error details:\n${result.errors.map((err, i) => `${i + 1}. ${err}`).join('\n')}`
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
// Add specific guidance for common errors
|
|
123
|
-
if (result.errors && result.errors.some((err) => err.includes("already exists"))) {
|
|
124
|
-
content.push({
|
|
125
|
-
type: "text",
|
|
126
|
-
text: `💡 **Attribute Already Exists**
|
|
127
|
-
|
|
128
|
-
The attribute you're trying to create already exists on this note. Here are your options:
|
|
129
|
-
|
|
130
|
-
1. **Update the existing attribute** (recommended):
|
|
131
|
-
- Use operation: "update" instead of "create"
|
|
132
|
-
- Only the value and position can be updated for labels
|
|
133
|
-
- Only the position can be updated for relations
|
|
134
|
-
|
|
135
|
-
2. **Delete and recreate** (for inheritable changes):
|
|
136
|
-
- First delete with operation: "delete"
|
|
137
|
-
- Then recreate with operation: "create"
|
|
138
|
-
- Use this when you need to change the 'isInheritable' property
|
|
139
|
-
|
|
140
|
-
3. **View current attributes**:
|
|
141
|
-
- Use read_attributes to see all existing attributes
|
|
142
|
-
- Check current values, positions, and inheritable settings
|
|
143
|
-
|
|
144
|
-
📋 **Example update operation**:
|
|
145
|
-
\`\`\`
|
|
146
|
-
{
|
|
147
|
-
"noteId": "${noteId}",
|
|
148
|
-
"operation": "update",
|
|
149
|
-
"attributes": [{"type": "label", "name": "your_attribute", "value": "new_value"}]
|
|
150
|
-
}
|
|
151
|
-
\`\`\``
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Add attribute data for successful operations
|
|
156
|
-
if (result.success && result.attributes && result.attributes.length > 0) {
|
|
157
|
-
content.push({
|
|
158
|
-
type: "text",
|
|
159
|
-
text: format_attributes_for_display(result.attributes)
|
|
160
|
-
});
|
|
161
|
-
// For batch operations, add summary
|
|
162
|
-
if (operation === "batch_create") {
|
|
163
|
-
content.push({
|
|
164
|
-
type: "text",
|
|
165
|
-
text: `📊 Summary: ${result.attributes.length} attributes processed for note ${noteId}`
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
// Add guidance for template relations
|
|
170
|
-
if (result.success && operation === "batch_create") {
|
|
171
|
-
const templateRelations = result.attributes?.filter((attr) => attr.type === "relation" && attr.name === "template");
|
|
172
|
-
if (templateRelations && templateRelations.length > 0) {
|
|
173
|
-
content.push({
|
|
174
|
-
type: "text",
|
|
175
|
-
text: `🎯 Template relation detected: ${templateRelations[0].value}\nNote: Template functionality depends on the target note existing in your Trilium instance.`
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Add guidance for batch operations with conflicts
|
|
180
|
-
if (result.success && operation === "batch_create" && result.errors && result.errors.length > 0) {
|
|
181
|
-
const hasConflicts = result.errors.some((err) => err.includes("Skipping duplicate") || err.includes("already exist"));
|
|
182
|
-
if (hasConflicts) {
|
|
183
|
-
content.push({
|
|
184
|
-
type: "text",
|
|
185
|
-
text: `⚠️ **Batch Operation Summary**
|
|
186
|
-
|
|
187
|
-
Some attributes were skipped due to conflicts (already existing). This is normal behavior for batch operations:
|
|
188
|
-
|
|
189
|
-
✅ **Successfully created**: ${result.attributes?.length || 0} attributes
|
|
190
|
-
❌ **Skipped duplicates**: ${result.errors?.filter((err) => err.includes("Skipping duplicate") || err.includes("already exist")).length || 0} attributes
|
|
191
|
-
|
|
192
|
-
💡 **To manage skipped attributes**:
|
|
193
|
-
- Use \`read_attributes\` to view current attributes
|
|
194
|
-
- Use \`update\` operation to modify existing attributes
|
|
195
|
-
- Use \`delete\` operation to remove unwanted attributes first
|
|
196
|
-
|
|
197
|
-
This approach prevents accidental overwrites while allowing partial success for batch operations.`
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return { content };
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Get help text for attribute management
|
|
205
|
-
*/
|
|
206
|
-
export function get_manage_attributes_help() {
|
|
207
|
-
return `
|
|
208
|
-
🔧 Attribute Management Tools
|
|
209
|
-
|
|
210
|
-
manage_attributes: Create, update, delete attributes (write operations)
|
|
211
|
-
|
|
212
|
-
📝 Usage Examples:
|
|
213
|
-
|
|
214
|
-
🔧 Create a single label:
|
|
215
|
-
- noteId: "abc123"
|
|
216
|
-
- operation: "create"
|
|
217
|
-
- attributes: [{type: "label", name: "important", position: 10}]
|
|
218
|
-
|
|
219
|
-
🔧 Create a template relation:
|
|
220
|
-
- noteId: "abc123"
|
|
221
|
-
- operation: "create"
|
|
222
|
-
- attributes: [{type: "relation", name: "template", value: "Board", position: 10}]
|
|
223
|
-
|
|
224
|
-
🔧 Create multiple attributes (batch):
|
|
225
|
-
- noteId: "abc123"
|
|
226
|
-
- operation: "batch_create"
|
|
227
|
-
- attributes: [
|
|
228
|
-
{type: "label", name: "project", value: "api", position: 10},
|
|
229
|
-
{type: "label", name: "language", value: "python", position: 20},
|
|
230
|
-
{type: "relation", name: "template", value: "Grid View", position: 30}
|
|
231
|
-
]
|
|
232
|
-
|
|
233
|
-
🔧 Update an attribute:
|
|
234
|
-
- noteId: "abc123"
|
|
235
|
-
- operation: "update"
|
|
236
|
-
- attributes: [{type: "label", name: "important", position: 15}]
|
|
237
|
-
|
|
238
|
-
🔧 Delete an attribute:
|
|
239
|
-
- noteId: "abc123"
|
|
240
|
-
- operation: "delete"
|
|
241
|
-
- attributes: [{type: "label", name: "important"}]
|
|
242
|
-
|
|
243
|
-
🏷️ Label Syntax: #tagname or #tagname = "value"
|
|
244
|
-
🔗 Relation Syntax: ~relationname = "target_value"
|
|
245
|
-
|
|
246
|
-
⚡ Performance Tips:
|
|
247
|
-
- Use "batch_create" for multiple attributes (faster than individual calls)
|
|
248
|
-
- Template relations require the target note to exist in your Trilium instance
|
|
249
|
-
- Position values control display order (lower numbers appear first)
|
|
250
|
-
- Use read_attributes to view existing attributes before making changes
|
|
251
|
-
|
|
252
|
-
🛡️ **Validation & Conflict Handling**:
|
|
253
|
-
- Create operations now validate against existing attributes to prevent duplicates
|
|
254
|
-
- If an attribute already exists, you'll get detailed error messages with guidance
|
|
255
|
-
- Batch operations skip duplicates and continue with valid attributes
|
|
256
|
-
- Use "update" to modify existing attributes, "create" for new ones only
|
|
257
|
-
|
|
258
|
-
🔒 **Security**: Requires WRITE permission to manage note attributes.
|
|
259
|
-
`;
|
|
260
|
-
}
|
|
261
|
-
//# sourceMappingURL=attributeManageHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributeManageHandler.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,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;QAC9H,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE;;;;8BAIgB,MAAM,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;4BAChC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC;;;;;;;kGAOjD;aAC3F,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDR,CAAC;AACF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribute Manage Manager Module
|
|
3
|
-
* Handles CRUD operations for note attributes (labels and relations)
|
|
4
|
-
*/
|
|
5
|
-
import { AxiosInstance } from 'axios';
|
|
6
|
-
import { ManageAttributesParams, Attribute, AttributeOperationResult } from '../shared/index.js';
|
|
7
|
-
export type { ManageAttributesParams, Attribute, AttributeOperationResult };
|
|
8
|
-
/**
|
|
9
|
-
* Manage note attributes with write operations (create, update, delete)
|
|
10
|
-
* This function provides write-only access to note attributes
|
|
11
|
-
*/
|
|
12
|
-
export declare function manage_attributes(params: ManageAttributesParams, axiosInstance: AxiosInstance): Promise<AttributeOperationResult>;
|
|
13
|
-
//# sourceMappingURL=attributeManageManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributeManageManager.d.ts","sourceRoot":"","sources":["../../../src/modules/attributes/attributeManageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EACL,sBAAsB,EACtB,SAAS,EACT,wBAAwB,EACzB,MAAM,oBAAoB,CAAC;AAW5B,YAAY,EAAE,sBAAsB,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;AAsH5E;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,sBAAsB,EAC9B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,wBAAwB,CAAC,CA6BnC"}
|