@composio/client 0.1.0-alpha.1 → 0.1.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/LICENSE +1 -1
  3. package/README.md +29 -29
  4. package/client.d.mts +16 -13
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +16 -13
  7. package/client.d.ts.map +1 -1
  8. package/client.js +54 -61
  9. package/client.js.map +1 -1
  10. package/client.mjs +52 -59
  11. package/client.mjs.map +1 -1
  12. package/core/api-promise.d.mts +2 -2
  13. package/core/api-promise.d.mts.map +1 -1
  14. package/core/api-promise.d.ts +2 -2
  15. package/core/api-promise.d.ts.map +1 -1
  16. package/core/api-promise.js.map +1 -1
  17. package/core/api-promise.mjs.map +1 -1
  18. package/core/error.d.mts +2 -2
  19. package/core/error.d.mts.map +1 -1
  20. package/core/error.d.ts +2 -2
  21. package/core/error.d.ts.map +1 -1
  22. package/core/error.js +4 -4
  23. package/core/error.js.map +1 -1
  24. package/core/error.mjs +2 -2
  25. package/core/error.mjs.map +1 -1
  26. package/core/resource.d.mts +3 -3
  27. package/core/resource.d.mts.map +1 -1
  28. package/core/resource.d.ts +3 -3
  29. package/core/resource.d.ts.map +1 -1
  30. package/core/resource.js.map +1 -1
  31. package/core/resource.mjs.map +1 -1
  32. package/index.d.mts +3 -3
  33. package/index.d.mts.map +1 -1
  34. package/index.d.ts +3 -3
  35. package/index.d.ts.map +1 -1
  36. package/index.js +4 -4
  37. package/index.js.map +1 -1
  38. package/index.mjs +3 -3
  39. package/index.mjs.map +1 -1
  40. package/internal/parse.d.mts +2 -2
  41. package/internal/parse.d.mts.map +1 -1
  42. package/internal/parse.d.ts +2 -2
  43. package/internal/parse.d.ts.map +1 -1
  44. package/internal/parse.js.map +1 -1
  45. package/internal/parse.mjs.map +1 -1
  46. package/internal/qs/formats.d.mts +6 -0
  47. package/internal/qs/formats.d.mts.map +1 -0
  48. package/internal/qs/formats.d.ts +6 -0
  49. package/internal/qs/formats.d.ts.map +1 -0
  50. package/internal/qs/formats.js +11 -0
  51. package/internal/qs/formats.js.map +1 -0
  52. package/internal/qs/formats.mjs +8 -0
  53. package/internal/qs/formats.mjs.map +1 -0
  54. package/internal/qs/index.d.mts +10 -0
  55. package/internal/qs/index.d.mts.map +1 -0
  56. package/internal/qs/index.d.ts +10 -0
  57. package/internal/qs/index.d.ts.map +1 -0
  58. package/internal/qs/index.js +14 -0
  59. package/internal/qs/index.js.map +1 -0
  60. package/internal/qs/index.mjs +10 -0
  61. package/internal/qs/index.mjs.map +1 -0
  62. package/internal/qs/stringify.d.mts +3 -0
  63. package/internal/qs/stringify.d.mts.map +1 -0
  64. package/internal/qs/stringify.d.ts +3 -0
  65. package/internal/qs/stringify.d.ts.map +1 -0
  66. package/internal/qs/stringify.js +280 -0
  67. package/internal/qs/stringify.js.map +1 -0
  68. package/internal/qs/stringify.mjs +276 -0
  69. package/internal/qs/stringify.mjs.map +1 -0
  70. package/internal/qs/types.d.mts +57 -0
  71. package/internal/qs/types.d.mts.map +1 -0
  72. package/internal/qs/types.d.ts +57 -0
  73. package/internal/qs/types.d.ts.map +1 -0
  74. package/internal/qs/types.js +3 -0
  75. package/internal/qs/types.js.map +1 -0
  76. package/internal/qs/types.mjs +2 -0
  77. package/internal/qs/types.mjs.map +1 -0
  78. package/internal/qs/utils.d.mts +14 -0
  79. package/internal/qs/utils.d.mts.map +1 -0
  80. package/internal/qs/utils.d.ts +14 -0
  81. package/internal/qs/utils.d.ts.map +1 -0
  82. package/internal/qs/utils.js +229 -0
  83. package/internal/qs/utils.js.map +1 -0
  84. package/internal/qs/utils.mjs +217 -0
  85. package/internal/qs/utils.mjs.map +1 -0
  86. package/internal/shims/getBuiltinModule.d.mts.map +1 -1
  87. package/internal/shims/getBuiltinModule.d.ts.map +1 -1
  88. package/internal/shims/getBuiltinModule.js +5 -2
  89. package/internal/shims/getBuiltinModule.js.map +1 -1
  90. package/internal/shims/getBuiltinModule.mjs +5 -2
  91. package/internal/shims/getBuiltinModule.mjs.map +1 -1
  92. package/internal/shims.js +1 -1
  93. package/internal/shims.js.map +1 -1
  94. package/internal/shims.mjs +1 -1
  95. package/internal/shims.mjs.map +1 -1
  96. package/internal/uploads.d.mts +4 -4
  97. package/internal/uploads.d.mts.map +1 -1
  98. package/internal/uploads.d.ts +4 -4
  99. package/internal/uploads.d.ts.map +1 -1
  100. package/internal/uploads.js.map +1 -1
  101. package/internal/uploads.mjs.map +1 -1
  102. package/internal/utils/base64.js +2 -2
  103. package/internal/utils/base64.js.map +1 -1
  104. package/internal/utils/base64.mjs +3 -3
  105. package/internal/utils/base64.mjs.map +1 -1
  106. package/internal/utils/log.d.mts +3 -3
  107. package/internal/utils/log.d.mts.map +1 -1
  108. package/internal/utils/log.d.ts +3 -3
  109. package/internal/utils/log.d.ts.map +1 -1
  110. package/internal/utils/log.js.map +1 -1
  111. package/internal/utils/log.mjs.map +1 -1
  112. package/internal/utils/path.d.mts.map +1 -1
  113. package/internal/utils/path.d.ts.map +1 -1
  114. package/internal/utils/path.js +1 -1
  115. package/internal/utils/path.js.map +1 -1
  116. package/internal/utils/path.mjs +2 -2
  117. package/internal/utils/path.mjs.map +1 -1
  118. package/internal/utils/values.js +5 -5
  119. package/internal/utils/values.js.map +1 -1
  120. package/internal/utils/values.mjs +6 -6
  121. package/internal/utils/values.mjs.map +1 -1
  122. package/package.json +4 -4
  123. package/resources/action-execution.d.mts +1 -1
  124. package/resources/action-execution.d.mts.map +1 -1
  125. package/resources/action-execution.d.ts +1 -1
  126. package/resources/action-execution.d.ts.map +1 -1
  127. package/resources/cli.d.mts +124 -0
  128. package/resources/cli.d.mts.map +1 -0
  129. package/resources/cli.d.ts +124 -0
  130. package/resources/cli.d.ts.map +1 -0
  131. package/resources/cli.js +18 -0
  132. package/resources/cli.js.map +1 -0
  133. package/resources/cli.mjs +14 -0
  134. package/resources/cli.mjs.map +1 -0
  135. package/resources/index.d.mts +2 -0
  136. package/resources/index.d.mts.map +1 -1
  137. package/resources/index.d.ts +2 -0
  138. package/resources/index.d.ts.map +1 -1
  139. package/resources/index.js +5 -1
  140. package/resources/index.js.map +1 -1
  141. package/resources/index.mjs +2 -0
  142. package/resources/index.mjs.map +1 -1
  143. package/resources/mcp/command.d.mts +34 -0
  144. package/resources/mcp/command.d.mts.map +1 -0
  145. package/resources/mcp/command.d.ts +34 -0
  146. package/resources/mcp/command.d.ts.map +1 -0
  147. package/resources/mcp/command.js +12 -0
  148. package/resources/mcp/command.js.map +1 -0
  149. package/resources/mcp/command.mjs +8 -0
  150. package/resources/mcp/command.mjs.map +1 -0
  151. package/resources/mcp/index.d.mts +3 -0
  152. package/resources/mcp/index.d.mts.map +1 -0
  153. package/resources/mcp/index.d.ts +3 -0
  154. package/resources/mcp/index.d.ts.map +1 -0
  155. package/resources/mcp/index.js +9 -0
  156. package/resources/mcp/index.js.map +1 -0
  157. package/resources/mcp/index.mjs +4 -0
  158. package/resources/mcp/index.mjs.map +1 -0
  159. package/resources/mcp/mcp.d.mts +378 -0
  160. package/resources/mcp/mcp.d.mts.map +1 -0
  161. package/resources/mcp/mcp.d.ts +378 -0
  162. package/resources/mcp/mcp.d.ts.map +1 -0
  163. package/resources/mcp/mcp.js +66 -0
  164. package/resources/mcp/mcp.js.map +1 -0
  165. package/resources/mcp/mcp.mjs +39 -0
  166. package/resources/mcp/mcp.mjs.map +1 -0
  167. package/resources/mcp.d.mts +2 -0
  168. package/resources/mcp.d.mts.map +1 -0
  169. package/resources/mcp.d.ts +2 -0
  170. package/resources/mcp.d.ts.map +1 -0
  171. package/resources/mcp.js +19 -0
  172. package/resources/mcp.js.map +1 -0
  173. package/resources/mcp.mjs +3 -0
  174. package/resources/mcp.mjs.map +1 -0
  175. package/src/client.ts +82 -47
  176. package/src/core/api-promise.ts +4 -4
  177. package/src/core/error.ts +2 -2
  178. package/src/core/resource.ts +3 -3
  179. package/src/index.ts +3 -3
  180. package/src/internal/parse.ts +2 -2
  181. package/src/internal/qs/LICENSE.md +13 -0
  182. package/src/internal/qs/README.md +3 -0
  183. package/src/internal/qs/formats.ts +9 -0
  184. package/src/internal/qs/index.ts +13 -0
  185. package/src/internal/qs/stringify.ts +388 -0
  186. package/src/internal/qs/types.ts +71 -0
  187. package/src/internal/qs/utils.ts +265 -0
  188. package/src/internal/shims/getBuiltinModule.ts +4 -2
  189. package/src/internal/shims.ts +1 -1
  190. package/src/internal/uploads.ts +5 -5
  191. package/src/internal/utils/base64.ts +3 -3
  192. package/src/internal/utils/log.ts +3 -3
  193. package/src/internal/utils/path.ts +2 -4
  194. package/src/internal/utils/values.ts +6 -6
  195. package/src/resources/action-execution.ts +1 -1
  196. package/src/resources/cli.ts +166 -0
  197. package/src/resources/index.ts +22 -0
  198. package/src/resources/mcp/command.ts +47 -0
  199. package/src/resources/mcp/index.ts +17 -0
  200. package/src/resources/mcp/mcp.ts +519 -0
  201. package/src/resources/mcp.ts +3 -0
  202. package/src/version.ts +1 -1
  203. package/version.d.mts +1 -1
  204. package/version.d.ts +1 -1
  205. package/version.js +1 -1
  206. package/version.mjs +1 -1
