@squadbase/vite-server 0.1.19-dev.2880e8d → 0.1.19-dev.40d2ebd
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/build-entry/server-entry.mjs +13 -18
- package/dist/cli/index.js +460 -417
- package/dist/connectors/google-analytics-oauth.js +192 -96
- package/dist/index.d.ts +5 -22
- package/dist/index.js +617 -499
- package/dist/main.d.ts +1 -1
- package/dist/main.js +620 -502
- package/dist/types/server-logic.d.ts +0 -3
- package/dist/vite-plugin.d.ts +1 -7
- package/dist/vite-plugin.js +47523 -41
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -435,15 +435,15 @@ function parseOracleJdbcUrl(jdbcUrl, options = {}) {
|
|
|
435
435
|
}
|
|
436
436
|
if (URL_PREFIX_RE.test(trimmed)) {
|
|
437
437
|
const url = new URL(trimmed);
|
|
438
|
-
const
|
|
439
|
-
if (!url.hostname || !
|
|
438
|
+
const path5 = url.pathname.replace(/^\//, "");
|
|
439
|
+
if (!url.hostname || !path5) {
|
|
440
440
|
throw new Error(
|
|
441
441
|
`Invalid Oracle URL "${redactOracleUrl(trimmed)}". Expected oracle://[user:password@]host:port/service`
|
|
442
442
|
);
|
|
443
443
|
}
|
|
444
444
|
const port = url.port || "1521";
|
|
445
445
|
return {
|
|
446
|
-
connectString: `${url.hostname}:${port}/${
|
|
446
|
+
connectString: `${url.hostname}:${port}/${path5}`,
|
|
447
447
|
user: url.username ? decodeURIComponent(url.username) : options.username,
|
|
448
448
|
password: url.password ? decodeURIComponent(url.password) : options.password
|
|
449
449
|
};
|
|
@@ -620,7 +620,12 @@ var init_oracle_runner = __esm({
|
|
|
620
620
|
import { Hono as Hono5 } from "hono";
|
|
621
621
|
import { contextStorage } from "hono/context-storage";
|
|
622
622
|
import { cors } from "hono/cors";
|
|
623
|
-
import
|
|
623
|
+
import path4 from "path";
|
|
624
|
+
|
|
625
|
+
// src/registry.ts
|
|
626
|
+
import { readdir, readFile as readFile2, mkdir } from "fs/promises";
|
|
627
|
+
import { watch as fsWatch2 } from "fs";
|
|
628
|
+
import path2 from "path";
|
|
624
629
|
|
|
625
630
|
// src/connector-client/registry.ts
|
|
626
631
|
import { readFileSync, watch as fsWatch } from "fs";
|
|
@@ -8071,12 +8076,12 @@ var parameters13 = {
|
|
|
8071
8076
|
|
|
8072
8077
|
// ../connectors/src/connectors/airtable/utils.ts
|
|
8073
8078
|
var BASE_URL = "https://api.airtable.com/v0";
|
|
8074
|
-
async function apiFetch(params,
|
|
8079
|
+
async function apiFetch(params, path5, init) {
|
|
8075
8080
|
const apiKey = params[parameters13.apiKey.slug];
|
|
8076
8081
|
if (!apiKey) {
|
|
8077
8082
|
throw new Error("airtable: missing required parameter: api-key");
|
|
8078
8083
|
}
|
|
8079
|
-
const url = `${BASE_URL}${
|
|
8084
|
+
const url = `${BASE_URL}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
8080
8085
|
const headers = new Headers(init?.headers);
|
|
8081
8086
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
8082
8087
|
return fetch(url, { ...init, headers });
|
|
@@ -8278,16 +8283,16 @@ Authentication is handled automatically using the API Key.
|
|
|
8278
8283
|
{baseId} in the path is automatically replaced with the connection's base-id.`,
|
|
8279
8284
|
inputSchema: inputSchema19,
|
|
8280
8285
|
outputSchema: outputSchema19,
|
|
8281
|
-
async execute({ connectionId, method, path:
|
|
8286
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
8282
8287
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
8283
8288
|
if (!connection2) {
|
|
8284
8289
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
8285
8290
|
}
|
|
8286
|
-
console.log(`[connector-request] airtable/${connection2.name}: ${method} ${
|
|
8291
|
+
console.log(`[connector-request] airtable/${connection2.name}: ${method} ${path5}`);
|
|
8287
8292
|
try {
|
|
8288
8293
|
const apiKey = parameters13.apiKey.getValue(connection2);
|
|
8289
8294
|
const baseId = parameters13.baseId.getValue(connection2);
|
|
8290
|
-
const resolvedPath =
|
|
8295
|
+
const resolvedPath = path5.replace(/\{baseId\}/g, baseId);
|
|
8291
8296
|
const url = `${BASE_URL2}${resolvedPath}`;
|
|
8292
8297
|
const controller = new AbortController();
|
|
8293
8298
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS7);
|
|
@@ -8982,7 +8987,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
8982
8987
|
{customerId} in the path is automatically replaced with the connection's customer ID (hyphens removed).`,
|
|
8983
8988
|
inputSchema: inputSchema21,
|
|
8984
8989
|
outputSchema: outputSchema21,
|
|
8985
|
-
async execute({ connectionId, method, path:
|
|
8990
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
8986
8991
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
8987
8992
|
if (!connection2) {
|
|
8988
8993
|
return {
|
|
@@ -8991,12 +8996,12 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
8991
8996
|
};
|
|
8992
8997
|
}
|
|
8993
8998
|
console.log(
|
|
8994
|
-
`[connector-request] google-ads/${connection2.name}: ${method} ${
|
|
8999
|
+
`[connector-request] google-ads/${connection2.name}: ${method} ${path5}`
|
|
8995
9000
|
);
|
|
8996
9001
|
try {
|
|
8997
9002
|
const rawCustomerId = parameters14.customerId.tryGetValue(connection2);
|
|
8998
9003
|
const customerId = rawCustomerId?.replace(/-/g, "") ?? "";
|
|
8999
|
-
const resolvedPath = customerId ?
|
|
9004
|
+
const resolvedPath = customerId ? path5.replace(/\{customerId\}/g, customerId) : path5;
|
|
9000
9005
|
const token = await getProxyToken5(config.oauthProxy);
|
|
9001
9006
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
9002
9007
|
const controller = new AbortController();
|
|
@@ -9343,7 +9348,7 @@ async function getAccessToken(serviceAccountKey) {
|
|
|
9343
9348
|
const data = await response.json();
|
|
9344
9349
|
return data.access_token;
|
|
9345
9350
|
}
|
|
9346
|
-
async function adminFetch(params,
|
|
9351
|
+
async function adminFetch(params, path5, init) {
|
|
9347
9352
|
const keyJsonBase64 = params[parameters15.serviceAccountKeyJsonBase64.slug];
|
|
9348
9353
|
if (!keyJsonBase64) {
|
|
9349
9354
|
throw new Error(
|
|
@@ -9352,12 +9357,12 @@ async function adminFetch(params, path4, init) {
|
|
|
9352
9357
|
}
|
|
9353
9358
|
const serviceAccountKey = decodeServiceAccount(keyJsonBase64);
|
|
9354
9359
|
const accessToken = await getAccessToken(serviceAccountKey);
|
|
9355
|
-
const url = `${ADMIN_BASE_URL}${
|
|
9360
|
+
const url = `${ADMIN_BASE_URL}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
9356
9361
|
const headers = new Headers(init?.headers);
|
|
9357
9362
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
9358
9363
|
return fetch(url, { ...init, headers });
|
|
9359
9364
|
}
|
|
9360
|
-
async function dataFetch(params,
|
|
9365
|
+
async function dataFetch(params, path5, init) {
|
|
9361
9366
|
const keyJsonBase64 = params[parameters15.serviceAccountKeyJsonBase64.slug];
|
|
9362
9367
|
if (!keyJsonBase64) {
|
|
9363
9368
|
throw new Error(
|
|
@@ -9366,7 +9371,7 @@ async function dataFetch(params, path4, init) {
|
|
|
9366
9371
|
}
|
|
9367
9372
|
const serviceAccountKey = decodeServiceAccount(keyJsonBase64);
|
|
9368
9373
|
const accessToken = await getAccessToken(serviceAccountKey);
|
|
9369
|
-
const url = `${DATA_BASE_URL}${
|
|
9374
|
+
const url = `${DATA_BASE_URL}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
9370
9375
|
const headers = new Headers(init?.headers);
|
|
9371
9376
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
9372
9377
|
return fetch(url, { ...init, headers });
|
|
@@ -9390,8 +9395,8 @@ async function listAccountSummaries(params) {
|
|
|
9390
9395
|
const summaries = [];
|
|
9391
9396
|
let pageToken;
|
|
9392
9397
|
do {
|
|
9393
|
-
const
|
|
9394
|
-
const res = await adminFetch(params,
|
|
9398
|
+
const path5 = pageToken ? `/accountSummaries?pageToken=${encodeURIComponent(pageToken)}` : `/accountSummaries`;
|
|
9399
|
+
const res = await adminFetch(params, path5);
|
|
9395
9400
|
if (!res.ok) {
|
|
9396
9401
|
const body = await res.text().catch(() => res.statusText);
|
|
9397
9402
|
throw new Error(
|
|
@@ -9630,9 +9635,9 @@ function renderTopPages(sections, report) {
|
|
|
9630
9635
|
sections.push("| Path | Page views | Active users | Avg session duration |");
|
|
9631
9636
|
sections.push("|------|------------|--------------|----------------------|");
|
|
9632
9637
|
for (const row of rows.slice(0, TOP_N_PAGES)) {
|
|
9633
|
-
const
|
|
9638
|
+
const path5 = truncate(row.dimensionValues?.[0]?.value, PAGE_PATH_MAX) || "-";
|
|
9634
9639
|
sections.push(
|
|
9635
|
-
`| ${escapePipe(
|
|
9640
|
+
`| ${escapePipe(path5)} | ${formatNumber(row.metricValues?.[0]?.value)} | ${formatNumber(
|
|
9636
9641
|
row.metricValues?.[1]?.value
|
|
9637
9642
|
)} | ${formatDuration(row.metricValues?.[2]?.value)} |`
|
|
9638
9643
|
);
|
|
@@ -10006,12 +10011,12 @@ var requestTool3 = new ConnectorTool({
|
|
|
10006
10011
|
Authentication is handled automatically using a service account.`,
|
|
10007
10012
|
inputSchema: inputSchema22,
|
|
10008
10013
|
outputSchema: outputSchema22,
|
|
10009
|
-
async execute({ connectionId, method, path:
|
|
10014
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
10010
10015
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
10011
10016
|
if (!connection2) {
|
|
10012
10017
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
10013
10018
|
}
|
|
10014
|
-
console.log(`[connector-request] google-analytics/${connection2.name}: ${method} ${
|
|
10019
|
+
console.log(`[connector-request] google-analytics/${connection2.name}: ${method} ${path5}`);
|
|
10015
10020
|
try {
|
|
10016
10021
|
const { GoogleAuth } = await import("google-auth-library");
|
|
10017
10022
|
const keyJsonBase64 = parameters15.serviceAccountKeyJsonBase64.getValue(connection2);
|
|
@@ -10026,7 +10031,7 @@ Authentication is handled automatically using a service account.`,
|
|
|
10026
10031
|
if (!token) {
|
|
10027
10032
|
return { success: false, error: "Failed to obtain access token" };
|
|
10028
10033
|
}
|
|
10029
|
-
const url = `${BASE_URL3}${
|
|
10034
|
+
const url = `${BASE_URL3}${path5}`;
|
|
10030
10035
|
const controller = new AbortController();
|
|
10031
10036
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS10);
|
|
10032
10037
|
try {
|
|
@@ -10500,11 +10505,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10500
10505
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10501
10506
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **0\u4EF6**: \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
|
|
10502
10507
|
3. \`${listPropertiesToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u9078\u629E\u3055\u308C\u305F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
10503
|
-
4. \
|
|
10504
|
-
-
|
|
10505
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\
|
|
10506
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
10507
|
-
5. \u9078\u629E\
|
|
10508
|
+
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
10509
|
+
- \`parameterSlug\`: \`"property-id"\`
|
|
10510
|
+
- \`options\`: \u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u8868\u793A\u540D (id: \u30D7\u30ED\u30D1\u30C6\u30A3ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30D1\u30C6\u30A3ID
|
|
10511
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\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\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10512
|
+
5. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30D7\u30ED\u30D1\u30C6\u30A3\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
|
|
10508
10513
|
|
|
10509
10514
|
#### \u5236\u7D04
|
|
10510
10515
|
- **\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
|
|
@@ -10518,11 +10523,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10518
10523
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
10519
10524
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
10520
10525
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
10521
|
-
4.
|
|
10522
|
-
-
|
|
10523
|
-
-
|
|
10524
|
-
- **0 properties
|
|
10525
|
-
5.
|
|
10526
|
+
4. Call \`updateConnectionParameters\`:
|
|
10527
|
+
- \`parameterSlug\`: \`"property-id"\`
|
|
10528
|
+
- \`options\`: The property list. Each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID
|
|
10529
|
+
- If **0 properties** are returned, abort setup and inform the user that no accessible properties are available
|
|
10530
|
+
5. The \`label\` of the user's selected property will arrive as a message. Proceed to the next step
|
|
10526
10531
|
|
|
10527
10532
|
#### Constraints
|
|
10528
10533
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -10530,17 +10535,26 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10530
10535
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
10531
10536
|
},
|
|
10532
10537
|
dataOverviewInstructions: {
|
|
10533
|
-
en: `
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
1. connector_google-analytics-oauth_request \u3067 GET properties/<propertyId>/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
10538
|
-
2. connector_google-analytics-oauth_request \u3067 POST properties/<propertyId>:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
10538
|
+
en: `1. Call connector_google-analytics-oauth_request with GET properties/{propertyId}/metadata to list available dimensions and metrics
|
|
10539
|
+
2. Call connector_google-analytics-oauth_request with POST properties/{propertyId}:runReport using a small date range and basic metrics to verify data availability`,
|
|
10540
|
+
ja: `1. connector_google-analytics-oauth_request \u3067 GET properties/{propertyId}/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
10541
|
+
2. connector_google-analytics-oauth_request \u3067 POST properties/{propertyId}:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
10539
10542
|
}
|
|
10540
10543
|
});
|
|
10541
10544
|
|
|
10542
10545
|
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
10543
|
-
|
|
10546
|
+
init_parameter_definition();
|
|
10547
|
+
var parameters16 = {
|
|
10548
|
+
propertyId: new ParameterDefinition({
|
|
10549
|
+
slug: "property-id",
|
|
10550
|
+
name: "Default Property ID",
|
|
10551
|
+
description: "Optional default Google Analytics 4 property ID (e.g., 123456789) used when a request does not specify one. Can be found in GA4 Admin > Property Settings. Leave empty to always pass the property ID per request.",
|
|
10552
|
+
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
10553
|
+
type: "text",
|
|
10554
|
+
secret: false,
|
|
10555
|
+
required: false
|
|
10556
|
+
})
|
|
10557
|
+
};
|
|
10544
10558
|
|
|
10545
10559
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
10546
10560
|
var ADMIN_BASE_URL4 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
@@ -10847,7 +10861,7 @@ var inputSchema25 = z25.object({
|
|
|
10847
10861
|
connectionId: z25.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
10848
10862
|
method: z25.enum(["GET", "POST"]).describe("HTTP method"),
|
|
10849
10863
|
path: z25.string().describe(
|
|
10850
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly
|
|
10864
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly; the {propertyId} placeholder is only substituted when a default property is configured on the connection."
|
|
10851
10865
|
),
|
|
10852
10866
|
body: z25.record(z25.string(), z25.unknown()).optional().describe("POST request body (JSON)")
|
|
10853
10867
|
});
|
|
@@ -10866,10 +10880,10 @@ var requestTool4 = new ConnectorTool({
|
|
|
10866
10880
|
name: "request",
|
|
10867
10881
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
10868
10882
|
Authentication is handled automatically via OAuth proxy.
|
|
10869
|
-
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
10883
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport). The {propertyId} placeholder is only substituted when a default property is configured on the connection.`,
|
|
10870
10884
|
inputSchema: inputSchema25,
|
|
10871
10885
|
outputSchema: outputSchema25,
|
|
10872
|
-
async execute({ connectionId, method, path:
|
|
10886
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
10873
10887
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
10874
10888
|
if (!connection2) {
|
|
10875
10889
|
return {
|
|
@@ -10878,10 +10892,12 @@ Write the numeric property id directly into the path (e.g. properties/123456789:
|
|
|
10878
10892
|
};
|
|
10879
10893
|
}
|
|
10880
10894
|
console.log(
|
|
10881
|
-
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${
|
|
10895
|
+
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${path5}`
|
|
10882
10896
|
);
|
|
10883
10897
|
try {
|
|
10884
|
-
const
|
|
10898
|
+
const propertyId = parameters16.propertyId.tryGetValue(connection2);
|
|
10899
|
+
const resolvedPath = propertyId ? path5.replace(/\{propertyId\}/g, propertyId) : path5;
|
|
10900
|
+
const url = `${BASE_URL4}${resolvedPath}`;
|
|
10885
10901
|
const token = await getProxyToken8(config.oauthProxy);
|
|
10886
10902
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
10887
10903
|
const controller = new AbortController();
|
|
@@ -10951,20 +10967,24 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
10951
10967
|
systemPrompt: {
|
|
10952
10968
|
en: `### Tools
|
|
10953
10969
|
|
|
10954
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}
|
|
10970
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}\` (the \`{propertyId}\` placeholder is only substituted when a default property is configured on the connection). Authentication is configured automatically via OAuth.
|
|
10955
10971
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
10956
10972
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
10957
10973
|
|
|
10958
|
-
### GA4 Data API Reference
|
|
10959
|
-
|
|
10960
|
-
These raw HTTP shapes describe the discovery **tool** above. **In server-logic (Business Logic below) do NOT hand-build these HTTP requests \u2014 call the SDK method on the same line, which takes the same body fields and returns already-parsed JSON:**
|
|
10974
|
+
### GA4 Data API Reference
|
|
10961
10975
|
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
| \`GET properties/{propertyId}/metadata\` | \`await client.getMetadata(propertyId)\` |
|
|
10965
|
-
| \`POST properties/{propertyId}:runReport\` with body \`{ dateRanges, dimensions, metrics, limit }\` | \`await client.runReport({ propertyId, dateRanges, dimensions, metrics, limit })\` \u2192 \`{ rows, rowCount }\` |
|
|
10976
|
+
#### Get Metadata (Check available dimensions and metrics)
|
|
10977
|
+
- GET properties/{propertyId}/metadata
|
|
10966
10978
|
|
|
10967
|
-
|
|
10979
|
+
### Get Report
|
|
10980
|
+
- POST properties/{propertyId}:runReport
|
|
10981
|
+
- Body example:
|
|
10982
|
+
{
|
|
10983
|
+
"dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
|
|
10984
|
+
"dimensions": [{"name": "date"}],
|
|
10985
|
+
"metrics": [{"name": "activeUsers"}],
|
|
10986
|
+
"limit": 100
|
|
10987
|
+
}
|
|
10968
10988
|
|
|
10969
10989
|
### Common Dimensions
|
|
10970
10990
|
date, country, city, deviceCategory, browser, pagePath, pageTitle,
|
|
@@ -10982,14 +11002,13 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
10982
11002
|
|
|
10983
11003
|
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 and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
10984
11004
|
|
|
10985
|
-
SDK surface (client created via \`connection(connectionId)\`)
|
|
10986
|
-
- \`client.
|
|
10987
|
-
- \`client.
|
|
10988
|
-
- \`client.
|
|
10989
|
-
|
|
10990
|
-
**Anti-pattern \u2014 do NOT do this.** \`client.request(...)\` is a low-level escape hatch that returns a raw \`Response\`; it is NOT how you run a report. In particular, **never call \`client.request({ method, path, body })\`** \u2014 that object shape belongs to the discovery *tool*, not the SDK. It will not run the report, and \`(await client.request({...})).rows\` is always \`undefined\`. Use \`client.runReport({ propertyId, ... })\` instead.
|
|
11005
|
+
SDK surface (client created via \`connection(connectionId)\`):
|
|
11006
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch (\`path\` is appended to \`https://analyticsdata.googleapis.com/v1beta/\`; \`{propertyId}\` placeholders are auto-replaced only when a default property is configured on the connection).
|
|
11007
|
+
- \`client.runReport(request)\` \u2014 run a GA4 report. Set \`propertyId\` (bare numeric id) on the request object to target a property; required when no default is configured.
|
|
11008
|
+
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report. \`propertyId\` works the same as \`runReport\`.
|
|
11009
|
+
- \`client.getMetadata(propertyId?)\` \u2014 fetch available dimensions and metrics for a property.
|
|
10991
11010
|
|
|
10992
|
-
|
|
11011
|
+
**Always pass \`propertyId\` explicitly** (the numeric id from the data overview) \u2014 the connection does not necessarily store a default property.
|
|
10993
11012
|
|
|
10994
11013
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
10995
11014
|
|
|
@@ -10998,42 +11017,51 @@ If a handler test fails with \`Connection proxy is not configured\`, retry \u201
|
|
|
10998
11017
|
\`\`\`ts
|
|
10999
11018
|
import { connection } from "@squadbase/vite-server/connectors/google-analytics-oauth";
|
|
11000
11019
|
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
const propertyId = "123456789"; // numeric GA4 property id from the data overview
|
|
11004
|
-
|
|
11005
|
-
const { rows } = await client.runReport({
|
|
11006
|
-
propertyId,
|
|
11007
|
-
dateRanges: [{ startDate: "28daysAgo", endDate: "today" }],
|
|
11008
|
-
dimensions: [{ name: "date" }, { name: "sessionDefaultChannelGroup" }],
|
|
11009
|
-
metrics: [{ name: "sessions" }],
|
|
11010
|
-
});
|
|
11020
|
+
const ga = connection("<connectionId>");
|
|
11021
|
+
const propertyId = "123456789"; // numeric GA4 property id from the data overview
|
|
11011
11022
|
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
}
|
|
11023
|
+
// Convenience methods (pass propertyId explicitly)
|
|
11024
|
+
const { rows, rowCount } = await ga.runReport({
|
|
11025
|
+
propertyId,
|
|
11026
|
+
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
|
|
11027
|
+
dimensions: [{ name: "date" }],
|
|
11028
|
+
metrics: [{ name: "activeUsers" }, { name: "sessions" }],
|
|
11029
|
+
limit: 100,
|
|
11030
|
+
});
|
|
11031
|
+
const metadata = await ga.getMetadata(propertyId);
|
|
11032
|
+
const realtime = await ga.runRealtimeReport({
|
|
11033
|
+
propertyId,
|
|
11034
|
+
metrics: [{ name: "activeUsers" }],
|
|
11035
|
+
dimensions: [{ name: "country" }],
|
|
11036
|
+
});
|
|
11017
11037
|
|
|
11018
|
-
|
|
11019
|
-
}
|
|
11038
|
+
// Low-level authenticated fetch (write the numeric property id into the path)
|
|
11039
|
+
const res = await ga.request(\`properties/\${propertyId}:runReport\`, {
|
|
11040
|
+
method: "POST",
|
|
11041
|
+
body: JSON.stringify({ dateRanges: [{ startDate: "7daysAgo", endDate: "today" }], metrics: [{ name: "activeUsers" }] }),
|
|
11042
|
+
});
|
|
11043
|
+
const data = await res.json();
|
|
11020
11044
|
\`\`\``,
|
|
11021
11045
|
ja: `### \u30C4\u30FC\u30EB
|
|
11022
11046
|
|
|
11023
|
-
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
11047
|
+
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\`{propertyId}\` \u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u30C7\u30D5\u30A9\u30EB\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306E\u307F\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
11024
11048
|
- \`connector_google-analytics-oauth_listAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Analytics\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11025
11049
|
- \`connector_google-analytics-oauth_listProperties\`: \u6307\u5B9A\u30A2\u30AB\u30A6\u30F3\u30C8\u306EGA4\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u30BF\u30FC\u30B2\u30C3\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11026
11050
|
|
|
11027
|
-
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
11028
|
-
|
|
11029
|
-
\u4EE5\u4E0B\u306E\u751F\u306E HTTP \u5F62\u5F0F\u306F\u63A2\u7D22\u7528**\u30C4\u30FC\u30EB**\u306E\u3082\u306E\u3067\u3059\u3002**server-logic\uFF08\u4E0B\u8A18 Business Logic\uFF09\u3067\u306F\u3001\u3053\u308C\u3089\u306E HTTP \u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u624B\u7D44\u307F\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 \u540C\u3058 body \u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u53D6\u308A\u3001\u30D1\u30FC\u30B9\u6E08\u307F JSON \u3092\u8FD4\u3059 SDK \u30E1\u30BD\u30C3\u30C9\u3092\u547C\u3093\u3067\u304F\u3060\u3055\u3044:**
|
|
11051
|
+
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
11030
11052
|
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
| \`GET properties/{propertyId}/metadata\` | \`await client.getMetadata(propertyId)\` |
|
|
11034
|
-
| \`POST properties/{propertyId}:runReport\`\uFF08body: \`{ dateRanges, dimensions, metrics, limit }\`\uFF09 | \`await client.runReport({ propertyId, dateRanges, dimensions, metrics, limit })\` \u2192 \`{ rows, rowCount }\` |
|
|
11053
|
+
#### \u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\uFF08\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u78BA\u8A8D\uFF09
|
|
11054
|
+
- GET properties/{propertyId}/metadata
|
|
11035
11055
|
|
|
11036
|
-
\u30EC\u30DD\u30FC\u30C8\u306E
|
|
11056
|
+
### \u30EC\u30DD\u30FC\u30C8\u306E\u53D6\u5F97
|
|
11057
|
+
- POST properties/{propertyId}:runReport
|
|
11058
|
+
- Body\u4F8B:
|
|
11059
|
+
{
|
|
11060
|
+
"dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
|
|
11061
|
+
"dimensions": [{"name": "date"}],
|
|
11062
|
+
"metrics": [{"name": "activeUsers"}],
|
|
11063
|
+
"limit": 100
|
|
11064
|
+
}
|
|
11037
11065
|
|
|
11038
11066
|
### \u4E3B\u8981\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3
|
|
11039
11067
|
date, country, city, deviceCategory, browser, pagePath, pageTitle,
|
|
@@ -11051,14 +11079,13 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11051
11079
|
|
|
11052
11080
|
\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\u30BF SDK \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\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
11053
11081
|
|
|
11054
|
-
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09
|
|
11055
|
-
- \`client.
|
|
11056
|
-
- \`client.
|
|
11057
|
-
- \`client.
|
|
11058
|
-
|
|
11059
|
-
**\u30A2\u30F3\u30C1\u30D1\u30BF\u30FC\u30F3 \u2014 \u3053\u308C\u306F\u7D76\u5BFE\u306B\u3084\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002** \`client.request(...)\` \u306F\u751F\u306E \`Response\` \u3092\u8FD4\u3059\u4F4E\u30EC\u30D9\u30EB\u306E\u9003\u3052\u9053\u3067\u3042\u308A\u3001\u30EC\u30DD\u30FC\u30C8\u5B9F\u884C\u306E\u624B\u6BB5\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u7279\u306B **\`client.request({ method, path, body })\` \u306F\u7D76\u5BFE\u306B\u547C\u3070\u306A\u3044\u3067\u304F\u3060\u3055\u3044** \u2014 \u305D\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u5F62\u306F\u63A2\u7D22\u7528*\u30C4\u30FC\u30EB*\u306E\u5F62\u3067\u3042\u3063\u3066 SDK \u306E\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30EC\u30DD\u30FC\u30C8\u306F\u5B9F\u884C\u3055\u308C\u305A\u3001\`(await client.request({...})).rows\` \u306F\u5E38\u306B \`undefined\` \u306B\u306A\u308A\u307E\u3059\u3002\u4EE3\u308F\u308A\u306B \`client.runReport({ propertyId, ... })\` \u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
11082
|
+
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
11083
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\uFF08\`path\` \u306F \`https://analyticsdata.googleapis.com/v1beta/\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\`{propertyId}\` \u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u306F\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u30C7\u30D5\u30A9\u30EB\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306E\u307F\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09\u3002
|
|
11084
|
+
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u672A\u8A2D\u5B9A\u306E\u5834\u5408\u306F\u5FC5\u9808\u3067\u3059\u3002
|
|
11085
|
+
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`propertyId\` \u306E\u6271\u3044\u306F \`runReport\` \u3068\u540C\u3058\u3067\u3059\u3002
|
|
11086
|
+
- \`client.getMetadata(propertyId?)\` \u2014 \u6307\u5B9A\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97\u3002
|
|
11060
11087
|
|
|
11061
|
-
**\`propertyId\` \u306F\
|
|
11088
|
+
**\`propertyId\` \u306F\u5FC5\u305A\u660E\u793A\u7684\u306B\u6E21\u3057\u3066\u304F\u3060\u3055\u3044**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u30C7\u30D5\u30A9\u30EB\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u4FDD\u5B58\u3055\u308C\u3066\u3044\u308B\u3068\u306F\u9650\u308A\u307E\u305B\u3093\u3002
|
|
11062
11089
|
|
|
11063
11090
|
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
11064
11091
|
|
|
@@ -11067,32 +11094,41 @@ SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9
|
|
|
11067
11094
|
\`\`\`ts
|
|
11068
11095
|
import { connection } from "@squadbase/vite-server/connectors/google-analytics-oauth";
|
|
11069
11096
|
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
const propertyId = "123456789"; // \u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024\u306E GA4 \u30D7\u30ED\u30D1\u30C6\u30A3ID
|
|
11073
|
-
|
|
11074
|
-
const { rows } = await client.runReport({
|
|
11075
|
-
propertyId,
|
|
11076
|
-
dateRanges: [{ startDate: "28daysAgo", endDate: "today" }],
|
|
11077
|
-
dimensions: [{ name: "date" }, { name: "sessionDefaultChannelGroup" }],
|
|
11078
|
-
metrics: [{ name: "sessions" }],
|
|
11079
|
-
});
|
|
11097
|
+
const ga = connection("<connectionId>");
|
|
11098
|
+
const propertyId = "123456789"; // \u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024\u306E GA4 \u30D7\u30ED\u30D1\u30C6\u30A3ID
|
|
11080
11099
|
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
}
|
|
11100
|
+
// \u4FBF\u5229\u30E1\u30BD\u30C3\u30C9\uFF08propertyId \u3092\u660E\u793A\u7684\u306B\u6E21\u3059\uFF09
|
|
11101
|
+
const { rows, rowCount } = await ga.runReport({
|
|
11102
|
+
propertyId,
|
|
11103
|
+
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
|
|
11104
|
+
dimensions: [{ name: "date" }],
|
|
11105
|
+
metrics: [{ name: "activeUsers" }, { name: "sessions" }],
|
|
11106
|
+
limit: 100,
|
|
11107
|
+
});
|
|
11108
|
+
const metadata = await ga.getMetadata(propertyId);
|
|
11109
|
+
const realtime = await ga.runRealtimeReport({
|
|
11110
|
+
propertyId,
|
|
11111
|
+
metrics: [{ name: "activeUsers" }],
|
|
11112
|
+
dimensions: [{ name: "country" }],
|
|
11113
|
+
});
|
|
11086
11114
|
|
|
11087
|
-
|
|
11088
|
-
}
|
|
11115
|
+
// \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u304F\uFF09
|
|
11116
|
+
const res = await ga.request(\`properties/\${propertyId}:runReport\`, {
|
|
11117
|
+
method: "POST",
|
|
11118
|
+
body: JSON.stringify({ dateRanges: [{ startDate: "7daysAgo", endDate: "today" }], metrics: [{ name: "activeUsers" }] }),
|
|
11119
|
+
});
|
|
11120
|
+
const data = await res.json();
|
|
11089
11121
|
\`\`\``
|
|
11090
11122
|
},
|
|
11091
11123
|
tools: tools16,
|
|
11092
11124
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
11093
|
-
async checkConnection(
|
|
11125
|
+
async checkConnection(params, config) {
|
|
11094
11126
|
const { proxyFetch } = config;
|
|
11095
|
-
const
|
|
11127
|
+
const propertyId = params[parameters16.propertyId.slug];
|
|
11128
|
+
if (!propertyId) {
|
|
11129
|
+
return { success: true };
|
|
11130
|
+
}
|
|
11131
|
+
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
11096
11132
|
try {
|
|
11097
11133
|
const res = await proxyFetch(url, { method: "GET" });
|
|
11098
11134
|
if (!res.ok) {
|
|
@@ -11116,8 +11152,8 @@ export default async function handler(c) {
|
|
|
11116
11152
|
import { z as z26 } from "zod";
|
|
11117
11153
|
|
|
11118
11154
|
// ../connectors/src/lib/normalize-path.ts
|
|
11119
|
-
function normalizeRequestPath(
|
|
11120
|
-
let p =
|
|
11155
|
+
function normalizeRequestPath(path5, basePathSegment) {
|
|
11156
|
+
let p = path5.trim();
|
|
11121
11157
|
if (!p.startsWith("/")) p = "/" + p;
|
|
11122
11158
|
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
11123
11159
|
p = p.slice(basePathSegment.length) || "/";
|
|
@@ -11181,7 +11217,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
11181
11217
|
description: "Call the Google Calendar API as the service account itself (no delegation). Read-only operations only. Only calendars explicitly shared with the service account email are accessible. Pass `scopes` as a read-only Calendar scope (e.g., ['https://www.googleapis.com/auth/calendar.readonly']). Use this tool when the project knowledge records the calendar with `(service-account, ...)` (no `subject`).",
|
|
11182
11218
|
inputSchema: inputSchema26,
|
|
11183
11219
|
outputSchema: outputSchema26,
|
|
11184
|
-
async execute({ connectionId, method, path:
|
|
11220
|
+
async execute({ connectionId, method, path: path5, scopes, queryParams, body }, connections) {
|
|
11185
11221
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
11186
11222
|
if (!connection2) {
|
|
11187
11223
|
return {
|
|
@@ -11202,7 +11238,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
11202
11238
|
}
|
|
11203
11239
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
11204
11240
|
console.log(
|
|
11205
|
-
`[connector-request] google-calendar/${connection2.name}: ${method} ${
|
|
11241
|
+
`[connector-request] google-calendar/${connection2.name}: ${method} ${path5} (service account)`
|
|
11206
11242
|
);
|
|
11207
11243
|
try {
|
|
11208
11244
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -11221,7 +11257,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
11221
11257
|
serviceAccountEmail
|
|
11222
11258
|
};
|
|
11223
11259
|
}
|
|
11224
|
-
const normalizedPath = normalizeRequestPath(
|
|
11260
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT);
|
|
11225
11261
|
let url = `${BASE_URL5}${normalizedPath}`;
|
|
11226
11262
|
if (queryParams) {
|
|
11227
11263
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -11318,7 +11354,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
11318
11354
|
description: "Call the Google Calendar API on behalf of the specified Workspace user via Domain-wide Delegation. Read-only operations only. Pass `subject` as the target user email and `scopes` as a read-only Calendar scope (e.g., ['https://www.googleapis.com/auth/calendar.readonly']). Use this tool when the project knowledge records the calendar with `(delegation, subject: <email>, ...)`. Requires Domain-wide Delegation to be authorized for the service account in the Workspace admin console.",
|
|
11319
11355
|
inputSchema: inputSchema27,
|
|
11320
11356
|
outputSchema: outputSchema27,
|
|
11321
|
-
async execute({ connectionId, method, path:
|
|
11357
|
+
async execute({ connectionId, method, path: path5, subject, scopes, queryParams, body }, connections) {
|
|
11322
11358
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
11323
11359
|
if (!connection2) {
|
|
11324
11360
|
return {
|
|
@@ -11339,7 +11375,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
11339
11375
|
}
|
|
11340
11376
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
11341
11377
|
console.log(
|
|
11342
|
-
`[connector-request] google-calendar/${connection2.name}: ${method} ${
|
|
11378
|
+
`[connector-request] google-calendar/${connection2.name}: ${method} ${path5} subject=${subject}`
|
|
11343
11379
|
);
|
|
11344
11380
|
try {
|
|
11345
11381
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -11359,7 +11395,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
11359
11395
|
serviceAccountEmail
|
|
11360
11396
|
};
|
|
11361
11397
|
}
|
|
11362
|
-
const normalizedPath = normalizeRequestPath(
|
|
11398
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT2);
|
|
11363
11399
|
let url = `${BASE_URL6}${normalizedPath}`;
|
|
11364
11400
|
if (queryParams) {
|
|
11365
11401
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -12441,7 +12477,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
12441
12477
|
{calendarId} in the path is automatically replaced with the connection's default calendar ID.`,
|
|
12442
12478
|
inputSchema: inputSchema29,
|
|
12443
12479
|
outputSchema: outputSchema29,
|
|
12444
|
-
async execute({ connectionId, method, path:
|
|
12480
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
12445
12481
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
12446
12482
|
if (!connection2) {
|
|
12447
12483
|
return {
|
|
@@ -12450,11 +12486,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
12450
12486
|
};
|
|
12451
12487
|
}
|
|
12452
12488
|
console.log(
|
|
12453
|
-
`[connector-request] google-calendar-oauth/${connection2.name}: ${method} ${
|
|
12489
|
+
`[connector-request] google-calendar-oauth/${connection2.name}: ${method} ${path5}`
|
|
12454
12490
|
);
|
|
12455
12491
|
try {
|
|
12456
12492
|
const calendarId = parameters18.calendarId.tryGetValue(connection2) ?? "primary";
|
|
12457
|
-
const resolvedPath =
|
|
12493
|
+
const resolvedPath = path5.replace(/\{calendarId\}/g, calendarId);
|
|
12458
12494
|
const normalizedPath = normalizeRequestPath(
|
|
12459
12495
|
resolvedPath,
|
|
12460
12496
|
BASE_PATH_SEGMENT3
|
|
@@ -12860,7 +12896,7 @@ Supports GET (read) and POST (create/update) methods.
|
|
|
12860
12896
|
Authentication is handled automatically via OAuth proxy.`,
|
|
12861
12897
|
inputSchema: inputSchema30,
|
|
12862
12898
|
outputSchema: outputSchema30,
|
|
12863
|
-
async execute({ connectionId, method, path:
|
|
12899
|
+
async execute({ connectionId, method, path: path5, body, queryParams }, connections, config) {
|
|
12864
12900
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
12865
12901
|
if (!connection2) {
|
|
12866
12902
|
return {
|
|
@@ -12869,11 +12905,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
12869
12905
|
};
|
|
12870
12906
|
}
|
|
12871
12907
|
console.log(
|
|
12872
|
-
`[connector-request] google-docs/${connection2.name}: ${method} ${
|
|
12908
|
+
`[connector-request] google-docs/${connection2.name}: ${method} ${path5}`
|
|
12873
12909
|
);
|
|
12874
12910
|
try {
|
|
12875
12911
|
const normalizedPath = normalizeRequestPath(
|
|
12876
|
-
|
|
12912
|
+
path5,
|
|
12877
12913
|
DOCS_BASE_PATH_SEGMENT
|
|
12878
12914
|
);
|
|
12879
12915
|
let url = `${DOCS_BASE_URL}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
@@ -13325,7 +13361,7 @@ Supports GET (read/list/download), POST (create/copy), and PATCH (update) method
|
|
|
13325
13361
|
Authentication is handled automatically via OAuth proxy.`,
|
|
13326
13362
|
inputSchema: inputSchema31,
|
|
13327
13363
|
outputSchema: outputSchema31,
|
|
13328
|
-
async execute({ connectionId, method, path:
|
|
13364
|
+
async execute({ connectionId, method, path: path5, body, queryParams }, connections, config) {
|
|
13329
13365
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
13330
13366
|
if (!connection2) {
|
|
13331
13367
|
return {
|
|
@@ -13334,10 +13370,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
13334
13370
|
};
|
|
13335
13371
|
}
|
|
13336
13372
|
console.log(
|
|
13337
|
-
`[connector-request] google-drive/${connection2.name}: ${method} ${
|
|
13373
|
+
`[connector-request] google-drive/${connection2.name}: ${method} ${path5}`
|
|
13338
13374
|
);
|
|
13339
13375
|
try {
|
|
13340
|
-
const normalizedPath = normalizeRequestPath(
|
|
13376
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT4);
|
|
13341
13377
|
let url = `${BASE_URL9}${normalizedPath}`;
|
|
13342
13378
|
if (queryParams) {
|
|
13343
13379
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -13766,7 +13802,7 @@ The caller must include the target spreadsheetId in the path explicitly.
|
|
|
13766
13802
|
Authentication is handled automatically via OAuth proxy.`,
|
|
13767
13803
|
inputSchema: inputSchema32,
|
|
13768
13804
|
outputSchema: outputSchema32,
|
|
13769
|
-
async execute({ connectionId, method, path:
|
|
13805
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
13770
13806
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
13771
13807
|
if (!connection2) {
|
|
13772
13808
|
return {
|
|
@@ -13775,11 +13811,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
13775
13811
|
};
|
|
13776
13812
|
}
|
|
13777
13813
|
console.log(
|
|
13778
|
-
`[connector-request] google-sheets/${connection2.name}: ${method} ${
|
|
13814
|
+
`[connector-request] google-sheets/${connection2.name}: ${method} ${path5}`
|
|
13779
13815
|
);
|
|
13780
13816
|
try {
|
|
13781
13817
|
const normalizedPath = normalizeRequestPath(
|
|
13782
|
-
|
|
13818
|
+
path5,
|
|
13783
13819
|
SHEETS_BASE_PATH_SEGMENT
|
|
13784
13820
|
);
|
|
13785
13821
|
let url = `${SHEETS_BASE_URL}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
@@ -14282,7 +14318,7 @@ Supports GET (read) and POST (create/update) methods.
|
|
|
14282
14318
|
Authentication is handled automatically via OAuth proxy.`,
|
|
14283
14319
|
inputSchema: inputSchema33,
|
|
14284
14320
|
outputSchema: outputSchema33,
|
|
14285
|
-
async execute({ connectionId, method, path:
|
|
14321
|
+
async execute({ connectionId, method, path: path5, body, queryParams }, connections, config) {
|
|
14286
14322
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
14287
14323
|
if (!connection2) {
|
|
14288
14324
|
return {
|
|
@@ -14291,11 +14327,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
14291
14327
|
};
|
|
14292
14328
|
}
|
|
14293
14329
|
console.log(
|
|
14294
|
-
`[connector-request] google-slides/${connection2.name}: ${method} ${
|
|
14330
|
+
`[connector-request] google-slides/${connection2.name}: ${method} ${path5}`
|
|
14295
14331
|
);
|
|
14296
14332
|
try {
|
|
14297
14333
|
const normalizedPath = normalizeRequestPath(
|
|
14298
|
-
|
|
14334
|
+
path5,
|
|
14299
14335
|
SLIDES_BASE_PATH_SEGMENT
|
|
14300
14336
|
);
|
|
14301
14337
|
let url = `${SLIDES_BASE_URL}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
@@ -14586,7 +14622,7 @@ var requestTool11 = new ConnectorTool({
|
|
|
14586
14622
|
Authentication is handled automatically via OAuth proxy.`,
|
|
14587
14623
|
inputSchema: inputSchema34,
|
|
14588
14624
|
outputSchema: outputSchema34,
|
|
14589
|
-
async execute({ connectionId, method, path:
|
|
14625
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
14590
14626
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
14591
14627
|
if (!connection2) {
|
|
14592
14628
|
return {
|
|
@@ -14595,10 +14631,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
14595
14631
|
};
|
|
14596
14632
|
}
|
|
14597
14633
|
console.log(
|
|
14598
|
-
`[connector-request] hubspot-oauth/${connection2.name}: ${method} ${
|
|
14634
|
+
`[connector-request] hubspot-oauth/${connection2.name}: ${method} ${path5}`
|
|
14599
14635
|
);
|
|
14600
14636
|
try {
|
|
14601
|
-
let url = `${BASE_URL10}${
|
|
14637
|
+
let url = `${BASE_URL10}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
14602
14638
|
if (queryParams) {
|
|
14603
14639
|
const searchParams = new URLSearchParams(queryParams);
|
|
14604
14640
|
url += `?${searchParams.toString()}`;
|
|
@@ -14674,8 +14710,8 @@ var hubspotOnboarding = new ConnectorOnboarding({
|
|
|
14674
14710
|
|
|
14675
14711
|
// ../connectors/src/connectors/hubspot-oauth/utils.ts
|
|
14676
14712
|
var BASE_URL11 = "https://api.hubapi.com";
|
|
14677
|
-
function apiFetch2(proxyFetch,
|
|
14678
|
-
const url = `${BASE_URL11}${
|
|
14713
|
+
function apiFetch2(proxyFetch, path5, init) {
|
|
14714
|
+
const url = `${BASE_URL11}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
14679
14715
|
return proxyFetch(url, init);
|
|
14680
14716
|
}
|
|
14681
14717
|
|
|
@@ -14997,7 +15033,7 @@ var requestTool12 = new ConnectorTool({
|
|
|
14997
15033
|
Authentication is handled automatically via OAuth proxy.`,
|
|
14998
15034
|
inputSchema: inputSchema35,
|
|
14999
15035
|
outputSchema: outputSchema35,
|
|
15000
|
-
async execute({ connectionId, method, path:
|
|
15036
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
15001
15037
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
15002
15038
|
if (!connection2) {
|
|
15003
15039
|
return {
|
|
@@ -15006,10 +15042,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
15006
15042
|
};
|
|
15007
15043
|
}
|
|
15008
15044
|
console.log(
|
|
15009
|
-
`[connector-request] stripe-oauth/${connection2.name}: ${method} ${
|
|
15045
|
+
`[connector-request] stripe-oauth/${connection2.name}: ${method} ${path5}`
|
|
15010
15046
|
);
|
|
15011
15047
|
try {
|
|
15012
|
-
let url = `${BASE_URL12}${
|
|
15048
|
+
let url = `${BASE_URL12}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15013
15049
|
if (queryParams) {
|
|
15014
15050
|
const searchParams = new URLSearchParams(queryParams);
|
|
15015
15051
|
url += `?${searchParams.toString()}`;
|
|
@@ -15423,7 +15459,7 @@ Authentication is handled automatically using the configured API Key (Bearer tok
|
|
|
15423
15459
|
Use this tool for all Stripe API interactions: querying charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more.`,
|
|
15424
15460
|
inputSchema: inputSchema36,
|
|
15425
15461
|
outputSchema: outputSchema36,
|
|
15426
|
-
async execute({ connectionId, method, path:
|
|
15462
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
15427
15463
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
15428
15464
|
if (!connection2) {
|
|
15429
15465
|
return {
|
|
@@ -15432,11 +15468,11 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
|
|
|
15432
15468
|
};
|
|
15433
15469
|
}
|
|
15434
15470
|
console.log(
|
|
15435
|
-
`[connector-request] stripe-api-key/${connection2.name}: ${method} ${
|
|
15471
|
+
`[connector-request] stripe-api-key/${connection2.name}: ${method} ${path5}`
|
|
15436
15472
|
);
|
|
15437
15473
|
try {
|
|
15438
15474
|
const apiKey = parameters25.apiKey.getValue(connection2);
|
|
15439
|
-
let url = `${BASE_URL14}${
|
|
15475
|
+
let url = `${BASE_URL14}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15440
15476
|
if (queryParams) {
|
|
15441
15477
|
const searchParams = new URLSearchParams(queryParams);
|
|
15442
15478
|
url += `?${searchParams.toString()}`;
|
|
@@ -15516,12 +15552,12 @@ var stripeApiKeyOnboarding = new ConnectorOnboarding({
|
|
|
15516
15552
|
|
|
15517
15553
|
// ../connectors/src/connectors/stripe-api-key/utils.ts
|
|
15518
15554
|
var BASE_URL15 = "https://api.stripe.com";
|
|
15519
|
-
async function apiFetch3(params,
|
|
15555
|
+
async function apiFetch3(params, path5, init) {
|
|
15520
15556
|
const apiKey = params[parameters25.apiKey.slug];
|
|
15521
15557
|
if (!apiKey) {
|
|
15522
15558
|
throw new Error("stripe-api-key: missing required parameter: api-key");
|
|
15523
15559
|
}
|
|
15524
|
-
const url = `${BASE_URL15}${
|
|
15560
|
+
const url = `${BASE_URL15}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15525
15561
|
const headers = new Headers(init?.headers);
|
|
15526
15562
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
15527
15563
|
return fetch(url, { ...init, headers });
|
|
@@ -15560,8 +15596,8 @@ var ENTITY_PATHS2 = {
|
|
|
15560
15596
|
paymentIntents: "/v1/payment_intents?limit=3"
|
|
15561
15597
|
};
|
|
15562
15598
|
var ENTITY_VALUES2 = Object.keys(ENTITY_PATHS2);
|
|
15563
|
-
async function defaultFetchEntity(params,
|
|
15564
|
-
return apiFetch3(params,
|
|
15599
|
+
async function defaultFetchEntity(params, path5) {
|
|
15600
|
+
return apiFetch3(params, path5);
|
|
15565
15601
|
}
|
|
15566
15602
|
function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "Stripe") {
|
|
15567
15603
|
return {
|
|
@@ -15895,7 +15931,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
15895
15931
|
{baseId} in the path is automatically replaced with the connection's default base ID if configured.`,
|
|
15896
15932
|
inputSchema: inputSchema37,
|
|
15897
15933
|
outputSchema: outputSchema37,
|
|
15898
|
-
async execute({ connectionId, method, path:
|
|
15934
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
15899
15935
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
15900
15936
|
if (!connection2) {
|
|
15901
15937
|
return {
|
|
@@ -15904,11 +15940,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
15904
15940
|
};
|
|
15905
15941
|
}
|
|
15906
15942
|
console.log(
|
|
15907
|
-
`[connector-request] airtable-oauth/${connection2.name}: ${method} ${
|
|
15943
|
+
`[connector-request] airtable-oauth/${connection2.name}: ${method} ${path5}`
|
|
15908
15944
|
);
|
|
15909
15945
|
try {
|
|
15910
15946
|
const baseId = parameters26.baseId.tryGetValue(connection2);
|
|
15911
|
-
const resolvedPath = baseId ?
|
|
15947
|
+
const resolvedPath = baseId ? path5.replace(/\{baseId\}/g, baseId) : path5;
|
|
15912
15948
|
let url = `${BASE_URL16}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
15913
15949
|
if (queryParams) {
|
|
15914
15950
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -15993,8 +16029,8 @@ var airtableOauthOnboarding = new ConnectorOnboarding({
|
|
|
15993
16029
|
|
|
15994
16030
|
// ../connectors/src/connectors/airtable-oauth/utils.ts
|
|
15995
16031
|
var BASE_URL17 = "https://api.airtable.com/v0";
|
|
15996
|
-
function apiFetch4(proxyFetch,
|
|
15997
|
-
const url = `${BASE_URL17}${
|
|
16032
|
+
function apiFetch4(proxyFetch, path5, init) {
|
|
16033
|
+
const url = `${BASE_URL17}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15998
16034
|
return proxyFetch(url, init);
|
|
15999
16035
|
}
|
|
16000
16036
|
|
|
@@ -16333,7 +16369,7 @@ var parameters27 = {
|
|
|
16333
16369
|
};
|
|
16334
16370
|
|
|
16335
16371
|
// ../connectors/src/connectors/kintone/utils.ts
|
|
16336
|
-
async function apiFetch5(params,
|
|
16372
|
+
async function apiFetch5(params, path5, init) {
|
|
16337
16373
|
const baseUrl = params[parameters27.baseUrl.slug];
|
|
16338
16374
|
const username = params[parameters27.username.slug];
|
|
16339
16375
|
const password = params[parameters27.password.slug];
|
|
@@ -16343,7 +16379,7 @@ async function apiFetch5(params, path4, init) {
|
|
|
16343
16379
|
);
|
|
16344
16380
|
}
|
|
16345
16381
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
16346
|
-
const normalizedPath =
|
|
16382
|
+
const normalizedPath = path5.replace(/^\/+/, "");
|
|
16347
16383
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${normalizedPath}`;
|
|
16348
16384
|
const headers = new Headers(init?.headers);
|
|
16349
16385
|
headers.set("X-Cybozu-Authorization", authToken);
|
|
@@ -16557,18 +16593,18 @@ var requestTool15 = new ConnectorTool({
|
|
|
16557
16593
|
Authentication is handled automatically using username and password.`,
|
|
16558
16594
|
inputSchema: inputSchema38,
|
|
16559
16595
|
outputSchema: outputSchema38,
|
|
16560
|
-
async execute({ connectionId, method, path:
|
|
16596
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
16561
16597
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
16562
16598
|
if (!connection2) {
|
|
16563
16599
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
16564
16600
|
}
|
|
16565
|
-
console.log(`[connector-request] kintone/${connection2.name}: ${method} ${
|
|
16601
|
+
console.log(`[connector-request] kintone/${connection2.name}: ${method} ${path5}`);
|
|
16566
16602
|
try {
|
|
16567
16603
|
const baseUrl = parameters27.baseUrl.getValue(connection2);
|
|
16568
16604
|
const username = parameters27.username.getValue(connection2);
|
|
16569
16605
|
const password = parameters27.password.getValue(connection2);
|
|
16570
16606
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
16571
|
-
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${
|
|
16607
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path5}`;
|
|
16572
16608
|
const controller = new AbortController();
|
|
16573
16609
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS26);
|
|
16574
16610
|
try {
|
|
@@ -16873,7 +16909,7 @@ var parameters28 = {
|
|
|
16873
16909
|
};
|
|
16874
16910
|
|
|
16875
16911
|
// ../connectors/src/connectors/kintone-api-token/utils.ts
|
|
16876
|
-
async function apiFetch6(params,
|
|
16912
|
+
async function apiFetch6(params, path5, init) {
|
|
16877
16913
|
const baseUrl = params[parameters28.baseUrl.slug];
|
|
16878
16914
|
const apiToken = params[parameters28.apiToken.slug];
|
|
16879
16915
|
if (!baseUrl || !apiToken) {
|
|
@@ -16881,7 +16917,7 @@ async function apiFetch6(params, path4, init) {
|
|
|
16881
16917
|
"kintone-api-token: missing required parameter(s): base-url, api-token"
|
|
16882
16918
|
);
|
|
16883
16919
|
}
|
|
16884
|
-
const normalizedPath =
|
|
16920
|
+
const normalizedPath = path5.replace(/^\/+/, "");
|
|
16885
16921
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${normalizedPath}`;
|
|
16886
16922
|
const headers = new Headers(init?.headers);
|
|
16887
16923
|
headers.set("X-Cybozu-API-Token", apiToken);
|
|
@@ -16994,8 +17030,8 @@ var APP_PARAM_KEY_BY_ENDPOINT = {
|
|
|
16994
17030
|
"app.json": "id"
|
|
16995
17031
|
};
|
|
16996
17032
|
var DEFAULT_APP_PARAM_KEY = "app";
|
|
16997
|
-
function injectAppIntoPath(
|
|
16998
|
-
const [head, query = ""] =
|
|
17033
|
+
function injectAppIntoPath(path5, appId) {
|
|
17034
|
+
const [head, query = ""] = path5.split("?", 2);
|
|
16999
17035
|
const endpoint = head.toLowerCase();
|
|
17000
17036
|
const paramKey = APP_PARAM_KEY_BY_ENDPOINT[endpoint] ?? DEFAULT_APP_PARAM_KEY;
|
|
17001
17037
|
const params = new URLSearchParams(query);
|
|
@@ -17036,17 +17072,17 @@ var requestTool16 = new ConnectorTool({
|
|
|
17036
17072
|
Authentication is handled automatically using the API token.`,
|
|
17037
17073
|
inputSchema: inputSchema39,
|
|
17038
17074
|
outputSchema: outputSchema39,
|
|
17039
|
-
async execute({ connectionId, method, path:
|
|
17075
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
17040
17076
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
17041
17077
|
if (!connection2) {
|
|
17042
17078
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
17043
17079
|
}
|
|
17044
|
-
console.log(`[connector-request] kintone-api-token/${connection2.name}: ${method} ${
|
|
17080
|
+
console.log(`[connector-request] kintone-api-token/${connection2.name}: ${method} ${path5}`);
|
|
17045
17081
|
try {
|
|
17046
17082
|
const baseUrl = parameters28.baseUrl.getValue(connection2);
|
|
17047
17083
|
const apiToken = parameters28.apiToken.getValue(connection2);
|
|
17048
17084
|
const appId = parameters28.appId.getValue(connection2);
|
|
17049
|
-
const normalizedPath =
|
|
17085
|
+
const normalizedPath = path5.replace(/^\/+/, "");
|
|
17050
17086
|
const pathHead = normalizedPath.split("?")[0] ?? "";
|
|
17051
17087
|
if (/^apps\.json$/i.test(pathHead)) {
|
|
17052
17088
|
return {
|
|
@@ -17263,8 +17299,8 @@ export default async function handler(c: Context) {
|
|
|
17263
17299
|
};
|
|
17264
17300
|
}
|
|
17265
17301
|
try {
|
|
17266
|
-
const
|
|
17267
|
-
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${
|
|
17302
|
+
const path5 = appId ? `app.json?id=${encodeURIComponent(appId)}` : `app/form/fields.json?app=0`;
|
|
17303
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path5}`;
|
|
17268
17304
|
const res = await fetch(url, {
|
|
17269
17305
|
method: "GET",
|
|
17270
17306
|
headers: {
|
|
@@ -17345,7 +17381,7 @@ var parameters29 = {
|
|
|
17345
17381
|
|
|
17346
17382
|
// ../connectors/src/connectors/wix-store/utils.ts
|
|
17347
17383
|
var BASE_URL18 = "https://www.wixapis.com";
|
|
17348
|
-
async function apiFetch7(params,
|
|
17384
|
+
async function apiFetch7(params, path5, init) {
|
|
17349
17385
|
const apiKey = params[parameters29.apiKey.slug];
|
|
17350
17386
|
const siteId = params[parameters29.siteId.slug];
|
|
17351
17387
|
if (!apiKey || !siteId) {
|
|
@@ -17353,7 +17389,7 @@ async function apiFetch7(params, path4, init) {
|
|
|
17353
17389
|
"wix-store: missing required parameters: api-key and site-id"
|
|
17354
17390
|
);
|
|
17355
17391
|
}
|
|
17356
|
-
const url = `${BASE_URL18}${
|
|
17392
|
+
const url = `${BASE_URL18}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
17357
17393
|
const headers = new Headers(init?.headers);
|
|
17358
17394
|
headers.set("Authorization", apiKey);
|
|
17359
17395
|
headers.set("wix-site-id", siteId);
|
|
@@ -17399,8 +17435,8 @@ var QUERY_SPECS = {
|
|
|
17399
17435
|
totalField: "totalResults"
|
|
17400
17436
|
}
|
|
17401
17437
|
};
|
|
17402
|
-
function lookupNumeric(data,
|
|
17403
|
-
const parts =
|
|
17438
|
+
function lookupNumeric(data, path5) {
|
|
17439
|
+
const parts = path5.split(".");
|
|
17404
17440
|
let cur = data;
|
|
17405
17441
|
for (const p of parts) {
|
|
17406
17442
|
if (!cur || typeof cur !== "object") return void 0;
|
|
@@ -17482,16 +17518,16 @@ var requestTool17 = new ConnectorTool({
|
|
|
17482
17518
|
Authentication is handled automatically using the API Key and Site ID.`,
|
|
17483
17519
|
inputSchema: inputSchema40,
|
|
17484
17520
|
outputSchema: outputSchema40,
|
|
17485
|
-
async execute({ connectionId, method, path:
|
|
17521
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
17486
17522
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
17487
17523
|
if (!connection2) {
|
|
17488
17524
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
17489
17525
|
}
|
|
17490
|
-
console.log(`[connector-request] wix-store/${connection2.name}: ${method} ${
|
|
17526
|
+
console.log(`[connector-request] wix-store/${connection2.name}: ${method} ${path5}`);
|
|
17491
17527
|
try {
|
|
17492
17528
|
const apiKey = parameters29.apiKey.getValue(connection2);
|
|
17493
17529
|
const siteId = parameters29.siteId.getValue(connection2);
|
|
17494
|
-
const url = `${BASE_URL19}${
|
|
17530
|
+
const url = `${BASE_URL19}${path5}`;
|
|
17495
17531
|
const controller = new AbortController();
|
|
17496
17532
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS28);
|
|
17497
17533
|
try {
|
|
@@ -17789,7 +17825,7 @@ function adminApiBase(host) {
|
|
|
17789
17825
|
}
|
|
17790
17826
|
return `https://${trimmed}`;
|
|
17791
17827
|
}
|
|
17792
|
-
function adminApiFetch(params,
|
|
17828
|
+
function adminApiFetch(params, path5, init) {
|
|
17793
17829
|
const host = params[parameters30.host.slug];
|
|
17794
17830
|
const token = params[parameters30.token.slug];
|
|
17795
17831
|
if (!host) {
|
|
@@ -17798,7 +17834,7 @@ function adminApiFetch(params, path4, init) {
|
|
|
17798
17834
|
if (!token) {
|
|
17799
17835
|
throw new Error(`dbt: missing required parameter: ${parameters30.token.slug}`);
|
|
17800
17836
|
}
|
|
17801
|
-
const trimmedPath =
|
|
17837
|
+
const trimmedPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
17802
17838
|
const headers = new Headers(init?.headers);
|
|
17803
17839
|
headers.set("Authorization", `Token ${token}`);
|
|
17804
17840
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -17887,8 +17923,8 @@ async function fetchRecentRunCount(params, projectId2) {
|
|
|
17887
17923
|
const accountId = params[parameters30.accountId.slug];
|
|
17888
17924
|
if (!accountId) return null;
|
|
17889
17925
|
try {
|
|
17890
|
-
const
|
|
17891
|
-
const res = await adminApiFetch(params,
|
|
17926
|
+
const path5 = `/api/v2/accounts/${encodeURIComponent(accountId)}/runs/?project_id=${encodeURIComponent(projectId2)}&limit=1&order_by=-id`;
|
|
17927
|
+
const res = await adminApiFetch(params, path5);
|
|
17892
17928
|
if (!res.ok) return null;
|
|
17893
17929
|
const data = await res.json();
|
|
17894
17930
|
const total = data.extra?.pagination?.total_count;
|
|
@@ -18139,11 +18175,11 @@ function classifyByTags(tags) {
|
|
|
18139
18175
|
function classifyModel(m) {
|
|
18140
18176
|
const fromTags = classifyByTags(m.tags ?? []);
|
|
18141
18177
|
if (fromTags) return fromTags;
|
|
18142
|
-
const
|
|
18143
|
-
if (
|
|
18144
|
-
if (MART_PATH_RE.test(
|
|
18145
|
-
if (INT_PATH_RE.test(
|
|
18146
|
-
if (STG_PATH_RE.test(
|
|
18178
|
+
const path5 = (m.filePath ?? "").toLowerCase();
|
|
18179
|
+
if (path5) {
|
|
18180
|
+
if (MART_PATH_RE.test(path5)) return "mart";
|
|
18181
|
+
if (INT_PATH_RE.test(path5)) return "intermediate";
|
|
18182
|
+
if (STG_PATH_RE.test(path5)) return "staging";
|
|
18147
18183
|
}
|
|
18148
18184
|
const name = (m.name ?? "").toLowerCase();
|
|
18149
18185
|
if (MART_NAME_RE.test(name)) return "mart";
|
|
@@ -19499,7 +19535,7 @@ function getBaseUrl(params) {
|
|
|
19499
19535
|
const region = params[parameters35.region.slug];
|
|
19500
19536
|
return region === "eu" ? "https://analytics.eu.amplitude.com" : "https://amplitude.com";
|
|
19501
19537
|
}
|
|
19502
|
-
async function apiFetch8(params,
|
|
19538
|
+
async function apiFetch8(params, path5, init) {
|
|
19503
19539
|
const apiKey = params[parameters35.apiKey.slug];
|
|
19504
19540
|
const secretKey = params[parameters35.secretKey.slug];
|
|
19505
19541
|
if (!apiKey || !secretKey) {
|
|
@@ -19507,7 +19543,7 @@ async function apiFetch8(params, path4, init) {
|
|
|
19507
19543
|
"amplitude: missing required parameters: api-key and secret-key"
|
|
19508
19544
|
);
|
|
19509
19545
|
}
|
|
19510
|
-
const url = `${getBaseUrl(params)}${
|
|
19546
|
+
const url = `${getBaseUrl(params)}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
19511
19547
|
const headers = new Headers(init?.headers);
|
|
19512
19548
|
headers.set("Authorization", `Basic ${btoa(`${apiKey}:${secretKey}`)}`);
|
|
19513
19549
|
return fetch(url, { ...init, headers });
|
|
@@ -19913,12 +19949,12 @@ var parameters36 = {
|
|
|
19913
19949
|
|
|
19914
19950
|
// ../connectors/src/connectors/attio/utils.ts
|
|
19915
19951
|
var BASE_URL20 = "https://api.attio.com/v2";
|
|
19916
|
-
async function apiFetch9(params,
|
|
19952
|
+
async function apiFetch9(params, path5, init) {
|
|
19917
19953
|
const apiKey = params[parameters36.apiKey.slug];
|
|
19918
19954
|
if (!apiKey) {
|
|
19919
19955
|
throw new Error("attio: missing required parameter: api-key");
|
|
19920
19956
|
}
|
|
19921
|
-
const url = `${BASE_URL20}${
|
|
19957
|
+
const url = `${BASE_URL20}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
19922
19958
|
const headers = new Headers(init?.headers);
|
|
19923
19959
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
19924
19960
|
headers.set("Accept", "application/json");
|
|
@@ -20059,7 +20095,7 @@ Use this tool for every Attio API interaction, including: querying records (peop
|
|
|
20059
20095
|
Record queries use POST /objects/{object}/records/query with a JSON body containing \`filter\`, \`sorts\`, \`limit\`, and \`offset\`. Record updates use PATCH (append multiselect) or PUT (overwrite multiselect). Workspace members, tasks, webhooks, notes, threads, comments, and meetings live at top-level paths \u2014 the workspace-members path uses a snake_case underscore: /workspace_members.`,
|
|
20060
20096
|
inputSchema: inputSchema44,
|
|
20061
20097
|
outputSchema: outputSchema44,
|
|
20062
|
-
async execute({ connectionId, method, path:
|
|
20098
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
20063
20099
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
20064
20100
|
if (!connection2) {
|
|
20065
20101
|
return {
|
|
@@ -20068,11 +20104,11 @@ Record queries use POST /objects/{object}/records/query with a JSON body contain
|
|
|
20068
20104
|
};
|
|
20069
20105
|
}
|
|
20070
20106
|
console.log(
|
|
20071
|
-
`[connector-request] attio/${connection2.name}: ${method} ${
|
|
20107
|
+
`[connector-request] attio/${connection2.name}: ${method} ${path5}`
|
|
20072
20108
|
);
|
|
20073
20109
|
try {
|
|
20074
20110
|
const apiKey = parameters36.apiKey.getValue(connection2);
|
|
20075
|
-
const url = `${BASE_URL21}${
|
|
20111
|
+
const url = `${BASE_URL21}${path5}`;
|
|
20076
20112
|
const controller = new AbortController();
|
|
20077
20113
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS31);
|
|
20078
20114
|
try {
|
|
@@ -20528,9 +20564,9 @@ async function getAccessToken3(params) {
|
|
|
20528
20564
|
}
|
|
20529
20565
|
return data.access_token;
|
|
20530
20566
|
}
|
|
20531
|
-
async function apiFetch10(params,
|
|
20567
|
+
async function apiFetch10(params, path5, init) {
|
|
20532
20568
|
const token = await getAccessToken3(params);
|
|
20533
|
-
const url = `${getStoreBaseUrl(params)}${
|
|
20569
|
+
const url = `${getStoreBaseUrl(params)}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
20534
20570
|
const headers = new Headers(init?.headers);
|
|
20535
20571
|
headers.set("X-Shopify-Access-Token", token);
|
|
20536
20572
|
if (!headers.has("Content-Type")) {
|
|
@@ -20565,8 +20601,8 @@ var COUNT_PATHS = {
|
|
|
20565
20601
|
inventory: null,
|
|
20566
20602
|
discounts: `/admin/api/${SHOPIFY_API_VERSION}/price_rules/count.json`
|
|
20567
20603
|
};
|
|
20568
|
-
async function defaultFetchCount(params,
|
|
20569
|
-
return apiFetch10(params,
|
|
20604
|
+
async function defaultFetchCount(params, path5) {
|
|
20605
|
+
return apiFetch10(params, path5);
|
|
20570
20606
|
}
|
|
20571
20607
|
function createShopifySetupFlow(fetchCount5 = defaultFetchCount, labelPrefix = "Shopify") {
|
|
20572
20608
|
return {
|
|
@@ -20597,10 +20633,10 @@ function createShopifySetupFlow(fetchCount5 = defaultFetchCount, labelPrefix = "
|
|
|
20597
20633
|
).slice(0, SHOPIFY_SETUP_MAX_ENTITIES);
|
|
20598
20634
|
const sections = [`## ${labelPrefix}`, ""];
|
|
20599
20635
|
for (const entity of selected) {
|
|
20600
|
-
const
|
|
20636
|
+
const path5 = COUNT_PATHS[entity];
|
|
20601
20637
|
let count = "available";
|
|
20602
|
-
if (
|
|
20603
|
-
const res = await fetchCount5(rt.params,
|
|
20638
|
+
if (path5) {
|
|
20639
|
+
const res = await fetchCount5(rt.params, path5);
|
|
20604
20640
|
if (res.ok) {
|
|
20605
20641
|
const data = await res.json();
|
|
20606
20642
|
if (typeof data.count === "number") count = String(data.count);
|
|
@@ -20650,7 +20686,7 @@ The store domain is resolved from the connection \u2014 only provide the path st
|
|
|
20650
20686
|
Use this tool for all Shopify API interactions: listing products, orders, customers, inventory, collections, and more.`,
|
|
20651
20687
|
inputSchema: inputSchema45,
|
|
20652
20688
|
outputSchema: outputSchema45,
|
|
20653
|
-
async execute({ connectionId, method, path:
|
|
20689
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
20654
20690
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
20655
20691
|
if (!connection2) {
|
|
20656
20692
|
return {
|
|
@@ -20659,7 +20695,7 @@ Use this tool for all Shopify API interactions: listing products, orders, custom
|
|
|
20659
20695
|
};
|
|
20660
20696
|
}
|
|
20661
20697
|
console.log(
|
|
20662
|
-
`[connector-request] shopify/${connection2.name}: ${method} ${
|
|
20698
|
+
`[connector-request] shopify/${connection2.name}: ${method} ${path5}`
|
|
20663
20699
|
);
|
|
20664
20700
|
try {
|
|
20665
20701
|
const storeDomain = parameters37.storeDomain.getValue(connection2);
|
|
@@ -20691,7 +20727,7 @@ Use this tool for all Shopify API interactions: listing products, orders, custom
|
|
|
20691
20727
|
error: "access_token not found in token response"
|
|
20692
20728
|
};
|
|
20693
20729
|
}
|
|
20694
|
-
const url = `https://${storeDomain}${
|
|
20730
|
+
const url = `https://${storeDomain}${path5}`;
|
|
20695
20731
|
const controller = new AbortController();
|
|
20696
20732
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS32);
|
|
20697
20733
|
try {
|
|
@@ -21006,7 +21042,7 @@ var requestTool22 = new ConnectorTool({
|
|
|
21006
21042
|
Authentication is handled automatically via OAuth proxy.`,
|
|
21007
21043
|
inputSchema: inputSchema46,
|
|
21008
21044
|
outputSchema: outputSchema46,
|
|
21009
|
-
async execute({ connectionId, method, path:
|
|
21045
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
21010
21046
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
21011
21047
|
if (!connection2) {
|
|
21012
21048
|
return {
|
|
@@ -21015,10 +21051,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
21015
21051
|
};
|
|
21016
21052
|
}
|
|
21017
21053
|
console.log(
|
|
21018
|
-
`[connector-request] shopify-oauth/${connection2.name}: ${method} ${
|
|
21054
|
+
`[connector-request] shopify-oauth/${connection2.name}: ${method} ${path5}`
|
|
21019
21055
|
);
|
|
21020
21056
|
try {
|
|
21021
|
-
let url =
|
|
21057
|
+
let url = path5;
|
|
21022
21058
|
if (queryParams) {
|
|
21023
21059
|
const searchParams = new URLSearchParams(queryParams);
|
|
21024
21060
|
url += `${url.includes("?") ? "&" : "?"}${searchParams.toString()}`;
|
|
@@ -21153,10 +21189,10 @@ var shopifyOauthSetupFlow = {
|
|
|
21153
21189
|
sections.push("| Entity | Count |");
|
|
21154
21190
|
sections.push("|--------|-------|");
|
|
21155
21191
|
for (const entity of selected) {
|
|
21156
|
-
const
|
|
21192
|
+
const path5 = COUNT_PATHS2[entity];
|
|
21157
21193
|
let count = "available";
|
|
21158
|
-
if (
|
|
21159
|
-
const res = await rt.config.proxyFetch(
|
|
21194
|
+
if (path5) {
|
|
21195
|
+
const res = await rt.config.proxyFetch(path5, { method: "GET" });
|
|
21160
21196
|
if (res.ok) {
|
|
21161
21197
|
const data = await res.json();
|
|
21162
21198
|
if (typeof data.count === "number") count = String(data.count);
|
|
@@ -21369,12 +21405,12 @@ var parameters39 = {
|
|
|
21369
21405
|
|
|
21370
21406
|
// ../connectors/src/connectors/hubspot/utils.ts
|
|
21371
21407
|
var BASE_URL22 = "https://api.hubapi.com";
|
|
21372
|
-
async function apiFetch11(params,
|
|
21408
|
+
async function apiFetch11(params, path5, init) {
|
|
21373
21409
|
const apiKey = params[parameters39.apiKey.slug];
|
|
21374
21410
|
if (!apiKey) {
|
|
21375
21411
|
throw new Error("hubspot: missing required parameter: api-key");
|
|
21376
21412
|
}
|
|
21377
|
-
const url = `${BASE_URL22}${
|
|
21413
|
+
const url = `${BASE_URL22}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
21378
21414
|
const headers = new Headers(init?.headers);
|
|
21379
21415
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
21380
21416
|
headers.set("Accept", "application/json");
|
|
@@ -21515,7 +21551,7 @@ Use this tool for all HubSpot API interactions: querying contacts, deals, compan
|
|
|
21515
21551
|
Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex queries with filters.`,
|
|
21516
21552
|
inputSchema: inputSchema47,
|
|
21517
21553
|
outputSchema: outputSchema47,
|
|
21518
|
-
async execute({ connectionId, method, path:
|
|
21554
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
21519
21555
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
21520
21556
|
if (!connection2) {
|
|
21521
21557
|
return {
|
|
@@ -21524,11 +21560,11 @@ Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex q
|
|
|
21524
21560
|
};
|
|
21525
21561
|
}
|
|
21526
21562
|
console.log(
|
|
21527
|
-
`[connector-request] hubspot/${connection2.name}: ${method} ${
|
|
21563
|
+
`[connector-request] hubspot/${connection2.name}: ${method} ${path5}`
|
|
21528
21564
|
);
|
|
21529
21565
|
try {
|
|
21530
21566
|
const apiKey = parameters39.apiKey.getValue(connection2);
|
|
21531
|
-
const url = `${BASE_URL23}${
|
|
21567
|
+
const url = `${BASE_URL23}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
21532
21568
|
const controller = new AbortController();
|
|
21533
21569
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS34);
|
|
21534
21570
|
try {
|
|
@@ -21786,7 +21822,7 @@ var parameters40 = {
|
|
|
21786
21822
|
};
|
|
21787
21823
|
|
|
21788
21824
|
// ../connectors/src/connectors/jira/utils.ts
|
|
21789
|
-
async function apiFetch12(params,
|
|
21825
|
+
async function apiFetch12(params, path5, init) {
|
|
21790
21826
|
const instanceUrl = params[parameters40.instanceUrl.slug];
|
|
21791
21827
|
const email = params[parameters40.email.slug];
|
|
21792
21828
|
const apiToken = params[parameters40.apiToken.slug];
|
|
@@ -21800,7 +21836,7 @@ async function apiFetch12(params, path4, init) {
|
|
|
21800
21836
|
throw new Error("jira: missing required parameter: api-token");
|
|
21801
21837
|
}
|
|
21802
21838
|
const credentials = Buffer.from(`${email}:${apiToken}`).toString("base64");
|
|
21803
|
-
const trimmedPath =
|
|
21839
|
+
const trimmedPath = path5.replace(/^\/+/, "");
|
|
21804
21840
|
const url = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${trimmedPath}`;
|
|
21805
21841
|
const headers = new Headers(init?.headers);
|
|
21806
21842
|
headers.set("Authorization", `Basic ${credentials}`);
|
|
@@ -21986,17 +22022,17 @@ Use this tool for all Jira operations: listing projects, searching issues with J
|
|
|
21986
22022
|
The base URL and authentication credentials are configured per connection \u2014 only specify the API path relative to /rest/api/3/.`,
|
|
21987
22023
|
inputSchema: inputSchema48,
|
|
21988
22024
|
outputSchema: outputSchema48,
|
|
21989
|
-
async execute({ connectionId, method, path:
|
|
22025
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
21990
22026
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
21991
22027
|
if (!connection2) {
|
|
21992
22028
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
21993
22029
|
}
|
|
21994
|
-
console.log(`[connector-request] jira-api-key/${connection2.name}: ${method} ${
|
|
22030
|
+
console.log(`[connector-request] jira-api-key/${connection2.name}: ${method} ${path5}`);
|
|
21995
22031
|
try {
|
|
21996
22032
|
const instanceUrl = parameters40.instanceUrl.getValue(connection2);
|
|
21997
22033
|
const email = parameters40.email.getValue(connection2);
|
|
21998
22034
|
const apiToken = parameters40.apiToken.getValue(connection2);
|
|
21999
|
-
const baseUrl = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${
|
|
22035
|
+
const baseUrl = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${path5}`;
|
|
22000
22036
|
const credentials = Buffer.from(`${email}:${apiToken}`).toString("base64");
|
|
22001
22037
|
const controller = new AbortController();
|
|
22002
22038
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS35);
|
|
@@ -22715,12 +22751,12 @@ var parameters42 = {
|
|
|
22715
22751
|
|
|
22716
22752
|
// ../connectors/src/connectors/asana/utils.ts
|
|
22717
22753
|
var BASE_URL26 = "https://app.asana.com/api/1.0";
|
|
22718
|
-
async function apiFetch13(params,
|
|
22754
|
+
async function apiFetch13(params, path5, init) {
|
|
22719
22755
|
const token = params[parameters42.personalAccessToken.slug];
|
|
22720
22756
|
if (!token) {
|
|
22721
22757
|
throw new Error("asana: missing required parameter: personal-access-token");
|
|
22722
22758
|
}
|
|
22723
|
-
const url = `${BASE_URL26}${
|
|
22759
|
+
const url = `${BASE_URL26}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
22724
22760
|
const headers = new Headers(init?.headers);
|
|
22725
22761
|
headers.set("Authorization", `Bearer ${token}`);
|
|
22726
22762
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -22915,7 +22951,7 @@ Common endpoints:
|
|
|
22915
22951
|
Pagination: Use limit (1-100) and offset query parameters. The response includes next_page.offset for the next page.`,
|
|
22916
22952
|
inputSchema: inputSchema50,
|
|
22917
22953
|
outputSchema: outputSchema50,
|
|
22918
|
-
async execute({ connectionId, method, path:
|
|
22954
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
22919
22955
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
22920
22956
|
if (!connection2) {
|
|
22921
22957
|
return {
|
|
@@ -22924,11 +22960,11 @@ Pagination: Use limit (1-100) and offset query parameters. The response includes
|
|
|
22924
22960
|
};
|
|
22925
22961
|
}
|
|
22926
22962
|
console.log(
|
|
22927
|
-
`[connector-request] asana/${connection2.name}: ${method} ${
|
|
22963
|
+
`[connector-request] asana/${connection2.name}: ${method} ${path5}`
|
|
22928
22964
|
);
|
|
22929
22965
|
try {
|
|
22930
22966
|
const token = parameters42.personalAccessToken.getValue(connection2);
|
|
22931
|
-
const normalizedPath = normalizeRequestPath(
|
|
22967
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT5);
|
|
22932
22968
|
const url = `${BASE_URL27}${normalizedPath}`;
|
|
22933
22969
|
const controller = new AbortController();
|
|
22934
22970
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS37);
|
|
@@ -24224,12 +24260,12 @@ var parameters45 = {
|
|
|
24224
24260
|
// ../connectors/src/connectors/notion/utils.ts
|
|
24225
24261
|
var BASE_URL28 = "https://api.notion.com/v1";
|
|
24226
24262
|
var NOTION_VERSION = "2022-06-28";
|
|
24227
|
-
async function apiFetch14(params,
|
|
24263
|
+
async function apiFetch14(params, path5, init) {
|
|
24228
24264
|
const apiKey = params[parameters45.apiKey.slug];
|
|
24229
24265
|
if (!apiKey) {
|
|
24230
24266
|
throw new Error("notion: missing required parameter: api-key");
|
|
24231
24267
|
}
|
|
24232
|
-
const url = `${BASE_URL28}${
|
|
24268
|
+
const url = `${BASE_URL28}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24233
24269
|
const headers = new Headers(init?.headers);
|
|
24234
24270
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
24235
24271
|
headers.set("Notion-Version", NOTION_VERSION);
|
|
@@ -24464,7 +24500,7 @@ Use this tool for all Notion API interactions: searching pages/databases, queryi
|
|
|
24464
24500
|
Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
24465
24501
|
inputSchema: inputSchema55,
|
|
24466
24502
|
outputSchema: outputSchema55,
|
|
24467
|
-
async execute({ connectionId, method, path:
|
|
24503
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
24468
24504
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
24469
24505
|
if (!connection2) {
|
|
24470
24506
|
return {
|
|
@@ -24473,11 +24509,11 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
24473
24509
|
};
|
|
24474
24510
|
}
|
|
24475
24511
|
console.log(
|
|
24476
|
-
`[connector-request] notion/${connection2.name}: ${method} ${
|
|
24512
|
+
`[connector-request] notion/${connection2.name}: ${method} ${path5}`
|
|
24477
24513
|
);
|
|
24478
24514
|
try {
|
|
24479
24515
|
const apiKey = parameters45.apiKey.getValue(connection2);
|
|
24480
|
-
const url = `${BASE_URL29}${
|
|
24516
|
+
const url = `${BASE_URL29}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24481
24517
|
const controller = new AbortController();
|
|
24482
24518
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS38);
|
|
24483
24519
|
try {
|
|
@@ -24764,7 +24800,7 @@ Use this tool for all Notion API interactions: searching pages/databases, queryi
|
|
|
24764
24800
|
Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
24765
24801
|
inputSchema: inputSchema56,
|
|
24766
24802
|
outputSchema: outputSchema56,
|
|
24767
|
-
async execute({ connectionId, method, path:
|
|
24803
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
24768
24804
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
24769
24805
|
if (!connection2) {
|
|
24770
24806
|
return {
|
|
@@ -24773,10 +24809,10 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
24773
24809
|
};
|
|
24774
24810
|
}
|
|
24775
24811
|
console.log(
|
|
24776
|
-
`[connector-request] notion-oauth/${connection2.name}: ${method} ${
|
|
24812
|
+
`[connector-request] notion-oauth/${connection2.name}: ${method} ${path5}`
|
|
24777
24813
|
);
|
|
24778
24814
|
try {
|
|
24779
|
-
const url = `${BASE_URL30}${
|
|
24815
|
+
const url = `${BASE_URL30}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24780
24816
|
const token = await getProxyToken19(config.oauthProxy);
|
|
24781
24817
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
24782
24818
|
const controller = new AbortController();
|
|
@@ -24855,8 +24891,8 @@ var parameters46 = {};
|
|
|
24855
24891
|
// ../connectors/src/connectors/notion-oauth/utils.ts
|
|
24856
24892
|
var BASE_URL31 = "https://api.notion.com/v1";
|
|
24857
24893
|
var NOTION_VERSION4 = "2022-06-28";
|
|
24858
|
-
function apiFetch15(proxyFetch,
|
|
24859
|
-
const url = `${BASE_URL31}${
|
|
24894
|
+
function apiFetch15(proxyFetch, path5, init) {
|
|
24895
|
+
const url = `${BASE_URL31}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24860
24896
|
const headers = new Headers(init?.headers);
|
|
24861
24897
|
headers.set("Notion-Version", NOTION_VERSION4);
|
|
24862
24898
|
if (init?.body && !headers.has("Content-Type")) {
|
|
@@ -25297,13 +25333,13 @@ var metaAdsOnboarding = new ConnectorOnboarding({
|
|
|
25297
25333
|
|
|
25298
25334
|
// ../connectors/src/connectors/meta-ads/utils.ts
|
|
25299
25335
|
var BASE_URL33 = "https://graph.facebook.com/v21.0";
|
|
25300
|
-
async function apiFetch16(params,
|
|
25336
|
+
async function apiFetch16(params, path5, init) {
|
|
25301
25337
|
const accessToken = params[parameters47.accessToken.slug];
|
|
25302
25338
|
if (!accessToken) {
|
|
25303
25339
|
throw new Error("meta-ads: missing required parameter: access-token");
|
|
25304
25340
|
}
|
|
25305
|
-
const sep =
|
|
25306
|
-
const url = `${BASE_URL33}${
|
|
25341
|
+
const sep = path5.includes("?") ? "&" : "?";
|
|
25342
|
+
const url = `${BASE_URL33}${path5.startsWith("/") ? "" : "/"}${path5}${sep}access_token=${encodeURIComponent(accessToken)}`;
|
|
25307
25343
|
return fetch(url, init);
|
|
25308
25344
|
}
|
|
25309
25345
|
|
|
@@ -25458,7 +25494,7 @@ Authentication is handled via the configured access token.
|
|
|
25458
25494
|
{adAccountId} in the path is automatically replaced with the connection's ad account ID (with act_ prefix added).`,
|
|
25459
25495
|
inputSchema: inputSchema58,
|
|
25460
25496
|
outputSchema: outputSchema58,
|
|
25461
|
-
async execute({ connectionId, method, path:
|
|
25497
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
25462
25498
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
25463
25499
|
if (!connection2) {
|
|
25464
25500
|
return {
|
|
@@ -25467,12 +25503,12 @@ Authentication is handled via the configured access token.
|
|
|
25467
25503
|
};
|
|
25468
25504
|
}
|
|
25469
25505
|
console.log(
|
|
25470
|
-
`[connector-request] meta-ads/${connection2.name}: ${method} ${
|
|
25506
|
+
`[connector-request] meta-ads/${connection2.name}: ${method} ${path5}`
|
|
25471
25507
|
);
|
|
25472
25508
|
try {
|
|
25473
25509
|
const accessToken = parameters47.accessToken.getValue(connection2);
|
|
25474
25510
|
const adAccountId = parameters47.adAccountId.tryGetValue(connection2) ?? "";
|
|
25475
|
-
const resolvedPath = adAccountId ?
|
|
25511
|
+
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
25476
25512
|
let url = `${BASE_URL34}${resolvedPath}`;
|
|
25477
25513
|
const params = new URLSearchParams(queryParams ?? {});
|
|
25478
25514
|
params.set("access_token", accessToken);
|
|
@@ -26022,7 +26058,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
26022
26058
|
{adAccountId} in the path is automatically replaced with the connection's ad account ID.`,
|
|
26023
26059
|
inputSchema: inputSchema60,
|
|
26024
26060
|
outputSchema: outputSchema60,
|
|
26025
|
-
async execute({ connectionId, method, path:
|
|
26061
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
26026
26062
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
26027
26063
|
if (!connection2) {
|
|
26028
26064
|
return {
|
|
@@ -26031,11 +26067,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
26031
26067
|
};
|
|
26032
26068
|
}
|
|
26033
26069
|
console.log(
|
|
26034
|
-
`[connector-request] meta-ads-oauth/${connection2.name}: ${method} ${
|
|
26070
|
+
`[connector-request] meta-ads-oauth/${connection2.name}: ${method} ${path5}`
|
|
26035
26071
|
);
|
|
26036
26072
|
try {
|
|
26037
26073
|
const adAccountId = parameters48.adAccountId.tryGetValue(connection2) ?? "";
|
|
26038
|
-
const resolvedPath = adAccountId ?
|
|
26074
|
+
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
26039
26075
|
let url = `${BASE_URL37}${resolvedPath}`;
|
|
26040
26076
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
26041
26077
|
const params = new URLSearchParams(queryParams);
|
|
@@ -26606,7 +26642,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
26606
26642
|
The advertiser_id is automatically injected if configured.`,
|
|
26607
26643
|
inputSchema: inputSchema62,
|
|
26608
26644
|
outputSchema: outputSchema62,
|
|
26609
|
-
async execute({ connectionId, method, path:
|
|
26645
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
26610
26646
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
26611
26647
|
if (!connection2) {
|
|
26612
26648
|
return {
|
|
@@ -26615,11 +26651,11 @@ The advertiser_id is automatically injected if configured.`,
|
|
|
26615
26651
|
};
|
|
26616
26652
|
}
|
|
26617
26653
|
console.log(
|
|
26618
|
-
`[connector-request] tiktok-ads/${connection2.name}: ${method} ${
|
|
26654
|
+
`[connector-request] tiktok-ads/${connection2.name}: ${method} ${path5}`
|
|
26619
26655
|
);
|
|
26620
26656
|
try {
|
|
26621
26657
|
const advertiserId = parameters49.advertiserId.tryGetValue(connection2) ?? "";
|
|
26622
|
-
const normalizedPath = normalizeRequestPath(
|
|
26658
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT6);
|
|
26623
26659
|
let url = `${BASE_URL40}${normalizedPath}`;
|
|
26624
26660
|
if (method === "GET") {
|
|
26625
26661
|
const params = new URLSearchParams(queryParams ?? {});
|
|
@@ -26904,14 +26940,14 @@ function extractDatacenter(apiKey) {
|
|
|
26904
26940
|
}
|
|
26905
26941
|
return dc;
|
|
26906
26942
|
}
|
|
26907
|
-
async function apiFetch17(params,
|
|
26943
|
+
async function apiFetch17(params, path5, init) {
|
|
26908
26944
|
const apiKey = params[parameters50.apiKey.slug];
|
|
26909
26945
|
if (!apiKey) {
|
|
26910
26946
|
throw new Error("mailchimp: missing required parameter: api-key");
|
|
26911
26947
|
}
|
|
26912
26948
|
const dc = extractDatacenter(apiKey);
|
|
26913
26949
|
const baseUrl = `https://${dc}.api.mailchimp.com/3.0`;
|
|
26914
|
-
const url = `${baseUrl}${
|
|
26950
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
26915
26951
|
const headers = new Headers(init?.headers);
|
|
26916
26952
|
headers.set("Authorization", `Basic ${btoa(`anystring:${apiKey}`)}`);
|
|
26917
26953
|
return fetch(url, { ...init, headers });
|
|
@@ -27044,7 +27080,7 @@ Use this tool for all Mailchimp API interactions: managing audiences/lists, camp
|
|
|
27044
27080
|
The datacenter is automatically extracted from the API key suffix.`,
|
|
27045
27081
|
inputSchema: inputSchema63,
|
|
27046
27082
|
outputSchema: outputSchema63,
|
|
27047
|
-
async execute({ connectionId, method, path:
|
|
27083
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
27048
27084
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27049
27085
|
if (!connection2) {
|
|
27050
27086
|
return {
|
|
@@ -27053,13 +27089,13 @@ The datacenter is automatically extracted from the API key suffix.`,
|
|
|
27053
27089
|
};
|
|
27054
27090
|
}
|
|
27055
27091
|
console.log(
|
|
27056
|
-
`[connector-request] mailchimp/${connection2.name}: ${method} ${
|
|
27092
|
+
`[connector-request] mailchimp/${connection2.name}: ${method} ${path5}`
|
|
27057
27093
|
);
|
|
27058
27094
|
try {
|
|
27059
27095
|
const apiKey = parameters50.apiKey.getValue(connection2);
|
|
27060
27096
|
const dc = extractDatacenter2(apiKey);
|
|
27061
27097
|
const baseUrl = `https://${dc}.api.mailchimp.com/3.0`;
|
|
27062
|
-
let url = `${baseUrl}${
|
|
27098
|
+
let url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27063
27099
|
if (queryParams) {
|
|
27064
27100
|
const searchParams = new URLSearchParams(queryParams);
|
|
27065
27101
|
url += `?${searchParams.toString()}`;
|
|
@@ -27372,7 +27408,7 @@ var parameters51 = {
|
|
|
27372
27408
|
};
|
|
27373
27409
|
|
|
27374
27410
|
// ../connectors/src/connectors/mailchimp-oauth/utils.ts
|
|
27375
|
-
function apiFetch18(params, proxyFetch,
|
|
27411
|
+
function apiFetch18(params, proxyFetch, path5, init) {
|
|
27376
27412
|
const serverPrefix = params[parameters51.serverPrefix.slug];
|
|
27377
27413
|
if (!serverPrefix) {
|
|
27378
27414
|
throw new Error(
|
|
@@ -27380,7 +27416,7 @@ function apiFetch18(params, proxyFetch, path4, init) {
|
|
|
27380
27416
|
);
|
|
27381
27417
|
}
|
|
27382
27418
|
const baseUrl = `https://${serverPrefix}.api.mailchimp.com/3.0`;
|
|
27383
|
-
const url = `${baseUrl}${
|
|
27419
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27384
27420
|
return proxyFetch(url, init);
|
|
27385
27421
|
}
|
|
27386
27422
|
|
|
@@ -27528,7 +27564,7 @@ var requestTool33 = new ConnectorTool({
|
|
|
27528
27564
|
Authentication is handled automatically via OAuth proxy.`,
|
|
27529
27565
|
inputSchema: inputSchema64,
|
|
27530
27566
|
outputSchema: outputSchema64,
|
|
27531
|
-
async execute({ connectionId, method, path:
|
|
27567
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
27532
27568
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27533
27569
|
if (!connection2) {
|
|
27534
27570
|
return {
|
|
@@ -27537,12 +27573,12 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
27537
27573
|
};
|
|
27538
27574
|
}
|
|
27539
27575
|
console.log(
|
|
27540
|
-
`[connector-request] mailchimp-oauth/${connection2.name}: ${method} ${
|
|
27576
|
+
`[connector-request] mailchimp-oauth/${connection2.name}: ${method} ${path5}`
|
|
27541
27577
|
);
|
|
27542
27578
|
try {
|
|
27543
27579
|
const serverPrefix = parameters51.serverPrefix.getValue(connection2);
|
|
27544
27580
|
const baseUrl = `https://${serverPrefix}.api.mailchimp.com/3.0`;
|
|
27545
|
-
let url = `${baseUrl}${
|
|
27581
|
+
let url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27546
27582
|
if (queryParams) {
|
|
27547
27583
|
const searchParams = new URLSearchParams(queryParams);
|
|
27548
27584
|
url += `?${searchParams.toString()}`;
|
|
@@ -27785,14 +27821,14 @@ var parameters52 = {
|
|
|
27785
27821
|
};
|
|
27786
27822
|
|
|
27787
27823
|
// ../connectors/src/connectors/customerio/utils.ts
|
|
27788
|
-
async function apiFetch19(params,
|
|
27824
|
+
async function apiFetch19(params, path5, init) {
|
|
27789
27825
|
const apiKey = params[parameters52.appApiKey.slug];
|
|
27790
27826
|
if (!apiKey) {
|
|
27791
27827
|
throw new Error("customerio: missing required parameter: app-api-key");
|
|
27792
27828
|
}
|
|
27793
27829
|
const region = params[parameters52.region.slug];
|
|
27794
27830
|
const baseUrl = region === "eu" ? "https://api-eu.customer.io" : "https://api.customer.io";
|
|
27795
|
-
const url = `${baseUrl}${
|
|
27831
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27796
27832
|
const headers = new Headers(init?.headers);
|
|
27797
27833
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
27798
27834
|
return fetch(url, { ...init, headers });
|
|
@@ -27849,10 +27885,10 @@ async function fetchEntityCount(params, entity) {
|
|
|
27849
27885
|
campaigns: "/v1/campaigns",
|
|
27850
27886
|
newsletters: "/v1/newsletters"
|
|
27851
27887
|
};
|
|
27852
|
-
const
|
|
27853
|
-
if (!
|
|
27888
|
+
const path5 = endpoint[entity];
|
|
27889
|
+
if (!path5) return "available";
|
|
27854
27890
|
try {
|
|
27855
|
-
const res = await apiFetch19(params,
|
|
27891
|
+
const res = await apiFetch19(params, path5);
|
|
27856
27892
|
if (!res.ok) return "available";
|
|
27857
27893
|
const data = await res.json();
|
|
27858
27894
|
if (typeof data.count === "number") return String(data.count);
|
|
@@ -27938,7 +27974,7 @@ Use this tool for reading customer data, managing campaigns, segments, broadcast
|
|
|
27938
27974
|
The App API is the read and management path for Customer.io data.`,
|
|
27939
27975
|
inputSchema: inputSchema65,
|
|
27940
27976
|
outputSchema: outputSchema65,
|
|
27941
|
-
async execute({ connectionId, method, path:
|
|
27977
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
27942
27978
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27943
27979
|
if (!connection2) {
|
|
27944
27980
|
return {
|
|
@@ -27947,13 +27983,13 @@ The App API is the read and management path for Customer.io data.`,
|
|
|
27947
27983
|
};
|
|
27948
27984
|
}
|
|
27949
27985
|
console.log(
|
|
27950
|
-
`[connector-request] customerio/${connection2.name}: ${method} ${
|
|
27986
|
+
`[connector-request] customerio/${connection2.name}: ${method} ${path5}`
|
|
27951
27987
|
);
|
|
27952
27988
|
try {
|
|
27953
27989
|
const appApiKey = parameters52.appApiKey.getValue(connection2);
|
|
27954
27990
|
const region = parameters52.region.tryGetValue(connection2);
|
|
27955
27991
|
const baseUrl = getBaseUrl2(region);
|
|
27956
|
-
let url = `${baseUrl}${
|
|
27992
|
+
let url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27957
27993
|
if (queryParams) {
|
|
27958
27994
|
const searchParams = new URLSearchParams(queryParams);
|
|
27959
27995
|
url += `?${searchParams.toString()}`;
|
|
@@ -28278,7 +28314,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
28278
28314
|
description: "Call the Gmail API on behalf of the specified Workspace user via Domain-wide Delegation. Read-only operations only. Pass `subject` as the target user email and `scopes` as ['https://www.googleapis.com/auth/gmail.readonly']. Paths are relative to https://gmail.googleapis.com/gmail/v1/users \u2014 use '/me' as the userId prefix (e.g., '/me/messages'). Requires Domain-wide Delegation to be authorized for the service account in the Workspace admin console.",
|
|
28279
28315
|
inputSchema: inputSchema66,
|
|
28280
28316
|
outputSchema: outputSchema66,
|
|
28281
|
-
async execute({ connectionId, method, path:
|
|
28317
|
+
async execute({ connectionId, method, path: path5, subject, scopes, queryParams, body }, connections) {
|
|
28282
28318
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
28283
28319
|
if (!connection2) {
|
|
28284
28320
|
return {
|
|
@@ -28299,7 +28335,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
28299
28335
|
}
|
|
28300
28336
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
28301
28337
|
console.log(
|
|
28302
|
-
`[connector-request] gmail/${connection2.name}: ${method} ${
|
|
28338
|
+
`[connector-request] gmail/${connection2.name}: ${method} ${path5} subject=${subject}`
|
|
28303
28339
|
);
|
|
28304
28340
|
try {
|
|
28305
28341
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -28319,7 +28355,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
28319
28355
|
serviceAccountEmail
|
|
28320
28356
|
};
|
|
28321
28357
|
}
|
|
28322
|
-
const normalizedPath = normalizeRequestPath(
|
|
28358
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT7);
|
|
28323
28359
|
let url = `${BASE_URL41}${normalizedPath}`;
|
|
28324
28360
|
if (queryParams) {
|
|
28325
28361
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -28882,7 +28918,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
28882
28918
|
All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me' as the userId prefix (e.g., '/me/messages').`,
|
|
28883
28919
|
inputSchema: inputSchema67,
|
|
28884
28920
|
outputSchema: outputSchema67,
|
|
28885
|
-
async execute({ connectionId, method, path:
|
|
28921
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
28886
28922
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
28887
28923
|
if (!connection2) {
|
|
28888
28924
|
return {
|
|
@@ -28891,10 +28927,10 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
28891
28927
|
};
|
|
28892
28928
|
}
|
|
28893
28929
|
console.log(
|
|
28894
|
-
`[connector-request] gmail-oauth/${connection2.name}: ${method} ${
|
|
28930
|
+
`[connector-request] gmail-oauth/${connection2.name}: ${method} ${path5}`
|
|
28895
28931
|
);
|
|
28896
28932
|
try {
|
|
28897
|
-
const normalizedPath = normalizeRequestPath(
|
|
28933
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT8);
|
|
28898
28934
|
let url = `${BASE_URL42}${normalizedPath}`;
|
|
28899
28935
|
if (queryParams) {
|
|
28900
28936
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -29336,7 +29372,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
29336
29372
|
description: "Call the Google Workspace Admin SDK Reports API on behalf of the specified Workspace admin via Domain-wide Delegation. Read-only operations only. Pass `subject` as the admin user email and `scopes` as one or both of ['https://www.googleapis.com/auth/admin.reports.audit.readonly', 'https://www.googleapis.com/auth/admin.reports.usage.readonly']. Paths are relative to https://admin.googleapis.com/admin/reports/v1 (e.g., '/activity/users/all/applications/login', '/usage/users/all/dates/2025-04-01'). Requires Domain-wide Delegation to be authorized for the service account in the Workspace admin console.",
|
|
29337
29373
|
inputSchema: inputSchema68,
|
|
29338
29374
|
outputSchema: outputSchema68,
|
|
29339
|
-
async execute({ connectionId, method, path:
|
|
29375
|
+
async execute({ connectionId, method, path: path5, subject, scopes, queryParams }, connections) {
|
|
29340
29376
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
29341
29377
|
if (!connection2) {
|
|
29342
29378
|
return {
|
|
@@ -29357,7 +29393,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
29357
29393
|
}
|
|
29358
29394
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
29359
29395
|
console.log(
|
|
29360
|
-
`[connector-request] google-audit-log/${connection2.name}: ${method} ${
|
|
29396
|
+
`[connector-request] google-audit-log/${connection2.name}: ${method} ${path5} subject=${subject}`
|
|
29361
29397
|
);
|
|
29362
29398
|
try {
|
|
29363
29399
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -29377,7 +29413,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
29377
29413
|
serviceAccountEmail
|
|
29378
29414
|
};
|
|
29379
29415
|
}
|
|
29380
|
-
const normalizedPath = normalizeRequestPath(
|
|
29416
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT9);
|
|
29381
29417
|
let url = `${BASE_URL43}${normalizedPath}`;
|
|
29382
29418
|
if (queryParams) {
|
|
29383
29419
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -30303,7 +30339,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
30303
30339
|
Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatically.`,
|
|
30304
30340
|
inputSchema: inputSchema70,
|
|
30305
30341
|
outputSchema: outputSchema70,
|
|
30306
|
-
async execute({ connectionId, method, path:
|
|
30342
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
30307
30343
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
30308
30344
|
if (!connection2) {
|
|
30309
30345
|
return {
|
|
@@ -30312,11 +30348,11 @@ Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatic
|
|
|
30312
30348
|
};
|
|
30313
30349
|
}
|
|
30314
30350
|
console.log(
|
|
30315
|
-
`[connector-request] linkedin-ads/${connection2.name}: ${method} ${
|
|
30351
|
+
`[connector-request] linkedin-ads/${connection2.name}: ${method} ${path5}`
|
|
30316
30352
|
);
|
|
30317
30353
|
try {
|
|
30318
30354
|
const adAccountId = parameters56.adAccountId.tryGetValue(connection2) ?? "";
|
|
30319
|
-
const resolvedPath = adAccountId ?
|
|
30355
|
+
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
30320
30356
|
let url = `${BASE_URL46}${resolvedPath}`;
|
|
30321
30357
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
30322
30358
|
const params = new URLSearchParams(queryParams);
|
|
@@ -30664,7 +30700,7 @@ function normalizeSubdomain(raw) {
|
|
|
30664
30700
|
function basicAuthHeader(email, apiToken) {
|
|
30665
30701
|
return `Basic ${Buffer.from(`${email}/token:${apiToken}`).toString("base64")}`;
|
|
30666
30702
|
}
|
|
30667
|
-
async function apiFetch20(params,
|
|
30703
|
+
async function apiFetch20(params, path5, init) {
|
|
30668
30704
|
const subdomain = params[parameters57.subdomain.slug];
|
|
30669
30705
|
const email = params[parameters57.email.slug];
|
|
30670
30706
|
const apiToken = params[parameters57.apiToken.slug];
|
|
@@ -30673,7 +30709,7 @@ async function apiFetch20(params, path4, init) {
|
|
|
30673
30709
|
"zendesk: missing required parameter(s) (subdomain, email, api-token)"
|
|
30674
30710
|
);
|
|
30675
30711
|
}
|
|
30676
|
-
const url = `https://${normalizeSubdomain(subdomain)}.zendesk.com${
|
|
30712
|
+
const url = `https://${normalizeSubdomain(subdomain)}.zendesk.com${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
30677
30713
|
const headers = new Headers(init?.headers);
|
|
30678
30714
|
headers.set("Authorization", basicAuthHeader(email, apiToken));
|
|
30679
30715
|
headers.set("Accept", "application/json");
|
|
@@ -30720,8 +30756,8 @@ async function listBrands(params) {
|
|
|
30720
30756
|
const data = await res.json();
|
|
30721
30757
|
return data.brands ?? [];
|
|
30722
30758
|
}
|
|
30723
|
-
async function fetchCount(params,
|
|
30724
|
-
const res = await apiFetch20(params,
|
|
30759
|
+
async function fetchCount(params, path5, countField) {
|
|
30760
|
+
const res = await apiFetch20(params, path5);
|
|
30725
30761
|
if (!res.ok) return null;
|
|
30726
30762
|
const data = await res.json();
|
|
30727
30763
|
const raw = data[countField];
|
|
@@ -30836,7 +30872,7 @@ Use this tool for all Zendesk API interactions: querying tickets, users, organiz
|
|
|
30836
30872
|
Zendesk uses cursor-based pagination with page[size] and page[after] parameters. All endpoints return .json suffix.`,
|
|
30837
30873
|
inputSchema: inputSchema71,
|
|
30838
30874
|
outputSchema: outputSchema71,
|
|
30839
|
-
async execute({ connectionId, method, path:
|
|
30875
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
30840
30876
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
30841
30877
|
if (!connection2) {
|
|
30842
30878
|
return {
|
|
@@ -30845,7 +30881,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
30845
30881
|
};
|
|
30846
30882
|
}
|
|
30847
30883
|
console.log(
|
|
30848
|
-
`[connector-request] zendesk/${connection2.name}: ${method} ${
|
|
30884
|
+
`[connector-request] zendesk/${connection2.name}: ${method} ${path5}`
|
|
30849
30885
|
);
|
|
30850
30886
|
try {
|
|
30851
30887
|
const subdomain = parameters57.subdomain.getValue(connection2);
|
|
@@ -30854,7 +30890,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
30854
30890
|
const authToken = Buffer.from(`${email}/token:${apiToken}`).toString(
|
|
30855
30891
|
"base64"
|
|
30856
30892
|
);
|
|
30857
|
-
const url = `https://${subdomain}.zendesk.com${
|
|
30893
|
+
const url = `https://${subdomain}.zendesk.com${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
30858
30894
|
const controller = new AbortController();
|
|
30859
30895
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS54);
|
|
30860
30896
|
try {
|
|
@@ -31178,7 +31214,7 @@ Use this tool for all Zendesk API interactions: querying tickets, users, organiz
|
|
|
31178
31214
|
Zendesk uses cursor-based pagination with page[size] and page[after] parameters. All endpoint paths end with .json.`,
|
|
31179
31215
|
inputSchema: inputSchema72,
|
|
31180
31216
|
outputSchema: outputSchema72,
|
|
31181
|
-
async execute({ connectionId, method, path:
|
|
31217
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
31182
31218
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
31183
31219
|
if (!connection2) {
|
|
31184
31220
|
return {
|
|
@@ -31187,10 +31223,10 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
31187
31223
|
};
|
|
31188
31224
|
}
|
|
31189
31225
|
console.log(
|
|
31190
|
-
`[connector-request] zendesk-oauth/${connection2.name}: ${method} ${
|
|
31226
|
+
`[connector-request] zendesk-oauth/${connection2.name}: ${method} ${path5}`
|
|
31191
31227
|
);
|
|
31192
31228
|
try {
|
|
31193
|
-
let url =
|
|
31229
|
+
let url = path5;
|
|
31194
31230
|
if (queryParams) {
|
|
31195
31231
|
const searchParams = new URLSearchParams(queryParams);
|
|
31196
31232
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -31268,8 +31304,8 @@ var zendeskOauthOnboarding = new ConnectorOnboarding({
|
|
|
31268
31304
|
});
|
|
31269
31305
|
|
|
31270
31306
|
// ../connectors/src/connectors/zendesk-oauth/utils.ts
|
|
31271
|
-
function apiFetch21(proxyFetch,
|
|
31272
|
-
const url =
|
|
31307
|
+
function apiFetch21(proxyFetch, path5, init) {
|
|
31308
|
+
const url = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
31273
31309
|
const headers = new Headers(init?.headers);
|
|
31274
31310
|
headers.set("Accept", "application/json");
|
|
31275
31311
|
return proxyFetch(url, { ...init, headers });
|
|
@@ -31310,8 +31346,8 @@ async function listBrands2(proxyFetch) {
|
|
|
31310
31346
|
const data = await res.json();
|
|
31311
31347
|
return data.brands ?? [];
|
|
31312
31348
|
}
|
|
31313
|
-
async function fetchCount2(proxyFetch,
|
|
31314
|
-
const res = await apiFetch21(proxyFetch,
|
|
31349
|
+
async function fetchCount2(proxyFetch, path5) {
|
|
31350
|
+
const res = await apiFetch21(proxyFetch, path5);
|
|
31315
31351
|
if (!res.ok) return null;
|
|
31316
31352
|
const data = await res.json();
|
|
31317
31353
|
if (typeof data["count"] === "number") return data["count"];
|
|
@@ -31626,12 +31662,12 @@ var parameters59 = {
|
|
|
31626
31662
|
// ../connectors/src/connectors/intercom/utils.ts
|
|
31627
31663
|
var BASE_URL47 = "https://api.intercom.io";
|
|
31628
31664
|
var INTERCOM_VERSION = "2.11";
|
|
31629
|
-
async function apiFetch22(params,
|
|
31665
|
+
async function apiFetch22(params, path5, init) {
|
|
31630
31666
|
const accessToken = params[parameters59.accessToken.slug];
|
|
31631
31667
|
if (!accessToken) {
|
|
31632
31668
|
throw new Error("intercom: missing required parameter: access-token");
|
|
31633
31669
|
}
|
|
31634
|
-
const url = `${BASE_URL47}${
|
|
31670
|
+
const url = `${BASE_URL47}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
31635
31671
|
const headers = new Headers(init?.headers);
|
|
31636
31672
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
31637
31673
|
headers.set("Accept", "application/json");
|
|
@@ -31652,8 +31688,8 @@ var INTERCOM_SCOPES = [
|
|
|
31652
31688
|
{ value: "articles", label: "Articles", countPath: "/articles?per_page=1" },
|
|
31653
31689
|
{ value: "teams", label: "Teams", countPath: "/teams" }
|
|
31654
31690
|
];
|
|
31655
|
-
async function fetchCount3(params,
|
|
31656
|
-
const res = await apiFetch22(params,
|
|
31691
|
+
async function fetchCount3(params, path5) {
|
|
31692
|
+
const res = await apiFetch22(params, path5);
|
|
31657
31693
|
if (!res.ok) {
|
|
31658
31694
|
return null;
|
|
31659
31695
|
}
|
|
@@ -31756,7 +31792,7 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
31756
31792
|
The Intercom-Version header is set to 2.11 automatically.`,
|
|
31757
31793
|
inputSchema: inputSchema73,
|
|
31758
31794
|
outputSchema: outputSchema73,
|
|
31759
|
-
async execute({ connectionId, method, path:
|
|
31795
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
31760
31796
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
31761
31797
|
if (!connection2) {
|
|
31762
31798
|
return {
|
|
@@ -31765,11 +31801,11 @@ The Intercom-Version header is set to 2.11 automatically.`,
|
|
|
31765
31801
|
};
|
|
31766
31802
|
}
|
|
31767
31803
|
console.log(
|
|
31768
|
-
`[connector-request] intercom/${connection2.name}: ${method} ${
|
|
31804
|
+
`[connector-request] intercom/${connection2.name}: ${method} ${path5}`
|
|
31769
31805
|
);
|
|
31770
31806
|
try {
|
|
31771
31807
|
const accessToken = parameters59.accessToken.getValue(connection2);
|
|
31772
|
-
const url = `${BASE_URL48}${
|
|
31808
|
+
const url = `${BASE_URL48}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
31773
31809
|
const controller = new AbortController();
|
|
31774
31810
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS56);
|
|
31775
31811
|
try {
|
|
@@ -32110,7 +32146,7 @@ Use this tool for all Intercom API interactions: querying contacts, conversation
|
|
|
32110
32146
|
Search endpoints (contacts/search, conversations/search) use POST with a query object in the body.`,
|
|
32111
32147
|
inputSchema: inputSchema74,
|
|
32112
32148
|
outputSchema: outputSchema74,
|
|
32113
|
-
async execute({ connectionId, method, path:
|
|
32149
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
32114
32150
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
32115
32151
|
if (!connection2) {
|
|
32116
32152
|
return {
|
|
@@ -32119,10 +32155,10 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
32119
32155
|
};
|
|
32120
32156
|
}
|
|
32121
32157
|
console.log(
|
|
32122
|
-
`[connector-request] intercom-oauth/${connection2.name}: ${method} ${
|
|
32158
|
+
`[connector-request] intercom-oauth/${connection2.name}: ${method} ${path5}`
|
|
32123
32159
|
);
|
|
32124
32160
|
try {
|
|
32125
|
-
let url = `${BASE_URL49}${
|
|
32161
|
+
let url = `${BASE_URL49}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
32126
32162
|
if (queryParams) {
|
|
32127
32163
|
const searchParams = new URLSearchParams(queryParams);
|
|
32128
32164
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -32203,8 +32239,8 @@ var intercomOauthOnboarding = new ConnectorOnboarding({
|
|
|
32203
32239
|
// ../connectors/src/connectors/intercom-oauth/utils.ts
|
|
32204
32240
|
var BASE_URL50 = "https://api.intercom.io";
|
|
32205
32241
|
var INTERCOM_VERSION2 = "2.11";
|
|
32206
|
-
function apiFetch23(proxyFetch,
|
|
32207
|
-
const url = `${BASE_URL50}${
|
|
32242
|
+
function apiFetch23(proxyFetch, path5, init) {
|
|
32243
|
+
const url = `${BASE_URL50}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
32208
32244
|
const headers = new Headers(init?.headers);
|
|
32209
32245
|
headers.set("Accept", "application/json");
|
|
32210
32246
|
headers.set("Intercom-Version", INTERCOM_VERSION2);
|
|
@@ -32224,8 +32260,8 @@ var INTERCOM_SCOPES2 = [
|
|
|
32224
32260
|
{ value: "articles", label: "Articles", countPath: "/articles?per_page=1" },
|
|
32225
32261
|
{ value: "teams", label: "Teams", countPath: "/teams" }
|
|
32226
32262
|
];
|
|
32227
|
-
async function fetchCount4(proxyFetch,
|
|
32228
|
-
const res = await apiFetch23(proxyFetch,
|
|
32263
|
+
async function fetchCount4(proxyFetch, path5) {
|
|
32264
|
+
const res = await apiFetch23(proxyFetch, path5);
|
|
32229
32265
|
if (!res.ok) {
|
|
32230
32266
|
return null;
|
|
32231
32267
|
}
|
|
@@ -32584,7 +32620,7 @@ function getQueryBaseUrl(params) {
|
|
|
32584
32620
|
if (region === "in") return "https://in.mixpanel.com/api";
|
|
32585
32621
|
return "https://mixpanel.com/api";
|
|
32586
32622
|
}
|
|
32587
|
-
async function apiFetch24(params,
|
|
32623
|
+
async function apiFetch24(params, path5, init) {
|
|
32588
32624
|
const username = params[parameters61.serviceAccountUsername.slug];
|
|
32589
32625
|
const secret = params[parameters61.serviceAccountSecret.slug];
|
|
32590
32626
|
const projectId2 = params[parameters61.projectId.slug];
|
|
@@ -32594,7 +32630,7 @@ async function apiFetch24(params, path4, init) {
|
|
|
32594
32630
|
);
|
|
32595
32631
|
}
|
|
32596
32632
|
const base = getQueryBaseUrl(params);
|
|
32597
|
-
const url = new URL(`${base}${
|
|
32633
|
+
const url = new URL(`${base}${path5.startsWith("/") ? "" : "/"}${path5}`);
|
|
32598
32634
|
if (!url.searchParams.has("project_id")) {
|
|
32599
32635
|
url.searchParams.set("project_id", projectId2);
|
|
32600
32636
|
}
|
|
@@ -33043,14 +33079,14 @@ var parameters62 = {
|
|
|
33043
33079
|
};
|
|
33044
33080
|
|
|
33045
33081
|
// ../connectors/src/connectors/grafana/utils.ts
|
|
33046
|
-
async function apiFetch25(params,
|
|
33082
|
+
async function apiFetch25(params, path5, init) {
|
|
33047
33083
|
const apiKey = params[parameters62.apiKey.slug];
|
|
33048
33084
|
const rawUrl = params[parameters62.url.slug];
|
|
33049
33085
|
if (!apiKey || !rawUrl) {
|
|
33050
33086
|
throw new Error("grafana: missing required parameters: url and api-key");
|
|
33051
33087
|
}
|
|
33052
33088
|
const baseUrl = rawUrl.replace(/\/+$/, "");
|
|
33053
|
-
const url = `${baseUrl}${
|
|
33089
|
+
const url = `${baseUrl}${path5.startsWith("/") ? path5 : `/${path5}`}`;
|
|
33054
33090
|
const headers = new Headers(init?.headers);
|
|
33055
33091
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
33056
33092
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -33235,7 +33271,7 @@ Use this tool to interact with Grafana resources: datasources, dashboards, alert
|
|
|
33235
33271
|
The path must start with '/' and is appended to the configured Grafana instance URL.`,
|
|
33236
33272
|
inputSchema: inputSchema76,
|
|
33237
33273
|
outputSchema: outputSchema76,
|
|
33238
|
-
async execute({ connectionId, method, path:
|
|
33274
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
33239
33275
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
33240
33276
|
if (!connection2) {
|
|
33241
33277
|
return {
|
|
@@ -33244,12 +33280,12 @@ The path must start with '/' and is appended to the configured Grafana instance
|
|
|
33244
33280
|
};
|
|
33245
33281
|
}
|
|
33246
33282
|
console.log(
|
|
33247
|
-
`[connector-request] grafana/${connection2.name}: ${method} ${
|
|
33283
|
+
`[connector-request] grafana/${connection2.name}: ${method} ${path5}`
|
|
33248
33284
|
);
|
|
33249
33285
|
try {
|
|
33250
33286
|
const baseUrl = parameters62.url.getValue(connection2).replace(/\/+$/, "");
|
|
33251
33287
|
const apiKey = parameters62.apiKey.getValue(connection2);
|
|
33252
|
-
const url = `${baseUrl}${
|
|
33288
|
+
const url = `${baseUrl}${path5}`;
|
|
33253
33289
|
const controller = new AbortController();
|
|
33254
33290
|
const timeout = setTimeout(
|
|
33255
33291
|
() => controller.abort(),
|
|
@@ -33487,7 +33523,7 @@ var parameters63 = {
|
|
|
33487
33523
|
};
|
|
33488
33524
|
|
|
33489
33525
|
// ../connectors/src/connectors/backlog/utils.ts
|
|
33490
|
-
async function apiFetch26(params,
|
|
33526
|
+
async function apiFetch26(params, path5, init) {
|
|
33491
33527
|
const spaceUrl = params[parameters63.spaceUrl.slug];
|
|
33492
33528
|
const apiKey = params[parameters63.apiKey.slug];
|
|
33493
33529
|
if (!spaceUrl) {
|
|
@@ -33496,7 +33532,7 @@ async function apiFetch26(params, path4, init) {
|
|
|
33496
33532
|
if (!apiKey) {
|
|
33497
33533
|
throw new Error("backlog: missing required parameter: api-key");
|
|
33498
33534
|
}
|
|
33499
|
-
const trimmedPath =
|
|
33535
|
+
const trimmedPath = path5.replace(/^\/+/, "");
|
|
33500
33536
|
const separator = trimmedPath.includes("?") ? "&" : "?";
|
|
33501
33537
|
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${trimmedPath}${separator}apiKey=${encodeURIComponent(apiKey)}`;
|
|
33502
33538
|
const headers = new Headers(init?.headers);
|
|
@@ -33649,17 +33685,17 @@ The base URL and API key are configured per connection \u2014 only specify the A
|
|
|
33649
33685
|
Do NOT include the apiKey parameter yourself; it is injected automatically.`,
|
|
33650
33686
|
inputSchema: inputSchema77,
|
|
33651
33687
|
outputSchema: outputSchema77,
|
|
33652
|
-
async execute({ connectionId, method, path:
|
|
33688
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
33653
33689
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
33654
33690
|
if (!connection2) {
|
|
33655
33691
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
33656
33692
|
}
|
|
33657
|
-
console.log(`[connector-request] backlog-api-key/${connection2.name}: ${method} ${
|
|
33693
|
+
console.log(`[connector-request] backlog-api-key/${connection2.name}: ${method} ${path5}`);
|
|
33658
33694
|
try {
|
|
33659
33695
|
const spaceUrl = parameters63.spaceUrl.getValue(connection2);
|
|
33660
33696
|
const apiKey = parameters63.apiKey.getValue(connection2);
|
|
33661
|
-
const separator =
|
|
33662
|
-
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${
|
|
33697
|
+
const separator = path5.includes("?") ? "&" : "?";
|
|
33698
|
+
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${path5}${separator}apiKey=${apiKey}`;
|
|
33663
33699
|
const controller = new AbortController();
|
|
33664
33700
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS60);
|
|
33665
33701
|
try {
|
|
@@ -33921,7 +33957,7 @@ var parameters64 = {
|
|
|
33921
33957
|
|
|
33922
33958
|
// ../connectors/src/connectors/gamma/utils.ts
|
|
33923
33959
|
var BASE_URL51 = "https://public-api.gamma.app/v1.0";
|
|
33924
|
-
function apiFetch27(params,
|
|
33960
|
+
function apiFetch27(params, path5, init) {
|
|
33925
33961
|
const apiKey = params[parameters64.apiKey.slug];
|
|
33926
33962
|
if (!apiKey) {
|
|
33927
33963
|
throw new Error(`gamma: missing required parameter: ${parameters64.apiKey.slug}`);
|
|
@@ -33929,7 +33965,7 @@ function apiFetch27(params, path4, init) {
|
|
|
33929
33965
|
const headers = new Headers(init?.headers);
|
|
33930
33966
|
headers.set("X-API-KEY", apiKey);
|
|
33931
33967
|
if (!headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
33932
|
-
const trimmedPath =
|
|
33968
|
+
const trimmedPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
33933
33969
|
return fetch(`${BASE_URL51}${trimmedPath}`, { ...init, headers });
|
|
33934
33970
|
}
|
|
33935
33971
|
|
|
@@ -34066,7 +34102,7 @@ Use this tool for listing themes, listing folders, checking generation status, a
|
|
|
34066
34102
|
For creating presentations/documents, prefer the connector_gamma_generate tool instead.`,
|
|
34067
34103
|
inputSchema: inputSchema78,
|
|
34068
34104
|
outputSchema: outputSchema78,
|
|
34069
|
-
async execute({ connectionId, method, path:
|
|
34105
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
34070
34106
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
34071
34107
|
if (!connection2) {
|
|
34072
34108
|
return {
|
|
@@ -34075,11 +34111,11 @@ For creating presentations/documents, prefer the connector_gamma_generate tool i
|
|
|
34075
34111
|
};
|
|
34076
34112
|
}
|
|
34077
34113
|
console.log(
|
|
34078
|
-
`[connector-request] gamma/${connection2.name}: ${method} ${
|
|
34114
|
+
`[connector-request] gamma/${connection2.name}: ${method} ${path5}`
|
|
34079
34115
|
);
|
|
34080
34116
|
try {
|
|
34081
34117
|
const apiKey = parameters64.apiKey.getValue(connection2);
|
|
34082
|
-
const url = `${BASE_URL52}${
|
|
34118
|
+
const url = `${BASE_URL52}${path5}`;
|
|
34083
34119
|
const controller = new AbortController();
|
|
34084
34120
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS61);
|
|
34085
34121
|
try {
|
|
@@ -34523,12 +34559,12 @@ var parameters65 = {
|
|
|
34523
34559
|
|
|
34524
34560
|
// ../connectors/src/connectors/sentry/utils.ts
|
|
34525
34561
|
var BASE_URL54 = "https://sentry.io/api/0";
|
|
34526
|
-
async function apiFetch28(params,
|
|
34562
|
+
async function apiFetch28(params, path5, init) {
|
|
34527
34563
|
const authToken = params[parameters65.authToken.slug];
|
|
34528
34564
|
if (!authToken) {
|
|
34529
34565
|
throw new Error("sentry: missing required parameter: auth-token");
|
|
34530
34566
|
}
|
|
34531
|
-
const url = `${BASE_URL54}${
|
|
34567
|
+
const url = `${BASE_URL54}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
34532
34568
|
const headers = new Headers(init?.headers);
|
|
34533
34569
|
headers.set("Authorization", `Bearer ${authToken}`);
|
|
34534
34570
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -34693,7 +34729,7 @@ Authentication is handled automatically via Bearer token.
|
|
|
34693
34729
|
{organizationSlug} in the path is automatically replaced with the configured organization slug.`,
|
|
34694
34730
|
inputSchema: inputSchema80,
|
|
34695
34731
|
outputSchema: outputSchema80,
|
|
34696
|
-
async execute({ connectionId, method, path:
|
|
34732
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
34697
34733
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
34698
34734
|
if (!connection2) {
|
|
34699
34735
|
return {
|
|
@@ -34702,12 +34738,12 @@ Authentication is handled automatically via Bearer token.
|
|
|
34702
34738
|
};
|
|
34703
34739
|
}
|
|
34704
34740
|
console.log(
|
|
34705
|
-
`[connector-request] sentry/${connection2.name}: ${method} ${
|
|
34741
|
+
`[connector-request] sentry/${connection2.name}: ${method} ${path5}`
|
|
34706
34742
|
);
|
|
34707
34743
|
try {
|
|
34708
34744
|
const authToken = parameters65.authToken.getValue(connection2);
|
|
34709
34745
|
const organizationSlug = parameters65.organizationSlug.getValue(connection2);
|
|
34710
|
-
const resolvedPath =
|
|
34746
|
+
const resolvedPath = path5.replace(
|
|
34711
34747
|
/\{organizationSlug\}/g,
|
|
34712
34748
|
organizationSlug
|
|
34713
34749
|
);
|
|
@@ -35044,9 +35080,9 @@ async function getAccessToken4(params) {
|
|
|
35044
35080
|
instanceUrl: tokenJson.instance_url ?? instanceUrl
|
|
35045
35081
|
};
|
|
35046
35082
|
}
|
|
35047
|
-
async function apiFetch29(params,
|
|
35083
|
+
async function apiFetch29(params, path5, init) {
|
|
35048
35084
|
const token = await getAccessToken4(params);
|
|
35049
|
-
const url = `${token.instanceUrl}${
|
|
35085
|
+
const url = `${token.instanceUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
35050
35086
|
const headers = new Headers(init?.headers);
|
|
35051
35087
|
headers.set("Authorization", `Bearer ${token.accessToken}`);
|
|
35052
35088
|
headers.set("Accept", "application/json");
|
|
@@ -35270,7 +35306,7 @@ Use this tool for all Salesforce interactions: describing sObjects, running SOQL
|
|
|
35270
35306
|
Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads rather than paginating /sobjects/{Type} endpoints.`,
|
|
35271
35307
|
inputSchema: inputSchema81,
|
|
35272
35308
|
outputSchema: outputSchema81,
|
|
35273
|
-
async execute({ connectionId, method, path:
|
|
35309
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
35274
35310
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
35275
35311
|
if (!connection2) {
|
|
35276
35312
|
return {
|
|
@@ -35279,7 +35315,7 @@ Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads ra
|
|
|
35279
35315
|
};
|
|
35280
35316
|
}
|
|
35281
35317
|
console.log(
|
|
35282
|
-
`[connector-request] salesforce/${connection2.name}: ${method} ${
|
|
35318
|
+
`[connector-request] salesforce/${connection2.name}: ${method} ${path5}`
|
|
35283
35319
|
);
|
|
35284
35320
|
try {
|
|
35285
35321
|
const instanceUrlParam = parameters66.instanceUrl.getValue(connection2);
|
|
@@ -35313,7 +35349,7 @@ Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads ra
|
|
|
35313
35349
|
};
|
|
35314
35350
|
}
|
|
35315
35351
|
const resolvedInstanceUrl = tokenJson.instance_url ?? instanceUrl;
|
|
35316
|
-
const url = `${resolvedInstanceUrl}${
|
|
35352
|
+
const url = `${resolvedInstanceUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
35317
35353
|
const controller = new AbortController();
|
|
35318
35354
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS63);
|
|
35319
35355
|
try {
|
|
@@ -35959,7 +35995,7 @@ Use this tool for all InfluxDB interactions: running SQL / InfluxQL / Flux queri
|
|
|
35959
35995
|
For read-only data exploration prefer SQL (InfluxDB 3) or InfluxQL queries \u2014 they return JSON that is straightforward to parse. Flux queries return annotated CSV.`,
|
|
35960
35996
|
inputSchema: inputSchema82,
|
|
35961
35997
|
outputSchema: outputSchema82,
|
|
35962
|
-
async execute({ connectionId, method, path:
|
|
35998
|
+
async execute({ connectionId, method, path: path5, body, contentType }, connections) {
|
|
35963
35999
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
35964
36000
|
if (!connection2) {
|
|
35965
36001
|
return {
|
|
@@ -35968,12 +36004,12 @@ For read-only data exploration prefer SQL (InfluxDB 3) or InfluxQL queries \u201
|
|
|
35968
36004
|
};
|
|
35969
36005
|
}
|
|
35970
36006
|
console.log(
|
|
35971
|
-
`[connector-request] influxdb/${connection2.name}: ${method} ${
|
|
36007
|
+
`[connector-request] influxdb/${connection2.name}: ${method} ${path5}`
|
|
35972
36008
|
);
|
|
35973
36009
|
try {
|
|
35974
36010
|
const url = parameters67.url.getValue(connection2).replace(/\/$/, "");
|
|
35975
36011
|
const token = parameters67.token.getValue(connection2);
|
|
35976
|
-
const fullUrl = `${url}${
|
|
36012
|
+
const fullUrl = `${url}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
35977
36013
|
const controller = new AbortController();
|
|
35978
36014
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS64);
|
|
35979
36015
|
const resolvedContentType = contentType ?? (typeof body === "string" ? "text/plain; charset=utf-8" : "application/json");
|
|
@@ -36010,7 +36046,7 @@ For read-only data exploration prefer SQL (InfluxDB 3) or InfluxQL queries \u201
|
|
|
36010
36046
|
} else if (bodyText) {
|
|
36011
36047
|
errorMessage = isHtml ? bodyText.replace(/\s+/g, " ").slice(0, 200) : bodyText;
|
|
36012
36048
|
}
|
|
36013
|
-
const hitsV3Path =
|
|
36049
|
+
const hitsV3Path = path5.includes("/api/v3/");
|
|
36014
36050
|
const looksLikeMissingV3 = hitsV3Path && (response.status === 405 || response.status === 404 || isHtml);
|
|
36015
36051
|
if (looksLikeMissingV3) {
|
|
36016
36052
|
errorMessage += " \u2014 This InfluxDB instance does not support the v3 API at this path. It is likely InfluxDB 2 (e.g. InfluxDB Cloud on '*.cloud2.influxdata.com'). Retry via Flux on '/api/v2/query?org={org}' with contentType 'application/vnd.flux'.";
|
|
@@ -37786,7 +37822,7 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
37786
37822
|
async execute({
|
|
37787
37823
|
connectionId,
|
|
37788
37824
|
method,
|
|
37789
|
-
path:
|
|
37825
|
+
path: path5,
|
|
37790
37826
|
queryParams,
|
|
37791
37827
|
body,
|
|
37792
37828
|
contentType,
|
|
@@ -37800,13 +37836,13 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
37800
37836
|
};
|
|
37801
37837
|
}
|
|
37802
37838
|
console.log(
|
|
37803
|
-
`[connector-request] semrush/${connection2.name}: ${method} ${
|
|
37839
|
+
`[connector-request] semrush/${connection2.name}: ${method} ${path5}`
|
|
37804
37840
|
);
|
|
37805
37841
|
try {
|
|
37806
37842
|
const apiKey = parameters70.apiKey.getValue(connection2);
|
|
37807
|
-
const isAbsolute = /^https?:\/\//i.test(
|
|
37843
|
+
const isAbsolute = /^https?:\/\//i.test(path5);
|
|
37808
37844
|
if (isAbsolute) {
|
|
37809
|
-
const host = new URL(
|
|
37845
|
+
const host = new URL(path5).hostname.toLowerCase();
|
|
37810
37846
|
if (host !== "api.semrush.com" && host !== "www.semrush.com") {
|
|
37811
37847
|
return {
|
|
37812
37848
|
success: false,
|
|
@@ -37815,7 +37851,7 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
37815
37851
|
}
|
|
37816
37852
|
}
|
|
37817
37853
|
const url = new URL(
|
|
37818
|
-
isAbsolute ?
|
|
37854
|
+
isAbsolute ? path5 : `${BASE_URL58}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
37819
37855
|
);
|
|
37820
37856
|
if (queryParams) {
|
|
37821
37857
|
for (const [k, v] of Object.entries(queryParams)) {
|
|
@@ -37921,14 +37957,14 @@ var semrushOnboarding = new ConnectorOnboarding({
|
|
|
37921
37957
|
// ../connectors/src/connectors/semrush/utils.ts
|
|
37922
37958
|
var BASE_URL59 = "https://api.semrush.com";
|
|
37923
37959
|
var PROJECTS_BASE_URL = `${BASE_URL59}/management/v1`;
|
|
37924
|
-
function projectsApiFetch(params,
|
|
37960
|
+
function projectsApiFetch(params, path5, init) {
|
|
37925
37961
|
const apiKey = params[parameters70.apiKey.slug];
|
|
37926
37962
|
if (!apiKey) {
|
|
37927
37963
|
throw new Error(
|
|
37928
37964
|
`semrush: missing required parameter: ${parameters70.apiKey.slug}`
|
|
37929
37965
|
);
|
|
37930
37966
|
}
|
|
37931
|
-
const trimmedPath =
|
|
37967
|
+
const trimmedPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
37932
37968
|
const url = new URL(`${PROJECTS_BASE_URL}${trimmedPath}`);
|
|
37933
37969
|
if (!url.searchParams.has("key")) {
|
|
37934
37970
|
url.searchParams.set("key", apiKey);
|
|
@@ -39036,7 +39072,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
39036
39072
|
For URL Inspection API requests, use the absolute path '/v1/urlInspection/index:inspect' \u2014 the leading /webmasters/v3 prefix will be stripped if you accidentally include it.`,
|
|
39037
39073
|
inputSchema: inputSchema87,
|
|
39038
39074
|
outputSchema: outputSchema87,
|
|
39039
|
-
async execute({ connectionId, method, path:
|
|
39075
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
39040
39076
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
39041
39077
|
if (!connection2) {
|
|
39042
39078
|
return {
|
|
@@ -39045,11 +39081,11 @@ For URL Inspection API requests, use the absolute path '/v1/urlInspection/index:
|
|
|
39045
39081
|
};
|
|
39046
39082
|
}
|
|
39047
39083
|
console.log(
|
|
39048
|
-
`[connector-request] google-search-console-oauth/${connection2.name}: ${method} ${
|
|
39084
|
+
`[connector-request] google-search-console-oauth/${connection2.name}: ${method} ${path5}`
|
|
39049
39085
|
);
|
|
39050
39086
|
try {
|
|
39051
39087
|
const siteUrl = parameters71.siteUrl.tryGetValue(connection2);
|
|
39052
|
-
const resolvedPath = siteUrl ?
|
|
39088
|
+
const resolvedPath = siteUrl ? path5.replace(/\{siteUrl\}/g, encodeURIComponent(siteUrl)) : path5;
|
|
39053
39089
|
const normalizedPath = normalizeRequestPath(
|
|
39054
39090
|
resolvedPath,
|
|
39055
39091
|
BASE_PATH_SEGMENT10
|
|
@@ -39705,12 +39741,12 @@ var parameters73 = {
|
|
|
39705
39741
|
|
|
39706
39742
|
// ../connectors/src/connectors/clickup/utils.ts
|
|
39707
39743
|
var BASE_URL62 = "https://api.clickup.com/api/v2";
|
|
39708
|
-
async function apiFetch30(params,
|
|
39744
|
+
async function apiFetch30(params, path5, init) {
|
|
39709
39745
|
const token = params[parameters73.apiToken.slug];
|
|
39710
39746
|
if (!token) {
|
|
39711
39747
|
throw new Error("clickup: missing required parameter: api-token");
|
|
39712
39748
|
}
|
|
39713
|
-
const url = `${BASE_URL62}${
|
|
39749
|
+
const url = `${BASE_URL62}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
39714
39750
|
const headers = new Headers(init?.headers);
|
|
39715
39751
|
headers.set("Authorization", token);
|
|
39716
39752
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -39937,7 +39973,7 @@ Common endpoints:
|
|
|
39937
39973
|
Pagination: ClickUp uses zero-indexed \`page\` query parameter on list endpoints (page=0, page=1, ...). Each page returns up to 100 tasks; you must increment \`page\` until the response array is empty.`,
|
|
39938
39974
|
inputSchema: inputSchema89,
|
|
39939
39975
|
outputSchema: outputSchema89,
|
|
39940
|
-
async execute({ connectionId, method, path:
|
|
39976
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
39941
39977
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
39942
39978
|
if (!connection2) {
|
|
39943
39979
|
return {
|
|
@@ -39946,11 +39982,11 @@ Pagination: ClickUp uses zero-indexed \`page\` query parameter on list endpoints
|
|
|
39946
39982
|
};
|
|
39947
39983
|
}
|
|
39948
39984
|
console.log(
|
|
39949
|
-
`[connector-request] clickup/${connection2.name}: ${method} ${
|
|
39985
|
+
`[connector-request] clickup/${connection2.name}: ${method} ${path5}`
|
|
39950
39986
|
);
|
|
39951
39987
|
try {
|
|
39952
39988
|
const token = parameters73.apiToken.getValue(connection2);
|
|
39953
|
-
const normalizedPath = normalizeRequestPath(
|
|
39989
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT11);
|
|
39954
39990
|
const url = `${BASE_URL63}${normalizedPath}`;
|
|
39955
39991
|
const controller = new AbortController();
|
|
39956
39992
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS69);
|
|
@@ -41831,7 +41867,7 @@ function buildBaseUrl(domain) {
|
|
|
41831
41867
|
function basicAuthHeader2(apiKey) {
|
|
41832
41868
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
41833
41869
|
}
|
|
41834
|
-
async function apiFetch31(params,
|
|
41870
|
+
async function apiFetch31(params, path5, init) {
|
|
41835
41871
|
const apiKey = params[parameters78.apiKey.slug];
|
|
41836
41872
|
const domain = params[parameters78.domain.slug];
|
|
41837
41873
|
if (!apiKey || !domain) {
|
|
@@ -41840,7 +41876,7 @@ async function apiFetch31(params, path4, init) {
|
|
|
41840
41876
|
);
|
|
41841
41877
|
}
|
|
41842
41878
|
const baseUrl = buildBaseUrl(domain);
|
|
41843
|
-
const url = `${baseUrl}${
|
|
41879
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
41844
41880
|
const headers = new Headers(init?.headers);
|
|
41845
41881
|
headers.set("Authorization", basicAuthHeader2(apiKey));
|
|
41846
41882
|
headers.set("Accept", "application/json");
|
|
@@ -41901,8 +41937,8 @@ var FRESHSERVICE_ENTITIES = [
|
|
|
41901
41937
|
countPath: "/service_catalog/items?per_page=1"
|
|
41902
41938
|
}
|
|
41903
41939
|
];
|
|
41904
|
-
async function fetchEntityCount2(params,
|
|
41905
|
-
const res = await apiFetch31(params,
|
|
41940
|
+
async function fetchEntityCount2(params, path5) {
|
|
41941
|
+
const res = await apiFetch31(params, path5);
|
|
41906
41942
|
if (!res.ok) return null;
|
|
41907
41943
|
const data = await res.json();
|
|
41908
41944
|
if (typeof data["total"] === "number") return data["total"];
|
|
@@ -42035,7 +42071,7 @@ Field codes:
|
|
|
42035
42071
|
- ticket source: 1 Email, 2 Portal, 3 Phone, 4 Chat, 5 Feedback widget, 7 Yammer, 8 AwsCloudwatch, 9 Pagerduty, 10 Walkup, 11 Slack`,
|
|
42036
42072
|
inputSchema: inputSchema95,
|
|
42037
42073
|
outputSchema: outputSchema95,
|
|
42038
|
-
async execute({ connectionId, method, path:
|
|
42074
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
42039
42075
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
42040
42076
|
if (!connection2) {
|
|
42041
42077
|
return {
|
|
@@ -42044,13 +42080,13 @@ Field codes:
|
|
|
42044
42080
|
};
|
|
42045
42081
|
}
|
|
42046
42082
|
console.log(
|
|
42047
|
-
`[connector-request] freshservice/${connection2.name}: ${method} ${
|
|
42083
|
+
`[connector-request] freshservice/${connection2.name}: ${method} ${path5}`
|
|
42048
42084
|
);
|
|
42049
42085
|
try {
|
|
42050
42086
|
const apiKey = parameters78.apiKey.getValue(connection2);
|
|
42051
42087
|
const domain = parameters78.domain.getValue(connection2);
|
|
42052
42088
|
const baseUrl = buildBaseUrl2(domain);
|
|
42053
|
-
const normalizedPath = normalizeRequestPath(
|
|
42089
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT13);
|
|
42054
42090
|
const url = `${baseUrl}${normalizedPath}`;
|
|
42055
42091
|
const controller = new AbortController();
|
|
42056
42092
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS70);
|
|
@@ -42343,7 +42379,7 @@ function buildBaseUrl3(domain) {
|
|
|
42343
42379
|
function basicAuthHeader4(apiKey) {
|
|
42344
42380
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
42345
42381
|
}
|
|
42346
|
-
async function apiFetch32(params,
|
|
42382
|
+
async function apiFetch32(params, path5, init) {
|
|
42347
42383
|
const apiKey = params[parameters79.apiKey.slug];
|
|
42348
42384
|
const domain = params[parameters79.domain.slug];
|
|
42349
42385
|
if (!apiKey || !domain) {
|
|
@@ -42352,7 +42388,7 @@ async function apiFetch32(params, path4, init) {
|
|
|
42352
42388
|
);
|
|
42353
42389
|
}
|
|
42354
42390
|
const baseUrl = buildBaseUrl3(domain);
|
|
42355
|
-
const url = `${baseUrl}${
|
|
42391
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
42356
42392
|
const headers = new Headers(init?.headers);
|
|
42357
42393
|
headers.set("Authorization", basicAuthHeader4(apiKey));
|
|
42358
42394
|
headers.set("Accept", "application/json");
|
|
@@ -42389,8 +42425,8 @@ var FRESHDESK_ENTITIES = [
|
|
|
42389
42425
|
countPath: "/groups?per_page=1"
|
|
42390
42426
|
}
|
|
42391
42427
|
];
|
|
42392
|
-
async function fetchEntityCount3(params,
|
|
42393
|
-
const res = await apiFetch32(params,
|
|
42428
|
+
async function fetchEntityCount3(params, path5, countField) {
|
|
42429
|
+
const res = await apiFetch32(params, path5);
|
|
42394
42430
|
if (!res.ok) return null;
|
|
42395
42431
|
const data = await res.json();
|
|
42396
42432
|
if (Array.isArray(data)) return null;
|
|
@@ -42602,7 +42638,7 @@ Field codes (tickets):
|
|
|
42602
42638
|
- source: 1 Email, 2 Portal, 3 Phone, 7 Chat, 9 Feedback widget, 10 Outbound email`,
|
|
42603
42639
|
inputSchema: inputSchema96,
|
|
42604
42640
|
outputSchema: outputSchema96,
|
|
42605
|
-
async execute({ connectionId, method, path:
|
|
42641
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
42606
42642
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
42607
42643
|
if (!connection2) {
|
|
42608
42644
|
return {
|
|
@@ -42611,13 +42647,13 @@ Field codes (tickets):
|
|
|
42611
42647
|
};
|
|
42612
42648
|
}
|
|
42613
42649
|
console.log(
|
|
42614
|
-
`[connector-request] freshdesk/${connection2.name}: ${method} ${
|
|
42650
|
+
`[connector-request] freshdesk/${connection2.name}: ${method} ${path5}`
|
|
42615
42651
|
);
|
|
42616
42652
|
try {
|
|
42617
42653
|
const apiKey = parameters79.apiKey.getValue(connection2);
|
|
42618
42654
|
const domain = parameters79.domain.getValue(connection2);
|
|
42619
42655
|
const baseUrl = buildBaseUrl4(domain);
|
|
42620
|
-
const normalizedPath = normalizeRequestPath(
|
|
42656
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT15);
|
|
42621
42657
|
const url = `${baseUrl}${normalizedPath}`;
|
|
42622
42658
|
const controller = new AbortController();
|
|
42623
42659
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS71);
|
|
@@ -42909,7 +42945,7 @@ function buildBaseUrl5(bundleAlias) {
|
|
|
42909
42945
|
const subdomain = trimmed.split(".")[0];
|
|
42910
42946
|
return `https://${subdomain}.myfreshworks.com${BASE_PATH_SEGMENT16}`;
|
|
42911
42947
|
}
|
|
42912
|
-
async function apiFetch33(params,
|
|
42948
|
+
async function apiFetch33(params, path5, init) {
|
|
42913
42949
|
const apiKey = params[parameters80.apiKey.slug];
|
|
42914
42950
|
const bundle = params[parameters80.bundleAlias.slug];
|
|
42915
42951
|
if (!apiKey || !bundle) {
|
|
@@ -42918,7 +42954,7 @@ async function apiFetch33(params, path4, init) {
|
|
|
42918
42954
|
);
|
|
42919
42955
|
}
|
|
42920
42956
|
const baseUrl = buildBaseUrl5(bundle);
|
|
42921
|
-
const url = `${baseUrl}${
|
|
42957
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
42922
42958
|
const headers = new Headers(init?.headers);
|
|
42923
42959
|
headers.set("Authorization", `Token token=${apiKey}`);
|
|
42924
42960
|
headers.set("Accept", "application/json");
|
|
@@ -43091,7 +43127,7 @@ Pagination: 1-indexed \`page\` + \`per_page\` (default 25, max 100). View endpoi
|
|
|
43091
43127
|
Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\`owner\`, \`creator\`, \`deals\`, \`contacts\`, etc.) to inline related records.`,
|
|
43092
43128
|
inputSchema: inputSchema97,
|
|
43093
43129
|
outputSchema: outputSchema97,
|
|
43094
|
-
async execute({ connectionId, method, path:
|
|
43130
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
43095
43131
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
43096
43132
|
if (!connection2) {
|
|
43097
43133
|
return {
|
|
@@ -43100,13 +43136,13 @@ Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\
|
|
|
43100
43136
|
};
|
|
43101
43137
|
}
|
|
43102
43138
|
console.log(
|
|
43103
|
-
`[connector-request] freshsales/${connection2.name}: ${method} ${
|
|
43139
|
+
`[connector-request] freshsales/${connection2.name}: ${method} ${path5}`
|
|
43104
43140
|
);
|
|
43105
43141
|
try {
|
|
43106
43142
|
const apiKey = parameters80.apiKey.getValue(connection2);
|
|
43107
43143
|
const bundle = parameters80.bundleAlias.getValue(connection2);
|
|
43108
43144
|
const baseUrl = buildBaseUrl6(bundle);
|
|
43109
|
-
const normalizedPath = normalizeRequestPath(
|
|
43145
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT17);
|
|
43110
43146
|
const url = `${baseUrl}${normalizedPath}`;
|
|
43111
43147
|
const controller = new AbortController();
|
|
43112
43148
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS72);
|
|
@@ -43411,7 +43447,7 @@ function resolveBaseUrl(connectionBaseUrl) {
|
|
|
43411
43447
|
const trimmed = connectionBaseUrl?.trim();
|
|
43412
43448
|
return trimmed && trimmed.replace(/\/+$/, "") || DEFAULT_BASE_URL;
|
|
43413
43449
|
}
|
|
43414
|
-
async function apiFetch34(params,
|
|
43450
|
+
async function apiFetch34(params, path5, init) {
|
|
43415
43451
|
const token = params[parameters81.personalAccessToken.slug];
|
|
43416
43452
|
if (!token) {
|
|
43417
43453
|
throw new Error(
|
|
@@ -43419,7 +43455,7 @@ async function apiFetch34(params, path4, init) {
|
|
|
43419
43455
|
);
|
|
43420
43456
|
}
|
|
43421
43457
|
const baseUrl = resolveBaseUrl(params[parameters81.baseUrl.slug]);
|
|
43422
|
-
const trimmedPath =
|
|
43458
|
+
const trimmedPath = path5.replace(/^\/+/, "/");
|
|
43423
43459
|
const url = `${baseUrl}${trimmedPath.startsWith("/") ? "" : "/"}${trimmedPath}`;
|
|
43424
43460
|
const headers = new Headers(init?.headers);
|
|
43425
43461
|
headers.set("Authorization", `Bearer ${token}`);
|
|
@@ -43657,7 +43693,7 @@ Pagination: 1-indexed \`page\` + \`per_page\` (max 100). The \`Link\` response h
|
|
|
43657
43693
|
Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`X-RateLimit-Remaining\` to throttle.`,
|
|
43658
43694
|
inputSchema: inputSchema98,
|
|
43659
43695
|
outputSchema: outputSchema98,
|
|
43660
|
-
async execute({ connectionId, method, path:
|
|
43696
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
43661
43697
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
43662
43698
|
if (!connection2) {
|
|
43663
43699
|
return {
|
|
@@ -43666,12 +43702,12 @@ Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`
|
|
|
43666
43702
|
};
|
|
43667
43703
|
}
|
|
43668
43704
|
console.log(
|
|
43669
|
-
`[connector-request] github/${connection2.name}: ${method} ${
|
|
43705
|
+
`[connector-request] github/${connection2.name}: ${method} ${path5}`
|
|
43670
43706
|
);
|
|
43671
43707
|
try {
|
|
43672
43708
|
const token = parameters81.personalAccessToken.getValue(connection2);
|
|
43673
43709
|
const baseUrl = resolveBaseUrl2(parameters81.baseUrl.tryGetValue(connection2));
|
|
43674
|
-
const trimmedPath =
|
|
43710
|
+
const trimmedPath = path5.trim().replace(/^\/+/, "/");
|
|
43675
43711
|
const url = `${baseUrl}${trimmedPath.startsWith("/") ? "" : "/"}${trimmedPath}`;
|
|
43676
43712
|
const controller = new AbortController();
|
|
43677
43713
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS73);
|
|
@@ -44049,7 +44085,7 @@ All paths are relative to https://api.powerbi.com/v1.0/myorg. Use the executeQue
|
|
|
44049
44085
|
The signed-in user must have access to the workspace; unlike Service Principals, OAuth users can also access "My workspace" via the \`/datasets\` (without \`/groups/\`) endpoints.`,
|
|
44050
44086
|
inputSchema: inputSchema99,
|
|
44051
44087
|
outputSchema: outputSchema99,
|
|
44052
|
-
async execute({ connectionId, method, path:
|
|
44088
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
44053
44089
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
44054
44090
|
if (!connection2) {
|
|
44055
44091
|
return {
|
|
@@ -44058,10 +44094,10 @@ The signed-in user must have access to the workspace; unlike Service Principals,
|
|
|
44058
44094
|
};
|
|
44059
44095
|
}
|
|
44060
44096
|
console.log(
|
|
44061
|
-
`[connector-request] powerbi-oauth/${connection2.name}: ${method} ${
|
|
44097
|
+
`[connector-request] powerbi-oauth/${connection2.name}: ${method} ${path5}`
|
|
44062
44098
|
);
|
|
44063
44099
|
try {
|
|
44064
|
-
const normalizedPath = normalizeRequestPath(
|
|
44100
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT18);
|
|
44065
44101
|
let url = `${BASE_URL64}${normalizedPath}`;
|
|
44066
44102
|
if (queryParams) {
|
|
44067
44103
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -44146,8 +44182,8 @@ var parameters82 = {};
|
|
|
44146
44182
|
|
|
44147
44183
|
// ../connectors/src/connectors/powerbi-oauth/utils.ts
|
|
44148
44184
|
var BASE_URL65 = "https://api.powerbi.com/v1.0/myorg";
|
|
44149
|
-
function apiFetch35(proxyFetch,
|
|
44150
|
-
const url = `${BASE_URL65}${
|
|
44185
|
+
function apiFetch35(proxyFetch, path5, init) {
|
|
44186
|
+
const url = `${BASE_URL65}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
44151
44187
|
return proxyFetch(url, init);
|
|
44152
44188
|
}
|
|
44153
44189
|
|
|
@@ -44172,8 +44208,8 @@ async function listGroups(proxyFetch) {
|
|
|
44172
44208
|
return data.value ?? [];
|
|
44173
44209
|
}
|
|
44174
44210
|
async function listResource(proxyFetch, groupId, resource) {
|
|
44175
|
-
const
|
|
44176
|
-
const res = await apiFetch35(proxyFetch,
|
|
44211
|
+
const path5 = groupId === MY_WORKSPACE ? `/${resource}` : `/groups/${encodeURIComponent(groupId)}/${resource}`;
|
|
44212
|
+
const res = await apiFetch35(proxyFetch, path5);
|
|
44177
44213
|
if (!res.ok) {
|
|
44178
44214
|
const body = await res.text().catch(() => res.statusText);
|
|
44179
44215
|
throw new Error(
|
|
@@ -44774,9 +44810,9 @@ function buildTableauBaseUrl(params) {
|
|
|
44774
44810
|
}
|
|
44775
44811
|
return `${serverUrl.replace(/\/$/, "")}/api/${apiVersion}`;
|
|
44776
44812
|
}
|
|
44777
|
-
async function tableauProxyApiFetch(proxyFetch, params,
|
|
44813
|
+
async function tableauProxyApiFetch(proxyFetch, params, path5, init) {
|
|
44778
44814
|
const baseUrl = buildTableauBaseUrl(params);
|
|
44779
|
-
const trimmedPath =
|
|
44815
|
+
const trimmedPath = path5.replace(/^([^/])/, "/$1");
|
|
44780
44816
|
return proxyFetch(`${baseUrl}${trimmedPath}`, init);
|
|
44781
44817
|
}
|
|
44782
44818
|
|
|
@@ -45135,7 +45171,7 @@ All paths are relative to {serverUrl}/api/{apiVersion}. Use the literal placehol
|
|
|
45135
45171
|
Accept and Content-Type headers default to application/json so list responses come back as JSON instead of Tableau's default XML.`,
|
|
45136
45172
|
inputSchema: inputSchema100,
|
|
45137
45173
|
outputSchema: outputSchema100,
|
|
45138
|
-
async execute({ connectionId, method, path:
|
|
45174
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
45139
45175
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
45140
45176
|
if (!connection2) {
|
|
45141
45177
|
return {
|
|
@@ -45144,12 +45180,12 @@ Accept and Content-Type headers default to application/json so list responses co
|
|
|
45144
45180
|
};
|
|
45145
45181
|
}
|
|
45146
45182
|
console.log(
|
|
45147
|
-
`[connector-request] tableau/${connection2.name}: ${method} ${
|
|
45183
|
+
`[connector-request] tableau/${connection2.name}: ${method} ${path5}`
|
|
45148
45184
|
);
|
|
45149
45185
|
try {
|
|
45150
45186
|
const serverUrl = parameters83.serverUrl.getValue(connection2);
|
|
45151
45187
|
const apiVersion = parameters83.apiVersion.tryGetValue(connection2) || DEFAULT_API_VERSION2;
|
|
45152
|
-
const trimmedPath =
|
|
45188
|
+
const trimmedPath = path5.trim().replace(/^([^/])/, "/$1");
|
|
45153
45189
|
const baseUrl = buildBaseUrl7(serverUrl, apiVersion);
|
|
45154
45190
|
let url = `${baseUrl}${trimmedPath}`;
|
|
45155
45191
|
if (queryParams) {
|
|
@@ -45443,7 +45479,7 @@ Covers mailbox (\`/me/messages\`, \`/me/mailFolders\`), threads (\`/me/messages?
|
|
|
45443
45479
|
For full-text search use the \`$search\` query parameter (must be wrapped in double quotes); for filtering use \`$filter\` with OData syntax (e.g., \`receivedDateTime ge 2025-01-01T00:00:00Z\`).`,
|
|
45444
45480
|
inputSchema: inputSchema101,
|
|
45445
45481
|
outputSchema: outputSchema101,
|
|
45446
|
-
async execute({ connectionId, method, path:
|
|
45482
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
45447
45483
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
45448
45484
|
if (!connection2) {
|
|
45449
45485
|
return {
|
|
@@ -45452,10 +45488,10 @@ For full-text search use the \`$search\` query parameter (must be wrapped in dou
|
|
|
45452
45488
|
};
|
|
45453
45489
|
}
|
|
45454
45490
|
console.log(
|
|
45455
|
-
`[connector-request] outlook-oauth/${connection2.name}: ${method} ${
|
|
45491
|
+
`[connector-request] outlook-oauth/${connection2.name}: ${method} ${path5}`
|
|
45456
45492
|
);
|
|
45457
45493
|
try {
|
|
45458
|
-
const normalizedPath = normalizeRequestPath(
|
|
45494
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT19);
|
|
45459
45495
|
let url = `${BASE_URL66}${normalizedPath}`;
|
|
45460
45496
|
if (queryParams) {
|
|
45461
45497
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -46024,7 +46060,7 @@ Use this tool for X API v2 reads such as looking up users, fetching posts, retri
|
|
|
46024
46060
|
X rate limits are endpoint-specific and commonly reset on fixed windows. This tool returns x-rate-limit-limit, x-rate-limit-remaining, and x-rate-limit-reset when X sends them. Before making repeated calls or adding pagination, inspect these values and keep dashboard requests small. Do not use this tool for frequent polling; if a request returns 429, wait until the reset timestamp instead of retrying immediately.`,
|
|
46025
46061
|
inputSchema: inputSchema102,
|
|
46026
46062
|
outputSchema: outputSchema102,
|
|
46027
|
-
async execute({ connectionId, method, path:
|
|
46063
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
46028
46064
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46029
46065
|
if (!connection2) {
|
|
46030
46066
|
return {
|
|
@@ -46032,9 +46068,9 @@ X rate limits are endpoint-specific and commonly reset on fixed windows. This to
|
|
|
46032
46068
|
error: `Connection ${connectionId} not found`
|
|
46033
46069
|
};
|
|
46034
46070
|
}
|
|
46035
|
-
console.log(`[connector-request] x/${connection2.name}: ${method} ${
|
|
46071
|
+
console.log(`[connector-request] x/${connection2.name}: ${method} ${path5}`);
|
|
46036
46072
|
try {
|
|
46037
|
-
if (/^https?:\/\//i.test(
|
|
46073
|
+
if (/^https?:\/\//i.test(path5)) {
|
|
46038
46074
|
return {
|
|
46039
46075
|
success: false,
|
|
46040
46076
|
error: "Absolute URLs are not allowed. Pass a path such as /2/users/me."
|
|
@@ -46042,7 +46078,7 @@ X rate limits are endpoint-specific and commonly reset on fixed windows. This to
|
|
|
46042
46078
|
}
|
|
46043
46079
|
const bearerToken = parameters85.bearerToken.getValue(connection2);
|
|
46044
46080
|
const url = new URL(
|
|
46045
|
-
`${BASE_URL67}${
|
|
46081
|
+
`${BASE_URL67}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
46046
46082
|
);
|
|
46047
46083
|
if (queryParams) {
|
|
46048
46084
|
for (const [k, v] of Object.entries(queryParams)) {
|
|
@@ -46414,7 +46450,7 @@ Use this tool for normal dashboard data: top/new/best/ask/show/job story IDs, in
|
|
|
46414
46450
|
This connector does not require API credentials, but a connectionId is still required to select the Hacker News data source. Keep dashboard calls bounded: fetch list IDs first, then fetch only the small slice of item details needed for the current view. Use searchAlgolia only when keyword, tag, or historical search is necessary.`,
|
|
46415
46451
|
inputSchema: inputSchema103,
|
|
46416
46452
|
outputSchema: outputSchema103,
|
|
46417
|
-
async execute({ connectionId, path:
|
|
46453
|
+
async execute({ connectionId, path: path5, printPretty }, connections) {
|
|
46418
46454
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46419
46455
|
if (!connection2) {
|
|
46420
46456
|
return {
|
|
@@ -46423,17 +46459,17 @@ This connector does not require API credentials, but a connectionId is still req
|
|
|
46423
46459
|
};
|
|
46424
46460
|
}
|
|
46425
46461
|
console.log(
|
|
46426
|
-
`[connector-request] hackernews/${connection2.name}: GET ${
|
|
46462
|
+
`[connector-request] hackernews/${connection2.name}: GET ${path5}`
|
|
46427
46463
|
);
|
|
46428
46464
|
try {
|
|
46429
|
-
if (/^https?:\/\//i.test(
|
|
46465
|
+
if (/^https?:\/\//i.test(path5)) {
|
|
46430
46466
|
return {
|
|
46431
46467
|
success: false,
|
|
46432
46468
|
error: "Absolute URLs are not allowed. Pass a Firebase path such as /topstories.json."
|
|
46433
46469
|
};
|
|
46434
46470
|
}
|
|
46435
46471
|
const url = new URL(
|
|
46436
|
-
`${BASE_URL68}${
|
|
46472
|
+
`${BASE_URL68}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
46437
46473
|
);
|
|
46438
46474
|
if (printPretty) url.searchParams.set("print", "pretty");
|
|
46439
46475
|
const controller = new AbortController();
|
|
@@ -46520,7 +46556,7 @@ Avoid frequent repeated Algolia searches from dashboards. Keep hitsPerPage small
|
|
|
46520
46556
|
`[connector-request] hackernews/${connection2.name}: Algolia ${endpoint}`
|
|
46521
46557
|
);
|
|
46522
46558
|
try {
|
|
46523
|
-
let
|
|
46559
|
+
let path5 = `/${endpoint}`;
|
|
46524
46560
|
if (endpoint === "items" || endpoint === "users") {
|
|
46525
46561
|
if (!idOrUsername) {
|
|
46526
46562
|
return {
|
|
@@ -46528,9 +46564,9 @@ Avoid frequent repeated Algolia searches from dashboards. Keep hitsPerPage small
|
|
|
46528
46564
|
error: `idOrUsername is required for endpoint ${endpoint}`
|
|
46529
46565
|
};
|
|
46530
46566
|
}
|
|
46531
|
-
|
|
46567
|
+
path5 += `/${encodeURIComponent(idOrUsername)}`;
|
|
46532
46568
|
}
|
|
46533
|
-
const url = new URL(`${BASE_URL69}${
|
|
46569
|
+
const url = new URL(`${BASE_URL69}${path5}`);
|
|
46534
46570
|
if (queryParams) {
|
|
46535
46571
|
for (const [k, v] of Object.entries(queryParams)) {
|
|
46536
46572
|
url.searchParams.set(k, v);
|
|
@@ -46792,7 +46828,7 @@ Use this tool for all Slack API interactions: listing channels, reading channel
|
|
|
46792
46828
|
Pagination is cursor-based: pass 'cursor' from 'response_metadata.next_cursor' of the previous response. Message timestamps ('ts', 'oldest', 'latest') are Unix epoch seconds as strings.`,
|
|
46793
46829
|
inputSchema: inputSchema105,
|
|
46794
46830
|
outputSchema: outputSchema105,
|
|
46795
|
-
async execute({ connectionId, method, path:
|
|
46831
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
46796
46832
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46797
46833
|
if (!connection2) {
|
|
46798
46834
|
return {
|
|
@@ -46801,10 +46837,10 @@ Pagination is cursor-based: pass 'cursor' from 'response_metadata.next_cursor' o
|
|
|
46801
46837
|
};
|
|
46802
46838
|
}
|
|
46803
46839
|
console.log(
|
|
46804
|
-
`[connector-request] slack/${connection2.name}: ${method} ${
|
|
46840
|
+
`[connector-request] slack/${connection2.name}: ${method} ${path5}`
|
|
46805
46841
|
);
|
|
46806
46842
|
try {
|
|
46807
|
-
const url = `${BASE_URL70}${
|
|
46843
|
+
const url = `${BASE_URL70}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
46808
46844
|
const token = await getProxyToken35(config.oauthProxy);
|
|
46809
46845
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
46810
46846
|
const controller = new AbortController();
|
|
@@ -47595,9 +47631,6 @@ function createDbtClient(entry, slug) {
|
|
|
47595
47631
|
// src/connector-client/index.ts
|
|
47596
47632
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
47597
47633
|
|
|
47598
|
-
// src/routes/server-logic.ts
|
|
47599
|
-
import { Hono } from "hono";
|
|
47600
|
-
|
|
47601
47634
|
// src/types/server-logic.ts
|
|
47602
47635
|
import { z as z106 } from "zod";
|
|
47603
47636
|
var parameterMetaSchema = z106.object({
|
|
@@ -47661,102 +47694,171 @@ var anyJsonServerLogicSchema = z106.union([
|
|
|
47661
47694
|
|
|
47662
47695
|
// src/registry.ts
|
|
47663
47696
|
var serverLogics = /* @__PURE__ */ new Map();
|
|
47697
|
+
var currentDirPath = "";
|
|
47664
47698
|
var skippedServerLogics = [];
|
|
47665
47699
|
function getSkippedServerLogics() {
|
|
47666
47700
|
return skippedServerLogics;
|
|
47667
47701
|
}
|
|
47702
|
+
var viteServer = null;
|
|
47703
|
+
function validateHandlerPath(dirPath, handlerPath) {
|
|
47704
|
+
const normalizedDir = path2.resolve(dirPath);
|
|
47705
|
+
const dirBase = path2.basename(normalizedDir);
|
|
47706
|
+
let normalized = handlerPath.replace(/^\.?[/\\]/, "");
|
|
47707
|
+
const prefix = dirBase + "/";
|
|
47708
|
+
if (normalized.startsWith(prefix)) {
|
|
47709
|
+
normalized = normalized.slice(prefix.length);
|
|
47710
|
+
}
|
|
47711
|
+
const absolute = path2.resolve(dirPath, normalized);
|
|
47712
|
+
if (!absolute.startsWith(normalizedDir + path2.sep)) {
|
|
47713
|
+
throw new Error(`Handler path escapes server-logic directory: ${handlerPath}`);
|
|
47714
|
+
}
|
|
47715
|
+
if (!absolute.endsWith(".ts")) {
|
|
47716
|
+
throw new Error(`Handler must be a .ts file: ${handlerPath}`);
|
|
47717
|
+
}
|
|
47718
|
+
return absolute;
|
|
47719
|
+
}
|
|
47720
|
+
var bundledHandlers = {};
|
|
47721
|
+
function registerBundledHandlers(handlers) {
|
|
47722
|
+
bundledHandlers = handlers;
|
|
47723
|
+
}
|
|
47724
|
+
async function loadTypeScriptHandler(slug, absolutePath) {
|
|
47725
|
+
if (viteServer) {
|
|
47726
|
+
const module = viteServer.moduleGraph.getModuleById(absolutePath);
|
|
47727
|
+
if (module) viteServer.moduleGraph.invalidateModule(module);
|
|
47728
|
+
const mod = await viteServer.ssrLoadModule(absolutePath);
|
|
47729
|
+
const handler2 = mod.default;
|
|
47730
|
+
if (typeof handler2 !== "function") {
|
|
47731
|
+
throw new Error(`Handler must export a default function: ${absolutePath}`);
|
|
47732
|
+
}
|
|
47733
|
+
return handler2;
|
|
47734
|
+
}
|
|
47735
|
+
if (!(slug in bundledHandlers)) {
|
|
47736
|
+
throw new Error(
|
|
47737
|
+
`Bundled handler not found for server logic: ${slug} (not compiled into the build)`
|
|
47738
|
+
);
|
|
47739
|
+
}
|
|
47740
|
+
const handler = bundledHandlers[slug];
|
|
47741
|
+
if (typeof handler !== "function") {
|
|
47742
|
+
throw new Error(`Server logic '${slug}' must export a default function`);
|
|
47743
|
+
}
|
|
47744
|
+
return handler;
|
|
47745
|
+
}
|
|
47668
47746
|
function applyDefaults(parameterMeta, runtimeParams) {
|
|
47669
|
-
const defaults = new Map(
|
|
47747
|
+
const defaults = new Map(
|
|
47748
|
+
parameterMeta.map((p) => [p.name, p.default ?? null])
|
|
47749
|
+
);
|
|
47670
47750
|
const result = {};
|
|
47671
|
-
for (const [key, value] of Object.entries(runtimeParams))
|
|
47751
|
+
for (const [key, value] of Object.entries(runtimeParams)) {
|
|
47752
|
+
result[key] = value;
|
|
47753
|
+
}
|
|
47672
47754
|
for (const [key, defaultVal] of defaults) {
|
|
47673
|
-
if (!(key in result))
|
|
47755
|
+
if (!(key in result)) {
|
|
47756
|
+
result[key] = defaultVal;
|
|
47757
|
+
}
|
|
47674
47758
|
}
|
|
47675
47759
|
return result;
|
|
47676
47760
|
}
|
|
47677
|
-
|
|
47678
|
-
|
|
47679
|
-
|
|
47680
|
-
|
|
47681
|
-
|
|
47682
|
-
function populateServerLogics(source) {
|
|
47761
|
+
var defaultServerLogicDir = path2.join(process.cwd(), "server-logic");
|
|
47762
|
+
async function initialize() {
|
|
47763
|
+
console.log(
|
|
47764
|
+
`[registry] loading server logics from ${defaultServerLogicDir}...`
|
|
47765
|
+
);
|
|
47683
47766
|
serverLogics.clear();
|
|
47684
47767
|
skippedServerLogics = [];
|
|
47685
|
-
|
|
47686
|
-
|
|
47687
|
-
|
|
47688
|
-
|
|
47689
|
-
|
|
47690
|
-
|
|
47691
|
-
|
|
47692
|
-
|
|
47693
|
-
|
|
47694
|
-
|
|
47695
|
-
|
|
47696
|
-
|
|
47697
|
-
}
|
|
47698
|
-
const parsed = anyJsonServerLogicSchema.safeParse(json);
|
|
47699
|
-
if (!parsed.success) {
|
|
47700
|
-
skippedServerLogics.push({ slug, file: jsonPath, error: parsed.error.message });
|
|
47701
|
-
continue;
|
|
47702
|
-
}
|
|
47703
|
-
const def = parsed.data;
|
|
47704
|
-
if (def.type === "typescript") {
|
|
47705
|
-
const dir = jsonPath.slice(0, jsonPath.lastIndexOf("/"));
|
|
47706
|
-
const dirBase = dir.slice(dir.lastIndexOf("/") + 1);
|
|
47707
|
-
const rel = normalizeHandlerPath(dirBase, def.handlerPath);
|
|
47708
|
-
const loadHandler = source.handlerModules[`${dir}/${rel}`];
|
|
47709
|
-
if (!loadHandler) {
|
|
47768
|
+
const dirPath = process.env.SERVER_LOGIC_DIR || process.env.DATA_SOURCE_DIR || defaultServerLogicDir;
|
|
47769
|
+
currentDirPath = dirPath;
|
|
47770
|
+
await mkdir(dirPath, { recursive: true });
|
|
47771
|
+
const files = await readdir(dirPath);
|
|
47772
|
+
const jsonFiles = files.filter((f) => f.endsWith(".json"));
|
|
47773
|
+
const results = await Promise.allSettled(
|
|
47774
|
+
jsonFiles.map(async (file) => {
|
|
47775
|
+
const slug = file.replace(/\.json$/, "");
|
|
47776
|
+
const raw = await readFile2(`${dirPath}/${file}`, "utf-8");
|
|
47777
|
+
const parsed = anyJsonServerLogicSchema.safeParse(JSON.parse(raw));
|
|
47778
|
+
if (!parsed.success) {
|
|
47779
|
+
console.warn(`[registry] Skipping ${file}: ${parsed.error.message}`);
|
|
47710
47780
|
skippedServerLogics.push({
|
|
47711
47781
|
slug,
|
|
47712
|
-
file
|
|
47713
|
-
error:
|
|
47782
|
+
file,
|
|
47783
|
+
error: parsed.error.message
|
|
47714
47784
|
});
|
|
47715
|
-
|
|
47785
|
+
return;
|
|
47716
47786
|
}
|
|
47717
|
-
|
|
47718
|
-
|
|
47719
|
-
|
|
47720
|
-
|
|
47721
|
-
|
|
47722
|
-
|
|
47723
|
-
|
|
47724
|
-
|
|
47725
|
-
|
|
47726
|
-
|
|
47727
|
-
|
|
47728
|
-
|
|
47729
|
-
|
|
47730
|
-
|
|
47731
|
-
|
|
47732
|
-
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
|
|
47736
|
-
|
|
47737
|
-
|
|
47738
|
-
|
|
47739
|
-
|
|
47740
|
-
|
|
47741
|
-
|
|
47742
|
-
|
|
47743
|
-
|
|
47787
|
+
const def = parsed.data;
|
|
47788
|
+
if (def.type === "typescript") {
|
|
47789
|
+
const absoluteHandlerPath = validateHandlerPath(dirPath, def.handlerPath);
|
|
47790
|
+
const serverLogicDef = {
|
|
47791
|
+
description: def.description,
|
|
47792
|
+
parameters: def.parameters ?? [],
|
|
47793
|
+
response: def.response,
|
|
47794
|
+
cacheConfig: def.cache,
|
|
47795
|
+
handler: async () => {
|
|
47796
|
+
throw new Error("TypeScript handler must be called via _tsHandlerPath");
|
|
47797
|
+
},
|
|
47798
|
+
_isTypescript: true,
|
|
47799
|
+
_tsHandlerPath: absoluteHandlerPath
|
|
47800
|
+
};
|
|
47801
|
+
serverLogics.set(slug, serverLogicDef);
|
|
47802
|
+
console.log(`[registry] registered (typescript): ${slug}`);
|
|
47803
|
+
} else {
|
|
47804
|
+
const sqlDef = def;
|
|
47805
|
+
const serverLogicDef = {
|
|
47806
|
+
description: sqlDef.description,
|
|
47807
|
+
parameters: sqlDef.parameters ?? [],
|
|
47808
|
+
response: sqlDef.response,
|
|
47809
|
+
connectionId: sqlDef.connectionId,
|
|
47810
|
+
cacheConfig: sqlDef.cache,
|
|
47811
|
+
_query: sqlDef.query,
|
|
47812
|
+
handler: async (runtimeParams) => {
|
|
47813
|
+
const query = await getQuery(sqlDef.connectionId);
|
|
47814
|
+
const namedParams = applyDefaults(
|
|
47815
|
+
sqlDef.parameters ?? [],
|
|
47816
|
+
runtimeParams
|
|
47817
|
+
);
|
|
47818
|
+
const result = await query(sqlDef.query, namedParams);
|
|
47819
|
+
return result.rows;
|
|
47820
|
+
}
|
|
47821
|
+
};
|
|
47822
|
+
serverLogics.set(slug, serverLogicDef);
|
|
47823
|
+
console.log(`[registry] registered: ${slug}`);
|
|
47824
|
+
}
|
|
47825
|
+
})
|
|
47826
|
+
);
|
|
47827
|
+
results.forEach((result, i) => {
|
|
47828
|
+
if (result.status === "rejected") {
|
|
47829
|
+
console.error(
|
|
47830
|
+
`[registry] Failed to load ${jsonFiles[i]}:`,
|
|
47831
|
+
result.reason
|
|
47832
|
+
);
|
|
47833
|
+
skippedServerLogics.push({
|
|
47834
|
+
slug: jsonFiles[i].replace(/\.json$/, ""),
|
|
47835
|
+
file: jsonFiles[i],
|
|
47836
|
+
error: String(
|
|
47837
|
+
result.reason instanceof Error ? result.reason.message : result.reason
|
|
47838
|
+
)
|
|
47744
47839
|
});
|
|
47745
47840
|
}
|
|
47746
|
-
}
|
|
47747
|
-
console.log(
|
|
47748
|
-
`[registry] ${serverLogics.size} server logic(s) ready` + (skippedServerLogics.length ? ` (${skippedServerLogics.length} skipped)` : "")
|
|
47749
|
-
);
|
|
47841
|
+
});
|
|
47842
|
+
console.log(`[registry] ${serverLogics.size} server logic(s) ready`);
|
|
47750
47843
|
}
|
|
47751
|
-
|
|
47752
|
-
|
|
47753
|
-
const
|
|
47754
|
-
|
|
47755
|
-
|
|
47756
|
-
|
|
47844
|
+
var reloadTimer = null;
|
|
47845
|
+
function startWatching() {
|
|
47846
|
+
const dirPath = process.env.SERVER_LOGIC_DIR || process.env.DATA_SOURCE_DIR || defaultServerLogicDir;
|
|
47847
|
+
try {
|
|
47848
|
+
fsWatch2(dirPath, { persistent: false }, (_event, filename) => {
|
|
47849
|
+
if (!filename?.endsWith(".json") && !filename?.endsWith(".ts")) return;
|
|
47850
|
+
if (reloadTimer) clearTimeout(reloadTimer);
|
|
47851
|
+
reloadTimer = setTimeout(async () => {
|
|
47852
|
+
console.log("[registry] server-logic changed, reloading...");
|
|
47853
|
+
await initialize();
|
|
47854
|
+
}, 300);
|
|
47855
|
+
});
|
|
47856
|
+
console.log("[registry] watching server-logic directory");
|
|
47857
|
+
} catch {
|
|
47858
|
+
console.warn(
|
|
47859
|
+
"[registry] could not watch server-logic directory (static load only)"
|
|
47757
47860
|
);
|
|
47758
47861
|
}
|
|
47759
|
-
return handler;
|
|
47760
47862
|
}
|
|
47761
47863
|
function getServerLogic(slug) {
|
|
47762
47864
|
return serverLogics.get(slug);
|
|
@@ -47770,12 +47872,23 @@ function buildMeta(slug, def) {
|
|
|
47770
47872
|
cache: def.cacheConfig
|
|
47771
47873
|
};
|
|
47772
47874
|
if (def._isTypescript) {
|
|
47773
|
-
return {
|
|
47875
|
+
return {
|
|
47876
|
+
...base,
|
|
47877
|
+
type: "typescript",
|
|
47878
|
+
handlerPath: path2.relative(currentDirPath, def._tsHandlerPath)
|
|
47879
|
+
};
|
|
47774
47880
|
}
|
|
47775
|
-
return {
|
|
47881
|
+
return {
|
|
47882
|
+
...base,
|
|
47883
|
+
type: "sql",
|
|
47884
|
+
connectionId: def.connectionId,
|
|
47885
|
+
query: def._query
|
|
47886
|
+
};
|
|
47776
47887
|
}
|
|
47777
47888
|
function getAllMeta() {
|
|
47778
|
-
return Array.from(serverLogics.entries()).map(
|
|
47889
|
+
return Array.from(serverLogics.entries()).map(
|
|
47890
|
+
([slug, def]) => buildMeta(slug, def)
|
|
47891
|
+
);
|
|
47779
47892
|
}
|
|
47780
47893
|
function getMeta(slug) {
|
|
47781
47894
|
const def = serverLogics.get(slug);
|
|
@@ -47783,6 +47896,9 @@ function getMeta(slug) {
|
|
|
47783
47896
|
return buildMeta(slug, def);
|
|
47784
47897
|
}
|
|
47785
47898
|
|
|
47899
|
+
// src/routes/server-logic.ts
|
|
47900
|
+
import { Hono } from "hono";
|
|
47901
|
+
|
|
47786
47902
|
// src/cache.ts
|
|
47787
47903
|
var MAX_SIZE = 100;
|
|
47788
47904
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -47920,7 +48036,7 @@ app.get("/:slug", async (c) => {
|
|
|
47920
48036
|
}
|
|
47921
48037
|
try {
|
|
47922
48038
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47923
|
-
const handler = await loadTypeScriptHandler(ds);
|
|
48039
|
+
const handler = await loadTypeScriptHandler(slug, ds._tsHandlerPath);
|
|
47924
48040
|
const result = await handler(c);
|
|
47925
48041
|
return result;
|
|
47926
48042
|
} else {
|
|
@@ -47948,7 +48064,7 @@ app.post("/:slug", async (c) => {
|
|
|
47948
48064
|
const ttl = cacheConfig?.ttl ?? 0;
|
|
47949
48065
|
if (ttl <= 0) {
|
|
47950
48066
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47951
|
-
const handler = await loadTypeScriptHandler(ds);
|
|
48067
|
+
const handler = await loadTypeScriptHandler(slug, ds._tsHandlerPath);
|
|
47952
48068
|
const result = await handler(c);
|
|
47953
48069
|
return result;
|
|
47954
48070
|
} else {
|
|
@@ -47972,7 +48088,7 @@ app.post("/:slug", async (c) => {
|
|
|
47972
48088
|
void (async () => {
|
|
47973
48089
|
try {
|
|
47974
48090
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47975
|
-
const tsHandler = await loadTypeScriptHandler(ds);
|
|
48091
|
+
const tsHandler = await loadTypeScriptHandler(slug, ds._tsHandlerPath);
|
|
47976
48092
|
const freshResponse = await tsHandler(c);
|
|
47977
48093
|
const outcome = await cacheTypescriptResponse(freshResponse);
|
|
47978
48094
|
if (outcome.cacheable) {
|
|
@@ -47996,7 +48112,7 @@ app.post("/:slug", async (c) => {
|
|
|
47996
48112
|
}
|
|
47997
48113
|
}
|
|
47998
48114
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47999
|
-
const handler = await loadTypeScriptHandler(ds);
|
|
48115
|
+
const handler = await loadTypeScriptHandler(slug, ds._tsHandlerPath);
|
|
48000
48116
|
const response = await handler(c);
|
|
48001
48117
|
const outcome = await cacheTypescriptResponse(response);
|
|
48002
48118
|
if (outcome.cacheable) {
|
|
@@ -48061,20 +48177,20 @@ var cache_default = app3;
|
|
|
48061
48177
|
|
|
48062
48178
|
// src/routes/pages.ts
|
|
48063
48179
|
import { Hono as Hono4 } from "hono";
|
|
48064
|
-
import
|
|
48180
|
+
import path3 from "path";
|
|
48065
48181
|
import fs from "fs";
|
|
48066
|
-
var DATA_DIR = process.env.DATA_DIR ??
|
|
48182
|
+
var DATA_DIR = process.env.DATA_DIR ?? path3.join(process.cwd(), "data");
|
|
48067
48183
|
var app4 = new Hono4();
|
|
48068
48184
|
function getPageList() {
|
|
48069
48185
|
if (!fs.existsSync(DATA_DIR)) return [];
|
|
48070
48186
|
const files = fs.readdirSync(DATA_DIR).filter((f) => f.endsWith(".json"));
|
|
48071
48187
|
const pages = files.map((file) => {
|
|
48072
|
-
const name =
|
|
48188
|
+
const name = path3.basename(file, ".json");
|
|
48073
48189
|
const urlPath = name === "home" ? "/" : "/" + name.replace(/-/g, "/");
|
|
48074
48190
|
let title = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, " ");
|
|
48075
48191
|
try {
|
|
48076
48192
|
const raw = JSON.parse(
|
|
48077
|
-
fs.readFileSync(
|
|
48193
|
+
fs.readFileSync(path3.join(DATA_DIR, file), "utf-8")
|
|
48078
48194
|
);
|
|
48079
48195
|
const puckData = raw.pageData || raw;
|
|
48080
48196
|
if (puckData?.root?.props?.title) {
|
|
@@ -48095,7 +48211,7 @@ app4.get("/pages", (c) => c.json(getPageList()));
|
|
|
48095
48211
|
app4.get("/page-data", (c) => {
|
|
48096
48212
|
const page = c.req.query("page") || "home";
|
|
48097
48213
|
const safePage = page.replace(/[^a-zA-Z0-9-_]/g, "");
|
|
48098
|
-
const filePath =
|
|
48214
|
+
const filePath = path3.join(DATA_DIR, `${safePage}.json`);
|
|
48099
48215
|
if (!fs.existsSync(filePath)) return c.json({ error: "not found" }, 404);
|
|
48100
48216
|
try {
|
|
48101
48217
|
const raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
@@ -48113,7 +48229,7 @@ app4.get("/page-data", (c) => {
|
|
|
48113
48229
|
app4.get("/runtime-data", (c) => {
|
|
48114
48230
|
const page = c.req.query("page") || "home";
|
|
48115
48231
|
const safePage = page.replace(/[^a-zA-Z0-9-_]/g, "");
|
|
48116
|
-
const filePath =
|
|
48232
|
+
const filePath = path3.join(DATA_DIR, `${safePage}.json`);
|
|
48117
48233
|
if (!fs.existsSync(filePath)) return c.json({ queries: [] });
|
|
48118
48234
|
try {
|
|
48119
48235
|
const raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
@@ -48245,9 +48361,9 @@ var getBase = () => {
|
|
|
48245
48361
|
if (cachedBase == null) cachedBase = resolveBase();
|
|
48246
48362
|
return cachedBase;
|
|
48247
48363
|
};
|
|
48248
|
-
var jsonFetch = async (method,
|
|
48364
|
+
var jsonFetch = async (method, path5, body) => {
|
|
48249
48365
|
const base = getBase();
|
|
48250
|
-
const url = `${base.baseUrl}${
|
|
48366
|
+
const url = `${base.baseUrl}${path5}`;
|
|
48251
48367
|
const authHeaders2 = resolveAuthHeaders2(base.routeKind);
|
|
48252
48368
|
const res = await fetch(url, {
|
|
48253
48369
|
method,
|
|
@@ -48440,7 +48556,9 @@ apiApp.route("/server-logic", server_logic_default);
|
|
|
48440
48556
|
apiApp.route("/server-logic-meta", server_logic_meta_default);
|
|
48441
48557
|
apiApp.route("/cache", cache_default);
|
|
48442
48558
|
apiApp.route("/", pages_default);
|
|
48443
|
-
reloadEnvFile(
|
|
48559
|
+
reloadEnvFile(path4.join(process.cwd(), ".env"));
|
|
48560
|
+
await initialize();
|
|
48561
|
+
startWatching();
|
|
48444
48562
|
watchConnectionsFile();
|
|
48445
48563
|
var app5 = new Hono5();
|
|
48446
48564
|
app5.get("/healthz", (c) => c.json({ status: "ok" }));
|
|
@@ -48458,6 +48576,6 @@ export {
|
|
|
48458
48576
|
src_default as default,
|
|
48459
48577
|
getQuery,
|
|
48460
48578
|
loadConnections,
|
|
48461
|
-
|
|
48579
|
+
registerBundledHandlers,
|
|
48462
48580
|
storage
|
|
48463
48581
|
};
|