UNPKG

@settlemint/sdk-js

Version:

Core JavaScript SDK for integrating SettleMint's blockchain platform services into your applications

1 lines • 131 kB
{"version":3,"file":"settlemint.cjs","names":["graphql: initGraphQLTada<{\n introspection: introspection;\n disableMasking: true;\n scalars: {\n DateTime: Date;\n JSON: Record<string, unknown>;\n Bytes: string;\n Int8: string;\n BigInt: string;\n BigDecimal: string;\n Timestamp: string;\n };\n}>","IdSchema","z","AccessTokenSchema","UrlSchema","verificationChallenges: VerificationChallenge[]","STANDALONE_INSTANCE","LOCAL_INSTANCE","z","GraphQLClient","data: { errors: { message: string }[] }"],"sources":["../src/helpers/graphql.ts","../src/graphql/workspace.ts","../src/graphql/application.ts","../src/graphql/application-access-tokens.ts","../src/defaults/cluster-service-defaults.ts","../src/defaults/blockchain-network-defaults.ts","../src/graphql/blockchain-network.ts","../src/graphql/blockchain-node.ts","../src/graphql/custom-deployment.ts","../src/graphql/foundry.ts","../src/graphql/load-balancer.ts","../src/graphql/insights.ts","../src/graphql/integration-tool.ts","../src/graphql/storage.ts","../src/graphql/middleware.ts","../src/graphql/platform.ts","../src/graphql/private-key.ts","../src/helpers/client-options.schema.ts","../src/pincode-verification.ts","../src/settlemint.ts"],"sourcesContent":["/**\n * This module initializes and exports GraphQL-related utilities using gql.tada.\n * It sets up the GraphQL client with specific configurations and exports necessary types and functions.\n */\n\nimport { initGraphQLTada } from \"gql.tada\";\nimport type { introspection } from \"./graphql-env.d.ts\";\n\n/**\n * Initializes the GraphQL client with specific configurations.\n *\n * @returns A configured GraphQL client instance.\n */\nexport const graphql: initGraphQLTada<{\n introspection: introspection;\n disableMasking: true;\n scalars: {\n DateTime: Date;\n JSON: Record<string, unknown>;\n Bytes: string;\n Int8: string;\n BigInt: string;\n BigDecimal: string;\n Timestamp: string;\n };\n}> = initGraphQLTada<{\n introspection: introspection;\n disableMasking: true;\n scalars: {\n DateTime: Date;\n JSON: Record<string, unknown>;\n Bytes: string;\n Int8: string;\n BigInt: string;\n BigDecimal: string;\n Timestamp: string;\n };\n}>();\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n","import { type Id, IdSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport type { GraphQLClient } from \"graphql-request\";\nimport { graphql, type ResultOf, type VariablesOf } from \"@/helpers/graphql.js\";\n\n/**\n * GraphQL fragment containing core workspace fields.\n */\nconst WorkspaceFragment = graphql(\n `\n fragment Workspace on Workspace {\n id\n uniqueName\n name\n applications {\n id\n uniqueName\n name\n }\n }\n `,\n);\n\n/**\n * Type representing a workspace entity.\n */\nexport type Workspace = ResultOf<typeof WorkspaceFragment>;\n\n/**\n * Query to fetch all workspaces and their applications.\n */\nconst getWorkspacesAndApplications = graphql(\n `\n query getWorkspacesAndApplications {\n workspaces {\n ...Workspace\n childWorkspaces {\n ...Workspace\n }\n }\n }\n `,\n [WorkspaceFragment],\n);\n\n/**\n * Query to fetch a specific workspace by unique name.\n */\nconst getWorkspace = graphql(\n `\n query getWorkspace($uniqueName: String!) {\n workspaceByUniqueName(uniqueName: $uniqueName) {\n ...Workspace\n }\n }\n `,\n [WorkspaceFragment],\n);\n\n/**\n * Mutation to create a new workspace.\n */\nconst createWorkspace = graphql(\n `\n mutation CreateWorkspace(\n $addressLine1: String\n $addressLine2: String\n $city: String\n $companyName: String\n $country: String\n $name: String!\n $parentId: String\n $paymentMethodId: String\n $postalCode: String\n $taxIdType: String\n $taxIdValue: String\n ) {\n createWorkspace(\n addressLine1: $addressLine1\n addressLine2: $addressLine2\n city: $city\n companyName: $companyName\n country: $country\n name: $name\n parentId: $parentId\n paymentMethodId: $paymentMethodId\n postalCode: $postalCode\n taxIdType: $taxIdType\n taxIdValue: $taxIdValue\n ) {\n ...Workspace\n }\n }\n `,\n [WorkspaceFragment],\n);\n\nexport type CreateWorkspaceArgs = VariablesOf<typeof createWorkspace>;\n\n/**\n * Mutation to delete a workspace.\n */\nconst deleteWorkspace = graphql(\n `\n mutation deleteWorkspace($uniqueName: String!) {\n deleteWorkspaceByUniqueName(uniqueName: $uniqueName) {\n ...Workspace\n }\n }\n `,\n [WorkspaceFragment],\n);\n\n/**\n * Mutation to add credits to a workspace.\n */\nconst addCredits = graphql(\n `\n mutation addCredits($workspaceId: String!, $amount: Float!) {\n addCredits(workspaceId: $workspaceId, amount: $amount)\n }\n `,\n);\n\n/**\n * Creates a function to list all workspaces and their applications.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that returns all workspaces sorted by name\n * @throws If the request fails\n */\nexport const workspaceList = (gqlClient: GraphQLClient): (() => Promise<Workspace[]>) => {\n return async () => {\n const { workspaces } = await gqlClient.request(getWorkspacesAndApplications);\n const allWorkspaces = workspaces.reduce<Workspace[]>((acc, workspace) => {\n acc.push(workspace);\n if (workspace.childWorkspaces) {\n acc.push(...workspace.childWorkspaces);\n }\n return acc;\n }, []);\n return allWorkspaces.sort((a, b) => a.name.localeCompare(b.name));\n };\n};\n\n/**\n * Creates a function to read a specific workspace by unique name.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches a single workspace by unique name\n * @throws If the workspace cannot be found or the request fails\n */\nexport const workspaceRead = (gqlClient: GraphQLClient): ((workspaceUniqueName: string) => Promise<Workspace>) => {\n return async (workspaceUniqueName: string) => {\n const { workspaceByUniqueName } = await gqlClient.request(getWorkspace, { uniqueName: workspaceUniqueName });\n return workspaceByUniqueName;\n };\n};\n\n/**\n * Creates a function to create a new workspace.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that creates a new workspace with the provided configuration\n * @throws If the creation fails or validation errors occur\n */\nexport const workspaceCreate = (gqlClient: GraphQLClient) => {\n return async (createWorkspaceArgs: CreateWorkspaceArgs) => {\n const { createWorkspace: workspace } = await gqlClient.request(createWorkspace, createWorkspaceArgs);\n return workspace;\n };\n};\n\n/**\n * Creates a function to delete a workspace.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that deletes a workspace by unique name\n * @throws If the workspace cannot be found or the deletion fails\n */\nexport const workspaceDelete = (gqlClient: GraphQLClient) => {\n return async (workspaceUniqueName: string) => {\n const { deleteWorkspaceByUniqueName: workspace } = await gqlClient.request(deleteWorkspace, {\n uniqueName: workspaceUniqueName,\n });\n return workspace;\n };\n};\n\n/**\n * Creates a function to add credits to a workspace.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that adds credits to a workspace\n * @throws If the workspace ID is invalid or amount is not positive\n */\nexport const workspaceAddCredits = (gqlClient: GraphQLClient) => {\n return async (workspaceId: Id, amount: number) => {\n const id = validate(IdSchema, workspaceId);\n if (amount <= 0) {\n throw new Error(\"Credit amount must be a positive number\");\n }\n const { addCredits: result } = await gqlClient.request(addCredits, { workspaceId: id, amount });\n return result;\n };\n};\n","import { type ResultOf, type VariablesOf, graphql } from \"@/helpers/graphql.js\";\nimport type { GraphQLClient } from \"graphql-request\";\nimport { workspaceRead } from \"./workspace.js\";\n\n/**\n * GraphQL fragment containing core application fields.\n */\nconst ApplicationFragment = graphql(`\n fragment Application on Application {\n id\n uniqueName\n name\n workspace {\n id\n uniqueName\n name\n }\n }\n`);\n\n/**\n * Type representing an application entity.\n */\nexport type Application = ResultOf<typeof ApplicationFragment>;\n\n/**\n * Query to fetch applications for a workspace.\n */\nconst listApplications = graphql(\n `\n query ListApplications($workspaceUniqueName: String!) {\n workspaceByUniqueName(uniqueName: $workspaceUniqueName) {\n applications {\n ...Application\n }\n }\n }\n `,\n [ApplicationFragment],\n);\n\n/**\n * Query to fetch a specific application.\n */\nconst readApplication = graphql(\n `\n query ReadApplication($applicationUniqueName: String!) {\n applicationByUniqueName(uniqueName: $applicationUniqueName) {\n ...Application\n }\n }\n `,\n [ApplicationFragment],\n);\n\n/**\n * Mutation to create a new application.\n */\nconst createApplication = graphql(\n `\n mutation CreateApplication($name: String!, $workspaceId: ID!) {\n createApplication(name: $name, workspaceId: $workspaceId) {\n ...Application\n }\n }\n `,\n [ApplicationFragment],\n);\n\n/**\n * Mutation to delete an application.\n */\nconst deleteApplication = graphql(\n `\n mutation DeleteApplication($uniqueName: String!) {\n deleteApplicationByUniqueName(uniqueName: $uniqueName) {\n ...Application\n }\n }\n `,\n [ApplicationFragment],\n);\n\n/**\n * Arguments required to create an application.\n */\nexport type CreateApplicationArgs = Omit<VariablesOf<typeof createApplication>, \"workspaceId\"> & {\n workspaceUniqueName: string;\n};\n\n/**\n * Creates a function to list applications in a workspace.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches applications for a workspace\n * @throws If the workspace cannot be found or the request fails\n */\nexport const applicationList = (gqlClient: GraphQLClient) => {\n return async (workspaceUniqueName: string): Promise<Application[]> => {\n const {\n workspaceByUniqueName: { applications },\n } = await gqlClient.request(listApplications, { workspaceUniqueName });\n return applications;\n };\n};\n\n/**\n * Creates a function to fetch a specific application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches a single application by unique name\n * @throws If the application cannot be found or the request fails\n */\nexport const applicationRead = (gqlClient: GraphQLClient) => {\n return async (applicationUniqueName: string): Promise<Application> => {\n const { applicationByUniqueName: application } = await gqlClient.request(readApplication, {\n applicationUniqueName,\n });\n return application;\n };\n};\n\n/**\n * Creates a function to create a new application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that creates a new application with the provided configuration\n * @throws If the creation fails or validation errors occur\n */\nexport const applicationCreate = (gqlClient: GraphQLClient) => {\n return async (args: CreateApplicationArgs): Promise<Application> => {\n const { workspaceUniqueName, ...otherArgs } = args;\n const workspace = await workspaceRead(gqlClient)(workspaceUniqueName);\n const { createApplication: application } = await gqlClient.request(createApplication, {\n ...otherArgs,\n workspaceId: workspace.id,\n });\n return application;\n };\n};\n\n/**\n * Creates a function to delete an application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that deletes an application by unique name\n * @throws If the application cannot be found or the deletion fails\n */\nexport const applicationDelete = (gqlClient: GraphQLClient) => {\n return async (applicationUniqueName: string): Promise<Application> => {\n const { deleteApplicationByUniqueName: application } = await gqlClient.request(deleteApplication, {\n uniqueName: applicationUniqueName,\n });\n return application;\n };\n};\n","import { applicationRead } from \"@/graphql/application.js\";\nimport { type VariablesOf, graphql } from \"@/helpers/graphql.js\";\nimport type { GraphQLClient } from \"graphql-request\";\n\nconst createApplicationAccessToken = graphql(\n `\n mutation CreateApplicationAccessToken(\n $applicationId: ID!,\n $blockchainNetworkScope: BlockchainNetworkScopeInputType!,\n $blockchainNodeScope: BlockchainNodeScopeInputType!,\n $customDeploymentScope: CustomDeploymentScopeInputType!,\n $insightsScope: InsightsScopeInputType!,\n $integrationScope: IntegrationScopeInputType!,\n $loadBalancerScope: LoadBalancerScopeInputType!,\n $middlewareScope: MiddlewareScopeInputType!,\n $name: String!,\n $privateKeyScope: PrivateKeyScopeInputType!,\n $smartContractSetScope: SmartContractSetScopeInputType!,\n $storageScope: StorageScopeInputType!,\n $validityPeriod: AccessTokenValidityPeriod!\n ) {\n createApplicationAccessToken(\n applicationId: $applicationId,\n blockchainNetworkScope: $blockchainNetworkScope,\n blockchainNodeScope: $blockchainNodeScope,\n customDeploymentScope: $customDeploymentScope,\n insightsScope: $insightsScope,\n integrationScope: $integrationScope,\n loadBalancerScope: $loadBalancerScope,\n middlewareScope: $middlewareScope,\n name: $name,\n privateKeyScope: $privateKeyScope,\n smartContractSetScope: $smartContractSetScope,\n storageScope: $storageScope,\n validityPeriod: $validityPeriod\n ) {\n token\n }\n }\n `,\n [],\n);\n\nexport type CreateApplicationAccessTokenArgs = Omit<\n VariablesOf<typeof createApplicationAccessToken>,\n \"applicationId\"\n> & { applicationUniqueName: string };\n\n/**\n * Creates a new application.\n *\n * @param gqlClient - The GraphQL client instance used to execute the mutation.\n * @returns A function that accepts the arguments for creating an application and returns a promise resolving to the created application.\n */\nexport const applicationAccessTokenCreate = (gqlClient: GraphQLClient) => {\n return async (args: CreateApplicationAccessTokenArgs): Promise<string> => {\n const { applicationUniqueName, ...otherArgs } = args;\n const application = await applicationRead(gqlClient)(applicationUniqueName);\n const { createApplicationAccessToken: applicationAccessToken } = await gqlClient.request(\n createApplicationAccessToken,\n {\n ...otherArgs,\n applicationId: application.id,\n },\n );\n if (!applicationAccessToken.token) {\n throw new Error(\"Failed to create application access token\");\n }\n return applicationAccessToken.token;\n };\n};\n","/**\n * Sets the default values for a cluster service.\n *\n * @param args - The arguments for creating a cluster service.\n * @returns The modified arguments with default values set.\n */\nexport function setClusterServiceDefaults<\n Args extends {\n size?: \"SMALL\" | \"MEDIUM\" | \"LARGE\" | \"CUSTOM\" | null | undefined;\n type?: \"SHARED\" | \"DEDICATED\" | null | undefined;\n },\n>(args: Args): Args {\n return {\n ...args,\n size: args.size ?? \"SMALL\",\n type: args.type ?? \"SHARED\",\n };\n}\n","import type { CreateBlockchainNetworkArgs } from \"../graphql/blockchain-network.js\";\nimport { setClusterServiceDefaults } from \"./cluster-service-defaults.js\";\n\n/**\n * Sets the default values for a blockchain network.\n *\n * @param args - The arguments for creating a blockchain network.\n * @returns The modified arguments with default values set.\n */\nexport function setNetworkDefaults(\n args: Omit<CreateBlockchainNetworkArgs, \"applicationUniqueName\">,\n): Omit<CreateBlockchainNetworkArgs, \"applicationUniqueName\"> {\n const clusterServiceArgs = setClusterServiceDefaults(args);\n if (args.consensusAlgorithm === \"BESU_QBFT\") {\n return {\n ...clusterServiceArgs,\n chainId: args.chainId ?? 46040,\n contractSizeLimit: args.contractSizeLimit ?? 2147483647,\n evmStackSize: args.evmStackSize ?? 2048,\n gasLimit: args.gasLimit ?? \"9007199254740991\",\n gasPrice: args.gasPrice ?? 0,\n secondsPerBlock: args.secondsPerBlock ?? 2,\n };\n }\n return clusterServiceArgs;\n}\n","import type { GraphQLClient } from \"graphql-request\";\nimport { applicationRead } from \"@/graphql/application.js\";\nimport { graphql, type ResultOf, type VariablesOf } from \"@/helpers/graphql.js\";\nimport { setNetworkDefaults } from \"../defaults/blockchain-network-defaults.js\";\n\n/**\n * Fragment containing core blockchain network fields.\n */\nconst BlockchainNetworkFragment = graphql(`\n fragment BlockchainNetwork on BlockchainNetwork {\n __typename\n id\n uniqueName\n name\n status\n healthStatus\n provider\n region\n ... on BesuQBFTBlockchainNetwork {\n chainId\n }\n ... on BesuIbftv2BlockchainNetwork {\n chainId\n }\n ... on PolygonEdgePoABlockchainNetwork {\n chainId\n }\n ... on QuorumQBFTBlockchainNetwork {\n chainId\n }\n ... on GethCliqueBlockchainNetwork {\n chainId\n }\n ... on PublicEvmBlockchainNetwork {\n chainId\n }\n blockchainNodes {\n ... on BlockchainNode {\n id\n name\n uniqueName\n endpoints {\n id\n label\n displayValue\n }\n }\n }\n }\n`);\n\n/**\n * Type representing a blockchain network entity.\n */\nexport type BlockchainNetwork = ResultOf<typeof BlockchainNetworkFragment>;\n\n/**\n * Query to fetch blockchain networks for an application.\n */\nconst getBlockchainNetworks = graphql(\n `\n query getBlockchainNetworks($applicationUniqueName: String!) {\n blockchainNetworksByUniqueName(applicationUniqueName: $applicationUniqueName) {\n items {\n ...BlockchainNetwork\n }\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Query to fetch a specific blockchain network.\n */\nconst getBlockchainNetwork = graphql(\n `\n query getBlockchainNetwork($uniqueName: String!) {\n blockchainNetworkByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNetwork\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Mutation to create a new blockchain network.\n */\nconst createBlockchainNetwork = graphql(\n `\n mutation createBlockchainNetwork(\n $applicationId: ID!\n $chainId: Int\n $consensusAlgorithm: ConsensusAlgorithm!\n $contractSizeLimit: Int\n $evmStackSize: Int\n $gasLimit: String\n $gasPrice: Int\n $name: String!\n $nodeName: String!\n $secondsPerBlock: Int\n $provider: String!\n $region: String!\n $size: ClusterServiceSize\n $type: ClusterServiceType\n $batchTimeout: Float\n $maxMessageCount: Int\n $absoluteMaxBytes: Int\n $preferredMaxBytes: Int\n $endorsementPolicy: FabricEndorsementPolicy\n $maxCodeSize: Int\n $txnSizeLimit: Int\n $besuIbft2Genesis: BesuIbft2GenesisInput\n $besuQbftGenesis: BesuQbftGenesisInput\n $quorumGenesis: QuorumGenesisInput\n $externalNodes: [BlockchainNetworkExternalNodeInput!]\n $privateKeyId: ID\n ) {\n createBlockchainNetwork(\n applicationId: $applicationId\n chainId: $chainId\n consensusAlgorithm: $consensusAlgorithm\n contractSizeLimit: $contractSizeLimit\n evmStackSize: $evmStackSize\n gasLimit: $gasLimit\n gasPrice: $gasPrice\n name: $name\n nodeName: $nodeName\n secondsPerBlock: $secondsPerBlock\n provider: $provider\n region: $region\n size: $size\n type: $type\n batchTimeout: $batchTimeout\n maxMessageCount: $maxMessageCount\n absoluteMaxBytes: $absoluteMaxBytes\n preferredMaxBytes: $preferredMaxBytes\n endorsementPolicy: $endorsementPolicy\n maxCodeSize: $maxCodeSize\n txnSizeLimit: $txnSizeLimit\n besuIbft2Genesis: $besuIbft2Genesis\n besuQbftGenesis: $besuQbftGenesis\n quorumGenesis: $quorumGenesis\n externalNodes: $externalNodes\n keyMaterial: $privateKeyId\n ) {\n ...BlockchainNetwork\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Arguments required to create a blockchain network.\n */\nexport type CreateBlockchainNetworkArgs = Omit<VariablesOf<typeof createBlockchainNetwork>, \"applicationId\"> & {\n applicationUniqueName: string;\n};\n\n/**\n * Mutation to delete a blockchain network.\n */\nconst deleteBlockchainNetwork = graphql(\n `\n mutation deleteBlockchainNetwork($uniqueName: String!) {\n deleteBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNetwork\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Mutation to restart a blockchain network.\n */\nconst restartBlockchainNetwork = graphql(\n `\n mutation RestartBlockchainNetwork($uniqueName: String!) {\n restartBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNetwork\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Mutation to pause a blockchain network.\n */\nconst pauseBlockchainNetwork = graphql(\n `\n mutation PauseBlockchainNetwork($uniqueName: String!) {\n pauseBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNetwork\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Mutation to resume a blockchain network.\n */\nconst resumeBlockchainNetwork = graphql(\n `\n mutation ResumeBlockchainNetwork($uniqueName: String!) {\n resumeBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNetwork\n }\n }\n `,\n [BlockchainNetworkFragment],\n);\n\n/**\n * Creates a function to list blockchain networks for a given application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches networks for an application\n * @throws If the application cannot be found or the request fails\n */\nexport const blockchainNetworkList = (gqlClient: GraphQLClient) => {\n return async (applicationUniqueName: string) => {\n const {\n blockchainNetworksByUniqueName: { items },\n } = await gqlClient.request(getBlockchainNetworks, { applicationUniqueName });\n return items;\n };\n};\n\n/**\n * Creates a function to fetch a specific blockchain network.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches a single network by unique name\n * @throws If the network cannot be found or the request fails\n */\nexport const blockchainNetworkRead = (gqlClient: GraphQLClient) => {\n return async (blockchainNetworkUniqueName: string) => {\n const { blockchainNetworkByUniqueName } = await gqlClient.request(getBlockchainNetwork, {\n uniqueName: blockchainNetworkUniqueName,\n });\n return blockchainNetworkByUniqueName;\n };\n};\n\n/**\n * Creates a function to create a new blockchain network.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that creates a new network with the provided configuration\n * @throws If the creation fails or validation errors occur\n */\nexport const blockchainNetworkCreate = (\n gqlClient: GraphQLClient,\n): ((args: CreateBlockchainNetworkArgs) => Promise<BlockchainNetwork>) => {\n return async (args: CreateBlockchainNetworkArgs) => {\n const { applicationUniqueName, ...otherArgs } = args;\n const application = await applicationRead(gqlClient)(applicationUniqueName);\n const blockchainNetworkArgs = setNetworkDefaults(otherArgs);\n const { createBlockchainNetwork: blockchainNetwork } = await gqlClient.request(createBlockchainNetwork, {\n ...blockchainNetworkArgs,\n applicationId: application.id,\n });\n return blockchainNetwork;\n };\n};\n\n/**\n * Creates a function to delete a blockchain network.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that deletes a network by unique name\n * @throws If the network cannot be found or the deletion fails\n */\nexport const blockchainNetworkDelete = (gqlClient: GraphQLClient) => {\n return async (blockchainNetworkUniqueName: string) => {\n const { deleteBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(\n deleteBlockchainNetwork,\n {\n uniqueName: blockchainNetworkUniqueName,\n },\n );\n return blockchainNetwork;\n };\n};\n\n/**\n * Creates a function to restart a blockchain network.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that restarts a network by unique name\n * @throws If the network cannot be found or the restart fails\n */\nexport const blockchainNetworkRestart =\n (gqlClient: GraphQLClient) =>\n async (blockchainNetworkUniqueName: string): Promise<BlockchainNetwork> => {\n const { restartBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(\n restartBlockchainNetwork,\n { uniqueName: blockchainNetworkUniqueName },\n );\n return blockchainNetwork;\n };\n\n/**\n * Creates a function to pause a blockchain network.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that pauses a network by unique name\n * @throws If the network cannot be found or the pause fails\n */\nexport const blockchainNetworkPause =\n (gqlClient: GraphQLClient) =>\n async (blockchainNetworkUniqueName: string): Promise<BlockchainNetwork> => {\n const { pauseBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(pauseBlockchainNetwork, {\n uniqueName: blockchainNetworkUniqueName,\n });\n return blockchainNetwork;\n };\n\n/**\n * Creates a function to resume a blockchain network.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that resumes a network by unique name\n * @throws If the network cannot be found or the resume fails\n */\nexport const blockchainNetworkResume =\n (gqlClient: GraphQLClient) =>\n async (blockchainNetworkUniqueName: string): Promise<BlockchainNetwork> => {\n const { resumeBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(\n resumeBlockchainNetwork,\n { uniqueName: blockchainNetworkUniqueName },\n );\n return blockchainNetwork;\n };\n","import type { GraphQLClient } from \"graphql-request\";\nimport { applicationRead } from \"@/graphql/application.js\";\nimport { graphql, type ResultOf, type VariablesOf } from \"@/helpers/graphql.js\";\nimport { blockchainNetworkRead } from \"./blockchain-network.js\";\n\n/**\n * Fragment containing core blockchain node fields.\n */\nconst BlockchainNodeFragment = graphql(`\n fragment BlockchainNode on BlockchainNode {\n __typename\n id\n uniqueName\n name\n status\n healthStatus\n provider\n region\n isEvm\n endpoints {\n id\n label\n displayValue\n }\n credentials {\n id\n label\n displayValue\n }\n blockchainNetwork {\n ... on AbstractClusterService {\n id\n name\n uniqueName\n ... on BesuQBFTBlockchainNetwork {\n chainId\n }\n ... on BesuIbftv2BlockchainNetwork {\n chainId\n }\n ... on PolygonEdgePoABlockchainNetwork {\n chainId\n }\n ... on QuorumQBFTBlockchainNetwork {\n chainId\n }\n ... on GethCliqueBlockchainNetwork {\n chainId\n }\n ... on PublicEvmBlockchainNetwork {\n chainId\n }\n }\n }\n privateKeys {\n ... on PrivateKey {\n id\n name\n privateKeyType\n address\n }\n }\n }\n`);\n\n/**\n * Type representing a blockchain node entity.\n */\nexport type BlockchainNode = ResultOf<typeof BlockchainNodeFragment>;\n\n/**\n * Query to fetch blockchain nodes for an application.\n */\nconst getBlockchainNodes = graphql(\n `\n query getBlockchainNodes($applicationUniqueName: String!) {\n blockchainNodesByUniqueName(applicationUniqueName: $applicationUniqueName) {\n items {\n ...BlockchainNode\n }\n }\n }\n `,\n [BlockchainNodeFragment],\n);\n\n/**\n * Query to fetch a specific blockchain node.\n */\nconst getBlockchainNode = graphql(\n `\n query getBlockchainNode($uniqueName: String!) {\n blockchainNodeByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNode\n }\n }\n `,\n [BlockchainNodeFragment],\n);\n\n/**\n * Mutation to create a blockchain node.\n */\nconst createBlockchainNode = graphql(\n `\n mutation createBlockchainNode(\n $applicationId: ID!\n $blockchainNetworkId: ID!\n $name: String!\n $provider: String!\n $region: String!\n $size: ClusterServiceSize\n $type: ClusterServiceType\n $nodeType: NodeType\n $keyMaterial: ID\n ) {\n createBlockchainNode(\n applicationId: $applicationId\n blockchainNetworkId: $blockchainNetworkId\n name: $name\n provider: $provider\n region: $region\n size: $size\n type: $type\n nodeType: $nodeType\n keyMaterial: $keyMaterial\n ) {\n ...BlockchainNode\n }\n }\n `,\n [BlockchainNodeFragment],\n);\n\n/**\n * Arguments required to create a blockchain node.\n */\nexport type CreateBlockchainNodeArgs = Omit<\n VariablesOf<typeof createBlockchainNode>,\n \"applicationId\" | \"blockchainNetworkId\"\n> & {\n applicationUniqueName: string;\n blockchainNetworkUniqueName: string;\n};\n\n/**\n * Mutation to restart a blockchain node.\n */\nconst restartBlockchainNode = graphql(\n `\n mutation RestartBlockchainNode($uniqueName: String!) {\n restartBlockchainNodeByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNode\n }\n }\n `,\n [BlockchainNodeFragment],\n);\n\n/**\n * Mutation to pause a blockchain node.\n */\nconst pauseBlockchainNode = graphql(\n `\n mutation PauseBlockchainNode($uniqueName: String!) {\n pauseBlockchainNodeByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNode\n }\n }\n `,\n [BlockchainNodeFragment],\n);\n\n/**\n * Mutation to resume a blockchain node.\n */\nconst resumeBlockchainNode = graphql(\n `\n mutation ResumeBlockchainNode($uniqueName: String!) {\n resumeBlockchainNodeByUniqueName(uniqueName: $uniqueName) {\n ...BlockchainNode\n }\n }\n `,\n [BlockchainNodeFragment],\n);\n\n/**\n * Creates a function to list blockchain nodes for an application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches blockchain nodes for an application\n * @throws If the application cannot be found or the request fails\n */\nexport const blockchainNodeList = (gqlClient: GraphQLClient) => {\n return async (applicationUniqueName: string): Promise<BlockchainNode[]> => {\n const {\n blockchainNodesByUniqueName: { items },\n } = await gqlClient.request(getBlockchainNodes, { applicationUniqueName });\n return items;\n };\n};\n\n/**\n * Creates a function to fetch a specific blockchain node.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches a single blockchain node by unique name\n * @throws If the blockchain node cannot be found or the request fails\n */\nexport const blockchainNodeRead = (gqlClient: GraphQLClient) => {\n return async (blockchainNodeUniqueName: string): Promise<BlockchainNode> => {\n const { blockchainNodeByUniqueName } = await gqlClient.request(getBlockchainNode, {\n uniqueName: blockchainNodeUniqueName,\n });\n return blockchainNodeByUniqueName;\n };\n};\n\n/**\n * Creates a function to create a new blockchain node.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that creates a new blockchain node with the provided configuration\n * @throws If the creation fails or validation errors occur\n */\nexport const blockchainNodeCreate = (gqlClient: GraphQLClient) => {\n return async (args: CreateBlockchainNodeArgs): Promise<BlockchainNode> => {\n const { applicationUniqueName, blockchainNetworkUniqueName, ...otherArgs } = args;\n const [application, blockchainNetwork] = await Promise.all([\n applicationRead(gqlClient)(applicationUniqueName),\n blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),\n ]);\n const { createBlockchainNode: blockchainNode } = await gqlClient.request(createBlockchainNode, {\n ...otherArgs,\n applicationId: application.id,\n blockchainNetworkId: blockchainNetwork.id,\n });\n return blockchainNode;\n };\n};\n\n/**\n * Creates a function to restart a blockchain node.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that restarts a blockchain node by unique name\n * @throws If the blockchain node cannot be found or the restart fails\n */\nexport const blockchainNodeRestart =\n (gqlClient: GraphQLClient) =>\n async (blockchainNodeUniqueName: string): Promise<BlockchainNode> => {\n const { restartBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(restartBlockchainNode, {\n uniqueName: blockchainNodeUniqueName,\n });\n return blockchainNode;\n };\n\n/**\n * Creates a function to pause a blockchain node.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that pauses a blockchain node by unique name\n * @throws If the blockchain node cannot be found or the pause fails\n */\nexport const blockchainNodePause =\n (gqlClient: GraphQLClient) =>\n async (blockchainNodeUniqueName: string): Promise<BlockchainNode> => {\n const { pauseBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(pauseBlockchainNode, {\n uniqueName: blockchainNodeUniqueName,\n });\n return blockchainNode;\n };\n\n/**\n * Creates a function to resume a blockchain node.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that resumes a blockchain node by unique name\n * @throws If the blockchain node cannot be found or the resume fails\n */\nexport const blockchainNodeResume =\n (gqlClient: GraphQLClient) =>\n async (blockchainNodeUniqueName: string): Promise<BlockchainNode> => {\n const { resumeBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(resumeBlockchainNode, {\n uniqueName: blockchainNodeUniqueName,\n });\n return blockchainNode;\n };\n","import type { GraphQLClient } from \"graphql-request\";\nimport { applicationRead } from \"@/graphql/application.js\";\nimport { graphql, type ResultOf, type VariablesOf } from \"@/helpers/graphql.js\";\n\n/**\n * Fragment containing core custom deployment fields.\n */\nconst CustomDeploymentFragment = graphql(`\n fragment CustomDeployment on CustomDeployment {\n id\n uniqueName\n name\n status\n healthStatus\n provider\n region\n endpoints {\n id\n label\n displayValue\n }\n credentials {\n id\n label\n displayValue\n }\n }\n`);\n\n/**\n * Type representing a custom deployment entity.\n */\nexport type CustomDeployment = ResultOf<typeof CustomDeploymentFragment>;\n\n/**\n * Query to fetch custom deployments for an application.\n */\nconst getCustomDeployments = graphql(\n `\n query getCustomDeployments($applicationUniqueName: String!) {\n customDeploymentsByUniqueName(applicationUniqueName: $applicationUniqueName) {\n items {\n ...CustomDeployment\n }\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Query to fetch a specific custom deployment.\n */\nconst getCustomDeployment = graphql(\n `\n query getCustomDeployment($uniqueName: String!) {\n customDeploymentByUniqueName(uniqueName: $uniqueName) {\n ...CustomDeployment\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Mutation to edit a custom deployment.\n */\nconst editCustomDeployment = graphql(\n `\n mutation EditCustomDeployment($uniqueName: String!, $imageTag: String) {\n editCustomDeploymentByUniqueName(uniqueName: $uniqueName, imageTag: $imageTag) {\n ...CustomDeployment\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Mutation to create a custom deployment.\n */\nconst createCustomDeployment = graphql(\n `\n mutation CreateCustomDeployment(\n $applicationId: ID!\n $name: String!\n $imageTag: String!\n $imageName: String!\n $imageRepository: String!\n $environmentVariables: JSON\n $port: Int!\n $provider: String!\n $region: String!\n $size: ClusterServiceSize\n $type: ClusterServiceType\n ) {\n createCustomDeployment(\n applicationId: $applicationId\n name: $name\n imageTag: $imageTag\n imageName: $imageName\n imageRepository: $imageRepository\n port: $port\n environmentVariables: $environmentVariables\n provider: $provider\n region: $region\n size: $size\n type: $type\n ) {\n ...CustomDeployment\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Arguments required to create a custom deployment.\n */\nexport type CreateCustomDeploymentArgs = Omit<VariablesOf<typeof createCustomDeployment>, \"applicationId\"> & {\n applicationUniqueName: string;\n};\n\n/**\n * Mutation to restart a custom deployment.\n */\nconst restartCustomDeployment = graphql(\n `\n mutation RestartCustomDeployment($uniqueName: String!) {\n restartCustomDeploymentByUniqueName(uniqueName: $uniqueName) {\n ...CustomDeployment\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Mutation to pause a custom deployment.\n */\nconst pauseCustomDeployment = graphql(\n `\n mutation PauseCustomDeployment($uniqueName: String!) {\n pauseCustomDeploymentByUniqueName(uniqueName: $uniqueName) {\n ...CustomDeployment\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Mutation to resume a custom deployment.\n */\nconst resumeCustomDeployment = graphql(\n `\n mutation ResumeCustomDeployment($uniqueName: String!) {\n resumeCustomDeploymentByUniqueName(uniqueName: $uniqueName) {\n ...CustomDeployment\n }\n }\n `,\n [CustomDeploymentFragment],\n);\n\n/**\n * Creates a function to list custom deployments for an application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches custom deployments for an application\n * @throws If the application cannot be found or the request fails\n */\nexport const customdeploymentList = (\n gqlClient: GraphQLClient,\n): ((applicationUniqueName: string) => Promise<CustomDeployment[]>) => {\n return async (applicationUniqueName: string) => {\n const {\n customDeploymentsByUniqueName: { items },\n } = await gqlClient.request(getCustomDeployments, { applicationUniqueName });\n return items;\n };\n};\n\n/**\n * Creates a function to fetch a specific custom deployment.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches a single custom deployment by unique name\n * @throws If the custom deployment cannot be found or the request fails\n */\nexport const customdeploymentRead = (\n gqlClient: GraphQLClient,\n): ((customDeploymentUniqueName: string) => Promise<CustomDeployment>) => {\n return async (customDeploymentUniqueName: string) => {\n const { customDeploymentByUniqueName: customDeployment } = await gqlClient.request(getCustomDeployment, {\n uniqueName: customDeploymentUniqueName,\n });\n return customDeployment;\n };\n};\n\n/**\n * Creates a function to update a custom deployment.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that updates a custom deployment with a new image tag\n * @throws If the custom deployment cannot be found or the update fails\n */\nexport const customdeploymentUpdate = (\n gqlClient: GraphQLClient,\n): ((customDeploymentUniqueName: string, imageTag: string) => Promise<CustomDeployment>) => {\n return async (customDeploymentUniqueName: string, imageTag: string) => {\n const { editCustomDeploymentByUniqueName: cd } = await gqlClient.request(editCustomDeployment, {\n uniqueName: customDeploymentUniqueName,\n imageTag,\n });\n return cd;\n };\n};\n\n/**\n * Creates a function to create a new custom deployment.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that creates a new custom deployment with the provided configuration\n * @throws If the creation fails or validation errors occur\n */\nexport const customdeploymentCreate = (\n gqlClient: GraphQLClient,\n): ((args: CreateCustomDeploymentArgs) => Promise<CustomDeployment>) => {\n return async (args: CreateCustomDeploymentArgs) => {\n const { applicationUniqueName, ...otherArgs } = args;\n const application = await applicationRead(gqlClient)(applicationUniqueName);\n const { createCustomDeployment: customDeployment } = await gqlClient.request(createCustomDeployment, {\n ...otherArgs,\n applicationId: application.id,\n });\n return customDeployment;\n };\n};\n\n/**\n * Creates a function to restart a custom deployment.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that restarts a custom deployment by unique name\n * @throws If the custom deployment cannot be found or the restart fails\n */\nexport const customDeploymentRestart =\n (gqlClient: GraphQLClient) =>\n async (customDeploymentUniqueName: string): Promise<CustomDeployment> => {\n const { restartCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(restartCustomDeployment, {\n uniqueName: customDeploymentUniqueName,\n });\n return customDeployment;\n };\n\n/**\n * Creates a function to pause a custom deployment.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that pauses a custom deployment by unique name\n * @throws If the custom deployment cannot be found or the pause fails\n */\nexport const customDeploymentPause =\n (gqlClient: GraphQLClient) =>\n async (customDeploymentUniqueName: string): Promise<CustomDeployment> => {\n const { pauseCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(pauseCustomDeployment, {\n uniqueName: customDeploymentUniqueName,\n });\n return customDeployment;\n };\n\n/**\n * Creates a function to resume a custom deployment.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that resumes a custom deployment by unique name\n * @throws If the custom deployment cannot be found or the resume fails\n */\nexport const customDeploymentResume =\n (gqlClient: GraphQLClient) =>\n async (customDeploymentUniqueName: string): Promise<CustomDeployment> => {\n const { resumeCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(resumeCustomDeployment, {\n uniqueName: customDeploymentUniqueName,\n });\n return customDeployment;\n };\n","import { type ResultOf, type VariablesOf, graphql } from \"@/helpers/graphql.js\";\nimport type { GraphQLClient } from \"graphql-request\";\n\n/**\n * Query to fetch Foundry environment configuration for a blockchain node.\n */\nconst getFoundryEnvConfig = graphql(\n `\n query GetFoundryEnvConfig($blockchainNodeUniqueName: String!) {\n foundryEnvConfigByUniqueName(blockchainNodeUniqueName: $blockchainNodeUniqueName)\n }\n `,\n);\n\n/**\n * Variables for the Foundry environment config query.\n */\nexport type GetFoundryEnvConfigVariables = VariablesOf<typeof getFoundryEnvConfig>;\n\n/**\n * Result type for the Foundry environment config query.\n */\nexport type GetFoundryEnvConfigResult = ResultOf<typeof getFoundryEnvConfig>;\n\n/**\n * Creates a function to fetch Foundry environment configuration.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches Foundry environment configuration for a blockchain node\n * @throws If the blockchain node cannot be found or the request fails\n */\nexport const getEnv = (gqlClient: GraphQLClient) => {\n return async (blockchainNodeUniqueName: string): Promise<Record<string, string>> => {\n const { foundryEnvConfigByUniqueName } = await gqlClient.request(getFoundryEnvConfig, { blockchainNodeUniqueName });\n return foundryEnvConfigByUniqueName as Record<string, string>;\n };\n};\n","import type { GraphQLClient } from \"graphql-request\";\nimport { applicationRead } from \"@/graphql/application.js\";\nimport { blockchainNetworkRead } from \"@/graphql/blockchain-network.js\";\nimport { graphql, type ResultOf, type VariablesOf } from \"@/helpers/graphql.js\";\nimport { blockchainNodeRead } from \"./blockchain-node.js\";\n\n/**\n * GraphQL fragment containing core load balancer fields.\n */\nconst LoadBalancerFragment = graphql(`\n fragment LoadBalancer on LoadBalancer {\n __typename\n id\n uniqueName\n name\n status\n healthStatus\n provider\n region\n endpoints {\n id\n label\n displayValue\n }\n }\n`);\n\n/**\n * Type representing a load balancer entity.\n */\nexport type LoadBalancer = ResultOf<typeof LoadBalancerFragment>;\n\n/**\n * Query to fetch a specific load balancer.\n */\nconst getLoadBalancer = graphql(\n `\n query GetLoadBalancer($uniqueName: String!) {\n loadBalancerByUniqueName(uniqueName: $uniqueName) {\n ...LoadBalancer\n }\n }\n `,\n [LoadBalancerFragment],\n);\n\n/**\n * Query to fetch all load balancers for an application.\n */\nconst getLoadBalancers = graphql(\n `\n query getLoadBalancers($applicationUniqueName: String!) {\n loadBalancersByUniqueName(applicationUniqueName: $applicationUniqueName) {\n items {\n ...LoadBalancer\n }\n }\n }\n `,\n [LoadBalancerFragment],\n);\n\n/**\n * Mutation to create a load balancer.\n */\nconst createLoadBalancer = graphql(\n `\n mutation createLoadBalancer(\n $applicationId: ID!\n $blockchainNetworkId: ID!\n $name: String!\n $provider: String!\n $region: String!\n $size: ClusterServiceSize\n $type: ClusterServiceType\n $connectedNodes: [ID!]!\n ) {\n createLoadBalancer(\n applicationId: $applicationId\n blockchainNetworkId: $blockchainNetworkId\n name: $name\n provider: $provider\n region: $region\n size: $size\n type: $type\n connectedNodes: $connectedNodes\n ) {\n ...LoadBalancer\n }\n }\n `,\n [LoadBalancerFragment],\n);\n\n/**\n * Arguments required to create a load balancer.\n */\nexport type CreateLoadBalancerArgs = Omit<\n VariablesOf<typeof createLoadBalancer>,\n \"applicationId\" | \"blockchainNetworkId\" | \"connectedNodes\"\n> & {\n applicationUniqueName: string;\n blockchainNetworkUniqueName: string;\n connectedNodesUniqueNames: string[];\n};\n\n/**\n * Mutation to restart a load balancer.\n */\nconst restartLoadBalancer = graphql(\n `\n mutation RestartLoadBalancer($uniqueName: String!) {\n restartLoadBalancerByUniqueName(uniqueName: $uniqueName) {\n ...LoadBalancer\n }\n }\n `,\n [LoadBalancerFragment],\n);\n\n/**\n * Mutation to pause a load balancer.\n */\nconst pauseLoadBalancer = graphql(\n `\n mutation PauseLoadBalancer($uniqueName: String!) {\n pauseLoadBalancerByUniqueName(uniqueName: $uniqueName) {\n ...LoadBalancer\n }\n }\n `,\n [LoadBalancerFragment],\n);\n\n/**\n * Mutation to resume a load balancer.\n */\nconst resumeLoadBalancer = graphql(\n `\n mutation ResumeLoadBalancer($uniqueName: String!) {\n resumeLoadBalancerByUniqueName(uniqueName: $uniqueName) {\n ...LoadBalancer\n }\n }\n `,\n [LoadBalancerFragment],\n);\n\n/**\n * Creates a function to fetch a specific load balancer.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches a single load balancer by unique name\n * @throws If the load balancer cannot be found or the request fails\n */\nexport const loadBalancerRead = (\n gqlClient: GraphQLClient,\n): ((loadBalancerUniqueName: string) => Promise<LoadBalancer>) => {\n return async (loadBalancerUniqueName: string): Promise<LoadBalancer> => {\n const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {\n uniqueName: loadBalancerUniqueName,\n });\n return loadBalancer as LoadBalancer;\n };\n};\n\n/**\n * Creates a function to list load balancers for an application.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that fetches load balancers for an application\n * @throws If the application cannot be found or the request fails\n */\nexport const loadBalancerList = (gqlClient: GraphQLClient) => {\n return async (applicationUniqueName: string): Promise<LoadBalancer[]> => {\n const {\n loadBalancersByUniqueName: { items },\n } = await gqlClient.request(getLoadBalancers, { applicationUniqueName });\n return items as LoadBalancer[];\n };\n};\n\n/**\n * Creates a function to create a load balancer.\n *\n * @param gqlClient - The GraphQL client instance\n * @returns Function that creates a load balancer\n * @throws If the load balancer cannot be created or the request f