@composio/client 2.0.0-rc.1 → 2.0.0-rc.3
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 +32 -0
- package/dist/{api-key-revocation-BZL5FAx7.mjs → api-key-revocation-Cbokr5zZ.mjs} +4 -3
- package/dist/{auth-CEq4JqWm.mjs → auth-CNDyZgjw.mjs} +1 -1
- package/dist/{auth-configs-CyksMqNB.mjs → auth-configs-4u-8I2K7.mjs} +17 -11
- package/dist/{clanker-4wByThQJ.mjs → clanker-D6FjS8Lj.mjs} +4 -3
- package/dist/cli-LIRIGe7k.mjs +45 -0
- package/dist/{client-CK6bm7nf.d.mts → client-ByIYmMzt.d.mts} +48 -7
- package/dist/{connected-accounts-B-qN_yLT.mjs → connected-accounts-Bqtl42g0.mjs} +23 -15
- package/dist/{consumer-DWlaGBmh.mjs → consumer-BauHsJXO.mjs} +8 -8
- package/dist/{custom-BQWoONFY.mjs → custom-CGqEBUWj.mjs} +4 -3
- package/dist/{files-B-UnEejx.mjs → files-BYEsIET1.mjs} +7 -5
- package/dist/{files-CNZ-ttVS.mjs → files-DkH2-irQ.mjs} +13 -9
- package/dist/{generate-DSqfJENZ.mjs → generate-DTodgjHD.mjs} +4 -3
- package/dist/{request-DwPfYYNF.mjs → generated-operations-WtSYnmW0.mjs} +1130 -83
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +274 -819
- package/dist/{link-CukKZMxs.mjs → link-DL53IiYh.mjs} +4 -3
- package/dist/{logs-B87z4hq7.mjs → logs-DPgNkEde.mjs} +8 -6
- package/dist/{manage-By-b66OH.mjs → manage-DDmuMlFb.mjs} +6 -4
- package/dist/mcp-CS9s4sDK.mjs +82 -0
- package/dist/{org-BSq_z6fP.mjs → org-9gTqtmtc.mjs} +9 -8
- package/dist/{owner-BDkEFEVF.mjs → owner-EZzWtfQx.mjs} +1 -1
- package/dist/{project-_s0fWHut.mjs → project-4Ol46ZwD.mjs} +7 -7
- package/dist/project-CKmDHyu_.mjs +47 -0
- package/dist/{project-D-c0Zrrl.mjs → project-DeRwedA-.mjs} +1 -1
- package/dist/{project-Cj-NKnWZ.mjs → project-uN9dGkls.mjs} +4 -3
- package/dist/realtime-C8DEUgai.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/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/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/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-DWQaRfV_.mjs} +39 -26
- package/dist/{session-DNm4GFO-.mjs → session-EJK1YmKD.mjs} +3 -2
- package/dist/{tool-router-5OfsPkJ_.mjs → tool-router-CqRP0_gv.mjs} +1 -1
- package/dist/toolkits-B3eGuBu0.mjs +48 -0
- package/dist/tools-B4uip2mE.mjs +33 -0
- package/dist/tools-fb-vXe-l.mjs +67 -0
- package/dist/{trigger-instances-lkKWqHgd.mjs → trigger-instances-BCL5DJ0o.mjs} +8 -6
- package/dist/{triggers-DNx9yjbS.mjs → triggers-DnDhI69h.mjs} +6 -4
- package/dist/triggers-types-HHDB0mLH.mjs +34 -0
- package/dist/{usage-Cv9VNy5H.mjs → usage-B6vtknow.mjs} +7 -5
- package/dist/{usage-CKyu9RzD.mjs → usage-CzAfsIc4.mjs} +7 -5
- package/dist/{webhook-endpoints-DIyg3YlR.mjs → webhook-endpoints-DRJgQ6s0.mjs} +15 -10
- package/dist/webhook-subscriptions-WcdnIkGU.mjs +55 -0
- package/package.json +5 -2
- 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
|
@@ -71,6 +71,75 @@ var UnprocessableEntityError = class extends APIError {};
|
|
|
71
71
|
var RateLimitError = class extends APIError {};
|
|
72
72
|
var InternalServerError = class extends APIError {};
|
|
73
73
|
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/compat/headers.ts
|
|
76
|
+
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";
|
|
77
|
+
const isHeaders = (value) => value instanceof Headers || hasEntries(value);
|
|
78
|
+
const isNullableHeadersLike = (headers) => {
|
|
79
|
+
if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
|
|
80
|
+
const nulls = headers.nulls;
|
|
81
|
+
return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Iterates every supported input while preserving explicit deletions. Plain
|
|
85
|
+
* objects replace an older value for a key; tuple inputs append duplicate
|
|
86
|
+
* values, matching the published client.
|
|
87
|
+
*/
|
|
88
|
+
function* iterateHeaders(headers) {
|
|
89
|
+
if (!headers) return;
|
|
90
|
+
if (isNullableHeadersLike(headers)) {
|
|
91
|
+
yield* headers.values.entries();
|
|
92
|
+
for (const name of headers.nulls) yield [name, null];
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
|
|
96
|
+
const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
|
|
97
|
+
for (const entry of entries) {
|
|
98
|
+
const name = entry[0];
|
|
99
|
+
if (typeof name !== "string") throw new TypeError("expected header name to be a string");
|
|
100
|
+
const rawValue = entry[1];
|
|
101
|
+
const values = Array.isArray(rawValue) ? rawValue : [rawValue];
|
|
102
|
+
let replaced = false;
|
|
103
|
+
for (const value of values) {
|
|
104
|
+
if (value === void 0) continue;
|
|
105
|
+
if (shouldReplace && !replaced) {
|
|
106
|
+
replaced = true;
|
|
107
|
+
yield [name, null];
|
|
108
|
+
}
|
|
109
|
+
yield [name, value];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Merge sources while retaining names explicitly deleted by the last source. */
|
|
114
|
+
const mergeHeaders = (sources) => {
|
|
115
|
+
const values = new Headers();
|
|
116
|
+
const nulls = /* @__PURE__ */ new Set();
|
|
117
|
+
for (const source of sources) {
|
|
118
|
+
if (!source) continue;
|
|
119
|
+
const seen = /* @__PURE__ */ new Set();
|
|
120
|
+
for (const [name, value] of iterateHeaders(source)) {
|
|
121
|
+
const lowerName = name.toLowerCase();
|
|
122
|
+
if (!seen.has(lowerName)) {
|
|
123
|
+
values.delete(name);
|
|
124
|
+
seen.add(lowerName);
|
|
125
|
+
}
|
|
126
|
+
if (value === null) {
|
|
127
|
+
values.delete(name);
|
|
128
|
+
nulls.add(lowerName);
|
|
129
|
+
} else {
|
|
130
|
+
values.append(name, value);
|
|
131
|
+
nulls.delete(lowerName);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
values,
|
|
137
|
+
nulls
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/** Merge sources into the native header collection sent to fetch. */
|
|
141
|
+
const buildHeaders = (sources) => mergeHeaders(sources).values;
|
|
142
|
+
|
|
74
143
|
//#endregion
|
|
75
144
|
//#region src/compat/credentials.ts
|
|
76
145
|
/**
|
|
@@ -257,6 +326,19 @@ const parseHTTPURL = (value) => {
|
|
|
257
326
|
return null;
|
|
258
327
|
}
|
|
259
328
|
};
|
|
329
|
+
/**
|
|
330
|
+
* The URL `target` names, resolved against `base`, when it lands on http(s);
|
|
331
|
+
* `null` when it cannot be parsed or names a scheme this client does not
|
|
332
|
+
* speak. The one spelling of "resolve against a base, http(s) only" — the
|
|
333
|
+
* redirect follower and the deprecation link resolver both need exactly this.
|
|
334
|
+
*/
|
|
335
|
+
const resolveHTTPURL = (target, base) => {
|
|
336
|
+
try {
|
|
337
|
+
return parseHTTPURL(new URL(target, base).href);
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
260
342
|
/** Whether a credential may be sent to this origin at all. */
|
|
261
343
|
const isCredentialSafeOrigin = (url) => url.protocol === "https:" || url.protocol === "http:" && isLoopbackHostname(url.hostname);
|
|
262
344
|
const LOOPBACK_DESCRIPTION = "localhost, *.localhost, 127.0.0.0/8, [::1]";
|
|
@@ -336,18 +418,9 @@ const FOREIGN_CREDENTIAL_HEADERS = ["x-user-api-key", "x-org-api-key"];
|
|
|
336
418
|
* may carry `null` to delete what an earlier one set (`buildHeaders`).
|
|
337
419
|
*/
|
|
338
420
|
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;
|
|
421
|
+
if (!sources.some(Boolean)) return false;
|
|
422
|
+
const headers = buildHeaders(sources);
|
|
423
|
+
return FOREIGN_CREDENTIAL_HEADERS.some((name) => headers.has(name));
|
|
351
424
|
};
|
|
352
425
|
/**
|
|
353
426
|
* Header names that carry a credential and must not survive an origin change.
|
|
@@ -425,6 +498,32 @@ const carriesCredentials = (headers) => CREDENTIAL_HEADERS.some((name) => header
|
|
|
425
498
|
//#endregion
|
|
426
499
|
//#region src/compat/deprecation.ts
|
|
427
500
|
/**
|
|
501
|
+
* Runtime deprecation notices, read off the response.
|
|
502
|
+
*
|
|
503
|
+
* The server announces a deprecated operation with three standard fields:
|
|
504
|
+
*
|
|
505
|
+
* - `Deprecation` (RFC 9745) — an Item Structured Field whose value is a Date
|
|
506
|
+
* (RFC 9651 §3.3.7): an `@` followed by integer seconds since the Unix
|
|
507
|
+
* epoch, e.g. `Deprecation: @1688169599`.
|
|
508
|
+
* - `Sunset` (RFC 8594) — an HTTP-date, e.g. `Sunset: Sat, 31 Dec 2018
|
|
509
|
+
* 23:59:59 GMT`, naming the date the operation stops being served.
|
|
510
|
+
* - `Link` (RFC 8288) — `rel="deprecation"` points at human-readable notes
|
|
511
|
+
* (RFC 9745 registers that relation); `rel="successor-version"` (RFC 5829)
|
|
512
|
+
* points at the replacement resource, which this module maps back to a
|
|
513
|
+
* public client chain when it can.
|
|
514
|
+
*
|
|
515
|
+
* The authoring-time half of the same contract already exists: an operation
|
|
516
|
+
* the input schema marks `deprecated: true` reaches the generated method as a
|
|
517
|
+
* `@deprecated` annotation. This is the runtime half, and the two are
|
|
518
|
+
* independent — a notice fires because the *server* said so, never because the
|
|
519
|
+
* committed snapshot did, so it stays correct between spec syncs.
|
|
520
|
+
*
|
|
521
|
+
* Everything here is defensive by construction. A deprecation notice is
|
|
522
|
+
* advisory; it must never break a live call, so a field that is oversized,
|
|
523
|
+
* carries control characters, or simply does not parse is dropped rather than
|
|
524
|
+
* raised.
|
|
525
|
+
*/
|
|
526
|
+
/**
|
|
428
527
|
* Field-size ceiling. A deprecation notice is decoration on a response that
|
|
429
528
|
* has already been paid for, so an oversized field is dropped rather than
|
|
430
529
|
* parsed — there is no message worth building out of 2 KiB of `Link`.
|
|
@@ -633,14 +732,7 @@ const parseLinkField = (value) => {
|
|
|
633
732
|
}
|
|
634
733
|
return links;
|
|
635
734
|
};
|
|
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
|
-
};
|
|
735
|
+
const httpURL = (target, baseURL) => resolveHTTPURL(target, baseURL);
|
|
644
736
|
/**
|
|
645
737
|
* A successor is only followed as far as *naming* it, and only when it lands
|
|
646
738
|
* on the API this client is configured against.
|
|
@@ -686,6 +778,20 @@ const parseDeprecation = (headers, contextURL, baseURL) => {
|
|
|
686
778
|
};
|
|
687
779
|
};
|
|
688
780
|
const pathSegments = (path) => (path.split(/[?#]/, 1)[0] ?? "").split("/").filter((segment) => segment !== "");
|
|
781
|
+
/**
|
|
782
|
+
* Template segments, keyed by descriptor so the cache holds only entries the
|
|
783
|
+
* operations table (or a test's stand-in for it) is still keeping alive. The
|
|
784
|
+
* table is module-level and immutable, so every logical call re-split the same
|
|
785
|
+
* 104 templates for nothing once the match became unconditional.
|
|
786
|
+
*/
|
|
787
|
+
const templateSegments = /* @__PURE__ */ new WeakMap();
|
|
788
|
+
const segmentsOf = (operation) => {
|
|
789
|
+
const cached = templateSegments.get(operation);
|
|
790
|
+
if (cached !== void 0) return cached;
|
|
791
|
+
const segments = pathSegments(operation.path);
|
|
792
|
+
templateSegments.set(operation, segments);
|
|
793
|
+
return segments;
|
|
794
|
+
};
|
|
689
795
|
const isTemplateParam = (segment) => segment.startsWith("{") && segment.endsWith("}");
|
|
690
796
|
/**
|
|
691
797
|
* The operation a dispatched request belongs to, recovered from the path it
|
|
@@ -699,17 +805,20 @@ const isTemplateParam = (segment) => segment.startsWith("{") && segment.endsWith
|
|
|
699
805
|
* (`/toolkits/{slug}` against `/toolkits/categories`) the literal wins, which
|
|
700
806
|
* is the same most-specific-first rule the server routes by.
|
|
701
807
|
*
|
|
702
|
-
* **Known limit of recovering identity from the path
|
|
703
|
-
* byte-identical requests —
|
|
808
|
+
* **Known limit of recovering identity from the path**, and who still pays
|
|
809
|
+
* it. Two accessors can emit byte-identical requests —
|
|
810
|
+
* `client.toolkits.retrieve('categories')` and
|
|
704
811
|
* `client.toolkits.retrieveCategories()` both dispatch
|
|
705
812
|
* `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
|
-
*
|
|
813
|
+
* them here and the literal sibling is always the one named. That is inherent
|
|
814
|
+
* to reverse-matching, not a bug in the matcher.
|
|
815
|
+
*
|
|
816
|
+
* Generated calls no longer reach this function at all: each one carries its
|
|
817
|
+
* own descriptor through dispatch (`withOperation` in `request.ts`), so
|
|
818
|
+
* `toolkits.retrieve('categories')` is now named as itself. What is left here
|
|
819
|
+
* is the escape hatch — `client.get('/api/v3.1/toolkits/categories')` — whose
|
|
820
|
+
* identity genuinely is not knowable before runtime, and for which naming the
|
|
821
|
+
* literal sibling remains the honest answer.
|
|
713
822
|
*/
|
|
714
823
|
const matchOperation = (method, path, operations) => {
|
|
715
824
|
const segments = pathSegments(path);
|
|
@@ -717,7 +826,7 @@ const matchOperation = (method, path, operations) => {
|
|
|
717
826
|
let bestLiterals = -1;
|
|
718
827
|
for (const operation of operations) {
|
|
719
828
|
if (operation.method !== method) continue;
|
|
720
|
-
const template =
|
|
829
|
+
const template = segmentsOf(operation);
|
|
721
830
|
if (template.length !== segments.length) continue;
|
|
722
831
|
let literals = 0;
|
|
723
832
|
let matched = true;
|
|
@@ -792,10 +901,10 @@ const noticeKey = (notice) => [
|
|
|
792
901
|
* same `Response` to `asResponse()`, `withResponse()` and the parsed path
|
|
793
902
|
* alike.
|
|
794
903
|
*/
|
|
795
|
-
const inspectDeprecation = ({ response, method, path, baseURL, operations, seen, warn }) => {
|
|
904
|
+
const inspectDeprecation = ({ response, method, path, operation: known, baseURL, operations, seen, warn }) => {
|
|
796
905
|
const notice = parseDeprecation(response.headers, response.url || baseURL, baseURL);
|
|
797
906
|
if (notice === null) return;
|
|
798
|
-
const operation = matchOperation(method, path, operations);
|
|
907
|
+
const operation = known ?? matchOperation(method, path, operations);
|
|
799
908
|
const key = `${operation === null ? `${method} ${pathSegments(path).join("/")}` : operation.chain.join(".")}${KEY_SEPARATOR}${noticeKey(notice)}`;
|
|
800
909
|
if (seen.has(key)) return;
|
|
801
910
|
if (seen.size >= MAX_TRACKED_NOTICES) return;
|
|
@@ -804,10 +913,110 @@ const inspectDeprecation = ({ response, method, path, baseURL, operations, seen,
|
|
|
804
913
|
const subject = operation === null ? `${method.toUpperCase()} ${path}` : chainLabel(operation.chain);
|
|
805
914
|
warn(formatDeprecationWarning(subject, notice, successorChain));
|
|
806
915
|
};
|
|
916
|
+
/**
|
|
917
|
+
* The keys a value map will actually carry on the wire. Both serializers drop
|
|
918
|
+
* an entry whose value is `undefined` outright — `JSON.stringify` for a body
|
|
919
|
+
* property, `stringifyQuery` for a query entry — while `null` is sent (JSON
|
|
920
|
+
* `null`, or `key=`), so only `undefined` reads as "not sent". `bodyKeys`
|
|
921
|
+
* relies on the same rule for its half of the surface.
|
|
922
|
+
*/
|
|
923
|
+
const presentKeys = (values) => new Set(Object.entries(values).filter(([, value]) => value !== void 0).map(([key]) => key));
|
|
924
|
+
/**
|
|
925
|
+
* The keys `body` will actually carry on the wire, at its top level, when it
|
|
926
|
+
* is a plain object — `presentKeys` over it, narrowed to objects: a resource
|
|
927
|
+
* method always passes an object (even an omitted optional body arrives as
|
|
928
|
+
* `{}`), so this covers every real call; a non-object `body` (the raw escape
|
|
929
|
+
* hatch dispatching something else entirely) has no top-level keys to check.
|
|
930
|
+
*/
|
|
931
|
+
const bodyKeys = (body) => typeof body === "object" && body !== null && !Array.isArray(body) ? presentKeys(body) : /* @__PURE__ */ new Set();
|
|
932
|
+
/**
|
|
933
|
+
* The static parameter-level warning: fires when the client sends an input
|
|
934
|
+
* the committed spec marks `deprecated: true`, decided entirely from the
|
|
935
|
+
* request the caller is about to send. Unlike `inspectDeprecation`, this
|
|
936
|
+
* needs no response — it runs before dispatch, so a connection failure never
|
|
937
|
+
* swallows it.
|
|
938
|
+
*
|
|
939
|
+
* One notice per (operation, sorted set of deprecated wire names present) per
|
|
940
|
+
* client instance, but every input in that set is named in its own `warn`
|
|
941
|
+
* call — the once-only key only suppresses an exact-repeat call, it does not
|
|
942
|
+
* collapse several inputs on one call into a single message.
|
|
943
|
+
*/
|
|
944
|
+
const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen, warn }) => {
|
|
945
|
+
if (operation === null) return;
|
|
946
|
+
const declared = table.get(operation.chain.join("."));
|
|
947
|
+
if (declared === void 0 || declared.length === 0) return;
|
|
948
|
+
const queryKeys = presentKeys(query);
|
|
949
|
+
const bodyKeySet = bodyKeys(body);
|
|
950
|
+
const present = declared.filter((input) => {
|
|
951
|
+
if (input.in === "query") return queryKeys.has(input.wire);
|
|
952
|
+
if (input.in === "body") return bodyKeySet.has(input.wire);
|
|
953
|
+
return headers.has(input.wire);
|
|
954
|
+
});
|
|
955
|
+
if (present.length === 0) return;
|
|
956
|
+
const wireSet = [...new Set(present.map((input) => input.wire))].sort();
|
|
957
|
+
const key = `param${KEY_SEPARATOR}${operation.chain.join(".")}${KEY_SEPARATOR}${wireSet.join(",")}`;
|
|
958
|
+
if (seen.has(key)) return;
|
|
959
|
+
if (seen.size >= MAX_TRACKED_NOTICES) return;
|
|
960
|
+
seen.add(key);
|
|
961
|
+
const subject = chainLabel(operation.chain);
|
|
962
|
+
for (const input of present) {
|
|
963
|
+
const clause = input.replacementWire === null ? "" : ` Use \`${input.replacementWire}\` instead.`;
|
|
964
|
+
warn(`Composio: the \`${input.wire}\` parameter of ${subject} is deprecated.${clause}`);
|
|
965
|
+
}
|
|
966
|
+
};
|
|
807
967
|
|
|
808
968
|
//#endregion
|
|
809
969
|
//#region src/compat/request.ts
|
|
810
970
|
/**
|
|
971
|
+
* Where a generated call records *which operation it is*.
|
|
972
|
+
*
|
|
973
|
+
* A resource method knows its own identity at code-generation time, and until
|
|
974
|
+
* now threw it away: dispatch carried only a method and a substituted path, so
|
|
975
|
+
* the kernel recovered the operation by matching that path back against all
|
|
976
|
+
* 104 templates on every single request (`matchOperation`). Recovery is still
|
|
977
|
+
* the right answer for an escape-hatch `client.get('/api/v3.1/…')`, whose
|
|
978
|
+
* identity genuinely is not knowable until runtime — but for a generated call
|
|
979
|
+
* it re-derives a fact the call site already had.
|
|
980
|
+
*
|
|
981
|
+
* The channel is a module-private symbol rather than a `RequestOptions`
|
|
982
|
+
* property, because `RequestOptions` is the Stainless options bag and its
|
|
983
|
+
* shape is the product (`test/types/*.test-d.ts` pins it structurally). A
|
|
984
|
+
* symbol key is invisible to that pinning, to `Object.keys`, to
|
|
985
|
+
* `JSON.stringify`, and to every serializer in this file — the descriptor
|
|
986
|
+
* reaches the kernel without becoming part of any public type or any byte on
|
|
987
|
+
* the wire.
|
|
988
|
+
*
|
|
989
|
+
* It is deliberately *enumerable*: `client.get()` re-spreads the options bag
|
|
990
|
+
* into `request()`, and object spread copies enumerable own symbols. A
|
|
991
|
+
* non-enumerable definition would silently drop the descriptor there and
|
|
992
|
+
* degrade every generated call back to matching, which is exactly the kind of
|
|
993
|
+
* regression that measures fine and reports nothing.
|
|
994
|
+
*/
|
|
995
|
+
const OPERATION = Symbol("composio.operation");
|
|
996
|
+
/**
|
|
997
|
+
* Attach a generated call's operation to the options bag it dispatches with.
|
|
998
|
+
*
|
|
999
|
+
* Called with the freshly built literal — never with the caller's own object —
|
|
1000
|
+
* and *after* the caller's options have been spread into it, so a caller
|
|
1001
|
+
* cannot pre-empt the descriptor: the write happens last, and the key it
|
|
1002
|
+
* writes to is not one a caller can name.
|
|
1003
|
+
*/
|
|
1004
|
+
const withOperation = (operation, options) => {
|
|
1005
|
+
options[OPERATION] = operation;
|
|
1006
|
+
return options;
|
|
1007
|
+
};
|
|
1008
|
+
/** The operation a generated call recorded, or `undefined` for a raw one. */
|
|
1009
|
+
const readOperation = (options) => options[OPERATION];
|
|
1010
|
+
/** A request label safe to print: dynamic path values and URL secrets are excluded. */
|
|
1011
|
+
const printableURL = (url, operation) => `${new URL(url).origin}${operation?.path ?? "/<custom>"}`;
|
|
1012
|
+
const emitLog = (config, level, message, metadata) => {
|
|
1013
|
+
try {
|
|
1014
|
+
config.onLog?.(level, message, metadata);
|
|
1015
|
+
} catch {}
|
|
1016
|
+
};
|
|
1017
|
+
const monotonicMillis = () => globalThis.performance?.now?.() ?? Date.now();
|
|
1018
|
+
const elapsedMillis = (startedAt) => Math.max(0, monotonicMillis() - startedAt);
|
|
1019
|
+
/**
|
|
811
1020
|
* Percent-encode everything that isn't a RFC-3986 pchar, leaving safe chars
|
|
812
1021
|
* (unreserved / sub-delims / ":" / "@") readable.
|
|
813
1022
|
*/
|
|
@@ -865,23 +1074,10 @@ const buildURL = (config, options) => {
|
|
|
865
1074
|
};
|
|
866
1075
|
const search = stringifyQuery(query);
|
|
867
1076
|
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;
|
|
1077
|
+
return {
|
|
1078
|
+
url: url.toString(),
|
|
1079
|
+
query
|
|
1080
|
+
};
|
|
885
1081
|
};
|
|
886
1082
|
/**
|
|
887
1083
|
* JSON body encoding. A resource method always passes the `body` key when its
|
|
@@ -1009,28 +1205,35 @@ const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times;
|
|
|
1009
1205
|
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
1206
|
const isOpaqueRedirect = (response) => response.type === "opaqueredirect";
|
|
1011
1207
|
/**
|
|
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
1208
|
* The `Location` a hop points at, resolved against the URL it arrived on, or
|
|
1020
1209
|
* `null` when there is nothing followable there — unparseable, or a scheme
|
|
1021
1210
|
* this client does not speak (`data:`, `file:`, an app link). `null` hands the
|
|
1022
1211
|
* 3xx back as the response it is, which is what `fetch` does with a `Location`
|
|
1023
1212
|
* it cannot use.
|
|
1024
1213
|
*/
|
|
1025
|
-
const resolveLocation = (location, from) =>
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1214
|
+
const resolveLocation = (location, from) => resolveHTTPURL(location, from);
|
|
1215
|
+
/**
|
|
1216
|
+
* Fetch's own method rewrite (§4.4 "HTTP-redirect fetch", step 13): a 303
|
|
1217
|
+
* turns any non-GET into a GET, and a 301/302 does the same to a POST — both
|
|
1218
|
+
* dropping the body. 307 and 308 preserve the method and the body, which is
|
|
1219
|
+
* what they exist for. Following by hand means reproducing this, or a caller's
|
|
1220
|
+
* POST silently becomes a POST to somewhere it was never sent before.
|
|
1221
|
+
*/
|
|
1032
1222
|
const rewriteForRedirect = (status, method) => status === 303 && method !== "GET" && method !== "HEAD" || (status === 301 || status === 302) && method === "POST";
|
|
1033
|
-
const sleep = (ms
|
|
1223
|
+
const sleep = (ms, signal) => {
|
|
1224
|
+
if (signal?.aborted) return Promise.reject(new APIUserAbortError());
|
|
1225
|
+
return new Promise((resolve, reject) => {
|
|
1226
|
+
const onAbort = () => {
|
|
1227
|
+
clearTimeout(timer);
|
|
1228
|
+
reject(new APIUserAbortError());
|
|
1229
|
+
};
|
|
1230
|
+
const timer = setTimeout(() => {
|
|
1231
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1232
|
+
resolve();
|
|
1233
|
+
}, ms);
|
|
1234
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1235
|
+
});
|
|
1236
|
+
};
|
|
1034
1237
|
/**
|
|
1035
1238
|
* Indirection over `sleep` so kernel tests can capture retry delays instead
|
|
1036
1239
|
* of waiting them out on the wall clock. Internal seam only — deliberately
|
|
@@ -1048,8 +1251,16 @@ const kernelInternals = { sleep };
|
|
|
1048
1251
|
* caller's own credential headers, which are legitimate on the URL the caller
|
|
1049
1252
|
* chose and are dropped once the *server* has chosen one.
|
|
1050
1253
|
*/
|
|
1051
|
-
const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme) => {
|
|
1052
|
-
const credential = withdrawn ||
|
|
1254
|
+
const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
|
|
1255
|
+
const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL);
|
|
1256
|
+
if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers) {
|
|
1257
|
+
const direct = new Headers({
|
|
1258
|
+
accept: "application/json",
|
|
1259
|
+
"user-agent": config.userAgent
|
|
1260
|
+
});
|
|
1261
|
+
if (credential !== null) direct.set(credential.name, credential.value);
|
|
1262
|
+
return direct;
|
|
1263
|
+
}
|
|
1053
1264
|
const headers = buildHeaders([
|
|
1054
1265
|
{
|
|
1055
1266
|
accept: "application/json",
|
|
@@ -1073,15 +1284,18 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
|
|
|
1073
1284
|
* asked for is the honest answer for the whole chain, and rule 3 already
|
|
1074
1285
|
* withdraws everything once a hop leaves the origin.
|
|
1075
1286
|
*
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1287
|
+
* `operation` is the match `makeRequest` already computed for the static
|
|
1288
|
+
* deprecated-input check, threaded in rather than re-derived: the two
|
|
1289
|
+
* features need the same fact, so `matchOperation` runs once per logical call
|
|
1290
|
+
* regardless of which of them a given client configuration actually uses.
|
|
1291
|
+
* With only `apiKey` set the scheme answer is still `ApiKeyAuth` down every
|
|
1292
|
+
* branch of {@link selectScheme}, so an existing caller's requests stay
|
|
1293
|
+
* byte-identical by construction; what changed is that the match itself is no
|
|
1294
|
+
* longer skippable, because the deprecated-input warning needs it too.
|
|
1081
1295
|
*/
|
|
1082
|
-
const schemeForRequest = (config,
|
|
1296
|
+
const schemeForRequest = (config, operation) => {
|
|
1083
1297
|
if (!hasAlternateCredential(config.credentials)) return "ApiKeyAuth";
|
|
1084
|
-
return selectScheme(
|
|
1298
|
+
return selectScheme(operation?.schemes, config.credentials);
|
|
1085
1299
|
};
|
|
1086
1300
|
/**
|
|
1087
1301
|
* One attempt: the request, plus however many redirects it takes to land on a
|
|
@@ -1106,10 +1320,11 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
|
|
|
1106
1320
|
let body = initialBody;
|
|
1107
1321
|
let bodyHeaders = initialBodyHeaders;
|
|
1108
1322
|
let withdrawn = false;
|
|
1323
|
+
const callerPlaced = callerPlacedCredential([config.defaultHeaders, options.headers]);
|
|
1109
1324
|
for (let hop = 0;; hop++) {
|
|
1110
|
-
const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme);
|
|
1325
|
+
const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme, callerPlaced);
|
|
1111
1326
|
const delegated = hop === 0 && !carriesCredentials(headers);
|
|
1112
|
-
const
|
|
1327
|
+
const init = {
|
|
1113
1328
|
method,
|
|
1114
1329
|
headers,
|
|
1115
1330
|
...body !== void 0 ? { body } : {},
|
|
@@ -1117,7 +1332,8 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
|
|
|
1117
1332
|
...options.fetchOptions,
|
|
1118
1333
|
redirect: delegated ? "follow" : "manual",
|
|
1119
1334
|
signal
|
|
1120
|
-
}
|
|
1335
|
+
};
|
|
1336
|
+
const response = config.transport === void 0 ? await config.fetch.call(void 0, url, init) : await config.transport.send(new Request(url, init));
|
|
1121
1337
|
if (delegated) return response;
|
|
1122
1338
|
if (isOpaqueRedirect(response)) throw new APIConnectionError({ message: OPAQUE_REDIRECT });
|
|
1123
1339
|
if (!REDIRECT_STATUSES.has(response.status)) return response;
|
|
@@ -1156,13 +1372,29 @@ async function makeRequest(config, options) {
|
|
|
1156
1372
|
const maxRetries = options.maxRetries ?? config.maxRetries;
|
|
1157
1373
|
validatePositiveInteger("maxRetries", maxRetries);
|
|
1158
1374
|
const timeout = options.timeout ?? config.timeout;
|
|
1159
|
-
const url = buildURL(config, options);
|
|
1375
|
+
const { url, query } = buildURL(config, options);
|
|
1160
1376
|
const { body, bodyHeaders } = buildBody(options);
|
|
1161
1377
|
const userSignal = options.signal ?? void 0;
|
|
1162
|
-
const
|
|
1378
|
+
const method = options.method.toUpperCase();
|
|
1379
|
+
const threaded = readOperation(options);
|
|
1380
|
+
const operation = threaded ?? matchOperation(options.method, options.path, config.operations ?? []);
|
|
1381
|
+
const requestLog = config.onLog === void 0 ? void 0 : {
|
|
1382
|
+
method,
|
|
1383
|
+
url: printableURL(url, operation),
|
|
1384
|
+
maxAttempts: maxRetries + 1
|
|
1385
|
+
};
|
|
1386
|
+
const scheme = schemeForRequest(config, operation);
|
|
1387
|
+
if (config.onRequest !== void 0 && (threaded === void 0 || threaded.hasDeprecatedInputs === true)) config.onRequest(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
|
|
1163
1388
|
for (let numRetries = 0;; numRetries++) {
|
|
1164
1389
|
if (userSignal?.aborted) throw new APIUserAbortError();
|
|
1390
|
+
const attempt = numRetries + 1;
|
|
1165
1391
|
const retriesRemaining = maxRetries - numRetries;
|
|
1392
|
+
const startedAt = requestLog === void 0 ? 0 : monotonicMillis();
|
|
1393
|
+
const attemptLog = requestLog === void 0 ? void 0 : {
|
|
1394
|
+
...requestLog,
|
|
1395
|
+
attempt
|
|
1396
|
+
};
|
|
1397
|
+
if (attemptLog !== void 0) emitLog(config, "debug", "Sending request", attemptLog);
|
|
1166
1398
|
const controller = new AbortController();
|
|
1167
1399
|
const abort = () => controller.abort();
|
|
1168
1400
|
userSignal?.addEventListener("abort", abort, { once: true });
|
|
@@ -1171,25 +1403,68 @@ async function makeRequest(config, options) {
|
|
|
1171
1403
|
try {
|
|
1172
1404
|
result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, scheme);
|
|
1173
1405
|
} catch (cause) {
|
|
1174
|
-
if (cause instanceof ComposioError)
|
|
1406
|
+
if (cause instanceof ComposioError) {
|
|
1407
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
|
|
1408
|
+
...attemptLog,
|
|
1409
|
+
durationMs: elapsedMillis(startedAt),
|
|
1410
|
+
errorType: cause.constructor.name
|
|
1411
|
+
});
|
|
1412
|
+
throw cause;
|
|
1413
|
+
}
|
|
1175
1414
|
result = castToError(cause);
|
|
1176
1415
|
} finally {
|
|
1177
1416
|
clearTimeout(timer);
|
|
1178
1417
|
userSignal?.removeEventListener("abort", abort);
|
|
1179
1418
|
}
|
|
1180
1419
|
if (result instanceof Error) {
|
|
1181
|
-
if (userSignal?.aborted)
|
|
1420
|
+
if (userSignal?.aborted) {
|
|
1421
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
|
|
1422
|
+
...attemptLog,
|
|
1423
|
+
durationMs: elapsedMillis(startedAt),
|
|
1424
|
+
errorType: APIUserAbortError.name
|
|
1425
|
+
});
|
|
1426
|
+
throw new APIUserAbortError();
|
|
1427
|
+
}
|
|
1182
1428
|
const isTimeout = controller.signal.aborted || /timed? ?out/i.test(String(result) + ("cause" in result ? String(result.cause) : ""));
|
|
1429
|
+
const errorType = isTimeout ? APIConnectionTimeoutError.name : APIConnectionError.name;
|
|
1430
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
|
|
1431
|
+
...attemptLog,
|
|
1432
|
+
durationMs: elapsedMillis(startedAt),
|
|
1433
|
+
errorType
|
|
1434
|
+
});
|
|
1183
1435
|
if (retriesRemaining > 0) {
|
|
1184
|
-
|
|
1436
|
+
const delayMs = retryDelayMillis(numRetries);
|
|
1437
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Retrying request", {
|
|
1438
|
+
...attemptLog,
|
|
1439
|
+
nextAttempt: attempt + 1,
|
|
1440
|
+
retriesRemaining,
|
|
1441
|
+
delayMs,
|
|
1442
|
+
reason: isTimeout ? "timeout" : "transport"
|
|
1443
|
+
});
|
|
1444
|
+
await kernelInternals.sleep(delayMs, userSignal);
|
|
1185
1445
|
continue;
|
|
1186
1446
|
}
|
|
1187
1447
|
if (isTimeout) throw new APIConnectionTimeoutError();
|
|
1188
1448
|
throw new APIConnectionError({ cause: result });
|
|
1189
1449
|
}
|
|
1450
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Received response", {
|
|
1451
|
+
...attemptLog,
|
|
1452
|
+
status: result.status,
|
|
1453
|
+
outcome: result.ok ? "success" : "http_error",
|
|
1454
|
+
durationMs: elapsedMillis(startedAt)
|
|
1455
|
+
});
|
|
1190
1456
|
if (!result.ok && retriesRemaining > 0 && shouldRetryResponse(result)) {
|
|
1191
1457
|
result.body?.cancel().catch(() => void 0);
|
|
1192
|
-
|
|
1458
|
+
const delayMs = retryDelayMillis(numRetries, result.headers);
|
|
1459
|
+
if (attemptLog !== void 0) emitLog(config, "info", "Retrying request", {
|
|
1460
|
+
...attemptLog,
|
|
1461
|
+
nextAttempt: attempt + 1,
|
|
1462
|
+
retriesRemaining,
|
|
1463
|
+
delayMs,
|
|
1464
|
+
reason: "response",
|
|
1465
|
+
status: result.status
|
|
1466
|
+
});
|
|
1467
|
+
await kernelInternals.sleep(delayMs, userSignal);
|
|
1193
1468
|
continue;
|
|
1194
1469
|
}
|
|
1195
1470
|
if (config.onResponse !== void 0) try {
|
|
@@ -1200,4 +1475,776 @@ async function makeRequest(config, options) {
|
|
|
1200
1475
|
}
|
|
1201
1476
|
|
|
1202
1477
|
//#endregion
|
|
1203
|
-
|
|
1478
|
+
//#region src/compat/generated-operations.ts
|
|
1479
|
+
const GENERATED_OPERATIONS = [
|
|
1480
|
+
{
|
|
1481
|
+
method: "delete",
|
|
1482
|
+
path: "/api/v3.1/auth_configs/{nanoid}",
|
|
1483
|
+
chain: ["authConfigs", "delete"],
|
|
1484
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
method: "delete",
|
|
1488
|
+
path: "/api/v3.1/connected_accounts/{nanoid}",
|
|
1489
|
+
chain: ["connectedAccounts", "delete"],
|
|
1490
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
method: "delete",
|
|
1494
|
+
path: "/api/v3.1/mcp/servers/{serverId}/instances/{instanceId}",
|
|
1495
|
+
chain: ["mcp", "deleteInstance"]
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
method: "delete",
|
|
1499
|
+
path: "/api/v3.1/mcp/{id}",
|
|
1500
|
+
chain: ["mcp", "delete"]
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
method: "delete",
|
|
1504
|
+
path: "/api/v3.1/org/owner/project/{nano_id}",
|
|
1505
|
+
chain: [
|
|
1506
|
+
"org",
|
|
1507
|
+
"owner",
|
|
1508
|
+
"project",
|
|
1509
|
+
"delete"
|
|
1510
|
+
],
|
|
1511
|
+
schemes: ["OrgApiKeyAuth"]
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
method: "delete",
|
|
1515
|
+
path: "/api/v3.1/tool_router/session/{session_id}",
|
|
1516
|
+
chain: [
|
|
1517
|
+
"toolRouter",
|
|
1518
|
+
"session",
|
|
1519
|
+
"delete"
|
|
1520
|
+
]
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
method: "delete",
|
|
1524
|
+
path: "/api/v3.1/trigger_instances/manage/{triggerId}",
|
|
1525
|
+
chain: [
|
|
1526
|
+
"triggerInstances",
|
|
1527
|
+
"manage",
|
|
1528
|
+
"delete"
|
|
1529
|
+
],
|
|
1530
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
method: "delete",
|
|
1534
|
+
path: "/api/v3.1/webhook_subscriptions/{id}",
|
|
1535
|
+
chain: ["webhookSubscriptions", "delete"]
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
method: "get",
|
|
1539
|
+
path: "/api/v3.1/auth/session/info",
|
|
1540
|
+
chain: [
|
|
1541
|
+
"auth",
|
|
1542
|
+
"session",
|
|
1543
|
+
"retrieveInfo"
|
|
1544
|
+
],
|
|
1545
|
+
schemes: ["UserApiKeyAuth"]
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
method: "get",
|
|
1549
|
+
path: "/api/v3.1/auth_configs",
|
|
1550
|
+
chain: ["authConfigs", "list"],
|
|
1551
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1552
|
+
hasDeprecatedInputs: true
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
method: "get",
|
|
1556
|
+
path: "/api/v3.1/auth_configs/{nanoid}",
|
|
1557
|
+
chain: ["authConfigs", "retrieve"],
|
|
1558
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
method: "get",
|
|
1562
|
+
path: "/api/v3.1/cli/get-session",
|
|
1563
|
+
chain: ["cli", "getSession"],
|
|
1564
|
+
schemes: ["no_auth"]
|
|
1565
|
+
},
|
|
1566
|
+
{
|
|
1567
|
+
method: "get",
|
|
1568
|
+
path: "/api/v3.1/cli/realtime/credentials",
|
|
1569
|
+
chain: [
|
|
1570
|
+
"cli",
|
|
1571
|
+
"realtime",
|
|
1572
|
+
"credentials"
|
|
1573
|
+
],
|
|
1574
|
+
schemes: ["UserApiKeyAuth"]
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
method: "get",
|
|
1578
|
+
path: "/api/v3.1/connected_accounts",
|
|
1579
|
+
chain: ["connectedAccounts", "list"],
|
|
1580
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
method: "get",
|
|
1584
|
+
path: "/api/v3.1/connected_accounts/{nanoid}",
|
|
1585
|
+
chain: ["connectedAccounts", "retrieve"],
|
|
1586
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
method: "get",
|
|
1590
|
+
path: "/api/v3.1/files/list",
|
|
1591
|
+
chain: ["files", "list"]
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
method: "get",
|
|
1595
|
+
path: "/api/v3.1/internal/action_execution/fields",
|
|
1596
|
+
chain: [
|
|
1597
|
+
"logs",
|
|
1598
|
+
"tools",
|
|
1599
|
+
"listFields"
|
|
1600
|
+
]
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
method: "get",
|
|
1604
|
+
path: "/api/v3.1/internal/action_execution/log/{id}",
|
|
1605
|
+
chain: [
|
|
1606
|
+
"logs",
|
|
1607
|
+
"tools",
|
|
1608
|
+
"retrieve"
|
|
1609
|
+
]
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
method: "get",
|
|
1613
|
+
path: "/api/v3.1/internal/trigger/log/{id}",
|
|
1614
|
+
chain: [
|
|
1615
|
+
"logs",
|
|
1616
|
+
"triggers",
|
|
1617
|
+
"retrieve"
|
|
1618
|
+
]
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
method: "get",
|
|
1622
|
+
path: "/api/v3.1/logs/tool_execution/{id}",
|
|
1623
|
+
chain: ["logs", "retrieveToolExecution"]
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
method: "get",
|
|
1627
|
+
path: "/api/v3.1/mcp/app/{appKey}",
|
|
1628
|
+
chain: ["mcp", "retrieveApp"]
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
method: "get",
|
|
1632
|
+
path: "/api/v3.1/mcp/servers",
|
|
1633
|
+
chain: ["mcp", "list"]
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
method: "get",
|
|
1637
|
+
path: "/api/v3.1/mcp/servers/{serverId}/instances",
|
|
1638
|
+
chain: ["mcp", "listInstances"]
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
method: "get",
|
|
1642
|
+
path: "/api/v3.1/mcp/{id}",
|
|
1643
|
+
chain: ["mcp", "retrieve"]
|
|
1644
|
+
},
|
|
1645
|
+
{
|
|
1646
|
+
method: "get",
|
|
1647
|
+
path: "/api/v3.1/org/consumer/connected_toolkits",
|
|
1648
|
+
chain: [
|
|
1649
|
+
"org",
|
|
1650
|
+
"consumer",
|
|
1651
|
+
"listConnectedToolkits"
|
|
1652
|
+
],
|
|
1653
|
+
schemes: ["UserApiKeyAuth"]
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
method: "get",
|
|
1657
|
+
path: "/api/v3.1/org/list",
|
|
1658
|
+
chain: ["org", "list"],
|
|
1659
|
+
schemes: ["UserApiKeyAuth"]
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
method: "get",
|
|
1663
|
+
path: "/api/v3.1/org/owner/project/list",
|
|
1664
|
+
chain: [
|
|
1665
|
+
"org",
|
|
1666
|
+
"owner",
|
|
1667
|
+
"project",
|
|
1668
|
+
"list"
|
|
1669
|
+
],
|
|
1670
|
+
schemes: ["OrgApiKeyAuth"]
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
method: "get",
|
|
1674
|
+
path: "/api/v3.1/org/owner/project/{nano_id}",
|
|
1675
|
+
chain: [
|
|
1676
|
+
"org",
|
|
1677
|
+
"owner",
|
|
1678
|
+
"project",
|
|
1679
|
+
"retrieve"
|
|
1680
|
+
],
|
|
1681
|
+
schemes: ["OrgApiKeyAuth"]
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
method: "get",
|
|
1685
|
+
path: "/api/v3.1/org/project/list",
|
|
1686
|
+
chain: [
|
|
1687
|
+
"org",
|
|
1688
|
+
"project",
|
|
1689
|
+
"list"
|
|
1690
|
+
],
|
|
1691
|
+
schemes: ["UserApiKeyAuth"]
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
method: "get",
|
|
1695
|
+
path: "/api/v3.1/tool_router/session/{session_id}",
|
|
1696
|
+
chain: [
|
|
1697
|
+
"toolRouter",
|
|
1698
|
+
"session",
|
|
1699
|
+
"retrieve"
|
|
1700
|
+
]
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
method: "get",
|
|
1704
|
+
path: "/api/v3.1/tool_router/session/{session_id}/config_history",
|
|
1705
|
+
chain: [
|
|
1706
|
+
"toolRouter",
|
|
1707
|
+
"session",
|
|
1708
|
+
"configHistory"
|
|
1709
|
+
]
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
method: "get",
|
|
1713
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/items",
|
|
1714
|
+
chain: [
|
|
1715
|
+
"toolRouter",
|
|
1716
|
+
"session",
|
|
1717
|
+
"files",
|
|
1718
|
+
"list"
|
|
1719
|
+
]
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
method: "get",
|
|
1723
|
+
path: "/api/v3.1/tool_router/session/{session_id}/toolkits",
|
|
1724
|
+
chain: [
|
|
1725
|
+
"toolRouter",
|
|
1726
|
+
"session",
|
|
1727
|
+
"toolkits"
|
|
1728
|
+
]
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
method: "get",
|
|
1732
|
+
path: "/api/v3.1/tool_router/session/{session_id}/tools",
|
|
1733
|
+
chain: [
|
|
1734
|
+
"toolRouter",
|
|
1735
|
+
"session",
|
|
1736
|
+
"tools"
|
|
1737
|
+
]
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
method: "get",
|
|
1741
|
+
path: "/api/v3.1/toolkits",
|
|
1742
|
+
chain: ["toolkits", "list"],
|
|
1743
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
method: "get",
|
|
1747
|
+
path: "/api/v3.1/toolkits/categories",
|
|
1748
|
+
chain: ["toolkits", "retrieveCategories"]
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
method: "get",
|
|
1752
|
+
path: "/api/v3.1/toolkits/changelog",
|
|
1753
|
+
chain: ["toolkits", "retrieveChangelog"]
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
method: "get",
|
|
1757
|
+
path: "/api/v3.1/toolkits/{slug}",
|
|
1758
|
+
chain: ["toolkits", "retrieve"],
|
|
1759
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
method: "get",
|
|
1763
|
+
path: "/api/v3.1/tools",
|
|
1764
|
+
chain: ["tools", "list"],
|
|
1765
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1766
|
+
hasDeprecatedInputs: true
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
method: "get",
|
|
1770
|
+
path: "/api/v3.1/tools/enum",
|
|
1771
|
+
chain: ["tools", "retrieveEnum"],
|
|
1772
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
method: "get",
|
|
1776
|
+
path: "/api/v3.1/tools/{tool_slug}",
|
|
1777
|
+
chain: ["tools", "retrieve"],
|
|
1778
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
method: "get",
|
|
1782
|
+
path: "/api/v3.1/trigger_instances/active",
|
|
1783
|
+
chain: ["triggerInstances", "listActive"],
|
|
1784
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1785
|
+
hasDeprecatedInputs: true
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
method: "get",
|
|
1789
|
+
path: "/api/v3.1/triggers_types",
|
|
1790
|
+
chain: ["triggersTypes", "list"],
|
|
1791
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
method: "get",
|
|
1795
|
+
path: "/api/v3.1/triggers_types/list/enum",
|
|
1796
|
+
chain: ["triggersTypes", "retrieveEnum"],
|
|
1797
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
method: "get",
|
|
1801
|
+
path: "/api/v3.1/triggers_types/{slug}",
|
|
1802
|
+
chain: ["triggersTypes", "retrieve"],
|
|
1803
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
method: "get",
|
|
1807
|
+
path: "/api/v3.1/webhook_endpoints",
|
|
1808
|
+
chain: ["webhookEndpoints", "list"]
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
method: "get",
|
|
1812
|
+
path: "/api/v3.1/webhook_endpoints/{nano_id}",
|
|
1813
|
+
chain: ["webhookEndpoints", "retrieve"]
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
method: "get",
|
|
1817
|
+
path: "/api/v3.1/webhook_subscriptions",
|
|
1818
|
+
chain: ["webhookSubscriptions", "list"]
|
|
1819
|
+
},
|
|
1820
|
+
{
|
|
1821
|
+
method: "get",
|
|
1822
|
+
path: "/api/v3.1/webhook_subscriptions/event_types",
|
|
1823
|
+
chain: ["webhookSubscriptions", "listEventTypes"]
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
method: "get",
|
|
1827
|
+
path: "/api/v3.1/webhook_subscriptions/{id}",
|
|
1828
|
+
chain: ["webhookSubscriptions", "retrieve"]
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
method: "patch",
|
|
1832
|
+
path: "/api/v3.1/auth_configs/{nanoid}",
|
|
1833
|
+
chain: ["authConfigs", "update"],
|
|
1834
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
1835
|
+
hasDeprecatedInputs: true
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
method: "patch",
|
|
1839
|
+
path: "/api/v3.1/auth_configs/{nanoid}/{status}",
|
|
1840
|
+
chain: ["authConfigs", "updateStatus"]
|
|
1841
|
+
},
|
|
1842
|
+
{
|
|
1843
|
+
method: "patch",
|
|
1844
|
+
path: "/api/v3.1/connected_accounts/{nanoId}/status",
|
|
1845
|
+
chain: ["connectedAccounts", "updateStatus"]
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
method: "patch",
|
|
1849
|
+
path: "/api/v3.1/connected_accounts/{nanoid}",
|
|
1850
|
+
chain: ["connectedAccounts", "patch"]
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
method: "patch",
|
|
1854
|
+
path: "/api/v3.1/mcp/{id}",
|
|
1855
|
+
chain: ["mcp", "update"]
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
method: "patch",
|
|
1859
|
+
path: "/api/v3.1/tool_router/session/{session_id}",
|
|
1860
|
+
chain: [
|
|
1861
|
+
"toolRouter",
|
|
1862
|
+
"session",
|
|
1863
|
+
"patch"
|
|
1864
|
+
]
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
method: "patch",
|
|
1868
|
+
path: "/api/v3.1/trigger_instances/manage/{triggerId}",
|
|
1869
|
+
chain: [
|
|
1870
|
+
"triggerInstances",
|
|
1871
|
+
"manage",
|
|
1872
|
+
"update"
|
|
1873
|
+
],
|
|
1874
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
method: "patch",
|
|
1878
|
+
path: "/api/v3.1/webhook_endpoints/{nano_id}",
|
|
1879
|
+
chain: ["webhookEndpoints", "update"]
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
method: "patch",
|
|
1883
|
+
path: "/api/v3.1/webhook_subscriptions/{id}",
|
|
1884
|
+
chain: ["webhookSubscriptions", "update"]
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
method: "post",
|
|
1888
|
+
path: "/api/v3.1/api_key_revocation",
|
|
1889
|
+
chain: ["apiKeyRevocation", "create"],
|
|
1890
|
+
schemes: ["no_auth"]
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
method: "post",
|
|
1894
|
+
path: "/api/v3.1/auth_configs",
|
|
1895
|
+
chain: ["authConfigs", "create"],
|
|
1896
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
method: "post",
|
|
1900
|
+
path: "/api/v3.1/cli/codact_failures",
|
|
1901
|
+
chain: ["cli", "createCodactFailure"],
|
|
1902
|
+
schemes: ["UserApiKeyAuth"]
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
method: "post",
|
|
1906
|
+
path: "/api/v3.1/cli/create-session",
|
|
1907
|
+
chain: ["cli", "createSession"],
|
|
1908
|
+
schemes: ["no_auth"]
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
method: "post",
|
|
1912
|
+
path: "/api/v3.1/cli/realtime/auth",
|
|
1913
|
+
chain: [
|
|
1914
|
+
"cli",
|
|
1915
|
+
"realtime",
|
|
1916
|
+
"auth"
|
|
1917
|
+
],
|
|
1918
|
+
schemes: ["UserApiKeyAuth"]
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
method: "post",
|
|
1922
|
+
path: "/api/v3.1/connected_accounts",
|
|
1923
|
+
chain: ["connectedAccounts", "create"]
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
method: "post",
|
|
1927
|
+
path: "/api/v3.1/connected_accounts/link",
|
|
1928
|
+
chain: ["link", "create"],
|
|
1929
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
method: "post",
|
|
1933
|
+
path: "/api/v3.1/connected_accounts/{nanoid}/refresh",
|
|
1934
|
+
chain: ["connectedAccounts", "refresh"]
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
method: "post",
|
|
1938
|
+
path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
|
|
1939
|
+
chain: ["connectedAccounts", "revoke"]
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
method: "post",
|
|
1943
|
+
path: "/api/v3.1/files/upload/request",
|
|
1944
|
+
chain: ["files", "createPresignedURL"]
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
method: "post",
|
|
1948
|
+
path: "/api/v3.1/internal/action_execution/logs",
|
|
1949
|
+
chain: [
|
|
1950
|
+
"logs",
|
|
1951
|
+
"tools",
|
|
1952
|
+
"list"
|
|
1953
|
+
]
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
method: "post",
|
|
1957
|
+
path: "/api/v3.1/internal/trigger/logs",
|
|
1958
|
+
chain: [
|
|
1959
|
+
"logs",
|
|
1960
|
+
"triggers",
|
|
1961
|
+
"list"
|
|
1962
|
+
]
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
method: "post",
|
|
1966
|
+
path: "/api/v3.1/logs/tool_execution",
|
|
1967
|
+
chain: ["logs", "createToolExecution"]
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
method: "post",
|
|
1971
|
+
path: "/api/v3.1/mcp/servers",
|
|
1972
|
+
chain: ["mcp", "create"]
|
|
1973
|
+
},
|
|
1974
|
+
{
|
|
1975
|
+
method: "post",
|
|
1976
|
+
path: "/api/v3.1/mcp/servers/custom",
|
|
1977
|
+
chain: [
|
|
1978
|
+
"mcp",
|
|
1979
|
+
"custom",
|
|
1980
|
+
"create"
|
|
1981
|
+
]
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
method: "post",
|
|
1985
|
+
path: "/api/v3.1/mcp/servers/generate",
|
|
1986
|
+
chain: [
|
|
1987
|
+
"mcp",
|
|
1988
|
+
"generate",
|
|
1989
|
+
"url"
|
|
1990
|
+
]
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
method: "post",
|
|
1994
|
+
path: "/api/v3.1/mcp/servers/{serverId}/instances",
|
|
1995
|
+
chain: ["mcp", "createInstance"]
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
method: "post",
|
|
1999
|
+
path: "/api/v3.1/org/clanker/create_claim",
|
|
2000
|
+
chain: [
|
|
2001
|
+
"org",
|
|
2002
|
+
"clanker",
|
|
2003
|
+
"createClaim"
|
|
2004
|
+
],
|
|
2005
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
method: "post",
|
|
2009
|
+
path: "/api/v3.1/org/consumer/project/resolve",
|
|
2010
|
+
chain: [
|
|
2011
|
+
"org",
|
|
2012
|
+
"consumer",
|
|
2013
|
+
"project",
|
|
2014
|
+
"resolve"
|
|
2015
|
+
],
|
|
2016
|
+
schemes: ["UserApiKeyAuth"]
|
|
2017
|
+
},
|
|
2018
|
+
{
|
|
2019
|
+
method: "post",
|
|
2020
|
+
path: "/api/v3.1/org/owner/project/new",
|
|
2021
|
+
chain: [
|
|
2022
|
+
"org",
|
|
2023
|
+
"owner",
|
|
2024
|
+
"project",
|
|
2025
|
+
"create"
|
|
2026
|
+
],
|
|
2027
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
method: "post",
|
|
2031
|
+
path: "/api/v3.1/org/owner/project/{nano_id}/regenerate_api_key",
|
|
2032
|
+
chain: [
|
|
2033
|
+
"org",
|
|
2034
|
+
"owner",
|
|
2035
|
+
"project",
|
|
2036
|
+
"regenerateAPIKey"
|
|
2037
|
+
],
|
|
2038
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
method: "post",
|
|
2042
|
+
path: "/api/v3.1/org/usage/summary",
|
|
2043
|
+
chain: [
|
|
2044
|
+
"org",
|
|
2045
|
+
"usage",
|
|
2046
|
+
"retrieveSummary"
|
|
2047
|
+
],
|
|
2048
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
method: "post",
|
|
2052
|
+
path: "/api/v3.1/org/usage/{entity_type}",
|
|
2053
|
+
chain: [
|
|
2054
|
+
"org",
|
|
2055
|
+
"usage",
|
|
2056
|
+
"retrieve"
|
|
2057
|
+
],
|
|
2058
|
+
schemes: ["OrgApiKeyAuth"]
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
method: "post",
|
|
2062
|
+
path: "/api/v3.1/project/usage/summary",
|
|
2063
|
+
chain: [
|
|
2064
|
+
"project",
|
|
2065
|
+
"usage",
|
|
2066
|
+
"retrieveSummary"
|
|
2067
|
+
]
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
method: "post",
|
|
2071
|
+
path: "/api/v3.1/project/usage/{entity_type}",
|
|
2072
|
+
chain: [
|
|
2073
|
+
"project",
|
|
2074
|
+
"usage",
|
|
2075
|
+
"retrieve"
|
|
2076
|
+
]
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
method: "post",
|
|
2080
|
+
path: "/api/v3.1/tool_router/session",
|
|
2081
|
+
chain: [
|
|
2082
|
+
"toolRouter",
|
|
2083
|
+
"session",
|
|
2084
|
+
"create"
|
|
2085
|
+
]
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
method: "post",
|
|
2089
|
+
path: "/api/v3.1/tool_router/session/{session_id}/attach",
|
|
2090
|
+
chain: [
|
|
2091
|
+
"toolRouter",
|
|
2092
|
+
"session",
|
|
2093
|
+
"attach"
|
|
2094
|
+
]
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
method: "post",
|
|
2098
|
+
path: "/api/v3.1/tool_router/session/{session_id}/execute",
|
|
2099
|
+
chain: [
|
|
2100
|
+
"toolRouter",
|
|
2101
|
+
"session",
|
|
2102
|
+
"execute"
|
|
2103
|
+
],
|
|
2104
|
+
schemes: ["ApiKeyAuth", "workbench_access_key"]
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
method: "post",
|
|
2108
|
+
path: "/api/v3.1/tool_router/session/{session_id}/execute_meta",
|
|
2109
|
+
chain: [
|
|
2110
|
+
"toolRouter",
|
|
2111
|
+
"session",
|
|
2112
|
+
"executeMeta"
|
|
2113
|
+
]
|
|
2114
|
+
},
|
|
2115
|
+
{
|
|
2116
|
+
method: "post",
|
|
2117
|
+
path: "/api/v3.1/tool_router/session/{session_id}/link",
|
|
2118
|
+
chain: [
|
|
2119
|
+
"toolRouter",
|
|
2120
|
+
"session",
|
|
2121
|
+
"link"
|
|
2122
|
+
]
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
method: "post",
|
|
2126
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/delete",
|
|
2127
|
+
chain: [
|
|
2128
|
+
"toolRouter",
|
|
2129
|
+
"session",
|
|
2130
|
+
"files",
|
|
2131
|
+
"delete"
|
|
2132
|
+
]
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
method: "post",
|
|
2136
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/download_url",
|
|
2137
|
+
chain: [
|
|
2138
|
+
"toolRouter",
|
|
2139
|
+
"session",
|
|
2140
|
+
"files",
|
|
2141
|
+
"createDownloadURL"
|
|
2142
|
+
]
|
|
2143
|
+
},
|
|
2144
|
+
{
|
|
2145
|
+
method: "post",
|
|
2146
|
+
path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/upload_url",
|
|
2147
|
+
chain: [
|
|
2148
|
+
"toolRouter",
|
|
2149
|
+
"session",
|
|
2150
|
+
"files",
|
|
2151
|
+
"createUploadURL"
|
|
2152
|
+
]
|
|
2153
|
+
},
|
|
2154
|
+
{
|
|
2155
|
+
method: "post",
|
|
2156
|
+
path: "/api/v3.1/tool_router/session/{session_id}/proxy_execute",
|
|
2157
|
+
chain: [
|
|
2158
|
+
"toolRouter",
|
|
2159
|
+
"session",
|
|
2160
|
+
"proxyExecute"
|
|
2161
|
+
],
|
|
2162
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
|
|
2163
|
+
},
|
|
2164
|
+
{
|
|
2165
|
+
method: "post",
|
|
2166
|
+
path: "/api/v3.1/tool_router/session/{session_id}/search",
|
|
2167
|
+
chain: [
|
|
2168
|
+
"toolRouter",
|
|
2169
|
+
"session",
|
|
2170
|
+
"search"
|
|
2171
|
+
]
|
|
2172
|
+
},
|
|
2173
|
+
{
|
|
2174
|
+
method: "post",
|
|
2175
|
+
path: "/api/v3.1/toolkits/multi",
|
|
2176
|
+
chain: ["toolkits", "retrieveMulti"]
|
|
2177
|
+
},
|
|
2178
|
+
{
|
|
2179
|
+
method: "post",
|
|
2180
|
+
path: "/api/v3.1/tools/execute/proxy",
|
|
2181
|
+
chain: ["tools", "proxy"],
|
|
2182
|
+
hasDeprecatedInputs: true
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
method: "post",
|
|
2186
|
+
path: "/api/v3.1/tools/execute/{tool_slug}",
|
|
2187
|
+
chain: ["tools", "execute"],
|
|
2188
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
2189
|
+
hasDeprecatedInputs: true
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
method: "post",
|
|
2193
|
+
path: "/api/v3.1/tools/execute/{tool_slug}/input",
|
|
2194
|
+
chain: ["tools", "getInput"]
|
|
2195
|
+
},
|
|
2196
|
+
{
|
|
2197
|
+
method: "post",
|
|
2198
|
+
path: "/api/v3.1/tools/scopes/required",
|
|
2199
|
+
chain: ["tools", "retrieveRequiredScopes"]
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
method: "post",
|
|
2203
|
+
path: "/api/v3.1/trigger_instances/{slug}/upsert",
|
|
2204
|
+
chain: ["triggerInstances", "upsert"],
|
|
2205
|
+
schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
|
|
2206
|
+
hasDeprecatedInputs: true
|
|
2207
|
+
},
|
|
2208
|
+
{
|
|
2209
|
+
method: "post",
|
|
2210
|
+
path: "/api/v3.1/webhook_endpoints",
|
|
2211
|
+
chain: ["webhookEndpoints", "create"]
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
method: "post",
|
|
2215
|
+
path: "/api/v3.1/webhook_endpoints/{nano_id}",
|
|
2216
|
+
chain: ["webhookEndpoints", "replace"]
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
method: "post",
|
|
2220
|
+
path: "/api/v3.1/webhook_subscriptions",
|
|
2221
|
+
chain: ["webhookSubscriptions", "create"]
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
method: "post",
|
|
2225
|
+
path: "/api/v3.1/webhook_subscriptions/{id}/rotate_secret",
|
|
2226
|
+
chain: ["webhookSubscriptions", "rotateSecret"]
|
|
2227
|
+
}
|
|
2228
|
+
];
|
|
2229
|
+
/**
|
|
2230
|
+
* The same descriptors, indexed by public chain — what a generated resource
|
|
2231
|
+
* resolves its own operation from at module load, so the kernel reads
|
|
2232
|
+
* identity off the call instead of recovering it from the URL.
|
|
2233
|
+
*
|
|
2234
|
+
* Built from the array rather than emitted a second time, so the two indexes
|
|
2235
|
+
* hold the *same objects* and cannot drift apart.
|
|
2236
|
+
*/
|
|
2237
|
+
const GENERATED_OPERATIONS_BY_KEY = new Map(GENERATED_OPERATIONS.map((operation) => [operation.chain.join("."), operation]));
|
|
2238
|
+
/**
|
|
2239
|
+
* The descriptor a generated method dispatches with. A miss is a generator
|
|
2240
|
+
* defect, not a runtime condition, so it fails at import time rather than
|
|
2241
|
+
* silently degrading that method back to path matching.
|
|
2242
|
+
*/
|
|
2243
|
+
const generatedOperation = (chainKey) => {
|
|
2244
|
+
const operation = GENERATED_OPERATIONS_BY_KEY.get(chainKey);
|
|
2245
|
+
if (operation === void 0) throw new Error(`generated-operations: no operation for chain '${chainKey}'`);
|
|
2246
|
+
return operation;
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
//#endregion
|
|
2250
|
+
export { PermissionDeniedError as C, NotFoundError as S, UnprocessableEntityError as T, AuthenticationError as _, path as a, ConflictError as b, withOperation as c, assertCredentialTransport as d, mergeHeaders as f, APIUserAbortError as g, APIError as h, makeRequest as i, inspectDeprecatedInputs as l, APIConnectionTimeoutError as m, generatedOperation as n, readOperation as o, APIConnectionError as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecation as u, BadRequestError as v, RateLimitError as w, InternalServerError as x, ComposioError as y };
|