@bubblelab/bubble-core 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bubble-bundle.d.ts +633 -1658
- package/dist/bubble-factory.d.ts.map +1 -1
- package/dist/bubble-factory.js +165 -43
- package/dist/bubble-factory.js.map +1 -1
- package/dist/bubble-flow/bubble-flow-class.d.ts +22 -1
- package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -1
- package/dist/bubble-flow/bubble-flow-class.js +36 -0
- package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
- package/dist/bubble-flow/sample/data-analyst-flow.d.ts +1 -1
- package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -1
- package/dist/bubble-flow/sample/error-ts.d.ts +1 -1
- package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -1
- package/dist/bubble-flow/sample/sanitytest.d.ts +1 -1
- package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -1
- package/dist/bubble-flow/sample/simple-webhook-2.d.ts +1 -1
- package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -1
- package/dist/bubble-flow/sample/simple-webhook.d.ts +1 -1
- package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -1
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +1 -1
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -1
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +6 -3
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -1
- package/dist/bubble-flow/sample/slack-v0.1.d.ts +1 -1
- package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -1
- package/dist/bubble-flow/sample/slackagenttest.d.ts +1 -1
- package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/agi-inc.d.ts +1121 -0
- package/dist/bubbles/service-bubble/agi-inc.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/agi-inc.js +730 -0
- package/dist/bubbles/service-bubble/agi-inc.js.map +1 -0
- package/dist/bubbles/service-bubble/ai-agent.d.ts +297 -85
- package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/ai-agent.js +535 -399
- package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
- package/dist/bubbles/service-bubble/airtable.d.ts +1753 -0
- package/dist/bubbles/service-bubble/airtable.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/airtable.js +1173 -0
- package/dist/bubbles/service-bubble/airtable.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +240 -0
- package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js +119 -0
- package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +38 -38
- package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +56 -56
- package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts +137 -0
- package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js +81 -0
- package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +27 -27
- package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +38 -38
- package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +488 -0
- package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js +463 -0
- package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +262 -0
- package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js +291 -0
- package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +184 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js +145 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts +52 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js +29 -0
- package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js.map +1 -0
- package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +1483 -123
- package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js +48 -0
- package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js.map +1 -1
- package/dist/bubbles/service-bubble/apify/apify.d.ts +156 -11
- package/dist/bubbles/service-bubble/apify/apify.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/apify/apify.js +205 -32
- package/dist/bubbles/service-bubble/apify/apify.js.map +1 -1
- package/dist/bubbles/service-bubble/apify/index.d.ts +2 -0
- package/dist/bubbles/service-bubble/apify/index.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/apify/index.js +3 -0
- package/dist/bubbles/service-bubble/apify/index.js.map +1 -1
- package/dist/bubbles/service-bubble/apify/types.js +1 -2
- package/dist/bubbles/service-bubble/apify/types.js.map +1 -1
- package/dist/bubbles/service-bubble/eleven-labs.d.ts +421 -0
- package/dist/bubbles/service-bubble/eleven-labs.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/eleven-labs.js +479 -0
- package/dist/bubbles/service-bubble/eleven-labs.js.map +1 -0
- package/dist/bubbles/service-bubble/firecrawl.d.ts +37748 -0
- package/dist/bubbles/service-bubble/firecrawl.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/firecrawl.js +1489 -0
- package/dist/bubbles/service-bubble/firecrawl.js.map +1 -0
- package/dist/bubbles/service-bubble/followupboss.d.ts +6822 -0
- package/dist/bubbles/service-bubble/followupboss.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/followupboss.js +1394 -0
- package/dist/bubbles/service-bubble/followupboss.js.map +1 -0
- package/dist/bubbles/service-bubble/github.d.ts +2399 -0
- package/dist/bubbles/service-bubble/github.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/github.js +1052 -0
- package/dist/bubbles/service-bubble/github.js.map +1 -0
- package/dist/bubbles/service-bubble/gmail.d.ts +726 -232
- package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/gmail.js +435 -7
- package/dist/bubbles/service-bubble/gmail.js.map +1 -1
- package/dist/bubbles/service-bubble/google-calendar.d.ts +8 -8
- package/dist/bubbles/service-bubble/google-drive.d.ts +270 -40
- package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/google-drive.js +100 -78
- package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +943 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts +31 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js +184 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.js +401 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.js.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +1024 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/{google-sheets.js → google-sheets/google-sheets.schema.js} +45 -409
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.js.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts +38 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js +183 -0
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/index.d.ts +4 -0
- package/dist/bubbles/service-bubble/google-sheets/index.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets/index.js +4 -0
- package/dist/bubbles/service-bubble/google-sheets/index.js.map +1 -0
- package/dist/bubbles/service-bubble/hello-world.js +2 -2
- package/dist/bubbles/service-bubble/hello-world.js.map +1 -1
- package/dist/bubbles/service-bubble/http.d.ts +6 -6
- package/dist/bubbles/service-bubble/http.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/http.js +7 -1
- package/dist/bubbles/service-bubble/http.js.map +1 -1
- package/dist/bubbles/service-bubble/insforge-db.d.ts +140 -0
- package/dist/bubbles/service-bubble/insforge-db.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/insforge-db.js +260 -0
- package/dist/bubbles/service-bubble/insforge-db.js.map +1 -0
- package/dist/bubbles/service-bubble/notion/index.d.ts +3 -0
- package/dist/bubbles/service-bubble/notion/index.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/notion/index.js +3 -0
- package/dist/bubbles/service-bubble/notion/index.js.map +1 -0
- package/dist/bubbles/service-bubble/notion/notion.d.ts +35405 -0
- package/dist/bubbles/service-bubble/notion/notion.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/notion/notion.js +1492 -0
- package/dist/bubbles/service-bubble/notion/notion.js.map +1 -0
- package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +1148 -0
- package/dist/bubbles/service-bubble/notion/property-schemas.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/notion/property-schemas.js +341 -0
- package/dist/bubbles/service-bubble/notion/property-schemas.js.map +1 -0
- package/dist/bubbles/service-bubble/postgresql.d.ts +8 -8
- package/dist/bubbles/service-bubble/resend.d.ts +30 -9
- package/dist/bubbles/service-bubble/resend.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/resend.js +133 -2
- package/dist/bubbles/service-bubble/resend.js.map +1 -1
- package/dist/bubbles/service-bubble/slack.d.ts +525 -525
- package/dist/bubbles/service-bubble/slack.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/slack.js +2 -2
- package/dist/bubbles/service-bubble/slack.js.map +1 -1
- package/dist/bubbles/service-bubble/storage.d.ts +21 -17
- package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/storage.js +59 -7
- package/dist/bubbles/service-bubble/storage.js.map +1 -1
- package/dist/bubbles/service-bubble/telegram.d.ts +7742 -0
- package/dist/bubbles/service-bubble/telegram.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/telegram.js +1132 -0
- package/dist/bubbles/service-bubble/telegram.js.map +1 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +60 -4
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +12 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +188 -0
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/code-edit-tool.js +321 -0
- package/dist/bubbles/tool-bubble/code-edit-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +8 -4
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +132 -19
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +455 -0
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/google-maps-tool.js +205 -0
- package/dist/bubbles/tool-bubble/google-maps-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts +90 -90
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/instagram-tool.js +2 -2
- package/dist/bubbles/tool-bubble/instagram-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +808 -431
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-tool.js +232 -12
- package/dist/bubbles/tool-bubble/linkedin-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +21 -16
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +97 -22
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +17 -16
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/research-agent-tool.js +27 -17
- package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +485 -0
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/tiktok-tool.js +226 -0
- package/dist/bubbles/tool-bubble/tiktok-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +947 -0
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/twitter-tool.js +494 -0
- package/dist/bubbles/tool-bubble/twitter-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +32 -26
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/web-crawl-tool.js +58 -59
- package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/web-extract-tool.js +17 -17
- package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +23 -115
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/web-scrape-tool.js +51 -72
- package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +18 -6
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/web-search-tool.js +46 -32
- package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts +394 -0
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/youtube-tool.js +352 -0
- package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -0
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +78 -78
- package/dist/bubbles/workflow-bubble/generate-document.workflow.js +1 -1
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +62 -62
- package/dist/bubbles/workflow-bubble/parse-document.workflow.js +1 -1
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +80 -80
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -1
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +4 -4
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -1
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +52 -52
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -1
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +2 -2
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -1
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +32 -32
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -1
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +6 -6
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -1
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +46 -46
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -1
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +24 -4
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -1
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +27 -27
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -1
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +8 -8
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -1
- package/dist/bubbles.json +251 -88
- package/dist/index.d.ts +27 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/logging/BubbleLogger.d.ts +45 -16
- package/dist/logging/BubbleLogger.d.ts.map +1 -1
- package/dist/logging/BubbleLogger.js +197 -89
- package/dist/logging/BubbleLogger.js.map +1 -1
- package/dist/logging/StreamingBubbleLogger.d.ts +13 -1
- package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
- package/dist/logging/StreamingBubbleLogger.js +56 -13
- package/dist/logging/StreamingBubbleLogger.js.map +1 -1
- package/dist/logging/WebhookStreamLogger.d.ts +66 -0
- package/dist/logging/WebhookStreamLogger.d.ts.map +1 -0
- package/dist/logging/WebhookStreamLogger.js +291 -0
- package/dist/logging/WebhookStreamLogger.js.map +1 -0
- package/dist/types/available-tools.d.ts +1 -1
- package/dist/types/available-tools.d.ts.map +1 -1
- package/dist/types/available-tools.js +1 -0
- package/dist/types/available-tools.js.map +1 -1
- package/dist/types/base-bubble-class.d.ts +7 -5
- package/dist/types/base-bubble-class.d.ts.map +1 -1
- package/dist/types/base-bubble-class.js +63 -40
- package/dist/types/base-bubble-class.js.map +1 -1
- package/dist/types/bubble.d.ts +3 -10
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/bubble.js +1 -1
- package/dist/types/bubble.js.map +1 -1
- package/dist/types/service-bubble-class.d.ts +2 -2
- package/dist/types/service-bubble-class.d.ts.map +1 -1
- package/dist/types/service-bubble-class.js +2 -2
- package/dist/types/service-bubble-class.js.map +1 -1
- package/dist/types/tool-bubble-class.d.ts +2 -2
- package/dist/types/tool-bubble-class.d.ts.map +1 -1
- package/dist/types/tool-bubble-class.js +2 -4
- package/dist/types/tool-bubble-class.js.map +1 -1
- package/dist/types/workflow-bubble-class.d.ts +2 -2
- package/dist/types/workflow-bubble-class.d.ts.map +1 -1
- package/dist/types/workflow-bubble-class.js +2 -2
- package/dist/types/workflow-bubble-class.js.map +1 -1
- package/dist/utils/agent-formatter.d.ts +14 -2
- package/dist/utils/agent-formatter.d.ts.map +1 -1
- package/dist/utils/agent-formatter.js +176 -28
- package/dist/utils/agent-formatter.js.map +1 -1
- package/dist/utils/bubbleflow-validation.d.ts +7 -0
- package/dist/utils/bubbleflow-validation.d.ts.map +1 -1
- package/dist/utils/bubbleflow-validation.js +257 -35
- package/dist/utils/bubbleflow-validation.js.map +1 -1
- package/dist/utils/error-sanitizer.d.ts +12 -0
- package/dist/utils/error-sanitizer.d.ts.map +1 -0
- package/dist/utils/error-sanitizer.js +77 -0
- package/dist/utils/error-sanitizer.js.map +1 -0
- package/dist/utils/json-parsing.d.ts.map +1 -1
- package/dist/utils/json-parsing.js +146 -0
- package/dist/utils/json-parsing.js.map +1 -1
- package/dist/utils/safe-gemini-chat.d.ts +31 -0
- package/dist/utils/safe-gemini-chat.d.ts.map +1 -0
- package/dist/utils/safe-gemini-chat.js +93 -0
- package/dist/utils/safe-gemini-chat.js.map +1 -0
- package/dist/utils/schema-comparison.d.ts +92 -0
- package/dist/utils/schema-comparison.d.ts.map +1 -0
- package/dist/utils/schema-comparison.js +716 -0
- package/dist/utils/schema-comparison.js.map +1 -0
- package/dist/utils/zod-schema.d.ts +24 -0
- package/dist/utils/zod-schema.d.ts.map +1 -0
- package/dist/utils/zod-schema.js +56 -0
- package/dist/utils/zod-schema.js.map +1 -0
- package/package.json +7 -6
- package/dist/bubble-trigger/index.d.ts +0 -2
- package/dist/bubble-trigger/index.d.ts.map +0 -1
- package/dist/bubble-trigger/index.js +0 -2
- package/dist/bubble-trigger/index.js.map +0 -1
- package/dist/bubble-trigger/types.d.ts +0 -87
- package/dist/bubble-trigger/types.d.ts.map +0 -1
- package/dist/bubble-trigger/types.js +0 -14
- package/dist/bubble-trigger/types.js.map +0 -1
- package/dist/bubbles/service-bubble/apify/api-scraper.schema.d.ts +0 -370
- package/dist/bubbles/service-bubble/apify/api-scraper.schema.d.ts.map +0 -1
- package/dist/bubbles/service-bubble/apify/api-scraper.schema.js +0 -14
- package/dist/bubbles/service-bubble/apify/api-scraper.schema.js.map +0 -1
- package/dist/bubbles/service-bubble/apify.d.ts +0 -136
- package/dist/bubbles/service-bubble/apify.d.ts.map +0 -1
- package/dist/bubbles/service-bubble/apify.js +0 -282
- package/dist/bubbles/service-bubble/apify.js.map +0 -1
- package/dist/bubbles/service-bubble/google-sheets.d.ts +0 -1811
- package/dist/bubbles/service-bubble/google-sheets.d.ts.map +0 -1
- package/dist/bubbles/service-bubble/google-sheets.js.map +0 -1
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +0 -114
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +0 -1
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +0 -782
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +0 -1
- package/dist/types/ai-models.d.ts +0 -4
- package/dist/types/ai-models.d.ts.map +0 -1
- package/dist/types/ai-models.js +0 -20
- package/dist/types/ai-models.js.map +0 -1
- package/dist/types/api-scraper.schema.d.ts +0 -453
- package/dist/types/api-scraper.schema.d.ts.map +0 -1
- package/dist/types/api-scraper.schema.js +0 -160
- package/dist/types/api-scraper.schema.js.map +0 -1
- package/dist/utils/param-helper.d.ts +0 -2
- package/dist/utils/param-helper.d.ts.map +0 -1
- package/dist/utils/param-helper.js +0 -5
- package/dist/utils/param-helper.js.map +0 -1
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServiceBubble } from '../../types/service-bubble-class.js';
|
|
3
|
+
import { CredentialType } from '@bubblelab/shared-schemas';
|
|
4
|
+
// GitHub API base URL
|
|
5
|
+
const GITHUB_API_BASE = 'https://api.github.com';
|
|
6
|
+
// GitHub file content schema
|
|
7
|
+
const GithubFileContentSchema = z.object({
|
|
8
|
+
name: z.string().describe('File name'),
|
|
9
|
+
path: z.string().describe('Full path to the file in the repository'),
|
|
10
|
+
sha: z.string().describe('Git SHA hash of the file'),
|
|
11
|
+
size: z.number().describe('File size in bytes'),
|
|
12
|
+
url: z.string().describe('API URL for this file'),
|
|
13
|
+
html_url: z.string().describe('Web URL to view the file on GitHub'),
|
|
14
|
+
git_url: z.string().describe('Git URL for the file object'),
|
|
15
|
+
download_url: z
|
|
16
|
+
.string()
|
|
17
|
+
.nullable()
|
|
18
|
+
.describe('Direct download URL for the file'),
|
|
19
|
+
type: z
|
|
20
|
+
.enum(['file', 'dir', 'symlink', 'submodule'])
|
|
21
|
+
.describe('Type of the content'),
|
|
22
|
+
content: z.string().optional().describe('Base64 encoded content (for files)'),
|
|
23
|
+
encoding: z.string().optional().describe('Encoding type (usually base64)'),
|
|
24
|
+
});
|
|
25
|
+
// GitHub repository schema
|
|
26
|
+
const GithubRepositorySchema = z.object({
|
|
27
|
+
id: z.number().describe('Repository ID'),
|
|
28
|
+
node_id: z.string().describe('GraphQL node ID'),
|
|
29
|
+
name: z.string().describe('Repository name'),
|
|
30
|
+
full_name: z.string().describe('Full repository name (owner/repo)'),
|
|
31
|
+
private: z.boolean().describe('Whether the repository is private'),
|
|
32
|
+
owner: z
|
|
33
|
+
.object({
|
|
34
|
+
login: z.string().describe('Owner username'),
|
|
35
|
+
id: z.number().describe('Owner ID'),
|
|
36
|
+
avatar_url: z.string().describe('Owner avatar URL'),
|
|
37
|
+
html_url: z.string().describe('Owner profile URL'),
|
|
38
|
+
})
|
|
39
|
+
.describe('Repository owner information'),
|
|
40
|
+
html_url: z.string().describe('Repository web URL'),
|
|
41
|
+
description: z.string().nullable().describe('Repository description'),
|
|
42
|
+
fork: z.boolean().describe('Whether this is a fork'),
|
|
43
|
+
created_at: z.string().describe('ISO datetime when repository was created'),
|
|
44
|
+
updated_at: z
|
|
45
|
+
.string()
|
|
46
|
+
.describe('ISO datetime when repository was last updated'),
|
|
47
|
+
pushed_at: z.string().describe('ISO datetime of last push'),
|
|
48
|
+
size: z.number().describe('Repository size in KB'),
|
|
49
|
+
stargazers_count: z.number().describe('Number of stars'),
|
|
50
|
+
watchers_count: z.number().describe('Number of watchers'),
|
|
51
|
+
language: z.string().nullable().describe('Primary programming language'),
|
|
52
|
+
forks_count: z.number().describe('Number of forks'),
|
|
53
|
+
open_issues_count: z.number().describe('Number of open issues'),
|
|
54
|
+
default_branch: z.string().describe('Default branch name'),
|
|
55
|
+
visibility: z
|
|
56
|
+
.string()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Repository visibility (public, private, internal)'),
|
|
59
|
+
});
|
|
60
|
+
// GitHub pull request schema
|
|
61
|
+
const GithubPullRequestSchema = z.object({
|
|
62
|
+
id: z.number().describe('Pull request ID'),
|
|
63
|
+
node_id: z.string().describe('GraphQL node ID'),
|
|
64
|
+
number: z.number().describe('Pull request number'),
|
|
65
|
+
state: z.enum(['open', 'closed']).describe('Pull request state'),
|
|
66
|
+
title: z.string().describe('Pull request title'),
|
|
67
|
+
body: z.string().nullable().describe('Pull request description'),
|
|
68
|
+
created_at: z.string().describe('ISO datetime when PR was created'),
|
|
69
|
+
updated_at: z.string().describe('ISO datetime when PR was last updated'),
|
|
70
|
+
closed_at: z.string().nullable().describe('ISO datetime when PR was closed'),
|
|
71
|
+
merged_at: z.string().nullable().describe('ISO datetime when PR was merged'),
|
|
72
|
+
user: z
|
|
73
|
+
.object({
|
|
74
|
+
login: z.string().describe('Author username'),
|
|
75
|
+
id: z.number().describe('Author ID'),
|
|
76
|
+
avatar_url: z.string().describe('Author avatar URL'),
|
|
77
|
+
})
|
|
78
|
+
.describe('Pull request author'),
|
|
79
|
+
html_url: z.string().describe('Web URL to view the PR'),
|
|
80
|
+
draft: z.boolean().describe('Whether this is a draft PR'),
|
|
81
|
+
head: z
|
|
82
|
+
.object({
|
|
83
|
+
ref: z.string().describe('Source branch name'),
|
|
84
|
+
sha: z.string().describe('Source commit SHA'),
|
|
85
|
+
})
|
|
86
|
+
.describe('Source branch information'),
|
|
87
|
+
base: z
|
|
88
|
+
.object({
|
|
89
|
+
ref: z.string().describe('Target branch name'),
|
|
90
|
+
sha: z.string().describe('Target commit SHA'),
|
|
91
|
+
})
|
|
92
|
+
.describe('Target branch information'),
|
|
93
|
+
merged: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe('Whether the PR has been merged (may not be present in list responses)'),
|
|
97
|
+
mergeable: z
|
|
98
|
+
.boolean()
|
|
99
|
+
.nullable()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Whether the PR can be merged (may not be present in list responses)'),
|
|
102
|
+
mergeable_state: z
|
|
103
|
+
.string()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe('Mergeable state (clean, unstable, dirty, etc.)'),
|
|
106
|
+
comments: z.number().optional().describe('Number of comments'),
|
|
107
|
+
review_comments: z.number().optional().describe('Number of review comments'),
|
|
108
|
+
commits: z.number().optional().describe('Number of commits'),
|
|
109
|
+
additions: z.number().optional().describe('Lines added'),
|
|
110
|
+
deletions: z.number().optional().describe('Lines deleted'),
|
|
111
|
+
changed_files: z.number().optional().describe('Number of files changed'),
|
|
112
|
+
});
|
|
113
|
+
// GitHub issue/PR comment schema
|
|
114
|
+
const GithubCommentSchema = z.object({
|
|
115
|
+
id: z.number().describe('Comment ID'),
|
|
116
|
+
node_id: z.string().describe('GraphQL node ID'),
|
|
117
|
+
body: z.string().describe('Comment text content'),
|
|
118
|
+
user: z
|
|
119
|
+
.object({
|
|
120
|
+
login: z.string().describe('Comment author username'),
|
|
121
|
+
id: z.number().describe('Comment author ID'),
|
|
122
|
+
})
|
|
123
|
+
.describe('Comment author information'),
|
|
124
|
+
created_at: z.string().describe('ISO datetime when comment was created'),
|
|
125
|
+
updated_at: z.string().describe('ISO datetime when comment was last updated'),
|
|
126
|
+
html_url: z.string().describe('Web URL to view the comment'),
|
|
127
|
+
});
|
|
128
|
+
// GitHub issue schema
|
|
129
|
+
const GithubIssueSchema = z.object({
|
|
130
|
+
id: z.number().describe('Issue ID'),
|
|
131
|
+
node_id: z.string().describe('GraphQL node ID'),
|
|
132
|
+
number: z.number().describe('Issue number'),
|
|
133
|
+
state: z.enum(['open', 'closed']).describe('Issue state'),
|
|
134
|
+
title: z.string().describe('Issue title'),
|
|
135
|
+
body: z.string().nullable().describe('Issue description'),
|
|
136
|
+
user: z
|
|
137
|
+
.object({
|
|
138
|
+
login: z.string().describe('Issue creator username'),
|
|
139
|
+
id: z.number().describe('Issue creator ID'),
|
|
140
|
+
})
|
|
141
|
+
.describe('Issue creator information'),
|
|
142
|
+
labels: z
|
|
143
|
+
.array(z.object({
|
|
144
|
+
id: z.number().describe('Label ID'),
|
|
145
|
+
name: z.string().describe('Label name'),
|
|
146
|
+
color: z.string().describe('Label color (hex)'),
|
|
147
|
+
description: z.string().nullable().describe('Label description'),
|
|
148
|
+
}))
|
|
149
|
+
.describe('Issue labels'),
|
|
150
|
+
created_at: z.string().describe('ISO datetime when issue was created'),
|
|
151
|
+
updated_at: z.string().describe('ISO datetime when issue was last updated'),
|
|
152
|
+
closed_at: z
|
|
153
|
+
.string()
|
|
154
|
+
.nullable()
|
|
155
|
+
.describe('ISO datetime when issue was closed'),
|
|
156
|
+
html_url: z.string().describe('Web URL to view the issue'),
|
|
157
|
+
comments: z.number().describe('Number of comments'),
|
|
158
|
+
});
|
|
159
|
+
// Define the parameters schema for different GitHub operations
|
|
160
|
+
const GithubParamsSchema = z.discriminatedUnion('operation', [
|
|
161
|
+
// Get file content operation
|
|
162
|
+
z.object({
|
|
163
|
+
operation: z
|
|
164
|
+
.literal('get_file')
|
|
165
|
+
.describe('Get the contents of a file from a GitHub repository'),
|
|
166
|
+
owner: z
|
|
167
|
+
.string()
|
|
168
|
+
.min(1, 'Repository owner is required')
|
|
169
|
+
.describe('Repository owner (username or organization name)'),
|
|
170
|
+
repo: z
|
|
171
|
+
.string()
|
|
172
|
+
.min(1, 'Repository name is required')
|
|
173
|
+
.describe('Repository name'),
|
|
174
|
+
path: z
|
|
175
|
+
.string()
|
|
176
|
+
.min(1, 'File path is required')
|
|
177
|
+
.describe('Path to the file in the repository (e.g., src/index.ts)'),
|
|
178
|
+
ref: z
|
|
179
|
+
.string()
|
|
180
|
+
.optional()
|
|
181
|
+
.describe('Git reference (branch, tag, or commit SHA). Defaults to the default branch'),
|
|
182
|
+
credentials: z
|
|
183
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
184
|
+
.optional()
|
|
185
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
186
|
+
}),
|
|
187
|
+
// Get directory contents operation
|
|
188
|
+
z.object({
|
|
189
|
+
operation: z
|
|
190
|
+
.literal('get_directory')
|
|
191
|
+
.describe('Get the contents of a directory from a GitHub repository'),
|
|
192
|
+
owner: z
|
|
193
|
+
.string()
|
|
194
|
+
.min(1, 'Repository owner is required')
|
|
195
|
+
.describe('Repository owner (username or organization name)'),
|
|
196
|
+
repo: z
|
|
197
|
+
.string()
|
|
198
|
+
.min(1, 'Repository name is required')
|
|
199
|
+
.describe('Repository name'),
|
|
200
|
+
path: z
|
|
201
|
+
.string()
|
|
202
|
+
.optional()
|
|
203
|
+
.default('')
|
|
204
|
+
.describe('Path to the directory in the repository (empty string for root)'),
|
|
205
|
+
ref: z
|
|
206
|
+
.string()
|
|
207
|
+
.optional()
|
|
208
|
+
.describe('Git reference (branch, tag, or commit SHA). Defaults to the default branch'),
|
|
209
|
+
credentials: z
|
|
210
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
211
|
+
.optional()
|
|
212
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
213
|
+
}),
|
|
214
|
+
// List pull requests operation
|
|
215
|
+
z.object({
|
|
216
|
+
operation: z
|
|
217
|
+
.literal('list_pull_requests')
|
|
218
|
+
.describe('List pull requests in a GitHub repository'),
|
|
219
|
+
owner: z
|
|
220
|
+
.string()
|
|
221
|
+
.min(1, 'Repository owner is required')
|
|
222
|
+
.describe('Repository owner (username or organization name)'),
|
|
223
|
+
repo: z
|
|
224
|
+
.string()
|
|
225
|
+
.min(1, 'Repository name is required')
|
|
226
|
+
.describe('Repository name'),
|
|
227
|
+
state: z
|
|
228
|
+
.enum(['open', 'closed', 'all'])
|
|
229
|
+
.optional()
|
|
230
|
+
.default('open')
|
|
231
|
+
.describe('Filter by PR state'),
|
|
232
|
+
sort: z
|
|
233
|
+
.enum(['created', 'updated', 'popularity', 'long-running'])
|
|
234
|
+
.optional()
|
|
235
|
+
.default('created')
|
|
236
|
+
.describe('Sort order for results'),
|
|
237
|
+
direction: z
|
|
238
|
+
.enum(['asc', 'desc'])
|
|
239
|
+
.optional()
|
|
240
|
+
.default('desc')
|
|
241
|
+
.describe('Sort direction'),
|
|
242
|
+
per_page: z
|
|
243
|
+
.number()
|
|
244
|
+
.min(1)
|
|
245
|
+
.max(100)
|
|
246
|
+
.optional()
|
|
247
|
+
.default(30)
|
|
248
|
+
.describe('Number of results per page (1-100)'),
|
|
249
|
+
page: z
|
|
250
|
+
.number()
|
|
251
|
+
.min(1)
|
|
252
|
+
.optional()
|
|
253
|
+
.default(1)
|
|
254
|
+
.describe('Page number for pagination'),
|
|
255
|
+
credentials: z
|
|
256
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
257
|
+
.optional()
|
|
258
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
259
|
+
}),
|
|
260
|
+
// Get pull request details operation
|
|
261
|
+
z.object({
|
|
262
|
+
operation: z
|
|
263
|
+
.literal('get_pull_request')
|
|
264
|
+
.describe('Get detailed information about a specific pull request'),
|
|
265
|
+
owner: z
|
|
266
|
+
.string()
|
|
267
|
+
.min(1, 'Repository owner is required')
|
|
268
|
+
.describe('Repository owner (username or organization name)'),
|
|
269
|
+
repo: z
|
|
270
|
+
.string()
|
|
271
|
+
.min(1, 'Repository name is required')
|
|
272
|
+
.describe('Repository name'),
|
|
273
|
+
pull_number: z
|
|
274
|
+
.number()
|
|
275
|
+
.min(1, 'Pull request number is required')
|
|
276
|
+
.describe('Pull request number'),
|
|
277
|
+
credentials: z
|
|
278
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
279
|
+
.optional()
|
|
280
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
281
|
+
}),
|
|
282
|
+
// Create PR comment operation
|
|
283
|
+
z.object({
|
|
284
|
+
operation: z
|
|
285
|
+
.literal('create_pr_comment')
|
|
286
|
+
.describe('Add a comment to a pull request'),
|
|
287
|
+
owner: z
|
|
288
|
+
.string()
|
|
289
|
+
.min(1, 'Repository owner is required')
|
|
290
|
+
.describe('Repository owner (username or organization name)'),
|
|
291
|
+
repo: z
|
|
292
|
+
.string()
|
|
293
|
+
.min(1, 'Repository name is required')
|
|
294
|
+
.describe('Repository name'),
|
|
295
|
+
pull_number: z
|
|
296
|
+
.number()
|
|
297
|
+
.min(1, 'Pull request number is required')
|
|
298
|
+
.describe('Pull request number'),
|
|
299
|
+
body: z
|
|
300
|
+
.string()
|
|
301
|
+
.min(1, 'Comment text is required')
|
|
302
|
+
.describe('Comment text content (supports GitHub Markdown)'),
|
|
303
|
+
credentials: z
|
|
304
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
305
|
+
.optional()
|
|
306
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
307
|
+
}),
|
|
308
|
+
// List repositories operation
|
|
309
|
+
z.object({
|
|
310
|
+
operation: z
|
|
311
|
+
.literal('list_repositories')
|
|
312
|
+
.describe('List repositories for the authenticated user'),
|
|
313
|
+
visibility: z
|
|
314
|
+
.enum(['all', 'public', 'private'])
|
|
315
|
+
.optional()
|
|
316
|
+
.default('all')
|
|
317
|
+
.describe('Filter by repository visibility'),
|
|
318
|
+
affiliation: z
|
|
319
|
+
.enum(['owner', 'collaborator', 'organization_member'])
|
|
320
|
+
.optional()
|
|
321
|
+
.default('owner')
|
|
322
|
+
.describe('Filter by user affiliation'),
|
|
323
|
+
sort: z
|
|
324
|
+
.enum(['created', 'updated', 'pushed', 'full_name'])
|
|
325
|
+
.optional()
|
|
326
|
+
.default('updated')
|
|
327
|
+
.describe('Sort order for results'),
|
|
328
|
+
direction: z
|
|
329
|
+
.enum(['asc', 'desc'])
|
|
330
|
+
.optional()
|
|
331
|
+
.default('desc')
|
|
332
|
+
.describe('Sort direction'),
|
|
333
|
+
per_page: z
|
|
334
|
+
.number()
|
|
335
|
+
.min(1)
|
|
336
|
+
.max(100)
|
|
337
|
+
.optional()
|
|
338
|
+
.default(30)
|
|
339
|
+
.describe('Number of results per page (1-100)'),
|
|
340
|
+
page: z
|
|
341
|
+
.number()
|
|
342
|
+
.min(1)
|
|
343
|
+
.optional()
|
|
344
|
+
.default(1)
|
|
345
|
+
.describe('Page number for pagination'),
|
|
346
|
+
credentials: z
|
|
347
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
348
|
+
.optional()
|
|
349
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
350
|
+
}),
|
|
351
|
+
// Get repository details operation
|
|
352
|
+
z.object({
|
|
353
|
+
operation: z
|
|
354
|
+
.literal('get_repository')
|
|
355
|
+
.describe('Get detailed information about a specific repository'),
|
|
356
|
+
owner: z
|
|
357
|
+
.string()
|
|
358
|
+
.min(1, 'Repository owner is required')
|
|
359
|
+
.describe('Repository owner (username or organization name)'),
|
|
360
|
+
repo: z
|
|
361
|
+
.string()
|
|
362
|
+
.min(1, 'Repository name is required')
|
|
363
|
+
.describe('Repository name'),
|
|
364
|
+
credentials: z
|
|
365
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
366
|
+
.optional()
|
|
367
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
368
|
+
}),
|
|
369
|
+
// Create issue comment operation
|
|
370
|
+
z.object({
|
|
371
|
+
operation: z
|
|
372
|
+
.literal('create_issue_comment')
|
|
373
|
+
.describe('Add a comment to an issue'),
|
|
374
|
+
owner: z
|
|
375
|
+
.string()
|
|
376
|
+
.min(1, 'Repository owner is required')
|
|
377
|
+
.describe('Repository owner (username or organization name)'),
|
|
378
|
+
repo: z
|
|
379
|
+
.string()
|
|
380
|
+
.min(1, 'Repository name is required')
|
|
381
|
+
.describe('Repository name'),
|
|
382
|
+
issue_number: z
|
|
383
|
+
.number()
|
|
384
|
+
.min(1, 'Issue number is required')
|
|
385
|
+
.describe('Issue number'),
|
|
386
|
+
body: z
|
|
387
|
+
.string()
|
|
388
|
+
.min(1, 'Comment text is required')
|
|
389
|
+
.describe('Comment text content (supports GitHub Markdown)'),
|
|
390
|
+
credentials: z
|
|
391
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
392
|
+
.optional()
|
|
393
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
394
|
+
}),
|
|
395
|
+
// List issues operation
|
|
396
|
+
z.object({
|
|
397
|
+
operation: z
|
|
398
|
+
.literal('list_issues')
|
|
399
|
+
.describe('List issues in a GitHub repository'),
|
|
400
|
+
owner: z
|
|
401
|
+
.string()
|
|
402
|
+
.min(1, 'Repository owner is required')
|
|
403
|
+
.describe('Repository owner (username or organization name)'),
|
|
404
|
+
repo: z
|
|
405
|
+
.string()
|
|
406
|
+
.min(1, 'Repository name is required')
|
|
407
|
+
.describe('Repository name'),
|
|
408
|
+
state: z
|
|
409
|
+
.enum(['open', 'closed', 'all'])
|
|
410
|
+
.optional()
|
|
411
|
+
.default('open')
|
|
412
|
+
.describe('Filter by issue state'),
|
|
413
|
+
labels: z
|
|
414
|
+
.string()
|
|
415
|
+
.optional()
|
|
416
|
+
.describe('Filter by labels (comma-separated list)'),
|
|
417
|
+
sort: z
|
|
418
|
+
.enum(['created', 'updated', 'comments'])
|
|
419
|
+
.optional()
|
|
420
|
+
.default('created')
|
|
421
|
+
.describe('Sort order for results'),
|
|
422
|
+
direction: z
|
|
423
|
+
.enum(['asc', 'desc'])
|
|
424
|
+
.optional()
|
|
425
|
+
.default('desc')
|
|
426
|
+
.describe('Sort direction'),
|
|
427
|
+
per_page: z
|
|
428
|
+
.number()
|
|
429
|
+
.min(1)
|
|
430
|
+
.max(100)
|
|
431
|
+
.optional()
|
|
432
|
+
.default(30)
|
|
433
|
+
.describe('Number of results per page (1-100)'),
|
|
434
|
+
page: z
|
|
435
|
+
.number()
|
|
436
|
+
.min(1)
|
|
437
|
+
.optional()
|
|
438
|
+
.default(1)
|
|
439
|
+
.describe('Page number for pagination'),
|
|
440
|
+
credentials: z
|
|
441
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
442
|
+
.optional()
|
|
443
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
444
|
+
}),
|
|
445
|
+
]);
|
|
446
|
+
// Define the result schemas for different GitHub operations
|
|
447
|
+
const GithubResultSchema = z.discriminatedUnion('operation', [
|
|
448
|
+
z
|
|
449
|
+
.object({
|
|
450
|
+
operation: z.literal('get_file'),
|
|
451
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
452
|
+
error: z.string().describe('Error message if operation failed'),
|
|
453
|
+
})
|
|
454
|
+
.merge(GithubFileContentSchema.partial()),
|
|
455
|
+
z.object({
|
|
456
|
+
operation: z.literal('get_directory'),
|
|
457
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
458
|
+
error: z.string().describe('Error message if operation failed'),
|
|
459
|
+
contents: z
|
|
460
|
+
.array(GithubFileContentSchema)
|
|
461
|
+
.optional()
|
|
462
|
+
.describe('Array of directory contents'),
|
|
463
|
+
}),
|
|
464
|
+
z.object({
|
|
465
|
+
operation: z.literal('list_pull_requests'),
|
|
466
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
467
|
+
error: z.string().describe('Error message if operation failed'),
|
|
468
|
+
pull_requests: z
|
|
469
|
+
.array(GithubPullRequestSchema)
|
|
470
|
+
.optional()
|
|
471
|
+
.describe('Array of pull requests'),
|
|
472
|
+
}),
|
|
473
|
+
z
|
|
474
|
+
.object({
|
|
475
|
+
operation: z.literal('get_pull_request'),
|
|
476
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
477
|
+
error: z.string().describe('Error message if operation failed'),
|
|
478
|
+
})
|
|
479
|
+
.merge(GithubPullRequestSchema.partial()),
|
|
480
|
+
z
|
|
481
|
+
.object({
|
|
482
|
+
operation: z.literal('create_pr_comment'),
|
|
483
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
484
|
+
error: z.string().describe('Error message if operation failed'),
|
|
485
|
+
})
|
|
486
|
+
.merge(GithubCommentSchema.partial()),
|
|
487
|
+
z.object({
|
|
488
|
+
operation: z.literal('list_repositories'),
|
|
489
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
490
|
+
error: z.string().describe('Error message if operation failed'),
|
|
491
|
+
repositories: z
|
|
492
|
+
.array(GithubRepositorySchema)
|
|
493
|
+
.optional()
|
|
494
|
+
.describe('Array of repositories'),
|
|
495
|
+
}),
|
|
496
|
+
z
|
|
497
|
+
.object({
|
|
498
|
+
operation: z.literal('get_repository'),
|
|
499
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
500
|
+
error: z.string().describe('Error message if operation failed'),
|
|
501
|
+
})
|
|
502
|
+
.merge(GithubRepositorySchema.partial()),
|
|
503
|
+
z
|
|
504
|
+
.object({
|
|
505
|
+
operation: z.literal('create_issue_comment'),
|
|
506
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
507
|
+
error: z.string().describe('Error message if operation failed'),
|
|
508
|
+
})
|
|
509
|
+
.merge(GithubCommentSchema.partial()),
|
|
510
|
+
z.object({
|
|
511
|
+
operation: z.literal('list_issues'),
|
|
512
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
513
|
+
error: z.string().describe('Error message if operation failed'),
|
|
514
|
+
issues: z.array(GithubIssueSchema).optional().describe('Array of issues'),
|
|
515
|
+
}),
|
|
516
|
+
]);
|
|
517
|
+
export class GithubBubble extends ServiceBubble {
|
|
518
|
+
static type = 'service';
|
|
519
|
+
static service = 'github';
|
|
520
|
+
static authType = 'apikey';
|
|
521
|
+
static bubbleName = 'github';
|
|
522
|
+
static schema = GithubParamsSchema;
|
|
523
|
+
static resultSchema = GithubResultSchema;
|
|
524
|
+
static shortDescription = 'GitHub API integration for repository operations';
|
|
525
|
+
static longDescription = `
|
|
526
|
+
GitHub API integration for accessing repositories, pull requests, issues, and files.
|
|
527
|
+
|
|
528
|
+
Features:
|
|
529
|
+
- Get file contents from repositories
|
|
530
|
+
- List and browse directory contents
|
|
531
|
+
- Manage pull requests (list, get details, comment)
|
|
532
|
+
- Manage issues (list, comment)
|
|
533
|
+
- List and get repository information
|
|
534
|
+
- Non-sensitive read and comment operations only
|
|
535
|
+
|
|
536
|
+
Use cases:
|
|
537
|
+
- Code review automation and PR management
|
|
538
|
+
- Repository file access and content retrieval
|
|
539
|
+
- Issue and PR comment automation
|
|
540
|
+
- Repository exploration and documentation
|
|
541
|
+
- CI/CD integration and status checks
|
|
542
|
+
|
|
543
|
+
Security Features:
|
|
544
|
+
- Personal access token authentication (GitHub PAT)
|
|
545
|
+
- Read-only operations with safe comment capabilities
|
|
546
|
+
- No file deletion or destructive operations
|
|
547
|
+
- Respects repository permissions
|
|
548
|
+
`;
|
|
549
|
+
static alias = 'gh';
|
|
550
|
+
constructor(params = {
|
|
551
|
+
operation: 'get_repository',
|
|
552
|
+
owner: 'octocat',
|
|
553
|
+
repo: 'Hello-World',
|
|
554
|
+
}, context) {
|
|
555
|
+
super(params, context);
|
|
556
|
+
}
|
|
557
|
+
async testCredential() {
|
|
558
|
+
try {
|
|
559
|
+
// Test the credential by fetching the authenticated user
|
|
560
|
+
const token = this.chooseCredential();
|
|
561
|
+
if (!token) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
const response = await fetch(`${GITHUB_API_BASE}/user`, {
|
|
565
|
+
headers: {
|
|
566
|
+
Authorization: `Bearer ${token}`,
|
|
567
|
+
Accept: 'application/vnd.github+json',
|
|
568
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
569
|
+
},
|
|
570
|
+
});
|
|
571
|
+
return response.ok;
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
console.error('GitHub credential test failed:', error);
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
chooseCredential() {
|
|
579
|
+
const credentials = this.params.credentials;
|
|
580
|
+
if (!credentials || typeof credentials !== 'object') {
|
|
581
|
+
return undefined;
|
|
582
|
+
}
|
|
583
|
+
return credentials[CredentialType.GITHUB_TOKEN];
|
|
584
|
+
}
|
|
585
|
+
async performAction(context) {
|
|
586
|
+
void context;
|
|
587
|
+
const { operation } = this.params;
|
|
588
|
+
switch (operation) {
|
|
589
|
+
case 'get_file':
|
|
590
|
+
return this.handleGetFile(this.params);
|
|
591
|
+
case 'get_directory':
|
|
592
|
+
return this.handleGetDirectory(this.params);
|
|
593
|
+
case 'list_pull_requests':
|
|
594
|
+
return this.handleListPullRequests(this.params);
|
|
595
|
+
case 'get_pull_request':
|
|
596
|
+
return this.handleGetPullRequest(this.params);
|
|
597
|
+
case 'create_pr_comment':
|
|
598
|
+
return this.handleCreatePrComment(this.params);
|
|
599
|
+
case 'list_repositories':
|
|
600
|
+
return this.handleListRepositories(this.params);
|
|
601
|
+
case 'get_repository':
|
|
602
|
+
return this.handleGetRepository(this.params);
|
|
603
|
+
case 'create_issue_comment':
|
|
604
|
+
return this.handleCreateIssueComment(this.params);
|
|
605
|
+
case 'list_issues':
|
|
606
|
+
return this.handleListIssues(this.params);
|
|
607
|
+
default:
|
|
608
|
+
return {
|
|
609
|
+
operation: operation,
|
|
610
|
+
success: false,
|
|
611
|
+
error: `Unknown operation: ${operation}`,
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
async handleGetFile(params) {
|
|
616
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
617
|
+
const { owner, repo, path, ref } = parsed;
|
|
618
|
+
try {
|
|
619
|
+
const token = this.chooseCredential();
|
|
620
|
+
if (!token) {
|
|
621
|
+
return {
|
|
622
|
+
operation: 'get_file',
|
|
623
|
+
success: false,
|
|
624
|
+
error: 'GitHub token credential not found',
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
let url = `${GITHUB_API_BASE}/repos/${owner}/${repo}/contents/${path}`;
|
|
628
|
+
if (ref) {
|
|
629
|
+
url += `?ref=${encodeURIComponent(ref)}`;
|
|
630
|
+
}
|
|
631
|
+
const response = await fetch(url, {
|
|
632
|
+
headers: {
|
|
633
|
+
Authorization: `Bearer ${token}`,
|
|
634
|
+
Accept: 'application/vnd.github+json',
|
|
635
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
636
|
+
},
|
|
637
|
+
});
|
|
638
|
+
if (!response.ok) {
|
|
639
|
+
const error = await response.text();
|
|
640
|
+
return {
|
|
641
|
+
operation: 'get_file',
|
|
642
|
+
success: false,
|
|
643
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
const data = await response.json();
|
|
647
|
+
const validatedData = GithubFileContentSchema.parse(data);
|
|
648
|
+
return {
|
|
649
|
+
operation: 'get_file',
|
|
650
|
+
success: true,
|
|
651
|
+
error: '',
|
|
652
|
+
...validatedData,
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
return {
|
|
657
|
+
operation: 'get_file',
|
|
658
|
+
success: false,
|
|
659
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
async handleGetDirectory(params) {
|
|
664
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
665
|
+
const { owner, repo, path, ref } = parsed;
|
|
666
|
+
try {
|
|
667
|
+
const token = this.chooseCredential();
|
|
668
|
+
if (!token) {
|
|
669
|
+
return {
|
|
670
|
+
operation: 'get_directory',
|
|
671
|
+
success: false,
|
|
672
|
+
error: 'GitHub token credential not found',
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
let url = `${GITHUB_API_BASE}/repos/${owner}/${repo}/contents/${path}`;
|
|
676
|
+
if (ref) {
|
|
677
|
+
url += `?ref=${encodeURIComponent(ref)}`;
|
|
678
|
+
}
|
|
679
|
+
const response = await fetch(url, {
|
|
680
|
+
headers: {
|
|
681
|
+
Authorization: `Bearer ${token}`,
|
|
682
|
+
Accept: 'application/vnd.github+json',
|
|
683
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
684
|
+
},
|
|
685
|
+
});
|
|
686
|
+
if (!response.ok) {
|
|
687
|
+
const error = await response.text();
|
|
688
|
+
return {
|
|
689
|
+
operation: 'get_directory',
|
|
690
|
+
success: false,
|
|
691
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
const data = await response.json();
|
|
695
|
+
const validatedData = z.array(GithubFileContentSchema).parse(data);
|
|
696
|
+
return {
|
|
697
|
+
operation: 'get_directory',
|
|
698
|
+
success: true,
|
|
699
|
+
error: '',
|
|
700
|
+
contents: validatedData,
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
catch (error) {
|
|
704
|
+
return {
|
|
705
|
+
operation: 'get_directory',
|
|
706
|
+
success: false,
|
|
707
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
async handleListPullRequests(params) {
|
|
712
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
713
|
+
const { owner, repo, state, sort, direction, per_page, page } = parsed;
|
|
714
|
+
try {
|
|
715
|
+
const token = this.chooseCredential();
|
|
716
|
+
if (!token) {
|
|
717
|
+
return {
|
|
718
|
+
operation: 'list_pull_requests',
|
|
719
|
+
success: false,
|
|
720
|
+
error: 'GitHub token credential not found',
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
const url = new URL(`${GITHUB_API_BASE}/repos/${owner}/${repo}/pulls`);
|
|
724
|
+
url.searchParams.set('state', state);
|
|
725
|
+
url.searchParams.set('sort', sort);
|
|
726
|
+
url.searchParams.set('direction', direction);
|
|
727
|
+
url.searchParams.set('per_page', per_page.toString());
|
|
728
|
+
url.searchParams.set('page', page.toString());
|
|
729
|
+
const response = await fetch(url.toString(), {
|
|
730
|
+
headers: {
|
|
731
|
+
Authorization: `Bearer ${token}`,
|
|
732
|
+
Accept: 'application/vnd.github+json',
|
|
733
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
734
|
+
},
|
|
735
|
+
});
|
|
736
|
+
if (!response.ok) {
|
|
737
|
+
const error = await response.text();
|
|
738
|
+
return {
|
|
739
|
+
operation: 'list_pull_requests',
|
|
740
|
+
success: false,
|
|
741
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
const data = await response.json();
|
|
745
|
+
const validatedData = z.array(GithubPullRequestSchema).parse(data);
|
|
746
|
+
return {
|
|
747
|
+
operation: 'list_pull_requests',
|
|
748
|
+
success: true,
|
|
749
|
+
error: '',
|
|
750
|
+
pull_requests: validatedData,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
catch (error) {
|
|
754
|
+
return {
|
|
755
|
+
operation: 'list_pull_requests',
|
|
756
|
+
success: false,
|
|
757
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
async handleGetPullRequest(params) {
|
|
762
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
763
|
+
const { owner, repo, pull_number } = parsed;
|
|
764
|
+
try {
|
|
765
|
+
const token = this.chooseCredential();
|
|
766
|
+
if (!token) {
|
|
767
|
+
return {
|
|
768
|
+
operation: 'get_pull_request',
|
|
769
|
+
success: false,
|
|
770
|
+
error: 'GitHub token credential not found',
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
const url = `${GITHUB_API_BASE}/repos/${owner}/${repo}/pulls/${pull_number}`;
|
|
774
|
+
const response = await fetch(url, {
|
|
775
|
+
headers: {
|
|
776
|
+
Authorization: `Bearer ${token}`,
|
|
777
|
+
Accept: 'application/vnd.github+json',
|
|
778
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
779
|
+
},
|
|
780
|
+
});
|
|
781
|
+
if (!response.ok) {
|
|
782
|
+
const error = await response.text();
|
|
783
|
+
return {
|
|
784
|
+
operation: 'get_pull_request',
|
|
785
|
+
success: false,
|
|
786
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
const data = await response.json();
|
|
790
|
+
const validatedData = GithubPullRequestSchema.parse(data);
|
|
791
|
+
return {
|
|
792
|
+
operation: 'get_pull_request',
|
|
793
|
+
success: true,
|
|
794
|
+
error: '',
|
|
795
|
+
...validatedData,
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
catch (error) {
|
|
799
|
+
return {
|
|
800
|
+
operation: 'get_pull_request',
|
|
801
|
+
success: false,
|
|
802
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
async handleCreatePrComment(params) {
|
|
807
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
808
|
+
const { owner, repo, pull_number, body } = parsed;
|
|
809
|
+
try {
|
|
810
|
+
const token = this.chooseCredential();
|
|
811
|
+
if (!token) {
|
|
812
|
+
return {
|
|
813
|
+
operation: 'create_pr_comment',
|
|
814
|
+
success: false,
|
|
815
|
+
error: 'GitHub token credential not found',
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
const url = `${GITHUB_API_BASE}/repos/${owner}/${repo}/issues/${pull_number}/comments`;
|
|
819
|
+
const response = await fetch(url, {
|
|
820
|
+
method: 'POST',
|
|
821
|
+
headers: {
|
|
822
|
+
Authorization: `Bearer ${token}`,
|
|
823
|
+
Accept: 'application/vnd.github+json',
|
|
824
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
825
|
+
'Content-Type': 'application/json',
|
|
826
|
+
},
|
|
827
|
+
body: JSON.stringify({ body }),
|
|
828
|
+
});
|
|
829
|
+
if (!response.ok) {
|
|
830
|
+
const error = await response.text();
|
|
831
|
+
return {
|
|
832
|
+
operation: 'create_pr_comment',
|
|
833
|
+
success: false,
|
|
834
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
const data = await response.json();
|
|
838
|
+
const validatedData = GithubCommentSchema.parse(data);
|
|
839
|
+
return {
|
|
840
|
+
operation: 'create_pr_comment',
|
|
841
|
+
success: true,
|
|
842
|
+
error: '',
|
|
843
|
+
...validatedData,
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
catch (error) {
|
|
847
|
+
return {
|
|
848
|
+
operation: 'create_pr_comment',
|
|
849
|
+
success: false,
|
|
850
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
async handleListRepositories(params) {
|
|
855
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
856
|
+
const { visibility, affiliation, sort, direction, per_page, page } = parsed;
|
|
857
|
+
try {
|
|
858
|
+
const token = this.chooseCredential();
|
|
859
|
+
if (!token) {
|
|
860
|
+
return {
|
|
861
|
+
operation: 'list_repositories',
|
|
862
|
+
success: false,
|
|
863
|
+
error: 'GitHub token credential not found',
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
const url = new URL(`${GITHUB_API_BASE}/user/repos`);
|
|
867
|
+
url.searchParams.set('visibility', visibility);
|
|
868
|
+
url.searchParams.set('affiliation', affiliation);
|
|
869
|
+
url.searchParams.set('sort', sort);
|
|
870
|
+
url.searchParams.set('direction', direction);
|
|
871
|
+
url.searchParams.set('per_page', per_page.toString());
|
|
872
|
+
url.searchParams.set('page', page.toString());
|
|
873
|
+
const response = await fetch(url.toString(), {
|
|
874
|
+
headers: {
|
|
875
|
+
Authorization: `Bearer ${token}`,
|
|
876
|
+
Accept: 'application/vnd.github+json',
|
|
877
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
878
|
+
},
|
|
879
|
+
});
|
|
880
|
+
if (!response.ok) {
|
|
881
|
+
const error = await response.text();
|
|
882
|
+
return {
|
|
883
|
+
operation: 'list_repositories',
|
|
884
|
+
success: false,
|
|
885
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
const data = await response.json();
|
|
889
|
+
const validatedData = z.array(GithubRepositorySchema).parse(data);
|
|
890
|
+
return {
|
|
891
|
+
operation: 'list_repositories',
|
|
892
|
+
success: true,
|
|
893
|
+
error: '',
|
|
894
|
+
repositories: validatedData,
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
catch (error) {
|
|
898
|
+
return {
|
|
899
|
+
operation: 'list_repositories',
|
|
900
|
+
success: false,
|
|
901
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
async handleGetRepository(params) {
|
|
906
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
907
|
+
const { owner, repo } = parsed;
|
|
908
|
+
try {
|
|
909
|
+
const token = this.chooseCredential();
|
|
910
|
+
if (!token) {
|
|
911
|
+
return {
|
|
912
|
+
operation: 'get_repository',
|
|
913
|
+
success: false,
|
|
914
|
+
error: 'GitHub token credential not found',
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
const url = `${GITHUB_API_BASE}/repos/${owner}/${repo}`;
|
|
918
|
+
const response = await fetch(url, {
|
|
919
|
+
headers: {
|
|
920
|
+
Authorization: `Bearer ${token}`,
|
|
921
|
+
Accept: 'application/vnd.github+json',
|
|
922
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
923
|
+
},
|
|
924
|
+
});
|
|
925
|
+
if (!response.ok) {
|
|
926
|
+
const error = await response.text();
|
|
927
|
+
return {
|
|
928
|
+
operation: 'get_repository',
|
|
929
|
+
success: false,
|
|
930
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
const data = await response.json();
|
|
934
|
+
const validatedData = GithubRepositorySchema.parse(data);
|
|
935
|
+
return {
|
|
936
|
+
operation: 'get_repository',
|
|
937
|
+
success: true,
|
|
938
|
+
error: '',
|
|
939
|
+
...validatedData,
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
catch (error) {
|
|
943
|
+
return {
|
|
944
|
+
operation: 'get_repository',
|
|
945
|
+
success: false,
|
|
946
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
async handleCreateIssueComment(params) {
|
|
951
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
952
|
+
const { owner, repo, issue_number, body } = parsed;
|
|
953
|
+
try {
|
|
954
|
+
const token = this.chooseCredential();
|
|
955
|
+
if (!token) {
|
|
956
|
+
return {
|
|
957
|
+
operation: 'create_issue_comment',
|
|
958
|
+
success: false,
|
|
959
|
+
error: 'GitHub token credential not found',
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
const url = `${GITHUB_API_BASE}/repos/${owner}/${repo}/issues/${issue_number}/comments`;
|
|
963
|
+
const response = await fetch(url, {
|
|
964
|
+
method: 'POST',
|
|
965
|
+
headers: {
|
|
966
|
+
Authorization: `Bearer ${token}`,
|
|
967
|
+
Accept: 'application/vnd.github+json',
|
|
968
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
969
|
+
'Content-Type': 'application/json',
|
|
970
|
+
},
|
|
971
|
+
body: JSON.stringify({ body }),
|
|
972
|
+
});
|
|
973
|
+
if (!response.ok) {
|
|
974
|
+
const error = await response.text();
|
|
975
|
+
return {
|
|
976
|
+
operation: 'create_issue_comment',
|
|
977
|
+
success: false,
|
|
978
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
const data = await response.json();
|
|
982
|
+
const validatedData = GithubCommentSchema.parse(data);
|
|
983
|
+
return {
|
|
984
|
+
operation: 'create_issue_comment',
|
|
985
|
+
success: true,
|
|
986
|
+
error: '',
|
|
987
|
+
...validatedData,
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
catch (error) {
|
|
991
|
+
return {
|
|
992
|
+
operation: 'create_issue_comment',
|
|
993
|
+
success: false,
|
|
994
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
async handleListIssues(params) {
|
|
999
|
+
const parsed = GithubParamsSchema.parse(params);
|
|
1000
|
+
const { owner, repo, state, labels, sort, direction, per_page, page } = parsed;
|
|
1001
|
+
try {
|
|
1002
|
+
const token = this.chooseCredential();
|
|
1003
|
+
if (!token) {
|
|
1004
|
+
return {
|
|
1005
|
+
operation: 'list_issues',
|
|
1006
|
+
success: false,
|
|
1007
|
+
error: 'GitHub token credential not found',
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
const url = new URL(`${GITHUB_API_BASE}/repos/${owner}/${repo}/issues`);
|
|
1011
|
+
url.searchParams.set('state', state);
|
|
1012
|
+
if (labels) {
|
|
1013
|
+
url.searchParams.set('labels', labels);
|
|
1014
|
+
}
|
|
1015
|
+
url.searchParams.set('sort', sort);
|
|
1016
|
+
url.searchParams.set('direction', direction);
|
|
1017
|
+
url.searchParams.set('per_page', per_page.toString());
|
|
1018
|
+
url.searchParams.set('page', page.toString());
|
|
1019
|
+
const response = await fetch(url.toString(), {
|
|
1020
|
+
headers: {
|
|
1021
|
+
Authorization: `Bearer ${token}`,
|
|
1022
|
+
Accept: 'application/vnd.github+json',
|
|
1023
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
1024
|
+
},
|
|
1025
|
+
});
|
|
1026
|
+
if (!response.ok) {
|
|
1027
|
+
const error = await response.text();
|
|
1028
|
+
return {
|
|
1029
|
+
operation: 'list_issues',
|
|
1030
|
+
success: false,
|
|
1031
|
+
error: `GitHub API error: ${response.status} ${error}`,
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
const data = await response.json();
|
|
1035
|
+
const validatedData = z.array(GithubIssueSchema).parse(data);
|
|
1036
|
+
return {
|
|
1037
|
+
operation: 'list_issues',
|
|
1038
|
+
success: true,
|
|
1039
|
+
error: '',
|
|
1040
|
+
issues: validatedData,
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
catch (error) {
|
|
1044
|
+
return {
|
|
1045
|
+
operation: 'list_issues',
|
|
1046
|
+
success: false,
|
|
1047
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
//# sourceMappingURL=github.js.map
|