@amigo-ai/platform-sdk 0.4.1 → 0.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.
- package/README.md +111 -0
- package/api.md +347 -0
- package/dist/core/errors.js +26 -4
- package/dist/core/errors.js.map +1 -1
- package/dist/core/openapi-client.js +164 -28
- package/dist/core/openapi-client.js.map +1 -1
- package/dist/core/request-options.js +80 -0
- package/dist/core/request-options.js.map +1 -0
- package/dist/core/retry.js +5 -2
- package/dist/core/retry.js.map +1 -1
- package/dist/core/utils.js +48 -2
- package/dist/core/utils.js.map +1 -1
- package/dist/core/webhooks.js +9 -0
- package/dist/core/webhooks.js.map +1 -1
- package/dist/index.cjs +538 -84
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +113 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +538 -84
- package/dist/index.mjs.map +4 -4
- package/dist/resources/base.js +33 -0
- package/dist/resources/base.js.map +1 -1
- package/dist/types/core/errors.d.ts +6 -0
- package/dist/types/core/errors.d.ts.map +1 -1
- package/dist/types/core/openapi-client.d.ts +26 -1
- package/dist/types/core/openapi-client.d.ts.map +1 -1
- package/dist/types/core/request-options.d.ts +66 -0
- package/dist/types/core/request-options.d.ts.map +1 -0
- package/dist/types/core/retry.d.ts +1 -1
- package/dist/types/core/retry.d.ts.map +1 -1
- package/dist/types/core/utils.d.ts +27 -1
- package/dist/types/core/utils.d.ts.map +1 -1
- package/dist/types/core/webhooks.d.ts.map +1 -1
- package/dist/types/index.d.ts +31 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/actions.d.ts +5 -5
- package/dist/types/resources/agents.d.ts +7 -7
- package/dist/types/resources/analytics.d.ts +11 -11
- package/dist/types/resources/api-keys.d.ts +4 -4
- package/dist/types/resources/audit.d.ts +6 -6
- package/dist/types/resources/base.d.ts +8 -3
- package/dist/types/resources/base.d.ts.map +1 -1
- package/dist/types/resources/billing.d.ts +6 -6
- package/dist/types/resources/calls.d.ts +6 -6
- package/dist/types/resources/compliance.d.ts +3 -3
- package/dist/types/resources/context-graphs.d.ts +7 -7
- package/dist/types/resources/data-sources.d.ts +6 -6
- package/dist/types/resources/functions.d.ts +6 -6
- package/dist/types/resources/integrations.d.ts +6 -6
- package/dist/types/resources/memory.d.ts +3 -3
- package/dist/types/resources/operators.d.ts +18 -18
- package/dist/types/resources/personas.d.ts +4 -4
- package/dist/types/resources/phone-numbers.d.ts +5 -5
- package/dist/types/resources/recordings.d.ts +2 -2
- package/dist/types/resources/review-queue.d.ts +17 -17
- package/dist/types/resources/safety.d.ts +5 -5
- package/dist/types/resources/services.d.ts +4 -4
- package/dist/types/resources/settings.d.ts +14 -14
- package/dist/types/resources/simulations.d.ts +6 -6
- package/dist/types/resources/skills.d.ts +5 -5
- package/dist/types/resources/triggers.d.ts +8 -8
- package/dist/types/resources/webhook-destinations.d.ts +6 -6
- package/dist/types/resources/workspaces.d.ts +5 -5
- package/dist/types/resources/world.d.ts +18 -18
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ console.log(stats.total_calls, stats.avg_duration_seconds)
|
|
|
43
43
|
|
|
44
44
|
- Product docs and API reference: [docs.amigo.ai](https://docs.amigo.ai/)
|
|
45
45
|
- Repo-local SDK examples: [examples/README.md](./examples/README.md)
|
|
46
|
+
- Repo-local API surface guide: [api.md](./api.md)
|
|
46
47
|
|
|
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.
|
|
48
49
|
|
|
@@ -54,6 +55,10 @@ The docs site remains the primary reference. The examples in this repo stay clos
|
|
|
54
55
|
| `workspaceId` | `string` | Yes | Your workspace ID — all resource operations are scoped to this |
|
|
55
56
|
| `baseUrl` | `string` | No | Override the API base URL (default: `https://api.platform.amigo.ai`) |
|
|
56
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 |
|
|
57
62
|
| `fetch` | `typeof fetch` | No | Custom fetch for BFF proxy, cookie forwarding, or test mocking |
|
|
58
63
|
|
|
59
64
|
### Retry options
|
|
@@ -72,6 +77,17 @@ const client = new AmigoClient({
|
|
|
72
77
|
|
|
73
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.
|
|
74
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
|
+
|
|
75
91
|
## Generated Types
|
|
76
92
|
|
|
77
93
|
The SDK ships with generated OpenAPI types and re-exports them for direct use:
|
|
@@ -89,6 +105,100 @@ Public builds are generated from the committed [`openapi.json`](./openapi.json)
|
|
|
89
105
|
npm run openapi:sync
|
|
90
106
|
```
|
|
91
107
|
|
|
108
|
+
For a repo-local overview of the exported client surface, see the generated [api.md](./api.md).
|
|
109
|
+
|
|
110
|
+
## Advanced request control
|
|
111
|
+
|
|
112
|
+
The normal resource surface supports scoped request overrides, so you can keep the ergonomic API while adding timeout, retry, and header controls:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const agents = await client
|
|
116
|
+
.withOptions({
|
|
117
|
+
timeout: 5_000,
|
|
118
|
+
maxRetries: 1,
|
|
119
|
+
headers: { 'X-Debug-Trace': 'true' },
|
|
120
|
+
})
|
|
121
|
+
.agents.list({ limit: 10 })
|
|
122
|
+
|
|
123
|
+
console.log(agents._request_id)
|
|
124
|
+
console.log(agents.lastResponse.statusCode)
|
|
125
|
+
console.log(agents.items)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
You can scope options to a single resource as well:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
const agent = await client.agents.withOptions({ timeout: 2_000 }).get('agent-id')
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
For lower-level control, use the built-in typed HTTP helpers. Workspace-scoped routes automatically receive your configured `workspaceId`, and the configured value wins if `workspace_id` is provided manually.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const result = await client.GET('/v1/{workspace_id}/agents', {
|
|
138
|
+
params: { query: { limit: 10 } },
|
|
139
|
+
timeout: 5_000,
|
|
140
|
+
maxRetries: 1,
|
|
141
|
+
headers: { 'X-Debug-Trace': 'true' },
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
console.log(result.requestId)
|
|
145
|
+
console.log(result.data.items)
|
|
146
|
+
console.log(result.rateLimit.remaining)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Available helpers:
|
|
150
|
+
|
|
151
|
+
- `client.GET(...)`
|
|
152
|
+
- `client.POST(...)`
|
|
153
|
+
- `client.PUT(...)`
|
|
154
|
+
- `client.PATCH(...)`
|
|
155
|
+
- `client.DELETE(...)`
|
|
156
|
+
- `client.HEAD(...)`
|
|
157
|
+
- `client.OPTIONS(...)`
|
|
158
|
+
- `client.withOptions(...)`
|
|
159
|
+
- `client.<resource>.withOptions(...)`
|
|
160
|
+
|
|
161
|
+
### Response metadata
|
|
162
|
+
|
|
163
|
+
Object responses from resource methods include non-enumerable request metadata:
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
const agent = await client.agents.get('agent-id')
|
|
167
|
+
|
|
168
|
+
console.log(agent._request_id)
|
|
169
|
+
console.log(agent.lastResponse.statusCode)
|
|
170
|
+
console.log(agent.lastResponse.rateLimit.remaining)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Low-level request helpers return the raw `Response` alongside parsed data:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
const { data, response, requestId } = await client.GET('/v1/{workspace_id}/agents')
|
|
177
|
+
|
|
178
|
+
console.log(requestId)
|
|
179
|
+
console.log(response.headers.get('content-type'))
|
|
180
|
+
console.log(data.items)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Request hooks
|
|
184
|
+
|
|
185
|
+
Use hooks for logging, tracing, and metrics without wrapping `fetch` yourself:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const client = new AmigoClient({
|
|
189
|
+
apiKey: 'your-api-key',
|
|
190
|
+
workspaceId: 'your-workspace-id',
|
|
191
|
+
hooks: {
|
|
192
|
+
onRequest({ request, schemaPath }) {
|
|
193
|
+
console.log('request', request.method, schemaPath)
|
|
194
|
+
},
|
|
195
|
+
onResponse({ response, requestId }) {
|
|
196
|
+
console.log('response', response.status, requestId)
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
})
|
|
200
|
+
```
|
|
201
|
+
|
|
92
202
|
## Resources
|
|
93
203
|
|
|
94
204
|
### Agents
|
|
@@ -499,6 +609,7 @@ Webhook verification errors are separate from API transport errors and throw `We
|
|
|
499
609
|
| `ServerError` | 5xx | Server-side error |
|
|
500
610
|
| `ConfigurationError` | — | SDK misconfiguration at init time |
|
|
501
611
|
| `NetworkError` | — | Fetch/network failure |
|
|
612
|
+
| `RequestTimeoutError` | — | Request exceeded the configured timeout |
|
|
502
613
|
|
|
503
614
|
## CommonJS (CJS) usage
|
|
504
615
|
|
package/api.md
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# API Surface
|
|
2
|
+
|
|
3
|
+
> Generated from source. Do not edit directly.
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Client
|
|
8
|
+
|
|
9
|
+
### `AmigoClient`
|
|
10
|
+
|
|
11
|
+
Configuration fields:
|
|
12
|
+
|
|
13
|
+
- `apiKey: string`
|
|
14
|
+
- `workspaceId: string`
|
|
15
|
+
- `baseUrl?: string`
|
|
16
|
+
- `retry?: RetryOptions`
|
|
17
|
+
- `maxRetries?: number`
|
|
18
|
+
- `timeout?: number`
|
|
19
|
+
- `headers?: HeadersOptions`
|
|
20
|
+
- `hooks?: ClientHooks`
|
|
21
|
+
- `fetch?: typeof globalThis.fetch`
|
|
22
|
+
|
|
23
|
+
Instance fields:
|
|
24
|
+
|
|
25
|
+
- `workspaceId: string`
|
|
26
|
+
- `baseUrl: string`
|
|
27
|
+
|
|
28
|
+
Client methods:
|
|
29
|
+
|
|
30
|
+
- `withOptions(options)`
|
|
31
|
+
- `GET(path, options?)`
|
|
32
|
+
- `POST(path, options?)`
|
|
33
|
+
- `PUT(path, options?)`
|
|
34
|
+
- `PATCH(path, options?)`
|
|
35
|
+
- `DELETE(path, options?)`
|
|
36
|
+
- `HEAD(path, options?)`
|
|
37
|
+
- `OPTIONS(path, options?)`
|
|
38
|
+
|
|
39
|
+
Notes:
|
|
40
|
+
|
|
41
|
+
- Workspace-scoped paths receive the configured `workspaceId` automatically, and the configured value wins if `workspace_id` is provided manually.
|
|
42
|
+
- `client.withOptions(options)` and `client.<resource>.withOptions(options)` layer headers, timeout, and retry overrides onto the normal resource surface.
|
|
43
|
+
- Low-level helpers return `AmigoResponse<T>` with `data`, `response`, `requestId`, and `rateLimit`.
|
|
44
|
+
- Object responses from resource methods include `_request_id` and `lastResponse` metadata.
|
|
45
|
+
|
|
46
|
+
## Core exports
|
|
47
|
+
|
|
48
|
+
- Errors: `AmigoError`, `BadRequestError`, `AuthenticationError`, `PermissionError`, `NotFoundError`, `ConflictError`, `ValidationError`, `RateLimitError`, `ServerError`, `ServiceUnavailableError`, `NetworkError`, `RequestTimeoutError`, `ParseError`, `ConfigurationError`
|
|
49
|
+
- Error guards: `isAmigoError`, `isNotFoundError`, `isRateLimitError`, `isAuthenticationError`, `isRequestTimeoutError`
|
|
50
|
+
- Request option types: `AmigoRequestOptions`, `ScopedRequestOptions`
|
|
51
|
+
- Webhooks: `verifyWebhookSignature`, `parseWebhookEvent`, `WebhookVerificationError`
|
|
52
|
+
- Pagination and response helpers: `paginate`, `buildLastResponse`, `extractRequestId`
|
|
53
|
+
- Response and hook types: `PaginatedList`, `ListParams`, `LastResponseInfo`, `ResponseMetadata`, `WithResponseMetadata`, `AmigoResponse`, `RetryOptions`, `RateLimitInfo`, `ClientHooks`, `RequestHookContext`, `ResponseHookContext`, `ErrorHookContext`
|
|
54
|
+
- Generated OpenAPI types: `paths`, `components`, `operations`
|
|
55
|
+
|
|
56
|
+
## Resources
|
|
57
|
+
|
|
58
|
+
All workspace-scoped resources also expose `withOptions(options)`.
|
|
59
|
+
|
|
60
|
+
### `workspaces`
|
|
61
|
+
|
|
62
|
+
- `create`
|
|
63
|
+
- `list`
|
|
64
|
+
- `get`
|
|
65
|
+
- `update`
|
|
66
|
+
- `archive`
|
|
67
|
+
|
|
68
|
+
### `apiKeys`
|
|
69
|
+
|
|
70
|
+
- `me`
|
|
71
|
+
- `create`
|
|
72
|
+
- `list`
|
|
73
|
+
- `revoke`
|
|
74
|
+
- `rotate`
|
|
75
|
+
|
|
76
|
+
### `agents`
|
|
77
|
+
|
|
78
|
+
- `create`
|
|
79
|
+
- `list`
|
|
80
|
+
- `get`
|
|
81
|
+
- `update`
|
|
82
|
+
- `delete`
|
|
83
|
+
- `listVersions`
|
|
84
|
+
- `getVersion`
|
|
85
|
+
- `createVersion`
|
|
86
|
+
|
|
87
|
+
### `skills`
|
|
88
|
+
|
|
89
|
+
- `create`
|
|
90
|
+
- `list`
|
|
91
|
+
- `get`
|
|
92
|
+
- `update`
|
|
93
|
+
- `delete`
|
|
94
|
+
- `test`
|
|
95
|
+
|
|
96
|
+
### `actions`
|
|
97
|
+
|
|
98
|
+
- `create`
|
|
99
|
+
- `list`
|
|
100
|
+
- `get`
|
|
101
|
+
- `update`
|
|
102
|
+
- `delete`
|
|
103
|
+
- `test`
|
|
104
|
+
|
|
105
|
+
### `operators`
|
|
106
|
+
|
|
107
|
+
- `list`
|
|
108
|
+
- `create`
|
|
109
|
+
- `get`
|
|
110
|
+
- `getDashboard`
|
|
111
|
+
- `getQueue`
|
|
112
|
+
- `getEscalations`
|
|
113
|
+
- `getActiveEscalations`
|
|
114
|
+
- `getEscalationStats`
|
|
115
|
+
- `getPerformance`
|
|
116
|
+
- `getAccessToken`
|
|
117
|
+
- `joinCall`
|
|
118
|
+
- `leaveCall`
|
|
119
|
+
- `switchMode`
|
|
120
|
+
- `sendGuidance`
|
|
121
|
+
- `createBriefing`
|
|
122
|
+
- `wrapUp`
|
|
123
|
+
- `getCallTranscript`
|
|
124
|
+
- `getAuditLog`
|
|
125
|
+
|
|
126
|
+
### `triggers`
|
|
127
|
+
|
|
128
|
+
- `list`
|
|
129
|
+
- `create`
|
|
130
|
+
- `get`
|
|
131
|
+
- `update`
|
|
132
|
+
- `delete`
|
|
133
|
+
- `fire`
|
|
134
|
+
- `pause`
|
|
135
|
+
- `resume`
|
|
136
|
+
- `listRuns`
|
|
137
|
+
|
|
138
|
+
### `services`
|
|
139
|
+
|
|
140
|
+
- `create`
|
|
141
|
+
- `list`
|
|
142
|
+
- `get`
|
|
143
|
+
- `update`
|
|
144
|
+
- `delete`
|
|
145
|
+
|
|
146
|
+
### `contextGraphs`
|
|
147
|
+
|
|
148
|
+
- `create`
|
|
149
|
+
- `list`
|
|
150
|
+
- `get`
|
|
151
|
+
- `update`
|
|
152
|
+
- `delete`
|
|
153
|
+
- `createVersion`
|
|
154
|
+
- `listVersions`
|
|
155
|
+
- `getVersion`
|
|
156
|
+
|
|
157
|
+
### `dataSources`
|
|
158
|
+
|
|
159
|
+
- `create`
|
|
160
|
+
- `list`
|
|
161
|
+
- `get`
|
|
162
|
+
- `update`
|
|
163
|
+
- `delete`
|
|
164
|
+
- `getStatus`
|
|
165
|
+
- `getSyncHistory`
|
|
166
|
+
|
|
167
|
+
### `world`
|
|
168
|
+
|
|
169
|
+
- `listEntities`
|
|
170
|
+
- `getEntity`
|
|
171
|
+
- `getRelationships`
|
|
172
|
+
- `getGraph`
|
|
173
|
+
- `getProvenance`
|
|
174
|
+
- `getLineage`
|
|
175
|
+
- `getMerged`
|
|
176
|
+
- `listEntityTypes`
|
|
177
|
+
- `listDuplicates`
|
|
178
|
+
- `search`
|
|
179
|
+
- `getTimeline`
|
|
180
|
+
- `getSyncStatusBySink`
|
|
181
|
+
- `listSyncEvents`
|
|
182
|
+
- `getSyncQueueDepth`
|
|
183
|
+
- `retrySyncEvent`
|
|
184
|
+
- `retryAllSyncEvents`
|
|
185
|
+
- `getStats`
|
|
186
|
+
- `getSourceBreakdown`
|
|
187
|
+
|
|
188
|
+
### `calls`
|
|
189
|
+
|
|
190
|
+
- `list`
|
|
191
|
+
- `get`
|
|
192
|
+
- `getIntelligence`
|
|
193
|
+
- `getActiveIntelligence`
|
|
194
|
+
- `getBenchmarks`
|
|
195
|
+
- `getTraceAnalysis`
|
|
196
|
+
|
|
197
|
+
### `phoneNumbers`
|
|
198
|
+
|
|
199
|
+
- `provision`
|
|
200
|
+
- `list`
|
|
201
|
+
- `get`
|
|
202
|
+
- `update`
|
|
203
|
+
- `release`
|
|
204
|
+
- `setForwarding`
|
|
205
|
+
- `clearForwarding`
|
|
206
|
+
|
|
207
|
+
### `integrations`
|
|
208
|
+
|
|
209
|
+
- `create`
|
|
210
|
+
- `list`
|
|
211
|
+
- `get`
|
|
212
|
+
- `update`
|
|
213
|
+
- `delete`
|
|
214
|
+
- `testEndpoint`
|
|
215
|
+
- `getHealthCheck`
|
|
216
|
+
|
|
217
|
+
### `analytics`
|
|
218
|
+
|
|
219
|
+
- `getDashboard`
|
|
220
|
+
- `getCalls`
|
|
221
|
+
- `getAgents`
|
|
222
|
+
- `getCallQuality`
|
|
223
|
+
- `getEmotionTrends`
|
|
224
|
+
- `getLatency`
|
|
225
|
+
- `getToolPerformance`
|
|
226
|
+
- `getDataQuality`
|
|
227
|
+
- `getUsage`
|
|
228
|
+
- `getAdvancedCallStats`
|
|
229
|
+
- `compareCallPeriods`
|
|
230
|
+
|
|
231
|
+
### `simulations`
|
|
232
|
+
|
|
233
|
+
- `createSession`
|
|
234
|
+
- `getSession`
|
|
235
|
+
- `deleteSession`
|
|
236
|
+
- `step`
|
|
237
|
+
- `recommend`
|
|
238
|
+
- `getIntelligence`
|
|
239
|
+
|
|
240
|
+
### `settings`
|
|
241
|
+
|
|
242
|
+
- `voice.get`
|
|
243
|
+
- `voice.update`
|
|
244
|
+
- `branding.get`
|
|
245
|
+
- `branding.update`
|
|
246
|
+
- `outreach.get`
|
|
247
|
+
- `outreach.update`
|
|
248
|
+
- `memory.get`
|
|
249
|
+
- `memory.update`
|
|
250
|
+
- `security.get`
|
|
251
|
+
- `security.update`
|
|
252
|
+
- `retention.get`
|
|
253
|
+
- `retention.update`
|
|
254
|
+
- `workflows.get`
|
|
255
|
+
- `workflows.update`
|
|
256
|
+
|
|
257
|
+
### `billing`
|
|
258
|
+
|
|
259
|
+
- `getDashboard`
|
|
260
|
+
- `getUsage`
|
|
261
|
+
- `getUsageTrends`
|
|
262
|
+
- `listInvoices`
|
|
263
|
+
- `getInvoice`
|
|
264
|
+
- `getInvoicePdf`
|
|
265
|
+
|
|
266
|
+
### `memory`
|
|
267
|
+
|
|
268
|
+
- `getEntityDimensions`
|
|
269
|
+
- `getEntityFacts`
|
|
270
|
+
- `getAnalytics`
|
|
271
|
+
|
|
272
|
+
### `personas`
|
|
273
|
+
|
|
274
|
+
- `list`
|
|
275
|
+
- `create`
|
|
276
|
+
- `get`
|
|
277
|
+
- `update`
|
|
278
|
+
- `delete`
|
|
279
|
+
|
|
280
|
+
### `reviewQueue`
|
|
281
|
+
|
|
282
|
+
- `list`
|
|
283
|
+
- `get`
|
|
284
|
+
- `getStats`
|
|
285
|
+
- `getDashboard`
|
|
286
|
+
- `getMyQueue`
|
|
287
|
+
- `approve`
|
|
288
|
+
- `reject`
|
|
289
|
+
- `claim`
|
|
290
|
+
- `unclaim`
|
|
291
|
+
- `correct`
|
|
292
|
+
- `batchApprove`
|
|
293
|
+
- `batchReject`
|
|
294
|
+
- `getHistory`
|
|
295
|
+
- `getTrends`
|
|
296
|
+
- `getPerformance`
|
|
297
|
+
- `getCorrectionSchema`
|
|
298
|
+
- `getDiff`
|
|
299
|
+
|
|
300
|
+
### `recordings`
|
|
301
|
+
|
|
302
|
+
- `getUrls`
|
|
303
|
+
- `getMetadata`
|
|
304
|
+
- `download`
|
|
305
|
+
|
|
306
|
+
### `audit`
|
|
307
|
+
|
|
308
|
+
- `list`
|
|
309
|
+
- `getSummary`
|
|
310
|
+
- `getPhiAccess`
|
|
311
|
+
- `createExport`
|
|
312
|
+
- `listExports`
|
|
313
|
+
- `getEntityAccessLog`
|
|
314
|
+
|
|
315
|
+
### `webhookDestinations`
|
|
316
|
+
|
|
317
|
+
- `list`
|
|
318
|
+
- `create`
|
|
319
|
+
- `get`
|
|
320
|
+
- `update`
|
|
321
|
+
- `delete`
|
|
322
|
+
- `listDeliveries`
|
|
323
|
+
- `rotateSecret`
|
|
324
|
+
|
|
325
|
+
### `safety`
|
|
326
|
+
|
|
327
|
+
- `getConfig`
|
|
328
|
+
- `updateConfig`
|
|
329
|
+
- `listTemplates`
|
|
330
|
+
- `getTemplate`
|
|
331
|
+
- `applyTemplate`
|
|
332
|
+
|
|
333
|
+
### `compliance`
|
|
334
|
+
|
|
335
|
+
- `getDashboard`
|
|
336
|
+
- `getHipaa`
|
|
337
|
+
- `getAccessReview`
|
|
338
|
+
|
|
339
|
+
### `functions`
|
|
340
|
+
|
|
341
|
+
- `list`
|
|
342
|
+
- `create`
|
|
343
|
+
- `delete`
|
|
344
|
+
- `test`
|
|
345
|
+
- `getCatalog`
|
|
346
|
+
- `query`
|
|
347
|
+
- `sync`
|
package/dist/core/errors.js
CHANGED
|
@@ -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',
|
|
7
|
-
'
|
|
8
|
-
'
|
|
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
|
|
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
|
package/dist/core/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,UAAU,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,UAAU;IACV,cAAc;IACd,eAAe;IACf,eAAe;IACf,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,QAAQ;IACR,YAAY;CACb,CAAC,CAAA;AAEF,SAAS,oBAAoB,CAAC,GAAY;IACxC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAA;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAE5D,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAA8B,CAAC,EAAE,CAAC;QAC1E,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAA;QAC5B,CAAC;aAAM,IAAI,OAAO,KAAK,KAA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