@composio/core 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CustomTool-VRfWzMix.d.mts → CustomTool-B3m-188G.d.mts} +1 -1
- package/dist/{CustomTool-Bz0f52QR.mjs → CustomTool-fYEFjSLM.mjs} +1 -1
- package/dist/{FileModifierErrors-CwB-Inm9.mjs → FileModifierErrors-CdGSABoq.mjs} +1 -1
- package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
- package/dist/{SsrfErrors-xhdVE4yw.mjs → SsrfErrors-DiQldIdC.mjs} +32 -17
- package/dist/{Telemetry-Dw9W5RSp.mjs → Telemetry-JRJJYS4I.mjs} +2 -2
- package/dist/{cancellation-P5YUlcfz.mjs → cancellation-Dwa9lGHA.mjs} +7 -5
- package/dist/{composio-Cb3d1jFe.d.mts → composio-B36OXii1.d.mts} +3017 -144
- package/dist/{customTool.types-B6ej_8XZ.d.mts → customTool.types-C436M_D0.d.mts} +525 -101
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +10 -10
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +8 -15
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +101 -18
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +123 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +9 -2
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +7 -0
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +56 -0
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +78 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +15 -15
- package/dist/docs/reference/sdk-reference/typescript/meta.json +8 -1
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +10 -10
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +117 -24
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +24 -10
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +151 -14
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +50 -40
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +26 -25
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +78 -0
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +162 -0
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +218 -0
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +20 -0
- package/dist/{errors-Ue9wMrPK.mjs → errors-D_A4b2c2.mjs} +143 -4
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-KE5Fa-af.mjs → fileUtils.node-DNLhLg0W.mjs} +8 -6
- package/dist/index.d.mts +418 -146
- package/dist/index.mjs +2728 -349
- package/dist/models/Files.node.d.mts +2 -3
- package/dist/models/Files.node.mjs +2 -2
- package/dist/models/Files.workerd.d.mts +2 -3
- package/dist/platform/node.d.mts +2 -3
- package/dist/platform/workerd.d.mts +2 -3
- package/dist/{sensitiveFileUploadPaths-QN7w4n8v.mjs → sensitiveFileUploadPaths-BlLp-Yo2.mjs} +10 -7
- package/dist/{ssrfGuard.node-BLX6b-Rf.mjs → ssrfGuard.node-BZ270bcu.mjs} +104 -14
- package/dist/{types-CGdgK442.d.mts → types-Br3GBya5.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.mjs +6 -6
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/dist/utils/ssrfGuard.node.d.mts +19 -10
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +12 -4
- package/dist/utils/ssrfGuard.workerd.mjs +2 -2
- package/package.json +9 -9
- package/src/composio.ts +207 -10
- package/src/errors/ConnectedAccountsErrors.ts +47 -0
- package/src/errors/SDKErrors.ts +52 -0
- package/src/errors/ToolErrors.ts +24 -0
- package/src/errors/ToolRouterErrors.ts +57 -0
- package/src/errors/index.ts +3 -0
- package/src/index.ts +15 -0
- package/src/lib/toolRouterMcp.ts +132 -0
- package/src/lib/toolRouterParams.ts +116 -29
- package/src/models/ConnectedAccounts.ts +118 -2
- package/src/models/CustomToolkits.ts +169 -0
- package/src/models/Experimental.ts +27 -0
- package/src/models/Keyring.ts +65 -0
- package/src/models/Logs.ts +101 -0
- package/src/models/MCP.ts +29 -15
- package/src/models/ToolRouter.ts +43 -14
- package/src/models/ToolRouterSession.ts +224 -16
- package/src/models/Toolkits.ts +181 -2
- package/src/models/Tools.ts +58 -26
- package/src/models/Triggers.ts +10 -90
- package/src/models/Usage.ts +119 -0
- package/src/models/Webhooks.ts +520 -0
- package/src/services/pusher/Pusher.ts +46 -16
- package/src/types/authConfigs.types.ts +2 -0
- package/src/types/connectedAccounts.types.ts +54 -0
- package/src/types/customToolkits.types.ts +102 -0
- package/src/types/keyring.types.ts +32 -0
- package/src/types/logs.types.ts +108 -0
- package/src/types/toolRouter.types.ts +259 -14
- package/src/types/toolkit.types.ts +161 -0
- package/src/types/usage.types.ts +81 -0
- package/src/types/webhooks.types.ts +143 -0
- package/src/utils/constants.ts +1 -5
- package/src/utils/jsonSchema.ts +4 -1
- package/src/utils/logger.ts +39 -7
- package/src/utils/sdk.ts +385 -22
- package/src/utils/ssrfGuard.node.ts +127 -13
- package/src/utils/ssrfGuard.workerd.ts +11 -1
- package/src/utils/transformers/connectedAccounts.ts +37 -2
- package/src/utils/transformers/customToolkits.ts +98 -0
- package/src/utils/transformers/keyring.ts +24 -0
- package/src/utils/transformers/logs.ts +85 -0
- package/src/utils/transformers/toolkits.ts +183 -3
- package/src/utils/transformers/triggers.ts +2 -2
- package/src/utils/transformers/usage.ts +77 -0
- package/src/utils/transformers/webhooks.ts +139 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "WebhookEndpoints"
|
|
3
|
+
description: "`composio.webhooks.endpoints` — inbound webhook endpoints. Each endpoint is the ingress URL Composio exposes for one toolkit + OAuth app pair, which you register with the third-party provider so it can push events to Composio."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.webhookEndpoints` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.webhookEndpoints.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### create()
|
|
18
|
+
|
|
19
|
+
Create a webhook endpoint for a toolkit + OAuth app pair. Returns the
|
|
20
|
+
existing endpoint when one already exists for that pair.
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
async create(params: { clientId: string; toolkitSlug: string }, requestOptions?: ComposioRequestOptions): Promise<...>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Parameters**
|
|
27
|
+
|
|
28
|
+
| Name | Type | Description |
|
|
29
|
+
|------|------|-------------|
|
|
30
|
+
| `params` | `\{ clientId: string; toolkitSlug: string \}` | `toolkitSlug` and `clientId` |
|
|
31
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
32
|
+
|
|
33
|
+
**Returns**
|
|
34
|
+
|
|
35
|
+
`Promise<...>` — The endpoint; register `webhookUrl` with the provider
|
|
36
|
+
|
|
37
|
+
**Example**
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
const endpoint = await composio.webhooks.endpoints.create({
|
|
41
|
+
toolkitSlug: 'slack',
|
|
42
|
+
clientId: 'my-slack-app-client-id',
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### get()
|
|
49
|
+
|
|
50
|
+
Retrieve a webhook endpoint by its nano id.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
async get(nanoId: string, requestOptions?: ComposioRequestOptions): Promise<...>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Parameters**
|
|
57
|
+
|
|
58
|
+
| Name | Type | Description |
|
|
59
|
+
|------|------|-------------|
|
|
60
|
+
| `nanoId` | `string` | The endpoint nano id (e.g. `we_abc123`) |
|
|
61
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
62
|
+
|
|
63
|
+
**Returns**
|
|
64
|
+
|
|
65
|
+
`Promise<...>` — The endpoint, with secret setup values masked
|
|
66
|
+
|
|
67
|
+
**Example**
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const endpoint = await composio.webhooks.endpoints.get('we_abc123');
|
|
71
|
+
console.log(endpoint.webhookUrl);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### list()
|
|
77
|
+
|
|
78
|
+
List webhook endpoints, optionally filtered by toolkit.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
async list(query?: { toolkitSlug?: string }, requestOptions?: ComposioRequestOptions): Promise<{ items: { clientId: string | null; id: string; toolkitSlug: string }[] }>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Parameters**
|
|
85
|
+
|
|
86
|
+
| Name | Type | Description |
|
|
87
|
+
|------|------|-------------|
|
|
88
|
+
| `query?` | `\{ toolkitSlug?: string \}` | Optional `toolkitSlug` filter |
|
|
89
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
90
|
+
|
|
91
|
+
**Returns**
|
|
92
|
+
|
|
93
|
+
`Promise<\{ items: \{ clientId: string \| null; id: string; toolkitSlug: string \}[] \}>` — The endpoints
|
|
94
|
+
|
|
95
|
+
**Example**
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const { items } = await composio.webhooks.endpoints.list({ toolkitSlug: 'slack' });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### replace()
|
|
104
|
+
|
|
105
|
+
Replace the setup fields of a webhook endpoint. All required setup fields
|
|
106
|
+
for the toolkit must be provided — this is the initial configuration.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
async replace(nanoId: string, params: { data: Record<string, string> }, requestOptions?: ComposioRequestOptions): Promise<...>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Parameters**
|
|
113
|
+
|
|
114
|
+
| Name | Type | Description |
|
|
115
|
+
|------|------|-------------|
|
|
116
|
+
| `nanoId` | `string` | The endpoint nano id |
|
|
117
|
+
| `params` | `\{ data: Record<string, string> \}` | `data` with every required setup field |
|
|
118
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
119
|
+
|
|
120
|
+
**Returns**
|
|
121
|
+
|
|
122
|
+
`Promise<...>` — The configured endpoint
|
|
123
|
+
|
|
124
|
+
**Example**
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
await composio.webhooks.endpoints.replace('we_abc123', {
|
|
128
|
+
data: { signing_secret: process.env.SLACK_SIGNING_SECRET! },
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### update()
|
|
135
|
+
|
|
136
|
+
Merge setup fields into a webhook endpoint. Omitted fields are preserved.
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
async update(nanoId: string, params: { data: Record<string, string> }, requestOptions?: ComposioRequestOptions): Promise<...>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Parameters**
|
|
143
|
+
|
|
144
|
+
| Name | Type | Description |
|
|
145
|
+
|------|------|-------------|
|
|
146
|
+
| `nanoId` | `string` | The endpoint nano id |
|
|
147
|
+
| `params` | `\{ data: Record<string, string> \}` | `data` with the fields to change |
|
|
148
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
149
|
+
|
|
150
|
+
**Returns**
|
|
151
|
+
|
|
152
|
+
`Promise<...>` — The updated endpoint
|
|
153
|
+
|
|
154
|
+
**Example**
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
await composio.webhooks.endpoints.update('we_abc123', {
|
|
158
|
+
data: { signing_secret: 'rotated-secret' },
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "WebhookSubscriptions"
|
|
3
|
+
description: "`composio.webhooks.subscriptions` — the project's outbound webhook subscription. The API allows one subscription per project; every response includes the signing `secret` used to verify deliveries with `composio.triggers.verifyWebhook()` / `composio.triggers.parse()`."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.webhookSubscriptions` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.webhookSubscriptions.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### delete()
|
|
18
|
+
|
|
19
|
+
Delete a webhook subscription. Deliveries stop immediately.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<{ success: boolean }>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Parameters**
|
|
26
|
+
|
|
27
|
+
| Name | Type | Description |
|
|
28
|
+
|------|------|-------------|
|
|
29
|
+
| `id` | `string` | The subscription id |
|
|
30
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
31
|
+
|
|
32
|
+
**Returns**
|
|
33
|
+
|
|
34
|
+
`Promise<\{ success: boolean \}>` — `\{ success \}`
|
|
35
|
+
|
|
36
|
+
**Example**
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
await composio.webhooks.subscriptions.delete('whs_abc123');
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### get()
|
|
45
|
+
|
|
46
|
+
Retrieve a webhook subscription by id.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
async get(id: string, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Parameters**
|
|
53
|
+
|
|
54
|
+
| Name | Type | Description |
|
|
55
|
+
|------|------|-------------|
|
|
56
|
+
| `id` | `string` | The subscription id |
|
|
57
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
58
|
+
|
|
59
|
+
**Returns**
|
|
60
|
+
|
|
61
|
+
`Promise<WebhookSubscription>` — The subscription, including its signing secret
|
|
62
|
+
|
|
63
|
+
**Example**
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const subscription = await composio.webhooks.subscriptions.get('whs_abc123');
|
|
67
|
+
console.log(subscription.enabledEvents);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### list()
|
|
73
|
+
|
|
74
|
+
List the project's webhook subscriptions.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
async list(query?: { cursor?: string; limit?: number }, requestOptions?: ComposioRequestOptions): Promise<{ currentPage: number; items: { createdAt?: string; enabledEvents: string[]; id: string; secret?: string; updatedAt?: string; version: 'V1' | 'V2' | 'V3'; webhookUrl: string }[]; nextCursor: string | null; totalItems: number; totalPages: number }>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Parameters**
|
|
81
|
+
|
|
82
|
+
| Name | Type | Description |
|
|
83
|
+
|------|------|-------------|
|
|
84
|
+
| `query?` | `\{ cursor?: string; limit?: number \}` | Pagination options |
|
|
85
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
86
|
+
|
|
87
|
+
**Returns**
|
|
88
|
+
|
|
89
|
+
`Promise<\{ currentPage: number; items: \{ createdAt?: string; enabledEvents: string[]; id: string; secret?: string; updatedAt?: string; version: 'V1' \| 'V2' \| 'V3'; webhookUrl: string \}[]; nextCursor: string \| null; totalItems: number; totalPages: number \}>` — Paginated subscriptions
|
|
90
|
+
|
|
91
|
+
**Example**
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
const { items } = await composio.webhooks.subscriptions.list();
|
|
95
|
+
console.log(items[0]?.webhookUrl);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### listEventTypes()
|
|
101
|
+
|
|
102
|
+
List the event types a subscription can enable, with the payload
|
|
103
|
+
versions each one supports.
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
async listEventTypes(requestOptions?: ComposioRequestOptions): Promise<{ items: { description: string; eventType: string; supportedVersions: ... | ... | ...[] }[] }>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Parameters**
|
|
110
|
+
|
|
111
|
+
| Name | Type |
|
|
112
|
+
|------|------|
|
|
113
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
114
|
+
|
|
115
|
+
**Returns**
|
|
116
|
+
|
|
117
|
+
`Promise<\{ items: \{ description: string; eventType: string; supportedVersions: ... \| ... \| ...[] \}[] \}>` — The available event types
|
|
118
|
+
|
|
119
|
+
**Example**
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
const { items } = await composio.webhooks.subscriptions.listEventTypes();
|
|
123
|
+
console.log(items.map(item => item.eventType));
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### rotateSecret()
|
|
129
|
+
|
|
130
|
+
Rotate the signing secret of a webhook subscription. The previous secret
|
|
131
|
+
stops validating, so update your verifier with the returned `secret`.
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
async rotateSecret(id: string, requestOptions?: ComposioRequestOptions): Promise<{ id: string; secret: string }>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Parameters**
|
|
138
|
+
|
|
139
|
+
| Name | Type | Description |
|
|
140
|
+
|------|------|-------------|
|
|
141
|
+
| `id` | `string` | The subscription id |
|
|
142
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
143
|
+
|
|
144
|
+
**Returns**
|
|
145
|
+
|
|
146
|
+
`Promise<\{ id: string; secret: string \}>` — `\{ id, secret \}`
|
|
147
|
+
|
|
148
|
+
**Example**
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const { secret } = await composio.webhooks.subscriptions.rotateSecret('whs_abc123');
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### set()
|
|
157
|
+
|
|
158
|
+
Create or update the project webhook subscription.
|
|
159
|
+
|
|
160
|
+
If a subscription already exists it is updated in place, otherwise a new
|
|
161
|
+
one is created. By default this subscribes to V3 trigger message events.
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
async set(params: { enabledEvents?: string[]; version?: 'V1' | 'V2' | 'V3'; webhookUrl: string }, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Parameters**
|
|
168
|
+
|
|
169
|
+
| Name | Type | Description |
|
|
170
|
+
|------|------|-------------|
|
|
171
|
+
| `params` | `\{ enabledEvents?: string[]; version?: 'V1' \| 'V2' \| 'V3'; webhookUrl: string \}` | `webhookUrl`, optional `enabledEvents` and `version` |
|
|
172
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
173
|
+
|
|
174
|
+
**Returns**
|
|
175
|
+
|
|
176
|
+
`Promise<WebhookSubscription>` — The resulting subscription
|
|
177
|
+
|
|
178
|
+
**Example**
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
const subscription = await composio.webhooks.subscriptions.set({
|
|
182
|
+
webhookUrl: `${APP_URL}/webhooks/composio`,
|
|
183
|
+
enabledEvents: ['composio.trigger.message', 'composio.connected_account.expired'],
|
|
184
|
+
});
|
|
185
|
+
process.env.COMPOSIO_WEBHOOK_SECRET = subscription.secret;
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### update()
|
|
191
|
+
|
|
192
|
+
Update an existing webhook subscription. Only the provided fields change.
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
async update(id: string, params: { enabledEvents?: string[]; version?: 'V1' | 'V2' | 'V3'; webhookUrl?: string }, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Parameters**
|
|
199
|
+
|
|
200
|
+
| Name | Type | Description |
|
|
201
|
+
|------|------|-------------|
|
|
202
|
+
| `id` | `string` | The subscription id |
|
|
203
|
+
| `params` | `\{ enabledEvents?: string[]; version?: 'V1' \| 'V2' \| 'V3'; webhookUrl?: string \}` | Fields to update |
|
|
204
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
205
|
+
|
|
206
|
+
**Returns**
|
|
207
|
+
|
|
208
|
+
`Promise<WebhookSubscription>` — The updated subscription
|
|
209
|
+
|
|
210
|
+
**Example**
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
await composio.webhooks.subscriptions.update('whs_abc123', {
|
|
214
|
+
enabledEvents: ['composio.trigger.message'],
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Webhooks"
|
|
3
|
+
description: "`composio.webhooks` namespace. - `subscriptions`: the project's outbound webhook subscription (where Composio delivers trigger and lifecycle events). - `endpoints`: inbound ingress URLs for third-party providers, one per toolkit + OAuth app pair."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.webhooks` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.webhooks.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
| Name | Type | Description |
|
|
18
|
+
|------|------|-------------|
|
|
19
|
+
| `endpoints` | `WebhookEndpoints` | Manage inbound webhook endpoints per toolkit + OAuth app. |
|
|
20
|
+
| `subscriptions` | `WebhookSubscriptions` | Manage the project's outbound webhook subscription. |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as ComposioError$1 } from "./SsrfErrors-
|
|
2
|
-
import "./FileModifierErrors-
|
|
1
|
+
import { r as ComposioError$1 } from "./SsrfErrors-DiQldIdC.mjs";
|
|
2
|
+
import "./FileModifierErrors-CdGSABoq.mjs";
|
|
3
3
|
import { APIError, APIUserAbortError } from "@composio/client";
|
|
4
4
|
import { ZodError } from "zod/v3";
|
|
5
5
|
|
|
@@ -29,7 +29,9 @@ const ConnectedAccountErrorCodes = {
|
|
|
29
29
|
LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED: "LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED",
|
|
30
30
|
SHARED_ACCESS_DENIED: "SHARED_ACCESS_DENIED",
|
|
31
31
|
ACL_ONLY_FOR_SHARED: "ACL_ONLY_FOR_SHARED",
|
|
32
|
-
SHARED_CONNECTION_NOT_ACCESSIBLE: "SHARED_CONNECTION_NOT_ACCESSIBLE"
|
|
32
|
+
SHARED_CONNECTION_NOT_ACCESSIBLE: "SHARED_CONNECTION_NOT_ACCESSIBLE",
|
|
33
|
+
REVOCATION_NOT_SUPPORTED: "CONNECTED_ACCOUNT_REVOCATION_NOT_SUPPORTED",
|
|
34
|
+
NOT_REVOKABLE: "CONNECTED_ACCOUNT_NOT_REVOKABLE"
|
|
33
35
|
};
|
|
34
36
|
var ComposioConnectedAccountNotFoundError = class extends ComposioError$1 {
|
|
35
37
|
constructor(message = "Connected account not found", options = {}) {
|
|
@@ -137,6 +139,39 @@ var ComposioLegacyConnectedAccountsEndpointRetiredError = class extends Composio
|
|
|
137
139
|
this.name = "ComposioLegacyConnectedAccountsEndpointRetiredError";
|
|
138
140
|
}
|
|
139
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* Thrown by `composio.connectedAccounts.revoke()` when the toolkit behind the
|
|
144
|
+
* connection does not support programmatic revocation at the provider (API
|
|
145
|
+
* 400).
|
|
146
|
+
*/
|
|
147
|
+
var ComposioConnectedAccountRevocationNotSupportedError = class extends ComposioError$1 {
|
|
148
|
+
constructor(message = "This toolkit does not support programmatic revocation of connected accounts", options = {}) {
|
|
149
|
+
super(message, {
|
|
150
|
+
...options,
|
|
151
|
+
code: ConnectedAccountErrorCodes.REVOCATION_NOT_SUPPORTED,
|
|
152
|
+
statusCode: 400,
|
|
153
|
+
possibleFixes: options.possibleFixes || ["Revoke the grant from the provider's own settings page, then disable or delete the connected account with composio.connectedAccounts.disable() / delete()."]
|
|
154
|
+
});
|
|
155
|
+
this.name = "ComposioConnectedAccountRevocationNotSupportedError";
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Thrown by `composio.connectedAccounts.revoke()` when the connection is not
|
|
160
|
+
* in a state that can be revoked (API 409), for example it never completed
|
|
161
|
+
* authentication. Revoking an already revoked connection is not an error: it
|
|
162
|
+
* returns an empty `revokedTokens` list.
|
|
163
|
+
*/
|
|
164
|
+
var ComposioConnectedAccountNotRevokableError = class extends ComposioError$1 {
|
|
165
|
+
constructor(message = "The connected account is not in a revokable state", options = {}) {
|
|
166
|
+
super(message, {
|
|
167
|
+
...options,
|
|
168
|
+
code: ConnectedAccountErrorCodes.NOT_REVOKABLE,
|
|
169
|
+
statusCode: 409,
|
|
170
|
+
possibleFixes: options.possibleFixes || ["Check the connection status with composio.connectedAccounts.get(); only ACTIVE connections can be revoked."]
|
|
171
|
+
});
|
|
172
|
+
this.name = "ComposioConnectedAccountNotRevokableError";
|
|
173
|
+
}
|
|
174
|
+
};
|
|
140
175
|
|
|
141
176
|
//#endregion
|
|
142
177
|
//#region src/errors/ConnectionRequestErrors.ts
|
|
@@ -168,6 +203,7 @@ var ConnectionRequestFailedError = class extends ComposioError$1 {
|
|
|
168
203
|
const ToolErrorCodes = {
|
|
169
204
|
TOOLSET_NOT_DEFINED: "TOOLSET_NOT_DEFINED",
|
|
170
205
|
TOOL_NOT_FOUND: "TOOL_NOT_FOUND",
|
|
206
|
+
TOOL_FETCH_ERROR: "TOOL_FETCH_ERROR",
|
|
171
207
|
INVALID_MODIFIER: "INVALID_MODIFIER",
|
|
172
208
|
TOOL_EXECUTION_ERROR: "TOOL_EXECUTION_ERROR",
|
|
173
209
|
INVALID_TOOL_ARGUMENTS: "INVALID_TOOL_ARGUMENTS",
|
|
@@ -195,6 +231,25 @@ var ComposioToolNotFoundError = class extends ComposioError$1 {
|
|
|
195
231
|
this.name = "ComposioToolNotFoundError";
|
|
196
232
|
}
|
|
197
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Error thrown when a tool schema could not be fetched for a reason other than
|
|
236
|
+
* the tool not existing (for example an invalid API key, a server error, or a
|
|
237
|
+
* network failure). The underlying client error is preserved as `cause`.
|
|
238
|
+
*/
|
|
239
|
+
var ComposioToolFetchError = class extends ComposioError$1 {
|
|
240
|
+
constructor(message = "Failed to fetch tool", options = {}) {
|
|
241
|
+
super(message, {
|
|
242
|
+
...options,
|
|
243
|
+
code: ToolErrorCodes.TOOL_FETCH_ERROR,
|
|
244
|
+
possibleFixes: options.possibleFixes || [
|
|
245
|
+
"Ensure the tool slug is valid",
|
|
246
|
+
"Ensure you are using the correct API key",
|
|
247
|
+
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
this.name = "ComposioToolFetchError";
|
|
251
|
+
}
|
|
252
|
+
};
|
|
198
253
|
var ComposioInvalidModifierError = class extends ComposioError$1 {
|
|
199
254
|
constructor(message = "Invalid modifier", options = {}) {
|
|
200
255
|
super(message, {
|
|
@@ -435,6 +490,8 @@ var JsonSchemaRefResolutionError = class extends ComposioError$1 {
|
|
|
435
490
|
//#region src/errors/SDKErrors.ts
|
|
436
491
|
const SDKErrorCodes = {
|
|
437
492
|
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED",
|
|
493
|
+
API_KEY_KIND_MISMATCH: "API_KEY_KIND_MISMATCH",
|
|
494
|
+
SCOPE_CONFIG_INVALID: "SCOPE_CONFIG_INVALID",
|
|
438
495
|
REQUEST_CANCELLED: "REQUEST_CANCELLED"
|
|
439
496
|
};
|
|
440
497
|
var ComposioNoAPIKeyError = class extends ComposioError$1 {
|
|
@@ -455,6 +512,43 @@ var ComposioNoAPIKeyError = class extends ComposioError$1 {
|
|
|
455
512
|
}
|
|
456
513
|
};
|
|
457
514
|
/**
|
|
515
|
+
* Thrown when the organization/project scope of an SDK instance is
|
|
516
|
+
* inconsistent: only one of `orgId` / `projectId` was supplied, or a scope
|
|
517
|
+
* option disagrees with the same header placed in `defaultHeaders`.
|
|
518
|
+
*/
|
|
519
|
+
var ComposioScopeConfigError = class extends ComposioError$1 {
|
|
520
|
+
constructor(message = "Invalid organization/project scope configuration", options = {}) {
|
|
521
|
+
super(message, {
|
|
522
|
+
...options,
|
|
523
|
+
code: SDKErrorCodes.SCOPE_CONFIG_INVALID,
|
|
524
|
+
possibleFixes: options.possibleFixes || ["Pass both `orgId` and `projectId` (the organization and consumer project nano IDs), or neither", "Supply the scope through the options or through the `x-org-id` / `x-project-id` default headers, not both with different values"]
|
|
525
|
+
});
|
|
526
|
+
this.name = "ComposioScopeConfigError";
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Thrown when the only API key the SDK could find is a Composio user key
|
|
531
|
+
* (`uak_...`, as stored by `composio login`) rather than a project key.
|
|
532
|
+
* User keys authenticate a person, not a project, so the SDK refuses to send
|
|
533
|
+
* one as `x-api-key`. The error never includes the key value.
|
|
534
|
+
*/
|
|
535
|
+
var ComposioAPIKeyKindError = class extends ComposioError$1 {
|
|
536
|
+
constructor(message = "The stored Composio API key is a user API key, not a project API key", options = {}) {
|
|
537
|
+
super(message, {
|
|
538
|
+
...options,
|
|
539
|
+
code: SDKErrorCodes.API_KEY_KIND_MISMATCH,
|
|
540
|
+
cause: options.cause || "The user config file holds a user API key written by the Composio CLI; it cannot authenticate SDK requests as a project",
|
|
541
|
+
possibleFixes: options.possibleFixes || [
|
|
542
|
+
"Pass a project API key via `apiKey` or the COMPOSIO_API_KEY environment variable",
|
|
543
|
+
"Create a project API key in the Composio dashboard at https://platform.composio.dev",
|
|
544
|
+
"To authenticate with the user API key instead, pass `apiKey: null` together with `userApiKey`"
|
|
545
|
+
],
|
|
546
|
+
statusCode: 401
|
|
547
|
+
});
|
|
548
|
+
this.name = "ComposioAPIKeyKindError";
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
458
552
|
* Thrown when an SDK call is cancelled via the caller-supplied `AbortSignal`.
|
|
459
553
|
*
|
|
460
554
|
* @example
|
|
@@ -618,4 +712,49 @@ var RemoteFileDownloadError = class extends ComposioError$1 {
|
|
|
618
712
|
};
|
|
619
713
|
|
|
620
714
|
//#endregion
|
|
621
|
-
|
|
715
|
+
//#region src/errors/ToolRouterErrors.ts
|
|
716
|
+
const ToolRouterErrorCodes = {
|
|
717
|
+
MCP_DESTINATION_REJECTED: "MCP_DESTINATION_REJECTED",
|
|
718
|
+
SESSION_CONFIG_CONFLICT: "SESSION_CONFIG_CONFLICT"
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Thrown when a session's hosted MCP endpoint is not a destination the SDK
|
|
722
|
+
* will hand the session credential to. The SDK only attaches its credential
|
|
723
|
+
* and scope headers when the MCP URL shares the origin of the API base URL
|
|
724
|
+
* the session was created against. The error is raised only when the caller
|
|
725
|
+
* asked for the endpoint with `mcp: true`; otherwise the session is returned
|
|
726
|
+
* with empty `mcp.headers` and a warning is logged instead. The error names
|
|
727
|
+
* both origins and never includes a credential value.
|
|
728
|
+
*/
|
|
729
|
+
var ComposioMCPDestinationError = class extends ComposioError$1 {
|
|
730
|
+
constructor(message = "The session MCP endpoint is not a trusted destination for the session credential", options = {}) {
|
|
731
|
+
super(message, {
|
|
732
|
+
...options,
|
|
733
|
+
code: ToolRouterErrorCodes.MCP_DESTINATION_REJECTED,
|
|
734
|
+
possibleFixes: options.possibleFixes ?? ["Point `baseURL` at the API origin that serves the session MCP endpoint; a custom base URL yields a matching MCP origin"]
|
|
735
|
+
});
|
|
736
|
+
this.name = "ComposioMCPDestinationError";
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
/**
|
|
740
|
+
* Thrown when a session update is rejected with HTTP 409 because the session
|
|
741
|
+
* configuration changed since it was last read: the `expected_config_version`
|
|
742
|
+
* precondition (the session's last observed `configVersion` by default) is
|
|
743
|
+
* stale. The local session object is left as it was before the call.
|
|
744
|
+
* Re-fetch the session with `sessions.use(sessionId)` and retry the update
|
|
745
|
+
* against the fresh `configVersion`.
|
|
746
|
+
*/
|
|
747
|
+
var ComposioSessionConfigConflictError = class extends ComposioError$1 {
|
|
748
|
+
constructor(message = "The session configuration changed since it was last read; re-fetch the session and retry the update", options = {}) {
|
|
749
|
+
super(message, {
|
|
750
|
+
...options,
|
|
751
|
+
code: ToolRouterErrorCodes.SESSION_CONFIG_CONFLICT,
|
|
752
|
+
statusCode: 409,
|
|
753
|
+
possibleFixes: options.possibleFixes ?? ["Re-fetch the session with `composio.sessions.use(sessionId)` to observe the current configVersion, then retry the update", "Pass `expectedConfigVersion: false` to apply the update regardless of concurrent changes (last writer wins)"]
|
|
754
|
+
});
|
|
755
|
+
this.name = "ComposioSessionConfigConflictError";
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
//#endregion
|
|
760
|
+
export { ComposioInvalidToolArgumentsError as A, ConnectionRequestTimeoutError as B, ValidationErrorCodes as C, ComposioGlobalExecuteToolFnNotSetError as D, ToolkitErrorCodes as E, ComposioToolVersionRequiredError as F, ComposioFailedToCreateConnectedAccountLink as G, ComposioConnectedAccountNotFoundError as H, ToolErrorCodes as I, ComposioSharedAccessDeniedError as J, ComposioLegacyConnectedAccountsEndpointRetiredError as K, handleToolExecutionError as L, ComposioToolExecutionError as M, ComposioToolFetchError as N, ComposioInvalidExecuteFunctionError as O, ComposioToolNotFoundError as P, ComposioAuthConfigNotFoundError as Q, ConnectionRequestErrorCodes as R, ValidationError as S, ComposioToolkitNotFoundError as T, ComposioConnectedAccountNotRevokableError as U, ComposioAclOnlyForSharedError as V, ComposioConnectedAccountRevocationNotSupportedError as W, ConnectedAccountErrorCodes as X, ComposioSharedConnectionNotAccessibleError as Y, AuthConfigErrorCodes as Z, ComposioScopeConfigError as _, RemoteFileErrorCodes as a, JsonSchemaRefResolutionError as b, ComposioFailedToSubscribeToPusherChannelError as c, ComposioWebhookPayloadError as d, ComposioWebhookSignatureVerificationError as f, ComposioRequestCancelledError as g, ComposioNoAPIKeyError as h, RemoteFileDownloadError as i, ComposioProviderNotDefinedError as j, ComposioInvalidModifierError as k, ComposioFailedToUnsubscribeFromPusherChannelError as l, ComposioAPIKeyKindError as m, ComposioSessionConfigConflictError as n, ComposioFailedToCreatePusherClientError as o, TriggerErrorCodes as p, ComposioMultipleConnectedAccountsError as q, ToolRouterErrorCodes as r, ComposioFailedToGetSDKRealtimeCredentialsError as s, ComposioMCPDestinationError as t, ComposioTriggerTypeNotFoundError as u, SDKErrorCodes as v, ComposioToolkitFetchError as w, JsonSchemaToZodError as x, isRequestAbortError as y, ConnectionRequestFailedError as z };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-
|
|
2
|
-
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-
|
|
1
|
+
import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-C436M_D0.mjs";
|
|
2
|
+
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-B3m-188G.mjs";
|
|
3
3
|
export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-
|
|
1
|
+
import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-fYEFjSLM.mjs";
|
|
2
2
|
|
|
3
3
|
export { createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-
|
|
3
|
-
import {
|
|
4
|
-
import { r as ssrfSafeFetch } from "./ssrfGuard.node-
|
|
1
|
+
import { i as logger, o as COMPOSIO_DIR, u as TEMP_FILES_DIRECTORY_NAME } from "./SsrfErrors-DiQldIdC.mjs";
|
|
2
|
+
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-CdGSABoq.mjs";
|
|
3
|
+
import { a as readResponseBodyWithLimit, c as uint8ArrayToBase64, l as getRandomShortId, n as assertSafeFileUploadPath, s as base64ToUint8Array } from "./sensitiveFileUploadPaths-BlLp-Yo2.mjs";
|
|
4
|
+
import { r as ssrfSafeFetch } from "./ssrfGuard.node-BZ270bcu.mjs";
|
|
5
5
|
import { platform } from "#platform";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
@@ -302,8 +302,10 @@ const readFile = async (file, signal) => {
|
|
|
302
302
|
content: uint8ArrayToBase64(new Uint8Array(content)),
|
|
303
303
|
mimeType: file.type
|
|
304
304
|
};
|
|
305
|
-
} else if (typeof file === "string")
|
|
306
|
-
|
|
305
|
+
} else if (typeof file === "string") {
|
|
306
|
+
if (isHttpUrl(file)) return await readFileContentFromURL(file, signal);
|
|
307
|
+
else return await readFileContent(file);
|
|
308
|
+
}
|
|
307
309
|
throw new Error("Invalid file type");
|
|
308
310
|
};
|
|
309
311
|
const getFileDataAfterUploadingToS3 = async (file, { toolSlug, toolkitSlug, client, sensitiveFileUploadProtection, fileUploadPathDenySegments, fileUploadAllowlist, signal }) => {
|