Skip to content

Commit 0b640c4

Browse files
authored
feat: support HA Hasura (#1120)
## Summary by Sourcery Add HA Hasura integration support across CLI and MCP by updating type definitions, prompts, commands, and schemas to recognize the HA_HASURA integrationType New Features: - Add support for high-availability Hasura by introducing the HAHasura integration type Enhancements: - Extend the Hasura type guard and prompt to handle both Hasura and HAHasura - Update CLI commands and environment variable logic to use the HA_HASURA integrationType - Include HA_HASURA in the MCP platform-integration-tool-create schema and example usage
1 parent 987e00f commit 0b640c4

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

sdk/cli/src/commands/platform/integration-tools/hasura/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function hasuraIntegrationCreateCommand() {
3333
settlemint.integrationTool.create({
3434
name,
3535
applicationUniqueName,
36-
integrationType: "HASURA",
36+
integrationType: "HA_HASURA",
3737
provider,
3838
region,
3939
size,

sdk/cli/src/prompts/cluster-service/hasura.prompt.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import { type BaseServicePromptArgs, servicePrompt } from "@/prompts/cluster-ser
22
import select from "@inquirer/select";
33
import type { IntegrationTool } from "@settlemint/sdk-js";
44

5-
export type Hasura = Extract<IntegrationTool, { __typename: "Hasura" }>;
5+
export type AnyHasura =
6+
| Extract<IntegrationTool, { __typename: "Hasura" }>
7+
| Extract<IntegrationTool, { __typename: "HAHasura" }>;
68

7-
export function isHasura(integration: IntegrationTool): integration is Hasura {
8-
return integration.__typename === "Hasura";
9+
export function isAnyHasura(integration: IntegrationTool): integration is AnyHasura {
10+
return integration.__typename === "Hasura" || integration.__typename === "HAHasura";
911
}
1012

1113
export interface HasuraPromptArgs extends BaseServicePromptArgs {
@@ -27,8 +29,8 @@ export async function hasuraPrompt({
2729
integrations,
2830
accept,
2931
isRequired = false,
30-
}: HasuraPromptArgs): Promise<Hasura | undefined> {
31-
const hasuras = integrations.filter(isHasura);
32+
}: HasuraPromptArgs): Promise<AnyHasura | undefined> {
33+
const hasuras = integrations.filter(isAnyHasura);
3234
return servicePrompt({
3335
env,
3436
services: hasuras,

sdk/cli/src/utils/get-cluster-service-env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { retryWhenFailed } from "@settlemint/sdk-utils/retry";
1313
import { spinner } from "@settlemint/sdk-utils/terminal";
1414
import type { DotEnv } from "@settlemint/sdk-utils/validation";
1515
import { DEFAULT_SUBGRAPH_NAME } from "@/constants/default-subgraph";
16+
import { isAnyHasura } from "@/prompts/cluster-service/hasura.prompt";
1617
import { isAnyHAGraphMiddleware } from "@/prompts/cluster-service/thegraph.prompt";
1718
import { getSubgraphName } from "./subgraph/subgraph-name";
1819

@@ -86,7 +87,7 @@ export function getPortalEnv(service: Middleware | undefined): Partial<DotEnv> {
8687
}
8788

8889
export function getHasuraEnv(service: IntegrationTool | undefined): Partial<DotEnv> {
89-
if (!service || service.__typename !== "Hasura") {
90+
if (!service || !isAnyHasura(service)) {
9091
return {};
9192
}
9293

sdk/mcp/src/prompts/tool-usage/platform-tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const hasura = await platformIntegrationToolCreate({
144144
type: "DEDICATED",
145145
provider: "aws",
146146
region: "eu-west-1",
147-
integrationType: "HASURA"
147+
integrationType: "HA_HASURA"
148148
});
149149
\`\`\`
150150

sdk/mcp/src/tools/platform/integration-tool/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const platformIntegrationToolCreate = (server: McpServer, env: Partial<Do
3636
size: z.enum(["SMALL", "MEDIUM", "LARGE"]).describe("Size of the integration tool"),
3737
provider: z.string().describe("Provider for the integration tool"),
3838
region: z.string().describe("Region for the integration tool"),
39-
integrationType: z.enum(["CHAINLINK", "HASURA", "INTEGRATION_STUDIO"]).describe("Type of integration"),
39+
integrationType: z.enum(["CHAINLINK", "HASURA", "HA_HASURA", "INTEGRATION_STUDIO"]).describe("Type of integration"),
4040
});
4141

4242
server.tool("platform-integration-tool-create", { inputSchema: zodToJsonSchema(schema) }, async (params) => {

0 commit comments

Comments
 (0)