|
7 | 7 | } from '@opentelemetry/sdk-trace-base' |
8 | 8 | import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' |
9 | 9 | import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions' |
| 10 | +import type { StandardSchemaV1 } from '@standard-schema/spec' |
10 | 11 | import pino, { type Logger } from 'pino' |
11 | 12 | import * as z from 'zod/mini' |
12 | 13 |
|
@@ -37,7 +38,9 @@ import { validateSchema } from './standard-schema.js' |
37 | 38 | * Extracts the inferred type from an action's input/output schema. |
38 | 39 | * Handles the case where the schema might be undefined. |
39 | 40 | */ |
40 | | -type InferActionSchema<T> = T extends z.ZodMiniType ? z.infer<T> : Record<string, unknown> |
| 41 | +type InferActionSchema<T> = T extends StandardSchemaV1 |
| 42 | + ? StandardSchemaV1.InferOutput<T> |
| 43 | + : Record<string, unknown> |
41 | 44 |
|
42 | 45 | /** |
43 | 46 | * Result returned from waitForJob with untyped input and output. |
@@ -492,8 +495,8 @@ export class Client< |
492 | 495 | */ |
493 | 496 | async runAction<TActionName extends keyof TActions>( |
494 | 497 | actionName: TActionName, |
495 | | - input?: NonNullable<TActions[TActionName]['input']> extends z.ZodMiniType |
496 | | - ? z.input<NonNullable<TActions[TActionName]['input']>> |
| 498 | + input?: NonNullable<TActions[TActionName]['input']> extends StandardSchemaV1 |
| 499 | + ? StandardSchemaV1.InferInput<NonNullable<TActions[TActionName]['input']>> |
497 | 500 | : never, |
498 | 501 | ): Promise<string> { |
499 | 502 | await this.start() |
@@ -567,8 +570,8 @@ export class Client< |
567 | 570 | */ |
568 | 571 | async runActionAndWait<TActionName extends keyof TActions>( |
569 | 572 | actionName: TActionName, |
570 | | - input?: NonNullable<TActions[TActionName]['input']> extends z.ZodMiniType |
571 | | - ? z.input<NonNullable<TActions[TActionName]['input']>> |
| 573 | + input?: NonNullable<TActions[TActionName]['input']> extends StandardSchemaV1 |
| 574 | + ? StandardSchemaV1.InferInput<NonNullable<TActions[TActionName]['input']>> |
572 | 575 | : never, |
573 | 576 | options?: { |
574 | 577 | /** |
|
0 commit comments