@composio/client 0.1.0-alpha.22 → 0.1.0-alpha.24

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 (144) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +3 -4
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js +22 -19
  8. package/client.js.map +1 -1
  9. package/client.mjs +11 -8
  10. package/client.mjs.map +1 -1
  11. package/core/resource.d.mts +1 -1
  12. package/core/resource.d.mts.map +1 -1
  13. package/core/resource.d.ts +1 -1
  14. package/core/resource.d.ts.map +1 -1
  15. package/core/resource.js.map +1 -1
  16. package/core/resource.mjs.map +1 -1
  17. package/internal/headers.d.mts.map +1 -1
  18. package/internal/headers.d.ts.map +1 -1
  19. package/internal/headers.js +4 -4
  20. package/internal/headers.js.map +1 -1
  21. package/internal/headers.mjs +4 -4
  22. package/internal/headers.mjs.map +1 -1
  23. package/internal/qs/formats.d.mts +1 -0
  24. package/internal/qs/formats.d.mts.map +1 -1
  25. package/internal/qs/formats.d.ts +1 -0
  26. package/internal/qs/formats.d.ts.map +1 -1
  27. package/internal/qs/formats.js +4 -2
  28. package/internal/qs/formats.js.map +1 -1
  29. package/internal/qs/formats.mjs +2 -1
  30. package/internal/qs/formats.mjs.map +1 -1
  31. package/internal/qs/stringify.d.mts.map +1 -1
  32. package/internal/qs/stringify.d.ts.map +1 -1
  33. package/internal/qs/stringify.js +15 -17
  34. package/internal/qs/stringify.js.map +1 -1
  35. package/internal/qs/stringify.mjs +17 -19
  36. package/internal/qs/stringify.mjs.map +1 -1
  37. package/internal/qs/utils.d.mts +1 -0
  38. package/internal/qs/utils.d.mts.map +1 -1
  39. package/internal/qs/utils.d.ts +1 -0
  40. package/internal/qs/utils.d.ts.map +1 -1
  41. package/internal/qs/utils.js +14 -13
  42. package/internal/qs/utils.js.map +1 -1
  43. package/internal/qs/utils.mjs +12 -12
  44. package/internal/qs/utils.mjs.map +1 -1
  45. package/internal/request-options.d.mts +1 -0
  46. package/internal/request-options.d.mts.map +1 -1
  47. package/internal/request-options.d.ts +1 -0
  48. package/internal/request-options.d.ts.map +1 -1
  49. package/internal/request-options.js.map +1 -1
  50. package/internal/request-options.mjs.map +1 -1
  51. package/internal/uploads.js +1 -1
  52. package/internal/uploads.js.map +1 -1
  53. package/internal/uploads.mjs +1 -1
  54. package/internal/uploads.mjs.map +1 -1
  55. package/internal/utils/log.js +1 -1
  56. package/internal/utils/log.js.map +1 -1
  57. package/internal/utils/log.mjs +1 -1
  58. package/internal/utils/log.mjs.map +1 -1
  59. package/internal/utils/path.d.mts.map +1 -1
  60. package/internal/utils/path.d.ts.map +1 -1
  61. package/internal/utils/path.js.map +1 -1
  62. package/internal/utils/path.mjs +1 -1
  63. package/internal/utils/path.mjs.map +1 -1
  64. package/internal/utils/values.d.mts +2 -0
  65. package/internal/utils/values.d.mts.map +1 -1
  66. package/internal/utils/values.d.ts +2 -0
  67. package/internal/utils/values.d.ts.map +1 -1
  68. package/internal/utils/values.js +4 -1
  69. package/internal/utils/values.js.map +1 -1
  70. package/internal/utils/values.mjs +2 -0
  71. package/internal/utils/values.mjs.map +1 -1
  72. package/package.json +1 -1
  73. package/resources/auth-configs.d.mts +3 -3
  74. package/resources/auth-configs.d.mts.map +1 -1
  75. package/resources/auth-configs.d.ts +3 -3
  76. package/resources/auth-configs.d.ts.map +1 -1
  77. package/resources/connected-accounts.d.mts +640 -1908
  78. package/resources/connected-accounts.d.mts.map +1 -1
  79. package/resources/connected-accounts.d.ts +640 -1908
  80. package/resources/connected-accounts.d.ts.map +1 -1
  81. package/resources/mcp/custom.d.mts +2 -2
  82. package/resources/mcp/custom.d.ts +2 -2
  83. package/resources/mcp/mcp.d.mts +4 -4
  84. package/resources/mcp/mcp.d.ts +4 -4
  85. package/resources/tools.d.mts +12 -0
  86. package/resources/tools.d.mts.map +1 -1
  87. package/resources/tools.d.ts +12 -0
  88. package/resources/tools.d.ts.map +1 -1
  89. package/resources/triggers-types.d.mts +2 -2
  90. package/resources/triggers-types.d.ts +2 -2
  91. package/resources/v3/index.d.mts +0 -1
  92. package/resources/v3/index.d.mts.map +1 -1
  93. package/resources/v3/index.d.ts +0 -1
  94. package/resources/v3/index.d.ts.map +1 -1
  95. package/resources/v3/index.js +1 -3
  96. package/resources/v3/index.js.map +1 -1
  97. package/resources/v3/index.mjs +0 -1
  98. package/resources/v3/index.mjs.map +1 -1
  99. package/resources/v3/internal/action-execution.d.mts +1 -1
  100. package/resources/v3/internal/action-execution.d.mts.map +1 -1
  101. package/resources/v3/internal/action-execution.d.ts +1 -1
  102. package/resources/v3/internal/action-execution.d.ts.map +1 -1
  103. package/resources/v3/v3.d.mts +0 -4
  104. package/resources/v3/v3.d.mts.map +1 -1
  105. package/resources/v3/v3.d.ts +0 -4
  106. package/resources/v3/v3.d.ts.map +1 -1
  107. package/resources/v3/v3.js +0 -4
  108. package/resources/v3/v3.js.map +1 -1
  109. package/resources/v3/v3.mjs +0 -4
  110. package/resources/v3/v3.mjs.map +1 -1
  111. package/src/client.ts +23 -6
  112. package/src/core/resource.ts +1 -1
  113. package/src/internal/headers.ts +5 -5
  114. package/src/internal/qs/formats.ts +2 -1
  115. package/src/internal/qs/stringify.ts +17 -20
  116. package/src/internal/qs/utils.ts +14 -14
  117. package/src/internal/request-options.ts +1 -0
  118. package/src/internal/uploads.ts +1 -1
  119. package/src/internal/utils/log.ts +1 -1
  120. package/src/internal/utils/path.ts +1 -1
  121. package/src/internal/utils/values.ts +3 -0
  122. package/src/resources/auth-configs.ts +3 -6
  123. package/src/resources/connected-accounts.ts +1120 -3556
  124. package/src/resources/mcp/custom.ts +2 -2
  125. package/src/resources/mcp/mcp.ts +4 -4
  126. package/src/resources/tools.ts +15 -0
  127. package/src/resources/triggers-types.ts +2 -2
  128. package/src/resources/v3/index.ts +0 -1
  129. package/src/resources/v3/internal/action-execution.ts +2 -2
  130. package/src/resources/v3/v3.ts +0 -10
  131. package/src/version.ts +1 -1
  132. package/version.d.mts +1 -1
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
  135. package/version.mjs +1 -1
  136. package/resources/v3/admin.d.mts +0 -61
  137. package/resources/v3/admin.d.mts.map +0 -1
  138. package/resources/v3/admin.d.ts +0 -61
  139. package/resources/v3/admin.d.ts.map +0 -1
  140. package/resources/v3/admin.js +0 -32
  141. package/resources/v3/admin.js.map +0 -1
  142. package/resources/v3/admin.mjs +0 -28
  143. package/resources/v3/admin.mjs.map +0 -1
  144. package/src/resources/v3/admin.ts +0 -85
