@oomol-lab/open-connector 1.9.0 → 1.9.1
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/agentearth.json +441 -0
- package/assets/open-connector/catalog/apps/appgrowing_mcp.json +863 -0
- package/assets/open-connector/catalog/apps/arcmira.json +610 -0
- package/assets/open-connector/catalog/apps/bainiu.json +654 -0
- package/assets/open-connector/catalog/apps/chaport.json +331 -0
- package/assets/open-connector/catalog/apps/cnb.json +1408 -0
- package/assets/open-connector/catalog/apps/crtsh.json +123 -0
- package/assets/open-connector/catalog/apps/eastmoney_miaoxiang.json +406 -0
- package/assets/open-connector/catalog/apps/fastmoss_mcp.json +876 -876
- package/assets/open-connector/catalog/apps/ftshare.json +1162 -0
- package/assets/open-connector/catalog/apps/fusion-api.json +143 -0
- package/assets/open-connector/catalog/apps/fxbaogao.json +308 -0
- package/assets/open-connector/catalog/apps/github.json +38 -3
- package/assets/open-connector/catalog/apps/hrmos_kintai.json +7519 -0
- package/assets/open-connector/catalog/apps/humor_api.json +351 -0
- package/assets/open-connector/catalog/apps/kaonavi.json +1723 -0
- package/assets/open-connector/catalog/apps/linear_mcp.json +882 -22
- package/assets/open-connector/catalog/apps/listinggood.json +362 -0
- package/assets/open-connector/catalog/apps/notion_mcp.json +338 -1
- package/assets/open-connector/catalog/apps/outlook.json +414 -0
- package/assets/open-connector/catalog/apps/porteden.json +1258 -0
- package/assets/open-connector/catalog/apps/qiuxiaoce.json +915 -0
- package/assets/open-connector/catalog/apps/qqmusic.json +1834 -0
- package/assets/open-connector/catalog/apps/rakuraku_seisan.json +217 -0
- package/assets/open-connector/catalog/apps/redfox.json +9661 -897
- package/assets/open-connector/catalog/apps/salesforce.json +4907 -0
- package/assets/open-connector/catalog/apps/sansan.json +4594 -0
- package/assets/open-connector/catalog/apps/smarthr.json +8071 -0
- package/assets/open-connector/catalog/apps/smooth.json +914 -0
- package/assets/open-connector/catalog/apps/tapd.json +727 -0
- package/assets/open-connector/catalog/apps/tencent_meeting_mcp.json +1301 -0
- package/assets/open-connector/catalog/apps/threatfox.json +203 -0
- package/assets/open-connector/catalog/apps/tradebee.json +915 -0
- package/assets/open-connector/catalog/apps/twittrapi.json +4914 -0
- package/assets/open-connector/catalog/apps/urlhaus.json +246 -0
- package/assets/open-connector/catalog/apps/weread.json +1514 -0
- package/assets/open-connector/catalog/apps/whatsapp.json +12 -0
- package/assets/open-connector/catalog/apps/zhiliaobiaoxun.json +812 -0
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/package.json +2 -1
- package/src/connection-service.js +55 -11
- package/src/core/provider-error-codes.d.ts +9 -0
- package/src/core/provider-error-codes.js +13 -0
- package/src/core/request.d.ts +2 -0
- package/src/core/request.js +11 -2
- package/src/mail/imap-smtp/protocol.js +4 -3
- package/src/oauth/oauth-flow-service.js +1 -0
- package/src/oauth/oauth-token.d.ts +2 -0
- package/src/providers/17track/runtime.js +17 -20
- package/src/providers/action-contracts.generated.d.ts +36 -6
- package/src/providers/agentearth/actions.d.ts +2 -0
- package/src/providers/agentearth/actions.js +100 -0
- package/src/providers/agentearth/executors.d.ts +4 -0
- package/src/providers/agentearth/executors.js +109 -0
- package/src/providers/appgrowing_mcp/actions.d.ts +2 -0
- package/src/providers/appgrowing_mcp/actions.js +175 -0
- package/src/providers/appgrowing_mcp/executors.d.ts +4 -0
- package/src/providers/appgrowing_mcp/executors.js +66 -0
- package/src/providers/arcmira/executors.d.ts +3 -0
- package/src/providers/arcmira/executors.js +8 -0
- package/src/providers/arcmira/runtime.d.ts +6 -0
- package/src/providers/arcmira/runtime.js +41 -0
- package/src/providers/bainiu/actions.d.ts +2 -0
- package/src/providers/bainiu/actions.js +108 -0
- package/src/providers/bainiu/executors.d.ts +4 -0
- package/src/providers/bainiu/executors.js +113 -0
- package/src/providers/baixiao/executors.js +1 -1
- package/src/providers/bing_webmaster/executors.js +1 -1
- package/src/providers/chaport/actions.d.ts +2 -0
- package/src/providers/chaport/actions.js +70 -0
- package/src/providers/chaport/executors.d.ts +4 -0
- package/src/providers/chaport/executors.js +128 -0
- package/src/providers/clickup/runtime.js +49 -52
- package/src/providers/cnb/actions.d.ts +2 -0
- package/src/providers/cnb/actions.js +341 -0
- package/src/providers/cnb/executors.d.ts +4 -0
- package/src/providers/cnb/executors.js +135 -0
- package/src/providers/coupontools/runtime.js +11 -14
- package/src/providers/crtsh/executors.d.ts +3 -0
- package/src/providers/crtsh/executors.js +19 -0
- package/src/providers/crtsh/runtime.d.ts +17 -0
- package/src/providers/crtsh/runtime.js +84 -0
- package/src/providers/eastmoney_miaoxiang/actions.d.ts +2 -0
- package/src/providers/eastmoney_miaoxiang/actions.js +95 -0
- package/src/providers/eastmoney_miaoxiang/executors.d.ts +4 -0
- package/src/providers/eastmoney_miaoxiang/executors.js +81 -0
- package/src/providers/fastmoss_mcp/actions-content.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-content.js +140 -0
- package/src/providers/fastmoss_mcp/actions-creator.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-creator.js +154 -0
- package/src/providers/fastmoss_mcp/actions-product.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-product.js +167 -0
- package/src/providers/fastmoss_mcp/actions-research.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-research.js +174 -0
- package/src/providers/fastmoss_mcp/actions-shop.d.ts +2 -0
- package/src/providers/fastmoss_mcp/actions-shop.js +142 -0
- package/src/providers/fastmoss_mcp/actions.js +11 -12
- package/src/providers/fastmoss_mcp/schemas.d.ts +51 -0
- package/src/providers/fastmoss_mcp/schemas.js +52 -0
- package/src/providers/ftshare/actions.d.ts +2 -0
- package/src/providers/ftshare/actions.js +124 -0
- package/src/providers/ftshare/executors.d.ts +4 -0
- package/src/providers/ftshare/executors.js +102 -0
- package/src/providers/fusion-api/operations.js +37 -0
- package/src/providers/fxbaogao/actions.d.ts +2 -0
- package/src/providers/fxbaogao/actions.js +74 -0
- package/src/providers/fxbaogao/executors.d.ts +4 -0
- package/src/providers/fxbaogao/executors.js +155 -0
- package/src/providers/github/app-installation.d.ts +37 -0
- package/src/providers/github/app-installation.js +233 -0
- package/src/providers/github/executors.js +93 -15
- package/src/providers/github/runtime-repository.js +21 -1
- package/src/providers/github/runtime-shared.d.ts +2 -0
- package/src/providers/github/runtime-shared.js +1 -0
- package/src/providers/googledrive/runtime-request.js +3 -3
- package/src/providers/hrmos_kintai/actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/actions.js +139 -0
- package/src/providers/hrmos_kintai/attendance-actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/attendance-actions.js +276 -0
- package/src/providers/hrmos_kintai/business-actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/business-actions.js +143 -0
- package/src/providers/hrmos_kintai/business-schemas.d.ts +4 -0
- package/src/providers/hrmos_kintai/business-schemas.js +320 -0
- package/src/providers/hrmos_kintai/executors.d.ts +4 -0
- package/src/providers/hrmos_kintai/executors.js +61 -0
- package/src/providers/hrmos_kintai/export-actions.d.ts +2 -0
- package/src/providers/hrmos_kintai/export-actions.js +58 -0
- package/src/providers/hrmos_kintai/operations.d.ts +9 -0
- package/src/providers/hrmos_kintai/operations.js +278 -0
- package/src/providers/hrmos_kintai/runtime.d.ts +10 -0
- package/src/providers/hrmos_kintai/runtime.js +217 -0
- package/src/providers/hrmos_kintai/schemas.d.ts +10 -0
- package/src/providers/hrmos_kintai/schemas.js +70 -0
- package/src/providers/humor_api/actions.d.ts +2 -0
- package/src/providers/humor_api/actions.js +96 -0
- package/src/providers/humor_api/executors.d.ts +4 -0
- package/src/providers/humor_api/executors.js +76 -0
- package/src/providers/kaonavi/actions.d.ts +4 -0
- package/src/providers/kaonavi/actions.js +144 -0
- package/src/providers/kaonavi/additional-actions.d.ts +10 -0
- package/src/providers/kaonavi/additional-actions.js +203 -0
- package/src/providers/kaonavi/executors.d.ts +4 -0
- package/src/providers/kaonavi/executors.js +69 -0
- package/src/providers/kaonavi/runtime.d.ts +4 -0
- package/src/providers/kaonavi/runtime.js +69 -0
- package/src/providers/linear_mcp/actions.d.ts +14 -0
- package/src/providers/linear_mcp/actions.js +134 -0
- package/src/providers/linear_mcp/runtime-mcp.d.ts +7 -1
- package/src/providers/linear_mcp/runtime-mcp.js +140 -28
- package/src/providers/linkfox/runtime.js +48 -51
- package/src/providers/listinggood/actions.d.ts +2 -0
- package/src/providers/listinggood/actions.js +95 -0
- package/src/providers/listinggood/executors.d.ts +4 -0
- package/src/providers/listinggood/executors.js +99 -0
- package/src/providers/mcp-tools.d.ts +3 -0
- package/src/providers/mcp-tools.js +5 -4
- package/src/providers/notion_mcp/executors.js +53 -24
- package/src/providers/notion_mcp/mcp-response.d.ts +26 -0
- package/src/providers/notion_mcp/mcp-response.js +95 -0
- package/src/providers/omise/executors.js +1 -1
- package/src/providers/outlook/executors.js +35 -2
- package/src/providers/porteden/actions.d.ts +2 -0
- package/src/providers/porteden/actions.js +162 -0
- package/src/providers/porteden/executors.d.ts +4 -0
- package/src/providers/porteden/executors.js +140 -0
- package/src/providers/provider-runtime.d.ts +3 -2
- package/src/providers/pushover/runtime.js +28 -31
- package/src/providers/qianfan/runtime.js +16 -19
- package/src/providers/qiuxiaoce/actions.d.ts +2 -0
- package/src/providers/qiuxiaoce/actions.js +248 -0
- package/src/providers/qiuxiaoce/executors.d.ts +4 -0
- package/src/providers/qiuxiaoce/executors.js +76 -0
- package/src/providers/qiuxiaoce/routes.d.ts +1 -0
- package/src/providers/qiuxiaoce/routes.js +20 -0
- package/src/providers/qqmusic/actions.d.ts +2 -0
- package/src/providers/qqmusic/actions.js +229 -0
- package/src/providers/qqmusic/executors.d.ts +4 -0
- package/src/providers/qqmusic/executors.js +92 -0
- package/src/providers/qqmusic/report-schema.d.ts +4 -0
- package/src/providers/qqmusic/report-schema.js +119 -0
- package/src/providers/rakuraku_seisan/actions.d.ts +2 -0
- package/src/providers/rakuraku_seisan/actions.js +50 -0
- package/src/providers/rakuraku_seisan/executors.d.ts +4 -0
- package/src/providers/rakuraku_seisan/executors.js +40 -0
- package/src/providers/rakuraku_seisan/runtime.d.ts +8 -0
- package/src/providers/rakuraku_seisan/runtime.js +251 -0
- package/src/providers/redfox/actions-account.d.ts +2 -0
- package/src/providers/redfox/actions-account.js +24 -0
- package/src/providers/redfox/actions-autohome.d.ts +2 -0
- package/src/providers/redfox/actions-autohome.js +51 -0
- package/src/providers/redfox/actions-baijiahao.d.ts +2 -0
- package/src/providers/redfox/actions-baijiahao.js +58 -0
- package/src/providers/redfox/actions-bilibili.d.ts +2 -0
- package/src/providers/redfox/actions-bilibili.js +67 -0
- package/src/providers/redfox/actions-dongchedi.d.ts +2 -0
- package/src/providers/redfox/actions-dongchedi.js +49 -0
- package/src/providers/redfox/actions-douyin.d.ts +2 -0
- package/src/providers/redfox/actions-douyin.js +297 -0
- package/src/providers/redfox/actions-generation.d.ts +2 -0
- package/src/providers/redfox/actions-generation.js +293 -0
- package/src/providers/redfox/actions-instagram.d.ts +2 -0
- package/src/providers/redfox/actions-instagram.js +49 -0
- package/src/providers/redfox/actions-kuaishou.d.ts +2 -0
- package/src/providers/redfox/actions-kuaishou.js +53 -0
- package/src/providers/redfox/actions-search.d.ts +2 -0
- package/src/providers/redfox/actions-search.js +125 -0
- package/src/providers/redfox/actions-tiktok.d.ts +2 -0
- package/src/providers/redfox/actions-tiktok.js +136 -0
- package/src/providers/redfox/actions-tools.d.ts +2 -0
- package/src/providers/redfox/actions-tools.js +151 -0
- package/src/providers/redfox/actions-toutiao.d.ts +2 -0
- package/src/providers/redfox/actions-toutiao.js +68 -0
- package/src/providers/redfox/actions-transcription.d.ts +2 -0
- package/src/providers/redfox/actions-transcription.js +165 -0
- package/src/providers/redfox/actions-wechat-channel.d.ts +2 -0
- package/src/providers/redfox/actions-wechat-channel.js +63 -0
- package/src/providers/redfox/actions-wechat.d.ts +2 -0
- package/src/providers/redfox/actions-wechat.js +302 -0
- package/src/providers/redfox/actions-weibo.d.ts +2 -0
- package/src/providers/redfox/actions-weibo.js +61 -0
- package/src/providers/redfox/actions-x.d.ts +2 -0
- package/src/providers/redfox/actions-x.js +126 -0
- package/src/providers/redfox/actions-xiaohongshu.d.ts +2 -0
- package/src/providers/redfox/actions-xiaohongshu.js +244 -0
- package/src/providers/redfox/actions-yiche.d.ts +2 -0
- package/src/providers/redfox/actions-yiche.js +59 -0
- package/src/providers/redfox/actions-youtube.d.ts +2 -0
- package/src/providers/redfox/actions-youtube.js +64 -0
- package/src/providers/redfox/actions-zhihu.d.ts +2 -0
- package/src/providers/redfox/actions-zhihu.js +26 -0
- package/src/providers/redfox/actions.d.ts +2 -0
- package/src/providers/redfox/actions.js +49 -0
- package/src/providers/redfox/executors.d.ts +2 -14
- package/src/providers/redfox/executors.js +28 -551
- package/src/providers/redfox/routes.d.ts +11 -0
- package/src/providers/redfox/routes.js +329 -0
- package/src/providers/redfox/runtime.d.ts +6 -0
- package/src/providers/redfox/runtime.js +151 -0
- package/src/providers/redfox/schemas.d.ts +9 -0
- package/src/providers/redfox/schemas.js +40 -0
- package/src/providers/registry.generated.js +30 -0
- package/src/providers/salesforce/context.d.ts +16 -0
- package/src/providers/salesforce/context.js +58 -0
- package/src/providers/salesforce/executors.d.ts +5 -0
- package/src/providers/salesforce/executors.js +54 -0
- package/src/providers/salesforce/media.d.ts +9 -0
- package/src/providers/salesforce/media.js +66 -0
- package/src/providers/salesforce/oauth.d.ts +2 -0
- package/src/providers/salesforce/oauth.js +89 -0
- package/src/providers/salesforce/runtime-analytics.d.ts +2 -0
- package/src/providers/salesforce/runtime-analytics.js +60 -0
- package/src/providers/salesforce/runtime-automation.d.ts +2 -0
- package/src/providers/salesforce/runtime-automation.js +64 -0
- package/src/providers/salesforce/runtime-base.d.ts +2 -0
- package/src/providers/salesforce/runtime-base.js +51 -0
- package/src/providers/salesforce/runtime-bulk.d.ts +2 -0
- package/src/providers/salesforce/runtime-bulk.js +98 -0
- package/src/providers/salesforce/runtime-data.d.ts +2 -0
- package/src/providers/salesforce/runtime-data.js +207 -0
- package/src/providers/salesforce/runtime-files.d.ts +2 -0
- package/src/providers/salesforce/runtime-files.js +108 -0
- package/src/providers/salesforce/transport.d.ts +9 -0
- package/src/providers/salesforce/transport.js +65 -0
- package/src/providers/sansan/actions.d.ts +2 -0
- package/src/providers/sansan/actions.js +165 -0
- package/src/providers/sansan/admin-actions.d.ts +2 -0
- package/src/providers/sansan/admin-actions.js +181 -0
- package/src/providers/sansan/admin.d.ts +2 -0
- package/src/providers/sansan/admin.js +42 -0
- package/src/providers/sansan/business-actions.d.ts +2 -0
- package/src/providers/sansan/business-actions.js +160 -0
- package/src/providers/sansan/business.d.ts +2 -0
- package/src/providers/sansan/business.js +51 -0
- package/src/providers/sansan/executors.d.ts +4 -0
- package/src/providers/sansan/executors.js +59 -0
- package/src/providers/sansan/file-schema.d.ts +2 -0
- package/src/providers/sansan/file-schema.js +8 -0
- package/src/providers/sansan/files.d.ts +11 -0
- package/src/providers/sansan/files.js +49 -0
- package/src/providers/sansan/organization-actions.d.ts +2 -0
- package/src/providers/sansan/organization-actions.js +198 -0
- package/src/providers/sansan/organization-columns.d.ts +2 -0
- package/src/providers/sansan/organization-columns.js +33 -0
- package/src/providers/sansan/organization.d.ts +2 -0
- package/src/providers/sansan/organization.js +88 -0
- package/src/providers/sansan/read.d.ts +2 -0
- package/src/providers/sansan/read.js +25 -0
- package/src/providers/sansan/request.d.ts +22 -0
- package/src/providers/sansan/request.js +94 -0
- package/src/providers/sansan/schemas.d.ts +7 -0
- package/src/providers/sansan/schemas.js +72 -0
- package/src/providers/shopee/runtime.d.ts +33 -29
- package/src/providers/shopee/runtime.js +166 -169
- package/src/providers/smarthr/actions.d.ts +2 -0
- package/src/providers/smarthr/actions.js +286 -0
- package/src/providers/smarthr/employee-runtime.d.ts +1 -0
- package/src/providers/smarthr/employee-runtime.js +63 -0
- package/src/providers/smarthr/employee-schema.d.ts +3 -0
- package/src/providers/smarthr/employee-schema.js +222 -0
- package/src/providers/smarthr/executors.d.ts +4 -0
- package/src/providers/smarthr/executors.js +35 -0
- package/src/providers/smarthr/pagination.d.ts +1 -0
- package/src/providers/smarthr/pagination.js +84 -0
- package/src/providers/smarthr/resource-routes.d.ts +16 -0
- package/src/providers/smarthr/resource-routes.js +163 -0
- package/src/providers/smarthr/runtime.d.ts +13 -0
- package/src/providers/smarthr/runtime.js +242 -0
- package/src/providers/smarthr/supplemental-actions.d.ts +2 -0
- package/src/providers/smarthr/supplemental-actions.js +541 -0
- package/src/providers/smooth/actions.d.ts +2 -0
- package/src/providers/smooth/actions.js +138 -0
- package/src/providers/smooth/executors.d.ts +4 -0
- package/src/providers/smooth/executors.js +102 -0
- package/src/providers/tapd/actions.d.ts +8 -0
- package/src/providers/tapd/actions.js +89 -0
- package/src/providers/tapd/executors.d.ts +4 -0
- package/src/providers/tapd/executors.js +137 -0
- package/src/providers/teable/runtime.js +12 -15
- package/src/providers/tencent_meeting_mcp/actions.d.ts +2 -0
- package/src/providers/tencent_meeting_mcp/actions.js +420 -0
- package/src/providers/tencent_meeting_mcp/executors.d.ts +4 -0
- package/src/providers/tencent_meeting_mcp/executors.js +117 -0
- package/src/providers/threatfox/executors.d.ts +4 -0
- package/src/providers/threatfox/executors.js +40 -0
- package/src/providers/threatfox/runtime.d.ts +15 -0
- package/src/providers/threatfox/runtime.js +128 -0
- package/src/providers/ticket_tailor/runtime.js +1 -1
- package/src/providers/ticketmaster/runtime.js +3 -6
- package/src/providers/timelinesai/runtime.js +13 -16
- package/src/providers/tradebee/actions.d.ts +2 -0
- package/src/providers/tradebee/actions.js +176 -0
- package/src/providers/tradebee/executors.d.ts +4 -0
- package/src/providers/tradebee/executors.js +83 -0
- package/src/providers/twittrapi/executors.d.ts +4 -0
- package/src/providers/twittrapi/executors.js +17 -0
- package/src/providers/twittrapi/runtime.d.ts +12 -0
- package/src/providers/twittrapi/runtime.js +203 -0
- package/src/providers/urlhaus/executors.d.ts +4 -0
- package/src/providers/urlhaus/executors.js +40 -0
- package/src/providers/urlhaus/runtime.d.ts +15 -0
- package/src/providers/urlhaus/runtime.js +142 -0
- package/src/providers/wangdian/runtime.js +16 -19
- package/src/providers/weread/actions.d.ts +2 -0
- package/src/providers/weread/actions.js +424 -0
- package/src/providers/weread/executors.d.ts +4 -0
- package/src/providers/weread/executors.js +98 -0
- package/src/providers/whatsapp/runtime.js +6 -1
- package/src/providers/workast/runtime.js +12 -17
- package/src/providers/youzan/runtime.js +21 -24
- package/src/providers/zenkit/runtime.js +13 -19
- package/src/providers/zhiliaobiaoxun/actions.d.ts +2 -0
- package/src/providers/zhiliaobiaoxun/actions.js +138 -0
- package/src/providers/zhiliaobiaoxun/executors.d.ts +4 -0
- package/src/providers/zhiliaobiaoxun/executors.js +78 -0
- package/src/server/api/auth.d.ts +2 -0
- package/src/server/api/auth.js +2 -1
- package/src/server/api/console-catalog-routes.d.ts +17 -0
- package/src/server/api/console-catalog-routes.js +88 -0
- package/src/server/api/console-oauth-routes.d.ts +18 -0
- package/src/server/api/console-oauth-routes.js +298 -0
- package/src/server/api/docs-routes.d.ts +12 -0
- package/src/server/api/docs-routes.js +38 -0
- package/src/server/api/http-utils.d.ts +1 -0
- package/src/server/api/http-utils.js +8 -0
- package/src/server/api/marketplace-routes.d.ts +7 -0
- package/src/server/api/marketplace-routes.js +62 -0
- package/src/server/api/mcp-routes.d.ts +18 -0
- package/src/server/api/mcp-routes.js +37 -0
- package/src/server/api/policy-routes.d.ts +13 -0
- package/src/server/api/policy-routes.js +50 -0
- package/src/server/api/policy-snapshot.d.ts +14 -0
- package/src/server/api/policy-snapshot.js +30 -0
- package/src/server/api/run-log-routes.d.ts +7 -0
- package/src/server/api/run-log-routes.js +70 -0
- package/src/server/api/runtime-api.d.ts +0 -7
- package/src/server/api/runtime-api.js +0 -13
- package/src/server/api/runtime-app-routes.d.ts +10 -0
- package/src/server/api/runtime-app-routes.js +72 -0
- package/src/server/api/runtime-catalog-routes.d.ts +37 -0
- package/src/server/api/runtime-catalog-routes.js +133 -0
- package/src/server/api/runtime-execution-routes.d.ts +16 -0
- package/src/server/api/runtime-execution-routes.js +198 -0
- package/src/server/api/saas-oauth-routes.d.ts +9 -0
- package/src/server/api/saas-oauth-routes.js +27 -0
- package/src/server/api/saas-project-routes.d.ts +7 -0
- package/src/server/api/saas-project-routes.js +16 -0
- package/src/server/api/transit-file-routes.d.ts +9 -0
- package/src/server/api/transit-file-routes.js +49 -0
- package/src/server/api/trigger-routes.d.ts +15 -0
- package/src/server/api/trigger-routes.js +48 -0
- package/src/server/connect-app.d.ts +1 -0
- package/src/server/connect-app.js +3 -1
- package/src/server/connect-server.d.ts +3 -54
- package/src/server/connect-server.js +95 -1148
- package/src/providers/fastmoss_mcp/official-tools.json +0 -2922
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { optionalString } from "../../core/cast.js";
|
|
3
|
+
import { decodeRunLogCursor } from "../storage/runtime-store.js";
|
|
4
|
+
import { jsonError } from "./http-utils.js";
|
|
5
|
+
function isRunLogCaller(value) {
|
|
6
|
+
return value === "http" || value === "mcp" || value === "web";
|
|
7
|
+
}
|
|
8
|
+
function readRunLogListInput(context) {
|
|
9
|
+
const rawLimit = optionalString(context.req.query("limit"));
|
|
10
|
+
const limit = rawLimit === undefined ? 50 : Number(rawLimit);
|
|
11
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
12
|
+
return { ok: false, message: "limit must be an integer between 1 and 100." };
|
|
13
|
+
}
|
|
14
|
+
const cursor = optionalString(context.req.query("cursor"));
|
|
15
|
+
if (cursor !== undefined) {
|
|
16
|
+
try {
|
|
17
|
+
decodeRunLogCursor(cursor);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return { ok: false, message: "cursor is invalid." };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const input = { limit };
|
|
24
|
+
if (cursor !== undefined) {
|
|
25
|
+
input.cursor = cursor;
|
|
26
|
+
}
|
|
27
|
+
const service = optionalString(context.req.query("service"));
|
|
28
|
+
if (service !== undefined) {
|
|
29
|
+
input.service = service;
|
|
30
|
+
}
|
|
31
|
+
const actionId = optionalString(context.req.query("actionId"));
|
|
32
|
+
if (actionId !== undefined) {
|
|
33
|
+
if (actionId.length > 256) {
|
|
34
|
+
return { ok: false, message: "actionId must be at most 256 characters." };
|
|
35
|
+
}
|
|
36
|
+
input.actionId = actionId;
|
|
37
|
+
}
|
|
38
|
+
const caller = optionalString(context.req.query("caller"));
|
|
39
|
+
if (caller !== undefined) {
|
|
40
|
+
if (!isRunLogCaller(caller)) {
|
|
41
|
+
return { ok: false, message: "caller must be one of http, mcp, or web." };
|
|
42
|
+
}
|
|
43
|
+
input.caller = caller;
|
|
44
|
+
}
|
|
45
|
+
const ok = optionalString(context.req.query("ok"));
|
|
46
|
+
if (ok !== undefined) {
|
|
47
|
+
if (ok !== "true" && ok !== "false") {
|
|
48
|
+
return { ok: false, message: "ok must be true or false." };
|
|
49
|
+
}
|
|
50
|
+
input.ok = ok === "true";
|
|
51
|
+
}
|
|
52
|
+
return { ok: true, input };
|
|
53
|
+
}
|
|
54
|
+
/** Action execution run log query and inspection routes. */
|
|
55
|
+
export function createRunLogRoutes({ actions }) {
|
|
56
|
+
const app = new Hono();
|
|
57
|
+
app.get("/runs", async (context) => {
|
|
58
|
+
const query = readRunLogListInput(context);
|
|
59
|
+
if (!query.ok) {
|
|
60
|
+
return jsonError(context, 400, "invalid_input", query.message);
|
|
61
|
+
}
|
|
62
|
+
return context.json(await actions.listRuns(query.input));
|
|
63
|
+
});
|
|
64
|
+
app.get("/runs/:id", async (context) => {
|
|
65
|
+
const id = context.req.param("id");
|
|
66
|
+
const run = await actions.getRun(id);
|
|
67
|
+
return run ? context.json(run) : jsonError(context, 404, "run_not_found", `Run not found: ${id}.`);
|
|
68
|
+
});
|
|
69
|
+
return app;
|
|
70
|
+
}
|
|
@@ -114,13 +114,6 @@ export declare function parseRuntimeActionHttpResult(value: unknown): RuntimeAct
|
|
|
114
114
|
*/
|
|
115
115
|
export declare function writeRuntimeActionHttpResult(context: Context, result: RuntimeActionHttpResult): Response;
|
|
116
116
|
export declare function mapConnectionErrorStatus(error: ConnectionError): 400 | 404 | 409;
|
|
117
|
-
/**
|
|
118
|
-
* The error codes a provider may put in `ProviderRequestError`'s `code`
|
|
119
|
-
* argument. Every other code `mapExecutionErrorStatus` knows is raised by the
|
|
120
|
-
* connection, policy or dispatch layer, and a provider that borrowed one would
|
|
121
|
-
* answer with a status that has nothing to do with what its upstream said.
|
|
122
|
-
*/
|
|
123
|
-
export declare const providerErrorCodes: readonly string[];
|
|
124
117
|
/** Management view adds stored account metadata without exposing credentials. */
|
|
125
118
|
export declare function serializeManagedConnection(connection: ManagedConnectionSummary): Omit<RuntimeConnectedApp, "status"> & {
|
|
126
119
|
status: ManagedConnectionSummary["status"];
|
|
@@ -166,19 +166,6 @@ export function mapConnectionErrorStatus(error) {
|
|
|
166
166
|
}
|
|
167
167
|
return 400;
|
|
168
168
|
}
|
|
169
|
-
/**
|
|
170
|
-
* The error codes a provider may put in `ProviderRequestError`'s `code`
|
|
171
|
-
* argument. Every other code `mapExecutionErrorStatus` knows is raised by the
|
|
172
|
-
* connection, policy or dispatch layer, and a provider that borrowed one would
|
|
173
|
-
* answer with a status that has nothing to do with what its upstream said.
|
|
174
|
-
*/
|
|
175
|
-
export const providerErrorCodes = [
|
|
176
|
-
"authorization_failed",
|
|
177
|
-
"insufficient_credit",
|
|
178
|
-
"invalid_input",
|
|
179
|
-
"provider_error",
|
|
180
|
-
"rate_limited",
|
|
181
|
-
];
|
|
182
169
|
function mapExecutionErrorStatus(code, details) {
|
|
183
170
|
const upstreamStatus = optionalInteger(optionalRecord(details)?.status);
|
|
184
171
|
if (upstreamStatus === 413) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConnectionService } from "../../connection-service.ts";
|
|
2
|
+
import type { ActionPolicySnapshot } from "../../core/action-policy.ts";
|
|
3
|
+
import type { Context } from "hono";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
|
+
export interface RuntimeAppRoutesOptions {
|
|
6
|
+
connections: ConnectionService;
|
|
7
|
+
getPolicySnapshot: (context: Context) => Promise<ActionPolicySnapshot>;
|
|
8
|
+
}
|
|
9
|
+
/** Connected runtime apps discovery and permission evaluation routes. */
|
|
10
|
+
export declare function createRuntimeAppRoutes({ connections, getPolicySnapshot }: RuntimeAppRoutesOptions): Hono;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { ConnectionError } from "../../connection-service.js";
|
|
3
|
+
import { mapConnectionErrorStatus, serializeRuntimeConnectedApp, writeRuntimeFailure, writeRuntimeSuccess, } from "./runtime-api.js";
|
|
4
|
+
function filterAllowedConnections(policy, connections) {
|
|
5
|
+
return connections.filter((connection) => connection.authType === "no_auth" || policy.evaluateConnection(connection.id).allowed);
|
|
6
|
+
}
|
|
7
|
+
/** Connected runtime apps discovery and permission evaluation routes. */
|
|
8
|
+
export function createRuntimeAppRoutes({ connections, getPolicySnapshot }) {
|
|
9
|
+
const app = new Hono();
|
|
10
|
+
app.get("/apps", async (context) => {
|
|
11
|
+
let policy;
|
|
12
|
+
try {
|
|
13
|
+
policy = await getPolicySnapshot(context);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return writeRuntimeFailure(context, {
|
|
17
|
+
status: 500,
|
|
18
|
+
errorCode: "internal_error",
|
|
19
|
+
message: "Runtime policy is unavailable.",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return writeRuntimeSuccess(context, filterAllowedConnections(policy, await connections.listConnections()).map(serializeRuntimeConnectedApp));
|
|
23
|
+
});
|
|
24
|
+
app.get("/apps/authenticated", async (context) => {
|
|
25
|
+
const services = context.req.queries("service") ?? [];
|
|
26
|
+
let policy;
|
|
27
|
+
try {
|
|
28
|
+
policy = await getPolicySnapshot(context);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return writeRuntimeFailure(context, {
|
|
32
|
+
status: 500,
|
|
33
|
+
errorCode: "internal_error",
|
|
34
|
+
message: "Runtime policy is unavailable.",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const authenticated = new Set(filterAllowedConnections(policy, await connections.listConnections())
|
|
38
|
+
.filter((connection) => connection.configured && connection.authType !== "no_auth")
|
|
39
|
+
.map((connection) => connection.service));
|
|
40
|
+
return writeRuntimeSuccess(context, services.filter((service) => authenticated.has(service)));
|
|
41
|
+
});
|
|
42
|
+
app.get("/apps/services/:service", async (context) => {
|
|
43
|
+
const service = context.req.param("service");
|
|
44
|
+
let policy;
|
|
45
|
+
try {
|
|
46
|
+
policy = await getPolicySnapshot(context);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return writeRuntimeFailure(context, {
|
|
50
|
+
status: 500,
|
|
51
|
+
errorCode: "internal_error",
|
|
52
|
+
message: "Runtime policy is unavailable.",
|
|
53
|
+
meta: { service },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
return writeRuntimeSuccess(context, filterAllowedConnections(policy, await connections.listConnectionsByService(service)).map(serializeRuntimeConnectedApp));
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error instanceof ConnectionError) {
|
|
61
|
+
return writeRuntimeFailure(context, {
|
|
62
|
+
status: mapConnectionErrorStatus(error),
|
|
63
|
+
errorCode: error.code,
|
|
64
|
+
message: error.message,
|
|
65
|
+
meta: { service },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return app;
|
|
72
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CatalogStore, RuntimeActionDefinition } from "../../catalog-store.ts";
|
|
2
|
+
import type { ConnectionService } from "../../connection-service.ts";
|
|
3
|
+
import type { ActionSearchDocument, ActionSearchIndexProvider } from "../../core/action-search.ts";
|
|
4
|
+
import type { OAuthClientConfigService } from "../../oauth/oauth-client-config-service.ts";
|
|
5
|
+
import type { SaasProjectService } from "../../saas/saas-project-service.ts";
|
|
6
|
+
import type { Context } from "hono";
|
|
7
|
+
import { Hono } from "hono";
|
|
8
|
+
export interface RuntimeActionSearchResult {
|
|
9
|
+
id: string;
|
|
10
|
+
service: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
operationType: RuntimeActionDefinition["operationType"];
|
|
14
|
+
authenticated: boolean;
|
|
15
|
+
inputSchema: RuntimeActionDefinition["inputSchema"];
|
|
16
|
+
outputSchema: RuntimeActionDefinition["outputSchema"];
|
|
17
|
+
}
|
|
18
|
+
export declare function serializeActionSearchResult(result: ActionSearchDocument, action: RuntimeActionDefinition, authenticated: boolean): RuntimeActionSearchResult;
|
|
19
|
+
export type SearchQuery = {
|
|
20
|
+
ok: true;
|
|
21
|
+
q: string;
|
|
22
|
+
service?: string;
|
|
23
|
+
limit: number;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function readSearchQuery(context: Context, defaultLimit?: number): SearchQuery;
|
|
29
|
+
export interface RuntimeCatalogRoutesOptions {
|
|
30
|
+
catalog: CatalogStore;
|
|
31
|
+
connections: ConnectionService;
|
|
32
|
+
actionSearch: ActionSearchIndexProvider;
|
|
33
|
+
oauthClientConfigs: OAuthClientConfigService;
|
|
34
|
+
saasProject?: SaasProjectService;
|
|
35
|
+
}
|
|
36
|
+
/** Provider and action discovery, inspection and search routes under /v1. */
|
|
37
|
+
export declare function createRuntimeCatalogRoutes({ catalog, connections, actionSearch, oauthClientConfigs, saasProject, }: RuntimeCatalogRoutesOptions): Hono;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { DEFAULT_ACTION_SEARCH_LIMIT, searchActions } from "../../core/action-search.js";
|
|
3
|
+
import { optionalString } from "../../core/cast.js";
|
|
4
|
+
import { serializeRuntimeAction, serializeRuntimeActionService, serializeRuntimeProvider, serializeRuntimeProviderSetup, unknownActionFailure, unknownServiceFailure, writeRuntimeFailure, writeRuntimeSuccess, } from "./runtime-api.js";
|
|
5
|
+
export function serializeActionSearchResult(result, action, authenticated) {
|
|
6
|
+
return {
|
|
7
|
+
id: result.id,
|
|
8
|
+
service: result.service,
|
|
9
|
+
name: result.name,
|
|
10
|
+
description: result.description,
|
|
11
|
+
operationType: action.operationType,
|
|
12
|
+
authenticated,
|
|
13
|
+
inputSchema: action.inputSchema,
|
|
14
|
+
outputSchema: action.outputSchema,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function readSearchQuery(context, defaultLimit = DEFAULT_ACTION_SEARCH_LIMIT) {
|
|
18
|
+
const q = optionalString(context.req.query("q") ?? context.req.query("query"));
|
|
19
|
+
if (!q || q.length > 256) {
|
|
20
|
+
return { ok: false, message: "q must be a non-empty string of at most 256 characters." };
|
|
21
|
+
}
|
|
22
|
+
const rawLimit = optionalString(context.req.query("limit"));
|
|
23
|
+
if (!rawLimit) {
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
q,
|
|
27
|
+
service: optionalString(context.req.query("service")),
|
|
28
|
+
limit: defaultLimit,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const limit = Number(rawLimit);
|
|
32
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 50) {
|
|
33
|
+
return { ok: false, message: "limit must be an integer between 1 and 50." };
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
q,
|
|
38
|
+
service: optionalString(context.req.query("service")),
|
|
39
|
+
limit,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Provider and action discovery, inspection and search routes under /v1. */
|
|
43
|
+
export function createRuntimeCatalogRoutes({ catalog, connections, actionSearch, oauthClientConfigs, saasProject, }) {
|
|
44
|
+
const app = new Hono();
|
|
45
|
+
const serializeSearchResults = async (results) => {
|
|
46
|
+
const authenticated = new Set(await connections.listAuthenticatedServices([...new Set(results.map((result) => result.service))]));
|
|
47
|
+
return results.flatMap((result) => {
|
|
48
|
+
const action = catalog.actionsById.get(result.id);
|
|
49
|
+
if (!action) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
return [serializeActionSearchResult(result, action, authenticated.has(action.service))];
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
app.get("/providers/:service/setup", async (context) => {
|
|
56
|
+
const service = context.req.param("service");
|
|
57
|
+
const provider = catalog.providers.find((p) => p.service === service);
|
|
58
|
+
if (!provider)
|
|
59
|
+
return writeRuntimeFailure(context, unknownServiceFailure(service));
|
|
60
|
+
let oauth = provider.auth.some((auth) => auth.type === "oauth2")
|
|
61
|
+
? await oauthClientConfigs.getSummary(service)
|
|
62
|
+
: undefined;
|
|
63
|
+
const source = oauth ? await saasProject?.getSource(service) : undefined;
|
|
64
|
+
if (oauth && source?.mode === "saas") {
|
|
65
|
+
const { config } = await saasProject.resolveConfig(service, source.providerConfigId, source.managedProjectId, context.req.raw.signal);
|
|
66
|
+
oauth = {
|
|
67
|
+
...oauth,
|
|
68
|
+
configured: true,
|
|
69
|
+
customClientAvailable: false,
|
|
70
|
+
expectedRedirectUri: config.callbackUrl,
|
|
71
|
+
missingFields: [],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return writeRuntimeSuccess(context, serializeRuntimeProviderSetup(provider, oauth));
|
|
75
|
+
});
|
|
76
|
+
app.get("/providers", (context) => {
|
|
77
|
+
const services = context.req.queries("service") ?? [];
|
|
78
|
+
const query = optionalString(context.req.query("q"))?.toLowerCase();
|
|
79
|
+
const providers = catalog.providers.filter((provider) => {
|
|
80
|
+
if (services.length > 0 && !services.includes(provider.service)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (!query) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return [
|
|
87
|
+
provider.service,
|
|
88
|
+
provider.displayName,
|
|
89
|
+
provider.categories.join(" "),
|
|
90
|
+
provider.scenario,
|
|
91
|
+
provider.authTypes.join(" "),
|
|
92
|
+
]
|
|
93
|
+
.join(" ")
|
|
94
|
+
.toLowerCase()
|
|
95
|
+
.includes(query);
|
|
96
|
+
});
|
|
97
|
+
return writeRuntimeSuccess(context, providers.map(serializeRuntimeProvider));
|
|
98
|
+
});
|
|
99
|
+
app.get("/actions", (context) => {
|
|
100
|
+
const service = optionalString(context.req.query("service"));
|
|
101
|
+
if (!service) {
|
|
102
|
+
const services = [...new Set(catalog.actions.map((action) => action.service))];
|
|
103
|
+
return writeRuntimeSuccess(context, services.map(serializeRuntimeActionService));
|
|
104
|
+
}
|
|
105
|
+
const actions = catalog.actions.filter((action) => action.service === service);
|
|
106
|
+
return writeRuntimeSuccess(context, actions.map(serializeRuntimeAction));
|
|
107
|
+
});
|
|
108
|
+
app.get("/actions/search", async (context) => {
|
|
109
|
+
const query = readSearchQuery(context, 10);
|
|
110
|
+
if (!query.ok) {
|
|
111
|
+
return writeRuntimeFailure(context, {
|
|
112
|
+
status: 400,
|
|
113
|
+
errorCode: "invalid_input",
|
|
114
|
+
message: query.message,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const index = await actionSearch.get();
|
|
118
|
+
const results = searchActions(index, query.q, {
|
|
119
|
+
service: query.service,
|
|
120
|
+
limit: query.limit,
|
|
121
|
+
});
|
|
122
|
+
return writeRuntimeSuccess(context, await serializeSearchResults(results));
|
|
123
|
+
});
|
|
124
|
+
app.get("/actions/:actionId", (context) => {
|
|
125
|
+
const actionId = context.req.param("actionId");
|
|
126
|
+
const action = catalog.actionsById.get(actionId);
|
|
127
|
+
if (!action) {
|
|
128
|
+
return writeRuntimeFailure(context, unknownActionFailure(actionId));
|
|
129
|
+
}
|
|
130
|
+
return writeRuntimeSuccess(context, serializeRuntimeAction(action));
|
|
131
|
+
});
|
|
132
|
+
return app;
|
|
133
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CatalogStore } from "../../catalog-store.ts";
|
|
2
|
+
import type { ActionPolicySnapshot } from "../../core/action-policy.ts";
|
|
3
|
+
import type { ActionRunner } from "../actions/action-runner.ts";
|
|
4
|
+
import type { ProxyRunner } from "../proxy/proxy-runner.ts";
|
|
5
|
+
import type { IIdempotencyStore } from "../storage/idempotency-store.ts";
|
|
6
|
+
import type { Context } from "hono";
|
|
7
|
+
import { Hono } from "hono";
|
|
8
|
+
export interface RuntimeExecutionRoutesOptions {
|
|
9
|
+
catalog: CatalogStore;
|
|
10
|
+
actions: ActionRunner;
|
|
11
|
+
idempotency: IIdempotencyStore;
|
|
12
|
+
proxyRunner: ProxyRunner;
|
|
13
|
+
getPolicySnapshot: (context: Context) => Promise<ActionPolicySnapshot>;
|
|
14
|
+
}
|
|
15
|
+
/** Action execution and proxy dispatch routes under /v1. */
|
|
16
|
+
export declare function createRuntimeExecutionRoutes({ catalog, actions, idempotency, proxyRunner, getPolicySnapshot, }: RuntimeExecutionRoutesOptions): Hono;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { ConnectionError, defaultConnectionName } from "../../connection-service.js";
|
|
3
|
+
import { optionalString } from "../../core/cast.js";
|
|
4
|
+
import { ActionInputDepthError, createIdempotencyExpiry, hashActionRequest, hashIdempotencyKey, readIdempotencyKey, } from "../actions/action-idempotency.js";
|
|
5
|
+
import { readRuntimeGrant } from "./auth.js";
|
|
6
|
+
import { HttpRequestError, readConnectionName, readJsonBody } from "./http-utils.js";
|
|
7
|
+
import { mapConnectionErrorStatus, serializeRuntimeActionResult, serializeRuntimeFailure, unknownActionFailure, writeRuntimeActionHttpResult, writeRuntimeFailure, writeRuntimeSuccess, } from "./runtime-api.js";
|
|
8
|
+
/** Action execution and proxy dispatch routes under /v1. */
|
|
9
|
+
export function createRuntimeExecutionRoutes({ catalog, actions, idempotency, proxyRunner, getPolicySnapshot, }) {
|
|
10
|
+
const app = new Hono();
|
|
11
|
+
const executeRuntimeAction = async (actionId, input, connectionName, policy, runtimeGrant, signal, connectionId) => {
|
|
12
|
+
try {
|
|
13
|
+
const run = await actions.run({
|
|
14
|
+
actionId,
|
|
15
|
+
input,
|
|
16
|
+
caller: "http",
|
|
17
|
+
connectionName,
|
|
18
|
+
connectionId,
|
|
19
|
+
policy,
|
|
20
|
+
runtimeTokenId: runtimeGrant?.tokenId,
|
|
21
|
+
signal,
|
|
22
|
+
});
|
|
23
|
+
if (!run) {
|
|
24
|
+
return serializeRuntimeFailure(unknownActionFailure(actionId));
|
|
25
|
+
}
|
|
26
|
+
return serializeRuntimeActionResult({
|
|
27
|
+
actionId,
|
|
28
|
+
executionId: run.executionId,
|
|
29
|
+
remoteExecutionId: run.remoteExecutionId,
|
|
30
|
+
failureStatus: run.failureStatus,
|
|
31
|
+
retryAfter: run.retryAfter,
|
|
32
|
+
auditPersisted: run.auditPersisted,
|
|
33
|
+
result: run.result,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (error instanceof ConnectionError) {
|
|
38
|
+
return serializeRuntimeFailure({
|
|
39
|
+
status: mapConnectionErrorStatus(error),
|
|
40
|
+
errorCode: error.code,
|
|
41
|
+
message: error.message,
|
|
42
|
+
meta: { actionId },
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
app.post("/actions/:actionId", async (context) => {
|
|
49
|
+
const actionId = context.req.param("actionId");
|
|
50
|
+
const action = catalog.actionsById.get(actionId);
|
|
51
|
+
if (!action) {
|
|
52
|
+
return writeRuntimeFailure(context, unknownActionFailure(actionId));
|
|
53
|
+
}
|
|
54
|
+
const body = await readJsonBody(context);
|
|
55
|
+
const input = body.input ?? {};
|
|
56
|
+
const connectionName = readConnectionName(context, body);
|
|
57
|
+
const connectionId = optionalString(context.req.header("x-oo-connector-app-id"));
|
|
58
|
+
const runtimeGrant = readRuntimeGrant(context);
|
|
59
|
+
let policy;
|
|
60
|
+
try {
|
|
61
|
+
policy = await getPolicySnapshot(context);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return writeRuntimeFailure(context, {
|
|
65
|
+
status: 500,
|
|
66
|
+
errorCode: "internal_error",
|
|
67
|
+
message: "Runtime policy is unavailable.",
|
|
68
|
+
meta: { actionId },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (!policy.evaluate(action).allowed) {
|
|
72
|
+
return writeRuntimeActionHttpResult(context, await executeRuntimeAction(actionId, input, connectionName, policy, runtimeGrant, context.req.raw.signal, connectionId));
|
|
73
|
+
}
|
|
74
|
+
const idempotencyKey = readIdempotencyKey(context.req.header("idempotency-key"));
|
|
75
|
+
if (!idempotencyKey.ok) {
|
|
76
|
+
return writeRuntimeFailure(context, {
|
|
77
|
+
status: 400,
|
|
78
|
+
errorCode: "invalid_input",
|
|
79
|
+
message: idempotencyKey.message,
|
|
80
|
+
meta: { actionId },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!idempotencyKey.key) {
|
|
84
|
+
return writeRuntimeActionHttpResult(context, await executeRuntimeAction(actionId, input, connectionName, policy, runtimeGrant, context.req.raw.signal, connectionId));
|
|
85
|
+
}
|
|
86
|
+
const now = new Date();
|
|
87
|
+
const keyHash = hashIdempotencyKey(idempotencyKey.key);
|
|
88
|
+
let requestHash;
|
|
89
|
+
try {
|
|
90
|
+
requestHash = hashActionRequest({
|
|
91
|
+
actionId,
|
|
92
|
+
connectionName: connectionName ?? defaultConnectionName,
|
|
93
|
+
connectionId,
|
|
94
|
+
input,
|
|
95
|
+
runtimeTokenId: runtimeGrant?.tokenId,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (!(error instanceof ActionInputDepthError)) {
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
return writeRuntimeFailure(context, {
|
|
103
|
+
status: 400,
|
|
104
|
+
errorCode: "invalid_input",
|
|
105
|
+
message: error.message,
|
|
106
|
+
meta: { actionId },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const claimId = crypto.randomUUID();
|
|
110
|
+
const claim = await idempotency.claim({
|
|
111
|
+
keyHash,
|
|
112
|
+
requestHash,
|
|
113
|
+
claimId,
|
|
114
|
+
now: now.toISOString(),
|
|
115
|
+
expiresAt: createIdempotencyExpiry(now),
|
|
116
|
+
});
|
|
117
|
+
if (claim.kind === "conflict") {
|
|
118
|
+
return writeRuntimeFailure(context, {
|
|
119
|
+
status: 409,
|
|
120
|
+
errorCode: "idempotency_key_conflict",
|
|
121
|
+
message: "Idempotency-Key has already been used with a different request.",
|
|
122
|
+
meta: { actionId },
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (claim.kind === "in_progress") {
|
|
126
|
+
return writeRuntimeFailure(context, {
|
|
127
|
+
status: 409,
|
|
128
|
+
errorCode: "idempotency_request_in_progress",
|
|
129
|
+
message: "A request with this Idempotency-Key is still in progress.",
|
|
130
|
+
meta: { actionId },
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (claim.kind === "completed") {
|
|
134
|
+
return writeRuntimeActionHttpResult(context, claim.response);
|
|
135
|
+
}
|
|
136
|
+
const result = await executeRuntimeAction(actionId, input, connectionName, policy, runtimeGrant, context.req.raw.signal, connectionId);
|
|
137
|
+
const completed = await idempotency.complete({
|
|
138
|
+
keyHash,
|
|
139
|
+
requestHash,
|
|
140
|
+
claimId,
|
|
141
|
+
response: result,
|
|
142
|
+
expiresAt: createIdempotencyExpiry(new Date()),
|
|
143
|
+
});
|
|
144
|
+
if (!completed) {
|
|
145
|
+
throw new Error("Idempotency claim was replaced before completion.");
|
|
146
|
+
}
|
|
147
|
+
return writeRuntimeActionHttpResult(context, result);
|
|
148
|
+
});
|
|
149
|
+
app.post("/proxy/:service", async (context) => {
|
|
150
|
+
const service = context.req.param("service");
|
|
151
|
+
let body;
|
|
152
|
+
try {
|
|
153
|
+
body = await readJsonBody(context);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (error instanceof HttpRequestError) {
|
|
157
|
+
return writeRuntimeFailure(context, {
|
|
158
|
+
status: error.status,
|
|
159
|
+
errorCode: error.code,
|
|
160
|
+
message: error.message,
|
|
161
|
+
meta: { service },
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
let policy;
|
|
167
|
+
try {
|
|
168
|
+
policy = await getPolicySnapshot(context);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
return writeRuntimeFailure(context, {
|
|
172
|
+
status: 500,
|
|
173
|
+
errorCode: "internal_error",
|
|
174
|
+
message: "Runtime policy is unavailable.",
|
|
175
|
+
meta: { service },
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const result = await proxyRunner.run({
|
|
179
|
+
service,
|
|
180
|
+
input: body,
|
|
181
|
+
connectionName: readConnectionName(context, body),
|
|
182
|
+
connectionId: optionalString(context.req.header("x-oo-connector-app-id")),
|
|
183
|
+
policy,
|
|
184
|
+
signal: context.req.raw.signal,
|
|
185
|
+
});
|
|
186
|
+
if (result.ok) {
|
|
187
|
+
return writeRuntimeSuccess(context, result.response, result.meta);
|
|
188
|
+
}
|
|
189
|
+
return writeRuntimeFailure(context, {
|
|
190
|
+
status: result.status,
|
|
191
|
+
errorCode: result.errorCode,
|
|
192
|
+
message: result.message,
|
|
193
|
+
data: result.data,
|
|
194
|
+
meta: result.meta,
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
return app;
|
|
198
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SaasOAuthService } from "../../saas/saas-oauth-service.ts";
|
|
2
|
+
import type { SaasProjectService } from "../../saas/saas-project-service.ts";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
export interface SaasOAuthRoutesOptions {
|
|
5
|
+
saasProject: SaasProjectService;
|
|
6
|
+
saasOAuth: SaasOAuthService;
|
|
7
|
+
}
|
|
8
|
+
/** Complete SaaS OAuth flow and browser-initiated connection sync. */
|
|
9
|
+
export declare function createSaasOAuthRoutes({ saasProject, saasOAuth }: SaasOAuthRoutesOptions): Hono;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { SaasError } from "../../saas/saas-client.js";
|
|
3
|
+
import { jsonError } from "./http-utils.js";
|
|
4
|
+
import { renderSaasCompletionPage } from "./saas-completion-page.js";
|
|
5
|
+
/** Complete SaaS OAuth flow and browser-initiated connection sync. */
|
|
6
|
+
export function createSaasOAuthRoutes({ saasProject, saasOAuth }) {
|
|
7
|
+
const app = new Hono();
|
|
8
|
+
app.get("/oauth/saas/complete", (context) => {
|
|
9
|
+
context.header("Content-Security-Policy", "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'");
|
|
10
|
+
context.header("Referrer-Policy", "no-referrer");
|
|
11
|
+
return context.html(renderSaasCompletionPage());
|
|
12
|
+
});
|
|
13
|
+
app.post("/api/oauth/connection-requests/:id/sync", async (context) => {
|
|
14
|
+
const expectedOrigin = saasProject.requireOrigin();
|
|
15
|
+
if (context.req.header("origin") !== expectedOrigin)
|
|
16
|
+
throw new SaasError("oauth_source_origin_mismatch", `Open Console at ${expectedOrigin}, or set OOMOL_CONNECT_ORIGIN to the exact Console address in your browser and restart Connect. localhost and 127.0.0.1 are different origins.`, 403);
|
|
17
|
+
if (context.req.header("x-openconnector-request") !== "sync" ||
|
|
18
|
+
context.req.header("content-type")?.split(";")[0].trim().toLowerCase() !== "application/json")
|
|
19
|
+
return context.json({ error: { code: "forbidden", message: "OAuth synchronization requires a same-origin JSON request." } }, 403);
|
|
20
|
+
const result = await saasOAuth.syncForBrowser(context.req.param("id"), "local-admin", context.req.raw.signal);
|
|
21
|
+
if (!result)
|
|
22
|
+
return jsonError(context, 404, "connection_request_not_found", "Connection request not found.");
|
|
23
|
+
context.header("Cache-Control", "private, no-store");
|
|
24
|
+
return context.json(result);
|
|
25
|
+
});
|
|
26
|
+
return app;
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SaasProjectService } from "../../saas/saas-project-service.ts";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
export interface SaasProjectRoutesOptions {
|
|
4
|
+
saasProject: SaasProjectService;
|
|
5
|
+
}
|
|
6
|
+
/** Managed project configuration for SaaS OAuth sources. */
|
|
7
|
+
export declare function createSaasProjectRoutes({ saasProject }: SaasProjectRoutesOptions): Hono;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { readJsonBody } from "./http-utils.js";
|
|
3
|
+
/** Managed project configuration for SaaS OAuth sources. */
|
|
4
|
+
export function createSaasProjectRoutes({ saasProject }) {
|
|
5
|
+
const app = new Hono();
|
|
6
|
+
app.get("/oauth/managed-project", async (context) => context.json(await saasProject.getState(context.req.raw.signal)));
|
|
7
|
+
app.put("/oauth/managed-project", async (context) => context.json(await saasProject.configure(await readJsonBody(context, 16_384), context.req.raw.signal)));
|
|
8
|
+
app.delete("/oauth/managed-project", async (context) => {
|
|
9
|
+
await saasProject.remove();
|
|
10
|
+
return context.json(await saasProject.getState(context.req.raw.signal));
|
|
11
|
+
});
|
|
12
|
+
app.get("/oauth/managed-project/provider-configs", async (context) => context.json(await saasProject.listProviderConfigs(context.req.raw.signal)));
|
|
13
|
+
app.get("/oauth/sources/:service", async (context) => context.json(await saasProject.getSource(context.req.param("service"))));
|
|
14
|
+
app.put("/oauth/sources/:service", async (context) => context.json(await saasProject.setSource(context.req.param("service"), await readJsonBody(context, 16_384), context.req.raw.signal)));
|
|
15
|
+
return app;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TransitFileUpload } from "../../core/types.ts";
|
|
2
|
+
import type { ITransitFileService } from "../files/transit-file-store.ts";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
export interface TransitFileRoutesOptions {
|
|
5
|
+
transitFiles: ITransitFileService;
|
|
6
|
+
uploadTransitFile?: (request: Request) => Promise<TransitFileUpload>;
|
|
7
|
+
}
|
|
8
|
+
/** Transit file upload, retrieval and deletion routes. */
|
|
9
|
+
export declare function createTransitFileRoutes({ transitFiles, uploadTransitFile }: TransitFileRoutesOptions): Hono;
|