@@ -0,0 +1,265 @@
1
+ import { RFC1738 } from './formats';
2
+ import type { DefaultEncoder, Format } from './types';
3
+
4
+ const has = Object.prototype.hasOwnProperty;
5
+ const is_array = Array.isArray;
6
+
7
+ const hex_table = (() => {
8
+ const array = [];
9
+ for (let i = 0; i < 256; ++i) {
10
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
11
+ }
12
+
13
+ return array;
14
+ })();
15
+
16
+ function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
17
+ while (queue.length > 1) {
18
+ const item = queue.pop();
19
+ if (!item) continue;
20
+
21
+ const obj = item.obj[item.prop];
22
+
23
+ if (is_array(obj)) {
24
+ const compacted: unknown[] = [];
25
+
26
+ for (let j = 0; j < obj.length; ++j) {
27
+ if (typeof obj[j] !== 'undefined') {
28
+ compacted.push(obj[j]);
29
+ }
30
+ }
31
+
32
+ // @ts-ignore
33
+ item.obj[item.prop] = compacted;
34
+ }
35
+ }
36
+ }
37
+
38
+ function array_to_object(source: any[], options: { plainObjects: boolean }) {
39
+ const obj = options && options.plainObjects ? Object.create(null) : {};
40
+ for (let i = 0; i < source.length; ++i) {
41
+ if (typeof source[i] !== 'undefined') {
42
+ obj[i] = source[i];
43
+ }
44
+ }
45
+
46
+ return obj;
47
+ }
48
+
49
+ export function merge(
50
+ target: any,
51
+ source: any,
52
+ options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
53
+ ) {
54
+ if (!source) {
55
+ return target;
56
+ }
57
+
58
+ if (typeof source !== 'object') {
59
+ if (is_array(target)) {
60
+ target.push(source);
61
+ } else if (target && typeof target === 'object') {
62
+ if (
63
+ (options && (options.plainObjects || options.allowPrototypes)) ||
64
+ !has.call(Object.prototype, source)
65
+ ) {
66
+ target[source] = true;
67
+ }
68
+ } else {
69
+ return [target, source];
70
+ }
71
+
72
+ return target;
73
+ }
74
+
75
+ if (!target || typeof target !== 'object') {
76
+ return [target].concat(source);
77
+ }
78
+
79
+ let mergeTarget = target;
80
+ if (is_array(target) && !is_array(source)) {
81
+ // @ts-ignore
82
+ mergeTarget = array_to_object(target, options);
83
+ }
84
+
85
+ if (is_array(target) && is_array(source)) {
86
+ source.forEach(function (item, i) {
87
+ if (has.call(target, i)) {
88
+ const targetItem = target[i];
89
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
+ target[i] = merge(targetItem, item, options);
91
+ } else {
92
+ target.push(item);
93
+ }
94
+ } else {
95
+ target[i] = item;
96
+ }
97
+ });
98
+ return target;
99
+ }
100
+
101
+ return Object.keys(source).reduce(function (acc, key) {
102
+ const value = source[key];
103
+
104
+ if (has.call(acc, key)) {
105
+ acc[key] = merge(acc[key], value, options);
106
+ } else {
107
+ acc[key] = value;
108
+ }
109
+ return acc;
110
+ }, mergeTarget);
111
+ }
112
+
113
+ export function assign_single_source(target: any, source: any) {
114
+ return Object.keys(source).reduce(function (acc, key) {
115
+ acc[key] = source[key];
116
+ return acc;
117
+ }, target);
118
+ }
119
+
120
+ export function decode(str: string, _: any, charset: string) {
121
+ const strWithoutPlus = str.replace(/\+/g, ' ');
122
+ if (charset === 'iso-8859-1') {
123
+ // unescape never throws, no try...catch needed:
124
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
125
+ }
126
+ // utf-8
127
+ try {
128
+ return decodeURIComponent(strWithoutPlus);
129
+ } catch (e) {
130
+ return strWithoutPlus;
131
+ }
132
+ }
133
+
134
+ const limit = 1024;
135
+
136
+ export const encode: (
137
+ str: any,
138
+ defaultEncoder: DefaultEncoder,
139
+ charset: string,
140
+ type: 'key' | 'value',
141
+ format: Format,
142
+ ) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
143
+ // This code was originally written by Brian White for the io.js core querystring library.
144
+ // It has been adapted here for stricter adherence to RFC 3986
145
+ if (str.length === 0) {
146
+ return str;
147
+ }
148
+
149
+ let string = str;
150
+ if (typeof str === 'symbol') {
151
+ string = Symbol.prototype.toString.call(str);
152
+ } else if (typeof str !== 'string') {
153
+ string = String(str);
154
+ }
155
+
156
+ if (charset === 'iso-8859-1') {
157
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
158
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
159
+ });
160
+ }
161
+
162
+ let out = '';
163
+ for (let j = 0; j < string.length; j += limit) {
164
+ const segment = string.length >= limit ? string.slice(j, j + limit) : string;
165
+ const arr = [];
166
+
167
+ for (let i = 0; i < segment.length; ++i) {
168
+ let c = segment.charCodeAt(i);
169
+ if (
170
+ c === 0x2d || // -
171
+ c === 0x2e || // .
172
+ c === 0x5f || // _
173
+ c === 0x7e || // ~
174
+ (c >= 0x30 && c <= 0x39) || // 0-9
175
+ (c >= 0x41 && c <= 0x5a) || // a-z
176
+ (c >= 0x61 && c <= 0x7a) || // A-Z
177
+ (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
178
+ ) {
179
+ arr[arr.length] = segment.charAt(i);
180
+ continue;
181
+ }
182
+
183
+ if (c < 0x80) {
184
+ arr[arr.length] = hex_table[c];
185
+ continue;
186
+ }
187
+
188
+ if (c < 0x800) {
189
+ arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
190
+ continue;
191
+ }
192
+
193
+ if (c < 0xd800 || c >= 0xe000) {
194
+ arr[arr.length] =
195
+ hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
196
+ continue;
197
+ }
198
+
199
+ i += 1;
200
+ c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
201
+
202
+ arr[arr.length] =
203
+ hex_table[0xf0 | (c >> 18)]! +
204
+ hex_table[0x80 | ((c >> 12) & 0x3f)] +
205
+ hex_table[0x80 | ((c >> 6) & 0x3f)] +
206
+ hex_table[0x80 | (c & 0x3f)];
207
+ }
208
+
209
+ out += arr.join('');
210
+ }
211
+
212
+ return out;
213
+ };
214
+
215
+ export function compact(value: any) {
216
+ const queue = [{ obj: { o: value }, prop: 'o' }];
217
+ const refs = [];
218
+
219
+ for (let i = 0; i < queue.length; ++i) {
220
+ const item = queue[i];
221
+ // @ts-ignore
222
+ const obj = item.obj[item.prop];
223
+
224
+ const keys = Object.keys(obj);
225
+ for (let j = 0; j < keys.length; ++j) {
226
+ const key = keys[j]!;
227
+ const val = obj[key];
228
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
229
+ queue.push({ obj: obj, prop: key });
230
+ refs.push(val);
231
+ }
232
+ }
233
+ }
234
+
235
+ compact_queue(queue);
236
+
237
+ return value;
238
+ }
239
+
240
+ export function is_regexp(obj: any) {
241
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
242
+ }
243
+
244
+ export function is_buffer(obj: any) {
245
+ if (!obj || typeof obj !== 'object') {
246
+ return false;
247
+ }
248
+
249
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
250
+ }
251
+
252
+ export function combine(a: any, b: any) {
253
+ return [].concat(a, b);
254
+ }
255
+
256
+ export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
+ if (is_array(val)) {
258
+ const mapped = [];
259
+ for (let i = 0; i < val.length; i += 1) {
260
+ mapped.push(fn(val[i]!));
261
+ }
262
+ return mapped;
263
+ }
264
+ return fn(val);
265
+ }
@@ -29,11 +29,13 @@ export let getBuiltinModule: null | ((id: string) => object | undefined) = funct
29
29
  }