@@ -1,8 +1,7 @@
1
- import { encode, is_buffer, maybe_map } from './utils';
2
- import { default_format, formatters } from './formats';
1
+ import { encode, is_buffer, maybe_map, has } from './utils';
2
+ import { default_format, default_formatter, formatters } from './formats';
3
3
  import type { NonNullableProperties, StringifyOptions } from './types';
4
-
5
- const has = Object.prototype.hasOwnProperty;
4
+ import { isArray } from '../utils/values';
6
5
 
7
6
  const array_prefix_generators = {
8
7
  brackets(prefix: PropertyKey) {
@@ -17,13 +16,11 @@ const array_prefix_generators = {
17
16
  },
18
17
  };
19
18
 
20
- const is_array = Array.isArray;
21
- const push = Array.prototype.push;
22
19
  const push_to_array = function (arr: any[], value_or_array: any) {
23
- push.apply(arr, is_array(value_or_array) ? value_or_array : [value_or_array]);
20
+ Array.prototype.push.apply(arr, isArray(value_or_array) ? value_or_array : [value_or_array]);
24
21
  };
25
22
 
26
- const to_ISO = Date.prototype.toISOString;
23
+ let toISOString;
27
24
 
28
25
  const defaults = {
29
26
  addQueryPrefix: false,
@@ -38,11 +35,11 @@ const defaults = {
38
35
  encoder: encode,
39
36
  encodeValuesOnly: false,
40
37
  format: default_format,
41
- formatter: formatters[default_format],
38
+ formatter: default_formatter,
42
39
  /** @deprecated */
43
40
  indices: false,
44
41
  serializeDate(date) {
45
- return to_ISO.call(date);
42
+ return (toISOString ??= Function.prototype.call.bind(Date.prototype.toISOString))(date);
46
43
  },
47
44
  skipNulls: false,
48
45
  strictNullHandling: false,
@@ -105,7 +102,7 @@ function inner_stringify(
105
102
  obj = filter(prefix, obj);
106
103
  } else if (obj instanceof Date) {
107
104
  obj = serializeDate?.(obj);
108
- } else if (generateArrayPrefix === 'comma' && is_array(obj)) {
105
+ } else if (generateArrayPrefix === 'comma' && isArray(obj)) {
109
106
  obj = maybe_map(obj, function (value) {
110
107
  if (value instanceof Date) {
111
108
  return serializeDate?.(value);
@@ -148,14 +145,14 @@ function inner_stringify(
148
145
  }
149
146
 
150
147
  let obj_keys;
151
- if (generateArrayPrefix === 'comma' && is_array(obj)) {
148
+ if (generateArrayPrefix === 'comma' && isArray(obj)) {
152
149
  // we need to join elements in
153
150
  if (encodeValuesOnly && encoder) {
154
151
  // @ts-expect-error values only
155
152
  obj = maybe_map(obj, encoder);
156
153
  }
157
154
  obj_keys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
158
- } else if (is_array(filter)) {
155
+ } else if (isArray(filter)) {
159
156
  obj_keys = filter;
160
157
  } else {
161
158
  const keys = Object.keys(obj);
@@ -165,9 +162,9 @@ function inner_stringify(
165
162
  const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
166
163
 
167
164
  const adjusted_prefix =
168
- commaRoundTrip && is_array(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix;
165
+ commaRoundTrip && isArray(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix;
169
166
 
170
- if (allowEmptyArrays && is_array(obj) && obj.length === 0) {
167
+ if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
171
168
  return adjusted_prefix + '[]';
172
169
  }
173
170
 
@@ -184,7 +181,7 @@ function inner_stringify(
184
181
  // @ts-ignore
185
182
  const encoded_key = allowDots && encodeDotInKeys ? (key as any).replace(/\./g, '%2E') : key;
186
183
  const key_prefix =
187
- is_array(obj) ?
184
+ isArray(obj) ?
188
185
  typeof generateArrayPrefix === 'function' ?
189
186
  generateArrayPrefix(adjusted_prefix, encoded_key)
190
187
  : adjusted_prefix
@@ -205,7 +202,7 @@ function inner_stringify(
205
202
  skipNulls,
206
203
  encodeDotInKeys,
207
204
  // @ts-ignore
208
- generateArrayPrefix === 'comma' && encodeValuesOnly && is_array(obj) ? null : encoder,
205
+ generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,
209
206
  filter,
210
207
  sort,
211
208
  allowDots,
@@ -244,7 +241,7 @@ function normalize_stringify_options(
244
241
 
245
242
  let format = default_format;
246
243
  if (typeof opts.format !== 'undefined') {
247
- if (!has.call(formatters, opts.format)) {
244
+ if (!has(formatters, opts.format)) {
248
245
  throw new TypeError('Unknown format option provided.');
249
246
  }
250
247
  format = opts.format;
@@ -252,7 +249,7 @@ function normalize_stringify_options(
252
249
  const formatter = formatters[format];
253
250
 
254
251
  let filter = defaults.filter;
255
- if (typeof opts.filter === 'function' || is_array(opts.filter)) {
252
+ if (typeof opts.filter === 'function' || isArray(opts.filter)) {
256
253
  filter = opts.filter;
257
254
  }
258
255
 
@@ -316,7 +313,7 @@ export function stringify(object: any, opts: StringifyOptions = {}) {
316
313
  if (typeof options.filter === 'function') {
317
314
  filter = options.filter;
318
315
  obj = filter('', obj);
319
- } else if (is_array(options.filter)) {
316
+ } else if (isArray(options.filter)) {
320
317
  filter = options.filter;
321
318
  obj_keys = filter;
322
319
  }
@@ -1,10 +1,13 @@
1
1
  import { RFC1738 } from './formats';
2
2
  import type { DefaultEncoder, Format } from './types';
3
+ import { isArray } from '../utils/values';
3
4
 
4
- const has = Object.prototype.hasOwnProperty;
5
- const is_array = Array.isArray;
5
+ export let has = (obj: object, key: PropertyKey): boolean => (
6
+ (has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
7
+ has(obj, key)
8
+ );
6
9
 
7
- const hex_table = (() => {
10
+ const hex_table = /* @__PURE__ */ (() => {
8
11
  const array = [];
9
12
  for (let i = 0; i < 256; ++i) {
10
13
  array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
@@ -20,7 +23,7 @@ function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; pro
20
23
 
21
24
  const obj = item.obj[item.prop];
22
25
 
23
- if (is_array(obj)) {
26
+ if (isArray(obj)) {
24
27
  const compacted: unknown[] = [];
25
28
 
26
29
  for (let j = 0; j < obj.length; ++j) {
@@ -56,13 +59,10 @@ export function merge(
56
59
  }
57
60
 
58
61
  if (typeof source !== 'object') {
59
- if (is_array(target)) {
62
+ if (isArray(target)) {
60
63
  target.push(source);
61
64
  } else if (target && typeof target === 'object') {
62
- if (
63
- (options && (options.plainObjects || options.allowPrototypes)) ||
64
- !has.call(Object.prototype, source)
65
- ) {
65
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
66
66
  target[source] = true;
67
67
  }
68
68
  } else {
@@ -77,14 +77,14 @@ export function merge(
77
77
  }
78
78
 
79
79
  let mergeTarget = target;
80
- if (is_array(target) && !is_array(source)) {
80
+ if (isArray(target) && !isArray(source)) {
81
81
  // @ts-ignore
82
82
  mergeTarget = array_to_object(target, options);
83
83
  }
84
84
 
85
- if (is_array(target) && is_array(source)) {
85
+ if (isArray(target) && isArray(source)) {
86
86
  source.forEach(function (item, i) {
87
- if (has.call(target, i)) {
87
+ if (has(target, i)) {
88
88
  const targetItem = target[i];
89
89
  if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
90
  target[i] = merge(targetItem, item, options);
@@ -101,7 +101,7 @@ export function merge(
101
101
  return Object.keys(source).reduce(function (acc, key) {
102
102
  const value = source[key];
103
103
 
104
- if (has.call(acc, key)) {
104
+ if (has(acc, key)) {
105
105
  acc[key] = merge(acc[key], value, options);
106
106
  } else {
107
107
  acc[key] = value;
@@ -254,7 +254,7 @@ export function combine(a: any, b: any) {
254
254
  }
255
255
 
256
256
  export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
- if (is_array(val)) {
257
+ if (isArray(val)) {
258
258
  const mapped = [];
259
259
  for (let i = 0; i < val.length; i += 1) {
260
260
  mapped.push(fn(val[i]!));
@@ -20,6 +20,7 @@ export type RequestOptions = {
20
20
  fetchOptions?: MergedRequestInit;
21
21
  signal?: AbortSignal | undefined | null;
22
22
  idempotencyKey?: string;
23
+ defaultBaseURL?: string | undefined;
23
24
 
24
25
  __binaryResponse?: boolean | undefined;
25
26
  };
@@ -90,7 +90,7 @@ export const multipartFormRequestOptions = async (
90
90
  return { ...opts, body: await createForm(opts.body, fetch) };
91
91
  };
92
92
 
93
- const supportsFormDataMap = new WeakMap<Fetch, Promise<boolean>>();
93
+ const supportsFormDataMap = /** @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>();
94
94
 
95
95
  /**
96
96
  * node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
@@ -58,7 +58,7 @@ const noopLogger = {
58
58
  debug: noop,
59
59
  };
60
60
 
61
- let cachedLoggers = new WeakMap<Logger, [LogLevel, Logger]>();
61
+ let cachedLoggers = /** @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
63
  export function loggerFor(client: Composio): Logger {
64
64
  const logger = client.logger;
@@ -60,4 +60,4 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
60
60
  /**
61
61
  * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
62
62
  */
63
- export const path = createPathTagFunction(encodeURIPath);
63
+ export const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
@@ -9,6 +9,9 @@ export const isAbsoluteURL = (url: string): boolean => {
9
9
  return startsWithSchemeRegexp.test(url);
10
10
  };
11
11
 
12
+ export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
13
+ export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];
14
+
12
15
  /** Returns an object if the given value isn't an object, otherwise returns as-is */
13
16
  export function maybeObj(x: unknown): object {
14
17
  if (typeof x !== 'object') {
@@ -195,8 +195,7 @@ export interface AuthConfigRetrieveResponse {
195
195
  | 'NO_AUTH'
196
196
  | 'BASIC_WITH_JWT'
197
197
  | 'COMPOSIO_LINK'
198
- | 'CALCOM_AUTH'
199
- | 'SNOWFLAKE';
198
+ | 'CALCOM_AUTH';
200
199
 
201
200
  /**
202
201
  * ISO 8601 date-time when the auth config was created
@@ -343,8 +342,7 @@ export namespace AuthConfigListResponse {
343
342
  | 'NO_AUTH'
344
343
  | 'BASIC_WITH_JWT'
345
344
  | 'COMPOSIO_LINK'
346
- | 'CALCOM_AUTH'
347
- | 'SNOWFLAKE';
345
+ | 'CALCOM_AUTH';
348
346
 
349
347
  /**
350
348
  * ISO 8601 date-time when the auth config was created
@@ -472,8 +470,7 @@ export namespace AuthConfigCreateParams {
472
470
  | 'NO_AUTH'
473
471
  | 'BASIC_WITH_JWT'
474
472
  | 'COMPOSIO_LINK'
475
- | 'CALCOM_AUTH'
476
- | 'SNOWFLAKE';
473
+ | 'CALCOM_AUTH';
477
474
 
478
475
  credentials: Record<string, string | boolean | number>;
479
476