@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.
Files changed (168) hide show
  1. package/bin/index.js +145 -98
  2. package/bin/mcp.js +1 -1
  3. package/bin/serve.js +144 -93
  4. package/connectors/clickbank/README.md +2 -2
  5. package/connectors/split-in-batches/CLAUDE.md +1 -1
  6. package/connectors/split-in-batches/README.md +1 -1
  7. package/connectors/split-in-batches/src/api/client.test.ts +16 -17
  8. package/connectors/split-in-batches/src/api/client.ts +4 -3
  9. package/connectors/split-in-batches/src/cli/index.ts +1 -1
  10. package/connectors/spreadsheet-file/.env.example +1 -1
  11. package/connectors/spreadsheet-file/CLAUDE.md +2 -2
  12. package/connectors/spreadsheet-file/README.md +3 -3
  13. package/connectors/spreadsheet-file/src/api/client.test.ts +8 -9
  14. package/connectors/spreadsheet-file/src/api/client.ts +4 -3
  15. package/connectors/spreadsheet-file/src/cli/index.ts +1 -1
  16. package/connectors/sse-trigger/.env.example +1 -1
  17. package/connectors/sse-trigger/CLAUDE.md +2 -2
  18. package/connectors/sse-trigger/README.md +1 -1
  19. package/connectors/sse-trigger/src/api/client.test.ts +12 -8
  20. package/connectors/sse-trigger/src/api/client.ts +4 -3
  21. package/connectors/sse-trigger/src/api/index.ts +1 -1
  22. package/connectors/sse-trigger/src/cli/index.ts +1 -1
  23. package/connectors/sse-trigger/src/index.ts +1 -1
  24. package/connectors/stability-api-platform/AGENTS.md +1 -1
  25. package/connectors/stability-api-platform/CLAUDE.md +1 -1
  26. package/connectors/stability-api-platform/README.md +2 -2
  27. package/connectors/stability-api-platform/src/api/client.test.ts +17 -12
  28. package/connectors/stability-api-platform/src/api/client.ts +4 -3
  29. package/connectors/stability-api-platform/src/api/index.ts +0 -1
  30. package/connectors/stability-api-platform/src/cli/index.ts +1 -1
  31. package/connectors/stability-api-platform/src/index.ts +0 -1
  32. package/connectors/stop-and-error/.env.example +1 -1
  33. package/connectors/stop-and-error/CLAUDE.md +1 -1
  34. package/connectors/stop-and-error/README.md +1 -1
  35. package/connectors/stop-and-error/src/api/client.test.ts +12 -8
  36. package/connectors/stop-and-error/src/api/client.ts +4 -3
  37. package/connectors/stop-and-error/src/cli/index.ts +2 -2
  38. package/connectors/stripe-financial-connections/.env.example +1 -1
  39. package/connectors/stripe-financial-connections/CLAUDE.md +2 -2
  40. package/connectors/stripe-financial-connections/src/api/client.test.ts +34 -0
  41. package/connectors/stripe-financial-connections/src/api/client.ts +4 -3
  42. package/connectors/stripe-financial-connections/src/cli/index.ts +1 -1
  43. package/connectors/sucuri-api-platform/.env.example +1 -1
  44. package/connectors/sucuri-api-platform/CLAUDE.md +1 -1
  45. package/connectors/sucuri-api-platform/README.md +2 -2
  46. package/connectors/sucuri-api-platform/src/api/client.test.ts +9 -7
  47. package/connectors/sucuri-api-platform/src/api/client.ts +4 -3
  48. package/connectors/sucuri-api-platform/src/api/index.ts +1 -1
  49. package/connectors/sucuri-api-platform/src/cli/index.ts +1 -1
  50. package/connectors/sucuri-api-platform/src/index.ts +1 -1
  51. package/connectors/tettra-api-platform/CLAUDE.md +1 -1
  52. package/connectors/tettra-api-platform/README.md +2 -2
  53. package/connectors/tettra-api-platform/src/api/client.test.ts +7 -8
  54. package/connectors/tettra-api-platform/src/api/client.ts +4 -3
  55. package/connectors/tettra-api-platform/src/api/index.ts +1 -1
  56. package/connectors/tettra-api-platform/src/cli/index.ts +1 -1
  57. package/connectors/tettra-api-platform/src/index.ts +1 -1
  58. package/connectors/together-api-platform/.env.example +1 -1
  59. package/connectors/together-api-platform/CLAUDE.md +1 -1
  60. package/connectors/together-api-platform/README.md +1 -1
  61. package/connectors/together-api-platform/src/api/client.test.ts +11 -7
  62. package/connectors/together-api-platform/src/api/client.ts +4 -4
  63. package/connectors/together-api-platform/src/api/index.ts +1 -1
  64. package/connectors/together-api-platform/src/cli/index.ts +1 -1
  65. package/connectors/together-api-platform/src/index.ts +1 -1
  66. package/connectors/travo-real-estate/CLAUDE.md +1 -1
  67. package/connectors/travo-real-estate/README.md +1 -1
  68. package/connectors/travo-real-estate/src/api/client.test.ts +20 -16
  69. package/connectors/travo-real-estate/src/api/client.ts +4 -3
  70. package/connectors/travo-real-estate/src/utils/config.ts +2 -4
  71. package/connectors/tray-api-platform/CLAUDE.md +1 -1
  72. package/connectors/tray-api-platform/src/api/client.test.ts +17 -13
  73. package/connectors/tray-api-platform/src/api/client.ts +4 -3
  74. package/connectors/tray-api-platform/src/api/index.ts +1 -1
  75. package/connectors/tray-api-platform/src/cli/index.ts +1 -1
  76. package/connectors/tray-api-platform/src/index.ts +0 -1
  77. package/connectors/turso-api-platform/CLAUDE.md +1 -1
  78. package/connectors/turso-api-platform/README.md +2 -2
  79. package/connectors/turso-api-platform/src/api/client.test.ts +17 -13
  80. package/connectors/turso-api-platform/src/api/client.ts +4 -3
  81. package/connectors/turso-api-platform/src/cli/index.ts +2 -2
  82. package/connectors/twilio-api-platform/CLAUDE.md +1 -1
  83. package/connectors/twilio-api-platform/src/api/client.test.ts +11 -11
  84. package/connectors/twilio-api-platform/src/api/client.ts +4 -3
  85. package/connectors/twilio-api-platform/src/api/index.ts +1 -1
  86. package/connectors/twilio-api-platform/src/cli/index.ts +1 -1
  87. package/connectors/twilio-api-platform/src/index.ts +1 -1
  88. package/connectors/tyk-api-platform/.env.example +1 -1
  89. package/connectors/tyk-api-platform/CLAUDE.md +2 -2
  90. package/connectors/tyk-api-platform/README.md +1 -1
  91. package/connectors/tyk-api-platform/src/api/client.test.ts +14 -15
  92. package/connectors/tyk-api-platform/src/api/client.ts +4 -3
  93. package/connectors/tyk-api-platform/src/api/index.ts +1 -1
  94. package/connectors/tyk-api-platform/src/cli/index.ts +1 -1
  95. package/connectors/tyk-api-platform/src/index.ts +1 -1
  96. package/connectors/vector-legal/.env.example +1 -1
  97. package/connectors/vector-legal/AGENTS.md +1 -1
  98. package/connectors/vector-legal/CLAUDE.md +1 -1
  99. package/connectors/vector-legal/README.md +1 -1
  100. package/connectors/vector-legal/src/api/client.test.ts +9 -5
  101. package/connectors/vector-legal/src/api/client.ts +4 -3
  102. package/connectors/vector-legal/src/api/index.ts +1 -1
  103. package/connectors/vector-legal/src/cli/index.ts +2 -2
  104. package/connectors/vector-legal/src/index.ts +0 -1
  105. package/connectors/vector-legal-api/CLAUDE.md +1 -1
  106. package/connectors/vector-legal-api/README.md +2 -2
  107. package/connectors/vector-legal-api/src/api/client.test.ts +12 -7
  108. package/connectors/vector-legal-api/src/api/client.ts +4 -3
  109. package/connectors/vector-legal-api/src/api/index.ts +1 -1
  110. package/connectors/vector-legal-api/src/cli/index.ts +1 -1
  111. package/connectors/vector-legal-api/src/index.ts +1 -2
  112. package/connectors/velum-data-quality/.env.example +1 -1
  113. package/connectors/velum-data-quality/CLAUDE.md +1 -1
  114. package/connectors/velum-data-quality/src/api/client.test.ts +15 -16
  115. package/connectors/velum-data-quality/src/api/client.ts +4 -3
  116. package/connectors/velum-data-quality/src/api/index.ts +1 -1
  117. package/connectors/velum-data-quality/src/cli/index.ts +1 -1
  118. package/connectors/velum-data-quality/src/index.ts +0 -1
  119. package/connectors/vercel-api-platform/.env.example +1 -1
  120. package/connectors/vercel-api-platform/CLAUDE.md +2 -2
  121. package/connectors/vercel-api-platform/README.md +2 -2
  122. package/connectors/vercel-api-platform/src/api/client.test.ts +27 -6
  123. package/connectors/vercel-api-platform/src/api/client.ts +4 -3
  124. package/connectors/vercel-api-platform/src/api/index.ts +1 -1
  125. package/connectors/vercel-api-platform/src/cli/index.ts +2 -2
  126. package/connectors/vercel-api-platform/src/index.ts +0 -1
  127. package/connectors/veriphone/README.md +2 -2
  128. package/connectors/wave-accounting/CLAUDE.md +1 -1
  129. package/connectors/wave-accounting/src/utils/auth.ts +1 -1
  130. package/connectors/weaviate-api-platform/CLAUDE.md +1 -1
  131. package/connectors/weaviate-api-platform/src/api/client.test.ts +32 -7
  132. package/connectors/weaviate-api-platform/src/api/client.ts +4 -3
  133. package/connectors/weaviate-api-platform/src/api/index.ts +1 -1
  134. package/connectors/weaviate-api-platform/src/cli/index.ts +1 -1
  135. package/connectors/weaviate-api-platform/src/index.ts +1 -1
  136. package/connectors/workflow-trigger/.env.example +1 -1
  137. package/connectors/workflow-trigger/CLAUDE.md +1 -1
  138. package/connectors/workflow-trigger/README.md +1 -1
  139. package/connectors/workflow-trigger/src/api/client.test.ts +10 -6
  140. package/connectors/workflow-trigger/src/api/client.ts +4 -3
  141. package/connectors/workflow-trigger/src/cli/index.ts +1 -1
  142. package/connectors/write-binary-file/CLAUDE.md +1 -1
  143. package/connectors/write-binary-file/README.md +1 -1
  144. package/connectors/write-binary-file/src/api/client.test.ts +16 -12
  145. package/connectors/write-binary-file/src/api/client.ts +4 -3
  146. package/connectors/write-binary-file/src/api/index.ts +1 -1
  147. package/connectors/write-binary-file/src/index.ts +1 -1
  148. package/connectors/wubookratechecker/src/api/client.test.ts +34 -0
  149. package/connectors/wubookratechecker/src/api/client.ts +3 -1
  150. package/connectors/wubookratechecker/src/api/index.ts +1 -1
  151. package/connectors/wubookratechecker/src/types/index.ts +1 -1
  152. package/connectors/xai-api-platform/.env.example +1 -1
  153. package/connectors/xai-api-platform/CLAUDE.md +1 -1
  154. package/connectors/xai-api-platform/README.md +1 -1
  155. package/connectors/xai-api-platform/src/api/client.test.ts +33 -8
  156. package/connectors/xai-api-platform/src/api/client.ts +4 -3
  157. package/connectors/xai-api-platform/src/api/index.ts +1 -1
  158. package/connectors/xai-api-platform/src/index.ts +1 -1
  159. package/connectors/xai-api-platform/src/utils/config.ts +2 -3
  160. package/connectors/zapier-api-platform/CLAUDE.md +1 -1
  161. package/connectors/zapier-api-platform/README.md +1 -1
  162. package/connectors/zapier-api-platform/src/api/client.test.ts +19 -14
  163. package/connectors/zapier-api-platform/src/api/client.ts +4 -3
  164. package/connectors/zapier-api-platform/src/api/index.ts +1 -1
  165. package/connectors/zapier-api-platform/src/cli/index.ts +1 -1
  166. package/connectors/zapier-api-platform/src/index.ts +1 -1
  167. package/dist/index.js +1 -1
  168. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  # @hasna/connect-vercel-api-platform
