This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
import { trait } from "@thilawyn/thilatrait"
|
|
||||||
import { mapValues } from "lodash-es"
|
|
||||||
import { makeObservable } from "mobx"
|
|
||||||
import { z } from "zod"
|
|
||||||
|
|
||||||
|
|
||||||
export const ObservableSchemable = trait(Parent => {
|
|
||||||
abstract class ObservableSchemable extends Parent {
|
|
||||||
abstract readonly schema: z.ZodObject<
|
|
||||||
z.ZodRawShape,
|
|
||||||
z.UnknownKeysParam,
|
|
||||||
z.ZodTypeAny,
|
|
||||||
z.objectOutputType<z.ZodRawShape, z.ZodTypeAny, z.UnknownKeysParam>,
|
|
||||||
z.objectInputType<z.ZodRawShape, z.ZodTypeAny, z.UnknownKeysParam>
|
|
||||||
>
|
|
||||||
|
|
||||||
// constructor(...args: any[]) {
|
|
||||||
// super(...args)
|
|
||||||
|
|
||||||
// makeObservable(this,
|
|
||||||
// mapValues(this.schema.shape, () => observable) as AnnotationsMap<$Config["values"], never>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
return ObservableSchemable
|
|
||||||
})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./ObservableSchemable"
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { pipeInto } from "ts-functional-pipe"
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { defineDefaultValues, extendSchemableClass, makeSchemableClass, newSchemable } from "."
|
import { defineDefaultValues, extendSchemableClass, makeSchemableClass, newSchemable } from "."
|
||||||
import { dejsonifyBigIntSchema, dejsonifySchemable, jsonifyBigIntSchema, makeJsonifiableSchemableClass } from "./jsonifiable"
|
import { dejsonifyBigIntSchema, dejsonifySchemable, jsonifyBigIntSchema, makeJsonifiableSchemableClass } from "./jsonifiable"
|
||||||
import { extendsAndExpresses } from "@thilawyn/thilatrait"
|
|
||||||
import { ObservableSchemable } from "./observable"
|
|
||||||
|
|
||||||
|
|
||||||
const UserLevel = z.enum(["User", "Admin"])
|
const UserLevel = z.enum(["User", "Admin"])
|
||||||
@@ -31,8 +29,6 @@ class User extends pipeInto(
|
|||||||
id: dejsonifyBigIntSchema(shape.id)
|
id: dejsonifyBigIntSchema(shape.id)
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
v => extendsAndExpresses(v, ObservableSchemable),
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
User.schema
|
User.schema
|
||||||
|
|||||||
Reference in New Issue
Block a user