abxbus 2.5.15 → 2.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/BaseEvent.ts CHANGED
@@ -530,15 +530,7 @@ function eventResultTypeToJSON(schema: z.ZodTypeAny | undefined): JsonSchema | u
530
530
  if (!schema) {
531
531
  return undefined
532
532
  }
533
- try {
534
- return toJsonSchema(schema)
535
- } catch {
536
- try {
537
- return toJsonSchema(schema, { io: 'input' })
538
- } catch {
539
- return undefined
540
- }
541
- }
533
+ return toJsonSchema(schema)
542
534
  }
543
535
 
544
536
  export class BaseEvent {
package/src/jsonschema.ts CHANGED
@@ -138,7 +138,14 @@ const normalizeJsonSchemaValue = (schema: unknown): unknown => {
138
138
  }
139
139
 
140
140
  export const toJsonSchema = (schema: z.core.$ZodType, params?: z.core.ToJSONSchemaParams): JsonSchema => {
141
- return normalizeJsonSchema(z.toJSONSchema(schema, params) as JsonSchema)
141
+ try {
142
+ return normalizeJsonSchema(z.toJSONSchema(schema, params) as JsonSchema)
143
+ } catch (error) {
144
+ if (params?.io === 'input') {
145
+ throw error
146
+ }
147
+ return normalizeJsonSchema(z.toJSONSchema(schema, { ...params, io: 'input' }) as JsonSchema)
148
+ }
142
149
  }
143
150
 
144
151
  export const fromJsonSchema = (schema: JsonSchema): z.ZodTypeAny => {