@@ -9,11 +9,11 @@ import ServerException from './ServerException'
9
9
import { ExternalConfig } from './interfaces/Config'
10
10
import { Store } from 'vuex/types'
11
11
import { AxiosInstance , AxiosError } from 'axios'
12
- import Resource , { EmbeddedCollectionType } from './interfaces/Resource'
12
+ import Resource from './interfaces/Resource'
13
13
import StoreData , { Link } from './interfaces/StoreData'
14
14
import ApiActions from './interfaces/ApiActions'
15
- import EmbeddedCollection from './EmbeddedCollection'
16
- import EmbeddedCollectionInterface from './interfaces/EmbeddedCollection'
15
+ import EmbeddedCollectionClass from './EmbeddedCollection'
16
+ import EmbeddedCollection , { EmbeddedCollectionMeta } from './interfaces/EmbeddedCollection'
17
17
18
18
/**
19
19
* Defines the API store methods available in all Vue components. The methods can be called as follows:
@@ -85,10 +85,10 @@ function HalJsonVuex (store: Store<Record<string, State>>, axios: AxiosInstance,
85
85
* @returns Promise Resolves when the GET request has completed and the updated entity is available
86
86
* in the Vuex store.
87
87
*/
88
- async function reload ( uriOrEntity : string | Resource | StoreData | EmbeddedCollectionType ) : Promise < Resource | EmbeddedCollectionInterface > {
89
- if ( isEmbeddedCollectionType ( uriOrEntity ) ) { // = type guard for Embedded Collection
88
+ async function reload ( uriOrEntity : string | Resource | StoreData | EmbeddedCollectionMeta ) : Promise < Resource | EmbeddedCollection > {
89
+ if ( isEmbeddedCollection ( uriOrEntity ) ) { // = type guard for Embedded Collection
90
90
return get ( uriOrEntity . _meta . reload . uri , true ) . _meta . load // load parent resource
91
- . then ( parent => parent [ uriOrEntity . _meta . reload . property ] ( ) as EmbeddedCollectionInterface ) // ... and unwrap reload property after loading has finished
91
+ . then ( parent => parent [ uriOrEntity . _meta . reload . property ] ( ) as EmbeddedCollection ) // ... and unwrap reload property after loading has finished
92
92
} else {
93
93
return get ( uriOrEntity , true ) . _meta . load
94
94
}
@@ -141,18 +141,18 @@ function HalJsonVuex (store: Store<Record<string, State>>, axios: AxiosInstance,
141
141
}
142
142
143
143
/**
144
- * Type guard for EmbeddedCollectionType
144
+ * Type guard for EmbeddedCollectionMeta
145
145
* @param uriOrEntity
146
146
*/
147
- function isEmbeddedCollectionType ( uriOrEntity : string | Resource | EmbeddedCollectionType | StoreData | null ) : uriOrEntity is EmbeddedCollectionType {
147
+ function isEmbeddedCollection ( uriOrEntity : string | Resource | EmbeddedCollectionMeta | StoreData | null ) : uriOrEntity is EmbeddedCollectionMeta {
148
148
if ( uriOrEntity === null ) return false
149
149
150
150
if ( typeof uriOrEntity === 'string' ) return false
151
151
152
152
// found an actual EmbeddedCollection instance
153
- if ( uriOrEntity instanceof EmbeddedCollection ) return true
153
+ if ( uriOrEntity instanceof EmbeddedCollectionClass ) return true
154
154
155
- // found an object that looks like an EmbeddedCollectionType
155
+ // found an object that looks like an EmbeddedCollectionMeta
156
156
return 'reload' in uriOrEntity . _meta
157
157
}
158
158
0 commit comments