File tree Expand file tree Collapse file tree 4 files changed +48
-9
lines changed
Expand file tree Collapse file tree 4 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -1584,16 +1584,28 @@ class BaseService extends RequestBuilder {
15841584 } ;
15851585 }
15861586 async create ( model , params ) {
1587- if ( params ) { }
1587+ if ( params ) {
1588+ }
15881589 const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
15891590 const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
1590- return await this . client . makePostRequest ( this . endpoint , payload ) ;
1591+ let resp = await this . client . makePostRequest ( this . endpoint , payload ) ;
1592+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
1593+ return {
1594+ ...resp ,
1595+ data : hydratedData
1596+ } ;
15911597 }
15921598 async update ( id , model , params ) {
1593- if ( params ) { }
1599+ if ( params ) {
1600+ }
15941601 const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
15951602 const payload = jsonApiSerializer . buildUpdatePayload ( model ) ;
1596- return await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
1603+ let resp = await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
1604+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
1605+ return {
1606+ ...resp ,
1607+ data : hydratedData
1608+ } ;
15971609 }
15981610 async stats ( options ) {
15991611 const statsEndpoint = `${ this . endpoint } /stats` ;
@@ -2286,6 +2298,9 @@ class ClientConfig {
22862298}
22872299// src/models/Organisation.ts
22882300class Organisation extends BaseModel {
2301+ constructor ( ) {
2302+ super ( ...arguments ) ;
2303+ }
22892304 type = "organisations" ;
22902305 static relationships = [ ] ;
22912306}
Original file line number Diff line number Diff line change @@ -31,14 +31,24 @@ export class BaseService extends RequestBuilder {
3131 }
3232 const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
3333 const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
34- return await this . client . makePostRequest ( this . endpoint , payload ) ;
34+ let resp = await this . client . makePostRequest ( this . endpoint , payload ) ;
35+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
36+ return {
37+ ...resp ,
38+ data : hydratedData ,
39+ } ;
3540 }
3641 async update ( id , model , params ) {
3742 if ( params ) {
3843 }
3944 const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
4045 const payload = jsonApiSerializer . buildUpdatePayload ( model ) ;
41- return await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
46+ let resp = await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
47+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
48+ return {
49+ ...resp ,
50+ data : hydratedData ,
51+ } ;
4252 }
4353 async stats ( options ) {
4454 const statsEndpoint = `${ this . endpoint } /stats` ;
Original file line number Diff line number Diff line change 44 "type" : " git" ,
55 "url" : " https://github.com/ctrl-hub/sdk.ts"
66 },
7- "version" : " 0.1.142 " ,
7+ "version" : " 0.1.143 " ,
88 "main" : " dist/index.js" ,
99 "types" : " dist/index.d.ts" ,
1010 "type" : " module" ,
Original file line number Diff line number Diff line change @@ -46,15 +46,29 @@ export class BaseService<T extends Model> extends RequestBuilder {
4646 }
4747 const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
4848 const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
49- return await this . client . makePostRequest ( this . endpoint , payload ) ;
49+ let resp = await this . client . makePostRequest ( this . endpoint , payload ) ;
50+
51+ const hydratedData = this . hydrator . hydrateResponse < T > ( resp . data as JsonData | JsonData [ ] , resp . included || [ ] ) ;
52+
53+ return {
54+ ...resp ,
55+ data : hydratedData ,
56+ } as InternalResponse < T > ;
5057 }
5158
5259 async update ( id : string , model : Model , params ?: unknown ) : Promise < InternalResponse < T > > {
5360 if ( params ) {
5461 }
5562 const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
5663 const payload = jsonApiSerializer . buildUpdatePayload ( model ) ;
57- return await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
64+ let resp = await this . client . makePatchRequest ( `${ this . endpoint } /${ id } ` , payload ) ;
65+
66+ const hydratedData = this . hydrator . hydrateResponse < T > ( resp . data as JsonData | JsonData [ ] , resp . included || [ ] ) ;
67+
68+ return {
69+ ...resp ,
70+ data : hydratedData ,
71+ } as InternalResponse < T > ;
5872 }
5973
6074 async stats < R = any > ( options ?: RequestOptionsType ) : Promise < InternalResponse < R > > {
You can’t perform that action at this time.
0 commit comments