@amigo-ai/platform-sdk 0.56.0 → 0.58.0

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 (67) hide show
  1. package/README.md +72 -6
  2. package/api.md +19 -24
  3. package/dist/core/branded-types.js +1 -0
  4. package/dist/core/branded-types.js.map +1 -1
  5. package/dist/index.cjs +180 -204
  6. package/dist/index.cjs.map +4 -4
  7. package/dist/index.js +9 -4
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +180 -204
  10. package/dist/index.mjs.map +4 -4
  11. package/dist/resources/fhir.js +1 -7
  12. package/dist/resources/fhir.js.map +1 -1
  13. package/dist/resources/integrations.js +66 -34
  14. package/dist/resources/integrations.js.map +1 -1
  15. package/dist/resources/settings.js +1 -19
  16. package/dist/resources/settings.js.map +1 -1
  17. package/dist/resources/tokens.js +31 -0
  18. package/dist/resources/tokens.js.map +1 -0
  19. package/dist/resources/workspace-data-queries.js +41 -0
  20. package/dist/resources/workspace-data-queries.js.map +1 -0
  21. package/dist/resources/world.js +0 -27
  22. package/dist/resources/world.js.map +1 -1
  23. package/dist/types/core/branded-types.d.ts +2 -0
  24. package/dist/types/core/branded-types.d.ts.map +1 -1
  25. package/dist/types/generated/api.d.ts +2825 -3993
  26. package/dist/types/generated/api.d.ts.map +1 -1
  27. package/dist/types/index.d.cts +10 -4
  28. package/dist/types/index.d.cts.map +1 -1
  29. package/dist/types/index.d.ts +10 -4
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/resources/actions.d.ts +5 -25
  32. package/dist/types/resources/actions.d.ts.map +1 -1
  33. package/dist/types/resources/base.d.ts +1 -1
  34. package/dist/types/resources/base.d.ts.map +1 -1
  35. package/dist/types/resources/calls.d.ts +17 -5
  36. package/dist/types/resources/calls.d.ts.map +1 -1
  37. package/dist/types/resources/context-graphs.d.ts +16 -0
  38. package/dist/types/resources/context-graphs.d.ts.map +1 -1
  39. package/dist/types/resources/fhir.d.ts +1 -22
  40. package/dist/types/resources/fhir.d.ts.map +1 -1
  41. package/dist/types/resources/intake.d.ts.map +1 -1
  42. package/dist/types/resources/integrations.d.ts +457 -599
  43. package/dist/types/resources/integrations.d.ts.map +1 -1
  44. package/dist/types/resources/metrics.d.ts +7 -3
  45. package/dist/types/resources/metrics.d.ts.map +1 -1
  46. package/dist/types/resources/operators.d.ts +2 -2
  47. package/dist/types/resources/operators.d.ts.map +1 -1
  48. package/dist/types/resources/review-queue.d.ts +11 -11
  49. package/dist/types/resources/services.d.ts +135 -0
  50. package/dist/types/resources/services.d.ts.map +1 -1
  51. package/dist/types/resources/settings.d.ts +7 -145
  52. package/dist/types/resources/settings.d.ts.map +1 -1
  53. package/dist/types/resources/skills.d.ts +5 -25
  54. package/dist/types/resources/skills.d.ts.map +1 -1
  55. package/dist/types/resources/surfaces.d.ts.map +1 -1
  56. package/dist/types/resources/tasks.d.ts +2 -2
  57. package/dist/types/resources/tokens.d.ts +20 -0
  58. package/dist/types/resources/tokens.d.ts.map +1 -0
  59. package/dist/types/resources/workspace-data-queries.d.ts +22 -0
  60. package/dist/types/resources/workspace-data-queries.d.ts.map +1 -0
  61. package/dist/types/resources/world.d.ts +25 -82
  62. package/dist/types/resources/world.d.ts.map +1 -1
  63. package/package.json +1 -1
  64. package/dist/resources/webhook-destinations.js +0 -50
  65. package/dist/resources/webhook-destinations.js.map +0 -1
  66. package/dist/types/resources/webhook-destinations.d.ts +0 -125
  67. package/dist/types/resources/webhook-destinations.d.ts.map +0 -1
