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): use triggerTypes for createToolkitIndex in place of triggerTypesAsEnums, preserving the old enums-like output for now
jkomyno committed
Jul 28, 2025 at 23:07 UTC
ee7b9787af791791f6fbbbd3a9690854f8821fa6
10 files changed
+220
-201
ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+6
-2
@@ -48,12 +48,16 @@ export function generatePythonTypeStubs({ outputOpt }: GetCmdParams<typeof _pyCm
48
// Fetch data from Composio API
49
yield* Console.log('Fetching latest data from Composio API...');
50
51
+ const triggerTypesAsEnums = yield* Effect.logDebug('Fetching trigger types...').pipe(
52
+ Effect.flatMap(() => client.getTriggerTypesAsEnums())
53
+ );
54
+
55
const [toolkits, tools, triggerTypes] = yield* Effect.all(
56
[
57
Effect.logDebug('Fetching toolkits...').pipe(Effect.flatMap(() => client.getToolkits())),
58
Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getTools())),
55
- Effect.logDebug('Fetching trigger types...').pipe(
56
- Effect.flatMap(() => client.getTriggerTypes())
59
+ Effect.logDebug('Fetching trigger types payloads...').pipe(
60
+ Effect.flatMap(() => client.getTriggerTypes(triggerTypesAsEnums.length))
61
),
62
],
63
{ concurrency: 'unbounded' }
ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
+2
-2
@@ -120,7 +120,7 @@ export function generateTypescriptTypeStubs({
120
Effect.flatMap(() => client.getTriggerTypesAsEnums())
121
);
122
123
- const [toolkits, tools, _triggerTypes] = yield* Effect.all(
123
+ const [toolkits, tools, triggerTypes] = yield* Effect.all(
124
[
125
Effect.logDebug('Fetching toolkits...').pipe(Effect.flatMap(() => client.getToolkits())),
126
Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getTools())),
@@ -131,7 +131,7 @@ export function generateTypescriptTypeStubs({
131
{ concurrency: 'unbounded' }
132
);
133
134
- const index = createToolkitIndex({ toolkits, tools, triggerTypes: triggerTypesAsEnums });
134
+ const index = createToolkitIndex({ toolkits, tools, triggerTypes });
135
136
// Generate TypeScript sources
137
const sources = generateTypeScriptSources({
ts/packages/cli/src/generation/create-toolkit-index.ts
+14
-6
@@ -2,7 +2,7 @@ import { pipe, String, Record } from 'effect';
2
import type { Simplify } from 'effect/Types';
3
import { Toolkit, Toolkits, ToolkitName } from 'src/models/toolkits';
4
import { Tools } from 'src/models/tools';
5
-import { TriggerTypesAsEnums } from 'src/models/trigger-types';
5
+import { TriggerType, TriggerTypes } from 'src/models/trigger-types';
6
7
const startsWith =
8
<const P extends string>(prefix: P) =>
@@ -10,9 +10,9 @@ const startsWith =
10
str.startsWith(prefix);
11
12
interface CreateToolkitIndexInput {
13
- toolkits: Toolkits; // e.g., [ { slug: 'gmail', }]
13
+ toolkits: Toolkits; // e.g., [ { slug: 'gmail', ... }]
14
tools: Tools; // e.g., [ 'GMAIL_SEND_EMAIL' ]
15
- triggerTypes: TriggerTypesAsEnums; // e.g., [ 'GMAIL_NEW_EMAIL' ]
15
+ triggerTypes: TriggerTypes; // e.g., [ { slug: 'GMAIL_NEW_EMAIL', ... } ]
16
}
17
18
export type ToolkitIndexData = Simplify<{
@@ -39,7 +39,7 @@ export function createToolkitIndex(input: CreateToolkitIndexInput): Simplify<Too
39
const { slug } = value.toolkit;
40
const tools = value.tools.map(tool => [stripPrefix(tool), tool] as const);
41
const triggerTypes = value.triggerTypes.map(
42
- triggerType => [stripPrefix(triggerType), triggerType] as const
42
+ triggerType => [stripPrefix(triggerType.slug), triggerType.slug] as const
43
);
44
45
return [
@@ -50,12 +50,17 @@ export function createToolkitIndex(input: CreateToolkitIndexInput): Simplify<Too
50
);
51
}
52
53
+type TriggerTypeWithUppercaseSlug<T extends ToolkitName> = Omit<TriggerType, 'slug'> & {
54
+ slug: `${Uppercase<T>}_${string}`;
55
+};
56
+
57
type GroupByToolkitOutput<T extends ToolkitName> = [
58
Uppercase<T>,
59
{
60
toolkit: Toolkit;
61
tools: Array<`${Uppercase<T>}_${string}`>;
58
- triggerTypes: Array<`${Uppercase<T>}_${string}`>;
62
+ // triggerTypes: Array<TriggerTypeWithUppercaseSlug<T>>;
63
+ triggerTypes: TriggerTypes;
64
},
65
];
66
@@ -74,7 +79,10 @@ const groupByToolkit =
79
{
80
toolkit,
81
tools: tools.filter(startsWith(`${toolkitName}_`)),
77
- triggerTypes: triggerTypes.filter(startsWith(`${toolkitName}_`)),
82
+ triggerTypes: triggerTypes.filter(triggerType => {
83
+ console.log('Checking trigger type slug', triggerType?.slug);
84
+ return startsWith(`${toolkitName}_`)(triggerType.slug);
85
+ }), // as Array<TriggerTypeWithUppercaseSlug<T & ToolkitName>>,
86
},
87
];
88
};
ts/packages/cli/test/__mocks__/trigger-type-gmail.ts
new
+174
@@ -0,0 +1,174 @@
1
+import type { TriggerType } from 'src/models/trigger-types';
2
+
3
+export const TRIGGER_TYPE_GMAIL = {
4
+ config: {
5
+ properties: {
6
+ interval: {
7
+ default: 1,
8
+ description: 'Periodic Interval to Check for Updates & Send a Trigger in Minutes',
9
+ title: 'Interval',
10
+ type: 'number',
11
+ },
12
+ labelIds: {
13
+ default: 'INBOX',
14
+ description:
15
+ "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.",
16
+ examples: ['INBOX', 'UNREAD', 'STARRED'],
17
+ title: 'Labelids',
18
+ type: 'string',
19
+ },
20
+ query: {
21
+ default: '',
22
+ description:
23
+ "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@domain.com), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
24
+ examples: [
25
+ 'label:inbox OR label:sent',
26
+ 'from:example@gmail.com is:unread',
27
+ 'has:attachment after:2023/1/1',
28
+ 'is:important is:unread',
29
+ ],
30
+ title: 'Query',
31
+ type: 'string',
32
+ },
33
+ userId: {
34
+ default: 'me',
35
+ description: "The user's email address or 'me' for the authenticated user.",
36
+ examples: ['me'],
37
+ title: 'Userid',
38
+ type: 'string',
39
+ },
40
+ },
41
+ title: 'NewMessageConfig',
42
+ type: 'object',
43
+ },
44
+ description: 'Triggers when a new message is received in Gmail.',
45
+ instructions:
46
+ "\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 ",
47
+ name: 'New Gmail Message Received Trigger',
48
+ payload: {
49
+ properties: {
50
+ attachment_list: {
51
+ anyOf: [
52
+ {
53
+ items: {},
54
+ type: 'array',
55
+ },
56
+ {
57
+ type: 'null',
58
+ },
59
+ ],
60
+ default: null,
61
+ description: 'The list of attachments in the message',
62
+ title: 'Attachment List',
63
+ },
64
+ message_id: {
65
+ anyOf: [
66
+ {
67
+ type: 'string',
68
+ },
69
+ {
70
+ type: 'null',
71
+ },
72
+ ],
73
+ default: null,
74
+ description: 'The message ID of the message',
75
+ title: 'Message ID',
76
+ },
77
+ message_text: {
78
+ anyOf: [
79
+ {
80
+ type: 'string',
81
+ },
82
+ {
83
+ type: 'null',
84
+ },
85
+ ],
86
+ default: null,
87
+ description: 'The text of the message',
88
+ title: 'Message Text',
89
+ },
90
+ message_timestamp: {
91
+ anyOf: [
92
+ {
93
+ type: 'string',
94
+ },
95
+ {
96
+ type: 'null',
97
+ },
98
+ ],
99
+ default: null,
100
+ description: 'The timestamp of the message',
101
+ title: 'Message Timestamp',
102
+ },
103
+ payload: {
104
+ anyOf: [
105
+ {
106
+ type: 'object',
107
+ },
108
+ {
109
+ type: 'null',
110
+ },
111
+ ],
112
+ default: null,
113
+ description: 'The payload of the message',
114
+ title: 'Payload',
115
+ },
116
+ sender: {
117
+ anyOf: [
118
+ {
119
+ type: 'string',
120
+ },
121
+ {
122
+ type: 'null',
123
+ },
124
+ ],
125
+ default: null,
126
+ description: 'The sender of the message',
127
+ title: 'Sender',
128
+ },
129
+ subject: {
130
+ anyOf: [
131
+ {
132
+ type: 'string',
133
+ },
134
+ {
135
+ type: 'null',
136
+ },
137
+ ],
138
+ default: null,
139
+ description: 'The subject of the message',
140
+ title: 'Subject',
141
+ },
142
+ thread_id: {
143
+ anyOf: [
144
+ {
145
+ type: 'string',
146
+ },
147
+ {
148
+ type: 'null',
149
+ },
150
+ ],
151
+ default: null,
152
+ description: 'The thread ID of the message',
153
+ title: 'Thread ID',
154
+ },
155
+ to: {
156
+ anyOf: [
157
+ {
158
+ type: 'string',
159
+ },
160
+ {
161
+ type: 'null',
162
+ },
163
+ ],
164
+ default: null,
165
+ description: 'The recipient of the message',
166
+ title: 'To',
167
+ },
168
+ },
169
+ title: 'NewMessagePayload',
170
+ type: 'object',
171
+ },
172
+ slug: 'GMAIL_NEW_GMAIL_MESSAGE',
173
+ type: 'poll',
174
+} satisfies TriggerType;
ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
+13
-185
@@ -3,7 +3,7 @@ import { describe, expect, layer } from '@effect/vitest';
3
import { Effect } from 'effect';
4
import { FileSystem } from '@effect/platform';
5
import { cli, TestLive } from 'test/__utils__';
6
-import { makeTestToolkit } from 'test/__utils__/models/toolkits';
6
+import { makeTestToolkits } from 'test/__utils__/models/toolkits';
7
import { NodeProcess } from 'src/services/node-process';
8
import {
9
assertTranspiledTypeScriptIsValid,
@@ -11,195 +11,23 @@ import {
11
} from 'test/__utils__/typescript-compiler';
12
import { ComposioCorePkgNotFound } from 'src/effects/find-composio-core-generated';
13
import type { TestLiveInput } from 'test/__utils__/services/test-layer';
14
+import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';
15
16
describe('CLI: composio ts generate', () => {
16
- const TOOLKIT_GMAIL = makeTestToolkit({
17
- name: 'Gmail',
18
- slug: 'gmail',
19
- });
20
- const TOOLKIT_SLACK = makeTestToolkit({
21
- name: 'Slack',
22
- slug: 'slack',
23
- });
24
-
17
const appClientData = {
26
- toolkits: [TOOLKIT_GMAIL, TOOLKIT_SLACK],
27
- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
28
- triggerTypesAsEnums: ['GMAIL_NEW_GMAIL_MESSAGE'],
29
- triggerTypes: [
18
+ toolkits: makeTestToolkits([
19
{
31
- config: {
32
- properties: {
33
- interval: {
34
- default: 1,
35
- description: 'Periodic Interval to Check for Updates & Send a Trigger in Minutes',
36
- title: 'Interval',
37
- type: 'number',
38
- },
39
- labelIds: {
40
- default: 'INBOX',
41
- description:
42
- "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.",
43
- examples: ['INBOX', 'UNREAD', 'STARRED'],
44
- title: 'Labelids',
45
- type: 'string',
46
- },
47
- query: {
48
- default: '',
49
- description:
50
- "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@domain.com), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
51
- examples: [
52
- 'label:inbox OR label:sent',
53
- 'from:example@gmail.com is:unread',
54
- 'has:attachment after:2023/1/1',
55
- 'is:important is:unread',
56
- ],
57
- title: 'Query',
58
- type: 'string',
59
- },
60
- userId: {
61
- default: 'me',
62
- description: "The user's email address or 'me' for the authenticated user.",
63
- examples: ['me'],
64
- title: 'Userid',
65
- type: 'string',
66
- },
67
- },
68
- title: 'NewMessageConfig',
69
- type: 'object',
70
- },
71
- description: 'Triggers when a new message is received in Gmail.',
72
- instructions:
73
- "\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 ",
74
- name: 'New Gmail Message Received Trigger',
75
- payload: {
76
- properties: {
77
- attachment_list: {
78
- anyOf: [
79
- {
80
- items: {},
81
- type: 'array',
82
- },
83
- {
84
- type: 'null',
85
- },
86
- ],
87
- default: null,
88
- description: 'The list of attachments in the message',
89
- title: 'Attachment List',
90
- },
91
- message_id: {
92
- anyOf: [
93
- {
94
- type: 'string',
95
- },
96
- {
97
- type: 'null',
98
- },
99
- ],
100
- default: null,
101
- description: 'The message ID of the message',
102
- title: 'Message ID',
103
- },
104
- message_text: {
105
- anyOf: [
106
- {
107
- type: 'string',
108
- },
109
- {
110
- type: 'null',
111
- },
112
- ],
113
- default: null,
114
- description: 'The text of the message',
115
- title: 'Message Text',
116
- },
117
- message_timestamp: {
118
- anyOf: [
119
- {
120
- type: 'string',
121
- },
122
- {
123
- type: 'null',
124
- },
125
- ],
126
- default: null,
127
- description: 'The timestamp of the message',
128
- title: 'Message Timestamp',
129
- },
130
- payload: {
131
- anyOf: [
132
- {
133
- type: 'object',
134
- },
135
- {
136
- type: 'null',
137
- },
138
- ],
139
- default: null,
140
- description: 'The payload of the message',
141
- title: 'Payload',
142
- },
143
- sender: {
144
- anyOf: [
145
- {
146
- type: 'string',
147
- },
148
- {
149
- type: 'null',
150
- },
151
- ],
152
- default: null,
153
- description: 'The sender of the message',
154
- title: 'Sender',
155
- },
156
- subject: {
157
- anyOf: [
158
- {
159
- type: 'string',
160
- },
161
- {
162
- type: 'null',
163
- },
164
- ],
165
- default: null,
166
- description: 'The subject of the message',
167
- title: 'Subject',
168
- },
169
- thread_id: {
170
- anyOf: [
171
- {
172
- type: 'string',
173
- },
174
- {
175
- type: 'null',
176
- },
177
- ],
178
- default: null,
179
- description: 'The thread ID of the message',
180
- title: 'Thread ID',
181
- },
182
- to: {
183
- anyOf: [
184
- {
185
- type: 'string',
186
- },
187
- {
188
- type: 'null',
189
- },
190
- ],
191
- default: null,
192
- description: 'The recipient of the message',
193
- title: 'To',
194
- },
195
- },
196
- title: 'NewMessagePayload',
197
- type: 'object',
198
- },
199
- slug: 'GMAIL_NEW_GMAIL_MESSAGE',
200
- type: 'poll',
20
+ name: 'Gmail',
21
+ slug: 'gmail',
22
+ },
23
+ {
24
+ name: 'Slack',
25
+ slug: 'slack',
26
},
202
- ],
27
+ ]),
28
+ tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
29
+ triggerTypesAsEnums: ['GMAIL_NEW_GMAIL_MESSAGE'],
30
+ triggerTypes: [TRIGGER_TYPE_GMAIL],
31
} satisfies TestLiveInput['toolkitsData'];
32
33
describe('[Given] valid fetched app data', () => {
ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
+2
-1
@@ -3,6 +3,7 @@ import { generatePythonToolkitSources } from 'src/generation/python/generate-too
3
import { createToolkitIndex } from 'src/generation/create-toolkit-index';
4
import { BANNER } from 'src/generation/constants';
5
import { makeTestToolkits } from 'test/__utils__/models/toolkits';
6
+import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';
7
8
describe('generatePythonToolkitSources', () => {
9
it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty array', () => {
@@ -67,7 +68,7 @@ describe('generatePythonToolkitSources', () => {
68
const index = createToolkitIndex({
69
toolkits,
70
tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
70
- triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
71
+ triggerTypes: [TRIGGER_TYPE_GMAIL],
72
});
73
74
const sources = generatePythonToolkitSources(BANNER)(index);
ts/packages/cli/test/src/generation/toolkit-index.test.ts
+2
-1
@@ -1,6 +1,7 @@
1
import { describe, expect, it } from 'vitest';
2
import { createToolkitIndex } from 'src/generation/create-toolkit-index';
3
import { makeTestToolkits } from 'test/__utils__/models/toolkits';
4
+import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';
5
6
describe('createToolkitIndex', () => {
7
it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty index', () => {
@@ -58,7 +59,7 @@ describe('createToolkitIndex', () => {
59
]);
60
61
const tools = ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'];
61
- const triggerTypes = ['GMAIL_NEW_GMAIL_MESSAGE'];
62
+ const triggerTypes = [TRIGGER_TYPE_GMAIL];
63
64
const index = createToolkitIndex({
65
toolkits,
ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts
+3
-2
@@ -6,6 +6,7 @@ import {
6
import { createToolkitIndex } from 'src/generation/create-toolkit-index';
7
import { makeTestToolkits } from 'test/__utils__/models/toolkits';
8
import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';
9
+import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';
10
11
describe('generateTypeScriptToolkitSources', () => {
12
describe('with a single emitted file', () => {
@@ -116,7 +117,7 @@ describe('generateTypeScriptToolkitSources', () => {
117
const index = createToolkitIndex({
118
toolkits,
119
tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
119
- triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
120
+ triggerTypes: [TRIGGER_TYPE_GMAIL],
121
});
122
123
const source = generateIndexSource(params)(index);
@@ -271,7 +272,7 @@ describe('generateTypeScriptToolkitSources', () => {
272
const index = createToolkitIndex({
273
toolkits,
274
tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
274
- triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
275
+ triggerTypes: [TRIGGER_TYPE_GMAIL],
276
});
277
278
const source = generateIndexSource(params)(index);
ts/packages/cli/test/src/generation/typescript/generate-toolkit-source.test.ts
+2
-1
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
2
import { generateTypeScriptToolkitSources } from 'src/generation/typescript/generate-toolkit-sources';
3
import { createToolkitIndex } from 'src/generation/create-toolkit-index';
4
import { makeTestToolkits } from 'test/__utils__/models/toolkits';
5
+import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';
6
7
describe('generateTypeScriptToolkitSources', () => {
8
describe('with a single emitted file', () => {
@@ -66,7 +67,7 @@ describe('generateTypeScriptToolkitSources', () => {
67
const index = createToolkitIndex({
68
toolkits,
69
tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
69
- triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
70
+ triggerTypes: [TRIGGER_TYPE_GMAIL],
71
});
72
73
const sources = generateTypeScriptToolkitSources(banner)(index);
ts/packages/cli/test/src/generation/typescript/generate.test.ts
+2
-1
@@ -4,6 +4,7 @@ import { generateTypeScriptSources } from 'src/generation/typescript/generate';
4
import { makeTestToolkits } from 'test/__utils__/models/toolkits';
5
import path from 'path';
6
import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';
7
+import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';
8
9
describe('generateTypeScriptSources', () => {
10
describe('with multiple emitted files', () => {
@@ -143,7 +144,7 @@ describe('generateTypeScriptSources', () => {
144
const index = createToolkitIndex({
145
toolkits,
146
tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],
146
- triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
147
+ triggerTypes: [TRIGGER_TYPE_GMAIL],
148
});
149
150
const sources = generateTypeScriptSources(params)(index);