File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 40
40
"dependencies" : {
41
41
"graphql" : " ^16.0.0" ,
42
42
"inflection" : " ^1.13.0" ,
43
- "jsonld" : " ^8.1.0 " ,
43
+ "jsonld" : " ^8.3.2 " ,
44
44
"jsonref" : " ^8.0.0" ,
45
45
"lodash.get" : " ^4.4.0" ,
46
46
"tslib" : " ^2.0.0"
Original file line number Diff line number Diff line change 1
1
import get from "lodash.get" ;
2
+ import type { EmptyResponseDocument , ResponseDocument } from "./fetchJsonLd.js" ;
2
3
import fetchJsonLd from "./fetchJsonLd.js" ;
3
4
import type { IriTemplateMapping , RequestInitExtended } from "./types.js" ;
4
5
@@ -9,10 +10,16 @@ export default (
9
10
return fetchJsonLd (
10
11
resourceUrl ,
11
12
Object . assign ( { itemsPerPage : 0 } , options )
12
- ) . then ( ( d ) => ( {
13
- parameters : get (
14
- d ,
15
- "body.hydra:search.hydra:mapping"
16
- ) as unknown as IriTemplateMapping [ ] ,
17
- } ) ) ;
13
+ ) . then ( ( d : ResponseDocument | EmptyResponseDocument ) => {
14
+ let hasPrefix = true ;
15
+ if ( ( d as ResponseDocument ) . body ) {
16
+ hasPrefix = "hydra:search" in ( d as ResponseDocument ) . body ;
17
+ }
18
+ return {
19
+ parameters : get (
20
+ d ,
21
+ hasPrefix ? "body.hydra:search.hydra:mapping" : "body.search.mapping"
22
+ ) as unknown as IriTemplateMapping [ ] ,
23
+ } ;
24
+ } ) ;
18
25
} ;
You can’t perform that action at this time.
0 commit comments