@debugg-ai/debugg-ai-mcp 1.0.51 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +85 -78
- package/package.json +1 -1
- package/dist/services/ngrok/index.js +0 -198
- package/dist/utils/axios.js +0 -35
- package/dist/utils/axiosNaming.js +0 -31
- package/dist/utils/transportConfig.js +0 -1
package/dist/index.js
CHANGED
|
@@ -23,16 +23,13 @@ import { config } from "./config/index.js";
|
|
|
23
23
|
import { initTools, getTools, getTool } from "./tools/index.js";
|
|
24
24
|
import { resolveProjectContext } from "./services/projectContext.js";
|
|
25
25
|
import { Logger, validateInput, createErrorResponse, toMCPError, handleConfigurationError, Telemetry, TelemetryEvents, } from "./utils/index.js";
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
// Logger and server are initialized lazily in main() to avoid triggering
|
|
27
|
+
// config loading at module load time. If config validation fails (bad env vars),
|
|
28
|
+
// the error is caught by main()'s try-catch instead of crashing before any
|
|
29
|
+
// error handling is set up.
|
|
30
|
+
let logger;
|
|
31
|
+
let server;
|
|
31
32
|
function createMCPServer() {
|
|
32
|
-
logger.info('Initializing DebuggAI MCP Server', {
|
|
33
|
-
name: config.server.name,
|
|
34
|
-
version: config.server.version
|
|
35
|
-
});
|
|
36
33
|
return new Server({
|
|
37
34
|
name: config.server.name,
|
|
38
35
|
version: config.server.version,
|
|
@@ -45,7 +42,6 @@ function createMCPServer() {
|
|
|
45
42
|
},
|
|
46
43
|
});
|
|
47
44
|
}
|
|
48
|
-
const server = createMCPServer();
|
|
49
45
|
/**
|
|
50
46
|
* Create progress callback for tool execution
|
|
51
47
|
*/
|
|
@@ -76,75 +72,70 @@ function createProgressCallback(progressToken) {
|
|
|
76
72
|
};
|
|
77
73
|
}
|
|
78
74
|
/**
|
|
79
|
-
*
|
|
75
|
+
* Register MCP request handlers. Called in main() after server is created.
|
|
80
76
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const { name, arguments: args } = typedReq.params;
|
|
92
|
-
const progressToken = typedReq.params._meta?.progressToken;
|
|
93
|
-
// Unknown tool is a protocol error - throw directly so SDK returns JSON-RPC error
|
|
94
|
-
const tool = getTool(name);
|
|
95
|
-
if (!tool) {
|
|
96
|
-
requestLogger.warn(`Tool not found: ${name}`);
|
|
97
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
// Validate input using the tool's schema
|
|
101
|
-
const validatedInput = validateInput(tool.inputSchema, args, name);
|
|
102
|
-
// Create tool context
|
|
103
|
-
const context = {
|
|
104
|
-
progressToken: typeof progressToken === 'string' ? progressToken : undefined,
|
|
105
|
-
requestId,
|
|
106
|
-
timestamp: new Date(),
|
|
107
|
-
};
|
|
108
|
-
// Create progress callback
|
|
109
|
-
const progressCallback = createProgressCallback(typeof progressToken === 'string' || typeof progressToken === 'number' ? String(progressToken) : undefined);
|
|
110
|
-
// Execute tool handler with progress callback
|
|
111
|
-
requestLogger.info(`Executing tool: ${name}`);
|
|
112
|
-
const toolStart = Date.now();
|
|
113
|
-
const result = await tool.handler(validatedInput, context, progressCallback);
|
|
114
|
-
const toolDuration = Date.now() - toolStart;
|
|
115
|
-
requestLogger.info(`Tool execution completed: ${name}`);
|
|
116
|
-
Telemetry.capture(TelemetryEvents.TOOL_EXECUTED, { toolName: name, durationMs: toolDuration, success: true });
|
|
117
|
-
return result;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
// Validation and execution errors are tool execution errors (isError: true)
|
|
121
|
-
// so the model can self-correct
|
|
122
|
-
const mcpError = toMCPError(error, 'tool execution');
|
|
123
|
-
requestLogger.error('Tool execution failed', {
|
|
124
|
-
errorCode: mcpError.code,
|
|
125
|
-
message: mcpError.message,
|
|
126
|
-
data: mcpError.data
|
|
77
|
+
function registerHandlers() {
|
|
78
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
79
|
+
const typedReq = req;
|
|
80
|
+
const requestId = `req_${Date.now()}`;
|
|
81
|
+
const requestLogger = logger.child({ requestId });
|
|
82
|
+
requestLogger.info("Received tool call request", {
|
|
83
|
+
toolName: typedReq.params.name,
|
|
84
|
+
hasProgressToken: !!typedReq.params._meta?.progressToken,
|
|
85
|
+
progressToken: typedReq.params._meta?.progressToken,
|
|
86
|
+
progressTokenType: typeof typedReq.params._meta?.progressToken
|
|
127
87
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
88
|
+
const { name, arguments: args } = typedReq.params;
|
|
89
|
+
const progressToken = typedReq.params._meta?.progressToken;
|
|
90
|
+
const tool = getTool(name);
|
|
91
|
+
if (!tool) {
|
|
92
|
+
requestLogger.warn(`Tool not found: ${name}`);
|
|
93
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const validatedInput = validateInput(tool.inputSchema, args, name);
|
|
97
|
+
const context = {
|
|
98
|
+
progressToken: typeof progressToken === 'string' ? progressToken : undefined,
|
|
99
|
+
requestId,
|
|
100
|
+
timestamp: new Date(),
|
|
101
|
+
};
|
|
102
|
+
const progressCallback = createProgressCallback(typeof progressToken === 'string' || typeof progressToken === 'number' ? String(progressToken) : undefined);
|
|
103
|
+
requestLogger.info(`Executing tool: ${name}`);
|
|
104
|
+
const toolStart = Date.now();
|
|
105
|
+
const result = await tool.handler(validatedInput, context, progressCallback);
|
|
106
|
+
const toolDuration = Date.now() - toolStart;
|
|
107
|
+
requestLogger.info(`Tool execution completed: ${name}`);
|
|
108
|
+
Telemetry.capture(TelemetryEvents.TOOL_EXECUTED, { toolName: name, durationMs: toolDuration, success: true });
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const mcpError = toMCPError(error, 'tool execution');
|
|
113
|
+
requestLogger.error('Tool execution failed', {
|
|
114
|
+
errorCode: mcpError.code,
|
|
115
|
+
message: mcpError.message,
|
|
116
|
+
data: mcpError.data
|
|
117
|
+
});
|
|
118
|
+
Telemetry.capture(TelemetryEvents.TOOL_FAILED, { toolName: name, errorCode: mcpError.code });
|
|
119
|
+
return createErrorResponse(mcpError, typedReq.params.name);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
123
|
+
const tools = getTools();
|
|
124
|
+
logger.info('Tools list requested', { toolCount: tools.length });
|
|
125
|
+
return { tools };
|
|
126
|
+
});
|
|
127
|
+
}
|
|
142
128
|
/**
|
|
143
129
|
* Main server initialization and startup
|
|
144
130
|
*/
|
|
145
131
|
async function main() {
|
|
146
132
|
try {
|
|
147
|
-
//
|
|
133
|
+
// Initialize logger and server here (not at module load time) so config
|
|
134
|
+
// validation errors are caught by this try-catch instead of crashing.
|
|
135
|
+
logger = new Logger({ module: 'main' });
|
|
136
|
+
server = createMCPServer();
|
|
137
|
+
// Register request handlers (they reference the `server` variable)
|
|
138
|
+
registerHandlers();
|
|
148
139
|
logger.info('Starting DebuggAI MCP Server', {
|
|
149
140
|
nodeVersion: process.version,
|
|
150
141
|
platform: process.platform,
|
|
@@ -198,27 +189,43 @@ async function main() {
|
|
|
198
189
|
throw handleConfigurationError(error);
|
|
199
190
|
}
|
|
200
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Safe log helper — falls back to stderr if logger isn't initialized yet
|
|
194
|
+
* (e.g. config validation failed before logger was created).
|
|
195
|
+
*/
|
|
196
|
+
function safeLog(level, message, meta) {
|
|
197
|
+
try {
|
|
198
|
+
if (logger) {
|
|
199
|
+
logger[level](message, meta);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// Logger init failed (config validation error) — fall through to stderr
|
|
205
|
+
}
|
|
206
|
+
process.stderr.write(`[${level.toUpperCase()}] ${message} ${meta ? JSON.stringify(meta) : ''}\n`);
|
|
207
|
+
}
|
|
201
208
|
/**
|
|
202
209
|
* Handle graceful shutdown
|
|
203
210
|
*/
|
|
204
211
|
process.on('SIGINT', async () => {
|
|
205
|
-
|
|
212
|
+
safeLog('info', 'Received SIGINT, shutting down gracefully');
|
|
206
213
|
await Telemetry.shutdown();
|
|
207
214
|
process.exit(0);
|
|
208
215
|
});
|
|
209
216
|
process.on('SIGTERM', async () => {
|
|
210
|
-
|
|
217
|
+
safeLog('info', 'Received SIGTERM, shutting down gracefully');
|
|
211
218
|
await Telemetry.shutdown();
|
|
212
219
|
process.exit(0);
|
|
213
220
|
});
|
|
214
221
|
process.on('unhandledRejection', (reason) => {
|
|
215
|
-
|
|
222
|
+
safeLog('error', 'Unhandled promise rejection', {
|
|
216
223
|
error: reason instanceof Error ? reason.message : String(reason),
|
|
217
224
|
stack: reason instanceof Error ? reason.stack : undefined,
|
|
218
225
|
});
|
|
219
226
|
});
|
|
220
227
|
process.on('uncaughtException', (error) => {
|
|
221
|
-
|
|
228
|
+
safeLog('error', 'Uncaught exception', {
|
|
222
229
|
error: error.message,
|
|
223
230
|
stack: error.stack,
|
|
224
231
|
});
|
|
@@ -227,9 +234,9 @@ process.on('uncaughtException', (error) => {
|
|
|
227
234
|
* Start the server
|
|
228
235
|
*/
|
|
229
236
|
main().catch((error) => {
|
|
230
|
-
|
|
237
|
+
safeLog('error', 'Fatal error during startup', {
|
|
231
238
|
error: error instanceof Error ? error.message : String(error),
|
|
232
|
-
stack: error instanceof Error ? error.stack : undefined
|
|
239
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
233
240
|
});
|
|
234
241
|
process.exit(1);
|
|
235
242
|
});
|
package/package.json
CHANGED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { existsSync, promises } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { isError } from './error.js';
|
|
5
|
-
const { readFile } = promises;
|
|
6
|
-
import { mkdirp } from 'mkdirp';
|
|
7
|
-
import { authtoken, connect, disconnect, getApi, kill } from 'ngrok';
|
|
8
|
-
import download from 'ngrok/download';
|
|
9
|
-
import { parse } from 'yaml';
|
|
10
|
-
// ES module compatible __dirname
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
// Use empty string to let ngrok use its default binary location
|
|
14
|
-
const basePath = '';
|
|
15
|
-
export const binPath = () => basePath;
|
|
16
|
-
const DEFAULT_CONFIG_PATH = join(__dirname, 'ngrok-config.yml');
|
|
17
|
-
const getConfigPath = () => {
|
|
18
|
-
return DEFAULT_CONFIG_PATH;
|
|
19
|
-
};
|
|
20
|
-
const getConfig = async () => {
|
|
21
|
-
const configPath = getConfigPath();
|
|
22
|
-
try {
|
|
23
|
-
const config = parse(await readFile(configPath, 'utf8'));
|
|
24
|
-
if (config && typeof config.authtoken !== 'undefined') {
|
|
25
|
-
await authtoken({ authtoken: config.authtoken, binPath });
|
|
26
|
-
}
|
|
27
|
-
return config;
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
if (isError(error) && error.code === 'ENOENT') {
|
|
31
|
-
if (configPath !== DEFAULT_CONFIG_PATH) {
|
|
32
|
-
console.error(`Could not find config file at ${configPath}.`);
|
|
33
|
-
error.message = `Could not find config file at ${configPath}`;
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
console.error(`Could not parse config file at ${configPath}.`);
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const tunnelsFromConfig = (tunnels) => {
|
|
44
|
-
return Object.keys(tunnels).map((tunnelName) => {
|
|
45
|
-
return {
|
|
46
|
-
label: tunnelName,
|
|
47
|
-
tunnelOptions: { name: tunnelName, ...tunnels[tunnelName] },
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
const getActiveTunnels = async (api) => {
|
|
52
|
-
const response = await api.listTunnels();
|
|
53
|
-
return response.tunnels;
|
|
54
|
-
};
|
|
55
|
-
export const start = async (options) => {
|
|
56
|
-
const config = await getConfig();
|
|
57
|
-
const tunnel = options;
|
|
58
|
-
if (typeof tunnel !== 'undefined') {
|
|
59
|
-
const configPath = getConfigPath();
|
|
60
|
-
if (existsSync(configPath)) {
|
|
61
|
-
tunnel.configPath = configPath;
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
// Let ngrok use default binPath if ours is empty
|
|
65
|
-
if (basePath) {
|
|
66
|
-
tunnel.binPath = binPath;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const url = await connect(tunnel);
|
|
70
|
-
return url;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
if (isError(error)) {
|
|
74
|
-
error.message = `There was an error starting your tunnel.`;
|
|
75
|
-
}
|
|
76
|
-
console.error(`There was an error starting your tunnel.`);
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
if (isError(error)) {
|
|
82
|
-
error.message = `There was an error finding the bin path.`;
|
|
83
|
-
}
|
|
84
|
-
console.error(`There was an error finding the bin path.`);
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
};
|
|
90
|
-
export const stop = async (tunnel) => {
|
|
91
|
-
const api = getApi();
|
|
92
|
-
if (!api) {
|
|
93
|
-
console.error('ngrok is not currently running.');
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
const tunnels = await getActiveTunnels(api);
|
|
98
|
-
console.log('tunnels', tunnels);
|
|
99
|
-
console.log('attempting to stop tunnel', tunnel);
|
|
100
|
-
if (tunnels.length > 0) {
|
|
101
|
-
if (tunnel === 'All') {
|
|
102
|
-
await closeAllTunnels();
|
|
103
|
-
}
|
|
104
|
-
else if (typeof tunnel !== 'undefined') {
|
|
105
|
-
let tunnelUrl = tunnel.includes("http") ? tunnel : `https://${tunnel}`;
|
|
106
|
-
await closeTunnel(tunnelUrl, api);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
console.error('There are no active ngrok tunnels.');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
console.error('Could not get active tunnels from ngrok.');
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const closeTunnel = async (tunnel, api) => {
|
|
118
|
-
try {
|
|
119
|
-
await disconnect(tunnel);
|
|
120
|
-
let message = `Debugg AI tunnel disconnected.`;
|
|
121
|
-
if ((await getActiveTunnels(api)).length === 0) {
|
|
122
|
-
await kill();
|
|
123
|
-
message = `${message} DebuggAI test runner completed.`;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
console.error(error);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const closeAllTunnels = async () => {
|
|
131
|
-
try {
|
|
132
|
-
await disconnect();
|
|
133
|
-
await kill();
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
console.error(error);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
export const setAuthToken = async (token) => {
|
|
140
|
-
if (typeof token !== 'undefined') {
|
|
141
|
-
await authtoken({
|
|
142
|
-
authtoken: token,
|
|
143
|
-
configPath: getConfigPath(),
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
export async function downloadBinary() {
|
|
148
|
-
const binaryLocations = [
|
|
149
|
-
join(basePath, 'ngrok'),
|
|
150
|
-
join(basePath, 'ngrok.exe'),
|
|
151
|
-
];
|
|
152
|
-
if (binaryLocations.some((path) => existsSync(path))) {
|
|
153
|
-
console.info('ngrok binary is already downloaded');
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
async function runDownload() {
|
|
157
|
-
await mkdirp(basePath);
|
|
158
|
-
try {
|
|
159
|
-
await new Promise((resolve, reject) => download((error) => (error ? reject(error) : resolve())));
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
console.error(`Can't update local tunnel configuration. The tests may not work correctly.`);
|
|
163
|
-
console.error(error);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
await runDownload();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
;
|
|
170
|
-
export class NgrokTunnelClient {
|
|
171
|
-
api = null;
|
|
172
|
-
constructor() {
|
|
173
|
-
this.api = getApi();
|
|
174
|
-
}
|
|
175
|
-
start = async (options) => {
|
|
176
|
-
return await start(options);
|
|
177
|
-
};
|
|
178
|
-
stop = async (tunnel) => {
|
|
179
|
-
await stop(tunnel);
|
|
180
|
-
};
|
|
181
|
-
getActiveTunnels = async (api) => {
|
|
182
|
-
return await getActiveTunnels(api);
|
|
183
|
-
};
|
|
184
|
-
getUrl = async (api) => {
|
|
185
|
-
const tunnels = await getActiveTunnels(api);
|
|
186
|
-
return tunnels.map((tunnel) => tunnel.public_url).join(', ');
|
|
187
|
-
};
|
|
188
|
-
getApi = async () => {
|
|
189
|
-
if (!this.api)
|
|
190
|
-
throw new Error('ngrok is not currently running.');
|
|
191
|
-
return this.api;
|
|
192
|
-
};
|
|
193
|
-
downloadBinary = async () => {
|
|
194
|
-
await downloadBinary();
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
// Export tunnel manager for high-level API
|
|
198
|
-
export { tunnelManager } from './tunnelManager.js';
|
package/dist/utils/axios.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
const axiosServices = axios.create({
|
|
3
|
-
baseURL: process.env.REACT_APP_API_URL || "http://localhost:81",
|
|
4
|
-
headers: {
|
|
5
|
-
"Content-Type": "application/json",
|
|
6
|
-
"Accept": "application/json",
|
|
7
|
-
"Authorization": "Token 6f960ed60c88b5af7d1d7ecfabeee53f5068dc4d",
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
// ==============================|| AXIOS - FOR MOCK SERVICES ||============================== //
|
|
11
|
-
axiosServices.interceptors.response.use((response) => {
|
|
12
|
-
//console.error(`Response data....${response.data}`)
|
|
13
|
-
if (response.data) {
|
|
14
|
-
// response.data = objToCamelCase(response.data);
|
|
15
|
-
// response.data = response.data;
|
|
16
|
-
}
|
|
17
|
-
return response;
|
|
18
|
-
}, (error) => {
|
|
19
|
-
// let host = window.location.host;
|
|
20
|
-
// let parts = host.split(".");
|
|
21
|
-
// let subdomain = parts[0];
|
|
22
|
-
// if (error.response.status === 401 && subdomain == 'app' && !window.location.href.includes('/login')) {
|
|
23
|
-
// window.location = '/login';
|
|
24
|
-
// }
|
|
25
|
-
if (error) {
|
|
26
|
-
// error = objToCamelCase(error);
|
|
27
|
-
}
|
|
28
|
-
return Promise.reject((error.response && error.response.data) || "Wrong Services");
|
|
29
|
-
});
|
|
30
|
-
axiosServices.interceptors.request.use(async (config) => {
|
|
31
|
-
// Update naming convention from CamelCase to the underscored type
|
|
32
|
-
return config;
|
|
33
|
-
}, (error) => error);
|
|
34
|
-
export default axiosServices;
|
|
35
|
-
export const { get, post, put, delete: destroy } = axiosServices;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { objToCamelCase, objToSnakeCase } from "./objectNaming.js";
|
|
2
|
-
import { destroy as destroyAxios, get as getAxios, post as postAxios, put as putAxios } from "./axios.js";
|
|
3
|
-
export async function get(url, params) {
|
|
4
|
-
const fmtdParams = objToSnakeCase(params);
|
|
5
|
-
return getAxios(url, fmtdParams).then((response) => {
|
|
6
|
-
console.error("response", response);
|
|
7
|
-
const fmtdData = objToCamelCase(response.data);
|
|
8
|
-
response.data = fmtdData;
|
|
9
|
-
return response;
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
export async function post(url, data, config) {
|
|
13
|
-
const fmtdData = objToSnakeCase(data);
|
|
14
|
-
return postAxios(url, fmtdData, config).then((response) => {
|
|
15
|
-
response.data = objToCamelCase(response.data);
|
|
16
|
-
return response;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export async function put(url, data, config) {
|
|
20
|
-
const fmtdData = objToSnakeCase(data);
|
|
21
|
-
return putAxios(url, fmtdData, config).then((response) => {
|
|
22
|
-
response.data = objToCamelCase(response.data);
|
|
23
|
-
return response;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
export async function destroy(url, config) {
|
|
27
|
-
return destroyAxios(url, config).then((response) => {
|
|
28
|
-
response.data = objToCamelCase(response.data);
|
|
29
|
-
return response;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|