From 884ce87175d7b30d61ae320ca19ce3c6bcdb50ab Mon Sep 17 00:00:00 2001 From: Chris Constable Date: Mon, 13 Jul 2026 14:54:34 -0400 Subject: [PATCH 1/6] feat(extstore): Add extstore store/retrieve to pipeline via LoadedDataConverter. Later, we can add ExternalStorage config to DataConverter to 'enable' it. --- .../common/src/converter/data-converter.ts | 7 ++ .../external-storage-visitor.ts | 67 ++++++++++++++++ .../common/src/internal-non-workflow/index.ts | 1 + packages/test/src/test-extstore-visit.ts | 78 +++++++++++++++++++ .../test/src/test-workflow-codec-runner.ts | 5 +- packages/worker/src/worker.ts | 20 ++++- packages/worker/src/workflow-codec-runner.ts | 6 +- 7 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 packages/common/src/internal-non-workflow/external-storage-visitor.ts create mode 100644 packages/test/src/test-extstore-visit.ts diff --git a/packages/common/src/converter/data-converter.ts b/packages/common/src/converter/data-converter.ts index 9ffd375770..2fbdd25bcf 100644 --- a/packages/common/src/converter/data-converter.ts +++ b/packages/common/src/converter/data-converter.ts @@ -1,3 +1,4 @@ +import type { ExternalStorage } from './extstore'; import type { FailureConverter } from './failure-converter'; import { DefaultFailureConverter } from './failure-converter'; import type { PayloadCodec } from './payload-codec'; @@ -60,6 +61,12 @@ export interface LoadedDataConverter { payloadConverter: PayloadConverter; failureConverter: FailureConverter; payloadCodecs: PayloadCodec[]; + + /** + * @internal + * @experimental + */ + externalStorage?: ExternalStorage; } /** diff --git a/packages/common/src/internal-non-workflow/external-storage-visitor.ts b/packages/common/src/internal-non-workflow/external-storage-visitor.ts new file mode 100644 index 0000000000..03cca45268 --- /dev/null +++ b/packages/common/src/internal-non-workflow/external-storage-visitor.ts @@ -0,0 +1,67 @@ +/** + * Visits payloads for External Storage and applies payload transformations via + * {@link ExternalStorageRunner}. + * + * @module + */ +import type { coresdk } from '@temporalio/proto'; + +import type { ConcurrencyLimit } from '../concurrency/limit'; +import type { ExternalStorage, StorageDriverTargetInfo } from '../converter/extstore'; +import { ExternalStorageRunner } from './external-storage-runner'; +import { visitWorkflowActivation, visitWorkflowActivationCompletion } from './payload-visitor'; + +/** + * Offload every eligible payload in a `WorkflowActivationCompletion` to external storage, + * replacing it in place with a reference payload. + * + * @internal + * @experimental + */ +export function storeWorkflowActivationCompletion( + externalStorage: ExternalStorage, + completion: coresdk.workflow_completion.IWorkflowActivationCompletion, + { + target, + limit, + abortSignal, + }: { + /** Identity of the workflow / activity that produced the payloads, used for object naming. */ + target?: StorageDriverTargetInfo; + /** Bounds concurrent transform calls across payload sites. Omit for sequential. */ + limit?: ConcurrencyLimit; + /** Aborts the walk and every in-flight driver call. */ + abortSignal?: AbortSignal; + } = {} +): Promise { + const runner = new ExternalStorageRunner(externalStorage); + return visitWorkflowActivationCompletion(completion, { + transformPayloads: (payloads, _context, signal) => runner.store(payloads, { target, abortSignal: signal }), + transformPayload: (payload, _context, signal) => + runner.store([payload], { target, abortSignal: signal }).then((stored) => stored[0]!), + limit, + abortSignal, + }); +} + +/** + * Replace every reference payload in a `WorkflowActivation` with the payload bytes fetched + * from external storage, in place. + * + * @internal + * @experimental + */ +export function retrieveWorkflowActivation( + externalStorage: ExternalStorage, + activation: coresdk.workflow_activation.IWorkflowActivation, + { limit, abortSignal }: { limit?: ConcurrencyLimit; abortSignal?: AbortSignal } = {} +): Promise { + const runner = new ExternalStorageRunner(externalStorage); + return visitWorkflowActivation(activation, { + transformPayloads: (payloads, _context, signal) => runner.retrieve(payloads, { abortSignal: signal }), + transformPayload: (payload, _context, signal) => + runner.retrieve([payload], { abortSignal: signal }).then((retrieved) => retrieved[0]!), + limit, + abortSignal, + }); +} diff --git a/packages/common/src/internal-non-workflow/index.ts b/packages/common/src/internal-non-workflow/index.ts index cc2c2bc1f7..772fbc9228 100644 --- a/packages/common/src/internal-non-workflow/index.ts +++ b/packages/common/src/internal-non-workflow/index.ts @@ -8,6 +8,7 @@ export * from './codec-types'; export * from './data-converter-helpers'; export * from './extstore-helpers'; export * from './external-storage-runner'; +export * from './external-storage-visitor'; export * from './parse-host-uri'; export * from './proxy-config'; export * from './tls-config'; diff --git a/packages/test/src/test-extstore-visit.ts b/packages/test/src/test-extstore-visit.ts new file mode 100644 index 0000000000..b8a0688a22 --- /dev/null +++ b/packages/test/src/test-extstore-visit.ts @@ -0,0 +1,78 @@ +/* eslint @typescript-eslint/no-non-null-assertion: 0 */ +import test from 'ava'; +import type { Payload } from '@temporalio/common'; +import { ExternalStorage } from '@temporalio/common/lib/converter/extstore'; +import { + isReferencePayload, + retrieveWorkflowActivation, + storeWorkflowActivationCompletion, +} from '@temporalio/common/lib/internal-non-workflow'; +import { encode } from '@temporalio/common/lib/encoding'; +import { METADATA_ENCODING_KEY } from '@temporalio/common/lib/converter/types'; +import { coresdk } from '@temporalio/proto'; +import { makeFakeDriver } from './extstore-fake-driver'; + +/** Build a Payload whose proto-encoded size is at least `bodyBytes`, filled with `fill`. */ +function makePayload(bodyBytes: number, fill = 0): Payload { + return { + metadata: { [METADATA_ENCODING_KEY]: encode('binary/plain') }, + data: new Uint8Array(bodyBytes).fill(fill), + }; +} + +function externalStorageWith(driver = makeFakeDriver({ name: 's3' }), payloadSizeThreshold = 96) { + return { driver, externalStorage: new ExternalStorage({ drivers: [driver], payloadSizeThreshold }) }; +} + +const WORKFLOW_TARGET = { kind: 'workflow', namespace: 'ns', id: 'wf-1', runId: 'run-1' } as const; + +test('store offloads a large payload at a singular site and threads the target to the driver', async (t) => { + const { driver, externalStorage } = externalStorageWith(); + const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { + successful: { commands: [{ completeWorkflowExecution: { result: makePayload(256) } }] }, + }; + + await storeWorkflowActivationCompletion(externalStorage, completion, { target: WORKFLOW_TARGET }); + + const result = completion.successful!.commands![0]!.completeWorkflowExecution!.result!; + t.true(isReferencePayload(result)); + t.is(driver.storeCalls.length, 1); + t.deepEqual(driver.storeCalls[0]!.context.target, WORKFLOW_TARGET); +}); + +test('store offloads only above-threshold payloads at a repeated site', async (t) => { + const { externalStorage } = externalStorageWith(); + const small = makePayload(0); + const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { + successful: { commands: [{ scheduleActivity: { arguments: [makePayload(256), small] } }] }, + }; + + await storeWorkflowActivationCompletion(externalStorage, completion, { target: WORKFLOW_TARGET }); + + const args = completion.successful!.commands![0]!.scheduleActivity!.arguments!; + t.true(isReferencePayload(args[0]!)); + t.deepEqual(args[1], small); +}); + +test('store then retrieve round-trips the original payload bytes through a worker message', async (t) => { + const { driver, externalStorage } = externalStorageWith(); + const original = makePayload(256, 7); + const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { + successful: { commands: [{ completeWorkflowExecution: { result: original } }] }, + }; + + await storeWorkflowActivationCompletion(externalStorage, completion, { target: WORKFLOW_TARGET }); + const reference = completion.successful!.commands![0]!.completeWorkflowExecution!.result!; + t.true(isReferencePayload(reference)); + + // The reference produced on the outbound path arrives back on a later inbound activation. + const activation: coresdk.workflow_activation.IWorkflowActivation = { + jobs: [{ resolveActivity: { result: { completed: { result: reference } } } }], + }; + await retrieveWorkflowActivation(externalStorage, activation); + + const retrieved = activation.jobs![0]!.resolveActivity!.result!.completed!.result!; + t.false(isReferencePayload(retrieved)); + t.deepEqual(retrieved, original); + t.is(driver.retrieveCalls.length, 1); +}); diff --git a/packages/test/src/test-workflow-codec-runner.ts b/packages/test/src/test-workflow-codec-runner.ts index 1ab455c55e..090106de6d 100644 --- a/packages/test/src/test-workflow-codec-runner.ts +++ b/packages/test/src/test-workflow-codec-runner.ts @@ -20,7 +20,10 @@ function failureWithDetail(label: string) { ); } -function decodeCompletion(bytes: Uint8Array): coresdk.workflow_completion.WorkflowActivationCompletion { +function decodeCompletion( + completion: coresdk.workflow_completion.IWorkflowActivationCompletion +): coresdk.workflow_completion.WorkflowActivationCompletion { + const bytes = coresdk.workflow_completion.WorkflowActivationCompletion.encodeDelimited(completion).finish(); return coresdk.workflow_completion.WorkflowActivationCompletion.decodeDelimited(bytes); } diff --git a/packages/worker/src/worker.ts b/packages/worker/src/worker.ts index 06a11f029d..9d3113d544 100644 --- a/packages/worker/src/worker.ts +++ b/packages/worker/src/worker.ts @@ -31,6 +31,8 @@ import { decodeFromPayloadsAtIndex, encodeErrorToFailure, encodeToPayload, + retrieveWorkflowActivation, + storeWorkflowActivationCompletion, } from '@temporalio/common/lib/internal-non-workflow'; import { historyFromJSON } from '@temporalio/common/lib/proto-utils'; import type { Duration } from '@temporalio/common/lib/time'; @@ -1441,6 +1443,10 @@ export class Worker { workflowId, }); } + const { externalStorage } = this.options.loadedDataConverter; + if (externalStorage) { + await retrieveWorkflowActivation(externalStorage, activation); + } const decodedActivation = await workflowCodecRunner.decodeActivation(activation); if (workflow === undefined) { @@ -1456,7 +1462,19 @@ export class Worker { let isFatalError = false; try { const unencodedCompletion = await workflow.workflow.activate(decodedActivation); - const completion = await workflowCodecRunner.encodeCompletion(unencodedCompletion); + const encodedCompletion = await workflowCodecRunner.encodeCompletion(unencodedCompletion); + if (externalStorage) { + await storeWorkflowActivationCompletion(externalStorage, encodedCompletion, { + target: { + kind: 'workflow', + namespace: workflowCodecRunner.workflowContext.namespace, + id: workflowCodecRunner.workflowContext.workflowId, + runId: activation.runId, + }, + }); + } + const completion = + coresdk.workflow_completion.WorkflowActivationCompletion.encodeDelimited(encodedCompletion).finish(); return { state: workflow, output: { close, completion } }; } catch (err) { diff --git a/packages/worker/src/workflow-codec-runner.ts b/packages/worker/src/workflow-codec-runner.ts index 0be766213a..206a497cc2 100644 --- a/packages/worker/src/workflow-codec-runner.ts +++ b/packages/worker/src/workflow-codec-runner.ts @@ -34,7 +34,7 @@ export class WorkflowCodecRunner { constructor( private readonly codecs: PayloadCodec[], - private readonly workflowContext: WorkflowSerializationContext + public readonly workflowContext: WorkflowSerializationContext ) {} private consumeContext( @@ -368,7 +368,7 @@ export class WorkflowCodecRunner { */ public async encodeCompletion( completion: coresdk.workflow_completion.IWorkflowActivationCompletion - ): Promise { + ): Promise> { const encodedCompletion: Encoded = { ...completion, failed: completion.failed @@ -608,6 +608,6 @@ export class WorkflowCodecRunner { : null, }; - return coresdk.workflow_completion.WorkflowActivationCompletion.encodeDelimited(encodedCompletion).finish(); + return encodedCompletion; } } From ad2abb72ed3602ff565e58eafbb65b3b598cf0ce Mon Sep 17 00:00:00 2001 From: Chris Constable Date: Wed, 15 Jul 2026 13:50:01 -0400 Subject: [PATCH 2/6] fix lint issues --- packages/common/src/converter/data-converter.ts | 2 +- packages/test/src/test-extstore-visit.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/src/converter/data-converter.ts b/packages/common/src/converter/data-converter.ts index 2fbdd25bcf..e242380d74 100644 --- a/packages/common/src/converter/data-converter.ts +++ b/packages/common/src/converter/data-converter.ts @@ -61,7 +61,7 @@ export interface LoadedDataConverter { payloadConverter: PayloadConverter; failureConverter: FailureConverter; payloadCodecs: PayloadCodec[]; - + /** * @internal * @experimental diff --git a/packages/test/src/test-extstore-visit.ts b/packages/test/src/test-extstore-visit.ts index b8a0688a22..8af910ec4c 100644 --- a/packages/test/src/test-extstore-visit.ts +++ b/packages/test/src/test-extstore-visit.ts @@ -9,7 +9,7 @@ import { } from '@temporalio/common/lib/internal-non-workflow'; import { encode } from '@temporalio/common/lib/encoding'; import { METADATA_ENCODING_KEY } from '@temporalio/common/lib/converter/types'; -import { coresdk } from '@temporalio/proto'; +import type { coresdk } from '@temporalio/proto'; import { makeFakeDriver } from './extstore-fake-driver'; /** Build a Payload whose proto-encoded size is at least `bodyBytes`, filled with `fill`. */ From 3fa04ca0ef1ccff3e469fbc48d5c798d000ec66e Mon Sep 17 00:00:00 2001 From: Chris Constable Date: Fri, 17 Jul 2026 12:07:53 -0400 Subject: [PATCH 3/6] add extstore to nexus and activity pipelines. --- .../external-storage-visitor.ts | 68 +++++----- .../common/src/internal-non-workflow/index.ts | 1 + .../internal-non-workflow/payload-visitor.ts | 59 +++++++++ packages/test/src/test-extstore-visit.ts | 117 ++++++++++++++++-- packages/worker/src/worker.ts | 89 +++++++++++-- 5 files changed, 276 insertions(+), 58 deletions(-) diff --git a/packages/common/src/internal-non-workflow/external-storage-visitor.ts b/packages/common/src/internal-non-workflow/external-storage-visitor.ts index 03cca45268..1ae2ad235b 100644 --- a/packages/common/src/internal-non-workflow/external-storage-visitor.ts +++ b/packages/common/src/internal-non-workflow/external-storage-visitor.ts @@ -1,67 +1,67 @@ /** - * Visits payloads for External Storage and applies payload transformations via + * Visits payloads for External Storage and applies payload transformations via ║ * {@link ExternalStorageRunner}. * * @module */ -import type { coresdk } from '@temporalio/proto'; - import type { ConcurrencyLimit } from '../concurrency/limit'; import type { ExternalStorage, StorageDriverTargetInfo } from '../converter/extstore'; import { ExternalStorageRunner } from './external-storage-runner'; -import { visitWorkflowActivation, visitWorkflowActivationCompletion } from './payload-visitor'; +import type { ContextDeriver, VisitOptions } from './payload-visitor'; + +/** + * The storage target in scope at a given payload site during a store walk. It starts at + * {@link ExternalStorageStoreOptions.initialTarget} and {@link ExternalStorageStoreOptions.deriveContext} + * may retarget it per message (e.g. a child-workflow command retargets its payloads at the child). + */ +type StoreTarget = StorageDriverTargetInfo | undefined; + +/** @internal @experimental */ +export interface ExternalStorageStoreOptions { + /** Storage target before any message is entered (the initial enclosing workflow / activity). */ + initialTarget?: StorageDriverTargetInfo; + /** Derives new storage target from the current message. */ + deriveContext?: ContextDeriver; + /** Bounds concurrent transform calls across payload sites. Omit for sequential. */ + limit?: ConcurrencyLimit; + /** Aborts the walk and every in-flight driver call. */ + abortSignal?: AbortSignal; +} /** - * Offload every eligible payload in a `WorkflowActivationCompletion` to external storage, - * replacing it in place with a reference payload. - * * @internal * @experimental */ -export function storeWorkflowActivationCompletion( +export function extstoreStoreOptions( externalStorage: ExternalStorage, - completion: coresdk.workflow_completion.IWorkflowActivationCompletion, - { - target, - limit, - abortSignal, - }: { - /** Identity of the workflow / activity that produced the payloads, used for object naming. */ - target?: StorageDriverTargetInfo; - /** Bounds concurrent transform calls across payload sites. Omit for sequential. */ - limit?: ConcurrencyLimit; - /** Aborts the walk and every in-flight driver call. */ - abortSignal?: AbortSignal; - } = {} -): Promise { + { initialTarget, deriveContext, limit, abortSignal }: ExternalStorageStoreOptions = {} +): VisitOptions { const runner = new ExternalStorageRunner(externalStorage); - return visitWorkflowActivationCompletion(completion, { - transformPayloads: (payloads, _context, signal) => runner.store(payloads, { target, abortSignal: signal }), - transformPayload: (payload, _context, signal) => + return { + transformPayloads: (payloads, target, signal) => runner.store(payloads, { target, abortSignal: signal }), + transformPayload: (payload, target, signal) => runner.store([payload], { target, abortSignal: signal }).then((stored) => stored[0]!), + deriveContext, + initialContext: initialTarget, limit, abortSignal, - }); + }; } /** - * Replace every reference payload in a `WorkflowActivation` with the payload bytes fetched - * from external storage, in place. - * * @internal * @experimental */ -export function retrieveWorkflowActivation( +export function extstoreRetrieveOptions( externalStorage: ExternalStorage, - activation: coresdk.workflow_activation.IWorkflowActivation, { limit, abortSignal }: { limit?: ConcurrencyLimit; abortSignal?: AbortSignal } = {} -): Promise { +): VisitOptions { const runner = new ExternalStorageRunner(externalStorage); - return visitWorkflowActivation(activation, { + return { transformPayloads: (payloads, _context, signal) => runner.retrieve(payloads, { abortSignal: signal }), transformPayload: (payload, _context, signal) => runner.retrieve([payload], { abortSignal: signal }).then((retrieved) => retrieved[0]!), limit, abortSignal, - }); + }; } diff --git a/packages/common/src/internal-non-workflow/index.ts b/packages/common/src/internal-non-workflow/index.ts index 772fbc9228..b938649deb 100644 --- a/packages/common/src/internal-non-workflow/index.ts +++ b/packages/common/src/internal-non-workflow/index.ts @@ -9,6 +9,7 @@ export * from './data-converter-helpers'; export * from './extstore-helpers'; export * from './external-storage-runner'; export * from './external-storage-visitor'; +export * from './payload-visitor'; export * from './parse-host-uri'; export * from './proxy-config'; export * from './tls-config'; diff --git a/packages/common/src/internal-non-workflow/payload-visitor.ts b/packages/common/src/internal-non-workflow/payload-visitor.ts index c367aac426..8bd845e9f5 100644 --- a/packages/common/src/internal-non-workflow/payload-visitor.ts +++ b/packages/common/src/internal-non-workflow/payload-visitor.ts @@ -1,5 +1,9 @@ import type { coresdk } from '@temporalio/proto'; import { + walkActivityTask, + walkActivityTaskCompletion, + walkNexusTask, + walkNexusTaskCompletion, walkWorkflowActivation, walkWorkflowActivationCompletion, type WalkEnv, @@ -160,3 +164,58 @@ export async function visitWorkflowActivationCompletion( ): Promise { return runVisit(options, (env, context) => walkWorkflowActivationCompletion(root, env, context)); } + +/** + * Applies the payload transforms to every {@link Payload} in an `ActivityTask` (activity input and + * last-recorded heartbeat details), mutating it in place. + * + * @internal + * @experimental + */ +export async function visitActivityTask( + root: coresdk.activity_task.IActivityTask, + options: VisitOptions +): Promise { + return runVisit(options, (env, context) => walkActivityTask(root, env, context)); +} + +/** + * Applies the payload transforms to every {@link Payload} in an `ActivityTaskCompletion` (the activity + * result / failure), mutating it in place. + * + * @internal + * @experimental + */ +export async function visitActivityTaskCompletion( + root: coresdk.IActivityTaskCompletion, + options: VisitOptions +): Promise { + return runVisit(options, (env, context) => walkActivityTaskCompletion(root, env, context)); +} + +/** + * Applies the payload transforms to every {@link Payload} in a `NexusTask`, mutating it in place. + * + * @internal + * @experimental + */ +export async function visitNexusTask( + root: coresdk.nexus.INexusTask, + options: VisitOptions +): Promise { + return runVisit(options, (env, context) => walkNexusTask(root, env, context)); +} + +/** + * Applies the payload transforms to every {@link Payload} in a `NexusTaskCompletion`, mutating it in + * place. + * + * @internal + * @experimental + */ +export async function visitNexusTaskCompletion( + root: coresdk.nexus.INexusTaskCompletion, + options: VisitOptions +): Promise { + return runVisit(options, (env, context) => walkNexusTaskCompletion(root, env, context)); +} diff --git a/packages/test/src/test-extstore-visit.ts b/packages/test/src/test-extstore-visit.ts index 8af910ec4c..6f3b6b3bac 100644 --- a/packages/test/src/test-extstore-visit.ts +++ b/packages/test/src/test-extstore-visit.ts @@ -3,9 +3,16 @@ import test from 'ava'; import type { Payload } from '@temporalio/common'; import { ExternalStorage } from '@temporalio/common/lib/converter/extstore'; import { + ExternalStorageRunner, + extstoreRetrieveOptions, + extstoreStoreOptions, isReferencePayload, - retrieveWorkflowActivation, - storeWorkflowActivationCompletion, + visitActivityTask, + visitActivityTaskCompletion, + visitNexusTask, + visitNexusTaskCompletion, + visitWorkflowActivation, + visitWorkflowActivationCompletion, } from '@temporalio/common/lib/internal-non-workflow'; import { encode } from '@temporalio/common/lib/encoding'; import { METADATA_ENCODING_KEY } from '@temporalio/common/lib/converter/types'; @@ -24,15 +31,24 @@ function externalStorageWith(driver = makeFakeDriver({ name: 's3' }), payloadSiz return { driver, externalStorage: new ExternalStorage({ drivers: [driver], payloadSizeThreshold }) }; } +/** Offload a payload through the runner and return the resulting reference payload. */ +async function toReference(externalStorage: ExternalStorage, payload: Payload): Promise { + const [reference] = await new ExternalStorageRunner(externalStorage).store([payload]); + return reference!; +} + const WORKFLOW_TARGET = { kind: 'workflow', namespace: 'ns', id: 'wf-1', runId: 'run-1' } as const; -test('store offloads a large payload at a singular site and threads the target to the driver', async (t) => { +test('workflow store offloads a large payload and threads the target to the driver', async (t) => { const { driver, externalStorage } = externalStorageWith(); const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { successful: { commands: [{ completeWorkflowExecution: { result: makePayload(256) } }] }, }; - await storeWorkflowActivationCompletion(externalStorage, completion, { target: WORKFLOW_TARGET }); + await visitWorkflowActivationCompletion( + completion, + extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) + ); const result = completion.successful!.commands![0]!.completeWorkflowExecution!.result!; t.true(isReferencePayload(result)); @@ -40,39 +56,118 @@ test('store offloads a large payload at a singular site and threads the target t t.deepEqual(driver.storeCalls[0]!.context.target, WORKFLOW_TARGET); }); -test('store offloads only above-threshold payloads at a repeated site', async (t) => { +test('workflow store offloads only above-threshold payloads at a repeated site', async (t) => { const { externalStorage } = externalStorageWith(); const small = makePayload(0); const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { successful: { commands: [{ scheduleActivity: { arguments: [makePayload(256), small] } }] }, }; - await storeWorkflowActivationCompletion(externalStorage, completion, { target: WORKFLOW_TARGET }); + await visitWorkflowActivationCompletion( + completion, + extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) + ); const args = completion.successful!.commands![0]!.scheduleActivity!.arguments!; t.true(isReferencePayload(args[0]!)); t.deepEqual(args[1], small); }); -test('store then retrieve round-trips the original payload bytes through a worker message', async (t) => { +test('workflow store applies a per-command derived target', async (t) => { const { driver, externalStorage } = externalStorageWith(); + const childTarget = { kind: 'workflow', namespace: 'ns', id: 'child-1' } as const; + const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { + successful: { + commands: [ + { completeWorkflowExecution: { result: makePayload(256, 1) } }, + { startChildWorkflowExecution: { workflowId: 'child-1', input: [makePayload(256, 2)] } }, + ], + }, + }; + + await visitWorkflowActivationCompletion( + completion, + extstoreStoreOptions(externalStorage, { + initialTarget: WORKFLOW_TARGET, + // Stand-in for the worker's command→target mapping: the child command retargets its payloads. + deriveContext: (_message, typeName, context) => + typeName === 'coresdk.workflow_commands.StartChildWorkflowExecution' ? childTarget : context, + }) + ); + + const targets = driver.storeCalls.map((call) => call.context.target?.id); + t.true(targets.includes('wf-1'), 'workflow result stored against the workflow'); + t.true(targets.includes('child-1'), 'child input stored against the child workflow'); +}); + +test('workflow store then retrieve round-trips the original payload bytes', async (t) => { + const { externalStorage } = externalStorageWith(); const original = makePayload(256, 7); const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { successful: { commands: [{ completeWorkflowExecution: { result: original } }] }, }; - await storeWorkflowActivationCompletion(externalStorage, completion, { target: WORKFLOW_TARGET }); + await visitWorkflowActivationCompletion( + completion, + extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) + ); const reference = completion.successful!.commands![0]!.completeWorkflowExecution!.result!; t.true(isReferencePayload(reference)); - // The reference produced on the outbound path arrives back on a later inbound activation. const activation: coresdk.workflow_activation.IWorkflowActivation = { jobs: [{ resolveActivity: { result: { completed: { result: reference } } } }], }; - await retrieveWorkflowActivation(externalStorage, activation); + await visitWorkflowActivation(activation, extstoreRetrieveOptions(externalStorage)); const retrieved = activation.jobs![0]!.resolveActivity!.result!.completed!.result!; t.false(isReferencePayload(retrieved)); t.deepEqual(retrieved, original); - t.is(driver.retrieveCalls.length, 1); +}); + +test('activity task completion store offloads the result payload', async (t) => { + const { driver, externalStorage } = externalStorageWith(); + const completion: coresdk.IActivityTaskCompletion = { + taskToken: new Uint8Array([1]), + result: { completed: { result: makePayload(256) } }, + }; + + await visitActivityTaskCompletion(completion, extstoreStoreOptions(externalStorage)); + + t.true(isReferencePayload(completion.result!.completed!.result!)); + t.is(driver.storeCalls.length, 1); +}); + +test('activity task retrieve resolves the activity input', async (t) => { + const { externalStorage } = externalStorageWith(); + const input = makePayload(256, 3); + const task: coresdk.activity_task.IActivityTask = { + start: { input: [await toReference(externalStorage, input)] }, + }; + + await visitActivityTask(task, extstoreRetrieveOptions(externalStorage)); + + t.deepEqual(task.start!.input![0], input); +}); + +test('nexus task completion store offloads the sync result payload', async (t) => { + const { externalStorage } = externalStorageWith(); + const completion: coresdk.nexus.INexusTaskCompletion = { + completed: { startOperation: { syncSuccess: { payload: makePayload(256) } } }, + }; + + await visitNexusTaskCompletion(completion, extstoreStoreOptions(externalStorage)); + + t.true(isReferencePayload(completion.completed!.startOperation!.syncSuccess!.payload!)); +}); + +test('nexus task retrieve resolves the request payload', async (t) => { + const { externalStorage } = externalStorageWith(); + const requestPayload = makePayload(256, 5); + const task: coresdk.nexus.INexusTask = { + task: { request: { startOperation: { payload: await toReference(externalStorage, requestPayload) } } }, + }; + + await visitNexusTask(task, extstoreRetrieveOptions(externalStorage)); + + t.deepEqual(task.task!.request!.startOperation!.payload, requestPayload); }); diff --git a/packages/worker/src/worker.ts b/packages/worker/src/worker.ts index 9d3113d544..86a4809f8d 100644 --- a/packages/worker/src/worker.ts +++ b/packages/worker/src/worker.ts @@ -31,9 +31,16 @@ import { decodeFromPayloadsAtIndex, encodeErrorToFailure, encodeToPayload, - retrieveWorkflowActivation, - storeWorkflowActivationCompletion, + extstoreRetrieveOptions, + extstoreStoreOptions, + visitActivityTask, + visitActivityTaskCompletion, + visitNexusTask, + visitNexusTaskCompletion, + visitWorkflowActivation, + visitWorkflowActivationCompletion, } from '@temporalio/common/lib/internal-non-workflow'; +import type { StorageDriverTargetInfo } from '@temporalio/common/lib/converter/extstore'; import { historyFromJSON } from '@temporalio/common/lib/proto-utils'; import type { Duration } from '@temporalio/common/lib/time'; import { @@ -1240,7 +1247,13 @@ export class Worker { return { taskToken, result }; }), filter((result: T): result is Exclude => result !== undefined), - map((rest) => coresdk.ActivityTaskCompletion.encodeDelimited(rest).finish()), + mergeMap(async (rest) => { + const { externalStorage } = this.options.loadedDataConverter; + if (externalStorage) { + await visitActivityTaskCompletion(rest, extstoreStoreOptions(externalStorage)); + } + return coresdk.ActivityTaskCompletion.encodeDelimited(rest).finish(); + }), tap({ next: () => { group$.close(); @@ -1296,7 +1309,13 @@ export class Worker { } ), filter((result: T): result is Exclude => result !== undefined), - map((result) => coresdk.nexus.NexusTaskCompletion.encodeDelimited(result).finish()) + mergeMap(async (result) => { + const { externalStorage } = this.options.loadedDataConverter; + if (externalStorage) { + await visitNexusTaskCompletion(result, extstoreStoreOptions(externalStorage)); + } + return coresdk.nexus.NexusTaskCompletion.encodeDelimited(result).finish(); + }) ); } @@ -1445,7 +1464,7 @@ export class Worker { } const { externalStorage } = this.options.loadedDataConverter; if (externalStorage) { - await retrieveWorkflowActivation(externalStorage, activation); + await visitWorkflowActivation(activation, extstoreRetrieveOptions(externalStorage)); } const decodedActivation = await workflowCodecRunner.decodeActivation(activation); @@ -1464,14 +1483,19 @@ export class Worker { const unencodedCompletion = await workflow.workflow.activate(decodedActivation); const encodedCompletion = await workflowCodecRunner.encodeCompletion(unencodedCompletion); if (externalStorage) { - await storeWorkflowActivationCompletion(externalStorage, encodedCompletion, { - target: { - kind: 'workflow', - namespace: workflowCodecRunner.workflowContext.namespace, - id: workflowCodecRunner.workflowContext.workflowId, - runId: activation.runId, - }, - }); + const namespace = workflowCodecRunner.workflowContext.namespace; + await visitWorkflowActivationCompletion( + encodedCompletion, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace, + id: workflowCodecRunner.workflowContext.workflowId, + runId: activation.runId, + }, + deriveContext: workflowCommandStoreTarget(namespace), + }) + ); } const completion = coresdk.workflow_completion.WorkflowActivationCompletion.encodeDelimited(encodedCompletion).finish(); @@ -1893,6 +1917,10 @@ export class Worker { this.hasOutstandingActivityPoll = false; } const task = coresdk.activity_task.ActivityTask.decode(new Uint8Array(buffer)); + const { externalStorage } = this.options.loadedDataConverter; + if (externalStorage) { + await visitActivityTask(task, extstoreRetrieveOptions(externalStorage)); + } const { taskToken, ...rest } = task; const base64TaskToken = formatTaskToken(taskToken); this.logger.trace('Got activity task', { @@ -1942,6 +1970,10 @@ export class Worker { this.hasOutstandingNexusPoll = false; } const task = coresdk.nexus.NexusTask.decode(new Uint8Array(buffer)); + const { externalStorage } = this.options.loadedDataConverter; + if (externalStorage) { + await visitNexusTask(task, extstoreRetrieveOptions(externalStorage)); + } const taskToken = task.task?.taskToken || task.cancelTask?.taskToken; if (taskToken == null) { throw new TypeError('Got a Nexus task without a task token'); @@ -2285,6 +2317,37 @@ async function extractActivityInfo({ }; } +function workflowCommandStoreTarget( + namespace: string +): ( + message: object, + typeName: string, + context: StorageDriverTargetInfo | undefined +) => StorageDriverTargetInfo | undefined { + return (message, typeName, context) => { + switch (typeName) { + case 'coresdk.workflow_commands.StartChildWorkflowExecution': { + const command = message as coresdk.workflow_commands.IStartChildWorkflowExecution; + return command.workflowId + ? { kind: 'workflow', namespace: command.namespace || namespace, id: command.workflowId } + : context; + } + case 'coresdk.workflow_commands.SignalExternalWorkflowExecution': + case 'coresdk.workflow_commands.RequestCancelExternalWorkflowExecution': { + const command = message as coresdk.workflow_commands.ISignalExternalWorkflowExecution & { + childWorkflowId?: string | null; + }; + const workflowId = command.workflowExecution?.workflowId ?? command.childWorkflowId ?? undefined; + return workflowId + ? { kind: 'workflow', namespace: command.workflowExecution?.namespace || namespace, id: workflowId } + : context; + } + default: + return context; + } + }; +} + function activitySerializationContextFromInfo(info: ActivityInfo): ActivitySerializationContext { return { type: 'activity', From f57ad2738ada601e9c8c92badd05fc609874fd39 Mon Sep 17 00:00:00 2001 From: Chris Constable Date: Fri, 17 Jul 2026 17:08:15 -0400 Subject: [PATCH 4/6] add client visitors, continueAsNewWorkflowExecution, and unconditionally create child workflow targets. --- packages/client/src/workflow-client.ts | 126 + .../src/__tests__/test-payload-visitor.ts | 44 +- .../internal-non-workflow/payload-visitor.ts | 92 +- packages/proto/scripts/gen-payload-visitor.ts | 27 +- .../proto/src/payload-visitor.generated.ts | 5717 ++++++++++++++--- packages/test/src/test-extstore-visit.ts | 67 +- packages/worker/src/worker.ts | 36 +- 7 files changed, 5251 insertions(+), 858 deletions(-) diff --git a/packages/client/src/workflow-client.ts b/packages/client/src/workflow-client.ts index 6146bcb5b8..b34058148d 100644 --- a/packages/client/src/workflow-client.ts +++ b/packages/client/src/workflow-client.ts @@ -39,6 +39,21 @@ import { decodeOptionalSinglePayload, encodeMapToPayloads, encodeToPayloadsWithContext, + extstoreRetrieveOptions, + extstoreStoreOptions, + visit, + walkExecuteMultiOperationRequest, + walkExecuteMultiOperationResponse, + walkGetWorkflowExecutionHistoryResponse, + walkPollWorkflowExecutionUpdateResponse, + walkQueryWorkflowRequest, + walkQueryWorkflowResponse, + walkSignalWithStartWorkflowExecutionRequest, + walkSignalWorkflowExecutionRequest, + walkStartWorkflowExecutionRequest, + walkTerminateWorkflowExecutionRequest, + walkUpdateWorkflowExecutionRequest, + walkUpdateWorkflowExecutionResponse, } from '@temporalio/common/lib/internal-non-workflow'; import { filterNullAndUndefined } from '@temporalio/common/lib/internal-workflow'; import { temporal } from '@temporalio/proto'; @@ -818,6 +833,10 @@ export class WorkflowClient extends BaseClient { } catch (err) { this.rethrowGrpcError(err, 'Failed to get Workflow execution history', { workflowId, runId }); } + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit(res, walkGetWorkflowExecutionHistoryResponse, extstoreRetrieveOptions(externalStorage)); + } const events = res.history?.events; if (events == null || events.length === 0) { @@ -962,6 +981,20 @@ export class WorkflowClient extends BaseClient { header: { fields: input.headers }, }, }; + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + req, + walkQueryWorkflowRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace: this.options.namespace, + id: input.workflowExecution.workflowId ?? undefined, + }, + }) + ); + } let response: temporal.api.workflowservice.v1.QueryWorkflowResponse; try { response = await this.workflowService.queryWorkflow(req); @@ -974,6 +1007,9 @@ export class WorkflowClient extends BaseClient { } this.rethrowGrpcError(err, 'Failed to query Workflow', input.workflowExecution); } + if (externalStorage) { + await visit(response, walkQueryWorkflowResponse, extstoreRetrieveOptions(externalStorage)); + } if (response.queryRejected) { if (response.queryRejected.status === undefined || response.queryRejected.status === null) { throw new TypeError('Received queryRejected from server with no status'); @@ -1034,6 +1070,20 @@ export class WorkflowClient extends BaseClient { : UpdateWorkflowExecutionLifecycleStage.UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED; const request = await this._createUpdateWorkflowRequest(waitForStageProto, input); + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + request, + walkUpdateWorkflowExecutionRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace: this.options.namespace, + id: input.workflowExecution.workflowId ?? undefined, + }, + }) + ); + } // Repeatedly send UpdateWorkflowExecution until update is durable (if the server receives a request with // an update ID that already exists, it responds with information for the existing update). If the @@ -1048,6 +1098,9 @@ export class WorkflowClient extends BaseClient { } catch (err) { this.rethrowUpdateGrpcError(err, 'Workflow Update failed', input.workflowExecution); } + if (externalStorage) { + await visit(response, walkUpdateWorkflowExecutionResponse, extstoreRetrieveOptions(externalStorage)); + } return { updateId: request.request!.meta!.updateId!, @@ -1106,8 +1159,25 @@ export class WorkflowClient extends BaseClient { // Repeatedly send ExecuteMultiOperation until update is durable (if the server receives a request with // an update ID that already exists, it responds with information for the existing update). If the // requested wait stage is COMPLETED, further polling is done before returning the UpdateHandle. + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + multiOpReq, + walkExecuteMultiOperationRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace: this.options.namespace, + id: input.workflowStartOptions.workflowId, + }, + }) + ); + } do { multiOpResp = await this.workflowService.executeMultiOperation(multiOpReq); + if (externalStorage) { + await visit(multiOpResp, walkExecuteMultiOperationResponse, extstoreRetrieveOptions(externalStorage)); + } startResp = multiOpResp.responses?.[0] ?.startWorkflow as temporal.api.workflowservice.v1.IStartWorkflowExecutionResponse; if (!seenStart) { @@ -1193,6 +1263,10 @@ export class WorkflowClient extends BaseClient { for (;;) { try { const response = await this.workflowService.pollWorkflowExecutionUpdate(req); + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit(response, walkPollWorkflowExecutionUpdateResponse, extstoreRetrieveOptions(externalStorage)); + } if (response.outcome) { return response.outcome; } @@ -1224,6 +1298,20 @@ export class WorkflowClient extends BaseClient { links: internalOptions?.links, }; try { + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + req, + walkSignalWorkflowExecutionRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace: this.options.namespace, + id: input.workflowExecution.workflowId, + }, + }) + ); + } const response = await this.workflowService.signalWorkflowExecution(req); if (internalOptions != null) { // Servers that support CHASM signal response links (1.31 and up) return a response link @@ -1281,6 +1369,16 @@ export class WorkflowClient extends BaseClient { links: internalOptions?.links, }; try { + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + req, + walkSignalWithStartWorkflowExecutionRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { kind: 'workflow', namespace: this.options.namespace, id: req.workflowId ?? undefined }, + }) + ); + } const response = await this.workflowService.signalWithStartWorkflowExecution(req); if (internalOptions != null) { // Servers that support CHASM signal response links (1.31 and up) return a response link @@ -1310,6 +1408,20 @@ export class WorkflowClient extends BaseClient { const { options: opts, workflowType } = input; const internalOptions = (opts as InternalWorkflowStartOptions)[InternalWorkflowStartOptionsSymbol]; try { + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + req, + walkStartWorkflowExecutionRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace: req.namespace ?? this.options.namespace, + id: req.workflowId ?? undefined, + }, + }) + ); + } const response = await this.workflowService.startWorkflowExecution(req); if (internalOptions != null) { internalOptions.responseLink = response.link ?? undefined; @@ -1401,6 +1513,20 @@ export class WorkflowClient extends BaseClient { firstExecutionRunId: input.firstExecutionRunId, }; try { + const externalStorage = this.dataConverter.externalStorage; + if (externalStorage) { + await visit( + req, + walkTerminateWorkflowExecutionRequest, + extstoreStoreOptions(externalStorage, { + initialTarget: { + kind: 'workflow', + namespace: this.options.namespace, + id: input.workflowExecution.workflowId ?? undefined, + }, + }) + ); + } return await this.workflowService.terminateWorkflowExecution(req); } catch (err) { this.rethrowGrpcError(err, 'Failed to terminate Workflow', input.workflowExecution); diff --git a/packages/common/src/__tests__/test-payload-visitor.ts b/packages/common/src/__tests__/test-payload-visitor.ts index b8b7e01ab3..aabb846c24 100644 --- a/packages/common/src/__tests__/test-payload-visitor.ts +++ b/packages/common/src/__tests__/test-payload-visitor.ts @@ -2,7 +2,11 @@ import test from 'ava'; import { coresdk } from '@temporalio/proto'; import { limit } from '../concurrency/limit'; import type { Payload } from '../interfaces'; -import { visitWorkflowActivation, visitWorkflowActivationCompletion } from '../internal-non-workflow/payload-visitor'; +import { + visit, + walkWorkflowActivation, + walkWorkflowActivationCompletion, +} from '../internal-non-workflow/payload-visitor'; // Lets the event loop run every async step that is currently ready const tick = (): Promise => new Promise((resolve) => setImmediate(resolve)); @@ -61,7 +65,7 @@ test('a failing transform surfaces its error and aborts in-flight siblings', asy }; const error = await t.throwsAsync( - visitWorkflowActivation(activation, { + visit(activation, walkWorkflowActivation, { transformPayload: async (p, _context, signal) => { const tag = read(p); if (tag === 'boom') { @@ -94,7 +98,7 @@ test('visitWorkflowActivationCompletion with an already-aborted signal skips the const counter = countingTransforms(); const error = await t.throwsAsync( - visitWorkflowActivationCompletion(completionWith('a', 'b'), { + visit(completionWith('a', 'b'), walkWorkflowActivationCompletion, { ...counter.transforms, abortSignal: AbortSignal.abort(new Error('stop')), }) @@ -161,7 +165,7 @@ test('visits every payload site exactly once and writes back in place', async (t const activation = activationWithEveryPayloadSite(); const seen: string[] = []; - await visitWorkflowActivation(activation, { + await visit(activation, walkWorkflowActivation, { ...perPayload((p) => { seen.push(read(p)); return payload(`${read(p)}#`); @@ -172,8 +176,9 @@ test('visits every payload site exactly once and writes back in place', async (t // A second walk should observe the first walk's rewrites, proving writeback landed in place. const seenAgain: string[] = []; - await visitWorkflowActivation( + await visit( activation, + walkWorkflowActivation, perPayload((p) => { seenAgain.push(read(p)); return p; @@ -189,10 +194,11 @@ test('visits every payload site exactly once and writes back in place', async (t test('an activation with no payloads makes no transform calls and resolves', async (t) => { const counter = countingTransforms(); - await visitWorkflowActivation({ jobs: [] }, counter.transforms); - await visitWorkflowActivation({}, counter.transforms); - await visitWorkflowActivation( + await visit({ jobs: [] }, walkWorkflowActivation, counter.transforms); + await visit({}, walkWorkflowActivation, counter.transforms); + await visit( { jobs: [{ initializeWorkflow: { arguments: [], headers: {} } }, { fireTimer: {} }] }, + walkWorkflowActivation, counter.transforms ); @@ -205,11 +211,11 @@ test('a repeated field may return any count, including zero', async (t) => { }); const emptied = withInput(); - await visitWorkflowActivation(emptied, { ...identity, transformPayloads: async () => [] }); + await visit(emptied, walkWorkflowActivation, { ...identity, transformPayloads: async () => [] }); t.deepEqual(emptied.jobs![0]!.signalWorkflow!.input, [], 'a repeated list can be emptied'); const reframed = withInput(); - await visitWorkflowActivation(reframed, { ...identity, transformPayloads: async () => [payload('merged')] }); + await visit(reframed, walkWorkflowActivation, { ...identity, transformPayloads: async () => [payload('merged')] }); t.deepEqual(reframed.jobs![0]!.signalWorkflow!.input!.map(read), ['merged'], 'count may shrink'); }); @@ -219,7 +225,7 @@ test('context is derived per message and isolated across sibling jobs', async (t }; const seen: Record = {}; - await visitWorkflowActivation(activation, { + await visit(activation, walkWorkflowActivation, { initialContext: 'root', deriveContext: (_message, typeName, context) => typeName === 'coresdk.workflow_activation.SignalWorkflow' @@ -250,7 +256,7 @@ test('skipHeaders and skipSearchAttributes omit those sites', async (t) => { }; const seen: string[] = []; - await visitWorkflowActivation(activation, { + await visit(activation, walkWorkflowActivation, { ...perPayload((p) => { seen.push(read(p)); return p; @@ -273,8 +279,9 @@ test('visits completion command payloads: user metadata and a rejected update', }; const seen: string[] = []; - await visitWorkflowActivationCompletion( + await visit( completion, + walkWorkflowActivationCompletion, perPayload((p) => { seen.push(read(p)); return payload(`${read(p)}!`); @@ -292,8 +299,9 @@ test('walks a decoded protobuf message instance, not just object literals', asyn const Type = coresdk.workflow_completion.WorkflowActivationCompletion; const decoded = Type.decode(Type.encode(completionWith('a', 'b')).finish()); - await visitWorkflowActivationCompletion( + await visit( decoded, + walkWorkflowActivationCompletion, perPayload((p) => payload(`${read(p)}!`)) ); @@ -306,7 +314,7 @@ test('an identity transform leaves a real message byte-for-byte unchanged', asyn const original = Type.encode(activationWithEveryPayloadSite()).finish(); const decoded = Type.decode(original); - await visitWorkflowActivation(decoded, identity); + await visit(decoded, walkWorkflowActivation, identity); t.deepEqual(Buffer.from(Type.encode(decoded).finish()), Buffer.from(original)); }); @@ -344,7 +352,7 @@ test('a concurrency limit caps in-flight transforms across the whole activation' }; const capped = tracked(); - const cappedVisit = visitWorkflowActivation(activationWithEveryPayloadSite(), { + const cappedVisit = visit(activationWithEveryPayloadSite(), walkWorkflowActivation, { ...capped.transforms, limit: limit(4), }); @@ -354,7 +362,7 @@ test('a concurrency limit caps in-flight transforms across the whole activation' await cappedVisit; const sequential = tracked(); - const sequentialVisit = visitWorkflowActivation(activationWithEveryPayloadSite(), { + const sequentialVisit = visit(activationWithEveryPayloadSite(), walkWorkflowActivation, { ...sequential.transforms, limit: limit(1), }); @@ -377,7 +385,7 @@ test('aborting mid-walk rejects and cancels in-flight transforms', async (t) => } }; - const visiting = visitWorkflowActivation(activationWithEveryPayloadSite(), { + const visiting = visit(activationWithEveryPayloadSite(), walkWorkflowActivation, { transformPayload: (p, _context, signal) => waitThenAbort(p, signal), transformPayloads: (ps, _context, signal) => waitThenAbort(ps, signal), limit: limit(16), diff --git a/packages/common/src/internal-non-workflow/payload-visitor.ts b/packages/common/src/internal-non-workflow/payload-visitor.ts index 8bd845e9f5..b9c145442d 100644 --- a/packages/common/src/internal-non-workflow/payload-visitor.ts +++ b/packages/common/src/internal-non-workflow/payload-visitor.ts @@ -1,13 +1,4 @@ -import type { coresdk } from '@temporalio/proto'; -import { - walkActivityTask, - walkActivityTaskCompletion, - walkNexusTask, - walkNexusTaskCompletion, - walkWorkflowActivation, - walkWorkflowActivationCompletion, - type WalkEnv, -} from '@temporalio/proto/lib/payload-visitor.generated'; +import type { WalkEnv } from '@temporalio/proto/lib/payload-visitor.generated'; import { sequential, type ConcurrencyLimit } from '../concurrency/limit'; import type { Payload } from '../interfaces'; @@ -139,83 +130,20 @@ async function runVisit( } /** - * Applies the payload transforms to every {@link Payload} in a `WorkflowActivation`, mutating it in place. + * Applies the payload transforms to every {@link Payload} in `root`, mutating it in place. Pass the + * generated `walk*` function for the root's message type (all are re-exported below). * * @internal * @experimental */ -export async function visitWorkflowActivation( - root: coresdk.workflow_activation.IWorkflowActivation, +export async function visit( + root: Root, + walk: (root: Root, env: WalkEnv, context: Ctx) => Promise[], options: VisitOptions ): Promise { - return runVisit(options, (env, context) => walkWorkflowActivation(root, env, context)); + return runVisit(options, (env, context) => walk(root, env, context)); } -/** - * Applies the payload transforms to every {@link Payload} in a `WorkflowActivationCompletion`, mutating - * it in place. - * - * @internal - * @experimental - */ -export async function visitWorkflowActivationCompletion( - root: coresdk.workflow_completion.IWorkflowActivationCompletion, - options: VisitOptions -): Promise { - return runVisit(options, (env, context) => walkWorkflowActivationCompletion(root, env, context)); -} - -/** - * Applies the payload transforms to every {@link Payload} in an `ActivityTask` (activity input and - * last-recorded heartbeat details), mutating it in place. - * - * @internal - * @experimental - */ -export async function visitActivityTask( - root: coresdk.activity_task.IActivityTask, - options: VisitOptions -): Promise { - return runVisit(options, (env, context) => walkActivityTask(root, env, context)); -} - -/** - * Applies the payload transforms to every {@link Payload} in an `ActivityTaskCompletion` (the activity - * result / failure), mutating it in place. - * - * @internal - * @experimental - */ -export async function visitActivityTaskCompletion( - root: coresdk.IActivityTaskCompletion, - options: VisitOptions -): Promise { - return runVisit(options, (env, context) => walkActivityTaskCompletion(root, env, context)); -} - -/** - * Applies the payload transforms to every {@link Payload} in a `NexusTask`, mutating it in place. - * - * @internal - * @experimental - */ -export async function visitNexusTask( - root: coresdk.nexus.INexusTask, - options: VisitOptions -): Promise { - return runVisit(options, (env, context) => walkNexusTask(root, env, context)); -} - -/** - * Applies the payload transforms to every {@link Payload} in a `NexusTaskCompletion`, mutating it in - * place. - * - * @internal - * @experimental - */ -export async function visitNexusTaskCompletion( - root: coresdk.nexus.INexusTaskCompletion, - options: VisitOptions -): Promise { - return runVisit(options, (env, context) => walkNexusTaskCompletion(root, env, context)); -} +// Re-export every generated walker so consumers pair any of them with `visit` without a deep import +// into the generated file. +export * from '@temporalio/proto/lib/payload-visitor.generated'; diff --git a/packages/proto/scripts/gen-payload-visitor.ts b/packages/proto/scripts/gen-payload-visitor.ts index 4cce764a7c..db49298b59 100644 --- a/packages/proto/scripts/gen-payload-visitor.ts +++ b/packages/proto/scripts/gen-payload-visitor.ts @@ -11,8 +11,10 @@ import * as prettier from 'prettier'; const PAYLOAD = 'temporal.api.common.v1.Payload'; const ANY = 'google.protobuf.Any'; -// Namespaces scanned for root messages. -const ROOT_NAMESPACES = ['coresdk'] as const; +// Namespaces scanned for root messages. Every payload-bearing message declared under these gets an +// exported entry point, so any message can be walked and new messages are covered automatically on +// regen. +const ROOT_NAMESPACES = ['coresdk', 'temporal.api.workflowservice.v1'] as const; const jsonModule = require(resolve(__dirname, '../protos/json-module.js')); const root = protobuf.Root.fromJSON(jsonModule); @@ -72,8 +74,8 @@ const reachableTypes = (): Map => { const types = reachableTypes(); -// Reverse reference index: `referrers.get(X)` is every type that has a field of type X. A type absent -// from this map is embedded by nothing — that is the "is a root" test below. +// Reverse reference index: `referrers.get(X)` is every type that has a field of type X. Used to walk +// back from Payload and mark every type that can transitively contain one. const referrers = new Map(); for (const type of types.values()) { for (const field of type.fieldsArray) { @@ -100,11 +102,18 @@ while (toVisit.length > 0) { // A message contains a Payload if it is one, or if it was marked above. const hasPayload = (type: protobuf.Type): boolean => fqn(type) === PAYLOAD || reachesPayload.has(fqn(type)); -// Roots: candidate messages that carry a payload and are embedded by no other message. -const roots = candidates.filter((type) => hasPayload(type) && !referrers.has(fqn(type))).sort(byFqn); - -// Public entry-point name for a root, derived from its message name (e.g. `walkWorkflowActivation`). -const entryName = (type: protobuf.Type): string => `walk${type.name}`; +// Roots: every payload-bearing message declared in the scanned namespaces. +const roots = candidates.filter((type) => hasPayload(type)).sort(byFqn); + +const simpleNameCounts = new Map(); +for (const type of roots) simpleNameCounts.set(type.name, (simpleNameCounts.get(type.name) ?? 0) + 1); +const entryName = (type: protobuf.Type): string => + (simpleNameCounts.get(type.name) ?? 0) > 1 + ? `walk${fqn(type) + .split(/[._]/) + .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)) + .join('')}` + : `walk${type.name}`; // Guard: two roots that share a simple name would collide as exported entry points. const seenEntries = new Set(); diff --git a/packages/proto/src/payload-visitor.generated.ts b/packages/proto/src/payload-visitor.generated.ts index dcc8566f08..b3897300a2 100644 --- a/packages/proto/src/payload-visitor.generated.ts +++ b/packages/proto/src/payload-visitor.generated.ts @@ -12,6 +12,56 @@ export interface WalkEnv { skipSearchAttributes: boolean; } +export function walkActivityExecutionResult( + root: coresdk.activity_result.IActivityExecutionResult, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_activity_result_ActivityExecutionResult(root, env, context, pending); + return pending; +} + +export function walkActivityResolution( + root: coresdk.activity_result.IActivityResolution, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_activity_result_ActivityResolution(root, env, context, pending); + return pending; +} + +export function walkCoresdkActivityResultCancellation( + root: coresdk.activity_result.ICancellation, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_activity_result_Cancellation(root, env, context, pending); + return pending; +} + +export function walkCoresdkActivityResultFailure( + root: coresdk.activity_result.IFailure, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_activity_result_Failure(root, env, context, pending); + return pending; +} + +export function walkCoresdkActivityResultSuccess( + root: coresdk.activity_result.ISuccess, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_activity_result_Success(root, env, context, pending); + return pending; +} + export function walkActivityTask( root: coresdk.activity_task.IActivityTask, env: WalkEnv, @@ -22,6 +72,16 @@ export function walkActivityTask( return pending; } +export function walkStart( + root: coresdk.activity_task.IStart, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_activity_task_Start(root, env, context, pending); + return pending; +} + export function walkActivityHeartbeat( root: coresdk.IActivityHeartbeat, env: WalkEnv, @@ -42,6 +102,56 @@ export function walkActivityTaskCompletion( return pending; } +export function walkCoresdkChildWorkflowCancellation( + root: coresdk.child_workflow.ICancellation, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_child_workflow_Cancellation(root, env, context, pending); + return pending; +} + +export function walkChildWorkflowResult( + root: coresdk.child_workflow.IChildWorkflowResult, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_child_workflow_ChildWorkflowResult(root, env, context, pending); + return pending; +} + +export function walkCoresdkChildWorkflowFailure( + root: coresdk.child_workflow.IFailure, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_child_workflow_Failure(root, env, context, pending); + return pending; +} + +export function walkCoresdkChildWorkflowSuccess( + root: coresdk.child_workflow.ISuccess, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_child_workflow_Success(root, env, context, pending); + return pending; +} + +export function walkNexusOperationResult( + root: coresdk.nexus.INexusOperationResult, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_nexus_NexusOperationResult(root, env, context, pending); + return pending; +} + export function walkNexusTask( root: coresdk.nexus.INexusTask, env: WalkEnv, @@ -62,6 +172,126 @@ export function walkNexusTaskCompletion( return pending; } +export function walkDoUpdate( + root: coresdk.workflow_activation.IDoUpdate, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_DoUpdate(root, env, context, pending); + return pending; +} + +export function walkInitializeWorkflow( + root: coresdk.workflow_activation.IInitializeWorkflow, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_InitializeWorkflow(root, env, context, pending); + return pending; +} + +export function walkQueryWorkflow( + root: coresdk.workflow_activation.IQueryWorkflow, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_QueryWorkflow(root, env, context, pending); + return pending; +} + +export function walkResolveActivity( + root: coresdk.workflow_activation.IResolveActivity, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveActivity(root, env, context, pending); + return pending; +} + +export function walkResolveChildWorkflowExecution( + root: coresdk.workflow_activation.IResolveChildWorkflowExecution, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveChildWorkflowExecution(root, env, context, pending); + return pending; +} + +export function walkResolveChildWorkflowExecutionStart( + root: coresdk.workflow_activation.IResolveChildWorkflowExecutionStart, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStart(root, env, context, pending); + return pending; +} + +export function walkResolveChildWorkflowExecutionStartCancelled( + root: coresdk.workflow_activation.IResolveChildWorkflowExecutionStartCancelled, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStartCancelled(root, env, context, pending); + return pending; +} + +export function walkResolveNexusOperation( + root: coresdk.workflow_activation.IResolveNexusOperation, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveNexusOperation(root, env, context, pending); + return pending; +} + +export function walkResolveNexusOperationStart( + root: coresdk.workflow_activation.IResolveNexusOperationStart, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveNexusOperationStart(root, env, context, pending); + return pending; +} + +export function walkResolveRequestCancelExternalWorkflow( + root: coresdk.workflow_activation.IResolveRequestCancelExternalWorkflow, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveRequestCancelExternalWorkflow(root, env, context, pending); + return pending; +} + +export function walkResolveSignalExternalWorkflow( + root: coresdk.workflow_activation.IResolveSignalExternalWorkflow, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_ResolveSignalExternalWorkflow(root, env, context, pending); + return pending; +} + +export function walkSignalWorkflow( + root: coresdk.workflow_activation.ISignalWorkflow, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_activation_SignalWorkflow(root, env, context, pending); + return pending; +} + export function walkWorkflowActivation( root: coresdk.workflow_activation.IWorkflowActivation, env: WalkEnv, @@ -72,1355 +302,5412 @@ export function walkWorkflowActivation( return pending; } -export function walkWorkflowActivationCompletion( - root: coresdk.workflow_completion.IWorkflowActivationCompletion, +export function walkWorkflowActivationJob( + root: coresdk.workflow_activation.IWorkflowActivationJob, env: WalkEnv, context: Ctx ): Promise[] { const pending: Promise[] = []; - walk_coresdk_workflow_completion_WorkflowActivationCompletion(root, env, context, pending); + walk_coresdk_workflow_activation_WorkflowActivationJob(root, env, context, pending); return pending; } -function walk_coresdk_activity_result_ActivityExecutionResult( - o: coresdk.activity_result.IActivityExecutionResult, +export function walkCompleteWorkflowExecution( + root: coresdk.workflow_commands.ICompleteWorkflowExecution, env: WalkEnv, - context: Ctx, - pending: Promise[] -): void { - const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.activity_result.ActivityExecutionResult', context) - : context; - { - const c = o.completed; - if (c != null) walk_coresdk_activity_result_Success(c, env, ctx, pending); - } - { - const c = o.failed; - if (c != null) walk_coresdk_activity_result_Failure(c, env, ctx, pending); - } - { - const c = o.cancelled; - if (c != null) walk_coresdk_activity_result_Cancellation(c, env, ctx, pending); - } + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_CompleteWorkflowExecution(root, env, context, pending); + return pending; } -function walk_coresdk_activity_result_ActivityResolution( - o: coresdk.activity_result.IActivityResolution, +export function walkContinueAsNewWorkflowExecution( + root: coresdk.workflow_commands.IContinueAsNewWorkflowExecution, env: WalkEnv, - context: Ctx, - pending: Promise[] -): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.ActivityResolution', context) : context; - { - const c = o.completed; - if (c != null) walk_coresdk_activity_result_Success(c, env, ctx, pending); - } - { - const c = o.failed; - if (c != null) walk_coresdk_activity_result_Failure(c, env, ctx, pending); - } - { - const c = o.cancelled; - if (c != null) walk_coresdk_activity_result_Cancellation(c, env, ctx, pending); - } + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_ContinueAsNewWorkflowExecution(root, env, context, pending); + return pending; } -function walk_coresdk_activity_result_Cancellation( - o: coresdk.activity_result.ICancellation, +export function walkFailWorkflowExecution( + root: coresdk.workflow_commands.IFailWorkflowExecution, env: WalkEnv, - context: Ctx, - pending: Promise[] -): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.Cancellation', context) : context; + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_FailWorkflowExecution(root, env, context, pending); + return pending; +} + +export function walkModifyWorkflowProperties( + root: coresdk.workflow_commands.IModifyWorkflowProperties, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_ModifyWorkflowProperties(root, env, context, pending); + return pending; +} + +export function walkQueryResult( + root: coresdk.workflow_commands.IQueryResult, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_QueryResult(root, env, context, pending); + return pending; +} + +export function walkQuerySuccess( + root: coresdk.workflow_commands.IQuerySuccess, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_QuerySuccess(root, env, context, pending); + return pending; +} + +export function walkScheduleActivity( + root: coresdk.workflow_commands.IScheduleActivity, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_ScheduleActivity(root, env, context, pending); + return pending; +} + +export function walkScheduleLocalActivity( + root: coresdk.workflow_commands.IScheduleLocalActivity, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_ScheduleLocalActivity(root, env, context, pending); + return pending; +} + +export function walkScheduleNexusOperation( + root: coresdk.workflow_commands.IScheduleNexusOperation, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_ScheduleNexusOperation(root, env, context, pending); + return pending; +} + +export function walkSignalExternalWorkflowExecution( + root: coresdk.workflow_commands.ISignalExternalWorkflowExecution, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_SignalExternalWorkflowExecution(root, env, context, pending); + return pending; +} + +export function walkStartChildWorkflowExecution( + root: coresdk.workflow_commands.IStartChildWorkflowExecution, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_StartChildWorkflowExecution(root, env, context, pending); + return pending; +} + +export function walkUpdateResponse( + root: coresdk.workflow_commands.IUpdateResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_UpdateResponse(root, env, context, pending); + return pending; +} + +export function walkUpsertWorkflowSearchAttributes( + root: coresdk.workflow_commands.IUpsertWorkflowSearchAttributes, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_UpsertWorkflowSearchAttributes(root, env, context, pending); + return pending; +} + +export function walkWorkflowCommand( + root: coresdk.workflow_commands.IWorkflowCommand, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_commands_WorkflowCommand(root, env, context, pending); + return pending; +} + +export function walkCoresdkWorkflowCompletionFailure( + root: coresdk.workflow_completion.IFailure, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_completion_Failure(root, env, context, pending); + return pending; +} + +export function walkCoresdkWorkflowCompletionSuccess( + root: coresdk.workflow_completion.ISuccess, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_completion_Success(root, env, context, pending); + return pending; +} + +export function walkWorkflowActivationCompletion( + root: coresdk.workflow_completion.IWorkflowActivationCompletion, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_coresdk_workflow_completion_WorkflowActivationCompletion(root, env, context, pending); + return pending; +} + +export function walkCountActivityExecutionsResponse( + root: temporal.api.workflowservice.v1.ICountActivityExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountActivityExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkTemporalApiWorkflowserviceV1CountActivityExecutionsResponseAggregationGroup( + root: temporal.api.workflowservice.v1.CountActivityExecutionsResponse.IAggregationGroup, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountActivityExecutionsResponse_AggregationGroup(root, env, context, pending); + return pending; +} + +export function walkCountNexusOperationExecutionsResponse( + root: temporal.api.workflowservice.v1.ICountNexusOperationExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountNexusOperationExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkTemporalApiWorkflowserviceV1CountNexusOperationExecutionsResponseAggregationGroup( + root: temporal.api.workflowservice.v1.CountNexusOperationExecutionsResponse.IAggregationGroup, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountNexusOperationExecutionsResponse_AggregationGroup( + root, + env, + context, + pending + ); + return pending; +} + +export function walkCountSchedulesResponse( + root: temporal.api.workflowservice.v1.ICountSchedulesResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountSchedulesResponse(root, env, context, pending); + return pending; +} + +export function walkTemporalApiWorkflowserviceV1CountSchedulesResponseAggregationGroup( + root: temporal.api.workflowservice.v1.CountSchedulesResponse.IAggregationGroup, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountSchedulesResponse_AggregationGroup(root, env, context, pending); + return pending; +} + +export function walkCountWorkflowExecutionsResponse( + root: temporal.api.workflowservice.v1.ICountWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountWorkflowExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkTemporalApiWorkflowserviceV1CountWorkflowExecutionsResponseAggregationGroup( + root: temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse.IAggregationGroup, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CountWorkflowExecutionsResponse_AggregationGroup(root, env, context, pending); + return pending; +} + +export function walkCreateScheduleRequest( + root: temporal.api.workflowservice.v1.ICreateScheduleRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CreateScheduleRequest(root, env, context, pending); + return pending; +} + +export function walkCreateWorkerDeploymentVersionRequest( + root: temporal.api.workflowservice.v1.ICreateWorkerDeploymentVersionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_CreateWorkerDeploymentVersionRequest(root, env, context, pending); + return pending; +} + +export function walkDescribeActivityExecutionResponse( + root: temporal.api.workflowservice.v1.IDescribeActivityExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_DescribeActivityExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkDescribeDeploymentResponse( + root: temporal.api.workflowservice.v1.IDescribeDeploymentResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_DescribeDeploymentResponse(root, env, context, pending); + return pending; +} + +export function walkDescribeNexusOperationExecutionResponse( + root: temporal.api.workflowservice.v1.IDescribeNexusOperationExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_DescribeNexusOperationExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkDescribeScheduleResponse( + root: temporal.api.workflowservice.v1.IDescribeScheduleResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_DescribeScheduleResponse(root, env, context, pending); + return pending; +} + +export function walkDescribeWorkerDeploymentVersionResponse( + root: temporal.api.workflowservice.v1.IDescribeWorkerDeploymentVersionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_DescribeWorkerDeploymentVersionResponse(root, env, context, pending); + return pending; +} + +export function walkDescribeWorkflowExecutionResponse( + root: temporal.api.workflowservice.v1.IDescribeWorkflowExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_DescribeWorkflowExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkExecuteMultiOperationRequest( + root: temporal.api.workflowservice.v1.IExecuteMultiOperationRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ExecuteMultiOperationRequest(root, env, context, pending); + return pending; +} + +export function walkOperation( + root: temporal.api.workflowservice.v1.ExecuteMultiOperationRequest.IOperation, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ExecuteMultiOperationRequest_Operation(root, env, context, pending); + return pending; +} + +export function walkExecuteMultiOperationResponse( + root: temporal.api.workflowservice.v1.IExecuteMultiOperationResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ExecuteMultiOperationResponse(root, env, context, pending); + return pending; +} + +export function walkResponse( + root: temporal.api.workflowservice.v1.ExecuteMultiOperationResponse.IResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ExecuteMultiOperationResponse_Response(root, env, context, pending); + return pending; +} + +export function walkGetCurrentDeploymentResponse( + root: temporal.api.workflowservice.v1.IGetCurrentDeploymentResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_GetCurrentDeploymentResponse(root, env, context, pending); + return pending; +} + +export function walkGetDeploymentReachabilityResponse( + root: temporal.api.workflowservice.v1.IGetDeploymentReachabilityResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_GetDeploymentReachabilityResponse(root, env, context, pending); + return pending; +} + +export function walkGetWorkflowExecutionHistoryResponse( + root: temporal.api.workflowservice.v1.IGetWorkflowExecutionHistoryResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_GetWorkflowExecutionHistoryResponse(root, env, context, pending); + return pending; +} + +export function walkGetWorkflowExecutionHistoryReverseResponse( + root: temporal.api.workflowservice.v1.IGetWorkflowExecutionHistoryReverseResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_GetWorkflowExecutionHistoryReverseResponse(root, env, context, pending); + return pending; +} + +export function walkListActivityExecutionsResponse( + root: temporal.api.workflowservice.v1.IListActivityExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListActivityExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkListArchivedWorkflowExecutionsResponse( + root: temporal.api.workflowservice.v1.IListArchivedWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListArchivedWorkflowExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkListClosedWorkflowExecutionsResponse( + root: temporal.api.workflowservice.v1.IListClosedWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListClosedWorkflowExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkListNexusOperationExecutionsResponse( + root: temporal.api.workflowservice.v1.IListNexusOperationExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListNexusOperationExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkListOpenWorkflowExecutionsResponse( + root: temporal.api.workflowservice.v1.IListOpenWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListOpenWorkflowExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkListSchedulesResponse( + root: temporal.api.workflowservice.v1.IListSchedulesResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListSchedulesResponse(root, env, context, pending); + return pending; +} + +export function walkListWorkflowExecutionsResponse( + root: temporal.api.workflowservice.v1.IListWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ListWorkflowExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkPollActivityExecutionResponse( + root: temporal.api.workflowservice.v1.IPollActivityExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_PollActivityExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkPollActivityTaskQueueResponse( + root: temporal.api.workflowservice.v1.IPollActivityTaskQueueResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_PollActivityTaskQueueResponse(root, env, context, pending); + return pending; +} + +export function walkPollNexusOperationExecutionResponse( + root: temporal.api.workflowservice.v1.IPollNexusOperationExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_PollNexusOperationExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkPollNexusTaskQueueResponse( + root: temporal.api.workflowservice.v1.IPollNexusTaskQueueResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_PollNexusTaskQueueResponse(root, env, context, pending); + return pending; +} + +export function walkPollWorkflowExecutionUpdateResponse( + root: temporal.api.workflowservice.v1.IPollWorkflowExecutionUpdateResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_PollWorkflowExecutionUpdateResponse(root, env, context, pending); + return pending; +} + +export function walkPollWorkflowTaskQueueResponse( + root: temporal.api.workflowservice.v1.IPollWorkflowTaskQueueResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_PollWorkflowTaskQueueResponse(root, env, context, pending); + return pending; +} + +export function walkQueryWorkflowRequest( + root: temporal.api.workflowservice.v1.IQueryWorkflowRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_QueryWorkflowRequest(root, env, context, pending); + return pending; +} + +export function walkQueryWorkflowResponse( + root: temporal.api.workflowservice.v1.IQueryWorkflowResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_QueryWorkflowResponse(root, env, context, pending); + return pending; +} + +export function walkRecordActivityTaskHeartbeatByIdRequest( + root: temporal.api.workflowservice.v1.IRecordActivityTaskHeartbeatByIdRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RecordActivityTaskHeartbeatByIdRequest(root, env, context, pending); + return pending; +} + +export function walkRecordActivityTaskHeartbeatRequest( + root: temporal.api.workflowservice.v1.IRecordActivityTaskHeartbeatRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RecordActivityTaskHeartbeatRequest(root, env, context, pending); + return pending; +} + +export function walkResetWorkflowExecutionRequest( + root: temporal.api.workflowservice.v1.IResetWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ResetWorkflowExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskCanceledByIdRequest( + root: temporal.api.workflowservice.v1.IRespondActivityTaskCanceledByIdRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskCanceledByIdRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskCanceledRequest( + root: temporal.api.workflowservice.v1.IRespondActivityTaskCanceledRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskCanceledRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskCompletedByIdRequest( + root: temporal.api.workflowservice.v1.IRespondActivityTaskCompletedByIdRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskCompletedByIdRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskCompletedRequest( + root: temporal.api.workflowservice.v1.IRespondActivityTaskCompletedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskCompletedRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskFailedByIdRequest( + root: temporal.api.workflowservice.v1.IRespondActivityTaskFailedByIdRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedByIdRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskFailedByIdResponse( + root: temporal.api.workflowservice.v1.IRespondActivityTaskFailedByIdResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedByIdResponse(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskFailedRequest( + root: temporal.api.workflowservice.v1.IRespondActivityTaskFailedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedRequest(root, env, context, pending); + return pending; +} + +export function walkRespondActivityTaskFailedResponse( + root: temporal.api.workflowservice.v1.IRespondActivityTaskFailedResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedResponse(root, env, context, pending); + return pending; +} + +export function walkRespondNexusTaskCompletedRequest( + root: temporal.api.workflowservice.v1.IRespondNexusTaskCompletedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondNexusTaskCompletedRequest(root, env, context, pending); + return pending; +} + +export function walkRespondNexusTaskFailedRequest( + root: temporal.api.workflowservice.v1.IRespondNexusTaskFailedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondNexusTaskFailedRequest(root, env, context, pending); + return pending; +} + +export function walkRespondQueryTaskCompletedRequest( + root: temporal.api.workflowservice.v1.IRespondQueryTaskCompletedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondQueryTaskCompletedRequest(root, env, context, pending); + return pending; +} + +export function walkRespondWorkflowTaskCompletedRequest( + root: temporal.api.workflowservice.v1.IRespondWorkflowTaskCompletedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondWorkflowTaskCompletedRequest(root, env, context, pending); + return pending; +} + +export function walkRespondWorkflowTaskCompletedResponse( + root: temporal.api.workflowservice.v1.IRespondWorkflowTaskCompletedResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondWorkflowTaskCompletedResponse(root, env, context, pending); + return pending; +} + +export function walkRespondWorkflowTaskFailedRequest( + root: temporal.api.workflowservice.v1.IRespondWorkflowTaskFailedRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_RespondWorkflowTaskFailedRequest(root, env, context, pending); + return pending; +} + +export function walkScanWorkflowExecutionsResponse( + root: temporal.api.workflowservice.v1.IScanWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ScanWorkflowExecutionsResponse(root, env, context, pending); + return pending; +} + +export function walkSetCurrentDeploymentRequest( + root: temporal.api.workflowservice.v1.ISetCurrentDeploymentRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_SetCurrentDeploymentRequest(root, env, context, pending); + return pending; +} + +export function walkSetCurrentDeploymentResponse( + root: temporal.api.workflowservice.v1.ISetCurrentDeploymentResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_SetCurrentDeploymentResponse(root, env, context, pending); + return pending; +} + +export function walkSignalWithStartWorkflowExecutionRequest( + root: temporal.api.workflowservice.v1.ISignalWithStartWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_SignalWithStartWorkflowExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkSignalWorkflowExecutionRequest( + root: temporal.api.workflowservice.v1.ISignalWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_SignalWorkflowExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkStartActivityExecutionRequest( + root: temporal.api.workflowservice.v1.IStartActivityExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_StartActivityExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkStartBatchOperationRequest( + root: temporal.api.workflowservice.v1.IStartBatchOperationRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_StartBatchOperationRequest(root, env, context, pending); + return pending; +} + +export function walkStartNexusOperationExecutionRequest( + root: temporal.api.workflowservice.v1.IStartNexusOperationExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_StartNexusOperationExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkStartWorkflowExecutionRequest( + root: temporal.api.workflowservice.v1.IStartWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_StartWorkflowExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkStartWorkflowExecutionResponse( + root: temporal.api.workflowservice.v1.IStartWorkflowExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_StartWorkflowExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkTerminateWorkflowExecutionRequest( + root: temporal.api.workflowservice.v1.ITerminateWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_TerminateWorkflowExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkUpdateScheduleRequest( + root: temporal.api.workflowservice.v1.IUpdateScheduleRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_UpdateScheduleRequest(root, env, context, pending); + return pending; +} + +export function walkUpdateWorkerDeploymentVersionComputeConfigRequest( + root: temporal.api.workflowservice.v1.IUpdateWorkerDeploymentVersionComputeConfigRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_UpdateWorkerDeploymentVersionComputeConfigRequest(root, env, context, pending); + return pending; +} + +export function walkUpdateWorkerDeploymentVersionMetadataRequest( + root: temporal.api.workflowservice.v1.IUpdateWorkerDeploymentVersionMetadataRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_UpdateWorkerDeploymentVersionMetadataRequest(root, env, context, pending); + return pending; +} + +export function walkUpdateWorkerDeploymentVersionMetadataResponse( + root: temporal.api.workflowservice.v1.IUpdateWorkerDeploymentVersionMetadataResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_UpdateWorkerDeploymentVersionMetadataResponse(root, env, context, pending); + return pending; +} + +export function walkUpdateWorkflowExecutionRequest( + root: temporal.api.workflowservice.v1.IUpdateWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_UpdateWorkflowExecutionRequest(root, env, context, pending); + return pending; +} + +export function walkUpdateWorkflowExecutionResponse( + root: temporal.api.workflowservice.v1.IUpdateWorkflowExecutionResponse, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_UpdateWorkflowExecutionResponse(root, env, context, pending); + return pending; +} + +export function walkValidateWorkerDeploymentVersionComputeConfigRequest( + root: temporal.api.workflowservice.v1.IValidateWorkerDeploymentVersionComputeConfigRequest, + env: WalkEnv, + context: Ctx +): Promise[] { + const pending: Promise[] = []; + walk_temporal_api_workflowservice_v1_ValidateWorkerDeploymentVersionComputeConfigRequest(root, env, context, pending); + return pending; +} + +function walk_coresdk_activity_result_ActivityExecutionResult( + o: coresdk.activity_result.IActivityExecutionResult, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.activity_result.ActivityExecutionResult', context) + : context; + { + const c = o.completed; + if (c != null) walk_coresdk_activity_result_Success(c, env, ctx, pending); + } + { + const c = o.failed; + if (c != null) walk_coresdk_activity_result_Failure(c, env, ctx, pending); + } + { + const c = o.cancelled; + if (c != null) walk_coresdk_activity_result_Cancellation(c, env, ctx, pending); + } +} + +function walk_coresdk_activity_result_ActivityResolution( + o: coresdk.activity_result.IActivityResolution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.ActivityResolution', context) : context; + { + const c = o.completed; + if (c != null) walk_coresdk_activity_result_Success(c, env, ctx, pending); + } + { + const c = o.failed; + if (c != null) walk_coresdk_activity_result_Failure(c, env, ctx, pending); + } + { + const c = o.cancelled; + if (c != null) walk_coresdk_activity_result_Cancellation(c, env, ctx, pending); + } +} + +function walk_coresdk_activity_result_Cancellation( + o: coresdk.activity_result.ICancellation, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.Cancellation', context) : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_activity_result_Failure( + o: coresdk.activity_result.IFailure, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.Failure', context) : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_activity_result_Success( + o: coresdk.activity_result.ISuccess, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.Success', context) : context; + { + const p = o.result; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.result = r; + }) + ); + } +} + +function walk_coresdk_activity_task_ActivityTask( + o: coresdk.activity_task.IActivityTask, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_task.ActivityTask', context) : context; + { + const c = o.start; + if (c != null) walk_coresdk_activity_task_Start(c, env, ctx, pending); + } +} + +function walk_coresdk_activity_task_Start( + o: coresdk.activity_task.IStart, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_task.Start', context) : context; + { + const m = o.headerFields; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + { + const a = o.input; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.input = r; + }) + ); + } + { + const a = o.heartbeatDetails; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.heartbeatDetails = r; + }) + ); + } +} + +function walk_coresdk_ActivityHeartbeat( + o: coresdk.IActivityHeartbeat, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.ActivityHeartbeat', context) : context; + { + const a = o.details; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.details = r; + }) + ); + } +} + +function walk_coresdk_ActivityTaskCompletion( + o: coresdk.IActivityTaskCompletion, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.ActivityTaskCompletion', context) : context; + { + const c = o.result; + if (c != null) walk_coresdk_activity_result_ActivityExecutionResult(c, env, ctx, pending); + } +} + +function walk_coresdk_child_workflow_Cancellation( + o: coresdk.child_workflow.ICancellation, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.Cancellation', context) : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_child_workflow_ChildWorkflowResult( + o: coresdk.child_workflow.IChildWorkflowResult, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.ChildWorkflowResult', context) : context; + { + const c = o.completed; + if (c != null) walk_coresdk_child_workflow_Success(c, env, ctx, pending); + } + { + const c = o.failed; + if (c != null) walk_coresdk_child_workflow_Failure(c, env, ctx, pending); + } + { + const c = o.cancelled; + if (c != null) walk_coresdk_child_workflow_Cancellation(c, env, ctx, pending); + } +} + +function walk_coresdk_child_workflow_Failure( + o: coresdk.child_workflow.IFailure, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.Failure', context) : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_child_workflow_Success( + o: coresdk.child_workflow.ISuccess, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.Success', context) : context; + { + const p = o.result; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.result = r; + }) + ); + } +} + +function walk_coresdk_nexus_NexusOperationResult( + o: coresdk.nexus.INexusOperationResult, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.nexus.NexusOperationResult', context) : context; + { + const p = o.completed; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.completed = r; + }) + ); + } + { + const c = o.failed; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.cancelled; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.timedOut; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_nexus_NexusTask( + o: coresdk.nexus.INexusTask, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.nexus.NexusTask', context) : context; + { + const c = o.task; + if (c != null) walk_temporal_api_workflowservice_v1_PollNexusTaskQueueResponse(c, env, ctx, pending); + } +} + +function walk_coresdk_nexus_NexusTaskCompletion( + o: coresdk.nexus.INexusTaskCompletion, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.nexus.NexusTaskCompletion', context) : context; + { + const c = o.completed; + if (c != null) walk_temporal_api_nexus_v1_Response(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_DoUpdate( + o: coresdk.workflow_activation.IDoUpdate, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_activation.DoUpdate', context) : context; + { + const a = o.input; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.input = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } +} + +function walk_coresdk_workflow_activation_InitializeWorkflow( + o: coresdk.workflow_activation.IInitializeWorkflow, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.InitializeWorkflow', context) + : context; + { + const a = o.arguments; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.arguments = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } + { + const c = o.continuedFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.lastCompletionResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_coresdk_workflow_activation_QueryWorkflow( + o: coresdk.workflow_activation.IQueryWorkflow, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_activation.QueryWorkflow', context) : context; + { + const a = o.arguments; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.arguments = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } +} + +function walk_coresdk_workflow_activation_ResolveActivity( + o: coresdk.workflow_activation.IResolveActivity, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveActivity', context) + : context; + { + const c = o.result; + if (c != null) walk_coresdk_activity_result_ActivityResolution(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveChildWorkflowExecution( + o: coresdk.workflow_activation.IResolveChildWorkflowExecution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveChildWorkflowExecution', context) + : context; + { + const c = o.result; + if (c != null) walk_coresdk_child_workflow_ChildWorkflowResult(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStart( + o: coresdk.workflow_activation.IResolveChildWorkflowExecutionStart, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveChildWorkflowExecutionStart', context) + : context; + { + const c = o.cancelled; + if (c != null) walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStartCancelled(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStartCancelled( + o: coresdk.workflow_activation.IResolveChildWorkflowExecutionStartCancelled, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelled', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveNexusOperation( + o: coresdk.workflow_activation.IResolveNexusOperation, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveNexusOperation', context) + : context; + { + const c = o.result; + if (c != null) walk_coresdk_nexus_NexusOperationResult(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveNexusOperationStart( + o: coresdk.workflow_activation.IResolveNexusOperationStart, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveNexusOperationStart', context) + : context; + { + const c = o.failed; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveRequestCancelExternalWorkflow( + o: coresdk.workflow_activation.IResolveRequestCancelExternalWorkflow, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveRequestCancelExternalWorkflow', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_ResolveSignalExternalWorkflow( + o: coresdk.workflow_activation.IResolveSignalExternalWorkflow, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveSignalExternalWorkflow', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_SignalWorkflow( + o: coresdk.workflow_activation.ISignalWorkflow, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_activation.SignalWorkflow', context) : context; + { + const a = o.input; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.input = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } +} + +function walk_coresdk_workflow_activation_WorkflowActivation( + o: coresdk.workflow_activation.IWorkflowActivation, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.WorkflowActivation', context) + : context; + { + const a = o.jobs; + if (a) for (const v of a) walk_coresdk_workflow_activation_WorkflowActivationJob(v, env, ctx, pending); + } +} + +function walk_coresdk_workflow_activation_WorkflowActivationJob( + o: coresdk.workflow_activation.IWorkflowActivationJob, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_activation.WorkflowActivationJob', context) + : context; + { + const c = o.initializeWorkflow; + if (c != null) walk_coresdk_workflow_activation_InitializeWorkflow(c, env, ctx, pending); + } + { + const c = o.queryWorkflow; + if (c != null) walk_coresdk_workflow_activation_QueryWorkflow(c, env, ctx, pending); + } + { + const c = o.signalWorkflow; + if (c != null) walk_coresdk_workflow_activation_SignalWorkflow(c, env, ctx, pending); + } + { + const c = o.resolveActivity; + if (c != null) walk_coresdk_workflow_activation_ResolveActivity(c, env, ctx, pending); + } + { + const c = o.resolveChildWorkflowExecutionStart; + if (c != null) walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStart(c, env, ctx, pending); + } + { + const c = o.resolveChildWorkflowExecution; + if (c != null) walk_coresdk_workflow_activation_ResolveChildWorkflowExecution(c, env, ctx, pending); + } + { + const c = o.resolveSignalExternalWorkflow; + if (c != null) walk_coresdk_workflow_activation_ResolveSignalExternalWorkflow(c, env, ctx, pending); + } + { + const c = o.resolveRequestCancelExternalWorkflow; + if (c != null) walk_coresdk_workflow_activation_ResolveRequestCancelExternalWorkflow(c, env, ctx, pending); + } + { + const c = o.doUpdate; + if (c != null) walk_coresdk_workflow_activation_DoUpdate(c, env, ctx, pending); + } + { + const c = o.resolveNexusOperationStart; + if (c != null) walk_coresdk_workflow_activation_ResolveNexusOperationStart(c, env, ctx, pending); + } + { + const c = o.resolveNexusOperation; + if (c != null) walk_coresdk_workflow_activation_ResolveNexusOperation(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_commands_CompleteWorkflowExecution( + o: coresdk.workflow_commands.ICompleteWorkflowExecution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.CompleteWorkflowExecution', context) + : context; + { + const p = o.result; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.result = r; + }) + ); + } +} + +function walk_coresdk_workflow_commands_ContinueAsNewWorkflowExecution( + o: coresdk.workflow_commands.IContinueAsNewWorkflowExecution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.ContinueAsNewWorkflowExecution', context) + : context; + { + const a = o.arguments; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.arguments = r; + }) + ); + } + { + const m = o.memo; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_coresdk_workflow_commands_FailWorkflowExecution( + o: coresdk.workflow_commands.IFailWorkflowExecution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.FailWorkflowExecution', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_commands_ModifyWorkflowProperties( + o: coresdk.workflow_commands.IModifyWorkflowProperties, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.ModifyWorkflowProperties', context) + : context; + { + const c = o.upsertedMemo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_commands_QueryResult( + o: coresdk.workflow_commands.IQueryResult, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.QueryResult', context) : context; + { + const c = o.succeeded; + if (c != null) walk_coresdk_workflow_commands_QuerySuccess(c, env, ctx, pending); + } + { + const c = o.failed; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_commands_QuerySuccess( + o: coresdk.workflow_commands.IQuerySuccess, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.QuerySuccess', context) : context; + { + const p = o.response; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.response = r; + }) + ); + } +} + +function walk_coresdk_workflow_commands_ScheduleActivity( + o: coresdk.workflow_commands.IScheduleActivity, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.ScheduleActivity', context) : context; + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } + { + const a = o.arguments; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.arguments = r; + }) + ); + } +} + +function walk_coresdk_workflow_commands_ScheduleLocalActivity( + o: coresdk.workflow_commands.IScheduleLocalActivity, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.ScheduleLocalActivity', context) + : context; + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } + { + const a = o.arguments; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.arguments = r; + }) + ); + } +} + +function walk_coresdk_workflow_commands_ScheduleNexusOperation( + o: coresdk.workflow_commands.IScheduleNexusOperation, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.ScheduleNexusOperation', context) + : context; + { + const p = o.input; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.input = r; + }) + ); + } +} + +function walk_coresdk_workflow_commands_SignalExternalWorkflowExecution( + o: coresdk.workflow_commands.ISignalExternalWorkflowExecution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.SignalExternalWorkflowExecution', context) + : context; + { + const a = o.args; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.args = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } +} + +function walk_coresdk_workflow_commands_StartChildWorkflowExecution( + o: coresdk.workflow_commands.IStartChildWorkflowExecution, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.StartChildWorkflowExecution', context) + : context; + { + const a = o.input; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.input = r; + }) + ); + } + { + if (!env.skipHeaders) { + const m = o.headers; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + } + { + const m = o.memo; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_coresdk_workflow_commands_UpdateResponse( + o: coresdk.workflow_commands.IUpdateResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.UpdateResponse', context) : context; + { + const c = o.rejected; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const p = o.completed; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.completed = r; + }) + ); + } +} + +function walk_coresdk_workflow_commands_UpsertWorkflowSearchAttributes( + o: coresdk.workflow_commands.IUpsertWorkflowSearchAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_commands.UpsertWorkflowSearchAttributes', context) + : context; + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_coresdk_workflow_commands_WorkflowCommand( + o: coresdk.workflow_commands.IWorkflowCommand, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.WorkflowCommand', context) : context; + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } + { + const c = o.scheduleActivity; + if (c != null) walk_coresdk_workflow_commands_ScheduleActivity(c, env, ctx, pending); + } + { + const c = o.respondToQuery; + if (c != null) walk_coresdk_workflow_commands_QueryResult(c, env, ctx, pending); + } + { + const c = o.completeWorkflowExecution; + if (c != null) walk_coresdk_workflow_commands_CompleteWorkflowExecution(c, env, ctx, pending); + } + { + const c = o.failWorkflowExecution; + if (c != null) walk_coresdk_workflow_commands_FailWorkflowExecution(c, env, ctx, pending); + } + { + const c = o.continueAsNewWorkflowExecution; + if (c != null) walk_coresdk_workflow_commands_ContinueAsNewWorkflowExecution(c, env, ctx, pending); + } + { + const c = o.startChildWorkflowExecution; + if (c != null) walk_coresdk_workflow_commands_StartChildWorkflowExecution(c, env, ctx, pending); + } + { + const c = o.signalExternalWorkflowExecution; + if (c != null) walk_coresdk_workflow_commands_SignalExternalWorkflowExecution(c, env, ctx, pending); + } + { + const c = o.scheduleLocalActivity; + if (c != null) walk_coresdk_workflow_commands_ScheduleLocalActivity(c, env, ctx, pending); + } + { + const c = o.upsertWorkflowSearchAttributes; + if (c != null) walk_coresdk_workflow_commands_UpsertWorkflowSearchAttributes(c, env, ctx, pending); + } + { + const c = o.modifyWorkflowProperties; + if (c != null) walk_coresdk_workflow_commands_ModifyWorkflowProperties(c, env, ctx, pending); + } + { + const c = o.updateResponse; + if (c != null) walk_coresdk_workflow_commands_UpdateResponse(c, env, ctx, pending); + } + { + const c = o.scheduleNexusOperation; + if (c != null) walk_coresdk_workflow_commands_ScheduleNexusOperation(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_completion_Failure( + o: coresdk.workflow_completion.IFailure, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_completion.Failure', context) : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_coresdk_workflow_completion_Success( + o: coresdk.workflow_completion.ISuccess, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_completion.Success', context) : context; + { + const a = o.commands; + if (a) for (const v of a) walk_coresdk_workflow_commands_WorkflowCommand(v, env, ctx, pending); + } +} + +function walk_coresdk_workflow_completion_WorkflowActivationCompletion( + o: coresdk.workflow_completion.IWorkflowActivationCompletion, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'coresdk.workflow_completion.WorkflowActivationCompletion', context) + : context; + { + const c = o.successful; + if (c != null) walk_coresdk_workflow_completion_Success(c, env, ctx, pending); + } + { + const c = o.failed; + if (c != null) walk_coresdk_workflow_completion_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_activity_v1_ActivityExecutionInfo( + o: temporal.api.activity.v1.IActivityExecutionInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.activity.v1.ActivityExecutionInfo', context) + : context; + { + const c = o.heartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.lastFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } +} + +function walk_temporal_api_activity_v1_ActivityExecutionListInfo( + o: temporal.api.activity.v1.IActivityExecutionListInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.activity.v1.ActivityExecutionListInfo', context) + : context; + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_activity_v1_ActivityExecutionOutcome( + o: temporal.api.activity.v1.IActivityExecutionOutcome, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.activity.v1.ActivityExecutionOutcome', context) + : context; + { + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_activity_v1_CallbackInfo( + o: temporal.api.activity.v1.ICallbackInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.activity.v1.CallbackInfo', context) : context; + { + const c = o.info; + if (c != null) walk_temporal_api_callback_v1_CallbackInfo(c, env, ctx, pending); + } +} + +function walk_temporal_api_batch_v1_BatchOperationReset( + o: temporal.api.batch.v1.IBatchOperationReset, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.batch.v1.BatchOperationReset', context) : context; + { + const a = o.postResetOperations; + if (a) for (const v of a) walk_temporal_api_workflow_v1_PostResetOperation(v, env, ctx, pending); + } +} + +function walk_temporal_api_batch_v1_BatchOperationSignal( + o: temporal.api.batch.v1.IBatchOperationSignal, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.batch.v1.BatchOperationSignal', context) : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_batch_v1_BatchOperationTermination( + o: temporal.api.batch.v1.IBatchOperationTermination, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.batch.v1.BatchOperationTermination', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_callback_v1_CallbackInfo( + o: temporal.api.callback.v1.ICallbackInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.callback.v1.CallbackInfo', context) : context; + { + const c = o.lastAttemptFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_CancelWorkflowExecutionCommandAttributes( + o: temporal.api.command.v1.ICancelWorkflowExecutionCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.CancelWorkflowExecutionCommandAttributes', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_Command( + o: temporal.api.command.v1.ICommand, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.command.v1.Command', context) : context; + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } + { + const a = o.eventGroupMarkers; + if (a) for (const v of a) walk_temporal_api_sdk_v1_EventGroupMarker(v, env, ctx, pending); + } + { + const c = o.scheduleActivityTaskCommandAttributes; + if (c != null) walk_temporal_api_command_v1_ScheduleActivityTaskCommandAttributes(c, env, ctx, pending); + } + { + const c = o.completeWorkflowExecutionCommandAttributes; + if (c != null) walk_temporal_api_command_v1_CompleteWorkflowExecutionCommandAttributes(c, env, ctx, pending); + } + { + const c = o.failWorkflowExecutionCommandAttributes; + if (c != null) walk_temporal_api_command_v1_FailWorkflowExecutionCommandAttributes(c, env, ctx, pending); + } + { + const c = o.cancelWorkflowExecutionCommandAttributes; + if (c != null) walk_temporal_api_command_v1_CancelWorkflowExecutionCommandAttributes(c, env, ctx, pending); + } + { + const c = o.recordMarkerCommandAttributes; + if (c != null) walk_temporal_api_command_v1_RecordMarkerCommandAttributes(c, env, ctx, pending); + } + { + const c = o.continueAsNewWorkflowExecutionCommandAttributes; + if (c != null) walk_temporal_api_command_v1_ContinueAsNewWorkflowExecutionCommandAttributes(c, env, ctx, pending); + } + { + const c = o.startChildWorkflowExecutionCommandAttributes; + if (c != null) walk_temporal_api_command_v1_StartChildWorkflowExecutionCommandAttributes(c, env, ctx, pending); + } + { + const c = o.signalExternalWorkflowExecutionCommandAttributes; + if (c != null) walk_temporal_api_command_v1_SignalExternalWorkflowExecutionCommandAttributes(c, env, ctx, pending); + } + { + const c = o.upsertWorkflowSearchAttributesCommandAttributes; + if (c != null) walk_temporal_api_command_v1_UpsertWorkflowSearchAttributesCommandAttributes(c, env, ctx, pending); + } + { + const c = o.modifyWorkflowPropertiesCommandAttributes; + if (c != null) walk_temporal_api_command_v1_ModifyWorkflowPropertiesCommandAttributes(c, env, ctx, pending); + } + { + const c = o.scheduleNexusOperationCommandAttributes; + if (c != null) walk_temporal_api_command_v1_ScheduleNexusOperationCommandAttributes(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_CompleteWorkflowExecutionCommandAttributes( + o: temporal.api.command.v1.ICompleteWorkflowExecutionCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.CompleteWorkflowExecutionCommandAttributes', context) + : context; + { + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_ContinueAsNewWorkflowExecutionCommandAttributes( + o: temporal.api.command.v1.IContinueAsNewWorkflowExecutionCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.ContinueAsNewWorkflowExecutionCommandAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.lastCompletionResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_command_v1_FailWorkflowExecutionCommandAttributes( + o: temporal.api.command.v1.IFailWorkflowExecutionCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.FailWorkflowExecutionCommandAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_ModifyWorkflowPropertiesCommandAttributes( + o: temporal.api.command.v1.IModifyWorkflowPropertiesCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.ModifyWorkflowPropertiesCommandAttributes', context) + : context; + { + const c = o.upsertedMemo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_RecordMarkerCommandAttributes( + o: temporal.api.command.v1.IRecordMarkerCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.RecordMarkerCommandAttributes', context) + : context; + { + const m = o.details; + if (m) for (const v of Object.values(m)) walk_temporal_api_common_v1_Payloads(v, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_ScheduleActivityTaskCommandAttributes( + o: temporal.api.command.v1.IScheduleActivityTaskCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.ScheduleActivityTaskCommandAttributes', context) + : context; + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_ScheduleNexusOperationCommandAttributes( + o: temporal.api.command.v1.IScheduleNexusOperationCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.ScheduleNexusOperationCommandAttributes', context) + : context; + { + const p = o.input; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.input = r; + }) + ); + } +} + +function walk_temporal_api_command_v1_SignalExternalWorkflowExecutionCommandAttributes( + o: temporal.api.command.v1.ISignalExternalWorkflowExecutionCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_command_v1_StartChildWorkflowExecutionCommandAttributes( + o: temporal.api.command.v1.IStartChildWorkflowExecutionCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.StartChildWorkflowExecutionCommandAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_command_v1_UpsertWorkflowSearchAttributesCommandAttributes( + o: temporal.api.command.v1.IUpsertWorkflowSearchAttributesCommandAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.command.v1.UpsertWorkflowSearchAttributesCommandAttributes', context) + : context; + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_common_v1_Header( + o: temporal.api.common.v1.IHeader, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.Header', context) : context; + { + const m = o.fields; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } +} + +function walk_temporal_api_common_v1_Memo( + o: temporal.api.common.v1.IMemo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.Memo', context) : context; + { + const m = o.fields; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } +} + +function walk_temporal_api_common_v1_Payloads( + o: temporal.api.common.v1.IPayloads, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.Payloads', context) : context; + { + const a = o.payloads; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.payloads = r; + }) + ); + } +} + +function walk_temporal_api_common_v1_SearchAttributes( + o: temporal.api.common.v1.ISearchAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.SearchAttributes', context) : context; + { + const m = o.indexedFields; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } +} + +function walk_temporal_api_compute_v1_ComputeConfig( + o: temporal.api.compute.v1.IComputeConfig, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.compute.v1.ComputeConfig', context) : context; + { + const m = o.scalingGroups; + if (m) + for (const v of Object.values(m)) walk_temporal_api_compute_v1_ComputeConfigScalingGroup(v, env, ctx, pending); + } +} + +function walk_temporal_api_compute_v1_ComputeConfigScalingGroup( + o: temporal.api.compute.v1.IComputeConfigScalingGroup, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.compute.v1.ComputeConfigScalingGroup', context) + : context; + { + const c = o.provider; + if (c != null) walk_temporal_api_compute_v1_ComputeProvider(c, env, ctx, pending); + } + { + const c = o.scaler; + if (c != null) walk_temporal_api_compute_v1_ComputeScaler(c, env, ctx, pending); + } +} + +function walk_temporal_api_compute_v1_ComputeConfigScalingGroupUpdate( + o: temporal.api.compute.v1.IComputeConfigScalingGroupUpdate, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.compute.v1.ComputeConfigScalingGroupUpdate', context) + : context; + { + const c = o.scalingGroup; + if (c != null) walk_temporal_api_compute_v1_ComputeConfigScalingGroup(c, env, ctx, pending); + } +} + +function walk_temporal_api_compute_v1_ComputeProvider( + o: temporal.api.compute.v1.IComputeProvider, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.compute.v1.ComputeProvider', context) : context; + { + const p = o.details; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.details = r; + }) + ); + } +} + +function walk_temporal_api_compute_v1_ComputeScaler( + o: temporal.api.compute.v1.IComputeScaler, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.compute.v1.ComputeScaler', context) : context; + { + const p = o.details; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.details = r; + }) + ); + } +} + +function walk_temporal_api_deployment_v1_DeploymentInfo( + o: temporal.api.deployment.v1.IDeploymentInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.deployment.v1.DeploymentInfo', context) : context; + { + const m = o.metadata; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } +} + +function walk_temporal_api_deployment_v1_UpdateDeploymentMetadata( + o: temporal.api.deployment.v1.IUpdateDeploymentMetadata, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.deployment.v1.UpdateDeploymentMetadata', context) + : context; + { + const m = o.upsertEntries; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } +} + +function walk_temporal_api_deployment_v1_VersionMetadata( + o: temporal.api.deployment.v1.IVersionMetadata, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.deployment.v1.VersionMetadata', context) : context; + { + const m = o.entries; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); + } +} + +function walk_temporal_api_deployment_v1_WorkerDeploymentVersionInfo( + o: temporal.api.deployment.v1.IWorkerDeploymentVersionInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.deployment.v1.WorkerDeploymentVersionInfo', context) + : context; + { + const c = o.metadata; + if (c != null) walk_temporal_api_deployment_v1_VersionMetadata(c, env, ctx, pending); + } + { + const c = o.computeConfig; + if (c != null) walk_temporal_api_compute_v1_ComputeConfig(c, env, ctx, pending); + } +} + +function walk_temporal_api_failure_v1_ApplicationFailureInfo( + o: temporal.api.failure.v1.IApplicationFailureInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.failure.v1.ApplicationFailureInfo', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_failure_v1_CanceledFailureInfo( + o: temporal.api.failure.v1.ICanceledFailureInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.failure.v1.CanceledFailureInfo', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_failure_v1_Failure( + o: temporal.api.failure.v1.IFailure, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.failure.v1.Failure', context) : context; + { + const p = o.encodedAttributes; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.encodedAttributes = r; + }) + ); + } + { + const c = o.cause; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.applicationFailureInfo; + if (c != null) walk_temporal_api_failure_v1_ApplicationFailureInfo(c, env, ctx, pending); + } + { + const c = o.timeoutFailureInfo; + if (c != null) walk_temporal_api_failure_v1_TimeoutFailureInfo(c, env, ctx, pending); + } + { + const c = o.canceledFailureInfo; + if (c != null) walk_temporal_api_failure_v1_CanceledFailureInfo(c, env, ctx, pending); + } + { + const c = o.resetWorkflowFailureInfo; + if (c != null) walk_temporal_api_failure_v1_ResetWorkflowFailureInfo(c, env, ctx, pending); + } +} + +function walk_temporal_api_failure_v1_ResetWorkflowFailureInfo( + o: temporal.api.failure.v1.IResetWorkflowFailureInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.failure.v1.ResetWorkflowFailureInfo', context) + : context; + { + const c = o.lastHeartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_failure_v1_TimeoutFailureInfo( + o: temporal.api.failure.v1.ITimeoutFailureInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.failure.v1.TimeoutFailureInfo', context) : context; + { + const c = o.lastHeartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ActivityTaskCanceledEventAttributes( + o: temporal.api.history.v1.IActivityTaskCanceledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ActivityTaskCanceledEventAttributes', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ActivityTaskCompletedEventAttributes( + o: temporal.api.history.v1.IActivityTaskCompletedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ActivityTaskCompletedEventAttributes', context) + : context; + { + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ActivityTaskFailedEventAttributes( + o: temporal.api.history.v1.IActivityTaskFailedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ActivityTaskFailedEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ActivityTaskScheduledEventAttributes( + o: temporal.api.history.v1.IActivityTaskScheduledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ActivityTaskScheduledEventAttributes', context) + : context; + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ActivityTaskStartedEventAttributes( + o: temporal.api.history.v1.IActivityTaskStartedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ActivityTaskStartedEventAttributes', context) + : context; + { + const c = o.lastFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ActivityTaskTimedOutEventAttributes( + o: temporal.api.history.v1.IActivityTaskTimedOutEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ActivityTaskTimedOutEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ChildWorkflowExecutionCanceledEventAttributes( + o: temporal.api.history.v1.IChildWorkflowExecutionCanceledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ChildWorkflowExecutionCanceledEventAttributes', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ChildWorkflowExecutionCompletedEventAttributes( + o: temporal.api.history.v1.IChildWorkflowExecutionCompletedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ChildWorkflowExecutionCompletedEventAttributes', context) + : context; + { + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ChildWorkflowExecutionFailedEventAttributes( + o: temporal.api.history.v1.IChildWorkflowExecutionFailedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ChildWorkflowExecutionFailedEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_ChildWorkflowExecutionStartedEventAttributes( + o: temporal.api.history.v1.IChildWorkflowExecutionStartedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.ChildWorkflowExecutionStartedEventAttributes', context) + : context; + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_History( + o: temporal.api.history.v1.IHistory, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.history.v1.History', context) : context; + { + const a = o.events; + if (a) for (const v of a) walk_temporal_api_history_v1_HistoryEvent(v, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_HistoryEvent( + o: temporal.api.history.v1.IHistoryEvent, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.history.v1.HistoryEvent', context) : context; + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } + { + const a = o.eventGroupMarkers; + if (a) for (const v of a) walk_temporal_api_sdk_v1_EventGroupMarker(v, env, ctx, pending); + } + { + const c = o.workflowExecutionStartedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionStartedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionCompletedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionCompletedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionFailedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionFailedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowTaskFailedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowTaskFailedEventAttributes(c, env, ctx, pending); + } + { + const c = o.activityTaskScheduledEventAttributes; + if (c != null) walk_temporal_api_history_v1_ActivityTaskScheduledEventAttributes(c, env, ctx, pending); + } + { + const c = o.activityTaskStartedEventAttributes; + if (c != null) walk_temporal_api_history_v1_ActivityTaskStartedEventAttributes(c, env, ctx, pending); + } + { + const c = o.activityTaskCompletedEventAttributes; + if (c != null) walk_temporal_api_history_v1_ActivityTaskCompletedEventAttributes(c, env, ctx, pending); + } + { + const c = o.activityTaskFailedEventAttributes; + if (c != null) walk_temporal_api_history_v1_ActivityTaskFailedEventAttributes(c, env, ctx, pending); + } + { + const c = o.activityTaskTimedOutEventAttributes; + if (c != null) walk_temporal_api_history_v1_ActivityTaskTimedOutEventAttributes(c, env, ctx, pending); + } + { + const c = o.activityTaskCanceledEventAttributes; + if (c != null) walk_temporal_api_history_v1_ActivityTaskCanceledEventAttributes(c, env, ctx, pending); + } + { + const c = o.markerRecordedEventAttributes; + if (c != null) walk_temporal_api_history_v1_MarkerRecordedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionSignaledEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionSignaledEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionTerminatedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionTerminatedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionCanceledEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionCanceledEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionContinuedAsNewEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionContinuedAsNewEventAttributes(c, env, ctx, pending); + } + { + const c = o.startChildWorkflowExecutionInitiatedEventAttributes; + if (c != null) + walk_temporal_api_history_v1_StartChildWorkflowExecutionInitiatedEventAttributes(c, env, ctx, pending); + } + { + const c = o.childWorkflowExecutionStartedEventAttributes; + if (c != null) walk_temporal_api_history_v1_ChildWorkflowExecutionStartedEventAttributes(c, env, ctx, pending); + } + { + const c = o.childWorkflowExecutionCompletedEventAttributes; + if (c != null) walk_temporal_api_history_v1_ChildWorkflowExecutionCompletedEventAttributes(c, env, ctx, pending); + } + { + const c = o.childWorkflowExecutionFailedEventAttributes; + if (c != null) walk_temporal_api_history_v1_ChildWorkflowExecutionFailedEventAttributes(c, env, ctx, pending); + } + { + const c = o.childWorkflowExecutionCanceledEventAttributes; + if (c != null) walk_temporal_api_history_v1_ChildWorkflowExecutionCanceledEventAttributes(c, env, ctx, pending); + } + { + const c = o.signalExternalWorkflowExecutionInitiatedEventAttributes; + if (c != null) + walk_temporal_api_history_v1_SignalExternalWorkflowExecutionInitiatedEventAttributes(c, env, ctx, pending); + } + { + const c = o.upsertWorkflowSearchAttributesEventAttributes; + if (c != null) walk_temporal_api_history_v1_UpsertWorkflowSearchAttributesEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionUpdateAcceptedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionUpdateAcceptedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionUpdateRejectedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionUpdateRejectedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionUpdateCompletedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionUpdateCompletedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowPropertiesModifiedExternallyEventAttributes; + if (c != null) + walk_temporal_api_history_v1_WorkflowPropertiesModifiedExternallyEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowPropertiesModifiedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowPropertiesModifiedEventAttributes(c, env, ctx, pending); + } + { + const c = o.workflowExecutionUpdateAdmittedEventAttributes; + if (c != null) walk_temporal_api_history_v1_WorkflowExecutionUpdateAdmittedEventAttributes(c, env, ctx, pending); + } + { + const c = o.nexusOperationScheduledEventAttributes; + if (c != null) walk_temporal_api_history_v1_NexusOperationScheduledEventAttributes(c, env, ctx, pending); + } + { + const c = o.nexusOperationCompletedEventAttributes; + if (c != null) walk_temporal_api_history_v1_NexusOperationCompletedEventAttributes(c, env, ctx, pending); + } + { + const c = o.nexusOperationFailedEventAttributes; + if (c != null) walk_temporal_api_history_v1_NexusOperationFailedEventAttributes(c, env, ctx, pending); + } + { + const c = o.nexusOperationCanceledEventAttributes; + if (c != null) walk_temporal_api_history_v1_NexusOperationCanceledEventAttributes(c, env, ctx, pending); + } + { + const c = o.nexusOperationTimedOutEventAttributes; + if (c != null) walk_temporal_api_history_v1_NexusOperationTimedOutEventAttributes(c, env, ctx, pending); + } + { + const c = o.nexusOperationCancelRequestFailedEventAttributes; + if (c != null) walk_temporal_api_history_v1_NexusOperationCancelRequestFailedEventAttributes(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_MarkerRecordedEventAttributes( + o: temporal.api.history.v1.IMarkerRecordedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.MarkerRecordedEventAttributes', context) + : context; + { + const m = o.details; + if (m) for (const v of Object.values(m)) walk_temporal_api_common_v1_Payloads(v, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_NexusOperationCanceledEventAttributes( + o: temporal.api.history.v1.INexusOperationCanceledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.NexusOperationCanceledEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_NexusOperationCancelRequestFailedEventAttributes( + o: temporal.api.history.v1.INexusOperationCancelRequestFailedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.NexusOperationCancelRequestFailedEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_NexusOperationCompletedEventAttributes( + o: temporal.api.history.v1.INexusOperationCompletedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.NexusOperationCompletedEventAttributes', context) + : context; + { + const p = o.result; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.result = r; + }) + ); + } +} + +function walk_temporal_api_history_v1_NexusOperationFailedEventAttributes( + o: temporal.api.history.v1.INexusOperationFailedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.NexusOperationFailedEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_NexusOperationScheduledEventAttributes( + o: temporal.api.history.v1.INexusOperationScheduledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.NexusOperationScheduledEventAttributes', context) + : context; + { + const p = o.input; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.input = r; + }) + ); + } +} + +function walk_temporal_api_history_v1_NexusOperationTimedOutEventAttributes( + o: temporal.api.history.v1.INexusOperationTimedOutEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.NexusOperationTimedOutEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_SignalExternalWorkflowExecutionInitiatedEventAttributes( + o: temporal.api.history.v1.ISignalExternalWorkflowExecutionInitiatedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_StartChildWorkflowExecutionInitiatedEventAttributes( + o: temporal.api.history.v1.IStartChildWorkflowExecutionInitiatedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.StartChildWorkflowExecutionInitiatedEventAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_history_v1_UpsertWorkflowSearchAttributesEventAttributes( + o: temporal.api.history.v1.IUpsertWorkflowSearchAttributesEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.UpsertWorkflowSearchAttributesEventAttributes', context) + : context; + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionCanceledEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionCanceledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionCanceledEventAttributes', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionCompletedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionCompletedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionCompletedEventAttributes', context) + : context; + { + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionContinuedAsNewEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionContinuedAsNewEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionContinuedAsNewEventAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.lastCompletionResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionFailedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionFailedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionFailedEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionSignaledEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionSignaledEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionSignaledEventAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionStartedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionStartedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionStartedEventAttributes', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.continuedFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.lastCompletionResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionTerminatedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionTerminatedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionTerminatedEventAttributes', context) + : context; + { + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionUpdateAcceptedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionUpdateAcceptedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionUpdateAcceptedEventAttributes', context) + : context; + { + const c = o.acceptedRequest; + if (c != null) walk_temporal_api_update_v1_Request(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionUpdateAdmittedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionUpdateAdmittedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionUpdateAdmittedEventAttributes', context) + : context; + { + const c = o.request; + if (c != null) walk_temporal_api_update_v1_Request(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionUpdateCompletedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionUpdateCompletedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionUpdateCompletedEventAttributes', context) + : context; + { + const c = o.outcome; + if (c != null) walk_temporal_api_update_v1_Outcome(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowExecutionUpdateRejectedEventAttributes( + o: temporal.api.history.v1.IWorkflowExecutionUpdateRejectedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowExecutionUpdateRejectedEventAttributes', context) + : context; + { + const c = o.rejectedRequest; + if (c != null) walk_temporal_api_update_v1_Request(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowPropertiesModifiedEventAttributes( + o: temporal.api.history.v1.IWorkflowPropertiesModifiedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowPropertiesModifiedEventAttributes', context) + : context; + { + const c = o.upsertedMemo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowPropertiesModifiedExternallyEventAttributes( + o: temporal.api.history.v1.IWorkflowPropertiesModifiedExternallyEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowPropertiesModifiedExternallyEventAttributes', context) + : context; + { + const c = o.upsertedMemo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } +} + +function walk_temporal_api_history_v1_WorkflowTaskFailedEventAttributes( + o: temporal.api.history.v1.IWorkflowTaskFailedEventAttributes, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.history.v1.WorkflowTaskFailedEventAttributes', context) + : context; + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_nexus_v1_NexusOperationExecutionCancellationInfo( + o: temporal.api.nexus.v1.INexusOperationExecutionCancellationInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.nexus.v1.NexusOperationExecutionCancellationInfo', context) + : context; + { + const c = o.lastAttemptFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_nexus_v1_NexusOperationExecutionInfo( + o: temporal.api.nexus.v1.INexusOperationExecutionInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.nexus.v1.NexusOperationExecutionInfo', context) + : context; + { + const c = o.lastAttemptFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.cancellationInfo; + if (c != null) walk_temporal_api_nexus_v1_NexusOperationExecutionCancellationInfo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } +} + +function walk_temporal_api_nexus_v1_NexusOperationExecutionListInfo( + o: temporal.api.nexus.v1.INexusOperationExecutionListInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.nexus.v1.NexusOperationExecutionListInfo', context) + : context; + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_nexus_v1_Request( + o: temporal.api.nexus.v1.IRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.nexus.v1.Request', context) : context; + { + const c = o.startOperation; + if (c != null) walk_temporal_api_nexus_v1_StartOperationRequest(c, env, ctx, pending); + } +} + +function walk_temporal_api_nexus_v1_Response( + o: temporal.api.nexus.v1.IResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.nexus.v1.Response', context) : context; + { + const c = o.startOperation; + if (c != null) walk_temporal_api_nexus_v1_StartOperationResponse(c, env, ctx, pending); + } +} + +function walk_temporal_api_nexus_v1_StartOperationRequest( + o: temporal.api.nexus.v1.IStartOperationRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.nexus.v1.StartOperationRequest', context) + : context; + { + const p = o.payload; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.payload = r; + }) + ); + } +} + +function walk_temporal_api_nexus_v1_StartOperationResponse( + o: temporal.api.nexus.v1.IStartOperationResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.nexus.v1.StartOperationResponse', context) + : context; + { + const c = o.syncSuccess; + if (c != null) walk_temporal_api_nexus_v1_StartOperationResponse_Sync(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_nexus_v1_StartOperationResponse_Sync( + o: temporal.api.nexus.v1.StartOperationResponse.ISync, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.nexus.v1.StartOperationResponse.Sync', context) + : context; + { + const p = o.payload; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.payload = r; + }) + ); + } +} + +function walk_temporal_api_query_v1_WorkflowQuery( + o: temporal.api.query.v1.IWorkflowQuery, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.query.v1.WorkflowQuery', context) : context; + { + const c = o.queryArgs; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_query_v1_WorkflowQueryResult( + o: temporal.api.query.v1.IWorkflowQueryResult, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.query.v1.WorkflowQueryResult', context) : context; + { + const c = o.answer; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_schedule_v1_Schedule( + o: temporal.api.schedule.v1.ISchedule, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.schedule.v1.Schedule', context) : context; + { + const c = o.action; + if (c != null) walk_temporal_api_schedule_v1_ScheduleAction(c, env, ctx, pending); + } +} + +function walk_temporal_api_schedule_v1_ScheduleAction( + o: temporal.api.schedule.v1.IScheduleAction, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.schedule.v1.ScheduleAction', context) : context; + { + const c = o.startWorkflow; + if (c != null) walk_temporal_api_workflow_v1_NewWorkflowExecutionInfo(c, env, ctx, pending); + } +} + +function walk_temporal_api_schedule_v1_ScheduleListEntry( + o: temporal.api.schedule.v1.IScheduleListEntry, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.schedule.v1.ScheduleListEntry', context) : context; + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_sdk_v1_EventGroupMarker( + o: temporal.api.sdk.v1.IEventGroupMarker, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.sdk.v1.EventGroupMarker', context) : context; + { + const c = o.label; + if (c != null) walk_temporal_api_sdk_v1_EventGroupMarker_Label(c, env, ctx, pending); + } +} + +function walk_temporal_api_sdk_v1_EventGroupMarker_Label( + o: temporal.api.sdk.v1.EventGroupMarker.ILabel, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.sdk.v1.EventGroupMarker.Label', context) : context; + { + const p = o.label; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.label = r; + }) + ); + } +} + +function walk_temporal_api_sdk_v1_UserMetadata( + o: temporal.api.sdk.v1.IUserMetadata, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.sdk.v1.UserMetadata', context) : context; + { + const p = o.summary; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.summary = r; + }) + ); + } + { + const p = o.details; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.details = r; + }) + ); + } +} + +function walk_temporal_api_update_v1_Input( + o: temporal.api.update.v1.IInput, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.update.v1.Input', context) : context; + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.args; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } +} + +function walk_temporal_api_update_v1_Outcome( + o: temporal.api.update.v1.IOutcome, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.update.v1.Outcome', context) : context; + { + const c = o.success; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_update_v1_Request( + o: temporal.api.update.v1.IRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.update.v1.Request', context) : context; + { + const c = o.input; + if (c != null) walk_temporal_api_update_v1_Input(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_CallbackInfo( + o: temporal.api.workflow.v1.ICallbackInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.workflow.v1.CallbackInfo', context) : context; + { + const c = o.lastAttemptFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_NewWorkflowExecutionInfo( + o: temporal.api.workflow.v1.INewWorkflowExecutionInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.NewWorkflowExecutionInfo', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_NexusOperationCancellationInfo( + o: temporal.api.workflow.v1.INexusOperationCancellationInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.NexusOperationCancellationInfo', context) + : context; + { + const c = o.lastAttemptFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_PendingActivityInfo( + o: temporal.api.workflow.v1.IPendingActivityInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.PendingActivityInfo', context) + : context; + { + const c = o.heartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.lastFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_PendingNexusOperationInfo( + o: temporal.api.workflow.v1.IPendingNexusOperationInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.PendingNexusOperationInfo', context) + : context; + { + const c = o.lastAttemptFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.cancellationInfo; + if (c != null) walk_temporal_api_workflow_v1_NexusOperationCancellationInfo(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_PostResetOperation( + o: temporal.api.workflow.v1.IPostResetOperation, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.PostResetOperation', context) + : context; + { + const c = o.signalWorkflow; + if (c != null) walk_temporal_api_workflow_v1_PostResetOperation_SignalWorkflow(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_PostResetOperation_SignalWorkflow( + o: temporal.api.workflow.v1.PostResetOperation.ISignalWorkflow, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.PostResetOperation.SignalWorkflow', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_WorkflowExecutionConfig( + o: temporal.api.workflow.v1.IWorkflowExecutionConfig, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.WorkflowExecutionConfig', context) + : context; + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflow_v1_WorkflowExecutionInfo( + o: temporal.api.workflow.v1.IWorkflowExecutionInfo, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflow.v1.WorkflowExecutionInfo', context) + : context; + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } +} + +function walk_temporal_api_workflowservice_v1_CountActivityExecutionsResponse( + o: temporal.api.workflowservice.v1.ICountActivityExecutionsResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountActivityExecutionsResponse', context) + : context; + { + const a = o.groups; + if (a) + for (const v of a) + walk_temporal_api_workflowservice_v1_CountActivityExecutionsResponse_AggregationGroup(v, env, ctx, pending); + } +} + +function walk_temporal_api_workflowservice_v1_CountActivityExecutionsResponse_AggregationGroup( + o: temporal.api.workflowservice.v1.CountActivityExecutionsResponse.IAggregationGroup, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountActivityExecutionsResponse.AggregationGroup', context) + : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const a = o.groupValues; + if (a && a.length) + pending.push( + env.transformPayloads(a, ctx).then((r) => { + o.groupValues = r; + }) + ); } } -function walk_coresdk_activity_result_Failure( - o: coresdk.activity_result.IFailure, +function walk_temporal_api_workflowservice_v1_CountNexusOperationExecutionsResponse( + o: temporal.api.workflowservice.v1.ICountNexusOperationExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.Failure', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountNexusOperationExecutionsResponse', context) + : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const a = o.groups; + if (a) + for (const v of a) + walk_temporal_api_workflowservice_v1_CountNexusOperationExecutionsResponse_AggregationGroup( + v, + env, + ctx, + pending + ); } } -function walk_coresdk_activity_result_Success( - o: coresdk.activity_result.ISuccess, +function walk_temporal_api_workflowservice_v1_CountNexusOperationExecutionsResponse_AggregationGroup( + o: temporal.api.workflowservice.v1.CountNexusOperationExecutionsResponse.IAggregationGroup, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_result.Success', context) : context; + const ctx = env.deriveContext + ? env.deriveContext( + o, + 'temporal.api.workflowservice.v1.CountNexusOperationExecutionsResponse.AggregationGroup', + context + ) + : context; { - const p = o.result; - if (p != null) + const a = o.groupValues; + if (a && a.length) pending.push( - env.transformPayload(p, ctx).then((r) => { - o.result = r; + env.transformPayloads(a, ctx).then((r) => { + o.groupValues = r; }) ); } } -function walk_coresdk_activity_task_ActivityTask( - o: coresdk.activity_task.IActivityTask, +function walk_temporal_api_workflowservice_v1_CountSchedulesResponse( + o: temporal.api.workflowservice.v1.ICountSchedulesResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_task.ActivityTask', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountSchedulesResponse', context) + : context; { - const c = o.start; - if (c != null) walk_coresdk_activity_task_Start(c, env, ctx, pending); + const a = o.groups; + if (a) + for (const v of a) + walk_temporal_api_workflowservice_v1_CountSchedulesResponse_AggregationGroup(v, env, ctx, pending); } } -function walk_coresdk_activity_task_Start( - o: coresdk.activity_task.IStart, +function walk_temporal_api_workflowservice_v1_CountSchedulesResponse_AggregationGroup( + o: temporal.api.workflowservice.v1.CountSchedulesResponse.IAggregationGroup, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.activity_task.Start', context) : context; - { - const m = o.headerFields; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountSchedulesResponse.AggregationGroup', context) + : context; { - const a = o.input; + const a = o.groupValues; if (a && a.length) pending.push( env.transformPayloads(a, ctx).then((r) => { - o.input = r; + o.groupValues = r; }) ); } +} + +function walk_temporal_api_workflowservice_v1_CountWorkflowExecutionsResponse( + o: temporal.api.workflowservice.v1.ICountWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse', context) + : context; { - const a = o.heartbeatDetails; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.heartbeatDetails = r; - }) - ); + const a = o.groups; + if (a) + for (const v of a) + walk_temporal_api_workflowservice_v1_CountWorkflowExecutionsResponse_AggregationGroup(v, env, ctx, pending); } } -function walk_coresdk_ActivityHeartbeat( - o: coresdk.IActivityHeartbeat, +function walk_temporal_api_workflowservice_v1_CountWorkflowExecutionsResponse_AggregationGroup( + o: temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse.IAggregationGroup, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.ActivityHeartbeat', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse.AggregationGroup', context) + : context; { - const a = o.details; + const a = o.groupValues; if (a && a.length) pending.push( env.transformPayloads(a, ctx).then((r) => { - o.details = r; + o.groupValues = r; }) ); } } -function walk_coresdk_ActivityTaskCompletion( - o: coresdk.IActivityTaskCompletion, +function walk_temporal_api_workflowservice_v1_CreateScheduleRequest( + o: temporal.api.workflowservice.v1.ICreateScheduleRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.ActivityTaskCompletion', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CreateScheduleRequest', context) + : context; { - const c = o.result; - if (c != null) walk_coresdk_activity_result_ActivityExecutionResult(c, env, ctx, pending); + const c = o.schedule; + if (c != null) walk_temporal_api_schedule_v1_Schedule(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } } } -function walk_coresdk_child_workflow_Cancellation( - o: coresdk.child_workflow.ICancellation, +function walk_temporal_api_workflowservice_v1_CreateWorkerDeploymentVersionRequest( + o: temporal.api.workflowservice.v1.ICreateWorkerDeploymentVersionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.Cancellation', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.CreateWorkerDeploymentVersionRequest', context) + : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.computeConfig; + if (c != null) walk_temporal_api_compute_v1_ComputeConfig(c, env, ctx, pending); } } -function walk_coresdk_child_workflow_ChildWorkflowResult( - o: coresdk.child_workflow.IChildWorkflowResult, +function walk_temporal_api_workflowservice_v1_DescribeActivityExecutionResponse( + o: temporal.api.workflowservice.v1.IDescribeActivityExecutionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.ChildWorkflowResult', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.DescribeActivityExecutionResponse', context) + : context; { - const c = o.completed; - if (c != null) walk_coresdk_child_workflow_Success(c, env, ctx, pending); + const c = o.info; + if (c != null) walk_temporal_api_activity_v1_ActivityExecutionInfo(c, env, ctx, pending); } { - const c = o.failed; - if (c != null) walk_coresdk_child_workflow_Failure(c, env, ctx, pending); + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } { - const c = o.cancelled; - if (c != null) walk_coresdk_child_workflow_Cancellation(c, env, ctx, pending); + const c = o.outcome; + if (c != null) walk_temporal_api_activity_v1_ActivityExecutionOutcome(c, env, ctx, pending); + } + { + const a = o.callbacks; + if (a) for (const v of a) walk_temporal_api_activity_v1_CallbackInfo(v, env, ctx, pending); } } -function walk_coresdk_child_workflow_Failure( - o: coresdk.child_workflow.IFailure, +function walk_temporal_api_workflowservice_v1_DescribeDeploymentResponse( + o: temporal.api.workflowservice.v1.IDescribeDeploymentResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.Failure', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.DescribeDeploymentResponse', context) + : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.deploymentInfo; + if (c != null) walk_temporal_api_deployment_v1_DeploymentInfo(c, env, ctx, pending); } } -function walk_coresdk_child_workflow_Success( - o: coresdk.child_workflow.ISuccess, +function walk_temporal_api_workflowservice_v1_DescribeNexusOperationExecutionResponse( + o: temporal.api.workflowservice.v1.IDescribeNexusOperationExecutionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.child_workflow.Success', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.DescribeNexusOperationExecutionResponse', context) + : context; { - const p = o.result; + const c = o.info; + if (c != null) walk_temporal_api_nexus_v1_NexusOperationExecutionInfo(c, env, ctx, pending); + } + { + const p = o.input; if (p != null) pending.push( env.transformPayload(p, ctx).then((r) => { - o.result = r; + o.input = r; }) ); } -} - -function walk_coresdk_nexus_NexusOperationResult( - o: coresdk.nexus.INexusOperationResult, - env: WalkEnv, - context: Ctx, - pending: Promise[] -): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.nexus.NexusOperationResult', context) : context; { - const p = o.completed; + const p = o.result; if (p != null) pending.push( env.transformPayload(p, ctx).then((r) => { - o.completed = r; + o.result = r; }) ); } { - const c = o.failed; + const c = o.failure; if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_DescribeScheduleResponse( + o: temporal.api.workflowservice.v1.IDescribeScheduleResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.DescribeScheduleResponse', context) + : context; { - const c = o.cancelled; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.schedule; + if (c != null) walk_temporal_api_schedule_v1_Schedule(c, env, ctx, pending); } { - const c = o.timedOut; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } } } -function walk_coresdk_nexus_NexusTask( - o: coresdk.nexus.INexusTask, +function walk_temporal_api_workflowservice_v1_DescribeWorkerDeploymentVersionResponse( + o: temporal.api.workflowservice.v1.IDescribeWorkerDeploymentVersionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.nexus.NexusTask', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse', context) + : context; { - const c = o.task; - if (c != null) walk_temporal_api_workflowservice_v1_PollNexusTaskQueueResponse(c, env, ctx, pending); + const c = o.workerDeploymentVersionInfo; + if (c != null) walk_temporal_api_deployment_v1_WorkerDeploymentVersionInfo(c, env, ctx, pending); } } -function walk_coresdk_nexus_NexusTaskCompletion( - o: coresdk.nexus.INexusTaskCompletion, +function walk_temporal_api_workflowservice_v1_DescribeWorkflowExecutionResponse( + o: temporal.api.workflowservice.v1.IDescribeWorkflowExecutionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.nexus.NexusTaskCompletion', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.DescribeWorkflowExecutionResponse', context) + : context; { - const c = o.completed; - if (c != null) walk_temporal_api_nexus_v1_Response(c, env, ctx, pending); + const c = o.executionConfig; + if (c != null) walk_temporal_api_workflow_v1_WorkflowExecutionConfig(c, env, ctx, pending); } { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.workflowExecutionInfo; + if (c != null) walk_temporal_api_workflow_v1_WorkflowExecutionInfo(c, env, ctx, pending); + } + { + const a = o.pendingActivities; + if (a) for (const v of a) walk_temporal_api_workflow_v1_PendingActivityInfo(v, env, ctx, pending); + } + { + const a = o.callbacks; + if (a) for (const v of a) walk_temporal_api_workflow_v1_CallbackInfo(v, env, ctx, pending); + } + { + const a = o.pendingNexusOperations; + if (a) for (const v of a) walk_temporal_api_workflow_v1_PendingNexusOperationInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_DoUpdate( - o: coresdk.workflow_activation.IDoUpdate, +function walk_temporal_api_workflowservice_v1_ExecuteMultiOperationRequest( + o: temporal.api.workflowservice.v1.IExecuteMultiOperationRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_activation.DoUpdate', context) : context; - { - const a = o.input; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.input = r; - }) - ); - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ExecuteMultiOperationRequest', context) + : context; { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const a = o.operations; + if (a) + for (const v of a) + walk_temporal_api_workflowservice_v1_ExecuteMultiOperationRequest_Operation(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_InitializeWorkflow( - o: coresdk.workflow_activation.IInitializeWorkflow, +function walk_temporal_api_workflowservice_v1_ExecuteMultiOperationRequest_Operation( + o: temporal.api.workflowservice.v1.ExecuteMultiOperationRequest.IOperation, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.InitializeWorkflow', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ExecuteMultiOperationRequest.Operation', context) : context; { - const a = o.arguments; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.arguments = r; - }) - ); - } - { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const c = o.startWorkflow; + if (c != null) walk_temporal_api_workflowservice_v1_StartWorkflowExecutionRequest(c, env, ctx, pending); } { - const c = o.continuedFailure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.updateWorkflow; + if (c != null) walk_temporal_api_workflowservice_v1_UpdateWorkflowExecutionRequest(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_ExecuteMultiOperationResponse( + o: temporal.api.workflowservice.v1.IExecuteMultiOperationResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ExecuteMultiOperationResponse', context) + : context; { - const c = o.lastCompletionResult; - if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + const a = o.responses; + if (a) + for (const v of a) + walk_temporal_api_workflowservice_v1_ExecuteMultiOperationResponse_Response(v, env, ctx, pending); } - { - const c = o.memo; - if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); +} + +function walk_temporal_api_workflowservice_v1_ExecuteMultiOperationResponse_Response( + o: temporal.api.workflowservice.v1.ExecuteMultiOperationResponse.IResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ExecuteMultiOperationResponse.Response', context) + : context; + { + const c = o.startWorkflow; + if (c != null) walk_temporal_api_workflowservice_v1_StartWorkflowExecutionResponse(c, env, ctx, pending); } { - if (!env.skipSearchAttributes) { - const c = o.searchAttributes; - if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); - } + const c = o.updateWorkflow; + if (c != null) walk_temporal_api_workflowservice_v1_UpdateWorkflowExecutionResponse(c, env, ctx, pending); } } -function walk_coresdk_workflow_activation_QueryWorkflow( - o: coresdk.workflow_activation.IQueryWorkflow, +function walk_temporal_api_workflowservice_v1_GetCurrentDeploymentResponse( + o: temporal.api.workflowservice.v1.IGetCurrentDeploymentResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_activation.QueryWorkflow', context) : context; - { - const a = o.arguments; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.arguments = r; - }) - ); - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.GetCurrentDeploymentResponse', context) + : context; { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const c = o.currentDeploymentInfo; + if (c != null) walk_temporal_api_deployment_v1_DeploymentInfo(c, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveActivity( - o: coresdk.workflow_activation.IResolveActivity, +function walk_temporal_api_workflowservice_v1_GetDeploymentReachabilityResponse( + o: temporal.api.workflowservice.v1.IGetDeploymentReachabilityResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveActivity', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.GetDeploymentReachabilityResponse', context) : context; { - const c = o.result; - if (c != null) walk_coresdk_activity_result_ActivityResolution(c, env, ctx, pending); + const c = o.deploymentInfo; + if (c != null) walk_temporal_api_deployment_v1_DeploymentInfo(c, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveChildWorkflowExecution( - o: coresdk.workflow_activation.IResolveChildWorkflowExecution, +function walk_temporal_api_workflowservice_v1_GetWorkflowExecutionHistoryResponse( + o: temporal.api.workflowservice.v1.IGetWorkflowExecutionHistoryResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveChildWorkflowExecution', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryResponse', context) : context; { - const c = o.result; - if (c != null) walk_coresdk_child_workflow_ChildWorkflowResult(c, env, ctx, pending); + const c = o.history; + if (c != null) walk_temporal_api_history_v1_History(c, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStart( - o: coresdk.workflow_activation.IResolveChildWorkflowExecutionStart, +function walk_temporal_api_workflowservice_v1_GetWorkflowExecutionHistoryReverseResponse( + o: temporal.api.workflowservice.v1.IGetWorkflowExecutionHistoryReverseResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveChildWorkflowExecutionStart', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryReverseResponse', context) : context; { - const c = o.cancelled; - if (c != null) walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStartCancelled(c, env, ctx, pending); + const c = o.history; + if (c != null) walk_temporal_api_history_v1_History(c, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStartCancelled( - o: coresdk.workflow_activation.IResolveChildWorkflowExecutionStartCancelled, +function walk_temporal_api_workflowservice_v1_ListActivityExecutionsResponse( + o: temporal.api.workflowservice.v1.IListActivityExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelled', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListActivityExecutionsResponse', context) : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const a = o.executions; + if (a) for (const v of a) walk_temporal_api_activity_v1_ActivityExecutionListInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveNexusOperation( - o: coresdk.workflow_activation.IResolveNexusOperation, +function walk_temporal_api_workflowservice_v1_ListArchivedWorkflowExecutionsResponse( + o: temporal.api.workflowservice.v1.IListArchivedWorkflowExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveNexusOperation', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListArchivedWorkflowExecutionsResponse', context) : context; { - const c = o.result; - if (c != null) walk_coresdk_nexus_NexusOperationResult(c, env, ctx, pending); + const a = o.executions; + if (a) for (const v of a) walk_temporal_api_workflow_v1_WorkflowExecutionInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveNexusOperationStart( - o: coresdk.workflow_activation.IResolveNexusOperationStart, +function walk_temporal_api_workflowservice_v1_ListClosedWorkflowExecutionsResponse( + o: temporal.api.workflowservice.v1.IListClosedWorkflowExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveNexusOperationStart', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListClosedWorkflowExecutionsResponse', context) : context; { - const c = o.failed; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const a = o.executions; + if (a) for (const v of a) walk_temporal_api_workflow_v1_WorkflowExecutionInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveRequestCancelExternalWorkflow( - o: coresdk.workflow_activation.IResolveRequestCancelExternalWorkflow, +function walk_temporal_api_workflowservice_v1_ListNexusOperationExecutionsResponse( + o: temporal.api.workflowservice.v1.IListNexusOperationExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveRequestCancelExternalWorkflow', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListNexusOperationExecutionsResponse', context) : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const a = o.operations; + if (a) for (const v of a) walk_temporal_api_nexus_v1_NexusOperationExecutionListInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_ResolveSignalExternalWorkflow( - o: coresdk.workflow_activation.IResolveSignalExternalWorkflow, +function walk_temporal_api_workflowservice_v1_ListOpenWorkflowExecutionsResponse( + o: temporal.api.workflowservice.v1.IListOpenWorkflowExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.ResolveSignalExternalWorkflow', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListOpenWorkflowExecutionsResponse', context) : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const a = o.executions; + if (a) for (const v of a) walk_temporal_api_workflow_v1_WorkflowExecutionInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_SignalWorkflow( - o: coresdk.workflow_activation.ISignalWorkflow, +function walk_temporal_api_workflowservice_v1_ListSchedulesResponse( + o: temporal.api.workflowservice.v1.IListSchedulesResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_activation.SignalWorkflow', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListSchedulesResponse', context) + : context; { - const a = o.input; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.input = r; - }) - ); + const a = o.schedules; + if (a) for (const v of a) walk_temporal_api_schedule_v1_ScheduleListEntry(v, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_ListWorkflowExecutionsResponse( + o: temporal.api.workflowservice.v1.IListWorkflowExecutionsResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ListWorkflowExecutionsResponse', context) + : context; { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const a = o.executions; + if (a) for (const v of a) walk_temporal_api_workflow_v1_WorkflowExecutionInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_activation_WorkflowActivation( - o: coresdk.workflow_activation.IWorkflowActivation, +function walk_temporal_api_workflowservice_v1_PollActivityExecutionResponse( + o: temporal.api.workflowservice.v1.IPollActivityExecutionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.WorkflowActivation', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollActivityExecutionResponse', context) : context; { - const a = o.jobs; - if (a) for (const v of a) walk_coresdk_workflow_activation_WorkflowActivationJob(v, env, ctx, pending); + const c = o.outcome; + if (c != null) walk_temporal_api_activity_v1_ActivityExecutionOutcome(c, env, ctx, pending); } } -function walk_coresdk_workflow_activation_WorkflowActivationJob( - o: coresdk.workflow_activation.IWorkflowActivationJob, +function walk_temporal_api_workflowservice_v1_PollActivityTaskQueueResponse( + o: temporal.api.workflowservice.v1.IPollActivityTaskQueueResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_activation.WorkflowActivationJob', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollActivityTaskQueueResponse', context) : context; { - const c = o.initializeWorkflow; - if (c != null) walk_coresdk_workflow_activation_InitializeWorkflow(c, env, ctx, pending); + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); } { - const c = o.queryWorkflow; - if (c != null) walk_coresdk_workflow_activation_QueryWorkflow(c, env, ctx, pending); + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } { - const c = o.signalWorkflow; - if (c != null) walk_coresdk_workflow_activation_SignalWorkflow(c, env, ctx, pending); + const c = o.heartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_PollNexusOperationExecutionResponse( + o: temporal.api.workflowservice.v1.IPollNexusOperationExecutionResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollNexusOperationExecutionResponse', context) + : context; { - const c = o.resolveActivity; - if (c != null) walk_coresdk_workflow_activation_ResolveActivity(c, env, ctx, pending); + const p = o.result; + if (p != null) + pending.push( + env.transformPayload(p, ctx).then((r) => { + o.result = r; + }) + ); } { - const c = o.resolveChildWorkflowExecutionStart; - if (c != null) walk_coresdk_workflow_activation_ResolveChildWorkflowExecutionStart(c, env, ctx, pending); + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_PollNexusTaskQueueResponse( + o: temporal.api.workflowservice.v1.IPollNexusTaskQueueResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollNexusTaskQueueResponse', context) + : context; { - const c = o.resolveChildWorkflowExecution; - if (c != null) walk_coresdk_workflow_activation_ResolveChildWorkflowExecution(c, env, ctx, pending); + const c = o.request; + if (c != null) walk_temporal_api_nexus_v1_Request(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_PollWorkflowExecutionUpdateResponse( + o: temporal.api.workflowservice.v1.IPollWorkflowExecutionUpdateResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollWorkflowExecutionUpdateResponse', context) + : context; { - const c = o.resolveSignalExternalWorkflow; - if (c != null) walk_coresdk_workflow_activation_ResolveSignalExternalWorkflow(c, env, ctx, pending); + const c = o.outcome; + if (c != null) walk_temporal_api_update_v1_Outcome(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_PollWorkflowTaskQueueResponse( + o: temporal.api.workflowservice.v1.IPollWorkflowTaskQueueResponse, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse', context) + : context; { - const c = o.resolveRequestCancelExternalWorkflow; - if (c != null) walk_coresdk_workflow_activation_ResolveRequestCancelExternalWorkflow(c, env, ctx, pending); + const c = o.history; + if (c != null) walk_temporal_api_history_v1_History(c, env, ctx, pending); } { - const c = o.doUpdate; - if (c != null) walk_coresdk_workflow_activation_DoUpdate(c, env, ctx, pending); + const c = o.query; + if (c != null) walk_temporal_api_query_v1_WorkflowQuery(c, env, ctx, pending); } { - const c = o.resolveNexusOperationStart; - if (c != null) walk_coresdk_workflow_activation_ResolveNexusOperationStart(c, env, ctx, pending); + const m = o.queries; + if (m) for (const v of Object.values(m)) walk_temporal_api_query_v1_WorkflowQuery(v, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_QueryWorkflowRequest( + o: temporal.api.workflowservice.v1.IQueryWorkflowRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.QueryWorkflowRequest', context) + : context; { - const c = o.resolveNexusOperation; - if (c != null) walk_coresdk_workflow_activation_ResolveNexusOperation(c, env, ctx, pending); + const c = o.query; + if (c != null) walk_temporal_api_query_v1_WorkflowQuery(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_CompleteWorkflowExecution( - o: coresdk.workflow_commands.ICompleteWorkflowExecution, +function walk_temporal_api_workflowservice_v1_QueryWorkflowResponse( + o: temporal.api.workflowservice.v1.IQueryWorkflowResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.CompleteWorkflowExecution', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.QueryWorkflowResponse', context) : context; { - const p = o.result; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.result = r; - }) - ); + const c = o.queryResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_ContinueAsNewWorkflowExecution( - o: coresdk.workflow_commands.IContinueAsNewWorkflowExecution, +function walk_temporal_api_workflowservice_v1_RecordActivityTaskHeartbeatByIdRequest( + o: temporal.api.workflowservice.v1.IRecordActivityTaskHeartbeatByIdRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.ContinueAsNewWorkflowExecution', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RecordActivityTaskHeartbeatByIdRequest', context) : context; { - const a = o.arguments; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.arguments = r; - }) - ); + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_RecordActivityTaskHeartbeatRequest( + o: temporal.api.workflowservice.v1.IRecordActivityTaskHeartbeatRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RecordActivityTaskHeartbeatRequest', context) + : context; { - const m = o.memo; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_ResetWorkflowExecutionRequest( + o: temporal.api.workflowservice.v1.IResetWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ResetWorkflowExecutionRequest', context) + : context; { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const a = o.postResetOperations; + if (a) for (const v of a) walk_temporal_api_workflow_v1_PostResetOperation(v, env, ctx, pending); } +} + +function walk_temporal_api_workflowservice_v1_RespondActivityTaskCanceledByIdRequest( + o: temporal.api.workflowservice.v1.IRespondActivityTaskCanceledByIdRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskCanceledByIdRequest', context) + : context; { - if (!env.skipSearchAttributes) { - const c = o.searchAttributes; - if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); - } + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_FailWorkflowExecution( - o: coresdk.workflow_commands.IFailWorkflowExecution, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskCanceledRequest( + o: temporal.api.workflowservice.v1.IRespondActivityTaskCanceledRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.FailWorkflowExecution', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskCanceledRequest', context) : context; { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.details; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_ModifyWorkflowProperties( - o: coresdk.workflow_commands.IModifyWorkflowProperties, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskCompletedByIdRequest( + o: temporal.api.workflowservice.v1.IRespondActivityTaskCompletedByIdRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.ModifyWorkflowProperties', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskCompletedByIdRequest', context) : context; { - const c = o.upsertedMemo; - if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_QueryResult( - o: coresdk.workflow_commands.IQueryResult, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskCompletedRequest( + o: temporal.api.workflowservice.v1.IRespondActivityTaskCompletedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.QueryResult', context) : context; - { - const c = o.succeeded; - if (c != null) walk_coresdk_workflow_commands_QuerySuccess(c, env, ctx, pending); - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskCompletedRequest', context) + : context; { - const c = o.failed; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.result; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_QuerySuccess( - o: coresdk.workflow_commands.IQuerySuccess, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedByIdRequest( + o: temporal.api.workflowservice.v1.IRespondActivityTaskFailedByIdRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.QuerySuccess', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskFailedByIdRequest', context) + : context; { - const p = o.response; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.response = r; - }) - ); + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.lastHeartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_ScheduleActivity( - o: coresdk.workflow_commands.IScheduleActivity, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedByIdResponse( + o: temporal.api.workflowservice.v1.IRespondActivityTaskFailedByIdResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.ScheduleActivity', context) : context; - { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskFailedByIdResponse', context) + : context; { - const a = o.arguments; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.arguments = r; - }) - ); + const a = o.failures; + if (a) for (const v of a) walk_temporal_api_failure_v1_Failure(v, env, ctx, pending); } } -function walk_coresdk_workflow_commands_ScheduleLocalActivity( - o: coresdk.workflow_commands.IScheduleLocalActivity, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedRequest( + o: temporal.api.workflowservice.v1.IRespondActivityTaskFailedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.ScheduleLocalActivity', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskFailedRequest', context) : context; { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); } { - const a = o.arguments; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.arguments = r; - }) - ); + const c = o.lastHeartbeatDetails; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_ScheduleNexusOperation( - o: coresdk.workflow_commands.IScheduleNexusOperation, +function walk_temporal_api_workflowservice_v1_RespondActivityTaskFailedResponse( + o: temporal.api.workflowservice.v1.IRespondActivityTaskFailedResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.ScheduleNexusOperation', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondActivityTaskFailedResponse', context) : context; { - const p = o.input; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.input = r; - }) - ); + const a = o.failures; + if (a) for (const v of a) walk_temporal_api_failure_v1_Failure(v, env, ctx, pending); } } -function walk_coresdk_workflow_commands_SignalExternalWorkflowExecution( - o: coresdk.workflow_commands.ISignalExternalWorkflowExecution, +function walk_temporal_api_workflowservice_v1_RespondNexusTaskCompletedRequest( + o: temporal.api.workflowservice.v1.IRespondNexusTaskCompletedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.SignalExternalWorkflowExecution', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondNexusTaskCompletedRequest', context) : context; { - const a = o.args; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.args = r; - }) - ); - } - { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } + const c = o.response; + if (c != null) walk_temporal_api_nexus_v1_Response(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_StartChildWorkflowExecution( - o: coresdk.workflow_commands.IStartChildWorkflowExecution, +function walk_temporal_api_workflowservice_v1_RespondNexusTaskFailedRequest( + o: temporal.api.workflowservice.v1.IRespondNexusTaskFailedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.StartChildWorkflowExecution', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondNexusTaskFailedRequest', context) : context; { - const a = o.input; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.input = r; - }) - ); - } - { - if (!env.skipHeaders) { - const m = o.headers; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } - } - { - const m = o.memo; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); - } - { - if (!env.skipSearchAttributes) { - const c = o.searchAttributes; - if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); - } + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_UpdateResponse( - o: coresdk.workflow_commands.IUpdateResponse, +function walk_temporal_api_workflowservice_v1_RespondQueryTaskCompletedRequest( + o: temporal.api.workflowservice.v1.IRespondQueryTaskCompletedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.UpdateResponse', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondQueryTaskCompletedRequest', context) + : context; { - const c = o.rejected; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.queryResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } { - const p = o.completed; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.completed = r; - }) - ); + const c = o.failure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); } } -function walk_coresdk_workflow_commands_UpsertWorkflowSearchAttributes( - o: coresdk.workflow_commands.IUpsertWorkflowSearchAttributes, +function walk_temporal_api_workflowservice_v1_RespondWorkflowTaskCompletedRequest( + o: temporal.api.workflowservice.v1.IRespondWorkflowTaskCompletedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_commands.UpsertWorkflowSearchAttributes', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest', context) : context; { - if (!env.skipSearchAttributes) { - const c = o.searchAttributes; - if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); - } + const a = o.commands; + if (a) for (const v of a) walk_temporal_api_command_v1_Command(v, env, ctx, pending); + } + { + const m = o.queryResults; + if (m) for (const v of Object.values(m)) walk_temporal_api_query_v1_WorkflowQueryResult(v, env, ctx, pending); } } -function walk_coresdk_workflow_commands_WorkflowCommand( - o: coresdk.workflow_commands.IWorkflowCommand, +function walk_temporal_api_workflowservice_v1_RespondWorkflowTaskCompletedResponse( + o: temporal.api.workflowservice.v1.IRespondWorkflowTaskCompletedResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_commands.WorkflowCommand', context) : context; - { - const c = o.userMetadata; - if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); - } - { - const c = o.scheduleActivity; - if (c != null) walk_coresdk_workflow_commands_ScheduleActivity(c, env, ctx, pending); - } - { - const c = o.respondToQuery; - if (c != null) walk_coresdk_workflow_commands_QueryResult(c, env, ctx, pending); - } - { - const c = o.completeWorkflowExecution; - if (c != null) walk_coresdk_workflow_commands_CompleteWorkflowExecution(c, env, ctx, pending); - } - { - const c = o.failWorkflowExecution; - if (c != null) walk_coresdk_workflow_commands_FailWorkflowExecution(c, env, ctx, pending); - } - { - const c = o.continueAsNewWorkflowExecution; - if (c != null) walk_coresdk_workflow_commands_ContinueAsNewWorkflowExecution(c, env, ctx, pending); - } - { - const c = o.startChildWorkflowExecution; - if (c != null) walk_coresdk_workflow_commands_StartChildWorkflowExecution(c, env, ctx, pending); - } - { - const c = o.signalExternalWorkflowExecution; - if (c != null) walk_coresdk_workflow_commands_SignalExternalWorkflowExecution(c, env, ctx, pending); - } - { - const c = o.scheduleLocalActivity; - if (c != null) walk_coresdk_workflow_commands_ScheduleLocalActivity(c, env, ctx, pending); - } - { - const c = o.upsertWorkflowSearchAttributes; - if (c != null) walk_coresdk_workflow_commands_UpsertWorkflowSearchAttributes(c, env, ctx, pending); - } - { - const c = o.modifyWorkflowProperties; - if (c != null) walk_coresdk_workflow_commands_ModifyWorkflowProperties(c, env, ctx, pending); - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedResponse', context) + : context; { - const c = o.updateResponse; - if (c != null) walk_coresdk_workflow_commands_UpdateResponse(c, env, ctx, pending); + const c = o.workflowTask; + if (c != null) walk_temporal_api_workflowservice_v1_PollWorkflowTaskQueueResponse(c, env, ctx, pending); } { - const c = o.scheduleNexusOperation; - if (c != null) walk_coresdk_workflow_commands_ScheduleNexusOperation(c, env, ctx, pending); + const a = o.activityTasks; + if (a) for (const v of a) walk_temporal_api_workflowservice_v1_PollActivityTaskQueueResponse(v, env, ctx, pending); } } -function walk_coresdk_workflow_completion_Failure( - o: coresdk.workflow_completion.IFailure, +function walk_temporal_api_workflowservice_v1_RespondWorkflowTaskFailedRequest( + o: temporal.api.workflowservice.v1.IRespondWorkflowTaskFailedRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_completion.Failure', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.RespondWorkflowTaskFailedRequest', context) + : context; { const c = o.failure; if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); } } -function walk_coresdk_workflow_completion_Success( - o: coresdk.workflow_completion.ISuccess, +function walk_temporal_api_workflowservice_v1_ScanWorkflowExecutionsResponse( + o: temporal.api.workflowservice.v1.IScanWorkflowExecutionsResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'coresdk.workflow_completion.Success', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.ScanWorkflowExecutionsResponse', context) + : context; { - const a = o.commands; - if (a) for (const v of a) walk_coresdk_workflow_commands_WorkflowCommand(v, env, ctx, pending); + const a = o.executions; + if (a) for (const v of a) walk_temporal_api_workflow_v1_WorkflowExecutionInfo(v, env, ctx, pending); } } -function walk_coresdk_workflow_completion_WorkflowActivationCompletion( - o: coresdk.workflow_completion.IWorkflowActivationCompletion, +function walk_temporal_api_workflowservice_v1_SetCurrentDeploymentRequest( + o: temporal.api.workflowservice.v1.ISetCurrentDeploymentRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'coresdk.workflow_completion.WorkflowActivationCompletion', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.SetCurrentDeploymentRequest', context) : context; { - const c = o.successful; - if (c != null) walk_coresdk_workflow_completion_Success(c, env, ctx, pending); - } - { - const c = o.failed; - if (c != null) walk_coresdk_workflow_completion_Failure(c, env, ctx, pending); + const c = o.updateMetadata; + if (c != null) walk_temporal_api_deployment_v1_UpdateDeploymentMetadata(c, env, ctx, pending); } } -function walk_temporal_api_common_v1_Memo( - o: temporal.api.common.v1.IMemo, +function walk_temporal_api_workflowservice_v1_SetCurrentDeploymentResponse( + o: temporal.api.workflowservice.v1.ISetCurrentDeploymentResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.Memo', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.SetCurrentDeploymentResponse', context) + : context; { - const m = o.fields; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); + const c = o.currentDeploymentInfo; + if (c != null) walk_temporal_api_deployment_v1_DeploymentInfo(c, env, ctx, pending); + } + { + const c = o.previousDeploymentInfo; + if (c != null) walk_temporal_api_deployment_v1_DeploymentInfo(c, env, ctx, pending); } } -function walk_temporal_api_common_v1_Payloads( - o: temporal.api.common.v1.IPayloads, +function walk_temporal_api_workflowservice_v1_SignalWithStartWorkflowExecutionRequest( + o: temporal.api.workflowservice.v1.ISignalWithStartWorkflowExecutionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.Payloads', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.SignalWithStartWorkflowExecutionRequest', context) + : context; { - const a = o.payloads; - if (a && a.length) - pending.push( - env.transformPayloads(a, ctx).then((r) => { - o.payloads = r; - }) - ); + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.signalInput; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); } } -function walk_temporal_api_common_v1_SearchAttributes( - o: temporal.api.common.v1.ISearchAttributes, +function walk_temporal_api_workflowservice_v1_SignalWorkflowExecutionRequest( + o: temporal.api.workflowservice.v1.ISignalWorkflowExecutionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.common.v1.SearchAttributes', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest', context) + : context; { - const m = o.indexedFields; - if (m) - for (const [k, v] of Object.entries(m)) - pending.push( - env.transformPayload(v, ctx).then((r) => { - m[k] = r; - }) - ); + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); } } -function walk_temporal_api_failure_v1_ApplicationFailureInfo( - o: temporal.api.failure.v1.IApplicationFailureInfo, +function walk_temporal_api_workflowservice_v1_StartActivityExecutionRequest( + o: temporal.api.workflowservice.v1.IStartActivityExecutionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.failure.v1.ApplicationFailureInfo', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.StartActivityExecutionRequest', context) : context; { - const c = o.details; + const c = o.input; if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } } -function walk_temporal_api_failure_v1_CanceledFailureInfo( - o: temporal.api.failure.v1.ICanceledFailureInfo, +function walk_temporal_api_workflowservice_v1_StartBatchOperationRequest( + o: temporal.api.workflowservice.v1.IStartBatchOperationRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.failure.v1.CanceledFailureInfo', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.StartBatchOperationRequest', context) : context; { - const c = o.details; - if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + const c = o.terminationOperation; + if (c != null) walk_temporal_api_batch_v1_BatchOperationTermination(c, env, ctx, pending); + } + { + const c = o.signalOperation; + if (c != null) walk_temporal_api_batch_v1_BatchOperationSignal(c, env, ctx, pending); + } + { + const c = o.resetOperation; + if (c != null) walk_temporal_api_batch_v1_BatchOperationReset(c, env, ctx, pending); } } -function walk_temporal_api_failure_v1_Failure( - o: temporal.api.failure.v1.IFailure, +function walk_temporal_api_workflowservice_v1_StartNexusOperationExecutionRequest( + o: temporal.api.workflowservice.v1.IStartNexusOperationExecutionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.failure.v1.Failure', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.StartNexusOperationExecutionRequest', context) + : context; { - const p = o.encodedAttributes; + const p = o.input; if (p != null) pending.push( env.transformPayload(p, ctx).then((r) => { - o.encodedAttributes = r; + o.input = r; }) ); } { - const c = o.cause; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } } { - const c = o.applicationFailureInfo; - if (c != null) walk_temporal_api_failure_v1_ApplicationFailureInfo(c, env, ctx, pending); + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); + } +} + +function walk_temporal_api_workflowservice_v1_StartWorkflowExecutionRequest( + o: temporal.api.workflowservice.v1.IStartWorkflowExecutionRequest, + env: WalkEnv, + context: Ctx, + pending: Promise[] +): void { + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.StartWorkflowExecutionRequest', context) + : context; + { + const c = o.input; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } { - const c = o.timeoutFailureInfo; - if (c != null) walk_temporal_api_failure_v1_TimeoutFailureInfo(c, env, ctx, pending); + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); } { - const c = o.canceledFailureInfo; - if (c != null) walk_temporal_api_failure_v1_CanceledFailureInfo(c, env, ctx, pending); + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } } { - const c = o.resetWorkflowFailureInfo; - if (c != null) walk_temporal_api_failure_v1_ResetWorkflowFailureInfo(c, env, ctx, pending); + const c = o.header; + if (c != null) walk_temporal_api_common_v1_Header(c, env, ctx, pending); + } + { + const c = o.continuedFailure; + if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + } + { + const c = o.lastCompletionResult; + if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + } + { + const c = o.userMetadata; + if (c != null) walk_temporal_api_sdk_v1_UserMetadata(c, env, ctx, pending); } } -function walk_temporal_api_failure_v1_ResetWorkflowFailureInfo( - o: temporal.api.failure.v1.IResetWorkflowFailureInfo, +function walk_temporal_api_workflowservice_v1_StartWorkflowExecutionResponse( + o: temporal.api.workflowservice.v1.IStartWorkflowExecutionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.failure.v1.ResetWorkflowFailureInfo', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.StartWorkflowExecutionResponse', context) : context; { - const c = o.lastHeartbeatDetails; - if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); + const c = o.eagerWorkflowTask; + if (c != null) walk_temporal_api_workflowservice_v1_PollWorkflowTaskQueueResponse(c, env, ctx, pending); } } -function walk_temporal_api_failure_v1_TimeoutFailureInfo( - o: temporal.api.failure.v1.ITimeoutFailureInfo, +function walk_temporal_api_workflowservice_v1_TerminateWorkflowExecutionRequest( + o: temporal.api.workflowservice.v1.ITerminateWorkflowExecutionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.failure.v1.TimeoutFailureInfo', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.TerminateWorkflowExecutionRequest', context) + : context; { - const c = o.lastHeartbeatDetails; + const c = o.details; if (c != null) walk_temporal_api_common_v1_Payloads(c, env, ctx, pending); } } -function walk_temporal_api_nexus_v1_Request( - o: temporal.api.nexus.v1.IRequest, +function walk_temporal_api_workflowservice_v1_UpdateScheduleRequest( + o: temporal.api.workflowservice.v1.IUpdateScheduleRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.nexus.v1.Request', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.UpdateScheduleRequest', context) + : context; { - const c = o.startOperation; - if (c != null) walk_temporal_api_nexus_v1_StartOperationRequest(c, env, ctx, pending); + const c = o.schedule; + if (c != null) walk_temporal_api_schedule_v1_Schedule(c, env, ctx, pending); + } + { + if (!env.skipSearchAttributes) { + const c = o.searchAttributes; + if (c != null) walk_temporal_api_common_v1_SearchAttributes(c, env, ctx, pending); + } + } + { + const c = o.memo; + if (c != null) walk_temporal_api_common_v1_Memo(c, env, ctx, pending); } } -function walk_temporal_api_nexus_v1_Response( - o: temporal.api.nexus.v1.IResponse, +function walk_temporal_api_workflowservice_v1_UpdateWorkerDeploymentVersionComputeConfigRequest( + o: temporal.api.workflowservice.v1.IUpdateWorkerDeploymentVersionComputeConfigRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.nexus.v1.Response', context) : context; + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionComputeConfigRequest', context) + : context; { - const c = o.startOperation; - if (c != null) walk_temporal_api_nexus_v1_StartOperationResponse(c, env, ctx, pending); + const m = o.computeConfigScalingGroups; + if (m) + for (const v of Object.values(m)) + walk_temporal_api_compute_v1_ComputeConfigScalingGroupUpdate(v, env, ctx, pending); } } -function walk_temporal_api_nexus_v1_StartOperationRequest( - o: temporal.api.nexus.v1.IStartOperationRequest, +function walk_temporal_api_workflowservice_v1_UpdateWorkerDeploymentVersionMetadataRequest( + o: temporal.api.workflowservice.v1.IUpdateWorkerDeploymentVersionMetadataRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.nexus.v1.StartOperationRequest', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataRequest', context) : context; { - const p = o.payload; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.payload = r; - }) - ); + const m = o.upsertEntries; + if (m) + for (const [k, v] of Object.entries(m)) + pending.push( + env.transformPayload(v, ctx).then((r) => { + m[k] = r; + }) + ); } } -function walk_temporal_api_nexus_v1_StartOperationResponse( - o: temporal.api.nexus.v1.IStartOperationResponse, +function walk_temporal_api_workflowservice_v1_UpdateWorkerDeploymentVersionMetadataResponse( + o: temporal.api.workflowservice.v1.IUpdateWorkerDeploymentVersionMetadataResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.nexus.v1.StartOperationResponse', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataResponse', context) : context; { - const c = o.syncSuccess; - if (c != null) walk_temporal_api_nexus_v1_StartOperationResponse_Sync(c, env, ctx, pending); - } - { - const c = o.failure; - if (c != null) walk_temporal_api_failure_v1_Failure(c, env, ctx, pending); + const c = o.metadata; + if (c != null) walk_temporal_api_deployment_v1_VersionMetadata(c, env, ctx, pending); } } -function walk_temporal_api_nexus_v1_StartOperationResponse_Sync( - o: temporal.api.nexus.v1.StartOperationResponse.ISync, +function walk_temporal_api_workflowservice_v1_UpdateWorkflowExecutionRequest( + o: temporal.api.workflowservice.v1.IUpdateWorkflowExecutionRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.nexus.v1.StartOperationResponse.Sync', context) + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.UpdateWorkflowExecutionRequest', context) : context; { - const p = o.payload; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.payload = r; - }) - ); + const c = o.request; + if (c != null) walk_temporal_api_update_v1_Request(c, env, ctx, pending); } } -function walk_temporal_api_sdk_v1_UserMetadata( - o: temporal.api.sdk.v1.IUserMetadata, +function walk_temporal_api_workflowservice_v1_UpdateWorkflowExecutionResponse( + o: temporal.api.workflowservice.v1.IUpdateWorkflowExecutionResponse, env: WalkEnv, context: Ctx, pending: Promise[] ): void { - const ctx = env.deriveContext ? env.deriveContext(o, 'temporal.api.sdk.v1.UserMetadata', context) : context; - { - const p = o.summary; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.summary = r; - }) - ); - } + const ctx = env.deriveContext + ? env.deriveContext(o, 'temporal.api.workflowservice.v1.UpdateWorkflowExecutionResponse', context) + : context; { - const p = o.details; - if (p != null) - pending.push( - env.transformPayload(p, ctx).then((r) => { - o.details = r; - }) - ); + const c = o.outcome; + if (c != null) walk_temporal_api_update_v1_Outcome(c, env, ctx, pending); } } -function walk_temporal_api_workflowservice_v1_PollNexusTaskQueueResponse( - o: temporal.api.workflowservice.v1.IPollNexusTaskQueueResponse, +function walk_temporal_api_workflowservice_v1_ValidateWorkerDeploymentVersionComputeConfigRequest( + o: temporal.api.workflowservice.v1.IValidateWorkerDeploymentVersionComputeConfigRequest, env: WalkEnv, context: Ctx, pending: Promise[] ): void { const ctx = env.deriveContext - ? env.deriveContext(o, 'temporal.api.workflowservice.v1.PollNexusTaskQueueResponse', context) + ? env.deriveContext( + o, + 'temporal.api.workflowservice.v1.ValidateWorkerDeploymentVersionComputeConfigRequest', + context + ) : context; { - const c = o.request; - if (c != null) walk_temporal_api_nexus_v1_Request(c, env, ctx, pending); + const m = o.computeConfigScalingGroups; + if (m) + for (const v of Object.values(m)) + walk_temporal_api_compute_v1_ComputeConfigScalingGroupUpdate(v, env, ctx, pending); } } diff --git a/packages/test/src/test-extstore-visit.ts b/packages/test/src/test-extstore-visit.ts index 6f3b6b3bac..eaa536f553 100644 --- a/packages/test/src/test-extstore-visit.ts +++ b/packages/test/src/test-extstore-visit.ts @@ -7,16 +7,19 @@ import { extstoreRetrieveOptions, extstoreStoreOptions, isReferencePayload, - visitActivityTask, - visitActivityTaskCompletion, - visitNexusTask, - visitNexusTaskCompletion, - visitWorkflowActivation, - visitWorkflowActivationCompletion, + visit, + walkActivityTask, + walkActivityTaskCompletion, + walkNexusTask, + walkNexusTaskCompletion, + walkQueryWorkflowResponse, + walkStartWorkflowExecutionRequest, + walkWorkflowActivation, + walkWorkflowActivationCompletion, } from '@temporalio/common/lib/internal-non-workflow'; import { encode } from '@temporalio/common/lib/encoding'; import { METADATA_ENCODING_KEY } from '@temporalio/common/lib/converter/types'; -import type { coresdk } from '@temporalio/proto'; +import type { coresdk, temporal } from '@temporalio/proto'; import { makeFakeDriver } from './extstore-fake-driver'; /** Build a Payload whose proto-encoded size is at least `bodyBytes`, filled with `fill`. */ @@ -45,8 +48,9 @@ test('workflow store offloads a large payload and threads the target to the driv successful: { commands: [{ completeWorkflowExecution: { result: makePayload(256) } }] }, }; - await visitWorkflowActivationCompletion( + await visit( completion, + walkWorkflowActivationCompletion, extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) ); @@ -63,8 +67,9 @@ test('workflow store offloads only above-threshold payloads at a repeated site', successful: { commands: [{ scheduleActivity: { arguments: [makePayload(256), small] } }] }, }; - await visitWorkflowActivationCompletion( + await visit( completion, + walkWorkflowActivationCompletion, extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) ); @@ -85,8 +90,9 @@ test('workflow store applies a per-command derived target', async (t) => { }, }; - await visitWorkflowActivationCompletion( + await visit( completion, + walkWorkflowActivationCompletion, extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET, // Stand-in for the worker's command→target mapping: the child command retargets its payloads. @@ -107,8 +113,9 @@ test('workflow store then retrieve round-trips the original payload bytes', asyn successful: { commands: [{ completeWorkflowExecution: { result: original } }] }, }; - await visitWorkflowActivationCompletion( + await visit( completion, + walkWorkflowActivationCompletion, extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) ); const reference = completion.successful!.commands![0]!.completeWorkflowExecution!.result!; @@ -117,7 +124,7 @@ test('workflow store then retrieve round-trips the original payload bytes', asyn const activation: coresdk.workflow_activation.IWorkflowActivation = { jobs: [{ resolveActivity: { result: { completed: { result: reference } } } }], }; - await visitWorkflowActivation(activation, extstoreRetrieveOptions(externalStorage)); + await visit(activation, walkWorkflowActivation, extstoreRetrieveOptions(externalStorage)); const retrieved = activation.jobs![0]!.resolveActivity!.result!.completed!.result!; t.false(isReferencePayload(retrieved)); @@ -131,7 +138,7 @@ test('activity task completion store offloads the result payload', async (t) => result: { completed: { result: makePayload(256) } }, }; - await visitActivityTaskCompletion(completion, extstoreStoreOptions(externalStorage)); + await visit(completion, walkActivityTaskCompletion, extstoreStoreOptions(externalStorage)); t.true(isReferencePayload(completion.result!.completed!.result!)); t.is(driver.storeCalls.length, 1); @@ -144,7 +151,7 @@ test('activity task retrieve resolves the activity input', async (t) => { start: { input: [await toReference(externalStorage, input)] }, }; - await visitActivityTask(task, extstoreRetrieveOptions(externalStorage)); + await visit(task, walkActivityTask, extstoreRetrieveOptions(externalStorage)); t.deepEqual(task.start!.input![0], input); }); @@ -155,7 +162,7 @@ test('nexus task completion store offloads the sync result payload', async (t) = completed: { startOperation: { syncSuccess: { payload: makePayload(256) } } }, }; - await visitNexusTaskCompletion(completion, extstoreStoreOptions(externalStorage)); + await visit(completion, walkNexusTaskCompletion, extstoreStoreOptions(externalStorage)); t.true(isReferencePayload(completion.completed!.startOperation!.syncSuccess!.payload!)); }); @@ -167,7 +174,35 @@ test('nexus task retrieve resolves the request payload', async (t) => { task: { request: { startOperation: { payload: await toReference(externalStorage, requestPayload) } } }, }; - await visitNexusTask(task, extstoreRetrieveOptions(externalStorage)); + await visit(task, walkNexusTask, extstoreRetrieveOptions(externalStorage)); t.deepEqual(task.task!.request!.startOperation!.payload, requestPayload); }); + +test('client request store offloads the workflow input (via generic visit)', async (t) => { + const { externalStorage } = externalStorageWith(); + const request: temporal.api.workflowservice.v1.IStartWorkflowExecutionRequest = { + workflowId: 'wf-1', + input: { payloads: [makePayload(256)] }, + }; + + await visit( + request, + walkStartWorkflowExecutionRequest, + extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) + ); + + t.true(isReferencePayload(request.input!.payloads![0]!)); +}); + +test('client response retrieve resolves the query result (via generic visit)', async (t) => { + const { externalStorage } = externalStorageWith(); + const queryResult = makePayload(256, 9); + const response: temporal.api.workflowservice.v1.IQueryWorkflowResponse = { + queryResult: { payloads: [await toReference(externalStorage, queryResult)] }, + }; + + await visit(response, walkQueryWorkflowResponse, extstoreRetrieveOptions(externalStorage)); + + t.deepEqual(response.queryResult!.payloads![0], queryResult); +}); diff --git a/packages/worker/src/worker.ts b/packages/worker/src/worker.ts index 86a4809f8d..dc9df1d27f 100644 --- a/packages/worker/src/worker.ts +++ b/packages/worker/src/worker.ts @@ -33,12 +33,13 @@ import { encodeToPayload, extstoreRetrieveOptions, extstoreStoreOptions, - visitActivityTask, - visitActivityTaskCompletion, - visitNexusTask, - visitNexusTaskCompletion, - visitWorkflowActivation, - visitWorkflowActivationCompletion, + visit, + walkActivityTask, + walkActivityTaskCompletion, + walkNexusTask, + walkNexusTaskCompletion, + walkWorkflowActivation, + walkWorkflowActivationCompletion, } from '@temporalio/common/lib/internal-non-workflow'; import type { StorageDriverTargetInfo } from '@temporalio/common/lib/converter/extstore'; import { historyFromJSON } from '@temporalio/common/lib/proto-utils'; @@ -1250,7 +1251,7 @@ export class Worker { mergeMap(async (rest) => { const { externalStorage } = this.options.loadedDataConverter; if (externalStorage) { - await visitActivityTaskCompletion(rest, extstoreStoreOptions(externalStorage)); + await visit(rest, walkActivityTaskCompletion, extstoreStoreOptions(externalStorage)); } return coresdk.ActivityTaskCompletion.encodeDelimited(rest).finish(); }), @@ -1312,7 +1313,7 @@ export class Worker { mergeMap(async (result) => { const { externalStorage } = this.options.loadedDataConverter; if (externalStorage) { - await visitNexusTaskCompletion(result, extstoreStoreOptions(externalStorage)); + await visit(result, walkNexusTaskCompletion, extstoreStoreOptions(externalStorage)); } return coresdk.nexus.NexusTaskCompletion.encodeDelimited(result).finish(); }) @@ -1464,7 +1465,7 @@ export class Worker { } const { externalStorage } = this.options.loadedDataConverter; if (externalStorage) { - await visitWorkflowActivation(activation, extstoreRetrieveOptions(externalStorage)); + await visit(activation, walkWorkflowActivation, extstoreRetrieveOptions(externalStorage)); } const decodedActivation = await workflowCodecRunner.decodeActivation(activation); @@ -1484,8 +1485,9 @@ export class Worker { const encodedCompletion = await workflowCodecRunner.encodeCompletion(unencodedCompletion); if (externalStorage) { const namespace = workflowCodecRunner.workflowContext.namespace; - await visitWorkflowActivationCompletion( + await visit( encodedCompletion, + walkWorkflowActivationCompletion, extstoreStoreOptions(externalStorage, { initialTarget: { kind: 'workflow', @@ -1919,7 +1921,7 @@ export class Worker { const task = coresdk.activity_task.ActivityTask.decode(new Uint8Array(buffer)); const { externalStorage } = this.options.loadedDataConverter; if (externalStorage) { - await visitActivityTask(task, extstoreRetrieveOptions(externalStorage)); + await visit(task, walkActivityTask, extstoreRetrieveOptions(externalStorage)); } const { taskToken, ...rest } = task; const base64TaskToken = formatTaskToken(taskToken); @@ -1972,7 +1974,7 @@ export class Worker { const task = coresdk.nexus.NexusTask.decode(new Uint8Array(buffer)); const { externalStorage } = this.options.loadedDataConverter; if (externalStorage) { - await visitNexusTask(task, extstoreRetrieveOptions(externalStorage)); + await visit(task, walkNexusTask, extstoreRetrieveOptions(externalStorage)); } const taskToken = task.task?.taskToken || task.cancelTask?.taskToken; if (taskToken == null) { @@ -2328,9 +2330,7 @@ function workflowCommandStoreTarget( switch (typeName) { case 'coresdk.workflow_commands.StartChildWorkflowExecution': { const command = message as coresdk.workflow_commands.IStartChildWorkflowExecution; - return command.workflowId - ? { kind: 'workflow', namespace: command.namespace || namespace, id: command.workflowId } - : context; + return { kind: 'workflow', namespace: command.namespace || namespace, id: command.workflowId ?? undefined }; } case 'coresdk.workflow_commands.SignalExternalWorkflowExecution': case 'coresdk.workflow_commands.RequestCancelExternalWorkflowExecution': { @@ -2338,10 +2338,10 @@ function workflowCommandStoreTarget( childWorkflowId?: string | null; }; const workflowId = command.workflowExecution?.workflowId ?? command.childWorkflowId ?? undefined; - return workflowId - ? { kind: 'workflow', namespace: command.workflowExecution?.namespace || namespace, id: workflowId } - : context; + return { kind: 'workflow', namespace: command.workflowExecution?.namespace || namespace, id: workflowId }; } + case 'coresdk.workflow_commands.ContinueAsNewWorkflowExecution': + return context ? { ...context, runId: undefined } : context; default: return context; } From f612d6724d3a929429e5148d5408079f1e4a158f Mon Sep 17 00:00:00 2001 From: Chris Constable Date: Fri, 17 Jul 2026 17:41:22 -0400 Subject: [PATCH 5/6] add extstore to heartbeat payloads. skip search attributes. --- .../external-storage-visitor.ts | 5 ++- packages/test/src/test-extstore-visit.ts | 38 +++++++++++++++++++ packages/worker/src/worker.ts | 11 ++++-- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/packages/common/src/internal-non-workflow/external-storage-visitor.ts b/packages/common/src/internal-non-workflow/external-storage-visitor.ts index 1ae2ad235b..b97374fd33 100644 --- a/packages/common/src/internal-non-workflow/external-storage-visitor.ts +++ b/packages/common/src/internal-non-workflow/external-storage-visitor.ts @@ -1,5 +1,5 @@ /** - * Visits payloads for External Storage and applies payload transformations via ║ + * Visits payloads for External Storage and applies payload transformations via * {@link ExternalStorageRunner}. * * @module @@ -43,6 +43,8 @@ export function extstoreStoreOptions( runner.store([payload], { target, abortSignal: signal }).then((stored) => stored[0]!), deriveContext, initialContext: initialTarget, + // Search attributes must keep their literal values so the server can index/search on them. + skipSearchAttributes: true, limit, abortSignal, }; @@ -61,6 +63,7 @@ export function extstoreRetrieveOptions( transformPayloads: (payloads, _context, signal) => runner.retrieve(payloads, { abortSignal: signal }), transformPayload: (payload, _context, signal) => runner.retrieve([payload], { abortSignal: signal }).then((retrieved) => retrieved[0]!), + skipSearchAttributes: true, limit, abortSignal, }; diff --git a/packages/test/src/test-extstore-visit.ts b/packages/test/src/test-extstore-visit.ts index eaa536f553..1eb1670e47 100644 --- a/packages/test/src/test-extstore-visit.ts +++ b/packages/test/src/test-extstore-visit.ts @@ -8,6 +8,7 @@ import { extstoreStoreOptions, isReferencePayload, visit, + walkActivityHeartbeat, walkActivityTask, walkActivityTaskCompletion, walkNexusTask, @@ -106,6 +107,34 @@ test('workflow store applies a per-command derived target', async (t) => { t.true(targets.includes('child-1'), 'child input stored against the child workflow'); }); +test('workflow store leaves search attributes inline while offloading siblings', async (t) => { + const { externalStorage } = externalStorageWith(); + const searchAttr = makePayload(256, 8); + const completion: coresdk.workflow_completion.IWorkflowActivationCompletion = { + successful: { + commands: [ + { + startChildWorkflowExecution: { + workflowId: 'child-1', + input: [makePayload(256, 1)], + searchAttributes: { indexedFields: { CustomKey: searchAttr } }, + }, + }, + ], + }, + }; + + await visit( + completion, + walkWorkflowActivationCompletion, + extstoreStoreOptions(externalStorage, { initialTarget: WORKFLOW_TARGET }) + ); + + const command = completion.successful!.commands![0]!.startChildWorkflowExecution!; + t.true(isReferencePayload(command.input![0]!), 'input is offloaded'); + t.deepEqual(command.searchAttributes!.indexedFields!.CustomKey, searchAttr, 'search attribute left untouched'); +}); + test('workflow store then retrieve round-trips the original payload bytes', async (t) => { const { externalStorage } = externalStorageWith(); const original = makePayload(256, 7); @@ -144,6 +173,15 @@ test('activity task completion store offloads the result payload', async (t) => t.is(driver.storeCalls.length, 1); }); +test('activity heartbeat store offloads the details payload', async (t) => { + const { externalStorage } = externalStorageWith(); + const heartbeat: coresdk.IActivityHeartbeat = { taskToken: new Uint8Array([1]), details: [makePayload(256)] }; + + await visit(heartbeat, walkActivityHeartbeat, extstoreStoreOptions(externalStorage)); + + t.true(isReferencePayload(heartbeat.details![0]!)); +}); + test('activity task retrieve resolves the activity input', async (t) => { const { externalStorage } = externalStorageWith(); const input = makePayload(256, 3); diff --git a/packages/worker/src/worker.ts b/packages/worker/src/worker.ts index dc9df1d27f..ca50e9d720 100644 --- a/packages/worker/src/worker.ts +++ b/packages/worker/src/worker.ts @@ -34,6 +34,7 @@ import { extstoreRetrieveOptions, extstoreStoreOptions, visit, + walkActivityHeartbeat, walkActivityTask, walkActivityTaskCompletion, walkNexusTask, @@ -1827,10 +1828,12 @@ export class Worker { onError(); return; } - const arr = coresdk.ActivityHeartbeat.encodeDelimited({ - taskToken, - details: [payload], - }).finish(); + const heartbeat: coresdk.IActivityHeartbeat = { taskToken, details: [payload] }; + const { externalStorage } = this.options.loadedDataConverter; + if (externalStorage) { + await visit(heartbeat, walkActivityHeartbeat, extstoreStoreOptions(externalStorage)); + } + const arr = coresdk.ActivityHeartbeat.encodeDelimited(heartbeat).finish(); this.nativeWorker.recordActivityHeartbeat(byteArrayToBuffer(arr)); } finally { this.activityHeartbeatSubject.next({ From 5b49f0192af844008d91bdbc095c9900f7f209ce Mon Sep 17 00:00:00 2001 From: Chris Constable Date: Mon, 20 Jul 2026 13:38:42 -0400 Subject: [PATCH 6/6] test: retry async metrics assertions to de-flake metrics-scrape tests --- packages/test-helpers/src/index.ts | 2 +- packages/test-helpers/src/utilities.ts | 34 +++++++++++ packages/test/src/helpers.ts | 1 + packages/test/src/test-metrics-custom.ts | 18 +++--- packages/test/src/test-runtime-otel.ts | 4 +- packages/test/src/test-runtime-prometheus.ts | 60 ++++++++++--------- .../test/src/test-worker-poller-autoscale.ts | 46 +++++++------- 7 files changed, 105 insertions(+), 60 deletions(-) diff --git a/packages/test-helpers/src/index.ts b/packages/test-helpers/src/index.ts index 91ab5f5b65..e6a9310f71 100644 --- a/packages/test-helpers/src/index.ts +++ b/packages/test-helpers/src/index.ts @@ -1,5 +1,5 @@ // Utilities -export { sleep, waitUntil, u8, approximatelyEqual } from './utilities'; +export { sleep, waitUntil, assertEventually, u8, approximatelyEqual } from './utilities'; // Flags export { diff --git a/packages/test-helpers/src/utilities.ts b/packages/test-helpers/src/utilities.ts index 09a3961942..928784882b 100644 --- a/packages/test-helpers/src/utilities.ts +++ b/packages/test-helpers/src/utilities.ts @@ -1,3 +1,5 @@ +import type { ExecutionContext } from 'ava'; + /** * Sleep for a given number of milliseconds */ @@ -5,6 +7,38 @@ export async function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } +/** + * Repeatedly run an assertion callback until it passes, or until a timeout elapses. + * + * Each attempt runs inside ava's `t.try()`, so failing intermediate attempts (including ones that + * throw, e.g. reading a metric line that isn't present yet) are discarded and do not fail the test. + * The final attempt is committed, so a genuine failure is reported with its normal assertion + * diagnostics and logs. + * + * Use this for state that only becomes true asynchronously (e.g. metrics that Core exports to its + * Prometheus endpoint on a delay). The check is written once, as the assertion, instead of being + * duplicated as both a `waitUntil` predicate and a separate assertion. + */ +export async function assertEventually( + t: ExecutionContext, + assertion: (t: ExecutionContext) => void | Promise, + timeoutMs = 10000, + intervalMs = 100 +): Promise { + const endTime = Date.now() + timeoutMs; + for (;;) { + const attempt = await t.try(async (tt) => { + await assertion(tt); + }); + if (attempt.passed || Date.now() >= endTime) { + attempt.commit(); + return; + } + attempt.discard(); + await sleep(intervalMs); + } +} + /** * Wait until a condition is met or timeout */ diff --git a/packages/test/src/helpers.ts b/packages/test/src/helpers.ts index 5ed6b93c23..d18462d12d 100644 --- a/packages/test/src/helpers.ts +++ b/packages/test/src/helpers.ts @@ -18,6 +18,7 @@ import { export { sleep, waitUntil, + assertEventually, u8, approximatelyEqual, RUN_INTEGRATION_TESTS, diff --git a/packages/test/src/test-metrics-custom.ts b/packages/test/src/test-metrics-custom.ts index e628a5cc75..5d4f94aa3d 100644 --- a/packages/test/src/test-metrics-custom.ts +++ b/packages/test/src/test-metrics-custom.ts @@ -6,7 +6,7 @@ import type { MetricTags } from '@temporalio/common'; import { Context as ActivityContext, metricMeter as activityMetricMeter } from '@temporalio/activity'; import type { Context as BaseContext } from './helpers-integration'; import { helpers, makeTestFunction } from './helpers-integration'; -import { getRandomPort } from './helpers'; +import { getRandomPort, assertEventually } from './helpers'; interface Context extends BaseContext { port: number; @@ -38,12 +38,16 @@ const test = makeTestFunction({ }); async function assertMetricReported(t: ExecutionContext, regexp: RegExp) { - const resp = await fetch(`http://127.0.0.1:${t.context.port}/metrics`); - const text = await resp.text(); - const matched = t.regex(text, regexp); - if (!matched) { - t.log(text); - } + // Metrics recorded by Core (in particular from workflows and activities) are pushed to the + // Prometheus exporter asynchronously, so the expected value may not be visible in the scrape + // immediately. Retry until it appears, otherwise these tests flake on slower runners. + await assertEventually(t, async (tt) => { + const text = await (await fetch(`http://127.0.0.1:${tt.context.port}/metrics`)).text(); + const matched = tt.regex(text, regexp); + if (!matched) { + tt.log(text); + } + }); } /** diff --git a/packages/test/src/test-runtime-otel.ts b/packages/test/src/test-runtime-otel.ts index c724a02f95..f217da0ae9 100644 --- a/packages/test/src/test-runtime-otel.ts +++ b/packages/test/src/test-runtime-otel.ts @@ -139,7 +139,7 @@ test.serial('Exporting OTEL metrics from Core works', async (t) => { }); const req = await Promise.race([ capturedRequest, - await new Promise((resolve) => setTimeout(() => resolve(undefined), 2000)), + new Promise((resolve) => setTimeout(() => resolve(undefined), 10000)), ]); t.truthy(req); t.is(req?.url, '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export'); @@ -192,7 +192,7 @@ test.serial('Exporting OTEL metrics using OTLP/HTTP from Core works', async (t) }); const req = await Promise.race([ capturedRequest, - await new Promise((resolve) => setTimeout(() => resolve(undefined), 2000)), + new Promise((resolve) => setTimeout(() => resolve(undefined), 10000)), ]); t.truthy(req); t.is(req?.url, '/v1/metrics'); diff --git a/packages/test/src/test-runtime-prometheus.ts b/packages/test/src/test-runtime-prometheus.ts index 711a37ca80..79d0ba30fd 100644 --- a/packages/test/src/test-runtime-prometheus.ts +++ b/packages/test/src/test-runtime-prometheus.ts @@ -2,7 +2,7 @@ import { randomUUID } from 'crypto'; import test from 'ava'; import { WorkflowClient } from '@temporalio/client'; import { Runtime } from '@temporalio/worker'; -import { Worker, getRandomPort, TestWorkflowEnvironment } from './helpers'; +import { Worker, getRandomPort, TestWorkflowEnvironment, assertEventually } from './helpers'; import * as workflows from './workflows'; test.serial('Runtime.install() throws meaningful error when passed invalid metrics.prometheus.bindAddress', (t) => { @@ -54,10 +54,12 @@ test.serial('Exporting Prometheus metrics from Core works', async (t) => { taskQueue: 'test-prometheus', workflowId: randomUUID(), }); - const resp = await fetch(`http://127.0.0.1:${port}/metrics`); - // We're not concerned about exact details here, just that the metrics are present - const text = await resp.text(); - t.assert(text.includes('myprefix_worker_task_slots_available')); + // Metrics are pushed to the Prometheus exporter asynchronously, so retry until present. + await assertEventually(t, async (tt) => { + const text = await (await fetch(`http://127.0.0.1:${port}/metrics`)).text(); + // We're not concerned about exact details here, just that the metrics are present + tt.assert(text.includes('myprefix_worker_task_slots_available'), `Actual: \n-------\n${text}\n-------`); + }); }); } finally { await localEnv.teardown(); @@ -99,31 +101,35 @@ test.serial('Exporting Prometheus metrics from Core works with lots of options', workflowId: randomUUID(), }); - const resp = await fetch(`http://127.0.0.1:${port}/metrics`); - const text = await resp.text(); + // The metrics below are recorded by the worker's Core runtime and pushed to the Prometheus + // exporter asynchronously, so they may not be visible in the scrape immediately after the + // workflow completes. Retry until they appear, otherwise this test flakes on slower runners. + await assertEventually(t, async (tt) => { + const text = await (await fetch(`http://127.0.0.1:${port}/metrics`)).text(); - // Verify use seconds & unit suffix - t.assert( - text.includes( - 'temporal_workflow_task_execution_latency_seconds_bucket{namespace="default",' + - 'service_name="temporal-core-sdk",task_queue="test-prometheus",' + - 'workflow_type="successString",my_tag="my_value",le="31415"}' - ), - `Actual: \n-------\n${text}\n-------` - ); + // Verify use seconds & unit suffix + tt.assert( + text.includes( + 'temporal_workflow_task_execution_latency_seconds_bucket{namespace="default",' + + 'service_name="temporal-core-sdk",task_queue="test-prometheus",' + + 'workflow_type="successString",my_tag="my_value",le="31415"}' + ), + `Actual: \n-------\n${text}\n-------` + ); - // Verify histogram overrides - t.assert( - text.match(/temporal_request_latency_seconds_bucket\{.*,le="31415"/), - `Actual: \n-------\n${text}\n-------` - ); - t.assert( - text.match(/workflow_task_execution_latency_seconds_bucket\{.*,le="31415"/), - `Actual: \n-------\n${text}\n-------` - ); + // Verify histogram overrides + tt.assert( + text.match(/temporal_request_latency_seconds_bucket\{.*,le="31415"/), + `Actual: \n-------\n${text}\n-------` + ); + tt.assert( + text.match(/workflow_task_execution_latency_seconds_bucket\{.*,le="31415"/), + `Actual: \n-------\n${text}\n-------` + ); - // Verify prefix exists on client request metrics - t.assert(text.includes('temporal_long_request{'), `Actual: \n-------\n${text}\n-------`); + // Verify prefix exists on client request metrics + tt.assert(text.includes('temporal_long_request{'), `Actual: \n-------\n${text}\n-------`); + }); }); } finally { await localEnv.teardown(); diff --git a/packages/test/src/test-worker-poller-autoscale.ts b/packages/test/src/test-worker-poller-autoscale.ts index ad2b5e3331..3ddac1eeac 100644 --- a/packages/test/src/test-worker-poller-autoscale.ts +++ b/packages/test/src/test-worker-poller-autoscale.ts @@ -1,7 +1,7 @@ import { randomUUID } from 'crypto'; import test from 'ava'; import { Runtime, Worker } from '@temporalio/worker'; -import { getRandomPort, TestWorkflowEnvironment } from './helpers'; +import { getRandomPort, TestWorkflowEnvironment, assertEventually } from './helpers'; import * as activities from './activities'; import * as workflows from './workflows'; @@ -36,30 +36,30 @@ test.serial('Can run autoscaling polling worker', async (t) => { }); const workerPromise = worker.run(); - // Give pollers a beat to start - await new Promise((resolve) => setTimeout(resolve, 300)); + // Pollers start asynchronously and their counts are exported to the Prometheus endpoint on a + // delay, so retry the assertions until they hold rather than sleeping for a fixed duration and + // hoping the pollers have stabilized. + await assertEventually(t, async (tt) => { + const metricsText = await (await fetch(`http://127.0.0.1:${port}/metrics`)).text(); + const matches = metricsText.split('\n').filter((l) => l.includes('temporal_num_pollers')); + const activity_pollers = matches.filter((l) => l.includes('activity_task')); + const workflow_pollers = matches.filter((l) => l.includes('workflow_task') && l.includes(taskQueue)); - const resp = await fetch(`http://127.0.0.1:${port}/metrics`); - const metricsText = await resp.text(); - const metricsLines = metricsText.split('\n'); + tt.is(activity_pollers.length, 1, 'Should have exactly one activity poller metric'); + tt.true(activity_pollers[0].endsWith('2'), 'Activity poller count should be 2'); + tt.is(workflow_pollers.length, 2, 'Should have exactly two workflow poller metrics (sticky and non-sticky)'); - const matches = metricsLines.filter((l) => l.includes('temporal_num_pollers')); - const activity_pollers = matches.filter((l) => l.includes('activity_task')); - t.is(activity_pollers.length, 1, 'Should have exactly one activity poller metric'); - t.true(activity_pollers[0].endsWith('2'), 'Activity poller count should be 2'); - const workflow_pollers = matches.filter((l) => l.includes('workflow_task') && l.includes(taskQueue)); - t.is(workflow_pollers.length, 2, 'Should have exactly two workflow poller metrics (sticky and non-sticky)'); - - // There's sticky & non-sticky pollers, and they may have a count of 1 or 2 depending on - // initialization timing. - t.true( - workflow_pollers[0].endsWith('2') || workflow_pollers[0].endsWith('1'), - 'First workflow poller count should be 1 or 2' - ); - t.true( - workflow_pollers[1].endsWith('2') || workflow_pollers[1].endsWith('1'), - 'Second workflow poller count should be 1 or 2' - ); + // There's sticky & non-sticky pollers, and they may have a count of 1 or 2 depending on + // initialization timing. + tt.true( + workflow_pollers[0].endsWith('2') || workflow_pollers[0].endsWith('1'), + 'First workflow poller count should be 1 or 2' + ); + tt.true( + workflow_pollers[1].endsWith('2') || workflow_pollers[1].endsWith('1'), + 'Second workflow poller count should be 1 or 2' + ); + }); const workflowPromises = Array(20) .fill(0)