@hasna/connectors 1.4.2 → 1.4.3

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 +1 -5
  2. package/bin/mcp.js +1 -1
  3. package/bin/serve.js +1 -1
  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,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
 
@@ -46,7 +46,7 @@ connect-xai-api-platform raw --path /items [--method GET] [--query '{}'] [--body
46
46
  | Variable | Description |
47
47
  |----------|-------------|
48
48
  | `XAI_API_PLATFORM_API_KEY` | API key (Bearer token) |
49
- | `XAI_API_PLATFORM_BASE_URL` | Optional base URL (default: `https://api.xaiapiplatform.com/v1`) |
49
+ | `XAI_API_PLATFORM_BASE_URL` | Optional base URL (default: `configured.example.com/v1`) |
50
50
 
51
51
  ## Library Usage
52
52
 
@@ -1,4 +1,5 @@
1
1
  import { afterEach, describe, expect, test } from 'bun:test';
2
+ import { XaiApiPlatformClient } from './client';
2
3
  import { XaiApiPlatform } from './index';
3
4
 
4
5
  const realFetch = globalThis.fetch;
@@ -40,12 +41,12 @@ afterEach(() => {
40
41
 
41
42
  describe('XaiApiPlatformClient', () => {
42
43
  const apiKey = 'xai' + '-api-platform-key';
43
- const client = new XaiApiPlatform({ apiKey });
44
+ const client = new XaiApiPlatform({ apiKey, baseUrl: 'https://configured.example.com/v1' });
44
45
 
45
46
  test('listItems uses bearer auth and /items endpoint', async () => {
46
47
  const recorded = installFetch();
47
48
  await client.listItems();
48
- expect(recorded[0].url).toBe('https://api.xaiapiplatform.com/v1/items');
49
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/items');
49
50
  expect(recorded[0].method).toBe('GET');
50
51
  expect(recorded[0].headers.get('Authorization')).toBe(`Bearer ${apiKey}`);
51
52
  });
@@ -53,14 +54,14 @@ describe('XaiApiPlatformClient', () => {
53
54
  test('getItem URL-encodes path segments', async () => {
54
55
  const recorded = installFetch();
55
56
  await client.getItem('item-1');
56
- expect(recorded[0].url).toBe('https://api.xaiapiplatform.com/v1/items/item-1');
57
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/items/item-1');
57
58
  expect(recorded[0].headers.get('Authorization')).toBe(`Bearer ${apiKey}`);
58
59
  });
59
60
 
60
61
  test('createItem posts JSON body to /items', async () => {
61
62
  const recorded = installFetch();
62
63
  await client.createItem({ name: 'test' });
63
- expect(recorded[0].url).toBe('https://api.xaiapiplatform.com/v1/items');
64
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/items');
64
65
  expect(recorded[0].method).toBe('POST');
65
66
  expect(recorded[0].body).toBe(JSON.stringify({ name: 'test' }));
66
67
  });
@@ -68,13 +69,13 @@ describe('XaiApiPlatformClient', () => {
68
69
  test('listEvents hits /events', async () => {
69
70
  const recorded = installFetch();
70
71
  await client.listEvents({ limit: 10 });
71
- expect(recorded[0].url).toBe('https://api.xaiapiplatform.com/v1/events?limit=10');
72
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/events?limit=10');
72
73
  });
73
74
 
74
75
  test('search posts to /search', async () => {
75
76
  const recorded = installFetch();
76
77
  await client.search({ q: 'hello' });
77
- expect(recorded[0].url).toBe('https://api.xaiapiplatform.com/v1/search');
78
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/search');
78
79
  expect(recorded[0].method).toBe('POST');
79
80
  expect(recorded[0].body).toBe(JSON.stringify({ q: 'hello' }));
80
81
  });
@@ -82,11 +83,35 @@ describe('XaiApiPlatformClient', () => {
82
83
  test('rawRequest supports custom path and method', async () => {
83
84
  const recorded = installFetch();
84
85
  await client.rawRequest('/custom', { method: 'POST', body: { a: 1 } });
85
- expect(recorded[0].url).toBe('https://api.xaiapiplatform.com/v1/custom');
86
+ expect(recorded[0].url).toBe('https://configured.example.com/v1/custom');
86
87
  expect(recorded[0].method).toBe('POST');
87
88
  });
88
89
 
89
90
  test('requires API key', () => {
90
- expect(() => new XaiApiPlatform({ apiKey: '' })).toThrow('API key is required');
91
+ expect(() => new XaiApiPlatform({ apiKey: '', baseUrl: 'https://configured.example.com/v1' })).toThrow('API key is required');
92
+ });
93
+
94
+ test('refuses to send without a configured base URL (no default endpoint)', () => {
95
+ expect(() => new XaiApiPlatformClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
96
+ });
97
+
98
+ test('sends the API key only to the configured base URL', async () => {
99
+ const recorded: string[] = [];
100
+ globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => {
101
+ recorded.push(typeof input === 'string' ? input : input.toString());
102
+ return {
103
+ ok: true,
104
+ status: 200,
105
+ statusText: 'OK',
106
+ headers: new Headers({ 'content-type': 'application/json' }),
107
+ async text() { return JSON.stringify({ ok: true }); },
108
+ async json() { return { ok: true }; },
109
+ } as Response;
110
+ }) as typeof fetch;
111
+ const client = new XaiApiPlatformClient({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
112
+ await client.request('/ping');
113
+ expect(recorded).toHaveLength(1);
114
+ expect(recorded[0].startsWith('https://configured.example.com/v1/')).toBe(true);
115
+ expect(recorded[0]).not.toContain('api.xaiapiplatform.com');
91
116
  });
92
117
  });
@@ -1,8 +1,6 @@
1
1
  import type { XaiApiPlatformConfig, RawRequestOptions } from '../types';
2
2
  import { XaiApiPlatformApiError } from '../types';
3
3
 
4
- export const DEFAULT_BASE_URL = 'https://api.xaiapiplatform.com/v1';
5
-
6
4
  export interface RequestOptions extends RawRequestOptions {}
7
5
 
8
6
  export class XaiApiPlatformClient {
@@ -14,7 +12,10 @@ export class XaiApiPlatformClient {
14
12
  throw new Error('API key is required');
15
13
  }
16
14
  this.apiKey = config.apiKey;
17
- this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/$/, '');
15
+ if (!config.baseUrl) {
16
+ throw new Error('baseUrl is required: no default endpoint is configured; set baseUrl (profile, config, or the connector BASE_URL environment variable)');
17
+ }
18
+ this.baseUrl = config.baseUrl.replace(/\/$/, '');
18
19
  }
19
20
 
20
21
  encodePathSegment(segment: string): string {
@@ -57,4 +57,4 @@ export class XaiApiPlatform {
57
57
  }
58
58
  }
59
59
 
60
- export { XaiApiPlatformClient, DEFAULT_BASE_URL } from './client';
60
+ export { XaiApiPlatformClient } from './client';
@@ -1,6 +1,6 @@
1
1
  export { XaiApiPlatform } from './api';
2
2
  export * from './types';
3
- export { XaiApiPlatformClient, DEFAULT_BASE_URL } from './api';
3
+ export { XaiApiPlatformClient } from './api';
4
4
 
5
5
  export {
6
6
  getApiKey,
@@ -1,7 +1,6 @@
1
1
  import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync, rmSync } from 'fs';
2
2
  import { homedir } from 'os';
3
3
  import { join } from 'path';
4
- import { DEFAULT_BASE_URL } from '../api/client';
5
4
 
6
5
  const CONNECTOR_NAME = 'connect-' + 'xai' + '-api-platform';
7
6
  const DEFAULT_PROFILE = 'default';
@@ -125,8 +124,8 @@ export function getApiKey(): string | undefined {
125
124
  return process.env.XAI_API_PLATFORM_API_KEY || loadProfile().apiKey;
126
125
  }
127
126
 
128
- export function getBaseUrl(): string {
129
- return process.env.XAI_API_PLATFORM_BASE_URL || loadProfile().baseUrl || DEFAULT_BASE_URL;
127
+ export function getBaseUrl(): string | undefined {
128
+ return process.env.XAI_API_PLATFORM_BASE_URL || loadProfile().baseUrl;
130
129
  }
131
130
 
132
131
  export function setApiKey(apiKey: string): void {
@@ -8,7 +8,7 @@ connect-zapier-api-platform is a TypeScript connector for the Zapier API Platfor
8
8
 
9
9
  ## API Reference
10
10
 
11
- - **Base URL**: `https://api.zapierapiplatform.com/v1`
11
+ - **Base URL**: no default (must be configured)
12
12
  - **Auth**: Bearer token (`Authorization: Bearer <api_key>`)
13
13
  - **Override**: `ZAPIER_API_PLATFORM_BASE_URL` environment variable
14
14
 
@@ -1,6 +1,6 @@
1
1
  # @hasna/connect-zapier-api-platform
2
2
 
3
- TypeScript connector for the [Zapier API Platform](https://api.zapierapiplatform.com/v1).
3
+ TypeScript connector for the [Zapier API Platform](configured.example.com/v1).
4
4
 
5
5
  ## Features
6
6
 
@@ -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
 
@@ -38,43 +39,43 @@ afterEach(() => {
38
39
  describe('Zapier API Platform client', () => {
39
40
  test('listItems uses default base URL and Bearer auth', async () => {
40
41
  const recorded = installFetch();
41
- const client = new Connector({ apiKey: 'test-key' });
42
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
42
43
  await client.items.list();
43
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/items`);
44
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/items`);
44
45
  expect(recorded[0].method).toBe('GET');
45
46
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer test-key');
46
47
  });
47
48
 
48
49
  test('getItem encodes item ID in path', async () => {
49
50
  const recorded = installFetch();
50
- const client = new Connector({ apiKey: 'test-key' });
51
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
51
52
  await client.items.get('item-1');
52
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/items/item-1`);
53
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/items/item-1`);
53
54
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer test-key');
54
55
  });
55
56
 
56
57
  test('createItem POSTs JSON body to /items', async () => {
57
58
  const recorded = installFetch();
58
- const client = new Connector({ apiKey: 'test-key' });
59
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
59
60
  await client.items.create({ name: 'example' });
60
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/items`);
61
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/items`);
61
62
  expect(recorded[0].method).toBe('POST');
62
63
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer test-key');
63
64
  });
64
65
 
65
66
  test('listEvents hits /events', async () => {
66
67
  const recorded = installFetch();
67
- const client = new Connector({ apiKey: 'test-key' });
68
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
68
69
  await client.events.list();
69
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/events`);
70
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/events`);
70
71
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer test-key');
71
72
  });
72
73
 
73
74
  test('search POSTs to /search', async () => {
74
75
  const recorded = installFetch();
75
- const client = new Connector({ apiKey: 'test-key' });
76
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
76
77
  await client.search.search({ query: 'test' });
77
- expect(recorded[0].url).toBe(`${DEFAULT_BASE_URL}/search`);
78
+ expect(recorded[0].url).toBe(`https://configured.example.com/v1/search`);
78
79
  expect(recorded[0].method).toBe('POST');
79
80
  expect(recorded[0].headers.get('Authorization')).toBe('Bearer test-key');
80
81
  });
@@ -127,7 +128,7 @@ describe('Zapier API Platform client', () => {
127
128
  } as Response;
128
129
  }) as unknown as typeof fetch;
129
130
 
130
- const client = new Connector({ apiKey: 'test-key' });
131
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
131
132
  await expect(client.items.list()).resolves.toEqual({ ok: true });
132
133
  expect(calls).toBe(2);
133
134
  });
@@ -137,7 +138,7 @@ describe('Zapier API Platform client', () => {
137
138
  throw new DOMException('The operation was aborted.', 'AbortError');
138
139
  }) as unknown as typeof fetch;
139
140
 
140
- const client = new Connector({ apiKey: 'test-key' });
141
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
141
142
  await expect(client.getClient().request('/items', { retries: 0, timeout: 5 })).rejects.toThrow('Request timeout after 5ms');
142
143
  });
143
144
 
@@ -160,7 +161,11 @@ describe('Zapier API Platform client', () => {
160
161
  } as Response;
161
162
  }) as unknown as typeof fetch;
162
163
 
163
- const client = new Connector({ apiKey: 'test-key' });
164
+ const client = new Connector({ apiKey: 'test-key', baseUrl: 'https://configured.example.com/v1' });
164
165
  await expect(client.getClient().request('/items', { retries: 0, timeout: 5 })).rejects.toThrow('Request timeout after 5ms');
165
166
  });
167
+
168
+ test('refuses to send without a configured base URL (no default endpoint)', () => {
169
+ expect(() => new ConnectorClient({ apiKey: 'test-key' })).toThrow(/baseUrl/);
170
+ });
166
171
  });
@@ -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.zapierapiplatform.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('Zapier API Platform API key is required');
24
22
  }
25
23
  this.apiKey = key;
26
- this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, '');
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.replace(/\/+$/, '');
27
28
  }
