Skip to content

Commit 1e6d018

Browse files
committed
fix: use StandardSchemaV1 instead of z.ZodMiniType in client
runAction and runActionAndWait now use StandardSchemaV1 as the type constraint instead of zod-specific types.
1 parent f96a504 commit 1e6d018

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎packages/duron/src/client.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@opentelemetry/sdk-trace-base'
88
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'
99
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'
10+
import type { StandardSchemaV1 } from '@standard-schema/spec'
1011
import pino, { type Logger } from 'pino'
1112
import * as z from 'zod/mini'
1213

@@ -37,7 +38,9 @@ import { validateSchema } from './standard-schema.js'
3738
* Extracts the inferred type from an action's input/output schema.
3839
* Handles the case where the schema might be undefined.
3940
*/
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>
4144

4245
/**
4346
* Result returned from waitForJob with untyped input and output.
@@ -492,8 +495,8 @@ export class Client<
492495
*/
493496
async runAction<TActionName extends keyof TActions>(
494497
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']>>
497500
: never,
498501
): Promise<string> {
499502
await this.start()
@@ -567,8 +570,8 @@ export class Client<
567570
*/
568571
async runActionAndWait<TActionName extends keyof TActions>(
569572
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']>>
572575
: never,
573576
options?: {
574577
/**

0 commit comments

Comments
 (0)