30
30
  const magicKey = Math.random() + '';
31
31
  let module: { BuiltinModule: any } | undefined;
32
+ let ObjectPrototype: {} = Blob;
33
+ for (let next; (next = Reflect.getPrototypeOf(ObjectPrototype)); ObjectPrototype = next);
32
34
  try {
33
35
  const kClone = Object.getOwnPropertySymbols(Blob.prototype).find(
34
36
  (e) => e.description?.includes('clone'),
35
37
  )!;
36
- Object.defineProperty(Object.prototype, magicKey, {
38
+ Object.defineProperty(ObjectPrototype, magicKey, {
37
39
  get() {
38
40
  module = this;
39
41
  throw null;
@@ -50,7 +52,7 @@ export let getBuiltinModule: null | ((id: string) => object | undefined) = funct
50
52
  })([]),
51
53
  );
52
54
  } catch {}
53
- delete (Object.prototype as any)[magicKey];
55
+ delete (ObjectPrototype as any)[magicKey];
54
56
  if (module) {
55
57
  getBuiltinModule = createFallbackGetBuiltinModule(module.BuiltinModule);
56
58
  } else {
@@ -16,7 +16,7 @@ export function getDefaultFetch(): Fetch {
16
16
  }
17
17
 
18
18
  throw new Error(
19
- '`fetch` is not defined as a global; Either pass `fetch` to the client, `new ComposioSDK({ fetch })` or polyfill the global, `globalThis.fetch = fetch`',
19
+ '`fetch` is not defined as a global; Either pass `fetch` to the client, `new Composio({ fetch })` or polyfill the global, `globalThis.fetch = fetch`',
20
20
  );
21
21
  }
22
22
 
@@ -1,6 +1,6 @@
1
1
  import { type RequestOptions } from './request-options';
2
2
  import type { FilePropertyBag, Fetch } from './builtin-types';
3
- import type { ComposioSDK } from '../client';
3
+ import type { Composio } from '../client';
4
4
  import { type File, getFile } from './shims/file';
5
5
  import { ReadableStreamFrom } from './shims';
6
6
 
@@ -61,7 +61,7 @@ export const isAsyncIterable = (value: any): value is AsyncIterable<any> =>
61
61
  */
62
62
  export const maybeMultipartFormRequestOptions = async (
63
63
  opts: RequestOptions,
64
- fetch: ComposioSDK | Fetch,
64
+ fetch: Composio | Fetch,
65
65
  ): Promise<RequestOptions> => {
66
66
  if (!hasUploadableValue(opts.body)) return opts;
67
67
 
@@ -72,7 +72,7 @@ type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & { body: unknow
72
72
 
73
73
  export const multipartFormRequestOptions = async (
74
74
  opts: MultipartFormRequestOptions,
75
- fetch: ComposioSDK | Fetch,
75
+ fetch: Composio | Fetch,
76
76
  ): Promise<RequestOptions> => {
77
77
  return { ...opts, body: await createForm(opts.body, fetch) };
78
78
  };
@@ -85,7 +85,7 @@ const supportsFormDataMap = new WeakMap<Fetch, Promise<boolean>>();
85
85
  * This function detects if the fetch function provided supports the global FormData object to avoid
86
86
  * confusing error messages later on.
87
87
  */
88
- function supportsFormData(fetchObject: ComposioSDK | Fetch): Promise<boolean> {
88
+ function supportsFormData(fetchObject: Composio | Fetch): Promise<boolean> {
89
89
  const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch;
90
90
  const cached = supportsFormDataMap.get(fetch);
91
91
  if (cached) return cached;
@@ -111,7 +111,7 @@ function supportsFormData(fetchObject: ComposioSDK | Fetch): Promise<boolean> {
111
111
 
112
112
  export const createForm = async <T = Record<string, unknown>>(
113
113
  body: T | undefined,
114
- fetch: ComposioSDK | Fetch,
114
+ fetch: Composio | Fetch,
115
115
  ): Promise<FormData> => {
116
116
  if (!(await supportsFormData(fetch))) {
117
117
  throw new TypeError(
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { ComposioSDKError } from '../../core/error';
3
+ import { ComposioError } from '../../core/error';
4
4
 
5
5
  export const toBase64 = (data: string | Uint8Array | null | undefined): string => {
6
6
  if (!data) return '';
@@ -17,7 +17,7 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string =
17
17
  return btoa(String.fromCharCode.apply(null, data as any));
18
18
  }
19
19
 
20
- throw new ComposioSDKError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
20
+ throw new ComposioError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
21
21
  };
22
22
 
23
23
  export const fromBase64 = (str: string): Uint8Array => {
@@ -33,5 +33,5 @@ export const fromBase64 = (str: string): Uint8Array => {
33
33
  );
34
34
  }
35
35
 
36
- throw new ComposioSDKError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
36
+ throw new ComposioError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
37
37
  };
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { hasOwn } from './values';
4
- import { type ComposioSDK } from '../../client';
4
+ import { type Composio } from '../../client';
5
5
  import { RequestOptions } from '../request-options';
6
6
 
7
7
  type LogFn = (message: string, ...rest: unknown[]) => void;
@@ -24,7 +24,7 @@ const levelNumbers = {
24
24
  export const parseLogLevel = (
25
25
  maybeLevel: string | undefined,
26
26
  sourceName: string,
27
- client: ComposioSDK,
27
+ client: Composio,
28
28
  ): LogLevel | undefined => {
29
29
  if (!maybeLevel) {
30
30
  return undefined;
@@ -60,7 +60,7 @@ const noopLogger = {
60
60
 
61
61
  let cachedLoggers = new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
- export function loggerFor(client: ComposioSDK): Logger {
63
+ export function loggerFor(client: Composio): Logger {
64
64
  const logger = client.logger;
65
65
  const logLevel = client.logLevel ?? 'off';
66
66
  if (!logger) {
@@ -1,4 +1,4 @@
1
- import { ComposioSDKError } from '../../core/error';
1
+ import { ComposioError } from '../../core/error';
2
2
 
3
3
  /**
4
4
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
@@ -51,9 +51,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
51
51
  return acc + spaces + arrows;
52
52
  }, '');
53
53
 
54
- throw new ComposioSDKError(
55
- `Path parameters result in path with invalid segments:\n${path}\n${underline}`,
56
- );
54
+ throw new ComposioError(`Path parameters result in path with invalid segments:\n${path}\n${underline}`);
57
55
  }
58
56
 
59
57
  return path;
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { ComposioSDKError } from '../../core/error';
3
+ import { ComposioError } from '../../core/error';
4
4
 
5
5
  // https://url.spec.whatwg.org/#url-scheme-string
6
6
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
@@ -36,7 +36,7 @@ export function isObj(obj: unknown): obj is Record<string, unknown> {
36
36
 
37
37
  export const ensurePresent = <T>(value: T | null | undefined): T => {
38
38
  if (value == null) {
39
- throw new ComposioSDKError(`Expected a value to be given but received ${value} instead.`);
39
+ throw new ComposioError(`Expected a value to be given but received ${value} instead.`);
40
40
  }
41
41
 
42
42
  return value;
@@ -44,10 +44,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
44
44
 
45
45
  export const validatePositiveInteger = (name: string, n: unknown): number => {
46
46
  if (typeof n !== 'number' || !Number.isInteger(n)) {
47
- throw new ComposioSDKError(`${name} must be an integer`);
47
+ throw new ComposioError(`${name} must be an integer`);
48
48
  }
49
49
  if (n < 0) {
50
- throw new ComposioSDKError(`${name} must be a positive integer`);
50
+ throw new ComposioError(`${name} must be a positive integer`);
51
51
  }
52
52
  return n;
53
53
  };
@@ -56,14 +56,14 @@ export const coerceInteger = (value: unknown): number => {
56
56
  if (typeof value === 'number') return Math.round(value);
57
57
  if (typeof value === 'string') return parseInt(value, 10);
58
58
 
59
- throw new ComposioSDKError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
59
+ throw new ComposioError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
60
60
  };
61
61
 
62
62
  export const coerceFloat = (value: unknown): number => {
63
63
  if (typeof value === 'number') return value;
64
64
  if (typeof value === 'string') return parseFloat(value);
65
65
 
66
- throw new ComposioSDKError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
66
+ throw new ComposioError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
67
67
  };
68
68
 
69
69
  export const coerceBoolean = (value: unknown): boolean => {
@@ -139,7 +139,7 @@ export namespace ActionExecutionRetrieveLogResponse {
139
139
 
140
140
  startTime: number;
141
141
 
142
- status: 'success' | 'error';
142
+ status: 'success' | 'failure' | 'error';
143
143
 
144
144
  totalDuration: number;
145
145
 
@@ -0,0 +1,166 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Cli extends APIResource {
8
+ createSession(options?: RequestOptions): APIPromise<CliCreateSessionResponse> {
9
+ return this._client.post('/api/v3/cli/create-session', options);
10
+ }
11
+
12
+ linkSession(body: CliLinkSessionParams, options?: RequestOptions): APIPromise<CliLinkSessionResponse> {
13
+ return this._client.put('/api/v3/cli/link-session', { body, ...options });
14
+ }
15
+
16
+ retrieveSession(
17
+ query: CliRetrieveSessionParams,
18
+ options?: RequestOptions,
19
+ ): APIPromise<CliRetrieveSessionResponse> {
20
+ return this._client.get('/api/v3/cli/get-session', { query, ...options });
21
+ }
22
+ }
23
+
24
+ export interface CliCreateSessionResponse {
25
+ /**
26
+ * Unique identifier for the CLI session
27
+ */
28
+ id: string;
29
+
30
+ /**
31
+ * Temporary code to use for CLI login
32
+ */
33
+ code: string;
34
+
35
+ /**
36
+ * Expiration time of the session
37
+ */
38
+ expiresAt: string;
39
+
40
+ /**
41
+ * Current status of the session
42
+ */
43
+ status: 'pending' | 'linked';
44
+ }
45
+
46
+ export interface CliLinkSessionResponse {
47
+ /**
48
+ * Unique identifier for the CLI session
49
+ */
50
+ id: string;
51
+
52
+ /**
53
+ * Information about the linked account
54
+ */
55
+ account: CliLinkSessionResponse.Account;
56
+
57
+ /**
58
+ * Temporary code used for CLI login
59
+ */
60
+ code: string;
61
+
62
+ /**
63
+ * Expiration time of the session
64
+ */
65
+ expiresAt: string;
66
+
67
+ /**
68
+ * Current status of the session
69
+ */
70
+ status: 'pending' | 'linked';
71
+ }
72
+
73
+ export namespace CliLinkSessionResponse {
74
+ /**
75
+ * Information about the linked account
76
+ */
77
+ export interface Account {
78
+ /**
79
+ * ID of the linked account
80
+ */
81
+ id: string;
82
+
83
+ /**
84
+ * Email of the linked account
85
+ */
86
+ email: string;
87
+
88
+ /**
89
+ * Name of the linked account
90
+ */
91
+ name: string;
92
+ }
93
+ }
94
+
95
+ export interface CliRetrieveSessionResponse {
96
+ /**
97
+ * Unique identifier for the CLI session
98
+ */
99
+ id: string;
100
+
101
+ /**
102
+ * Information about the linked account, if any
103
+ */
104
+ account: CliRetrieveSessionResponse.Account | null;
105
+
106
+ /**
107
+ * Temporary code used for CLI login
108
+ */
109
+ code: string;
110
+
111
+ /**
112
+ * Expiration time of the session
113
+ */
114
+ expiresAt: string;
115
+
116
+ /**
117
+ * Current status of the session
118
+ */
119
+ status: 'pending' | 'linked';
120
+ }
121
+
122
+ export namespace CliRetrieveSessionResponse {
123
+ /**
124
+ * Information about the linked account, if any
125
+ */
126
+ export interface Account {
127
+ /**
128
+ * ID of the linked account
129
+ */
130
+ id: string;
131
+
132
+ /**
133
+ * Email of the linked account
134
+ */
135
+ email: string;
136
+
137
+ /**
138
+ * Name of the linked account
139
+ */
140
+ name: string;
141
+ }
142
+ }
143
+
144
+ export interface CliLinkSessionParams {
145
+ /**
146
+ * CLI session ID or code to link
147
+ */
148
+ id: string;
149
+ }
150
+
151
+ export interface CliRetrieveSessionParams {
152
+ /**
153
+ * CLI session ID or code to check
154
+ */
155
+ id: string;
156
+ }
157
+
158
+ export declare namespace Cli {
159
+ export {
160
+ type CliCreateSessionResponse as CliCreateSessionResponse,
161
+ type CliLinkSessionResponse as CliLinkSessionResponse,
162
+ type CliRetrieveSessionResponse as CliRetrieveSessionResponse,
163
+ type CliLinkSessionParams as CliLinkSessionParams,
164
+ type CliRetrieveSessionParams as CliRetrieveSessionParams,
165
+ };
166
+ }
@@ -20,6 +20,14 @@ export {
20
20
  type AuthConfigListParams,
21
21
  type AuthConfigUpdateStatusParams,
22
22
  } from './auth-configs';
23
+ export {
24
+ Cli,
25
+ type CliCreateSessionResponse,
26
+ type CliLinkSessionResponse,
27
+ type CliRetrieveSessionResponse,
28
+ type CliLinkSessionParams,
29
+ type CliRetrieveSessionParams,
30
+ } from './cli';
23
31
  export {
24
32
  ConnectedAccounts,
25
33
  type ConnectedAccountCreateResponse,
@@ -32,6 +40,20 @@ export {
32
40
  type ConnectedAccountListParams,
33
41
  type ConnectedAccountUpdateStatusParams,
34
42
  } from './connected-accounts';
43
+ export {
44
+ Mcp,
45
+ type McpCreateResponse,
46
+ type McpRetrieveResponse,
47
+ type McpUpdateResponse,
48
+ type McpListResponse,
49
+ type McpDeleteResponse,
50
+ type McpRetrieveAppResponse,
51
+ type McpValidateResponse,
52
+ type McpCreateParams,
53
+ type McpUpdateParams,
54
+ type McpListParams,
55
+ type McpValidateParams,
56
+ } from './mcp/mcp';
35
57
  export { Org } from './org/org';
36
58
  export {
37
59
  TeamMembers,