Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(cli): add "--type-tools" support to "ts generate" command; implement optional input/output type generation for tools

jkomyno9e9a5ecae551
diff --git a/ts/packages/cli/src/commands/generate.cmd.ts b/ts/packages/cli/src/commands/generate.cmd.ts
index 70c79df02..959f4ac68 100644
--- a/ts/packages/cli/src/commands/generate.cmd.ts
+++ b/ts/packages/cli/src/commands/generate.cmd.ts
@@ -11,17 +11,24 @@ export const outputOpt = Options.optional(
})
).pipe(Options.withAlias('o'), Options.withDescription('Output directory for type stubs'));
+export const typeTools = Options.boolean('type-tools').pipe(
+ Options.withDefault(false),
+ Options.withDescription(
+ 'Whether to emit type stubs for tools. This only applies to TypeScript projects.'
+ )
+);
+
/**
* @example
* ```bash
* composio generate <command>
* ```
*/
-export const generateCmd = Command.make('generate', { outputOpt }).pipe(
+export const generateCmd = Command.make('generate', { outputOpt, typeTools }).pipe(
Command.withDescription(
'Updates the local type stubs with the latest app data, automatically detecting the language of the project in the current working directory (TypeScript | Python).'
),
- Command.withHandler(({ outputOpt }) =>
+ Command.withHandler(({ outputOpt, typeTools }) =>
Effect.gen(function* () {
const process = yield* NodeProcess;
const cwd = process.cwd;
@@ -34,7 +41,7 @@ export const generateCmd = Command.make('generate', { outputOpt }).pipe(
// Redirect to either `ts generate` or `py generate` commands
yield* Match.value(envLang).pipe(
Match.when('TypeScript', () =>
- generateTypescriptTypeStubs({ outputOpt, compact: false, transpiled: false })
+ generateTypescriptTypeStubs({ outputOpt, compact: false, transpiled: false, typeTools })
),
Match.when('Python', () => generatePythonTypeStubs({ outputOpt })),
Match.exhaustive
diff --git a/ts/packages/cli/src/commands/login.cmd.ts b/ts/packages/cli/src/commands/login.cmd.ts
index 27a86aacb..3fc7b1b3a 100644
--- a/ts/packages/cli/src/commands/login.cmd.ts
+++ b/ts/packages/cli/src/commands/login.cmd.ts
@@ -1,4 +1,4 @@
-import { Command, Options, Prompt } from '@effect/cli';
+import { Command, Options } from '@effect/cli';
import { Effect, Console, Schedule } from 'effect';
import { green } from 'ansis';
import open, { apps } from 'open';
diff --git a/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts b/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
index 9e593cc07..b4be2057e 100644
--- a/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+++ b/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
@@ -55,7 +55,7 @@ export function generatePythonTypeStubs({ outputOpt }: GetCmdParams<typeof _pyCm
const [toolkits, tools, triggerTypes] = yield* Effect.all(
[
Effect.logDebug('Fetching toolkits...').pipe(Effect.flatMap(() => client.getToolkits())),
- Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getTools())),
+ Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getToolsAsEnums())),
Effect.logDebug('Fetching trigger types payloads...').pipe(
Effect.flatMap(() => client.getTriggerTypes(triggerTypesAsEnums.length))
),
@@ -63,7 +63,9 @@ export function generatePythonTypeStubs({ outputOpt }: GetCmdParams<typeof _pyCm
{ concurrency: 'unbounded' }
);
- const index = createToolkitIndex({ toolkits, tools, triggerTypes });
+ const typeableTools = { withTypes: false as const, tools };
+
+ const index = createToolkitIndex({ toolkits, typeableTools, triggerTypes });
// Generate Python sources
const sources = generatePythonSources({
diff --git a/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts b/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
index 8714f6a57..b620105e2 100644
--- a/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
+++ b/ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
@@ -17,6 +17,7 @@
import path from 'node:path';
import { Command, Options } from '@effect/cli';
import { Console, Effect, Option, pipe } from 'effect';
+import { Match } from 'effect';
import { FileSystem } from '@effect/platform';
import { ComposioToolkitsRepository } from 'src/services/composio-clients';
import { NodeProcess } from 'src/services/node-process';
@@ -46,10 +47,16 @@ export const transpiled = Options.boolean('transpiled').pipe(
Options.withDescription('Whether to emit transpiled JavaScript alongside TypeScript files')
);
+export const typeTools = Options.boolean('type-tools').pipe(
+ Options.withDefault(false),
+ Options.withDescription('Whether to emit type stubs for tools')
+);
+
const _tsCmd$Generate = Command.make('generate', {
outputOpt,
compact,
transpiled: transpiled,
+ typeTools,
}).pipe(Command.withDescription('Updates the local type stubs with the latest app data.'));
/**
@@ -89,6 +96,7 @@ export const tsCmd$Generate = _tsCmd$Generate.pipe(
export function generateTypescriptTypeStubs({
outputOpt,
compact,
+ typeTools,
transpiled = false,
}: GetCmdParams<typeof _tsCmd$Generate> & { transpiled?: boolean }) {
return Effect.gen(function* () {
@@ -116,14 +124,16 @@ export function generateTypescriptTypeStubs({
// Fetch data from Composio API
yield* Console.log('Fetching latest data from Composio API...');
- const triggerTypesAsEnums = yield* Effect.logDebug('Fetching trigger types...').pipe(
- Effect.flatMap(() => client.getTriggerTypesAsEnums())
- );
+ const [triggerTypesAsEnums, toolsAsEnums] = yield* Effect.all([
+ Effect.logDebug('Fetching trigger types...').pipe(
+ Effect.flatMap(() => client.getTriggerTypesAsEnums())
+ ),
+ Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getToolsAsEnums())),
+ ]);
- const [toolkits, tools, triggerTypes] = yield* Effect.all(
+ const [toolkits, triggerTypes] = yield* Effect.all(
[
Effect.logDebug('Fetching toolkits...').pipe(Effect.flatMap(() => client.getToolkits())),
- Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getTools())),
Effect.logDebug('Fetching trigger types payloads...').pipe(
Effect.flatMap(() => client.getTriggerTypes(triggerTypesAsEnums.length))
),
@@ -131,7 +141,27 @@ export function generateTypescriptTypeStubs({
{ concurrency: 'unbounded' }
);
- const index = createToolkitIndex({ toolkits, tools, triggerTypes });
+ // Only fetch tools if `--type-tools` was specified
+ const typeableTools = yield* Match.value(typeTools).pipe(
+ Match.when(true, typePredicate =>
+ Effect.logDebug('Fetching tools...').pipe(
+ Effect.flatMap(() => client.getTools(toolsAsEnums.length)),
+ Effect.map(tools => ({
+ withTypes: typePredicate,
+ tools,
+ }))
+ )
+ ),
+ Match.when(false, typePredicate =>
+ Effect.succeed({
+ withTypes: typePredicate,
+ tools: toolsAsEnums,
+ })
+ ),
+ Match.exhaustive
+ );
+
+ const index = createToolkitIndex({ toolkits, typeableTools, triggerTypes });
// Generate TypeScript sources
const sources = yield* generateTypeScriptSources({
diff --git a/ts/packages/cli/src/effects/force-config.ts b/ts/packages/cli/src/effects/force-config.ts
index 00618e93b..4628681cd 100644
--- a/ts/packages/cli/src/effects/force-config.ts
+++ b/ts/packages/cli/src/effects/force-config.ts
@@ -1,4 +1,4 @@
-import { Config, Option } from 'effect';
+import { Config } from 'effect';
type FORCE_CONFIG = Config.Config.Wrap<{
USE_CACHE: boolean;
diff --git a/ts/packages/cli/src/generation/create-toolkit-index.ts b/ts/packages/cli/src/generation/create-toolkit-index.ts
index 628712661..3a2af96d1 100644
--- a/ts/packages/cli/src/generation/create-toolkit-index.ts
+++ b/ts/packages/cli/src/generation/create-toolkit-index.ts
@@ -1,7 +1,7 @@
-import { pipe, String, Record } from 'effect';
+import { pipe, String, Record, Match } from 'effect';
import type { Simplify } from 'effect/Types';
import { Toolkit, Toolkits, ToolkitName } from 'src/models/toolkits';
-import { Tools } from 'src/models/tools';
+import { ToolsAsEnums, Tools, ToolAsEnum, Tool } from 'src/models/tools';
import { TriggerType, TriggerTypes } from 'src/models/trigger-types';
const startsWith =
@@ -11,13 +11,15 @@ const startsWith =
interface CreateToolkitIndexInput {
toolkits: Toolkits; // e.g., [ { slug: 'gmail', ... }]
- tools: Tools; // e.g., [ 'GMAIL_SEND_EMAIL' ]
+ typeableTools: { withTypes: false; tools: ToolsAsEnums } | { withTypes: true; tools: Tools }; // e.g., [ 'GMAIL_SEND_EMAIL' ] | [ { slug: 'GMAIL_SEND_EMAIL', ... } ]
triggerTypes: TriggerTypes; // e.g., [ { slug: 'GMAIL_NEW_EMAIL', ... } ]
}
export type ToolkitIndexData = Simplify<{
slug: string;
- tools: Record<`${ToolkitName}_${string}`, string>;
+ typeableTools:
+ | { withTypes: false; value: Record<`${ToolkitName}_${string}`, ToolAsEnum> }
+ | { withTypes: true; value: Record<`${ToolkitName}_${string}`, Tool> };
triggerTypes: Record<`${ToolkitName}_${string}`, TriggerType>;
}>;
@@ -37,14 +39,34 @@ export function createToolkitIndex(input: CreateToolkitIndexInput): Simplify<Too
const stripPrefix = String.slice(key.length + 1);
const { slug } = value.toolkit;
- const tools = value.tools.map(tool => [stripPrefix(tool), tool] as const);
+
+ const typeableTools = Match.value(value.typeableTools).pipe(
+ Match.when({ withTypes: true }, ({ withTypes, tools }) => {
+ return {
+ withTypes,
+ value: Record.fromEntries(tools.map(tool => [stripPrefix(tool.slug), tool] as const)),
+ };
+ }),
+ Match.when({ withTypes: false }, ({ withTypes, tools }) => {
+ return {
+ withTypes,
+ value: Record.fromEntries(tools.map(tool => [stripPrefix(tool), tool] as const)),
+ };
+ }),
+ Match.exhaustive
+ );
+
const triggerTypes = value.triggerTypes.map(
triggerType => [stripPrefix(triggerType.slug), triggerType] as const
);
return [
key,
- { slug, tools: Record.fromEntries(tools), triggerTypes: Record.fromEntries(triggerTypes) },
+ {
+ slug,
+ typeableTools,
+ triggerTypes: Record.fromEntries(triggerTypes),
+ },
] as const;
})
);
@@ -58,7 +80,9 @@ type GroupByToolkitOutput<T extends ToolkitName> = [
Uppercase<T>,
{
toolkit: Toolkit;
- tools: Array<`${Uppercase<T>}_${string}`>;
+ typeableTools:
+ | { withTypes: false; tools: Array<`${Uppercase<T>}_${string}`> }
+ | { withTypes: true; tools: Array<Tool & { slug: `${Uppercase<T>}_${string}` }> };
triggerTypes: Array<TriggerTypeWithUppercaseSlug<T>>;
},
];
@@ -66,18 +90,32 @@ type GroupByToolkitOutput<T extends ToolkitName> = [
const groupByToolkit =
<const T extends string>(toolkit: Omit<Toolkit, 'name'> & { name: T }) =>
({
- tools,
+ typeableTools,
triggerTypes,
}: Omit<CreateToolkitIndexInput, 'toolkits'>): GroupByToolkitOutput<T & ToolkitName> => {
const toolkitName = pipe(toolkit.slug, String.toUpperCase, ToolkitName) as Uppercase<
T & ToolkitName
>;
+ const filteredTypeableTools = Match.value(typeableTools).pipe(
+ Match.when({ withTypes: true }, ({ withTypes, tools }) => ({
+ withTypes,
+ tools: tools.filter(tool => startsWith(`${toolkitName}_`)(tool.slug)) as Array<
+ Tool & { slug: `${typeof toolkitName}_${string}` }
+ >,
+ })),
+ Match.when({ withTypes: false }, ({ withTypes, tools }) => ({
+ withTypes,
+ tools: tools.filter(startsWith(`${toolkitName}_`)),
+ })),
+ Match.exhaustive
+ );
+
return [
toolkitName,
{
toolkit,
- tools: tools.filter(startsWith(`${toolkitName}_`)),
+ typeableTools: filteredTypeableTools,
triggerTypes: triggerTypes.filter(triggerType =>
startsWith(`${toolkitName}_`)(triggerType.slug)
) as Array<TriggerTypeWithUppercaseSlug<T & ToolkitName>>,
diff --git a/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts b/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
index 667c4d782..9c01ad2c8 100644
--- a/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
+++ b/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
@@ -31,7 +31,7 @@
* ```
*/
-import { pipe, Record } from 'effect';
+import { Match, pipe, Record } from 'effect';
import type { ToolkitName } from 'src/models/toolkits';
import type { ToolkitIndex, ToolkitIndexData } from 'src/generation/create-toolkit-index';
import type { SourceFile } from 'src/generation/types';
@@ -120,8 +120,18 @@ function generatePythonToolkitSource(banner: string) {
const toolsEntries = (spacing: number) => {
const spacePad = ' '.repeat(spacing);
- if (Record.size(toolkit.tools) > 0) {
- return Object.entries(toolkit.tools)
+ if (Object.keys(toolkit.typeableTools.value).length > 0) {
+ const tools = Match.value(toolkit.typeableTools).pipe(
+ Match.when({ withTypes: true }, ({ value }) =>
+ Record.mapEntries(value, (toolValue, toolName) => [toolName, toolValue.slug])
+ ),
+ Match.when({ withTypes: false }, ({ value }) =>
+ Record.mapEntries(value, (toolValue, toolName) => [toolName, toolValue])
+ ),
+ Match.exhaustive
+ );
+
+ return Object.entries(tools)
.map(([toolName, toolValue]) => `${spacePad}${toolName} = "${toolValue}"`)
.join('\n');
}
diff --git a/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts b/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts
index 14b110751..626ea9714 100644
--- a/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts
+++ b/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts
@@ -116,7 +116,7 @@ export function generateTypeScriptToolkitSources(banner: string) {
function generateTypeScriptToolkitSource(_banner: string) {
return (
toolkitName: ToolkitName,
- { slug, tools, triggerTypes }: ToolkitIndexData
+ { slug, typeableTools, triggerTypes }: ToolkitIndexData
): Effect.Effect<SourceFile, GenerateTypeFromJsonSchemaError, never> => {
return Effect.gen(function* () {
const filename = `${slug}.ts`;
@@ -129,6 +129,107 @@ function generateTypeScriptToolkitSource(_banner: string) {
);
}
+ if (typeableTools.withTypes) {
+ file.add(
+ ts.docSectionComment(
+ `// --------------- //
+ // Tool types //
+ // --------------- //
+ `
+ )
+ );
+
+ // write type declarations for each tool, without exporting them
+ for (const [toolName, tool] of Record.toEntries(typeableTools.value)) {
+ // e.g., `type GMAIL_SEND_EMAIL_INPUT = { .. }`
+ const toolInputType = yield* generateTypeFromJsonSchema(
+ `${toolkitName}_${toolName}_INPUT`,
+ tool.input_parameters
+ );
+
+ // e.g., `type GMAIL_SEND_EMAIL_OUTPUT = { .. }`
+ const toolOutputType = yield* generateTypeFromJsonSchema(
+ `${toolkitName}_${toolName}_OUTPUT`,
+ tool.output_parameters
+ );
+
+ file.add(
+ ts
+ .typeDeclaration(tool.slug, toolInputType)
+ .setDocComment(ts.docComment(`Type of ${toolkitName}'s ${tool.slug} tool input.`))
+ );
+
+ file.add(
+ ts
+ .typeDeclaration(tool.slug, toolOutputType)
+ .setDocComment(ts.docComment(`Type of ${toolkitName}'s ${tool.slug} tool output.`))
+ );
+ }
+
+ // write the map of input tool types
+ {
+ const toolInputTypeEntries = pipe(
+ typeableTools.value,
+ Record.map((_, toolName) =>
+ ts.property(toolName, ts.namedType(`${toolkitName}_${toolName}_INPUT`))
+ ),
+ Record.toEntries,
+ Arr.map(([_, value]) => value)
+ );
+
+ const doc = ts.docComment(
+ `Type map of all available tool input types for toolkit "${toolkitName}".`
+ );
+
+ file.add(
+ ts
+ .moduleExport(
+ ts.typeDeclaration(
+ `${toolkitName}_TOOL_INPUTS`,
+ ts.objectType().addMultiple(toolInputTypeEntries)
+ )
+ )
+ .setDocComment(doc)
+ );
+ }
+
+ // write the map of output tool types
+ {
+ const toolOutputTypeEntries = pipe(
+ typeableTools.value,
+ Record.map((_, toolName) =>
+ ts.property(toolName, ts.namedType(`${toolkitName}_${toolName}_OUTPUT`))
+ ),
+ Record.toEntries,
+ Arr.map(([_, value]) => value)
+ );
+
+ const doc = ts.docComment(
+ `Type map of all available tool input types for toolkit "${toolkitName}".`
+ );
+
+ file.add(
+ ts
+ .moduleExport(
+ ts.typeDeclaration(
+ `${toolkitName}_TOOL_OUTPUTS`,
+ ts.objectType().addMultiple(toolOutputTypeEntries)
+ )
+ )
+ .setDocComment(doc)
+ );
+ }
+ }
+
+ file.add(
+ ts.docSectionComment(
+ `// ------------------- //
+ // Trigger types //
+ // ------------------- //
+ `
+ )
+ );
+
// write type declarations for each trigger payload, without exporting them
for (const [triggerTypeSlug, triggerType] of Record.toEntries(triggerTypes)) {
// e.g., `type GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD = { .. }`
@@ -136,7 +237,13 @@ function generateTypeScriptToolkitSource(_banner: string) {
`${toolkitName}_${triggerTypeSlug}_PAYLOAD`,
triggerType.payload
);
- file.add(ts.typeDeclaration(triggerTypeSlug, triggerPayloadType));
+ file.add(
+ ts
+ .typeDeclaration(triggerTypeSlug, triggerPayloadType)
+ .setDocComment(
+ ts.docComment(`Type of ${toolkitName}'s ${triggerTypeSlug} trigger payload.`)
+ )
+ );
}
// write the toolkit const object declaration
@@ -151,7 +258,7 @@ function generateTypeScriptToolkitSource(_banner: string) {
ts
.objectValue()
.addMultiple(
- Object.entries(tools).map(([toolName, tool]) =>
+ Object.entries(typeableTools.value).map(([toolName, tool]) =>
ts.propertyValue(toolName, ts.stringLiteral(tool).asValue())
)
)
diff --git a/ts/packages/cli/src/generation/typescript/generate.ts b/ts/packages/cli/src/generation/typescript/generate.ts
index b51883898..9562d5fb2 100644
--- a/ts/packages/cli/src/generation/typescript/generate.ts
+++ b/ts/packages/cli/src/generation/typescript/generate.ts
@@ -20,21 +20,21 @@ export function generateTypeScriptSources(params: GenerateTypeScriptSourcesParam
index: ToolkitIndex
): Effect.Effect<Array<SourceFile>, GenerateTypeFromJsonSchemaError, never> =>
Effect.gen(function* () {
- const toolkiteSources = yield* generateTypeScriptToolkitSources(params.banner)(index);
+ const toolkitSources = yield* generateTypeScriptToolkitSources(params.banner)(index);
const indexSource = generateIndexSource(params)(index);
const indexFilename = path.join(params.outputDir, 'index.ts');
if (!params.emitSingleFile) {
return [
- ...toolkiteSources.map(
+ ...toolkitSources.map(
([filename, content]) => [path.join(params.outputDir, filename), content] as const
),
[indexFilename, indexSource] as const,
] as const;
}
- const localToolkitsSources = toolkiteSources.map(([_, content]) => content).join('\n');
+ const localToolkitsSources = toolkitSources.map(([_, content]) => content).join('\n');
const indexSourceSingleFile = `${ts.stringify(ts.docComment(params.banner))}
${localToolkitsSources}
diff --git a/ts/packages/cli/src/models/tools.ts b/ts/packages/cli/src/models/tools.ts
index d04dbf827..031f4ff81 100644
--- a/ts/packages/cli/src/models/tools.ts
+++ b/ts/packages/cli/src/models/tools.ts
@@ -2,21 +2,21 @@ import { Brand, Schema } from 'effect';
import { JSONTransformSchema } from './utils/json-transform-schema';
import { extractActual } from './utils/extract-actual';
-export const Tool = Schema.String.annotations({ identifier: 'Tool' });
-export type Tool = Schema.Schema.Type<typeof Tool>;
+export const ToolAsEnum = Schema.String.annotations({ identifier: 'ToolAsEnum' });
+export type ToolAsEnum = Schema.Schema.Type<typeof ToolAsEnum>;
-export const Tools = Schema.Array(Tool).annotations({
- identifier: 'Array<Tool>',
+export const ToolsAsEnums = Schema.Array(ToolAsEnum).annotations({
+ identifier: 'Array<ToolAsEnum>',
message: issue => ({
message: `Expected an array of strings, got ${extractActual(issue)}`,
override: true,
}),
});
-export type Tools = Schema.Schema.Type<typeof Tools>;
+export type ToolsAsEnums = Schema.Schema.Type<typeof ToolsAsEnums>;
-export const ToolsJSON = JSONTransformSchema(Tools);
-export const toolsFromJSON = Schema.decode(ToolsJSON);
-export const toolsToJSON = Schema.encode(ToolsJSON);
+export const ToolsAsEnumsJSON = JSONTransformSchema(ToolsAsEnums);
+export const toolsAsEnumsFromJSON = Schema.decode(ToolsAsEnumsJSON);
+export const toolsAsEnumsToJSON = Schema.encode(ToolsAsEnumsJSON);
// E.g., `SEND_EMAIL`
export type ToolName = string & Brand.Brand<'ToolName'>;
@@ -25,3 +25,45 @@ export const ToolName = Brand.nominal<ToolName>();
// E.g., `GMAIL_SEND_EMAIL`
export type ToolNameWithToolkitPrefix = string & Brand.Brand<'ToolNameWithToolkitPrefix'>;
export const ToolNameWithToolkitPrefix = Brand.nominal<ToolNameWithToolkitPrefix>();
+
+/**
+ * Tool with payload
+ */
+export const Tool = Schema.Struct({
+ /**
+ * List of available versions of this tool
+ */
+ available_versions: Schema.Array(Schema.String),
+ /**
+ * Human-readable display name of the tool
+ */
+ name: Schema.String,
+ /**
+ * Unique identifier for the tool
+ */
+ slug: ToolAsEnum,
+ /**
+ * Schema definition of required input parameters for the tool
+ */
+ input_parameters: Schema.Record({ key: Schema.String, value: Schema.Unknown }),
+ /**
+ * Schema definition of required output parameters for the tool
+ */
+ output_parameters: Schema.Record({ key: Schema.String, value: Schema.Unknown }),
+ /**
+ * Detailed explanation of the tool's functionality and purpose.
+ */
+ description: Schema.String,
+ /**
+ * List of tags associated with the tool for categorization and filtering.
+ */
+ tags: Schema.Array(Schema.String),
+}).annotations({ identifier: 'Tool' });
+export type Tool = Schema.Schema.Type<typeof Tool>;
+
+export const Tools = Schema.Array(Tool).annotations({ identifier: 'Array<Tool>' });
+export type Tools = Schema.Schema.Type<typeof Tools>;
+
+export const ToolsJSON = JSONTransformSchema(Tools);
+export const ToolsFromJSON = Schema.decode(ToolsJSON);
+export const ToolsToJSON = Schema.encode(ToolsJSON);
diff --git a/ts/packages/cli/src/models/trigger-types.ts b/ts/packages/cli/src/models/trigger-types.ts
index 5b5ec99e7..5b2d07385 100644
--- a/ts/packages/cli/src/models/trigger-types.ts
+++ b/ts/packages/cli/src/models/trigger-types.ts
@@ -1,7 +1,6 @@
import { Brand, Schema } from 'effect';
import { JSONTransformSchema } from './utils/json-transform-schema';
import { extractActual } from './utils/extract-actual';
-import { Toolkit } from './toolkits';
/**
* TriggerType as Enums
diff --git a/ts/packages/cli/src/services/composio-clients-cached.ts b/ts/packages/cli/src/services/composio-clients-cached.ts
index 151dddf4d..e317673ef 100644
--- a/ts/packages/cli/src/services/composio-clients-cached.ts
+++ b/ts/packages/cli/src/services/composio-clients-cached.ts
@@ -7,7 +7,12 @@ import { FORCE_CONFIG } from 'src/effects/force-config';
import { ComposioToolkitsRepository } from './composio-clients';
import { NodeOs } from './node-os';
import { toolkitsFromJSON, toolkitsToJSON } from 'src/models/toolkits';
-import { toolsFromJSON, toolsToJSON } from 'src/models/tools';
+import {
+ toolsAsEnumsFromJSON,
+ toolsAsEnumsToJSON,
+ ToolsFromJSON,
+ ToolsToJSON,
+} from 'src/models/tools';
import {
TriggerTypesAsEnumsFromJSON,
TriggerTypesAsEnumsToJSON,
@@ -22,6 +27,7 @@ import { ConfigLive } from './config';
export const CACHE_FILES = {
toolkits: 'toolkits.json',
tools: 'tools.json',
+ toolsAsEnums: 'tools-as-enums.json',
triggerTypesAsEnums: 'trigger-types-as-enums.json',
triggerTypes: 'trigger-types.json',
} as const;
@@ -118,12 +124,12 @@ export const ComposioToolkitsRepositoryCached = Layer.effect(
);
},
- getTools: () => {
+ getToolsAsEnums: () => {
return createCachedEffect(
- CACHE_FILES.tools,
- toolsFromJSON,
- toolsToJSON,
- underlyingRepository.getTools()
+ CACHE_FILES.toolsAsEnums,
+ toolsAsEnumsFromJSON,
+ toolsAsEnumsToJSON,
+ underlyingRepository.getToolsAsEnums()
);
},
@@ -145,6 +151,16 @@ export const ComposioToolkitsRepositoryCached = Layer.effect(
underlyingRepository.getTriggerTypes(limit)
);
},
+
+ getTools: (limit: number) => {
+ return createCachedEffect(
+ // We don't care about the limit in the cache file name
+ CACHE_FILES.tools,
+ ToolsFromJSON,
+ ToolsToJSON,
+ underlyingRepository.getTools(limit)
+ );
+ },
});
})
).pipe(
diff --git a/ts/packages/cli/src/services/composio-clients.ts b/ts/packages/cli/src/services/composio-clients.ts
index 19920c664..764719cb8 100644
--- a/ts/packages/cli/src/services/composio-clients.ts
+++ b/ts/packages/cli/src/services/composio-clients.ts
@@ -1,7 +1,7 @@
import { pipe, Data, Effect, Option, Schema, Array, Order, ParseResult } from 'effect';
import { Composio as _RawComposioClient } from '@composio/client';
import { Toolkit, Toolkits } from 'src/models/toolkits';
-import { Tools } from 'src/models/tools';
+import { ToolsAsEnums, Tools, Tool } from 'src/models/tools';
import { Session, RetrievedSession } from 'src/models/session';
import { TriggerType, TriggerTypes, TriggerTypesAsEnums } from 'src/models/trigger-types';
import { ComposioUserContext, ComposioUserContextLive } from './user-context';
@@ -45,7 +45,14 @@ export const ToolkitsResponse = Schema.Struct({
}).annotations({ identifier: 'ToolkitsResponse' });
export type ToolkitsResponse = Schema.Schema.Type<typeof ToolkitsResponse>;
-export const ToolsResponse = Tools;
+export const ToolsAsEnumsResponse = ToolsAsEnums;
+export type ToolsAsEnumsResponse = Schema.Schema.Type<typeof ToolsAsEnumsResponse>;
+
+export const ToolsResponse = Schema.Struct({
+ items: Tools,
+ total_pages: Schema.Int,
+ next_cursor: Schema.NullOr(Schema.Int),
+}).annotations({ identifier: 'ToolsResponse' });
export type ToolsResponse = Schema.Schema.Type<typeof ToolsResponse>;
export const TriggerTypesAsEnumsResponse = TriggerTypesAsEnums;
@@ -182,7 +189,17 @@ export class ComposioClientLive extends Effect.Service<ComposioClientLive>()(
* Retrieve a list of all available tool enumeration values (tool slugs) for the project.
*/
retrieveEnum: () =>
- callClient(clientSingleton, client => client.tools.retrieveEnum(), ToolsResponse),
+ callClient(
+ clientSingleton,
+ client => client.tools.retrieveEnum(),
+ ToolsAsEnumsResponse
+ ),
+ /**
+ * Retrieve a list of $limit trigger types, containing their payload.
+ * Usually, you would call this with a limit matching the length of the list returned by `retrieveEnum`.
+ */
+ list: (params: { limit: number }) =>
+ callClient(clientSingleton, client => client.tools.list(params), ToolsResponse),
},
triggersTypes: {
/**
@@ -242,7 +259,6 @@ export class ComposioToolkitsRepository extends Effect.Service<ComposioToolkitsR
getToolkits: () =>
client.toolkits.list().pipe(
Effect.map(response => response.items),
- Effect.tap(Effect.logDebug),
Effect.flatMap(
Effect.fn(function* (toolkits) {
// Sort apps by slug.
@@ -252,13 +268,23 @@ export class ComposioToolkitsRepository extends Effect.Service<ComposioToolkitsR
})
)
),
- getTools: () => client.tools.retrieveEnum().pipe(Effect.tap(Effect.logDebug)),
- getTriggerTypesAsEnums: () =>
- client.triggersTypes.retrieveEnum().pipe(Effect.tap(Effect.logDebug)),
+ getToolsAsEnums: () => client.tools.retrieveEnum(),
+ getTools: (limit: number) =>
+ client.tools.list({ limit }).pipe(
+ Effect.map(response => response.items),
+ Effect.flatMap(
+ Effect.fn(function* (tools) {
+ // Sort apps by slug.
+ // TODO: make sure this happens on the server-side.
+ const orderBySlug = Order.mapInput(Order.string, (app: Tool) => app.slug);
+ return Array.sort(tools, orderBySlug) as ReadonlyArray<Tool>;
+ })
+ )
+ ),
+ getTriggerTypesAsEnums: () => client.triggersTypes.retrieveEnum(),
getTriggerTypes: (limit: number) =>
client.triggersTypes.list({ limit }).pipe(
Effect.map(response => response.items),
- Effect.tap(Effect.logDebug),
Effect.flatMap(
Effect.fn(function* (triggerTypes) {
// Sort apps by slug.
diff --git a/ts/packages/cli/src/services/config.ts b/ts/packages/cli/src/services/config.ts
index e95397b25..2a893e2b9 100644
--- a/ts/packages/cli/src/services/config.ts
+++ b/ts/packages/cli/src/services/config.ts
@@ -1,4 +1,4 @@
-import { Option, Effect, ConfigProvider, Layer, Logger, LogLevel } from 'effect';
+import { Option, Effect, ConfigProvider, Layer, Logger } from 'effect';
import * as constants from 'src/constants';
import { DEBUG_OVERRIDE_CONFIG } from 'src/effects/debug-config';
import { APP_CONFIG } from 'src/effects/app-config';
diff --git a/ts/packages/cli/test/__utils__/services/test-layer.ts b/ts/packages/cli/test/__utils__/services/test-layer.ts
index cebe8b96d..af7a4299f 100644
--- a/ts/packages/cli/test/__utils__/services/test-layer.ts
+++ b/ts/packages/cli/test/__utils__/services/test-layer.ts
@@ -24,7 +24,7 @@ import {
} from 'src/services/composio-clients';
import { EnvLangDetector } from 'src/services/env-lang-detector';
import { JsPackageManagerDetector } from 'src/services/js-package-manager-detector';
-import type { Tools } from 'src/models/tools';
+import type { ToolsAsEnums } from 'src/models/tools';
import type { TriggerTypes, TriggerTypesAsEnums } from 'src/models/trigger-types';
import { ComposioUserContextLive } from 'src/services/user-context';
import { UpgradeBinary } from 'src/services/upgrade-binary';
@@ -48,7 +48,7 @@ export interface TestLiveInput {
*/
toolkitsData?: {
toolkits?: Toolkits;
- tools?: Tools;
+ tools?: ToolsAsEnums;
triggerTypesAsEnums?: TriggerTypesAsEnums;
triggerTypes?: TriggerTypes;
};
@@ -90,9 +90,10 @@ export const TestLayer = (input?: TestLiveInput) =>
ComposioToolkitsRepository,
new ComposioToolkitsRepository({
getToolkits: () => Effect.succeed(toolkitsData.toolkits),
- getTools: () => Effect.succeed(toolkitsData.tools),
+ getToolsAsEnums: () => Effect.succeed(toolkitsData.tools),
getTriggerTypesAsEnums: () => Effect.succeed(toolkitsData.triggerTypesAsEnums),
getTriggerTypes: limit => Effect.succeed(toolkitsData.triggerTypes.slice(0, limit)),
+ getTools: limit => Effect.succeed(toolkitsData.tools.slice(0, limit)),
})
);
diff --git a/ts/packages/cli/test/src/commands/$default.cmd.test.ts b/ts/packages/cli/test/src/commands/$default.cmd.test.ts
index c87225e1c..4059d450d 100644
--- a/ts/packages/cli/test/src/commands/$default.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/$default.cmd.test.ts
@@ -58,25 +58,25 @@ describe('CLI: composio', () => {
COMMANDS
- - version Display your account information.
+ - version Display your account information.
- - upgrade Upgrade your Composio CLI to the latest available version.
+ - upgrade Upgrade your Composio CLI to the latest available version.
- - whoami Display your account information.
+ - whoami Display your account information.
- - login [--no-browser] Log in to the Composio SDK.
+ - login [--no-browser] Log in to the Composio SDK.
- - logout Log out from the Composio SDK.
+ - logout Log out from the Composio SDK.
- - generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data, automatically detecting the language of the project in the current working directory (TypeScript | Python).
+ - generate [(-o, --output-dir directory)] [--type-tools] Updates the local type stubs with the latest app data, automatically detecting the language of the project in the current working directory (TypeScript | Python).
- - py Handle Python projects.
+ - py Handle Python projects.
- - py generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data.
+ - py generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data.
- - ts Handle TypeScript projects.
+ - ts Handle TypeScript projects.
- - ts generate [(-o, --output-dir directory)] [--compact] [--transpiled] Updates the local type stubs with the latest app data.
+ - ts generate [(-o, --output-dir directory)] [--compact] [--transpiled] [--type-tools] Updates the local type stubs with the latest app data.
"
`);
})
diff --git a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
index bdab4f503..21ca0af39 100644
--- a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
@@ -64,6 +64,15 @@ describe('CLI: composio ts generate', () => {
expect(gmailSourceCode).toMatchInlineSnapshot(`
"import { type TriggerEvent } from "@composio/core"
+ // ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
+ * Type of GMAIL's NEW_GMAIL_MESSAGE trigger payload.
+ */
type GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD = {
/**
* Attachment List
@@ -288,7 +297,13 @@ describe('CLI: composio ts generate', () => {
"
`);
expect(slackSourceCode).toMatchInlineSnapshot(`
- "/**
+ "// ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
* Map of Composio's SLACK toolkit.
*/
export const SLACK = {
@@ -392,6 +407,15 @@ describe('CLI: composio ts generate', () => {
expect(gmailSourceCode).toMatchInlineSnapshot(`
"import { type TriggerEvent } from "@composio/core"
+ // ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
+ * Type of GMAIL's NEW_GMAIL_MESSAGE trigger payload.
+ */
type GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD = {
/**
* Attachment List
@@ -616,7 +640,13 @@ describe('CLI: composio ts generate', () => {
"
`);
expect(slackSourceCode).toMatchInlineSnapshot(`
- "/**
+ "// ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
* Map of Composio's SLACK toolkit.
*/
export const SLACK = {
diff --git a/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts b/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
index 419ebc403..47a69c60b 100644
--- a/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
+++ b/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
@@ -11,7 +11,7 @@ describe('generatePythonToolkitSources', () => {
it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty array', () => {
const index = createToolkitIndex({
toolkits: [],
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -30,7 +30,7 @@ describe('generatePythonToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -71,7 +71,7 @@ describe('generatePythonToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [...TOOLS_GMAIL.slice(0, 3)],
+ typeableTools: { withTypes: false, tools: [...TOOLS_GMAIL.slice(0, 3)] },
triggerTypes: [...TRIGGER_TYPES_GMAIL],
});
diff --git a/ts/packages/cli/test/src/generation/toolkit-index.test.ts b/ts/packages/cli/test/src/generation/toolkit-index.test.ts
index c3d1c45a4..0ddf90a49 100644
--- a/ts/packages/cli/test/src/generation/toolkit-index.test.ts
+++ b/ts/packages/cli/test/src/generation/toolkit-index.test.ts
@@ -7,7 +7,7 @@ describe('createToolkitIndex', () => {
it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty index', () => {
const index = createToolkitIndex({
toolkits: [],
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -28,19 +28,19 @@ describe('createToolkitIndex', () => {
const index = createToolkitIndex({
toolkits,
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
expect(index).toEqual({
GMAIL: {
slug: 'gmail',
- tools: {},
+ typeableTools: { withTypes: false, value: {} },
triggerTypes: {},
},
SLACK: {
slug: 'slack',
- tools: {},
+ typeableTools: { withTypes: false, value: {} },
triggerTypes: {},
},
});
@@ -67,17 +67,20 @@ describe('createToolkitIndex', () => {
const index = createToolkitIndex({
toolkits,
- tools,
+ typeableTools: { withTypes: false, tools },
triggerTypes,
});
expect(index).toEqual({
GMAIL: {
slug: 'gmail',
- tools: {
- CREATE_EMAIL_DRAFT: 'GMAIL_CREATE_EMAIL_DRAFT',
- DELETE_MESSAGE: 'GMAIL_DELETE_MESSAGE',
- FETCH_EMAILS: 'GMAIL_FETCH_EMAILS',
+ typeableTools: {
+ withTypes: false,
+ value: {
+ CREATE_EMAIL_DRAFT: 'GMAIL_CREATE_EMAIL_DRAFT',
+ DELETE_MESSAGE: 'GMAIL_DELETE_MESSAGE',
+ FETCH_EMAILS: 'GMAIL_FETCH_EMAILS',
+ },
},
triggerTypes: {
NEW_GMAIL_MESSAGE: GMAIL_NEW_GMAIL_MESSAGE,
@@ -85,7 +88,7 @@ describe('createToolkitIndex', () => {
},
SLACK: {
slug: 'slack',
- tools: {},
+ typeableTools: { withTypes: false, value: {} },
triggerTypes: {},
},
});
diff --git a/ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts b/ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts
index e541d9605..16994025b 100644
--- a/ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts
+++ b/ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts
@@ -28,7 +28,7 @@ describe('generateTypeScriptToolkitSources', () => {
it('[Given] empty toolkits, tools, triggerTypes [Then] it creates a valid but empty index map', () => {
const index = createToolkitIndex({
toolkits: [],
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -71,7 +71,7 @@ describe('generateTypeScriptToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -119,7 +119,10 @@ describe('generateTypeScriptToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [...TOOLS_GMAIL.slice(0, 3), ...TOOLS_GITHUB.slice(0, 3)],
+ typeableTools: {
+ withTypes: false,
+ tools: [...TOOLS_GMAIL.slice(0, 3), ...TOOLS_GITHUB.slice(0, 3)],
+ },
triggerTypes: [...TRIGGER_TYPES_GITHUB, ...TRIGGER_TYPES_GMAIL],
});
@@ -173,7 +176,7 @@ describe('generateTypeScriptToolkitSources', () => {
it('[Given] empty toolkits, tools, triggerTypes [Then] it creates a valid but empty index map', () => {
const index = createToolkitIndex({
toolkits: [],
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -220,7 +223,7 @@ describe('generateTypeScriptToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -274,7 +277,10 @@ describe('generateTypeScriptToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
+ typeableTools: {
+ withTypes: false,
+ tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
+ },
triggerTypes: [...TRIGGER_TYPES_GMAIL],
});
diff --git a/ts/packages/cli/test/src/generation/typescript/generate-toolkit-source.test.ts b/ts/packages/cli/test/src/generation/typescript/generate-toolkit-source.test.ts
index 78ae159fa..e95c03c11 100644
--- a/ts/packages/cli/test/src/generation/typescript/generate-toolkit-source.test.ts
+++ b/ts/packages/cli/test/src/generation/typescript/generate-toolkit-source.test.ts
@@ -20,7 +20,7 @@ describe('generateTypeScriptToolkitSources', () => {
Effect.fn(function* () {
const index = createToolkitIndex({
toolkits: [],
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -42,7 +42,7 @@ describe('generateTypeScriptToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -51,26 +51,32 @@ describe('generateTypeScriptToolkitSources', () => {
expect(sources[0]).toHaveLength(2);
expect(sources[0][0]).toBe('slack.ts');
expect(sources[0][1]).toMatchInlineSnapshot(`
- "/**
- * Map of Composio's SLACK toolkit.
- */
- export const SLACK = {
- slug: "slack",
- tools: {},
- triggerTypes: {},
- }
+ "// ------------------- //
+ // Trigger types //
+ // ------------------- //
- /**
- * Type map of all available trigger payloads for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_PAYLOADS = {}
- /**
- * Type map of all available trigger events for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_EVENTS = {}
- "
- `);
+
+ /**
+ * Map of Composio's SLACK toolkit.
+ */
+ export const SLACK = {
+ slug: "slack",
+ tools: {},
+ triggerTypes: {},
+ }
+
+ /**
+ * Type map of all available trigger payloads for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_PAYLOADS = {}
+
+ /**
+ * Type map of all available trigger events for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_EVENTS = {}
+ "
+ `);
})
);
@@ -98,11 +104,14 @@ describe('generateTypeScriptToolkitSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [
- ...TOOLS_GITHUB.slice(0, 3),
- ...TOOLS_GMAIL.slice(0, 3),
- ...TOOLS_GOOGLEDRIVE.slice(0, 3),
- ],
+ typeableTools: {
+ withTypes: false,
+ tools: [
+ ...TOOLS_GITHUB.slice(0, 3),
+ ...TOOLS_GMAIL.slice(0, 3),
+ ...TOOLS_GOOGLEDRIVE.slice(0, 3),
+ ],
+ },
triggerTypes: [
...TRIGGER_TYPES_GITHUB,
...TRIGGER_TYPES_GMAIL,
@@ -116,882 +125,930 @@ describe('generateTypeScriptToolkitSources', () => {
expect(sources[0]).toHaveLength(2);
expect(sources[0][0]).toBe('gmail.ts');
expect(sources[0][1]).toMatchInlineSnapshot(`
- "import { type TriggerEvent } from "@composio/core"
+ "import { type TriggerEvent } from "@composio/core"
+
+ // ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
- type GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD = {
- /**
- * Attachment List
- * @description The list of attachments in the message
- * @default null
- */
- attachment_list: unknown[] | null;
- /**
- * Message ID
- * @description The message ID of the message
- * @default null
- */
- message_id: string | null;
- /**
- * Message Text
- * @description The text of the message
- * @default null
- */
- message_text: string | null;
- /**
- * Message Timestamp
- * @description The timestamp of the message
- * @default null
- */
- message_timestamp: string | null;
- /**
- * Payload
- * @description The payload of the message
- * @default null
- */
- payload: Record<string, never> | null;
- /**
- * Sender
- * @description The sender of the message
- * @default null
- */
- sender: string | null;
- /**
- * Subject
- * @description The subject of the message
- * @default null
- */
- subject: string | null;
/**
- * Thread ID
- * @description The thread ID of the message
- * @default null
+ * Type of GMAIL's NEW_GMAIL_MESSAGE trigger payload.
*/
- thread_id: string | null;
+ type GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD = {
+ /**
+ * Attachment List
+ * @description The list of attachments in the message
+ * @default null
+ */
+ attachment_list: unknown[] | null;
+ /**
+ * Message ID
+ * @description The message ID of the message
+ * @default null
+ */
+ message_id: string | null;
+ /**
+ * Message Text
+ * @description The text of the message
+ * @default null
+ */
+ message_text: string | null;
+ /**
+ * Message Timestamp
+ * @description The timestamp of the message
+ * @default null
+ */
+ message_timestamp: string | null;
+ /**
+ * Payload
+ * @description The payload of the message
+ * @default null
+ */
+ payload: Record<string, never> | null;
+ /**
+ * Sender
+ * @description The sender of the message
+ * @default null
+ */
+ sender: string | null;
+ /**
+ * Subject
+ * @description The subject of the message
+ * @default null
+ */
+ subject: string | null;
+ /**
+ * Thread ID
+ * @description The thread ID of the message
+ * @default null
+ */
+ thread_id: string | null;
+ /**
+ * To
+ * @description The recipient of the message
+ * @default null
+ */
+ to: string | null;
+ };
+
/**
- * To
- * @description The recipient of the message
- * @default null
+ * Map of Composio's GMAIL toolkit.
*/
- to: string | null;
- };
-
- /**
- * Map of Composio's GMAIL toolkit.
- */
- export const GMAIL = {
- slug: "gmail",
- tools: {
- ADD_LABEL_TO_EMAIL: "GMAIL_ADD_LABEL_TO_EMAIL",
- CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
- CREATE_LABEL: "GMAIL_CREATE_LABEL",
- },
- triggerTypes: {
- NEW_GMAIL_MESSAGE: {
- slug: "GMAIL_NEW_GMAIL_MESSAGE",
- name: "New Gmail Message Received Trigger",
- description: "Triggers when a new message is received in Gmail.",
- instructions: "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
- config: {
- properties: {
- interval: {
- default: 1,
- description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
- title: "Interval",
- type: "number",
- },
- labelIds: {
- default: "INBOX",
- description: "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
- examples: ["INBOX", "UNREAD", "STARRED"],
- title: "Labelids",
- type: "string",
- },
- query: {
- default: "",
- description: "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:[email protected]), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
- examples: ["label:inbox OR label:sent", "from:[email protected] is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
- title: "Query",
- type: "string",
- },
- userId: {
- default: "me",
- description: "The user's email address or 'me' for the authenticated user.",
- examples: ["me"],
- title: "Userid",
- type: "string",
- },
- },
- title: "NewMessageConfig",
- type: "object",
- },
- payload: {
- properties: {
- attachment_list: {
- anyOf: [{
- items: {},
- type: "array",
- }, {
- type: "null",
- }],
- default: null,
- description: "The list of attachments in the message",
- title: "Attachment List",
- },
- message_id: {
- anyOf: [{
- type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The message ID of the message",
- title: "Message ID",
- },
- message_text: {
- anyOf: [{
- type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The text of the message",
- title: "Message Text",
- },
- message_timestamp: {
- anyOf: [{
- type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The timestamp of the message",
- title: "Message Timestamp",
- },
- payload: {
- anyOf: [{
- type: "object",
- }, {
- type: "null",
- }],
- default: null,
- description: "The payload of the message",
- title: "Payload",
- },
- sender: {
- anyOf: [{
+ export const GMAIL = {
+ slug: "gmail",
+ tools: {
+ ADD_LABEL_TO_EMAIL: "GMAIL_ADD_LABEL_TO_EMAIL",
+ CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
+ CREATE_LABEL: "GMAIL_CREATE_LABEL",
+ },
+ triggerTypes: {
+ NEW_GMAIL_MESSAGE: {
+ slug: "GMAIL_NEW_GMAIL_MESSAGE",
+ name: "New Gmail Message Received Trigger",
+ description: "Triggers when a new message is received in Gmail.",
+ instructions: "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
+ config: {
+ properties: {
+ interval: {
+ default: 1,
+ description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
+ title: "Interval",
+ type: "number",
+ },
+ labelIds: {
+ default: "INBOX",
+ description: "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
+ examples: ["INBOX", "UNREAD", "STARRED"],
+ title: "Labelids",
type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The sender of the message",
- title: "Sender",
- },
- subject: {
- anyOf: [{
+ },
+ query: {
+ default: "",
+ description: "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:[email protected]), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
+ examples: ["label:inbox OR label:sent", "from:[email protected] is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
+ title: "Query",
type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The subject of the message",
- title: "Subject",
- },
- thread_id: {
- anyOf: [{
+ },
+ userId: {
+ default: "me",
+ description: "The user's email address or 'me' for the authenticated user.",
+ examples: ["me"],
+ title: "Userid",
type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The thread ID of the message",
- title: "Thread ID",
+ },
},
- to: {
- anyOf: [{
- type: "string",
- }, {
- type: "null",
- }],
- default: null,
- description: "The recipient of the message",
- title: "To",
+ title: "NewMessageConfig",
+ type: "object",
+ },
+ payload: {
+ properties: {
+ attachment_list: {
+ anyOf: [{
+ items: {},
+ type: "array",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The list of attachments in the message",
+ title: "Attachment List",
+ },
+ message_id: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The message ID of the message",
+ title: "Message ID",
+ },
+ message_text: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The text of the message",
+ title: "Message Text",
+ },
+ message_timestamp: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The timestamp of the message",
+ title: "Message Timestamp",
+ },
+ payload: {
+ anyOf: [{
+ type: "object",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The payload of the message",
+ title: "Payload",
+ },
+ sender: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The sender of the message",
+ title: "Sender",
+ },
+ subject: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The subject of the message",
+ title: "Subject",
+ },
+ thread_id: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The thread ID of the message",
+ title: "Thread ID",
+ },
+ to: {
+ anyOf: [{
+ type: "string",
+ }, {
+ type: "null",
+ }],
+ default: null,
+ description: "The recipient of the message",
+ title: "To",
+ },
},
+ title: "NewMessagePayload",
+ type: "object",
},
- title: "NewMessagePayload",
- type: "object",
+ type: "poll",
},
- type: "poll",
},
- },
- }
+ }
- /**
- * Type map of all available trigger payloads for toolkit "GMAIL".
- */
- export type GMAIL_TRIGGER_PAYLOADS = {
- NEW_GMAIL_MESSAGE: GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD
- }
+ /**
+ * Type map of all available trigger payloads for toolkit "GMAIL".
+ */
+ export type GMAIL_TRIGGER_PAYLOADS = {
+ NEW_GMAIL_MESSAGE: GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD
+ }
- /**
- * Type map of all available trigger events for toolkit "GMAIL".
- */
- export type GMAIL_TRIGGER_EVENTS = {
- NEW_GMAIL_MESSAGE: TriggerEvent<GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD>
- }
- "
- `);
+ /**
+ * Type map of all available trigger events for toolkit "GMAIL".
+ */
+ export type GMAIL_TRIGGER_EVENTS = {
+ NEW_GMAIL_MESSAGE: TriggerEvent<GMAIL_NEW_GMAIL_MESSAGE_PAYLOAD>
+ }
+ "
+ `);
expect(sources[1]).toHaveLength(2);
expect(sources[1][0]).toBe('github.ts');
expect(sources[1][1]).toMatchInlineSnapshot(`
- "import { type TriggerEvent } from "@composio/core"
+ "import { type TriggerEvent } from "@composio/core"
- type GITHUB_COMMIT_EVENT_PAYLOAD = {
- /**
- * Author
- * @description The GitHub username of the commit author
- */
- author?: string;
- /**
- * Id
- * @description The SHA of the commit
- */
- id?: string;
- /**
- * Message
- * @description The commit message
- */
- message?: string;
- /**
- * Timestamp
- * @description The timestamp of the commit
- */
- timestamp?: string;
- /**
- * Url
- * @description The GitHub URL of the commit
- */
- url?: string;
- };
+ // ------------------- //
+ // Trigger types //
+ // ------------------- //
- type GITHUB_FOLLOWER_EVENT_PAYLOAD = {
- /**
- * Username
- * @description Username of the github follower
- */
- username?: string;
- };
- type GITHUB_ISSUE_ADDED_EVENT_PAYLOAD = {
- /**
- * Action
- * @description The action that was performed on the issue
- */
- action?: string;
- /**
- * Createdat
- * @description The timestamp when the issue was created
- */
- createdAt?: string;
- /**
- * Createdby
- * @description The GitHub username of the user who created the issue
- */
- createdBy?: string;
- /**
- * Description
- * @description A detailed description of the issue
- * @default
- */
- description: string;
- /**
- * Issue Id
- * @description The unique ID assigned to the issue
- */
- issue_id?: number;
- /**
- * Number
- * @description The unique number assigned to the issue
- */
- number?: number;
- /**
- * Title
- * @description The title of the issue
- */
- title?: string;
- /**
- * Url
- * @description The GitHub URL of the issue
- */
- url?: string;
- };
- type GITHUB_LABEL_ADDED_EVENT_PAYLOAD = {
- /**
- * Action
- * @description The action that was performed on the label
- */
- action?: string;
/**
- * Label
- * @description The name of the label that was added
+ * Type of GITHUB's COMMIT_EVENT trigger payload.
*/
- label?: string;
- /**
- * Labeled At
- * @description The timestamp when the label was added
- */
- labeled_at?: string;
- /**
- * Labeled By
- * @description The GitHub username of the user who added the label
- */
- labeled_by?: string;
- /**
- * Pull Request Number
- * @description The unique number assigned to the pull request
- */
- pull_request_number?: number;
- /**
- * Pull Request Title
- * @description The title of the pull request
- */
- pull_request_title?: string;
- /**
- * Pull Request Url
- * @description The GitHub URL of the pull request
- */
- pull_request_url?: string;
- };
+ type GITHUB_COMMIT_EVENT_PAYLOAD = {
+ /**
+ * Author
+ * @description The GitHub username of the commit author
+ */
+ author?: string;
+ /**
+ * Id
+ * @description The SHA of the commit
+ */
+ id?: string;
+ /**
+ * Message
+ * @description The commit message
+ */
+ message?: string;
+ /**
+ * Timestamp
+ * @description The timestamp of the commit
+ */
+ timestamp?: string;
+ /**
+ * Url
+ * @description The GitHub URL of the commit
+ */
+ url?: string;
+ };
- type GITHUB_PULL_REQUEST_EVENT_PAYLOAD = {
- /**
- * Action
- * @description The action that was performed on the pull request
- */
- action?: string;
- /**
- * Createdat
- * @description The timestamp when the pull request was created
- */
- createdAt?: string;
- /**
- * Createdby
- * @description The GitHub username of the user who created the pull request
- */
- createdBy?: string;
/**
- * Description
- * @description A detailed description of the pull request
- * @default
+ * Type of GITHUB's FOLLOWER_EVENT trigger payload.
*/
- description: string;
- /**
- * Number
- * @description The unique number assigned to the pull request
- */
- number?: number;
- /**
- * Title
- * @description The title of the pull request
- */
- title?: string;
- /**
- * Url
- * @description The GitHub URL of the pull request
- */
- url?: string;
- };
+ type GITHUB_FOLLOWER_EVENT_PAYLOAD = {
+ /**
+ * Username
+ * @description Username of the github follower
+ */
+ username?: string;
+ };
- type GITHUB_STAR_ADDED_EVENT_PAYLOAD = {
- /**
- * Action
- * @description The action that was performed on the star
- */
- action?: string;
/**
- * Repository Id
- * @description The unique ID assigned to the repository
+ * Type of GITHUB's ISSUE_ADDED_EVENT trigger payload.
*/
- repository_id?: number;
+ type GITHUB_ISSUE_ADDED_EVENT_PAYLOAD = {
+ /**
+ * Action
+ * @description The action that was performed on the issue
+ */
+ action?: string;
+ /**
+ * Createdat
+ * @description The timestamp when the issue was created
+ */
+ createdAt?: string;
+ /**
+ * Createdby
+ * @description The GitHub username of the user who created the issue
+ */
+ createdBy?: string;
+ /**
+ * Description
+ * @description A detailed description of the issue
+ * @default
+ */
+ description: string;
+ /**
+ * Issue Id
+ * @description The unique ID assigned to the issue
+ */
+ issue_id?: number;
+ /**
+ * Number
+ * @description The unique number assigned to the issue
+ */
+ number?: number;
+ /**
+ * Title
+ * @description The title of the issue
+ */
+ title?: string;
+ /**
+ * Url
+ * @description The GitHub URL of the issue
+ */
+ url?: string;
+ };
+
/**
- * Repository Name
- * @description The name of the repository
+ * Type of GITHUB's LABEL_ADDED_EVENT trigger payload.
*/
- repository_name?: string;
+ type GITHUB_LABEL_ADDED_EVENT_PAYLOAD = {
+ /**
+ * Action
+ * @description The action that was performed on the label
+ */
+ action?: string;
+ /**
+ * Label
+ * @description The name of the label that was added
+ */
+ label?: string;
+ /**
+ * Labeled At
+ * @description The timestamp when the label was added
+ */
+ labeled_at?: string;
+ /**
+ * Labeled By
+ * @description The GitHub username of the user who added the label
+ */
+ labeled_by?: string;
+ /**
+ * Pull Request Number
+ * @description The unique number assigned to the pull request
+ */
+ pull_request_number?: number;
+ /**
+ * Pull Request Title
+ * @description The title of the pull request
+ */
+ pull_request_title?: string;
+ /**
+ * Pull Request Url
+ * @description The GitHub URL of the pull request
+ */
+ pull_request_url?: string;
+ };
+
/**
- * Repository Url
- * @description The GitHub URL of the repository
+ * Type of GITHUB's PULL_REQUEST_EVENT trigger payload.
*/
- repository_url?: string;
+ type GITHUB_PULL_REQUEST_EVENT_PAYLOAD = {
+ /**
+ * Action
+ * @description The action that was performed on the pull request
+ */
+ action?: string;
+ /**
+ * Createdat
+ * @description The timestamp when the pull request was created
+ */
+ createdAt?: string;
+ /**
+ * Createdby
+ * @description The GitHub username of the user who created the pull request
+ */
+ createdBy?: string;
+ /**
+ * Description
+ * @description A detailed description of the pull request
+ * @default
+ */
+ description: string;
+ /**
+ * Number
+ * @description The unique number assigned to the pull request
+ */
+ number?: number;
+ /**
+ * Title
+ * @description The title of the pull request
+ */
+ title?: string;
+ /**
+ * Url
+ * @description The GitHub URL of the pull request
+ */
+ url?: string;
+ };
+
/**
- * Starred At
- * @description The timestamp when the star was added
+ * Type of GITHUB's STAR_ADDED_EVENT trigger payload.
*/
- starred_at?: string;
+ type GITHUB_STAR_ADDED_EVENT_PAYLOAD = {
+ /**
+ * Action
+ * @description The action that was performed on the star
+ */
+ action?: string;
+ /**
+ * Repository Id
+ * @description The unique ID assigned to the repository
+ */
+ repository_id?: number;
+ /**
+ * Repository Name
+ * @description The name of the repository
+ */
+ repository_name?: string;
+ /**
+ * Repository Url
+ * @description The GitHub URL of the repository
+ */
+ repository_url?: string;
+ /**
+ * Starred At
+ * @description The timestamp when the star was added
+ */
+ starred_at?: string;
+ /**
+ * Starred By
+ * @description The GitHub username of the user who added the star
+ */
+ starred_by?: string;
+ };
+
/**
- * Starred By
- * @description The GitHub username of the user who added the star
+ * Map of Composio's GITHUB toolkit.
*/
- starred_by?: string;
- };
-
- /**
- * Map of Composio's GITHUB toolkit.
- */
- export const GITHUB = {
- slug: "github",
- tools: {
- ACCEPT_A_REPOSITORY_INVITATION: "GITHUB_ACCEPT_A_REPOSITORY_INVITATION",
- ACTIVITY_LIST_REPO_S_STARRED_BY_AUTHENTICATED_USER: "GITHUB_ACTIVITY_LIST_REPO_S_STARRED_BY_AUTHENTICATED_USER",
- ACTIVITY_LIST_STARGAZERS_FOR_REPO: "GITHUB_ACTIVITY_LIST_STARGAZERS_FOR_REPO",
- },
- triggerTypes: {
- COMMIT_EVENT: {
- slug: "GITHUB_COMMIT_EVENT",
- name: "Commit Event",
- description: "Triggered when a new commit is pushed to a repository.",
- instructions: "This trigger fires every time a new commit is pushed to the repository.",
- config: {
- properties: {
- owner: {
- description: "Owner of the repository",
- title: "Owner",
- type: "string",
- },
- repo: {
- description: "Repository name",
- title: "Repo",
- type: "string",
+ export const GITHUB = {
+ slug: "github",
+ tools: {
+ ACCEPT_A_REPOSITORY_INVITATION: "GITHUB_ACCEPT_A_REPOSITORY_INVITATION",
+ ACTIVITY_LIST_REPO_S_STARRED_BY_AUTHENTICATED_USER: "GITHUB_ACTIVITY_LIST_REPO_S_STARRED_BY_AUTHENTICATED_USER",
+ ACTIVITY_LIST_STARGAZERS_FOR_REPO: "GITHUB_ACTIVITY_LIST_STARGAZERS_FOR_REPO",
+ },
+ triggerTypes: {
+ COMMIT_EVENT: {
+ slug: "GITHUB_COMMIT_EVENT",
+ name: "Commit Event",
+ description: "Triggered when a new commit is pushed to a repository.",
+ instructions: "This trigger fires every time a new commit is pushed to the repository.",
+ config: {
+ properties: {
+ owner: {
+ description: "Owner of the repository",
+ title: "Owner",
+ type: "string",
+ },
+ repo: {
+ description: "Repository name",
+ title: "Repo",
+ type: "string",
+ },
},
+ required: ["owner", "repo"],
+ title: "WebhookConfigSchema",
+ type: "object",
},
- required: ["owner", "repo"],
- title: "WebhookConfigSchema",
- type: "object",
- },
- payload: {
- properties: {
- author: {
- description: "The GitHub username of the commit author",
- examples: ["octocat"],
- title: "Author",
- type: "string",
- },
- id: {
- description: "The SHA of the commit",
- examples: ["7638417db6d59f3c431d3e1f261cc637155684cd"],
- title: "Id",
- type: "string",
- },
- message: {
- description: "The commit message",
- examples: ["Fix typo in README"],
- title: "Message",
- type: "string",
- },
- timestamp: {
- description: "The timestamp of the commit",
- examples: ["2021-04-14T02:15:15Z"],
- title: "Timestamp",
- type: "string",
- },
- url: {
- description: "The GitHub URL of the commit",
- examples: ["https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd"],
- title: "Url",
- type: "string",
+ payload: {
+ properties: {
+ author: {
+ description: "The GitHub username of the commit author",
+ examples: ["octocat"],
+ title: "Author",
+ type: "string",
+ },
+ id: {
+ description: "The SHA of the commit",
+ examples: ["7638417db6d59f3c431d3e1f261cc637155684cd"],
+ title: "Id",
+ type: "string",
+ },
+ message: {
+ description: "The commit message",
+ examples: ["Fix typo in README"],
+ title: "Message",
+ type: "string",
+ },
+ timestamp: {
+ description: "The timestamp of the commit",
+ examples: ["2021-04-14T02:15:15Z"],
+ title: "Timestamp",
+ type: "string",
+ },
+ url: {
+ description: "The GitHub URL of the commit",
+ examples: ["https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd"],
+ title: "Url",
+ type: "string",
+ },
},
+ required: ["id", "message", "timestamp", "author", "url"],
+ title: "CommitPayloadSchema",
+ type: "object",
},
- required: ["id", "message", "timestamp", "author", "url"],
- title: "CommitPayloadSchema",
- type: "object",
+ type: "webhook",
},
- type: "webhook",
- },
- FOLLOWER_EVENT: {
- slug: "GITHUB_FOLLOWER_EVENT",
- name: "Follower Changes",
- description: "Triggers when there are changes in GitHub followers.",
- instructions: "**Instructions for Setting Up the Trigger:**\\n\\n This trigger fires when there are changes in your GitHub followers.\\n It detects new followers and unfollowers.\\n ",
- config: {
- properties: {
- interval: {
- default: 1,
- description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
- title: "Interval",
- type: "number",
+ FOLLOWER_EVENT: {
+ slug: "GITHUB_FOLLOWER_EVENT",
+ name: "Follower Changes",
+ description: "Triggers when there are changes in GitHub followers.",
+ instructions: "**Instructions for Setting Up the Trigger:**\\n\\n This trigger fires when there are changes in your GitHub followers.\\n It detects new followers and unfollowers.\\n ",
+ config: {
+ properties: {
+ interval: {
+ default: 1,
+ description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
+ title: "Interval",
+ type: "number",
+ },
},
+ title: "GithubFollowerConfig",
+ type: "object",
},
- title: "GithubFollowerConfig",
- type: "object",
- },
- payload: {
- properties: {
- username: {
- description: "Username of the github follower",
- title: "Username",
- type: "string",
+ payload: {
+ properties: {
+ username: {
+ description: "Username of the github follower",
+ title: "Username",
+ type: "string",
+ },
},
+ required: ["username"],
+ title: "GithubFollowerPayload",
+ type: "object",
},
- required: ["username"],
- title: "GithubFollowerPayload",
- type: "object",
+ type: "poll",
},
- type: "poll",
- },
- ISSUE_ADDED_EVENT: {
- slug: "GITHUB_ISSUE_ADDED_EVENT",
- name: "Issue Added Event",
- description: "Triggered when a new issue is added to the repository.",
- instructions: "This trigger fires every time a new issue is added to the repository.",
- config: {
- properties: {
- owner: {
- description: "Owner of the repository",
- title: "Owner",
- type: "string",
- },
- repo: {
- description: "Repository name",
- title: "Repo",
- type: "string",
+ ISSUE_ADDED_EVENT: {
+ slug: "GITHUB_ISSUE_ADDED_EVENT",
+ name: "Issue Added Event",
+ description: "Triggered when a new issue is added to the repository.",
+ instructions: "This trigger fires every time a new issue is added to the repository.",
+ config: {
+ properties: {
+ owner: {
+ description: "Owner of the repository",
+ title: "Owner",
+ type: "string",
+ },
+ repo: {
+ description: "Repository name",
+ title: "Repo",
+ type: "string",
+ },
},
+ required: ["owner", "repo"],
+ title: "WebhookConfigSchema",
+ type: "object",
},
- required: ["owner", "repo"],
- title: "WebhookConfigSchema",
- type: "object",
- },
- payload: {
- properties: {
- action: {
- description: "The action that was performed on the issue",
- examples: ["opened"],
- title: "Action",
- type: "string",
- },
- createdAt: {
- description: "The timestamp when the issue was created",
- examples: ["2021-04-14T02:15:15Z"],
- title: "Createdat",
- type: "string",
- },
- createdBy: {
- description: "The GitHub username of the user who created the issue",
- examples: ["octocat"],
- title: "Createdby",
- type: "string",
- },
- description: {
- default: "",
- description: "A detailed description of the issue",
- examples: ["There is a bug in the code that needs to be fixed."],
- title: "Description",
- type: "string",
- },
- issue_id: {
- description: "The unique ID assigned to the issue",
- examples: [101],
- title: "Issue Id",
- type: "integer",
- },
- number: {
- description: "The unique number assigned to the issue",
- examples: [42],
- title: "Number",
- type: "integer",
- },
- title: {
- description: "The title of the issue",
- examples: ["Bug in code"],
- title: "Title",
- type: "string",
- },
- url: {
- description: "The GitHub URL of the issue",
- examples: ["https://github.com/octocat/Hello-World/issues/42"],
- title: "Url",
- type: "string",
+ payload: {
+ properties: {
+ action: {
+ description: "The action that was performed on the issue",
+ examples: ["opened"],
+ title: "Action",
+ type: "string",
+ },
+ createdAt: {
+ description: "The timestamp when the issue was created",
+ examples: ["2021-04-14T02:15:15Z"],
+ title: "Createdat",
+ type: "string",
+ },
+ createdBy: {
+ description: "The GitHub username of the user who created the issue",
+ examples: ["octocat"],
+ title: "Createdby",
+ type: "string",
+ },
+ description: {
+ default: "",
+ description: "A detailed description of the issue",
+ examples: ["There is a bug in the code that needs to be fixed."],
+ title: "Description",
+ type: "string",
+ },
+ issue_id: {
+ description: "The unique ID assigned to the issue",
+ examples: [101],
+ title: "Issue Id",
+ type: "integer",
+ },
+ number: {
+ description: "The unique number assigned to the issue",
+ examples: [42],
+ title: "Number",
+ type: "integer",
+ },
+ title: {
+ description: "The title of the issue",
+ examples: ["Bug in code"],
+ title: "Title",
+ type: "string",
+ },
+ url: {
+ description: "The GitHub URL of the issue",
+ examples: ["https://github.com/octocat/Hello-World/issues/42"],
+ title: "Url",
+ type: "string",
+ },
},
+ required: ["action", "issue_id", "number", "title", "createdBy", "createdAt", "url"],
+ title: "IssueAddedPayloadSchema",
+ type: "object",
},
- required: ["action", "issue_id", "number", "title", "createdBy", "createdAt", "url"],
- title: "IssueAddedPayloadSchema",
- type: "object",
+ type: "webhook",
},
- type: "webhook",
- },
- LABEL_ADDED_EVENT: {
- slug: "GITHUB_LABEL_ADDED_EVENT",
- name: "Label Added Event",
- description: "Triggered when a new label is added to a pull request.",
- instructions: "This trigger fires every time a new label is added to a pull request on the repository.",
- config: {
- properties: {
- owner: {
- description: "Owner of the repository",
- title: "Owner",
- type: "string",
- },
- repo: {
- description: "Repository name",
- title: "Repo",
- type: "string",
+ LABEL_ADDED_EVENT: {
+ slug: "GITHUB_LABEL_ADDED_EVENT",
+ name: "Label Added Event",
+ description: "Triggered when a new label is added to a pull request.",
+ instructions: "This trigger fires every time a new label is added to a pull request on the repository.",
+ config: {
+ properties: {
+ owner: {
+ description: "Owner of the repository",
+ title: "Owner",
+ type: "string",
+ },
+ repo: {
+ description: "Repository name",
+ title: "Repo",
+ type: "string",
+ },
},
+ required: ["owner", "repo"],
+ title: "WebhookConfigSchema",
+ type: "object",
},
- required: ["owner", "repo"],
- title: "WebhookConfigSchema",
- type: "object",
- },
- payload: {
- properties: {
- action: {
- description: "The action that was performed on the label",
- examples: ["labeled"],
- title: "Action",
- type: "string",
- },
- label: {
- description: "The name of the label that was added",
- examples: ["bug", "enhancement"],
- title: "Label",
- type: "string",
- },
- labeled_at: {
- description: "The timestamp when the label was added",
- examples: ["2021-04-14T02:15:15Z"],
- title: "Labeled At",
- type: "string",
- },
- labeled_by: {
- description: "The GitHub username of the user who added the label",
- examples: ["octocat"],
- title: "Labeled By",
- type: "string",
- },
- pull_request_number: {
- description: "The unique number assigned to the pull request",
- examples: [42],
- title: "Pull Request Number",
- type: "integer",
- },
- pull_request_title: {
- description: "The title of the pull request",
- examples: ["Fix typo in README"],
- title: "Pull Request Title",
- type: "string",
- },
- pull_request_url: {
- description: "The GitHub URL of the pull request",
- examples: ["https://github.com/octocat/Hello-World/pull/42"],
- title: "Pull Request Url",
- type: "string",
+ payload: {
+ properties: {
+ action: {
+ description: "The action that was performed on the label",
+ examples: ["labeled"],
+ title: "Action",
+ type: "string",
+ },
+ label: {
+ description: "The name of the label that was added",
+ examples: ["bug", "enhancement"],
+ title: "Label",
+ type: "string",
+ },
+ labeled_at: {
+ description: "The timestamp when the label was added",
+ examples: ["2021-04-14T02:15:15Z"],
+ title: "Labeled At",
+ type: "string",
+ },
+ labeled_by: {
+ description: "The GitHub username of the user who added the label",
+ examples: ["octocat"],
+ title: "Labeled By",
+ type: "string",
+ },
+ pull_request_number: {
+ description: "The unique number assigned to the pull request",
+ examples: [42],
+ title: "Pull Request Number",
+ type: "integer",
+ },
+ pull_request_title: {
+ description: "The title of the pull request",
+ examples: ["Fix typo in README"],
+ title: "Pull Request Title",
+ type: "string",
+ },
+ pull_request_url: {
+ description: "The GitHub URL of the pull request",
+ examples: ["https://github.com/octocat/Hello-World/pull/42"],
+ title: "Pull Request Url",
+ type: "string",
+ },
},
+ required: ["action", "label", "pull_request_number", "pull_request_title", "pull_request_url", "labeled_by", "labeled_at"],
+ title: "LabelAddedPayloadSchema",
+ type: "object",
},
- required: ["action", "label", "pull_request_number", "pull_request_title", "pull_request_url", "labeled_by", "labeled_at"],
- title: "LabelAddedPayloadSchema",
- type: "object",
+ type: "webhook",
},
- type: "webhook",
- },
- PULL_REQUEST_EVENT: {
- slug: "GITHUB_PULL_REQUEST_EVENT",
- name: "Pull Request Event",
- description: "Triggered when a pull request is opened, closed, or synchronized.",
- instructions: "This trigger fires every time a pull request is opened, closed, or synchronized on the repository.",
- config: {
- properties: {
- owner: {
- description: "Owner of the repository",
- title: "Owner",
- type: "string",
- },
- repo: {
- description: "Repository name",
- title: "Repo",
- type: "string",
+ PULL_REQUEST_EVENT: {
+ slug: "GITHUB_PULL_REQUEST_EVENT",
+ name: "Pull Request Event",
+ description: "Triggered when a pull request is opened, closed, or synchronized.",
+ instructions: "This trigger fires every time a pull request is opened, closed, or synchronized on the repository.",
+ config: {
+ properties: {
+ owner: {
+ description: "Owner of the repository",
+ title: "Owner",
+ type: "string",
+ },
+ repo: {
+ description: "Repository name",
+ title: "Repo",
+ type: "string",
+ },
},
+ required: ["owner", "repo"],
+ title: "WebhookConfigSchema",
+ type: "object",
},
- required: ["owner", "repo"],
- title: "WebhookConfigSchema",
- type: "object",
- },
- payload: {
- properties: {
- action: {
- description: "The action that was performed on the pull request",
- examples: ["opened", "closed", "synchronize"],
- title: "Action",
- type: "string",
- },
- createdAt: {
- description: "The timestamp when the pull request was created",
- examples: ["2021-04-14T02:15:15Z"],
- title: "Createdat",
- type: "string",
- },
- createdBy: {
- description: "The GitHub username of the user who created the pull request",
- examples: ["octocat"],
- title: "Createdby",
- type: "string",
- },
- description: {
- default: "",
- description: "A detailed description of the pull request",
- examples: ["This pull request fixes a typo found in the README file under the 'Installation' section."],
- title: "Description",
- type: "string",
- },
- number: {
- description: "The unique number assigned to the pull request",
- examples: [42],
- title: "Number",
- type: "integer",
- },
- title: {
- description: "The title of the pull request",
- examples: ["Fix typo in README"],
- title: "Title",
- type: "string",
- },
- url: {
- description: "The GitHub URL of the pull request",
- examples: ["https://github.com/octocat/Hello-World/pull/42"],
- title: "Url",
- type: "string",
+ payload: {
+ properties: {
+ action: {
+ description: "The action that was performed on the pull request",
+ examples: ["opened", "closed", "synchronize"],
+ title: "Action",
+ type: "string",
+ },
+ createdAt: {
+ description: "The timestamp when the pull request was created",
+ examples: ["2021-04-14T02:15:15Z"],
+ title: "Createdat",
+ type: "string",
+ },
+ createdBy: {
+ description: "The GitHub username of the user who created the pull request",
+ examples: ["octocat"],
+ title: "Createdby",
+ type: "string",
+ },
+ description: {
+ default: "",
+ description: "A detailed description of the pull request",
+ examples: ["This pull request fixes a typo found in the README file under the 'Installation' section."],
+ title: "Description",
+ type: "string",
+ },
+ number: {
+ description: "The unique number assigned to the pull request",
+ examples: [42],
+ title: "Number",
+ type: "integer",
+ },
+ title: {
+ description: "The title of the pull request",
+ examples: ["Fix typo in README"],
+ title: "Title",
+ type: "string",
+ },
+ url: {
+ description: "The GitHub URL of the pull request",
+ examples: ["https://github.com/octocat/Hello-World/pull/42"],
+ title: "Url",
+ type: "string",
+ },
},
+ required: ["action", "number", "title", "createdBy", "createdAt", "url"],
+ title: "PullRequestPayloadSchema",
+ type: "object",
},
- required: ["action", "number", "title", "createdBy", "createdAt", "url"],
- title: "PullRequestPayloadSchema",
- type: "object",
+ type: "webhook",
},
- type: "webhook",
- },
- STAR_ADDED_EVENT: {
- slug: "GITHUB_STAR_ADDED_EVENT",
- name: "Star Added Event",
- description: "Triggered when a new star is added to the repository.",
- instructions: "This trigger fires every time a new star is added to the repository.",
- config: {
- properties: {
- owner: {
- description: "Owner of the repository",
- title: "Owner",
- type: "string",
- },
- repo: {
- description: "Repository name",
- title: "Repo",
- type: "string",
+ STAR_ADDED_EVENT: {
+ slug: "GITHUB_STAR_ADDED_EVENT",
+ name: "Star Added Event",
+ description: "Triggered when a new star is added to the repository.",
+ instructions: "This trigger fires every time a new star is added to the repository.",
+ config: {
+ properties: {
+ owner: {
+ description: "Owner of the repository",
+ title: "Owner",
+ type: "string",
+ },
+ repo: {
+ description: "Repository name",
+ title: "Repo",
+ type: "string",
+ },
},
+ required: ["owner", "repo"],
+ title: "WebhookConfigSchema",
+ type: "object",
},
- required: ["owner", "repo"],
- title: "WebhookConfigSchema",
- type: "object",
- },
- payload: {
- properties: {
- action: {
- description: "The action that was performed on the star",
- examples: ["created"],
- title: "Action",
- type: "string",
- },
- repository_id: {
- description: "The unique ID assigned to the repository",
- examples: [101],
- title: "Repository Id",
- type: "integer",
- },
- repository_name: {
- description: "The name of the repository",
- examples: ["Hello-World"],
- title: "Repository Name",
- type: "string",
- },
- repository_url: {
- description: "The GitHub URL of the repository",
- examples: ["https://github.com/octocat/Hello-World"],
- title: "Repository Url",
- type: "string",
- },
- starred_at: {
- description: "The timestamp when the star was added",
- examples: ["2021-04-14T02:15:15Z"],
- title: "Starred At",
- type: "string",
- },
- starred_by: {
- description: "The GitHub username of the user who added the star",
- examples: ["octocat"],
- title: "Starred By",
- type: "string",
+ payload: {
+ properties: {
+ action: {
+ description: "The action that was performed on the star",
+ examples: ["created"],
+ title: "Action",
+ type: "string",
+ },
+ repository_id: {
+ description: "The unique ID assigned to the repository",
+ examples: [101],
+ title: "Repository Id",
+ type: "integer",
+ },
+ repository_name: {
+ description: "The name of the repository",
+ examples: ["Hello-World"],
+ title: "Repository Name",
+ type: "string",
+ },
+ repository_url: {
+ description: "The GitHub URL of the repository",
+ examples: ["https://github.com/octocat/Hello-World"],
+ title: "Repository Url",
+ type: "string",
+ },
+ starred_at: {
+ description: "The timestamp when the star was added",
+ examples: ["2021-04-14T02:15:15Z"],
+ title: "Starred At",
+ type: "string",
+ },
+ starred_by: {
+ description: "The GitHub username of the user who added the star",
+ examples: ["octocat"],
+ title: "Starred By",
+ type: "string",
+ },
},
+ required: ["action", "starred_at", "repository_id", "repository_name", "repository_url", "starred_by"],
+ title: "StarAddedPayloadSchema",
+ type: "object",
},
- required: ["action", "starred_at", "repository_id", "repository_name", "repository_url", "starred_by"],
- title: "StarAddedPayloadSchema",
- type: "object",
+ type: "webhook",
},
- type: "webhook",
},
- },
- }
+ }
- /**
- * Type map of all available trigger payloads for toolkit "GITHUB".
- */
- export type GITHUB_TRIGGER_PAYLOADS = {
- COMMIT_EVENT: GITHUB_COMMIT_EVENT_PAYLOAD
- FOLLOWER_EVENT: GITHUB_FOLLOWER_EVENT_PAYLOAD
- ISSUE_ADDED_EVENT: GITHUB_ISSUE_ADDED_EVENT_PAYLOAD
- LABEL_ADDED_EVENT: GITHUB_LABEL_ADDED_EVENT_PAYLOAD
- PULL_REQUEST_EVENT: GITHUB_PULL_REQUEST_EVENT_PAYLOAD
- STAR_ADDED_EVENT: GITHUB_STAR_ADDED_EVENT_PAYLOAD
- }
+ /**
+ * Type map of all available trigger payloads for toolkit "GITHUB".
+ */
+ export type GITHUB_TRIGGER_PAYLOADS = {
+ COMMIT_EVENT: GITHUB_COMMIT_EVENT_PAYLOAD
+ FOLLOWER_EVENT: GITHUB_FOLLOWER_EVENT_PAYLOAD
+ ISSUE_ADDED_EVENT: GITHUB_ISSUE_ADDED_EVENT_PAYLOAD
+ LABEL_ADDED_EVENT: GITHUB_LABEL_ADDED_EVENT_PAYLOAD
+ PULL_REQUEST_EVENT: GITHUB_PULL_REQUEST_EVENT_PAYLOAD
+ STAR_ADDED_EVENT: GITHUB_STAR_ADDED_EVENT_PAYLOAD
+ }
- /**
- * Type map of all available trigger events for toolkit "GITHUB".
- */
- export type GITHUB_TRIGGER_EVENTS = {
- COMMIT_EVENT: TriggerEvent<GITHUB_COMMIT_EVENT_PAYLOAD>
- FOLLOWER_EVENT: TriggerEvent<GITHUB_FOLLOWER_EVENT_PAYLOAD>
- ISSUE_ADDED_EVENT: TriggerEvent<GITHUB_ISSUE_ADDED_EVENT_PAYLOAD>
- LABEL_ADDED_EVENT: TriggerEvent<GITHUB_LABEL_ADDED_EVENT_PAYLOAD>
- PULL_REQUEST_EVENT: TriggerEvent<GITHUB_PULL_REQUEST_EVENT_PAYLOAD>
- STAR_ADDED_EVENT: TriggerEvent<GITHUB_STAR_ADDED_EVENT_PAYLOAD>
- }
- "
- `);
+ /**
+ * Type map of all available trigger events for toolkit "GITHUB".
+ */
+ export type GITHUB_TRIGGER_EVENTS = {
+ COMMIT_EVENT: TriggerEvent<GITHUB_COMMIT_EVENT_PAYLOAD>
+ FOLLOWER_EVENT: TriggerEvent<GITHUB_FOLLOWER_EVENT_PAYLOAD>
+ ISSUE_ADDED_EVENT: TriggerEvent<GITHUB_ISSUE_ADDED_EVENT_PAYLOAD>
+ LABEL_ADDED_EVENT: TriggerEvent<GITHUB_LABEL_ADDED_EVENT_PAYLOAD>
+ PULL_REQUEST_EVENT: TriggerEvent<GITHUB_PULL_REQUEST_EVENT_PAYLOAD>
+ STAR_ADDED_EVENT: TriggerEvent<GITHUB_STAR_ADDED_EVENT_PAYLOAD>
+ }
+ "
+ `);
expect(sources[2]).toHaveLength(2);
expect(sources[2][0]).toBe('slack.ts');
expect(sources[2][1]).toMatchInlineSnapshot(`
- "/**
- * Map of Composio's SLACK toolkit.
- */
- export const SLACK = {
- slug: "slack",
- tools: {},
- triggerTypes: {},
- }
+ "// ------------------- //
+ // Trigger types //
+ // ------------------- //
- /**
- * Type map of all available trigger payloads for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_PAYLOADS = {}
- /**
- * Type map of all available trigger events for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_EVENTS = {}
- "
- `);
+
+ /**
+ * Map of Composio's SLACK toolkit.
+ */
+ export const SLACK = {
+ slug: "slack",
+ tools: {},
+ triggerTypes: {},
+ }
+
+ /**
+ * Type map of all available trigger payloads for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_PAYLOADS = {}
+
+ /**
+ * Type map of all available trigger events for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_EVENTS = {}
+ "
+ `);
expect(sources[3]).toHaveLength(2);
expect(sources[3][0]).toBe('googledrive.ts');
expect(sources[3][1]).toMatchInlineSnapshot(`
"import { type TriggerEvent } from "@composio/core"
+ // ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
+ * Type of GOOGLEDRIVE's GOOGLE_DRIVE_CHANGES trigger payload.
+ */
type GOOGLEDRIVE_GOOGLE_DRIVE_CHANGES_PAYLOAD = object;
/**
diff --git a/ts/packages/cli/test/src/generation/typescript/generate.test.ts b/ts/packages/cli/test/src/generation/typescript/generate.test.ts
index de5321bdb..57140bdbd 100644
--- a/ts/packages/cli/test/src/generation/typescript/generate.test.ts
+++ b/ts/packages/cli/test/src/generation/typescript/generate.test.ts
@@ -29,7 +29,7 @@ describe('generateTypeScriptSources', () => {
Effect.fn(function* () {
const index = createToolkitIndex({
toolkits: [],
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -82,7 +82,7 @@ describe('generateTypeScriptSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [],
+ typeableTools: { withTypes: false, tools: [] },
triggerTypes: [],
});
@@ -91,26 +91,32 @@ describe('generateTypeScriptSources', () => {
expect(sources[0]).toHaveLength(2);
expect(sources[0][0]).toBe(path.join(params.outputDir, 'slack.ts'));
expect(sources[0][1]).toMatchInlineSnapshot(`
- "/**
- * Map of Composio's SLACK toolkit.
- */
- export const SLACK = {
- slug: "slack",
- tools: {},
- triggerTypes: {},
- }
-
- /**
- * Type map of all available trigger payloads for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_PAYLOADS = {}
-
- /**
- * Type map of all available trigger events for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_EVENTS = {}
- "
- `);
+ "// ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
+ * Map of Composio's SLACK toolkit.
+ */
+ export const SLACK = {
+ slug: "slack",
+ tools: {},
+ triggerTypes: {},
+ }
+
+ /**
+ * Type map of all available trigger payloads for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_PAYLOADS = {}
+
+ /**
+ * Type map of all available trigger events for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_EVENTS = {}
+ "
+ `);
assertTypeScriptIsValid({ files: { './slack.ts': sources[0][1] } });
expect(sources[1]).toHaveLength(2);
@@ -165,7 +171,10 @@ describe('generateTypeScriptSources', () => {
const index = createToolkitIndex({
toolkits,
- tools: [...TOOLS_GMAIL.slice(0, 3), ...TOOLS_GITHUB.slice(0, 3)],
+ typeableTools: {
+ withTypes: false,
+ tools: [...TOOLS_GMAIL.slice(0, 3), ...TOOLS_GITHUB.slice(0, 3)],
+ },
triggerTypes: [...TRIGGER_TYPES_GMAIL, ...TRIGGER_TYPES_GITHUB],
});
@@ -174,26 +183,32 @@ describe('generateTypeScriptSources', () => {
expect(sources[0]).toHaveLength(2);
expect(sources[0][0]).toBe(path.join(params.outputDir, './slack.ts'));
expect(sources[0][1]).toMatchInlineSnapshot(`
- "/**
- * Map of Composio's SLACK toolkit.
- */
- export const SLACK = {
- slug: "slack",
- tools: {},
- triggerTypes: {},
- }
-
- /**
- * Type map of all available trigger payloads for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_PAYLOADS = {}
-
- /**
- * Type map of all available trigger events for toolkit "SLACK".
- */
- export type SLACK_TRIGGER_EVENTS = {}
- "
- `);
+ "// ------------------- //
+ // Trigger types //
+ // ------------------- //
+
+
+
+ /**
+ * Map of Composio's SLACK toolkit.
+ */
+ export const SLACK = {
+ slug: "slack",
+ tools: {},
+ triggerTypes: {},
+ }
+
+ /**
+ * Type map of all available trigger payloads for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_PAYLOADS = {}
+
+ /**
+ * Type map of all available trigger events for toolkit "SLACK".
+ */
+ export type SLACK_TRIGGER_EVENTS = {}
+ "
+ `);
assertTypeScriptIsValid({ files: { './slack.ts': sources[0][1] } });
expect(sources[1]).toHaveLength(2);
diff --git a/ts/packages/ts-builders/src/DocSectionComment.ts b/ts/packages/ts-builders/src/DocSectionComment.ts
new file mode 100644
index 000000000..43cc7b768
--- /dev/null
+++ b/ts/packages/ts-builders/src/DocSectionComment.ts
@@ -0,0 +1,18 @@
+import type { BasicBuilder } from './BasicBuilder';
+import { Writer } from './Writer';
+
+export class DocSectionComment implements BasicBuilder {
+ constructor(private startingText: string) {}
+
+ write(writer: Writer): void {
+ const lines = this.startingText.split('\n');
+
+ for (const line of lines) {
+ writer.writeLine(line.trimStart());
+ }
+ }
+}
+
+export function docSectionComment(startingText: string) {
+ return new DocSectionComment(startingText);
+}
diff --git a/ts/packages/ts-builders/src/File.ts b/ts/packages/ts-builders/src/File.ts
index 6c5659229..784d83c40 100644
--- a/ts/packages/ts-builders/src/File.ts
+++ b/ts/packages/ts-builders/src/File.ts
@@ -1,12 +1,13 @@
import type { AnyDeclarationBuilder } from './AnyDeclarationBuilder';
import type { BasicBuilder } from './BasicBuilder';
+import type { DocSectionComment } from './DocSectionComment';
import { Export } from './Export';
import type { ExportFrom } from './ExportFrom';
import type { Import } from './Import';
import { Writer } from './Writer';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export type FileItem = AnyDeclarationBuilder | Export<any> | ExportFrom;
+export type FileItem = AnyDeclarationBuilder | Export<any> | ExportFrom | DocSectionComment;
export class File implements BasicBuilder {
private imports: Import[] = [];
private declarations: FileItem[] = [];
diff --git a/ts/packages/ts-builders/src/index.ts b/ts/packages/ts-builders/src/index.ts
index 92e4c4143..b6c4a2073 100644
--- a/ts/packages/ts-builders/src/index.ts
+++ b/ts/packages/ts-builders/src/index.ts
@@ -6,6 +6,7 @@ export * from './BasicBuilder';
export * from './Class';
export * from './ConstDeclaration';
export * from './DocComment';
+export * from './DocSectionComment';
export * from './Export';
export * from './ExportFrom';
export * from './File';