@composio/client 0.1.0-alpha.1 → 0.1.0-alpha.6
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.
- package/CHANGELOG.md +51 -0
- package/LICENSE +1 -1
- package/README.md +29 -29
- package/client.d.mts +16 -13
- package/client.d.mts.map +1 -1
- package/client.d.ts +16 -13
- package/client.d.ts.map +1 -1
- package/client.js +54 -61
- package/client.js.map +1 -1
- package/client.mjs +52 -59
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +2 -2
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts +2 -2
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.d.mts +2 -2
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +2 -2
- package/core/error.d.ts.map +1 -1
- package/core/error.js +4 -4
- package/core/error.js.map +1 -1
- package/core/error.mjs +2 -2
- package/core/error.mjs.map +1 -1
- package/core/resource.d.mts +3 -3
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts +3 -3
- package/core/resource.d.ts.map +1 -1
- package/core/resource.js.map +1 -1
- package/core/resource.mjs.map +1 -1
- package/index.d.mts +3 -3
- package/index.d.mts.map +1 -1
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/index.js +4 -4
- package/index.js.map +1 -1
- package/index.mjs +3 -3
- package/index.mjs.map +1 -1
- package/internal/parse.d.mts +2 -2
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts +2 -2
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts +6 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +6 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +11 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +8 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +280 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +276 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +14 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +14 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +229 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/shims/getBuiltinModule.d.mts.map +1 -1
- package/internal/shims/getBuiltinModule.d.ts.map +1 -1
- package/internal/shims/getBuiltinModule.js +5 -2
- package/internal/shims/getBuiltinModule.js.map +1 -1
- package/internal/shims/getBuiltinModule.mjs +5 -2
- package/internal/shims/getBuiltinModule.mjs.map +1 -1
- package/internal/shims.js +1 -1
- package/internal/shims.js.map +1 -1
- package/internal/shims.mjs +1 -1
- package/internal/shims.mjs.map +1 -1
- package/internal/uploads.d.mts +4 -4
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts +4 -4
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.js.map +1 -1
- package/internal/utils/base64.mjs +3 -3
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts +3 -3
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts +3 -3
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.d.mts.map +1 -1
- package/internal/utils/path.d.ts.map +1 -1
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs +2 -2
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/values.js +5 -5
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +6 -6
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +4 -4
- package/resources/action-execution.d.mts +1 -1
- package/resources/action-execution.d.mts.map +1 -1
- package/resources/action-execution.d.ts +1 -1
- package/resources/action-execution.d.ts.map +1 -1
- package/resources/cli.d.mts +124 -0
- package/resources/cli.d.mts.map +1 -0
- package/resources/cli.d.ts +124 -0
- package/resources/cli.d.ts.map +1 -0
- package/resources/cli.js +18 -0
- package/resources/cli.js.map +1 -0
- package/resources/cli.mjs +14 -0
- package/resources/cli.mjs.map +1 -0
- package/resources/index.d.mts +2 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/mcp/command.d.mts +34 -0
- package/resources/mcp/command.d.mts.map +1 -0
- package/resources/mcp/command.d.ts +34 -0
- package/resources/mcp/command.d.ts.map +1 -0
- package/resources/mcp/command.js +12 -0
- package/resources/mcp/command.js.map +1 -0
- package/resources/mcp/command.mjs +8 -0
- package/resources/mcp/command.mjs.map +1 -0
- package/resources/mcp/index.d.mts +3 -0
- package/resources/mcp/index.d.mts.map +1 -0
- package/resources/mcp/index.d.ts +3 -0
- package/resources/mcp/index.d.ts.map +1 -0
- package/resources/mcp/index.js +9 -0
- package/resources/mcp/index.js.map +1 -0
- package/resources/mcp/index.mjs +4 -0
- package/resources/mcp/index.mjs.map +1 -0
- package/resources/mcp/mcp.d.mts +378 -0
- package/resources/mcp/mcp.d.mts.map +1 -0
- package/resources/mcp/mcp.d.ts +378 -0
- package/resources/mcp/mcp.d.ts.map +1 -0
- package/resources/mcp/mcp.js +66 -0
- package/resources/mcp/mcp.js.map +1 -0
- package/resources/mcp/mcp.mjs +39 -0
- package/resources/mcp/mcp.mjs.map +1 -0
- package/resources/mcp.d.mts +2 -0
- package/resources/mcp.d.mts.map +1 -0
- package/resources/mcp.d.ts +2 -0
- package/resources/mcp.d.ts.map +1 -0
- package/resources/mcp.js +19 -0
- package/resources/mcp.js.map +1 -0
- package/resources/mcp.mjs +3 -0
- package/resources/mcp.mjs.map +1 -0
- package/src/client.ts +82 -47
- package/src/core/api-promise.ts +4 -4
- package/src/core/error.ts +2 -2
- package/src/core/resource.ts +3 -3
- package/src/index.ts +3 -3
- package/src/internal/parse.ts +2 -2
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +9 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +388 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/shims/getBuiltinModule.ts +4 -2
- package/src/internal/shims.ts +1 -1
- package/src/internal/uploads.ts +5 -5
- package/src/internal/utils/base64.ts +3 -3
- package/src/internal/utils/log.ts +3 -3
- package/src/internal/utils/path.ts +2 -4
- package/src/internal/utils/values.ts +6 -6
- package/src/resources/action-execution.ts +1 -1
- package/src/resources/cli.ts +166 -0
- package/src/resources/index.ts +22 -0
- package/src/resources/mcp/command.ts +47 -0
- package/src/resources/mcp/index.ts +17 -0
- package/src/resources/mcp/mcp.ts +519 -0
- package/src/resources/mcp.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/client.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { APIResponseProps } from './internal/parse';
|
|
|
12
12
|
import { getPlatformHeaders } from './internal/detect-platform';
|
|
13
13
|
import * as Shims from './internal/shims';
|
|
14
14
|
import * as Opts from './internal/request-options';
|
|
15
|
+
import * as qs from './internal/qs';
|
|
15
16
|
import { VERSION } from './version';
|
|
16
17
|
import * as Errors from './core/error';
|
|
17
18
|
import * as Uploads from './core/uploads';
|
|
@@ -40,6 +41,14 @@ import {
|
|
|
40
41
|
AuthConfigUpdateStatusResponse,
|
|
41
42
|
AuthConfigs,
|
|
42
43
|
} from './resources/auth-configs';
|
|
44
|
+
import {
|
|
45
|
+
Cli,
|
|
46
|
+
CliCreateSessionResponse,
|
|
47
|
+
CliLinkSessionParams,
|
|
48
|
+
CliLinkSessionResponse,
|
|
49
|
+
CliRetrieveSessionParams,
|
|
50
|
+
CliRetrieveSessionResponse,
|
|
51
|
+
} from './resources/cli';
|
|
43
52
|
import {
|
|
44
53
|
ConnectedAccountCreateParams,
|
|
45
54
|
ConnectedAccountCreateResponse,
|
|
@@ -92,6 +101,20 @@ import {
|
|
|
92
101
|
import { readEnv } from './internal/utils/env';
|
|
93
102
|
import { formatRequestDetails, loggerFor } from './internal/utils/log';
|
|
94
103
|
import { isEmptyObj } from './internal/utils/values';
|
|
104
|
+
import {
|
|
105
|
+
Mcp,
|
|
106
|
+
McpCreateParams,
|
|
107
|
+
McpCreateResponse,
|
|
108
|
+
McpDeleteResponse,
|
|
109
|
+
McpListParams,
|
|
110
|
+
McpListResponse,
|
|
111
|
+
McpRetrieveAppResponse,
|
|
112
|
+
McpRetrieveResponse,
|
|
113
|
+
McpUpdateParams,
|
|
114
|
+
McpUpdateResponse,
|
|
115
|
+
McpValidateParams,
|
|
116
|
+
McpValidateResponse,
|
|
117
|
+
} from './resources/mcp/mcp';
|
|
95
118
|
import { Org } from './resources/org/org';
|
|
96
119
|
import {
|
|
97
120
|
TriggerInstanceListActiveParams,
|
|
@@ -130,7 +153,7 @@ export interface ClientOptions {
|
|
|
130
153
|
/**
|
|
131
154
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
132
155
|
*
|
|
133
|
-
* Defaults to process.env['
|
|
156
|
+
* Defaults to process.env['COMPOSIO_BASE_URL'].
|
|
134
157
|
*/
|
|
135
158
|
baseURL?: string | null | undefined;
|
|
136
159
|
|
|
@@ -182,7 +205,7 @@ export interface ClientOptions {
|
|
|
182
205
|
/**
|
|
183
206
|
* Set the log level.
|
|
184
207
|
*
|
|
185
|
-
* Defaults to process.env['
|
|
208
|
+
* Defaults to process.env['COMPOSIO_LOG'] or 'warn' if it isn't set.
|
|
186
209
|
*/
|
|
187
210
|
logLevel?: LogLevel | undefined;
|
|
188
211
|
|
|
@@ -195,9 +218,9 @@ export interface ClientOptions {
|
|
|
195
218
|
}
|
|
196
219
|
|
|
197
220
|
/**
|
|
198
|
-
* API Client for interfacing with the Composio
|
|
221
|
+
* API Client for interfacing with the Composio API.
|
|
199
222
|
*/
|
|
200
|
-
export class
|
|
223
|
+
export class Composio {
|
|
201
224
|
apiKey: string;
|
|
202
225
|
|
|
203
226
|
baseURL: string;
|
|
@@ -213,11 +236,11 @@ export class ComposioSDK {
|
|
|
213
236
|
private _options: ClientOptions;
|
|
214
237
|
|
|
215
238
|
/**
|
|
216
|
-
* API Client for interfacing with the Composio
|
|
239
|
+
* API Client for interfacing with the Composio API.
|
|
217
240
|
*
|
|
218
241
|
* @param {string | undefined} [opts.apiKey=process.env['COMPOSIO_API_KEY'] ?? undefined]
|
|
219
242
|
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
|
|
220
|
-
* @param {string} [opts.baseURL=process.env['
|
|
243
|
+
* @param {string} [opts.baseURL=process.env['COMPOSIO_BASE_URL'] ?? https://backend.composio.dev] - Override the default base URL for the API.
|
|
221
244
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
222
245
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
223
246
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -226,13 +249,13 @@ export class ComposioSDK {
|
|
|
226
249
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
227
250
|
*/
|
|
228
251
|
constructor({
|
|
229
|
-
baseURL = readEnv('
|
|
252
|
+
baseURL = readEnv('COMPOSIO_BASE_URL'),
|
|
230
253
|
apiKey = readEnv('COMPOSIO_API_KEY'),
|
|
231
254
|
...opts
|
|
232
255
|
}: ClientOptions = {}) {
|
|
233
256
|
if (apiKey === undefined) {
|
|
234
|
-
throw new Errors.
|
|
235
|
-
"The COMPOSIO_API_KEY environment variable is missing or empty; either provide it, or instantiate the
|
|
257
|
+
throw new Errors.ComposioError(
|
|
258
|
+
"The COMPOSIO_API_KEY environment variable is missing or empty; either provide it, or instantiate the Composio client with an apiKey option, like new Composio({ apiKey: 'My API Key' }).",
|
|
236
259
|
);
|
|
237
260
|
}
|
|
238
261
|
|
|
@@ -244,20 +267,20 @@ export class ComposioSDK {
|
|
|
244
267
|
};
|
|
245
268
|
|
|
246
269
|
if (baseURL && opts.environment) {
|
|
247
|
-
throw new Errors.
|
|
248
|
-
'Ambiguous URL; The `baseURL` option (or
|
|
270
|
+
throw new Errors.ComposioError(
|
|
271
|
+
'Ambiguous URL; The `baseURL` option (or COMPOSIO_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null',
|
|
249
272
|
);
|
|
250
273
|
}
|
|
251
274
|
|
|
252
275
|
this.baseURL = options.baseURL || environments[options.environment || 'production'];
|
|
253
|
-
this.timeout = options.timeout ??
|
|
276
|
+
this.timeout = options.timeout ?? Composio.DEFAULT_TIMEOUT /* 1 minute */;
|
|
254
277
|
this.logger = options.logger ?? console;
|
|
255
278
|
const defaultLogLevel = 'warn';
|
|
256
279
|
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
257
280
|
this.logLevel = defaultLogLevel;
|
|
258
281
|
this.logLevel =
|
|
259
282
|
parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
|
|
260
|
-
parseLogLevel(readEnv('
|
|
283
|
+
parseLogLevel(readEnv('COMPOSIO_LOG'), "process.env['COMPOSIO_LOG']", this) ??
|
|
261
284
|
defaultLogLevel;
|
|
262
285
|
this.fetchOptions = options.fetchOptions;
|
|
263
286
|
this.maxRetries = options.maxRetries ?? 2;
|
|
@@ -278,27 +301,11 @@ export class ComposioSDK {
|
|
|
278
301
|
}
|
|
279
302
|
|
|
280
303
|
protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined {
|
|
281
|
-
return buildHeaders([{ '
|
|
304
|
+
return buildHeaders([{ 'x-api-key': this.apiKey }]);
|
|
282
305
|
}
|
|
283
306
|
|
|
284
|
-
/**
|
|
285
|
-
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
286
|
-
*/
|
|
287
307
|
protected stringifyQuery(query: Record<string, unknown>): string {
|
|
288
|
-
return
|
|
289
|
-
.filter(([_, value]) => typeof value !== 'undefined')
|
|
290
|
-
.map(([key, value]) => {
|
|
291
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
292
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
293
|
-
}
|
|
294
|
-
if (value === null) {
|
|
295
|
-
return `${encodeURIComponent(key)}=`;
|
|
296
|
-
}
|
|
297
|
-
throw new Errors.ComposioSDKError(
|
|
298
|
-
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
299
|
-
);
|
|
300
|
-
})
|
|
301
|
-
.join('&');
|
|
308
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
302
309
|
}
|
|
303
310
|
|
|
304
311
|
private getUserAgent(): string {
|
|
@@ -659,17 +666,17 @@ export class ComposioSDK {
|
|
|
659
666
|
}
|
|
660
667
|
|
|
661
668
|
buildRequest(
|
|
662
|
-
|
|
669
|
+
inputOptions: FinalRequestOptions,
|
|
663
670
|
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
664
671
|
): { req: FinalizedRequestInit; url: string; timeout: number } {
|
|
665
|
-
options = { ...
|
|
672
|
+
const options = { ...inputOptions };
|
|
666
673
|
const { method, path, query } = options;
|
|
667
674
|
|
|
668
675
|
const url = this.buildURL(path!, query as Record<string, unknown>);
|
|
669
676
|
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
670
677
|
options.timeout = options.timeout ?? this.timeout;
|
|
671
678
|
const { bodyHeaders, body } = this.buildBody({ options });
|
|
672
|
-
const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount });
|
|
679
|
+
const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
673
680
|
|
|
674
681
|
const req: FinalizedRequestInit = {
|
|
675
682
|
method,
|
|
@@ -759,10 +766,10 @@ export class ComposioSDK {
|
|
|
759
766
|
}
|
|
760
767
|
}
|
|
761
768
|
|
|
762
|
-
static
|
|
769
|
+
static Composio = this;
|
|
763
770
|
static DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
764
771
|
|
|
765
|
-
static
|
|
772
|
+
static ComposioError = Errors.ComposioError;
|
|
766
773
|
static APIError = Errors.APIError;
|
|
767
774
|
static APIConnectionError = Errors.APIConnectionError;
|
|
768
775
|
static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
@@ -788,18 +795,22 @@ export class ComposioSDK {
|
|
|
788
795
|
tools: API.Tools = new API.Tools(this);
|
|
789
796
|
triggerInstances: API.TriggerInstances = new API.TriggerInstances(this);
|
|
790
797
|
triggersTypes: API.TriggersTypes = new API.TriggersTypes(this);
|
|
798
|
+
cli: API.Cli = new API.Cli(this);
|
|
799
|
+
mcp: API.Mcp = new API.Mcp(this);
|
|
791
800
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
801
|
+
Composio.AuthConfigs = AuthConfigs;
|
|
802
|
+
Composio.ConnectedAccounts = ConnectedAccounts;
|
|
803
|
+
Composio.Trigger = Trigger;
|
|
804
|
+
Composio.ActionExecution = ActionExecution;
|
|
805
|
+
Composio.Org = Org;
|
|
806
|
+
Composio.TeamMembers = TeamMembers;
|
|
807
|
+
Composio.Toolkits = Toolkits;
|
|
808
|
+
Composio.Tools = Tools;
|
|
809
|
+
Composio.TriggerInstances = TriggerInstances;
|
|
810
|
+
Composio.TriggersTypes = TriggersTypes;
|
|
811
|
+
Composio.Cli = Cli;
|
|
812
|
+
Composio.Mcp = Mcp;
|
|
813
|
+
export declare namespace Composio {
|
|
803
814
|
export type RequestOptions = Opts.RequestOptions;
|
|
804
815
|
|
|
805
816
|
export {
|
|
@@ -895,4 +906,28 @@ export declare namespace ComposioSDK {
|
|
|
895
906
|
type TriggersTypeRetrieveEnumResponse as TriggersTypeRetrieveEnumResponse,
|
|
896
907
|
type TriggersTypeListParams as TriggersTypeListParams,
|
|
897
908
|
};
|
|
909
|
+
|
|
910
|
+
export {
|
|
911
|
+
Cli as Cli,
|
|
912
|
+
type CliCreateSessionResponse as CliCreateSessionResponse,
|
|
913
|
+
type CliLinkSessionResponse as CliLinkSessionResponse,
|
|
914
|
+
type CliRetrieveSessionResponse as CliRetrieveSessionResponse,
|
|
915
|
+
type CliLinkSessionParams as CliLinkSessionParams,
|
|
916
|
+
type CliRetrieveSessionParams as CliRetrieveSessionParams,
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
export {
|
|
920
|
+
Mcp as Mcp,
|
|
921
|
+
type McpCreateResponse as McpCreateResponse,
|
|
922
|
+
type McpRetrieveResponse as McpRetrieveResponse,
|
|
923
|
+
type McpUpdateResponse as McpUpdateResponse,
|
|
924
|
+
type McpListResponse as McpListResponse,
|
|
925
|
+
type McpDeleteResponse as McpDeleteResponse,
|
|
926
|
+
type McpRetrieveAppResponse as McpRetrieveAppResponse,
|
|
927
|
+
type McpValidateResponse as McpValidateResponse,
|
|
928
|
+
type McpCreateParams as McpCreateParams,
|
|
929
|
+
type McpUpdateParams as McpUpdateParams,
|
|
930
|
+
type McpListParams as McpListParams,
|
|
931
|
+
type McpValidateParams as McpValidateParams,
|
|
932
|
+
};
|
|
898
933
|
}
|
package/src/core/api-promise.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { type
|
|
3
|
+
import { type Composio } from '../client';
|
|
4
4
|
|
|
5
5
|
import { type PromiseOrValue } from '../internal/types';
|
|
6
6
|
import { APIResponseProps, defaultParseResponse } from '../internal/parse';
|
|
@@ -11,13 +11,13 @@ import { APIResponseProps, defaultParseResponse } from '../internal/parse';
|
|
|
11
11
|
*/
|
|
12
12
|
export class APIPromise<T> extends Promise<T> {
|
|
13
13
|
private parsedPromise: Promise<T> | undefined;
|
|
14
|
-
#client:
|
|
14
|
+
#client: Composio;
|
|
15
15
|
|
|
16
16
|
constructor(
|
|
17
|
-
client:
|
|
17
|
+
client: Composio,
|
|
18
18
|
private responsePromise: Promise<APIResponseProps>,
|
|
19
19
|
private parseResponse: (
|
|
20
|
-
client:
|
|
20
|
+
client: Composio,
|
|
21
21
|
props: APIResponseProps,
|
|
22
22
|
) => PromiseOrValue<T> = defaultParseResponse,
|
|
23
23
|
) {
|
package/src/core/error.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { castToError } from '../internal/errors';
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class ComposioError extends Error {}
|
|
6
6
|
|
|
7
7
|
export class APIError<
|
|
8
8
|
TStatus extends number | undefined = number | undefined,
|
|
9
9
|
THeaders extends Headers | undefined = Headers | undefined,
|
|
10
10
|
TError extends Object | undefined = Object | undefined,
|
|
11
|
-
> extends
|
|
11
|
+
> extends ComposioError {
|
|
12
12
|
/** HTTP status for the response that caused the error */
|
|
13
13
|
readonly status: TStatus;
|
|
14
14
|
/** HTTP headers for the response that caused the error */
|
package/src/core/resource.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { Composio } from '../client';
|
|
4
4
|
|
|
5
5
|
export class APIResource {
|
|
6
|
-
protected _client:
|
|
6
|
+
protected _client: Composio;
|
|
7
7
|
|
|
8
|
-
constructor(client:
|
|
8
|
+
constructor(client: Composio) {
|
|
9
9
|
this._client = client;
|
|
10
10
|
}
|
|
11
11
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { Composio as default } from './client';
|
|
4
4
|
|
|
5
5
|
export { type Uploadable, toFile } from './core/uploads';
|
|
6
6
|
export { APIPromise } from './core/api-promise';
|
|
7
|
-
export {
|
|
7
|
+
export { Composio, type ClientOptions } from './client';
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
ComposioError,
|
|
10
10
|
APIError,
|
|
11
11
|
APIConnectionError,
|
|
12
12
|
APIConnectionTimeoutError,
|
package/src/internal/parse.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import type { FinalRequestOptions } from './request-options';
|
|
4
|
-
import { type
|
|
4
|
+
import { type Composio } from '../client';
|
|
5
5
|
import { formatRequestDetails, loggerFor } from './utils/log';
|
|
6
6
|
|
|
7
7
|
export type APIResponseProps = {
|
|
@@ -13,7 +13,7 @@ export type APIResponseProps = {
|
|
|
13
13
|
startTime: number;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export async function defaultParseResponse<T>(client:
|
|
16
|
+
export async function defaultParseResponse<T>(client: Composio, props: APIResponseProps): Promise<T> {
|
|
17
17
|
const { response, requestLogID, retryOfRequestLogID, startTime } = props;
|
|
18
18
|
const body = await (async () => {
|
|
19
19
|
// fetch refuses to read the body when the status code is 204.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
10
|
+
|
|
11
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Format } from './types';
|
|
2
|
+
|
|
3
|
+
export const default_format: Format = 'RFC3986';
|
|
4
|
+
export const formatters: Record<Format, (str: PropertyKey) => string> = {
|
|
5
|
+
RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'),
|
|
6
|
+
RFC3986: (v: PropertyKey) => String(v),
|
|
7
|
+
};
|
|
8
|
+
export const RFC1738 = 'RFC1738';
|
|
9
|
+
export const RFC3986 = 'RFC3986';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default_format, formatters, RFC1738, RFC3986 } from './formats';
|
|
2
|
+
|
|
3
|
+
const formats = {
|
|
4
|
+
formatters,
|
|
5
|
+
RFC1738,
|
|
6
|
+
RFC3986,
|
|
7
|
+
default: default_format,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { stringify } from './stringify';
|
|
11
|
+
export { formats };
|
|
12
|
+
|
|
13
|
+
export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from './types';
|