File tree Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -1584,16 +1584,23 @@ class BaseService extends RequestBuilder {
1584
1584
} ;
1585
1585
}
1586
1586
async create ( model , params ) {
1587
- if ( params ) { }
1587
+ if ( params ) {
1588
+ }
1588
1589
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
1589
1590
const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
1590
1591
return await this . client . makePostRequest ( this . endpoint , payload ) ;
1591
1592
}
1592
1593
async update ( id , model , params ) {
1593
- if ( params ) { }
1594
+ if ( params ) {
1595
+ }
1594
1596
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
1595
1597
const payload = jsonApiSerializer . buildUpdatePayload ( model ) ;
1596
- return await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
1598
+ let resp = await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
1599
+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
1600
+ return {
1601
+ ...resp ,
1602
+ data : hydratedData
1603
+ } ;
1597
1604
}
1598
1605
async stats ( options ) {
1599
1606
const statsEndpoint = `${ this . endpoint } /stats` ;
@@ -2286,6 +2293,9 @@ class ClientConfig {
2286
2293
}
2287
2294
// src/models/Organisation.ts
2288
2295
class Organisation extends BaseModel {
2296
+ constructor ( ) {
2297
+ super ( ...arguments ) ;
2298
+ }
2289
2299
type = "organisations" ;
2290
2300
static relationships = [ ] ;
2291
2301
}
Original file line number Diff line number Diff line change @@ -38,7 +38,12 @@ export class BaseService extends RequestBuilder {
38
38
}
39
39
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
40
40
const payload = jsonApiSerializer . buildUpdatePayload ( model ) ;
41
- return await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
41
+ let resp = await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
42
+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
43
+ return {
44
+ ...resp ,
45
+ data : hydratedData ,
46
+ } ;
42
47
}
43
48
async stats ( options ) {
44
49
const statsEndpoint = `${ this . endpoint } /stats` ;
Original file line number Diff line number Diff line change 4
4
"type" : " git" ,
5
5
"url" : " https://github.com/ctrl-hub/sdk.ts"
6
6
},
7
- "version" : " 0.1.142 " ,
7
+ "version" : " 0.1.143 " ,
8
8
"main" : " dist/index.js" ,
9
9
"types" : " dist/index.d.ts" ,
10
10
"type" : " module" ,
Original file line number Diff line number Diff line change @@ -54,7 +54,14 @@ export class BaseService<T extends Model> extends RequestBuilder {
54
54
}
55
55
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
56
56
const payload = jsonApiSerializer . buildUpdatePayload ( model ) ;
57
- return await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
57
+ let resp = await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
58
+
59
+ const hydratedData = this . hydrator . hydrateResponse < T > ( resp . data as JsonData | JsonData [ ] , resp . included || [ ] ) ;
60
+
61
+ return {
62
+ ...resp ,
63
+ data : hydratedData ,
64
+ } as InternalResponse < T > ;
58
65
}
59
66
60
67
async stats < R = any > ( options ?: RequestOptionsType ) : Promise < InternalResponse < R > > {
You can’t perform that action at this time.
0 commit comments