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