0.1.2 #3
@@ -1,8 +1,7 @@
|
||||
import { trait } from "@thilawyn/traitify-ts"
|
||||
import { Effect } from "effect"
|
||||
import { JsonifiableObject } from "type-fest/source/jsonifiable"
|
||||
import { z } from "zod"
|
||||
import { JsonifiableZodSchemaClass, JsonifiableZodSchemas } from "../shapes/JsonifiableZodSchemaClass"
|
||||
import { JsonifiableZodSchemas } from "../shapes/JsonifiableZodSchemaClass"
|
||||
import { parseZodTypeEffect } from "../util"
|
||||
|
||||
|
||||
@@ -37,5 +36,65 @@ export const JsonifiableZodSchemaObject = trait
|
||||
) {
|
||||
return this.jsonifySchema.parse(this, params)
|
||||
}
|
||||
|
||||
async jsonifyPromise<
|
||||
JsonifySchemaT extends z.ZodRawShape,
|
||||
JsonifySchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
JsonifySchemaCatchall extends z.ZodTypeAny,
|
||||
|
||||
DejsonifySchemaT extends z.ZodRawShape,
|
||||
DejsonifySchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
DejsonifySchemaCatchall extends z.ZodTypeAny,
|
||||
|
||||
JsonifiedValues extends JsonifiableObject,
|
||||
Values extends object,
|
||||
>(
|
||||
this: Values & JsonifiableZodSchemas<
|
||||
JsonifySchemaT,
|
||||
JsonifySchemaUnknownKeys,
|
||||
JsonifySchemaCatchall,
|
||||
|
||||
DejsonifySchemaT,
|
||||
DejsonifySchemaUnknownKeys,
|
||||
DejsonifySchemaCatchall,
|
||||
|
||||
JsonifiedValues,
|
||||
Values
|
||||
>,
|
||||
|
||||
params?: Partial<z.ParseParams>,
|
||||
) {
|
||||
return this.dejsonifySchema.parseAsync(this, params)
|
||||
}
|
||||
|
||||
jsonifyEffect<
|
||||
JsonifySchemaT extends z.ZodRawShape,
|
||||
JsonifySchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
JsonifySchemaCatchall extends z.ZodTypeAny,
|
||||
|
||||
DejsonifySchemaT extends z.ZodRawShape,
|
||||
DejsonifySchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
DejsonifySchemaCatchall extends z.ZodTypeAny,
|
||||
|
||||
JsonifiedValues extends JsonifiableObject,
|
||||
Values extends object,
|
||||
>(
|
||||
this: Values & JsonifiableZodSchemas<
|
||||
JsonifySchemaT,
|
||||
JsonifySchemaUnknownKeys,
|
||||
JsonifySchemaCatchall,
|
||||
|
||||
DejsonifySchemaT,
|
||||
DejsonifySchemaUnknownKeys,
|
||||
DejsonifySchemaCatchall,
|
||||
|
||||
JsonifiedValues,
|
||||
Values
|
||||
>,
|
||||
|
||||
params?: Partial<z.ParseParams>,
|
||||
) {
|
||||
return parseZodTypeEffect(this.jsonifySchema, this, params)
|
||||
}
|
||||
})
|
||||
.build()
|
||||
|
||||
Reference in New Issue
Block a user