@@ -67,7 +67,6 @@ export class Session<
67
67
serverInformation ?: QueryServerInformationResponse ;
68
68
serverVersion ?: string ;
69
69
private ensureSerializableResponse : boolean ;
70
- private decodeDatesAsIso : boolean ;
71
70
private schemasPromise ?: Promise < Schema < TEntityTypeMap > [ ] > ;
72
71
private serverInformationPromise ?: Promise < ServerInformation > ;
73
72
private serverInformationValues ?: string [ ] ;
@@ -89,7 +88,6 @@ export class Session<
89
88
* @param {string } [options.apiEndpoint=/api] - API endpoint.
90
89
* @param {object } [options.headers] - Additional headers to send with the request
91
90
* @param {object } [options.strictApi] - Turn on strict API mode
92
- * @param {object } [options.decodeDatesAsIso] - Decode dates as ISO strings instead of dayjs objects
93
91
* @param {object } [options.ensureSerializableResponse] - Disable normalization of response data
94
92
*
95
93
* @constructs Session
@@ -106,7 +104,6 @@ export class Session<
106
104
apiEndpoint = "/api" ,
107
105
additionalHeaders = { } ,
108
106
strictApi = false ,
109
- decodeDatesAsIso = true ,
110
107
ensureSerializableResponse = false ,
111
108
} : SessionOptions = { } ,
112
109
) {
@@ -205,8 +202,6 @@ export class Session<
205
202
{ action : "query_schemas" } ,
206
203
] ;
207
204
208
- this . decodeDatesAsIso = decodeDatesAsIso ;
209
-
210
205
/**
211
206
* By default the API server will return normalized responses, and we denormalize them in the client.
212
207
* This might cause cyclical references in the response data, making it non-JSON serializable.
@@ -389,31 +384,26 @@ export class Session<
389
384
data : any ,
390
385
identityMap : Data = { } ,
391
386
{
392
- decodeDatesAsIso = true ,
393
387
ensureSerializableResponse = false ,
394
388
} : {
395
- decodeDatesAsIso ?: boolean ;
396
389
ensureSerializableResponse ?: boolean ;
397
390
} = { } ,
398
391
) : any {
399
392
if ( Array . isArray ( data ) ) {
400
393
return this . _decodeArray ( data , identityMap , {
401
- decodeDatesAsIso,
402
394
ensureSerializableResponse,
403
395
} ) ;
404
396
}
405
397
if ( ! ! data && typeof data === "object" ) {
406
398
if ( data . __entity_type__ && ! ensureSerializableResponse ) {
407
399
return this . _mergeEntity ( data , identityMap , {
408
- decodeDatesAsIso,
409
400
ensureSerializableResponse,
410
401
} ) ;
411
402
}
412
- if ( data . __type__ === "datetime" && decodeDatesAsIso ) {
403
+ if ( data . __type__ === "datetime" ) {
413
404
return this . _decodeDateTimeAsIso ( data ) ;
414
405
}
415
406
return this . _decodePlainObject ( data , identityMap , {
416
- decodeDatesAsIso,
417
407
ensureSerializableResponse,
418
408
} ) ;
419
409
}
@@ -452,16 +442,13 @@ export class Session<
452
442
object : Data ,
453
443
identityMap : Data ,
454
444
{
455
- decodeDatesAsIso,
456
445
ensureSerializableResponse,
457
446
} : {
458
- decodeDatesAsIso ?: boolean ;
459
447
ensureSerializableResponse ?: boolean ;
460
448
} = { } ,
461
449
) {
462
450
return Object . keys ( object ) . reduce < Data > ( ( previous , key ) => {
463
451
previous [ key ] = this . decode ( object [ key ] , identityMap , {
464
- decodeDatesAsIso,
465
452
ensureSerializableResponse,
466
453
} ) ;
467
454
return previous ;
@@ -476,16 +463,13 @@ export class Session<
476
463
collection : any [ ] ,
477
464
identityMap : Data ,
478
465
{
479
- decodeDatesAsIso = true ,
480
466
ensureSerializableResponse = false ,
481
467
} : {
482
- decodeDatesAsIso ?: boolean ;
483
468
ensureSerializableResponse ?: boolean ;
484
469
} = { } ,
485
470
) : any [ ] {
486
471
return collection . map ( ( item ) =>
487
472
this . decode ( item , identityMap , {
488
- decodeDatesAsIso,
489
473
ensureSerializableResponse,
490
474
} ) ,
491
475
) ;
@@ -499,10 +483,8 @@ export class Session<
499
483
entity : Data ,
500
484
identityMap : Data ,
501
485
{
502
- decodeDatesAsIso,
503
486
ensureSerializableResponse,
504
487
} : {
505
- decodeDatesAsIso ?: boolean ;
506
488
ensureSerializableResponse ?: boolean ;
507
489
} = { } ,
508
490
) {
@@ -527,7 +509,6 @@ export class Session<
527
509
for ( const key in entity ) {
528
510
if ( Object . hasOwn ( entity , key ) ) {
529
511
mergedEntity [ key ] = this . decode ( entity [ key ] , identityMap , {
530
- decodeDatesAsIso,
531
512
ensureSerializableResponse,
532
513
} ) ;
533
514
}
@@ -610,7 +591,6 @@ export class Session<
610
591
* @param {AbortSignal } options.signal - Abort signal
611
592
* @param {string } options.pushToken - push token to associate with the request
612
593
* @param {object } options.headers - Additional headers to send with the request
613
- * @param {string } options.decodeDatesAsIso - Return dates as ISO strings instead of dayjs objects
614
594
*
615
595
*/
616
596
async call < T = ActionResponse < keyof TEntityTypeMap > > (
@@ -620,7 +600,6 @@ export class Session<
620
600
pushToken,
621
601
signal,
622
602
additionalHeaders = { } ,
623
- decodeDatesAsIso = this . decodeDatesAsIso ,
624
603
ensureSerializableResponse = this . ensureSerializableResponse ,
625
604
} : CallOptions = { } ,
626
605
) : Promise < IsTuple < T > extends true ? T : T [ ] > {
@@ -670,11 +649,7 @@ export class Session<
670
649
throw this . getErrorFromResponse ( response ) ;
671
650
}
672
651
try {
673
- return this . decode (
674
- response ,
675
- { } ,
676
- { decodeDatesAsIso, ensureSerializableResponse } ,
677
- ) ;
652
+ return this . decode ( response , { } , { ensureSerializableResponse } ) ;
678
653
} catch ( reason ) {
679
654
logger . warn ( "Server reported error in unexpected format. " , reason ) ;
680
655
throw this . getErrorFromResponse ( {
@@ -836,7 +811,6 @@ export class Session<
836
811
* @param {object } options.abortController - Deprecated in favour of options.signal
837
812
* @param {object } options.signal - Abort signal user for aborting requests prematurely
838
813
* @param {object } options.headers - Additional headers to send with the request
839
- * @param {object } options.decodeDatesAsIso - Decode dates as ISO strings instead of dayjs objects
840
814
* @param {object } options.ensureSerializableResponse - Disable normalization of response data
841
815
* @return {Promise } Promise which will be resolved with an object
842
816
* containing action, data and metadata
@@ -865,7 +839,6 @@ export class Session<
865
839
* @param {object } options.abortController - Deprecated in favour of options.signal
866
840
* @param {object } options.signal - Abort signal user for aborting requests prematurely
867
841
* @param {object } options.headers - Additional headers to send with the request
868
- * @param {object } options.decodeDatesAsIso - Decode dates as ISO strings instead of dayjs objects
869
842
* @param {object } options.ensureSerializableResponse - Disable normalization of response data
870
843
* @return {Promise } Promise which will be resolved with an object
871
844
* containing data and metadata
@@ -911,7 +884,6 @@ export class Session<
911
884
* @param {Object } options
912
885
* @param {string } options.pushToken - push token to associate with the request
913
886
* @param {object } options.headers - Additional headers to send with the request
914
- * @param {object } options.decodeDatesAsIso - Decode dates as ISO strings instead of dayjs objects
915
887
* @param {object } options.ensureSerializableResponse - Disable normalization of response data
916
888
* @return {Promise } Promise which will be resolved with the response.
917
889
*/
@@ -937,7 +909,6 @@ export class Session<
937
909
* @param {Object } options
938
910
* @param {string } options.pushToken - push token to associate with the request
939
911
* @param {object } options.headers - Additional headers to send with the request
940
- * @param {object } options.decodeDatesAsIso - Decode dates as ISO strings instead of dayjs objects
941
912
* @param {object } options.ensureSerializableResponse - Disable normalization of response data
942
913
* @return {Promise } Promise resolved with the response.
943
914
*/
@@ -963,7 +934,6 @@ export class Session<
963
934
* @param {Object } options
964
935
* @param {string } options.pushToken - push token to associate with the request
965
936
* @param {object } options.headers - Additional headers to send with the request
966
- * @param {object } options.decodeDatesAsIso - Decode dates as ISO strings instead of dayjs objects
967
937
* @return {Promise } Promise resolved with the response.
968
938
*/
969
939
async delete < TEntityType extends keyof TEntityTypeMap > (
0 commit comments