2
2
 
3
- TypeScript connector and CLI for the [Vercel Api Platform](https://api.vercelapiplatform.com/v1) REST API.
3
+ TypeScript connector and CLI for the [Vercel Api Platform](configured.example.com/v1) REST API.
4
4
 
5
5
  > **Note:** This is distinct from `@hasna/connect-vercel`, which targets `api.vercel.com` for Vercel deployments.
6
6
 
@@ -15,7 +15,7 @@ bun add @hasna/connect-vercel-api-platform
15
15
  ```bash
16
16
  export VERCEL_API_PLATFORM_API_KEY=your-api-key
17
17
  # optional
18
- export VERCEL_API_PLATFORM_BASE_URL=https://api.vercelapiplatform.com/v1
18
+ export VERCEL_API_PLATFORM_BASE_URL=https://configured.example.com/v1
19
19
  ```
20
20
 
21
21
  Or use the CLI profile/config commands.
@@ -1,5 +1,5 @@
1
1
  import { describe, test, expect, mock, beforeEach, afterEach } from 'bun:test';
2
- import { ConnectorClient, DEFAULT_BASE_URL } from './client';
2
+ import { ConnectorClient } from './client';
3
3
  import { Connector } from './index';
4
4
  import { ConnectorApiError } from '../types';
5
5
 
@@ -38,10 +38,9 @@ describe('ConnectorClient', () => {
38
38
  expect(client.getBaseUrl()).toBe(TEST_BASE_URL);
39
39
  });
40
40
 
41
- test('uses default base URL when not provided', () => {
42
- const client = new ConnectorClient({ apiKey: 'key' });
43
- expect(client.getBaseUrl()).toBe(DEFAULT_BASE_URL);
44
- });
41
+ test('refuses to send without a configured base URL (no default endpoint)', () => {
42
+ expect(() => new ConnectorClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
43
+ });
45
44
 
46
45
  test('strips trailing slashes from base URL', () => {
47
46
  const client = new ConnectorClient({ apiKey: 'key', baseUrl: 'https://api.example.com/v1///' });
@@ -56,7 +55,7 @@ describe('ConnectorClient', () => {
56
55
  });
57
56
 
58
57
  test('returns *** for short keys', () => {
59
- const client = new ConnectorClient({ apiKey: 'short' });
58
+ const client = new ConnectorClient({ apiKey: 'short', baseUrl: 'https://configured.example.com/v1' });
60
59
  expect(client.getApiKeyPreview()).toBe('***');
61
60
  });
62
61
  });
@@ -198,10 +197,32 @@ describe('Connector API modules', () => {
198
197
  test('raw.request uses configured base URL override', async () => {
199
198
  const connector = new Connector({
200
199
  apiKey: 'key',
200
+ baseUrl: 'https://configured.example.com/v1',
201
+ baseUrl: 'https://configured.example.com/v1',
201
202
  baseUrl: 'https://override.example.com/v1',
202
203
  });
203
204
  await connector.raw.request({ path: '/items', method: 'GET' });
204
205
  const [url] = getFetchMock().mock.calls[0];
205
206
  expect(url).toBe('https://override.example.com/v1/items');
206
207
  });
208
+
209
+ test('sends the API key only to the configured base URL', async () => {
210
+ const recorded: string[] = [];
211
+ globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => {
212
+ recorded.push(typeof input === 'string' ? input : input.toString());
213
+ return {
214
+ ok: true,
215
+ status: 200,
216
+ statusText: 'OK',
217
+ headers: new Headers({ 'content-type': 'application/json' }),
218
+ async text() { return JSON.stringify({ ok: true }); },
219
+ async json() { return { ok: true }; },
220
+ } as Response;
221
+ }) as typeof fetch;
222
+ const client = new ConnectorClient({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
223
+ await client.request('/ping');
224
+ expect(recorded).toHaveLength(1);
225
+ expect(recorded[0].startsWith('https://configured.example.com/v1/')).toBe(true);
226
+ expect(recorded[0]).not.toContain('api.vercelapiplatform.com');
227
+ });
207
228
  });
@@ -1,8 +1,6 @@
1
1
  import type { ConnectorConfig } from '../types';
2
2
  import { ConnectorApiError, parseApiError } from '../types';
3
3
 
4
- export const DEFAULT_BASE_URL = 'https://api.vercelapiplatform.com/v1';
5
-
6
4
  export interface RequestOptions {
7
5
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
8
6
  params?: Record<string, string | number | boolean | undefined>;
@@ -22,7 +20,10 @@ export class ConnectorClient {
22
20
  throw new Error('API key, token, or accessToken is required');
23
21
  }
24
22
  this.apiKey = key;
25
- this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, '');
23
+ if (!config.baseUrl) {
24
+ throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
25
+ }
26
+ this.baseUrl = config.baseUrl.replace(/\/+$/, '');
26
27
  }
27
28
 
28
29
  getBaseUrl(): string {
@@ -41,7 +41,7 @@ export class Connector {
41
41
  }
42
42
  }
43
43
 
44
- export { ConnectorClient, DEFAULT_BASE_URL } from './client';
44
+ export { ConnectorClient } from './client';
45
45
  export { ItemsApi } from './items';
46
46
  export { EventsApi } from './events';
47
47
  export { SearchApi } from './search';
@@ -140,7 +140,7 @@ profileCmd.command('show [name]').description('Show profile configuration').acti
140
140
  const active = getCurrentProfile();
141
141
  console.log(chalk.bold(`Profile: ${profileName}${profileName === active ? chalk.green(' (active)') : ''}`));
142
142
  info(`API Key: ${config.apiKey ? `${config.apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
143
- info(`Base URL: ${config.baseUrl || chalk.gray('default (https://api.vercelapiplatform.com/v1)')}`);
143
+ info(`Base URL: ${config.baseUrl || chalk.gray('none configured')}`);
144
144
  });
145
145
 
146
146
  const configCmd = program.command('config').description('Manage CLI configuration');
@@ -162,7 +162,7 @@ configCmd.command('show').description('Show current configuration').action(() =>
162
162
  console.log(chalk.bold(`Active Profile: ${profileName}`));
163
163
  info(`Config directory: ${getConfigDir()}`);
164
164
  info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
165
- info(`Base URL: ${baseUrl || chalk.gray('default (https://api.vercelapiplatform.com/v1)')}`);
165
+ info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
166
166
  });
167
167
 
168
168
  configCmd.command('clear').description('Clear configuration for active profile').action(() => {
@@ -9,7 +9,6 @@ export {
9
9
  EventsApi,
10
10
  SearchApi,
11
11
  RawApi,
12
- DEFAULT_BASE_URL,
13
12
  } from './api';
14
13
 
15
14
  export {
@@ -21,7 +21,7 @@ bun install
21
21
  Set your API key via environment variable or CLI profile:
22
22
 
23
23
  ```bash
24
- export VERIPHONE_API_KEY=your-api-key-here
24
+ export VERIPHONE_API_KEY=<your-api-key>
25
25
  # or
26
26
  bun run dev config set-key your-api-key-here
27
27
  ```
@@ -35,7 +35,7 @@ Get an API key at [veriphone.io](https://veriphone.io).
35
35
  bun run dev verify "+4915123577723"
36
36
 
37
37
  # With default country hint
38
- bun run dev verify "015123577723" --default-country DE
38
+ bun run dev verify "0151-23577723" --default-country DE
39
39
 
40
40
  # Use POST method
41
41
  bun run dev verify "+14155552671" --method post
@@ -29,7 +29,7 @@ bun test
29
29
  ## Authentication
30
30
 
31
31
  - **Bearer token (dev):** Full-access token from Wave developer portal
32
- - **OAuth2 (production):** Scopes per https://developer.waveapps.com/hc/en-us/articles/360032818132-OAuth-Scopes
32
+ - **OAuth2 (production):** Scopes per the Wave OAuth scopes documentation (developer.waveapps.com)
33
33
 
34
34
  Auth type: `oauth` / `bearer`
35
35
 
@@ -6,7 +6,7 @@ const DEFAULT_AUTH_URL = 'https://api.waveapps.com/oauth2/authorize/';
6
6
  const DEFAULT_TOKEN_URL = 'https://api.waveapps.com/oauth2/token/';
7
7
 
8
8
  // Wave OAuth scopes for accounting/invoicing operations
9
- // https://developer.waveapps.com/hc/en-us/articles/360032818132-OAuth-Scopes
9
+ // (see developer.waveapps.com OAuth scopes documentation)
10
10
  const DEFAULT_SCOPES = [
11
11
  'business:read',
12
12
  'invoice:read',
@@ -23,7 +23,7 @@ Bearer token via `Authorization: Bearer <api_key>` header.
23
23
  ## Base URL
24
24
 
25
25
  ```
26
- https://api.weaviateapiplatform.com/v1
26
+ configured.example.com/v1
27
27
  ```
28
28
 
29
29
  Override with profile `baseUrl` or `WEAVIATE_API_PLATFORM_BASE_URL`.
@@ -1,5 +1,6 @@
1
1
  import { afterEach, describe, expect, test } from 'bun:test';
2
- import { Connector, DEFAULT_BASE_URL } from './index';
2
+ import { ConnectorClient } from './client';
3
+ import { Connector } from './index';
3
4
 
4
5
  const realFetch = globalThis.fetch;
5
6
 
@@ -44,25 +45,25 @@ afterEach(() => {
44
45
  describe('WeaviateApiPlatform client', () => {
45
46
  test('uses bearer auth and default base URL for listItems', async () => {
46
47
  const recorded = installFetch();
47
- const client = new Connector({ apiKey: 'test-api-key' });
48
+ const client = new Connector({ apiKey: 'test-api-key', baseUrl: 'https://configured.example.com/v1' });
48
49
  await client.listItems();
49
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/items`);
50
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/items`);
50
51
  expect(recorded[0].method).toBe('GET');
51
52
  expect(recorded[0].headers.authorization || recorded[0].headers.Authorization).toBe('Bearer test-api-key');
52
53
  });
53
54
 
54
55
  test('encodes item IDs in getItem path', async () => {
55
56
  const recorded = installFetch();
56
- const client = new Connector({ apiKey: 'test-api-key' });
57
+ const client = new Connector({ apiKey: 'test-api-key', baseUrl: 'https://configured.example.com/v1' });
57
58
  await client.getItem('item/with/slash');
58
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/items/${encodeURIComponent('item/with/slash')}`);
59
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/items/${encodeURIComponent('item/with/slash')}`);
59
60
  });
60
61
 
61
62
  test('posts search body to /search', async () => {
62
63
  const recorded = installFetch();
63
- const client = new Connector({ apiKey: 'test-api-key' });
64
+ const client = new Connector({ apiKey: 'test-api-key', baseUrl: 'https://configured.example.com/v1' });
64
65
  await client.search({ query: 'hello', limit: 5 });
65
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/search`);
66
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/search`);
66
67
  expect(recorded[0].method).toBe('POST');
67
68
  expect(recorded[0].body).toBe(JSON.stringify({ query: 'hello', limit: 5 }));
68
69
  });
@@ -80,4 +81,28 @@ describe('WeaviateApiPlatform client', () => {
80
81
  test('requires API key', () => {
81
82
  expect(() => new Connector({})).toThrow('API key is required');
82
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
+ });
88
+
89
+ test('sends the API key only to the configured base URL', async () => {
90
+ const recorded: string[] = [];
91
+ globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => {
92
+ recorded.push(typeof input === 'string' ? input : input.toString());
93
+ return {
94
+ ok: true,
95
+ status: 200,
96
+ statusText: 'OK',
97
+ headers: new Headers({ 'content-type': 'application/json' }),
98
+ async text() { return JSON.stringify({ ok: true }); },
99
+ async json() { return { ok: true }; },
100
+ } as Response;
101
+ }) as typeof fetch;
102
+ const client = new ConnectorClient({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
103
+ await client.request('/ping');
104
+ expect(recorded).toHaveLength(1);
105
+ expect(recorded[0].startsWith('https://configured.example.com/v1/')).toBe(true);
106
+ expect(recorded[0]).not.toContain('api.weaviateapiplatform.com');
107
+ });
83
108
  });
@@ -1,8 +1,6 @@
1
1
  import type { ConnectorConfig, RawRequestOptions } from '../types';
2
2
  import { ConnectorApiError, parseApiError } from '../types';
3
3
 
4
- export const DEFAULT_BASE_URL = 'https://api.weaviateapiplatform.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>;
@@ -22,7 +20,10 @@ export class ConnectorClient {
22
20
  throw new Error('Weaviate API Platform API key is required');
23
21
  }
24
22
  this.apiKey = key;
25
- this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/$/, '');
23
+ if (!config.baseUrl) {
24
+ throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
25
+ }
26
+ this.baseUrl = config.baseUrl.replace(/\/$/, '');
26
27
  }
27
28
 
28
29
  getBaseUrl(): string {
@@ -56,4 +56,4 @@ export class Connector {
56
56
  }
57
57
  }
58
58
 
59
- export { ConnectorClient, DEFAULT_BASE_URL } from './client';
59
+ export { ConnectorClient } from './client';
@@ -166,7 +166,7 @@ configCmd.command('show').description('Show current configuration').action(() =>
166
166
  console.log(chalk.bold(`Active Profile: ${profileName}`));
167
167
  info(`Config directory: ${getConfigDir()}`);
168
168
  info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
169
- info(`Base URL: ${baseUrl || chalk.gray('https://api.weaviateapiplatform.com/v1 (default)')}`);
169
+ info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
170
170
  });
171
171
 
172
172
  configCmd.command('clear').description('Clear configuration for active profile').action(() => {
@@ -1,6 +1,6 @@
1
1
  // Weaviate API Platform Connector
2
2
 
3
- export { Connector, ConnectorClient, DEFAULT_BASE_URL } from './api';
3
+ export { Connector, ConnectorClient } from './api';
4
4
  export * from './types';
5
5
 
6
6
  export {
@@ -1,5 +1,5 @@
1
1
  # WorkflowTrigger API credentials (placeholders only)
2
2
  WORKFLOW_TRIGGER_API_KEY=your-api-key-here
3
3
 
4
- # Optional: override API base URL (default: https://api.workflow-trigger.com/v1)
4
+ # Optional: override API base URL (no default - must be configured)
5
5
  # WORKFLOW_TRIGGER_BASE_URL=https://api.workflow-trigger.com/v1
@@ -56,7 +56,7 @@ src/
56
56
 
57
57
  ## API Details
58
58
 
59
- - **Base URL**: `https://api.workflow-trigger.com/v1` (override with `WORKFLOW_TRIGGER_BASE_URL`)
59
+ - **Base URL**: no default (must be configured) (override with `WORKFLOW_TRIGGER_BASE_URL`)
60
60
  - **Auth**: Bearer token (`Authorization: Bearer <api_key>`)
61
61
  - **Endpoints**:
62
62
  - `GET /triggers` - List triggers
@@ -13,7 +13,7 @@ bun install
13
13
  ```bash
14
14
  export WORKFLOW_TRIGGER_API_KEY=your-api-key
15
15
  # optional:
16
- export WORKFLOW_TRIGGER_BASE_URL=https://api.workflow-trigger.com/v1
16
+ export WORKFLOW_TRIGGER_BASE_URL=https://configured.example.com/v1
17
17
  ```
18
18
 
19
19
  Or use the CLI profile:
@@ -54,22 +54,22 @@ describe('WorkflowTrigger API client', () => {
54
54
 
55
55
  test('list triggers uses Bearer auth and GET /triggers', async () => {
56
56
  const recorded = installFetch(() => ({ data: [] }));
57
- const client = new ConnectorClient({ apiKey: 'test-key' });
57
+ const client = new ConnectorClient({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
58
58
  await client.get('/triggers');
59
59
 
60
60
  expect(recorded).toHaveLength(1);
61
- expect(recorded[0].url).toBe('https://api.workflow-trigger.com/v1/triggers');
61
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/triggers');
62
62
  expect(recorded[0].method).toBe('GET');
63
63
  expect(recorded[0].headers.Authorization || recorded[0].headers.authorization).toBe('Bearer test-key');
64
64
  });
65
65
 
66
66
  test('get trigger encodes ID in path', async () => {
67
67
  const recorded = installFetch(() => ({ id: 'item-1' }));
68
- const connector = new Connector({ apiKey: 'workflow-trigger-key' });
68
+ const connector = new Connector({ apiKey: 'workflow-trigger-key', baseUrl: 'https://configured.example.com/v1' });
69
69
  await connector.triggers.get('item-1');
70
70
 
71
71
  expect(recorded).toHaveLength(1);
72
- expect(recorded[0].url).toBe('https://api.workflow-trigger.com/v1/triggers/item-1');
72
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/triggers/item-1');
73
73
  expect(recorded[0].headers.Authorization || recorded[0].headers.authorization).toBe('Bearer workflow-trigger-key');
74
74
  });
75
75
 
@@ -86,10 +86,14 @@ describe('WorkflowTrigger API client', () => {
86
86
 
87
87
  test('search posts to /search', async () => {
88
88
  const recorded = installFetch(() => ({ results: [] }));
89
- const connector = new Connector({ apiKey: 'key' });
89
+ const connector = new Connector({ apiKey: 'key', baseUrl: 'https://configured.example.com/v1' });
90
90
  await connector.search.search({ query: 'test' });
91
91
 
92
- expect(recorded[0].url).toBe('https://api.workflow-trigger.com/v1/search');
92
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/search');
93
93
  expect(recorded[0].method).toBe('POST');
94
94
  });
95
+
96
+ test('refuses to send without a configured base URL (no default endpoint)', () => {
97
+ expect(() => new ConnectorClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
98
+ });
95
99
  });
@@ -2,8 +2,6 @@ import type { ConnectorConfig } from '../types';
2
2
  import { ConnectorApiError, parseApiError } from '../types';
3
3
  import type { RawRequestParams } from '../types';
4
4
 
5
- const DEFAULT_BASE_URL = 'https://api.workflow-trigger.com/v1';
6
-
7
5
  export interface RequestOptions {
8
6
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
9
7
  params?: Record<string, string | number | boolean | undefined>;
@@ -23,7 +21,10 @@ export class ConnectorClient {
23
21
  throw new Error('WorkflowTrigger API key is required');
24
22
  }
25
23
  this.apiKey = key;
26
- this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
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 {
@@ -204,7 +204,7 @@ configCmd
204
204
  console.log(chalk.bold(`Active Profile: ${profileName}`));
205
205
  info(`Config directory: ${getConfigDir()}`);
206
206
  info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
207
- info(`Base URL: ${baseUrl || chalk.gray('default (https://api.workflow-trigger.com/v1)')}`);
207
+ info(`Base URL: ${baseUrl || chalk.gray('none configured')}`);
208
208
  });
209
209
 
210
210
  configCmd
@@ -19,7 +19,7 @@ bun run typecheck
19
19
 
20
20
  API key bearer auth. Set via profile config, `WRITE_BINARY_FILE_API_KEY`, or `--api-key`.
21
21
 
22
- Default base URL: `https://api.write-binary-file.com/v1`
22
+ Default base URL: none (must be configured)
23
23
 
24
24
  ## API Surface
25
25
 
@@ -1,6 +1,6 @@
1
1
  # connect-write-binary-file
2
2
 
3
- TypeScript connector and CLI for the [Write Binary File](https://api.write-binary-file.com) REST API.
3
+ TypeScript connector and CLI for the [Write Binary File](configured.example.com/v1) REST API.
4
4
 
5
5
  ## Features
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { afterEach, describe, expect, test } from 'bun:test';
2
- import { DEFAULT_BASE_URL, WriteBinaryFileClient } from './client';
2
+ import { WriteBinaryFileClient } from './client';
3
3
 
4
4
  const realFetch = globalThis.fetch;
5
5
 
@@ -36,46 +36,50 @@ afterEach(() => {
36
36
  describe('WriteBinaryFileClient transport', () => {
37
37
  test('listFiles uses bearer auth and default base URL', async () => {
38
38
  const recorded = installFetch();
39
- const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key' });
39
+ const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key', baseUrl: 'https://configured.example.com/v1' });
40
40
  await client.listFiles();
41
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/files`);
41
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/files`);
42
42
  expect(recorded[0].method).toBe('GET');
43
43
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer write-binary-file-key');
44
44
  });
45
45
 
46
46
  test('getFile encodes file id in path', async () => {
47
47
  const recorded = installFetch();
48
- const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key' });
48
+ const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key', baseUrl: 'https://configured.example.com/v1' });
49
49
  await client.getFile('item-1');
50
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/files/item-1`);
50
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/files/item-1`);
51
51
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer write-binary-file-key');
52
52
  });
53
53
 
54
54
  test('createFile posts JSON body', async () => {
55
55
  const recorded = installFetch();
56
- const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key' });
56
+ const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key', baseUrl: 'https://configured.example.com/v1' });
57
57
  await client.createFile({ name: 'demo.bin' });
58
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/files`);
58
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/files`);
59
59
  expect(recorded[0].method).toBe('POST');
60
60
  });
61
61
 
62
62
  test('search posts to /search', async () => {
63
63
  const recorded = installFetch();
64
- const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key' });
64
+ const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key', baseUrl: 'https://configured.example.com/v1' });
65
65
  await client.search({ q: 'report' });
66
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/search`);
66
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/search`);
67
67
  expect(recorded[0].method).toBe('POST');
68
68
  });
69
69
 
70
70
  test('rawRequest honors custom path and method', async () => {
71
71
  const recorded = installFetch();
72
- const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key' });
72
+ const client = new WriteBinaryFileClient({ apiKey: 'write-binary-file-key', baseUrl: 'https://configured.example.com/v1' });
73
73
  await client.rawRequest({ path: '/events', method: 'GET', query: { limit: 5 } });
74
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/events?limit=5`);
74
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/events?limit=5`);
75
75
  expect(recorded[0].method).toBe('GET');
76
76
  });
77
77
 
78
78
  test('requires api key', () => {
79
- expect(() => new WriteBinaryFileClient({ apiKey: '' })).toThrow('API key is required');
79
+ expect(() => new WriteBinaryFileClient({ apiKey: '', baseUrl: 'https://configured.example.com/v1' })).toThrow('API key is required');
80
+ });
81
+
82
+ test('refuses to send without a configured base URL (no default endpoint)', () => {
83
+ expect(() => new WriteBinaryFileClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
80
84
  });
81
85
  });
@@ -6,8 +6,6 @@ import {
6
6
  type WriteBinaryFileConfig,
7
7
  } from '../types';
8
8
 
9
- export const DEFAULT_BASE_URL = 'https://api.write-binary-file.com/v1';
10
-
11
9
  export function encodePathSegment(value: string): string {
12
10
  return encodeURIComponent(value);
13
11
  }
@@ -32,7 +30,10 @@ export class WriteBinaryFileClient {
32
30
  throw new Error('API key is required');
33
31
  }
34
32
  this.apiKey = config.apiKey;
35
- this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/$/, '');
33
+ if (!config.baseUrl) {
34
+ throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
35
+ }
36
+ this.baseUrl = config.baseUrl.replace(/\/$/, '');
36
37
  }
37
38
 
38
39
  private buildUrl(path: string, query?: Record<string, string | number | boolean | undefined>): string {
@@ -53,4 +53,4 @@ export class WriteBinaryFile {
53
53
  }
54
54
  }
55
55
 
56
- export { WriteBinaryFileClient, DEFAULT_BASE_URL, encodePathSegment } from './client';
56
+ export { WriteBinaryFileClient, encodePathSegment } from './client';
@@ -2,7 +2,7 @@
2
2
 
3
3
  export { WriteBinaryFile } from './api';
4
4
  export * from './types';
5
- export { WriteBinaryFileClient, DEFAULT_BASE_URL, encodePathSegment } from './api';
5
+ export { WriteBinaryFileClient, encodePathSegment } from './api';
6
6
 
7
7
  export {
8
8
  getApiKey,
@@ -0,0 +1,34 @@
1
+ import { afterEach, describe, expect, test } from 'bun:test';
2
+ import { WuBookrateClient } from './client';
3
+
4
+ const realFetch = globalThis.fetch;
5
+
6
+ afterEach(() => {
7
+ globalThis.fetch = realFetch;
8
+ });
9
+
10
+ describe('WuBookrateClient transport', () => {
11
+ test('refuses to send without a configured base URL (no default endpoint)', () => {
12
+ expect(() => new WuBookrateClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
13
+ });
14
+
15
+ test('sends the API key only to the configured base URL', async () => {
16
+ const recorded: string[] = [];
17
+ globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => {
18
+ recorded.push(typeof input === 'string' ? input : input.toString());
19
+ return {
20
+ ok: true,
21
+ status: 200,
22
+ statusText: 'OK',
23
+ headers: new Headers({ 'content-type': 'application/json' }),
24
+ async text() { return JSON.stringify({ ok: true }); },
25
+ async json() { return { ok: true }; },
26
+ } as Response;
27
+ }) as typeof fetch;
28
+ const client = new WuBookrateClient({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
29
+ await client.request('/ping');
30
+ expect(recorded).toHaveLength(1);
31
+ expect(recorded[0].startsWith('https://configured.example.com/v1/')).toBe(true);
32
+ expect(recorded[0]).not.toContain('api.wubookratechecker.com');
33
+ });
34
+ });
@@ -3,11 +3,13 @@ import { WuBookrateApiError } from '../types';
3
3
 
4
4
  export class WuBookrateClient {
5
5
  private readonly apiKey: string;
6
- private readonly baseUrl = 'https://api.wubookratechecker.com/v1';
6
+ private readonly baseUrl: string;
7
7
 
8
8
  constructor(config: WuBookrateConfig) {
9
9
  if (!config.apiKey) throw new Error('Wu Bookrate Checker apiKey is required');
10
+ if (!config.baseUrl) throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
10
11
  this.apiKey = config.apiKey;
12
+ this.baseUrl = config.baseUrl;
11
13
  }
12
14
 
13
15
  async request<T>(path: string, params?: Record<string, string | number | undefined>): Promise<T> {
@@ -9,7 +9,7 @@ export class WuBookrateChecker {
9
9
  static fromEnv(): WuBookrateChecker {
10
10
  const apiKey = process.env.WUBOOKRATE_API_KEY;
11
11
  if (!apiKey) throw new Error('WUBOOKRATE_API_KEY is required');
12
- return new WuBookrateChecker({ apiKey });
12
+ return new WuBookrateChecker({ apiKey, baseUrl: process.env.WUBOOKRATE_BASE_URL });
13
13
  }
14
14
 
15
15
  async lookupByISBN(isbn: string): Promise<WBBook> { return this.client.request<WBBook>(`/books/${isbn}`); }
@@ -1,4 +1,4 @@
1
- export interface WuBookrateConfig { apiKey: string; }
1
+ export interface WuBookrateConfig { apiKey: string; baseUrl?: string; }
2
2
 
3
3
  export interface WBBook { isbn: string; title: string; author: string; publisher: string; published_date: string; average_rating: number; ratings_count: number; image_url: string; }
4
4
  export interface WBReview { source: string; rating: number; review_count: number; url: string; }
@@ -3,5 +3,5 @@
3
3
 
4
4
  XAI_API_PLATFORM_API_KEY=
5
5
 
6
- # Optional: override the API base URL (default: https://api.xaiapiplatform.com/v1)
6
+ # Optional: override the API base URL (no default - must be configured)
7
7
  # XAI_API_PLATFORM_BASE_URL=https://api.xaiapiplatform.com/v1
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code when working with the Xai API Platfor
4
4
 
5
5
  ## Project Overview
6
6
 
7
- `connect-xai-api-platform` is a TypeScript CLI and library for the Xai API Platform REST API at `https://api.xaiapiplatform.com/v1`. It is **distinct** from `connect-xai` (Grok at `api.x.ai`).
7
+ `connect-xai-api-platform` is a TypeScript CLI and library for the Xai API Platform REST API at `configured.example.com/v1`. It is **distinct** from `connect-xai` (Grok at `api.x.ai`).
8
8
 
9
9
  ## Build & Run Commands
10
10