@dynatrace-sdk/client-query 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/cjs/index.js +40 -34
- package/dynatrace-metadata.json +3 -3
- package/esm/index.js +40 -34
- package/package.json +1 -1
- package/types/packages/client/query/src/lib/apis/api-client-options.d.ts +7 -0
- package/types/packages/client/query/src/lib/apis/query-assistance-api.d.ts +4 -1
- package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
@dynatrace-sdk/client-query
|
|
4
4
|
|
|
5
|
+
## 1.19.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- Added support for optional transformations. (APPDEV-11914)
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Added fix for 'transformToFormDataField' function. (APPDEV-12478)
|
|
14
|
+
|
|
5
15
|
## 1.18.1
|
|
6
16
|
|
|
7
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dynatrace-sdk/client-query
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.19.0)
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
5
|
|
|
6
6
|
Exposes an API to fetch records stored in Grail
|
package/cjs/index.js
CHANGED
|
@@ -220,13 +220,16 @@ function transformResponse(object, keys) {
|
|
|
220
220
|
// packages/client/query/src/lib/apis/query-assistance-api.ts
|
|
221
221
|
var QueryAssistanceClient = class {
|
|
222
222
|
httpClient;
|
|
223
|
+
shouldTransformDates = true;
|
|
223
224
|
/**
|
|
224
225
|
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryAssistanceClient. Custom http client should implement {HttpClient} interface.
|
|
226
|
+
* @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
|
|
225
227
|
* @example
|
|
226
228
|
* const queryAssistanceClientNodeJs = new QueryAssistanceClient(yourCustomImplementation);
|
|
227
229
|
*/
|
|
228
|
-
constructor(httpClientImplementation) {
|
|
230
|
+
constructor(httpClientImplementation, options) {
|
|
229
231
|
this.httpClient = httpClientImplementation;
|
|
232
|
+
this.shouldTransformDates = options?.transformDates ?? true;
|
|
230
233
|
}
|
|
231
234
|
/**
|
|
232
235
|
* Verifies a query without executing it.
|
|
@@ -259,7 +262,7 @@ var QueryAssistanceClient = class {
|
|
|
259
262
|
if (!config) {
|
|
260
263
|
throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
261
264
|
}
|
|
262
|
-
const encodedBody = transformRequest(config.body, []);
|
|
265
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
263
266
|
try {
|
|
264
267
|
const response = await this.httpClient.send({
|
|
265
268
|
url: `/platform/storage/query/v1/query:verify`,
|
|
@@ -277,7 +280,7 @@ var QueryAssistanceClient = class {
|
|
|
277
280
|
});
|
|
278
281
|
const responseValue = await response.body("json");
|
|
279
282
|
try {
|
|
280
|
-
return transformResponse(responseValue, []);
|
|
283
|
+
return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
281
284
|
} catch (err) {
|
|
282
285
|
throw new import_shared_errors3.InvalidResponseError(
|
|
283
286
|
`QueryAssistanceClient.query:verify:200`,
|
|
@@ -301,7 +304,7 @@ var QueryAssistanceClient = class {
|
|
|
301
304
|
case 400: {
|
|
302
305
|
const responseValue = await response.body("json");
|
|
303
306
|
try {
|
|
304
|
-
const errorBody = transformResponse(responseValue, []);
|
|
307
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
305
308
|
throw new ErrorEnvelopeError(
|
|
306
309
|
`400`,
|
|
307
310
|
response,
|
|
@@ -326,7 +329,7 @@ var QueryAssistanceClient = class {
|
|
|
326
329
|
case 500: {
|
|
327
330
|
const responseValue = await response.body("json");
|
|
328
331
|
try {
|
|
329
|
-
const errorBody = transformResponse(responseValue, []);
|
|
332
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
330
333
|
throw new ErrorEnvelopeError(
|
|
331
334
|
`500`,
|
|
332
335
|
response,
|
|
@@ -595,7 +598,7 @@ var QueryAssistanceClient = class {
|
|
|
595
598
|
if (!config) {
|
|
596
599
|
throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
597
600
|
}
|
|
598
|
-
const encodedBody = transformRequest(config.body, []);
|
|
601
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
599
602
|
try {
|
|
600
603
|
const response = await this.httpClient.send({
|
|
601
604
|
url: `/platform/storage/query/v1/query:parse`,
|
|
@@ -613,7 +616,7 @@ var QueryAssistanceClient = class {
|
|
|
613
616
|
});
|
|
614
617
|
const responseValue = await response.body("json");
|
|
615
618
|
try {
|
|
616
|
-
return transformResponse(responseValue, []);
|
|
619
|
+
return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
617
620
|
} catch (err) {
|
|
618
621
|
throw new import_shared_errors3.InvalidResponseError(
|
|
619
622
|
`QueryAssistanceClient.query:parse:200`,
|
|
@@ -637,7 +640,7 @@ var QueryAssistanceClient = class {
|
|
|
637
640
|
case 400: {
|
|
638
641
|
const responseValue = await response.body("json");
|
|
639
642
|
try {
|
|
640
|
-
const errorBody = transformResponse(responseValue, []);
|
|
643
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
641
644
|
throw new ErrorEnvelopeError(
|
|
642
645
|
`400`,
|
|
643
646
|
response,
|
|
@@ -665,7 +668,7 @@ var QueryAssistanceClient = class {
|
|
|
665
668
|
case 500: {
|
|
666
669
|
const responseValue = await response.body("json");
|
|
667
670
|
try {
|
|
668
|
-
const errorBody = transformResponse(responseValue, []);
|
|
671
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
669
672
|
throw new ErrorEnvelopeError(
|
|
670
673
|
`500`,
|
|
671
674
|
response,
|
|
@@ -778,7 +781,7 @@ var QueryAssistanceClient = class {
|
|
|
778
781
|
if (!config) {
|
|
779
782
|
throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
780
783
|
}
|
|
781
|
-
const encodedBody = transformRequest(config.body, []);
|
|
784
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
782
785
|
try {
|
|
783
786
|
const response = await this.httpClient.send({
|
|
784
787
|
url: `/platform/storage/query/v1/query:autocomplete`,
|
|
@@ -796,7 +799,7 @@ var QueryAssistanceClient = class {
|
|
|
796
799
|
});
|
|
797
800
|
const responseValue = await response.body("json");
|
|
798
801
|
try {
|
|
799
|
-
return transformResponse(responseValue, []);
|
|
802
|
+
return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
800
803
|
} catch (err) {
|
|
801
804
|
throw new import_shared_errors3.InvalidResponseError(
|
|
802
805
|
`QueryAssistanceClient.query:autocomplete:200`,
|
|
@@ -820,7 +823,7 @@ var QueryAssistanceClient = class {
|
|
|
820
823
|
case 400: {
|
|
821
824
|
const responseValue = await response.body("json");
|
|
822
825
|
try {
|
|
823
|
-
const errorBody = transformResponse(responseValue, []);
|
|
826
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
824
827
|
throw new ErrorEnvelopeError(
|
|
825
828
|
`400`,
|
|
826
829
|
response,
|
|
@@ -848,7 +851,7 @@ var QueryAssistanceClient = class {
|
|
|
848
851
|
case 500: {
|
|
849
852
|
const responseValue = await response.body("json");
|
|
850
853
|
try {
|
|
851
|
-
const errorBody = transformResponse(responseValue, []);
|
|
854
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
852
855
|
throw new ErrorEnvelopeError(
|
|
853
856
|
`500`,
|
|
854
857
|
response,
|
|
@@ -969,13 +972,16 @@ var toQueryString = (rawQuery, flags = {}) => {
|
|
|
969
972
|
// packages/client/query/src/lib/apis/query-execution-api.ts
|
|
970
973
|
var QueryExecutionClient = class {
|
|
971
974
|
httpClient;
|
|
975
|
+
shouldTransformDates = true;
|
|
972
976
|
/**
|
|
973
977
|
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryExecutionClient. Custom http client should implement {HttpClient} interface.
|
|
978
|
+
* @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
|
|
974
979
|
* @example
|
|
975
980
|
* const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
|
|
976
981
|
*/
|
|
977
|
-
constructor(httpClientImplementation) {
|
|
982
|
+
constructor(httpClientImplementation, options) {
|
|
978
983
|
this.httpClient = httpClientImplementation;
|
|
984
|
+
this.shouldTransformDates = options?.transformDates ?? true;
|
|
979
985
|
}
|
|
980
986
|
/**
|
|
981
987
|
* Retrieves query status and final result from Grail.
|
|
@@ -1053,7 +1059,7 @@ var QueryExecutionClient = class {
|
|
|
1053
1059
|
});
|
|
1054
1060
|
const responseValue = await response.body("json");
|
|
1055
1061
|
try {
|
|
1056
|
-
return transformResponse(responseValue, [
|
|
1062
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1057
1063
|
["result.records.*.start", { datetime: true }],
|
|
1058
1064
|
["result.records.*.end", { datetime: true }],
|
|
1059
1065
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1062,7 +1068,7 @@ var QueryExecutionClient = class {
|
|
|
1062
1068
|
["result.records.*.end", { datetime: true }],
|
|
1063
1069
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1064
1070
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1065
|
-
]);
|
|
1071
|
+
]) : responseValue;
|
|
1066
1072
|
} catch (err) {
|
|
1067
1073
|
throw new import_shared_errors4.InvalidResponseError(
|
|
1068
1074
|
`QueryExecutionClient.query:poll:200`,
|
|
@@ -1086,7 +1092,7 @@ var QueryExecutionClient = class {
|
|
|
1086
1092
|
case 400: {
|
|
1087
1093
|
const responseValue = await response.body("json");
|
|
1088
1094
|
try {
|
|
1089
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1095
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1090
1096
|
throw new ErrorEnvelopeError(
|
|
1091
1097
|
`400`,
|
|
1092
1098
|
response,
|
|
@@ -1125,7 +1131,7 @@ var QueryExecutionClient = class {
|
|
|
1125
1131
|
case 500: {
|
|
1126
1132
|
const responseValue = await response.body("json");
|
|
1127
1133
|
try {
|
|
1128
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1134
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1129
1135
|
throw new ErrorEnvelopeError(
|
|
1130
1136
|
`500`,
|
|
1131
1137
|
response,
|
|
@@ -1239,7 +1245,7 @@ var QueryExecutionClient = class {
|
|
|
1239
1245
|
if (!config) {
|
|
1240
1246
|
throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
1241
1247
|
}
|
|
1242
|
-
const encodedBody = transformRequest(config.body, []);
|
|
1248
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
1243
1249
|
const query = toQueryString({ enrich: config.enrich });
|
|
1244
1250
|
try {
|
|
1245
1251
|
const response = await this.httpClient.send({
|
|
@@ -1260,7 +1266,7 @@ var QueryExecutionClient = class {
|
|
|
1260
1266
|
case 200: {
|
|
1261
1267
|
const responseValue = await response.body("json");
|
|
1262
1268
|
try {
|
|
1263
|
-
return transformResponse(responseValue, [
|
|
1269
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1264
1270
|
["result.records.*.start", { datetime: true }],
|
|
1265
1271
|
["result.records.*.end", { datetime: true }],
|
|
1266
1272
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1269,7 +1275,7 @@ var QueryExecutionClient = class {
|
|
|
1269
1275
|
["result.records.*.end", { datetime: true }],
|
|
1270
1276
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1271
1277
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1272
|
-
]);
|
|
1278
|
+
]) : responseValue;
|
|
1273
1279
|
} catch (err) {
|
|
1274
1280
|
throw new import_shared_errors4.InvalidResponseError(
|
|
1275
1281
|
`QueryExecutionClient.query:execute:${response.status}`,
|
|
@@ -1284,7 +1290,7 @@ var QueryExecutionClient = class {
|
|
|
1284
1290
|
case 202: {
|
|
1285
1291
|
const responseValue = await response.body("json");
|
|
1286
1292
|
try {
|
|
1287
|
-
return transformResponse(responseValue, [
|
|
1293
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1288
1294
|
["result.records.*.start", { datetime: true }],
|
|
1289
1295
|
["result.records.*.end", { datetime: true }],
|
|
1290
1296
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1293,7 +1299,7 @@ var QueryExecutionClient = class {
|
|
|
1293
1299
|
["result.records.*.end", { datetime: true }],
|
|
1294
1300
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1295
1301
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1296
|
-
]);
|
|
1302
|
+
]) : responseValue;
|
|
1297
1303
|
} catch (err) {
|
|
1298
1304
|
throw new import_shared_errors4.InvalidResponseError(
|
|
1299
1305
|
`QueryExecutionClient.query:execute:${response.status}`,
|
|
@@ -1346,7 +1352,7 @@ var QueryExecutionClient = class {
|
|
|
1346
1352
|
case 400: {
|
|
1347
1353
|
const responseValue = await response.body("json");
|
|
1348
1354
|
try {
|
|
1349
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1355
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1350
1356
|
throw new ErrorEnvelopeError(
|
|
1351
1357
|
`400`,
|
|
1352
1358
|
response,
|
|
@@ -1374,7 +1380,7 @@ var QueryExecutionClient = class {
|
|
|
1374
1380
|
case 403: {
|
|
1375
1381
|
const responseValue = await response.body("json");
|
|
1376
1382
|
try {
|
|
1377
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1383
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1378
1384
|
throw new InsufficientPermission(
|
|
1379
1385
|
`403`,
|
|
1380
1386
|
response,
|
|
@@ -1399,7 +1405,7 @@ var QueryExecutionClient = class {
|
|
|
1399
1405
|
case 429: {
|
|
1400
1406
|
const responseValue = await response.body("json");
|
|
1401
1407
|
try {
|
|
1402
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1408
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1403
1409
|
throw new ErrorEnvelopeError(
|
|
1404
1410
|
`429`,
|
|
1405
1411
|
response,
|
|
@@ -1424,7 +1430,7 @@ var QueryExecutionClient = class {
|
|
|
1424
1430
|
case 500: {
|
|
1425
1431
|
const responseValue = await response.body("json");
|
|
1426
1432
|
try {
|
|
1427
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1433
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1428
1434
|
throw new ErrorEnvelopeError(
|
|
1429
1435
|
`500`,
|
|
1430
1436
|
response,
|
|
@@ -1449,7 +1455,7 @@ var QueryExecutionClient = class {
|
|
|
1449
1455
|
case 503: {
|
|
1450
1456
|
const responseValue = await response.body("json");
|
|
1451
1457
|
try {
|
|
1452
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1458
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1453
1459
|
throw new ErrorEnvelopeError(
|
|
1454
1460
|
`503`,
|
|
1455
1461
|
response,
|
|
@@ -1475,7 +1481,7 @@ var QueryExecutionClient = class {
|
|
|
1475
1481
|
if (response.status >= 400 && response.status <= 499) {
|
|
1476
1482
|
const responseValue = await response.body("json");
|
|
1477
1483
|
try {
|
|
1478
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1484
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1479
1485
|
throw new ErrorEnvelopeError(
|
|
1480
1486
|
`${response.status}`,
|
|
1481
1487
|
response,
|
|
@@ -1499,7 +1505,7 @@ var QueryExecutionClient = class {
|
|
|
1499
1505
|
} else if (response.status >= 500 && response.status <= 599) {
|
|
1500
1506
|
const responseValue = await response.body("json");
|
|
1501
1507
|
try {
|
|
1502
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1508
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1503
1509
|
throw new ErrorEnvelopeError(
|
|
1504
1510
|
`${response.status}`,
|
|
1505
1511
|
response,
|
|
@@ -1627,7 +1633,7 @@ var QueryExecutionClient = class {
|
|
|
1627
1633
|
case 200: {
|
|
1628
1634
|
const responseValue = await response.body("json");
|
|
1629
1635
|
try {
|
|
1630
|
-
return transformResponse(responseValue, [
|
|
1636
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1631
1637
|
["result.records.*.start", { datetime: true }],
|
|
1632
1638
|
["result.records.*.end", { datetime: true }],
|
|
1633
1639
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1636,7 +1642,7 @@ var QueryExecutionClient = class {
|
|
|
1636
1642
|
["result.records.*.end", { datetime: true }],
|
|
1637
1643
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1638
1644
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1639
|
-
]);
|
|
1645
|
+
]) : responseValue;
|
|
1640
1646
|
} catch (err) {
|
|
1641
1647
|
throw new import_shared_errors4.InvalidResponseError(
|
|
1642
1648
|
`QueryExecutionClient.query:cancel:${response.status}`,
|
|
@@ -1692,7 +1698,7 @@ var QueryExecutionClient = class {
|
|
|
1692
1698
|
case 400: {
|
|
1693
1699
|
const responseValue = await response.body("json");
|
|
1694
1700
|
try {
|
|
1695
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1701
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1696
1702
|
throw new ErrorEnvelopeError(
|
|
1697
1703
|
`400`,
|
|
1698
1704
|
response,
|
|
@@ -1731,7 +1737,7 @@ var QueryExecutionClient = class {
|
|
|
1731
1737
|
case 500: {
|
|
1732
1738
|
const responseValue = await response.body("json");
|
|
1733
1739
|
try {
|
|
1734
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1740
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1735
1741
|
throw new ErrorEnvelopeError(
|
|
1736
1742
|
`500`,
|
|
1737
1743
|
response,
|
package/dynatrace-metadata.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dynagen": {
|
|
3
|
-
"version": "0.
|
|
4
|
-
"generatedAt": "",
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"generatedAt": "2025-03-12T14:13:49.759Z",
|
|
5
5
|
"template": {
|
|
6
6
|
"name": "@dynatrace-sdk/template-typescript-client",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.33.2"
|
|
8
8
|
},
|
|
9
9
|
"featureFlags": {
|
|
10
10
|
"typeguards": true
|
package/esm/index.js
CHANGED
|
@@ -185,13 +185,16 @@ function transformResponse(object, keys) {
|
|
|
185
185
|
// packages/client/query/src/lib/apis/query-assistance-api.ts
|
|
186
186
|
var QueryAssistanceClient = class {
|
|
187
187
|
httpClient;
|
|
188
|
+
shouldTransformDates = true;
|
|
188
189
|
/**
|
|
189
190
|
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryAssistanceClient. Custom http client should implement {HttpClient} interface.
|
|
191
|
+
* @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
|
|
190
192
|
* @example
|
|
191
193
|
* const queryAssistanceClientNodeJs = new QueryAssistanceClient(yourCustomImplementation);
|
|
192
194
|
*/
|
|
193
|
-
constructor(httpClientImplementation) {
|
|
195
|
+
constructor(httpClientImplementation, options) {
|
|
194
196
|
this.httpClient = httpClientImplementation;
|
|
197
|
+
this.shouldTransformDates = options?.transformDates ?? true;
|
|
195
198
|
}
|
|
196
199
|
/**
|
|
197
200
|
* Verifies a query without executing it.
|
|
@@ -224,7 +227,7 @@ var QueryAssistanceClient = class {
|
|
|
224
227
|
if (!config) {
|
|
225
228
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
226
229
|
}
|
|
227
|
-
const encodedBody = transformRequest(config.body, []);
|
|
230
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
228
231
|
try {
|
|
229
232
|
const response = await this.httpClient.send({
|
|
230
233
|
url: `/platform/storage/query/v1/query:verify`,
|
|
@@ -242,7 +245,7 @@ var QueryAssistanceClient = class {
|
|
|
242
245
|
});
|
|
243
246
|
const responseValue = await response.body("json");
|
|
244
247
|
try {
|
|
245
|
-
return transformResponse(responseValue, []);
|
|
248
|
+
return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
246
249
|
} catch (err) {
|
|
247
250
|
throw new InvalidResponseError(
|
|
248
251
|
`QueryAssistanceClient.query:verify:200`,
|
|
@@ -266,7 +269,7 @@ var QueryAssistanceClient = class {
|
|
|
266
269
|
case 400: {
|
|
267
270
|
const responseValue = await response.body("json");
|
|
268
271
|
try {
|
|
269
|
-
const errorBody = transformResponse(responseValue, []);
|
|
272
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
270
273
|
throw new ErrorEnvelopeError(
|
|
271
274
|
`400`,
|
|
272
275
|
response,
|
|
@@ -291,7 +294,7 @@ var QueryAssistanceClient = class {
|
|
|
291
294
|
case 500: {
|
|
292
295
|
const responseValue = await response.body("json");
|
|
293
296
|
try {
|
|
294
|
-
const errorBody = transformResponse(responseValue, []);
|
|
297
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
295
298
|
throw new ErrorEnvelopeError(
|
|
296
299
|
`500`,
|
|
297
300
|
response,
|
|
@@ -560,7 +563,7 @@ var QueryAssistanceClient = class {
|
|
|
560
563
|
if (!config) {
|
|
561
564
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
562
565
|
}
|
|
563
|
-
const encodedBody = transformRequest(config.body, []);
|
|
566
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
564
567
|
try {
|
|
565
568
|
const response = await this.httpClient.send({
|
|
566
569
|
url: `/platform/storage/query/v1/query:parse`,
|
|
@@ -578,7 +581,7 @@ var QueryAssistanceClient = class {
|
|
|
578
581
|
});
|
|
579
582
|
const responseValue = await response.body("json");
|
|
580
583
|
try {
|
|
581
|
-
return transformResponse(responseValue, []);
|
|
584
|
+
return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
582
585
|
} catch (err) {
|
|
583
586
|
throw new InvalidResponseError(
|
|
584
587
|
`QueryAssistanceClient.query:parse:200`,
|
|
@@ -602,7 +605,7 @@ var QueryAssistanceClient = class {
|
|
|
602
605
|
case 400: {
|
|
603
606
|
const responseValue = await response.body("json");
|
|
604
607
|
try {
|
|
605
|
-
const errorBody = transformResponse(responseValue, []);
|
|
608
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
606
609
|
throw new ErrorEnvelopeError(
|
|
607
610
|
`400`,
|
|
608
611
|
response,
|
|
@@ -630,7 +633,7 @@ var QueryAssistanceClient = class {
|
|
|
630
633
|
case 500: {
|
|
631
634
|
const responseValue = await response.body("json");
|
|
632
635
|
try {
|
|
633
|
-
const errorBody = transformResponse(responseValue, []);
|
|
636
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
634
637
|
throw new ErrorEnvelopeError(
|
|
635
638
|
`500`,
|
|
636
639
|
response,
|
|
@@ -743,7 +746,7 @@ var QueryAssistanceClient = class {
|
|
|
743
746
|
if (!config) {
|
|
744
747
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
745
748
|
}
|
|
746
|
-
const encodedBody = transformRequest(config.body, []);
|
|
749
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
747
750
|
try {
|
|
748
751
|
const response = await this.httpClient.send({
|
|
749
752
|
url: `/platform/storage/query/v1/query:autocomplete`,
|
|
@@ -761,7 +764,7 @@ var QueryAssistanceClient = class {
|
|
|
761
764
|
});
|
|
762
765
|
const responseValue = await response.body("json");
|
|
763
766
|
try {
|
|
764
|
-
return transformResponse(responseValue, []);
|
|
767
|
+
return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
765
768
|
} catch (err) {
|
|
766
769
|
throw new InvalidResponseError(
|
|
767
770
|
`QueryAssistanceClient.query:autocomplete:200`,
|
|
@@ -785,7 +788,7 @@ var QueryAssistanceClient = class {
|
|
|
785
788
|
case 400: {
|
|
786
789
|
const responseValue = await response.body("json");
|
|
787
790
|
try {
|
|
788
|
-
const errorBody = transformResponse(responseValue, []);
|
|
791
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
789
792
|
throw new ErrorEnvelopeError(
|
|
790
793
|
`400`,
|
|
791
794
|
response,
|
|
@@ -813,7 +816,7 @@ var QueryAssistanceClient = class {
|
|
|
813
816
|
case 500: {
|
|
814
817
|
const responseValue = await response.body("json");
|
|
815
818
|
try {
|
|
816
|
-
const errorBody = transformResponse(responseValue, []);
|
|
819
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
817
820
|
throw new ErrorEnvelopeError(
|
|
818
821
|
`500`,
|
|
819
822
|
response,
|
|
@@ -944,13 +947,16 @@ var toQueryString = (rawQuery, flags = {}) => {
|
|
|
944
947
|
// packages/client/query/src/lib/apis/query-execution-api.ts
|
|
945
948
|
var QueryExecutionClient = class {
|
|
946
949
|
httpClient;
|
|
950
|
+
shouldTransformDates = true;
|
|
947
951
|
/**
|
|
948
952
|
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryExecutionClient. Custom http client should implement {HttpClient} interface.
|
|
953
|
+
* @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
|
|
949
954
|
* @example
|
|
950
955
|
* const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
|
|
951
956
|
*/
|
|
952
|
-
constructor(httpClientImplementation) {
|
|
957
|
+
constructor(httpClientImplementation, options) {
|
|
953
958
|
this.httpClient = httpClientImplementation;
|
|
959
|
+
this.shouldTransformDates = options?.transformDates ?? true;
|
|
954
960
|
}
|
|
955
961
|
/**
|
|
956
962
|
* Retrieves query status and final result from Grail.
|
|
@@ -1028,7 +1034,7 @@ var QueryExecutionClient = class {
|
|
|
1028
1034
|
});
|
|
1029
1035
|
const responseValue = await response.body("json");
|
|
1030
1036
|
try {
|
|
1031
|
-
return transformResponse(responseValue, [
|
|
1037
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1032
1038
|
["result.records.*.start", { datetime: true }],
|
|
1033
1039
|
["result.records.*.end", { datetime: true }],
|
|
1034
1040
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1037,7 +1043,7 @@ var QueryExecutionClient = class {
|
|
|
1037
1043
|
["result.records.*.end", { datetime: true }],
|
|
1038
1044
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1039
1045
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1040
|
-
]);
|
|
1046
|
+
]) : responseValue;
|
|
1041
1047
|
} catch (err) {
|
|
1042
1048
|
throw new InvalidResponseError2(
|
|
1043
1049
|
`QueryExecutionClient.query:poll:200`,
|
|
@@ -1061,7 +1067,7 @@ var QueryExecutionClient = class {
|
|
|
1061
1067
|
case 400: {
|
|
1062
1068
|
const responseValue = await response.body("json");
|
|
1063
1069
|
try {
|
|
1064
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1070
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1065
1071
|
throw new ErrorEnvelopeError(
|
|
1066
1072
|
`400`,
|
|
1067
1073
|
response,
|
|
@@ -1100,7 +1106,7 @@ var QueryExecutionClient = class {
|
|
|
1100
1106
|
case 500: {
|
|
1101
1107
|
const responseValue = await response.body("json");
|
|
1102
1108
|
try {
|
|
1103
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1109
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1104
1110
|
throw new ErrorEnvelopeError(
|
|
1105
1111
|
`500`,
|
|
1106
1112
|
response,
|
|
@@ -1214,7 +1220,7 @@ var QueryExecutionClient = class {
|
|
|
1214
1220
|
if (!config) {
|
|
1215
1221
|
throw new ApiClientError2("API client error", "API client call is missing mandatory config parameter");
|
|
1216
1222
|
}
|
|
1217
|
-
const encodedBody = transformRequest(config.body, []);
|
|
1223
|
+
const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
|
|
1218
1224
|
const query = toQueryString({ enrich: config.enrich });
|
|
1219
1225
|
try {
|
|
1220
1226
|
const response = await this.httpClient.send({
|
|
@@ -1235,7 +1241,7 @@ var QueryExecutionClient = class {
|
|
|
1235
1241
|
case 200: {
|
|
1236
1242
|
const responseValue = await response.body("json");
|
|
1237
1243
|
try {
|
|
1238
|
-
return transformResponse(responseValue, [
|
|
1244
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1239
1245
|
["result.records.*.start", { datetime: true }],
|
|
1240
1246
|
["result.records.*.end", { datetime: true }],
|
|
1241
1247
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1244,7 +1250,7 @@ var QueryExecutionClient = class {
|
|
|
1244
1250
|
["result.records.*.end", { datetime: true }],
|
|
1245
1251
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1246
1252
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1247
|
-
]);
|
|
1253
|
+
]) : responseValue;
|
|
1248
1254
|
} catch (err) {
|
|
1249
1255
|
throw new InvalidResponseError2(
|
|
1250
1256
|
`QueryExecutionClient.query:execute:${response.status}`,
|
|
@@ -1259,7 +1265,7 @@ var QueryExecutionClient = class {
|
|
|
1259
1265
|
case 202: {
|
|
1260
1266
|
const responseValue = await response.body("json");
|
|
1261
1267
|
try {
|
|
1262
|
-
return transformResponse(responseValue, [
|
|
1268
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1263
1269
|
["result.records.*.start", { datetime: true }],
|
|
1264
1270
|
["result.records.*.end", { datetime: true }],
|
|
1265
1271
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1268,7 +1274,7 @@ var QueryExecutionClient = class {
|
|
|
1268
1274
|
["result.records.*.end", { datetime: true }],
|
|
1269
1275
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1270
1276
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1271
|
-
]);
|
|
1277
|
+
]) : responseValue;
|
|
1272
1278
|
} catch (err) {
|
|
1273
1279
|
throw new InvalidResponseError2(
|
|
1274
1280
|
`QueryExecutionClient.query:execute:${response.status}`,
|
|
@@ -1321,7 +1327,7 @@ var QueryExecutionClient = class {
|
|
|
1321
1327
|
case 400: {
|
|
1322
1328
|
const responseValue = await response.body("json");
|
|
1323
1329
|
try {
|
|
1324
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1330
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1325
1331
|
throw new ErrorEnvelopeError(
|
|
1326
1332
|
`400`,
|
|
1327
1333
|
response,
|
|
@@ -1349,7 +1355,7 @@ var QueryExecutionClient = class {
|
|
|
1349
1355
|
case 403: {
|
|
1350
1356
|
const responseValue = await response.body("json");
|
|
1351
1357
|
try {
|
|
1352
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1358
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1353
1359
|
throw new InsufficientPermission(
|
|
1354
1360
|
`403`,
|
|
1355
1361
|
response,
|
|
@@ -1374,7 +1380,7 @@ var QueryExecutionClient = class {
|
|
|
1374
1380
|
case 429: {
|
|
1375
1381
|
const responseValue = await response.body("json");
|
|
1376
1382
|
try {
|
|
1377
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1383
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1378
1384
|
throw new ErrorEnvelopeError(
|
|
1379
1385
|
`429`,
|
|
1380
1386
|
response,
|
|
@@ -1399,7 +1405,7 @@ var QueryExecutionClient = class {
|
|
|
1399
1405
|
case 500: {
|
|
1400
1406
|
const responseValue = await response.body("json");
|
|
1401
1407
|
try {
|
|
1402
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1408
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1403
1409
|
throw new ErrorEnvelopeError(
|
|
1404
1410
|
`500`,
|
|
1405
1411
|
response,
|
|
@@ -1424,7 +1430,7 @@ var QueryExecutionClient = class {
|
|
|
1424
1430
|
case 503: {
|
|
1425
1431
|
const responseValue = await response.body("json");
|
|
1426
1432
|
try {
|
|
1427
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1433
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1428
1434
|
throw new ErrorEnvelopeError(
|
|
1429
1435
|
`503`,
|
|
1430
1436
|
response,
|
|
@@ -1450,7 +1456,7 @@ var QueryExecutionClient = class {
|
|
|
1450
1456
|
if (response.status >= 400 && response.status <= 499) {
|
|
1451
1457
|
const responseValue = await response.body("json");
|
|
1452
1458
|
try {
|
|
1453
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1459
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1454
1460
|
throw new ErrorEnvelopeError(
|
|
1455
1461
|
`${response.status}`,
|
|
1456
1462
|
response,
|
|
@@ -1474,7 +1480,7 @@ var QueryExecutionClient = class {
|
|
|
1474
1480
|
} else if (response.status >= 500 && response.status <= 599) {
|
|
1475
1481
|
const responseValue = await response.body("json");
|
|
1476
1482
|
try {
|
|
1477
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1483
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1478
1484
|
throw new ErrorEnvelopeError(
|
|
1479
1485
|
`${response.status}`,
|
|
1480
1486
|
response,
|
|
@@ -1602,7 +1608,7 @@ var QueryExecutionClient = class {
|
|
|
1602
1608
|
case 200: {
|
|
1603
1609
|
const responseValue = await response.body("json");
|
|
1604
1610
|
try {
|
|
1605
|
-
return transformResponse(responseValue, [
|
|
1611
|
+
return this.shouldTransformDates ? transformResponse(responseValue, [
|
|
1606
1612
|
["result.records.*.start", { datetime: true }],
|
|
1607
1613
|
["result.records.*.end", { datetime: true }],
|
|
1608
1614
|
["result.records.**.start", { datetime: true }],
|
|
@@ -1611,7 +1617,7 @@ var QueryExecutionClient = class {
|
|
|
1611
1617
|
["result.records.*.end", { datetime: true }],
|
|
1612
1618
|
["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
|
|
1613
1619
|
["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
|
|
1614
|
-
]);
|
|
1620
|
+
]) : responseValue;
|
|
1615
1621
|
} catch (err) {
|
|
1616
1622
|
throw new InvalidResponseError2(
|
|
1617
1623
|
`QueryExecutionClient.query:cancel:${response.status}`,
|
|
@@ -1667,7 +1673,7 @@ var QueryExecutionClient = class {
|
|
|
1667
1673
|
case 400: {
|
|
1668
1674
|
const responseValue = await response.body("json");
|
|
1669
1675
|
try {
|
|
1670
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1676
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1671
1677
|
throw new ErrorEnvelopeError(
|
|
1672
1678
|
`400`,
|
|
1673
1679
|
response,
|
|
@@ -1706,7 +1712,7 @@ var QueryExecutionClient = class {
|
|
|
1706
1712
|
case 500: {
|
|
1707
1713
|
const responseValue = await response.body("json");
|
|
1708
1714
|
try {
|
|
1709
|
-
const errorBody = transformResponse(responseValue, []);
|
|
1715
|
+
const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
|
|
1710
1716
|
throw new ErrorEnvelopeError(
|
|
1711
1717
|
`500`,
|
|
1712
1718
|
response,
|
package/package.json
CHANGED
|
@@ -5,17 +5,20 @@ import { DQLNode } from '../models/dql-node';
|
|
|
5
5
|
import { ParseRequest } from '../models/parse-request';
|
|
6
6
|
import { VerifyRequest } from '../models/verify-request';
|
|
7
7
|
import { VerifyResponse } from '../models/verify-response';
|
|
8
|
+
import { ApiClientOptions } from './api-client-options';
|
|
8
9
|
/**
|
|
9
10
|
* Supporting operations for the Query. Also known as the Language services.
|
|
10
11
|
*/
|
|
11
12
|
export declare class QueryAssistanceClient {
|
|
12
13
|
private httpClient;
|
|
14
|
+
private shouldTransformDates;
|
|
13
15
|
/**
|
|
14
16
|
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryAssistanceClient. Custom http client should implement {HttpClient} interface.
|
|
17
|
+
* @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
|
|
15
18
|
* @example
|
|
16
19
|
* const queryAssistanceClientNodeJs = new QueryAssistanceClient(yourCustomImplementation);
|
|
17
20
|
*/
|
|
18
|
-
constructor(httpClientImplementation: HttpClient);
|
|
21
|
+
constructor(httpClientImplementation: HttpClient, options?: ApiClientOptions);
|
|
19
22
|
/**
|
|
20
23
|
* Verifies a query without executing it.
|
|
21
24
|
*
|
|
@@ -2,17 +2,20 @@ import { AbortSignal, HttpClient } from '@dynatrace-sdk/http-client';
|
|
|
2
2
|
import { ExecuteRequest } from '../models/execute-request';
|
|
3
3
|
import { QueryPollResponse } from '../models/query-poll-response';
|
|
4
4
|
import { QueryStartResponse } from '../models/query-start-response';
|
|
5
|
+
import { ApiClientOptions } from './api-client-options';
|
|
5
6
|
/**
|
|
6
7
|
* Operations related to the Query execution.
|
|
7
8
|
*/
|
|
8
9
|
export declare class QueryExecutionClient {
|
|
9
10
|
private httpClient;
|
|
11
|
+
private shouldTransformDates;
|
|
10
12
|
/**
|
|
11
13
|
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryExecutionClient. Custom http client should implement {HttpClient} interface.
|
|
14
|
+
* @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
|
|
12
15
|
* @example
|
|
13
16
|
* const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
|
|
14
17
|
*/
|
|
15
|
-
constructor(httpClientImplementation: HttpClient);
|
|
18
|
+
constructor(httpClientImplementation: HttpClient, options?: ApiClientOptions);
|
|
16
19
|
/**
|
|
17
20
|
* Retrieves query status and final result from Grail.
|
|
18
21
|
*
|