@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/cli/index.js
CHANGED
|
@@ -910,17 +910,17 @@ var require_nacl_fast = __commonJS({
|
|
|
910
910
|
}
|
|
911
911
|
var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
|
|
912
912
|
function crypto_stream_salsa20_xor(c6, cpos, m4, mpos, b6, n2, k6) {
|
|
913
|
-
var
|
|
913
|
+
var z98 = new Uint8Array(16), x = new Uint8Array(64);
|
|
914
914
|
var u, i6;
|
|
915
|
-
for (i6 = 0; i6 < 16; i6++)
|
|
916
|
-
for (i6 = 0; i6 < 8; i6++)
|
|
915
|
+
for (i6 = 0; i6 < 16; i6++) z98[i6] = 0;
|
|
916
|
+
for (i6 = 0; i6 < 8; i6++) z98[i6] = n2[i6];
|
|
917
917
|
while (b6 >= 64) {
|
|
918
|
-
crypto_core_salsa20(x,
|
|
918
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
919
919
|
for (i6 = 0; i6 < 64; i6++) c6[cpos + i6] = m4[mpos + i6] ^ x[i6];
|
|
920
920
|
u = 1;
|
|
921
921
|
for (i6 = 8; i6 < 16; i6++) {
|
|
922
|
-
u = u + (
|
|
923
|
-
|
|
922
|
+
u = u + (z98[i6] & 255) | 0;
|
|
923
|
+
z98[i6] = u & 255;
|
|
924
924
|
u >>>= 8;
|
|
925
925
|
}
|
|
926
926
|
b6 -= 64;
|
|
@@ -928,30 +928,30 @@ var require_nacl_fast = __commonJS({
|
|
|
928
928
|
mpos += 64;
|
|
929
929
|
}
|
|
930
930
|
if (b6 > 0) {
|
|
931
|
-
crypto_core_salsa20(x,
|
|
931
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
932
932
|
for (i6 = 0; i6 < b6; i6++) c6[cpos + i6] = m4[mpos + i6] ^ x[i6];
|
|
933
933
|
}
|
|
934
934
|
return 0;
|
|
935
935
|
}
|
|
936
936
|
function crypto_stream_salsa20(c6, cpos, b6, n2, k6) {
|
|
937
|
-
var
|
|
937
|
+
var z98 = new Uint8Array(16), x = new Uint8Array(64);
|
|
938
938
|
var u, i6;
|
|
939
|
-
for (i6 = 0; i6 < 16; i6++)
|
|
940
|
-
for (i6 = 0; i6 < 8; i6++)
|
|
939
|
+
for (i6 = 0; i6 < 16; i6++) z98[i6] = 0;
|
|
940
|
+
for (i6 = 0; i6 < 8; i6++) z98[i6] = n2[i6];
|
|
941
941
|
while (b6 >= 64) {
|
|
942
|
-
crypto_core_salsa20(x,
|
|
942
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
943
943
|
for (i6 = 0; i6 < 64; i6++) c6[cpos + i6] = x[i6];
|
|
944
944
|
u = 1;
|
|
945
945
|
for (i6 = 8; i6 < 16; i6++) {
|
|
946
|
-
u = u + (
|
|
947
|
-
|
|
946
|
+
u = u + (z98[i6] & 255) | 0;
|
|
947
|
+
z98[i6] = u & 255;
|
|
948
948
|
u >>>= 8;
|
|
949
949
|
}
|
|
950
950
|
b6 -= 64;
|
|
951
951
|
cpos += 64;
|
|
952
952
|
}
|
|
953
953
|
if (b6 > 0) {
|
|
954
|
-
crypto_core_salsa20(x,
|
|
954
|
+
crypto_core_salsa20(x, z98, k6, sigma);
|
|
955
955
|
for (i6 = 0; i6 < b6; i6++) c6[cpos + i6] = x[i6];
|
|
956
956
|
}
|
|
957
957
|
return 0;
|
|
@@ -1831,12 +1831,12 @@ var require_nacl_fast = __commonJS({
|
|
|
1831
1831
|
for (a6 = 0; a6 < 16; a6++) o2[a6] = c6[a6];
|
|
1832
1832
|
}
|
|
1833
1833
|
function crypto_scalarmult(q2, n2, p2) {
|
|
1834
|
-
var
|
|
1834
|
+
var z98 = new Uint8Array(32);
|
|
1835
1835
|
var x = new Float64Array(80), r6, i6;
|
|
1836
1836
|
var a6 = gf(), b6 = gf(), c6 = gf(), d6 = gf(), e6 = gf(), f6 = gf();
|
|
1837
|
-
for (i6 = 0; i6 < 31; i6++)
|
|
1838
|
-
|
|
1839
|
-
|
|
1837
|
+
for (i6 = 0; i6 < 31; i6++) z98[i6] = n2[i6];
|
|
1838
|
+
z98[31] = n2[31] & 127 | 64;
|
|
1839
|
+
z98[0] &= 248;
|
|
1840
1840
|
unpack25519(x, p2);
|
|
1841
1841
|
for (i6 = 0; i6 < 16; i6++) {
|
|
1842
1842
|
b6[i6] = x[i6];
|
|
@@ -1844,7 +1844,7 @@ var require_nacl_fast = __commonJS({
|
|
|
1844
1844
|
}
|
|
1845
1845
|
a6[0] = d6[0] = 1;
|
|
1846
1846
|
for (i6 = 254; i6 >= 0; --i6) {
|
|
1847
|
-
r6 =
|
|
1847
|
+
r6 = z98[i6 >>> 3] >>> (i6 & 7) & 1;
|
|
1848
1848
|
sel25519(a6, b6, r6);
|
|
1849
1849
|
sel25519(c6, d6, r6);
|
|
1850
1850
|
A(e6, a6, c6);
|
|
@@ -4861,8 +4861,8 @@ var require_poly1305 = __commonJS({
|
|
|
4861
4861
|
});
|
|
4862
4862
|
var u = {}, w;
|
|
4863
4863
|
for (w in b6) b6.hasOwnProperty(w) && (u[w] = b6[w]);
|
|
4864
|
-
var x = "object" === typeof window, y = "function" === typeof importScripts,
|
|
4865
|
-
if (
|
|
4864
|
+
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;
|
|
4865
|
+
if (z98) B = y ? __require("path").dirname(B) + "/" : __dirname + "/", C = function(a6, c6) {
|
|
4866
4866
|
var d6 = H(a6);
|
|
4867
4867
|
if (d6) return c6 ? d6 : d6.toString();
|
|
4868
4868
|
F || (F = __require("fs"));
|
|
@@ -5118,7 +5118,7 @@ var require_poly1305 = __commonJS({
|
|
|
5118
5118
|
function H(a6) {
|
|
5119
5119
|
if (a6.startsWith(V)) {
|
|
5120
5120
|
a6 = a6.slice(V.length);
|
|
5121
|
-
if ("boolean" === typeof
|
|
5121
|
+
if ("boolean" === typeof z98 && z98) {
|
|
5122
5122
|
var c6 = Buffer.from(a6, "base64");
|
|
5123
5123
|
c6 = new Uint8Array(c6.buffer, c6.byteOffset, c6.byteLength);
|
|
5124
5124
|
} else try {
|
|
@@ -39041,14 +39041,14 @@ var init_NormalizedSchema = __esm({
|
|
|
39041
39041
|
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
|
39042
39042
|
}
|
|
39043
39043
|
const struct = this.getSchema();
|
|
39044
|
-
const
|
|
39044
|
+
const z98 = struct[4].length;
|
|
39045
39045
|
let it = struct[anno.it];
|
|
39046
|
-
if (it &&
|
|
39046
|
+
if (it && z98 === it.length) {
|
|
39047
39047
|
yield* it;
|
|
39048
39048
|
return;
|
|
39049
39049
|
}
|
|
39050
|
-
it = Array(
|
|
39051
|
-
for (let i6 = 0; i6 <
|
|
39050
|
+
it = Array(z98);
|
|
39051
|
+
for (let i6 = 0; i6 < z98; ++i6) {
|
|
39052
39052
|
const k6 = struct[4][i6];
|
|
39053
39053
|
const v = member([struct[5][i6], 0], k6);
|
|
39054
39054
|
yield it[i6] = [k6, v];
|
|
@@ -39729,12 +39729,12 @@ var init_split_header = __esm({
|
|
|
39729
39729
|
"../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"() {
|
|
39730
39730
|
"use strict";
|
|
39731
39731
|
splitHeader = (value) => {
|
|
39732
|
-
const
|
|
39732
|
+
const z98 = value.length;
|
|
39733
39733
|
const values = [];
|
|
39734
39734
|
let withinQuotes = false;
|
|
39735
39735
|
let prevChar = void 0;
|
|
39736
39736
|
let anchor = 0;
|
|
39737
|
-
for (let i6 = 0; i6 <
|
|
39737
|
+
for (let i6 = 0; i6 < z98; ++i6) {
|
|
39738
39738
|
const char = value[i6];
|
|
39739
39739
|
switch (char) {
|
|
39740
39740
|
case `"`:
|
|
@@ -39755,12 +39755,12 @@ var init_split_header = __esm({
|
|
|
39755
39755
|
values.push(value.slice(anchor));
|
|
39756
39756
|
return values.map((v) => {
|
|
39757
39757
|
v = v.trim();
|
|
39758
|
-
const
|
|
39759
|
-
if (
|
|
39758
|
+
const z99 = v.length;
|
|
39759
|
+
if (z99 < 2) {
|
|
39760
39760
|
return v;
|
|
39761
39761
|
}
|
|
39762
|
-
if (v[0] === `"` && v[
|
|
39763
|
-
v = v.slice(1,
|
|
39762
|
+
if (v[0] === `"` && v[z99 - 1] === `"`) {
|
|
39763
|
+
v = v.slice(1, z99 - 1);
|
|
39764
39764
|
}
|
|
39765
39765
|
return v.replace(/\\"/g, '"');
|
|
39766
39766
|
});
|
|
@@ -41197,11 +41197,11 @@ var init_EndpointCache = __esm({
|
|
|
41197
41197
|
}
|
|
41198
41198
|
hash(endpointParams) {
|
|
41199
41199
|
let buffer = "";
|
|
41200
|
-
const { parameters:
|
|
41201
|
-
if (
|
|
41200
|
+
const { parameters: parameters80 } = this;
|
|
41201
|
+
if (parameters80.length === 0) {
|
|
41202
41202
|
return false;
|
|
41203
41203
|
}
|
|
41204
|
-
for (const param of
|
|
41204
|
+
for (const param of parameters80) {
|
|
41205
41205
|
const val = String(endpointParams[param] ?? "");
|
|
41206
41206
|
if (val.includes("|;")) {
|
|
41207
41207
|
return false;
|
|
@@ -47673,8 +47673,8 @@ var init_ProtocolLib = __esm({
|
|
|
47673
47673
|
constructor(queryCompat = false) {
|
|
47674
47674
|
this.queryCompat = queryCompat;
|
|
47675
47675
|
}
|
|
47676
|
-
resolveRestContentType(defaultContentType,
|
|
47677
|
-
const members =
|
|
47676
|
+
resolveRestContentType(defaultContentType, inputSchema97) {
|
|
47677
|
+
const members = inputSchema97.getMemberSchemas();
|
|
47678
47678
|
const httpPayloadMember = Object.values(members).find((m4) => {
|
|
47679
47679
|
return !!m4.getMergedTraits().httpPayload;
|
|
47680
47680
|
});
|
|
@@ -47689,7 +47689,7 @@ var init_ProtocolLib = __esm({
|
|
|
47689
47689
|
} else {
|
|
47690
47690
|
return defaultContentType;
|
|
47691
47691
|
}
|
|
47692
|
-
} else if (!
|
|
47692
|
+
} else if (!inputSchema97.isUnitSchema()) {
|
|
47693
47693
|
const hasBody = Object.values(members).find((m4) => {
|
|
47694
47694
|
const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m4.getMergedTraits();
|
|
47695
47695
|
const noPrefixHeaders = httpPrefixHeaders === void 0;
|
|
@@ -48542,9 +48542,9 @@ var init_AwsRestJsonProtocol = __esm({
|
|
|
48542
48542
|
}
|
|
48543
48543
|
async serializeRequest(operationSchema, input, context) {
|
|
48544
48544
|
const request2 = await super.serializeRequest(operationSchema, input, context);
|
|
48545
|
-
const
|
|
48545
|
+
const inputSchema97 = NormalizedSchema.of(operationSchema.input);
|
|
48546
48546
|
if (!request2.headers["content-type"]) {
|
|
48547
|
-
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(),
|
|
48547
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema97);
|
|
48548
48548
|
if (contentType) {
|
|
48549
48549
|
request2.headers["content-type"] = contentType;
|
|
48550
48550
|
}
|
|
@@ -48556,8 +48556,8 @@ var init_AwsRestJsonProtocol = __esm({
|
|
|
48556
48556
|
}
|
|
48557
48557
|
async deserializeResponse(operationSchema, context, response) {
|
|
48558
48558
|
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
48559
|
-
const
|
|
48560
|
-
for (const [name, member2] of
|
|
48559
|
+
const outputSchema97 = NormalizedSchema.of(operationSchema.output);
|
|
48560
|
+
for (const [name, member2] of outputSchema97.structIterator()) {
|
|
48561
48561
|
if (member2.getMemberTraits().httpPayload && !(name in output)) {
|
|
48562
48562
|
output[name] = null;
|
|
48563
48563
|
}
|
|
@@ -54375,22 +54375,22 @@ var init_loadCognitoIdentity = __esm({
|
|
|
54375
54375
|
});
|
|
54376
54376
|
|
|
54377
54377
|
// ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
|
|
54378
|
-
function fromCognitoIdentity(
|
|
54378
|
+
function fromCognitoIdentity(parameters80) {
|
|
54379
54379
|
return async (awsIdentityProperties) => {
|
|
54380
|
-
|
|
54380
|
+
parameters80.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
|
|
54381
54381
|
const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
54382
|
-
const fromConfigs = (property) =>
|
|
54383
|
-
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(
|
|
54382
|
+
const fromConfigs = (property) => parameters80.clientConfig?.[property] ?? parameters80.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
|
|
54383
|
+
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters80.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters80.logger), SessionToken } = throwOnMissingCredentials(parameters80.logger) } = await (parameters80.client ?? new CognitoIdentityClient2(Object.assign({}, parameters80.clientConfig ?? {}, {
|
|
54384
54384
|
region: fromConfigs("region"),
|
|
54385
54385
|
profile: fromConfigs("profile"),
|
|
54386
54386
|
userAgentAppId: fromConfigs("userAgentAppId")
|
|
54387
54387
|
}))).send(new GetCredentialsForIdentityCommand2({
|
|
54388
|
-
CustomRoleArn:
|
|
54389
|
-
IdentityId:
|
|
54390
|
-
Logins:
|
|
54388
|
+
CustomRoleArn: parameters80.customRoleArn,
|
|
54389
|
+
IdentityId: parameters80.identityId,
|
|
54390
|
+
Logins: parameters80.logins ? await resolveLogins(parameters80.logins) : void 0
|
|
54391
54391
|
}));
|
|
54392
54392
|
return {
|
|
54393
|
-
identityId:
|
|
54393
|
+
identityId: parameters80.identityId,
|
|
54394
54394
|
accessKeyId: AccessKeyId,
|
|
54395
54395
|
secretAccessKey: SecretKey,
|
|
54396
54396
|
sessionToken: SessionToken,
|
|
@@ -62169,7 +62169,7 @@ __export(lib_exports, {
|
|
|
62169
62169
|
FetchError: () => FetchError,
|
|
62170
62170
|
Headers: () => Headers2,
|
|
62171
62171
|
Request: () => Request2,
|
|
62172
|
-
Response: () =>
|
|
62172
|
+
Response: () => Response2,
|
|
62173
62173
|
default: () => lib_default
|
|
62174
62174
|
});
|
|
62175
62175
|
import Stream from "stream";
|
|
@@ -62695,7 +62695,7 @@ function fetch2(url, opts) {
|
|
|
62695
62695
|
};
|
|
62696
62696
|
const codings = headers.get("Content-Encoding");
|
|
62697
62697
|
if (!request2.compress || request2.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
62698
|
-
response = new
|
|
62698
|
+
response = new Response2(body, response_options);
|
|
62699
62699
|
resolve(response);
|
|
62700
62700
|
return;
|
|
62701
62701
|
}
|
|
@@ -62705,7 +62705,7 @@ function fetch2(url, opts) {
|
|
|
62705
62705
|
};
|
|
62706
62706
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
62707
62707
|
body = body.pipe(zlib.createGunzip(zlibOptions));
|
|
62708
|
-
response = new
|
|
62708
|
+
response = new Response2(body, response_options);
|
|
62709
62709
|
resolve(response);
|
|
62710
62710
|
return;
|
|
62711
62711
|
}
|
|
@@ -62717,12 +62717,12 @@ function fetch2(url, opts) {
|
|
|
62717
62717
|
} else {
|
|
62718
62718
|
body = body.pipe(zlib.createInflateRaw());
|
|
62719
62719
|
}
|
|
62720
|
-
response = new
|
|
62720
|
+
response = new Response2(body, response_options);
|
|
62721
62721
|
resolve(response);
|
|
62722
62722
|
});
|
|
62723
62723
|
raw.on("end", function() {
|
|
62724
62724
|
if (!response) {
|
|
62725
|
-
response = new
|
|
62725
|
+
response = new Response2(body, response_options);
|
|
62726
62726
|
resolve(response);
|
|
62727
62727
|
}
|
|
62728
62728
|
});
|
|
@@ -62730,11 +62730,11 @@ function fetch2(url, opts) {
|
|
|
62730
62730
|
}
|
|
62731
62731
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
62732
62732
|
body = body.pipe(zlib.createBrotliDecompress());
|
|
62733
|
-
response = new
|
|
62733
|
+
response = new Response2(body, response_options);
|
|
62734
62734
|
resolve(response);
|
|
62735
62735
|
return;
|
|
62736
62736
|
}
|
|
62737
|
-
response = new
|
|
62737
|
+
response = new Response2(body, response_options);
|
|
62738
62738
|
resolve(response);
|
|
62739
62739
|
});
|
|
62740
62740
|
writeToStream(req, request2);
|
|
@@ -62767,7 +62767,7 @@ function destroyStream(stream, err) {
|
|
|
62767
62767
|
stream.end();
|
|
62768
62768
|
}
|
|
62769
62769
|
}
|
|
62770
|
-
var import_whatwg_url, Readable6, BUFFER, TYPE, Blob2, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers2, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES,
|
|
62770
|
+
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;
|
|
62771
62771
|
var init_lib2 = __esm({
|
|
62772
62772
|
"../../node_modules/node-fetch/lib/index.mjs"() {
|
|
62773
62773
|
"use strict";
|
|
@@ -63210,7 +63210,7 @@ var init_lib2 = __esm({
|
|
|
63210
63210
|
});
|
|
63211
63211
|
INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
63212
63212
|
STATUS_CODES = http.STATUS_CODES;
|
|
63213
|
-
|
|
63213
|
+
Response2 = class _Response {
|
|
63214
63214
|
constructor() {
|
|
63215
63215
|
let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
63216
63216
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -63268,8 +63268,8 @@ var init_lib2 = __esm({
|
|
|
63268
63268
|
});
|
|
63269
63269
|
}
|
|
63270
63270
|
};
|
|
63271
|
-
Body.mixIn(
|
|
63272
|
-
Object.defineProperties(
|
|
63271
|
+
Body.mixIn(Response2.prototype);
|
|
63272
|
+
Object.defineProperties(Response2.prototype, {
|
|
63273
63273
|
url: { enumerable: true },
|
|
63274
63274
|
status: { enumerable: true },
|
|
63275
63275
|
ok: { enumerable: true },
|
|
@@ -63278,7 +63278,7 @@ var init_lib2 = __esm({
|
|
|
63278
63278
|
headers: { enumerable: true },
|
|
63279
63279
|
clone: { enumerable: true }
|
|
63280
63280
|
});
|
|
63281
|
-
Object.defineProperty(
|
|
63281
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
63282
63282
|
value: "Response",
|
|
63283
63283
|
writable: false,
|
|
63284
63284
|
enumerable: false,
|
|
@@ -67147,11 +67147,11 @@ var require_bignumber = __commonJS({
|
|
|
67147
67147
|
return n2 > 0 || n2 === i6 ? i6 : i6 - 1;
|
|
67148
67148
|
}
|
|
67149
67149
|
function coeffToString(a6) {
|
|
67150
|
-
var s,
|
|
67150
|
+
var s, z98, i6 = 1, j6 = a6.length, r6 = a6[0] + "";
|
|
67151
67151
|
for (; i6 < j6; ) {
|
|
67152
67152
|
s = a6[i6++] + "";
|
|
67153
|
-
|
|
67154
|
-
for (;
|
|
67153
|
+
z98 = LOG_BASE - s.length;
|
|
67154
|
+
for (; z98--; s = "0" + s) ;
|
|
67155
67155
|
r6 += s;
|
|
67156
67156
|
}
|
|
67157
67157
|
for (j6 = r6.length; r6.charCodeAt(--j6) === 48; ) ;
|
|
@@ -67184,15 +67184,15 @@ var require_bignumber = __commonJS({
|
|
|
67184
67184
|
function toExponential(str, e6) {
|
|
67185
67185
|
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e6 < 0 ? "e" : "e+") + e6;
|
|
67186
67186
|
}
|
|
67187
|
-
function toFixedPoint(str, e6,
|
|
67187
|
+
function toFixedPoint(str, e6, z98) {
|
|
67188
67188
|
var len, zs;
|
|
67189
67189
|
if (e6 < 0) {
|
|
67190
|
-
for (zs =
|
|
67190
|
+
for (zs = z98 + "."; ++e6; zs += z98) ;
|
|
67191
67191
|
str = zs + str;
|
|
67192
67192
|
} else {
|
|
67193
67193
|
len = str.length;
|
|
67194
67194
|
if (++e6 > len) {
|
|
67195
|
-
for (zs =
|
|
67195
|
+
for (zs = z98, e6 -= len; --e6; zs += z98) ;
|
|
67196
67196
|
str += zs;
|
|
67197
67197
|
} else if (e6 < len) {
|
|
67198
67198
|
str = str.slice(0, e6) + "." + str.slice(e6);
|
|
@@ -89708,6 +89708,12 @@ var NOOP_TUNNEL = (connectionUrl) => ({
|
|
|
89708
89708
|
close: async () => {
|
|
89709
89709
|
}
|
|
89710
89710
|
});
|
|
89711
|
+
var NOOP_TUNNEL_HOSTPORT = (host, port) => ({
|
|
89712
|
+
host,
|
|
89713
|
+
port,
|
|
89714
|
+
close: async () => {
|
|
89715
|
+
}
|
|
89716
|
+
});
|
|
89711
89717
|
function connectionParamsToRecord(connection) {
|
|
89712
89718
|
const out = {};
|
|
89713
89719
|
for (const p2 of connection.parameters) {
|
|
@@ -89715,9 +89721,9 @@ function connectionParamsToRecord(connection) {
|
|
|
89715
89721
|
}
|
|
89716
89722
|
return out;
|
|
89717
89723
|
}
|
|
89718
|
-
async function
|
|
89724
|
+
async function maybeOpenSshTunnelHostPort(params, dbHost, dbPort) {
|
|
89719
89725
|
const sshHost = params[sshTunnelParameters.sshHost.slug];
|
|
89720
|
-
if (!sshHost) return
|
|
89726
|
+
if (!sshHost) return NOOP_TUNNEL_HOSTPORT(dbHost, dbPort);
|
|
89721
89727
|
const sshUsername = params[sshTunnelParameters.sshUsername.slug];
|
|
89722
89728
|
const sshPrivateKeyBase64 = params[sshTunnelParameters.sshPrivateKeyBase64.slug];
|
|
89723
89729
|
if (!sshUsername || !sshPrivateKeyBase64) {
|
|
@@ -89727,9 +89733,6 @@ async function maybeOpenSshTunnel(params, connectionUrl, defaultDbPort) {
|
|
|
89727
89733
|
}
|
|
89728
89734
|
const sshPort = Number(params[sshTunnelParameters.sshPort.slug] || "22") || 22;
|
|
89729
89735
|
const sshPassphrase = params[sshTunnelParameters.sshPassphrase.slug];
|
|
89730
|
-
const url = new URL(connectionUrl);
|
|
89731
|
-
const dbHost = url.hostname;
|
|
89732
|
-
const dbPort = url.port ? Number(url.port) : defaultDbPort;
|
|
89733
89736
|
const [{ Client: Client2 }, net] = await Promise.all([
|
|
89734
89737
|
Promise.resolve().then(() => __toESM(require_lib3(), 1)),
|
|
89735
89738
|
import("net")
|
|
@@ -89772,16 +89775,29 @@ async function maybeOpenSshTunnel(params, connectionUrl, defaultDbPort) {
|
|
|
89772
89775
|
sshClient.end();
|
|
89773
89776
|
throw new Error("Failed to allocate local port for SSH tunnel.");
|
|
89774
89777
|
}
|
|
89775
|
-
url.hostname = "127.0.0.1";
|
|
89776
|
-
url.port = String(address.port);
|
|
89777
89778
|
return {
|
|
89778
|
-
|
|
89779
|
+
host: "127.0.0.1",
|
|
89780
|
+
port: address.port,
|
|
89779
89781
|
close: async () => {
|
|
89780
89782
|
await new Promise((resolve) => server.close(() => resolve()));
|
|
89781
89783
|
sshClient.end();
|
|
89782
89784
|
}
|
|
89783
89785
|
};
|
|
89784
89786
|
}
|
|
89787
|
+
async function maybeOpenSshTunnel(params, connectionUrl, defaultDbPort) {
|
|
89788
|
+
const sshHost = params[sshTunnelParameters.sshHost.slug];
|
|
89789
|
+
if (!sshHost) return NOOP_TUNNEL(connectionUrl);
|
|
89790
|
+
const url = new URL(connectionUrl);
|
|
89791
|
+
const dbHost = url.hostname;
|
|
89792
|
+
const dbPort = url.port ? Number(url.port) : defaultDbPort;
|
|
89793
|
+
const tunnel = await maybeOpenSshTunnelHostPort(params, dbHost, dbPort);
|
|
89794
|
+
url.hostname = tunnel.host;
|
|
89795
|
+
url.port = String(tunnel.port);
|
|
89796
|
+
return {
|
|
89797
|
+
connectionUrl: url.toString(),
|
|
89798
|
+
close: tunnel.close
|
|
89799
|
+
};
|
|
89800
|
+
}
|
|
89785
89801
|
|
|
89786
89802
|
// ../connectors/src/connectors/postgresql/setup.ts
|
|
89787
89803
|
var postgresqlOnboarding = new ConnectorOnboarding({
|
|
@@ -91923,9 +91939,16 @@ A Filter is an Expression. Leaves are \`Dimensions\`, \`Tags\`, or \`CostCategor
|
|
|
91923
91939
|
|
|
91924
91940
|
### Business Logic
|
|
91925
91941
|
|
|
91926
|
-
The business logic type for this connector is "typescript". The connector exposes resolved AWS credentials via \`connection(connectionId)
|
|
91942
|
+
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.
|
|
91927
91943
|
|
|
91928
|
-
####
|
|
91944
|
+
#### Server logic slug naming
|
|
91945
|
+
|
|
91946
|
+
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.
|
|
91947
|
+
|
|
91948
|
+
- OK: \`monthly-cost-trend\`, \`cost_by_service\`, \`top10-services\`
|
|
91949
|
+
- NG: \`monthlyCostTrend\`, \`MonthlyCostTrend\`, \`monthly cost trend\`
|
|
91950
|
+
|
|
91951
|
+
#### Example (slug: \`monthly-cost-trend\`)
|
|
91929
91952
|
|
|
91930
91953
|
\`\`\`ts
|
|
91931
91954
|
import type { Context } from "hono";
|
|
@@ -92001,9 +92024,16 @@ Filter \u306F Expression \u3067\u3059\u3002\u30EA\u30FC\u30D5\u306F \`Dimensions
|
|
|
92001
92024
|
|
|
92002
92025
|
### Business Logic
|
|
92003
92026
|
|
|
92004
|
-
\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
|
|
92027
|
+
\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
|
|
92005
92028
|
|
|
92006
|
-
####
|
|
92029
|
+
#### \u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E slug \u547D\u540D\u898F\u5247
|
|
92030
|
+
|
|
92031
|
+
\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
|
|
92032
|
+
|
|
92033
|
+
- OK: \`monthly-cost-trend\`\u3001\`cost_by_service\`\u3001\`top10-services\`
|
|
92034
|
+
- NG: \`monthlyCostTrend\`\u3001\`MonthlyCostTrend\`\u3001\`monthly cost trend\`
|
|
92035
|
+
|
|
92036
|
+
#### Example\uFF08slug: \`monthly-cost-trend\`\uFF09
|
|
92007
92037
|
|
|
92008
92038
|
\`\`\`ts
|
|
92009
92039
|
import type { Context } from "hono";
|
|
@@ -92910,33 +92940,41 @@ export default async function handler(c: Context) {
|
|
|
92910
92940
|
tools: tools11
|
|
92911
92941
|
});
|
|
92912
92942
|
|
|
92913
|
-
// ../connectors/src/connectors/google-ads/
|
|
92914
|
-
|
|
92915
|
-
|
|
92916
|
-
|
|
92917
|
-
|
|
92918
|
-
customerId: new ParameterDefinition({
|
|
92919
|
-
slug: "customer-id",
|
|
92920
|
-
name: "Google Ads Customer ID",
|
|
92921
|
-
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.",
|
|
92922
|
-
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
92923
|
-
type: "text",
|
|
92924
|
-
secret: false,
|
|
92925
|
-
required: false
|
|
92926
|
-
}),
|
|
92927
|
-
developerToken: new ParameterDefinition({
|
|
92928
|
-
slug: "developer-token",
|
|
92929
|
-
name: "Google Ads Developer Token",
|
|
92930
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
92931
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
92932
|
-
type: "text",
|
|
92933
|
-
secret: true,
|
|
92934
|
-
required: true
|
|
92935
|
-
})
|
|
92943
|
+
// ../connectors/src/connectors/google-ads/constants.ts
|
|
92944
|
+
var VERSION_FALLBACK_ORDER = ["v22", "v23", "v24"];
|
|
92945
|
+
var cachedWorkingVersion = VERSION_FALLBACK_ORDER[0];
|
|
92946
|
+
var looksSunset = (contentType) => {
|
|
92947
|
+
return contentType != null && contentType.toLowerCase().includes("text/html");
|
|
92936
92948
|
};
|
|
92949
|
+
async function fetchGoogleAdsWithVersionFallback(attempt) {
|
|
92950
|
+
const order = [
|
|
92951
|
+
cachedWorkingVersion,
|
|
92952
|
+
...VERSION_FALLBACK_ORDER.filter((v) => v !== cachedWorkingVersion)
|
|
92953
|
+
];
|
|
92954
|
+
let lastResponse = null;
|
|
92955
|
+
for (let i6 = 0; i6 < order.length; i6++) {
|
|
92956
|
+
const version2 = order[i6];
|
|
92957
|
+
const baseUrl = `https://googleads.googleapis.com/${version2}/`;
|
|
92958
|
+
const response = await attempt(baseUrl);
|
|
92959
|
+
const contentType = response.headers.get("content-type");
|
|
92960
|
+
if (looksSunset(contentType) && i6 < order.length - 1) {
|
|
92961
|
+
console.warn(
|
|
92962
|
+
`[google-ads] version ${version2} returned a sunset/HTML response (status ${response.status}); retrying with newer version`
|
|
92963
|
+
);
|
|
92964
|
+
lastResponse = response;
|
|
92965
|
+
continue;
|
|
92966
|
+
}
|
|
92967
|
+
cachedWorkingVersion = version2;
|
|
92968
|
+
return response;
|
|
92969
|
+
}
|
|
92970
|
+
return lastResponse ?? new Response(null, {
|
|
92971
|
+
status: 502,
|
|
92972
|
+
statusText: "All Google Ads API versions returned sunset responses"
|
|
92973
|
+
});
|
|
92974
|
+
}
|
|
92937
92975
|
|
|
92938
92976
|
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92939
|
-
|
|
92977
|
+
import { z as z18 } from "zod";
|
|
92940
92978
|
var REQUEST_TIMEOUT_MS8 = 6e4;
|
|
92941
92979
|
var cachedToken4 = null;
|
|
92942
92980
|
async function getProxyToken4(config) {
|
|
@@ -93007,27 +93045,25 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93007
93045
|
`[connector-request] google-ads/${connection.name}: listCustomers`
|
|
93008
93046
|
);
|
|
93009
93047
|
try {
|
|
93010
|
-
const developerToken = parameters12.developerToken.getValue(connection);
|
|
93011
93048
|
const token = await getProxyToken4(config.oauthProxy);
|
|
93012
93049
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
93013
93050
|
const controller = new AbortController();
|
|
93014
93051
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS8);
|
|
93015
93052
|
try {
|
|
93016
|
-
const response = await
|
|
93017
|
-
|
|
93018
|
-
|
|
93019
|
-
"Content-Type": "application/json",
|
|
93020
|
-
Authorization: `Bearer ${token}`
|
|
93021
|
-
},
|
|
93022
|
-
body: JSON.stringify({
|
|
93023
|
-
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
93024
|
-
method: "GET",
|
|
93053
|
+
const response = await fetchGoogleAdsWithVersionFallback(
|
|
93054
|
+
(baseUrl) => fetch(proxyUrl, {
|
|
93055
|
+
method: "POST",
|
|
93025
93056
|
headers: {
|
|
93026
|
-
"
|
|
93027
|
-
|
|
93028
|
-
|
|
93029
|
-
|
|
93030
|
-
|
|
93057
|
+
"Content-Type": "application/json",
|
|
93058
|
+
Authorization: `Bearer ${token}`
|
|
93059
|
+
},
|
|
93060
|
+
body: JSON.stringify({
|
|
93061
|
+
url: `${baseUrl}customers:listAccessibleCustomers`,
|
|
93062
|
+
method: "GET"
|
|
93063
|
+
}),
|
|
93064
|
+
signal: controller.signal
|
|
93065
|
+
})
|
|
93066
|
+
);
|
|
93031
93067
|
const data = await response.json();
|
|
93032
93068
|
if (!response.ok) {
|
|
93033
93069
|
const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
|
|
@@ -93039,26 +93075,27 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93039
93075
|
const customers = [];
|
|
93040
93076
|
for (const cid of customerIds) {
|
|
93041
93077
|
try {
|
|
93042
|
-
const detailResponse = await
|
|
93043
|
-
|
|
93044
|
-
headers: {
|
|
93045
|
-
"Content-Type": "application/json",
|
|
93046
|
-
Authorization: `Bearer ${token}`
|
|
93047
|
-
},
|
|
93048
|
-
body: JSON.stringify({
|
|
93049
|
-
url: `${BASE_URL2}customers/${cid}/googleAds:searchStream`,
|
|
93078
|
+
const detailResponse = await fetchGoogleAdsWithVersionFallback(
|
|
93079
|
+
(baseUrl) => fetch(proxyUrl, {
|
|
93050
93080
|
method: "POST",
|
|
93051
93081
|
headers: {
|
|
93052
93082
|
"Content-Type": "application/json",
|
|
93053
|
-
|
|
93054
|
-
"login-customer-id": cid
|
|
93083
|
+
Authorization: `Bearer ${token}`
|
|
93055
93084
|
},
|
|
93056
93085
|
body: JSON.stringify({
|
|
93057
|
-
|
|
93058
|
-
|
|
93059
|
-
|
|
93060
|
-
|
|
93061
|
-
|
|
93086
|
+
url: `${baseUrl}customers/${cid}/googleAds:searchStream`,
|
|
93087
|
+
method: "POST",
|
|
93088
|
+
headers: {
|
|
93089
|
+
"Content-Type": "application/json",
|
|
93090
|
+
"login-customer-id": cid
|
|
93091
|
+
},
|
|
93092
|
+
body: JSON.stringify({
|
|
93093
|
+
query: "SELECT customer.id, customer.descriptive_name FROM customer LIMIT 1"
|
|
93094
|
+
})
|
|
93095
|
+
}),
|
|
93096
|
+
signal: controller.signal
|
|
93097
|
+
})
|
|
93098
|
+
);
|
|
93062
93099
|
if (detailResponse.ok) {
|
|
93063
93100
|
const detailData = await detailResponse.json();
|
|
93064
93101
|
const customer = detailData?.[0]?.results?.[0]?.customer;
|
|
@@ -93096,30 +93133,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93096
93133
|
connectionSetupInstructions: {
|
|
93097
93134
|
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
|
|
93098
93135
|
|
|
93099
|
-
1. \
|
|
93136
|
+
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
|
|
93100
93137
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93101
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93102
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
93103
|
-
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
|
|
93104
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93105
93138
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93106
93139
|
- \`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
|
|
93107
|
-
|
|
93140
|
+
- \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
|
|
93141
|
+
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
|
|
93108
93142
|
|
|
93109
93143
|
#### \u5236\u7D04
|
|
93110
93144
|
- **\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
|
|
93111
93145
|
- \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`,
|
|
93112
93146
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
93113
93147
|
|
|
93114
|
-
1.
|
|
93148
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93115
93149
|
2. Call \`updateConnectionParameters\`:
|
|
93116
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93117
|
-
- \`value\`: The Developer Token provided by the user
|
|
93118
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93119
|
-
4. Call \`updateConnectionParameters\`:
|
|
93120
93150
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93121
93151
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
93122
|
-
|
|
93152
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
93153
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
93123
93154
|
|
|
93124
93155
|
#### Constraints
|
|
93125
93156
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -93133,9 +93164,21 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93133
93164
|
}
|
|
93134
93165
|
});
|
|
93135
93166
|
|
|
93167
|
+
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
93168
|
+
var parameters12 = {
|
|
93169
|
+
customerId: new ParameterDefinition({
|
|
93170
|
+
slug: "customer-id",
|
|
93171
|
+
name: "Google Ads Customer ID",
|
|
93172
|
+
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.",
|
|
93173
|
+
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
93174
|
+
type: "text",
|
|
93175
|
+
secret: false,
|
|
93176
|
+
required: false
|
|
93177
|
+
})
|
|
93178
|
+
};
|
|
93179
|
+
|
|
93136
93180
|
// ../connectors/src/connectors/google-ads/tools/request.ts
|
|
93137
93181
|
import { z as z19 } from "zod";
|
|
93138
|
-
var BASE_URL3 = "https://googleads.googleapis.com/v18/";
|
|
93139
93182
|
var REQUEST_TIMEOUT_MS9 = 6e4;
|
|
93140
93183
|
var cachedToken5 = null;
|
|
93141
93184
|
async function getProxyToken5(config) {
|
|
@@ -93175,7 +93218,7 @@ var inputSchema19 = z19.object({
|
|
|
93175
93218
|
connectionId: z19.string().describe("ID of the Google Ads OAuth connection to use"),
|
|
93176
93219
|
method: z19.enum(["GET", "POST"]).describe("HTTP method"),
|
|
93177
93220
|
path: z19.string().describe(
|
|
93178
|
-
"API path appended to https://googleads.googleapis.com
|
|
93221
|
+
"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."
|
|
93179
93222
|
),
|
|
93180
93223
|
body: z19.record(z19.string(), z19.unknown()).optional().describe("POST request body (JSON)")
|
|
93181
93224
|
});
|
|
@@ -93192,7 +93235,7 @@ var outputSchema19 = z19.discriminatedUnion("success", [
|
|
|
93192
93235
|
]);
|
|
93193
93236
|
var requestTool2 = new ConnectorTool({
|
|
93194
93237
|
name: "request",
|
|
93195
|
-
description: `Send authenticated requests to the Google Ads API
|
|
93238
|
+
description: `Send authenticated requests to the Google Ads API.
|
|
93196
93239
|
Authentication is handled automatically via OAuth proxy.
|
|
93197
93240
|
{customerId} in the path is automatically replaced with the connection's customer ID (hyphens removed).`,
|
|
93198
93241
|
inputSchema: inputSchema19,
|
|
@@ -93212,31 +93255,30 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93212
93255
|
const rawCustomerId = parameters12.customerId.tryGetValue(connection);
|
|
93213
93256
|
const customerId = rawCustomerId?.replace(/-/g, "") ?? "";
|
|
93214
93257
|
const resolvedPath = customerId ? path5.replace(/\{customerId\}/g, customerId) : path5;
|
|
93215
|
-
const url = `${BASE_URL3}${resolvedPath}`;
|
|
93216
93258
|
const token = await getProxyToken5(config.oauthProxy);
|
|
93217
93259
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
93218
93260
|
const controller = new AbortController();
|
|
93219
93261
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS9);
|
|
93220
93262
|
try {
|
|
93221
|
-
const
|
|
93222
|
-
|
|
93223
|
-
|
|
93224
|
-
headers: {
|
|
93225
|
-
"Content-Type": "application/json",
|
|
93226
|
-
Authorization: `Bearer ${token}`
|
|
93227
|
-
},
|
|
93228
|
-
body: JSON.stringify({
|
|
93229
|
-
url,
|
|
93230
|
-
method,
|
|
93263
|
+
const response = await fetchGoogleAdsWithVersionFallback(
|
|
93264
|
+
(baseUrl) => fetch(proxyUrl, {
|
|
93265
|
+
method: "POST",
|
|
93231
93266
|
headers: {
|
|
93232
93267
|
"Content-Type": "application/json",
|
|
93233
|
-
|
|
93234
|
-
...customerId ? { "login-customer-id": customerId } : {}
|
|
93268
|
+
Authorization: `Bearer ${token}`
|
|
93235
93269
|
},
|
|
93236
|
-
|
|
93237
|
-
|
|
93238
|
-
|
|
93239
|
-
|
|
93270
|
+
body: JSON.stringify({
|
|
93271
|
+
url: `${baseUrl}${resolvedPath}`,
|
|
93272
|
+
method,
|
|
93273
|
+
headers: {
|
|
93274
|
+
"Content-Type": "application/json",
|
|
93275
|
+
...customerId ? { "login-customer-id": customerId } : {}
|
|
93276
|
+
},
|
|
93277
|
+
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
93278
|
+
}),
|
|
93279
|
+
signal: controller.signal
|
|
93280
|
+
})
|
|
93281
|
+
);
|
|
93240
93282
|
const data = await response.json();
|
|
93241
93283
|
if (!response.ok) {
|
|
93242
93284
|
const dataObj = data;
|
|
@@ -93411,26 +93453,22 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
93411
93453
|
if (!customerId) {
|
|
93412
93454
|
return { success: true };
|
|
93413
93455
|
}
|
|
93414
|
-
const developerToken = params[parameters12.developerToken.slug];
|
|
93415
|
-
if (!developerToken) {
|
|
93416
|
-
return {
|
|
93417
|
-
success: false,
|
|
93418
|
-
error: "Developer token is required"
|
|
93419
|
-
};
|
|
93420
|
-
}
|
|
93421
|
-
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
93422
93456
|
try {
|
|
93423
|
-
const res = await
|
|
93424
|
-
|
|
93425
|
-
|
|
93426
|
-
|
|
93427
|
-
|
|
93428
|
-
|
|
93429
|
-
|
|
93430
|
-
|
|
93431
|
-
|
|
93432
|
-
|
|
93433
|
-
|
|
93457
|
+
const res = await fetchGoogleAdsWithVersionFallback(
|
|
93458
|
+
(baseUrl) => proxyFetch(
|
|
93459
|
+
`${baseUrl}customers/${customerId}/googleAds:searchStream`,
|
|
93460
|
+
{
|
|
93461
|
+
method: "POST",
|
|
93462
|
+
headers: {
|
|
93463
|
+
"Content-Type": "application/json",
|
|
93464
|
+
"login-customer-id": customerId
|
|
93465
|
+
},
|
|
93466
|
+
body: JSON.stringify({
|
|
93467
|
+
query: "SELECT customer.id FROM customer LIMIT 1"
|
|
93468
|
+
})
|
|
93469
|
+
}
|
|
93470
|
+
)
|
|
93471
|
+
);
|
|
93434
93472
|
if (!res.ok) {
|
|
93435
93473
|
const errorText = await res.text().catch(() => res.statusText);
|
|
93436
93474
|
return {
|
|
@@ -93482,7 +93520,7 @@ var parameters13 = {
|
|
|
93482
93520
|
|
|
93483
93521
|
// ../connectors/src/connectors/google-analytics/tools/request.ts
|
|
93484
93522
|
import { z as z20 } from "zod";
|
|
93485
|
-
var
|
|
93523
|
+
var BASE_URL2 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
93486
93524
|
var REQUEST_TIMEOUT_MS10 = 6e4;
|
|
93487
93525
|
var inputSchema20 = z20.object({
|
|
93488
93526
|
toolUseIntent: z20.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
|
|
@@ -93531,7 +93569,7 @@ Authentication is handled automatically using a service account.
|
|
|
93531
93569
|
return { success: false, error: "Failed to obtain access token" };
|
|
93532
93570
|
}
|
|
93533
93571
|
const resolvedPath = path5.replace(/\{propertyId\}/g, propertyId);
|
|
93534
|
-
const url = `${
|
|
93572
|
+
const url = `${BASE_URL2}${resolvedPath}`;
|
|
93535
93573
|
const controller = new AbortController();
|
|
93536
93574
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS10);
|
|
93537
93575
|
try {
|
|
@@ -94011,7 +94049,7 @@ var parameters14 = {
|
|
|
94011
94049
|
|
|
94012
94050
|
// ../connectors/src/connectors/google-analytics-oauth/tools/request.ts
|
|
94013
94051
|
import { z as z23 } from "zod";
|
|
94014
|
-
var
|
|
94052
|
+
var BASE_URL3 = "https://analyticsdata.googleapis.com/v1beta/";
|
|
94015
94053
|
var REQUEST_TIMEOUT_MS13 = 6e4;
|
|
94016
94054
|
var cachedToken8 = null;
|
|
94017
94055
|
async function getProxyToken8(config) {
|
|
@@ -94087,7 +94125,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
94087
94125
|
try {
|
|
94088
94126
|
const propertyId = parameters14.propertyId.tryGetValue(connection);
|
|
94089
94127
|
const resolvedPath = propertyId ? path5.replace(/\{propertyId\}/g, propertyId) : path5;
|
|
94090
|
-
const url = `${
|
|
94128
|
+
const url = `${BASE_URL3}${resolvedPath}`;
|
|
94091
94129
|
const token = await getProxyToken8(config.oauthProxy);
|
|
94092
94130
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
94093
94131
|
const controller = new AbortController();
|
|
@@ -94355,7 +94393,7 @@ var parameters15 = {
|
|
|
94355
94393
|
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
94356
94394
|
var BASE_HOST = "https://www.googleapis.com";
|
|
94357
94395
|
var BASE_PATH_SEGMENT = "/calendar/v3";
|
|
94358
|
-
var
|
|
94396
|
+
var BASE_URL4 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
|
|
94359
94397
|
var REQUEST_TIMEOUT_MS14 = 6e4;
|
|
94360
94398
|
function decodeServiceAccount(keyJsonBase64) {
|
|
94361
94399
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -94435,7 +94473,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
94435
94473
|
};
|
|
94436
94474
|
}
|
|
94437
94475
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT);
|
|
94438
|
-
let url = `${
|
|
94476
|
+
let url = `${BASE_URL4}${normalizedPath}`;
|
|
94439
94477
|
if (queryParams) {
|
|
94440
94478
|
const searchParams = new URLSearchParams(queryParams);
|
|
94441
94479
|
url += `?${searchParams.toString()}`;
|
|
@@ -94487,7 +94525,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
94487
94525
|
import { z as z25 } from "zod";
|
|
94488
94526
|
var BASE_HOST2 = "https://www.googleapis.com";
|
|
94489
94527
|
var BASE_PATH_SEGMENT2 = "/calendar/v3";
|
|
94490
|
-
var
|
|
94528
|
+
var BASE_URL5 = `${BASE_HOST2}${BASE_PATH_SEGMENT2}`;
|
|
94491
94529
|
var REQUEST_TIMEOUT_MS15 = 6e4;
|
|
94492
94530
|
function decodeServiceAccount2(keyJsonBase64) {
|
|
94493
94531
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -94573,7 +94611,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
94573
94611
|
};
|
|
94574
94612
|
}
|
|
94575
94613
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT2);
|
|
94576
|
-
let url = `${
|
|
94614
|
+
let url = `${BASE_URL5}${normalizedPath}`;
|
|
94577
94615
|
if (queryParams) {
|
|
94578
94616
|
const searchParams = new URLSearchParams(queryParams);
|
|
94579
94617
|
url += `?${searchParams.toString()}`;
|
|
@@ -95053,7 +95091,7 @@ export default async function handler(c: Context) {
|
|
|
95053
95091
|
|
|
95054
95092
|
// ../connectors/src/connectors/google-calendar-oauth/tools/list-calendars.ts
|
|
95055
95093
|
import { z as z26 } from "zod";
|
|
95056
|
-
var
|
|
95094
|
+
var BASE_URL6 = "https://www.googleapis.com/calendar/v3";
|
|
95057
95095
|
var REQUEST_TIMEOUT_MS16 = 6e4;
|
|
95058
95096
|
var cachedToken9 = null;
|
|
95059
95097
|
async function getProxyToken9(config) {
|
|
@@ -95126,7 +95164,7 @@ var listCalendarsTool = new ConnectorTool({
|
|
|
95126
95164
|
`[connector-request] google-calendar-oauth/${connection.name}: listCalendars`
|
|
95127
95165
|
);
|
|
95128
95166
|
try {
|
|
95129
|
-
const url = `${
|
|
95167
|
+
const url = `${BASE_URL6}/users/me/calendarList`;
|
|
95130
95168
|
const token = await getProxyToken9(config.oauthProxy);
|
|
95131
95169
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
95132
95170
|
const controller = new AbortController();
|
|
@@ -95223,7 +95261,7 @@ var parameters16 = {
|
|
|
95223
95261
|
import { z as z27 } from "zod";
|
|
95224
95262
|
var BASE_HOST3 = "https://www.googleapis.com";
|
|
95225
95263
|
var BASE_PATH_SEGMENT3 = "/calendar/v3";
|
|
95226
|
-
var
|
|
95264
|
+
var BASE_URL7 = `${BASE_HOST3}${BASE_PATH_SEGMENT3}`;
|
|
95227
95265
|
var REQUEST_TIMEOUT_MS17 = 6e4;
|
|
95228
95266
|
var cachedToken10 = null;
|
|
95229
95267
|
async function getProxyToken10(config) {
|
|
@@ -95304,7 +95342,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
95304
95342
|
resolvedPath,
|
|
95305
95343
|
BASE_PATH_SEGMENT3
|
|
95306
95344
|
);
|
|
95307
|
-
let url = `${
|
|
95345
|
+
let url = `${BASE_URL7}${normalizedPath}`;
|
|
95308
95346
|
if (queryParams) {
|
|
95309
95347
|
const searchParams = new URLSearchParams(queryParams);
|
|
95310
95348
|
url += `?${searchParams.toString()}`;
|
|
@@ -95842,7 +95880,7 @@ var parameters18 = {};
|
|
|
95842
95880
|
import { z as z29 } from "zod";
|
|
95843
95881
|
var BASE_HOST4 = "https://www.googleapis.com";
|
|
95844
95882
|
var BASE_PATH_SEGMENT4 = "/drive/v3";
|
|
95845
|
-
var
|
|
95883
|
+
var BASE_URL8 = `${BASE_HOST4}${BASE_PATH_SEGMENT4}`;
|
|
95846
95884
|
var REQUEST_TIMEOUT_MS19 = 6e4;
|
|
95847
95885
|
var cachedToken12 = null;
|
|
95848
95886
|
async function getProxyToken12(config) {
|
|
@@ -95918,7 +95956,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
95918
95956
|
);
|
|
95919
95957
|
try {
|
|
95920
95958
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT4);
|
|
95921
|
-
let url = `${
|
|
95959
|
+
let url = `${BASE_URL8}${normalizedPath}`;
|
|
95922
95960
|
if (queryParams) {
|
|
95923
95961
|
const searchParams = new URLSearchParams(queryParams);
|
|
95924
95962
|
url += `?${searchParams.toString()}`;
|
|
@@ -96959,7 +96997,7 @@ await slides.batchUpdate(presentationId, [
|
|
|
96959
96997
|
|
|
96960
96998
|
// ../connectors/src/connectors/hubspot-oauth/tools/request.ts
|
|
96961
96999
|
import { z as z32 } from "zod";
|
|
96962
|
-
var
|
|
97000
|
+
var BASE_URL9 = "https://api.hubapi.com";
|
|
96963
97001
|
var REQUEST_TIMEOUT_MS22 = 6e4;
|
|
96964
97002
|
var cachedToken15 = null;
|
|
96965
97003
|
async function getProxyToken15(config) {
|
|
@@ -97033,7 +97071,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
97033
97071
|
`[connector-request] hubspot-oauth/${connection.name}: ${method} ${path5}`
|
|
97034
97072
|
);
|
|
97035
97073
|
try {
|
|
97036
|
-
let url = `${
|
|
97074
|
+
let url = `${BASE_URL9}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
97037
97075
|
if (queryParams) {
|
|
97038
97076
|
const searchParams = new URLSearchParams(queryParams);
|
|
97039
97077
|
url += `?${searchParams.toString()}`;
|
|
@@ -97249,7 +97287,7 @@ const data = await res.json();
|
|
|
97249
97287
|
|
|
97250
97288
|
// ../connectors/src/connectors/stripe-oauth/tools/request.ts
|
|
97251
97289
|
import { z as z33 } from "zod";
|
|
97252
|
-
var
|
|
97290
|
+
var BASE_URL10 = "https://api.stripe.com";
|
|
97253
97291
|
var REQUEST_TIMEOUT_MS23 = 6e4;
|
|
97254
97292
|
var cachedToken16 = null;
|
|
97255
97293
|
async function getProxyToken16(config) {
|
|
@@ -97323,7 +97361,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
97323
97361
|
`[connector-request] stripe-oauth/${connection.name}: ${method} ${path5}`
|
|
97324
97362
|
);
|
|
97325
97363
|
try {
|
|
97326
|
-
let url = `${
|
|
97364
|
+
let url = `${BASE_URL10}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
97327
97365
|
if (queryParams) {
|
|
97328
97366
|
const searchParams = new URLSearchParams(queryParams);
|
|
97329
97367
|
url += `?${searchParams.toString()}`;
|
|
@@ -97561,7 +97599,7 @@ var parameters23 = {
|
|
|
97561
97599
|
};
|
|
97562
97600
|
|
|
97563
97601
|
// ../connectors/src/connectors/stripe-api-key/tools/request.ts
|
|
97564
|
-
var
|
|
97602
|
+
var BASE_URL11 = "https://api.stripe.com";
|
|
97565
97603
|
var REQUEST_TIMEOUT_MS24 = 6e4;
|
|
97566
97604
|
var inputSchema34 = z34.object({
|
|
97567
97605
|
toolUseIntent: z34.string().optional().describe(
|
|
@@ -97610,7 +97648,7 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
|
|
|
97610
97648
|
);
|
|
97611
97649
|
try {
|
|
97612
97650
|
const apiKey = parameters23.apiKey.getValue(connection);
|
|
97613
|
-
let url = `${
|
|
97651
|
+
let url = `${BASE_URL11}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
97614
97652
|
if (queryParams) {
|
|
97615
97653
|
const searchParams = new URLSearchParams(queryParams);
|
|
97616
97654
|
url += `?${searchParams.toString()}`;
|
|
@@ -97852,7 +97890,7 @@ var parameters24 = {
|
|
|
97852
97890
|
};
|
|
97853
97891
|
|
|
97854
97892
|
// ../connectors/src/connectors/airtable-oauth/tools/request.ts
|
|
97855
|
-
var
|
|
97893
|
+
var BASE_URL12 = "https://api.airtable.com/v0";
|
|
97856
97894
|
var REQUEST_TIMEOUT_MS25 = 6e4;
|
|
97857
97895
|
var cachedToken17 = null;
|
|
97858
97896
|
async function getProxyToken17(config) {
|
|
@@ -97929,7 +97967,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
97929
97967
|
try {
|
|
97930
97968
|
const baseId = parameters24.baseId.tryGetValue(connection);
|
|
97931
97969
|
const resolvedPath = baseId ? path5.replace(/\{baseId\}/g, baseId) : path5;
|
|
97932
|
-
let url = `${
|
|
97970
|
+
let url = `${BASE_URL12}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
97933
97971
|
if (queryParams) {
|
|
97934
97972
|
const searchParams = new URLSearchParams(queryParams);
|
|
97935
97973
|
url += `?${searchParams.toString()}`;
|
|
@@ -98782,7 +98820,7 @@ var parameters27 = {
|
|
|
98782
98820
|
|
|
98783
98821
|
// ../connectors/src/connectors/wix-store/tools/request.ts
|
|
98784
98822
|
import { z as z38 } from "zod";
|
|
98785
|
-
var
|
|
98823
|
+
var BASE_URL13 = "https://www.wixapis.com/";
|
|
98786
98824
|
var REQUEST_TIMEOUT_MS28 = 6e4;
|
|
98787
98825
|
var inputSchema38 = z38.object({
|
|
98788
98826
|
toolUseIntent: z38.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
|
|
@@ -98817,7 +98855,7 @@ Authentication is handled automatically using the API Key and Site ID.`,
|
|
|
98817
98855
|
try {
|
|
98818
98856
|
const apiKey = parameters27.apiKey.getValue(connection);
|
|
98819
98857
|
const siteId = parameters27.siteId.getValue(connection);
|
|
98820
|
-
const url = `${
|
|
98858
|
+
const url = `${BASE_URL13}${path5}`;
|
|
98821
98859
|
const controller = new AbortController();
|
|
98822
98860
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS28);
|
|
98823
98861
|
try {
|
|
@@ -100097,7 +100135,7 @@ var parameters34 = {
|
|
|
100097
100135
|
|
|
100098
100136
|
// ../connectors/src/connectors/attio/tools/request.ts
|
|
100099
100137
|
import { z as z42 } from "zod";
|
|
100100
|
-
var
|
|
100138
|
+
var BASE_URL14 = "https://api.attio.com/v2";
|
|
100101
100139
|
var REQUEST_TIMEOUT_MS31 = 6e4;
|
|
100102
100140
|
var inputSchema42 = z42.object({
|
|
100103
100141
|
toolUseIntent: z42.string().optional().describe(
|
|
@@ -100144,7 +100182,7 @@ Record queries use POST /objects/{object}/records/query with a JSON body contain
|
|
|
100144
100182
|
);
|
|
100145
100183
|
try {
|
|
100146
100184
|
const apiKey = parameters34.apiKey.getValue(connection);
|
|
100147
|
-
const url = `${
|
|
100185
|
+
const url = `${BASE_URL14}${path5}`;
|
|
100148
100186
|
const controller = new AbortController();
|
|
100149
100187
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS31);
|
|
100150
100188
|
try {
|
|
@@ -101112,7 +101150,7 @@ var parameters37 = {
|
|
|
101112
101150
|
|
|
101113
101151
|
// ../connectors/src/connectors/hubspot/tools/request.ts
|
|
101114
101152
|
import { z as z45 } from "zod";
|
|
101115
|
-
var
|
|
101153
|
+
var BASE_URL15 = "https://api.hubapi.com";
|
|
101116
101154
|
var REQUEST_TIMEOUT_MS34 = 6e4;
|
|
101117
101155
|
var inputSchema45 = z45.object({
|
|
101118
101156
|
toolUseIntent: z45.string().optional().describe(
|
|
@@ -101159,7 +101197,7 @@ Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex q
|
|
|
101159
101197
|
);
|
|
101160
101198
|
try {
|
|
101161
101199
|
const apiKey = parameters37.apiKey.getValue(connection);
|
|
101162
|
-
const url = `${
|
|
101200
|
+
const url = `${BASE_URL15}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
101163
101201
|
const controller = new AbortController();
|
|
101164
101202
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS34);
|
|
101165
101203
|
try {
|
|
@@ -101645,7 +101683,7 @@ var parameters39 = {
|
|
|
101645
101683
|
|
|
101646
101684
|
// ../connectors/src/connectors/linear/tools/request.ts
|
|
101647
101685
|
import { z as z47 } from "zod";
|
|
101648
|
-
var
|
|
101686
|
+
var BASE_URL16 = "https://api.linear.app/graphql";
|
|
101649
101687
|
var REQUEST_TIMEOUT_MS36 = 6e4;
|
|
101650
101688
|
var inputSchema47 = z47.object({
|
|
101651
101689
|
toolUseIntent: z47.string().optional().describe(
|
|
@@ -101695,7 +101733,7 @@ Archived resources are hidden by default; pass includeArchived: true in query ar
|
|
|
101695
101733
|
try {
|
|
101696
101734
|
const body = { query };
|
|
101697
101735
|
if (variables) body.variables = variables;
|
|
101698
|
-
const response = await fetch(
|
|
101736
|
+
const response = await fetch(BASE_URL16, {
|
|
101699
101737
|
method: "POST",
|
|
101700
101738
|
headers: {
|
|
101701
101739
|
Authorization: apiKey,
|
|
@@ -101903,7 +101941,7 @@ var parameters40 = {
|
|
|
101903
101941
|
import { z as z48 } from "zod";
|
|
101904
101942
|
var BASE_HOST5 = "https://app.asana.com";
|
|
101905
101943
|
var BASE_PATH_SEGMENT5 = "/api/1.0";
|
|
101906
|
-
var
|
|
101944
|
+
var BASE_URL17 = `${BASE_HOST5}${BASE_PATH_SEGMENT5}`;
|
|
101907
101945
|
var REQUEST_TIMEOUT_MS37 = 6e4;
|
|
101908
101946
|
var inputSchema48 = z48.object({
|
|
101909
101947
|
toolUseIntent: z48.string().optional().describe(
|
|
@@ -101968,7 +102006,7 @@ Pagination: Use limit (1-100) and offset query parameters. The response includes
|
|
|
101968
102006
|
try {
|
|
101969
102007
|
const token = parameters40.personalAccessToken.getValue(connection);
|
|
101970
102008
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT5);
|
|
101971
|
-
const url = `${
|
|
102009
|
+
const url = `${BASE_URL17}${normalizedPath}`;
|
|
101972
102010
|
const controller = new AbortController();
|
|
101973
102011
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS37);
|
|
101974
102012
|
try {
|
|
@@ -102841,7 +102879,7 @@ var parameters43 = {
|
|
|
102841
102879
|
|
|
102842
102880
|
// ../connectors/src/connectors/notion/tools/request.ts
|
|
102843
102881
|
import { z as z53 } from "zod";
|
|
102844
|
-
var
|
|
102882
|
+
var BASE_URL18 = "https://api.notion.com/v1";
|
|
102845
102883
|
var NOTION_VERSION = "2022-06-28";
|
|
102846
102884
|
var REQUEST_TIMEOUT_MS38 = 6e4;
|
|
102847
102885
|
var inputSchema53 = z53.object({
|
|
@@ -102889,7 +102927,7 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
102889
102927
|
);
|
|
102890
102928
|
try {
|
|
102891
102929
|
const apiKey = parameters43.apiKey.getValue(connection);
|
|
102892
|
-
const url = `${
|
|
102930
|
+
const url = `${BASE_URL18}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
102893
102931
|
const controller = new AbortController();
|
|
102894
102932
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS38);
|
|
102895
102933
|
try {
|
|
@@ -103078,7 +103116,7 @@ export default async function handler(c: Context) {
|
|
|
103078
103116
|
|
|
103079
103117
|
// ../connectors/src/connectors/notion-oauth/tools/request.ts
|
|
103080
103118
|
import { z as z54 } from "zod";
|
|
103081
|
-
var
|
|
103119
|
+
var BASE_URL19 = "https://api.notion.com/v1";
|
|
103082
103120
|
var NOTION_VERSION2 = "2022-06-28";
|
|
103083
103121
|
var REQUEST_TIMEOUT_MS39 = 6e4;
|
|
103084
103122
|
var cachedToken19 = null;
|
|
@@ -103154,7 +103192,7 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
103154
103192
|
`[connector-request] notion-oauth/${connection.name}: ${method} ${path5}`
|
|
103155
103193
|
);
|
|
103156
103194
|
try {
|
|
103157
|
-
const url = `${
|
|
103195
|
+
const url = `${BASE_URL19}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
103158
103196
|
const token = await getProxyToken19(config.oauthProxy);
|
|
103159
103197
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
103160
103198
|
const controller = new AbortController();
|
|
@@ -103403,7 +103441,7 @@ var parameters45 = {
|
|
|
103403
103441
|
};
|
|
103404
103442
|
|
|
103405
103443
|
// ../connectors/src/connectors/meta-ads/tools/list-ad-accounts.ts
|
|
103406
|
-
var
|
|
103444
|
+
var BASE_URL20 = "https://graph.facebook.com/v21.0/";
|
|
103407
103445
|
var REQUEST_TIMEOUT_MS40 = 6e4;
|
|
103408
103446
|
var inputSchema55 = z55.object({
|
|
103409
103447
|
toolUseIntent: z55.string().optional().describe(
|
|
@@ -103444,7 +103482,7 @@ var listAdAccountsTool = new ConnectorTool({
|
|
|
103444
103482
|
);
|
|
103445
103483
|
try {
|
|
103446
103484
|
const accessToken = parameters45.accessToken.getValue(connection);
|
|
103447
|
-
const url = `${
|
|
103485
|
+
const url = `${BASE_URL20}me/adaccounts?fields=account_id,name,account_status&access_token=${encodeURIComponent(accessToken)}`;
|
|
103448
103486
|
const controller = new AbortController();
|
|
103449
103487
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS40);
|
|
103450
103488
|
try {
|
|
@@ -103513,7 +103551,7 @@ var metaAdsOnboarding = new ConnectorOnboarding({
|
|
|
103513
103551
|
|
|
103514
103552
|
// ../connectors/src/connectors/meta-ads/tools/request.ts
|
|
103515
103553
|
import { z as z56 } from "zod";
|
|
103516
|
-
var
|
|
103554
|
+
var BASE_URL21 = "https://graph.facebook.com/v21.0/";
|
|
103517
103555
|
var REQUEST_TIMEOUT_MS41 = 6e4;
|
|
103518
103556
|
var inputSchema56 = z56.object({
|
|
103519
103557
|
toolUseIntent: z56.string().optional().describe(
|
|
@@ -103560,7 +103598,7 @@ Authentication is handled via the configured access token.
|
|
|
103560
103598
|
const accessToken = parameters45.accessToken.getValue(connection);
|
|
103561
103599
|
const adAccountId = parameters45.adAccountId.tryGetValue(connection) ?? "";
|
|
103562
103600
|
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
103563
|
-
let url = `${
|
|
103601
|
+
let url = `${BASE_URL21}${resolvedPath}`;
|
|
103564
103602
|
const params = new URLSearchParams(queryParams ?? {});
|
|
103565
103603
|
params.set("access_token", accessToken);
|
|
103566
103604
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -103766,7 +103804,7 @@ const accounts = await meta.listAdAccounts();
|
|
|
103766
103804
|
|
|
103767
103805
|
// ../connectors/src/connectors/meta-ads-oauth/tools/list-ad-accounts.ts
|
|
103768
103806
|
import { z as z57 } from "zod";
|
|
103769
|
-
var
|
|
103807
|
+
var BASE_URL22 = "https://graph.facebook.com/v21.0/";
|
|
103770
103808
|
var REQUEST_TIMEOUT_MS42 = 6e4;
|
|
103771
103809
|
var cachedToken20 = null;
|
|
103772
103810
|
async function getProxyToken20(config) {
|
|
@@ -103849,7 +103887,7 @@ var listAdAccountsTool2 = new ConnectorTool({
|
|
|
103849
103887
|
Authorization: `Bearer ${token}`
|
|
103850
103888
|
},
|
|
103851
103889
|
body: JSON.stringify({
|
|
103852
|
-
url: `${
|
|
103890
|
+
url: `${BASE_URL22}me/adaccounts?fields=account_id,name,account_status`,
|
|
103853
103891
|
method: "GET"
|
|
103854
103892
|
}),
|
|
103855
103893
|
signal: controller.signal
|
|
@@ -103928,7 +103966,7 @@ var parameters46 = {
|
|
|
103928
103966
|
|
|
103929
103967
|
// ../connectors/src/connectors/meta-ads-oauth/tools/request.ts
|
|
103930
103968
|
import { z as z58 } from "zod";
|
|
103931
|
-
var
|
|
103969
|
+
var BASE_URL23 = "https://graph.facebook.com/v21.0/";
|
|
103932
103970
|
var REQUEST_TIMEOUT_MS43 = 6e4;
|
|
103933
103971
|
var cachedToken21 = null;
|
|
103934
103972
|
async function getProxyToken21(config) {
|
|
@@ -104005,7 +104043,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
104005
104043
|
try {
|
|
104006
104044
|
const adAccountId = parameters46.adAccountId.tryGetValue(connection) ?? "";
|
|
104007
104045
|
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
104008
|
-
let url = `${
|
|
104046
|
+
let url = `${BASE_URL23}${resolvedPath}`;
|
|
104009
104047
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
104010
104048
|
const params = new URLSearchParams(queryParams);
|
|
104011
104049
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -104211,7 +104249,7 @@ const data = await res.json();
|
|
|
104211
104249
|
|
|
104212
104250
|
// ../connectors/src/connectors/tiktok-ads/tools/list-advertisers.ts
|
|
104213
104251
|
import { z as z59 } from "zod";
|
|
104214
|
-
var
|
|
104252
|
+
var BASE_URL24 = "https://business-api.tiktok.com/open_api/v1.3/";
|
|
104215
104253
|
var REQUEST_TIMEOUT_MS44 = 6e4;
|
|
104216
104254
|
var cachedToken22 = null;
|
|
104217
104255
|
async function getProxyToken22(config) {
|
|
@@ -104294,7 +104332,7 @@ var listAdvertisersTool = new ConnectorTool({
|
|
|
104294
104332
|
Authorization: `Bearer ${token}`
|
|
104295
104333
|
},
|
|
104296
104334
|
body: JSON.stringify({
|
|
104297
|
-
url: `${
|
|
104335
|
+
url: `${BASE_URL24}oauth2/advertiser/get/`,
|
|
104298
104336
|
method: "GET"
|
|
104299
104337
|
}),
|
|
104300
104338
|
signal: controller.signal
|
|
@@ -104385,7 +104423,7 @@ var parameters47 = {
|
|
|
104385
104423
|
import { z as z60 } from "zod";
|
|
104386
104424
|
var BASE_HOST6 = "https://business-api.tiktok.com";
|
|
104387
104425
|
var BASE_PATH_SEGMENT6 = "/open_api/v1.3";
|
|
104388
|
-
var
|
|
104426
|
+
var BASE_URL25 = `${BASE_HOST6}${BASE_PATH_SEGMENT6}`;
|
|
104389
104427
|
var REQUEST_TIMEOUT_MS45 = 6e4;
|
|
104390
104428
|
var cachedToken23 = null;
|
|
104391
104429
|
async function getProxyToken23(config) {
|
|
@@ -104462,7 +104500,7 @@ The advertiser_id is automatically injected if configured.`,
|
|
|
104462
104500
|
try {
|
|
104463
104501
|
const advertiserId = parameters47.advertiserId.tryGetValue(connection) ?? "";
|
|
104464
104502
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT6);
|
|
104465
|
-
let url = `${
|
|
104503
|
+
let url = `${BASE_URL25}${normalizedPath}`;
|
|
104466
104504
|
if (method === "GET") {
|
|
104467
104505
|
const params = new URLSearchParams(queryParams ?? {});
|
|
104468
104506
|
if (advertiserId && !params.has("advertiser_id")) {
|
|
@@ -105678,7 +105716,7 @@ var parameters51 = {
|
|
|
105678
105716
|
// ../connectors/src/connectors/gmail/tools/request-with-delegation.ts
|
|
105679
105717
|
var BASE_HOST7 = "https://gmail.googleapis.com";
|
|
105680
105718
|
var BASE_PATH_SEGMENT7 = "/gmail/v1/users";
|
|
105681
|
-
var
|
|
105719
|
+
var BASE_URL26 = `${BASE_HOST7}${BASE_PATH_SEGMENT7}`;
|
|
105682
105720
|
var REQUEST_TIMEOUT_MS49 = 6e4;
|
|
105683
105721
|
function decodeServiceAccount3(keyJsonBase64) {
|
|
105684
105722
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -105764,7 +105802,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
105764
105802
|
};
|
|
105765
105803
|
}
|
|
105766
105804
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT7);
|
|
105767
|
-
let url = `${
|
|
105805
|
+
let url = `${BASE_URL26}${normalizedPath}`;
|
|
105768
105806
|
if (queryParams) {
|
|
105769
105807
|
const searchParams = new URLSearchParams(queryParams);
|
|
105770
105808
|
url += `?${searchParams.toString()}`;
|
|
@@ -106085,7 +106123,7 @@ for (const msg of messages.messages ?? []) {
|
|
|
106085
106123
|
import { z as z65 } from "zod";
|
|
106086
106124
|
var BASE_HOST8 = "https://gmail.googleapis.com";
|
|
106087
106125
|
var BASE_PATH_SEGMENT8 = "/gmail/v1/users";
|
|
106088
|
-
var
|
|
106126
|
+
var BASE_URL27 = `${BASE_HOST8}${BASE_PATH_SEGMENT8}`;
|
|
106089
106127
|
var REQUEST_TIMEOUT_MS50 = 6e4;
|
|
106090
106128
|
var cachedToken25 = null;
|
|
106091
106129
|
async function getProxyToken25(config) {
|
|
@@ -106162,7 +106200,7 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
106162
106200
|
);
|
|
106163
106201
|
try {
|
|
106164
106202
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT8);
|
|
106165
|
-
let url = `${
|
|
106203
|
+
let url = `${BASE_URL27}${normalizedPath}`;
|
|
106166
106204
|
if (queryParams) {
|
|
106167
106205
|
const searchParams = new URLSearchParams(queryParams);
|
|
106168
106206
|
url += `?${searchParams.toString()}`;
|
|
@@ -106474,7 +106512,7 @@ var parameters53 = {
|
|
|
106474
106512
|
// ../connectors/src/connectors/google-audit-log/tools/request-with-delegation.ts
|
|
106475
106513
|
var BASE_HOST9 = "https://admin.googleapis.com";
|
|
106476
106514
|
var BASE_PATH_SEGMENT9 = "/admin/reports/v1";
|
|
106477
|
-
var
|
|
106515
|
+
var BASE_URL28 = `${BASE_HOST9}${BASE_PATH_SEGMENT9}`;
|
|
106478
106516
|
var REQUEST_TIMEOUT_MS51 = 6e4;
|
|
106479
106517
|
function decodeServiceAccount4(keyJsonBase64) {
|
|
106480
106518
|
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
@@ -106561,7 +106599,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
106561
106599
|
};
|
|
106562
106600
|
}
|
|
106563
106601
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT9);
|
|
106564
|
-
let url = `${
|
|
106602
|
+
let url = `${BASE_URL28}${normalizedPath}`;
|
|
106565
106603
|
if (queryParams) {
|
|
106566
106604
|
const searchParams = new URLSearchParams(queryParams);
|
|
106567
106605
|
url += `?${searchParams.toString()}`;
|
|
@@ -106871,7 +106909,7 @@ export default async function handler(c: Context) {
|
|
|
106871
106909
|
|
|
106872
106910
|
// ../connectors/src/connectors/linkedin-ads/tools/list-ad-accounts.ts
|
|
106873
106911
|
import { z as z67 } from "zod";
|
|
106874
|
-
var
|
|
106912
|
+
var BASE_URL29 = "https://api.linkedin.com/rest/";
|
|
106875
106913
|
var LINKEDIN_VERSION = "202603";
|
|
106876
106914
|
var REQUEST_TIMEOUT_MS52 = 6e4;
|
|
106877
106915
|
var cachedToken26 = null;
|
|
@@ -106955,7 +106993,7 @@ var listAdAccountsTool3 = new ConnectorTool({
|
|
|
106955
106993
|
Authorization: `Bearer ${token}`
|
|
106956
106994
|
},
|
|
106957
106995
|
body: JSON.stringify({
|
|
106958
|
-
url: `${
|
|
106996
|
+
url: `${BASE_URL29}adAccounts?q=search&search=(status:(values:List(ACTIVE)))&pageSize=100`,
|
|
106959
106997
|
method: "GET",
|
|
106960
106998
|
headers: {
|
|
106961
106999
|
"LinkedIn-Version": LINKEDIN_VERSION,
|
|
@@ -107038,7 +107076,7 @@ var parameters54 = {
|
|
|
107038
107076
|
|
|
107039
107077
|
// ../connectors/src/connectors/linkedin-ads/tools/request.ts
|
|
107040
107078
|
import { z as z68 } from "zod";
|
|
107041
|
-
var
|
|
107079
|
+
var BASE_URL30 = "https://api.linkedin.com/rest/";
|
|
107042
107080
|
var LINKEDIN_VERSION2 = "202603";
|
|
107043
107081
|
var REQUEST_TIMEOUT_MS53 = 6e4;
|
|
107044
107082
|
var cachedToken27 = null;
|
|
@@ -107117,7 +107155,7 @@ Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatic
|
|
|
107117
107155
|
try {
|
|
107118
107156
|
const adAccountId = parameters54.adAccountId.tryGetValue(connection) ?? "";
|
|
107119
107157
|
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
107120
|
-
let url = `${
|
|
107158
|
+
let url = `${BASE_URL30}${resolvedPath}`;
|
|
107121
107159
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
107122
107160
|
const params = new URLSearchParams(queryParams);
|
|
107123
107161
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -108073,7 +108111,7 @@ var parameters57 = {
|
|
|
108073
108111
|
|
|
108074
108112
|
// ../connectors/src/connectors/intercom/tools/request.ts
|
|
108075
108113
|
import { z as z71 } from "zod";
|
|
108076
|
-
var
|
|
108114
|
+
var BASE_URL31 = "https://api.intercom.io";
|
|
108077
108115
|
var API_VERSION = "2.11";
|
|
108078
108116
|
var REQUEST_TIMEOUT_MS56 = 6e4;
|
|
108079
108117
|
var inputSchema71 = z71.object({
|
|
@@ -108123,7 +108161,7 @@ The Intercom-Version header is set to 2.11 automatically.`,
|
|
|
108123
108161
|
);
|
|
108124
108162
|
try {
|
|
108125
108163
|
const accessToken = parameters57.accessToken.getValue(connection);
|
|
108126
|
-
const url = `${
|
|
108164
|
+
const url = `${BASE_URL31}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
108127
108165
|
const controller = new AbortController();
|
|
108128
108166
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS56);
|
|
108129
108167
|
try {
|
|
@@ -108366,7 +108404,7 @@ export default async function handler(c: Context) {
|
|
|
108366
108404
|
|
|
108367
108405
|
// ../connectors/src/connectors/intercom-oauth/tools/request.ts
|
|
108368
108406
|
import { z as z72 } from "zod";
|
|
108369
|
-
var
|
|
108407
|
+
var BASE_URL32 = "https://api.intercom.io";
|
|
108370
108408
|
var REQUEST_TIMEOUT_MS57 = 6e4;
|
|
108371
108409
|
var cachedToken29 = null;
|
|
108372
108410
|
async function getProxyToken29(config) {
|
|
@@ -108443,7 +108481,7 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
108443
108481
|
`[connector-request] intercom-oauth/${connection.name}: ${method} ${path5}`
|
|
108444
108482
|
);
|
|
108445
108483
|
try {
|
|
108446
|
-
let url = `${
|
|
108484
|
+
let url = `${BASE_URL32}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
108447
108485
|
if (queryParams) {
|
|
108448
108486
|
const searchParams = new URLSearchParams(queryParams);
|
|
108449
108487
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -109556,7 +109594,7 @@ var parameters62 = {
|
|
|
109556
109594
|
|
|
109557
109595
|
// ../connectors/src/connectors/gamma/tools/request.ts
|
|
109558
109596
|
import { z as z76 } from "zod";
|
|
109559
|
-
var
|
|
109597
|
+
var BASE_URL33 = "https://public-api.gamma.app/v1.0";
|
|
109560
109598
|
var REQUEST_TIMEOUT_MS61 = 6e4;
|
|
109561
109599
|
var inputSchema76 = z76.object({
|
|
109562
109600
|
toolUseIntent: z76.string().optional().describe(
|
|
@@ -109601,7 +109639,7 @@ For creating presentations/documents, prefer the gamma_generate tool instead.`,
|
|
|
109601
109639
|
);
|
|
109602
109640
|
try {
|
|
109603
109641
|
const apiKey = parameters62.apiKey.getValue(connection);
|
|
109604
|
-
const url = `${
|
|
109642
|
+
const url = `${BASE_URL33}${path5}`;
|
|
109605
109643
|
const controller = new AbortController();
|
|
109606
109644
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS61);
|
|
109607
109645
|
try {
|
|
@@ -109633,7 +109671,7 @@ For creating presentations/documents, prefer the gamma_generate tool instead.`,
|
|
|
109633
109671
|
|
|
109634
109672
|
// ../connectors/src/connectors/gamma/tools/generate.ts
|
|
109635
109673
|
import { z as z77 } from "zod";
|
|
109636
|
-
var
|
|
109674
|
+
var BASE_URL34 = "https://public-api.gamma.app/v1.0";
|
|
109637
109675
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
109638
109676
|
var MAX_POLL_DURATION_MS = 3e5;
|
|
109639
109677
|
var inputSchema77 = z77.object({
|
|
@@ -109750,7 +109788,7 @@ Gamma does NOT support image uploads. To visualize data, embed raw numbers direc
|
|
|
109750
109788
|
if (textAmount) textOptions.amount = textAmount;
|
|
109751
109789
|
if (Object.keys(textOptions).length > 0) body.textOptions = textOptions;
|
|
109752
109790
|
if (imageSource) body.imageOptions = { source: imageSource };
|
|
109753
|
-
const createRes = await fetch(`${
|
|
109791
|
+
const createRes = await fetch(`${BASE_URL34}/generations`, {
|
|
109754
109792
|
method: "POST",
|
|
109755
109793
|
headers,
|
|
109756
109794
|
body: JSON.stringify(body)
|
|
@@ -109770,7 +109808,7 @@ Gamma does NOT support image uploads. To visualize data, embed raw numbers direc
|
|
|
109770
109808
|
const deadline = Date.now() + MAX_POLL_DURATION_MS;
|
|
109771
109809
|
while (Date.now() < deadline) {
|
|
109772
109810
|
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS3));
|
|
109773
|
-
const pollRes = await fetch(`${
|
|
109811
|
+
const pollRes = await fetch(`${BASE_URL34}/generations/${generationId}`, {
|
|
109774
109812
|
method: "GET",
|
|
109775
109813
|
headers
|
|
109776
109814
|
});
|
|
@@ -110008,7 +110046,7 @@ var parameters63 = {
|
|
|
110008
110046
|
|
|
110009
110047
|
// ../connectors/src/connectors/sentry/tools/request.ts
|
|
110010
110048
|
import { z as z78 } from "zod";
|
|
110011
|
-
var
|
|
110049
|
+
var BASE_URL35 = "https://sentry.io/api/0";
|
|
110012
110050
|
var REQUEST_TIMEOUT_MS62 = 6e4;
|
|
110013
110051
|
var inputSchema78 = z78.object({
|
|
110014
110052
|
toolUseIntent: z78.string().optional().describe(
|
|
@@ -110058,7 +110096,7 @@ Authentication is handled automatically via Bearer token.
|
|
|
110058
110096
|
/\{organizationSlug\}/g,
|
|
110059
110097
|
organizationSlug
|
|
110060
110098
|
);
|
|
110061
|
-
const url = `${
|
|
110099
|
+
const url = `${BASE_URL35}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
110062
110100
|
const controller = new AbortController();
|
|
110063
110101
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS62);
|
|
110064
110102
|
try {
|
|
@@ -111071,7 +111109,7 @@ var parameters66 = {
|
|
|
111071
111109
|
|
|
111072
111110
|
// ../connectors/src/connectors/monday/tools/request.ts
|
|
111073
111111
|
import { z as z81 } from "zod";
|
|
111074
|
-
var
|
|
111112
|
+
var BASE_URL36 = "https://api.monday.com/v2";
|
|
111075
111113
|
var REQUEST_TIMEOUT_MS65 = 6e4;
|
|
111076
111114
|
var inputSchema81 = z81.object({
|
|
111077
111115
|
toolUseIntent: z81.string().optional().describe(
|
|
@@ -111129,7 +111167,7 @@ Items are paginated with a cursor-based \`items_page(limit, cursor)\` field on a
|
|
|
111129
111167
|
"Content-Type": "application/json"
|
|
111130
111168
|
};
|
|
111131
111169
|
if (apiVersion) headers["API-Version"] = apiVersion;
|
|
111132
|
-
const response = await fetch(
|
|
111170
|
+
const response = await fetch(BASE_URL36, {
|
|
111133
111171
|
method: "POST",
|
|
111134
111172
|
headers,
|
|
111135
111173
|
body: JSON.stringify(body),
|
|
@@ -111442,17 +111480,27 @@ async function importMssql() {
|
|
|
111442
111480
|
}
|
|
111443
111481
|
async function runMssqlQuery(parsed, sql, options = {}) {
|
|
111444
111482
|
const sqlMod = await importMssql();
|
|
111445
|
-
const
|
|
111446
|
-
|
|
111447
|
-
|
|
111448
|
-
|
|
111449
|
-
|
|
111483
|
+
const tunnel = options.tunnelParams ? await maybeOpenSshTunnelHostPort(
|
|
111484
|
+
options.tunnelParams,
|
|
111485
|
+
parsed.server,
|
|
111486
|
+
parsed.port
|
|
111487
|
+
) : null;
|
|
111450
111488
|
try {
|
|
111451
|
-
const
|
|
111452
|
-
const
|
|
111453
|
-
|
|
111489
|
+
const tunneled = tunnel ? { ...parsed, server: tunnel.host, port: tunnel.port } : parsed;
|
|
111490
|
+
const config = toMssqlConfig(tunneled, {
|
|
111491
|
+
encrypt: options.forceEncrypt
|
|
111492
|
+
});
|
|
111493
|
+
const pool = new sqlMod.ConnectionPool(config);
|
|
111494
|
+
await pool.connect();
|
|
111495
|
+
try {
|
|
111496
|
+
const result = await pool.request().query(sql);
|
|
111497
|
+
const recordset = result.recordset ?? [];
|
|
111498
|
+
return { rows: recordset };
|
|
111499
|
+
} finally {
|
|
111500
|
+
await pool.close();
|
|
111501
|
+
}
|
|
111454
111502
|
} finally {
|
|
111455
|
-
await
|
|
111503
|
+
await tunnel?.close();
|
|
111456
111504
|
}
|
|
111457
111505
|
}
|
|
111458
111506
|
async function checkMssqlConnection(url, credentials, options = {}) {
|
|
@@ -111540,35 +111588,69 @@ function parseOracleJdbcUrl(jdbcUrl, options = {}) {
|
|
|
111540
111588
|
function redactOracleUrl(jdbcUrl) {
|
|
111541
111589
|
return jdbcUrl.replace(/(:\/\/)([^@/]+)@/, "$1***@").replace(/(thin:)([^@]+)@/i, "$1***@");
|
|
111542
111590
|
}
|
|
111591
|
+
function parseOracleConnectStringHostPort(connectString) {
|
|
111592
|
+
const m4 = /^([^:/]+):(\d+)(.*)$/.exec(connectString);
|
|
111593
|
+
if (!m4) return null;
|
|
111594
|
+
return { host: m4[1], port: Number(m4[2]), trailing: m4[3] };
|
|
111595
|
+
}
|
|
111596
|
+
function rewriteOracleConnectStringHostPort(connectString, host, port) {
|
|
111597
|
+
const parts = parseOracleConnectStringHostPort(connectString);
|
|
111598
|
+
if (!parts) return connectString;
|
|
111599
|
+
return `${host}:${port}${parts.trailing}`;
|
|
111600
|
+
}
|
|
111543
111601
|
|
|
111544
111602
|
// ../connectors/src/lib/oracle-runner.ts
|
|
111545
111603
|
async function importOracleDb() {
|
|
111546
111604
|
const mod = await import("oracledb");
|
|
111547
111605
|
return mod.default ?? mod;
|
|
111548
111606
|
}
|
|
111549
|
-
async function runOracleQuery(parsed, sql) {
|
|
111607
|
+
async function runOracleQuery(parsed, sql, options = {}) {
|
|
111550
111608
|
const oracledb = await importOracleDb();
|
|
111551
|
-
|
|
111552
|
-
|
|
111553
|
-
|
|
111554
|
-
|
|
111555
|
-
|
|
111609
|
+
let tunnel = null;
|
|
111610
|
+
if (options.tunnelParams) {
|
|
111611
|
+
const hostPort = parseOracleConnectStringHostPort(parsed.connectString);
|
|
111612
|
+
if (hostPort) {
|
|
111613
|
+
tunnel = await maybeOpenSshTunnelHostPort(
|
|
111614
|
+
options.tunnelParams,
|
|
111615
|
+
hostPort.host,
|
|
111616
|
+
hostPort.port
|
|
111617
|
+
);
|
|
111618
|
+
}
|
|
111619
|
+
}
|
|
111556
111620
|
try {
|
|
111557
|
-
const
|
|
111558
|
-
|
|
111559
|
-
|
|
111560
|
-
|
|
111561
|
-
|
|
111621
|
+
const connectString = tunnel ? rewriteOracleConnectStringHostPort(
|
|
111622
|
+
parsed.connectString,
|
|
111623
|
+
tunnel.host,
|
|
111624
|
+
tunnel.port
|
|
111625
|
+
) : parsed.connectString;
|
|
111626
|
+
const connection = await oracledb.getConnection({
|
|
111627
|
+
user: parsed.user,
|
|
111628
|
+
password: parsed.password,
|
|
111629
|
+
connectString
|
|
111562
111630
|
});
|
|
111563
|
-
return { rows: result.rows ?? [] };
|
|
111564
|
-
} finally {
|
|
111565
111631
|
try {
|
|
111566
|
-
await connection.
|
|
111567
|
-
|
|
111632
|
+
const result = await connection.execute(
|
|
111633
|
+
sql,
|
|
111634
|
+
[],
|
|
111635
|
+
{
|
|
111636
|
+
outFormat: oracledb.OUT_FORMAT_OBJECT,
|
|
111637
|
+
// Bound by the connector's own row cap, but keep the driver from
|
|
111638
|
+
// streaming arbitrarily large result sets.
|
|
111639
|
+
maxRows: 5e3
|
|
111640
|
+
}
|
|
111641
|
+
);
|
|
111642
|
+
return { rows: result.rows ?? [] };
|
|
111643
|
+
} finally {
|
|
111644
|
+
try {
|
|
111645
|
+
await connection.close();
|
|
111646
|
+
} catch {
|
|
111647
|
+
}
|
|
111568
111648
|
}
|
|
111649
|
+
} finally {
|
|
111650
|
+
await tunnel?.close();
|
|
111569
111651
|
}
|
|
111570
111652
|
}
|
|
111571
|
-
async function checkOracleConnection(url, credentials) {
|
|
111653
|
+
async function checkOracleConnection(url, credentials, options = {}) {
|
|
111572
111654
|
let parsed;
|
|
111573
111655
|
try {
|
|
111574
111656
|
parsed = parseOracleJdbcUrl(url, credentials);
|
|
@@ -111579,7 +111661,7 @@ async function checkOracleConnection(url, credentials) {
|
|
|
111579
111661
|
};
|
|
111580
111662
|
}
|
|
111581
111663
|
try {
|
|
111582
|
-
await runOracleQuery(parsed, "SELECT 1 FROM DUAL");
|
|
111664
|
+
await runOracleQuery(parsed, "SELECT 1 FROM DUAL", options);
|
|
111583
111665
|
return { success: true };
|
|
111584
111666
|
} catch (err) {
|
|
111585
111667
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -111789,12 +111871,13 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
111789
111871
|
};
|
|
111790
111872
|
}
|
|
111791
111873
|
try {
|
|
111874
|
+
const tunnelParams = connectionParamsToRecord(connection);
|
|
111792
111875
|
if (parsed.driver === "sqlserver") {
|
|
111793
111876
|
const mssqlParsed = parseSqlServerJdbcUrl(parsed.originalUrl, {
|
|
111794
111877
|
username,
|
|
111795
111878
|
password
|
|
111796
111879
|
});
|
|
111797
|
-
const result = await runMssqlQuery(mssqlParsed, sql);
|
|
111880
|
+
const result = await runMssqlQuery(mssqlParsed, sql, { tunnelParams });
|
|
111798
111881
|
const rows = result.rows;
|
|
111799
111882
|
return {
|
|
111800
111883
|
success: true,
|
|
@@ -111809,7 +111892,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
111809
111892
|
password
|
|
111810
111893
|
});
|
|
111811
111894
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
111812
|
-
const result = await runOracleQuery(oracleParsed, cleanSql
|
|
111895
|
+
const result = await runOracleQuery(oracleParsed, cleanSql, {
|
|
111896
|
+
tunnelParams
|
|
111897
|
+
});
|
|
111813
111898
|
const rows = result.rows;
|
|
111814
111899
|
return {
|
|
111815
111900
|
success: true,
|
|
@@ -111821,7 +111906,7 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
111821
111906
|
let tunnel;
|
|
111822
111907
|
try {
|
|
111823
111908
|
tunnel = await maybeOpenSshTunnel(
|
|
111824
|
-
|
|
111909
|
+
tunnelParams,
|
|
111825
111910
|
parsed.nativeUrl,
|
|
111826
111911
|
parsed.defaultPort
|
|
111827
111912
|
);
|
|
@@ -111995,10 +112080,18 @@ JDBC URL \u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u306B\u3088\u308A\u65B
|
|
|
111995
112080
|
};
|
|
111996
112081
|
}
|
|
111997
112082
|
if (parsed.driver === "sqlserver") {
|
|
111998
|
-
return checkMssqlConnection(
|
|
112083
|
+
return checkMssqlConnection(
|
|
112084
|
+
parsed.originalUrl,
|
|
112085
|
+
{ username, password },
|
|
112086
|
+
{ tunnelParams: params }
|
|
112087
|
+
);
|
|
111999
112088
|
}
|
|
112000
112089
|
if (parsed.driver === "oracle") {
|
|
112001
|
-
return checkOracleConnection(
|
|
112090
|
+
return checkOracleConnection(
|
|
112091
|
+
parsed.originalUrl,
|
|
112092
|
+
{ username, password },
|
|
112093
|
+
{ tunnelParams: params }
|
|
112094
|
+
);
|
|
112002
112095
|
}
|
|
112003
112096
|
const tunnel = await maybeOpenSshTunnel(
|
|
112004
112097
|
params,
|
|
@@ -112055,10 +112148,12 @@ JDBC URL \u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u306B\u3088\u308A\u65B
|
|
|
112055
112148
|
});
|
|
112056
112149
|
const sample = unwrapSampleLimit(sql);
|
|
112057
112150
|
if (sample) {
|
|
112058
|
-
const result = await runMssqlQuery(mssqlParsed, sample.inner
|
|
112151
|
+
const result = await runMssqlQuery(mssqlParsed, sample.inner, {
|
|
112152
|
+
tunnelParams: params
|
|
112153
|
+
});
|
|
112059
112154
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
112060
112155
|
}
|
|
112061
|
-
return runMssqlQuery(mssqlParsed, sql);
|
|
112156
|
+
return runMssqlQuery(mssqlParsed, sql, { tunnelParams: params });
|
|
112062
112157
|
}
|
|
112063
112158
|
if (parsed.driver === "oracle") {
|
|
112064
112159
|
const oracleParsed = parseOracleJdbcUrl(parsed.originalUrl, {
|
|
@@ -112068,11 +112163,13 @@ JDBC URL \u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u306B\u3088\u308A\u65B
|
|
|
112068
112163
|
const sample = unwrapSampleLimit(sql);
|
|
112069
112164
|
if (sample) {
|
|
112070
112165
|
const inner = sample.inner.replace(/;\s*$/, "");
|
|
112071
|
-
const result = await runOracleQuery(oracleParsed, inner
|
|
112166
|
+
const result = await runOracleQuery(oracleParsed, inner, {
|
|
112167
|
+
tunnelParams: params
|
|
112168
|
+
});
|
|
112072
112169
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
112073
112170
|
}
|
|
112074
112171
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
112075
|
-
return runOracleQuery(oracleParsed, cleanSql);
|
|
112172
|
+
return runOracleQuery(oracleParsed, cleanSql, { tunnelParams: params });
|
|
112076
112173
|
}
|
|
112077
112174
|
const tunnel = await maybeOpenSshTunnel(
|
|
112078
112175
|
params,
|
|
@@ -112136,7 +112233,7 @@ var parameters68 = {
|
|
|
112136
112233
|
};
|
|
112137
112234
|
|
|
112138
112235
|
// ../connectors/src/connectors/semrush/tools/request.ts
|
|
112139
|
-
var
|
|
112236
|
+
var BASE_URL37 = "https://api.semrush.com";
|
|
112140
112237
|
var REQUEST_TIMEOUT_MS66 = 6e4;
|
|
112141
112238
|
var inputSchema83 = z83.object({
|
|
112142
112239
|
toolUseIntent: z83.string().optional().describe(
|
|
@@ -112216,7 +112313,7 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
112216
112313
|
}
|
|
112217
112314
|
}
|
|
112218
112315
|
const url = new URL(
|
|
112219
|
-
isAbsolute ? path5 : `${
|
|
112316
|
+
isAbsolute ? path5 : `${BASE_URL37}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
112220
112317
|
);
|
|
112221
112318
|
if (queryParams) {
|
|
112222
112319
|
for (const [k6, v] of Object.entries(queryParams)) {
|
|
@@ -112304,16 +112401,18 @@ var semrushOnboarding = new ConnectorOnboarding({
|
|
|
112304
112401
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
112305
112402
|
},
|
|
112306
112403
|
dataOverviewInstructions: {
|
|
112307
|
-
en: `1. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "
|
|
112404
|
+
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)
|
|
112308
112405
|
2. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "domain_organic", "domain": "<example.com>", "database": "us", "display_limit": "5" }\` to sample organic keywords
|
|
112309
112406
|
3. Call ${requestToolName12} with path "/" and queryParams \`{ "type": "phrase_this", "phrase": "<keyword>", "database": "us" }\` to inspect a keyword overview
|
|
112310
|
-
4.
|
|
112311
|
-
5.
|
|
112312
|
-
|
|
112407
|
+
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"\`)
|
|
112408
|
+
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
|
|
112409
|
+
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`,
|
|
112410
|
+
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
|
|
112313
112411
|
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
|
|
112314
112412
|
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
|
|
112315
|
-
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\
|
|
112316
|
-
5. \
|
|
112413
|
+
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
|
|
112414
|
+
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
|
|
112415
|
+
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`
|
|
112317
112416
|
}
|
|
112318
112417
|
});
|
|
112319
112418
|
|
|
@@ -112340,10 +112439,19 @@ The business logic type for this connector is "typescript". Write handler code u
|
|
|
112340
112439
|
|
|
112341
112440
|
SDK methods (client created via \`connection(connectionId)\`):
|
|
112342
112441
|
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch. Pass \`init.query\` to set query parameters; \`key\` is injected automatically
|
|
112343
|
-
- \`client.
|
|
112442
|
+
- \`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()\`
|
|
112443
|
+
- \`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
|
|
112344
112444
|
- \`client.trends(path, query?)\` \u2014 call a Trends API endpoint (\`/analytics/v1/...\`) and return parsed JSON
|
|
112345
112445
|
- \`client.projects(path, init?)\` \u2014 call a Projects API endpoint (\`/management/v1/...\`) and return parsed JSON
|
|
112346
112446
|
|
|
112447
|
+
\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.
|
|
112448
|
+
|
|
112449
|
+
\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.
|
|
112450
|
+
|
|
112451
|
+
\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.
|
|
112452
|
+
|
|
112453
|
+
\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"])\`.
|
|
112454
|
+
|
|
112347
112455
|
\`\`\`ts
|
|
112348
112456
|
import type { Context } from "hono";
|
|
112349
112457
|
import { connection } from "@squadbase/vite-server/connectors/semrush";
|
|
@@ -112356,9 +112464,25 @@ export default async function handler(c: Context) {
|
|
|
112356
112464
|
database?: string;
|
|
112357
112465
|
}>();
|
|
112358
112466
|
|
|
112359
|
-
const
|
|
112467
|
+
const result = await semrush.report("domain_organic", {
|
|
112468
|
+
domain,
|
|
112469
|
+
database,
|
|
112470
|
+
display_limit: "100",
|
|
112471
|
+
});
|
|
112472
|
+
|
|
112473
|
+
// \u2705 Correct: access by column name
|
|
112474
|
+
const rows = result.rows.map((row) => ({
|
|
112475
|
+
keyword: row["Keyword"],
|
|
112476
|
+
position: Number(row["Position"]) || 0,
|
|
112477
|
+
searchVolume: Number(row["Search Volume"]) || 0,
|
|
112478
|
+
url: row["Url"] ?? "",
|
|
112479
|
+
}));
|
|
112480
|
+
|
|
112481
|
+
// \u274C Wrong: do NOT do this \u2014 row[index] is undefined because rows are objects, not arrays
|
|
112482
|
+
// const urlIdx = result.columns.indexOf("Url");
|
|
112483
|
+
// const url = (row as unknown as string[])[urlIdx];
|
|
112360
112484
|
|
|
112361
|
-
return c.json({ columns:
|
|
112485
|
+
return c.json({ columns: result.columns, rows });
|
|
112362
112486
|
}
|
|
112363
112487
|
\`\`\`
|
|
112364
112488
|
|
|
@@ -112370,8 +112494,8 @@ export default async function handler(c: Context) {
|
|
|
112370
112494
|
|
|
112371
112495
|
Authentication: API key passed as the \`key\` query parameter on every request (handled automatically).
|
|
112372
112496
|
|
|
112373
|
-
#### Common Standard Analytics report types
|
|
112374
|
-
- \`
|
|
112497
|
+
#### Common Standard Analytics report types (path \`/\`, returns CSV)
|
|
112498
|
+
- \`domain_ranks\` \u2014 single-row domain summary (rank, organic/paid keywords, traffic, cost). **There is no \`domain_overview\` type \u2014 use \`domain_ranks\`.**
|
|
112375
112499
|
- \`domain_organic\` \u2014 organic keywords for a domain
|
|
112376
112500
|
- \`domain_adwords\` \u2014 paid keywords for a domain
|
|
112377
112501
|
- \`domain_organic_organic\` / \`domain_adwords_adwords\` \u2014 organic / paid competitors
|
|
@@ -112380,10 +112504,13 @@ Authentication: API key passed as the \`key\` query parameter on every request (
|
|
|
112380
112504
|
- \`phrase_fullsearch\` \u2014 full-text keyword research
|
|
112381
112505
|
- \`phrase_questions\` \u2014 question keywords
|
|
112382
112506
|
- \`phrase_kdi\` \u2014 keyword difficulty index
|
|
112507
|
+
- \`url_organic\` / \`url_adwords\` \u2014 keywords ranking for a specific URL
|
|
112508
|
+
|
|
112509
|
+
#### Backlinks API report types (path \`/analytics/v1/\`, also returns **CSV** \u2014 not JSON)
|
|
112510
|
+
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.
|
|
112383
112511
|
- \`backlinks_overview\` \u2014 backlinks summary
|
|
112384
112512
|
- \`backlinks\` \u2014 list of backlinks
|
|
112385
112513
|
- \`backlinks_refdomains\` \u2014 referring domains
|
|
112386
|
-
- \`url_organic\` / \`url_adwords\` \u2014 keywords ranking for a specific URL
|
|
112387
112514
|
|
|
112388
112515
|
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.
|
|
112389
112516
|
|
|
@@ -112391,7 +112518,7 @@ To check remaining API units (free, does NOT consume units), call the request to
|
|
|
112391
112518
|
- \`type\` \u2014 report type (required for the Standard API)
|
|
112392
112519
|
- \`domain\` / \`phrase\` / \`url\` \u2014 entity to query
|
|
112393
112520
|
- \`database\` \u2014 regional database (e.g. \`us\`, \`uk\`, \`de\`, \`fr\`, \`jp\`, \`br\`); required for most reports
|
|
112394
|
-
- \`display_limit\` \u2014 page size (default 10000, max 100000 depending on report)
|
|
112521
|
+
- \`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.
|
|
112395
112522
|
- \`display_offset\` \u2014 pagination offset
|
|
112396
112523
|
- \`display_date\` \u2014 historical date in \`YYYYMM15\` format (always day 15)
|
|
112397
112524
|
- \`export_columns\` \u2014 comma-separated columns to return (e.g. \`Ph,Po,Nq,Cp\`)
|
|
@@ -112402,6 +112529,7 @@ To check remaining API units (free, does NOT consume units), call the request to
|
|
|
112402
112529
|
- 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
|
|
112403
112530
|
- The CSV separator is \`;\` (semicolon), NOT \`,\`. Some cells may contain commas inside them.
|
|
112404
112531
|
- An HTTP 200 response with a body starting with \`ERROR\` indicates an API error (auth, parameters, or quota)
|
|
112532
|
+
- \`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.
|
|
112405
112533
|
- The Trends API requires a separate Trends subscription; calls without it will fail with an authorization error
|
|
112406
112534
|
- Date strings in historical endpoints must be the 15th of the month (\`YYYYMM15\`)`,
|
|
112407
112535
|
ja: `### \u30C4\u30FC\u30EB
|
|
@@ -112414,10 +112542,19 @@ To check remaining API units (free, does NOT consume units), call the request to
|
|
|
112414
112542
|
|
|
112415
112543
|
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
112416
112544
|
- \`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
|
|
112417
|
-
- \`client.
|
|
112545
|
+
- \`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
|
|
112546
|
+
- \`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
|
|
112418
112547
|
- \`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
|
|
112419
112548
|
- \`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
|
|
112420
112549
|
|
|
112550
|
+
\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
|
|
112551
|
+
|
|
112552
|
+
\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
|
|
112553
|
+
|
|
112554
|
+
\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
|
|
112555
|
+
|
|
112556
|
+
\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
|
|
112557
|
+
|
|
112421
112558
|
\`\`\`ts
|
|
112422
112559
|
import type { Context } from "hono";
|
|
112423
112560
|
import { connection } from "@squadbase/vite-server/connectors/semrush";
|
|
@@ -112430,9 +112567,25 @@ export default async function handler(c: Context) {
|
|
|
112430
112567
|
database?: string;
|
|
112431
112568
|
}>();
|
|
112432
112569
|
|
|
112433
|
-
const
|
|
112570
|
+
const result = await semrush.report("domain_organic", {
|
|
112571
|
+
domain,
|
|
112572
|
+
database,
|
|
112573
|
+
display_limit: "100",
|
|
112574
|
+
});
|
|
112575
|
+
|
|
112576
|
+
// \u2705 \u6B63: \u30AB\u30E9\u30E0\u540D\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B
|
|
112577
|
+
const rows = result.rows.map((row) => ({
|
|
112578
|
+
keyword: row["Keyword"],
|
|
112579
|
+
position: Number(row["Position"]) || 0,
|
|
112580
|
+
searchVolume: Number(row["Search Volume"]) || 0,
|
|
112581
|
+
url: row["Url"] ?? "",
|
|
112582
|
+
}));
|
|
112434
112583
|
|
|
112435
|
-
|
|
112584
|
+
// \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
|
|
112585
|
+
// const urlIdx = result.columns.indexOf("Url");
|
|
112586
|
+
// const url = (row as unknown as string[])[urlIdx];
|
|
112587
|
+
|
|
112588
|
+
return c.json({ columns: result.columns, rows });
|
|
112436
112589
|
}
|
|
112437
112590
|
\`\`\`
|
|
112438
112591
|
|
|
@@ -112444,8 +112597,8 @@ export default async function handler(c: Context) {
|
|
|
112444
112597
|
|
|
112445
112598
|
\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
|
|
112446
112599
|
|
|
112447
|
-
#### \u4E3B\u8981\u306A Standard Analytics \u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7
|
|
112448
|
-
- \`
|
|
112600
|
+
#### \u4E3B\u8981\u306A Standard Analytics \u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7\uFF08path \`/\`\u3001CSV\u3092\u8FD4\u3059\uFF09
|
|
112601
|
+
- \`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**
|
|
112449
112602
|
- \`domain_organic\` \u2014 \u30C9\u30E1\u30A4\u30F3\u306E\u30AA\u30FC\u30AC\u30CB\u30C3\u30AF\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112450
112603
|
- \`domain_adwords\` \u2014 \u30C9\u30E1\u30A4\u30F3\u306E\u6709\u6599\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112451
112604
|
- \`domain_organic_organic\` / \`domain_adwords_adwords\` \u2014 \u30AA\u30FC\u30AC\u30CB\u30C3\u30AF\uFF0F\u6709\u6599\u306E\u7AF6\u5408
|
|
@@ -112454,10 +112607,13 @@ export default async function handler(c: Context) {
|
|
|
112454
112607
|
- \`phrase_fullsearch\` \u2014 \u30D5\u30EB\u30C6\u30AD\u30B9\u30C8\u30AD\u30FC\u30EF\u30FC\u30C9\u30EA\u30B5\u30FC\u30C1
|
|
112455
112608
|
- \`phrase_questions\` \u2014 \u8CEA\u554F\u5F62\u5F0F\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112456
112609
|
- \`phrase_kdi\` \u2014 \u30AD\u30FC\u30EF\u30FC\u30C9\u96E3\u6613\u5EA6\uFF08KDI\uFF09
|
|
112610
|
+
- \`url_organic\` / \`url_adwords\` \u2014 \u7279\u5B9AURL\u3067\u30E9\u30F3\u30AF\u30A4\u30F3\u3057\u3066\u3044\u308B\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112611
|
+
|
|
112612
|
+
#### 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
|
|
112613
|
+
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
|
|
112457
112614
|
- \`backlinks_overview\` \u2014 \u30D0\u30C3\u30AF\u30EA\u30F3\u30AF\u6982\u8981
|
|
112458
112615
|
- \`backlinks\` \u2014 \u30D0\u30C3\u30AF\u30EA\u30F3\u30AF\u4E00\u89A7
|
|
112459
112616
|
- \`backlinks_refdomains\` \u2014 \u53C2\u7167\u30C9\u30E1\u30A4\u30F3
|
|
112460
|
-
- \`url_organic\` / \`url_adwords\` \u2014 \u7279\u5B9AURL\u3067\u30E9\u30F3\u30AF\u30A4\u30F3\u3057\u3066\u3044\u308B\u30AD\u30FC\u30EF\u30FC\u30C9
|
|
112461
112617
|
|
|
112462
112618
|
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
|
|
112463
112619
|
|
|
@@ -112465,7 +112621,7 @@ API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u30
|
|
|
112465
112621
|
- \`type\` \u2014 \u30EC\u30DD\u30FC\u30C8\u7A2E\u5225\uFF08Standard API \u3067\u306F\u5FC5\u9808\uFF09
|
|
112466
112622
|
- \`domain\` / \`phrase\` / \`url\` \u2014 \u30AF\u30A8\u30EA\u5BFE\u8C61\u306E\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3
|
|
112467
112623
|
- \`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
|
|
112468
|
-
- \`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
|
|
112624
|
+
- \`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
|
|
112469
112625
|
- \`display_offset\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8
|
|
112470
112626
|
- \`display_date\` \u2014 \u5C65\u6B74\u306E\u65E5\u4ED8\u3002\`YYYYMM15\` \u5F62\u5F0F\uFF08\u5FC5\u305A\u6708\u306E15\u65E5\uFF09
|
|
112471
112627
|
- \`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
|
|
@@ -112476,6 +112632,7 @@ API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u30
|
|
|
112476
112632
|
- 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
|
|
112477
112633
|
- 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
|
|
112478
112634
|
- 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
|
|
112635
|
+
- \`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
|
|
112479
112636
|
- 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
|
|
112480
112637
|
- \u5C65\u6B74\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u65E5\u4ED8\u306F\u5FC5\u305A\u6708\u306E15\u65E5\uFF08\`YYYYMM15\`\uFF09`
|
|
112481
112638
|
},
|
|
@@ -112514,7 +112671,7 @@ API \u30E6\u30CB\u30C3\u30C8\u6B8B\u91CF\u306E\u78BA\u8A8D\uFF08\u7121\u6599\u30
|
|
|
112514
112671
|
|
|
112515
112672
|
// ../connectors/src/connectors/google-search-console-oauth/tools/list-sites.ts
|
|
112516
112673
|
import { z as z84 } from "zod";
|
|
112517
|
-
var
|
|
112674
|
+
var BASE_URL38 = "https://searchconsole.googleapis.com/webmasters/v3";
|
|
112518
112675
|
var REQUEST_TIMEOUT_MS67 = 6e4;
|
|
112519
112676
|
var cachedToken30 = null;
|
|
112520
112677
|
async function getProxyToken30(config) {
|
|
@@ -112585,7 +112742,7 @@ var listSitesTool = new ConnectorTool({
|
|
|
112585
112742
|
`[connector-request] google-search-console-oauth/${connection.name}: listSites`
|
|
112586
112743
|
);
|
|
112587
112744
|
try {
|
|
112588
|
-
const url = `${
|
|
112745
|
+
const url = `${BASE_URL38}/sites`;
|
|
112589
112746
|
const token = await getProxyToken30(config.oauthProxy);
|
|
112590
112747
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
112591
112748
|
const controller = new AbortController();
|
|
@@ -112684,7 +112841,7 @@ var parameters69 = {
|
|
|
112684
112841
|
import { z as z85 } from "zod";
|
|
112685
112842
|
var BASE_HOST10 = "https://searchconsole.googleapis.com";
|
|
112686
112843
|
var BASE_PATH_SEGMENT10 = "/webmasters/v3";
|
|
112687
|
-
var
|
|
112844
|
+
var BASE_URL39 = `${BASE_HOST10}${BASE_PATH_SEGMENT10}`;
|
|
112688
112845
|
var REQUEST_TIMEOUT_MS68 = 6e4;
|
|
112689
112846
|
var cachedToken31 = null;
|
|
112690
112847
|
async function getProxyToken31(config) {
|
|
@@ -112769,7 +112926,7 @@ For URL Inspection API requests, use the absolute path '/v1/urlInspection/index:
|
|
|
112769
112926
|
resolvedPath,
|
|
112770
112927
|
BASE_PATH_SEGMENT10
|
|
112771
112928
|
);
|
|
112772
|
-
let url = `${
|
|
112929
|
+
let url = `${BASE_URL39}${normalizedPath}`;
|
|
112773
112930
|
if (queryParams) {
|
|
112774
112931
|
const searchParams = new URLSearchParams(queryParams);
|
|
112775
112932
|
url += `?${searchParams.toString()}`;
|
|
@@ -113259,7 +113416,7 @@ var parameters71 = {
|
|
|
113259
113416
|
import { z as z87 } from "zod";
|
|
113260
113417
|
var BASE_HOST11 = "https://api.clickup.com";
|
|
113261
113418
|
var BASE_PATH_SEGMENT11 = "/api/v2";
|
|
113262
|
-
var
|
|
113419
|
+
var BASE_URL40 = `${BASE_HOST11}${BASE_PATH_SEGMENT11}`;
|
|
113263
113420
|
var REQUEST_TIMEOUT_MS69 = 6e4;
|
|
113264
113421
|
var inputSchema87 = z87.object({
|
|
113265
113422
|
toolUseIntent: z87.string().optional().describe(
|
|
@@ -113332,7 +113489,7 @@ Pagination: ClickUp uses zero-indexed \`page\` query parameter on list endpoints
|
|
|
113332
113489
|
try {
|
|
113333
113490
|
const token = parameters71.apiToken.getValue(connection);
|
|
113334
113491
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT11);
|
|
113335
|
-
const url = `${
|
|
113492
|
+
const url = `${BASE_URL40}${normalizedPath}`;
|
|
113336
113493
|
const controller = new AbortController();
|
|
113337
113494
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS69);
|
|
113338
113495
|
try {
|
|
@@ -113595,7 +113752,8 @@ var parameters72 = {
|
|
|
113595
113752
|
type: "text",
|
|
113596
113753
|
secret: true,
|
|
113597
113754
|
required: false
|
|
113598
|
-
})
|
|
113755
|
+
}),
|
|
113756
|
+
...sshTunnelParameters
|
|
113599
113757
|
};
|
|
113600
113758
|
|
|
113601
113759
|
// ../connectors/src/connectors/sqlserver/tools/execute-query.ts
|
|
@@ -113654,7 +113812,9 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
113654
113812
|
};
|
|
113655
113813
|
}
|
|
113656
113814
|
try {
|
|
113657
|
-
const { rows } = await runMssqlQuery(parsed, sql
|
|
113815
|
+
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
113816
|
+
tunnelParams: connectionParamsToRecord(connection)
|
|
113817
|
+
});
|
|
113658
113818
|
const truncated = rows.length > MAX_ROWS14;
|
|
113659
113819
|
return {
|
|
113660
113820
|
success: true,
|
|
@@ -113725,7 +113885,8 @@ The business logic type for this connector is "sql".
|
|
|
113725
113885
|
{
|
|
113726
113886
|
username: params[parameters72.username.slug],
|
|
113727
113887
|
password: params[parameters72.password.slug]
|
|
113728
|
-
}
|
|
113888
|
+
},
|
|
113889
|
+
{ tunnelParams: params }
|
|
113729
113890
|
);
|
|
113730
113891
|
},
|
|
113731
113892
|
async query(params, sql, _namedParams) {
|
|
@@ -113735,10 +113896,12 @@ The business logic type for this connector is "sql".
|
|
|
113735
113896
|
});
|
|
113736
113897
|
const sample = unwrapSampleLimit(sql);
|
|
113737
113898
|
if (sample) {
|
|
113738
|
-
const result = await runMssqlQuery(parsed, sample.inner
|
|
113899
|
+
const result = await runMssqlQuery(parsed, sample.inner, {
|
|
113900
|
+
tunnelParams: params
|
|
113901
|
+
});
|
|
113739
113902
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
113740
113903
|
}
|
|
113741
|
-
return runMssqlQuery(parsed, sql);
|
|
113904
|
+
return runMssqlQuery(parsed, sql, { tunnelParams: params });
|
|
113742
113905
|
}
|
|
113743
113906
|
});
|
|
113744
113907
|
|
|
@@ -113784,7 +113947,8 @@ var parameters73 = {
|
|
|
113784
113947
|
type: "text",
|
|
113785
113948
|
secret: true,
|
|
113786
113949
|
required: false
|
|
113787
|
-
})
|
|
113950
|
+
}),
|
|
113951
|
+
...sshTunnelParameters
|
|
113788
113952
|
};
|
|
113789
113953
|
|
|
113790
113954
|
// ../connectors/src/connectors/azure-sql/tools/execute-query.ts
|
|
@@ -113843,7 +114007,10 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
113843
114007
|
};
|
|
113844
114008
|
}
|
|
113845
114009
|
try {
|
|
113846
|
-
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
114010
|
+
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
114011
|
+
forceEncrypt: true,
|
|
114012
|
+
tunnelParams: connectionParamsToRecord(connection)
|
|
114013
|
+
});
|
|
113847
114014
|
const truncated = rows.length > MAX_ROWS15;
|
|
113848
114015
|
return {
|
|
113849
114016
|
success: true,
|
|
@@ -113868,7 +114035,7 @@ var azureSqlConnector = new ConnectorPlugin({
|
|
|
113868
114035
|
description: "Connect to Azure SQL Database (managed) using a JDBC-style URL. Encryption is enforced automatically.",
|
|
113869
114036
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5TL0yBbxoLlk6jFZuiHl8w/55040f52d57bf0b77a2215c985c5a772/azure-sql-icon.png",
|
|
113870
114037
|
parameters: parameters73,
|
|
113871
|
-
releaseFlag: { dev1: true, dev2:
|
|
114038
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
113872
114039
|
categories: ["database"],
|
|
113873
114040
|
onboarding: azureSqlOnboarding,
|
|
113874
114041
|
systemPrompt: {
|
|
@@ -113915,7 +114082,7 @@ The business logic type for this connector is "sql".
|
|
|
113915
114082
|
username: params[parameters73.username.slug],
|
|
113916
114083
|
password: params[parameters73.password.slug]
|
|
113917
114084
|
},
|
|
113918
|
-
{ forceEncrypt: true }
|
|
114085
|
+
{ forceEncrypt: true, tunnelParams: params }
|
|
113919
114086
|
);
|
|
113920
114087
|
},
|
|
113921
114088
|
async query(params, sql, _namedParams) {
|
|
@@ -113926,11 +114093,353 @@ The business logic type for this connector is "sql".
|
|
|
113926
114093
|
const sample = unwrapSampleLimit(sql);
|
|
113927
114094
|
if (sample) {
|
|
113928
114095
|
const result = await runMssqlQuery(parsed, sample.inner, {
|
|
113929
|
-
forceEncrypt: true
|
|
114096
|
+
forceEncrypt: true,
|
|
114097
|
+
tunnelParams: params
|
|
113930
114098
|
});
|
|
113931
114099
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
113932
114100
|
}
|
|
113933
|
-
return runMssqlQuery(parsed, sql, {
|
|
114101
|
+
return runMssqlQuery(parsed, sql, {
|
|
114102
|
+
forceEncrypt: true,
|
|
114103
|
+
tunnelParams: params
|
|
114104
|
+
});
|
|
114105
|
+
}
|
|
114106
|
+
});
|
|
114107
|
+
|
|
114108
|
+
// ../connectors/src/connectors/cosmosdb/setup.ts
|
|
114109
|
+
var cosmosdbOnboarding = new ConnectorOnboarding({
|
|
114110
|
+
dataOverviewInstructions: {
|
|
114111
|
+
en: `1. Use cosmosdb_listContainers to list all containers in the configured database
|
|
114112
|
+
2. For key containers, sample documents with cosmosdb_query: container="users", sql="SELECT TOP 5 * FROM c"
|
|
114113
|
+
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)
|
|
114114
|
+
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\``,
|
|
114115
|
+
ja: `1. cosmosdb_listContainers \u3067\u5BFE\u8C61\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5185\u306E\u30B3\u30F3\u30C6\u30CA\u4E00\u89A7\u3092\u53D6\u5F97
|
|
114116
|
+
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"
|
|
114117
|
+
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
|
|
114118
|
+
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\``
|
|
114119
|
+
}
|
|
114120
|
+
});
|
|
114121
|
+
|
|
114122
|
+
// ../connectors/src/connectors/cosmosdb/parameters.ts
|
|
114123
|
+
var parameters74 = {
|
|
114124
|
+
endpoint: new ParameterDefinition({
|
|
114125
|
+
slug: "endpoint",
|
|
114126
|
+
name: "Cosmos DB Endpoint",
|
|
114127
|
+
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.",
|
|
114128
|
+
envVarBaseKey: "COSMOSDB_ENDPOINT",
|
|
114129
|
+
type: "text",
|
|
114130
|
+
secret: false,
|
|
114131
|
+
required: true
|
|
114132
|
+
}),
|
|
114133
|
+
key: new ParameterDefinition({
|
|
114134
|
+
slug: "key",
|
|
114135
|
+
name: "Account Key",
|
|
114136
|
+
description: "Cosmos DB account key (primary or secondary master key). Use a read-only key when only querying data.",
|
|
114137
|
+
envVarBaseKey: "COSMOSDB_KEY",
|
|
114138
|
+
type: "text",
|
|
114139
|
+
secret: true,
|
|
114140
|
+
required: true
|
|
114141
|
+
}),
|
|
114142
|
+
database: new ParameterDefinition({
|
|
114143
|
+
slug: "database",
|
|
114144
|
+
name: "Database",
|
|
114145
|
+
description: "The Cosmos DB database (a.k.a. database account namespace) to connect to.",
|
|
114146
|
+
envVarBaseKey: "COSMOSDB_DATABASE",
|
|
114147
|
+
type: "text",
|
|
114148
|
+
secret: false,
|
|
114149
|
+
required: true
|
|
114150
|
+
})
|
|
114151
|
+
};
|
|
114152
|
+
|
|
114153
|
+
// ../connectors/src/connectors/cosmosdb/tools/list-containers.ts
|
|
114154
|
+
import { z as z90 } from "zod";
|
|
114155
|
+
var inputSchema90 = z90.object({
|
|
114156
|
+
toolUseIntent: z90.string().optional().describe(
|
|
114157
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
114158
|
+
),
|
|
114159
|
+
connectionId: z90.string().describe("ID of the Cosmos DB connection to use")
|
|
114160
|
+
});
|
|
114161
|
+
var outputSchema90 = z90.discriminatedUnion("success", [
|
|
114162
|
+
z90.object({
|
|
114163
|
+
success: z90.literal(true),
|
|
114164
|
+
containers: z90.array(
|
|
114165
|
+
z90.object({
|
|
114166
|
+
id: z90.string(),
|
|
114167
|
+
partitionKey: z90.array(z90.string()).optional()
|
|
114168
|
+
})
|
|
114169
|
+
)
|
|
114170
|
+
}),
|
|
114171
|
+
z90.object({
|
|
114172
|
+
success: z90.literal(false),
|
|
114173
|
+
error: z90.string()
|
|
114174
|
+
})
|
|
114175
|
+
]);
|
|
114176
|
+
var listContainersTool = new ConnectorTool({
|
|
114177
|
+
name: "listContainers",
|
|
114178
|
+
description: `List all containers in the configured Cosmos DB database.
|
|
114179
|
+
Use this as the first step to explore the data structure. Returns container ids and their partition key paths.
|
|
114180
|
+
After listing containers, use the query tool to sample items and understand each container's schema.`,
|
|
114181
|
+
inputSchema: inputSchema90,
|
|
114182
|
+
outputSchema: outputSchema90,
|
|
114183
|
+
async execute({ connectionId }, connections) {
|
|
114184
|
+
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114185
|
+
if (!connection) {
|
|
114186
|
+
return {
|
|
114187
|
+
success: false,
|
|
114188
|
+
error: `Connection ${connectionId} not found`
|
|
114189
|
+
};
|
|
114190
|
+
}
|
|
114191
|
+
console.log(
|
|
114192
|
+
`[connector-query] cosmosdb/${connection.name}: listContainers`
|
|
114193
|
+
);
|
|
114194
|
+
let key;
|
|
114195
|
+
try {
|
|
114196
|
+
const { CosmosClient } = await import("@azure/cosmos");
|
|
114197
|
+
const endpoint = parameters74.endpoint.getValue(connection);
|
|
114198
|
+
key = parameters74.key.getValue(connection);
|
|
114199
|
+
const database = parameters74.database.getValue(connection);
|
|
114200
|
+
const client = new CosmosClient({ endpoint, key });
|
|
114201
|
+
const db = client.database(database);
|
|
114202
|
+
const { resources } = await db.containers.readAll().fetchAll();
|
|
114203
|
+
return {
|
|
114204
|
+
success: true,
|
|
114205
|
+
containers: resources.map((c6) => ({
|
|
114206
|
+
id: c6.id,
|
|
114207
|
+
partitionKey: extractPartitionKeyPaths(c6.partitionKey)
|
|
114208
|
+
}))
|
|
114209
|
+
};
|
|
114210
|
+
} catch (err) {
|
|
114211
|
+
let msg = err instanceof Error ? err.message : String(err);
|
|
114212
|
+
if (key) msg = msg.replaceAll(key, "***");
|
|
114213
|
+
return { success: false, error: msg };
|
|
114214
|
+
}
|
|
114215
|
+
}
|
|
114216
|
+
});
|
|
114217
|
+
function extractPartitionKeyPaths(partitionKey) {
|
|
114218
|
+
if (!partitionKey || typeof partitionKey !== "object") return void 0;
|
|
114219
|
+
const paths = partitionKey.paths;
|
|
114220
|
+
if (!Array.isArray(paths)) return void 0;
|
|
114221
|
+
return paths.filter((p2) => typeof p2 === "string");
|
|
114222
|
+
}
|
|
114223
|
+
|
|
114224
|
+
// ../connectors/src/connectors/cosmosdb/tools/query.ts
|
|
114225
|
+
import { z as z91 } from "zod";
|
|
114226
|
+
var MAX_DOCUMENTS3 = 500;
|
|
114227
|
+
var inputSchema91 = z91.object({
|
|
114228
|
+
toolUseIntent: z91.string().optional().describe(
|
|
114229
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
114230
|
+
),
|
|
114231
|
+
connectionId: z91.string().describe("ID of the Cosmos DB connection to use"),
|
|
114232
|
+
container: z91.string().describe("Id of the container (a.k.a. collection) to query"),
|
|
114233
|
+
sql: z91.string().describe(
|
|
114234
|
+
"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`."
|
|
114235
|
+
),
|
|
114236
|
+
partitionKey: z91.string().optional().describe(
|
|
114237
|
+
`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.`
|
|
114238
|
+
)
|
|
114239
|
+
});
|
|
114240
|
+
var outputSchema91 = z91.discriminatedUnion("success", [
|
|
114241
|
+
z91.object({
|
|
114242
|
+
success: z91.literal(true),
|
|
114243
|
+
documentCount: z91.number(),
|
|
114244
|
+
truncated: z91.boolean(),
|
|
114245
|
+
requestCharge: z91.number().optional(),
|
|
114246
|
+
documents: z91.array(z91.unknown())
|
|
114247
|
+
}),
|
|
114248
|
+
z91.object({
|
|
114249
|
+
success: z91.literal(false),
|
|
114250
|
+
error: z91.string()
|
|
114251
|
+
})
|
|
114252
|
+
]);
|
|
114253
|
+
var queryTool = new ConnectorTool({
|
|
114254
|
+
name: "query",
|
|
114255
|
+
description: `Execute a Cosmos DB SQL (Core / NoSQL API) query against a container. Returns up to ${MAX_DOCUMENTS3} items.
|
|
114256
|
+
Use for: schema exploration, data sampling, aggregations, and analytical queries.
|
|
114257
|
+
Cosmos DB SQL targets a single container; reference items via the alias \`c\` (e.g. \`SELECT c.id FROM c WHERE c.userId = 'abc'\`).
|
|
114258
|
+
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.`,
|
|
114259
|
+
inputSchema: inputSchema91,
|
|
114260
|
+
outputSchema: outputSchema91,
|
|
114261
|
+
async execute({ connectionId, container, sql, partitionKey }, connections) {
|
|
114262
|
+
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114263
|
+
if (!connection) {
|
|
114264
|
+
return {
|
|
114265
|
+
success: false,
|
|
114266
|
+
error: `Connection ${connectionId} not found`
|
|
114267
|
+
};
|
|
114268
|
+
}
|
|
114269
|
+
console.log(
|
|
114270
|
+
`[connector-query] cosmosdb/${connection.name} (${container}): ${sql}`
|
|
114271
|
+
);
|
|
114272
|
+
let key;
|
|
114273
|
+
try {
|
|
114274
|
+
const cosmos = await import("@azure/cosmos");
|
|
114275
|
+
const { CosmosClient } = cosmos;
|
|
114276
|
+
const endpoint = parameters74.endpoint.getValue(connection);
|
|
114277
|
+
key = parameters74.key.getValue(connection);
|
|
114278
|
+
const database = parameters74.database.getValue(connection);
|
|
114279
|
+
const client = new CosmosClient({ endpoint, key });
|
|
114280
|
+
const cont = client.database(database).container(container);
|
|
114281
|
+
const queryOptions = {
|
|
114282
|
+
// Bound by the connector's own row cap, but keep the SDK from
|
|
114283
|
+
// streaming arbitrarily large continuations.
|
|
114284
|
+
maxItemCount: MAX_DOCUMENTS3 + 1
|
|
114285
|
+
};
|
|
114286
|
+
if (partitionKey != null && partitionKey !== "") {
|
|
114287
|
+
try {
|
|
114288
|
+
queryOptions.partitionKey = JSON.parse(partitionKey);
|
|
114289
|
+
} catch {
|
|
114290
|
+
return {
|
|
114291
|
+
success: false,
|
|
114292
|
+
error: `Invalid partitionKey: must be a JSON-encoded scalar (e.g. '"abc"' or '123'). Got: ${partitionKey}`
|
|
114293
|
+
};
|
|
114294
|
+
}
|
|
114295
|
+
}
|
|
114296
|
+
const iterator = cont.items.query(sql, queryOptions);
|
|
114297
|
+
const { resources, requestCharge } = await iterator.fetchNext();
|
|
114298
|
+
const documents = resources ?? [];
|
|
114299
|
+
const truncated = documents.length > MAX_DOCUMENTS3;
|
|
114300
|
+
return {
|
|
114301
|
+
success: true,
|
|
114302
|
+
documentCount: Math.min(documents.length, MAX_DOCUMENTS3),
|
|
114303
|
+
truncated,
|
|
114304
|
+
requestCharge,
|
|
114305
|
+
documents: documents.slice(0, MAX_DOCUMENTS3)
|
|
114306
|
+
};
|
|
114307
|
+
} catch (err) {
|
|
114308
|
+
let msg = err instanceof Error ? err.message : String(err);
|
|
114309
|
+
if (key) msg = msg.replaceAll(key, "***");
|
|
114310
|
+
return { success: false, error: msg };
|
|
114311
|
+
}
|
|
114312
|
+
}
|
|
114313
|
+
});
|
|
114314
|
+
|
|
114315
|
+
// ../connectors/src/connectors/cosmosdb/index.ts
|
|
114316
|
+
var tools74 = {
|
|
114317
|
+
listContainers: listContainersTool,
|
|
114318
|
+
query: queryTool
|
|
114319
|
+
};
|
|
114320
|
+
var cosmosdbConnector = new ConnectorPlugin({
|
|
114321
|
+
slug: "cosmosdb",
|
|
114322
|
+
authType: AUTH_TYPES.USER_PASSWORD,
|
|
114323
|
+
name: "Azure Cosmos DB",
|
|
114324
|
+
description: "Connect to Azure Cosmos DB (Core / NoSQL API) for document-oriented data storage and SQL-style querying.",
|
|
114325
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5p9B2Db0V2d8mK2jgBWtZu/dad72db8f41b16c50de2bcef03f9d415/cosmosdb-icon.png",
|
|
114326
|
+
parameters: parameters74,
|
|
114327
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114328
|
+
categories: ["database"],
|
|
114329
|
+
onboarding: cosmosdbOnboarding,
|
|
114330
|
+
systemPrompt: {
|
|
114331
|
+
en: `### Tools
|
|
114332
|
+
|
|
114333
|
+
- \`cosmosdb_listContainers\`: Lists all containers in the configured database, with their partition key paths. Use this first to explore available data.
|
|
114334
|
+
- \`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).
|
|
114335
|
+
|
|
114336
|
+
### Business Logic
|
|
114337
|
+
|
|
114338
|
+
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.
|
|
114339
|
+
|
|
114340
|
+
\u26A0\uFE0F **The client returned by \`connection(connectionId)\` is NOT the raw \`@azure/cosmos\` \`CosmosClient\`.** It is a thin wrapper exposing only two methods:
|
|
114341
|
+
- \`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 }\`.
|
|
114342
|
+
- \`client.listContainers() => Promise<{ id: string; partitionKey?: string[] }[]>\` \u2014 lists containers in the configured database.
|
|
114343
|
+
|
|
114344
|
+
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\`.
|
|
114345
|
+
|
|
114346
|
+
\`\`\`ts
|
|
114347
|
+
import type { Context } from "hono";
|
|
114348
|
+
import { connection } from "@squadbase/vite-server/connectors/cosmosdb";
|
|
114349
|
+
|
|
114350
|
+
const cosmos = connection("<connectionId>");
|
|
114351
|
+
|
|
114352
|
+
export default async function handler(_c: Context) {
|
|
114353
|
+
// \`query\` returns the items array directly \u2014 no \`.resources\` to unwrap.
|
|
114354
|
+
const rows = await cosmos.query<{ prod: string; orderCount: number }>(
|
|
114355
|
+
"<containerName>",
|
|
114356
|
+
"SELECT c.prod, COUNT(1) AS orderCount FROM c GROUP BY c.prod",
|
|
114357
|
+
// Optional: scope to a single partition to save RUs.
|
|
114358
|
+
// { partitionKey: "<partitionKeyValue>" },
|
|
114359
|
+
);
|
|
114360
|
+
|
|
114361
|
+
rows.sort((a, b) => Number(b.orderCount) - Number(a.orderCount));
|
|
114362
|
+
|
|
114363
|
+
return new Response(JSON.stringify(rows), {
|
|
114364
|
+
headers: { "Content-Type": "application/json" },
|
|
114365
|
+
});
|
|
114366
|
+
}
|
|
114367
|
+
\`\`\`
|
|
114368
|
+
|
|
114369
|
+
### Cosmos DB SQL Reference
|
|
114370
|
+
- Cosmos DB stores schema-flexible JSON items in **containers** organised under a **database**. Items are partitioned by a per-container partition key path.
|
|
114371
|
+
- 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'\`).
|
|
114372
|
+
- 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.
|
|
114373
|
+
- System fields are prefixed with an underscore (\`c.id\`, \`c._ts\` for the modification timestamp, \`c._etag\`).
|
|
114374
|
+
- 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\`).
|
|
114375
|
+
- Joins: only **intra-document** joins via \`JOIN\` over arrays inside the same item; there is no cross-container/cross-document join.
|
|
114376
|
+
- Always bound results with \`TOP n\` and prefer scoped queries with a \`partitionKey\` value when possible \u2014 cross-partition queries cost more RUs.`,
|
|
114377
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
114378
|
+
|
|
114379
|
+
- \`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
|
|
114380
|
+
- \`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
|
|
114381
|
+
|
|
114382
|
+
### Business Logic
|
|
114383
|
+
|
|
114384
|
+
\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
|
|
114385
|
+
|
|
114386
|
+
\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
|
|
114387
|
+
- \`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
|
|
114388
|
+
- \`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
|
|
114389
|
+
|
|
114390
|
+
\`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
|
|
114391
|
+
|
|
114392
|
+
\`\`\`ts
|
|
114393
|
+
import type { Context } from "hono";
|
|
114394
|
+
import { connection } from "@squadbase/vite-server/connectors/cosmosdb";
|
|
114395
|
+
|
|
114396
|
+
const cosmos = connection("<connectionId>");
|
|
114397
|
+
|
|
114398
|
+
export default async function handler(_c: Context) {
|
|
114399
|
+
// \`query\` \u306F items \u914D\u5217\u3092\u305D\u306E\u307E\u307E\u8FD4\u3059 \u2014 \`.resources\` \u306E\u5C55\u958B\u306F\u4E0D\u8981\u3002
|
|
114400
|
+
const rows = await cosmos.query<{ prod: string; orderCount: number }>(
|
|
114401
|
+
"<containerName>",
|
|
114402
|
+
"SELECT c.prod, COUNT(1) AS orderCount FROM c GROUP BY c.prod",
|
|
114403
|
+
// \u4EFB\u610F: \u5358\u4E00\u30D1\u30FC\u30C6\u30A3\u30B7\u30E7\u30F3\u306B\u30B9\u30B3\u30FC\u30D7\u3057\u3066 RU \u3092\u7BC0\u7D04\u3002
|
|
114404
|
+
// { partitionKey: "<partitionKeyValue>" },
|
|
114405
|
+
);
|
|
114406
|
+
|
|
114407
|
+
rows.sort((a, b) => Number(b.orderCount) - Number(a.orderCount));
|
|
114408
|
+
|
|
114409
|
+
return new Response(JSON.stringify(rows), {
|
|
114410
|
+
headers: { "Content-Type": "application/json" },
|
|
114411
|
+
});
|
|
114412
|
+
}
|
|
114413
|
+
\`\`\`
|
|
114414
|
+
|
|
114415
|
+
### Cosmos DB SQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
114416
|
+
- 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
|
|
114417
|
+
- \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
|
|
114418
|
+
- \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
|
|
114419
|
+
- \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
|
|
114420
|
+
- \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
|
|
114421
|
+
- \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
|
|
114422
|
+
- \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`
|
|
114423
|
+
},
|
|
114424
|
+
tools: tools74,
|
|
114425
|
+
async checkConnection(params, _config) {
|
|
114426
|
+
try {
|
|
114427
|
+
const { CosmosClient } = await import("@azure/cosmos");
|
|
114428
|
+
const client = new CosmosClient({
|
|
114429
|
+
endpoint: params[parameters74.endpoint.slug],
|
|
114430
|
+
key: params[parameters74.key.slug]
|
|
114431
|
+
});
|
|
114432
|
+
const database = params[parameters74.database.slug];
|
|
114433
|
+
await client.database(database).read();
|
|
114434
|
+
return { success: true };
|
|
114435
|
+
} catch (error2) {
|
|
114436
|
+
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
114437
|
+
const key = params[parameters74.key.slug];
|
|
114438
|
+
return {
|
|
114439
|
+
success: false,
|
|
114440
|
+
error: key ? msg.replaceAll(key, "***") : msg
|
|
114441
|
+
};
|
|
114442
|
+
}
|
|
113934
114443
|
}
|
|
113935
114444
|
});
|
|
113936
114445
|
|
|
@@ -113951,7 +114460,7 @@ var oracleOnboarding = new ConnectorOnboarding({
|
|
|
113951
114460
|
});
|
|
113952
114461
|
|
|
113953
114462
|
// ../connectors/src/connectors/oracle/parameters.ts
|
|
113954
|
-
var
|
|
114463
|
+
var parameters75 = {
|
|
113955
114464
|
jdbcUrl: new ParameterDefinition({
|
|
113956
114465
|
slug: "jdbc-url",
|
|
113957
114466
|
name: "Oracle JDBC URL",
|
|
@@ -113978,31 +114487,32 @@ var parameters74 = {
|
|
|
113978
114487
|
type: "text",
|
|
113979
114488
|
secret: true,
|
|
113980
114489
|
required: false
|
|
113981
|
-
})
|
|
114490
|
+
}),
|
|
114491
|
+
...sshTunnelParameters
|
|
113982
114492
|
};
|
|
113983
114493
|
|
|
113984
114494
|
// ../connectors/src/connectors/oracle/tools/execute-query.ts
|
|
113985
|
-
import { z as
|
|
114495
|
+
import { z as z92 } from "zod";
|
|
113986
114496
|
var MAX_ROWS16 = 500;
|
|
113987
|
-
var
|
|
113988
|
-
toolUseIntent:
|
|
114497
|
+
var inputSchema92 = z92.object({
|
|
114498
|
+
toolUseIntent: z92.string().optional().describe(
|
|
113989
114499
|
"Brief description of what you intend to accomplish with this tool call"
|
|
113990
114500
|
),
|
|
113991
|
-
connectionId:
|
|
113992
|
-
sql:
|
|
114501
|
+
connectionId: z92.string().describe("ID of the Oracle connection to use"),
|
|
114502
|
+
sql: z92.string().describe(
|
|
113993
114503
|
"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."
|
|
113994
114504
|
)
|
|
113995
114505
|
});
|
|
113996
|
-
var
|
|
113997
|
-
|
|
113998
|
-
success:
|
|
113999
|
-
rowCount:
|
|
114000
|
-
truncated:
|
|
114001
|
-
rows:
|
|
114506
|
+
var outputSchema92 = z92.discriminatedUnion("success", [
|
|
114507
|
+
z92.object({
|
|
114508
|
+
success: z92.literal(true),
|
|
114509
|
+
rowCount: z92.number(),
|
|
114510
|
+
truncated: z92.boolean(),
|
|
114511
|
+
rows: z92.array(z92.record(z92.string(), z92.unknown()))
|
|
114002
114512
|
}),
|
|
114003
|
-
|
|
114004
|
-
success:
|
|
114005
|
-
error:
|
|
114513
|
+
z92.object({
|
|
114514
|
+
success: z92.literal(false),
|
|
114515
|
+
error: z92.string()
|
|
114006
114516
|
})
|
|
114007
114517
|
]);
|
|
114008
114518
|
var executeQueryTool16 = new ConnectorTool({
|
|
@@ -114012,8 +114522,8 @@ Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_T
|
|
|
114012
114522
|
Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
|
|
114013
114523
|
Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
|
|
114014
114524
|
Do NOT terminate statements with a semicolon; the driver rejects trailing terminators.`,
|
|
114015
|
-
inputSchema:
|
|
114016
|
-
outputSchema:
|
|
114525
|
+
inputSchema: inputSchema92,
|
|
114526
|
+
outputSchema: outputSchema92,
|
|
114017
114527
|
async execute({ connectionId, sql }, connections) {
|
|
114018
114528
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114019
114529
|
if (!connection) {
|
|
@@ -114022,9 +114532,9 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
114022
114532
|
error: `Connection ${connectionId} not found`
|
|
114023
114533
|
};
|
|
114024
114534
|
}
|
|
114025
|
-
const jdbcUrl =
|
|
114026
|
-
const username =
|
|
114027
|
-
const password =
|
|
114535
|
+
const jdbcUrl = parameters75.jdbcUrl.getValue(connection);
|
|
114536
|
+
const username = parameters75.username.tryGetValue(connection);
|
|
114537
|
+
const password = parameters75.password.tryGetValue(connection);
|
|
114028
114538
|
console.log(
|
|
114029
114539
|
`[connector-query] oracle/${connection.name} (${redactOracleUrl(jdbcUrl)}): ${sql}`
|
|
114030
114540
|
);
|
|
@@ -114039,7 +114549,9 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
114039
114549
|
}
|
|
114040
114550
|
try {
|
|
114041
114551
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
114042
|
-
const { rows } = await runOracleQuery(parsed, cleanSql
|
|
114552
|
+
const { rows } = await runOracleQuery(parsed, cleanSql, {
|
|
114553
|
+
tunnelParams: connectionParamsToRecord(connection)
|
|
114554
|
+
});
|
|
114043
114555
|
const truncated = rows.length > MAX_ROWS16;
|
|
114044
114556
|
return {
|
|
114045
114557
|
success: true,
|
|
@@ -114056,14 +114568,14 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
114056
114568
|
});
|
|
114057
114569
|
|
|
114058
114570
|
// ../connectors/src/connectors/oracle/index.ts
|
|
114059
|
-
var
|
|
114571
|
+
var tools75 = { executeQuery: executeQueryTool16 };
|
|
114060
114572
|
var oracleConnector = new ConnectorPlugin({
|
|
114061
114573
|
slug: "oracle",
|
|
114062
114574
|
authType: AUTH_TYPES.USER_PASSWORD,
|
|
114063
114575
|
name: "Oracle Database",
|
|
114064
114576
|
description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
|
|
114065
114577
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
|
|
114066
|
-
parameters:
|
|
114578
|
+
parameters: parameters75,
|
|
114067
114579
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
114068
114580
|
categories: ["database"],
|
|
114069
114581
|
onboarding: oracleOnboarding,
|
|
@@ -114107,26 +114619,32 @@ The business logic type for this connector is "sql".
|
|
|
114107
114619
|
- \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
|
|
114108
114620
|
- \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`
|
|
114109
114621
|
},
|
|
114110
|
-
tools:
|
|
114622
|
+
tools: tools75,
|
|
114111
114623
|
async checkConnection(params, _config) {
|
|
114112
|
-
return checkOracleConnection(
|
|
114113
|
-
|
|
114114
|
-
|
|
114115
|
-
|
|
114624
|
+
return checkOracleConnection(
|
|
114625
|
+
params[parameters75.jdbcUrl.slug],
|
|
114626
|
+
{
|
|
114627
|
+
username: params[parameters75.username.slug],
|
|
114628
|
+
password: params[parameters75.password.slug]
|
|
114629
|
+
},
|
|
114630
|
+
{ tunnelParams: params }
|
|
114631
|
+
);
|
|
114116
114632
|
},
|
|
114117
114633
|
async query(params, sql, _namedParams) {
|
|
114118
|
-
const parsed = parseOracleJdbcUrl(params[
|
|
114119
|
-
username: params[
|
|
114120
|
-
password: params[
|
|
114634
|
+
const parsed = parseOracleJdbcUrl(params[parameters75.jdbcUrl.slug], {
|
|
114635
|
+
username: params[parameters75.username.slug],
|
|
114636
|
+
password: params[parameters75.password.slug]
|
|
114121
114637
|
});
|
|
114122
114638
|
const sample = unwrapSampleLimit(sql);
|
|
114123
114639
|
if (sample) {
|
|
114124
114640
|
const inner = sample.inner.replace(/;\s*$/, "");
|
|
114125
|
-
const result = await runOracleQuery(parsed, inner
|
|
114641
|
+
const result = await runOracleQuery(parsed, inner, {
|
|
114642
|
+
tunnelParams: params
|
|
114643
|
+
});
|
|
114126
114644
|
return { rows: result.rows.slice(0, sample.limit) };
|
|
114127
114645
|
}
|
|
114128
114646
|
const cleanSql = sql.replace(/;\s*$/, "");
|
|
114129
|
-
return runOracleQuery(parsed, cleanSql);
|
|
114647
|
+
return runOracleQuery(parsed, cleanSql, { tunnelParams: params });
|
|
114130
114648
|
}
|
|
114131
114649
|
});
|
|
114132
114650
|
|
|
@@ -114147,7 +114665,7 @@ var freshserviceOnboarding = new ConnectorOnboarding({
|
|
|
114147
114665
|
});
|
|
114148
114666
|
|
|
114149
114667
|
// ../connectors/src/connectors/freshservice/parameters.ts
|
|
114150
|
-
var
|
|
114668
|
+
var parameters76 = {
|
|
114151
114669
|
domain: new ParameterDefinition({
|
|
114152
114670
|
slug: "domain",
|
|
114153
114671
|
name: "Freshservice Domain",
|
|
@@ -114169,7 +114687,7 @@ var parameters75 = {
|
|
|
114169
114687
|
};
|
|
114170
114688
|
|
|
114171
114689
|
// ../connectors/src/connectors/freshservice/tools/request.ts
|
|
114172
|
-
import { z as
|
|
114690
|
+
import { z as z93 } from "zod";
|
|
114173
114691
|
var BASE_PATH_SEGMENT12 = "/api/v2";
|
|
114174
114692
|
var REQUEST_TIMEOUT_MS70 = 6e4;
|
|
114175
114693
|
function buildBaseUrl(domain) {
|
|
@@ -114180,33 +114698,33 @@ function buildBaseUrl(domain) {
|
|
|
114180
114698
|
function basicAuthHeader(apiKey) {
|
|
114181
114699
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
114182
114700
|
}
|
|
114183
|
-
var
|
|
114184
|
-
toolUseIntent:
|
|
114701
|
+
var inputSchema93 = z93.object({
|
|
114702
|
+
toolUseIntent: z93.string().optional().describe(
|
|
114185
114703
|
"Brief description of what you intend to accomplish with this tool call"
|
|
114186
114704
|
),
|
|
114187
|
-
connectionId:
|
|
114188
|
-
method:
|
|
114705
|
+
connectionId: z93.string().describe("ID of the Freshservice connection to use"),
|
|
114706
|
+
method: z93.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
114189
114707
|
"HTTP method. GET for reading resources, POST for creating, PUT for updating, DELETE for removing."
|
|
114190
114708
|
),
|
|
114191
|
-
path:
|
|
114709
|
+
path: z93.string().describe(
|
|
114192
114710
|
"API path (e.g., '/tickets', '/tickets/123', '/agents'). Append query parameters such as '?per_page=100&page=1' for pagination."
|
|
114193
114711
|
),
|
|
114194
|
-
body:
|
|
114712
|
+
body: z93.record(z93.string(), z93.unknown()).optional().describe(
|
|
114195
114713
|
'Request body (JSON) for POST/PUT requests. Example: { "subject": "...", "description": "...", "email": "...", "priority": 2, "status": 2, "source": 2 }.'
|
|
114196
114714
|
)
|
|
114197
114715
|
});
|
|
114198
|
-
var
|
|
114199
|
-
|
|
114200
|
-
success:
|
|
114201
|
-
status:
|
|
114202
|
-
data:
|
|
114203
|
-
|
|
114204
|
-
|
|
114716
|
+
var outputSchema93 = z93.discriminatedUnion("success", [
|
|
114717
|
+
z93.object({
|
|
114718
|
+
success: z93.literal(true),
|
|
114719
|
+
status: z93.number(),
|
|
114720
|
+
data: z93.union([
|
|
114721
|
+
z93.record(z93.string(), z93.unknown()),
|
|
114722
|
+
z93.array(z93.unknown())
|
|
114205
114723
|
])
|
|
114206
114724
|
}),
|
|
114207
|
-
|
|
114208
|
-
success:
|
|
114209
|
-
error:
|
|
114725
|
+
z93.object({
|
|
114726
|
+
success: z93.literal(false),
|
|
114727
|
+
error: z93.string()
|
|
114210
114728
|
})
|
|
114211
114729
|
]);
|
|
114212
114730
|
var requestTool52 = new ConnectorTool({
|
|
@@ -114237,8 +114755,8 @@ Field codes:
|
|
|
114237
114755
|
- ticket priority: 1 Low, 2 Medium, 3 High, 4 Urgent
|
|
114238
114756
|
- ticket status: 2 Open, 3 Pending, 4 Resolved, 5 Closed
|
|
114239
114757
|
- ticket source: 1 Email, 2 Portal, 3 Phone, 4 Chat, 5 Feedback widget, 7 Yammer, 8 AwsCloudwatch, 9 Pagerduty, 10 Walkup, 11 Slack`,
|
|
114240
|
-
inputSchema:
|
|
114241
|
-
outputSchema:
|
|
114758
|
+
inputSchema: inputSchema93,
|
|
114759
|
+
outputSchema: outputSchema93,
|
|
114242
114760
|
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
114243
114761
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114244
114762
|
if (!connection) {
|
|
@@ -114251,8 +114769,8 @@ Field codes:
|
|
|
114251
114769
|
`[connector-request] freshservice/${connection.name}: ${method} ${path5}`
|
|
114252
114770
|
);
|
|
114253
114771
|
try {
|
|
114254
|
-
const apiKey =
|
|
114255
|
-
const domain =
|
|
114772
|
+
const apiKey = parameters76.apiKey.getValue(connection);
|
|
114773
|
+
const domain = parameters76.domain.getValue(connection);
|
|
114256
114774
|
const baseUrl = buildBaseUrl(domain);
|
|
114257
114775
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT12);
|
|
114258
114776
|
const url = `${baseUrl}${normalizedPath}`;
|
|
@@ -114291,14 +114809,14 @@ Field codes:
|
|
|
114291
114809
|
});
|
|
114292
114810
|
|
|
114293
114811
|
// ../connectors/src/connectors/freshservice/index.ts
|
|
114294
|
-
var
|
|
114812
|
+
var tools76 = { request: requestTool52 };
|
|
114295
114813
|
var freshserviceConnector = new ConnectorPlugin({
|
|
114296
114814
|
slug: "freshservice",
|
|
114297
114815
|
authType: AUTH_TYPES.API_KEY,
|
|
114298
114816
|
name: "Freshservice",
|
|
114299
114817
|
description: "Connect to Freshservice (ITSM) for ticket, agent, asset, and ITIL workflow data via API key.",
|
|
114300
114818
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6Tj64HZOoIrGgQYDayBosY/3f45b29d3479726b5d245ac38d5a7036/freshservice-icon.svg",
|
|
114301
|
-
parameters:
|
|
114819
|
+
parameters: parameters76,
|
|
114302
114820
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114303
114821
|
categories: ["productivity"],
|
|
114304
114822
|
onboarding: freshserviceOnboarding,
|
|
@@ -114456,7 +114974,7 @@ export default async function handler(c: Context) {
|
|
|
114456
114974
|
- \`status\`: 2=Open, 3=Pending, 4=Resolved, 5=Closed
|
|
114457
114975
|
- \`source\`: 1=Email, 2=Portal, 3=Phone, 4=Chat, 5=Feedback widget, 7=Yammer, 8=AwsCloudwatch, 9=Pagerduty, 10=Walkup, 11=Slack`
|
|
114458
114976
|
},
|
|
114459
|
-
tools:
|
|
114977
|
+
tools: tools76
|
|
114460
114978
|
});
|
|
114461
114979
|
|
|
114462
114980
|
// ../connectors/src/connectors/freshdesk/setup.ts
|
|
@@ -114476,7 +114994,7 @@ var freshdeskOnboarding = new ConnectorOnboarding({
|
|
|
114476
114994
|
});
|
|
114477
114995
|
|
|
114478
114996
|
// ../connectors/src/connectors/freshdesk/parameters.ts
|
|
114479
|
-
var
|
|
114997
|
+
var parameters77 = {
|
|
114480
114998
|
domain: new ParameterDefinition({
|
|
114481
114999
|
slug: "domain",
|
|
114482
115000
|
name: "Freshdesk Domain",
|
|
@@ -114498,7 +115016,7 @@ var parameters76 = {
|
|
|
114498
115016
|
};
|
|
114499
115017
|
|
|
114500
115018
|
// ../connectors/src/connectors/freshdesk/tools/request.ts
|
|
114501
|
-
import { z as
|
|
115019
|
+
import { z as z94 } from "zod";
|
|
114502
115020
|
var BASE_PATH_SEGMENT13 = "/api/v2";
|
|
114503
115021
|
var REQUEST_TIMEOUT_MS71 = 6e4;
|
|
114504
115022
|
function buildBaseUrl2(domain) {
|
|
@@ -114509,33 +115027,33 @@ function buildBaseUrl2(domain) {
|
|
|
114509
115027
|
function basicAuthHeader2(apiKey) {
|
|
114510
115028
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
114511
115029
|
}
|
|
114512
|
-
var
|
|
114513
|
-
toolUseIntent:
|
|
115030
|
+
var inputSchema94 = z94.object({
|
|
115031
|
+
toolUseIntent: z94.string().optional().describe(
|
|
114514
115032
|
"Brief description of what you intend to accomplish with this tool call"
|
|
114515
115033
|
),
|
|
114516
|
-
connectionId:
|
|
114517
|
-
method:
|
|
115034
|
+
connectionId: z94.string().describe("ID of the Freshdesk connection to use"),
|
|
115035
|
+
method: z94.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
114518
115036
|
"HTTP method. GET for reading resources, POST for creating, PUT for updating, DELETE for removing."
|
|
114519
115037
|
),
|
|
114520
|
-
path:
|
|
115038
|
+
path: z94.string().describe(
|
|
114521
115039
|
"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'."
|
|
114522
115040
|
),
|
|
114523
|
-
body:
|
|
115041
|
+
body: z94.record(z94.string(), z94.unknown()).optional().describe(
|
|
114524
115042
|
'Request body (JSON) for POST/PUT requests. Example creating a ticket: { "subject": "...", "description": "...", "email": "...", "priority": 2, "status": 2, "source": 1 }.'
|
|
114525
115043
|
)
|
|
114526
115044
|
});
|
|
114527
|
-
var
|
|
114528
|
-
|
|
114529
|
-
success:
|
|
114530
|
-
status:
|
|
114531
|
-
data:
|
|
114532
|
-
|
|
114533
|
-
|
|
115045
|
+
var outputSchema94 = z94.discriminatedUnion("success", [
|
|
115046
|
+
z94.object({
|
|
115047
|
+
success: z94.literal(true),
|
|
115048
|
+
status: z94.number(),
|
|
115049
|
+
data: z94.union([
|
|
115050
|
+
z94.record(z94.string(), z94.unknown()),
|
|
115051
|
+
z94.array(z94.unknown())
|
|
114534
115052
|
])
|
|
114535
115053
|
}),
|
|
114536
|
-
|
|
114537
|
-
success:
|
|
114538
|
-
error:
|
|
115054
|
+
z94.object({
|
|
115055
|
+
success: z94.literal(false),
|
|
115056
|
+
error: z94.string()
|
|
114539
115057
|
})
|
|
114540
115058
|
]);
|
|
114541
115059
|
var requestTool53 = new ConnectorTool({
|
|
@@ -114566,8 +115084,8 @@ Field codes (tickets):
|
|
|
114566
115084
|
- priority: 1 Low, 2 Medium, 3 High, 4 Urgent
|
|
114567
115085
|
- status: 2 Open, 3 Pending, 4 Resolved, 5 Closed
|
|
114568
115086
|
- source: 1 Email, 2 Portal, 3 Phone, 7 Chat, 9 Feedback widget, 10 Outbound email`,
|
|
114569
|
-
inputSchema:
|
|
114570
|
-
outputSchema:
|
|
115087
|
+
inputSchema: inputSchema94,
|
|
115088
|
+
outputSchema: outputSchema94,
|
|
114571
115089
|
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
114572
115090
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114573
115091
|
if (!connection) {
|
|
@@ -114580,8 +115098,8 @@ Field codes (tickets):
|
|
|
114580
115098
|
`[connector-request] freshdesk/${connection.name}: ${method} ${path5}`
|
|
114581
115099
|
);
|
|
114582
115100
|
try {
|
|
114583
|
-
const apiKey =
|
|
114584
|
-
const domain =
|
|
115101
|
+
const apiKey = parameters77.apiKey.getValue(connection);
|
|
115102
|
+
const domain = parameters77.domain.getValue(connection);
|
|
114585
115103
|
const baseUrl = buildBaseUrl2(domain);
|
|
114586
115104
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT13);
|
|
114587
115105
|
const url = `${baseUrl}${normalizedPath}`;
|
|
@@ -114620,14 +115138,14 @@ Field codes (tickets):
|
|
|
114620
115138
|
});
|
|
114621
115139
|
|
|
114622
115140
|
// ../connectors/src/connectors/freshdesk/index.ts
|
|
114623
|
-
var
|
|
115141
|
+
var tools77 = { request: requestTool53 };
|
|
114624
115142
|
var freshdeskConnector = new ConnectorPlugin({
|
|
114625
115143
|
slug: "freshdesk",
|
|
114626
115144
|
authType: AUTH_TYPES.API_KEY,
|
|
114627
115145
|
name: "Freshdesk",
|
|
114628
115146
|
description: "Connect to Freshdesk for customer support ticket, contact, and company data via API key.",
|
|
114629
115147
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1PSjIfQJgTYmiWriNTx4uE/26905f4120713bda0afd0b23d02a154e/freshdesk-icon.png",
|
|
114630
|
-
parameters:
|
|
115148
|
+
parameters: parameters77,
|
|
114631
115149
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114632
115150
|
categories: ["crm"],
|
|
114633
115151
|
onboarding: freshdeskOnboarding,
|
|
@@ -114787,7 +115305,7 @@ export default async function handler(c: Context) {
|
|
|
114787
115305
|
- \`status\`: 2=Open, 3=Pending, 4=Resolved, 5=Closed
|
|
114788
115306
|
- \`source\`: 1=Email, 2=Portal, 3=Phone, 7=Chat, 9=Feedback widget, 10=Outbound email`
|
|
114789
115307
|
},
|
|
114790
|
-
tools:
|
|
115308
|
+
tools: tools77
|
|
114791
115309
|
});
|
|
114792
115310
|
|
|
114793
115311
|
// ../connectors/src/connectors/freshsales/setup.ts
|
|
@@ -114807,7 +115325,7 @@ var freshsalesOnboarding = new ConnectorOnboarding({
|
|
|
114807
115325
|
});
|
|
114808
115326
|
|
|
114809
115327
|
// ../connectors/src/connectors/freshsales/parameters.ts
|
|
114810
|
-
var
|
|
115328
|
+
var parameters78 = {
|
|
114811
115329
|
bundleAlias: new ParameterDefinition({
|
|
114812
115330
|
slug: "bundle-alias",
|
|
114813
115331
|
name: "Freshsales Bundle Alias",
|
|
@@ -114829,7 +115347,7 @@ var parameters77 = {
|
|
|
114829
115347
|
};
|
|
114830
115348
|
|
|
114831
115349
|
// ../connectors/src/connectors/freshsales/tools/request.ts
|
|
114832
|
-
import { z as
|
|
115350
|
+
import { z as z95 } from "zod";
|
|
114833
115351
|
var BASE_PATH_SEGMENT14 = "/crm/sales/api";
|
|
114834
115352
|
var REQUEST_TIMEOUT_MS72 = 6e4;
|
|
114835
115353
|
function buildBaseUrl3(bundleAlias) {
|
|
@@ -114837,33 +115355,33 @@ function buildBaseUrl3(bundleAlias) {
|
|
|
114837
115355
|
const subdomain = trimmed.split(".")[0];
|
|
114838
115356
|
return `https://${subdomain}.myfreshworks.com${BASE_PATH_SEGMENT14}`;
|
|
114839
115357
|
}
|
|
114840
|
-
var
|
|
114841
|
-
toolUseIntent:
|
|
115358
|
+
var inputSchema95 = z95.object({
|
|
115359
|
+
toolUseIntent: z95.string().optional().describe(
|
|
114842
115360
|
"Brief description of what you intend to accomplish with this tool call"
|
|
114843
115361
|
),
|
|
114844
|
-
connectionId:
|
|
114845
|
-
method:
|
|
115362
|
+
connectionId: z95.string().describe("ID of the Freshsales connection to use"),
|
|
115363
|
+
method: z95.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
114846
115364
|
"HTTP method. GET for reading resources (including /lookup), POST for creating, PUT for updating, DELETE for removing."
|
|
114847
115365
|
),
|
|
114848
|
-
path:
|
|
115366
|
+
path: z95.string().describe(
|
|
114849
115367
|
"API path (e.g., '/contacts', '/contacts/filters', '/contacts/view/{view_id}', '/deals/{id}', '/lookup'). Append query parameters such as '?page=1&per_page=100'."
|
|
114850
115368
|
),
|
|
114851
|
-
body:
|
|
115369
|
+
body: z95.record(z95.string(), z95.unknown()).optional().describe(
|
|
114852
115370
|
'Request body (JSON). For creating a contact: { "contact": { "first_name": "...", "last_name": "...", "email": "..." } }. For lookup: { "q": "john@example.com", "f": "email", "entities": "contact" }.'
|
|
114853
115371
|
)
|
|
114854
115372
|
});
|
|
114855
|
-
var
|
|
114856
|
-
|
|
114857
|
-
success:
|
|
114858
|
-
status:
|
|
114859
|
-
data:
|
|
114860
|
-
|
|
114861
|
-
|
|
115373
|
+
var outputSchema95 = z95.discriminatedUnion("success", [
|
|
115374
|
+
z95.object({
|
|
115375
|
+
success: z95.literal(true),
|
|
115376
|
+
status: z95.number(),
|
|
115377
|
+
data: z95.union([
|
|
115378
|
+
z95.record(z95.string(), z95.unknown()),
|
|
115379
|
+
z95.array(z95.unknown())
|
|
114862
115380
|
])
|
|
114863
115381
|
}),
|
|
114864
|
-
|
|
114865
|
-
success:
|
|
114866
|
-
error:
|
|
115382
|
+
z95.object({
|
|
115383
|
+
success: z95.literal(false),
|
|
115384
|
+
error: z95.string()
|
|
114867
115385
|
})
|
|
114868
115386
|
]);
|
|
114869
115387
|
var requestTool54 = new ConnectorTool({
|
|
@@ -114896,8 +115414,8 @@ Common endpoints:
|
|
|
114896
115414
|
Pagination: 1-indexed \`page\` + \`per_page\` (default 25, max 100). View endpoints return \`{ contacts/sales_accounts/deals: [...], meta: { total_pages, total } }\`.
|
|
114897
115415
|
|
|
114898
115416
|
Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\`owner\`, \`creator\`, \`deals\`, \`contacts\`, etc.) to inline related records.`,
|
|
114899
|
-
inputSchema:
|
|
114900
|
-
outputSchema:
|
|
115417
|
+
inputSchema: inputSchema95,
|
|
115418
|
+
outputSchema: outputSchema95,
|
|
114901
115419
|
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
114902
115420
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
114903
115421
|
if (!connection) {
|
|
@@ -114910,8 +115428,8 @@ Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\
|
|
|
114910
115428
|
`[connector-request] freshsales/${connection.name}: ${method} ${path5}`
|
|
114911
115429
|
);
|
|
114912
115430
|
try {
|
|
114913
|
-
const apiKey =
|
|
114914
|
-
const bundle =
|
|
115431
|
+
const apiKey = parameters78.apiKey.getValue(connection);
|
|
115432
|
+
const bundle = parameters78.bundleAlias.getValue(connection);
|
|
114915
115433
|
const baseUrl = buildBaseUrl3(bundle);
|
|
114916
115434
|
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT14);
|
|
114917
115435
|
const url = `${baseUrl}${normalizedPath}`;
|
|
@@ -114949,14 +115467,14 @@ Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\
|
|
|
114949
115467
|
});
|
|
114950
115468
|
|
|
114951
115469
|
// ../connectors/src/connectors/freshsales/index.ts
|
|
114952
|
-
var
|
|
115470
|
+
var tools78 = { request: requestTool54 };
|
|
114953
115471
|
var freshsalesConnector = new ConnectorPlugin({
|
|
114954
115472
|
slug: "freshsales",
|
|
114955
115473
|
authType: AUTH_TYPES.API_KEY,
|
|
114956
115474
|
name: "Freshsales",
|
|
114957
115475
|
description: "Connect to Freshsales / Freshworks CRM for contact, account, and deal data via API key.",
|
|
114958
115476
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4UDOrFPM6wOFekbMVljjgl/4acc6060c3a1ff703980e6f4e76a3cd4/629b6c6f7c5cd817694c321f.png",
|
|
114959
|
-
parameters:
|
|
115477
|
+
parameters: parameters78,
|
|
114960
115478
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
114961
115479
|
categories: ["crm"],
|
|
114962
115480
|
onboarding: freshsalesOnboarding,
|
|
@@ -115128,7 +115646,7 @@ export default async function handler(c: Context) {
|
|
|
115128
115646
|
- GET \`/selector/lifecycle_stages\` \u2014 \u30E9\u30A4\u30D5\u30B5\u30A4\u30AF\u30EB\u30B9\u30C6\u30FC\u30B8
|
|
115129
115647
|
- GET \`/selector/territories\` / \`/selector/business_types\` / \`/selector/industry_types\` / \`/selector/contact_statuses\` / \`/selector/sales_activity_types\``
|
|
115130
115648
|
},
|
|
115131
|
-
tools:
|
|
115649
|
+
tools: tools78
|
|
115132
115650
|
});
|
|
115133
115651
|
|
|
115134
115652
|
// ../connectors/src/connectors/github/setup.ts
|
|
@@ -115154,7 +115672,7 @@ var githubOnboarding = new ConnectorOnboarding({
|
|
|
115154
115672
|
});
|
|
115155
115673
|
|
|
115156
115674
|
// ../connectors/src/connectors/github/parameters.ts
|
|
115157
|
-
var
|
|
115675
|
+
var parameters79 = {
|
|
115158
115676
|
personalAccessToken: new ParameterDefinition({
|
|
115159
115677
|
slug: "personal-access-token",
|
|
115160
115678
|
name: "GitHub Personal Access Token",
|
|
@@ -115177,42 +115695,42 @@ var parameters78 = {
|
|
|
115177
115695
|
var DEFAULT_BASE_URL = "https://api.github.com";
|
|
115178
115696
|
|
|
115179
115697
|
// ../connectors/src/connectors/github/tools/request.ts
|
|
115180
|
-
import { z as
|
|
115698
|
+
import { z as z96 } from "zod";
|
|
115181
115699
|
var REQUEST_TIMEOUT_MS73 = 6e4;
|
|
115182
115700
|
function resolveBaseUrl(connectionBaseUrl) {
|
|
115183
115701
|
const trimmed = connectionBaseUrl?.trim();
|
|
115184
115702
|
return trimmed && trimmed.replace(/\/+$/, "") || DEFAULT_BASE_URL;
|
|
115185
115703
|
}
|
|
115186
|
-
var
|
|
115187
|
-
toolUseIntent:
|
|
115704
|
+
var inputSchema96 = z96.object({
|
|
115705
|
+
toolUseIntent: z96.string().optional().describe(
|
|
115188
115706
|
"Brief description of what you intend to accomplish with this tool call"
|
|
115189
115707
|
),
|
|
115190
|
-
connectionId:
|
|
115191
|
-
method:
|
|
115708
|
+
connectionId: z96.string().describe("ID of the GitHub connection to use"),
|
|
115709
|
+
method: z96.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe(
|
|
115192
115710
|
"HTTP method. GET for reading, POST for creating, PATCH for partial updates, PUT for replacement (e.g. starring), DELETE for removal."
|
|
115193
115711
|
),
|
|
115194
|
-
path:
|
|
115712
|
+
path: z96.string().describe(
|
|
115195
115713
|
"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'."
|
|
115196
115714
|
),
|
|
115197
|
-
body:
|
|
115198
|
-
|
|
115199
|
-
|
|
115715
|
+
body: z96.union([
|
|
115716
|
+
z96.record(z96.string(), z96.unknown()),
|
|
115717
|
+
z96.array(z96.unknown())
|
|
115200
115718
|
]).optional().describe(
|
|
115201
115719
|
'Request body (JSON). Example creating an issue: { "title": "...", "body": "...", "labels": ["bug"] }.'
|
|
115202
115720
|
)
|
|
115203
115721
|
});
|
|
115204
|
-
var
|
|
115205
|
-
|
|
115206
|
-
success:
|
|
115207
|
-
status:
|
|
115208
|
-
data:
|
|
115209
|
-
|
|
115210
|
-
|
|
115722
|
+
var outputSchema96 = z96.discriminatedUnion("success", [
|
|
115723
|
+
z96.object({
|
|
115724
|
+
success: z96.literal(true),
|
|
115725
|
+
status: z96.number(),
|
|
115726
|
+
data: z96.union([
|
|
115727
|
+
z96.record(z96.string(), z96.unknown()),
|
|
115728
|
+
z96.array(z96.unknown())
|
|
115211
115729
|
])
|
|
115212
115730
|
}),
|
|
115213
|
-
|
|
115214
|
-
success:
|
|
115215
|
-
error:
|
|
115731
|
+
z96.object({
|
|
115732
|
+
success: z96.literal(false),
|
|
115733
|
+
error: z96.string()
|
|
115216
115734
|
})
|
|
115217
115735
|
]);
|
|
115218
115736
|
var requestTool55 = new ConnectorTool({
|
|
@@ -115250,8 +115768,8 @@ Common endpoints:
|
|
|
115250
115768
|
Pagination: 1-indexed \`page\` + \`per_page\` (max 100). The \`Link\` response header exposes \`rel="next"\`/\`rel="last"\` URLs.
|
|
115251
115769
|
|
|
115252
115770
|
Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`X-RateLimit-Remaining\` to throttle.`,
|
|
115253
|
-
inputSchema:
|
|
115254
|
-
outputSchema:
|
|
115771
|
+
inputSchema: inputSchema96,
|
|
115772
|
+
outputSchema: outputSchema96,
|
|
115255
115773
|
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
115256
115774
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
115257
115775
|
if (!connection) {
|
|
@@ -115264,8 +115782,8 @@ Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`
|
|
|
115264
115782
|
`[connector-request] github/${connection.name}: ${method} ${path5}`
|
|
115265
115783
|
);
|
|
115266
115784
|
try {
|
|
115267
|
-
const token =
|
|
115268
|
-
const baseUrl = resolveBaseUrl(
|
|
115785
|
+
const token = parameters79.personalAccessToken.getValue(connection);
|
|
115786
|
+
const baseUrl = resolveBaseUrl(parameters79.baseUrl.tryGetValue(connection));
|
|
115269
115787
|
const trimmedPath = path5.trim().replace(/^\/+/, "/");
|
|
115270
115788
|
const url = `${baseUrl}${trimmedPath.startsWith("/") ? "" : "/"}${trimmedPath}`;
|
|
115271
115789
|
const controller = new AbortController();
|
|
@@ -115305,14 +115823,14 @@ Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`
|
|
|
115305
115823
|
});
|
|
115306
115824
|
|
|
115307
115825
|
// ../connectors/src/connectors/github/index.ts
|
|
115308
|
-
var
|
|
115826
|
+
var tools79 = { request: requestTool55 };
|
|
115309
115827
|
var githubConnector = new ConnectorPlugin({
|
|
115310
115828
|
slug: "github",
|
|
115311
115829
|
authType: AUTH_TYPES.PAT,
|
|
115312
115830
|
name: "GitHub",
|
|
115313
115831
|
description: "Connect to GitHub for repository, issue, pull request, commit, and search data via Personal Access Token (Classic or fine-grained).",
|
|
115314
115832
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2flOAufkhDrLKuOQqEVS3/1f9dcf145680ef77aef149709263e2d4/github-icon.svg",
|
|
115315
|
-
parameters:
|
|
115833
|
+
parameters: parameters79,
|
|
115316
115834
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
115317
115835
|
categories: ["productivity"],
|
|
115318
115836
|
onboarding: githubOnboarding,
|
|
@@ -115532,7 +116050,7 @@ export default async function handler(c: Context) {
|
|
|
115532
116050
|
**\u30AF\u30A9\u30FC\u30BF**
|
|
115533
116051
|
- GET \`/rate_limit\` \u2014 REST / GraphQL / search \u306E\u6B8B\u30EC\u30FC\u30C8\u78BA\u8A8D`
|
|
115534
116052
|
},
|
|
115535
|
-
tools:
|
|
116053
|
+
tools: tools79
|
|
115536
116054
|
});
|
|
115537
116055
|
|
|
115538
116056
|
// ../connectors/src/connectors/registry.ts
|
|
@@ -115610,6 +116128,7 @@ var plugins = {
|
|
|
115610
116128
|
clickup: clickupConnector,
|
|
115611
116129
|
sqlserver: sqlserverConnector,
|
|
115612
116130
|
azureSql: azureSqlConnector,
|
|
116131
|
+
cosmosdb: cosmosdbConnector,
|
|
115613
116132
|
oracle: oracleConnector,
|
|
115614
116133
|
freshservice: freshserviceConnector,
|
|
115615
116134
|
freshdesk: freshdeskConnector,
|
|
@@ -115841,62 +116360,62 @@ import { watch as fsWatch2 } from "fs";
|
|
|
115841
116360
|
import path2 from "path";
|
|
115842
116361
|
|
|
115843
116362
|
// src/types/server-logic.ts
|
|
115844
|
-
import { z as
|
|
115845
|
-
var parameterMetaSchema =
|
|
115846
|
-
name:
|
|
115847
|
-
type:
|
|
115848
|
-
description:
|
|
115849
|
-
required:
|
|
115850
|
-
default:
|
|
115851
|
-
});
|
|
115852
|
-
var serverLogicCacheConfigSchema =
|
|
115853
|
-
ttl:
|
|
115854
|
-
staleWhileRevalidate:
|
|
115855
|
-
});
|
|
115856
|
-
var serverLogicSchemaObjectSchema =
|
|
115857
|
-
() =>
|
|
115858
|
-
type:
|
|
115859
|
-
format:
|
|
115860
|
-
description:
|
|
115861
|
-
nullable:
|
|
115862
|
-
enum:
|
|
116363
|
+
import { z as z97 } from "zod";
|
|
116364
|
+
var parameterMetaSchema = z97.object({
|
|
116365
|
+
name: z97.string(),
|
|
116366
|
+
type: z97.enum(["string", "number", "boolean"]),
|
|
116367
|
+
description: z97.string(),
|
|
116368
|
+
required: z97.boolean().optional(),
|
|
116369
|
+
default: z97.union([z97.string(), z97.number(), z97.boolean()]).optional()
|
|
116370
|
+
});
|
|
116371
|
+
var serverLogicCacheConfigSchema = z97.object({
|
|
116372
|
+
ttl: z97.number(),
|
|
116373
|
+
staleWhileRevalidate: z97.boolean().optional()
|
|
116374
|
+
});
|
|
116375
|
+
var serverLogicSchemaObjectSchema = z97.lazy(
|
|
116376
|
+
() => z97.object({
|
|
116377
|
+
type: z97.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
116378
|
+
format: z97.string().optional(),
|
|
116379
|
+
description: z97.string().optional(),
|
|
116380
|
+
nullable: z97.boolean().optional(),
|
|
116381
|
+
enum: z97.array(z97.union([z97.string(), z97.number(), z97.boolean(), z97.null()])).optional(),
|
|
115863
116382
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
115864
|
-
properties:
|
|
115865
|
-
required:
|
|
115866
|
-
additionalProperties:
|
|
115867
|
-
minimum:
|
|
115868
|
-
maximum:
|
|
115869
|
-
minLength:
|
|
115870
|
-
maxLength:
|
|
115871
|
-
pattern:
|
|
116383
|
+
properties: z97.record(z97.string(), serverLogicSchemaObjectSchema).optional(),
|
|
116384
|
+
required: z97.array(z97.string()).optional(),
|
|
116385
|
+
additionalProperties: z97.union([z97.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
116386
|
+
minimum: z97.number().optional(),
|
|
116387
|
+
maximum: z97.number().optional(),
|
|
116388
|
+
minLength: z97.number().optional(),
|
|
116389
|
+
maxLength: z97.number().optional(),
|
|
116390
|
+
pattern: z97.string().optional()
|
|
115872
116391
|
})
|
|
115873
116392
|
);
|
|
115874
|
-
var serverLogicMediaTypeSchema =
|
|
116393
|
+
var serverLogicMediaTypeSchema = z97.object({
|
|
115875
116394
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
115876
|
-
example:
|
|
116395
|
+
example: z97.unknown().optional()
|
|
115877
116396
|
});
|
|
115878
|
-
var serverLogicResponseSchema =
|
|
115879
|
-
description:
|
|
115880
|
-
content:
|
|
116397
|
+
var serverLogicResponseSchema = z97.object({
|
|
116398
|
+
description: z97.string().optional(),
|
|
116399
|
+
content: z97.record(z97.string(), serverLogicMediaTypeSchema).optional()
|
|
115881
116400
|
});
|
|
115882
116401
|
var jsonBaseFields = {
|
|
115883
|
-
description:
|
|
115884
|
-
parameters:
|
|
116402
|
+
description: z97.string(),
|
|
116403
|
+
parameters: z97.array(parameterMetaSchema).optional(),
|
|
115885
116404
|
response: serverLogicResponseSchema.optional(),
|
|
115886
116405
|
cache: serverLogicCacheConfigSchema.optional()
|
|
115887
116406
|
};
|
|
115888
|
-
var jsonSqlServerLogicSchema =
|
|
116407
|
+
var jsonSqlServerLogicSchema = z97.object({
|
|
115889
116408
|
...jsonBaseFields,
|
|
115890
|
-
type:
|
|
115891
|
-
query:
|
|
115892
|
-
connectionId:
|
|
116409
|
+
type: z97.literal("sql").optional(),
|
|
116410
|
+
query: z97.string(),
|
|
116411
|
+
connectionId: z97.string()
|
|
115893
116412
|
});
|
|
115894
|
-
var jsonTypeScriptServerLogicSchema =
|
|
116413
|
+
var jsonTypeScriptServerLogicSchema = z97.object({
|
|
115895
116414
|
...jsonBaseFields,
|
|
115896
|
-
type:
|
|
115897
|
-
handlerPath:
|
|
116415
|
+
type: z97.literal("typescript"),
|
|
116416
|
+
handlerPath: z97.string()
|
|
115898
116417
|
});
|
|
115899
|
-
var anyJsonServerLogicSchema =
|
|
116418
|
+
var anyJsonServerLogicSchema = z97.union([
|
|
115900
116419
|
jsonTypeScriptServerLogicSchema,
|
|
115901
116420
|
jsonSqlServerLogicSchema
|
|
115902
116421
|
]);
|