@amigo-ai/platform-sdk 0.4.0 → 0.4.2

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 (57) hide show
  1. package/README.md +147 -55
  2. package/api.md +354 -0
  3. package/dist/core/errors.js +26 -4
  4. package/dist/core/errors.js.map +1 -1
  5. package/dist/core/openapi-client.js +108 -6
  6. package/dist/core/openapi-client.js.map +1 -1
  7. package/dist/core/retry.js +5 -2
  8. package/dist/core/retry.js.map +1 -1
  9. package/dist/core/utils.js +48 -2
  10. package/dist/core/utils.js.map +1 -1
  11. package/dist/core/webhooks.js +8 -2
  12. package/dist/core/webhooks.js.map +1 -1
  13. package/dist/index.cjs +268 -40
  14. package/dist/index.cjs.map +4 -4
  15. package/dist/index.js +50 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +268 -40
  18. package/dist/index.mjs.map +4 -4
  19. package/dist/types/core/errors.d.ts +6 -0
  20. package/dist/types/core/errors.d.ts.map +1 -1
  21. package/dist/types/core/openapi-client.d.ts +24 -1
  22. package/dist/types/core/openapi-client.d.ts.map +1 -1
  23. package/dist/types/core/retry.d.ts +1 -1
  24. package/dist/types/core/retry.d.ts.map +1 -1
  25. package/dist/types/core/utils.d.ts +27 -1
  26. package/dist/types/core/utils.d.ts.map +1 -1
  27. package/dist/types/core/webhooks.d.ts.map +1 -1
  28. package/dist/types/index.d.ts +40 -2
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/dist/types/resources/actions.d.ts +5 -5
  31. package/dist/types/resources/agents.d.ts +7 -7
  32. package/dist/types/resources/analytics.d.ts +11 -11
  33. package/dist/types/resources/api-keys.d.ts +4 -4
  34. package/dist/types/resources/audit.d.ts +6 -6
  35. package/dist/types/resources/billing.d.ts +6 -6
  36. package/dist/types/resources/calls.d.ts +6 -6
  37. package/dist/types/resources/compliance.d.ts +3 -3
  38. package/dist/types/resources/context-graphs.d.ts +7 -7
  39. package/dist/types/resources/data-sources.d.ts +6 -6
  40. package/dist/types/resources/functions.d.ts +6 -6
  41. package/dist/types/resources/integrations.d.ts +6 -6
  42. package/dist/types/resources/memory.d.ts +3 -3
  43. package/dist/types/resources/operators.d.ts +18 -18
  44. package/dist/types/resources/personas.d.ts +4 -4
  45. package/dist/types/resources/phone-numbers.d.ts +5 -5
  46. package/dist/types/resources/recordings.d.ts +2 -2
  47. package/dist/types/resources/review-queue.d.ts +17 -17
  48. package/dist/types/resources/safety.d.ts +5 -5
  49. package/dist/types/resources/services.d.ts +4 -4
  50. package/dist/types/resources/settings.d.ts +14 -14
  51. package/dist/types/resources/simulations.d.ts +6 -6
  52. package/dist/types/resources/skills.d.ts +5 -5
  53. package/dist/types/resources/triggers.d.ts +8 -8
  54. package/dist/types/resources/webhook-destinations.d.ts +6 -6
  55. package/dist/types/resources/workspaces.d.ts +5 -5
  56. package/dist/types/resources/world.d.ts +18 -18
  57. package/package.json +10 -4
package/README.md CHANGED
@@ -23,29 +23,43 @@ const client = new AmigoClient({
23
23
  })
24
24
 
25
25
  // List agents
