@oomol-lab/open-connector 1.6.4 → 1.7.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/assets/open-connector/catalog/apps/aisa.json +6394 -0
- package/assets/open-connector/catalog/apps/baizhi_mcp.json +135 -0
- package/assets/open-connector/catalog/apps/bilibili.json +2586 -0
- package/assets/open-connector/catalog/apps/bitwarden.json +1423 -0
- package/assets/open-connector/catalog/apps/cronfree.json +303 -0
- package/assets/open-connector/catalog/apps/cufinder.json +368 -0
- package/assets/open-connector/catalog/apps/discordbot.json +2888 -248
- package/assets/open-connector/catalog/apps/drawio_mcp.json +192 -0
- package/assets/open-connector/catalog/apps/firecrawl.json +176 -32
- package/assets/open-connector/catalog/apps/framejet.json +273 -0
- package/assets/open-connector/catalog/apps/futunn.json +2967 -0
- package/assets/open-connector/catalog/apps/gmail.json +298 -0
- package/assets/open-connector/catalog/apps/google_analytics.json +4 -1
- package/assets/open-connector/catalog/apps/google_bigquery.json +4 -1
- package/assets/open-connector/catalog/apps/google_search_console.json +4 -1
- package/assets/open-connector/catalog/apps/googlecalendar.json +4 -1
- package/assets/open-connector/catalog/apps/googlechat.json +694 -7
- package/assets/open-connector/catalog/apps/googledocs.json +4 -1
- package/assets/open-connector/catalog/apps/googlesheets.json +4 -1
- package/assets/open-connector/catalog/apps/granola.json +23 -0
- package/assets/open-connector/catalog/apps/investoday_mcp.json +22228 -197
- package/assets/open-connector/catalog/apps/ixspy.json +2274 -0
- package/assets/open-connector/catalog/apps/keepa.json +3534 -987
- package/assets/open-connector/catalog/apps/linear.json +17 -0
- package/assets/open-connector/catalog/apps/linear_mcp.json +510 -0
- package/assets/open-connector/catalog/apps/moneyforward_mcp.json +1432 -0
- package/assets/open-connector/catalog/apps/notion.json +446 -1
- package/assets/open-connector/catalog/apps/notion_mcp.json +490 -0
- package/assets/open-connector/catalog/apps/odoo.json +619 -0
- package/assets/open-connector/catalog/apps/osv.json +663 -0
- package/assets/open-connector/catalog/apps/outlook.json +30 -8
- package/assets/open-connector/catalog/apps/outlook_calendar.json +23 -2
- package/assets/open-connector/catalog/apps/pdf_vector.json +329 -0
- package/assets/open-connector/catalog/apps/postiz.json +334 -0
- package/assets/open-connector/catalog/apps/proworkflow.json +529 -0
- package/assets/open-connector/catalog/apps/pulsetic.json +406 -0
- package/assets/open-connector/catalog/apps/sellersprite_mcp.json +2 -1
- package/assets/open-connector/catalog/apps/shopee.json +1785 -0
- package/assets/open-connector/catalog/apps/slack.json +304 -0
- package/assets/open-connector/catalog/apps/slackbot.json +295 -0
- package/assets/open-connector/catalog/apps/speak_ai.json +360 -0
- package/assets/open-connector/catalog/apps/tencent_docs.json +3 -0
- package/assets/open-connector/catalog/apps/wisburg.json +1528 -0
- package/assets/open-connector/catalog/apps/youtube.json +4 -1
- package/assets/open-connector/catalog/apps/zerotier.json +3319 -0
- package/assets/open-connector/catalog/apps/zyhub.json +1585 -0
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/package.json +1 -1
- package/src/core/cast.d.ts +10 -0
- package/src/core/cast.js +14 -0
- package/src/core/guarded-fetch.d.ts +6 -3
- package/src/core/guarded-fetch.js +6 -3
- package/src/core/json-schema.d.ts +5 -1
- package/src/core/json-schema.js +14 -2
- package/src/core/provider-scenarios.js +67 -13
- package/src/core/request.js +4 -1
- package/src/core/types.d.ts +10 -1
- package/src/mcp.js +10 -7
- package/src/oauth/oauth-client-config-service.d.ts +16 -1
- package/src/oauth/oauth-client-config-service.js +59 -3
- package/src/oauth/oauth-credential-refresh-service.js +3 -1
- package/src/oauth/oauth-flow-service.d.ts +6 -0
- package/src/oauth/oauth-flow-service.js +21 -4
- package/src/oauth/oauth-token.d.ts +13 -0
- package/src/providers/17track/runtime.js +1 -1
- package/src/providers/action-contracts.generated.d.ts +32 -8
- package/src/providers/aifinmarket/runtime.js +1 -1
- package/src/providers/aisa/executors.d.ts +4 -0
- package/src/providers/aisa/executors.js +864 -0
- package/src/providers/aliyun_ack/runtime.js +1 -1
- package/src/providers/aliyun_sls/runtime.js +1 -1
- package/src/providers/app_store_server/runtime-helpers.js +1 -1
- package/src/providers/baizhi_mcp/actions.d.ts +2 -0
- package/src/providers/baizhi_mcp/actions.js +40 -0
- package/src/providers/baizhi_mcp/executors.d.ts +3 -0
- package/src/providers/baizhi_mcp/executors.js +102 -0
- package/src/providers/bazhuayu/runtime.js +2 -2
- package/src/providers/bilibili/articles.d.ts +3 -0
- package/src/providers/bilibili/articles.js +369 -0
- package/src/providers/bilibili/executors.d.ts +8 -0
- package/src/providers/bilibili/executors.js +262 -0
- package/src/providers/bilibili/runtime.d.ts +95 -0
- package/src/providers/bilibili/runtime.js +236 -0
- package/src/providers/bilibili/upload.d.ts +14 -0
- package/src/providers/bilibili/upload.js +107 -0
- package/src/providers/bitwarden/executors.d.ts +3 -0
- package/src/providers/bitwarden/executors.js +146 -0
- package/src/providers/cloudflare_browser_rendering/executors.js +1 -1
- package/src/providers/cloudflare_dns/executors.js +1 -1
- package/src/providers/{cloudflare-current-user.js → cloudflare_dns/runtime-user.js} +2 -2
- package/src/providers/cloudflare_dns/runtime.d.ts +1 -1
- package/src/providers/cloudflare_dns/runtime.js +1 -1
- package/src/providers/cloudflare_r2/executors.js +1 -1
- package/src/providers/cloudflare_r2/runtime.d.ts +1 -1
- package/src/providers/cloudflare_r2/runtime.js +1 -1
- package/src/providers/cloudflare_worker/executors.js +1 -1
- package/src/providers/cloudflare_worker/runtime.d.ts +1 -1
- package/src/providers/cloudflare_worker/runtime.js +1 -1
- package/src/providers/cronfree/executors.d.ts +4 -0
- package/src/providers/cronfree/executors.js +89 -0
- package/src/providers/cufinder/executors.d.ts +4 -0
- package/src/providers/cufinder/executors.js +105 -0
- package/src/providers/dingtalk_mcp/runtime.js +1 -1
- package/src/providers/discordbot/executors.d.ts +0 -9
- package/src/providers/discordbot/executors.js +9 -101
- package/src/providers/discordbot/runtime-guilds.d.ts +3 -0
- package/src/providers/discordbot/runtime-guilds.js +464 -0
- package/src/providers/discordbot/runtime.d.ts +42 -0
- package/src/providers/discordbot/runtime.js +124 -0
- package/src/providers/drawio_mcp/executors.d.ts +3 -0
- package/src/providers/drawio_mcp/executors.js +19 -0
- package/src/providers/drawio_mcp/runtime.d.ts +8 -0
- package/src/providers/drawio_mcp/runtime.js +175 -0
- package/src/providers/elevenreader/runtime.js +6 -5
- package/src/providers/fastmoss_mcp/executors.js +2 -2
- package/src/providers/finchina/executors.js +1 -1
- package/src/providers/framejet/executors.d.ts +4 -0
- package/src/providers/framejet/executors.js +19 -0
- package/src/providers/framejet/runtime.d.ts +16 -0
- package/src/providers/framejet/runtime.js +148 -0
- package/src/providers/futunn/actions.d.ts +2 -0
- package/src/providers/futunn/actions.js +152 -0
- package/src/providers/futunn/actions.research.d.ts +2 -0
- package/src/providers/futunn/actions.research.js +423 -0
- package/src/providers/futunn/actions.trading.d.ts +2 -0
- package/src/providers/futunn/actions.trading.js +204 -0
- package/src/providers/futunn/executors.d.ts +3 -0
- package/src/providers/futunn/executors.js +24 -0
- package/src/providers/futunn/runtime-research.d.ts +3 -0
- package/src/providers/futunn/runtime-research.js +133 -0
- package/src/providers/futunn/runtime-trading.d.ts +3 -0
- package/src/providers/futunn/runtime-trading.js +39 -0
- package/src/providers/futunn/runtime.d.ts +2 -0
- package/src/providers/futunn/runtime.js +50 -0
- package/src/providers/futunn/transport.d.ts +11 -0
- package/src/providers/futunn/transport.js +76 -0
- package/src/providers/gildata/executors.js +1 -1
- package/src/providers/gmail/attachment-stream.d.ts +2 -0
- package/src/providers/gmail/attachment-stream.js +162 -0
- package/src/providers/gmail/executors.d.ts +3 -1
- package/src/providers/gmail/executors.js +54 -26
- package/src/providers/gmail/message.d.ts +6 -8
- package/src/providers/gmail/message.js +4 -0
- package/src/providers/gmail/scopes.d.ts +32 -0
- package/src/providers/gmail/scopes.js +37 -0
- package/src/providers/google_analytics/executors.js +2 -2
- package/src/providers/google_analytics/scopes.js +6 -1
- package/src/providers/google_bigquery/executors.js +2 -2
- package/src/providers/google_bigquery/scopes.js +2 -0
- package/src/providers/google_search_console/executors.js +2 -2
- package/src/providers/google_search_console/scopes.js +2 -0
- package/src/providers/googleads/executors.js +1 -1
- package/src/providers/googleads/scopes.d.ts +1 -3
- package/src/providers/googleads/scopes.js +2 -4
- package/src/providers/googlecalendar/executors.js +1 -1
- package/src/providers/googlecalendar/runtime-shared.js +2 -2
- package/src/providers/googlecalendar/scopes.js +2 -0
- package/src/providers/googlechat/executors.d.ts +1 -3
- package/src/providers/googlechat/executors.js +219 -28
- package/src/providers/googlechat/members.d.ts +55 -0
- package/src/providers/googlechat/members.js +293 -0
- package/src/providers/googlechat/runtime.d.ts +16 -0
- package/src/providers/googlechat/runtime.js +25 -0
- package/src/providers/googlechat/scopes.d.ts +22 -3
- package/src/providers/googlechat/scopes.js +30 -7
- package/src/providers/googledocs/executors.js +1 -1
- package/src/providers/googledrive/executors.js +2 -2
- package/src/providers/{google-auth.d.ts → googledrive/runtime-auth.d.ts} +2 -2
- package/src/providers/{google-auth.js → googledrive/runtime-auth.js} +3 -3
- package/src/providers/googledrive/runtime-collaboration.js +1 -1
- package/src/providers/{google-runtime.d.ts → googledrive/runtime-request.d.ts} +1 -1
- package/src/providers/{google-runtime.js → googledrive/runtime-request.js} +2 -2
- package/src/providers/googleforms/executors.js +2 -2
- package/src/providers/googleforms/scopes.d.ts +0 -3
- package/src/providers/googleforms/scopes.js +2 -6
- package/src/providers/googlemeet/executors.js +2 -2
- package/src/providers/googlemeet/scopes.d.ts +0 -3
- package/src/providers/googlemeet/scopes.js +2 -6
- package/src/providers/googlesheets/executors.js +1 -1
- package/src/providers/googlesheets/scopes.js +2 -0
- package/src/providers/googleslides/executors.js +2 -2
- package/src/providers/googleslides/scopes.d.ts +0 -3
- package/src/providers/googleslides/scopes.js +2 -6
- package/src/providers/googletasks/executors.js +2 -2
- package/src/providers/googletasks/scopes.d.ts +0 -3
- package/src/providers/googletasks/scopes.js +2 -6
- package/src/providers/granola/actions.js +2 -0
- package/src/providers/granola/runtime-mcp.js +2 -0
- package/src/providers/granola/runtime.js +2 -2
- package/src/providers/indiegogo/executors.js +1 -1
- package/src/providers/investoday_mcp/executors.js +2 -2
- package/src/providers/investoday_mcp/official-actions.js +19 -372
- package/src/providers/investoday_mcp/official-tool-types.d.ts +10 -0
- package/src/providers/investoday_mcp/official-tool-types.js +4 -0
- package/src/providers/investoday_mcp/official-tools/charts.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/charts.js +32 -0
- package/src/providers/investoday_mcp/official-tools/fixed-income.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/fixed-income.js +326 -0
- package/src/providers/investoday_mcp/official-tools/funds.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/funds.js +1085 -0
- package/src/providers/investoday_mcp/official-tools/hong-kong.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/hong-kong.js +275 -0
- package/src/providers/investoday_mcp/official-tools/indices-industries.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/indices-industries.js +642 -0
- package/src/providers/investoday_mcp/official-tools/macro-calendar.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/macro-calendar.js +398 -0
- package/src/providers/investoday_mcp/official-tools/other.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/other.js +131 -0
- package/src/providers/investoday_mcp/official-tools/research-news.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/research-news.js +302 -0
- package/src/providers/investoday_mcp/official-tools/stocks.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/stocks.js +2829 -0
- package/src/providers/ixspy/executors.d.ts +3 -0
- package/src/providers/ixspy/executors.js +220 -0
- package/src/providers/iyunbiao/runtime.js +2 -2
- package/src/providers/keepa/actions.d.ts +1 -1
- package/src/providers/keepa/actions.js +371 -149
- package/src/providers/keepa/deal-attributes.d.ts +1 -0
- package/src/providers/keepa/deal-attributes.js +26 -0
- package/src/providers/keepa/runtime.js +212 -18
- package/src/providers/kingdee/executors.js +1 -1
- package/src/providers/kingdee/runtime.js +2 -2
- package/src/providers/kuaidi100/runtime.js +1 -1
- package/src/providers/linear/executors.js +12 -9
- package/src/providers/linear_mcp/actions.d.ts +47 -0
- package/src/providers/linear_mcp/actions.js +102 -0
- package/src/providers/linear_mcp/endpoints.d.ts +3 -0
- package/src/providers/linear_mcp/endpoints.js +3 -0
- package/src/providers/linear_mcp/executors.d.ts +3 -0
- package/src/providers/linear_mcp/executors.js +9 -0
- package/src/providers/linear_mcp/runtime-mcp.d.ts +15 -0
- package/src/providers/linear_mcp/runtime-mcp.js +238 -0
- package/src/providers/lingxing_mcp/runtime.js +1 -1
- package/src/providers/mcdonalds_cn_mcp/runtime.js +1 -1
- package/src/providers/metabase/mcp-runtime.js +1 -1
- package/src/providers/moneyforward_mcp/executors.d.ts +3 -0
- package/src/providers/moneyforward_mcp/executors.js +11 -0
- package/src/providers/moneyforward_mcp/manifest.d.ts +31 -0
- package/src/providers/moneyforward_mcp/manifest.js +204 -0
- package/src/providers/moneyforward_mcp/runtime.d.ts +18 -0
- package/src/providers/moneyforward_mcp/runtime.js +296 -0
- package/src/providers/notion/executors.js +39 -3
- package/src/providers/notion_mcp/endpoints.d.ts +3 -0
- package/src/providers/notion_mcp/endpoints.js +3 -0
- package/src/providers/notion_mcp/executors.d.ts +3 -0
- package/src/providers/notion_mcp/executors.js +176 -0
- package/src/providers/notion_mcp/mcp-response.d.ts +86 -0
- package/src/providers/notion_mcp/mcp-response.js +314 -0
- package/src/providers/odoo/executors.d.ts +3 -0
- package/src/providers/odoo/executors.js +32 -0
- package/src/providers/odoo/runtime.d.ts +16 -0
- package/src/providers/odoo/runtime.js +140 -0
- package/src/providers/osv/executors.d.ts +2 -0
- package/src/providers/osv/executors.js +11 -0
- package/src/providers/osv/runtime.d.ts +9 -0
- package/src/providers/osv/runtime.js +66 -0
- package/src/providers/outlook/executors.js +27 -6
- package/src/providers/outlook/microsoft-graph.js +17 -6
- package/src/providers/outlook_calendar/executors.js +24 -7
- package/src/providers/patsnap_mcp/executors.js +2 -2
- package/src/providers/pdf_vector/executors.d.ts +4 -0
- package/src/providers/pdf_vector/executors.js +108 -0
- package/src/providers/postiz/executors.d.ts +4 -0
- package/src/providers/postiz/executors.js +83 -0
- package/src/providers/provider-runtime.d.ts +18 -0
- package/src/providers/provider-runtime.js +60 -4
- package/src/providers/proworkflow/executors.d.ts +4 -0
- package/src/providers/proworkflow/executors.js +135 -0
- package/src/providers/pulsetic/executors.d.ts +4 -0
- package/src/providers/pulsetic/executors.js +126 -0
- package/src/providers/registry.generated.js +24 -0
- package/src/providers/scrape_creators/catalog.js +1 -1
- package/src/providers/scrape_creators/runtime.js +1 -1
- package/src/providers/sellersprite_mcp/executors.js +2 -2
- package/src/providers/sellersprite_mcp/official-actions.js +3 -2
- package/src/providers/sentry/runtime.js +6 -7
- package/src/providers/shopee/actions.d.ts +2 -0
- package/src/providers/shopee/actions.js +474 -0
- package/src/providers/shopee/executors.d.ts +3 -0
- package/src/providers/shopee/executors.js +85 -0
- package/src/providers/shopee/runtime.d.ts +79 -0
- package/src/providers/shopee/runtime.js +693 -0
- package/src/providers/slack/actions.js +69 -3
- package/src/providers/slack/runtime.js +116 -21
- package/src/providers/slickdeals/runtime.js +1 -1
- package/src/providers/sorftime_mcp/executors.js +2 -2
- package/src/providers/speak_ai/executors.d.ts +3 -0
- package/src/providers/speak_ai/executors.js +187 -0
- package/src/providers/tikhub/bounded-response.d.ts +1 -1
- package/src/providers/tikhub/bounded-response.js +8 -34
- package/src/providers/tikhub/endpoint-catalog.js +1 -1
- package/src/providers/tikhub/runtime.js +2 -2
- package/src/providers/tongdaxin/executors.js +79 -15
- package/src/providers/tushare/runtime.js +22 -9
- package/src/providers/uspto/executors.js +1 -1
- package/src/providers/waffo/executors.js +1 -1
- package/src/providers/waffo/runtime.js +1 -1
- package/src/providers/wecom_mcp/runtime.js +1 -1
- package/src/providers/wisburg/executors.d.ts +4 -0
- package/src/providers/wisburg/executors.js +13 -0
- package/src/providers/wisburg/runtime.d.ts +12 -0
- package/src/providers/wisburg/runtime.js +133 -0
- package/src/providers/xydc_mcp/executors.js +2 -2
- package/src/providers/youtube/executors.js +1 -1
- package/src/providers/youtube/runtime.js +1 -1
- package/src/providers/zerotier/executors.d.ts +9 -0
- package/src/providers/zerotier/executors.js +629 -0
- package/src/providers/zerotier/runtime.d.ts +54 -0
- package/src/providers/zerotier/runtime.js +207 -0
- package/src/providers/zyhub/executors.d.ts +3 -0
- package/src/providers/zyhub/executors.js +240 -0
- package/src/server/api/openapi.js +12 -2
- package/src/server/api/runtime-api.d.ts +8 -1
- package/src/server/api/runtime-api.js +19 -1
- package/src/server/connect-server.js +10 -2
- package/src/server/files/transit-files.d.ts +3 -2
- package/src/server/files/transit-files.js +31 -35
- package/src/providers/sentry/scopes.d.ts +0 -1
- package/src/providers/sentry/scopes.js +0 -7
- /package/src/providers/{cloudflare-current-user.d.ts → cloudflare_dns/runtime-user.d.ts} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { providerResponseError, ProviderRequestError } from "../provider-runtime.js";
|
|
2
|
+
const chunkSize = 16 * 1024;
|
|
3
|
+
const maxEnvelopeCharacters = 16 * 1024;
|
|
4
|
+
/** Decode MessagePartBody.data while retaining only a small JSON envelope and one base64 block. */
|
|
5
|
+
export function decodeGmailAttachment(body, maxBytes) {
|
|
6
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
7
|
+
const parser = new AttachmentParser(maxBytes);
|
|
8
|
+
return body.pipeThrough(new TransformStream({
|
|
9
|
+
transform(chunk, controller) {
|
|
10
|
+
for (let offset = 0; offset < chunk.length; offset += chunkSize) {
|
|
11
|
+
parser.push(decoder.decode(chunk.subarray(offset, offset + chunkSize), { stream: true }), controller);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
flush(controller) {
|
|
15
|
+
parser.push(decoder.decode(), controller);
|
|
16
|
+
parser.finish();
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
/** Strip only the top-level data string; JSON.parse validates the remaining bounded envelope at EOF. */
|
|
21
|
+
class AttachmentParser {
|
|
22
|
+
maxBytes;
|
|
23
|
+
envelope = "";
|
|
24
|
+
depth = 0;
|
|
25
|
+
previous = "";
|
|
26
|
+
stringKind;
|
|
27
|
+
escaped = false;
|
|
28
|
+
keyToken = "";
|
|
29
|
+
key = "";
|
|
30
|
+
keys = new Set();
|
|
31
|
+
sawData = false;
|
|
32
|
+
dataEscape = "";
|
|
33
|
+
base64 = "";
|
|
34
|
+
padding = false;
|
|
35
|
+
sizeBytes = 0;
|
|
36
|
+
constructor(maxBytes) {
|
|
37
|
+
this.maxBytes = maxBytes;
|
|
38
|
+
}
|
|
39
|
+
push(text, controller) {
|
|
40
|
+
for (const character of text) {
|
|
41
|
+
if (this.stringKind === "data") {
|
|
42
|
+
this.pushData(character, controller);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
this.envelope += character;
|
|
46
|
+
if (this.envelope.length > maxEnvelopeCharacters) {
|
|
47
|
+
throw providerResponseError("Gmail attachment JSON envelope is too large");
|
|
48
|
+
}
|
|
49
|
+
if (this.stringKind) {
|
|
50
|
+
if (this.stringKind === "key")
|
|
51
|
+
this.keyToken += character;
|
|
52
|
+
if (this.escaped) {
|
|
53
|
+
this.escaped = false;
|
|
54
|
+
}
|
|
55
|
+
else if (character === "\\") {
|
|
56
|
+
this.escaped = true;
|
|
57
|
+
}
|
|
58
|
+
else if (character === '"') {
|
|
59
|
+
if (this.stringKind === "key") {
|
|
60
|
+
this.key = JSON.parse(this.keyToken);
|
|
61
|
+
if (this.keys.has(this.key))
|
|
62
|
+
throw providerResponseError("Duplicate Gmail attachment field");
|
|
63
|
+
this.keys.add(this.key);
|
|
64
|
+
}
|
|
65
|
+
this.stringKind = undefined;
|
|
66
|
+
this.previous = '"';
|
|
67
|
+
}
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (character === '"') {
|
|
71
|
+
if (this.depth === 1 && (this.previous === "{" || this.previous === ",")) {
|
|
72
|
+
this.stringKind = "key";
|
|
73
|
+
this.keyToken = '"';
|
|
74
|
+
}
|
|
75
|
+
else if (this.depth === 1 && this.previous === ":" && this.key === "data") {
|
|
76
|
+
this.stringKind = "data";
|
|
77
|
+
this.sawData = true;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.stringKind = "other";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (character === "{" || character === "[") {
|
|
84
|
+
this.depth++;
|
|
85
|
+
}
|
|
86
|
+
else if (character === "}" || character === "]") {
|
|
87
|
+
this.depth--;
|
|
88
|
+
}
|
|
89
|
+
if (!/\s/.test(character))
|
|
90
|
+
this.previous = character;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
finish() {
|
|
94
|
+
let envelope;
|
|
95
|
+
try {
|
|
96
|
+
envelope = JSON.parse(this.envelope);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
throw providerResponseError("Invalid Gmail attachment JSON");
|
|
100
|
+
}
|
|
101
|
+
if (!this.sawData ||
|
|
102
|
+
this.stringKind ||
|
|
103
|
+
envelope?.data !== "" ||
|
|
104
|
+
!Number.isSafeInteger(envelope.size) ||
|
|
105
|
+
envelope.size !== this.sizeBytes) {
|
|
106
|
+
throw providerResponseError("Gmail attachment is incomplete or its size does not match");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
pushData(character, controller) {
|
|
110
|
+
if (this.dataEscape) {
|
|
111
|
+
this.dataEscape += character;
|
|
112
|
+
if (this.dataEscape === "\\u" || (this.dataEscape.startsWith("\\u") && this.dataEscape.length < 6))
|
|
113
|
+
return;
|
|
114
|
+
try {
|
|
115
|
+
character = JSON.parse(`"${this.dataEscape}"`);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
throw providerResponseError("Invalid Gmail attachment JSON escape");
|
|
119
|
+
}
|
|
120
|
+
this.dataEscape = "";
|
|
121
|
+
}
|
|
122
|
+
else if (character === "\\") {
|
|
123
|
+
this.dataEscape = character;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
else if (character === '"') {
|
|
127
|
+
// Buffer's decoder is permissive. Round-tripping the tail rejects bad padding and unused bits.
|
|
128
|
+
const tail = Buffer.from(this.base64, "base64url");
|
|
129
|
+
if (!/^[A-Za-z0-9_-]*={0,2}$/.test(this.base64) ||
|
|
130
|
+
(this.padding && this.base64.length % 4 !== 0) ||
|
|
131
|
+
tail.toString("base64url") !== this.base64.replace(/=+$/, "")) {
|
|
132
|
+
throw providerResponseError("Invalid Gmail attachment base64url data");
|
|
133
|
+
}
|
|
134
|
+
this.emit(tail, controller);
|
|
135
|
+
this.base64 = "";
|
|
136
|
+
this.stringKind = undefined;
|
|
137
|
+
this.previous = '"';
|
|
138
|
+
this.envelope += '"';
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!/^[A-Za-z0-9_=-]$/.test(character) || (this.padding && character !== "=")) {
|
|
142
|
+
throw providerResponseError("Invalid Gmail attachment base64url data");
|
|
143
|
+
}
|
|
144
|
+
this.padding ||= character === "=";
|
|
145
|
+
this.base64 += character;
|
|
146
|
+
if (this.padding && this.base64.length > chunkSize + 2) {
|
|
147
|
+
throw providerResponseError("Invalid Gmail attachment base64url padding");
|
|
148
|
+
}
|
|
149
|
+
if (!this.padding && this.base64.length === chunkSize) {
|
|
150
|
+
this.emit(Buffer.from(this.base64, "base64url"), controller);
|
|
151
|
+
this.base64 = "";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
emit(bytes, controller) {
|
|
155
|
+
this.sizeBytes += bytes.length;
|
|
156
|
+
if (this.sizeBytes > this.maxBytes) {
|
|
157
|
+
throw new ProviderRequestError(413, `Gmail attachment exceeds transit file limit of ${this.maxBytes} bytes`);
|
|
158
|
+
}
|
|
159
|
+
if (bytes.length)
|
|
160
|
+
controller.enqueue(bytes);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { CredentialValidators, ProviderExecutors, ProviderProxyExecutor } from "../../core/types.ts";
|
|
1
|
+
import type { CredentialValidators, ExecutionContext, ProviderExecutors, ProviderProxyExecutor } from "../../core/types.ts";
|
|
2
2
|
import type { ProviderActionHandlers } from "../provider-runtime.ts";
|
|
3
3
|
declare const service = "gmail";
|
|
4
4
|
interface ActionContext {
|
|
5
5
|
userId: string;
|
|
6
6
|
accessToken: string;
|
|
7
7
|
fetcher: typeof fetch;
|
|
8
|
+
transitFiles?: ExecutionContext["transitFiles"];
|
|
9
|
+
signal?: AbortSignal;
|
|
8
10
|
}
|
|
9
11
|
type ActionHandler = (input: Record<string, unknown>, context: ActionContext) => Promise<unknown>;
|
|
10
12
|
export declare const gmailActionHandlers: ProviderActionHandlers<typeof service, ActionHandler>;
|
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { looseArray, optionalRecord, optionalString } from "../../core/cast.js";
|
|
2
|
+
import { encodePathSegment } from "../../core/request.js";
|
|
3
|
+
import { googleBearerProxyAuth, googleServiceAccountValidator, resolveGoogleAccessToken, } from "../googledrive/runtime-auth.js";
|
|
4
|
+
import { defineProviderExecutors, defineProviderProxy, ProviderRequestError, readProviderErrorTextBody, readProviderJsonBody, requiredInputString, runProviderRequest, withRetryAfterSeconds, } from "../provider-runtime.js";
|
|
5
|
+
import { decodeGmailAttachment } from "./attachment-stream.js";
|
|
3
6
|
import { buildRecipients, encodeMimeMessage, extractBodyContent, firstAddress, normalizeGmailMessage, normalizeMessageId, normalizeThreadId, parseAddressList, readHeader, resolveReplyHeaders, summarizeGmailMessage, } from "./message.js";
|
|
4
7
|
import { gmailOAuthScopes } from "./scopes.js";
|
|
5
8
|
const service = "gmail";
|
|
6
9
|
const gmailApiBaseUrl = "https://gmail.googleapis.com/gmail/v1";
|
|
7
10
|
const detailHydrationBatchSize = 10;
|
|
11
|
+
// Attachments may reach Gmail's 25 MB cap, and the base64 JSON envelope is a third larger again;
|
|
12
|
+
// the default 30 s request budget covers fetch, decode, and disk write, so give this transfer longer.
|
|
13
|
+
const attachmentDownloadTimeoutMs = 120_000;
|
|
8
14
|
const defaultFetchEmailsMaxResults = 20;
|
|
9
15
|
export const gmailActionHandlers = {
|
|
16
|
+
async download_attachment(input, context) {
|
|
17
|
+
const { transitFiles, fetcher, accessToken } = context;
|
|
18
|
+
if (!transitFiles?.createFromStream) {
|
|
19
|
+
throw new ProviderRequestError(400, "Gmail attachment downloads require a streaming transit file backend (filesystem).");
|
|
20
|
+
}
|
|
21
|
+
const messageId = requiredInputString(input.messageId, "messageId");
|
|
22
|
+
const attachmentId = requiredInputString(input.attachmentId, "attachmentId");
|
|
23
|
+
const userId = optionalString(input.userId) ?? context.userId;
|
|
24
|
+
const url = `${gmailUserUrl(userId, "messages")}/${encodePathSegment(messageId)}/attachments/${encodePathSegment(attachmentId)}?fields=data,size`;
|
|
25
|
+
return runProviderRequest({ signal: context.signal, label: "Gmail attachment", timeoutMs: attachmentDownloadTimeoutMs }, async (signal) => {
|
|
26
|
+
const response = await fetcher(url, { headers: { authorization: `Bearer ${accessToken}` }, signal });
|
|
27
|
+
await assertGmailResponse(response);
|
|
28
|
+
if (!response.body)
|
|
29
|
+
throw new ProviderRequestError(502, "Gmail attachment response has no body");
|
|
30
|
+
return transitFiles.createFromStream({
|
|
31
|
+
body: decodeGmailAttachment(response.body, transitFiles.maxBytes),
|
|
32
|
+
name: optionalString(input.fileName) ?? "attachment",
|
|
33
|
+
mimeType: optionalString(input.mimeType) ?? "application/octet-stream",
|
|
34
|
+
signal,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
},
|
|
10
38
|
async search_threads(input, { userId, accessToken, fetcher }) {
|
|
11
39
|
const output = await listThreads(input, userId, accessToken, fetcher);
|
|
12
40
|
return {
|
|
@@ -175,13 +203,20 @@ export const executors = defineProviderExecutors({
|
|
|
175
203
|
fetcher,
|
|
176
204
|
signal: context.signal,
|
|
177
205
|
});
|
|
178
|
-
return {
|
|
206
|
+
return {
|
|
207
|
+
userId: "me",
|
|
208
|
+
accessToken: resolved.accessToken,
|
|
209
|
+
fetcher,
|
|
210
|
+
transitFiles: context.transitFiles,
|
|
211
|
+
signal: context.signal,
|
|
212
|
+
};
|
|
179
213
|
},
|
|
180
214
|
});
|
|
181
215
|
export const proxy = defineProviderProxy({
|
|
182
216
|
service,
|
|
183
217
|
baseUrl: gmailApiBaseUrl,
|
|
184
218
|
auth: googleBearerProxyAuth(gmailOAuthScopes),
|
|
219
|
+
readError: readGmailError,
|
|
185
220
|
});
|
|
186
221
|
export const credentialValidators = {
|
|
187
222
|
async oauth2(input, { fetcher }) {
|
|
@@ -733,31 +768,24 @@ async function assertGmailResponse(response) {
|
|
|
733
768
|
if (response.ok) {
|
|
734
769
|
return;
|
|
735
770
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
throw new ProviderRequestError(response.status, message);
|
|
748
|
-
}
|
|
749
|
-
function readGmailErrorMessage(text) {
|
|
750
|
-
if (!text) {
|
|
751
|
-
return "";
|
|
752
|
-
}
|
|
771
|
+
throw await readGmailError(response);
|
|
772
|
+
}
|
|
773
|
+
const gmailQuotaReasons = new Set([
|
|
774
|
+
"rateLimitExceeded",
|
|
775
|
+
"userRateLimitExceeded",
|
|
776
|
+
"dailyLimitExceeded",
|
|
777
|
+
"quotaExceeded",
|
|
778
|
+
]);
|
|
779
|
+
async function readGmailError(response) {
|
|
780
|
+
const text = await readProviderErrorTextBody(response, "gmail error response");
|
|
781
|
+
let error;
|
|
753
782
|
try {
|
|
754
|
-
|
|
755
|
-
if (typeof payload.error === "string") {
|
|
756
|
-
return payload.error;
|
|
757
|
-
}
|
|
758
|
-
return payload.error?.message ?? text;
|
|
783
|
+
error = optionalRecord(optionalRecord(JSON.parse(text))?.error);
|
|
759
784
|
}
|
|
760
785
|
catch {
|
|
761
|
-
|
|
786
|
+
// A malformed response must not expose its raw body or change status classification.
|
|
762
787
|
}
|
|
788
|
+
const rateLimited = response.status === 403 &&
|
|
789
|
+
looseArray(error?.errors).some((entry) => gmailQuotaReasons.has(optionalString(optionalRecord(entry)?.reason) ?? ""));
|
|
790
|
+
return new ProviderRequestError(response.status, optionalString(error?.message) ?? `gmail request failed with ${response.status}`, withRetryAfterSeconds(response), rateLimited ? "rate_limited" : undefined);
|
|
763
791
|
}
|
|
@@ -20,6 +20,7 @@ export interface GmailMessageResource {
|
|
|
20
20
|
internalDate?: string;
|
|
21
21
|
labelIds?: string[];
|
|
22
22
|
snippet?: string;
|
|
23
|
+
sizeEstimate?: number;
|
|
23
24
|
raw?: string;
|
|
24
25
|
payload?: GmailMessagePart;
|
|
25
26
|
}
|
|
@@ -39,13 +40,7 @@ export interface GmailAttachmentSummary {
|
|
|
39
40
|
mimeType: string;
|
|
40
41
|
size: number;
|
|
41
42
|
}
|
|
42
|
-
export interface NormalizedGmailMessage {
|
|
43
|
-
messageId: string;
|
|
44
|
-
threadId: string;
|
|
45
|
-
labelIds: string[];
|
|
46
|
-
subject: string;
|
|
47
|
-
sender: string;
|
|
48
|
-
to: string;
|
|
43
|
+
export interface NormalizedGmailMessage extends GmailMessageSummary {
|
|
49
44
|
preview: {
|
|
50
45
|
subject: string;
|
|
51
46
|
body: string;
|
|
@@ -53,7 +48,6 @@ export interface NormalizedGmailMessage {
|
|
|
53
48
|
payload: GmailMessagePart | null;
|
|
54
49
|
messageText: string;
|
|
55
50
|
attachmentList: GmailAttachmentSummary[];
|
|
56
|
-
messageTimestamp: string;
|
|
57
51
|
raw?: string;
|
|
58
52
|
}
|
|
59
53
|
export interface GmailMessageSummary {
|
|
@@ -64,6 +58,10 @@ export interface GmailMessageSummary {
|
|
|
64
58
|
sender: string;
|
|
65
59
|
to: string;
|
|
66
60
|
messageTimestamp: string;
|
|
61
|
+
historyId?: string;
|
|
62
|
+
internalDate?: string;
|
|
63
|
+
sizeEstimate?: number;
|
|
64
|
+
snippet?: string;
|
|
67
65
|
}
|
|
68
66
|
export interface MimeMessageInput {
|
|
69
67
|
to: string[];
|
|
@@ -8,6 +8,10 @@ export function summarizeGmailMessage(resource) {
|
|
|
8
8
|
sender: readHeader(headers, "From"),
|
|
9
9
|
to: readHeader(headers, "To"),
|
|
10
10
|
messageTimestamp: toMessageTimestamp(resource.internalDate, readHeader(headers, "Date")),
|
|
11
|
+
historyId: resource.historyId,
|
|
12
|
+
internalDate: resource.internalDate,
|
|
13
|
+
sizeEstimate: resource.sizeEstimate,
|
|
14
|
+
snippet: resource.snippet,
|
|
11
15
|
};
|
|
12
16
|
}
|
|
13
17
|
export function normalizeGmailMessage(resource) {
|
|
@@ -10,4 +10,36 @@ export declare const gmailComposeScopes: string[];
|
|
|
10
10
|
export declare const gmailSendScopes: string[];
|
|
11
11
|
export declare const gmailLabelScopes: string[];
|
|
12
12
|
export declare const gmailSettingsBasicScopes: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The scopes a SERVICE ACCOUNT token is minted for, and the ones the proxy
|
|
15
|
+
* resolves with. Unchanged: a domain-wide-delegation grant lists these exact
|
|
16
|
+
* scopes in the Workspace admin console, and a token request naming a scope the
|
|
17
|
+
* admin has not authorized fails outright — so this list cannot grow without
|
|
18
|
+
* breaking every existing service-account connection.
|
|
19
|
+
*/
|
|
13
20
|
export declare const gmailOAuthScopes: string[];
|
|
21
|
+
/**
|
|
22
|
+
* The scopes a user OAuth authorization may request — the menu, not a minimum.
|
|
23
|
+
*
|
|
24
|
+
* `gmail.readonly` is here and not in {@link gmailOAuthScopes} because the two
|
|
25
|
+
* lists answer different questions. That one asks "what does a service account
|
|
26
|
+
* token need to cover every action"; `modify` subsumes `readonly` there, so
|
|
27
|
+
* adding it would be redundant at best and, through domain-wide delegation,
|
|
28
|
+
* breaking at worst.
|
|
29
|
+
*
|
|
30
|
+
* This one is what `filterDeclaredScopes` intersects a caller's
|
|
31
|
+
* `requestedScopes` against, so a scope absent here cannot be requested AT ALL.
|
|
32
|
+
* Leaving `readonly` out therefore forced every read-only integration to
|
|
33
|
+
* authorize `gmail.modify` — write, label and trash on the user's mailbox — in
|
|
34
|
+
* order to call actions that declare `gmailReadScopes`. That is the opposite of
|
|
35
|
+
* least privilege, and it is invisible: consent succeeds, so nothing reports
|
|
36
|
+
* that more was granted than the integration can use.
|
|
37
|
+
*
|
|
38
|
+
* Note for anyone storing a client config WITHOUT `requestedScopes`:
|
|
39
|
+
* `getEffectiveScopes` falls back to this whole list, so such a config now asks
|
|
40
|
+
* for four scopes rather than three. `readonly` is subsumed by `modify`, so no
|
|
41
|
+
* new capability is granted — but the consent screen gains a line, and a
|
|
42
|
+
* deployment that wants the narrow set should say so explicitly with
|
|
43
|
+
* `requestedScopes`, which is the correct posture regardless.
|
|
44
|
+
*/
|
|
45
|
+
export declare const gmailAuthorizableScopes: string[];
|
|
@@ -10,4 +10,41 @@ export const gmailComposeScopes = [gmailComposeScope];
|
|
|
10
10
|
export const gmailSendScopes = [gmailSendScope];
|
|
11
11
|
export const gmailLabelScopes = [gmailLabelsScope];
|
|
12
12
|
export const gmailSettingsBasicScopes = [gmailSettingsBasicScope];
|
|
13
|
+
/**
|
|
14
|
+
* The scopes a SERVICE ACCOUNT token is minted for, and the ones the proxy
|
|
15
|
+
* resolves with. Unchanged: a domain-wide-delegation grant lists these exact
|
|
16
|
+
* scopes in the Workspace admin console, and a token request naming a scope the
|
|
17
|
+
* admin has not authorized fails outright — so this list cannot grow without
|
|
18
|
+
* breaking every existing service-account connection.
|
|
19
|
+
*/
|
|
13
20
|
export const gmailOAuthScopes = [gmailModifyScope, gmailLabelsScope, gmailSettingsBasicScope];
|
|
21
|
+
/**
|
|
22
|
+
* The scopes a user OAuth authorization may request — the menu, not a minimum.
|
|
23
|
+
*
|
|
24
|
+
* `gmail.readonly` is here and not in {@link gmailOAuthScopes} because the two
|
|
25
|
+
* lists answer different questions. That one asks "what does a service account
|
|
26
|
+
* token need to cover every action"; `modify` subsumes `readonly` there, so
|
|
27
|
+
* adding it would be redundant at best and, through domain-wide delegation,
|
|
28
|
+
* breaking at worst.
|
|
29
|
+
*
|
|
30
|
+
* This one is what `filterDeclaredScopes` intersects a caller's
|
|
31
|
+
* `requestedScopes` against, so a scope absent here cannot be requested AT ALL.
|
|
32
|
+
* Leaving `readonly` out therefore forced every read-only integration to
|
|
33
|
+
* authorize `gmail.modify` — write, label and trash on the user's mailbox — in
|
|
34
|
+
* order to call actions that declare `gmailReadScopes`. That is the opposite of
|
|
35
|
+
* least privilege, and it is invisible: consent succeeds, so nothing reports
|
|
36
|
+
* that more was granted than the integration can use.
|
|
37
|
+
*
|
|
38
|
+
* Note for anyone storing a client config WITHOUT `requestedScopes`:
|
|
39
|
+
* `getEffectiveScopes` falls back to this whole list, so such a config now asks
|
|
40
|
+
* for four scopes rather than three. `readonly` is subsumed by `modify`, so no
|
|
41
|
+
* new capability is granted — but the consent screen gains a line, and a
|
|
42
|
+
* deployment that wants the narrow set should say so explicitly with
|
|
43
|
+
* `requestedScopes`, which is the correct posture regardless.
|
|
44
|
+
*/
|
|
45
|
+
export const gmailAuthorizableScopes = [
|
|
46
|
+
gmailReadonlyScope,
|
|
47
|
+
gmailModifyScope,
|
|
48
|
+
gmailLabelsScope,
|
|
49
|
+
gmailSettingsBasicScope,
|
|
50
|
+
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compactObject, objectArray, optionalBooleanOrNull, optionalIntegerOrNull, optionalObjectArray, optionalRecord as asOptionalObject, optionalScalarString, optionalString as optionalNonEmptyString, optionalStringOrNull, requiredRecord, } from "../../core/cast.js";
|
|
2
|
-
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator } from "../
|
|
3
|
-
import { googleJsonRequest } from "../
|
|
2
|
+
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator, } from "../googledrive/runtime-auth.js";
|
|
3
|
+
import { googleJsonRequest } from "../googledrive/runtime-request.js";
|
|
4
4
|
import { defineProviderProxy, ProviderRequestError } from "../provider-runtime.js";
|
|
5
5
|
import { googleAnalyticsOAuthScopes } from "./scopes.js";
|
|
6
6
|
const service = "google_analytics";
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { googleIdentityScopes } from "../googleads/scopes.js";
|
|
1
2
|
export const googleAnalyticsReadonlyScope = "https://www.googleapis.com/auth/analytics.readonly";
|
|
2
3
|
export const googleAnalyticsEditScope = "https://www.googleapis.com/auth/analytics.edit";
|
|
3
4
|
export const googleAnalyticsReadScopes = [googleAnalyticsReadonlyScope];
|
|
4
5
|
export const googleAnalyticsWriteScopes = [googleAnalyticsEditScope];
|
|
5
|
-
export const googleAnalyticsOAuthScopes = [
|
|
6
|
+
export const googleAnalyticsOAuthScopes = [
|
|
7
|
+
googleAnalyticsReadonlyScope,
|
|
8
|
+
googleAnalyticsEditScope,
|
|
9
|
+
...googleIdentityScopes,
|
|
10
|
+
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { booleanString, compactObject, optionalBoolean, optionalInteger as asOptionalInteger, requiredRecord, } from "../../core/cast.js";
|
|
2
|
-
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator } from "../
|
|
3
|
-
import { googleJsonRequest, googleRequest } from "../
|
|
2
|
+
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator, } from "../googledrive/runtime-auth.js";
|
|
3
|
+
import { googleJsonRequest, googleRequest } from "../googledrive/runtime-request.js";
|
|
4
4
|
import { defineProviderProxy, ProviderRequestError } from "../provider-runtime.js";
|
|
5
5
|
import { googleBigQueryOAuthScopes } from "./scopes.js";
|
|
6
6
|
const bigQueryApiBaseUrl = "https://bigquery.googleapis.com/bigquery/v2";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { googleIdentityScopes } from "../googleads/scopes.js";
|
|
1
2
|
export const bigQueryScope = "https://www.googleapis.com/auth/bigquery";
|
|
2
3
|
export const bigQueryReadOnlyScope = "https://www.googleapis.com/auth/bigquery.readonly";
|
|
3
4
|
export const bigQueryInsertDataScope = "https://www.googleapis.com/auth/bigquery.insertdata";
|
|
@@ -14,4 +15,5 @@ export const googleBigQueryOAuthScopes = [
|
|
|
14
15
|
bigQueryInsertDataScope,
|
|
15
16
|
devStorageReadOnlyScope,
|
|
16
17
|
devStorageReadWriteScope,
|
|
18
|
+
...googleIdentityScopes,
|
|
17
19
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compactObject, optionalNumber, optionalRecord as asOptionalObject, optionalString as asOptionalString, pickOptionalInteger, pickOptionalString as pickNonEmptyString, } from "../../core/cast.js";
|
|
2
|
-
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator } from "../
|
|
3
|
-
import { googleJsonRequest, googleRequest } from "../
|
|
2
|
+
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator, } from "../googledrive/runtime-auth.js";
|
|
3
|
+
import { googleJsonRequest, googleRequest } from "../googledrive/runtime-request.js";
|
|
4
4
|
import { defineProviderProxy, ProviderRequestError } from "../provider-runtime.js";
|
|
5
5
|
import { googleSearchConsoleOAuthScopes } from "./scopes.js";
|
|
6
6
|
const service = "google_search_console";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { googleIdentityScopes } from "../googleads/scopes.js";
|
|
1
2
|
export const googleSearchConsoleReadonlyScope = "https://www.googleapis.com/auth/webmasters.readonly";
|
|
2
3
|
export const googleSearchConsoleFullScope = "https://www.googleapis.com/auth/webmasters";
|
|
3
4
|
export const googleSearchConsoleReadScopes = [googleSearchConsoleReadonlyScope];
|
|
@@ -5,4 +6,5 @@ export const googleSearchConsoleWriteScopes = [googleSearchConsoleFullScope];
|
|
|
5
6
|
export const googleSearchConsoleOAuthScopes = [
|
|
6
7
|
googleSearchConsoleReadonlyScope,
|
|
7
8
|
googleSearchConsoleFullScope,
|
|
9
|
+
...googleIdentityScopes,
|
|
8
10
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { compactObject, objectArray, optionalBoolean, optionalRecord, optionalScalarString, optionalString, } from "../../core/cast.js";
|
|
3
|
-
import { googleJsonRequest, googleRequest } from "../
|
|
3
|
+
import { googleJsonRequest, googleRequest } from "../googledrive/runtime-request.js";
|
|
4
4
|
import { defineProviderExecutors, defineProviderProxy, ProviderRequestError, requireOAuthCredential, requiredInputString, } from "../provider-runtime.js";
|
|
5
5
|
import { googleAdsScope } from "./scopes.js";
|
|
6
6
|
export const googleAdsApiBaseUrl = "https://googleads.googleapis.com/v22";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export declare const googleAdsScope = "https://www.googleapis.com/auth/adwords";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const googleEmailScope = "email";
|
|
4
|
-
export declare const googleProfileScope = "profile";
|
|
2
|
+
export declare const googleIdentityScopes: string[];
|
|
5
3
|
export declare const googleAdsOAuthScopes: string[];
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export const googleAdsScope = "https://www.googleapis.com/auth/adwords";
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
4
|
-
export const googleProfileScope = "profile";
|
|
5
|
-
export const googleAdsOAuthScopes = [googleAdsScope, googleOpenIdScope, googleEmailScope, googleProfileScope];
|
|
2
|
+
export const googleIdentityScopes = ["openid", "email", "profile"];
|
|
3
|
+
export const googleAdsOAuthScopes = [googleAdsScope, ...googleIdentityScopes];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compactObject, optionalString, pickOptionalBoolean, pickOptionalInteger, pickOptionalString, requiredRecord, } from "../../core/cast.js";
|
|
2
|
-
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator } from "../
|
|
2
|
+
import { defineGoogleProviderExecutors, googleBearerProxyAuth, googleServiceAccountValidator, } from "../googledrive/runtime-auth.js";
|
|
3
3
|
import { combineProviderActionHandlers, defineProviderProxy, ProviderRequestError } from "../provider-runtime.js";
|
|
4
4
|
import { googlecalendarEventActionHandlers } from "./runtime-events.js";
|
|
5
5
|
import { googlecalendarApiBaseUrl, googlecalendarJsonRequest, googlecalendarRequest, resolveCalendarId, resolveRuleId, resolveSettingId, } from "./runtime-shared.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { optionalRecord, optionalString as asOptionalString, pickOptionalString } from "../../core/cast.js";
|
|
2
|
-
import { providerUserAgent, ProviderRequestError } from "../provider-runtime.js";
|
|
2
|
+
import { providerUserAgent, ProviderRequestError, withRetryAfterSeconds } from "../provider-runtime.js";
|
|
3
3
|
export const googlecalendarApiBaseUrl = "https://www.googleapis.com/calendar/v3";
|
|
4
4
|
const service = "googlecalendar";
|
|
5
5
|
const googleDefaultRequestTimeoutMs = 30_000;
|
|
@@ -142,7 +142,7 @@ async function assertGoogleResponse(response) {
|
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
const { message, details } = await extractGoogleError(response);
|
|
145
|
-
throw new ProviderRequestError(response.status, message, details);
|
|
145
|
+
throw new ProviderRequestError(response.status, message, withRetryAfterSeconds(response, details));
|
|
146
146
|
}
|
|
147
147
|
async function extractGoogleError(response) {
|
|
148
148
|
const rawText = await response.text().catch(() => "");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { googleIdentityScopes } from "../googleads/scopes.js";
|
|
1
2
|
export const googleCalendarReadonlyScope = "https://www.googleapis.com/auth/calendar.readonly";
|
|
2
3
|
export const googleCalendarEventsScope = "https://www.googleapis.com/auth/calendar.events";
|
|
3
4
|
export const googleCalendarCalendarsScope = "https://www.googleapis.com/auth/calendar.calendars";
|
|
@@ -22,4 +23,5 @@ export const googlecalendarOAuthScopes = [
|
|
|
22
23
|
googleCalendarSettingsReadonlyScope,
|
|
23
24
|
googleCalendarAclsScope,
|
|
24
25
|
googleCalendarAclsReadonlyScope,
|
|
26
|
+
...googleIdentityScopes,
|
|
25
27
|
];
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { CredentialValidators, ProviderExecutors, ProviderProxyExecutor } from "../../core/types.ts";
|
|
2
2
|
import type { ProviderActionHandlers } from "../provider-runtime.ts";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const googleChatApiBaseUrl = "https://chat.googleapis.com/v1";
|
|
5
|
-
type GoogleChatRuntimeContext = OAuthProviderContext;
|
|
3
|
+
import type { GoogleChatRuntimeContext } from "./runtime.ts";
|
|
6
4
|
type GoogleChatActionHandler = (input: Record<string, unknown>, context: GoogleChatRuntimeContext) => Promise<unknown>;
|
|
7
5
|
export declare const googleChatActionHandlers: ProviderActionHandlers<"googlechat", GoogleChatActionHandler>;
|
|
8
6
|
export declare const executors: ProviderExecutors;
|