@superblocksteam/vite-plugin-file-sync 2.0.77 → 2.0.78-next.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/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +26 -0
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.js +13 -0
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/api-executor.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/api-executor.js +102 -7
- package/dist/ai-service/agent/tools/apis/api-executor.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts +17 -0
- package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api-artifact.js +20 -12
- package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.js +9 -1
- package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +46 -0
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.js +326 -58
- package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/integration-types.d.ts +20 -1
- package/dist/ai-service/agent/tools/apis/integration-types.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/integration-types.js +1033 -288
- package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts +1 -1
- package/dist/ai-service/agent/tools/apis/write-api.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-read-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.js +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +18 -10
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js +11 -7
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +27 -5
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata-ripgrep.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata-ripgrep.js +78 -7
- package/dist/ai-service/agent/tools2/tools/grep-metadata-ripgrep.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts +6 -2
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js +26 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/index.d.ts +2 -0
- package/dist/ai-service/agent/tools2/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/index.js +2 -0
- package/dist/ai-service/agent/tools2/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.js +2 -3
- package/dist/ai-service/agent/tools2/tools/list-attachments.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/start-test-run.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/start-test-run.js +51 -6
- package/dist/ai-service/agent/tools2/tools/start-test-run.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/web-fetch.d.ts +28 -0
- package/dist/ai-service/agent/tools2/tools/web-fetch.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/web-fetch.js +274 -0
- package/dist/ai-service/agent/tools2/tools/web-fetch.js.map +1 -0
- package/dist/ai-service/agent/tools2/tools/web-search.d.ts +25 -0
- package/dist/ai-service/agent/tools2/tools/web-search.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/web-search.js +210 -0
- package/dist/ai-service/agent/tools2/tools/web-search.js.map +1 -0
- package/dist/ai-service/attachments/store.d.ts +4 -4
- package/dist/ai-service/attachments/store.d.ts.map +1 -1
- package/dist/ai-service/attachments/store.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.d.ts +19 -4
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +32 -6
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/clark-provider/clark-language-model.d.ts.map +1 -1
- package/dist/ai-service/clark-provider/clark-language-model.js +11 -2
- package/dist/ai-service/clark-provider/clark-language-model.js.map +1 -1
- package/dist/ai-service/const.d.ts +3 -2
- package/dist/ai-service/const.d.ts.map +1 -1
- package/dist/ai-service/const.js +3 -2
- package/dist/ai-service/const.js.map +1 -1
- package/dist/ai-service/context-download.d.ts +4 -1
- package/dist/ai-service/context-download.d.ts.map +1 -1
- package/dist/ai-service/context-download.js +36 -7
- package/dist/ai-service/context-download.js.map +1 -1
- package/dist/ai-service/features.d.ts +8 -0
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +8 -0
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/index.d.ts +1 -0
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +101 -18
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/integrations/store.d.ts +14 -2
- package/dist/ai-service/integrations/store.d.ts.map +1 -1
- package/dist/ai-service/integrations/store.js +19 -2
- package/dist/ai-service/integrations/store.js.map +1 -1
- package/dist/ai-service/judge/judge-eval-service-runner.d.ts.map +1 -1
- package/dist/ai-service/judge/judge-eval-service-runner.js +7 -0
- package/dist/ai-service/judge/judge-eval-service-runner.js.map +1 -1
- package/dist/ai-service/llm/client.d.ts +29 -11
- package/dist/ai-service/llm/client.d.ts.map +1 -1
- package/dist/ai-service/llm/client.js +95 -78
- package/dist/ai-service/llm/client.js.map +1 -1
- package/dist/ai-service/llm/context/context.d.ts +2 -1
- package/dist/ai-service/llm/context/context.d.ts.map +1 -1
- package/dist/ai-service/llm/context/context.js.map +1 -1
- package/dist/ai-service/llm/context/conversation-context.d.ts +89 -0
- package/dist/ai-service/llm/context/conversation-context.d.ts.map +1 -0
- package/dist/ai-service/llm/context/conversation-context.js +13 -0
- package/dist/ai-service/llm/context/conversation-context.js.map +1 -0
- package/dist/ai-service/llm/context/index.d.ts +1 -0
- package/dist/ai-service/llm/context/index.d.ts.map +1 -1
- package/dist/ai-service/llm/context/utils/get-loaded-context.d.ts +12 -0
- package/dist/ai-service/llm/context/utils/get-loaded-context.d.ts.map +1 -0
- package/dist/ai-service/llm/context/utils/get-loaded-context.js +7 -0
- package/dist/ai-service/llm/context/utils/get-loaded-context.js.map +1 -0
- package/dist/ai-service/llm/context/utils/index.d.ts +1 -5
- package/dist/ai-service/llm/context/utils/index.d.ts.map +1 -1
- package/dist/ai-service/llm/context/utils/index.js +1 -5
- package/dist/ai-service/llm/context/utils/index.js.map +1 -1
- package/dist/ai-service/llm/context-v2/adapter.d.ts +26 -0
- package/dist/ai-service/llm/context-v2/adapter.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/adapter.js +88 -0
- package/dist/ai-service/llm/context-v2/adapter.js.map +1 -0
- package/dist/ai-service/llm/context-v2/caching.d.ts +39 -0
- package/dist/ai-service/llm/context-v2/caching.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/caching.js +48 -0
- package/dist/ai-service/llm/context-v2/caching.js.map +1 -0
- package/dist/ai-service/llm/context-v2/compactor.d.ts +16 -0
- package/dist/ai-service/llm/context-v2/compactor.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/compactor.js +164 -0
- package/dist/ai-service/llm/context-v2/compactor.js.map +1 -0
- package/dist/ai-service/llm/context-v2/config.d.ts +6 -0
- package/dist/ai-service/llm/context-v2/config.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/config.js +8 -0
- package/dist/ai-service/llm/context-v2/config.js.map +1 -0
- package/dist/ai-service/llm/context-v2/context.d.ts +61 -0
- package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/context.js +238 -0
- package/dist/ai-service/llm/context-v2/context.js.map +1 -0
- package/dist/ai-service/llm/context-v2/index.d.ts +16 -0
- package/dist/ai-service/llm/context-v2/index.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/index.js +16 -0
- package/dist/ai-service/llm/context-v2/index.js.map +1 -0
- package/dist/ai-service/llm/context-v2/manager.d.ts +57 -0
- package/dist/ai-service/llm/context-v2/manager.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/manager.js +129 -0
- package/dist/ai-service/llm/context-v2/manager.js.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/index.d.ts +8 -0
- package/dist/ai-service/llm/context-v2/migrations/index.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/index.js +8 -0
- package/dist/ai-service/llm/context-v2/migrations/index.js.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/registry.d.ts +19 -0
- package/dist/ai-service/llm/context-v2/migrations/registry.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/registry.js +32 -0
- package/dist/ai-service/llm/context-v2/migrations/registry.js.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/runner.d.ts +3 -0
- package/dist/ai-service/llm/context-v2/migrations/runner.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/runner.js +61 -0
- package/dist/ai-service/llm/context-v2/migrations/runner.js.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/types.d.ts +22 -0
- package/dist/ai-service/llm/context-v2/migrations/types.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/types.js +33 -0
- package/dist/ai-service/llm/context-v2/migrations/types.js.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.d.ts +29 -0
- package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.js +143 -0
- package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.js.map +1 -0
- package/dist/ai-service/llm/context-v2/operation-queue.d.ts +9 -0
- package/dist/ai-service/llm/context-v2/operation-queue.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/operation-queue.js +13 -0
- package/dist/ai-service/llm/context-v2/operation-queue.js.map +1 -0
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.d.ts +16 -0
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js +135 -0
- package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js.map +1 -0
- package/dist/ai-service/llm/context-v2/phase2-session-summarizer.d.ts +20 -0
- package/dist/ai-service/llm/context-v2/phase2-session-summarizer.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/phase2-session-summarizer.js +213 -0
- package/dist/ai-service/llm/context-v2/phase2-session-summarizer.js.map +1 -0
- package/dist/ai-service/llm/context-v2/prompts/compaction.d.ts +11 -0
- package/dist/ai-service/llm/context-v2/prompts/compaction.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/prompts/compaction.js +57 -0
- package/dist/ai-service/llm/context-v2/prompts/compaction.js.map +1 -0
- package/dist/ai-service/llm/context-v2/session-capture.d.ts +18 -0
- package/dist/ai-service/llm/context-v2/session-capture.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/session-capture.js +64 -0
- package/dist/ai-service/llm/context-v2/session-capture.js.map +1 -0
- package/dist/ai-service/llm/context-v2/storage/index.d.ts +14 -0
- package/dist/ai-service/llm/context-v2/storage/index.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/storage/index.js +2 -0
- package/dist/ai-service/llm/context-v2/storage/index.js.map +1 -0
- package/dist/ai-service/llm/context-v2/storage/local.d.ts +25 -0
- package/dist/ai-service/llm/context-v2/storage/local.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/storage/local.js +71 -0
- package/dist/ai-service/llm/context-v2/storage/local.js.map +1 -0
- package/dist/ai-service/llm/context-v2/storage/types.d.ts +12 -0
- package/dist/ai-service/llm/context-v2/storage/types.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/storage/types.js +2 -0
- package/dist/ai-service/llm/context-v2/storage/types.js.map +1 -0
- package/dist/ai-service/llm/context-v2/token-tracker.d.ts +4 -0
- package/dist/ai-service/llm/context-v2/token-tracker.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/token-tracker.js +13 -0
- package/dist/ai-service/llm/context-v2/token-tracker.js.map +1 -0
- package/dist/ai-service/llm/context-v2/truncation-fallback.d.ts +10 -0
- package/dist/ai-service/llm/context-v2/truncation-fallback.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/truncation-fallback.js +120 -0
- package/dist/ai-service/llm/context-v2/truncation-fallback.js.map +1 -0
- package/dist/ai-service/llm/context-v2/turns.d.ts +23 -0
- package/dist/ai-service/llm/context-v2/turns.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/turns.js +61 -0
- package/dist/ai-service/llm/context-v2/turns.js.map +1 -0
- package/dist/ai-service/llm/context-v2/types.d.ts +100 -0
- package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -0
- package/dist/ai-service/llm/context-v2/types.js +262 -0
- package/dist/ai-service/llm/context-v2/types.js.map +1 -0
- package/dist/ai-service/llm/error.d.ts +4 -0
- package/dist/ai-service/llm/error.d.ts.map +1 -1
- package/dist/ai-service/llm/error.js +26 -0
- package/dist/ai-service/llm/error.js.map +1 -1
- package/dist/ai-service/llm/impl/clark.d.ts.map +1 -1
- package/dist/ai-service/llm/impl/clark.js +3 -2
- package/dist/ai-service/llm/impl/clark.js.map +1 -1
- package/dist/ai-service/llm/interaction/adapters/vercel.d.ts.map +1 -1
- package/dist/ai-service/llm/interaction/adapters/vercel.js +3 -1
- package/dist/ai-service/llm/interaction/adapters/vercel.js.map +1 -1
- package/dist/ai-service/llm/provider.d.ts +2 -2
- package/dist/ai-service/llm/provider.d.ts.map +1 -1
- package/dist/ai-service/llm/provider.js +2 -2
- package/dist/ai-service/llm/provider.js.map +1 -1
- package/dist/ai-service/llm/stream/event-bus.d.ts +1 -1
- package/dist/ai-service/llm/stream/event-bus.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/observers/context.d.ts +2 -9
- package/dist/ai-service/llm/stream/observers/context.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/observers/context.js +4 -4
- package/dist/ai-service/llm/stream/observers/context.js.map +1 -1
- package/dist/ai-service/llm/stream/observers/llmobs.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/observers/llmobs.js +2 -1
- package/dist/ai-service/llm/stream/observers/llmobs.js.map +1 -1
- package/dist/ai-service/llm/stream/observers/logging.js +1 -1
- package/dist/ai-service/llm/stream/observers/logging.js.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.js +22 -13
- package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
- package/dist/ai-service/llm/stream/session.d.ts +3 -0
- package/dist/ai-service/llm/stream/session.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/session.js +2 -0
- package/dist/ai-service/llm/stream/session.js.map +1 -1
- package/dist/ai-service/llm/utils.d.ts +2 -2
- package/dist/ai-service/llm/utils.d.ts.map +1 -1
- package/dist/ai-service/llm/utils.js +27 -10
- package/dist/ai-service/llm/utils.js.map +1 -1
- package/dist/ai-service/llm/workflow-metrics.d.ts +14 -0
- package/dist/ai-service/llm/workflow-metrics.d.ts.map +1 -0
- package/dist/ai-service/llm/workflow-metrics.js +19 -0
- package/dist/ai-service/llm/workflow-metrics.js.map +1 -0
- package/dist/ai-service/security/safety-classifier.d.ts +2 -0
- package/dist/ai-service/security/safety-classifier.d.ts.map +1 -1
- package/dist/ai-service/security/safety-classifier.js +9 -6
- package/dist/ai-service/security/safety-classifier.js.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.d.ts +15 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js +3 -4
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.js +32 -18
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/awaiting-user.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/awaiting-user.js +34 -0
- package/dist/ai-service/state-machine/handlers/awaiting-user.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.js +6 -1
- package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +84 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.js +6 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.d.ts +7 -0
- package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.js +24 -8
- package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
- package/dist/ai-service/transform/api-builder/shared.d.ts +5 -0
- package/dist/ai-service/transform/api-builder/shared.d.ts.map +1 -1
- package/dist/ai-service/transform/api-builder/shared.js +13 -1
- package/dist/ai-service/transform/api-builder/shared.js.map +1 -1
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.d.ts +11 -0
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.d.ts.map +1 -1
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.js +11 -4
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.js.map +1 -1
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.d.ts +4 -0
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.d.ts.map +1 -1
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.js +7 -0
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.js.map +1 -1
- package/dist/binding-extraction/extract-identifiers.d.ts.map +1 -1
- package/dist/binding-extraction/extract-identifiers.js +39 -3
- package/dist/binding-extraction/extract-identifiers.js.map +1 -1
- package/dist/clark-log-forwarder.d.ts.map +1 -1
- package/dist/clark-log-forwarder.js +1 -0
- package/dist/clark-log-forwarder.js.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +4 -1
- package/dist/resolver.js.map +1 -1
- package/dist/router-parser.d.ts.map +1 -1
- package/dist/router-parser.js +34 -9
- package/dist/router-parser.js.map +1 -1
- package/package.json +23 -18
|
@@ -2,212 +2,66 @@
|
|
|
2
2
|
* TypeScript type definitions for all Superblocks integrations.
|
|
3
3
|
* These definitions are used to provide type information in API documentation.
|
|
4
4
|
*/
|
|
5
|
-
import { getBasePluginId } from "@superblocksteam/shared";
|
|
5
|
+
import { compareSemVer, getBasePluginId, } from "@superblocksteam/shared";
|
|
6
6
|
import { datasourceSdkClassByType } from "../../../const.js";
|
|
7
|
+
/**
|
|
8
|
+
* Compare two semantic version strings.
|
|
9
|
+
* Returns true if version >= minVersion.
|
|
10
|
+
*/
|
|
11
|
+
function semverGte(version, minVersion) {
|
|
12
|
+
return compareSemVer(version, minVersion) >= 0;
|
|
13
|
+
}
|
|
7
14
|
/**
|
|
8
15
|
* Map of plugin IDs to their TypeScript type definitions.
|
|
9
16
|
* These are based on the actual classes from @superblocksteam/library.
|
|
10
17
|
*/
|
|
11
18
|
export const INTEGRATION_TYPE_DEFINITIONS = {
|
|
12
|
-
// SQL Databases
|
|
13
|
-
postgres
|
|
14
|
-
|
|
15
|
-
pluginId: "postgres",
|
|
16
|
-
description: "PostgreSQL database integration",
|
|
17
|
-
typeDefinition: `export class PostgreSQL extends Integration {
|
|
18
|
-
constructor(
|
|
19
|
-
name: string,
|
|
20
|
-
integrationId: string,
|
|
21
|
-
config: {
|
|
22
|
-
statement: Binding<string>;
|
|
23
|
-
/** Optional, defaults to \`"prepared"\` */
|
|
24
|
-
mode?: Binding<"simple" | "prepared">;
|
|
25
|
-
/** Optional, defaults to \`false\` */
|
|
26
|
-
enablePooling?: Binding<boolean>;
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
/** Execute SQL statement - returns array of rows */
|
|
31
|
-
async execute(): Promise<any[]>;
|
|
32
|
-
}`,
|
|
33
|
-
example: `new PostgreSQL("GetUsers", postgresIntegrationId, {
|
|
34
|
-
statement: ({ statusFilter }) =>
|
|
35
|
-
\`SELECT * FROM users WHERE status = '\${statusFilter}'\` // API inputs don't need .value
|
|
36
|
-
})`,
|
|
37
|
-
},
|
|
38
|
-
mysql: {
|
|
39
|
-
className: "MySQL",
|
|
40
|
-
pluginId: "mysql",
|
|
41
|
-
description: "MySQL database integration",
|
|
42
|
-
typeDefinition: `export class MySQL extends Integration {
|
|
43
|
-
constructor(
|
|
44
|
-
name: string,
|
|
45
|
-
integrationId: string,
|
|
46
|
-
config: {
|
|
47
|
-
statement: Binding<string>;
|
|
48
|
-
/** Optional, defaults to \`false\` */
|
|
49
|
-
enablePooling?: Binding<boolean>;
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
/** Execute SQL statement - returns array of rows */
|
|
54
|
-
async execute(): Promise<any[]>;
|
|
55
|
-
}`,
|
|
56
|
-
example: `new MySQL("GetOrders", mysqlIntegrationId, {
|
|
57
|
-
statement: ({ customerId }) =>
|
|
58
|
-
\`SELECT * FROM orders WHERE customer_id = \${customerId}\` // API inputs don't need .value
|
|
59
|
-
})`,
|
|
60
|
-
},
|
|
61
|
-
mssql: {
|
|
62
|
-
className: "MicrosoftSQL",
|
|
63
|
-
pluginId: "mssql",
|
|
64
|
-
description: "Microsoft SQL Server integration",
|
|
65
|
-
typeDefinition: `export class MicrosoftSQL extends Integration {
|
|
66
|
-
constructor(
|
|
67
|
-
name: string,
|
|
68
|
-
integrationId: string,
|
|
69
|
-
config: {
|
|
70
|
-
statement: Binding<string>;
|
|
71
|
-
/** Optional, defaults to \`false\` */
|
|
72
|
-
enablePooling?: Binding<boolean>;
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
/** Execute SQL statement - returns array of rows */
|
|
77
|
-
async execute(): Promise<any[]>;
|
|
78
|
-
}`,
|
|
79
|
-
example: `new MicrosoftSQL("GetProducts", mssqlIntegrationId, {
|
|
80
|
-
statement: ({ minPrice }) =>
|
|
81
|
-
\`SELECT * FROM products WHERE price > \${minPrice}\` // API inputs don't need .value
|
|
82
|
-
})`,
|
|
83
|
-
},
|
|
84
|
-
snowflake: {
|
|
85
|
-
className: "Snowflake",
|
|
86
|
-
pluginId: "snowflake",
|
|
87
|
-
description: "Snowflake data warehouse integration",
|
|
88
|
-
typeDefinition: `export class Snowflake extends Integration {
|
|
89
|
-
constructor(
|
|
90
|
-
name: string,
|
|
91
|
-
integrationId: string,
|
|
92
|
-
config: {
|
|
93
|
-
statement: Binding<string>;
|
|
94
|
-
/** Optional, defaults to \`false\` */
|
|
95
|
-
enablePooling?: Binding<boolean>;
|
|
96
|
-
/** Optional warehouse to use */
|
|
97
|
-
warehouse?: Binding<string>;
|
|
98
|
-
/** Optional database to use */
|
|
99
|
-
database?: Binding<string>;
|
|
100
|
-
/** Optional schema to use */
|
|
101
|
-
schema?: Binding<string>;
|
|
102
|
-
/** Optional role to use */
|
|
103
|
-
role?: Binding<string>;
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
/** Execute SQL statement - returns array of rows */
|
|
108
|
-
async execute(): Promise<any[]>;
|
|
109
|
-
}`,
|
|
110
|
-
example: `new Snowflake("AnalyzeSales", snowflakeIntegrationId, {
|
|
111
|
-
statement: "SELECT region, SUM(amount) FROM sales GROUP BY region",
|
|
112
|
-
warehouse: "COMPUTE_WH",
|
|
113
|
-
database: "ANALYTICS"
|
|
114
|
-
})`,
|
|
115
|
-
},
|
|
116
|
-
databricks: {
|
|
117
|
-
className: "Databricks",
|
|
118
|
-
pluginId: "databricks",
|
|
119
|
-
description: "Databricks lakehouse integration",
|
|
120
|
-
typeDefinition: `export class Databricks extends Integration {
|
|
121
|
-
constructor(
|
|
122
|
-
name: string,
|
|
123
|
-
integrationId: string,
|
|
124
|
-
config: {
|
|
125
|
-
statement: Binding<string>;
|
|
126
|
-
/** Optional, defaults to \`false\` */
|
|
127
|
-
enablePooling?: Binding<boolean>;
|
|
128
|
-
/** Optional catalog to use */
|
|
129
|
-
catalog?: Binding<string>;
|
|
130
|
-
/** Optional schema to use */
|
|
131
|
-
schema?: Binding<string>;
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
/** Execute SQL statement - returns array of rows */
|
|
136
|
-
async execute(): Promise<any[]>;
|
|
137
|
-
}`,
|
|
138
|
-
example: `new Databricks("ProcessLogs", databricksIntegrationId, {
|
|
139
|
-
statement: ({ selectedDate }) =>
|
|
140
|
-
\`SELECT * FROM catalog.schema.logs WHERE date = '\${selectedDate}'\`, // API inputs don't need .value
|
|
141
|
-
catalog: "main",
|
|
142
|
-
schema: "events"
|
|
143
|
-
})`,
|
|
144
|
-
},
|
|
145
|
-
redshift: {
|
|
146
|
-
className: "Redshift",
|
|
147
|
-
pluginId: "redshift",
|
|
148
|
-
description: "Amazon Redshift data warehouse integration",
|
|
149
|
-
typeDefinition: `export class Redshift extends Integration {
|
|
150
|
-
constructor(
|
|
151
|
-
name: string,
|
|
152
|
-
integrationId: string,
|
|
153
|
-
config: {
|
|
154
|
-
statement: Binding<string>;
|
|
155
|
-
/** Optional, defaults to \`false\` */
|
|
156
|
-
enablePooling?: Binding<boolean>;
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
/** Execute SQL statement - returns array of rows */
|
|
161
|
-
async execute(): Promise<any[]>;
|
|
162
|
-
}`,
|
|
163
|
-
example: `new Redshift("GetMetrics", redshiftIntegrationId, {
|
|
164
|
-
statement: ({ startTime }) =>
|
|
165
|
-
\`SELECT * FROM metrics WHERE timestamp > '\${startTime}'\` // API inputs don't need .value
|
|
166
|
-
})`,
|
|
167
|
-
},
|
|
168
|
-
bigquery: {
|
|
169
|
-
className: "BigQuery",
|
|
170
|
-
pluginId: "bigquery",
|
|
171
|
-
description: "Google BigQuery data warehouse integration",
|
|
172
|
-
typeDefinition: `export class BigQuery extends Integration {
|
|
173
|
-
constructor(
|
|
174
|
-
name: string,
|
|
175
|
-
integrationId: string,
|
|
176
|
-
config: {
|
|
177
|
-
sqlBody: Binding<string>;
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
/** Execute SQL statement - returns array of rows */
|
|
182
|
-
async execute(): Promise<any[]>;
|
|
183
|
-
}`,
|
|
184
|
-
example: `new BigQuery("QueryEvents", bigqueryIntegrationId, {
|
|
185
|
-
sqlBody: ({ eventType }) =>
|
|
186
|
-
\`SELECT * FROM \\\`project.dataset.events\\\` WHERE type = '\${eventType}'\`, // API inputs don't need .value
|
|
187
|
-
})`,
|
|
188
|
-
},
|
|
19
|
+
// SQL Databases - most SQL databases are in VERSION_SPECIFIC_TYPE_DEFINITIONS
|
|
20
|
+
// for parameterized queries support (postgres, mysql, mariadb, mssql, snowflake,
|
|
21
|
+
// redshift, bigquery, athena, databricks, oracledb, cockroachdb)
|
|
189
22
|
// NoSQL Databases
|
|
190
23
|
mongodb: {
|
|
191
24
|
className: "MongoDB",
|
|
192
25
|
pluginId: "mongodb",
|
|
193
26
|
description: "MongoDB NoSQL database integration",
|
|
194
|
-
typeDefinition: `
|
|
27
|
+
typeDefinition: `type MongoDBOperation =
|
|
28
|
+
| "aggregate"
|
|
29
|
+
| "count"
|
|
30
|
+
| "deleteOne"
|
|
31
|
+
| "deleteMany"
|
|
32
|
+
| "distinct"
|
|
33
|
+
| "find"
|
|
34
|
+
| "findOne"
|
|
35
|
+
| "insertOne"
|
|
36
|
+
| "insertMany"
|
|
37
|
+
| "listCollections"
|
|
38
|
+
| "replaceOne"
|
|
39
|
+
| "updateOne"
|
|
40
|
+
| "updateMany";
|
|
41
|
+
|
|
42
|
+
export class MongoDB extends Integration {
|
|
195
43
|
constructor(
|
|
196
44
|
name: string,
|
|
197
45
|
integrationId: string,
|
|
198
46
|
config: {
|
|
199
|
-
/** MongoDB operation
|
|
200
|
-
operation: Binding<
|
|
201
|
-
/** Collection name */
|
|
202
|
-
collection
|
|
203
|
-
/** Query filter (JSON) */
|
|
47
|
+
/** MongoDB operation */
|
|
48
|
+
operation: Binding<MongoDBOperation>;
|
|
49
|
+
/** Collection name (not required for listCollections) */
|
|
50
|
+
collection?: Binding<string>;
|
|
51
|
+
/** Query filter (JSON) - for find, findOne, updateOne, updateMany, deleteOne, deleteMany, count, distinct, replaceOne */
|
|
204
52
|
query?: Binding<any>;
|
|
205
|
-
/** Update document (JSON) */
|
|
53
|
+
/** Update document (JSON) - for updateOne, updateMany */
|
|
206
54
|
update?: Binding<any>;
|
|
207
|
-
/**
|
|
55
|
+
/** Replacement document (JSON) - for replaceOne */
|
|
56
|
+
replacement?: Binding<any>;
|
|
57
|
+
/** Document to insert (JSON) - for insertOne */
|
|
208
58
|
document?: Binding<any>;
|
|
209
|
-
/**
|
|
59
|
+
/** Documents to insert (JSON array) - for insertMany */
|
|
60
|
+
documents?: Binding<any[]>;
|
|
61
|
+
/** Aggregation pipeline (JSON array) - for aggregate */
|
|
210
62
|
pipeline?: Binding<any[]>;
|
|
63
|
+
/** Field name - for distinct */
|
|
64
|
+
field?: Binding<string>;
|
|
211
65
|
/** Options (JSON) */
|
|
212
66
|
options?: Binding<any>;
|
|
213
67
|
}
|
|
@@ -216,50 +70,87 @@ export const INTEGRATION_TYPE_DEFINITIONS = {
|
|
|
216
70
|
/** Execute MongoDB operation */
|
|
217
71
|
async execute(): Promise<any>;
|
|
218
72
|
}`,
|
|
219
|
-
example:
|
|
73
|
+
example: `// Find documents
|
|
74
|
+
new MongoDB("FindUsers", mongoIntegrationId, {
|
|
220
75
|
operation: "find",
|
|
221
76
|
collection: "users",
|
|
222
77
|
query: { status: "active" },
|
|
223
78
|
options: { limit: 10 }
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// List collections in database
|
|
82
|
+
new MongoDB("ListCollections", mongoIntegrationId, {
|
|
83
|
+
operation: "listCollections"
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// Replace a document
|
|
87
|
+
new MongoDB("ReplaceUser", mongoIntegrationId, {
|
|
88
|
+
operation: "replaceOne",
|
|
89
|
+
collection: "users",
|
|
90
|
+
query: ({ userId }) => ({ _id: userId }),
|
|
91
|
+
replacement: ({ userData }) => userData
|
|
224
92
|
})`,
|
|
225
93
|
},
|
|
226
94
|
dynamodb: {
|
|
227
|
-
className: "
|
|
95
|
+
className: "DynamoDb",
|
|
228
96
|
pluginId: "dynamodb",
|
|
229
97
|
description: "Amazon DynamoDB NoSQL database integration",
|
|
230
|
-
typeDefinition: `
|
|
98
|
+
typeDefinition: `type DynamoDbAction =
|
|
99
|
+
| "getItem"
|
|
100
|
+
| "updateItem"
|
|
101
|
+
| "putItem"
|
|
102
|
+
| "deleteItem"
|
|
103
|
+
| "query"
|
|
104
|
+
| "scan"
|
|
105
|
+
| "executeStatement"
|
|
106
|
+
| "executeTransaction"
|
|
107
|
+
| "listTagsOfResource"
|
|
108
|
+
| "tagResource"
|
|
109
|
+
| "listTables"
|
|
110
|
+
| "describeTable"
|
|
111
|
+
| "createTable"
|
|
112
|
+
| "updateTable"
|
|
113
|
+
| "deleteTable"
|
|
114
|
+
| "batchWriteItem";
|
|
115
|
+
|
|
116
|
+
export class DynamoDb extends Integration {
|
|
231
117
|
constructor(
|
|
232
118
|
name: string,
|
|
233
119
|
integrationId: string,
|
|
234
120
|
config: {
|
|
235
|
-
/** DynamoDB
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
/** Update expression */
|
|
244
|
-
updateExpression?: Binding<string>;
|
|
245
|
-
/** Expression attribute names */
|
|
246
|
-
expressionAttributeNames?: Binding<any>;
|
|
247
|
-
/** Expression attribute values */
|
|
248
|
-
expressionAttributeValues?: Binding<any>;
|
|
249
|
-
/** Key condition expression for query */
|
|
250
|
-
keyConditionExpression?: Binding<string>;
|
|
251
|
-
/** Filter expression */
|
|
252
|
-
filterExpression?: Binding<string>;
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
/** Execute DynamoDB operation */
|
|
121
|
+
/** DynamoDB action to perform */
|
|
122
|
+
action: DynamoDbAction;
|
|
123
|
+
/** Request parameters as a JSON string - structure depends on the action */
|
|
124
|
+
paramsJson: Binding<string>;
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
/** Execute DynamoDB action */
|
|
257
129
|
async execute(): Promise<any>;
|
|
258
130
|
}`,
|
|
259
|
-
example:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
131
|
+
example: `// Get an item
|
|
132
|
+
new DynamoDb("GetItem", dynamoIntegrationId, {
|
|
133
|
+
action: "getItem",
|
|
134
|
+
paramsJson: ({ userId }) => JSON.stringify({
|
|
135
|
+
TableName: "users",
|
|
136
|
+
Key: { userId: { S: userId } }
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Query items
|
|
141
|
+
new DynamoDb("QueryUsers", dynamoIntegrationId, {
|
|
142
|
+
action: "query",
|
|
143
|
+
paramsJson: JSON.stringify({
|
|
144
|
+
TableName: "users",
|
|
145
|
+
KeyConditionExpression: "pk = :pk",
|
|
146
|
+
ExpressionAttributeValues: { ":pk": { S: "USER" } }
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// List tables
|
|
151
|
+
new DynamoDb("ListTables", dynamoIntegrationId, {
|
|
152
|
+
action: "listTables",
|
|
153
|
+
paramsJson: "{}"
|
|
263
154
|
})`,
|
|
264
155
|
},
|
|
265
156
|
// REST API (ad-hoc, no preconfigured integration)
|
|
@@ -307,13 +198,16 @@ new RestApi("CreateUser", myRestApiIntegrationId, {
|
|
|
307
198
|
})`,
|
|
308
199
|
},
|
|
309
200
|
// GraphQL
|
|
201
|
+
// GraphQL - requires a preconfigured GraphQL integration
|
|
202
|
+
// Note: Unlike REST API, there is no ad-hoc GraphQL support. You must use a preconfigured integration.
|
|
310
203
|
graphql: {
|
|
311
204
|
className: "GraphQL",
|
|
312
205
|
pluginId: "graphql",
|
|
313
|
-
description: "GraphQL API integration",
|
|
206
|
+
description: "GraphQL API integration. Requires a preconfigured GraphQL integration - there is no ad-hoc GraphQL support like with REST APIs.",
|
|
314
207
|
typeDefinition: `export class GraphQL extends Integration {
|
|
315
208
|
constructor(
|
|
316
209
|
name: string,
|
|
210
|
+
/** ID of a preconfigured GraphQL integration - ad-hoc GraphQL is not supported */
|
|
317
211
|
integrationId: string,
|
|
318
212
|
config: {
|
|
319
213
|
/** GraphQL query or mutation */
|
|
@@ -328,7 +222,8 @@ new RestApi("CreateUser", myRestApiIntegrationId, {
|
|
|
328
222
|
/** Execute GraphQL request */
|
|
329
223
|
async execute(): Promise<{ data: any; errors?: any[] }>;
|
|
330
224
|
}`,
|
|
331
|
-
example:
|
|
225
|
+
example: `// Requires a preconfigured GraphQL integration - pass the integration ID
|
|
226
|
+
new GraphQL("GetUser", graphqlIntegrationId, {
|
|
332
227
|
query: \`
|
|
333
228
|
query GetUser($id: ID!) {
|
|
334
229
|
user(id: $id) {
|
|
@@ -338,6 +233,42 @@ new RestApi("CreateUser", myRestApiIntegrationId, {
|
|
|
338
233
|
}
|
|
339
234
|
}
|
|
340
235
|
\`,
|
|
236
|
+
variables: ({ userId }) => JSON.stringify({ id: userId })
|
|
237
|
+
})`,
|
|
238
|
+
},
|
|
239
|
+
// GraphQL Integration (extends GraphQL for managed integrations)
|
|
240
|
+
graphqlintegration: {
|
|
241
|
+
className: "GraphQLIntegration",
|
|
242
|
+
pluginId: "graphqlintegration",
|
|
243
|
+
description: "Managed GraphQL integration for third-party services. Requires a preconfigured GraphQL integration.",
|
|
244
|
+
typeDefinition: `export class GraphQLIntegration extends GraphQL {
|
|
245
|
+
constructor(
|
|
246
|
+
name: string,
|
|
247
|
+
/** ID of a preconfigured GraphQL integration */
|
|
248
|
+
integrationId: string,
|
|
249
|
+
config: {
|
|
250
|
+
/** GraphQL query or mutation */
|
|
251
|
+
query: Binding<string>;
|
|
252
|
+
/** Query variables as a JSON string */
|
|
253
|
+
variables?: Binding<string>;
|
|
254
|
+
/** Additional headers */
|
|
255
|
+
headers?: { key: Binding<string>; value: Binding<string> }[];
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
/** Execute GraphQL request */
|
|
260
|
+
async execute(): Promise<{ data: any; errors?: any[] }>;
|
|
261
|
+
}`,
|
|
262
|
+
example: `new GraphQLIntegration("GetData", graphqlIntegrationId, {
|
|
263
|
+
query: \`
|
|
264
|
+
query GetData($id: ID!) {
|
|
265
|
+
resource(id: $id) {
|
|
266
|
+
id
|
|
267
|
+
name
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
\`,
|
|
271
|
+
variables: ({ resourceId }) => JSON.stringify({ id: resourceId })
|
|
341
272
|
})`,
|
|
342
273
|
},
|
|
343
274
|
// Cloud Storage
|
|
@@ -417,6 +348,7 @@ new S3("GetUploadUrl", s3IntegrationId, {
|
|
|
417
348
|
}
|
|
418
349
|
})`,
|
|
419
350
|
},
|
|
351
|
+
// Google Cloud Storage
|
|
420
352
|
gcs: {
|
|
421
353
|
className: "GoogleCloudStorage",
|
|
422
354
|
pluginId: "gcs",
|
|
@@ -440,31 +372,57 @@ export class GoogleCloudStorage extends Integration {
|
|
|
440
372
|
name: string,
|
|
441
373
|
integrationId: string,
|
|
442
374
|
config: {
|
|
443
|
-
|
|
444
|
-
action: Binding<GCSAction>;
|
|
375
|
+
action: GCSAction;
|
|
445
376
|
/** Bucket name */
|
|
446
377
|
resource?: Binding<string>;
|
|
447
|
-
/** File path/name */
|
|
378
|
+
/** File path/name within the bucket */
|
|
448
379
|
path?: Binding<string>;
|
|
380
|
+
/** For LIST_OBJECTS or LIST_BUCKETS: filter by prefix */
|
|
381
|
+
prefix?: Binding<string>;
|
|
449
382
|
/** For UPLOAD_OBJECT: file content as string */
|
|
450
383
|
body?: Binding<string>;
|
|
451
384
|
/** For UPLOAD_MULTIPLE_OBJECTS: pass file objects directly from input.
|
|
452
|
-
* Example: fileObjects: ({ files }) => files.files
|
|
453
|
-
* The GCS plugin internally calls readContents() and converts to the required format. */
|
|
385
|
+
* Example: fileObjects: ({ files }) => files.files */
|
|
454
386
|
fileObjects?: Binding<GCSFileObject[]>;
|
|
455
|
-
/**
|
|
456
|
-
|
|
387
|
+
/** For GET_OBJECT: response type */
|
|
388
|
+
responseType?: "AUTO" | "JSON" | "TEXT" | "BINARY";
|
|
389
|
+
/** Custom properties for GENERATE_PRESIGNED_URL */
|
|
390
|
+
custom?: {
|
|
391
|
+
presignedExpiration?: { value: number };
|
|
392
|
+
};
|
|
457
393
|
}
|
|
458
394
|
);
|
|
459
395
|
|
|
460
396
|
/** Execute GCS operation */
|
|
461
397
|
async execute(): Promise<any>;
|
|
462
398
|
}`,
|
|
463
|
-
example: `//
|
|
399
|
+
example: `// List files in a bucket
|
|
400
|
+
new GoogleCloudStorage("ListFiles", gcsIntegrationId, {
|
|
401
|
+
action: "LIST_OBJECTS",
|
|
402
|
+
resource: "my-bucket",
|
|
403
|
+
prefix: "uploads/"
|
|
404
|
+
})
|
|
405
|
+
|
|
406
|
+
// Read a file
|
|
407
|
+
new GoogleCloudStorage("ReadFile", gcsIntegrationId, {
|
|
408
|
+
action: "GET_OBJECT",
|
|
409
|
+
resource: "my-bucket",
|
|
410
|
+
path: "data/config.json"
|
|
411
|
+
})
|
|
412
|
+
|
|
413
|
+
// Upload a file
|
|
414
|
+
new GoogleCloudStorage("UploadFile", gcsIntegrationId, {
|
|
415
|
+
action: "UPLOAD_OBJECT",
|
|
416
|
+
resource: ({ bucketName }) => bucketName,
|
|
417
|
+
path: ({ fileName }) => \`uploads/\${fileName}\`,
|
|
418
|
+
body: ({ fileContent }) => fileContent
|
|
419
|
+
})
|
|
420
|
+
|
|
421
|
+
// Upload multiple files
|
|
464
422
|
new GoogleCloudStorage("UploadFiles", gcsIntegrationId, {
|
|
465
423
|
action: "UPLOAD_MULTIPLE_OBJECTS",
|
|
466
424
|
resource: ({ bucket }) => bucket,
|
|
467
|
-
fileObjects: ({ files }) => files.files
|
|
425
|
+
fileObjects: ({ files }) => files.files
|
|
468
426
|
})`,
|
|
469
427
|
},
|
|
470
428
|
// Email
|
|
@@ -559,36 +517,6 @@ df = pd.DataFrame(data)
|
|
|
559
517
|
summary = df.describe().to_dict()
|
|
560
518
|
return json.dumps(summary)
|
|
561
519
|
\`
|
|
562
|
-
})`,
|
|
563
|
-
},
|
|
564
|
-
// Workflow
|
|
565
|
-
workflow: {
|
|
566
|
-
className: "Workflow",
|
|
567
|
-
pluginId: "workflow",
|
|
568
|
-
description: "Superblocks workflow execution",
|
|
569
|
-
typeDefinition: `export class Workflow extends Integration {
|
|
570
|
-
constructor(
|
|
571
|
-
name: string,
|
|
572
|
-
integrationId: string,
|
|
573
|
-
config: {
|
|
574
|
-
/** Workflow to execute */
|
|
575
|
-
workflow: Binding<string>;
|
|
576
|
-
/** Input parameters */
|
|
577
|
-
inputs?: Binding<Record<string, any>>;
|
|
578
|
-
/** Execution environment */
|
|
579
|
-
environment?: Binding<string>;
|
|
580
|
-
}
|
|
581
|
-
);
|
|
582
|
-
|
|
583
|
-
/** Execute workflow */
|
|
584
|
-
async execute(): Promise<any>;
|
|
585
|
-
}`,
|
|
586
|
-
example: `new Workflow("RunETL", workflowIntegrationId, {
|
|
587
|
-
workflow: "data-etl-pipeline",
|
|
588
|
-
inputs: ({ startDate, endDate }) => ({
|
|
589
|
-
startDate: startDate,
|
|
590
|
-
endDate: endDate
|
|
591
|
-
})
|
|
592
520
|
})`,
|
|
593
521
|
},
|
|
594
522
|
// Salesforce
|
|
@@ -641,15 +569,22 @@ export declare class Salesforce extends Integration {
|
|
|
641
569
|
},
|
|
642
570
|
);
|
|
643
571
|
|
|
644
|
-
/** Execute
|
|
645
|
-
|
|
572
|
+
/** Execute Salesforce action
|
|
573
|
+
* SOQL queries return an array of records directly (NOT wrapped in { records: [...] })
|
|
574
|
+
* CRUD actions return the affected record(s)
|
|
575
|
+
*/
|
|
576
|
+
async execute(): Promise<any[]>;
|
|
646
577
|
}
|
|
647
578
|
`,
|
|
648
|
-
example:
|
|
579
|
+
example: `// SOQL Query - returns array directly
|
|
580
|
+
new Salesforce("GetAccounts", salesforceIntegrationId, {
|
|
649
581
|
action: {
|
|
650
582
|
action: "SOQL_ACTION_SOQL",
|
|
651
583
|
soqlBody: "SELECT Id, Name FROM Account WHERE Industry = 'Technology'"
|
|
652
|
-
}
|
|
584
|
+
}
|
|
585
|
+
})
|
|
586
|
+
// Output: [{ Id: "001...", Name: "Acme" }, { Id: "001...", Name: "TechCorp" }]
|
|
587
|
+
// Access: GetAccounts.output is the array directly, use Array.isArray() to check`,
|
|
653
588
|
},
|
|
654
589
|
// Generic OpenAPI
|
|
655
590
|
restapiintegration: {
|
|
@@ -691,34 +626,844 @@ export declare class Salesforce extends Integration {
|
|
|
691
626
|
// Add more integrations as needed...
|
|
692
627
|
};
|
|
693
628
|
/**
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
|
|
697
|
-
export function createExtendedPluginTypeDefinition(plugin, basePluginId, description = `${plugin.id} API integration`) {
|
|
698
|
-
const predefined = INTEGRATION_TYPE_DEFINITIONS[basePluginId];
|
|
699
|
-
if (!predefined)
|
|
700
|
-
return undefined;
|
|
701
|
-
// Replace "BaseClass extends ParentClass" with "DerivedClass extends BaseClass"
|
|
702
|
-
const regex = new RegExp(`\\b${predefined.className}\\s+extends\\s+\\w+`, "g");
|
|
703
|
-
const className = pluginIdToSdkClassName(plugin.id);
|
|
704
|
-
const updatedTypeDef = predefined.typeDefinition.replace(regex, `${className} extends ${predefined.className}`);
|
|
705
|
-
const updatedExample = predefined.example
|
|
706
|
-
? predefined.example.replace(new RegExp(`new\\s+${predefined.className}\\b`, "g"), `new ${className}`)
|
|
707
|
-
: undefined;
|
|
708
|
-
return {
|
|
709
|
-
className,
|
|
710
|
-
pluginId: plugin.id,
|
|
711
|
-
description,
|
|
712
|
-
typeDefinition: updatedTypeDef,
|
|
713
|
-
example: updatedExample,
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Get type definition for a specific integration by its plugin ID.
|
|
718
|
-
* For OpenAPI-derived plugins not in the predefined list, generates a definition using the template.
|
|
629
|
+
* Version-specific type definitions for plugins that have different APIs based on version.
|
|
630
|
+
* The key format is "pluginId:minVersion" where minVersion is the minimum version for that definition.
|
|
631
|
+
* Definitions are checked in order, so more specific versions should come first.
|
|
719
632
|
*/
|
|
720
|
-
export
|
|
721
|
-
//
|
|
633
|
+
export const VERSION_SPECIFIC_TYPE_DEFINITIONS = [
|
|
634
|
+
// PostgreSQL 0.0.12+ uses run_sql with parameters
|
|
635
|
+
{
|
|
636
|
+
pluginId: "postgres",
|
|
637
|
+
minVersion: "0.0.12",
|
|
638
|
+
definition: {
|
|
639
|
+
className: "PostgreSQL",
|
|
640
|
+
pluginId: "postgres",
|
|
641
|
+
description: "PostgreSQL database integration (v0.0.12+)",
|
|
642
|
+
typeDefinition: `export class PostgreSQL extends Integration {
|
|
643
|
+
constructor(
|
|
644
|
+
name: string,
|
|
645
|
+
integrationId: string,
|
|
646
|
+
config: {
|
|
647
|
+
statement: Binding<string>;
|
|
648
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
649
|
+
parameters: Binding<string>;
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
|
|
653
|
+
/** Execute SQL statement - returns array of rows */
|
|
654
|
+
async execute(): Promise<any[]>;
|
|
655
|
+
}`,
|
|
656
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
657
|
+
new PostgreSQL("GetUsers", postgresIntegrationId, {
|
|
658
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
659
|
+
\`SELECT * FROM users WHERE status = $1 OFFSET $2 LIMIT $3\`,
|
|
660
|
+
parameters: "[statusFilter, offset, limit]"
|
|
661
|
+
})
|
|
662
|
+
|
|
663
|
+
// Mixed pattern - binding function for dynamic SQL + parameters for safe values
|
|
664
|
+
new PostgreSQL("GetUsersByTable", postgresIntegrationId, {
|
|
665
|
+
statement: ({ tableName, statusFilter }: { tableName: string; statusFilter: string }) =>
|
|
666
|
+
\`SELECT * FROM \${tableName} WHERE status = $1\`,
|
|
667
|
+
parameters: "[statusFilter]"
|
|
668
|
+
})
|
|
669
|
+
|
|
670
|
+
// Array handling - use = ANY() for WHERE IN queries with arrays
|
|
671
|
+
new PostgreSQL("GetUsersByIds", postgresIntegrationId, {
|
|
672
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
673
|
+
\`SELECT * FROM users WHERE id = ANY($1::int[])\`, // Cast to appropriate array type
|
|
674
|
+
parameters: "[userIds]" // userIds should be an array like [1, 2, 3]
|
|
675
|
+
})
|
|
676
|
+
|
|
677
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
678
|
+
new PostgreSQL("SortedUsers", postgresIntegrationId, {
|
|
679
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
680
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
681
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
682
|
+
})`,
|
|
683
|
+
},
|
|
684
|
+
},
|
|
685
|
+
// PostgreSQL < 0.0.12 uses run_sql with usePreparedSql
|
|
686
|
+
{
|
|
687
|
+
pluginId: "postgres",
|
|
688
|
+
minVersion: "0.0.0",
|
|
689
|
+
definition: {
|
|
690
|
+
className: "PostgreSQL",
|
|
691
|
+
pluginId: "postgres",
|
|
692
|
+
description: "PostgreSQL database integration (legacy)",
|
|
693
|
+
typeDefinition: `export class PostgreSQL extends Integration {
|
|
694
|
+
constructor(
|
|
695
|
+
name: string,
|
|
696
|
+
integrationId: string,
|
|
697
|
+
config: {
|
|
698
|
+
statement: Binding<string>;
|
|
699
|
+
/** Operation type - run_sql is the legacy format */
|
|
700
|
+
operation?: "run_sql";
|
|
701
|
+
/** Whether to use prepared statements (legacy) */
|
|
702
|
+
usePreparedSql?: boolean;
|
|
703
|
+
}
|
|
704
|
+
);
|
|
705
|
+
|
|
706
|
+
/** Execute SQL statement - returns array of rows */
|
|
707
|
+
async execute(): Promise<any[]>;
|
|
708
|
+
}`,
|
|
709
|
+
example: `new PostgreSQL("GetUsers", postgresIntegrationId, {
|
|
710
|
+
statement: ({ statusFilter }: { statusFilter: string }) =>
|
|
711
|
+
\`SELECT * FROM users WHERE status = '\${statusFilter}'\`,
|
|
712
|
+
usePreparedSql: true // Optional: use prepared statements
|
|
713
|
+
})`,
|
|
714
|
+
},
|
|
715
|
+
},
|
|
716
|
+
// MySQL 0.0.12+ uses run_sql with parameters (? placeholders)
|
|
717
|
+
{
|
|
718
|
+
pluginId: "mysql",
|
|
719
|
+
minVersion: "0.0.12",
|
|
720
|
+
definition: {
|
|
721
|
+
className: "MySQL",
|
|
722
|
+
pluginId: "mysql",
|
|
723
|
+
description: "MySQL database integration (v0.0.12+)",
|
|
724
|
+
typeDefinition: `export class MySQL extends Integration {
|
|
725
|
+
constructor(
|
|
726
|
+
name: string,
|
|
727
|
+
integrationId: string,
|
|
728
|
+
config: {
|
|
729
|
+
statement: Binding<string>;
|
|
730
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
731
|
+
parameters: Binding<string>;
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
|
|
735
|
+
/** Execute SQL statement - returns array of rows */
|
|
736
|
+
async execute(): Promise<any[]>;
|
|
737
|
+
}`,
|
|
738
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
739
|
+
new MySQL("GetUsers", mysqlIntegrationId, {
|
|
740
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
741
|
+
\`SELECT * FROM users WHERE status = ? OFFSET ? LIMIT ?\`,
|
|
742
|
+
parameters: "[statusFilter, offset, limit]"
|
|
743
|
+
})
|
|
744
|
+
|
|
745
|
+
// Array handling - use FIND_IN_SET for WHERE IN queries with comma-separated values
|
|
746
|
+
new MySQL("GetUsersByIds", mysqlIntegrationId, {
|
|
747
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
748
|
+
\`SELECT * FROM users WHERE FIND_IN_SET(id, ?)\`,
|
|
749
|
+
parameters: "[userIds.join(',')]" // Convert array to comma-separated string
|
|
750
|
+
})
|
|
751
|
+
|
|
752
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
753
|
+
new MySQL("SortedUsers", mysqlIntegrationId, {
|
|
754
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
755
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
756
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
757
|
+
})`,
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
// MySQL < 0.0.12 uses run_sql with usePreparedSql
|
|
761
|
+
{
|
|
762
|
+
pluginId: "mysql",
|
|
763
|
+
minVersion: "0.0.0",
|
|
764
|
+
definition: {
|
|
765
|
+
className: "MySQL",
|
|
766
|
+
pluginId: "mysql",
|
|
767
|
+
description: "MySQL database integration (legacy)",
|
|
768
|
+
typeDefinition: `export class MySQL extends Integration {
|
|
769
|
+
constructor(
|
|
770
|
+
name: string,
|
|
771
|
+
integrationId: string,
|
|
772
|
+
config: {
|
|
773
|
+
statement: Binding<string>;
|
|
774
|
+
}
|
|
775
|
+
);
|
|
776
|
+
|
|
777
|
+
/** Execute SQL statement - returns array of rows */
|
|
778
|
+
async execute(): Promise<any[]>;
|
|
779
|
+
}`,
|
|
780
|
+
example: `new MySQL("GetOrders", mysqlIntegrationId, {
|
|
781
|
+
statement: ({ customerId }) =>
|
|
782
|
+
\`SELECT * FROM orders WHERE customer_id = \${customerId}\`
|
|
783
|
+
})`,
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
// MariaDB 0.0.12+ uses run_sql with parameters (? placeholders)
|
|
787
|
+
{
|
|
788
|
+
pluginId: "mariadb",
|
|
789
|
+
minVersion: "0.0.12",
|
|
790
|
+
definition: {
|
|
791
|
+
className: "MariaDB",
|
|
792
|
+
pluginId: "mariadb",
|
|
793
|
+
description: "MariaDB database integration (v0.0.12+)",
|
|
794
|
+
typeDefinition: `export class MariaDB extends Integration {
|
|
795
|
+
constructor(
|
|
796
|
+
name: string,
|
|
797
|
+
integrationId: string,
|
|
798
|
+
config: {
|
|
799
|
+
statement: Binding<string>;
|
|
800
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
801
|
+
parameters: Binding<string>;
|
|
802
|
+
}
|
|
803
|
+
);
|
|
804
|
+
|
|
805
|
+
/** Execute SQL statement - returns array of rows */
|
|
806
|
+
async execute(): Promise<any[]>;
|
|
807
|
+
}`,
|
|
808
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
809
|
+
new MariaDB("GetUsers", mariadbIntegrationId, {
|
|
810
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
811
|
+
\`SELECT * FROM users WHERE status = ? OFFSET ? LIMIT ?\`,
|
|
812
|
+
parameters: "[statusFilter, offset, limit]"
|
|
813
|
+
})
|
|
814
|
+
|
|
815
|
+
// Array handling - use FIND_IN_SET for WHERE IN queries with comma-separated values
|
|
816
|
+
new MariaDB("GetUsersByIds", mariadbIntegrationId, {
|
|
817
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
818
|
+
\`SELECT * FROM users WHERE FIND_IN_SET(id, ?)\`,
|
|
819
|
+
parameters: "[userIds.join(',')]" // Convert array to comma-separated string
|
|
820
|
+
})
|
|
821
|
+
|
|
822
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
823
|
+
new MariaDB("SortedUsers", mariadbIntegrationId, {
|
|
824
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
825
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
826
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
827
|
+
})`,
|
|
828
|
+
},
|
|
829
|
+
},
|
|
830
|
+
// MariaDB < 0.0.12 uses run_sql with usePreparedSql
|
|
831
|
+
{
|
|
832
|
+
pluginId: "mariadb",
|
|
833
|
+
minVersion: "0.0.0",
|
|
834
|
+
definition: {
|
|
835
|
+
className: "MariaDB",
|
|
836
|
+
pluginId: "mariadb",
|
|
837
|
+
description: "MariaDB database integration (legacy)",
|
|
838
|
+
typeDefinition: `export class MariaDB extends Integration {
|
|
839
|
+
constructor(
|
|
840
|
+
name: string,
|
|
841
|
+
integrationId: string,
|
|
842
|
+
config: {
|
|
843
|
+
statement: Binding<string>;
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
|
|
847
|
+
/** Execute SQL statement - returns array of rows */
|
|
848
|
+
async execute(): Promise<any[]>;
|
|
849
|
+
}`,
|
|
850
|
+
example: `new MariaDB("GetOrders", mariadbIntegrationId, {
|
|
851
|
+
statement: ({ customerId }) =>
|
|
852
|
+
\`SELECT * FROM orders WHERE customer_id = \${customerId}\`
|
|
853
|
+
})`,
|
|
854
|
+
},
|
|
855
|
+
},
|
|
856
|
+
// Microsoft SQL Server 0.0.11+ uses run_sql with parameters (@p1, @p2 placeholders)
|
|
857
|
+
{
|
|
858
|
+
pluginId: "mssql",
|
|
859
|
+
minVersion: "0.0.11",
|
|
860
|
+
definition: {
|
|
861
|
+
className: "MicrosoftSql",
|
|
862
|
+
pluginId: "mssql",
|
|
863
|
+
description: "Microsoft SQL Server integration (v0.0.11+)",
|
|
864
|
+
typeDefinition: `export class MicrosoftSql extends Integration {
|
|
865
|
+
constructor(
|
|
866
|
+
name: string,
|
|
867
|
+
integrationId: string,
|
|
868
|
+
config: {
|
|
869
|
+
statement: Binding<string>;
|
|
870
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
871
|
+
parameters: Binding<string>;
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
|
|
875
|
+
/** Execute SQL statement - returns array of rows */
|
|
876
|
+
async execute(): Promise<any[]>;
|
|
877
|
+
}`,
|
|
878
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
879
|
+
new MicrosoftSql("GetUsers", mssqlIntegrationId, {
|
|
880
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
881
|
+
\`SELECT * FROM users WHERE status = @PARAM_1 OFFSET @PARAM_2 ROWS FETCH NEXT @PARAM_3 ROWS ONLY\`,
|
|
882
|
+
parameters: "[statusFilter, offset, limit]"
|
|
883
|
+
})
|
|
884
|
+
|
|
885
|
+
// Array handling - use STRING_SPLIT for WHERE IN queries with comma-separated values
|
|
886
|
+
new MicrosoftSql("GetUsersByIds", mssqlIntegrationId, {
|
|
887
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
888
|
+
\`SELECT * FROM users WHERE id IN (SELECT value FROM STRING_SPLIT(@PARAM_1, ','))\`,
|
|
889
|
+
parameters: "[userIds.join(',')]" // Convert array to comma-separated string
|
|
890
|
+
})
|
|
891
|
+
|
|
892
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
893
|
+
new MicrosoftSql("SortedUsers", mssqlIntegrationId, {
|
|
894
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
895
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
896
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
897
|
+
})`,
|
|
898
|
+
},
|
|
899
|
+
},
|
|
900
|
+
// Microsoft SQL Server < 0.0.11 uses run_sql with usePreparedSql
|
|
901
|
+
{
|
|
902
|
+
pluginId: "mssql",
|
|
903
|
+
minVersion: "0.0.0",
|
|
904
|
+
definition: {
|
|
905
|
+
className: "MicrosoftSql",
|
|
906
|
+
pluginId: "mssql",
|
|
907
|
+
description: "Microsoft SQL Server integration (legacy)",
|
|
908
|
+
typeDefinition: `export class MicrosoftSql extends Integration {
|
|
909
|
+
constructor(
|
|
910
|
+
name: string,
|
|
911
|
+
integrationId: string,
|
|
912
|
+
config: {
|
|
913
|
+
statement: Binding<string>;
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
|
|
917
|
+
/** Execute SQL statement - returns array of rows */
|
|
918
|
+
async execute(): Promise<any[]>;
|
|
919
|
+
}`,
|
|
920
|
+
example: `new MicrosoftSql("GetProducts", mssqlIntegrationId, {
|
|
921
|
+
statement: ({ minPrice }) =>
|
|
922
|
+
\`SELECT * FROM products WHERE price > \${minPrice}\`
|
|
923
|
+
})`,
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
// Snowflake 0.0.11+ uses run_sql with parameters (? placeholders)
|
|
927
|
+
{
|
|
928
|
+
pluginId: "snowflake",
|
|
929
|
+
minVersion: "0.0.11",
|
|
930
|
+
definition: {
|
|
931
|
+
className: "Snowflake",
|
|
932
|
+
pluginId: "snowflake",
|
|
933
|
+
description: "Snowflake data warehouse integration (v0.0.11+)",
|
|
934
|
+
typeDefinition: `export class Snowflake extends Integration {
|
|
935
|
+
constructor(
|
|
936
|
+
name: string,
|
|
937
|
+
integrationId: string,
|
|
938
|
+
config: {
|
|
939
|
+
statement: Binding<string>;
|
|
940
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
941
|
+
parameters: Binding<string>;
|
|
942
|
+
}
|
|
943
|
+
);
|
|
944
|
+
|
|
945
|
+
/** Execute SQL statement - returns array of rows */
|
|
946
|
+
async execute(): Promise<any[]>;
|
|
947
|
+
}`,
|
|
948
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
949
|
+
new Snowflake("GetUsers", snowflakeIntegrationId, {
|
|
950
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
951
|
+
\`SELECT * FROM users WHERE status = ? OFFSET ? LIMIT ?\`,
|
|
952
|
+
parameters: "[statusFilter, offset, limit]"
|
|
953
|
+
})
|
|
954
|
+
|
|
955
|
+
// Array handling - use ARRAY_CONTAINS with PARSE_JSON for WHERE IN queries
|
|
956
|
+
new Snowflake("GetUsersByCities", snowflakeIntegrationId, {
|
|
957
|
+
statement: ({ selectedCities }: { selectedCities: string[] }) =>
|
|
958
|
+
\`SELECT * FROM users WHERE ARRAY_CONTAINS(city::variant, PARSE_JSON(?))\`,
|
|
959
|
+
parameters: "[JSON.stringify(selectedCities)]" // Pass array as JSON string
|
|
960
|
+
})
|
|
961
|
+
|
|
962
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
963
|
+
new Snowflake("SortedUsers", snowflakeIntegrationId, {
|
|
964
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
965
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
966
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
967
|
+
})`,
|
|
968
|
+
},
|
|
969
|
+
},
|
|
970
|
+
// Snowflake < 0.0.11 uses legacy format
|
|
971
|
+
{
|
|
972
|
+
pluginId: "snowflake",
|
|
973
|
+
minVersion: "0.0.0",
|
|
974
|
+
definition: {
|
|
975
|
+
className: "Snowflake",
|
|
976
|
+
pluginId: "snowflake",
|
|
977
|
+
description: "Snowflake data warehouse integration (legacy)",
|
|
978
|
+
typeDefinition: `export class Snowflake extends Integration {
|
|
979
|
+
constructor(
|
|
980
|
+
name: string,
|
|
981
|
+
integrationId: string,
|
|
982
|
+
config: {
|
|
983
|
+
statement: Binding<string>;
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
|
|
987
|
+
/** Execute SQL statement - returns array of rows */
|
|
988
|
+
async execute(): Promise<any[]>;
|
|
989
|
+
}`,
|
|
990
|
+
example: `new Snowflake("GetSales", snowflakeIntegrationId, {
|
|
991
|
+
statement: ({ region }) =>
|
|
992
|
+
\`SELECT * FROM sales WHERE region = '\${region}'\`
|
|
993
|
+
})`,
|
|
994
|
+
},
|
|
995
|
+
},
|
|
996
|
+
// Redshift 0.0.8+ uses run_sql with parameters ($1, $2 placeholders)
|
|
997
|
+
{
|
|
998
|
+
pluginId: "redshift",
|
|
999
|
+
minVersion: "0.0.8",
|
|
1000
|
+
definition: {
|
|
1001
|
+
className: "Redshift",
|
|
1002
|
+
pluginId: "redshift",
|
|
1003
|
+
description: "Amazon Redshift integration (v0.0.8+)",
|
|
1004
|
+
typeDefinition: `export class Redshift extends Integration {
|
|
1005
|
+
constructor(
|
|
1006
|
+
name: string,
|
|
1007
|
+
integrationId: string,
|
|
1008
|
+
config: {
|
|
1009
|
+
statement: Binding<string>;
|
|
1010
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
1011
|
+
parameters: Binding<string>;
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
|
|
1015
|
+
/** Execute SQL statement - returns array of rows */
|
|
1016
|
+
async execute(): Promise<any[]>;
|
|
1017
|
+
}`,
|
|
1018
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
1019
|
+
new Redshift("GetUsers", redshiftIntegrationId, {
|
|
1020
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
1021
|
+
\`SELECT * FROM users WHERE status = $1 OFFSET $2 LIMIT $3\`,
|
|
1022
|
+
parameters: "[statusFilter, offset, limit]"
|
|
1023
|
+
})
|
|
1024
|
+
|
|
1025
|
+
// Array handling - use = ANY() for WHERE IN queries with arrays (PostgreSQL-compatible)
|
|
1026
|
+
new Redshift("GetUsersByIds", redshiftIntegrationId, {
|
|
1027
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
1028
|
+
\`SELECT * FROM users WHERE id = ANY($1::int[])\`,
|
|
1029
|
+
parameters: "[userIds]" // Pass array directly
|
|
1030
|
+
})
|
|
1031
|
+
|
|
1032
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
1033
|
+
new Redshift("SortedUsers", redshiftIntegrationId, {
|
|
1034
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
1035
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
1036
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
1037
|
+
})`,
|
|
1038
|
+
},
|
|
1039
|
+
},
|
|
1040
|
+
// Redshift < 0.0.8 uses legacy format
|
|
1041
|
+
{
|
|
1042
|
+
pluginId: "redshift",
|
|
1043
|
+
minVersion: "0.0.0",
|
|
1044
|
+
definition: {
|
|
1045
|
+
className: "Redshift",
|
|
1046
|
+
pluginId: "redshift",
|
|
1047
|
+
description: "Amazon Redshift integration (legacy)",
|
|
1048
|
+
typeDefinition: `export class Redshift extends Integration {
|
|
1049
|
+
constructor(
|
|
1050
|
+
name: string,
|
|
1051
|
+
integrationId: string,
|
|
1052
|
+
config: {
|
|
1053
|
+
statement: Binding<string>;
|
|
1054
|
+
}
|
|
1055
|
+
);
|
|
1056
|
+
|
|
1057
|
+
/** Execute SQL statement - returns array of rows */
|
|
1058
|
+
async execute(): Promise<any[]>;
|
|
1059
|
+
}`,
|
|
1060
|
+
example: `new Redshift("GetAnalytics", redshiftIntegrationId, {
|
|
1061
|
+
statement: ({ dateRange }) =>
|
|
1062
|
+
\`SELECT * FROM analytics WHERE date_range = '\${dateRange}'\`
|
|
1063
|
+
})`,
|
|
1064
|
+
},
|
|
1065
|
+
},
|
|
1066
|
+
// BigQuery 0.0.8+ uses run_sql with parameters (@param1, @param2 placeholders)
|
|
1067
|
+
{
|
|
1068
|
+
pluginId: "bigquery",
|
|
1069
|
+
minVersion: "0.0.8",
|
|
1070
|
+
definition: {
|
|
1071
|
+
className: "BigQuery",
|
|
1072
|
+
pluginId: "bigquery",
|
|
1073
|
+
description: "Google BigQuery integration (v0.0.8+)",
|
|
1074
|
+
typeDefinition: `export class BigQuery extends Integration {
|
|
1075
|
+
constructor(
|
|
1076
|
+
name: string,
|
|
1077
|
+
integrationId: string,
|
|
1078
|
+
config: {
|
|
1079
|
+
sqlBody: Binding<string>;
|
|
1080
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
1081
|
+
parameters: Binding<string>;
|
|
1082
|
+
}
|
|
1083
|
+
);
|
|
1084
|
+
|
|
1085
|
+
/** Execute SQL statement - returns array of rows */
|
|
1086
|
+
async execute(): Promise<any[]>;
|
|
1087
|
+
}`,
|
|
1088
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
1089
|
+
new BigQuery("GetUsers", bigqueryIntegrationId, {
|
|
1090
|
+
sqlBody: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
1091
|
+
\`SELECT * FROM users WHERE status = ? OFFSET ? LIMIT ?\`,
|
|
1092
|
+
parameters: "[statusFilter, offset, limit]"
|
|
1093
|
+
})
|
|
1094
|
+
|
|
1095
|
+
// Array handling - use UNNEST for WHERE IN queries with arrays
|
|
1096
|
+
new BigQuery("GetUsersByIds", bigqueryIntegrationId, {
|
|
1097
|
+
sqlBody: ({ userIds }: { userIds: number[] }) =>
|
|
1098
|
+
\`SELECT * FROM users WHERE id IN UNNEST(?)\`,
|
|
1099
|
+
parameters: "[userIds]" // Pass array directly - BigQuery handles array parameters natively
|
|
1100
|
+
})
|
|
1101
|
+
|
|
1102
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
1103
|
+
new BigQuery("SortedUsers", bigqueryIntegrationId, {
|
|
1104
|
+
sqlBody: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
1105
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
1106
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
1107
|
+
})`,
|
|
1108
|
+
},
|
|
1109
|
+
},
|
|
1110
|
+
// BigQuery < 0.0.8 uses legacy format
|
|
1111
|
+
{
|
|
1112
|
+
pluginId: "bigquery",
|
|
1113
|
+
minVersion: "0.0.0",
|
|
1114
|
+
definition: {
|
|
1115
|
+
className: "BigQuery",
|
|
1116
|
+
pluginId: "bigquery",
|
|
1117
|
+
description: "Google BigQuery integration (legacy)",
|
|
1118
|
+
typeDefinition: `export class BigQuery extends Integration {
|
|
1119
|
+
constructor(
|
|
1120
|
+
name: string,
|
|
1121
|
+
integrationId: string,
|
|
1122
|
+
config: {
|
|
1123
|
+
sqlBody: Binding<string>;
|
|
1124
|
+
}
|
|
1125
|
+
);
|
|
1126
|
+
|
|
1127
|
+
/** Execute SQL statement - returns array of rows */
|
|
1128
|
+
async execute(): Promise<any[]>;
|
|
1129
|
+
}`,
|
|
1130
|
+
example: `new BigQuery("GetAnalytics", bigqueryIntegrationId, {
|
|
1131
|
+
sqlBody: ({ dataset }) =>
|
|
1132
|
+
\`SELECT * FROM \${dataset}.events\`
|
|
1133
|
+
})`,
|
|
1134
|
+
},
|
|
1135
|
+
},
|
|
1136
|
+
// Athena 0.0.2+ uses run_sql with parameters (? placeholders)
|
|
1137
|
+
{
|
|
1138
|
+
pluginId: "athena",
|
|
1139
|
+
minVersion: "0.0.2",
|
|
1140
|
+
definition: {
|
|
1141
|
+
className: "Athena",
|
|
1142
|
+
pluginId: "athena",
|
|
1143
|
+
description: "Amazon Athena integration (v0.0.2+)",
|
|
1144
|
+
typeDefinition: `export class Athena extends Integration {
|
|
1145
|
+
constructor(
|
|
1146
|
+
name: string,
|
|
1147
|
+
integrationId: string,
|
|
1148
|
+
config: {
|
|
1149
|
+
sqlBody: Binding<string>;
|
|
1150
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
1151
|
+
parameters: Binding<string>;
|
|
1152
|
+
}
|
|
1153
|
+
);
|
|
1154
|
+
|
|
1155
|
+
/** Execute SQL statement - returns array of rows */
|
|
1156
|
+
async execute(): Promise<any[]>;
|
|
1157
|
+
}`,
|
|
1158
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
1159
|
+
new Athena("GetLogs", athenaIntegrationId, {
|
|
1160
|
+
sqlBody: ({ logLevel, limit }: { logLevel: string; limit: number }) =>
|
|
1161
|
+
\`SELECT * FROM logs WHERE level = ? LIMIT ?\`,
|
|
1162
|
+
parameters: "[logLevel, limit]"
|
|
1163
|
+
})
|
|
1164
|
+
|
|
1165
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
1166
|
+
new Athena("SortedLogs", athenaIntegrationId, {
|
|
1167
|
+
sqlBody: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
1168
|
+
\`SELECT * FROM logs ORDER BY \${sortColumn} \${sortDir}\`,
|
|
1169
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
1170
|
+
})`,
|
|
1171
|
+
},
|
|
1172
|
+
},
|
|
1173
|
+
// Athena < 0.0.2 uses legacy format
|
|
1174
|
+
{
|
|
1175
|
+
pluginId: "athena",
|
|
1176
|
+
minVersion: "0.0.0",
|
|
1177
|
+
definition: {
|
|
1178
|
+
className: "Athena",
|
|
1179
|
+
pluginId: "athena",
|
|
1180
|
+
description: "Amazon Athena integration (legacy)",
|
|
1181
|
+
typeDefinition: `export class Athena extends Integration {
|
|
1182
|
+
constructor(
|
|
1183
|
+
name: string,
|
|
1184
|
+
integrationId: string,
|
|
1185
|
+
config: {
|
|
1186
|
+
sqlBody: Binding<string>;
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
|
|
1190
|
+
/** Execute SQL statement - returns array of rows */
|
|
1191
|
+
async execute(): Promise<any[]>;
|
|
1192
|
+
}`,
|
|
1193
|
+
example: `new Athena("GetLogs", athenaIntegrationId, {
|
|
1194
|
+
sqlBody: ({ database }) =>
|
|
1195
|
+
\`SELECT * FROM \${database}.logs\`
|
|
1196
|
+
})`,
|
|
1197
|
+
},
|
|
1198
|
+
},
|
|
1199
|
+
// Databricks 0.0.5+ uses run_sql with parameters (:param1, :param2 placeholders)
|
|
1200
|
+
{
|
|
1201
|
+
pluginId: "databricks",
|
|
1202
|
+
minVersion: "0.0.5",
|
|
1203
|
+
definition: {
|
|
1204
|
+
className: "Databricks",
|
|
1205
|
+
pluginId: "databricks",
|
|
1206
|
+
description: "Databricks integration (v0.0.5+)",
|
|
1207
|
+
typeDefinition: `export class Databricks extends Integration {
|
|
1208
|
+
constructor(
|
|
1209
|
+
name: string,
|
|
1210
|
+
integrationId: string,
|
|
1211
|
+
config: {
|
|
1212
|
+
statement: Binding<string>;
|
|
1213
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
1214
|
+
parameters: Binding<string>;
|
|
1215
|
+
}
|
|
1216
|
+
);
|
|
1217
|
+
|
|
1218
|
+
/** Execute SQL statement - returns array of rows */
|
|
1219
|
+
async execute(): Promise<any[]>;
|
|
1220
|
+
}`,
|
|
1221
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
1222
|
+
new Databricks("GetUsers", databricksIntegrationId, {
|
|
1223
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
1224
|
+
\`SELECT * FROM users WHERE status = :PARAM_1 OFFSET :PARAM_2 LIMIT :PARAM_3\`,
|
|
1225
|
+
parameters: "[statusFilter, offset, limit]"
|
|
1226
|
+
})
|
|
1227
|
+
|
|
1228
|
+
// Array handling - use array_contains for WHERE IN queries with arrays
|
|
1229
|
+
new Databricks("GetUsersByIds", databricksIntegrationId, {
|
|
1230
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
1231
|
+
\`SELECT * FROM users WHERE array_contains(array(:PARAM_1), id)\`,
|
|
1232
|
+
parameters: "[userIds.join(',')]" // For dynamic arrays, may need string splitting approach
|
|
1233
|
+
})
|
|
1234
|
+
|
|
1235
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
1236
|
+
new Databricks("SortedUsers", databricksIntegrationId, {
|
|
1237
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
1238
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
1239
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
1240
|
+
})`,
|
|
1241
|
+
},
|
|
1242
|
+
},
|
|
1243
|
+
// Databricks < 0.0.5 uses legacy format
|
|
1244
|
+
{
|
|
1245
|
+
pluginId: "databricks",
|
|
1246
|
+
minVersion: "0.0.0",
|
|
1247
|
+
definition: {
|
|
1248
|
+
className: "Databricks",
|
|
1249
|
+
pluginId: "databricks",
|
|
1250
|
+
description: "Databricks integration (legacy)",
|
|
1251
|
+
typeDefinition: `export class Databricks extends Integration {
|
|
1252
|
+
constructor(
|
|
1253
|
+
name: string,
|
|
1254
|
+
integrationId: string,
|
|
1255
|
+
config: {
|
|
1256
|
+
statement: Binding<string>;
|
|
1257
|
+
}
|
|
1258
|
+
);
|
|
1259
|
+
|
|
1260
|
+
/** Execute SQL statement - returns array of rows */
|
|
1261
|
+
async execute(): Promise<any[]>;
|
|
1262
|
+
}`,
|
|
1263
|
+
example: `new Databricks("GetAnalytics", databricksIntegrationId, {
|
|
1264
|
+
statement: ({ catalog }) =>
|
|
1265
|
+
\`SELECT * FROM \${catalog}.default.events\`
|
|
1266
|
+
})`,
|
|
1267
|
+
},
|
|
1268
|
+
},
|
|
1269
|
+
// CockroachDB 0.0.3+ uses run_sql with parameters ($1, $2 placeholders - PostgreSQL-compatible)
|
|
1270
|
+
{
|
|
1271
|
+
pluginId: "cockroachdb",
|
|
1272
|
+
minVersion: "0.0.3",
|
|
1273
|
+
definition: {
|
|
1274
|
+
className: "CockroachDB",
|
|
1275
|
+
pluginId: "cockroachdb",
|
|
1276
|
+
description: "CockroachDB distributed SQL database (v0.0.3+)",
|
|
1277
|
+
typeDefinition: `export class CockroachDB extends Integration {
|
|
1278
|
+
constructor(
|
|
1279
|
+
name: string,
|
|
1280
|
+
integrationId: string,
|
|
1281
|
+
config: {
|
|
1282
|
+
statement: Binding<string>;
|
|
1283
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
1284
|
+
parameters: Binding<string>;
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
|
|
1288
|
+
/** Execute SQL statement - returns array of rows */
|
|
1289
|
+
async execute(): Promise<any[]>;
|
|
1290
|
+
}`,
|
|
1291
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
1292
|
+
new CockroachDB("GetUsers", cockroachdbIntegrationId, {
|
|
1293
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
1294
|
+
\`SELECT * FROM users WHERE status = $1 OFFSET $2 LIMIT $3\`,
|
|
1295
|
+
parameters: "[statusFilter, offset, limit]"
|
|
1296
|
+
})
|
|
1297
|
+
|
|
1298
|
+
// Array handling - use = ANY() for WHERE IN queries with arrays (PostgreSQL-compatible)
|
|
1299
|
+
new CockroachDB("GetUsersByIds", cockroachdbIntegrationId, {
|
|
1300
|
+
statement: ({ userIds }: { userIds: number[] }) =>
|
|
1301
|
+
\`SELECT * FROM users WHERE id = ANY($1::int[])\`, // Cast to appropriate array type
|
|
1302
|
+
parameters: "[userIds]" // userIds should be an array like [1, 2, 3]
|
|
1303
|
+
})
|
|
1304
|
+
|
|
1305
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
1306
|
+
new CockroachDB("SortedUsers", cockroachdbIntegrationId, {
|
|
1307
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
1308
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
1309
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
1310
|
+
})`,
|
|
1311
|
+
},
|
|
1312
|
+
},
|
|
1313
|
+
// CockroachDB < 0.0.3 uses legacy format
|
|
1314
|
+
{
|
|
1315
|
+
pluginId: "cockroachdb",
|
|
1316
|
+
minVersion: "0.0.0",
|
|
1317
|
+
definition: {
|
|
1318
|
+
className: "CockroachDB",
|
|
1319
|
+
pluginId: "cockroachdb",
|
|
1320
|
+
description: "CockroachDB distributed SQL database (legacy)",
|
|
1321
|
+
typeDefinition: `export class CockroachDB extends Integration {
|
|
1322
|
+
constructor(
|
|
1323
|
+
name: string,
|
|
1324
|
+
integrationId: string,
|
|
1325
|
+
config: {
|
|
1326
|
+
statement: Binding<string>;
|
|
1327
|
+
}
|
|
1328
|
+
);
|
|
1329
|
+
|
|
1330
|
+
/** Execute SQL statement - returns array of rows */
|
|
1331
|
+
async execute(): Promise<any[]>;
|
|
1332
|
+
}`,
|
|
1333
|
+
example: `new CockroachDB("GetAccounts", cockroachdbIntegrationId, {
|
|
1334
|
+
statement: ({ region }) =>
|
|
1335
|
+
\`SELECT * FROM accounts WHERE region = '\${region}'\`
|
|
1336
|
+
})`,
|
|
1337
|
+
},
|
|
1338
|
+
},
|
|
1339
|
+
// OracleDB 0.0.3+ uses run_sql with parameters (:1, :2 placeholders)
|
|
1340
|
+
{
|
|
1341
|
+
pluginId: "oracledb",
|
|
1342
|
+
minVersion: "0.0.3",
|
|
1343
|
+
definition: {
|
|
1344
|
+
className: "OracleDB",
|
|
1345
|
+
pluginId: "oracledb",
|
|
1346
|
+
description: "Oracle Database integration (v0.0.3+)",
|
|
1347
|
+
typeDefinition: `export class OracleDB extends Integration {
|
|
1348
|
+
constructor(
|
|
1349
|
+
name: string,
|
|
1350
|
+
integrationId: string,
|
|
1351
|
+
config: {
|
|
1352
|
+
statement: Binding<string>;
|
|
1353
|
+
/** SQL parameters array - use "[]" for queries without parameters */
|
|
1354
|
+
parameters: Binding<string>;
|
|
1355
|
+
}
|
|
1356
|
+
);
|
|
1357
|
+
|
|
1358
|
+
/** Execute SQL statement - returns array of rows */
|
|
1359
|
+
async execute(): Promise<any[]>;
|
|
1360
|
+
}`,
|
|
1361
|
+
example: `// Simple parameterized SQL - declare inputs in statement function signature
|
|
1362
|
+
new OracleDB("GetUsers", oracledbIntegrationId, {
|
|
1363
|
+
statement: ({ statusFilter, offset, limit }: { statusFilter: string; offset: number; limit: number }) =>
|
|
1364
|
+
\`SELECT * FROM users WHERE status = :1 OFFSET :2 ROWS FETCH NEXT :3 ROWS ONLY\`,
|
|
1365
|
+
parameters: "[statusFilter, offset, limit]"
|
|
1366
|
+
})
|
|
1367
|
+
|
|
1368
|
+
// Dynamic ORDER BY - can't be parameterized, use empty parameters
|
|
1369
|
+
new OracleDB("SortedUsers", oracledbIntegrationId, {
|
|
1370
|
+
statement: ({ sortColumn, sortDir }: { sortColumn: string; sortDir: 'ASC' | 'DESC' }) =>
|
|
1371
|
+
\`SELECT * FROM users ORDER BY \${sortColumn} \${sortDir}\`,
|
|
1372
|
+
parameters: "" // Empty string - ORDER BY columns/directions can't be parameterized
|
|
1373
|
+
})`,
|
|
1374
|
+
},
|
|
1375
|
+
},
|
|
1376
|
+
// OracleDB < 0.0.3 uses legacy format
|
|
1377
|
+
{
|
|
1378
|
+
pluginId: "oracledb",
|
|
1379
|
+
minVersion: "0.0.0",
|
|
1380
|
+
definition: {
|
|
1381
|
+
className: "OracleDB",
|
|
1382
|
+
pluginId: "oracledb",
|
|
1383
|
+
description: "Oracle Database integration (legacy)",
|
|
1384
|
+
typeDefinition: `export class OracleDB extends Integration {
|
|
1385
|
+
constructor(
|
|
1386
|
+
name: string,
|
|
1387
|
+
integrationId: string,
|
|
1388
|
+
config: {
|
|
1389
|
+
statement: Binding<string>;
|
|
1390
|
+
}
|
|
1391
|
+
);
|
|
1392
|
+
|
|
1393
|
+
/** Execute SQL statement - returns array of rows */
|
|
1394
|
+
async execute(): Promise<any[]>;
|
|
1395
|
+
}`,
|
|
1396
|
+
example: `new OracleDB("GetEmployees", oracledbIntegrationId, {
|
|
1397
|
+
statement: ({ deptId }) =>
|
|
1398
|
+
\`SELECT * FROM employees WHERE department_id = \${deptId}\`
|
|
1399
|
+
})`,
|
|
1400
|
+
},
|
|
1401
|
+
},
|
|
1402
|
+
];
|
|
1403
|
+
/**
|
|
1404
|
+
* Get a version-specific type definition if one exists for the given plugin and version.
|
|
1405
|
+
*/
|
|
1406
|
+
function getVersionSpecificDefinition(pluginId, version) {
|
|
1407
|
+
if (!version) {
|
|
1408
|
+
return undefined;
|
|
1409
|
+
}
|
|
1410
|
+
// Find the first matching version-specific definition
|
|
1411
|
+
// Definitions are ordered by version (highest first), so we find the first one
|
|
1412
|
+
// where the current version is >= the minVersion
|
|
1413
|
+
for (const versionDef of VERSION_SPECIFIC_TYPE_DEFINITIONS) {
|
|
1414
|
+
if (versionDef.pluginId === pluginId) {
|
|
1415
|
+
if (semverGte(version, versionDef.minVersion)) {
|
|
1416
|
+
return versionDef.definition;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
return undefined;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Create a type definition for a derived plugin.
|
|
1424
|
+
* This template is used for all integrations that use a derived plugin (eg extends OpenApi).
|
|
1425
|
+
*/
|
|
1426
|
+
export function createExtendedPluginTypeDefinition(plugin, basePluginId, description = `${plugin.id} API integration`) {
|
|
1427
|
+
const predefined = INTEGRATION_TYPE_DEFINITIONS[basePluginId];
|
|
1428
|
+
if (!predefined)
|
|
1429
|
+
return undefined;
|
|
1430
|
+
// Replace "BaseClass extends ParentClass" with "DerivedClass extends BaseClass"
|
|
1431
|
+
const regex = new RegExp(`\\b${predefined.className}\\s+extends\\s+\\w+`, "g");
|
|
1432
|
+
const className = pluginIdToSdkClassName(plugin.id);
|
|
1433
|
+
const updatedTypeDef = predefined.typeDefinition.replace(regex, `${className} extends ${predefined.className}`);
|
|
1434
|
+
const updatedExample = predefined.example
|
|
1435
|
+
? predefined.example.replace(new RegExp(`new\\s+${predefined.className}\\b`, "g"), `new ${className}`)
|
|
1436
|
+
: undefined;
|
|
1437
|
+
return {
|
|
1438
|
+
className,
|
|
1439
|
+
pluginId: plugin.id,
|
|
1440
|
+
description,
|
|
1441
|
+
typeDefinition: updatedTypeDef,
|
|
1442
|
+
example: updatedExample,
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Get type definition for a specific integration by its plugin ID.
|
|
1447
|
+
* For OpenAPI-derived plugins not in the predefined list, generates a definition using the template.
|
|
1448
|
+
*
|
|
1449
|
+
* @param plugin - The plugin header containing plugin metadata
|
|
1450
|
+
* @param version - Optional plugin execution version to get version-specific definitions
|
|
1451
|
+
* @param options - Optional configuration including feature flags
|
|
1452
|
+
*/
|
|
1453
|
+
export function getIntegrationTypeDefinition(plugin, version, options) {
|
|
1454
|
+
// If parameterized APIs feature is not explicitly enabled, force version to "0.0.0"
|
|
1455
|
+
// to get legacy definitions (without parameters field) for SQL plugins.
|
|
1456
|
+
// This matches the UI behavior where ldFlag defaults to false when missing.
|
|
1457
|
+
let effectiveVersion = version;
|
|
1458
|
+
if (options?.parameterizedApisEnabled !== true) {
|
|
1459
|
+
effectiveVersion = "0.0.0";
|
|
1460
|
+
}
|
|
1461
|
+
// First, check for version-specific definitions
|
|
1462
|
+
const versionSpecific = getVersionSpecificDefinition(plugin.id, effectiveVersion);
|
|
1463
|
+
if (versionSpecific) {
|
|
1464
|
+
return versionSpecific;
|
|
1465
|
+
}
|
|
1466
|
+
// Fall back to predefined integration
|
|
722
1467
|
const predefined = INTEGRATION_TYPE_DEFINITIONS[plugin.id];
|
|
723
1468
|
if (predefined) {
|
|
724
1469
|
return predefined;
|