@hasna/connectors 1.4.2 → 1.4.4
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/bin/index.js +145 -98
- package/bin/mcp.js +1 -1
- package/bin/serve.js +144 -93
- package/connectors/clickbank/README.md +2 -2
- package/connectors/split-in-batches/CLAUDE.md +1 -1
- package/connectors/split-in-batches/README.md +1 -1
- package/connectors/split-in-batches/src/api/client.test.ts +16 -17
- package/connectors/split-in-batches/src/api/client.ts +4 -3
- package/connectors/split-in-batches/src/cli/index.ts +1 -1
- package/connectors/spreadsheet-file/.env.example +1 -1
- package/connectors/spreadsheet-file/CLAUDE.md +2 -2
- package/connectors/spreadsheet-file/README.md +3 -3
- package/connectors/spreadsheet-file/src/api/client.test.ts +8 -9
- package/connectors/spreadsheet-file/src/api/client.ts +4 -3
- package/connectors/spreadsheet-file/src/cli/index.ts +1 -1
- package/connectors/sse-trigger/.env.example +1 -1
- package/connectors/sse-trigger/CLAUDE.md +2 -2
- package/connectors/sse-trigger/README.md +1 -1
- package/connectors/sse-trigger/src/api/client.test.ts +12 -8
- package/connectors/sse-trigger/src/api/client.ts +4 -3
- package/connectors/sse-trigger/src/api/index.ts +1 -1
- package/connectors/sse-trigger/src/cli/index.ts +1 -1
- package/connectors/sse-trigger/src/index.ts +1 -1
- package/connectors/stability-api-platform/AGENTS.md +1 -1
- package/connectors/stability-api-platform/CLAUDE.md +1 -1
- package/connectors/stability-api-platform/README.md +2 -2
- package/connectors/stability-api-platform/src/api/client.test.ts +17 -12
- package/connectors/stability-api-platform/src/api/client.ts +4 -3
- package/connectors/stability-api-platform/src/api/index.ts +0 -1
- package/connectors/stability-api-platform/src/cli/index.ts +1 -1
- package/connectors/stability-api-platform/src/index.ts +0 -1
- package/connectors/stop-and-error/.env.example +1 -1
- package/connectors/stop-and-error/CLAUDE.md +1 -1
- package/connectors/stop-and-error/README.md +1 -1
- package/connectors/stop-and-error/src/api/client.test.ts +12 -8
- package/connectors/stop-and-error/src/api/client.ts +4 -3
- package/connectors/stop-and-error/src/cli/index.ts +2 -2
- package/connectors/stripe-financial-connections/.env.example +1 -1
- package/connectors/stripe-financial-connections/CLAUDE.md +2 -2
- package/connectors/stripe-financial-connections/src/api/client.test.ts +34 -0
- package/connectors/stripe-financial-connections/src/api/client.ts +4 -3
- package/connectors/stripe-financial-connections/src/cli/index.ts +1 -1
- package/connectors/sucuri-api-platform/.env.example +1 -1
- package/connectors/sucuri-api-platform/CLAUDE.md +1 -1
- package/connectors/sucuri-api-platform/README.md +2 -2
- package/connectors/sucuri-api-platform/src/api/client.test.ts +9 -7
- package/connectors/sucuri-api-platform/src/api/client.ts +4 -3
- package/connectors/sucuri-api-platform/src/api/index.ts +1 -1
- package/connectors/sucuri-api-platform/src/cli/index.ts +1 -1
- package/connectors/sucuri-api-platform/src/index.ts +1 -1
- package/connectors/tettra-api-platform/CLAUDE.md +1 -1
- package/connectors/tettra-api-platform/README.md +2 -2
- package/connectors/tettra-api-platform/src/api/client.test.ts +7 -8
- package/connectors/tettra-api-platform/src/api/client.ts +4 -3
- package/connectors/tettra-api-platform/src/api/index.ts +1 -1
- package/connectors/tettra-api-platform/src/cli/index.ts +1 -1
- package/connectors/tettra-api-platform/src/index.ts +1 -1
- package/connectors/together-api-platform/.env.example +1 -1
- package/connectors/together-api-platform/CLAUDE.md +1 -1
- package/connectors/together-api-platform/README.md +1 -1
- package/connectors/together-api-platform/src/api/client.test.ts +11 -7
- package/connectors/together-api-platform/src/api/client.ts +4 -4
- package/connectors/together-api-platform/src/api/index.ts +1 -1
- package/connectors/together-api-platform/src/cli/index.ts +1 -1
- package/connectors/together-api-platform/src/index.ts +1 -1
- package/connectors/travo-real-estate/CLAUDE.md +1 -1
- package/connectors/travo-real-estate/README.md +1 -1
- package/connectors/travo-real-estate/src/api/client.test.ts +20 -16
- package/connectors/travo-real-estate/src/api/client.ts +4 -3
- package/connectors/travo-real-estate/src/utils/config.ts +2 -4
- package/connectors/tray-api-platform/CLAUDE.md +1 -1
- package/connectors/tray-api-platform/src/api/client.test.ts +17 -13
- package/connectors/tray-api-platform/src/api/client.ts +4 -3
- package/connectors/tray-api-platform/src/api/index.ts +1 -1
- package/connectors/tray-api-platform/src/cli/index.ts +1 -1
- package/connectors/tray-api-platform/src/index.ts +0 -1
- package/connectors/turso-api-platform/CLAUDE.md +1 -1
- package/connectors/turso-api-platform/README.md +2 -2
- package/connectors/turso-api-platform/src/api/client.test.ts +17 -13
- package/connectors/turso-api-platform/src/api/client.ts +4 -3
- package/connectors/turso-api-platform/src/cli/index.ts +2 -2
- package/connectors/twilio-api-platform/CLAUDE.md +1 -1
- package/connectors/twilio-api-platform/src/api/client.test.ts +11 -11
- package/connectors/twilio-api-platform/src/api/client.ts +4 -3
- package/connectors/twilio-api-platform/src/api/index.ts +1 -1
- package/connectors/twilio-api-platform/src/cli/index.ts +1 -1
- package/connectors/twilio-api-platform/src/index.ts +1 -1
- package/connectors/tyk-api-platform/.env.example +1 -1
- package/connectors/tyk-api-platform/CLAUDE.md +2 -2
- package/connectors/tyk-api-platform/README.md +1 -1
- package/connectors/tyk-api-platform/src/api/client.test.ts +14 -15
- package/connectors/tyk-api-platform/src/api/client.ts +4 -3
- package/connectors/tyk-api-platform/src/api/index.ts +1 -1
- package/connectors/tyk-api-platform/src/cli/index.ts +1 -1
- package/connectors/tyk-api-platform/src/index.ts +1 -1
- package/connectors/vector-legal/.env.example +1 -1
- package/connectors/vector-legal/AGENTS.md +1 -1
- package/connectors/vector-legal/CLAUDE.md +1 -1
- package/connectors/vector-legal/README.md +1 -1
- package/connectors/vector-legal/src/api/client.test.ts +9 -5
- package/connectors/vector-legal/src/api/client.ts +4 -3
- package/connectors/vector-legal/src/api/index.ts +1 -1
- package/connectors/vector-legal/src/cli/index.ts +2 -2
- package/connectors/vector-legal/src/index.ts +0 -1
- package/connectors/vector-legal-api/CLAUDE.md +1 -1
- package/connectors/vector-legal-api/README.md +2 -2
- package/connectors/vector-legal-api/src/api/client.test.ts +12 -7
- package/connectors/vector-legal-api/src/api/client.ts +4 -3
- package/connectors/vector-legal-api/src/api/index.ts +1 -1
- package/connectors/vector-legal-api/src/cli/index.ts +1 -1
- package/connectors/vector-legal-api/src/index.ts +1 -2
- package/connectors/velum-data-quality/.env.example +1 -1
- package/connectors/velum-data-quality/CLAUDE.md +1 -1
- package/connectors/velum-data-quality/src/api/client.test.ts +15 -16
- package/connectors/velum-data-quality/src/api/client.ts +4 -3
- package/connectors/velum-data-quality/src/api/index.ts +1 -1
- package/connectors/velum-data-quality/src/cli/index.ts +1 -1
- package/connectors/velum-data-quality/src/index.ts +0 -1
- package/connectors/vercel-api-platform/.env.example +1 -1
- package/connectors/vercel-api-platform/CLAUDE.md +2 -2
- package/connectors/vercel-api-platform/README.md +2 -2
- package/connectors/vercel-api-platform/src/api/client.test.ts +27 -6
- package/connectors/vercel-api-platform/src/api/client.ts +4 -3
- package/connectors/vercel-api-platform/src/api/index.ts +1 -1
- package/connectors/vercel-api-platform/src/cli/index.ts +2 -2
- package/connectors/vercel-api-platform/src/index.ts +0 -1
- package/connectors/veriphone/README.md +2 -2
- package/connectors/wave-accounting/CLAUDE.md +1 -1
- package/connectors/wave-accounting/src/utils/auth.ts +1 -1
- package/connectors/weaviate-api-platform/CLAUDE.md +1 -1
- package/connectors/weaviate-api-platform/src/api/client.test.ts +32 -7
- package/connectors/weaviate-api-platform/src/api/client.ts +4 -3
- package/connectors/weaviate-api-platform/src/api/index.ts +1 -1
- package/connectors/weaviate-api-platform/src/cli/index.ts +1 -1
- package/connectors/weaviate-api-platform/src/index.ts +1 -1
- package/connectors/workflow-trigger/.env.example +1 -1
- package/connectors/workflow-trigger/CLAUDE.md +1 -1
- package/connectors/workflow-trigger/README.md +1 -1
- package/connectors/workflow-trigger/src/api/client.test.ts +10 -6
- package/connectors/workflow-trigger/src/api/client.ts +4 -3
- package/connectors/workflow-trigger/src/cli/index.ts +1 -1
- package/connectors/write-binary-file/CLAUDE.md +1 -1
- package/connectors/write-binary-file/README.md +1 -1
- package/connectors/write-binary-file/src/api/client.test.ts +16 -12
- package/connectors/write-binary-file/src/api/client.ts +4 -3
- package/connectors/write-binary-file/src/api/index.ts +1 -1
- package/connectors/write-binary-file/src/index.ts +1 -1
- package/connectors/wubookratechecker/src/api/client.test.ts +34 -0
- package/connectors/wubookratechecker/src/api/client.ts +3 -1
- package/connectors/wubookratechecker/src/api/index.ts +1 -1
- package/connectors/wubookratechecker/src/types/index.ts +1 -1
- package/connectors/xai-api-platform/.env.example +1 -1
- package/connectors/xai-api-platform/CLAUDE.md +1 -1
- package/connectors/xai-api-platform/README.md +1 -1
- package/connectors/xai-api-platform/src/api/client.test.ts +33 -8
- package/connectors/xai-api-platform/src/api/client.ts +4 -3
- package/connectors/xai-api-platform/src/api/index.ts +1 -1
- package/connectors/xai-api-platform/src/index.ts +1 -1
- package/connectors/xai-api-platform/src/utils/config.ts +2 -3
- package/connectors/zapier-api-platform/CLAUDE.md +1 -1
- package/connectors/zapier-api-platform/README.md +1 -1
- package/connectors/zapier-api-platform/src/api/client.test.ts +19 -14
- package/connectors/zapier-api-platform/src/api/client.ts +4 -3
- package/connectors/zapier-api-platform/src/api/index.ts +1 -1
- package/connectors/zapier-api-platform/src/cli/index.ts +1 -1
- package/connectors/zapier-api-platform/src/index.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ bun run dev search --data '{"query":"gateway"}'
|
|
|
31
31
|
| Variable | Description |
|
|
32
32
|
|----------|-------------|
|
|
33
33
|
| `TYK_API_PLATFORM_API_KEY` | API key |
|
|
34
|
-
| `TYK_API_PLATFORM_BASE_URL` | Optional base URL (default: `
|
|
34
|
+
| `TYK_API_PLATFORM_BASE_URL` | Optional base URL (default: `configured.example.com/v1`) |
|
|
35
35
|
|
|
36
36
|
## Library Usage
|
|
37
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, mock } from 'bun:test';
|
|
2
|
-
import { TykApiPlatformClient
|
|
2
|
+
import { TykApiPlatformClient } from './client';
|
|
3
3
|
import { TykApiPlatform } from './index';
|
|
4
4
|
import { TykApiPlatformApiError } from '../types';
|
|
5
5
|
|
|
@@ -9,12 +9,11 @@ function restoreFetch(original: typeof globalThis.fetch) {
|
|
|
9
9
|
|
|
10
10
|
describe('TykApiPlatformClient', () => {
|
|
11
11
|
it('should require an API key', () => {
|
|
12
|
-
expect(() => new TykApiPlatformClient({ apiKey: '' })).toThrow('API key is required');
|
|
12
|
+
expect(() => new TykApiPlatformClient({ apiKey: '', baseUrl: 'https://configured.example.com/v1' })).toThrow('API key is required');
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
it('
|
|
16
|
-
|
|
17
|
-
expect(client.getBaseUrl()).toBe(DEFAULT_BASE_URL);
|
|
15
|
+
it('refuses to send without a configured base URL (no default endpoint)', () => {
|
|
16
|
+
expect(() => new TykApiPlatformClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
|
|
18
17
|
});
|
|
19
18
|
|
|
20
19
|
it('should allow base URL override', () => {
|
|
@@ -39,14 +38,14 @@ describe('TykApiPlatformClient', () => {
|
|
|
39
38
|
);
|
|
40
39
|
}) as any;
|
|
41
40
|
|
|
42
|
-
const client = new TykApiPlatformClient({ apiKey: 'my-api-key' });
|
|
41
|
+
const client = new TykApiPlatformClient({ apiKey: 'my-api-key', baseUrl: 'https://configured.example.com/v1' });
|
|
43
42
|
await client.get('/items');
|
|
44
43
|
|
|
45
44
|
expect(capturedHeaders.Authorization).toBe('Bearer my-api-key');
|
|
46
45
|
restoreFetch(originalFetch);
|
|
47
46
|
});
|
|
48
47
|
|
|
49
|
-
it('should request GET /items on
|
|
48
|
+
it('should request GET /items on the configured base URL', async () => {
|
|
50
49
|
const originalFetch = globalThis.fetch;
|
|
51
50
|
let capturedUrl = '';
|
|
52
51
|
|
|
@@ -60,10 +59,10 @@ describe('TykApiPlatformClient', () => {
|
|
|
60
59
|
);
|
|
61
60
|
}) as any;
|
|
62
61
|
|
|
63
|
-
const client = new TykApiPlatformClient({ apiKey: 'key' });
|
|
62
|
+
const client = new TykApiPlatformClient({ apiKey: 'key', baseUrl: 'https://configured.example.com/v1' });
|
|
64
63
|
await client.get('/items');
|
|
65
64
|
|
|
66
|
-
expect(capturedUrl).toBe(
|
|
65
|
+
expect(capturedUrl).toBe(`https://configured.example.com/v1/items`);
|
|
67
66
|
restoreFetch(originalFetch);
|
|
68
67
|
});
|
|
69
68
|
|
|
@@ -81,10 +80,10 @@ describe('TykApiPlatformClient', () => {
|
|
|
81
80
|
);
|
|
82
81
|
}) as any;
|
|
83
82
|
|
|
84
|
-
const api = new TykApiPlatform({ apiKey: 'key' });
|
|
83
|
+
const api = new TykApiPlatform({ apiKey: 'key', baseUrl: 'https://configured.example.com/v1' });
|
|
85
84
|
await api.getItem('a/b');
|
|
86
85
|
|
|
87
|
-
expect(capturedUrl).toBe(
|
|
86
|
+
expect(capturedUrl).toBe(`https://configured.example.com/v1/items/a%2Fb`);
|
|
88
87
|
restoreFetch(originalFetch);
|
|
89
88
|
});
|
|
90
89
|
|
|
@@ -100,7 +99,7 @@ describe('TykApiPlatformClient', () => {
|
|
|
100
99
|
)
|
|
101
100
|
) as any;
|
|
102
101
|
|
|
103
|
-
const client = new TykApiPlatformClient({ apiKey: 'bad-key' });
|
|
102
|
+
const client = new TykApiPlatformClient({ apiKey: 'bad-key', baseUrl: 'https://configured.example.com/v1' });
|
|
104
103
|
|
|
105
104
|
try {
|
|
106
105
|
await client.get('/items');
|
|
@@ -132,10 +131,10 @@ describe('TykApiPlatformClient', () => {
|
|
|
132
131
|
);
|
|
133
132
|
}) as any;
|
|
134
133
|
|
|
135
|
-
const api = new TykApiPlatform({ apiKey: 'key' });
|
|
134
|
+
const api = new TykApiPlatform({ apiKey: 'key', baseUrl: 'https://configured.example.com/v1' });
|
|
136
135
|
await api.search({ query: 'gateway' });
|
|
137
136
|
|
|
138
|
-
expect(capturedUrl).toBe(
|
|
137
|
+
expect(capturedUrl).toBe(`https://configured.example.com/v1/search`);
|
|
139
138
|
expect(capturedMethod).toBe('POST');
|
|
140
139
|
expect(JSON.parse(capturedBody)).toEqual({ query: 'gateway' });
|
|
141
140
|
|
|
@@ -145,7 +144,7 @@ describe('TykApiPlatformClient', () => {
|
|
|
145
144
|
|
|
146
145
|
describe('TykApiPlatform', () => {
|
|
147
146
|
it('should expose underlying client', () => {
|
|
148
|
-
const api = new TykApiPlatform({ apiKey: 'key' });
|
|
147
|
+
const api = new TykApiPlatform({ apiKey: 'key', baseUrl: 'https://configured.example.com/v1' });
|
|
149
148
|
expect(api.getClient()).toBeInstanceOf(TykApiPlatformClient);
|
|
150
149
|
});
|
|
151
150
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { TykApiPlatformConfig } from '../types';
|
|
2
2
|
import { TykApiPlatformApiError } from '../types';
|
|
3
3
|
|
|
4
|
-
export const DEFAULT_BASE_URL = 'https://api.tykapiplatform.com/v1';
|
|
5
|
-
|
|
6
4
|
export interface RequestOptions {
|
|
7
5
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
8
6
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -19,7 +17,10 @@ export class TykApiPlatformClient {
|
|
|
19
17
|
throw new Error('API key is required');
|
|
20
18
|
}
|
|
21
19
|
this.apiKey = config.apiKey;
|
|
22
|
-
|
|
20
|
+
if (!config.baseUrl) {
|
|
21
|
+
throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
|
|
22
|
+
}
|
|
23
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
getBaseUrl(): string {
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
RawRequestOptions,
|
|
8
8
|
} from '../types';
|
|
9
9
|
|
|
10
|
-
export { TykApiPlatformClient
|
|
10
|
+
export { TykApiPlatformClient } from './client';
|
|
11
11
|
|
|
12
12
|
export class TykApiPlatform {
|
|
13
13
|
private readonly client: TykApiPlatformClient;
|
|
@@ -180,7 +180,7 @@ configCmd
|
|
|
180
180
|
console.log(chalk.bold(`Active Profile: ${profileName}`));
|
|
181
181
|
info(`Config directory: ${getConfigDir()}`);
|
|
182
182
|
info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
|
|
183
|
-
info(`Base URL: ${baseUrl || chalk.gray('
|
|
183
|
+
info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
186
|
configCmd
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Vector Legal API credentials
|
|
2
2
|
VECTOR_LEGAL_API_KEY=your-api-key-here
|
|
3
3
|
|
|
4
|
-
# Optional: custom API base URL (default
|
|
4
|
+
# Optional: custom API base URL (no default - must be configured)
|
|
5
5
|
# VECTOR_LEGAL_BASE_URL=https://api.vector-legal.com/v1
|
|
@@ -10,7 +10,7 @@ Guidance for AI agents working with the Vector Legal connector.
|
|
|
10
10
|
|
|
11
11
|
- **Type**: Bearer API key
|
|
12
12
|
- **Env**: `VECTOR_LEGAL_API_KEY`
|
|
13
|
-
- **Optional**: `VECTOR_LEGAL_BASE_URL` (default
|
|
13
|
+
- **Optional**: `VECTOR_LEGAL_BASE_URL` (no default - must be set)
|
|
14
14
|
|
|
15
15
|
## API Surface
|
|
16
16
|
|
|
@@ -19,7 +19,7 @@ bun run dev -- --help # Show CLI help
|
|
|
19
19
|
|
|
20
20
|
## API Details
|
|
21
21
|
|
|
22
|
-
- **Base URL**:
|
|
22
|
+
- **Base URL**: no default (must be configured) (configurable via `VECTOR_LEGAL_BASE_URL`)
|
|
23
23
|
- **Auth**: Bearer token: `Authorization: Bearer <API_KEY>`
|
|
24
24
|
|
|
25
25
|
## API Resources
|
|
@@ -50,7 +50,7 @@ const docs = await client.documents.list();
|
|
|
50
50
|
| Variable | Description |
|
|
51
51
|
|----------|-------------|
|
|
52
52
|
| `VECTOR_LEGAL_API_KEY` | API key |
|
|
53
|
-
| `VECTOR_LEGAL_BASE_URL` | Optional base URL (default
|
|
53
|
+
| `VECTOR_LEGAL_BASE_URL` | Optional base URL (no default - must be configured) |
|
|
54
54
|
|
|
55
55
|
## License
|
|
56
56
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
|
-
import { ConnectorClient
|
|
2
|
+
import { ConnectorClient } from './client';
|
|
3
3
|
|
|
4
4
|
const realFetch = globalThis.fetch;
|
|
5
5
|
|
|
@@ -47,22 +47,22 @@ afterEach(() => {
|
|
|
47
47
|
describe('Vector Legal API client', () => {
|
|
48
48
|
test('uses default base URL and Bearer auth for GET /documents', async () => {
|
|
49
49
|
const recorded = installFetch();
|
|
50
|
-
const client = new ConnectorClient({ apiKey: 'vector-legal-key' });
|
|
50
|
+
const client = new ConnectorClient({ apiKey: 'vector-legal-key', baseUrl: 'https://configured.example.com/v1' });
|
|
51
51
|
await client.get('/documents');
|
|
52
52
|
|
|
53
53
|
expect(recorded).toHaveLength(1);
|
|
54
|
-
expect(recorded[0].url).toBe(
|
|
54
|
+
expect(recorded[0].url).toBe(`https://configured.example.com/v1/documents`);
|
|
55
55
|
expect(recorded[0].method).toBe('GET');
|
|
56
56
|
expect(headerValue(recorded[0].headers, 'Authorization')).toBe('Bearer vector-legal-key');
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
test('uses default base URL and Bearer auth for GET /documents/:id', async () => {
|
|
60
60
|
const recorded = installFetch();
|
|
61
|
-
const client = new ConnectorClient({ apiKey: 'vector-legal-key' });
|
|
61
|
+
const client = new ConnectorClient({ apiKey: 'vector-legal-key', baseUrl: 'https://configured.example.com/v1' });
|
|
62
62
|
await client.get('/documents/item-1');
|
|
63
63
|
|
|
64
64
|
expect(recorded).toHaveLength(1);
|
|
65
|
-
expect(recorded[0].url).toBe(
|
|
65
|
+
expect(recorded[0].url).toBe(`https://configured.example.com/v1/documents/item-1`);
|
|
66
66
|
expect(recorded[0].method).toBe('GET');
|
|
67
67
|
expect(headerValue(recorded[0].headers, 'Authorization')).toBe('Bearer vector-legal-key');
|
|
68
68
|
});
|
|
@@ -81,4 +81,8 @@ describe('Vector Legal API client', () => {
|
|
|
81
81
|
test('requires API key', () => {
|
|
82
82
|
expect(() => new ConnectorClient({})).toThrow('API key');
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
test('refuses to send without a configured base URL (no default endpoint)', () => {
|
|
86
|
+
expect(() => new ConnectorClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
|
|
87
|
+
});
|
|
84
88
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ConnectorConfig, OutputFormat } from '../types';
|
|
2
2
|
import { ConnectorApiError, parseApiError } from '../types';
|
|
3
3
|
|
|
4
|
-
export const DEFAULT_BASE_URL = 'https://api.vector-legal.com/v1';
|
|
5
|
-
|
|
6
4
|
export interface RequestOptions {
|
|
7
5
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
8
6
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -23,7 +21,10 @@ export class ConnectorClient {
|
|
|
23
21
|
throw new Error('API key, token, or accessToken is required');
|
|
24
22
|
}
|
|
25
23
|
this.apiKey = key;
|
|
26
|
-
|
|
24
|
+
if (!config.baseUrl) {
|
|
25
|
+
throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
|
|
26
|
+
}
|
|
27
|
+
this.baseUrl = config.baseUrl;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
private buildUrl(path: string, params?: Record<string, string | number | boolean | undefined>): string {
|
|
@@ -41,7 +41,7 @@ export class Connector {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export { ConnectorClient
|
|
44
|
+
export { ConnectorClient } from './client';
|
|
45
45
|
export { DocumentsApi } from './documents';
|
|
46
46
|
export { EventsApi } from './events';
|
|
47
47
|
export { SearchApi } from './search';
|
|
@@ -160,7 +160,7 @@ profileCmd
|
|
|
160
160
|
|
|
161
161
|
console.log(chalk.bold(`Profile: ${profileName}${profileName === active ? chalk.green(' (active)') : ''}`));
|
|
162
162
|
info(`API Key: ${config.apiKey ? `${config.apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
|
|
163
|
-
info(`Base URL: ${config.baseUrl || chalk.gray('
|
|
163
|
+
info(`Base URL: ${config.baseUrl || chalk.gray('none configured')}`);
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
// ============================================
|
|
@@ -197,7 +197,7 @@ configCmd
|
|
|
197
197
|
console.log(chalk.bold(`Active Profile: ${profileName}`));
|
|
198
198
|
info(`Config directory: ${getConfigDir()}`);
|
|
199
199
|
info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
|
|
200
|
-
info(`Base URL: ${baseUrl || chalk.gray('
|
|
200
|
+
info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
|
|
201
201
|
});
|
|
202
202
|
|
|
203
203
|
configCmd
|
|
@@ -19,7 +19,7 @@ bun run dev -- --help # Show CLI help
|
|
|
19
19
|
|
|
20
20
|
## API Details
|
|
21
21
|
|
|
22
|
-
- **Base URL**:
|
|
22
|
+
- **Base URL**: no default (must be configured) (configurable via `VECTOR_LEGAL_API_BASE_URL`)
|
|
23
23
|
- **Auth**: Bearer token: `Authorization: Bearer <API_KEY>` (api_key credential field)
|
|
24
24
|
|
|
25
25
|
## API Resources
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# connect-vector-legal-api
|
|
2
2
|
|
|
3
|
-
TypeScript connector for the [Vector Legal API](
|
|
3
|
+
TypeScript connector for the [Vector Legal API](configured.example.com/v1) — legal document management, events, and search.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -30,7 +30,7 @@ bun run dev documents list
|
|
|
30
30
|
| Variable | Required | Description |
|
|
31
31
|
|----------|----------|-------------|
|
|
32
32
|
| `VECTOR_LEGAL_API_KEY` | Yes | API key |
|
|
33
|
-
| `VECTOR_LEGAL_API_BASE_URL` | No | Base URL (default: `
|
|
33
|
+
| `VECTOR_LEGAL_API_BASE_URL` | No | Base URL (default: `configured.example.com/v1`) |
|
|
34
34
|
|
|
35
35
|
## CLI
|
|
36
36
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { afterEach, describe, expect, mock, test } from 'bun:test';
|
|
2
|
-
import {
|
|
2
|
+
import { ConnectorClient } from './client';
|
|
3
|
+
import { Connector } from './index';
|
|
3
4
|
|
|
4
5
|
const realFetch = globalThis.fetch;
|
|
5
6
|
|
|
@@ -30,21 +31,21 @@ function installFetch(): Recorded[] {
|
|
|
30
31
|
describe('Vector Legal API client', () => {
|
|
31
32
|
test('uses default base URL and Bearer auth for list documents', async () => {
|
|
32
33
|
const recorded = installFetch();
|
|
33
|
-
const client = new Connector({ apiKey: 'vector-legal-api-key' });
|
|
34
|
+
const client = new Connector({ apiKey: 'vector-legal-api-key', baseUrl: 'https://configured.example.com/v1' });
|
|
34
35
|
await client.documents.list();
|
|
35
36
|
|
|
36
37
|
expect(recorded).toHaveLength(1);
|
|
37
|
-
expect(recorded[0].url).toBe(
|
|
38
|
+
expect(recorded[0].url).toBe(`https://configured.example.com/v1/documents`);
|
|
38
39
|
expect(recorded[0].method).toBe('GET');
|
|
39
40
|
expect(recorded[0].headers.get('Authorization')).toBe('Bearer vector-legal-api-key');
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
test('get document encodes id in path', async () => {
|
|
43
44
|
const recorded = installFetch();
|
|
44
|
-
const client = new Connector({ apiKey: 'vector-legal-api-key' });
|
|
45
|
+
const client = new Connector({ apiKey: 'vector-legal-api-key', baseUrl: 'https://configured.example.com/v1' });
|
|
45
46
|
await client.documents.get('item-1');
|
|
46
47
|
|
|
47
|
-
expect(recorded[0].url).toBe(
|
|
48
|
+
expect(recorded[0].url).toBe(`https://configured.example.com/v1/documents/item-1`);
|
|
48
49
|
expect(recorded[0].headers.get('Authorization')).toBe('Bearer vector-legal-api-key');
|
|
49
50
|
});
|
|
50
51
|
|
|
@@ -61,10 +62,10 @@ describe('Vector Legal API client', () => {
|
|
|
61
62
|
|
|
62
63
|
test('search posts to /search with body', async () => {
|
|
63
64
|
const recorded = installFetch();
|
|
64
|
-
const client = new Connector({ apiKey: 'test-key' });
|
|
65
|
+
const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
65
66
|
await client.search.search({ query: 'nda' });
|
|
66
67
|
|
|
67
|
-
expect(recorded[0].url).toBe(
|
|
68
|
+
expect(recorded[0].url).toBe(`https://configured.example.com/v1/search`);
|
|
68
69
|
expect(recorded[0].method).toBe('POST');
|
|
69
70
|
});
|
|
70
71
|
|
|
@@ -78,4 +79,8 @@ describe('Vector Legal API client', () => {
|
|
|
78
79
|
test('requires api key', () => {
|
|
79
80
|
expect(() => new Connector({})).toThrow('API key');
|
|
80
81
|
});
|
|
82
|
+
|
|
83
|
+
test('refuses to send without a configured base URL (no default endpoint)', () => {
|
|
84
|
+
expect(() => new ConnectorClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
|
|
85
|
+
});
|
|
81
86
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ConnectorConfig, OutputFormat } from '../types';
|
|
2
2
|
import { ConnectorApiError, parseApiError } from '../types';
|
|
3
3
|
|
|
4
|
-
export const DEFAULT_BASE_URL = 'https://api.vector-legal.com/v1';
|
|
5
|
-
|
|
6
4
|
export interface RequestOptions {
|
|
7
5
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
8
6
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -23,7 +21,10 @@ export class ConnectorClient {
|
|
|
23
21
|
throw new Error('API key or token is required');
|
|
24
22
|
}
|
|
25
23
|
this.apiKey = key;
|
|
26
|
-
|
|
24
|
+
if (!config.baseUrl) {
|
|
25
|
+
throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
|
|
26
|
+
}
|
|
27
|
+
this.baseUrl = config.baseUrl;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
getBaseUrl(): string {
|
|
@@ -38,7 +38,7 @@ export class Connector {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export { ConnectorClient
|
|
41
|
+
export { ConnectorClient } from './client';
|
|
42
42
|
export { DocumentsApi } from './documents';
|
|
43
43
|
export { EventsApi } from './events';
|
|
44
44
|
export { SearchApi } from './search';
|
|
@@ -200,7 +200,7 @@ configCmd
|
|
|
200
200
|
console.log(chalk.bold(`Active Profile: ${getCurrentProfile()}`));
|
|
201
201
|
info(`Config directory: ${getConfigDir()}`);
|
|
202
202
|
info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
|
|
203
|
-
info(`Base URL: ${baseUrl || chalk.gray('
|
|
203
|
+
info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
configCmd
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
VELUM_DATA_QUALITY_API_KEY=your-api-key-here
|
|
4
4
|
|
|
5
|
-
# Optional: override API base URL (default
|
|
5
|
+
# Optional: override API base URL (no default - must be configured)
|
|
6
6
|
# VELUM_DATA_QUALITY_BASE_URL=https://api.velum-data-quality.com/v1
|
|
@@ -18,7 +18,7 @@ bun run dev -- --help # Show CLI help
|
|
|
18
18
|
|
|
19
19
|
## API Details
|
|
20
20
|
|
|
21
|
-
- **Base URL**:
|
|
21
|
+
- **Base URL**: no default (must be configured) (configurable via `VELUM_DATA_QUALITY_BASE_URL`)
|
|
22
22
|
- **Auth**: Bearer token: `Authorization: Bearer <API_KEY>`
|
|
23
23
|
|
|
24
24
|
## API Resources
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
|
-
import { Connector, ConnectorClient
|
|
2
|
+
import { Connector, ConnectorClient } from './index';
|
|
3
3
|
|
|
4
4
|
const realFetch = globalThis.fetch;
|
|
5
5
|
|
|
@@ -48,20 +48,19 @@ describe('Velum Data Quality API client', () => {
|
|
|
48
48
|
expect(() => new ConnectorClient({})).toThrow('API key');
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
expect(client.getBaseUrl()).toBe(DEFAULT_BASE_URL);
|
|
51
|
+
test('refuses to send without a configured base URL (no default endpoint)', () => {
|
|
52
|
+
expect(() => new ConnectorClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
test('listChecks sends Bearer auth to GET /checks', async () => {
|
|
57
56
|
const recorded = installFetch((req) => {
|
|
58
57
|
expect(req.method).toBe('GET');
|
|
59
|
-
expect(req.url).toBe(
|
|
58
|
+
expect(req.url).toBe(`https://configured.example.com/v1/checks`);
|
|
60
59
|
expect(req.headers.authorization).toBe('Bearer velum-test-key');
|
|
61
60
|
return { checks: [{ id: 'chk_1' }] };
|
|
62
61
|
});
|
|
63
62
|
|
|
64
|
-
const connector = new Connector({ apiKey: 'velum-test-key' });
|
|
63
|
+
const connector = new Connector({ apiKey: 'velum-test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
65
64
|
const result = await connector.checks.list();
|
|
66
65
|
expect(result).toEqual({ checks: [{ id: 'chk_1' }] });
|
|
67
66
|
expect(recorded).toHaveLength(1);
|
|
@@ -70,11 +69,11 @@ describe('Velum Data Quality API client', () => {
|
|
|
70
69
|
test('getCheck encodes check ID in path', async () => {
|
|
71
70
|
const recorded = installFetch((req) => {
|
|
72
71
|
expect(req.method).toBe('GET');
|
|
73
|
-
expect(req.url).toBe(
|
|
72
|
+
expect(req.url).toBe(`https://configured.example.com/v1/checks/check%2F123`);
|
|
74
73
|
return { id: 'check/123', status: 'active' };
|
|
75
74
|
});
|
|
76
75
|
|
|
77
|
-
const connector = new Connector({ apiKey: 'velum-test-key' });
|
|
76
|
+
const connector = new Connector({ apiKey: 'velum-test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
78
77
|
const result = await connector.checks.get('check/123');
|
|
79
78
|
expect(result).toEqual({ id: 'check/123', status: 'active' });
|
|
80
79
|
expect(recorded).toHaveLength(1);
|
|
@@ -83,12 +82,12 @@ describe('Velum Data Quality API client', () => {
|
|
|
83
82
|
test('createCheck POSTs JSON body to /checks', async () => {
|
|
84
83
|
const recorded = installFetch((req) => {
|
|
85
84
|
expect(req.method).toBe('POST');
|
|
86
|
-
expect(req.url).toBe(
|
|
85
|
+
expect(req.url).toBe(`https://configured.example.com/v1/checks`);
|
|
87
86
|
expect(req.body).toBe(JSON.stringify({ name: 'freshness' }));
|
|
88
87
|
return { id: 'chk_new', name: 'freshness' };
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
const connector = new Connector({ apiKey: 'velum-test-key' });
|
|
90
|
+
const connector = new Connector({ apiKey: 'velum-test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
92
91
|
const result = await connector.checks.create({ name: 'freshness' });
|
|
93
92
|
expect(result).toEqual({ id: 'chk_new', name: 'freshness' });
|
|
94
93
|
expect(recorded).toHaveLength(1);
|
|
@@ -97,11 +96,11 @@ describe('Velum Data Quality API client', () => {
|
|
|
97
96
|
test('listEvents hits GET /events', async () => {
|
|
98
97
|
const recorded = installFetch((req) => {
|
|
99
98
|
expect(req.method).toBe('GET');
|
|
100
|
-
expect(req.url).toBe(
|
|
99
|
+
expect(req.url).toBe(`https://configured.example.com/v1/events`);
|
|
101
100
|
return { events: [{ id: 'evt_1' }] };
|
|
102
101
|
});
|
|
103
102
|
|
|
104
|
-
const connector = new Connector({ apiKey: 'velum-test-key' });
|
|
103
|
+
const connector = new Connector({ apiKey: 'velum-test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
105
104
|
const result = await connector.events.list();
|
|
106
105
|
expect(result).toEqual({ events: [{ id: 'evt_1' }] });
|
|
107
106
|
expect(recorded).toHaveLength(1);
|
|
@@ -110,12 +109,12 @@ describe('Velum Data Quality API client', () => {
|
|
|
110
109
|
test('search POSTs to /search', async () => {
|
|
111
110
|
const recorded = installFetch((req) => {
|
|
112
111
|
expect(req.method).toBe('POST');
|
|
113
|
-
expect(req.url).toBe(
|
|
112
|
+
expect(req.url).toBe(`https://configured.example.com/v1/search`);
|
|
114
113
|
expect(req.body).toBe(JSON.stringify({ query: 'failed' }));
|
|
115
114
|
return { results: [] };
|
|
116
115
|
});
|
|
117
116
|
|
|
118
|
-
const connector = new Connector({ apiKey: 'velum-test-key' });
|
|
117
|
+
const connector = new Connector({ apiKey: 'velum-test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
119
118
|
const result = await connector.search.search({ query: 'failed' });
|
|
120
119
|
expect(result).toEqual({ results: [] });
|
|
121
120
|
expect(recorded).toHaveLength(1);
|
|
@@ -124,11 +123,11 @@ describe('Velum Data Quality API client', () => {
|
|
|
124
123
|
test('rawRequest supports custom path and method', async () => {
|
|
125
124
|
const recorded = installFetch((req) => {
|
|
126
125
|
expect(req.method).toBe('PATCH');
|
|
127
|
-
expect(req.url).toBe(
|
|
126
|
+
expect(req.url).toBe(`https://configured.example.com/v1/checks/chk_1`);
|
|
128
127
|
return { ok: true };
|
|
129
128
|
});
|
|
130
129
|
|
|
131
|
-
const connector = new Connector({ apiKey: 'velum-test-key' });
|
|
130
|
+
const connector = new Connector({ apiKey: 'velum-test-key', baseUrl: 'https://configured.example.com/v1' });
|
|
132
131
|
await connector.rawRequest({ method: 'PATCH', path: '/checks/chk_1', body: { status: 'paused' } });
|
|
133
132
|
expect(recorded).toHaveLength(1);
|
|
134
133
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ConnectorConfig, OutputFormat } from '../types';
|
|
2
2
|
import { ConnectorApiError, parseApiError } from '../types';
|
|
3
3
|
|
|
4
|
-
export const DEFAULT_BASE_URL = 'https://api.velum-data-quality.com/v1';
|
|
5
|
-
|
|
6
4
|
export interface RequestOptions {
|
|
7
5
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
8
6
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -23,7 +21,10 @@ export class ConnectorClient {
|
|
|
23
21
|
throw new Error('API key, token, or accessToken is required');
|
|
24
22
|
}
|
|
25
23
|
this.apiKey = key;
|
|
26
|
-
|
|
24
|
+
if (!config.baseUrl) {
|
|
25
|
+
throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
|
|
26
|
+
}
|
|
27
|
+
this.baseUrl = config.baseUrl;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
private buildUrl(path: string, params?: Record<string, string | number | boolean | undefined>): string {
|
|
@@ -48,7 +48,7 @@ export class Connector {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export { ConnectorClient
|
|
51
|
+
export { ConnectorClient } from './client';
|
|
52
52
|
export { ChecksApi } from './checks';
|
|
53
53
|
export { EventsApi } from './events';
|
|
54
54
|
export { SearchApi } from './search';
|
|
@@ -226,7 +226,7 @@ configCmd
|
|
|
226
226
|
console.log(chalk.bold(`Active Profile: ${profileName}`));
|
|
227
227
|
info(`Config directory: ${getConfigDir()}`);
|
|
228
228
|
info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
|
|
229
|
-
info(`Base URL: ${baseUrl || chalk.gray('
|
|
229
|
+
info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
configCmd
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Vercel Api Platform API credentials
|
|
2
2
|
VERCEL_API_PLATFORM_API_KEY=your-api-key-here
|
|
3
3
|
|
|
4
|
-
# Optional: override API base URL (default
|
|
4
|
+
# Optional: override API base URL (no default - must be configured)
|
|
5
5
|
# VERCEL_API_PLATFORM_BASE_URL=https://api.vercelapiplatform.com/v1
|
|
@@ -4,11 +4,11 @@ Guidance for working with the Vercel Api Platform connector.
|
|
|
4
4
|
|
|
5
5
|
## Distinction from connect-vercel
|
|
6
6
|
|
|
7
|
-
This connector targets **Vercel Api Platform** at `
|
|
7
|
+
This connector targets **Vercel Api Platform** at `configured.example.com/v1` (items, events, search). It is **not** the same as `connect-vercel`, which wraps `api.vercel.com` for deployments and projects.
|
|
8
8
|
|
|
9
9
|
## API Reference
|
|
10
10
|
|
|
11
|
-
- **Base URL**:
|
|
11
|
+
- **Base URL**: no default (must be configured) (override via profile or `VERCEL_API_PLATFORM_BASE_URL`)
|
|
12
12
|
- **Auth**: Bearer token (`Authorization: Bearer <api_key>`)
|
|
13
13
|
- **Endpoints**:
|
|
14
14
|
- `GET /items` — list items
|