@@ -7,8 +7,8 @@ import { type InMemoryEntity } from "../in_memory";
77export type SystemInSet = Required < SystemInSetSchema > ;
88export type InSet = SystemInSet [ "inSet" ] [ 0 ] ;
99
10- function entityInSetPropsMixin < E extends InMemoryEntity > ( item : E ) {
11- const properties = {
10+ function schemaMixin < E extends InMemoryEntity > ( item : E ) {
11+ const schema = {
1212 get inSet ( ) {
1313 return item . prop < InSet [ ] > ( "inSet" , [ ] ) ;
1414 } ,
@@ -18,13 +18,13 @@ function entityInSetPropsMixin<E extends InMemoryEntity>(item: E) {
1818 } ,
1919 } satisfies SystemInSetSchema ;
2020
21- Object . defineProperties ( item , Object . getOwnPropertyDescriptors ( properties ) ) ;
21+ Object . defineProperties ( item , Object . getOwnPropertyDescriptors ( schema ) ) ;
2222
23- return properties ;
23+ return schema ;
2424}
2525
26- function entityInSetMethodsMixin < E extends InMemoryEntity > ( item : E & InMemoryEntityInSetProps ) {
27- const methods = {
26+ function propertiesMixin < E extends InMemoryEntity > ( item : E & InMemoryEntityInSetSchema ) {
27+ const properties = {
2828 getInSetFilteredByCls ( cls : string ) {
2929 return item . inSet . filter ( ( ref ) => ref . cls === cls ) ;
3030 } ,
@@ -36,32 +36,32 @@ function entityInSetMethodsMixin<E extends InMemoryEntity>(item: E & InMemoryEnt
3636 } ,
3737 } ;
3838
39- Object . defineProperties ( item , Object . getOwnPropertyDescriptors ( methods ) ) ;
39+ Object . defineProperties ( item , Object . getOwnPropertyDescriptors ( properties ) ) ;
4040
41- return methods ;
41+ return properties ;
4242}
4343
44- export function entityInSetMixin < E extends InMemoryEntity > ( item : E ) {
45- entityInSetPropsMixin ( item ) ;
46- entityInSetMethodsMixin ( item as E & InMemoryEntityInSetProps ) ;
44+ export function inMemoryEntityInSetMixin < E extends InMemoryEntity > ( item : E ) {
45+ schemaMixin ( item ) ;
46+ propertiesMixin ( item as E & InMemoryEntityInSetSchema ) ;
4747}
4848
49- type InMemoryEntityInSetProps = ReturnType < typeof entityInSetPropsMixin > ;
50- type InMemoryEntityInSetPropsConstructor = Constructor < InMemoryEntityInSetProps > ;
51- type InMemoryEntityInSetMethods = ReturnType < typeof entityInSetMethodsMixin > ;
52- type InMemoryEntityInSetMethodsConstructor = Constructor < InMemoryEntityInSetMethods > ;
49+ type InMemoryEntityInSetSchema = ReturnType < typeof schemaMixin > ;
50+ type InMemoryEntityInSetSchemaConstructor = Constructor < InMemoryEntityInSetSchema > ;
51+ type InMemoryEntityInSetProperties = ReturnType < typeof propertiesMixin > ;
52+ type InMemoryEntityInSetPropertiesConstructor = Constructor < InMemoryEntityInSetProperties > ;
5353
54- export type InMemoryEntityInSet = InMemoryEntityInSetProps & InMemoryEntityInSetMethods ;
55- export type InMemoryEntityInSetConstructor = InMemoryEntityInSetPropsConstructor &
56- InMemoryEntityInSetMethodsConstructor ;
54+ export type InMemoryEntityInSet = InMemoryEntityInSetSchema & InMemoryEntityInSetProperties ;
55+ export type InMemoryEntityInSetConstructor = InMemoryEntityInSetSchemaConstructor &
56+ InMemoryEntityInSetPropertiesConstructor ;
5757
5858type Base = Constructor < InMemoryEntity > ;
5959
6060export default function InMemoryEntityInSetMixin < S extends Base = Base > ( superclass : S ) {
6161 class InMemoryEntityInSetMixin extends superclass {
6262 constructor ( ...args : any [ ] ) {
6363 super ( ...args ) ;
64- entityInSetMixin ( this ) ;
64+ inMemoryEntityInSetMixin ( this ) ;
6565 }
6666 }
6767
0 commit comments