@composio/client 2.0.0-rc.1 → 2.0.0-rc.11
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/README.md +108 -2
- package/dist/{api-key-revocation-BZL5FAx7.mjs → api-key-revocation-Dh-KSokR.mjs} +4 -3
- package/dist/{auth-CEq4JqWm.mjs → auth-Drov-jN8.mjs} +1 -1
- package/dist/{auth-configs-CyksMqNB.mjs → auth-configs-yM05-r6r.mjs} +18 -11
- package/dist/{clanker-4wByThQJ.mjs → clanker-BYmc69WC.mjs} +4 -3
- package/dist/cli-Ce8RT7yp.mjs +45 -0
- package/dist/{connected-accounts-B-qN_yLT.mjs → connected-accounts-D__sOoNZ.mjs} +31 -15
- package/dist/{consumer-DWlaGBmh.mjs → consumer-DTh50Hih.mjs} +8 -8
- package/dist/{custom-BQWoONFY.mjs → custom-CdC-6Y_i.mjs} +5 -3
- package/dist/custom-nlGufiDz.mjs +88 -0
- package/dist/error-DLB1uKM3.mjs +109 -0
- package/dist/{files-B-UnEejx.mjs → files-DROCPzLP.mjs} +7 -5
- package/dist/{files-CNZ-ttVS.mjs → files-RJPIH6iE.mjs} +13 -9
- package/dist/{generate-DSqfJENZ.mjs → generate-mU4b3zJf.mjs} +5 -3
- package/dist/{request-DwPfYYNF.mjs → generated-operations-CWhusMPU.mjs} +1266 -157
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +312 -827
- package/dist/keyring-BzkcB1gu.mjs +17 -0
- package/dist/{link-CukKZMxs.mjs → link-CfIyH3nF.mjs} +4 -3
- package/dist/{logs-B87z4hq7.mjs → logs-D2wxXYiO.mjs} +8 -6
- package/dist/{manage-By-b66OH.mjs → manage-Vc3jdRr_.mjs} +7 -5
- package/dist/mcp-DEe7xU7G.mjs +91 -0
- package/dist/{org-BSq_z6fP.mjs → org-CYsl9O1u.mjs} +9 -8
- package/dist/{owner-BDkEFEVF.mjs → owner-DmQb3AF5.mjs} +1 -1
- package/dist/pagination.d.mts +56 -0
- package/dist/pagination.mjs +50 -0
- package/dist/{project-D-c0Zrrl.mjs → project-BVBWJzHm.mjs} +1 -1
- package/dist/{project-_s0fWHut.mjs → project-D-_r3H1_.mjs} +7 -7
- package/dist/project-DvSCDA9B.mjs +47 -0
- package/dist/{project-Cj-NKnWZ.mjs → project-OSigfIdr.mjs} +4 -3
- package/dist/realtime-Dsk1QGAl.mjs +28 -0
- package/dist/resources/api-key-revocation.d.mts +1 -1
- package/dist/resources/api-key-revocation.mjs +1 -1
- package/dist/resources/auth/auth.d.mts +1 -1
- package/dist/resources/auth/auth.mjs +1 -1
- package/dist/resources/auth/index.d.mts +1 -1
- package/dist/resources/auth/index.mjs +2 -2
- package/dist/resources/auth/session.d.mts +1 -1
- package/dist/resources/auth/session.mjs +1 -1
- package/dist/resources/auth-configs.d.mts +1 -1
- package/dist/resources/auth-configs.mjs +1 -1
- package/dist/resources/auth.d.mts +1 -1
- package/dist/resources/auth.mjs +2 -2
- package/dist/resources/cli/cli.d.mts +1 -1
- package/dist/resources/cli/cli.mjs +1 -1
- package/dist/resources/cli/index.d.mts +1 -1
- package/dist/resources/cli/index.mjs +2 -2
- package/dist/resources/cli/realtime.d.mts +1 -1
- package/dist/resources/cli/realtime.mjs +1 -1
- package/dist/resources/cli.d.mts +1 -1
- package/dist/resources/cli.mjs +2 -2
- package/dist/resources/connected-accounts.d.mts +1 -1
- package/dist/resources/connected-accounts.mjs +1 -1
- package/dist/resources/custom.d.mts +2 -0
- package/dist/resources/custom.mjs +3 -0
- package/dist/resources/files.d.mts +1 -1
- package/dist/resources/files.mjs +1 -1
- package/dist/resources/index.d.mts +1 -1
- package/dist/resources/index.mjs +13 -13
- package/dist/resources/keyring.d.mts +2 -0
- package/dist/resources/keyring.mjs +3 -0
- package/dist/resources/link.d.mts +1 -1
- package/dist/resources/link.mjs +1 -1
- package/dist/resources/logs/index.d.mts +1 -1
- package/dist/resources/logs/index.mjs +3 -3
- package/dist/resources/logs/logs.d.mts +1 -1
- package/dist/resources/logs/logs.mjs +1 -1
- package/dist/resources/logs/tools.d.mts +1 -1
- package/dist/resources/logs/tools.mjs +1 -1
- package/dist/resources/logs/triggers.d.mts +1 -1
- package/dist/resources/logs/triggers.mjs +1 -1
- package/dist/resources/logs.d.mts +1 -1
- package/dist/resources/logs.mjs +3 -3
- package/dist/resources/mcp/custom.d.mts +1 -1
- package/dist/resources/mcp/custom.mjs +1 -1
- package/dist/resources/mcp/generate.d.mts +1 -1
- package/dist/resources/mcp/generate.mjs +1 -1
- package/dist/resources/mcp/index.d.mts +1 -1
- package/dist/resources/mcp/index.mjs +3 -3
- package/dist/resources/mcp/mcp.d.mts +1 -1
- package/dist/resources/mcp/mcp.mjs +1 -1
- package/dist/resources/mcp.d.mts +1 -1
- package/dist/resources/mcp.mjs +3 -3
- package/dist/resources/org/clanker.d.mts +1 -1
- package/dist/resources/org/clanker.mjs +1 -1
- package/dist/resources/org/consumer/consumer.d.mts +1 -1
- package/dist/resources/org/consumer/consumer.mjs +1 -1
- package/dist/resources/org/consumer/index.d.mts +1 -1
- package/dist/resources/org/consumer/index.mjs +2 -2
- package/dist/resources/org/consumer/project.d.mts +1 -1
- package/dist/resources/org/consumer/project.mjs +1 -1
- package/dist/resources/org/consumer.d.mts +1 -1
- package/dist/resources/org/consumer.mjs +2 -2
- package/dist/resources/org/index.d.mts +1 -1
- package/dist/resources/org/index.mjs +6 -6
- package/dist/resources/org/org.d.mts +1 -1
- package/dist/resources/org/org.mjs +1 -1
- package/dist/resources/org/owner/index.d.mts +1 -1
- package/dist/resources/org/owner/index.mjs +2 -2
- package/dist/resources/org/owner/owner.d.mts +1 -1
- package/dist/resources/org/owner/owner.mjs +1 -1
- package/dist/resources/org/owner/project.d.mts +1 -1
- package/dist/resources/org/owner/project.mjs +1 -1
- package/dist/resources/org/owner.d.mts +1 -1
- package/dist/resources/org/owner.mjs +2 -2
- package/dist/resources/org/project.d.mts +1 -1
- package/dist/resources/org/project.mjs +1 -1
- package/dist/resources/org/usage.d.mts +1 -1
- package/dist/resources/org/usage.mjs +1 -1
- package/dist/resources/org.d.mts +1 -1
- package/dist/resources/org.mjs +6 -6
- package/dist/resources/project/index.d.mts +1 -1
- package/dist/resources/project/index.mjs +1 -1
- package/dist/resources/project/project.d.mts +1 -1
- package/dist/resources/project/project.mjs +1 -1
- package/dist/resources/project/usage.d.mts +1 -1
- package/dist/resources/project/usage.mjs +1 -1
- package/dist/resources/project.d.mts +1 -1
- package/dist/resources/project.mjs +1 -1
- package/dist/resources/session-configs.d.mts +2 -0
- package/dist/resources/session-configs.mjs +24 -0
- package/dist/resources/tool-router/index.d.mts +1 -1
- package/dist/resources/tool-router/index.mjs +2 -2
- package/dist/resources/tool-router/session/files.d.mts +1 -1
- package/dist/resources/tool-router/session/files.mjs +1 -1
- package/dist/resources/tool-router/session/index.d.mts +1 -1
- package/dist/resources/tool-router/session/index.mjs +2 -2
- package/dist/resources/tool-router/session/session.d.mts +1 -1
- package/dist/resources/tool-router/session/session.mjs +1 -1
- package/dist/resources/tool-router/session.d.mts +1 -1
- package/dist/resources/tool-router/session.mjs +2 -2
- package/dist/resources/tool-router/tool-router.d.mts +1 -1
- package/dist/resources/tool-router/tool-router.mjs +1 -1
- package/dist/resources/tool-router.d.mts +1 -1
- package/dist/resources/tool-router.mjs +2 -2
- package/dist/resources/toolkits.d.mts +1 -1
- package/dist/resources/toolkits.mjs +1 -1
- package/dist/resources/tools.d.mts +1 -1
- package/dist/resources/tools.mjs +1 -1
- package/dist/resources/trigger-instances/index.d.mts +1 -1
- package/dist/resources/trigger-instances/index.mjs +2 -2
- package/dist/resources/trigger-instances/manage.d.mts +1 -1
- package/dist/resources/trigger-instances/manage.mjs +1 -1
- package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
- package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
- package/dist/resources/trigger-instances.d.mts +1 -1
- package/dist/resources/trigger-instances.mjs +2 -2
- package/dist/resources/triggers-types.d.mts +1 -1
- package/dist/resources/triggers-types.mjs +1 -1
- package/dist/resources/webhook-endpoints.d.mts +1 -1
- package/dist/resources/webhook-endpoints.mjs +1 -1
- package/dist/resources/webhook-subscriptions.d.mts +1 -1
- package/dist/resources/webhook-subscriptions.mjs +1 -1
- package/dist/{session-Do3wHYNe.mjs → session-BUYbl8BA.mjs} +39 -26
- package/dist/{session-DNm4GFO-.mjs → session-DfISYrbs.mjs} +3 -2
- package/dist/{client-CK6bm7nf.d.mts → session-configs-CipRvstF.d.mts} +5450 -1009
- package/dist/{tool-router-5OfsPkJ_.mjs → tool-router-DJQ12uhs.mjs} +1 -1
- package/dist/toolkits-CbdyRtvr.mjs +62 -0
- package/dist/tools-DiH6dAto.mjs +69 -0
- package/dist/tools-a29E_8La.mjs +33 -0
- package/dist/{trigger-instances-lkKWqHgd.mjs → trigger-instances-Bg0n7X-d.mjs} +8 -6
- package/dist/{triggers-DNx9yjbS.mjs → triggers-BoSFNGss.mjs} +6 -4
- package/dist/triggers-types-BPtTEwUA.mjs +34 -0
- package/dist/{usage-CKyu9RzD.mjs → usage-CHVyZ3tm.mjs} +7 -5
- package/dist/{usage-Cv9VNy5H.mjs → usage-Cs10eWCd.mjs} +7 -5
- package/dist/{webhook-endpoints-DIyg3YlR.mjs → webhook-endpoints-B4lZc5YC.mjs} +15 -10
- package/dist/webhook-subscriptions-DJTSJd6K.mjs +55 -0
- package/package.json +21 -6
- package/dist/cli-Bi4_ORQO.mjs +0 -45
- package/dist/mcp-B0wla_93.mjs +0 -73
- package/dist/project-C0h91WGF.mjs +0 -42
- package/dist/realtime-BcHoYszT.mjs +0 -26
- package/dist/toolkits-CcE90C2S.mjs +0 -43
- package/dist/tools-B5uEInC8.mjs +0 -30
- package/dist/tools-CdVgfSpk.mjs +0 -63
- package/dist/triggers-types-MjEcrPbH.mjs +0 -31
- package/dist/webhook-subscriptions-B7AgTACq.mjs +0 -48
|
@@ -1,75 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as APIUserAbortError, n as APIConnectionTimeoutError, s as ComposioError, t as APIConnectionError } from "./error-DLB1uKM3.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/compat/headers.ts
|
|
4
|
+
const hasEntries = (value) => typeof value === "object" && value !== null && "append" in value && typeof value.append === "function" && "delete" in value && typeof value.delete === "function" && "entries" in value && typeof value.entries === "function" && "get" in value && typeof value.get === "function";
|
|
5
|
+
const isHeaders = (value) => value instanceof Headers || hasEntries(value);
|
|
6
|
+
const isNullableHeadersLike = (headers) => {
|
|
7
|
+
if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
|
|
8
|
+
const nulls = headers.nulls;
|
|
9
|
+
return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
|
|
10
|
+
};
|
|
2
11
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `headers` on these classes (see docs/research/drop-in-contract.md §4), so
|
|
7
|
-
* both the class names and the inheritance chain are part of the drop-in
|
|
8
|
-
* contract: `BadRequestError extends APIError extends ComposioError extends Error`.
|
|
12
|
+
* Iterates every supported input while preserving explicit deletions. Plain
|
|
13
|
+
* objects replace an older value for a key; tuple inputs append duplicate
|
|
14
|
+
* values, matching the published client.
|
|
9
15
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** JSON body of the response that caused the error. */
|
|
17
|
-
error;
|
|
18
|
-
constructor(status, error, message, headers) {
|
|
19
|
-
super(APIError.makeMessage(status, error, message));
|
|
20
|
-
this.status = status;
|
|
21
|
-
this.headers = headers;
|
|
22
|
-
this.error = error;
|
|
23
|
-
}
|
|
24
|
-
static makeMessage(status, error, message) {
|
|
25
|
-
const errorMessage = error?.message;
|
|
26
|
-
const msg = errorMessage ? typeof errorMessage === "string" ? errorMessage : JSON.stringify(errorMessage) : error ? JSON.stringify(error) : message;
|
|
27
|
-
if (status && msg) return `${status} ${msg}`;
|
|
28
|
-
if (status) return `${status} status code (no body)`;
|
|
29
|
-
if (msg) return msg;
|
|
30
|
-
return "(no status code or body)";
|
|
31
|
-
}
|
|
32
|
-
static generate(status, errorResponse, message, headers) {
|
|
33
|
-
if (!status || !headers) return new APIConnectionError({
|
|
34
|
-
message,
|
|
35
|
-
cause: errorResponse
|
|
36
|
-
});
|
|
37
|
-
const error = errorResponse;
|
|
38
|
-
if (status === 400) return new BadRequestError(status, error, message, headers);
|
|
39
|
-
if (status === 401) return new AuthenticationError(status, error, message, headers);
|
|
40
|
-
if (status === 403) return new PermissionDeniedError(status, error, message, headers);
|
|
41
|
-
if (status === 404) return new NotFoundError(status, error, message, headers);
|
|
42
|
-
if (status === 409) return new ConflictError(status, error, message, headers);
|
|
43
|
-
if (status === 422) return new UnprocessableEntityError(status, error, message, headers);
|
|
44
|
-
if (status === 429) return new RateLimitError(status, error, message, headers);
|
|
45
|
-
if (status >= 500) return new InternalServerError(status, error, message, headers);
|
|
46
|
-
return new APIError(status, error, message, headers);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var APIUserAbortError = class extends APIError {
|
|
50
|
-
constructor({ message } = {}) {
|
|
51
|
-
super(void 0, void 0, message ?? "Request was aborted.", void 0);
|
|
16
|
+
function* iterateHeaders(headers) {
|
|
17
|
+
if (!headers) return;
|
|
18
|
+
if (isNullableHeadersLike(headers)) {
|
|
19
|
+
yield* headers.values.entries();
|
|
20
|
+
for (const name of headers.nulls) yield [name, null];
|
|
21
|
+
return;
|
|
52
22
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
23
|
+
const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
|
|
24
|
+
const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
const name = entry[0];
|
|
27
|
+
if (typeof name !== "string") throw new TypeError("expected header name to be a string");
|
|
28
|
+
const rawValue = entry[1];
|
|
29
|
+
const values = Array.isArray(rawValue) ? rawValue : [rawValue];
|
|
30
|
+
let replaced = false;
|
|
31
|
+
for (const value of values) {
|
|
32
|
+
if (value === void 0) continue;
|
|
33
|
+
if (shouldReplace && !replaced) {
|
|
34
|
+
replaced = true;
|
|
35
|
+
yield [name, null];
|
|
36
|
+
}
|
|
37
|
+
yield [name, value];
|
|
38
|
+
}
|
|
58
39
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
}
|
|
41
|
+
/** Merge sources while retaining names explicitly deleted by the last source. */
|
|
42
|
+
const mergeHeaders = (sources) => {
|
|
43
|
+
const values = new Headers();
|
|
44
|
+
const nulls = /* @__PURE__ */ new Set();
|
|
45
|
+
for (const source of sources) {
|
|
46
|
+
if (!source) continue;
|
|
47
|
+
const seen = /* @__PURE__ */ new Set();
|
|
48
|
+
for (const [name, value] of iterateHeaders(source)) {
|
|
49
|
+
const lowerName = name.toLowerCase();
|
|
50
|
+
if (!seen.has(lowerName)) {
|
|
51
|
+
values.delete(name);
|
|
52
|
+
seen.add(lowerName);
|
|
53
|
+
}
|
|
54
|
+
if (value === null) {
|
|
55
|
+
values.delete(name);
|
|
56
|
+
nulls.add(lowerName);
|
|
57
|
+
} else {
|
|
58
|
+
values.append(name, value);
|
|
59
|
+
nulls.delete(lowerName);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
63
62
|
}
|
|
63
|
+
return {
|
|
64
|
+
values,
|
|
65
|
+
nulls
|
|
66
|
+
};
|
|
64
67
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var PermissionDeniedError = class extends APIError {};
|
|
68
|
-
var NotFoundError = class extends APIError {};
|
|
69
|
-
var ConflictError = class extends APIError {};
|
|
70
|
-
var UnprocessableEntityError = class extends APIError {};
|
|
71
|
-
var RateLimitError = class extends APIError {};
|
|
72
|
-
var InternalServerError = class extends APIError {};
|
|
68
|
+
/** Merge sources into the native header collection sent to fetch. */
|
|
69
|
+
const buildHeaders = (sources) => mergeHeaders(sources).values;
|
|
73
70
|
|
|
74
71
|
//#endregion
|
|
75
72
|
//#region src/compat/credentials.ts
|
|
@@ -89,8 +86,9 @@ var InternalServerError = class extends APIError {};
|
|
|
89
86
|
* decides which one that is. See wayfinder ticket 48 and §4 of
|
|
90
87
|
* `docs/research/drop-in-contract.md`.
|
|
91
88
|
* 1. **A credentialed API origin must use HTTPS.** Plain `http:` is permitted
|
|
92
|
-
* only for loopback development endpoints
|
|
93
|
-
*
|
|
89
|
+
* only for loopback development endpoints, or for the exact origin a
|
|
90
|
+
* caller opts into with `allowInsecureHTTP` or
|
|
91
|
+
* `COMPOSIO_ALLOW_INSECURE_HTTP=1`.
|
|
94
92
|
* Enforced by {@link assertCredentialTransport} at construction and again
|
|
95
93
|
* by {@link credentialForRequest} at dispatch, because `apiKey` and
|
|
96
94
|
* `baseURL` are both public mutable fields on the client.
|
|
@@ -257,10 +255,23 @@ const parseHTTPURL = (value) => {
|
|
|
257
255
|
return null;
|
|
258
256
|
}
|
|
259
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
* The URL `target` names, resolved against `base`, when it lands on http(s);
|
|
260
|
+
* `null` when it cannot be parsed or names a scheme this client does not
|
|
261
|
+
* speak. The one spelling of "resolve against a base, http(s) only" — the
|
|
262
|
+
* redirect follower and the deprecation link resolver both need exactly this.
|
|
263
|
+
*/
|
|
264
|
+
const resolveHTTPURL = (target, base) => {
|
|
265
|
+
try {
|
|
266
|
+
return parseHTTPURL(new URL(target, base).href);
|
|
267
|
+
} catch {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
260
271
|
/** Whether a credential may be sent to this origin at all. */
|
|
261
|
-
const isCredentialSafeOrigin = (url) => url.protocol === "https:" || url.protocol === "http:" && isLoopbackHostname(url.hostname);
|
|
272
|
+
const isCredentialSafeOrigin = (url, allowedHTTPOrigin = null) => url.protocol === "https:" || url.protocol === "http:" && (isLoopbackHostname(url.hostname) || allowedHTTPOrigin !== null && url.origin === allowedHTTPOrigin);
|
|
262
273
|
const LOOPBACK_DESCRIPTION = "localhost, *.localhost, 127.0.0.0/8, [::1]";
|
|
263
|
-
const insecureOriginMessage = (baseURL) => `Refusing to send a Composio API credential to ${baseURL}: a credentialed API origin must use HTTPS.
|
|
274
|
+
const insecureOriginMessage = (baseURL) => `Refusing to send a Composio API credential to ${baseURL}: a credentialed API origin must use HTTPS. By default, plain http:// is permitted only for loopback development endpoints (${LOOPBACK_DESCRIPTION}). Pass an https:// baseURL, use environment: 'local', set allowInsecureHTTP: true (or COMPOSIO_ALLOW_INSECURE_HTTP=1) for the configured development origin, or construct the client without credentials.`;
|
|
264
275
|
/** Whether the client holds anything at all that rule 1 has to protect. */
|
|
265
276
|
const anyCredential = (credentials) => credentials.apiKey !== null || hasAlternateCredential(credentials);
|
|
266
277
|
/**
|
|
@@ -276,10 +287,10 @@ const anyCredential = (credentials) => credentials.apiKey !== null || hasAlterna
|
|
|
276
287
|
* request carries is decided per operation, so a client holding *any* of them
|
|
277
288
|
* is a client that can put one on the wire.
|
|
278
289
|
*/
|
|
279
|
-
const assertCredentialTransport = (baseURL, credentials) => {
|
|
290
|
+
const assertCredentialTransport = (baseURL, credentials, allowedHTTPOrigin = null) => {
|
|
280
291
|
if (!anyCredential(credentials)) return;
|
|
281
292
|
const url = parseHTTPURL(baseURL);
|
|
282
|
-
if (url === null || !isCredentialSafeOrigin(url)) throw new ComposioError(insecureOriginMessage(baseURL));
|
|
293
|
+
if (url === null || !isCredentialSafeOrigin(url, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
|
|
283
294
|
};
|
|
284
295
|
/**
|
|
285
296
|
* The credential this request may carry, or `null` for none.
|
|
@@ -299,20 +310,29 @@ const assertCredentialTransport = (baseURL, credentials) => {
|
|
|
299
310
|
* with credentials, so that one dies at the transport instead. httpx has no
|
|
300
311
|
* such objection, which is why the Python port checks the same thing.)
|
|
301
312
|
*/
|
|
302
|
-
const credentialForRequest = (baseURL, scheme, credentials, requestURL) => {
|
|
313
|
+
const credentialForRequest = (baseURL, scheme, credentials, requestURL, allowedHTTPOrigin = null) => {
|
|
303
314
|
const value = valueFor(scheme, credentials);
|
|
304
315
|
if (value === null) return null;
|
|
305
316
|
const base = parseHTTPURL(baseURL);
|
|
306
317
|
const target = parseHTTPURL(requestURL);
|
|
307
318
|
if (base === null || target === null) return null;
|
|
308
319
|
if (base.origin !== target.origin) return null;
|
|
309
|
-
if (!isCredentialSafeOrigin(target)) throw new ComposioError(insecureOriginMessage(baseURL));
|
|
320
|
+
if (!isCredentialSafeOrigin(target, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
|
|
310
321
|
return {
|
|
311
322
|
name: SCHEME_HEADERS[scheme],
|
|
312
323
|
value
|
|
313
324
|
};
|
|
314
325
|
};
|
|
315
326
|
/**
|
|
327
|
+
* Whether two absolute http(s) URLs share an origin, by the same test
|
|
328
|
+
* {@link credentialForRequest} applies. An unparseable side is never the same
|
|
329
|
+
* origin as anything. Python's `same_origin` is the twin.
|
|
330
|
+
*/
|
|
331
|
+
const sameOrigin = (a, b) => {
|
|
332
|
+
const origin = parseHTTPURL(a)?.origin;
|
|
333
|
+
return origin !== void 0 && origin === parseHTTPURL(b)?.origin;
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
316
336
|
* The credential headers a *caller* can place that are not the one this client
|
|
317
337
|
* attaches — `x-api-key` is excluded because a caller setting it is overriding
|
|
318
338
|
* the client's own value in the same slot, which is pinned Stainless behaviour,
|
|
@@ -336,18 +356,9 @@ const FOREIGN_CREDENTIAL_HEADERS = ["x-user-api-key", "x-org-api-key"];
|
|
|
336
356
|
* may carry `null` to delete what an earlier one set (`buildHeaders`).
|
|
337
357
|
*/
|
|
338
358
|
const callerPlacedCredential = (sources) => {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
for (const [name, value] of Object.entries(source)) {
|
|
343
|
-
const header = name.toLowerCase();
|
|
344
|
-
if (!FOREIGN_CREDENTIAL_HEADERS.includes(header)) continue;
|
|
345
|
-
if (value === void 0) continue;
|
|
346
|
-
if (value === null) placed.delete(header);
|
|
347
|
-
else placed.add(header);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return placed.size > 0;
|
|
359
|
+
if (!sources.some(Boolean)) return false;
|
|
360
|
+
const headers = buildHeaders(sources);
|
|
361
|
+
return FOREIGN_CREDENTIAL_HEADERS.some((name) => headers.has(name));
|
|
351
362
|
};
|
|
352
363
|
/**
|
|
353
364
|
* Header names that carry a credential and must not survive an origin change.
|
|
@@ -425,6 +436,32 @@ const carriesCredentials = (headers) => CREDENTIAL_HEADERS.some((name) => header
|
|
|
425
436
|
//#endregion
|
|
426
437
|
//#region src/compat/deprecation.ts
|
|
427
438
|
/**
|
|
439
|
+
* Runtime deprecation notices, read off the response.
|
|
440
|
+
*
|
|
441
|
+
* The server announces a deprecated operation with three standard fields:
|
|
442
|
+
*
|
|
443
|
+
* - `Deprecation` (RFC 9745) — an Item Structured Field whose value is a Date
|
|
444
|
+
* (RFC 9651 §3.3.7): an `@` followed by integer seconds since the Unix
|
|
445
|
+
* epoch, e.g. `Deprecation: @1688169599`.
|
|
446
|
+
* - `Sunset` (RFC 8594) — an HTTP-date, e.g. `Sunset: Sat, 31 Dec 2018
|
|
447
|
+
* 23:59:59 GMT`, naming the date the operation stops being served.
|
|
448
|
+
* - `Link` (RFC 8288) — `rel="deprecation"` points at human-readable notes
|
|
449
|
+
* (RFC 9745 registers that relation); `rel="successor-version"` (RFC 5829)
|
|
450
|
+
* points at the replacement resource, which this module maps back to a
|
|
451
|
+
* public client chain when it can.
|
|
452
|
+
*
|
|
453
|
+
* The authoring-time half of the same contract already exists: an operation
|
|
454
|
+
* the input schema marks `deprecated: true` reaches the generated method as a
|
|
455
|
+
* `@deprecated` annotation. This is the runtime half, and the two are
|
|
456
|
+
* independent — a notice fires because the *server* said so, never because the
|
|
457
|
+
* committed snapshot did, so it stays correct between spec syncs.
|
|
458
|
+
*
|
|
459
|
+
* Everything here is defensive by construction. A deprecation notice is
|
|
460
|
+
* advisory; it must never break a live call, so a field that is oversized,
|
|
461
|
+
* carries control characters, or simply does not parse is dropped rather than
|
|
462
|
+
* raised.
|
|
463
|
+
*/
|
|
464
|
+
/**
|
|
428
465
|
* Field-size ceiling. A deprecation notice is decoration on a response that
|
|
429
466
|
* has already been paid for, so an oversized field is dropped rather than
|
|
430
467
|
* parsed — there is no message worth building out of 2 KiB of `Link`.
|
|
@@ -633,14 +670,7 @@ const parseLinkField = (value) => {
|
|
|
633
670
|
}
|
|
634
671
|
return links;
|
|
635
672
|
};
|
|
636
|
-
const httpURL = (target, baseURL) =>
|
|
637
|
-
try {
|
|
638
|
-
const url = new URL(target, baseURL);
|
|
639
|
-
return url.protocol === "http:" || url.protocol === "https:" ? url : null;
|
|
640
|
-
} catch {
|
|
641
|
-
return null;
|
|
642
|
-
}
|
|
643
|
-
};
|
|
673
|
+
const httpURL = (target, baseURL) => resolveHTTPURL(target, baseURL);
|
|
644
674
|
/**
|
|
645
675
|
* A successor is only followed as far as *naming* it, and only when it lands
|
|
646
676
|
* on the API this client is configured against.
|
|
@@ -686,6 +716,20 @@ const parseDeprecation = (headers, contextURL, baseURL) => {
|
|
|
686
716
|
};
|
|
687
717
|
};
|
|
688
718
|
const pathSegments = (path) => (path.split(/[?#]/, 1)[0] ?? "").split("/").filter((segment) => segment !== "");
|
|
719
|
+
/**
|
|
720
|
+
* Template segments, keyed by descriptor so the cache holds only entries the
|
|
721
|
+
* operations table (or a test's stand-in for it) is still keeping alive. The
|
|
722
|
+
* table is module-level and immutable, so every logical call re-split the same
|
|
723
|
+
* 104 templates for nothing once the match became unconditional.
|
|
724
|
+
*/
|
|
725
|
+
const templateSegments = /* @__PURE__ */ new WeakMap();
|
|
726
|
+
const segmentsOf = (operation) => {
|
|
727
|
+
const cached = templateSegments.get(operation);
|
|
728
|
+
if (cached !== void 0) return cached;
|
|
729
|
+
const segments = pathSegments(operation.path);
|
|
730
|
+
templateSegments.set(operation, segments);
|
|
731
|
+
return segments;
|
|
732
|
+
};
|
|
689
733
|
const isTemplateParam = (segment) => segment.startsWith("{") && segment.endsWith("}");
|
|
690
734
|
/**
|
|
691
735
|
* The operation a dispatched request belongs to, recovered from the path it
|
|
@@ -699,17 +743,20 @@ const isTemplateParam = (segment) => segment.startsWith("{") && segment.endsWith
|
|
|
699
743
|
* (`/toolkits/{slug}` against `/toolkits/categories`) the literal wins, which
|
|
700
744
|
* is the same most-specific-first rule the server routes by.
|
|
701
745
|
*
|
|
702
|
-
* **Known limit of recovering identity from the path
|
|
703
|
-
* byte-identical requests —
|
|
746
|
+
* **Known limit of recovering identity from the path**, and who still pays
|
|
747
|
+
* it. Two accessors can emit byte-identical requests —
|
|
748
|
+
* `client.toolkits.retrieve('categories')` and
|
|
704
749
|
* `client.toolkits.retrieveCategories()` both dispatch
|
|
705
750
|
* `GET /api/v3.1/toolkits/categories` — so nothing observable distinguishes
|
|
706
|
-
* them here and the literal sibling is always the one named.
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
751
|
+
* them here and the literal sibling is always the one named. That is inherent
|
|
752
|
+
* to reverse-matching, not a bug in the matcher.
|
|
753
|
+
*
|
|
754
|
+
* Generated calls no longer reach this function at all: each one carries its
|
|
755
|
+
* own descriptor through dispatch (`withOperation` in `request.ts`), so
|
|
756
|
+
* `toolkits.retrieve('categories')` is now named as itself. What is left here
|
|
757
|
+
* is the escape hatch — `client.get('/api/v3.1/toolkits/categories')` — whose
|
|
758
|
+
* identity genuinely is not knowable before runtime, and for which naming the
|
|
759
|
+
* literal sibling remains the honest answer.
|
|
713
760
|
*/
|
|
714
761
|
const matchOperation = (method, path, operations) => {
|
|
715
762
|
const segments = pathSegments(path);
|
|
@@ -717,7 +764,7 @@ const matchOperation = (method, path, operations) => {
|
|
|
717
764
|
let bestLiterals = -1;
|
|
718
765
|
for (const operation of operations) {
|
|
719
766
|
if (operation.method !== method) continue;
|
|
720
|
-
const template =
|
|
767
|
+
const template = segmentsOf(operation);
|
|
721
768
|
if (template.length !== segments.length) continue;
|
|
722
769
|
let literals = 0;
|
|
723
770
|
let matched = true;
|
|
@@ -792,10 +839,10 @@ const noticeKey = (notice) => [
|
|
|
792
839
|
* same `Response` to `asResponse()`, `withResponse()` and the parsed path
|
|
793
840
|
* alike.
|
|
794
841
|
*/
|
|
795
|
-
const inspectDeprecation = ({ response, method, path, baseURL, operations, seen, warn }) => {
|
|
842
|
+
const inspectDeprecation = ({ response, method, path, operation: known, baseURL, operations, seen, warn }) => {
|
|
796
843
|
const notice = parseDeprecation(response.headers, response.url || baseURL, baseURL);
|
|
797
844
|
if (notice === null) return;
|
|
798
|
-
const operation = matchOperation(method, path, operations);
|
|
845
|
+
const operation = known ?? matchOperation(method, path, operations);
|
|
799
846
|
const key = `${operation === null ? `${method} ${pathSegments(path).join("/")}` : operation.chain.join(".")}${KEY_SEPARATOR}${noticeKey(notice)}`;
|
|
800
847
|
if (seen.has(key)) return;
|
|
801
848
|
if (seen.size >= MAX_TRACKED_NOTICES) return;
|
|
@@ -804,10 +851,176 @@ const inspectDeprecation = ({ response, method, path, baseURL, operations, seen,
|
|
|
804
851
|
const subject = operation === null ? `${method.toUpperCase()} ${path}` : chainLabel(operation.chain);
|
|
805
852
|
warn(formatDeprecationWarning(subject, notice, successorChain));
|
|
806
853
|
};
|
|
854
|
+
/**
|
|
855
|
+
* The keys a value map will actually carry on the wire. Both serializers drop
|
|
856
|
+
* an entry whose value is `undefined` outright — `JSON.stringify` for a body
|
|
857
|
+
* property, `stringifyQuery` for a query entry — while `null` is sent (JSON
|
|
858
|
+
* `null`, or `key=`), so only `undefined` reads as "not sent". `bodyKeys`
|
|
859
|
+
* relies on the same rule for its half of the surface.
|
|
860
|
+
*/
|
|
861
|
+
const presentKeys = (values) => new Set(Object.entries(values).filter(([, value]) => value !== void 0).map(([key]) => key));
|
|
862
|
+
/**
|
|
863
|
+
* The keys `body` will actually carry on the wire, at its top level, when it
|
|
864
|
+
* is a plain object — `presentKeys` over it, narrowed to objects: a resource
|
|
865
|
+
* method always passes an object (even an omitted optional body arrives as
|
|
866
|
+
* `{}`), so this covers every real call; a non-object `body` (the raw escape
|
|
867
|
+
* hatch dispatching something else entirely) has no top-level keys to check.
|
|
868
|
+
*/
|
|
869
|
+
const bodyKeys = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? presentKeys(body) : /* @__PURE__ */ new Set();
|
|
870
|
+
/**
|
|
871
|
+
* The static parameter-level warning: fires when the client sends an input
|
|
872
|
+
* the committed spec marks `deprecated: true`, decided entirely from the
|
|
873
|
+
* request the caller is about to send. Unlike `inspectDeprecation`, this
|
|
874
|
+
* needs no response — it runs before dispatch, so a connection failure never
|
|
875
|
+
* swallows it.
|
|
876
|
+
*
|
|
877
|
+
* One notice per (operation, sorted set of deprecated wire names present) per
|
|
878
|
+
* client instance, but every input in that set is named in its own `warn`
|
|
879
|
+
* call — the once-only key only suppresses an exact-repeat call, it does not
|
|
880
|
+
* collapse several inputs on one call into a single message.
|
|
881
|
+
*/
|
|
882
|
+
const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen, warn }) => {
|
|
883
|
+
if (operation === null) return;
|
|
884
|
+
const declared = table.get(operation.chain.join("."));
|
|
885
|
+
if (declared === void 0 || declared.length === 0) return;
|
|
886
|
+
const queryKeys = presentKeys(query);
|
|
887
|
+
const bodyKeySet = bodyKeys(body);
|
|
888
|
+
const present = declared.filter((input) => {
|
|
889
|
+
if (input.in === "query") return queryKeys.has(input.wire);
|
|
890
|
+
if (input.in === "body") return bodyKeySet.has(input.wire);
|
|
891
|
+
return headers.has(input.wire);
|
|
892
|
+
});
|
|
893
|
+
if (present.length === 0) return;
|
|
894
|
+
const wireSet = [...new Set(present.map((input) => input.wire))].sort();
|
|
895
|
+
const key = `param${KEY_SEPARATOR}${operation.chain.join(".")}${KEY_SEPARATOR}${wireSet.join(",")}`;
|
|
896
|
+
if (seen.has(key)) return;
|
|
897
|
+
if (seen.size >= MAX_TRACKED_NOTICES) return;
|
|
898
|
+
seen.add(key);
|
|
899
|
+
const subject = chainLabel(operation.chain);
|
|
900
|
+
for (const input of present) {
|
|
901
|
+
const clause = input.replacementWire === null ? "" : ` Use \`${input.replacementWire}\` instead.`;
|
|
902
|
+
warn(`Composio: the \`${input.wire}\` parameter of ${subject} is deprecated.${clause}`);
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
//#endregion
|
|
907
|
+
//#region src/version.ts
|
|
908
|
+
const VERSION = "2.0.0-rc.11";
|
|
909
|
+
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/compat/telemetry.ts
|
|
912
|
+
/**
|
|
913
|
+
* The runtime label and version, first match wins. Workers and Vercel Edge are
|
|
914
|
+
* checked before Node because `nodejs_compat` and edge polyfills can expose
|
|
915
|
+
* `process.versions.node`; neither reports a version, so a polyfilled Node
|
|
916
|
+
* version is never sent as theirs.
|
|
917
|
+
*/
|
|
918
|
+
const detectRuntime = () => {
|
|
919
|
+
const g = globalThis;
|
|
920
|
+
if (g.Bun !== void 0) return ["bun", g.Bun.version];
|
|
921
|
+
if (g.Deno !== void 0) return ["deno", g.Deno.version?.deno];
|
|
922
|
+
if (g.navigator?.userAgent === "Cloudflare-Workers" || g.caches !== void 0 && g.WebSocketPair !== void 0) return ["cloudflare", void 0];
|
|
923
|
+
if (g.EdgeRuntime !== void 0) return ["vercel_edge", void 0];
|
|
924
|
+
if (typeof process !== "undefined" && process.versions?.node) return ["nodejs", process.versions.node];
|
|
925
|
+
if (typeof g.ServiceWorkerGlobalScope === "function" && globalThis instanceof g.ServiceWorkerGlobalScope) return ["service_worker", void 0];
|
|
926
|
+
if (g.WorkerGlobalScope !== void 0 && typeof g.importScripts === "function") return ["web_worker", void 0];
|
|
927
|
+
if (g.navigator?.product === "ReactNative") return ["react_native", void 0];
|
|
928
|
+
if (g.window !== void 0 && g.document !== void 0) return ["browser", void 0];
|
|
929
|
+
return ["unknown", void 0];
|
|
930
|
+
};
|
|
931
|
+
/** Caller headers override these defaults, including the calling SDK's identity. */
|
|
932
|
+
const clientTelemetryHeaders = () => {
|
|
933
|
+
const [runtime, version] = detectRuntime();
|
|
934
|
+
const headers = {
|
|
935
|
+
"x-client-provenance": "@composio/client",
|
|
936
|
+
"x-client-version": VERSION,
|
|
937
|
+
"x-client-library": "@composio/client",
|
|
938
|
+
"x-client-library-version": VERSION,
|
|
939
|
+
"x-client-language": "typescript",
|
|
940
|
+
"x-client-runtime": runtime,
|
|
941
|
+
"x-runtime": runtime
|
|
942
|
+
};
|
|
943
|
+
if (version) headers["x-runtime-version"] = version;
|
|
944
|
+
return headers;
|
|
945
|
+
};
|
|
807
946
|
|
|
808
947
|
//#endregion
|
|
809
948
|
//#region src/compat/request.ts
|
|
810
949
|
/**
|
|
950
|
+
* Where a generated call records *which operation it is*.
|
|
951
|
+
*
|
|
952
|
+
* A resource method knows its own identity at code-generation time, and until
|
|
953
|
+
* now threw it away: dispatch carried only a method and a substituted path, so
|
|
954
|
+
* the kernel recovered the operation by matching that path back against all
|
|
955
|
+
* 104 templates on every single request (`matchOperation`). Recovery is still
|
|
956
|
+
* the right answer for an escape-hatch `client.get('/api/v3.1/…')`, whose
|
|
957
|
+
* identity genuinely is not knowable until runtime — but for a generated call
|
|
958
|
+
* it re-derives a fact the call site already had.
|
|
959
|
+
*
|
|
960
|
+
* The channel is a module-private symbol rather than a `RequestOptions`
|
|
961
|
+
* property, because `RequestOptions` is the Stainless options bag and its
|
|
962
|
+
* shape is the product (`test/types/*.test-d.ts` pins it structurally). A
|
|
963
|
+
* symbol key is invisible to that pinning, to `Object.keys`, to
|
|
964
|
+
* `JSON.stringify`, and to every serializer in this file — the descriptor
|
|
965
|
+
* reaches the kernel without becoming part of any public type or any byte on
|
|
966
|
+
* the wire.
|
|
967
|
+
*
|
|
968
|
+
* It is deliberately *enumerable*: `client.get()` re-spreads the options bag
|
|
969
|
+
* into `request()`, and object spread copies enumerable own symbols. A
|
|
970
|
+
* non-enumerable definition would silently drop the descriptor there and
|
|
971
|
+
* degrade every generated call back to matching, which is exactly the kind of
|
|
972
|
+
* regression that measures fine and reports nothing.
|
|
973
|
+
*/
|
|
974
|
+
const OPERATION = Symbol("composio.operation");
|
|
975
|
+
/**
|
|
976
|
+
* Attach a generated call's operation to the options bag it dispatches with.
|
|
977
|
+
*
|
|
978
|
+
* Called with the freshly built literal — never with the caller's own object —
|
|
979
|
+
* and *after* the caller's options have been spread into it, so a caller
|
|
980
|
+
* cannot pre-empt the descriptor: the write happens last, and the key it
|
|
981
|
+
* writes to is not one a caller can name.
|
|
982
|
+
*/
|
|
983
|
+
const withOperation = (operation, options) => {
|
|
984
|
+
options[OPERATION] = operation;
|
|
985
|
+
return options;
|
|
986
|
+
};
|
|
987
|
+
/** The operation a generated call recorded, or `undefined` for a raw one. */
|
|
988
|
+
const readOperation = (options) => options[OPERATION];
|
|
989
|
+
/** A request label safe to print: dynamic path values and URL secrets are excluded. */
|
|
990
|
+
const printableURL = (url, operation) => `${new URL(url).origin}${operation?.path ?? "/<custom>"}`;
|
|
991
|
+
const emitLog = (config, level, message, metadata) => {
|
|
992
|
+
try {
|
|
993
|
+
config.onLog?.(level, message, metadata);
|
|
994
|
+
} catch {}
|
|
995
|
+
};
|
|
996
|
+
const monotonicMillis = () => globalThis.performance?.now?.() ?? Date.now();
|
|
997
|
+
const elapsedMillis = (startedAt) => Math.max(0, monotonicMillis() - startedAt);
|
|
998
|
+
/**
|
|
999
|
+
* Settle a dispatch when its signal aborts even if a custom transport ignores
|
|
1000
|
+
* the signal. The transport promise keeps a rejection handler after abort so
|
|
1001
|
+
* a late failure cannot become an unhandled rejection.
|
|
1002
|
+
*/
|
|
1003
|
+
const settleOnAbort = (promise, signal) => new Promise((resolve, reject) => {
|
|
1004
|
+
let settled = false;
|
|
1005
|
+
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
1006
|
+
const finish = (settle, value) => {
|
|
1007
|
+
if (settled) return;
|
|
1008
|
+
settled = true;
|
|
1009
|
+
cleanup();
|
|
1010
|
+
settle(value);
|
|
1011
|
+
};
|
|
1012
|
+
const fail = (reason) => {
|
|
1013
|
+
if (settled) return;
|
|
1014
|
+
settled = true;
|
|
1015
|
+
cleanup();
|
|
1016
|
+
reject(reason);
|
|
1017
|
+
};
|
|
1018
|
+
const onAbort = () => fail(/* @__PURE__ */ new Error("Request aborted"));
|
|
1019
|
+
promise.then((value) => finish(resolve, value), fail);
|
|
1020
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
1021
|
+
if (signal.aborted) onAbort();
|
|
1022
|
+
});
|
|
1023
|
+
/**
|
|
811
1024
|
* Percent-encode everything that isn't a RFC-3986 pchar, leaving safe chars
|
|
812
1025
|
* (unreserved / sub-delims / ":" / "@") readable.
|
|
813
1026
|
*/
|
|
@@ -865,23 +1078,10 @@ const buildURL = (config, options) => {
|
|
|
865
1078
|
};
|
|
866
1079
|
const search = stringifyQuery(query);
|
|
867
1080
|
if (search) url.search = search;
|
|
868
|
-
return
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
* value deletes the header, `undefined` leaves it untouched.
|
|
873
|
-
*/
|
|
874
|
-
const buildHeaders = (sources) => {
|
|
875
|
-
const headers = new Headers();
|
|
876
|
-
for (const source of sources) {
|
|
877
|
-
if (!source) continue;
|
|
878
|
-
for (const [name, value] of Object.entries(source)) {
|
|
879
|
-
if (value === void 0) continue;
|
|
880
|
-
if (value === null) headers.delete(name);
|
|
881
|
-
else headers.set(name, value);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
return headers;
|
|
1081
|
+
return {
|
|
1082
|
+
url: url.toString(),
|
|
1083
|
+
query
|
|
1084
|
+
};
|
|
885
1085
|
};
|
|
886
1086
|
/**
|
|
887
1087
|
* JSON body encoding. A resource method always passes the `body` key when its
|
|
@@ -1009,28 +1209,35 @@ const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times;
|
|
|
1009
1209
|
const OPAQUE_REDIRECT = "The API responded with a redirect that this runtime will not let the client read (an opaque redirect, in a browser). Redirects are followed only where the response can be inspected, because a credential must never cross an origin change.";
|
|
1010
1210
|
const isOpaqueRedirect = (response) => response.type === "opaqueredirect";
|
|
1011
1211
|
/**
|
|
1012
|
-
* Fetch's own method rewrite (§4.4 "HTTP-redirect fetch", step 13): a 303
|
|
1013
|
-
* turns any non-GET into a GET, and a 301/302 does the same to a POST — both
|
|
1014
|
-
* dropping the body. 307 and 308 preserve the method and the body, which is
|
|
1015
|
-
* what they exist for. Following by hand means reproducing this, or a caller's
|
|
1016
|
-
* POST silently becomes a POST to somewhere it was never sent before.
|
|
1017
|
-
*/
|
|
1018
|
-
/**
|
|
1019
1212
|
* The `Location` a hop points at, resolved against the URL it arrived on, or
|
|
1020
1213
|
* `null` when there is nothing followable there — unparseable, or a scheme
|
|
1021
1214
|
* this client does not speak (`data:`, `file:`, an app link). `null` hands the
|
|
1022
1215
|
* 3xx back as the response it is, which is what `fetch` does with a `Location`
|
|
1023
1216
|
* it cannot use.
|
|
1024
1217
|
*/
|
|
1025
|
-
const resolveLocation = (location, from) =>
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1218
|
+
const resolveLocation = (location, from) => resolveHTTPURL(location, from);
|
|
1219
|
+
/**
|
|
1220
|
+
* Fetch's own method rewrite (§4.4 "HTTP-redirect fetch", step 13): a 303
|
|
1221
|
+
* turns any non-GET into a GET, and a 301/302 does the same to a POST — both
|
|
1222
|
+
* dropping the body. 307 and 308 preserve the method and the body, which is
|
|
1223
|
+
* what they exist for. Following by hand means reproducing this, or a caller's
|
|
1224
|
+
* POST silently becomes a POST to somewhere it was never sent before.
|
|
1225
|
+
*/
|
|
1032
1226
|
const rewriteForRedirect = (status, method) => status === 303 && method !== "GET" && method !== "HEAD" || (status === 301 || status === 302) && method === "POST";
|
|
1033
|
-
const sleep = (ms
|
|
1227
|
+
const sleep = (ms, signal) => {
|
|
1228
|
+
if (signal?.aborted) return Promise.reject(new APIUserAbortError());
|
|
1229
|
+
return new Promise((resolve, reject) => {
|
|
1230
|
+
const onAbort = () => {
|
|
1231
|
+
clearTimeout(timer);
|
|
1232
|
+
reject(new APIUserAbortError());
|
|
1233
|
+
};
|
|
1234
|
+
const timer = setTimeout(() => {
|
|
1235
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1236
|
+
resolve();
|
|
1237
|
+
}, ms);
|
|
1238
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1239
|
+
});
|
|
1240
|
+
};
|
|
1034
1241
|
/**
|
|
1035
1242
|
* Indirection over `sleep` so kernel tests can capture retry delays instead
|
|
1036
1243
|
* of waiting them out on the wall clock. Internal seam only — deliberately
|
|
@@ -1047,11 +1254,27 @@ const kernelInternals = { sleep };
|
|
|
1047
1254
|
* simply does not get a key. `withdrawn` covers what that cannot — the
|
|
1048
1255
|
* caller's own credential headers, which are legitimate on the URL the caller
|
|
1049
1256
|
* chose and are dropped once the *server* has chosen one.
|
|
1257
|
+
*
|
|
1258
|
+
* The client's identity headers follow the same per-hop rule: they describe
|
|
1259
|
+
* this client to its own API, so a hop off the configured origin (a presigned
|
|
1260
|
+
* storage URL, a redirect target) goes without them.
|
|
1050
1261
|
*/
|
|
1051
|
-
const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme) => {
|
|
1052
|
-
const credential = withdrawn ||
|
|
1262
|
+
const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
|
|
1263
|
+
const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL, config.allowedHTTPOrigin);
|
|
1264
|
+
const identity = sameOrigin(config.baseURL, requestURL) ? clientTelemetryHeaders() : void 0;
|
|
1265
|
+
if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
|
|
1266
|
+
const direct = new Headers({
|
|
1267
|
+
...identity,
|
|
1268
|
+
accept: "application/json",
|
|
1269
|
+
"user-agent": config.userAgent
|
|
1270
|
+
});
|
|
1271
|
+
if (credential !== null) direct.set(credential.name, credential.value);
|
|
1272
|
+
return direct;
|
|
1273
|
+
}
|
|
1053
1274
|
const headers = buildHeaders([
|
|
1275
|
+
{ "idempotency-key": options.idempotencyKey },
|
|
1054
1276
|
{
|
|
1277
|
+
...identity,
|
|
1055
1278
|
accept: "application/json",
|
|
1056
1279
|
"user-agent": config.userAgent
|
|
1057
1280
|
},
|
|
@@ -1073,15 +1296,18 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
|
|
|
1073
1296
|
* asked for is the honest answer for the whole chain, and rule 3 already
|
|
1074
1297
|
* withdraws everything once a hop leaves the origin.
|
|
1075
1298
|
*
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1299
|
+
* `operation` is the match `makeRequest` already computed for the static
|
|
1300
|
+
* deprecated-input check, threaded in rather than re-derived: the two
|
|
1301
|
+
* features need the same fact, so `matchOperation` runs once per logical call
|
|
1302
|
+
* regardless of which of them a given client configuration actually uses.
|
|
1303
|
+
* With only `apiKey` set the scheme answer is still `ApiKeyAuth` down every
|
|
1304
|
+
* branch of {@link selectScheme}, so an existing caller's requests stay
|
|
1305
|
+
* byte-identical by construction; what changed is that the match itself is no
|
|
1306
|
+
* longer skippable, because the deprecated-input warning needs it too.
|
|
1081
1307
|
*/
|
|
1082
|
-
const schemeForRequest = (config,
|
|
1308
|
+
const schemeForRequest = (config, operation) => {
|
|
1083
1309
|
if (!hasAlternateCredential(config.credentials)) return "ApiKeyAuth";
|
|
1084
|
-
return selectScheme(
|
|
1310
|
+
return selectScheme(operation?.schemes, config.credentials);
|
|
1085
1311
|
};
|
|
1086
1312
|
/**
|
|
1087
1313
|
* One attempt: the request, plus however many redirects it takes to land on a
|
|
@@ -1106,10 +1332,11 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
|
|
|
1106
1332
|
let body = initialBody;
|
|
1107
1333
|
let bodyHeaders = initialBodyHeaders;
|
|
1108
1334
|
let withdrawn = false;
|
|
1335
|
+
const callerPlaced = callerPlacedCredential([config.defaultHeaders, options.headers]);
|
|
1109
1336
|
for (let hop = 0;; hop++) {
|
|
1110
|
-
const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme);
|
|
1337
|
+
const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme, callerPlaced);
|
|
1111
1338
|
const delegated = hop === 0 && !carriesCredentials(headers);
|
|
1112
|
-
const
|
|
1339
|
+
const init = {
|
|
1113
1340
|
method,
|
|
1114
1341
|
headers,
|
|
1115
1342
|
...body !== void 0 ? { body } : {},
|
|
@@ -1117,7 +1344,8 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
|
|
|
1117
1344
|
...options.fetchOptions,
|
|
1118
1345
|
redirect: delegated ? "follow" : "manual",
|
|
1119
1346
|
signal
|
|
1120
|
-
}
|
|
1347
|
+
};
|
|
1348
|
+
const response = config.transport === void 0 ? await config.fetch.call(void 0, url, init) : await settleOnAbort(config.transport.send(new Request(url, init)), signal);
|
|
1121
1349
|
if (delegated) return response;
|
|
1122
1350
|
if (isOpaqueRedirect(response)) throw new APIConnectionError({ message: OPAQUE_REDIRECT });
|
|
1123
1351
|
if (!REDIRECT_STATUSES.has(response.status)) return response;
|
|
@@ -1156,13 +1384,29 @@ async function makeRequest(config, options) {
|
|
|
1156
1384
|
const maxRetries = options.maxRetries ?? config.maxRetries;
|
|
1157
1385
|
validatePositiveInteger("maxRetries", maxRetries);
|
|
1158
1386
|
const timeout = options.timeout ?? config.timeout;
|
|
1159
|
-
const url = buildURL(config, options);
|
|
1387
|
+
const { url, query } = buildURL(config, options);
|
|
1160
1388
|
const { body, bodyHeaders } = buildBody(options);
|
|
1161
1389
|
const userSignal = options.signal ?? void 0;
|
|
1162
|
-
const
|
|
1390
|
+
const method = options.method.toUpperCase();
|
|
1391
|
+
const threaded = readOperation(options);
|
|
1392
|
+
const operation = threaded ?? matchOperation(options.method, options.path, config.operations ?? []);
|
|
1393
|
+
const requestLog = config.onLog === void 0 ? void 0 : {
|
|
1394
|
+
method,
|
|
1395
|
+
url: printableURL(url, operation),
|
|
1396
|
+
maxAttempts: maxRetries + 1
|
|
1397
|
+
};
|
|
1398
|
+
const scheme = schemeForRequest(config, operation);
|
|
1399
|
+
if (config.onRequest !== void 0 && (threaded === void 0 || threaded.hasDeprecatedInputs === true)) config.onRequest(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
|
|
1163
1400
|
for (let numRetries = 0;; numRetries++) {
|
|
1164
1401
|
if (userSignal?.aborted) throw new APIUserAbortError();
|
|
1402
|
+
const attempt = numRetries + 1;
|
|
1165
1403
|
const retriesRemaining = maxRetries - numRetries;
|
|
1404
|
+
const startedAt = requestLog === void 0 ? 0 : monotonicMillis();
|
|
1405
|
+
const attemptLog = requestLog === void 0 ? void 0 : {
|
|
1406
|
+
...requestLog,
|
|
1407
|
+
attempt
|
|
1408
|
+
};
|
|
1409
|
+
if (attemptLog !== void 0) emitLog(config, "debug", "Sending request", attemptLog);
|
|
1166
1410
|
const controller = new AbortController();
|
|
1167
1411
|
const abort = () => controller.abort();
|
|
1168
1412
|
userSignal?.addEventListener("abort", abort, { once: true });
|
|
@@ -1171,25 +1415,68 @@ async function makeRequest(config, options) {
|
|
|
1171
1415
|
try {
|
|
1172
1416
|
result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, scheme);
|
|
1173
1417
|
} catch (cause) {
|
|
1174
|
-
if (cause instanceof ComposioError)
|
|
1418
|
+
if (cause instanceof ComposioError) {
|
|
1419
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
|
|
1420
|
+
...attemptLog,
|
|
1421
|
+
durationMs: elapsedMillis(startedAt),
|
|
1422
|
+
errorType: cause.constructor.name
|
|
1423
|
+
});
|
|
1424
|
+
throw cause;
|
|
1425
|
+
}
|
|
1175
1426
|
result = castToError(cause);
|
|
1176
1427
|
} finally {
|
|
1177
1428
|
clearTimeout(timer);
|
|
1178
1429
|
userSignal?.removeEventListener("abort", abort);
|
|
1179
1430
|
}
|
|
1180
1431
|
if (result instanceof Error) {
|
|
1181
|
-
if (userSignal?.aborted)
|
|
1432
|
+
if (userSignal?.aborted) {
|
|
1433
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
|
|
1434
|
+
...attemptLog,
|
|
1435
|
+
durationMs: elapsedMillis(startedAt),
|
|
1436
|
+
errorType: APIUserAbortError.name
|
|
1437
|
+
});
|
|
1438
|
+
throw new APIUserAbortError();
|
|
1439
|
+
}
|
|
1182
1440
|
const isTimeout = controller.signal.aborted || /timed? ?out/i.test(String(result) + ("cause" in result ? String(result.cause) : ""));
|
|
1441
|
+
const errorType = isTimeout ? APIConnectionTimeoutError.name : APIConnectionError.name;
|
|
1442
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
|
|
1443
|
+
...attemptLog,
|
|
1444
|
+
durationMs: elapsedMillis(startedAt),
|
|
1445
|
+
errorType
|
|
1446
|
+
});
|
|
1183
1447
|
if (retriesRemaining > 0) {
|
|
1184
|
-
|
|
1448
|
+
const delayMs = retryDelayMillis(numRetries);
|
|
1449
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Retrying request", {
|
|
1450
|
+
...attemptLog,
|
|
1451
|
+
nextAttempt: attempt + 1,
|
|
1452
|
+
retriesRemaining,
|
|
1453
|
+
delayMs,
|
|
1454
|
+
reason: isTimeout ? "timeout" : "transport"
|
|
1455
|
+
});
|
|
1456
|
+
await kernelInternals.sleep(delayMs, userSignal);
|
|
1185
1457
|
continue;
|
|
1186
1458
|
}
|
|
1187
1459
|
if (isTimeout) throw new APIConnectionTimeoutError();
|
|
1188
1460
|
throw new APIConnectionError({ cause: result });
|
|
1189
1461
|
}
|
|
1462
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Received response", {
|
|
1463
|
+
...attemptLog,
|
|
1464
|
+
status: result.status,
|
|
1465
|
+
outcome: result.ok ? "success" : "http_error",
|
|
1466
|
+
durationMs: elapsedMillis(startedAt)
|
|
1467
|
+
});
|
|
1190
1468
|
if (!result.ok && retriesRemaining > 0 && shouldRetryResponse(result)) {
|
|
1191
1469
|
result.body?.cancel().catch(() => void 0);
|
|
1192
|
-
|
|
1470
|
+
const delayMs = retryDelayMillis(numRetries, result.headers);
|
|
1471
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Retrying request", {
|
|
1472
|
+
...attemptLog,
|
|
1473
|
+
nextAttempt: attempt + 1,
|
|
1474
|
+
retriesRemaining,
|
|
1475
|
+
delayMs,
|
|
1476
|
+
reason: "response",
|
|
1477
|
+
status: result.status
|
|
1478
|
+
});
|
|
1479
|
+
await kernelInternals.sleep(delayMs, userSignal);
|
|
1193
1480
|
continue;
|
|
1194
1481
|
}
|
|
1195
1482
|
if (config.onResponse !== void 0) try {
|
|
@@ -1200,4 +1487,826 @@ async function makeRequest(config, options) {
|
|
|
1200
1487
|
}
|
|
1201
1488
|
|
|
1202
1489
|
//#endregion
|
|
1203
|
-
|
|
1490
|
+
//#region src/compat/generated-operations.ts
|
|
1491
|
+
const GENERATED_OPERATIONS = [
|
|
1492
|
+
{
|
|
1493
|
+
method: "delete",
|
|
1494
|
+
path: "/api/v3.1/auth_configs/{nanoid}",
|
|
1495
|
+
chain: ["authConfigs", "delete"],
|
|
1496
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
method: "delete",
|
|
1500
|
+
path: "/api/v3.1/connected_accounts/{nanoid}",
|
|
1501
|
+
chain: ["connectedAccounts", "delete"],
|
|
1502
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
method: "delete",
|
|
1506
|
+
path: "/api/v3.1/custom/toolkits/{slug}",
|
|
1507
|
+
chain: ["custom", "deleteToolkit"],
|
|
1508
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
method: "delete",
|
|
1512
|
+
path: "/api/v3.1/mcp/servers/{serverId}/instances/{instanceId}",
|
|
1513
|
+
chain: ["mcp", "deleteInstance"]
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
method: "delete",
|
|
1517
|
+
path: "/api/v3.1/mcp/{id}",
|
|
1518
|
+
chain: ["mcp", "delete"]
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
method: "delete",
|
|
1522
|
+
path: "/api/v3.1/org/owner/project/{nano_id}",
|
|
1523
|
+
chain: [
|
|
1524
|
+
"org",
|
|
1525
|
+
"owner",
|
|
1526
|
+
"project",
|
|
1527
|
+
"delete"
|
|
1528
|
+
],
|
|
1529
|
+
schemes: ["OrgApiKeyAuth"]
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
method: "delete",
|
|
1533
|
+
path: "/api/v3.1/tool_router/session/{session_id}",
|
|
1534
|
+
chain: [
|
|
1535
|
+
"toolRouter",
|
|
1536
|
+
"session",
|
|
1537
|
+
"delete"
|
|
1538
|
+
]
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
method: "delete",
|
|
1542
|
+
path: "/api/v3.1/trigger_instances/manage/{triggerId}",
|
|
1543
|
+
chain: [
|
|
1544
|
+
"triggerInstances",
|
|
1545
|
+
"manage",
|
|
1546
|
+
"delete"
|
|
1547
|
+
],
|
|
1548
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
method: "delete",
|
|
1552
|
+
path: "/api/v3.1/webhook_subscriptions/{id}",
|
|
1553
|
+
chain: ["webhookSubscriptions", "delete"]
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
method: "get",
|
|
1557
|
+
path: "/api/v3.1/auth/session/info",
|
|
1558
|
+
chain: [
|
|
1559
|
+
"auth",
|
|
1560
|
+
"session",
|
|
1561
|
+
"retrieveInfo"
|
|
1562
|
+
],
|
|
1563
|
+
schemes: ["UserApiKeyAuth"]
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
method: "get",
|
|
1567
|
+
path: "/api/v3.1/auth_configs",
|
|
1568
|
+
chain: ["authConfigs", "list"],
|
|
1569
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1570
|
+
hasDeprecatedInputs: true
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
method: "get",
|
|
1574
|
+
path: "/api/v3.1/auth_configs/{nanoid}",
|
|
1575
|
+
chain: ["authConfigs", "retrieve"],
|
|
1576
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
method: "get",
|
|
1580
|
+
path: "/api/v3.1/cli/get-session",
|
|
1581
|
+
chain: ["cli", "getSession"],
|
|
1582
|
+
schemes: ["no_auth"]
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
method: "get",
|
|
1586
|
+
path: "/api/v3.1/cli/realtime/credentials",
|
|
1587
|
+
chain: [
|
|
1588
|
+
"cli",
|
|
1589
|
+
"realtime",
|
|
1590
|
+
"credentials"
|
|
1591
|
+
],
|
|
1592
|
+
schemes: ["UserApiKeyAuth"]
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
method: "get",
|
|
1596
|
+
path: "/api/v3.1/connected_accounts",
|
|
1597
|
+
chain: ["connectedAccounts", "list"],
|
|
1598
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
method: "get",
|
|
1602
|
+
path: "/api/v3.1/connected_accounts/{nanoid}",
|
|
1603
|
+
chain: ["connectedAccounts", "retrieve"],
|
|
1604
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
method: "get",
|
|
1608
|
+
path: "/api/v3.1/files/list",
|
|
1609
|
+
chain: ["files", "list"]
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
method: "get",
|
|
1613
|
+
path: "/api/v3.1/internal/action_execution/fields",
|
|
1614
|
+
chain: [
|
|
1615
|
+
"logs",
|
|
1616
|
+
"tools",
|
|
1617
|
+
"listFields"
|
|
1618
|
+
]
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
method: "get",
|
|
1622
|
+
path: "/api/v3.1/internal/action_execution/log/{id}",
|
|
1623
|
+
chain: [
|
|
1624
|
+
"logs",
|
|
1625
|
+
"tools",
|
|
1626
|
+
"retrieve"
|
|
1627
|
+
]
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
method: "get",
|
|
1631
|
+
path: "/api/v3.1/internal/trigger/log/{id}",
|
|
1632
|
+
chain: [
|
|
1633
|
+
"logs",
|
|
1634
|
+
"triggers",
|
|
1635
|
+
"retrieve"
|
|
1636
|
+
]
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
method: "get",
|
|
1640
|
+
path: "/api/v3.1/keyring/transfer_keys",
|
|
1641
|
+
chain: ["keyring", "listTransferKeys"]
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
method: "get",
|
|
1645
|
+
path: "/api/v3.1/logs/tool_execution/{id}",
|
|
1646
|
+
chain: ["logs", "retrieveToolExecution"]
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
method: "get",
|
|
1650
|
+
path: "/api/v3.1/mcp/app/{appKey}",
|
|
1651
|
+
chain: ["mcp", "retrieveApp"]
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
method: "get",
|
|
1655
|
+
path: "/api/v3.1/mcp/servers",
|
|
1656
|
+
chain: ["mcp", "list"]
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
method: "get",
|
|
1660
|
+
path: "/api/v3.1/mcp/servers/{serverId}/instances",
|
|
1661
|
+
chain: ["mcp", "listInstances"]
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
method: "get",
|
|
1665
|
+
path: "/api/v3.1/mcp/{id}",
|
|
1666
|
+
chain: ["mcp", "retrieve"]
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
method: "get",
|
|
1670
|
+
path: "/api/v3.1/org/consumer/connected_toolkits",
|
|
1671
|
+
chain: [
|
|
1672
|
+
"org",
|
|
1673
|
+
"consumer",
|
|
1674
|
+
"listConnectedToolkits"
|
|
1675
|
+
],
|
|
1676
|
+
schemes: ["UserApiKeyAuth"]
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
method: "get",
|
|
1680
|
+
path: "/api/v3.1/org/list",
|
|
1681
|
+
chain: ["org", "list"],
|
|
1682
|
+
schemes: ["UserApiKeyAuth"]
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
method: "get",
|
|
1686
|
+
path: "/api/v3.1/org/owner/project/list",
|
|
1687
|
+
chain: [
|
|
1688
|
+
"org",
|
|
1689
|
+
"owner",
|
|
1690
|
+
"project",
|
|
1691
|
+
"list"
|
|
1692
|
+
],
|
|
1693
|
+
schemes: ["OrgApiKeyAuth"]
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
method: "get",
|
|
1697
|
+
path: "/api/v3.1/org/owner/project/{nano_id}",
|
|
1698
|
+
chain: [
|
|
1699
|
+
"org",
|
|
1700
|
+
"owner",
|
|
1701
|
+
"project",
|
|
1702
|
+
"retrieve"
|
|
1703
|
+
],
|
|
1704
|
+
schemes: ["OrgApiKeyAuth"]
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
method: "get",
|
|
1708
|
+
path: "/api/v3.1/org/project/list",
|
|
1709
|
+
chain: [
|
|
1710
|
+
"org",
|
|
1711
|
+
"project",
|
|
1712
|
+
"list"
|
|
1713
|
+
],
|
|
1714
|
+
schemes: ["UserApiKeyAuth"]
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
method: "get",
|
|
1718
|
+
path: "/api/v3.1/session_configs",
|
|
1719
|
+
chain: ["sessionConfigs", "list"]
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
method: "get",
|
|
1723
|
+
path: "/api/v3.1/session_configs/{session_config_id}",
|
|
1724
|
+
chain: ["sessionConfigs", "retrieve"]
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
method: "get",
|
|
1728
|
+
path: "/api/v3.1/tool_router/session/{session_id}",
|
|
1729
|
+
chain: [
|
|
1730
|
+
"toolRouter",
|
|
1731
|
+
"session",
|
|
1732
|
+
"retrieve"
|
|
1733
|
+
]
|
|
1734
|
+
},
|
|
1735
|
+
{
|
|
1736
|
+
method: "get",
|
|
1737
|
+
path: "/api/v3.1/tool_router/session/{session_id}/config_history",
|
|
1738
|
+
chain: [
|
|
1739
|
+
"toolRouter",
|
|
1740
|
+
"session",
|
|
1741
|
+
"configHistory"
|
|
1742
|
+
]
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
method: "get",
|
|
1746
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/items",
|
|
1747
|
+
chain: [
|
|
1748
|
+
"toolRouter",
|
|
1749
|
+
"session",
|
|
1750
|
+
"files",
|
|
1751
|
+
"list"
|
|
1752
|
+
]
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
method: "get",
|
|
1756
|
+
path: "/api/v3.1/tool_router/session/{session_id}/toolkits",
|
|
1757
|
+
chain: [
|
|
1758
|
+
"toolRouter",
|
|
1759
|
+
"session",
|
|
1760
|
+
"toolkits"
|
|
1761
|
+
]
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
method: "get",
|
|
1765
|
+
path: "/api/v3.1/tool_router/session/{session_id}/tools",
|
|
1766
|
+
chain: [
|
|
1767
|
+
"toolRouter",
|
|
1768
|
+
"session",
|
|
1769
|
+
"tools"
|
|
1770
|
+
]
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
method: "get",
|
|
1774
|
+
path: "/api/v3.1/toolkits",
|
|
1775
|
+
chain: ["toolkits", "list"],
|
|
1776
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1777
|
+
hasDeprecatedInputs: true
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
method: "get",
|
|
1781
|
+
path: "/api/v3.1/toolkits/categories",
|
|
1782
|
+
chain: ["toolkits", "retrieveCategories"]
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
method: "get",
|
|
1786
|
+
path: "/api/v3.1/toolkits/changelog",
|
|
1787
|
+
chain: ["toolkits", "retrieveChangelog"]
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
method: "get",
|
|
1791
|
+
path: "/api/v3.1/toolkits/{slug}",
|
|
1792
|
+
chain: ["toolkits", "retrieve"],
|
|
1793
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
method: "get",
|
|
1797
|
+
path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/grant_context",
|
|
1798
|
+
chain: ["toolkits", "retrieveScopesGrantContext"]
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
method: "get",
|
|
1802
|
+
path: "/api/v3.1/tools",
|
|
1803
|
+
chain: ["tools", "list"],
|
|
1804
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1805
|
+
hasDeprecatedInputs: true
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
method: "get",
|
|
1809
|
+
path: "/api/v3.1/tools/enum",
|
|
1810
|
+
chain: ["tools", "retrieveEnum"],
|
|
1811
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
method: "get",
|
|
1815
|
+
path: "/api/v3.1/tools/{tool_slug}",
|
|
1816
|
+
chain: ["tools", "retrieve"],
|
|
1817
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
method: "get",
|
|
1821
|
+
path: "/api/v3.1/trigger_instances/active",
|
|
1822
|
+
chain: ["triggerInstances", "listActive"],
|
|
1823
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1824
|
+
hasDeprecatedInputs: true
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
method: "get",
|
|
1828
|
+
path: "/api/v3.1/triggers_types",
|
|
1829
|
+
chain: ["triggersTypes", "list"],
|
|
1830
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
method: "get",
|
|
1834
|
+
path: "/api/v3.1/triggers_types/list/enum",
|
|
1835
|
+
chain: ["triggersTypes", "retrieveEnum"],
|
|
1836
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1837
|
+
},
|
|
1838
|
+
{
|
|
1839
|
+
method: "get",
|
|
1840
|
+
path: "/api/v3.1/triggers_types/{slug}",
|
|
1841
|
+
chain: ["triggersTypes", "retrieve"],
|
|
1842
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
method: "get",
|
|
1846
|
+
path: "/api/v3.1/webhook_endpoints",
|
|
1847
|
+
chain: ["webhookEndpoints", "list"]
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
method: "get",
|
|
1851
|
+
path: "/api/v3.1/webhook_endpoints/{nano_id}",
|
|
1852
|
+
chain: ["webhookEndpoints", "retrieve"]
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
method: "get",
|
|
1856
|
+
path: "/api/v3.1/webhook_subscriptions",
|
|
1857
|
+
chain: ["webhookSubscriptions", "list"]
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
method: "get",
|
|
1861
|
+
path: "/api/v3.1/webhook_subscriptions/event_types",
|
|
1862
|
+
chain: ["webhookSubscriptions", "listEventTypes"]
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
method: "get",
|
|
1866
|
+
path: "/api/v3.1/webhook_subscriptions/{id}",
|
|
1867
|
+
chain: ["webhookSubscriptions", "retrieve"]
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
method: "patch",
|
|
1871
|
+
path: "/api/v3.1/auth_configs/{nanoid}",
|
|
1872
|
+
chain: ["authConfigs", "update"],
|
|
1873
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1874
|
+
hasDeprecatedInputs: true
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
method: "patch",
|
|
1878
|
+
path: "/api/v3.1/auth_configs/{nanoid}/{status}",
|
|
1879
|
+
chain: ["authConfigs", "updateStatus"]
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
method: "patch",
|
|
1883
|
+
path: "/api/v3.1/connected_accounts/{nanoId}/status",
|
|
1884
|
+
chain: ["connectedAccounts", "updateStatus"]
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
method: "patch",
|
|
1888
|
+
path: "/api/v3.1/connected_accounts/{nanoid}",
|
|
1889
|
+
chain: ["connectedAccounts", "patch"]
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
method: "patch",
|
|
1893
|
+
path: "/api/v3.1/mcp/{id}",
|
|
1894
|
+
chain: ["mcp", "update"]
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
method: "patch",
|
|
1898
|
+
path: "/api/v3.1/tool_router/session/{session_id}",
|
|
1899
|
+
chain: [
|
|
1900
|
+
"toolRouter",
|
|
1901
|
+
"session",
|
|
1902
|
+
"patch"
|
|
1903
|
+
]
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
method: "patch",
|
|
1907
|
+
path: "/api/v3.1/trigger_instances/manage/{triggerId}",
|
|
1908
|
+
chain: [
|
|
1909
|
+
"triggerInstances",
|
|
1910
|
+
"manage",
|
|
1911
|
+
"update"
|
|
1912
|
+
],
|
|
1913
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
method: "patch",
|
|
1917
|
+
path: "/api/v3.1/webhook_endpoints/{nano_id}",
|
|
1918
|
+
chain: ["webhookEndpoints", "update"]
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
method: "patch",
|
|
1922
|
+
path: "/api/v3.1/webhook_subscriptions/{id}",
|
|
1923
|
+
chain: ["webhookSubscriptions", "update"]
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
method: "post",
|
|
1927
|
+
path: "/api/v3.1/api_key_revocation",
|
|
1928
|
+
chain: ["apiKeyRevocation", "create"],
|
|
1929
|
+
schemes: ["no_auth"]
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
method: "post",
|
|
1933
|
+
path: "/api/v3.1/auth_configs",
|
|
1934
|
+
chain: ["authConfigs", "create"],
|
|
1935
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
method: "post",
|
|
1939
|
+
path: "/api/v3.1/cli/codact_failures",
|
|
1940
|
+
chain: ["cli", "createCodactFailure"],
|
|
1941
|
+
schemes: ["UserApiKeyAuth"]
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
method: "post",
|
|
1945
|
+
path: "/api/v3.1/cli/create-session",
|
|
1946
|
+
chain: ["cli", "createSession"],
|
|
1947
|
+
schemes: ["no_auth"]
|
|
1948
|
+
},
|
|
1949
|
+
{
|
|
1950
|
+
method: "post",
|
|
1951
|
+
path: "/api/v3.1/cli/realtime/auth",
|
|
1952
|
+
chain: [
|
|
1953
|
+
"cli",
|
|
1954
|
+
"realtime",
|
|
1955
|
+
"auth"
|
|
1956
|
+
],
|
|
1957
|
+
schemes: ["UserApiKeyAuth"]
|
|
1958
|
+
},
|
|
1959
|
+
{
|
|
1960
|
+
method: "post",
|
|
1961
|
+
path: "/api/v3.1/connected_accounts",
|
|
1962
|
+
chain: ["connectedAccounts", "create"]
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
method: "post",
|
|
1966
|
+
path: "/api/v3.1/connected_accounts/complete_auth",
|
|
1967
|
+
chain: ["connectedAccounts", "completeAuth"]
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
method: "post",
|
|
1971
|
+
path: "/api/v3.1/connected_accounts/link",
|
|
1972
|
+
chain: ["link", "create"],
|
|
1973
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
method: "post",
|
|
1977
|
+
path: "/api/v3.1/connected_accounts/{nanoid}/refresh",
|
|
1978
|
+
chain: ["connectedAccounts", "refresh"]
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
method: "post",
|
|
1982
|
+
path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
|
|
1983
|
+
chain: ["connectedAccounts", "revoke"]
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
method: "post",
|
|
1987
|
+
path: "/api/v3.1/custom/toolkits/sync",
|
|
1988
|
+
chain: ["custom", "sync"],
|
|
1989
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1990
|
+
},
|
|
1991
|
+
{
|
|
1992
|
+
method: "post",
|
|
1993
|
+
path: "/api/v3.1/custom/toolkits/upsert",
|
|
1994
|
+
chain: ["custom", "upsert"],
|
|
1995
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
method: "post",
|
|
1999
|
+
path: "/api/v3.1/files/upload/request",
|
|
2000
|
+
chain: ["files", "createPresignedURL"]
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
method: "post",
|
|
2004
|
+
path: "/api/v3.1/internal/action_execution/logs",
|
|
2005
|
+
chain: [
|
|
2006
|
+
"logs",
|
|
2007
|
+
"tools",
|
|
2008
|
+
"list"
|
|
2009
|
+
]
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
method: "post",
|
|
2013
|
+
path: "/api/v3.1/internal/trigger/logs",
|
|
2014
|
+
chain: [
|
|
2015
|
+
"logs",
|
|
2016
|
+
"triggers",
|
|
2017
|
+
"list"
|
|
2018
|
+
]
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
method: "post",
|
|
2022
|
+
path: "/api/v3.1/logs/tool_execution",
|
|
2023
|
+
chain: ["logs", "createToolExecution"]
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
method: "post",
|
|
2027
|
+
path: "/api/v3.1/mcp/servers",
|
|
2028
|
+
chain: ["mcp", "create"]
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
method: "post",
|
|
2032
|
+
path: "/api/v3.1/mcp/servers/custom",
|
|
2033
|
+
chain: [
|
|
2034
|
+
"mcp",
|
|
2035
|
+
"custom",
|
|
2036
|
+
"create"
|
|
2037
|
+
]
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
method: "post",
|
|
2041
|
+
path: "/api/v3.1/mcp/servers/generate",
|
|
2042
|
+
chain: [
|
|
2043
|
+
"mcp",
|
|
2044
|
+
"generate",
|
|
2045
|
+
"url"
|
|
2046
|
+
]
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
method: "post",
|
|
2050
|
+
path: "/api/v3.1/mcp/servers/{serverId}/instances",
|
|
2051
|
+
chain: ["mcp", "createInstance"]
|
|
2052
|
+
},
|
|
2053
|
+
{
|
|
2054
|
+
method: "post",
|
|
2055
|
+
path: "/api/v3.1/org/clanker/create_claim",
|
|
2056
|
+
chain: [
|
|
2057
|
+
"org",
|
|
2058
|
+
"clanker",
|
|
2059
|
+
"createClaim"
|
|
2060
|
+
],
|
|
2061
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
method: "post",
|
|
2065
|
+
path: "/api/v3.1/org/consumer/project/resolve",
|
|
2066
|
+
chain: [
|
|
2067
|
+
"org",
|
|
2068
|
+
"consumer",
|
|
2069
|
+
"project",
|
|
2070
|
+
"resolve"
|
|
2071
|
+
],
|
|
2072
|
+
schemes: ["UserApiKeyAuth"]
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
method: "post",
|
|
2076
|
+
path: "/api/v3.1/org/owner/project/new",
|
|
2077
|
+
chain: [
|
|
2078
|
+
"org",
|
|
2079
|
+
"owner",
|
|
2080
|
+
"project",
|
|
2081
|
+
"create"
|
|
2082
|
+
],
|
|
2083
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
method: "post",
|
|
2087
|
+
path: "/api/v3.1/org/owner/project/{nano_id}/regenerate_api_key",
|
|
2088
|
+
chain: [
|
|
2089
|
+
"org",
|
|
2090
|
+
"owner",
|
|
2091
|
+
"project",
|
|
2092
|
+
"regenerateAPIKey"
|
|
2093
|
+
],
|
|
2094
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
method: "post",
|
|
2098
|
+
path: "/api/v3.1/org/usage/summary",
|
|
2099
|
+
chain: [
|
|
2100
|
+
"org",
|
|
2101
|
+
"usage",
|
|
2102
|
+
"retrieveSummary"
|
|
2103
|
+
],
|
|
2104
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
method: "post",
|
|
2108
|
+
path: "/api/v3.1/org/usage/{entity_type}",
|
|
2109
|
+
chain: [
|
|
2110
|
+
"org",
|
|
2111
|
+
"usage",
|
|
2112
|
+
"retrieve"
|
|
2113
|
+
],
|
|
2114
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
method: "post",
|
|
2118
|
+
path: "/api/v3.1/project/usage/summary",
|
|
2119
|
+
chain: [
|
|
2120
|
+
"project",
|
|
2121
|
+
"usage",
|
|
2122
|
+
"retrieveSummary"
|
|
2123
|
+
]
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
method: "post",
|
|
2127
|
+
path: "/api/v3.1/project/usage/{entity_type}",
|
|
2128
|
+
chain: [
|
|
2129
|
+
"project",
|
|
2130
|
+
"usage",
|
|
2131
|
+
"retrieve"
|
|
2132
|
+
]
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
method: "post",
|
|
2136
|
+
path: "/api/v3.1/tool_router/session",
|
|
2137
|
+
chain: [
|
|
2138
|
+
"toolRouter",
|
|
2139
|
+
"session",
|
|
2140
|
+
"create"
|
|
2141
|
+
]
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
method: "post",
|
|
2145
|
+
path: "/api/v3.1/tool_router/session/{session_id}/attach",
|
|
2146
|
+
chain: [
|
|
2147
|
+
"toolRouter",
|
|
2148
|
+
"session",
|
|
2149
|
+
"attach"
|
|
2150
|
+
]
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
method: "post",
|
|
2154
|
+
path: "/api/v3.1/tool_router/session/{session_id}/execute",
|
|
2155
|
+
chain: [
|
|
2156
|
+
"toolRouter",
|
|
2157
|
+
"session",
|
|
2158
|
+
"execute"
|
|
2159
|
+
],
|
|
2160
|
+
schemes: ["ApiKeyAuth", "workbench_access_key"]
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
method: "post",
|
|
2164
|
+
path: "/api/v3.1/tool_router/session/{session_id}/execute_meta",
|
|
2165
|
+
chain: [
|
|
2166
|
+
"toolRouter",
|
|
2167
|
+
"session",
|
|
2168
|
+
"executeMeta"
|
|
2169
|
+
]
|
|
2170
|
+
},
|
|
2171
|
+
{
|
|
2172
|
+
method: "post",
|
|
2173
|
+
path: "/api/v3.1/tool_router/session/{session_id}/link",
|
|
2174
|
+
chain: [
|
|
2175
|
+
"toolRouter",
|
|
2176
|
+
"session",
|
|
2177
|
+
"link"
|
|
2178
|
+
]
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
method: "post",
|
|
2182
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/delete",
|
|
2183
|
+
chain: [
|
|
2184
|
+
"toolRouter",
|
|
2185
|
+
"session",
|
|
2186
|
+
"files",
|
|
2187
|
+
"delete"
|
|
2188
|
+
]
|
|
2189
|
+
},
|
|
2190
|
+
{
|
|
2191
|
+
method: "post",
|
|
2192
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/download_url",
|
|
2193
|
+
chain: [
|
|
2194
|
+
"toolRouter",
|
|
2195
|
+
"session",
|
|
2196
|
+
"files",
|
|
2197
|
+
"createDownloadURL"
|
|
2198
|
+
]
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
method: "post",
|
|
2202
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/upload_url",
|
|
2203
|
+
chain: [
|
|
2204
|
+
"toolRouter",
|
|
2205
|
+
"session",
|
|
2206
|
+
"files",
|
|
2207
|
+
"createUploadURL"
|
|
2208
|
+
]
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
method: "post",
|
|
2212
|
+
path: "/api/v3.1/tool_router/session/{session_id}/proxy_execute",
|
|
2213
|
+
chain: [
|
|
2214
|
+
"toolRouter",
|
|
2215
|
+
"session",
|
|
2216
|
+
"proxyExecute"
|
|
2217
|
+
],
|
|
2218
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
2219
|
+
hasDeprecatedInputs: true
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
method: "post",
|
|
2223
|
+
path: "/api/v3.1/tool_router/session/{session_id}/search",
|
|
2224
|
+
chain: [
|
|
2225
|
+
"toolRouter",
|
|
2226
|
+
"session",
|
|
2227
|
+
"search"
|
|
2228
|
+
]
|
|
2229
|
+
},
|
|
2230
|
+
{
|
|
2231
|
+
method: "post",
|
|
2232
|
+
path: "/api/v3.1/toolkits/multi",
|
|
2233
|
+
chain: ["toolkits", "retrieveMulti"]
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
method: "post",
|
|
2237
|
+
path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/recommended",
|
|
2238
|
+
chain: ["toolkits", "recommendScopes"]
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
method: "post",
|
|
2242
|
+
path: "/api/v3.1/tools/execute/proxy",
|
|
2243
|
+
chain: ["tools", "proxy"],
|
|
2244
|
+
hasDeprecatedInputs: true
|
|
2245
|
+
},
|
|
2246
|
+
{
|
|
2247
|
+
method: "post",
|
|
2248
|
+
path: "/api/v3.1/tools/execute/{tool_slug}",
|
|
2249
|
+
chain: ["tools", "execute"],
|
|
2250
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
2251
|
+
hasDeprecatedInputs: true
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
method: "post",
|
|
2255
|
+
path: "/api/v3.1/tools/execute/{tool_slug}/input",
|
|
2256
|
+
chain: ["tools", "getInput"]
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
method: "post",
|
|
2260
|
+
path: "/api/v3.1/tools/scopes/required",
|
|
2261
|
+
chain: ["tools", "retrieveRequiredScopes"]
|
|
2262
|
+
},
|
|
2263
|
+
{
|
|
2264
|
+
method: "post",
|
|
2265
|
+
path: "/api/v3.1/trigger_instances/{slug}/upsert",
|
|
2266
|
+
chain: ["triggerInstances", "upsert"],
|
|
2267
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
2268
|
+
hasDeprecatedInputs: true
|
|
2269
|
+
},
|
|
2270
|
+
{
|
|
2271
|
+
method: "post",
|
|
2272
|
+
path: "/api/v3.1/webhook_endpoints",
|
|
2273
|
+
chain: ["webhookEndpoints", "create"]
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
method: "post",
|
|
2277
|
+
path: "/api/v3.1/webhook_endpoints/{nano_id}",
|
|
2278
|
+
chain: ["webhookEndpoints", "replace"]
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
method: "post",
|
|
2282
|
+
path: "/api/v3.1/webhook_subscriptions",
|
|
2283
|
+
chain: ["webhookSubscriptions", "create"]
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
method: "post",
|
|
2287
|
+
path: "/api/v3.1/webhook_subscriptions/{id}/rotate_secret",
|
|
2288
|
+
chain: ["webhookSubscriptions", "rotateSecret"]
|
|
2289
|
+
}
|
|
2290
|
+
];
|
|
2291
|
+
/**
|
|
2292
|
+
* The same descriptors, indexed by public chain — what a generated resource
|
|
2293
|
+
* resolves its own operation from at module load, so the kernel reads
|
|
2294
|
+
* identity off the call instead of recovering it from the URL.
|
|
2295
|
+
*
|
|
2296
|
+
* Built from the array rather than emitted a second time, so the two indexes
|
|
2297
|
+
* hold the *same objects* and cannot drift apart.
|
|
2298
|
+
*/
|
|
2299
|
+
const GENERATED_OPERATIONS_BY_KEY = new Map(GENERATED_OPERATIONS.map((operation) => [operation.chain.join("."), operation]));
|
|
2300
|
+
/**
|
|
2301
|
+
* The descriptor a generated method dispatches with. A miss is a generator
|
|
2302
|
+
* defect, not a runtime condition, so it fails at import time rather than
|
|
2303
|
+
* silently degrading that method back to path matching.
|
|
2304
|
+
*/
|
|
2305
|
+
const generatedOperation = (chainKey) => {
|
|
2306
|
+
const operation = GENERATED_OPERATIONS_BY_KEY.get(chainKey);
|
|
2307
|
+
if (operation === void 0) throw new Error(`generated-operations: no operation for chain '${chainKey}'`);
|
|
2308
|
+
return operation;
|
|
2309
|
+
};
|
|
2310
|
+
|
|
2311
|
+
//#endregion
|
|
2312
|
+
export { path as a, withOperation as c, inspectDeprecation as d, assertCredentialTransport as f, makeRequest as i, VERSION as l, mergeHeaders as m, generatedOperation as n, readOperation as o, parseHTTPURL as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecatedInputs as u };
|