@databasin/mcp-client 0.1.0 → 0.2.0-beta.1
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 +128 -61
- package/dist/abort.d.ts +5 -0
- package/dist/abort.d.ts.map +1 -0
- package/dist/abort.js +25 -0
- package/dist/abort.js.map +1 -0
- package/dist/api-client.d.ts +49 -34
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +142 -145
- package/dist/api-client.js.map +1 -1
- package/dist/api-contract.d.ts +59 -0
- package/dist/api-contract.d.ts.map +1 -0
- package/dist/api-contract.js +47 -0
- package/dist/api-contract.js.map +1 -0
- package/dist/api-profile.d.ts +5 -0
- package/dist/api-profile.d.ts.map +1 -0
- package/dist/api-profile.js +38 -0
- package/dist/api-profile.js.map +1 -0
- package/dist/api-request.d.ts +27 -0
- package/dist/api-request.d.ts.map +1 -0
- package/dist/api-request.js +147 -0
- package/dist/api-request.js.map +1 -0
- package/dist/api-response.d.ts +9 -0
- package/dist/api-response.d.ts.map +1 -0
- package/dist/api-response.js +206 -0
- package/dist/api-response.js.map +1 -0
- package/dist/auth.d.ts +22 -11
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +71 -71
- package/dist/auth.js.map +1 -1
- package/dist/browser.d.ts +20 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +19 -17
- package/dist/browser.js.map +1 -1
- package/dist/cli.d.ts +31 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +147 -67
- package/dist/cli.js.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/correlation.d.ts +6 -0
- package/dist/correlation.d.ts.map +1 -0
- package/dist/correlation.js +15 -0
- package/dist/correlation.js.map +1 -0
- package/dist/credential-store.d.ts +21 -0
- package/dist/credential-store.d.ts.map +1 -0
- package/dist/credential-store.js +46 -0
- package/dist/credential-store.js.map +1 -0
- package/dist/errors.d.ts +17 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +24 -6
- package/dist/errors.js.map +1 -1
- package/dist/login-url.d.ts +18 -0
- package/dist/login-url.d.ts.map +1 -0
- package/dist/login-url.js +82 -0
- package/dist/login-url.js.map +1 -0
- package/dist/safety.d.ts +4 -0
- package/dist/safety.d.ts.map +1 -1
- package/dist/safety.js +94 -10
- package/dist/safety.js.map +1 -1
- package/dist/schemas.d.ts +326 -49
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +242 -55
- package/dist/schemas.js.map +1 -1
- package/dist/server.d.ts +2 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +17 -10
- package/dist/server.js.map +1 -1
- package/dist/token-validation.d.ts +5 -0
- package/dist/token-validation.d.ts.map +1 -0
- package/dist/token-validation.js +183 -0
- package/dist/token-validation.js.map +1 -0
- package/dist/tools.d.ts +12 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +286 -75
- package/dist/tools.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +10 -6
- package/dist/mappers.d.ts +0 -56
- package/dist/mappers.d.ts.map +0 -1
- package/dist/mappers.js +0 -171
- package/dist/mappers.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,108 +1,175 @@
|
|
|
1
1
|
# DataBasin MCP Client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Local stdio MCP client for DataBasin. It keeps Microsoft Entra credentials in the OS-protected MSAL cache and calls only the versioned DataBasin SvelteKit machine façade over HTTPS.
|
|
4
4
|
|
|
5
|
-
Production is the default.
|
|
5
|
+
Production is the default. The non-production profile is selected with `--environment np`.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## NP beta pilot
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- A DataBasin account
|
|
11
|
-
- A supported OS credential store: Windows DPAPI, macOS Keychain, or Linux Secret Service/LibSecret
|
|
9
|
+
The `0.2.0-beta.1` candidate is for the DataBasin team and invited beta testers against NP only. Install the exact version so npm's production `latest` tag remains on the production-compatible `0.1.0` line:
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
```bash
|
|
12
|
+
npx -y @databasin/mcp-client@0.2.0-beta.1 doctor --environment np
|
|
13
|
+
npx -y @databasin/mcp-client@0.2.0-beta.1 login --environment np
|
|
14
|
+
```
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
The beta requires Node.js 22.20+ or Node.js 24 and an available OS-protected credential store. `doctor` reports the selected fixed profile, runtime support, credential-store availability, and sign-in state; it never prints account identity, tokens, or credentials.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
2. Call `databasin_login` when sign-in is needed. It returns Microsoft's short-lived device-login URL and user code immediately.
|
|
19
|
-
3. Give you that URL and code. You can complete sign-in from any browser or device, after which the assistant calls `databasin_auth_status` again.
|
|
18
|
+
Use the exact beta version in the host configuration during the pilot:
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
| Host | NP beta setup |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| Codex | `codex mcp add databasin-np -- npx -y @databasin/mcp-client@0.2.0-beta.1 --environment np` |
|
|
23
|
+
| Claude Code | `claude mcp add --transport stdio --scope user databasin-np -- npx -y @databasin/mcp-client@0.2.0-beta.1 --environment np` |
|
|
24
|
+
| Claude Desktop / Cursor-compatible config | Use the `mcpServers` JSON below |
|
|
25
|
+
| VS Code | Use the `servers` JSON below in user or workspace `mcp.json` |
|
|
26
|
+
| OpenCode v2 | Use the `mcp.servers` JSON below in `opencode.jsonc` |
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
Claude Desktop and other hosts that accept the common `mcpServers` shape:
|
|
24
29
|
|
|
25
|
-
```
|
|
26
|
-
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"databasin-np": {
|
|
34
|
+
"type": "stdio",
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["-y", "@databasin/mcp-client@0.2.0-beta.1", "--environment", "np"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
27
40
|
```
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
VS Code `mcp.json`:
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"servers": {
|
|
47
|
+
"databasinNp": {
|
|
48
|
+
"type": "stdio",
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "@databasin/mcp-client@0.2.0-beta.1", "--environment", "np"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
32
55
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
OpenCode v2 `opencode.jsonc`:
|
|
57
|
+
|
|
58
|
+
```jsonc
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://opencode.ai/config.json",
|
|
61
|
+
"mcp": {
|
|
62
|
+
"servers": {
|
|
63
|
+
"databasin-np": {
|
|
64
|
+
"type": "local",
|
|
65
|
+
"command": ["npx", "-y", "@databasin/mcp-client@0.2.0-beta.1", "--environment", "np"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
36
70
|
```
|
|
37
71
|
|
|
38
|
-
|
|
72
|
+
On native Windows, a host that cannot launch `npx` directly should use `cmd` with arguments beginning `[/c, npx, ...]` (JSON string form: `["/c", "npx", ...]`). Restart the host after changing its MCP configuration so it refreshes the 13-tool inventory.
|
|
73
|
+
|
|
74
|
+
The only remote façades are:
|
|
75
|
+
|
|
76
|
+
- Production: `https://databasin.cloud/api/v1/mcp`
|
|
77
|
+
- NP: `https://databasin-ui-np.grayriver-813df174.centralus.azurecontainerapps.io/api/v1/mcp`
|
|
78
|
+
|
|
79
|
+
## Install and connect
|
|
39
80
|
|
|
40
81
|
```bash
|
|
41
|
-
|
|
82
|
+
npx -y @databasin/mcp-client
|
|
42
83
|
```
|
|
43
84
|
|
|
44
|
-
|
|
85
|
+
The client requires an OS credential store. On Linux, an available and unlocked
|
|
86
|
+
Secret Service/libsecret keyring is required; headless environments must provide
|
|
87
|
+
one explicitly. The client fails closed rather than falling back to a plaintext
|
|
88
|
+
token cache.
|
|
89
|
+
|
|
90
|
+
Codex:
|
|
45
91
|
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
command = "npx"
|
|
49
|
-
args = ["-y", "@databasin/mcp-client"]
|
|
92
|
+
```bash
|
|
93
|
+
codex mcp add databasin -- npx -y @databasin/mcp-client
|
|
50
94
|
```
|
|
51
95
|
|
|
52
|
-
|
|
96
|
+
Claude Code:
|
|
53
97
|
|
|
54
98
|
```bash
|
|
55
99
|
claude mcp add --transport stdio --scope user databasin -- npx -y @databasin/mcp-client
|
|
56
100
|
```
|
|
57
101
|
|
|
58
|
-
|
|
102
|
+
To use non-production:
|
|
59
103
|
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
"mcpServers": {
|
|
63
|
-
"databasin": {
|
|
64
|
-
"command": "npx",
|
|
65
|
-
"args": ["-y", "@databasin/mcp-client"]
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
104
|
+
```bash
|
|
105
|
+
npx -y @databasin/mcp-client --environment np
|
|
69
106
|
```
|
|
70
107
|
|
|
71
|
-
|
|
108
|
+
The assistant can call `databasin_login` and give you the short-lived Microsoft device URL and code. Enter credentials only on Microsoft’s page. The client never sends credentials or tokens through MCP tool output.
|
|
72
109
|
|
|
73
|
-
|
|
110
|
+
Device login output is restricted to the HTTPS `microsoft.com/devicelogin` endpoint (with an optional trailing slash, canonicalized away). Interactive CLI login is restricted to the configured tenant’s exact `login.microsoftonline.com/<tenant>/oauth2/v2.0/authorize` path and client ID. Credential-bearing URLs, redirects to other hosts, other schemes, ports, fragments, and unexpected paths fail closed before a URL is opened or returned. Raw MSAL device codes, polling intervals/handles, and provider messages are discarded immediately; only the validated verification URL, human-entered user code, and expiry are retained.
|
|
74
111
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
args = ["-y", "@databasin/mcp-client", "--environment", "np"]
|
|
79
|
-
```
|
|
112
|
+
Before using an MSAL access token, the client fail-closes on its tenant, issuer, audience, delegated scope, timing, authority, account, and expiry metadata. JWT payload decoding here is local defense-in-depth, not signature verification; the DataBasin API remains the cryptographic validation and authorization boundary.
|
|
113
|
+
|
|
114
|
+
## Tools
|
|
80
115
|
|
|
81
|
-
|
|
116
|
+
The MCP server exposes thirteen tools in two deliberately separate groups. Eleven product tools call the remote DataBasin façade:
|
|
82
117
|
|
|
83
|
-
|
|
118
|
+
- `databasin_get_capabilities` — fetch the server-owned capability allowlist.
|
|
119
|
+
- `databasin_get_context` — fetch authorized project and connector metadata.
|
|
120
|
+
- `databasin_search` — bounded authorized metadata search.
|
|
121
|
+
- `databasin_get_schema` — bounded non-secret schema metadata.
|
|
122
|
+
- `databasin_run_agent` — run the fixed `metadata_readonly` profile for an explicit institution and optional project/connector scope.
|
|
123
|
+
- `databasin_get_agent_run` — read an authorized run status/result.
|
|
124
|
+
- `databasin_cancel_agent_run` — request cancellation and report the server’s truthful state.
|
|
125
|
+
- `databasin_run_query` — execute a single read-only `SELECT`/`WITH` statement against an authorized connector and return up to `maxRows` rows.
|
|
126
|
+
- `databasin_get_query_status` — read an authorized query's status, and its columns/rows/error once terminal.
|
|
127
|
+
- `databasin_cancel_query` — request cancellation and report the server’s truthful state.
|
|
128
|
+
- `databasin_run_assistant` — run the read-only DataBasin assistant (a server-side Claude Code agent) that browses metadata and runs DataBasin skills over multiple steps to answer a natural-language request.
|
|
84
129
|
|
|
85
|
-
|
|
130
|
+
The other two tools, `databasin_auth_status` and `databasin_login`, are client-local authentication helpers. They interact only with the local MSAL credential manager and Microsoft sign-in; they are not part of the eleven-tool DataBasin product façade and do not call DataBasin product routes.
|
|
131
|
+
|
|
132
|
+
No organization configuration is required. Unscoped `databasin_get_context` and `databasin_search` discover metadata only across organizations the signed-in user is authorized to access. A project-scoped search must include its `institutionId`; account discovery is not a wildcard and never broadens server-side authorization.
|
|
133
|
+
|
|
134
|
+
The client does not expose arbitrary SQL, shell commands, connector credentials, arbitrary URLs, or arbitrary headers. `databasin_run_query` accepts only a single read-only `SELECT`/`WITH` statement, enforced server-side; multi-statement text and any mutating keyword are rejected outright, and `language`/`sessionId`/`timeoutSeconds` are never caller-facing (`language` is always `sql`; `timeoutSeconds` is a fixed server-side constant). Every remote success is the strict envelope `{ "data": T, "correlationId": "..." }` and must match the response `X-Correlation-Id` header.
|
|
86
135
|
|
|
87
|
-
- `
|
|
88
|
-
- `databasin_login`: return Microsoft device-login instructions without blocking the assistant
|
|
89
|
-
- `databasin_get_context`: list caller-visible projects and connection identifiers
|
|
90
|
-
- `databasin_search`: search visible pipelines, connectors, and automations
|
|
91
|
-
- `databasin_browse_schema`: browse catalogs, schemas, tables, and columns
|
|
92
|
-
- `databasin_get_operation`: read bounded query status and results
|
|
93
|
-
- `databasin_cancel_operation`: request cancellation of a visible query operation
|
|
136
|
+
`databasin_run_agent` accepts `institutionId`, `prompt`, an optional JSON-object `context`, optional `projectInternalId`, `connectorId`, `model`, and top-level `maxTurns` (`1..100`). The optional model is restricted to the server-owned `haiku` or `sonnet` allowlist; omitting it uses `haiku`. Its profile is always `metadata_readonly`. Agent creation and cancellation each accept an optional UUID `idempotencyKey` for replay after a lost response; otherwise the client generates one. The key is sent only as `Idempotency-Key`, never in the request body. Polling is bounded to 30 minutes with bounded backoff and honors MCP cancellation.
|
|
94
137
|
|
|
95
|
-
|
|
138
|
+
Agent status, result, and cancellation responses include the complete server-authorized scope. A canonical run contains `runId`, the three scope IDs (nullable where optional), `profile`, `status`, bounded `result`/`error`, and `createdAt`/`updatedAt`. Cancellation reports the state returned by the server and does not imply completion before the server says `cancelled`.
|
|
96
139
|
|
|
97
|
-
|
|
140
|
+
`databasin_run_query` accepts `connectorId`, `code` (the SQL text, 1–32768 bytes), and `maxRows` (`1..1000`, default `1000`). Unlike agent runs, query creation and cancellation take no idempotency key. Polling is bounded to 2 minutes with the same bounded backoff, since a query is meant to feel like a fast synchronous tool call rather than a long-running job; on timeout the last observed non-terminal status is returned with its `queryId` for `databasin_get_query_status`/`databasin_cancel_query` to follow up. A canonical query result contains `queryId`, `connectorId`, `status`, bounded `columns`/`data`/`rowCount` (populated once terminal, otherwise `null`), `truncated`, and `error`.
|
|
98
141
|
|
|
99
|
-
|
|
142
|
+
`databasin_run_assistant` accepts `connectorId` (required, so the assistant has an LLM to route to), `prompt` (1–32768 bytes), an optional `context` string (up to 4096 characters), and `maxTurns` (`1..25`, default `6`). It never accepts `model`, `sessionId`, `options`, or any tool/permission override — the assistant is stateless per call in v1 (no session continuity), and the server-side agent's read-only tool policy is enforced entirely on the façade, not by this client. The call is synchronous and may take up to a few minutes; the client gives this one endpoint a longer request timeout than the shared default so a legitimate in-progress run is never cut off client-side first. A canonical result contains `status` (`completed`/`failed`/`incomplete`), bounded `text`, `turns`, and `error`. This tool is metadata-and-skills only — it never executes SQL; use `databasin_run_query` for that.
|
|
143
|
+
|
|
144
|
+
## CLI fallback
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx -y @databasin/mcp-client login
|
|
148
|
+
npx -y @databasin/mcp-client status
|
|
149
|
+
npx -y @databasin/mcp-client logout
|
|
150
|
+
npx -y @databasin/mcp-client login --environment np
|
|
151
|
+
npx -y @databasin/mcp-client doctor --environment np
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Environment aliases `production` and `staging`/`test` are accepted for `prod` and `np` respectively.
|
|
155
|
+
|
|
156
|
+
## Development
|
|
100
157
|
|
|
101
158
|
```bash
|
|
102
159
|
npm ci
|
|
103
160
|
npm run verify
|
|
104
|
-
npm
|
|
105
|
-
npm
|
|
161
|
+
npm audit --omit=dev --audit-level=high
|
|
162
|
+
npm run verify:package
|
|
106
163
|
```
|
|
107
164
|
|
|
108
|
-
|
|
165
|
+
`npm run verify` runs the TypeScript check, unit tests, build, and stdio child-process E2E. CI runs those checks on Node 22 and 24 across Linux, macOS, and Windows, audits production dependencies, and verifies the exact package allowlist with `npm pack --dry-run --json`.
|
|
166
|
+
|
|
167
|
+
Release qualification uses an exact local tarball, never a mutable dist-tag. After `npm pack`, an authorized tester with an existing NP session can run the read-only qualification:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
DATABASIN_MCP_BETA_TARBALL=./databasin-mcp-client-0.2.0-beta.1.tgz npm run qualify:np
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The release owner may add `DATABASIN_MCP_QUALIFY_STATEFUL=1` plus explicit authorized connector/scope environment variables to exercise all 13 tools, including the agent, query, and assistant lifecycles. The command emits only package/version, counts, mode, and terminal statuses; resource identifiers, names, responses, and credentials are not evidence output.
|
|
174
|
+
|
|
175
|
+
Release approval still requires proof of the Entra registration, tenant, issuer, audience, delegated scope, and wrong-claim rejection behavior for each environment.
|
package/dist/abort.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DataBasinError } from './errors.js';
|
|
2
|
+
export declare function abortedRequest(correlationId?: string): DataBasinError;
|
|
3
|
+
export declare function throwIfAborted(signal?: AbortSignal, correlationId?: string): void;
|
|
4
|
+
export declare function abortableDelay(milliseconds: number, signal?: AbortSignal): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../src/abort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,cAAc,CAMrE;AAED,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAEjF;AAED,wBAAsB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9F"}
|
package/dist/abort.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DataBasinError } from './errors.js';
|
|
2
|
+
export function abortedRequest(correlationId) {
|
|
3
|
+
return new DataBasinError('REQUEST_ABORTED', 'The DataBasin request was cancelled by the caller.', correlationId === undefined ? {} : { correlationId });
|
|
4
|
+
}
|
|
5
|
+
export function throwIfAborted(signal, correlationId) {
|
|
6
|
+
if (signal?.aborted)
|
|
7
|
+
throw abortedRequest(correlationId);
|
|
8
|
+
}
|
|
9
|
+
export async function abortableDelay(milliseconds, signal) {
|
|
10
|
+
throwIfAborted(signal);
|
|
11
|
+
await new Promise((resolve, reject) => {
|
|
12
|
+
const cleanup = () => signal?.removeEventListener('abort', onAbort);
|
|
13
|
+
const onAbort = () => {
|
|
14
|
+
clearTimeout(handle);
|
|
15
|
+
cleanup();
|
|
16
|
+
reject(abortedRequest());
|
|
17
|
+
};
|
|
18
|
+
const handle = setTimeout(() => {
|
|
19
|
+
cleanup();
|
|
20
|
+
resolve();
|
|
21
|
+
}, milliseconds);
|
|
22
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../src/abort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,cAAc,CAAC,aAAsB;IACnD,OAAO,IAAI,cAAc,CACvB,iBAAiB,EACjB,oDAAoD,EACpD,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,aAAsB;IACzE,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,cAAc,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,YAAoB,EAAE,MAAoB;IAC7E,cAAc,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,YAAY,CAAC,CAAC;QACjB,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/api-client.d.ts
CHANGED
|
@@ -1,43 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fixedFacadeBaseUrl } from './api-profile.js';
|
|
3
|
+
import { type Sleep } from './api-request.js';
|
|
4
|
+
import { parseRetryAfter } from './api-response.js';
|
|
1
5
|
import type { DataBasinProfile } from './config.js';
|
|
2
|
-
import type
|
|
6
|
+
import { CapabilitiesEnvelopeSchema, ContextEnvelopeSchema, GetSchemaEnvelopeSchema, SearchEnvelopeSchema, type AgentRunEnvelope, type AgentRunRequest, type AssistantEnvelope, type GetSchemaInput, type QueryEnvelope, type RunAssistantInput, type RunQueryInput, type SearchInput } from './schemas.js';
|
|
7
|
+
type CapabilitiesEnvelope = z.infer<typeof CapabilitiesEnvelopeSchema>;
|
|
8
|
+
type ContextEnvelope = z.infer<typeof ContextEnvelopeSchema>;
|
|
9
|
+
type SearchEnvelope = z.infer<typeof SearchEnvelopeSchema>;
|
|
10
|
+
type GetSchemaEnvelope = z.infer<typeof GetSchemaEnvelopeSchema>;
|
|
3
11
|
export interface DataBasinApi {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
search(input: SearchInput, signal?: AbortSignal): Promise<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
getCapabilities(signal?: AbortSignal): Promise<CapabilitiesEnvelope>;
|
|
13
|
+
getContext(signal?: AbortSignal): Promise<ContextEnvelope>;
|
|
14
|
+
search(input: SearchInput, signal?: AbortSignal): Promise<SearchEnvelope>;
|
|
15
|
+
getSchema(input: GetSchemaInput, signal?: AbortSignal): Promise<GetSchemaEnvelope>;
|
|
16
|
+
createAgentRun(input: AgentRunRequest, idempotencyKey: string, signal?: AbortSignal): Promise<AgentRunEnvelope>;
|
|
17
|
+
getAgentRun(runId: string, signal?: AbortSignal): Promise<AgentRunEnvelope>;
|
|
18
|
+
cancelAgentRun(runId: string, idempotencyKey: string, reason: string, signal?: AbortSignal): Promise<AgentRunEnvelope>;
|
|
19
|
+
runQuery(input: RunQueryInput, signal?: AbortSignal): Promise<QueryEnvelope>;
|
|
20
|
+
getQueryStatus(queryId: string, signal?: AbortSignal): Promise<QueryEnvelope>;
|
|
21
|
+
cancelQuery(queryId: string, signal?: AbortSignal): Promise<QueryEnvelope>;
|
|
22
|
+
runAssistant(input: RunAssistantInput, signal?: AbortSignal): Promise<AssistantEnvelope>;
|
|
13
23
|
}
|
|
14
|
-
export interface
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
export interface AuthProvider {
|
|
25
|
+
profile: DataBasinProfile;
|
|
26
|
+
getAccessToken(): Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
export interface TestOnlyDataBasinApiClientOptions {
|
|
29
|
+
testOnlyBaseUrl: string;
|
|
30
|
+
auth: AuthProvider;
|
|
31
|
+
fetchImpl: typeof fetch;
|
|
21
32
|
maxResponseBytes?: number;
|
|
22
33
|
timeoutMs?: number;
|
|
34
|
+
sleepImpl?: Sleep;
|
|
35
|
+
now?: () => number;
|
|
23
36
|
}
|
|
24
37
|
export declare class DataBasinApiClient implements DataBasinApi {
|
|
25
|
-
private readonly
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
private
|
|
38
|
+
private readonly transport;
|
|
39
|
+
private constructor();
|
|
40
|
+
static forProfile(auth: AuthProvider): DataBasinApiClient;
|
|
41
|
+
static createForTests(options: TestOnlyDataBasinApiClientOptions): DataBasinApiClient;
|
|
42
|
+
getCapabilities(signal?: AbortSignal): Promise<CapabilitiesEnvelope>;
|
|
43
|
+
getContext(signal?: AbortSignal): Promise<ContextEnvelope>;
|
|
44
|
+
search(input: SearchInput, signal?: AbortSignal): Promise<SearchEnvelope>;
|
|
45
|
+
getSchema(input: GetSchemaInput, signal?: AbortSignal): Promise<GetSchemaEnvelope>;
|
|
46
|
+
createAgentRun(input: AgentRunRequest, idempotencyKey: string, signal?: AbortSignal): Promise<AgentRunEnvelope>;
|
|
47
|
+
getAgentRun(runId: string, signal?: AbortSignal): Promise<AgentRunEnvelope>;
|
|
48
|
+
cancelAgentRun(runId: string, idempotencyKey: string, reason: string, signal?: AbortSignal): Promise<AgentRunEnvelope>;
|
|
49
|
+
runQuery(input: RunQueryInput, signal?: AbortSignal): Promise<QueryEnvelope>;
|
|
50
|
+
getQueryStatus(queryId: string, signal?: AbortSignal): Promise<QueryEnvelope>;
|
|
51
|
+
cancelQuery(queryId: string, signal?: AbortSignal): Promise<QueryEnvelope>;
|
|
52
|
+
runAssistant(input: RunAssistantInput, signal?: AbortSignal): Promise<AssistantEnvelope>;
|
|
53
|
+
private execute;
|
|
41
54
|
}
|
|
42
|
-
export declare function
|
|
55
|
+
export declare function createDataBasinApiClientForTests(options: TestOnlyDataBasinApiClientOptions): DataBasinApiClient;
|
|
56
|
+
export { fixedFacadeBaseUrl, parseRetryAfter };
|
|
57
|
+
export declare const ASSISTANT_REQUEST_TIMEOUT_MS: number;
|
|
43
58
|
//# sourceMappingURL=api-client.d.ts.map
|
package/dist/api-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAwB,kBAAkB,EAA4B,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAKL,KAAK,KAAK,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAIL,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EAOvB,oBAAoB,EAEpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAEjB,MAAM,cAAc,CAAC;AAEtB,KAAK,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACvE,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC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