@composio/core 0.5.5 → 0.6.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/BaseProvider-2__95v5V.d.cts +26875 -0
- package/dist/BaseProvider-D1UCDu8V.d.mts +26875 -0
- package/dist/FileToolModifier.utils.neutral-BN_L8usp.mjs +78 -0
- package/dist/FileToolModifier.utils.neutral-Bcl7LVf4.cjs +102 -0
- package/dist/Telemetry-Bn5VseVi.mjs +331 -0
- package/dist/Telemetry-DErMJqj0.cjs +337 -0
- package/dist/buffer-BFpVRahf.mjs +382 -0
- package/dist/buffer-CYf1Z6Sd.cjs +478 -0
- package/dist/composio-CFe2Q5BN.d.cts +6313 -0
- package/dist/composio-DtAsGWh4.d.mts +6313 -0
- package/dist/fileUtils.node-BJQeDcfa.cjs +233 -0
- package/dist/fileUtils.node-C6fQOgF0.mjs +220 -0
- package/dist/index.cjs +140 -389
- package/dist/index.d.cts +6 -33161
- package/dist/index.d.mts +6 -33161
- package/dist/index.mjs +49 -297
- package/dist/models/Files.node.cjs +6 -4
- package/dist/models/Files.node.d.cts +1 -1
- package/dist/models/Files.node.d.mts +1 -1
- package/dist/models/Files.node.mjs +4 -2
- package/dist/models/Files.workerd.cjs +1 -1
- package/dist/models/Files.workerd.mjs +1 -1
- package/dist/platform/node.cjs +6 -3
- package/dist/platform/node.d.cts +1 -1
- package/dist/platform/node.d.mts +1 -1
- package/dist/platform/node.mjs +6 -3
- package/dist/platform/workerd.d.cts +1 -1
- package/dist/platform/workerd.d.mts +1 -1
- package/dist/{types-BaUqjuX3.d.mts → types-BF2OQZRP.d.cts} +8 -5
- package/dist/{types-BrsW5suw.d.cts → types-Cvt_yFsu.d.mts} +8 -5
- package/dist/types-Do-rlwX8.d.mts +13 -0
- package/dist/types-Ohe4pd-1.d.cts +13 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.cjs +10 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +7 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +8 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.mjs +9 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +10 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +7 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +8 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +9 -0
- package/dist/utils/modifiers/FileToolModifier.node.cjs +172 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +21 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +21 -0
- package/dist/utils/modifiers/FileToolModifier.node.mjs +173 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.cjs +27 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +20 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +20 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +27 -0
- package/generated/ably.ts +20 -0
- package/generated/accelo.ts +8 -0
- package/generated/acculynx.ts +17 -0
- package/generated/active_campaign.ts +30 -0
- package/generated/adobe.ts +8 -0
- package/generated/adyntel.ts +12 -0
- package/generated/aero_workflow.ts +8 -0
- package/generated/affinity.ts +29 -0
- package/generated/agencyzoom.ts +108 -0
- package/generated/ahrefs.ts +49 -0
- package/generated/airtable.ts +26 -0
- package/generated/alchemy.ts +16 -0
- package/generated/algolia.ts +39 -0
- package/generated/altoviz.ts +18 -0
- package/generated/amazon.ts +8 -0
- package/generated/amcards.ts +11 -0
- package/generated/amplitude.ts +25 -0
- package/generated/anthropic_administrator.ts +13 -0
- package/generated/apaleo.ts +38 -0
- package/generated/apollo.ts +40 -0
- package/generated/appdrag.ts +8 -0
- package/generated/appsflyer.ts +8 -0
- package/generated/asana.ts +95 -0
- package/generated/ashby.ts +8 -0
- package/generated/atlassian.ts +8 -0
- package/generated/attio.ts +20 -0
- package/generated/auth0.ts +8 -0
- package/generated/axonaut.ts +8 -0
- package/generated/bamboohr.ts +168 -0
- package/generated/bannerbear.ts +17 -0
- package/generated/baserow.ts +11 -0
- package/generated/battlenet.ts +8 -0
- package/generated/beeminder.ts +14 -0
- package/generated/bigmailer.ts +12 -0
- package/generated/bigml.ts +15 -0
- package/generated/bill.ts +218 -0
- package/generated/bitbucket.ts +25 -0
- package/generated/bitwarden.ts +8 -0
- package/generated/blackbaud.ts +8 -0
- package/generated/blackboard.ts +323 -0
- package/generated/boldsign.ts +8 -0
- package/generated/bolna.ts +24 -0
- package/generated/borneo.ts +162 -0
- package/generated/botbaba.ts +8 -0
- package/generated/box.ts +282 -0
- package/generated/braintree.ts +8 -0
- package/generated/brandfetch.ts +15 -0
- package/generated/breezy_hr.ts +8 -0
- package/generated/brevo.ts +28 -0
- package/generated/brex.ts +8 -0
- package/generated/brex_staging.ts +8 -0
- package/generated/brightpearl.ts +8 -0
- package/generated/brilliant_directories.ts +15 -0
- package/generated/browseai.ts +18 -0
- package/generated/browserbase_tool.ts +10 -0
- package/generated/browserhub.ts +8 -0
- package/generated/browserless.ts +16 -0
- package/generated/bubble.ts +8 -0
- package/generated/bugbug.ts +13 -0
- package/generated/builtwith.ts +21 -0
- package/generated/cal.ts +150 -0
- package/generated/calendly.ts +51 -0
- package/generated/canva.ts +41 -0
- package/generated/canvas.ts +100 -0
- package/generated/chatwork.ts +17 -0
- package/generated/chmeetings.ts +8 -0
- package/generated/clickup.ts +153 -0
- package/generated/clockify.ts +23 -0
- package/generated/close.ts +15 -0
- package/generated/cloudflare.ts +10 -0
- package/generated/coda.ts +115 -0
- package/generated/codeinterpreter.ts +14 -0
- package/generated/coinbase.ts +15 -0
- package/generated/coinmarketcal.ts +8 -0
- package/generated/composio.ts +34 -0
- package/generated/composio_search.ts +22 -0
- package/generated/confluence.ts +199 -0
- package/generated/contentful.ts +12 -0
- package/generated/crustdata.ts +23 -0
- package/generated/customer_io.ts +8 -0
- package/generated/cutt_ly.ts +10 -0
- package/generated/d2lbrightspace.ts +54 -0
- package/generated/dailybot.ts +15 -0
- package/generated/datadog.ts +47 -0
- package/generated/datagma.ts +8 -0
- package/generated/datarobot.ts +8 -0
- package/generated/deel.ts +8 -0
- package/generated/demio.ts +8 -0
- package/generated/dialpad.ts +201 -0
- package/generated/digicert.ts +15 -0
- package/generated/discord.ts +17 -0
- package/generated/discordbot.ts +173 -0
- package/generated/docmosis.ts +8 -0
- package/generated/docusign.ts +351 -0
- package/generated/dropbox.ts +20 -0
- package/generated/dropbox_sign.ts +8 -0
- package/generated/dynamics365.ts +25 -0
- package/generated/echtpost.ts +10 -0
- package/generated/elevenlabs.ts +70 -0
- package/generated/emailoctopus.ts +16 -0
- package/generated/enigma.ts +11 -0
- package/generated/entelligence.ts +11 -0
- package/generated/epic_games.ts +8 -0
- package/generated/eventbrite.ts +12 -0
- package/generated/exa.ts +13 -0
- package/generated/excel.ts +34 -0
- package/generated/exist.ts +8 -0
- package/generated/facebook.ts +8 -0
- package/generated/factorial.ts +8 -0
- package/generated/figma.ts +59 -0
- package/generated/finage.ts +19 -0
- package/generated/firecrawl.ts +16 -0
- package/generated/fireflies.ts +21 -0
- package/generated/fitbit.ts +8 -0
- package/generated/flutterwave.ts +33 -0
- package/generated/fomo.ts +10 -0
- package/generated/formcarry.ts +10 -0
- package/generated/formsite.ts +14 -0
- package/generated/foursquare.ts +14 -0
- package/generated/freshbooks.ts +11 -0
- package/generated/freshdesk.ts +16 -0
- package/generated/front.ts +8 -0
- package/generated/github.ts +967 -0
- package/generated/gitlab.ts +82 -0
- package/generated/gmail.d.ts +86 -0
- package/generated/gmail.js +13 -0
- package/generated/gmail.ts +95 -0
- package/generated/go_to_webinar.ts +8 -0
- package/generated/gong.ts +63 -0
- package/generated/google_analytics.ts +13 -0
- package/generated/google_maps.ts +16 -0
- package/generated/googleads.ts +14 -0
- package/generated/googlebigquery.ts +10 -0
- package/generated/googlecalendar.ts +39 -0
- package/generated/googledocs.ts +41 -0
- package/generated/googledrive.ts +62 -0
- package/generated/googlemeet.ts +18 -0
- package/generated/googlephotos.ts +22 -0
- package/generated/googlesheets.ts +40 -0
- package/generated/googleslides.ts +8 -0
- package/generated/googlesuper.ts +230 -0
- package/generated/googletasks.ts +23 -0
- package/generated/gorgias.ts +41 -0
- package/generated/gumroad.ts +14 -0
- package/generated/guru.ts +8 -0
- package/generated/hackernews.ts +15 -0
- package/generated/hackerrank_work.ts +8 -0
- package/generated/harvest.ts +56 -0
- package/generated/helcim.ts +8 -0
- package/generated/heygen.ts +44 -0
- package/generated/highlevel.ts +8 -0
- package/generated/hubspot.ts +252 -0
- package/generated/humanloop.ts +13 -0
- package/generated/icims_talent_cloud.ts +8 -0
- package/generated/idea_scale.ts +8 -0
- package/generated/index.ts +151 -0
- package/generated/insighto_ai.ts +19 -0
- package/generated/intercom.ts +52 -0
- package/generated/interzoid.ts +8 -0
- package/generated/jira.ts +59 -0
- package/generated/jotform.ts +15 -0
- package/generated/junglescout.ts +15 -0
- package/generated/keap.ts +8 -0
- package/generated/kibana.ts +58 -0
- package/generated/kit.ts +38 -0
- package/generated/klaviyo.ts +240 -0
- package/generated/klipfolio.ts +20 -0
- package/generated/kommo.ts +24 -0
- package/generated/lastpass.ts +8 -0
- package/generated/launch_darkly.ts +16 -0
- package/generated/leadfeeder.ts +13 -0
- package/generated/leadoku.ts +10 -0
- package/generated/lever.ts +8 -0
- package/generated/lever_sandbox.ts +8 -0
- package/generated/lexoffice.ts +8 -0
- package/generated/linear.ts +31 -0
- package/generated/linkedin.ts +13 -0
- package/generated/linkhut.ts +14 -0
- package/generated/linkup.ts +11 -0
- package/generated/listennotes.ts +35 -0
- package/generated/lmnt.ts +16 -0
- package/generated/lodgify.ts +10 -0
- package/generated/mailchimp.ts +285 -0
- package/generated/mailerlite.ts +8 -0
- package/generated/maintainx.ts +20 -0
- package/generated/make.ts +12 -0
- package/generated/mboum.ts +8 -0
- package/generated/mem0.ts +52 -0
- package/generated/metaads.ts +25 -0
- package/generated/metatextai.ts +8 -0
- package/generated/microsoft_clarity.ts +10 -0
- package/generated/microsoft_teams.ts +22 -0
- package/generated/microsoft_tenant.ts +8 -0
- package/generated/miro.ts +23 -0
- package/generated/mixpanel.ts +30 -0
- package/generated/mocean.ts +8 -0
- package/generated/monday.ts +30 -0
- package/generated/mopinion.ts +8 -0
- package/generated/more_trees.ts +10 -0
- package/generated/moxie.ts +8 -0
- package/generated/moz.ts +8 -0
- package/generated/mural.ts +14 -0
- package/generated/nasdaq.ts +15 -0
- package/generated/ncscale.ts +8 -0
- package/generated/neon.ts +78 -0
- package/generated/netsuite.ts +8 -0
- package/generated/nextdns.ts +11 -0
- package/generated/ngrok.ts +18 -0
- package/generated/notion.ts +40 -0
- package/generated/oncehub.ts +8 -0
- package/generated/one_drive.ts +49 -0
- package/generated/onepage.ts +11 -0
- package/generated/open_sea.ts +33 -0
- package/generated/outlook.ts +37 -0
- package/generated/pagerduty.ts +362 -0
- package/generated/pandadoc.ts +23 -0
- package/generated/peopledatalabs.ts +24 -0
- package/generated/perplexityai.ts +10 -0
- package/generated/piggy.ts +8 -0
- package/generated/pipedrive.ts +288 -0
- package/generated/placekey.ts +12 -0
- package/generated/posthog.ts +367 -0
- package/generated/precoro.ts +8 -0
- package/generated/printnode.ts +8 -0
- package/generated/process_street.ts +14 -0
- package/generated/productboard.ts +8 -0
- package/generated/qualaroo.ts +8 -0
- package/generated/quickbooks.ts +22 -0
- package/generated/rafflys.ts +8 -0
- package/generated/ragic.ts +10 -0
- package/generated/ramp.ts +17 -0
- package/generated/ravenseotools.ts +8 -0
- package/generated/recallai.ts +17 -0
- package/generated/reddit.ts +19 -0
- package/generated/resend.ts +27 -0
- package/generated/retellai.ts +19 -0
- package/generated/retently.ts +24 -0
- package/generated/ring_central.ts +8 -0
- package/generated/rippling.ts +8 -0
- package/generated/rocket_reach.ts +8 -0
- package/generated/rocketlane.ts +42 -0
- package/generated/rootly.ts +12 -0
- package/generated/rosette_text_analytics.ts +12 -0
- package/generated/sage.ts +8 -0
- package/generated/salesforce.ts +46 -0
- package/generated/scrape_do.ts +28 -0
- package/generated/scrapingant.ts +14 -0
- package/generated/screenshotone.ts +10 -0
- package/generated/seismic.ts +8 -0
- package/generated/semanticscholar.ts +23 -0
- package/generated/semrush.ts +45 -0
- package/generated/sendgrid.ts +384 -0
- package/generated/sentry.ts +185 -0
- package/generated/serpapi.ts +32 -0
- package/generated/servicem8.ts +37 -0
- package/generated/servicenow.ts +14 -0
- package/generated/share_point.ts +15 -0
- package/generated/shopify.ts +37 -0
- package/generated/shortcut.ts +131 -0
- package/generated/simplesat.ts +11 -0
- package/generated/slack.d.ts +16 -0
- package/generated/slack.js +11 -0
- package/generated/slack.ts +24 -0
- package/generated/slackbot.ts +205 -0
- package/generated/smartrecruiters.ts +8 -0
- package/generated/smugmug.ts +14 -0
- package/generated/snowflake.ts +15 -0
- package/generated/sourcegraph.ts +16 -0
- package/generated/square.ts +8 -0
- package/generated/stack_exchange.ts +17 -0
- package/generated/starton.ts +11 -0
- package/generated/storeganise.ts +12 -0
- package/generated/stripe.ts +50 -0
- package/generated/supabase.ts +86 -0
- package/generated/survey_monkey.ts +8 -0
- package/generated/tally.ts +25 -0
- package/generated/tapfiliate.ts +11 -0
- package/generated/tapform.ts +8 -0
- package/generated/tavily.ts +10 -0
- package/generated/terminus.ts +8 -0
- package/generated/text_to_pdf.ts +10 -0
- package/generated/textrazor.ts +22 -0
- package/generated/timecamp.ts +10 -0
- package/generated/timekit.ts +8 -0
- package/generated/timely.ts +11 -0
- package/generated/tinypng.ts +15 -0
- package/generated/tinyurl.ts +10 -0
- package/generated/tisane.ts +15 -0
- package/generated/todoist.ts +19 -0
- package/generated/toneden.ts +8 -0
- package/generated/tpscheck.ts +10 -0
- package/generated/trello.ts +360 -0
- package/generated/twitch.ts +8 -0
- package/generated/twitter.ts +82 -0
- package/generated/twitter_media.ts +10 -0
- package/generated/typefully.ts +14 -0
- package/generated/venly.ts +8 -0
- package/generated/vero.ts +8 -0
- package/generated/visme.ts +8 -0
- package/generated/waboxapp.ts +8 -0
- package/generated/wakatime.ts +8 -0
- package/generated/wave_accounting.ts +8 -0
- package/generated/weathermap.ts +10 -0
- package/generated/webex.ts +37 -0
- package/generated/webflow.ts +30 -0
- package/generated/whatsapp.ts +14 -0
- package/generated/wiz.ts +8 -0
- package/generated/workiom.ts +12 -0
- package/generated/wrike.ts +47 -0
- package/generated/xero.ts +13 -0
- package/generated/yandex.ts +13 -0
- package/generated/ynab.ts +8 -0
- package/generated/yousearch.ts +10 -0
- package/generated/youtube.ts +26 -0
- package/generated/zendesk.ts +23 -0
- package/generated/zenrows.ts +25 -0
- package/generated/zenserp.ts +20 -0
- package/generated/zoho.ts +33 -0
- package/generated/zoho_bigin.ts +21 -0
- package/generated/zoho_books.ts +8 -0
- package/generated/zoho_desk.ts +8 -0
- package/generated/zoho_inventory.ts +8 -0
- package/generated/zoho_invoice.ts +15 -0
- package/generated/zoho_mail.ts +8 -0
- package/generated/zoom.ts +181 -0
- package/generated/zoominfo.ts +26 -0
- package/package.json +25 -1
- package/src/platform/index.ts +1 -1
- package/src/platform/node.ts +17 -9
- package/src/platform/types.ts +9 -5
- package/src/platform/workerd.ts +7 -3
- package/dist/fileUtils-2bnnG7dq.cjs +0 -979
- package/dist/fileUtils-Dbn-fnh5.mjs +0 -900
- /package/dist/{chunk-0j-ceAHr.mjs → chunk-Dx2NuYGI.mjs} +0 -0
- /package/dist/{files.types-B7P5A1Z5.d.mts → files.types-BDqIUdfP.d.mts} +0 -0
- /package/dist/{files.types-D-RzIOHq.d.cts → files.types-nK6eTNnc.d.cts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import {
|
|
1
|
+
import "./chunk-Dx2NuYGI.mjs";
|
|
2
|
+
import { c as COMPOSIO_DIR, d as IS_DEVELOPMENT_OR_CI, g as getEnvsWithPrefix, h as getEnvVariable, l as COMPOSIO_LOG_LEVEL, m as constants_exports, o as ComposioError, p as USER_DATA_FILE_NAME, s as logger_default, t as arrayBufferToBase64, u as DEFAULT_BASE_URL } from "./buffer-BFpVRahf.mjs";
|
|
3
|
+
import { t as telemetry } from "./Telemetry-Bn5VseVi.mjs";
|
|
3
4
|
import ComposioClient, { APIError } from "@composio/client";
|
|
5
|
+
import { FileToolModifier } from "#file_tool_modifier";
|
|
4
6
|
import z, { ZodError, z as z$1 } from "zod/v3";
|
|
5
7
|
import * as zodToJsonSchema from "zod-to-json-schema";
|
|
6
|
-
import
|
|
7
|
-
import { platform } from "#platform";
|
|
8
|
+
import { CONFIG_DEFAULTS } from "#config_defaults";
|
|
8
9
|
import { APIError as APIError$1 } from "openai";
|
|
10
|
+
import { platform } from "#platform";
|
|
9
11
|
import semver from "semver";
|
|
10
12
|
import { Files } from "#files";
|
|
11
13
|
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
@@ -1728,277 +1730,6 @@ var CustomTools = class {
|
|
|
1728
1730
|
}
|
|
1729
1731
|
};
|
|
1730
1732
|
|
|
1731
|
-
//#endregion
|
|
1732
|
-
//#region src/errors/FileModifierErrors.ts
|
|
1733
|
-
const FileModifierErrorCodes = { FILE_UPLOAD_FAILED: "FILE_UPLOAD_FAILED" };
|
|
1734
|
-
var ComposioFileUploadError = class extends ComposioError {
|
|
1735
|
-
constructor(message = "Failed to upload file", options = {}) {
|
|
1736
|
-
super(message, {
|
|
1737
|
-
...options,
|
|
1738
|
-
code: FileModifierErrorCodes.FILE_UPLOAD_FAILED,
|
|
1739
|
-
possibleFixes: options.possibleFixes || ["Check if the file exists in the location provided"]
|
|
1740
|
-
});
|
|
1741
|
-
this.name = "ComposioFileUploadError";
|
|
1742
|
-
}
|
|
1743
|
-
};
|
|
1744
|
-
|
|
1745
|
-
//#endregion
|
|
1746
|
-
//#region src/utils/modifiers/FileToolModifier.ts
|
|
1747
|
-
/**
|
|
1748
|
-
* Transforms a single JSON schema property, recursively handling nested properties,
|
|
1749
|
-
* anyOf, oneOf, and allOf.
|
|
1750
|
-
*/
|
|
1751
|
-
const transformSchema = (property) => {
|
|
1752
|
-
if (property.file_uploadable) return {
|
|
1753
|
-
title: property.title,
|
|
1754
|
-
description: property.description,
|
|
1755
|
-
format: "path",
|
|
1756
|
-
type: "string",
|
|
1757
|
-
file_uploadable: true
|
|
1758
|
-
};
|
|
1759
|
-
const newProperty = { ...property };
|
|
1760
|
-
if (property.type === "object" && property.properties) newProperty.properties = transformProperties(property.properties);
|
|
1761
|
-
if (property.anyOf) newProperty.anyOf = property.anyOf.map(transformSchema);
|
|
1762
|
-
if (property.oneOf) newProperty.oneOf = property.oneOf.map(transformSchema);
|
|
1763
|
-
if (property.allOf) newProperty.allOf = property.allOf.map(transformSchema);
|
|
1764
|
-
if (property.items) if (Array.isArray(property.items)) newProperty.items = property.items.map(transformSchema);
|
|
1765
|
-
else newProperty.items = transformSchema(property.items);
|
|
1766
|
-
return newProperty;
|
|
1767
|
-
};
|
|
1768
|
-
/**
|
|
1769
|
-
* Transforms the properties of the tool schema to include the file upload URL.
|
|
1770
|
-
*
|
|
1771
|
-
* Attaches the format: 'path' to the properties that are file uploadable for agents.
|
|
1772
|
-
*
|
|
1773
|
-
* @param properties - The properties of the tool schema.
|
|
1774
|
-
* @returns The transformed properties.
|
|
1775
|
-
*/
|
|
1776
|
-
const transformProperties = (properties) => {
|
|
1777
|
-
const newProperties = {};
|
|
1778
|
-
for (const [key, property] of Object.entries(properties)) newProperties[key] = transformSchema(property);
|
|
1779
|
-
return newProperties;
|
|
1780
|
-
};
|
|
1781
|
-
/**
|
|
1782
|
-
* Recursively checks if a schema (or any of its variants) contains a specific file property.
|
|
1783
|
-
*/
|
|
1784
|
-
const schemaHasFileProperty = (schema, property) => {
|
|
1785
|
-
if (!schema) return false;
|
|
1786
|
-
if (schema[property]) return true;
|
|
1787
|
-
if (schema.properties) {
|
|
1788
|
-
for (const prop of Object.values(schema.properties)) if (schemaHasFileProperty(prop, property)) return true;
|
|
1789
|
-
}
|
|
1790
|
-
if (schema.anyOf) {
|
|
1791
|
-
for (const variant of schema.anyOf) if (schemaHasFileProperty(variant, property)) return true;
|
|
1792
|
-
}
|
|
1793
|
-
if (schema.oneOf) {
|
|
1794
|
-
for (const variant of schema.oneOf) if (schemaHasFileProperty(variant, property)) return true;
|
|
1795
|
-
}
|
|
1796
|
-
if (schema.allOf) {
|
|
1797
|
-
for (const variant of schema.allOf) if (schemaHasFileProperty(variant, property)) return true;
|
|
1798
|
-
}
|
|
1799
|
-
if (schema.items) {
|
|
1800
|
-
if (Array.isArray(schema.items)) {
|
|
1801
|
-
for (const item of schema.items) if (schemaHasFileProperty(item, property)) return true;
|
|
1802
|
-
} else if (schemaHasFileProperty(schema.items, property)) return true;
|
|
1803
|
-
}
|
|
1804
|
-
return false;
|
|
1805
|
-
};
|
|
1806
|
-
/**
|
|
1807
|
-
* Recursively checks if a schema (or any of its variants) contains file_uploadable properties.
|
|
1808
|
-
*/
|
|
1809
|
-
const schemaHasFileUploadable = (schema) => {
|
|
1810
|
-
return schemaHasFileProperty(schema, "file_uploadable");
|
|
1811
|
-
};
|
|
1812
|
-
/**
|
|
1813
|
-
* Recursively checks if a schema (or any of its variants) contains file_downloadable properties.
|
|
1814
|
-
*/
|
|
1815
|
-
const schemaHasFileDownloadable = (schema) => {
|
|
1816
|
-
return schemaHasFileProperty(schema, "file_downloadable");
|
|
1817
|
-
};
|
|
1818
|
-
/**
|
|
1819
|
-
* Recursively walks a runtime value and its matching JSON-Schema node,
|
|
1820
|
-
* uploading any string path whose schema node has `file_uploadable: true`.
|
|
1821
|
-
* The function returns a **new** value with all substitutions applied;
|
|
1822
|
-
* nothing is mutated in-place.
|
|
1823
|
-
*/
|
|
1824
|
-
const hydrateFiles = async (value, schema, ctx) => {
|
|
1825
|
-
if (schema?.file_uploadable) {
|
|
1826
|
-
if (typeof value !== "string" && !(value instanceof File)) return value;
|
|
1827
|
-
logger_default.debug(`Uploading file "${value}"`);
|
|
1828
|
-
return getFileDataAfterUploadingToS3(value, {
|
|
1829
|
-
toolSlug: ctx.toolSlug,
|
|
1830
|
-
toolkitSlug: ctx.toolkitSlug,
|
|
1831
|
-
client: ctx.client
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
const schemaVariants = [
|
|
1835
|
-
...schema?.anyOf ?? [],
|
|
1836
|
-
...schema?.oneOf ?? [],
|
|
1837
|
-
...schema?.allOf ?? []
|
|
1838
|
-
];
|
|
1839
|
-
if (schemaVariants.length > 0) {
|
|
1840
|
-
const uploadableVariants = schemaVariants.filter(schemaHasFileUploadable);
|
|
1841
|
-
if (uploadableVariants.length > 0) {
|
|
1842
|
-
let result = value;
|
|
1843
|
-
for (const variant of uploadableVariants) result = await hydrateFiles(result, variant, ctx);
|
|
1844
|
-
return result;
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
if (schema?.type === "object" && schema.properties && isPlainObject(value)) {
|
|
1848
|
-
const transformed = {};
|
|
1849
|
-
for (const [k, v] of Object.entries(value)) transformed[k] = await hydrateFiles(v, schema.properties[k], ctx);
|
|
1850
|
-
return transformed;
|
|
1851
|
-
}
|
|
1852
|
-
if (schema?.type === "array" && schema.items && Array.isArray(value)) {
|
|
1853
|
-
const itemSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items;
|
|
1854
|
-
return Promise.all(value.map((item) => hydrateFiles(item, itemSchema, ctx)));
|
|
1855
|
-
}
|
|
1856
|
-
return value;
|
|
1857
|
-
};
|
|
1858
|
-
/**
|
|
1859
|
-
* Downloads a file from S3 and returns a replacement object.
|
|
1860
|
-
*/
|
|
1861
|
-
const downloadS3File = async (value, ctx) => {
|
|
1862
|
-
const { s3url, mimetype } = value;
|
|
1863
|
-
try {
|
|
1864
|
-
logger_default.debug(`Downloading from S3: ${s3url}`);
|
|
1865
|
-
const dl = await downloadFileFromS3({
|
|
1866
|
-
toolSlug: ctx.toolSlug,
|
|
1867
|
-
s3Url: s3url,
|
|
1868
|
-
mimeType: mimetype ?? "application/octet-stream"
|
|
1869
|
-
});
|
|
1870
|
-
logger_default.debug(`Downloaded → ${dl.filePath}`);
|
|
1871
|
-
return {
|
|
1872
|
-
uri: dl.filePath,
|
|
1873
|
-
file_downloaded: dl.filePath ? true : false,
|
|
1874
|
-
s3url,
|
|
1875
|
-
mimeType: dl.mimeType
|
|
1876
|
-
};
|
|
1877
|
-
} catch (err) {
|
|
1878
|
-
logger_default.error(`Download failed: ${s3url}`, { cause: err });
|
|
1879
|
-
return {
|
|
1880
|
-
uri: "",
|
|
1881
|
-
file_downloaded: false,
|
|
1882
|
-
s3url,
|
|
1883
|
-
mimeType: mimetype ?? "application/octet-stream"
|
|
1884
|
-
};
|
|
1885
|
-
}
|
|
1886
|
-
};
|
|
1887
|
-
/**
|
|
1888
|
-
* Recursively walks an arbitrary value and its matching JSON-Schema node.
|
|
1889
|
-
* Whenever it encounters an object that represents a file reference
|
|
1890
|
-
* (i.e. has an `s3url`), it downloads the file and returns a replacement:
|
|
1891
|
-
* {
|
|
1892
|
-
* uri: "<local-path>",
|
|
1893
|
-
* file_downloaded: true | false,
|
|
1894
|
-
* s3url: "<original S3 URL>",
|
|
1895
|
-
* mimeType: "<detected-or-fallback-mime-type>"
|
|
1896
|
-
* }
|
|
1897
|
-
*
|
|
1898
|
-
* The function is side-effect-free: it never mutates the input value.
|
|
1899
|
-
*/
|
|
1900
|
-
const hydrateDownloads = async (value, schema, ctx) => {
|
|
1901
|
-
if (isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
|
|
1902
|
-
if (schema?.file_downloadable && isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
|
|
1903
|
-
const schemaVariants = [
|
|
1904
|
-
...schema?.anyOf ?? [],
|
|
1905
|
-
...schema?.oneOf ?? [],
|
|
1906
|
-
...schema?.allOf ?? []
|
|
1907
|
-
];
|
|
1908
|
-
if (schemaVariants.length > 0) {
|
|
1909
|
-
const downloadableVariants = schemaVariants.filter(schemaHasFileDownloadable);
|
|
1910
|
-
let result = value;
|
|
1911
|
-
for (const variant of downloadableVariants) result = await hydrateDownloads(result, variant, ctx);
|
|
1912
|
-
if (downloadableVariants.length === 0) return hydrateDownloads(value, void 0, ctx);
|
|
1913
|
-
return result;
|
|
1914
|
-
}
|
|
1915
|
-
if (isPlainObject(value)) {
|
|
1916
|
-
const pairs = await Promise.all(Object.entries(value).map(async ([k, v]) => [k, await hydrateDownloads(v, schema?.properties?.[k], ctx)]));
|
|
1917
|
-
return Object.fromEntries(pairs);
|
|
1918
|
-
}
|
|
1919
|
-
if (Array.isArray(value)) {
|
|
1920
|
-
const itemSchema = schema?.items ? Array.isArray(schema.items) ? schema.items[0] : schema.items : void 0;
|
|
1921
|
-
return Promise.all(value.map((item) => hydrateDownloads(item, itemSchema, ctx)));
|
|
1922
|
-
}
|
|
1923
|
-
return value;
|
|
1924
|
-
};
|
|
1925
|
-
function isPlainObject(val) {
|
|
1926
|
-
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
1927
|
-
}
|
|
1928
|
-
var FileToolModifier = class {
|
|
1929
|
-
client;
|
|
1930
|
-
constructor(client) {
|
|
1931
|
-
this.client = client;
|
|
1932
|
-
}
|
|
1933
|
-
/**
|
|
1934
|
-
* Modifies the tool schema to include the file upload URL.
|
|
1935
|
-
*
|
|
1936
|
-
* @description This modifier is used to upload a file to the Composio platform and replace the file path with the file upload URL.
|
|
1937
|
-
*
|
|
1938
|
-
* @param _toolSlug - The slug of the tool that is being executed.
|
|
1939
|
-
* @param _toolkitSlug - The slug of the toolkit that is being executed.
|
|
1940
|
-
* @param schema - The schema of the tool.
|
|
1941
|
-
* @returns The schema with the file upload URL included.
|
|
1942
|
-
*/
|
|
1943
|
-
async modifyToolSchema(toolSlug, toolkitSlug, schema) {
|
|
1944
|
-
if (!schema.inputParameters?.properties) return schema;
|
|
1945
|
-
const properties = transformProperties(schema.inputParameters.properties);
|
|
1946
|
-
return {
|
|
1947
|
-
...schema,
|
|
1948
|
-
inputParameters: {
|
|
1949
|
-
...schema.inputParameters,
|
|
1950
|
-
properties
|
|
1951
|
-
}
|
|
1952
|
-
};
|
|
1953
|
-
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Modifies the input parameters to include the file upload URL.
|
|
1956
|
-
*
|
|
1957
|
-
* @description This modifier is used to upload a file to the Composio platform and replace the file path with the file upload URL.
|
|
1958
|
-
*
|
|
1959
|
-
* @param toolSlug - The slug of the tool that is being executed.
|
|
1960
|
-
* @param toolkitSlug - The slug of the toolkit that is being executed.
|
|
1961
|
-
*
|
|
1962
|
-
*/
|
|
1963
|
-
async fileUploadModifier(tool, options) {
|
|
1964
|
-
const { params, toolSlug, toolkitSlug = "unknown" } = options;
|
|
1965
|
-
const { arguments: args } = params;
|
|
1966
|
-
if (!args || typeof args !== "object") return params;
|
|
1967
|
-
try {
|
|
1968
|
-
const newArgs = await hydrateFiles(args, tool.inputParameters, {
|
|
1969
|
-
toolSlug,
|
|
1970
|
-
toolkitSlug,
|
|
1971
|
-
client: this.client
|
|
1972
|
-
});
|
|
1973
|
-
return {
|
|
1974
|
-
...params,
|
|
1975
|
-
arguments: newArgs
|
|
1976
|
-
};
|
|
1977
|
-
} catch (error) {
|
|
1978
|
-
throw new ComposioFileUploadError("Failed to upload file", { cause: error });
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
/**
|
|
1982
|
-
* Modifies the result to include the file download URL.
|
|
1983
|
-
*
|
|
1984
|
-
* @description This modifier is used to download a file and
|
|
1985
|
-
*
|
|
1986
|
-
* @param tool - The tool schema containing output parameters.
|
|
1987
|
-
* @param toolSlug - The slug of the tool that is being executed.
|
|
1988
|
-
* @param toolkitSlug - The slug of the toolkit that is being executed.
|
|
1989
|
-
* @param result - The result of the tool execution.
|
|
1990
|
-
* @returns The result with the file download URL included.
|
|
1991
|
-
*/
|
|
1992
|
-
async fileDownloadModifier(tool, options) {
|
|
1993
|
-
const { result, toolSlug } = options;
|
|
1994
|
-
const dataWithDownloads = await hydrateDownloads(result.data, tool.outputParameters, { toolSlug });
|
|
1995
|
-
return {
|
|
1996
|
-
...result,
|
|
1997
|
-
data: dataWithDownloads
|
|
1998
|
-
};
|
|
1999
|
-
}
|
|
2000
|
-
};
|
|
2001
|
-
|
|
2002
1733
|
//#endregion
|
|
2003
1734
|
//#region src/utils/toolkitVersion.ts
|
|
2004
1735
|
/**
|
|
@@ -2032,8 +1763,8 @@ var Tools = class {
|
|
|
2032
1763
|
this.client = client;
|
|
2033
1764
|
this.customTools = new CustomTools(client);
|
|
2034
1765
|
this.provider = config.provider;
|
|
2035
|
-
this.autoUploadDownloadFiles = config?.autoUploadDownloadFiles ??
|
|
2036
|
-
this.toolkitVersions = config?.toolkitVersions ??
|
|
1766
|
+
this.autoUploadDownloadFiles = config?.autoUploadDownloadFiles ?? CONFIG_DEFAULTS.autoUploadDownloadFiles;
|
|
1767
|
+
this.toolkitVersions = config?.toolkitVersions ?? CONFIG_DEFAULTS.toolkitVersions;
|
|
2037
1768
|
this.execute = this.execute.bind(this);
|
|
2038
1769
|
this.provider._setExecuteToolFn(this.createExecuteFnForProviders());
|
|
2039
1770
|
this.getRawComposioToolBySlug = this.getRawComposioToolBySlug.bind(this);
|
|
@@ -2323,7 +2054,8 @@ var Tools = class {
|
|
|
2323
2054
|
} else logger_default.debug(`Tool ${slug} is not a custom tool. Fetching from Composio API`);
|
|
2324
2055
|
let tool;
|
|
2325
2056
|
try {
|
|
2326
|
-
|
|
2057
|
+
const retrieveParams = options?.version ? { version: options.version } : { toolkit_versions: this.toolkitVersions };
|
|
2058
|
+
tool = await this.client.tools.retrieve(slug, retrieveParams);
|
|
2327
2059
|
} catch (error) {
|
|
2328
2060
|
throw new ComposioToolNotFoundError(`Unable to retrieve tool with slug ${slug}`, { cause: error });
|
|
2329
2061
|
}
|
|
@@ -2541,7 +2273,7 @@ var Tools = class {
|
|
|
2541
2273
|
const executeParams = ToolExecuteParamsSchema.safeParse(body);
|
|
2542
2274
|
if (!executeParams.success) throw new ValidationError("Invalid tool execute parameters", { cause: executeParams.error });
|
|
2543
2275
|
const customTool = await this.customTools.getCustomToolBySlug(slug);
|
|
2544
|
-
const tool = customTool ?? await this.getRawComposioToolBySlug(slug);
|
|
2276
|
+
const tool = customTool ?? await this.getRawComposioToolBySlug(slug, { version: body.version });
|
|
2545
2277
|
const toolkitSlug = tool.toolkit?.slug ?? "unknown";
|
|
2546
2278
|
const params = await this.applyBeforeExecuteModifiers(tool, {
|
|
2547
2279
|
toolSlug: slug,
|
|
@@ -4242,6 +3974,31 @@ function transformTriggerInstanceListActiveResponse(response) {
|
|
|
4242
3974
|
}));
|
|
4243
3975
|
}
|
|
4244
3976
|
|
|
3977
|
+
//#endregion
|
|
3978
|
+
//#region src/utils/crypto.ts
|
|
3979
|
+
/**
|
|
3980
|
+
* Computes HMAC-SHA256 using Web Crypto API
|
|
3981
|
+
*/
|
|
3982
|
+
async function hmacSha256Base64(secret, message) {
|
|
3983
|
+
const encoder = new TextEncoder();
|
|
3984
|
+
const keyData = encoder.encode(secret);
|
|
3985
|
+
const key = await globalThis.crypto.subtle.importKey("raw", keyData, {
|
|
3986
|
+
name: "HMAC",
|
|
3987
|
+
hash: "SHA-256"
|
|
3988
|
+
}, false, ["sign"]);
|
|
3989
|
+
const signatureData = encoder.encode(message);
|
|
3990
|
+
return arrayBufferToBase64(await globalThis.crypto.subtle.sign("HMAC", key, signatureData));
|
|
3991
|
+
}
|
|
3992
|
+
/**
|
|
3993
|
+
* Constant-time comparison of two strings to prevent timing attacks
|
|
3994
|
+
*/
|
|
3995
|
+
function timingSafeEqual(a, b) {
|
|
3996
|
+
if (a.length !== b.length) return false;
|
|
3997
|
+
let result = 0;
|
|
3998
|
+
for (let i = 0; i < a.length; i++) result |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
3999
|
+
return result === 0;
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4245
4002
|
//#endregion
|
|
4246
4003
|
//#region src/models/Triggers.ts
|
|
4247
4004
|
/**
|
|
@@ -4256,7 +4013,7 @@ var Triggers = class {
|
|
|
4256
4013
|
constructor(client, config) {
|
|
4257
4014
|
this.client = client;
|
|
4258
4015
|
this.pusherService = new PusherService(client);
|
|
4259
|
-
this.toolkitVersions = config?.toolkitVersions ??
|
|
4016
|
+
this.toolkitVersions = config?.toolkitVersions ?? CONFIG_DEFAULTS.toolkitVersions;
|
|
4260
4017
|
telemetry.instrument(this, "Triggers");
|
|
4261
4018
|
}
|
|
4262
4019
|
/**
|
|
@@ -4530,9 +4287,9 @@ var Triggers = class {
|
|
|
4530
4287
|
* @example
|
|
4531
4288
|
* ```ts
|
|
4532
4289
|
* // In an Express.js webhook handler
|
|
4533
|
-
* app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
|
|
4290
|
+
* app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
|
|
4534
4291
|
* try {
|
|
4535
|
-
* const result = composio.triggers.verifyWebhook({
|
|
4292
|
+
* const result = await composio.triggers.verifyWebhook({
|
|
4536
4293
|
* payload: req.body.toString(),
|
|
4537
4294
|
* signature: req.headers['webhook-signature'] as string,
|
|
4538
4295
|
* webhookId: req.headers['webhook-id'] as string,
|
|
@@ -4551,12 +4308,12 @@ var Triggers = class {
|
|
|
4551
4308
|
* });
|
|
4552
4309
|
* ```
|
|
4553
4310
|
*/
|
|
4554
|
-
verifyWebhook(params) {
|
|
4311
|
+
async verifyWebhook(params) {
|
|
4555
4312
|
const parsedParams = VerifyWebhookParamsSchema.safeParse(params);
|
|
4556
4313
|
if (!parsedParams.success) throw new ValidationError("Invalid parameters passed to verifyWebhook", { cause: parsedParams.error });
|
|
4557
4314
|
const { payload, signature, secret, id: webhookId, timestamp: webhookTimestamp, tolerance } = parsedParams.data;
|
|
4558
4315
|
if (tolerance > 0) this.validateWebhookTimestamp(webhookTimestamp, tolerance);
|
|
4559
|
-
this.verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret);
|
|
4316
|
+
await this.verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret);
|
|
4560
4317
|
const { version: version$1, rawPayload, normalizedPayload } = this.parseWebhookPayload(payload);
|
|
4561
4318
|
return {
|
|
4562
4319
|
version: version$1,
|
|
@@ -4702,7 +4459,7 @@ var Triggers = class {
|
|
|
4702
4459
|
* The signing input is: `${msgId}.${timestamp}.${payload}`
|
|
4703
4460
|
* @private
|
|
4704
4461
|
*/
|
|
4705
|
-
verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret) {
|
|
4462
|
+
async verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret) {
|
|
4706
4463
|
if (payload.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook payload was provided.");
|
|
4707
4464
|
if (signature.length === 0) throw new ComposioWebhookSignatureVerificationError("No signature header value was provided. Please pass the value of the 'webhook-signature' header.");
|
|
4708
4465
|
if (secret.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook secret was provided. You can find your webhook secret in your Composio dashboard.");
|
|
@@ -4715,16 +4472,11 @@ var Triggers = class {
|
|
|
4715
4472
|
if (version$1 === "v1" && value) v1Signatures.push(value);
|
|
4716
4473
|
}
|
|
4717
4474
|
if (v1Signatures.length === 0) throw new ComposioWebhookSignatureVerificationError("No valid v1 signature found in the webhook-signature header. Expected format: 'v1,base64EncodedSignature'");
|
|
4718
|
-
const
|
|
4719
|
-
const expectedSignature = crypto$1.createHmac("sha256", secret).update(toSign, "utf8").digest("base64");
|
|
4475
|
+
const expectedSignature = await hmacSha256Base64(secret, `${webhookId}.${webhookTimestamp}.${payload}`);
|
|
4720
4476
|
let isValid = false;
|
|
4721
|
-
for (const providedSignature of v1Signatures) {
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
if (signatureBuffer.length === expectedBuffer.length && crypto$1.timingSafeEqual(signatureBuffer, expectedBuffer)) {
|
|
4725
|
-
isValid = true;
|
|
4726
|
-
break;
|
|
4727
|
-
}
|
|
4477
|
+
for (const providedSignature of v1Signatures) if (timingSafeEqual(providedSignature, expectedSignature)) {
|
|
4478
|
+
isValid = true;
|
|
4479
|
+
break;
|
|
4728
4480
|
}
|
|
4729
4481
|
if (!isValid) throw new ComposioWebhookSignatureVerificationError("The signature provided is invalid. Please ensure you are using the correct webhook secret.");
|
|
4730
4482
|
}
|
|
@@ -5723,7 +5475,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5723
5475
|
|
|
5724
5476
|
//#endregion
|
|
5725
5477
|
//#region package.json
|
|
5726
|
-
var version = "0.
|
|
5478
|
+
var version = "0.6.0";
|
|
5727
5479
|
|
|
5728
5480
|
//#endregion
|
|
5729
5481
|
//#region src/utils/session.ts
|
|
@@ -6248,8 +6000,8 @@ var Composio = class Composio {
|
|
|
6248
6000
|
baseURL: baseURLParsed,
|
|
6249
6001
|
apiKey: apiKeyParsed,
|
|
6250
6002
|
toolkitVersions: getToolkitVersionsFromEnv(config?.toolkitVersions),
|
|
6251
|
-
allowTracking: config?.allowTracking ??
|
|
6252
|
-
autoUploadDownloadFiles: config?.autoUploadDownloadFiles ??
|
|
6003
|
+
allowTracking: config?.allowTracking ?? CONFIG_DEFAULTS.allowTracking,
|
|
6004
|
+
autoUploadDownloadFiles: config?.autoUploadDownloadFiles ?? CONFIG_DEFAULTS.autoUploadDownloadFiles,
|
|
6253
6005
|
provider: config?.provider ?? this.provider
|
|
6254
6006
|
};
|
|
6255
6007
|
/**
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
require('../buffer-CYf1Z6Sd.cjs');
|
|
2
|
+
const require_Telemetry = require('../Telemetry-DErMJqj0.cjs');
|
|
3
|
+
const require_fileUtils_node = require('../fileUtils.node-BJQeDcfa.cjs');
|
|
2
4
|
|
|
3
5
|
//#region src/models/Files.node.ts
|
|
4
6
|
var Files = class {
|
|
5
7
|
constructor(client) {
|
|
6
8
|
this.client = client;
|
|
7
|
-
|
|
9
|
+
require_Telemetry.telemetry.instrument(this, "Files");
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Upload a file and return the file data.
|
|
@@ -24,7 +26,7 @@ var Files = class {
|
|
|
24
26
|
* });
|
|
25
27
|
* */
|
|
26
28
|
async upload({ file, toolSlug, toolkitSlug }) {
|
|
27
|
-
return await
|
|
29
|
+
return await require_fileUtils_node.getFileDataAfterUploadingToS3(file, {
|
|
28
30
|
toolSlug,
|
|
29
31
|
toolkitSlug,
|
|
30
32
|
client: this.client
|
|
@@ -36,7 +38,7 @@ var Files = class {
|
|
|
36
38
|
* @returns The file data.
|
|
37
39
|
*/
|
|
38
40
|
async download({ toolSlug, s3Url, mimeType }) {
|
|
39
|
-
return await
|
|
41
|
+
return await require_fileUtils_node.downloadFileFromS3({
|
|
40
42
|
toolSlug,
|
|
41
43
|
s3Url,
|
|
42
44
|
mimeType
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import
|
|
1
|
+
import "../chunk-Dx2NuYGI.mjs";
|
|
2
|
+
import "../buffer-BFpVRahf.mjs";
|
|
3
|
+
import { t as telemetry } from "../Telemetry-Bn5VseVi.mjs";
|
|
4
|
+
import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-C6fQOgF0.mjs";
|
|
3
5
|
|
|
4
6
|
//#region src/models/Files.node.ts
|
|
5
7
|
var Files = class {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/models/Files.workerd.ts
|
|
3
|
-
const UNSUPPORTED_MESSAGE = "File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (
|
|
3
|
+
const UNSUPPORTED_MESSAGE = "File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (e.g., `node:crypto`, `node:fs`) that are not available in this environment. Please use a Node.js runtime for file operations.";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a Proxy that throws a user-friendly error when any method is accessed.
|
|
6
6
|
* This ensures that users get a clear error message when attempting to use
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/models/Files.workerd.ts
|
|
2
|
-
const UNSUPPORTED_MESSAGE = "File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (
|
|
2
|
+
const UNSUPPORTED_MESSAGE = "File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (e.g., `node:crypto`, `node:fs`) that are not available in this environment. Please use a Node.js runtime for file operations.";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Proxy that throws a user-friendly error when any method is accessed.
|
|
5
5
|
* This ensures that users get a clear error message when attempting to use
|
package/dist/platform/node.cjs
CHANGED
|
@@ -33,11 +33,14 @@ const platform = {
|
|
|
33
33
|
node_fs.mkdirSync(dirPath, { recursive: true });
|
|
34
34
|
},
|
|
35
35
|
readFileSync(filePath, encoding) {
|
|
36
|
-
if (encoding
|
|
37
|
-
|
|
36
|
+
if (encoding === void 0) {
|
|
37
|
+
const buf = node_fs.readFileSync(filePath, { encoding: null });
|
|
38
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
39
|
+
}
|
|
40
|
+
return node_fs.readFileSync(filePath, { encoding });
|
|
38
41
|
},
|
|
39
42
|
writeFileSync(filePath, content, encoding) {
|
|
40
|
-
if (encoding && typeof content === "string") node_fs.writeFileSync(filePath, content, encoding);
|
|
43
|
+
if (encoding && typeof content === "string") node_fs.writeFileSync(filePath, content, { encoding });
|
|
41
44
|
else node_fs.writeFileSync(filePath, content);
|
|
42
45
|
}
|
|
43
46
|
};
|
package/dist/platform/node.d.cts
CHANGED
package/dist/platform/node.d.mts
CHANGED
package/dist/platform/node.mjs
CHANGED
|
@@ -29,11 +29,14 @@ const platform = {
|
|
|
29
29
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
30
30
|
},
|
|
31
31
|
readFileSync(filePath, encoding) {
|
|
32
|
-
if (encoding
|
|
33
|
-
|
|
32
|
+
if (encoding === void 0) {
|
|
33
|
+
const buf = fs.readFileSync(filePath, { encoding: null });
|
|
34
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
35
|
+
}
|
|
36
|
+
return fs.readFileSync(filePath, { encoding });
|
|
34
37
|
},
|
|
35
38
|
writeFileSync(filePath, content, encoding) {
|
|
36
|
-
if (encoding && typeof content === "string") fs.writeFileSync(filePath, content, encoding);
|
|
39
|
+
if (encoding && typeof content === "string") fs.writeFileSync(filePath, content, { encoding });
|
|
37
40
|
else fs.writeFileSync(filePath, content);
|
|
38
41
|
}
|
|
39
42
|
};
|
|
@@ -35,22 +35,25 @@ interface Platform {
|
|
|
35
35
|
/**
|
|
36
36
|
* Reads a file synchronously and returns its contents.
|
|
37
37
|
* @param filePath - The path to the file.
|
|
38
|
-
* @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns
|
|
39
|
-
* @returns The file contents as a string (if encoding provided) or
|
|
38
|
+
* @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns an Uint8Array.
|
|
39
|
+
* @returns The file contents as a string (if encoding provided) or Uint8Array.
|
|
40
40
|
*/
|
|
41
|
-
readFileSync(filePath: string, encoding?:
|
|
41
|
+
readFileSync(filePath: string, encoding?: never): Uint8Array;
|
|
42
|
+
readFileSync(filePath: string, encoding: Uint8ArrayEncoding): string;
|
|
42
43
|
/**
|
|
43
44
|
* Writes content to a file synchronously.
|
|
44
45
|
* @param filePath - The path to the file.
|
|
45
|
-
* @param content - The content to write (string or
|
|
46
|
+
* @param content - The content to write (string or Uint8Array).
|
|
46
47
|
* @param encoding - Optional encoding for string content.
|
|
47
48
|
*/
|
|
48
|
-
writeFileSync(filePath: string, content:
|
|
49
|
+
writeFileSync(filePath: string, content: Uint8Array, encoding?: never): void;
|
|
50
|
+
writeFileSync(filePath: string, content: string, encoding: Uint8ArrayEncoding): void;
|
|
49
51
|
/**
|
|
50
52
|
* Indicates whether this platform supports file system operations.
|
|
51
53
|
* Edge runtimes like Cloudflare Workers return false.
|
|
52
54
|
*/
|
|
53
55
|
readonly supportsFileSystem: boolean;
|
|
54
56
|
}
|
|
57
|
+
type Uint8ArrayEncoding = 'utf8';
|
|
55
58
|
//#endregion
|
|
56
59
|
export { Platform as t };
|
|
@@ -35,22 +35,25 @@ interface Platform {
|
|
|
35
35
|
/**
|
|
36
36
|
* Reads a file synchronously and returns its contents.
|
|
37
37
|
* @param filePath - The path to the file.
|
|
38
|
-
* @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns
|
|
39
|
-
* @returns The file contents as a string (if encoding provided) or
|
|
38
|
+
* @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns an Uint8Array.
|
|
39
|
+
* @returns The file contents as a string (if encoding provided) or Uint8Array.
|
|
40
40
|
*/
|
|
41
|
-
readFileSync(filePath: string, encoding?:
|
|
41
|
+
readFileSync(filePath: string, encoding?: never): Uint8Array;
|
|
42
|
+
readFileSync(filePath: string, encoding: Uint8ArrayEncoding): string;
|
|
42
43
|
/**
|
|
43
44
|
* Writes content to a file synchronously.
|
|
44
45
|
* @param filePath - The path to the file.
|
|
45
|
-
* @param content - The content to write (string or
|
|
46
|
+
* @param content - The content to write (string or Uint8Array).
|
|
46
47
|
* @param encoding - Optional encoding for string content.
|
|
47
48
|
*/
|
|
48
|
-
writeFileSync(filePath: string, content:
|
|
49
|
+
writeFileSync(filePath: string, content: Uint8Array, encoding?: never): void;
|
|
50
|
+
writeFileSync(filePath: string, content: string, encoding: Uint8ArrayEncoding): void;
|
|
49
51
|
/**
|
|
50
52
|
* Indicates whether this platform supports file system operations.
|
|
51
53
|
* Edge runtimes like Cloudflare Workers return false.
|
|
52
54
|
*/
|
|
53
55
|
readonly supportsFileSystem: boolean;
|
|
54
56
|
}
|
|
57
|
+
type Uint8ArrayEncoding = 'utf8';
|
|
55
58
|
//#endregion
|
|
56
59
|
export { Platform as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as BaseComposioProvider } from "./BaseProvider-D1UCDu8V.mjs";
|
|
2
|
+
import { n as ComposioConfig } from "./composio-DtAsGWh4.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/config-defaults/types.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration defaults for Composio.
|
|
8
|
+
* These are the required fields that must have default values.
|
|
9
|
+
* The provider type is set to never since defaults don't include a provider instance.
|
|
10
|
+
*/
|
|
11
|
+
type ConfigDefaults = Required<Pick<ComposioConfig<BaseComposioProvider<never, never, never>>, 'autoUploadDownloadFiles' | 'allowTracking' | 'toolkitVersions'>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ConfigDefaults as t };
|