@squadbase/vite-server 0.1.10-dev.5aa0720 → 0.1.10-dev.cec85c2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +20 -52
- package/dist/connectors/google-ads.js +8 -48
- package/dist/index.js +20 -52
- package/dist/main.js +20 -52
- package/dist/vite-plugin.js +20 -52
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -92942,30 +92942,6 @@ export default async function handler(c: Context) {
|
|
|
92942
92942
|
|
|
92943
92943
|
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92944
92944
|
import { z as z18 } from "zod";
|
|
92945
|
-
|
|
92946
|
-
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
92947
|
-
var parameters12 = {
|
|
92948
|
-
customerId: new ParameterDefinition({
|
|
92949
|
-
slug: "customer-id",
|
|
92950
|
-
name: "Google Ads Customer ID",
|
|
92951
|
-
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
92952
|
-
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
92953
|
-
type: "text",
|
|
92954
|
-
secret: false,
|
|
92955
|
-
required: false
|
|
92956
|
-
}),
|
|
92957
|
-
developerToken: new ParameterDefinition({
|
|
92958
|
-
slug: "developer-token",
|
|
92959
|
-
name: "Google Ads Developer Token",
|
|
92960
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
92961
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
92962
|
-
type: "text",
|
|
92963
|
-
secret: true,
|
|
92964
|
-
required: true
|
|
92965
|
-
})
|
|
92966
|
-
};
|
|
92967
|
-
|
|
92968
|
-
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92969
92945
|
var BASE_URL2 = "https://googleads.googleapis.com/v18/";
|
|
92970
92946
|
var REQUEST_TIMEOUT_MS8 = 6e4;
|
|
92971
92947
|
var cachedToken4 = null;
|
|
@@ -93037,7 +93013,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93037
93013
|
`[connector-request] google-ads/${connection.name}: listCustomers`
|
|
93038
93014
|
);
|
|
93039
93015
|
try {
|
|
93040
|
-
const developerToken = parameters12.developerToken.getValue(connection);
|
|
93041
93016
|
const token = await getProxyToken4(config.oauthProxy);
|
|
93042
93017
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
93043
93018
|
const controller = new AbortController();
|
|
@@ -93051,10 +93026,7 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93051
93026
|
},
|
|
93052
93027
|
body: JSON.stringify({
|
|
93053
93028
|
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
93054
|
-
method: "GET"
|
|
93055
|
-
headers: {
|
|
93056
|
-
"developer-token": developerToken
|
|
93057
|
-
}
|
|
93029
|
+
method: "GET"
|
|
93058
93030
|
}),
|
|
93059
93031
|
signal: controller.signal
|
|
93060
93032
|
});
|
|
@@ -93080,7 +93052,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93080
93052
|
method: "POST",
|
|
93081
93053
|
headers: {
|
|
93082
93054
|
"Content-Type": "application/json",
|
|
93083
|
-
"developer-token": developerToken,
|
|
93084
93055
|
"login-customer-id": cid
|
|
93085
93056
|
},
|
|
93086
93057
|
body: JSON.stringify({
|
|
@@ -93126,30 +93097,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93126
93097
|
connectionSetupInstructions: {
|
|
93127
93098
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Ads (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
93128
93099
|
|
|
93129
|
-
1. \
|
|
93100
|
+
1. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93130
93101
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93131
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93132
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
93133
|
-
3. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93134
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93135
93102
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93136
93103
|
- \`options\`: \u30AB\u30B9\u30BF\u30DE\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30A2\u30AB\u30A6\u30F3\u30C8\u540D (id: \u30AB\u30B9\u30BF\u30DE\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30B9\u30BF\u30DE\u30FCID
|
|
93137
|
-
|
|
93104
|
+
- \u30AB\u30B9\u30BF\u30DE\u30FC\u304C **0\u4EF6** \u306E\u5834\u5408\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
93105
|
+
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30B9\u30BF\u30DE\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
93138
93106
|
|
|
93139
93107
|
#### \u5236\u7D04
|
|
93140
93108
|
- **\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
|
|
93141
93109
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
93142
93110
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
93143
93111
|
|
|
93144
|
-
1.
|
|
93112
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93145
93113
|
2. Call \`updateConnectionParameters\`:
|
|
93146
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93147
|
-
- \`value\`: The Developer Token provided by the user
|
|
93148
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93149
|
-
4. Call \`updateConnectionParameters\`:
|
|
93150
93114
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93151
93115
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
93152
|
-
|
|
93116
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
93117
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
93153
93118
|
|
|
93154
93119
|
#### Constraints
|
|
93155
93120
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -93163,6 +93128,19 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93163
93128
|
}
|
|
93164
93129
|
});
|
|
93165
93130
|
|
|
93131
|
+
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
93132
|
+
var parameters12 = {
|
|
93133
|
+
customerId: new ParameterDefinition({
|
|
93134
|
+
slug: "customer-id",
|
|
93135
|
+
name: "Google Ads Customer ID",
|
|
93136
|
+
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
93137
|
+
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
93138
|
+
type: "text",
|
|
93139
|
+
secret: false,
|
|
93140
|
+
required: false
|
|
93141
|
+
})
|
|
93142
|
+
};
|
|
93143
|
+
|
|
93166
93144
|
// ../connectors/src/connectors/google-ads/tools/request.ts
|
|
93167
93145
|
import { z as z19 } from "zod";
|
|
93168
93146
|
var BASE_URL3 = "https://googleads.googleapis.com/v18/";
|
|
@@ -93248,7 +93226,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93248
93226
|
const controller = new AbortController();
|
|
93249
93227
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS9);
|
|
93250
93228
|
try {
|
|
93251
|
-
const developerToken = parameters12.developerToken.getValue(connection);
|
|
93252
93229
|
const response = await fetch(proxyUrl, {
|
|
93253
93230
|
method: "POST",
|
|
93254
93231
|
headers: {
|
|
@@ -93260,7 +93237,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93260
93237
|
method,
|
|
93261
93238
|
headers: {
|
|
93262
93239
|
"Content-Type": "application/json",
|
|
93263
|
-
"developer-token": developerToken,
|
|
93264
93240
|
...customerId ? { "login-customer-id": customerId } : {}
|
|
93265
93241
|
},
|
|
93266
93242
|
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
@@ -93441,20 +93417,12 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
93441
93417
|
if (!customerId) {
|
|
93442
93418
|
return { success: true };
|
|
93443
93419
|
}
|
|
93444
|
-
const developerToken = params[parameters12.developerToken.slug];
|
|
93445
|
-
if (!developerToken) {
|
|
93446
|
-
return {
|
|
93447
|
-
success: false,
|
|
93448
|
-
error: "Developer token is required"
|
|
93449
|
-
};
|
|
93450
|
-
}
|
|
93451
93420
|
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
93452
93421
|
try {
|
|
93453
93422
|
const res = await proxyFetch(url, {
|
|
93454
93423
|
method: "POST",
|
|
93455
93424
|
headers: {
|
|
93456
93425
|
"Content-Type": "application/json",
|
|
93457
|
-
"developer-token": developerToken,
|
|
93458
93426
|
"login-customer-id": customerId
|
|
93459
93427
|
},
|
|
93460
93428
|
body: JSON.stringify({
|
|
@@ -52,15 +52,6 @@ var parameters = {
|
|
|
52
52
|
type: "text",
|
|
53
53
|
secret: false,
|
|
54
54
|
required: false
|
|
55
|
-
}),
|
|
56
|
-
developerToken: new ParameterDefinition({
|
|
57
|
-
slug: "developer-token",
|
|
58
|
-
name: "Google Ads Developer Token",
|
|
59
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
60
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
61
|
-
type: "text",
|
|
62
|
-
secret: true,
|
|
63
|
-
required: true
|
|
64
55
|
})
|
|
65
56
|
};
|
|
66
57
|
|
|
@@ -69,12 +60,6 @@ var BASE_URL = "https://googleads.googleapis.com/v18/";
|
|
|
69
60
|
function createClient(params, fetchFn = fetch) {
|
|
70
61
|
const rawCustomerId = params[parameters.customerId.slug];
|
|
71
62
|
const defaultCustomerId = rawCustomerId?.replace(/-/g, "") ?? "";
|
|
72
|
-
const developerToken = params[parameters.developerToken.slug];
|
|
73
|
-
if (!developerToken) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
`google-ads: missing required parameter: ${parameters.developerToken.slug}`
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
63
|
function resolveCustomerId(override) {
|
|
79
64
|
const id = override?.replace(/-/g, "") ?? defaultCustomerId;
|
|
80
65
|
if (!id) {
|
|
@@ -88,7 +73,6 @@ function createClient(params, fetchFn = fetch) {
|
|
|
88
73
|
const resolvedPath = defaultCustomerId ? path2.replace(/\{customerId\}/g, defaultCustomerId) : path2;
|
|
89
74
|
const url = `${BASE_URL}${resolvedPath}`;
|
|
90
75
|
const headers = new Headers(init?.headers);
|
|
91
|
-
headers.set("developer-token", developerToken);
|
|
92
76
|
if (defaultCustomerId) {
|
|
93
77
|
headers.set("login-customer-id", defaultCustomerId);
|
|
94
78
|
}
|
|
@@ -99,7 +83,6 @@ function createClient(params, fetchFn = fetch) {
|
|
|
99
83
|
const url = `${BASE_URL}customers/${cid}/googleAds:searchStream`;
|
|
100
84
|
const headers = new Headers();
|
|
101
85
|
headers.set("Content-Type", "application/json");
|
|
102
|
-
headers.set("developer-token", developerToken);
|
|
103
86
|
headers.set("login-customer-id", cid);
|
|
104
87
|
const response = await fetchFn(url, {
|
|
105
88
|
method: "POST",
|
|
@@ -117,9 +100,7 @@ function createClient(params, fetchFn = fetch) {
|
|
|
117
100
|
}
|
|
118
101
|
async function listAccessibleCustomers() {
|
|
119
102
|
const url = `${BASE_URL}customers:listAccessibleCustomers`;
|
|
120
|
-
const
|
|
121
|
-
headers.set("developer-token", developerToken);
|
|
122
|
-
const response = await fetchFn(url, { method: "GET", headers });
|
|
103
|
+
const response = await fetchFn(url, { method: "GET" });
|
|
123
104
|
if (!response.ok) {
|
|
124
105
|
const body = await response.text();
|
|
125
106
|
throw new Error(
|
|
@@ -360,7 +341,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
360
341
|
`[connector-request] google-ads/${connection2.name}: listCustomers`
|
|
361
342
|
);
|
|
362
343
|
try {
|
|
363
|
-
const developerToken = parameters.developerToken.getValue(connection2);
|
|
364
344
|
const token = await getProxyToken(config.oauthProxy);
|
|
365
345
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
366
346
|
const controller = new AbortController();
|
|
@@ -374,10 +354,7 @@ var listCustomersTool = new ConnectorTool({
|
|
|
374
354
|
},
|
|
375
355
|
body: JSON.stringify({
|
|
376
356
|
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
377
|
-
method: "GET"
|
|
378
|
-
headers: {
|
|
379
|
-
"developer-token": developerToken
|
|
380
|
-
}
|
|
357
|
+
method: "GET"
|
|
381
358
|
}),
|
|
382
359
|
signal: controller.signal
|
|
383
360
|
});
|
|
@@ -403,7 +380,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
403
380
|
method: "POST",
|
|
404
381
|
headers: {
|
|
405
382
|
"Content-Type": "application/json",
|
|
406
|
-
"developer-token": developerToken,
|
|
407
383
|
"login-customer-id": cid
|
|
408
384
|
},
|
|
409
385
|
body: JSON.stringify({
|
|
@@ -449,30 +425,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
449
425
|
connectionSetupInstructions: {
|
|
450
426
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Ads (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
451
427
|
|
|
452
|
-
1. \
|
|
428
|
+
1. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
453
429
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
454
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
455
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
456
|
-
3. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
457
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
458
430
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
459
431
|
- \`options\`: \u30AB\u30B9\u30BF\u30DE\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30A2\u30AB\u30A6\u30F3\u30C8\u540D (id: \u30AB\u30B9\u30BF\u30DE\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30B9\u30BF\u30DE\u30FCID
|
|
460
|
-
|
|
432
|
+
- \u30AB\u30B9\u30BF\u30DE\u30FC\u304C **0\u4EF6** \u306E\u5834\u5408\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
433
|
+
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30B9\u30BF\u30DE\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
461
434
|
|
|
462
435
|
#### \u5236\u7D04
|
|
463
436
|
- **\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
|
|
464
437
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
465
438
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
466
439
|
|
|
467
|
-
1.
|
|
440
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
468
441
|
2. Call \`updateConnectionParameters\`:
|
|
469
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
470
|
-
- \`value\`: The Developer Token provided by the user
|
|
471
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
472
|
-
4. Call \`updateConnectionParameters\`:
|
|
473
442
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
474
443
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
475
|
-
|
|
444
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
445
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
476
446
|
|
|
477
447
|
#### Constraints
|
|
478
448
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -571,7 +541,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
571
541
|
const controller = new AbortController();
|
|
572
542
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS2);
|
|
573
543
|
try {
|
|
574
|
-
const developerToken = parameters.developerToken.getValue(connection2);
|
|
575
544
|
const response = await fetch(proxyUrl, {
|
|
576
545
|
method: "POST",
|
|
577
546
|
headers: {
|
|
@@ -583,7 +552,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
583
552
|
method,
|
|
584
553
|
headers: {
|
|
585
554
|
"Content-Type": "application/json",
|
|
586
|
-
"developer-token": developerToken,
|
|
587
555
|
...customerId ? { "login-customer-id": customerId } : {}
|
|
588
556
|
},
|
|
589
557
|
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
@@ -764,20 +732,12 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
764
732
|
if (!customerId) {
|
|
765
733
|
return { success: true };
|
|
766
734
|
}
|
|
767
|
-
const developerToken = params[parameters.developerToken.slug];
|
|
768
|
-
if (!developerToken) {
|
|
769
|
-
return {
|
|
770
|
-
success: false,
|
|
771
|
-
error: "Developer token is required"
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
735
|
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
775
736
|
try {
|
|
776
737
|
const res = await proxyFetch(url, {
|
|
777
738
|
method: "POST",
|
|
778
739
|
headers: {
|
|
779
740
|
"Content-Type": "application/json",
|
|
780
|
-
"developer-token": developerToken,
|
|
781
741
|
"login-customer-id": customerId
|
|
782
742
|
},
|
|
783
743
|
body: JSON.stringify({
|
package/dist/index.js
CHANGED
|
@@ -92877,30 +92877,6 @@ export default async function handler(c: Context) {
|
|
|
92877
92877
|
|
|
92878
92878
|
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92879
92879
|
import { z as z18 } from "zod";
|
|
92880
|
-
|
|
92881
|
-
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
92882
|
-
var parameters12 = {
|
|
92883
|
-
customerId: new ParameterDefinition({
|
|
92884
|
-
slug: "customer-id",
|
|
92885
|
-
name: "Google Ads Customer ID",
|
|
92886
|
-
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
92887
|
-
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
92888
|
-
type: "text",
|
|
92889
|
-
secret: false,
|
|
92890
|
-
required: false
|
|
92891
|
-
}),
|
|
92892
|
-
developerToken: new ParameterDefinition({
|
|
92893
|
-
slug: "developer-token",
|
|
92894
|
-
name: "Google Ads Developer Token",
|
|
92895
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
92896
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
92897
|
-
type: "text",
|
|
92898
|
-
secret: true,
|
|
92899
|
-
required: true
|
|
92900
|
-
})
|
|
92901
|
-
};
|
|
92902
|
-
|
|
92903
|
-
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92904
92880
|
var BASE_URL2 = "https://googleads.googleapis.com/v18/";
|
|
92905
92881
|
var REQUEST_TIMEOUT_MS8 = 6e4;
|
|
92906
92882
|
var cachedToken4 = null;
|
|
@@ -92972,7 +92948,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92972
92948
|
`[connector-request] google-ads/${connection2.name}: listCustomers`
|
|
92973
92949
|
);
|
|
92974
92950
|
try {
|
|
92975
|
-
const developerToken = parameters12.developerToken.getValue(connection2);
|
|
92976
92951
|
const token = await getProxyToken4(config.oauthProxy);
|
|
92977
92952
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
92978
92953
|
const controller = new AbortController();
|
|
@@ -92986,10 +92961,7 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92986
92961
|
},
|
|
92987
92962
|
body: JSON.stringify({
|
|
92988
92963
|
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
92989
|
-
method: "GET"
|
|
92990
|
-
headers: {
|
|
92991
|
-
"developer-token": developerToken
|
|
92992
|
-
}
|
|
92964
|
+
method: "GET"
|
|
92993
92965
|
}),
|
|
92994
92966
|
signal: controller.signal
|
|
92995
92967
|
});
|
|
@@ -93015,7 +92987,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93015
92987
|
method: "POST",
|
|
93016
92988
|
headers: {
|
|
93017
92989
|
"Content-Type": "application/json",
|
|
93018
|
-
"developer-token": developerToken,
|
|
93019
92990
|
"login-customer-id": cid
|
|
93020
92991
|
},
|
|
93021
92992
|
body: JSON.stringify({
|
|
@@ -93061,30 +93032,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93061
93032
|
connectionSetupInstructions: {
|
|
93062
93033
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Ads (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
93063
93034
|
|
|
93064
|
-
1. \
|
|
93035
|
+
1. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93065
93036
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93066
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93067
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
93068
|
-
3. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93069
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93070
93037
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93071
93038
|
- \`options\`: \u30AB\u30B9\u30BF\u30DE\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30A2\u30AB\u30A6\u30F3\u30C8\u540D (id: \u30AB\u30B9\u30BF\u30DE\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30B9\u30BF\u30DE\u30FCID
|
|
93072
|
-
|
|
93039
|
+
- \u30AB\u30B9\u30BF\u30DE\u30FC\u304C **0\u4EF6** \u306E\u5834\u5408\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
93040
|
+
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30B9\u30BF\u30DE\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
93073
93041
|
|
|
93074
93042
|
#### \u5236\u7D04
|
|
93075
93043
|
- **\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
|
|
93076
93044
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
93077
93045
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
93078
93046
|
|
|
93079
|
-
1.
|
|
93047
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93080
93048
|
2. Call \`updateConnectionParameters\`:
|
|
93081
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93082
|
-
- \`value\`: The Developer Token provided by the user
|
|
93083
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93084
|
-
4. Call \`updateConnectionParameters\`:
|
|
93085
93049
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93086
93050
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
93087
|
-
|
|
93051
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
93052
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
93088
93053
|
|
|
93089
93054
|
#### Constraints
|
|
93090
93055
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -93098,6 +93063,19 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93098
93063
|
}
|
|
93099
93064
|
});
|
|
93100
93065
|
|
|
93066
|
+
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
93067
|
+
var parameters12 = {
|
|
93068
|
+
customerId: new ParameterDefinition({
|
|
93069
|
+
slug: "customer-id",
|
|
93070
|
+
name: "Google Ads Customer ID",
|
|
93071
|
+
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
93072
|
+
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
93073
|
+
type: "text",
|
|
93074
|
+
secret: false,
|
|
93075
|
+
required: false
|
|
93076
|
+
})
|
|
93077
|
+
};
|
|
93078
|
+
|
|
93101
93079
|
// ../connectors/src/connectors/google-ads/tools/request.ts
|
|
93102
93080
|
import { z as z19 } from "zod";
|
|
93103
93081
|
var BASE_URL3 = "https://googleads.googleapis.com/v18/";
|
|
@@ -93183,7 +93161,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93183
93161
|
const controller = new AbortController();
|
|
93184
93162
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS9);
|
|
93185
93163
|
try {
|
|
93186
|
-
const developerToken = parameters12.developerToken.getValue(connection2);
|
|
93187
93164
|
const response = await fetch(proxyUrl, {
|
|
93188
93165
|
method: "POST",
|
|
93189
93166
|
headers: {
|
|
@@ -93195,7 +93172,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93195
93172
|
method,
|
|
93196
93173
|
headers: {
|
|
93197
93174
|
"Content-Type": "application/json",
|
|
93198
|
-
"developer-token": developerToken,
|
|
93199
93175
|
...customerId ? { "login-customer-id": customerId } : {}
|
|
93200
93176
|
},
|
|
93201
93177
|
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
@@ -93376,20 +93352,12 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
93376
93352
|
if (!customerId) {
|
|
93377
93353
|
return { success: true };
|
|
93378
93354
|
}
|
|
93379
|
-
const developerToken = params[parameters12.developerToken.slug];
|
|
93380
|
-
if (!developerToken) {
|
|
93381
|
-
return {
|
|
93382
|
-
success: false,
|
|
93383
|
-
error: "Developer token is required"
|
|
93384
|
-
};
|
|
93385
|
-
}
|
|
93386
93355
|
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
93387
93356
|
try {
|
|
93388
93357
|
const res = await proxyFetch(url, {
|
|
93389
93358
|
method: "POST",
|
|
93390
93359
|
headers: {
|
|
93391
93360
|
"Content-Type": "application/json",
|
|
93392
|
-
"developer-token": developerToken,
|
|
93393
93361
|
"login-customer-id": customerId
|
|
93394
93362
|
},
|
|
93395
93363
|
body: JSON.stringify({
|
package/dist/main.js
CHANGED
|
@@ -92877,30 +92877,6 @@ export default async function handler(c: Context) {
|
|
|
92877
92877
|
|
|
92878
92878
|
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92879
92879
|
import { z as z18 } from "zod";
|
|
92880
|
-
|
|
92881
|
-
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
92882
|
-
var parameters12 = {
|
|
92883
|
-
customerId: new ParameterDefinition({
|
|
92884
|
-
slug: "customer-id",
|
|
92885
|
-
name: "Google Ads Customer ID",
|
|
92886
|
-
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
92887
|
-
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
92888
|
-
type: "text",
|
|
92889
|
-
secret: false,
|
|
92890
|
-
required: false
|
|
92891
|
-
}),
|
|
92892
|
-
developerToken: new ParameterDefinition({
|
|
92893
|
-
slug: "developer-token",
|
|
92894
|
-
name: "Google Ads Developer Token",
|
|
92895
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
92896
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
92897
|
-
type: "text",
|
|
92898
|
-
secret: true,
|
|
92899
|
-
required: true
|
|
92900
|
-
})
|
|
92901
|
-
};
|
|
92902
|
-
|
|
92903
|
-
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92904
92880
|
var BASE_URL2 = "https://googleads.googleapis.com/v18/";
|
|
92905
92881
|
var REQUEST_TIMEOUT_MS8 = 6e4;
|
|
92906
92882
|
var cachedToken4 = null;
|
|
@@ -92972,7 +92948,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92972
92948
|
`[connector-request] google-ads/${connection2.name}: listCustomers`
|
|
92973
92949
|
);
|
|
92974
92950
|
try {
|
|
92975
|
-
const developerToken = parameters12.developerToken.getValue(connection2);
|
|
92976
92951
|
const token = await getProxyToken4(config.oauthProxy);
|
|
92977
92952
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
92978
92953
|
const controller = new AbortController();
|
|
@@ -92986,10 +92961,7 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92986
92961
|
},
|
|
92987
92962
|
body: JSON.stringify({
|
|
92988
92963
|
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
92989
|
-
method: "GET"
|
|
92990
|
-
headers: {
|
|
92991
|
-
"developer-token": developerToken
|
|
92992
|
-
}
|
|
92964
|
+
method: "GET"
|
|
92993
92965
|
}),
|
|
92994
92966
|
signal: controller.signal
|
|
92995
92967
|
});
|
|
@@ -93015,7 +92987,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93015
92987
|
method: "POST",
|
|
93016
92988
|
headers: {
|
|
93017
92989
|
"Content-Type": "application/json",
|
|
93018
|
-
"developer-token": developerToken,
|
|
93019
92990
|
"login-customer-id": cid
|
|
93020
92991
|
},
|
|
93021
92992
|
body: JSON.stringify({
|
|
@@ -93061,30 +93032,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93061
93032
|
connectionSetupInstructions: {
|
|
93062
93033
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Ads (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
93063
93034
|
|
|
93064
|
-
1. \
|
|
93035
|
+
1. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93065
93036
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93066
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93067
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
93068
|
-
3. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93069
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93070
93037
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93071
93038
|
- \`options\`: \u30AB\u30B9\u30BF\u30DE\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30A2\u30AB\u30A6\u30F3\u30C8\u540D (id: \u30AB\u30B9\u30BF\u30DE\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30B9\u30BF\u30DE\u30FCID
|
|
93072
|
-
|
|
93039
|
+
- \u30AB\u30B9\u30BF\u30DE\u30FC\u304C **0\u4EF6** \u306E\u5834\u5408\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
93040
|
+
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30B9\u30BF\u30DE\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
93073
93041
|
|
|
93074
93042
|
#### \u5236\u7D04
|
|
93075
93043
|
- **\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
|
|
93076
93044
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
93077
93045
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
93078
93046
|
|
|
93079
|
-
1.
|
|
93047
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93080
93048
|
2. Call \`updateConnectionParameters\`:
|
|
93081
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93082
|
-
- \`value\`: The Developer Token provided by the user
|
|
93083
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93084
|
-
4. Call \`updateConnectionParameters\`:
|
|
93085
93049
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93086
93050
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
93087
|
-
|
|
93051
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
93052
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
93088
93053
|
|
|
93089
93054
|
#### Constraints
|
|
93090
93055
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -93098,6 +93063,19 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93098
93063
|
}
|
|
93099
93064
|
});
|
|
93100
93065
|
|
|
93066
|
+
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
93067
|
+
var parameters12 = {
|
|
93068
|
+
customerId: new ParameterDefinition({
|
|
93069
|
+
slug: "customer-id",
|
|
93070
|
+
name: "Google Ads Customer ID",
|
|
93071
|
+
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
93072
|
+
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
93073
|
+
type: "text",
|
|
93074
|
+
secret: false,
|
|
93075
|
+
required: false
|
|
93076
|
+
})
|
|
93077
|
+
};
|
|
93078
|
+
|
|
93101
93079
|
// ../connectors/src/connectors/google-ads/tools/request.ts
|
|
93102
93080
|
import { z as z19 } from "zod";
|
|
93103
93081
|
var BASE_URL3 = "https://googleads.googleapis.com/v18/";
|
|
@@ -93183,7 +93161,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93183
93161
|
const controller = new AbortController();
|
|
93184
93162
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS9);
|
|
93185
93163
|
try {
|
|
93186
|
-
const developerToken = parameters12.developerToken.getValue(connection2);
|
|
93187
93164
|
const response = await fetch(proxyUrl, {
|
|
93188
93165
|
method: "POST",
|
|
93189
93166
|
headers: {
|
|
@@ -93195,7 +93172,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93195
93172
|
method,
|
|
93196
93173
|
headers: {
|
|
93197
93174
|
"Content-Type": "application/json",
|
|
93198
|
-
"developer-token": developerToken,
|
|
93199
93175
|
...customerId ? { "login-customer-id": customerId } : {}
|
|
93200
93176
|
},
|
|
93201
93177
|
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
@@ -93376,20 +93352,12 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
93376
93352
|
if (!customerId) {
|
|
93377
93353
|
return { success: true };
|
|
93378
93354
|
}
|
|
93379
|
-
const developerToken = params[parameters12.developerToken.slug];
|
|
93380
|
-
if (!developerToken) {
|
|
93381
|
-
return {
|
|
93382
|
-
success: false,
|
|
93383
|
-
error: "Developer token is required"
|
|
93384
|
-
};
|
|
93385
|
-
}
|
|
93386
93355
|
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
93387
93356
|
try {
|
|
93388
93357
|
const res = await proxyFetch(url, {
|
|
93389
93358
|
method: "POST",
|
|
93390
93359
|
headers: {
|
|
93391
93360
|
"Content-Type": "application/json",
|
|
93392
|
-
"developer-token": developerToken,
|
|
93393
93361
|
"login-customer-id": customerId
|
|
93394
93362
|
},
|
|
93395
93363
|
body: JSON.stringify({
|
package/dist/vite-plugin.js
CHANGED
|
@@ -92878,30 +92878,6 @@ export default async function handler(c: Context) {
|
|
|
92878
92878
|
|
|
92879
92879
|
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92880
92880
|
import { z as z18 } from "zod";
|
|
92881
|
-
|
|
92882
|
-
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
92883
|
-
var parameters12 = {
|
|
92884
|
-
customerId: new ParameterDefinition({
|
|
92885
|
-
slug: "customer-id",
|
|
92886
|
-
name: "Google Ads Customer ID",
|
|
92887
|
-
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
92888
|
-
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
92889
|
-
type: "text",
|
|
92890
|
-
secret: false,
|
|
92891
|
-
required: false
|
|
92892
|
-
}),
|
|
92893
|
-
developerToken: new ParameterDefinition({
|
|
92894
|
-
slug: "developer-token",
|
|
92895
|
-
name: "Google Ads Developer Token",
|
|
92896
|
-
description: "The developer token for accessing the Google Ads API. Required for all API requests.",
|
|
92897
|
-
envVarBaseKey: "GOOGLE_ADS_DEVELOPER_TOKEN",
|
|
92898
|
-
type: "text",
|
|
92899
|
-
secret: true,
|
|
92900
|
-
required: true
|
|
92901
|
-
})
|
|
92902
|
-
};
|
|
92903
|
-
|
|
92904
|
-
// ../connectors/src/connectors/google-ads/tools/list-customers.ts
|
|
92905
92881
|
var BASE_URL2 = "https://googleads.googleapis.com/v18/";
|
|
92906
92882
|
var REQUEST_TIMEOUT_MS8 = 6e4;
|
|
92907
92883
|
var cachedToken4 = null;
|
|
@@ -92973,7 +92949,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92973
92949
|
`[connector-request] google-ads/${connection.name}: listCustomers`
|
|
92974
92950
|
);
|
|
92975
92951
|
try {
|
|
92976
|
-
const developerToken = parameters12.developerToken.getValue(connection);
|
|
92977
92952
|
const token = await getProxyToken4(config.oauthProxy);
|
|
92978
92953
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
92979
92954
|
const controller = new AbortController();
|
|
@@ -92987,10 +92962,7 @@ var listCustomersTool = new ConnectorTool({
|
|
|
92987
92962
|
},
|
|
92988
92963
|
body: JSON.stringify({
|
|
92989
92964
|
url: `${BASE_URL2}customers:listAccessibleCustomers`,
|
|
92990
|
-
method: "GET"
|
|
92991
|
-
headers: {
|
|
92992
|
-
"developer-token": developerToken
|
|
92993
|
-
}
|
|
92965
|
+
method: "GET"
|
|
92994
92966
|
}),
|
|
92995
92967
|
signal: controller.signal
|
|
92996
92968
|
});
|
|
@@ -93016,7 +92988,6 @@ var listCustomersTool = new ConnectorTool({
|
|
|
93016
92988
|
method: "POST",
|
|
93017
92989
|
headers: {
|
|
93018
92990
|
"Content-Type": "application/json",
|
|
93019
|
-
"developer-token": developerToken,
|
|
93020
92991
|
"login-customer-id": cid
|
|
93021
92992
|
},
|
|
93022
92993
|
body: JSON.stringify({
|
|
@@ -93062,30 +93033,24 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93062
93033
|
connectionSetupInstructions: {
|
|
93063
93034
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Ads (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
93064
93035
|
|
|
93065
|
-
1. \
|
|
93036
|
+
1. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93066
93037
|
2. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93067
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93068
|
-
- \`value\`: \u30E6\u30FC\u30B6\u30FC\u304C\u63D0\u4F9B\u3057\u305F Developer Token
|
|
93069
|
-
3. \`${listCustomersToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u30AB\u30B9\u30BF\u30DE\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
93070
|
-
4. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
93071
93038
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93072
93039
|
- \`options\`: \u30AB\u30B9\u30BF\u30DE\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30A2\u30AB\u30A6\u30F3\u30C8\u540D (id: \u30AB\u30B9\u30BF\u30DE\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30B9\u30BF\u30DE\u30FCID
|
|
93073
|
-
|
|
93040
|
+
- \u30AB\u30B9\u30BF\u30DE\u30FC\u304C **0\u4EF6** \u306E\u5834\u5408\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
93041
|
+
3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30B9\u30BF\u30DE\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u306E\u3067\u3001\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
93074
93042
|
|
|
93075
93043
|
#### \u5236\u7D04
|
|
93076
93044
|
- **\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
|
|
93077
93045
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
93078
93046
|
en: `Follow these steps to set up the Google Ads (OAuth) connection.
|
|
93079
93047
|
|
|
93080
|
-
1.
|
|
93048
|
+
1. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93081
93049
|
2. Call \`updateConnectionParameters\`:
|
|
93082
|
-
- \`parameterSlug\`: \`"developer-token"\`
|
|
93083
|
-
- \`value\`: The Developer Token provided by the user
|
|
93084
|
-
3. Call \`${listCustomersToolName}\` to get the list of Google Ads customer accounts accessible with the OAuth credentials
|
|
93085
|
-
4. Call \`updateConnectionParameters\`:
|
|
93086
93050
|
- \`parameterSlug\`: \`"customer-id"\`
|
|
93087
93051
|
- \`options\`: The customer list. Each option's \`label\` should be \`Account Name (id: customerId)\`, \`value\` should be the customer ID
|
|
93088
|
-
|
|
93052
|
+
- If **0 customers** are returned, abort setup and inform the user that no accessible accounts are available
|
|
93053
|
+
3. The \`label\` of the user's selected customer will arrive as a message. Proceed to the next step
|
|
93089
93054
|
|
|
93090
93055
|
#### Constraints
|
|
93091
93056
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -93099,6 +93064,19 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
93099
93064
|
}
|
|
93100
93065
|
});
|
|
93101
93066
|
|
|
93067
|
+
// ../connectors/src/connectors/google-ads/parameters.ts
|
|
93068
|
+
var parameters12 = {
|
|
93069
|
+
customerId: new ParameterDefinition({
|
|
93070
|
+
slug: "customer-id",
|
|
93071
|
+
name: "Google Ads Customer ID",
|
|
93072
|
+
description: "The Google Ads customer ID (e.g., 123-456-7890 or 1234567890). Can be found in the top-right corner of your Google Ads account.",
|
|
93073
|
+
envVarBaseKey: "GOOGLE_ADS_CUSTOMER_ID",
|
|
93074
|
+
type: "text",
|
|
93075
|
+
secret: false,
|
|
93076
|
+
required: false
|
|
93077
|
+
})
|
|
93078
|
+
};
|
|
93079
|
+
|
|
93102
93080
|
// ../connectors/src/connectors/google-ads/tools/request.ts
|
|
93103
93081
|
import { z as z19 } from "zod";
|
|
93104
93082
|
var BASE_URL3 = "https://googleads.googleapis.com/v18/";
|
|
@@ -93184,7 +93162,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93184
93162
|
const controller = new AbortController();
|
|
93185
93163
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS9);
|
|
93186
93164
|
try {
|
|
93187
|
-
const developerToken = parameters12.developerToken.getValue(connection);
|
|
93188
93165
|
const response = await fetch(proxyUrl, {
|
|
93189
93166
|
method: "POST",
|
|
93190
93167
|
headers: {
|
|
@@ -93196,7 +93173,6 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
93196
93173
|
method,
|
|
93197
93174
|
headers: {
|
|
93198
93175
|
"Content-Type": "application/json",
|
|
93199
|
-
"developer-token": developerToken,
|
|
93200
93176
|
...customerId ? { "login-customer-id": customerId } : {}
|
|
93201
93177
|
},
|
|
93202
93178
|
...method === "POST" && body ? { body: JSON.stringify(body) } : {}
|
|
@@ -93377,20 +93353,12 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
93377
93353
|
if (!customerId) {
|
|
93378
93354
|
return { success: true };
|
|
93379
93355
|
}
|
|
93380
|
-
const developerToken = params[parameters12.developerToken.slug];
|
|
93381
|
-
if (!developerToken) {
|
|
93382
|
-
return {
|
|
93383
|
-
success: false,
|
|
93384
|
-
error: "Developer token is required"
|
|
93385
|
-
};
|
|
93386
|
-
}
|
|
93387
93356
|
const url = `https://googleads.googleapis.com/v18/customers/${customerId}/googleAds:searchStream`;
|
|
93388
93357
|
try {
|
|
93389
93358
|
const res = await proxyFetch(url, {
|
|
93390
93359
|
method: "POST",
|
|
93391
93360
|
headers: {
|
|
93392
93361
|
"Content-Type": "application/json",
|
|
93393
|
-
"developer-token": developerToken,
|
|
93394
93362
|
"login-customer-id": customerId
|
|
93395
93363
|
},
|
|
93396
93364
|
body: JSON.stringify({
|