@composio/core 0.1.11-alpha.0 → 0.1.12-alpha.10
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/README.md +27 -7
- package/dist/index.cjs +894 -452
- package/dist/index.d.cts +957 -169
- package/dist/index.d.ts +957 -169
- package/dist/index.js +893 -452
- package/package.json +13 -12
- package/src/index.ts +0 -23
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ToolProxyParams, ToolProxyResponse, ToolRetrieveEnumResponse, ToolGetIn
|
|
|
4
4
|
import { RequestOptions } from '@composio/client/internal/request-options';
|
|
5
5
|
import { TriggerInstanceListActiveParams, TriggerInstanceUpsertParams, TriggerInstanceUpsertResponse, TriggerInstanceRemoveUpsertResponse, TriggerInstanceUpdateStatusParams, TriggersTypeListParams, TriggersTypeListResponse, TriggersTypeRetrieveResponse, TriggersTypeRetrieveEnumResponse } from '@composio/client/resources/index';
|
|
6
6
|
import { AuthConfigUpdateResponse, AuthConfigDeleteResponse, AuthConfigUpdateStatusResponse } from '@composio/client/resources/auth-configs';
|
|
7
|
-
import {
|
|
7
|
+
import { ConnectedAccountRetrieveResponse as ConnectedAccountRetrieveResponse$1, ConnectedAccountListResponse as ConnectedAccountListResponse$1, ConnectedAccountDeleteResponse, ConnectedAccountRefreshResponse, ConnectedAccountUpdateStatusParams, ConnectedAccountUpdateStatusResponse } from '@composio/client/resources/connected-accounts';
|
|
8
8
|
import { OpenAI } from 'openai';
|
|
9
9
|
import { Stream } from 'openai/streaming';
|
|
10
10
|
|
|
@@ -359,47 +359,294 @@ declare abstract class BaseAgenticProvider<TToolCollection, TTool> extends BaseP
|
|
|
359
359
|
type BaseComposioProvider<TToolCollection, TTool> = BaseNonAgenticProvider<TToolCollection, TTool> | BaseAgenticProvider<TToolCollection, TTool>;
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
|
-
* Modifier for altering the tool execute
|
|
363
|
-
*
|
|
362
|
+
* Modifier for altering the tool execute parameters before execution.
|
|
363
|
+
*
|
|
364
|
+
* This function allows you to intercept and modify the parameters being passed to a tool
|
|
365
|
+
* before the actual execution happens. Common use cases include:
|
|
366
|
+
* - Adding or modifying authentication parameters
|
|
367
|
+
* - Transforming input data to match expected formats
|
|
368
|
+
* - Adding contextual information to the request
|
|
369
|
+
* - Implementing request validation or normalization
|
|
370
|
+
*
|
|
371
|
+
* @param {string} toolSlug - The slug identifier of the tool being executed
|
|
372
|
+
* @param {string} toolkitSlug - The slug identifier of the toolkit containing the tool
|
|
373
|
+
* @param {ToolExecuteParams} toolExecuteParams - The original execution parameters
|
|
374
|
+
* @returns {ToolExecuteParams} The modified execution parameters
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* // Add authentication headers to all tool requests
|
|
379
|
+
* const beforeExecute = (toolSlug, toolkitSlug, params) => {
|
|
380
|
+
* return {
|
|
381
|
+
* ...params,
|
|
382
|
+
* customAuthParams: {
|
|
383
|
+
* ...params.customAuthParams,
|
|
384
|
+
* headers: {
|
|
385
|
+
* ...params.customAuthParams?.headers,
|
|
386
|
+
* 'X-API-Key': 'my-api-key'
|
|
387
|
+
* }
|
|
388
|
+
* }
|
|
389
|
+
* };
|
|
390
|
+
* };
|
|
391
|
+
*
|
|
392
|
+
* // Transform input parameters for a specific tool
|
|
393
|
+
* const beforeExecute = (toolSlug, toolkitSlug, params) => {
|
|
394
|
+
* if (toolSlug === 'GITHUB_SEARCH_REPOS') {
|
|
395
|
+
* // Convert simple query to structured query format
|
|
396
|
+
* return {
|
|
397
|
+
* ...params,
|
|
398
|
+
* arguments: {
|
|
399
|
+
* ...params.arguments,
|
|
400
|
+
* q: `${params.arguments.query} in:name,description`
|
|
401
|
+
* }
|
|
402
|
+
* };
|
|
403
|
+
* }
|
|
404
|
+
* return params;
|
|
405
|
+
* };
|
|
406
|
+
* ```
|
|
364
407
|
*/
|
|
365
|
-
type
|
|
408
|
+
type beforeExecuteModifier = (toolSlug: string, toolkitSlug: string, toolExecuteParams: ToolExecuteParams) => ToolExecuteParams;
|
|
366
409
|
/**
|
|
367
|
-
* Modifier for altering the tool
|
|
368
|
-
*
|
|
410
|
+
* Modifier for altering the tool execution response after execution completes.
|
|
411
|
+
*
|
|
412
|
+
* This function allows you to intercept and modify the response returned from a tool
|
|
413
|
+
* after its execution has completed. Common use cases include:
|
|
414
|
+
* - Transforming response data into a more convenient format
|
|
415
|
+
* - Handling or enhancing error responses
|
|
416
|
+
* - Adding additional context or derived data to successful responses
|
|
417
|
+
* - Implementing cross-cutting concerns like logging or analytics
|
|
418
|
+
*
|
|
419
|
+
* @param {string} toolSlug - The slug identifier of the tool that was executed
|
|
420
|
+
* @param {string} toolkitSlug - The slug identifier of the toolkit containing the tool
|
|
421
|
+
* @param {ToolExecuteResponse} toolExecuteResponse - The original execution response
|
|
422
|
+
* @returns {ToolExecuteResponse} The modified execution response
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```typescript
|
|
426
|
+
* // Transform the response data format
|
|
427
|
+
* const afterExecute = (toolSlug, toolkitSlug, response) => {
|
|
428
|
+
* if (toolSlug === 'GITHUB_LIST_REPOS' && response.successful) {
|
|
429
|
+
* // Transform the returned repos into a simpler format
|
|
430
|
+
* return {
|
|
431
|
+
* ...response,
|
|
432
|
+
* data: {
|
|
433
|
+
* repositories: response.data.items.map(repo => ({
|
|
434
|
+
* name: repo.name,
|
|
435
|
+
* url: repo.html_url,
|
|
436
|
+
* stars: repo.stargazers_count
|
|
437
|
+
* }))
|
|
438
|
+
* }
|
|
439
|
+
* };
|
|
440
|
+
* }
|
|
441
|
+
* return response;
|
|
442
|
+
* };
|
|
443
|
+
*
|
|
444
|
+
* // Add error handling with custom messages
|
|
445
|
+
* const afterExecute = (toolSlug, toolkitSlug, response) => {
|
|
446
|
+
* if (!response.successful) {
|
|
447
|
+
* return {
|
|
448
|
+
* ...response,
|
|
449
|
+
* error: {
|
|
450
|
+
* message: `Error using ${toolSlug}: ${response.error?.message || 'Unknown error'}`,
|
|
451
|
+
* code: response.error?.code || 'UNKNOWN_ERROR'
|
|
452
|
+
* }
|
|
453
|
+
* };
|
|
454
|
+
* }
|
|
455
|
+
* return response;
|
|
456
|
+
* };
|
|
457
|
+
* ```
|
|
369
458
|
*/
|
|
370
|
-
type
|
|
459
|
+
type afterExecuteModifier = (toolSlug: string, toolkitSlug: string, toolExecuteResponse: ToolExecuteResponse) => ToolExecuteResponse;
|
|
371
460
|
/**
|
|
372
|
-
* Modifier for altering the tool schema
|
|
373
|
-
*
|
|
461
|
+
* Modifier for altering the tool schema before it's exposed to consumers.
|
|
462
|
+
*
|
|
463
|
+
* This function allows you to customize the metadata, parameters, and behavior definitions
|
|
464
|
+
* of tools before they are used. Common use cases include:
|
|
465
|
+
* - Customizing input parameter definitions or descriptions
|
|
466
|
+
* - Adding, removing, or modifying parameters to match your application's needs
|
|
467
|
+
* - Changing the name or description of tools to better fit your context
|
|
468
|
+
* - Implementing versioning or feature flagging for tool schemas
|
|
469
|
+
*
|
|
470
|
+
* @param {string} toolSlug - The slug identifier of the tool being modified
|
|
471
|
+
* @param {string} toolkitSlug - The slug identifier of the toolkit containing the tool
|
|
472
|
+
* @param {Tool} toolSchema - The original tool schema
|
|
473
|
+
* @returns {Tool} The modified tool schema
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* // Modify the input parameters for a specific tool
|
|
478
|
+
* const modifySchema = (toolSlug, toolkitSlug, toolSchema) => {
|
|
479
|
+
* if (toolSlug === 'HACKERNEWS_GET_USER') {
|
|
480
|
+
* return {
|
|
481
|
+
* ...toolSchema,
|
|
482
|
+
* inputParameters: {
|
|
483
|
+
* ...toolSchema.inputParameters,
|
|
484
|
+
* userId: {
|
|
485
|
+
* type: 'string',
|
|
486
|
+
* description: 'The HackerNews username to retrieve information for',
|
|
487
|
+
* required: true
|
|
488
|
+
* }
|
|
489
|
+
* }
|
|
490
|
+
* };
|
|
491
|
+
* }
|
|
492
|
+
* return toolSchema;
|
|
493
|
+
* };
|
|
494
|
+
*
|
|
495
|
+
* // Add custom descriptions to all tools in a toolkit
|
|
496
|
+
* const modifySchema = (toolSlug, toolkitSlug, toolSchema) => {
|
|
497
|
+
* if (toolkitSlug === 'github') {
|
|
498
|
+
* return {
|
|
499
|
+
* ...toolSchema,
|
|
500
|
+
* description: `Company GitHub tool: ${toolSchema.description}`,
|
|
501
|
+
* important: true
|
|
502
|
+
* };
|
|
503
|
+
* }
|
|
504
|
+
* return toolSchema;
|
|
505
|
+
* };
|
|
506
|
+
*
|
|
507
|
+
* // Simplify tool schemas for a specific consumer
|
|
508
|
+
* const modifySchema = (toolSlug, toolkitSlug, toolSchema) => {
|
|
509
|
+
* // Remove advanced or complex parameters
|
|
510
|
+
* const { complexParam1, complexParam2, ...simpleInputParams } = toolSchema.inputParameters;
|
|
511
|
+
*
|
|
512
|
+
* return {
|
|
513
|
+
* ...toolSchema,
|
|
514
|
+
* inputParameters: simpleInputParams
|
|
515
|
+
* };
|
|
516
|
+
* };
|
|
517
|
+
* ```
|
|
374
518
|
*/
|
|
375
519
|
type TransformToolSchemaModifier = (toolSlug: string, toolkitSlug: string, toolSchema: Tool) => Tool;
|
|
376
520
|
/**
|
|
377
|
-
*
|
|
521
|
+
* Options for non-agentic tool configuration.
|
|
522
|
+
*
|
|
523
|
+
* These options are used when working with non-agentic tool providers to
|
|
524
|
+
* customize the behavior of tools through schema transformation.
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```typescript
|
|
528
|
+
* // Configure tools with schema modification
|
|
529
|
+
* const tools = await composio.tools.get('default', {
|
|
530
|
+
* toolkits: ['github']
|
|
531
|
+
* }, {
|
|
532
|
+
* modifySchema: (toolSlug, toolkitSlug, schema) => {
|
|
533
|
+
* // Custom schema modifications
|
|
534
|
+
* return schema;
|
|
535
|
+
* }
|
|
536
|
+
* });
|
|
537
|
+
* ```
|
|
378
538
|
*/
|
|
379
539
|
type ToolOptions = {
|
|
380
540
|
/**
|
|
381
|
-
*
|
|
541
|
+
* Function to transform tool schemas before they're exposed to consumers.
|
|
542
|
+
* This allows customizing input/output parameters, descriptions, and other metadata.
|
|
382
543
|
*/
|
|
383
|
-
|
|
544
|
+
modifySchema?: TransformToolSchemaModifier;
|
|
384
545
|
};
|
|
385
546
|
/**
|
|
386
|
-
*
|
|
387
|
-
*
|
|
547
|
+
* Options for configuring tool execution behavior.
|
|
548
|
+
*
|
|
549
|
+
* These modifiers allow you to intercept and modify tool execution at both
|
|
550
|
+
* the request and response stages, enabling custom behavior, data transformation,
|
|
551
|
+
* error handling, and more.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```typescript
|
|
555
|
+
* // Execute a tool with request and response modifications
|
|
556
|
+
* const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
557
|
+
* userId: 'default',
|
|
558
|
+
* arguments: { owner: 'composio' }
|
|
559
|
+
* }, {
|
|
560
|
+
* beforeExecute: (toolSlug, toolkitSlug, params) => {
|
|
561
|
+
* console.log(`Executing ${toolSlug} from ${toolkitSlug}`);
|
|
562
|
+
* return params;
|
|
563
|
+
* },
|
|
564
|
+
* afterExecute: (toolSlug, toolkitSlug, response) => {
|
|
565
|
+
* if (response.successful) {
|
|
566
|
+
* console.log(`Successfully executed ${toolSlug}`);
|
|
567
|
+
* }
|
|
568
|
+
* return response;
|
|
569
|
+
* }
|
|
570
|
+
* });
|
|
571
|
+
* ```
|
|
388
572
|
*/
|
|
389
573
|
type ExecuteToolModifiers = {
|
|
390
574
|
/**
|
|
391
|
-
*
|
|
575
|
+
* Function to intercept and modify tool execution parameters before the tool is executed.
|
|
576
|
+
* This allows customizing the request based on tool-specific needs.
|
|
392
577
|
*/
|
|
393
|
-
|
|
578
|
+
beforeExecute?: beforeExecuteModifier;
|
|
394
579
|
/**
|
|
395
|
-
*
|
|
580
|
+
* Function to intercept and modify tool execution responses after the tool has executed.
|
|
581
|
+
* This allows transforming the response or implementing custom error handling.
|
|
396
582
|
*/
|
|
397
|
-
|
|
583
|
+
afterExecute?: afterExecuteModifier;
|
|
398
584
|
};
|
|
399
585
|
/**
|
|
400
|
-
*
|
|
586
|
+
* Options for agentic tool configuration.
|
|
587
|
+
*
|
|
588
|
+
* These options combine schema modification capabilities with execution behavior
|
|
589
|
+
* customization, providing full control over both the definition and execution
|
|
590
|
+
* of tools in agentic contexts (like LLM providers).
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```typescript
|
|
594
|
+
* // Configure agentic tools with schema and execution modifications
|
|
595
|
+
* const agenticTools = await vercel.tools.get('default', 'GITHUB_GET_REPOS', {
|
|
596
|
+
* modifySchema: (toolSlug, toolkitSlug, schema) => {
|
|
597
|
+
* return {
|
|
598
|
+
* ...schema,
|
|
599
|
+
* description: `Enhanced ${toolSlug} for better context`
|
|
600
|
+
* };
|
|
601
|
+
* },
|
|
602
|
+
*
|
|
603
|
+
* // Intercept before execution
|
|
604
|
+
* beforeExecute: (toolSlug, toolkitSlug, params) => {
|
|
605
|
+
* // Add analytics tracking
|
|
606
|
+
* trackToolUsage(toolSlug);
|
|
607
|
+
* return params;
|
|
608
|
+
* },
|
|
609
|
+
*
|
|
610
|
+
* // Transform after execution
|
|
611
|
+
* afterExecute: (toolSlug, toolkitSlug, response) => {
|
|
612
|
+
* // Log results and handle errors
|
|
613
|
+
* if (!response.successful) {
|
|
614
|
+
* logToolError(toolSlug, response.error);
|
|
615
|
+
* }
|
|
616
|
+
* return response;
|
|
617
|
+
* }
|
|
618
|
+
* });
|
|
619
|
+
* ```
|
|
401
620
|
*/
|
|
402
621
|
type AgenticToolOptions = ToolOptions & ExecuteToolModifiers;
|
|
622
|
+
/**
|
|
623
|
+
* Provider-specific options determined by the type of provider being used.
|
|
624
|
+
*
|
|
625
|
+
* This type automatically resolves to either AgenticToolOptions or ToolOptions
|
|
626
|
+
* based on whether the provider is agentic (like OpenAI or Vercel) or non-agentic.
|
|
627
|
+
*
|
|
628
|
+
* @template T - The provider type
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```typescript
|
|
632
|
+
* // With standard provider (non-agentic)
|
|
633
|
+
* const tools = await composio.tools.get('default', 'GITHUB_GET_REPOS', {
|
|
634
|
+
* modifySchema: (toolSlug, toolkitSlug, schema) => schema
|
|
635
|
+
* });
|
|
636
|
+
*
|
|
637
|
+
* // With agentic provider (e.g., VercelProvider)
|
|
638
|
+
* const vercel = new Composio({
|
|
639
|
+
* apiKey: process.env.COMPOSIO_API_KEY,
|
|
640
|
+
* provider: new VercelProvider()
|
|
641
|
+
* });
|
|
642
|
+
*
|
|
643
|
+
* const agenticTools = await vercel.tools.get('default', 'GITHUB_GET_REPOS', {
|
|
644
|
+
* modifySchema: (toolSlug, toolkitSlug, schema) => schema,
|
|
645
|
+
* beforeExecute: (toolSlug, toolkitSlug, params) => params,
|
|
646
|
+
* afterExecute: (toolSlug, toolkitSlug, response) => response
|
|
647
|
+
* });
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
403
650
|
type ProviderOptions<T extends BaseComposioProvider<unknown, unknown>> = T extends BaseAgenticProvider<unknown, unknown> ? AgenticToolOptions : ToolOptions;
|
|
404
651
|
|
|
405
652
|
/**
|
|
@@ -412,15 +659,27 @@ declare class Tools<TToolCollection, TTool, TProvider extends BaseComposioProvid
|
|
|
412
659
|
private provider;
|
|
413
660
|
constructor(client: ComposioClient, provider: TProvider);
|
|
414
661
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
662
|
+
* Transforms tool data from snake_case API format to camelCase for internal SDK use.
|
|
663
|
+
*
|
|
664
|
+
* This method standardizes the property naming convention for tools retrieved from the Composio API,
|
|
665
|
+
* making them more consistent with JavaScript/TypeScript conventions.
|
|
666
|
+
*
|
|
667
|
+
* @param {ToolRetrieveResponse | ComposioToolListResponse['items'][0]} tool - The tool object to transform
|
|
668
|
+
* @returns {Tool} The transformed tool with camelCase properties
|
|
669
|
+
*
|
|
670
|
+
* @private
|
|
418
671
|
*/
|
|
419
672
|
private transformToolCases;
|
|
420
673
|
/**
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
674
|
+
* Transforms tool execution response from snake_case API format to camelCase.
|
|
675
|
+
*
|
|
676
|
+
* This method converts the response received from the Composio API to a standardized format
|
|
677
|
+
* with consistent property naming that follows JavaScript/TypeScript conventions.
|
|
678
|
+
*
|
|
679
|
+
* @param {ComposioToolExecuteResponse} response - The raw API response to transform
|
|
680
|
+
* @returns {ToolExecuteResponse} The transformed response with camelCase properties
|
|
681
|
+
*
|
|
682
|
+
* @private
|
|
424
683
|
*/
|
|
425
684
|
private transformToolExecuteResponse;
|
|
426
685
|
/**
|
|
@@ -438,13 +697,40 @@ declare class Tools<TToolCollection, TTool, TProvider extends BaseComposioProvid
|
|
|
438
697
|
*/
|
|
439
698
|
private getConnectedAccountIdForTool;
|
|
440
699
|
/**
|
|
441
|
-
* Lists all tools available in the Composio SDK
|
|
442
|
-
*
|
|
443
|
-
*
|
|
700
|
+
* Lists all tools available in the Composio SDK including custom tools.
|
|
701
|
+
*
|
|
702
|
+
* This method fetches tools from the Composio API in raw format and combines them with
|
|
703
|
+
* any registered custom tools. The response can be filtered and modified as needed.
|
|
704
|
+
*
|
|
705
|
+
* @param {string} userId - The user ID for whom to fetch the tools
|
|
706
|
+
* @param {ToolListParams} [query={}] - Optional query parameters to filter the tools
|
|
707
|
+
* @param {TransformToolSchemaModifier} [modifier] - Optional function to transform tool schemas
|
|
708
|
+
* @returns {Promise<ToolList>} List of tools matching the query criteria
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* // Get all tools
|
|
713
|
+
* const tools = await composio.tools.getRawComposioTools('default');
|
|
714
|
+
*
|
|
715
|
+
* // Get tools with filters
|
|
716
|
+
* const githubTools = await composio.tools.getRawComposioTools('default', {
|
|
717
|
+
* toolkits: ['github'],
|
|
718
|
+
* important: true
|
|
719
|
+
* });
|
|
720
|
+
*
|
|
721
|
+
* // Get tools with schema transformation
|
|
722
|
+
* const tools = await composio.tools.getRawComposioTools('default', {},
|
|
723
|
+
* (toolSlug, toolkitSlug, tool) => {
|
|
724
|
+
* // Add custom properties to tool schema
|
|
725
|
+
* return {...tool, customProperty: 'value'};
|
|
726
|
+
* }
|
|
727
|
+
* );
|
|
728
|
+
* ```
|
|
444
729
|
*/
|
|
445
730
|
getRawComposioTools(userId: string, query?: ToolListParams, modifier?: TransformToolSchemaModifier): Promise<ToolList>;
|
|
446
731
|
/**
|
|
447
732
|
* Retrieves a tool by its Slug.
|
|
733
|
+
* This method is used to get the raw tools from the composio API.
|
|
448
734
|
* @param slug The ID of the tool to be retrieved
|
|
449
735
|
* @returns {Promise<Tool>} The tool
|
|
450
736
|
*
|
|
@@ -455,33 +741,54 @@ declare class Tools<TToolCollection, TTool, TProvider extends BaseComposioProvid
|
|
|
455
741
|
*/
|
|
456
742
|
getRawComposioToolBySlug(userId: string, slug: string, modifier?: TransformToolSchemaModifier): Promise<Tool>;
|
|
457
743
|
/**
|
|
458
|
-
* Get a
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
* @param
|
|
462
|
-
* @
|
|
744
|
+
* Get a list of tools from Composio based on filters.
|
|
745
|
+
* This method fetches the tools from the Composio API and wraps them using the provider.
|
|
746
|
+
*
|
|
747
|
+
* @param {string} userId - The user id to get the tools for
|
|
748
|
+
* @param {ToolListParams} filters - The filters to apply when fetching tools
|
|
749
|
+
* @param {ProviderOptions<TProvider>} [options] - Optional provider options including modifiers
|
|
750
|
+
* @returns {Promise<ReturnType<T['wrapTools']>>} The wrapped tools collection
|
|
463
751
|
*
|
|
464
752
|
* @example
|
|
465
|
-
* ```
|
|
466
|
-
*
|
|
753
|
+
* ```typescript
|
|
754
|
+
* // Get tools from the GitHub toolkit
|
|
755
|
+
* const tools = await composio.tools.get('default', {
|
|
756
|
+
* toolkits: ['github'],
|
|
757
|
+
* limit: 10
|
|
758
|
+
* });
|
|
759
|
+
*
|
|
760
|
+
* // Get tools with search
|
|
761
|
+
* const tools = await composio.tools.get('default', {
|
|
762
|
+
* search: 'user',
|
|
763
|
+
* important: true
|
|
764
|
+
* });
|
|
467
765
|
* ```
|
|
468
766
|
*/
|
|
469
|
-
get<T extends TProvider>(userId: string,
|
|
767
|
+
get<T extends TProvider>(userId: string, filters: ToolListParams, options?: ProviderOptions<TProvider>): Promise<ReturnType<T['wrapTools']>>;
|
|
470
768
|
/**
|
|
471
|
-
* Get a
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
* @param
|
|
475
|
-
* @
|
|
769
|
+
* Get a specific tool by its slug.
|
|
770
|
+
* This method fetches the tool from the Composio API and wraps it using the provider.
|
|
771
|
+
*
|
|
772
|
+
* @param {string} userId - The user id to get the tool for
|
|
773
|
+
* @param {string} slug - The slug of the tool to fetch
|
|
774
|
+
* @param {ProviderOptions<TProvider>} [options] - Optional provider options including modifiers
|
|
775
|
+
* @returns {Promise<ReturnType<T['wrapTools']>>} The wrapped tool
|
|
476
776
|
*
|
|
477
777
|
* @example
|
|
478
|
-
* ```
|
|
479
|
-
*
|
|
480
|
-
*
|
|
778
|
+
* ```typescript
|
|
779
|
+
* // Get a specific tool by slug
|
|
780
|
+
* const hackerNewsUserTool = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
|
|
781
|
+
*
|
|
782
|
+
* // Get a tool with schema modifications
|
|
783
|
+
* const tool = await composio.tools.get('default', 'GITHUB_GET_REPOS', {
|
|
784
|
+
* modifySchema: (toolSlug, toolkitSlug, schema) => {
|
|
785
|
+
* // Customize the tool schema
|
|
786
|
+
* return {...schema, description: 'Custom description'};
|
|
787
|
+
* }
|
|
481
788
|
* });
|
|
482
789
|
* ```
|
|
483
790
|
*/
|
|
484
|
-
get<T extends TProvider>(userId: string,
|
|
791
|
+
get<T extends TProvider>(userId: string, slug: string, options?: ProviderOptions<TProvider>): Promise<ReturnType<T['wrapTools']>>;
|
|
485
792
|
/**
|
|
486
793
|
* @internal
|
|
487
794
|
* Creates a function that executes a tool.
|
|
@@ -510,13 +817,43 @@ declare class Tools<TToolCollection, TTool, TProvider extends BaseComposioProvid
|
|
|
510
817
|
*/
|
|
511
818
|
private handleComposioToolExecution;
|
|
512
819
|
/**
|
|
513
|
-
*
|
|
820
|
+
* Executes a given tool with the provided parameters.
|
|
514
821
|
*
|
|
515
|
-
* This method calls the Composio API to execute the tool and returns the response.
|
|
822
|
+
* This method calls the Composio API or a custom tool handler to execute the tool and returns the response.
|
|
823
|
+
* It automatically determines whether to use a custom tool or a Composio API tool based on the slug.
|
|
516
824
|
*
|
|
517
|
-
* @param {string} slug - The ID of the tool to be executed
|
|
825
|
+
* @param {string} slug - The slug/ID of the tool to be executed
|
|
518
826
|
* @param {ToolExecuteParams} body - The parameters to be passed to the tool
|
|
827
|
+
* @param {ExecuteToolModifiers} [modifiers] - Optional modifiers to transform the request or response
|
|
519
828
|
* @returns {Promise<ToolExecuteResponse>} - The response from the tool execution
|
|
829
|
+
*
|
|
830
|
+
* @throws {ComposioCustomToolsNotInitializedError} If the CustomTools instance is not initialized
|
|
831
|
+
* @throws {ComposioToolNotFoundError} If the tool with the given slug is not found
|
|
832
|
+
* @throws {ComposioToolExecutionError} If there is an error during tool execution
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* ```typescript
|
|
836
|
+
* // Execute a Composio API tool
|
|
837
|
+
* const result = await composio.tools.execute('HACKERNEWS_GET_USER', {
|
|
838
|
+
* userId: 'default',
|
|
839
|
+
* arguments: { userId: 'pg' }
|
|
840
|
+
* });
|
|
841
|
+
*
|
|
842
|
+
* // Execute with modifiers
|
|
843
|
+
* const result = await composio.tools.execute('GITHUB_GET_ISSUES', {
|
|
844
|
+
* userId: 'default',
|
|
845
|
+
* arguments: { owner: 'composio', repo: 'sdk' }
|
|
846
|
+
* }, {
|
|
847
|
+
* beforeExecute: (toolSlug, toolkitSlug, params) => {
|
|
848
|
+
* // Modify params before execution
|
|
849
|
+
* return params;
|
|
850
|
+
* },
|
|
851
|
+
* afterExecute: (toolSlug, toolkitSlug, result) => {
|
|
852
|
+
* // Transform result after execution
|
|
853
|
+
* return result;
|
|
854
|
+
* }
|
|
855
|
+
* });
|
|
856
|
+
* ```
|
|
520
857
|
*/
|
|
521
858
|
execute(slug: string, body: ToolExecuteParams, modifiers?: ExecuteToolModifiers): Promise<ToolExecuteResponse>;
|
|
522
859
|
/**
|
|
@@ -544,9 +881,39 @@ declare class Tools<TToolCollection, TTool, TProvider extends BaseComposioProvid
|
|
|
544
881
|
*/
|
|
545
882
|
proxyExecute(body: ToolProxyParams): Promise<ToolProxyResponse>;
|
|
546
883
|
/**
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
884
|
+
* Creates a custom tool that can be used within the Composio SDK.
|
|
885
|
+
*
|
|
886
|
+
* Custom tools allow you to extend the functionality of Composio with your own implementations
|
|
887
|
+
* while keeping a consistent interface for both built-in and custom tools.
|
|
888
|
+
*
|
|
889
|
+
* @param {CustomToolOptions} body - The configuration for the custom tool
|
|
890
|
+
* @returns {Promise<Tool>} The created custom tool
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```typescript
|
|
894
|
+
* const customTool = await composio.tools.createCustomTool({
|
|
895
|
+
* name: 'My Custom Tool',
|
|
896
|
+
* description: 'A custom tool that does something specific',
|
|
897
|
+
* slug: 'MY_CUSTOM_TOOL',
|
|
898
|
+
* inputParameters: {
|
|
899
|
+
* param1: {
|
|
900
|
+
* type: 'string',
|
|
901
|
+
* description: 'First parameter',
|
|
902
|
+
* required: true
|
|
903
|
+
* }
|
|
904
|
+
* },
|
|
905
|
+
* outputParameters: {
|
|
906
|
+
* result: {
|
|
907
|
+
* type: 'string',
|
|
908
|
+
* description: 'The result of the operation'
|
|
909
|
+
* }
|
|
910
|
+
* },
|
|
911
|
+
* handler: async (params, context) => {
|
|
912
|
+
* // Custom logic here
|
|
913
|
+
* return { data: { result: 'Success!' } };
|
|
914
|
+
* }
|
|
915
|
+
* });
|
|
916
|
+
* ```
|
|
550
917
|
*/
|
|
551
918
|
createCustomTool(body: CustomToolOptions): Promise<Tool>;
|
|
552
919
|
}
|
|
@@ -1179,14 +1546,14 @@ declare const ConnectedAccountStatuses: {
|
|
|
1179
1546
|
type ConnectedAccountStatus = (typeof ConnectedAccountStatuses)[keyof typeof ConnectedAccountStatuses];
|
|
1180
1547
|
type CreateConnectedAccountOptions = z.infer<typeof CreateConnectedAccountOptionsSchema>;
|
|
1181
1548
|
declare const CreateConnectedAccountOptionsSchema: z.ZodObject<{
|
|
1182
|
-
|
|
1549
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1183
1550
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1184
1551
|
}, "strip", z.ZodTypeAny, {
|
|
1185
1552
|
data?: Record<string, unknown> | undefined;
|
|
1186
|
-
|
|
1553
|
+
callbackUrl?: string | undefined;
|
|
1187
1554
|
}, {
|
|
1188
1555
|
data?: Record<string, unknown> | undefined;
|
|
1189
|
-
|
|
1556
|
+
callbackUrl?: string | undefined;
|
|
1190
1557
|
}>;
|
|
1191
1558
|
type CreateConnectedAccountOptionsSchema = z.infer<typeof CreateConnectedAccountOptionsSchema>;
|
|
1192
1559
|
declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
@@ -1209,7 +1576,7 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
|
1209
1576
|
}>;
|
|
1210
1577
|
userId: z.ZodString;
|
|
1211
1578
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1212
|
-
params: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
1579
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1213
1580
|
status: z.ZodEnum<["ACTIVE", "INACTIVE", "DELETED", "INITIATED", "EXPIRED", "FAILED"]>;
|
|
1214
1581
|
statusReason: z.ZodNullable<z.ZodString>;
|
|
1215
1582
|
toolkit: z.ZodObject<{
|
|
@@ -1224,7 +1591,6 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
|
1224
1591
|
createdAt: z.ZodString;
|
|
1225
1592
|
updatedAt: z.ZodString;
|
|
1226
1593
|
}, "strip", z.ZodTypeAny, {
|
|
1227
|
-
params: Record<string, unknown>;
|
|
1228
1594
|
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1229
1595
|
toolkit: {
|
|
1230
1596
|
slug: string;
|
|
@@ -1242,9 +1608,9 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
|
1242
1608
|
};
|
|
1243
1609
|
isDisabled: boolean;
|
|
1244
1610
|
statusReason: string | null;
|
|
1611
|
+
params?: Record<string, unknown> | undefined;
|
|
1245
1612
|
testRequestEndpoint?: string | undefined;
|
|
1246
1613
|
}, {
|
|
1247
|
-
params: Record<string, unknown>;
|
|
1248
1614
|
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1249
1615
|
toolkit: {
|
|
1250
1616
|
slug: string;
|
|
@@ -1262,9 +1628,167 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
|
1262
1628
|
};
|
|
1263
1629
|
isDisabled: boolean;
|
|
1264
1630
|
statusReason: string | null;
|
|
1631
|
+
params?: Record<string, unknown> | undefined;
|
|
1265
1632
|
testRequestEndpoint?: string | undefined;
|
|
1266
1633
|
}>;
|
|
1267
1634
|
type ConnectedAccountRetrieveResponse = z.infer<typeof ConnectedAccountRetrieveResponseSchema>;
|
|
1635
|
+
declare const ConnectedAccountListParamsSchema: z.ZodObject<{
|
|
1636
|
+
authConfigIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1637
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1638
|
+
labels: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1639
|
+
limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1640
|
+
orderBy: z.ZodOptional<z.ZodEnum<["created_at", "updated_at"]>>;
|
|
1641
|
+
statuses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["ACTIVE", "INACTIVE", "DELETED", "INITIATED", "EXPIRED", "FAILED"]>, "many">>>;
|
|
1642
|
+
toolkitSlugs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1643
|
+
userIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1644
|
+
}, "strip", z.ZodTypeAny, {
|
|
1645
|
+
cursor?: number | null | undefined;
|
|
1646
|
+
limit?: number | null | undefined;
|
|
1647
|
+
authConfigIds?: string[] | null | undefined;
|
|
1648
|
+
labels?: string[] | null | undefined;
|
|
1649
|
+
orderBy?: "created_at" | "updated_at" | undefined;
|
|
1650
|
+
statuses?: ("ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED")[] | null | undefined;
|
|
1651
|
+
toolkitSlugs?: string[] | null | undefined;
|
|
1652
|
+
userIds?: string[] | null | undefined;
|
|
1653
|
+
}, {
|
|
1654
|
+
cursor?: number | null | undefined;
|
|
1655
|
+
limit?: number | null | undefined;
|
|
1656
|
+
authConfigIds?: string[] | null | undefined;
|
|
1657
|
+
labels?: string[] | null | undefined;
|
|
1658
|
+
orderBy?: "created_at" | "updated_at" | undefined;
|
|
1659
|
+
statuses?: ("ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED")[] | null | undefined;
|
|
1660
|
+
toolkitSlugs?: string[] | null | undefined;
|
|
1661
|
+
userIds?: string[] | null | undefined;
|
|
1662
|
+
}>;
|
|
1663
|
+
type ConnectedAccountListParams = z.infer<typeof ConnectedAccountListParamsSchema>;
|
|
1664
|
+
declare const ConnectedAccountListResponseSchema: z.ZodObject<{
|
|
1665
|
+
items: z.ZodArray<z.ZodObject<{
|
|
1666
|
+
id: z.ZodString;
|
|
1667
|
+
authConfig: z.ZodObject<{
|
|
1668
|
+
id: z.ZodString;
|
|
1669
|
+
authScheme: z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>;
|
|
1670
|
+
isComposioManaged: z.ZodBoolean;
|
|
1671
|
+
isDisabled: z.ZodBoolean;
|
|
1672
|
+
}, "strip", z.ZodTypeAny, {
|
|
1673
|
+
id: string;
|
|
1674
|
+
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1675
|
+
isComposioManaged: boolean;
|
|
1676
|
+
isDisabled: boolean;
|
|
1677
|
+
}, {
|
|
1678
|
+
id: string;
|
|
1679
|
+
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1680
|
+
isComposioManaged: boolean;
|
|
1681
|
+
isDisabled: boolean;
|
|
1682
|
+
}>;
|
|
1683
|
+
userId: z.ZodString;
|
|
1684
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1685
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1686
|
+
status: z.ZodEnum<["ACTIVE", "INACTIVE", "DELETED", "INITIATED", "EXPIRED", "FAILED"]>;
|
|
1687
|
+
statusReason: z.ZodNullable<z.ZodString>;
|
|
1688
|
+
toolkit: z.ZodObject<{
|
|
1689
|
+
slug: z.ZodString;
|
|
1690
|
+
}, "strip", z.ZodTypeAny, {
|
|
1691
|
+
slug: string;
|
|
1692
|
+
}, {
|
|
1693
|
+
slug: string;
|
|
1694
|
+
}>;
|
|
1695
|
+
testRequestEndpoint: z.ZodOptional<z.ZodString>;
|
|
1696
|
+
isDisabled: z.ZodBoolean;
|
|
1697
|
+
createdAt: z.ZodString;
|
|
1698
|
+
updatedAt: z.ZodString;
|
|
1699
|
+
}, "strip", z.ZodTypeAny, {
|
|
1700
|
+
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1701
|
+
toolkit: {
|
|
1702
|
+
slug: string;
|
|
1703
|
+
};
|
|
1704
|
+
userId: string;
|
|
1705
|
+
data: Record<string, unknown>;
|
|
1706
|
+
createdAt: string;
|
|
1707
|
+
updatedAt: string;
|
|
1708
|
+
id: string;
|
|
1709
|
+
authConfig: {
|
|
1710
|
+
id: string;
|
|
1711
|
+
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1712
|
+
isComposioManaged: boolean;
|
|
1713
|
+
isDisabled: boolean;
|
|
1714
|
+
};
|
|
1715
|
+
isDisabled: boolean;
|
|
1716
|
+
statusReason: string | null;
|
|
1717
|
+
params?: Record<string, unknown> | undefined;
|
|
1718
|
+
testRequestEndpoint?: string | undefined;
|
|
1719
|
+
}, {
|
|
1720
|
+
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1721
|
+
toolkit: {
|
|
1722
|
+
slug: string;
|
|
1723
|
+
};
|
|
1724
|
+
userId: string;
|
|
1725
|
+
data: Record<string, unknown>;
|
|
1726
|
+
createdAt: string;
|
|
1727
|
+
updatedAt: string;
|
|
1728
|
+
id: string;
|
|
1729
|
+
authConfig: {
|
|
1730
|
+
id: string;
|
|
1731
|
+
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1732
|
+
isComposioManaged: boolean;
|
|
1733
|
+
isDisabled: boolean;
|
|
1734
|
+
};
|
|
1735
|
+
isDisabled: boolean;
|
|
1736
|
+
statusReason: string | null;
|
|
1737
|
+
params?: Record<string, unknown> | undefined;
|
|
1738
|
+
testRequestEndpoint?: string | undefined;
|
|
1739
|
+
}>, "many">;
|
|
1740
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
1741
|
+
totalPages: z.ZodNumber;
|
|
1742
|
+
}, "strip", z.ZodTypeAny, {
|
|
1743
|
+
items: {
|
|
1744
|
+
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1745
|
+
toolkit: {
|
|
1746
|
+
slug: string;
|
|
1747
|
+
};
|
|
1748
|
+
userId: string;
|
|
1749
|
+
data: Record<string, unknown>;
|
|
1750
|
+
createdAt: string;
|
|
1751
|
+
updatedAt: string;
|
|
1752
|
+
id: string;
|
|
1753
|
+
authConfig: {
|
|
1754
|
+
id: string;
|
|
1755
|
+
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1756
|
+
isComposioManaged: boolean;
|
|
1757
|
+
isDisabled: boolean;
|
|
1758
|
+
};
|
|
1759
|
+
isDisabled: boolean;
|
|
1760
|
+
statusReason: string | null;
|
|
1761
|
+
params?: Record<string, unknown> | undefined;
|
|
1762
|
+
testRequestEndpoint?: string | undefined;
|
|
1763
|
+
}[];
|
|
1764
|
+
nextCursor: string | null;
|
|
1765
|
+
totalPages: number;
|
|
1766
|
+
}, {
|
|
1767
|
+
items: {
|
|
1768
|
+
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1769
|
+
toolkit: {
|
|
1770
|
+
slug: string;
|
|
1771
|
+
};
|
|
1772
|
+
userId: string;
|
|
1773
|
+
data: Record<string, unknown>;
|
|
1774
|
+
createdAt: string;
|
|
1775
|
+
updatedAt: string;
|
|
1776
|
+
id: string;
|
|
1777
|
+
authConfig: {
|
|
1778
|
+
id: string;
|
|
1779
|
+
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1780
|
+
isComposioManaged: boolean;
|
|
1781
|
+
isDisabled: boolean;
|
|
1782
|
+
};
|
|
1783
|
+
isDisabled: boolean;
|
|
1784
|
+
statusReason: string | null;
|
|
1785
|
+
params?: Record<string, unknown> | undefined;
|
|
1786
|
+
testRequestEndpoint?: string | undefined;
|
|
1787
|
+
}[];
|
|
1788
|
+
nextCursor: string | null;
|
|
1789
|
+
totalPages: number;
|
|
1790
|
+
}>;
|
|
1791
|
+
type ConnectedAccountListResponse = z.infer<typeof ConnectedAccountListResponseSchema>;
|
|
1268
1792
|
|
|
1269
1793
|
/**
|
|
1270
1794
|
* @fileoverview Connection request class for Composio SDK, used to manage an initiated connection request.
|
|
@@ -1276,21 +1800,48 @@ type ConnectedAccountRetrieveResponse = z.infer<typeof ConnectedAccountRetrieveR
|
|
|
1276
1800
|
|
|
1277
1801
|
declare class ConnectionRequest {
|
|
1278
1802
|
private client;
|
|
1279
|
-
|
|
1280
|
-
|
|
1803
|
+
id: string;
|
|
1804
|
+
status?: ConnectedAccountStatus;
|
|
1281
1805
|
redirectUrl?: string | null;
|
|
1282
|
-
constructor(client: ComposioClient, connectedAccountId: string,
|
|
1806
|
+
constructor(client: ComposioClient, connectedAccountId: string, status?: ConnectedAccountStatus, redirectUrl?: string | null);
|
|
1283
1807
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
*
|
|
1808
|
+
* Transforms the raw connected account response from the Composio API to the SDK format.
|
|
1809
|
+
*
|
|
1810
|
+
* This method converts property names from snake_case to camelCase and reorganizes
|
|
1811
|
+
* the data structure to match the SDK's standardized format.
|
|
1812
|
+
*
|
|
1813
|
+
* @param {OriginalConnectedAccountResponse} response - The raw API response to transform
|
|
1814
|
+
* @returns {Promise<ConnectedAccountRetrieveResponse>} The transformed response
|
|
1815
|
+
* @throws {ZodError} If the response fails validation against the expected schema
|
|
1816
|
+
*
|
|
1817
|
+
* @private
|
|
1287
1818
|
*/
|
|
1288
1819
|
private transformResponse;
|
|
1289
1820
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1821
|
+
* Waits for the connection request to complete and become active.
|
|
1822
|
+
*
|
|
1823
|
+
* This method continuously polls the Composio API to check the status of the connection request
|
|
1824
|
+
* until it either becomes active, enters a terminal error state, or times out.
|
|
1825
|
+
*
|
|
1826
|
+
* @param {number} [timeout=60000] - Maximum time to wait in milliseconds before timing out (default: 60 seconds)
|
|
1827
|
+
* @returns {Promise<ConnectedAccountRetrieveResponse>} The final connected account response when successful
|
|
1828
|
+
* @throws {ComposioConnectedAccountNotFoundError} If the connected account cannot be found
|
|
1829
|
+
* @throws {ConnectionRequestFailedError} If the connection enters a failed, expired, or deleted state
|
|
1830
|
+
* @throws {ConnectionRequestTimeoutError} If the connection request does not complete within the timeout period
|
|
1831
|
+
*
|
|
1832
|
+
* @example
|
|
1833
|
+
* ```typescript
|
|
1834
|
+
* // Wait for connection with default timeout (60 seconds)
|
|
1835
|
+
* try {
|
|
1836
|
+
* const connection = await connectionRequest.waitForConnection();
|
|
1837
|
+
* console.log('Connection established:', connection.id);
|
|
1838
|
+
* } catch (error) {
|
|
1839
|
+
* console.error('Connection failed:', error.message);
|
|
1840
|
+
* }
|
|
1841
|
+
*
|
|
1842
|
+
* // Wait for connection with custom timeout (2 minutes)
|
|
1843
|
+
* const connection = await connectionRequest.waitForConnection(120000);
|
|
1844
|
+
* ```
|
|
1294
1845
|
*/
|
|
1295
1846
|
waitForConnection(timeout?: number): Promise<ConnectedAccountRetrieveResponse>;
|
|
1296
1847
|
}
|
|
@@ -1305,37 +1856,84 @@ declare class Toolkits {
|
|
|
1305
1856
|
private client;
|
|
1306
1857
|
constructor(client: ComposioClient);
|
|
1307
1858
|
/**
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1859
|
+
* Retrieves a list of toolkits based on the provided query parameters.
|
|
1860
|
+
*
|
|
1861
|
+
* This method fetches toolkits from the Composio API and transforms the response
|
|
1862
|
+
* from snake_case to camelCase format for consistency with JavaScript/TypeScript conventions.
|
|
1863
|
+
*
|
|
1864
|
+
* @param {ToolkitListParams} query - The query parameters to filter toolkits
|
|
1865
|
+
* @returns {Promise<ToolKitListResponse>} The transformed list of toolkits
|
|
1866
|
+
*
|
|
1867
|
+
* @private
|
|
1311
1868
|
*/
|
|
1312
1869
|
private getToolkits;
|
|
1313
1870
|
/**
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* @param slug - The
|
|
1317
|
-
* @
|
|
1318
|
-
* @
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1871
|
+
* Retrieves a specific toolkit by its slug identifier.
|
|
1872
|
+
*
|
|
1873
|
+
* @param {string} slug - The unique slug identifier of the toolkit to retrieve
|
|
1874
|
+
* @returns {Promise<ToolkitRetrieveResponse>} The toolkit object with detailed information
|
|
1875
|
+
* @throws {ComposioToolNotFoundError} If no toolkit with the given slug exists
|
|
1876
|
+
*
|
|
1877
|
+
* @example
|
|
1878
|
+
* ```typescript
|
|
1879
|
+
* // Get a specific toolkit
|
|
1880
|
+
* const githubToolkit = await composio.toolkits.get('github');
|
|
1881
|
+
* console.log(githubToolkit.name); // GitHub
|
|
1882
|
+
* console.log(githubToolkit.authConfigDetails); // Authentication configuration details
|
|
1883
|
+
* ```
|
|
1326
1884
|
*/
|
|
1327
1885
|
get(slug: string): Promise<ToolkitRetrieveResponse>;
|
|
1328
1886
|
/**
|
|
1329
|
-
*
|
|
1330
|
-
*
|
|
1331
|
-
* @param query - The parameters to
|
|
1332
|
-
* @returns {Promise<ToolKitListResponse>}
|
|
1887
|
+
* Retrieves a list of toolkits based on the provided query parameters.
|
|
1888
|
+
*
|
|
1889
|
+
* @param {ToolkitListParams} query - The query parameters to filter toolkits
|
|
1890
|
+
* @returns {Promise<ToolKitListResponse>} A paginated list of toolkits matching the query criteria
|
|
1891
|
+
*
|
|
1892
|
+
* @example
|
|
1893
|
+
* ```typescript
|
|
1894
|
+
* // Get all toolkits
|
|
1895
|
+
* const allToolkits = await composio.toolkits.get({});
|
|
1896
|
+
*
|
|
1897
|
+
* // Get toolkits by category
|
|
1898
|
+
* const devToolkits = await composio.toolkits.get({
|
|
1899
|
+
* category: 'developer-tools'
|
|
1900
|
+
* });
|
|
1901
|
+
*
|
|
1902
|
+
* // Get local toolkits
|
|
1903
|
+
* const localToolkits = await composio.toolkits.get({
|
|
1904
|
+
* isLocal: true
|
|
1905
|
+
* });
|
|
1906
|
+
* ```
|
|
1333
1907
|
*/
|
|
1334
1908
|
get(query: ToolkitListParams): Promise<ToolKitListResponse>;
|
|
1335
1909
|
/**
|
|
1336
|
-
*
|
|
1910
|
+
* Retrieves a specific toolkit by its slug identifier.
|
|
1911
|
+
*
|
|
1912
|
+
* This method fetches a single toolkit from the Composio API and transforms
|
|
1913
|
+
* the response to use camelCase property naming consistent with JavaScript/TypeScript conventions.
|
|
1914
|
+
*
|
|
1915
|
+
* @param {string} slug - The unique slug identifier of the toolkit to retrieve
|
|
1916
|
+
* @returns {Promise<ToolkitRetrieveResponse>} The transformed toolkit object
|
|
1917
|
+
* @throws {ValidationError} If the response cannot be properly parsed
|
|
1918
|
+
* @throws {ComposioToolNotFoundError} If no toolkit with the given slug exists
|
|
1919
|
+
*
|
|
1920
|
+
* @private
|
|
1921
|
+
*/
|
|
1922
|
+
private getToolkitBySlug;
|
|
1923
|
+
/**
|
|
1924
|
+
* Retrieves all toolkit categories available in the Composio SDK.
|
|
1925
|
+
*
|
|
1926
|
+
* This method fetches the complete list of categories from the Composio API
|
|
1927
|
+
* and transforms the response to use camelCase property naming.
|
|
1928
|
+
*
|
|
1929
|
+
* @returns {Promise<ToolkitRetrieveCategoriesResponse>} The list of toolkit categories
|
|
1337
1930
|
*
|
|
1338
|
-
* @
|
|
1931
|
+
* @example
|
|
1932
|
+
* ```typescript
|
|
1933
|
+
* // Get all toolkit categories
|
|
1934
|
+
* const categories = await composio.toolkits.listCategories();
|
|
1935
|
+
* console.log(categories.items); // Array of category objects
|
|
1936
|
+
* ```
|
|
1339
1937
|
*/
|
|
1340
1938
|
listCategories(): Promise<ToolkitRetrieveCategoriesResponse>;
|
|
1341
1939
|
/**
|
|
@@ -1343,8 +1941,12 @@ declare class Toolkits {
|
|
|
1343
1941
|
* This method will create an auth config if one doesn't exist and initiate a connection request.
|
|
1344
1942
|
* @param {string} userId - The user id of the user to authorize
|
|
1345
1943
|
* @param {string} toolkitSlug - The slug of the toolkit to authorize
|
|
1346
|
-
* @param {string} authConfigId - The id of the auth config to use
|
|
1347
1944
|
* @returns {Promise<ConnectionRequest>} The connection request object
|
|
1945
|
+
*
|
|
1946
|
+
* @example
|
|
1947
|
+
* ```typescript
|
|
1948
|
+
* const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
1949
|
+
* ```
|
|
1348
1950
|
*/
|
|
1349
1951
|
authorize(userId: string, toolkitSlug: string): Promise<ConnectionRequest>;
|
|
1350
1952
|
}
|
|
@@ -1576,7 +2178,7 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
1576
2178
|
status: z.ZodEnum<["ENABLED", "DISABLED"]>;
|
|
1577
2179
|
uuid: z.ZodString;
|
|
1578
2180
|
authScheme: z.ZodOptional<z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>>;
|
|
1579
|
-
credentials: z.
|
|
2181
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1580
2182
|
expectedInputFields: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
1581
2183
|
isComposioManaged: z.ZodOptional<z.ZodBoolean>;
|
|
1582
2184
|
createdBy: z.ZodOptional<z.ZodString>;
|
|
@@ -1590,10 +2192,10 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
1590
2192
|
logo: string;
|
|
1591
2193
|
};
|
|
1592
2194
|
id: string;
|
|
1593
|
-
credentials: Record<string, string | number | boolean>;
|
|
1594
2195
|
noOfConnections: number;
|
|
1595
2196
|
uuid: string;
|
|
1596
2197
|
createdAt?: string | undefined;
|
|
2198
|
+
credentials?: Record<string, unknown> | undefined;
|
|
1597
2199
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
1598
2200
|
isComposioManaged?: boolean | undefined;
|
|
1599
2201
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -1607,10 +2209,10 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
1607
2209
|
logo: string;
|
|
1608
2210
|
};
|
|
1609
2211
|
id: string;
|
|
1610
|
-
credentials: Record<string, string | number | boolean>;
|
|
1611
2212
|
noOfConnections: number;
|
|
1612
2213
|
uuid: string;
|
|
1613
2214
|
createdAt?: string | undefined;
|
|
2215
|
+
credentials?: Record<string, unknown> | undefined;
|
|
1614
2216
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
1615
2217
|
isComposioManaged?: boolean | undefined;
|
|
1616
2218
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -1653,7 +2255,7 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
1653
2255
|
status: z.ZodEnum<["ENABLED", "DISABLED"]>;
|
|
1654
2256
|
uuid: z.ZodString;
|
|
1655
2257
|
authScheme: z.ZodOptional<z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>>;
|
|
1656
|
-
credentials: z.
|
|
2258
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1657
2259
|
expectedInputFields: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
1658
2260
|
isComposioManaged: z.ZodOptional<z.ZodBoolean>;
|
|
1659
2261
|
createdBy: z.ZodOptional<z.ZodString>;
|
|
@@ -1667,10 +2269,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
1667
2269
|
logo: string;
|
|
1668
2270
|
};
|
|
1669
2271
|
id: string;
|
|
1670
|
-
credentials: Record<string, string | number | boolean>;
|
|
1671
2272
|
noOfConnections: number;
|
|
1672
2273
|
uuid: string;
|
|
1673
2274
|
createdAt?: string | undefined;
|
|
2275
|
+
credentials?: Record<string, unknown> | undefined;
|
|
1674
2276
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
1675
2277
|
isComposioManaged?: boolean | undefined;
|
|
1676
2278
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -1684,10 +2286,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
1684
2286
|
logo: string;
|
|
1685
2287
|
};
|
|
1686
2288
|
id: string;
|
|
1687
|
-
credentials: Record<string, string | number | boolean>;
|
|
1688
2289
|
noOfConnections: number;
|
|
1689
2290
|
uuid: string;
|
|
1690
2291
|
createdAt?: string | undefined;
|
|
2292
|
+
credentials?: Record<string, unknown> | undefined;
|
|
1691
2293
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
1692
2294
|
isComposioManaged?: boolean | undefined;
|
|
1693
2295
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -1705,10 +2307,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
1705
2307
|
logo: string;
|
|
1706
2308
|
};
|
|
1707
2309
|
id: string;
|
|
1708
|
-
credentials: Record<string, string | number | boolean>;
|
|
1709
2310
|
noOfConnections: number;
|
|
1710
2311
|
uuid: string;
|
|
1711
2312
|
createdAt?: string | undefined;
|
|
2313
|
+
credentials?: Record<string, unknown> | undefined;
|
|
1712
2314
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
1713
2315
|
isComposioManaged?: boolean | undefined;
|
|
1714
2316
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -1726,10 +2328,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
1726
2328
|
logo: string;
|
|
1727
2329
|
};
|
|
1728
2330
|
id: string;
|
|
1729
|
-
credentials: Record<string, string | number | boolean>;
|
|
1730
2331
|
noOfConnections: number;
|
|
1731
2332
|
uuid: string;
|
|
1732
2333
|
createdAt?: string | undefined;
|
|
2334
|
+
credentials?: Record<string, unknown> | undefined;
|
|
1733
2335
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
1734
2336
|
isComposioManaged?: boolean | undefined;
|
|
1735
2337
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -1790,12 +2392,44 @@ declare class AuthConfigs {
|
|
|
1790
2392
|
* @protected
|
|
1791
2393
|
*/
|
|
1792
2394
|
protected getClient(): ComposioClient;
|
|
2395
|
+
/**
|
|
2396
|
+
* Transforms an auth config response from API format to SDK format.
|
|
2397
|
+
*
|
|
2398
|
+
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2399
|
+
* the data structure to match the SDK's standardized format for auth configurations.
|
|
2400
|
+
*
|
|
2401
|
+
* @param {ComposioAuthConfigRetrieveResponse} authConfig - The raw API response to transform
|
|
2402
|
+
* @returns {AuthConfigRetrieveResponse} The transformed auth config data
|
|
2403
|
+
* @throws {ValidationError} If the response fails validation against the expected schema
|
|
2404
|
+
*
|
|
2405
|
+
* @private
|
|
2406
|
+
*/
|
|
1793
2407
|
private parseAuthConfigRetrieveResponse;
|
|
1794
2408
|
/**
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
1798
|
-
*
|
|
2409
|
+
* Lists authentication configurations based on provided filter criteria.
|
|
2410
|
+
*
|
|
2411
|
+
* This method retrieves auth configs from the Composio API, transforms them to the SDK format,
|
|
2412
|
+
* and supports filtering by various parameters.
|
|
2413
|
+
*
|
|
2414
|
+
* @param {AuthConfigListParams} [query] - Optional query parameters for filtering auth configs
|
|
2415
|
+
* @returns {Promise<AuthConfigListResponse>} A paginated list of auth configurations
|
|
2416
|
+
* @throws {ValidationError} If the query parameters or response fail validation
|
|
2417
|
+
*
|
|
2418
|
+
* @example
|
|
2419
|
+
* ```typescript
|
|
2420
|
+
* // List all auth configs
|
|
2421
|
+
* const allConfigs = await composio.authConfigs.list();
|
|
2422
|
+
*
|
|
2423
|
+
* // List auth configs for a specific toolkit
|
|
2424
|
+
* const githubConfigs = await composio.authConfigs.list({
|
|
2425
|
+
* toolkitSlug: 'github'
|
|
2426
|
+
* });
|
|
2427
|
+
*
|
|
2428
|
+
* // List Composio-managed auth configs
|
|
2429
|
+
* const managedConfigs = await composio.authConfigs.list({
|
|
2430
|
+
* isComposioManaged: true
|
|
2431
|
+
* });
|
|
2432
|
+
* ```
|
|
1799
2433
|
*/
|
|
1800
2434
|
list(query?: AuthConfigListParams): Promise<AuthConfigListResponse>;
|
|
1801
2435
|
/**
|
|
@@ -1816,49 +2450,132 @@ declare class AuthConfigs {
|
|
|
1816
2450
|
*
|
|
1817
2451
|
* @link https://docs.composio.dev/reference/auth-configs/create-auth-config
|
|
1818
2452
|
*/
|
|
1819
|
-
create(toolkit: string, options
|
|
2453
|
+
create(toolkit: string, options?: CreateAuthConfigParams): Promise<CreateAuthConfigResponse>;
|
|
1820
2454
|
/**
|
|
1821
|
-
*
|
|
1822
|
-
*
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
2455
|
+
* Retrieves a specific authentication configuration by its ID.
|
|
2456
|
+
*
|
|
2457
|
+
* This method fetches detailed information about a single auth config
|
|
2458
|
+
* and transforms the response to the SDK's standardized format.
|
|
2459
|
+
*
|
|
2460
|
+
* @param {string} nanoid - The unique identifier of the auth config to retrieve
|
|
2461
|
+
* @returns {Promise<AuthConfigRetrieveResponse>} The auth config details
|
|
2462
|
+
* @throws {Error} If the auth config cannot be found or an API error occurs
|
|
2463
|
+
* @throws {ValidationError} If the response fails validation
|
|
2464
|
+
*
|
|
2465
|
+
* @example
|
|
2466
|
+
* ```typescript
|
|
2467
|
+
* // Get an auth config by ID
|
|
2468
|
+
* const authConfig = await composio.authConfigs.get('auth_abc123');
|
|
2469
|
+
* console.log(authConfig.name); // e.g., 'GitHub Auth'
|
|
2470
|
+
* console.log(authConfig.toolkit.slug); // e.g., 'github'
|
|
2471
|
+
* ```
|
|
1825
2472
|
*/
|
|
1826
2473
|
get(nanoid: string): Promise<AuthConfigRetrieveResponse>;
|
|
1827
2474
|
/**
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
2475
|
+
* Updates an existing authentication configuration.
|
|
2476
|
+
*
|
|
2477
|
+
* This method allows you to modify properties of an auth config such as credentials,
|
|
2478
|
+
* scopes, or tool restrictions. The update type (custom or default) determines which
|
|
2479
|
+
* fields can be updated.
|
|
2480
|
+
*
|
|
2481
|
+
* @param {string} nanoid - The unique identifier of the auth config to update
|
|
2482
|
+
* @param {AuthConfigUpdateParams} data - The data to update, which can be either custom or default type
|
|
2483
|
+
* @returns {Promise<AuthConfigUpdateResponse>} The updated auth config
|
|
2484
|
+
* @throws {ValidationError} If the update parameters are invalid
|
|
2485
|
+
* @throws {Error} If the auth config cannot be found or updated
|
|
2486
|
+
*
|
|
2487
|
+
* @example
|
|
2488
|
+
* ```typescript
|
|
2489
|
+
* // Update a custom auth config with new credentials
|
|
2490
|
+
* const updatedConfig = await composio.authConfigs.update('auth_abc123', {
|
|
2491
|
+
* type: 'custom',
|
|
2492
|
+
* credentials: {
|
|
2493
|
+
* apiKey: 'new-api-key-value'
|
|
2494
|
+
* }
|
|
2495
|
+
* });
|
|
2496
|
+
*
|
|
2497
|
+
* // Update a default auth config with new scopes
|
|
2498
|
+
* const updatedConfig = await composio.authConfigs.update('auth_abc123', {
|
|
2499
|
+
* type: 'default',
|
|
2500
|
+
* scopes: ['read:user', 'repo']
|
|
2501
|
+
* });
|
|
2502
|
+
* ```
|
|
1833
2503
|
*/
|
|
1834
2504
|
update(nanoid: string, data: AuthConfigUpdateParams): Promise<AuthConfigUpdateResponse>;
|
|
1835
2505
|
/**
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
2506
|
+
* Deletes an authentication configuration.
|
|
2507
|
+
*
|
|
2508
|
+
* This method permanently removes an auth config from the Composio platform.
|
|
2509
|
+
* This action cannot be undone and will prevent any connected accounts that use
|
|
2510
|
+
* this auth config from functioning.
|
|
2511
|
+
*
|
|
2512
|
+
* @param {string} nanoid - The unique identifier of the auth config to delete
|
|
2513
|
+
* @returns {Promise<AuthConfigDeleteResponse>} The deletion response
|
|
2514
|
+
* @throws {Error} If the auth config doesn't exist or cannot be deleted
|
|
2515
|
+
*
|
|
2516
|
+
* @example
|
|
2517
|
+
* ```typescript
|
|
2518
|
+
* // Delete an auth config
|
|
2519
|
+
* await composio.authConfigs.delete('auth_abc123');
|
|
2520
|
+
* ```
|
|
1840
2521
|
*/
|
|
1841
2522
|
delete(nanoid: string): Promise<AuthConfigDeleteResponse>;
|
|
1842
2523
|
/**
|
|
1843
|
-
*
|
|
1844
|
-
*
|
|
1845
|
-
*
|
|
1846
|
-
*
|
|
1847
|
-
*
|
|
2524
|
+
* Updates the status of an authentication configuration.
|
|
2525
|
+
*
|
|
2526
|
+
* This method allows you to enable or disable an auth config. When disabled,
|
|
2527
|
+
* the auth config cannot be used to create new connected accounts or authenticate
|
|
2528
|
+
* with third-party services.
|
|
2529
|
+
*
|
|
2530
|
+
* @param {string} status - The status to set ('ENABLED' or 'DISABLED')
|
|
2531
|
+
* @param {string} nanoid - The unique identifier of the auth config
|
|
2532
|
+
* @returns {Promise<AuthConfigUpdateStatusResponse>} The updated auth config details
|
|
2533
|
+
* @throws {Error} If the auth config cannot be found or the status cannot be updated
|
|
2534
|
+
*
|
|
2535
|
+
* @example
|
|
2536
|
+
* ```typescript
|
|
2537
|
+
* // Disable an auth config
|
|
2538
|
+
* await composio.authConfigs.updateStatus('DISABLED', 'auth_abc123');
|
|
2539
|
+
*
|
|
2540
|
+
* // Enable an auth config
|
|
2541
|
+
* await composio.authConfigs.updateStatus('ENABLED', 'auth_abc123');
|
|
2542
|
+
* ```
|
|
1848
2543
|
*/
|
|
1849
2544
|
updateStatus(status: 'ENABLED' | 'DISABLED', nanoid: string): Promise<AuthConfigUpdateStatusResponse>;
|
|
1850
2545
|
/**
|
|
1851
|
-
*
|
|
1852
|
-
*
|
|
1853
|
-
*
|
|
1854
|
-
*
|
|
2546
|
+
* Enables an authentication configuration.
|
|
2547
|
+
*
|
|
2548
|
+
* This is a convenience method that calls updateStatus with 'ENABLED'.
|
|
2549
|
+
* When enabled, the auth config can be used to create new connected accounts
|
|
2550
|
+
* and authenticate with third-party services.
|
|
2551
|
+
*
|
|
2552
|
+
* @param {string} nanoid - The unique identifier of the auth config to enable
|
|
2553
|
+
* @returns {Promise<AuthConfigUpdateStatusResponse>} The updated auth config details
|
|
2554
|
+
* @throws {Error} If the auth config cannot be found or enabled
|
|
2555
|
+
*
|
|
2556
|
+
* @example
|
|
2557
|
+
* ```typescript
|
|
2558
|
+
* // Enable an auth config
|
|
2559
|
+
* await composio.authConfigs.enable('auth_abc123');
|
|
2560
|
+
* ```
|
|
1855
2561
|
*/
|
|
1856
2562
|
enable(nanoid: string): Promise<AuthConfigUpdateStatusResponse>;
|
|
1857
2563
|
/**
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
1860
|
-
*
|
|
1861
|
-
*
|
|
2564
|
+
* Disables an authentication configuration.
|
|
2565
|
+
*
|
|
2566
|
+
* This is a convenience method that calls updateStatus with 'DISABLED'.
|
|
2567
|
+
* When disabled, the auth config cannot be used to create new connected accounts
|
|
2568
|
+
* or authenticate with third-party services, but existing connections may continue to work.
|
|
2569
|
+
*
|
|
2570
|
+
* @param {string} nanoid - The unique identifier of the auth config to disable
|
|
2571
|
+
* @returns {Promise<AuthConfigUpdateStatusResponse>} The updated auth config details
|
|
2572
|
+
* @throws {Error} If the auth config cannot be found or disabled
|
|
2573
|
+
*
|
|
2574
|
+
* @example
|
|
2575
|
+
* ```typescript
|
|
2576
|
+
* // Disable an auth config
|
|
2577
|
+
* await composio.authConfigs.disable('auth_abc123');
|
|
2578
|
+
* ```
|
|
1862
2579
|
*/
|
|
1863
2580
|
disable(nanoid: string): Promise<AuthConfigUpdateStatusResponse>;
|
|
1864
2581
|
}
|
|
@@ -1880,13 +2597,45 @@ declare class AuthConfigs {
|
|
|
1880
2597
|
declare class ConnectedAccounts {
|
|
1881
2598
|
private client;
|
|
1882
2599
|
constructor(client: ComposioClient);
|
|
2600
|
+
transformConnectedAccountRetrieveResponse(response: ConnectedAccountRetrieveResponse$1 | ConnectedAccountListResponse$1['items'][0]): ConnectedAccountRetrieveResponse;
|
|
1883
2601
|
/**
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
2602
|
+
* Lists all connected accounts based on provided filter criteria.
|
|
2603
|
+
*
|
|
2604
|
+
* This method retrieves connected accounts from the Composio API with optional filtering.
|
|
2605
|
+
*
|
|
2606
|
+
* @param {ConnectedAccountListParams} [query] - Optional query parameters for filtering connected accounts
|
|
2607
|
+
* @returns {Promise<ConnectedAccountListResponse>} A paginated list of connected accounts
|
|
2608
|
+
* @throws {ValidationError} If the query fails validation against the expected schema
|
|
2609
|
+
* @example
|
|
2610
|
+
* ```typescript
|
|
2611
|
+
* // List all connected accounts
|
|
2612
|
+
* const allAccounts = await composio.connectedAccounts.list();
|
|
2613
|
+
*
|
|
2614
|
+
* // List accounts for a specific user
|
|
2615
|
+
* const userAccounts = await composio.connectedAccounts.list({
|
|
2616
|
+
* userIds: ['user123']
|
|
2617
|
+
* });
|
|
2618
|
+
*
|
|
2619
|
+
* // List accounts for a specific toolkit
|
|
2620
|
+
* const githubAccounts = await composio.connectedAccounts.list({
|
|
2621
|
+
* toolkitSlugs: ['github']
|
|
2622
|
+
* });
|
|
2623
|
+
* ```
|
|
1888
2624
|
*/
|
|
1889
2625
|
list(query?: ConnectedAccountListParams): Promise<ConnectedAccountListResponse>;
|
|
2626
|
+
/**
|
|
2627
|
+
* Transforms connected account data from API format to SDK format.
|
|
2628
|
+
*
|
|
2629
|
+
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2630
|
+
* the data structure to match the SDK's standardized format for connected accounts.
|
|
2631
|
+
*
|
|
2632
|
+
* @param {ConnectedAccountRetrieveResponseRaw} response - The raw API response to transform
|
|
2633
|
+
* @returns {ConnectedAccountRetrieveResponse} The transformed connected account data
|
|
2634
|
+
* @throws {ValidationError} If the response fails validation against the expected schema
|
|
2635
|
+
*
|
|
2636
|
+
* @private
|
|
2637
|
+
*/
|
|
2638
|
+
transformConnectedAccountResponse(response: ConnectedAccountRetrieveResponse$1): ConnectedAccountRetrieveResponse;
|
|
1890
2639
|
/**
|
|
1891
2640
|
* Compound function to create a new connected account.
|
|
1892
2641
|
* This function creates a new connected account and returns a connection request.
|
|
@@ -1907,24 +2656,79 @@ declare class ConnectedAccounts {
|
|
|
1907
2656
|
*/
|
|
1908
2657
|
initiate(userId: string, authConfigId: string, options?: CreateConnectedAccountOptions): Promise<ConnectionRequest>;
|
|
1909
2658
|
/**
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
2659
|
+
* Waits for a connection request to complete and become active.
|
|
2660
|
+
*
|
|
2661
|
+
* This method continuously polls the Composio API to check the status of a connection
|
|
2662
|
+
* until it either becomes active, enters a terminal error state, or times out.
|
|
2663
|
+
*
|
|
2664
|
+
* @param {string} connectedAccountId - The ID of the connected account to wait for
|
|
2665
|
+
* @param {number} [timeout=60000] - Maximum time to wait in milliseconds (default: 60 seconds)
|
|
2666
|
+
* @returns {Promise<ConnectedAccountRetrieveResponse>} The finalized connected account data
|
|
2667
|
+
* @throws {ComposioConnectedAccountNotFoundError} If the connected account cannot be found
|
|
2668
|
+
* @throws {ConnectionRequestFailedError} If the connection enters a failed, expired, or deleted state
|
|
2669
|
+
* @throws {ConnectionRequestTimeoutError} If the connection does not complete within the timeout period
|
|
2670
|
+
*
|
|
2671
|
+
* @example
|
|
2672
|
+
* ```typescript
|
|
2673
|
+
* // Wait for a connection to complete with default timeout
|
|
2674
|
+
* const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc');
|
|
2675
|
+
*
|
|
2676
|
+
* // Wait with a custom timeout of 2 minutes
|
|
2677
|
+
* const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc', 120000);
|
|
2678
|
+
* ```
|
|
1914
2679
|
*/
|
|
1915
|
-
|
|
2680
|
+
waitForConnection(connectedAccountId: string, timeout?: number): Promise<ConnectedAccountRetrieveResponse>;
|
|
1916
2681
|
/**
|
|
1917
|
-
*
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
2682
|
+
* Retrieves a specific connected account by its ID.
|
|
2683
|
+
*
|
|
2684
|
+
* This method fetches detailed information about a single connected account
|
|
2685
|
+
* and transforms the response to the SDK's standardized format.
|
|
2686
|
+
*
|
|
2687
|
+
* @param {string} nanoid - The unique identifier of the connected account
|
|
2688
|
+
* @returns {Promise<ConnectedAccountRetrieveResponse>} The connected account details
|
|
2689
|
+
* @throws {Error} If the connected account cannot be found or an API error occurs
|
|
2690
|
+
*
|
|
2691
|
+
* @example
|
|
2692
|
+
* ```typescript
|
|
2693
|
+
* // Get a connected account by ID
|
|
2694
|
+
* const account = await composio.connectedAccounts.get('conn_abc123');
|
|
2695
|
+
* console.log(account.status); // e.g., 'ACTIVE'
|
|
2696
|
+
* console.log(account.toolkit.slug); // e.g., 'github'
|
|
2697
|
+
* ```
|
|
2698
|
+
*/
|
|
2699
|
+
get(nanoid: string): Promise<ConnectedAccountRetrieveResponse>;
|
|
2700
|
+
/**
|
|
2701
|
+
* Deletes a connected account.
|
|
2702
|
+
*
|
|
2703
|
+
* This method permanently removes a connected account from the Composio platform.
|
|
2704
|
+
* This action cannot be undone and will revoke any access tokens associated with the account.
|
|
2705
|
+
*
|
|
2706
|
+
* @param {string} nanoid - The unique identifier of the connected account to delete
|
|
2707
|
+
* @returns {Promise<ConnectedAccountDeleteResponse>} The deletion response
|
|
2708
|
+
* @throws {Error} If the account doesn't exist or cannot be deleted
|
|
2709
|
+
*
|
|
2710
|
+
* @example
|
|
2711
|
+
* ```typescript
|
|
2712
|
+
* // Delete a connected account
|
|
2713
|
+
* await composio.connectedAccounts.delete('conn_abc123');
|
|
2714
|
+
* ```
|
|
1921
2715
|
*/
|
|
1922
2716
|
delete(nanoid: string): Promise<ConnectedAccountDeleteResponse>;
|
|
1923
2717
|
/**
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
2718
|
+
* Refreshes a connected account's authentication credentials.
|
|
2719
|
+
*
|
|
2720
|
+
* This method attempts to refresh OAuth tokens or other credentials associated with
|
|
2721
|
+
* the connected account. This is useful when a token has expired or is about to expire.
|
|
2722
|
+
*
|
|
2723
|
+
* @param {string} nanoid - The unique identifier of the connected account to refresh
|
|
2724
|
+
* @returns {Promise<ConnectedAccountRefreshResponse>} The response containing the refreshed account details
|
|
2725
|
+
* @throws {Error} If the account doesn't exist or credentials cannot be refreshed
|
|
2726
|
+
*
|
|
2727
|
+
* @example
|
|
2728
|
+
* ```typescript
|
|
2729
|
+
* // Refresh a connected account's credentials
|
|
2730
|
+
* const refreshedAccount = await composio.connectedAccounts.refresh('conn_abc123');
|
|
2731
|
+
* ```
|
|
1928
2732
|
*/
|
|
1929
2733
|
refresh(nanoid: string): Promise<ConnectedAccountRefreshResponse>;
|
|
1930
2734
|
/**
|
|
@@ -1966,6 +2770,13 @@ declare abstract class BaseTelemetryTransport {
|
|
|
1966
2770
|
*/
|
|
1967
2771
|
abstract send(payload: TelemetryTransportParams): Promise<void>;
|
|
1968
2772
|
}
|
|
2773
|
+
/**
|
|
2774
|
+
* A telemetry transport that logs to the console.
|
|
2775
|
+
* This is just for testing purposes.
|
|
2776
|
+
*/
|
|
2777
|
+
declare class ConsoleTelemetryTransport implements BaseTelemetryTransport {
|
|
2778
|
+
send(payload: TelemetryTransportParams): Promise<void>;
|
|
2779
|
+
}
|
|
1969
2780
|
|
|
1970
2781
|
/**
|
|
1971
2782
|
* OpenAI ToolSet
|
|
@@ -2057,7 +2868,6 @@ declare class Composio<TProvider extends BaseComposioProvider<unknown, unknown>
|
|
|
2057
2868
|
* @type {ComposioConfig<TProvider>}
|
|
2058
2869
|
*/
|
|
2059
2870
|
private config;
|
|
2060
|
-
private telemetry;
|
|
2061
2871
|
/**
|
|
2062
2872
|
* Core models for Composio.
|
|
2063
2873
|
*/
|
|
@@ -2066,9 +2876,7 @@ declare class Composio<TProvider extends BaseComposioProvider<unknown, unknown>
|
|
|
2066
2876
|
triggers: Triggers;
|
|
2067
2877
|
provider: TProvider;
|
|
2068
2878
|
authConfigs: AuthConfigs;
|
|
2069
|
-
createAuthConfig: AuthConfigs['create'];
|
|
2070
2879
|
connectedAccounts: ConnectedAccounts;
|
|
2071
|
-
initiateConnection: ConnectedAccounts['initiate'];
|
|
2072
2880
|
/**
|
|
2073
2881
|
* @param {Object} config Configuration for the Composio SDK.
|
|
2074
2882
|
* @param {string} config.apiKey The API key for the Composio SDK.
|
|
@@ -2079,31 +2887,11 @@ declare class Composio<TProvider extends BaseComposioProvider<unknown, unknown>
|
|
|
2079
2887
|
* @param {TProvider} config.provider The provider to use for this Composio instance.
|
|
2080
2888
|
*/
|
|
2081
2889
|
constructor(config: ComposioConfig<TProvider>);
|
|
2082
|
-
/**
|
|
2083
|
-
* Initialize the instrumentations and telemetry for the Composio SDK.
|
|
2084
|
-
* @param {TelemetryMetadata} config - The configuration for the telemetry.
|
|
2085
|
-
* @param {BaseTelemetryTransport} transport - The transport for the telemetry.
|
|
2086
|
-
*/
|
|
2087
|
-
private initializeTelemetry;
|
|
2088
2890
|
/**
|
|
2089
2891
|
* Get the Composio SDK client.
|
|
2090
2892
|
* @returns {ComposioClient} The Composio API client.
|
|
2091
2893
|
*/
|
|
2092
2894
|
getClient(): ComposioClient;
|
|
2093
|
-
/**
|
|
2094
|
-
* Fetch all the tools from Composio.
|
|
2095
|
-
* @param {ToolListParams} params Parameters to fetch the tools.
|
|
2096
|
-
* @param {ProviderOptions<TProvider>} modifiers Modifiers to apply to the tools.
|
|
2097
|
-
* @returns {Promise<ReturnType<TProvider['getTools']>>} The tools from the provider.
|
|
2098
|
-
*/
|
|
2099
|
-
getTools<T extends TProvider>(userId: string, filters: ToolListParams, modifiers?: ProviderOptions<T>): Promise<ReturnType<T['wrapTools']>>;
|
|
2100
|
-
/**
|
|
2101
|
-
* Fetch a tool from Composio by its slug.
|
|
2102
|
-
* @param {string} slug slug of the tool
|
|
2103
|
-
* @param {ProviderOptions<TProvider>} modifiers to be applied to the tool
|
|
2104
|
-
* @returns {Promise<ReturnType<TProvider['getToolBySlug']>>} The tool from the provider.
|
|
2105
|
-
*/
|
|
2106
|
-
getToolBySlug<T extends TProvider>(userId: string, slug: string, modifiers?: ProviderOptions<T>): Promise<ReturnType<T['wrapTool']>>;
|
|
2107
2895
|
}
|
|
2108
2896
|
|
|
2109
2897
|
/**
|
|
@@ -2123,4 +2911,4 @@ declare class ComposioProvider extends BaseNonAgenticProvider<Array<CustomTool>,
|
|
|
2123
2911
|
|
|
2124
2912
|
declare function jsonSchemaToModel(jsonSchema: Record<string, unknown>): z.ZodObject<Record<string, z.ZodTypeAny>>;
|
|
2125
2913
|
|
|
2126
|
-
export { type
|
|
2914
|
+
export { type AgenticToolOptions, type AuthConfigType, AuthConfigTypes, type AuthSchemeType, AuthSchemeTypes, BaseAgenticProvider, type BaseComposioProvider, BaseNonAgenticProvider, BaseTelemetryTransport, Composio, ComposioProvider, ConsoleTelemetryTransport, type ExecuteMetadata, type ExecuteToolFn, type ExecuteToolFnOptions, type ExecuteToolModifiers, OpenAIProvider, type Provider, type Tool, type ToolExecuteParams, type ToolListParams, ToolListParamsSchema, type ToolOptions, type TransformToolSchemaModifier, type afterExecuteModifier, type beforeExecuteModifier, jsonSchemaToModel };
|