1
1
import { dasherize , singularize } from '@ember-data/request-utils/string' ;
2
2
import type Store from '@ember-data/store' ;
3
3
import { DEBUG } from '@warp-drive/build-config/env' ;
4
- import type { LegacyRelationshipSchema } from '@warp-drive/core-types/schema/fields' ;
4
+ import type { LegacyRelationshipField } from '@warp-drive/core-types/schema/fields' ;
5
5
6
6
import type { Model } from './model' ;
7
7
8
- function typeForRelationshipMeta ( meta : LegacyRelationshipSchema ) : string {
8
+ function typeForRelationshipMeta ( meta : LegacyRelationshipField ) : string {
9
9
let modelName = dasherize ( meta . type || meta . name ) ;
10
10
11
11
if ( meta . kind === 'hasMany' ) {
@@ -15,7 +15,7 @@ function typeForRelationshipMeta(meta: LegacyRelationshipSchema): string {
15
15
return modelName ;
16
16
}
17
17
18
- function shouldFindInverse ( relationshipMeta : LegacyRelationshipSchema ) : boolean {
18
+ function shouldFindInverse ( relationshipMeta : LegacyRelationshipField ) : boolean {
19
19
const options = relationshipMeta . options ;
20
20
return ! ( options && options . inverse === null ) ;
21
21
}
@@ -26,9 +26,9 @@ class RelationshipDefinition {
26
26
declare __hasCalculatedInverse : boolean ;
27
27
declare parentModelName : string ;
28
28
declare inverseIsAsync : string | null ;
29
- declare meta : LegacyRelationshipSchema ;
29
+ declare meta : LegacyRelationshipField ;
30
30
31
- constructor ( meta : LegacyRelationshipSchema , parentModelName : string ) {
31
+ constructor ( meta : LegacyRelationshipField , parentModelName : string ) {
32
32
this . _type = '' ;
33
33
this . __inverseKey = '' ;
34
34
this . __hasCalculatedInverse = false ;
@@ -63,7 +63,7 @@ class RelationshipDefinition {
63
63
_calculateInverse ( store : Store , modelClass : typeof Model ) : void {
64
64
this . __hasCalculatedInverse = true ;
65
65
let inverseKey : string | null = null ;
66
- let inverse : LegacyRelationshipSchema | null = null ;
66
+ let inverse : LegacyRelationshipField | null = null ;
67
67
68
68
if ( shouldFindInverse ( this . meta ) ) {
69
69
inverse = modelClass . inverseFor ( this . name , store ) ;
@@ -85,9 +85,6 @@ class RelationshipDefinition {
85
85
}
86
86
export type { RelationshipDefinition } ;
87
87
88
- export function relationshipFromMeta (
89
- meta : LegacyRelationshipSchema ,
90
- parentModelName : string
91
- ) : LegacyRelationshipSchema {
92
- return new RelationshipDefinition ( meta , parentModelName ) as unknown as LegacyRelationshipSchema ;
88
+ export function relationshipFromMeta ( meta : LegacyRelationshipField , parentModelName : string ) : LegacyRelationshipField {
89
+ return new RelationshipDefinition ( meta , parentModelName ) as unknown as LegacyRelationshipField ;
93
90
}
0 commit comments