@composio/client 2.0.0-rc.6 → 2.0.0-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +51 -3
  2. package/dist/{api-key-revocation-CSNyQo6m.mjs → api-key-revocation--5qqPnDz.mjs} +1 -1
  3. package/dist/{auth-BpeKOtkr.mjs → auth-_btgyN8t.mjs} +1 -1
  4. package/dist/{auth-configs-DAS68quO.mjs → auth-configs-lkRDnT-a.mjs} +1 -1
  5. package/dist/{clanker-CdTX3VrN.mjs → clanker-DBfYfkSH.mjs} +1 -1
  6. package/dist/{cli-BwAcGYUv.mjs → cli-Ckmt28-b.mjs} +2 -2
  7. package/dist/{connected-accounts-Bri1c8_y.mjs → connected-accounts-BJ5Ms_qb.mjs} +8 -1
  8. package/dist/{consumer-C-Sr8ilJ.mjs → consumer--h4l55c3.mjs} +2 -2
  9. package/dist/{custom-CZ41HKuF.mjs → custom-CA8Amqss.mjs} +2 -1
  10. package/dist/custom-CFKQnTel.mjs +31 -0
  11. package/dist/error-DLB1uKM3.mjs +109 -0
  12. package/dist/{files-Bw-q9jvQ.mjs → files-BP4vVrwo.mjs} +1 -1
  13. package/dist/{files-nKAca7MP.mjs → files-DG9Gc9CB.mjs} +1 -1
  14. package/dist/{generate-22I_8m4Q.mjs → generate-CGElZfOL.mjs} +2 -1
  15. package/dist/{generated-operations-BQO2JR1q.mjs → generated-operations-DVRtlxnl.mjs} +54 -76
  16. package/dist/index.d.mts +3 -3
  17. package/dist/index.mjs +48 -26
  18. package/dist/keyring-DaSYpy6j.mjs +17 -0
  19. package/dist/{link-D68LLK4Z.mjs → link-DUiP6kjL.mjs} +1 -1
  20. package/dist/{logs-D51p26Kb.mjs → logs-e4Kf3pcP.mjs} +3 -3
  21. package/dist/{manage-D8yy7vO-.mjs → manage-DTaRdqWV.mjs} +2 -2
  22. package/dist/{mcp-YTLiywS3.mjs → mcp-DxX8J9j8.mjs} +12 -3
  23. package/dist/{org-Cutt-dnU.mjs → org-BIGutZCA.mjs} +6 -6
  24. package/dist/{owner-ZVJeAZpU.mjs → owner-YrMH9R90.mjs} +1 -1
  25. package/dist/pagination.d.mts +56 -0
  26. package/dist/pagination.mjs +50 -0
  27. package/dist/{project-C8ZpAfnV.mjs → project-B59Fh0L9.mjs} +1 -1
  28. package/dist/{project-D0caI7O8.mjs → project-D2NT5pmv.mjs} +1 -1
  29. package/dist/{project-DKhGV5KP.mjs → project-DGE_op-j.mjs} +1 -1
  30. package/dist/{project-BObd0xOa.mjs → project-DWBDOy0X.mjs} +1 -1
  31. package/dist/{realtime-CtLFFEf8.mjs → realtime-BFjIp94B.mjs} +1 -1
  32. package/dist/resources/api-key-revocation.d.mts +1 -1
  33. package/dist/resources/api-key-revocation.mjs +1 -1
  34. package/dist/resources/auth/auth.d.mts +1 -1
  35. package/dist/resources/auth/auth.mjs +1 -1
  36. package/dist/resources/auth/index.d.mts +1 -1
  37. package/dist/resources/auth/index.mjs +2 -2
  38. package/dist/resources/auth/session.d.mts +1 -1
  39. package/dist/resources/auth/session.mjs +1 -1
  40. package/dist/resources/auth-configs.d.mts +1 -1
  41. package/dist/resources/auth-configs.mjs +1 -1
  42. package/dist/resources/auth.d.mts +1 -1
  43. package/dist/resources/auth.mjs +2 -2
  44. package/dist/resources/cli/cli.d.mts +1 -1
  45. package/dist/resources/cli/cli.mjs +1 -1
  46. package/dist/resources/cli/index.d.mts +1 -1
  47. package/dist/resources/cli/index.mjs +2 -2
  48. package/dist/resources/cli/realtime.d.mts +1 -1
  49. package/dist/resources/cli/realtime.mjs +1 -1
  50. package/dist/resources/cli.d.mts +1 -1
  51. package/dist/resources/cli.mjs +2 -2
  52. package/dist/resources/connected-accounts.d.mts +1 -1
  53. package/dist/resources/connected-accounts.mjs +1 -1
  54. package/dist/resources/custom.d.mts +2 -0
  55. package/dist/resources/custom.mjs +3 -0
  56. package/dist/resources/files.d.mts +1 -1
  57. package/dist/resources/files.mjs +1 -1
  58. package/dist/resources/index.d.mts +1 -1
  59. package/dist/resources/index.mjs +13 -13
  60. package/dist/resources/keyring.d.mts +2 -0
  61. package/dist/resources/keyring.mjs +3 -0
  62. package/dist/resources/link.d.mts +1 -1
  63. package/dist/resources/link.mjs +1 -1
  64. package/dist/resources/logs/index.d.mts +1 -1
  65. package/dist/resources/logs/index.mjs +3 -3
  66. package/dist/resources/logs/logs.d.mts +1 -1
  67. package/dist/resources/logs/logs.mjs +1 -1
  68. package/dist/resources/logs/tools.d.mts +1 -1
  69. package/dist/resources/logs/tools.mjs +1 -1
  70. package/dist/resources/logs/triggers.d.mts +1 -1
  71. package/dist/resources/logs/triggers.mjs +1 -1
  72. package/dist/resources/logs.d.mts +1 -1
  73. package/dist/resources/logs.mjs +3 -3
  74. package/dist/resources/mcp/custom.d.mts +1 -1
  75. package/dist/resources/mcp/custom.mjs +1 -1
  76. package/dist/resources/mcp/generate.d.mts +1 -1
  77. package/dist/resources/mcp/generate.mjs +1 -1
  78. package/dist/resources/mcp/index.d.mts +1 -1
  79. package/dist/resources/mcp/index.mjs +3 -3
  80. package/dist/resources/mcp/mcp.d.mts +1 -1
  81. package/dist/resources/mcp/mcp.mjs +1 -1
  82. package/dist/resources/mcp.d.mts +1 -1
  83. package/dist/resources/mcp.mjs +3 -3
  84. package/dist/resources/org/clanker.d.mts +1 -1
  85. package/dist/resources/org/clanker.mjs +1 -1
  86. package/dist/resources/org/consumer/consumer.d.mts +1 -1
  87. package/dist/resources/org/consumer/consumer.mjs +1 -1
  88. package/dist/resources/org/consumer/index.d.mts +1 -1
  89. package/dist/resources/org/consumer/index.mjs +2 -2
  90. package/dist/resources/org/consumer/project.d.mts +1 -1
  91. package/dist/resources/org/consumer/project.mjs +1 -1
  92. package/dist/resources/org/consumer.d.mts +1 -1
  93. package/dist/resources/org/consumer.mjs +2 -2
  94. package/dist/resources/org/index.d.mts +1 -1
  95. package/dist/resources/org/index.mjs +6 -6
  96. package/dist/resources/org/org.d.mts +1 -1
  97. package/dist/resources/org/org.mjs +1 -1
  98. package/dist/resources/org/owner/index.d.mts +1 -1
  99. package/dist/resources/org/owner/index.mjs +2 -2
  100. package/dist/resources/org/owner/owner.d.mts +1 -1
  101. package/dist/resources/org/owner/owner.mjs +1 -1
  102. package/dist/resources/org/owner/project.d.mts +1 -1
  103. package/dist/resources/org/owner/project.mjs +1 -1
  104. package/dist/resources/org/owner.d.mts +1 -1
  105. package/dist/resources/org/owner.mjs +2 -2
  106. package/dist/resources/org/project.d.mts +1 -1
  107. package/dist/resources/org/project.mjs +1 -1
  108. package/dist/resources/org/usage.d.mts +1 -1
  109. package/dist/resources/org/usage.mjs +1 -1
  110. package/dist/resources/org.d.mts +1 -1
  111. package/dist/resources/org.mjs +6 -6
  112. package/dist/resources/project/index.d.mts +1 -1
  113. package/dist/resources/project/index.mjs +1 -1
  114. package/dist/resources/project/project.d.mts +1 -1
  115. package/dist/resources/project/project.mjs +1 -1
  116. package/dist/resources/project/usage.d.mts +1 -1
  117. package/dist/resources/project/usage.mjs +1 -1
  118. package/dist/resources/project.d.mts +1 -1
  119. package/dist/resources/project.mjs +1 -1
  120. package/dist/resources/session-configs.d.mts +2 -0
  121. package/dist/resources/session-configs.mjs +24 -0
  122. package/dist/resources/tool-router/index.d.mts +1 -1
  123. package/dist/resources/tool-router/index.mjs +2 -2
  124. package/dist/resources/tool-router/session/files.d.mts +1 -1
  125. package/dist/resources/tool-router/session/files.mjs +1 -1
  126. package/dist/resources/tool-router/session/index.d.mts +1 -1
  127. package/dist/resources/tool-router/session/index.mjs +2 -2
  128. package/dist/resources/tool-router/session/session.d.mts +1 -1
  129. package/dist/resources/tool-router/session/session.mjs +1 -1
  130. package/dist/resources/tool-router/session.d.mts +1 -1
  131. package/dist/resources/tool-router/session.mjs +2 -2
  132. package/dist/resources/tool-router/tool-router.d.mts +1 -1
  133. package/dist/resources/tool-router/tool-router.mjs +1 -1
  134. package/dist/resources/tool-router.d.mts +1 -1
  135. package/dist/resources/tool-router.mjs +2 -2
  136. package/dist/resources/toolkits.d.mts +1 -1
  137. package/dist/resources/toolkits.mjs +1 -1
  138. package/dist/resources/tools.d.mts +1 -1
  139. package/dist/resources/tools.mjs +1 -1
  140. package/dist/resources/trigger-instances/index.d.mts +1 -1
  141. package/dist/resources/trigger-instances/index.mjs +2 -2
  142. package/dist/resources/trigger-instances/manage.d.mts +1 -1
  143. package/dist/resources/trigger-instances/manage.mjs +1 -1
  144. package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
  145. package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
  146. package/dist/resources/trigger-instances.d.mts +1 -1
  147. package/dist/resources/trigger-instances.mjs +2 -2
  148. package/dist/resources/triggers-types.d.mts +1 -1
  149. package/dist/resources/triggers-types.mjs +1 -1
  150. package/dist/resources/webhook-endpoints.d.mts +1 -1
  151. package/dist/resources/webhook-endpoints.mjs +1 -1
  152. package/dist/resources/webhook-subscriptions.d.mts +1 -1
  153. package/dist/resources/webhook-subscriptions.mjs +1 -1
  154. package/dist/{session-Byj-qri0.mjs → session-B9FZU6oA.mjs} +1 -1
  155. package/dist/{session-BFEAeE9G.mjs → session-DtXQM3G3.mjs} +2 -2
  156. package/dist/{client-Cu0FrKmX.d.mts → session-configs-DC9dblKH.d.mts} +4526 -897
  157. package/dist/{tool-router-CyuTk9t-.mjs → tool-router-CTH_fcxP.mjs} +1 -1
  158. package/dist/{toolkits-Bck41m7-.mjs → toolkits-CxXj47JG.mjs} +15 -1
  159. package/dist/{tools-Bvbrgij6.mjs → tools-B9zq-uPU.mjs} +2 -1
  160. package/dist/{tools-D8kKy_iy.mjs → tools-BpRusMHS.mjs} +1 -1
  161. package/dist/{trigger-instances-B3oj-IJW.mjs → trigger-instances-DSk1vemj.mjs} +2 -2
  162. package/dist/{triggers-CirhOG03.mjs → triggers-DRn4adsh.mjs} +1 -1
  163. package/dist/{triggers-types-CHJxtojA.mjs → triggers-types-Cgh-mvOz.mjs} +1 -1
  164. package/dist/{usage-CD53euIq.mjs → usage-B6pidrAI.mjs} +1 -1
  165. package/dist/{usage-C5VBnFfd.mjs → usage-B8p0O_pg.mjs} +1 -1
  166. package/dist/{webhook-endpoints-gTzzFJ1c.mjs → webhook-endpoints-D4uTri1P.mjs} +1 -1
  167. package/dist/{webhook-subscriptions-bZFki65N.mjs → webhook-subscriptions-DYxSYlZP.mjs} +1 -1
  168. 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:
