@composio/core 0.31.0 → 0.32.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-CBx9kzea.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-BWKZmDxM.mjs} +2 -2
- package/dist/composio-CPf6NHnB.d.mts +20334 -0
- package/dist/{customTool.types-DHxXBU6E.d.mts → customTool.types-BSbIG1OG.d.mts} +291 -68
- 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 +44 -32
- 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-BJUYMEph.mjs} +7 -7
- package/dist/index.d.mts +6 -11
- package/dist/index.mjs +526 -233
- package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-BZoXGUCr.mjs} +2 -2
- package/dist/models/Files.node.mjs +3 -3
- package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-CcbMAYCC.mjs} +21 -15
- package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
- package/dist/{types-DcdZy5Nc.d.mts → types-ns3Q_WrP.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/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 +2 -2
- 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 +30 -17
- 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/provider.types.ts +0 -1
- package/src/types/sessionWebhooks.types.ts +292 -0
- package/src/types/toolRouter.types.ts +33 -4
- 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 +4 -3
- package/src/utils/logger.ts +19 -9
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as LocalTool, o as CreateLocalToolParams, s as CreateLocalToolkitParams, t as AnyZodSchema, w as LocalToolkit } from "./customTool.types-
|
|
1
|
+
import { S as LocalTool, o as CreateLocalToolParams, s as CreateLocalToolkitParams, t as AnyZodSchema, w as LocalToolkit } from "./customTool.types-BSbIG1OG.mjs";
|
|
2
2
|
import "@composio/client/resources/tool-router/session";
|
|
3
3
|
/**
|
|
4
4
|
* Create a local tool for use in tool router sessions.
|
|
@@ -4,7 +4,7 @@ import { ZodError } from "zod/v3";
|
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
|
|
6
6
|
// src/utils/env.ts
|
|
7
|
-
const getEnvVariable = (name, defaultValue
|
|
7
|
+
const getEnvVariable = (name, defaultValue) => {
|
|
8
8
|
try {
|
|
9
9
|
return process.env[name] || defaultValue;
|
|
10
10
|
} catch (_e) {
|
|
@@ -25,7 +25,7 @@ const getEnvsWithPrefix = (prefix) => {
|
|
|
25
25
|
try {
|
|
26
26
|
if (process && process.env) return Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith(prefix)));
|
|
27
27
|
else return {};
|
|
28
|
-
} catch
|
|
28
|
+
} catch {
|
|
29
29
|
return {};
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -212,13 +212,8 @@ var Logger = class {
|
|
|
212
212
|
formatMessage(args) {
|
|
213
213
|
const formattedArgs = args.map((arg, index) => {
|
|
214
214
|
if (typeof arg === "object") return JSON.stringify(arg);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (args.length > 1) return pc.yellow(`${arg}`);
|
|
218
|
-
else return String(arg);
|
|
219
|
-
}
|
|
220
|
-
return String(arg);
|
|
221
|
-
}
|
|
215
|
+
const text = formatLogValue(arg);
|
|
216
|
+
return index === 0 && args.length > 1 ? pc.yellow(text) : text;
|
|
222
217
|
}).join("\n");
|
|
223
218
|
const redactedArgs = redactSensitiveText(formattedArgs) ?? formattedArgs;
|
|
224
219
|
if (!this.includeTimestamp) return redactedArgs;
|
|
@@ -241,8 +236,60 @@ var Logger = class {
|
|
|
241
236
|
if (this.shouldLog("debug")) this.sink.debug(this.formatMessage(args));
|
|
242
237
|
}
|
|
243
238
|
};
|
|
239
|
+
function formatLogValue(value) {
|
|
240
|
+
switch (typeof value) {
|
|
241
|
+
case "string": return value;
|
|
242
|
+
case "function": return value.toString();
|
|
243
|
+
case "number":
|
|
244
|
+
case "boolean":
|
|
245
|
+
case "bigint":
|
|
246
|
+
case "symbol":
|
|
247
|
+
case "undefined": return String(value);
|
|
248
|
+
default: return Object.prototype.toString.call(value);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
244
251
|
const logger = new Logger();
|
|
245
252
|
|
|
253
|
+
// src/utils/userCallback.ts
|
|
254
|
+
/**
|
|
255
|
+
* Describes a thrown or rejected value for a log line without ever throwing.
|
|
256
|
+
*
|
|
257
|
+
* The logger serializes object arguments with `JSON.stringify`, which turns an `Error` into `{}`
|
|
258
|
+
* and throws on a circular value, so callers log this string instead of the raw value.
|
|
259
|
+
* `JSON.stringify` and `String()` can both throw (a circular value, an object without a
|
|
260
|
+
* prototype), so each is tried in turn.
|
|
261
|
+
*/
|
|
262
|
+
function describeThrown(value) {
|
|
263
|
+
try {
|
|
264
|
+
if (value instanceof Error) return value.message;
|
|
265
|
+
if (typeof value === "object" && value !== null) return JSON.stringify(value) ?? Object.prototype.toString.call(value);
|
|
266
|
+
return String(value);
|
|
267
|
+
} catch {
|
|
268
|
+
try {
|
|
269
|
+
return String(value);
|
|
270
|
+
} catch {
|
|
271
|
+
return "[unprintable value]";
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Calls a user-supplied event callback so that neither a synchronous throw nor a rejected promise
|
|
277
|
+
* escapes into the event emitter that invoked it. Failures are logged after `label`.
|
|
278
|
+
*
|
|
279
|
+
* pusher-js does not catch listener exceptions, and nothing awaits the promise an `async`
|
|
280
|
+
* listener returns, so an escaped failure would end a Node process.
|
|
281
|
+
*/
|
|
282
|
+
function invokeUserCallback(label, callback) {
|
|
283
|
+
const logFailure = (error) => {
|
|
284
|
+
logger.error(label, describeThrown(error));
|
|
285
|
+
};
|
|
286
|
+
try {
|
|
287
|
+
Promise.resolve(callback()).catch(logFailure);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
logFailure(error);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
246
293
|
// src/errors/apiErrorDetails.ts
|
|
247
294
|
const ANSI_ESCAPE = /\u001b(?:\[[0-?]*[ -/]*[@-~]|\][^\u0007\u001b]*(?:\u0007|\u001b\\)|[@-_])/g;
|
|
248
295
|
const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g;
|
|
@@ -350,7 +397,7 @@ var ComposioError = class ComposioError extends Error {
|
|
|
350
397
|
const { cause, code, stack, statusCode, apiErrorCode, meta, possibleFixes } = this;
|
|
351
398
|
if (cause !== void 0) {
|
|
352
399
|
const rawCause = cause;
|
|
353
|
-
data.cause = rawCause instanceof APIError ? sanitizeApiErrorText(rawCause.message) : rawCause instanceof Error ? rawCause.message : sanitizeApiErrorText(
|
|
400
|
+
data.cause = rawCause instanceof APIError ? sanitizeApiErrorText(rawCause.message) : rawCause instanceof Error ? rawCause.message : sanitizeApiErrorText(describeThrown(rawCause));
|
|
354
401
|
}
|
|
355
402
|
if (code) data.code = code;
|
|
356
403
|
if (statusCode !== void 0) data.statusCode = statusCode;
|
|
@@ -501,7 +548,7 @@ var ComposioError = class ComposioError extends Error {
|
|
|
501
548
|
logger.error("\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold("Unknown error occurred")));
|
|
502
549
|
if (error !== null && error !== void 0) {
|
|
503
550
|
logger.error(pc.gray("Error details:"));
|
|
504
|
-
logger.error(" " + pc.white(
|
|
551
|
+
logger.error(" " + pc.white(describeThrown(error)));
|
|
505
552
|
}
|
|
506
553
|
logger.error("");
|
|
507
554
|
}
|
|
@@ -539,4 +586,4 @@ var ComposioBlockedInternalUrlError = class extends ComposioError {
|
|
|
539
586
|
}
|
|
540
587
|
};
|
|
541
588
|
|
|
542
|
-
export {
|
|
589
|
+
export { constants_exports as _, sanitizeApiErrorText as a, invokeUserCallback as c, COMPOSIO_DIR as d, DEFAULT_BASE_URL as f, USER_DATA_FILE_NAME as g, TEMP_FILES_DIRECTORY_NAME as h, apiErrorSuggestedFixes as i, logger as l, IS_DEVELOPMENT_OR_CI as m, SsrfErrorCodes as n, withApiErrorMessage as o, DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID as p, ComposioError as r, describeThrown as s, ComposioBlockedInternalUrlError as t, redactSensitiveText as u, getEnvVariable as v, getEnvsWithPrefix as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { l as logger, r as ComposioError$1, u as redactSensitiveText, v as getEnvVariable } from "./SsrfErrors-BekZPeWY.mjs";
|
|
2
|
+
import { h as getRandomUUID } from "./sensitiveFileUploadPaths-CcbMAYCC.mjs";
|
|
3
3
|
import { ComposioError } from "@composio/client";
|
|
4
4
|
|
|
5
5
|
// src/types/telemetry.types.ts
|