diff --git a/packages/cre-sdk/scripts/src/fix-imports.ts b/packages/cre-sdk/scripts/src/fix-imports.ts index f983f60..1d0d2aa 100644 --- a/packages/cre-sdk/scripts/src/fix-imports.ts +++ b/packages/cre-sdk/scripts/src/fix-imports.ts @@ -17,7 +17,7 @@ const fixImports = async () => { const content = await readFile(file, 'utf-8') // Replace @cre/* imports with relative paths - const fixedContent = content.replace(/@cre\/([^'"]*)/g, (_, path) => { + const fixedContent = content.replace(/@cre\/([A-Za-z0-9/_.\-]+)/g, (_, path) => { // Convert @cre/sdk/utils to relative path from current file const currentDir = dirname(file) const targetPath = join(process.cwd(), 'dist', path) diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.ts index 6c2a32c..bf115c0 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.ts @@ -1,464 +1,521 @@ -import type { Trigger } from "@cre/sdk/utils/triggers/trigger-interface" -import { type Any, AnySchema, anyPack } from "@bufbuild/protobuf/wkt" -import type { Runtime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import { hexToBytes } from "@cre/sdk/utils/hex-utils"; -import { fromJson, create } from "@bufbuild/protobuf" +import { create, fromJson } from '@bufbuild/protobuf' +import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' import { - BalanceAtReplySchema, - BalanceAtRequestSchema, - CallContractReplySchema, - CallContractRequestSchema, - EstimateGasReplySchema, - EstimateGasRequestSchema, - FilterLogTriggerRequestSchema, - FilterLogsReplySchema, - FilterLogsRequestSchema, - GasConfigSchema, - GetTransactionByHashReplySchema, - GetTransactionByHashRequestSchema, - GetTransactionReceiptReplySchema, - GetTransactionReceiptRequestSchema, - HeaderByNumberReplySchema, - HeaderByNumberRequestSchema, - LogSchema, - WriteReportReplySchema, - WriteReportRequestSchema, - type BalanceAtReply, - type BalanceAtRequest, - type BalanceAtRequestJson, - type CallContractReply, - type CallContractRequest, - type CallContractRequestJson, - type EstimateGasReply, - type EstimateGasRequest, - type EstimateGasRequestJson, - type FilterLogTriggerRequest, - type FilterLogTriggerRequestJson, - type FilterLogsReply, - type FilterLogsRequest, - type FilterLogsRequestJson, - type GasConfig, - type GasConfigJson, - type GetTransactionByHashReply, - type GetTransactionByHashRequest, - type GetTransactionByHashRequestJson, - type GetTransactionReceiptReply, - type GetTransactionReceiptRequest, - type GetTransactionReceiptRequestJson, - type HeaderByNumberReply, - type HeaderByNumberRequest, - type HeaderByNumberRequestJson, - type Log, - type WriteReportReply, - type WriteReportRequest, - type WriteReportRequestJson, -} from "@cre/generated/capabilities/blockchain/evm/v1alpha/client_pb" + type BalanceAtReply, + BalanceAtReplySchema, + type BalanceAtRequest, + type BalanceAtRequestJson, + BalanceAtRequestSchema, + type CallContractReply, + CallContractReplySchema, + type CallContractRequest, + type CallContractRequestJson, + CallContractRequestSchema, + type EstimateGasReply, + EstimateGasReplySchema, + type EstimateGasRequest, + type EstimateGasRequestJson, + EstimateGasRequestSchema, + type FilterLogsReply, + FilterLogsReplySchema, + type FilterLogsRequest, + type FilterLogsRequestJson, + FilterLogsRequestSchema, + type FilterLogTriggerRequest, + type FilterLogTriggerRequestJson, + FilterLogTriggerRequestSchema, + type GasConfig, + type GasConfigJson, + GasConfigSchema, + type GetTransactionByHashReply, + GetTransactionByHashReplySchema, + type GetTransactionByHashRequest, + type GetTransactionByHashRequestJson, + GetTransactionByHashRequestSchema, + type GetTransactionReceiptReply, + GetTransactionReceiptReplySchema, + type GetTransactionReceiptRequest, + type GetTransactionReceiptRequestJson, + GetTransactionReceiptRequestSchema, + type HeaderByNumberReply, + HeaderByNumberReplySchema, + type HeaderByNumberRequest, + type HeaderByNumberRequestJson, + HeaderByNumberRequestSchema, + type Log, + LogSchema, + type WriteReportReply, + WriteReportReplySchema, + type WriteReportRequest, + type WriteReportRequestJson, + WriteReportRequestSchema, +} from '@cre/generated/capabilities/blockchain/evm/v1alpha/client_pb' import { - ReportResponseSchema, - type ReportResponse, - type ReportResponseJson, -} from "@cre/generated/sdk/v1alpha/sdk_pb" - - + type ReportResponse, + type ReportResponseJson, + ReportResponseSchema, +} from '@cre/generated/sdk/v1alpha/sdk_pb' +import type { Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import { hexToBytes } from '@cre/sdk/utils/hex-utils' +import type { Trigger } from '@cre/sdk/utils/triggers/trigger-interface' export type WriteCreReportRequest = { - receiver: Uint8Array; - report?: Report; - gasConfig?: GasConfig; - $report: true -}; + receiver: Uint8Array + report?: Report + gasConfig?: GasConfig + $report: true +} export type WriteCreReportRequestJson = { - receiver: string; - report?: Report; - gasConfig?: GasConfigJson -}; + receiver: string + report?: Report + gasConfig?: GasConfigJson +} -export function x_generatedCodeOnly_wrap_WriteCreReportRequest(input: WriteReportRequest): WriteCreReportRequest { - return { - receiver: input.receiver, - report: input.report !== undefined ? new Report(input.report) : undefined, - gasConfig: input.gasConfig, - $report: true - }; - } - -export function createWriteCreReportRequest(input: WriteCreReportRequestJson): WriteCreReportRequest { - return { - receiver: hexToBytes(input.receiver), - report: input.report, - gasConfig: input.gasConfig !== undefined ? fromJson(GasConfigSchema, input.gasConfig) : undefined, - $report: true - }; - } - -export function x_generatedCodeOnly_unwrap_WriteCreReportRequest(input: WriteCreReportRequest): WriteReportRequest { - return create(WriteReportRequestSchema, { - receiver: input.receiver, - report: input.report !== undefined ? input.report.x_generatedCodeOnly_unwrap() : undefined, - gasConfig: input.gasConfig - }); - } - +export function x_generatedCodeOnly_wrap_WriteCreReportRequest( + input: WriteReportRequest, +): WriteCreReportRequest { + return { + receiver: input.receiver, + report: input.report !== undefined ? new Report(input.report) : undefined, + gasConfig: input.gasConfig, + $report: true, + } +} + +export function createWriteCreReportRequest( + input: WriteCreReportRequestJson, +): WriteCreReportRequest { + return { + receiver: hexToBytes(input.receiver), + report: input.report, + gasConfig: + input.gasConfig !== undefined ? fromJson(GasConfigSchema, input.gasConfig) : undefined, + $report: true, + } +} + +export function x_generatedCodeOnly_unwrap_WriteCreReportRequest( + input: WriteCreReportRequest, +): WriteReportRequest { + return create(WriteReportRequestSchema, { + receiver: input.receiver, + report: input.report !== undefined ? input.report.x_generatedCodeOnly_unwrap() : undefined, + gasConfig: input.gasConfig, + }) +} /** * Client Capability - * + * * Capability ID: evm@1.0.0 * Capability Name: evm * Capability Version: 1.0.0 */ export class ClientCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "evm@1.0.0"; - - static readonly CAPABILITY_NAME = "evm"; - static readonly CAPABILITY_VERSION = "1.0.0"; - - /** Available ChainSelector values */ - static readonly SUPPORTED_CHAIN_SELECTORS = { - "apechain-testnet-curtis": 9900119385908781505n, - "arc-testnet": 3034092155422581607n, - "avalanche-mainnet": 6433500567565415381n, - "avalanche-testnet-fuji": 14767482510784806043n, - "binance_smart_chain-mainnet": 11344663589394136015n, - "binance_smart_chain-testnet": 13264668187771770619n, - "ethereum-mainnet": 5009297550715157269n, - "ethereum-mainnet-arbitrum-1": 4949039107694359620n, - "ethereum-mainnet-base-1": 15971525489660198786n, - "ethereum-mainnet-optimism-1": 3734403246176062136n, - "ethereum-mainnet-worldchain-1": 2049429975587534727n, - "ethereum-mainnet-zksync-1": 1562403441176082196n, - "ethereum-testnet-sepolia": 16015286601757825753n, - "ethereum-testnet-sepolia-arbitrum-1": 3478487238524512106n, - "ethereum-testnet-sepolia-base-1": 10344971235874465080n, - "ethereum-testnet-sepolia-linea-1": 5719461335882077547n, - "ethereum-testnet-sepolia-optimism-1": 5224473277236331295n, - "ethereum-testnet-sepolia-worldchain-1": 5299555114858065850n, - "ethereum-testnet-sepolia-zksync-1": 6898391096552792247n, - "hyperliquid-testnet": 4286062357653186312n, - "ink-testnet-sepolia": 9763904284804119144n, - "jovay-testnet": 945045181441419236n, - "plasma-testnet": 3967220077692964309n, - "polygon-mainnet": 4051577828743386545n, - "polygon-testnet-amoy": 16281711391670634445n, - "private-testnet-andesite": 6915682381028791124n - } as const + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'evm@1.0.0' + + static readonly CAPABILITY_NAME = 'evm' + static readonly CAPABILITY_VERSION = '1.0.0' + + /** Available ChainSelector values */ + static readonly SUPPORTED_CHAIN_SELECTORS = { + 'apechain-testnet-curtis': 9900119385908781505n, + 'arc-testnet': 3034092155422581607n, + 'avalanche-mainnet': 6433500567565415381n, + 'avalanche-testnet-fuji': 14767482510784806043n, + 'binance_smart_chain-mainnet': 11344663589394136015n, + 'binance_smart_chain-testnet': 13264668187771770619n, + 'celo-mainnet': 1346049177634351622n, + 'cronos-testnet': 2995292832068775165n, + 'dtcc-testnet-andesite': 15513093881969820114n, + 'ethereum-mainnet': 5009297550715157269n, + 'ethereum-mainnet-arbitrum-1': 4949039107694359620n, + 'ethereum-mainnet-base-1': 15971525489660198786n, + 'ethereum-mainnet-ink-1': 3461204551265785888n, + 'ethereum-mainnet-linea-1': 4627098889531055414n, + 'ethereum-mainnet-mantle-1': 1556008542357238666n, + 'ethereum-mainnet-optimism-1': 3734403246176062136n, + 'ethereum-mainnet-scroll-1': 13204309965629103672n, + 'ethereum-mainnet-worldchain-1': 2049429975587534727n, + 'ethereum-mainnet-xlayer-1': 3016212468291539606n, + 'ethereum-mainnet-zksync-1': 1562403441176082196n, + 'ethereum-testnet-sepolia': 16015286601757825753n, + 'ethereum-testnet-sepolia-arbitrum-1': 3478487238524512106n, + 'ethereum-testnet-sepolia-base-1': 10344971235874465080n, + 'ethereum-testnet-sepolia-linea-1': 5719461335882077547n, + 'ethereum-testnet-sepolia-mantle-1': 8236463271206331221n, + 'ethereum-testnet-sepolia-optimism-1': 5224473277236331295n, + 'ethereum-testnet-sepolia-scroll-1': 2279865765895943307n, + 'ethereum-testnet-sepolia-unichain-1': 14135854469784514356n, + 'ethereum-testnet-sepolia-worldchain-1': 5299555114858065850n, + 'ethereum-testnet-sepolia-zksync-1': 6898391096552792247n, + 'gnosis_chain-mainnet': 465200170687744372n, + 'gnosis_chain-testnet-chiado': 8871595565390010547n, + 'hyperliquid-mainnet': 2442541497099098535n, + 'hyperliquid-testnet': 4286062357653186312n, + 'ink-testnet-sepolia': 9763904284804119144n, + 'jovay-mainnet': 1523760397290643893n, + 'jovay-testnet': 945045181441419236n, + 'megaeth-mainnet': 6093540873831549674n, + 'megaeth-testnet-2': 18241817625092392675n, + 'pharos-atlantic-testnet': 16098325658947243212n, + 'pharos-mainnet': 7801139999541420232n, + 'plasma-mainnet': 9335212494177455608n, + 'plasma-testnet': 3967220077692964309n, + 'polygon-mainnet': 4051577828743386545n, + 'polygon-testnet-amoy': 16281711391670634445n, + 'private-testnet-andesite': 6915682381028791124n, + 'sonic-mainnet': 1673871237479749969n, + 'sonic-testnet': 1763698235108410440n, + 'tac-testnet': 9488606126177218005n, + 'xlayer-testnet': 10212741611335999305n, + } as const + + constructor(private readonly ChainSelector: bigint) {} + + callContract( + runtime: Runtime, + input: CallContractRequest | CallContractRequestJson, + ): { result: () => CallContractReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: CallContractRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as CallContractRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(CallContractRequestSchema, input as CallContractRequestJson) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'CallContract', + payload, + inputSchema: CallContractRequestSchema, + outputSchema: CallContractReplySchema, + }) - constructor( - private readonly ChainSelector: bigint - ) {} - - callContract(runtime: Runtime, input: CallContractRequest | CallContractRequestJson): {result: () => CallContractReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: CallContractRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as CallContractRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(CallContractRequestSchema, input as CallContractRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "CallContract", - payload, - inputSchema: CallContractRequestSchema, - outputSchema: CallContractReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - filterLogs(runtime: Runtime, input: FilterLogsRequest | FilterLogsRequestJson): {result: () => FilterLogsReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: FilterLogsRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as FilterLogsRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(FilterLogsRequestSchema, input as FilterLogsRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "FilterLogs", - payload, - inputSchema: FilterLogsRequestSchema, - outputSchema: FilterLogsReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - balanceAt(runtime: Runtime, input: BalanceAtRequest | BalanceAtRequestJson): {result: () => BalanceAtReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: BalanceAtRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as BalanceAtRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(BalanceAtRequestSchema, input as BalanceAtRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "BalanceAt", - payload, - inputSchema: BalanceAtRequestSchema, - outputSchema: BalanceAtReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - estimateGas(runtime: Runtime, input: EstimateGasRequest | EstimateGasRequestJson): {result: () => EstimateGasReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: EstimateGasRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as EstimateGasRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(EstimateGasRequestSchema, input as EstimateGasRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "EstimateGas", - payload, - inputSchema: EstimateGasRequestSchema, - outputSchema: EstimateGasReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - getTransactionByHash(runtime: Runtime, input: GetTransactionByHashRequest | GetTransactionByHashRequestJson): {result: () => GetTransactionByHashReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: GetTransactionByHashRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as GetTransactionByHashRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(GetTransactionByHashRequestSchema, input as GetTransactionByHashRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "GetTransactionByHash", - payload, - inputSchema: GetTransactionByHashRequestSchema, - outputSchema: GetTransactionByHashReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - getTransactionReceipt(runtime: Runtime, input: GetTransactionReceiptRequest | GetTransactionReceiptRequestJson): {result: () => GetTransactionReceiptReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: GetTransactionReceiptRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as GetTransactionReceiptRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(GetTransactionReceiptRequestSchema, input as GetTransactionReceiptRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "GetTransactionReceipt", - payload, - inputSchema: GetTransactionReceiptRequestSchema, - outputSchema: GetTransactionReceiptReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - headerByNumber(runtime: Runtime, input: HeaderByNumberRequest | HeaderByNumberRequestJson): {result: () => HeaderByNumberReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: HeaderByNumberRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as HeaderByNumberRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(HeaderByNumberRequestSchema, input as HeaderByNumberRequestJson) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "HeaderByNumber", - payload, - inputSchema: HeaderByNumberRequestSchema, - outputSchema: HeaderByNumberReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - logTrigger(config: FilterLogTriggerRequestJson): ClientLogTrigger { - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - return new ClientLogTrigger(config, capabilityId, "LogTrigger", this.ChainSelector); - } - - writeReport(runtime: Runtime, input: WriteCreReportRequest | WriteCreReportRequestJson): {result: () => WriteReportReply} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: WriteReportRequest - - // Check if it's a wrapped type by looking for the $report property - if ((input as unknown as { $report?: boolean }).$report) { - // It's a wrapped type, unwrap it - payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(input as WriteCreReportRequest) - } else { - // It's wrapped JSON, convert using create function - payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(createWriteCreReportRequest(input as WriteCreReportRequestJson)) - } - - - // Include all labels in capability ID for routing when specified - const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "WriteReport", - payload, - inputSchema: WriteReportRequestSchema, - outputSchema: WriteReportReplySchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + filterLogs( + runtime: Runtime, + input: FilterLogsRequest | FilterLogsRequestJson, + ): { result: () => FilterLogsReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: FilterLogsRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as FilterLogsRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(FilterLogsRequestSchema, input as FilterLogsRequestJson) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'FilterLogs', + payload, + inputSchema: FilterLogsRequestSchema, + outputSchema: FilterLogsReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + balanceAt( + runtime: Runtime, + input: BalanceAtRequest | BalanceAtRequestJson, + ): { result: () => BalanceAtReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: BalanceAtRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as BalanceAtRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(BalanceAtRequestSchema, input as BalanceAtRequestJson) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'BalanceAt', + payload, + inputSchema: BalanceAtRequestSchema, + outputSchema: BalanceAtReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + estimateGas( + runtime: Runtime, + input: EstimateGasRequest | EstimateGasRequestJson, + ): { result: () => EstimateGasReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: EstimateGasRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as EstimateGasRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(EstimateGasRequestSchema, input as EstimateGasRequestJson) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'EstimateGas', + payload, + inputSchema: EstimateGasRequestSchema, + outputSchema: EstimateGasReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + getTransactionByHash( + runtime: Runtime, + input: GetTransactionByHashRequest | GetTransactionByHashRequestJson, + ): { result: () => GetTransactionByHashReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: GetTransactionByHashRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as GetTransactionByHashRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson( + GetTransactionByHashRequestSchema, + input as GetTransactionByHashRequestJson, + ) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability< + GetTransactionByHashRequest, + GetTransactionByHashReply + >({ + capabilityId, + method: 'GetTransactionByHash', + payload, + inputSchema: GetTransactionByHashRequestSchema, + outputSchema: GetTransactionByHashReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + getTransactionReceipt( + runtime: Runtime, + input: GetTransactionReceiptRequest | GetTransactionReceiptRequestJson, + ): { result: () => GetTransactionReceiptReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: GetTransactionReceiptRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as GetTransactionReceiptRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson( + GetTransactionReceiptRequestSchema, + input as GetTransactionReceiptRequestJson, + ) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability< + GetTransactionReceiptRequest, + GetTransactionReceiptReply + >({ + capabilityId, + method: 'GetTransactionReceipt', + payload, + inputSchema: GetTransactionReceiptRequestSchema, + outputSchema: GetTransactionReceiptReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + headerByNumber( + runtime: Runtime, + input: HeaderByNumberRequest | HeaderByNumberRequestJson, + ): { result: () => HeaderByNumberReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: HeaderByNumberRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as HeaderByNumberRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(HeaderByNumberRequestSchema, input as HeaderByNumberRequestJson) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'HeaderByNumber', + payload, + inputSchema: HeaderByNumberRequestSchema, + outputSchema: HeaderByNumberReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + logTrigger(config: FilterLogTriggerRequestJson): ClientLogTrigger { + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + return new ClientLogTrigger(config, capabilityId, 'LogTrigger', this.ChainSelector) + } + + writeReport( + runtime: Runtime, + input: WriteCreReportRequest | WriteCreReportRequestJson, + ): { result: () => WriteReportReply } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: WriteReportRequest + + // Check if it's a wrapped type by looking for the $report property + if ((input as unknown as { $report?: boolean }).$report) { + // It's a wrapped type, unwrap it + payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(input as WriteCreReportRequest) + } else { + // It's wrapped JSON, convert using create function + payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest( + createWriteCreReportRequest(input as WriteCreReportRequestJson), + ) + } + + // Include all labels in capability ID for routing when specified + const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}` + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'WriteReport', + payload, + inputSchema: WriteReportRequestSchema, + outputSchema: WriteReportReplySchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } } /** * Trigger implementation for LogTrigger */ class ClientLogTrigger implements Trigger { - public readonly config: FilterLogTriggerRequest - constructor( - config: FilterLogTriggerRequest | FilterLogTriggerRequestJson, - private readonly _capabilityId: string, - private readonly _method: string, - private readonly ChainSelector: bigint, - ) { - // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages - this.config = (config as any).$typeName ? config as FilterLogTriggerRequest : fromJson(FilterLogTriggerRequestSchema, config as FilterLogTriggerRequestJson) - } - - capabilityId(): string { - return this._capabilityId; - } - - method(): string { - return this._method; - } - - outputSchema() { - return LogSchema; - } - - configAsAny(): Any { - return anyPack(FilterLogTriggerRequestSchema, this.config); - } - - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Log): Log { - return rawOutput; - } -} \ No newline at end of file + public readonly config: FilterLogTriggerRequest + constructor( + config: FilterLogTriggerRequest | FilterLogTriggerRequestJson, + private readonly _capabilityId: string, + private readonly _method: string, + private readonly ChainSelector: bigint, + ) { + // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages + this.config = (config as any).$typeName + ? (config as FilterLogTriggerRequest) + : fromJson(FilterLogTriggerRequestSchema, config as FilterLogTriggerRequestJson) + } + + capabilityId(): string { + return this._capabilityId + } + + method(): string { + return this._method + } + + outputSchema() { + return LogSchema + } + + configAsAny(): Any { + return anyPack(FilterLogTriggerRequestSchema, this.config) + } + + /** + * Transform the raw trigger output - override this method if needed + * Default implementation returns the raw output unchanged + */ + adapt(rawOutput: Log): Log { + return rawOutput + } +} diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/internal/actionandtrigger/v1/basic_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/internal/actionandtrigger/v1/basic_sdk_gen.ts index 81cada1..630b827 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/internal/actionandtrigger/v1/basic_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/internal/actionandtrigger/v1/basic_sdk_gen.ts @@ -1,115 +1,110 @@ -import type { Trigger } from "@cre/sdk/utils/triggers/trigger-interface" -import { type Any, AnySchema, anyPack } from "@bufbuild/protobuf/wkt" -import type { Runtime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import { hexToBytes } from "@cre/sdk/utils/hex-utils"; -import { fromJson, create } from "@bufbuild/protobuf" +import { create, fromJson } from '@bufbuild/protobuf' +import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' import { - ConfigSchema, - InputSchema, - OutputSchema, - TriggerEventSchema, - type Config, - type ConfigJson, - type Input, - type InputJson, - type Output, - type TriggerEvent, -} from "@cre/generated/capabilities/internal/actionandtrigger/v1/action_and_trigger_pb" - - + type Config, + type ConfigJson, + ConfigSchema, + type Input, + type InputJson, + InputSchema, + type Output, + OutputSchema, + type TriggerEvent, + TriggerEventSchema, +} from '@cre/generated/capabilities/internal/actionandtrigger/v1/action_and_trigger_pb' +import type { Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import { hexToBytes } from '@cre/sdk/utils/hex-utils' +import type { Trigger } from '@cre/sdk/utils/triggers/trigger-interface' /** * Basic Capability - * + * * Capability ID: basic-test-action-trigger@1.0.0 * Capability Name: basic-test-action-trigger * Capability Version: 1.0.0 */ export class BasicCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "basic-test-action-trigger@1.0.0"; - - static readonly CAPABILITY_NAME = "basic-test-action-trigger"; - static readonly CAPABILITY_VERSION = "1.0.0"; - - - - action(runtime: Runtime, input: Input | InputJson): {result: () => Output} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: Input - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as Input - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(InputSchema, input as InputJson) - } - - - const capabilityId = BasicCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "Action", - payload, - inputSchema: InputSchema, - outputSchema: OutputSchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - - trigger(config: ConfigJson): BasicTrigger { - - const capabilityId = BasicCapability.CAPABILITY_ID; - return new BasicTrigger(config, capabilityId, "Trigger"); - } + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'basic-test-action-trigger@1.0.0' + + static readonly CAPABILITY_NAME = 'basic-test-action-trigger' + static readonly CAPABILITY_VERSION = '1.0.0' + + action(runtime: Runtime, input: Input | InputJson): { result: () => Output } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: Input + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as Input + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(InputSchema, input as InputJson) + } + + const capabilityId = BasicCapability.CAPABILITY_ID + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'Action', + payload, + inputSchema: InputSchema, + outputSchema: OutputSchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } + + trigger(config: ConfigJson): BasicTrigger { + const capabilityId = BasicCapability.CAPABILITY_ID + return new BasicTrigger(config, capabilityId, 'Trigger') + } } /** * Trigger implementation for Trigger */ class BasicTrigger implements Trigger { - public readonly config: Config - constructor( - config: Config | ConfigJson, - private readonly _capabilityId: string, - private readonly _method: string, - - ) { - // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages - this.config = (config as any).$typeName ? config as Config : fromJson(ConfigSchema, config as ConfigJson) - } - - capabilityId(): string { - return this._capabilityId; - } - - method(): string { - return this._method; - } - - outputSchema() { - return TriggerEventSchema; - } - - configAsAny(): Any { - return anyPack(ConfigSchema, this.config); - } - - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: TriggerEvent): TriggerEvent { - return rawOutput; - } -} \ No newline at end of file + public readonly config: Config + constructor( + config: Config | ConfigJson, + private readonly _capabilityId: string, + private readonly _method: string, + ) { + // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages + this.config = (config as any).$typeName + ? (config as Config) + : fromJson(ConfigSchema, config as ConfigJson) + } + + capabilityId(): string { + return this._capabilityId + } + + method(): string { + return this._method + } + + outputSchema() { + return TriggerEventSchema + } + + configAsAny(): Any { + return anyPack(ConfigSchema, this.config) + } + + /** + * Transform the raw trigger output - override this method if needed + * Default implementation returns the raw output unchanged + */ + adapt(rawOutput: TriggerEvent): TriggerEvent { + return rawOutput + } +} diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/internal/basicaction/v1/basicaction_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/internal/basicaction/v1/basicaction_sdk_gen.ts index b12c854..81e07d8 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/internal/basicaction/v1/basicaction_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/internal/basicaction/v1/basicaction_sdk_gen.ts @@ -1,62 +1,57 @@ -import type { Runtime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import { hexToBytes } from "@cre/sdk/utils/hex-utils"; -import { fromJson } from "@bufbuild/protobuf" +import { fromJson } from '@bufbuild/protobuf' import { - InputsSchema, - OutputsSchema, - type Inputs, - type InputsJson, - type Outputs, -} from "@cre/generated/capabilities/internal/basicaction/v1/basic_action_pb" - - + type Inputs, + type InputsJson, + InputsSchema, + type Outputs, + OutputsSchema, +} from '@cre/generated/capabilities/internal/basicaction/v1/basic_action_pb' +import type { Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import { hexToBytes } from '@cre/sdk/utils/hex-utils' /** * BasicAction Capability - * + * * Capability ID: basic-test-action@1.0.0 * Capability Name: basic-test-action * Capability Version: 1.0.0 */ export class BasicActionCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "basic-test-action@1.0.0"; - - static readonly CAPABILITY_NAME = "basic-test-action"; - static readonly CAPABILITY_VERSION = "1.0.0"; - - - - performAction(runtime: Runtime, input: Inputs | InputsJson): {result: () => Outputs} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: Inputs - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as Inputs - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(InputsSchema, input as InputsJson) - } - - - const capabilityId = BasicActionCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "PerformAction", - payload, - inputSchema: InputsSchema, - outputSchema: OutputsSchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'basic-test-action@1.0.0' + + static readonly CAPABILITY_NAME = 'basic-test-action' + static readonly CAPABILITY_VERSION = '1.0.0' + + performAction(runtime: Runtime, input: Inputs | InputsJson): { result: () => Outputs } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: Inputs + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as Inputs + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(InputsSchema, input as InputsJson) + } + + const capabilityId = BasicActionCapability.CAPABILITY_ID + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'PerformAction', + payload, + inputSchema: InputsSchema, + outputSchema: OutputsSchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } } diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/internal/basictrigger/v1/basic_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/internal/basictrigger/v1/basic_sdk_gen.ts index 3e5429a..47790d0 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/internal/basictrigger/v1/basic_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/internal/basictrigger/v1/basic_sdk_gen.ts @@ -1,75 +1,71 @@ -import type { Trigger } from "@cre/sdk/utils/triggers/trigger-interface" -import { type Any, AnySchema, anyPack } from "@bufbuild/protobuf/wkt" -import { fromJson, create } from "@bufbuild/protobuf" +import { create, fromJson } from '@bufbuild/protobuf' +import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' import { - ConfigSchema, - OutputsSchema, - type Config, - type ConfigJson, - type Outputs, -} from "@cre/generated/capabilities/internal/basictrigger/v1/basic_trigger_pb" - - + type Config, + type ConfigJson, + ConfigSchema, + type Outputs, + OutputsSchema, +} from '@cre/generated/capabilities/internal/basictrigger/v1/basic_trigger_pb' +import type { Trigger } from '@cre/sdk/utils/triggers/trigger-interface' /** * Basic Capability - * + * * Capability ID: basic-test-trigger@1.0.0 * Capability Name: basic-test-trigger * Capability Version: 1.0.0 */ export class BasicCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "basic-test-trigger@1.0.0"; - - static readonly CAPABILITY_NAME = "basic-test-trigger"; - static readonly CAPABILITY_VERSION = "1.0.0"; + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'basic-test-trigger@1.0.0' + static readonly CAPABILITY_NAME = 'basic-test-trigger' + static readonly CAPABILITY_VERSION = '1.0.0' - - trigger(config: ConfigJson): BasicTrigger { - - const capabilityId = BasicCapability.CAPABILITY_ID; - return new BasicTrigger(config, capabilityId, "Trigger"); - } + trigger(config: ConfigJson): BasicTrigger { + const capabilityId = BasicCapability.CAPABILITY_ID + return new BasicTrigger(config, capabilityId, 'Trigger') + } } /** * Trigger implementation for Trigger */ class BasicTrigger implements Trigger { - public readonly config: Config - constructor( - config: Config | ConfigJson, - private readonly _capabilityId: string, - private readonly _method: string, - - ) { - // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages - this.config = (config as any).$typeName ? config as Config : fromJson(ConfigSchema, config as ConfigJson) - } + public readonly config: Config + constructor( + config: Config | ConfigJson, + private readonly _capabilityId: string, + private readonly _method: string, + ) { + // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages + this.config = (config as any).$typeName + ? (config as Config) + : fromJson(ConfigSchema, config as ConfigJson) + } - capabilityId(): string { - return this._capabilityId; - } + capabilityId(): string { + return this._capabilityId + } - method(): string { - return this._method; - } + method(): string { + return this._method + } - outputSchema() { - return OutputsSchema; - } + outputSchema() { + return OutputsSchema + } - configAsAny(): Any { - return anyPack(ConfigSchema, this.config); - } + configAsAny(): Any { + return anyPack(ConfigSchema, this.config) + } - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Outputs): Outputs { - return rawOutput; - } -} \ No newline at end of file + /** + * Transform the raw trigger output - override this method if needed + * Default implementation returns the raw output unchanged + */ + adapt(rawOutput: Outputs): Outputs { + return rawOutput + } +} diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/internal/consensus/v1alpha/consensus_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/internal/consensus/v1alpha/consensus_sdk_gen.ts index 096ae2c..2077be1 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/internal/consensus/v1alpha/consensus_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/internal/consensus/v1alpha/consensus_sdk_gen.ts @@ -1,101 +1,98 @@ -import type { Runtime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import { hexToBytes } from "@cre/sdk/utils/hex-utils"; -import { fromJson } from "@bufbuild/protobuf" +import { fromJson } from '@bufbuild/protobuf' import { - ReportRequestSchema, - ReportResponseSchema, - SimpleConsensusInputsSchema, - type ReportRequest, - type ReportRequestJson, - type ReportResponse, - type SimpleConsensusInputs, - type SimpleConsensusInputsJson, -} from "@cre/generated/sdk/v1alpha/sdk_pb" -import { - ValueSchema, - type Value, -} from "@cre/generated/values/v1/values_pb" - - + type ReportRequest, + type ReportRequestJson, + ReportRequestSchema, + type ReportResponse, + ReportResponseSchema, + type SimpleConsensusInputs, + type SimpleConsensusInputsJson, + SimpleConsensusInputsSchema, +} from '@cre/generated/sdk/v1alpha/sdk_pb' +import { type Value, ValueSchema } from '@cre/generated/values/v1/values_pb' +import type { Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import { hexToBytes } from '@cre/sdk/utils/hex-utils' /** * Consensus Capability - * + * * Capability ID: consensus@1.0.0-alpha * Capability Name: consensus * Capability Version: 1.0.0-alpha */ export class ConsensusCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "consensus@1.0.0-alpha"; + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'consensus@1.0.0-alpha' + + static readonly CAPABILITY_NAME = 'consensus' + static readonly CAPABILITY_VERSION = '1.0.0-alpha' + + simple( + runtime: Runtime, + input: SimpleConsensusInputs | SimpleConsensusInputsJson, + ): { result: () => Value } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: SimpleConsensusInputs + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as SimpleConsensusInputs + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(SimpleConsensusInputsSchema, input as SimpleConsensusInputsJson) + } + + const capabilityId = ConsensusCapability.CAPABILITY_ID + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'Simple', + payload, + inputSchema: SimpleConsensusInputsSchema, + outputSchema: ValueSchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() - static readonly CAPABILITY_NAME = "consensus"; - static readonly CAPABILITY_VERSION = "1.0.0-alpha"; + return result + }, + } + } + report( + runtime: Runtime, + input: ReportRequest | ReportRequestJson, + ): { result: () => Report } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: ReportRequest + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as ReportRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(ReportRequestSchema, input as ReportRequestJson) + } - simple(runtime: Runtime, input: SimpleConsensusInputs | SimpleConsensusInputsJson): {result: () => Value} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: SimpleConsensusInputs - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as SimpleConsensusInputs - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(SimpleConsensusInputsSchema, input as SimpleConsensusInputsJson) - } - - - const capabilityId = ConsensusCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "Simple", - payload, - inputSchema: SimpleConsensusInputsSchema, - outputSchema: ValueSchema - }) + const capabilityId = ConsensusCapability.CAPABILITY_ID - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'Report', + payload, + inputSchema: ReportRequestSchema, + outputSchema: ReportResponseSchema, + }) - report(runtime: Runtime, input: ReportRequest | ReportRequestJson): {result: () => Report} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: ReportRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as ReportRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(ReportRequestSchema, input as ReportRequestJson) - } - - - const capabilityId = ConsensusCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "Report", - payload, - inputSchema: ReportRequestSchema, - outputSchema: ReportResponseSchema - }) + return { + result: () => { + const result = capabilityResponse.result() - return { - result: () => { - const result = capabilityResponse.result() - - return new Report(result) - } - } - } + return new Report(result) + }, + } + } } diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/internal/nodeaction/v1/basicaction_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/internal/nodeaction/v1/basicaction_sdk_gen.ts index dc794a4..3046dfc 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/internal/nodeaction/v1/basicaction_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/internal/nodeaction/v1/basicaction_sdk_gen.ts @@ -1,101 +1,107 @@ -import type { Runtime, NodeRuntime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import type { ConsensusAggregation, PrimitiveTypes, UnwrapOptions } from "@cre/sdk/utils" -import { fromJson } from "@bufbuild/protobuf" +import { fromJson } from '@bufbuild/protobuf' import { - NodeInputsSchema, - NodeOutputsSchema, - type NodeInputs, - type NodeInputsJson, - type NodeOutputs, -} from "@cre/generated/capabilities/internal/nodeaction/v1/node_action_pb" + type NodeInputs, + type NodeInputsJson, + NodeInputsSchema, + type NodeOutputs, + NodeOutputsSchema, +} from '@cre/generated/capabilities/internal/nodeaction/v1/node_action_pb' +import type { NodeRuntime, Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import type { ConsensusAggregation, PrimitiveTypes, UnwrapOptions } from '@cre/sdk/utils' export class PerformActioner { - constructor(private readonly runtime: NodeRuntime, private readonly client: BasicActionCapability) {} - performAction(input: NodeInputs | NodeInputsJson): {result: () => NodeOutputs} { + constructor( + private readonly runtime: NodeRuntime, + private readonly client: BasicActionCapability, + ) {} + performAction(input: NodeInputs | NodeInputsJson): { result: () => NodeOutputs } { return this.client.performAction(this.runtime, input) } } - /** * BasicAction Capability - * + * * Capability ID: basic-test-node-action@1.0.0 * Capability Name: basic-test-node-action * Capability Version: 1.0.0 */ export class BasicActionCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "basic-test-node-action@1.0.0"; + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'basic-test-node-action@1.0.0' + + static readonly CAPABILITY_NAME = 'basic-test-node-action' + static readonly CAPABILITY_VERSION = '1.0.0' + + performAction( + runtime: NodeRuntime, + input: NodeInputs | NodeInputsJson, + ): { result: () => NodeOutputs } + performAction( + runtime: Runtime, + fn: (performActioner: PerformActioner, ...args: TArgs) => TOutput, + consensusAggregation: ConsensusAggregation, + unwrapOptions?: TOutput extends PrimitiveTypes ? never : UnwrapOptions, + ): (...args: TArgs) => { result: () => TOutput } + performAction(...args: unknown[]): unknown { + // Check if this is the sugar syntax overload (has function parameter) + if (typeof args[1] === 'function') { + const [runtime, fn, consensusAggregation, unwrapOptions] = args as [ + Runtime, + (performActioner: PerformActioner, ...args: unknown[]) => unknown, + ConsensusAggregation, + UnwrapOptions | undefined, + ] + return this.performActionSugarHelper(runtime, fn, consensusAggregation, unwrapOptions) + } + // Otherwise, this is the basic call overload + const [runtime, input] = args as [NodeRuntime, NodeInputs | NodeInputsJson] + return this.performActionCallHelper(runtime, input) + } + private performActionCallHelper( + runtime: NodeRuntime, + input: NodeInputs | NodeInputsJson, + ): { result: () => NodeOutputs } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: NodeInputs - static readonly CAPABILITY_NAME = "basic-test-node-action"; - static readonly CAPABILITY_VERSION = "1.0.0"; + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as NodeInputs + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(NodeInputsSchema, input as NodeInputsJson) + } + const capabilityId = BasicActionCapability.CAPABILITY_ID + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'PerformAction', + payload, + inputSchema: NodeInputsSchema, + outputSchema: NodeOutputsSchema, + }) - performAction(runtime: NodeRuntime, input: NodeInputs | NodeInputsJson): {result: () => NodeOutputs} - performAction( - runtime: Runtime, - fn: (performActioner: PerformActioner, ...args: TArgs) => TOutput, - consensusAggregation: ConsensusAggregation, - unwrapOptions?: TOutput extends PrimitiveTypes - ? never - : UnwrapOptions, - ): (...args: TArgs) => { result: () => TOutput } - performAction(...args: unknown[]): unknown { - // Check if this is the sugar syntax overload (has function parameter) - if (typeof args[1] === 'function') { - const [runtime, fn, consensusAggregation, unwrapOptions] = args as [Runtime, (performActioner: PerformActioner, ...args: unknown[]) => unknown, ConsensusAggregation, UnwrapOptions | undefined] - return this.performActionSugarHelper(runtime, fn, consensusAggregation, unwrapOptions) - } - // Otherwise, this is the basic call overload - const [runtime, input] = args as [NodeRuntime, NodeInputs | NodeInputsJson] - return this.performActionCallHelper(runtime, input) - } - private performActionCallHelper(runtime: NodeRuntime, input: NodeInputs | NodeInputsJson): {result: () => NodeOutputs} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: NodeInputs - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as NodeInputs - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(NodeInputsSchema, input as NodeInputsJson) - } - - - const capabilityId = BasicActionCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "PerformAction", - payload, - inputSchema: NodeInputsSchema, - outputSchema: NodeOutputsSchema - }) + return { + result: () => { + const result = capabilityResponse.result() - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - private performActionSugarHelper( - runtime: Runtime, - fn: (performActioner: PerformActioner, ...args: TArgs) => TOutput, - consensusAggregation: ConsensusAggregation, - unwrapOptions?: TOutput extends PrimitiveTypes - ? never - : UnwrapOptions, - ): (...args: TArgs) => { result: () => TOutput } { - const wrappedFn = (runtime: NodeRuntime, ...args: TArgs) => { - const performActioner = new PerformActioner(runtime, this) - return fn(performActioner, ...args) - } - return runtime.runInNodeMode(wrappedFn, consensusAggregation, unwrapOptions) - } + return result + }, + } + } + private performActionSugarHelper( + runtime: Runtime, + fn: (performActioner: PerformActioner, ...args: TArgs) => TOutput, + consensusAggregation: ConsensusAggregation, + unwrapOptions?: TOutput extends PrimitiveTypes ? never : UnwrapOptions, + ): (...args: TArgs) => { result: () => TOutput } { + const wrappedFn = (runtime: NodeRuntime, ...args: TArgs) => { + const performActioner = new PerformActioner(runtime, this) + return fn(performActioner, ...args) + } + return runtime.runInNodeMode(wrappedFn, consensusAggregation, unwrapOptions) + } } diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.ts index 679f856..110fc54 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.ts @@ -1,62 +1,60 @@ -import type { Runtime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import { hexToBytes } from "@cre/sdk/utils/hex-utils"; -import { fromJson } from "@bufbuild/protobuf" +import { fromJson } from '@bufbuild/protobuf' import { - ConfidentialHTTPRequestSchema, - HTTPResponseSchema, - type ConfidentialHTTPRequest, - type ConfidentialHTTPRequestJson, - type HTTPResponse, -} from "@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb" - - + type ConfidentialHTTPRequest, + type ConfidentialHTTPRequestJson, + ConfidentialHTTPRequestSchema, + type HTTPResponse, + HTTPResponseSchema, +} from '@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb' +import type { Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import { hexToBytes } from '@cre/sdk/utils/hex-utils' /** * Client Capability - * + * * Capability ID: confidential-http@1.0.0-alpha * Capability Name: confidential-http * Capability Version: 1.0.0-alpha */ export class ClientCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "confidential-http@1.0.0-alpha"; - - static readonly CAPABILITY_NAME = "confidential-http"; - static readonly CAPABILITY_VERSION = "1.0.0-alpha"; - - - - sendRequest(runtime: Runtime, input: ConfidentialHTTPRequest | ConfidentialHTTPRequestJson): {result: () => HTTPResponse} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: ConfidentialHTTPRequest - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as ConfidentialHTTPRequest - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(ConfidentialHTTPRequestSchema, input as ConfidentialHTTPRequestJson) - } - - - const capabilityId = ClientCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "SendRequest", - payload, - inputSchema: ConfidentialHTTPRequestSchema, - outputSchema: HTTPResponseSchema - }) - - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'confidential-http@1.0.0-alpha' + + static readonly CAPABILITY_NAME = 'confidential-http' + static readonly CAPABILITY_VERSION = '1.0.0-alpha' + + sendRequest( + runtime: Runtime, + input: ConfidentialHTTPRequest | ConfidentialHTTPRequestJson, + ): { result: () => HTTPResponse } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: ConfidentialHTTPRequest + + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as ConfidentialHTTPRequest + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(ConfidentialHTTPRequestSchema, input as ConfidentialHTTPRequestJson) + } + + const capabilityId = ClientCapability.CAPABILITY_ID + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'SendRequest', + payload, + inputSchema: ConfidentialHTTPRequestSchema, + outputSchema: HTTPResponseSchema, + }) + + return { + result: () => { + const result = capabilityResponse.result() + + return result + }, + } + } } diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.ts index c4ecfc6..69beaf7 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.ts @@ -1,101 +1,107 @@ -import type { Runtime, NodeRuntime } from "@cre/sdk" -import { Report } from "@cre/sdk/report" -import type { ConsensusAggregation, PrimitiveTypes, UnwrapOptions } from "@cre/sdk/utils" -import { fromJson } from "@bufbuild/protobuf" +import { fromJson } from '@bufbuild/protobuf' import { - RequestSchema, - ResponseSchema, - type Request, - type RequestJson, - type Response, -} from "@cre/generated/capabilities/networking/http/v1alpha/client_pb" + type Request, + type RequestJson, + RequestSchema, + type Response, + ResponseSchema, +} from '@cre/generated/capabilities/networking/http/v1alpha/client_pb' +import type { NodeRuntime, Runtime } from '@cre/sdk' +import { Report } from '@cre/sdk/report' +import type { ConsensusAggregation, PrimitiveTypes, UnwrapOptions } from '@cre/sdk/utils' export class SendRequester { - constructor(private readonly runtime: NodeRuntime, private readonly client: ClientCapability) {} - sendRequest(input: Request | RequestJson): {result: () => Response} { + constructor( + private readonly runtime: NodeRuntime, + private readonly client: ClientCapability, + ) {} + sendRequest(input: Request | RequestJson): { result: () => Response } { return this.client.sendRequest(this.runtime, input) } } - /** * Client Capability - * + * * Capability ID: http-actions@1.0.0-alpha * Capability Name: http-actions * Capability Version: 1.0.0-alpha */ export class ClientCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "http-actions@1.0.0-alpha"; + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'http-actions@1.0.0-alpha' + + static readonly CAPABILITY_NAME = 'http-actions' + static readonly CAPABILITY_VERSION = '1.0.0-alpha' + + sendRequest( + runtime: NodeRuntime, + input: Request | RequestJson, + ): { result: () => Response } + sendRequest( + runtime: Runtime, + fn: (sendRequester: SendRequester, ...args: TArgs) => TOutput, + consensusAggregation: ConsensusAggregation, + unwrapOptions?: TOutput extends PrimitiveTypes ? never : UnwrapOptions, + ): (...args: TArgs) => { result: () => TOutput } + sendRequest(...args: unknown[]): unknown { + // Check if this is the sugar syntax overload (has function parameter) + if (typeof args[1] === 'function') { + const [runtime, fn, consensusAggregation, unwrapOptions] = args as [ + Runtime, + (sendRequester: SendRequester, ...args: unknown[]) => unknown, + ConsensusAggregation, + UnwrapOptions | undefined, + ] + return this.sendRequestSugarHelper(runtime, fn, consensusAggregation, unwrapOptions) + } + // Otherwise, this is the basic call overload + const [runtime, input] = args as [NodeRuntime, Request | RequestJson] + return this.sendRequestCallHelper(runtime, input) + } + private sendRequestCallHelper( + runtime: NodeRuntime, + input: Request | RequestJson, + ): { result: () => Response } { + // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed + let payload: Request - static readonly CAPABILITY_NAME = "http-actions"; - static readonly CAPABILITY_VERSION = "1.0.0-alpha"; + if ((input as unknown as { $typeName?: string }).$typeName) { + // It's the original protobuf type + payload = input as Request + } else { + // It's regular JSON, convert using fromJson + payload = fromJson(RequestSchema, input as RequestJson) + } + const capabilityId = ClientCapability.CAPABILITY_ID + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: 'SendRequest', + payload, + inputSchema: RequestSchema, + outputSchema: ResponseSchema, + }) - sendRequest(runtime: NodeRuntime, input: Request | RequestJson): {result: () => Response} - sendRequest( - runtime: Runtime, - fn: (sendRequester: SendRequester, ...args: TArgs) => TOutput, - consensusAggregation: ConsensusAggregation, - unwrapOptions?: TOutput extends PrimitiveTypes - ? never - : UnwrapOptions, - ): (...args: TArgs) => { result: () => TOutput } - sendRequest(...args: unknown[]): unknown { - // Check if this is the sugar syntax overload (has function parameter) - if (typeof args[1] === 'function') { - const [runtime, fn, consensusAggregation, unwrapOptions] = args as [Runtime, (sendRequester: SendRequester, ...args: unknown[]) => unknown, ConsensusAggregation, UnwrapOptions | undefined] - return this.sendRequestSugarHelper(runtime, fn, consensusAggregation, unwrapOptions) - } - // Otherwise, this is the basic call overload - const [runtime, input] = args as [NodeRuntime, Request | RequestJson] - return this.sendRequestCallHelper(runtime, input) - } - private sendRequestCallHelper(runtime: NodeRuntime, input: Request | RequestJson): {result: () => Response} { - // Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed - let payload: Request - - if ((input as unknown as { $typeName?: string }).$typeName) { - // It's the original protobuf type - payload = input as Request - } else { - // It's regular JSON, convert using fromJson - payload = fromJson(RequestSchema, input as RequestJson) - } - - - const capabilityId = ClientCapability.CAPABILITY_ID; - - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: "SendRequest", - payload, - inputSchema: RequestSchema, - outputSchema: ResponseSchema - }) + return { + result: () => { + const result = capabilityResponse.result() - return { - result: () => { - const result = capabilityResponse.result() - - return result - } - } - } - private sendRequestSugarHelper( - runtime: Runtime, - fn: (sendRequester: SendRequester, ...args: TArgs) => TOutput, - consensusAggregation: ConsensusAggregation, - unwrapOptions?: TOutput extends PrimitiveTypes - ? never - : UnwrapOptions, - ): (...args: TArgs) => { result: () => TOutput } { - const wrappedFn = (runtime: NodeRuntime, ...args: TArgs) => { - const sendRequester = new SendRequester(runtime, this) - return fn(sendRequester, ...args) - } - return runtime.runInNodeMode(wrappedFn, consensusAggregation, unwrapOptions) - } + return result + }, + } + } + private sendRequestSugarHelper( + runtime: Runtime, + fn: (sendRequester: SendRequester, ...args: TArgs) => TOutput, + consensusAggregation: ConsensusAggregation, + unwrapOptions?: TOutput extends PrimitiveTypes ? never : UnwrapOptions, + ): (...args: TArgs) => { result: () => TOutput } { + const wrappedFn = (runtime: NodeRuntime, ...args: TArgs) => { + const sendRequester = new SendRequester(runtime, this) + return fn(sendRequester, ...args) + } + return runtime.runInNodeMode(wrappedFn, consensusAggregation, unwrapOptions) + } } diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/http_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/http_sdk_gen.ts index 1d9d403..3754793 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/http_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/http_sdk_gen.ts @@ -1,75 +1,71 @@ -import type { Trigger } from "@cre/sdk/utils/triggers/trigger-interface" -import { type Any, AnySchema, anyPack } from "@bufbuild/protobuf/wkt" -import { fromJson, create } from "@bufbuild/protobuf" +import { create, fromJson } from '@bufbuild/protobuf' +import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' import { - ConfigSchema, - PayloadSchema, - type Config, - type ConfigJson, - type Payload, -} from "@cre/generated/capabilities/networking/http/v1alpha/trigger_pb" - - + type Config, + type ConfigJson, + ConfigSchema, + type Payload, + PayloadSchema, +} from '@cre/generated/capabilities/networking/http/v1alpha/trigger_pb' +import type { Trigger } from '@cre/sdk/utils/triggers/trigger-interface' /** * HTTP Capability - * + * * Capability ID: http-trigger@1.0.0-alpha * Capability Name: http-trigger * Capability Version: 1.0.0-alpha */ export class HTTPCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "http-trigger@1.0.0-alpha"; - - static readonly CAPABILITY_NAME = "http-trigger"; - static readonly CAPABILITY_VERSION = "1.0.0-alpha"; + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'http-trigger@1.0.0-alpha' + static readonly CAPABILITY_NAME = 'http-trigger' + static readonly CAPABILITY_VERSION = '1.0.0-alpha' - - trigger(config: ConfigJson): HTTPTrigger { - - const capabilityId = HTTPCapability.CAPABILITY_ID; - return new HTTPTrigger(config, capabilityId, "Trigger"); - } + trigger(config: ConfigJson): HTTPTrigger { + const capabilityId = HTTPCapability.CAPABILITY_ID + return new HTTPTrigger(config, capabilityId, 'Trigger') + } } /** * Trigger implementation for Trigger */ class HTTPTrigger implements Trigger { - public readonly config: Config - constructor( - config: Config | ConfigJson, - private readonly _capabilityId: string, - private readonly _method: string, - - ) { - // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages - this.config = (config as any).$typeName ? config as Config : fromJson(ConfigSchema, config as ConfigJson) - } + public readonly config: Config + constructor( + config: Config | ConfigJson, + private readonly _capabilityId: string, + private readonly _method: string, + ) { + // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages + this.config = (config as any).$typeName + ? (config as Config) + : fromJson(ConfigSchema, config as ConfigJson) + } - capabilityId(): string { - return this._capabilityId; - } + capabilityId(): string { + return this._capabilityId + } - method(): string { - return this._method; - } + method(): string { + return this._method + } - outputSchema() { - return PayloadSchema; - } + outputSchema() { + return PayloadSchema + } - configAsAny(): Any { - return anyPack(ConfigSchema, this.config); - } + configAsAny(): Any { + return anyPack(ConfigSchema, this.config) + } - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Payload): Payload { - return rawOutput; - } -} \ No newline at end of file + /** + * Transform the raw trigger output - override this method if needed + * Default implementation returns the raw output unchanged + */ + adapt(rawOutput: Payload): Payload { + return rawOutput + } +} diff --git a/packages/cre-sdk/src/generated-sdk/capabilities/scheduler/cron/v1/cron_sdk_gen.ts b/packages/cre-sdk/src/generated-sdk/capabilities/scheduler/cron/v1/cron_sdk_gen.ts index 23ff2a3..9d15821 100644 --- a/packages/cre-sdk/src/generated-sdk/capabilities/scheduler/cron/v1/cron_sdk_gen.ts +++ b/packages/cre-sdk/src/generated-sdk/capabilities/scheduler/cron/v1/cron_sdk_gen.ts @@ -1,77 +1,73 @@ -import type { Trigger } from "@cre/sdk/utils/triggers/trigger-interface" -import { type Any, AnySchema, anyPack } from "@bufbuild/protobuf/wkt" -import { fromJson, create } from "@bufbuild/protobuf" +import { create, fromJson } from '@bufbuild/protobuf' +import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' import { - ConfigSchema, - LegacyPayloadSchema, - PayloadSchema, - type Config, - type ConfigJson, - type LegacyPayload, - type Payload, -} from "@cre/generated/capabilities/scheduler/cron/v1/trigger_pb" - - + type Config, + type ConfigJson, + ConfigSchema, + type LegacyPayload, + LegacyPayloadSchema, + type Payload, + PayloadSchema, +} from '@cre/generated/capabilities/scheduler/cron/v1/trigger_pb' +import type { Trigger } from '@cre/sdk/utils/triggers/trigger-interface' /** * Cron Capability - * + * * Capability ID: cron-trigger@1.0.0 * Capability Name: cron-trigger * Capability Version: 1.0.0 */ export class CronCapability { - /** The capability ID for this service */ - static readonly CAPABILITY_ID = "cron-trigger@1.0.0"; - - static readonly CAPABILITY_NAME = "cron-trigger"; - static readonly CAPABILITY_VERSION = "1.0.0"; + /** The capability ID for this service */ + static readonly CAPABILITY_ID = 'cron-trigger@1.0.0' + static readonly CAPABILITY_NAME = 'cron-trigger' + static readonly CAPABILITY_VERSION = '1.0.0' - - trigger(config: ConfigJson): CronTrigger { - - const capabilityId = CronCapability.CAPABILITY_ID; - return new CronTrigger(config, capabilityId, "Trigger"); - } + trigger(config: ConfigJson): CronTrigger { + const capabilityId = CronCapability.CAPABILITY_ID + return new CronTrigger(config, capabilityId, 'Trigger') + } } /** * Trigger implementation for Trigger */ class CronTrigger implements Trigger { - public readonly config: Config - constructor( - config: Config | ConfigJson, - private readonly _capabilityId: string, - private readonly _method: string, - - ) { - // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages - this.config = (config as any).$typeName ? config as Config : fromJson(ConfigSchema, config as ConfigJson) - } + public readonly config: Config + constructor( + config: Config | ConfigJson, + private readonly _capabilityId: string, + private readonly _method: string, + ) { + // biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages + this.config = (config as any).$typeName + ? (config as Config) + : fromJson(ConfigSchema, config as ConfigJson) + } - capabilityId(): string { - return this._capabilityId; - } + capabilityId(): string { + return this._capabilityId + } - method(): string { - return this._method; - } + method(): string { + return this._method + } - outputSchema() { - return PayloadSchema; - } + outputSchema() { + return PayloadSchema + } - configAsAny(): Any { - return anyPack(ConfigSchema, this.config); - } + configAsAny(): Any { + return anyPack(ConfigSchema, this.config) + } - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Payload): Payload { - return rawOutput; - } -} \ No newline at end of file + /** + * Transform the raw trigger output - override this method if needed + * Default implementation returns the raw output unchanged + */ + adapt(rawOutput: Payload): Payload { + return rawOutput + } +} diff --git a/packages/cre-sdk/src/generated/capabilities/blockchain/evm/v1alpha/client_pb.ts b/packages/cre-sdk/src/generated/capabilities/blockchain/evm/v1alpha/client_pb.ts index bee6222..366e7d9 100644 --- a/packages/cre-sdk/src/generated/capabilities/blockchain/evm/v1alpha/client_pb.ts +++ b/packages/cre-sdk/src/generated/capabilities/blockchain/evm/v1alpha/client_pb.ts @@ -17,7 +17,7 @@ import { file_values_v1_values } from '../../../../values/v1/values_pb' export const file_capabilities_blockchain_evm_v1alpha_client: GenFile = /*@__PURE__*/ fileDesc( - 'CjBjYXBhYmlsaXRpZXMvYmxvY2tjaGFpbi9ldm0vdjFhbHBoYS9jbGllbnQucHJvdG8SI2NhcGFiaWxpdGllcy5ibG9ja2NoYWluLmV2bS52MWFscGhhIh0KC1RvcGljVmFsdWVzEg4KBnZhbHVlcxgBIAMoDCK4AQoXRmlsdGVyTG9nVHJpZ2dlclJlcXVlc3Q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uYmxvY2tjaGFpbi5ldm0udjFhbHBoYUILQ2xpZW50UHJvdG9QAaICA0NCRaoCI0NhcGFiaWxpdGllcy5CbG9ja2NoYWluLkV2bS5WMWFscGhhygIjQ2FwYWJpbGl0aWVzXEJsb2NrY2hhaW5cRXZtXFYxYWxwaGHiAi9DYXBhYmlsaXRpZXNcQmxvY2tjaGFpblxFdm1cVjFhbHBoYVxHUEJNZXRhZGF0YeoCJkNhcGFiaWxpdGllczo6QmxvY2tjaGFpbjo6RXZtOjpWMWFscGhhYgZwcm90bzM', [file_sdk_v1alpha_sdk, file_tools_generator_v1alpha_cre_metadata, file_values_v1_values], ) diff --git a/packages/cre-sdk/src/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb.ts b/packages/cre-sdk/src/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb.ts index 1f7b16a..b02ba68 100644 --- a/packages/cre-sdk/src/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb.ts +++ b/packages/cre-sdk/src/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb.ts @@ -2,85 +2,131 @@ // @generated from file capabilities/networking/confidentialhttp/v1alpha/client.proto (package capabilities.networking.confidentialhttp.v1alpha, syntax proto3) /* eslint-disable */ -import type { Message } from '@bufbuild/protobuf' -import type { GenEnum, GenFile, GenMessage, GenService } from '@bufbuild/protobuf/codegenv2' -import { enumDesc, fileDesc, messageDesc, serviceDesc } from '@bufbuild/protobuf/codegenv2' -import type { Duration, DurationJson } from '@bufbuild/protobuf/wkt' -import { file_google_protobuf_duration } from '@bufbuild/protobuf/wkt' -import { file_tools_generator_v1alpha_cre_metadata } from '../../../../tools/generator/v1alpha/cre_metadata_pb' +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Duration, DurationJson } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_duration } from "@bufbuild/protobuf/wkt"; +import { file_tools_generator_v1alpha_cre_metadata } from "../../../../tools/generator/v1alpha/cre_metadata_pb"; +import type { Message } from "@bufbuild/protobuf"; /** * Describes the file capabilities/networking/confidentialhttp/v1alpha/client.proto. */ -export const file_capabilities_networking_confidentialhttp_v1alpha_client: GenFile = - /*@__PURE__*/ - fileDesc( - 'Cj1jYXBhYmlsaXRpZXMvbmV0d29ya2luZy9jb25maWRlbnRpYWxodHRwL3YxYWxwaGEvY2xpZW50LnByb3RvEjBjYXBhYmlsaXRpZXMubmV0d29ya2luZy5jb25maWRlbnRpYWxodHRwLnYxYWxwaGEiUAoQU2VjcmV0SWRlbnRpZmllchILCgNrZXkYASABKAkSEQoJbmFtZXNwYWNlGAIgASgJEhIKBW93bmVyGAMgASgJSACIAQFCCAoGX293bmVyIh4KDEhlYWRlclZhbHVlcxIOCgZ2YWx1ZXMYASADKAki1wQKC0hUVFBSZXF1ZXN0EgsKA3VybBgBIAEoCRIOCgZtZXRob2QYAiABKAkSFQoLYm9keV9zdHJpbmcYAyABKAlIABIUCgpib2R5X2J5dGVzGAggASgMSAASZgoNbXVsdGlfaGVhZGVycxgEIAMoCzJPLmNhcGFiaWxpdGllcy5uZXR3b3JraW5nLmNvbmZpZGVudGlhbGh0dHAudjFhbHBoYS5IVFRQUmVxdWVzdC5NdWx0aUhlYWRlcnNFbnRyeRJ3ChZ0ZW1wbGF0ZV9wdWJsaWNfdmFsdWVzGAUgAygLMlcuY2FwYWJpbGl0aWVzLm5ldHdvcmtpbmcuY29uZmlkZW50aWFsaHR0cC52MWFscGhhLkhUVFBSZXF1ZXN0LlRlbXBsYXRlUHVibGljVmFsdWVzRW50cnkSHwoXY3VzdG9tX3Jvb3RfY2FfY2VydF9wZW0YBiABKAwSKgoHdGltZW91dBgHIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIWCg5lbmNyeXB0X291dHB1dBgJIAEoCBpzChFNdWx0aUhlYWRlcnNFbnRyeRILCgNrZXkYASABKAkSTQo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YWxwaGEuQ29uZmlkZW50aWFsSFRUUFJlcXVlc3QaPi5jYXBhYmlsaXRpZXMubmV0d29ya2luZy5jb25maWRlbnRpYWxodHRwLnYxYWxwaGEuSFRUUFJlc3BvbnNlGiWCtRghCAESHWNvbmZpZGVudGlhbC1odHRwQDEuMC4wLWFscGhhQqYCCjRjb20uY2FwYWJpbGl0aWVzLm5ldHdvcmtpbmcuY29uZmlkZW50aWFsaHR0cC52MWFscGhhQgtDbGllbnRQcm90b1ABogIDQ05DqgIwQ2FwYWJpbGl0aWVzLk5ldHdvcmtpbmcuQ29uZmlkZW50aWFsaHR0cC5WMWFscGhhygIwQ2FwYWJpbGl0aWVzXE5ldHdvcmtpbmdcQ29uZmlkZW50aWFsaHR0cFxWMWFscGhh4gI8Q2FwYWJpbGl0aWVzXE5ldHdvcmtpbmdcQ29uZmlkZW50aWFsaHR0cFxWMWFscGhhXEdQQk1ldGFkYXRh6gIzQ2FwYWJpbGl0aWVzOjpOZXR3b3JraW5nOjpDb25maWRlbnRpYWxodHRwOjpWMWFscGhhYgZwcm90bzM', - [file_google_protobuf_duration, file_tools_generator_v1alpha_cre_metadata], - ) +export const file_capabilities_networking_confidentialhttp_v1alpha_client: GenFile = /*@__PURE__*/ + fileDesc("Cj1jYXBhYmlsaXRpZXMvbmV0d29ya2luZy9jb25maWRlbnRpYWxodHRwL3YxYWxwaGEvY2xpZW50LnByb3RvEjBjYXBhYmlsaXRpZXMubmV0d29ya2luZy5jb25maWRlbnRpYWxodHRwLnYxYWxwaGEiUAoQU2VjcmV0SWRlbnRpZmllchILCgNrZXkYASABKAkSEQoJbmFtZXNwYWNlGAIgASgJEhIKBW93bmVyGAMgASgJSACIAQFCCAoGX293bmVyIoABCg5TdHJpbmdPclNlY3JldBIPCgVwbGFpbhgBIAEoCUgAElQKBnNlY3JldBgCIAEoCzJCLmNhcGFiaWxpdGllcy5uZXR3b3JraW5nLmNvbmZpZGVudGlhbGh0dHAudjFhbHBoYS5TZWNyZXRJZGV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2YWx1ZRgCIAEoCToCOAEyygEKBkNsaWVudBKYAQoLU2VuZFJlcXVlc3QSSS5jYXBhYmlsaXRpZXMubmV0d29ya2luZy5jb25maWRlbnRpYWxodHRwLnYxYWxwaGEuQ29uZmlkZW50aWFsSFRUUFJlcXVlc3QaPi5jYXBhYmlsaXRpZXMubmV0d29ya2luZy5jb25maWRlbnRpYWxodHRwLnYxYWxwaGEuSFRUUFJlc3BvbnNlGiWCtRghCAESHWNvbmZpZGVudGlhbC1odHRwQDEuMC4wLWFscGhhQqYCCjRjb20uY2FwYWJpbGl0aWVzLm5ldHdvcmtpbmcuY29uZmlkZW50aWFsaHR0cC52MWFscGhhQgtDbGllbnRQcm90b1ABogIDQ05DqgIwQ2FwYWJpbGl0aWVzLk5ldHdvcmtpbmcuQ29uZmlkZW50aWFsaHR0cC5WMWFscGhhygIwQ2FwYWJpbGl0aWVzXE5ldHdvcmtpbmdcQ29uZmlkZW50aWFsaHR0cFxWMWFscGhh4gI8Q2FwYWJpbGl0aWVzXE5ldHdvcmtpbmdcQ29uZmlkZW50aWFsaHR0cFxWMWFscGhhXEdQQk1ldGFkYXRh6gIzQ2FwYWJpbGl0aWVzOjpOZXR3b3JraW5nOjpDb25maWRlbnRpYWxodHRwOjpWMWFscGhhYgZwcm90bzM", [file_google_protobuf_duration, file_tools_generator_v1alpha_cre_metadata]); /** * @generated from message capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier */ -export type SecretIdentifier = - Message<'capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier'> & { - /** - * @generated from field: string key = 1; - */ - key: string - - /** - * @generated from field: string namespace = 2; - */ - namespace: string - - /** - * @generated from field: optional string owner = 3; - */ - owner?: string - } +export type SecretIdentifier = Message<"capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: string namespace = 2; + */ + namespace: string; + + /** + * @generated from field: optional string owner = 3; + */ + owner?: string; +}; /** * @generated from message capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier */ export type SecretIdentifierJson = { - /** - * @generated from field: string key = 1; - */ - key?: string - - /** - * @generated from field: string namespace = 2; - */ - namespace?: string - - /** - * @generated from field: optional string owner = 3; - */ - owner?: string -} + /** + * @generated from field: string key = 1; + */ + key?: string; + + /** + * @generated from field: string namespace = 2; + */ + namespace?: string; + + /** + * @generated from field: optional string owner = 3; + */ + owner?: string; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier. * Use `create(SecretIdentifierSchema)` to create a new message. */ -export const SecretIdentifierSchema: GenMessage< - SecretIdentifier, - { jsonType: SecretIdentifierJson } -> = /*@__PURE__*/ messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 0) +export const SecretIdentifierSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 0); + +/** + * StringOrSecret allows a field to carry either a plain string value + * (used directly) or a SecretIdentifier (resolved from the vault at + * signing time). Use this for fields that aren't necessarily secret, + * e.g. a username or client_id. + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.StringOrSecret + */ +export type StringOrSecret = Message<"capabilities.networking.confidentialhttp.v1alpha.StringOrSecret"> & { + /** + * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.StringOrSecret.value + */ + value: { + /** + * @generated from field: string plain = 1; + */ + value: string; + case: "plain"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 2; + */ + value: SecretIdentifier; + case: "secret"; + } | { case: undefined; value?: undefined }; +}; + +/** + * StringOrSecret allows a field to carry either a plain string value + * (used directly) or a SecretIdentifier (resolved from the vault at + * signing time). Use this for fields that aren't necessarily secret, + * e.g. a username or client_id. + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.StringOrSecret + */ +export type StringOrSecretJson = { + /** + * @generated from field: string plain = 1; + */ + plain?: string; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 2; + */ + secret?: SecretIdentifierJson; +}; + +/** + * Describes the message capabilities.networking.confidentialhttp.v1alpha.StringOrSecret. + * Use `create(StringOrSecretSchema)` to create a new message. + */ +export const StringOrSecretSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 1); /** * HeaderValues represents multiple values for a single header key. * * @generated from message capabilities.networking.confidentialhttp.v1alpha.HeaderValues */ -export type HeaderValues = - Message<'capabilities.networking.confidentialhttp.v1alpha.HeaderValues'> & { - /** - * @generated from field: repeated string values = 1; - */ - values: string[] - } +export type HeaderValues = Message<"capabilities.networking.confidentialhttp.v1alpha.HeaderValues"> & { + /** + * @generated from field: repeated string values = 1; + */ + values: string[]; +}; /** * HeaderValues represents multiple values for a single header key. @@ -88,103 +134,106 @@ export type HeaderValues = * @generated from message capabilities.networking.confidentialhttp.v1alpha.HeaderValues */ export type HeaderValuesJson = { - /** - * @generated from field: repeated string values = 1; - */ - values?: string[] -} + /** + * @generated from field: repeated string values = 1; + */ + values?: string[]; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.HeaderValues. * Use `create(HeaderValuesSchema)` to create a new message. */ -export const HeaderValuesSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 1) +export const HeaderValuesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 2); /** * HTTPRequest contains the HTTP fields used to make a request from the enclave. * * @generated from message capabilities.networking.confidentialhttp.v1alpha.HTTPRequest */ -export type HTTPRequest = - Message<'capabilities.networking.confidentialhttp.v1alpha.HTTPRequest'> & { - /** - * url is the endpoint to which the request is sent. - * - * @generated from field: string url = 1; - */ - url: string - - /** - * method is the HTTP method (GET, POST, PUT, DELETE, etc.). - * - * @generated from field: string method = 2; - */ - method: string - - /** - * body is the request body - either a string template or raw bytes. - * - * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.HTTPRequest.body - */ - body: - | { - /** - * @generated from field: string body_string = 3; - */ - value: string - case: 'bodyString' - } - | { - /** - * @generated from field: bytes body_bytes = 8; - */ - value: Uint8Array - case: 'bodyBytes' - } - | { case: undefined; value?: undefined } - - /** - * multi_headers are the request headers as name-value pairs. - * Supports multiple values per header key. - * - * @generated from field: map multi_headers = 4; - */ - multiHeaders: { [key: string]: HeaderValues } - - /** - * template_public_values are public values used to fill in request body and header templates. - * - * @generated from field: map template_public_values = 5; - */ - templatePublicValues: { [key: string]: string } - - /** - * custom_root_ca_cert_pem is an optional custom root CA certificate (PEM format) - * for verifying the external server's TLS certificate. - * - * @generated from field: bytes custom_root_ca_cert_pem = 6; - */ - customRootCaCertPem: Uint8Array - - /** - * timeout is the request timeout duration. - * - * @generated from field: google.protobuf.Duration timeout = 7; - */ - timeout?: Duration - - /** - * encrypt_output controls whether the enclave response should be encrypted. - * If true, the response will be AES-GCM encrypted using the - * "san_marino_aes_gcm_encryption_key" secret. - * Default is false (response returned unencrypted). - * - * @generated from field: bool encrypt_output = 9; - */ - encryptOutput: boolean - } +export type HTTPRequest = Message<"capabilities.networking.confidentialhttp.v1alpha.HTTPRequest"> & { + /** + * url is the endpoint to which the request is sent. + * + * @generated from field: string url = 1; + */ + url: string; + + /** + * method is the HTTP method (GET, POST, PUT, DELETE, etc.). + * + * @generated from field: string method = 2; + */ + method: string; + + /** + * body is the request body - either a string template or raw bytes. + * + * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.HTTPRequest.body + */ + body: { + /** + * @generated from field: string body_string = 3; + */ + value: string; + case: "bodyString"; + } | { + /** + * @generated from field: bytes body_bytes = 8; + */ + value: Uint8Array; + case: "bodyBytes"; + } | { case: undefined; value?: undefined }; + + /** + * multi_headers are the request headers as name-value pairs. + * Supports multiple values per header key. + * + * @generated from field: map multi_headers = 4; + */ + multiHeaders: { [key: string]: HeaderValues }; + + /** + * template_public_values are public values used to fill in request body and header templates. + * + * @generated from field: map template_public_values = 5; + */ + templatePublicValues: { [key: string]: string }; + + /** + * custom_root_ca_cert_pem is an optional custom root CA certificate (PEM format) + * for verifying the external server's TLS certificate. + * + * @generated from field: bytes custom_root_ca_cert_pem = 6; + */ + customRootCaCertPem: Uint8Array; + + /** + * timeout is the request timeout duration. + * + * @generated from field: google.protobuf.Duration timeout = 7; + */ + timeout?: Duration; + + /** + * encrypt_output controls whether the enclave response should be encrypted. + * If true, the response will be AES-GCM encrypted using the + * "san_marino_aes_gcm_encryption_key" secret. + * Default is false (response returned unencrypted). + * + * @generated from field: bool encrypt_output = 9; + */ + encryptOutput: boolean; + + /** + * mtls, when set, configures mutual TLS for this request. Serialized here + * (on HTTPRequest) so it is included in GetInput() and reaches the enclave. + * + * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.MtlsAuth mtls = 10; + */ + mtls?: MtlsAuth; +}; /** * HTTPRequest contains the HTTP fields used to make a request from the enclave. @@ -192,108 +241,114 @@ export type HTTPRequest = * @generated from message capabilities.networking.confidentialhttp.v1alpha.HTTPRequest */ export type HTTPRequestJson = { - /** - * url is the endpoint to which the request is sent. - * - * @generated from field: string url = 1; - */ - url?: string - - /** - * method is the HTTP method (GET, POST, PUT, DELETE, etc.). - * - * @generated from field: string method = 2; - */ - method?: string - - /** - * @generated from field: string body_string = 3; - */ - bodyString?: string - - /** - * @generated from field: bytes body_bytes = 8; - */ - bodyBytes?: string - - /** - * multi_headers are the request headers as name-value pairs. - * Supports multiple values per header key. - * - * @generated from field: map multi_headers = 4; - */ - multiHeaders?: { [key: string]: HeaderValuesJson } - - /** - * template_public_values are public values used to fill in request body and header templates. - * - * @generated from field: map template_public_values = 5; - */ - templatePublicValues?: { [key: string]: string } - - /** - * custom_root_ca_cert_pem is an optional custom root CA certificate (PEM format) - * for verifying the external server's TLS certificate. - * - * @generated from field: bytes custom_root_ca_cert_pem = 6; - */ - customRootCaCertPem?: string - - /** - * timeout is the request timeout duration. - * - * @generated from field: google.protobuf.Duration timeout = 7; - */ - timeout?: DurationJson - - /** - * encrypt_output controls whether the enclave response should be encrypted. - * If true, the response will be AES-GCM encrypted using the - * "san_marino_aes_gcm_encryption_key" secret. - * Default is false (response returned unencrypted). - * - * @generated from field: bool encrypt_output = 9; - */ - encryptOutput?: boolean -} + /** + * url is the endpoint to which the request is sent. + * + * @generated from field: string url = 1; + */ + url?: string; + + /** + * method is the HTTP method (GET, POST, PUT, DELETE, etc.). + * + * @generated from field: string method = 2; + */ + method?: string; + + /** + * @generated from field: string body_string = 3; + */ + bodyString?: string; + + /** + * @generated from field: bytes body_bytes = 8; + */ + bodyBytes?: string; + + /** + * multi_headers are the request headers as name-value pairs. + * Supports multiple values per header key. + * + * @generated from field: map multi_headers = 4; + */ + multiHeaders?: { [key: string]: HeaderValuesJson }; + + /** + * template_public_values are public values used to fill in request body and header templates. + * + * @generated from field: map template_public_values = 5; + */ + templatePublicValues?: { [key: string]: string }; + + /** + * custom_root_ca_cert_pem is an optional custom root CA certificate (PEM format) + * for verifying the external server's TLS certificate. + * + * @generated from field: bytes custom_root_ca_cert_pem = 6; + */ + customRootCaCertPem?: string; + + /** + * timeout is the request timeout duration. + * + * @generated from field: google.protobuf.Duration timeout = 7; + */ + timeout?: DurationJson; + + /** + * encrypt_output controls whether the enclave response should be encrypted. + * If true, the response will be AES-GCM encrypted using the + * "san_marino_aes_gcm_encryption_key" secret. + * Default is false (response returned unencrypted). + * + * @generated from field: bool encrypt_output = 9; + */ + encryptOutput?: boolean; + + /** + * mtls, when set, configures mutual TLS for this request. Serialized here + * (on HTTPRequest) so it is included in GetInput() and reaches the enclave. + * + * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.MtlsAuth mtls = 10; + */ + mtls?: MtlsAuthJson; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.HTTPRequest. * Use `create(HTTPRequestSchema)` to create a new message. */ -export const HTTPRequestSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 2) +export const HTTPRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 3); /** * HTTPResponse contains the HTTP response from the enclave. * * @generated from message capabilities.networking.confidentialhttp.v1alpha.HTTPResponse */ -export type HTTPResponse = - Message<'capabilities.networking.confidentialhttp.v1alpha.HTTPResponse'> & { - /** - * status_code is the HTTP status code. - * - * @generated from field: uint32 status_code = 1; - */ - statusCode: number - - /** - * body is the response body. - * - * @generated from field: bytes body = 2; - */ - body: Uint8Array - - /** - * multi_headers are the response headers. - * Supports multiple values per header key. - * - * @generated from field: map multi_headers = 3; - */ - multiHeaders: { [key: string]: HeaderValues } - } +export type HTTPResponse = Message<"capabilities.networking.confidentialhttp.v1alpha.HTTPResponse"> & { + /** + * status_code is the HTTP status code. + * + * @generated from field: uint32 status_code = 1; + */ + statusCode: number; + + /** + * body is the response body. + * + * @generated from field: bytes body = 2; + */ + body: Uint8Array; + + /** + * multi_headers are the response headers. + * Supports multiple values per header key. + * + * @generated from field: map multi_headers = 3; + */ + multiHeaders: { [key: string]: HeaderValues }; +}; /** * HTTPResponse contains the HTTP response from the enclave. @@ -301,36 +356,35 @@ export type HTTPResponse = * @generated from message capabilities.networking.confidentialhttp.v1alpha.HTTPResponse */ export type HTTPResponseJson = { - /** - * status_code is the HTTP status code. - * - * @generated from field: uint32 status_code = 1; - */ - statusCode?: number - - /** - * body is the response body. - * - * @generated from field: bytes body = 2; - */ - body?: string - - /** - * multi_headers are the response headers. - * Supports multiple values per header key. - * - * @generated from field: map multi_headers = 3; - */ - multiHeaders?: { [key: string]: HeaderValuesJson } -} + /** + * status_code is the HTTP status code. + * + * @generated from field: uint32 status_code = 1; + */ + statusCode?: number; + + /** + * body is the response body. + * + * @generated from field: bytes body = 2; + */ + body?: string; + + /** + * multi_headers are the response headers. + * Supports multiple values per header key. + * + * @generated from field: map multi_headers = 3; + */ + multiHeaders?: { [key: string]: HeaderValuesJson }; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.HTTPResponse. * Use `create(HTTPResponseSchema)` to create a new message. */ -export const HTTPResponseSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 3) +export const HTTPResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 4); /** * ConfidentialHTTPRequest is the input provided to the confidential HTTP capability. @@ -338,30 +392,37 @@ export const HTTPResponseSchema: GenMessage & { - /** - * @generated from field: repeated capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier vault_don_secrets = 1; - */ - vaultDonSecrets: SecretIdentifier[] - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HTTPRequest request = 2; - */ - request?: HTTPRequest - - /** - * auth, when set, instructs the enclave to sign the outbound request using - * the specified method. Every secret_name referenced inside AuthConfig must - * also appear in vault_don_secrets (enforced by the capability validator). - * When auth is nil, the request is sent with only the headers/body the - * caller provided — preserving the legacy "{{.SECRET_NAME}}" header-template - * behavior. - * - * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.AuthConfig auth = 3; - */ - auth?: AuthConfig - } +export type ConfidentialHTTPRequest = Message<"capabilities.networking.confidentialhttp.v1alpha.ConfidentialHTTPRequest"> & { + /** + * @generated from field: repeated capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier vault_don_secrets = 1; + */ + vaultDonSecrets: SecretIdentifier[]; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HTTPRequest request = 2; + */ + request?: HTTPRequest; + + /** + * auth, when set, instructs the enclave to sign the outbound request using + * the specified method. Every SecretIdentifier referenced inside AuthConfig + * must also appear in vault_don_secrets (enforced by the capability validator). + * When auth is nil, the request is sent with only the headers/body the + * caller provided — preserving the legacy "{{.SECRET_NAME}}" header-template + * behavior. + * + * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.AuthConfig auth = 3; + */ + auth?: AuthConfig; + + /** + * mtls, when set, configures mutual TLS for the outbound request. mTLS is + * a transport-level mechanism and operates independently of auth. + * + * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.MtlsAuth mtls = 4; + */ + mtls?: MtlsAuth; +}; /** * ConfidentialHTTPRequest is the input provided to the confidential HTTP capability. @@ -370,220 +431,287 @@ export type ConfidentialHTTPRequest = * @generated from message capabilities.networking.confidentialhttp.v1alpha.ConfidentialHTTPRequest */ export type ConfidentialHTTPRequestJson = { - /** - * @generated from field: repeated capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier vault_don_secrets = 1; - */ - vaultDonSecrets?: SecretIdentifierJson[] - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HTTPRequest request = 2; - */ - request?: HTTPRequestJson - - /** - * auth, when set, instructs the enclave to sign the outbound request using - * the specified method. Every secret_name referenced inside AuthConfig must - * also appear in vault_don_secrets (enforced by the capability validator). - * When auth is nil, the request is sent with only the headers/body the - * caller provided — preserving the legacy "{{.SECRET_NAME}}" header-template - * behavior. - * - * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.AuthConfig auth = 3; - */ - auth?: AuthConfigJson -} + /** + * @generated from field: repeated capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier vault_don_secrets = 1; + */ + vaultDonSecrets?: SecretIdentifierJson[]; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HTTPRequest request = 2; + */ + request?: HTTPRequestJson; + + /** + * auth, when set, instructs the enclave to sign the outbound request using + * the specified method. Every SecretIdentifier referenced inside AuthConfig + * must also appear in vault_don_secrets (enforced by the capability validator). + * When auth is nil, the request is sent with only the headers/body the + * caller provided — preserving the legacy "{{.SECRET_NAME}}" header-template + * behavior. + * + * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.AuthConfig auth = 3; + */ + auth?: AuthConfigJson; + + /** + * mtls, when set, configures mutual TLS for the outbound request. mTLS is + * a transport-level mechanism and operates independently of auth. + * + * @generated from field: optional capabilities.networking.confidentialhttp.v1alpha.MtlsAuth mtls = 4; + */ + mtls?: MtlsAuthJson; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.ConfidentialHTTPRequest. * Use `create(ConfidentialHTTPRequestSchema)` to create a new message. */ -export const ConfidentialHTTPRequestSchema: GenMessage< - ConfidentialHTTPRequest, - { jsonType: ConfidentialHTTPRequestJson } -> = /*@__PURE__*/ messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 4) +export const ConfidentialHTTPRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 5); + +/** + * MtlsAuth configures mutual TLS for the outbound request. The client + * certificate and private key are resolved from VaultDON at execution time. + * Every SecretIdentifier referenced inside MtlsAuth must also appear in + * vault_don_secrets (enforced by the capability validator). + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.MtlsAuth + */ +export type MtlsAuth = Message<"capabilities.networking.confidentialhttp.v1alpha.MtlsAuth"> & { + /** + * required; PEM-encoded client certificate + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_cert = 1; + */ + clientCert?: SecretIdentifier; + + /** + * required; PEM-encoded private key + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_key = 2; + */ + clientKey?: SecretIdentifier; + + /** + * optional; PEM-encoded CA bundle for server verification + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier ca_cert = 3; + */ + caCert?: SecretIdentifier; +}; + +/** + * MtlsAuth configures mutual TLS for the outbound request. The client + * certificate and private key are resolved from VaultDON at execution time. + * Every SecretIdentifier referenced inside MtlsAuth must also appear in + * vault_don_secrets (enforced by the capability validator). + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.MtlsAuth + */ +export type MtlsAuthJson = { + /** + * required; PEM-encoded client certificate + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_cert = 1; + */ + clientCert?: SecretIdentifierJson; + + /** + * required; PEM-encoded private key + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_key = 2; + */ + clientKey?: SecretIdentifierJson; + + /** + * optional; PEM-encoded CA bundle for server verification + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier ca_cert = 3; + */ + caCert?: SecretIdentifierJson; +}; + +/** + * Describes the message capabilities.networking.confidentialhttp.v1alpha.MtlsAuth. + * Use `create(MtlsAuthSchema)` to create a new message. + */ +export const MtlsAuthSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 6); /** * AuthConfig selects one of the supported request-signing methods. * Each variant carries the method-specific parameters and references - * the names of the Vault-DON secrets it needs. + * the secrets it needs. * * @generated from message capabilities.networking.confidentialhttp.v1alpha.AuthConfig */ -export type AuthConfig = Message<'capabilities.networking.confidentialhttp.v1alpha.AuthConfig'> & { - /** - * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.AuthConfig.method - */ - method: - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth api_key = 1; - */ - value: ApiKeyAuth - case: 'apiKey' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BasicAuth basic = 2; - */ - value: BasicAuth - case: 'basic' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BearerAuth bearer = 3; - */ - value: BearerAuth - case: 'bearer' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacAuth hmac = 4; - */ - value: HmacAuth - case: 'hmac' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth oauth2 = 5; - */ - value: OAuth2Auth - case: 'oauth2' - } - | { case: undefined; value?: undefined } -} +export type AuthConfig = Message<"capabilities.networking.confidentialhttp.v1alpha.AuthConfig"> & { + /** + * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.AuthConfig.method + */ + method: { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth api_key = 1; + */ + value: ApiKeyAuth; + case: "apiKey"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BasicAuth basic = 2; + */ + value: BasicAuth; + case: "basic"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BearerAuth bearer = 3; + */ + value: BearerAuth; + case: "bearer"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacAuth hmac = 4; + */ + value: HmacAuth; + case: "hmac"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth oauth2 = 5; + */ + value: OAuth2Auth; + case: "oauth2"; + } | { case: undefined; value?: undefined }; +}; /** * AuthConfig selects one of the supported request-signing methods. * Each variant carries the method-specific parameters and references - * the names of the Vault-DON secrets it needs. + * the secrets it needs. * * @generated from message capabilities.networking.confidentialhttp.v1alpha.AuthConfig */ export type AuthConfigJson = { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth api_key = 1; - */ - apiKey?: ApiKeyAuthJson - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BasicAuth basic = 2; - */ - basic?: BasicAuthJson - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BearerAuth bearer = 3; - */ - bearer?: BearerAuthJson - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacAuth hmac = 4; - */ - hmac?: HmacAuthJson - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth oauth2 = 5; - */ - oauth2?: OAuth2AuthJson -} + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth api_key = 1; + */ + apiKey?: ApiKeyAuthJson; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BasicAuth basic = 2; + */ + basic?: BasicAuthJson; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.BearerAuth bearer = 3; + */ + bearer?: BearerAuthJson; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacAuth hmac = 4; + */ + hmac?: HmacAuthJson; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth oauth2 = 5; + */ + oauth2?: OAuth2AuthJson; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.AuthConfig. * Use `create(AuthConfigSchema)` to create a new message. */ -export const AuthConfigSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 5) +export const AuthConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 7); /** * ApiKeyAuth attaches a secret value to a chosen header. * Renders as: : - * Example (header_name="x-api-key", secret_name="coingecko", value_prefix=""): + * Example (header_name="x-api-key"): * x-api-key: * * @generated from message capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth */ -export type ApiKeyAuth = Message<'capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth'> & { - /** - * required, e.g. "x-api-key", "Authorization" - * - * @generated from field: string header_name = 1; - */ - headerName: string - - /** - * required; key into ConfidentialHTTPRequest.vault_don_secrets - * - * @generated from field: string secret_name = 2; - */ - secretName: string - - /** - * optional, e.g. "ApiKey ", "Token " - * - * @generated from field: string value_prefix = 3; - */ - valuePrefix: string -} +export type ApiKeyAuth = Message<"capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth"> & { + /** + * required, e.g. "x-api-key", "Authorization" + * + * @generated from field: string header_name = 1; + */ + headerName: string; + + /** + * required; the API key value + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 2; + */ + secret?: SecretIdentifier; + + /** + * optional, e.g. "ApiKey ", "Token " + * + * @generated from field: string value_prefix = 3; + */ + valuePrefix: string; +}; /** * ApiKeyAuth attaches a secret value to a chosen header. * Renders as: : - * Example (header_name="x-api-key", secret_name="coingecko", value_prefix=""): + * Example (header_name="x-api-key"): * x-api-key: * * @generated from message capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth */ export type ApiKeyAuthJson = { - /** - * required, e.g. "x-api-key", "Authorization" - * - * @generated from field: string header_name = 1; - */ - headerName?: string - - /** - * required; key into ConfidentialHTTPRequest.vault_don_secrets - * - * @generated from field: string secret_name = 2; - */ - secretName?: string - - /** - * optional, e.g. "ApiKey ", "Token " - * - * @generated from field: string value_prefix = 3; - */ - valuePrefix?: string -} + /** + * required, e.g. "x-api-key", "Authorization" + * + * @generated from field: string header_name = 1; + */ + headerName?: string; + + /** + * required; the API key value + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 2; + */ + secret?: SecretIdentifierJson; + + /** + * optional, e.g. "ApiKey ", "Token " + * + * @generated from field: string value_prefix = 3; + */ + valuePrefix?: string; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth. * Use `create(ApiKeyAuthSchema)` to create a new message. */ -export const ApiKeyAuthSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 6) +export const ApiKeyAuthSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 8); /** * BasicAuth renders: Authorization: Basic base64(username ":" password). * * @generated from message capabilities.networking.confidentialhttp.v1alpha.BasicAuth */ -export type BasicAuth = Message<'capabilities.networking.confidentialhttp.v1alpha.BasicAuth'> & { - /** - * required - * - * @generated from field: string username_secret_name = 1; - */ - usernameSecretName: string - - /** - * required - * - * @generated from field: string password_secret_name = 2; - */ - passwordSecretName: string -} +export type BasicAuth = Message<"capabilities.networking.confidentialhttp.v1alpha.BasicAuth"> & { + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret username = 1; + */ + username?: StringOrSecret; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier password = 2; + */ + password?: SecretIdentifier; +}; /** * BasicAuth renders: Authorization: Basic base64(username ":" password). @@ -591,28 +719,27 @@ export type BasicAuth = Message<'capabilities.networking.confidentialhttp.v1alph * @generated from message capabilities.networking.confidentialhttp.v1alpha.BasicAuth */ export type BasicAuthJson = { - /** - * required - * - * @generated from field: string username_secret_name = 1; - */ - usernameSecretName?: string - - /** - * required - * - * @generated from field: string password_secret_name = 2; - */ - passwordSecretName?: string -} + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret username = 1; + */ + username?: StringOrSecretJson; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier password = 2; + */ + password?: SecretIdentifierJson; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.BasicAuth. * Use `create(BasicAuthSchema)` to create a new message. */ -export const BasicAuthSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 7) +export const BasicAuthSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 9); /** * BearerAuth attaches a pre-issued long-lived token. @@ -622,28 +749,28 @@ export const BasicAuthSchema: GenMessage * * @generated from message capabilities.networking.confidentialhttp.v1alpha.BearerAuth */ -export type BearerAuth = Message<'capabilities.networking.confidentialhttp.v1alpha.BearerAuth'> & { - /** - * required - * - * @generated from field: string token_secret_name = 1; - */ - tokenSecretName: string - - /** - * optional override, default "Authorization" - * - * @generated from field: string header_name = 2; - */ - headerName: string - - /** - * optional override, default "Bearer " - * - * @generated from field: string value_prefix = 3; - */ - valuePrefix: string -} +export type BearerAuth = Message<"capabilities.networking.confidentialhttp.v1alpha.BearerAuth"> & { + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier token = 1; + */ + token?: SecretIdentifier; + + /** + * optional override, default "Authorization" + * + * @generated from field: string header_name = 2; + */ + headerName: string; + + /** + * optional override, default "Bearer " + * + * @generated from field: string value_prefix = 3; + */ + valuePrefix: string; +}; /** * BearerAuth attaches a pre-issued long-lived token. @@ -654,69 +781,64 @@ export type BearerAuth = Message<'capabilities.networking.confidentialhttp.v1alp * @generated from message capabilities.networking.confidentialhttp.v1alpha.BearerAuth */ export type BearerAuthJson = { - /** - * required - * - * @generated from field: string token_secret_name = 1; - */ - tokenSecretName?: string - - /** - * optional override, default "Authorization" - * - * @generated from field: string header_name = 2; - */ - headerName?: string - - /** - * optional override, default "Bearer " - * - * @generated from field: string value_prefix = 3; - */ - valuePrefix?: string -} + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier token = 1; + */ + token?: SecretIdentifierJson; + + /** + * optional override, default "Authorization" + * + * @generated from field: string header_name = 2; + */ + headerName?: string; + + /** + * optional override, default "Bearer " + * + * @generated from field: string value_prefix = 3; + */ + valuePrefix?: string; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.BearerAuth. * Use `create(BearerAuthSchema)` to create a new message. */ -export const BearerAuthSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 8) +export const BearerAuthSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 10); /** * HmacAuth groups all HMAC-family signing variants. * * @generated from message capabilities.networking.confidentialhttp.v1alpha.HmacAuth */ -export type HmacAuth = Message<'capabilities.networking.confidentialhttp.v1alpha.HmacAuth'> & { - /** - * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.HmacAuth.variant - */ - variant: - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacSha256 sha256 = 1; - */ - value: HmacSha256 - case: 'sha256' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.AwsSigV4 aws_sig_v4 = 2; - */ - value: AwsSigV4 - case: 'awsSigV4' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom custom = 3; - */ - value: HmacCustom - case: 'custom' - } - | { case: undefined; value?: undefined } -} +export type HmacAuth = Message<"capabilities.networking.confidentialhttp.v1alpha.HmacAuth"> & { + /** + * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.HmacAuth.variant + */ + variant: { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacSha256 sha256 = 1; + */ + value: HmacSha256; + case: "sha256"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.AwsSigV4 aws_sig_v4 = 2; + */ + value: AwsSigV4; + case: "awsSigV4"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom custom = 3; + */ + value: HmacCustom; + case: "custom"; + } | { case: undefined; value?: undefined }; +}; /** * HmacAuth groups all HMAC-family signing variants. @@ -724,29 +846,28 @@ export type HmacAuth = Message<'capabilities.networking.confidentialhttp.v1alpha * @generated from message capabilities.networking.confidentialhttp.v1alpha.HmacAuth */ export type HmacAuthJson = { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacSha256 sha256 = 1; - */ - sha256?: HmacSha256Json - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.AwsSigV4 aws_sig_v4 = 2; - */ - awsSigV4?: AwsSigV4Json - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom custom = 3; - */ - custom?: HmacCustomJson -} + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacSha256 sha256 = 1; + */ + sha256?: HmacSha256Json; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.AwsSigV4 aws_sig_v4 = 2; + */ + awsSigV4?: AwsSigV4Json; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom custom = 3; + */ + custom?: HmacCustomJson; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.HmacAuth. * Use `create(HmacAuthSchema)` to create a new message. */ -export const HmacAuthSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 9) +export const HmacAuthSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 11); /** * HmacSha256 implements a generic canonical-string HMAC-SHA256 signature. @@ -755,42 +876,42 @@ export const HmacAuthSchema: GenMessage = * * @generated from message capabilities.networking.confidentialhttp.v1alpha.HmacSha256 */ -export type HmacSha256 = Message<'capabilities.networking.confidentialhttp.v1alpha.HmacSha256'> & { - /** - * required shared secret - * - * @generated from field: string secret_name = 1; - */ - secretName: string - - /** - * default "X-Signature" - * - * @generated from field: string signature_header = 2; - */ - signatureHeader: string - - /** - * default "X-Timestamp" - * - * @generated from field: string timestamp_header = 3; - */ - timestampHeader: string - - /** - * if true, include the query string in the canonical url - * - * @generated from field: bool include_query = 4; - */ - includeQuery: boolean - - /** - * "hex" (default) or "base64" - * - * @generated from field: string encoding = 5; - */ - encoding: string -} +export type HmacSha256 = Message<"capabilities.networking.confidentialhttp.v1alpha.HmacSha256"> & { + /** + * required; the shared signing secret + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 1; + */ + secret?: SecretIdentifier; + + /** + * default "X-Signature" + * + * @generated from field: string signature_header = 2; + */ + signatureHeader: string; + + /** + * default "X-Timestamp" + * + * @generated from field: string timestamp_header = 3; + */ + timestampHeader: string; + + /** + * if true, include the query string in the canonical url + * + * @generated from field: bool include_query = 4; + */ + includeQuery: boolean; + + /** + * "hex" (default) or "base64" + * + * @generated from field: string encoding = 5; + */ + encoding: string; +}; /** * HmacSha256 implements a generic canonical-string HMAC-SHA256 signature. @@ -800,49 +921,48 @@ export type HmacSha256 = Message<'capabilities.networking.confidentialhttp.v1alp * @generated from message capabilities.networking.confidentialhttp.v1alpha.HmacSha256 */ export type HmacSha256Json = { - /** - * required shared secret - * - * @generated from field: string secret_name = 1; - */ - secretName?: string - - /** - * default "X-Signature" - * - * @generated from field: string signature_header = 2; - */ - signatureHeader?: string - - /** - * default "X-Timestamp" - * - * @generated from field: string timestamp_header = 3; - */ - timestampHeader?: string - - /** - * if true, include the query string in the canonical url - * - * @generated from field: bool include_query = 4; - */ - includeQuery?: boolean - - /** - * "hex" (default) or "base64" - * - * @generated from field: string encoding = 5; - */ - encoding?: string -} + /** + * required; the shared signing secret + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 1; + */ + secret?: SecretIdentifierJson; + + /** + * default "X-Signature" + * + * @generated from field: string signature_header = 2; + */ + signatureHeader?: string; + + /** + * default "X-Timestamp" + * + * @generated from field: string timestamp_header = 3; + */ + timestampHeader?: string; + + /** + * if true, include the query string in the canonical url + * + * @generated from field: bool include_query = 4; + */ + includeQuery?: boolean; + + /** + * "hex" (default) or "base64" + * + * @generated from field: string encoding = 5; + */ + encoding?: string; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.HmacSha256. * Use `create(HmacSha256Schema)` to create a new message. */ -export const HmacSha256Schema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 10) +export const HmacSha256Schema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 12); /** * AwsSigV4 implements AWS Signature Version 4. @@ -850,59 +970,58 @@ export const HmacSha256Schema: GenMessage & { - /** - * required - * - * @generated from field: string access_key_id_secret_name = 1; - */ - accessKeyIdSecretName: string - - /** - * required - * - * @generated from field: string secret_access_key_secret_name = 2; - */ - secretAccessKeySecretName: string - - /** - * optional (for STS creds) - * - * @generated from field: string session_token_secret_name = 3; - */ - sessionTokenSecretName: string - - /** - * required, e.g. "us-east-1" - * - * @generated from field: string region = 4; - */ - region: string - - /** - * required, e.g. "execute-api", "s3" - * - * @generated from field: string service = 5; - */ - service: string - - /** - * Signed headers (comma-separated lowercase). Optional; defaults to - * "host;x-amz-date" plus "x-amz-security-token" if session_token_secret_name - * is set. - * - * @generated from field: repeated string signed_headers = 6; - */ - signedHeaders: string[] - - /** - * If true, uses X-Amz-Content-Sha256: UNSIGNED-PAYLOAD (useful for large S3 - * uploads). Default false. - * - * @generated from field: bool unsigned_payload = 7; - */ - unsignedPayload: boolean -} +export type AwsSigV4 = Message<"capabilities.networking.confidentialhttp.v1alpha.AwsSigV4"> & { + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret access_key_id = 1; + */ + accessKeyId?: StringOrSecret; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret_access_key = 2; + */ + secretAccessKey?: SecretIdentifier; + + /** + * optional (for STS temporary credentials) + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier session_token = 3; + */ + sessionToken?: SecretIdentifier; + + /** + * required, e.g. "us-east-1" + * + * @generated from field: string region = 4; + */ + region: string; + + /** + * required, e.g. "execute-api", "s3" + * + * @generated from field: string service = 5; + */ + service: string; + + /** + * Signed headers (comma-separated lowercase). Optional; defaults to + * "host;x-amz-date" plus "x-amz-security-token" if session_token is set. + * + * @generated from field: repeated string signed_headers = 6; + */ + signedHeaders: string[]; + + /** + * If true, uses X-Amz-Content-Sha256: UNSIGNED-PAYLOAD (useful for large S3 + * uploads). Default false. + * + * @generated from field: bool unsigned_payload = 7; + */ + unsignedPayload: boolean; +}; /** * AwsSigV4 implements AWS Signature Version 4. @@ -911,66 +1030,64 @@ export type AwsSigV4 = Message<'capabilities.networking.confidentialhttp.v1alpha * @generated from message capabilities.networking.confidentialhttp.v1alpha.AwsSigV4 */ export type AwsSigV4Json = { - /** - * required - * - * @generated from field: string access_key_id_secret_name = 1; - */ - accessKeyIdSecretName?: string - - /** - * required - * - * @generated from field: string secret_access_key_secret_name = 2; - */ - secretAccessKeySecretName?: string - - /** - * optional (for STS creds) - * - * @generated from field: string session_token_secret_name = 3; - */ - sessionTokenSecretName?: string - - /** - * required, e.g. "us-east-1" - * - * @generated from field: string region = 4; - */ - region?: string - - /** - * required, e.g. "execute-api", "s3" - * - * @generated from field: string service = 5; - */ - service?: string - - /** - * Signed headers (comma-separated lowercase). Optional; defaults to - * "host;x-amz-date" plus "x-amz-security-token" if session_token_secret_name - * is set. - * - * @generated from field: repeated string signed_headers = 6; - */ - signedHeaders?: string[] - - /** - * If true, uses X-Amz-Content-Sha256: UNSIGNED-PAYLOAD (useful for large S3 - * uploads). Default false. - * - * @generated from field: bool unsigned_payload = 7; - */ - unsignedPayload?: boolean -} + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret access_key_id = 1; + */ + accessKeyId?: StringOrSecretJson; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret_access_key = 2; + */ + secretAccessKey?: SecretIdentifierJson; + + /** + * optional (for STS temporary credentials) + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier session_token = 3; + */ + sessionToken?: SecretIdentifierJson; + + /** + * required, e.g. "us-east-1" + * + * @generated from field: string region = 4; + */ + region?: string; + + /** + * required, e.g. "execute-api", "s3" + * + * @generated from field: string service = 5; + */ + service?: string; + + /** + * Signed headers (comma-separated lowercase). Optional; defaults to + * "host;x-amz-date" plus "x-amz-security-token" if session_token is set. + * + * @generated from field: repeated string signed_headers = 6; + */ + signedHeaders?: string[]; + + /** + * If true, uses X-Amz-Content-Sha256: UNSIGNED-PAYLOAD (useful for large S3 + * uploads). Default false. + * + * @generated from field: bool unsigned_payload = 7; + */ + unsignedPayload?: boolean; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.AwsSigV4. * Use `create(AwsSigV4Schema)` to create a new message. */ -export const AwsSigV4Schema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 11) +export const AwsSigV4Schema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 13); /** * HmacCustom lets workflow authors specify the canonical string via a @@ -980,61 +1097,61 @@ export const AwsSigV4Schema: GenMessage = * * @generated from message capabilities.networking.confidentialhttp.v1alpha.HmacCustom */ -export type HmacCustom = Message<'capabilities.networking.confidentialhttp.v1alpha.HmacCustom'> & { - /** - * required - * - * @generated from field: string secret_name = 1; - */ - secretName: string - - /** - * required - * - * @generated from field: string canonical_template = 2; - */ - canonicalTemplate: string - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash hash = 3; - */ - hash: HmacCustom_Hash - - /** - * required - * - * @generated from field: string signature_header = 4; - */ - signatureHeader: string - - /** - * e.g. "HMAC-SHA256 " - * - * @generated from field: string signature_prefix = 5; - */ - signaturePrefix: string - - /** - * optional; if set, timestamp header injected - * - * @generated from field: string timestamp_header = 6; - */ - timestampHeader: string - - /** - * optional; if set, random nonce header injected - * - * @generated from field: string nonce_header = 7; - */ - nonceHeader: string - - /** - * "hex" (default) or "base64" - * - * @generated from field: string encoding = 8; - */ - encoding: string -} +export type HmacCustom = Message<"capabilities.networking.confidentialhttp.v1alpha.HmacCustom"> & { + /** + * required; the signing secret + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 1; + */ + secret?: SecretIdentifier; + + /** + * required + * + * @generated from field: string canonical_template = 2; + */ + canonicalTemplate: string; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash hash = 3; + */ + hash: HmacCustom_Hash; + + /** + * required + * + * @generated from field: string signature_header = 4; + */ + signatureHeader: string; + + /** + * e.g. "HMAC-SHA256 " + * + * @generated from field: string signature_prefix = 5; + */ + signaturePrefix: string; + + /** + * optional; if set, timestamp header injected + * + * @generated from field: string timestamp_header = 6; + */ + timestampHeader: string; + + /** + * optional; if set, random nonce header injected + * + * @generated from field: string nonce_header = 7; + */ + nonceHeader: string; + + /** + * "hex" (default) or "base64" + * + * @generated from field: string encoding = 8; + */ + encoding: string; +}; /** * HmacCustom lets workflow authors specify the canonical string via a @@ -1045,95 +1162,93 @@ export type HmacCustom = Message<'capabilities.networking.confidentialhttp.v1alp * @generated from message capabilities.networking.confidentialhttp.v1alpha.HmacCustom */ export type HmacCustomJson = { - /** - * required - * - * @generated from field: string secret_name = 1; - */ - secretName?: string - - /** - * required - * - * @generated from field: string canonical_template = 2; - */ - canonicalTemplate?: string - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash hash = 3; - */ - hash?: HmacCustom_HashJson - - /** - * required - * - * @generated from field: string signature_header = 4; - */ - signatureHeader?: string - - /** - * e.g. "HMAC-SHA256 " - * - * @generated from field: string signature_prefix = 5; - */ - signaturePrefix?: string - - /** - * optional; if set, timestamp header injected - * - * @generated from field: string timestamp_header = 6; - */ - timestampHeader?: string - - /** - * optional; if set, random nonce header injected - * - * @generated from field: string nonce_header = 7; - */ - nonceHeader?: string - - /** - * "hex" (default) or "base64" - * - * @generated from field: string encoding = 8; - */ - encoding?: string -} + /** + * required; the signing secret + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier secret = 1; + */ + secret?: SecretIdentifierJson; + + /** + * required + * + * @generated from field: string canonical_template = 2; + */ + canonicalTemplate?: string; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash hash = 3; + */ + hash?: HmacCustom_HashJson; + + /** + * required + * + * @generated from field: string signature_header = 4; + */ + signatureHeader?: string; + + /** + * e.g. "HMAC-SHA256 " + * + * @generated from field: string signature_prefix = 5; + */ + signaturePrefix?: string; + + /** + * optional; if set, timestamp header injected + * + * @generated from field: string timestamp_header = 6; + */ + timestampHeader?: string; + + /** + * optional; if set, random nonce header injected + * + * @generated from field: string nonce_header = 7; + */ + nonceHeader?: string; + + /** + * "hex" (default) or "base64" + * + * @generated from field: string encoding = 8; + */ + encoding?: string; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.HmacCustom. * Use `create(HmacCustomSchema)` to create a new message. */ -export const HmacCustomSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 12) +export const HmacCustomSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 14); /** * @generated from enum capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash */ export enum HmacCustom_Hash { - /** - * @generated from enum value: HASH_SHA256 = 0; - */ - SHA256 = 0, - - /** - * @generated from enum value: HASH_SHA512 = 1; - */ - SHA512 = 1, + /** + * @generated from enum value: HASH_SHA256 = 0; + */ + SHA256 = 0, + + /** + * @generated from enum value: HASH_SHA512 = 1; + */ + SHA512 = 1, } /** * @generated from enum capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash */ -export type HmacCustom_HashJson = 'HASH_SHA256' | 'HASH_SHA512' +export type HmacCustom_HashJson = "HASH_SHA256" | "HASH_SHA512"; /** * Describes the enum capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash. */ -export const HmacCustom_HashSchema: GenEnum = - /*@__PURE__*/ - enumDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 12, 0) +export const HmacCustom_HashSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 14, 0); /** * OAuth2Auth groups headless OAuth 2.0 flows. @@ -1142,27 +1257,24 @@ export const HmacCustom_HashSchema: GenEnum & { - /** - * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth.variant - */ - variant: - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials client_credentials = 1; - */ - value: OAuth2ClientCredentials - case: 'clientCredentials' - } - | { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken refresh_token = 2; - */ - value: OAuth2RefreshToken - case: 'refreshToken' - } - | { case: undefined; value?: undefined } -} +export type OAuth2Auth = Message<"capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth"> & { + /** + * @generated from oneof capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth.variant + */ + variant: { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials client_credentials = 1; + */ + value: OAuth2ClientCredentials; + case: "clientCredentials"; + } | { + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken refresh_token = 2; + */ + value: OAuth2RefreshToken; + case: "refreshToken"; + } | { case: undefined; value?: undefined }; +}; /** * OAuth2Auth groups headless OAuth 2.0 flows. @@ -1172,24 +1284,23 @@ export type OAuth2Auth = Message<'capabilities.networking.confidentialhttp.v1alp * @generated from message capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth */ export type OAuth2AuthJson = { - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials client_credentials = 1; - */ - clientCredentials?: OAuth2ClientCredentialsJson - - /** - * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken refresh_token = 2; - */ - refreshToken?: OAuth2RefreshTokenJson -} + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials client_credentials = 1; + */ + clientCredentials?: OAuth2ClientCredentialsJson; + + /** + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken refresh_token = 2; + */ + refreshToken?: OAuth2RefreshTokenJson; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth. * Use `create(OAuth2AuthSchema)` to create a new message. */ -export const OAuth2AuthSchema: GenMessage = - /*@__PURE__*/ - messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 13) +export const OAuth2AuthSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 15); /** * OAuth2ClientCredentials: machine-to-machine grant. @@ -1199,58 +1310,57 @@ export const OAuth2AuthSchema: GenMessage & { - /** - * required, must be https:// - * - * @generated from field: string token_url = 1; - */ - tokenUrl: string - - /** - * required - * - * @generated from field: string client_id_secret_name = 2; - */ - clientIdSecretName: string - - /** - * required - * - * @generated from field: string client_secret_secret_name = 3; - */ - clientSecretSecretName: string - - /** - * optional - * - * @generated from field: repeated string scopes = 4; - */ - scopes: string[] - - /** - * optional (Auth0-style) - * - * @generated from field: string audience = 5; - */ - audience: string - - /** - * "basic_auth" (default) or "request_body" — where to put client creds - * on the token request. - * - * @generated from field: string client_auth_method = 6; - */ - clientAuthMethod: string - - /** - * Extra form params to send with the token request. - * - * @generated from field: map extra_params = 7; - */ - extraParams: { [key: string]: string } - } +export type OAuth2ClientCredentials = Message<"capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials"> & { + /** + * required, must be https:// + * + * @generated from field: string token_url = 1; + */ + tokenUrl: string; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret client_id = 2; + */ + clientId?: StringOrSecret; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_secret = 3; + */ + clientSecret?: SecretIdentifier; + + /** + * optional + * + * @generated from field: repeated string scopes = 4; + */ + scopes: string[]; + + /** + * optional (Auth0-style) + * + * @generated from field: string audience = 5; + */ + audience: string; + + /** + * "basic_auth" (default) or "request_body" — where to put client creds + * on the token request. + * + * @generated from field: string client_auth_method = 6; + */ + clientAuthMethod: string; + + /** + * Extra form params to send with the token request. + * + * @generated from field: map extra_params = 7; + */ + extraParams: { [key: string]: string }; +}; /** * OAuth2ClientCredentials: machine-to-machine grant. @@ -1261,65 +1371,63 @@ export type OAuth2ClientCredentials = * @generated from message capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials */ export type OAuth2ClientCredentialsJson = { - /** - * required, must be https:// - * - * @generated from field: string token_url = 1; - */ - tokenUrl?: string - - /** - * required - * - * @generated from field: string client_id_secret_name = 2; - */ - clientIdSecretName?: string - - /** - * required - * - * @generated from field: string client_secret_secret_name = 3; - */ - clientSecretSecretName?: string - - /** - * optional - * - * @generated from field: repeated string scopes = 4; - */ - scopes?: string[] - - /** - * optional (Auth0-style) - * - * @generated from field: string audience = 5; - */ - audience?: string - - /** - * "basic_auth" (default) or "request_body" — where to put client creds - * on the token request. - * - * @generated from field: string client_auth_method = 6; - */ - clientAuthMethod?: string - - /** - * Extra form params to send with the token request. - * - * @generated from field: map extra_params = 7; - */ - extraParams?: { [key: string]: string } -} + /** + * required, must be https:// + * + * @generated from field: string token_url = 1; + */ + tokenUrl?: string; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret client_id = 2; + */ + clientId?: StringOrSecretJson; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_secret = 3; + */ + clientSecret?: SecretIdentifierJson; + + /** + * optional + * + * @generated from field: repeated string scopes = 4; + */ + scopes?: string[]; + + /** + * optional (Auth0-style) + * + * @generated from field: string audience = 5; + */ + audience?: string; + + /** + * "basic_auth" (default) or "request_body" — where to put client creds + * on the token request. + * + * @generated from field: string client_auth_method = 6; + */ + clientAuthMethod?: string; + + /** + * Extra form params to send with the token request. + * + * @generated from field: map extra_params = 7; + */ + extraParams?: { [key: string]: string }; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials. * Use `create(OAuth2ClientCredentialsSchema)` to create a new message. */ -export const OAuth2ClientCredentialsSchema: GenMessage< - OAuth2ClientCredentials, - { jsonType: OAuth2ClientCredentialsJson } -> = /*@__PURE__*/ messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 14) +export const OAuth2ClientCredentialsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 16); /** * OAuth2RefreshToken: the workflow stores a long-lived refresh_token in Vault @@ -1332,48 +1440,47 @@ export const OAuth2ClientCredentialsSchema: GenMessage< * * @generated from message capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken */ -export type OAuth2RefreshToken = - Message<'capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken'> & { - /** - * required, must be https:// - * - * @generated from field: string token_url = 1; - */ - tokenUrl: string - - /** - * required - * - * @generated from field: string refresh_token_secret_name = 2; - */ - refreshTokenSecretName: string - - /** - * optional (some IdPs require) - * - * @generated from field: string client_id_secret_name = 3; - */ - clientIdSecretName: string - - /** - * optional (some IdPs require) - * - * @generated from field: string client_secret_secret_name = 4; - */ - clientSecretSecretName: string - - /** - * optional - * - * @generated from field: repeated string scopes = 5; - */ - scopes: string[] - - /** - * @generated from field: map extra_params = 6; - */ - extraParams: { [key: string]: string } - } +export type OAuth2RefreshToken = Message<"capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken"> & { + /** + * required, must be https:// + * + * @generated from field: string token_url = 1; + */ + tokenUrl: string; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier refresh_token = 2; + */ + refreshToken?: SecretIdentifier; + + /** + * optional + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret client_id = 3; + */ + clientId?: StringOrSecret; + + /** + * optional when present + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_secret = 4; + */ + clientSecret?: SecretIdentifier; + + /** + * optional + * + * @generated from field: repeated string scopes = 5; + */ + scopes: string[]; + + /** + * @generated from field: map extra_params = 6; + */ + extraParams: { [key: string]: string }; +}; /** * OAuth2RefreshToken: the workflow stores a long-lived refresh_token in Vault @@ -1387,66 +1494,66 @@ export type OAuth2RefreshToken = * @generated from message capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken */ export type OAuth2RefreshTokenJson = { - /** - * required, must be https:// - * - * @generated from field: string token_url = 1; - */ - tokenUrl?: string - - /** - * required - * - * @generated from field: string refresh_token_secret_name = 2; - */ - refreshTokenSecretName?: string - - /** - * optional (some IdPs require) - * - * @generated from field: string client_id_secret_name = 3; - */ - clientIdSecretName?: string - - /** - * optional (some IdPs require) - * - * @generated from field: string client_secret_secret_name = 4; - */ - clientSecretSecretName?: string - - /** - * optional - * - * @generated from field: repeated string scopes = 5; - */ - scopes?: string[] - - /** - * @generated from field: map extra_params = 6; - */ - extraParams?: { [key: string]: string } -} + /** + * required, must be https:// + * + * @generated from field: string token_url = 1; + */ + tokenUrl?: string; + + /** + * required + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier refresh_token = 2; + */ + refreshToken?: SecretIdentifierJson; + + /** + * optional + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.StringOrSecret client_id = 3; + */ + clientId?: StringOrSecretJson; + + /** + * optional when present + * + * @generated from field: capabilities.networking.confidentialhttp.v1alpha.SecretIdentifier client_secret = 4; + */ + clientSecret?: SecretIdentifierJson; + + /** + * optional + * + * @generated from field: repeated string scopes = 5; + */ + scopes?: string[]; + + /** + * @generated from field: map extra_params = 6; + */ + extraParams?: { [key: string]: string }; +}; /** * Describes the message capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken. * Use `create(OAuth2RefreshTokenSchema)` to create a new message. */ -export const OAuth2RefreshTokenSchema: GenMessage< - OAuth2RefreshToken, - { jsonType: OAuth2RefreshTokenJson } -> = /*@__PURE__*/ messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 15) +export const OAuth2RefreshTokenSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 17); /** * @generated from service capabilities.networking.confidentialhttp.v1alpha.Client */ export const Client: GenService<{ - /** - * @generated from rpc capabilities.networking.confidentialhttp.v1alpha.Client.SendRequest - */ - sendRequest: { - methodKind: 'unary' - input: typeof ConfidentialHTTPRequestSchema - output: typeof HTTPResponseSchema - } -}> = /*@__PURE__*/ serviceDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 0) + /** + * @generated from rpc capabilities.networking.confidentialhttp.v1alpha.Client.SendRequest + */ + sendRequest: { + methodKind: "unary"; + input: typeof ConfidentialHTTPRequestSchema; + output: typeof HTTPResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 0); + diff --git a/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts b/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts index 72ee30e..a103904 100644 --- a/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts +++ b/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts @@ -6,131 +6,130 @@ describe('buildAuthConfig', () => { const a = buildAuthConfig({ kind: 'apiKey', headerName: 'x-api-key', - secretName: 'cg', + secret: { key: 'cg' }, }) - expect(a.method.case).toBe('apiKey') - if (a.method.case !== 'apiKey') throw new Error('narrow') - expect(a.method.value.headerName).toBe('x-api-key') - expect(a.method.value.secretName).toBe('cg') - expect(a.method.value.valuePrefix).toBe('') + expect(a.apiKey?.headerName).toBe('x-api-key') + expect(a.apiKey?.secret?.key).toBe('cg') + expect(a.apiKey?.valuePrefix).toBe('') }) test('apiKey with valuePrefix', () => { const a = buildAuthConfig({ kind: 'apiKey', headerName: 'Authorization', - secretName: 'tok', + secret: { key: 'tok' }, valuePrefix: 'ApiKey ', }) - if (a.method.case !== 'apiKey') throw new Error('narrow') - expect(a.method.value.valuePrefix).toBe('ApiKey ') + expect(a.apiKey?.valuePrefix).toBe('ApiKey ') }) test('basic variant', () => { const a = buildAuthConfig({ kind: 'basic', - usernameSecretName: 'u', - passwordSecretName: 'p', + username: { key: 'u' }, + password: { key: 'p' }, }) - expect(a.method.case).toBe('basic') + expect(a.basic?.username?.secret?.key).toBe('u') + expect(a.basic?.password?.key).toBe('p') + }) + + test('basic with plain username', () => { + const a = buildAuthConfig({ + kind: 'basic', + username: 'public-user', + password: { key: 'p' }, + }) + expect(a.basic?.username?.plain).toBe('public-user') + expect(a.basic?.password?.key).toBe('p') }) test('bearer with overrides', () => { const a = buildAuthConfig({ kind: 'bearer', - tokenSecretName: 'pat', + token: { key: 'pat' }, headerName: 'Authorization', valuePrefix: 'token ', }) - if (a.method.case !== 'bearer') throw new Error('narrow') - expect(a.method.value.headerName).toBe('Authorization') - expect(a.method.value.valuePrefix).toBe('token ') + expect(a.bearer?.token?.key).toBe('pat') + expect(a.bearer?.headerName).toBe('Authorization') + expect(a.bearer?.valuePrefix).toBe('token ') }) test('hmacSha256', () => { const a = buildAuthConfig({ kind: 'hmacSha256', - secretName: 'k', + secret: { key: 'k' }, signatureHeader: 'X-Sig', encoding: 'base64', includeQuery: true, }) - if (a.method.case !== 'hmac') throw new Error('narrow method') - if (a.method.value.variant.case !== 'sha256') throw new Error('narrow variant') - expect(a.method.value.variant.value.signatureHeader).toBe('X-Sig') - expect(a.method.value.variant.value.includeQuery).toBe(true) - expect(a.method.value.variant.value.encoding).toBe('base64') + expect(a.hmac?.sha256?.signatureHeader).toBe('X-Sig') + expect(a.hmac?.sha256?.includeQuery).toBe(true) + expect(a.hmac?.sha256?.encoding).toBe('base64') }) test('awsSigV4 with all options', () => { const a = buildAuthConfig({ kind: 'awsSigV4', - accessKeyIdSecretName: 'ak', - secretAccessKeySecretName: 'sk', - sessionTokenSecretName: 'st', + accessKeyId: { key: 'ak' }, + secretAccessKey: { key: 'sk' }, + sessionToken: { key: 'st' }, region: 'us-east-1', service: 's3', signedHeaders: ['host', 'x-amz-date'], unsignedPayload: true, }) - if (a.method.case !== 'hmac') throw new Error('narrow method') - if (a.method.value.variant.case !== 'awsSigV4') throw new Error('narrow variant') - const v = a.method.value.variant.value - expect(v.sessionTokenSecretName).toBe('st') - expect(v.signedHeaders.length).toBe(2) - expect(v.unsignedPayload).toBe(true) + const v = a.hmac?.awsSigV4 + expect(v?.accessKeyId?.secret?.key).toBe('ak') + expect(v?.secretAccessKey?.key).toBe('sk') + expect(v?.sessionToken?.key).toBe('st') + expect(v?.signedHeaders?.length).toBe(2) + expect(v?.unsignedPayload).toBe(true) }) test('hmacCustom sha512', () => { const a = buildAuthConfig({ kind: 'hmacCustom', - secretName: 'k', + secret: { key: 'k' }, canonicalTemplate: '{{.method}}', hash: 'sha512', signatureHeader: 'X-Sig', signaturePrefix: 'HMAC-SHA512 ', }) - if (a.method.case !== 'hmac') throw new Error('narrow method') - if (a.method.value.variant.case !== 'custom') throw new Error('narrow variant') - // SHA512 enum value = 1 per generated enum. - expect(a.method.value.variant.value.hash).toBe(1) - expect(a.method.value.variant.value.signaturePrefix).toBe('HMAC-SHA512 ') + expect(a.hmac?.custom?.hash).toBe('HASH_SHA512') + expect(a.hmac?.custom?.signaturePrefix).toBe('HMAC-SHA512 ') }) test('oauth2 clientCredentials', () => { const a = buildAuthConfig({ kind: 'oauth2ClientCredentials', tokenUrl: 'https://idp/token', - clientIdSecretName: 'cid', - clientSecretSecretName: 'csec', + clientId: { key: 'cid' }, + clientSecret: { key: 'csec' }, scopes: ['read', 'write'], audience: 'aud', clientAuthMethod: 'requestBody', extraParams: { foo: 'bar' }, }) - if (a.method.case !== 'oauth2') throw new Error('narrow method') - if (a.method.value.variant.case !== 'clientCredentials') throw new Error('narrow variant') - const v = a.method.value.variant.value - expect(v.tokenUrl).toBe('https://idp/token') - expect(v.scopes).toEqual(['read', 'write']) - expect(v.clientAuthMethod).toBe('request_body') - expect(v.extraParams.foo).toBe('bar') + const v = a.oauth2?.clientCredentials + expect(v?.tokenUrl).toBe('https://idp/token') + expect(v?.scopes).toEqual(['read', 'write']) + expect(v?.clientAuthMethod).toBe('request_body') + expect(v?.extraParams?.foo).toBe('bar') }) test('oauth2 refreshToken', () => { const a = buildAuthConfig({ kind: 'oauth2RefreshToken', tokenUrl: 'https://idp/token', - refreshTokenSecretName: 'rt', - clientIdSecretName: 'cid', - clientSecretSecretName: 'csec', + refreshToken: { key: 'rt' }, + clientId: { key: 'cid' }, + clientSecret: { key: 'csec' }, scopes: ['read'], }) - if (a.method.case !== 'oauth2') throw new Error('narrow method') - if (a.method.value.variant.case !== 'refreshToken') throw new Error('narrow variant') - const v = a.method.value.variant.value - expect(v.refreshTokenSecretName).toBe('rt') - expect(v.clientIdSecretName).toBe('cid') - expect(v.clientSecretSecretName).toBe('csec') + const v = a.oauth2?.refreshToken + expect(v?.refreshToken?.key).toBe('rt') + expect(v?.clientId?.secret?.key).toBe('cid') + expect(v?.clientSecret?.key).toBe('csec') }) }) diff --git a/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts b/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts index 3c37019..3b22a9b 100644 --- a/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts +++ b/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts @@ -1,36 +1,44 @@ -/** - * Ergonomic helpers for the confidentialHTTP capability's AuthConfig. - * - * The generated SDK at `@cre/generated-sdk/.../confidentialhttp/.../client_sdk_gen.ts` - * accepts a raw `ConfidentialHTTPRequest` / `ConfidentialHTTPRequestJson`. - * Building the AuthConfig oneof variants by hand is verbose; these helpers - * let workflow authors describe the signing method via a discriminated union - * and produce the matching proto structure. - * - * All secret references are by string key; every name used inside an - * `AuthConfigInput` must also appear in `vaultDonSecrets` (the capability - * validator enforces this). - */ +// Ergonomic helpers for the confidentialHTTP capability's AuthConfig. +// +// Building the AuthConfig oneof variants by hand is verbose; these helpers +// let workflow authors describe the signing method via a discriminated union +// and produce the matching proto-JSON structure that fits straight into a +// ConfidentialHTTPRequestJson.auth field. +// +// Every SecretIdentifier referenced inside an AuthConfigInput must also +// appear in vaultDonSecrets (the capability validator enforces this). -import { - type ApiKeyAuth, - type AuthConfig, - type AwsSigV4, - type BasicAuth, - type BearerAuth, - HmacCustom_Hash, - type HmacAuth, - type HmacCustom, - type HmacSha256, - type OAuth2Auth, - type OAuth2ClientCredentials, - type OAuth2RefreshToken, +import type { + ApiKeyAuthJson, + AuthConfigJson, + AwsSigV4Json, + BasicAuthJson, + BearerAuthJson, + HmacAuthJson, + HmacCustomJson, + HmacSha256Json, + MtlsAuthJson, + OAuth2AuthJson, + OAuth2ClientCredentialsJson, + OAuth2RefreshTokenJson, + SecretIdentifierJson, + StringOrSecretJson, } from '@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb' // ----------------------------------------------------------------------------- -// Discriminated union — the ergonomic input type for workflow authors. +// Input types // ----------------------------------------------------------------------------- +/** A reference to a Vault DON secret. */ +export type SecretRef = { + key: string + namespace?: string + owner?: string +} + +/** A field that may carry either a plain string or a Vault secret. */ +export type StringOrSecretInput = string | SecretRef + export type AuthConfigInput = | ApiKeyAuthInput | BasicAuthInput @@ -41,25 +49,35 @@ export type AuthConfigInput = | OAuth2ClientCredentialsInput | OAuth2RefreshTokenInput +/** Mutual TLS config for transport-level client authentication. */ +export type MtlsInput = { + /** Vault secret key for the PEM-encoded client certificate. */ + clientCert: SecretRef + /** Vault secret key for the PEM-encoded client private key. */ + clientKey: SecretRef + /** Optional Vault secret key for a PEM-encoded CA bundle (server verification). */ + caCert?: SecretRef +} + export type ApiKeyAuthInput = { kind: 'apiKey' /** Header name, e.g. "x-api-key" or "Authorization". */ headerName: string - /** Name of a secret declared in vaultDonSecrets. */ - secretName: string + /** Vault secret carrying the API key value. */ + secret: SecretRef /** Optional prefix, e.g. "ApiKey " or "Token ". Default: empty. */ valuePrefix?: string } export type BasicAuthInput = { kind: 'basic' - usernameSecretName: string - passwordSecretName: string + username: StringOrSecretInput + password: SecretRef } export type BearerAuthInput = { kind: 'bearer' - tokenSecretName: string + token: SecretRef /** Default "Authorization". */ headerName?: string /** Default "Bearer ". */ @@ -68,7 +86,7 @@ export type BearerAuthInput = { export type HmacSha256Input = { kind: 'hmacSha256' - secretName: string + secret: SecretRef /** Default "X-Signature". */ signatureHeader?: string /** Default "X-Timestamp". */ @@ -80,25 +98,20 @@ export type HmacSha256Input = { export type AwsSigV4Input = { kind: 'awsSigV4' - accessKeyIdSecretName: string - secretAccessKeySecretName: string - /** Optional STS session token. */ - sessionTokenSecretName?: string + accessKeyId: StringOrSecretInput + secretAccessKey: SecretRef + sessionToken?: SecretRef region: string service: string - /** Override the set of signed headers. */ signedHeaders?: string[] - /** S3 streaming uploads — advertise UNSIGNED-PAYLOAD. */ unsignedPayload?: boolean } export type HmacCustomInput = { kind: 'hmacCustom' - secretName: string - /** Go text/template canonical string. See docs for available vars. */ + secret: SecretRef canonicalTemplate: string hash: 'sha256' | 'sha512' - /** "hex" (default) or "base64". */ encoding?: 'hex' | 'base64' signatureHeader: string signaturePrefix?: string @@ -108,13 +121,11 @@ export type HmacCustomInput = { export type OAuth2ClientCredentialsInput = { kind: 'oauth2ClientCredentials' - /** Must be https://. */ tokenUrl: string - clientIdSecretName: string - clientSecretSecretName: string + clientId: StringOrSecretInput + clientSecret: SecretRef scopes?: string[] audience?: string - /** How to send client creds to the token endpoint. Default 'basicAuth'. */ clientAuthMethod?: 'basicAuth' | 'requestBody' extraParams?: Record } @@ -122,186 +133,180 @@ export type OAuth2ClientCredentialsInput = { export type OAuth2RefreshTokenInput = { kind: 'oauth2RefreshToken' tokenUrl: string - refreshTokenSecretName: string - clientIdSecretName?: string - clientSecretSecretName?: string + refreshToken: SecretRef + clientId?: StringOrSecretInput + clientSecret?: SecretRef scopes?: string[] extraParams?: Record } // ----------------------------------------------------------------------------- -// buildAuthConfig — factory that converts the union into an AuthConfig proto. +// Conversion helpers +// ----------------------------------------------------------------------------- + +function toSecretIdentifierJson(ref: SecretRef): SecretIdentifierJson { + const out: SecretIdentifierJson = { key: ref.key } + if (ref.namespace !== undefined) out.namespace = ref.namespace + if (ref.owner !== undefined) out.owner = ref.owner + return out +} + +function toStringOrSecretJson(value: StringOrSecretInput): StringOrSecretJson { + if (typeof value === 'string') { + return { plain: value } + } + return { secret: toSecretIdentifierJson(value) } +} + +// ----------------------------------------------------------------------------- +// buildAuthConfig — factory that converts the union into an AuthConfigJson. // ----------------------------------------------------------------------------- /** - * Convert a workflow-author-friendly AuthConfigInput into the proto - * AuthConfig expected by the ConfidentialHTTPRequest. + * Convert a workflow-author-friendly AuthConfigInput into the proto-JSON + * AuthConfig expected by `ConfidentialHTTPRequestJson.auth`. * * @example * const auth = buildAuthConfig({ * kind: 'apiKey', * headerName: 'x-api-key', - * secretName: 'coingecko_api_key', + * secret: { key: 'coingecko_api_key' }, * }) + * client.sendRequest(runtime, { request, vaultDonSecrets, auth }) */ -export function buildAuthConfig(input: AuthConfigInput): AuthConfig { +export function buildAuthConfig(input: AuthConfigInput): AuthConfigJson { switch (input.kind) { case 'apiKey': - return authFromApiKey(input) + return { apiKey: apiKeyJson(input) } case 'basic': - return authFromBasic(input) + return { basic: basicJson(input) } case 'bearer': - return authFromBearer(input) + return { bearer: bearerJson(input) } case 'hmacSha256': - return authFromHmacSha256(input) + return { hmac: { sha256: hmacSha256Json(input) } satisfies HmacAuthJson } case 'awsSigV4': - return authFromAwsSigV4(input) + return { hmac: { awsSigV4: awsSigV4Json(input) } satisfies HmacAuthJson } case 'hmacCustom': - return authFromHmacCustom(input) + return { hmac: { custom: hmacCustomJson(input) } satisfies HmacAuthJson } case 'oauth2ClientCredentials': - return authFromOAuth2ClientCredentials(input) + return { + oauth2: { clientCredentials: oauth2ClientCredentialsJson(input) } satisfies OAuth2AuthJson, + } case 'oauth2RefreshToken': - return authFromOAuth2RefreshToken(input) + return { oauth2: { refreshToken: oauth2RefreshTokenJson(input) } satisfies OAuth2AuthJson } } } -function authFromApiKey(i: ApiKeyAuthInput): AuthConfig { - const a: ApiKeyAuth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth', +function apiKeyJson(i: ApiKeyAuthInput): ApiKeyAuthJson { + return { headerName: i.headerName, - secretName: i.secretName, + secret: toSecretIdentifierJson(i.secret), valuePrefix: i.valuePrefix ?? '', } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'apiKey', value: a }, - } } -function authFromBasic(i: BasicAuthInput): AuthConfig { - const a: BasicAuth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.BasicAuth', - usernameSecretName: i.usernameSecretName, - passwordSecretName: i.passwordSecretName, - } +function basicJson(i: BasicAuthInput): BasicAuthJson { return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'basic', value: a }, + username: toStringOrSecretJson(i.username), + password: toSecretIdentifierJson(i.password), } } -function authFromBearer(i: BearerAuthInput): AuthConfig { - const a: BearerAuth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.BearerAuth', - tokenSecretName: i.tokenSecretName, +function bearerJson(i: BearerAuthInput): BearerAuthJson { + return { + token: toSecretIdentifierJson(i.token), headerName: i.headerName ?? '', valuePrefix: i.valuePrefix ?? '', } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'bearer', value: a }, - } } -function authFromHmacSha256(i: HmacSha256Input): AuthConfig { - const v: HmacSha256 = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.HmacSha256', - secretName: i.secretName, +function hmacSha256Json(i: HmacSha256Input): HmacSha256Json { + return { + secret: toSecretIdentifierJson(i.secret), signatureHeader: i.signatureHeader ?? '', timestampHeader: i.timestampHeader ?? '', includeQuery: i.includeQuery ?? false, encoding: i.encoding ?? '', } - const hmac: HmacAuth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.HmacAuth', - variant: { case: 'sha256', value: v }, - } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'hmac', value: hmac }, - } } -function authFromAwsSigV4(i: AwsSigV4Input): AuthConfig { - const v: AwsSigV4 = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AwsSigV4', - accessKeyIdSecretName: i.accessKeyIdSecretName, - secretAccessKeySecretName: i.secretAccessKeySecretName, - sessionTokenSecretName: i.sessionTokenSecretName ?? '', +function awsSigV4Json(i: AwsSigV4Input): AwsSigV4Json { + const out: AwsSigV4Json = { + accessKeyId: toStringOrSecretJson(i.accessKeyId), + secretAccessKey: toSecretIdentifierJson(i.secretAccessKey), region: i.region, service: i.service, signedHeaders: i.signedHeaders ?? [], unsignedPayload: i.unsignedPayload ?? false, } - const hmac: HmacAuth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.HmacAuth', - variant: { case: 'awsSigV4', value: v }, - } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'hmac', value: hmac }, - } + if (i.sessionToken) out.sessionToken = toSecretIdentifierJson(i.sessionToken) + return out } -function authFromHmacCustom(i: HmacCustomInput): AuthConfig { - const v: HmacCustom = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.HmacCustom', - secretName: i.secretName, +function hmacCustomJson(i: HmacCustomInput): HmacCustomJson { + return { + secret: toSecretIdentifierJson(i.secret), canonicalTemplate: i.canonicalTemplate, - hash: i.hash === 'sha512' ? HmacCustom_Hash.SHA512 : HmacCustom_Hash.SHA256, + hash: i.hash === 'sha512' ? 'HASH_SHA512' : 'HASH_SHA256', encoding: i.encoding ?? '', signatureHeader: i.signatureHeader, signaturePrefix: i.signaturePrefix ?? '', timestampHeader: i.timestampHeader ?? '', nonceHeader: i.nonceHeader ?? '', } - const hmac: HmacAuth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.HmacAuth', - variant: { case: 'custom', value: v }, - } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'hmac', value: hmac }, - } } -function authFromOAuth2ClientCredentials(i: OAuth2ClientCredentialsInput): AuthConfig { - const v: OAuth2ClientCredentials = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials', +function oauth2ClientCredentialsJson( + i: OAuth2ClientCredentialsInput, +): OAuth2ClientCredentialsJson { + return { tokenUrl: i.tokenUrl, - clientIdSecretName: i.clientIdSecretName, - clientSecretSecretName: i.clientSecretSecretName, + clientId: toStringOrSecretJson(i.clientId), + clientSecret: toSecretIdentifierJson(i.clientSecret), scopes: i.scopes ?? [], audience: i.audience ?? '', - clientAuthMethod: i.clientAuthMethod === 'requestBody' ? 'request_body' : i.clientAuthMethod === 'basicAuth' ? 'basic_auth' : '', + clientAuthMethod: + i.clientAuthMethod === 'requestBody' + ? 'request_body' + : i.clientAuthMethod === 'basicAuth' + ? 'basic_auth' + : '', extraParams: i.extraParams ?? {}, } - const oauth: OAuth2Auth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth', - variant: { case: 'clientCredentials', value: v }, - } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'oauth2', value: oauth }, - } } -function authFromOAuth2RefreshToken(i: OAuth2RefreshTokenInput): AuthConfig { - const v: OAuth2RefreshToken = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.OAuth2RefreshToken', +function oauth2RefreshTokenJson(i: OAuth2RefreshTokenInput): OAuth2RefreshTokenJson { + const out: OAuth2RefreshTokenJson = { tokenUrl: i.tokenUrl, - refreshTokenSecretName: i.refreshTokenSecretName, - clientIdSecretName: i.clientIdSecretName ?? '', - clientSecretSecretName: i.clientSecretSecretName ?? '', + refreshToken: toSecretIdentifierJson(i.refreshToken), scopes: i.scopes ?? [], extraParams: i.extraParams ?? {}, } - const oauth: OAuth2Auth = { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth', - variant: { case: 'refreshToken', value: v }, + if (i.clientId !== undefined) out.clientId = toStringOrSecretJson(i.clientId) + if (i.clientSecret !== undefined) out.clientSecret = toSecretIdentifierJson(i.clientSecret) + return out +} + +/** + * Convert a MtlsInput into the proto-JSON MtlsAuth expected by + * `HTTPRequestJson.mtls`. The returned object should be set on + * `request.mtls` (the inner HTTPRequest, not ConfidentialHTTPRequest). + * All referenced secrets must appear in `vaultDonSecrets`. + * + * @example + * const mtls = buildMtlsConfig({ + * clientCert: { key: 'my-cert', namespace: 'my-ns' }, + * clientKey: { key: 'my-key', namespace: 'my-ns' }, + * }) + * client.sendRequest(runtime, { request: { ...req, mtls }, vaultDonSecrets }) + */ +export function buildMtlsConfig(input: MtlsInput): MtlsAuthJson { + const out: MtlsAuthJson = { + clientCert: toSecretIdentifierJson(input.clientCert), + clientKey: toSecretIdentifierJson(input.clientKey), } - return { - $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', - method: { case: 'oauth2', value: oauth }, + if (input.caCert !== undefined) { + out.caCert = toSecretIdentifierJson(input.caCert) } + return out } diff --git a/packages/cre-sdk/src/sdk/cre/index.ts b/packages/cre-sdk/src/sdk/cre/index.ts index 27165a5..d863c35 100644 --- a/packages/cre-sdk/src/sdk/cre/index.ts +++ b/packages/cre-sdk/src/sdk/cre/index.ts @@ -39,7 +39,9 @@ export { type HmacCustomInput, type OAuth2ClientCredentialsInput, type OAuth2RefreshTokenInput, + type MtlsInput, buildAuthConfig, + buildMtlsConfig, } from '@cre/sdk/cre/confidentialhttp' // HTTP Capability export { diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/blockchain/evm/v1alpha/evm_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/blockchain/evm/v1alpha/evm_mock_gen.ts index 0352db7..da5b3d9 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/blockchain/evm/v1alpha/evm_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/blockchain/evm/v1alpha/evm_mock_gen.ts @@ -1,130 +1,252 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type BalanceAtReply, type BalanceAtReplyJson, BalanceAtReplySchema, type BalanceAtRequest, BalanceAtRequestSchema, type CallContractReply, type CallContractReplyJson, CallContractReplySchema, type CallContractRequest, CallContractRequestSchema, type EstimateGasReply, type EstimateGasReplyJson, EstimateGasReplySchema, type EstimateGasRequest, EstimateGasRequestSchema, type FilterLogsReply, type FilterLogsReplyJson, FilterLogsReplySchema, type FilterLogsRequest, FilterLogsRequestSchema, type GetTransactionByHashReply, type GetTransactionByHashReplyJson, GetTransactionByHashReplySchema, type GetTransactionByHashRequest, GetTransactionByHashRequestSchema, type GetTransactionReceiptReply, type GetTransactionReceiptReplyJson, GetTransactionReceiptReplySchema, type GetTransactionReceiptRequest, GetTransactionReceiptRequestSchema, type HeaderByNumberReply, type HeaderByNumberReplyJson, HeaderByNumberReplySchema, type HeaderByNumberRequest, HeaderByNumberRequestSchema, type WriteReportReply, type WriteReportReplyJson, WriteReportReplySchema, type WriteReportRequest, WriteReportRequestSchema } from "@cre/generated/capabilities/blockchain/evm/v1alpha/client_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type BalanceAtReply, + type BalanceAtReplyJson, + BalanceAtReplySchema, + type BalanceAtRequest, + BalanceAtRequestSchema, + type CallContractReply, + type CallContractReplyJson, + CallContractReplySchema, + type CallContractRequest, + CallContractRequestSchema, + type EstimateGasReply, + type EstimateGasReplyJson, + EstimateGasReplySchema, + type EstimateGasRequest, + EstimateGasRequestSchema, + type FilterLogsReply, + type FilterLogsReplyJson, + FilterLogsReplySchema, + type FilterLogsRequest, + FilterLogsRequestSchema, + type GetTransactionByHashReply, + type GetTransactionByHashReplyJson, + GetTransactionByHashReplySchema, + type GetTransactionByHashRequest, + GetTransactionByHashRequestSchema, + type GetTransactionReceiptReply, + type GetTransactionReceiptReplyJson, + GetTransactionReceiptReplySchema, + type GetTransactionReceiptRequest, + GetTransactionReceiptRequestSchema, + type HeaderByNumberReply, + type HeaderByNumberReplyJson, + HeaderByNumberReplySchema, + type HeaderByNumberRequest, + HeaderByNumberRequestSchema, + type WriteReportReply, + type WriteReportReplyJson, + WriteReportReplySchema, + type WriteReportRequest, + WriteReportRequestSchema, +} from '@cre/generated/capabilities/blockchain/evm/v1alpha/client_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for ClientCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class EvmMock { - static readonly CAPABILITY_ID = "evm@1.0.0"; + static readonly CAPABILITY_ID = 'evm@1.0.0' - /** Set to define the return value for CallContract. May return a plain object (CallContractReplyJson) or the message type. */ - callContract?: (input: CallContractRequest) => CallContractReply | CallContractReplyJson; + /** Set to define the return value for CallContract. May return a plain object (CallContractReplyJson) or the message type. */ + callContract?: (input: CallContractRequest) => CallContractReply | CallContractReplyJson - /** Set to define the return value for FilterLogs. May return a plain object (FilterLogsReplyJson) or the message type. */ - filterLogs?: (input: FilterLogsRequest) => FilterLogsReply | FilterLogsReplyJson; + /** Set to define the return value for FilterLogs. May return a plain object (FilterLogsReplyJson) or the message type. */ + filterLogs?: (input: FilterLogsRequest) => FilterLogsReply | FilterLogsReplyJson - /** Set to define the return value for BalanceAt. May return a plain object (BalanceAtReplyJson) or the message type. */ - balanceAt?: (input: BalanceAtRequest) => BalanceAtReply | BalanceAtReplyJson; + /** Set to define the return value for BalanceAt. May return a plain object (BalanceAtReplyJson) or the message type. */ + balanceAt?: (input: BalanceAtRequest) => BalanceAtReply | BalanceAtReplyJson - /** Set to define the return value for EstimateGas. May return a plain object (EstimateGasReplyJson) or the message type. */ - estimateGas?: (input: EstimateGasRequest) => EstimateGasReply | EstimateGasReplyJson; + /** Set to define the return value for EstimateGas. May return a plain object (EstimateGasReplyJson) or the message type. */ + estimateGas?: (input: EstimateGasRequest) => EstimateGasReply | EstimateGasReplyJson - /** Set to define the return value for GetTransactionByHash. May return a plain object (GetTransactionByHashReplyJson) or the message type. */ - getTransactionByHash?: (input: GetTransactionByHashRequest) => GetTransactionByHashReply | GetTransactionByHashReplyJson; + /** Set to define the return value for GetTransactionByHash. May return a plain object (GetTransactionByHashReplyJson) or the message type. */ + getTransactionByHash?: ( + input: GetTransactionByHashRequest, + ) => GetTransactionByHashReply | GetTransactionByHashReplyJson - /** Set to define the return value for GetTransactionReceipt. May return a plain object (GetTransactionReceiptReplyJson) or the message type. */ - getTransactionReceipt?: (input: GetTransactionReceiptRequest) => GetTransactionReceiptReply | GetTransactionReceiptReplyJson; + /** Set to define the return value for GetTransactionReceipt. May return a plain object (GetTransactionReceiptReplyJson) or the message type. */ + getTransactionReceipt?: ( + input: GetTransactionReceiptRequest, + ) => GetTransactionReceiptReply | GetTransactionReceiptReplyJson - /** Set to define the return value for HeaderByNumber. May return a plain object (HeaderByNumberReplyJson) or the message type. */ - headerByNumber?: (input: HeaderByNumberRequest) => HeaderByNumberReply | HeaderByNumberReplyJson; + /** Set to define the return value for HeaderByNumber. May return a plain object (HeaderByNumberReplyJson) or the message type. */ + headerByNumber?: (input: HeaderByNumberRequest) => HeaderByNumberReply | HeaderByNumberReplyJson - /** Set to define the return value for WriteReport. May return a plain object (WriteReportReplyJson) or the message type. */ - writeReport?: (input: WriteReportRequest) => WriteReportReply | WriteReportReplyJson; + /** Set to define the return value for WriteReport. May return a plain object (WriteReportReplyJson) or the message type. */ + writeReport?: (input: WriteReportRequest) => WriteReportReply | WriteReportReplyJson - private constructor(chainSelector: bigint) { - const self = this; - const qualifiedId = `evm:ChainSelector:${chainSelector}@1.0.0`; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "CallContract": { - const input = anyUnpack(req.payload, CallContractRequestSchema) as CallContractRequest; - const handler = self.callContract; - if (typeof handler !== "function") throw new Error("CallContract: no implementation provided; set the mock's callContract property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as CallContractReply) : fromJson(CallContractReplySchema, raw as CallContractReplyJson); - return { response: { case: "payload", value: anyPack(CallContractReplySchema, output) } }; - } - case "FilterLogs": { - const input = anyUnpack(req.payload, FilterLogsRequestSchema) as FilterLogsRequest; - const handler = self.filterLogs; - if (typeof handler !== "function") throw new Error("FilterLogs: no implementation provided; set the mock's filterLogs property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as FilterLogsReply) : fromJson(FilterLogsReplySchema, raw as FilterLogsReplyJson); - return { response: { case: "payload", value: anyPack(FilterLogsReplySchema, output) } }; - } - case "BalanceAt": { - const input = anyUnpack(req.payload, BalanceAtRequestSchema) as BalanceAtRequest; - const handler = self.balanceAt; - if (typeof handler !== "function") throw new Error("BalanceAt: no implementation provided; set the mock's balanceAt property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as BalanceAtReply) : fromJson(BalanceAtReplySchema, raw as BalanceAtReplyJson); - return { response: { case: "payload", value: anyPack(BalanceAtReplySchema, output) } }; - } - case "EstimateGas": { - const input = anyUnpack(req.payload, EstimateGasRequestSchema) as EstimateGasRequest; - const handler = self.estimateGas; - if (typeof handler !== "function") throw new Error("EstimateGas: no implementation provided; set the mock's estimateGas property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as EstimateGasReply) : fromJson(EstimateGasReplySchema, raw as EstimateGasReplyJson); - return { response: { case: "payload", value: anyPack(EstimateGasReplySchema, output) } }; - } - case "GetTransactionByHash": { - const input = anyUnpack(req.payload, GetTransactionByHashRequestSchema) as GetTransactionByHashRequest; - const handler = self.getTransactionByHash; - if (typeof handler !== "function") throw new Error("GetTransactionByHash: no implementation provided; set the mock's getTransactionByHash property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as GetTransactionByHashReply) : fromJson(GetTransactionByHashReplySchema, raw as GetTransactionByHashReplyJson); - return { response: { case: "payload", value: anyPack(GetTransactionByHashReplySchema, output) } }; - } - case "GetTransactionReceipt": { - const input = anyUnpack(req.payload, GetTransactionReceiptRequestSchema) as GetTransactionReceiptRequest; - const handler = self.getTransactionReceipt; - if (typeof handler !== "function") throw new Error("GetTransactionReceipt: no implementation provided; set the mock's getTransactionReceipt property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as GetTransactionReceiptReply) : fromJson(GetTransactionReceiptReplySchema, raw as GetTransactionReceiptReplyJson); - return { response: { case: "payload", value: anyPack(GetTransactionReceiptReplySchema, output) } }; - } - case "HeaderByNumber": { - const input = anyUnpack(req.payload, HeaderByNumberRequestSchema) as HeaderByNumberRequest; - const handler = self.headerByNumber; - if (typeof handler !== "function") throw new Error("HeaderByNumber: no implementation provided; set the mock's headerByNumber property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as HeaderByNumberReply) : fromJson(HeaderByNumberReplySchema, raw as HeaderByNumberReplyJson); - return { response: { case: "payload", value: anyPack(HeaderByNumberReplySchema, output) } }; - } - case "WriteReport": { - const input = anyUnpack(req.payload, WriteReportRequestSchema) as WriteReportRequest; - const handler = self.writeReport; - if (typeof handler !== "function") throw new Error("WriteReport: no implementation provided; set the mock's writeReport property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as WriteReportReply) : fromJson(WriteReportReplySchema, raw as WriteReportReplyJson); - return { response: { case: "payload", value: anyPack(WriteReportReplySchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor(chainSelector: bigint) { + const self = this + const qualifiedId = `evm:ChainSelector:${chainSelector}@1.0.0` + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'CallContract': { + const input = anyUnpack(req.payload, CallContractRequestSchema) as CallContractRequest + const handler = self.callContract + if (typeof handler !== 'function') + throw new Error( + "CallContract: no implementation provided; set the mock's callContract property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as CallContractReply) + : fromJson(CallContractReplySchema, raw as CallContractReplyJson) + return { + response: { case: 'payload', value: anyPack(CallContractReplySchema, output) }, + } + } + case 'FilterLogs': { + const input = anyUnpack(req.payload, FilterLogsRequestSchema) as FilterLogsRequest + const handler = self.filterLogs + if (typeof handler !== 'function') + throw new Error( + "FilterLogs: no implementation provided; set the mock's filterLogs property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as FilterLogsReply) + : fromJson(FilterLogsReplySchema, raw as FilterLogsReplyJson) + return { response: { case: 'payload', value: anyPack(FilterLogsReplySchema, output) } } + } + case 'BalanceAt': { + const input = anyUnpack(req.payload, BalanceAtRequestSchema) as BalanceAtRequest + const handler = self.balanceAt + if (typeof handler !== 'function') + throw new Error( + "BalanceAt: no implementation provided; set the mock's balanceAt property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as BalanceAtReply) + : fromJson(BalanceAtReplySchema, raw as BalanceAtReplyJson) + return { response: { case: 'payload', value: anyPack(BalanceAtReplySchema, output) } } + } + case 'EstimateGas': { + const input = anyUnpack(req.payload, EstimateGasRequestSchema) as EstimateGasRequest + const handler = self.estimateGas + if (typeof handler !== 'function') + throw new Error( + "EstimateGas: no implementation provided; set the mock's estimateGas property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as EstimateGasReply) + : fromJson(EstimateGasReplySchema, raw as EstimateGasReplyJson) + return { response: { case: 'payload', value: anyPack(EstimateGasReplySchema, output) } } + } + case 'GetTransactionByHash': { + const input = anyUnpack( + req.payload, + GetTransactionByHashRequestSchema, + ) as GetTransactionByHashRequest + const handler = self.getTransactionByHash + if (typeof handler !== 'function') + throw new Error( + "GetTransactionByHash: no implementation provided; set the mock's getTransactionByHash property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as GetTransactionByHashReply) + : fromJson(GetTransactionByHashReplySchema, raw as GetTransactionByHashReplyJson) + return { + response: { + case: 'payload', + value: anyPack(GetTransactionByHashReplySchema, output), + }, + } + } + case 'GetTransactionReceipt': { + const input = anyUnpack( + req.payload, + GetTransactionReceiptRequestSchema, + ) as GetTransactionReceiptRequest + const handler = self.getTransactionReceipt + if (typeof handler !== 'function') + throw new Error( + "GetTransactionReceipt: no implementation provided; set the mock's getTransactionReceipt property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as GetTransactionReceiptReply) + : fromJson(GetTransactionReceiptReplySchema, raw as GetTransactionReceiptReplyJson) + return { + response: { + case: 'payload', + value: anyPack(GetTransactionReceiptReplySchema, output), + }, + } + } + case 'HeaderByNumber': { + const input = anyUnpack( + req.payload, + HeaderByNumberRequestSchema, + ) as HeaderByNumberRequest + const handler = self.headerByNumber + if (typeof handler !== 'function') + throw new Error( + "HeaderByNumber: no implementation provided; set the mock's headerByNumber property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as HeaderByNumberReply) + : fromJson(HeaderByNumberReplySchema, raw as HeaderByNumberReplyJson) + return { + response: { case: 'payload', value: anyPack(HeaderByNumberReplySchema, output) }, + } + } + case 'WriteReport': { + const input = anyUnpack(req.payload, WriteReportRequestSchema) as WriteReportRequest + const handler = self.writeReport + if (typeof handler !== 'function') + throw new Error( + "WriteReport: no implementation provided; set the mock's writeReport property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as WriteReportReply) + : fromJson(WriteReportReplySchema, raw as WriteReportReplyJson) + return { response: { case: 'payload', value: anyPack(WriteReportReplySchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability and the specified tags. - * Multiple calls with the same tag values return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(chainSelector: bigint): EvmMock { - const qualifiedId = `evm:ChainSelector:${chainSelector}@1.0.0`; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new EvmMock(chainSelector); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability and the specified tags. + * Multiple calls with the same tag values return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(chainSelector: bigint): EvmMock { + const qualifiedId = `evm:ChainSelector:${chainSelector}@1.0.0` + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new EvmMock(chainSelector) + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/actionandtrigger/v1/basic_test_action_trigger_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/actionandtrigger/v1/basic_test_action_trigger_mock_gen.ts index 064e222..8fcc3d3 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/actionandtrigger/v1/basic_test_action_trigger_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/actionandtrigger/v1/basic_test_action_trigger_mock_gen.ts @@ -1,53 +1,71 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type Input, InputSchema, type Output, type OutputJson, OutputSchema } from "@cre/generated/capabilities/internal/actionandtrigger/v1/action_and_trigger_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type Input, + InputSchema, + type Output, + type OutputJson, + OutputSchema, +} from '@cre/generated/capabilities/internal/actionandtrigger/v1/action_and_trigger_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for BasicCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class BasicTestActionTriggerMock { - static readonly CAPABILITY_ID = "basic-test-action-trigger@1.0.0"; + static readonly CAPABILITY_ID = 'basic-test-action-trigger@1.0.0' - /** Set to define the return value for Action. May return a plain object (OutputJson) or the message type. */ - action?: (input: Input) => Output | OutputJson; + /** Set to define the return value for Action. May return a plain object (OutputJson) or the message type. */ + action?: (input: Input) => Output | OutputJson - private constructor() { - const self = this; - const qualifiedId = BasicTestActionTriggerMock.CAPABILITY_ID; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "Action": { - const input = anyUnpack(req.payload, InputSchema) as Input; - const handler = self.action; - if (typeof handler !== "function") throw new Error("Action: no implementation provided; set the mock's action property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as Output) : fromJson(OutputSchema, raw as OutputJson); - return { response: { case: "payload", value: anyPack(OutputSchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor() { + const self = this + const qualifiedId = BasicTestActionTriggerMock.CAPABILITY_ID + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'Action': { + const input = anyUnpack(req.payload, InputSchema) as Input + const handler = self.action + if (typeof handler !== 'function') + throw new Error( + "Action: no implementation provided; set the mock's action property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as Output) + : fromJson(OutputSchema, raw as OutputJson) + return { response: { case: 'payload', value: anyPack(OutputSchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability. - * Multiple calls with the same arguments return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(): BasicTestActionTriggerMock { - const qualifiedId = BasicTestActionTriggerMock.CAPABILITY_ID; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new BasicTestActionTriggerMock(); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability. + * Multiple calls with the same arguments return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(): BasicTestActionTriggerMock { + const qualifiedId = BasicTestActionTriggerMock.CAPABILITY_ID + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new BasicTestActionTriggerMock() + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/basicaction/v1/basic_test_action_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/basicaction/v1/basic_test_action_mock_gen.ts index 73c12e5..675f5a9 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/basicaction/v1/basic_test_action_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/basicaction/v1/basic_test_action_mock_gen.ts @@ -1,53 +1,71 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type Inputs, InputsSchema, type Outputs, type OutputsJson, OutputsSchema } from "@cre/generated/capabilities/internal/basicaction/v1/basic_action_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type Inputs, + InputsSchema, + type Outputs, + type OutputsJson, + OutputsSchema, +} from '@cre/generated/capabilities/internal/basicaction/v1/basic_action_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for BasicActionCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class BasicTestActionMock { - static readonly CAPABILITY_ID = "basic-test-action@1.0.0"; + static readonly CAPABILITY_ID = 'basic-test-action@1.0.0' - /** Set to define the return value for PerformAction. May return a plain object (OutputsJson) or the message type. */ - performAction?: (input: Inputs) => Outputs | OutputsJson; + /** Set to define the return value for PerformAction. May return a plain object (OutputsJson) or the message type. */ + performAction?: (input: Inputs) => Outputs | OutputsJson - private constructor() { - const self = this; - const qualifiedId = BasicTestActionMock.CAPABILITY_ID; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "PerformAction": { - const input = anyUnpack(req.payload, InputsSchema) as Inputs; - const handler = self.performAction; - if (typeof handler !== "function") throw new Error("PerformAction: no implementation provided; set the mock's performAction property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as Outputs) : fromJson(OutputsSchema, raw as OutputsJson); - return { response: { case: "payload", value: anyPack(OutputsSchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor() { + const self = this + const qualifiedId = BasicTestActionMock.CAPABILITY_ID + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'PerformAction': { + const input = anyUnpack(req.payload, InputsSchema) as Inputs + const handler = self.performAction + if (typeof handler !== 'function') + throw new Error( + "PerformAction: no implementation provided; set the mock's performAction property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as Outputs) + : fromJson(OutputsSchema, raw as OutputsJson) + return { response: { case: 'payload', value: anyPack(OutputsSchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability. - * Multiple calls with the same arguments return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(): BasicTestActionMock { - const qualifiedId = BasicTestActionMock.CAPABILITY_ID; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new BasicTestActionMock(); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability. + * Multiple calls with the same arguments return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(): BasicTestActionMock { + const qualifiedId = BasicTestActionMock.CAPABILITY_ID + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new BasicTestActionMock() + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/consensus/v1alpha/consensus_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/consensus/v1alpha/consensus_mock_gen.ts index e906a39..8c9e256 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/consensus/v1alpha/consensus_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/consensus/v1alpha/consensus_mock_gen.ts @@ -1,65 +1,94 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type ReportRequest, ReportRequestSchema, type ReportResponse, type ReportResponseJson, ReportResponseSchema, type SimpleConsensusInputs, SimpleConsensusInputsSchema } from "@cre/generated/sdk/v1alpha/sdk_pb" -import { type Value, type ValueJson, ValueSchema } from "@cre/generated/values/v1/values_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type ReportRequest, + ReportRequestSchema, + type ReportResponse, + type ReportResponseJson, + ReportResponseSchema, + type SimpleConsensusInputs, + SimpleConsensusInputsSchema, +} from '@cre/generated/sdk/v1alpha/sdk_pb' +import { type Value, type ValueJson, ValueSchema } from '@cre/generated/values/v1/values_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for ConsensusCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class ConsensusMock { - static readonly CAPABILITY_ID = "consensus@1.0.0-alpha"; + static readonly CAPABILITY_ID = 'consensus@1.0.0-alpha' - /** Set to define the return value for Simple. May return a plain object (ValueJson) or the message type. */ - simple?: (input: SimpleConsensusInputs) => Value | ValueJson; + /** Set to define the return value for Simple. May return a plain object (ValueJson) or the message type. */ + simple?: (input: SimpleConsensusInputs) => Value | ValueJson - /** Set to define the return value for Report. May return a plain object (ReportResponseJson) or the message type. */ - report?: (input: ReportRequest) => ReportResponse | ReportResponseJson; + /** Set to define the return value for Report. May return a plain object (ReportResponseJson) or the message type. */ + report?: (input: ReportRequest) => ReportResponse | ReportResponseJson - private constructor() { - const self = this; - const qualifiedId = ConsensusMock.CAPABILITY_ID; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "Simple": { - const input = anyUnpack(req.payload, SimpleConsensusInputsSchema) as SimpleConsensusInputs; - const handler = self.simple; - if (typeof handler !== "function") throw new Error("Simple: no implementation provided; set the mock's simple property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as Value) : fromJson(ValueSchema, raw as ValueJson); - return { response: { case: "payload", value: anyPack(ValueSchema, output) } }; - } - case "Report": { - const input = anyUnpack(req.payload, ReportRequestSchema) as ReportRequest; - const handler = self.report; - if (typeof handler !== "function") throw new Error("Report: no implementation provided; set the mock's report property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as ReportResponse) : fromJson(ReportResponseSchema, raw as ReportResponseJson); - return { response: { case: "payload", value: anyPack(ReportResponseSchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor() { + const self = this + const qualifiedId = ConsensusMock.CAPABILITY_ID + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'Simple': { + const input = anyUnpack( + req.payload, + SimpleConsensusInputsSchema, + ) as SimpleConsensusInputs + const handler = self.simple + if (typeof handler !== 'function') + throw new Error( + "Simple: no implementation provided; set the mock's simple property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as Value) + : fromJson(ValueSchema, raw as ValueJson) + return { response: { case: 'payload', value: anyPack(ValueSchema, output) } } + } + case 'Report': { + const input = anyUnpack(req.payload, ReportRequestSchema) as ReportRequest + const handler = self.report + if (typeof handler !== 'function') + throw new Error( + "Report: no implementation provided; set the mock's report property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as ReportResponse) + : fromJson(ReportResponseSchema, raw as ReportResponseJson) + return { response: { case: 'payload', value: anyPack(ReportResponseSchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability. - * Multiple calls with the same arguments return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(): ConsensusMock { - const qualifiedId = ConsensusMock.CAPABILITY_ID; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new ConsensusMock(); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability. + * Multiple calls with the same arguments return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(): ConsensusMock { + const qualifiedId = ConsensusMock.CAPABILITY_ID + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new ConsensusMock() + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/nodeaction/v1/basic_test_node_action_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/nodeaction/v1/basic_test_node_action_mock_gen.ts index 0965e4f..bf8e9de 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/nodeaction/v1/basic_test_node_action_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/internal/nodeaction/v1/basic_test_node_action_mock_gen.ts @@ -1,53 +1,71 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type NodeInputs, NodeInputsSchema, type NodeOutputs, type NodeOutputsJson, NodeOutputsSchema } from "@cre/generated/capabilities/internal/nodeaction/v1/node_action_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type NodeInputs, + NodeInputsSchema, + type NodeOutputs, + type NodeOutputsJson, + NodeOutputsSchema, +} from '@cre/generated/capabilities/internal/nodeaction/v1/node_action_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for BasicActionCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class BasicTestNodeActionMock { - static readonly CAPABILITY_ID = "basic-test-node-action@1.0.0"; + static readonly CAPABILITY_ID = 'basic-test-node-action@1.0.0' - /** Set to define the return value for PerformAction. May return a plain object (NodeOutputsJson) or the message type. */ - performAction?: (input: NodeInputs) => NodeOutputs | NodeOutputsJson; + /** Set to define the return value for PerformAction. May return a plain object (NodeOutputsJson) or the message type. */ + performAction?: (input: NodeInputs) => NodeOutputs | NodeOutputsJson - private constructor() { - const self = this; - const qualifiedId = BasicTestNodeActionMock.CAPABILITY_ID; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "PerformAction": { - const input = anyUnpack(req.payload, NodeInputsSchema) as NodeInputs; - const handler = self.performAction; - if (typeof handler !== "function") throw new Error("PerformAction: no implementation provided; set the mock's performAction property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as NodeOutputs) : fromJson(NodeOutputsSchema, raw as NodeOutputsJson); - return { response: { case: "payload", value: anyPack(NodeOutputsSchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor() { + const self = this + const qualifiedId = BasicTestNodeActionMock.CAPABILITY_ID + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'PerformAction': { + const input = anyUnpack(req.payload, NodeInputsSchema) as NodeInputs + const handler = self.performAction + if (typeof handler !== 'function') + throw new Error( + "PerformAction: no implementation provided; set the mock's performAction property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as NodeOutputs) + : fromJson(NodeOutputsSchema, raw as NodeOutputsJson) + return { response: { case: 'payload', value: anyPack(NodeOutputsSchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability. - * Multiple calls with the same arguments return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(): BasicTestNodeActionMock { - const qualifiedId = BasicTestNodeActionMock.CAPABILITY_ID; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new BasicTestNodeActionMock(); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability. + * Multiple calls with the same arguments return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(): BasicTestNodeActionMock { + const qualifiedId = BasicTestNodeActionMock.CAPABILITY_ID + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new BasicTestNodeActionMock() + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/confidentialhttp/v1alpha/confidential_http_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/confidentialhttp/v1alpha/confidential_http_mock_gen.ts index e617dbf..0529085 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/confidentialhttp/v1alpha/confidential_http_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/confidentialhttp/v1alpha/confidential_http_mock_gen.ts @@ -1,53 +1,74 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type ConfidentialHTTPRequest, ConfidentialHTTPRequestSchema, type HTTPResponse, type HTTPResponseJson, HTTPResponseSchema } from "@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type ConfidentialHTTPRequest, + ConfidentialHTTPRequestSchema, + type HTTPResponse, + type HTTPResponseJson, + HTTPResponseSchema, +} from '@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for ClientCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class ConfidentialHttpMock { - static readonly CAPABILITY_ID = "confidential-http@1.0.0-alpha"; + static readonly CAPABILITY_ID = 'confidential-http@1.0.0-alpha' - /** Set to define the return value for SendRequest. May return a plain object (HTTPResponseJson) or the message type. */ - sendRequest?: (input: ConfidentialHTTPRequest) => HTTPResponse | HTTPResponseJson; + /** Set to define the return value for SendRequest. May return a plain object (HTTPResponseJson) or the message type. */ + sendRequest?: (input: ConfidentialHTTPRequest) => HTTPResponse | HTTPResponseJson - private constructor() { - const self = this; - const qualifiedId = ConfidentialHttpMock.CAPABILITY_ID; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "SendRequest": { - const input = anyUnpack(req.payload, ConfidentialHTTPRequestSchema) as ConfidentialHTTPRequest; - const handler = self.sendRequest; - if (typeof handler !== "function") throw new Error("SendRequest: no implementation provided; set the mock's sendRequest property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as HTTPResponse) : fromJson(HTTPResponseSchema, raw as HTTPResponseJson); - return { response: { case: "payload", value: anyPack(HTTPResponseSchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor() { + const self = this + const qualifiedId = ConfidentialHttpMock.CAPABILITY_ID + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'SendRequest': { + const input = anyUnpack( + req.payload, + ConfidentialHTTPRequestSchema, + ) as ConfidentialHTTPRequest + const handler = self.sendRequest + if (typeof handler !== 'function') + throw new Error( + "SendRequest: no implementation provided; set the mock's sendRequest property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as HTTPResponse) + : fromJson(HTTPResponseSchema, raw as HTTPResponseJson) + return { response: { case: 'payload', value: anyPack(HTTPResponseSchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability. - * Multiple calls with the same arguments return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(): ConfidentialHttpMock { - const qualifiedId = ConfidentialHttpMock.CAPABILITY_ID; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new ConfidentialHttpMock(); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability. + * Multiple calls with the same arguments return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(): ConfidentialHttpMock { + const qualifiedId = ConfidentialHttpMock.CAPABILITY_ID + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new ConfidentialHttpMock() + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/http/v1alpha/http_actions_mock_gen.ts b/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/http/v1alpha/http_actions_mock_gen.ts index 78f8fe0..e6cb757 100644 --- a/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/http/v1alpha/http_actions_mock_gen.ts +++ b/packages/cre-sdk/src/sdk/test/generated/capabilities/networking/http/v1alpha/http_actions_mock_gen.ts @@ -1,53 +1,71 @@ -import { fromJson } from "@bufbuild/protobuf" -import { anyPack, anyUnpack } from "@bufbuild/protobuf/wkt" -import { registerTestCapability, __getTestMockInstance, __setTestMockInstance } from "@cre/sdk/testutils/test-runtime" -import { type Request, RequestSchema, type Response, type ResponseJson, ResponseSchema } from "@cre/generated/capabilities/networking/http/v1alpha/client_pb" +import { fromJson } from '@bufbuild/protobuf' +import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt' +import { + type Request, + RequestSchema, + type Response, + type ResponseJson, + ResponseSchema, +} from '@cre/generated/capabilities/networking/http/v1alpha/client_pb' +import { + __getTestMockInstance, + __setTestMockInstance, + registerTestCapability, +} from '@cre/sdk/testutils/test-runtime' /** * Mock for ClientCapability. Use testInstance() to obtain an instance; do not construct directly. * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown. */ export class HttpActionsMock { - static readonly CAPABILITY_ID = "http-actions@1.0.0-alpha"; + static readonly CAPABILITY_ID = 'http-actions@1.0.0-alpha' - /** Set to define the return value for SendRequest. May return a plain object (ResponseJson) or the message type. */ - sendRequest?: (input: Request) => Response | ResponseJson; + /** Set to define the return value for SendRequest. May return a plain object (ResponseJson) or the message type. */ + sendRequest?: (input: Request) => Response | ResponseJson - private constructor() { - const self = this; - const qualifiedId = HttpActionsMock.CAPABILITY_ID; - try { - registerTestCapability(qualifiedId, (req) => { - switch (req.method) { - case "SendRequest": { - const input = anyUnpack(req.payload, RequestSchema) as Request; - const handler = self.sendRequest; - if (typeof handler !== "function") throw new Error("SendRequest: no implementation provided; set the mock's sendRequest property to define the return value."); - const raw = handler(input); - const output = raw && typeof (raw as unknown as { $typeName?: string }).$typeName === "string" ? (raw as Response) : fromJson(ResponseSchema, raw as ResponseJson); - return { response: { case: "payload", value: anyPack(ResponseSchema, output) } }; - } - default: - return { response: { case: "error", value: `unknown method ${req.method}` } }; - } - }); - } catch { - throw new Error("Capability mocks must be used within the CRE test framework's test() method.") - } - } + private constructor() { + const self = this + const qualifiedId = HttpActionsMock.CAPABILITY_ID + try { + registerTestCapability(qualifiedId, (req) => { + switch (req.method) { + case 'SendRequest': { + const input = anyUnpack(req.payload, RequestSchema) as Request + const handler = self.sendRequest + if (typeof handler !== 'function') + throw new Error( + "SendRequest: no implementation provided; set the mock's sendRequest property to define the return value.", + ) + const raw = handler(input) + const output = + raw && typeof (raw as unknown as { $typeName?: string }).$typeName === 'string' + ? (raw as Response) + : fromJson(ResponseSchema, raw as ResponseJson) + return { response: { case: 'payload', value: anyPack(ResponseSchema, output) } } + } + default: + return { response: { case: 'error', value: `unknown method ${req.method}` } } + } + }) + } catch { + throw new Error( + "Capability mocks must be used within the CRE test framework's test() method.", + ) + } + } - /** - * Returns the mock instance for this capability. - * Multiple calls with the same arguments return the same instance. - * Must be called within the test framework's test() method. - */ - static testInstance(): HttpActionsMock { - const qualifiedId = HttpActionsMock.CAPABILITY_ID; - let instance = __getTestMockInstance(qualifiedId); - if (!instance) { - instance = new HttpActionsMock(); - __setTestMockInstance(qualifiedId, instance); - } - return instance; - } + /** + * Returns the mock instance for this capability. + * Multiple calls with the same arguments return the same instance. + * Must be called within the test framework's test() method. + */ + static testInstance(): HttpActionsMock { + const qualifiedId = HttpActionsMock.CAPABILITY_ID + let instance = __getTestMockInstance(qualifiedId) + if (!instance) { + instance = new HttpActionsMock() + __setTestMockInstance(qualifiedId, instance) + } + return instance + } } diff --git a/packages/cre-sdk/src/sdk/test/generated/index.ts b/packages/cre-sdk/src/sdk/test/generated/index.ts index d593ba4..52e25d8 100644 --- a/packages/cre-sdk/src/sdk/test/generated/index.ts +++ b/packages/cre-sdk/src/sdk/test/generated/index.ts @@ -1,9 +1,9 @@ /** Auto-generated barrel of capability mocks. Do not edit. */ -export { BasicTestActionMock } from "./capabilities/internal/basicaction/v1/basic_test_action_mock_gen" -export { BasicTestNodeActionMock } from "./capabilities/internal/nodeaction/v1/basic_test_node_action_mock_gen" -export { ConsensusMock } from "./capabilities/internal/consensus/v1alpha/consensus_mock_gen" -export { BasicTestActionTriggerMock } from "./capabilities/internal/actionandtrigger/v1/basic_test_action_trigger_mock_gen" -export { EvmMock } from "./capabilities/blockchain/evm/v1alpha/evm_mock_gen" -export { HttpActionsMock } from "./capabilities/networking/http/v1alpha/http_actions_mock_gen" -export { ConfidentialHttpMock } from "./capabilities/networking/confidentialhttp/v1alpha/confidential_http_mock_gen" +export { EvmMock } from './capabilities/blockchain/evm/v1alpha/evm_mock_gen' +export { BasicTestActionTriggerMock } from './capabilities/internal/actionandtrigger/v1/basic_test_action_trigger_mock_gen' +export { BasicTestActionMock } from './capabilities/internal/basicaction/v1/basic_test_action_mock_gen' +export { ConsensusMock } from './capabilities/internal/consensus/v1alpha/consensus_mock_gen' +export { BasicTestNodeActionMock } from './capabilities/internal/nodeaction/v1/basic_test_node_action_mock_gen' +export { ConfidentialHttpMock } from './capabilities/networking/confidentialhttp/v1alpha/confidential_http_mock_gen' +export { HttpActionsMock } from './capabilities/networking/http/v1alpha/http_actions_mock_gen' diff --git a/submodules/chainlink-protos b/submodules/chainlink-protos index a16fdc3..a13ce58 160000 --- a/submodules/chainlink-protos +++ b/submodules/chainlink-protos @@ -1 +1 @@ -Subproject commit a16fdc328bcd4185951bcda8e9dcc1c3b38e76d2 +Subproject commit a13ce582498c0aae9a1441a5361ab1453179fe3d