28
29
 
29
30
  private buildUrl(path: string, params?: Record<string, string | number | boolean | undefined>): string {
@@ -45,7 +45,7 @@ export class Connector {
45
45
  }
46
46
  }
47
47
 
48
- export { ConnectorClient, DEFAULT_BASE_URL } from './client';
48
+ export { ConnectorClient } from './client';
49
49
  export { ItemsApi } from './items';
50
50
  export { EventsApi } from './events';
51
51
  export { SearchApi } from './search';
@@ -173,7 +173,7 @@ configCmd
173
173
  console.log(chalk.bold(`Active Profile: ${profileName}`));
174
174
  info(`Config directory: ${getConfigDir()}`);
175
175
  info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
176
- info(`Base URL: ${process.env.ZAPIER_API_PLATFORM_BASE_URL || chalk.gray('default (https://api.zapierapiplatform.com/v1)')}`);
176
+ info(`Base URL: ${process.env.ZAPIER_API_PLATFORM_BASE_URL || chalk.gray('none configured')}`);
177
177
  });
178
178
 
179
179
  configCmd
@@ -3,7 +3,7 @@
3
3
  export { Connector } from './api';
4
4
  export * from './types';
5
5
 
6
- export { ConnectorClient, ItemsApi, EventsApi, SearchApi, RawApi, DEFAULT_BASE_URL } from './api';
6
+ export { ConnectorClient, ItemsApi, EventsApi, SearchApi, RawApi } from './api';
7
7
 
8
8
  export {
9
9
  getApiKey,
package/dist/index.js CHANGED
@@ -5764,7 +5764,7 @@ function extractGoogleError(body) {
5764
5764
  // package.json
5765
5765
  var package_default = {
5766
5766
  name: "@hasna/connectors",
5767
- version: "1.4.2",
5767
+ version: "1.4.3",
5768
5768
  description: "Open source connector library - Install API connectors with a single command",
5769
5769
  type: "module",
5770
5770
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {