@composio/client 2.0.0-rc.16 → 2.0.0-rc.18
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 +146 -32
- package/dist/{api-key-revocation-CvGpd3Rw.mjs → api-key-revocation-JkA4sOGH.mjs} +1 -1
- package/dist/{auth-C0IYTv5D.mjs → auth-B_K-wdMm.mjs} +1 -1
- package/dist/{auth-configs-COmbnKYx.mjs → auth-configs-RAgN782Z.mjs} +1 -1
- package/dist/{clanker-hE4FKPjg.mjs → clanker-Pgyyh95r.mjs} +1 -1
- package/dist/{cli-CuFaxvp4.mjs → cli-Ca5bRiEN.mjs} +4 -5
- package/dist/{connected-accounts-BmbcAhdS.mjs → connected-accounts-D6NTwvbi.mjs} +1 -1
- package/dist/{consumer-BaJgJBXQ.mjs → consumer-BP4OyJS0.mjs} +6 -7
- package/dist/{custom-DIJbIQGR.mjs → custom-BBr7KbCv.mjs} +1 -1
- package/dist/{custom-DbEv7dUC.mjs → custom-DA3ABHnI.mjs} +1 -1
- package/dist/effect.d.mts +70 -26
- package/dist/effect.mjs +216 -141
- package/dist/{error-D9cG225M.mjs → error-Bw7_G2NZ.mjs} +1 -1
- package/dist/{files-Cw6ulQZy.mjs → files-CeBs4ZE1.mjs} +1 -1
- package/dist/{files-RPz_Fvnz.mjs → files-DLRmNLRD.mjs} +1 -1
- package/dist/{generate-DZXuXtYM.mjs → generate-16uLPwUU.mjs} +1 -1
- package/dist/{generated-deprecated-inputs-B6o8D8ub.mjs → generated-deprecated-inputs-zx6ml908.mjs} +2 -2
- package/dist/{generated-operations-DrhN6W_k.mjs → generated-operations-DKgGT6Dg.mjs} +572 -211
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +134 -100
- package/dist/{keyring-CmnkWH5K.mjs → keyring-Q8GSieAv.mjs} +1 -1
- package/dist/{link-C0KzTJBI.mjs → link-D4dY_eaN.mjs} +1 -1
- package/dist/{logs-Bj5MAt8z.mjs → logs-Dc63Ju74.mjs} +3 -3
- package/dist/{manage-DDFmGWNH.mjs → manage-ByF6b3OD.mjs} +1 -1
- package/dist/{mcp-DXmBAF09.mjs → mcp-Cw7-Mtkm.mjs} +3 -3
- package/dist/{org-D4J-n07N.mjs → org-RRUxKfRw.mjs} +6 -6
- package/dist/{owner-CfjgcAcM.mjs → owner-GZX-sp-h.mjs} +1 -1
- package/dist/{pagination-rules-uMUdPq_7.mjs → pagination-rules-CMnBwktJ.mjs} +1 -1
- package/dist/pagination.mjs +1 -1
- package/dist/{project-Dw9JLelr.mjs → project-BsKmk9T7.mjs} +1 -1
- package/dist/{project-CnOrdnOM.mjs → project-C1uq7bV_.mjs} +1 -1
- package/dist/{project-7LL6W_tc.mjs → project-C_YZ-eLI.mjs} +4 -7
- package/dist/{project-CLrBv6tJ.mjs → project-Cj9ULE0a.mjs} +1 -1
- package/dist/{realtime-DQ_gT0q7.mjs → realtime-W-lJ0Vcs.mjs} +1 -1
- package/dist/resources/api-key-revocation.d.mts +1 -1
- package/dist/resources/api-key-revocation.mjs +1 -1
- package/dist/resources/auth/auth.d.mts +1 -1
- package/dist/resources/auth/auth.mjs +1 -1
- package/dist/resources/auth/index.d.mts +1 -1
- package/dist/resources/auth/index.mjs +2 -2
- package/dist/resources/auth/session.d.mts +1 -1
- package/dist/resources/auth/session.mjs +1 -1
- package/dist/resources/auth-configs.d.mts +1 -1
- package/dist/resources/auth-configs.mjs +1 -1
- package/dist/resources/auth.d.mts +1 -1
- package/dist/resources/auth.mjs +2 -2
- package/dist/resources/cli/cli.d.mts +1 -1
- package/dist/resources/cli/cli.mjs +1 -1
- package/dist/resources/cli/index.d.mts +1 -1
- package/dist/resources/cli/index.mjs +2 -2
- package/dist/resources/cli/realtime.d.mts +1 -1
- package/dist/resources/cli/realtime.mjs +1 -1
- package/dist/resources/cli.d.mts +1 -1
- package/dist/resources/cli.mjs +2 -2
- package/dist/resources/connected-accounts.d.mts +1 -1
- package/dist/resources/connected-accounts.mjs +1 -1
- package/dist/resources/custom.d.mts +1 -1
- package/dist/resources/custom.mjs +1 -1
- package/dist/resources/files.d.mts +1 -1
- package/dist/resources/files.mjs +1 -1
- package/dist/resources/index.d.mts +1 -1
- package/dist/resources/index.mjs +13 -13
- package/dist/resources/keyring.d.mts +1 -1
- package/dist/resources/keyring.mjs +1 -1
- package/dist/resources/link.d.mts +1 -1
- package/dist/resources/link.mjs +1 -1
- package/dist/resources/logs/index.d.mts +1 -1
- package/dist/resources/logs/index.mjs +3 -3
- package/dist/resources/logs/logs.d.mts +1 -1
- package/dist/resources/logs/logs.mjs +1 -1
- package/dist/resources/logs/tools.d.mts +1 -1
- package/dist/resources/logs/tools.mjs +1 -1
- package/dist/resources/logs/triggers.d.mts +1 -1
- package/dist/resources/logs/triggers.mjs +1 -1
- package/dist/resources/logs.d.mts +1 -1
- package/dist/resources/logs.mjs +3 -3
- package/dist/resources/mcp/custom.d.mts +1 -1
- package/dist/resources/mcp/custom.mjs +1 -1
- package/dist/resources/mcp/generate.d.mts +1 -1
- package/dist/resources/mcp/generate.mjs +1 -1
- package/dist/resources/mcp/index.d.mts +1 -1
- package/dist/resources/mcp/index.mjs +3 -3
- package/dist/resources/mcp/mcp.d.mts +1 -1
- package/dist/resources/mcp/mcp.mjs +1 -1
- package/dist/resources/mcp.d.mts +1 -1
- package/dist/resources/mcp.mjs +3 -3
- package/dist/resources/org/clanker.d.mts +1 -1
- package/dist/resources/org/clanker.mjs +1 -1
- package/dist/resources/org/consumer/consumer.d.mts +1 -1
- package/dist/resources/org/consumer/consumer.mjs +1 -1
- package/dist/resources/org/consumer/index.d.mts +1 -1
- package/dist/resources/org/consumer/index.mjs +2 -2
- package/dist/resources/org/consumer/project.d.mts +1 -1
- package/dist/resources/org/consumer/project.mjs +1 -1
- package/dist/resources/org/consumer.d.mts +1 -1
- package/dist/resources/org/consumer.mjs +2 -2
- package/dist/resources/org/index.d.mts +1 -1
- package/dist/resources/org/index.mjs +6 -6
- package/dist/resources/org/org.d.mts +1 -1
- package/dist/resources/org/org.mjs +1 -1
- package/dist/resources/org/owner/index.d.mts +1 -1
- package/dist/resources/org/owner/index.mjs +2 -2
- package/dist/resources/org/owner/owner.d.mts +1 -1
- package/dist/resources/org/owner/owner.mjs +1 -1
- package/dist/resources/org/owner/project.d.mts +1 -1
- package/dist/resources/org/owner/project.mjs +1 -1
- package/dist/resources/org/owner.d.mts +1 -1
- package/dist/resources/org/owner.mjs +2 -2
- package/dist/resources/org/project.d.mts +1 -1
- package/dist/resources/org/project.mjs +1 -1
- package/dist/resources/org/usage.d.mts +1 -1
- package/dist/resources/org/usage.mjs +1 -1
- package/dist/resources/org.d.mts +1 -1
- package/dist/resources/org.mjs +6 -6
- package/dist/resources/project/index.d.mts +1 -1
- package/dist/resources/project/index.mjs +1 -1
- package/dist/resources/project/project.d.mts +1 -1
- package/dist/resources/project/project.mjs +1 -1
- package/dist/resources/project/usage.d.mts +1 -1
- package/dist/resources/project/usage.mjs +1 -1
- package/dist/resources/project.d.mts +1 -1
- package/dist/resources/project.mjs +1 -1
- package/dist/resources/session-configs.d.mts +1 -1
- package/dist/resources/session-configs.mjs +1 -1
- package/dist/resources/tool-router/index.d.mts +1 -1
- package/dist/resources/tool-router/index.mjs +2 -2
- package/dist/resources/tool-router/session/files.d.mts +1 -1
- package/dist/resources/tool-router/session/files.mjs +1 -1
- package/dist/resources/tool-router/session/index.d.mts +1 -1
- package/dist/resources/tool-router/session/index.mjs +2 -2
- package/dist/resources/tool-router/session/session.d.mts +1 -1
- package/dist/resources/tool-router/session/session.mjs +1 -1
- package/dist/resources/tool-router/session.d.mts +1 -1
- package/dist/resources/tool-router/session.mjs +2 -2
- package/dist/resources/tool-router/tool-router.d.mts +1 -1
- package/dist/resources/tool-router/tool-router.mjs +1 -1
- package/dist/resources/tool-router.d.mts +1 -1
- package/dist/resources/tool-router.mjs +2 -2
- package/dist/resources/toolkits.d.mts +1 -1
- package/dist/resources/toolkits.mjs +1 -1
- package/dist/resources/tools.d.mts +1 -1
- package/dist/resources/tools.mjs +1 -1
- package/dist/resources/trigger-instances/index.d.mts +1 -1
- package/dist/resources/trigger-instances/index.mjs +2 -2
- package/dist/resources/trigger-instances/manage.d.mts +1 -1
- package/dist/resources/trigger-instances/manage.mjs +1 -1
- package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
- package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
- package/dist/resources/trigger-instances.d.mts +1 -1
- package/dist/resources/trigger-instances.mjs +2 -2
- package/dist/resources/triggers-types.d.mts +1 -1
- package/dist/resources/triggers-types.mjs +1 -1
- package/dist/resources/webhook-endpoints.d.mts +1 -1
- package/dist/resources/webhook-endpoints.mjs +1 -1
- package/dist/resources/webhook-subscriptions.d.mts +1 -1
- package/dist/resources/webhook-subscriptions.mjs +1 -1
- package/dist/{session-CtO_BX-m.mjs → session-BT5NJfbm.mjs} +1 -1
- package/dist/{session-Bmbv2Y2h.mjs → session-BmXeclWC.mjs} +2 -2
- package/dist/{session-configs-C_A0gUf5.d.mts → session-configs-x3OA4CSe.d.mts} +205 -97
- package/dist/{tool-router-BICZScC1.mjs → tool-router-DYPUf-fN.mjs} +1 -1
- package/dist/{toolkits-Cj8oNvQi.mjs → toolkits-DZOZDm-4.mjs} +1 -1
- package/dist/{tools-C-2Nsm32.mjs → tools-BDCRk80t.mjs} +1 -1
- package/dist/{tools-BiyVpJSA.mjs → tools-C0GjPEpP.mjs} +1 -1
- package/dist/{trigger-instances-0GIUz_qu.mjs → trigger-instances-J5frdgzO.mjs} +2 -2
- package/dist/{triggers-DWnL3gjv.mjs → triggers-CnvE7y0L.mjs} +1 -1
- package/dist/{triggers-types-BkigxzlE.mjs → triggers-types-DLVCtuwC.mjs} +1 -1
- package/dist/{usage-RRYqkjLH.mjs → usage-DPxuivP6.mjs} +1 -1
- package/dist/{usage-D9XlIZBX.mjs → usage-DjQg9WIV.mjs} +1 -1
- package/dist/version-DEAhxVwC.d.mts +4 -0
- package/dist/{webhook-endpoints-x3UiV7uH.mjs → webhook-endpoints-BrSjXOf0.mjs} +1 -1
- package/dist/{webhook-subscriptions-_7MTwe1s.mjs → webhook-subscriptions-HT1acmwH.mjs} +1 -1
- package/package.json +2 -2
- package/dist/version-BkHUhokz.d.mts +0 -4
package/README.md
CHANGED
|
@@ -6,17 +6,58 @@ This repo is the successor to the Stainless-generated [`@composio/client`](https
|
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
The package root is the
|
|
9
|
+
The package root is the Promise client: `new Composio({ auth })`, the Stainless type names, and throwing `APIPromise` semantics (shipped via UXE-163/UXE-164).
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
|
-
import Composio from '@composio/client'
|
|
12
|
+
import Composio, { Auth } from '@composio/client'
|
|
13
13
|
|
|
14
|
-
const composio = new Composio({
|
|
14
|
+
const composio = new Composio({ auth: Auth.project(process.env.COMPOSIO_API_KEY!) })
|
|
15
15
|
|
|
16
16
|
const session = await composio.toolRouter.session.create({ user_id: 'user_123' })
|
|
17
17
|
console.log(session.session_id, session.mcp.url)
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
### Authentication and scope
|
|
21
|
+
|
|
22
|
+
`auth` is required and says how every request authenticates. A request carries at most one Composio
|
|
23
|
+
credential.
|
|
24
|
+
|
|
25
|
+
| `auth` | Sends |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `Auth.project(key)` | `x-api-key` on every request to the API origin |
|
|
28
|
+
| `Auth.user(key)` | `x-user-api-key` on every request to the API origin |
|
|
29
|
+
| `Auth.organization(key)` | `x-org-api-key` on every request to the API origin |
|
|
30
|
+
| `Auth.auto({ project, user, organization })` | one of the keys given, chosen per operation: the project key wherever the operation accepts it, otherwise the first scheme it declares that a key is given for. This is how releases before rc.18 chose |
|
|
31
|
+
| `Auth.none()` | no credential. The credential header names are then ordinary headers, for a client used as a transport for schemes it does not model |
|
|
32
|
+
|
|
33
|
+
A fixed mode never consults the operation table. A key may be a function that returns one (or a
|
|
34
|
+
promise of one): it is called once per call, after the call starts, and its key is reused across
|
|
35
|
+
retries and same-origin redirects. It is not called for a call that starts off the API origin.
|
|
36
|
+
`client.authMode` reads the mode back; the client never returns a credential it was given as a
|
|
37
|
+
function.
|
|
38
|
+
|
|
39
|
+
`scope` names the organization and project the client addresses, sent as `x-org-id` and
|
|
40
|
+
`x-project-id` on requests to the API origin: `{ organizationId }`, `{ projectId }`, or both.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const composio = new Composio({
|
|
44
|
+
auth: Auth.user(() => vault.read('composio-user-key')),
|
|
45
|
+
scope: { organizationId: 'org_123', projectId: 'pr_456' },
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
A header name is reserved while something is configured to write it: the three credential names
|
|
50
|
+
while `auth` is not `none`, `x-org-id` and `x-project-id` while `scope` is set, and the identity
|
|
51
|
+
names as [below](#identify-the-calling-product). `defaultHeaders` and `COMPOSIO_CUSTOM_HEADERS` that
|
|
52
|
+
name a reserved header fail construction, and a call's `headers` that name one fail the call before
|
|
53
|
+
anything is sent. A client that needs another credential or scope derives one:
|
|
54
|
+
`composio.withOptions({ auth: Auth.project(key) })`. `withOptions` re-runs every construction check.
|
|
55
|
+
|
|
56
|
+
Three operations declare a credential or scope id as a header parameter
|
|
57
|
+
(`org.consumer.project.resolve`, `org.consumer.listConnectedToolkits`, `cli.createCodactFailure`).
|
|
58
|
+
Their signatures are unchanged: the value replaces the configured credential for that call, and an
|
|
59
|
+
`x-org-id` that disagrees with the configured `scope` fails the call.
|
|
60
|
+
|
|
20
61
|
### Pagination
|
|
21
62
|
|
|
22
63
|
Use the `@composio/client/pagination` subpath to traverse list operations that return the standard
|
|
@@ -65,28 +106,30 @@ cursor ends traversal. When a response omits `next_cursor` but numeric `current_
|
|
|
65
106
|
returning partial results; provide a custom adapter for that response shape. Requests are sequential
|
|
66
107
|
and inherit the normal client retry/backoff path, but this is not proactive/shared rate-limit pacing.
|
|
67
108
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
applications that load configuration themselves:
|
|
109
|
+
The constructor reads nothing from the process. `Composio.fromEnv` is the one reader of the
|
|
110
|
+
environment, and it reads the mapping it is handed:
|
|
71
111
|
|
|
72
112
|
```ts
|
|
73
|
-
const composio = Composio.fromEnv(
|
|
113
|
+
const composio = Composio.fromEnv(process.env, { environment: 'staging' })
|
|
74
114
|
```
|
|
75
115
|
|
|
76
|
-
`fromEnv`
|
|
77
|
-
`
|
|
78
|
-
`
|
|
79
|
-
not
|
|
116
|
+
`fromEnv` reads `COMPOSIO_API_KEY`, `COMPOSIO_USER_API_KEY` and `COMPOSIO_ORG_API_KEY` into `auth`
|
|
117
|
+
(one set: that fixed mode; several: `Auth.auto`; none: `Auth.none()`), and `COMPOSIO_BASE_URL`,
|
|
118
|
+
`COMPOSIO_ALLOW_INSECURE_HTTP=1`, `COMPOSIO_CUSTOM_HEADERS` (as `defaultHeaders`) and
|
|
119
|
+
`COMPOSIO_LOG_LEVEL`. It does not read `COMPOSIO_ORG_ID` or `COMPOSIO_PROJECT_ID`: `scope` is always
|
|
120
|
+
an argument. An override replaces the whole field it names, so `{ auth: Auth.none() }` means none
|
|
121
|
+
whatever the mapping holds. Derived clients created with `withOptions()` keep using the resolved
|
|
122
|
+
snapshot.
|
|
80
123
|
|
|
81
124
|
Inject a `Transport` when an application or test needs to own HTTP dispatch. The transport receives
|
|
82
125
|
a complete `Request`; retries, credential-safe redirects, timeouts, and response parsing stay in the
|
|
83
126
|
client:
|
|
84
127
|
|
|
85
128
|
```ts
|
|
86
|
-
import Composio, { createFetchTransport } from '@composio/client'
|
|
129
|
+
import Composio, { Auth, createFetchTransport } from '@composio/client'
|
|
87
130
|
|
|
88
131
|
const transport = createFetchTransport({ fetch: instrumentedFetch })
|
|
89
|
-
const composio = new Composio({ apiKey, transport })
|
|
132
|
+
const composio = new Composio({ auth: Auth.project(apiKey), transport })
|
|
90
133
|
```
|
|
91
134
|
|
|
92
135
|
Without a `transport`, the client resolves `globalThis.fetch` when a request is sent, so late
|
|
@@ -133,13 +176,13 @@ subpaths never import it and load without it.
|
|
|
133
176
|
```ts
|
|
134
177
|
import { Effect, Layer } from 'effect'
|
|
135
178
|
import * as FetchHttpClient from 'effect/http/FetchHttpClient'
|
|
136
|
-
import { ComposioClient, layer, layerConfig, layerFetch } from '@composio/client/effect'
|
|
179
|
+
import { Auth, ComposioClient, layer, layerConfig, layerFetch } from '@composio/client/effect'
|
|
137
180
|
|
|
138
181
|
// Explicit options, over a fetch-backed `HttpClient` the layer brings with it.
|
|
139
|
-
const live = layerFetch({
|
|
182
|
+
const live = layerFetch({ auth: Auth.project('your-api-key') })
|
|
140
183
|
|
|
141
184
|
// Explicit options, over the `HttpClient` the application provides.
|
|
142
|
-
const overMyTransport = layer({
|
|
185
|
+
const overMyTransport = layer({ auth: Auth.project('your-api-key') }).pipe(Layer.provide(FetchHttpClient.layer))
|
|
143
186
|
|
|
144
187
|
// Options read from the `COMPOSIO_*` settings.
|
|
145
188
|
const fromConfig = layerConfig().pipe(Layer.provide(FetchHttpClient.layer))
|
|
@@ -156,15 +199,24 @@ const slug: Promise<string> = Effect.runPromise(program.pipe(Effect.provide(live
|
|
|
156
199
|
`make(options, httpClient)` builds the same client synchronously from an `HttpClient` you already
|
|
157
200
|
hold, and throws where the layers fail.
|
|
158
201
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
`
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
`
|
|
167
|
-
|
|
202
|
+
`auth` and `scope` mean what they mean on the root client (see
|
|
203
|
+
[Authentication and scope](#authentication-and-scope)), and `Auth` is exported from
|
|
204
|
+
`@composio/client/effect` too. A key may also be a `Redacted<string>`, or a function returning a
|
|
205
|
+
string or a `Redacted<string>`. There is no `withOptions`: a client is a value, and a caller that
|
|
206
|
+
needs another credential calls `make` again with the same `HttpClient`.
|
|
207
|
+
|
|
208
|
+
Only `layerConfig` reads the environment. It reads `COMPOSIO_API_KEY`, `COMPOSIO_USER_API_KEY` and
|
|
209
|
+
`COMPOSIO_ORG_API_KEY` into `auth` by the rule `Composio.fromEnv` applies, each key `Redacted`
|
|
210
|
+
throughout, and `COMPOSIO_BASE_URL` and `COMPOSIO_ALLOW_INSECURE_HTTP=1`, through Effect's `Config`,
|
|
211
|
+
so the `ConfigProvider` in context decides where they come from; by default that is the process
|
|
212
|
+
environment. An option passed to `layerConfig` replaces the setting it names, so
|
|
213
|
+
`layerConfig({ auth: Auth.none() })` means none whatever is configured. `make`, `layer` and
|
|
214
|
+
`layerFetch` read nothing.
|
|
215
|
+
|
|
216
|
+
Construction fails with a `ConfigurationError` when a credentialed origin is not HTTPS (loopback and
|
|
217
|
+
`allowInsecureHTTP` excepted, as on the root client), when a key or a header option is refused, or
|
|
218
|
+
when `decode: true` is given without `schemas`. A credential provider that fails, or returns
|
|
219
|
+
something a header cannot carry, fails the call with a `ConfigurationError` before anything is sent.
|
|
168
220
|
|
|
169
221
|
The resources are plain objects of functions, not classes, so a method can be passed around without
|
|
170
222
|
binding. One thing on the root client has no counterpart here: the resources that hold no operation
|
|
@@ -287,7 +339,7 @@ import { make } from '@composio/client/effect'
|
|
|
287
339
|
import { schemaLoaders } from '@composio/client/effect/schemas'
|
|
288
340
|
|
|
289
341
|
const checkedCategories = (httpClient: HttpClient.HttpClient) => {
|
|
290
|
-
const composio = make({
|
|
342
|
+
const composio = make({ auth: Auth.project('your-api-key'), schemas: schemaLoaders }, httpClient)
|
|
291
343
|
return composio.toolkits.retrieveCategories({ decode: true }).pipe(
|
|
292
344
|
Effect.catchTag('@composio/client/DecodeError', (error) =>
|
|
293
345
|
Effect.logError(`${error.operation}: ${JSON.stringify(error.issues)}`).pipe(Effect.as(null)),
|
|
@@ -345,10 +397,10 @@ top of the span itself.
|
|
|
345
397
|
|
|
346
398
|
### Credentials and redaction
|
|
347
399
|
|
|
348
|
-
A request carries one credential header, chosen
|
|
349
|
-
`x-user-api-key` or `x-org-api-key`. The client holds
|
|
350
|
-
three header names to Effect's redaction list for its requests, so spans and renderings
|
|
351
|
-
show `<redacted>`; Effect's own list knows only `x-api-key`.
|
|
400
|
+
A request carries at most one credential header, chosen by `auth` as on the root client:
|
|
401
|
+
`x-api-key`, `x-user-api-key` or `x-org-api-key`. The client holds every key as a `Redacted` value
|
|
402
|
+
and adds all three header names to Effect's redaction list for its requests, so spans and renderings
|
|
403
|
+
of a request show `<redacted>`; Effect's own list knows only `x-api-key`.
|
|
352
404
|
|
|
353
405
|
No error the client produces holds the request, the transport's error or a credential value. One
|
|
354
406
|
caveat: `APIConnectionError.description` is the transport's own message text, copied. A transport
|
|
@@ -432,6 +484,37 @@ decodes, then with the loader table and every schema it reaches.
|
|
|
432
484
|
of which 2.1 MB and 328 files are `dist/effect/schemas*`, against 1.1 MB in 176 files for
|
|
433
485
|
`2.0.0-rc.11` as published. None of it is on the root entry's import path.
|
|
434
486
|
|
|
487
|
+
### Identify the calling product
|
|
488
|
+
|
|
489
|
+
A product built on the client passes `identity` instead of setting headers by hand. The root client
|
|
490
|
+
and `./effect` take the same option:
|
|
491
|
+
|
|
492
|
+
```ts
|
|
493
|
+
const composio = new Composio({
|
|
494
|
+
auth: Auth.project(apiKey),
|
|
495
|
+
identity: { product: '@composio/core', version: '0.9.0', source: 'TYPESCRIPT_SDK', framework: 'openai' },
|
|
496
|
+
})
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
| Header | Sent from | Without `identity` |
|
|
500
|
+
| --- | --- | --- |
|
|
501
|
+
| `x-client-provenance`, `x-client-version` | `product`, `version` | the package name and version |
|
|
502
|
+
| `x-sdk-version` | `version` | not sent |
|
|
503
|
+
| `x-source`, `x-framework` | `source`, `framework` | not sent |
|
|
504
|
+
| `x-runtime` | `runtime`, else the detected runtime | the detected runtime |
|
|
505
|
+
| `x-client-runtime`, `x-runtime-version` | the detected runtime | the detected runtime |
|
|
506
|
+
| `x-client-library`, `x-client-library-version`, `x-client-language` | the package | the package |
|
|
507
|
+
|
|
508
|
+
The three library headers are the package's own: `defaultHeaders`, `COMPOSIO_CUSTOM_HEADERS` and a
|
|
509
|
+
call's `headers` cannot set or delete them. Once `identity` is set, the same holds for every header
|
|
510
|
+
in the table. A refused name fails construction (`ComposioError`, or `ConfigurationError` on
|
|
511
|
+
`./effect`), or the call before anything is sent. Identity values must be non-empty printable ASCII
|
|
512
|
+
with no surrounding whitespace, and are sent to the configured API origin only.
|
|
513
|
+
|
|
514
|
+
The detected runtime is one of `nodejs`, `bun`, `deno`, `cloudflare`, `vercel_edge`, `netlify`,
|
|
515
|
+
`fastly` or `unknown`, checked in [`std-env`](https://github.com/unjs/std-env)'s order; the
|
|
516
|
+
Python client always reports `python`.
|
|
517
|
+
|
|
435
518
|
## Upgrade from Stainless 0.1.x to 2.0
|
|
436
519
|
|
|
437
520
|
By default, the 2.0 client refuses to send credentials over plain HTTP unless the hostname is
|
|
@@ -440,13 +523,13 @@ configured origin:
|
|
|
440
523
|
|
|
441
524
|
```ts
|
|
442
525
|
const composio = new Composio({
|
|
443
|
-
apiKey,
|
|
526
|
+
auth: Auth.project(apiKey),
|
|
444
527
|
baseURL: 'http://host.docker.internal:9900',
|
|
445
528
|
allowInsecureHTTP: true,
|
|
446
529
|
})
|
|
447
530
|
```
|
|
448
531
|
|
|
449
|
-
The equivalent environment configuration is:
|
|
532
|
+
The equivalent environment configuration, for `Composio.fromEnv`, is:
|
|
450
533
|
|
|
451
534
|
```sh
|
|
452
535
|
COMPOSIO_BASE_URL=http://host.docker.internal:9900 \
|
|
@@ -457,6 +540,37 @@ The opt-in records the resolved scheme, hostname, and port. Mutating `baseURL` c
|
|
|
457
540
|
and `withOptions({ baseURL: ... })` requires `allowInsecureHTTP: true` again when the origin
|
|
458
541
|
changes. Redirects to another origin remain credential-free.
|
|
459
542
|
|
|
543
|
+
### Removed in 2.0.0-rc.18
|
|
544
|
+
|
|
545
|
+
Each removal is a declared entry in `packages/codegen/assignability-ledger.json`. The other rows are
|
|
546
|
+
behaviour the type check cannot see, listed so an upgrade can find them.
|
|
547
|
+
|
|
548
|
+
| Removed | Migration |
|
|
549
|
+
| --- | --- |
|
|
550
|
+
| `apiKey` (root `ClientOptions` and `./effect` `ComposioClientOptions`) | `auth: Auth.project(key)` |
|
|
551
|
+
| `userApiKey` | `auth: Auth.user(key)`, which sends the user key on every request. The old per-operation selection is `Auth.auto({ project, user, organization })` |
|
|
552
|
+
| `orgApiKey` | `auth: Auth.organization(key)`, or `Auth.auto({ ... })` |
|
|
553
|
+
| `apiKey: null` plus a credential in `defaultHeaders` | the `auth` that credential is. While `auth` is not `none`, `defaultHeaders`, `COMPOSIO_CUSTOM_HEADERS` and a call's `headers` cannot name `x-api-key`, `x-user-api-key` or `x-org-api-key` |
|
|
554
|
+
| `x-api-key` overriding the credential for one call | a second client: `withOptions({ auth: Auth.project(key) })` on the root, `make({ ...options, auth: Auth.project(key) }, httpClient)` on `./effect` |
|
|
555
|
+
| `x-org-id`, `x-project-id` in `defaultHeaders` | `scope: { organizationId, projectId }`, which reserves both names. Without `scope` they are still ordinary headers |
|
|
556
|
+
| the constructor reading `COMPOSIO_*` from the process | `Composio.fromEnv(process.env, overrides)`; nothing else reads the environment. `new Composio()` with no options is gone with it |
|
|
557
|
+
| `layerConfig({ apiKey: null })` | `layerConfig({ auth: Auth.none() })`; an override replaces the whole `auth` |
|
|
558
|
+
| `layer()`, `layerFetch()` with no options | pass the options, `auth` included |
|
|
559
|
+
| assigning `client.apiKey`, `userApiKey` or `orgApiKey` | `withOptions({ auth })`. The three fields stay readable until rc.19 and read the string keys `auth` holds; keep your own copy of a key you need |
|
|
560
|
+
| `Credential` on `./effect` accepting `null` | `Auth.none()`. It now also accepts a function that returns a key |
|
|
561
|
+
|
|
562
|
+
Python makes the same change: `auth=ProjectAuth(key)` (and `UserAuth`, `OrganizationAuth`,
|
|
563
|
+
`AutoAuth`, `NoAuth`) and `scope=Scope(...)`, see [`python/README.md`](./python/README.md).
|
|
564
|
+
|
|
565
|
+
### Changed in 2.0.0-rc.17
|
|
566
|
+
|
|
567
|
+
`defaultHeaders`, `COMPOSIO_CUSTOM_HEADERS` and per-call `headers` refuse the library headers
|
|
568
|
+
(`x-client-library`, `x-client-library-version`, `x-client-language`), and refuse every identity
|
|
569
|
+
header once `identity` is set. A wrapper that set its product headers through `defaultHeaders`
|
|
570
|
+
moves them into `identity` (see [Identify the calling product](#identify-the-calling-product)).
|
|
571
|
+
Python takes `identity=ClientIdentity(...)` under the same rule. The type surface is unchanged
|
|
572
|
+
apart from the added option, so the release declares no ledger entry.
|
|
573
|
+
|
|
460
574
|
### Removed in 2.0.0-rc.16
|
|
461
575
|
|
|
462
576
|
Each row is a declared entry in `packages/codegen/assignability-ledger.json`, the list of what a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/api-key-revocation.ts
|
|
4
4
|
const OP_CREATE = generatedOperation("apiKeyRevocation.create");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as path, n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/auth-configs.ts
|
|
4
4
|
const OP_CREATE = generatedOperation("authConfigs.create");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/org/clanker.ts
|
|
4
4
|
const OP_CREATE_CLAIM = generatedOperation("org.clanker.createClaim");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Realtime } from "./realtime-
|
|
1
|
+
import { n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
|
+
import { t as Realtime } from "./realtime-W-lJ0Vcs.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/compat/resources/cli/cli.ts
|
|
5
5
|
const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
|
|
@@ -22,9 +22,8 @@ var Cli = class {
|
|
|
22
22
|
const { "x-user-api-key": xUserApiKey, ...body } = params;
|
|
23
23
|
return this.#client.post("/api/v3.1/cli/codact_failures", withOperation(OP_CREATE_CODACT_FAILURE, {
|
|
24
24
|
body,
|
|
25
|
-
...options
|
|
26
|
-
|
|
27
|
-
}));
|
|
25
|
+
...options
|
|
26
|
+
}, { "x-user-api-key": xUserApiKey }));
|
|
28
27
|
}
|
|
29
28
|
createSession(body = {}, options) {
|
|
30
29
|
return this.#client.post("/api/v3.1/cli/create-session", withOperation(OP_CREATE_SESSION, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as path, n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/connected-accounts.ts
|
|
4
4
|
const OP_CREATE = generatedOperation("connectedAccounts.create");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Project } from "./project-
|
|
1
|
+
import { n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
|
+
import { t as Project } from "./project-C_YZ-eLI.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/compat/resources/org/consumer/consumer.ts
|
|
5
5
|
const OP_LIST_CONNECTED_TOOLKITS = generatedOperation("org.consumer.listConnectedToolkits");
|
|
@@ -20,11 +20,10 @@ var Consumer = class {
|
|
|
20
20
|
const { "x-user-api-key": xUserApiKey, "x-org-id": xOrgId, ...query } = params;
|
|
21
21
|
return this.#client.get("/api/v3.1/org/consumer/connected_toolkits", withOperation(OP_LIST_CONNECTED_TOOLKITS, {
|
|
22
22
|
query,
|
|
23
|
-
...options
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, options?.headers])
|
|
23
|
+
...options
|
|
24
|
+
}, {
|
|
25
|
+
"x-user-api-key": xUserApiKey,
|
|
26
|
+
"x-org-id": xOrgId
|
|
28
27
|
}));
|
|
29
28
|
}
|
|
30
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/mcp/custom.ts
|
|
4
4
|
const OP_CREATE = generatedOperation("mcp.custom.create");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as path, n as generatedOperation, y as withOperation } from "./generated-operations-DKgGT6Dg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/custom.ts
|
|
4
4
|
const OP_DELETE_TOOLKIT = generatedOperation("custom.deleteToolkit");
|
package/dist/effect.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as ProjectRegenerateAPIKeyResponse, $n as ToolkitRetrieveChangelogResponse, $r as SessionCreateResponse, $t as McpCreateInstanceParams, A as ClankerCreateClaimResponse, An as TriggersTypeListParams, Ar as FileListResponse$1, At as LogRetrieveToolExecutionResponse, B as ConsumerListConnectedToolkitsParams, Bn as AuthConfigListParams, Br as ToolRetrieveEnumResponse, Ci as FileDeleteResponse, Cn as TriggerInstanceUpsertParams, Cr as ConnectedAccountRevokeResponse, D as OrgListResponse, Dn as ManageDeleteResponse, Dr as FileCreatePresignedURLParams, Dt as UsageRetrieveSummaryResponse, E as OrgListParams, Et as UsageRetrieveSummaryParams, F as UsageRetrieveSummaryResponse$1,
|
|
2
|
-
import { t as VERSION } from "./version-
|
|
1
|
+
import { $ as ProjectRegenerateAPIKeyResponse, $i as HeadersLike, $n as ToolkitRetrieveChangelogResponse, $r as SessionCreateResponse, $t as McpCreateInstanceParams, A as ClankerCreateClaimResponse, Ai as AuthOf, An as TriggersTypeListParams, Ar as FileListResponse$1, At as LogRetrieveToolExecutionResponse, B as ConsumerListConnectedToolkitsParams, Bn as AuthConfigListParams, Br as ToolRetrieveEnumResponse, Ci as FileDeleteResponse, Cn as TriggerInstanceUpsertParams, Cr as ConnectedAccountRevokeResponse, D as OrgListResponse, Dn as ManageDeleteResponse, Dr as FileCreatePresignedURLParams, Dt as UsageRetrieveSummaryResponse, E as OrgListParams, Et as UsageRetrieveSummaryParams, F as UsageRetrieveSummaryResponse$1, Fr as ToolGetInputResponse, Ft as ToolRetrieveResponse$1, Gn as AuthConfigUpdateStatusParams, Gt as CliCreateSessionResponse, Hn as AuthConfigRetrieveResponse, Hr as ToolRetrieveRequiredScopesParams, Ht as CliCreateCodactFailureParams, In as AuthConfigCreateParams, Ir as ToolListParams, J as ProjectCreateResponse, Jn as ToolkitListParams, Jr as SessionAttachParams, Kn as AuthConfigUpdateStatusResponse, Kt as CliGetSessionParams, L as ProjectListParams$1, Li as APIErrorBody, Ln as AuthConfigCreateResponse, Lr as ToolListResponse, Lt as TriggerListParams, M as UsageRetrieveParams$1, Mn as TriggersTypeRetrieveEnumResponse, Mr as ToolExecuteParams, Mt as ToolListFieldsResponse, N as UsageRetrieveResponse$1, Ni as Scope, Nn as TriggersTypeRetrieveParams, Nr as ToolExecuteResponse, Nt as ToolListParams$1, Oi as AuthConstructors, On as ManageUpdateParams, Or as FileCreatePresignedURLResponse, Ot as LogCreateToolExecutionParams, P as UsageRetrieveSummaryParams$1, Pn as TriggersTypeRetrieveResponse, Pr as ToolGetInputParams, Pt as ToolListResponse$1, Q as ProjectListResponse, Qi as ClientIdentity, Qn as ToolkitRetrieveCategoriesResponse, Qr as SessionCreateParams, R as ProjectListResponse$1, Rn as AuthConfigDeleteParams, Rr as ToolProxyParams, Rt as TriggerListResponse, Si as FileDeleteParams, Sn as TriggerInstanceListActiveResponse, Sr as ConnectedAccountRetrieveResponse, Ti as FileListResponse, Tr as ConnectedAccountUpdateStatusResponse, Tt as UsageRetrieveResponse, U as ProjectResolveParams, Un as AuthConfigUpdateParams, Ur as ToolRetrieveRequiredScopesResponse, Ut as CliCreateCodactFailureResponse, V as ConsumerListConnectedToolkitsResponse, Vn as AuthConfigListResponse, Vr as ToolRetrieveParams, W as ProjectResolveResponse, Wn as AuthConfigUpdateResponse, Wr as ToolRetrieveResponse, Wt as CliCreateSessionParams, X as ProjectDeleteResponse, Xn as ToolkitRecommendScopesParams, Xr as SessionConfigHistoryParams, Xt as RealtimeAuthResponse, Y as ProjectDeleteParams, Yn as ToolkitListResponse, Yr as SessionAttachResponse, Yt as RealtimeAuthParams, Z as ProjectListParams, Zn as ToolkitRecommendScopesResponse, Zr as SessionConfigHistoryResponse, Zt as RealtimeCredentialsResponse, _ as CustomUpsertParams, _i as SessionToolsResponse, _n as GenerateURLResponse, _r as ConnectedAccountListResponse, _t as WebhookSubscriptionRetrieveResponse, ai as SessionLinkParams, an as McpDeleteResponse, ar as ToolkitRetrieveScopesGrantContextResponse, at as WebhookEndpointReplaceParams, b as ApiKeyRevocationCreateParams, bi as FileCreateUploadURLParams, bn as CustomCreateResponse, br as ConnectedAccountRefreshParams, bt as WebhookSubscriptionUpdateResponse, ci as SessionPatchResponse, cn as McpListParams, cr as LinkCreateParams, ct as WebhookEndpointUpdateParams, d as KeyringListTransferKeysResponse, di as SessionRetrieveResponse, dn as McpRetrieveAppResponse, dr as ConnectedAccountCompleteAuthResponse, dt as WebhookSubscriptionCreateParams, ei as SessionDeleteResponse, en as McpCreateInstanceResponse, er as ToolkitRetrieveMultiParams, et as ProjectRetrieveResponse, fi as SessionSearchParams, fn as McpRetrieveResponse, fr as ConnectedAccountCreateParams, ft as WebhookSubscriptionCreateResponse, g as CustomSyncResponse, gi as SessionToolsParams, gn as GenerateURLParams, gr as ConnectedAccountListParams, gt as WebhookSubscriptionListResponse, h as CustomSyncParams, hi as SessionToolkitsResponse, hr as ConnectedAccountDeleteResponse, ht as WebhookSubscriptionListParams, i as SessionConfigsRetrieveResponse, ii as SessionExecuteResponse, in as McpDeleteInstanceResponse, ir as ToolkitRetrieveScopesGrantContextParams, it as WebhookEndpointListResponse, ji as AutoCredentials, jn as TriggersTypeListResponse, k as ClankerCreateClaimParams, kn as ManageUpdateResponse, kr as FileListParams$1, kt as LogCreateToolExecutionResponse, li as SessionProxyExecuteParams, ln as McpListResponse, lr as LinkCreateResponse, lt as WebhookEndpointUpdateResponse, m as CustomDeleteToolkitResponse, mi as SessionToolkitsParams, mn as McpUpdateResponse, mr as ConnectedAccountDeleteParams, mt as WebhookSubscriptionListEventTypesResponse, n as SessionConfigsListParams, ni as SessionExecuteMetaResponse, nn as McpCreateResponse, nr as ToolkitRetrieveParams, nt as WebhookEndpointCreateResponse, oi as SessionLinkResponse, on as McpListInstancesParams, ot as WebhookEndpointReplaceResponse, p as CustomDeleteToolkitParams, pi as SessionSearchResponse, pn as McpUpdateParams, pr as ConnectedAccountCreateResponse, pt as WebhookSubscriptionDeleteResponse, q as ProjectCreateParams, qt as CliGetSessionResponse, r as SessionConfigsListResponse, ri as SessionExecuteParams, rn as McpDeleteInstanceParams, rr as ToolkitRetrieveResponse, rt as WebhookEndpointListParams, si as SessionPatchParams, sn as McpListInstancesResponse, st as WebhookEndpointRetrieveResponse, ti as SessionExecuteMetaParams, tn as McpCreateParams, tr as ToolkitRetrieveMultiResponse, tt as WebhookEndpointCreateParams, ui as SessionProxyExecuteResponse, un as McpRetrieveAppParams, ur as ConnectedAccountCompleteAuthParams, v as CustomUpsertResponse, vi as FileCreateDownloadURLParams, vr as ConnectedAccountPatchParams, vt as WebhookSubscriptionRotateSecretResponse, w as SessionRetrieveInfoResponse, wi as FileListParams, wn as TriggerInstanceUpsertResponse, wr as ConnectedAccountUpdateStatusParams, wt as UsageRetrieveParams, x as ApiKeyRevocationCreateResponse, xi as FileCreateUploadURLResponse, xn as TriggerInstanceListActiveParams, xr as ConnectedAccountRefreshResponse, yi as FileCreateDownloadURLResponse, yn as CustomCreateParams, yr as ConnectedAccountPatchResponse, yt as WebhookSubscriptionUpdateParams, zn as AuthConfigDeleteResponse, zr as ToolProxyResponse, zt as TriggerRetrieveResponse } from "./session-configs-x3OA4CSe.mjs";
|
|
2
|
+
import { t as VERSION } from "./version-DEAhxVwC.mjs";
|
|
3
3
|
import { Context, Effect, Layer, Redacted, Stream } from "effect";
|
|
4
4
|
import * as HttpClient from "effect/http/HttpClient";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
@@ -130,6 +130,18 @@ declare const isAPIError: (value: unknown) => value is APIStatusError;
|
|
|
130
130
|
/** Whether a value is any error this surface produces. Structural, like {@link isAPIError}. */
|
|
131
131
|
declare const isComposioError: (value: unknown) => value is ComposioError;
|
|
132
132
|
//#endregion
|
|
133
|
+
//#region src/effect/credentials.d.ts
|
|
134
|
+
type Key = string | Redacted.Redacted<string>;
|
|
135
|
+
/**
|
|
136
|
+
* A key, or a function that returns one, as the Effect client takes it: a
|
|
137
|
+
* string or a `Redacted<string>`. A function is called once per call, after
|
|
138
|
+
* the call starts, and its key is reused across retries and same-origin
|
|
139
|
+
* redirects.
|
|
140
|
+
*/
|
|
141
|
+
type Credential = Key | (() => Key | PromiseLike<Key>);
|
|
142
|
+
/** How the Effect client authenticates: `Auth.project(key)` and its siblings, with `Redacted` keys accepted. */
|
|
143
|
+
type Auth$2 = AuthOf<Credential>;
|
|
144
|
+
//#endregion
|
|
133
145
|
//#region src/effect/decode.d.ts
|
|
134
146
|
/**
|
|
135
147
|
* What a client decodes with: an operation's public chain (`toolkits.list`) →
|
|
@@ -573,7 +585,7 @@ interface Session {
|
|
|
573
585
|
//#endregion
|
|
574
586
|
//#region src/effect/generated/resources/auth/auth.d.ts
|
|
575
587
|
/** `client.auth` on the Effect surface. */
|
|
576
|
-
interface Auth {
|
|
588
|
+
interface Auth$1 {
|
|
577
589
|
readonly session: Session;
|
|
578
590
|
}
|
|
579
591
|
//#endregion
|
|
@@ -627,7 +639,7 @@ interface ClientResources {
|
|
|
627
639
|
readonly webhookSubscriptions: WebhookSubscriptions;
|
|
628
640
|
readonly webhookEndpoints: WebhookEndpoints;
|
|
629
641
|
readonly org: Org;
|
|
630
|
-
readonly auth: Auth;
|
|
642
|
+
readonly auth: Auth$1;
|
|
631
643
|
readonly apiKeyRevocation: ApiKeyRevocation;
|
|
632
644
|
readonly custom: Custom;
|
|
633
645
|
readonly keyring: Keyring;
|
|
@@ -635,15 +647,30 @@ interface ClientResources {
|
|
|
635
647
|
}
|
|
636
648
|
//#endregion
|
|
637
649
|
//#region src/effect/client.d.ts
|
|
638
|
-
/**
|
|
639
|
-
type
|
|
650
|
+
/** How the client authenticates; a key may be a string, a `Redacted<string>`, or a function that returns either. */
|
|
651
|
+
type Auth = Auth$2;
|
|
652
|
+
/**
|
|
653
|
+
* The constructors of {@link Auth}, the same as the root entry's: `Auth.project(key)`,
|
|
654
|
+
* `Auth.user(key)`, `Auth.organization(key)`, `Auth.auto({ ... })` and
|
|
655
|
+
* `Auth.none()`. A key may be a string, a `Redacted<string>`, or a function
|
|
656
|
+
* that returns either.
|
|
657
|
+
*/
|
|
658
|
+
declare const Auth: AuthConstructors<Credential>;
|
|
640
659
|
interface ClientSettings {
|
|
641
|
-
/**
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
660
|
+
/**
|
|
661
|
+
* How the client authenticates. A fixed mode sends its credential on every
|
|
662
|
+
* request to the API origin; `Auth.auto` picks one per operation; with
|
|
663
|
+
* `Auth.none()` the credential header names are the caller's. While `auth`
|
|
664
|
+
* is not `none`, neither `defaultHeaders` nor a call's `headers` may name a
|
|
665
|
+
* credential header.
|
|
666
|
+
*/
|
|
667
|
+
readonly auth: Auth;
|
|
668
|
+
/**
|
|
669
|
+
* The organization and project the client addresses, sent as `x-org-id` and
|
|
670
|
+
* `x-project-id`. While it is set, neither `defaultHeaders` nor a call's
|
|
671
|
+
* `headers` may name either header.
|
|
672
|
+
*/
|
|
673
|
+
readonly scope?: Scope | undefined;
|
|
647
674
|
/** The API origin. Defaults to `https://backend.composio.dev`. */
|
|
648
675
|
readonly baseURL?: string | undefined;
|
|
649
676
|
/**
|
|
@@ -651,7 +678,19 @@ interface ClientSettings {
|
|
|
651
678
|
* origin. The permission is limited to the resolved scheme, host, and port.
|
|
652
679
|
*/
|
|
653
680
|
readonly allowInsecureHTTP?: boolean | undefined;
|
|
654
|
-
/**
|
|
681
|
+
/**
|
|
682
|
+
* The calling product, sent as the product headers (`x-client-provenance`,
|
|
683
|
+
* `x-client-version`, `x-sdk-version`, `x-source`, `x-framework`,
|
|
684
|
+
* `x-runtime`). With it set, neither `defaultHeaders` nor a call's `headers`
|
|
685
|
+
* may name an identity header; without it the client reports itself.
|
|
686
|
+
*/
|
|
687
|
+
readonly identity?: ClientIdentity | undefined;
|
|
688
|
+
/**
|
|
689
|
+
* Headers sent on every request; per-call headers win, `null` deletes. The
|
|
690
|
+
* library headers (`x-client-library`, `x-client-library-version`,
|
|
691
|
+
* `x-client-language`) are the client's own and are refused here, as is
|
|
692
|
+
* every identity header once `identity` is set.
|
|
693
|
+
*/
|
|
655
694
|
readonly defaultHeaders?: HeadersLike;
|
|
656
695
|
/**
|
|
657
696
|
* Maximum retries for temporary failures of a call whose method is
|
|
@@ -687,7 +726,7 @@ interface ClientSettings {
|
|
|
687
726
|
* ```ts
|
|
688
727
|
* import { schemaLoaders } from '@composio/client/effect/schemas'
|
|
689
728
|
*
|
|
690
|
-
* make({
|
|
729
|
+
* make({ auth: Auth.project(key), decode: true, schemas: schemaLoaders }, httpClient)
|
|
691
730
|
* ```
|
|
692
731
|
*/
|
|
693
732
|
type DecodingOptions = {
|
|
@@ -728,29 +767,34 @@ declare class ComposioClient extends ComposioClient_base {}
|
|
|
728
767
|
* Reads no environment variable.
|
|
729
768
|
*
|
|
730
769
|
* @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
|
|
731
|
-
* credential cannot be sent as a header,
|
|
732
|
-
*
|
|
770
|
+
* credential cannot be sent as a header, `identity` is invalid or
|
|
771
|
+
* `defaultHeaders` names an identity header, or the client is to decode and
|
|
772
|
+
* was given no schemas.
|
|
733
773
|
*/
|
|
734
774
|
declare const make: (options: ComposioClientOptions, httpClient: HttpClient.HttpClient) => ComposioClientShape;
|
|
735
775
|
/**
|
|
736
776
|
* Provides the client from explicit options and the `HttpClient` in context.
|
|
737
777
|
* Reads no environment variable.
|
|
738
778
|
*/
|
|
739
|
-
declare const layer: (options
|
|
779
|
+
declare const layer: (options: ComposioClientOptions) => Layer.Layer<ComposioClient, ConfigurationError, HttpClient.HttpClient>;
|
|
740
780
|
/**
|
|
741
781
|
* {@link layer} over a fetch-backed `HttpClient`, for an application that has
|
|
742
782
|
* no transport of its own to supply. `fetch` is the platform's, or whatever
|
|
743
783
|
* the `FetchHttpClient.Fetch` reference in context names.
|
|
744
784
|
*/
|
|
745
|
-
declare const layerFetch: (options
|
|
785
|
+
declare const layerFetch: (options: ComposioClientOptions) => Layer.Layer<ComposioClient, ConfigurationError>;
|
|
746
786
|
/**
|
|
747
|
-
* Provides the client from the `COMPOSIO_*` settings
|
|
748
|
-
* `
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
787
|
+
* Provides the client from the `COMPOSIO_*` settings, read through the
|
|
788
|
+
* `ConfigProvider` in context, which is the process environment unless the
|
|
789
|
+
* application says otherwise. `COMPOSIO_API_KEY`, `COMPOSIO_USER_API_KEY` and
|
|
790
|
+
* `COMPOSIO_ORG_API_KEY` become `auth` by the rule `Composio.fromEnv` applies
|
|
791
|
+
* (one set: that fixed mode; several: `Auth.auto`; none: `Auth.none()`), each
|
|
792
|
+
* key `Redacted` throughout; `COMPOSIO_BASE_URL` and
|
|
793
|
+
* `COMPOSIO_ALLOW_INSECURE_HTTP=1` are read too. `COMPOSIO_ORG_ID` and
|
|
794
|
+
* `COMPOSIO_PROJECT_ID` are not: `scope` is an argument. An option given here
|
|
795
|
+
* replaces the whole setting it names, so `{ auth: Auth.none() }` means none
|
|
796
|
+
* whatever is configured.
|
|
753
797
|
*/
|
|
754
|
-
declare const layerConfig: (
|
|
798
|
+
declare const layerConfig: (overrides?: Partial<ClientSettings> & DecodingOptions) => Layer.Layer<ComposioClient, ConfigurationError, HttpClient.HttpClient>;
|
|
755
799
|
//#endregion
|
|
756
|
-
export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, type APIErrorFields, type APIStatusError, AuthenticationError, BadRequestError, ComposioClient, type ComposioClientOptions, type ComposioClientShape, type ComposioError, ConfigurationError, ConflictError, type Credential, DecodeError, type DecodeIssue, type DeprecationNotices, type HeadersLike, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, type RawBodyRequestOptions, type RawRequestOptions, type RequestOptions, type SchemaLoaders, type Tracing, UnprocessableEntityError, VERSION, isAPIError, isComposioError, layer, layerConfig, layerFetch, make };
|
|
800
|
+
export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, type APIErrorFields, type APIStatusError, Auth, AuthenticationError, type AutoCredentials, BadRequestError, type ClientIdentity, ComposioClient, type ComposioClientOptions, type ComposioClientShape, type ComposioError, ConfigurationError, ConflictError, type Credential, DecodeError, type DecodeIssue, type DeprecationNotices, type HeadersLike, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, type RawBodyRequestOptions, type RawRequestOptions, type RequestOptions, type SchemaLoaders, type Scope, type Tracing, UnprocessableEntityError, VERSION, isAPIError, isComposioError, layer, layerConfig, layerFetch, make };
|