Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat(cli): generate TS types for trigger payloads and events (#1830)
Alberto Schiabel9c2761da992d
diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8f7c7661d..b0e50a919 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -565,6 +565,9 @@ importers:open:specifier: ^10.2.0version: 10.2.0+ openapi-typescript:+ specifier: ^7.8.0+ version: 7.8.0([email protected])picocolors:specifier: ^1.1.1version: 1.1.1@@ -577,6 +580,9 @@ importers:superjson:specifier: ^2.2.2version: 2.2.2+ ts-morph:+ specifier: ^26.0.0+ version: 26.0.0devDependencies:'@effect/eslint-plugin':specifier: ^0.3.2@@ -1062,6 +1068,10 @@ packages:resolution: {integrity: sha512-DIIotRnefVL6DiaHtO6/21DhJ4JZnnIwdNbpwiAhdt/AVbttcE4yw925gsjur0OGv5BTYXQXU3YnANBYnZjuQA==}engines: {node: '>=18.0.0'}+ '@babel/[email protected]':+ resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==}+ engines: {node: '>=6.9.0'}+'@babel/[email protected]':resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==}engines: {node: '>=6.9.0'}@@ -2038,6 +2048,14 @@ packages:resolution: {integrity: sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==}engines: {node: '>=18'}+ '@isaacs/[email protected]':+ resolution: {integrity: sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==}+ engines: {node: 20 || >=22}++ '@isaacs/[email protected]':+ resolution: {integrity: sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==}+ engines: {node: 20 || >=22}+'@isaacs/[email protected]':resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}engines: {node: '>=12'}@@ -2869,6 +2887,16 @@ packages:'@protobufjs/[email protected]':resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==}+ '@redocly/[email protected]':+ resolution: {integrity: sha512-4P3iZse91TkBiY+Dx5DUgxQ9GXkVJf++cmI0MOyLDxV9b5MUBI4II6ES8zA5JCbO72nKAJxWrw4PUPW+YP3ZDQ==}++ '@redocly/[email protected]':+ resolution: {integrity: sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==}++ '@redocly/[email protected]':+ resolution: {integrity: sha512-0EbE8LRbkogtcCXU7liAyC00n9uNG9hJ+eMyHFdUsy9lB/WGqnEBgwjA9q2cyzAVcdTkQqTBBU1XePNnN3OijA==}+ engines: {node: '>=18.17.0', npm: '>=9.5.0'}+'@rollup/[email protected]':resolution: {integrity: sha512-Krjy9awJl6rKbruhQDgivNbD1WuLb8xAclM4IR4cN5pHGAs2oIMMQJEiC3IC/9TZJ+QZkmZhlMO/6MBGxPidpw==}cpu: [arm]@@ -3219,6 +3247,9 @@ packages:'@swc/[email protected]':resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}+ '@ts-morph/[email protected]':+ resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==}+'@types/[email protected]':resolution: {integrity: sha512-nD0Z9fNIZcxYX5Mai2CTmFD7wX7UldCkW2ezCF8D1T5hdiLsnTWDGRpfRYntU6VjTdLQjOvyszru7I1c1oCQew==}@@ -3705,6 +3736,9 @@ packages:resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}+ resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==}+resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}@@ -3754,6 +3788,9 @@ packages:resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==}engines: {node: '>=0.8'}+ resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==}+resolution: {integrity: sha512-GI/uWVYYGIN3gdjJRlbjEaLJNJVXsUJyOlPqwBWgAmK18kP4CJoErxKwU0aLe3tHHOBcC2RqXe6PmGO0dz7dpQ==}@@ -3771,6 +3808,9 @@ packages:resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==}engines: {node: '>=12.5.0'}+ resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==}+resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==}@@ -4636,6 +4676,10 @@ packages:resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==}engines: {node: '>=12'}+ resolution: {integrity: sha512-XPdx9Dq4t9Qk1mTMbWONJqU7boCoumEH7fRET37HX5+khDUl3J2W6PdALxhILYlIYx2amlwYcRPp28p0tSiojg==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}@@ -4774,6 +4818,10 @@ packages:resolution: {integrity: sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ==}+ resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==}+ engines: {node: '>=0.10.0'}+resolution: {integrity: sha512-Xlaqhhs8VfCd6Sh7a1cFkZHQbYTLCwVJJWiHVxBYzLPxW0XsoxBy1hitmjkdIjD3Aon5BXLHFwU5O8WUx6HH+A==}@@ -4804,6 +4852,9 @@ packages:resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}+ resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}+resolution: {integrity: sha512-nXN2cMky0Iw7Af28w061hmxaPDaML5/bQD9nwm1lOoIKEGjHcRGxqWe4MfrkYThYAPjSUhmsp4bJNoLAyVn9Xw==}engines: {node: '>=10'}@@ -5071,9 +5122,17 @@ packages:engines: {node: '>=18.0.0'}hasBin: true+ resolution: {integrity: sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==}+ engines: {node: 20 || >=22}+resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}+ resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}+ engines: {node: '>=10'}+resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}engines: {node: '>=16 || 14 >=14.17'}@@ -5265,6 +5324,12 @@ packages:resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}+ resolution: {integrity: sha512-1EeVWmDzi16A+siQlo/SwSGIT7HwaFAVjvMA7/jG5HMLSnrUOzPL7uSTRZZa4v/LCRxHTApHKtNY6glApEoiUQ==}+ hasBin: true+ peerDependencies:+ typescript: ^5.x+resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}engines: {node: '>= 0.8.0'}@@ -5330,10 +5395,17 @@ packages:resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}engines: {node: '>=6'}+ resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}engines: {node: '>= 0.8'}+ resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}+resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}engines: {node: '>=8'}@@ -5457,6 +5529,10 @@ packages:resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}+ resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}+ engines: {node: '>=4'}+resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}engines: {node: '>= 0.4'}@@ -5682,6 +5758,10 @@ packages:resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}+ engines: {node: '>=0.10.0'}+resolution: {integrity: sha512-gAZ+kLqBdHarXB64XpAe2VCjB7rIRv+mU8tfRWziHRJ5umKsIHN2tLLv6EtMw7WCdP19S0ERVMldNvxYCHnhSQ==}engines: {node: '>=8.6.0'}@@ -6120,6 +6200,9 @@ packages:resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}+ resolution: {integrity: sha512-ztMO++owQnz8c/gIENcM9XfCEzgoGphTv+nKpYNM1bgsdOVC/jRZuEBf6N+mLLDNg68Kl+GgUZfOySaRiG1/Ug==}+resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}@@ -6203,6 +6286,10 @@ packages:resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==}engines: {node: '>=12.20'}+ resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==}+ engines: {node: '>=16'}+resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}engines: {node: '>= 0.6'}@@ -6289,6 +6376,9 @@ packages:resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}engines: {node: '>= 0.8'}+ resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==}+resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}@@ -6522,6 +6612,9 @@ packages:resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}engines: {node: '>=10'}+ resolution: {integrity: sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==}+resolution: {integrity: sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==}engines: {node: '>= 14.6'}@@ -7103,6 +7196,12 @@ snapshots:'@smithy/types': 4.3.1tslib: 2.8.1+ '@babel/[email protected]':+ dependencies:+ '@babel/helper-validator-identifier': 7.27.1+ js-tokens: 4.0.0+ picocolors: 1.1.1+'@babel/[email protected]': {}'@babel/[email protected]': {}@@ -7630,7 +7729,7 @@ snapshots:'@eslint/[email protected]':dependencies:'@eslint/object-schema': 2.1.6- debug: 4.4.1+ debug: 4.4.1([email protected])minimatch: 3.1.2transitivePeerDependencies:- supports-color@@ -7648,7 +7747,7 @@ snapshots:'@eslint/[email protected]':dependencies:ajv: 6.12.6- debug: 4.4.1+ debug: 4.4.1([email protected])espree: 10.4.0globals: 14.0.0ignore: 5.3.2@@ -7977,6 +8076,12 @@ snapshots:dependencies:mute-stream: 1.0.0+ '@isaacs/[email protected]': {}++ '@isaacs/[email protected]':+ dependencies:+ '@isaacs/balanced-match': 4.0.1+'@isaacs/[email protected]':dependencies:string-width: 5.1.2@@ -8286,7 +8391,7 @@ snapshots:dependencies:'@openai/zod': [email protected]- debug: 4.4.1+ debug: 4.4.1([email protected])openai: 5.5.1([email protected])([email protected])optionalDependencies:'@modelcontextprotocol/sdk': 1.13.0@@ -8299,7 +8404,7 @@ snapshots:dependencies:'@openai/agents-core': 0.0.7([email protected])([email protected])'@openai/zod': [email protected]- debug: 4.4.1+ debug: 4.4.1([email protected])openai: 5.5.1([email protected])([email protected])transitivePeerDependencies:- supports-color@@ -8311,7 +8416,7 @@ snapshots:'@openai/agents-core': 0.0.7([email protected])([email protected])'@openai/zod': [email protected]'@types/ws': 8.18.1- debug: 4.4.1+ debug: 4.4.1([email protected])ws: 8.18.2transitivePeerDependencies:- bufferutil@@ -8324,7 +8429,7 @@ snapshots:'@openai/agents-core': 0.0.7([email protected])([email protected])'@openai/agents-openai': 0.0.7([email protected])([email protected])'@openai/agents-realtime': 0.0.7([email protected])- debug: 4.4.1+ debug: 4.4.1([email protected])openai: 5.5.1([email protected])([email protected])transitivePeerDependencies:- bufferutil@@ -9119,6 +9224,29 @@ snapshots:'@protobufjs/[email protected]': {}+ '@redocly/[email protected]':+ dependencies:+ fast-deep-equal: 3.1.3+ json-schema-traverse: 1.0.0+ require-from-string: 2.0.2+ uri-js-replace: 1.0.1++ '@redocly/[email protected]': {}++ '@redocly/[email protected]([email protected])':+ dependencies:+ '@redocly/ajv': 8.11.3+ '@redocly/config': 0.22.2+ colorette: 1.4.0+ https-proxy-agent: 7.0.6([email protected])+ js-levenshtein: 1.1.6+ js-yaml: 4.1.0+ minimatch: 5.1.6+ pluralize: 8.0.0+ yaml-ast-parser: 0.0.43+ transitivePeerDependencies:+ - supports-color+'@rollup/[email protected]':optional: true@@ -9548,6 +9676,12 @@ snapshots:dependencies:tslib: 2.8.1+ '@ts-morph/[email protected]':+ dependencies:+ fast-glob: 3.3.3+ minimatch: 10.0.3+ path-browserify: 1.0.1+'@types/[email protected]': {}'@types/[email protected]': {}@@ -9702,7 +9836,7 @@ snapshots:'@typescript-eslint/types': 8.34.1'@typescript-eslint/typescript-estree': 8.34.1([email protected])'@typescript-eslint/visitor-keys': 8.34.1- debug: 4.4.1+ debug: 4.4.1([email protected])eslint: 9.29.0([email protected])typescript: 5.8.3transitivePeerDependencies:@@ -9712,7 +9846,7 @@ snapshots:dependencies:'@typescript-eslint/tsconfig-utils': 8.34.1([email protected])'@typescript-eslint/types': 8.34.1- debug: 4.4.1+ debug: 4.4.1([email protected])typescript: 5.8.3transitivePeerDependencies:- supports-color@@ -9730,7 +9864,7 @@ snapshots:dependencies:'@typescript-eslint/typescript-estree': 8.34.1([email protected])- debug: 4.4.1+ debug: 4.4.1([email protected])eslint: 9.29.0([email protected])ts-api-utils: 2.1.0([email protected])typescript: 5.8.3@@ -9745,7 +9879,7 @@ snapshots:'@typescript-eslint/tsconfig-utils': 8.34.1([email protected])'@typescript-eslint/types': 8.34.1'@typescript-eslint/visitor-keys': 8.34.1- debug: 4.4.1+ debug: 4.4.1([email protected])fast-glob: 3.3.3is-glob: 4.0.3minimatch: 9.0.5@@ -9986,7 +10120,7 @@ snapshots:dependencies:bytes: 3.1.2content-type: 1.0.5- debug: 4.4.1+ debug: 4.4.1([email protected])http-errors: 2.0.0iconv-lite: 0.6.3on-finished: 2.4.1@@ -10095,6 +10229,8 @@ snapshots:+ [email protected]: {}+@@ -10144,6 +10280,8 @@ snapshots:+ [email protected]: {}+dependencies:'@aws-sdk/client-sagemaker': 3.832.0@@ -10179,6 +10317,8 @@ snapshots:color-convert: 2.0.1color-string: 1.9.1+ [email protected]: {}+@@ -10298,9 +10438,11 @@ snapshots:dependencies:ms: 2.0.0dependencies:ms: 2.1.3+ optionalDependencies:+ supports-color: 10.0.0@@ -10545,7 +10687,7 @@ snapshots:ajv: 6.12.6chalk: 4.1.2cross-spawn: 7.0.6- debug: 4.4.1+ debug: 4.4.1([email protected])escape-string-regexp: 4.0.0eslint-scope: 8.4.0eslint-visitor-keys: 4.2.1@@ -10677,7 +10819,7 @@ snapshots:content-type: 1.0.5cookie: 0.7.2cookie-signature: 1.2.2- debug: 4.4.1+ debug: 4.4.1([email protected])encodeurl: 2.0.0escape-html: 1.0.3etag: 1.8.1@@ -10791,7 +10933,7 @@ snapshots:dependencies:- debug: 4.4.1+ debug: 4.4.1([email protected])encodeurl: 2.0.0escape-html: 1.0.3on-finished: 2.4.1@@ -10885,7 +11027,7 @@ snapshots:dependencies:extend: 3.0.2- https-proxy-agent: 7.0.6+ https-proxy-agent: 7.0.6([email protected])is-stream: 2.0.1node-fetch: 2.7.0uuid: 9.0.1@@ -11046,10 +11188,10 @@ snapshots:statuses: 2.0.1toidentifier: 1.0.1dependencies:agent-base: 7.1.3- debug: 4.4.1+ debug: 4.4.1([email protected])transitivePeerDependencies:- supports-color@@ -11093,6 +11235,8 @@ snapshots:+ [email protected]: {}+@@ -11196,6 +11340,8 @@ snapshots:+ [email protected]: {}+dependencies:base64-js: 1.5.1@@ -11223,6 +11369,8 @@ snapshots:+ [email protected]: {}+dependencies:'@apidevtools/json-schema-ref-parser': 11.9.3@@ -11325,7 +11473,7 @@ snapshots:dependencies:chalk: 5.4.1commander: 13.1.0- debug: 4.4.1+ debug: 4.4.1([email protected])execa: 8.0.1lilconfig: 3.1.3listr2: 8.3.3@@ -11481,10 +11629,18 @@ snapshots:- bufferutil- utf-8-validate+ dependencies:+ '@isaacs/brace-expansion': 5.0.0+dependencies:brace-expansion: 1.1.12+ dependencies:+ brace-expansion: 2.0.2+dependencies:brace-expansion: 2.0.2@@ -11671,6 +11827,16 @@ snapshots:+ dependencies:+ '@redocly/openapi-core': 1.34.5([email protected])+ ansi-colors: 4.1.3+ change-case: 5.4.4+ parse-json: 8.3.0+ supports-color: 10.0.0+ typescript: 5.8.3+ yargs-parser: 21.1.1+dependencies:deep-is: 0.1.4@@ -11734,8 +11900,16 @@ snapshots:dependencies:callsites: 3.1.0+ dependencies:+ '@babel/code-frame': 7.27.1+ index-to-position: 1.1.0+ type-fest: 4.41.0++ [email protected]: {}+@@ -11847,6 +12021,8 @@ snapshots:mlly: 1.7.4pathe: 2.0.3+ [email protected]: {}+@@ -12056,9 +12232,11 @@ snapshots:+ [email protected]: {}+dependencies:- debug: 4.4.1+ debug: 4.4.1([email protected])module-details-from-path: 1.0.4resolve: 1.22.10transitivePeerDependencies:@@ -12119,7 +12297,7 @@ snapshots:dependencies:- debug: 4.4.1+ debug: 4.4.1([email protected])depd: 2.0.0is-promise: 4.0.0parseurl: 1.3.3@@ -12182,7 +12360,7 @@ snapshots:dependencies:- debug: 4.4.1+ debug: 4.4.1([email protected])encodeurl: 2.0.0escape-html: 1.0.3etag: 1.8.1@@ -12601,6 +12779,11 @@ snapshots:+ dependencies:+ '@ts-morph/common': 0.27.0+ code-block-writer: 13.0.3+@@ -12611,7 +12794,7 @@ snapshots:cac: 6.7.14chokidar: 4.0.3consola: 3.4.2- debug: 4.4.1+ debug: 4.4.1([email protected])esbuild: 0.25.5fix-dts-default-cjs-exports: 1.0.1joycon: 3.1.1@@ -12679,6 +12862,8 @@ snapshots:+ [email protected]: {}+dependencies:media-typer: 0.3.0@@ -12770,6 +12955,8 @@ snapshots:+ [email protected]: {}+dependencies:punycode: 2.3.1@@ -12795,7 +12982,7 @@ snapshots:[email protected](@types/[email protected])([email protected])([email protected])([email protected]):dependencies:cac: 6.7.14- debug: 4.4.1+ debug: 4.4.1([email protected])es-module-lexer: 1.7.0pathe: 2.0.3@@ -12816,7 +13003,7 @@ snapshots:[email protected](@types/[email protected])([email protected])([email protected])([email protected]):dependencies:cac: 6.7.14- debug: 4.4.1+ debug: 4.4.1([email protected])es-module-lexer: 1.7.0pathe: 2.0.3@@ -12837,7 +13024,7 @@ snapshots:[email protected](@types/[email protected])([email protected])([email protected])([email protected]):dependencies:cac: 6.7.14- debug: 4.4.1+ debug: 4.4.1([email protected])es-module-lexer: 1.7.0pathe: 2.0.3@@ -12911,7 +13098,7 @@ snapshots:'@vitest/spy': 3.2.4'@vitest/utils': 3.2.4chai: 5.2.0- debug: 4.4.1+ debug: 4.4.1([email protected])expect-type: 1.2.1magic-string: 0.30.17pathe: 2.0.3@@ -12953,7 +13140,7 @@ snapshots:'@vitest/spy': 3.2.4'@vitest/utils': 3.2.4chai: 5.2.0- debug: 4.4.1+ debug: 4.4.1([email protected])expect-type: 1.2.1magic-string: 0.30.17pathe: 2.0.3@@ -12995,7 +13182,7 @@ snapshots:'@vitest/spy': 3.2.4'@vitest/utils': 3.2.4chai: 5.2.0- debug: 4.4.1+ debug: 4.4.1([email protected])expect-type: 1.2.1magic-string: 0.30.17pathe: 2.0.3@@ -13156,6 +13343,8 @@ snapshots:+ [email protected]: {}+diff --git a/ts/packages/cli/package.json b/ts/packages/cli/package.jsonindex 03ac69f4c..1d075a6d5 100644--- a/ts/packages/cli/package.json+++ b/ts/packages/cli/package.json@@ -72,10 +72,12 @@"effect": "^3.16.16","indent-string": "^5.0.0","open": "^10.2.0",+ "openapi-typescript": "^7.8.0","picocolors": "^1.1.1","semver": "^7.7.2","source-map-js": "^1.2.1",- "superjson": "^2.2.2"+ "superjson": "^2.2.2",+ "ts-morph": "^26.0.0"},"gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064"}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.tsindex 7985e1a21..8714f6a57 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@@ -134,7 +134,7 @@ export function generateTypescriptTypeStubs({const index = createToolkitIndex({ toolkits, tools, triggerTypes });// Generate TypeScript sources- const sources = generateTypeScriptSources({+ const sources = yield* generateTypeScriptSources({outputDir,emitSingleFile: Boolean(compact), // Ensure boolean typebanner: BANNER,diff --git a/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts b/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.tsindex c361966db..14b110751 100644--- a/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts+++ b/ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts@@ -24,11 +24,15 @@*/import * as ts from '@composio/ts-builders';-import { pipe, Record } from 'effect';+import { Effect, pipe, Record, Array as Arr } 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';import type { TriggerType } from 'src/models/trigger-types';+import {+ generateTypeFromJsonSchema,+ GenerateTypeFromJsonSchemaError,+} from './generate-type-from-json-schema';function jsValueToTsValue(value: unknown): ts.ValueBuilder {if (value === null) {@@ -97,65 +101,148 @@ function generateTriggerTypeObjectValue(triggerType: TriggerType): ts.ValueBuild* Generates a list of TypeScript source files that should be written to disk by the caller.*/export function generateTypeScriptToolkitSources(banner: string) {- return (index: ToolkitIndex): Array<SourceFile> => {- const toolkitSources = pipe(- index,- Record.mapEntries(generateTypeScriptToolkitSource(banner)),- Record.toEntries- );-- return toolkitSources;- };+ return (index: ToolkitIndex) =>+ Effect.gen(function* () {+ const toolkitSources = yield* Effect.all(+ Record.toEntries(index).map(([key, value]) =>+ generateTypeScriptToolkitSource(banner)(key, value)+ )+ );++ return toolkitSources;+ });}function generateTypeScriptToolkitSource(_banner: string) {return (- { slug, tools, triggerTypes }: ToolkitIndexData,- toolkitName: ToolkitName- ): SourceFile => {- const filename = `${slug}.ts`;-- const file = ts.file();-- const entry = ts.propertyValue(- toolkitName,- ts- .objectValue()- .add(ts.propertyValue('slug', ts.stringLiteral(slug).asValue()))- .add(- ts.propertyValue(- 'tools',- ts- .objectValue()- .addMultiple(- Object.entries(tools).map(([toolName, tool]) =>- ts.propertyValue(toolName, ts.stringLiteral(tool).asValue())+ toolkitName: ToolkitName,+ { slug, tools, triggerTypes }: ToolkitIndexData+ ): Effect.Effect<SourceFile, GenerateTypeFromJsonSchemaError, never> => {+ return Effect.gen(function* () {+ const filename = `${slug}.ts`;+ const file = ts.file();++ // add `import { type TriggerEvent } from "@composio/core"`, if there are trigger types+ if (Object.keys(triggerTypes).length > 0) {+ file.addImport(+ ts.moduleImport('@composio/core').named(ts.namedImport('TriggerEvent').typeOnly())+ );+ }++ // 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 = { .. }`+ const triggerPayloadType = yield* generateTypeFromJsonSchema(+ `${toolkitName}_${triggerTypeSlug}_PAYLOAD`,+ triggerType.payload+ );+ file.add(ts.typeDeclaration(triggerTypeSlug, triggerPayloadType));+ }++ // write the toolkit const object declaration+ const toolValueDeclaration = ts.propertyValue(+ toolkitName,+ ts+ .objectValue()+ .add(ts.propertyValue('slug', ts.stringLiteral(slug).asValue()))+ .add(+ ts.propertyValue(+ 'tools',+ ts+ .objectValue()+ .addMultiple(+ Object.entries(tools).map(([toolName, tool]) =>+ ts.propertyValue(toolName, ts.stringLiteral(tool).asValue())+ ))- )+ ))- )- .add(- ts.propertyValue(- 'triggerTypes',- ts- .objectValue()- .addMultiple(- Object.entries(triggerTypes).map(([triggerTypeSlug, triggerType]) =>- ts.propertyValue(triggerTypeSlug, generateTriggerTypeObjectValue(triggerType))+ .add(+ ts.propertyValue(+ 'triggerTypes',+ ts+ .objectValue()+ .addMultiple(+ Object.entries(triggerTypes).map(([triggerTypeSlug, triggerType]) =>+ ts.propertyValue(triggerTypeSlug, generateTriggerTypeObjectValue(triggerType))+ ))- )+ ))- )- );+ );- file.add(- ts- .moduleExport(ts.constDeclaration(entry.name as string).setValue(entry.value))- .setDocComment(ts.docComment(`Map of Composio's ${entry.name} toolkit.`))- );+ file.add(+ ts+ .moduleExport(+ ts+ .constDeclaration(toolValueDeclaration.name as string)+ .setValue(toolValueDeclaration.value)+ )+ .setDocComment(ts.docComment(`Map of Composio's ${toolValueDeclaration.name} toolkit.`))+ );++ // write the map of trigger payload types+ {+ const triggerPayloadTypeEntries = pipe(+ triggerTypes,+ Record.map((_, triggerTypeSlug) =>+ ts.property(triggerTypeSlug, ts.namedType(`${toolkitName}_${triggerTypeSlug}_PAYLOAD`))+ ),+ Record.toEntries,+ Arr.map(([_, value]) => value)+ );++ const doc = ts.docComment(+ `Type map of all available trigger payloads for toolkit "${toolkitName}".`+ );++ file.add(+ ts+ .moduleExport(+ ts.typeDeclaration(+ `${toolkitName}_TRIGGER_PAYLOADS`,+ ts.objectType().addMultiple(triggerPayloadTypeEntries)+ )+ )+ .setDocComment(doc)+ );+ }++ // write the map of trigger events+ {+ const triggerEventTypeEntries = pipe(+ triggerTypes,+ Record.map((_, triggerTypeSlug) =>+ ts.property(+ triggerTypeSlug,+ ts+ .namedType('TriggerEvent')+ .addGenericArgument(ts.namedType(`${toolkitName}_${triggerTypeSlug}_PAYLOAD`))+ )+ ),+ Record.toEntries,+ Arr.map(([_, value]) => value)+ );++ const doc = ts.docComment(+ `Type map of all available trigger events for toolkit "${toolkitName}".`+ );++ file.add(+ ts+ .moduleExport(+ ts.typeDeclaration(+ `${toolkitName}_TRIGGER_EVENTS`,+ ts.objectType().addMultiple(triggerEventTypeEntries)+ )+ )+ .setDocComment(doc)+ );+ }- const filesource = ts.stringify(file);+ const filesource = ts.stringify(file);- return [filename, filesource];+ return [filename, filesource];+ });};}diff --git a/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts b/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.tsnew file mode 100644index 000000000..aacb4c73e--- /dev/null+++ b/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts@@ -0,0 +1,142 @@+import ts from 'typescript';+import openapiTS, { type OpenAPI3, astToString } from 'openapi-typescript';+import { Effect } from 'effect';+import { TaggedError } from 'effect/Data';++export class GenerateTypeFromJsonSchemaError extends TaggedError('json-parsing-error')<{+ cause?: unknown;+ message?: string;+}> {}++export function generateTypeFromJsonSchema(+ name: string,+ schema: { readonly [x: string]: unknown }+) {+ const openApi3Definition = {+ openapi: '3.1.0',+ components: {+ schemas: {+ [name]: {+ type: 'object',+ properties: schema['properties'],+ },+ },+ },+ } as unknown as OpenAPI3;++ return Effect.gen(function* () {+ const astNodes = yield* Effect.tryPromise({+ try: () => openapiTS(openApi3Definition),+ catch: e =>+ new GenerateTypeFromJsonSchemaError({+ cause: e,+ message: 'Failed to generate type from JSON schema',+ }),+ });++ const components = astNodes.find(isInterfaceComponents);++ if (components === undefined) {+ return yield* Effect.fail(+ new GenerateTypeFromJsonSchemaError({+ message:+ 'Failed to find `components` interface in types generated by `openapi-typescript`',+ })+ );+ }++ // This is the TypeScript definition obtained via `openapi-typescript`, which contains the types we want + some garbage we don't need.+ // We thus have to extract the type we want using the TypeScript API.+ const sourceCode = astToString(components);++ const sourceFile = ts.createSourceFile('virtual.ts', sourceCode, ts.ScriptTarget.Latest, true);++ // Navigate to components.schemas[name]+ const schemasProp = components.members.find(+ m => ts.isPropertySignature(m) && (m.name as ts.Identifier).text === 'schemas'+ ) as ts.PropertySignature | undefined;++ if (!schemasProp || !schemasProp.type || !ts.isTypeLiteralNode(schemasProp.type)) {+ return yield* Effect.fail(+ new GenerateTypeFromJsonSchemaError({+ message: '`schemas` is not a type literal',+ })+ );+ }++ const schemasTypeLiteral = schemasProp.type;+ const payloadProp = schemasTypeLiteral.members.find(+ m => ts.isPropertySignature(m) && (m.name as ts.Identifier).text === name+ ) as ts.PropertySignature | undefined;++ if (!payloadProp || !payloadProp.type) {+ return yield* Effect.fail(+ new GenerateTypeFromJsonSchemaError({+ message: `Failed to find type for ${name}`,+ })+ );+ }++ let typeNode: ts.TypeNode;++ // Handle different type node cases+ if (ts.isTypeLiteralNode(payloadProp.type)) {+ // Case 1: Type literal with specific properties (e.g., { foo: string; bar: number; })+ // BUT also handle empty type literals (which represent generic objects with no properties)+ if (payloadProp.type.members.length === 0) {+ // Empty type literal {} should be converted to 'object'+ typeNode = ts.factory.createTypeReferenceNode('object');+ } else {+ // Type literal with specific properties+ typeNode = payloadProp.type;+ }+ } else if (+ ts.isTypeReferenceNode(payloadProp.type) &&+ payloadProp.type.typeName &&+ ts.isIdentifier(payloadProp.type.typeName)+ ) {+ const typeNameText = payloadProp.type.typeName.text;+ if (typeNameText === 'object') {+ // Case 2a: Generic 'object' type reference - output TypeScript 'object' type+ typeNode = ts.factory.createTypeReferenceNode('object');+ } else if (typeNameText === 'Record') {+ // Case 2b: Record type (generated by openapi-typescript for generic objects) - convert to 'object'+ typeNode = ts.factory.createTypeReferenceNode('object');+ } else {+ // Case 2c: Other type references - fall back to 'unknown'+ typeNode = ts.factory.createTypeReferenceNode('unknown');+ }+ } else if (+ ts.isToken(payloadProp.type) &&+ payloadProp.type.kind === ts.SyntaxKind.ObjectKeyword+ ) {+ // Case 3: Direct 'object' keyword - output TypeScript 'object' type+ typeNode = ts.factory.createTypeReferenceNode('object');+ } else {+ // Case 4: Other unexpected types - fall back to 'unknown'+ typeNode = ts.factory.createTypeReferenceNode('unknown');+ }++ // Print the type as a string with JSDoc preserved+ const printer = ts.createPrinter({ removeComments: false });++ const printedType = ts.factory.createTypeAliasDeclaration(+ [],+ // [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],+ name,+ undefined,+ typeNode+ );++ const printedText = printer.printNode(ts.EmitHint.Unspecified, printedType, sourceFile);++ // Formats the type so that it is indented by 2 spaces instead of 4+ const adjustedText = printedText.replace(/^ {4}/gm, ' ');++ return adjustedText;+ });+}++function isInterfaceComponents(node: ts.Node): node is ts.InterfaceDeclaration {+ return ts.isInterfaceDeclaration(node) && node.name.escapedText === 'components';+}diff --git a/ts/packages/cli/src/generation/typescript/generate.ts b/ts/packages/cli/src/generation/typescript/generate.tsindex b246bdb76..b51883898 100644--- a/ts/packages/cli/src/generation/typescript/generate.ts+++ b/ts/packages/cli/src/generation/typescript/generate.ts@@ -3,6 +3,8 @@ import path from 'node:path';import type { ToolkitIndex } from 'src/generation/create-toolkit-index';import { generateTypeScriptToolkitSources } from './generate-toolkit-sources';import { generateIndexSource } from './generate-index-source';+import { Effect } from 'effect';+import type { GenerateTypeFromJsonSchemaError } from './generate-type-from-json-schema';type SourceFile = readonly [filename: string, content: string];@@ -14,27 +16,30 @@ type GenerateTypeScriptSourcesParams = {};export function generateTypeScriptSources(params: GenerateTypeScriptSourcesParams) {- return (index: ToolkitIndex): Array<SourceFile> => {- const toolkiteSources = generateTypeScriptToolkitSources(params.banner)(index);+ return (+ index: ToolkitIndex+ ): Effect.Effect<Array<SourceFile>, GenerateTypeFromJsonSchemaError, never> =>+ Effect.gen(function* () {+ const toolkiteSources = yield* generateTypeScriptToolkitSources(params.banner)(index);- const indexSource = generateIndexSource(params)(index);- const indexFilename = path.join(params.outputDir, 'index.ts');+ const indexSource = generateIndexSource(params)(index);+ const indexFilename = path.join(params.outputDir, 'index.ts');- if (!params.emitSingleFile) {- return [- ...toolkiteSources.map(- ([filename, content]) => [path.join(params.outputDir, filename), content] as const- ),- [indexFilename, indexSource] as const,- ] as const;- }+ if (!params.emitSingleFile) {+ return [+ ...toolkiteSources.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 = toolkiteSources.map(([_, content]) => content).join('\n');- const indexSourceSingleFile = `${ts.stringify(ts.docComment(params.banner))}-${localToolkitsSources}-${indexSource}-`;- return [[indexFilename, indexSourceSingleFile] as const];- };+ const indexSourceSingleFile = `${ts.stringify(ts.docComment(params.banner))}+ ${localToolkitsSources}+ ${indexSource}+ `;+ return [[indexFilename, indexSourceSingleFile] as const];+ });}diff --git a/ts/packages/cli/test/__mocks__/tools_github.ts b/ts/packages/cli/test/__mocks__/tools_github.tsnew file mode 100644index 000000000..3cd0fcd68--- /dev/null+++ b/ts/packages/cli/test/__mocks__/tools_github.ts@@ -0,0 +1,3 @@+import TOOLS from './tools.json' with { type: 'json' };++export const TOOLS_GITHUB = TOOLS.filter(tool => tool.startsWith('GITHUB_'));diff --git a/ts/packages/cli/test/__mocks__/tools_gmail.ts b/ts/packages/cli/test/__mocks__/tools_gmail.tsnew file mode 100644index 000000000..c90e31567--- /dev/null+++ b/ts/packages/cli/test/__mocks__/tools_gmail.ts@@ -0,0 +1,3 @@+import TOOLS from './tools.json' with { type: 'json' };++export const TOOLS_GMAIL = TOOLS.filter(tool => tool.startsWith('GMAIL_'));diff --git a/ts/packages/cli/test/__mocks__/tools_googledrive.ts b/ts/packages/cli/test/__mocks__/tools_googledrive.tsnew file mode 100644index 000000000..214d7ba97--- /dev/null+++ b/ts/packages/cli/test/__mocks__/tools_googledrive.ts@@ -0,0 +1,3 @@+import TOOLS from './tools.json' with { type: 'json' };++export const TOOLS_GOOGLEDRIVE = TOOLS.filter(tool => tool.startsWith('GOOGLEDRIVE_'));diff --git a/ts/packages/cli/test/__mocks__/trigger-type-gmail.ts b/ts/packages/cli/test/__mocks__/trigger-type-gmail.tsdeleted file mode 100644index 36ffa8ddb..000000000--- a/ts/packages/cli/test/__mocks__/trigger-type-gmail.ts+++ /dev/null@@ -1,6 +0,0 @@-import type { TriggerType } from 'src/models/trigger-types';-import TRIGGER_TYPES from './trigger-types.json' with { type: 'json' };--export const TRIGGER_TYPE_GMAIL = TRIGGER_TYPES.find(- triggerType => triggerType.slug === 'GMAIL_NEW_GMAIL_MESSAGE'-)! as TriggerType;diff --git a/ts/packages/cli/test/__mocks__/trigger-types-github.ts b/ts/packages/cli/test/__mocks__/trigger-types-github.tsnew file mode 100644index 000000000..fc2b7edac--- /dev/null+++ b/ts/packages/cli/test/__mocks__/trigger-types-github.ts@@ -0,0 +1,6 @@+import TRIGGER_TYPES from './trigger-types.json' with { type: 'json' };+import { TriggerType } from 'src/models/trigger-types';++export const TRIGGER_TYPES_GITHUB = TRIGGER_TYPES.filter(triggerType =>+ triggerType.slug.startsWith('GITHUB_')+) as TriggerType[];diff --git a/ts/packages/cli/test/__mocks__/trigger-types-gmail.ts b/ts/packages/cli/test/__mocks__/trigger-types-gmail.tsnew file mode 100644index 000000000..ceca329db--- /dev/null+++ b/ts/packages/cli/test/__mocks__/trigger-types-gmail.ts@@ -0,0 +1,6 @@+import TRIGGER_TYPES from './trigger-types.json' with { type: 'json' };+import { TriggerType } from 'src/models/trigger-types';++export const TRIGGER_TYPES_GMAIL = TRIGGER_TYPES.filter(triggerType =>+ triggerType.slug.startsWith('GMAIL')+) as TriggerType[];diff --git a/ts/packages/cli/test/__mocks__/trigger-types-googledrive.ts b/ts/packages/cli/test/__mocks__/trigger-types-googledrive.tsnew file mode 100644index 000000000..2b2786ae6--- /dev/null+++ b/ts/packages/cli/test/__mocks__/trigger-types-googledrive.ts@@ -0,0 +1,6 @@+import TRIGGER_TYPES from './trigger-types.json' with { type: 'json' };+import { TriggerType } from 'src/models/trigger-types';++export const TRIGGER_TYPES_GOOGLEDRIVE = TRIGGER_TYPES.filter(triggerType =>+ triggerType.slug.startsWith('GOOGLEDRIVE')+) as TriggerType[];diff --git a/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts b/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.tsindex c426e0880..9f4933fc9 100644--- a/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts@@ -5,9 +5,10 @@ import { FileSystem } from '@effect/platform';import { cli, TestLive } from 'test/__utils__';import { makeTestToolkits } from 'test/__utils__/models/toolkits';import { NodeProcess } from 'src/services/node-process';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';import { TestLiveInput } from 'test/__utils__/services/test-layer';import { assertPythonIsValid } from 'test/__utils__/python-compiler';+import { TOOLS_GMAIL } from 'test/__mocks__/tools_gmail';describe('CLI: composio py generate', () => {const appClientData = {@@ -21,9 +22,9 @@ describe('CLI: composio py generate', () => {slug: 'slack',},]),- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypesAsEnums: ['GMAIL_NEW_GMAIL_MESSAGE'],- triggerTypes: [TRIGGER_TYPE_GMAIL],+ tools: [...TOOLS_GMAIL.slice(0, 3)],+ triggerTypesAsEnums: [...TRIGGER_TYPES_GMAIL.slice(0, 3).map(triggerType => triggerType.slug)],+ triggerTypes: [...TRIGGER_TYPES_GMAIL.slice(0, 3)],} satisfies TestLiveInput['toolkitsData'];layer(@@ -126,9 +127,9 @@ describe('CLI: composio py generate', () => {slug: str = "gmail"class tools:+ ADD_LABEL_TO_EMAIL = "GMAIL_ADD_LABEL_TO_EMAIL"CREATE_EMAIL_DRAFT = "GMAIL_CREATE_EMAIL_DRAFT"- DELETE_MESSAGE = "GMAIL_DELETE_MESSAGE"- FETCH_EMAILS = "GMAIL_FETCH_EMAILS"+ CREATE_LABEL = "GMAIL_CREATE_LABEL"class triggers:NEW_GMAIL_MESSAGE = {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.tsindex abf5c7697..bdab4f503 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@@ -11,7 +11,8 @@ import {} from 'test/__utils__/typescript-compiler';import { ComposioCorePkgNotFound } from 'src/effects/find-composio-core-generated';import type { TestLiveInput } from 'test/__utils__/services/test-layer';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';+import { TOOLS_GMAIL } from 'test/__mocks__/tools_gmail';describe('CLI: composio ts generate', () => {const appClientData = {@@ -25,9 +26,9 @@ describe('CLI: composio ts generate', () => {slug: 'slack',},]),- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypesAsEnums: ['GMAIL_NEW_GMAIL_MESSAGE'],- triggerTypes: [TRIGGER_TYPE_GMAIL],+ tools: [...TOOLS_GMAIL.slice(0, 3)],+ triggerTypes: [...TRIGGER_TYPES_GMAIL.slice(0, 3)],+ triggerTypesAsEnums: [...TRIGGER_TYPES_GMAIL.slice(0, 3).map(triggerType => triggerType.slug)],} satisfies TestLiveInput['toolkitsData'];describe('[Given] valid fetched app data', () => {@@ -61,15 +62,74 @@ describe('CLI: composio ts generate', () => {const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));expect(gmailSourceCode).toMatchInlineSnapshot(`- "/**+ "import { type TriggerEvent } from "@composio/core"++ 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;+ };++ /*** 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",- DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",- FETCH_EMAILS: "GMAIL_FETCH_EMAILS",+ CREATE_LABEL: "GMAIL_CREATE_LABEL",},triggerTypes: {NEW_GMAIL_MESSAGE: {@@ -211,19 +271,43 @@ describe('CLI: composio ts generate', () => {},},}++ /**+ * 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>+ }"`);expect(slackSourceCode).toMatchInlineSnapshot(`- "/**- * Map of Composio's SLACK toolkit.- */- export const SLACK = {- slug: "slack",- tools: {},- triggerTypes: {},- }- "- `);+ "/**+ * 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(indexSourceCode).toMatchInlineSnapshot(`"/*** Auto-generated by Composio CLI. Do not modify manually.@@ -306,15 +390,74 @@ describe('CLI: composio ts generate', () => {const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));expect(gmailSourceCode).toMatchInlineSnapshot(`- "/**+ "import { type TriggerEvent } from "@composio/core"++ 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;+ };++ /*** 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",- DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",- FETCH_EMAILS: "GMAIL_FETCH_EMAILS",+ CREATE_LABEL: "GMAIL_CREATE_LABEL",},triggerTypes: {NEW_GMAIL_MESSAGE: {@@ -456,19 +599,43 @@ describe('CLI: composio ts generate', () => {},},}++ /**+ * 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>+ }"`);expect(slackSourceCode).toMatchInlineSnapshot(`- "/**- * Map of Composio's SLACK toolkit.- */- export const SLACK = {- slug: "slack",- tools: {},- triggerTypes: {},- }- "- `);+ "/**+ * 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(indexSourceCode).toMatchInlineSnapshot(`"/*** Auto-generated by Composio CLI. Do not modify manually.diff --git a/ts/packages/cli/test/src/effects/detect-platform.test.ts b/ts/packages/cli/test/src/effects/detect-platform.test.tsindex ed73bb8a7..48265d88a 100644--- a/ts/packages/cli/test/src/effects/detect-platform.test.ts+++ b/ts/packages/cli/test/src/effects/detect-platform.test.ts@@ -364,7 +364,7 @@ describe('detect-platform.ts', () => {});describe('Type Tests', () => {- it('should return correct PlatformArch type for supported combinations', () => {+ it('should return correct PlatformArch type for supported combinations', async () => {// This test verifies TypeScript types at runtimeconst testType = async (platform: string, arch: string): Promise<PlatformArch> => {return await Effect.runPromise(@@ -373,9 +373,15 @@ describe('detect-platform.ts', () => {};// These calls should compile without TypeScript errors- expect(testType('darwin', 'x64')).resolves.toEqual({ platform: 'darwin', arch: 'x64' });- expect(testType('darwin', 'arm64')).resolves.toEqual({ platform: 'darwin', arch: 'aarch64' });- expect(testType('linux', 'aarch64')).resolves.toEqual({ platform: 'linux', arch: 'aarch64' });+ await expect(testType('darwin', 'x64')).resolves.toEqual({ platform: 'darwin', arch: 'x64' });+ await expect(testType('darwin', 'arm64')).resolves.toEqual({+ platform: 'darwin',+ arch: 'aarch64',+ });+ await expect(testType('linux', 'aarch64')).resolves.toEqual({+ platform: 'linux',+ arch: 'aarch64',+ });});});});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.tsindex 6cd912c3a..419ebc403 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@@ -4,7 +4,8 @@ import { createToolkitIndex } from 'src/generation/create-toolkit-index';import { BANNER } from 'src/generation/constants';import { makeTestToolkits } from 'test/__utils__/models/toolkits';import { assertPythonIsValid } from 'test/__utils__/python-compiler';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';+import { TOOLS_GMAIL } from 'test/__mocks__/tools_gmail';describe('generatePythonToolkitSources', () => {it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty array', () => {@@ -70,8 +71,8 @@ describe('generatePythonToolkitSources', () => {const index = createToolkitIndex({toolkits,- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypes: [TRIGGER_TYPE_GMAIL],+ tools: [...TOOLS_GMAIL.slice(0, 3)],+ triggerTypes: [...TRIGGER_TYPES_GMAIL],});const sources = generatePythonToolkitSources(BANNER)(index);@@ -88,9 +89,9 @@ describe('generatePythonToolkitSources', () => {slug: str = "gmail"class tools:+ ADD_LABEL_TO_EMAIL = "GMAIL_ADD_LABEL_TO_EMAIL"CREATE_EMAIL_DRAFT = "GMAIL_CREATE_EMAIL_DRAFT"- DELETE_MESSAGE = "GMAIL_DELETE_MESSAGE"- FETCH_EMAILS = "GMAIL_FETCH_EMAILS"+ CREATE_LABEL = "GMAIL_CREATE_LABEL"class triggers:NEW_GMAIL_MESSAGE = {diff --git a/ts/packages/cli/test/src/generation/toolkit-index.test.ts b/ts/packages/cli/test/src/generation/toolkit-index.test.tsindex adb4f2b3a..c3d1c45a4 100644--- a/ts/packages/cli/test/src/generation/toolkit-index.test.ts+++ b/ts/packages/cli/test/src/generation/toolkit-index.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from 'vitest';import { createToolkitIndex } from 'src/generation/create-toolkit-index';import { makeTestToolkits } from 'test/__utils__/models/toolkits';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';describe('createToolkitIndex', () => {it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty index', () => {@@ -58,8 +58,12 @@ describe('createToolkitIndex', () => {},]);+ const GMAIL_NEW_GMAIL_MESSAGE = TRIGGER_TYPES_GMAIL.find(+ triggerType => triggerType.slug === 'GMAIL_NEW_GMAIL_MESSAGE'+ )!;+const tools = ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'];- const triggerTypes = [TRIGGER_TYPE_GMAIL];+ const triggerTypes = [GMAIL_NEW_GMAIL_MESSAGE];const index = createToolkitIndex({toolkits,@@ -76,7 +80,7 @@ describe('createToolkitIndex', () => {FETCH_EMAILS: 'GMAIL_FETCH_EMAILS',},triggerTypes: {- NEW_GMAIL_MESSAGE: TRIGGER_TYPE_GMAIL,+ NEW_GMAIL_MESSAGE: GMAIL_NEW_GMAIL_MESSAGE,},},SLACK: {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.tsindex 0823f1d36..e541d9605 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@@ -6,7 +6,10 @@ import {import { createToolkitIndex } from 'src/generation/create-toolkit-index';import { makeTestToolkits } from 'test/__utils__/models/toolkits';import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TOOLS_GITHUB } from 'test/__mocks__/tools_github';+import { TRIGGER_TYPES_GITHUB } from 'test/__mocks__/trigger-types-github';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';+import { TOOLS_GMAIL } from 'test/__mocks__/tools_gmail';describe('generateTypeScriptToolkitSources', () => {describe('with a single emitted file', () => {@@ -116,8 +119,8 @@ describe('generateTypeScriptToolkitSources', () => {const index = createToolkitIndex({toolkits,- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypes: [TRIGGER_TYPE_GMAIL],+ tools: [...TOOLS_GMAIL.slice(0, 3), ...TOOLS_GITHUB.slice(0, 3)],+ triggerTypes: [...TRIGGER_TYPES_GITHUB, ...TRIGGER_TYPES_GMAIL],});const source = generateIndexSource(params)(index);@@ -272,7 +275,7 @@ describe('generateTypeScriptToolkitSources', () => {const index = createToolkitIndex({toolkits,tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypes: [TRIGGER_TYPE_GMAIL],+ triggerTypes: [...TRIGGER_TYPES_GMAIL],});const source = generateIndexSource(params)(index);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.tsindex 1f0ad18b7..78ae159fa 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@@ -1,45 +1,56 @@-import { describe, expect, it } from 'vitest';+import { describe, expect, it } from '@effect/vitest';+import { Effect } from 'effect';import { generateTypeScriptToolkitSources } from 'src/generation/typescript/generate-toolkit-sources';import { createToolkitIndex } from 'src/generation/create-toolkit-index';import { makeTestToolkits } from 'test/__utils__/models/toolkits';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TOOLS_GITHUB } from 'test/__mocks__/tools_github';+import { TOOLS_GOOGLEDRIVE } from 'test/__mocks__/tools_googledrive';+import { TOOLS_GMAIL } from 'test/__mocks__/tools_gmail';+import { TRIGGER_TYPES_GITHUB } from 'test/__mocks__/trigger-types-github';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';+import { TRIGGER_TYPES_GOOGLEDRIVE } from 'test/__mocks__/trigger-types-googledrive';describe('generateTypeScriptToolkitSources', () => {describe('with a single emitted file', () => {describe('with banner', () => {const banner = 'Some banner that will appear in a comment';- it('[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty array', () => {- const index = createToolkitIndex({- toolkits: [],- tools: [],- triggerTypes: [],- });-- const sources = generateTypeScriptToolkitSources(banner)(index);-- expect(sources).toEqual([]);- });-- it('[Given] a single toolkit with no tools or triggerTypes [Then] it returns a single toolkit source file', () => {- const toolkits = makeTestToolkits([- {- name: 'Slack Helper',- slug: 'slack',- },- ]);-- const index = createToolkitIndex({- toolkits,- tools: [],- triggerTypes: [],- });-- const sources = generateTypeScriptToolkitSources(banner)(index);- expect(sources).toHaveLength(1);- expect(sources[0]).toHaveLength(2);- expect(sources[0][0]).toBe('slack.ts');- expect(sources[0][1]).toMatchInlineSnapshot(`+ it.effect(+ '[Given] empty toolkits, tools, triggerTypes [Then] it returns an empty array',+ Effect.fn(function* () {+ const index = createToolkitIndex({+ toolkits: [],+ tools: [],+ triggerTypes: [],+ });++ const sources = yield* generateTypeScriptToolkitSources(banner)(index);++ expect(sources).toEqual([]);+ })+ );++ it.effect(+ '[Given] a single toolkit with no tools or triggerTypes [Then] it returns a single toolkit source file',+ Effect.fn(function* () {+ const toolkits = makeTestToolkits([+ {+ name: 'Slack Helper',+ slug: 'slack',+ },+ ]);++ const index = createToolkitIndex({+ toolkits,+ tools: [],+ triggerTypes: [],+ });++ const sources = yield* generateTypeScriptToolkitSources(banner)(index);+ expect(sources).toHaveLength(1);+ expect(sources[0]).toHaveLength(2);+ expect(sources[0][0]).toBe('slack.ts');+ expect(sources[0][1]).toMatchInlineSnapshot(`"/*** Map of Composio's SLACK toolkit.*/@@ -48,43 +59,131 @@ describe('generateTypeScriptToolkitSources', () => {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 = {}"`);- });-- it('[Given] toolkits with tools and triggerTypes [Then] it returns a TypeScript source file for each toolkit + the index map', () => {- const toolkits = makeTestToolkits([- {- name: 'Gmail',- slug: 'gmail',- },- {- name: 'Slack Helper',- slug: 'slack',- },- ]);-- const index = createToolkitIndex({- toolkits,- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypes: [TRIGGER_TYPE_GMAIL],- });-- const sources = generateTypeScriptToolkitSources(banner)(index);- expect(sources).toHaveLength(2);-- expect(sources[0]).toHaveLength(2);- expect(sources[0][0]).toBe('gmail.ts');- expect(sources[0][1]).toMatchInlineSnapshot(`- "/**+ })+ );++ it.effect(+ '[Given] toolkits with tools and triggerTypes [Then] it returns a TypeScript source file for each toolkit + the index map',+ Effect.fn(function* () {+ const toolkits = makeTestToolkits([+ {+ name: 'Gmail',+ slug: 'gmail',+ },+ {+ name: 'Github',+ slug: 'github',+ },+ {+ name: 'Slack Helper',+ slug: 'slack',+ },+ {+ name: 'Google Drive',+ slug: 'googledrive',+ },+ ]);++ const index = createToolkitIndex({+ toolkits,+ tools: [+ ...TOOLS_GITHUB.slice(0, 3),+ ...TOOLS_GMAIL.slice(0, 3),+ ...TOOLS_GOOGLEDRIVE.slice(0, 3),+ ],+ triggerTypes: [+ ...TRIGGER_TYPES_GITHUB,+ ...TRIGGER_TYPES_GMAIL,+ ...TRIGGER_TYPES_GOOGLEDRIVE,+ ],+ });++ const sources = yield* generateTypeScriptToolkitSources(banner)(index);+ expect(sources).toHaveLength(4);++ expect(sources[0]).toHaveLength(2);+ expect(sources[0][0]).toBe('gmail.ts');+ expect(sources[0][1]).toMatchInlineSnapshot(`+ "import { type TriggerEvent } from "@composio/core"++ 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;+ };++ /*** 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",- DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",- FETCH_EMAILS: "GMAIL_FETCH_EMAILS",+ CREATE_LABEL: "GMAIL_CREATE_LABEL",},triggerTypes: {NEW_GMAIL_MESSAGE: {@@ -226,12 +325,647 @@ describe('generateTypeScriptToolkitSources', () => {},},}++ /**+ * 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>+ }"`);- expect(sources[1]).toHaveLength(2);- expect(sources[1][0]).toBe('slack.ts');- expect(sources[1][1]).toMatchInlineSnapshot(`+ expect(sources[1]).toHaveLength(2);+ expect(sources[1][0]).toBe('github.ts');+ expect(sources[1][1]).toMatchInlineSnapshot(`+ "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;+ };++ 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+ */+ 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_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;+ };++ 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;+ };++ /**+ * 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",+ },+ },+ 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",+ },+ },+ required: ["id", "message", "timestamp", "author", "url"],+ title: "CommitPayloadSchema",+ type: "object",+ },+ 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",+ },+ },+ title: "GithubFollowerConfig",+ type: "object",+ },+ payload: {+ properties: {+ username: {+ description: "Username of the github follower",+ title: "Username",+ type: "string",+ },+ },+ required: ["username"],+ title: "GithubFollowerPayload",+ type: "object",+ },+ 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",+ },+ },+ 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",+ },+ },+ required: ["action", "issue_id", "number", "title", "createdBy", "createdAt", "url"],+ title: "IssueAddedPayloadSchema",+ type: "object",+ },+ 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",+ },+ },+ 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",+ },+ },+ required: ["action", "label", "pull_request_number", "pull_request_title", "pull_request_url", "labeled_by", "labeled_at"],+ title: "LabelAddedPayloadSchema",+ type: "object",+ },+ 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",+ },+ },+ 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",+ },+ },+ required: ["action", "number", "title", "createdBy", "createdAt", "url"],+ title: "PullRequestPayloadSchema",+ type: "object",+ },+ 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",+ },+ },+ 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",+ },+ },+ required: ["action", "starred_at", "repository_id", "repository_name", "repository_url", "starred_by"],+ title: "StarAddedPayloadSchema",+ type: "object",+ },+ 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 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.*/@@ -240,9 +974,76 @@ describe('generateTypeScriptToolkitSources', () => {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"++ type GOOGLEDRIVE_GOOGLE_DRIVE_CHANGES_PAYLOAD = object;++ /**+ * Map of Composio's GOOGLEDRIVE toolkit.+ */+ export const GOOGLEDRIVE = {+ slug: "googledrive",+ tools: {+ ADD_FILE_SHARING_PREFERENCE: "GOOGLEDRIVE_ADD_FILE_SHARING_PREFERENCE",+ COPY_FILE: "GOOGLEDRIVE_COPY_FILE",+ CREATE_COMMENT: "GOOGLEDRIVE_CREATE_COMMENT",+ },+ triggerTypes: {+ GOOGLE_DRIVE_CHANGES: {+ slug: "GOOGLEDRIVE_GOOGLE_DRIVE_CHANGES",+ name: "Google Drive Changes",+ description: "Triggers when changes are detected in a Google Drive.",+ instructions: "\\n **Instructions for Setting Up the Trigger:**\\n - Ensure you have set the necessary permissions to access Google Drive.\\n ",+ config: {+ description: "Configuration for Google Drive trigger",+ properties: {},+ title: "DriveConfig",+ type: "object",+ },+ payload: {+ description: "Schema for Google Drive trigger payload.\\nCurrently no specific fields are present, but may include\\nconfiguration options in the future.",+ properties: {},+ title: "DrivePayload",+ type: "object",+ },+ type: "poll",+ },+ },+ }++ /**+ * Type map of all available trigger payloads for toolkit "GOOGLEDRIVE".+ */+ export type GOOGLEDRIVE_TRIGGER_PAYLOADS = {+ GOOGLE_DRIVE_CHANGES: GOOGLEDRIVE_GOOGLE_DRIVE_CHANGES_PAYLOAD+ }++ /**+ * Type map of all available trigger events for toolkit "GOOGLEDRIVE".+ */+ export type GOOGLEDRIVE_TRIGGER_EVENTS = {+ GOOGLE_DRIVE_CHANGES: TriggerEvent<GOOGLEDRIVE_GOOGLE_DRIVE_CHANGES_PAYLOAD>+ }+ "+ `);+ })+ );});});});diff --git a/ts/packages/cli/test/src/generation/typescript/generate.test.ts b/ts/packages/cli/test/src/generation/typescript/generate.test.tsindex c0fd59931..de5321bdb 100644--- a/ts/packages/cli/test/src/generation/typescript/generate.test.ts+++ b/ts/packages/cli/test/src/generation/typescript/generate.test.ts@@ -1,10 +1,14 @@-import { describe, expect, it } from 'vitest';+import { describe, expect, it } from '@effect/vitest';import { createToolkitIndex } from 'src/generation/create-toolkit-index';import { generateTypeScriptSources } from 'src/generation/typescript/generate';import { makeTestToolkits } from 'test/__utils__/models/toolkits';import path from 'path';import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';-import { TRIGGER_TYPE_GMAIL } from 'test/__mocks__/trigger-type-gmail';+import { TOOLS_GITHUB } from 'test/__mocks__/tools_github';+import { TRIGGER_TYPES_GITHUB } from 'test/__mocks__/trigger-types-github';+import { TRIGGER_TYPES_GMAIL } from 'test/__mocks__/trigger-types-gmail';+import { TOOLS_GMAIL } from 'test/__mocks__/tools_gmail';+import { Effect } from 'effect';describe('generateTypeScriptSources', () => {describe('with multiple emitted files', () => {@@ -20,20 +24,22 @@ describe('generateTypeScriptSources', () => {banner: 'Some banner that will appear in a comment',};- it('[Given] empty toolkits, tools, triggerTypes [Then] it returns just the index map', () => {- const index = createToolkitIndex({- toolkits: [],- tools: [],- triggerTypes: [],- });+ it.effect(+ '[Given] empty toolkits, tools, triggerTypes [Then] it returns just the index map',+ Effect.fn(function* () {+ const index = createToolkitIndex({+ toolkits: [],+ tools: [],+ triggerTypes: [],+ });- const sources = generateTypeScriptSources(params)(index);+ const sources = yield* generateTypeScriptSources(params)(index);- expect(sources).toHaveLength(1);- const [[filename, source]] = sources;+ expect(sources).toHaveLength(1);+ const [[filename, source]] = sources;- expect(filename).toBe(path.join(params.outputDir, 'index.ts'));- expect(source).toMatchInlineSnapshot(`+ expect(filename).toBe(path.join(params.outputDir, 'index.ts'));+ expect(source).toMatchInlineSnapshot(`"/*** Some banner that will appear in a comment*/@@ -60,28 +66,31 @@ describe('generateTypeScriptSources', () => {"`);- assertTypeScriptIsValid({ files: { './index.ts': source } });- });-- it('[Given] a single toolkit with no tools or triggerTypes [Then] it returns a single toolkit source file + the index map', () => {- const toolkits = makeTestToolkits([- {- name: 'Slack Helper',- slug: 'slack',- },- ]);-- const index = createToolkitIndex({- toolkits,- tools: [],- triggerTypes: [],- });-- const sources = generateTypeScriptSources(params)(index);- expect(sources).toHaveLength(2);- expect(sources[0]).toHaveLength(2);- expect(sources[0][0]).toBe(path.join(params.outputDir, 'slack.ts'));- expect(sources[0][1]).toMatchInlineSnapshot(`+ assertTypeScriptIsValid({ files: { './index.ts': source } });+ })+ );++ it.effect(+ '[Given] a single toolkit with no tools or triggerTypes [Then] it returns a single toolkit source file + the index map',+ Effect.fn(function* () {+ const toolkits = makeTestToolkits([+ {+ name: 'Slack Helper',+ slug: 'slack',+ },+ ]);++ const index = createToolkitIndex({+ toolkits,+ tools: [],+ triggerTypes: [],+ });++ const sources = yield* generateTypeScriptSources(params)(index);+ expect(sources).toHaveLength(2);+ 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.*/@@ -90,13 +99,23 @@ describe('generateTypeScriptSources', () => {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] } });+ assertTypeScriptIsValid({ files: { './slack.ts': sources[0][1] } });- expect(sources[1]).toHaveLength(2);- expect(sources[1][0]).toBe(path.join(params.outputDir, 'index.ts'));- expect(sources[1][1]).toMatchInlineSnapshot(`+ expect(sources[1]).toHaveLength(2);+ expect(sources[1][0]).toBe(path.join(params.outputDir, 'index.ts'));+ expect(sources[1][1]).toMatchInlineSnapshot(`"/*** Some banner that will appear in a comment*/@@ -128,30 +147,33 @@ describe('generateTypeScriptSources', () => {"`);- assertTypeScriptIsValid({- files: { './index.ts': sources[1][1], './slack.ts': sources[0][1] },- });- });-- it('[Given] toolkits with tools and triggerTypes [Then] it returns a TypeScript source file for each toolkit + the index map', () => {- const toolkits = makeTestToolkits([- {- name: 'Slack Helper',- slug: 'slack',- },- ]);-- const index = createToolkitIndex({- toolkits,- tools: ['GMAIL_CREATE_EMAIL_DRAFT', 'GMAIL_DELETE_MESSAGE', 'GMAIL_FETCH_EMAILS'],- triggerTypes: [TRIGGER_TYPE_GMAIL],- });-- const sources = generateTypeScriptSources(params)(index);- expect(sources).toHaveLength(2);- expect(sources[0]).toHaveLength(2);- expect(sources[0][0]).toBe(path.join(params.outputDir, './slack.ts'));- expect(sources[0][1]).toMatchInlineSnapshot(`+ assertTypeScriptIsValid({+ files: { './index.ts': sources[1][1], './slack.ts': sources[0][1] },+ });+ })+ );++ it.effect(+ '[Given] toolkits with tools and triggerTypes [Then] it returns a TypeScript source file for each toolkit + the index map',+ Effect.fn(function* () {+ const toolkits = makeTestToolkits([+ {+ name: 'Slack Helper',+ slug: 'slack',+ },+ ]);++ const index = createToolkitIndex({+ toolkits,+ tools: [...TOOLS_GMAIL.slice(0, 3), ...TOOLS_GITHUB.slice(0, 3)],+ triggerTypes: [...TRIGGER_TYPES_GMAIL, ...TRIGGER_TYPES_GITHUB],+ });++ const sources = yield* generateTypeScriptSources(params)(index);+ expect(sources).toHaveLength(2);+ 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.*/@@ -160,13 +182,23 @@ describe('generateTypeScriptSources', () => {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] } });+ assertTypeScriptIsValid({ files: { './slack.ts': sources[0][1] } });- expect(sources[1]).toHaveLength(2);- expect(sources[1][0]).toBe(path.join(params.outputDir, 'index.ts'));- expect(sources[1][1]).toMatchInlineSnapshot(`+ expect(sources[1]).toHaveLength(2);+ expect(sources[1][0]).toBe(path.join(params.outputDir, 'index.ts'));+ expect(sources[1][1]).toMatchInlineSnapshot(`"/*** Some banner that will appear in a comment*/@@ -197,8 +229,9 @@ describe('generateTypeScriptSources', () => {"`);- assertTypeScriptIsValid({ files: { './index.ts': sources[1][1] } });- });+ assertTypeScriptIsValid({ files: { './index.ts': sources[1][1] } });+ })+ );});});});diff --git a/ts/packages/ts-builders/src/TypeDeclaration.ts b/ts/packages/ts-builders/src/TypeDeclaration.tsindex 171202dc5..88fb72aae 100644--- a/ts/packages/ts-builders/src/TypeDeclaration.ts+++ b/ts/packages/ts-builders/src/TypeDeclaration.ts@@ -10,7 +10,7 @@ export class TypeDeclaration<InnerType extends TypeBuilder = TypeBuilder> implemconstructor(public name: string,- readonly type: InnerType+ private type: InnerType | string) {}addGenericParameter(param: GenericParameter): this {@@ -23,6 +23,10 @@ export class TypeDeclaration<InnerType extends TypeBuilder = TypeBuilder> implemreturn this;}+ setValue(typeDecl: string) {+ this.type = typeDecl;+ }+setDocComment(docComment: DocComment): this {this.docComment = docComment;return this;@@ -32,6 +36,12 @@ export class TypeDeclaration<InnerType extends TypeBuilder = TypeBuilder> implemif (this.docComment) {writer.write(this.docComment);}++ if (typeof this.type === 'string') {+ writer.write(this.type);+ return;+ }+writer.write('type ').write(this.name);if (this.genericParameters.length > 0) {writer.write('<').writeJoined(', ', this.genericParameters).write('>');@@ -42,7 +52,7 @@ export class TypeDeclaration<InnerType extends TypeBuilder = TypeBuilder> implemexport function typeDeclaration<InnerType extends TypeBuilder = TypeBuilder>(name: string,- type: InnerType+ type: InnerType | string) {return new TypeDeclaration(name, type);}