@composio/core 0.1.12-alpha.8 → 0.1.12-alpha.9
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/dist/index.cjs +19 -37
- package/dist/index.d.cts +12 -38
- package/dist/index.d.ts +12 -38
- package/dist/index.js +19 -37
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -485,7 +485,7 @@ var ValidationErrorCodes = {
|
|
|
485
485
|
};
|
|
486
486
|
var ValidationError = class extends ComposioError {
|
|
487
487
|
zodError;
|
|
488
|
-
constructor(zodError, message = "Input validation failed") {
|
|
488
|
+
constructor(zodError, message = "Input validation failed", meta) {
|
|
489
489
|
let zodErrorInstance;
|
|
490
490
|
if (!(zodError instanceof import_zod2.ZodError)) {
|
|
491
491
|
zodErrorInstance = new import_zod2.ZodError([
|
|
@@ -498,18 +498,13 @@ var ValidationError = class extends ComposioError {
|
|
|
498
498
|
} else {
|
|
499
499
|
zodErrorInstance = zodError;
|
|
500
500
|
}
|
|
501
|
+
const issues = zodErrorInstance.issues.map(
|
|
502
|
+
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
503
|
+
);
|
|
501
504
|
super(message, {
|
|
502
505
|
code: ValidationErrorCodes.VALIDATION_ERROR,
|
|
503
|
-
meta
|
|
504
|
-
|
|
505
|
-
zodErrorInstance.issues.map((issue) => ({
|
|
506
|
-
path: issue.path.join("."),
|
|
507
|
-
message: issue.message,
|
|
508
|
-
code: issue.code
|
|
509
|
-
}))
|
|
510
|
-
)
|
|
511
|
-
},
|
|
512
|
-
cause: zodErrorInstance
|
|
506
|
+
meta,
|
|
507
|
+
cause: issues.join("\n")
|
|
513
508
|
});
|
|
514
509
|
this.zodError = zodErrorInstance;
|
|
515
510
|
this.name = "ValidationError";
|
|
@@ -1142,7 +1137,7 @@ var AuthConfigRetrieveResponseSchema = import_zod4.z.object({
|
|
|
1142
1137
|
status: import_zod4.z.enum(["ENABLED", "DISABLED"]),
|
|
1143
1138
|
uuid: import_zod4.z.string(),
|
|
1144
1139
|
authScheme: AuthSchemeEnum.optional(),
|
|
1145
|
-
credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.
|
|
1140
|
+
credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1146
1141
|
expectedInputFields: import_zod4.z.array(import_zod4.z.unknown()).optional(),
|
|
1147
1142
|
isComposioManaged: import_zod4.z.boolean().optional(),
|
|
1148
1143
|
createdBy: import_zod4.z.string().optional(),
|
|
@@ -1509,7 +1504,7 @@ var CreateConnectedAccountParamsSchema = import_zod5.z.object({
|
|
|
1509
1504
|
}),
|
|
1510
1505
|
connection: import_zod5.z.object({
|
|
1511
1506
|
data: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional(),
|
|
1512
|
-
|
|
1507
|
+
callbackUrl: import_zod5.z.string().optional(),
|
|
1513
1508
|
userId: import_zod5.z.string().optional()
|
|
1514
1509
|
})
|
|
1515
1510
|
});
|
|
@@ -1519,12 +1514,12 @@ var DefaultCreateConnectedAccountParamsSchema = import_zod5.z.object({
|
|
|
1519
1514
|
}),
|
|
1520
1515
|
connection: import_zod5.z.object({
|
|
1521
1516
|
data: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional(),
|
|
1522
|
-
|
|
1517
|
+
callback_url: import_zod5.z.string().optional(),
|
|
1523
1518
|
user_id: import_zod5.z.string().optional()
|
|
1524
1519
|
})
|
|
1525
1520
|
});
|
|
1526
1521
|
var CreateConnectedAccountOptionsSchema = import_zod5.z.object({
|
|
1527
|
-
|
|
1522
|
+
callbackUrl: import_zod5.z.string().optional(),
|
|
1528
1523
|
data: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional()
|
|
1529
1524
|
});
|
|
1530
1525
|
var CreateConnectedAccountResponseSchema = import_zod5.z.object({
|
|
@@ -1634,10 +1629,10 @@ var ConnectionRequest = class {
|
|
|
1634
1629
|
id;
|
|
1635
1630
|
status;
|
|
1636
1631
|
redirectUrl;
|
|
1637
|
-
constructor(client, connectedAccountId,
|
|
1632
|
+
constructor(client, connectedAccountId, status, redirectUrl) {
|
|
1638
1633
|
this.client = client;
|
|
1639
1634
|
this.id = connectedAccountId;
|
|
1640
|
-
this.status =
|
|
1635
|
+
this.status = status || ConnectedAccountStatuses.INITIATED;
|
|
1641
1636
|
this.redirectUrl = redirectUrl;
|
|
1642
1637
|
}
|
|
1643
1638
|
/**
|
|
@@ -1709,6 +1704,7 @@ var ConnectionRequest = class {
|
|
|
1709
1704
|
try {
|
|
1710
1705
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
1711
1706
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
1707
|
+
this.status = ConnectedAccountStatuses.ACTIVE;
|
|
1712
1708
|
return this.transformResponse(response);
|
|
1713
1709
|
}
|
|
1714
1710
|
} catch (error) {
|
|
@@ -1733,6 +1729,7 @@ var ConnectionRequest = class {
|
|
|
1733
1729
|
while (Date.now() - start < timeout) {
|
|
1734
1730
|
try {
|
|
1735
1731
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
1732
|
+
this.status = response.status;
|
|
1736
1733
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
1737
1734
|
return this.transformResponse(response);
|
|
1738
1735
|
}
|
|
@@ -1755,17 +1752,6 @@ var ConnectionRequest = class {
|
|
|
1755
1752
|
throw new ConnectionRequestTimeoutError(`Connection request timed out for ${this.id}`);
|
|
1756
1753
|
}
|
|
1757
1754
|
};
|
|
1758
|
-
var connectionRequest = (client) => {
|
|
1759
|
-
return {
|
|
1760
|
-
waitForConnection: async (connectedAccountId, timeout = 6e4) => {
|
|
1761
|
-
return new ConnectionRequest(
|
|
1762
|
-
client,
|
|
1763
|
-
connectedAccountId,
|
|
1764
|
-
ConnectedAccountStatuses.INITIATED
|
|
1765
|
-
).waitForConnection(timeout);
|
|
1766
|
-
}
|
|
1767
|
-
};
|
|
1768
|
-
};
|
|
1769
1755
|
|
|
1770
1756
|
// src/models/ConnectedAccounts.ts
|
|
1771
1757
|
var ConnectedAccounts = class {
|
|
@@ -1888,11 +1874,11 @@ var ConnectedAccounts = class {
|
|
|
1888
1874
|
},
|
|
1889
1875
|
connection: {
|
|
1890
1876
|
data: options?.data,
|
|
1891
|
-
|
|
1877
|
+
callback_url: options?.callbackUrl,
|
|
1892
1878
|
user_id: userId
|
|
1893
1879
|
}
|
|
1894
1880
|
});
|
|
1895
|
-
return new ConnectionRequest(this.client, response.id, response.status, response.
|
|
1881
|
+
return new ConnectionRequest(this.client, response.id, response.status, response.redirect_url);
|
|
1896
1882
|
}
|
|
1897
1883
|
/**
|
|
1898
1884
|
* Waits for a connection request to complete and become active.
|
|
@@ -1917,8 +1903,8 @@ var ConnectedAccounts = class {
|
|
|
1917
1903
|
* ```
|
|
1918
1904
|
*/
|
|
1919
1905
|
async waitForConnection(connectedAccountId, timeout = 6e4) {
|
|
1920
|
-
const
|
|
1921
|
-
return
|
|
1906
|
+
const connectionRequest = new ConnectionRequest(this.client, connectedAccountId);
|
|
1907
|
+
return connectionRequest.waitForConnection(timeout);
|
|
1922
1908
|
}
|
|
1923
1909
|
/**
|
|
1924
1910
|
* Retrieves a specific connected account by its ID.
|
|
@@ -2914,7 +2900,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
2914
2900
|
};
|
|
2915
2901
|
|
|
2916
2902
|
// package.json
|
|
2917
|
-
var version = "0.1.12-alpha.
|
|
2903
|
+
var version = "0.1.12-alpha.9";
|
|
2918
2904
|
|
|
2919
2905
|
// src/utils/uuid.ts
|
|
2920
2906
|
var import_uuid = require("uuid");
|
|
@@ -2946,7 +2932,6 @@ var Composio = class {
|
|
|
2946
2932
|
authConfigs;
|
|
2947
2933
|
// connected accounts
|
|
2948
2934
|
connectedAccounts;
|
|
2949
|
-
experimental;
|
|
2950
2935
|
/**
|
|
2951
2936
|
* @param {Object} config Configuration for the Composio SDK.
|
|
2952
2937
|
* @param {string} config.apiKey The API key for the Composio SDK.
|
|
@@ -2978,9 +2963,6 @@ var Composio = class {
|
|
|
2978
2963
|
this.triggers = new Triggers(this.client);
|
|
2979
2964
|
this.authConfigs = new AuthConfigs(this.client);
|
|
2980
2965
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
2981
|
-
this.experimental = {
|
|
2982
|
-
connectionRequest: connectionRequest(this.client)
|
|
2983
|
-
};
|
|
2984
2966
|
if (this.config.allowTracking ?? true) {
|
|
2985
2967
|
this.initializeTelemetry(
|
|
2986
2968
|
{
|
package/dist/index.d.cts
CHANGED
|
@@ -1546,14 +1546,14 @@ declare const ConnectedAccountStatuses: {
|
|
|
1546
1546
|
type ConnectedAccountStatus = (typeof ConnectedAccountStatuses)[keyof typeof ConnectedAccountStatuses];
|
|
1547
1547
|
type CreateConnectedAccountOptions = z.infer<typeof CreateConnectedAccountOptionsSchema>;
|
|
1548
1548
|
declare const CreateConnectedAccountOptionsSchema: z.ZodObject<{
|
|
1549
|
-
|
|
1549
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1550
1550
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1551
1551
|
}, "strip", z.ZodTypeAny, {
|
|
1552
1552
|
data?: Record<string, unknown> | undefined;
|
|
1553
|
-
|
|
1553
|
+
callbackUrl?: string | undefined;
|
|
1554
1554
|
}, {
|
|
1555
1555
|
data?: Record<string, unknown> | undefined;
|
|
1556
|
-
|
|
1556
|
+
callbackUrl?: string | undefined;
|
|
1557
1557
|
}>;
|
|
1558
1558
|
type CreateConnectedAccountOptionsSchema = z.infer<typeof CreateConnectedAccountOptionsSchema>;
|
|
1559
1559
|
declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
@@ -1803,7 +1803,7 @@ declare class ConnectionRequest {
|
|
|
1803
1803
|
id: string;
|
|
1804
1804
|
status?: ConnectedAccountStatus;
|
|
1805
1805
|
redirectUrl?: string | null;
|
|
1806
|
-
constructor(client: ComposioClient, connectedAccountId: string,
|
|
1806
|
+
constructor(client: ComposioClient, connectedAccountId: string, status?: ConnectedAccountStatus, redirectUrl?: string | null);
|
|
1807
1807
|
/**
|
|
1808
1808
|
* Transforms the raw connected account response from the Composio API to the SDK format.
|
|
1809
1809
|
*
|
|
@@ -1845,29 +1845,6 @@ declare class ConnectionRequest {
|
|
|
1845
1845
|
*/
|
|
1846
1846
|
waitForConnection(timeout?: number): Promise<ConnectedAccountRetrieveResponse>;
|
|
1847
1847
|
}
|
|
1848
|
-
declare const connectionRequest: (client: ComposioClient) => {
|
|
1849
|
-
waitForConnection: (connectedAccountId: string, timeout?: number) => Promise<{
|
|
1850
|
-
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1851
|
-
toolkit: {
|
|
1852
|
-
slug: string;
|
|
1853
|
-
};
|
|
1854
|
-
userId: string;
|
|
1855
|
-
data: Record<string, unknown>;
|
|
1856
|
-
createdAt: string;
|
|
1857
|
-
updatedAt: string;
|
|
1858
|
-
id: string;
|
|
1859
|
-
authConfig: {
|
|
1860
|
-
id: string;
|
|
1861
|
-
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1862
|
-
isComposioManaged: boolean;
|
|
1863
|
-
isDisabled: boolean;
|
|
1864
|
-
};
|
|
1865
|
-
isDisabled: boolean;
|
|
1866
|
-
statusReason: string | null;
|
|
1867
|
-
params?: Record<string, unknown> | undefined;
|
|
1868
|
-
testRequestEndpoint?: string | undefined;
|
|
1869
|
-
}>;
|
|
1870
|
-
};
|
|
1871
1848
|
|
|
1872
1849
|
/**
|
|
1873
1850
|
* Toolkits class
|
|
@@ -2201,7 +2178,7 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
2201
2178
|
status: z.ZodEnum<["ENABLED", "DISABLED"]>;
|
|
2202
2179
|
uuid: z.ZodString;
|
|
2203
2180
|
authScheme: z.ZodOptional<z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>>;
|
|
2204
|
-
credentials: z.
|
|
2181
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2205
2182
|
expectedInputFields: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
2206
2183
|
isComposioManaged: z.ZodOptional<z.ZodBoolean>;
|
|
2207
2184
|
createdBy: z.ZodOptional<z.ZodString>;
|
|
@@ -2215,10 +2192,10 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
2215
2192
|
logo: string;
|
|
2216
2193
|
};
|
|
2217
2194
|
id: string;
|
|
2218
|
-
credentials: Record<string, string | number | boolean>;
|
|
2219
2195
|
noOfConnections: number;
|
|
2220
2196
|
uuid: string;
|
|
2221
2197
|
createdAt?: string | undefined;
|
|
2198
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2222
2199
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2223
2200
|
isComposioManaged?: boolean | undefined;
|
|
2224
2201
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2232,10 +2209,10 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
2232
2209
|
logo: string;
|
|
2233
2210
|
};
|
|
2234
2211
|
id: string;
|
|
2235
|
-
credentials: Record<string, string | number | boolean>;
|
|
2236
2212
|
noOfConnections: number;
|
|
2237
2213
|
uuid: string;
|
|
2238
2214
|
createdAt?: string | undefined;
|
|
2215
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2239
2216
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2240
2217
|
isComposioManaged?: boolean | undefined;
|
|
2241
2218
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2278,7 +2255,7 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2278
2255
|
status: z.ZodEnum<["ENABLED", "DISABLED"]>;
|
|
2279
2256
|
uuid: z.ZodString;
|
|
2280
2257
|
authScheme: z.ZodOptional<z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>>;
|
|
2281
|
-
credentials: z.
|
|
2258
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2282
2259
|
expectedInputFields: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
2283
2260
|
isComposioManaged: z.ZodOptional<z.ZodBoolean>;
|
|
2284
2261
|
createdBy: z.ZodOptional<z.ZodString>;
|
|
@@ -2292,10 +2269,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2292
2269
|
logo: string;
|
|
2293
2270
|
};
|
|
2294
2271
|
id: string;
|
|
2295
|
-
credentials: Record<string, string | number | boolean>;
|
|
2296
2272
|
noOfConnections: number;
|
|
2297
2273
|
uuid: string;
|
|
2298
2274
|
createdAt?: string | undefined;
|
|
2275
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2299
2276
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2300
2277
|
isComposioManaged?: boolean | undefined;
|
|
2301
2278
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2309,10 +2286,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2309
2286
|
logo: string;
|
|
2310
2287
|
};
|
|
2311
2288
|
id: string;
|
|
2312
|
-
credentials: Record<string, string | number | boolean>;
|
|
2313
2289
|
noOfConnections: number;
|
|
2314
2290
|
uuid: string;
|
|
2315
2291
|
createdAt?: string | undefined;
|
|
2292
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2316
2293
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2317
2294
|
isComposioManaged?: boolean | undefined;
|
|
2318
2295
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2330,10 +2307,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2330
2307
|
logo: string;
|
|
2331
2308
|
};
|
|
2332
2309
|
id: string;
|
|
2333
|
-
credentials: Record<string, string | number | boolean>;
|
|
2334
2310
|
noOfConnections: number;
|
|
2335
2311
|
uuid: string;
|
|
2336
2312
|
createdAt?: string | undefined;
|
|
2313
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2337
2314
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2338
2315
|
isComposioManaged?: boolean | undefined;
|
|
2339
2316
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2351,10 +2328,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2351
2328
|
logo: string;
|
|
2352
2329
|
};
|
|
2353
2330
|
id: string;
|
|
2354
|
-
credentials: Record<string, string | number | boolean>;
|
|
2355
2331
|
noOfConnections: number;
|
|
2356
2332
|
uuid: string;
|
|
2357
2333
|
createdAt?: string | undefined;
|
|
2334
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2358
2335
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2359
2336
|
isComposioManaged?: boolean | undefined;
|
|
2360
2337
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2894,9 +2871,6 @@ declare class Composio<TProvider extends BaseComposioProvider<unknown, unknown>
|
|
|
2894
2871
|
provider: TProvider;
|
|
2895
2872
|
authConfigs: AuthConfigs;
|
|
2896
2873
|
connectedAccounts: ConnectedAccounts;
|
|
2897
|
-
experimental: {
|
|
2898
|
-
connectionRequest: ReturnType<typeof connectionRequest>;
|
|
2899
|
-
};
|
|
2900
2874
|
/**
|
|
2901
2875
|
* @param {Object} config Configuration for the Composio SDK.
|
|
2902
2876
|
* @param {string} config.apiKey The API key for the Composio SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -1546,14 +1546,14 @@ declare const ConnectedAccountStatuses: {
|
|
|
1546
1546
|
type ConnectedAccountStatus = (typeof ConnectedAccountStatuses)[keyof typeof ConnectedAccountStatuses];
|
|
1547
1547
|
type CreateConnectedAccountOptions = z.infer<typeof CreateConnectedAccountOptionsSchema>;
|
|
1548
1548
|
declare const CreateConnectedAccountOptionsSchema: z.ZodObject<{
|
|
1549
|
-
|
|
1549
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1550
1550
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1551
1551
|
}, "strip", z.ZodTypeAny, {
|
|
1552
1552
|
data?: Record<string, unknown> | undefined;
|
|
1553
|
-
|
|
1553
|
+
callbackUrl?: string | undefined;
|
|
1554
1554
|
}, {
|
|
1555
1555
|
data?: Record<string, unknown> | undefined;
|
|
1556
|
-
|
|
1556
|
+
callbackUrl?: string | undefined;
|
|
1557
1557
|
}>;
|
|
1558
1558
|
type CreateConnectedAccountOptionsSchema = z.infer<typeof CreateConnectedAccountOptionsSchema>;
|
|
1559
1559
|
declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
@@ -1803,7 +1803,7 @@ declare class ConnectionRequest {
|
|
|
1803
1803
|
id: string;
|
|
1804
1804
|
status?: ConnectedAccountStatus;
|
|
1805
1805
|
redirectUrl?: string | null;
|
|
1806
|
-
constructor(client: ComposioClient, connectedAccountId: string,
|
|
1806
|
+
constructor(client: ComposioClient, connectedAccountId: string, status?: ConnectedAccountStatus, redirectUrl?: string | null);
|
|
1807
1807
|
/**
|
|
1808
1808
|
* Transforms the raw connected account response from the Composio API to the SDK format.
|
|
1809
1809
|
*
|
|
@@ -1845,29 +1845,6 @@ declare class ConnectionRequest {
|
|
|
1845
1845
|
*/
|
|
1846
1846
|
waitForConnection(timeout?: number): Promise<ConnectedAccountRetrieveResponse>;
|
|
1847
1847
|
}
|
|
1848
|
-
declare const connectionRequest: (client: ComposioClient) => {
|
|
1849
|
-
waitForConnection: (connectedAccountId: string, timeout?: number) => Promise<{
|
|
1850
|
-
status: "ACTIVE" | "INACTIVE" | "DELETED" | "INITIATED" | "EXPIRED" | "FAILED";
|
|
1851
|
-
toolkit: {
|
|
1852
|
-
slug: string;
|
|
1853
|
-
};
|
|
1854
|
-
userId: string;
|
|
1855
|
-
data: Record<string, unknown>;
|
|
1856
|
-
createdAt: string;
|
|
1857
|
-
updatedAt: string;
|
|
1858
|
-
id: string;
|
|
1859
|
-
authConfig: {
|
|
1860
|
-
id: string;
|
|
1861
|
-
authScheme: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE";
|
|
1862
|
-
isComposioManaged: boolean;
|
|
1863
|
-
isDisabled: boolean;
|
|
1864
|
-
};
|
|
1865
|
-
isDisabled: boolean;
|
|
1866
|
-
statusReason: string | null;
|
|
1867
|
-
params?: Record<string, unknown> | undefined;
|
|
1868
|
-
testRequestEndpoint?: string | undefined;
|
|
1869
|
-
}>;
|
|
1870
|
-
};
|
|
1871
1848
|
|
|
1872
1849
|
/**
|
|
1873
1850
|
* Toolkits class
|
|
@@ -2201,7 +2178,7 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
2201
2178
|
status: z.ZodEnum<["ENABLED", "DISABLED"]>;
|
|
2202
2179
|
uuid: z.ZodString;
|
|
2203
2180
|
authScheme: z.ZodOptional<z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>>;
|
|
2204
|
-
credentials: z.
|
|
2181
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2205
2182
|
expectedInputFields: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
2206
2183
|
isComposioManaged: z.ZodOptional<z.ZodBoolean>;
|
|
2207
2184
|
createdBy: z.ZodOptional<z.ZodString>;
|
|
@@ -2215,10 +2192,10 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
2215
2192
|
logo: string;
|
|
2216
2193
|
};
|
|
2217
2194
|
id: string;
|
|
2218
|
-
credentials: Record<string, string | number | boolean>;
|
|
2219
2195
|
noOfConnections: number;
|
|
2220
2196
|
uuid: string;
|
|
2221
2197
|
createdAt?: string | undefined;
|
|
2198
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2222
2199
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2223
2200
|
isComposioManaged?: boolean | undefined;
|
|
2224
2201
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2232,10 +2209,10 @@ declare const AuthConfigRetrieveResponseSchema: z.ZodObject<{
|
|
|
2232
2209
|
logo: string;
|
|
2233
2210
|
};
|
|
2234
2211
|
id: string;
|
|
2235
|
-
credentials: Record<string, string | number | boolean>;
|
|
2236
2212
|
noOfConnections: number;
|
|
2237
2213
|
uuid: string;
|
|
2238
2214
|
createdAt?: string | undefined;
|
|
2215
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2239
2216
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2240
2217
|
isComposioManaged?: boolean | undefined;
|
|
2241
2218
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2278,7 +2255,7 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2278
2255
|
status: z.ZodEnum<["ENABLED", "DISABLED"]>;
|
|
2279
2256
|
uuid: z.ZodString;
|
|
2280
2257
|
authScheme: z.ZodOptional<z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>>;
|
|
2281
|
-
credentials: z.
|
|
2258
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2282
2259
|
expectedInputFields: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
2283
2260
|
isComposioManaged: z.ZodOptional<z.ZodBoolean>;
|
|
2284
2261
|
createdBy: z.ZodOptional<z.ZodString>;
|
|
@@ -2292,10 +2269,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2292
2269
|
logo: string;
|
|
2293
2270
|
};
|
|
2294
2271
|
id: string;
|
|
2295
|
-
credentials: Record<string, string | number | boolean>;
|
|
2296
2272
|
noOfConnections: number;
|
|
2297
2273
|
uuid: string;
|
|
2298
2274
|
createdAt?: string | undefined;
|
|
2275
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2299
2276
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2300
2277
|
isComposioManaged?: boolean | undefined;
|
|
2301
2278
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2309,10 +2286,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2309
2286
|
logo: string;
|
|
2310
2287
|
};
|
|
2311
2288
|
id: string;
|
|
2312
|
-
credentials: Record<string, string | number | boolean>;
|
|
2313
2289
|
noOfConnections: number;
|
|
2314
2290
|
uuid: string;
|
|
2315
2291
|
createdAt?: string | undefined;
|
|
2292
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2316
2293
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2317
2294
|
isComposioManaged?: boolean | undefined;
|
|
2318
2295
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2330,10 +2307,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2330
2307
|
logo: string;
|
|
2331
2308
|
};
|
|
2332
2309
|
id: string;
|
|
2333
|
-
credentials: Record<string, string | number | boolean>;
|
|
2334
2310
|
noOfConnections: number;
|
|
2335
2311
|
uuid: string;
|
|
2336
2312
|
createdAt?: string | undefined;
|
|
2313
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2337
2314
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2338
2315
|
isComposioManaged?: boolean | undefined;
|
|
2339
2316
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2351,10 +2328,10 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
2351
2328
|
logo: string;
|
|
2352
2329
|
};
|
|
2353
2330
|
id: string;
|
|
2354
|
-
credentials: Record<string, string | number | boolean>;
|
|
2355
2331
|
noOfConnections: number;
|
|
2356
2332
|
uuid: string;
|
|
2357
2333
|
createdAt?: string | undefined;
|
|
2334
|
+
credentials?: Record<string, unknown> | undefined;
|
|
2358
2335
|
authScheme?: "NO_AUTH" | "OAUTH2" | "OAUTH1" | "OAUTH1A" | "API_KEY" | "BASIC" | "BILLCOM_AUTH" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "COMPOSIO_LINK" | "CALCOM_AUTH" | "SNOWFLAKE" | undefined;
|
|
2359
2336
|
isComposioManaged?: boolean | undefined;
|
|
2360
2337
|
expectedInputFields?: unknown[] | undefined;
|
|
@@ -2894,9 +2871,6 @@ declare class Composio<TProvider extends BaseComposioProvider<unknown, unknown>
|
|
|
2894
2871
|
provider: TProvider;
|
|
2895
2872
|
authConfigs: AuthConfigs;
|
|
2896
2873
|
connectedAccounts: ConnectedAccounts;
|
|
2897
|
-
experimental: {
|
|
2898
|
-
connectionRequest: ReturnType<typeof connectionRequest>;
|
|
2899
|
-
};
|
|
2900
2874
|
/**
|
|
2901
2875
|
* @param {Object} config Configuration for the Composio SDK.
|
|
2902
2876
|
* @param {string} config.apiKey The API key for the Composio SDK.
|
package/dist/index.js
CHANGED
|
@@ -447,7 +447,7 @@ var ValidationErrorCodes = {
|
|
|
447
447
|
};
|
|
448
448
|
var ValidationError = class extends ComposioError {
|
|
449
449
|
zodError;
|
|
450
|
-
constructor(zodError, message = "Input validation failed") {
|
|
450
|
+
constructor(zodError, message = "Input validation failed", meta) {
|
|
451
451
|
let zodErrorInstance;
|
|
452
452
|
if (!(zodError instanceof ZodError)) {
|
|
453
453
|
zodErrorInstance = new ZodError([
|
|
@@ -460,18 +460,13 @@ var ValidationError = class extends ComposioError {
|
|
|
460
460
|
} else {
|
|
461
461
|
zodErrorInstance = zodError;
|
|
462
462
|
}
|
|
463
|
+
const issues = zodErrorInstance.issues.map(
|
|
464
|
+
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
465
|
+
);
|
|
463
466
|
super(message, {
|
|
464
467
|
code: ValidationErrorCodes.VALIDATION_ERROR,
|
|
465
|
-
meta
|
|
466
|
-
|
|
467
|
-
zodErrorInstance.issues.map((issue) => ({
|
|
468
|
-
path: issue.path.join("."),
|
|
469
|
-
message: issue.message,
|
|
470
|
-
code: issue.code
|
|
471
|
-
}))
|
|
472
|
-
)
|
|
473
|
-
},
|
|
474
|
-
cause: zodErrorInstance
|
|
468
|
+
meta,
|
|
469
|
+
cause: issues.join("\n")
|
|
475
470
|
});
|
|
476
471
|
this.zodError = zodErrorInstance;
|
|
477
472
|
this.name = "ValidationError";
|
|
@@ -1104,7 +1099,7 @@ var AuthConfigRetrieveResponseSchema = z3.object({
|
|
|
1104
1099
|
status: z3.enum(["ENABLED", "DISABLED"]),
|
|
1105
1100
|
uuid: z3.string(),
|
|
1106
1101
|
authScheme: AuthSchemeEnum.optional(),
|
|
1107
|
-
credentials: z3.record(z3.string(), z3.
|
|
1102
|
+
credentials: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1108
1103
|
expectedInputFields: z3.array(z3.unknown()).optional(),
|
|
1109
1104
|
isComposioManaged: z3.boolean().optional(),
|
|
1110
1105
|
createdBy: z3.string().optional(),
|
|
@@ -1471,7 +1466,7 @@ var CreateConnectedAccountParamsSchema = z4.object({
|
|
|
1471
1466
|
}),
|
|
1472
1467
|
connection: z4.object({
|
|
1473
1468
|
data: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1474
|
-
|
|
1469
|
+
callbackUrl: z4.string().optional(),
|
|
1475
1470
|
userId: z4.string().optional()
|
|
1476
1471
|
})
|
|
1477
1472
|
});
|
|
@@ -1481,12 +1476,12 @@ var DefaultCreateConnectedAccountParamsSchema = z4.object({
|
|
|
1481
1476
|
}),
|
|
1482
1477
|
connection: z4.object({
|
|
1483
1478
|
data: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1484
|
-
|
|
1479
|
+
callback_url: z4.string().optional(),
|
|
1485
1480
|
user_id: z4.string().optional()
|
|
1486
1481
|
})
|
|
1487
1482
|
});
|
|
1488
1483
|
var CreateConnectedAccountOptionsSchema = z4.object({
|
|
1489
|
-
|
|
1484
|
+
callbackUrl: z4.string().optional(),
|
|
1490
1485
|
data: z4.record(z4.string(), z4.unknown()).optional()
|
|
1491
1486
|
});
|
|
1492
1487
|
var CreateConnectedAccountResponseSchema = z4.object({
|
|
@@ -1596,10 +1591,10 @@ var ConnectionRequest = class {
|
|
|
1596
1591
|
id;
|
|
1597
1592
|
status;
|
|
1598
1593
|
redirectUrl;
|
|
1599
|
-
constructor(client, connectedAccountId,
|
|
1594
|
+
constructor(client, connectedAccountId, status, redirectUrl) {
|
|
1600
1595
|
this.client = client;
|
|
1601
1596
|
this.id = connectedAccountId;
|
|
1602
|
-
this.status =
|
|
1597
|
+
this.status = status || ConnectedAccountStatuses.INITIATED;
|
|
1603
1598
|
this.redirectUrl = redirectUrl;
|
|
1604
1599
|
}
|
|
1605
1600
|
/**
|
|
@@ -1671,6 +1666,7 @@ var ConnectionRequest = class {
|
|
|
1671
1666
|
try {
|
|
1672
1667
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
1673
1668
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
1669
|
+
this.status = ConnectedAccountStatuses.ACTIVE;
|
|
1674
1670
|
return this.transformResponse(response);
|
|
1675
1671
|
}
|
|
1676
1672
|
} catch (error) {
|
|
@@ -1695,6 +1691,7 @@ var ConnectionRequest = class {
|
|
|
1695
1691
|
while (Date.now() - start < timeout) {
|
|
1696
1692
|
try {
|
|
1697
1693
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
1694
|
+
this.status = response.status;
|
|
1698
1695
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
1699
1696
|
return this.transformResponse(response);
|
|
1700
1697
|
}
|
|
@@ -1717,17 +1714,6 @@ var ConnectionRequest = class {
|
|
|
1717
1714
|
throw new ConnectionRequestTimeoutError(`Connection request timed out for ${this.id}`);
|
|
1718
1715
|
}
|
|
1719
1716
|
};
|
|
1720
|
-
var connectionRequest = (client) => {
|
|
1721
|
-
return {
|
|
1722
|
-
waitForConnection: async (connectedAccountId, timeout = 6e4) => {
|
|
1723
|
-
return new ConnectionRequest(
|
|
1724
|
-
client,
|
|
1725
|
-
connectedAccountId,
|
|
1726
|
-
ConnectedAccountStatuses.INITIATED
|
|
1727
|
-
).waitForConnection(timeout);
|
|
1728
|
-
}
|
|
1729
|
-
};
|
|
1730
|
-
};
|
|
1731
1717
|
|
|
1732
1718
|
// src/models/ConnectedAccounts.ts
|
|
1733
1719
|
var ConnectedAccounts = class {
|
|
@@ -1850,11 +1836,11 @@ var ConnectedAccounts = class {
|
|
|
1850
1836
|
},
|
|
1851
1837
|
connection: {
|
|
1852
1838
|
data: options?.data,
|
|
1853
|
-
|
|
1839
|
+
callback_url: options?.callbackUrl,
|
|
1854
1840
|
user_id: userId
|
|
1855
1841
|
}
|
|
1856
1842
|
});
|
|
1857
|
-
return new ConnectionRequest(this.client, response.id, response.status, response.
|
|
1843
|
+
return new ConnectionRequest(this.client, response.id, response.status, response.redirect_url);
|
|
1858
1844
|
}
|
|
1859
1845
|
/**
|
|
1860
1846
|
* Waits for a connection request to complete and become active.
|
|
@@ -1879,8 +1865,8 @@ var ConnectedAccounts = class {
|
|
|
1879
1865
|
* ```
|
|
1880
1866
|
*/
|
|
1881
1867
|
async waitForConnection(connectedAccountId, timeout = 6e4) {
|
|
1882
|
-
const
|
|
1883
|
-
return
|
|
1868
|
+
const connectionRequest = new ConnectionRequest(this.client, connectedAccountId);
|
|
1869
|
+
return connectionRequest.waitForConnection(timeout);
|
|
1884
1870
|
}
|
|
1885
1871
|
/**
|
|
1886
1872
|
* Retrieves a specific connected account by its ID.
|
|
@@ -2876,7 +2862,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
2876
2862
|
};
|
|
2877
2863
|
|
|
2878
2864
|
// package.json
|
|
2879
|
-
var version = "0.1.12-alpha.
|
|
2865
|
+
var version = "0.1.12-alpha.9";
|
|
2880
2866
|
|
|
2881
2867
|
// src/utils/uuid.ts
|
|
2882
2868
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -2908,7 +2894,6 @@ var Composio = class {
|
|
|
2908
2894
|
authConfigs;
|
|
2909
2895
|
// connected accounts
|
|
2910
2896
|
connectedAccounts;
|
|
2911
|
-
experimental;
|
|
2912
2897
|
/**
|
|
2913
2898
|
* @param {Object} config Configuration for the Composio SDK.
|
|
2914
2899
|
* @param {string} config.apiKey The API key for the Composio SDK.
|
|
@@ -2940,9 +2925,6 @@ var Composio = class {
|
|
|
2940
2925
|
this.triggers = new Triggers(this.client);
|
|
2941
2926
|
this.authConfigs = new AuthConfigs(this.client);
|
|
2942
2927
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
2943
|
-
this.experimental = {
|
|
2944
|
-
connectionRequest: connectionRequest(this.client)
|
|
2945
|
-
};
|
|
2946
2928
|
if (this.config.allowTracking ?? true) {
|
|
2947
2929
|
this.initializeTelemetry(
|
|
2948
2930
|
{
|