fms-odata-mcp 0.1.2
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 +154 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +248 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +49 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +126 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +57 -0
- package/dist/logger.js.map +1 -0
- package/dist/odata-client.d.ts +102 -0
- package/dist/odata-client.d.ts.map +1 -0
- package/dist/odata-client.js +226 -0
- package/dist/odata-client.js.map +1 -0
- package/dist/odata-parser.d.ts +64 -0
- package/dist/odata-parser.d.ts.map +1 -0
- package/dist/odata-parser.js +126 -0
- package/dist/odata-parser.js.map +1 -0
- package/dist/tools/configuration.d.ts +69 -0
- package/dist/tools/configuration.d.ts.map +1 -0
- package/dist/tools/configuration.js +221 -0
- package/dist/tools/configuration.js.map +1 -0
- package/dist/tools/connection.d.ts +66 -0
- package/dist/tools/connection.d.ts.map +1 -0
- package/dist/tools/connection.js +230 -0
- package/dist/tools/connection.js.map +1 -0
- package/dist/tools/index.d.ts +319 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +48 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/odata.d.ts +233 -0
- package/dist/tools/odata.d.ts.map +1 -0
- package/dist/tools/odata.js +404 -0
- package/dist/tools/odata.js.map +1 -0
- package/dist/transport.d.ts +18 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +138 -0
- package/dist/transport.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { ODataClient } from "./odata-client.js";
|
|
2
|
+
import { getDefaultConnection, getConnection } from "./config.js";
|
|
3
|
+
import { logger } from "./logger.js";
|
|
4
|
+
/**
|
|
5
|
+
* Connection Manager for OData clients
|
|
6
|
+
* Manages multiple OData client instances for different connections
|
|
7
|
+
*/
|
|
8
|
+
export class ConnectionManager {
|
|
9
|
+
clients;
|
|
10
|
+
currentConnectionName;
|
|
11
|
+
constructor() {
|
|
12
|
+
this.clients = new Map();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create an OData client from a connection configuration
|
|
16
|
+
*/
|
|
17
|
+
createClient(connection, verifySsl, timeout) {
|
|
18
|
+
const config = {
|
|
19
|
+
server: connection.server,
|
|
20
|
+
database: connection.database,
|
|
21
|
+
user: connection.user,
|
|
22
|
+
password: connection.password,
|
|
23
|
+
verifySsl: verifySsl,
|
|
24
|
+
timeout: timeout,
|
|
25
|
+
};
|
|
26
|
+
return new ODataClient(config);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get or create a client for a connection
|
|
30
|
+
*/
|
|
31
|
+
getClient(connectionName, verifySsl, timeout) {
|
|
32
|
+
// Check if we already have a client for this connection
|
|
33
|
+
if (this.clients.has(connectionName)) {
|
|
34
|
+
return this.clients.get(connectionName);
|
|
35
|
+
}
|
|
36
|
+
// Get connection from config
|
|
37
|
+
const connection = getConnection(connectionName);
|
|
38
|
+
if (!connection) {
|
|
39
|
+
throw new Error(`Connection "${connectionName}" not found`);
|
|
40
|
+
}
|
|
41
|
+
// Create and cache the client
|
|
42
|
+
const client = this.createClient(connection, verifySsl, timeout);
|
|
43
|
+
this.clients.set(connectionName, client);
|
|
44
|
+
this.currentConnectionName = connectionName;
|
|
45
|
+
logger.debug(`Created OData client for connection: ${connectionName}`);
|
|
46
|
+
return client;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a client with inline credentials (temporary, not saved)
|
|
50
|
+
*/
|
|
51
|
+
createInlineClient(connection, verifySsl, timeout) {
|
|
52
|
+
const client = this.createClient(connection, verifySsl, timeout);
|
|
53
|
+
// Store with a unique temporary name
|
|
54
|
+
const tempName = `inline_${Date.now()}`;
|
|
55
|
+
this.clients.set(tempName, client);
|
|
56
|
+
this.currentConnectionName = tempName;
|
|
57
|
+
logger.debug(`Created inline OData client`);
|
|
58
|
+
return client;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the current active client
|
|
62
|
+
*/
|
|
63
|
+
getCurrentClient() {
|
|
64
|
+
if (!this.currentConnectionName) {
|
|
65
|
+
// Try to use default connection
|
|
66
|
+
const defaultConn = getDefaultConnection();
|
|
67
|
+
if (defaultConn && defaultConn.name) {
|
|
68
|
+
return this.getClient(defaultConn.name);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return this.clients.get(this.currentConnectionName) || null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get current connection name
|
|
76
|
+
*/
|
|
77
|
+
getCurrentConnectionName() {
|
|
78
|
+
return this.currentConnectionName;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Set the current connection
|
|
82
|
+
*/
|
|
83
|
+
setCurrentConnection(connectionName, verifySsl, timeout) {
|
|
84
|
+
const connection = getConnection(connectionName);
|
|
85
|
+
if (!connection) {
|
|
86
|
+
throw new Error(`Connection "${connectionName}" not found`);
|
|
87
|
+
}
|
|
88
|
+
this.getClient(connectionName, verifySsl, timeout);
|
|
89
|
+
this.currentConnectionName = connectionName;
|
|
90
|
+
logger.info(`Switched to connection: ${connectionName}`);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Test a connection
|
|
94
|
+
*/
|
|
95
|
+
async testConnection(connectionName) {
|
|
96
|
+
try {
|
|
97
|
+
const client = this.getClient(connectionName);
|
|
98
|
+
return await client.testConnection();
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
logger.error(`Connection test failed for ${connectionName}:`, error);
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Clear all cached clients
|
|
107
|
+
*/
|
|
108
|
+
clearClients() {
|
|
109
|
+
this.clients.clear();
|
|
110
|
+
this.currentConnectionName = undefined;
|
|
111
|
+
logger.debug("Cleared all cached OData clients");
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Remove a specific client from cache
|
|
115
|
+
*/
|
|
116
|
+
removeClient(connectionName) {
|
|
117
|
+
this.clients.delete(connectionName);
|
|
118
|
+
if (this.currentConnectionName === connectionName) {
|
|
119
|
+
this.currentConnectionName = undefined;
|
|
120
|
+
}
|
|
121
|
+
logger.debug(`Removed OData client: ${connectionName}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Export singleton instance
|
|
125
|
+
export const connectionManager = new ConnectionManager();
|
|
126
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAc,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,OAAO,CAA2B;IAClC,qBAAqB,CAAU;IAEvC;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,UAAsB,EAAE,SAAmB,EAAE,OAAgB;QAChF,MAAM,MAAM,GAAsB;YAChC,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,QAAQ,EAAE,UAAU,CAAC,QAA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,cAAc,GAAG,EAAE,KAAK,CAAC,CAAC;YACrE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,cAAsB;QACjC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,qBAAqB,KAAK,cAAc,EAAE,CAAC;YAClD,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;QACzC,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,cAAc,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* FMS-ODATA-MCP Server
|
|
4
|
+
* MCP server for FileMaker Server OData 4.01 API
|
|
5
|
+
*/
|
|
6
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
7
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { setupTransport, getTransportConfig } from "./transport.js";
|
|
9
|
+
import { getConfig } from "./config.js";
|
|
10
|
+
import { logger } from "./logger.js";
|
|
11
|
+
import { allTools, handleToolCall } from "./tools/index.js";
|
|
12
|
+
/**
|
|
13
|
+
* Main server class
|
|
14
|
+
*/
|
|
15
|
+
class FileMakerODataServer {
|
|
16
|
+
server;
|
|
17
|
+
constructor() {
|
|
18
|
+
this.server = new Server({
|
|
19
|
+
name: "fms-odata-mcp",
|
|
20
|
+
version: "0.1.0",
|
|
21
|
+
}, {
|
|
22
|
+
capabilities: {
|
|
23
|
+
tools: {},
|
|
24
|
+
resources: {},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
this.setupErrorHandling();
|
|
28
|
+
this.setupToolHandlers();
|
|
29
|
+
}
|
|
30
|
+
setupErrorHandling() {
|
|
31
|
+
this.server.onerror = (error) => {
|
|
32
|
+
logger.error("[MCP Error]", error);
|
|
33
|
+
};
|
|
34
|
+
process.on("SIGINT", async () => {
|
|
35
|
+
logger.info("Shutting down server...");
|
|
36
|
+
await this.server.close();
|
|
37
|
+
process.exit(0);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
setupToolHandlers() {
|
|
41
|
+
// List available tools
|
|
42
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
43
|
+
logger.debug("Listing tools");
|
|
44
|
+
return {
|
|
45
|
+
tools: allTools,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
// Handle tool calls
|
|
49
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
50
|
+
logger.debug(`Tool called: ${request.params.name}`);
|
|
51
|
+
try {
|
|
52
|
+
const result = await handleToolCall(request.params.name, request.params.arguments);
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
logger.error(`Tool execution error:`, error);
|
|
57
|
+
return {
|
|
58
|
+
content: [
|
|
59
|
+
{
|
|
60
|
+
type: "text",
|
|
61
|
+
text: `Error executing tool: ${error.message}`,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
isError: true,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
logger.info(`Registered ${allTools.length} tools`);
|
|
69
|
+
}
|
|
70
|
+
async run() {
|
|
71
|
+
try {
|
|
72
|
+
const config = getConfig();
|
|
73
|
+
const transportConfig = getTransportConfig();
|
|
74
|
+
logger.info("Starting FMS-ODATA-MCP Server...");
|
|
75
|
+
logger.info(`Transport: ${transportConfig.type}`);
|
|
76
|
+
await setupTransport(this.server, transportConfig);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
logger.error("Failed to start server:", error);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Start the server
|
|
85
|
+
const server = new FileMakerODataServer();
|
|
86
|
+
server.run().catch((error) => {
|
|
87
|
+
logger.error("Fatal error:", error);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;GAEG;AACH,MAAM,oBAAoB;IAChB,MAAM,CAAS;IAEvB;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CACtB;YACE,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,OAAO;SACjB,EACD;YACE,YAAY,EAAE;gBACZ,KAAK,EAAE,EAAE;gBACT,SAAS,EAAE,EAAE;aACd;SACF,CACF,CAAC;QAEF,IAAI,CAAC,k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AM;4BACZ,IAAI,EAAE,yBAAyB,KAAK,CAAC,OAAO,EAAE;yBAC/C;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,cAAc,QAAQ,CAAC,MAAM,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;YAE7C,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YAChD,MAAM,CAAC,IAAI,CAAC,cAAc,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;YAElD,MAAM,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAED,mBAAmB;AACnB,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3B,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger utility for FMS-ODATA-MCP
|
|
3
|
+
*/
|
|
4
|
+
export declare class Logger {
|
|
5
|
+
private logFile;
|
|
6
|
+
private fileLoggingEnabled;
|
|
7
|
+
constructor();
|
|
8
|
+
private ensureLogDirectory;
|
|
9
|
+
private writeToFile;
|
|
10
|
+
info(message: string, ...args: any[]): void;
|
|
11
|
+
error(message: string, ...args: any[]): void;
|
|
12
|
+
debug(message: string, ...args: any[]): void;
|
|
13
|
+
}
|
|
14
|
+
export declare const logger: Logger;
|
|
15
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAU;;IAgBpC,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,WAAW;IAYnB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAK3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAI7C;AAGD,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import debug from "debug";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { getConfigDir } from "./config.js";
|
|
5
|
+
// Create debug instances
|
|
6
|
+
const debugInfo = debug("fms-odata-mcp:info");
|
|
7
|
+
const debugError = debug("fms-odata-mcp:error");
|
|
8
|
+
const debugDebug = debug("fms-odata-mcp:debug");
|
|
9
|
+
/**
|
|
10
|
+
* Logger utility for FMS-ODATA-MCP
|
|
11
|
+
*/
|
|
12
|
+
export class Logger {
|
|
13
|
+
logFile;
|
|
14
|
+
fileLoggingEnabled;
|
|
15
|
+
constructor() {
|
|
16
|
+
this.fileLoggingEnabled = process.env.MCP_LOG_FILE === "true";
|
|
17
|
+
this.logFile = path.join(getConfigDir(), "..", "fms-odata-mcp", "logs", "server.log");
|
|
18
|
+
if (this.fileLoggingEnabled) {
|
|
19
|
+
this.ensureLogDirectory();
|
|
20
|
+
}
|
|
21
|
+
// Enable all debug namespaces if DEBUG env var is set
|
|
22
|
+
if (process.env.DEBUG) {
|
|
23
|
+
debug.enable(process.env.DEBUG);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
ensureLogDirectory() {
|
|
27
|
+
const logDir = path.dirname(this.logFile);
|
|
28
|
+
if (!fs.existsSync(logDir)) {
|
|
29
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
writeToFile(level, message, ...args) {
|
|
33
|
+
if (!this.fileLoggingEnabled)
|
|
34
|
+
return;
|
|
35
|
+
const timestamp = new Date().toISOString();
|
|
36
|
+
const formattedArgs = args.map((arg) => typeof arg === "object" ? JSON.stringify(arg, null, 2) : String(arg));
|
|
37
|
+
const logEntry = `[${timestamp}] [${level}] ${message} ${formattedArgs.join(" ")}\n`;
|
|
38
|
+
fs.appendFileSync(this.logFile, logEntry);
|
|
39
|
+
}
|
|
40
|
+
info(message, ...args) {
|
|
41
|
+
debugInfo(message, ...args);
|
|
42
|
+
this.writeToFile("INFO", message, ...args);
|
|
43
|
+
}
|
|
44
|
+
error(message, ...args) {
|
|
45
|
+
debugError(message, ...args);
|
|
46
|
+
this.writeToFile("ERROR", message, ...args);
|
|
47
|
+
// Also log to stderr for visibility
|
|
48
|
+
console.error(`[ERROR] ${message}`, ...args);
|
|
49
|
+
}
|
|
50
|
+
debug(message, ...args) {
|
|
51
|
+
debugDebug(message, ...args);
|
|
52
|
+
this.writeToFile("DEBUG", message, ...args);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Export singleton instance
|
|
56
|
+
export const logger = new Logger();
|
|
57
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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E,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export interface ODataClientConfig {
|
|
2
|
+
server: string;
|
|
3
|
+
database: string;
|
|
4
|
+
user: string;
|
|
5
|
+
password: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
verifySsl?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ODataQueryOptions {
|
|
10
|
+
filter?: string;
|
|
11
|
+
select?: string;
|
|
12
|
+
orderby?: string;
|
|
13
|
+
top?: number;
|
|
14
|
+
skip?: number;
|
|
15
|
+
expand?: string;
|
|
16
|
+
count?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ODataResponse<T = any> {
|
|
19
|
+
"@odata.context": string;
|
|
20
|
+
"@odata.count"?: number;
|
|
21
|
+
value: T[];
|
|
22
|
+
}
|
|
23
|
+
export interface ODataError {
|
|
24
|
+
error: {
|
|
25
|
+
code: string;
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* OData Client for FileMaker Server
|
|
31
|
+
* Implements Basic Authentication and OData 4.01 operations
|
|
32
|
+
*/
|
|
33
|
+
export declare class ODataClient {
|
|
34
|
+
private axiosInstance;
|
|
35
|
+
private config;
|
|
36
|
+
private baseUrl;
|
|
37
|
+
constructor(config: ODataClientConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Generate Basic Auth header
|
|
40
|
+
*/
|
|
41
|
+
private getAuthHeader;
|
|
42
|
+
/**
|
|
43
|
+
* Handle and format errors
|
|
44
|
+
*/
|
|
45
|
+
private handleError;
|
|
46
|
+
/**
|
|
47
|
+
* Build OData URL with query options
|
|
48
|
+
*/
|
|
49
|
+
private buildUrl;
|
|
50
|
+
/**
|
|
51
|
+
* Get service document
|
|
52
|
+
*/
|
|
53
|
+
getServiceDocument(): Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Get metadata document
|
|
56
|
+
*/
|
|
57
|
+
getMetadata(): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Query records from a table
|
|
60
|
+
*/
|
|
61
|
+
queryRecords<T = any>(table: string, options?: ODataQueryOptions): Promise<ODataResponse<T>>;
|
|
62
|
+
/**
|
|
63
|
+
* Get a single record by ID
|
|
64
|
+
*/
|
|
65
|
+
getRecord<T = any>(table: string, recordId: string, options?: Pick<ODataQueryOptions, "select" | "expand">): Promise<T>;
|
|
66
|
+
/**
|
|
67
|
+
* Create a new record
|
|
68
|
+
*/
|
|
69
|
+
createRecord<T = any>(table: string, data: Partial<T>): Promise<T>;
|
|
70
|
+
/**
|
|
71
|
+
* Update an existing record
|
|
72
|
+
*/
|
|
73
|
+
updateRecord<T = any>(table: string, recordId: string, data: Partial<T>): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Delete a record
|
|
76
|
+
*/
|
|
77
|
+
deleteRecord(table: string, recordId: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Count records
|
|
80
|
+
*/
|
|
81
|
+
countRecords(table: string, filter?: string): Promise<number>;
|
|
82
|
+
/**
|
|
83
|
+
* Execute batch operations
|
|
84
|
+
*/
|
|
85
|
+
batch(operations: BatchOperation[]): Promise<BatchResponse[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Test connection
|
|
88
|
+
*/
|
|
89
|
+
testConnection(): Promise<boolean>;
|
|
90
|
+
}
|
|
91
|
+
export interface BatchOperation {
|
|
92
|
+
method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
93
|
+
url: string;
|
|
94
|
+
data?: any;
|
|
95
|
+
}
|
|
96
|
+
export interface BatchResponse {
|
|
97
|
+
success: boolean;
|
|
98
|
+
status: number;
|
|
99
|
+
data?: any;
|
|
100
|
+
error?: string;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=odata-client.d.ts.map
|
|
@@ -0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M,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import https from "https";
|
|
3
|
+
import { logger } from "./logger.js";
|
|
4
|
+
/**
|
|
5
|
+
* OData Client for FileMaker Server
|
|
6
|
+
* Implements Basic Authentication and OData 4.01 operations
|
|
7
|
+
*/
|
|
8
|
+
export class ODataClient {
|
|
9
|
+
axiosInstance;
|
|
10
|
+
config;
|
|
11
|
+
baseUrl;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.baseUrl = `${config.server}/fmi/odata/v4/${config.database}`;
|
|
15
|
+
this.axiosInstance = axios.create({
|
|
16
|
+
timeout: config.timeout || 30000,
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
"Accept": "application/json",
|
|
20
|
+
},
|
|
21
|
+
// Configure SSL certificate verification
|
|
22
|
+
// verifySsl defaults to true for production security
|
|
23
|
+
// Set to false for self-signed certificates (development/local networks)
|
|
24
|
+
httpsAgent: new https.Agent({
|
|
25
|
+
rejectUnauthorized: config.verifySsl !== false, // true by default
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
// Add request interceptor for Basic Auth
|
|
29
|
+
this.axiosInstance.interceptors.request.use((config) => {
|
|
30
|
+
config.headers.Authorization = this.getAuthHeader();
|
|
31
|
+
return config;
|
|
32
|
+
}, (error) => {
|
|
33
|
+
logger.error("Request interceptor error:", error);
|
|
34
|
+
return Promise.reject(error);
|
|
35
|
+
});
|
|
36
|
+
// Add response interceptor for error handling
|
|
37
|
+
this.axiosInstance.interceptors.response.use((response) => response, (error) => {
|
|
38
|
+
logger.error("Response error:", error.response?.data || error.message);
|
|
39
|
+
return Promise.reject(this.handleError(error));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Generate Basic Auth header
|
|
44
|
+
*/
|
|
45
|
+
getAuthHeader() {
|
|
46
|
+
const credentials = Buffer.from(`${this.config.user}:${this.config.password}`).toString("base64");
|
|
47
|
+
return `Basic ${credentials}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Handle and format errors
|
|
51
|
+
*/
|
|
52
|
+
handleError(error) {
|
|
53
|
+
if (error.response) {
|
|
54
|
+
const odataError = error.response.data;
|
|
55
|
+
if (odataError?.error) {
|
|
56
|
+
return new Error(`OData Error [${odataError.error.code}]: ${odataError.error.message}`);
|
|
57
|
+
}
|
|
58
|
+
return new Error(`HTTP ${error.response.status}: ${error.response.statusText}`);
|
|
59
|
+
}
|
|
60
|
+
if (error.request) {
|
|
61
|
+
return new Error("No response from server - connection failed");
|
|
62
|
+
}
|
|
63
|
+
return error;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build OData URL with query options
|
|
67
|
+
*/
|
|
68
|
+
buildUrl(table, options, recordId) {
|
|
69
|
+
let url = `${this.baseUrl}/${table}`;
|
|
70
|
+
if (recordId) {
|
|
71
|
+
url += `('${recordId}')`;
|
|
72
|
+
}
|
|
73
|
+
if (options) {
|
|
74
|
+
const params = new URLSearchParams();
|
|
75
|
+
if (options.filter)
|
|
76
|
+
params.append("$filter", options.filter);
|
|
77
|
+
if (options.select)
|
|
78
|
+
params.append("$select", options.select);
|
|
79
|
+
if (options.orderby)
|
|
80
|
+
params.append("$orderby", options.orderby);
|
|
81
|
+
if (options.top !== undefined)
|
|
82
|
+
params.append("$top", options.top.toString());
|
|
83
|
+
if (options.skip !== undefined)
|
|
84
|
+
params.append("$skip", options.skip.toString());
|
|
85
|
+
if (options.expand)
|
|
86
|
+
params.append("$expand", options.expand);
|
|
87
|
+
if (options.count)
|
|
88
|
+
params.append("$count", "true");
|
|
89
|
+
const queryString = params.toString();
|
|
90
|
+
if (queryString) {
|
|
91
|
+
url += `?${queryString}`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return url;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get service document
|
|
98
|
+
*/
|
|
99
|
+
async getServiceDocument() {
|
|
100
|
+
logger.debug(`Getting service document from ${this.baseUrl}`);
|
|
101
|
+
const response = await this.axiosInstance.get(this.baseUrl);
|
|
102
|
+
return response.data;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get metadata document
|
|
106
|
+
*/
|
|
107
|
+
async getMetadata() {
|
|
108
|
+
logger.debug(`Getting metadata from ${this.baseUrl}/$metadata`);
|
|
109
|
+
const response = await this.axiosInstance.get(`${this.baseUrl}/$metadata`, {
|
|
110
|
+
headers: {
|
|
111
|
+
Accept: "application/xml",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
return response.data;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Query records from a table
|
|
118
|
+
*/
|
|
119
|
+
async queryRecords(table, options) {
|
|
120
|
+
const url = this.buildUrl(table, options);
|
|
121
|
+
logger.debug(`Querying records: ${url}`);
|
|
122
|
+
const response = await this.axiosInstance.get(url);
|
|
123
|
+
return response.data;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get a single record by ID
|
|
127
|
+
*/
|
|
128
|
+
async getRecord(table, recordId, options) {
|
|
129
|
+
const url = this.buildUrl(table, options, recordId);
|
|
130
|
+
logger.debug(`Getting record: ${url}`);
|
|
131
|
+
const response = await this.axiosInstance.get(url);
|
|
132
|
+
return response.data;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a new record
|
|
136
|
+
*/
|
|
137
|
+
async createRecord(table, data) {
|
|
138
|
+
const url = `${this.baseUrl}/${table}`;
|
|
139
|
+
logger.debug(`Creating record in ${table}`);
|
|
140
|
+
const response = await this.axiosInstance.post(url, data);
|
|
141
|
+
return response.data;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Update an existing record
|
|
145
|
+
*/
|
|
146
|
+
async updateRecord(table, recordId, data) {
|
|
147
|
+
const url = `${this.baseUrl}/${table}('${recordId}')`;
|
|
148
|
+
logger.debug(`Updating record: ${url}`);
|
|
149
|
+
await this.axiosInstance.patch(url, data);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Delete a record
|
|
153
|
+
*/
|
|
154
|
+
async deleteRecord(table, recordId) {
|
|
155
|
+
const url = `${this.baseUrl}/${table}('${recordId}')`;
|
|
156
|
+
logger.debug(`Deleting record: ${url}`);
|
|
157
|
+
await this.axiosInstance.delete(url);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Count records
|
|
161
|
+
*/
|
|
162
|
+
async countRecords(table, filter) {
|
|
163
|
+
const url = `${this.baseUrl}/${table}/$count`;
|
|
164
|
+
const params = filter ? { $filter: filter } : undefined;
|
|
165
|
+
logger.debug(`Counting records in ${table}`);
|
|
166
|
+
const response = await this.axiosInstance.get(url, { params });
|
|
167
|
+
return response.data;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Execute batch operations
|
|
171
|
+
*/
|
|
172
|
+
async batch(operations) {
|
|
173
|
+
// OData batch implementation
|
|
174
|
+
// This is a simplified version - full batch requires multipart/mixed format
|
|
175
|
+
logger.debug(`Executing batch with ${operations.length} operations`);
|
|
176
|
+
const results = [];
|
|
177
|
+
for (const op of operations) {
|
|
178
|
+
try {
|
|
179
|
+
let result;
|
|
180
|
+
switch (op.method) {
|
|
181
|
+
case "GET":
|
|
182
|
+
result = await this.axiosInstance.get(op.url);
|
|
183
|
+
break;
|
|
184
|
+
case "POST":
|
|
185
|
+
result = await this.axiosInstance.post(op.url, op.data);
|
|
186
|
+
break;
|
|
187
|
+
case "PATCH":
|
|
188
|
+
result = await this.axiosInstance.patch(op.url, op.data);
|
|
189
|
+
break;
|
|
190
|
+
case "DELETE":
|
|
191
|
+
result = await this.axiosInstance.delete(op.url);
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
throw new Error(`Unsupported method: ${op.method}`);
|
|
195
|
+
}
|
|
196
|
+
results.push({
|
|
197
|
+
success: true,
|
|
198
|
+
status: result.status,
|
|
199
|
+
data: result.data,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
results.push({
|
|
204
|
+
success: false,
|
|
205
|
+
status: error.response?.status || 500,
|
|
206
|
+
error: error.message,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return results;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Test connection
|
|
214
|
+
*/
|
|
215
|
+
async testConnection() {
|
|
216
|
+
try {
|
|
217
|
+
await this.getServiceDocument();
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
logger.error("Connection test failed:", error);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=odata-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odata-client.js","sourceRoot":"","sources":["../src/odata-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkCrC;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,aAAa,CAAgB;IAC7B,MAAM,CAAoB;IAC1B,OAAO,CAAS;IAExB,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,MAAM,CAAC,MAAM,iBAAiB,MAAM,CAAC,QAAQ,EAAE,CAAC;QAElE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,MAAM,CAA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