@composio/client 2.0.0-rc.5 → 2.0.0-rc.7
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 +78 -4
- package/dist/{api-key-revocation-qTsznJmF.mjs → api-key-revocation-BPURmRJx.mjs} +1 -1
- package/dist/{auth-configs-B0IbEao2.mjs → auth-configs-DYkxc_It.mjs} +1 -1
- package/dist/{auth-Dw30Hpb_.mjs → auth-iqhTmHa9.mjs} +1 -1
- package/dist/{clanker-BJNgPfZ2.mjs → clanker-CzfQDpuy.mjs} +1 -1
- package/dist/{cli-CUWplx80.mjs → cli-Er9a9rGs.mjs} +2 -2
- package/dist/{client-CtqZaY-5.d.mts → client-CcYk8XXt.d.mts} +3857 -684
- package/dist/{connected-accounts-hwz_Ahf8.mjs → connected-accounts-DDgErVLd.mjs} +8 -1
- package/dist/{consumer-BX9lVqTG.mjs → consumer-BPCfagDO.mjs} +2 -2
- package/dist/custom-Cs019zcM.mjs +31 -0
- package/dist/{custom-tBFB6wwF.mjs → custom-VZyKhTTG.mjs} +2 -1
- package/dist/error-DPPtjCl1.mjs +75 -0
- package/dist/{files-Blm1q37V.mjs → files-C1QA5PTw.mjs} +1 -1
- package/dist/{files-vyDo0NH0.mjs → files-hhfQpMSx.mjs} +1 -1
- package/dist/{generate-DnzpeBp5.mjs → generate-iwm8bHWW.mjs} +2 -1
- package/dist/{generated-operations-DEPr4e2f.mjs → generated-operations-CJ7bbwvC.mjs} +50 -83
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +51 -29
- package/dist/keyring-Dkcbmstv.mjs +17 -0
- package/dist/{link-UHD4M7zo.mjs → link-Dk-yWRgc.mjs} +1 -1
- package/dist/{logs-B61ufb_6.mjs → logs-DnZUgpLM.mjs} +3 -3
- package/dist/{manage-6ysZI9l4.mjs → manage-DfB0PrkM.mjs} +1 -1
- package/dist/{mcp-C9IT8Cpv.mjs → mcp-BfStaFrR.mjs} +12 -3
- package/dist/{org-Bj5m1nn8.mjs → org-bXBx5whI.mjs} +6 -6
- package/dist/{owner-BSIXkRF0.mjs → owner-BlJ0zURX.mjs} +1 -1
- package/dist/pagination.d.mts +56 -0
- package/dist/pagination.mjs +50 -0
- package/dist/{project-84ETQ8s3.mjs → project-B0ax2ZoD.mjs} +1 -1
- package/dist/{project-BrbKVCdG.mjs → project-BeWloPLZ.mjs} +1 -1
- package/dist/{project-BfNWC2nb.mjs → project-BnMfaNjl.mjs} +1 -1
- package/dist/{project-CPmAuLg4.mjs → project-CGi2urmA.mjs} +1 -1
- package/dist/{realtime-D7OslBiN.mjs → realtime-BNfA3u3B.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 +2 -0
- package/dist/resources/custom.mjs +3 -0
- 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 +2 -0
- package/dist/resources/keyring.mjs +3 -0
- 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/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-CJLfSQti.mjs → session-B78Twedd.mjs} +1 -1
- package/dist/{session-HQf03_ub.mjs → session-D3Azxyck.mjs} +2 -2
- package/dist/{tool-router-kFw8Xqp9.mjs → tool-router-Bx1tQfx-.mjs} +1 -1
- package/dist/{toolkits-wapurMFl.mjs → toolkits-DFC0JDvT.mjs} +15 -1
- package/dist/{tools-BmHuPUvd.mjs → tools-Bv2Txlel.mjs} +1 -1
- package/dist/{tools-KN8T5BtJ.mjs → tools-EL1x4SBb.mjs} +2 -1
- package/dist/{trigger-instances-DeRL4DhM.mjs → trigger-instances-BI-STHc4.mjs} +2 -2
- package/dist/{triggers-types-DLap3EOR.mjs → triggers-types-CJWi--Kk.mjs} +1 -1
- package/dist/{triggers-DZWXfIwq.mjs → triggers-vTkWuT5B.mjs} +1 -1
- package/dist/{usage-DwYx7p-o.mjs → usage-DspCrBUv.mjs} +1 -1
- package/dist/{usage-Buq-FwCY.mjs → usage-cffJ-ds7.mjs} +1 -1
- package/dist/{webhook-endpoints-DbIlhiI-.mjs → webhook-endpoints-DSN8i5KN.mjs} +1 -1
- package/dist/{webhook-subscriptions-CXC0oAhI.mjs → webhook-subscriptions-Bgsnr29T.mjs} +1 -1
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -17,6 +17,54 @@ 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
|
+
### Pagination
|
|
21
|
+
|
|
22
|
+
Use the `@composio/client/pagination` subpath to traverse list operations that return the standard
|
|
23
|
+
`items` and `next_cursor` fields:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { paginate } from '@composio/client/pagination'
|
|
27
|
+
|
|
28
|
+
const toolkits = paginate(({ cursor }) =>
|
|
29
|
+
composio.toolkits.list({ cursor, limit: 100 }),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
for await (const toolkit of toolkits) {
|
|
33
|
+
console.log(toolkit.slug)
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Item iteration is lazy. Each traversal starts from the first page, and breaking early stops fetching
|
|
38
|
+
more pages. Use `iterPages()` when page metadata matters, or `toArray()` to collect every item; avoid
|
|
39
|
+
`toArray()` when the full result may not fit comfortably in memory.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
for await (const page of toolkits.iterPages()) {
|
|
43
|
+
console.log(page.items.length)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const allToolkits = await toolkits.toArray()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For another response shape, provide an adapter. Custom cursors must be strings or numbers so repeated
|
|
50
|
+
values can be detected reliably across independently decoded pages:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const results = paginate(
|
|
54
|
+
({ cursor }) => loadPage(cursor),
|
|
55
|
+
{
|
|
56
|
+
items: page => page.data,
|
|
57
|
+
nextCursor: page => page.nextCursor,
|
|
58
|
+
},
|
|
59
|
+
)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A repeated cursor cycle throws `ComposioError` instead of requesting pages indefinitely. An empty
|
|
63
|
+
cursor ends traversal. When a response omits `next_cursor` but numeric `current_page` and
|
|
64
|
+
`total_pages` metadata shows that more pages exist, the default adapter fails instead of silently
|
|
65
|
+
returning partial results; provide a custom adapter for that response shape. Requests are sequential
|
|
66
|
+
and inherit the normal client retry/backoff path, but this is not proactive/shared rate-limit pacing.
|
|
67
|
+
|
|
20
68
|
Use `fromEnv` when configuration must come from a specific environment snapshot instead of the
|
|
21
69
|
host process. Explicit options replace mapped values, so this is safe for tests, workers, and
|
|
22
70
|
applications that load configuration themselves:
|
|
@@ -26,8 +74,9 @@ const composio = Composio.fromEnv(config, { environment: 'staging' })
|
|
|
26
74
|
```
|
|
27
75
|
|
|
28
76
|
`fromEnv` recognizes `COMPOSIO_API_KEY`, `COMPOSIO_USER_API_KEY`, `COMPOSIO_ORG_API_KEY`,
|
|
29
|
-
`COMPOSIO_BASE_URL`, `COMPOSIO_CUSTOM_HEADERS`, and
|
|
30
|
-
`withOptions()` keep using the resolved snapshot and do
|
|
77
|
+
`COMPOSIO_BASE_URL`, `COMPOSIO_ALLOW_INSECURE_HTTP`, `COMPOSIO_CUSTOM_HEADERS`, and
|
|
78
|
+
`COMPOSIO_LOG_LEVEL`. Derived clients created with `withOptions()` keep using the resolved snapshot and do
|
|
79
|
+
not fall back to ambient values.
|
|
31
80
|
|
|
32
81
|
Inject a `Transport` when an application or test needs to own HTTP dispatch. The transport receives
|
|
33
82
|
a complete `Request`; retries, credential-safe redirects, timeouts, and response parsing stay in the
|
|
@@ -43,6 +92,31 @@ const composio = new Composio({ apiKey, transport })
|
|
|
43
92
|
Existing `fetch` and `fetchOptions` constructor options remain supported. They cannot be combined
|
|
44
93
|
with `transport` because a request can have only one HTTP dispatcher.
|
|
45
94
|
|
|
95
|
+
## Upgrade from Stainless 0.1.x to 2.0
|
|
96
|
+
|
|
97
|
+
By default, the 2.0 client refuses to send credentials over plain HTTP unless the hostname is
|
|
98
|
+
loopback. For a trusted development backend such as Docker's host gateway, opt in to the exact
|
|
99
|
+
configured origin:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
const composio = new Composio({
|
|
103
|
+
apiKey,
|
|
104
|
+
baseURL: 'http://host.docker.internal:9900',
|
|
105
|
+
allowInsecureHTTP: true,
|
|
106
|
+
})
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The equivalent environment configuration is:
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
COMPOSIO_BASE_URL=http://host.docker.internal:9900 \
|
|
113
|
+
COMPOSIO_ALLOW_INSECURE_HTTP=1
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The opt-in records the resolved scheme, hostname, and port. Mutating `baseURL` cannot broaden it,
|
|
117
|
+
and `withOptions({ baseURL: ... })` requires `allowInsecureHTTP: true` again when the origin
|
|
118
|
+
changes. Redirects to another origin remain credential-free.
|
|
119
|
+
|
|
46
120
|
## Development
|
|
47
121
|
|
|
48
122
|
Toolchain is pinned via [mise](https://mise.jdx.dev) (`mise install`): Node 24, pnpm 11, Python 3.13, uv. ESM-only, TypeScript 7 (native compiler for typechecking, `typescript@6` retained for tooling until 7.1 restores the compiler API).
|
|
@@ -50,8 +124,8 @@ Toolchain is pinned via [mise](https://mise.jdx.dev) (`mise install`): Node 24,
|
|
|
50
124
|
```sh
|
|
51
125
|
pnpm install
|
|
52
126
|
pnpm generate # hey-api + compat codegen: spec/openapi.json → src/generated + src/compat/resources (do not edit)
|
|
53
|
-
pnpm lint # eslint over src, test,
|
|
54
|
-
pnpm typecheck # tsgo (TS native)
|
|
127
|
+
pnpm lint # eslint over src, test, codegen, parity, and demo
|
|
128
|
+
pnpm typecheck # tsgo (TS native), including type tests and demo
|
|
55
129
|
pnpm typecheck:tsc # same programs under tsc — both compilers must pass
|
|
56
130
|
pnpm codegen:check # verify committed src/compat/resources matches the generator
|
|
57
131
|
pnpm test # unit tests (MSW mocks) + codegen tests
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as withOperation, n as generatedOperation } from "./generated-operations-
|
|
1
|
+
import { c as withOperation, n as generatedOperation } from "./generated-operations-CJ7bbwvC.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 { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-
|
|
1
|
+
import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-CJ7bbwvC.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 { c as withOperation, n as generatedOperation } from "./generated-operations-
|
|
1
|
+
import { c as withOperation, n as generatedOperation } from "./generated-operations-CJ7bbwvC.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 { c as withOperation,
|
|
2
|
-
import { t as Realtime } from "./realtime-
|
|
1
|
+
import { c as withOperation, n as generatedOperation, p as mergeHeaders } from "./generated-operations-CJ7bbwvC.mjs";
|
|
2
|
+
import { t as Realtime } from "./realtime-BNfA3u3B.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/compat/resources/cli/cli.ts
|
|
5
5
|
const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
|