@dotsetlabs/tollgate 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 +21 -0
- package/README.md +885 -0
- package/dist/analyzers/filesystem.d.ts +26 -0
- package/dist/analyzers/filesystem.d.ts.map +1 -0
- package/dist/analyzers/filesystem.js +284 -0
- package/dist/analyzers/filesystem.js.map +1 -0
- package/dist/analyzers/http.d.ts +90 -0
- package/dist/analyzers/http.d.ts.map +1 -0
- package/dist/analyzers/http.js +433 -0
- package/dist/analyzers/http.js.map +1 -0
- package/dist/analyzers/index.d.ts +101 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +342 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/analyzers/loader.d.ts +114 -0
- package/dist/analyzers/loader.d.ts.map +1 -0
- package/dist/analyzers/loader.js +184 -0
- package/dist/analyzers/loader.js.map +1 -0
- package/dist/analyzers/prompt-injection.d.ts +95 -0
- package/dist/analyzers/prompt-injection.d.ts.map +1 -0
- package/dist/analyzers/prompt-injection.js +725 -0
- package/dist/analyzers/prompt-injection.js.map +1 -0
- package/dist/analyzers/sdk.d.ts +230 -0
- package/dist/analyzers/sdk.d.ts.map +1 -0
- package/dist/analyzers/sdk.js +283 -0
- package/dist/analyzers/sdk.js.map +1 -0
- package/dist/analyzers/shell.d.ts +20 -0
- package/dist/analyzers/shell.d.ts.map +1 -0
- package/dist/analyzers/shell.js +297 -0
- package/dist/analyzers/shell.js.map +1 -0
- package/dist/analyzers/sql.d.ts +37 -0
- package/dist/analyzers/sql.d.ts.map +1 -0
- package/dist/analyzers/sql.js +455 -0
- package/dist/analyzers/sql.js.map +1 -0
- package/dist/analyzers/types.d.ts +117 -0
- package/dist/analyzers/types.d.ts.map +1 -0
- package/dist/analyzers/types.js +46 -0
- package/dist/analyzers/types.js.map +1 -0
- package/dist/approval/interactive.d.ts +72 -0
- package/dist/approval/interactive.d.ts.map +1 -0
- package/dist/approval/interactive.js +550 -0
- package/dist/approval/interactive.js.map +1 -0
- package/dist/approval/terminal.d.ts +59 -0
- package/dist/approval/terminal.d.ts.map +1 -0
- package/dist/approval/terminal.js +238 -0
- package/dist/approval/terminal.js.map +1 -0
- package/dist/approval/types.d.ts +66 -0
- package/dist/approval/types.d.ts.map +1 -0
- package/dist/approval/types.js +2 -0
- package/dist/approval/types.js.map +1 -0
- package/dist/audit/exporter.d.ts +138 -0
- package/dist/audit/exporter.d.ts.map +1 -0
- package/dist/audit/exporter.js +366 -0
- package/dist/audit/exporter.js.map +1 -0
- package/dist/audit/logger.d.ts +156 -0
- package/dist/audit/logger.d.ts.map +1 -0
- package/dist/audit/logger.js +406 -0
- package/dist/audit/logger.js.map +1 -0
- package/dist/audit/redaction.d.ts +110 -0
- package/dist/audit/redaction.d.ts.map +1 -0
- package/dist/audit/redaction.js +307 -0
- package/dist/audit/redaction.js.map +1 -0
- package/dist/audit/schema.d.ts +76 -0
- package/dist/audit/schema.d.ts.map +1 -0
- package/dist/audit/schema.js +122 -0
- package/dist/audit/schema.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +34 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +431 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/export.d.ts +18 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +63 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +102 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +11 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +60 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +29 -0
- package/dist/cli/commands/scan.d.ts.map +1 -0
- package/dist/cli/commands/scan.js +251 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +26 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +424 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/start.d.ts +20 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +82 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +10 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +42 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/commands/templates.d.ts +26 -0
- package/dist/cli/commands/templates.d.ts.map +1 -0
- package/dist/cli/commands/templates.js +221 -0
- package/dist/cli/commands/templates.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +107 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/wrap.d.ts +19 -0
- package/dist/cli/commands/wrap.d.ts.map +1 -0
- package/dist/cli/commands/wrap.js +59 -0
- package/dist/cli/commands/wrap.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +202 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui.d.ts +139 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +271 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/constants.d.ts +33 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +54 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +28 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +37 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/index.d.ts +11 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +10 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/manager.d.ts +127 -0
- package/dist/orchestrator/manager.d.ts.map +1 -0
- package/dist/orchestrator/manager.js +498 -0
- package/dist/orchestrator/manager.js.map +1 -0
- package/dist/orchestrator/types.d.ts +141 -0
- package/dist/orchestrator/types.d.ts.map +1 -0
- package/dist/orchestrator/types.js +9 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/policy/engine.d.ts +55 -0
- package/dist/policy/engine.d.ts.map +1 -0
- package/dist/policy/engine.js +288 -0
- package/dist/policy/engine.js.map +1 -0
- package/dist/policy/natural-language.d.ts +141 -0
- package/dist/policy/natural-language.d.ts.map +1 -0
- package/dist/policy/natural-language.js +552 -0
- package/dist/policy/natural-language.js.map +1 -0
- package/dist/policy/parser.d.ts +141 -0
- package/dist/policy/parser.d.ts.map +1 -0
- package/dist/policy/parser.js +314 -0
- package/dist/policy/parser.js.map +1 -0
- package/dist/policy/types.d.ts +428 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +32 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/policy/validator.d.ts +72 -0
- package/dist/policy/validator.d.ts.map +1 -0
- package/dist/policy/validator.js +453 -0
- package/dist/policy/validator.js.map +1 -0
- package/dist/proxy/bridge.d.ts +84 -0
- package/dist/proxy/bridge.d.ts.map +1 -0
- package/dist/proxy/bridge.js +217 -0
- package/dist/proxy/bridge.js.map +1 -0
- package/dist/proxy/client.d.ts +130 -0
- package/dist/proxy/client.d.ts.map +1 -0
- package/dist/proxy/client.js +290 -0
- package/dist/proxy/client.js.map +1 -0
- package/dist/proxy/server.d.ts +111 -0
- package/dist/proxy/server.d.ts.map +1 -0
- package/dist/proxy/server.js +444 -0
- package/dist/proxy/server.js.map +1 -0
- package/dist/scanner.d.ts +91 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +373 -0
- package/dist/scanner.js.map +1 -0
- package/dist/session/index.d.ts +32 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +31 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/manager.d.ts +166 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +454 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/sqlite-store.d.ts +54 -0
- package/dist/session/sqlite-store.d.ts.map +1 -0
- package/dist/session/sqlite-store.js +209 -0
- package/dist/session/sqlite-store.js.map +1 -0
- package/dist/session/types.d.ts +179 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +38 -0
- package/dist/session/types.js.map +1 -0
- package/dist/templates.d.ts +64 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +451 -0
- package/dist/templates.js.map +1 -0
- package/dist/utils/config.d.ts +57 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +104 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/errors.d.ts +18 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +35 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +144 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +300 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/wizard.d.ts +68 -0
- package/dist/wizard.d.ts.map +1 -0
- package/dist/wizard.js +395 -0
- package/dist/wizard.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Templates Library for Tollgate
|
|
3
|
+
*
|
|
4
|
+
* Extended collection of MCP server templates for quick configuration.
|
|
5
|
+
* These templates provide recommended policies for popular MCP servers.
|
|
6
|
+
*
|
|
7
|
+
* Usage via CLI:
|
|
8
|
+
* tollgate templates list # List all available templates
|
|
9
|
+
* tollgate templates show <name> # Show template details
|
|
10
|
+
* tollgate templates apply <name> # Add template to tollgate.yaml
|
|
11
|
+
*
|
|
12
|
+
* @module templates
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Complete template library.
|
|
16
|
+
*/
|
|
17
|
+
export const TEMPLATE_LIBRARY = [
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Database Templates
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
{
|
|
22
|
+
name: 'postgres',
|
|
23
|
+
displayName: 'PostgreSQL',
|
|
24
|
+
description: 'PostgreSQL database access via SQL queries',
|
|
25
|
+
command: 'npx',
|
|
26
|
+
args: ['-y', '@modelcontextprotocol/server-postgres'],
|
|
27
|
+
envVars: [
|
|
28
|
+
{
|
|
29
|
+
key: 'DATABASE_URL',
|
|
30
|
+
description: 'PostgreSQL connection string',
|
|
31
|
+
example: 'postgresql://user:pass@localhost/dbname',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
recommendedPolicies: {
|
|
35
|
+
read: ['query'],
|
|
36
|
+
write: ['execute'],
|
|
37
|
+
destructive: [],
|
|
38
|
+
},
|
|
39
|
+
analyzer: 'sql',
|
|
40
|
+
category: 'database',
|
|
41
|
+
tags: ['database', 'sql', 'postgres', 'postgresql'],
|
|
42
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/postgres',
|
|
43
|
+
verified: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'sqlite',
|
|
47
|
+
displayName: 'SQLite',
|
|
48
|
+
description: 'SQLite database access for local databases',
|
|
49
|
+
command: 'npx',
|
|
50
|
+
args: ['-y', '@modelcontextprotocol/server-sqlite'],
|
|
51
|
+
envVars: [
|
|
52
|
+
{
|
|
53
|
+
key: 'SQLITE_PATH',
|
|
54
|
+
description: 'Path to SQLite database file',
|
|
55
|
+
example: './database.db',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
recommendedPolicies: {
|
|
59
|
+
read: ['query', 'list_tables', 'describe_table'],
|
|
60
|
+
write: ['execute'],
|
|
61
|
+
destructive: [],
|
|
62
|
+
},
|
|
63
|
+
analyzer: 'sql',
|
|
64
|
+
category: 'database',
|
|
65
|
+
tags: ['database', 'sql', 'sqlite', 'local'],
|
|
66
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite',
|
|
67
|
+
verified: true,
|
|
68
|
+
},
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
// Filesystem Templates
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
{
|
|
73
|
+
name: 'filesystem',
|
|
74
|
+
displayName: 'Filesystem',
|
|
75
|
+
description: 'Local filesystem access (read/write files)',
|
|
76
|
+
command: 'npx',
|
|
77
|
+
args: ['-y', '@anthropic/mcp-server-filesystem'],
|
|
78
|
+
recommendedPolicies: {
|
|
79
|
+
read: ['read_file', 'read_multiple_files', 'list_directory', 'get_file_info', 'search_files'],
|
|
80
|
+
write: ['write_file', 'create_directory', 'move_file'],
|
|
81
|
+
destructive: ['delete_file'],
|
|
82
|
+
},
|
|
83
|
+
analyzer: 'filesystem',
|
|
84
|
+
category: 'filesystem',
|
|
85
|
+
tags: ['filesystem', 'files', 'local', 'disk'],
|
|
86
|
+
docsUrl: 'https://github.com/anthropics/anthropic-cookbook/tree/main/mcp/servers/filesystem',
|
|
87
|
+
verified: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'google-drive',
|
|
91
|
+
displayName: 'Google Drive',
|
|
92
|
+
description: 'Access and manage Google Drive files',
|
|
93
|
+
command: 'npx',
|
|
94
|
+
args: ['-y', '@anthropic/mcp-server-google-drive'],
|
|
95
|
+
envVars: [
|
|
96
|
+
{
|
|
97
|
+
key: 'GOOGLE_APPLICATION_CREDENTIALS',
|
|
98
|
+
description: 'Path to Google service account JSON',
|
|
99
|
+
example: './service-account.json',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
recommendedPolicies: {
|
|
103
|
+
read: ['list_files', 'get_file', 'search', 'get_*'],
|
|
104
|
+
write: ['create_file', 'update_file', 'upload', 'move_*'],
|
|
105
|
+
destructive: ['delete_file', 'trash_*'],
|
|
106
|
+
},
|
|
107
|
+
category: 'filesystem',
|
|
108
|
+
tags: ['cloud', 'storage', 'google', 'drive', 'files'],
|
|
109
|
+
docsUrl: 'https://github.com/anthropics/anthropic-cookbook/tree/main/mcp/servers/google-drive',
|
|
110
|
+
verified: true,
|
|
111
|
+
},
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Web & Browser Templates
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
{
|
|
116
|
+
name: 'puppeteer',
|
|
117
|
+
displayName: 'Puppeteer (Web Browser)',
|
|
118
|
+
description: 'Web browsing and scraping via headless Chrome',
|
|
119
|
+
command: 'npx',
|
|
120
|
+
args: ['-y', '@anthropic/mcp-server-puppeteer'],
|
|
121
|
+
recommendedPolicies: {
|
|
122
|
+
read: ['screenshot', 'get_page_content', 'evaluate', 'get_*'],
|
|
123
|
+
write: ['navigate', 'click', 'type', 'fill', 'select', 'scroll'],
|
|
124
|
+
destructive: [],
|
|
125
|
+
},
|
|
126
|
+
analyzer: 'http',
|
|
127
|
+
category: 'web',
|
|
128
|
+
tags: ['browser', 'web', 'scraping', 'automation', 'chrome', 'puppeteer'],
|
|
129
|
+
docsUrl: 'https://github.com/anthropics/anthropic-cookbook/tree/main/mcp/servers/puppeteer',
|
|
130
|
+
verified: true,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'fetch',
|
|
134
|
+
displayName: 'Fetch (HTTP Requests)',
|
|
135
|
+
description: 'Make HTTP requests to external APIs',
|
|
136
|
+
command: 'npx',
|
|
137
|
+
args: ['-y', '@anthropic/mcp-server-fetch'],
|
|
138
|
+
recommendedPolicies: {
|
|
139
|
+
read: ['fetch'],
|
|
140
|
+
write: [],
|
|
141
|
+
destructive: [],
|
|
142
|
+
},
|
|
143
|
+
analyzer: 'http',
|
|
144
|
+
category: 'web',
|
|
145
|
+
tags: ['http', 'api', 'fetch', 'requests', 'web'],
|
|
146
|
+
docsUrl: 'https://github.com/anthropics/anthropic-cookbook/tree/main/mcp/servers/fetch',
|
|
147
|
+
verified: true,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'brave-search',
|
|
151
|
+
displayName: 'Brave Search',
|
|
152
|
+
description: 'Web search using Brave Search API',
|
|
153
|
+
command: 'npx',
|
|
154
|
+
args: ['-y', '@anthropic/mcp-server-brave-search'],
|
|
155
|
+
envVars: [
|
|
156
|
+
{
|
|
157
|
+
key: 'BRAVE_API_KEY',
|
|
158
|
+
description: 'Brave Search API key',
|
|
159
|
+
example: 'BSA_xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
recommendedPolicies: {
|
|
163
|
+
read: ['search', 'web_search', 'local_search'],
|
|
164
|
+
write: [],
|
|
165
|
+
destructive: [],
|
|
166
|
+
},
|
|
167
|
+
category: 'web',
|
|
168
|
+
tags: ['search', 'web', 'brave', 'internet'],
|
|
169
|
+
docsUrl: 'https://github.com/anthropics/anthropic-cookbook/tree/main/mcp/servers/brave-search',
|
|
170
|
+
verified: true,
|
|
171
|
+
},
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// Productivity Templates
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
{
|
|
176
|
+
name: 'slack',
|
|
177
|
+
displayName: 'Slack',
|
|
178
|
+
description: 'Interact with Slack workspaces',
|
|
179
|
+
command: 'npx',
|
|
180
|
+
args: ['-y', '@anthropic/mcp-server-slack'],
|
|
181
|
+
envVars: [
|
|
182
|
+
{
|
|
183
|
+
key: 'SLACK_BOT_TOKEN',
|
|
184
|
+
description: 'Slack Bot User OAuth Token',
|
|
185
|
+
example: 'xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
recommendedPolicies: {
|
|
189
|
+
read: ['list_channels', 'get_channel_history', 'search_*', 'get_*'],
|
|
190
|
+
write: ['post_message', 'reply_*', 'update_*'],
|
|
191
|
+
destructive: ['delete_message'],
|
|
192
|
+
},
|
|
193
|
+
category: 'communication',
|
|
194
|
+
tags: ['slack', 'chat', 'messaging', 'team', 'communication'],
|
|
195
|
+
docsUrl: 'https://github.com/anthropics/anthropic-cookbook/tree/main/mcp/servers/slack',
|
|
196
|
+
verified: true,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'notion',
|
|
200
|
+
displayName: 'Notion',
|
|
201
|
+
description: 'Access and manage Notion workspaces',
|
|
202
|
+
command: 'npx',
|
|
203
|
+
args: ['-y', '@modelcontextprotocol/server-notion'],
|
|
204
|
+
envVars: [
|
|
205
|
+
{
|
|
206
|
+
key: 'NOTION_API_KEY',
|
|
207
|
+
description: 'Notion integration token',
|
|
208
|
+
example: 'secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
recommendedPolicies: {
|
|
212
|
+
read: ['search', 'get_page', 'get_database', 'query_database', 'get_*', 'list_*'],
|
|
213
|
+
write: ['create_page', 'update_page', 'append_*', 'create_*'],
|
|
214
|
+
destructive: ['delete_page', 'archive_*'],
|
|
215
|
+
},
|
|
216
|
+
category: 'productivity',
|
|
217
|
+
tags: ['notion', 'notes', 'wiki', 'database', 'productivity'],
|
|
218
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/notion',
|
|
219
|
+
verified: true,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'memory',
|
|
223
|
+
displayName: 'Memory',
|
|
224
|
+
description: 'Persistent memory and knowledge storage',
|
|
225
|
+
command: 'npx',
|
|
226
|
+
args: ['-y', '@modelcontextprotocol/server-memory'],
|
|
227
|
+
recommendedPolicies: {
|
|
228
|
+
read: ['retrieve', 'search', 'get_*', 'list_*'],
|
|
229
|
+
write: ['store', 'update', 'create_*'],
|
|
230
|
+
destructive: ['delete', 'clear'],
|
|
231
|
+
},
|
|
232
|
+
category: 'ai',
|
|
233
|
+
tags: ['memory', 'storage', 'knowledge', 'persistent', 'ai'],
|
|
234
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/memory',
|
|
235
|
+
verified: true,
|
|
236
|
+
},
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// Developer Templates
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
{
|
|
241
|
+
name: 'github',
|
|
242
|
+
displayName: 'GitHub',
|
|
243
|
+
description: 'GitHub repository operations',
|
|
244
|
+
command: 'npx',
|
|
245
|
+
args: ['-y', '@modelcontextprotocol/server-github'],
|
|
246
|
+
envVars: [
|
|
247
|
+
{
|
|
248
|
+
key: 'GITHUB_TOKEN',
|
|
249
|
+
description: 'GitHub personal access token',
|
|
250
|
+
example: 'ghp_xxxxxxxxxxxx',
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
recommendedPolicies: {
|
|
254
|
+
read: ['get_file_contents', 'list_commits', 'search_*', 'get_*', 'list_*'],
|
|
255
|
+
write: ['create_issue', 'create_pull_request', 'push_files', 'create_*', 'update_*'],
|
|
256
|
+
destructive: ['delete_*'],
|
|
257
|
+
},
|
|
258
|
+
category: 'developer',
|
|
259
|
+
tags: ['github', 'git', 'vcs', 'code', 'repository'],
|
|
260
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/github',
|
|
261
|
+
verified: true,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: 'gitlab',
|
|
265
|
+
displayName: 'GitLab',
|
|
266
|
+
description: 'GitLab repository and CI/CD operations',
|
|
267
|
+
command: 'npx',
|
|
268
|
+
args: ['-y', '@modelcontextprotocol/server-gitlab'],
|
|
269
|
+
envVars: [
|
|
270
|
+
{
|
|
271
|
+
key: 'GITLAB_TOKEN',
|
|
272
|
+
description: 'GitLab personal access token',
|
|
273
|
+
example: 'glpat-xxxxxxxxxxxxxxxxxxxx',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: 'GITLAB_URL',
|
|
277
|
+
description: 'GitLab instance URL (optional)',
|
|
278
|
+
example: 'https://gitlab.com',
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
recommendedPolicies: {
|
|
282
|
+
read: ['get_file', 'list_projects', 'search_*', 'get_*', 'list_*'],
|
|
283
|
+
write: ['create_issue', 'create_merge_request', 'push_*', 'create_*', 'update_*'],
|
|
284
|
+
destructive: ['delete_*'],
|
|
285
|
+
},
|
|
286
|
+
category: 'developer',
|
|
287
|
+
tags: ['gitlab', 'git', 'vcs', 'code', 'cicd'],
|
|
288
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/gitlab',
|
|
289
|
+
verified: true,
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'sentry',
|
|
293
|
+
displayName: 'Sentry',
|
|
294
|
+
description: 'Monitor and debug application errors',
|
|
295
|
+
command: 'npx',
|
|
296
|
+
args: ['-y', '@modelcontextprotocol/server-sentry'],
|
|
297
|
+
envVars: [
|
|
298
|
+
{
|
|
299
|
+
key: 'SENTRY_AUTH_TOKEN',
|
|
300
|
+
description: 'Sentry authentication token',
|
|
301
|
+
example: 'sntrys_xxxxxxxxxxxxxxxxxxxx',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: 'SENTRY_ORG',
|
|
305
|
+
description: 'Sentry organization slug',
|
|
306
|
+
example: 'my-org',
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
recommendedPolicies: {
|
|
310
|
+
read: ['list_issues', 'get_issue', 'search_*', 'get_*', 'list_*'],
|
|
311
|
+
write: ['resolve_issue', 'assign_issue', 'update_*'],
|
|
312
|
+
destructive: ['delete_*'],
|
|
313
|
+
},
|
|
314
|
+
category: 'developer',
|
|
315
|
+
tags: ['sentry', 'errors', 'monitoring', 'debugging', 'observability'],
|
|
316
|
+
docsUrl: 'https://github.com/modelcontextprotocol/servers/tree/main/src/sentry',
|
|
317
|
+
verified: true,
|
|
318
|
+
},
|
|
319
|
+
];
|
|
320
|
+
// ============================================================================
|
|
321
|
+
// Template Utilities
|
|
322
|
+
// ============================================================================
|
|
323
|
+
/**
|
|
324
|
+
* Get all templates.
|
|
325
|
+
*/
|
|
326
|
+
export function getAllTemplates() {
|
|
327
|
+
return TEMPLATE_LIBRARY;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get templates by category.
|
|
331
|
+
*/
|
|
332
|
+
export function getTemplatesByCategory(category) {
|
|
333
|
+
return TEMPLATE_LIBRARY.filter((t) => t.category === category);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Get template by name.
|
|
337
|
+
*/
|
|
338
|
+
export function getTemplateByName(name) {
|
|
339
|
+
return TEMPLATE_LIBRARY.find((t) => t.name.toLowerCase() === name.toLowerCase());
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Search templates by keyword.
|
|
343
|
+
*/
|
|
344
|
+
export function searchTemplates(query) {
|
|
345
|
+
const lowerQuery = query.toLowerCase();
|
|
346
|
+
return TEMPLATE_LIBRARY.filter((t) => t.name.toLowerCase().includes(lowerQuery) ||
|
|
347
|
+
t.displayName.toLowerCase().includes(lowerQuery) ||
|
|
348
|
+
t.description.toLowerCase().includes(lowerQuery) ||
|
|
349
|
+
t.tags.some((tag) => tag.includes(lowerQuery)));
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Get unique categories.
|
|
353
|
+
*/
|
|
354
|
+
export function getCategories() {
|
|
355
|
+
return [...new Set(TEMPLATE_LIBRARY.map((t) => t.category))];
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Generate YAML configuration for a template.
|
|
359
|
+
*/
|
|
360
|
+
export function generateTemplateYaml(template, policyPreset = 'balanced') {
|
|
361
|
+
const lines = [];
|
|
362
|
+
// Policy mappings
|
|
363
|
+
const presets = {
|
|
364
|
+
strict: { read: 'prompt', write: 'deny', destructive: 'deny' },
|
|
365
|
+
balanced: { read: 'allow', write: 'prompt', destructive: 'deny' },
|
|
366
|
+
permissive: { read: 'allow', write: 'prompt', destructive: 'prompt' },
|
|
367
|
+
};
|
|
368
|
+
const preset = presets[policyPreset];
|
|
369
|
+
lines.push(` # ${template.displayName}`);
|
|
370
|
+
lines.push(` # ${template.description}`);
|
|
371
|
+
lines.push(` ${template.name}:`);
|
|
372
|
+
lines.push(` command: "${template.command}"`);
|
|
373
|
+
if (template.args.length > 0) {
|
|
374
|
+
lines.push(` args: [${template.args.map((a) => `"${a}"`).join(', ')}]`);
|
|
375
|
+
}
|
|
376
|
+
// Environment variables
|
|
377
|
+
if (template.envVars && template.envVars.length > 0) {
|
|
378
|
+
lines.push(' env:');
|
|
379
|
+
for (const env of template.envVars) {
|
|
380
|
+
lines.push(` ${env.key}: "\${${env.key}}" # ${env.description}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// Analyzer if applicable
|
|
384
|
+
if (template.analyzer) {
|
|
385
|
+
lines.push(' defaults:');
|
|
386
|
+
lines.push(` analyzer: ${template.analyzer}`);
|
|
387
|
+
}
|
|
388
|
+
// Tool policies
|
|
389
|
+
lines.push(' tools:');
|
|
390
|
+
// Read operations
|
|
391
|
+
if (template.recommendedPolicies.read && template.recommendedPolicies.read.length > 0) {
|
|
392
|
+
lines.push(' # Read operations');
|
|
393
|
+
for (const pattern of template.recommendedPolicies.read) {
|
|
394
|
+
lines.push(` "${pattern}":`);
|
|
395
|
+
lines.push(` action: ${preset.read}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
// Write operations
|
|
399
|
+
if (template.recommendedPolicies.write && template.recommendedPolicies.write.length > 0) {
|
|
400
|
+
lines.push(' # Write operations');
|
|
401
|
+
for (const pattern of template.recommendedPolicies.write) {
|
|
402
|
+
lines.push(` "${pattern}":`);
|
|
403
|
+
lines.push(` action: ${preset.write}`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
// Destructive operations
|
|
407
|
+
if (template.recommendedPolicies.destructive && template.recommendedPolicies.destructive.length > 0) {
|
|
408
|
+
lines.push(' # Destructive operations');
|
|
409
|
+
for (const pattern of template.recommendedPolicies.destructive) {
|
|
410
|
+
lines.push(` "${pattern}":`);
|
|
411
|
+
lines.push(` action: ${preset.destructive}`);
|
|
412
|
+
if (preset.destructive === 'deny') {
|
|
413
|
+
lines.push(' reason: "Destructive operations are disabled for safety"');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
// Catch-all
|
|
418
|
+
lines.push(' # Catch-all for unmatched tools');
|
|
419
|
+
lines.push(' "*":');
|
|
420
|
+
lines.push(' action: prompt');
|
|
421
|
+
return lines.join('\n');
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Generate full config file from multiple templates.
|
|
425
|
+
*/
|
|
426
|
+
export function generateFullConfig(templateNames, policyPreset = 'balanced') {
|
|
427
|
+
const lines = [
|
|
428
|
+
'# Tollgate Configuration',
|
|
429
|
+
'# Generated by `tollgate templates apply`',
|
|
430
|
+
'# https://github.com/dotsetlabs/tollgate',
|
|
431
|
+
'',
|
|
432
|
+
'version: "1"',
|
|
433
|
+
'',
|
|
434
|
+
'# Default action when no policy matches',
|
|
435
|
+
'defaults:',
|
|
436
|
+
' action: prompt',
|
|
437
|
+
' timeout: 60000',
|
|
438
|
+
'',
|
|
439
|
+
'# MCP Server configurations',
|
|
440
|
+
'servers:',
|
|
441
|
+
];
|
|
442
|
+
for (const name of templateNames) {
|
|
443
|
+
const template = getTemplateByName(name);
|
|
444
|
+
if (template) {
|
|
445
|
+
lines.push(generateTemplateYaml(template, policyPreset));
|
|
446
|
+
lines.push('');
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return lines.join('\n');
|
|
450
|
+
}
|
|
451
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkCH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAuB;IAChD,8EAA8E;IAC9E,qBAAqB;IACrB,8EAA8E;IAC9E;QACI,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,YAAY;QACzB,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,uCAAuC,CAAC;QACrD,OAAO,EAAE;YACL;gBACI,GAAG,EAAE,cAAc;gBACnB,WAAW,EAAE,8BAA8B;gBAC3C,OAAO,EAAE,yCAAyC;aACrD;SACJ;QACD,mBAAmB,EAAE;YACjB,IAAI,EAAE,CAAC,OAAO,CAAC;YACf,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,WAAW,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,CAAC;QACnD,OAAO,EAAE,wEAAwE;QACjF,QAAQ,EAAE,IAAI;KACjB;IACD;QACI,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,qCAAqC,CAAC;QACnD,OAAO,EAAE;YACL;gBACI,GAAG,EAAE,aAAa;gBAClB,WAAW,EAAE,8BAA8B;gBAC3C,OAAO,EAAE,eAAe;aAC3B;SACJ;QACD,mBAAmB,EAAE;YACjB,IAAI,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,gBAAgB,CAAC;YAChD,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,WAAW,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE,K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AAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TollgateConfig } from '../policy/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Loads and parses the Tollgate configuration file.
|
|
4
|
+
*
|
|
5
|
+
* Searches for configuration in the following order:
|
|
6
|
+
* 1. Explicitly provided path
|
|
7
|
+
* 2. ./tollgate.yaml
|
|
8
|
+
* 3. ./tollgate.yml
|
|
9
|
+
* 4. ~/.config/tollgate/config.yaml
|
|
10
|
+
* 5. ~/.tollgate.yaml
|
|
11
|
+
*
|
|
12
|
+
* @param configPath - Optional explicit path to the configuration file
|
|
13
|
+
* @returns The parsed Tollgate configuration
|
|
14
|
+
* @throws {ConfigError} If no configuration file is found or parsing fails
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const config = await loadConfig('./my-config.yaml');
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadConfig(configPath?: string): Promise<TollgateConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* Expands environment variable placeholders in a string.
|
|
24
|
+
*
|
|
25
|
+
* Replaces `${VAR_NAME}` patterns with the corresponding environment
|
|
26
|
+
* variable value. Undefined variables are replaced with an empty string.
|
|
27
|
+
*
|
|
28
|
+
* @param value - The string containing environment variable placeholders
|
|
29
|
+
* @returns The string with all placeholders expanded
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // With HOME=/Users/alice
|
|
34
|
+
* expandEnvVars('${HOME}/.config') // Returns '/Users/alice/.config'
|
|
35
|
+
*
|
|
36
|
+
* // Undefined variables become empty
|
|
37
|
+
* expandEnvVars('${UNDEFINED_VAR}') // Returns ''
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function expandEnvVars(value: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the Tollgate data directory path.
|
|
43
|
+
*
|
|
44
|
+
* The data directory is used for storing:
|
|
45
|
+
* - Audit logs (SQLite database)
|
|
46
|
+
* - Session data (when persistent sessions are enabled)
|
|
47
|
+
* - Other runtime data
|
|
48
|
+
*
|
|
49
|
+
* @returns The path to the Tollgate data directory (`~/.tollgate`)
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const dataDir = getDataDir(); // Returns '/Users/alice/.tollgate'
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function getDataDir(): string;
|
|
57
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA0B7E;AAWD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAGnC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { load as loadYaml } from 'js-yaml';
|
|
6
|
+
import { ConfigError } from './errors.js';
|
|
7
|
+
const DEFAULT_CONFIG_PATHS = [
|
|
8
|
+
'./tollgate.yaml',
|
|
9
|
+
'./tollgate.yml',
|
|
10
|
+
join(homedir(), '.config', 'tollgate', 'config.yaml'),
|
|
11
|
+
join(homedir(), '.tollgate.yaml'),
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* Loads and parses the Tollgate configuration file.
|
|
15
|
+
*
|
|
16
|
+
* Searches for configuration in the following order:
|
|
17
|
+
* 1. Explicitly provided path
|
|
18
|
+
* 2. ./tollgate.yaml
|
|
19
|
+
* 3. ./tollgate.yml
|
|
20
|
+
* 4. ~/.config/tollgate/config.yaml
|
|
21
|
+
* 5. ~/.tollgate.yaml
|
|
22
|
+
*
|
|
23
|
+
* @param configPath - Optional explicit path to the configuration file
|
|
24
|
+
* @returns The parsed Tollgate configuration
|
|
25
|
+
* @throws {ConfigError} If no configuration file is found or parsing fails
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const config = await loadConfig('./my-config.yaml');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export async function loadConfig(configPath) {
|
|
33
|
+
const path = configPath ?? findConfigFile();
|
|
34
|
+
if (!path) {
|
|
35
|
+
throw new ConfigError('No configuration file found. Create tollgate.yaml or specify --config', { searchedPaths: DEFAULT_CONFIG_PATHS });
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const content = await readFile(path, 'utf-8');
|
|
39
|
+
const config = loadYaml(content);
|
|
40
|
+
if (!config || typeof config !== 'object') {
|
|
41
|
+
throw new ConfigError('Invalid configuration: must be a YAML object');
|
|
42
|
+
}
|
|
43
|
+
return config;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error instanceof ConfigError)
|
|
47
|
+
throw error;
|
|
48
|
+
throw new ConfigError(`Failed to load config from ${path}`, {
|
|
49
|
+
path,
|
|
50
|
+
error: error instanceof Error ? error.message : String(error),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function findConfigFile() {
|
|
55
|
+
for (const path of DEFAULT_CONFIG_PATHS) {
|
|
56
|
+
if (existsSync(path)) {
|
|
57
|
+
return path;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Expands environment variable placeholders in a string.
|
|
64
|
+
*
|
|
65
|
+
* Replaces `${VAR_NAME}` patterns with the corresponding environment
|
|
66
|
+
* variable value. Undefined variables are replaced with an empty string.
|
|
67
|
+
*
|
|
68
|
+
* @param value - The string containing environment variable placeholders
|
|
69
|
+
* @returns The string with all placeholders expanded
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // With HOME=/Users/alice
|
|
74
|
+
* expandEnvVars('${HOME}/.config') // Returns '/Users/alice/.config'
|
|
75
|
+
*
|
|
76
|
+
* // Undefined variables become empty
|
|
77
|
+
* expandEnvVars('${UNDEFINED_VAR}') // Returns ''
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function expandEnvVars(value) {
|
|
81
|
+
return value.replace(/\$\{(\w+)\}/g, (_, name) => {
|
|
82
|
+
return process.env[name] ?? '';
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns the Tollgate data directory path.
|
|
87
|
+
*
|
|
88
|
+
* The data directory is used for storing:
|
|
89
|
+
* - Audit logs (SQLite database)
|
|
90
|
+
* - Session data (when persistent sessions are enabled)
|
|
91
|
+
* - Other runtime data
|
|
92
|
+
*
|
|
93
|
+
* @returns The path to the Tollgate data directory (`~/.tollgate`)
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const dataDir = getDataDir(); // Returns '/Users/alice/.tollgate'
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export function getDataDir() {
|
|
101
|
+
const dir = join(homedir(), '.tollgate');
|
|
102
|
+
return dir;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE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AAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,cAAc;IACrB,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE,CAAC;QACxC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,IAAY,EAAE,EAAE;QACvD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;IACzC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class TollgateError extends Error {
|
|
2
|
+
code: string;
|
|
3
|
+
details?: Record<string, unknown> | undefined;
|
|
4
|
+
constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
|
|
5
|
+
}
|
|
6
|
+
export declare class PolicyError extends TollgateError {
|
|
7
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
8
|
+
}
|
|
9
|
+
export declare class ConfigError extends TollgateError {
|
|
10
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
11
|
+
}
|
|
12
|
+
export declare class ProxyError extends TollgateError {
|
|
13
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
14
|
+
}
|
|
15
|
+
export declare class UpstreamError extends TollgateError {
|
|
16
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IAG7B,IAAI,EAAE,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFxC,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAK3C;AAED,qBAAa,WAAY,SAAQ,aAAa;gBAChC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,WAAY,SAAQ,aAAa;gBAChC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,UAAW,SAAQ,aAAa;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D"}
|