@squadbase/vite-server 0.1.19 → 0.1.20-dev.39a001c
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 +23 -0
- package/dist/cli/index.js +419 -452
- package/dist/connectors/google-analytics-oauth.js +102 -188
- package/dist/index.d.ts +25 -1
- package/dist/index.js +501 -610
- package/dist/main.d.ts +1 -0
- package/dist/main.js +505 -614
- package/dist/types/server-logic.d.ts +3 -0
- package/dist/vite-plugin.d.ts +7 -2
- package/dist/vite-plugin.js +54 -47459
- package/package.json +3 -8
package/dist/main.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,12 +620,7 @@ 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
|
|
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";
|
|
623
|
+
import path3 from "path";
|
|
629
624
|
|
|
630
625
|
// src/connector-client/registry.ts
|
|
631
626
|
import { readFileSync, watch as fsWatch } from "fs";
|
|
@@ -8076,12 +8071,12 @@ var parameters13 = {
|
|
|
8076
8071
|
|
|
8077
8072
|
// ../connectors/src/connectors/airtable/utils.ts
|
|
8078
8073
|
var BASE_URL = "https://api.airtable.com/v0";
|
|
8079
|
-
async function apiFetch(params,
|
|
8074
|
+
async function apiFetch(params, path5, init) {
|
|
8080
8075
|
const apiKey = params[parameters13.apiKey.slug];
|
|
8081
8076
|
if (!apiKey) {
|
|
8082
8077
|
throw new Error("airtable: missing required parameter: api-key");
|
|
8083
8078
|
}
|
|
8084
|
-
const url = `${BASE_URL}${
|
|
8079
|
+
const url = `${BASE_URL}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
8085
8080
|
const headers = new Headers(init?.headers);
|
|
8086
8081
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
8087
8082
|
return fetch(url, { ...init, headers });
|
|
@@ -8283,16 +8278,16 @@ Authentication is handled automatically using the API Key.
|
|
|
8283
8278
|
{baseId} in the path is automatically replaced with the connection's base-id.`,
|
|
8284
8279
|
inputSchema: inputSchema19,
|
|
8285
8280
|
outputSchema: outputSchema19,
|
|
8286
|
-
async execute({ connectionId, method, path:
|
|
8281
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
8287
8282
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
8288
8283
|
if (!connection2) {
|
|
8289
8284
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
8290
8285
|
}
|
|
8291
|
-
console.log(`[connector-request] airtable/${connection2.name}: ${method} ${
|
|
8286
|
+
console.log(`[connector-request] airtable/${connection2.name}: ${method} ${path5}`);
|
|
8292
8287
|
try {
|
|
8293
8288
|
const apiKey = parameters13.apiKey.getValue(connection2);
|
|
8294
8289
|
const baseId = parameters13.baseId.getValue(connection2);
|
|
8295
|
-
const resolvedPath =
|
|
8290
|
+
const resolvedPath = path5.replace(/\{baseId\}/g, baseId);
|
|
8296
8291
|
const url = `${BASE_URL2}${resolvedPath}`;
|
|
8297
8292
|
const controller = new AbortController();
|
|
8298
8293
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS7);
|
|
@@ -8987,7 +8982,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
8987
8982
|
{customerId} in the path is automatically replaced with the connection's customer ID (hyphens removed).`,
|
|
8988
8983
|
inputSchema: inputSchema21,
|
|
8989
8984
|
outputSchema: outputSchema21,
|
|
8990
|
-
async execute({ connectionId, method, path:
|
|
8985
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
8991
8986
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
8992
8987
|
if (!connection2) {
|
|
8993
8988
|
return {
|
|
@@ -8996,12 +8991,12 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
8996
8991
|
};
|
|
8997
8992
|
}
|
|
8998
8993
|
console.log(
|
|
8999
|
-
`[connector-request] google-ads/${connection2.name}: ${method} ${
|
|
8994
|
+
`[connector-request] google-ads/${connection2.name}: ${method} ${path5}`
|
|
9000
8995
|
);
|
|
9001
8996
|
try {
|
|
9002
8997
|
const rawCustomerId = parameters14.customerId.tryGetValue(connection2);
|
|
9003
8998
|
const customerId = rawCustomerId?.replace(/-/g, "") ?? "";
|
|
9004
|
-
const resolvedPath = customerId ?
|
|
8999
|
+
const resolvedPath = customerId ? path5.replace(/\{customerId\}/g, customerId) : path5;
|
|
9005
9000
|
const token = await getProxyToken5(config.oauthProxy);
|
|
9006
9001
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
9007
9002
|
const controller = new AbortController();
|
|
@@ -9348,7 +9343,7 @@ async function getAccessToken(serviceAccountKey) {
|
|
|
9348
9343
|
const data = await response.json();
|
|
9349
9344
|
return data.access_token;
|
|
9350
9345
|
}
|
|
9351
|
-
async function adminFetch(params,
|
|
9346
|
+
async function adminFetch(params, path5, init) {
|
|
9352
9347
|
const keyJsonBase64 = params[parameters15.serviceAccountKeyJsonBase64.slug];
|
|
9353
9348
|
if (!keyJsonBase64) {
|
|
9354
9349
|
throw new Error(
|
|
@@ -9357,12 +9352,12 @@ async function adminFetch(params, path6, init) {
|
|
|
9357
9352
|
}
|
|
9358
9353
|
const serviceAccountKey = decodeServiceAccount(keyJsonBase64);
|
|
9359
9354
|
const accessToken = await getAccessToken(serviceAccountKey);
|
|
9360
|
-
const url = `${ADMIN_BASE_URL}${
|
|
9355
|
+
const url = `${ADMIN_BASE_URL}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
9361
9356
|
const headers = new Headers(init?.headers);
|
|
9362
9357
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
9363
9358
|
return fetch(url, { ...init, headers });
|
|
9364
9359
|
}
|
|
9365
|
-
async function dataFetch(params,
|
|
9360
|
+
async function dataFetch(params, path5, init) {
|
|
9366
9361
|
const keyJsonBase64 = params[parameters15.serviceAccountKeyJsonBase64.slug];
|
|
9367
9362
|
if (!keyJsonBase64) {
|
|
9368
9363
|
throw new Error(
|
|
@@ -9371,7 +9366,7 @@ async function dataFetch(params, path6, init) {
|
|
|
9371
9366
|
}
|
|
9372
9367
|
const serviceAccountKey = decodeServiceAccount(keyJsonBase64);
|
|
9373
9368
|
const accessToken = await getAccessToken(serviceAccountKey);
|
|
9374
|
-
const url = `${DATA_BASE_URL}${
|
|
9369
|
+
const url = `${DATA_BASE_URL}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
9375
9370
|
const headers = new Headers(init?.headers);
|
|
9376
9371
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
9377
9372
|
return fetch(url, { ...init, headers });
|
|
@@ -9395,8 +9390,8 @@ async function listAccountSummaries(params) {
|
|
|
9395
9390
|
const summaries = [];
|
|
9396
9391
|
let pageToken;
|
|
9397
9392
|
do {
|
|
9398
|
-
const
|
|
9399
|
-
const res = await adminFetch(params,
|
|
9393
|
+
const path5 = pageToken ? `/accountSummaries?pageToken=${encodeURIComponent(pageToken)}` : `/accountSummaries`;
|
|
9394
|
+
const res = await adminFetch(params, path5);
|
|
9400
9395
|
if (!res.ok) {
|
|
9401
9396
|
const body = await res.text().catch(() => res.statusText);
|
|
9402
9397
|
throw new Error(
|
|
@@ -9635,9 +9630,9 @@ function renderTopPages(sections, report) {
|
|
|
9635
9630
|
sections.push("| Path | Page views | Active users | Avg session duration |");
|
|
9636
9631
|
sections.push("|------|------------|--------------|----------------------|");
|
|
9637
9632
|
for (const row of rows.slice(0, TOP_N_PAGES)) {
|
|
9638
|
-
const
|
|
9633
|
+
const path5 = truncate(row.dimensionValues?.[0]?.value, PAGE_PATH_MAX) || "-";
|
|
9639
9634
|
sections.push(
|
|
9640
|
-
`| ${escapePipe(
|
|
9635
|
+
`| ${escapePipe(path5)} | ${formatNumber(row.metricValues?.[0]?.value)} | ${formatNumber(
|
|
9641
9636
|
row.metricValues?.[1]?.value
|
|
9642
9637
|
)} | ${formatDuration(row.metricValues?.[2]?.value)} |`
|
|
9643
9638
|
);
|
|
@@ -10011,12 +10006,12 @@ var requestTool3 = new ConnectorTool({
|
|
|
10011
10006
|
Authentication is handled automatically using a service account.`,
|
|
10012
10007
|
inputSchema: inputSchema22,
|
|
10013
10008
|
outputSchema: outputSchema22,
|
|
10014
|
-
async execute({ connectionId, method, path:
|
|
10009
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
10015
10010
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
10016
10011
|
if (!connection2) {
|
|
10017
10012
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
10018
10013
|
}
|
|
10019
|
-
console.log(`[connector-request] google-analytics/${connection2.name}: ${method} ${
|
|
10014
|
+
console.log(`[connector-request] google-analytics/${connection2.name}: ${method} ${path5}`);
|
|
10020
10015
|
try {
|
|
10021
10016
|
const { GoogleAuth } = await import("google-auth-library");
|
|
10022
10017
|
const keyJsonBase64 = parameters15.serviceAccountKeyJsonBase64.getValue(connection2);
|
|
@@ -10031,7 +10026,7 @@ Authentication is handled automatically using a service account.`,
|
|
|
10031
10026
|
if (!token) {
|
|
10032
10027
|
return { success: false, error: "Failed to obtain access token" };
|
|
10033
10028
|
}
|
|
10034
|
-
const url = `${BASE_URL3}${
|
|
10029
|
+
const url = `${BASE_URL3}${path5}`;
|
|
10035
10030
|
const controller = new AbortController();
|
|
10036
10031
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS10);
|
|
10037
10032
|
try {
|
|
@@ -10505,11 +10500,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10505
10500
|
- \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
|
|
10506
10501
|
- \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
|
|
10507
10502
|
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
|
|
10508
|
-
4.
|
|
10509
|
-
- \`
|
|
10510
|
-
-
|
|
10511
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
10512
|
-
5. \
|
|
10503
|
+
4. \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u9078\u629E:
|
|
10504
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **2\u4EF6\u4EE5\u4E0A**: \u300C\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059\uFF08\`options\`: \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\uFF09
|
|
10505
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10506
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\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\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10507
|
+
5. \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF08\u6570\u5024\uFF09\u306F\u4EE5\u964D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u30D1\u30B9\u306B\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u306F\u4FDD\u5B58\u3055\u308C\u306A\u3044\uFF09\u3002\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
10513
10508
|
|
|
10514
10509
|
#### \u5236\u7D04
|
|
10515
10510
|
- **\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
|
|
@@ -10523,11 +10518,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10523
10518
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
10524
10519
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
10525
10520
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
10526
|
-
4.
|
|
10527
|
-
- \`
|
|
10528
|
-
-
|
|
10529
|
-
-
|
|
10530
|
-
5.
|
|
10521
|
+
4. Select a property:
|
|
10522
|
+
- **2 or more properties**: Tell the user "Please select a property.", then call \`askUserQuestion\` (\`options\`: each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID)
|
|
10523
|
+
- **Only 1 property**: Skip \`askUserQuestion\` and proceed using that property as the selection
|
|
10524
|
+
- **0 properties**: Abort setup and inform the user that no accessible properties are available
|
|
10525
|
+
5. Write the selected numeric property id directly into the request path (it is not stored on the connection). Proceed to the next step
|
|
10531
10526
|
|
|
10532
10527
|
#### Constraints
|
|
10533
10528
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -10535,26 +10530,17 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10535
10530
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
10536
10531
|
},
|
|
10537
10532
|
dataOverviewInstructions: {
|
|
10538
|
-
en: `
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10533
|
+
en: `Use the selected numeric property id in the path (write it directly, e.g. properties/123456789).
|
|
10534
|
+
1. Call connector_google-analytics-oauth_request with GET properties/<propertyId>/metadata to list available dimensions and metrics
|
|
10535
|
+
2. Call connector_google-analytics-oauth_request with POST properties/<propertyId>:runReport using a small date range and basic metrics to verify data availability`,
|
|
10536
|
+
ja: `\u9078\u629E\u3057\u305F\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: properties/123456789\uFF09\u3002
|
|
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`
|
|
10542
10539
|
}
|
|
10543
10540
|
});
|
|
10544
10541
|
|
|
10545
10542
|
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
10546
|
-
|
|
10547
|
-
var parameters16 = {
|
|
10548
|
-
propertyId: new ParameterDefinition({
|
|
10549
|
-
slug: "property-id",
|
|
10550
|
-
name: "Google Analytics Property ID",
|
|
10551
|
-
description: "The Google Analytics 4 property ID (e.g., 123456789). Can be found in GA4 Admin > Property Settings.",
|
|
10552
|
-
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
10553
|
-
type: "text",
|
|
10554
|
-
secret: false,
|
|
10555
|
-
required: false
|
|
10556
|
-
})
|
|
10557
|
-
};
|
|
10543
|
+
var parameters16 = {};
|
|
10558
10544
|
|
|
10559
10545
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
10560
10546
|
var ADMIN_BASE_URL4 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
@@ -10861,7 +10847,7 @@ var inputSchema25 = z25.object({
|
|
|
10861
10847
|
connectionId: z25.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
10862
10848
|
method: z25.enum(["GET", "POST"]).describe("HTTP method"),
|
|
10863
10849
|
path: z25.string().describe(
|
|
10864
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/
|
|
10850
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly into the path."
|
|
10865
10851
|
),
|
|
10866
10852
|
body: z25.record(z25.string(), z25.unknown()).optional().describe("POST request body (JSON)")
|
|
10867
10853
|
});
|
|
@@ -10880,10 +10866,10 @@ var requestTool4 = new ConnectorTool({
|
|
|
10880
10866
|
name: "request",
|
|
10881
10867
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
10882
10868
|
Authentication is handled automatically via OAuth proxy.
|
|
10883
|
-
|
|
10869
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
10884
10870
|
inputSchema: inputSchema25,
|
|
10885
10871
|
outputSchema: outputSchema25,
|
|
10886
|
-
async execute({ connectionId, method, path:
|
|
10872
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
10887
10873
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
10888
10874
|
if (!connection2) {
|
|
10889
10875
|
return {
|
|
@@ -10892,12 +10878,10 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
10892
10878
|
};
|
|
10893
10879
|
}
|
|
10894
10880
|
console.log(
|
|
10895
|
-
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${
|
|
10881
|
+
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${path5}`
|
|
10896
10882
|
);
|
|
10897
10883
|
try {
|
|
10898
|
-
const
|
|
10899
|
-
const resolvedPath = propertyId ? path6.replace(/\{propertyId\}/g, propertyId) : path6;
|
|
10900
|
-
const url = `${BASE_URL4}${resolvedPath}`;
|
|
10884
|
+
const url = `${BASE_URL4}${path5}`;
|
|
10901
10885
|
const token = await getProxyToken8(config.oauthProxy);
|
|
10902
10886
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
10903
10887
|
const controller = new AbortController();
|
|
@@ -10967,24 +10951,20 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
10967
10951
|
systemPrompt: {
|
|
10968
10952
|
en: `### Tools
|
|
10969
10953
|
|
|
10970
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports.
|
|
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}\`. Authentication is configured automatically via OAuth.
|
|
10971
10955
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
10972
10956
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
10973
10957
|
|
|
10974
|
-
### GA4 Data API Reference
|
|
10958
|
+
### GA4 Data API Reference \u2014 for the \`connector_google-analytics-oauth_request\` **tool** only (setup/discovery)
|
|
10975
10959
|
|
|
10976
|
-
|
|
10977
|
-
- GET properties/{propertyId}/metadata
|
|
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:**
|
|
10978
10961
|
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
"metrics": [{"name": "activeUsers"}],
|
|
10986
|
-
"limit": 100
|
|
10987
|
-
}
|
|
10962
|
+
| Raw HTTP (tool, discovery) | Server-logic (SDK method) |
|
|
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 }\` |
|
|
10966
|
+
|
|
10967
|
+
Report body fields: \`dateRanges: [{ startDate, endDate }]\`, \`dimensions: [{ name }]\`, \`metrics: [{ name }]\`, optional \`limit\`.
|
|
10988
10968
|
|
|
10989
10969
|
### Common Dimensions
|
|
10990
10970
|
date, country, city, deviceCategory, browser, pagePath, pageTitle,
|
|
@@ -11002,11 +10982,14 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11002
10982
|
|
|
11003
10983
|
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.
|
|
11004
10984
|
|
|
11005
|
-
SDK surface (client created via \`connection(connectionId)\`)
|
|
11006
|
-
- \`client.
|
|
11007
|
-
- \`client.
|
|
11008
|
-
- \`client.
|
|
11009
|
-
|
|
10985
|
+
SDK surface (client created via \`connection(connectionId)\`). **Every method returns already-parsed JSON \u2014 you never build an HTTP request or parse a response yourself:**
|
|
10986
|
+
- \`client.runReport({ propertyId, dateRanges, dimensions, metrics, limit? })\` \u2014 run a GA4 report. Returns \`{ rows, rowCount }\`. **Use this for all reporting.**
|
|
10987
|
+
- \`client.runRealtimeReport({ propertyId, dimensions, metrics })\` \u2014 realtime report. Returns \`{ rows, rowCount }\`.
|
|
10988
|
+
- \`client.getMetadata(propertyId)\` \u2014 available dimensions and metrics for a property.
|
|
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.
|
|
10991
|
+
|
|
10992
|
+
**\`propertyId\` is required on every call** \u2014 pass the numeric id from the data overview. A GA connection can span multiple properties, so there is no stored default.
|
|
11010
10993
|
|
|
11011
10994
|
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.
|
|
11012
10995
|
|
|
@@ -11015,48 +10998,42 @@ If a handler test fails with \`Connection proxy is not configured\`, retry \u201
|
|
|
11015
10998
|
\`\`\`ts
|
|
11016
10999
|
import { connection } from "@squadbase/vite-server/connectors/google-analytics-oauth";
|
|
11017
11000
|
|
|
11018
|
-
|
|
11001
|
+
export default async function handler(c) {
|
|
11002
|
+
const client = connection("<connectionId>");
|
|
11003
|
+
const propertyId = "123456789"; // numeric GA4 property id from the data overview
|
|
11019
11004
|
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
}
|
|
11025
|
-
|
|
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
|
+
});
|
|
11026
11011
|
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
const realtime = await ga.runRealtimeReport({
|
|
11036
|
-
metrics: [{ name: "activeUsers" }],
|
|
11037
|
-
dimensions: [{ name: "country" }],
|
|
11038
|
-
});
|
|
11012
|
+
const data = rows.map((row) => ({
|
|
11013
|
+
date: row.dimensionValues[0].value,
|
|
11014
|
+
channel: row.dimensionValues[1].value,
|
|
11015
|
+
sessions: Number(row.metricValues[0].value) || 0,
|
|
11016
|
+
}));
|
|
11017
|
+
|
|
11018
|
+
return c.json(data);
|
|
11019
|
+
}
|
|
11039
11020
|
\`\`\``,
|
|
11040
11021
|
ja: `### \u30C4\u30FC\u30EB
|
|
11041
11022
|
|
|
11042
|
-
- \`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\u30D1\u30B9\
|
|
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
|
|
11043
11024
|
- \`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
|
|
11044
11025
|
- \`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
|
|
11045
11026
|
|
|
11046
|
-
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
11027
|
+
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9 \u2014 \`connector_google-analytics-oauth_request\` **\u30C4\u30FC\u30EB**\u5C02\u7528\uFF08\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7/\u63A2\u7D22\u6642\uFF09
|
|
11047
11028
|
|
|
11048
|
-
|
|
11049
|
-
- GET properties/{propertyId}/metadata
|
|
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:**
|
|
11050
11030
|
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
"metrics": [{"name": "activeUsers"}],
|
|
11058
|
-
"limit": 100
|
|
11059
|
-
}
|
|
11031
|
+
| \u751F\u306E HTTP\uFF08\u30C4\u30FC\u30EB\u30FB\u63A2\u7D22\u7528\uFF09 | server-logic\uFF08SDK \u30E1\u30BD\u30C3\u30C9\uFF09 |
|
|
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 }\` |
|
|
11035
|
+
|
|
11036
|
+
\u30EC\u30DD\u30FC\u30C8\u306E body \u30D5\u30A3\u30FC\u30EB\u30C9: \`dateRanges: [{ startDate, endDate }]\`, \`dimensions: [{ name }]\`, \`metrics: [{ name }]\`, \u4EFB\u610F\u3067 \`limit\`\u3002
|
|
11060
11037
|
|
|
11061
11038
|
### \u4E3B\u8981\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3
|
|
11062
11039
|
date, country, city, deviceCategory, browser, pagePath, pageTitle,
|
|
@@ -11074,11 +11051,14 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11074
11051
|
|
|
11075
11052
|
\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
|
|
11076
11053
|
|
|
11077
|
-
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09
|
|
11078
|
-
- \`client.
|
|
11079
|
-
- \`client.
|
|
11080
|
-
- \`client.
|
|
11081
|
-
|
|
11054
|
+
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09\u3002**\u5404\u30E1\u30BD\u30C3\u30C9\u306F\u30D1\u30FC\u30B9\u6E08\u307F JSON \u3092\u8FD4\u3057\u307E\u3059 \u2014 HTTP \u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u7D44\u307F\u7ACB\u3066\u3084\u30EC\u30B9\u30DD\u30F3\u30B9\u306E\u30D1\u30FC\u30B9\u3092\u81EA\u5206\u3067\u884C\u3046\u5FC5\u8981\u306F\u3042\u308A\u307E\u305B\u3093:**
|
|
11055
|
+
- \`client.runReport({ propertyId, dateRanges, dimensions, metrics, limit? })\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`{ rows, rowCount }\` \u3092\u8FD4\u3057\u307E\u3059\u3002**\u30EC\u30DD\u30FC\u30C8\u53D6\u5F97\u306F\u5FC5\u305A\u3053\u308C\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002**
|
|
11056
|
+
- \`client.runRealtimeReport({ propertyId, dimensions, metrics })\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3002\`{ rows, rowCount }\` \u3092\u8FD4\u3057\u307E\u3059\u3002
|
|
11057
|
+
- \`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
|
|
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
|
|
11060
|
+
|
|
11061
|
+
**\`propertyId\` \u306F\u3059\u3079\u3066\u306E\u547C\u3073\u51FA\u3057\u3067\u5FC5\u9808\u3067\u3059**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002GA \u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u8907\u6570\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u307E\u305F\u304C\u308B\u3053\u3068\u304C\u3042\u308B\u305F\u3081\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3002
|
|
11082
11062
|
|
|
11083
11063
|
\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
|
|
11084
11064
|
|
|
@@ -11087,38 +11067,32 @@ SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9
|
|
|
11087
11067
|
\`\`\`ts
|
|
11088
11068
|
import { connection } from "@squadbase/vite-server/connectors/google-analytics-oauth";
|
|
11089
11069
|
|
|
11090
|
-
|
|
11070
|
+
export default async function handler(c) {
|
|
11071
|
+
const client = connection("<connectionId>");
|
|
11072
|
+
const propertyId = "123456789"; // \u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024\u306E GA4 \u30D7\u30ED\u30D1\u30C6\u30A3ID
|
|
11091
11073
|
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
}
|
|
11097
|
-
|
|
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
|
+
});
|
|
11098
11080
|
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
const realtime = await ga.runRealtimeReport({
|
|
11108
|
-
metrics: [{ name: "activeUsers" }],
|
|
11109
|
-
dimensions: [{ name: "country" }],
|
|
11110
|
-
});
|
|
11081
|
+
const data = rows.map((row) => ({
|
|
11082
|
+
date: row.dimensionValues[0].value,
|
|
11083
|
+
channel: row.dimensionValues[1].value,
|
|
11084
|
+
sessions: Number(row.metricValues[0].value) || 0,
|
|
11085
|
+
}));
|
|
11086
|
+
|
|
11087
|
+
return c.json(data);
|
|
11088
|
+
}
|
|
11111
11089
|
\`\`\``
|
|
11112
11090
|
},
|
|
11113
11091
|
tools: tools16,
|
|
11114
11092
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
11115
|
-
async checkConnection(
|
|
11093
|
+
async checkConnection(_params, config) {
|
|
11116
11094
|
const { proxyFetch } = config;
|
|
11117
|
-
const
|
|
11118
|
-
if (!propertyId) {
|
|
11119
|
-
return { success: true };
|
|
11120
|
-
}
|
|
11121
|
-
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
11095
|
+
const url = "https://analyticsadmin.googleapis.com/v1beta/accountSummaries";
|
|
11122
11096
|
try {
|
|
11123
11097
|
const res = await proxyFetch(url, { method: "GET" });
|
|
11124
11098
|
if (!res.ok) {
|
|
@@ -11142,8 +11116,8 @@ const realtime = await ga.runRealtimeReport({
|
|
|
11142
11116
|
import { z as z26 } from "zod";
|
|
11143
11117
|
|
|
11144
11118
|
// ../connectors/src/lib/normalize-path.ts
|
|
11145
|
-
function normalizeRequestPath(
|
|
11146
|
-
let p =
|
|
11119
|
+
function normalizeRequestPath(path5, basePathSegment) {
|
|
11120
|
+
let p = path5.trim();
|
|
11147
11121
|
if (!p.startsWith("/")) p = "/" + p;
|
|
11148
11122
|
if (p === basePathSegment || p.startsWith(basePathSegment + "/")) {
|
|
11149
11123
|
p = p.slice(basePathSegment.length) || "/";
|
|
@@ -11207,7 +11181,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
11207
11181
|
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`).",
|
|
11208
11182
|
inputSchema: inputSchema26,
|
|
11209
11183
|
outputSchema: outputSchema26,
|
|
11210
|
-
async execute({ connectionId, method, path:
|
|
11184
|
+
async execute({ connectionId, method, path: path5, scopes, queryParams, body }, connections) {
|
|
11211
11185
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
11212
11186
|
if (!connection2) {
|
|
11213
11187
|
return {
|
|
@@ -11228,7 +11202,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
11228
11202
|
}
|
|
11229
11203
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
11230
11204
|
console.log(
|
|
11231
|
-
`[connector-request] google-calendar/${connection2.name}: ${method} ${
|
|
11205
|
+
`[connector-request] google-calendar/${connection2.name}: ${method} ${path5} (service account)`
|
|
11232
11206
|
);
|
|
11233
11207
|
try {
|
|
11234
11208
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -11247,7 +11221,7 @@ var requestTool5 = new ConnectorTool({
|
|
|
11247
11221
|
serviceAccountEmail
|
|
11248
11222
|
};
|
|
11249
11223
|
}
|
|
11250
|
-
const normalizedPath = normalizeRequestPath(
|
|
11224
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT);
|
|
11251
11225
|
let url = `${BASE_URL5}${normalizedPath}`;
|
|
11252
11226
|
if (queryParams) {
|
|
11253
11227
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -11344,7 +11318,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
11344
11318
|
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.",
|
|
11345
11319
|
inputSchema: inputSchema27,
|
|
11346
11320
|
outputSchema: outputSchema27,
|
|
11347
|
-
async execute({ connectionId, method, path:
|
|
11321
|
+
async execute({ connectionId, method, path: path5, subject, scopes, queryParams, body }, connections) {
|
|
11348
11322
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
11349
11323
|
if (!connection2) {
|
|
11350
11324
|
return {
|
|
@@ -11365,7 +11339,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
11365
11339
|
}
|
|
11366
11340
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
11367
11341
|
console.log(
|
|
11368
|
-
`[connector-request] google-calendar/${connection2.name}: ${method} ${
|
|
11342
|
+
`[connector-request] google-calendar/${connection2.name}: ${method} ${path5} subject=${subject}`
|
|
11369
11343
|
);
|
|
11370
11344
|
try {
|
|
11371
11345
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -11385,7 +11359,7 @@ var requestWithDelegationTool = new ConnectorTool({
|
|
|
11385
11359
|
serviceAccountEmail
|
|
11386
11360
|
};
|
|
11387
11361
|
}
|
|
11388
|
-
const normalizedPath = normalizeRequestPath(
|
|
11362
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT2);
|
|
11389
11363
|
let url = `${BASE_URL6}${normalizedPath}`;
|
|
11390
11364
|
if (queryParams) {
|
|
11391
11365
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -12467,7 +12441,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
12467
12441
|
{calendarId} in the path is automatically replaced with the connection's default calendar ID.`,
|
|
12468
12442
|
inputSchema: inputSchema29,
|
|
12469
12443
|
outputSchema: outputSchema29,
|
|
12470
|
-
async execute({ connectionId, method, path:
|
|
12444
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
12471
12445
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
12472
12446
|
if (!connection2) {
|
|
12473
12447
|
return {
|
|
@@ -12476,11 +12450,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
12476
12450
|
};
|
|
12477
12451
|
}
|
|
12478
12452
|
console.log(
|
|
12479
|
-
`[connector-request] google-calendar-oauth/${connection2.name}: ${method} ${
|
|
12453
|
+
`[connector-request] google-calendar-oauth/${connection2.name}: ${method} ${path5}`
|
|
12480
12454
|
);
|
|
12481
12455
|
try {
|
|
12482
12456
|
const calendarId = parameters18.calendarId.tryGetValue(connection2) ?? "primary";
|
|
12483
|
-
const resolvedPath =
|
|
12457
|
+
const resolvedPath = path5.replace(/\{calendarId\}/g, calendarId);
|
|
12484
12458
|
const normalizedPath = normalizeRequestPath(
|
|
12485
12459
|
resolvedPath,
|
|
12486
12460
|
BASE_PATH_SEGMENT3
|
|
@@ -12886,7 +12860,7 @@ Supports GET (read) and POST (create/update) methods.
|
|
|
12886
12860
|
Authentication is handled automatically via OAuth proxy.`,
|
|
12887
12861
|
inputSchema: inputSchema30,
|
|
12888
12862
|
outputSchema: outputSchema30,
|
|
12889
|
-
async execute({ connectionId, method, path:
|
|
12863
|
+
async execute({ connectionId, method, path: path5, body, queryParams }, connections, config) {
|
|
12890
12864
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
12891
12865
|
if (!connection2) {
|
|
12892
12866
|
return {
|
|
@@ -12895,11 +12869,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
12895
12869
|
};
|
|
12896
12870
|
}
|
|
12897
12871
|
console.log(
|
|
12898
|
-
`[connector-request] google-docs/${connection2.name}: ${method} ${
|
|
12872
|
+
`[connector-request] google-docs/${connection2.name}: ${method} ${path5}`
|
|
12899
12873
|
);
|
|
12900
12874
|
try {
|
|
12901
12875
|
const normalizedPath = normalizeRequestPath(
|
|
12902
|
-
|
|
12876
|
+
path5,
|
|
12903
12877
|
DOCS_BASE_PATH_SEGMENT
|
|
12904
12878
|
);
|
|
12905
12879
|
let url = `${DOCS_BASE_URL}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
@@ -13351,7 +13325,7 @@ Supports GET (read/list/download), POST (create/copy), and PATCH (update) method
|
|
|
13351
13325
|
Authentication is handled automatically via OAuth proxy.`,
|
|
13352
13326
|
inputSchema: inputSchema31,
|
|
13353
13327
|
outputSchema: outputSchema31,
|
|
13354
|
-
async execute({ connectionId, method, path:
|
|
13328
|
+
async execute({ connectionId, method, path: path5, body, queryParams }, connections, config) {
|
|
13355
13329
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
13356
13330
|
if (!connection2) {
|
|
13357
13331
|
return {
|
|
@@ -13360,10 +13334,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
13360
13334
|
};
|
|
13361
13335
|
}
|
|
13362
13336
|
console.log(
|
|
13363
|
-
`[connector-request] google-drive/${connection2.name}: ${method} ${
|
|
13337
|
+
`[connector-request] google-drive/${connection2.name}: ${method} ${path5}`
|
|
13364
13338
|
);
|
|
13365
13339
|
try {
|
|
13366
|
-
const normalizedPath = normalizeRequestPath(
|
|
13340
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT4);
|
|
13367
13341
|
let url = `${BASE_URL9}${normalizedPath}`;
|
|
13368
13342
|
if (queryParams) {
|
|
13369
13343
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -13792,7 +13766,7 @@ The caller must include the target spreadsheetId in the path explicitly.
|
|
|
13792
13766
|
Authentication is handled automatically via OAuth proxy.`,
|
|
13793
13767
|
inputSchema: inputSchema32,
|
|
13794
13768
|
outputSchema: outputSchema32,
|
|
13795
|
-
async execute({ connectionId, method, path:
|
|
13769
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
13796
13770
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
13797
13771
|
if (!connection2) {
|
|
13798
13772
|
return {
|
|
@@ -13801,11 +13775,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
13801
13775
|
};
|
|
13802
13776
|
}
|
|
13803
13777
|
console.log(
|
|
13804
|
-
`[connector-request] google-sheets/${connection2.name}: ${method} ${
|
|
13778
|
+
`[connector-request] google-sheets/${connection2.name}: ${method} ${path5}`
|
|
13805
13779
|
);
|
|
13806
13780
|
try {
|
|
13807
13781
|
const normalizedPath = normalizeRequestPath(
|
|
13808
|
-
|
|
13782
|
+
path5,
|
|
13809
13783
|
SHEETS_BASE_PATH_SEGMENT
|
|
13810
13784
|
);
|
|
13811
13785
|
let url = `${SHEETS_BASE_URL}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
@@ -14308,7 +14282,7 @@ Supports GET (read) and POST (create/update) methods.
|
|
|
14308
14282
|
Authentication is handled automatically via OAuth proxy.`,
|
|
14309
14283
|
inputSchema: inputSchema33,
|
|
14310
14284
|
outputSchema: outputSchema33,
|
|
14311
|
-
async execute({ connectionId, method, path:
|
|
14285
|
+
async execute({ connectionId, method, path: path5, body, queryParams }, connections, config) {
|
|
14312
14286
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
14313
14287
|
if (!connection2) {
|
|
14314
14288
|
return {
|
|
@@ -14317,11 +14291,11 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
14317
14291
|
};
|
|
14318
14292
|
}
|
|
14319
14293
|
console.log(
|
|
14320
|
-
`[connector-request] google-slides/${connection2.name}: ${method} ${
|
|
14294
|
+
`[connector-request] google-slides/${connection2.name}: ${method} ${path5}`
|
|
14321
14295
|
);
|
|
14322
14296
|
try {
|
|
14323
14297
|
const normalizedPath = normalizeRequestPath(
|
|
14324
|
-
|
|
14298
|
+
path5,
|
|
14325
14299
|
SLIDES_BASE_PATH_SEGMENT
|
|
14326
14300
|
);
|
|
14327
14301
|
let url = `${SLIDES_BASE_URL}${normalizedPath === "/" ? "" : normalizedPath}`;
|
|
@@ -14612,7 +14586,7 @@ var requestTool11 = new ConnectorTool({
|
|
|
14612
14586
|
Authentication is handled automatically via OAuth proxy.`,
|
|
14613
14587
|
inputSchema: inputSchema34,
|
|
14614
14588
|
outputSchema: outputSchema34,
|
|
14615
|
-
async execute({ connectionId, method, path:
|
|
14589
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
14616
14590
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
14617
14591
|
if (!connection2) {
|
|
14618
14592
|
return {
|
|
@@ -14621,10 +14595,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
14621
14595
|
};
|
|
14622
14596
|
}
|
|
14623
14597
|
console.log(
|
|
14624
|
-
`[connector-request] hubspot-oauth/${connection2.name}: ${method} ${
|
|
14598
|
+
`[connector-request] hubspot-oauth/${connection2.name}: ${method} ${path5}`
|
|
14625
14599
|
);
|
|
14626
14600
|
try {
|
|
14627
|
-
let url = `${BASE_URL10}${
|
|
14601
|
+
let url = `${BASE_URL10}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
14628
14602
|
if (queryParams) {
|
|
14629
14603
|
const searchParams = new URLSearchParams(queryParams);
|
|
14630
14604
|
url += `?${searchParams.toString()}`;
|
|
@@ -14700,8 +14674,8 @@ var hubspotOnboarding = new ConnectorOnboarding({
|
|
|
14700
14674
|
|
|
14701
14675
|
// ../connectors/src/connectors/hubspot-oauth/utils.ts
|
|
14702
14676
|
var BASE_URL11 = "https://api.hubapi.com";
|
|
14703
|
-
function apiFetch2(proxyFetch,
|
|
14704
|
-
const url = `${BASE_URL11}${
|
|
14677
|
+
function apiFetch2(proxyFetch, path5, init) {
|
|
14678
|
+
const url = `${BASE_URL11}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
14705
14679
|
return proxyFetch(url, init);
|
|
14706
14680
|
}
|
|
14707
14681
|
|
|
@@ -15023,7 +14997,7 @@ var requestTool12 = new ConnectorTool({
|
|
|
15023
14997
|
Authentication is handled automatically via OAuth proxy.`,
|
|
15024
14998
|
inputSchema: inputSchema35,
|
|
15025
14999
|
outputSchema: outputSchema35,
|
|
15026
|
-
async execute({ connectionId, method, path:
|
|
15000
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
15027
15001
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
15028
15002
|
if (!connection2) {
|
|
15029
15003
|
return {
|
|
@@ -15032,10 +15006,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
15032
15006
|
};
|
|
15033
15007
|
}
|
|
15034
15008
|
console.log(
|
|
15035
|
-
`[connector-request] stripe-oauth/${connection2.name}: ${method} ${
|
|
15009
|
+
`[connector-request] stripe-oauth/${connection2.name}: ${method} ${path5}`
|
|
15036
15010
|
);
|
|
15037
15011
|
try {
|
|
15038
|
-
let url = `${BASE_URL12}${
|
|
15012
|
+
let url = `${BASE_URL12}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15039
15013
|
if (queryParams) {
|
|
15040
15014
|
const searchParams = new URLSearchParams(queryParams);
|
|
15041
15015
|
url += `?${searchParams.toString()}`;
|
|
@@ -15449,7 +15423,7 @@ Authentication is handled automatically using the configured API Key (Bearer tok
|
|
|
15449
15423
|
Use this tool for all Stripe API interactions: querying charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more.`,
|
|
15450
15424
|
inputSchema: inputSchema36,
|
|
15451
15425
|
outputSchema: outputSchema36,
|
|
15452
|
-
async execute({ connectionId, method, path:
|
|
15426
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
15453
15427
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
15454
15428
|
if (!connection2) {
|
|
15455
15429
|
return {
|
|
@@ -15458,11 +15432,11 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
|
|
|
15458
15432
|
};
|
|
15459
15433
|
}
|
|
15460
15434
|
console.log(
|
|
15461
|
-
`[connector-request] stripe-api-key/${connection2.name}: ${method} ${
|
|
15435
|
+
`[connector-request] stripe-api-key/${connection2.name}: ${method} ${path5}`
|
|
15462
15436
|
);
|
|
15463
15437
|
try {
|
|
15464
15438
|
const apiKey = parameters25.apiKey.getValue(connection2);
|
|
15465
|
-
let url = `${BASE_URL14}${
|
|
15439
|
+
let url = `${BASE_URL14}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15466
15440
|
if (queryParams) {
|
|
15467
15441
|
const searchParams = new URLSearchParams(queryParams);
|
|
15468
15442
|
url += `?${searchParams.toString()}`;
|
|
@@ -15542,12 +15516,12 @@ var stripeApiKeyOnboarding = new ConnectorOnboarding({
|
|
|
15542
15516
|
|
|
15543
15517
|
// ../connectors/src/connectors/stripe-api-key/utils.ts
|
|
15544
15518
|
var BASE_URL15 = "https://api.stripe.com";
|
|
15545
|
-
async function apiFetch3(params,
|
|
15519
|
+
async function apiFetch3(params, path5, init) {
|
|
15546
15520
|
const apiKey = params[parameters25.apiKey.slug];
|
|
15547
15521
|
if (!apiKey) {
|
|
15548
15522
|
throw new Error("stripe-api-key: missing required parameter: api-key");
|
|
15549
15523
|
}
|
|
15550
|
-
const url = `${BASE_URL15}${
|
|
15524
|
+
const url = `${BASE_URL15}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
15551
15525
|
const headers = new Headers(init?.headers);
|
|
15552
15526
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
15553
15527
|
return fetch(url, { ...init, headers });
|
|
@@ -15586,8 +15560,8 @@ var ENTITY_PATHS2 = {
|
|
|
15586
15560
|
paymentIntents: "/v1/payment_intents?limit=3"
|
|
15587
15561
|
};
|
|
15588
15562
|
var ENTITY_VALUES2 = Object.keys(ENTITY_PATHS2);
|
|
15589
|
-
async function defaultFetchEntity(params,
|
|
15590
|
-
return apiFetch3(params,
|
|
15563
|
+
async function defaultFetchEntity(params, path5) {
|
|
15564
|
+
return apiFetch3(params, path5);
|
|
15591
15565
|
}
|
|
15592
15566
|
function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "Stripe") {
|
|
15593
15567
|
return {
|
|
@@ -15921,7 +15895,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
15921
15895
|
{baseId} in the path is automatically replaced with the connection's default base ID if configured.`,
|
|
15922
15896
|
inputSchema: inputSchema37,
|
|
15923
15897
|
outputSchema: outputSchema37,
|
|
15924
|
-
async execute({ connectionId, method, path:
|
|
15898
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
15925
15899
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
15926
15900
|
if (!connection2) {
|
|
15927
15901
|
return {
|
|
@@ -15930,11 +15904,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
15930
15904
|
};
|
|
15931
15905
|
}
|
|
15932
15906
|
console.log(
|
|
15933
|
-
`[connector-request] airtable-oauth/${connection2.name}: ${method} ${
|
|
15907
|
+
`[connector-request] airtable-oauth/${connection2.name}: ${method} ${path5}`
|
|
15934
15908
|
);
|
|
15935
15909
|
try {
|
|
15936
15910
|
const baseId = parameters26.baseId.tryGetValue(connection2);
|
|
15937
|
-
const resolvedPath = baseId ?
|
|
15911
|
+
const resolvedPath = baseId ? path5.replace(/\{baseId\}/g, baseId) : path5;
|
|
15938
15912
|
let url = `${BASE_URL16}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
15939
15913
|
if (queryParams) {
|
|
15940
15914
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -16019,8 +15993,8 @@ var airtableOauthOnboarding = new ConnectorOnboarding({
|
|
|
16019
15993
|
|
|
16020
15994
|
// ../connectors/src/connectors/airtable-oauth/utils.ts
|
|
16021
15995
|
var BASE_URL17 = "https://api.airtable.com/v0";
|
|
16022
|
-
function apiFetch4(proxyFetch,
|
|
16023
|
-
const url = `${BASE_URL17}${
|
|
15996
|
+
function apiFetch4(proxyFetch, path5, init) {
|
|
15997
|
+
const url = `${BASE_URL17}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
16024
15998
|
return proxyFetch(url, init);
|
|
16025
15999
|
}
|
|
16026
16000
|
|
|
@@ -16359,7 +16333,7 @@ var parameters27 = {
|
|
|
16359
16333
|
};
|
|
16360
16334
|
|
|
16361
16335
|
// ../connectors/src/connectors/kintone/utils.ts
|
|
16362
|
-
async function apiFetch5(params,
|
|
16336
|
+
async function apiFetch5(params, path5, init) {
|
|
16363
16337
|
const baseUrl = params[parameters27.baseUrl.slug];
|
|
16364
16338
|
const username = params[parameters27.username.slug];
|
|
16365
16339
|
const password = params[parameters27.password.slug];
|
|
@@ -16369,7 +16343,7 @@ async function apiFetch5(params, path6, init) {
|
|
|
16369
16343
|
);
|
|
16370
16344
|
}
|
|
16371
16345
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
16372
|
-
const normalizedPath =
|
|
16346
|
+
const normalizedPath = path5.replace(/^\/+/, "");
|
|
16373
16347
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${normalizedPath}`;
|
|
16374
16348
|
const headers = new Headers(init?.headers);
|
|
16375
16349
|
headers.set("X-Cybozu-Authorization", authToken);
|
|
@@ -16583,18 +16557,18 @@ var requestTool15 = new ConnectorTool({
|
|
|
16583
16557
|
Authentication is handled automatically using username and password.`,
|
|
16584
16558
|
inputSchema: inputSchema38,
|
|
16585
16559
|
outputSchema: outputSchema38,
|
|
16586
|
-
async execute({ connectionId, method, path:
|
|
16560
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
16587
16561
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
16588
16562
|
if (!connection2) {
|
|
16589
16563
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
16590
16564
|
}
|
|
16591
|
-
console.log(`[connector-request] kintone/${connection2.name}: ${method} ${
|
|
16565
|
+
console.log(`[connector-request] kintone/${connection2.name}: ${method} ${path5}`);
|
|
16592
16566
|
try {
|
|
16593
16567
|
const baseUrl = parameters27.baseUrl.getValue(connection2);
|
|
16594
16568
|
const username = parameters27.username.getValue(connection2);
|
|
16595
16569
|
const password = parameters27.password.getValue(connection2);
|
|
16596
16570
|
const authToken = Buffer.from(`${username}:${password}`).toString("base64");
|
|
16597
|
-
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${
|
|
16571
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path5}`;
|
|
16598
16572
|
const controller = new AbortController();
|
|
16599
16573
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS26);
|
|
16600
16574
|
try {
|
|
@@ -16899,7 +16873,7 @@ var parameters28 = {
|
|
|
16899
16873
|
};
|
|
16900
16874
|
|
|
16901
16875
|
// ../connectors/src/connectors/kintone-api-token/utils.ts
|
|
16902
|
-
async function apiFetch6(params,
|
|
16876
|
+
async function apiFetch6(params, path5, init) {
|
|
16903
16877
|
const baseUrl = params[parameters28.baseUrl.slug];
|
|
16904
16878
|
const apiToken = params[parameters28.apiToken.slug];
|
|
16905
16879
|
if (!baseUrl || !apiToken) {
|
|
@@ -16907,7 +16881,7 @@ async function apiFetch6(params, path6, init) {
|
|
|
16907
16881
|
"kintone-api-token: missing required parameter(s): base-url, api-token"
|
|
16908
16882
|
);
|
|
16909
16883
|
}
|
|
16910
|
-
const normalizedPath =
|
|
16884
|
+
const normalizedPath = path5.replace(/^\/+/, "");
|
|
16911
16885
|
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${normalizedPath}`;
|
|
16912
16886
|
const headers = new Headers(init?.headers);
|
|
16913
16887
|
headers.set("X-Cybozu-API-Token", apiToken);
|
|
@@ -17020,8 +16994,8 @@ var APP_PARAM_KEY_BY_ENDPOINT = {
|
|
|
17020
16994
|
"app.json": "id"
|
|
17021
16995
|
};
|
|
17022
16996
|
var DEFAULT_APP_PARAM_KEY = "app";
|
|
17023
|
-
function injectAppIntoPath(
|
|
17024
|
-
const [head, query = ""] =
|
|
16997
|
+
function injectAppIntoPath(path5, appId) {
|
|
16998
|
+
const [head, query = ""] = path5.split("?", 2);
|
|
17025
16999
|
const endpoint = head.toLowerCase();
|
|
17026
17000
|
const paramKey = APP_PARAM_KEY_BY_ENDPOINT[endpoint] ?? DEFAULT_APP_PARAM_KEY;
|
|
17027
17001
|
const params = new URLSearchParams(query);
|
|
@@ -17062,17 +17036,17 @@ var requestTool16 = new ConnectorTool({
|
|
|
17062
17036
|
Authentication is handled automatically using the API token.`,
|
|
17063
17037
|
inputSchema: inputSchema39,
|
|
17064
17038
|
outputSchema: outputSchema39,
|
|
17065
|
-
async execute({ connectionId, method, path:
|
|
17039
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
17066
17040
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
17067
17041
|
if (!connection2) {
|
|
17068
17042
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
17069
17043
|
}
|
|
17070
|
-
console.log(`[connector-request] kintone-api-token/${connection2.name}: ${method} ${
|
|
17044
|
+
console.log(`[connector-request] kintone-api-token/${connection2.name}: ${method} ${path5}`);
|
|
17071
17045
|
try {
|
|
17072
17046
|
const baseUrl = parameters28.baseUrl.getValue(connection2);
|
|
17073
17047
|
const apiToken = parameters28.apiToken.getValue(connection2);
|
|
17074
17048
|
const appId = parameters28.appId.getValue(connection2);
|
|
17075
|
-
const normalizedPath =
|
|
17049
|
+
const normalizedPath = path5.replace(/^\/+/, "");
|
|
17076
17050
|
const pathHead = normalizedPath.split("?")[0] ?? "";
|
|
17077
17051
|
if (/^apps\.json$/i.test(pathHead)) {
|
|
17078
17052
|
return {
|
|
@@ -17289,8 +17263,8 @@ export default async function handler(c: Context) {
|
|
|
17289
17263
|
};
|
|
17290
17264
|
}
|
|
17291
17265
|
try {
|
|
17292
|
-
const
|
|
17293
|
-
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${
|
|
17266
|
+
const path5 = appId ? `app.json?id=${encodeURIComponent(appId)}` : `app/form/fields.json?app=0`;
|
|
17267
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path5}`;
|
|
17294
17268
|
const res = await fetch(url, {
|
|
17295
17269
|
method: "GET",
|
|
17296
17270
|
headers: {
|
|
@@ -17371,7 +17345,7 @@ var parameters29 = {
|
|
|
17371
17345
|
|
|
17372
17346
|
// ../connectors/src/connectors/wix-store/utils.ts
|
|
17373
17347
|
var BASE_URL18 = "https://www.wixapis.com";
|
|
17374
|
-
async function apiFetch7(params,
|
|
17348
|
+
async function apiFetch7(params, path5, init) {
|
|
17375
17349
|
const apiKey = params[parameters29.apiKey.slug];
|
|
17376
17350
|
const siteId = params[parameters29.siteId.slug];
|
|
17377
17351
|
if (!apiKey || !siteId) {
|
|
@@ -17379,7 +17353,7 @@ async function apiFetch7(params, path6, init) {
|
|
|
17379
17353
|
"wix-store: missing required parameters: api-key and site-id"
|
|
17380
17354
|
);
|
|
17381
17355
|
}
|
|
17382
|
-
const url = `${BASE_URL18}${
|
|
17356
|
+
const url = `${BASE_URL18}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
17383
17357
|
const headers = new Headers(init?.headers);
|
|
17384
17358
|
headers.set("Authorization", apiKey);
|
|
17385
17359
|
headers.set("wix-site-id", siteId);
|
|
@@ -17425,8 +17399,8 @@ var QUERY_SPECS = {
|
|
|
17425
17399
|
totalField: "totalResults"
|
|
17426
17400
|
}
|
|
17427
17401
|
};
|
|
17428
|
-
function lookupNumeric(data,
|
|
17429
|
-
const parts =
|
|
17402
|
+
function lookupNumeric(data, path5) {
|
|
17403
|
+
const parts = path5.split(".");
|
|
17430
17404
|
let cur = data;
|
|
17431
17405
|
for (const p of parts) {
|
|
17432
17406
|
if (!cur || typeof cur !== "object") return void 0;
|
|
@@ -17508,16 +17482,16 @@ var requestTool17 = new ConnectorTool({
|
|
|
17508
17482
|
Authentication is handled automatically using the API Key and Site ID.`,
|
|
17509
17483
|
inputSchema: inputSchema40,
|
|
17510
17484
|
outputSchema: outputSchema40,
|
|
17511
|
-
async execute({ connectionId, method, path:
|
|
17485
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
17512
17486
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
17513
17487
|
if (!connection2) {
|
|
17514
17488
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
17515
17489
|
}
|
|
17516
|
-
console.log(`[connector-request] wix-store/${connection2.name}: ${method} ${
|
|
17490
|
+
console.log(`[connector-request] wix-store/${connection2.name}: ${method} ${path5}`);
|
|
17517
17491
|
try {
|
|
17518
17492
|
const apiKey = parameters29.apiKey.getValue(connection2);
|
|
17519
17493
|
const siteId = parameters29.siteId.getValue(connection2);
|
|
17520
|
-
const url = `${BASE_URL19}${
|
|
17494
|
+
const url = `${BASE_URL19}${path5}`;
|
|
17521
17495
|
const controller = new AbortController();
|
|
17522
17496
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS28);
|
|
17523
17497
|
try {
|
|
@@ -17815,7 +17789,7 @@ function adminApiBase(host) {
|
|
|
17815
17789
|
}
|
|
17816
17790
|
return `https://${trimmed}`;
|
|
17817
17791
|
}
|
|
17818
|
-
function adminApiFetch(params,
|
|
17792
|
+
function adminApiFetch(params, path5, init) {
|
|
17819
17793
|
const host = params[parameters30.host.slug];
|
|
17820
17794
|
const token = params[parameters30.token.slug];
|
|
17821
17795
|
if (!host) {
|
|
@@ -17824,7 +17798,7 @@ function adminApiFetch(params, path6, init) {
|
|
|
17824
17798
|
if (!token) {
|
|
17825
17799
|
throw new Error(`dbt: missing required parameter: ${parameters30.token.slug}`);
|
|
17826
17800
|
}
|
|
17827
|
-
const trimmedPath =
|
|
17801
|
+
const trimmedPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
17828
17802
|
const headers = new Headers(init?.headers);
|
|
17829
17803
|
headers.set("Authorization", `Token ${token}`);
|
|
17830
17804
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -17913,8 +17887,8 @@ async function fetchRecentRunCount(params, projectId2) {
|
|
|
17913
17887
|
const accountId = params[parameters30.accountId.slug];
|
|
17914
17888
|
if (!accountId) return null;
|
|
17915
17889
|
try {
|
|
17916
|
-
const
|
|
17917
|
-
const res = await adminApiFetch(params,
|
|
17890
|
+
const path5 = `/api/v2/accounts/${encodeURIComponent(accountId)}/runs/?project_id=${encodeURIComponent(projectId2)}&limit=1&order_by=-id`;
|
|
17891
|
+
const res = await adminApiFetch(params, path5);
|
|
17918
17892
|
if (!res.ok) return null;
|
|
17919
17893
|
const data = await res.json();
|
|
17920
17894
|
const total = data.extra?.pagination?.total_count;
|
|
@@ -18165,11 +18139,11 @@ function classifyByTags(tags) {
|
|
|
18165
18139
|
function classifyModel(m) {
|
|
18166
18140
|
const fromTags = classifyByTags(m.tags ?? []);
|
|
18167
18141
|
if (fromTags) return fromTags;
|
|
18168
|
-
const
|
|
18169
|
-
if (
|
|
18170
|
-
if (MART_PATH_RE.test(
|
|
18171
|
-
if (INT_PATH_RE.test(
|
|
18172
|
-
if (STG_PATH_RE.test(
|
|
18142
|
+
const path5 = (m.filePath ?? "").toLowerCase();
|
|
18143
|
+
if (path5) {
|
|
18144
|
+
if (MART_PATH_RE.test(path5)) return "mart";
|
|
18145
|
+
if (INT_PATH_RE.test(path5)) return "intermediate";
|
|
18146
|
+
if (STG_PATH_RE.test(path5)) return "staging";
|
|
18173
18147
|
}
|
|
18174
18148
|
const name = (m.name ?? "").toLowerCase();
|
|
18175
18149
|
if (MART_NAME_RE.test(name)) return "mart";
|
|
@@ -19525,7 +19499,7 @@ function getBaseUrl(params) {
|
|
|
19525
19499
|
const region = params[parameters35.region.slug];
|
|
19526
19500
|
return region === "eu" ? "https://analytics.eu.amplitude.com" : "https://amplitude.com";
|
|
19527
19501
|
}
|
|
19528
|
-
async function apiFetch8(params,
|
|
19502
|
+
async function apiFetch8(params, path5, init) {
|
|
19529
19503
|
const apiKey = params[parameters35.apiKey.slug];
|
|
19530
19504
|
const secretKey = params[parameters35.secretKey.slug];
|
|
19531
19505
|
if (!apiKey || !secretKey) {
|
|
@@ -19533,7 +19507,7 @@ async function apiFetch8(params, path6, init) {
|
|
|
19533
19507
|
"amplitude: missing required parameters: api-key and secret-key"
|
|
19534
19508
|
);
|
|
19535
19509
|
}
|
|
19536
|
-
const url = `${getBaseUrl(params)}${
|
|
19510
|
+
const url = `${getBaseUrl(params)}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
19537
19511
|
const headers = new Headers(init?.headers);
|
|
19538
19512
|
headers.set("Authorization", `Basic ${btoa(`${apiKey}:${secretKey}`)}`);
|
|
19539
19513
|
return fetch(url, { ...init, headers });
|
|
@@ -19939,12 +19913,12 @@ var parameters36 = {
|
|
|
19939
19913
|
|
|
19940
19914
|
// ../connectors/src/connectors/attio/utils.ts
|
|
19941
19915
|
var BASE_URL20 = "https://api.attio.com/v2";
|
|
19942
|
-
async function apiFetch9(params,
|
|
19916
|
+
async function apiFetch9(params, path5, init) {
|
|
19943
19917
|
const apiKey = params[parameters36.apiKey.slug];
|
|
19944
19918
|
if (!apiKey) {
|
|
19945
19919
|
throw new Error("attio: missing required parameter: api-key");
|
|
19946
19920
|
}
|
|
19947
|
-
const url = `${BASE_URL20}${
|
|
19921
|
+
const url = `${BASE_URL20}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
19948
19922
|
const headers = new Headers(init?.headers);
|
|
19949
19923
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
19950
19924
|
headers.set("Accept", "application/json");
|
|
@@ -20085,7 +20059,7 @@ Use this tool for every Attio API interaction, including: querying records (peop
|
|
|
20085
20059
|
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.`,
|
|
20086
20060
|
inputSchema: inputSchema44,
|
|
20087
20061
|
outputSchema: outputSchema44,
|
|
20088
|
-
async execute({ connectionId, method, path:
|
|
20062
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
20089
20063
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
20090
20064
|
if (!connection2) {
|
|
20091
20065
|
return {
|
|
@@ -20094,11 +20068,11 @@ Record queries use POST /objects/{object}/records/query with a JSON body contain
|
|
|
20094
20068
|
};
|
|
20095
20069
|
}
|
|
20096
20070
|
console.log(
|
|
20097
|
-
`[connector-request] attio/${connection2.name}: ${method} ${
|
|
20071
|
+
`[connector-request] attio/${connection2.name}: ${method} ${path5}`
|
|
20098
20072
|
);
|
|
20099
20073
|
try {
|
|
20100
20074
|
const apiKey = parameters36.apiKey.getValue(connection2);
|
|
20101
|
-
const url = `${BASE_URL21}${
|
|
20075
|
+
const url = `${BASE_URL21}${path5}`;
|
|
20102
20076
|
const controller = new AbortController();
|
|
20103
20077
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS31);
|
|
20104
20078
|
try {
|
|
@@ -20554,9 +20528,9 @@ async function getAccessToken3(params) {
|
|
|
20554
20528
|
}
|
|
20555
20529
|
return data.access_token;
|
|
20556
20530
|
}
|
|
20557
|
-
async function apiFetch10(params,
|
|
20531
|
+
async function apiFetch10(params, path5, init) {
|
|
20558
20532
|
const token = await getAccessToken3(params);
|
|
20559
|
-
const url = `${getStoreBaseUrl(params)}${
|
|
20533
|
+
const url = `${getStoreBaseUrl(params)}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
20560
20534
|
const headers = new Headers(init?.headers);
|
|
20561
20535
|
headers.set("X-Shopify-Access-Token", token);
|
|
20562
20536
|
if (!headers.has("Content-Type")) {
|
|
@@ -20591,8 +20565,8 @@ var COUNT_PATHS = {
|
|
|
20591
20565
|
inventory: null,
|
|
20592
20566
|
discounts: `/admin/api/${SHOPIFY_API_VERSION}/price_rules/count.json`
|
|
20593
20567
|
};
|
|
20594
|
-
async function defaultFetchCount(params,
|
|
20595
|
-
return apiFetch10(params,
|
|
20568
|
+
async function defaultFetchCount(params, path5) {
|
|
20569
|
+
return apiFetch10(params, path5);
|
|
20596
20570
|
}
|
|
20597
20571
|
function createShopifySetupFlow(fetchCount5 = defaultFetchCount, labelPrefix = "Shopify") {
|
|
20598
20572
|
return {
|
|
@@ -20623,10 +20597,10 @@ function createShopifySetupFlow(fetchCount5 = defaultFetchCount, labelPrefix = "
|
|
|
20623
20597
|
).slice(0, SHOPIFY_SETUP_MAX_ENTITIES);
|
|
20624
20598
|
const sections = [`## ${labelPrefix}`, ""];
|
|
20625
20599
|
for (const entity of selected) {
|
|
20626
|
-
const
|
|
20600
|
+
const path5 = COUNT_PATHS[entity];
|
|
20627
20601
|
let count = "available";
|
|
20628
|
-
if (
|
|
20629
|
-
const res = await fetchCount5(rt.params,
|
|
20602
|
+
if (path5) {
|
|
20603
|
+
const res = await fetchCount5(rt.params, path5);
|
|
20630
20604
|
if (res.ok) {
|
|
20631
20605
|
const data = await res.json();
|
|
20632
20606
|
if (typeof data.count === "number") count = String(data.count);
|
|
@@ -20676,7 +20650,7 @@ The store domain is resolved from the connection \u2014 only provide the path st
|
|
|
20676
20650
|
Use this tool for all Shopify API interactions: listing products, orders, customers, inventory, collections, and more.`,
|
|
20677
20651
|
inputSchema: inputSchema45,
|
|
20678
20652
|
outputSchema: outputSchema45,
|
|
20679
|
-
async execute({ connectionId, method, path:
|
|
20653
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
20680
20654
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
20681
20655
|
if (!connection2) {
|
|
20682
20656
|
return {
|
|
@@ -20685,7 +20659,7 @@ Use this tool for all Shopify API interactions: listing products, orders, custom
|
|
|
20685
20659
|
};
|
|
20686
20660
|
}
|
|
20687
20661
|
console.log(
|
|
20688
|
-
`[connector-request] shopify/${connection2.name}: ${method} ${
|
|
20662
|
+
`[connector-request] shopify/${connection2.name}: ${method} ${path5}`
|
|
20689
20663
|
);
|
|
20690
20664
|
try {
|
|
20691
20665
|
const storeDomain = parameters37.storeDomain.getValue(connection2);
|
|
@@ -20717,7 +20691,7 @@ Use this tool for all Shopify API interactions: listing products, orders, custom
|
|
|
20717
20691
|
error: "access_token not found in token response"
|
|
20718
20692
|
};
|
|
20719
20693
|
}
|
|
20720
|
-
const url = `https://${storeDomain}${
|
|
20694
|
+
const url = `https://${storeDomain}${path5}`;
|
|
20721
20695
|
const controller = new AbortController();
|
|
20722
20696
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS32);
|
|
20723
20697
|
try {
|
|
@@ -21032,7 +21006,7 @@ var requestTool22 = new ConnectorTool({
|
|
|
21032
21006
|
Authentication is handled automatically via OAuth proxy.`,
|
|
21033
21007
|
inputSchema: inputSchema46,
|
|
21034
21008
|
outputSchema: outputSchema46,
|
|
21035
|
-
async execute({ connectionId, method, path:
|
|
21009
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
21036
21010
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
21037
21011
|
if (!connection2) {
|
|
21038
21012
|
return {
|
|
@@ -21041,10 +21015,10 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
21041
21015
|
};
|
|
21042
21016
|
}
|
|
21043
21017
|
console.log(
|
|
21044
|
-
`[connector-request] shopify-oauth/${connection2.name}: ${method} ${
|
|
21018
|
+
`[connector-request] shopify-oauth/${connection2.name}: ${method} ${path5}`
|
|
21045
21019
|
);
|
|
21046
21020
|
try {
|
|
21047
|
-
let url =
|
|
21021
|
+
let url = path5;
|
|
21048
21022
|
if (queryParams) {
|
|
21049
21023
|
const searchParams = new URLSearchParams(queryParams);
|
|
21050
21024
|
url += `${url.includes("?") ? "&" : "?"}${searchParams.toString()}`;
|
|
@@ -21179,10 +21153,10 @@ var shopifyOauthSetupFlow = {
|
|
|
21179
21153
|
sections.push("| Entity | Count |");
|
|
21180
21154
|
sections.push("|--------|-------|");
|
|
21181
21155
|
for (const entity of selected) {
|
|
21182
|
-
const
|
|
21156
|
+
const path5 = COUNT_PATHS2[entity];
|
|
21183
21157
|
let count = "available";
|
|
21184
|
-
if (
|
|
21185
|
-
const res = await rt.config.proxyFetch(
|
|
21158
|
+
if (path5) {
|
|
21159
|
+
const res = await rt.config.proxyFetch(path5, { method: "GET" });
|
|
21186
21160
|
if (res.ok) {
|
|
21187
21161
|
const data = await res.json();
|
|
21188
21162
|
if (typeof data.count === "number") count = String(data.count);
|
|
@@ -21395,12 +21369,12 @@ var parameters39 = {
|
|
|
21395
21369
|
|
|
21396
21370
|
// ../connectors/src/connectors/hubspot/utils.ts
|
|
21397
21371
|
var BASE_URL22 = "https://api.hubapi.com";
|
|
21398
|
-
async function apiFetch11(params,
|
|
21372
|
+
async function apiFetch11(params, path5, init) {
|
|
21399
21373
|
const apiKey = params[parameters39.apiKey.slug];
|
|
21400
21374
|
if (!apiKey) {
|
|
21401
21375
|
throw new Error("hubspot: missing required parameter: api-key");
|
|
21402
21376
|
}
|
|
21403
|
-
const url = `${BASE_URL22}${
|
|
21377
|
+
const url = `${BASE_URL22}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
21404
21378
|
const headers = new Headers(init?.headers);
|
|
21405
21379
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
21406
21380
|
headers.set("Accept", "application/json");
|
|
@@ -21541,7 +21515,7 @@ Use this tool for all HubSpot API interactions: querying contacts, deals, compan
|
|
|
21541
21515
|
Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex queries with filters.`,
|
|
21542
21516
|
inputSchema: inputSchema47,
|
|
21543
21517
|
outputSchema: outputSchema47,
|
|
21544
|
-
async execute({ connectionId, method, path:
|
|
21518
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
21545
21519
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
21546
21520
|
if (!connection2) {
|
|
21547
21521
|
return {
|
|
@@ -21550,11 +21524,11 @@ Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex q
|
|
|
21550
21524
|
};
|
|
21551
21525
|
}
|
|
21552
21526
|
console.log(
|
|
21553
|
-
`[connector-request] hubspot/${connection2.name}: ${method} ${
|
|
21527
|
+
`[connector-request] hubspot/${connection2.name}: ${method} ${path5}`
|
|
21554
21528
|
);
|
|
21555
21529
|
try {
|
|
21556
21530
|
const apiKey = parameters39.apiKey.getValue(connection2);
|
|
21557
|
-
const url = `${BASE_URL23}${
|
|
21531
|
+
const url = `${BASE_URL23}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
21558
21532
|
const controller = new AbortController();
|
|
21559
21533
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS34);
|
|
21560
21534
|
try {
|
|
@@ -21812,7 +21786,7 @@ var parameters40 = {
|
|
|
21812
21786
|
};
|
|
21813
21787
|
|
|
21814
21788
|
// ../connectors/src/connectors/jira/utils.ts
|
|
21815
|
-
async function apiFetch12(params,
|
|
21789
|
+
async function apiFetch12(params, path5, init) {
|
|
21816
21790
|
const instanceUrl = params[parameters40.instanceUrl.slug];
|
|
21817
21791
|
const email = params[parameters40.email.slug];
|
|
21818
21792
|
const apiToken = params[parameters40.apiToken.slug];
|
|
@@ -21826,7 +21800,7 @@ async function apiFetch12(params, path6, init) {
|
|
|
21826
21800
|
throw new Error("jira: missing required parameter: api-token");
|
|
21827
21801
|
}
|
|
21828
21802
|
const credentials = Buffer.from(`${email}:${apiToken}`).toString("base64");
|
|
21829
|
-
const trimmedPath =
|
|
21803
|
+
const trimmedPath = path5.replace(/^\/+/, "");
|
|
21830
21804
|
const url = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${trimmedPath}`;
|
|
21831
21805
|
const headers = new Headers(init?.headers);
|
|
21832
21806
|
headers.set("Authorization", `Basic ${credentials}`);
|
|
@@ -22012,17 +21986,17 @@ Use this tool for all Jira operations: listing projects, searching issues with J
|
|
|
22012
21986
|
The base URL and authentication credentials are configured per connection \u2014 only specify the API path relative to /rest/api/3/.`,
|
|
22013
21987
|
inputSchema: inputSchema48,
|
|
22014
21988
|
outputSchema: outputSchema48,
|
|
22015
|
-
async execute({ connectionId, method, path:
|
|
21989
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
22016
21990
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
22017
21991
|
if (!connection2) {
|
|
22018
21992
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
22019
21993
|
}
|
|
22020
|
-
console.log(`[connector-request] jira-api-key/${connection2.name}: ${method} ${
|
|
21994
|
+
console.log(`[connector-request] jira-api-key/${connection2.name}: ${method} ${path5}`);
|
|
22021
21995
|
try {
|
|
22022
21996
|
const instanceUrl = parameters40.instanceUrl.getValue(connection2);
|
|
22023
21997
|
const email = parameters40.email.getValue(connection2);
|
|
22024
21998
|
const apiToken = parameters40.apiToken.getValue(connection2);
|
|
22025
|
-
const baseUrl = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${
|
|
21999
|
+
const baseUrl = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${path5}`;
|
|
22026
22000
|
const credentials = Buffer.from(`${email}:${apiToken}`).toString("base64");
|
|
22027
22001
|
const controller = new AbortController();
|
|
22028
22002
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS35);
|
|
@@ -22741,12 +22715,12 @@ var parameters42 = {
|
|
|
22741
22715
|
|
|
22742
22716
|
// ../connectors/src/connectors/asana/utils.ts
|
|
22743
22717
|
var BASE_URL26 = "https://app.asana.com/api/1.0";
|
|
22744
|
-
async function apiFetch13(params,
|
|
22718
|
+
async function apiFetch13(params, path5, init) {
|
|
22745
22719
|
const token = params[parameters42.personalAccessToken.slug];
|
|
22746
22720
|
if (!token) {
|
|
22747
22721
|
throw new Error("asana: missing required parameter: personal-access-token");
|
|
22748
22722
|
}
|
|
22749
|
-
const url = `${BASE_URL26}${
|
|
22723
|
+
const url = `${BASE_URL26}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
22750
22724
|
const headers = new Headers(init?.headers);
|
|
22751
22725
|
headers.set("Authorization", `Bearer ${token}`);
|
|
22752
22726
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -22941,7 +22915,7 @@ Common endpoints:
|
|
|
22941
22915
|
Pagination: Use limit (1-100) and offset query parameters. The response includes next_page.offset for the next page.`,
|
|
22942
22916
|
inputSchema: inputSchema50,
|
|
22943
22917
|
outputSchema: outputSchema50,
|
|
22944
|
-
async execute({ connectionId, method, path:
|
|
22918
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
22945
22919
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
22946
22920
|
if (!connection2) {
|
|
22947
22921
|
return {
|
|
@@ -22950,11 +22924,11 @@ Pagination: Use limit (1-100) and offset query parameters. The response includes
|
|
|
22950
22924
|
};
|
|
22951
22925
|
}
|
|
22952
22926
|
console.log(
|
|
22953
|
-
`[connector-request] asana/${connection2.name}: ${method} ${
|
|
22927
|
+
`[connector-request] asana/${connection2.name}: ${method} ${path5}`
|
|
22954
22928
|
);
|
|
22955
22929
|
try {
|
|
22956
22930
|
const token = parameters42.personalAccessToken.getValue(connection2);
|
|
22957
|
-
const normalizedPath = normalizeRequestPath(
|
|
22931
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT5);
|
|
22958
22932
|
const url = `${BASE_URL27}${normalizedPath}`;
|
|
22959
22933
|
const controller = new AbortController();
|
|
22960
22934
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS37);
|
|
@@ -24250,12 +24224,12 @@ var parameters45 = {
|
|
|
24250
24224
|
// ../connectors/src/connectors/notion/utils.ts
|
|
24251
24225
|
var BASE_URL28 = "https://api.notion.com/v1";
|
|
24252
24226
|
var NOTION_VERSION = "2022-06-28";
|
|
24253
|
-
async function apiFetch14(params,
|
|
24227
|
+
async function apiFetch14(params, path5, init) {
|
|
24254
24228
|
const apiKey = params[parameters45.apiKey.slug];
|
|
24255
24229
|
if (!apiKey) {
|
|
24256
24230
|
throw new Error("notion: missing required parameter: api-key");
|
|
24257
24231
|
}
|
|
24258
|
-
const url = `${BASE_URL28}${
|
|
24232
|
+
const url = `${BASE_URL28}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24259
24233
|
const headers = new Headers(init?.headers);
|
|
24260
24234
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
24261
24235
|
headers.set("Notion-Version", NOTION_VERSION);
|
|
@@ -24490,7 +24464,7 @@ Use this tool for all Notion API interactions: searching pages/databases, queryi
|
|
|
24490
24464
|
Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
24491
24465
|
inputSchema: inputSchema55,
|
|
24492
24466
|
outputSchema: outputSchema55,
|
|
24493
|
-
async execute({ connectionId, method, path:
|
|
24467
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
24494
24468
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
24495
24469
|
if (!connection2) {
|
|
24496
24470
|
return {
|
|
@@ -24499,11 +24473,11 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
24499
24473
|
};
|
|
24500
24474
|
}
|
|
24501
24475
|
console.log(
|
|
24502
|
-
`[connector-request] notion/${connection2.name}: ${method} ${
|
|
24476
|
+
`[connector-request] notion/${connection2.name}: ${method} ${path5}`
|
|
24503
24477
|
);
|
|
24504
24478
|
try {
|
|
24505
24479
|
const apiKey = parameters45.apiKey.getValue(connection2);
|
|
24506
|
-
const url = `${BASE_URL29}${
|
|
24480
|
+
const url = `${BASE_URL29}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24507
24481
|
const controller = new AbortController();
|
|
24508
24482
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS38);
|
|
24509
24483
|
try {
|
|
@@ -24790,7 +24764,7 @@ Use this tool for all Notion API interactions: searching pages/databases, queryi
|
|
|
24790
24764
|
Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
24791
24765
|
inputSchema: inputSchema56,
|
|
24792
24766
|
outputSchema: outputSchema56,
|
|
24793
|
-
async execute({ connectionId, method, path:
|
|
24767
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
24794
24768
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
24795
24769
|
if (!connection2) {
|
|
24796
24770
|
return {
|
|
@@ -24799,10 +24773,10 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
24799
24773
|
};
|
|
24800
24774
|
}
|
|
24801
24775
|
console.log(
|
|
24802
|
-
`[connector-request] notion-oauth/${connection2.name}: ${method} ${
|
|
24776
|
+
`[connector-request] notion-oauth/${connection2.name}: ${method} ${path5}`
|
|
24803
24777
|
);
|
|
24804
24778
|
try {
|
|
24805
|
-
const url = `${BASE_URL30}${
|
|
24779
|
+
const url = `${BASE_URL30}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24806
24780
|
const token = await getProxyToken19(config.oauthProxy);
|
|
24807
24781
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
24808
24782
|
const controller = new AbortController();
|
|
@@ -24881,8 +24855,8 @@ var parameters46 = {};
|
|
|
24881
24855
|
// ../connectors/src/connectors/notion-oauth/utils.ts
|
|
24882
24856
|
var BASE_URL31 = "https://api.notion.com/v1";
|
|
24883
24857
|
var NOTION_VERSION4 = "2022-06-28";
|
|
24884
|
-
function apiFetch15(proxyFetch,
|
|
24885
|
-
const url = `${BASE_URL31}${
|
|
24858
|
+
function apiFetch15(proxyFetch, path5, init) {
|
|
24859
|
+
const url = `${BASE_URL31}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
24886
24860
|
const headers = new Headers(init?.headers);
|
|
24887
24861
|
headers.set("Notion-Version", NOTION_VERSION4);
|
|
24888
24862
|
if (init?.body && !headers.has("Content-Type")) {
|
|
@@ -25323,13 +25297,13 @@ var metaAdsOnboarding = new ConnectorOnboarding({
|
|
|
25323
25297
|
|
|
25324
25298
|
// ../connectors/src/connectors/meta-ads/utils.ts
|
|
25325
25299
|
var BASE_URL33 = "https://graph.facebook.com/v21.0";
|
|
25326
|
-
async function apiFetch16(params,
|
|
25300
|
+
async function apiFetch16(params, path5, init) {
|
|
25327
25301
|
const accessToken = params[parameters47.accessToken.slug];
|
|
25328
25302
|
if (!accessToken) {
|
|
25329
25303
|
throw new Error("meta-ads: missing required parameter: access-token");
|
|
25330
25304
|
}
|
|
25331
|
-
const sep =
|
|
25332
|
-
const url = `${BASE_URL33}${
|
|
25305
|
+
const sep = path5.includes("?") ? "&" : "?";
|
|
25306
|
+
const url = `${BASE_URL33}${path5.startsWith("/") ? "" : "/"}${path5}${sep}access_token=${encodeURIComponent(accessToken)}`;
|
|
25333
25307
|
return fetch(url, init);
|
|
25334
25308
|
}
|
|
25335
25309
|
|
|
@@ -25484,7 +25458,7 @@ Authentication is handled via the configured access token.
|
|
|
25484
25458
|
{adAccountId} in the path is automatically replaced with the connection's ad account ID (with act_ prefix added).`,
|
|
25485
25459
|
inputSchema: inputSchema58,
|
|
25486
25460
|
outputSchema: outputSchema58,
|
|
25487
|
-
async execute({ connectionId, method, path:
|
|
25461
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
25488
25462
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
25489
25463
|
if (!connection2) {
|
|
25490
25464
|
return {
|
|
@@ -25493,12 +25467,12 @@ Authentication is handled via the configured access token.
|
|
|
25493
25467
|
};
|
|
25494
25468
|
}
|
|
25495
25469
|
console.log(
|
|
25496
|
-
`[connector-request] meta-ads/${connection2.name}: ${method} ${
|
|
25470
|
+
`[connector-request] meta-ads/${connection2.name}: ${method} ${path5}`
|
|
25497
25471
|
);
|
|
25498
25472
|
try {
|
|
25499
25473
|
const accessToken = parameters47.accessToken.getValue(connection2);
|
|
25500
25474
|
const adAccountId = parameters47.adAccountId.tryGetValue(connection2) ?? "";
|
|
25501
|
-
const resolvedPath = adAccountId ?
|
|
25475
|
+
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
25502
25476
|
let url = `${BASE_URL34}${resolvedPath}`;
|
|
25503
25477
|
const params = new URLSearchParams(queryParams ?? {});
|
|
25504
25478
|
params.set("access_token", accessToken);
|
|
@@ -26048,7 +26022,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
26048
26022
|
{adAccountId} in the path is automatically replaced with the connection's ad account ID.`,
|
|
26049
26023
|
inputSchema: inputSchema60,
|
|
26050
26024
|
outputSchema: outputSchema60,
|
|
26051
|
-
async execute({ connectionId, method, path:
|
|
26025
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
26052
26026
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
26053
26027
|
if (!connection2) {
|
|
26054
26028
|
return {
|
|
@@ -26057,11 +26031,11 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
26057
26031
|
};
|
|
26058
26032
|
}
|
|
26059
26033
|
console.log(
|
|
26060
|
-
`[connector-request] meta-ads-oauth/${connection2.name}: ${method} ${
|
|
26034
|
+
`[connector-request] meta-ads-oauth/${connection2.name}: ${method} ${path5}`
|
|
26061
26035
|
);
|
|
26062
26036
|
try {
|
|
26063
26037
|
const adAccountId = parameters48.adAccountId.tryGetValue(connection2) ?? "";
|
|
26064
|
-
const resolvedPath = adAccountId ?
|
|
26038
|
+
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
26065
26039
|
let url = `${BASE_URL37}${resolvedPath}`;
|
|
26066
26040
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
26067
26041
|
const params = new URLSearchParams(queryParams);
|
|
@@ -26632,7 +26606,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
26632
26606
|
The advertiser_id is automatically injected if configured.`,
|
|
26633
26607
|
inputSchema: inputSchema62,
|
|
26634
26608
|
outputSchema: outputSchema62,
|
|
26635
|
-
async execute({ connectionId, method, path:
|
|
26609
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
26636
26610
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
26637
26611
|
if (!connection2) {
|
|
26638
26612
|
return {
|
|
@@ -26641,11 +26615,11 @@ The advertiser_id is automatically injected if configured.`,
|
|
|
26641
26615
|
};
|
|
26642
26616
|
}
|
|
26643
26617
|
console.log(
|
|
26644
|
-
`[connector-request] tiktok-ads/${connection2.name}: ${method} ${
|
|
26618
|
+
`[connector-request] tiktok-ads/${connection2.name}: ${method} ${path5}`
|
|
26645
26619
|
);
|
|
26646
26620
|
try {
|
|
26647
26621
|
const advertiserId = parameters49.advertiserId.tryGetValue(connection2) ?? "";
|
|
26648
|
-
const normalizedPath = normalizeRequestPath(
|
|
26622
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT6);
|
|
26649
26623
|
let url = `${BASE_URL40}${normalizedPath}`;
|
|
26650
26624
|
if (method === "GET") {
|
|
26651
26625
|
const params = new URLSearchParams(queryParams ?? {});
|
|
@@ -26930,14 +26904,14 @@ function extractDatacenter(apiKey) {
|
|
|
26930
26904
|
}
|
|
26931
26905
|
return dc;
|
|
26932
26906
|
}
|
|
26933
|
-
async function apiFetch17(params,
|
|
26907
|
+
async function apiFetch17(params, path5, init) {
|
|
26934
26908
|
const apiKey = params[parameters50.apiKey.slug];
|
|
26935
26909
|
if (!apiKey) {
|
|
26936
26910
|
throw new Error("mailchimp: missing required parameter: api-key");
|
|
26937
26911
|
}
|
|
26938
26912
|
const dc = extractDatacenter(apiKey);
|
|
26939
26913
|
const baseUrl = `https://${dc}.api.mailchimp.com/3.0`;
|
|
26940
|
-
const url = `${baseUrl}${
|
|
26914
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
26941
26915
|
const headers = new Headers(init?.headers);
|
|
26942
26916
|
headers.set("Authorization", `Basic ${btoa(`anystring:${apiKey}`)}`);
|
|
26943
26917
|
return fetch(url, { ...init, headers });
|
|
@@ -27070,7 +27044,7 @@ Use this tool for all Mailchimp API interactions: managing audiences/lists, camp
|
|
|
27070
27044
|
The datacenter is automatically extracted from the API key suffix.`,
|
|
27071
27045
|
inputSchema: inputSchema63,
|
|
27072
27046
|
outputSchema: outputSchema63,
|
|
27073
|
-
async execute({ connectionId, method, path:
|
|
27047
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
27074
27048
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27075
27049
|
if (!connection2) {
|
|
27076
27050
|
return {
|
|
@@ -27079,13 +27053,13 @@ The datacenter is automatically extracted from the API key suffix.`,
|
|
|
27079
27053
|
};
|
|
27080
27054
|
}
|
|
27081
27055
|
console.log(
|
|
27082
|
-
`[connector-request] mailchimp/${connection2.name}: ${method} ${
|
|
27056
|
+
`[connector-request] mailchimp/${connection2.name}: ${method} ${path5}`
|
|
27083
27057
|
);
|
|
27084
27058
|
try {
|
|
27085
27059
|
const apiKey = parameters50.apiKey.getValue(connection2);
|
|
27086
27060
|
const dc = extractDatacenter2(apiKey);
|
|
27087
27061
|
const baseUrl = `https://${dc}.api.mailchimp.com/3.0`;
|
|
27088
|
-
let url = `${baseUrl}${
|
|
27062
|
+
let url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27089
27063
|
if (queryParams) {
|
|
27090
27064
|
const searchParams = new URLSearchParams(queryParams);
|
|
27091
27065
|
url += `?${searchParams.toString()}`;
|
|
@@ -27398,7 +27372,7 @@ var parameters51 = {
|
|
|
27398
27372
|
};
|
|
27399
27373
|
|
|
27400
27374
|
// ../connectors/src/connectors/mailchimp-oauth/utils.ts
|
|
27401
|
-
function apiFetch18(params, proxyFetch,
|
|
27375
|
+
function apiFetch18(params, proxyFetch, path5, init) {
|
|
27402
27376
|
const serverPrefix = params[parameters51.serverPrefix.slug];
|
|
27403
27377
|
if (!serverPrefix) {
|
|
27404
27378
|
throw new Error(
|
|
@@ -27406,7 +27380,7 @@ function apiFetch18(params, proxyFetch, path6, init) {
|
|
|
27406
27380
|
);
|
|
27407
27381
|
}
|
|
27408
27382
|
const baseUrl = `https://${serverPrefix}.api.mailchimp.com/3.0`;
|
|
27409
|
-
const url = `${baseUrl}${
|
|
27383
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27410
27384
|
return proxyFetch(url, init);
|
|
27411
27385
|
}
|
|
27412
27386
|
|
|
@@ -27554,7 +27528,7 @@ var requestTool33 = new ConnectorTool({
|
|
|
27554
27528
|
Authentication is handled automatically via OAuth proxy.`,
|
|
27555
27529
|
inputSchema: inputSchema64,
|
|
27556
27530
|
outputSchema: outputSchema64,
|
|
27557
|
-
async execute({ connectionId, method, path:
|
|
27531
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
27558
27532
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27559
27533
|
if (!connection2) {
|
|
27560
27534
|
return {
|
|
@@ -27563,12 +27537,12 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
27563
27537
|
};
|
|
27564
27538
|
}
|
|
27565
27539
|
console.log(
|
|
27566
|
-
`[connector-request] mailchimp-oauth/${connection2.name}: ${method} ${
|
|
27540
|
+
`[connector-request] mailchimp-oauth/${connection2.name}: ${method} ${path5}`
|
|
27567
27541
|
);
|
|
27568
27542
|
try {
|
|
27569
27543
|
const serverPrefix = parameters51.serverPrefix.getValue(connection2);
|
|
27570
27544
|
const baseUrl = `https://${serverPrefix}.api.mailchimp.com/3.0`;
|
|
27571
|
-
let url = `${baseUrl}${
|
|
27545
|
+
let url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27572
27546
|
if (queryParams) {
|
|
27573
27547
|
const searchParams = new URLSearchParams(queryParams);
|
|
27574
27548
|
url += `?${searchParams.toString()}`;
|
|
@@ -27811,14 +27785,14 @@ var parameters52 = {
|
|
|
27811
27785
|
};
|
|
27812
27786
|
|
|
27813
27787
|
// ../connectors/src/connectors/customerio/utils.ts
|
|
27814
|
-
async function apiFetch19(params,
|
|
27788
|
+
async function apiFetch19(params, path5, init) {
|
|
27815
27789
|
const apiKey = params[parameters52.appApiKey.slug];
|
|
27816
27790
|
if (!apiKey) {
|
|
27817
27791
|
throw new Error("customerio: missing required parameter: app-api-key");
|
|
27818
27792
|
}
|
|
27819
27793
|
const region = params[parameters52.region.slug];
|
|
27820
27794
|
const baseUrl = region === "eu" ? "https://api-eu.customer.io" : "https://api.customer.io";
|
|
27821
|
-
const url = `${baseUrl}${
|
|
27795
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27822
27796
|
const headers = new Headers(init?.headers);
|
|
27823
27797
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
27824
27798
|
return fetch(url, { ...init, headers });
|
|
@@ -27875,10 +27849,10 @@ async function fetchEntityCount(params, entity) {
|
|
|
27875
27849
|
campaigns: "/v1/campaigns",
|
|
27876
27850
|
newsletters: "/v1/newsletters"
|
|
27877
27851
|
};
|
|
27878
|
-
const
|
|
27879
|
-
if (!
|
|
27852
|
+
const path5 = endpoint[entity];
|
|
27853
|
+
if (!path5) return "available";
|
|
27880
27854
|
try {
|
|
27881
|
-
const res = await apiFetch19(params,
|
|
27855
|
+
const res = await apiFetch19(params, path5);
|
|
27882
27856
|
if (!res.ok) return "available";
|
|
27883
27857
|
const data = await res.json();
|
|
27884
27858
|
if (typeof data.count === "number") return String(data.count);
|
|
@@ -27964,7 +27938,7 @@ Use this tool for reading customer data, managing campaigns, segments, broadcast
|
|
|
27964
27938
|
The App API is the read and management path for Customer.io data.`,
|
|
27965
27939
|
inputSchema: inputSchema65,
|
|
27966
27940
|
outputSchema: outputSchema65,
|
|
27967
|
-
async execute({ connectionId, method, path:
|
|
27941
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
27968
27942
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
27969
27943
|
if (!connection2) {
|
|
27970
27944
|
return {
|
|
@@ -27973,13 +27947,13 @@ The App API is the read and management path for Customer.io data.`,
|
|
|
27973
27947
|
};
|
|
27974
27948
|
}
|
|
27975
27949
|
console.log(
|
|
27976
|
-
`[connector-request] customerio/${connection2.name}: ${method} ${
|
|
27950
|
+
`[connector-request] customerio/${connection2.name}: ${method} ${path5}`
|
|
27977
27951
|
);
|
|
27978
27952
|
try {
|
|
27979
27953
|
const appApiKey = parameters52.appApiKey.getValue(connection2);
|
|
27980
27954
|
const region = parameters52.region.tryGetValue(connection2);
|
|
27981
27955
|
const baseUrl = getBaseUrl2(region);
|
|
27982
|
-
let url = `${baseUrl}${
|
|
27956
|
+
let url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27983
27957
|
if (queryParams) {
|
|
27984
27958
|
const searchParams = new URLSearchParams(queryParams);
|
|
27985
27959
|
url += `?${searchParams.toString()}`;
|
|
@@ -28304,7 +28278,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
28304
28278
|
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.",
|
|
28305
28279
|
inputSchema: inputSchema66,
|
|
28306
28280
|
outputSchema: outputSchema66,
|
|
28307
|
-
async execute({ connectionId, method, path:
|
|
28281
|
+
async execute({ connectionId, method, path: path5, subject, scopes, queryParams, body }, connections) {
|
|
28308
28282
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
28309
28283
|
if (!connection2) {
|
|
28310
28284
|
return {
|
|
@@ -28325,7 +28299,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
28325
28299
|
}
|
|
28326
28300
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
28327
28301
|
console.log(
|
|
28328
|
-
`[connector-request] gmail/${connection2.name}: ${method} ${
|
|
28302
|
+
`[connector-request] gmail/${connection2.name}: ${method} ${path5} subject=${subject}`
|
|
28329
28303
|
);
|
|
28330
28304
|
try {
|
|
28331
28305
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -28345,7 +28319,7 @@ var requestWithDelegationTool2 = new ConnectorTool({
|
|
|
28345
28319
|
serviceAccountEmail
|
|
28346
28320
|
};
|
|
28347
28321
|
}
|
|
28348
|
-
const normalizedPath = normalizeRequestPath(
|
|
28322
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT7);
|
|
28349
28323
|
let url = `${BASE_URL41}${normalizedPath}`;
|
|
28350
28324
|
if (queryParams) {
|
|
28351
28325
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -28908,7 +28882,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
28908
28882
|
All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me' as the userId prefix (e.g., '/me/messages').`,
|
|
28909
28883
|
inputSchema: inputSchema67,
|
|
28910
28884
|
outputSchema: outputSchema67,
|
|
28911
|
-
async execute({ connectionId, method, path:
|
|
28885
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
28912
28886
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
28913
28887
|
if (!connection2) {
|
|
28914
28888
|
return {
|
|
@@ -28917,10 +28891,10 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
28917
28891
|
};
|
|
28918
28892
|
}
|
|
28919
28893
|
console.log(
|
|
28920
|
-
`[connector-request] gmail-oauth/${connection2.name}: ${method} ${
|
|
28894
|
+
`[connector-request] gmail-oauth/${connection2.name}: ${method} ${path5}`
|
|
28921
28895
|
);
|
|
28922
28896
|
try {
|
|
28923
|
-
const normalizedPath = normalizeRequestPath(
|
|
28897
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT8);
|
|
28924
28898
|
let url = `${BASE_URL42}${normalizedPath}`;
|
|
28925
28899
|
if (queryParams) {
|
|
28926
28900
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -29362,7 +29336,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
29362
29336
|
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.",
|
|
29363
29337
|
inputSchema: inputSchema68,
|
|
29364
29338
|
outputSchema: outputSchema68,
|
|
29365
|
-
async execute({ connectionId, method, path:
|
|
29339
|
+
async execute({ connectionId, method, path: path5, subject, scopes, queryParams }, connections) {
|
|
29366
29340
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
29367
29341
|
if (!connection2) {
|
|
29368
29342
|
return {
|
|
@@ -29383,7 +29357,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
29383
29357
|
}
|
|
29384
29358
|
const serviceAccountEmail = serviceAccount.client_email;
|
|
29385
29359
|
console.log(
|
|
29386
|
-
`[connector-request] google-audit-log/${connection2.name}: ${method} ${
|
|
29360
|
+
`[connector-request] google-audit-log/${connection2.name}: ${method} ${path5} subject=${subject}`
|
|
29387
29361
|
);
|
|
29388
29362
|
try {
|
|
29389
29363
|
const { GoogleAuth } = await import("google-auth-library");
|
|
@@ -29403,7 +29377,7 @@ var requestWithDelegationTool3 = new ConnectorTool({
|
|
|
29403
29377
|
serviceAccountEmail
|
|
29404
29378
|
};
|
|
29405
29379
|
}
|
|
29406
|
-
const normalizedPath = normalizeRequestPath(
|
|
29380
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT9);
|
|
29407
29381
|
let url = `${BASE_URL43}${normalizedPath}`;
|
|
29408
29382
|
if (queryParams) {
|
|
29409
29383
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -30329,7 +30303,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
30329
30303
|
Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatically.`,
|
|
30330
30304
|
inputSchema: inputSchema70,
|
|
30331
30305
|
outputSchema: outputSchema70,
|
|
30332
|
-
async execute({ connectionId, method, path:
|
|
30306
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
30333
30307
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
30334
30308
|
if (!connection2) {
|
|
30335
30309
|
return {
|
|
@@ -30338,11 +30312,11 @@ Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatic
|
|
|
30338
30312
|
};
|
|
30339
30313
|
}
|
|
30340
30314
|
console.log(
|
|
30341
|
-
`[connector-request] linkedin-ads/${connection2.name}: ${method} ${
|
|
30315
|
+
`[connector-request] linkedin-ads/${connection2.name}: ${method} ${path5}`
|
|
30342
30316
|
);
|
|
30343
30317
|
try {
|
|
30344
30318
|
const adAccountId = parameters56.adAccountId.tryGetValue(connection2) ?? "";
|
|
30345
|
-
const resolvedPath = adAccountId ?
|
|
30319
|
+
const resolvedPath = adAccountId ? path5.replace(/\{adAccountId\}/g, adAccountId) : path5;
|
|
30346
30320
|
let url = `${BASE_URL46}${resolvedPath}`;
|
|
30347
30321
|
if (queryParams && Object.keys(queryParams).length > 0) {
|
|
30348
30322
|
const params = new URLSearchParams(queryParams);
|
|
@@ -30690,7 +30664,7 @@ function normalizeSubdomain(raw) {
|
|
|
30690
30664
|
function basicAuthHeader(email, apiToken) {
|
|
30691
30665
|
return `Basic ${Buffer.from(`${email}/token:${apiToken}`).toString("base64")}`;
|
|
30692
30666
|
}
|
|
30693
|
-
async function apiFetch20(params,
|
|
30667
|
+
async function apiFetch20(params, path5, init) {
|
|
30694
30668
|
const subdomain = params[parameters57.subdomain.slug];
|
|
30695
30669
|
const email = params[parameters57.email.slug];
|
|
30696
30670
|
const apiToken = params[parameters57.apiToken.slug];
|
|
@@ -30699,7 +30673,7 @@ async function apiFetch20(params, path6, init) {
|
|
|
30699
30673
|
"zendesk: missing required parameter(s) (subdomain, email, api-token)"
|
|
30700
30674
|
);
|
|
30701
30675
|
}
|
|
30702
|
-
const url = `https://${normalizeSubdomain(subdomain)}.zendesk.com${
|
|
30676
|
+
const url = `https://${normalizeSubdomain(subdomain)}.zendesk.com${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
30703
30677
|
const headers = new Headers(init?.headers);
|
|
30704
30678
|
headers.set("Authorization", basicAuthHeader(email, apiToken));
|
|
30705
30679
|
headers.set("Accept", "application/json");
|
|
@@ -30746,8 +30720,8 @@ async function listBrands(params) {
|
|
|
30746
30720
|
const data = await res.json();
|
|
30747
30721
|
return data.brands ?? [];
|
|
30748
30722
|
}
|
|
30749
|
-
async function fetchCount(params,
|
|
30750
|
-
const res = await apiFetch20(params,
|
|
30723
|
+
async function fetchCount(params, path5, countField) {
|
|
30724
|
+
const res = await apiFetch20(params, path5);
|
|
30751
30725
|
if (!res.ok) return null;
|
|
30752
30726
|
const data = await res.json();
|
|
30753
30727
|
const raw = data[countField];
|
|
@@ -30862,7 +30836,7 @@ Use this tool for all Zendesk API interactions: querying tickets, users, organiz
|
|
|
30862
30836
|
Zendesk uses cursor-based pagination with page[size] and page[after] parameters. All endpoints return .json suffix.`,
|
|
30863
30837
|
inputSchema: inputSchema71,
|
|
30864
30838
|
outputSchema: outputSchema71,
|
|
30865
|
-
async execute({ connectionId, method, path:
|
|
30839
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
30866
30840
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
30867
30841
|
if (!connection2) {
|
|
30868
30842
|
return {
|
|
@@ -30871,7 +30845,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
30871
30845
|
};
|
|
30872
30846
|
}
|
|
30873
30847
|
console.log(
|
|
30874
|
-
`[connector-request] zendesk/${connection2.name}: ${method} ${
|
|
30848
|
+
`[connector-request] zendesk/${connection2.name}: ${method} ${path5}`
|
|
30875
30849
|
);
|
|
30876
30850
|
try {
|
|
30877
30851
|
const subdomain = parameters57.subdomain.getValue(connection2);
|
|
@@ -30880,7 +30854,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
30880
30854
|
const authToken = Buffer.from(`${email}/token:${apiToken}`).toString(
|
|
30881
30855
|
"base64"
|
|
30882
30856
|
);
|
|
30883
|
-
const url = `https://${subdomain}.zendesk.com${
|
|
30857
|
+
const url = `https://${subdomain}.zendesk.com${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
30884
30858
|
const controller = new AbortController();
|
|
30885
30859
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS54);
|
|
30886
30860
|
try {
|
|
@@ -31204,7 +31178,7 @@ Use this tool for all Zendesk API interactions: querying tickets, users, organiz
|
|
|
31204
31178
|
Zendesk uses cursor-based pagination with page[size] and page[after] parameters. All endpoint paths end with .json.`,
|
|
31205
31179
|
inputSchema: inputSchema72,
|
|
31206
31180
|
outputSchema: outputSchema72,
|
|
31207
|
-
async execute({ connectionId, method, path:
|
|
31181
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
31208
31182
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
31209
31183
|
if (!connection2) {
|
|
31210
31184
|
return {
|
|
@@ -31213,10 +31187,10 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
31213
31187
|
};
|
|
31214
31188
|
}
|
|
31215
31189
|
console.log(
|
|
31216
|
-
`[connector-request] zendesk-oauth/${connection2.name}: ${method} ${
|
|
31190
|
+
`[connector-request] zendesk-oauth/${connection2.name}: ${method} ${path5}`
|
|
31217
31191
|
);
|
|
31218
31192
|
try {
|
|
31219
|
-
let url =
|
|
31193
|
+
let url = path5;
|
|
31220
31194
|
if (queryParams) {
|
|
31221
31195
|
const searchParams = new URLSearchParams(queryParams);
|
|
31222
31196
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -31294,8 +31268,8 @@ var zendeskOauthOnboarding = new ConnectorOnboarding({
|
|
|
31294
31268
|
});
|
|
31295
31269
|
|
|
31296
31270
|
// ../connectors/src/connectors/zendesk-oauth/utils.ts
|
|
31297
|
-
function apiFetch21(proxyFetch,
|
|
31298
|
-
const url =
|
|
31271
|
+
function apiFetch21(proxyFetch, path5, init) {
|
|
31272
|
+
const url = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
31299
31273
|
const headers = new Headers(init?.headers);
|
|
31300
31274
|
headers.set("Accept", "application/json");
|
|
31301
31275
|
return proxyFetch(url, { ...init, headers });
|
|
@@ -31336,8 +31310,8 @@ async function listBrands2(proxyFetch) {
|
|
|
31336
31310
|
const data = await res.json();
|
|
31337
31311
|
return data.brands ?? [];
|
|
31338
31312
|
}
|
|
31339
|
-
async function fetchCount2(proxyFetch,
|
|
31340
|
-
const res = await apiFetch21(proxyFetch,
|
|
31313
|
+
async function fetchCount2(proxyFetch, path5) {
|
|
31314
|
+
const res = await apiFetch21(proxyFetch, path5);
|
|
31341
31315
|
if (!res.ok) return null;
|
|
31342
31316
|
const data = await res.json();
|
|
31343
31317
|
if (typeof data["count"] === "number") return data["count"];
|
|
@@ -31652,12 +31626,12 @@ var parameters59 = {
|
|
|
31652
31626
|
// ../connectors/src/connectors/intercom/utils.ts
|
|
31653
31627
|
var BASE_URL47 = "https://api.intercom.io";
|
|
31654
31628
|
var INTERCOM_VERSION = "2.11";
|
|
31655
|
-
async function apiFetch22(params,
|
|
31629
|
+
async function apiFetch22(params, path5, init) {
|
|
31656
31630
|
const accessToken = params[parameters59.accessToken.slug];
|
|
31657
31631
|
if (!accessToken) {
|
|
31658
31632
|
throw new Error("intercom: missing required parameter: access-token");
|
|
31659
31633
|
}
|
|
31660
|
-
const url = `${BASE_URL47}${
|
|
31634
|
+
const url = `${BASE_URL47}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
31661
31635
|
const headers = new Headers(init?.headers);
|
|
31662
31636
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
31663
31637
|
headers.set("Accept", "application/json");
|
|
@@ -31678,8 +31652,8 @@ var INTERCOM_SCOPES = [
|
|
|
31678
31652
|
{ value: "articles", label: "Articles", countPath: "/articles?per_page=1" },
|
|
31679
31653
|
{ value: "teams", label: "Teams", countPath: "/teams" }
|
|
31680
31654
|
];
|
|
31681
|
-
async function fetchCount3(params,
|
|
31682
|
-
const res = await apiFetch22(params,
|
|
31655
|
+
async function fetchCount3(params, path5) {
|
|
31656
|
+
const res = await apiFetch22(params, path5);
|
|
31683
31657
|
if (!res.ok) {
|
|
31684
31658
|
return null;
|
|
31685
31659
|
}
|
|
@@ -31782,7 +31756,7 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
31782
31756
|
The Intercom-Version header is set to 2.11 automatically.`,
|
|
31783
31757
|
inputSchema: inputSchema73,
|
|
31784
31758
|
outputSchema: outputSchema73,
|
|
31785
|
-
async execute({ connectionId, method, path:
|
|
31759
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
31786
31760
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
31787
31761
|
if (!connection2) {
|
|
31788
31762
|
return {
|
|
@@ -31791,11 +31765,11 @@ The Intercom-Version header is set to 2.11 automatically.`,
|
|
|
31791
31765
|
};
|
|
31792
31766
|
}
|
|
31793
31767
|
console.log(
|
|
31794
|
-
`[connector-request] intercom/${connection2.name}: ${method} ${
|
|
31768
|
+
`[connector-request] intercom/${connection2.name}: ${method} ${path5}`
|
|
31795
31769
|
);
|
|
31796
31770
|
try {
|
|
31797
31771
|
const accessToken = parameters59.accessToken.getValue(connection2);
|
|
31798
|
-
const url = `${BASE_URL48}${
|
|
31772
|
+
const url = `${BASE_URL48}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
31799
31773
|
const controller = new AbortController();
|
|
31800
31774
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS56);
|
|
31801
31775
|
try {
|
|
@@ -32136,7 +32110,7 @@ Use this tool for all Intercom API interactions: querying contacts, conversation
|
|
|
32136
32110
|
Search endpoints (contacts/search, conversations/search) use POST with a query object in the body.`,
|
|
32137
32111
|
inputSchema: inputSchema74,
|
|
32138
32112
|
outputSchema: outputSchema74,
|
|
32139
|
-
async execute({ connectionId, method, path:
|
|
32113
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
32140
32114
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
32141
32115
|
if (!connection2) {
|
|
32142
32116
|
return {
|
|
@@ -32145,10 +32119,10 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
32145
32119
|
};
|
|
32146
32120
|
}
|
|
32147
32121
|
console.log(
|
|
32148
|
-
`[connector-request] intercom-oauth/${connection2.name}: ${method} ${
|
|
32122
|
+
`[connector-request] intercom-oauth/${connection2.name}: ${method} ${path5}`
|
|
32149
32123
|
);
|
|
32150
32124
|
try {
|
|
32151
|
-
let url = `${BASE_URL49}${
|
|
32125
|
+
let url = `${BASE_URL49}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
32152
32126
|
if (queryParams) {
|
|
32153
32127
|
const searchParams = new URLSearchParams(queryParams);
|
|
32154
32128
|
const separator = url.includes("?") ? "&" : "?";
|
|
@@ -32229,8 +32203,8 @@ var intercomOauthOnboarding = new ConnectorOnboarding({
|
|
|
32229
32203
|
// ../connectors/src/connectors/intercom-oauth/utils.ts
|
|
32230
32204
|
var BASE_URL50 = "https://api.intercom.io";
|
|
32231
32205
|
var INTERCOM_VERSION2 = "2.11";
|
|
32232
|
-
function apiFetch23(proxyFetch,
|
|
32233
|
-
const url = `${BASE_URL50}${
|
|
32206
|
+
function apiFetch23(proxyFetch, path5, init) {
|
|
32207
|
+
const url = `${BASE_URL50}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
32234
32208
|
const headers = new Headers(init?.headers);
|
|
32235
32209
|
headers.set("Accept", "application/json");
|
|
32236
32210
|
headers.set("Intercom-Version", INTERCOM_VERSION2);
|
|
@@ -32250,8 +32224,8 @@ var INTERCOM_SCOPES2 = [
|
|
|
32250
32224
|
{ value: "articles", label: "Articles", countPath: "/articles?per_page=1" },
|
|
32251
32225
|
{ value: "teams", label: "Teams", countPath: "/teams" }
|
|
32252
32226
|
];
|
|
32253
|
-
async function fetchCount4(proxyFetch,
|
|
32254
|
-
const res = await apiFetch23(proxyFetch,
|
|
32227
|
+
async function fetchCount4(proxyFetch, path5) {
|
|
32228
|
+
const res = await apiFetch23(proxyFetch, path5);
|
|
32255
32229
|
if (!res.ok) {
|
|
32256
32230
|
return null;
|
|
32257
32231
|
}
|
|
@@ -32610,7 +32584,7 @@ function getQueryBaseUrl(params) {
|
|
|
32610
32584
|
if (region === "in") return "https://in.mixpanel.com/api";
|
|
32611
32585
|
return "https://mixpanel.com/api";
|
|
32612
32586
|
}
|
|
32613
|
-
async function apiFetch24(params,
|
|
32587
|
+
async function apiFetch24(params, path5, init) {
|
|
32614
32588
|
const username = params[parameters61.serviceAccountUsername.slug];
|
|
32615
32589
|
const secret = params[parameters61.serviceAccountSecret.slug];
|
|
32616
32590
|
const projectId2 = params[parameters61.projectId.slug];
|
|
@@ -32620,7 +32594,7 @@ async function apiFetch24(params, path6, init) {
|
|
|
32620
32594
|
);
|
|
32621
32595
|
}
|
|
32622
32596
|
const base = getQueryBaseUrl(params);
|
|
32623
|
-
const url = new URL(`${base}${
|
|
32597
|
+
const url = new URL(`${base}${path5.startsWith("/") ? "" : "/"}${path5}`);
|
|
32624
32598
|
if (!url.searchParams.has("project_id")) {
|
|
32625
32599
|
url.searchParams.set("project_id", projectId2);
|
|
32626
32600
|
}
|
|
@@ -33069,14 +33043,14 @@ var parameters62 = {
|
|
|
33069
33043
|
};
|
|
33070
33044
|
|
|
33071
33045
|
// ../connectors/src/connectors/grafana/utils.ts
|
|
33072
|
-
async function apiFetch25(params,
|
|
33046
|
+
async function apiFetch25(params, path5, init) {
|
|
33073
33047
|
const apiKey = params[parameters62.apiKey.slug];
|
|
33074
33048
|
const rawUrl = params[parameters62.url.slug];
|
|
33075
33049
|
if (!apiKey || !rawUrl) {
|
|
33076
33050
|
throw new Error("grafana: missing required parameters: url and api-key");
|
|
33077
33051
|
}
|
|
33078
33052
|
const baseUrl = rawUrl.replace(/\/+$/, "");
|
|
33079
|
-
const url = `${baseUrl}${
|
|
33053
|
+
const url = `${baseUrl}${path5.startsWith("/") ? path5 : `/${path5}`}`;
|
|
33080
33054
|
const headers = new Headers(init?.headers);
|
|
33081
33055
|
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
33082
33056
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -33261,7 +33235,7 @@ Use this tool to interact with Grafana resources: datasources, dashboards, alert
|
|
|
33261
33235
|
The path must start with '/' and is appended to the configured Grafana instance URL.`,
|
|
33262
33236
|
inputSchema: inputSchema76,
|
|
33263
33237
|
outputSchema: outputSchema76,
|
|
33264
|
-
async execute({ connectionId, method, path:
|
|
33238
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
33265
33239
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
33266
33240
|
if (!connection2) {
|
|
33267
33241
|
return {
|
|
@@ -33270,12 +33244,12 @@ The path must start with '/' and is appended to the configured Grafana instance
|
|
|
33270
33244
|
};
|
|
33271
33245
|
}
|
|
33272
33246
|
console.log(
|
|
33273
|
-
`[connector-request] grafana/${connection2.name}: ${method} ${
|
|
33247
|
+
`[connector-request] grafana/${connection2.name}: ${method} ${path5}`
|
|
33274
33248
|
);
|
|
33275
33249
|
try {
|
|
33276
33250
|
const baseUrl = parameters62.url.getValue(connection2).replace(/\/+$/, "");
|
|
33277
33251
|
const apiKey = parameters62.apiKey.getValue(connection2);
|
|
33278
|
-
const url = `${baseUrl}${
|
|
33252
|
+
const url = `${baseUrl}${path5}`;
|
|
33279
33253
|
const controller = new AbortController();
|
|
33280
33254
|
const timeout = setTimeout(
|
|
33281
33255
|
() => controller.abort(),
|
|
@@ -33513,7 +33487,7 @@ var parameters63 = {
|
|
|
33513
33487
|
};
|
|
33514
33488
|
|
|
33515
33489
|
// ../connectors/src/connectors/backlog/utils.ts
|
|
33516
|
-
async function apiFetch26(params,
|
|
33490
|
+
async function apiFetch26(params, path5, init) {
|
|
33517
33491
|
const spaceUrl = params[parameters63.spaceUrl.slug];
|
|
33518
33492
|
const apiKey = params[parameters63.apiKey.slug];
|
|
33519
33493
|
if (!spaceUrl) {
|
|
@@ -33522,7 +33496,7 @@ async function apiFetch26(params, path6, init) {
|
|
|
33522
33496
|
if (!apiKey) {
|
|
33523
33497
|
throw new Error("backlog: missing required parameter: api-key");
|
|
33524
33498
|
}
|
|
33525
|
-
const trimmedPath =
|
|
33499
|
+
const trimmedPath = path5.replace(/^\/+/, "");
|
|
33526
33500
|
const separator = trimmedPath.includes("?") ? "&" : "?";
|
|
33527
33501
|
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${trimmedPath}${separator}apiKey=${encodeURIComponent(apiKey)}`;
|
|
33528
33502
|
const headers = new Headers(init?.headers);
|
|
@@ -33675,17 +33649,17 @@ The base URL and API key are configured per connection \u2014 only specify the A
|
|
|
33675
33649
|
Do NOT include the apiKey parameter yourself; it is injected automatically.`,
|
|
33676
33650
|
inputSchema: inputSchema77,
|
|
33677
33651
|
outputSchema: outputSchema77,
|
|
33678
|
-
async execute({ connectionId, method, path:
|
|
33652
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
33679
33653
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
33680
33654
|
if (!connection2) {
|
|
33681
33655
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
33682
33656
|
}
|
|
33683
|
-
console.log(`[connector-request] backlog-api-key/${connection2.name}: ${method} ${
|
|
33657
|
+
console.log(`[connector-request] backlog-api-key/${connection2.name}: ${method} ${path5}`);
|
|
33684
33658
|
try {
|
|
33685
33659
|
const spaceUrl = parameters63.spaceUrl.getValue(connection2);
|
|
33686
33660
|
const apiKey = parameters63.apiKey.getValue(connection2);
|
|
33687
|
-
const separator =
|
|
33688
|
-
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${
|
|
33661
|
+
const separator = path5.includes("?") ? "&" : "?";
|
|
33662
|
+
const url = `${spaceUrl.replace(/\/+$/, "")}/api/v2/${path5}${separator}apiKey=${apiKey}`;
|
|
33689
33663
|
const controller = new AbortController();
|
|
33690
33664
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS60);
|
|
33691
33665
|
try {
|
|
@@ -33947,7 +33921,7 @@ var parameters64 = {
|
|
|
33947
33921
|
|
|
33948
33922
|
// ../connectors/src/connectors/gamma/utils.ts
|
|
33949
33923
|
var BASE_URL51 = "https://public-api.gamma.app/v1.0";
|
|
33950
|
-
function apiFetch27(params,
|
|
33924
|
+
function apiFetch27(params, path5, init) {
|
|
33951
33925
|
const apiKey = params[parameters64.apiKey.slug];
|
|
33952
33926
|
if (!apiKey) {
|
|
33953
33927
|
throw new Error(`gamma: missing required parameter: ${parameters64.apiKey.slug}`);
|
|
@@ -33955,7 +33929,7 @@ function apiFetch27(params, path6, init) {
|
|
|
33955
33929
|
const headers = new Headers(init?.headers);
|
|
33956
33930
|
headers.set("X-API-KEY", apiKey);
|
|
33957
33931
|
if (!headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
33958
|
-
const trimmedPath =
|
|
33932
|
+
const trimmedPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
33959
33933
|
return fetch(`${BASE_URL51}${trimmedPath}`, { ...init, headers });
|
|
33960
33934
|
}
|
|
33961
33935
|
|
|
@@ -34092,7 +34066,7 @@ Use this tool for listing themes, listing folders, checking generation status, a
|
|
|
34092
34066
|
For creating presentations/documents, prefer the connector_gamma_generate tool instead.`,
|
|
34093
34067
|
inputSchema: inputSchema78,
|
|
34094
34068
|
outputSchema: outputSchema78,
|
|
34095
|
-
async execute({ connectionId, method, path:
|
|
34069
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
34096
34070
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
34097
34071
|
if (!connection2) {
|
|
34098
34072
|
return {
|
|
@@ -34101,11 +34075,11 @@ For creating presentations/documents, prefer the connector_gamma_generate tool i
|
|
|
34101
34075
|
};
|
|
34102
34076
|
}
|
|
34103
34077
|
console.log(
|
|
34104
|
-
`[connector-request] gamma/${connection2.name}: ${method} ${
|
|
34078
|
+
`[connector-request] gamma/${connection2.name}: ${method} ${path5}`
|
|
34105
34079
|
);
|
|
34106
34080
|
try {
|
|
34107
34081
|
const apiKey = parameters64.apiKey.getValue(connection2);
|
|
34108
|
-
const url = `${BASE_URL52}${
|
|
34082
|
+
const url = `${BASE_URL52}${path5}`;
|
|
34109
34083
|
const controller = new AbortController();
|
|
34110
34084
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS61);
|
|
34111
34085
|
try {
|
|
@@ -34549,12 +34523,12 @@ var parameters65 = {
|
|
|
34549
34523
|
|
|
34550
34524
|
// ../connectors/src/connectors/sentry/utils.ts
|
|
34551
34525
|
var BASE_URL54 = "https://sentry.io/api/0";
|
|
34552
|
-
async function apiFetch28(params,
|
|
34526
|
+
async function apiFetch28(params, path5, init) {
|
|
34553
34527
|
const authToken = params[parameters65.authToken.slug];
|
|
34554
34528
|
if (!authToken) {
|
|
34555
34529
|
throw new Error("sentry: missing required parameter: auth-token");
|
|
34556
34530
|
}
|
|
34557
|
-
const url = `${BASE_URL54}${
|
|
34531
|
+
const url = `${BASE_URL54}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
34558
34532
|
const headers = new Headers(init?.headers);
|
|
34559
34533
|
headers.set("Authorization", `Bearer ${authToken}`);
|
|
34560
34534
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -34719,7 +34693,7 @@ Authentication is handled automatically via Bearer token.
|
|
|
34719
34693
|
{organizationSlug} in the path is automatically replaced with the configured organization slug.`,
|
|
34720
34694
|
inputSchema: inputSchema80,
|
|
34721
34695
|
outputSchema: outputSchema80,
|
|
34722
|
-
async execute({ connectionId, method, path:
|
|
34696
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
34723
34697
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
34724
34698
|
if (!connection2) {
|
|
34725
34699
|
return {
|
|
@@ -34728,12 +34702,12 @@ Authentication is handled automatically via Bearer token.
|
|
|
34728
34702
|
};
|
|
34729
34703
|
}
|
|
34730
34704
|
console.log(
|
|
34731
|
-
`[connector-request] sentry/${connection2.name}: ${method} ${
|
|
34705
|
+
`[connector-request] sentry/${connection2.name}: ${method} ${path5}`
|
|
34732
34706
|
);
|
|
34733
34707
|
try {
|
|
34734
34708
|
const authToken = parameters65.authToken.getValue(connection2);
|
|
34735
34709
|
const organizationSlug = parameters65.organizationSlug.getValue(connection2);
|
|
34736
|
-
const resolvedPath =
|
|
34710
|
+
const resolvedPath = path5.replace(
|
|
34737
34711
|
/\{organizationSlug\}/g,
|
|
34738
34712
|
organizationSlug
|
|
34739
34713
|
);
|
|
@@ -35070,9 +35044,9 @@ async function getAccessToken4(params) {
|
|
|
35070
35044
|
instanceUrl: tokenJson.instance_url ?? instanceUrl
|
|
35071
35045
|
};
|
|
35072
35046
|
}
|
|
35073
|
-
async function apiFetch29(params,
|
|
35047
|
+
async function apiFetch29(params, path5, init) {
|
|
35074
35048
|
const token = await getAccessToken4(params);
|
|
35075
|
-
const url = `${token.instanceUrl}${
|
|
35049
|
+
const url = `${token.instanceUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
35076
35050
|
const headers = new Headers(init?.headers);
|
|
35077
35051
|
headers.set("Authorization", `Bearer ${token.accessToken}`);
|
|
35078
35052
|
headers.set("Accept", "application/json");
|
|
@@ -35296,7 +35270,7 @@ Use this tool for all Salesforce interactions: describing sObjects, running SOQL
|
|
|
35296
35270
|
Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads rather than paginating /sobjects/{Type} endpoints.`,
|
|
35297
35271
|
inputSchema: inputSchema81,
|
|
35298
35272
|
outputSchema: outputSchema81,
|
|
35299
|
-
async execute({ connectionId, method, path:
|
|
35273
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
35300
35274
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
35301
35275
|
if (!connection2) {
|
|
35302
35276
|
return {
|
|
@@ -35305,7 +35279,7 @@ Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads ra
|
|
|
35305
35279
|
};
|
|
35306
35280
|
}
|
|
35307
35281
|
console.log(
|
|
35308
|
-
`[connector-request] salesforce/${connection2.name}: ${method} ${
|
|
35282
|
+
`[connector-request] salesforce/${connection2.name}: ${method} ${path5}`
|
|
35309
35283
|
);
|
|
35310
35284
|
try {
|
|
35311
35285
|
const instanceUrlParam = parameters66.instanceUrl.getValue(connection2);
|
|
@@ -35339,7 +35313,7 @@ Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads ra
|
|
|
35339
35313
|
};
|
|
35340
35314
|
}
|
|
35341
35315
|
const resolvedInstanceUrl = tokenJson.instance_url ?? instanceUrl;
|
|
35342
|
-
const url = `${resolvedInstanceUrl}${
|
|
35316
|
+
const url = `${resolvedInstanceUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
35343
35317
|
const controller = new AbortController();
|
|
35344
35318
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS63);
|
|
35345
35319
|
try {
|
|
@@ -35985,7 +35959,7 @@ Use this tool for all InfluxDB interactions: running SQL / InfluxQL / Flux queri
|
|
|
35985
35959
|
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.`,
|
|
35986
35960
|
inputSchema: inputSchema82,
|
|
35987
35961
|
outputSchema: outputSchema82,
|
|
35988
|
-
async execute({ connectionId, method, path:
|
|
35962
|
+
async execute({ connectionId, method, path: path5, body, contentType }, connections) {
|
|
35989
35963
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
35990
35964
|
if (!connection2) {
|
|
35991
35965
|
return {
|
|
@@ -35994,12 +35968,12 @@ For read-only data exploration prefer SQL (InfluxDB 3) or InfluxQL queries \u201
|
|
|
35994
35968
|
};
|
|
35995
35969
|
}
|
|
35996
35970
|
console.log(
|
|
35997
|
-
`[connector-request] influxdb/${connection2.name}: ${method} ${
|
|
35971
|
+
`[connector-request] influxdb/${connection2.name}: ${method} ${path5}`
|
|
35998
35972
|
);
|
|
35999
35973
|
try {
|
|
36000
35974
|
const url = parameters67.url.getValue(connection2).replace(/\/$/, "");
|
|
36001
35975
|
const token = parameters67.token.getValue(connection2);
|
|
36002
|
-
const fullUrl = `${url}${
|
|
35976
|
+
const fullUrl = `${url}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
36003
35977
|
const controller = new AbortController();
|
|
36004
35978
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS64);
|
|
36005
35979
|
const resolvedContentType = contentType ?? (typeof body === "string" ? "text/plain; charset=utf-8" : "application/json");
|
|
@@ -36036,7 +36010,7 @@ For read-only data exploration prefer SQL (InfluxDB 3) or InfluxQL queries \u201
|
|
|
36036
36010
|
} else if (bodyText) {
|
|
36037
36011
|
errorMessage = isHtml ? bodyText.replace(/\s+/g, " ").slice(0, 200) : bodyText;
|
|
36038
36012
|
}
|
|
36039
|
-
const hitsV3Path =
|
|
36013
|
+
const hitsV3Path = path5.includes("/api/v3/");
|
|
36040
36014
|
const looksLikeMissingV3 = hitsV3Path && (response.status === 405 || response.status === 404 || isHtml);
|
|
36041
36015
|
if (looksLikeMissingV3) {
|
|
36042
36016
|
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'.";
|
|
@@ -37812,7 +37786,7 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
37812
37786
|
async execute({
|
|
37813
37787
|
connectionId,
|
|
37814
37788
|
method,
|
|
37815
|
-
path:
|
|
37789
|
+
path: path5,
|
|
37816
37790
|
queryParams,
|
|
37817
37791
|
body,
|
|
37818
37792
|
contentType,
|
|
@@ -37826,13 +37800,13 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
37826
37800
|
};
|
|
37827
37801
|
}
|
|
37828
37802
|
console.log(
|
|
37829
|
-
`[connector-request] semrush/${connection2.name}: ${method} ${
|
|
37803
|
+
`[connector-request] semrush/${connection2.name}: ${method} ${path5}`
|
|
37830
37804
|
);
|
|
37831
37805
|
try {
|
|
37832
37806
|
const apiKey = parameters70.apiKey.getValue(connection2);
|
|
37833
|
-
const isAbsolute = /^https?:\/\//i.test(
|
|
37807
|
+
const isAbsolute = /^https?:\/\//i.test(path5);
|
|
37834
37808
|
if (isAbsolute) {
|
|
37835
|
-
const host = new URL(
|
|
37809
|
+
const host = new URL(path5).hostname.toLowerCase();
|
|
37836
37810
|
if (host !== "api.semrush.com" && host !== "www.semrush.com") {
|
|
37837
37811
|
return {
|
|
37838
37812
|
success: false,
|
|
@@ -37841,7 +37815,7 @@ Errors from the Standard API are returned as a plain text body starting with "ER
|
|
|
37841
37815
|
}
|
|
37842
37816
|
}
|
|
37843
37817
|
const url = new URL(
|
|
37844
|
-
isAbsolute ?
|
|
37818
|
+
isAbsolute ? path5 : `${BASE_URL58}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
37845
37819
|
);
|
|
37846
37820
|
if (queryParams) {
|
|
37847
37821
|
for (const [k, v] of Object.entries(queryParams)) {
|
|
@@ -37947,14 +37921,14 @@ var semrushOnboarding = new ConnectorOnboarding({
|
|
|
37947
37921
|
// ../connectors/src/connectors/semrush/utils.ts
|
|
37948
37922
|
var BASE_URL59 = "https://api.semrush.com";
|
|
37949
37923
|
var PROJECTS_BASE_URL = `${BASE_URL59}/management/v1`;
|
|
37950
|
-
function projectsApiFetch(params,
|
|
37924
|
+
function projectsApiFetch(params, path5, init) {
|
|
37951
37925
|
const apiKey = params[parameters70.apiKey.slug];
|
|
37952
37926
|
if (!apiKey) {
|
|
37953
37927
|
throw new Error(
|
|
37954
37928
|
`semrush: missing required parameter: ${parameters70.apiKey.slug}`
|
|
37955
37929
|
);
|
|
37956
37930
|
}
|
|
37957
|
-
const trimmedPath =
|
|
37931
|
+
const trimmedPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
37958
37932
|
const url = new URL(`${PROJECTS_BASE_URL}${trimmedPath}`);
|
|
37959
37933
|
if (!url.searchParams.has("key")) {
|
|
37960
37934
|
url.searchParams.set("key", apiKey);
|
|
@@ -39062,7 +39036,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
39062
39036
|
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.`,
|
|
39063
39037
|
inputSchema: inputSchema87,
|
|
39064
39038
|
outputSchema: outputSchema87,
|
|
39065
|
-
async execute({ connectionId, method, path:
|
|
39039
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
39066
39040
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
39067
39041
|
if (!connection2) {
|
|
39068
39042
|
return {
|
|
@@ -39071,11 +39045,11 @@ For URL Inspection API requests, use the absolute path '/v1/urlInspection/index:
|
|
|
39071
39045
|
};
|
|
39072
39046
|
}
|
|
39073
39047
|
console.log(
|
|
39074
|
-
`[connector-request] google-search-console-oauth/${connection2.name}: ${method} ${
|
|
39048
|
+
`[connector-request] google-search-console-oauth/${connection2.name}: ${method} ${path5}`
|
|
39075
39049
|
);
|
|
39076
39050
|
try {
|
|
39077
39051
|
const siteUrl = parameters71.siteUrl.tryGetValue(connection2);
|
|
39078
|
-
const resolvedPath = siteUrl ?
|
|
39052
|
+
const resolvedPath = siteUrl ? path5.replace(/\{siteUrl\}/g, encodeURIComponent(siteUrl)) : path5;
|
|
39079
39053
|
const normalizedPath = normalizeRequestPath(
|
|
39080
39054
|
resolvedPath,
|
|
39081
39055
|
BASE_PATH_SEGMENT10
|
|
@@ -39731,12 +39705,12 @@ var parameters73 = {
|
|
|
39731
39705
|
|
|
39732
39706
|
// ../connectors/src/connectors/clickup/utils.ts
|
|
39733
39707
|
var BASE_URL62 = "https://api.clickup.com/api/v2";
|
|
39734
|
-
async function apiFetch30(params,
|
|
39708
|
+
async function apiFetch30(params, path5, init) {
|
|
39735
39709
|
const token = params[parameters73.apiToken.slug];
|
|
39736
39710
|
if (!token) {
|
|
39737
39711
|
throw new Error("clickup: missing required parameter: api-token");
|
|
39738
39712
|
}
|
|
39739
|
-
const url = `${BASE_URL62}${
|
|
39713
|
+
const url = `${BASE_URL62}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
39740
39714
|
const headers = new Headers(init?.headers);
|
|
39741
39715
|
headers.set("Authorization", token);
|
|
39742
39716
|
if (!headers.has("Accept")) headers.set("Accept", "application/json");
|
|
@@ -39963,7 +39937,7 @@ Common endpoints:
|
|
|
39963
39937
|
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.`,
|
|
39964
39938
|
inputSchema: inputSchema89,
|
|
39965
39939
|
outputSchema: outputSchema89,
|
|
39966
|
-
async execute({ connectionId, method, path:
|
|
39940
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
39967
39941
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
39968
39942
|
if (!connection2) {
|
|
39969
39943
|
return {
|
|
@@ -39972,11 +39946,11 @@ Pagination: ClickUp uses zero-indexed \`page\` query parameter on list endpoints
|
|
|
39972
39946
|
};
|
|
39973
39947
|
}
|
|
39974
39948
|
console.log(
|
|
39975
|
-
`[connector-request] clickup/${connection2.name}: ${method} ${
|
|
39949
|
+
`[connector-request] clickup/${connection2.name}: ${method} ${path5}`
|
|
39976
39950
|
);
|
|
39977
39951
|
try {
|
|
39978
39952
|
const token = parameters73.apiToken.getValue(connection2);
|
|
39979
|
-
const normalizedPath = normalizeRequestPath(
|
|
39953
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT11);
|
|
39980
39954
|
const url = `${BASE_URL63}${normalizedPath}`;
|
|
39981
39955
|
const controller = new AbortController();
|
|
39982
39956
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS69);
|
|
@@ -41857,7 +41831,7 @@ function buildBaseUrl(domain) {
|
|
|
41857
41831
|
function basicAuthHeader2(apiKey) {
|
|
41858
41832
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
41859
41833
|
}
|
|
41860
|
-
async function apiFetch31(params,
|
|
41834
|
+
async function apiFetch31(params, path5, init) {
|
|
41861
41835
|
const apiKey = params[parameters78.apiKey.slug];
|
|
41862
41836
|
const domain = params[parameters78.domain.slug];
|
|
41863
41837
|
if (!apiKey || !domain) {
|
|
@@ -41866,7 +41840,7 @@ async function apiFetch31(params, path6, init) {
|
|
|
41866
41840
|
);
|
|
41867
41841
|
}
|
|
41868
41842
|
const baseUrl = buildBaseUrl(domain);
|
|
41869
|
-
const url = `${baseUrl}${
|
|
41843
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
41870
41844
|
const headers = new Headers(init?.headers);
|
|
41871
41845
|
headers.set("Authorization", basicAuthHeader2(apiKey));
|
|
41872
41846
|
headers.set("Accept", "application/json");
|
|
@@ -41927,8 +41901,8 @@ var FRESHSERVICE_ENTITIES = [
|
|
|
41927
41901
|
countPath: "/service_catalog/items?per_page=1"
|
|
41928
41902
|
}
|
|
41929
41903
|
];
|
|
41930
|
-
async function fetchEntityCount2(params,
|
|
41931
|
-
const res = await apiFetch31(params,
|
|
41904
|
+
async function fetchEntityCount2(params, path5) {
|
|
41905
|
+
const res = await apiFetch31(params, path5);
|
|
41932
41906
|
if (!res.ok) return null;
|
|
41933
41907
|
const data = await res.json();
|
|
41934
41908
|
if (typeof data["total"] === "number") return data["total"];
|
|
@@ -42061,7 +42035,7 @@ Field codes:
|
|
|
42061
42035
|
- ticket source: 1 Email, 2 Portal, 3 Phone, 4 Chat, 5 Feedback widget, 7 Yammer, 8 AwsCloudwatch, 9 Pagerduty, 10 Walkup, 11 Slack`,
|
|
42062
42036
|
inputSchema: inputSchema95,
|
|
42063
42037
|
outputSchema: outputSchema95,
|
|
42064
|
-
async execute({ connectionId, method, path:
|
|
42038
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
42065
42039
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
42066
42040
|
if (!connection2) {
|
|
42067
42041
|
return {
|
|
@@ -42070,13 +42044,13 @@ Field codes:
|
|
|
42070
42044
|
};
|
|
42071
42045
|
}
|
|
42072
42046
|
console.log(
|
|
42073
|
-
`[connector-request] freshservice/${connection2.name}: ${method} ${
|
|
42047
|
+
`[connector-request] freshservice/${connection2.name}: ${method} ${path5}`
|
|
42074
42048
|
);
|
|
42075
42049
|
try {
|
|
42076
42050
|
const apiKey = parameters78.apiKey.getValue(connection2);
|
|
42077
42051
|
const domain = parameters78.domain.getValue(connection2);
|
|
42078
42052
|
const baseUrl = buildBaseUrl2(domain);
|
|
42079
|
-
const normalizedPath = normalizeRequestPath(
|
|
42053
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT13);
|
|
42080
42054
|
const url = `${baseUrl}${normalizedPath}`;
|
|
42081
42055
|
const controller = new AbortController();
|
|
42082
42056
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS70);
|
|
@@ -42369,7 +42343,7 @@ function buildBaseUrl3(domain) {
|
|
|
42369
42343
|
function basicAuthHeader4(apiKey) {
|
|
42370
42344
|
return `Basic ${Buffer.from(`${apiKey}:X`).toString("base64")}`;
|
|
42371
42345
|
}
|
|
42372
|
-
async function apiFetch32(params,
|
|
42346
|
+
async function apiFetch32(params, path5, init) {
|
|
42373
42347
|
const apiKey = params[parameters79.apiKey.slug];
|
|
42374
42348
|
const domain = params[parameters79.domain.slug];
|
|
42375
42349
|
if (!apiKey || !domain) {
|
|
@@ -42378,7 +42352,7 @@ async function apiFetch32(params, path6, init) {
|
|
|
42378
42352
|
);
|
|
42379
42353
|
}
|
|
42380
42354
|
const baseUrl = buildBaseUrl3(domain);
|
|
42381
|
-
const url = `${baseUrl}${
|
|
42355
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
42382
42356
|
const headers = new Headers(init?.headers);
|
|
42383
42357
|
headers.set("Authorization", basicAuthHeader4(apiKey));
|
|
42384
42358
|
headers.set("Accept", "application/json");
|
|
@@ -42415,8 +42389,8 @@ var FRESHDESK_ENTITIES = [
|
|
|
42415
42389
|
countPath: "/groups?per_page=1"
|
|
42416
42390
|
}
|
|
42417
42391
|
];
|
|
42418
|
-
async function fetchEntityCount3(params,
|
|
42419
|
-
const res = await apiFetch32(params,
|
|
42392
|
+
async function fetchEntityCount3(params, path5, countField) {
|
|
42393
|
+
const res = await apiFetch32(params, path5);
|
|
42420
42394
|
if (!res.ok) return null;
|
|
42421
42395
|
const data = await res.json();
|
|
42422
42396
|
if (Array.isArray(data)) return null;
|
|
@@ -42628,7 +42602,7 @@ Field codes (tickets):
|
|
|
42628
42602
|
- source: 1 Email, 2 Portal, 3 Phone, 7 Chat, 9 Feedback widget, 10 Outbound email`,
|
|
42629
42603
|
inputSchema: inputSchema96,
|
|
42630
42604
|
outputSchema: outputSchema96,
|
|
42631
|
-
async execute({ connectionId, method, path:
|
|
42605
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
42632
42606
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
42633
42607
|
if (!connection2) {
|
|
42634
42608
|
return {
|
|
@@ -42637,13 +42611,13 @@ Field codes (tickets):
|
|
|
42637
42611
|
};
|
|
42638
42612
|
}
|
|
42639
42613
|
console.log(
|
|
42640
|
-
`[connector-request] freshdesk/${connection2.name}: ${method} ${
|
|
42614
|
+
`[connector-request] freshdesk/${connection2.name}: ${method} ${path5}`
|
|
42641
42615
|
);
|
|
42642
42616
|
try {
|
|
42643
42617
|
const apiKey = parameters79.apiKey.getValue(connection2);
|
|
42644
42618
|
const domain = parameters79.domain.getValue(connection2);
|
|
42645
42619
|
const baseUrl = buildBaseUrl4(domain);
|
|
42646
|
-
const normalizedPath = normalizeRequestPath(
|
|
42620
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT15);
|
|
42647
42621
|
const url = `${baseUrl}${normalizedPath}`;
|
|
42648
42622
|
const controller = new AbortController();
|
|
42649
42623
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS71);
|
|
@@ -42935,7 +42909,7 @@ function buildBaseUrl5(bundleAlias) {
|
|
|
42935
42909
|
const subdomain = trimmed.split(".")[0];
|
|
42936
42910
|
return `https://${subdomain}.myfreshworks.com${BASE_PATH_SEGMENT16}`;
|
|
42937
42911
|
}
|
|
42938
|
-
async function apiFetch33(params,
|
|
42912
|
+
async function apiFetch33(params, path5, init) {
|
|
42939
42913
|
const apiKey = params[parameters80.apiKey.slug];
|
|
42940
42914
|
const bundle = params[parameters80.bundleAlias.slug];
|
|
42941
42915
|
if (!apiKey || !bundle) {
|
|
@@ -42944,7 +42918,7 @@ async function apiFetch33(params, path6, init) {
|
|
|
42944
42918
|
);
|
|
42945
42919
|
}
|
|
42946
42920
|
const baseUrl = buildBaseUrl5(bundle);
|
|
42947
|
-
const url = `${baseUrl}${
|
|
42921
|
+
const url = `${baseUrl}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
42948
42922
|
const headers = new Headers(init?.headers);
|
|
42949
42923
|
headers.set("Authorization", `Token token=${apiKey}`);
|
|
42950
42924
|
headers.set("Accept", "application/json");
|
|
@@ -43117,7 +43091,7 @@ Pagination: 1-indexed \`page\` + \`per_page\` (default 25, max 100). View endpoi
|
|
|
43117
43091
|
Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\`owner\`, \`creator\`, \`deals\`, \`contacts\`, etc.) to inline related records.`,
|
|
43118
43092
|
inputSchema: inputSchema97,
|
|
43119
43093
|
outputSchema: outputSchema97,
|
|
43120
|
-
async execute({ connectionId, method, path:
|
|
43094
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
43121
43095
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
43122
43096
|
if (!connection2) {
|
|
43123
43097
|
return {
|
|
@@ -43126,13 +43100,13 @@ Includes: most GET endpoints accept \`?include=\` with a comma-separated list (\
|
|
|
43126
43100
|
};
|
|
43127
43101
|
}
|
|
43128
43102
|
console.log(
|
|
43129
|
-
`[connector-request] freshsales/${connection2.name}: ${method} ${
|
|
43103
|
+
`[connector-request] freshsales/${connection2.name}: ${method} ${path5}`
|
|
43130
43104
|
);
|
|
43131
43105
|
try {
|
|
43132
43106
|
const apiKey = parameters80.apiKey.getValue(connection2);
|
|
43133
43107
|
const bundle = parameters80.bundleAlias.getValue(connection2);
|
|
43134
43108
|
const baseUrl = buildBaseUrl6(bundle);
|
|
43135
|
-
const normalizedPath = normalizeRequestPath(
|
|
43109
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT17);
|
|
43136
43110
|
const url = `${baseUrl}${normalizedPath}`;
|
|
43137
43111
|
const controller = new AbortController();
|
|
43138
43112
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS72);
|
|
@@ -43437,7 +43411,7 @@ function resolveBaseUrl(connectionBaseUrl) {
|
|
|
43437
43411
|
const trimmed = connectionBaseUrl?.trim();
|
|
43438
43412
|
return trimmed && trimmed.replace(/\/+$/, "") || DEFAULT_BASE_URL;
|
|
43439
43413
|
}
|
|
43440
|
-
async function apiFetch34(params,
|
|
43414
|
+
async function apiFetch34(params, path5, init) {
|
|
43441
43415
|
const token = params[parameters81.personalAccessToken.slug];
|
|
43442
43416
|
if (!token) {
|
|
43443
43417
|
throw new Error(
|
|
@@ -43445,7 +43419,7 @@ async function apiFetch34(params, path6, init) {
|
|
|
43445
43419
|
);
|
|
43446
43420
|
}
|
|
43447
43421
|
const baseUrl = resolveBaseUrl(params[parameters81.baseUrl.slug]);
|
|
43448
|
-
const trimmedPath =
|
|
43422
|
+
const trimmedPath = path5.replace(/^\/+/, "/");
|
|
43449
43423
|
const url = `${baseUrl}${trimmedPath.startsWith("/") ? "" : "/"}${trimmedPath}`;
|
|
43450
43424
|
const headers = new Headers(init?.headers);
|
|
43451
43425
|
headers.set("Authorization", `Bearer ${token}`);
|
|
@@ -43683,7 +43657,7 @@ Pagination: 1-indexed \`page\` + \`per_page\` (max 100). The \`Link\` response h
|
|
|
43683
43657
|
Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`X-RateLimit-Remaining\` to throttle.`,
|
|
43684
43658
|
inputSchema: inputSchema98,
|
|
43685
43659
|
outputSchema: outputSchema98,
|
|
43686
|
-
async execute({ connectionId, method, path:
|
|
43660
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
43687
43661
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
43688
43662
|
if (!connection2) {
|
|
43689
43663
|
return {
|
|
@@ -43692,12 +43666,12 @@ Rate limits: 5,000 req/hr on REST endpoints, 30 req/min on /search/*. Inspect \`
|
|
|
43692
43666
|
};
|
|
43693
43667
|
}
|
|
43694
43668
|
console.log(
|
|
43695
|
-
`[connector-request] github/${connection2.name}: ${method} ${
|
|
43669
|
+
`[connector-request] github/${connection2.name}: ${method} ${path5}`
|
|
43696
43670
|
);
|
|
43697
43671
|
try {
|
|
43698
43672
|
const token = parameters81.personalAccessToken.getValue(connection2);
|
|
43699
43673
|
const baseUrl = resolveBaseUrl2(parameters81.baseUrl.tryGetValue(connection2));
|
|
43700
|
-
const trimmedPath =
|
|
43674
|
+
const trimmedPath = path5.trim().replace(/^\/+/, "/");
|
|
43701
43675
|
const url = `${baseUrl}${trimmedPath.startsWith("/") ? "" : "/"}${trimmedPath}`;
|
|
43702
43676
|
const controller = new AbortController();
|
|
43703
43677
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS73);
|
|
@@ -44075,7 +44049,7 @@ All paths are relative to https://api.powerbi.com/v1.0/myorg. Use the executeQue
|
|
|
44075
44049
|
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.`,
|
|
44076
44050
|
inputSchema: inputSchema99,
|
|
44077
44051
|
outputSchema: outputSchema99,
|
|
44078
|
-
async execute({ connectionId, method, path:
|
|
44052
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
44079
44053
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
44080
44054
|
if (!connection2) {
|
|
44081
44055
|
return {
|
|
@@ -44084,10 +44058,10 @@ The signed-in user must have access to the workspace; unlike Service Principals,
|
|
|
44084
44058
|
};
|
|
44085
44059
|
}
|
|
44086
44060
|
console.log(
|
|
44087
|
-
`[connector-request] powerbi-oauth/${connection2.name}: ${method} ${
|
|
44061
|
+
`[connector-request] powerbi-oauth/${connection2.name}: ${method} ${path5}`
|
|
44088
44062
|
);
|
|
44089
44063
|
try {
|
|
44090
|
-
const normalizedPath = normalizeRequestPath(
|
|
44064
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT18);
|
|
44091
44065
|
let url = `${BASE_URL64}${normalizedPath}`;
|
|
44092
44066
|
if (queryParams) {
|
|
44093
44067
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -44172,8 +44146,8 @@ var parameters82 = {};
|
|
|
44172
44146
|
|
|
44173
44147
|
// ../connectors/src/connectors/powerbi-oauth/utils.ts
|
|
44174
44148
|
var BASE_URL65 = "https://api.powerbi.com/v1.0/myorg";
|
|
44175
|
-
function apiFetch35(proxyFetch,
|
|
44176
|
-
const url = `${BASE_URL65}${
|
|
44149
|
+
function apiFetch35(proxyFetch, path5, init) {
|
|
44150
|
+
const url = `${BASE_URL65}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
44177
44151
|
return proxyFetch(url, init);
|
|
44178
44152
|
}
|
|
44179
44153
|
|
|
@@ -44198,8 +44172,8 @@ async function listGroups(proxyFetch) {
|
|
|
44198
44172
|
return data.value ?? [];
|
|
44199
44173
|
}
|
|
44200
44174
|
async function listResource(proxyFetch, groupId, resource) {
|
|
44201
|
-
const
|
|
44202
|
-
const res = await apiFetch35(proxyFetch,
|
|
44175
|
+
const path5 = groupId === MY_WORKSPACE ? `/${resource}` : `/groups/${encodeURIComponent(groupId)}/${resource}`;
|
|
44176
|
+
const res = await apiFetch35(proxyFetch, path5);
|
|
44203
44177
|
if (!res.ok) {
|
|
44204
44178
|
const body = await res.text().catch(() => res.statusText);
|
|
44205
44179
|
throw new Error(
|
|
@@ -44800,9 +44774,9 @@ function buildTableauBaseUrl(params) {
|
|
|
44800
44774
|
}
|
|
44801
44775
|
return `${serverUrl.replace(/\/$/, "")}/api/${apiVersion}`;
|
|
44802
44776
|
}
|
|
44803
|
-
async function tableauProxyApiFetch(proxyFetch, params,
|
|
44777
|
+
async function tableauProxyApiFetch(proxyFetch, params, path5, init) {
|
|
44804
44778
|
const baseUrl = buildTableauBaseUrl(params);
|
|
44805
|
-
const trimmedPath =
|
|
44779
|
+
const trimmedPath = path5.replace(/^([^/])/, "/$1");
|
|
44806
44780
|
return proxyFetch(`${baseUrl}${trimmedPath}`, init);
|
|
44807
44781
|
}
|
|
44808
44782
|
|
|
@@ -45161,7 +45135,7 @@ All paths are relative to {serverUrl}/api/{apiVersion}. Use the literal placehol
|
|
|
45161
45135
|
Accept and Content-Type headers default to application/json so list responses come back as JSON instead of Tableau's default XML.`,
|
|
45162
45136
|
inputSchema: inputSchema100,
|
|
45163
45137
|
outputSchema: outputSchema100,
|
|
45164
|
-
async execute({ connectionId, method, path:
|
|
45138
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
45165
45139
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
45166
45140
|
if (!connection2) {
|
|
45167
45141
|
return {
|
|
@@ -45170,12 +45144,12 @@ Accept and Content-Type headers default to application/json so list responses co
|
|
|
45170
45144
|
};
|
|
45171
45145
|
}
|
|
45172
45146
|
console.log(
|
|
45173
|
-
`[connector-request] tableau/${connection2.name}: ${method} ${
|
|
45147
|
+
`[connector-request] tableau/${connection2.name}: ${method} ${path5}`
|
|
45174
45148
|
);
|
|
45175
45149
|
try {
|
|
45176
45150
|
const serverUrl = parameters83.serverUrl.getValue(connection2);
|
|
45177
45151
|
const apiVersion = parameters83.apiVersion.tryGetValue(connection2) || DEFAULT_API_VERSION2;
|
|
45178
|
-
const trimmedPath =
|
|
45152
|
+
const trimmedPath = path5.trim().replace(/^([^/])/, "/$1");
|
|
45179
45153
|
const baseUrl = buildBaseUrl7(serverUrl, apiVersion);
|
|
45180
45154
|
let url = `${baseUrl}${trimmedPath}`;
|
|
45181
45155
|
if (queryParams) {
|
|
@@ -45469,7 +45443,7 @@ Covers mailbox (\`/me/messages\`, \`/me/mailFolders\`), threads (\`/me/messages?
|
|
|
45469
45443
|
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\`).`,
|
|
45470
45444
|
inputSchema: inputSchema101,
|
|
45471
45445
|
outputSchema: outputSchema101,
|
|
45472
|
-
async execute({ connectionId, method, path:
|
|
45446
|
+
async execute({ connectionId, method, path: path5, queryParams }, connections, config) {
|
|
45473
45447
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
45474
45448
|
if (!connection2) {
|
|
45475
45449
|
return {
|
|
@@ -45478,10 +45452,10 @@ For full-text search use the \`$search\` query parameter (must be wrapped in dou
|
|
|
45478
45452
|
};
|
|
45479
45453
|
}
|
|
45480
45454
|
console.log(
|
|
45481
|
-
`[connector-request] outlook-oauth/${connection2.name}: ${method} ${
|
|
45455
|
+
`[connector-request] outlook-oauth/${connection2.name}: ${method} ${path5}`
|
|
45482
45456
|
);
|
|
45483
45457
|
try {
|
|
45484
|
-
const normalizedPath = normalizeRequestPath(
|
|
45458
|
+
const normalizedPath = normalizeRequestPath(path5, BASE_PATH_SEGMENT19);
|
|
45485
45459
|
let url = `${BASE_URL66}${normalizedPath}`;
|
|
45486
45460
|
if (queryParams) {
|
|
45487
45461
|
const searchParams = new URLSearchParams(queryParams);
|
|
@@ -46050,7 +46024,7 @@ Use this tool for X API v2 reads such as looking up users, fetching posts, retri
|
|
|
46050
46024
|
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.`,
|
|
46051
46025
|
inputSchema: inputSchema102,
|
|
46052
46026
|
outputSchema: outputSchema102,
|
|
46053
|
-
async execute({ connectionId, method, path:
|
|
46027
|
+
async execute({ connectionId, method, path: path5, queryParams, body }, connections) {
|
|
46054
46028
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46055
46029
|
if (!connection2) {
|
|
46056
46030
|
return {
|
|
@@ -46058,9 +46032,9 @@ X rate limits are endpoint-specific and commonly reset on fixed windows. This to
|
|
|
46058
46032
|
error: `Connection ${connectionId} not found`
|
|
46059
46033
|
};
|
|
46060
46034
|
}
|
|
46061
|
-
console.log(`[connector-request] x/${connection2.name}: ${method} ${
|
|
46035
|
+
console.log(`[connector-request] x/${connection2.name}: ${method} ${path5}`);
|
|
46062
46036
|
try {
|
|
46063
|
-
if (/^https?:\/\//i.test(
|
|
46037
|
+
if (/^https?:\/\//i.test(path5)) {
|
|
46064
46038
|
return {
|
|
46065
46039
|
success: false,
|
|
46066
46040
|
error: "Absolute URLs are not allowed. Pass a path such as /2/users/me."
|
|
@@ -46068,7 +46042,7 @@ X rate limits are endpoint-specific and commonly reset on fixed windows. This to
|
|
|
46068
46042
|
}
|
|
46069
46043
|
const bearerToken = parameters85.bearerToken.getValue(connection2);
|
|
46070
46044
|
const url = new URL(
|
|
46071
|
-
`${BASE_URL67}${
|
|
46045
|
+
`${BASE_URL67}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
46072
46046
|
);
|
|
46073
46047
|
if (queryParams) {
|
|
46074
46048
|
for (const [k, v] of Object.entries(queryParams)) {
|
|
@@ -46440,7 +46414,7 @@ Use this tool for normal dashboard data: top/new/best/ask/show/job story IDs, in
|
|
|
46440
46414
|
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.`,
|
|
46441
46415
|
inputSchema: inputSchema103,
|
|
46442
46416
|
outputSchema: outputSchema103,
|
|
46443
|
-
async execute({ connectionId, path:
|
|
46417
|
+
async execute({ connectionId, path: path5, printPretty }, connections) {
|
|
46444
46418
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46445
46419
|
if (!connection2) {
|
|
46446
46420
|
return {
|
|
@@ -46449,17 +46423,17 @@ This connector does not require API credentials, but a connectionId is still req
|
|
|
46449
46423
|
};
|
|
46450
46424
|
}
|
|
46451
46425
|
console.log(
|
|
46452
|
-
`[connector-request] hackernews/${connection2.name}: GET ${
|
|
46426
|
+
`[connector-request] hackernews/${connection2.name}: GET ${path5}`
|
|
46453
46427
|
);
|
|
46454
46428
|
try {
|
|
46455
|
-
if (/^https?:\/\//i.test(
|
|
46429
|
+
if (/^https?:\/\//i.test(path5)) {
|
|
46456
46430
|
return {
|
|
46457
46431
|
success: false,
|
|
46458
46432
|
error: "Absolute URLs are not allowed. Pass a Firebase path such as /topstories.json."
|
|
46459
46433
|
};
|
|
46460
46434
|
}
|
|
46461
46435
|
const url = new URL(
|
|
46462
|
-
`${BASE_URL68}${
|
|
46436
|
+
`${BASE_URL68}${path5.startsWith("/") ? "" : "/"}${path5}`
|
|
46463
46437
|
);
|
|
46464
46438
|
if (printPretty) url.searchParams.set("print", "pretty");
|
|
46465
46439
|
const controller = new AbortController();
|
|
@@ -46546,7 +46520,7 @@ Avoid frequent repeated Algolia searches from dashboards. Keep hitsPerPage small
|
|
|
46546
46520
|
`[connector-request] hackernews/${connection2.name}: Algolia ${endpoint}`
|
|
46547
46521
|
);
|
|
46548
46522
|
try {
|
|
46549
|
-
let
|
|
46523
|
+
let path5 = `/${endpoint}`;
|
|
46550
46524
|
if (endpoint === "items" || endpoint === "users") {
|
|
46551
46525
|
if (!idOrUsername) {
|
|
46552
46526
|
return {
|
|
@@ -46554,9 +46528,9 @@ Avoid frequent repeated Algolia searches from dashboards. Keep hitsPerPage small
|
|
|
46554
46528
|
error: `idOrUsername is required for endpoint ${endpoint}`
|
|
46555
46529
|
};
|
|
46556
46530
|
}
|
|
46557
|
-
|
|
46531
|
+
path5 += `/${encodeURIComponent(idOrUsername)}`;
|
|
46558
46532
|
}
|
|
46559
|
-
const url = new URL(`${BASE_URL69}${
|
|
46533
|
+
const url = new URL(`${BASE_URL69}${path5}`);
|
|
46560
46534
|
if (queryParams) {
|
|
46561
46535
|
for (const [k, v] of Object.entries(queryParams)) {
|
|
46562
46536
|
url.searchParams.set(k, v);
|
|
@@ -46818,7 +46792,7 @@ Use this tool for all Slack API interactions: listing channels, reading channel
|
|
|
46818
46792
|
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.`,
|
|
46819
46793
|
inputSchema: inputSchema105,
|
|
46820
46794
|
outputSchema: outputSchema105,
|
|
46821
|
-
async execute({ connectionId, method, path:
|
|
46795
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
46822
46796
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46823
46797
|
if (!connection2) {
|
|
46824
46798
|
return {
|
|
@@ -46827,10 +46801,10 @@ Pagination is cursor-based: pass 'cursor' from 'response_metadata.next_cursor' o
|
|
|
46827
46801
|
};
|
|
46828
46802
|
}
|
|
46829
46803
|
console.log(
|
|
46830
|
-
`[connector-request] slack/${connection2.name}: ${method} ${
|
|
46804
|
+
`[connector-request] slack/${connection2.name}: ${method} ${path5}`
|
|
46831
46805
|
);
|
|
46832
46806
|
try {
|
|
46833
|
-
const url = `${BASE_URL70}${
|
|
46807
|
+
const url = `${BASE_URL70}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
46834
46808
|
const token = await getProxyToken35(config.oauthProxy);
|
|
46835
46809
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
46836
46810
|
const controller = new AbortController();
|
|
@@ -47354,6 +47328,9 @@ function resolveParams(entry, connectionId, plugin) {
|
|
|
47354
47328
|
// src/connector-client/index.ts
|
|
47355
47329
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
47356
47330
|
|
|
47331
|
+
// src/routes/server-logic.ts
|
|
47332
|
+
import { Hono } from "hono";
|
|
47333
|
+
|
|
47357
47334
|
// src/types/server-logic.ts
|
|
47358
47335
|
import { z as z106 } from "zod";
|
|
47359
47336
|
var parameterMetaSchema = z106.object({
|
|
@@ -47417,173 +47394,102 @@ var anyJsonServerLogicSchema = z106.union([
|
|
|
47417
47394
|
|
|
47418
47395
|
// src/registry.ts
|
|
47419
47396
|
var serverLogics = /* @__PURE__ */ new Map();
|
|
47420
|
-
var currentDirPath = "";
|
|
47421
47397
|
var skippedServerLogics = [];
|
|
47422
47398
|
function getSkippedServerLogics() {
|
|
47423
47399
|
return skippedServerLogics;
|
|
47424
47400
|
}
|
|
47425
|
-
var viteServer = null;
|
|
47426
|
-
function validateHandlerPath(dirPath, handlerPath) {
|
|
47427
|
-
const normalizedDir = path2.resolve(dirPath);
|
|
47428
|
-
const dirBase = path2.basename(normalizedDir);
|
|
47429
|
-
let normalized = handlerPath.replace(/^\.?[/\\]/, "");
|
|
47430
|
-
const prefix = dirBase + "/";
|
|
47431
|
-
if (normalized.startsWith(prefix)) {
|
|
47432
|
-
normalized = normalized.slice(prefix.length);
|
|
47433
|
-
}
|
|
47434
|
-
const absolute = path2.resolve(dirPath, normalized);
|
|
47435
|
-
if (!absolute.startsWith(normalizedDir + path2.sep)) {
|
|
47436
|
-
throw new Error(`Handler path escapes server-logic directory: ${handlerPath}`);
|
|
47437
|
-
}
|
|
47438
|
-
if (!absolute.endsWith(".ts")) {
|
|
47439
|
-
throw new Error(`Handler must be a .ts file: ${handlerPath}`);
|
|
47440
|
-
}
|
|
47441
|
-
return absolute;
|
|
47442
|
-
}
|
|
47443
|
-
var jitiInstance = null;
|
|
47444
|
-
var jitiModuleCache = /* @__PURE__ */ new Map();
|
|
47445
|
-
async function loadTsHandlerWithJiti(absolutePath) {
|
|
47446
|
-
const cached = jitiModuleCache.get(absolutePath);
|
|
47447
|
-
if (cached) return cached;
|
|
47448
|
-
if (!jitiInstance) {
|
|
47449
|
-
const { createJiti } = await import("jiti");
|
|
47450
|
-
jitiInstance = createJiti(import.meta.url, { fsCache: false });
|
|
47451
|
-
}
|
|
47452
|
-
const mod = await jitiInstance.import(absolutePath);
|
|
47453
|
-
jitiModuleCache.set(absolutePath, mod);
|
|
47454
|
-
return mod;
|
|
47455
|
-
}
|
|
47456
|
-
async function loadTypeScriptHandler(absolutePath) {
|
|
47457
|
-
let mod;
|
|
47458
|
-
if (viteServer) {
|
|
47459
|
-
const module = viteServer.moduleGraph.getModuleById(absolutePath);
|
|
47460
|
-
if (module) viteServer.moduleGraph.invalidateModule(module);
|
|
47461
|
-
mod = await viteServer.ssrLoadModule(absolutePath);
|
|
47462
|
-
} else {
|
|
47463
|
-
mod = await loadTsHandlerWithJiti(absolutePath);
|
|
47464
|
-
}
|
|
47465
|
-
const handler = mod.default;
|
|
47466
|
-
if (typeof handler !== "function") {
|
|
47467
|
-
throw new Error(`Handler must export a default function: ${absolutePath}`);
|
|
47468
|
-
}
|
|
47469
|
-
return handler;
|
|
47470
|
-
}
|
|
47471
47401
|
function applyDefaults(parameterMeta, runtimeParams) {
|
|
47472
|
-
const defaults = new Map(
|
|
47473
|
-
parameterMeta.map((p) => [p.name, p.default ?? null])
|
|
47474
|
-
);
|
|
47402
|
+
const defaults = new Map(parameterMeta.map((p) => [p.name, p.default ?? null]));
|
|
47475
47403
|
const result = {};
|
|
47476
|
-
for (const [key, value] of Object.entries(runtimeParams))
|
|
47477
|
-
result[key] = value;
|
|
47478
|
-
}
|
|
47404
|
+
for (const [key, value] of Object.entries(runtimeParams)) result[key] = value;
|
|
47479
47405
|
for (const [key, defaultVal] of defaults) {
|
|
47480
|
-
if (!(key in result))
|
|
47481
|
-
result[key] = defaultVal;
|
|
47482
|
-
}
|
|
47406
|
+
if (!(key in result)) result[key] = defaultVal;
|
|
47483
47407
|
}
|
|
47484
47408
|
return result;
|
|
47485
47409
|
}
|
|
47486
|
-
|
|
47487
|
-
|
|
47488
|
-
|
|
47489
|
-
|
|
47490
|
-
|
|
47410
|
+
function normalizeHandlerPath(dirBase, handlerPath) {
|
|
47411
|
+
let hp = handlerPath.replace(/^\.?\//, "");
|
|
47412
|
+
if (hp.startsWith(dirBase + "/")) hp = hp.slice(dirBase.length + 1);
|
|
47413
|
+
return hp;
|
|
47414
|
+
}
|
|
47415
|
+
function populateServerLogics(source) {
|
|
47491
47416
|
serverLogics.clear();
|
|
47492
47417
|
skippedServerLogics = [];
|
|
47493
|
-
const
|
|
47494
|
-
|
|
47495
|
-
|
|
47496
|
-
|
|
47497
|
-
|
|
47498
|
-
|
|
47499
|
-
|
|
47500
|
-
|
|
47501
|
-
|
|
47502
|
-
|
|
47503
|
-
|
|
47504
|
-
|
|
47418
|
+
for (const [jsonPath, raw] of Object.entries(source.metaModules)) {
|
|
47419
|
+
const slug = jsonPath.slice(jsonPath.lastIndexOf("/") + 1).replace(/\.json$/, "");
|
|
47420
|
+
let json;
|
|
47421
|
+
try {
|
|
47422
|
+
json = JSON.parse(raw);
|
|
47423
|
+
} catch (e) {
|
|
47424
|
+
skippedServerLogics.push({
|
|
47425
|
+
slug,
|
|
47426
|
+
file: jsonPath,
|
|
47427
|
+
error: `invalid JSON: ${e instanceof Error ? e.message : String(e)}`
|
|
47428
|
+
});
|
|
47429
|
+
continue;
|
|
47430
|
+
}
|
|
47431
|
+
const parsed = anyJsonServerLogicSchema.safeParse(json);
|
|
47432
|
+
if (!parsed.success) {
|
|
47433
|
+
skippedServerLogics.push({ slug, file: jsonPath, error: parsed.error.message });
|
|
47434
|
+
continue;
|
|
47435
|
+
}
|
|
47436
|
+
const def = parsed.data;
|
|
47437
|
+
if (def.type === "typescript") {
|
|
47438
|
+
const dir = jsonPath.slice(0, jsonPath.lastIndexOf("/"));
|
|
47439
|
+
const dirBase = dir.slice(dir.lastIndexOf("/") + 1);
|
|
47440
|
+
const rel = normalizeHandlerPath(dirBase, def.handlerPath);
|
|
47441
|
+
const loadHandler = source.handlerModules[`${dir}/${rel}`];
|
|
47442
|
+
if (!loadHandler) {
|
|
47505
47443
|
skippedServerLogics.push({
|
|
47506
47444
|
slug,
|
|
47507
|
-
file,
|
|
47508
|
-
error:
|
|
47445
|
+
file: jsonPath,
|
|
47446
|
+
error: `handler file not found: ${def.handlerPath}`
|
|
47509
47447
|
});
|
|
47510
|
-
|
|
47511
|
-
}
|
|
47512
|
-
const def = parsed.data;
|
|
47513
|
-
if (def.type === "typescript") {
|
|
47514
|
-
const absoluteHandlerPath = validateHandlerPath(dirPath, def.handlerPath);
|
|
47515
|
-
const serverLogicDef = {
|
|
47516
|
-
description: def.description,
|
|
47517
|
-
parameters: def.parameters ?? [],
|
|
47518
|
-
response: def.response,
|
|
47519
|
-
cacheConfig: def.cache,
|
|
47520
|
-
handler: async () => {
|
|
47521
|
-
throw new Error("TypeScript handler must be called via _tsHandlerPath");
|
|
47522
|
-
},
|
|
47523
|
-
_isTypescript: true,
|
|
47524
|
-
_tsHandlerPath: absoluteHandlerPath
|
|
47525
|
-
};
|
|
47526
|
-
serverLogics.set(slug, serverLogicDef);
|
|
47527
|
-
console.log(`[registry] registered (typescript): ${slug}`);
|
|
47528
|
-
} else {
|
|
47529
|
-
const sqlDef = def;
|
|
47530
|
-
const serverLogicDef = {
|
|
47531
|
-
description: sqlDef.description,
|
|
47532
|
-
parameters: sqlDef.parameters ?? [],
|
|
47533
|
-
response: sqlDef.response,
|
|
47534
|
-
connectionId: sqlDef.connectionId,
|
|
47535
|
-
cacheConfig: sqlDef.cache,
|
|
47536
|
-
_query: sqlDef.query,
|
|
47537
|
-
handler: async (runtimeParams) => {
|
|
47538
|
-
const query = await getQuery(sqlDef.connectionId);
|
|
47539
|
-
const namedParams = applyDefaults(
|
|
47540
|
-
sqlDef.parameters ?? [],
|
|
47541
|
-
runtimeParams
|
|
47542
|
-
);
|
|
47543
|
-
const result = await query(sqlDef.query, namedParams);
|
|
47544
|
-
return result.rows;
|
|
47545
|
-
}
|
|
47546
|
-
};
|
|
47547
|
-
serverLogics.set(slug, serverLogicDef);
|
|
47548
|
-
console.log(`[registry] registered: ${slug}`);
|
|
47448
|
+
continue;
|
|
47549
47449
|
}
|
|
47550
|
-
|
|
47551
|
-
|
|
47552
|
-
|
|
47553
|
-
|
|
47554
|
-
|
|
47555
|
-
|
|
47556
|
-
|
|
47557
|
-
|
|
47558
|
-
|
|
47559
|
-
|
|
47560
|
-
|
|
47561
|
-
|
|
47562
|
-
|
|
47563
|
-
|
|
47450
|
+
serverLogics.set(slug, {
|
|
47451
|
+
description: def.description,
|
|
47452
|
+
parameters: def.parameters ?? [],
|
|
47453
|
+
response: def.response,
|
|
47454
|
+
cacheConfig: def.cache,
|
|
47455
|
+
handler: async () => {
|
|
47456
|
+
throw new Error("TypeScript handler must be loaded via loadTypeScriptHandler");
|
|
47457
|
+
},
|
|
47458
|
+
_isTypescript: true,
|
|
47459
|
+
_tsHandlerPath: rel,
|
|
47460
|
+
_loadHandler: loadHandler
|
|
47461
|
+
});
|
|
47462
|
+
} else {
|
|
47463
|
+
const sqlDef = def;
|
|
47464
|
+
serverLogics.set(slug, {
|
|
47465
|
+
description: sqlDef.description,
|
|
47466
|
+
parameters: sqlDef.parameters ?? [],
|
|
47467
|
+
response: sqlDef.response,
|
|
47468
|
+
connectionId: sqlDef.connectionId,
|
|
47469
|
+
cacheConfig: sqlDef.cache,
|
|
47470
|
+
_query: sqlDef.query,
|
|
47471
|
+
handler: async (runtimeParams) => {
|
|
47472
|
+
const query = await getQuery(sqlDef.connectionId);
|
|
47473
|
+
const namedParams = applyDefaults(sqlDef.parameters ?? [], runtimeParams);
|
|
47474
|
+
const result = await query(sqlDef.query, namedParams);
|
|
47475
|
+
return result.rows;
|
|
47476
|
+
}
|
|
47564
47477
|
});
|
|
47565
47478
|
}
|
|
47566
|
-
}
|
|
47567
|
-
console.log(
|
|
47479
|
+
}
|
|
47480
|
+
console.log(
|
|
47481
|
+
`[registry] ${serverLogics.size} server logic(s) ready` + (skippedServerLogics.length ? ` (${skippedServerLogics.length} skipped)` : "")
|
|
47482
|
+
);
|
|
47568
47483
|
}
|
|
47569
|
-
|
|
47570
|
-
|
|
47571
|
-
const
|
|
47572
|
-
|
|
47573
|
-
|
|
47574
|
-
|
|
47575
|
-
if (reloadTimer) clearTimeout(reloadTimer);
|
|
47576
|
-
reloadTimer = setTimeout(async () => {
|
|
47577
|
-
console.log("[registry] server-logic changed, reloading...");
|
|
47578
|
-
await initialize();
|
|
47579
|
-
}, 300);
|
|
47580
|
-
});
|
|
47581
|
-
console.log("[registry] watching server-logic directory");
|
|
47582
|
-
} catch {
|
|
47583
|
-
console.warn(
|
|
47584
|
-
"[registry] could not watch server-logic directory (static load only)"
|
|
47484
|
+
async function loadTypeScriptHandler(def) {
|
|
47485
|
+
const mod = await def._loadHandler();
|
|
47486
|
+
const handler = mod.default;
|
|
47487
|
+
if (typeof handler !== "function") {
|
|
47488
|
+
throw new Error(
|
|
47489
|
+
`Server logic handler must export a default function: ${def._tsHandlerPath}`
|
|
47585
47490
|
);
|
|
47586
47491
|
}
|
|
47492
|
+
return handler;
|
|
47587
47493
|
}
|
|
47588
47494
|
function getServerLogic(slug) {
|
|
47589
47495
|
return serverLogics.get(slug);
|
|
@@ -47597,23 +47503,12 @@ function buildMeta(slug, def) {
|
|
|
47597
47503
|
cache: def.cacheConfig
|
|
47598
47504
|
};
|
|
47599
47505
|
if (def._isTypescript) {
|
|
47600
|
-
return {
|
|
47601
|
-
...base,
|
|
47602
|
-
type: "typescript",
|
|
47603
|
-
handlerPath: path2.relative(currentDirPath, def._tsHandlerPath)
|
|
47604
|
-
};
|
|
47506
|
+
return { ...base, type: "typescript", handlerPath: def._tsHandlerPath };
|
|
47605
47507
|
}
|
|
47606
|
-
return {
|
|
47607
|
-
...base,
|
|
47608
|
-
type: "sql",
|
|
47609
|
-
connectionId: def.connectionId,
|
|
47610
|
-
query: def._query
|
|
47611
|
-
};
|
|
47508
|
+
return { ...base, type: "sql", connectionId: def.connectionId, query: def._query };
|
|
47612
47509
|
}
|
|
47613
47510
|
function getAllMeta() {
|
|
47614
|
-
return Array.from(serverLogics.entries()).map(
|
|
47615
|
-
([slug, def]) => buildMeta(slug, def)
|
|
47616
|
-
);
|
|
47511
|
+
return Array.from(serverLogics.entries()).map(([slug, def]) => buildMeta(slug, def));
|
|
47617
47512
|
}
|
|
47618
47513
|
function getMeta(slug) {
|
|
47619
47514
|
const def = serverLogics.get(slug);
|
|
@@ -47621,9 +47516,6 @@ function getMeta(slug) {
|
|
|
47621
47516
|
return buildMeta(slug, def);
|
|
47622
47517
|
}
|
|
47623
47518
|
|
|
47624
|
-
// src/routes/server-logic.ts
|
|
47625
|
-
import { Hono } from "hono";
|
|
47626
|
-
|
|
47627
47519
|
// src/cache.ts
|
|
47628
47520
|
var MAX_SIZE = 100;
|
|
47629
47521
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -47761,7 +47653,7 @@ app.get("/:slug", async (c) => {
|
|
|
47761
47653
|
}
|
|
47762
47654
|
try {
|
|
47763
47655
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47764
|
-
const handler = await loadTypeScriptHandler(ds
|
|
47656
|
+
const handler = await loadTypeScriptHandler(ds);
|
|
47765
47657
|
const result = await handler(c);
|
|
47766
47658
|
return result;
|
|
47767
47659
|
} else {
|
|
@@ -47789,7 +47681,7 @@ app.post("/:slug", async (c) => {
|
|
|
47789
47681
|
const ttl = cacheConfig?.ttl ?? 0;
|
|
47790
47682
|
if (ttl <= 0) {
|
|
47791
47683
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47792
|
-
const handler = await loadTypeScriptHandler(ds
|
|
47684
|
+
const handler = await loadTypeScriptHandler(ds);
|
|
47793
47685
|
const result = await handler(c);
|
|
47794
47686
|
return result;
|
|
47795
47687
|
} else {
|
|
@@ -47813,7 +47705,7 @@ app.post("/:slug", async (c) => {
|
|
|
47813
47705
|
void (async () => {
|
|
47814
47706
|
try {
|
|
47815
47707
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47816
|
-
const tsHandler = await loadTypeScriptHandler(ds
|
|
47708
|
+
const tsHandler = await loadTypeScriptHandler(ds);
|
|
47817
47709
|
const freshResponse = await tsHandler(c);
|
|
47818
47710
|
const outcome = await cacheTypescriptResponse(freshResponse);
|
|
47819
47711
|
if (outcome.cacheable) {
|
|
@@ -47837,7 +47729,7 @@ app.post("/:slug", async (c) => {
|
|
|
47837
47729
|
}
|
|
47838
47730
|
}
|
|
47839
47731
|
if (ds._isTypescript && ds._tsHandlerPath) {
|
|
47840
|
-
const handler = await loadTypeScriptHandler(ds
|
|
47732
|
+
const handler = await loadTypeScriptHandler(ds);
|
|
47841
47733
|
const response = await handler(c);
|
|
47842
47734
|
const outcome = await cacheTypescriptResponse(response);
|
|
47843
47735
|
if (outcome.cacheable) {
|
|
@@ -47902,20 +47794,20 @@ var cache_default = app3;
|
|
|
47902
47794
|
|
|
47903
47795
|
// src/routes/pages.ts
|
|
47904
47796
|
import { Hono as Hono4 } from "hono";
|
|
47905
|
-
import
|
|
47797
|
+
import path2 from "path";
|
|
47906
47798
|
import fs from "fs";
|
|
47907
|
-
var DATA_DIR = process.env.DATA_DIR ??
|
|
47799
|
+
var DATA_DIR = process.env.DATA_DIR ?? path2.join(process.cwd(), "data");
|
|
47908
47800
|
var app4 = new Hono4();
|
|
47909
47801
|
function getPageList() {
|
|
47910
47802
|
if (!fs.existsSync(DATA_DIR)) return [];
|
|
47911
47803
|
const files = fs.readdirSync(DATA_DIR).filter((f) => f.endsWith(".json"));
|
|
47912
47804
|
const pages = files.map((file) => {
|
|
47913
|
-
const name =
|
|
47805
|
+
const name = path2.basename(file, ".json");
|
|
47914
47806
|
const urlPath = name === "home" ? "/" : "/" + name.replace(/-/g, "/");
|
|
47915
47807
|
let title = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, " ");
|
|
47916
47808
|
try {
|
|
47917
47809
|
const raw = JSON.parse(
|
|
47918
|
-
fs.readFileSync(
|
|
47810
|
+
fs.readFileSync(path2.join(DATA_DIR, file), "utf-8")
|
|
47919
47811
|
);
|
|
47920
47812
|
const puckData = raw.pageData || raw;
|
|
47921
47813
|
if (puckData?.root?.props?.title) {
|
|
@@ -47936,7 +47828,7 @@ app4.get("/pages", (c) => c.json(getPageList()));
|
|
|
47936
47828
|
app4.get("/page-data", (c) => {
|
|
47937
47829
|
const page = c.req.query("page") || "home";
|
|
47938
47830
|
const safePage = page.replace(/[^a-zA-Z0-9-_]/g, "");
|
|
47939
|
-
const filePath =
|
|
47831
|
+
const filePath = path2.join(DATA_DIR, `${safePage}.json`);
|
|
47940
47832
|
if (!fs.existsSync(filePath)) return c.json({ error: "not found" }, 404);
|
|
47941
47833
|
try {
|
|
47942
47834
|
const raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
@@ -47954,7 +47846,7 @@ app4.get("/page-data", (c) => {
|
|
|
47954
47846
|
app4.get("/runtime-data", (c) => {
|
|
47955
47847
|
const page = c.req.query("page") || "home";
|
|
47956
47848
|
const safePage = page.replace(/[^a-zA-Z0-9-_]/g, "");
|
|
47957
|
-
const filePath =
|
|
47849
|
+
const filePath = path2.join(DATA_DIR, `${safePage}.json`);
|
|
47958
47850
|
if (!fs.existsSync(filePath)) return c.json({ queries: [] });
|
|
47959
47851
|
try {
|
|
47960
47852
|
const raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
@@ -48021,9 +47913,9 @@ var getBase = () => {
|
|
|
48021
47913
|
if (cachedBase == null) cachedBase = resolveBase();
|
|
48022
47914
|
return cachedBase;
|
|
48023
47915
|
};
|
|
48024
|
-
var jsonFetch = async (method,
|
|
47916
|
+
var jsonFetch = async (method, path5, body) => {
|
|
48025
47917
|
const base = getBase();
|
|
48026
|
-
const url = `${base.baseUrl}${
|
|
47918
|
+
const url = `${base.baseUrl}${path5}`;
|
|
48027
47919
|
const authHeaders2 = resolveAuthHeaders(base.routeKind);
|
|
48028
47920
|
const res = await fetch(url, {
|
|
48029
47921
|
method,
|
|
@@ -48211,9 +48103,7 @@ apiApp.route("/server-logic", server_logic_default);
|
|
|
48211
48103
|
apiApp.route("/server-logic-meta", server_logic_meta_default);
|
|
48212
48104
|
apiApp.route("/cache", cache_default);
|
|
48213
48105
|
apiApp.route("/", pages_default);
|
|
48214
|
-
reloadEnvFile(
|
|
48215
|
-
await initialize();
|
|
48216
|
-
startWatching();
|
|
48106
|
+
reloadEnvFile(path3.join(process.cwd(), ".env"));
|
|
48217
48107
|
watchConnectionsFile();
|
|
48218
48108
|
var app5 = new Hono5();
|
|
48219
48109
|
app5.get("/healthz", (c) => c.json({ status: "ok" }));
|
|
@@ -48222,9 +48112,9 @@ var src_default = app5;
|
|
|
48222
48112
|
|
|
48223
48113
|
// src/main.ts
|
|
48224
48114
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
48225
|
-
import
|
|
48115
|
+
import path4 from "path";
|
|
48226
48116
|
import fs2 from "fs";
|
|
48227
|
-
var STATIC_DIR = process.env.STATIC_DIR ??
|
|
48117
|
+
var STATIC_DIR = process.env.STATIC_DIR ?? "dist/client";
|
|
48228
48118
|
src_default.use(
|
|
48229
48119
|
"/assets/*",
|
|
48230
48120
|
serveStatic({
|
|
@@ -48236,11 +48126,12 @@ src_default.use(
|
|
|
48236
48126
|
);
|
|
48237
48127
|
src_default.use("/*", serveStatic({ root: STATIC_DIR }));
|
|
48238
48128
|
src_default.get("*", (c) => {
|
|
48239
|
-
const indexPath =
|
|
48129
|
+
const indexPath = path4.join(STATIC_DIR, "index.html");
|
|
48240
48130
|
if (!fs2.existsSync(indexPath)) return c.text("index.html not found", 404);
|
|
48241
48131
|
return c.html(fs2.readFileSync(indexPath, "utf-8"));
|
|
48242
48132
|
});
|
|
48243
48133
|
var main_default = src_default;
|
|
48244
48134
|
export {
|
|
48245
|
-
main_default as default
|
|
48135
|
+
main_default as default,
|
|
48136
|
+
populateServerLogics
|
|
48246
48137
|
};
|