@composio/client 2.0.0-rc.1 → 2.0.0-rc.11
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 +108 -2
- package/dist/{api-key-revocation-BZL5FAx7.mjs → api-key-revocation-Dh-KSokR.mjs} +4 -3
- package/dist/{auth-CEq4JqWm.mjs → auth-Drov-jN8.mjs} +1 -1
- package/dist/{auth-configs-CyksMqNB.mjs → auth-configs-yM05-r6r.mjs} +18 -11
- package/dist/{clanker-4wByThQJ.mjs → clanker-BYmc69WC.mjs} +4 -3
- package/dist/cli-Ce8RT7yp.mjs +45 -0
- package/dist/{connected-accounts-B-qN_yLT.mjs → connected-accounts-D__sOoNZ.mjs} +31 -15
- package/dist/{consumer-DWlaGBmh.mjs → consumer-DTh50Hih.mjs} +8 -8
- package/dist/{custom-BQWoONFY.mjs → custom-CdC-6Y_i.mjs} +5 -3
- package/dist/custom-nlGufiDz.mjs +88 -0
- package/dist/error-DLB1uKM3.mjs +109 -0
- package/dist/{files-B-UnEejx.mjs → files-DROCPzLP.mjs} +7 -5
- package/dist/{files-CNZ-ttVS.mjs → files-RJPIH6iE.mjs} +13 -9
- package/dist/{generate-DSqfJENZ.mjs → generate-mU4b3zJf.mjs} +5 -3
- package/dist/{request-DwPfYYNF.mjs → generated-operations-CWhusMPU.mjs} +1266 -157
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +312 -827
- package/dist/keyring-BzkcB1gu.mjs +17 -0
- package/dist/{link-CukKZMxs.mjs → link-CfIyH3nF.mjs} +4 -3
- package/dist/{logs-B87z4hq7.mjs → logs-D2wxXYiO.mjs} +8 -6
- package/dist/{manage-By-b66OH.mjs → manage-Vc3jdRr_.mjs} +7 -5
- package/dist/mcp-DEe7xU7G.mjs +91 -0
- package/dist/{org-BSq_z6fP.mjs → org-CYsl9O1u.mjs} +9 -8
- package/dist/{owner-BDkEFEVF.mjs → owner-DmQb3AF5.mjs} +1 -1
- package/dist/pagination.d.mts +56 -0
- package/dist/pagination.mjs +50 -0
- package/dist/{project-D-c0Zrrl.mjs → project-BVBWJzHm.mjs} +1 -1
- package/dist/{project-_s0fWHut.mjs → project-D-_r3H1_.mjs} +7 -7
- package/dist/project-DvSCDA9B.mjs +47 -0
- package/dist/{project-Cj-NKnWZ.mjs → project-OSigfIdr.mjs} +4 -3
- package/dist/realtime-Dsk1QGAl.mjs +28 -0
- 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/session-configs.d.mts +2 -0
- package/dist/resources/session-configs.mjs +24 -0
- 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-Do3wHYNe.mjs → session-BUYbl8BA.mjs} +39 -26
- package/dist/{session-DNm4GFO-.mjs → session-DfISYrbs.mjs} +3 -2
- package/dist/{client-CK6bm7nf.d.mts → session-configs-CipRvstF.d.mts} +5450 -1009
- package/dist/{tool-router-5OfsPkJ_.mjs → tool-router-DJQ12uhs.mjs} +1 -1
- package/dist/toolkits-CbdyRtvr.mjs +62 -0
- package/dist/tools-DiH6dAto.mjs +69 -0
- package/dist/tools-a29E_8La.mjs +33 -0
- package/dist/{trigger-instances-lkKWqHgd.mjs → trigger-instances-Bg0n7X-d.mjs} +8 -6
- package/dist/{triggers-DNx9yjbS.mjs → triggers-BoSFNGss.mjs} +6 -4
- package/dist/triggers-types-BPtTEwUA.mjs +34 -0
- package/dist/{usage-CKyu9RzD.mjs → usage-CHVyZ3tm.mjs} +7 -5
- package/dist/{usage-Cv9VNy5H.mjs → usage-Cs10eWCd.mjs} +7 -5
- package/dist/{webhook-endpoints-DIyg3YlR.mjs → webhook-endpoints-B4lZc5YC.mjs} +15 -10
- package/dist/webhook-subscriptions-DJTSJd6K.mjs +55 -0
- package/package.json +21 -6
- package/dist/cli-Bi4_ORQO.mjs +0 -45
- package/dist/mcp-B0wla_93.mjs +0 -73
- package/dist/project-C0h91WGF.mjs +0 -42
- package/dist/realtime-BcHoYszT.mjs +0 -26
- package/dist/toolkits-CcE90C2S.mjs +0 -43
- package/dist/tools-B5uEInC8.mjs +0 -30
- package/dist/tools-CdVgfSpk.mjs +0 -63
- package/dist/triggers-types-MjEcrPbH.mjs +0 -31
- package/dist/webhook-subscriptions-B7AgTACq.mjs +0 -48
package/README.md
CHANGED
|
@@ -17,6 +17,106 @@ 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
|
+
|
|
68
|
+
Use `fromEnv` when configuration must come from a specific environment snapshot instead of the
|
|
69
|
+
host process. Explicit options replace mapped values, so this is safe for tests, workers, and
|
|
70
|
+
applications that load configuration themselves:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
const composio = Composio.fromEnv(config, { environment: 'staging' })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`fromEnv` recognizes `COMPOSIO_API_KEY`, `COMPOSIO_USER_API_KEY`, `COMPOSIO_ORG_API_KEY`,
|
|
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.
|
|
80
|
+
|
|
81
|
+
Inject a `Transport` when an application or test needs to own HTTP dispatch. The transport receives
|
|
82
|
+
a complete `Request`; retries, credential-safe redirects, timeouts, and response parsing stay in the
|
|
83
|
+
client:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import Composio, { createFetchTransport } from '@composio/client'
|
|
87
|
+
|
|
88
|
+
const transport = createFetchTransport({ fetch: instrumentedFetch })
|
|
89
|
+
const composio = new Composio({ apiKey, transport })
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Existing `fetch` and `fetchOptions` constructor options remain supported. They cannot be combined
|
|
93
|
+
with `transport` because a request can have only one HTTP dispatcher.
|
|
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
|
+
|
|
20
120
|
## Development
|
|
21
121
|
|
|
22
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).
|
|
@@ -24,13 +124,15 @@ Toolchain is pinned via [mise](https://mise.jdx.dev) (`mise install`): Node 24,
|
|
|
24
124
|
```sh
|
|
25
125
|
pnpm install
|
|
26
126
|
pnpm generate # hey-api + compat codegen: spec/openapi.json → src/generated + src/compat/resources (do not edit)
|
|
27
|
-
pnpm lint # eslint over src, test,
|
|
28
|
-
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
|
|
29
129
|
pnpm typecheck:tsc # same programs under tsc — both compilers must pass
|
|
30
130
|
pnpm codegen:check # verify committed src/compat/resources matches the generator
|
|
31
131
|
pnpm test # unit tests (MSW mocks) + codegen tests
|
|
32
132
|
pnpm build # tsdown → dist/ (runs publint + arethetypeswrong)
|
|
33
133
|
pnpm test:pack # pack the real tarball, typecheck + import every drop-in subpath
|
|
134
|
+
pnpm benchmark:baseline # capture the dist/ a benchmark run compares against
|
|
135
|
+
pnpm benchmark # score SDK overhead against that baseline and against Stainless
|
|
34
136
|
pnpm test:contract # live API tests; requires COMPOSIO_API_KEY (copy .env.example to .env)
|
|
35
137
|
pnpm refresh-spec # re-fetch spec/openapi.json from the live backend
|
|
36
138
|
```
|
|
@@ -49,3 +151,7 @@ uv run ruff check
|
|
|
49
151
|
uv run mypy src scripts
|
|
50
152
|
uv run pytest
|
|
51
153
|
```
|
|
154
|
+
|
|
155
|
+
Client-overhead measurements use a deterministic in-memory transport and are documented in
|
|
156
|
+
[`docs/benchmarks/client-overhead.md`](./docs/benchmarks/client-overhead.md). They do not measure API
|
|
157
|
+
latency.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/api-key-revocation.ts
|
|
4
|
+
const OP_CREATE = generatedOperation("apiKeyRevocation.create");
|
|
4
5
|
/**
|
|
5
6
|
* Spec-surface `client.apiKeyRevocation` resource: the 1-method public
|
|
6
7
|
* leaked-key revocation surface of the v3.1 spec
|
|
@@ -13,10 +14,10 @@ var ApiKeyRevocation = class {
|
|
|
13
14
|
this.#client = client;
|
|
14
15
|
}
|
|
15
16
|
create(body, options) {
|
|
16
|
-
return this.#client.post(
|
|
17
|
+
return this.#client.post("/api/v3.1/api_key_revocation", withOperation(OP_CREATE, {
|
|
17
18
|
body,
|
|
18
19
|
...options
|
|
19
|
-
});
|
|
20
|
+
}));
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/auth-configs.ts
|
|
4
|
+
const OP_CREATE = generatedOperation("authConfigs.create");
|
|
5
|
+
const OP_RETRIEVE = generatedOperation("authConfigs.retrieve");
|
|
6
|
+
const OP_UPDATE = generatedOperation("authConfigs.update");
|
|
7
|
+
const OP_LIST = generatedOperation("authConfigs.list");
|
|
8
|
+
const OP_DELETE = generatedOperation("authConfigs.delete");
|
|
9
|
+
const OP_UPDATE_STATUS = generatedOperation("authConfigs.updateStatus");
|
|
4
10
|
/**
|
|
5
11
|
* Stainless-shaped `client.authConfigs` resource: the exact 6-method surface of
|
|
6
12
|
* `@composio/client` (create/retrieve/update/list/delete/updateStatus),
|
|
@@ -12,35 +18,36 @@ var AuthConfigs = class {
|
|
|
12
18
|
this.#client = client;
|
|
13
19
|
}
|
|
14
20
|
create(body, options) {
|
|
15
|
-
return this.#client.post(
|
|
21
|
+
return this.#client.post("/api/v3.1/auth_configs", withOperation(OP_CREATE, {
|
|
16
22
|
body,
|
|
17
23
|
...options
|
|
18
|
-
});
|
|
24
|
+
}));
|
|
19
25
|
}
|
|
20
26
|
retrieve(nanoid, options) {
|
|
21
|
-
return this.#client.get(path`/api/v3.1/auth_configs/${nanoid}`, { ...options });
|
|
27
|
+
return this.#client.get(path`/api/v3.1/auth_configs/${nanoid}`, withOperation(OP_RETRIEVE, { ...options }));
|
|
22
28
|
}
|
|
23
29
|
update(nanoid, body, options) {
|
|
24
|
-
return this.#client.patch(path`/api/v3.1/auth_configs/${nanoid}`, {
|
|
30
|
+
return this.#client.patch(path`/api/v3.1/auth_configs/${nanoid}`, withOperation(OP_UPDATE, {
|
|
25
31
|
body,
|
|
26
32
|
...options
|
|
27
|
-
});
|
|
33
|
+
}));
|
|
28
34
|
}
|
|
29
35
|
list(query = {}, options) {
|
|
30
|
-
return this.#client.get(
|
|
36
|
+
return this.#client.get("/api/v3.1/auth_configs", withOperation(OP_LIST, {
|
|
31
37
|
query,
|
|
32
38
|
...options
|
|
33
|
-
});
|
|
39
|
+
}));
|
|
34
40
|
}
|
|
35
41
|
delete(nanoid, query = {}, options) {
|
|
36
|
-
return this.#client.delete(path`/api/v3.1/auth_configs/${nanoid}`, {
|
|
42
|
+
return this.#client.delete(path`/api/v3.1/auth_configs/${nanoid}`, withOperation(OP_DELETE, {
|
|
37
43
|
query,
|
|
38
44
|
...options
|
|
39
|
-
});
|
|
45
|
+
}));
|
|
40
46
|
}
|
|
47
|
+
/** @deprecated Deprecated in the input OpenAPI schema. */
|
|
41
48
|
updateStatus(status, params, options) {
|
|
42
49
|
const { nanoid } = params;
|
|
43
|
-
return this.#client.patch(path`/api/v3.1/auth_configs/${nanoid}/${status}`, { ...options });
|
|
50
|
+
return this.#client.patch(path`/api/v3.1/auth_configs/${nanoid}/${status}`, withOperation(OP_UPDATE_STATUS, { ...options }));
|
|
44
51
|
}
|
|
45
52
|
};
|
|
46
53
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/org/clanker.ts
|
|
4
|
+
const OP_CREATE_CLAIM = generatedOperation("org.clanker.createClaim");
|
|
4
5
|
/**
|
|
5
6
|
* Spec-surface `client.org.clanker` resource: the 1-method claim surface of
|
|
6
7
|
* the v3.1 spec (`POST /org/clanker/create_claim`), never published by
|
|
@@ -12,10 +13,10 @@ var Clanker = class {
|
|
|
12
13
|
this.#client = client;
|
|
13
14
|
}
|
|
14
15
|
createClaim(body, options) {
|
|
15
|
-
return this.#client.post(
|
|
16
|
+
return this.#client.post("/api/v3.1/org/clanker/create_claim", withOperation(OP_CREATE_CLAIM, {
|
|
16
17
|
body,
|
|
17
18
|
...options
|
|
18
|
-
});
|
|
19
|
+
}));
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { c as withOperation, m as mergeHeaders, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
|
+
import { t as Realtime } from "./realtime-Dsk1QGAl.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/compat/resources/cli/cli.ts
|
|
5
|
+
const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
|
|
6
|
+
const OP_CREATE_SESSION = generatedOperation("cli.createSession");
|
|
7
|
+
const OP_GET_SESSION = generatedOperation("cli.getSession");
|
|
8
|
+
/**
|
|
9
|
+
* Stainless-shaped `client.cli` resource: the 2-method published CLI
|
|
10
|
+
* authentication surface of `@composio/client` (createSession/getSession)
|
|
11
|
+
* plus the spec-surface `createCodactFailure` (`POST /cli/codact_failures`,
|
|
12
|
+
* never published by Stainless — wayfinder ticket 29).
|
|
13
|
+
*/
|
|
14
|
+
var Cli = class {
|
|
15
|
+
realtime;
|
|
16
|
+
#client;
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.#client = client;
|
|
19
|
+
this.realtime = new Realtime(client);
|
|
20
|
+
}
|
|
21
|
+
createCodactFailure(params, options) {
|
|
22
|
+
const { "x-user-api-key": xUserApiKey, ...body } = params;
|
|
23
|
+
return this.#client.post("/api/v3.1/cli/codact_failures", withOperation(OP_CREATE_CODACT_FAILURE, {
|
|
24
|
+
body,
|
|
25
|
+
...options,
|
|
26
|
+
headers: mergeHeaders([{ ...xUserApiKey != null ? { "x-user-api-key": xUserApiKey } : void 0 }, options?.headers])
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
createSession(body = {}, options) {
|
|
30
|
+
return this.#client.post("/api/v3.1/cli/create-session", withOperation(OP_CREATE_SESSION, {
|
|
31
|
+
body,
|
|
32
|
+
...options
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
getSession(query, options) {
|
|
36
|
+
return this.#client.get("/api/v3.1/cli/get-session", withOperation(OP_GET_SESSION, {
|
|
37
|
+
query,
|
|
38
|
+
...options
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
Cli.Realtime = Realtime;
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Cli as t };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/connected-accounts.ts
|
|
4
|
+
const OP_CREATE = generatedOperation("connectedAccounts.create");
|
|
5
|
+
const OP_RETRIEVE = generatedOperation("connectedAccounts.retrieve");
|
|
6
|
+
const OP_LIST = generatedOperation("connectedAccounts.list");
|
|
7
|
+
const OP_DELETE = generatedOperation("connectedAccounts.delete");
|
|
8
|
+
const OP_COMPLETE_AUTH = generatedOperation("connectedAccounts.completeAuth");
|
|
9
|
+
const OP_PATCH = generatedOperation("connectedAccounts.patch");
|
|
10
|
+
const OP_REFRESH = generatedOperation("connectedAccounts.refresh");
|
|
11
|
+
const OP_REVOKE = generatedOperation("connectedAccounts.revoke");
|
|
12
|
+
const OP_UPDATE_STATUS = generatedOperation("connectedAccounts.updateStatus");
|
|
4
13
|
/**
|
|
5
14
|
* Stainless-shaped `client.connectedAccounts` resource: the 7-method published
|
|
6
15
|
* surface of `@composio/client` (create/retrieve/list/delete/patch/refresh/
|
|
@@ -14,52 +23,59 @@ var ConnectedAccounts = class {
|
|
|
14
23
|
this.#client = client;
|
|
15
24
|
}
|
|
16
25
|
create(body, options) {
|
|
17
|
-
return this.#client.post(
|
|
26
|
+
return this.#client.post("/api/v3.1/connected_accounts", withOperation(OP_CREATE, {
|
|
18
27
|
body,
|
|
19
28
|
...options
|
|
20
|
-
});
|
|
29
|
+
}));
|
|
21
30
|
}
|
|
22
31
|
retrieve(nanoid, options) {
|
|
23
|
-
return this.#client.get(path`/api/v3.1/connected_accounts/${nanoid}`, { ...options });
|
|
32
|
+
return this.#client.get(path`/api/v3.1/connected_accounts/${nanoid}`, withOperation(OP_RETRIEVE, { ...options }));
|
|
24
33
|
}
|
|
25
34
|
list(query = {}, options) {
|
|
26
|
-
return this.#client.get(
|
|
35
|
+
return this.#client.get("/api/v3.1/connected_accounts", withOperation(OP_LIST, {
|
|
27
36
|
query,
|
|
28
37
|
...options
|
|
29
|
-
});
|
|
38
|
+
}));
|
|
30
39
|
}
|
|
31
40
|
delete(nanoid, query = {}, options) {
|
|
32
|
-
return this.#client.delete(path`/api/v3.1/connected_accounts/${nanoid}`, {
|
|
41
|
+
return this.#client.delete(path`/api/v3.1/connected_accounts/${nanoid}`, withOperation(OP_DELETE, {
|
|
33
42
|
query,
|
|
34
43
|
...options
|
|
35
|
-
});
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
completeAuth(body, options) {
|
|
47
|
+
return this.#client.post("/api/v3.1/connected_accounts/complete_auth", withOperation(OP_COMPLETE_AUTH, {
|
|
48
|
+
body,
|
|
49
|
+
...options
|
|
50
|
+
}));
|
|
36
51
|
}
|
|
37
52
|
patch(nanoid, body = {}, options) {
|
|
38
|
-
return this.#client.patch(path`/api/v3.1/connected_accounts/${nanoid}`, {
|
|
53
|
+
return this.#client.patch(path`/api/v3.1/connected_accounts/${nanoid}`, withOperation(OP_PATCH, {
|
|
39
54
|
body,
|
|
40
55
|
...options
|
|
41
|
-
});
|
|
56
|
+
}));
|
|
42
57
|
}
|
|
43
58
|
/** @deprecated Deprecated in the input OpenAPI schema. */
|
|
44
59
|
refresh(nanoid, params = {}, options) {
|
|
45
60
|
const { query_redirect_url, body_redirect_url, ...body } = params ?? {};
|
|
46
|
-
return this.#client.post(path`/api/v3.1/connected_accounts/${nanoid}/refresh`, {
|
|
61
|
+
return this.#client.post(path`/api/v3.1/connected_accounts/${nanoid}/refresh`, withOperation(OP_REFRESH, {
|
|
47
62
|
query: { redirect_url: query_redirect_url },
|
|
48
63
|
body: {
|
|
49
64
|
...body,
|
|
50
65
|
redirect_url: body_redirect_url
|
|
51
66
|
},
|
|
52
67
|
...options
|
|
53
|
-
});
|
|
68
|
+
}));
|
|
54
69
|
}
|
|
55
70
|
revoke(nanoid, options) {
|
|
56
|
-
return this.#client.post(path`/api/v3.1/connected_accounts/${nanoid}/revoke`, { ...options });
|
|
71
|
+
return this.#client.post(path`/api/v3.1/connected_accounts/${nanoid}/revoke`, withOperation(OP_REVOKE, { ...options }));
|
|
57
72
|
}
|
|
73
|
+
/** @deprecated Deprecated in the input OpenAPI schema. */
|
|
58
74
|
updateStatus(nanoID, body, options) {
|
|
59
|
-
return this.#client.patch(path`/api/v3.1/connected_accounts/${nanoID}/status`, {
|
|
75
|
+
return this.#client.patch(path`/api/v3.1/connected_accounts/${nanoID}/status`, withOperation(OP_UPDATE_STATUS, {
|
|
60
76
|
body,
|
|
61
77
|
...options
|
|
62
|
-
});
|
|
78
|
+
}));
|
|
63
79
|
}
|
|
64
80
|
};
|
|
65
81
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Project } from "./project-
|
|
1
|
+
import { c as withOperation, m as mergeHeaders, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
|
+
import { t as Project } from "./project-D-_r3H1_.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/compat/resources/org/consumer/consumer.ts
|
|
5
|
+
const OP_LIST_CONNECTED_TOOLKITS = generatedOperation("org.consumer.listConnectedToolkits");
|
|
5
6
|
/**
|
|
6
7
|
* Spec-surface `client.org.consumer` resource: the 1-method consumer surface
|
|
7
8
|
* of the v3.1 spec (listConnectedToolkits over
|
|
@@ -17,15 +18,14 @@ var Consumer = class {
|
|
|
17
18
|
}
|
|
18
19
|
listConnectedToolkits(params, options) {
|
|
19
20
|
const { "x-user-api-key": xUserApiKey, "x-org-id": xOrgId, ...query } = params;
|
|
20
|
-
return this.#client.get(
|
|
21
|
+
return this.#client.get("/api/v3.1/org/consumer/connected_toolkits", withOperation(OP_LIST_CONNECTED_TOOLKITS, {
|
|
21
22
|
query,
|
|
22
23
|
...options,
|
|
23
|
-
headers: {
|
|
24
|
+
headers: mergeHeaders([{
|
|
24
25
|
...xUserApiKey != null ? { "x-user-api-key": xUserApiKey } : void 0,
|
|
25
|
-
...xOrgId != null ? { "x-org-id": xOrgId } : void 0
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
26
|
+
...xOrgId != null ? { "x-org-id": xOrgId } : void 0
|
|
27
|
+
}, options?.headers])
|
|
28
|
+
}));
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
Consumer.Project = Project;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/mcp/custom.ts
|
|
4
|
+
const OP_CREATE = generatedOperation("mcp.custom.create");
|
|
4
5
|
/**
|
|
5
6
|
* Stainless-shaped `client.mcp.custom` resource: the 1-method custom MCP
|
|
6
7
|
* server sub-surface of `@composio/client` (`POST /mcp/servers/custom`).
|
|
@@ -10,11 +11,12 @@ var Custom = class {
|
|
|
10
11
|
constructor(client) {
|
|
11
12
|
this.#client = client;
|
|
12
13
|
}
|
|
14
|
+
/** @deprecated Deprecated in the input OpenAPI schema. */
|
|
13
15
|
create(body, options) {
|
|
14
|
-
return this.#client.post(
|
|
16
|
+
return this.#client.post("/api/v3.1/mcp/servers/custom", withOperation(OP_CREATE, {
|
|
15
17
|
body,
|
|
16
18
|
...options
|
|
17
|
-
});
|
|
19
|
+
}));
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/compat/legacy-options.ts
|
|
4
|
+
/**
|
|
5
|
+
* Recognizing a request-options bag passed where a params object now goes.
|
|
6
|
+
*
|
|
7
|
+
* TODO(#66): a migration guardrail, to be removed before stable 2.0 —
|
|
8
|
+
* https://github.com/ComposioHQ/composio-client/issues/66.
|
|
9
|
+
*
|
|
10
|
+
* A method that gains its first optional parameter moves from
|
|
11
|
+
* `method(id, options?)` to `method(id, params?, options?)`. A caller written
|
|
12
|
+
* against the released two-position form then hands its options to the params
|
|
13
|
+
* position, where `headers` is serialized into the URL and `timeout`/`signal`
|
|
14
|
+
* are dropped. The generator emits a check for exactly the methods its ledger
|
|
15
|
+
* declares (`LEGACY_OPTIONS_POSITIONS` in `packages/codegen`), and every one of
|
|
16
|
+
* them asks this module — the key set lives here once, not in generated files.
|
|
17
|
+
*
|
|
18
|
+
* This file imports nothing on purpose: the generator reads
|
|
19
|
+
* `REQUEST_OPTIONS_KEYS` to refuse a ledger entry whose parameter names collide
|
|
20
|
+
* with it, and must be able to load the list without the rest of the kernel.
|
|
21
|
+
* `test/types/legacy-options.test-d.ts` pins the list to `keyof RequestOptions`
|
|
22
|
+
* in both directions, so a key added to that interface cannot be forgotten here.
|
|
23
|
+
*/
|
|
24
|
+
/** Every key of `RequestOptions` (`request.ts`). */
|
|
25
|
+
const REQUEST_OPTIONS_KEYS = [
|
|
26
|
+
"headers",
|
|
27
|
+
"maxRetries",
|
|
28
|
+
"timeout",
|
|
29
|
+
"signal",
|
|
30
|
+
"fetchOptions",
|
|
31
|
+
"idempotencyKey"
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Whether `value`, received in a params position, is really a request-options
|
|
35
|
+
* bag from a call written against the released two-position signature.
|
|
36
|
+
*
|
|
37
|
+
* `declaredKeys` are the operation's own parameter names. An object carrying
|
|
38
|
+
* any of them is params, whatever else it carries: a mixed object is ambiguous,
|
|
39
|
+
* and reading it as options would silently discard a parameter the caller set.
|
|
40
|
+
* Otherwise it is options only on positive evidence — at least one
|
|
41
|
+
* `RequestOptions` key — so `{}`, `null` and `undefined` stay params.
|
|
42
|
+
*
|
|
43
|
+
* The generator guarantees the two key sets are disjoint, which is what makes
|
|
44
|
+
* the answer unambiguous for every object that is not mixed.
|
|
45
|
+
*/
|
|
46
|
+
const isLegacyRequestOptions = (value, declaredKeys) => {
|
|
47
|
+
if (typeof value !== "object" || value === null) return false;
|
|
48
|
+
if (declaredKeys.some((key) => Object.hasOwn(value, key))) return false;
|
|
49
|
+
return REQUEST_OPTIONS_KEYS.some((key) => Object.hasOwn(value, key));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/compat/resources/custom.ts
|
|
54
|
+
const OP_DELETE_TOOLKIT = generatedOperation("custom.deleteToolkit");
|
|
55
|
+
const OP_SYNC = generatedOperation("custom.sync");
|
|
56
|
+
const OP_UPSERT = generatedOperation("custom.upsert");
|
|
57
|
+
const LEGACY_PARAM_KEYS_DELETE_TOOLKIT = ["revoke_on_delete"];
|
|
58
|
+
/** OpenAPI resource for `custom`. */
|
|
59
|
+
var Custom = class {
|
|
60
|
+
#client;
|
|
61
|
+
constructor(client) {
|
|
62
|
+
this.#client = client;
|
|
63
|
+
}
|
|
64
|
+
deleteToolkit(slug, queryOrOptions = {}, trailingOptions) {
|
|
65
|
+
const optionsSecond = trailingOptions === void 0 && isLegacyRequestOptions(queryOrOptions, LEGACY_PARAM_KEYS_DELETE_TOOLKIT);
|
|
66
|
+
const query = optionsSecond ? {} : queryOrOptions;
|
|
67
|
+
const options = optionsSecond ? queryOrOptions : trailingOptions;
|
|
68
|
+
return this.#client.delete(path`/api/v3.1/custom/toolkits/${slug}`, withOperation(OP_DELETE_TOOLKIT, {
|
|
69
|
+
query,
|
|
70
|
+
...options
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
sync(body, options) {
|
|
74
|
+
return this.#client.post("/api/v3.1/custom/toolkits/sync", withOperation(OP_SYNC, {
|
|
75
|
+
body,
|
|
76
|
+
...options
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
upsert(body, options) {
|
|
80
|
+
return this.#client.post("/api/v3.1/custom/toolkits/upsert", withOperation(OP_UPSERT, {
|
|
81
|
+
body,
|
|
82
|
+
...options
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { Custom as t };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//#region src/compat/error.ts
|
|
2
|
+
var ComposioError = class extends Error {};
|
|
3
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
const isStringArray = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
5
|
+
/**
|
|
6
|
+
* Narrow a parsed error body to the envelope's inner object. Checks exactly
|
|
7
|
+
* the fields the schema requires plus the optional ones' types; anything
|
|
8
|
+
* else (text bodies, foreign JSON, a 502 from a proxy) is `undefined`.
|
|
9
|
+
*/
|
|
10
|
+
const errorDetails = (body) => {
|
|
11
|
+
if (!isRecord(body) || !isRecord(body.error)) return void 0;
|
|
12
|
+
const { message, code, slug, status, request_id, suggested_fix, errors } = body.error;
|
|
13
|
+
if (typeof message !== "string" || typeof slug !== "string") return void 0;
|
|
14
|
+
if (typeof code !== "number" || typeof status !== "number") return void 0;
|
|
15
|
+
if (request_id !== void 0 && typeof request_id !== "string") return void 0;
|
|
16
|
+
if (suggested_fix !== void 0 && typeof suggested_fix !== "string") return void 0;
|
|
17
|
+
if (errors !== void 0 && !isStringArray(errors)) return void 0;
|
|
18
|
+
return {
|
|
19
|
+
message,
|
|
20
|
+
code,
|
|
21
|
+
slug,
|
|
22
|
+
status,
|
|
23
|
+
...request_id !== void 0 ? { request_id } : void 0,
|
|
24
|
+
...suggested_fix !== void 0 ? { suggested_fix } : void 0,
|
|
25
|
+
...errors !== void 0 ? { errors } : void 0
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
var APIError = class APIError extends ComposioError {
|
|
29
|
+
/** HTTP status for the response that caused the error. */
|
|
30
|
+
status;
|
|
31
|
+
/** HTTP headers of the response that caused the error. */
|
|
32
|
+
headers;
|
|
33
|
+
/** JSON body of the response that caused the error. */
|
|
34
|
+
error;
|
|
35
|
+
/**
|
|
36
|
+
* The body narrowed to the Composio error envelope (`APIErrorBody['error']`),
|
|
37
|
+
* or `undefined` when the body is not one — so a validation failure's
|
|
38
|
+
* `errors[]` and `suggested_fix` are reachable without casting `error`.
|
|
39
|
+
*
|
|
40
|
+
* Not part of the Stainless surface: a sanctioned superset, like
|
|
41
|
+
* `ClientOptions.userApiKey`.
|
|
42
|
+
*/
|
|
43
|
+
details;
|
|
44
|
+
/**
|
|
45
|
+
* The request id the API assigned, from the `x-request-id` response header
|
|
46
|
+
* first and the envelope's `request_id` otherwise; `undefined` when neither
|
|
47
|
+
* is present (connection errors, aborts). Same superset status as `details`.
|
|
48
|
+
*/
|
|
49
|
+
requestId;
|
|
50
|
+
constructor(status, error, message, headers) {
|
|
51
|
+
super(APIError.makeMessage(status, error, message));
|
|
52
|
+
this.status = status;
|
|
53
|
+
this.headers = headers;
|
|
54
|
+
this.error = error;
|
|
55
|
+
this.details = errorDetails(error);
|
|
56
|
+
this.requestId = headers?.get?.("x-request-id") || this.details?.request_id;
|
|
57
|
+
}
|
|
58
|
+
static makeMessage(status, error, message) {
|
|
59
|
+
const errorMessage = error?.message;
|
|
60
|
+
const msg = errorMessage ? typeof errorMessage === "string" ? errorMessage : JSON.stringify(errorMessage) : error ? JSON.stringify(error) : message;
|
|
61
|
+
if (status && msg) return `${status} ${msg}`;
|
|
62
|
+
if (status) return `${status} status code (no body)`;
|
|
63
|
+
if (msg) return msg;
|
|
64
|
+
return "(no status code or body)";
|
|
65
|
+
}
|
|
66
|
+
static generate(status, errorResponse, message, headers) {
|
|
67
|
+
if (!status || !headers) return new APIConnectionError({
|
|
68
|
+
message,
|
|
69
|
+
cause: errorResponse
|
|
70
|
+
});
|
|
71
|
+
const error = errorResponse;
|
|
72
|
+
if (status === 400) return new BadRequestError(status, error, message, headers);
|
|
73
|
+
if (status === 401) return new AuthenticationError(status, error, message, headers);
|
|
74
|
+
if (status === 403) return new PermissionDeniedError(status, error, message, headers);
|
|
75
|
+
if (status === 404) return new NotFoundError(status, error, message, headers);
|
|
76
|
+
if (status === 409) return new ConflictError(status, error, message, headers);
|
|
77
|
+
if (status === 422) return new UnprocessableEntityError(status, error, message, headers);
|
|
78
|
+
if (status === 429) return new RateLimitError(status, error, message, headers);
|
|
79
|
+
if (status >= 500) return new InternalServerError(status, error, message, headers);
|
|
80
|
+
return new APIError(status, error, message, headers);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var APIUserAbortError = class extends APIError {
|
|
84
|
+
constructor({ message } = {}) {
|
|
85
|
+
super(void 0, void 0, message ?? "Request was aborted.", void 0);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var APIConnectionError = class extends APIError {
|
|
89
|
+
constructor({ message, cause }) {
|
|
90
|
+
super(void 0, void 0, message ?? "Connection error.", void 0);
|
|
91
|
+
if (cause) this.cause = cause;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var APIConnectionTimeoutError = class extends APIConnectionError {
|
|
95
|
+
constructor({ message } = {}) {
|
|
96
|
+
super({ message: message ?? "Request timed out." });
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var BadRequestError = class extends APIError {};
|
|
100
|
+
var AuthenticationError = class extends APIError {};
|
|
101
|
+
var PermissionDeniedError = class extends APIError {};
|
|
102
|
+
var NotFoundError = class extends APIError {};
|
|
103
|
+
var ConflictError = class extends APIError {};
|
|
104
|
+
var UnprocessableEntityError = class extends APIError {};
|
|
105
|
+
var RateLimitError = class extends APIError {};
|
|
106
|
+
var InternalServerError = class extends APIError {};
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
export { AuthenticationError as a, ConflictError as c, PermissionDeniedError as d, RateLimitError as f, APIUserAbortError as i, InternalServerError as l, APIConnectionTimeoutError as n, BadRequestError as o, UnprocessableEntityError as p, APIError as r, ComposioError as s, APIConnectionError as t, NotFoundError as u };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as withOperation, n as generatedOperation } from "./generated-operations-CWhusMPU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/compat/resources/files.ts
|
|
4
|
+
const OP_LIST = generatedOperation("files.list");
|
|
5
|
+
const OP_CREATE_PRESIGNED_URL = generatedOperation("files.createPresignedURL");
|
|
4
6
|
/**
|
|
5
7
|
* Stainless-shaped `client.files` resource: the 2-method project file surface
|
|
6
8
|
* of `@composio/client` (list, createPresignedURL).
|
|
@@ -12,16 +14,16 @@ var Files = class {
|
|
|
12
14
|
}
|
|
13
15
|
/** @deprecated Deprecated in the input OpenAPI schema. */
|
|
14
16
|
list(query = {}, options) {
|
|
15
|
-
return this.#client.get(
|
|
17
|
+
return this.#client.get("/api/v3.1/files/list", withOperation(OP_LIST, {
|
|
16
18
|
query,
|
|
17
19
|
...options
|
|
18
|
-
});
|
|
20
|
+
}));
|
|
19
21
|
}
|
|
20
22
|
createPresignedURL(body, options) {
|
|
21
|
-
return this.#client.post(
|
|
23
|
+
return this.#client.post("/api/v3.1/files/upload/request", withOperation(OP_CREATE_PRESIGNED_URL, {
|
|
22
24
|
body,
|
|
23
25
|
...options
|
|
24
|
-
});
|
|
26
|
+
}));
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
29
|
|