@squadbase/vite-server 0.1.9-dev.f236b23 → 0.1.10-dev.9dac57b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1027 -508
- package/dist/connectors/aws-billing.js +18 -4
- package/dist/connectors/azure-sql.js +20374 -16
- package/dist/connectors/cosmosdb.d.ts +5 -0
- package/dist/connectors/cosmosdb.js +743 -0
- package/dist/connectors/google-ads.js +114 -112
- package/dist/connectors/jdbc.js +244 -165
- package/dist/connectors/oracle.js +20408 -26
- package/dist/connectors/semrush.js +109 -21
- package/dist/connectors/sqlserver.js +20370 -15
- package/dist/index.js +1015 -496
- package/dist/main.js +1015 -496
- package/dist/vite-plugin.js +1027 -508
- package/package.json +7 -2
package/dist/vite-plugin.js
CHANGED
|
@@ -909,17 +909,17 @@ var require_nacl_fast = __commonJS({
|
|
|
909
909
|
}
|
|
910
910
|
var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
|
|
911
911
|
function crypto_stream_salsa20_xor(c6, cpos, m4, mpos, b6, n2, k6) {
|
|
912
|
-
var
|
|
912
|
+
var z98 = new Uint8Array(16), x = new Uint8Array(64);
|
|
913
913
|
var u, i6;
|
|
914
|
-
for (i6 = 0; i6 < 16; i6++)
|
|
915
|
-
for (i6 = 0; i6 < 8; i6++)
|
|
914
|
+
for (i6 = 0; i6 < 16; i6++) z98[i6] = 0;
|
|
915
|
+
for (i6 = 0; i6 < 8; i6++) z98[i6] = n2[i6];
|
|
916
916
|
while (b6 >= 64) {
|
|
917
|
-
crypto_core_salsa20(x,
|
|
917
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
918
918
|
for (i6 = 0; i6 < 64; i6++) c6[cpos + i6] = m4[mpos + i6] ^ x[i6];
|
|
919
919
|
u = 1;
|
|
920
920
|
for (i6 = 8; i6 < 16; i6++) {
|
|
921
|
-
u = u + (
|
|
922
|
-
|
|
921
|
+
u = u + (z98[i6] & 255) | 0;
|
|
922
|
+
z98[i6] = u & 255;
|
|
923
923
|
u >>>= 8;
|
|
924
924
|
}
|
|
925
925
|
b6 -= 64;
|
|
@@ -927,30 +927,30 @@ var require_nacl_fast = __commonJS({
|
|
|
927
927
|
mpos += 64;
|
|
928
928
|
}
|
|
929
929
|
if (b6 > 0) {
|
|
930
|
-
crypto_core_salsa20(x,
|
|
930
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
931
931
|
for (i6 = 0; i6 < b6; i6++) c6[cpos + i6] = m4[mpos + i6] ^ x[i6];
|
|
932
932
|
}
|
|
933
933
|
return 0;
|
|
934
934
|
}
|
|
935
935
|
function crypto_stream_salsa20(c6, cpos, b6, n2, k6) {
|
|
936
|
-
var
|
|
936
|
+
var z98 = new Uint8Array(16), x = new Uint8Array(64);
|
|
937
937
|
var u, i6;
|
|
938
|
-
for (i6 = 0; i6 < 16; i6++)
|
|
939
|
-
for (i6 = 0; i6 < 8; i6++)
|
|
938
|
+
for (i6 = 0; i6 < 16; i6++) z98[i6] = 0;
|
|
939
|
+
for (i6 = 0; i6 < 8; i6++) z98[i6] = n2[i6];
|
|
940
940
|
while (b6 >= 64) {
|
|
941
|
-
crypto_core_salsa20(x,
|
|
941
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
942
942
|
for (i6 = 0; i6 < 64; i6++) c6[cpos + i6] = x[i6];
|
|
943
943
|
u = 1;
|
|
944
944
|
for (i6 = 8; i6 < 16; i6++) {
|
|
945
|
-
u = u + (
|
|
946
|
-
|
|
945
|
+
u = u + (z98[i6] & 255) | 0;
|
|
946
|
+
z98[i6] = u & 255;
|
|
947
947
|
u >>>= 8;
|
|
948
948
|
}
|
|
949
949
|
b6 -= 64;
|
|
950
950
|
cpos += 64;
|
|
951
951
|
}
|
|
952
952
|
if (b6 > 0) {
|
|
953
|
-
crypto_core_salsa20(x,
|
|
953
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
954
954
|
for (i6 = 0; i6 < b6; i6++) c6[cpos + i6] = x[i6];
|
|
955
955
|
}
|
|
956
956
|
return 0;
|
|
@@ -1830,12 +1830,12 @@ var require_nacl_fast = __commonJS({
|
|
|
1830
1830
|
for (a6 = 0; a6 < 16; a6++) o2[a6] = c6[a6];
|
|
1831
1831
|
}
|
|
1832
1832
|
function crypto_scalarmult(q2, n2, p2) {
|
|
1833
|
-
var
|
|
1833
|
+
var z98 = new Uint8Array(32);
|
|
1834
1834
|
var x = new Float64Array(80), r6, i6;
|
|
1835
1835
|
var a6 = gf(), b6 = gf(), c6 = gf(), d6 = gf(), e6 = gf(), f6 = gf();
|
|
1836
|
-
for (i6 = 0; i6 < 31; i6++)
|
|
1837
|
-
|
|
1838
|
-
|
|
1836
|
+
for (i6 = 0; i6 < 31; i6++) z98[i6] = n2[i6];
|
|
1837
|
+
z98[31] = n2[31] & 127 | 64;
|
|
1838
|
+
z98[0] &= 248;
|
|
1839
1839
|
unpack25519(x, p2);
|
|
1840
1840
|
for (i6 = 0; i6 < 16; i6++) {
|
|
1841
1841
|
b6[i6] = x[i6];
|
|
@@ -1843,7 +1843,7 @@ var require_nacl_fast = __commonJS({
|
|
|
1843
1843
|
}
|
|
1844
1844
|
a6[0] = d6[0] = 1;
|
|
1845
1845
|
for (i6 = 254; i6 >= 0; --i6) {
|
|
1846
|
-
r6 =
|
|
1846
|
+
r6 = z98[i6 >>> 3] >>> (i6 & 7) & 1;
|
|
1847
1847
|
sel25519(a6, b6, r6);
|
|
1848
1848
|
sel25519(c6, d6, r6);
|
|
1849
1849
|
A(e6, a6, c6);
|
|
@@ -4860,8 +4860,8 @@ var require_poly1305 = __commonJS({
|
|
|
4860
4860
|
});
|
|
4861
4861
|
var u = {}, w;
|
|
4862
4862
|
for (w in b6) b6.hasOwnProperty(w) && (u[w] = b6[w]);
|
|
4863
|
-
var x = "object" === typeof window, y = "function" === typeof importScripts,
|
|
4864
|
-
if (
|
|
4863
|
+
var x = "object" === typeof window, y = "function" === typeof importScripts, z98 = "object" === typeof process && "object" === typeof process.versions && "string" === typeof process.versions.node, B = "", C, D, E, F, G;
|
|
4864
|
+
if (z98) B = y ? __require("path").dirname(B) + "/" : __dirname + "/", C = function(a6, c6) {
|
|
4865
4865
|
var d6 = H(a6);
|
|
4866
4866
|
if (d6) return c6 ? d6 : d6.toString();
|
|
4867
4867
|
F || (F = __require("fs"));
|
|
@@ -5117,7 +5117,7 @@ var require_poly1305 = __commonJS({
|
|
|
5117
5117
|
function H(a6) {
|
|
5118
5118
|
if (a6.startsWith(V)) {
|
|
5119
5119
|
a6 = a6.slice(V.length);
|
|
5120
|
-
if ("boolean" === typeof
|
|
5120
|
+
if ("boolean" === typeof z98 && z98) {
|
|
5121
5121
|
var c6 = Buffer.from(a6, "base64");
|
|
5122
5122
|
c6 = new Uint8Array(c6.buffer, c6.byteOffset, c6.byteLength);
|
|
5123
5123
|
} else try {
|
|
@@ -39040,14 +39040,14 @@ var init_NormalizedSchema = __esm({
|
|
|
39040
39040
|
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
|
39041
39041
|
}
|
|
39042
39042
|
const struct = this.getSchema();
|
|
39043
|
-
const
|
|
39043
|
+
const z98 = struct[4].length;
|
|
39044
39044
|
let it = struct[anno.it];
|
|
39045
|
-
if (it &&
|
|
39045
|
+
if (it && z98 === it.length) {
|
|
39046
39046
|
yield* it;
|
|
39047
39047
|
return;
|
|
39048
39048
|
}
|
|
39049
|
-
it = Array(
|
|
39050
|
-
for (let i6 = 0; i6 <
|
|
39049
|
+
it = Array(z98);
|
|
39050
|
+
for (let i6 = 0; i6 < z98; ++i6) {
|
|
39051
39051
|
const k6 = struct[4][i6];
|
|
39052
39052
|
const v = member([struct[5][i6], 0], k6);
|
|
39053
39053
|
yield it[i6] = [k6, v];
|
|
@@ -39728,12 +39728,12 @@ var init_split_header = __esm({
|
|
|
39728
39728
|
"../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"() {
|
|
39729
39729
|
"use strict";
|
|
39730
39730
|
splitHeader = (value) => {
|
|
39731
|
-
const
|
|
39731
|
+
const z98 = value.length;
|
|
39732
39732
|
const values = [];
|
|
39733
39733
|
let withinQuotes = false;
|
|
39734
39734
|
let prevChar = void 0;
|
|
39735
39735
|
let anchor = 0;
|
|
39736
|
-
for (let i6 = 0; i6 <
|
|
39736
|
+
for (let i6 = 0; i6 < z98; ++i6) {
|
|
39737
39737
|
const char = value[i6];
|
|
39738
39738
|
switch (char) {
|
|
39739
39739
|
case `"`:
|
|
@@ -39754,12 +39754,12 @@ var init_split_header = __esm({
|
|
|
39754
39754
|
values.push(value.slice(anchor));
|
|
39755
39755
|
return values.map((v) => {
|
|
39756
39756
|
v = v.trim();
|
|
39757
|
-
const
|
|
39758
|
-
if (
|
|
39757
|
+
const z99 = v.length;
|
|
39758
|
+
if (z99 < 2) {
|
|
39759
39759
|
return v;
|
|
39760
39760
|
}
|
|
39761
|
-
if (v[0] === `"` && v[
|
|
39762
|
-
v = v.slice(1,
|
|
39761
|
+
if (v[0] === `"` && v[z99 - 1] === `"`) {
|
|
39762
|
+
v = v.slice(1, z99 - 1);
|
|
39763
39763
|
}
|
|
39764
39764
|
return v.replace(/\\"/g, '"');
|
|
39765
39765
|
});
|
|
@@ -41196,11 +41196,11 @@ var init_EndpointCache = __esm({
|
|
|
41196
41196
|
}
|
|
41197
41197
|
hash(endpointParams) {
|
|
41198
41198
|
let buffer = "";
|
|
41199
|
-
const { parameters:
|
|
41200
|
-
if (
|
|
41199
|
+
const { parameters: parameters80 } = this;
|
|
41200
|
+
if (parameters80.length === 0) {
|
|
41201
41201
|
return false;
|
|
41202
41202
|
}
|
|
41203
|
-
for (const param of
|
|
41203
|
+
for (const param of parameters80) {
|
|
41204
41204
|
const val = String(endpointParams[param] ?? "");
|
|
41205
41205
|
if (val.includes("|;")) {
|
|
41206
41206
|
return false;
|
|
@@ -47672,8 +47672,8 @@ var init_ProtocolLib = __esm({
|
|
|
47672
47672
|
constructor(queryCompat = false) {
|
|
47673
47673
|
this.queryCompat = queryCompat;
|
|
47674
47674
|
}
|
|
47675
|
-
resolveRestContentType(defaultContentType,
|
|
47676
|
-
const members =
|
|
47675
|
+
resolveRestContentType(defaultContentType, inputSchema97) {
|
|
47676
|
+
const members = inputSchema97.getMemberSchemas();
|
|
47677
47677
|
const httpPayloadMember = Object.values(members).find((m4) => {
|
|
47678
47678
|
return !!m4.getMergedTraits().httpPayload;
|
|
47679
47679
|
});
|
|
@@ -47688,7 +47688,7 @@ var init_ProtocolLib = __esm({
|
|
|
47688
47688
|
} else {
|
|
47689
47689
|
return defaultContentType;
|
|
47690
47690
|
}
|
|
47691
|
-
} else if (!
|
|
47691
|
+
} else if (!inputSchema97.isUnitSchema()) {
|
|
47692
47692
|
const hasBody = Object.values(members).find((m4) => {
|
|
47693
47693
|
const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m4.getMergedTraits();
|
|
47694
47694
|
const noPrefixHeaders = httpPrefixHeaders === void 0;
|
|
@@ -48541,9 +48541,9 @@ var init_AwsRestJsonProtocol = __esm({
|
|
|
48541
48541
|
}
|
|
48542
48542
|
async serializeRequest(operationSchema, input, context) {
|
|
48543
48543
|
const request2 = await super.serializeRequest(operationSchema, input, context);
|
|
48544
|
-
const
|
|
48544
|
+
const inputSchema97 = NormalizedSchema.of(operationSchema.input);
|
|
48545
48545
|
if (!request2.headers["content-type"]) {
|
|
48546
|
-
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(),
|
|
48546
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema97);
|
|
48547
48547
|
if (contentType) {
|
|
48548
48548
|
request2.headers["content-type"] = contentType;
|
|
48549
48549
|
}
|
|
@@ -48555,8 +48555,8 @@ var init_AwsRestJsonProtocol = __esm({
|
|
|
48555
48555
|
}
|
|
48556
48556
|
async deserializeResponse(operationSchema, context, response) {
|
|
48557
48557
|
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
48558
|
-
const
|
|
48559
|
-
for (const [name, member2] of
|
|
48558
|
+
const outputSchema97 = NormalizedSchema.of(operationSchema.output);
|
|
48559
|
+
for (const [name, member2] of outputSchema97.structIterator()) {
|
|
48560
48560
|
if (member2.getMemberTraits().httpPayload && !(name in output)) {
|
|
48561
48561
|
output[name] = null;
|
|
48562
48562
|
}
|
|
@@ -54374,22 +54374,22 @@ var init_loadCognitoIdentity = __esm({
|
|
|
54374
54374
|
});
|
|
54375
54375
|
|
|
54376
54376
|
// ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
|
|
54377
|
-
function fromCognitoIdentity(
|
|
54377
|
+
function fromCognitoIdentity(parameters80) {
|
|
54378
54378
|
return async (awsIdentityProperties) => {
|
|
54379
|
-
|
|
54379
|
+
parameters80.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
|
|
54380
54380
|
const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
54381
|
-
const fromConfigs = (property) =>
|
|
54382
|
-
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(
|
|
54381
|
+
const fromConfigs = (property) => parameters80.clientConfig?.[property] ?? parameters80.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
|
|
54382
|
+
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters80.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters80.logger), SessionToken } = throwOnMissingCredentials(parameters80.logger) } = await (parameters80.client ?? new CognitoIdentityClient2(Object.assign({}, parameters80.clientConfig ?? {}, {
|
|
54383
54383
|
region: fromConfigs("region"),
|
|
54384
54384
|
profile: fromConfigs("profile"),
|
|
54385
54385
|
userAgentAppId: fromConfigs("userAgentAppId")
|
|
54386
54386
|
}))).send(new GetCredentialsForIdentityCommand2({
|
|
54387
|
-
CustomRoleArn:
|
|
54388
|
-
IdentityId:
|
|
54389
|
-
Logins:
|
|
54387
|
+
CustomRoleArn: parameters80.customRoleArn,
|
|
54388
|
+
IdentityId: parameters80.identityId,
|
|
54389
|
+
Logins: parameters80.logins ? await resolveLogins(parameters80.logins) : void 0
|
|
54390
54390
|
}));
|
|
54391
54391
|
return {
|
|
54392
|
-
identityId:
|
|
54392
|
+
identityId: parameters80.identityId,
|
|
54393
54393
|
accessKeyId: AccessKeyId,
|
|
54394
54394
|
secretAccessKey: SecretKey,
|
|
54395
54395
|
sessionToken: SessionToken,
|
|
@@ -62168,7 +62168,7 @@ __export(lib_exports, {
|
|
|
62168
62168
|
FetchError: () => FetchError,
|
|
62169
62169
|
Headers: () => Headers2,
|
|
62170
62170
|
Request: () => Request2,
|
|
62171
|
-
Response: () =>
|
|
62171
|
+
Response: () => Response2,
|
|
62172
62172
|
default: () => lib_default
|
|
62173
62173
|
});
|
|
62174
62174
|
import Stream from "stream";
|
|
@@ -62694,7 +62694,7 @@ function fetch2(url, opts) {
|
|
|
62694
62694
|
};
|
|
62695
62695
|
const codings = headers.get("Content-Encoding");
|
|
62696
62696
|
if (!request2.compress || request2.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
62697
|
-
response = new
|
|
62697
|
+
response = new Response2(body, response_options);
|
|
62698
62698
|
resolve(response);
|
|
62699
62699
|
return;
|
|
62700
62700
|
}
|
|
@@ -62704,7 +62704,7 @@ function fetch2(url, opts) {
|
|
|
62704
62704
|
};
|
|
62705
62705
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
62706
62706
|
body = body.pipe(zlib.createGunzip(zlibOptions));
|
|
62707
|
-
response = new
|
|
62707
|
+
response = new Response2(body, response_options);
|
|
62708
62708
|
resolve(response);
|
|
62709
62709
|
return;
|
|
62710
62710
|
}
|
|
@@ -62716,12 +62716,12 @@ function fetch2(url, opts) {
|
|
|
62716
62716
|
} else {
|
|
62717
62717
|
body = body.pipe(zlib.createInflateRaw());
|
|
62718
62718
|
}
|
|
62719
|
-
response = new
|
|
62719
|
+
response = new Response2(body, response_options);
|
|
62720
62720
|
resolve(response);
|
|
62721
62721
|
});
|
|
62722
62722
|
raw.on("end", function() {
|
|
62723
62723
|
if (!response) {
|
|
62724
|
-
response = new
|
|
62724
|
+
response = new Response2(body, response_options);
|
|
62725
62725
|
resolve(response);
|
|
62726
62726
|
}
|
|
62727
62727
|
});
|
|
@@ -62729,11 +62729,11 @@ function fetch2(url, opts) {
|
|
|
62729
62729
|
}
|
|
62730
62730
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
62731
62731
|
body = body.pipe(zlib.createBrotliDecompress());
|
|
62732
|
-
response = new
|
|
62732
|
+
response = new Response2(body, response_options);
|
|
62733
62733
|
resolve(response);
|
|
62734
62734
|
return;
|
|
62735
62735
|
}
|
|
62736
|
-
response = new
|
|
62736
|
+
response = new Response2(body, response_options);
|
|
62737
62737
|
resolve(response);
|
|
62738
62738
|
});
|
|
62739
62739
|
writeToStream(req, request2);
|
|
@@ -62766,7 +62766,7 @@ function destroyStream(stream, err) {
|
|
|
62766
62766
|
stream.end();
|
|
62767
62767
|
}
|
|
62768
62768
|
}
|
|
62769
|
-
var import_whatwg_url, Readable6, BUFFER, TYPE, Blob2, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers2, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES,
|
|
62769
|
+
var import_whatwg_url, Readable6, BUFFER, TYPE, Blob2, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers2, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES, Response2, INTERNALS$2, URL2, parse_url, format_url, streamDestructionSupported, Request2, URL$1, PassThrough$1, isDomainOrSubdomain, isSameProtocol, lib_default;
|
|
62770
62770
|
var init_lib2 = __esm({
|
|
62771
62771
|
"../../node_modules/node-fetch/lib/index.mjs"() {
|
|
62772
62772
|
"use strict";
|
|
@@ -63209,7 +63209,7 @@ var init_lib2 = __esm({
|
|
|
63209
63209
|
});
|
|
63210
63210
|
INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
63211
63211
|
STATUS_CODES = http.STATUS_CODES;
|
|
63212
|
-
|
|
63212
|
+
Response2 = class _Response {
|
|
63213
63213
|
constructor() {
|
|
63214
63214
|
let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
63215
63215
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -63267,8 +63267,8 @@ var init_lib2 = __esm({
|
|
|
63267
63267
|
});
|
|
63268
63268
|
}
|
|
63269
63269
|
};
|
|
63270
|
-
Body.mixIn(
|
|
63271
|
-
Object.defineProperties(
|
|
63270
|
+
Body.mixIn(Response2.prototype);
|
|
63271
|
+
Object.defineProperties(Response2.prototype, {
|
|
63272
63272
|
url: { enumerable: true },
|
|
63273
63273
|
status: { enumerable: true },
|
|
63274
63274
|
ok: { enumerable: true },
|
|
@@ -63277,7 +63277,7 @@ var init_lib2 = __esm({
|
|
|
63277
63277
|
headers: { enumerable: true },
|
|
63278
63278
|
clone: { enumerable: true }
|
|
63279
63279
|
});
|
|
63280
|
-
Object.defineProperty(
|
|
63280
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
63281
63281
|
value: "Response",
|
|
63282
63282
|
writable: false,
|
|
63283
63283
|
enumerable: false,
|
|
@@ -67146,11 +67146,11 @@ var require_bignumber = __commonJS({
|
|
|
67146
67146
|
return n2 > 0 || n2 === i6 ? i6 : i6 - 1;
|
|
67147
67147
|
}
|
|
67148
67148
|
function coeffToString(a6) {
|
|
67149
|
-
var s,
|
|
67149
|
+
var s, z98, i6 = 1, j6 = a6.length, r6 = a6[0] + "";
|
|
67150
67150
|
for (; i6 < j6; ) {
|
|
67151
67151
|
s = a6[i6++] + "";
|
|
67152
|
-
|
|
67153
|
-
for (;
|
|
67152
|
+
z98 = LOG_BASE - s.length;
|
|
67153
|
+
for (; z98--; s = "0" + s) ;
|
|
67154
67154
|
r6 += s;
|
|
67155
67155
|
}
|
|
67156
67156
|
for (j6 = r6.length; r6.charCodeAt(--j6) === 48; ) ;
|
|
@@ -67183,15 +67183,15 @@ var require_bignumber = __commonJS({
|
|
|
67183
67183
|
function toExponential(str, e6) {
|
|
67184
67184
|
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e6 < 0 ? "e" : "e+") + e6;
|
|
67185
67185
|
}
|
|
67186
|
-
function toFixedPoint(str, e6,
|
|
67186
|
+
function toFixedPoint(str, e6, z98) {
|
|
67187
67187
|
var len, zs;
|
|
67188
67188
|
if (e6 < 0) {
|
|
67189
|
-
for (zs =
|
|
67189
|
+
for (zs = z98 + "."; ++e6; zs += z98) ;
|
|
67190
67190
|
str = zs + str;
|
|
67191
67191
|
} else {
|
|
67192
67192
|
len = str.length;
|
|
67193
67193
|
if (++e6 > len) {
|
|
67194
|
-
for (zs =
|
|
67194
|
+
for (zs = z98, e6 -= len; --e6; zs += z98) ;
|
|
67195
67195
|
str += zs;
|
|
67196
67196
|
} else if (e6 < len) {
|
|
67197
67197
|
str = str.slice(0, e6) + "." + str.slice(e6);
|
|
@@ -89644,6 +89644,12 @@ var NOOP_TUNNEL = (connectionUrl) => ({
|
|
|
89644
89644
|
close: async () => {
|
|
89645
89645
|
}
|
|
89646
89646
|
});
|
|
89647
|
+
var NOOP_TUNNEL_HOSTPORT = (host, port) => ({
|
|
89648
|
+
host,
|
|
89649
|
+
port,
|
|
89650
|
+
close: async () => {
|
|
89651
|
+
}
|
|
89652
|
+
});
|
|
89647
89653
|
function connectionParamsToRecord(connection) {
|
|
89648
89654
|
const out = {};
|
|
89649
89655
|
for (const p2 of connection.parameters) {
|
|
@@ -89651,9 +89657,9 @@ function connectionParamsToRecord(connection) {
|
|
|
89651
89657
|
}
|
|
89652
89658
|
return out;
|
|
89653
89659
|
}
|
|
89654
|
-
async function
|
|
89660
|
+
async function maybeOpenSshTunnelHostPort(params, dbHost, dbPort) {
|
|
89655
89661
|
const sshHost = params[sshTunnelParameters.sshHost.slug];
|
|
89656
|
-
if (!sshHost) return
|
|
89662
|
+
if (!sshHost) return NOOP_TUNNEL_HOSTPORT(dbHost, dbPort);
|
|
89657
89663
|
const sshUsername = params[sshTunnelParameters.sshUsername.slug];
|
|
89658
89664
|
const sshPrivateKeyBase64 = params[sshTunnelParameters.sshPrivateKeyBase64.slug];
|
|
89659
89665
|
if (!sshUsername || !sshPrivateKeyBase64) {
|
|
@@ -89663,9 +89669,6 @@ async function maybeOpenSshTunnel(params, connectionUrl, defaultDbPort) {
|
|
|
89663
89669
|
}
|
|
89664
89670
|
const sshPort = Number(params[sshTunnelParameters.sshPort.slug] || "22") || 22;
|
|
89665
89671
|
const sshPassphrase = params[sshTunnelParameters.sshPassphrase.slug];
|
|
89666
|
-
const url = new URL(connectionUrl);
|
|
89667
|
-
const dbHost = url.hostname;
|
|
89668
|
-
const dbPort = url.port ? Number(url.port) : defaultDbPort;
|
|
89669
89672
|
const [{ Client: Client2 }, net] = await Promise.all([
|
|
89670
89673
|
Promise.resolve().then(() => __toESM(require_lib3(), 1)),
|
|
89671
89674
|
import("net")
|
|
@@ -89708,16 +89711,29 @@ async function maybeOpenSshTunnel(params, connectionUrl, defaultDbPort) {
|
|
|
89708
89711
|
sshClient.end();
|
|
89709
89712
|
throw new Error("Failed to allocate local port for SSH tunnel.");
|
|
89710
89713
|
}
|
|
89711
|
-
url.hostname = "127.0.0.1";
|
|
89712
|
-
url.port = String(address.port);
|
|
89713
89714
|
return {
|
|
89714
|
-
|
|
89715
|
+
host: "127.0.0.1",
|
|
89716
|
+
port: address.port,
|
|
89715
89717
|
close: async () => {
|
|
89716
89718
|
await new Promise((resolve) => server.close(() => resolve()));
|
|
89717
89719
|
sshClient.end();
|
|
89718
89720
|
}
|
|
89719
89721
|
};
|
|
89720
89722
|
}
|
|
89723
|
+
async function maybeOpenSshTunnel(params, connectionUrl, defaultDbPort) {
|
|
89724
|
+
const sshHost = params[sshTunnelParameters.sshHost.slug];
|
|
89725
|
+
if (!sshHost) return NOOP_TUNNEL(connectionUrl);
|
|
89726
|
+
const url = new URL(connectionUrl);
|
|
89727
|
+
const dbHost = url.hostname;
|
|
89728
|
+
const dbPort = url.port ? Number(url.port) : defaultDbPort;
|
|
89729
|
+
const tunnel = await maybeOpenSshTunnelHostPort(params, dbHost, dbPort);
|
|
89730
|
+
url.hostname = tunnel.host;
|
|
89731
|
+
url.port = String(tunnel.port);
|
|
89732
|
+
return {
|
|
89733
|
+
connectionUrl: url.toString(),
|
|
89734
|
+
close: tunnel.close
|
|
89735
|
+
};
|
|
89736
|
+
}
|
|
89721
89737
|
|
|
89722
89738
|
// ../connectors/src/connectors/postgresql/setup.ts
|
|
89723
89739
|
var postgresqlOnboarding = new ConnectorOnboarding({
|
|
@@ -91859,9 +91875,16 @@ A Filter is an Expression. Leaves are \`Dimensions\`, \`Tags\`, or \`CostCategor
|
|
|
91859
91875
|
|
|
91860
91876
|
### Business Logic
|
|
91861
91877
|
|
|
91862
|
-
The business logic type for this connector is "typescript". The connector exposes resolved AWS credentials via \`connection(connectionId)
|
|
91878
|
+
The business logic type for this connector is "typescript". The connector exposes resolved AWS credentials via \`connection(connectionId)\` (already typed as \`{ accessKeyId, secretAccessKey, region }\` \u2014 do NOT add an \`as\` cast). Pass them to \`@aws-sdk/client-cost-explorer\` directly inside the handler. Do NOT read AWS credentials from environment variables.
|
|
91863
91879
|
|
|
91864
|
-
####
|
|
91880
|
+
#### Server logic slug naming
|
|
91881
|
+
|
|
91882
|
+
When creating a server logic for this connector, the \`slug\` (file name) MUST be lowercase kebab-case or snake_case \u2014 only \`[a-z0-9-_]\` is allowed. camelCase and uppercase will fail validation.
|
|
91883
|
+
|
|
91884
|
+
- OK: \`monthly-cost-trend\`, \`cost_by_service\`, \`top10-services\`
|
|
91885
|
+
- NG: \`monthlyCostTrend\`, \`MonthlyCostTrend\`, \`monthly cost trend\`
|
|
91886
|
+
|
|
91887
|
+
#### Example (slug: \`monthly-cost-trend\`)
|
|
91865
91888
|
|
|
91866
91889
|
\`\`\`ts
|
|
91867
91890
|
import type { Context } from "hono";
|
|
@@ -91937,9 +91960,16 @@ Filter \u306F Expression \u3067\u3059\u3002\u30EA\u30FC\u30D5\u306F \`Dimensions
|
|
|
91937
91960
|
|
|
91938
91961
|
### Business Logic
|
|
91939
91962
|
|
|
91940
|
-
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\`connection(connectionId)\` \u3067\u89E3\u6C7A\u6E08\u307F\u306E AWS \u8A8D\u8A3C\u60C5\u5831\u3092\u53D6\u5F97\u3057\u3001\`@aws-sdk/client-cost-explorer\` \u306B\u76F4\u63A5\u6E21\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u5229\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089 AWS \u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
91963
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\`connection(connectionId)\` \u3067\u89E3\u6C7A\u6E08\u307F\u306E AWS \u8A8D\u8A3C\u60C5\u5831\uFF08\`{ accessKeyId, secretAccessKey, region }\` \u3068\u3057\u3066\u578B\u4ED8\u3051\u6E08\u307F \u2014 \`as\` \u30AD\u30E3\u30B9\u30C8\u306F\u4E0D\u8981\uFF09\u3092\u53D6\u5F97\u3057\u3001\`@aws-sdk/client-cost-explorer\` \u306B\u76F4\u63A5\u6E21\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u5229\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089 AWS \u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
91941
91964
|
|
|
91942
|
-
####
|
|
91965
|
+
#### \u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E slug \u547D\u540D\u898F\u5247
|
|
91966
|
+
|
|
91967
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u7528\u306E\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u4F5C\u6210\u3059\u308B\u969B\u3001\`slug\`\uFF08\u30D5\u30A1\u30A4\u30EB\u540D\uFF09\u306F **\u5C0F\u6587\u5B57\u306E kebab-case \u307E\u305F\u306F snake_case** \u306B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8A31\u5BB9\u6587\u5B57\u306F \`[a-z0-9-_]\` \u306E\u307F\uFF09\u3002camelCase \u3084\u5927\u6587\u5B57\u3092\u542B\u3080\u3068\u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u3059\u3002
|
|
91968
|
+
|
|
91969
|
+
- OK: \`monthly-cost-trend\`\u3001\`cost_by_service\`\u3001\`top10-services\`
|
|
91970
|
+
- NG: \`monthlyCostTrend\`\u3001\`MonthlyCostTrend\`\u3001\`monthly cost trend\`
|
|
91971
|
+
|
|
91972
|
+
#### Example\uFF08slug: \`monthly-cost-trend\`\uFF09
|
|
91943
91973
|
|
|
91944
91974
|
\`\`\`ts
|
|
91945
91975
|
import type { Context } from "hono";
|
|
@@ -92846,33 +92876,41 @@ export default async function handler(c: Context) {
|
|
|
92846
92876
|
tools: tools11
|
|
92847
92877
|
});
|
|
92848
92878
|
|
|
92849
|
-
// ../connectors/src/connectors/google-ads/
|
|
92850
|
-
|
|
92851
|
-
|
|
92852
|
-
|
|
92853
|
-
|
|
92854
|
-
customerId: new ParameterDefinition({
|
|
92855
|
-
slug: "customer-id",
|
|
92856
|
-
name: "Google Ads Customer ID",
|
|
92857
|
-
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
92858
|
-
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
92859
|
-
type: "text",
|
|
92860
|
-
secret: false,
|
|
92861
|
-
required: false
|
|
92862
|
-
}),
|
|
92863
|
-
developerToken: new ParameterDefinition({
|
|
92864
|
-
slug: "developer-token",
|
|
92865
|
-
name: "Google Ads Developer Token",
|
|
92866
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
92867
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
92868
|
-
type: "text",
|
|
92869
|
-
secret: true,
|
|
92870
|
-
required: true
|
|
92871
|
-
})
|
|
92879
|
+
// ../connectors/src/connectors/google-ads/constants.ts
|
|
92880
|
+
var VERSION_FALLBACK_ORDER = ["v22", "v23", "v24"];
|
|
92881
|
+
var cachedWorkingVersion = VERSION_FALLBACK_ORDER[0];
|
|
92882
|
+
var looksSunset = (contentType) => {
|
|
92883
|
+
return contentType != null && contentType.toLowerCase().includes("text/html");
|
|
92872
92884
|
};
|
|
92885
|
+
async function fetchGoogleAdsWithVersionFallback(attempt) {
|
|
92886
|
+
const order = [
|
|
92887
|
+
cachedWorkingVersion,
|
|
92888
|
+
...VERSION_FALLBACK_ORDER.filter((v) => v !== cachedWorkingVersion)
|
|
92889
|
+
];
|
|
92890
|
+
let lastResponse = null;
|
|
92891
|
+
for (let i6 = 0; i6 < order.length; i6++) {
|
|
92892
|
+
const version2 = order[i6];
|
|
92893
|
+
const baseUrl = `https://googleads.googleapis.com/${version2}/`;
|
|
92894
|
+
const response = await attempt(baseUrl);
|
|
92895
|
+
const contentType = response.headers.get("content-type");
|
|
92896
|
+
if (looksSunset(contentType) && i6 < order.length - 1) {
|
|
92897
|
+
console.warn(
|
|
92898
|
+
`[google-ads] version ${version2} returned a sunset/HTML response (status ${response.status}); retrying with newer version`
|
|
92899
|
+
);
|
|
92900
|
+
lastResponse = response;
|
|
92901
|
+
continue;
|
|
92902
|
+
}
|
|
92903
|
+
cachedWorkingVersion = version2;
|
|
92904
|
+
return response;
|
|
92905
|
+
}
|
|
92906
|
+
return lastResponse ?? new Response(null, {
|
|
92907
|
+
status: 502,
|
|
92908
|
+
statusText: "All Google Ads API versions returned sunset responses"
|
|
92909
|
+
});
|
|
92910
|
+
}
|
|
92873
92911
|
|
|
92874
92912
|
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92875
|
-
|
|
92913
|
+
import { z as z18 } from "zod";
|
|
92876
92914
|
var REQUEST_TIMEOUT_MS8 = 6e4;
|
|
92877
92915
|
var cachedToken4 = null;
|
|
92878
92916
|
async function getProxyToken4(config) {
|
|
@@ -92943,27 +92981,25 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92943
92981
|
`[connector-request] google-ads/${connection.name}: listCustomers`
|
|
92944
92982
|
);
|
|
92945
92983
|
try {
|
|
92946
|
-
const developerToken = parameters12.developerToken.getValue(connection);
|
|
92947
92984
|
const token = await getProxyToken4(config.oauthProxy);
|
|
92948
92985
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
92949
92986
|
const controller = new AbortController();
|
|
92950
92987
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS8);
|
|
92951
92988
|
try {
|
|
92952
|
-
const response = await
|
|
92953
|
-
|
|
92954
|
-
|
|
92955
|
-
"Content-Type": "application/json",
|
|
92956
|
-
Authorization: `Bearer ${token}`
|
|
92957
|
-
},
|
|
92958
|
-
body: JSON.stringify({
|
|
92959
|
-
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
92960
|
-
method: "GET",
|
|
92989
|
+
const response = await fetchGoogleAdsWithVersionFallback(
|
|
92990
|
+
(baseUrl) => fetch(proxyUrl, {
|
|
92991
|
+
method: "POST",
|
|
92961
92992
|
headers: {
|
|
92962
|
-
"
|
|
92963
|
-
|
|
92964
|
-
|
|
92965
|
-
|
|
92966
|
-
|
|
92993
|
+
"Content-Type": "application/json",
|
|
92994
|
+
Authorization: `Bearer ${token}`
|
|
92995
|
+
},
|
|
92996
|
+
body: JSON.stringify({
|
|
92997
|
+
url: `${baseUrl}customers:listAccessibleCustomers`,
|
|
92998
|
+
method: "GET"
|
|
92999
|
+
}),
|
|
93000
|
+
signal: controller.signal
|
|
93001
|
+
})
|
|
93002
|
+
);
|
|
92967
93003
|
const data = await response.json();
|
|
92968
93004
|
if (!response.ok) {
|
|
92969
93005
|
const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
|
|
@@ -92975,26 +93011,27 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92975
93011
|
const customers = [];
|
|
92976
93012
|
for (const cid of customerIds) {
|
|
92977
93013
|
try {
|
|
92978
|
-
const detailResponse = await
|
|
92979
|
-
|
|
92980
|
-
headers: {
|
|
92981
|
-
"Content-Type": "application/json",
|
|
92982
|
-
Authorization: `Bearer ${token}`
|
|
92983
|
-
},
|
|
92984
|
-
body: JSON.stringify({
|
|
92985
|
-
url: `${BASE_URL2}customers/${cid}/googleAds:searchStream`,
|
|
93014
|
+
const detailResponse = await fetchGoogleAdsWithVersionFallback(
|
|
93015
|
+
(baseUrl) => fetch(proxyUrl, {
|
|
92986
93016
|
method: "POST",
|
|
92987
93017
|
headers: {
|
|
92988
93018
|
"Content-Type": "application/json",
|
|
92989
|
-
|
|
92990
|
-
"login-customer-id": cid
|
|
93019
|
+
Authorization: `Bearer ${token}`
|
|
92991
93020
|
},
|
|
92992
93021
|
body: JSON.stringify({
|
|
92993
|
-
|
|
92994
|
-
|
|
92995
|
-
|
|
92996
|
-
|
|
92997
|
-
|
|
93022
|
+
url: `${baseUrl}customers/${cid}/googleAds:searchStream`,
|
|
93023
|
+
method: "POST",
|
|
93024
|
+
headers: {
|
|
93025
|
+
"Content-Type": "application/json",
|
|
93026
|
+
"login-customer-id": cid
|
|
93027
|
+
},
|
|
93028
|
+
body: JSON.stringify({
|
|
93029
|
+
query: "SELECT customer.id, customer.descriptive_name FROM customer LIMIT 1"
|
|
93030
|
+
})
|
|
93031
|
+
}),
|
|
93032
|
+
signal: controller.signal
|
|
93033
|
+
})
|
|
93034
|
+
);
|
|
92998
93035
|
if (detailResponse.ok) {
|
|
92999
93036
|
const detailData = await detailResponse.json();
|
|
93000
93037
|
const customer = detailData?.[0]?.results?.[0]?.customer;
|
|
@@ -93032,30 +93069,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93032
93069
|
connectionSetupInstructions: {
|
|
93033
93070
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Ads (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
93034
93071
|
|
|
93035
|
-
1. \
|
|
93072
|
+
1. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93036
93073
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93037
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93038
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
93039
|
-
3. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93040
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93041
93074
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93042
93075
|
- \`options\`: \u30AB\u30B9\u30BF\u30DE\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30A2\u30AB\u30A6\u30F3\u30C8\u540D (id: \u30AB\u30B9\u30BF\u30DE\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30B9\u30BF\u30DE\u30FCID
|
|
93043
|
-
|
|
93076
|
+
- \u30AB\u30B9\u30BF\u30DE\u30FC\u304C **0\u4EF6** \u306E\u5834\u5408\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
93077
|
+
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30B9\u30BF\u30DE\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
93044
93078
|
|
|
93045
93079
|
#### \u5236\u7D04
|
|
93046
93080
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30EC\u30DD\u30FC\u30C8\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
93047
93081
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
93048
93082
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
93049
93083
|
|
|
93050
|
-
1.
|
|
93084
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93051
93085
|
2. Call \`updateConnectionParameters\`:
|
|
93052
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93053
|
-
- \`value\`: The Developer Token provided by the user
|
|
93054
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93055
|
-
4. Call \`updateConnectionParameters\`:
|
|
93056
93086
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93057
93087
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
93058
|
-
|
|
93088
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
93089
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
93059
93090
|
|
|
93060
93091
|
#### Constraints
|
|
93061
93092
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -93069,9 +93100,21 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93069
93100
|
}
|
|
93070
93101
|
});
|
|
93071
93102
|
|
|
93103
|
+
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
93104
|
+
var parameters12 = {
|
|
93105
|
+
customerId: new ParameterDefinition({
|
|
93106
|
+
slug: "customer-id",
|
|
93107
|
+
name: "Google Ads Customer ID",
|
|
93108
|
+
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
93109
|
+
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
93110
|
+
type: "text",
|
|
93111
|
+
secret: false,
|
|
93112
|
+
required: false
|
|
93113
|
+
})
|
|
93114
|
+
};
|
|
93115
|
+
|
|
93072
93116
|
// ../connectors/src/connectors/google-ads/tools/request.ts
|
|
93073
93117
|
import { z as z19 } from "zod";
|
|
93074
|
-
var BASE_URL3 = "https://googleads.googleapis.com/v18/";
|
|
93075
93118
|
var REQUEST_TIMEOUT_MS9 = 6e4;
|
|
93076
93119
|
var cachedToken5 = null;
|
|
93077
93120
|
async function getProxyToken5(config) {
|
|
@@ -93111,7 +93154,7 @@ var inputSchema19 = z19.object({
|
|
|
93111
93154
|
connectionId: z19.string().describe("ID of the Google Ads OAuth connection to use"),
|
|
93112
93155
|
method: z19.enum(["GET", "POST"]).describe("HTTP method"),
|
|
93113
93156
|
path: z19.string().describe(
|
|
93114
|
-
"API path appended to https://googleads.googleapis.com
|
|
93157
|
+
"API path appended to https://googleads.googleapis.com/<version>/ (e.g., 'customers/{customerId}/googleAds:searchStream'). The API version is auto-managed and {customerId} is automatically replaced."
|
|
93115
93158
|
),
|
|
93116
93159
|
body: z19.record(z19.string(), z19.unknown()).optional().describe("POST request body (JSON)")
|
|
93117
93160
|
});
|
|
@@ -93128,7 +93171,7 @@ var outputSchema19 = z19.discriminatedUnion("success", [
|
|
|
93128
93171
|
]);
|
|
93129
93172
|
var requestTool2 = new ConnectorTool({
|
|
93130
93173
|
name: "request",
|
|
93131
|
-
description: `Send authenticated requests to the Google Ads API
|
|
93174
|
+
description: `Send authenticated requests to the Google Ads API.
|
|
93132
93175
|
Authentication is handled automatically via OAuth proxy.
|
|
93133
93176
|
{customerId} in the path is automatically replaced with the connection's customer ID (hyphens removed).`,
|
|
93134
93177
|
inputSchema: inputSchema19,
|
|
@@ -93148,31 +93191,30 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93148
93191
|
const rawCustomerId = parameters12.customerId.tryGetValue(connection);
|
|
93149
93192
|
const customerId = rawCustomerId?.replace(/-/g, "") ?? "";
|
|
93150
93193
|
const resolvedPath = customerId ? path4.replace(/\{customerId\}/g, customerId) : path4;
|
|
93151
|
-
const url = `${BASE_URL3}${resolvedPath}`;
|
|
93152
93194
|
const token = await getProxyToken5(config.oauthProxy);
|
|
93153
93195
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
93154
93196
|
const controller = new AbortController();
|
|
93155
93197
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS9);
|
|
93156
93198
|
try {
|
|
93157
|
-
const
|
|
93158
|
-
|
|
93159
|
-
|
|
93160
|
-
headers: {
|
|
93161
|
-
"Content-Type": "application/json",
|
|
93162
|
-
Authorization: `Bearer ${token}`
|
|
93163
|
-
},
|
|
93164
|
-
body: JSON.stringify({
|
|
93165
|
-
url,
|
|
93166
|
-
method,
|
|
93199
|
+
const response = await fetchGoogleAdsWithVersionFallback(
|
|
93200
|
+
(baseUrl) => fetch(proxyUrl, {
|
|
93201
|
+
method: "POST",
|
|
93167
93202
|
headers: {
|
|
93168
93203
|
"Content-Type": "application/json",
|
|
93169
|
-
|
|
93170
|
-
...customerId ? { "login-customer-id": customerId } : {}
|
|
93204
|
+
Authorization: `Bearer ${token}`
|
|
93171
93205
|
},
|
|
93172
|
-
|
|
93173
|
-
|
|
93174
|
-
|
|
93175
|
-
|
|
93206
|
+
body: JSON.stringify({
|
|
93207
|
+
url: `${baseUrl}${resolvedPath}`,
|
|
93208
|
+
method,
|
|
93209
|
+
headers: {
|
|
93210
|
+
"Content-Type": "application/json",
|
|
93211
|
+
...customerId ? { "login-customer-id": customerId } : {}
|
|
93212
|
+
},
|
|
93213
|
+
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
93214
|
+
}),
|
|
93215
|
+
signal: controller.signal
|
|
93216
|
+
})
|
|
93217
|
+
);
|
|
93176
93218
|
const data = await response.json();
|
|
93177
93219
|
if (!response.ok) {
|
|
93178
93220
|
const dataObj = data;
|
|
@@ -93347,26 +93389,22 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
93347
93389
|
if (!customerId) {
|
|
93348
93390
|
return { success: true };
|
|
93349
93391
|
}
|
|
93350
|
-
const developerToken = params[parameters12.developerToken.slug];
|
|
93351
|
-
if (!developerToken) {
|
|
93352
|
-
return {
|
|
93353
|
-
success: false,
|
|
93354
|
-
error: "Developer token is required"
|
|
93355
|
-
};
|
|
93356
|
-
}
|
|
93357
|
-
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
93358
93392
|
try {
|
|
93359
|
-
const res = await
|
|
93360
|
-
|
|
93361
|
-
|
|
93362
|
-
|
|
93363
|
-
|
|
93364
|
-
|
|
93365
|
-
|
|
93366
|
-
|
|
93367
|
-
|
|
93368
|
-
|
|
93369
|
-
|
|
93393
|
+
const res = await fetchGoogleAdsWithVersionFallback(
|
|
93394
|
+
(baseUrl) => proxyFetch(
|
|
93395
|
+
`${baseUrl}customers/${customerId}/googleAds:searchStream`,
|
|
93396
|
+
{
|
|
93397
|
+
method: "POST",
|
|
93398
|
+
headers: {
|
|
93399
|
+
"Content-Type": "application/json",
|
|
93400
|
+
"login-customer-id": customerId
|
|
93401
|
+
},
|
|
93402
|
+
body: JSON.stringify({
|
|
93403
|
+
query: "SELECT customer.id FROM customer LIMIT 1"
|
|
93404
|
+
})
|
|
93405
|
+
}
|
|
93406
|
+
)
|
|
93407
|
+
);
|
|
93370
93408
|
if (!res.ok) {
|
|
93371
93409
|
const errorText = await res.text().catch(() => res.statusText);
|
|
93372
93410
|
return {
|
|
@@ -93418,7 +93456,7 @@ var parameters13 = {
|
|
|
93418
93456
|
|
|
93419
93457
|
// ../connectors/src/connectors/google-analytics/tools/request.ts
|
|
93420
93458
|
import { z as z20 } from "zod";
|
|
93421
|
-
var
|
|
93459
|
+
var BASE_URL2 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
93422
93460
|
var REQUEST_TIMEOUT_MS10 = 6e4;
|
|
93423
93461
|
var inputSchema20 = z20.object({
|
|
93424
93462
|
toolUseIntent: z20.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
|
|
@@ -93467,7 +93505,7 @@ Authentication is handled automatically using a service account.
|
|
|
93467
93505
|
return { success: false, error: "Failed to obtain access token" };
|
|
93468
93506
|
}
|
|
93469
93507
|
const resolvedPath = path4.replace(/\{propertyId\}/g, propertyId);
|
|
93470
|
-
const url = `${
|
|
93508
|
+
const url = `${BASE_URL2}${resolvedPath}`;
|
|
93471
93509
|
const controller = new AbortController();
|
|
93472
93510
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS10);
|
|
93473
93511
|
try {
|
|
@@ -93947,7 +93985,7 @@ var parameters14 = {
|
|
|
93947
93985
|
|
|
93948
93986
|
// ../connectors/src/connectors/google-analytics-oauth/tools/request.ts
|
|
93949
93987
|
import { z as z23 } from "zod";
|
|
93950
|
-
var
|
|
93988
|
+
var BASE_URL3 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
93951
93989
|
var REQUEST_TIMEOUT_MS13 = 6e4;
|
|
93952
93990
|
var cachedToken8 = null;
|
|
93953
93991
|
async function getProxyToken8(config) {
|
|
@@ -94023,7 +94061,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
94023
94061
|
try {
|
|
94024
94062
|
const propertyId = parameters14.propertyId.tryGetValue(connection);
|
|
94025
94063
|
const resolvedPath = propertyId ? path4.replace(/\{propertyId\}/g, propertyId) : path4;
|
|
94026
|
-
const url = `${
|
|
94064
|
+
const url = `${BASE_URL3}${resolvedPath}`;
|
|
94027
94065
|
const token = await getProxyToken8(config.oauthProxy);
|
|
94028
94066
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
94029
94067
|
const controller = new AbortController();
|
|
@@ -94291,7 +94329,7 @@ var parameters15 = {
|
|
|
94291
94329
|
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
94292
94330
|
var BASE_HOST = "https://www.googleapis.com";
|
|
94293
94331
|
var BASE_PATH_SEGMENT = "/calendar/v3";
|
|
94294
|
-
var
|
|
94332
|
+
var BASE_URL4 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
94295
94333
|
var REQUEST_TIMEOUT_MS14 = 6e4;
|
|
94296
94334
|
function decodeServiceAccount(keyJsonBase64) {
|
|
94297
94335
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -94371,7 +94409,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
94371
94409
|
};
|
|
94372
94410
|
}
|
|
94373
94411
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT);
|
|
94374
|
-
let url = `${
|
|
94412
|
+
let url = `${BASE_URL4}${normalizedPath}`;
|
|
94375
94413
|
if (queryParams) {
|
|
94376
94414
|
const searchParams = new URLSearchParams(queryParams);
|
|
94377
94415
|
url += `?${searchParams.toString()}`;
|
|
@@ -94423,7 +94461,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
94423
94461
|
import { z as z25 } from "zod";
|
|
94424
94462
|
var BASE_HOST2 = "https://www.googleapis.com";
|
|
94425
94463
|
var BASE_PATH_SEGMENT2 = "/calendar/v3";
|
|
94426
|
-
var
|
|
94464
|
+
var BASE_URL5 = `${BASE_HOST2}${BASE_PATH_SEGMENT2}`;
|
|
94427
94465
|
var REQUEST_TIMEOUT_MS15 = 6e4;
|
|
94428
94466
|
function decodeServiceAccount2(keyJsonBase64) {
|
|
94429
94467
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -94509,7 +94547,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
94509
94547
|
};
|
|
94510
94548
|
}
|
|
94511
94549
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT2);
|
|
94512
|
-
let url = `${
|
|
94550
|
+
let url = `${BASE_URL5}${normalizedPath}`;
|
|
94513
94551
|
if (queryParams) {
|
|
94514
94552
|
const searchParams = new URLSearchParams(queryParams);
|
|
94515
94553
|
url += `?${searchParams.toString()}`;
|
|
@@ -94989,7 +95027,7 @@ export default async function handler(c: Context) {
|
|
|
94989
95027
|
|
|
94990
95028
|
// ../connectors/src/connectors/google-calendar-oauth/tools/list-calendars.ts
|
|
94991
95029
|
import { z as z26 } from "zod";
|
|
94992
|
-
var
|
|
95030
|
+
var BASE_URL6 = "https://www.googleapis.com/calendar/v3";
|
|
94993
95031
|
var REQUEST_TIMEOUT_MS16 = 6e4;
|
|
94994
95032
|
var cachedToken9 = null;
|
|
94995
95033
|
async function getProxyToken9(config) {
|
|
@@ -95062,7 +95100,7 @@ var listCalendarsTool = new ConnectorTool({
|
|
|
95062
95100
|
`[connector-request] google-calendar-oauth/${connection.name}: listCalendars`
|
|
95063
95101
|
);
|
|
95064
95102
|
try {
|
|
95065
|
-
const url = `${
|
|
95103
|
+
const url = `${BASE_URL6}/users/me/calendarList`;
|
|
95066
95104
|
const token = await getProxyToken9(config.oauthProxy);
|
|
95067
95105
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
95068
95106
|
const controller = new AbortController();
|
|
@@ -95159,7 +95197,7 @@ var parameters16 = {
|
|
|
95159
95197
|
import { z as z27 } from "zod";
|
|
95160
95198
|
var BASE_HOST3 = "https://www.googleapis.com";
|
|
95161
95199
|
var BASE_PATH_SEGMENT3 = "/calendar/v3";
|
|
95162
|
-
var
|
|
95200
|
+
var BASE_URL7 = `${BASE_HOST3}${BASE_PATH_SEGMENT3}`;
|
|
95163
95201
|
var REQUEST_TIMEOUT_MS17 = 6e4;
|
|
95164
95202
|
var cachedToken10 = null;
|
|
95165
95203
|
async function getProxyToken10(config) {
|
|
@@ -95240,7 +95278,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
95240
95278
|
resolvedPath,
|
|
95241
95279
|
BASE_PATH_SEGMENT3
|
|
95242
95280
|
);
|
|
95243
|
-
let url = `${
|
|
95281
|
+
let url = `${BASE_URL7}${normalizedPath}`;
|
|
95244
95282
|
if (queryParams) {
|
|
95245
95283
|
const searchParams = new URLSearchParams(queryParams);
|
|
95246
95284
|
url += `?${searchParams.toString()}`;
|
|
@@ -95778,7 +95816,7 @@ var parameters18 = {};
|
|
|
95778
95816
|
import { z as z29 } from "zod";
|
|
95779
95817
|
var BASE_HOST4 = "https://www.googleapis.com";
|
|
95780
95818
|
var BASE_PATH_SEGMENT4 = "/drive/v3";
|
|
95781
|
-
var
|
|
95819
|
+
var BASE_URL8 = `${BASE_HOST4}${BASE_PATH_SEGMENT4}`;
|
|
95782
95820
|
var REQUEST_TIMEOUT_MS19 = 6e4;
|
|
95783
95821
|
var cachedToken12 = null;
|
|
95784
95822
|
async function getProxyToken12(config) {
|
|
@@ -95854,7 +95892,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
95854
95892
|
);
|
|
95855
95893
|
try {
|
|
95856
95894
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT4);
|
|
95857
|
-
let url = `${
|
|
95895
|
+
let url = `${BASE_URL8}${normalizedPath}`;
|
|
95858
95896
|
if (queryParams) {
|
|
95859
95897
|
const searchParams = new URLSearchParams(queryParams);
|
|
95860
95898
|
url += `?${searchParams.toString()}`;
|
|
@@ -96895,7 +96933,7 @@ await slides.batchUpdate(presentationId, [
|
|
|
96895
96933
|
|
|
96896
96934
|
// ../connectors/src/connectors/hubspot-oauth/tools/request.ts
|
|
96897
96935
|
import { z as z32 } from "zod";
|
|
96898
|
-
var
|
|
96936
|
+
var BASE_URL9 = "https://api.hubapi.com";
|
|
96899
96937
|
var REQUEST_TIMEOUT_MS22 = 6e4;
|
|
96900
96938
|
var cachedToken15 = null;
|
|
96901
96939
|
async function getProxyToken15(config) {
|
|
@@ -96969,7 +97007,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
96969
97007
|
`[connector-request] hubspot-oauth/${connection.name}: ${method} ${path4}`
|
|
96970
97008
|
);
|
|
96971
97009
|
try {
|
|
96972
|
-
let url = `${
|
|
97010
|
+
let url = `${BASE_URL9}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
96973
97011
|
if (queryParams) {
|
|
96974
97012
|
const searchParams = new URLSearchParams(queryParams);
|
|
96975
97013
|
url += `?${searchParams.toString()}`;
|
|
@@ -97185,7 +97223,7 @@ const data = await res.json();
|
|
|
97185
97223
|
|
|
97186
97224
|
// ../connectors/src/connectors/stripe-oauth/tools/request.ts
|
|
97187
97225
|
import { z as z33 } from "zod";
|
|
97188
|
-
var
|
|
97226
|
+
var BASE_URL10 = "https://api.stripe.com";
|
|
97189
97227
|
var REQUEST_TIMEOUT_MS23 = 6e4;
|
|
97190
97228
|
var cachedToken16 = null;
|
|
97191
97229
|
async function getProxyToken16(config) {
|
|
@@ -97259,7 +97297,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
97259
97297
|
`[connector-request] stripe-oauth/${connection.name}: ${method} ${path4}`
|
|
97260
97298
|
);
|
|
97261
97299
|
try {
|
|
97262
|
-
let url = `${
|
|
97300
|
+
let url = `${BASE_URL10}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
97263
97301
|
if (queryParams) {
|
|
97264
97302
|
const searchParams = new URLSearchParams(queryParams);
|
|
97265
97303
|
url += `?${searchParams.toString()}`;
|
|
@@ -97497,7 +97535,7 @@ var parameters23 = {
|
|
|
97497
97535
|
};
|
|
97498
97536
|
|
|
97499
97537
|
// ../connectors/src/connectors/stripe-api-key/tools/request.ts
|
|
97500
|
-
var
|
|
97538
|
+
var BASE_URL11 = "https://api.stripe.com";
|
|
97501
97539
|
var REQUEST_TIMEOUT_MS24 = 6e4;
|
|
97502
97540
|
var inputSchema34 = z34.object({
|
|
97503
97541
|
toolUseIntent: z34.string().optional().describe(
|
|
@@ -97546,7 +97584,7 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
|
|
|
97546
97584
|
);
|
|
97547
97585
|
try {
|
|
97548
97586
|
const apiKey = parameters23.apiKey.getValue(connection);
|
|
97549
|
-
let url = `${
|
|
97587
|
+
let url = `${BASE_URL11}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
97550
97588
|
if (queryParams) {
|
|
97551
97589
|
const searchParams = new URLSearchParams(queryParams);
|
|
97552
97590
|
url += `?${searchParams.toString()}`;
|
|
@@ -97788,7 +97826,7 @@ var parameters24 = {
|
|
|
97788
97826
|
};
|
|
97789
97827
|
|
|
97790
97828
|
// ../connectors/src/connectors/airtable-oauth/tools/request.ts
|
|
97791
|
-
var
|
|
97829
|
+
var BASE_URL12 = "https://api.airtable.com/v0";
|
|
97792
97830
|
var REQUEST_TIMEOUT_MS25 = 6e4;
|
|
97793
97831
|
var cachedToken17 = null;
|
|
97794
97832
|
async function getProxyToken17(config) {
|
|
@@ -97865,7 +97903,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
97865
97903
|
try {
|
|
97866
97904
|
const baseId = parameters24.baseId.tryGetValue(connection);
|
|
97867
97905
|
const resolvedPath = baseId ? path4.replace(/\{baseId\}/g, baseId) : path4;
|
|
97868
|
-
let url = `${
|
|
97906
|
+
let url = `${BASE_URL12}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
97869
97907
|
if (queryParams) {
|
|
97870
97908
|
const searchParams = new URLSearchParams(queryParams);
|
|
97871
97909
|
url += `?${searchParams.toString()}`;
|
|
@@ -98718,7 +98756,7 @@ var parameters27 = {
|
|
|
98718
98756
|
|
|
98719
98757
|
// ../connectors/src/connectors/wix-store/tools/request.ts
|
|
98720
98758
|
import { z as z38 } from "zod";
|
|
98721
|
-
var
|
|
98759
|
+
var BASE_URL13 = "https://www.wixapis.com/";
|
|
98722
98760
|
var REQUEST_TIMEOUT_MS28 = 6e4;
|
|
98723
98761
|
var inputSchema38 = z38.object({
|
|
98724
98762
|
toolUseIntent: z38.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
|
|
@@ -98753,7 +98791,7 @@ Authentication is handled automatically using the API Key and Site ID.`,
|
|
|
98753
98791
|
try {
|
|
98754
98792
|
const apiKey = parameters27.apiKey.getValue(connection);
|
|
98755
98793
|
const siteId = parameters27.siteId.getValue(connection);
|
|
98756
|
-
const url = `${
|
|
98794
|
+
const url = `${BASE_URL13}${path4}`;
|
|
98757
98795
|
const controller = new AbortController();
|
|
98758
98796
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS28);
|
|
98759
98797
|
try {
|
|
@@ -100033,7 +100071,7 @@ var parameters34 = {
|
|
|
100033
100071
|
|
|
100034
100072
|
// ../connectors/src/connectors/attio/tools/request.ts
|
|
100035
100073
|
import { z as z42 } from "zod";
|
|
100036
|
-
var
|
|
100074
|
+
var BASE_URL14 = "https://api.attio.com/v2";
|
|
100037
100075
|
var REQUEST_TIMEOUT_MS31 = 6e4;
|
|
100038
100076
|
var inputSchema42 = z42.object({
|
|
100039
100077
|
toolUseIntent: z42.string().optional().describe(
|
|
@@ -100080,7 +100118,7 @@ Record queries use POST /objects/{object}/records/query with a JSON body contain
|
|
|
100080
100118
|
);
|
|
100081
100119
|
try {
|
|
100082
100120
|
const apiKey = parameters34.apiKey.getValue(connection);
|
|
100083
|
-
const url = `${
|
|
100121
|
+
const url = `${BASE_URL14}${path4}`;
|
|
100084
100122
|
const controller = new AbortController();
|
|
100085
100123
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS31);
|
|
100086
100124
|
try {
|
|
@@ -101048,7 +101086,7 @@ var parameters37 = {
|
|
|
101048
101086
|
|
|
101049
101087
|
// ../connectors/src/connectors/hubspot/tools/request.ts
|
|
101050
101088
|
import { z as z45 } from "zod";
|
|
101051
|
-
var
|
|
101089
|
+
var BASE_URL15 = "https://api.hubapi.com";
|
|
101052
101090
|
var REQUEST_TIMEOUT_MS34 = 6e4;
|
|
101053
101091
|
var inputSchema45 = z45.object({
|
|
101054
101092
|
toolUseIntent: z45.string().optional().describe(
|
|
@@ -101095,7 +101133,7 @@ Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex q
|
|
|
101095
101133
|
);
|
|
101096
101134
|
try {
|
|
101097
101135
|
const apiKey = parameters37.apiKey.getValue(connection);
|
|
101098
|
-
const url = `${
|
|
101136
|
+
const url = `${BASE_URL15}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
101099
101137
|
const controller = new AbortController();
|
|
101100
101138
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS34);
|
|
101101
101139
|
try {
|
|
@@ -101581,7 +101619,7 @@ var parameters39 = {
|
|
|
101581
101619
|
|
|
101582
101620
|
// ../connectors/src/connectors/linear/tools/request.ts
|
|
101583
101621
|
import { z as z47 } from "zod";
|
|
101584
|
-
var
|
|
101622
|
+
var BASE_URL16 = "https://api.linear.app/graphql";
|
|
101585
101623
|
var REQUEST_TIMEOUT_MS36 = 6e4;
|
|
101586
101624
|
var inputSchema47 = z47.object({
|
|
101587
101625
|
toolUseIntent: z47.string().optional().describe(
|
|
@@ -101631,7 +101669,7 @@ Archived resources are hidden by default; pass includeArchived: true in query ar
|
|
|
101631
101669
|
try {
|
|
101632
101670
|
const body = { query };
|
|
101633
101671
|
if (variables) body.variables = variables;
|
|
101634
|
-
const response = await fetch(
|
|
101672
|
+
const response = await fetch(BASE_URL16, {
|
|
101635
101673
|
method: "POST",
|
|
101636
101674
|
headers: {
|
|
101637
101675
|
Authorization: apiKey,
|
|
@@ -101839,7 +101877,7 @@ var parameters40 = {
|
|
|
101839
101877
|
import { z as z48 } from "zod";
|
|
101840
101878
|
var BASE_HOST5 = "https://app.asana.com";
|
|
101841
101879
|
var BASE_PATH_SEGMENT5 = "/api/1.0";
|
|
101842
|
-
var
|
|
101880
|
+
var BASE_URL17 = `${BASE_HOST5}${BASE_PATH_SEGMENT5}`;
|
|
101843
101881
|
var REQUEST_TIMEOUT_MS37 = 6e4;
|
|
101844
101882
|
var inputSchema48 = z48.object({
|
|
101845
101883
|
toolUseIntent: z48.string().optional().describe(
|
|
@@ -101904,7 +101942,7 @@ Pagination: Use limit (1-100) and offset query parameters. The response includes
|
|
|
101904
101942
|
try {
|
|
101905
101943
|
const token = parameters40.personalAccessToken.getValue(connection);
|
|
101906
101944
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT5);
|
|
101907
|
-
const url = `${
|
|
101945
|
+
const url = `${BASE_URL17}${normalizedPath}`;
|
|
101908
101946
|
const controller = new AbortController();
|
|
101909
101947
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS37);
|
|
101910
101948
|
try {
|
|
@@ -102777,7 +102815,7 @@ var parameters43 = {
|
|
|
102777
102815
|
|
|
102778
102816
|
// ../connectors/src/connectors/notion/tools/request.ts
|
|
102779
102817
|
import { z as z53 } from "zod";
|
|
102780
|
-
var
|
|
102818
|
+
var BASE_URL18 = "https://api.notion.com/v1";
|
|
102781
102819
|
var NOTION_VERSION = "2022-06-28";
|
|
102782
102820
|
var REQUEST_TIMEOUT_MS38 = 6e4;
|
|
102783
102821
|
var inputSchema53 = z53.object({
|
|
@@ -102825,7 +102863,7 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
102825
102863
|
);
|
|
102826
102864
|
try {
|
|
102827
102865
|
const apiKey = parameters43.apiKey.getValue(connection);
|
|
102828
|
-
const url = `${
|
|
102866
|
+
const url = `${BASE_URL18}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
102829
102867
|
const controller = new AbortController();
|
|
102830
102868
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS38);
|
|
102831
102869
|
try {
|
|
@@ -103014,7 +103052,7 @@ export default async function handler(c: Context) {
|
|
|
103014
103052
|
|
|
103015
103053
|
// ../connectors/src/connectors/notion-oauth/tools/request.ts
|
|
103016
103054
|
import { z as z54 } from "zod";
|
|
103017
|
-
var
|
|
103055
|
+
var BASE_URL19 = "https://api.notion.com/v1";
|
|
103018
103056
|
var NOTION_VERSION2 = "2022-06-28";
|
|
103019
103057
|
var REQUEST_TIMEOUT_MS39 = 6e4;
|
|
103020
103058
|
var cachedToken19 = null;
|
|
@@ -103090,7 +103128,7 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
103090
103128
|
`[connector-request] notion-oauth/${connection.name}: ${method} ${path4}`
|
|
103091
103129
|
);
|
|
103092
103130
|
try {
|
|
103093
|
-
const url = `${
|
|
103131
|
+
const url = `${BASE_URL19}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
103094
103132
|
const token = await getProxyToken19(config.oauthProxy);
|
|
103095
103133
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
103096
103134
|
const controller = new AbortController();
|
|
@@ -103339,7 +103377,7 @@ var parameters45 = {
|
|
|
103339
103377
|
};
|
|
103340
103378
|
|
|
103341
103379
|
// ../connectors/src/connectors/meta-ads/tools/list-ad-accounts.ts
|
|
103342
|
-
var
|
|
103380
|
+
var BASE_URL20 = "https://graph.facebook.com/v21.0/";
|
|
103343
103381
|
var REQUEST_TIMEOUT_MS40 = 6e4;
|
|
103344
103382
|
var inputSchema55 = z55.object({
|
|
103345
103383
|
toolUseIntent: z55.string().optional().describe(
|
|
@@ -103380,7 +103418,7 @@ var listAdAccountsTool = new ConnectorTool({
|
|
|
103380
103418
|
);
|
|
103381
103419
|
try {
|
|
103382
103420
|
const accessToken = parameters45.accessToken.getValue(connection);
|
|
103383
|
-
const url = `${
|
|
103421
|
+
const url = `${BASE_URL20}me/adaccounts?fields=account_id,name,account_status&access_token=${encodeURIComponent(accessToken)}`;
|
|
103384
103422
|
const controller = new AbortController();
|
|
103385
103423
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS40);
|
|
103386
103424
|
try {
|
|
@@ -103449,7 +103487,7 @@ var metaAdsOnboarding = new ConnectorOnboarding({
|
|
|
103449
103487
|
|
|
103450
103488
|
// ../connectors/src/connectors/meta-ads/tools/request.ts
|
|
103451
103489
|
import { z as z56 } from "zod";
|
|
103452
|
-
var
|
|
103490
|
+
var BASE_URL21 = "https://graph.facebook.com/v21.0/";
|
|
103453
103491
|
var REQUEST_TIMEOUT_MS41 = 6e4;
|
|
103454
103492
|
var inputSchema56 = z56.object({
|
|
103455
103493
|
toolUseIntent: z56.string().optional().describe(
|
|
@@ -103496,7 +103534,7 @@ Authentication is handled via the configured access token.
|
|
|
103496
103534
|
const accessToken = parameters45.accessToken.getValue(connection);
|
|
103497
103535
|
const adAccountId = parameters45.adAccountId.tryGetValue(connection) ?? "";
|
|
103498
103536
|
const resolvedPath = adAccountId ? path4.replace(/\{adAccountId\}/g, adAccountId) : path4;
|
|
103499
|
-
let url = `${
|
|
103537
|
+
let url = `${BASE_URL21}${resolvedPath}`;
|
|
103500
103538
|
const params = new URLSearchParams(queryParams ?? {});
|
|
103501
103539
|
params.set("access_token", accessToken);
|
|
103502
103540
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -103702,7 +103740,7 @@ const accounts = await meta.listAdAccounts();
|
|
|
103702
103740
|
|
|
103703
103741
|
// ../connectors/src/connectors/meta-ads-oauth/tools/list-ad-accounts.ts
|
|
103704
103742
|
import { z as z57 } from "zod";
|
|
103705
|
-
var
|
|
103743
|
+
var BASE_URL22 = "https://graph.facebook.com/v21.0/";
|
|
103706
103744
|
var REQUEST_TIMEOUT_MS42 = 6e4;
|
|
103707
103745
|
var cachedToken20 = null;
|
|
103708
103746
|
async function getProxyToken20(config) {
|
|
@@ -103785,7 +103823,7 @@ var listAdAccountsTool2 = new ConnectorTool({
|
|
|
103785
103823
|
Authorization: `Bearer ${token}`
|
|
103786
103824
|
},
|
|
103787
103825
|
body: JSON.stringify({
|
|
103788
|
-
url: `${
|
|
103826
|
+
url: `${BASE_URL22}me/adaccounts?fields=account_id,name,account_status`,
|
|
103789
103827
|
method: "GET"
|
|
103790
103828
|
}),
|
|
103791
103829
|
signal: controller.signal
|
|
@@ -103864,7 +103902,7 @@ var parameters46 = {
|
|
|
103864
103902
|
|
|
103865
103903
|
// ../connectors/src/connectors/meta-ads-oauth/tools/request.ts
|
|
103866
103904
|
import { z as z58 } from "zod";
|
|
103867
|
-
var
|
|
103905
|
+
var BASE_URL23 = "https://graph.facebook.com/v21.0/";
|
|
103868
103906
|
var REQUEST_TIMEOUT_MS43 = 6e4;
|
|
103869
103907
|
var cachedToken21 = null;
|
|
103870
103908
|
async function getProxyToken21(config) {
|
|
@@ -103941,7 +103979,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
103941
103979
|
try {
|
|
103942
103980
|
const adAccountId = parameters46.adAccountId.tryGetValue(connection) ?? "";
|
|
103943
103981
|
const resolvedPath = adAccountId ? path4.replace(/\{adAccountId\}/g, adAccountId) : path4;
|
|
103944
|
-
let url = `${
|
|
103982
|
+
let url = `${BASE_URL23}${resolvedPath}`;
|
|
103945
103983
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
103946
103984
|
const params = new URLSearchParams(queryParams);
|
|
103947
103985
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -104147,7 +104185,7 @@ const data = await res.json();
|
|
|
104147
104185
|
|
|
104148
104186
|
// ../connectors/src/connectors/tiktok-ads/tools/list-advertisers.ts
|
|
104149
104187
|
import { z as z59 } from "zod";
|
|
104150
|
-
var
|
|
104188
|
+
var BASE_URL24 = "https://business-api.tiktok.com/open_api/v1.3/";
|
|
104151
104189
|
var REQUEST_TIMEOUT_MS44 = 6e4;
|
|
104152
104190
|
var cachedToken22 = null;
|
|
104153
104191
|
async function getProxyToken22(config) {
|
|
@@ -104230,7 +104268,7 @@ var listAdvertisersTool = new ConnectorTool({
|
|
|
104230
104268
|
Authorization: `Bearer ${token}`
|
|
104231
104269
|
},
|
|
104232
104270
|
body: JSON.stringify({
|
|
104233
|
-
url: `${
|
|
104271
|
+
url: `${BASE_URL24}oauth2/advertiser/get/`,
|
|
104234
104272
|
method: "GET"
|
|
104235
104273
|
}),
|
|
104236
104274
|
signal: controller.signal
|
|
@@ -104321,7 +104359,7 @@ var parameters47 = {
|
|
|
104321
104359
|
import { z as z60 } from "zod";
|
|
104322
104360
|
var BASE_HOST6 = "https://business-api.tiktok.com";
|
|
104323
104361
|
var BASE_PATH_SEGMENT6 = "/open_api/v1.3";
|
|
104324
|
-
var
|
|
104362
|
+
var BASE_URL25 = `${BASE_HOST6}${BASE_PATH_SEGMENT6}`;
|
|
104325
104363
|
var REQUEST_TIMEOUT_MS45 = 6e4;
|
|
104326
104364
|
var cachedToken23 = null;
|
|
104327
104365
|
async function getProxyToken23(config) {
|
|
@@ -104398,7 +104436,7 @@ The advertiser_id is automatically injected if configured.`,
|
|
|
104398
104436
|
try {
|
|
104399
104437
|
const advertiserId = parameters47.advertiserId.tryGetValue(connection) ?? "";
|
|
104400
104438
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT6);
|
|
104401
|
-
let url = `${
|
|
104439
|
+
let url = `${BASE_URL25}${normalizedPath}`;
|
|
104402
104440
|
if (method === "GET") {
|
|
104403
104441
|
const params = new URLSearchParams(queryParams ?? {});
|
|
104404
104442
|
if (advertiserId && !params.has("advertiser_id")) {
|
|
@@ -105614,7 +105652,7 @@ var parameters51 = {
|
|
|
105614
105652
|
// ../connectors/src/connectors/gmail/tools/request-with-delegation.ts
|
|
105615
105653
|
var BASE_HOST7 = "https://gmail.googleapis.com";
|
|
105616
105654
|
var BASE_PATH_SEGMENT7 = "/gmail/v1/users";
|
|
105617
|
-
var
|
|
105655
|
+
var BASE_URL26 = `${BASE_HOST7}${BASE_PATH_SEGMENT7}`;
|
|
105618
105656
|
var REQUEST_TIMEOUT_MS49 = 6e4;
|
|
105619
105657
|
function decodeServiceAccount3(keyJsonBase64) {
|
|
105620
105658
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -105700,7 +105738,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
105700
105738
|
};
|
|
105701
105739
|
}
|
|
105702
105740
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT7);
|
|
105703
|
-
let url = `${
|
|
105741
|
+
let url = `${BASE_URL26}${normalizedPath}`;
|
|
105704
105742
|
if (queryParams) {
|
|
105705
105743
|
const searchParams = new URLSearchParams(queryParams);
|
|
105706
105744
|
url += `?${searchParams.toString()}`;
|
|
@@ -106021,7 +106059,7 @@ for (const msg of messages.messages ?? []) {
|
|
|
106021
106059
|
import { z as z65 } from "zod";
|
|
106022
106060
|
var BASE_HOST8 = "https://gmail.googleapis.com";
|
|
106023
106061
|
var BASE_PATH_SEGMENT8 = "/gmail/v1/users";
|
|
106024
|
-
var
|
|
106062
|
+
var BASE_URL27 = `${BASE_HOST8}${BASE_PATH_SEGMENT8}`;
|
|
106025
106063
|
var REQUEST_TIMEOUT_MS50 = 6e4;
|
|
106026
106064
|
var cachedToken25 = null;
|
|
106027
106065
|
async function getProxyToken25(config) {
|
|
@@ -106098,7 +106136,7 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
106098
106136
|
);
|
|
106099
106137
|
try {
|
|
106100
106138
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT8);
|
|
106101
|
-
let url = `${
|
|
106139
|
+
let url = `${BASE_URL27}${normalizedPath}`;
|
|
106102
106140
|
if (queryParams) {
|
|
106103
106141
|
const searchParams = new URLSearchParams(queryParams);
|
|
106104
106142
|
url += `?${searchParams.toString()}`;
|
|
@@ -106410,7 +106448,7 @@ var parameters53 = {
|
|
|
106410
106448
|
// ../connectors/src/connectors/google-audit-log/tools/request-with-delegation.ts
|
|
106411
106449
|
var BASE_HOST9 = "https://admin.googleapis.com";
|
|
106412
106450
|
var BASE_PATH_SEGMENT9 = "/admin/reports/v1";
|
|
106413
|
-
var
|
|
106451
|
+
var BASE_URL28 = `${BASE_HOST9}${BASE_PATH_SEGMENT9}`;
|
|
106414
106452
|
var REQUEST_TIMEOUT_MS51 = 6e4;
|
|
106415
106453
|
function decodeServiceAccount4(keyJsonBase64) {
|
|
106416
106454
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -106497,7 +106535,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
106497
106535
|
};
|
|
106498
106536
|
}
|
|
106499
106537
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT9);
|
|
106500
|
-
let url = `${
|
|
106538
|
+
let url = `${BASE_URL28}${normalizedPath}`;
|
|
106501
106539
|
if (queryParams) {
|
|
106502
106540
|
const searchParams = new URLSearchParams(queryParams);
|
|
106503
106541
|
url += `?${searchParams.toString()}`;
|
|
@@ -106807,7 +106845,7 @@ export default async function handler(c: Context) {
|
|
|
106807
106845
|
|
|
106808
106846
|
// ../connectors/src/connectors/linkedin-ads/tools/list-ad-accounts.ts
|
|
106809
106847
|
import { z as z67 } from "zod";
|
|
106810
|
-
var
|
|
106848
|
+
var BASE_URL29 = "https://api.linkedin.com/rest/";
|
|
106811
106849
|
var LINKEDIN_VERSION = "202603";
|
|
106812
106850
|
var REQUEST_TIMEOUT_MS52 = 6e4;
|
|
106813
106851
|
var cachedToken26 = null;
|
|
@@ -106891,7 +106929,7 @@ var listAdAccountsTool3 = new ConnectorTool({
|
|
|
106891
106929
|
Authorization: `Bearer ${token}`
|
|
106892
106930
|
},
|
|
106893
106931
|
body: JSON.stringify({
|
|
106894
|
-
url: `${
|
|
106932
|
+
url: `${BASE_URL29}adAccounts?q=search&search=(status:(values:List(ACTIVE)))&pageSize=100`,
|
|
106895
106933
|
method: "GET",
|
|
106896
106934
|
headers: {
|
|
106897
106935
|
"LinkedIn-Version": LINKEDIN_VERSION,
|
|
@@ -106974,7 +107012,7 @@ var parameters54 = {
|
|
|
106974
107012
|
|
|
106975
107013
|
// ../connectors/src/connectors/linkedin-ads/tools/request.ts
|
|
106976
107014
|
import { z as z68 } from "zod";
|
|
106977
|
-
var
|
|
107015
|
+
var BASE_URL30 = "https://api.linkedin.com/rest/";
|
|
106978
107016
|
var LINKEDIN_VERSION2 = "202603";
|
|
106979
107017
|
var REQUEST_TIMEOUT_MS53 = 6e4;
|
|
106980
107018
|
var cachedToken27 = null;
|
|
@@ -107053,7 +107091,7 @@ Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatic
|
|
|
107053
107091
|
try {
|
|
107054
107092
|
const adAccountId = parameters54.adAccountId.tryGetValue(connection) ?? "";
|
|
107055
107093
|
const resolvedPath = adAccountId ? path4.replace(/\{adAccountId\}/g, adAccountId) : path4;
|
|
107056
|
-
let url = `${
|
|
107094
|
+
let url = `${BASE_URL30}${resolvedPath}`;
|
|
107057
107095
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
107058
107096
|
const params = new URLSearchParams(queryParams);
|
|
107059
107097
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -108009,7 +108047,7 @@ var parameters57 = {
|
|
|
108009
108047
|
|
|
108010
108048
|
// ../connectors/src/connectors/intercom/tools/request.ts
|
|
108011
108049
|
import { z as z71 } from "zod";
|
|
108012
|
-
var
|
|
108050
|
+
var BASE_URL31 = "https://api.intercom.io";
|
|
108013
108051
|
var API_VERSION = "2.11";
|
|
108014
108052
|
var REQUEST_TIMEOUT_MS56 = 6e4;
|
|
108015
108053
|
var inputSchema71 = z71.object({
|
|
@@ -108059,7 +108097,7 @@ The Intercom-Version header is set to 2.11 automatically.`,
|
|
|
108059
108097
|
);
|
|
108060
108098
|
try {
|
|
108061
108099
|
const accessToken = parameters57.accessToken.getValue(connection);
|
|
108062
|
-
const url = `${
|
|
108100
|
+
const url = `${BASE_URL31}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
108063
108101
|
const controller = new AbortController();
|
|
108064
108102
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS56);
|
|
108065
108103
|
try {
|
|
@@ -108302,7 +108340,7 @@ export default async function handler(c: Context) {
|
|
|
108302
108340
|
|
|
108303
108341
|
// ../connectors/src/connectors/intercom-oauth/tools/request.ts
|
|
108304
108342
|
import { z as z72 } from "zod";
|
|
108305
|
-
var
|
|
108343
|
+
var BASE_URL32 = "https://api.intercom.io";
|
|
108306
108344
|
var REQUEST_TIMEOUT_MS57 = 6e4;
|
|
108307
108345
|
var cachedToken29 = null;
|
|
108308
108346
|
async function getProxyToken29(config) {
|
|
@@ -108379,7 +108417,7 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
108379
108417
|
`[connector-request] intercom-oauth/${connection.name}: ${method} ${path4}`
|
|
108380
108418
|
);
|
|
108381
108419
|
try {
|
|
108382
|
-
let url = `${
|
|
108420
|
+
let url = `${BASE_URL32}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
108383
108421
|
if (queryParams) {
|
|
108384
108422
|
const searchParams = new URLSearchParams(queryParams);
|
|
108385
108423
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -109492,7 +109530,7 @@ var parameters62 = {
|
|
|
109492
109530
|
|
|
109493
109531
|
// ../connectors/src/connectors/gamma/tools/request.ts
|
|
109494
109532
|
import { z as z76 } from "zod";
|
|
109495
|
-
var
|
|
109533
|
+
var BASE_URL33 = "https://public-api.gamma.app/v1.0";
|
|
109496
109534
|
var REQUEST_TIMEOUT_MS61 = 6e4;
|
|
109497
109535
|
var inputSchema76 = z76.object({
|
|
109498
109536
|
toolUseIntent: z76.string().optional().describe(
|
|
@@ -109537,7 +109575,7 @@ For creating presentations/documents, prefer the gamma_generate tool instead.`,
|
|
|
109537
109575
|
);
|
|
109538
109576
|
try {
|
|
109539
109577
|
const apiKey = parameters62.apiKey.getValue(connection);
|
|
109540
|
-
const url = `${
|
|
109578
|
+
const url = `${BASE_URL33}${path4}`;
|
|
109541
109579
|
const controller = new AbortController();
|
|
109542
109580
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS61);
|
|
109543
109581
|
try {
|
|
@@ -109569,7 +109607,7 @@ For creating presentations/documents, prefer the gamma_generate tool instead.`,
|
|
|
109569
109607
|
|
|
109570
109608
|
// ../connectors/src/connectors/gamma/tools/generate.ts
|
|
109571
109609
|
import { z as z77 } from "zod";
|
|
109572
|
-
var
|
|
109610
|
+
var BASE_URL34 = "https://public-api.gamma.app/v1.0";
|
|
109573
109611
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
109574
109612
|
var MAX_POLL_DURATION_MS = 3e5;
|
|
109575
109613
|
var inputSchema77 = z77.object({
|
|
@@ -109686,7 +109724,7 @@ Gamma does NOT support image uploads. To visualize data, embed raw numbers direc
|
|
|
109686
109724
|
if (textAmount) textOptions.amount = textAmount;
|
|
109687
109725
|
if (Object.keys(textOptions).length > 0) body.textOptions = textOptions;
|
|
109688
109726
|
if (imageSource) body.imageOptions = { source: imageSource };
|
|
109689
|
-
const createRes = await fetch(`${
|
|
109727
|
+
const createRes = await fetch(`${BASE_URL34}/generations`, {
|
|
109690
109728
|
method: "POST",
|
|
109691
109729
|
headers,
|
|
109692
109730
|
body: JSON.stringify(body)
|
|
@@ -109706,7 +109744,7 @@ Gamma does NOT support image uploads. To visualize data, embed raw numbers direc
|
|
|
109706
109744
|
const deadline = Date.now() + MAX_POLL_DURATION_MS;
|
|
109707
109745
|
while (Date.now() < deadline) {
|
|
109708
109746
|
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS3));
|
|
109709
|
-
const pollRes = await fetch(`${
|
|
109747
|
+
const pollRes = await fetch(`${BASE_URL34}/generations/${generationId}`, {
|
|
109710
109748
|
method: "GET",
|
|
109711
109749
|
headers
|
|
109712
109750
|
});
|
|
@@ -109944,7 +109982,7 @@ var parameters63 = {
|
|
|
109944
109982
|
|
|
109945
109983
|
// ../connectors/src/connectors/sentry/tools/request.ts
|
|
109946
109984
|
import { z as z78 } from "zod";
|
|
109947
|
-
var
|
|
109985
|
+
var BASE_URL35 = "https://sentry.io/api/0";
|
|
109948
109986
|
var REQUEST_TIMEOUT_MS62 = 6e4;
|
|
109949
109987
|
var inputSchema78 = z78.object({
|
|
109950
109988
|
toolUseIntent: z78.string().optional().describe(
|
|
@@ -109994,7 +110032,7 @@ Authentication is handled automatically via Bearer token.
|
|
|
109994
110032
|
/\{organizationSlug\}/g,
|
|
109995
110033
|
organizationSlug
|
|
109996
110034
|
);
|
|
109997
|
-
const url = `${
|
|
110035
|
+
const url = `${BASE_URL35}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
109998
110036
|
const controller = new AbortController();
|
|
109999
110037
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS62);
|
|
110000
110038
|
try {
|
|
@@ -111007,7 +111045,7 @@ var parameters66 = {
|
|
|
111007
111045
|
|
|
111008
111046
|
// ../connectors/src/connectors/monday/tools/request.ts
|
|
111009
111047
|
import { z as z81 } from "zod";
|
|
111010
|
-
var
|
|
111048
|
+
var BASE_URL36 = "https://api.monday.com/v2";
|
|
111011
111049
|
var REQUEST_TIMEOUT_MS65 = 6e4;
|
|
111012
111050
|
var inputSchema81 = z81.object({
|
|
111013
111051
|
toolUseIntent: z81.string().optional().describe(
|
|
@@ -111065,7 +111103,7 @@ Items are paginated with a cursor-based \`items_page(limit, cursor)\` field on a
|
|
|
111065
111103
|
"Content-Type": "application/json"
|
|
111066
111104
|
};
|
|
111067
111105
|
if (apiVersion) headers["API-Version"] = apiVersion;
|
|
111068
|
-
const response = await fetch(
|
|
111106
|
+
const response = await fetch(BASE_URL36, {
|
|
111069
111107
|
method: "POST",
|
|
111070
111108
|
headers,
|
|
111071
111109
|
body: JSON.stringify(body),
|
|
@@ -111378,17 +111416,27 @@ async function importMssql() {
|
|
|
111378
111416
|
}
|
|
111379
111417
|
async function runMssqlQuery(parsed, sql, options = {}) {
|
|
111380
111418
|
const sqlMod = await importMssql();
|
|
111381
|
-
const
|
|
111382
|
-
|
|
111383
|
-
|
|
111384
|
-
|
|
111385
|
-
|
|
111419
|
+
const tunnel = options.tunnelParams ? await maybeOpenSshTunnelHostPort(
|
|
111420
|
+
options.tunnelParams,
|
|
111421
|
+
parsed.server,
|
|
111422
|
+
parsed.port
|
|
111423
|
+
) : null;
|
|
111386
111424
|
try {
|
|
111387
|
-
const
|
|
111388
|
-
const
|
|
111389
|
-
|
|
111425
|
+
const tunneled = tunnel ? { ...parsed, server: tunnel.host, port: tunnel.port } : parsed;
|
|
111426
|
+
const config = toMssqlConfig(tunneled, {
|
|
111427
|
+
encrypt: options.forceEncrypt
|
|
111428
|
+
});
|
|
111429
|
+
const pool = new sqlMod.ConnectionPool(config);
|
|
111430
|
+
await pool.connect();
|
|
111431
|
+
try {
|
|
111432
|
+
const result = await pool.request().query(sql);
|
|
111433
|
+
const recordset = result.recordset ?? [];
|
|
111434
|
+
return { rows: recordset };
|
|
111435
|
+
} finally {
|
|
111436
|
+
await pool.close();
|
|
111437
|
+
}
|
|
111390
111438
|
} finally {
|
|
111391
|
-
await
|
|
111439
|
+
await tunnel?.close();
|
|
111392
111440
|
}
|
|
111393
111441
|
}
|
|
111394
111442
|
async function checkMssqlConnection(url, credentials, options = {}) {
|
|
@@ -111476,35 +111524,69 @@ function parseOracleJdbcUrl(jdbcUrl, options = {}) {
|
|
|
111476
111524
|
function redactOracleUrl(jdbcUrl) {
|
|
111477
111525
|
return jdbcUrl.replace(/(:\/\/)([^@/]+)@/, "$1***@").replace(/(thin:)([^@]+)@/i, "$1***@");
|
|
111478
111526
|
}
|
|
111527
|
+
function parseOracleConnectStringHostPort(connectString) {
|
|
111528
|
+
const m4 = /^([^:/]+):(\d+)(.*)$/.exec(connectString);
|
|
111529
|
+
if (!m4) return null;
|
|
111530
|
+
return { host: m4[1], port: Number(m4[2]), trailing: m4[3] };
|
|
111531
|
+
}
|
|
111532
|
+
function rewriteOracleConnectStringHostPort(connectString, host, port) {
|
|
111533
|
+
const parts = parseOracleConnectStringHostPort(connectString);
|
|
111534
|
+
if (!parts) return connectString;
|
|
111535
|
+
return `${host}:${port}${parts.trailing}`;
|
|
111536
|
+
}
|
|
111479
111537
|
|
|
111480
111538
|
// ../connectors/src/lib/oracle-runner.ts
|
|
111481
111539
|
async function importOracleDb() {
|
|
111482
111540
|
const mod = await import("oracledb");
|
|
111483
111541
|
return mod.default ?? mod;
|
|
111484
111542
|
}
|
|
111485
|
-
async function runOracleQuery(parsed, sql) {
|
|
111543
|
+
async function runOracleQuery(parsed, sql, options = {}) {
|
|
111486
111544
|
const oracledb = await importOracleDb();
|
|
111487
|
-
|
|
111488
|
-
|
|
111489
|
-
|
|
111490
|
-
|
|
111491
|
-
|
|
111545
|
+
let tunnel = null;
|
|
111546
|
+
if (options.tunnelParams) {
|
|
111547
|
+
const hostPort = parseOracleConnectStringHostPort(parsed.connectString);
|
|
111548
|
+
if (hostPort) {
|
|
111549
|
+
tunnel = await maybeOpenSshTunnelHostPort(
|
|
111550
|
+
options.tunnelParams,
|
|
111551
|
+
hostPort.host,
|
|
111552
|
+
hostPort.port
|
|
111553
|
+
);
|
|
111554
|
+
}
|
|
111555
|
+
}
|
|
111492
111556
|
try {
|
|
111493
|
-
const
|
|
111494
|
-
|
|
111495
|
-
|
|
111496
|
-
|
|
111497
|
-
|
|
111557
|
+
const connectString = tunnel ? rewriteOracleConnectStringHostPort(
|
|
111558
|
+
parsed.connectString,
|
|
111559
|
+
tunnel.host,
|
|
111560
|
+
tunnel.port
|
|
111561
|
+
) : parsed.connectString;
|
|
111562
|
+
const connection = await oracledb.getConnection({
|
|
111563
|
+
user: parsed.user,
|
|
111564
|
+
password: parsed.password,
|
|
111565
|
+
connectString
|
|
111498
111566
|
});
|
|
111499
|
-
return { rows: result.rows ?? [] };
|
|
111500
|
-
} finally {
|
|
111501
111567
|
try {
|
|
111502
|
-
await connection.
|
|
111503
|
-
|
|
111568
|
+
const result = await connection.execute(
|
|
111569
|
+
sql,
|
|
111570
|
+
[],
|
|
111571
|
+
{
|
|
111572
|
+
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
|
111573
|
+
// Bound by the connector's own row cap, but keep the driver from
|
|
111574
|
+
// streaming arbitrarily large result sets.
|
|
111575
|
+
maxRows: 5e3
|
|
111576
|
+
}
|
|
111577
|
+
);
|
|
111578
|
+
return { rows: result.rows ?? [] };
|
|
111579
|
+
} finally {
|
|
111580
|
+
try {
|
|
111581
|
+
await connection.close();
|
|
111582
|
+
} catch {
|
|
111583
|
+
}
|
|
111504
111584
|
}
|
|
111585
|
+
} finally {
|
|
111586
|
+
await tunnel?.close();
|
|
111505
111587
|
}
|
|
111506
111588
|
}
|
|
111507
|
-
async function checkOracleConnection(url, credentials) {
|
|
111589
|
+
async function checkOracleConnection(url, credentials, options = {}) {
|
|
111508
111590
|
let parsed;
|
|
111509
111591
|
try {
|
|
111510
111592
|
parsed = parseOracleJdbcUrl(url, credentials);
|
|
@@ -111515,7 +111597,7 @@ async function checkOracleConnection(url, credentials) {
|
|
|
111515
111597
|
};
|
|
111516
111598
|
}
|
|
111517
111599
|
try {
|
|
111518
|
-
await runOracleQuery(parsed, "SELECT 1 FROM DUAL");
|
|
111600
|
+
await runOracleQuery(parsed, "SELECT 1 FROM DUAL", options);
|
|
111519
111601
|
return { success: true };
|
|
111520
111602
|
} catch (err) {
|
|
111521
111603
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -111725,12 +111807,13 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
111725
111807
|
};
|
|
111726
111808
|
}
|
|
111727
111809
|
try {
|
|
111810
|
+
const tunnelParams = connectionParamsToRecord(connection);
|
|
111728
111811
|
if (parsed.driver === "sqlserver") {
|
|
111729
111812
|
const mssqlParsed = parseSqlServerJdbcUrl(parsed.originalUrl, {
|
|
111730
111813
|
username,
|
|
111731
111814
|
password
|
|
111732
111815
|
});
|
|
111733
|
-
const result = await runMssqlQuery(mssqlParsed, sql);
|
|
111816
|
+
const result = await runMssqlQuery(mssqlParsed, sql, { tunnelParams });
|
|
111734
111817
|
const rows = result.rows;
|
|
111735
111818
|
return {
|
|
111736
111819
|
success: true,
|
|
@@ -111745,7 +111828,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
111745
111828
|
password
|
|
111746
111829
|
});
|
|
111747
111830
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
111748
|
-
const result = await runOracleQuery(oracleParsed, cleanSql
|
|
111831
|
+
const result = await runOracleQuery(oracleParsed, cleanSql, {
|
|
111832
|
+
tunnelParams
|
|
111833
|
+
});
|
|
111749
111834
|
const rows = result.rows;
|
|
111750
111835
|
return {
|
|
111751
111836
|
success: true,
|
|
@@ -111757,7 +111842,7 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
111757
111842
|
let tunnel;
|
|
111758
111843
|
try {
|
|
111759
111844
|
tunnel = await maybeOpenSshTunnel(
|
|
111760
|
-
|
|
111845
|
+
tunnelParams,
|
|
111761
111846
|
parsed.nativeUrl,
|
|
111762
111847
|
parsed.defaultPort
|
|
111763
111848
|
);
|
|
@@ -111931,10 +112016,18 @@ JDBC URL \u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u306B\u3088\u308A\u65B
|
|
|
111931
112016
|
};
|
|
111932
112017
|
}
|
|
111933
112018
|
if (parsed.driver === "sqlserver") {
|
|
111934
|
-
return checkMssqlConnection(
|
|
112019
|
+
return checkMssqlConnection(
|
|
112020
|
+
parsed.originalUrl,
|
|
112021
|
+
{ username, password },
|
|
112022
|
+
{ tunnelParams: params }
|
|
112023
|
+
);
|
|
111935
112024
|
}
|
|
111936
112025
|
if (parsed.driver === "oracle") {
|
|
111937
|
-
return checkOracleConnection(
|
|
112026
|
+
return checkOracleConnection(
|
|
112027
|
+
parsed.originalUrl,
|
|
112028
|
+
{ username, password },
|
|
112029
|
+
{ tunnelParams: params }
|
|
112030
|
+
);
|
|
111938
112031
|
}
|
|
111939
112032
|
const tunnel = await maybeOpenSshTunnel(
|
|
111940
112033
|
params,
|
|
@@ -111991,10 +112084,12 @@ JDBC URL \u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u306B\u3088\u308A\u65B
|
|
|
111991
112084
|
});
|
|
111992
112085
|
const sample = unwrapSampleLimit(sql);
|
|
111993
112086
|
if (sample) {
|
|
111994
|
-
const result = await runMssqlQuery(mssqlParsed, sample.inner
|
|
112087
|
+
const result = await runMssqlQuery(mssqlParsed, sample.inner, {
|
|
112088
|
+
tunnelParams: params
|
|
112089
|
+
});
|
|
111995
112090
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
111996
112091
|
}
|
|
111997
|
-
return runMssqlQuery(mssqlParsed, sql);
|
|
112092
|
+
return runMssqlQuery(mssqlParsed, sql, { tunnelParams: params });
|
|
111998
112093
|
}
|
|
111999
112094
|
if (parsed.driver === "oracle") {
|
|
112000
112095
|
const oracleParsed = parseOracleJdbcUrl(parsed.originalUrl, {
|
|
@@ -112004,11 +112099,13 @@ JDBC URL \u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u306B\u3088\u308A\u65B
|
|
|
112004
112099
|
const sample = unwrapSampleLimit(sql);
|
|
112005
112100
|
if (sample) {
|
|
112006
112101
|
const inner = sample.inner.replace(/;\s*$/, "");
|
|
112007
|
-
const result = await runOracleQuery(oracleParsed, inner
|
|
112102
|
+
const result = await runOracleQuery(oracleParsed, inner, {
|
|
112103
|
+
tunnelParams: params
|
|
112104
|
+
});
|
|
112008
112105
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
112009
112106
|
}
|
|
112010
112107
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
112011
|
-
return runOracleQuery(oracleParsed, cleanSql);
|
|
112108
|
+
return runOracleQuery(oracleParsed, cleanSql, { tunnelParams: params });
|
|
112012
112109
|
}
|
|
112013
112110
|
const tunnel = await maybeOpenSshTunnel(
|
|
112014
112111
|
params,
|
|
@@ -112072,7 +112169,7 @@ var parameters68 = {
|
|
|
112072
112169
|
};
|
|
112073
112170
|
|
|
112074
112171
|
// ../connectors/src/connectors/semrush/tools/request.ts
|
|
112075
|
-
var
|
|
112172
|
+
var BASE_URL37 = "https://api.semrush.com";
|
|
112076
112173
|
var REQUEST_TIMEOUT_MS66 = 6e4;
|
|
112077
112174
|
var inputSchema83 = z83.object({
|
|
112078
112175
|
toolUseIntent: z83.string().optional().describe(
|
|
@@ -112152,7 +112249,7 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
112152
112249
|
}
|
|
112153
112250
|
}
|
|
112154
112251
|
const url = new URL(
|
|
112155
|
-
isAbsolute ? path4 : `${
|
|
112252
|
+
isAbsolute ? path4 : `${BASE_URL37}${path4.startsWith("/") ? "" : "/"}${path4}`
|
|
112156
112253
|
);
|
|
112157
112254
|
if (queryParams) {
|
|
112158
112255
|
for (const [k6, v] of Object.entries(queryParams)) {
|
|
@@ -112240,16 +112337,18 @@ var semrushOnboarding = new ConnectorOnboarding({
|
|
|
112240
112337
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
112241
112338
|
},
|
|
112242
112339
|
dataOverviewInstructions: {
|
|
112243
|
-
en: `1. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "
|
|
112340
|
+
en: `1. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "domain_ranks", "domain": "<example.com>", "database": "us" }\` to inspect the domain summary report (single-row CSV: rank, organic/paid keywords, traffic, cost)
|
|
112244
112341
|
2. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "domain_organic", "domain": "<example.com>", "database": "us", "display_limit": "5" }\` to sample organic keywords
|
|
112245
112342
|
3. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "phrase_this", "phrase": "<keyword>", "database": "us" }\` to inspect a keyword overview
|
|
112246
|
-
4.
|
|
112247
|
-
5.
|
|
112248
|
-
|
|
112343
|
+
4. Optionally call ${requestToolName12} with path "/analytics/v1/" and queryParams \`{ "type": "backlinks_overview", "target": "<example.com>", "target_type": "root_domain" }\` to inspect a backlinks summary (returns semicolon-separated CSV \u2014 keep \`responseFormat="text"\`)
|
|
112344
|
+
5. Always pass an explicit small \`display_limit\` (e.g. \`"5"\`) \u2014 never rely on the default 10000, which can trip \`ERROR 132\` even when units remain
|
|
112345
|
+
6. Remember: the Standard Analytics API and the \`/analytics/v1/?type=backlinks_*\` Backlinks endpoints both return semicolon-separated CSV with the first row as the header`,
|
|
112346
|
+
ja: `1. ${requestToolName12} \u3067 path "/" \u3068 queryParams \`{ "type": "domain_ranks", "domain": "<example.com>", "database": "us" }\` \u3092\u547C\u3073\u51FA\u3057\u3001\u30C9\u30E1\u30A4\u30F3\u30B5\u30DE\u30EA\u30FC\u30EC\u30DD\u30FC\u30C8\uFF08rank\u30FB\u30AA\u30FC\u30AC\u30CB\u30C3\u30AF/\u6709\u6599\u30AD\u30FC\u30EF\u30FC\u30C9\u30FB\u30C8\u30E9\u30D5\u30A3\u30C3\u30AF\u30FB\u30B3\u30B9\u30C8\u7B49\u306E1\u884CCSV\uFF09\u3092\u78BA\u8A8D
|
|
112249
112347
|
2. ${requestToolName12} \u3067 path "/" \u3068 queryParams \`{ "type": "domain_organic", "domain": "<example.com>", "database": "us", "display_limit": "5" }\` \u3092\u547C\u3073\u51FA\u3057\u3001\u30AA\u30FC\u30AC\u30CB\u30C3\u30AF\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
112250
112348
|
3. ${requestToolName12} \u3067 path "/" \u3068 queryParams \`{ "type": "phrase_this", "phrase": "<keyword>", "database": "us" }\` \u3092\u547C\u3073\u51FA\u3057\u3001\u30AD\u30FC\u30EF\u30FC\u30C9\u6982\u8981\u3092\u78BA\u8A8D
|
|
112251
|
-
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\
|
|
112252
|
-
5. \
|
|
112349
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066 ${requestToolName12} \u3067 path "/analytics/v1/" \u3068 queryParams \`{ "type": "backlinks_overview", "target": "<example.com>", "target_type": "root_domain" }\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30D0\u30C3\u30AF\u30EA\u30F3\u30AF\u30B5\u30DE\u30EA\u30FC\u3092\u78BA\u8A8D\uFF08\u30BB\u30DF\u30B3\u30ED\u30F3\u533A\u5207\u308ACSV\u3092\u8FD4\u3059\u305F\u3081 \`responseFormat="text"\` \u306E\u307E\u307E\uFF09
|
|
112350
|
+
5. \`display_limit\` \u306F\u5FC5\u305A\u660E\u793A\u7684\u306B\u5C0F\u3055\u3044\u5024\uFF08\u4F8B: \`"5"\`\uFF09\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u3002\u30C7\u30D5\u30A9\u30EB\u30C810000\u306E\u307E\u307E\u3060\u3068\u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u304C\u3042\u3063\u3066\u3082 \`ERROR 132\` \u3067\u62D2\u5426\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308B
|
|
112351
|
+
6. \u6CE8\u610F: Standard Analytics API \u304A\u3088\u3073 \`/analytics/v1/?type=backlinks_*\` \u306E\u30D0\u30C3\u30AF\u30EA\u30F3\u30AF\u7CFB\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306F\u3069\u3061\u3089\u3082\u30BB\u30DF\u30B3\u30ED\u30F3\u533A\u5207\u308ACSV\uFF081\u884C\u76EE\u304C\u30D8\u30C3\u30C0\u30FC\uFF09\u3092\u8FD4\u3059`
|
|
112253
112352
|
}
|
|
112254
112353
|
});
|
|
112255
112354
|
|
|
@@ -112276,10 +112375,19 @@ The business logic type for this connector is "typescript". Write handler code u
|
|
|
112276
112375
|
|
|
112277
112376
|
SDK methods (client created via \`connection(connectionId)\`):
|
|
112278
112377
|
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
|
|
112279
|
-
- \`client.
|
|
112378
|
+
- \`client.checkUnits()\` \u2014 return the current API unit balance as a number. **FREE \u2014 does not consume units.** Use as a pre-flight before \`report()\`
|
|
112379
|
+
- \`client.report(type, query?)\` \u2014 call a Standard Analytics report and parse the CSV into \`{ columns: string[], rows: Record<string, string>[], raw: string }\`. Throws \`API UNITS BALANCE IS ZERO\` when the account is out of units
|
|
112280
112380
|
- \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
|
|
112281
112381
|
- \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
|
|
112282
112382
|
|
|
112383
|
+
\u{1F6A8} **MANDATORY pre-flight before creating any server logic that calls \`report()\`.** Before authoring a TypeScript handler that invokes \`client.report(...)\` (Standard Analytics \u2014 \`domain_ranks\`, \`domain_organic\`, \`phrase_this\`, etc.), you MUST first call the \`semrush-api-key_request\` tool with \`path: "https://www.semrush.com/users/countapiunits.html"\`, no \`queryParams\`, \`responseFormat: "text"\` to confirm the unit balance is greater than 0. If the balance is 0, **stop, do not create the server logic**, and report the issue to the user (the account owner needs to top up API units in the Semrush console). \`testFetchServerLogic\` will execute the handler and consume units; creating handlers when the balance is 0 produces \`ERROR 132 :: API UNITS BALANCE IS ZERO\` failures across every server logic.
|
|
112384
|
+
|
|
112385
|
+
\u{1F6A8} **Always set a small \`display_limit\` explicitly \u2014 never rely on the default.** Semrush computes "required units = display_limit \xD7 per-row cost" up front, and rejects the request with \`ERROR 132 :: API UNITS BALANCE IS ZERO\` when the *estimated* cost exceeds the remaining balance, **even when the actual balance is non-zero** (e.g. balance \u2248 40,950 still fails for \`display_limit=10000\` on costly reports). Default to \`display_limit: "1000"\` (or smaller \u2014 \`"100"\` is plenty for most dashboards), and only increase it when the user explicitly asks for a larger sample AND \`checkUnits()\` confirms enough headroom. If you truly need all rows, paginate with \`display_offset\` in chunks of 1000 instead of bumping \`display_limit\`. Treat \`ERROR 132\` as "request too large for the current balance" first, and only as "balance is literally zero" after re-checking units.
|
|
112386
|
+
|
|
112387
|
+
\u{1F6AB} **Do NOT use the Trends API (\`client.trends\`) or Projects API (\`client.projects\`) unless the user explicitly requests them.** These APIs require separate paid subscriptions (Trends and Projects/Management) that not every Semrush account has. Calls without the corresponding subscription fail with an authorization error. Default to the Standard Analytics API (\`client.report\`) for all SEO/keyword/backlink/competitor analysis. Only reach for \`trends()\` / \`projects()\` when the user explicitly mentions Trends data (traffic analytics, market explorer, etc.) or Projects (site audit, position tracking, etc.) \u2014 and confirm the user has the subscription before building the server logic.
|
|
112388
|
+
|
|
112389
|
+
\u26A0\uFE0F **Important: \`report()\` row shape.** \`rows\` is \`Record<string, string>[]\` \u2014 each row is an object keyed by the CSV column NAME (matching \`columns\`), NOT a positional array. Access fields with \`row["Url"]\`, \`row["Keyword"]\`, \`row["Search Volume"]\` (column names may contain spaces). Do NOT use \`columns.indexOf("Url")\` and then \`row[index]\` \u2014 that returns \`undefined\` and silently produces empty results when combined with \`?? ""\` or \`Number(...) || 0\`. All values are strings; convert numeric columns with \`Number(row["Position"])\`.
|
|
112390
|
+
|
|
112283
112391
|
\`\`\`ts
|
|
112284
112392
|
import type { Context } from "hono";
|
|
112285
112393
|
import { connection } from "@squadbase/vite-server/connectors/semrush";
|
|
@@ -112292,9 +112400,25 @@ export default async function handler(c: Context) {
|
|
|
112292
112400
|
database?: string;
|
|
112293
112401
|
}>();
|
|
112294
112402
|
|
|
112295
|
-
const
|
|
112403
|
+
const result = await semrush.report("domain_organic", {
|
|
112404
|
+
domain,
|
|
112405
|
+
database,
|
|
112406
|
+
display_limit: "100",
|
|
112407
|
+
});
|
|
112408
|
+
|
|
112409
|
+
// \u2705 Correct: access by column name
|
|
112410
|
+
const rows = result.rows.map((row) => ({
|
|
112411
|
+
keyword: row["Keyword"],
|
|
112412
|
+
position: Number(row["Position"]) || 0,
|
|
112413
|
+
searchVolume: Number(row["Search Volume"]) || 0,
|
|
112414
|
+
url: row["Url"] ?? "",
|
|
112415
|
+
}));
|
|
112296
112416
|
|
|
112297
|
-
|
|
112417
|
+
// \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
|
|
112418
|
+
// const urlIdx = result.columns.indexOf("Url");
|
|
112419
|
+
// const url = (row as unknown as string[])[urlIdx];
|
|
112420
|
+
|
|
112421
|
+
return c.json({ columns: result.columns, rows });
|
|
112298
112422
|
}
|
|
112299
112423
|
\`\`\`
|
|
112300
112424
|
|
|
@@ -112306,8 +112430,8 @@ export default async function handler(c: Context) {
|
|
|
112306
112430
|
|
|
112307
112431
|
Authentication: API key passed as the \`key\` query parameter on every request (handled automatically).
|
|
112308
112432
|
|
|
112309
|
-
#### Common Standard Analytics report types
|
|
112310
|
-
- \`
|
|
112433
|
+
#### Common Standard Analytics report types (path \`/\`, returns CSV)
|
|
112434
|
+
- \`domain_ranks\` \u2014 single-row domain summary (rank, organic/paid keywords, traffic, cost). **There is no \`domain_overview\` type \u2014 use \`domain_ranks\`.**
|
|
112311
112435
|
- \`domain_organic\` \u2014 organic keywords for a domain
|
|
112312
112436
|
- \`domain_adwords\` \u2014 paid keywords for a domain
|
|
112313
112437
|
- \`domain_organic_organic\` / \`domain_adwords_adwords\` \u2014 organic / paid competitors
|
|
@@ -112316,10 +112440,13 @@ Authentication: API key passed as the \`key\` query parameter on every request (
|
|
|
112316
112440
|
- \`phrase_fullsearch\` \u2014 full-text keyword research
|
|
112317
112441
|
- \`phrase_questions\` \u2014 question keywords
|
|
112318
112442
|
- \`phrase_kdi\` \u2014 keyword difficulty index
|
|
112443
|
+
- \`url_organic\` / \`url_adwords\` \u2014 keywords ranking for a specific URL
|
|
112444
|
+
|
|
112445
|
+
#### Backlinks API report types (path \`/analytics/v1/\`, also returns **CSV** \u2014 not JSON)
|
|
112446
|
+
Backlinks endpoints live under \`/analytics/v1/?type=backlinks_*\` and require \`target\` + \`target_type\` (\`root_domain\` | \`domain\` | \`url\`) instead of \`domain\`/\`database\`. They return semicolon-separated CSV, so use \`responseFormat="text"\` from the request tool, and from the SDK use \`client.request("/analytics/v1/", { query: { type: "backlinks_overview", target, target_type: "root_domain" } })\` and parse the CSV yourself \u2014 \`client.trends()\` will throw because it JSON-parses the body.
|
|
112319
112447
|
- \`backlinks_overview\` \u2014 backlinks summary
|
|
112320
112448
|
- \`backlinks\` \u2014 list of backlinks
|
|
112321
112449
|
- \`backlinks_refdomains\` \u2014 referring domains
|
|
112322
|
-
- \`url_organic\` / \`url_adwords\` \u2014 keywords ranking for a specific URL
|
|
112323
112450
|
|
|
112324
112451
|
To check remaining API units (free, does NOT consume units), call the request tool with an absolute URL: \`path: "https://www.semrush.com/users/countapiunits.html"\`, no query params, \`responseFormat: "text"\`. The response body is just a number.
|
|
112325
112452
|
|
|
@@ -112327,7 +112454,7 @@ To check remaining API units (free, does NOT consume units), call the request to
|
|
|
112327
112454
|
- \`type\` \u2014 report type (required for the Standard API)
|
|
112328
112455
|
- \`domain\` / \`phrase\` / \`url\` \u2014 entity to query
|
|
112329
112456
|
- \`database\` \u2014 regional database (e.g. \`us\`, \`uk\`, \`de\`, \`fr\`, \`jp\`, \`br\`); required for most reports
|
|
112330
|
-
- \`display_limit\` \u2014 page size (default 10000, max 100000 depending on report)
|
|
112457
|
+
- \`display_limit\` \u2014 page size (default 10000, max 100000 depending on report). **Do NOT use the default \u2014 always pass an explicit small value like \`"1000"\`.** Large limits make Semrush pre-charge required units and reject with \`ERROR 132\` even when the balance is non-zero.
|
|
112331
112458
|
- \`display_offset\` \u2014 pagination offset
|
|
112332
112459
|
- \`display_date\` \u2014 historical date in \`YYYYMM15\` format (always day 15)
|
|
112333
112460
|
- \`export_columns\` \u2014 comma-separated columns to return (e.g. \`Ph,Po,Nq,Cp\`)
|
|
@@ -112338,6 +112465,7 @@ To check remaining API units (free, does NOT consume units), call the request to
|
|
|
112338
112465
|
- Each Standard Analytics report consumes API units; check the unit balance via \`https://www.semrush.com/users/countapiunits.html?key=...\` (free) first if you suspect a quota issue
|
|
112339
112466
|
- The CSV separator is \`;\` (semicolon), NOT \`,\`. Some cells may contain commas inside them.
|
|
112340
112467
|
- An HTTP 200 response with a body starting with \`ERROR\` indicates an API error (auth, parameters, or quota)
|
|
112468
|
+
- \`ERROR 132 :: API UNITS BALANCE IS ZERO\` does NOT only mean the balance is literally 0. Semrush also returns it when \`display_limit \xD7 per-row cost\` exceeds the remaining balance. Re-check the balance with \`countapiunits.html\` and lower \`display_limit\` (e.g. to \`1000\` or \`100\`) before assuming the account is empty.
|
|
112341
112469
|
- The Trends API requires a separate Trends subscription; calls without it will fail with an authorization error
|
|
112342
112470
|
- Date strings in historical endpoints must be the 15th of the month (\`YYYYMM15\`)`,
|
|
112343
112471
|
ja: `### \u30C4\u30FC\u30EB
|
|
@@ -112350,10 +112478,19 @@ To check remaining API units (free, does NOT consume units), call the request to
|
|
|
112350
112478
|
|
|
112351
112479
|
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
112352
112480
|
- \`client.request(path, init?)\` \u2014 \u8A8D\u8A3C\u4ED8\u304D\u306E\u4F4E\u30EC\u30D9\u30EBfetch\u3002\`init.query\` \u3067\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6307\u5B9A\u3002\`key\` \u306F\u81EA\u52D5\u4ED8\u4E0E
|
|
112353
|
-
- \`client.
|
|
112481
|
+
- \`client.checkUnits()\` \u2014 \u73FE\u5728\u306E API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u3092\u6570\u5024\u3067\u8FD4\u3059\u3002**\u7121\u6599\u3067\u3001\u30E6\u30CB\u30C3\u30C8\u3092\u6D88\u8CBB\u3057\u306A\u3044\u3002** \`report()\` \u5B9F\u884C\u524D\u306E\u30D7\u30EA\u30D5\u30E9\u30A4\u30C8\u306B\u4F7F\u3046
|
|
112482
|
+
- \`client.report(type, query?)\` \u2014 Standard Analytics \u306E\u30EC\u30DD\u30FC\u30C8\u3092\u547C\u3073\u51FA\u3057\u3001CSV\u3092 \`{ columns: string[], rows: Record<string, string>[], raw: string }\` \u306B\u30D1\u30FC\u30B9\u3002\u6B8B\u91CF\u30BC\u30ED\u306E\u5834\u5408\u306F \`API UNITS BALANCE IS ZERO\` \u3092\u542B\u3080\u30A8\u30E9\u30FC\u3092 throw
|
|
112354
112483
|
- \`client.trends(path, query?)\` \u2014 Trends API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/analytics/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
|
|
112355
112484
|
- \`client.projects(path, init?)\` \u2014 Projects API \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\`/management/v1/...\`\uFF09\u3092\u547C\u3073\u51FA\u3057 JSON \u3092\u8FD4\u3059
|
|
112356
112485
|
|
|
112486
|
+
\u{1F6A8} **\`report()\` \u3092\u547C\u3076\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u4F5C\u6210\u3059\u308B\u524D\u306E\u5FC5\u9808\u30D7\u30EA\u30D5\u30E9\u30A4\u30C8\u3002** Standard Analytics\uFF08\`domain_ranks\`\u3001\`domain_organic\`\u3001\`phrase_this\` \u306A\u3069\uFF09\u306E \`client.report(...)\` \u3092\u542B\u3080 TypeScript \u30CF\u30F3\u30C9\u30E9\u3092\u4F5C\u6210\u3059\u308B\u524D\u306B\u3001\u5FC5\u305A \`semrush-api-key_request\` \u30C4\u30FC\u30EB\u3092 \`path: "https://www.semrush.com/users/countapiunits.html"\`\u3001\`queryParams\` \u7121\u3057\u3001\`responseFormat: "text"\` \u3067\u547C\u3073\u51FA\u3057\u3066\u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u304C 0 \u3088\u308A\u5927\u304D\u3044\u3053\u3068\u3092\u78BA\u8A8D\u3059\u308B\u3053\u3068\u3002\u6B8B\u91CF\u304C 0 \u306E\u5834\u5408\u306F **\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u4F5C\u6210\u305B\u305A\u306B\u505C\u6B62\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u5831\u544A**\u3059\u308B\uFF08Semrush \u306E\u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u304B\u3089 API \u30E6\u30CB\u30C3\u30C8\u3092\u88DC\u5145\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\uFF09\u3002\`testFetchServerLogic\` \u306F\u30CF\u30F3\u30C9\u30E9\u3092\u5B9F\u884C\u3057\u3066\u30E6\u30CB\u30C3\u30C8\u3092\u6D88\u8CBB\u3059\u308B\u305F\u3081\u3001\u6B8B\u91CF 0 \u306E\u307E\u307E\u4F5C\u6210\u3059\u308B\u3068\u5168\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u304C \`ERROR 132 :: API UNITS BALANCE IS ZERO\` \u3067\u5931\u6557\u3059\u308B\u3002
|
|
112487
|
+
|
|
112488
|
+
\u{1F6A8} **\`display_limit\` \u306F\u5FC5\u305A\u660E\u793A\u7684\u306B\u5C0F\u3055\u3044\u5024\u3092\u6307\u5B9A\u3057\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u983C\u3089\u306A\u3044\u3053\u3068\u3002** Semrush \u306F\u4E8B\u524D\u306B\u300C\u5FC5\u8981\u30E6\u30CB\u30C3\u30C8 = display_limit \xD7 \u884C\u3042\u305F\u308A\u5358\u4FA1\u300D\u3092\u8A08\u7B97\u3057\u3001\u305D\u306E**\u898B\u7A4D\u984D**\u304C\u6B8B\u91CF\u3092\u8D85\u3048\u308B\u3068\u30EA\u30AF\u30A8\u30B9\u30C8\u3092 \`ERROR 132 :: API UNITS BALANCE IS ZERO\` \u3067\u62D2\u5426\u3059\u308B\u3002**\u5B9F\u6B8B\u91CF\u304C\u30BC\u30ED\u3067\u306A\u304F\u3066\u3082**\u8D77\u3053\u308B\uFF08\u4F8B\uFF1A\u6B8B\u91CF\u7D04 40,950 \u3067\u3082\u3001\u30B3\u30B9\u30C8\u306E\u9AD8\u3044\u30EC\u30DD\u30FC\u30C8\u3067 \`display_limit=10000\` \u3060\u3068\u5931\u6557\u3059\u308B\uFF09\u3002\u539F\u5247\u3068\u3057\u3066 \`display_limit: "1000"\`\uFF08\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u7528\u9014\u306A\u3089 \`"100"\` \u3067\u3082\u5341\u5206\uFF09\u3092\u6307\u5B9A\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u304C\u660E\u793A\u7684\u306B\u5927\u304D\u306A\u30B5\u30F3\u30D7\u30EB\u3092\u8981\u6C42\u3057\u3001\u304B\u3064 \`checkUnits()\` \u3067\u6B8B\u91CF\u306B\u5341\u5206\u306A\u4F59\u88D5\u304C\u3042\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3067\u304D\u305F\u5834\u5408\u306E\u307F\u5897\u3084\u3059\u3002\u5168\u884C\u304C\u5FC5\u8981\u306A\u5834\u5408\u306F \`display_limit\` \u3092\u4E0A\u3052\u308B\u306E\u3067\u306F\u306A\u304F\u3001\`display_offset\` \u3067 1000 \u4EF6\u523B\u307F\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u5B9F\u88C5\u3059\u308B\u3053\u3068\u3002\`ERROR 132\` \u306F\u300C\u6B8B\u91CF\u304C\u6587\u5B57\u901A\u308A\u30BC\u30ED\u300D\u3088\u308A\u5148\u306B\u300C\u73FE\u5728\u306E\u6B8B\u91CF\u306B\u5BFE\u3057\u3066\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u5927\u304D\u3059\u304E\u308B\u300D\u3092\u7591\u3044\u3001\u30E6\u30CB\u30C3\u30C8\u3092\u518D\u78BA\u8A8D\u3057\u3066\u304B\u3089\u5224\u65AD\u3059\u308B\u3053\u3068\u3002
|
|
112489
|
+
|
|
112490
|
+
\u{1F6AB} **Trends API\uFF08\`client.trends\`\uFF09\u3068 Projects API\uFF08\`client.projects\`\uFF09\u306F\u3001\u30E6\u30FC\u30B6\u30FC\u304B\u3089\u660E\u793A\u7684\u306B\u6307\u793A\u3055\u308C\u306A\u3044\u9650\u308A\u4F7F\u7528\u3057\u306A\u3044\u3053\u3068\u3002** \u3053\u308C\u3089\u306E API \u306F\u5225\u9014\u6709\u6599\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\uFF08Trends / Projects\uFF08Management\uFF09\uFF09\u304C\u5FC5\u8981\u3067\u3001\u3059\u3079\u3066\u306E Semrush \u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u5951\u7D04\u3057\u3066\u3044\u308B\u308F\u3051\u3067\u306F\u306A\u3044\u3002\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u304C\u306A\u3044\u72B6\u614B\u3067\u547C\u3073\u51FA\u3059\u3068\u8A8D\u53EF\u30A8\u30E9\u30FC\u3067\u5931\u6557\u3059\u308B\u3002SEO\u30FB\u30AD\u30FC\u30EF\u30FC\u30C9\u30FB\u88AB\u30EA\u30F3\u30AF\u30FB\u7AF6\u5408\u5206\u6790\u306F\u539F\u5247 Standard Analytics API\uFF08\`client.report\`\uFF09\u3067\u884C\u3046\u3002\`trends()\` / \`projects()\` \u3092\u4F7F\u3046\u306E\u306F\u3001\u30E6\u30FC\u30B6\u30FC\u304C Trends \u30C7\u30FC\u30BF\uFF08\u30C8\u30E9\u30D5\u30A3\u30C3\u30AF\u30A2\u30CA\u30EA\u30C6\u30A3\u30AF\u30B9\u3001\u30DE\u30FC\u30B1\u30C3\u30C8\u30A8\u30AF\u30B9\u30D7\u30ED\u30FC\u30E9\u30FC\u7B49\uFF09\u307E\u305F\u306F Projects \u6A5F\u80FD\uFF08\u30B5\u30A4\u30C8\u76E3\u67FB\u3001\u30DD\u30B8\u30B7\u30E7\u30F3\u30C8\u30E9\u30C3\u30AD\u30F3\u30B0\u7B49\uFF09\u3092**\u660E\u793A\u7684\u306B\u6C42\u3081\u305F\u5834\u5408\u306E\u307F**\u3067\u3001\u305D\u306E\u969B\u3082\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u306E\u6709\u7121\u3092\u30E6\u30FC\u30B6\u30FC\u306B\u78BA\u8A8D\u3057\u3066\u304B\u3089\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u3092\u4F5C\u6210\u3059\u308B\u3053\u3068\u3002
|
|
112491
|
+
|
|
112492
|
+
\u26A0\uFE0F **\u91CD\u8981: \`report()\` \u306E\u884C\uFF08row\uFF09\u306E\u5F62\u72B6\u306B\u3064\u3044\u3066\u3002** \`rows\` \u306F \`Record<string, string>[]\` \u3067\u3059 \u2014 \u5404\u884C\u306F CSV \u306E\u30AB\u30E9\u30E0\u300C\u540D\u300D\uFF08\`columns\` \u3068\u4E00\u81F4\uFF09\u3092\u30AD\u30FC\u3068\u3057\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u3001\u4F4D\u7F6E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u306E\u914D\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u5FC5\u305A \`row["Url"]\`\u3001\`row["Keyword"]\`\u3001\`row["Search Volume"]\`\uFF08\u30AB\u30E9\u30E0\u540D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u542B\u3080\u3053\u3068\u3042\u308A\uFF09\u306E\u3088\u3046\u306B\u30AB\u30E9\u30E0\u540D\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`columns.indexOf("Url")\` \u3067\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089 \`row[index]\` \u3067\u30A2\u30AF\u30BB\u30B9\u3057\u3066\u306F\u3044\u3051\u307E\u305B\u3093 \u2014 \u305D\u308C\u306F \`undefined\` \u3092\u8FD4\u3057\u3001\`?? ""\` \u3084 \`Number(...) || 0\` \u3068\u7D44\u307F\u5408\u308F\u3055\u308B\u3053\u3068\u3067\u7D50\u679C\u304C\u7A7A\u306B\u306A\u308B\u7121\u97F3\u306E\u5931\u6557\u3092\u751F\u307F\u307E\u3059\u3002\u5168\u3066\u306E\u5024\u306F\u6587\u5B57\u5217\u306A\u306E\u3067\u3001\u6570\u5024\u30AB\u30E9\u30E0\u306F \`Number(row["Position"])\` \u3067\u660E\u793A\u5909\u63DB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
112493
|
+
|
|
112357
112494
|
\`\`\`ts
|
|
112358
112495
|
import type { Context } from "hono";
|
|
112359
112496
|
import { connection } from "@squadbase/vite-server/connectors/semrush";
|
|
@@ -112366,9 +112503,25 @@ export default async function handler(c: Context) {
|
|
|
112366
112503
|
database?: string;
|
|
112367
112504
|
}>();
|
|
112368
112505
|
|
|
112369
|
-
const
|
|
112506
|
+
const result = await semrush.report("domain_organic", {
|
|
112507
|
+
domain,
|
|
112508
|
+
database,
|
|
112509
|
+
display_limit: "100",
|
|
112510
|
+
});
|
|
112511
|
+
|
|
112512
|
+
// \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
|
|
112513
|
+
const rows = result.rows.map((row) => ({
|
|
112514
|
+
keyword: row["Keyword"],
|
|
112515
|
+
position: Number(row["Position"]) || 0,
|
|
112516
|
+
searchVolume: Number(row["Search Volume"]) || 0,
|
|
112517
|
+
url: row["Url"] ?? "",
|
|
112518
|
+
}));
|
|
112519
|
+
|
|
112520
|
+
// \u274C \u8AA4: \u884C\u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308A\u914D\u5217\u3067\u306F\u306A\u3044\u305F\u3081 row[index] \u306F undefined \u306B\u306A\u308B
|
|
112521
|
+
// const urlIdx = result.columns.indexOf("Url");
|
|
112522
|
+
// const url = (row as unknown as string[])[urlIdx];
|
|
112370
112523
|
|
|
112371
|
-
return c.json({ columns:
|
|
112524
|
+
return c.json({ columns: result.columns, rows });
|
|
112372
112525
|
}
|
|
112373
112526
|
\`\`\`
|
|
112374
112527
|
|
|
@@ -112380,8 +112533,8 @@ export default async function handler(c: Context) {
|
|
|
112380
112533
|
|
|
112381
112534
|
\u8A8D\u8A3C: API\u30AD\u30FC\u3092\u3059\u3079\u3066\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u306B \`key\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3068\u3057\u3066\u4ED8\u4E0E\uFF08\u81EA\u52D5\uFF09\u3002
|
|
112382
112535
|
|
|
112383
|
-
#### \u4E3B\u8981\u306A Standard Analytics \u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7
|
|
112384
|
-
- \`
|
|
112536
|
+
#### \u4E3B\u8981\u306A Standard Analytics \u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7\uFF08path \`/\`\u3001CSV\u3092\u8FD4\u3059\uFF09
|
|
112537
|
+
- \`domain_ranks\` \u2014 \u30C9\u30E1\u30A4\u30F3\u306E\u30B5\u30DE\u30EA\u30FC\uFF08rank\u3001\u30AA\u30FC\u30AC\u30CB\u30C3\u30AF/\u6709\u6599\u30AD\u30FC\u30EF\u30FC\u30C9\u6570\u3001\u30C8\u30E9\u30D5\u30A3\u30C3\u30AF\u3001\u30B3\u30B9\u30C8\u306E1\u884CCSV\uFF09\u3002**\`domain_overview\` \u3068\u3044\u3046\u30BF\u30A4\u30D7\u306F\u5B58\u5728\u3057\u306A\u3044\u3002\`domain_ranks\` \u3092\u4F7F\u3046\u3053\u3068\u3002**
|
|
112385
112538
|
- \`domain_organic\` \u2014 \u30C9\u30E1\u30A4\u30F3\u306E\u30AA\u30FC\u30AC\u30CB\u30C3\u30AF\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112386
112539
|
- \`domain_adwords\` \u2014 \u30C9\u30E1\u30A4\u30F3\u306E\u6709\u6599\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112387
112540
|
- \`domain_organic_organic\` / \`domain_adwords_adwords\` \u2014 \u30AA\u30FC\u30AC\u30CB\u30C3\u30AF\uFF0F\u6709\u6599\u306E\u7AF6\u5408
|
|
@@ -112390,10 +112543,13 @@ export default async function handler(c: Context) {
|
|
|
112390
112543
|
- \`phrase_fullsearch\` \u2014 \u30D5\u30EB\u30C6\u30AD\u30B9\u30C8\u30AD\u30FC\u30EF\u30FC\u30C9\u30EA\u30B5\u30FC\u30C1
|
|
112391
112544
|
- \`phrase_questions\` \u2014 \u8CEA\u554F\u5F62\u5F0F\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112392
112545
|
- \`phrase_kdi\` \u2014 \u30AD\u30FC\u30EF\u30FC\u30C9\u96E3\u6613\u5EA6\uFF08KDI\uFF09
|
|
112546
|
+
- \`url_organic\` / \`url_adwords\` \u2014 \u7279\u5B9AURL\u3067\u30E9\u30F3\u30AF\u30A4\u30F3\u3057\u3066\u3044\u308B\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112547
|
+
|
|
112548
|
+
#### Backlinks API \u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7\uFF08path \`/analytics/v1/\`\u3001\u3053\u3061\u3089\u3082 **CSV** \u3092\u8FD4\u3059\u3002JSON \u3067\u306F\u306A\u3044\uFF09
|
|
112549
|
+
Backlinks \u7CFB\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306F \`/analytics/v1/?type=backlinks_*\` \u914D\u4E0B\u306B\u3042\u308A\u3001\`domain\`/\`database\` \u3067\u306F\u306A\u304F \`target\` + \`target_type\`\uFF08\`root_domain\` | \`domain\` | \`url\`\uFF09\u3092\u8981\u6C42\u3059\u308B\u3002\u30EC\u30B9\u30DD\u30F3\u30B9\u306F\u30BB\u30DF\u30B3\u30ED\u30F3\u533A\u5207\u308ACSV\u306A\u306E\u3067\u3001request \u30C4\u30FC\u30EB\u3067\u306F \`responseFormat="text"\` \u3092\u4F7F\u3044\u3001SDK \u3067\u306F \`client.request("/analytics/v1/", { query: { type: "backlinks_overview", target, target_type: "root_domain" } })\` \u3092\u547C\u3093\u3067 CSV \u3092\u81EA\u524D\u3067\u30D1\u30FC\u30B9\u3059\u308B\u3053\u3068\u3002\`client.trends()\` \u306F JSON.parse \u3059\u308B\u305F\u3081 backlinks \u7CFB\u3067\u4F7F\u3046\u3068 throw \u3059\u308B\u3002
|
|
112393
112550
|
- \`backlinks_overview\` \u2014 \u30D0\u30C3\u30AF\u30EA\u30F3\u30AF\u6982\u8981
|
|
112394
112551
|
- \`backlinks\` \u2014 \u30D0\u30C3\u30AF\u30EA\u30F3\u30AF\u4E00\u89A7
|
|
112395
112552
|
- \`backlinks_refdomains\` \u2014 \u53C2\u7167\u30C9\u30E1\u30A4\u30F3
|
|
112396
|
-
- \`url_organic\` / \`url_adwords\` \u2014 \u7279\u5B9AURL\u3067\u30E9\u30F3\u30AF\u30A4\u30F3\u3057\u3066\u3044\u308B\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112397
112553
|
|
|
112398
112554
|
API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u3001\u30E6\u30CB\u30C3\u30C8\u3092\u6D88\u8CBB\u3057\u306A\u3044\uFF09\u306F request \u30C4\u30FC\u30EB\u306B\u7D76\u5BFEURL\u3092\u6E21\u3059: \`path: "https://www.semrush.com/users/countapiunits.html"\`\u3001queryParams \u306A\u3057\u3001\`responseFormat: "text"\`\u3002\u30EC\u30B9\u30DD\u30F3\u30B9\u672C\u6587\u306F\u6570\u5024\u306E\u307F\u3002
|
|
112399
112555
|
|
|
@@ -112401,7 +112557,7 @@ API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u30
|
|
|
112401
112557
|
- \`type\` \u2014 \u30EC\u30DD\u30FC\u30C8\u7A2E\u5225\uFF08Standard API \u3067\u306F\u5FC5\u9808\uFF09
|
|
112402
112558
|
- \`domain\` / \`phrase\` / \`url\` \u2014 \u30AF\u30A8\u30EA\u5BFE\u8C61\u306E\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3
|
|
112403
112559
|
- \`database\` \u2014 \u5730\u57DF\u5225\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\uFF08\`us\`, \`uk\`, \`de\`, \`fr\`, \`jp\`, \`br\` \u306A\u3069\uFF09\u3002\u591A\u304F\u306E\u30EC\u30DD\u30FC\u30C8\u3067\u5FC5\u9808
|
|
112404
|
-
- \`display_limit\` \u2014 \u30DA\u30FC\u30B8\u30B5\u30A4\u30BA\uFF08\u30C7\u30D5\u30A9\u30EB\u30C810000\u3001\u30EC\u30DD\u30FC\u30C8\u306B\u3088\u3063\u3066\u306F\u6700\u5927100000\uFF09
|
|
112560
|
+
- \`display_limit\` \u2014 \u30DA\u30FC\u30B8\u30B5\u30A4\u30BA\uFF08\u30C7\u30D5\u30A9\u30EB\u30C810000\u3001\u30EC\u30DD\u30FC\u30C8\u306B\u3088\u3063\u3066\u306F\u6700\u5927100000\uFF09\u3002**\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u4F7F\u308F\u305A\u3001\u5FC5\u305A \`"1000"\` \u7A0B\u5EA6\u306E\u5C0F\u3055\u3044\u5024\u3092\u660E\u793A\u7684\u306B\u6307\u5B9A\u3059\u308B\u3053\u3068\u3002** \u5927\u304D\u3044\u5024\u3060\u3068 Semrush \u304C\u5FC5\u8981\u30E6\u30CB\u30C3\u30C8\u3092\u4E8B\u524D\u8A08\u7B97\u3057\u3001\u6B8B\u91CF\u304C\u3042\u3063\u3066\u3082 \`ERROR 132\` \u3067\u62D2\u5426\u3059\u308B\u3002
|
|
112405
112561
|
- \`display_offset\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8
|
|
112406
112562
|
- \`display_date\` \u2014 \u5C65\u6B74\u306E\u65E5\u4ED8\u3002\`YYYYMM15\` \u5F62\u5F0F\uFF08\u5FC5\u305A\u6708\u306E15\u65E5\uFF09
|
|
112407
112563
|
- \`export_columns\` \u2014 \u8FD4\u5374\u30AB\u30E9\u30E0\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\uFF08\u4F8B: \`Ph,Po,Nq,Cp\`\uFF09
|
|
@@ -112412,6 +112568,7 @@ API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u30
|
|
|
112412
112568
|
- Standard Analytics \u306E\u5404\u30EC\u30DD\u30FC\u30C8\u306F API \u30E6\u30CB\u30C3\u30C8\u3092\u6D88\u8CBB\u3059\u308B\u3002\u30AF\u30A9\u30FC\u30BF\u304C\u7591\u308F\u3057\u3044\u5834\u5408\u306F \`https://www.semrush.com/users/countapiunits.html?key=...\` \u3067\u6B8B\u91CF\u3092\u5148\u306B\u78BA\u8A8D\u3059\u308B\uFF08\u7121\u6599\uFF09
|
|
112413
112569
|
- CSV \u306E\u30BB\u30D1\u30EC\u30FC\u30BF\u306F \`;\`\uFF08\u30BB\u30DF\u30B3\u30ED\u30F3\uFF09\u3067\u3042\u308A \`,\` \u3067\u306F\u306A\u3044\u3002\u30BB\u30EB\u5185\u306B\u30AB\u30F3\u30DE\u304C\u542B\u307E\u308C\u308B\u3053\u3068\u304C\u3042\u308B
|
|
112414
112570
|
- HTTP 200 \u3067\u3082\u672C\u6587\u304C \`ERROR\` \u3067\u59CB\u307E\u308B\u5834\u5408\u306F API\u30A8\u30E9\u30FC\uFF08\u8A8D\u8A3C\u3001\u30D1\u30E9\u30E1\u30FC\u30BF\u3001\u30AF\u30A9\u30FC\u30BF\uFF09
|
|
112571
|
+
- \`ERROR 132 :: API UNITS BALANCE IS ZERO\` \u306F\u300C\u6B8B\u91CF\u304C\u6587\u5B57\u901A\u308A 0\u300D\u3060\u3051\u3092\u610F\u5473\u3059\u308B\u308F\u3051\u3067\u306F\u306A\u3044\u3002Semrush \u306F \`display_limit \xD7 \u884C\u3042\u305F\u308A\u5358\u4FA1\` \u304C\u6B8B\u91CF\u3092\u8D85\u3048\u308B\u5834\u5408\u3082\u540C\u3058\u30A8\u30E9\u30FC\u3092\u8FD4\u3059\u3002\`countapiunits.html\` \u3067\u6B8B\u91CF\u3092\u518D\u78BA\u8A8D\u3057\u3001\`display_limit\` \u3092 \`1000\` \u3084 \`100\` \u307E\u3067\u4E0B\u3052\u3066\u304B\u3089\u300C\u6B8B\u91CF\u5207\u308C\u300D\u3068\u5224\u65AD\u3059\u308B\u3053\u3068\u3002
|
|
112415
112572
|
- Trends API \u306F\u5225\u9014 Trends \u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u304C\u5FC5\u8981\u3002\u672A\u5951\u7D04\u3060\u3068\u8A8D\u53EF\u30A8\u30E9\u30FC\u306B\u306A\u308B
|
|
112416
112573
|
- \u5C65\u6B74\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u65E5\u4ED8\u306F\u5FC5\u305A\u6708\u306E15\u65E5\uFF08\`YYYYMM15\`\uFF09`
|
|
112417
112574
|
},
|
|
@@ -112450,7 +112607,7 @@ API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u30
|
|
|
112450
112607
|
|
|
112451
112608
|
// ../connectors/src/connectors/google-search-console-oauth/tools/list-sites.ts
|
|
112452
112609
|
import { z as z84 } from "zod";
|
|
112453
|
-
var
|
|
112610
|
+
var BASE_URL38 = "https://searchconsole.googleapis.com/webmasters/v3";
|
|
112454
112611
|
var REQUEST_TIMEOUT_MS67 = 6e4;
|
|
112455
112612
|
var cachedToken30 = null;
|
|
112456
112613
|
async function getProxyToken30(config) {
|
|
@@ -112521,7 +112678,7 @@ var listSitesTool = new ConnectorTool({
|
|
|
112521
112678
|
`[connector-request] google-search-console-oauth/${connection.name}: listSites`
|
|
112522
112679
|
);
|
|
112523
112680
|
try {
|
|
112524
|
-
const url = `${
|
|
112681
|
+
const url = `${BASE_URL38}/sites`;
|
|
112525
112682
|
const token = await getProxyToken30(config.oauthProxy);
|
|
112526
112683
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
112527
112684
|
const controller = new AbortController();
|
|
@@ -112620,7 +112777,7 @@ var parameters69 = {
|
|
|
112620
112777
|
import { z as z85 } from "zod";
|
|
112621
112778
|
var BASE_HOST10 = "https://searchconsole.googleapis.com";
|
|
112622
112779
|
var BASE_PATH_SEGMENT10 = "/webmasters/v3";
|
|
112623
|
-
var
|
|
112780
|
+
var BASE_URL39 = `${BASE_HOST10}${BASE_PATH_SEGMENT10}`;
|
|
112624
112781
|
var REQUEST_TIMEOUT_MS68 = 6e4;
|
|
112625
112782
|
var cachedToken31 = null;
|
|
112626
112783
|
async function getProxyToken31(config) {
|
|
@@ -112705,7 +112862,7 @@ For URL Inspection API requests, use the absolute path '/v1/urlInspection/index:
|
|
|
112705
112862
|
resolvedPath,
|
|
112706
112863
|
BASE_PATH_SEGMENT10
|
|
112707
112864
|
);
|
|
112708
|
-
let url = `${
|
|
112865
|
+
let url = `${BASE_URL39}${normalizedPath}`;
|
|
112709
112866
|
if (queryParams) {
|
|
112710
112867
|
const searchParams = new URLSearchParams(queryParams);
|
|
112711
112868
|
url += `?${searchParams.toString()}`;
|
|
@@ -113195,7 +113352,7 @@ var parameters71 = {
|
|
|
113195
113352
|
import { z as z87 } from "zod";
|
|
113196
113353
|
var BASE_HOST11 = "https://api.clickup.com";
|
|
113197
113354
|
var BASE_PATH_SEGMENT11 = "/api/v2";
|
|
113198
|
-
var
|
|
113355
|
+
var BASE_URL40 = `${BASE_HOST11}${BASE_PATH_SEGMENT11}`;
|
|
113199
113356
|
var REQUEST_TIMEOUT_MS69 = 6e4;
|
|
113200
113357
|
var inputSchema87 = z87.object({
|
|
113201
113358
|
toolUseIntent: z87.string().optional().describe(
|
|
@@ -113268,7 +113425,7 @@ Pagination: ClickUp uses zero-indexed \`page\` query parameter on list endpoints
|
|
|
113268
113425
|
try {
|
|
113269
113426
|
const token = parameters71.apiToken.getValue(connection);
|
|
113270
113427
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT11);
|
|
113271
|
-
const url = `${
|
|
113428
|
+
const url = `${BASE_URL40}${normalizedPath}`;
|
|
113272
113429
|
const controller = new AbortController();
|
|
113273
113430
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS69);
|
|
113274
113431
|
try {
|
|
@@ -113531,7 +113688,8 @@ var parameters72 = {
|
|
|
113531
113688
|
type: "text",
|
|
113532
113689
|
secret: true,
|
|
113533
113690
|
required: false
|
|
113534
|
-
})
|
|
113691
|
+
}),
|
|
113692
|
+
...sshTunnelParameters
|
|
113535
113693
|
};
|
|
113536
113694
|
|
|
113537
113695
|
// ../connectors/src/connectors/sqlserver/tools/execute-query.ts
|
|
@@ -113590,7 +113748,9 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
113590
113748
|
};
|
|
113591
113749
|
}
|
|
113592
113750
|
try {
|
|
113593
|
-
const { rows } = await runMssqlQuery(parsed, sql
|
|
113751
|
+
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
113752
|
+
tunnelParams: connectionParamsToRecord(connection)
|
|
113753
|
+
});
|
|
113594
113754
|
const truncated = rows.length > MAX_ROWS14;
|
|
113595
113755
|
return {
|
|
113596
113756
|
success: true,
|
|
@@ -113661,7 +113821,8 @@ The business logic type for this connector is "sql".
|
|
|
113661
113821
|
{
|
|
113662
113822
|
username: params[parameters72.username.slug],
|
|
113663
113823
|
password: params[parameters72.password.slug]
|
|
113664
|
-
}
|
|
113824
|
+
},
|
|
113825
|
+
{ tunnelParams: params }
|
|
113665
113826
|
);
|
|
113666
113827
|
},
|
|
113667
113828
|
async query(params, sql, _namedParams) {
|
|
@@ -113671,10 +113832,12 @@ The business logic type for this connector is "sql".
|
|
|
113671
113832
|
});
|
|
113672
113833
|
const sample = unwrapSampleLimit(sql);
|
|
113673
113834
|
if (sample) {
|
|
113674
|
-
const result = await runMssqlQuery(parsed, sample.inner
|
|
113835
|
+
const result = await runMssqlQuery(parsed, sample.inner, {
|
|
113836
|
+
tunnelParams: params
|
|
113837
|
+
});
|
|
113675
113838
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
113676
113839
|
}
|
|
113677
|
-
return runMssqlQuery(parsed, sql);
|
|
113840
|
+
return runMssqlQuery(parsed, sql, { tunnelParams: params });
|
|
113678
113841
|
}
|
|
113679
113842
|
});
|
|
113680
113843
|
|
|
@@ -113720,7 +113883,8 @@ var parameters73 = {
|
|
|
113720
113883
|
type: "text",
|
|
113721
113884
|
secret: true,
|
|
113722
113885
|
required: false
|
|
113723
|
-
})
|
|
113886
|
+
}),
|
|
113887
|
+
...sshTunnelParameters
|
|
113724
113888
|
};
|
|
113725
113889
|
|
|
113726
113890
|
// ../connectors/src/connectors/azure-sql/tools/execute-query.ts
|
|
@@ -113779,7 +113943,10 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
113779
113943
|
};
|
|
113780
113944
|
}
|
|
113781
113945
|
try {
|
|
113782
|
-
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
113946
|
+
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
113947
|
+
forceEncrypt: true,
|
|
113948
|
+
tunnelParams: connectionParamsToRecord(connection)
|
|
113949
|
+
});
|
|
113783
113950
|
const truncated = rows.length > MAX_ROWS15;
|
|
113784
113951
|
return {
|
|
113785
113952
|
success: true,
|
|
@@ -113804,7 +113971,7 @@ var azureSqlConnector = new ConnectorPlugin({
|
|
|
113804
113971
|
description: "Connect to Azure SQL Database (managed) using a JDBC-style URL. Encryption is enforced automatically.",
|
|
113805
113972
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5TL0yBbxoLlk6jFZuiHl8w/55040f52d57bf0b77a2215c985c5a772/azure-sql-icon.png",
|
|
113806
113973
|
parameters: parameters73,
|
|
113807
|
-
releaseFlag: { dev1: true, dev2:
|
|
113974
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
113808
113975
|
categories: ["database"],
|
|
113809
113976
|
onboarding: azureSqlOnboarding,
|
|
113810
113977
|
systemPrompt: {
|
|
@@ -113851,7 +114018,7 @@ The business logic type for this connector is "sql".
|
|
|
113851
114018
|
username: params[parameters73.username.slug],
|
|
113852
114019
|
password: params[parameters73.password.slug]
|
|
113853
114020
|
},
|
|
113854
|
-
{ forceEncrypt: true }
|
|
114021
|
+
{ forceEncrypt: true, tunnelParams: params }
|
|
113855
114022
|
);
|
|
113856
114023
|
},
|
|
113857
114024
|
async query(params, sql, _namedParams) {
|
|
@@ -113862,11 +114029,353 @@ The business logic type for this connector is "sql".
|
|
|
113862
114029
|
const sample = unwrapSampleLimit(sql);
|
|
113863
114030
|
if (sample) {
|
|
113864
114031
|
const result = await runMssqlQuery(parsed, sample.inner, {
|
|
113865
|
-
forceEncrypt: true
|
|
114032
|
+
forceEncrypt: true,
|
|
114033
|
+
tunnelParams: params
|
|
113866
114034
|
});
|
|
113867
114035
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
113868
114036
|
}
|
|
113869
|
-
return runMssqlQuery(parsed, sql, {
|
|
114037
|
+
return runMssqlQuery(parsed, sql, {
|
|
114038
|
+
forceEncrypt: true,
|
|
114039
|
+
tunnelParams: params
|
|
114040
|
+
});
|
|
114041
|
+
}
|
|
114042
|
+
});
|
|
114043
|
+
|
|
114044
|
+
// ../connectors/src/connectors/cosmosdb/setup.ts
|
|
114045
|
+
var cosmosdbOnboarding = new ConnectorOnboarding({
|
|
114046
|
+
dataOverviewInstructions: {
|
|
114047
|
+
en: `1. Use cosmosdb_listContainers to list all containers in the configured database
|
|
114048
|
+
2. For key containers, sample documents with cosmosdb_query: container="users", sql="SELECT TOP 5 * FROM c"
|
|
114049
|
+
3. Examine the document structure to understand the schema (Cosmos DB containers are schema-flexible \u2014 items in the same container may have different fields)
|
|
114050
|
+
4. Use cosmosdb_query with GROUP BY to analyse data distribution if needed: \`SELECT c.status, COUNT(1) AS n FROM c GROUP BY c.status\``,
|
|
114051
|
+
ja: `1. cosmosdb_listContainers \u3067\u5BFE\u8C61\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5185\u306E\u30B3\u30F3\u30C6\u30CA\u4E00\u89A7\u3092\u53D6\u5F97
|
|
114052
|
+
2. \u4E3B\u8981\u30B3\u30F3\u30C6\u30CA\u306B\u3064\u3044\u3066 cosmosdb_query \u3067\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0: container="users", sql="SELECT TOP 5 * FROM c"
|
|
114053
|
+
3. \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u69CB\u9020\u3092\u78BA\u8A8D\u3057\u3066\u30B9\u30AD\u30FC\u30DE\u3092\u628A\u63E1\uFF08Cosmos DB \u306E\u30B3\u30F3\u30C6\u30CA\u306F\u30B9\u30AD\u30FC\u30DE\u304C\u67D4\u8EDF\u306A\u305F\u3081\u3001\u540C\u3058\u30B3\u30F3\u30C6\u30CA\u5185\u3067\u3082\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u7570\u306A\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\uFF09
|
|
114054
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066 cosmosdb_query \u306E GROUP BY \u3067\u30C7\u30FC\u30BF\u5206\u5E03\u3092\u78BA\u8A8D: \`SELECT c.status, COUNT(1) AS n FROM c GROUP BY c.status\``
|
|
114055
|
+
}
|
|
114056
|
+
});
|
|
114057
|
+
|
|
114058
|
+
// ../connectors/src/connectors/cosmosdb/parameters.ts
|
|
114059
|
+
var parameters74 = {
|
|
114060
|
+
endpoint: new ParameterDefinition({
|
|
114061
|
+
slug: "endpoint",
|
|
114062
|
+
name: "Cosmos DB Endpoint",
|
|
114063
|
+
description: "Cosmos DB account endpoint URL (e.g. `https://<account>.documents.azure.com:443/`). Found in the Azure Portal under the account's *Keys* blade.",
|
|
114064
|
+
envVarBaseKey: "COSMOSDB_ENDPOINT",
|
|
114065
|
+
type: "text",
|
|
114066
|
+
secret: false,
|
|
114067
|
+
required: true
|
|
114068
|
+
}),
|
|
114069
|
+
key: new ParameterDefinition({
|
|
114070
|
+
slug: "key",
|
|
114071
|
+
name: "Account Key",
|
|
114072
|
+
description: "Cosmos DB account key (primary or secondary master key). Use a read-only key when only querying data.",
|
|
114073
|
+
envVarBaseKey: "COSMOSDB_KEY",
|
|
114074
|
+
type: "text",
|
|
114075
|
+
secret: true,
|
|
114076
|
+
required: true
|
|
114077
|
+
}),
|
|
114078
|
+
database: new ParameterDefinition({
|
|
114079
|
+
slug: "database",
|
|
114080
|
+
name: "Database",
|
|
114081
|
+
description: "The Cosmos DB database (a.k.a. database account namespace) to connect to.",
|
|
114082
|
+
envVarBaseKey: "COSMOSDB_DATABASE",
|
|
114083
|
+
type: "text",
|
|
114084
|
+
secret: false,
|
|
114085
|
+
required: true
|
|
114086
|
+
})
|
|
114087
|
+
};
|
|
114088
|
+
|
|
114089
|
+
// ../connectors/src/connectors/cosmosdb/tools/list-containers.ts
|
|
114090
|
+
import { z as z90 } from "zod";
|
|
114091
|
+
var inputSchema90 = z90.object({
|
|
114092
|
+
toolUseIntent: z90.string().optional().describe(
|
|
114093
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
114094
|
+
),
|
|
114095
|
+
connectionId: z90.string().describe("ID of the Cosmos DB connection to use")
|
|
114096
|
+
});
|
|
114097
|
+
var outputSchema90 = z90.discriminatedUnion("success", [
|
|
114098
|
+
z90.object({
|
|
114099
|
+
success: z90.literal(true),
|
|
114100
|
+
containers: z90.array(
|
|
114101
|
+
z90.object({
|
|
114102
|
+
id: z90.string(),
|
|
114103
|
+
partitionKey: z90.array(z90.string()).optional()
|
|
114104
|
+
})
|
|
114105
|
+
)
|
|
114106
|
+
}),
|
|
114107
|
+
z90.object({
|
|
114108
|
+
success: z90.literal(false),
|
|
114109
|
+
error: z90.string()
|
|
114110
|
+
})
|
|
114111
|
+
]);
|
|
114112
|
+
var listContainersTool = new ConnectorTool({
|
|
114113
|
+
name: "listContainers",
|
|
114114
|
+
description: `List all containers in the configured Cosmos DB database.
|
|
114115
|
+
Use this as the first step to explore the data structure. Returns container ids and their partition key paths.
|
|
114116
|
+
After listing containers, use the query tool to sample items and understand each container's schema.`,
|
|
114117
|
+
inputSchema: inputSchema90,
|
|
114118
|
+
outputSchema: outputSchema90,
|
|
114119
|
+
async execute({ connectionId }, connections) {
|
|
114120
|
+
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114121
|
+
if (!connection) {
|
|
114122
|
+
return {
|
|
114123
|
+
success: false,
|
|
114124
|
+
error: `Connection ${connectionId} not found`
|
|
114125
|
+
};
|
|
114126
|
+
}
|
|
114127
|
+
console.log(
|
|
114128
|
+
`[connector-query] cosmosdb/${connection.name}: listContainers`
|
|
114129
|
+
);
|
|
114130
|
+
let key;
|
|
114131
|
+
try {
|
|
114132
|
+
const { CosmosClient } = await import("@azure/cosmos");
|
|
114133
|
+
const endpoint = parameters74.endpoint.getValue(connection);
|
|
114134
|
+
key = parameters74.key.getValue(connection);
|
|
114135
|
+
const database = parameters74.database.getValue(connection);
|
|
114136
|
+
const client = new CosmosClient({ endpoint, key });
|
|
114137
|
+
const db = client.database(database);
|
|
114138
|
+
const { resources } = await db.containers.readAll().fetchAll();
|
|
114139
|
+
return {
|
|
114140
|
+
success: true,
|
|
114141
|
+
containers: resources.map((c6) => ({
|
|
114142
|
+
id: c6.id,
|
|
114143
|
+
partitionKey: extractPartitionKeyPaths(c6.partitionKey)
|
|
114144
|
+
}))
|
|
114145
|
+
};
|
|
114146
|
+
} catch (err) {
|
|
114147
|
+
let msg = err instanceof Error ? err.message : String(err);
|
|
114148
|
+
if (key) msg = msg.replaceAll(key, "***");
|
|
114149
|
+
return { success: false, error: msg };
|
|
114150
|
+
}
|
|
114151
|
+
}
|
|
114152
|
+
});
|
|
114153
|
+
function extractPartitionKeyPaths(partitionKey) {
|
|
114154
|
+
if (!partitionKey || typeof partitionKey !== "object") return void 0;
|
|
114155
|
+
const paths = partitionKey.paths;
|
|
114156
|
+
if (!Array.isArray(paths)) return void 0;
|
|
114157
|
+
return paths.filter((p2) => typeof p2 === "string");
|
|
114158
|
+
}
|
|
114159
|
+
|
|
114160
|
+
// ../connectors/src/connectors/cosmosdb/tools/query.ts
|
|
114161
|
+
import { z as z91 } from "zod";
|
|
114162
|
+
var MAX_DOCUMENTS3 = 500;
|
|
114163
|
+
var inputSchema91 = z91.object({
|
|
114164
|
+
toolUseIntent: z91.string().optional().describe(
|
|
114165
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
114166
|
+
),
|
|
114167
|
+
connectionId: z91.string().describe("ID of the Cosmos DB connection to use"),
|
|
114168
|
+
container: z91.string().describe("Id of the container (a.k.a. collection) to query"),
|
|
114169
|
+
sql: z91.string().describe(
|
|
114170
|
+
"Cosmos DB SQL query (Core / NoSQL API). Reference items via the alias `c` (e.g. `SELECT TOP 100 c.id, c.name FROM c WHERE c.status = 'active'`). Use `TOP n` rather than `LIMIT n` \u2014 Cosmos DB does not understand `LIMIT`."
|
|
114171
|
+
),
|
|
114172
|
+
partitionKey: z91.string().optional().describe(
|
|
114173
|
+
`Optional partition key value to scope the query to a single partition. Pass as a JSON-encoded scalar (e.g. '"abc"' or '123'). Omit for cross-partition queries.`
|
|
114174
|
+
)
|
|
114175
|
+
});
|
|
114176
|
+
var outputSchema91 = z91.discriminatedUnion("success", [
|
|
114177
|
+
z91.object({
|
|
114178
|
+
success: z91.literal(true),
|
|
114179
|
+
documentCount: z91.number(),
|
|
114180
|
+
truncated: z91.boolean(),
|
|
114181
|
+
requestCharge: z91.number().optional(),
|
|
114182
|
+
documents: z91.array(z91.unknown())
|
|
114183
|
+
}),
|
|
114184
|
+
z91.object({
|
|
114185
|
+
success: z91.literal(false),
|
|
114186
|
+
error: z91.string()
|
|
114187
|
+
})
|
|
114188
|
+
]);
|
|
114189
|
+
var queryTool = new ConnectorTool({
|
|
114190
|
+
name: "query",
|
|
114191
|
+
description: `Execute a Cosmos DB SQL (Core / NoSQL API) query against a container. Returns up to ${MAX_DOCUMENTS3} items.
|
|
114192
|
+
Use for: schema exploration, data sampling, aggregations, and analytical queries.
|
|
114193
|
+
Cosmos DB SQL targets a single container; reference items via the alias \`c\` (e.g. \`SELECT c.id FROM c WHERE c.userId = 'abc'\`).
|
|
114194
|
+
Use \`TOP n\` (not \`LIMIT n\`) to bound the result. Cross-partition queries are enabled by default \u2014 pass \`partitionKey\` to restrict to a single partition.`,
|
|
114195
|
+
inputSchema: inputSchema91,
|
|
114196
|
+
outputSchema: outputSchema91,
|
|
114197
|
+
async execute({ connectionId, container, sql, partitionKey }, connections) {
|
|
114198
|
+
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114199
|
+
if (!connection) {
|
|
114200
|
+
return {
|
|
114201
|
+
success: false,
|
|
114202
|
+
error: `Connection ${connectionId} not found`
|
|
114203
|
+
};
|
|
114204
|
+
}
|
|
114205
|
+
console.log(
|
|
114206
|
+
`[connector-query] cosmosdb/${connection.name} (${container}): ${sql}`
|
|
114207
|
+
);
|
|
114208
|
+
let key;
|
|
114209
|
+
try {
|
|
114210
|
+
const cosmos = await import("@azure/cosmos");
|
|
114211
|
+
const { CosmosClient } = cosmos;
|
|
114212
|
+
const endpoint = parameters74.endpoint.getValue(connection);
|
|
114213
|
+
key = parameters74.key.getValue(connection);
|
|
114214
|
+
const database = parameters74.database.getValue(connection);
|
|
114215
|
+
const client = new CosmosClient({ endpoint, key });
|
|
114216
|
+
const cont = client.database(database).container(container);
|
|
114217
|
+
const queryOptions = {
|
|
114218
|
+
// Bound by the connector's own row cap, but keep the SDK from
|
|
114219
|
+
// streaming arbitrarily large continuations.
|
|
114220
|
+
maxItemCount: MAX_DOCUMENTS3 + 1
|
|
114221
|
+
};
|
|
114222
|
+
if (partitionKey != null && partitionKey !== "") {
|
|
114223
|
+
try {
|
|
114224
|
+
queryOptions.partitionKey = JSON.parse(partitionKey);
|
|
114225
|
+
} catch {
|
|
114226
|
+
return {
|
|
114227
|
+
success: false,
|
|
114228
|
+
error: `Invalid partitionKey: must be a JSON-encoded scalar (e.g. '"abc"' or '123'). Got: ${partitionKey}`
|
|
114229
|
+
};
|
|
114230
|
+
}
|
|
114231
|
+
}
|
|
114232
|
+
const iterator = cont.items.query(sql, queryOptions);
|
|
114233
|
+
const { resources, requestCharge } = await iterator.fetchNext();
|
|
114234
|
+
const documents = resources ?? [];
|
|
114235
|
+
const truncated = documents.length > MAX_DOCUMENTS3;
|
|
114236
|
+
return {
|
|
114237
|
+
success: true,
|
|
114238
|
+
documentCount: Math.min(documents.length, MAX_DOCUMENTS3),
|
|
114239
|
+
truncated,
|
|
114240
|
+
requestCharge,
|
|
114241
|
+
documents: documents.slice(0, MAX_DOCUMENTS3)
|
|
114242
|
+
};
|
|
114243
|
+
} catch (err) {
|
|
114244
|
+
let msg = err instanceof Error ? err.message : String(err);
|
|
114245
|
+
if (key) msg = msg.replaceAll(key, "***");
|
|
114246
|
+
return { success: false, error: msg };
|
|
114247
|
+
}
|
|
114248
|
+
}
|
|
114249
|
+
});
|
|
114250
|
+
|
|
114251
|
+
// ../connectors/src/connectors/cosmosdb/index.ts
|
|
114252
|
+
var tools74 = {
|
|
114253
|
+
listContainers: listContainersTool,
|
|
114254
|
+
query: queryTool
|
|
114255
|
+
};
|
|
114256
|
+
var cosmosdbConnector = new ConnectorPlugin({
|
|
114257
|
+
slug: "cosmosdb",
|
|
114258
|
+
authType: AUTH_TYPES.USER_PASSWORD,
|
|
114259
|
+
name: "Azure Cosmos DB",
|
|
114260
|
+
description: "Connect to Azure Cosmos DB (Core / NoSQL API) for document-oriented data storage and SQL-style querying.",
|
|
114261
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5p9B2Db0V2d8mK2jgBWtZu/dad72db8f41b16c50de2bcef03f9d415/cosmosdb-icon.png",
|
|
114262
|
+
parameters: parameters74,
|
|
114263
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114264
|
+
categories: ["database"],
|
|
114265
|
+
onboarding: cosmosdbOnboarding,
|
|
114266
|
+
systemPrompt: {
|
|
114267
|
+
en: `### Tools
|
|
114268
|
+
|
|
114269
|
+
- \`cosmosdb_listContainers\`: Lists all containers in the configured database, with their partition key paths. Use this first to explore available data.
|
|
114270
|
+
- \`cosmosdb_query\`: Executes a Cosmos DB SQL (Core / NoSQL API) query against a single container and returns items. Use for schema exploration, data sampling, and analytical queries. Pass \`partitionKey\` to scope the query to a single partition (cross-partition queries are enabled by default).
|
|
114271
|
+
|
|
114272
|
+
### Business Logic
|
|
114273
|
+
|
|
114274
|
+
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
|
|
114275
|
+
|
|
114276
|
+
\u26A0\uFE0F **The client returned by \`connection(connectionId)\` is NOT the raw \`@azure/cosmos\` \`CosmosClient\`.** It is a thin wrapper exposing only two methods:
|
|
114277
|
+
- \`client.query<T>(container, sql, options?) => Promise<T[]>\` \u2014 runs a Cosmos SQL query against the named container and returns the **already-unwrapped** items array (no \`{ resources }\` wrapper). \`options\` accepts \`{ maxItemCount?: number; partitionKey?: unknown }\`.
|
|
114278
|
+
- \`client.listContainers() => Promise<{ id: string; partitionKey?: string[] }[]>\` \u2014 lists containers in the configured database.
|
|
114279
|
+
|
|
114280
|
+
There is **no** \`client.databases\`, \`client.database(...)\`, \`client.container(...)\`, or \`client.items\`. Do NOT attempt to use the \`@azure/cosmos\` \`CosmosClient\` API directly through this client \u2014 those calls will fail with \`Cannot read properties of undefined\`.
|
|
114281
|
+
|
|
114282
|
+
\`\`\`ts
|
|
114283
|
+
import type { Context } from "hono";
|
|
114284
|
+
import { connection } from "@squadbase/vite-server/connectors/cosmosdb";
|
|
114285
|
+
|
|
114286
|
+
const cosmos = connection("<connectionId>");
|
|
114287
|
+
|
|
114288
|
+
export default async function handler(_c: Context) {
|
|
114289
|
+
// \`query\` returns the items array directly \u2014 no \`.resources\` to unwrap.
|
|
114290
|
+
const rows = await cosmos.query<{ prod: string; orderCount: number }>(
|
|
114291
|
+
"<containerName>",
|
|
114292
|
+
"SELECT c.prod, COUNT(1) AS orderCount FROM c GROUP BY c.prod",
|
|
114293
|
+
// Optional: scope to a single partition to save RUs.
|
|
114294
|
+
// { partitionKey: "<partitionKeyValue>" },
|
|
114295
|
+
);
|
|
114296
|
+
|
|
114297
|
+
rows.sort((a, b) => Number(b.orderCount) - Number(a.orderCount));
|
|
114298
|
+
|
|
114299
|
+
return new Response(JSON.stringify(rows), {
|
|
114300
|
+
headers: { "Content-Type": "application/json" },
|
|
114301
|
+
});
|
|
114302
|
+
}
|
|
114303
|
+
\`\`\`
|
|
114304
|
+
|
|
114305
|
+
### Cosmos DB SQL Reference
|
|
114306
|
+
- Cosmos DB stores schema-flexible JSON items in **containers** organised under a **database**. Items are partitioned by a per-container partition key path.
|
|
114307
|
+
- Queries always target a single container and reference items via the alias \`c\` (e.g. \`SELECT c.id, c.name FROM c WHERE c.status = 'active'\`).
|
|
114308
|
+
- Row limiting: use \`TOP n\` (e.g. \`SELECT TOP 100 * FROM c\`). \`LIMIT\` is **not** supported. \`OFFSET m LIMIT n\` is supported on newer accounts but \`TOP\` is the safe default.
|
|
114309
|
+
- System fields are prefixed with an underscore (\`c.id\`, \`c._ts\` for the modification timestamp, \`c._etag\`).
|
|
114310
|
+
- Aggregates: \`COUNT(1)\`, \`SUM\`, \`AVG\`, \`MIN\`, \`MAX\`, with \`GROUP BY\` (e.g. \`SELECT c.country, COUNT(1) AS n FROM c GROUP BY c.country\`).
|
|
114311
|
+
- Joins: only **intra-document** joins via \`JOIN\` over arrays inside the same item; there is no cross-container/cross-document join.
|
|
114312
|
+
- Always bound results with \`TOP n\` and prefer scoped queries with a \`partitionKey\` value when possible \u2014 cross-partition queries cost more RUs.`,
|
|
114313
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
114314
|
+
|
|
114315
|
+
- \`cosmosdb_listContainers\`: \u8A2D\u5B9A\u3055\u308C\u305F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5185\u306E\u30B3\u30F3\u30C6\u30CA\u4E00\u89A7\uFF08\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u30AD\u30FC\u306E\u30D1\u30B9\u4ED8\u304D\uFF09\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30C7\u30FC\u30BF\u63A2\u7D22\u306E\u6700\u521D\u306E\u30B9\u30C6\u30C3\u30D7\u3068\u3057\u3066\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
114316
|
+
- \`cosmosdb_query\`: \u5358\u4E00\u306E\u30B3\u30F3\u30C6\u30CA\u306B\u5BFE\u3057\u3066 Cosmos DB SQL\uFF08Core / NoSQL API\uFF09\u30AF\u30A8\u30EA\u3092\u5B9F\u884C\u3057\u3001\u30A2\u30A4\u30C6\u30E0\u3092\u8FD4\u3057\u307E\u3059\u3002\u30B9\u30AD\u30FC\u30DE\u63A2\u7D22\u3001\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3001\u5206\u6790\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\`partitionKey\` \u3092\u6E21\u3059\u3068\u5358\u4E00\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u306B\u30B9\u30B3\u30FC\u30D7\u3067\u304D\u3001\u672A\u6307\u5B9A\u3060\u3068\u30AF\u30ED\u30B9\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u30AF\u30A8\u30EA\u306B\u306A\u308A\u307E\u3059\u3002
|
|
114317
|
+
|
|
114318
|
+
### Business Logic
|
|
114319
|
+
|
|
114320
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
114321
|
+
|
|
114322
|
+
\u26A0\uFE0F **\`connection(connectionId)\` \u304C\u8FD4\u3059\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u306F \`@azure/cosmos\` \u306E \`CosmosClient\` \u305D\u306E\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002** \u4EE5\u4E0B\u306E2\u30E1\u30BD\u30C3\u30C9\u306E\u307F\u3092\u516C\u958B\u3059\u308B\u8584\u3044\u30E9\u30C3\u30D1\u30FC\u3067\u3059\uFF1A
|
|
114323
|
+
- \`client.query<T>(container, sql, options?) => Promise<T[]>\` \u2014 \u6307\u5B9A\u30B3\u30F3\u30C6\u30CA\u306B\u5BFE\u3057\u3066 Cosmos SQL \u3092\u5B9F\u884C\u3057\u3001**\u3059\u3067\u306B\u5C55\u958B\u6E08\u307F\u306E\u30A2\u30A4\u30C6\u30E0\u914D\u5217**\u3092\u8FD4\u3059\uFF08\`{ resources }\` \u3067\u30E9\u30C3\u30D7\u3055\u308C\u3066\u3044\u306A\u3044\uFF09\u3002\`options\` \u306F \`{ maxItemCount?: number; partitionKey?: unknown }\`\u3002
|
|
114324
|
+
- \`client.listContainers() => Promise<{ id: string; partitionKey?: string[] }[]>\` \u2014 \u8A2D\u5B9A\u3055\u308C\u305F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5185\u306E\u30B3\u30F3\u30C6\u30CA\u4E00\u89A7\u3092\u8FD4\u3059\u3002
|
|
114325
|
+
|
|
114326
|
+
\`client.databases\`\u3001\`client.database(...)\`\u3001\`client.container(...)\`\u3001\`client.items\` \u306F **\u5B58\u5728\u3057\u306A\u3044**\u3002\`@azure/cosmos\` \u306E \`CosmosClient\` API \u3092\u3053\u306E\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u8D8A\u3057\u306B\u76F4\u63A5\u4F7F\u304A\u3046\u3068\u3057\u306A\u3044\u3053\u3068 \u2014 \`Cannot read properties of undefined\` \u3067\u5931\u6557\u3059\u308B\u3002
|
|
114327
|
+
|
|
114328
|
+
\`\`\`ts
|
|
114329
|
+
import type { Context } from "hono";
|
|
114330
|
+
import { connection } from "@squadbase/vite-server/connectors/cosmosdb";
|
|
114331
|
+
|
|
114332
|
+
const cosmos = connection("<connectionId>");
|
|
114333
|
+
|
|
114334
|
+
export default async function handler(_c: Context) {
|
|
114335
|
+
// \`query\` \u306F items \u914D\u5217\u3092\u305D\u306E\u307E\u307E\u8FD4\u3059 \u2014 \`.resources\` \u306E\u5C55\u958B\u306F\u4E0D\u8981\u3002
|
|
114336
|
+
const rows = await cosmos.query<{ prod: string; orderCount: number }>(
|
|
114337
|
+
"<containerName>",
|
|
114338
|
+
"SELECT c.prod, COUNT(1) AS orderCount FROM c GROUP BY c.prod",
|
|
114339
|
+
// \u4EFB\u610F: \u5358\u4E00\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u306B\u30B9\u30B3\u30FC\u30D7\u3057\u3066 RU \u3092\u7BC0\u7D04\u3002
|
|
114340
|
+
// { partitionKey: "<partitionKeyValue>" },
|
|
114341
|
+
);
|
|
114342
|
+
|
|
114343
|
+
rows.sort((a, b) => Number(b.orderCount) - Number(a.orderCount));
|
|
114344
|
+
|
|
114345
|
+
return new Response(JSON.stringify(rows), {
|
|
114346
|
+
headers: { "Content-Type": "application/json" },
|
|
114347
|
+
});
|
|
114348
|
+
}
|
|
114349
|
+
\`\`\`
|
|
114350
|
+
|
|
114351
|
+
### Cosmos DB SQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
114352
|
+
- Cosmos DB \u306F\u30B9\u30AD\u30FC\u30DE\u67D4\u8EDF\u306A JSON \u30A2\u30A4\u30C6\u30E0\u3092 **\u30B3\u30F3\u30C6\u30CA** \u306B\u683C\u7D0D\u3057\u3001\u30B3\u30F3\u30C6\u30CA\u306F\u30B3\u30F3\u30C6\u30CA\u3054\u3068\u306E\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u30AD\u30FC\u30D1\u30B9\u3067\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u5206\u5272\u3055\u308C\u307E\u3059\u3002\u30B3\u30F3\u30C6\u30CA\u306F **\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9** \u306B\u307E\u3068\u3081\u3089\u308C\u307E\u3059\u3002
|
|
114353
|
+
- \u30AF\u30A8\u30EA\u306F\u5E38\u306B\u5358\u4E00\u30B3\u30F3\u30C6\u30CA\u3092\u5BFE\u8C61\u3068\u3057\u3001\u30A2\u30A4\u30C6\u30E0\u306F\u5225\u540D \`c\` \u3067\u53C2\u7167\u3057\u307E\u3059\uFF08\u4F8B: \`SELECT c.id, c.name FROM c WHERE c.status = 'active'\`\uFF09\u3002
|
|
114354
|
+
- \u884C\u6570\u5236\u9650: \`TOP n\` \u3092\u4F7F\u7528\u3057\u307E\u3059\uFF08\u4F8B: \`SELECT TOP 100 * FROM c\`\uFF09\u3002\`LIMIT\` \u306F **\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093**\u3002\u65B0\u3057\u3044\u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u306F \`OFFSET m LIMIT n\` \u304C\u4F7F\u3048\u307E\u3059\u304C\u3001\u5B89\u5168\u5074\u306E\u65E2\u5B9A\u306F \`TOP\` \u3067\u3059\u3002
|
|
114355
|
+
- \u30B7\u30B9\u30C6\u30E0\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u30A2\u30F3\u30C0\u30FC\u30B9\u30B3\u30A2\u59CB\u307E\u308A\uFF08\`c.id\`\u3001\u5909\u66F4\u6642\u523B\u306E \`c._ts\`\u3001\`c._etag\`\uFF09\u3002
|
|
114356
|
+
- \u96C6\u7D04: \`COUNT(1)\`\u3001\`SUM\`\u3001\`AVG\`\u3001\`MIN\`\u3001\`MAX\` \u3092 \`GROUP BY\` \u3068\u7D44\u307F\u5408\u308F\u305B\u307E\u3059\uFF08\u4F8B: \`SELECT c.country, COUNT(1) AS n FROM c GROUP BY c.country\`\uFF09\u3002
|
|
114357
|
+
- \u7D50\u5408: \u540C\u4E00\u30A2\u30A4\u30C6\u30E0\u5185\u306E\u914D\u5217\u306B\u5BFE\u3059\u308B **\u30A4\u30F3\u30C8\u30E9\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8** \`JOIN\` \u306E\u307F\u3067\u3001\u30B3\u30F3\u30C6\u30CA\u9593\uFF0F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u9593\u306E\u7D50\u5408\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u307E\u305B\u3093\u3002
|
|
114358
|
+
- \u7D50\u679C\u4EF6\u6570\u306F\u5FC5\u305A \`TOP n\` \u3067\u5236\u9650\u3057\u3001\u53EF\u80FD\u3067\u3042\u308C\u3070 \`partitionKey\` \u3067\u5358\u4E00\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u306B\u30B9\u30B3\u30FC\u30D7\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u30AF\u30ED\u30B9\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u30AF\u30A8\u30EA\u306F RU \u3092\u591A\u304F\u6D88\u8CBB\u3057\u307E\u3059\uFF09\u3002`
|
|
114359
|
+
},
|
|
114360
|
+
tools: tools74,
|
|
114361
|
+
async checkConnection(params, _config) {
|
|
114362
|
+
try {
|
|
114363
|
+
const { CosmosClient } = await import("@azure/cosmos");
|
|
114364
|
+
const client = new CosmosClient({
|
|
114365
|
+
endpoint: params[parameters74.endpoint.slug],
|
|
114366
|
+
key: params[parameters74.key.slug]
|
|
114367
|
+
});
|
|
114368
|
+
const database = params[parameters74.database.slug];
|
|
114369
|
+
await client.database(database).read();
|
|
114370
|
+
return { success: true };
|
|
114371
|
+
} catch (error2) {
|
|
114372
|
+
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
114373
|
+
const key = params[parameters74.key.slug];
|
|
114374
|
+
return {
|
|
114375
|
+
success: false,
|
|
114376
|
+
error: key ? msg.replaceAll(key, "***") : msg
|
|
114377
|
+
};
|
|
114378
|
+
}
|
|
113870
114379
|
}
|
|
113871
114380
|
});
|
|
113872
114381
|
|
|
@@ -113887,7 +114396,7 @@ var oracleOnboarding = new ConnectorOnboarding({
|
|
|
113887
114396
|
});
|
|
113888
114397
|
|
|
113889
114398
|
// ../connectors/src/connectors/oracle/parameters.ts
|
|
113890
|
-
var
|
|
114399
|
+
var parameters75 = {
|
|
113891
114400
|
jdbcUrl: new ParameterDefinition({
|
|
113892
114401
|
slug: "jdbc-url",
|
|
113893
114402
|
name: "Oracle JDBC URL",
|
|
@@ -113914,31 +114423,32 @@ var parameters74 = {
|
|
|
113914
114423
|
type: "text",
|
|
113915
114424
|
secret: true,
|
|
113916
114425
|
required: false
|
|
113917
|
-
})
|
|
114426
|
+
}),
|
|
114427
|
+
...sshTunnelParameters
|
|
113918
114428
|
};
|
|
113919
114429
|
|
|
113920
114430
|
// ../connectors/src/connectors/oracle/tools/execute-query.ts
|
|
113921
|
-
import { z as
|
|
114431
|
+
import { z as z92 } from "zod";
|
|
113922
114432
|
var MAX_ROWS16 = 500;
|
|
113923
|
-
var
|
|
113924
|
-
toolUseIntent:
|
|
114433
|
+
var inputSchema92 = z92.object({
|
|
114434
|
+
toolUseIntent: z92.string().optional().describe(
|
|
113925
114435
|
"Brief description of what you intend to accomplish with this tool call"
|
|
113926
114436
|
),
|
|
113927
|
-
connectionId:
|
|
113928
|
-
sql:
|
|
114437
|
+
connectionId: z92.string().describe("ID of the Oracle connection to use"),
|
|
114438
|
+
sql: z92.string().describe(
|
|
113929
114439
|
"PL/SQL-compatible query. Oracle has no `LIMIT`; use `FETCH FIRST n ROWS ONLY` or filter on `ROWNUM`. Don't end the statement with a semicolon \u2014 the driver rejects trailing terminators."
|
|
113930
114440
|
)
|
|
113931
114441
|
});
|
|
113932
|
-
var
|
|
113933
|
-
|
|
113934
|
-
success:
|
|
113935
|
-
rowCount:
|
|
113936
|
-
truncated:
|
|
113937
|
-
rows:
|
|
114442
|
+
var outputSchema92 = z92.discriminatedUnion("success", [
|
|
114443
|
+
z92.object({
|
|
114444
|
+
success: z92.literal(true),
|
|
114445
|
+
rowCount: z92.number(),
|
|
114446
|
+
truncated: z92.boolean(),
|
|
114447
|
+
rows: z92.array(z92.record(z92.string(), z92.unknown()))
|
|
113938
114448
|
}),
|
|
113939
|
-
|
|
113940
|
-
success:
|
|
113941
|
-
error:
|
|
114449
|
+
z92.object({
|
|
114450
|
+
success: z92.literal(false),
|
|
114451
|
+
error: z92.string()
|
|
113942
114452
|
})
|
|
113943
114453
|
]);
|
|
113944
114454
|
var executeQueryTool16 = new ConnectorTool({
|
|
@@ -113948,8 +114458,8 @@ Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_T
|
|
|
113948
114458
|
Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
|
|
113949
114459
|
Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
|
|
113950
114460
|
Do NOT terminate statements with a semicolon; the driver rejects trailing terminators.`,
|
|
113951
|
-
inputSchema:
|
|
113952
|
-
outputSchema:
|
|
114461
|
+
inputSchema: inputSchema92,
|
|
114462
|
+
outputSchema: outputSchema92,
|
|
113953
114463
|
async execute({ connectionId, sql }, connections) {
|
|
113954
114464
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
113955
114465
|
if (!connection) {
|
|
@@ -113958,9 +114468,9 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
113958
114468
|
error: `Connection ${connectionId} not found`
|
|
113959
114469
|
};
|
|
113960
114470
|
}
|
|
113961
|
-
const jdbcUrl =
|
|
113962
|
-
const username =
|
|
113963
|
-
const password =
|
|
114471
|
+
const jdbcUrl = parameters75.jdbcUrl.getValue(connection);
|
|
114472
|
+
const username = parameters75.username.tryGetValue(connection);
|
|
114473
|
+
const password = parameters75.password.tryGetValue(connection);
|
|
113964
114474
|
console.log(
|
|
113965
114475
|
`[connector-query] oracle/${connection.name} (${redactOracleUrl(jdbcUrl)}): ${sql}`
|
|
113966
114476
|
);
|
|
@@ -113975,7 +114485,9 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
113975
114485
|
}
|
|
113976
114486
|
try {
|
|
113977
114487
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
113978
|
-
const { rows } = await runOracleQuery(parsed, cleanSql
|
|
114488
|
+
const { rows } = await runOracleQuery(parsed, cleanSql, {
|
|
114489
|
+
tunnelParams: connectionParamsToRecord(connection)
|
|
114490
|
+
});
|
|
113979
114491
|
const truncated = rows.length > MAX_ROWS16;
|
|
113980
114492
|
return {
|
|
113981
114493
|
success: true,
|
|
@@ -113992,14 +114504,14 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
113992
114504
|
});
|
|
113993
114505
|
|
|
113994
114506
|
// ../connectors/src/connectors/oracle/index.ts
|
|
113995
|
-
var
|
|
114507
|
+
var tools75 = { executeQuery: executeQueryTool16 };
|
|
113996
114508
|
var oracleConnector = new ConnectorPlugin({
|
|
113997
114509
|
slug: "oracle",
|
|
113998
114510
|
authType: AUTH_TYPES.USER_PASSWORD,
|
|
113999
114511
|
name: "Oracle Database",
|
|
114000
114512
|
description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
|
|
114001
114513
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
|
|
114002
|
-
parameters:
|
|
114514
|
+
parameters: parameters75,
|
|
114003
114515
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
114004
114516
|
categories: ["database"],
|
|
114005
114517
|
onboarding: oracleOnboarding,
|
|
@@ -114043,26 +114555,32 @@ The business logic type for this connector is "sql".
|
|
|
114043
114555
|
- \u30B9\u30C6\u30FC\u30C8\u30E1\u30F3\u30C8\u672B\u5C3E\u306B\u30BB\u30DF\u30B3\u30ED\u30F3\u3092\u4ED8\u3051\u306A\u3044\u3067\u304F\u3060\u3055\u3044\uFF08thin \u30C9\u30E9\u30A4\u30D0\u304C\u62D2\u5426\u3057\u307E\u3059\uFF09\u3002
|
|
114044
114556
|
- \u884C\u6570\u5236\u9650\u306E\u4E92\u63DB\u6027: \u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u306E server-logic \u30B9\u30AD\u30FC\u30DE\u63A8\u8AD6\u306F\u3001\u30AF\u30A8\u30EA\u3092 \`SELECT * FROM (<inner>) AS _sq LIMIT N\` \u306E\u5F62\u3067\u30E9\u30C3\u30D7\u3057\u3066\u304F\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002Oracle \u306B\u306F \`LIMIT\` \u30AD\u30FC\u30EF\u30FC\u30C9\u304C\u5B58\u5728\u3057\u306A\u3044\u305F\u3081\u3001\u30B3\u30CD\u30AF\u30BF\u306F \`query()\` \u5185\u3067\u3053\u306E\u30E9\u30C3\u30D1\u3092\u691C\u51FA\u3057\u3001\`<inner>\` \u3092\u305D\u306E\u307E\u307E\u5B9F\u884C\u3057\u3066 JS \u5074\u3067\u5148\u982D N \u884C\u306B\u5207\u308A\u8A70\u3081\u307E\u3059\u3002\u5229\u7528\u8005\u5074\u3067\u5BFE\u51E6\u3059\u308B\u5FC5\u8981\u306F\u3042\u308A\u307E\u305B\u3093\u304C\u3001\u81EA\u5206\u3067\u66F8\u304F SQL \u3067\u306F \`LIMIT\` \u3092\u4F7F\u308F\u305A \`FETCH FIRST N ROWS ONLY\` / \`OFFSET m ROWS FETCH NEXT N ROWS ONLY\` / \`ROWNUM\` \u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
114045
114557
|
},
|
|
114046
|
-
tools:
|
|
114558
|
+
tools: tools75,
|
|
114047
114559
|
async checkConnection(params, _config) {
|
|
114048
|
-
return checkOracleConnection(
|
|
114049
|
-
|
|
114050
|
-
|
|
114051
|
-
|
|
114560
|
+
return checkOracleConnection(
|
|
114561
|
+
params[parameters75.jdbcUrl.slug],
|
|
114562
|
+
{
|
|
114563
|
+
username: params[parameters75.username.slug],
|
|
114564
|
+
password: params[parameters75.password.slug]
|
|
114565
|
+
},
|
|
114566
|
+
{ tunnelParams: params }
|
|
114567
|
+
);
|
|
114052
114568
|
},
|
|
114053
114569
|
async query(params, sql, _namedParams) {
|
|
114054
|
-
const parsed = parseOracleJdbcUrl(params[
|
|
114055
|
-
username: params[
|
|
114056
|
-
password: params[
|
|
114570
|
+
const parsed = parseOracleJdbcUrl(params[parameters75.jdbcUrl.slug], {
|
|
114571
|
+
username: params[parameters75.username.slug],
|
|
114572
|
+
password: params[parameters75.password.slug]
|
|
114057
114573
|
});
|
|
114058
114574
|
const sample = unwrapSampleLimit(sql);
|
|
114059
114575
|
if (sample) {
|
|
114060
114576
|
const inner = sample.inner.replace(/;\s*$/, "");
|
|
114061
|
-
const result = await runOracleQuery(parsed, inner
|
|
114577
|
+
const result = await runOracleQuery(parsed, inner, {
|
|
114578
|
+
tunnelParams: params
|
|
114579
|
+
});
|
|
114062
114580
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
114063
114581
|
}
|
|
114064
114582
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
114065
|
-
return runOracleQuery(parsed, cleanSql);
|
|
114583
|
+
return runOracleQuery(parsed, cleanSql, { tunnelParams: params });
|
|
114066
114584
|
}
|
|
114067
114585
|
});
|
|
114068
114586
|
|
|
@@ -114083,7 +114601,7 @@ var freshserviceOnboarding = new ConnectorOnboarding({
|
|
|
114083
114601
|
});
|
|
114084
114602
|
|
|
114085
114603
|
// ../connectors/src/connectors/freshservice/parameters.ts
|
|
114086
|
-
var
|
|
114604
|
+
var parameters76 = {
|
|
114087
114605
|
domain: new ParameterDefinition({
|
|
114088
114606
|
slug: "domain",
|
|
114089
114607
|
name: "Freshservice Domain",
|
|
@@ -114105,7 +114623,7 @@ var parameters75 = {
|
|
|
114105
114623
|
};
|
|
114106
114624
|
|
|
114107
114625
|
// ../connectors/src/connectors/freshservice/tools/request.ts
|
|
114108
|
-
import { z as
|
|
114626
|
+
import { z as z93 } from "zod";
|
|
114109
114627
|
var BASE_PATH_SEGMENT12 = "/api/v2";
|
|
114110
114628
|
var REQUEST_TIMEOUT_MS70 = 6e4;
|
|
114111
114629
|
function buildBaseUrl(domain) {
|
|
@@ -114116,33 +114634,33 @@ function buildBaseUrl(domain) {
|
|
|
114116
114634
|
function basicAuthHeader(apiKey) {
|
|
114117
114635
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
114118
114636
|
}
|
|
114119
|
-
var
|
|
114120
|
-
toolUseIntent:
|
|
114637
|
+
var inputSchema93 = z93.object({
|
|
114638
|
+
toolUseIntent: z93.string().optional().describe(
|
|
114121
114639
|
"Brief description of what you intend to accomplish with this tool call"
|
|
114122
114640
|
),
|
|
114123
|
-
connectionId:
|
|
114124
|
-
method:
|
|
114641
|
+
connectionId: z93.string().describe("ID of the Freshservice connection to use"),
|
|
114642
|
+
method: z93.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
114125
114643
|
"HTTP method. GET for reading resources, POST for creating, PUT for updating, DELETE for removing."
|
|
114126
114644
|
),
|
|
114127
|
-
path:
|
|
114645
|
+
path: z93.string().describe(
|
|
114128
114646
|
"API path (e.g., '/tickets', '/tickets/123', '/agents'). Append query parameters such as '?per_page=100&page=1' for pagination."
|
|
114129
114647
|
),
|
|
114130
|
-
body:
|
|
114648
|
+
body: z93.record(z93.string(), z93.unknown()).optional().describe(
|
|
114131
114649
|
'Request body (JSON) for POST/PUT requests. Example: { "subject": "...", "description": "...", "email": "...", "priority": 2, "status": 2, "source": 2 }.'
|
|
114132
114650
|
)
|
|
114133
114651
|
});
|
|
114134
|
-
var
|
|
114135
|
-
|
|
114136
|
-
success:
|
|
114137
|
-
status:
|
|
114138
|
-
data:
|
|
114139
|
-
|
|
114140
|
-
|
|
114652
|
+
var outputSchema93 = z93.discriminatedUnion("success", [
|
|
114653
|
+
z93.object({
|
|
114654
|
+
success: z93.literal(true),
|
|
114655
|
+
status: z93.number(),
|
|
114656
|
+
data: z93.union([
|
|
114657
|
+
z93.record(z93.string(), z93.unknown()),
|
|
114658
|
+
z93.array(z93.unknown())
|
|
114141
114659
|
])
|
|
114142
114660
|
}),
|
|
114143
|
-
|
|
114144
|
-
success:
|
|
114145
|
-
error:
|
|
114661
|
+
z93.object({
|
|
114662
|
+
success: z93.literal(false),
|
|
114663
|
+
error: z93.string()
|
|
114146
114664
|
})
|
|
114147
114665
|
]);
|
|
114148
114666
|
var requestTool52 = new ConnectorTool({
|
|
@@ -114173,8 +114691,8 @@ Field codes:
|
|
|
114173
114691
|
- ticket priority: 1 Low, 2 Medium, 3 High, 4 Urgent
|
|
114174
114692
|
- ticket status: 2 Open, 3 Pending, 4 Resolved, 5 Closed
|
|
114175
114693
|
- ticket source: 1 Email, 2 Portal, 3 Phone, 4 Chat, 5 Feedback widget, 7 Yammer, 8 AwsCloudwatch, 9 Pagerduty, 10 Walkup, 11 Slack`,
|
|
114176
|
-
inputSchema:
|
|
114177
|
-
outputSchema:
|
|
114694
|
+
inputSchema: inputSchema93,
|
|
114695
|
+
outputSchema: outputSchema93,
|
|
114178
114696
|
async execute({ connectionId, method, path: path4, body }, connections) {
|
|
114179
114697
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114180
114698
|
if (!connection) {
|
|
@@ -114187,8 +114705,8 @@ Field codes:
|
|
|
114187
114705
|
`[connector-request] freshservice/${connection.name}: ${method} ${path4}`
|
|
114188
114706
|
);
|
|
114189
114707
|
try {
|
|
114190
|
-
const apiKey =
|
|
114191
|
-
const domain =
|
|
114708
|
+
const apiKey = parameters76.apiKey.getValue(connection);
|
|
114709
|
+
const domain = parameters76.domain.getValue(connection);
|
|
114192
114710
|
const baseUrl = buildBaseUrl(domain);
|
|
114193
114711
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT12);
|
|
114194
114712
|
const url = `${baseUrl}${normalizedPath}`;
|
|
@@ -114227,14 +114745,14 @@ Field codes:
|
|
|
114227
114745
|
});
|
|
114228
114746
|
|
|
114229
114747
|
// ../connectors/src/connectors/freshservice/index.ts
|
|
114230
|
-
var
|
|
114748
|
+
var tools76 = { request: requestTool52 };
|
|
114231
114749
|
var freshserviceConnector = new ConnectorPlugin({
|
|
114232
114750
|
slug: "freshservice",
|
|
114233
114751
|
authType: AUTH_TYPES.API_KEY,
|
|
114234
114752
|
name: "Freshservice",
|
|
114235
114753
|
description: "Connect to Freshservice (ITSM) for ticket, agent, asset, and ITIL workflow data via API key.",
|
|
114236
114754
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6Tj64HZOoIrGgQYDayBosY/3f45b29d3479726b5d245ac38d5a7036/freshservice-icon.svg",
|
|
114237
|
-
parameters:
|
|
114755
|
+
parameters: parameters76,
|
|
114238
114756
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114239
114757
|
categories: ["productivity"],
|
|
114240
114758
|
onboarding: freshserviceOnboarding,
|
|
@@ -114392,7 +114910,7 @@ export default async function handler(c: Context) {
|
|
|
114392
114910
|
- \`status\`: 2=Open, 3=Pending, 4=Resolved, 5=Closed
|
|
114393
114911
|
- \`source\`: 1=Email, 2=Portal, 3=Phone, 4=Chat, 5=Feedback widget, 7=Yammer, 8=AwsCloudwatch, 9=Pagerduty, 10=Walkup, 11=Slack`
|
|
114394
114912
|
},
|
|
114395
|
-
tools:
|
|
114913
|
+
tools: tools76
|
|
114396
114914
|
});
|
|
114397
114915
|
|
|
114398
114916
|
// ../connectors/src/connectors/freshdesk/setup.ts
|
|
@@ -114412,7 +114930,7 @@ var freshdeskOnboarding = new ConnectorOnboarding({
|
|
|
114412
114930
|
});
|
|
114413
114931
|
|
|
114414
114932
|
// ../connectors/src/connectors/freshdesk/parameters.ts
|
|
114415
|
-
var
|
|
114933
|
+
var parameters77 = {
|
|
114416
114934
|
domain: new ParameterDefinition({
|
|
114417
114935
|
slug: "domain",
|
|
114418
114936
|
name: "Freshdesk Domain",
|
|
@@ -114434,7 +114952,7 @@ var parameters76 = {
|
|
|
114434
114952
|
};
|
|
114435
114953
|
|
|
114436
114954
|
// ../connectors/src/connectors/freshdesk/tools/request.ts
|
|
114437
|
-
import { z as
|
|
114955
|
+
import { z as z94 } from "zod";
|
|
114438
114956
|
var BASE_PATH_SEGMENT13 = "/api/v2";
|
|
114439
114957
|
var REQUEST_TIMEOUT_MS71 = 6e4;
|
|
114440
114958
|
function buildBaseUrl2(domain) {
|
|
@@ -114445,33 +114963,33 @@ function buildBaseUrl2(domain) {
|
|
|
114445
114963
|
function basicAuthHeader2(apiKey) {
|
|
114446
114964
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
114447
114965
|
}
|
|
114448
|
-
var
|
|
114449
|
-
toolUseIntent:
|
|
114966
|
+
var inputSchema94 = z94.object({
|
|
114967
|
+
toolUseIntent: z94.string().optional().describe(
|
|
114450
114968
|
"Brief description of what you intend to accomplish with this tool call"
|
|
114451
114969
|
),
|
|
114452
|
-
connectionId:
|
|
114453
|
-
method:
|
|
114970
|
+
connectionId: z94.string().describe("ID of the Freshdesk connection to use"),
|
|
114971
|
+
method: z94.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
114454
114972
|
"HTTP method. GET for reading resources, POST for creating, PUT for updating, DELETE for removing."
|
|
114455
114973
|
),
|
|
114456
|
-
path:
|
|
114974
|
+
path: z94.string().describe(
|
|
114457
114975
|
"API path (e.g., '/tickets', '/tickets/123', '/contacts'). Append query parameters such as '?per_page=100&page=1&order_by=created_at&order_type=desc'."
|
|
114458
114976
|
),
|
|
114459
|
-
body:
|
|
114977
|
+
body: z94.record(z94.string(), z94.unknown()).optional().describe(
|
|
114460
114978
|
'Request body (JSON) for POST/PUT requests. Example creating a ticket: { "subject": "...", "description": "...", "email": "...", "priority": 2, "status": 2, "source": 1 }.'
|
|
114461
114979
|
)
|
|
114462
114980
|
});
|
|
114463
|
-
var
|
|
114464
|
-
|
|
114465
|
-
success:
|
|
114466
|
-
status:
|
|
114467
|
-
data:
|
|
114468
|
-
|
|
114469
|
-
|
|
114981
|
+
var outputSchema94 = z94.discriminatedUnion("success", [
|
|
114982
|
+
z94.object({
|
|
114983
|
+
success: z94.literal(true),
|
|
114984
|
+
status: z94.number(),
|
|
114985
|
+
data: z94.union([
|
|
114986
|
+
z94.record(z94.string(), z94.unknown()),
|
|
114987
|
+
z94.array(z94.unknown())
|
|
114470
114988
|
])
|
|
114471
114989
|
}),
|
|
114472
|
-
|
|
114473
|
-
success:
|
|
114474
|
-
error:
|
|
114990
|
+
z94.object({
|
|
114991
|
+
success: z94.literal(false),
|
|
114992
|
+
error: z94.string()
|
|
114475
114993
|
})
|
|
114476
114994
|
]);
|
|
114477
114995
|
var requestTool53 = new ConnectorTool({
|
|
@@ -114502,8 +115020,8 @@ Field codes (tickets):
|
|
|
114502
115020
|
- priority: 1 Low, 2 Medium, 3 High, 4 Urgent
|
|
114503
115021
|
- status: 2 Open, 3 Pending, 4 Resolved, 5 Closed
|
|
114504
115022
|
- source: 1 Email, 2 Portal, 3 Phone, 7 Chat, 9 Feedback widget, 10 Outbound email`,
|
|
114505
|
-
inputSchema:
|
|
114506
|
-
outputSchema:
|
|
115023
|
+
inputSchema: inputSchema94,
|
|
115024
|
+
outputSchema: outputSchema94,
|
|
114507
115025
|
async execute({ connectionId, method, path: path4, body }, connections) {
|
|
114508
115026
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114509
115027
|
if (!connection) {
|
|
@@ -114516,8 +115034,8 @@ Field codes (tickets):
|
|
|
114516
115034
|
`[connector-request] freshdesk/${connection.name}: ${method} ${path4}`
|
|
114517
115035
|
);
|
|
114518
115036
|
try {
|
|
114519
|
-
const apiKey =
|
|
114520
|
-
const domain =
|
|
115037
|
+
const apiKey = parameters77.apiKey.getValue(connection);
|
|
115038
|
+
const domain = parameters77.domain.getValue(connection);
|
|
114521
115039
|
const baseUrl = buildBaseUrl2(domain);
|
|
114522
115040
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT13);
|
|
114523
115041
|
const url = `${baseUrl}${normalizedPath}`;
|
|
@@ -114556,14 +115074,14 @@ Field codes (tickets):
|
|
|
114556
115074
|
});
|
|
114557
115075
|
|
|
114558
115076
|
// ../connectors/src/connectors/freshdesk/index.ts
|
|
114559
|
-
var
|
|
115077
|
+
var tools77 = { request: requestTool53 };
|
|
114560
115078
|
var freshdeskConnector = new ConnectorPlugin({
|
|
114561
115079
|
slug: "freshdesk",
|
|
114562
115080
|
authType: AUTH_TYPES.API_KEY,
|
|
114563
115081
|
name: "Freshdesk",
|
|
114564
115082
|
description: "Connect to Freshdesk for customer support ticket, contact, and company data via API key.",
|
|
114565
115083
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1PSjIfQJgTYmiWriNTx4uE/26905f4120713bda0afd0b23d02a154e/freshdesk-icon.png",
|
|
114566
|
-
parameters:
|
|
115084
|
+
parameters: parameters77,
|
|
114567
115085
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114568
115086
|
categories: ["crm"],
|
|
114569
115087
|
onboarding: freshdeskOnboarding,
|
|
@@ -114723,7 +115241,7 @@ export default async function handler(c: Context) {
|
|
|
114723
115241
|
- \`status\`: 2=Open, 3=Pending, 4=Resolved, 5=Closed
|
|
114724
115242
|
- \`source\`: 1=Email, 2=Portal, 3=Phone, 7=Chat, 9=Feedback widget, 10=Outbound email`
|
|
114725
115243
|
},
|
|
114726
|
-
tools:
|
|
115244
|
+
tools: tools77
|
|
114727
115245
|
});
|
|
114728
115246
|
|
|
114729
115247
|
// ../connectors/src/connectors/freshsales/setup.ts
|
|
@@ -114743,7 +115261,7 @@ var freshsalesOnboarding = new ConnectorOnboarding({
|
|
|
114743
115261
|
});
|
|
114744
115262
|
|
|
114745
115263
|
// ../connectors/src/connectors/freshsales/parameters.ts
|
|
114746
|
-
var
|
|
115264
|
+
var parameters78 = {
|
|
114747
115265
|
bundleAlias: new ParameterDefinition({
|
|
114748
115266
|
slug: "bundle-alias",
|
|
114749
115267
|
name: "Freshsales Bundle Alias",
|
|
@@ -114765,7 +115283,7 @@ var parameters77 = {
|
|
|
114765
115283
|
};
|
|
114766
115284
|
|
|
114767
115285
|
// ../connectors/src/connectors/freshsales/tools/request.ts
|
|
114768
|
-
import { z as
|
|
115286
|
+
import { z as z95 } from "zod";
|
|
114769
115287
|
var BASE_PATH_SEGMENT14 = "/crm/sales/api";
|
|
114770
115288
|
var REQUEST_TIMEOUT_MS72 = 6e4;
|
|
114771
115289
|
function buildBaseUrl3(bundleAlias) {
|
|
@@ -114773,33 +115291,33 @@ function buildBaseUrl3(bundleAlias) {
|
|
|
114773
115291
|
const subdomain = trimmed.split(".")[0];
|
|
114774
115292
|
return `https://${subdomain}.myfreshworks.com${BASE_PATH_SEGMENT14}`;
|
|
114775
115293
|
}
|
|
114776
|
-
var
|
|
114777
|
-
toolUseIntent:
|
|
115294
|
+
var inputSchema95 = z95.object({
|
|
115295
|
+
toolUseIntent: z95.string().optional().describe(
|
|
114778
115296
|
"Brief description of what you intend to accomplish with this tool call"
|
|
114779
115297
|
),
|
|
114780
|
-
connectionId:
|
|
114781
|
-
method:
|
|
115298
|
+
connectionId: z95.string().describe("ID of the Freshsales connection to use"),
|
|
115299
|
+
method: z95.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
114782
115300
|
"HTTP method. GET for reading resources (including /lookup), POST for creating, PUT for updating, DELETE for removing."
|
|
114783
115301
|
),
|
|
114784
|
-
path:
|
|
115302
|
+
path: z95.string().describe(
|
|
114785
115303
|
"API path (e.g., '/contacts', '/contacts/filters', '/contacts/view/{view_id}', '/deals/{id}', '/lookup'). Append query parameters such as '?page=1&per_page=100'."
|
|
114786
115304
|
),
|
|
114787
|
-
body:
|
|
115305
|
+
body: z95.record(z95.string(), z95.unknown()).optional().describe(
|
|
114788
115306
|
'Request body (JSON). For creating a contact: { "contact": { "first_name": "...", "last_name": "...", "email": "..." } }. For lookup: { "q": "john@example.com", "f": "email", "entities": "contact" }.'
|
|
114789
115307
|
)
|
|
114790
115308
|
});
|
|
114791
|
-
var
|
|
114792
|
-
|
|
114793
|
-
success:
|
|
114794
|
-
status:
|
|
114795
|
-
data:
|
|
114796
|
-
|
|
114797
|
-
|
|
115309
|
+
var outputSchema95 = z95.discriminatedUnion("success", [
|
|
115310
|
+
z95.object({
|
|
115311
|
+
success: z95.literal(true),
|
|
115312
|
+
status: z95.number(),
|
|
115313
|
+
data: z95.union([
|
|
115314
|
+
z95.record(z95.string(), z95.unknown()),
|
|
115315
|
+
z95.array(z95.unknown())
|
|
114798
115316
|
])
|
|
114799
115317
|
}),
|
|
114800
|
-
|
|
114801
|
-
success:
|
|
114802
|
-
error:
|
|
115318
|
+
z95.object({
|
|
115319
|
+
success: z95.literal(false),
|
|
115320
|
+
error: z95.string()
|
|
114803
115321
|
})
|
|
114804
115322
|
]);
|
|
114805
115323
|
var requestTool54 = new ConnectorTool({
|
|
@@ -114832,8 +115350,8 @@ Common endpoints:
|
|
|
114832
115350
|
Pagination: 1-indexed \`page\` + \`per_page\` (default 25, max 100). View endpoints return \`{ contacts/sales_accounts/deals: [...], meta: { total_pages, total } }\`.
|
|
114833
115351
|
|
|
114834
115352
|
Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\`owner\`, \`creator\`, \`deals\`, \`contacts\`, etc.) to inline related records.`,
|
|
114835
|
-
inputSchema:
|
|
114836
|
-
outputSchema:
|
|
115353
|
+
inputSchema: inputSchema95,
|
|
115354
|
+
outputSchema: outputSchema95,
|
|
114837
115355
|
async execute({ connectionId, method, path: path4, body }, connections) {
|
|
114838
115356
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114839
115357
|
if (!connection) {
|
|
@@ -114846,8 +115364,8 @@ Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\
|
|
|
114846
115364
|
`[connector-request] freshsales/${connection.name}: ${method} ${path4}`
|
|
114847
115365
|
);
|
|
114848
115366
|
try {
|
|
114849
|
-
const apiKey =
|
|
114850
|
-
const bundle =
|
|
115367
|
+
const apiKey = parameters78.apiKey.getValue(connection);
|
|
115368
|
+
const bundle = parameters78.bundleAlias.getValue(connection);
|
|
114851
115369
|
const baseUrl = buildBaseUrl3(bundle);
|
|
114852
115370
|
const normalizedPath = normalizeRequestPath(path4, BASE_PATH_SEGMENT14);
|
|
114853
115371
|
const url = `${baseUrl}${normalizedPath}`;
|
|
@@ -114885,14 +115403,14 @@ Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\
|
|
|
114885
115403
|
});
|
|
114886
115404
|
|
|
114887
115405
|
// ../connectors/src/connectors/freshsales/index.ts
|
|
114888
|
-
var
|
|
115406
|
+
var tools78 = { request: requestTool54 };
|
|
114889
115407
|
var freshsalesConnector = new ConnectorPlugin({
|
|
114890
115408
|
slug: "freshsales",
|
|
114891
115409
|
authType: AUTH_TYPES.API_KEY,
|
|
114892
115410
|
name: "Freshsales",
|
|
114893
115411
|
description: "Connect to Freshsales / Freshworks CRM for contact, account, and deal data via API key.",
|
|
114894
115412
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4UDOrFPM6wOFekbMVljjgl/4acc6060c3a1ff703980e6f4e76a3cd4/629b6c6f7c5cd817694c321f.png",
|
|
114895
|
-
parameters:
|
|
115413
|
+
parameters: parameters78,
|
|
114896
115414
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114897
115415
|
categories: ["crm"],
|
|
114898
115416
|
onboarding: freshsalesOnboarding,
|
|
@@ -115064,7 +115582,7 @@ export default async function handler(c: Context) {
|
|
|
115064
115582
|
- GET \`/selector/lifecycle_stages\` \u2014 \u30E9\u30A4\u30D5\u30B5\u30A4\u30AF\u30EB\u30B9\u30C6\u30FC\u30B8
|
|
115065
115583
|
- GET \`/selector/territories\` / \`/selector/business_types\` / \`/selector/industry_types\` / \`/selector/contact_statuses\` / \`/selector/sales_activity_types\``
|
|
115066
115584
|
},
|
|
115067
|
-
tools:
|
|
115585
|
+
tools: tools78
|
|
115068
115586
|
});
|
|
115069
115587
|
|
|
115070
115588
|
// ../connectors/src/connectors/github/setup.ts
|
|
@@ -115090,7 +115608,7 @@ var githubOnboarding = new ConnectorOnboarding({
|
|
|
115090
115608
|
});
|
|
115091
115609
|
|
|
115092
115610
|
// ../connectors/src/connectors/github/parameters.ts
|
|
115093
|
-
var
|
|
115611
|
+
var parameters79 = {
|
|
115094
115612
|
personalAccessToken: new ParameterDefinition({
|
|
115095
115613
|
slug: "personal-access-token",
|
|
115096
115614
|
name: "GitHub Personal Access Token",
|
|
@@ -115113,42 +115631,42 @@ var parameters78 = {
|
|
|
115113
115631
|
var DEFAULT_BASE_URL = "https://api.github.com";
|
|
115114
115632
|
|
|
115115
115633
|
// ../connectors/src/connectors/github/tools/request.ts
|
|
115116
|
-
import { z as
|
|
115634
|
+
import { z as z96 } from "zod";
|
|
115117
115635
|
var REQUEST_TIMEOUT_MS73 = 6e4;
|
|
115118
115636
|
function resolveBaseUrl(connectionBaseUrl) {
|
|
115119
115637
|
const trimmed = connectionBaseUrl?.trim();
|
|
115120
115638
|
return trimmed && trimmed.replace(/\/+$/, "") || DEFAULT_BASE_URL;
|
|
115121
115639
|
}
|
|
115122
|
-
var
|
|
115123
|
-
toolUseIntent:
|
|
115640
|
+
var inputSchema96 = z96.object({
|
|
115641
|
+
toolUseIntent: z96.string().optional().describe(
|
|
115124
115642
|
"Brief description of what you intend to accomplish with this tool call"
|
|
115125
115643
|
),
|
|
115126
|
-
connectionId:
|
|
115127
|
-
method:
|
|
115644
|
+
connectionId: z96.string().describe("ID of the GitHub connection to use"),
|
|
115645
|
+
method: z96.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe(
|
|
115128
115646
|
"HTTP method. GET for reading, POST for creating, PATCH for partial updates, PUT for replacement (e.g. starring), DELETE for removal."
|
|
115129
115647
|
),
|
|
115130
|
-
path:
|
|
115648
|
+
path: z96.string().describe(
|
|
115131
115649
|
"API path (e.g., '/user', '/repos/{owner}/{repo}/issues', '/search/repositories?q=topic:react'). Append query parameters such as '?state=open&per_page=100&page=1'."
|
|
115132
115650
|
),
|
|
115133
|
-
body:
|
|
115134
|
-
|
|
115135
|
-
|
|
115651
|
+
body: z96.union([
|
|
115652
|
+
z96.record(z96.string(), z96.unknown()),
|
|
115653
|
+
z96.array(z96.unknown())
|
|
115136
115654
|
]).optional().describe(
|
|
115137
115655
|
'Request body (JSON). Example creating an issue: { "title": "...", "body": "...", "labels": ["bug"] }.'
|
|
115138
115656
|
)
|
|
115139
115657
|
});
|
|
115140
|
-
var
|
|
115141
|
-
|
|
115142
|
-
success:
|
|
115143
|
-
status:
|
|
115144
|
-
data:
|
|
115145
|
-
|
|
115146
|
-
|
|
115658
|
+
var outputSchema96 = z96.discriminatedUnion("success", [
|
|
115659
|
+
z96.object({
|
|
115660
|
+
success: z96.literal(true),
|
|
115661
|
+
status: z96.number(),
|
|
115662
|
+
data: z96.union([
|
|
115663
|
+
z96.record(z96.string(), z96.unknown()),
|
|
115664
|
+
z96.array(z96.unknown())
|
|
115147
115665
|
])
|
|
115148
115666
|
}),
|
|
115149
|
-
|
|
115150
|
-
success:
|
|
115151
|
-
error:
|
|
115667
|
+
z96.object({
|
|
115668
|
+
success: z96.literal(false),
|
|
115669
|
+
error: z96.string()
|
|
115152
115670
|
})
|
|
115153
115671
|
]);
|
|
115154
115672
|
var requestTool55 = new ConnectorTool({
|
|
@@ -115186,8 +115704,8 @@ Common endpoints:
|
|
|
115186
115704
|
Pagination: 1-indexed \`page\` + \`per_page\` (max 100). The \`Link\` response header exposes \`rel="next"\`/\`rel="last"\` URLs.
|
|
115187
115705
|
|
|
115188
115706
|
Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`X-RateLimit-Remaining\` to throttle.`,
|
|
115189
|
-
inputSchema:
|
|
115190
|
-
outputSchema:
|
|
115707
|
+
inputSchema: inputSchema96,
|
|
115708
|
+
outputSchema: outputSchema96,
|
|
115191
115709
|
async execute({ connectionId, method, path: path4, body }, connections) {
|
|
115192
115710
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
115193
115711
|
if (!connection) {
|
|
@@ -115200,8 +115718,8 @@ Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`
|
|
|
115200
115718
|
`[connector-request] github/${connection.name}: ${method} ${path4}`
|
|
115201
115719
|
);
|
|
115202
115720
|
try {
|
|
115203
|
-
const token =
|
|
115204
|
-
const baseUrl = resolveBaseUrl(
|
|
115721
|
+
const token = parameters79.personalAccessToken.getValue(connection);
|
|
115722
|
+
const baseUrl = resolveBaseUrl(parameters79.baseUrl.tryGetValue(connection));
|
|
115205
115723
|
const trimmedPath = path4.trim().replace(/^\/+/, "/");
|
|
115206
115724
|
const url = `${baseUrl}${trimmedPath.startsWith("/") ? "" : "/"}${trimmedPath}`;
|
|
115207
115725
|
const controller = new AbortController();
|
|
@@ -115241,14 +115759,14 @@ Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`
|
|
|
115241
115759
|
});
|
|
115242
115760
|
|
|
115243
115761
|
// ../connectors/src/connectors/github/index.ts
|
|
115244
|
-
var
|
|
115762
|
+
var tools79 = { request: requestTool55 };
|
|
115245
115763
|
var githubConnector = new ConnectorPlugin({
|
|
115246
115764
|
slug: "github",
|
|
115247
115765
|
authType: AUTH_TYPES.PAT,
|
|
115248
115766
|
name: "GitHub",
|
|
115249
115767
|
description: "Connect to GitHub for repository, issue, pull request, commit, and search data via Personal Access Token (Classic or fine-grained).",
|
|
115250
115768
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2flOAufkhDrLKuOQqEVS3/1f9dcf145680ef77aef149709263e2d4/github-icon.svg",
|
|
115251
|
-
parameters:
|
|
115769
|
+
parameters: parameters79,
|
|
115252
115770
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
115253
115771
|
categories: ["productivity"],
|
|
115254
115772
|
onboarding: githubOnboarding,
|
|
@@ -115468,7 +115986,7 @@ export default async function handler(c: Context) {
|
|
|
115468
115986
|
**\u30AF\u30A9\u30FC\u30BF**
|
|
115469
115987
|
- GET \`/rate_limit\` \u2014 REST / GraphQL / search \u306E\u6B8B\u30EC\u30FC\u30C8\u78BA\u8A8D`
|
|
115470
115988
|
},
|
|
115471
|
-
tools:
|
|
115989
|
+
tools: tools79
|
|
115472
115990
|
});
|
|
115473
115991
|
|
|
115474
115992
|
// ../connectors/src/connectors/registry.ts
|
|
@@ -115546,6 +116064,7 @@ var plugins = {
|
|
|
115546
116064
|
clickup: clickupConnector,
|
|
115547
116065
|
sqlserver: sqlserverConnector,
|
|
115548
116066
|
azureSql: azureSqlConnector,
|
|
116067
|
+
cosmosdb: cosmosdbConnector,
|
|
115549
116068
|
oracle: oracleConnector,
|
|
115550
116069
|
freshservice: freshserviceConnector,
|
|
115551
116070
|
freshdesk: freshdeskConnector,
|
|
@@ -115761,62 +116280,62 @@ function resolveParams2(entry, connectionId, plugin) {
|
|
|
115761
116280
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
115762
116281
|
|
|
115763
116282
|
// src/types/server-logic.ts
|
|
115764
|
-
import { z as
|
|
115765
|
-
var parameterMetaSchema =
|
|
115766
|
-
name:
|
|
115767
|
-
type:
|
|
115768
|
-
description:
|
|
115769
|
-
required:
|
|
115770
|
-
default:
|
|
115771
|
-
});
|
|
115772
|
-
var serverLogicCacheConfigSchema =
|
|
115773
|
-
ttl:
|
|
115774
|
-
staleWhileRevalidate:
|
|
115775
|
-
});
|
|
115776
|
-
var serverLogicSchemaObjectSchema =
|
|
115777
|
-
() =>
|
|
115778
|
-
type:
|
|
115779
|
-
format:
|
|
115780
|
-
description:
|
|
115781
|
-
nullable:
|
|
115782
|
-
enum:
|
|
116283
|
+
import { z as z97 } from "zod";
|
|
116284
|
+
var parameterMetaSchema = z97.object({
|
|
116285
|
+
name: z97.string(),
|
|
116286
|
+
type: z97.enum(["string", "number", "boolean"]),
|
|
116287
|
+
description: z97.string(),
|
|
116288
|
+
required: z97.boolean().optional(),
|
|
116289
|
+
default: z97.union([z97.string(), z97.number(), z97.boolean()]).optional()
|
|
116290
|
+
});
|
|
116291
|
+
var serverLogicCacheConfigSchema = z97.object({
|
|
116292
|
+
ttl: z97.number(),
|
|
116293
|
+
staleWhileRevalidate: z97.boolean().optional()
|
|
116294
|
+
});
|
|
116295
|
+
var serverLogicSchemaObjectSchema = z97.lazy(
|
|
116296
|
+
() => z97.object({
|
|
116297
|
+
type: z97.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
116298
|
+
format: z97.string().optional(),
|
|
116299
|
+
description: z97.string().optional(),
|
|
116300
|
+
nullable: z97.boolean().optional(),
|
|
116301
|
+
enum: z97.array(z97.union([z97.string(), z97.number(), z97.boolean(), z97.null()])).optional(),
|
|
115783
116302
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
115784
|
-
properties:
|
|
115785
|
-
required:
|
|
115786
|
-
additionalProperties:
|
|
115787
|
-
minimum:
|
|
115788
|
-
maximum:
|
|
115789
|
-
minLength:
|
|
115790
|
-
maxLength:
|
|
115791
|
-
pattern:
|
|
116303
|
+
properties: z97.record(z97.string(), serverLogicSchemaObjectSchema).optional(),
|
|
116304
|
+
required: z97.array(z97.string()).optional(),
|
|
116305
|
+
additionalProperties: z97.union([z97.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
116306
|
+
minimum: z97.number().optional(),
|
|
116307
|
+
maximum: z97.number().optional(),
|
|
116308
|
+
minLength: z97.number().optional(),
|
|
116309
|
+
maxLength: z97.number().optional(),
|
|
116310
|
+
pattern: z97.string().optional()
|
|
115792
116311
|
})
|
|
115793
116312
|
);
|
|
115794
|
-
var serverLogicMediaTypeSchema =
|
|
116313
|
+
var serverLogicMediaTypeSchema = z97.object({
|
|
115795
116314
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
115796
|
-
example:
|
|
116315
|
+
example: z97.unknown().optional()
|
|
115797
116316
|
});
|
|
115798
|
-
var serverLogicResponseSchema =
|
|
115799
|
-
description:
|
|
115800
|
-
content:
|
|
116317
|
+
var serverLogicResponseSchema = z97.object({
|
|
116318
|
+
description: z97.string().optional(),
|
|
116319
|
+
content: z97.record(z97.string(), serverLogicMediaTypeSchema).optional()
|
|
115801
116320
|
});
|
|
115802
116321
|
var jsonBaseFields = {
|
|
115803
|
-
description:
|
|
115804
|
-
parameters:
|
|
116322
|
+
description: z97.string(),
|
|
116323
|
+
parameters: z97.array(parameterMetaSchema).optional(),
|
|
115805
116324
|
response: serverLogicResponseSchema.optional(),
|
|
115806
116325
|
cache: serverLogicCacheConfigSchema.optional()
|
|
115807
116326
|
};
|
|
115808
|
-
var jsonSqlServerLogicSchema =
|
|
116327
|
+
var jsonSqlServerLogicSchema = z97.object({
|
|
115809
116328
|
...jsonBaseFields,
|
|
115810
|
-
type:
|
|
115811
|
-
query:
|
|
115812
|
-
connectionId:
|
|
116329
|
+
type: z97.literal("sql").optional(),
|
|
116330
|
+
query: z97.string(),
|
|
116331
|
+
connectionId: z97.string()
|
|
115813
116332
|
});
|
|
115814
|
-
var jsonTypeScriptServerLogicSchema =
|
|
116333
|
+
var jsonTypeScriptServerLogicSchema = z97.object({
|
|
115815
116334
|
...jsonBaseFields,
|
|
115816
|
-
type:
|
|
115817
|
-
handlerPath:
|
|
116335
|
+
type: z97.literal("typescript"),
|
|
116336
|
+
handlerPath: z97.string()
|
|
115818
116337
|
});
|
|
115819
|
-
var anyJsonServerLogicSchema =
|
|
116338
|
+
var anyJsonServerLogicSchema = z97.union([
|
|
115820
116339
|
jsonTypeScriptServerLogicSchema,
|
|
115821
116340
|
jsonSqlServerLogicSchema
|
|
115822
116341
|
]);
|