@composio/core 0.12.0 → 0.13.1
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/{BaseProvider-BBnsv9kS.d.mts → BaseProvider-Brb3o86-.d.mts} +80 -80
- package/dist/{CustomTool-DEB4BQPl.mjs → CustomTool-D9qwyMrv.mjs} +1 -1
- package/dist/{CustomTool-DH18rVQu.d.mts → CustomTool-DLf7JeKt.d.mts} +1 -1
- package/dist/CustomTool-NpHpqdnU.d.mts +74 -0
- package/dist/{composio-CHnEggnv.d.mts → composio-BHSQwOUz.d.mts} +503 -319
- package/dist/composio-DfPD7BAi.d.mts +5666 -0
- package/dist/{customTool.types-DpIdOJjL.d.mts → customTool.types-9yFqPjdw.d.mts} +448 -76
- package/dist/customTool.types-D-6YqFdW.d.mts +2826 -0
- package/dist/docs/error-consistency.md +97 -0
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
- package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +252 -0
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +155 -0
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
- package/dist/{errors-D5f4pfvI.mjs → errors-DSIlYfl5.mjs} +2 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/index.d.mts +36 -6
- package/dist/index.mjs +455 -123
- package/dist/{jsonSchema-daqF3S3d.mjs → jsonSchema-CFKdONpP.mjs} +1 -1
- package/dist/{types-CaI5Z4PA.d.mts → types-BJLCRj9q.d.mts} +2 -2
- package/dist/types-CCh8qvui.d.mts +12 -0
- 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/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/docs/error-consistency.md +97 -0
- package/package.json +4 -3
- package/src/composio.ts +509 -0
- package/src/errors/AuthConfigErrors.ts +23 -0
- package/src/errors/ComposioError.ts +408 -0
- package/src/errors/ConnectedAccountsErrors.ts +158 -0
- package/src/errors/ConnectionRequestErrors.ts +32 -0
- package/src/errors/FileModifierErrors.ts +100 -0
- package/src/errors/PusherErrors.ts +28 -0
- package/src/errors/RemoteFileErrors.ts +62 -0
- package/src/errors/SDKErrors.ts +92 -0
- package/src/errors/ToolErrors.ts +244 -0
- package/src/errors/ToolkitErrors.ts +39 -0
- package/src/errors/TriggerErrors.ts +120 -0
- package/src/errors/ValidationErrors.ts +99 -0
- package/src/errors/index.ts +41 -0
- package/src/experimental/index.ts +28 -0
- package/src/index.ts +64 -0
- package/src/lib/toolRouterConstants.ts +1 -0
- package/src/lib/toolRouterParams.ts +306 -0
- package/src/lib/toolRouterSessionDelete.ts +30 -0
- package/src/models/AuthConfigs.ts +398 -0
- package/src/models/AuthScheme.ts +206 -0
- package/src/models/ConnectedAccounts.ts +735 -0
- package/src/models/ConnectionRequest.ts +150 -0
- package/src/models/CustomTool.ts +676 -0
- package/src/models/Experimental.ts +202 -0
- package/src/models/Files.node.ts +93 -0
- package/src/models/Files.workerd.ts +49 -0
- package/src/models/MCP.ts +478 -0
- package/src/models/RemoteFile.ts +172 -0
- package/src/models/SessionContext.ts +147 -0
- package/src/models/Sessions.ts +21 -0
- package/src/models/ToolRouter.ts +406 -0
- package/src/models/ToolRouterSession.ts +839 -0
- package/src/models/ToolRouterSessionFileMount.ts +389 -0
- package/src/models/Toolkits.ts +412 -0
- package/src/models/Tools.ts +1260 -0
- package/src/models/Triggers.ts +1381 -0
- package/src/models/customToolExecution.ts +118 -0
- package/src/models/inlineCustomToolsPayload.ts +17 -0
- package/src/models/proxyParamsTransform.ts +26 -0
- package/src/provider/BaseProvider.ts +138 -0
- package/src/provider/ComposioProvider.ts +29 -0
- package/src/provider/OpenAIProvider.ts +547 -0
- package/src/services/internal/InternalService.ts +50 -0
- package/src/services/internal/InternalService.types.ts +14 -0
- package/src/services/pusher/Pusher.ts +230 -0
- package/src/services/telemetry/TelemetryService.ts +48 -0
- package/src/services/telemetry/TelemetryService.types.ts +67 -0
- package/src/telemetry/BatchProcessor.ts +77 -0
- package/src/telemetry/README.md +123 -0
- package/src/telemetry/Telemetry.ts +356 -0
- package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
- package/src/types/authConfigs.types.ts +174 -0
- package/src/types/composio.types.ts +1 -0
- package/src/types/connectedAccountAuthStates.types.ts +852 -0
- package/src/types/connectedAccounts.types.ts +395 -0
- package/src/types/connectionRequest.types.ts +16 -0
- package/src/types/customTool.types.ts +261 -0
- package/src/types/files.types.ts +15 -0
- package/src/types/mcp.experimental.types.ts +163 -0
- package/src/types/mcp.types.ts +362 -0
- package/src/types/modifiers.types.ts +663 -0
- package/src/types/org.types.ts +0 -0
- package/src/types/provider.types.ts +41 -0
- package/src/types/pusher.types.ts +18 -0
- package/src/types/requestOptions.types.ts +62 -0
- package/src/types/telemetry.types.ts +89 -0
- package/src/types/tool.types.ts +408 -0
- package/src/types/toolRouter.types.ts +774 -0
- package/src/types/toolkit.types.ts +130 -0
- package/src/types/triggers.types.ts +401 -0
- package/src/types/webhookEvents.types.ts +219 -0
- package/src/utils/buffer.ts +30 -0
- package/src/utils/cancellation.ts +22 -0
- package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
- package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
- package/src/utils/config-defaults/index.ts +1 -0
- package/src/utils/config-defaults/types.ts +14 -0
- package/src/utils/constants.ts +22 -0
- package/src/utils/crypto.ts +34 -0
- package/src/utils/env.ts +34 -0
- package/src/utils/fileDirs.ts +81 -0
- package/src/utils/fileUtils.node.ts +458 -0
- package/src/utils/json-schema.ts +1 -0
- package/src/utils/jsonSchema.ts +355 -0
- package/src/utils/logger.ts +99 -0
- package/src/utils/mime.ts +75 -0
- package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
- package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
- package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
- package/src/utils/pagination.ts +73 -0
- package/src/utils/pusher.ts +286 -0
- package/src/utils/schemaPropertyKeys.ts +433 -0
- package/src/utils/sdk.ts +110 -0
- package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
- package/src/utils/session.ts +114 -0
- package/src/utils/toolArguments.ts +73 -0
- package/src/utils/toolkitVersion.ts +26 -0
- package/src/utils/transform.ts +42 -0
- package/src/utils/transformers/authConfigs.ts +107 -0
- package/src/utils/transformers/connectedAccounts.ts +119 -0
- package/src/utils/transformers/mcp.ts +164 -0
- package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
- package/src/utils/transformers/toolkits.ts +100 -0
- package/src/utils/transformers/triggers.ts +118 -0
- package/src/utils/uploadDirAllowlist.node.ts +178 -0
- package/src/utils/uuid.ts +7 -0
- package/src/utils/version.ts +58 -0
- package/src/utils/zodSchema.ts +90 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as logger } from "./FileModifierErrors-3fSwIWoa.mjs";
|
|
2
|
-
import { C as JsonSchemaRefResolutionError, S as isRequestAbortError, b as ComposioRequestCancelledError, w as JsonSchemaToZodError } from "./errors-
|
|
2
|
+
import { C as JsonSchemaRefResolutionError, S as isRequestAbortError, b as ComposioRequestCancelledError, w as JsonSchemaToZodError } from "./errors-DSIlYfl5.mjs";
|
|
3
3
|
import { t as isPlainObject } from "./FileToolModifier.utils.neutral-B5rT711M.mjs";
|
|
4
4
|
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as BaseComposioProvider } from "./BaseProvider-
|
|
2
|
-
import { n as ComposioConfig } from "./composio-
|
|
1
|
+
import { n as BaseComposioProvider } from "./BaseProvider-Brb3o86-.mjs";
|
|
2
|
+
import { n as ComposioConfig } from "./composio-DfPD7BAi.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/config-defaults/types.d.ts
|
|
5
5
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as BaseComposioProvider } from "./BaseProvider-Brb3o86-.mjs";
|
|
2
|
+
import { n as ComposioConfig } from "./composio-BHSQwOUz.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/config-defaults/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Configuration defaults for Composio.
|
|
7
|
+
* These are the required fields that must have default values.
|
|
8
|
+
* The provider type is set to never since defaults don't include a provider instance.
|
|
9
|
+
*/
|
|
10
|
+
type ConfigDefaults = Required<Pick<ComposioConfig<BaseComposioProvider<never, never, never>>, 'dangerouslyAllowAutoUploadDownloadFiles' | 'allowTracking' | 'toolkitVersions'>>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ConfigDefaults as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-
|
|
1
|
+
import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-Brb3o86-.mjs";
|
|
2
2
|
import ComposioClient from "@composio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/modifiers/FileToolModifier.node.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as ComposioSensitiveFilePathBlockedError, c as logger, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-3fSwIWoa.mjs";
|
|
2
|
-
import { b as ComposioRequestCancelledError } from "../../errors-
|
|
2
|
+
import { b as ComposioRequestCancelledError } from "../../errors-DSIlYfl5.mjs";
|
|
3
3
|
import { i as transformProperties, n as schemaHasFileProperty, t as isPlainObject } from "../../FileToolModifier.utils.neutral-B5rT711M.mjs";
|
|
4
|
-
import { i as withCancellation, t as dereferenceJsonSchema } from "../../jsonSchema-
|
|
4
|
+
import { i as withCancellation, t as dereferenceJsonSchema } from "../../jsonSchema-CFKdONpP.mjs";
|
|
5
5
|
import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../../fileUtils.node-BiO1JQsJ.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/utils/modifiers/FileToolModifier.node.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-
|
|
1
|
+
import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-Brb3o86-.mjs";
|
|
2
2
|
import ComposioClient from "@composio/client";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/modifiers/FileToolModifier.workerd.d.ts
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Error Class Consistency in Composio SDK
|
|
2
|
+
|
|
3
|
+
This document outlines the standardized pattern for error classes in the Composio SDK.
|
|
4
|
+
|
|
5
|
+
## Standardized Error Class Pattern
|
|
6
|
+
|
|
7
|
+
All error classes in the Composio SDK follow this standard pattern:
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export class SomeSpecificError extends ComposioError {
|
|
11
|
+
constructor(
|
|
12
|
+
message: string = 'Default error message',
|
|
13
|
+
options: Omit<ComposioErrorOptions, 'code'> = {}
|
|
14
|
+
) {
|
|
15
|
+
super(message, {
|
|
16
|
+
...options,
|
|
17
|
+
code: ERROR_CODE_CONSTANT,
|
|
18
|
+
possibleFixes: options.possibleFixes || [
|
|
19
|
+
'Default fix suggestion 1',
|
|
20
|
+
'Default fix suggestion 2',
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
this.name = 'SomeSpecificError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Key Standardization Points
|
|
29
|
+
|
|
30
|
+
1. **Message Parameter**: All constructors accept a message string with a default value.
|
|
31
|
+
2. **Options Object**: All constructors take an options object (rather than individual properties).
|
|
32
|
+
3. **Default Values**: Default values are provided for both the message and options parameters.
|
|
33
|
+
4. **Preserving Options**: All options are preserved with `...options` and only specific properties are overridden.
|
|
34
|
+
5. **Default Fixes**: Default `possibleFixes` are provided but can be overridden.
|
|
35
|
+
6. **Name Property**: Each error class sets its `name` property to match the class name.
|
|
36
|
+
|
|
37
|
+
## Special Cases
|
|
38
|
+
|
|
39
|
+
Some error classes have specific requirements:
|
|
40
|
+
|
|
41
|
+
1. **ValidationError**: Accepts a `zodError` in the options.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
new ValidationError('Message', { cause: someZodError });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. **ComposioToolExecutionError**: Accepts an `originalError` in the options.
|
|
48
|
+
```typescript
|
|
49
|
+
new ComposioToolExecutionError('Message', { originalError: someError });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Using Error Classes
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Basic usage
|
|
56
|
+
throw new ComposioNoAPIKeyError();
|
|
57
|
+
|
|
58
|
+
// With custom message
|
|
59
|
+
throw new ComposioToolNotFoundError('Could not find the specified tool');
|
|
60
|
+
|
|
61
|
+
// With additional options
|
|
62
|
+
throw new ComposioConnectedAccountNotFoundError('Account not found', {
|
|
63
|
+
meta: {
|
|
64
|
+
accountId: '12345',
|
|
65
|
+
userId: 'user123',
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Special cases
|
|
70
|
+
try {
|
|
71
|
+
// Some code that might throw
|
|
72
|
+
} catch (error) {
|
|
73
|
+
// Handle tool execution errors
|
|
74
|
+
throw new ComposioToolExecutionError('Tool failed', {
|
|
75
|
+
originalError: error,
|
|
76
|
+
meta: { toolId: 'some-tool' },
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Handle validation errors
|
|
80
|
+
throw new ValidationError('Validation failed', {
|
|
81
|
+
zodError: someZodError,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Utility Methods
|
|
87
|
+
|
|
88
|
+
All error classes inherit these helpful methods from `ComposioError`:
|
|
89
|
+
|
|
90
|
+
1. **toString()**: Returns a formatted string representation
|
|
91
|
+
2. **prettyPrint()**: Prints a formatted error message to the console
|
|
92
|
+
3. **toJSON()**: Returns a JSON representation of the error
|
|
93
|
+
|
|
94
|
+
## Static Factory Methods
|
|
95
|
+
|
|
96
|
+
1. **ComposioError.createAndPrint()**: Creates and prints an error in one step
|
|
97
|
+
2. **ComposioError.handle()**: Generic error handler for any error type
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
7
7
|
"publishConfig": {
|
|
@@ -71,9 +71,10 @@
|
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"README.md",
|
|
74
|
+
"docs",
|
|
74
75
|
"dist",
|
|
75
76
|
"generated",
|
|
76
|
-
"src
|
|
77
|
+
"src"
|
|
77
78
|
],
|
|
78
79
|
"keywords": [],
|
|
79
80
|
"author": "",
|
|
@@ -116,7 +117,7 @@
|
|
|
116
117
|
"homepage": "https://github.com/ComposioHQ/composio/tree/main/ts/packages/core#readme",
|
|
117
118
|
"scripts": {
|
|
118
119
|
"clean": "git clean -xdf node_modules",
|
|
119
|
-
"build": "tsdown",
|
|
120
|
+
"build": "pnpm exec tsdown",
|
|
120
121
|
"test": "vitest run",
|
|
121
122
|
"typecheck": "pnpm exec tsgo --noEmit --skipLibCheck && pnpm exec tsgo --noEmit --skipLibCheck -p tsconfig.type-tests.json",
|
|
122
123
|
"typecheck:tsc": "tsc --noEmit --skipLibCheck && tsc --noEmit --skipLibCheck -p tsconfig.type-tests.json",
|