26
- const { items: agents } = await client.agents.list()
27
-
28
- // Emit a world event
29
- await client.world.emitEvent({
30
- entity_id: 'entity-id',
31
- event_type: 'appointment_scheduled',
32
- data: { appointment_id: 'appt-001' },
26
+ const { items: agents } = await client.agents.list({ limit: 10 })
27
+ console.log(agents.map((agent) => agent.name))
28
+
29
+ // Search entities in the world model
30
+ const entityResults = await client.world.listEntities({
31
+ q: 'Jane Doe',
32
+ entity_type: ['patient'],
33
+ limit: 5,
33
34
  })
35
+ console.log(entityResults.entities[0]?.display_name)
34
36
 
35
37
  // Get call analytics for the last 30 days
36
- const stats = await client.analytics.getCalls({ period: '30d' })
38
+ const stats = await client.analytics.getCalls({ days: 30 })
37
39
  console.log(stats.total_calls, stats.avg_duration_seconds)
38
40
  ```
39
41
 
42
+ ## Examples and Docs
43
+
44
+ - Product docs and API reference: [docs.amigo.ai](https://docs.amigo.ai/)
45
+ - Repo-local SDK examples: [examples/README.md](./examples/README.md)
46
+ - Repo-local API surface guide: [api.md](./api.md)
47
+
48
+ The docs site remains the primary reference. The examples in this repo stay close to the package surface and are typechecked in CI to reduce drift.
49
+
40
50
  ## Configuration
41
51
 
42
- | Option | Type | Required | Description |
43
- |--------|------|----------|-------------|
44
- | `apiKey` | `string` | Yes | Your Platform API key — create one at Workspace Settings > API Keys |
45
- | `workspaceId` | `string` | Yes | Your workspace ID — all resource operations are scoped to this |
46
- | `baseUrl` | `string` | No | Override the API base URL (default: `https://api.platform.amigo.ai`) |
47
- | `retry` | `RetryOptions` | No | Retry configuration for transient failures |
48
- | `fetch` | `typeof fetch` | No | Custom fetch for BFF proxy, cookie forwarding, or test mocking |
52
+ | Option | Type | Required | Description |
53
+ | ------------- | -------------- | -------- | -------------------------------------------------------------------- |
54
+ | `apiKey` | `string` | Yes | Your Platform API key — create one at Workspace Settings > API Keys |
55
+ | `workspaceId` | `string` | Yes | Your workspace ID — all resource operations are scoped to this |
56
+ | `baseUrl` | `string` | No | Override the API base URL (default: `https://api.platform.amigo.ai`) |
57
+ | `retry` | `RetryOptions` | No | Retry configuration for transient failures |
58
+ | `maxRetries` | `number` | No | Convenience alias for retry count |
59
+ | `timeout` | `number` | No | Default request timeout in milliseconds |
60
+ | `headers` | `HeadersInit` | No | Default headers added to every request |
61
+ | `hooks` | `ClientHooks` | No | Request/response lifecycle hooks for tracing or logging |
62
+ | `fetch` | `typeof fetch` | No | Custom fetch for BFF proxy, cookie forwarding, or test mocking |
49
63
 
50
64
  ### Retry options
51
65
 
@@ -54,8 +68,8 @@ const client = new AmigoClient({
54
68
  apiKey: 'your-key',
55
69
  workspaceId: 'your-workspace-id',
56
70
  retry: {
57
- maxAttempts: 3, // Total attempts including first. Default: 3
58
- baseDelayMs: 250, // Base delay for exponential backoff. Default: 250
71
+ maxAttempts: 3, // Total attempts including first. Default: 3
72
+ baseDelayMs: 250, // Base delay for exponential backoff. Default: 250
59
73
  maxDelayMs: 30000, // Cap on delay. Default: 30_000
60
74
  },
61
75
  })
@@ -63,6 +77,17 @@ const client = new AmigoClient({
63
77
 
64
78
  GET requests are retried on 408, 429, 500, 502, 503, 504. POST requests are only retried on 429 with a `Retry-After` header. Backoff uses full jitter.
65
79
 
80
+ ### Runtime requirements
81
+
82
+ The SDK is built around web-standard primitives. Use it in runtimes that provide:
83
+
84
+ - `fetch`, `Request`, `Response`, `Headers`, `URL`
85
+ - `AbortController`
86
+ - `TextEncoder` / `TextDecoder`
87
+ - `crypto.subtle` for webhook signature verification
88
+
89
+ CI currently validates Node-based packaging and runtime behavior. Standards-based edge/server runtimes with the same APIs work well with the low-level request wrappers.
90
+
66
91
  ## Generated Types
67
92
 
68
93
  The SDK ships with generated OpenAPI types and re-exports them for direct use:
@@ -71,8 +96,7 @@ The SDK ships with generated OpenAPI types and re-exports them for direct use:
71
96
  import type { components, operations, paths } from '@amigo-ai/platform-sdk'
72
97
 
73
98
  type Agent = components['schemas']['AgentResponse']
74
- type ListAgentsQuery =
75
- operations['list_agents_v1__workspace_id__agents_get']['parameters']['query']
99
+ type ListAgentsQuery = operations['list_agents_v1__workspace_id__agents_get']['parameters']['query']
76
100
  ```
77
101
 
78
102
  Public builds are generated from the committed [`openapi.json`](./openapi.json) snapshot in this repo so type output stays deterministic across machines and CI runs. When you need to refresh that snapshot, run:
@@ -81,6 +105,76 @@ Public builds are generated from the committed [`openapi.json`](./openapi.json)
81
105
  npm run openapi:sync
82
106
  ```
83
107
 
108
+ For a repo-local overview of the exported client surface, see [api.md](./api.md).
109
+
110
+ ## Advanced request control
111
+
112
+ Resource wrappers cover the common path. For lower-level control, use the built-in typed HTTP helpers. Workspace-scoped routes automatically receive your configured `workspaceId`.
113
+
114
+ ```typescript
115
+ const result = await client.GET('/v1/{workspace_id}/agents', {
116
+ params: { query: { limit: 10 } },
117
+ timeout: 5_000,
118
+ maxRetries: 1,
119
+ headers: { 'X-Debug-Trace': 'true' },
120
+ })
121
+
122
+ console.log(result.requestId)
123
+ console.log(result.data.items)
124
+ console.log(result.rateLimit.remaining)
125
+ ```
126
+
127
+ Available helpers:
128
+
129
+ - `client.GET(...)`
130
+ - `client.POST(...)`
131
+ - `client.PUT(...)`
132
+ - `client.PATCH(...)`
133
+ - `client.DELETE(...)`
134
+ - `client.HEAD(...)`
135
+ - `client.OPTIONS(...)`
136
+
137
+ ### Response metadata
138
+
139
+ Object responses from resource methods include non-enumerable request metadata:
140
+
141
+ ```typescript
142
+ const agent = await client.agents.get('agent-id')
143
+
144
+ console.log(agent._request_id)
145
+ console.log(agent.lastResponse.statusCode)
146
+ console.log(agent.lastResponse.rateLimit.remaining)
147
+ ```
148
+
149
+ Low-level request helpers return the raw `Response` alongside parsed data:
150
+
151
+ ```typescript
152
+ const { data, response, requestId } = await client.GET('/v1/{workspace_id}/agents')
153
+
154
+ console.log(requestId)
155
+ console.log(response.headers.get('content-type'))
156
+ console.log(data.items)
157
+ ```
158
+
159
+ ### Request hooks
160
+
161
+ Use hooks for logging, tracing, and metrics without wrapping `fetch` yourself:
162
+
163
+ ```typescript
164
+ const client = new AmigoClient({
165
+ apiKey: 'your-api-key',
166
+ workspaceId: 'your-workspace-id',
167
+ hooks: {
168
+ onRequest({ request, schemaPath }) {
169
+ console.log('request', request.method, schemaPath)
170
+ },
171
+ onResponse({ response, requestId }) {
172
+ console.log('response', response.status, requestId)
173
+ },
174
+ },
175
+ })
176
+ ```
177
+
84
178
  ## Resources
85
179
 
86
180
  ### Agents
@@ -157,25 +251,27 @@ console.log(service.agent_name, service.channel_type, service.version_sets)
157
251
  The world model tracks entities (patients, contacts, appointments) and the events that flow through them.
158
252
 
159
253
  ```typescript
160
- // Create an entity
161
- const patient = await client.world.createEntity({
162
- entity_type: 'patient',
163
- canonical_id: 'MRN-12345',
164
- display_name: 'Jane Doe',
254
+ // Filter entities with simple list queries
255
+ const patients = await client.world.listEntities({
256
+ q: 'Jane Doe',
257
+ entity_type: ['patient'],
258
+ limit: 10,
165
259
  })
260
+ console.log(patients.entities.length)
166
261
 
167
- // Emit an event
168
- await client.world.emitEvent({
169
- entity_id: patient.id,
170
- event_type: 'call_completed',
171
- data: { duration_seconds: 180, outcome: 'appointment_scheduled' },
172
- })
262
+ // Get a single entity
263
+ const patient = await client.world.getEntity('entity-id')
264
+ console.log(patient.display_name, patient.entity_type)
173
265
 
174
266
  // Query timeline
175
- const timeline = await client.world.getTimeline(patient.id)
267
+ const timeline = await client.world.getTimeline('entity-id', { limit: 20 })
176
268
 
177
- // Search entities
178
- const results = await client.world.search('Jane Doe', { entity_type: 'patient' })
269
+ // Semantic search over the world model
270
+ const results = await client.world.search({
271
+ q: 'Jane Doe',
272
+ entity_type: 'patient',
273
+ limit: 5,
274
+ })
179
275
 
180
276
  // View sync status from connectors
181
277
  const syncStatus = await client.world.getSyncStatusBySink()
@@ -209,7 +305,7 @@ console.log(dashboard.call_volume.value, dashboard.call_volume.delta_pct)
209
305
  console.log(dashboard.avg_quality.value)
210
306
 
211
307
  // Call volume time series
212
- const calls = await client.analytics.getCalls({ period: '30d' })
308
+ const calls = await client.analytics.getCalls({ days: 30, interval: '1d' })
213
309
  console.log(calls.total_calls, calls.calls_by_date)
214
310
 
215
311
  // Per-agent performance
@@ -247,11 +343,9 @@ console.log(analytics.coverage_rate, analytics.total_facts)
247
343
  const { items: integrations } = await client.integrations.list({ enabled: true })
248
344
 
249
345
  // Test a specific endpoint
250
- const result = await client.integrations.testEndpoint(
251
- 'integration-id',
252
- 'geocode',
253
- { textQuery: '123 Main St, Springfield' },
254
- )
346
+ const result = await client.integrations.testEndpoint('integration-id', 'geocode', {
347
+ textQuery: '123 Main St, Springfield',
348
+ })
255
349
  ```
256
350
 
257
351
  ### Data Sources
@@ -390,10 +484,7 @@ const deliveries = await client.webhookDestinations.listDeliveries(dest.id)
390
484
  Use the raw request body when verifying webhook deliveries. Timestamped signatures are replay-protected by default.
391
485
 
392
486
  ```typescript
393
- import {
394
- parseWebhookEvent,
395
- WebhookVerificationError,
396
- } from '@amigo-ai/platform-sdk'
487
+ import { parseWebhookEvent, WebhookVerificationError } from '@amigo-ai/platform-sdk'
397
488
 
398
489
  const body = await request.text()
399
490
 
@@ -482,18 +573,19 @@ Webhook verification errors are separate from API transport errors and throw `We
482
573
 
483
574
  ### Error classes
484
575
 
485
- | Class | HTTP Status | Description |
486
- |-------|-------------|-------------|
487
- | `BadRequestError` | 400 | Malformed request |
488
- | `AuthenticationError` | 401 | Invalid or expired API key |
489
- | `PermissionError` | 403 | Insufficient permissions |
490
- | `NotFoundError` | 404 | Resource does not exist |
491
- | `ConflictError` | 409 | Duplicate slug or version conflict |
492
- | `ValidationError` | 422 | Request body validation failure |
493
- | `RateLimitError` | 429 | Too many requests — check `.retryAfter` |
494
- | `ServerError` | 5xx | Server-side error |
495
- | `ConfigurationError` | — | SDK misconfiguration at init time |
496
- | `NetworkError` | — | Fetch/network failure |
576
+ | Class | HTTP Status | Description |
577
+ | --------------------- | ----------- | --------------------------------------- |
578
+ | `BadRequestError` | 400 | Malformed request |
579
+ | `AuthenticationError` | 401 | Invalid or expired API key |
580
+ | `PermissionError` | 403 | Insufficient permissions |
581
+ | `NotFoundError` | 404 | Resource does not exist |
582
+ | `ConflictError` | 409 | Duplicate slug or version conflict |
583
+ | `ValidationError` | 422 | Request body validation failure |
584
+ | `RateLimitError` | 429 | Too many requests — check `.retryAfter` |
585
+ | `ServerError` | 5xx | Server-side error |
586
+ | `ConfigurationError` | — | SDK misconfiguration at init time |
587
+ | `NetworkError` | — | Fetch/network failure |
588
+ | `RequestTimeoutError` | — | Request exceeded the configured timeout |
497
589
 
498
590
  ## CommonJS (CJS) usage
499
591
 
package/api.md ADDED
@@ -0,0 +1,354 @@
1
+ # API Surface
2
+
3
+ Repo-local reference for the public TypeScript SDK surface. This document complements the product docs and stays focused on the package exports that ship from this repository.
4
+
5
+ ## Client
6
+
7
+ ### `AmigoClient`
8
+
9
+ Configuration fields:
10
+
11
+ - `apiKey: string`
12
+ - `workspaceId: string`
13
+ - `baseUrl?: string`
14
+ - `retry?: RetryOptions`
15
+ - `maxRetries?: number`
16
+ - `timeout?: number`
17
+ - `headers?: HeadersInit`
18
+ - `hooks?: ClientHooks`
19
+ - `fetch?: typeof fetch`
20
+
21
+ Instance fields:
22
+
23
+ - `workspaceId: string`
24
+ - `baseUrl: string`
25
+
26
+ Low-level typed request helpers:
27
+
28
+ - `GET(path, options?)`
29
+ - `POST(path, options?)`
30
+ - `PUT(path, options?)`
31
+ - `PATCH(path, options?)`
32
+ - `DELETE(path, options?)`
33
+ - `HEAD(path, options?)`
34
+ - `OPTIONS(path, options?)`
35
+
36
+ Notes:
37
+
38
+ - Workspace-scoped paths such as `/v1/{workspace_id}/agents` receive `workspaceId` automatically.
39
+ - Low-level helpers return `AmigoResponse<T>` with `data`, `response`, `requestId`, and `rateLimit`.
40
+ - Object responses from resource methods include `_request_id` and `lastResponse` metadata.
41
+
42
+ ## Core exports
43
+
44
+ - Errors: `AmigoError`, `BadRequestError`, `AuthenticationError`, `PermissionError`, `NotFoundError`, `ConflictError`, `ValidationError`, `RateLimitError`, `ServerError`, `ServiceUnavailableError`, `NetworkError`, `RequestTimeoutError`, `ParseError`, `ConfigurationError`
45
+ - Error guards: `isAmigoError`, `isNotFoundError`, `isRateLimitError`, `isAuthenticationError`, `isRequestTimeoutError`
46
+ - Webhooks: `verifyWebhookSignature`, `parseWebhookEvent`, `WebhookVerificationError`
47
+ - Pagination: `paginate`
48
+ - Rate limit helpers: `parseRateLimitHeaders`
49
+ - Response helpers: `extractRequestId`, `buildLastResponse`
50
+ - Generated types: `components`, `operations`, `paths`
51
+
52
+ ## Response types
53
+
54
+ - `AmigoRequestOptions<T>`
55
+ - `AmigoResponse<T>`
56
+ - `ResponseMetadata`
57
+ - `LastResponseInfo`
58
+ - `RetryOptions`
59
+ - `RateLimitInfo`
60
+ - `ClientHooks`
61
+ - `RequestHookContext`
62
+ - `ResponseHookContext`
63
+ - `ErrorHookContext`
64
+
65
+ ## Resources
66
+
67
+ ### `workspaces`
68
+
69
+ - `create`
70
+ - `list`
71
+ - `get`
72
+ - `update`
73
+ - `archive`
74
+
75
+ ### `apiKeys`
76
+
77
+ - `me`
78
+ - `create`
79
+ - `list`
80
+ - `revoke`
81
+ - `rotate`
82
+
83
+ ### `agents`
84
+
85
+ - `create`
86
+ - `list`
87
+ - `get`
88
+ - `update`
89
+ - `delete`
90
+ - `listVersions`
91
+ - `getVersion`
92
+ - `createVersion`
93
+
94
+ ### `skills`
95
+
96
+ - `create`
97
+ - `list`
98
+ - `get`
99
+ - `update`
100
+ - `delete`
101
+ - `test`
102
+
103
+ ### `actions`
104
+
105
+ - `create`
106
+ - `list`
107
+ - `get`
108
+ - `update`
109
+ - `delete`
110
+ - `test`
111
+
112
+ ### `operators`
113
+
114
+ - `list`
115
+ - `create`
116
+ - `get`
117
+ - `getDashboard`
118
+ - `getQueue`
119
+ - `getEscalations`
120
+ - `getActiveEscalations`
121
+ - `getEscalationStats`
122
+ - `getPerformance`
123
+ - `getAccessToken`
124
+ - `joinCall`
125
+ - `leaveCall`
126
+ - `switchMode`
127
+ - `sendGuidance`
128
+ - `createBriefing`
129
+ - `wrapUp`
130
+ - `getCallTranscript`
131
+ - `getAuditLog`
132
+
133
+ ### `triggers`
134
+
135
+ - `list`
136
+ - `create`
137
+ - `get`
138
+ - `update`
139
+ - `delete`
140
+ - `fire`
141
+ - `pause`
142
+ - `resume`
143
+ - `listRuns`
144
+
145
+ ### `services`
146
+
147
+ - `create`
148
+ - `list`
149
+ - `get`
150
+ - `update`
151
+ - `delete`
152
+
153
+ ### `contextGraphs`
154
+
155
+ - `create`
156
+ - `list`
157
+ - `get`
158
+ - `update`
159
+ - `delete`
160
+ - `createVersion`
161
+ - `listVersions`
162
+ - `getVersion`
163
+
164
+ ### `dataSources`
165
+
166
+ - `create`
167
+ - `list`
168
+ - `get`
169
+ - `update`
170
+ - `delete`
171
+ - `getStatus`
172
+ - `getSyncHistory`
173
+
174
+ ### `world`
175
+
176
+ - `listEntities`
177
+ - `getEntity`
178
+ - `getRelationships`
179
+ - `getGraph`
180
+ - `getProvenance`
181
+ - `getLineage`
182
+ - `getMerged`
183
+ - `listEntityTypes`
184
+ - `listDuplicates`
185
+ - `search`
186
+ - `getTimeline`
187
+ - `getSyncStatusBySink`
188
+ - `listSyncEvents`
189
+ - `getSyncQueueDepth`
190
+ - `retrySyncEvent`
191
+ - `retryAllSyncEvents`
192
+ - `getStats`
193
+ - `getSourceBreakdown`
194
+
195
+ ### `calls`
196
+
197
+ - `list`
198
+ - `get`
199
+ - `getIntelligence`
200
+ - `getActiveIntelligence`
201
+ - `getBenchmarks`
202
+ - `getTraceAnalysis`
203
+
204
+ ### `phoneNumbers`
205
+
206
+ - `provision`
207
+ - `list`
208
+ - `get`
209
+ - `update`
210
+ - `release`
211
+ - `setForwarding`
212
+ - `clearForwarding`
213
+
214
+ ### `integrations`
215
+
216
+ - `create`
217
+ - `list`
218
+ - `get`
219
+ - `update`
220
+ - `delete`
221
+ - `testEndpoint`
222
+ - `getHealthCheck`
223
+
224
+ ### `analytics`
225
+
226
+ - `getDashboard`
227
+ - `getCalls`
228
+ - `getAgents`
229
+ - `getCallQuality`
230
+ - `getEmotionTrends`
231
+ - `getLatency`
232
+ - `getToolPerformance`
233
+ - `getDataQuality`
234
+ - `getUsage`
235
+ - `getAdvancedCallStats`
236
+ - `compareCallPeriods`
237
+
238
+ ### `simulations`
239
+
240
+ - `createSession`
241
+ - `getSession`
242
+ - `deleteSession`
243
+ - `step`
244
+ - `recommend`
245
+ - `getIntelligence`
246
+
247
+ ### `settings`
248
+
249
+ - `voice.get`
250
+ - `voice.update`
251
+ - `branding.get`
252
+ - `branding.update`
253
+ - `outreach.get`
254
+ - `outreach.update`
255
+ - `memory.get`
256
+ - `memory.update`
257
+ - `security.get`
258
+ - `security.update`
259
+ - `retention.get`
260
+ - `retention.update`
261
+ - `workflows.get`
262
+ - `workflows.update`
263
+
264
+ ### `billing`
265
+
266
+ - `getDashboard`
267
+ - `getUsage`
268
+ - `getUsageTrends`
269
+ - `listInvoices`
270
+ - `getInvoice`
271
+ - `getInvoicePdf`
272
+
273
+ ### `memory`
274
+
275
+ - `getEntityDimensions`
276
+ - `getEntityFacts`
277
+ - `getAnalytics`
278
+
279
+ ### `personas`
280
+
281
+ - `list`
282
+ - `create`
283
+ - `get`
284
+ - `update`
285
+ - `delete`
286
+
287
+ ### `reviewQueue`
288
+
289
+ - `list`
290
+ - `get`
291
+ - `getStats`
292
+ - `getDashboard`
293
+ - `getMyQueue`
294
+ - `approve`
295
+ - `reject`
296
+ - `claim`
297
+ - `unclaim`
298
+ - `correct`
299
+ - `batchApprove`
300
+ - `batchReject`
301
+ - `getHistory`
302
+ - `getTrends`
303
+ - `getPerformance`
304
+ - `getCorrectionSchema`
305
+ - `getDiff`
306
+
307
+ ### `recordings`
308
+
309
+ - `getUrls`
310
+ - `getMetadata`
311
+ - `download`
312
+
313
+ ### `audit`
314
+
315
+ - `list`
316
+ - `getSummary`
317
+ - `getPhiAccess`
318
+ - `createExport`
319
+ - `listExports`
320
+ - `getEntityAccessLog`
321
+
322
+ ### `webhookDestinations`
323
+
324
+ - `list`
325
+ - `create`
326
+ - `get`
327
+ - `update`
328
+ - `delete`
329
+ - `listDeliveries`
330
+ - `rotateSecret`
331
+
332
+ ### `safety`
333
+
334
+ - `getConfig`
335
+ - `updateConfig`
336
+ - `listTemplates`
337
+ - `getTemplate`
338
+ - `applyTemplate`
339
+
340
+ ### `compliance`
341
+
342
+ - `getDashboard`
343
+ - `getHipaa`
344
+ - `getAccessReview`
345
+
346
+ ### `functions`
347
+
348
+ - `list`
349
+ - `create`
350
+ - `delete`
351
+ - `test`
352
+ - `getCatalog`
353
+ - `query`
354
+ - `sync`
@@ -3,9 +3,18 @@
3
3
  * All errors extend AmigoError which can be caught with a single catch.
4
4
  */
5
5
  const SENSITIVE_FIELDS = new Set([
6
- 'id_token', 'access_token', 'refresh_token', 'authorization',
7
- 'api_key', 'apikey', 'token', 'secret', 'password', 'x-api-key',
8
- 'cookie', 'set-cookie',
6
+ 'id_token',
7
+ 'access_token',
8
+ 'refresh_token',
9
+ 'authorization',
10
+ 'api_key',
11
+ 'apikey',
12
+ 'token',
13
+ 'secret',
14
+ 'password',
15
+ 'x-api-key',
16
+ 'cookie',
17
+ 'set-cookie',
9
18
  ]);
10
19
  function sanitizeErrorContext(obj) {
11
20
  if (typeof obj !== 'object' || !obj)
@@ -40,7 +49,9 @@ export class AmigoError extends Error {
40
49
  this.errorCode = ctx.errorCode;
41
50
  this.requestId = ctx.requestId;
42
51
  this.detail = ctx.detail;
43
- this.context = ctx.context ? sanitizeErrorContext(ctx.context) : undefined;
52
+ this.context = ctx.context
53
+ ? sanitizeErrorContext(ctx.context)
54
+ : undefined;
44
55
  Object.setPrototypeOf(this, new.target.prototype);
45
56
  if (typeof Error.captureStackTrace === 'function') {
46
57
  Error.captureStackTrace(this, this.constructor);
@@ -124,6 +135,14 @@ export class NetworkError extends AmigoError {
124
135
  }
125
136
  }
126
137
  }
138
+ /** Request timed out before receiving a response */
139
+ export class RequestTimeoutError extends NetworkError {
140
+ timeoutMs;
141
+ constructor(message, timeoutMs, cause) {
142
+ super(message, cause);
143
+ this.timeoutMs = timeoutMs;
144
+ }
145
+ }
127
146
  /** Failed to parse response body */
128
147
  export class ParseError extends AmigoError {
129
148
  body;
@@ -204,4 +223,7 @@ export function isRateLimitError(err) {
204
223
  export function isAuthenticationError(err) {
205
224
  return err instanceof AuthenticationError;
206
225
  }
226
+ export function isRequestTimeoutError(err) {
227
+ return err instanceof RequestTimeoutError;
228
+ }
207
229
  //# sourceMappingURL=errors.js.map