@amigo-ai/platform-sdk 0.4.1 → 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.
- package/README.md +87 -0
- package/api.md +354 -0
- package/dist/core/errors.js +26 -4
- package/dist/core/errors.js.map +1 -1
- package/dist/core/openapi-client.js +108 -6
- package/dist/core/openapi-client.js.map +1 -1
- 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/index.cjs +258 -38
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +50 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +258 -38
- package/dist/index.mjs.map +4 -4
- 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 +24 -1
- package/dist/types/core/openapi-client.d.ts.map +1 -1
- 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/index.d.ts +40 -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/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 +2 -1
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,76 @@ 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 [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
|
+
|
|
92
178
|
## Resources
|
|
93
179
|
|
|
94
180
|
### Agents
|
|
@@ -499,6 +585,7 @@ Webhook verification errors are separate from API transport errors and throw `We
|
|
|
499
585
|
| `ServerError` | 5xx | Server-side error |
|
|
500
586
|
| `ConfigurationError` | — | SDK misconfiguration at init time |
|
|
501
587
|
| `NetworkError` | — | Fetch/network failure |
|
|
588
|
+
| `RequestTimeoutError` | — | Request exceeded the configured timeout |
|
|
502
589
|
|
|
503
590
|
## CommonJS (CJS) usage
|
|
504
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`
|
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,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