11import * as Data from 'effect/Data' ;
2- import * as Schema from 'effect/Schema' ;
3- import type { AnyNoContext , EntityWithRelation } from './types.js' ;
2+ import type { AnyNoContext } from './types.js' ;
43import * as VariantSchema from './variant-schema.js' ;
54
65const {
@@ -18,32 +17,10 @@ const {
1817 defaultVariant : 'select' ,
1918} ) ;
2019
21- export { Class } ;
22-
23- export const Text = Schema . String ;
24- // biome-ignore lint/suspicious/noShadowRestrictedNames: is part of a namespaces module and therefor ok
25- export const Number = Schema . Number ;
26- export const Checkbox = Schema . Boolean ;
27- // biome-ignore lint/suspicious/noShadowRestrictedNames: is part of a namespaces module and therefor ok
28- export const Date = Schema . Date ;
29- export const Url = Schema . URL ;
30- export const Point = Schema . transform ( Schema . String , Schema . Array ( Number ) , {
31- strict : true ,
32- decode : ( str : string ) => {
33- return str . split ( ',' ) . map ( ( n : string ) => globalThis . Number ( n ) ) ;
34- } ,
35- encode : ( points : readonly number [ ] ) => points . join ( ',' ) ,
36- } ) ;
20+ export { Class , Field } ;
3721
3822export class EntityNotFoundError extends Data . TaggedError ( 'EntityNotFoundError' ) < {
3923 id : string ;
4024 type : AnyNoContext ;
4125 cause ?: unknown ;
4226} > { }
43-
44- export const Relation = < S extends AnyNoContext > ( schema : S ) =>
45- Field ( {
46- select : Schema . Array ( schema ) as unknown as Schema . Schema < ReadonlyArray < EntityWithRelation < S > > > ,
47- insert : Schema . optional ( Schema . Array ( Schema . String ) ) ,
48- update : Schema . Undefined ,
49- } ) ;
0 commit comments