package/README.md CHANGED
@@ -126,6 +126,56 @@ const client = new AmigoClient({ apiKey: result.accessToken, workspaceId: result
126
126
 
127
127
  See [`examples/auth/device-code-login.ts`](./examples/auth/device-code-login.ts) for a complete working example.
128
128
 
129
+ ### Exchange an API key for a JWT
130
+
131
+ Use `client.tokens.exchangeApiKey()` to swap a long-lived API key for a
132
+ short-lived identity-issued JWT. This is useful when you want to mint a
133
+ narrowly scoped, time-bound token from a privileged server (for example to
134
+ forward to a browser via a BFF proxy, or to call the platform from a runtime
135
+ that can't safely hold the raw API key).
136
+
137
+ The call posts to `POST /token` on the configured `baseUrl` and is **not**
138
+ workspace-scoped — `workspaceId` is still required on the client because it
139
+ governs every other resource call on the same instance, but `POST /token`
140
+ itself ignores it. The SDK also unconditionally strips the configured
141
+ `Authorization` header for this one request and sends the exchange key only
142
+ as the `api_key` form field, so the configured client key is never sent over
143
+ the wire on the exchange call.
144
+
145
+ ```typescript
146
+ import { AmigoClient } from '@amigo-ai/platform-sdk'
147
+
148
+ const apiKey = process.env.AMIGO_API_KEY
149
+ const workspaceId = process.env.AMIGO_WORKSPACE_ID
150
+ if (!apiKey || !workspaceId) {
151
+ throw new Error('AMIGO_API_KEY and AMIGO_WORKSPACE_ID must be set')
152
+ }
153
+
154
+ const client = new AmigoClient({ apiKey, workspaceId })
155
+
156
+ const { access_token, expires_in, scope } = await client.tokens.exchangeApiKey({
157
+ apiKey,
158
+ // Optional: request a narrower scope on the issued JWT. Enforcement is
159
+ // server-side — the SDK just forwards the value as a form field.
160
+ scope: 'entities:read agents:read',
161
+ })
162
+
163
+ console.log(`Got JWT, expires in ${expires_in}s with scope "${scope}"`)
164
+
165
+ // Use the JWT in a second client. JWTs are passed as `apiKey` — Bearer auth.
166
+ const scopedClient = new AmigoClient({ apiKey: access_token, workspaceId })
167
+
168
+ const { items: agents } = await scopedClient.agents.list({ limit: 5 })
169
+ console.log(agents.map((agent) => agent.name))
170
+ ```
171
+
172
+ The response is the standard OAuth-style token payload (`access_token`,
173
+ `token_type`, `expires_in`, `scope`, plus optional `session_id` /
174
+ `refresh_token` when applicable). The `apiKey` you pass to
175
+ `exchangeApiKey()` can be a different key than the one configured on the
176
+ client — the configured key is not used to authenticate the exchange
177
+ request itself.
178
+
129
179
  ## Configuration
130
180
 
131
181
  | Option | Type | Required | Description |
@@ -280,6 +330,19 @@ const client = new AmigoClient({
280
330
 
281
331
  ## Resources
282
332
 
333
+ ### Tokens
334
+
335
+ Exchange a long-lived API key for a short-lived identity-issued JWT. See
336
+ [Exchange an API key for a JWT](#exchange-an-api-key-for-a-jwt) under
337
+ Authentication for the full walkthrough.
338
+
339
+ ```typescript
340
+ const { access_token, expires_in } = await client.tokens.exchangeApiKey({
341
+ apiKey: process.env.AMIGO_API_KEY!,
342
+ scope: 'entities:read agents:read',
343
+ })
344
+ ```
345
+
283
346
  ### Agents
284
347
 
285
348
  ```typescript
@@ -715,15 +778,18 @@ const fn = await client.functions.get('my-function')
715
778
  const result = await client.functions.test('my-function', { input: { query: 'test' } })
716
779
  ```
717
780
 
718
- ### Webhook Destinations
781
+ ### Workspace Data Queries
719
782
 
720
783
  ```typescript
721
- const dest = await client.webhookDestinations.create({
722
- name: 'My Webhook',
723
- url: 'https://example.com/webhook',
724
- events: ['call.completed'],
784
+ const query = await client.workspaceDataQueries.create({
785
+ name: 'recent_orders',
786
+ description: 'Recent orders by status',
787
+ sql_template: 'select * from custom.orders where status = :status',
788
+ parameters: [{ name: 'status', type: 'string', description: 'Order status' }],
789
+ })
790
+ const result = await client.workspaceDataQueries.invoke(query.id, {
791
+ input: { status: 'open' },
725
792
  })
726
- const deliveries = await client.webhookDestinations.listDeliveries(dest.id)
727
793
  ```
728
794
 
729
795
  ## Webhook Verification
package/api.md CHANGED
@@ -90,6 +90,10 @@ All workspace-scoped resources also expose `withOptions(options)`.
90
90
  - `revoke`
91
91
  - `rotate`
92
92
 
93
+ ### `tokens`
94
+
95
+ - `exchangeApiKey`
96
+
93
97
  ### `agents`
94
98
 
95
99
  - `create`
@@ -221,11 +225,6 @@ All workspace-scoped resources also expose `withOptions(options)`.
221
225
  - `getTimeline`
222
226
  - `getTimelineAutoPaging`
223
227
  - `getSyncStatusBySink`
224
- - `listSyncEvents`
225
- - `listSyncEventsAutoPaging`
226
- - `getSyncQueueDepth`
227
- - `retrySyncEvent`
228
- - `retryAllSyncEvents`
229
228
  - `getStats`
230
229
  - `getSourceBreakdown`
231
230
 
@@ -275,9 +274,13 @@ All workspace-scoped resources also expose `withOptions(options)`.
275
274
  - `get`
276
275
  - `update`
277
276
  - `delete`
277
+ - `listEndpoints`
278
+ - `listEndpointsAutoPaging`
279
+ - `getEndpoint`
280
+ - `createEndpoint`
281
+ - `updateEndpoint`
282
+ - `deleteEndpoint`
278
283
  - `testEndpoint`
279
- - `testConnection`
280
- - `getHealthCheck`
281
284
 
282
285
  ### `analytics`
283
286
 
@@ -339,8 +342,6 @@ All workspace-scoped resources also expose `withOptions(options)`.
339
342
  - `memory.update`
340
343
  - `retention.get`
341
344
  - `retention.update`
342
- - `behaviors.get`
343
- - `behaviors.update`
344
345
  - `gapScanner.get`
345
346
  - `gapScanner.update`
346
347
  - `gapScanner.preview`
@@ -349,8 +350,6 @@ All workspace-scoped resources also expose `withOptions(options)`.
349
350
  - `metrics.update`
350
351
  - `environments.get`
351
352
  - `environments.update`
352
- - `workflows.get`
353
- - `workflows.update`
354
353
 
355
354
  ### `billing`
356
355
 
@@ -409,18 +408,6 @@ All workspace-scoped resources also expose `withOptions(options)`.
409
408
  - `getEntityAccessLog`
410
409
  - `getEntityAccessLogAutoPaging`
411
410
 
412
- ### `webhookDestinations`
413
-
414
- - `list`
415
- - `listAutoPaging`
416
- - `create`
417
- - `get`
418
- - `update`
419
- - `delete`
420
- - `listDeliveries`
421
- - `listDeliveriesAutoPaging`
422
- - `rotateSecret`
423
-
424
411
  ### `compliance`
425
412
 
426
413
  - `getDashboard`
@@ -447,7 +434,6 @@ All workspace-scoped resources also expose `withOptions(options)`.
447
434
  ### `fhir`
448
435
 
449
436
  - `getStatus`
450
- - `getSyncFailures`
451
437
  - `import`
452
438
  - `searchPatients`
453
439
  - `getPatientSummary`
@@ -574,4 +560,13 @@ All workspace-scoped resources also expose `withOptions(options)`.
574
560
  - `deleteQueryTool`
575
561
  - `testQueryTool`
576
562
 
563
+ ### `workspaceDataQueries`
564
+
565
+ - `list`
566
+ - `create`
567
+ - `get`
568
+ - `update`
569
+ - `delete`
570
+ - `invoke`
571
+
577
572
  ### `api`
@@ -9,6 +9,7 @@ export const contextGraphId = (id) => id;
9
9
  export const callId = (id) => id;
10
10
  export const phoneNumberId = (id) => id;
11
11
  export const integrationId = (id) => id;
12
+ export const integrationEndpointId = (id) => id;
12
13
  export const entityId = (id) => id;
13
14
  export const eventId = (id) => id;
14
15
  export const surfaceId = (id) => id;
@@ -1 +1 @@
1
- {"version":3,"file":"branded-types.js","sourceRoot":"","sources":["../../src/core/branded-types.ts"],"names":[],"mappings":"AA+BA,uBAAuB;AACvB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAU,EAAe,EAAE,CAAC,EAAiB,CAAA;AACzE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAY,EAAE,CAAC,EAAc,CAAA;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAW,EAAE,CAAC,EAAa,CAAA;AAC7D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAW,EAAE,CAAC,EAAa,CAAA;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAY,EAAE,CAAC,EAAc,CAAA;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAU,EAAa,EAAE,CAAC,EAAe,CAAA;AACnE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAU,EAAkB,EAAE,CAAC,EAAoB,CAAA;AAClF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,EAAY,CAAA;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,EAAmB,CAAA;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,EAAmB,CAAA;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAY,EAAE,CAAC,EAAc,CAAA;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,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