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 bf115c08..6c2a32c4 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,521 +1,464 @@ -import { create, fromJson } from '@bufbuild/protobuf' -import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' +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 { - 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' + 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" import { - 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' + ReportResponseSchema, + type ReportResponse, + type ReportResponseJson, +} from "@cre/generated/sdk/v1alpha/sdk_pb" -export type WriteCreReportRequest = { - receiver: Uint8Array - report?: Report - gasConfig?: GasConfig - $report: true -} -export type WriteCreReportRequestJson = { - 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 type WriteCreReportRequest = { + receiver: Uint8Array; + report?: Report; + gasConfig?: 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 type WriteCreReportRequestJson = { + receiver: string; + report?: Report; + gasConfig?: GasConfigJson +}; -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, - '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, - }) - - 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, - }) + /** 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 - 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 - }, - } - } + 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 + } + } + } } /** * 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 - } -} + 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 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 630b8277..81cada1f 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,110 +1,115 @@ -import { create, fromJson } from '@bufbuild/protobuf' -import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' +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 { - 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' + 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" + + /** * 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 - } -} + 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 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 81e07d89..b12c8547 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,57 +1,62 @@ -import { fromJson } from '@bufbuild/protobuf' +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 { - 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' + InputsSchema, + OutputsSchema, + type Inputs, + type InputsJson, + type Outputs, +} from "@cre/generated/capabilities/internal/basicaction/v1/basic_action_pb" + + /** * 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 47790d03..3e5429a5 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,71 +1,75 @@ -import { create, fromJson } from '@bufbuild/protobuf' -import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' +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 { - 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' + ConfigSchema, + OutputsSchema, + type Config, + type ConfigJson, + type Outputs, +} from "@cre/generated/capabilities/internal/basictrigger/v1/basic_trigger_pb" + + /** * 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' + /** 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"; - 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, - capabilityId(): string { - return this._capabilityId - } + ) { + // 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) + } - method(): string { - return this._method - } + capabilityId(): string { + return this._capabilityId; + } - outputSchema() { - return OutputsSchema - } + method(): string { + return this._method; + } - configAsAny(): Any { - return anyPack(ConfigSchema, this.config) - } + outputSchema() { + return OutputsSchema; + } - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Outputs): Outputs { - return rawOutput - } -} + 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 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 2077be10..096ae2ce 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,98 +1,101 @@ -import { fromJson } from '@bufbuild/protobuf' +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 { - 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' + 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" + + /** * 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' - - 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() + /** The capability ID for this service */ + static readonly CAPABILITY_ID = "consensus@1.0.0-alpha"; - return result - }, - } - } + static readonly CAPABILITY_NAME = "consensus"; + static readonly CAPABILITY_VERSION = "1.0.0-alpha"; - 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 + 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 capabilityResponse = runtime.callCapability({ - capabilityId, - method: 'Report', - payload, - inputSchema: ReportRequestSchema, - outputSchema: ReportResponseSchema, - }) + return { + result: () => { + const result = capabilityResponse.result() + + return result + } + } + } - return { - result: () => { - const result = capabilityResponse.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) + } + + + const capabilityId = ConsensusCapability.CAPABILITY_ID; + + const capabilityResponse = runtime.callCapability({ + capabilityId, + method: "Report", + payload, + inputSchema: ReportRequestSchema, + outputSchema: ReportResponseSchema + }) - return new Report(result) - }, - } - } + return { + result: () => { + const result = capabilityResponse.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 3046dfc2..dc794a41 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,107 +1,101 @@ -import { fromJson } from '@bufbuild/protobuf' +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 { - 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' + NodeInputsSchema, + NodeOutputsSchema, + type NodeInputs, + type NodeInputsJson, + type NodeOutputs, +} from "@cre/generated/capabilities/internal/nodeaction/v1/node_action_pb" 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' - - 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 + /** The capability ID for this service */ + static readonly CAPABILITY_ID = "basic-test-node-action@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) - } + static readonly CAPABILITY_NAME = "basic-test-node-action"; + static readonly CAPABILITY_VERSION = "1.0.0"; - const capabilityId = BasicActionCapability.CAPABILITY_ID - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: 'PerformAction', - payload, - inputSchema: NodeInputsSchema, - outputSchema: NodeOutputsSchema, - }) - return { - result: () => { - const result = capabilityResponse.result() + 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 - }, - } - } - 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: () => { + 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) + } } 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 110fc54b..679f856e 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,60 +1,62 @@ -import { fromJson } from '@bufbuild/protobuf' +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 { - 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' + ConfidentialHTTPRequestSchema, + HTTPResponseSchema, + type ConfidentialHTTPRequest, + type ConfidentialHTTPRequestJson, + type HTTPResponse, +} from "@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb" + + /** * 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 69beaf7b..c4ecfc68 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,107 +1,101 @@ -import { fromJson } from '@bufbuild/protobuf' +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 { - 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' + RequestSchema, + ResponseSchema, + type Request, + type RequestJson, + type Response, +} from "@cre/generated/capabilities/networking/http/v1alpha/client_pb" 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' - - 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 + /** The capability ID for this service */ + static readonly CAPABILITY_ID = "http-actions@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) - } + static readonly CAPABILITY_NAME = "http-actions"; + static readonly CAPABILITY_VERSION = "1.0.0-alpha"; - const capabilityId = ClientCapability.CAPABILITY_ID - const capabilityResponse = runtime.callCapability({ - capabilityId, - method: 'SendRequest', - payload, - inputSchema: RequestSchema, - outputSchema: ResponseSchema, - }) - return { - result: () => { - const result = capabilityResponse.result() + 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 - }, - } - } - 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: () => { + 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) + } } 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 37547938..1d9d4035 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,71 +1,75 @@ -import { create, fromJson } from '@bufbuild/protobuf' -import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' +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 { - 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' + ConfigSchema, + PayloadSchema, + type Config, + type ConfigJson, + type Payload, +} from "@cre/generated/capabilities/networking/http/v1alpha/trigger_pb" + + /** * 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' + /** 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"; - 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, - capabilityId(): string { - return this._capabilityId - } + ) { + // 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) + } - method(): string { - return this._method - } + capabilityId(): string { + return this._capabilityId; + } - outputSchema() { - return PayloadSchema - } + method(): string { + return this._method; + } - configAsAny(): Any { - return anyPack(ConfigSchema, this.config) - } + outputSchema() { + return PayloadSchema; + } - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Payload): Payload { - return rawOutput - } -} + 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 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 9d158212..23ff2a30 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,73 +1,77 @@ -import { create, fromJson } from '@bufbuild/protobuf' -import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt' +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 { - 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' + ConfigSchema, + LegacyPayloadSchema, + PayloadSchema, + type Config, + type ConfigJson, + type LegacyPayload, + type Payload, +} from "@cre/generated/capabilities/scheduler/cron/v1/trigger_pb" + + /** * 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' + /** 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"; - 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, - capabilityId(): string { - return this._capabilityId - } + ) { + // 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) + } - method(): string { - return this._method - } + capabilityId(): string { + return this._capabilityId; + } - outputSchema() { - return PayloadSchema - } + method(): string { + return this._method; + } - configAsAny(): Any { - return anyPack(ConfigSchema, this.config) - } + outputSchema() { + return PayloadSchema; + } - /** - * Transform the raw trigger output - override this method if needed - * Default implementation returns the raw output unchanged - */ - adapt(rawOutput: Payload): Payload { - return rawOutput - } -} + 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 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 366e7d9a..bee62222 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( - 'CjBjYXBhYmlsaXRpZXMvYmxvY2tjaGFpbi9ldm0vdjFhbHBoYS9jbGllbnQucHJvdG8SI2NhcGFiaWxpdGllcy5ibG9ja2NoYWluLmV2bS52MWFscGhhIh0KC1RvcGljVmFsdWVzEg4KBnZhbHVlcxgBIAMoDCK4AQoXRmlsdGVyTG9nVHJpZ2dlclJlcXVlc3QSEQoJYWRkcmVzc2VzGAEgAygMEkAKBnRvcGljcxgCIAMoCzIwLmNhcGFiaWxpdGllcy5ibG9ja2NoYWluLmV2bS52MWFscGhhLlRvcGljVmFsdWVzEkgKCmNvbmZpZGVuY2UYAyABKA4yNC5jYXBhYmlsaXRpZXMuYmxvY2tjaGFpbi5ldm0udjFhbHBoYS5Db25maWRlbmNlTGV2ZWwiegoTQ2FsbENvbnRyYWN0UmVxdWVzdBI6CgRjYWxsGAEgASgLMiwuY2FwYWJpbGl0aWVzLmJsb2NrY2hha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[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 473f7b89..1f7b16a8 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 @@ -3,8 +3,8 @@ /* eslint-disable */ import type { Message } from '@bufbuild/protobuf' -import type { GenFile, GenMessage, GenService } from '@bufbuild/protobuf/codegenv2' -import { fileDesc, messageDesc, serviceDesc } from '@bufbuild/protobuf/codegenv2' +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' @@ -15,7 +15,7 @@ import { file_tools_generator_v1alpha_cre_metadata } from '../../../../tools/gen export const file_capabilities_networking_confidentialhttp_v1alpha_client: GenFile = /*@__PURE__*/ fileDesc( - 'Cj1jYXBhYmlsaXRpZXMvbmV0d29ya2luZy9jb25maWRlbnRpYWxodHRwL3YxYWxwaGEvY2xpZW50LnByb3RvEjBjYXBhYmlsaXRpZXMubmV0d29ya2luZy5jb25maWRlbnRpYWxodHRwLnYxYWxwaGEiUAoQU2VjcmV0SWRlbnRpZmllchILCgNrZXkYASABKAkSEQoJbmFtZXNwYWNlGAIgASgJEhIKBW93bmVyGAMgASgJSACIAQFCCAoGX293bmVyIh4KDEhlYWRlclZhbHVlcxIOCgZ2YWx1ZXMYASADKAki1wQKC0hUVFBSZXF1ZXN0EgsKA3VybBgBIAEoCRIOCgZtZXR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bnRQcm90b1ABogIDQ05DqgIwQ2FwYWJpbGl0aWVzLk5ldHdvcmtpbmcuQ29uZmlkZW50aWFsaHR0cC5WMWFscGhhygIwQ2FwYWJpbGl0aWVzXE5ldHdvcmtpbmdcQ29uZmlkZW50aWFsaHR0cFxWMWFscGhh4gI8Q2FwYWJpbGl0aWVzXE5ldHdvcmtpbmdcQ29uZmlkZW50aWFsaHR0cFxWMWFscGhhXEdQQk1ldGFkYXRh6gIzQ2FwYWJpbGl0aWVzOjpOZXR3b3JraW5nOjpDb25maWRlbnRpYWxodHRwOjpWMWFscGhhYgZwcm90bzM', [file_google_protobuf_duration, file_tools_generator_v1alpha_cre_metadata], ) @@ -349,6 +349,18 @@ export type ConfidentialHTTPRequest = * @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 } /** @@ -367,6 +379,18 @@ export type ConfidentialHTTPRequestJson = { * @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 } /** @@ -378,6 +402,1041 @@ export const ConfidentialHTTPRequestSchema: GenMessage< { jsonType: ConfidentialHTTPRequestJson } > = /*@__PURE__*/ messageDesc(file_capabilities_networking_confidentialhttp_v1alpha_client, 4) +/** + * 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. + * + * @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 } +} + +/** + * 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. + * + * @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 +} + +/** + * 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) + +/** + * ApiKeyAuth attaches a secret value to a chosen header. + * Renders as: : + * Example (header_name="x-api-key", secret_name="coingecko", value_prefix=""): + * 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 +} + +/** + * ApiKeyAuth attaches a secret value to a chosen header. + * Renders as: : + * Example (header_name="x-api-key", secret_name="coingecko", value_prefix=""): + * 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 +} + +/** + * 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) + +/** + * 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 +} + +/** + * BasicAuth renders: Authorization: Basic base64(username ":" password). + * + * @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 +} + +/** + * 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) + +/** + * BearerAuth attaches a pre-issued long-lived token. + * Default behavior: Authorization: Bearer + * header_name and value_prefix allow rare overrides (e.g. GitHub's + * "Authorization: token "). + * + * @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 +} + +/** + * BearerAuth attaches a pre-issued long-lived token. + * Default behavior: Authorization: Bearer + * header_name and value_prefix allow rare overrides (e.g. GitHub's + * "Authorization: token "). + * + * @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 +} + +/** + * 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) + +/** + * 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 } +} + +/** + * HmacAuth groups all HMAC-family signing variants. + * + * @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 +} + +/** + * 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) + +/** + * HmacSha256 implements a generic canonical-string HMAC-SHA256 signature. + * Canonical string: method "\n" url "\n" sha256(body) "\n" timestamp + * Signature is attached via signature_header, timestamp via timestamp_header. + * + * @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 +} + +/** + * HmacSha256 implements a generic canonical-string HMAC-SHA256 signature. + * Canonical string: method "\n" url "\n" sha256(body) "\n" timestamp + * Signature is attached via signature_header, timestamp via timestamp_header. + * + * @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 +} + +/** + * 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) + +/** + * AwsSigV4 implements AWS Signature Version 4. + * Uses github.com/aws/aws-sdk-go-v2/aws/signer/v4 under the hood. + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.AwsSigV4 + */ +export type AwsSigV4 = Message<'capabilities.networking.confidentialhttp.v1alpha.AwsSigV4'> & { + /** + * 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 +} + +/** + * AwsSigV4 implements AWS Signature Version 4. + * Uses github.com/aws/aws-sdk-go-v2/aws/signer/v4 under the hood. + * + * @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 +} + +/** + * 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) + +/** + * HmacCustom lets workflow authors specify the canonical string via a + * Go text/template string. Available template vars: + * {{.method}} {{.url}} {{.path}} {{.query}} {{.body}} {{.body_sha256}} + * {{.timestamp}} {{.nonce}} {{header "X-Foo"}} + * + * @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 +} + +/** + * HmacCustom lets workflow authors specify the canonical string via a + * Go text/template string. Available template vars: + * {{.method}} {{.url}} {{.path}} {{.query}} {{.body}} {{.body_sha256}} + * {{.timestamp}} {{.nonce}} {{header "X-Foo"}} + * + * @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 +} + +/** + * 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) + +/** + * @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 capabilities.networking.confidentialhttp.v1alpha.HmacCustom.Hash + */ +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) + +/** + * OAuth2Auth groups headless OAuth 2.0 flows. + * Interactive flows (Authorization Code, PKCE, Device Code) are NOT supported — + * they require browser consent that a headless TEE cannot perform. + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth + */ +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. + * Interactive flows (Authorization Code, PKCE, Device Code) are NOT supported — + * they require browser consent that a headless TEE cannot perform. + * + * @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 +} + +/** + * 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) + +/** + * OAuth2ClientCredentials: machine-to-machine grant. + * The enclave POSTs to token_url with client_id/client_secret, caches the + * resulting access_token per (workflow_owner, token_url, client_id, scopes), + * and attaches "Authorization: Bearer " to the outbound request. + * + * @generated from message capabilities.networking.confidentialhttp.v1alpha.OAuth2ClientCredentials + */ +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: 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 } + } + +/** + * OAuth2ClientCredentials: machine-to-machine grant. + * The enclave POSTs to token_url with client_id/client_secret, caches the + * resulting access_token per (workflow_owner, token_url, client_id, scopes), + * and attaches "Authorization: Bearer " to the outbound request. + * + * @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 } +} + +/** + * 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) + +/** + * OAuth2RefreshToken: the workflow stores a long-lived refresh_token in Vault + * (obtained out-of-band during an interactive consent). The enclave exchanges + * it for an access_token on cache miss. + * + * Important: if the IdP rotates refresh tokens on each exchange, the enclave + * cannot persist the new refresh_token back to Vault. Disable refresh-token + * rotation at the IdP, or prefer client_credentials where possible. + * + * @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 } + } + +/** + * OAuth2RefreshToken: the workflow stores a long-lived refresh_token in Vault + * (obtained out-of-band during an interactive consent). The enclave exchanges + * it for an access_token on cache miss. + * + * Important: if the IdP rotates refresh tokens on each exchange, the enclave + * cannot persist the new refresh_token back to Vault. Disable refresh-token + * rotation at the IdP, or prefer client_credentials where possible. + * + * @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 } +} + +/** + * 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) + /** * @generated from service capabilities.networking.confidentialhttp.v1alpha.Client */ diff --git a/packages/cre-sdk/src/generated/tools/generator/v1alpha/cre_metadata_pb.ts b/packages/cre-sdk/src/generated/tools/generator/v1alpha/cre_metadata_pb.ts index dfafc07f..89c672a3 100644 --- a/packages/cre-sdk/src/generated/tools/generator/v1alpha/cre_metadata_pb.ts +++ b/packages/cre-sdk/src/generated/tools/generator/v1alpha/cre_metadata_pb.ts @@ -16,7 +16,7 @@ import { file_sdk_v1alpha_sdk } from '../../../sdk/v1alpha/sdk_pb' export const file_tools_generator_v1alpha_cre_metadata: GenFile = /*@__PURE__*/ fileDesc( - 'Cip0b29scy9nZW5lcmF0b3IvdjFhbHBoYS9jcmVfbWV0YWRhdGEucHJvdG8SF3Rvb2xzLmdlbmVyYXRvci52MWFscGhhIoQBCgtTdHJpbmdMYWJlbBJECghkZWZhdWx0cxgBIAMoCzIyLnRvb2xzLmdlbmVyYXRvci52MWFscGhhLlN0cmluZ0xhYmVsLkRlZmF1bHRzRW50cnkaLwoNRGVmYXVsdHNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBIogBCgtVaW50NjRMYWJlbBJECghkZWZhdWx0cxgBIAMoCzIyLnRvb2xzLmdlbmVyYXRvci52MWFscGhhLlVpbnQ2NExhYmVsLkRlZmF1bHRzRW50cnkaMwoNRGVmYXVsdHNFbnRyeRILCgNrZXkYASABKAkSEQoFdmFsdWUYAiABKARCAjAAOgI4ASKEAQoLVWludDMyTGFiZWwSRAoIZGVmYXVsdHMYASADKAsyMi50b29scy5nZW5lcmF0b3IudjFhbHBoYS5VaW50MzJMYWJlbC5EZWZhdWx0c0VudHJ5Gi8KDURlZmF1bHRzRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgNOgI4ASKGAQoKSW50NjRMYWJlbBJDCghkZWZhdWx0cxgBIAMoCzIxLnRvb2xzLmdlbmVyYXRvci52MWFscGhhLkludDY0TGFiZWwuRGVm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2VuZXJhdG9yLnYxYWxwaGEuQ2FwYWJpbGl0eU1ldGFkYXRhLkxhYmVsc0VudHJ5Gk0KC0xhYmVsc0VudHJ5EgsKA2tleRgBIAEoCRItCgV2YWx1ZRgCIAEoCzIeLnRvb2xzLmdlbmVyYXRvci52MWFscGhhLkxhYmVsOgI4ASI2ChhDYXBhYmlsaXR5TWV0aG9kTWV0YWRhdGESGgoSbWFwX3RvX3VudHlwZWRfYXBpGAEgASgIOm4KCmNhcGFiaWxpdHkSHy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMY0IYDIAEoCzIrLnRvb2xzLmdlbmVyYXRvci52MWFscGhhLkNhcGFiaWxpdHlNZXRhZGF0YVIKY2FwYWJpbGl0eTprCgZtZXRob2QSHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxjRhgMgASgLMjEudG9vbHMuZ2VuZXJhdG9yLnYxYWxwaGEuQ2FwYWJpbGl0eU1ldGhvZE1ldGFkYXRhUgZtZXRob2RCrwEKG2NvbS50b29scy5nZW5lcmF0b3IudjFhbHBoYUIQQ3JlTWV0YWRhdGFQcm90b1ABogIDVEdYqgIXVG9vbHMuR2VuZXJhdG9yLlYxYWxwaGHKAhhUb29sc1xHZW5lcmF0b3JfXFYxYWxwaGHiAiRUb29sc1xHZW5lcmF0b3JfXFYxYWxwaGFcR1BCTWV0YWRhdGHqAhlUb29sczo6R2VuZXJhdG9yOjpWMWFscGhhYgZwcm90bzM', [file_google_protobuf_descriptor, file_sdk_v1alpha_sdk], ) @@ -164,6 +164,13 @@ export const Int32LabelSchema: GenMessage & { + /** + * When true, the label is not required and will only be included in the capability ID when set. + * + * @generated from field: bool optional = 6; + */ + optional: boolean + /** * @generated from oneof tools.generator.v1alpha.Label.kind */ @@ -210,6 +217,13 @@ export type Label = Message<'tools.generator.v1alpha.Label'> & { * @generated from message tools.generator.v1alpha.Label */ export type LabelJson = { + /** + * When true, the label is not required and will only be included in the capability ID when set. + * + * @generated from field: bool optional = 6; + */ + optional?: boolean + /** * @generated from field: tools.generator.v1alpha.StringLabel string_label = 1; */ diff --git a/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts b/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts new file mode 100644 index 00000000..72ee30e7 --- /dev/null +++ b/packages/cre-sdk/src/sdk/cre/__tests__/confidentialhttp.test.ts @@ -0,0 +1,136 @@ +import { describe, expect, test } from 'bun:test' +import { buildAuthConfig } from '@cre/sdk/cre/confidentialhttp' + +describe('buildAuthConfig', () => { + test('apiKey variant', () => { + const a = buildAuthConfig({ + kind: 'apiKey', + headerName: 'x-api-key', + secretName: '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('') + }) + + test('apiKey with valuePrefix', () => { + const a = buildAuthConfig({ + kind: 'apiKey', + headerName: 'Authorization', + secretName: 'tok', + valuePrefix: 'ApiKey ', + }) + if (a.method.case !== 'apiKey') throw new Error('narrow') + expect(a.method.value.valuePrefix).toBe('ApiKey ') + }) + + test('basic variant', () => { + const a = buildAuthConfig({ + kind: 'basic', + usernameSecretName: 'u', + passwordSecretName: 'p', + }) + expect(a.method.case).toBe('basic') + }) + + test('bearer with overrides', () => { + const a = buildAuthConfig({ + kind: 'bearer', + tokenSecretName: '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 ') + }) + + test('hmacSha256', () => { + const a = buildAuthConfig({ + kind: 'hmacSha256', + secretName: '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') + }) + + test('awsSigV4 with all options', () => { + const a = buildAuthConfig({ + kind: 'awsSigV4', + accessKeyIdSecretName: 'ak', + secretAccessKeySecretName: 'sk', + sessionTokenSecretName: '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) + }) + + test('hmacCustom sha512', () => { + const a = buildAuthConfig({ + kind: 'hmacCustom', + secretName: '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 ') + }) + + test('oauth2 clientCredentials', () => { + const a = buildAuthConfig({ + kind: 'oauth2ClientCredentials', + tokenUrl: 'https://idp/token', + clientIdSecretName: 'cid', + clientSecretSecretName: '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') + }) + + test('oauth2 refreshToken', () => { + const a = buildAuthConfig({ + kind: 'oauth2RefreshToken', + tokenUrl: 'https://idp/token', + refreshTokenSecretName: 'rt', + clientIdSecretName: 'cid', + clientSecretSecretName: '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') + }) +}) diff --git a/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts b/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts new file mode 100644 index 00000000..3c370197 --- /dev/null +++ b/packages/cre-sdk/src/sdk/cre/confidentialhttp.ts @@ -0,0 +1,307 @@ +/** + * 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). + */ + +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, +} from '@cre/generated/capabilities/networking/confidentialhttp/v1alpha/client_pb' + +// ----------------------------------------------------------------------------- +// Discriminated union — the ergonomic input type for workflow authors. +// ----------------------------------------------------------------------------- + +export type AuthConfigInput = + | ApiKeyAuthInput + | BasicAuthInput + | BearerAuthInput + | HmacSha256Input + | AwsSigV4Input + | HmacCustomInput + | OAuth2ClientCredentialsInput + | OAuth2RefreshTokenInput + +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 + /** Optional prefix, e.g. "ApiKey " or "Token ". Default: empty. */ + valuePrefix?: string +} + +export type BasicAuthInput = { + kind: 'basic' + usernameSecretName: string + passwordSecretName: string +} + +export type BearerAuthInput = { + kind: 'bearer' + tokenSecretName: string + /** Default "Authorization". */ + headerName?: string + /** Default "Bearer ". */ + valuePrefix?: string +} + +export type HmacSha256Input = { + kind: 'hmacSha256' + secretName: string + /** Default "X-Signature". */ + signatureHeader?: string + /** Default "X-Timestamp". */ + timestampHeader?: string + includeQuery?: boolean + /** "hex" (default) or "base64". */ + encoding?: 'hex' | 'base64' +} + +export type AwsSigV4Input = { + kind: 'awsSigV4' + accessKeyIdSecretName: string + secretAccessKeySecretName: string + /** Optional STS session token. */ + sessionTokenSecretName?: string + 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. */ + canonicalTemplate: string + hash: 'sha256' | 'sha512' + /** "hex" (default) or "base64". */ + encoding?: 'hex' | 'base64' + signatureHeader: string + signaturePrefix?: string + timestampHeader?: string + nonceHeader?: string +} + +export type OAuth2ClientCredentialsInput = { + kind: 'oauth2ClientCredentials' + /** Must be https://. */ + tokenUrl: string + clientIdSecretName: string + clientSecretSecretName: string + scopes?: string[] + audience?: string + /** How to send client creds to the token endpoint. Default 'basicAuth'. */ + clientAuthMethod?: 'basicAuth' | 'requestBody' + extraParams?: Record +} + +export type OAuth2RefreshTokenInput = { + kind: 'oauth2RefreshToken' + tokenUrl: string + refreshTokenSecretName: string + clientIdSecretName?: string + clientSecretSecretName?: string + scopes?: string[] + extraParams?: Record +} + +// ----------------------------------------------------------------------------- +// buildAuthConfig — factory that converts the union into an AuthConfig proto. +// ----------------------------------------------------------------------------- + +/** + * Convert a workflow-author-friendly AuthConfigInput into the proto + * AuthConfig expected by the ConfidentialHTTPRequest. + * + * @example + * const auth = buildAuthConfig({ + * kind: 'apiKey', + * headerName: 'x-api-key', + * secretName: 'coingecko_api_key', + * }) + */ +export function buildAuthConfig(input: AuthConfigInput): AuthConfig { + switch (input.kind) { + case 'apiKey': + return authFromApiKey(input) + case 'basic': + return authFromBasic(input) + case 'bearer': + return authFromBearer(input) + case 'hmacSha256': + return authFromHmacSha256(input) + case 'awsSigV4': + return authFromAwsSigV4(input) + case 'hmacCustom': + return authFromHmacCustom(input) + case 'oauth2ClientCredentials': + return authFromOAuth2ClientCredentials(input) + case 'oauth2RefreshToken': + return authFromOAuth2RefreshToken(input) + } +} + +function authFromApiKey(i: ApiKeyAuthInput): AuthConfig { + const a: ApiKeyAuth = { + $typeName: 'capabilities.networking.confidentialhttp.v1alpha.ApiKeyAuth', + headerName: i.headerName, + secretName: i.secretName, + 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, + } + return { + $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', + method: { case: 'basic', value: a }, + } +} + +function authFromBearer(i: BearerAuthInput): AuthConfig { + const a: BearerAuth = { + $typeName: 'capabilities.networking.confidentialhttp.v1alpha.BearerAuth', + tokenSecretName: i.tokenSecretName, + 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, + 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 ?? '', + 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 }, + } +} + +function authFromHmacCustom(i: HmacCustomInput): AuthConfig { + const v: HmacCustom = { + $typeName: 'capabilities.networking.confidentialhttp.v1alpha.HmacCustom', + secretName: i.secretName, + canonicalTemplate: i.canonicalTemplate, + hash: i.hash === 'sha512' ? HmacCustom_Hash.SHA512 : HmacCustom_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', + tokenUrl: i.tokenUrl, + clientIdSecretName: i.clientIdSecretName, + clientSecretSecretName: i.clientSecretSecretName, + scopes: i.scopes ?? [], + audience: i.audience ?? '', + 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', + tokenUrl: i.tokenUrl, + refreshTokenSecretName: i.refreshTokenSecretName, + clientIdSecretName: i.clientIdSecretName ?? '', + clientSecretSecretName: i.clientSecretSecretName ?? '', + scopes: i.scopes ?? [], + extraParams: i.extraParams ?? {}, + } + const oauth: OAuth2Auth = { + $typeName: 'capabilities.networking.confidentialhttp.v1alpha.OAuth2Auth', + variant: { case: 'refreshToken', value: v }, + } + return { + $typeName: 'capabilities.networking.confidentialhttp.v1alpha.AuthConfig', + method: { case: 'oauth2', value: oauth }, + } +} diff --git a/packages/cre-sdk/src/sdk/cre/index.ts b/packages/cre-sdk/src/sdk/cre/index.ts index 270e8ede..27165a51 100644 --- a/packages/cre-sdk/src/sdk/cre/index.ts +++ b/packages/cre-sdk/src/sdk/cre/index.ts @@ -29,6 +29,18 @@ export { } from '@cre/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen' // Confidential HTTP Capability export { ClientCapability as ConfidentialHTTPClient } from '@cre/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen' +export { + type AuthConfigInput, + type ApiKeyAuthInput, + type BasicAuthInput, + type BearerAuthInput, + type HmacSha256Input, + type AwsSigV4Input, + type HmacCustomInput, + type OAuth2ClientCredentialsInput, + type OAuth2RefreshTokenInput, + buildAuthConfig, +} from '@cre/sdk/cre/confidentialhttp' // HTTP Capability export { ClientCapability as HTTPClient, 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 da5b3d9d..0352db71 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,252 +1,130 @@ -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' +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" /** * 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 8fcc3d37..064e222d 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,71 +1,53 @@ -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' +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" /** * 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 675f5a9b..73c12e55 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,71 +1,53 @@ -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' +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" /** * 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 8c9e2567..e906a39e 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,94 +1,65 @@ -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' +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" /** * 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 bf8e9deb..0965e4f6 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,71 +1,53 @@ -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' +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" /** * 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 05290851..e617dbfb 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,74 +1,53 @@ -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' +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" /** * 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 e6cb757f..78f8fe03 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,71 +1,53 @@ -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' +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" /** * 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 52e25d83..d593ba4e 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 { 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' +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" diff --git a/submodules/chainlink-protos b/submodules/chainlink-protos index faea187e..a16fdc32 160000 --- a/submodules/chainlink-protos +++ b/submodules/chainlink-protos @@ -1 +1 @@ -Subproject commit faea187e6997e00852cad8046c09b7b2d0f1e128 +Subproject commit a16fdc328bcd4185951bcda8e9dcc1c3b38e76d2