@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/index.js
CHANGED
|
@@ -3681,11 +3681,14 @@ var googleAdsOauthConnector = new ConnectorPlugin({
|
|
|
3681
3681
|
]
|
|
3682
3682
|
},
|
|
3683
3683
|
systemPrompt: {
|
|
3684
|
-
en: `###
|
|
3685
|
-
|
|
3686
|
-
- {customerId} in
|
|
3684
|
+
en: `### Tools
|
|
3685
|
+
|
|
3686
|
+
- \`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.
|
|
3687
|
+
- \`google-ads-oauth_listCustomers\`: List accessible Google Ads customer accounts. Use this during setup to discover available accounts.
|
|
3687
3688
|
|
|
3688
|
-
###
|
|
3689
|
+
### Google Ads API Reference
|
|
3690
|
+
|
|
3691
|
+
#### Query Data (searchStream)
|
|
3689
3692
|
- POST customers/{customerId}/googleAds:searchStream
|
|
3690
3693
|
- Body: { "query": "SELECT campaign.id, campaign.name, metrics.impressions FROM campaign WHERE segments.date DURING LAST_30_DAYS" }
|
|
3691
3694
|
|
|
@@ -3731,11 +3734,14 @@ rows.forEach(row => console.log(row));
|
|
|
3731
3734
|
// List accessible customer accounts
|
|
3732
3735
|
const customerIds = await ads.listAccessibleCustomers();
|
|
3733
3736
|
\`\`\``,
|
|
3734
|
-
ja: `###
|
|
3735
|
-
- 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
|
|
3736
|
-
- \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
|
|
3737
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
3737
3738
|
|
|
3738
|
-
|
|
3739
|
+
- \`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
|
|
3740
|
+
- \`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
|
|
3741
|
+
|
|
3742
|
+
### Google Ads API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
3743
|
+
|
|
3744
|
+
#### \u30C7\u30FC\u30BF\u306E\u30AF\u30A8\u30EA (searchStream)
|
|
3739
3745
|
- POST customers/{customerId}/googleAds:searchStream
|
|
3740
3746
|
- Body: { "query": "SELECT campaign.id, campaign.name, metrics.impressions FROM campaign WHERE segments.date DURING LAST_30_DAYS" }
|
|
3741
3747
|
|
|
@@ -4531,11 +4537,15 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
4531
4537
|
]
|
|
4532
4538
|
},
|
|
4533
4539
|
systemPrompt: {
|
|
4534
|
-
en: `###
|
|
4535
|
-
|
|
4536
|
-
- {propertyId} in
|
|
4540
|
+
en: `### Tools
|
|
4541
|
+
|
|
4542
|
+
- \`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.
|
|
4543
|
+
- \`google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
4544
|
+
- \`google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
4537
4545
|
|
|
4538
|
-
###
|
|
4546
|
+
### GA4 Data API Reference
|
|
4547
|
+
|
|
4548
|
+
#### Get Metadata (Check available dimensions and metrics)
|
|
4539
4549
|
- GET properties/{propertyId}/metadata
|
|
4540
4550
|
|
|
4541
4551
|
### Get Report
|
|
@@ -4591,11 +4601,15 @@ const realtime = await ga.runRealtimeReport({
|
|
|
4591
4601
|
dimensions: [{ name: "country" }],
|
|
4592
4602
|
});
|
|
4593
4603
|
\`\`\``,
|
|
4594
|
-
ja: `###
|
|
4595
|
-
|
|
4596
|
-
- \u30D1\u30B9\u5185\u306E
|
|
4604
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
4605
|
+
|
|
4606
|
+
- \`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
|
|
4607
|
+
- \`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
|
|
4608
|
+
- \`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
|
|
4597
4609
|
|
|
4598
|
-
### \
|
|
4610
|
+
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
4611
|
+
|
|
4612
|
+
#### \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
|
|
4599
4613
|
- GET properties/{propertyId}/metadata
|
|
4600
4614
|
|
|
4601
4615
|
### \u30EC\u30DD\u30FC\u30C8\u306E\u53D6\u5F97
|
|
@@ -4881,9 +4895,13 @@ var googleSheetsOauthConnector = new ConnectorPlugin({
|
|
|
4881
4895
|
]
|
|
4882
4896
|
},
|
|
4883
4897
|
systemPrompt: {
|
|
4884
|
-
en: `###
|
|
4898
|
+
en: `### Tools
|
|
4899
|
+
|
|
4900
|
+
- \`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.
|
|
4885
4901
|
|
|
4886
|
-
###
|
|
4902
|
+
### Google Sheets API Reference
|
|
4903
|
+
|
|
4904
|
+
#### Available Endpoints
|
|
4887
4905
|
- GET \`/{spreadsheetId}\` \u2014 Get spreadsheet metadata (title, sheets, properties)
|
|
4888
4906
|
- GET \`/{spreadsheetId}/values/{range}\` \u2014 Get cell values for a range
|
|
4889
4907
|
- GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 Get values for multiple ranges
|
|
@@ -4925,9 +4943,13 @@ console.log(values.values); // 2D array
|
|
|
4925
4943
|
const batch = await sheets.batchGetValues(["Sheet1!A1:B5", "Sheet2!A1:C3"]);
|
|
4926
4944
|
batch.valueRanges.forEach(vr => console.log(vr.range, vr.values));
|
|
4927
4945
|
\`\`\``,
|
|
4928
|
-
ja: `###
|
|
4946
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
4947
|
+
|
|
4948
|
+
- \`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
|
|
4949
|
+
|
|
4950
|
+
### Google Sheets API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
4929
4951
|
|
|
4930
|
-
|
|
4952
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
4931
4953
|
- 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
|
|
4932
4954
|
- GET \`/{spreadsheetId}/values/{range}\` \u2014 \u7BC4\u56F2\u306E\u30BB\u30EB\u5024\u3092\u53D6\u5F97
|
|
4933
4955
|
- GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 \u8907\u6570\u7BC4\u56F2\u306E\u5024\u3092\u53D6\u5F97
|
|
@@ -5176,9 +5198,13 @@ var hubspotOauthConnector = new ConnectorPlugin({
|
|
|
5176
5198
|
]
|
|
5177
5199
|
},
|
|
5178
5200
|
systemPrompt: {
|
|
5179
|
-
en: `###
|
|
5201
|
+
en: `### Tools
|
|
5202
|
+
|
|
5203
|
+
- \`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.
|
|
5180
5204
|
|
|
5181
|
-
###
|
|
5205
|
+
### HubSpot API Reference
|
|
5206
|
+
|
|
5207
|
+
#### Available Endpoints
|
|
5182
5208
|
- GET \`/crm/v3/objects/contacts\` \u2014 List contacts
|
|
5183
5209
|
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 Get a contact
|
|
5184
5210
|
- GET \`/crm/v3/objects/deals\` \u2014 List deals
|
|
@@ -5217,9 +5243,13 @@ const hubspot = connection("<connectionId>");
|
|
|
5217
5243
|
const res = await hubspot.request("/crm/v3/objects/contacts?limit=10");
|
|
5218
5244
|
const data = await res.json();
|
|
5219
5245
|
\`\`\``,
|
|
5220
|
-
ja: `###
|
|
5246
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
5221
5247
|
|
|
5222
|
-
|
|
5248
|
+
- \`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
|
|
5249
|
+
|
|
5250
|
+
### HubSpot API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
5251
|
+
|
|
5252
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
5223
5253
|
- GET \`/crm/v3/objects/contacts\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
5224
5254
|
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u53D6\u5F97
|
|
5225
5255
|
- GET \`/crm/v3/objects/deals\` \u2014 \u53D6\u5F15\u4E00\u89A7\u3092\u53D6\u5F97
|
|
@@ -5463,9 +5493,13 @@ var stripeOauthConnector = new ConnectorPlugin({
|
|
|
5463
5493
|
]
|
|
5464
5494
|
},
|
|
5465
5495
|
systemPrompt: {
|
|
5466
|
-
en: `###
|
|
5496
|
+
en: `### Tools
|
|
5497
|
+
|
|
5498
|
+
- \`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\`.
|
|
5467
5499
|
|
|
5468
|
-
###
|
|
5500
|
+
### Stripe API Reference
|
|
5501
|
+
|
|
5502
|
+
#### Available Endpoints
|
|
5469
5503
|
- GET \`/v1/charges\` \u2014 List charges
|
|
5470
5504
|
- GET \`/v1/charges/{chargeId}\` \u2014 Get a charge
|
|
5471
5505
|
- GET \`/v1/customers\` \u2014 List customers
|
|
@@ -5508,9 +5542,13 @@ const stripe = connection("<connectionId>");
|
|
|
5508
5542
|
const res = await stripe.request("/v1/customers?limit=10");
|
|
5509
5543
|
const data = await res.json();
|
|
5510
5544
|
\`\`\``,
|
|
5511
|
-
ja: `###
|
|
5545
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
5546
|
+
|
|
5547
|
+
- \`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
|
|
5548
|
+
|
|
5549
|
+
### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
5512
5550
|
|
|
5513
|
-
|
|
5551
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
5514
5552
|
- GET \`/v1/charges\` \u2014 \u8ACB\u6C42\u4E00\u89A7\u3092\u53D6\u5F97
|
|
5515
5553
|
- GET \`/v1/charges/{chargeId}\` \u2014 \u8ACB\u6C42\u3092\u53D6\u5F97
|
|
5516
5554
|
- GET \`/v1/customers\` \u2014 \u9867\u5BA2\u4E00\u89A7\u3092\u53D6\u5F97
|
|
@@ -5782,9 +5820,13 @@ var airtableOauthConnector = new ConnectorPlugin({
|
|
|
5782
5820
|
]
|
|
5783
5821
|
},
|
|
5784
5822
|
systemPrompt: {
|
|
5785
|
-
en: `###
|
|
5823
|
+
en: `### Tools
|
|
5824
|
+
|
|
5825
|
+
- \`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.
|
|
5826
|
+
|
|
5827
|
+
### Airtable API Reference
|
|
5786
5828
|
|
|
5787
|
-
|
|
5829
|
+
#### Available Endpoints
|
|
5788
5830
|
- GET \`/meta/bases/{baseId}/tables\` \u2014 List tables in a base
|
|
5789
5831
|
- GET \`/{baseId}/{tableIdOrName}\` \u2014 List records in a table
|
|
5790
5832
|
- GET \`/{baseId}/{tableIdOrName}/{recordId}\` \u2014 Get a single record
|
|
@@ -5826,9 +5868,13 @@ const data = await res.json();
|
|
|
5826
5868
|
const records = await airtable.request("/{baseId}/Tasks?maxRecords=100");
|
|
5827
5869
|
const recordsData = await records.json();
|
|
5828
5870
|
\`\`\``,
|
|
5829
|
-
ja: `###
|
|
5871
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
5872
|
+
|
|
5873
|
+
- \`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
|
|
5874
|
+
|
|
5875
|
+
### Airtable API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
5830
5876
|
|
|
5831
|
-
|
|
5877
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
5832
5878
|
- GET \`/meta/bases/{baseId}/tables\` \u2014 \u30D9\u30FC\u30B9\u5185\u306E\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97
|
|
5833
5879
|
- GET \`/{baseId}/{tableIdOrName}\` \u2014 \u30C6\u30FC\u30D6\u30EB\u5185\u306E\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
5834
5880
|
- GET \`/{baseId}/{tableIdOrName}/{recordId}\` \u2014 \u5358\u4E00\u30EC\u30B3\u30FC\u30C9\u3092\u53D6\u5F97
|
|
@@ -6281,12 +6327,13 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
|
|
|
6281
6327
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
6282
6328
|
onboarding: kintoneApiTokenOnboarding,
|
|
6283
6329
|
systemPrompt: {
|
|
6284
|
-
en: `###
|
|
6285
|
-
|
|
6286
|
-
- The
|
|
6287
|
-
|
|
6330
|
+
en: `### Tools
|
|
6331
|
+
|
|
6332
|
+
- \`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.
|
|
6333
|
+
|
|
6334
|
+
### kintone REST API Reference
|
|
6288
6335
|
|
|
6289
|
-
|
|
6336
|
+
#### List Apps
|
|
6290
6337
|
- GET apps.json
|
|
6291
6338
|
|
|
6292
6339
|
### Get Field Definitions
|
|
@@ -6296,20 +6343,17 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
|
|
|
6296
6343
|
- GET records.json?app={appId}&query={query}
|
|
6297
6344
|
- Query example: records.json?app=1&query=updatedTime > "2024-01-01" order by recordNumber asc limit 100
|
|
6298
6345
|
|
|
6299
|
-
|
|
6346
|
+
#### Add Record
|
|
6300
6347
|
- POST record.json
|
|
6301
6348
|
- Body: { "app": 1, "record": { "fieldName": { "value": "value" } } }
|
|
6302
6349
|
|
|
6303
|
-
|
|
6350
|
+
#### kintone Query Syntax
|
|
6304
6351
|
- Comparison: fieldName = "value", fieldName > 100
|
|
6305
6352
|
- Operators: and, or, not
|
|
6306
6353
|
- Sort: order by fieldName asc/desc
|
|
6307
6354
|
- Limit: limit 100 offset 0
|
|
6308
6355
|
- String: like "partial match"
|
|
6309
6356
|
|
|
6310
|
-
### Tips
|
|
6311
|
-
- API tokens are scoped per app. If you need to access multiple apps, you can combine multiple tokens separated by commas.
|
|
6312
|
-
|
|
6313
6357
|
### Business Logic
|
|
6314
6358
|
|
|
6315
6359
|
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.
|
|
@@ -6330,12 +6374,13 @@ await kintone.request("/k/v1/record.json", {
|
|
|
6330
6374
|
body: JSON.stringify({ app: 1, record: { title: { value: "Hello" } } }),
|
|
6331
6375
|
});
|
|
6332
6376
|
\`\`\``,
|
|
6333
|
-
ja: `###
|
|
6334
|
-
|
|
6335
|
-
- \
|
|
6336
|
-
|
|
6377
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
6378
|
+
|
|
6379
|
+
- \`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
|
|
6380
|
+
|
|
6381
|
+
### kintone REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
6337
6382
|
|
|
6338
|
-
|
|
6383
|
+
#### \u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97
|
|
6339
6384
|
- GET apps.json
|
|
6340
6385
|
|
|
6341
6386
|
### \u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97
|
|
@@ -6345,20 +6390,17 @@ await kintone.request("/k/v1/record.json", {
|
|
|
6345
6390
|
- GET records.json?app={appId}&query={query}
|
|
6346
6391
|
- \u30AF\u30A8\u30EA\u4F8B: records.json?app=1&query=updatedTime > "2024-01-01" order by recordNumber asc limit 100
|
|
6347
6392
|
|
|
6348
|
-
|
|
6393
|
+
#### \u30EC\u30B3\u30FC\u30C9\u306E\u8FFD\u52A0
|
|
6349
6394
|
- POST record.json
|
|
6350
6395
|
- Body: { "app": 1, "record": { "fieldName": { "value": "value" } } }
|
|
6351
6396
|
|
|
6352
|
-
|
|
6397
|
+
#### kintone \u30AF\u30A8\u30EA\u69CB\u6587
|
|
6353
6398
|
- \u6BD4\u8F03: fieldName = "value", fieldName > 100
|
|
6354
6399
|
- \u6F14\u7B97\u5B50: and, or, not
|
|
6355
6400
|
- \u30BD\u30FC\u30C8: order by fieldName asc/desc
|
|
6356
6401
|
- \u5236\u9650: limit 100 offset 0
|
|
6357
6402
|
- \u6587\u5B57\u5217: like "\u90E8\u5206\u4E00\u81F4"
|
|
6358
6403
|
|
|
6359
|
-
### \u30D2\u30F3\u30C8
|
|
6360
|
-
- 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
|
|
6361
|
-
|
|
6362
6404
|
### Business Logic
|
|
6363
6405
|
|
|
6364
6406
|
\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
|
|
@@ -7425,6 +7467,22 @@ export default async function handler(c: Context) {
|
|
|
7425
7467
|
tools: tools25
|
|
7426
7468
|
});
|
|
7427
7469
|
|
|
7470
|
+
// ../connectors/src/connectors/amplitude/setup.ts
|
|
7471
|
+
var amplitudeOnboarding = new ConnectorOnboarding({
|
|
7472
|
+
dataOverviewInstructions: {
|
|
7473
|
+
en: `1. Check the connection's region parameter: use https://analytics.eu.amplitude.com for EU, https://amplitude.com for US (default)
|
|
7474
|
+
2. Call amplitude_request with GET {baseUrl}/api/2/events/list to list available event types
|
|
7475
|
+
3. Call amplitude_request with GET {baseUrl}/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH to export raw event data for a time range
|
|
7476
|
+
4. Use GET {baseUrl}/api/2/usersearch?user=QUERY and GET {baseUrl}/api/2/useractivity?user=AMPLITUDE_ID to explore user-level data
|
|
7477
|
+
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.`,
|
|
7478
|
+
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
|
|
7479
|
+
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
|
|
7480
|
+
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
|
|
7481
|
+
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
|
|
7482
|
+
\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`
|
|
7483
|
+
}
|
|
7484
|
+
});
|
|
7485
|
+
|
|
7428
7486
|
// ../connectors/src/connectors/amplitude/parameters.ts
|
|
7429
7487
|
var parameters26 = {
|
|
7430
7488
|
apiKey: new ParameterDefinition({
|
|
@@ -7444,11 +7502,106 @@ var parameters26 = {
|
|
|
7444
7502
|
type: "text",
|
|
7445
7503
|
secret: true,
|
|
7446
7504
|
required: true
|
|
7505
|
+
}),
|
|
7506
|
+
region: new ParameterDefinition({
|
|
7507
|
+
slug: "region",
|
|
7508
|
+
name: "Region",
|
|
7509
|
+
description: 'Amplitude data region. Set to "eu" if your Amplitude project is hosted in the EU. Leave empty for US (default).',
|
|
7510
|
+
envVarBaseKey: "AMPLITUDE_REGION",
|
|
7511
|
+
type: "text",
|
|
7512
|
+
secret: false,
|
|
7513
|
+
required: false
|
|
7447
7514
|
})
|
|
7448
7515
|
};
|
|
7449
7516
|
|
|
7517
|
+
// ../connectors/src/connectors/amplitude/tools/request.ts
|
|
7518
|
+
import { z as z30 } from "zod";
|
|
7519
|
+
var REQUEST_TIMEOUT_MS19 = 6e4;
|
|
7520
|
+
var inputSchema30 = z30.object({
|
|
7521
|
+
toolUseIntent: z30.string().optional().describe(
|
|
7522
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
7523
|
+
),
|
|
7524
|
+
connectionId: z30.string().describe("ID of the Amplitude connection to use"),
|
|
7525
|
+
method: z30.enum(["GET", "POST"]).describe(
|
|
7526
|
+
"HTTP method. GET for most read endpoints (events/list, export, usersearch, useractivity). POST is rarely needed."
|
|
7527
|
+
),
|
|
7528
|
+
url: z30.string().describe(
|
|
7529
|
+
"Full URL including query parameters (e.g., 'https://amplitude.com/api/2/events/list', 'https://amplitude.com/api/2/export?start=20240101T00&end=20240102T00')"
|
|
7530
|
+
),
|
|
7531
|
+
body: z30.record(z30.string(), z30.unknown()).optional().describe("Request body (JSON) for POST requests")
|
|
7532
|
+
});
|
|
7533
|
+
var outputSchema30 = z30.discriminatedUnion("success", [
|
|
7534
|
+
z30.object({
|
|
7535
|
+
success: z30.literal(true),
|
|
7536
|
+
status: z30.number(),
|
|
7537
|
+
data: z30.record(z30.string(), z30.unknown())
|
|
7538
|
+
}),
|
|
7539
|
+
z30.object({
|
|
7540
|
+
success: z30.literal(false),
|
|
7541
|
+
error: z30.string()
|
|
7542
|
+
})
|
|
7543
|
+
]);
|
|
7544
|
+
var requestTool13 = new ConnectorTool({
|
|
7545
|
+
name: "request",
|
|
7546
|
+
description: `Send authenticated requests to the Amplitude REST API.
|
|
7547
|
+
Authentication is handled automatically using Basic auth (API Key + Secret Key).
|
|
7548
|
+
Provide the full URL including any query parameters.
|
|
7549
|
+
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.
|
|
7550
|
+
|
|
7551
|
+
Recommended endpoints (available on all plans):
|
|
7552
|
+
- GET {baseUrl}/api/2/events/list \u2014 list event types
|
|
7553
|
+
- GET {baseUrl}/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH \u2014 export raw events
|
|
7554
|
+
- GET {baseUrl}/api/2/usersearch?user=QUERY \u2014 search users
|
|
7555
|
+
- GET {baseUrl}/api/2/useractivity?user=AMPLITUDE_ID \u2014 user activity
|
|
7556
|
+
|
|
7557
|
+
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.`,
|
|
7558
|
+
inputSchema: inputSchema30,
|
|
7559
|
+
outputSchema: outputSchema30,
|
|
7560
|
+
async execute({ connectionId, method, url, body }, connections) {
|
|
7561
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
7562
|
+
if (!connection2) {
|
|
7563
|
+
return {
|
|
7564
|
+
success: false,
|
|
7565
|
+
error: `Connection ${connectionId} not found`
|
|
7566
|
+
};
|
|
7567
|
+
}
|
|
7568
|
+
console.log(
|
|
7569
|
+
`[connector-request] amplitude/${connection2.name}: ${method} ${url}`
|
|
7570
|
+
);
|
|
7571
|
+
try {
|
|
7572
|
+
const apiKey = parameters26.apiKey.getValue(connection2);
|
|
7573
|
+
const secretKey = parameters26.secretKey.getValue(connection2);
|
|
7574
|
+
const authToken = btoa(`${apiKey}:${secretKey}`);
|
|
7575
|
+
const controller = new AbortController();
|
|
7576
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS19);
|
|
7577
|
+
try {
|
|
7578
|
+
const response = await fetch(url, {
|
|
7579
|
+
method,
|
|
7580
|
+
headers: {
|
|
7581
|
+
Authorization: `Basic ${authToken}`,
|
|
7582
|
+
"Content-Type": "application/json"
|
|
7583
|
+
},
|
|
7584
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
7585
|
+
signal: controller.signal
|
|
7586
|
+
});
|
|
7587
|
+
const data = await response.json();
|
|
7588
|
+
if (!response.ok) {
|
|
7589
|
+
const errorMessage = typeof data?.error === "string" ? data.error : typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`;
|
|
7590
|
+
return { success: false, error: errorMessage };
|
|
7591
|
+
}
|
|
7592
|
+
return { success: true, status: response.status, data };
|
|
7593
|
+
} finally {
|
|
7594
|
+
clearTimeout(timeout);
|
|
7595
|
+
}
|
|
7596
|
+
} catch (err) {
|
|
7597
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
7598
|
+
return { success: false, error: msg };
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
});
|
|
7602
|
+
|
|
7450
7603
|
// ../connectors/src/connectors/amplitude/index.ts
|
|
7451
|
-
var tools26 = {};
|
|
7604
|
+
var tools26 = { request: requestTool13 };
|
|
7452
7605
|
var amplitudeConnector = new ConnectorPlugin({
|
|
7453
7606
|
slug: "amplitude",
|
|
7454
7607
|
authType: null,
|
|
@@ -7457,57 +7610,154 @@ var amplitudeConnector = new ConnectorPlugin({
|
|
|
7457
7610
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2UBJSdRlFJaLq52WUCTBEB/308b59b374cf6c662ac70989860bffd7/amplitude-icon.svg",
|
|
7458
7611
|
parameters: parameters26,
|
|
7459
7612
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
7613
|
+
onboarding: amplitudeOnboarding,
|
|
7460
7614
|
systemPrompt: {
|
|
7461
|
-
en: `###
|
|
7462
|
-
|
|
7615
|
+
en: `### Tools
|
|
7616
|
+
|
|
7617
|
+
- \`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.
|
|
7618
|
+
|
|
7619
|
+
### Business Logic
|
|
7620
|
+
|
|
7621
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
7622
|
+
|
|
7623
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
7624
|
+
- \`client.request(url, init?)\` \u2014 low-level authenticated fetch (provide full URL)
|
|
7625
|
+
- \`client.listEventTypes()\` \u2014 list all event types
|
|
7626
|
+
- \`client.eventSegmentation(options)\` \u2014 run event segmentation query (e, start, end, m?, i?, g?)
|
|
7627
|
+
- \`client.userSearch(query)\` \u2014 search users by user or amplitude ID
|
|
7628
|
+
- \`client.userActivity(amplitudeId, options?)\` \u2014 get user activity by amplitude ID
|
|
7463
7629
|
|
|
7464
7630
|
\`\`\`ts
|
|
7631
|
+
import type { Context } from "hono";
|
|
7465
7632
|
import { connection } from "@squadbase/vite-server/connectors/amplitude";
|
|
7466
7633
|
|
|
7467
|
-
const
|
|
7634
|
+
const amp = connection("<connectionId>");
|
|
7468
7635
|
|
|
7469
|
-
|
|
7470
|
-
const
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
});
|
|
7475
|
-
|
|
7636
|
+
export default async function handler(c: Context) {
|
|
7637
|
+
const { eventType, start, end } = await c.req.json<{
|
|
7638
|
+
eventType: string;
|
|
7639
|
+
start: string;
|
|
7640
|
+
end: string;
|
|
7641
|
+
}>();
|
|
7642
|
+
|
|
7643
|
+
const result = await amp.eventSegmentation({
|
|
7644
|
+
e: { event_type: eventType },
|
|
7645
|
+
start,
|
|
7646
|
+
end,
|
|
7647
|
+
});
|
|
7648
|
+
|
|
7649
|
+
return c.json(result);
|
|
7650
|
+
}
|
|
7476
7651
|
\`\`\`
|
|
7477
7652
|
|
|
7478
|
-
###
|
|
7479
|
-
|
|
7653
|
+
### Amplitude REST API Reference
|
|
7654
|
+
|
|
7655
|
+
- Authentication: Basic auth (API Key:Secret Key, handled automatically)
|
|
7656
|
+
- All timestamps use YYYYMMDD format for date parameters
|
|
7657
|
+
|
|
7658
|
+
#### Endpoints Available on All Plans
|
|
7480
7659
|
- GET \`https://amplitude.com/api/2/events/list\` \u2014 List event types
|
|
7481
|
-
- GET \`https://amplitude.com/api/2/
|
|
7482
|
-
- GET \`https://amplitude.com/api/2/
|
|
7483
|
-
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7660
|
+
- GET \`https://amplitude.com/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH\` \u2014 Export raw events
|
|
7661
|
+
- GET \`https://amplitude.com/api/2/usersearch?user=QUERY\` \u2014 Search users
|
|
7662
|
+
- GET \`https://amplitude.com/api/2/useractivity?user=AMPLITUDE_ID\` \u2014 User activity
|
|
7663
|
+
|
|
7664
|
+
#### Endpoints Requiring Growth or Enterprise Plan (will return 403 on free/Starter plans)
|
|
7665
|
+
- GET \`https://amplitude.com/api/2/events/segmentation\` \u2014 Event segmentation
|
|
7666
|
+
- GET \`https://amplitude.com/api/2/funnels\` \u2014 Funnel analysis
|
|
7667
|
+
- GET \`https://amplitude.com/api/2/retention\` \u2014 Retention analysis
|
|
7668
|
+
- GET \`https://amplitude.com/api/2/revenue\` \u2014 Revenue analysis
|
|
7669
|
+
|
|
7670
|
+
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.
|
|
7671
|
+
|
|
7672
|
+
#### Event Segmentation Query Parameters (Growth/Enterprise only)
|
|
7673
|
+
- \`e\` \u2014 JSON-encoded event definition (e.g., \`{"event_type":"Click"}\`)
|
|
7674
|
+
- \`start\` \u2014 Start date (YYYYMMDD)
|
|
7675
|
+
- \`end\` \u2014 End date (YYYYMMDD)
|
|
7676
|
+
- \`m\` \u2014 Metric type (uniques, totals, avg, etc.)
|
|
7677
|
+
- \`i\` \u2014 Interval (1=daily, 7=weekly, 30=monthly)
|
|
7678
|
+
- \`g\` \u2014 Group by property`,
|
|
7679
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
7680
|
+
|
|
7681
|
+
- \`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
|
|
7682
|
+
|
|
7683
|
+
### Business Logic
|
|
7684
|
+
|
|
7685
|
+
\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
|
|
7686
|
+
|
|
7687
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
7688
|
+
- \`client.request(url, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch\uFF08\u5B8C\u5168\u306AURL\u3092\u6307\u5B9A\uFF09
|
|
7689
|
+
- \`client.listEventTypes()\` \u2014 \u5168\u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u306E\u4E00\u89A7
|
|
7690
|
+
- \`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
|
|
7691
|
+
- \`client.userSearch(query)\` \u2014 \u30E6\u30FC\u30B6\u30FC\u307E\u305F\u306Famplitude ID\u3067\u30E6\u30FC\u30B6\u30FC\u3092\u691C\u7D22
|
|
7692
|
+
- \`client.userActivity(amplitudeId, options?)\` \u2014 amplitude ID\u3067\u30E6\u30FC\u30B6\u30FC\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3\u3092\u53D6\u5F97
|
|
7486
7693
|
|
|
7487
7694
|
\`\`\`ts
|
|
7695
|
+
import type { Context } from "hono";
|
|
7488
7696
|
import { connection } from "@squadbase/vite-server/connectors/amplitude";
|
|
7489
7697
|
|
|
7490
|
-
const
|
|
7698
|
+
const amp = connection("<connectionId>");
|
|
7491
7699
|
|
|
7492
|
-
|
|
7493
|
-
const
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
});
|
|
7498
|
-
|
|
7700
|
+
export default async function handler(c: Context) {
|
|
7701
|
+
const { eventType, start, end } = await c.req.json<{
|
|
7702
|
+
eventType: string;
|
|
7703
|
+
start: string;
|
|
7704
|
+
end: string;
|
|
7705
|
+
}>();
|
|
7706
|
+
|
|
7707
|
+
const result = await amp.eventSegmentation({
|
|
7708
|
+
e: { event_type: eventType },
|
|
7709
|
+
start,
|
|
7710
|
+
end,
|
|
7711
|
+
});
|
|
7712
|
+
|
|
7713
|
+
return c.json(result);
|
|
7714
|
+
}
|
|
7499
7715
|
\`\`\`
|
|
7500
7716
|
|
|
7501
|
-
### \
|
|
7502
|
-
|
|
7717
|
+
### Amplitude REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
7718
|
+
|
|
7719
|
+
- \u8A8D\u8A3C: Basic\u8A8D\u8A3C\uFF08API Key:Secret Key\u3001\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
7720
|
+
- \u65E5\u4ED8\u30D1\u30E9\u30E1\u30FC\u30BF\u306F\u3059\u3079\u3066YYYYMMDD\u5F62\u5F0F\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u4F7F\u7528
|
|
7721
|
+
|
|
7722
|
+
#### \u5168\u30D7\u30E9\u30F3\u3067\u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
7503
7723
|
- GET \`https://amplitude.com/api/2/events/list\` \u2014 \u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u4E00\u89A7
|
|
7504
|
-
- GET \`https://amplitude.com/api/2/
|
|
7505
|
-
- GET \`https://amplitude.com/api/2/
|
|
7506
|
-
-
|
|
7724
|
+
- GET \`https://amplitude.com/api/2/export?start=YYYYMMDDTHH&end=YYYYMMDDTHH\` \u2014 \u751F\u30A4\u30D9\u30F3\u30C8\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8
|
|
7725
|
+
- GET \`https://amplitude.com/api/2/usersearch?user=QUERY\` \u2014 \u30E6\u30FC\u30B6\u30FC\u691C\u7D22
|
|
7726
|
+
- GET \`https://amplitude.com/api/2/useractivity?user=AMPLITUDE_ID\` \u2014 \u30E6\u30FC\u30B6\u30FC\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3
|
|
7727
|
+
|
|
7728
|
+
#### 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
|
|
7729
|
+
- GET \`https://amplitude.com/api/2/events/segmentation\` \u2014 \u30A4\u30D9\u30F3\u30C8\u30BB\u30B0\u30E1\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3
|
|
7730
|
+
- GET \`https://amplitude.com/api/2/funnels\` \u2014 \u30D5\u30A1\u30CD\u30EB\u5206\u6790
|
|
7731
|
+
- GET \`https://amplitude.com/api/2/retention\` \u2014 \u30EA\u30C6\u30F3\u30B7\u30E7\u30F3\u5206\u6790
|
|
7732
|
+
- GET \`https://amplitude.com/api/2/revenue\` \u2014 \u53CE\u76CA\u5206\u6790
|
|
7733
|
+
|
|
7734
|
+
\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
|
|
7735
|
+
|
|
7736
|
+
#### \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
|
|
7737
|
+
- \`e\` \u2014 JSON\u30A8\u30F3\u30B3\u30FC\u30C9\u3055\u308C\u305F\u30A4\u30D9\u30F3\u30C8\u5B9A\u7FA9\uFF08\u4F8B: \`{"event_type":"Click"}\`\uFF09
|
|
7738
|
+
- \`start\` \u2014 \u958B\u59CB\u65E5\uFF08YYYYMMDD\uFF09
|
|
7739
|
+
- \`end\` \u2014 \u7D42\u4E86\u65E5\uFF08YYYYMMDD\uFF09
|
|
7740
|
+
- \`m\` \u2014 \u30E1\u30C8\u30EA\u30AF\u30B9\u30BF\u30A4\u30D7\uFF08uniques, totals, avg\u306A\u3069\uFF09
|
|
7741
|
+
- \`i\` \u2014 \u30A4\u30F3\u30BF\u30FC\u30D0\u30EB\uFF081=\u65E5\u6B21\u30017=\u9031\u6B21\u300130=\u6708\u6B21\uFF09
|
|
7742
|
+
- \`g\` \u2014 \u30B0\u30EB\u30FC\u30D7\u5316\u30D7\u30ED\u30D1\u30C6\u30A3`
|
|
7507
7743
|
},
|
|
7508
7744
|
tools: tools26
|
|
7509
7745
|
});
|
|
7510
7746
|
|
|
7747
|
+
// ../connectors/src/connectors/attio/setup.ts
|
|
7748
|
+
var attioOnboarding = new ConnectorOnboarding({
|
|
7749
|
+
dataOverviewInstructions: {
|
|
7750
|
+
en: `1. Call attio_request with GET /objects to list all available objects (people, companies, deals, etc.)
|
|
7751
|
+
2. Call attio_request with GET /objects/people/attributes to explore the people object attributes
|
|
7752
|
+
3. Call attio_request with POST /objects/people/records/query with { "limit": 5 } to sample people records
|
|
7753
|
+
4. Explore other objects (companies, deals) as needed`,
|
|
7754
|
+
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
|
|
7755
|
+
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
|
|
7756
|
+
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
|
|
7757
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\uFF08companies\u3001deals\uFF09\u3092\u63A2\u7D22`
|
|
7758
|
+
}
|
|
7759
|
+
});
|
|
7760
|
+
|
|
7511
7761
|
// ../connectors/src/connectors/attio/parameters.ts
|
|
7512
7762
|
var parameters27 = {
|
|
7513
7763
|
apiKey: new ParameterDefinition({
|
|
@@ -7521,8 +7771,86 @@ var parameters27 = {
|
|
|
7521
7771
|
})
|
|
7522
7772
|
};
|
|
7523
7773
|
|
|
7774
|
+
// ../connectors/src/connectors/attio/tools/request.ts
|
|
7775
|
+
import { z as z31 } from "zod";
|
|
7776
|
+
var BASE_URL11 = "https://api.attio.com/v2";
|
|
7777
|
+
var REQUEST_TIMEOUT_MS20 = 6e4;
|
|
7778
|
+
var inputSchema31 = z31.object({
|
|
7779
|
+
toolUseIntent: z31.string().optional().describe(
|
|
7780
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
7781
|
+
),
|
|
7782
|
+
connectionId: z31.string().describe("ID of the Attio connection to use"),
|
|
7783
|
+
method: z31.enum(["GET", "POST", "PATCH", "DELETE"]).describe(
|
|
7784
|
+
"HTTP method. GET for reading resources, POST for creating or querying records, PATCH for updating, DELETE for removing."
|
|
7785
|
+
),
|
|
7786
|
+
path: z31.string().describe(
|
|
7787
|
+
"API path (e.g., '/objects', '/objects/people/records/query', '/objects/companies/records/{record_id}')"
|
|
7788
|
+
),
|
|
7789
|
+
body: z31.record(z31.string(), z31.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
7790
|
+
});
|
|
7791
|
+
var outputSchema31 = z31.discriminatedUnion("success", [
|
|
7792
|
+
z31.object({
|
|
7793
|
+
success: z31.literal(true),
|
|
7794
|
+
status: z31.number(),
|
|
7795
|
+
data: z31.record(z31.string(), z31.unknown())
|
|
7796
|
+
}),
|
|
7797
|
+
z31.object({
|
|
7798
|
+
success: z31.literal(false),
|
|
7799
|
+
error: z31.string()
|
|
7800
|
+
})
|
|
7801
|
+
]);
|
|
7802
|
+
var requestTool14 = new ConnectorTool({
|
|
7803
|
+
name: "request",
|
|
7804
|
+
description: `Send authenticated requests to the Attio REST API.
|
|
7805
|
+
Authentication is handled automatically using the API Key (Bearer token).
|
|
7806
|
+
Use this tool for all Attio API interactions: querying records (people, companies, deals), listing objects and attributes, managing list entries, and working with notes.
|
|
7807
|
+
Note that querying records uses POST (not GET) with a request body for filters.`,
|
|
7808
|
+
inputSchema: inputSchema31,
|
|
7809
|
+
outputSchema: outputSchema31,
|
|
7810
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
7811
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
7812
|
+
if (!connection2) {
|
|
7813
|
+
return {
|
|
7814
|
+
success: false,
|
|
7815
|
+
error: `Connection ${connectionId} not found`
|
|
7816
|
+
};
|
|
7817
|
+
}
|
|
7818
|
+
console.log(
|
|
7819
|
+
`[connector-request] attio/${connection2.name}: ${method} ${path5}`
|
|
7820
|
+
);
|
|
7821
|
+
try {
|
|
7822
|
+
const apiKey = parameters27.apiKey.getValue(connection2);
|
|
7823
|
+
const url = `${BASE_URL11}${path5}`;
|
|
7824
|
+
const controller = new AbortController();
|
|
7825
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS20);
|
|
7826
|
+
try {
|
|
7827
|
+
const response = await fetch(url, {
|
|
7828
|
+
method,
|
|
7829
|
+
headers: {
|
|
7830
|
+
Authorization: `Bearer ${apiKey}`,
|
|
7831
|
+
"Content-Type": "application/json"
|
|
7832
|
+
},
|
|
7833
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
7834
|
+
signal: controller.signal
|
|
7835
|
+
});
|
|
7836
|
+
const data = await response.json();
|
|
7837
|
+
if (!response.ok) {
|
|
7838
|
+
const errorMessage = typeof data?.message === "string" ? data.message : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
7839
|
+
return { success: false, error: errorMessage };
|
|
7840
|
+
}
|
|
7841
|
+
return { success: true, status: response.status, data };
|
|
7842
|
+
} finally {
|
|
7843
|
+
clearTimeout(timeout);
|
|
7844
|
+
}
|
|
7845
|
+
} catch (err) {
|
|
7846
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
7847
|
+
return { success: false, error: msg };
|
|
7848
|
+
}
|
|
7849
|
+
}
|
|
7850
|
+
});
|
|
7851
|
+
|
|
7524
7852
|
// ../connectors/src/connectors/attio/index.ts
|
|
7525
|
-
var tools27 = {};
|
|
7853
|
+
var tools27 = { request: requestTool14 };
|
|
7526
7854
|
var attioConnector = new ConnectorPlugin({
|
|
7527
7855
|
slug: "attio",
|
|
7528
7856
|
authType: null,
|
|
@@ -7531,97 +7859,275 @@ var attioConnector = new ConnectorPlugin({
|
|
|
7531
7859
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2qqx99vvXJojUM3tSrSWPX/1e7c35e13da6b365b8b475c1effe568f/attio.svg",
|
|
7532
7860
|
parameters: parameters27,
|
|
7533
7861
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
7862
|
+
onboarding: attioOnboarding,
|
|
7534
7863
|
systemPrompt: {
|
|
7535
|
-
en: `###
|
|
7536
|
-
|
|
7864
|
+
en: `### Tools
|
|
7865
|
+
|
|
7866
|
+
- \`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.
|
|
7867
|
+
|
|
7868
|
+
### Business Logic
|
|
7869
|
+
|
|
7870
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
7871
|
+
|
|
7872
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
7873
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
7874
|
+
- \`client.listObjects()\` \u2014 list all objects (people, companies, deals, etc.)
|
|
7875
|
+
- \`client.listAttributes(object)\` \u2014 list attributes for an object
|
|
7876
|
+
- \`client.queryRecords(object, options?)\` \u2014 query records with filter/sort/pagination
|
|
7877
|
+
- \`client.getRecord(object, recordId)\` \u2014 fetch a single record
|
|
7878
|
+
- \`client.queryListEntries(listId, options?)\` \u2014 query list entries with filter/sort/pagination
|
|
7537
7879
|
|
|
7538
7880
|
\`\`\`ts
|
|
7881
|
+
import type { Context } from "hono";
|
|
7539
7882
|
import { connection } from "@squadbase/vite-server/connectors/attio";
|
|
7540
7883
|
|
|
7541
|
-
const
|
|
7884
|
+
const attio = connection("<connectionId>");
|
|
7542
7885
|
|
|
7543
|
-
|
|
7544
|
-
const
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
},
|
|
7550
|
-
|
|
7551
|
-
});
|
|
7552
|
-
|
|
7886
|
+
export default async function handler(c: Context) {
|
|
7887
|
+
const { object = "people", limit = 25 } = await c.req.json<{
|
|
7888
|
+
object?: string;
|
|
7889
|
+
limit?: number;
|
|
7890
|
+
}>();
|
|
7891
|
+
|
|
7892
|
+
const { data } = await attio.queryRecords(object, { limit });
|
|
7893
|
+
|
|
7894
|
+
return c.json({ records: data });
|
|
7895
|
+
}
|
|
7553
7896
|
\`\`\`
|
|
7554
7897
|
|
|
7555
|
-
###
|
|
7898
|
+
### Attio REST API Reference
|
|
7899
|
+
|
|
7900
|
+
- Base URL: \`https://api.attio.com/v2\`
|
|
7901
|
+
- Authentication: Bearer token (handled automatically)
|
|
7902
|
+
- Querying records uses POST with JSON body (not GET with query params)
|
|
7903
|
+
|
|
7904
|
+
#### Common Endpoints
|
|
7905
|
+
- GET \`/objects\` \u2014 List all objects
|
|
7906
|
+
- GET \`/objects/{object}/attributes\` \u2014 List attributes of an object
|
|
7556
7907
|
- POST \`/objects/{object}/records/query\` \u2014 Query records (people, companies, deals, etc.)
|
|
7557
7908
|
- GET \`/objects/{object}/records/{record_id}\` \u2014 Get a record
|
|
7558
7909
|
- POST \`/objects/{object}/records\` \u2014 Create a record
|
|
7559
7910
|
- PATCH \`/objects/{object}/records/{record_id}\` \u2014 Update a record
|
|
7560
7911
|
- DELETE \`/objects/{object}/records/{record_id}\` \u2014 Delete a record
|
|
7561
|
-
- GET \`/objects\` \u2014 List all objects
|
|
7562
|
-
- GET \`/objects/{object}/attributes\` \u2014 List attributes of an object
|
|
7563
7912
|
- POST \`/lists/{list_id}/entries/query\` \u2014 Query list entries
|
|
7564
7913
|
- POST \`/notes\` \u2014 Create a note
|
|
7565
|
-
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 Get notes for a record
|
|
7566
|
-
|
|
7567
|
-
|
|
7914
|
+
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 Get notes for a record
|
|
7915
|
+
|
|
7916
|
+
#### Query Body (for POST /objects/{object}/records/query)
|
|
7917
|
+
- \`filter\` \u2014 Filter conditions
|
|
7918
|
+
- \`sorts\` \u2014 Array of sort specifications
|
|
7919
|
+
- \`limit\` \u2014 Max records per page (default 25)
|
|
7920
|
+
- \`offset\` \u2014 Pagination offset`,
|
|
7921
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
7922
|
+
|
|
7923
|
+
- \`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
|
|
7924
|
+
|
|
7925
|
+
### Business Logic
|
|
7926
|
+
|
|
7927
|
+
\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
|
|
7928
|
+
|
|
7929
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
7930
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
7931
|
+
- \`client.listObjects()\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
7932
|
+
- \`client.listAttributes(object)\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
7933
|
+
- \`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
|
|
7934
|
+
- \`client.getRecord(object, recordId)\` \u2014 \u5358\u4E00\u30EC\u30B3\u30FC\u30C9\u3092\u53D6\u5F97
|
|
7935
|
+
- \`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
|
|
7568
7936
|
|
|
7569
7937
|
\`\`\`ts
|
|
7938
|
+
import type { Context } from "hono";
|
|
7570
7939
|
import { connection } from "@squadbase/vite-server/connectors/attio";
|
|
7571
7940
|
|
|
7572
|
-
const
|
|
7941
|
+
const attio = connection("<connectionId>");
|
|
7573
7942
|
|
|
7574
|
-
|
|
7575
|
-
const
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
},
|
|
7581
|
-
|
|
7582
|
-
});
|
|
7583
|
-
|
|
7943
|
+
export default async function handler(c: Context) {
|
|
7944
|
+
const { object = "people", limit = 25 } = await c.req.json<{
|
|
7945
|
+
object?: string;
|
|
7946
|
+
limit?: number;
|
|
7947
|
+
}>();
|
|
7948
|
+
|
|
7949
|
+
const { data } = await attio.queryRecords(object, { limit });
|
|
7950
|
+
|
|
7951
|
+
return c.json({ records: data });
|
|
7952
|
+
}
|
|
7584
7953
|
\`\`\`
|
|
7585
7954
|
|
|
7586
|
-
### \
|
|
7955
|
+
### Attio REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
7956
|
+
|
|
7957
|
+
- \u30D9\u30FC\u30B9URL: \`https://api.attio.com/v2\`
|
|
7958
|
+
- \u8A8D\u8A3C: Bearer\u30C8\u30FC\u30AF\u30F3\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
7959
|
+
- \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
|
|
7960
|
+
|
|
7961
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
7962
|
+
- GET \`/objects\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7
|
|
7963
|
+
- GET \`/objects/{object}/attributes\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
7587
7964
|
- POST \`/objects/{object}/records/query\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u691C\u7D22\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
7588
7965
|
- GET \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u53D6\u5F97
|
|
7589
7966
|
- POST \`/objects/{object}/records\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u4F5C\u6210
|
|
7590
7967
|
- PATCH \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u66F4\u65B0
|
|
7591
7968
|
- DELETE \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u524A\u9664
|
|
7592
|
-
- GET \`/objects\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7
|
|
7593
|
-
- GET \`/objects/{object}/attributes\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
7594
7969
|
- POST \`/lists/{list_id}/entries/query\` \u2014 \u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u306E\u691C\u7D22
|
|
7595
7970
|
- POST \`/notes\` \u2014 \u30CE\u30FC\u30C8\u306E\u4F5C\u6210
|
|
7596
|
-
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u30CE\u30FC\u30C8\u3092\u53D6\u5F97
|
|
7971
|
+
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u30CE\u30FC\u30C8\u3092\u53D6\u5F97
|
|
7972
|
+
|
|
7973
|
+
#### \u30AF\u30A8\u30EA\u30DC\u30C7\u30A3 (POST /objects/{object}/records/query)
|
|
7974
|
+
- \`filter\` \u2014 \u30D5\u30A3\u30EB\u30BF\u6761\u4EF6
|
|
7975
|
+
- \`sorts\` \u2014 \u30BD\u30FC\u30C8\u6307\u5B9A\u306E\u914D\u5217
|
|
7976
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u30EC\u30B3\u30FC\u30C9\u6570\uFF08\u30C7\u30D5\u30A9\u30EB\u30C825\uFF09
|
|
7977
|
+
- \`offset\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8`
|
|
7597
7978
|
},
|
|
7598
7979
|
tools: tools27
|
|
7599
7980
|
});
|
|
7600
7981
|
|
|
7982
|
+
// ../connectors/src/connectors/shopify/setup.ts
|
|
7983
|
+
var shopifyOnboarding = new ConnectorOnboarding({
|
|
7984
|
+
dataOverviewInstructions: {
|
|
7985
|
+
en: `1. Call shopify_request with GET /admin/api/2024-10/products.json?limit=5 to explore products structure
|
|
7986
|
+
2. Call shopify_request with GET /admin/api/2024-10/orders.json?limit=5&status=any to explore orders structure
|
|
7987
|
+
3. Explore other endpoints (customers, inventory, collections) as needed`,
|
|
7988
|
+
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
|
|
7989
|
+
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
|
|
7990
|
+
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`
|
|
7991
|
+
}
|
|
7992
|
+
});
|
|
7993
|
+
|
|
7601
7994
|
// ../connectors/src/connectors/shopify/parameters.ts
|
|
7602
7995
|
var parameters28 = {
|
|
7603
|
-
accessToken: new ParameterDefinition({
|
|
7604
|
-
slug: "access-token",
|
|
7605
|
-
name: "Shopify Admin API Access Token",
|
|
7606
|
-
description: "The Shopify Admin API access token for authentication (starts with shpat_).",
|
|
7607
|
-
envVarBaseKey: "SHOPIFY_ACCESS_TOKEN",
|
|
7608
|
-
type: "text",
|
|
7609
|
-
secret: true,
|
|
7610
|
-
required: true
|
|
7611
|
-
}),
|
|
7612
7996
|
storeDomain: new ParameterDefinition({
|
|
7613
7997
|
slug: "store-domain",
|
|
7614
|
-
name: "
|
|
7615
|
-
description:
|
|
7998
|
+
name: "Shop Name",
|
|
7999
|
+
description: 'Your Shopify store name (the subdomain part of your .myshopify.com URL, e.g., "mystore" for mystore.myshopify.com).',
|
|
7616
8000
|
envVarBaseKey: "SHOPIFY_STORE_DOMAIN",
|
|
7617
8001
|
type: "text",
|
|
7618
8002
|
secret: false,
|
|
7619
8003
|
required: true
|
|
8004
|
+
}),
|
|
8005
|
+
clientId: new ParameterDefinition({
|
|
8006
|
+
slug: "client-id",
|
|
8007
|
+
name: "Client ID",
|
|
8008
|
+
description: "The Client ID (API Key) of your Shopify Custom App.",
|
|
8009
|
+
envVarBaseKey: "SHOPIFY_CLIENT_ID",
|
|
8010
|
+
type: "text",
|
|
8011
|
+
secret: false,
|
|
8012
|
+
required: true
|
|
8013
|
+
}),
|
|
8014
|
+
clientSecret: new ParameterDefinition({
|
|
8015
|
+
slug: "client-secret",
|
|
8016
|
+
name: "Client Secret",
|
|
8017
|
+
description: "The Client Secret (API Secret Key) of your Shopify Custom App.",
|
|
8018
|
+
envVarBaseKey: "SHOPIFY_CLIENT_SECRET",
|
|
8019
|
+
type: "text",
|
|
8020
|
+
secret: true,
|
|
8021
|
+
required: true
|
|
7620
8022
|
})
|
|
7621
8023
|
};
|
|
7622
8024
|
|
|
8025
|
+
// ../connectors/src/connectors/shopify/tools/request.ts
|
|
8026
|
+
import { z as z32 } from "zod";
|
|
8027
|
+
var REQUEST_TIMEOUT_MS21 = 6e4;
|
|
8028
|
+
var inputSchema32 = z32.object({
|
|
8029
|
+
toolUseIntent: z32.string().optional().describe(
|
|
8030
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
8031
|
+
),
|
|
8032
|
+
connectionId: z32.string().describe("ID of the Shopify connection to use"),
|
|
8033
|
+
method: z32.enum(["GET", "POST", "PUT", "DELETE"]).describe(
|
|
8034
|
+
"HTTP method. GET for reading resources (products, orders, customers), POST for creating, PUT for updating, DELETE for removing."
|
|
8035
|
+
),
|
|
8036
|
+
path: z32.string().describe(
|
|
8037
|
+
"API path including version (e.g., '/admin/api/2024-10/products.json', '/admin/api/2024-10/orders.json?limit=50')"
|
|
8038
|
+
),
|
|
8039
|
+
body: z32.record(z32.string(), z32.unknown()).optional().describe("Request body (JSON) for POST/PUT requests")
|
|
8040
|
+
});
|
|
8041
|
+
var outputSchema32 = z32.discriminatedUnion("success", [
|
|
8042
|
+
z32.object({
|
|
8043
|
+
success: z32.literal(true),
|
|
8044
|
+
status: z32.number(),
|
|
8045
|
+
data: z32.record(z32.string(), z32.unknown())
|
|
8046
|
+
}),
|
|
8047
|
+
z32.object({
|
|
8048
|
+
success: z32.literal(false),
|
|
8049
|
+
error: z32.string()
|
|
8050
|
+
})
|
|
8051
|
+
]);
|
|
8052
|
+
var requestTool15 = new ConnectorTool({
|
|
8053
|
+
name: "request",
|
|
8054
|
+
description: `Send authenticated requests to the Shopify Admin REST API.
|
|
8055
|
+
Authentication is handled automatically using Custom App credentials (Client ID + Client Secret). An access token is obtained on each request.
|
|
8056
|
+
The store domain is resolved from the connection \u2014 only provide the path starting with /admin/api/.
|
|
8057
|
+
Use this tool for all Shopify API interactions: listing products, orders, customers, inventory, collections, and more.`,
|
|
8058
|
+
inputSchema: inputSchema32,
|
|
8059
|
+
outputSchema: outputSchema32,
|
|
8060
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
8061
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
8062
|
+
if (!connection2) {
|
|
8063
|
+
return {
|
|
8064
|
+
success: false,
|
|
8065
|
+
error: `Connection ${connectionId} not found`
|
|
8066
|
+
};
|
|
8067
|
+
}
|
|
8068
|
+
console.log(
|
|
8069
|
+
`[connector-request] shopify/${connection2.name}: ${method} ${path5}`
|
|
8070
|
+
);
|
|
8071
|
+
try {
|
|
8072
|
+
const storeDomain = parameters28.storeDomain.getValue(connection2);
|
|
8073
|
+
const clientId = parameters28.clientId.getValue(connection2);
|
|
8074
|
+
const clientSecret = parameters28.clientSecret.getValue(connection2);
|
|
8075
|
+
const tokenRes = await fetch(
|
|
8076
|
+
`https://${storeDomain}/admin/oauth/access_token`,
|
|
8077
|
+
{
|
|
8078
|
+
method: "POST",
|
|
8079
|
+
headers: { "Content-Type": "application/json" },
|
|
8080
|
+
body: JSON.stringify({
|
|
8081
|
+
client_id: clientId,
|
|
8082
|
+
client_secret: clientSecret
|
|
8083
|
+
})
|
|
8084
|
+
}
|
|
8085
|
+
);
|
|
8086
|
+
if (!tokenRes.ok) {
|
|
8087
|
+
const tokenBody = await tokenRes.text().catch(() => "(unreadable body)");
|
|
8088
|
+
return {
|
|
8089
|
+
success: false,
|
|
8090
|
+
error: `Failed to obtain access token: ${tokenRes.status} ${tokenRes.statusText} \u2014 ${tokenBody}`
|
|
8091
|
+
};
|
|
8092
|
+
}
|
|
8093
|
+
const tokenJson = await tokenRes.json();
|
|
8094
|
+
if (!tokenJson.access_token) {
|
|
8095
|
+
return {
|
|
8096
|
+
success: false,
|
|
8097
|
+
error: "access_token not found in token response"
|
|
8098
|
+
};
|
|
8099
|
+
}
|
|
8100
|
+
const url = `https://${storeDomain}${path5}`;
|
|
8101
|
+
const controller = new AbortController();
|
|
8102
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS21);
|
|
8103
|
+
try {
|
|
8104
|
+
const response = await fetch(url, {
|
|
8105
|
+
method,
|
|
8106
|
+
headers: {
|
|
8107
|
+
"X-Shopify-Access-Token": tokenJson.access_token,
|
|
8108
|
+
"Content-Type": "application/json"
|
|
8109
|
+
},
|
|
8110
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
8111
|
+
signal: controller.signal
|
|
8112
|
+
});
|
|
8113
|
+
const data = await response.json();
|
|
8114
|
+
if (!response.ok) {
|
|
8115
|
+
const errorMessage = typeof data?.errors === "string" ? data.errors : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
8116
|
+
return { success: false, error: errorMessage };
|
|
8117
|
+
}
|
|
8118
|
+
return { success: true, status: response.status, data };
|
|
8119
|
+
} finally {
|
|
8120
|
+
clearTimeout(timeout);
|
|
8121
|
+
}
|
|
8122
|
+
} catch (err) {
|
|
8123
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
8124
|
+
return { success: false, error: msg };
|
|
8125
|
+
}
|
|
8126
|
+
}
|
|
8127
|
+
});
|
|
8128
|
+
|
|
7623
8129
|
// ../connectors/src/connectors/shopify/index.ts
|
|
7624
|
-
var tools28 = {};
|
|
8130
|
+
var tools28 = { request: requestTool15 };
|
|
7625
8131
|
var shopifyConnector = new ConnectorPlugin({
|
|
7626
8132
|
slug: "shopify",
|
|
7627
8133
|
authType: null,
|
|
@@ -7630,89 +8136,152 @@ var shopifyConnector = new ConnectorPlugin({
|
|
|
7630
8136
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/57KEjZCBskKgSxgKyU4Sm0/117d681a410f48dc36f97cdd9c0593c5/shopify-icon.svg",
|
|
7631
8137
|
parameters: parameters28,
|
|
7632
8138
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
8139
|
+
onboarding: shopifyOnboarding,
|
|
7633
8140
|
systemPrompt: {
|
|
7634
|
-
en: `###
|
|
7635
|
-
|
|
8141
|
+
en: `### Tools
|
|
8142
|
+
|
|
8143
|
+
- \`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).
|
|
8144
|
+
|
|
8145
|
+
### Business Logic
|
|
8146
|
+
|
|
8147
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
8148
|
+
|
|
8149
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
8150
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
8151
|
+
- \`client.listProducts(options?)\` \u2014 list products with filters (status, date range) and pagination
|
|
8152
|
+
- \`client.getProduct(productId)\` \u2014 fetch a single product
|
|
8153
|
+
- \`client.listOrders(options?)\` \u2014 list orders with filters (status, financial_status, fulfillment_status, date range)
|
|
8154
|
+
- \`client.getOrder(orderId)\` \u2014 fetch a single order
|
|
8155
|
+
- \`client.listCustomers(options?)\` \u2014 list customers with filters and pagination
|
|
8156
|
+
- \`client.getCustomer(customerId)\` \u2014 fetch a single customer
|
|
8157
|
+
- \`client.listCustomCollections(options?)\` \u2014 list custom collections
|
|
8158
|
+
- \`client.listSmartCollections(options?)\` \u2014 list smart collections
|
|
7636
8159
|
|
|
7637
8160
|
\`\`\`ts
|
|
8161
|
+
import type { Context } from "hono";
|
|
7638
8162
|
import { connection } from "@squadbase/vite-server/connectors/shopify";
|
|
7639
8163
|
|
|
7640
|
-
const
|
|
8164
|
+
const shopify = connection("<connectionId>");
|
|
7641
8165
|
|
|
7642
|
-
|
|
7643
|
-
const
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
)
|
|
7652
|
-
|
|
8166
|
+
export default async function handler(c: Context) {
|
|
8167
|
+
const { status = "active", limit = 50 } = await c.req.json<{
|
|
8168
|
+
status?: "active" | "draft" | "archived";
|
|
8169
|
+
limit?: number;
|
|
8170
|
+
}>();
|
|
8171
|
+
|
|
8172
|
+
const { products } = await shopify.listProducts({ status, limit });
|
|
8173
|
+
|
|
8174
|
+
return c.json({
|
|
8175
|
+
products: products.map((p: Record<string, unknown>) => ({
|
|
8176
|
+
id: p.id,
|
|
8177
|
+
title: p.title,
|
|
8178
|
+
status: p.status,
|
|
8179
|
+
vendor: p.vendor,
|
|
8180
|
+
created_at: p.created_at,
|
|
8181
|
+
})),
|
|
8182
|
+
});
|
|
8183
|
+
}
|
|
7653
8184
|
\`\`\`
|
|
7654
8185
|
|
|
7655
|
-
###
|
|
7656
|
-
- GET \`/products.json\` \u2014 List products
|
|
7657
|
-
- GET \`/products/{id}.json\` \u2014 Get a product
|
|
7658
|
-
- GET \`/orders.json\` \u2014 List orders
|
|
7659
|
-
- GET \`/orders/{id}.json\` \u2014 Get an order
|
|
7660
|
-
- GET \`/customers.json\` \u2014 List customers
|
|
7661
|
-
- GET \`/customers/{id}.json\` \u2014 Get a customer
|
|
7662
|
-
- GET \`/inventory_items.json?ids={ids}\` \u2014 List inventory items
|
|
7663
|
-
- GET \`/locations.json\` \u2014 List locations
|
|
7664
|
-
- GET \`/collects.json\` \u2014 List collects
|
|
7665
|
-
- GET \`/custom_collections.json\` \u2014 List custom collections
|
|
7666
|
-
- GET \`/smart_collections.json\` \u2014 List smart collections
|
|
8186
|
+
### Shopify Admin REST API Reference
|
|
7667
8187
|
|
|
7668
|
-
|
|
8188
|
+
- Base URL: \`https://{storeDomain}/admin/api/2024-10\`
|
|
8189
|
+
- Authentication: Custom App (Client ID + Client Secret \u2192 access token obtained per request)
|
|
8190
|
+
- Pagination: cursor-based via \`page_info\` query parameter (from Link header)
|
|
8191
|
+
- Max 250 records per page
|
|
8192
|
+
|
|
8193
|
+
#### Common Endpoints
|
|
8194
|
+
- GET \`/admin/api/2024-10/products.json\` \u2014 List products
|
|
8195
|
+
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 Get a product
|
|
8196
|
+
- GET \`/admin/api/2024-10/orders.json\` \u2014 List orders
|
|
8197
|
+
- GET \`/admin/api/2024-10/orders/{id}.json\` \u2014 Get an order
|
|
8198
|
+
- GET \`/admin/api/2024-10/customers.json\` \u2014 List customers
|
|
8199
|
+
- GET \`/admin/api/2024-10/customers/{id}.json\` \u2014 Get a customer
|
|
8200
|
+
- GET \`/admin/api/2024-10/inventory_items.json?ids={ids}\` \u2014 List inventory items
|
|
8201
|
+
- GET \`/admin/api/2024-10/locations.json\` \u2014 List locations
|
|
8202
|
+
- GET \`/admin/api/2024-10/collects.json\` \u2014 List collects
|
|
8203
|
+
- GET \`/admin/api/2024-10/custom_collections.json\` \u2014 List custom collections
|
|
8204
|
+
- GET \`/admin/api/2024-10/smart_collections.json\` \u2014 List smart collections
|
|
8205
|
+
|
|
8206
|
+
#### Common Query Parameters
|
|
7669
8207
|
- \`limit\` \u2014 Max records per page (max 250)
|
|
7670
8208
|
- \`page_info\` \u2014 Cursor for pagination (from Link header)
|
|
7671
8209
|
- \`fields\` \u2014 Comma-separated list of fields to return
|
|
7672
|
-
- \`created_at_min\`, \`created_at_max\` \u2014 Date filters
|
|
7673
|
-
- \`updated_at_min\`, \`updated_at_max\` \u2014 Date filters
|
|
7674
|
-
- \`status\` \u2014 Filter by status (e.g., active, draft, archived for products)`,
|
|
7675
|
-
ja: `###
|
|
7676
|
-
|
|
8210
|
+
- \`created_at_min\`, \`created_at_max\` \u2014 Date filters (ISO 8601)
|
|
8211
|
+
- \`updated_at_min\`, \`updated_at_max\` \u2014 Date filters (ISO 8601)
|
|
8212
|
+
- \`status\` \u2014 Filter by status (e.g., active, draft, archived for products; open, closed, cancelled, any for orders)`,
|
|
8213
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
8214
|
+
|
|
8215
|
+
- \`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
|
|
8216
|
+
|
|
8217
|
+
### Business Logic
|
|
8218
|
+
|
|
8219
|
+
\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
|
|
8220
|
+
|
|
8221
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
8222
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
8223
|
+
- \`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
|
|
8224
|
+
- \`client.getProduct(productId)\` \u2014 \u5358\u4E00\u5546\u54C1\u3092\u53D6\u5F97
|
|
8225
|
+
- \`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
|
|
8226
|
+
- \`client.getOrder(orderId)\` \u2014 \u5358\u4E00\u6CE8\u6587\u3092\u53D6\u5F97
|
|
8227
|
+
- \`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
|
|
8228
|
+
- \`client.getCustomer(customerId)\` \u2014 \u5358\u4E00\u9867\u5BA2\u3092\u53D6\u5F97
|
|
8229
|
+
- \`client.listCustomCollections(options?)\` \u2014 \u30AB\u30B9\u30BF\u30E0\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u53D6\u5F97
|
|
8230
|
+
- \`client.listSmartCollections(options?)\` \u2014 \u30B9\u30DE\u30FC\u30C8\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u4E00\u89A7\u53D6\u5F97
|
|
7677
8231
|
|
|
7678
8232
|
\`\`\`ts
|
|
8233
|
+
import type { Context } from "hono";
|
|
7679
8234
|
import { connection } from "@squadbase/vite-server/connectors/shopify";
|
|
7680
8235
|
|
|
7681
|
-
const
|
|
8236
|
+
const shopify = connection("<connectionId>");
|
|
7682
8237
|
|
|
7683
|
-
|
|
7684
|
-
const
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
"X-Shopify-Access-Token": accessToken,
|
|
7689
|
-
"Content-Type": "application/json",
|
|
7690
|
-
},
|
|
7691
|
-
},
|
|
7692
|
-
);
|
|
7693
|
-
const data = await res.json();
|
|
7694
|
-
\`\`\`
|
|
8238
|
+
export default async function handler(c: Context) {
|
|
8239
|
+
const { status = "active", limit = 50 } = await c.req.json<{
|
|
8240
|
+
status?: "active" | "draft" | "archived";
|
|
8241
|
+
limit?: number;
|
|
8242
|
+
}>();
|
|
7695
8243
|
|
|
7696
|
-
|
|
7697
|
-
- GET \`/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7
|
|
7698
|
-
- GET \`/products/{id}.json\` \u2014 \u5546\u54C1\u306E\u53D6\u5F97
|
|
7699
|
-
- GET \`/orders.json\` \u2014 \u6CE8\u6587\u4E00\u89A7
|
|
7700
|
-
- GET \`/orders/{id}.json\` \u2014 \u6CE8\u6587\u306E\u53D6\u5F97
|
|
7701
|
-
- GET \`/customers.json\` \u2014 \u9867\u5BA2\u4E00\u89A7
|
|
7702
|
-
- GET \`/customers/{id}.json\` \u2014 \u9867\u5BA2\u306E\u53D6\u5F97
|
|
7703
|
-
- GET \`/inventory_items.json?ids={ids}\` \u2014 \u5728\u5EAB\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7
|
|
7704
|
-
- GET \`/locations.json\` \u2014 \u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
7705
|
-
- GET \`/collects.json\` \u2014 \u30B3\u30EC\u30AF\u30C8\u4E00\u89A7
|
|
7706
|
-
- GET \`/custom_collections.json\` \u2014 \u30AB\u30B9\u30BF\u30E0\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
7707
|
-
- GET \`/smart_collections.json\` \u2014 \u30B9\u30DE\u30FC\u30C8\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
8244
|
+
const { products } = await shopify.listProducts({ status, limit });
|
|
7708
8245
|
|
|
7709
|
-
|
|
8246
|
+
return c.json({
|
|
8247
|
+
products: products.map((p: Record<string, unknown>) => ({
|
|
8248
|
+
id: p.id,
|
|
8249
|
+
title: p.title,
|
|
8250
|
+
status: p.status,
|
|
8251
|
+
vendor: p.vendor,
|
|
8252
|
+
created_at: p.created_at,
|
|
8253
|
+
})),
|
|
8254
|
+
});
|
|
8255
|
+
}
|
|
8256
|
+
\`\`\`
|
|
8257
|
+
|
|
8258
|
+
### Shopify Admin REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
8259
|
+
|
|
8260
|
+
- \u30D9\u30FC\u30B9URL: \`https://{storeDomain}/admin/api/2024-10\`
|
|
8261
|
+
- \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
|
|
8262
|
+
- \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
|
|
8263
|
+
- \u30DA\u30FC\u30B8\u3042\u305F\u308A\u6700\u5927250\u30EC\u30B3\u30FC\u30C9
|
|
8264
|
+
|
|
8265
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
8266
|
+
- GET \`/admin/api/2024-10/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7
|
|
8267
|
+
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 \u5546\u54C1\u306E\u53D6\u5F97
|
|
8268
|
+
- GET \`/admin/api/2024-10/orders.json\` \u2014 \u6CE8\u6587\u4E00\u89A7
|
|
8269
|
+
- GET \`/admin/api/2024-10/orders/{id}.json\` \u2014 \u6CE8\u6587\u306E\u53D6\u5F97
|
|
8270
|
+
- GET \`/admin/api/2024-10/customers.json\` \u2014 \u9867\u5BA2\u4E00\u89A7
|
|
8271
|
+
- GET \`/admin/api/2024-10/customers/{id}.json\` \u2014 \u9867\u5BA2\u306E\u53D6\u5F97
|
|
8272
|
+
- GET \`/admin/api/2024-10/inventory_items.json?ids={ids}\` \u2014 \u5728\u5EAB\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7
|
|
8273
|
+
- GET \`/admin/api/2024-10/locations.json\` \u2014 \u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
8274
|
+
- GET \`/admin/api/2024-10/collects.json\` \u2014 \u30B3\u30EC\u30AF\u30C8\u4E00\u89A7
|
|
8275
|
+
- GET \`/admin/api/2024-10/custom_collections.json\` \u2014 \u30AB\u30B9\u30BF\u30E0\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
8276
|
+
- GET \`/admin/api/2024-10/smart_collections.json\` \u2014 \u30B9\u30DE\u30FC\u30C8\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
8277
|
+
|
|
8278
|
+
#### \u4E3B\u8981\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
|
|
7710
8279
|
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u30EC\u30B3\u30FC\u30C9\u6570\uFF08\u6700\u5927250\uFF09
|
|
7711
8280
|
- \`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
|
|
7712
8281
|
- \`fields\` \u2014 \u8FD4\u5374\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
|
|
7713
|
-
- \`created_at_min\`, \`created_at_max\` \u2014 \u4F5C\u6210\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC
|
|
7714
|
-
- \`updated_at_min\`, \`updated_at_max\` \u2014 \u66F4\u65B0\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC
|
|
7715
|
-
- \`status\` \u2014 \u30B9\u30C6\u30FC\u30BF\u30B9\u3067\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08\u4F8B: \u5546\u54C1\u306E\u5834\u5408 active, draft, archived\uFF09`
|
|
8282
|
+
- \`created_at_min\`, \`created_at_max\` \u2014 \u4F5C\u6210\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08ISO 8601\uFF09
|
|
8283
|
+
- \`updated_at_min\`, \`updated_at_max\` \u2014 \u66F4\u65B0\u65E5\u30D5\u30A3\u30EB\u30BF\u30FC\uFF08ISO 8601\uFF09
|
|
8284
|
+
- \`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`
|
|
7716
8285
|
},
|
|
7717
8286
|
tools: tools28
|
|
7718
8287
|
});
|
|
@@ -7885,8 +8454,8 @@ const data = await res.json();
|
|
|
7885
8454
|
});
|
|
7886
8455
|
|
|
7887
8456
|
// ../connectors/src/connectors/shopify-oauth/tools/request.ts
|
|
7888
|
-
import { z as
|
|
7889
|
-
var
|
|
8457
|
+
import { z as z33 } from "zod";
|
|
8458
|
+
var REQUEST_TIMEOUT_MS22 = 6e4;
|
|
7890
8459
|
var cachedToken13 = null;
|
|
7891
8460
|
async function getProxyToken13(config) {
|
|
7892
8461
|
if (cachedToken13 && cachedToken13.expiresAt > Date.now() + 6e4) {
|
|
@@ -7918,35 +8487,35 @@ async function getProxyToken13(config) {
|
|
|
7918
8487
|
};
|
|
7919
8488
|
return data.token;
|
|
7920
8489
|
}
|
|
7921
|
-
var
|
|
7922
|
-
toolUseIntent:
|
|
8490
|
+
var inputSchema33 = z33.object({
|
|
8491
|
+
toolUseIntent: z33.string().optional().describe(
|
|
7923
8492
|
"Brief description of what you intend to accomplish with this tool call"
|
|
7924
8493
|
),
|
|
7925
|
-
connectionId:
|
|
7926
|
-
method:
|
|
7927
|
-
path:
|
|
8494
|
+
connectionId: z33.string().describe("ID of the Shopify OAuth connection to use"),
|
|
8495
|
+
method: z33.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
|
|
8496
|
+
path: z33.string().describe(
|
|
7928
8497
|
"API path (e.g., '/admin/api/2024-10/products.json', '/admin/api/2024-10/orders.json')"
|
|
7929
8498
|
),
|
|
7930
|
-
queryParams:
|
|
7931
|
-
body:
|
|
7932
|
-
});
|
|
7933
|
-
var
|
|
7934
|
-
|
|
7935
|
-
success:
|
|
7936
|
-
status:
|
|
7937
|
-
data:
|
|
8499
|
+
queryParams: z33.record(z33.string(), z33.string()).optional().describe("Query parameters to append to the URL"),
|
|
8500
|
+
body: z33.record(z33.string(), z33.unknown()).optional().describe("Request body (JSON) for POST/PUT requests")
|
|
8501
|
+
});
|
|
8502
|
+
var outputSchema33 = z33.discriminatedUnion("success", [
|
|
8503
|
+
z33.object({
|
|
8504
|
+
success: z33.literal(true),
|
|
8505
|
+
status: z33.number(),
|
|
8506
|
+
data: z33.record(z33.string(), z33.unknown())
|
|
7938
8507
|
}),
|
|
7939
|
-
|
|
7940
|
-
success:
|
|
7941
|
-
error:
|
|
8508
|
+
z33.object({
|
|
8509
|
+
success: z33.literal(false),
|
|
8510
|
+
error: z33.string()
|
|
7942
8511
|
})
|
|
7943
8512
|
]);
|
|
7944
|
-
var
|
|
8513
|
+
var requestTool16 = new ConnectorTool({
|
|
7945
8514
|
name: "request",
|
|
7946
8515
|
description: `Send authenticated requests to the Shopify Admin API.
|
|
7947
8516
|
Authentication is handled automatically via OAuth proxy.`,
|
|
7948
|
-
inputSchema:
|
|
7949
|
-
outputSchema:
|
|
8517
|
+
inputSchema: inputSchema33,
|
|
8518
|
+
outputSchema: outputSchema33,
|
|
7950
8519
|
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
7951
8520
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
7952
8521
|
if (!connection2) {
|
|
@@ -7967,7 +8536,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
7967
8536
|
const token = await getProxyToken13(config.oauthProxy);
|
|
7968
8537
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
7969
8538
|
const controller = new AbortController();
|
|
7970
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
8539
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS22);
|
|
7971
8540
|
try {
|
|
7972
8541
|
const response = await fetch(proxyUrl, {
|
|
7973
8542
|
method: "POST",
|
|
@@ -7999,7 +8568,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
7999
8568
|
});
|
|
8000
8569
|
|
|
8001
8570
|
// ../connectors/src/connectors/shopify-oauth/setup.ts
|
|
8002
|
-
var requestToolName5 = `shopify-oauth_${
|
|
8571
|
+
var requestToolName5 = `shopify-oauth_${requestTool16.name}`;
|
|
8003
8572
|
var shopifyOauthOnboarding = new ConnectorOnboarding({
|
|
8004
8573
|
connectionSetupInstructions: {
|
|
8005
8574
|
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
|
|
@@ -8043,7 +8612,7 @@ var shopifyOauthOnboarding = new ConnectorOnboarding({
|
|
|
8043
8612
|
var parameters30 = {};
|
|
8044
8613
|
|
|
8045
8614
|
// ../connectors/src/connectors/shopify-oauth/index.ts
|
|
8046
|
-
var tools30 = { request:
|
|
8615
|
+
var tools30 = { request: requestTool16 };
|
|
8047
8616
|
var shopifyOauthConnector = new ConnectorPlugin({
|
|
8048
8617
|
slug: "shopify",
|
|
8049
8618
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -8062,9 +8631,13 @@ var shopifyOauthConnector = new ConnectorPlugin({
|
|
|
8062
8631
|
]
|
|
8063
8632
|
},
|
|
8064
8633
|
systemPrompt: {
|
|
8065
|
-
en: `###
|
|
8634
|
+
en: `### Tools
|
|
8066
8635
|
|
|
8067
|
-
|
|
8636
|
+
- \`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).
|
|
8637
|
+
|
|
8638
|
+
### Shopify Admin REST API Reference
|
|
8639
|
+
|
|
8640
|
+
#### Available Endpoints (API version: 2024-10)
|
|
8068
8641
|
- GET \`/admin/api/2024-10/shop.json\` \u2014 Get shop info
|
|
8069
8642
|
- GET \`/admin/api/2024-10/products.json\` \u2014 List products
|
|
8070
8643
|
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 Get a product
|
|
@@ -8105,9 +8678,13 @@ const shopify = connection("<connectionId>");
|
|
|
8105
8678
|
const res = await shopify.request("/admin/api/2024-10/products.json?limit=10");
|
|
8106
8679
|
const data = await res.json();
|
|
8107
8680
|
\`\`\``,
|
|
8108
|
-
ja: `###
|
|
8681
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
8109
8682
|
|
|
8110
|
-
|
|
8683
|
+
- \`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
|
|
8684
|
+
|
|
8685
|
+
### Shopify Admin REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
8686
|
+
|
|
8687
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 (API\u30D0\u30FC\u30B8\u30E7\u30F3: 2024-10)
|
|
8111
8688
|
- GET \`/admin/api/2024-10/shop.json\` \u2014 \u30B7\u30E7\u30C3\u30D7\u60C5\u5831\u3092\u53D6\u5F97
|
|
8112
8689
|
- GET \`/admin/api/2024-10/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7\u3092\u53D6\u5F97
|
|
8113
8690
|
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 \u5546\u54C1\u3092\u53D6\u5F97
|
|
@@ -8366,9 +8943,9 @@ const data = await res.json();
|
|
|
8366
8943
|
});
|
|
8367
8944
|
|
|
8368
8945
|
// ../connectors/src/connectors/ms-teams-oauth/tools/request.ts
|
|
8369
|
-
import { z as
|
|
8370
|
-
var
|
|
8371
|
-
var
|
|
8946
|
+
import { z as z34 } from "zod";
|
|
8947
|
+
var BASE_URL12 = "https://graph.microsoft.com";
|
|
8948
|
+
var REQUEST_TIMEOUT_MS23 = 6e4;
|
|
8372
8949
|
var cachedToken14 = null;
|
|
8373
8950
|
async function getProxyToken14(config) {
|
|
8374
8951
|
if (cachedToken14 && cachedToken14.expiresAt > Date.now() + 6e4) {
|
|
@@ -8400,35 +8977,35 @@ async function getProxyToken14(config) {
|
|
|
8400
8977
|
};
|
|
8401
8978
|
return data.token;
|
|
8402
8979
|
}
|
|
8403
|
-
var
|
|
8404
|
-
toolUseIntent:
|
|
8980
|
+
var inputSchema34 = z34.object({
|
|
8981
|
+
toolUseIntent: z34.string().optional().describe(
|
|
8405
8982
|
"Brief description of what you intend to accomplish with this tool call"
|
|
8406
8983
|
),
|
|
8407
|
-
connectionId:
|
|
8408
|
-
method:
|
|
8409
|
-
path:
|
|
8984
|
+
connectionId: z34.string().describe("ID of the Microsoft Teams OAuth connection to use"),
|
|
8985
|
+
method: z34.enum(["GET", "POST", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
8986
|
+
path: z34.string().describe(
|
|
8410
8987
|
"API path appended to https://graph.microsoft.com (e.g., '/v1.0/me/joinedTeams', '/v1.0/teams/{id}/channels')"
|
|
8411
8988
|
),
|
|
8412
|
-
queryParams:
|
|
8413
|
-
body:
|
|
8414
|
-
});
|
|
8415
|
-
var
|
|
8416
|
-
|
|
8417
|
-
success:
|
|
8418
|
-
status:
|
|
8419
|
-
data:
|
|
8989
|
+
queryParams: z34.record(z34.string(), z34.string()).optional().describe("Query parameters to append to the URL"),
|
|
8990
|
+
body: z34.record(z34.string(), z34.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
8991
|
+
});
|
|
8992
|
+
var outputSchema34 = z34.discriminatedUnion("success", [
|
|
8993
|
+
z34.object({
|
|
8994
|
+
success: z34.literal(true),
|
|
8995
|
+
status: z34.number(),
|
|
8996
|
+
data: z34.record(z34.string(), z34.unknown())
|
|
8420
8997
|
}),
|
|
8421
|
-
|
|
8422
|
-
success:
|
|
8423
|
-
error:
|
|
8998
|
+
z34.object({
|
|
8999
|
+
success: z34.literal(false),
|
|
9000
|
+
error: z34.string()
|
|
8424
9001
|
})
|
|
8425
9002
|
]);
|
|
8426
|
-
var
|
|
9003
|
+
var requestTool17 = new ConnectorTool({
|
|
8427
9004
|
name: "request",
|
|
8428
9005
|
description: `Send authenticated requests to the Microsoft Graph API.
|
|
8429
9006
|
Authentication is handled automatically via OAuth proxy.`,
|
|
8430
|
-
inputSchema:
|
|
8431
|
-
outputSchema:
|
|
9007
|
+
inputSchema: inputSchema34,
|
|
9008
|
+
outputSchema: outputSchema34,
|
|
8432
9009
|
async execute({ connectionId, method, path: path5, queryParams, body }, connections, config) {
|
|
8433
9010
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
8434
9011
|
if (!connection2) {
|
|
@@ -8441,7 +9018,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
8441
9018
|
`[connector-request] ms-teams-oauth/${connection2.name}: ${method} ${path5}`
|
|
8442
9019
|
);
|
|
8443
9020
|
try {
|
|
8444
|
-
let url = `${
|
|
9021
|
+
let url = `${BASE_URL12}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
8445
9022
|
if (queryParams) {
|
|
8446
9023
|
const searchParams = new URLSearchParams(queryParams);
|
|
8447
9024
|
url += `?${searchParams.toString()}`;
|
|
@@ -8449,7 +9026,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
8449
9026
|
const token = await getProxyToken14(config.oauthProxy);
|
|
8450
9027
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
8451
9028
|
const controller = new AbortController();
|
|
8452
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
9029
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS23);
|
|
8453
9030
|
try {
|
|
8454
9031
|
const response = await fetch(proxyUrl, {
|
|
8455
9032
|
method: "POST",
|
|
@@ -8481,7 +9058,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
8481
9058
|
});
|
|
8482
9059
|
|
|
8483
9060
|
// ../connectors/src/connectors/ms-teams-oauth/setup.ts
|
|
8484
|
-
var requestToolName6 = `microsoft-teams-oauth_${
|
|
9061
|
+
var requestToolName6 = `microsoft-teams-oauth_${requestTool17.name}`;
|
|
8485
9062
|
var msTeamsOauthOnboarding = new ConnectorOnboarding({
|
|
8486
9063
|
connectionSetupInstructions: {
|
|
8487
9064
|
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
|
|
@@ -8527,7 +9104,7 @@ var msTeamsOauthOnboarding = new ConnectorOnboarding({
|
|
|
8527
9104
|
var parameters32 = {};
|
|
8528
9105
|
|
|
8529
9106
|
// ../connectors/src/connectors/ms-teams-oauth/index.ts
|
|
8530
|
-
var tools32 = { request:
|
|
9107
|
+
var tools32 = { request: requestTool17 };
|
|
8531
9108
|
var msTeamsOauthConnector = new ConnectorPlugin({
|
|
8532
9109
|
slug: "microsoft-teams",
|
|
8533
9110
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -8661,6 +9238,257 @@ const data = await res.json();
|
|
|
8661
9238
|
}
|
|
8662
9239
|
});
|
|
8663
9240
|
|
|
9241
|
+
// ../connectors/src/connectors/hubspot/setup.ts
|
|
9242
|
+
var hubspotOnboarding2 = new ConnectorOnboarding({
|
|
9243
|
+
dataOverviewInstructions: {
|
|
9244
|
+
en: `1. Call hubspot_request with GET /crm/v3/objects/contacts?limit=5 to explore contacts structure
|
|
9245
|
+
2. Call hubspot_request with GET /crm/v3/objects/deals?limit=5 to explore deals structure
|
|
9246
|
+
3. Explore other object types (companies, tickets, etc.) as needed to understand available data`,
|
|
9247
|
+
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
|
|
9248
|
+
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
|
|
9249
|
+
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`
|
|
9250
|
+
}
|
|
9251
|
+
});
|
|
9252
|
+
|
|
9253
|
+
// ../connectors/src/connectors/hubspot/parameters.ts
|
|
9254
|
+
var parameters33 = {
|
|
9255
|
+
apiKey: new ParameterDefinition({
|
|
9256
|
+
slug: "api-key",
|
|
9257
|
+
name: "HubSpot Private App Access Token",
|
|
9258
|
+
description: "The HubSpot private app access token for authentication (starts with pat-).",
|
|
9259
|
+
envVarBaseKey: "HUBSPOT_API_KEY",
|
|
9260
|
+
type: "text",
|
|
9261
|
+
secret: true,
|
|
9262
|
+
required: true
|
|
9263
|
+
})
|
|
9264
|
+
};
|
|
9265
|
+
|
|
9266
|
+
// ../connectors/src/connectors/hubspot/tools/request.ts
|
|
9267
|
+
import { z as z35 } from "zod";
|
|
9268
|
+
var BASE_URL13 = "https://api.hubapi.com";
|
|
9269
|
+
var REQUEST_TIMEOUT_MS24 = 6e4;
|
|
9270
|
+
var inputSchema35 = z35.object({
|
|
9271
|
+
toolUseIntent: z35.string().optional().describe(
|
|
9272
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
9273
|
+
),
|
|
9274
|
+
connectionId: z35.string().describe("ID of the HubSpot connection to use"),
|
|
9275
|
+
method: z35.enum(["GET", "POST", "PATCH", "DELETE"]).describe(
|
|
9276
|
+
"HTTP method. GET for reading resources, POST for creating or searching, PATCH for updating, DELETE for removing."
|
|
9277
|
+
),
|
|
9278
|
+
path: z35.string().describe(
|
|
9279
|
+
"API path appended to https://api.hubapi.com (e.g., '/crm/v3/objects/contacts', '/crm/v3/objects/deals', '/crm/v3/objects/contacts/search')"
|
|
9280
|
+
),
|
|
9281
|
+
body: z35.record(z35.string(), z35.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
9282
|
+
});
|
|
9283
|
+
var outputSchema35 = z35.discriminatedUnion("success", [
|
|
9284
|
+
z35.object({
|
|
9285
|
+
success: z35.literal(true),
|
|
9286
|
+
status: z35.number(),
|
|
9287
|
+
data: z35.record(z35.string(), z35.unknown())
|
|
9288
|
+
}),
|
|
9289
|
+
z35.object({
|
|
9290
|
+
success: z35.literal(false),
|
|
9291
|
+
error: z35.string()
|
|
9292
|
+
})
|
|
9293
|
+
]);
|
|
9294
|
+
var requestTool18 = new ConnectorTool({
|
|
9295
|
+
name: "request",
|
|
9296
|
+
description: `Send authenticated requests to the HubSpot API.
|
|
9297
|
+
Authentication is handled automatically using the Private App Access Token (Bearer token).
|
|
9298
|
+
Use this tool for all HubSpot API interactions: querying contacts, deals, companies, tickets, and other CRM objects.
|
|
9299
|
+
Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex queries with filters.`,
|
|
9300
|
+
inputSchema: inputSchema35,
|
|
9301
|
+
outputSchema: outputSchema35,
|
|
9302
|
+
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
9303
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
9304
|
+
if (!connection2) {
|
|
9305
|
+
return {
|
|
9306
|
+
success: false,
|
|
9307
|
+
error: `Connection ${connectionId} not found`
|
|
9308
|
+
};
|
|
9309
|
+
}
|
|
9310
|
+
console.log(
|
|
9311
|
+
`[connector-request] hubspot/${connection2.name}: ${method} ${path5}`
|
|
9312
|
+
);
|
|
9313
|
+
try {
|
|
9314
|
+
const apiKey = parameters33.apiKey.getValue(connection2);
|
|
9315
|
+
const url = `${BASE_URL13}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
9316
|
+
const controller = new AbortController();
|
|
9317
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS24);
|
|
9318
|
+
try {
|
|
9319
|
+
const response = await fetch(url, {
|
|
9320
|
+
method,
|
|
9321
|
+
headers: {
|
|
9322
|
+
Authorization: `Bearer ${apiKey}`,
|
|
9323
|
+
"Content-Type": "application/json"
|
|
9324
|
+
},
|
|
9325
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
9326
|
+
signal: controller.signal
|
|
9327
|
+
});
|
|
9328
|
+
const data = await response.json();
|
|
9329
|
+
if (!response.ok) {
|
|
9330
|
+
const errorMessage = typeof data?.message === "string" ? data.message : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
9331
|
+
return { success: false, error: errorMessage };
|
|
9332
|
+
}
|
|
9333
|
+
return { success: true, status: response.status, data };
|
|
9334
|
+
} finally {
|
|
9335
|
+
clearTimeout(timeout);
|
|
9336
|
+
}
|
|
9337
|
+
} catch (err) {
|
|
9338
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
9339
|
+
return { success: false, error: msg };
|
|
9340
|
+
}
|
|
9341
|
+
}
|
|
9342
|
+
});
|
|
9343
|
+
|
|
9344
|
+
// ../connectors/src/connectors/hubspot/index.ts
|
|
9345
|
+
var tools33 = { request: requestTool18 };
|
|
9346
|
+
var hubspotConnector = new ConnectorPlugin({
|
|
9347
|
+
slug: "hubspot",
|
|
9348
|
+
authType: null,
|
|
9349
|
+
name: "HubSpot",
|
|
9350
|
+
description: "Connect to HubSpot CRM for contacts, deals, companies, and marketing data using a Private App Access Token.",
|
|
9351
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5UcSkKkzhUMA4RsM45ynuo/43b967e36915ca0fc5d277684b204320/hubspot.svg",
|
|
9352
|
+
parameters: parameters33,
|
|
9353
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
9354
|
+
onboarding: hubspotOnboarding2,
|
|
9355
|
+
systemPrompt: {
|
|
9356
|
+
en: `### Tools
|
|
9357
|
+
|
|
9358
|
+
- \`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.
|
|
9359
|
+
|
|
9360
|
+
### Business Logic
|
|
9361
|
+
|
|
9362
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
9363
|
+
|
|
9364
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
9365
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
9366
|
+
- \`client.listObjects(objectType, options?)\` \u2014 list CRM objects with pagination (limit, after, properties, associations)
|
|
9367
|
+
- \`client.getObject(objectType, objectId, options?)\` \u2014 fetch a single CRM object
|
|
9368
|
+
- \`client.searchObjects(objectType, options?)\` \u2014 search CRM objects with filters, sorts, and pagination
|
|
9369
|
+
|
|
9370
|
+
\`\`\`ts
|
|
9371
|
+
import type { Context } from "hono";
|
|
9372
|
+
import { connection } from "@squadbase/vite-server/connectors/hubspot";
|
|
9373
|
+
|
|
9374
|
+
const hubspot = connection("<connectionId>");
|
|
9375
|
+
|
|
9376
|
+
export default async function handler(c: Context) {
|
|
9377
|
+
const { limit = 10 } = await c.req.json<{ limit?: number }>();
|
|
9378
|
+
|
|
9379
|
+
const { results, paging } = await hubspot.listObjects("contacts", {
|
|
9380
|
+
limit,
|
|
9381
|
+
properties: ["email", "firstname", "lastname"],
|
|
9382
|
+
});
|
|
9383
|
+
|
|
9384
|
+
return c.json({
|
|
9385
|
+
contacts: results,
|
|
9386
|
+
nextPage: paging?.next?.after,
|
|
9387
|
+
});
|
|
9388
|
+
}
|
|
9389
|
+
\`\`\`
|
|
9390
|
+
|
|
9391
|
+
### HubSpot API Reference
|
|
9392
|
+
|
|
9393
|
+
- Base URL: \`https://api.hubapi.com\`
|
|
9394
|
+
- Authentication: Bearer token (handled automatically)
|
|
9395
|
+
- Pagination: cursor-based with \`after\` parameter from \`paging.next.after\`
|
|
9396
|
+
|
|
9397
|
+
#### Common Endpoints
|
|
9398
|
+
- GET \`/crm/v3/objects/contacts\` \u2014 List contacts
|
|
9399
|
+
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 Get a contact
|
|
9400
|
+
- GET \`/crm/v3/objects/deals\` \u2014 List deals
|
|
9401
|
+
- GET \`/crm/v3/objects/deals/{dealId}\` \u2014 Get a deal
|
|
9402
|
+
- GET \`/crm/v3/objects/companies\` \u2014 List companies
|
|
9403
|
+
- GET \`/crm/v3/objects/companies/{companyId}\` \u2014 Get a company
|
|
9404
|
+
- POST \`/crm/v3/objects/contacts\` \u2014 Create a contact
|
|
9405
|
+
- POST \`/crm/v3/objects/deals\` \u2014 Create a deal
|
|
9406
|
+
- PATCH \`/crm/v3/objects/contacts/{contactId}\` \u2014 Update a contact
|
|
9407
|
+
- PATCH \`/crm/v3/objects/deals/{dealId}\` \u2014 Update a deal
|
|
9408
|
+
- POST \`/crm/v3/objects/{objectType}/search\` \u2014 Search objects
|
|
9409
|
+
|
|
9410
|
+
#### Query Parameters
|
|
9411
|
+
- \`limit\` \u2014 Number of results per page (max 100)
|
|
9412
|
+
- \`after\` \u2014 Pagination cursor
|
|
9413
|
+
- \`properties\` \u2014 Comma-separated list of properties to return
|
|
9414
|
+
- \`associations\` \u2014 Comma-separated list of association types to include
|
|
9415
|
+
|
|
9416
|
+
#### Search Body (POST /crm/v3/objects/{objectType}/search)
|
|
9417
|
+
- \`filterGroups\` \u2014 Array of filter groups with \`filters\` (propertyName, operator, value)
|
|
9418
|
+
- \`sorts\` \u2014 Array of sort specifications
|
|
9419
|
+
- \`properties\` \u2014 Array of properties to return
|
|
9420
|
+
- \`limit\` \u2014 Max results per page (max 100)
|
|
9421
|
+
- \`after\` \u2014 Pagination offset`,
|
|
9422
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
9423
|
+
|
|
9424
|
+
- \`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
|
|
9425
|
+
|
|
9426
|
+
### Business Logic
|
|
9427
|
+
|
|
9428
|
+
\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
|
|
9429
|
+
|
|
9430
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
9431
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
9432
|
+
- \`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
|
|
9433
|
+
- \`client.getObject(objectType, objectId, options?)\` \u2014 \u5358\u4E00CRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u53D6\u5F97
|
|
9434
|
+
- \`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
|
|
9435
|
+
|
|
9436
|
+
\`\`\`ts
|
|
9437
|
+
import type { Context } from "hono";
|
|
9438
|
+
import { connection } from "@squadbase/vite-server/connectors/hubspot";
|
|
9439
|
+
|
|
9440
|
+
const hubspot = connection("<connectionId>");
|
|
9441
|
+
|
|
9442
|
+
export default async function handler(c: Context) {
|
|
9443
|
+
const { limit = 10 } = await c.req.json<{ limit?: number }>();
|
|
9444
|
+
|
|
9445
|
+
const { results, paging } = await hubspot.listObjects("contacts", {
|
|
9446
|
+
limit,
|
|
9447
|
+
properties: ["email", "firstname", "lastname"],
|
|
9448
|
+
});
|
|
9449
|
+
|
|
9450
|
+
return c.json({
|
|
9451
|
+
contacts: results,
|
|
9452
|
+
nextPage: paging?.next?.after,
|
|
9453
|
+
});
|
|
9454
|
+
}
|
|
9455
|
+
\`\`\`
|
|
9456
|
+
|
|
9457
|
+
### HubSpot API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
9458
|
+
|
|
9459
|
+
- \u30D9\u30FC\u30B9URL: \`https://api.hubapi.com\`
|
|
9460
|
+
- \u8A8D\u8A3C: Bearer\u30C8\u30FC\u30AF\u30F3\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
9461
|
+
- \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
|
|
9462
|
+
|
|
9463
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
9464
|
+
- GET \`/crm/v3/objects/contacts\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
9465
|
+
- GET \`/crm/v3/objects/contacts/{contactId}\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u53D6\u5F97
|
|
9466
|
+
- GET \`/crm/v3/objects/deals\` \u2014 \u53D6\u5F15\u4E00\u89A7\u3092\u53D6\u5F97
|
|
9467
|
+
- GET \`/crm/v3/objects/deals/{dealId}\` \u2014 \u53D6\u5F15\u3092\u53D6\u5F97
|
|
9468
|
+
- GET \`/crm/v3/objects/companies\` \u2014 \u4F1A\u793E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
9469
|
+
- GET \`/crm/v3/objects/companies/{companyId}\` \u2014 \u4F1A\u793E\u3092\u53D6\u5F97
|
|
9470
|
+
- POST \`/crm/v3/objects/contacts\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u4F5C\u6210
|
|
9471
|
+
- POST \`/crm/v3/objects/deals\` \u2014 \u53D6\u5F15\u3092\u4F5C\u6210
|
|
9472
|
+
- PATCH \`/crm/v3/objects/contacts/{contactId}\` \u2014 \u30B3\u30F3\u30BF\u30AF\u30C8\u3092\u66F4\u65B0
|
|
9473
|
+
- PATCH \`/crm/v3/objects/deals/{dealId}\` \u2014 \u53D6\u5F15\u3092\u66F4\u65B0
|
|
9474
|
+
- POST \`/crm/v3/objects/{objectType}/search\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u691C\u7D22
|
|
9475
|
+
|
|
9476
|
+
#### \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF
|
|
9477
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u7D50\u679C\u6570\uFF08\u6700\u5927100\uFF09
|
|
9478
|
+
- \`after\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AB\u30FC\u30BD\u30EB
|
|
9479
|
+
- \`properties\` \u2014 \u8FD4\u5374\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8
|
|
9480
|
+
- \`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
|
|
9481
|
+
|
|
9482
|
+
#### \u691C\u7D22\u30DC\u30C7\u30A3 (POST /crm/v3/objects/{objectType}/search)
|
|
9483
|
+
- \`filterGroups\` \u2014 \u30D5\u30A3\u30EB\u30BF\u30B0\u30EB\u30FC\u30D7\u306E\u914D\u5217\uFF08\`filters\`: propertyName, operator, value\uFF09
|
|
9484
|
+
- \`sorts\` \u2014 \u30BD\u30FC\u30C8\u6307\u5B9A\u306E\u914D\u5217
|
|
9485
|
+
- \`properties\` \u2014 \u8FD4\u5374\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u914D\u5217
|
|
9486
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u7D50\u679C\u6570\uFF08\u6700\u5927100\uFF09
|
|
9487
|
+
- \`after\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8`
|
|
9488
|
+
},
|
|
9489
|
+
tools: tools33
|
|
9490
|
+
});
|
|
9491
|
+
|
|
8664
9492
|
// ../connectors/src/connectors/registry.ts
|
|
8665
9493
|
var plugins = {
|
|
8666
9494
|
snowflake: snowflakeConnector,
|
|
@@ -8694,7 +9522,8 @@ var plugins = {
|
|
|
8694
9522
|
slack: slackConnector,
|
|
8695
9523
|
shopifyOauth: shopifyOauthConnector,
|
|
8696
9524
|
msTeams: msTeamsConnector,
|
|
8697
|
-
msTeamsOauth: msTeamsOauthConnector
|
|
9525
|
+
msTeamsOauth: msTeamsOauthConnector,
|
|
9526
|
+
hubspot: hubspotConnector
|
|
8698
9527
|
};
|
|
8699
9528
|
var connectors = {
|
|
8700
9529
|
...plugins,
|
|
@@ -9157,62 +9986,62 @@ function createDbtClient(entry, slug) {
|
|
|
9157
9986
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
9158
9987
|
|
|
9159
9988
|
// src/types/server-logic.ts
|
|
9160
|
-
import { z as
|
|
9161
|
-
var parameterMetaSchema =
|
|
9162
|
-
name:
|
|
9163
|
-
type:
|
|
9164
|
-
description:
|
|
9165
|
-
required:
|
|
9166
|
-
default:
|
|
9167
|
-
});
|
|
9168
|
-
var serverLogicCacheConfigSchema =
|
|
9169
|
-
ttl:
|
|
9170
|
-
staleWhileRevalidate:
|
|
9171
|
-
});
|
|
9172
|
-
var serverLogicSchemaObjectSchema =
|
|
9173
|
-
() =>
|
|
9174
|
-
type:
|
|
9175
|
-
format:
|
|
9176
|
-
description:
|
|
9177
|
-
nullable:
|
|
9178
|
-
enum:
|
|
9989
|
+
import { z as z36 } from "zod";
|
|
9990
|
+
var parameterMetaSchema = z36.object({
|
|
9991
|
+
name: z36.string(),
|
|
9992
|
+
type: z36.enum(["string", "number", "boolean"]),
|
|
9993
|
+
description: z36.string(),
|
|
9994
|
+
required: z36.boolean().optional(),
|
|
9995
|
+
default: z36.union([z36.string(), z36.number(), z36.boolean()]).optional()
|
|
9996
|
+
});
|
|
9997
|
+
var serverLogicCacheConfigSchema = z36.object({
|
|
9998
|
+
ttl: z36.number(),
|
|
9999
|
+
staleWhileRevalidate: z36.boolean().optional()
|
|
10000
|
+
});
|
|
10001
|
+
var serverLogicSchemaObjectSchema = z36.lazy(
|
|
10002
|
+
() => z36.object({
|
|
10003
|
+
type: z36.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
10004
|
+
format: z36.string().optional(),
|
|
10005
|
+
description: z36.string().optional(),
|
|
10006
|
+
nullable: z36.boolean().optional(),
|
|
10007
|
+
enum: z36.array(z36.union([z36.string(), z36.number(), z36.boolean(), z36.null()])).optional(),
|
|
9179
10008
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
9180
|
-
properties:
|
|
9181
|
-
required:
|
|
9182
|
-
additionalProperties:
|
|
9183
|
-
minimum:
|
|
9184
|
-
maximum:
|
|
9185
|
-
minLength:
|
|
9186
|
-
maxLength:
|
|
9187
|
-
pattern:
|
|
10009
|
+
properties: z36.record(z36.string(), serverLogicSchemaObjectSchema).optional(),
|
|
10010
|
+
required: z36.array(z36.string()).optional(),
|
|
10011
|
+
additionalProperties: z36.union([z36.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
10012
|
+
minimum: z36.number().optional(),
|
|
10013
|
+
maximum: z36.number().optional(),
|
|
10014
|
+
minLength: z36.number().optional(),
|
|
10015
|
+
maxLength: z36.number().optional(),
|
|
10016
|
+
pattern: z36.string().optional()
|
|
9188
10017
|
})
|
|
9189
10018
|
);
|
|
9190
|
-
var serverLogicMediaTypeSchema =
|
|
10019
|
+
var serverLogicMediaTypeSchema = z36.object({
|
|
9191
10020
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
9192
|
-
example:
|
|
10021
|
+
example: z36.unknown().optional()
|
|
9193
10022
|
});
|
|
9194
|
-
var serverLogicResponseSchema =
|
|
9195
|
-
description:
|
|
9196
|
-
content:
|
|
10023
|
+
var serverLogicResponseSchema = z36.object({
|
|
10024
|
+
description: z36.string().optional(),
|
|
10025
|
+
content: z36.record(z36.string(), serverLogicMediaTypeSchema).optional()
|
|
9197
10026
|
});
|
|
9198
10027
|
var jsonBaseFields = {
|
|
9199
|
-
description:
|
|
9200
|
-
parameters:
|
|
10028
|
+
description: z36.string(),
|
|
10029
|
+
parameters: z36.array(parameterMetaSchema).optional(),
|
|
9201
10030
|
response: serverLogicResponseSchema.optional(),
|
|
9202
10031
|
cache: serverLogicCacheConfigSchema.optional()
|
|
9203
10032
|
};
|
|
9204
|
-
var jsonSqlServerLogicSchema =
|
|
10033
|
+
var jsonSqlServerLogicSchema = z36.object({
|
|
9205
10034
|
...jsonBaseFields,
|
|
9206
|
-
type:
|
|
9207
|
-
query:
|
|
9208
|
-
connectionId:
|
|
10035
|
+
type: z36.literal("sql").optional(),
|
|
10036
|
+
query: z36.string(),
|
|
10037
|
+
connectionId: z36.string()
|
|
9209
10038
|
});
|
|
9210
|
-
var jsonTypeScriptServerLogicSchema =
|
|
10039
|
+
var jsonTypeScriptServerLogicSchema = z36.object({
|
|
9211
10040
|
...jsonBaseFields,
|
|
9212
|
-
type:
|
|
9213
|
-
handlerPath:
|
|
10041
|
+
type: z36.literal("typescript"),
|
|
10042
|
+
handlerPath: z36.string()
|
|
9214
10043
|
});
|
|
9215
|
-
var anyJsonServerLogicSchema =
|
|
10044
|
+
var anyJsonServerLogicSchema = z36.union([
|
|
9216
10045
|
jsonTypeScriptServerLogicSchema,
|
|
9217
10046
|
jsonSqlServerLogicSchema
|
|
9218
10047
|
]);
|