@squadbase/vite-server 0.1.2 → 0.1.3-dev.0
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 +1123 -294
- package/dist/connectors/airtable-oauth.js +12 -4
- package/dist/connectors/amplitude.js +335 -32
- package/dist/connectors/attio.js +304 -36
- package/dist/connectors/google-ads-oauth.js +14 -8
- package/dist/connectors/google-analytics-oauth.js +16 -8
- package/dist/connectors/google-sheets-oauth.js +12 -4
- package/dist/connectors/hubspot-oauth.js +12 -4
- package/dist/connectors/hubspot.d.ts +5 -0
- package/dist/connectors/hubspot.js +541 -0
- package/dist/connectors/kintone-api-token.js +16 -20
- package/dist/connectors/shopify-oauth.js +12 -4
- package/dist/connectors/shopify.js +500 -80
- package/dist/connectors/stripe-oauth.js +12 -4
- package/dist/index.js +1117 -288
- package/dist/main.js +1117 -288
- package/dist/vite-plugin.js +1117 -288
- package/package.json +5 -1
package/dist/cli/index.js
CHANGED
|
@@ -7215,8 +7215,8 @@ var init_body = __esm({
|
|
|
7215
7215
|
const ct = this.headers.get("content-type");
|
|
7216
7216
|
if (ct.startsWith("application/x-www-form-urlencoded")) {
|
|
7217
7217
|
const formData = new FormData2();
|
|
7218
|
-
const
|
|
7219
|
-
for (const [name, value] of
|
|
7218
|
+
const parameters34 = new URLSearchParams(await this.text());
|
|
7219
|
+
for (const [name, value] of parameters34) {
|
|
7220
7220
|
formData.append(name, value);
|
|
7221
7221
|
}
|
|
7222
7222
|
return formData;
|
|
@@ -10164,11 +10164,11 @@ var require_bignumber = __commonJS({
|
|
|
10164
10164
|
return n > 0 || n === i2 ? i2 : i2 - 1;
|
|
10165
10165
|
}
|
|
10166
10166
|
function coeffToString(a) {
|
|
10167
|
-
var s2,
|
|
10167
|
+
var s2, z37, i2 = 1, j = a.length, r2 = a[0] + "";
|
|
10168
10168
|
for (; i2 < j; ) {
|
|
10169
10169
|
s2 = a[i2++] + "";
|
|
10170
|
-
|
|
10171
|
-
for (;
|
|
10170
|
+
z37 = LOG_BASE - s2.length;
|
|
10171
|
+
for (; z37--; s2 = "0" + s2) ;
|
|
10172
10172
|
r2 += s2;
|
|
10173
10173
|
}
|
|
10174
10174
|
for (j = r2.length; r2.charCodeAt(--j) === 48; ) ;
|
|
@@ -10201,15 +10201,15 @@ var require_bignumber = __commonJS({
|
|
|
10201
10201
|
function toExponential(str, e2) {
|
|
10202
10202
|
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e2 < 0 ? "e" : "e+") + e2;
|
|
10203
10203
|
}
|
|
10204
|
-
function toFixedPoint(str, e2,
|
|
10204
|
+
function toFixedPoint(str, e2, z37) {
|
|
10205
10205
|
var len, zs;
|
|
10206
10206
|
if (e2 < 0) {
|
|
10207
|
-
for (zs =
|
|
10207
|
+
for (zs = z37 + "."; ++e2; zs += z37) ;
|
|
10208
10208
|
str = zs + str;
|
|
10209
10209
|
} else {
|
|
10210
10210
|
len = str.length;
|
|
10211
10211
|
if (++e2 > len) {
|
|
10212
|
-
for (zs =
|
|
10212
|
+
for (zs = z37, e2 -= len; --e2; zs += z37) ;
|
|
10213
10213
|
str += zs;
|
|
10214
10214
|
} else if (e2 < len) {
|
|
10215
10215
|
str = str.slice(0, e2) + "." + str.slice(e2);
|
|
@@ -22015,11 +22015,14 @@ var googleAdsOauthConnector = new ConnectorPlugin({
|
|
|
22015
22015
|
]
|
|
22016
22016
|
},
|
|
22017
22017
|
systemPrompt: {
|
|
22018
|
-
en: `###
|
|
22019
|
-
|
|
22020
|
-
- {customerId} in
|
|
22018
|
+
en: `### Tools
|
|
22019
|
+
|
|
22020
|
+
- \`google-ads-oauth_request\`: Send authenticated requests to the Google Ads API. Use it for GAQL queries via searchStream. The {customerId} placeholder in paths is automatically replaced (hyphens removed). Authentication and developer token are configured automatically.
|
|
22021
|
+
- \`google-ads-oauth_listCustomers\`: List accessible Google Ads customer accounts. Use this during setup to discover available accounts.
|
|
22021
22022
|
|
|
22022
|
-
###
|
|
22023
|
+
### Google Ads API Reference
|
|
22024
|
+
|
|
22025
|
+
#### Query Data (searchStream)
|
|
22023
22026
|
- POST customers/{customerId}/googleAds:searchStream
|
|
22024
22027
|
- Body: { "query": "SELECT campaign.id, campaign.name, metrics.impressions FROM campaign WHERE segments.date DURING LAST_30_DAYS" }
|
|
22025
22028
|
|
|
@@ -22065,11 +22068,14 @@ rows.forEach(row => console.log(row));
|
|
|
22065
22068
|
// List accessible customer accounts
|
|
22066
22069
|
const customerIds = await ads.listAccessibleCustomers();
|
|
22067
22070
|
\`\`\``,
|
|
22068
|
-
ja: `###
|
|
22069
|
-
- GAQL (Google Ads Query Language) \u3092\u4F7F\u7528\u3057\u3066\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30C7\u30FC\u30BF\u3092\u30AF\u30A8\u30EA\u3057\u307E\u3059
|
|
22070
|
-
- \u30D1\u30B9\u5185\u306E {customerId} \u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF08\u30CF\u30A4\u30D5\u30F3\u306F\u9664\u53BB\uFF09
|
|
22071
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
22071
22072
|
|
|
22072
|
-
|
|
22073
|
+
- \`google-ads-oauth_request\`: Google Ads API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002searchStream\u3092\u4F7F\u3063\u305FGAQL\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{customerId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF08\u30CF\u30A4\u30D5\u30F3\u306F\u9664\u53BB\uFF09\u3002\u8A8D\u8A3C\u3068\u30C7\u30D9\u30ED\u30C3\u30D1\u30FC\u30C8\u30FC\u30AF\u30F3\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
22074
|
+
- \`google-ads-oauth_listCustomers\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Ads\u9867\u5BA2\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
|
|
22075
|
+
|
|
22076
|
+
### Google Ads API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
22077
|
+
|
|
22078
|
+
#### \u30C7\u30FC\u30BF\u306E\u30AF\u30A8\u30EA (searchStream)
|
|
22073
22079
|
- POST customers/{customerId}/googleAds:searchStream
|
|
22074
22080
|
- Body: { "query": "SELECT campaign.id, campaign.name, metrics.impressions FROM campaign WHERE segments.date DURING LAST_30_DAYS" }
|
|
22075
22081
|
|
|
@@ -22865,11 +22871,15 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
22865
22871
|
]
|
|
22866
22872
|
},
|
|
22867
22873
|
systemPrompt: {
|
|
22868
|
-
en: `###
|
|
22869
|
-
|
|
22870
|
-
- {propertyId} in
|
|
22874
|
+
en: `### Tools
|
|
22875
|
+
|
|
22876
|
+
- \`google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. The {propertyId} placeholder in paths is automatically replaced. Authentication is configured automatically via OAuth.
|
|
22877
|
+
- \`google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
22878
|
+
- \`google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
22871
22879
|
|
|
22872
|
-
###
|
|
22880
|
+
### GA4 Data API Reference
|
|
22881
|
+
|
|
22882
|
+
#### Get Metadata (Check available dimensions and metrics)
|
|
22873
22883
|
- GET properties/{propertyId}/metadata
|
|
22874
22884
|
|
|
22875
22885
|
### Get Report
|
|
@@ -22925,11 +22935,15 @@ const realtime = await ga.runRealtimeReport({
|
|
|
22925
22935
|
dimensions: [{ name: "country" }],
|
|
22926
22936
|
});
|
|
22927
22937
|
\`\`\``,
|
|
22928
|
-
ja: `###
|
|
22929
|
-
|
|
22930
|
-
- \u30D1\u30B9\u5185\u306E
|
|
22938
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
22939
|
+
|
|
22940
|
+
- \`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\u5185\u306E{propertyId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
22941
|
+
- \`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
|
|
22942
|
+
- \`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
|
|
22931
22943
|
|
|
22932
|
-
### \
|
|
22944
|
+
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
22945
|
+
|
|
22946
|
+
#### \u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\uFF08\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u78BA\u8A8D\uFF09
|
|
22933
22947
|
- GET properties/{propertyId}/metadata
|
|
22934
22948
|
|
|
22935
22949
|
### \u30EC\u30DD\u30FC\u30C8\u306E\u53D6\u5F97
|
|
@@ -23215,9 +23229,13 @@ var googleSheetsOauthConnector = new ConnectorPlugin({
|
|
|
23215
23229
|
]
|
|
23216
23230
|
},
|
|
23217
23231
|
systemPrompt: {
|
|
23218
|
-
en: `###
|
|
23232
|
+
en: `### Tools
|
|
23233
|
+
|
|
23234
|
+
- \`google-sheets-oauth_request\`: The only way to call the Google Sheets API (read-only). Use it to get spreadsheet metadata, cell values, and batch values. Authentication is configured automatically via OAuth. The {spreadsheetId} placeholder in paths is automatically replaced with the configured default spreadsheet ID.
|
|
23219
23235
|
|
|
23220
|
-
###
|
|
23236
|
+
### Google Sheets API Reference
|
|
23237
|
+
|
|
23238
|
+
#### Available Endpoints
|
|
23221
23239
|
- GET \`/{spreadsheetId}\` \u2014 Get spreadsheet metadata (title, sheets, properties)
|
|
23222
23240
|
- GET \`/{spreadsheetId}/values/{range}\` \u2014 Get cell values for a range
|
|
23223
23241
|
- GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 Get values for multiple ranges
|
|
@@ -23259,9 +23277,13 @@ console.log(values.values); // 2D array
|
|
|
23259
23277
|
const batch = await sheets.batchGetValues(["Sheet1!A1:B5", "Sheet2!A1:C3"]);
|
|
23260
23278
|
batch.valueRanges.forEach(vr => console.log(vr.range, vr.values));
|
|
23261
23279
|
\`\`\``,
|
|
23262
|
-
ja: `###
|
|
23280
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
23281
|
+
|
|
23282
|
+
- \`google-sheets-oauth_request\`: Google Sheets API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3001\u30BB\u30EB\u5024\u3001\u30D0\u30C3\u30C1\u5024\u306E\u53D6\u5F97\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{spreadsheetId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002
|
|
23283
|
+
|
|
23284
|
+
### Google Sheets API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
23263
23285
|
|
|
23264
|
-
|
|
23286
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
23265
23287
|
- GET \`/{spreadsheetId}\` \u2014 \u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\uFF08\u30BF\u30A4\u30C8\u30EB\u3001\u30B7\u30FC\u30C8\u3001\u30D7\u30ED\u30D1\u30C6\u30A3\uFF09
|
|
23266
23288
|
- GET \`/{spreadsheetId}/values/{range}\` \u2014 \u7BC4\u56F2\u306E\u30BB\u30EB\u5024\u3092\u53D6\u5F97
|
|
23267
23289
|
- GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 \u8907\u6570\u7BC4\u56F2\u306E\u5024\u3092\u53D6\u5F97
|
|
@@ -23510,9 +23532,13 @@ var hubspotOauthConnector = new ConnectorPlugin({
|
|
|
23510
23532
|
]
|
|
23511
23533
|
},
|
|
23512
23534
|
systemPrompt: {
|
|
23513
|
-
en: `###
|
|
23535
|
+
en: `### Tools
|
|
23536
|
+
|
|
23537
|
+
- \`hubspot-oauth_request\`: The only way to call the HubSpot API. Use it to query contacts, deals, companies, and other CRM objects. Authentication is configured automatically via OAuth. HubSpot uses cursor-based pagination with the \`after\` parameter from \`paging.next.after\` in the response.
|
|
23514
23538
|
|
|
23515
|
-
###
|
|
23539
|
+
### HubSpot API Reference
|
|
23540
|
+
|
|
23541
|
+
#### Available Endpoints
|
|
23516
23542
|
- GET \`/crm/v3/objects/contacts\` \u2014 List contacts
|
|
23517
23543
|
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 Get a contact
|
|
23518
23544
|
- GET \`/crm/v3/objects/deals\` \u2014 List deals
|
|
@@ -23551,9 +23577,13 @@ const hubspot = connection("<connectionId>");
|
|
|
23551
23577
|
const res = await hubspot.request("/crm/v3/objects/contacts?limit=10");
|
|
23552
23578
|
const data = await res.json();
|
|
23553
23579
|
\`\`\``,
|
|
23554
|
-
ja: `###
|
|
23580
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
23555
23581
|
|
|
23556
|
-
|
|
23582
|
+
- \`hubspot-oauth_request\`: HubSpot API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u53D6\u5F15\u3001\u4F1A\u793E\u3001\u305D\u306E\u4ED6\u306ECRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002HubSpot\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`paging.next.after\` \u304B\u3089\u306E \`after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
23583
|
+
|
|
23584
|
+
### HubSpot API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
23585
|
+
|
|
23586
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
23557
23587
|
- GET \`/crm/v3/objects/contacts\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
23558
23588
|
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u53D6\u5F97
|
|
23559
23589
|
- GET \`/crm/v3/objects/deals\` \u2014 \u53D6\u5F15\u4E00\u89A7\u3092\u53D6\u5F97
|
|
@@ -23797,9 +23827,13 @@ var stripeOauthConnector = new ConnectorPlugin({
|
|
|
23797
23827
|
]
|
|
23798
23828
|
},
|
|
23799
23829
|
systemPrompt: {
|
|
23800
|
-
en: `###
|
|
23830
|
+
en: `### Tools
|
|
23831
|
+
|
|
23832
|
+
- \`stripe-oauth_request\`: The only way to call the Stripe API. Use it to query charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more. Authentication is configured automatically via OAuth. Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`.
|
|
23801
23833
|
|
|
23802
|
-
###
|
|
23834
|
+
### Stripe API Reference
|
|
23835
|
+
|
|
23836
|
+
#### Available Endpoints
|
|
23803
23837
|
- GET \`/v1/charges\` \u2014 List charges
|
|
23804
23838
|
- GET \`/v1/charges/{chargeId}\` \u2014 Get a charge
|
|
23805
23839
|
- GET \`/v1/customers\` \u2014 List customers
|
|
@@ -23842,9 +23876,13 @@ const stripe = connection("<connectionId>");
|
|
|
23842
23876
|
const res = await stripe.request("/v1/customers?limit=10");
|
|
23843
23877
|
const data = await res.json();
|
|
23844
23878
|
\`\`\``,
|
|
23845
|
-
ja: `###
|
|
23879
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
23880
|
+
|
|
23881
|
+
- \`stripe-oauth_request\`: Stripe API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u8ACB\u6C42\u3001\u9867\u5BA2\u3001\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\u3001\u4FA1\u683C\u3001\u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u3001\u6B8B\u9AD8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
23882
|
+
|
|
23883
|
+
### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
23846
23884
|
|
|
23847
|
-
|
|
23885
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
23848
23886
|
- GET \`/v1/charges\` \u2014 \u8ACB\u6C42\u4E00\u89A7\u3092\u53D6\u5F97
|
|
23849
23887
|
- GET \`/v1/charges/{chargeId}\` \u2014 \u8ACB\u6C42\u3092\u53D6\u5F97
|
|
23850
23888
|
- GET \`/v1/customers\` \u2014 \u9867\u5BA2\u4E00\u89A7\u3092\u53D6\u5F97
|
|
@@ -24116,9 +24154,13 @@ var airtableOauthConnector = new ConnectorPlugin({
|
|
|
24116
24154
|
]
|
|
24117
24155
|
},
|
|
24118
24156
|
systemPrompt: {
|
|
24119
|
-
en: `###
|
|
24157
|
+
en: `### Tools
|
|
24158
|
+
|
|
24159
|
+
- \`airtable-oauth_request\`: The only way to call the Airtable REST API. Use it to list tables, query/create/update/delete records. Authentication is configured automatically via OAuth. The {baseId} placeholder in paths is automatically replaced with the configured default base ID.
|
|
24160
|
+
|
|
24161
|
+
### Airtable API Reference
|
|
24120
24162
|
|
|
24121
|
-
|
|
24163
|
+
#### Available Endpoints
|
|
24122
24164
|
- GET \`/meta/bases/{baseId}/tables\` \u2014 List tables in a base
|
|
24123
24165
|
- GET \`/{baseId}/{tableIdOrName}\` \u2014 List records in a table
|
|
24124
24166
|
- GET \`/{baseId}/{tableIdOrName}/{recordId}\` \u2014 Get a single record
|
|
@@ -24160,9 +24202,13 @@ const data = await res.json();
|
|
|
24160
24202
|
const records = await airtable.request("/{baseId}/Tasks?maxRecords=100");
|
|
24161
24203
|
const recordsData = await records.json();
|
|
24162
24204
|
\`\`\``,
|
|
24163
|
-
ja: `###
|
|
24205
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
24206
|
+
|
|
24207
|
+
- \`airtable-oauth_request\`: Airtable REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u691C\u7D22\u30FB\u4F5C\u6210\u30FB\u66F4\u65B0\u30FB\u524A\u9664\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{baseId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30D9\u30FC\u30B9ID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002
|
|
24208
|
+
|
|
24209
|
+
### Airtable API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
24164
24210
|
|
|
24165
|
-
|
|
24211
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
24166
24212
|
- GET \`/meta/bases/{baseId}/tables\` \u2014 \u30D9\u30FC\u30B9\u5185\u306E\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97
|
|
24167
24213
|
- GET \`/{baseId}/{tableIdOrName}\` \u2014 \u30C6\u30FC\u30D6\u30EB\u5185\u306E\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
24168
24214
|
- GET \`/{baseId}/{tableIdOrName}/{recordId}\` \u2014 \u5358\u4E00\u30EC\u30B3\u30FC\u30C9\u3092\u53D6\u5F97
|
|
@@ -24615,12 +24661,13 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
|
|
|
24615
24661
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
24616
24662
|
onboarding: kintoneApiTokenOnboarding,
|
|
24617
24663
|
systemPrompt: {
|
|
24618
|
-
en: `###
|
|
24619
|
-
|
|
24620
|
-
- The
|
|
24621
|
-
|
|
24664
|
+
en: `### Tools
|
|
24665
|
+
|
|
24666
|
+
- \`kintone-api-key_request\`: The only way to call the kintone REST API. Use it to list apps, get field definitions, query records, and create/update records. Authentication (API Token) and base URL are configured automatically. API tokens are scoped per app \u2014 combine multiple tokens with commas to access multiple apps.
|
|
24667
|
+
|
|
24668
|
+
### kintone REST API Reference
|
|
24622
24669
|
|
|
24623
|
-
|
|
24670
|
+
#### List Apps
|
|
24624
24671
|
- GET apps.json
|
|
24625
24672
|
|
|
24626
24673
|
### Get Field Definitions
|
|
@@ -24630,20 +24677,17 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
|
|
|
24630
24677
|
- GET records.json?app={appId}&query={query}
|
|
24631
24678
|
- Query example: records.json?app=1&query=updatedTime > "2024-01-01" order by recordNumber asc limit 100
|
|
24632
24679
|
|
|
24633
|
-
|
|
24680
|
+
#### Add Record
|
|
24634
24681
|
- POST record.json
|
|
24635
24682
|
- Body: { "app": 1, "record": { "fieldName": { "value": "value" } } }
|
|
24636
24683
|
|
|
24637
|
-
|
|
24684
|
+
#### kintone Query Syntax
|
|
24638
24685
|
- Comparison: fieldName = "value", fieldName > 100
|
|
24639
24686
|
- Operators: and, or, not
|
|
24640
24687
|
- Sort: order by fieldName asc/desc
|
|
24641
24688
|
- Limit: limit 100 offset 0
|
|
24642
24689
|
- String: like "partial match"
|
|
24643
24690
|
|
|
24644
|
-
### Tips
|
|
24645
|
-
- API tokens are scoped per app. If you need to access multiple apps, you can combine multiple tokens separated by commas.
|
|
24646
|
-
|
|
24647
24691
|
### Business Logic
|
|
24648
24692
|
|
|
24649
24693
|
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.
|
|
@@ -24664,12 +24708,13 @@ await kintone.request("/k/v1/record.json", {
|
|
|
24664
24708
|
body: JSON.stringify({ app: 1, record: { title: { value: "Hello" } } }),
|
|
24665
24709
|
});
|
|
24666
24710
|
\`\`\``,
|
|
24667
|
-
ja: `###
|
|
24668
|
-
|
|
24669
|
-
- \
|
|
24670
|
-
|
|
24711
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
24712
|
+
|
|
24713
|
+
- \`kintone-api-key_request\`: kintone REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u691C\u7D22\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30C8\u30FC\u30AF\u30F3\uFF09\u3068\u30D9\u30FC\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002API\u30C8\u30FC\u30AF\u30F3\u306F\u30A2\u30D7\u30EA\u3054\u3068\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059 \u2014 \u8907\u6570\u306E\u30A2\u30D7\u30EA\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u5834\u5408\u306F\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u30C8\u30FC\u30AF\u30F3\u3092\u7D44\u307F\u5408\u308F\u305B\u3066\u304F\u3060\u3055\u3044\u3002
|
|
24714
|
+
|
|
24715
|
+
### kintone REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
24671
24716
|
|
|
24672
|
-
|
|
24717
|
+
#### \u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97
|
|
24673
24718
|
- GET apps.json
|
|
24674
24719
|
|
|
24675
24720
|
### \u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97
|
|
@@ -24679,20 +24724,17 @@ await kintone.request("/k/v1/record.json", {
|
|
|
24679
24724
|
- GET records.json?app={appId}&query={query}
|
|
24680
24725
|
- \u30AF\u30A8\u30EA\u4F8B: records.json?app=1&query=updatedTime > "2024-01-01" order by recordNumber asc limit 100
|
|
24681
24726
|
|
|
24682
|
-
|
|
24727
|
+
#### \u30EC\u30B3\u30FC\u30C9\u306E\u8FFD\u52A0
|
|
24683
24728
|
- POST record.json
|
|
24684
24729
|
- Body: { "app": 1, "record": { "fieldName": { "value": "value" } } }
|
|
24685
24730
|
|
|
24686
|
-
|
|
24731
|
+
#### kintone \u30AF\u30A8\u30EA\u69CB\u6587
|
|
24687
24732
|
- \u6BD4\u8F03: fieldName = "value", fieldName > 100
|
|
24688
24733
|
- \u6F14\u7B97\u5B50: and, or, not
|
|
24689
24734
|
- \u30BD\u30FC\u30C8: order by fieldName asc/desc
|
|
24690
24735
|
- \u5236\u9650: limit 100 offset 0
|
|
24691
24736
|
- \u6587\u5B57\u5217: like "\u90E8\u5206\u4E00\u81F4"
|
|
24692
24737
|
|
|
24693
|
-
### \u30D2\u30F3\u30C8
|
|
24694
|
-
- API\u30C8\u30FC\u30AF\u30F3\u306F\u30A2\u30D7\u30EA\u3054\u3068\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u8907\u6570\u306E\u30A2\u30D7\u30EA\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u5834\u5408\u306F\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u8907\u6570\u306E\u30C8\u30FC\u30AF\u30F3\u3092\u7D44\u307F\u5408\u308F\u305B\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002
|
|
24695
|
-
|
|
24696
24738
|
### Business Logic
|
|
24697
24739
|
|
|
24698
24740
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
@@ -25759,6 +25801,22 @@ export default async function handler(c: Context) {
|
|
|
25759
25801
|
tools: tools25
|
|
25760
25802
|
});
|
|
25761
25803
|
|
|
25804
|
+
// ../connectors/src/connectors/amplitude/setup.ts
|
|
25805
|
+
var amplitudeOnboarding = new ConnectorOnboarding({
|
|
25806
|
+
dataOverviewInstructions: {
|
|
25807
|
+
en: `1. Check the connection's region parameter: use https://analytics.eu.amplitude.com for EU, https://amplitude.com for US (default)
|
|
25808
|
+
2. Call amplitude_request with GET {baseUrl}/api/2/events/list to list available event types
|
|
25809
|
+
3. Call amplitude_request with GET {baseUrl}/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH to export raw event data for a time range
|
|
25810
|
+
4. Use GET {baseUrl}/api/2/usersearch?user=QUERY and GET {baseUrl}/api/2/useractivity?user=AMPLITUDE_ID to explore user-level data
|
|
25811
|
+
NOTE: The Dashboard REST API endpoints (events/segmentation, funnels, retention, etc.) require a paid Growth or Enterprise plan. If you get a 403 Forbidden error, fall back to the Export API (/api/2/export) to retrieve raw events and perform aggregation in code instead.`,
|
|
25812
|
+
ja: `1. \u63A5\u7D9A\u306Eregion\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u78BA\u8A8D\uFF1AEU\u306E\u5834\u5408\u306F https://analytics.eu.amplitude.com\u3001US\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8\uFF09\u306E\u5834\u5408\u306F https://amplitude.com \u3092\u4F7F\u7528
|
|
25813
|
+
2. amplitude_request \u3067 GET {baseUrl}/api/2/events/list \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u4E00\u89A7\u3092\u53D6\u5F97
|
|
25814
|
+
3. amplitude_request \u3067 GET {baseUrl}/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH \u3092\u547C\u3073\u51FA\u3057\u3001\u6307\u5B9A\u671F\u9593\u306E\u751F\u30A4\u30D9\u30F3\u30C8\u30C7\u30FC\u30BF\u3092\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8
|
|
25815
|
+
4. GET {baseUrl}/api/2/usersearch?user=QUERY \u3084 GET {baseUrl}/api/2/useractivity?user=AMPLITUDE_ID \u3067\u30E6\u30FC\u30B6\u30FC\u30EC\u30D9\u30EB\u306E\u30C7\u30FC\u30BF\u3092\u63A2\u7D22
|
|
25816
|
+
\u6CE8\u610F: Dashboard REST API\uFF08events/segmentation\u3001funnels\u3001retention\u7B49\uFF09\u306F\u6709\u6599\u306EGrowth\u307E\u305F\u306FEnterprise\u30D7\u30E9\u30F3\u304C\u5FC5\u8981\u3067\u3059\u3002403 Forbidden\u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u306F\u3001Export API\uFF08/api/2/export\uFF09\u3067\u751F\u30A4\u30D9\u30F3\u30C8\u3092\u53D6\u5F97\u3057\u3001\u30B3\u30FC\u30C9\u4E0A\u3067\u96C6\u8A08\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
25817
|
+
}
|
|
25818
|
+
});
|
|
25819
|
+
|
|
25762
25820
|
// ../connectors/src/connectors/amplitude/parameters.ts
|
|
25763
25821
|
var parameters26 = {
|
|
25764
25822
|
apiKey: new ParameterDefinition({
|
|
@@ -25778,11 +25836,106 @@ var parameters26 = {
|
|
|
25778
25836
|
type: "text",
|
|
25779
25837
|
secret: true,
|
|
25780
25838
|
required: true
|
|
25839
|
+
}),
|
|
25840
|
+
region: new ParameterDefinition({
|
|
25841
|
+
slug: "region",
|
|
25842
|
+
name: "Region",
|
|
25843
|
+
description: 'Amplitude data region. Set to "eu" if your Amplitude project is hosted in the EU. Leave empty for US (default).',
|
|
25844
|
+
envVarBaseKey: "AMPLITUDE_REGION",
|
|
25845
|
+
type: "text",
|
|
25846
|
+
secret: false,
|
|
25847
|
+
required: false
|
|
25781
25848
|
})
|
|
25782
25849
|
};
|
|
25783
25850
|
|
|
25851
|
+
// ../connectors/src/connectors/amplitude/tools/request.ts
|
|
25852
|
+
import { z as z30 } from "zod";
|
|
25853
|
+
var REQUEST_TIMEOUT_MS19 = 6e4;
|
|
25854
|
+
var inputSchema30 = z30.object({
|
|
25855
|
+
toolUseIntent: z30.string().optional().describe(
|
|
25856
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
25857
|
+
),
|
|
25858
|
+
connectionId: z30.string().describe("ID of the Amplitude connection to use"),
|
|
25859
|
+
method: z30.enum(["GET", "POST"]).describe(
|
|
25860
|
+
"HTTP method. GET for most read endpoints (events/list, export, usersearch, useractivity). POST is rarely needed."
|
|
25861
|
+
),
|
|
25862
|
+
url: z30.string().describe(
|
|
25863
|
+
"Full URL including query parameters (e.g., 'https://amplitude.com/api/2/events/list', 'https://amplitude.com/api/2/export?start=20240101T00&end=20240102T00')"
|
|
25864
|
+
),
|
|
25865
|
+
body: z30.record(z30.string(), z30.unknown()).optional().describe("Request body (JSON) for POST requests")
|
|
25866
|
+
});
|
|
25867
|
+
var outputSchema30 = z30.discriminatedUnion("success", [
|
|
25868
|
+
z30.object({
|
|
25869
|
+
success: z30.literal(true),
|
|
25870
|
+
status: z30.number(),
|
|
25871
|
+
data: z30.record(z30.string(), z30.unknown())
|
|
25872
|
+
}),
|
|
25873
|
+
z30.object({
|
|
25874
|
+
success: z30.literal(false),
|
|
25875
|
+
error: z30.string()
|
|
25876
|
+
})
|
|
25877
|
+
]);
|
|
25878
|
+
var requestTool13 = new ConnectorTool({
|
|
25879
|
+
name: "request",
|
|
25880
|
+
description: `Send authenticated requests to the Amplitude REST API.
|
|
25881
|
+
Authentication is handled automatically using Basic auth (API Key + Secret Key).
|
|
25882
|
+
Provide the full URL including any query parameters.
|
|
25883
|
+
Base URL by region: US \u2192 https://amplitude.com, EU \u2192 https://analytics.eu.amplitude.com. Check the connection's region parameter to determine which base URL to use.
|
|
25884
|
+
|
|
25885
|
+
Recommended endpoints (available on all plans):
|
|
25886
|
+
- GET {baseUrl}/api/2/events/list \u2014 list event types
|
|
25887
|
+
- GET {baseUrl}/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH \u2014 export raw events
|
|
25888
|
+
- GET {baseUrl}/api/2/usersearch?user=QUERY \u2014 search users
|
|
25889
|
+
- GET {baseUrl}/api/2/useractivity?user=AMPLITUDE_ID \u2014 user activity
|
|
25890
|
+
|
|
25891
|
+
IMPORTANT: Dashboard REST API endpoints (events/segmentation, funnels, retention, revenue, etc.) require a paid Growth or Enterprise plan and will return 403 Forbidden on free plans. Always try the Export API first and aggregate data in code.`,
|
|
25892
|
+
inputSchema: inputSchema30,
|
|
25893
|
+
outputSchema: outputSchema30,
|
|
25894
|
+
async execute({ connectionId, method, url, body }, connections) {
|
|
25895
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
25896
|
+
if (!connection) {
|
|
25897
|
+
return {
|
|
25898
|
+
success: false,
|
|
25899
|
+
error: `Connection ${connectionId} not found`
|
|
25900
|
+
};
|
|
25901
|
+
}
|
|
25902
|
+
console.log(
|
|
25903
|
+
`[connector-request] amplitude/${connection.name}: ${method} ${url}`
|
|
25904
|
+
);
|
|
25905
|
+
try {
|
|
25906
|
+
const apiKey = parameters26.apiKey.getValue(connection);
|
|
25907
|
+
const secretKey = parameters26.secretKey.getValue(connection);
|
|
25908
|
+
const authToken = btoa(`${apiKey}:${secretKey}`);
|
|
25909
|
+
const controller = new AbortController();
|
|
25910
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS19);
|
|
25911
|
+
try {
|
|
25912
|
+
const response = await fetch(url, {
|
|
25913
|
+
method,
|
|
25914
|
+
headers: {
|
|
25915
|
+
Authorization: `Basic ${authToken}`,
|
|
25916
|
+
"Content-Type": "application/json"
|
|
25917
|
+
},
|
|
25918
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
25919
|
+
signal: controller.signal
|
|
25920
|
+
});
|
|
25921
|
+
const data = await response.json();
|
|
25922
|
+
if (!response.ok) {
|
|
25923
|
+
const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
|
|
25924
|
+
return { success: false, error: errorMessage };
|
|
25925
|
+
}
|
|
25926
|
+
return { success: true, status: response.status, data };
|
|
25927
|
+
} finally {
|
|
25928
|
+
clearTimeout(timeout);
|
|
25929
|
+
}
|
|
25930
|
+
} catch (err) {
|
|
25931
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
25932
|
+
return { success: false, error: msg };
|
|
25933
|
+
}
|
|
25934
|
+
}
|
|
25935
|
+
});
|
|
25936
|
+
|
|
25784
25937
|
// ../connectors/src/connectors/amplitude/index.ts
|
|
25785
|
-
var tools26 = {};
|
|
25938
|
+
var tools26 = { request: requestTool13 };
|
|
25786
25939
|
var amplitudeConnector = new ConnectorPlugin({
|
|
25787
25940
|
slug: "amplitude",
|
|
25788
25941
|
authType: null,
|
|
@@ -25791,57 +25944,154 @@ var amplitudeConnector = new ConnectorPlugin({
|
|
|
25791
25944
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2UBJSdRlFJaLq52WUCTBEB/308b59b374cf6c662ac70989860bffd7/amplitude-icon.svg",
|
|
25792
25945
|
parameters: parameters26,
|
|
25793
25946
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
25947
|
+
onboarding: amplitudeOnboarding,
|
|
25794
25948
|
systemPrompt: {
|
|
25795
|
-
en: `###
|
|
25796
|
-
|
|
25949
|
+
en: `### Tools
|
|
25950
|
+
|
|
25951
|
+
- \`amplitude_request\`: The only way to call the Amplitude REST API. Use it for event segmentation, listing event types, user search, user activity, and data export. Authentication (Basic auth with API Key + Secret Key) is configured automatically. Provide the full URL including query parameters \u2014 the base URL varies by endpoint.
|
|
25952
|
+
|
|
25953
|
+
### Business Logic
|
|
25954
|
+
|
|
25955
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
25956
|
+
|
|
25957
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
25958
|
+
- \`client.request(url, init?)\` \u2014 low-level authenticated fetch (provide full URL)
|
|
25959
|
+
- \`client.listEventTypes()\` \u2014 list all event types
|
|
25960
|
+
- \`client.eventSegmentation(options)\` \u2014 run event segmentation query (e, start, end, m?, i?, g?)
|
|
25961
|
+
- \`client.userSearch(query)\` \u2014 search users by user or amplitude ID
|
|
25962
|
+
- \`client.userActivity(amplitudeId, options?)\` \u2014 get user activity by amplitude ID
|
|
25797
25963
|
|
|
25798
25964
|
\`\`\`ts
|
|
25965
|
+
import type { Context } from "hono";
|
|
25799
25966
|
import { connection } from "@squadbase/vite-server/connectors/amplitude";
|
|
25800
25967
|
|
|
25801
|
-
const
|
|
25968
|
+
const amp = connection("<connectionId>");
|
|
25802
25969
|
|
|
25803
|
-
|
|
25804
|
-
const
|
|
25805
|
-
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
});
|
|
25809
|
-
|
|
25970
|
+
export default async function handler(c: Context) {
|
|
25971
|
+
const { eventType, start, end } = await c.req.json<{
|
|
25972
|
+
eventType: string;
|
|
25973
|
+
start: string;
|
|
25974
|
+
end: string;
|
|
25975
|
+
}>();
|
|
25976
|
+
|
|
25977
|
+
const result = await amp.eventSegmentation({
|
|
25978
|
+
e: { event_type: eventType },
|
|
25979
|
+
start,
|
|
25980
|
+
end,
|
|
25981
|
+
});
|
|
25982
|
+
|
|
25983
|
+
return c.json(result);
|
|
25984
|
+
}
|
|
25810
25985
|
\`\`\`
|
|
25811
25986
|
|
|
25812
|
-
###
|
|
25813
|
-
|
|
25987
|
+
### Amplitude REST API Reference
|
|
25988
|
+
|
|
25989
|
+
- Authentication: Basic auth (API Key:Secret Key, handled automatically)
|
|
25990
|
+
- All timestamps use YYYYMMDD format for date parameters
|
|
25991
|
+
|
|
25992
|
+
#### Endpoints Available on All Plans
|
|
25814
25993
|
- GET \`https://amplitude.com/api/2/events/list\` \u2014 List event types
|
|
25815
|
-
- GET \`https://amplitude.com/api/2/
|
|
25816
|
-
- GET \`https://amplitude.com/api/2/
|
|
25817
|
-
-
|
|
25818
|
-
|
|
25819
|
-
|
|
25994
|
+
- GET \`https://amplitude.com/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH\` \u2014 Export raw events
|
|
25995
|
+
- GET \`https://amplitude.com/api/2/usersearch?user=QUERY\` \u2014 Search users
|
|
25996
|
+
- GET \`https://amplitude.com/api/2/useractivity?user=AMPLITUDE_ID\` \u2014 User activity
|
|
25997
|
+
|
|
25998
|
+
#### Endpoints Requiring Growth or Enterprise Plan (will return 403 on free/Starter plans)
|
|
25999
|
+
- GET \`https://amplitude.com/api/2/events/segmentation\` \u2014 Event segmentation
|
|
26000
|
+
- GET \`https://amplitude.com/api/2/funnels\` \u2014 Funnel analysis
|
|
26001
|
+
- GET \`https://amplitude.com/api/2/retention\` \u2014 Retention analysis
|
|
26002
|
+
- GET \`https://amplitude.com/api/2/revenue\` \u2014 Revenue analysis
|
|
26003
|
+
|
|
26004
|
+
IMPORTANT: Always start with the endpoints available on all plans. If you need aggregated analytics, use the Export API to retrieve raw events and aggregate in code. Only attempt the Dashboard REST API endpoints (segmentation, funnels, retention, revenue) if specifically requested, and handle 403 errors gracefully by falling back to the Export API.
|
|
26005
|
+
|
|
26006
|
+
#### Event Segmentation Query Parameters (Growth/Enterprise only)
|
|
26007
|
+
- \`e\` \u2014 JSON-encoded event definition (e.g., \`{"event_type":"Click"}\`)
|
|
26008
|
+
- \`start\` \u2014 Start date (YYYYMMDD)
|
|
26009
|
+
- \`end\` \u2014 End date (YYYYMMDD)
|
|
26010
|
+
- \`m\` \u2014 Metric type (uniques, totals, avg, etc.)
|
|
26011
|
+
- \`i\` \u2014 Interval (1=daily, 7=weekly, 30=monthly)
|
|
26012
|
+
- \`g\` \u2014 Group by property`,
|
|
26013
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
26014
|
+
|
|
26015
|
+
- \`amplitude_request\`: Amplitude REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A4\u30D9\u30F3\u30C8\u30BB\u30B0\u30E1\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3001\u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u4E00\u89A7\u3001\u30E6\u30FC\u30B6\u30FC\u691C\u7D22\u3001\u30E6\u30FC\u30B6\u30FC\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3001\u30C7\u30FC\u30BF\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API Key + Secret Key\u306B\u3088\u308BBasic\u8A8D\u8A3C\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u542B\u3080\u5B8C\u5168\u306AURL\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044 \u2014 \u30D9\u30FC\u30B9URL\u306F\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u3088\u3063\u3066\u7570\u306A\u308A\u307E\u3059\u3002
|
|
26016
|
+
|
|
26017
|
+
### Business Logic
|
|
26018
|
+
|
|
26019
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
26020
|
+
|
|
26021
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
26022
|
+
- \`client.request(url, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch\uFF08\u5B8C\u5168\u306AURL\u3092\u6307\u5B9A\uFF09
|
|
26023
|
+
- \`client.listEventTypes()\` \u2014 \u5168\u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u306E\u4E00\u89A7
|
|
26024
|
+
- \`client.eventSegmentation(options)\` \u2014 \u30A4\u30D9\u30F3\u30C8\u30BB\u30B0\u30E1\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u30AF\u30A8\u30EA\u306E\u5B9F\u884C\uFF08e, start, end, m?, i?, g?\uFF09
|
|
26025
|
+
- \`client.userSearch(query)\` \u2014 \u30E6\u30FC\u30B6\u30FC\u307E\u305F\u306Famplitude ID\u3067\u30E6\u30FC\u30B6\u30FC\u3092\u691C\u7D22
|
|
26026
|
+
- \`client.userActivity(amplitudeId, options?)\` \u2014 amplitude ID\u3067\u30E6\u30FC\u30B6\u30FC\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u53D6\u5F97
|
|
25820
26027
|
|
|
25821
26028
|
\`\`\`ts
|
|
26029
|
+
import type { Context } from "hono";
|
|
25822
26030
|
import { connection } from "@squadbase/vite-server/connectors/amplitude";
|
|
25823
26031
|
|
|
25824
|
-
const
|
|
26032
|
+
const amp = connection("<connectionId>");
|
|
25825
26033
|
|
|
25826
|
-
|
|
25827
|
-
const
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
});
|
|
25832
|
-
|
|
26034
|
+
export default async function handler(c: Context) {
|
|
26035
|
+
const { eventType, start, end } = await c.req.json<{
|
|
26036
|
+
eventType: string;
|
|
26037
|
+
start: string;
|
|
26038
|
+
end: string;
|
|
26039
|
+
}>();
|
|
26040
|
+
|
|
26041
|
+
const result = await amp.eventSegmentation({
|
|
26042
|
+
e: { event_type: eventType },
|
|
26043
|
+
start,
|
|
26044
|
+
end,
|
|
26045
|
+
});
|
|
26046
|
+
|
|
26047
|
+
return c.json(result);
|
|
26048
|
+
}
|
|
25833
26049
|
\`\`\`
|
|
25834
26050
|
|
|
25835
|
-
### \
|
|
25836
|
-
|
|
26051
|
+
### Amplitude REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
26052
|
+
|
|
26053
|
+
- \u8A8D\u8A3C: Basic\u8A8D\u8A3C\uFF08API Key:Secret Key\u3001\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
26054
|
+
- \u65E5\u4ED8\u30D1\u30E9\u30E1\u30FC\u30BF\u306F\u3059\u3079\u3066YYYYMMDD\u5F62\u5F0F\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u4F7F\u7528
|
|
26055
|
+
|
|
26056
|
+
#### \u5168\u30D7\u30E9\u30F3\u3067\u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
25837
26057
|
- GET \`https://amplitude.com/api/2/events/list\` \u2014 \u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u4E00\u89A7
|
|
25838
|
-
- GET \`https://amplitude.com/api/2/
|
|
25839
|
-
- GET \`https://amplitude.com/api/2/
|
|
25840
|
-
-
|
|
26058
|
+
- GET \`https://amplitude.com/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH\` \u2014 \u751F\u30A4\u30D9\u30F3\u30C8\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8
|
|
26059
|
+
- GET \`https://amplitude.com/api/2/usersearch?user=QUERY\` \u2014 \u30E6\u30FC\u30B6\u30FC\u691C\u7D22
|
|
26060
|
+
- GET \`https://amplitude.com/api/2/useractivity?user=AMPLITUDE_ID\` \u2014 \u30E6\u30FC\u30B6\u30FC\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3
|
|
26061
|
+
|
|
26062
|
+
#### Growth\u307E\u305F\u306FEnterprise\u30D7\u30E9\u30F3\u304C\u5FC5\u8981\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u7121\u6599/Starter\u30D7\u30E9\u30F3\u3067\u306F403\u30A8\u30E9\u30FC\uFF09
|
|
26063
|
+
- GET \`https://amplitude.com/api/2/events/segmentation\` \u2014 \u30A4\u30D9\u30F3\u30C8\u30BB\u30B0\u30E1\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3
|
|
26064
|
+
- GET \`https://amplitude.com/api/2/funnels\` \u2014 \u30D5\u30A1\u30CD\u30EB\u5206\u6790
|
|
26065
|
+
- GET \`https://amplitude.com/api/2/retention\` \u2014 \u30EA\u30C6\u30F3\u30B7\u30E7\u30F3\u5206\u6790
|
|
26066
|
+
- GET \`https://amplitude.com/api/2/revenue\` \u2014 \u53CE\u76CA\u5206\u6790
|
|
26067
|
+
|
|
26068
|
+
\u91CD\u8981: \u307E\u305A\u5168\u30D7\u30E9\u30F3\u3067\u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u96C6\u8A08\u5206\u6790\u304C\u5FC5\u8981\u306A\u5834\u5408\u306F\u3001Export API\u3067\u751F\u30A4\u30D9\u30F3\u30C8\u3092\u53D6\u5F97\u3057\u3001\u30B3\u30FC\u30C9\u4E0A\u3067\u96C6\u8A08\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002Dashboard REST API\uFF08segmentation\u3001funnels\u3001retention\u3001revenue\uFF09\u306F\u660E\u793A\u7684\u306B\u8981\u6C42\u3055\u308C\u305F\u5834\u5408\u306E\u307F\u8A66\u884C\u3057\u3001403\u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u306FExport API\u306B\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
26069
|
+
|
|
26070
|
+
#### \u30A4\u30D9\u30F3\u30C8\u30BB\u30B0\u30E1\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\uFF08Growth/Enterprise\u30D7\u30E9\u30F3\u306E\u307F\uFF09
|
|
26071
|
+
- \`e\` \u2014 JSON\u30A8\u30F3\u30B3\u30FC\u30C9\u3055\u308C\u305F\u30A4\u30D9\u30F3\u30C8\u5B9A\u7FA9\uFF08\u4F8B: \`{"event_type":"Click"}\`\uFF09
|
|
26072
|
+
- \`start\` \u2014 \u958B\u59CB\u65E5\uFF08YYYYMMDD\uFF09
|
|
26073
|
+
- \`end\` \u2014 \u7D42\u4E86\u65E5\uFF08YYYYMMDD\uFF09
|
|
26074
|
+
- \`m\` \u2014 \u30E1\u30C8\u30EA\u30AF\u30B9\u30BF\u30A4\u30D7\uFF08uniques, totals, avg\u306A\u3069\uFF09
|
|
26075
|
+
- \`i\` \u2014 \u30A4\u30F3\u30BF\u30FC\u30D0\u30EB\uFF081=\u65E5\u6B21\u30017=\u9031\u6B21\u300130=\u6708\u6B21\uFF09
|
|
26076
|
+
- \`g\` \u2014 \u30B0\u30EB\u30FC\u30D7\u5316\u30D7\u30ED\u30D1\u30C6\u30A3`
|
|
25841
26077
|
},
|
|
25842
26078
|
tools: tools26
|
|
25843
26079
|
});
|
|
25844
26080
|
|
|
26081
|
+
// ../connectors/src/connectors/attio/setup.ts
|
|
26082
|
+
var attioOnboarding = new ConnectorOnboarding({
|
|
26083
|
+
dataOverviewInstructions: {
|
|
26084
|
+
en: `1. Call attio_request with GET /objects to list all available objects (people, companies, deals, etc.)
|
|
26085
|
+
2. Call attio_request with GET /objects/people/attributes to explore the people object attributes
|
|
26086
|
+
3. Call attio_request with POST /objects/people/records/query with { "limit": 5 } to sample people records
|
|
26087
|
+
4. Explore other objects (companies, deals) as needed`,
|
|
26088
|
+
ja: `1. attio_request \u3067 GET /objects \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
26089
|
+
2. attio_request \u3067 GET /objects/people/attributes \u3092\u547C\u3073\u51FA\u3057\u3001people\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u3092\u78BA\u8A8D
|
|
26090
|
+
3. attio_request \u3067 POST /objects/people/records/query \u3092 { "limit": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001people\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
26091
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\uFF08companies\u3001deals\uFF09\u3092\u63A2\u7D22`
|
|
26092
|
+
}
|
|
26093
|
+
});
|
|
26094
|
+
|
|
25845
26095
|
// ../connectors/src/connectors/attio/parameters.ts
|
|
25846
26096
|
var parameters27 = {
|
|
25847
26097
|
apiKey: new ParameterDefinition({
|
|
@@ -25855,8 +26105,86 @@ var parameters27 = {
|
|
|
25855
26105
|
})
|
|
25856
26106
|
};
|
|
25857
26107
|
|
|
26108
|
+
// ../connectors/src/connectors/attio/tools/request.ts
|
|
26109
|
+
import { z as z31 } from "zod";
|
|
26110
|
+
var BASE_URL11 = "https://api.attio.com/v2";
|
|
26111
|
+
var REQUEST_TIMEOUT_MS20 = 6e4;
|
|
26112
|
+
var inputSchema31 = z31.object({
|
|
26113
|
+
toolUseIntent: z31.string().optional().describe(
|
|
26114
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
26115
|
+
),
|
|
26116
|
+
connectionId: z31.string().describe("ID of the Attio connection to use"),
|
|
26117
|
+
method: z31.enum(["GET", "POST", "PATCH", "DELETE"]).describe(
|
|
26118
|
+
"HTTP method. GET for reading resources, POST for creating or querying records, PATCH for updating, DELETE for removing."
|
|
26119
|
+
),
|
|
26120
|
+
path: z31.string().describe(
|
|
26121
|
+
"API path (e.g., '/objects', '/objects/people/records/query', '/objects/companies/records/{record_id}')"
|
|
26122
|
+
),
|
|
26123
|
+
body: z31.record(z31.string(), z31.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
26124
|
+
});
|
|
26125
|
+
var outputSchema31 = z31.discriminatedUnion("success", [
|
|
26126
|
+
z31.object({
|
|
26127
|
+
success: z31.literal(true),
|
|
26128
|
+
status: z31.number(),
|
|
26129
|
+
data: z31.record(z31.string(), z31.unknown())
|
|
26130
|
+
}),
|
|
26131
|
+
z31.object({
|
|
26132
|
+
success: z31.literal(false),
|
|
26133
|
+
error: z31.string()
|
|
26134
|
+
})
|
|
26135
|
+
]);
|
|
26136
|
+
var requestTool14 = new ConnectorTool({
|
|
26137
|
+
name: "request",
|
|
26138
|
+
description: `Send authenticated requests to the Attio REST API.
|
|
26139
|
+
Authentication is handled automatically using the API Key (Bearer token).
|
|
26140
|
+
Use this tool for all Attio API interactions: querying records (people, companies, deals), listing objects and attributes, managing list entries, and working with notes.
|
|
26141
|
+
Note that querying records uses POST (not GET) with a request body for filters.`,
|
|
26142
|
+
inputSchema: inputSchema31,
|
|
26143
|
+
outputSchema: outputSchema31,
|
|
26144
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
26145
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
26146
|
+
if (!connection) {
|
|
26147
|
+
return {
|
|
26148
|
+
success: false,
|
|
26149
|
+
error: `Connection ${connectionId} not found`
|
|
26150
|
+
};
|
|
26151
|
+
}
|
|
26152
|
+
console.log(
|
|
26153
|
+
`[connector-request] attio/${connection.name}: ${method} ${path5}`
|
|
26154
|
+
);
|
|
26155
|
+
try {
|
|
26156
|
+
const apiKey = parameters27.apiKey.getValue(connection);
|
|
26157
|
+
const url = `${BASE_URL11}${path5}`;
|
|
26158
|
+
const controller = new AbortController();
|
|
26159
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS20);
|
|
26160
|
+
try {
|
|
26161
|
+
const response = await fetch(url, {
|
|
26162
|
+
method,
|
|
26163
|
+
headers: {
|
|
26164
|
+
Authorization: `Bearer ${apiKey}`,
|
|
26165
|
+
"Content-Type": "application/json"
|
|
26166
|
+
},
|
|
26167
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
26168
|
+
signal: controller.signal
|
|
26169
|
+
});
|
|
26170
|
+
const data = await response.json();
|
|
26171
|
+
if (!response.ok) {
|
|
26172
|
+
const errorMessage = typeof data?.message === "string" ? data.message : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
26173
|
+
return { success: false, error: errorMessage };
|
|
26174
|
+
}
|
|
26175
|
+
return { success: true, status: response.status, data };
|
|
26176
|
+
} finally {
|
|
26177
|
+
clearTimeout(timeout);
|
|
26178
|
+
}
|
|
26179
|
+
} catch (err) {
|
|
26180
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
26181
|
+
return { success: false, error: msg };
|
|
26182
|
+
}
|
|
26183
|
+
}
|
|
26184
|
+
});
|
|
26185
|
+
|
|
25858
26186
|
// ../connectors/src/connectors/attio/index.ts
|
|
25859
|
-
var tools27 = {};
|
|
26187
|
+
var tools27 = { request: requestTool14 };
|
|
25860
26188
|
var attioConnector = new ConnectorPlugin({
|
|
25861
26189
|
slug: "attio",
|
|
25862
26190
|
authType: null,
|
|
@@ -25865,97 +26193,275 @@ var attioConnector = new ConnectorPlugin({
|
|
|
25865
26193
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2qqx99vvXJojUM3tSrSWPX/1e7c35e13da6b365b8b475c1effe568f/attio.svg",
|
|
25866
26194
|
parameters: parameters27,
|
|
25867
26195
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
26196
|
+
onboarding: attioOnboarding,
|
|
25868
26197
|
systemPrompt: {
|
|
25869
|
-
en: `###
|
|
25870
|
-
|
|
26198
|
+
en: `### Tools
|
|
26199
|
+
|
|
26200
|
+
- \`attio_request\`: The only way to call the Attio REST API. Use it to query records (people, companies, deals), list objects and attributes, manage list entries, and work with notes. Authentication (Bearer token) is configured automatically. Note that querying records uses POST (not GET) with a request body containing filters.
|
|
26201
|
+
|
|
26202
|
+
### Business Logic
|
|
26203
|
+
|
|
26204
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
26205
|
+
|
|
26206
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
26207
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
26208
|
+
- \`client.listObjects()\` \u2014 list all objects (people, companies, deals, etc.)
|
|
26209
|
+
- \`client.listAttributes(object)\` \u2014 list attributes for an object
|
|
26210
|
+
- \`client.queryRecords(object, options?)\` \u2014 query records with filter/sort/pagination
|
|
26211
|
+
- \`client.getRecord(object, recordId)\` \u2014 fetch a single record
|
|
26212
|
+
- \`client.queryListEntries(listId, options?)\` \u2014 query list entries with filter/sort/pagination
|
|
25871
26213
|
|
|
25872
26214
|
\`\`\`ts
|
|
26215
|
+
import type { Context } from "hono";
|
|
25873
26216
|
import { connection } from "@squadbase/vite-server/connectors/attio";
|
|
25874
26217
|
|
|
25875
|
-
const
|
|
26218
|
+
const attio = connection("<connectionId>");
|
|
25876
26219
|
|
|
25877
|
-
|
|
25878
|
-
const
|
|
25879
|
-
|
|
25880
|
-
|
|
25881
|
-
|
|
25882
|
-
|
|
25883
|
-
},
|
|
25884
|
-
|
|
25885
|
-
});
|
|
25886
|
-
|
|
26220
|
+
export default async function handler(c: Context) {
|
|
26221
|
+
const { object = "people", limit = 25 } = await c.req.json<{
|
|
26222
|
+
object?: string;
|
|
26223
|
+
limit?: number;
|
|
26224
|
+
}>();
|
|
26225
|
+
|
|
26226
|
+
const { data } = await attio.queryRecords(object, { limit });
|
|
26227
|
+
|
|
26228
|
+
return c.json({ records: data });
|
|
26229
|
+
}
|
|
25887
26230
|
\`\`\`
|
|
25888
26231
|
|
|
25889
|
-
###
|
|
26232
|
+
### Attio REST API Reference
|
|
26233
|
+
|
|
26234
|
+
- Base URL: \`https://api.attio.com/v2\`
|
|
26235
|
+
- Authentication: Bearer token (handled automatically)
|
|
26236
|
+
- Querying records uses POST with JSON body (not GET with query params)
|
|
26237
|
+
|
|
26238
|
+
#### Common Endpoints
|
|
26239
|
+
- GET \`/objects\` \u2014 List all objects
|
|
26240
|
+
- GET \`/objects/{object}/attributes\` \u2014 List attributes of an object
|
|
25890
26241
|
- POST \`/objects/{object}/records/query\` \u2014 Query records (people, companies, deals, etc.)
|
|
25891
26242
|
- GET \`/objects/{object}/records/{record_id}\` \u2014 Get a record
|
|
25892
26243
|
- POST \`/objects/{object}/records\` \u2014 Create a record
|
|
25893
26244
|
- PATCH \`/objects/{object}/records/{record_id}\` \u2014 Update a record
|
|
25894
26245
|
- DELETE \`/objects/{object}/records/{record_id}\` \u2014 Delete a record
|
|
25895
|
-
- GET \`/objects\` \u2014 List all objects
|
|
25896
|
-
- GET \`/objects/{object}/attributes\` \u2014 List attributes of an object
|
|
25897
26246
|
- POST \`/lists/{list_id}/entries/query\` \u2014 Query list entries
|
|
25898
26247
|
- POST \`/notes\` \u2014 Create a note
|
|
25899
|
-
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 Get notes for a record
|
|
25900
|
-
|
|
25901
|
-
|
|
26248
|
+
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 Get notes for a record
|
|
26249
|
+
|
|
26250
|
+
#### Query Body (for POST /objects/{object}/records/query)
|
|
26251
|
+
- \`filter\` \u2014 Filter conditions
|
|
26252
|
+
- \`sorts\` \u2014 Array of sort specifications
|
|
26253
|
+
- \`limit\` \u2014 Max records per page (default 25)
|
|
26254
|
+
- \`offset\` \u2014 Pagination offset`,
|
|
26255
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
26256
|
+
|
|
26257
|
+
- \`attio_request\`: Attio REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30EC\u30B3\u30FC\u30C9\uFF08people\u3001companies\u3001deals\uFF09\u306E\u30AF\u30A8\u30EA\u3001\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3084\u5C5E\u6027\u306E\u4E00\u89A7\u8868\u793A\u3001\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u306E\u7BA1\u7406\u3001\u30CE\u30FC\u30C8\u306E\u64CD\u4F5C\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30EC\u30B3\u30FC\u30C9\u306E\u30AF\u30A8\u30EA\u306B\u306FGET\u3067\u306F\u306A\u304FPOST\u3092\u30D5\u30A3\u30EB\u30BF\u4ED8\u304D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u30DC\u30C7\u30A3\u3067\u4F7F\u7528\u3059\u308B\u70B9\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
26258
|
+
|
|
26259
|
+
### Business Logic
|
|
26260
|
+
|
|
26261
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
26262
|
+
|
|
26263
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
26264
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
26265
|
+
- \`client.listObjects()\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
26266
|
+
- \`client.listAttributes(object)\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
26267
|
+
- \`client.queryRecords(object, options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF/\u30BD\u30FC\u30C8/\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067\u30EC\u30B3\u30FC\u30C9\u3092\u30AF\u30A8\u30EA
|
|
26268
|
+
- \`client.getRecord(object, recordId)\` \u2014 \u5358\u4E00\u30EC\u30B3\u30FC\u30C9\u3092\u53D6\u5F97
|
|
26269
|
+
- \`client.queryListEntries(listId, options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF/\u30BD\u30FC\u30C8/\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u3092\u30AF\u30A8\u30EA
|
|
25902
26270
|
|
|
25903
26271
|
\`\`\`ts
|
|
26272
|
+
import type { Context } from "hono";
|
|
25904
26273
|
import { connection } from "@squadbase/vite-server/connectors/attio";
|
|
25905
26274
|
|
|
25906
|
-
const
|
|
26275
|
+
const attio = connection("<connectionId>");
|
|
25907
26276
|
|
|
25908
|
-
|
|
25909
|
-
const
|
|
25910
|
-
|
|
25911
|
-
|
|
25912
|
-
|
|
25913
|
-
|
|
25914
|
-
},
|
|
25915
|
-
|
|
25916
|
-
});
|
|
25917
|
-
|
|
26277
|
+
export default async function handler(c: Context) {
|
|
26278
|
+
const { object = "people", limit = 25 } = await c.req.json<{
|
|
26279
|
+
object?: string;
|
|
26280
|
+
limit?: number;
|
|
26281
|
+
}>();
|
|
26282
|
+
|
|
26283
|
+
const { data } = await attio.queryRecords(object, { limit });
|
|
26284
|
+
|
|
26285
|
+
return c.json({ records: data });
|
|
26286
|
+
}
|
|
25918
26287
|
\`\`\`
|
|
25919
26288
|
|
|
25920
|
-
### \
|
|
26289
|
+
### Attio REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
26290
|
+
|
|
26291
|
+
- \u30D9\u30FC\u30B9URL: \`https://api.attio.com/v2\`
|
|
26292
|
+
- \u8A8D\u8A3C: Bearer\u30C8\u30FC\u30AF\u30F3\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
26293
|
+
- \u30EC\u30B3\u30FC\u30C9\u306E\u30AF\u30A8\u30EA\u306B\u306FGET\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u306F\u306A\u304FPOST\u3067JSON\u30DC\u30C7\u30A3\u3092\u4F7F\u7528\u3057\u307E\u3059
|
|
26294
|
+
|
|
26295
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
26296
|
+
- GET \`/objects\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7
|
|
26297
|
+
- GET \`/objects/{object}/attributes\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
25921
26298
|
- POST \`/objects/{object}/records/query\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u691C\u7D22\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
25922
26299
|
- GET \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u53D6\u5F97
|
|
25923
26300
|
- POST \`/objects/{object}/records\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u4F5C\u6210
|
|
25924
26301
|
- PATCH \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u66F4\u65B0
|
|
25925
26302
|
- DELETE \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u524A\u9664
|
|
25926
|
-
- GET \`/objects\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7
|
|
25927
|
-
- GET \`/objects/{object}/attributes\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
25928
26303
|
- POST \`/lists/{list_id}/entries/query\` \u2014 \u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u306E\u691C\u7D22
|
|
25929
26304
|
- POST \`/notes\` \u2014 \u30CE\u30FC\u30C8\u306E\u4F5C\u6210
|
|
25930
|
-
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u30CE\u30FC\u30C8\u3092\u53D6\u5F97
|
|
26305
|
+
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u30CE\u30FC\u30C8\u3092\u53D6\u5F97
|
|
26306
|
+
|
|
26307
|
+
#### \u30AF\u30A8\u30EA\u30DC\u30C7\u30A3 (POST /objects/{object}/records/query)
|
|
26308
|
+
- \`filter\` \u2014 \u30D5\u30A3\u30EB\u30BF\u6761\u4EF6
|
|
26309
|
+
- \`sorts\` \u2014 \u30BD\u30FC\u30C8\u6307\u5B9A\u306E\u914D\u5217
|
|
26310
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u30EC\u30B3\u30FC\u30C9\u6570\uFF08\u30C7\u30D5\u30A9\u30EB\u30C825\uFF09
|
|
26311
|
+
- \`offset\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8`
|
|
25931
26312
|
},
|
|
25932
26313
|
tools: tools27
|
|
25933
26314
|
});
|
|
25934
26315
|
|
|
26316
|
+
// ../connectors/src/connectors/shopify/setup.ts
|
|
26317
|
+
var shopifyOnboarding = new ConnectorOnboarding({
|
|
26318
|
+
dataOverviewInstructions: {
|
|
26319
|
+
en: `1. Call shopify_request with GET /admin/api/2024-10/products.json?limit=5 to explore products structure
|
|
26320
|
+
2. Call shopify_request with GET /admin/api/2024-10/orders.json?limit=5&status=any to explore orders structure
|
|
26321
|
+
3. Explore other endpoints (customers, inventory, collections) as needed`,
|
|
26322
|
+
ja: `1. shopify_request \u3067 GET /admin/api/2024-10/products.json?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u5546\u54C1\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
26323
|
+
2. shopify_request \u3067 GET /admin/api/2024-10/orders.json?limit=5&status=any \u3092\u547C\u3073\u51FA\u3057\u3001\u6CE8\u6587\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
26324
|
+
3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u9867\u5BA2\u3001\u5728\u5EAB\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\uFF09\u3092\u63A2\u7D22`
|
|
26325
|
+
}
|
|
26326
|
+
});
|
|
26327
|
+
|
|
25935
26328
|
// ../connectors/src/connectors/shopify/parameters.ts
|
|
25936
26329
|
var parameters28 = {
|
|
25937
|
-
accessToken: new ParameterDefinition({
|
|
25938
|
-
slug: "access-token",
|
|
25939
|
-
name: "Shopify Admin API Access Token",
|
|
25940
|
-
description: "The Shopify Admin API access token for authentication (starts with shpat_).",
|
|
25941
|
-
envVarBaseKey: "SHOPIFY_ACCESS_TOKEN",
|
|
25942
|
-
type: "text",
|
|
25943
|
-
secret: true,
|
|
25944
|
-
required: true
|
|
25945
|
-
}),
|
|
25946
26330
|
storeDomain: new ParameterDefinition({
|
|
25947
26331
|
slug: "store-domain",
|
|
25948
|
-
name: "
|
|
25949
|
-
description:
|
|
26332
|
+
name: "Shop Name",
|
|
26333
|
+
description: 'Your Shopify store name (the subdomain part of your .myshopify.com URL, e.g., "mystore" for mystore.myshopify.com).',
|
|
25950
26334
|
envVarBaseKey: "SHOPIFY_STORE_DOMAIN",
|
|
25951
26335
|
type: "text",
|
|
25952
26336
|
secret: false,
|
|
25953
26337
|
required: true
|
|
26338
|
+
}),
|
|
26339
|
+
clientId: new ParameterDefinition({
|
|
26340
|
+
slug: "client-id",
|
|
26341
|
+
name: "Client ID",
|
|
26342
|
+
description: "The Client ID (API Key) of your Shopify Custom App.",
|
|
26343
|
+
envVarBaseKey: "SHOPIFY_CLIENT_ID",
|
|
26344
|
+
type: "text",
|
|
26345
|
+
secret: false,
|
|
26346
|
+
required: true
|
|
26347
|
+
}),
|
|
26348
|
+
clientSecret: new ParameterDefinition({
|
|
26349
|
+
slug: "client-secret",
|
|
26350
|
+
name: "Client Secret",
|
|
26351
|
+
description: "The Client Secret (API Secret Key) of your Shopify Custom App.",
|
|
26352
|
+
envVarBaseKey: "SHOPIFY_CLIENT_SECRET",
|
|
26353
|
+
type: "text",
|
|
26354
|
+
secret: true,
|
|
26355
|
+
required: true
|
|
25954
26356
|
})
|
|
25955
26357
|
};
|
|
25956
26358
|
|
|
26359
|
+
// ../connectors/src/connectors/shopify/tools/request.ts
|
|
26360
|
+
import { z as z32 } from "zod";
|
|
26361
|
+
var REQUEST_TIMEOUT_MS21 = 6e4;
|
|
26362
|
+
var inputSchema32 = z32.object({
|
|
26363
|
+
toolUseIntent: z32.string().optional().describe(
|
|
26364
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
26365
|
+
),
|
|
26366
|
+
connectionId: z32.string().describe("ID of the Shopify connection to use"),
|
|
26367
|
+
method: z32.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
26368
|
+
"HTTP method. GET for reading resources (products, orders, customers), POST for creating, PUT for updating, DELETE for removing."
|
|
26369
|
+
),
|
|
26370
|
+
path: z32.string().describe(
|
|
26371
|
+
"API path including version (e.g., '/admin/api/2024-10/products.json', '/admin/api/2024-10/orders.json?limit=50')"
|
|
26372
|
+
),
|
|
26373
|
+
body: z32.record(z32.string(), z32.unknown()).optional().describe("Request body (JSON) for POST/PUT requests")
|
|
26374
|
+
});
|
|
26375
|
+
var outputSchema32 = z32.discriminatedUnion("success", [
|
|
26376
|
+
z32.object({
|
|
26377
|
+
success: z32.literal(true),
|
|
26378
|
+
status: z32.number(),
|
|
26379
|
+
data: z32.record(z32.string(), z32.unknown())
|
|
26380
|
+
}),
|
|
26381
|
+
z32.object({
|
|
26382
|
+
success: z32.literal(false),
|
|
26383
|
+
error: z32.string()
|
|
26384
|
+
})
|
|
26385
|
+
]);
|
|
26386
|
+
var requestTool15 = new ConnectorTool({
|
|
26387
|
+
name: "request",
|
|
26388
|
+
description: `Send authenticated requests to the Shopify Admin REST API.
|
|
26389
|
+
Authentication is handled automatically using Custom App credentials (Client ID + Client Secret). An access token is obtained on each request.
|
|
26390
|
+
The store domain is resolved from the connection \u2014 only provide the path starting with /admin/api/.
|
|
26391
|
+
Use this tool for all Shopify API interactions: listing products, orders, customers, inventory, collections, and more.`,
|
|
26392
|
+
inputSchema: inputSchema32,
|
|
26393
|
+
outputSchema: outputSchema32,
|
|
26394
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
26395
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
26396
|
+
if (!connection) {
|
|
26397
|
+
return {
|
|
26398
|
+
success: false,
|
|
26399
|
+
error: `Connection ${connectionId} not found`
|
|
26400
|
+
};
|
|
26401
|
+
}
|
|
26402
|
+
console.log(
|
|
26403
|
+
`[connector-request] shopify/${connection.name}: ${method} ${path5}`
|
|
26404
|
+
);
|
|
26405
|
+
try {
|
|
26406
|
+
const storeDomain = parameters28.storeDomain.getValue(connection);
|
|
26407
|
+
const clientId = parameters28.clientId.getValue(connection);
|
|
26408
|
+
const clientSecret = parameters28.clientSecret.getValue(connection);
|
|
26409
|
+
const tokenRes = await fetch(
|
|
26410
|
+
`https://${storeDomain}/admin/oauth/access_token`,
|
|
26411
|
+
{
|
|
26412
|
+
method: "POST",
|
|
26413
|
+
headers: { "Content-Type": "application/json" },
|
|
26414
|
+
body: JSON.stringify({
|
|
26415
|
+
client_id: clientId,
|
|
26416
|
+
client_secret: clientSecret
|
|
26417
|
+
})
|
|
26418
|
+
}
|
|
26419
|
+
);
|
|
26420
|
+
if (!tokenRes.ok) {
|
|
26421
|
+
const tokenBody = await tokenRes.text().catch(() => "(unreadable body)");
|
|
26422
|
+
return {
|
|
26423
|
+
success: false,
|
|
26424
|
+
error: `Failed to obtain access token: ${tokenRes.status} ${tokenRes.statusText} \u2014 ${tokenBody}`
|
|
26425
|
+
};
|
|
26426
|
+
}
|
|
26427
|
+
const tokenJson = await tokenRes.json();
|
|
26428
|
+
if (!tokenJson.access_token) {
|
|
26429
|
+
return {
|
|
26430
|
+
success: false,
|
|
26431
|
+
error: "access_token not found in token response"
|
|
26432
|
+
};
|
|
26433
|
+
}
|
|
26434
|
+
const url = `https://${storeDomain}${path5}`;
|
|
26435
|
+
const controller = new AbortController();
|
|
26436
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS21);
|
|
26437
|
+
try {
|
|
26438
|
+
const response = await fetch(url, {
|
|
26439
|
+
method,
|
|
26440
|
+
headers: {
|
|
26441
|
+
"X-Shopify-Access-Token": tokenJson.access_token,
|
|
26442
|
+
"Content-Type": "application/json"
|
|
26443
|
+
},
|
|
26444
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
26445
|
+
signal: controller.signal
|
|
26446
|
+
});
|
|
26447
|
+
const data = await response.json();
|
|
26448
|
+
if (!response.ok) {
|
|
26449
|
+
const errorMessage = typeof data?.errors === "string" ? data.errors : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
26450
|
+
return { success: false, error: errorMessage };
|
|
26451
|
+
}
|
|
26452
|
+
return { success: true, status: response.status, data };
|
|
26453
|
+
} finally {
|
|
26454
|
+
clearTimeout(timeout);
|
|
26455
|
+
}
|
|
26456
|
+
} catch (err) {
|
|
26457
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
26458
|
+
return { success: false, error: msg };
|
|
26459
|
+
}
|
|
26460
|
+
}
|
|
26461
|
+
});
|
|
26462
|
+
|
|
25957
26463
|
// ../connectors/src/connectors/shopify/index.ts
|
|
25958
|
-
var tools28 = {};
|
|
26464
|
+
var tools28 = { request: requestTool15 };
|
|
25959
26465
|
var shopifyConnector = new ConnectorPlugin({
|
|
25960
26466
|
slug: "shopify",
|
|
25961
26467
|
authType: null,
|
|
@@ -25964,89 +26470,152 @@ var shopifyConnector = new ConnectorPlugin({
|
|
|
25964
26470
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/57KEjZCBskKgSxgKyU4Sm0/117d681a410f48dc36f97cdd9c0593c5/shopify-icon.svg",
|
|
25965
26471
|
parameters: parameters28,
|
|
25966
26472
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
26473
|
+
onboarding: shopifyOnboarding,
|
|
25967
26474
|
systemPrompt: {
|
|
25968
|
-
en: `###
|
|
25969
|
-
|
|
26475
|
+
en: `### Tools
|
|
26476
|
+
|
|
26477
|
+
- \`shopify_request\`: The only way to call the Shopify Admin REST API. Use it to query products, orders, customers, inventory, collections, and more. Authentication (Custom App Client ID + Client Secret) is configured automatically \u2014 an access token is obtained on each request. Only provide the path starting with \`/admin/api/\`. Shopify uses cursor-based pagination via the \`page_info\` query parameter (obtained from the Link header in the response).
|
|
26478
|
+
|
|
26479
|
+
### Business Logic
|
|
26480
|
+
|
|
26481
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
26482
|
+
|
|
26483
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
26484
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
26485
|
+
- \`client.listProducts(options?)\` \u2014 list products with filters (status, date range) and pagination
|
|
26486
|
+
- \`client.getProduct(productId)\` \u2014 fetch a single product
|
|
26487
|
+
- \`client.listOrders(options?)\` \u2014 list orders with filters (status, financial_status, fulfillment_status, date range)
|
|
26488
|
+
- \`client.getOrder(orderId)\` \u2014 fetch a single order
|
|
26489
|
+
- \`client.listCustomers(options?)\` \u2014 list customers with filters and pagination
|
|
26490
|
+
- \`client.getCustomer(customerId)\` \u2014 fetch a single customer
|
|
26491
|
+
- \`client.listCustomCollections(options?)\` \u2014 list custom collections
|
|
26492
|
+
- \`client.listSmartCollections(options?)\` \u2014 list smart collections
|
|
25970
26493
|
|
|
25971
26494
|
\`\`\`ts
|
|
26495
|
+
import type { Context } from "hono";
|
|
25972
26496
|
import { connection } from "@squadbase/vite-server/connectors/shopify";
|
|
25973
26497
|
|
|
25974
|
-
const
|
|
26498
|
+
const shopify = connection("<connectionId>");
|
|
25975
26499
|
|
|
25976
|
-
|
|
25977
|
-
const
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
25982
|
-
|
|
25983
|
-
|
|
25984
|
-
|
|
25985
|
-
)
|
|
25986
|
-
|
|
26500
|
+
export default async function handler(c: Context) {
|
|
26501
|
+
const { status = "active", limit = 50 } = await c.req.json<{
|
|
26502
|
+
status?: "active" | "draft" | "archived";
|
|
26503
|
+
limit?: number;
|
|
26504
|
+
}>();
|
|
26505
|
+
|
|
26506
|
+
const { products } = await shopify.listProducts({ status, limit });
|
|
26507
|
+
|
|
26508
|
+
return c.json({
|
|
26509
|
+
products: products.map((p: Record<string, unknown>) => ({
|
|
26510
|
+
id: p.id,
|
|
26511
|
+
title: p.title,
|
|
26512
|
+
status: p.status,
|
|
26513
|
+
vendor: p.vendor,
|
|
26514
|
+
created_at: p.created_at,
|
|
26515
|
+
})),
|
|
26516
|
+
});
|
|
26517
|
+
}
|
|
25987
26518
|
\`\`\`
|
|
25988
26519
|
|
|
25989
|
-
###
|
|
25990
|
-
- GET \`/products.json\` \u2014 List products
|
|
25991
|
-
- GET \`/products/{id}.json\` \u2014 Get a product
|
|
25992
|
-
- GET \`/orders.json\` \u2014 List orders
|
|
25993
|
-
- GET \`/orders/{id}.json\` \u2014 Get an order
|
|
25994
|
-
- GET \`/customers.json\` \u2014 List customers
|
|
25995
|
-
- GET \`/customers/{id}.json\` \u2014 Get a customer
|
|
25996
|
-
- GET \`/inventory_items.json?ids={ids}\` \u2014 List inventory items
|
|
25997
|
-
- GET \`/locations.json\` \u2014 List locations
|
|
25998
|
-
- GET \`/collects.json\` \u2014 List collects
|
|
25999
|
-
- GET \`/custom_collections.json\` \u2014 List custom collections
|
|
26000
|
-
- GET \`/smart_collections.json\` \u2014 List smart collections
|
|
26520
|
+
### Shopify Admin REST API Reference
|
|
26001
26521
|
|
|
26002
|
-
|
|
26522
|
+
- Base URL: \`https://{storeDomain}/admin/api/2024-10\`
|
|
26523
|
+
- Authentication: Custom App (Client ID + Client Secret \u2192 access token obtained per request)
|
|
26524
|
+
- Pagination: cursor-based via \`page_info\` query parameter (from Link header)
|
|
26525
|
+
- Max 250 records per page
|
|
26526
|
+
|
|
26527
|
+
#### Common Endpoints
|
|
26528
|
+
- GET \`/admin/api/2024-10/products.json\` \u2014 List products
|
|
26529
|
+
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 Get a product
|
|
26530
|
+
- GET \`/admin/api/2024-10/orders.json\` \u2014 List orders
|
|
26531
|
+
- GET \`/admin/api/2024-10/orders/{id}.json\` \u2014 Get an order
|
|
26532
|
+
- GET \`/admin/api/2024-10/customers.json\` \u2014 List customers
|
|
26533
|
+
- GET \`/admin/api/2024-10/customers/{id}.json\` \u2014 Get a customer
|
|
26534
|
+
- GET \`/admin/api/2024-10/inventory_items.json?ids={ids}\` \u2014 List inventory items
|
|
26535
|
+
- GET \`/admin/api/2024-10/locations.json\` \u2014 List locations
|
|
26536
|
+
- GET \`/admin/api/2024-10/collects.json\` \u2014 List collects
|
|
26537
|
+
- GET \`/admin/api/2024-10/custom_collections.json\` \u2014 List custom collections
|
|
26538
|
+
- GET \`/admin/api/2024-10/smart_collections.json\` \u2014 List smart collections
|
|
26539
|
+
|
|
26540
|
+
#### Common Query Parameters
|
|
26003
26541
|
- \`limit\` \u2014 Max records per page (max 250)
|
|
26004
26542
|
- \`page_info\` \u2014 Cursor for pagination (from Link header)
|
|
26005
26543
|
- \`fields\` \u2014 Comma-separated list of fields to return
|
|
26006
|
-
- \`created_at_min\`, \`created_at_max\` \u2014 Date filters
|
|
26007
|
-
- \`updated_at_min\`, \`updated_at_max\` \u2014 Date filters
|
|
26008
|
-
- \`status\` \u2014 Filter by status (e.g., active, draft, archived for products)`,
|
|
26009
|
-
ja: `###
|
|
26010
|
-
|
|
26544
|
+
- \`created_at_min\`, \`created_at_max\` \u2014 Date filters (ISO 8601)
|
|
26545
|
+
- \`updated_at_min\`, \`updated_at_max\` \u2014 Date filters (ISO 8601)
|
|
26546
|
+
- \`status\` \u2014 Filter by status (e.g., active, draft, archived for products; open, closed, cancelled, any for orders)`,
|
|
26547
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
26548
|
+
|
|
26549
|
+
- \`shopify_request\`: Shopify Admin REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u5546\u54C1\u3001\u6CE8\u6587\u3001\u9867\u5BA2\u3001\u5728\u5EAB\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08\u30AB\u30B9\u30BF\u30E0\u30A2\u30D7\u30EA\u306E Client ID + Client Secret\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u3001\u30EA\u30AF\u30A8\u30B9\u30C8\u3054\u3068\u306B\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\`/admin/api/\` \u304B\u3089\u59CB\u307E\u308B\u30D1\u30B9\u306E\u307F\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002Shopify\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E Link \u30D8\u30C3\u30C0\u30FC\u304B\u3089\u53D6\u5F97\u3059\u308B \`page_info\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
26550
|
+
|
|
26551
|
+
### Business Logic
|
|
26552
|
+
|
|
26553
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
26554
|
+
|
|
26555
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
26556
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
26557
|
+
- \`client.listProducts(options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF\uFF08\u30B9\u30C6\u30FC\u30BF\u30B9\u3001\u65E5\u4ED8\u7BC4\u56F2\uFF09\u3068\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067\u5546\u54C1\u3092\u4E00\u89A7\u53D6\u5F97
|
|
26558
|
+
- \`client.getProduct(productId)\` \u2014 \u5358\u4E00\u5546\u54C1\u3092\u53D6\u5F97
|
|
26559
|
+
- \`client.listOrders(options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF\uFF08\u30B9\u30C6\u30FC\u30BF\u30B9\u3001\u652F\u6255\u3044\u72B6\u6CC1\u3001\u914D\u9001\u72B6\u6CC1\u3001\u65E5\u4ED8\u7BC4\u56F2\uFF09\u4ED8\u304D\u3067\u6CE8\u6587\u3092\u4E00\u89A7\u53D6\u5F97
|
|
26560
|
+
- \`client.getOrder(orderId)\` \u2014 \u5358\u4E00\u6CE8\u6587\u3092\u53D6\u5F97
|
|
26561
|
+
- \`client.listCustomers(options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF\u3068\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067\u9867\u5BA2\u3092\u4E00\u89A7\u53D6\u5F97
|
|
26562
|
+
- \`client.getCustomer(customerId)\` \u2014 \u5358\u4E00\u9867\u5BA2\u3092\u53D6\u5F97
|
|
26563
|
+
- \`client.listCustomCollections(options?)\` \u2014 \u30AB\u30B9\u30BF\u30E0\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u53D6\u5F97
|
|
26564
|
+
- \`client.listSmartCollections(options?)\` \u2014 \u30B9\u30DE\u30FC\u30C8\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u53D6\u5F97
|
|
26011
26565
|
|
|
26012
26566
|
\`\`\`ts
|
|
26567
|
+
import type { Context } from "hono";
|
|
26013
26568
|
import { connection } from "@squadbase/vite-server/connectors/shopify";
|
|
26014
26569
|
|
|
26015
|
-
const
|
|
26570
|
+
const shopify = connection("<connectionId>");
|
|
26016
26571
|
|
|
26017
|
-
|
|
26018
|
-
const
|
|
26019
|
-
|
|
26020
|
-
|
|
26021
|
-
|
|
26022
|
-
"X-Shopify-Access-Token": accessToken,
|
|
26023
|
-
"Content-Type": "application/json",
|
|
26024
|
-
},
|
|
26025
|
-
},
|
|
26026
|
-
);
|
|
26027
|
-
const data = await res.json();
|
|
26028
|
-
\`\`\`
|
|
26572
|
+
export default async function handler(c: Context) {
|
|
26573
|
+
const { status = "active", limit = 50 } = await c.req.json<{
|
|
26574
|
+
status?: "active" | "draft" | "archived";
|
|
26575
|
+
limit?: number;
|
|
26576
|
+
}>();
|
|
26029
26577
|
|
|
26030
|
-
|
|
26031
|
-
- GET \`/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7
|
|
26032
|
-
- GET \`/products/{id}.json\` \u2014 \u5546\u54C1\u306E\u53D6\u5F97
|
|
26033
|
-
- GET \`/orders.json\` \u2014 \u6CE8\u6587\u4E00\u89A7
|
|
26034
|
-
- GET \`/orders/{id}.json\` \u2014 \u6CE8\u6587\u306E\u53D6\u5F97
|
|
26035
|
-
- GET \`/customers.json\` \u2014 \u9867\u5BA2\u4E00\u89A7
|
|
26036
|
-
- GET \`/customers/{id}.json\` \u2014 \u9867\u5BA2\u306E\u53D6\u5F97
|
|
26037
|
-
- GET \`/inventory_items.json?ids={ids}\` \u2014 \u5728\u5EAB\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7
|
|
26038
|
-
- GET \`/locations.json\` \u2014 \u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
26039
|
-
- GET \`/collects.json\` \u2014 \u30B3\u30EC\u30AF\u30C8\u4E00\u89A7
|
|
26040
|
-
- GET \`/custom_collections.json\` \u2014 \u30AB\u30B9\u30BF\u30E0\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
26041
|
-
- GET \`/smart_collections.json\` \u2014 \u30B9\u30DE\u30FC\u30C8\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
26578
|
+
const { products } = await shopify.listProducts({ status, limit });
|
|
26042
26579
|
|
|
26043
|
-
|
|
26580
|
+
return c.json({
|
|
26581
|
+
products: products.map((p: Record<string, unknown>) => ({
|
|
26582
|
+
id: p.id,
|
|
26583
|
+
title: p.title,
|
|
26584
|
+
status: p.status,
|
|
26585
|
+
vendor: p.vendor,
|
|
26586
|
+
created_at: p.created_at,
|
|
26587
|
+
})),
|
|
26588
|
+
});
|
|
26589
|
+
}
|
|
26590
|
+
\`\`\`
|
|
26591
|
+
|
|
26592
|
+
### Shopify Admin REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
26593
|
+
|
|
26594
|
+
- \u30D9\u30FC\u30B9URL: \`https://{storeDomain}/admin/api/2024-10\`
|
|
26595
|
+
- \u8A8D\u8A3C: \u30AB\u30B9\u30BF\u30E0\u30A2\u30D7\u30EA\uFF08Client ID + Client Secret \u2192 \u30EA\u30AF\u30A8\u30B9\u30C8\u3054\u3068\u306B\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u53D6\u5F97\uFF09
|
|
26596
|
+
- \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3: Link \u30D8\u30C3\u30C0\u30FC\u304B\u3089\u306E \`page_info\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9
|
|
26597
|
+
- \u30DA\u30FC\u30B8\u3042\u305F\u308A\u6700\u5927250\u30EC\u30B3\u30FC\u30C9
|
|
26598
|
+
|
|
26599
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
26600
|
+
- GET \`/admin/api/2024-10/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7
|
|
26601
|
+
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 \u5546\u54C1\u306E\u53D6\u5F97
|
|
26602
|
+
- GET \`/admin/api/2024-10/orders.json\` \u2014 \u6CE8\u6587\u4E00\u89A7
|
|
26603
|
+
- GET \`/admin/api/2024-10/orders/{id}.json\` \u2014 \u6CE8\u6587\u306E\u53D6\u5F97
|
|
26604
|
+
- GET \`/admin/api/2024-10/customers.json\` \u2014 \u9867\u5BA2\u4E00\u89A7
|
|
26605
|
+
- GET \`/admin/api/2024-10/customers/{id}.json\` \u2014 \u9867\u5BA2\u306E\u53D6\u5F97
|
|
26606
|
+
- GET \`/admin/api/2024-10/inventory_items.json?ids={ids}\` \u2014 \u5728\u5EAB\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7
|
|
26607
|
+
- GET \`/admin/api/2024-10/locations.json\` \u2014 \u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
26608
|
+
- GET \`/admin/api/2024-10/collects.json\` \u2014 \u30B3\u30EC\u30AF\u30C8\u4E00\u89A7
|
|
26609
|
+
- GET \`/admin/api/2024-10/custom_collections.json\` \u2014 \u30AB\u30B9\u30BF\u30E0\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
26610
|
+
- GET \`/admin/api/2024-10/smart_collections.json\` \u2014 \u30B9\u30DE\u30FC\u30C8\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
26611
|
+
|
|
26612
|
+
#### \u4E3B\u8981\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
|
|
26044
26613
|
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u30EC\u30B3\u30FC\u30C9\u6570\uFF08\u6700\u5927250\uFF09
|
|
26045
26614
|
- \`page_info\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u7528\u30AB\u30FC\u30BD\u30EB\uFF08Link\u30D8\u30C3\u30C0\u30FC\u304B\u3089\u53D6\u5F97\uFF09
|
|
26046
26615
|
- \`fields\` \u2014 \u8FD4\u5374\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
|
|
26047
|
-
- \`created_at_min\`, \`created_at_max\` \u2014 \u4F5C\u6210\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC
|
|
26048
|
-
- \`updated_at_min\`, \`updated_at_max\` \u2014 \u66F4\u65B0\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC
|
|
26049
|
-
- \`status\` \u2014 \u30B9\u30C6\u30FC\u30BF\u30B9\u3067\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08\u4F8B: \u5546\u54C1\u306E\u5834\u5408 active, draft, archived\uFF09`
|
|
26616
|
+
- \`created_at_min\`, \`created_at_max\` \u2014 \u4F5C\u6210\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08ISO 8601\uFF09
|
|
26617
|
+
- \`updated_at_min\`, \`updated_at_max\` \u2014 \u66F4\u65B0\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08ISO 8601\uFF09
|
|
26618
|
+
- \`status\` \u2014 \u30B9\u30C6\u30FC\u30BF\u30B9\u3067\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08\u4F8B: \u5546\u54C1\u306E\u5834\u5408 active, draft, archived\u3001\u6CE8\u6587\u306E\u5834\u5408 open, closed, cancelled, any\uFF09`
|
|
26050
26619
|
},
|
|
26051
26620
|
tools: tools28
|
|
26052
26621
|
});
|
|
@@ -26219,8 +26788,8 @@ const data = await res.json();
|
|
|
26219
26788
|
});
|
|
26220
26789
|
|
|
26221
26790
|
// ../connectors/src/connectors/shopify-oauth/tools/request.ts
|
|
26222
|
-
import { z as
|
|
26223
|
-
var
|
|
26791
|
+
import { z as z33 } from "zod";
|
|
26792
|
+
var REQUEST_TIMEOUT_MS22 = 6e4;
|
|
26224
26793
|
var cachedToken13 = null;
|
|
26225
26794
|
async function getProxyToken13(config) {
|
|
26226
26795
|
if (cachedToken13 && cachedToken13.expiresAt > Date.now() + 6e4) {
|
|
@@ -26252,35 +26821,35 @@ async function getProxyToken13(config) {
|
|
|
26252
26821
|
};
|
|
26253
26822
|
return data.token;
|
|
26254
26823
|
}
|
|
26255
|
-
var
|
|
26256
|
-
toolUseIntent:
|
|
26824
|
+
var inputSchema33 = z33.object({
|
|
26825
|
+
toolUseIntent: z33.string().optional().describe(
|
|
26257
26826
|
"Brief description of what you intend to accomplish with this tool call"
|
|
26258
26827
|
),
|
|
26259
|
-
connectionId:
|
|
26260
|
-
method:
|
|
26261
|
-
path:
|
|
26828
|
+
connectionId: z33.string().describe("ID of the Shopify OAuth connection to use"),
|
|
26829
|
+
method: z33.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
|
|
26830
|
+
path: z33.string().describe(
|
|
26262
26831
|
"API path (e.g., '/admin/api/2024-10/products.json', '/admin/api/2024-10/orders.json')"
|
|
26263
26832
|
),
|
|
26264
|
-
queryParams:
|
|
26265
|
-
body:
|
|
26833
|
+
queryParams: z33.record(z33.string(), z33.string()).optional().describe("Query parameters to append to the URL"),
|
|
26834
|
+
body: z33.record(z33.string(), z33.unknown()).optional().describe("Request body (JSON) for POST/PUT requests")
|
|
26266
26835
|
});
|
|
26267
|
-
var
|
|
26268
|
-
|
|
26269
|
-
success:
|
|
26270
|
-
status:
|
|
26271
|
-
data:
|
|
26836
|
+
var outputSchema33 = z33.discriminatedUnion("success", [
|
|
26837
|
+
z33.object({
|
|
26838
|
+
success: z33.literal(true),
|
|
26839
|
+
status: z33.number(),
|
|
26840
|
+
data: z33.record(z33.string(), z33.unknown())
|
|
26272
26841
|
}),
|
|
26273
|
-
|
|
26274
|
-
success:
|
|
26275
|
-
error:
|
|
26842
|
+
z33.object({
|
|
26843
|
+
success: z33.literal(false),
|
|
26844
|
+
error: z33.string()
|
|
26276
26845
|
})
|
|
26277
26846
|
]);
|
|
26278
|
-
var
|
|
26847
|
+
var requestTool16 = new ConnectorTool({
|
|
26279
26848
|
name: "request",
|
|
26280
26849
|
description: `Send authenticated requests to the Shopify Admin API.
|
|
26281
26850
|
Authentication is handled automatically via OAuth proxy.`,
|
|
26282
|
-
inputSchema:
|
|
26283
|
-
outputSchema:
|
|
26851
|
+
inputSchema: inputSchema33,
|
|
26852
|
+
outputSchema: outputSchema33,
|
|
26284
26853
|
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
26285
26854
|
const connection = connections.find((c) => c.id === connectionId);
|
|
26286
26855
|
if (!connection) {
|
|
@@ -26301,7 +26870,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
26301
26870
|
const token = await getProxyToken13(config.oauthProxy);
|
|
26302
26871
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
26303
26872
|
const controller = new AbortController();
|
|
26304
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
26873
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS22);
|
|
26305
26874
|
try {
|
|
26306
26875
|
const response = await fetch(proxyUrl, {
|
|
26307
26876
|
method: "POST",
|
|
@@ -26333,7 +26902,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
26333
26902
|
});
|
|
26334
26903
|
|
|
26335
26904
|
// ../connectors/src/connectors/shopify-oauth/setup.ts
|
|
26336
|
-
var requestToolName5 = `shopify-oauth_${
|
|
26905
|
+
var requestToolName5 = `shopify-oauth_${requestTool16.name}`;
|
|
26337
26906
|
var shopifyOauthOnboarding = new ConnectorOnboarding({
|
|
26338
26907
|
connectionSetupInstructions: {
|
|
26339
26908
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Shopify\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
@@ -26377,7 +26946,7 @@ var shopifyOauthOnboarding = new ConnectorOnboarding({
|
|
|
26377
26946
|
var parameters30 = {};
|
|
26378
26947
|
|
|
26379
26948
|
// ../connectors/src/connectors/shopify-oauth/index.ts
|
|
26380
|
-
var tools30 = { request:
|
|
26949
|
+
var tools30 = { request: requestTool16 };
|
|
26381
26950
|
var shopifyOauthConnector = new ConnectorPlugin({
|
|
26382
26951
|
slug: "shopify",
|
|
26383
26952
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -26396,9 +26965,13 @@ var shopifyOauthConnector = new ConnectorPlugin({
|
|
|
26396
26965
|
]
|
|
26397
26966
|
},
|
|
26398
26967
|
systemPrompt: {
|
|
26399
|
-
en: `###
|
|
26968
|
+
en: `### Tools
|
|
26969
|
+
|
|
26970
|
+
- \`shopify-oauth_request\`: The only way to call the Shopify Admin REST API. Use it to query products, orders, customers, inventory, collections, and more. Authentication is configured automatically via OAuth proxy. Shopify uses cursor-based pagination via the \`page_info\` query parameter (obtained from the Link header in the response).
|
|
26400
26971
|
|
|
26401
|
-
###
|
|
26972
|
+
### Shopify Admin REST API Reference
|
|
26973
|
+
|
|
26974
|
+
#### Available Endpoints (API version: 2024-10)
|
|
26402
26975
|
- GET \`/admin/api/2024-10/shop.json\` \u2014 Get shop info
|
|
26403
26976
|
- GET \`/admin/api/2024-10/products.json\` \u2014 List products
|
|
26404
26977
|
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 Get a product
|
|
@@ -26439,9 +27012,13 @@ const shopify = connection("<connectionId>");
|
|
|
26439
27012
|
const res = await shopify.request("/admin/api/2024-10/products.json?limit=10");
|
|
26440
27013
|
const data = await res.json();
|
|
26441
27014
|
\`\`\``,
|
|
26442
|
-
ja: `###
|
|
27015
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
27016
|
+
|
|
27017
|
+
- \`shopify-oauth_request\`: Shopify Admin REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u5546\u54C1\u3001\u6CE8\u6587\u3001\u9867\u5BA2\u3001\u5728\u5EAB\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Shopify\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E Link \u30D8\u30C3\u30C0\u30FC\u304B\u3089\u53D6\u5F97\u3059\u308B \`page_info\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
26443
27018
|
|
|
26444
|
-
###
|
|
27019
|
+
### Shopify Admin REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
27020
|
+
|
|
27021
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 (API\u30D0\u30FC\u30B8\u30E7\u30F3: 2024-10)
|
|
26445
27022
|
- GET \`/admin/api/2024-10/shop.json\` \u2014 \u30B7\u30E7\u30C3\u30D7\u60C5\u5831\u3092\u53D6\u5F97
|
|
26446
27023
|
- GET \`/admin/api/2024-10/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7\u3092\u53D6\u5F97
|
|
26447
27024
|
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 \u5546\u54C1\u3092\u53D6\u5F97
|
|
@@ -26700,9 +27277,9 @@ const data = await res.json();
|
|
|
26700
27277
|
});
|
|
26701
27278
|
|
|
26702
27279
|
// ../connectors/src/connectors/ms-teams-oauth/tools/request.ts
|
|
26703
|
-
import { z as
|
|
26704
|
-
var
|
|
26705
|
-
var
|
|
27280
|
+
import { z as z34 } from "zod";
|
|
27281
|
+
var BASE_URL12 = "https://graph.microsoft.com";
|
|
27282
|
+
var REQUEST_TIMEOUT_MS23 = 6e4;
|
|
26706
27283
|
var cachedToken14 = null;
|
|
26707
27284
|
async function getProxyToken14(config) {
|
|
26708
27285
|
if (cachedToken14 && cachedToken14.expiresAt > Date.now() + 6e4) {
|
|
@@ -26734,35 +27311,35 @@ async function getProxyToken14(config) {
|
|
|
26734
27311
|
};
|
|
26735
27312
|
return data.token;
|
|
26736
27313
|
}
|
|
26737
|
-
var
|
|
26738
|
-
toolUseIntent:
|
|
27314
|
+
var inputSchema34 = z34.object({
|
|
27315
|
+
toolUseIntent: z34.string().optional().describe(
|
|
26739
27316
|
"Brief description of what you intend to accomplish with this tool call"
|
|
26740
27317
|
),
|
|
26741
|
-
connectionId:
|
|
26742
|
-
method:
|
|
26743
|
-
path:
|
|
27318
|
+
connectionId: z34.string().describe("ID of the Microsoft Teams OAuth connection to use"),
|
|
27319
|
+
method: z34.enum(["GET", "POST", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
27320
|
+
path: z34.string().describe(
|
|
26744
27321
|
"API path appended to https://graph.microsoft.com (e.g., '/v1.0/me/joinedTeams', '/v1.0/teams/{id}/channels')"
|
|
26745
27322
|
),
|
|
26746
|
-
queryParams:
|
|
26747
|
-
body:
|
|
27323
|
+
queryParams: z34.record(z34.string(), z34.string()).optional().describe("Query parameters to append to the URL"),
|
|
27324
|
+
body: z34.record(z34.string(), z34.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
26748
27325
|
});
|
|
26749
|
-
var
|
|
26750
|
-
|
|
26751
|
-
success:
|
|
26752
|
-
status:
|
|
26753
|
-
data:
|
|
27326
|
+
var outputSchema34 = z34.discriminatedUnion("success", [
|
|
27327
|
+
z34.object({
|
|
27328
|
+
success: z34.literal(true),
|
|
27329
|
+
status: z34.number(),
|
|
27330
|
+
data: z34.record(z34.string(), z34.unknown())
|
|
26754
27331
|
}),
|
|
26755
|
-
|
|
26756
|
-
success:
|
|
26757
|
-
error:
|
|
27332
|
+
z34.object({
|
|
27333
|
+
success: z34.literal(false),
|
|
27334
|
+
error: z34.string()
|
|
26758
27335
|
})
|
|
26759
27336
|
]);
|
|
26760
|
-
var
|
|
27337
|
+
var requestTool17 = new ConnectorTool({
|
|
26761
27338
|
name: "request",
|
|
26762
27339
|
description: `Send authenticated requests to the Microsoft Graph API.
|
|
26763
27340
|
Authentication is handled automatically via OAuth proxy.`,
|
|
26764
|
-
inputSchema:
|
|
26765
|
-
outputSchema:
|
|
27341
|
+
inputSchema: inputSchema34,
|
|
27342
|
+
outputSchema: outputSchema34,
|
|
26766
27343
|
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
26767
27344
|
const connection = connections.find((c) => c.id === connectionId);
|
|
26768
27345
|
if (!connection) {
|
|
@@ -26775,7 +27352,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
26775
27352
|
`[connector-request] ms-teams-oauth/${connection.name}: ${method} ${path5}`
|
|
26776
27353
|
);
|
|
26777
27354
|
try {
|
|
26778
|
-
let url = `${
|
|
27355
|
+
let url = `${BASE_URL12}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
26779
27356
|
if (queryParams) {
|
|
26780
27357
|
const searchParams = new URLSearchParams(queryParams);
|
|
26781
27358
|
url += `?${searchParams.toString()}`;
|
|
@@ -26783,7 +27360,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
26783
27360
|
const token = await getProxyToken14(config.oauthProxy);
|
|
26784
27361
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
26785
27362
|
const controller = new AbortController();
|
|
26786
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
27363
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS23);
|
|
26787
27364
|
try {
|
|
26788
27365
|
const response = await fetch(proxyUrl, {
|
|
26789
27366
|
method: "POST",
|
|
@@ -26815,7 +27392,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
26815
27392
|
});
|
|
26816
27393
|
|
|
26817
27394
|
// ../connectors/src/connectors/ms-teams-oauth/setup.ts
|
|
26818
|
-
var requestToolName6 = `microsoft-teams-oauth_${
|
|
27395
|
+
var requestToolName6 = `microsoft-teams-oauth_${requestTool17.name}`;
|
|
26819
27396
|
var msTeamsOauthOnboarding = new ConnectorOnboarding({
|
|
26820
27397
|
connectionSetupInstructions: {
|
|
26821
27398
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3092\u6B63\u78BA\u306B\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u624B\u9806\u306B\u8A18\u8F09\u306E\u306A\u3044\u8FFD\u52A0\u306EAPI\u30EA\u30AF\u30A8\u30B9\u30C8\u306F\u4E00\u5207\u884C\u308F\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
@@ -26861,7 +27438,7 @@ var msTeamsOauthOnboarding = new ConnectorOnboarding({
|
|
|
26861
27438
|
var parameters32 = {};
|
|
26862
27439
|
|
|
26863
27440
|
// ../connectors/src/connectors/ms-teams-oauth/index.ts
|
|
26864
|
-
var tools32 = { request:
|
|
27441
|
+
var tools32 = { request: requestTool17 };
|
|
26865
27442
|
var msTeamsOauthConnector = new ConnectorPlugin({
|
|
26866
27443
|
slug: "microsoft-teams",
|
|
26867
27444
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -26995,6 +27572,257 @@ const data = await res.json();
|
|
|
26995
27572
|
}
|
|
26996
27573
|
});
|
|
26997
27574
|
|
|
27575
|
+
// ../connectors/src/connectors/hubspot/setup.ts
|
|
27576
|
+
var hubspotOnboarding2 = new ConnectorOnboarding({
|
|
27577
|
+
dataOverviewInstructions: {
|
|
27578
|
+
en: `1. Call hubspot_request with GET /crm/v3/objects/contacts?limit=5 to explore contacts structure
|
|
27579
|
+
2. Call hubspot_request with GET /crm/v3/objects/deals?limit=5 to explore deals structure
|
|
27580
|
+
3. Explore other object types (companies, tickets, etc.) as needed to understand available data`,
|
|
27581
|
+
ja: `1. hubspot_request \u3067 GET /crm/v3/objects/contacts?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
27582
|
+
2. hubspot_request \u3067 GET /crm/v3/objects/deals?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u53D6\u5F15\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
27583
|
+
3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30BF\u30A4\u30D7\uFF08\u4F01\u696D\u3001\u30C1\u30B1\u30C3\u30C8\u306A\u3069\uFF09\u3092\u63A2\u7D22\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30FC\u30BF\u3092\u628A\u63E1`
|
|
27584
|
+
}
|
|
27585
|
+
});
|
|
27586
|
+
|
|
27587
|
+
// ../connectors/src/connectors/hubspot/parameters.ts
|
|
27588
|
+
var parameters33 = {
|
|
27589
|
+
apiKey: new ParameterDefinition({
|
|
27590
|
+
slug: "api-key",
|
|
27591
|
+
name: "HubSpot Private App Access Token",
|
|
27592
|
+
description: "The HubSpot private app access token for authentication (starts with pat-).",
|
|
27593
|
+
envVarBaseKey: "HUBSPOT_API_KEY",
|
|
27594
|
+
type: "text",
|
|
27595
|
+
secret: true,
|
|
27596
|
+
required: true
|
|
27597
|
+
})
|
|
27598
|
+
};
|
|
27599
|
+
|
|
27600
|
+
// ../connectors/src/connectors/hubspot/tools/request.ts
|
|
27601
|
+
import { z as z35 } from "zod";
|
|
27602
|
+
var BASE_URL13 = "https://api.hubapi.com";
|
|
27603
|
+
var REQUEST_TIMEOUT_MS24 = 6e4;
|
|
27604
|
+
var inputSchema35 = z35.object({
|
|
27605
|
+
toolUseIntent: z35.string().optional().describe(
|
|
27606
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
27607
|
+
),
|
|
27608
|
+
connectionId: z35.string().describe("ID of the HubSpot connection to use"),
|
|
27609
|
+
method: z35.enum(["GET", "POST", "PATCH", "DELETE"]).describe(
|
|
27610
|
+
"HTTP method. GET for reading resources, POST for creating or searching, PATCH for updating, DELETE for removing."
|
|
27611
|
+
),
|
|
27612
|
+
path: z35.string().describe(
|
|
27613
|
+
"API path appended to https://api.hubapi.com (e.g., '/crm/v3/objects/contacts', '/crm/v3/objects/deals', '/crm/v3/objects/contacts/search')"
|
|
27614
|
+
),
|
|
27615
|
+
body: z35.record(z35.string(), z35.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
27616
|
+
});
|
|
27617
|
+
var outputSchema35 = z35.discriminatedUnion("success", [
|
|
27618
|
+
z35.object({
|
|
27619
|
+
success: z35.literal(true),
|
|
27620
|
+
status: z35.number(),
|
|
27621
|
+
data: z35.record(z35.string(), z35.unknown())
|
|
27622
|
+
}),
|
|
27623
|
+
z35.object({
|
|
27624
|
+
success: z35.literal(false),
|
|
27625
|
+
error: z35.string()
|
|
27626
|
+
})
|
|
27627
|
+
]);
|
|
27628
|
+
var requestTool18 = new ConnectorTool({
|
|
27629
|
+
name: "request",
|
|
27630
|
+
description: `Send authenticated requests to the HubSpot API.
|
|
27631
|
+
Authentication is handled automatically using the Private App Access Token (Bearer token).
|
|
27632
|
+
Use this tool for all HubSpot API interactions: querying contacts, deals, companies, tickets, and other CRM objects.
|
|
27633
|
+
Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex queries with filters.`,
|
|
27634
|
+
inputSchema: inputSchema35,
|
|
27635
|
+
outputSchema: outputSchema35,
|
|
27636
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
27637
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
27638
|
+
if (!connection) {
|
|
27639
|
+
return {
|
|
27640
|
+
success: false,
|
|
27641
|
+
error: `Connection ${connectionId} not found`
|
|
27642
|
+
};
|
|
27643
|
+
}
|
|
27644
|
+
console.log(
|
|
27645
|
+
`[connector-request] hubspot/${connection.name}: ${method} ${path5}`
|
|
27646
|
+
);
|
|
27647
|
+
try {
|
|
27648
|
+
const apiKey = parameters33.apiKey.getValue(connection);
|
|
27649
|
+
const url = `${BASE_URL13}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
27650
|
+
const controller = new AbortController();
|
|
27651
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS24);
|
|
27652
|
+
try {
|
|
27653
|
+
const response = await fetch(url, {
|
|
27654
|
+
method,
|
|
27655
|
+
headers: {
|
|
27656
|
+
Authorization: `Bearer ${apiKey}`,
|
|
27657
|
+
"Content-Type": "application/json"
|
|
27658
|
+
},
|
|
27659
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
27660
|
+
signal: controller.signal
|
|
27661
|
+
});
|
|
27662
|
+
const data = await response.json();
|
|
27663
|
+
if (!response.ok) {
|
|
27664
|
+
const errorMessage = typeof data?.message === "string" ? data.message : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
27665
|
+
return { success: false, error: errorMessage };
|
|
27666
|
+
}
|
|
27667
|
+
return { success: true, status: response.status, data };
|
|
27668
|
+
} finally {
|
|
27669
|
+
clearTimeout(timeout);
|
|
27670
|
+
}
|
|
27671
|
+
} catch (err) {
|
|
27672
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
27673
|
+
return { success: false, error: msg };
|
|
27674
|
+
}
|
|
27675
|
+
}
|
|
27676
|
+
});
|
|
27677
|
+
|
|
27678
|
+
// ../connectors/src/connectors/hubspot/index.ts
|
|
27679
|
+
var tools33 = { request: requestTool18 };
|
|
27680
|
+
var hubspotConnector = new ConnectorPlugin({
|
|
27681
|
+
slug: "hubspot",
|
|
27682
|
+
authType: null,
|
|
27683
|
+
name: "HubSpot",
|
|
27684
|
+
description: "Connect to HubSpot CRM for contacts, deals, companies, and marketing data using a Private App Access Token.",
|
|
27685
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5UcSkKkzhUMA4RsM45ynuo/43b967e36915ca0fc5d277684b204320/hubspot.svg",
|
|
27686
|
+
parameters: parameters33,
|
|
27687
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
27688
|
+
onboarding: hubspotOnboarding2,
|
|
27689
|
+
systemPrompt: {
|
|
27690
|
+
en: `### Tools
|
|
27691
|
+
|
|
27692
|
+
- \`hubspot_request\`: The only way to call the HubSpot API. Use it to query contacts, deals, companies, tickets, and other CRM objects. Authentication (Bearer token) is configured automatically. HubSpot uses cursor-based pagination with the \`after\` parameter from \`paging.next.after\` in the response. Use the search endpoint for complex queries with filters.
|
|
27693
|
+
|
|
27694
|
+
### Business Logic
|
|
27695
|
+
|
|
27696
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
27697
|
+
|
|
27698
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
27699
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
27700
|
+
- \`client.listObjects(objectType, options?)\` \u2014 list CRM objects with pagination (limit, after, properties, associations)
|
|
27701
|
+
- \`client.getObject(objectType, objectId, options?)\` \u2014 fetch a single CRM object
|
|
27702
|
+
- \`client.searchObjects(objectType, options?)\` \u2014 search CRM objects with filters, sorts, and pagination
|
|
27703
|
+
|
|
27704
|
+
\`\`\`ts
|
|
27705
|
+
import type { Context } from "hono";
|
|
27706
|
+
import { connection } from "@squadbase/vite-server/connectors/hubspot";
|
|
27707
|
+
|
|
27708
|
+
const hubspot = connection("<connectionId>");
|
|
27709
|
+
|
|
27710
|
+
export default async function handler(c: Context) {
|
|
27711
|
+
const { limit = 10 } = await c.req.json<{ limit?: number }>();
|
|
27712
|
+
|
|
27713
|
+
const { results, paging } = await hubspot.listObjects("contacts", {
|
|
27714
|
+
limit,
|
|
27715
|
+
properties: ["email", "firstname", "lastname"],
|
|
27716
|
+
});
|
|
27717
|
+
|
|
27718
|
+
return c.json({
|
|
27719
|
+
contacts: results,
|
|
27720
|
+
nextPage: paging?.next?.after,
|
|
27721
|
+
});
|
|
27722
|
+
}
|
|
27723
|
+
\`\`\`
|
|
27724
|
+
|
|
27725
|
+
### HubSpot API Reference
|
|
27726
|
+
|
|
27727
|
+
- Base URL: \`https://api.hubapi.com\`
|
|
27728
|
+
- Authentication: Bearer token (handled automatically)
|
|
27729
|
+
- Pagination: cursor-based with \`after\` parameter from \`paging.next.after\`
|
|
27730
|
+
|
|
27731
|
+
#### Common Endpoints
|
|
27732
|
+
- GET \`/crm/v3/objects/contacts\` \u2014 List contacts
|
|
27733
|
+
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 Get a contact
|
|
27734
|
+
- GET \`/crm/v3/objects/deals\` \u2014 List deals
|
|
27735
|
+
- GET \`/crm/v3/objects/deals/{dealId}\` \u2014 Get a deal
|
|
27736
|
+
- GET \`/crm/v3/objects/companies\` \u2014 List companies
|
|
27737
|
+
- GET \`/crm/v3/objects/companies/{companyId}\` \u2014 Get a company
|
|
27738
|
+
- POST \`/crm/v3/objects/contacts\` \u2014 Create a contact
|
|
27739
|
+
- POST \`/crm/v3/objects/deals\` \u2014 Create a deal
|
|
27740
|
+
- PATCH \`/crm/v3/objects/contacts/{contactId}\` \u2014 Update a contact
|
|
27741
|
+
- PATCH \`/crm/v3/objects/deals/{dealId}\` \u2014 Update a deal
|
|
27742
|
+
- POST \`/crm/v3/objects/{objectType}/search\` \u2014 Search objects
|
|
27743
|
+
|
|
27744
|
+
#### Query Parameters
|
|
27745
|
+
- \`limit\` \u2014 Number of results per page (max 100)
|
|
27746
|
+
- \`after\` \u2014 Pagination cursor
|
|
27747
|
+
- \`properties\` \u2014 Comma-separated list of properties to return
|
|
27748
|
+
- \`associations\` \u2014 Comma-separated list of association types to include
|
|
27749
|
+
|
|
27750
|
+
#### Search Body (POST /crm/v3/objects/{objectType}/search)
|
|
27751
|
+
- \`filterGroups\` \u2014 Array of filter groups with \`filters\` (propertyName, operator, value)
|
|
27752
|
+
- \`sorts\` \u2014 Array of sort specifications
|
|
27753
|
+
- \`properties\` \u2014 Array of properties to return
|
|
27754
|
+
- \`limit\` \u2014 Max results per page (max 100)
|
|
27755
|
+
- \`after\` \u2014 Pagination offset`,
|
|
27756
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
27757
|
+
|
|
27758
|
+
- \`hubspot_request\`: HubSpot API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u53D6\u5F15\u3001\u4F1A\u793E\u3001\u30C1\u30B1\u30C3\u30C8\u3001\u305D\u306E\u4ED6\u306ECRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002HubSpot\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`paging.next.after\` \u304B\u3089\u306E \`after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002\u8907\u96D1\u306A\u30AF\u30A8\u30EA\u306B\u306F\u30D5\u30A3\u30EB\u30BF\u4ED8\u304D\u306Esearch\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
27759
|
+
|
|
27760
|
+
### Business Logic
|
|
27761
|
+
|
|
27762
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
27763
|
+
|
|
27764
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
27765
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
27766
|
+
- \`client.listObjects(objectType, options?)\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067CRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u4E00\u89A7\u53D6\u5F97\uFF08limit, after, properties, associations\uFF09
|
|
27767
|
+
- \`client.getObject(objectType, objectId, options?)\` \u2014 \u5358\u4E00CRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u53D6\u5F97
|
|
27768
|
+
- \`client.searchObjects(objectType, options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF\u3001\u30BD\u30FC\u30C8\u3001\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067CRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u691C\u7D22
|
|
27769
|
+
|
|
27770
|
+
\`\`\`ts
|
|
27771
|
+
import type { Context } from "hono";
|
|
27772
|
+
import { connection } from "@squadbase/vite-server/connectors/hubspot";
|
|
27773
|
+
|
|
27774
|
+
const hubspot = connection("<connectionId>");
|
|
27775
|
+
|
|
27776
|
+
export default async function handler(c: Context) {
|
|
27777
|
+
const { limit = 10 } = await c.req.json<{ limit?: number }>();
|
|
27778
|
+
|
|
27779
|
+
const { results, paging } = await hubspot.listObjects("contacts", {
|
|
27780
|
+
limit,
|
|
27781
|
+
properties: ["email", "firstname", "lastname"],
|
|
27782
|
+
});
|
|
27783
|
+
|
|
27784
|
+
return c.json({
|
|
27785
|
+
contacts: results,
|
|
27786
|
+
nextPage: paging?.next?.after,
|
|
27787
|
+
});
|
|
27788
|
+
}
|
|
27789
|
+
\`\`\`
|
|
27790
|
+
|
|
27791
|
+
### HubSpot API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
27792
|
+
|
|
27793
|
+
- \u30D9\u30FC\u30B9URL: \`https://api.hubapi.com\`
|
|
27794
|
+
- \u8A8D\u8A3C: Bearer\u30C8\u30FC\u30AF\u30F3\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
27795
|
+
- \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3: \`paging.next.after\` \u304B\u3089\u306E \`after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9
|
|
27796
|
+
|
|
27797
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
27798
|
+
- GET \`/crm/v3/objects/contacts\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27799
|
+
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u53D6\u5F97
|
|
27800
|
+
- GET \`/crm/v3/objects/deals\` \u2014 \u53D6\u5F15\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27801
|
+
- GET \`/crm/v3/objects/deals/{dealId}\` \u2014 \u53D6\u5F15\u3092\u53D6\u5F97
|
|
27802
|
+
- GET \`/crm/v3/objects/companies\` \u2014 \u4F1A\u793E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
27803
|
+
- GET \`/crm/v3/objects/companies/{companyId}\` \u2014 \u4F1A\u793E\u3092\u53D6\u5F97
|
|
27804
|
+
- POST \`/crm/v3/objects/contacts\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u4F5C\u6210
|
|
27805
|
+
- POST \`/crm/v3/objects/deals\` \u2014 \u53D6\u5F15\u3092\u4F5C\u6210
|
|
27806
|
+
- PATCH \`/crm/v3/objects/contacts/{contactId}\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u66F4\u65B0
|
|
27807
|
+
- PATCH \`/crm/v3/objects/deals/{dealId}\` \u2014 \u53D6\u5F15\u3092\u66F4\u65B0
|
|
27808
|
+
- POST \`/crm/v3/objects/{objectType}/search\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u691C\u7D22
|
|
27809
|
+
|
|
27810
|
+
#### \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
|
|
27811
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u7D50\u679C\u6570\uFF08\u6700\u5927100\uFF09
|
|
27812
|
+
- \`after\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AB\u30FC\u30BD\u30EB
|
|
27813
|
+
- \`properties\` \u2014 \u8FD4\u5374\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
|
|
27814
|
+
- \`associations\` \u2014 \u542B\u3081\u308B\u30A2\u30BD\u30B7\u30A8\u30FC\u30B7\u30E7\u30F3\u30BF\u30A4\u30D7\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
|
|
27815
|
+
|
|
27816
|
+
#### \u691C\u7D22\u30DC\u30C7\u30A3 (POST /crm/v3/objects/{objectType}/search)
|
|
27817
|
+
- \`filterGroups\` \u2014 \u30D5\u30A3\u30EB\u30BF\u30B0\u30EB\u30FC\u30D7\u306E\u914D\u5217\uFF08\`filters\`: propertyName, operator, value\uFF09
|
|
27818
|
+
- \`sorts\` \u2014 \u30BD\u30FC\u30C8\u6307\u5B9A\u306E\u914D\u5217
|
|
27819
|
+
- \`properties\` \u2014 \u8FD4\u5374\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u914D\u5217
|
|
27820
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u7D50\u679C\u6570\uFF08\u6700\u5927100\uFF09
|
|
27821
|
+
- \`after\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8`
|
|
27822
|
+
},
|
|
27823
|
+
tools: tools33
|
|
27824
|
+
});
|
|
27825
|
+
|
|
26998
27826
|
// ../connectors/src/connectors/registry.ts
|
|
26999
27827
|
var plugins = {
|
|
27000
27828
|
snowflake: snowflakeConnector,
|
|
@@ -27028,7 +27856,8 @@ var plugins = {
|
|
|
27028
27856
|
slack: slackConnector,
|
|
27029
27857
|
shopifyOauth: shopifyOauthConnector,
|
|
27030
27858
|
msTeams: msTeamsConnector,
|
|
27031
|
-
msTeamsOauth: msTeamsOauthConnector
|
|
27859
|
+
msTeamsOauth: msTeamsOauthConnector,
|
|
27860
|
+
hubspot: hubspotConnector
|
|
27032
27861
|
};
|
|
27033
27862
|
var connectors = {
|
|
27034
27863
|
...plugins,
|
|
@@ -27245,62 +28074,62 @@ import { watch as fsWatch2 } from "fs";
|
|
|
27245
28074
|
import path2 from "path";
|
|
27246
28075
|
|
|
27247
28076
|
// src/types/server-logic.ts
|
|
27248
|
-
import { z as
|
|
27249
|
-
var parameterMetaSchema =
|
|
27250
|
-
name:
|
|
27251
|
-
type:
|
|
27252
|
-
description:
|
|
27253
|
-
required:
|
|
27254
|
-
default:
|
|
27255
|
-
});
|
|
27256
|
-
var serverLogicCacheConfigSchema =
|
|
27257
|
-
ttl:
|
|
27258
|
-
staleWhileRevalidate:
|
|
27259
|
-
});
|
|
27260
|
-
var serverLogicSchemaObjectSchema =
|
|
27261
|
-
() =>
|
|
27262
|
-
type:
|
|
27263
|
-
format:
|
|
27264
|
-
description:
|
|
27265
|
-
nullable:
|
|
27266
|
-
enum:
|
|
28077
|
+
import { z as z36 } from "zod";
|
|
28078
|
+
var parameterMetaSchema = z36.object({
|
|
28079
|
+
name: z36.string(),
|
|
28080
|
+
type: z36.enum(["string", "number", "boolean"]),
|
|
28081
|
+
description: z36.string(),
|
|
28082
|
+
required: z36.boolean().optional(),
|
|
28083
|
+
default: z36.union([z36.string(), z36.number(), z36.boolean()]).optional()
|
|
28084
|
+
});
|
|
28085
|
+
var serverLogicCacheConfigSchema = z36.object({
|
|
28086
|
+
ttl: z36.number(),
|
|
28087
|
+
staleWhileRevalidate: z36.boolean().optional()
|
|
28088
|
+
});
|
|
28089
|
+
var serverLogicSchemaObjectSchema = z36.lazy(
|
|
28090
|
+
() => z36.object({
|
|
28091
|
+
type: z36.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
28092
|
+
format: z36.string().optional(),
|
|
28093
|
+
description: z36.string().optional(),
|
|
28094
|
+
nullable: z36.boolean().optional(),
|
|
28095
|
+
enum: z36.array(z36.union([z36.string(), z36.number(), z36.boolean(), z36.null()])).optional(),
|
|
27267
28096
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
27268
|
-
properties:
|
|
27269
|
-
required:
|
|
27270
|
-
additionalProperties:
|
|
27271
|
-
minimum:
|
|
27272
|
-
maximum:
|
|
27273
|
-
minLength:
|
|
27274
|
-
maxLength:
|
|
27275
|
-
pattern:
|
|
28097
|
+
properties: z36.record(z36.string(), serverLogicSchemaObjectSchema).optional(),
|
|
28098
|
+
required: z36.array(z36.string()).optional(),
|
|
28099
|
+
additionalProperties: z36.union([z36.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
28100
|
+
minimum: z36.number().optional(),
|
|
28101
|
+
maximum: z36.number().optional(),
|
|
28102
|
+
minLength: z36.number().optional(),
|
|
28103
|
+
maxLength: z36.number().optional(),
|
|
28104
|
+
pattern: z36.string().optional()
|
|
27276
28105
|
})
|
|
27277
28106
|
);
|
|
27278
|
-
var serverLogicMediaTypeSchema =
|
|
28107
|
+
var serverLogicMediaTypeSchema = z36.object({
|
|
27279
28108
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
27280
|
-
example:
|
|
28109
|
+
example: z36.unknown().optional()
|
|
27281
28110
|
});
|
|
27282
|
-
var serverLogicResponseSchema =
|
|
27283
|
-
description:
|
|
27284
|
-
content:
|
|
28111
|
+
var serverLogicResponseSchema = z36.object({
|
|
28112
|
+
description: z36.string().optional(),
|
|
28113
|
+
content: z36.record(z36.string(), serverLogicMediaTypeSchema).optional()
|
|
27285
28114
|
});
|
|
27286
28115
|
var jsonBaseFields = {
|
|
27287
|
-
description:
|
|
27288
|
-
parameters:
|
|
28116
|
+
description: z36.string(),
|
|
28117
|
+
parameters: z36.array(parameterMetaSchema).optional(),
|
|
27289
28118
|
response: serverLogicResponseSchema.optional(),
|
|
27290
28119
|
cache: serverLogicCacheConfigSchema.optional()
|
|
27291
28120
|
};
|
|
27292
|
-
var jsonSqlServerLogicSchema =
|
|
28121
|
+
var jsonSqlServerLogicSchema = z36.object({
|
|
27293
28122
|
...jsonBaseFields,
|
|
27294
|
-
type:
|
|
27295
|
-
query:
|
|
27296
|
-
connectionId:
|
|
28123
|
+
type: z36.literal("sql").optional(),
|
|
28124
|
+
query: z36.string(),
|
|
28125
|
+
connectionId: z36.string()
|
|
27297
28126
|
});
|
|
27298
|
-
var jsonTypeScriptServerLogicSchema =
|
|
28127
|
+
var jsonTypeScriptServerLogicSchema = z36.object({
|
|
27299
28128
|
...jsonBaseFields,
|
|
27300
|
-
type:
|
|
27301
|
-
handlerPath:
|
|
28129
|
+
type: z36.literal("typescript"),
|
|
28130
|
+
handlerPath: z36.string()
|
|
27302
28131
|
});
|
|
27303
|
-
var anyJsonServerLogicSchema =
|
|
28132
|
+
var anyJsonServerLogicSchema = z36.union([
|
|
27304
28133
|
jsonTypeScriptServerLogicSchema,
|
|
27305
28134
|
jsonSqlServerLogicSchema
|
|
27306
28135
|
]);
|