@@ -27,7 +75,7 @@ const composio = Composio.fromEnv(config, { environment: 'staging' })
27
75
 
28
76
  `fromEnv` recognizes `COMPOSIO_API_KEY`, `COMPOSIO_USER_API_KEY`, `COMPOSIO_ORG_API_KEY`,
29
77
  `COMPOSIO_BASE_URL`, `COMPOSIO_ALLOW_INSECURE_HTTP`, `COMPOSIO_CUSTOM_HEADERS`, and
30
- `COMPOSIO_LOG`. Derived clients created with `withOptions()` keep using the resolved snapshot and do
78
+ `COMPOSIO_LOG_LEVEL`. Derived clients created with `withOptions()` keep using the resolved snapshot and do
31
79
  not fall back to ambient values.
32
80
 
33
81
  Inject a `Transport` when an application or test needs to own HTTP dispatch. The transport receives
@@ -76,8 +124,8 @@ Toolchain is pinned via [mise](https://mise.jdx.dev) (`mise install`): Node 24,
76
124
  ```sh
77
125
  pnpm install
78
126
  pnpm generate # hey-api + compat codegen: spec/openapi.json → src/generated + src/compat/resources (do not edit)
79
- pnpm lint # eslint over src, test, packages/codegen
80
- pnpm typecheck # tsgo (TS native) over src+test, incl. type tests
127
+ pnpm lint # eslint over src, test, codegen, parity, and demo
128
+ pnpm typecheck # tsgo (TS native), including type tests and demo
81
129
  pnpm typecheck:tsc # same programs under tsc — both compilers must pass
82
130
  pnpm codegen:check # verify committed src/compat/resources matches the generator
83
131
  pnpm test # unit tests (MSW mocks) + codegen tests
@@ -1,4 +1,4 @@
1
- import { c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.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 { t as Session } from "./session-Byj-qri0.mjs";
1
+ import { t as Session } from "./session-B9FZU6oA.mjs";
2
2
 
3
3
  //#region src/compat/resources/auth/auth.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.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-BQO2JR1q.mjs";
1
+ import { c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.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, n as generatedOperation, p as mergeHeaders } from "./generated-operations-BQO2JR1q.mjs";
2
- import { t as Realtime } from "./realtime-CtLFFEf8.mjs";
1
+ import { c as withOperation, n as generatedOperation, p as mergeHeaders } from "./generated-operations-DVRtlxnl.mjs";
2
+ import { t as Realtime } from "./realtime-BFjIp94B.mjs";
3
3
 
4
4
  //#region src/compat/resources/cli/cli.ts
5
5
  const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
@@ -1,10 +1,11 @@
1
- import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.mjs";
2
2
 
3
3
  //#region src/compat/resources/connected-accounts.ts
4
4
  const OP_CREATE = generatedOperation("connectedAccounts.create");
5
5
  const OP_RETRIEVE = generatedOperation("connectedAccounts.retrieve");
6
6
  const OP_LIST = generatedOperation("connectedAccounts.list");
7
7
  const OP_DELETE = generatedOperation("connectedAccounts.delete");
8
+ const OP_COMPLETE_AUTH = generatedOperation("connectedAccounts.completeAuth");
8
9
  const OP_PATCH = generatedOperation("connectedAccounts.patch");
9
10
  const OP_REFRESH = generatedOperation("connectedAccounts.refresh");
10
11
  const OP_REVOKE = generatedOperation("connectedAccounts.revoke");
@@ -42,6 +43,12 @@ var ConnectedAccounts = class {
42
43
  ...options
43
44
  }));
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
+ }));
51
+ }
45
52
  patch(nanoid, body = {}, options) {
46
53
  return this.#client.patch(path`/api/v3.1/connected_accounts/${nanoid}`, withOperation(OP_PATCH, {
47
54
  body,
@@ -1,5 +1,5 @@
1
- import { c as withOperation, n as generatedOperation, p as mergeHeaders } from "./generated-operations-BQO2JR1q.mjs";
2
- import { t as Project } from "./project-D0caI7O8.mjs";
1
+ import { c as withOperation, n as generatedOperation, p as mergeHeaders } from "./generated-operations-DVRtlxnl.mjs";
2
+ import { t as Project } from "./project-D2NT5pmv.mjs";
3
3
 
4
4
  //#region src/compat/resources/org/consumer/consumer.ts
5
5
  const OP_LIST_CONNECTED_TOOLKITS = generatedOperation("org.consumer.listConnectedToolkits");
@@ -1,4 +1,4 @@
1
- import { c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.mjs";
2
2
 
3
3
  //#region src/compat/resources/mcp/custom.ts
4
4
  const OP_CREATE = generatedOperation("mcp.custom.create");
@@ -11,6 +11,7 @@ var Custom = class {
11
11
  constructor(client) {
12
12
  this.#client = client;
13
13
  }
14
+ /** @deprecated Deprecated in the input OpenAPI schema. */
14
15
  create(body, options) {
15
16
  return this.#client.post("/api/v3.1/mcp/servers/custom", withOperation(OP_CREATE, {
16
17
  body,
@@ -0,0 +1,31 @@
1
+ import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.mjs";
2
+
3
+ //#region src/compat/resources/custom.ts
4
+ const OP_DELETE_TOOLKIT = generatedOperation("custom.deleteToolkit");
5
+ const OP_SYNC = generatedOperation("custom.sync");
6
+ const OP_UPSERT = generatedOperation("custom.upsert");
7
+ /** OpenAPI resource for `custom`. */
8
+ var Custom = class {
9
+ #client;
10
+ constructor(client) {
11
+ this.#client = client;
12
+ }
13
+ deleteToolkit(slug, options) {
14
+ return this.#client.delete(path`/api/v3.1/custom/toolkits/${slug}`, withOperation(OP_DELETE_TOOLKIT, { ...options }));
15
+ }
16
+ sync(body, options) {
17
+ return this.#client.post("/api/v3.1/custom/toolkits/sync", withOperation(OP_SYNC, {
18
+ body,
19
+ ...options
20
+ }));
21
+ }
22
+ upsert(body, options) {
23
+ return this.#client.post("/api/v3.1/custom/toolkits/upsert", withOperation(OP_UPSERT, {
24
+ body,
25
+ ...options
26
+ }));
27
+ }
28
+ };
29
+
30
+ //#endregion
31
+ 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,4 +1,4 @@
1
- import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { a as path, c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.mjs";
2
2
 
3
3
  //#region src/compat/resources/tool-router/session/files.ts
4
4
  const OP_LIST = generatedOperation("toolRouter.session.files.list");
@@ -1,4 +1,4 @@
1
- import { c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.mjs";
2
2
 
3
3
  //#region src/compat/resources/files.ts
4
4
  const OP_LIST = generatedOperation("files.list");
@@ -1,4 +1,4 @@
1
- import { c as withOperation, n as generatedOperation } from "./generated-operations-BQO2JR1q.mjs";
1
+ import { c as withOperation, n as generatedOperation } from "./generated-operations-DVRtlxnl.mjs";
2
2
 
3
3
  //#region src/compat/resources/mcp/generate.ts
4
4
  const OP_URL = generatedOperation("mcp.generate.url");
@@ -11,6 +11,7 @@ var Generate = class {
11
11
  constructor(client) {
12
12
  this.#client = client;
13
13
  }
14
+ /** @deprecated Deprecated in the input OpenAPI schema. */
14
15
  url(body, options) {
15
16
  return this.#client.post("/api/v3.1/mcp/servers/generate", withOperation(OP_URL, {
16
17
  body,
@@ -1,77 +1,5 @@
1
- //#region src/compat/error.ts
2
- /**
3
- * Stainless-compatible error hierarchy.
4
- *
5
- * Downstream code does `instanceof` checks and reads `status` / `error` /
6
- * `headers` on these classes (see docs/research/drop-in-contract.md §4), so
7
- * both the class names and the inheritance chain are part of the drop-in
8
- * contract: `BadRequestError extends APIError extends ComposioError extends Error`.
9
- */
10
- var ComposioError = class extends Error {};
11
- var APIError = class APIError extends ComposioError {
12
- /** HTTP status for the response that caused the error. */
13
- status;
14
- /** HTTP headers of the response that caused the error. */
15
- headers;
16
- /** JSON body of the response that caused the error. */
17
- error;
18
- constructor(status, error, message, headers) {
19
- super(APIError.makeMessage(status, error, message));
20
- this.status = status;
21
- this.headers = headers;
22
- this.error = error;
23
- }
24
- static makeMessage(status, error, message) {
25
- const errorMessage = error?.message;
26
- const msg = errorMessage ? typeof errorMessage === "string" ? errorMessage : JSON.stringify(errorMessage) : error ? JSON.stringify(error) : message;
27
- if (status && msg) return `${status} ${msg}`;
28
- if (status) return `${status} status code (no body)`;
29
- if (msg) return msg;
30
- return "(no status code or body)";
31
- }
32
- static generate(status, errorResponse, message, headers) {
33
- if (!status || !headers) return new APIConnectionError({
34
- message,
35
- cause: errorResponse
36
- });
37
- const error = errorResponse;
38
- if (status === 400) return new BadRequestError(status, error, message, headers);
39
- if (status === 401) return new AuthenticationError(status, error, message, headers);
40
- if (status === 403) return new PermissionDeniedError(status, error, message, headers);
41
- if (status === 404) return new NotFoundError(status, error, message, headers);
42
- if (status === 409) return new ConflictError(status, error, message, headers);
43
- if (status === 422) return new UnprocessableEntityError(status, error, message, headers);
44
- if (status === 429) return new RateLimitError(status, error, message, headers);
45
- if (status >= 500) return new InternalServerError(status, error, message, headers);
46
- return new APIError(status, error, message, headers);
47
- }
48
- };
49
- var APIUserAbortError = class extends APIError {
50
- constructor({ message } = {}) {
51
- super(void 0, void 0, message ?? "Request was aborted.", void 0);
52
- }
53
- };
54
- var APIConnectionError = class extends APIError {
55
- constructor({ message, cause }) {
56
- super(void 0, void 0, message ?? "Connection error.", void 0);
57
- if (cause) this.cause = cause;
58
- }
59
- };
60
- var APIConnectionTimeoutError = class extends APIConnectionError {
61
- constructor({ message } = {}) {
62
- super({ message: message ?? "Request timed out." });
63
- }
64
- };
65
- var BadRequestError = class extends APIError {};
66
- var AuthenticationError = class extends APIError {};
67
- var PermissionDeniedError = class extends APIError {};
68
- var NotFoundError = class extends APIError {};
69
- var ConflictError = class extends APIError {};
70
- var UnprocessableEntityError = class extends APIError {};
71
- var RateLimitError = class extends APIError {};
72
- var InternalServerError = class extends APIError {};
1
+ import { i as APIUserAbortError, n as APIConnectionTimeoutError, s as ComposioError, t as APIConnectionError } from "./error-DLB1uKM3.mjs";
73
2
 
74
- //#endregion
75
3
  //#region src/compat/headers.ts
76
4
  const hasEntries = (value) => typeof value === "object" && value !== null && "append" in value && typeof value.append === "function" && "delete" in value && typeof value.delete === "function" && "entries" in value && typeof value.entries === "function" && "get" in value && typeof value.get === "function";
77
5
  const isHeaders = (value) => value instanceof Headers || hasEntries(value);
@@ -1279,7 +1207,7 @@ const kernelInternals = { sleep };
1279
1207
  */
1280
1208
  const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
1281
1209
  const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL, config.allowedHTTPOrigin);
1282
- if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers) {
1210
+ if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
1283
1211
  const direct = new Headers({
1284
1212
  accept: "application/json",
1285
1213
  "user-agent": config.userAgent
@@ -1288,6 +1216,7 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
1288
1216
  return direct;
1289
1217
  }
1290
1218
  const headers = buildHeaders([
1219
+ { "idempotency-key": options.idempotencyKey },
1291
1220
  {
1292
1221
  accept: "application/json",
1293
1222
  "user-agent": config.userAgent
@@ -1515,6 +1444,12 @@ const GENERATED_OPERATIONS = [
1515
1444
  chain: ["connectedAccounts", "delete"],
1516
1445
  schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1517
1446
  },
1447
+ {
1448
+ method: "delete",
1449
+ path: "/api/v3.1/custom/toolkits/{slug}",
1450
+ chain: ["custom", "deleteToolkit"],
1451
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1452
+ },
1518
1453
  {
1519
1454
  method: "delete",
1520
1455
  path: "/api/v3.1/mcp/servers/{serverId}/instances/{instanceId}",
@@ -1643,6 +1578,11 @@ const GENERATED_OPERATIONS = [
1643
1578
  "retrieve"
1644
1579
  ]
1645
1580
  },
1581
+ {
1582
+ method: "get",
1583
+ path: "/api/v3.1/keyring/transfer_keys",
1584
+ chain: ["keyring", "listTransferKeys"]
1585
+ },
1646
1586
  {
1647
1587
  method: "get",
1648
1588
  path: "/api/v3.1/logs/tool_execution/{id}",
@@ -1716,6 +1656,16 @@ const GENERATED_OPERATIONS = [
1716
1656
  ],
1717
1657
  schemes: ["UserApiKeyAuth"]
1718
1658
  },
1659
+ {
1660
+ method: "get",
1661
+ path: "/api/v3.1/session_configs",
1662
+ chain: ["sessionConfigs", "list"]
1663
+ },
1664
+ {
1665
+ method: "get",
1666
+ path: "/api/v3.1/session_configs/{session_config_id}",
1667
+ chain: ["sessionConfigs", "retrieve"]
1668
+ },
1719
1669
  {
1720
1670
  method: "get",
1721
1671
  path: "/api/v3.1/tool_router/session/{session_id}",
@@ -1784,6 +1734,11 @@ const GENERATED_OPERATIONS = [
1784
1734
  chain: ["toolkits", "retrieve"],
1785
1735
  schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1786
1736
  },
1737
+ {
1738
+ method: "get",
1739
+ path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/grant_context",
1740
+ chain: ["toolkits", "retrieveScopesGrantContext"]
1741
+ },
1787
1742
  {
1788
1743
  method: "get",
1789
1744
  path: "/api/v3.1/tools",
@@ -1948,6 +1903,11 @@ const GENERATED_OPERATIONS = [
1948
1903
  path: "/api/v3.1/connected_accounts",
1949
1904
  chain: ["connectedAccounts", "create"]
1950
1905
  },
1906
+ {
1907
+ method: "post",
1908
+ path: "/api/v3.1/connected_accounts/complete_auth",
1909
+ chain: ["connectedAccounts", "completeAuth"]
1910
+ },
1951
1911
  {
1952
1912
  method: "post",
1953
1913
  path: "/api/v3.1/connected_accounts/link",
@@ -1964,6 +1924,18 @@ const GENERATED_OPERATIONS = [
1964
1924
  path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
1965
1925
  chain: ["connectedAccounts", "revoke"]
1966
1926
  },
1927
+ {
1928
+ method: "post",
1929
+ path: "/api/v3.1/custom/toolkits/sync",
1930
+ chain: ["custom", "sync"],
1931
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1932
+ },
1933
+ {
1934
+ method: "post",
1935
+ path: "/api/v3.1/custom/toolkits/upsert",
1936
+ chain: ["custom", "upsert"],
1937
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1938
+ },
1967
1939
  {
1968
1940
  method: "post",
1969
1941
  path: "/api/v3.1/files/upload/request",
@@ -2185,7 +2157,8 @@ const GENERATED_OPERATIONS = [
2185
2157
  "session",
2186
2158
  "proxyExecute"
2187
2159
  ],
2188
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2160
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2161
+ hasDeprecatedInputs: true
2189
2162
  },
2190
2163
  {
2191
2164
  method: "post",
@@ -2201,6 +2174,11 @@ const GENERATED_OPERATIONS = [
2201
2174
  path: "/api/v3.1/toolkits/multi",
2202
2175
  chain: ["toolkits", "retrieveMulti"]
2203
2176
  },
2177
+ {
2178
+ method: "post",
2179
+ path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/recommended",
2180
+ chain: ["toolkits", "recommendScopes"]
2181
+ },
2204
2182
  {
2205
2183
  method: "post",
2206
2184
  path: "/api/v3.1/tools/execute/proxy",
@@ -2273,4 +2251,4 @@ const generatedOperation = (chainKey) => {
2273
2251
  };
2274
2252
 
2275
2253
  //#endregion
2276
- export { NotFoundError as C, UnprocessableEntityError as E, InternalServerError as S, RateLimitError as T, APIUserAbortError as _, path as a, ComposioError as b, withOperation as c, assertCredentialTransport as d, parseHTTPURL as f, APIError as g, APIConnectionTimeoutError as h, makeRequest as i, inspectDeprecatedInputs as l, APIConnectionError as m, generatedOperation as n, readOperation as o, mergeHeaders as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecation as u, AuthenticationError as v, PermissionDeniedError as w, ConflictError as x, BadRequestError as y };
2254
+ export { path as a, withOperation as c, assertCredentialTransport as d, parseHTTPURL as f, makeRequest as i, inspectDeprecatedInputs as l, generatedOperation as n, readOperation as o, mergeHeaders as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecation as u };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $r as FileListParams, Ar as SessionExecuteMetaParams, Br as SessionRetrieveResponse, Cr as SessionAttachParams, Dr as SessionCreateParams, Er as SessionConfigHistoryResponse, Fr as SessionLinkResponse, Gr as SessionToolsParams, Hr as SessionSearchResponse, Ir as SessionPatchParams, Jr as FileCreateDownloadURLResponse, Kr as SessionToolsResponse, Lr as SessionPatchResponse, Mr as SessionExecuteParams, Nr as SessionExecuteResponse, Or as SessionCreateResponse, Pr as SessionLinkParams, Qr as FileDeleteResponse, Rr as SessionProxyExecuteParams, Sr as Session, Tr as SessionConfigHistoryParams, Ur as SessionToolkitsParams, Vr as SessionSearchParams, Wr as SessionToolkitsResponse, Xr as FileCreateUploadURLResponse, Yr as FileCreateUploadURLParams, Zr as FileDeleteParams, _i as RateLimitError, a as Logger, ai as createFetchTransport, ci as APIError, di as BadRequestError, ei as FileListResponse, fi as ComposioError, gi as PermissionDeniedError, hi as NotFoundError, i as LogLevel, ii as Transport, jr as SessionExecuteMetaResponse, kr as SessionDeleteResponse, li as APIUserAbortError, mi as InternalServerError, n as Composio, ni as RequestOptions, oi as APIConnectionError, pi as ConflictError, qr as FileCreateDownloadURLParams, r as EnvironmentMap, ri as FetchTransportDefaults, si as APIConnectionTimeoutError, t as ClientOptions, ti as Files, ui as AuthenticationError, vi as UnprocessableEntityError, wr as SessionAttachResponse, xr as ToolRouter, yi as APIPromise, zr as SessionProxyExecuteResponse } from "./client-Cu0FrKmX.mjs";
1
+ import { $r as SessionSearchParams, Ai as RateLimitError, Br as SessionCreateResponse, Ci as AuthenticationError, Di as InternalServerError, Ei as ConflictError, Fr as SessionAttachParams, Gr as SessionExecuteResponse, Hr as SessionExecuteMetaParams, Ir as SessionAttachResponse, Jr as SessionPatchParams, Kr as SessionLinkParams, Lr as SessionConfigHistoryParams, Mi as APIPromise, Nr as ToolRouter, Oi as NotFoundError, Pr as Session, Qr as SessionRetrieveResponse, Rr as SessionConfigHistoryResponse, Si as APIUserAbortError, Ti as ComposioError, Ur as SessionExecuteMetaResponse, Vr as SessionDeleteResponse, Wr as SessionExecuteParams, Xr as SessionProxyExecuteParams, Yr as SessionPatchResponse, Zr as SessionProxyExecuteResponse, _i as createFetchTransport, a as ClientOptions, ai as FileCreateDownloadURLParams, bi as APIError, c as LogLevel, ci as FileCreateUploadURLResponse, di as FileListParams, ei as SessionSearchResponse, fi as FileListResponse, gi as Transport, hi as FetchTransportDefaults, ii as SessionToolsResponse, ji as UnprocessableEntityError, ki as PermissionDeniedError, l as Logger, li as FileDeleteParams, mi as RequestOptions, ni as SessionToolkitsResponse, o as Composio, oi as FileCreateDownloadURLResponse, pi as Files, qr as SessionLinkResponse, ri as SessionToolsParams, s as EnvironmentMap, si as FileCreateUploadURLParams, ti as SessionToolkitsParams, ui as FileDeleteResponse, vi as APIConnectionError, wi as BadRequestError, xi as APIErrorBody, yi as APIConnectionTimeoutError, zr as SessionCreateParams } from "./session-configs-DC9dblKH.mjs";
2
2
  //#region src/version.d.ts
3
- declare const VERSION = "2.0.0-rc.6";
3
+ declare const VERSION = "2.0.0-rc.8";
4
4
  //#endregion
5
- export { APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, type ClientOptions, Composio, Composio as default, ComposioError, ConflictError, type EnvironmentMap, type FetchTransportDefaults, type FileCreateDownloadURLParams, type FileCreateDownloadURLResponse, type FileCreateUploadURLParams, type FileCreateUploadURLResponse, type FileDeleteParams, type FileDeleteResponse, type FileListParams, type FileListResponse, Files, InternalServerError, type LogLevel, type Logger, NotFoundError, PermissionDeniedError, RateLimitError, type RequestOptions, Session, type SessionAttachParams, type SessionAttachResponse, type SessionConfigHistoryParams, type SessionConfigHistoryResponse, type SessionCreateParams, type SessionCreateResponse, type SessionDeleteResponse, type SessionExecuteMetaParams, type SessionExecuteMetaResponse, type SessionExecuteParams, type SessionExecuteResponse, type SessionLinkParams, type SessionLinkResponse, type SessionPatchParams, type SessionPatchResponse, type SessionProxyExecuteParams, type SessionProxyExecuteResponse, type SessionRetrieveResponse, type SessionSearchParams, type SessionSearchResponse, type SessionToolkitsParams, type SessionToolkitsResponse, type SessionToolsParams, type SessionToolsResponse, ToolRouter, type Transport, UnprocessableEntityError, VERSION, createFetchTransport };
5
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, type ClientOptions, Composio, Composio as default, ComposioError, ConflictError, type EnvironmentMap, type FetchTransportDefaults, type FileCreateDownloadURLParams, type FileCreateDownloadURLResponse, type FileCreateUploadURLParams, type FileCreateUploadURLResponse, type FileDeleteParams, type FileDeleteResponse, type FileListParams, type FileListResponse, Files, InternalServerError, type LogLevel, type Logger, NotFoundError, PermissionDeniedError, RateLimitError, type RequestOptions, Session, type SessionAttachParams, type SessionAttachResponse, type SessionConfigHistoryParams, type SessionConfigHistoryResponse, type SessionCreateParams, type SessionCreateResponse, type SessionDeleteResponse, type SessionExecuteMetaParams, type SessionExecuteMetaResponse, type SessionExecuteParams, type SessionExecuteResponse, type SessionLinkParams, type SessionLinkResponse, type SessionPatchParams, type SessionPatchResponse, type SessionProxyExecuteParams, type SessionProxyExecuteResponse, type SessionRetrieveResponse, type SessionSearchParams, type SessionSearchResponse, type SessionToolkitsParams, type SessionToolkitsResponse, type SessionToolsParams, type SessionToolsResponse, ToolRouter, type Transport, UnprocessableEntityError, VERSION, createFetchTransport };