@databridgeai/connector 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -0
- package/dist/agent.d.ts +33 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +152 -0
- package/dist/agent.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @databridgeai/connector
|
|
2
|
+
|
|
3
|
+
**Connect your Node.js backend to DataBridge AI for natural language database queries.**
|
|
4
|
+
|
|
5
|
+
Your users ask questions in plain English. DataBridge AI translates them into safe, tenant-isolated database queries — and your backend executes them locally. Your data never leaves your infrastructure.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @databridgeai/connector
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { initExecutorAgent } from '@databridgeai/connector';
|
|
15
|
+
import { Pool } from 'pg';
|
|
16
|
+
|
|
17
|
+
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
18
|
+
|
|
19
|
+
const agent = await initExecutorAgent({
|
|
20
|
+
apiKey: process.env.DATABRIDGE_API_KEY!,
|
|
21
|
+
runtimeUrl: 'https://your-databridge-server.vercel.app',
|
|
22
|
+
db: pool,
|
|
23
|
+
exposeTables: ['users', 'orders', 'products'],
|
|
24
|
+
tenantField: 'organization_id',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Start the agent (introspects schema, registers with server)
|
|
28
|
+
await agent.init();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Express Middleware
|
|
32
|
+
|
|
33
|
+
Drop a chat endpoint into any Express app:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import express from 'express';
|
|
37
|
+
|
|
38
|
+
const app = express();
|
|
39
|
+
app.use(express.json());
|
|
40
|
+
|
|
41
|
+
// One line to add AI-powered database chat
|
|
42
|
+
app.post('/api/ai/chat', agent.middleware());
|
|
43
|
+
|
|
44
|
+
app.listen(4000);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Direct Query API
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const result = await agent.query(
|
|
51
|
+
'Show me all premium customers who joined this year',
|
|
52
|
+
{ userId: 'user_123', orgId: 'acme_corp', role: 'admin' }
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
console.log(result.message); // "Here are 42 premium customers..."
|
|
56
|
+
console.log(result.data.rows); // Actual database rows
|
|
57
|
+
console.log(result.visualization); // Optional chart config
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## How It Works
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Your React App → Your Node Backend → DataBridge Server → OpenAI
|
|
64
|
+
↓ ↓
|
|
65
|
+
Executes query Generates safe
|
|
66
|
+
on YOUR database QueryDSL + NL response
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
1. **Your backend** sends the user's question to DataBridge Server
|
|
70
|
+
2. **DataBridge Server** uses GPT-4o to generate a safe, validated QueryDSL
|
|
71
|
+
3. **Your backend** executes the query on your own database (data stays local)
|
|
72
|
+
4. **DataBridge Server** composes a natural language response from the results
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- **Multi-tenant isolation**: Automatic `WHERE organization_id = ?` filtering
|
|
77
|
+
- **Schema-aware**: Auto-introspects your Postgres/MongoDB schema
|
|
78
|
+
- **Safe queries**: All queries validated against schema, no raw SQL injection
|
|
79
|
+
- **Local execution**: Your database credentials never leave your backend
|
|
80
|
+
- **Chart visualizations**: Automatic chart suggestions for aggregate data
|
|
81
|
+
- **Image detection**: Renders image URLs inline in results
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
const agent = await initExecutorAgent({
|
|
87
|
+
// Required
|
|
88
|
+
apiKey: string; // Your DataBridge API key
|
|
89
|
+
db: Pool | Db; // Postgres Pool or MongoDB Db instance
|
|
90
|
+
exposeTables: string[]; // Tables to expose to AI
|
|
91
|
+
|
|
92
|
+
// Optional
|
|
93
|
+
runtimeUrl?: string; // DataBridge server URL (default: http://localhost:3100)
|
|
94
|
+
tenantField?: string; // Column used for tenant isolation (e.g., 'org_id')
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Supported Databases
|
|
99
|
+
|
|
100
|
+
| Database | Driver | Minimum Version |
|
|
101
|
+
|----------|--------|----------------|
|
|
102
|
+
| PostgreSQL | `pg` | 8.x+ |
|
|
103
|
+
| MongoDB | `mongodb` | 6.x+ |
|
|
104
|
+
|
|
105
|
+
## Security
|
|
106
|
+
|
|
107
|
+
- Database credentials **never leave your backend**
|
|
108
|
+
- All queries validated against your schema before execution
|
|
109
|
+
- Tenant field ensures row-level isolation per organization
|
|
110
|
+
- API key authentication for all server communication
|
|
111
|
+
|
|
112
|
+
## Related Packages
|
|
113
|
+
|
|
114
|
+
| Package | Purpose |
|
|
115
|
+
|---------|---------|
|
|
116
|
+
| `@databridgeai/react` | Drop-in React chat widget |
|
|
117
|
+
| `@databridgeai/toolkit` | Schema introspection & utilities |
|
|
118
|
+
| `@databridgeai/core` | Shared types & validators |
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Pool } from "pg";
|
|
2
|
+
import { Db } from "mongodb";
|
|
3
|
+
import { ChatResponse, UserContext } from "@databridgeai/core";
|
|
4
|
+
export interface ExecutorAgentConfig {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
db: Pool | Db;
|
|
7
|
+
exposeTables: string[];
|
|
8
|
+
tenantField?: string;
|
|
9
|
+
runtimeUrl?: string;
|
|
10
|
+
composeResponse?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class ExecutorAgentClient {
|
|
13
|
+
private config;
|
|
14
|
+
private runtimeUrl;
|
|
15
|
+
private schema;
|
|
16
|
+
private initialized;
|
|
17
|
+
constructor(config: ExecutorAgentConfig);
|
|
18
|
+
init(): Promise<void>;
|
|
19
|
+
chat(message: string, userContext: UserContext): Promise<ChatResponse>;
|
|
20
|
+
middleware(): (req: any, res: any) => Promise<void>;
|
|
21
|
+
playgroundUI(options?: {
|
|
22
|
+
chatEndpoint?: string;
|
|
23
|
+
defaultUserId?: string;
|
|
24
|
+
defaultOrgId?: string;
|
|
25
|
+
defaultRole?: string;
|
|
26
|
+
projectName?: string;
|
|
27
|
+
}): (_req: any, res: any) => void;
|
|
28
|
+
private executeLocal;
|
|
29
|
+
private getDbType;
|
|
30
|
+
private introspectSchema;
|
|
31
|
+
}
|
|
32
|
+
export declare function initExecutorAgent(config: ExecutorAgentConfig): Promise<ExecutorAgentClient>;
|
|
33
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,YAAY,EAMZ,WAAW,EAEZ,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,mBAAmB;IAKjC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBrB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAgE5E,UAAU,KACM,KAAK,GAAG,EAAE,KAAK,GAAG;IAyBlC,YAAY,CAAC,OAAO,CAAC,EAAE;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,IASS,MAAM,GAAG,EAAE,KAAK,GAAG;YAcf,YAAY;IAU1B,OAAO,CAAC,SAAS;YAYH,gBAAgB;CAO/B;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAI9B"}
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecutorAgentClient = void 0;
|
|
4
|
+
exports.initExecutorAgent = initExecutorAgent;
|
|
5
|
+
const pg_1 = require("pg");
|
|
6
|
+
const core_1 = require("@databridgeai/core");
|
|
7
|
+
const toolkit_1 = require("@databridgeai/toolkit");
|
|
8
|
+
class ExecutorAgentClient {
|
|
9
|
+
config;
|
|
10
|
+
runtimeUrl;
|
|
11
|
+
schema = null;
|
|
12
|
+
initialized = false;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.runtimeUrl = config.runtimeUrl || "http://localhost:3100";
|
|
16
|
+
}
|
|
17
|
+
async init() {
|
|
18
|
+
this.schema = await this.introspectSchema();
|
|
19
|
+
const response = await fetch(`${this.runtimeUrl}/register-project`, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: { "Content-Type": "application/json" },
|
|
22
|
+
body: JSON.stringify({
|
|
23
|
+
apiKey: this.config.apiKey,
|
|
24
|
+
dbType: this.getDbType(),
|
|
25
|
+
schema: this.schema,
|
|
26
|
+
tenantField: this.config.tenantField,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
const err = await response.json().catch(() => ({}));
|
|
31
|
+
throw new Error(`Failed to register with runtime: ${response.status} ${JSON.stringify(err)}`);
|
|
32
|
+
}
|
|
33
|
+
this.initialized = true;
|
|
34
|
+
}
|
|
35
|
+
async chat(message, userContext) {
|
|
36
|
+
if (!this.initialized || !this.schema) {
|
|
37
|
+
throw new Error("Executor agent not initialized. Call init() before chat().");
|
|
38
|
+
}
|
|
39
|
+
const dslResponse = await fetch(`${this.runtimeUrl}/generate-query`, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
44
|
+
},
|
|
45
|
+
body: JSON.stringify({
|
|
46
|
+
message,
|
|
47
|
+
userContext,
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
if (!dslResponse.ok) {
|
|
51
|
+
const err = await dslResponse.json().catch(() => ({}));
|
|
52
|
+
throw new Error(`Generate query failed: ${dslResponse.status} ${JSON.stringify(err)}`);
|
|
53
|
+
}
|
|
54
|
+
const dslPayload = (await dslResponse.json());
|
|
55
|
+
const query = dslPayload.query;
|
|
56
|
+
const queryResult = await this.executeLocal(query);
|
|
57
|
+
const data = (0, core_1.formatResultForResponse)(queryResult);
|
|
58
|
+
let responseMessage = `Found ${queryResult.rowCount} result(s).`;
|
|
59
|
+
let visualization = null;
|
|
60
|
+
if (this.config.composeResponse !== false) {
|
|
61
|
+
const composeResponse = await fetch(`${this.runtimeUrl}/compose-response`, {
|
|
62
|
+
method: "POST",
|
|
63
|
+
headers: {
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
message,
|
|
69
|
+
query,
|
|
70
|
+
queryResult,
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
if (composeResponse.ok) {
|
|
74
|
+
const composed = (await composeResponse.json());
|
|
75
|
+
responseMessage = composed.message || responseMessage;
|
|
76
|
+
visualization = composed.visualization || null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
message: responseMessage,
|
|
81
|
+
data,
|
|
82
|
+
visualization,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
middleware() {
|
|
86
|
+
return async (req, res) => {
|
|
87
|
+
try {
|
|
88
|
+
const { message, userContext } = req.body;
|
|
89
|
+
if (!message) {
|
|
90
|
+
res.status(400).json({ error: "Missing 'message' in request body." });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!userContext?.orgId) {
|
|
94
|
+
res
|
|
95
|
+
.status(400)
|
|
96
|
+
.json({ error: "Missing 'userContext.orgId' in request body." });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const result = await this.chat(message, userContext);
|
|
100
|
+
res.json(result);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.error("[databridgeai/connector] Middleware error:", err);
|
|
104
|
+
res.status(500).json({ error: err.message });
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
playgroundUI(options) {
|
|
109
|
+
const { chatEndpoint = "/ai/chat", defaultUserId = "user_1", defaultOrgId = "org_acme", defaultRole = "admin", projectName = "AI Agent", } = options || {};
|
|
110
|
+
return (_req, res) => {
|
|
111
|
+
res.setHeader("Content-Type", "text/html");
|
|
112
|
+
res.send((0, toolkit_1.getPlaygroundHTML)({
|
|
113
|
+
chatEndpoint,
|
|
114
|
+
defaultUserId,
|
|
115
|
+
defaultOrgId,
|
|
116
|
+
defaultRole,
|
|
117
|
+
projectName,
|
|
118
|
+
}));
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
async executeLocal(query) {
|
|
122
|
+
if (this.getDbType() === "postgres") {
|
|
123
|
+
const adapter = new core_1.PostgresAdapter(this.config.db);
|
|
124
|
+
return adapter.execute(query);
|
|
125
|
+
}
|
|
126
|
+
const adapter = new core_1.MongoAdapter(this.config.db);
|
|
127
|
+
return adapter.execute(query);
|
|
128
|
+
}
|
|
129
|
+
getDbType() {
|
|
130
|
+
if (this.config.db instanceof pg_1.Pool)
|
|
131
|
+
return "postgres";
|
|
132
|
+
if (this.config.db &&
|
|
133
|
+
typeof this.config.db.collection === "function" &&
|
|
134
|
+
typeof this.config.db.databaseName === "string") {
|
|
135
|
+
return "mongo";
|
|
136
|
+
}
|
|
137
|
+
throw new Error("Unable to detect database type from provided db instance.");
|
|
138
|
+
}
|
|
139
|
+
async introspectSchema() {
|
|
140
|
+
if (this.getDbType() === "postgres") {
|
|
141
|
+
return (0, toolkit_1.introspectPostgres)(this.config.db, this.config.exposeTables);
|
|
142
|
+
}
|
|
143
|
+
return (0, toolkit_1.introspectMongo)(this.config.db, this.config.exposeTables);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ExecutorAgentClient = ExecutorAgentClient;
|
|
147
|
+
async function initExecutorAgent(config) {
|
|
148
|
+
const client = new ExecutorAgentClient(config);
|
|
149
|
+
await client.init();
|
|
150
|
+
return client;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;AAgNA,8CAMC;AAtND,2BAA0B;AAE1B,6CAS4B;AAC5B,mDAA+F;AAW/F,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AAC,EAAU,CAAC,UAAU,KAAK,UAAU;YACxD,OAAQ,IAAI,CAAC,MAAM,CAAC,EAAU,CAAC,YAAY,KAAK,QAAQ,EACxD,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,UAAU,EAAE,CAAC;YACpC,OAAO,IAAA,4BAAkB,EAAC,IAAI,CAAC,MAAM,CAAC,EAAU,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,IAAA,yBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,EAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACzE,CAAC;CACF;AAvLD,kDAuLC;AAEM,KAAK,UAAU,iBAAiB,CACrC,MAA2B;IAE3B,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initExecutorAgent = exports.ExecutorAgentClient = void 0;
|
|
4
|
+
var agent_1 = require("./agent");
|
|
5
|
+
Object.defineProperty(exports, "ExecutorAgentClient", { enumerable: true, get: function () { return agent_1.ExecutorAgentClient; } });
|
|
6
|
+
Object.defineProperty(exports, "initExecutorAgent", { enumerable: true, get: function () { return agent_1.initExecutorAgent; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAAiE;AAAxD,4GAAA,mBAAmB,OAAA;AAAE,0GAAA,iBAAiB,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@databridgeai/connector",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "DataBridge AI Connector — Connect your Node.js backend to DataBridge for natural language database queries",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.json",
|
|
9
|
+
"dev": "tsc -p tsconfig.json --watch"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@databridgeai/core": "*",
|
|
13
|
+
"@databridgeai/toolkit": "*",
|
|
14
|
+
"pg": "^8.11.3",
|
|
15
|
+
"mongodb": "^6.3.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/pg": "^8.10.9",
|
|
19
|
+
"typescript": "^5.3.3"
|
|
20
|
+
},
|
|
21
|
+
"files": ["dist", "README.md"],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/rishabhAgg/DataBridgeAI.git",
|
|
28
|
+
"directory": "packages/connector"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/rishabhAgg/DataBridgeAI#readme",
|
|
31
|
+
"keywords": ["databridgeai", "ai", "database", "connector", "natural-language", "postgres", "mongodb", "node"],
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|