@composio/core 0.31.0 → 0.33.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-9Vlb4XaS.mjs → CustomTool-B4dQn2M5.mjs} +1 -1
- package/dist/{CustomTool-Ds5aLDth.d.mts → CustomTool-C2kvAvzk.d.mts} +1 -1
- package/dist/{FileModifierErrors-WrqokuIF.mjs → FileModifierErrors-D-AKc3ds.mjs} +1 -1
- package/dist/{SsrfErrors-BSVMW915.mjs → SsrfErrors-BekZPeWY.mjs} +59 -12
- package/dist/{Telemetry-a7SOQXcg.mjs → Telemetry-CcCuFVUb.mjs} +2 -2
- package/dist/composio-BqE615oV.d.mts +20365 -0
- package/dist/{customTool.types-DHxXBU6E.d.mts → customTool.types-DnyEZmlx.d.mts} +510 -33
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +20 -12
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +28 -10
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +96 -40
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +8 -6
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +4 -3
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +4 -2
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +6 -3
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +53 -42
- package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +5 -14
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +7 -5
- package/dist/docs/reference/sdk-reference/typescript/session-webhooks.mdx +64 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +16 -16
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +36 -8
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +14 -11
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +16 -18
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +42 -30
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +6 -4
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +9 -7
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +13 -9
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +3 -1
- package/dist/{errors-xC13uvaA.mjs → errors-CtIKA9BH.mjs} +2 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-CAwIbWYH.mjs → fileUtils.node-DPMtE0ER.mjs} +7 -71
- package/dist/index.d.mts +7 -245
- package/dist/index.mjs +573 -251
- package/dist/jsonSchema-CDHLYm7d.d.mts +237 -0
- package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-CfZwBS13.mjs} +7 -3
- package/dist/models/Files.node.mjs +3 -3
- package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-6NcnFSyX.mjs} +82 -85
- package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
- package/dist/{types-DcdZy5Nc.d.mts → types-Cwr_Makk.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/json-schema.d.mts +2 -1
- package/dist/utils/json-schema.mjs +2 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.mjs +1 -1
- package/package.json +6 -6
- package/src/composio.ts +26 -7
- package/src/errors/ComposioError.ts +3 -2
- package/src/index.ts +19 -0
- package/src/lib/toolRouterParams.ts +38 -14
- package/src/models/AuthConfigs.ts +10 -3
- package/src/models/ConnectedAccounts.ts +101 -28
- package/src/models/CustomTool.ts +0 -10
- package/src/models/Keyring.ts +2 -1
- package/src/models/MCP.ts +43 -35
- package/src/models/SessionWebhooks.ts +136 -0
- package/src/models/ToolRouter.ts +39 -4
- package/src/models/ToolRouterSession.ts +2 -2
- package/src/models/ToolRouterSessionFileMount.ts +3 -1
- package/src/models/Toolkits.ts +1 -0
- package/src/models/Tools.ts +4 -8
- package/src/models/Triggers.ts +48 -213
- package/src/models/Webhooks.ts +2 -0
- package/src/provider/ComposioProvider.ts +0 -1
- package/src/telemetry/BatchProcessor.ts +1 -1
- package/src/telemetry/Telemetry.ts +1 -1
- package/src/types/connectedAccountAuthStates.types.ts +0 -1
- package/src/types/connectedAccounts.types.ts +59 -1
- package/src/types/provider.types.ts +0 -1
- package/src/types/sessionWebhooks.types.ts +292 -0
- package/src/types/toolRouter.types.ts +35 -5
- package/src/types/triggers.types.ts +4 -0
- package/src/utils/crypto.ts +6 -5
- package/src/utils/env.ts +2 -5
- package/src/utils/fileUtils.node.ts +5 -86
- package/src/utils/json-schema.ts +6 -0
- package/src/utils/jsonSchema.ts +17 -4
- package/src/utils/logger.ts +19 -9
- package/src/utils/mime.ts +25 -385
- package/src/utils/mimeTables.generated.ts +356 -0
- package/src/utils/pusher.ts +5 -2
- package/src/utils/readResponseBody.ts +30 -17
- package/src/utils/transformers/authConfigs.ts +0 -1
- package/src/utils/userCallback.ts +3 -1
- package/src/utils/webhookVerification.ts +211 -0
- package/dist/composio-Ba89XGHL.d.mts +0 -9736
|
@@ -5,11 +5,13 @@ description: "`composio.webhooks.subscriptions` — the project's outbound webho
|
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
|
-
Access this class through the `composio.
|
|
8
|
+
Access this class through the `composio.webhooks.subscriptions` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const subscriptions = composio.webhooks.subscriptions;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -18,7 +20,7 @@ const result = await composio.webhookSubscriptions.list();
|
|
|
18
20
|
|
|
19
21
|
Delete a webhook subscription. Deliveries stop immediately.
|
|
20
22
|
|
|
21
|
-
```typescript
|
|
23
|
+
```typescript signature
|
|
22
24
|
async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscriptionDeleteResponse>
|
|
23
25
|
```
|
|
24
26
|
|
|
@@ -45,7 +47,7 @@ await composio.webhooks.subscriptions.delete('whs_abc123');
|
|
|
45
47
|
|
|
46
48
|
Retrieve a webhook subscription by id.
|
|
47
49
|
|
|
48
|
-
```typescript
|
|
50
|
+
```typescript signature
|
|
49
51
|
async get(id: string, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
|
|
50
52
|
```
|
|
51
53
|
|
|
@@ -73,7 +75,7 @@ console.log(subscription.enabledEvents);
|
|
|
73
75
|
|
|
74
76
|
List the project's webhook subscriptions.
|
|
75
77
|
|
|
76
|
-
```typescript
|
|
78
|
+
```typescript signature
|
|
77
79
|
async list(query?: WebhookSubscriptionListParams, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscriptionListResponse>
|
|
78
80
|
```
|
|
79
81
|
|
|
@@ -102,7 +104,7 @@ console.log(items[0]?.webhookUrl);
|
|
|
102
104
|
List the event types a subscription can enable, with the payload
|
|
103
105
|
versions each one supports.
|
|
104
106
|
|
|
105
|
-
```typescript
|
|
107
|
+
```typescript signature
|
|
106
108
|
async listEventTypes(requestOptions?: ComposioRequestOptions): Promise<WebhookSubscriptionEventTypesResponse>
|
|
107
109
|
```
|
|
108
110
|
|
|
@@ -130,7 +132,7 @@ console.log(items.map(item => item.eventType));
|
|
|
130
132
|
Rotate the signing secret of a webhook subscription. The previous secret
|
|
131
133
|
stops validating, so update your verifier with the returned `secret`.
|
|
132
134
|
|
|
133
|
-
```typescript
|
|
135
|
+
```typescript signature
|
|
134
136
|
async rotateSecret(id: string, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscriptionRotateSecretResponse>
|
|
135
137
|
```
|
|
136
138
|
|
|
@@ -160,7 +162,7 @@ Create or update the project webhook subscription.
|
|
|
160
162
|
If a subscription already exists it is updated in place, otherwise a new
|
|
161
163
|
one is created. By default this subscribes to V3 trigger message events.
|
|
162
164
|
|
|
163
|
-
```typescript
|
|
165
|
+
```typescript signature
|
|
164
166
|
async set(params: WebhookSubscriptionSetParams, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
|
|
165
167
|
```
|
|
166
168
|
|
|
@@ -178,6 +180,8 @@ async set(params: WebhookSubscriptionSetParams, requestOptions?: ComposioRequest
|
|
|
178
180
|
**Example**
|
|
179
181
|
|
|
180
182
|
```typescript
|
|
183
|
+
const APP_URL = 'https://your-app.com';
|
|
184
|
+
|
|
181
185
|
const subscription = await composio.webhooks.subscriptions.set({
|
|
182
186
|
webhookUrl: `${APP_URL}/webhooks/composio`,
|
|
183
187
|
enabledEvents: ['composio.trigger.message', 'composio.connected_account.expired'],
|
|
@@ -191,7 +195,7 @@ process.env.COMPOSIO_WEBHOOK_SECRET = subscription.secret;
|
|
|
191
195
|
|
|
192
196
|
Update an existing webhook subscription. Only the provided fields change.
|
|
193
197
|
|
|
194
|
-
```typescript
|
|
198
|
+
```typescript signature
|
|
195
199
|
async update(id: string, params: WebhookSubscriptionUpdateParams, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
|
|
196
200
|
```
|
|
197
201
|
|
|
@@ -8,8 +8,10 @@ description: "`composio.webhooks` namespace. - `subscriptions`: the project's o
|
|
|
8
8
|
Access this class through the `composio.webhooks` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const webhooks = composio.webhooks;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Properties
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as sanitizeApiErrorText, i as apiErrorSuggestedFixes, o as withApiErrorMessage, r as ComposioError$1 } from "./SsrfErrors-
|
|
2
|
-
import "./FileModifierErrors-
|
|
1
|
+
import { a as sanitizeApiErrorText, i as apiErrorSuggestedFixes, o as withApiErrorMessage, r as ComposioError$1 } from "./SsrfErrors-BekZPeWY.mjs";
|
|
2
|
+
import "./FileModifierErrors-D-AKc3ds.mjs";
|
|
3
3
|
import { APIError } from "@composio/client";
|
|
4
4
|
import { ZodError } from "zod/v3";
|
|
5
5
|
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* `@composio/experimental` package, on the `@composio/experimental/workbench`
|
|
13
13
|
* subpath — they are no longer part of `@composio/core`.
|
|
14
14
|
*/
|
|
15
|
-
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-
|
|
16
|
-
import { C as LocalToolExecuteFn, S as LocalTool, a as CreateCustomToolkitParams, c as CustomTool, k as SessionContext, m as CustomToolkit, o as CreateLocalToolParams, r as CreateCustomToolParams, s as CreateLocalToolkitParams, u as CustomToolExecuteFn, w as LocalToolkit } from "../customTool.types-
|
|
15
|
+
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-C2kvAvzk.mjs";
|
|
16
|
+
import { C as LocalToolExecuteFn, S as LocalTool, a as CreateCustomToolkitParams, c as CustomTool, k as SessionContext, m as CustomToolkit, o as CreateLocalToolParams, r as CreateCustomToolParams, s as CreateLocalToolkitParams, u as CustomToolExecuteFn, w as LocalToolkit } from "../customTool.types-DnyEZmlx.mjs";
|
|
17
17
|
export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CreateLocalToolParams, type CreateLocalToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type LocalTool, type LocalToolExecuteFn, type LocalToolkit, 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-B4dQn2M5.mjs";
|
|
2
2
|
|
|
3
3
|
export { createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as getMimeTypeFromFileName,
|
|
3
|
-
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-
|
|
4
|
-
import { r as ssrfSafeFetch } from "./ssrfGuard.node-
|
|
1
|
+
import { d as COMPOSIO_DIR, h as TEMP_FILES_DIRECTORY_NAME, l as logger, s as describeThrown } from "./SsrfErrors-BekZPeWY.mjs";
|
|
2
|
+
import { a as getMimeTypeFromFileName, d as base64ToUint8Array, f as uint8ArrayToBase64, i as getExtensionFromMimeType, l as readResponseBodyWithLimit, m as getRandomShortId, n as assertSafeFileUploadPath } from "./sensitiveFileUploadPaths-6NcnFSyX.mjs";
|
|
3
|
+
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-D-AKc3ds.mjs";
|
|
4
|
+
import { r as ssrfSafeFetch } from "./ssrfGuard.node-B749ae5Q.mjs";
|
|
5
5
|
import { platform } from "#platform";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
@@ -170,70 +170,6 @@ const isHttpUrl = (value) => {
|
|
|
170
170
|
return false;
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
const getExtensionFromMimeType = (mimeType) => {
|
|
174
|
-
const mimeToExt = {
|
|
175
|
-
"text/plain": "txt",
|
|
176
|
-
"text/html": "html",
|
|
177
|
-
"text/css": "css",
|
|
178
|
-
"text/csv": "csv",
|
|
179
|
-
"text/javascript": "js",
|
|
180
|
-
"application/json": "json",
|
|
181
|
-
"application/xml": "xml",
|
|
182
|
-
"application/pdf": "pdf",
|
|
183
|
-
"application/zip": "zip",
|
|
184
|
-
"application/x-zip-compressed": "zip",
|
|
185
|
-
"application/gzip": "gz",
|
|
186
|
-
"application/x-tar": "tar",
|
|
187
|
-
"application/msword": "doc",
|
|
188
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
189
|
-
"application/vnd.ms-excel": "xls",
|
|
190
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
191
|
-
"application/vnd.ms-powerpoint": "ppt",
|
|
192
|
-
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
193
|
-
"image/jpeg": "jpg",
|
|
194
|
-
"image/jpg": "jpg",
|
|
195
|
-
"image/png": "png",
|
|
196
|
-
"image/gif": "gif",
|
|
197
|
-
"image/svg+xml": "svg",
|
|
198
|
-
"image/webp": "webp",
|
|
199
|
-
"image/bmp": "bmp",
|
|
200
|
-
"image/tiff": "tiff",
|
|
201
|
-
"audio/mpeg": "mp3",
|
|
202
|
-
"audio/wav": "wav",
|
|
203
|
-
"audio/ogg": "ogg",
|
|
204
|
-
"video/mp4": "mp4",
|
|
205
|
-
"video/mpeg": "mpeg",
|
|
206
|
-
"video/quicktime": "mov",
|
|
207
|
-
"video/x-msvideo": "avi",
|
|
208
|
-
"video/webm": "webm"
|
|
209
|
-
};
|
|
210
|
-
const cleanMimeType = mimeType.split(";")[0].toLowerCase().trim();
|
|
211
|
-
if (Object.hasOwn(mimeToExt, cleanMimeType)) return mimeToExt[cleanMimeType];
|
|
212
|
-
const parts = cleanMimeType.split("/");
|
|
213
|
-
if (parts.length === 2) {
|
|
214
|
-
const cleanSubtype = parts[1].toLowerCase();
|
|
215
|
-
if (cleanSubtype.includes("+")) {
|
|
216
|
-
const plusParts = cleanSubtype.split("+");
|
|
217
|
-
const prefix = plusParts[0];
|
|
218
|
-
const suffix = plusParts[plusParts.length - 1];
|
|
219
|
-
if ([
|
|
220
|
-
"svg",
|
|
221
|
-
"atom",
|
|
222
|
-
"rss"
|
|
223
|
-
].includes(prefix)) return prefix;
|
|
224
|
-
if ([
|
|
225
|
-
"json",
|
|
226
|
-
"xml",
|
|
227
|
-
"yaml",
|
|
228
|
-
"zip",
|
|
229
|
-
"gzip"
|
|
230
|
-
].includes(suffix)) return suffix;
|
|
231
|
-
return suffix;
|
|
232
|
-
}
|
|
233
|
-
return cleanSubtype || "txt";
|
|
234
|
-
}
|
|
235
|
-
return "txt";
|
|
236
|
-
};
|
|
237
173
|
const generateTimestampedFilename = (extension, prefix) => {
|
|
238
174
|
return `${prefix || "file_ts"}${Date.now()}${getRandomShortId()}.${extension}`;
|
|
239
175
|
};
|
|
@@ -247,7 +183,7 @@ const readFileContent = async (filePath) => {
|
|
|
247
183
|
mimeType: getMimeTypeFromFileName(filePath)
|
|
248
184
|
};
|
|
249
185
|
} catch (error) {
|
|
250
|
-
throw new Error(`Error reading file at ${filePath}: ${error}`);
|
|
186
|
+
throw new Error(`Error reading file at ${filePath}: ${describeThrown(error)}`);
|
|
251
187
|
}
|
|
252
188
|
};
|
|
253
189
|
const readFileContentFromURL = async (path, signal) => {
|
|
@@ -399,7 +335,7 @@ const saveFile = (file, content, options = {}) => {
|
|
|
399
335
|
if (!platform.existsSync(absDir)) platform.mkdirSync(absDir);
|
|
400
336
|
composioFilesDir = absDir;
|
|
401
337
|
} catch (err) {
|
|
402
|
-
logger.warn(`fileDownloadDir "${absDir}" is not writable, falling back to the default (~/.composio/files). Error: ${err}`);
|
|
338
|
+
logger.warn(`fileDownloadDir "${absDir}" is not writable, falling back to the default (~/.composio/files). Error: ${describeThrown(err)}`);
|
|
403
339
|
composioFilesDir = getComposioTempFilesDir(true);
|
|
404
340
|
}
|
|
405
341
|
} else composioFilesDir = opts.isTempFile ? getComposioTempFilesDir(true) : getComposioDir(true);
|
|
@@ -410,7 +346,7 @@ const saveFile = (file, content, options = {}) => {
|
|
|
410
346
|
else platform.writeFileSync(filePath, content, "utf8");
|
|
411
347
|
return filePath;
|
|
412
348
|
} catch (_error) {
|
|
413
|
-
logger.debug(`Error saving file: ${_error}`);
|
|
349
|
+
logger.debug(`Error saving file: ${describeThrown(_error)}`);
|
|
414
350
|
return null;
|
|
415
351
|
}
|
|
416
352
|
};
|