@dynatrace-sdk/client-query 1.18.1 → 1.20.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 CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  @dynatrace-sdk/client-query
4
4
 
5
+ ## 1.20.0
6
+
7
+ ### Minor changes
8
+ - Add request body parameter `includeTypes` to `ExecuteRequest`
9
+ - Add header `dt-client-context` to all query endpoints
10
+ - Add `enforce-query-consumption-limit` header to `/query:execute` and `/query:autocomplete` endpoints
11
+
12
+ ## 1.19.0
13
+
14
+ ### Minor Changes
15
+
16
+ - Added support for optional transformations. (APPDEV-11914)
17
+
18
+ ### Patch Changes
19
+
20
+ - Added fix for 'transformToFormDataField' function. (APPDEV-12478)
21
+
5
22
  ## 1.18.1
6
23
 
7
24
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @dynatrace-sdk/client-query
2
2
 
3
- [![npm](https://img.shields.io/badge/npm-v1.18.1-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.18.1)
3
+ [![npm](https://img.shields.io/badge/npm-v1.20.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.20.0)
4
4
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5
5
 
6
6
  Exposes an API to fetch records stored in Grail
@@ -88,9 +88,11 @@ a link to docs, etc.
88
88
 
89
89
  #### Parameters
90
90
 
91
- | Name | Type |
92
- | --- | --- |
93
- |config.body<sup>*required</sup>|<a href="#autocompleterequest" target="_blank" rel="noopener noreferrer">AutocompleteRequest</a>|
91
+ | Name | Type | Description |
92
+ | --- | --- | --- |
93
+ |config.body<sup>*required</sup>|<a href="#autocompleterequest" target="_blank" rel="noopener noreferrer">AutocompleteRequest</a>| |
94
+ |config.dtClientContext|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. |
95
+ |config.enforceQueryConsumptionLimit|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|If set, query consumption limit will be enforced. |
94
96
 
95
97
 
96
98
 
@@ -341,9 +343,10 @@ When displaying the query, pick one option. You may use the other options for ho
341
343
 
342
344
  #### Parameters
343
345
 
344
- | Name | Type |
345
- | --- | --- |
346
- |config.body<sup>*required</sup>|<a href="#parserequest" target="_blank" rel="noopener noreferrer">ParseRequest</a>|
346
+ | Name | Type | Description |
347
+ | --- | --- | --- |
348
+ |config.body<sup>*required</sup>|<a href="#parserequest" target="_blank" rel="noopener noreferrer">ParseRequest</a>| |
349
+ |config.dtClientContext|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. |
347
350
 
348
351
 
349
352
 
@@ -409,9 +412,10 @@ submitting the query for execution.
409
412
 
410
413
  #### Parameters
411
414
 
412
- | Name | Type |
413
- | --- | --- |
414
- |config.body<sup>*required</sup>|<a href="#verifyrequest" target="_blank" rel="noopener noreferrer">VerifyRequest</a>|
415
+ | Name | Type | Description |
416
+ | --- | --- | --- |
417
+ |config.body<sup>*required</sup>|<a href="#verifyrequest" target="_blank" rel="noopener noreferrer">VerifyRequest</a>| |
418
+ |config.dtClientContext|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. |
415
419
 
416
420
 
417
421
 
@@ -513,6 +517,7 @@ It is guaranteed that every field of every record will have a corresponding type
513
517
 
514
518
  | Name | Type | Description |
515
519
  | --- | --- | --- |
520
+ |config.dtClientContext|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. |
516
521
  |config.enrich|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|If set additional data will be available in the metadata section. |
517
522
  |config.requestToken<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The request-token of the query. |
518
523
 
@@ -609,6 +614,8 @@ It is guaranteed that every field of every record will have a corresponding type
609
614
  | Name | Type | Description |
610
615
  | --- | --- | --- |
611
616
  |config.body<sup>*required</sup>|<a href="#executerequest">ExecuteRequest</a>| |
617
+ |config.dtClientContext|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. |
618
+ |config.enforceQueryConsumptionLimit|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|If set, query consumption limit will be enforced. |
612
619
  |config.enrich|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|If set additional data will be available in the metadata section. |
613
620
 
614
621
 
@@ -704,6 +711,7 @@ It is guaranteed that every field of every record will have a corresponding type
704
711
 
705
712
  | Name | Type | Description |
706
713
  | --- | --- | --- |
714
+ |config.dtClientContext|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. |
707
715
  |config.enrich|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|If set additional data will be available in the metadata section. |
708
716
  |config.requestTimeoutMilliseconds|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The time a client is willing to wait for the query result. In case the query finishes within the specified timeout, the query result is returned. Otherwise, the query status is returned. |
709
717
  |config.requestToken<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The request-token of the query. |
@@ -890,12 +898,13 @@ Detailed information about the error.
890
898
  |enablePreview|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Request preview results. If a preview is available within the requestTimeoutMilliseconds, then it will be returned as part of the response. |
891
899
  |fetchTimeoutSeconds|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The query will stop reading data after reaching the fetch-timeout. The query execution will continue, providing a partial result based on the read data. |
892
900
  |filterSegments|<a href="#filtersegments">FilterSegments</a>|Represents a collection of filter segments. |
901
+ |includeTypes|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Parameter to exclude the type information from the query result. In case not specified, the type information will be included. <i>default:</i> <code>true</code>|
893
902
  |locale|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'. |
894
903
  |maxResultBytes|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The maximum number of result bytes that this query will return. |
895
904
  |maxResultRecords|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The maximum number of result records that this query will return. |
896
905
  |query<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The full query string. |
897
906
  |queryOptions|<a href="#queryoptions" target="_blank" rel="noopener noreferrer">QueryOptions</a>|Query options enhance query functionality for Dynatrace internal services. |
898
- |requestTimeoutMilliseconds|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The time a client is willing to wait for the query result. In case the query finishes within the specified timeout, the query result is returned. Otherwise, the requestToken is returned, allowing polling for the result. |
907
+ |requestTimeoutMilliseconds|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The maximum time the response will be delayed to wait for a result. (This excludes the sending time and time spent in any services between the query-frontend and the client.) If the query finishes within the specified timeout, the query result is returned. Otherwise, the requestToken is returned, allowing polling for the result. |
899
908
  |timezone|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The query timezone. If none is specified, UTC is used as fallback. The list of valid input values matches that of the IANA Time Zone Database (TZDB). It accepts values in their canonical names like 'Europe/Paris', the abbreviated version like CET or the UTC offset format like '+01:00' |
900
909
 
901
910
  ### FieldType
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,10 @@ 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;
266
+ const headerParameters = {
267
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
268
+ };
263
269
  try {
264
270
  const response = await this.httpClient.send({
265
271
  url: `/platform/storage/query/v1/query:verify`,
@@ -268,7 +274,8 @@ var QueryAssistanceClient = class {
268
274
  body: encodedBody,
269
275
  headers: {
270
276
  "Content-Type": "application/json",
271
- Accept: "application/json"
277
+ Accept: "application/json",
278
+ ...headerParameters
272
279
  },
273
280
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
274
281
  statusValidator: (status) => {
@@ -277,7 +284,7 @@ var QueryAssistanceClient = class {
277
284
  });
278
285
  const responseValue = await response.body("json");
279
286
  try {
280
- return transformResponse(responseValue, []);
287
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
281
288
  } catch (err) {
282
289
  throw new import_shared_errors3.InvalidResponseError(
283
290
  `QueryAssistanceClient.query:verify:200`,
@@ -301,7 +308,7 @@ var QueryAssistanceClient = class {
301
308
  case 400: {
302
309
  const responseValue = await response.body("json");
303
310
  try {
304
- const errorBody = transformResponse(responseValue, []);
311
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
305
312
  throw new ErrorEnvelopeError(
306
313
  `400`,
307
314
  response,
@@ -326,7 +333,7 @@ var QueryAssistanceClient = class {
326
333
  case 500: {
327
334
  const responseValue = await response.body("json");
328
335
  try {
329
- const errorBody = transformResponse(responseValue, []);
336
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
330
337
  throw new ErrorEnvelopeError(
331
338
  `500`,
332
339
  response,
@@ -595,7 +602,10 @@ var QueryAssistanceClient = class {
595
602
  if (!config) {
596
603
  throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
597
604
  }
598
- const encodedBody = transformRequest(config.body, []);
605
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
606
+ const headerParameters = {
607
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
608
+ };
599
609
  try {
600
610
  const response = await this.httpClient.send({
601
611
  url: `/platform/storage/query/v1/query:parse`,
@@ -604,7 +614,8 @@ var QueryAssistanceClient = class {
604
614
  body: encodedBody,
605
615
  headers: {
606
616
  "Content-Type": "application/json",
607
- Accept: "application/json"
617
+ Accept: "application/json",
618
+ ...headerParameters
608
619
  },
609
620
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
610
621
  statusValidator: (status) => {
@@ -613,7 +624,7 @@ var QueryAssistanceClient = class {
613
624
  });
614
625
  const responseValue = await response.body("json");
615
626
  try {
616
- return transformResponse(responseValue, []);
627
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
617
628
  } catch (err) {
618
629
  throw new import_shared_errors3.InvalidResponseError(
619
630
  `QueryAssistanceClient.query:parse:200`,
@@ -637,7 +648,7 @@ var QueryAssistanceClient = class {
637
648
  case 400: {
638
649
  const responseValue = await response.body("json");
639
650
  try {
640
- const errorBody = transformResponse(responseValue, []);
651
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
641
652
  throw new ErrorEnvelopeError(
642
653
  `400`,
643
654
  response,
@@ -665,7 +676,7 @@ var QueryAssistanceClient = class {
665
676
  case 500: {
666
677
  const responseValue = await response.body("json");
667
678
  try {
668
- const errorBody = transformResponse(responseValue, []);
679
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
669
680
  throw new ErrorEnvelopeError(
670
681
  `500`,
671
682
  response,
@@ -778,7 +789,13 @@ var QueryAssistanceClient = class {
778
789
  if (!config) {
779
790
  throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
780
791
  }
781
- const encodedBody = transformRequest(config.body, []);
792
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
793
+ const headerParameters = {
794
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) },
795
+ ...config.enforceQueryConsumptionLimit !== void 0 && {
796
+ "enforce-query-consumption-limit": String(config.enforceQueryConsumptionLimit)
797
+ }
798
+ };
782
799
  try {
783
800
  const response = await this.httpClient.send({
784
801
  url: `/platform/storage/query/v1/query:autocomplete`,
@@ -787,7 +804,8 @@ var QueryAssistanceClient = class {
787
804
  body: encodedBody,
788
805
  headers: {
789
806
  "Content-Type": "application/json",
790
- Accept: "application/json"
807
+ Accept: "application/json",
808
+ ...headerParameters
791
809
  },
792
810
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
793
811
  statusValidator: (status) => {
@@ -796,7 +814,7 @@ var QueryAssistanceClient = class {
796
814
  });
797
815
  const responseValue = await response.body("json");
798
816
  try {
799
- return transformResponse(responseValue, []);
817
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
800
818
  } catch (err) {
801
819
  throw new import_shared_errors3.InvalidResponseError(
802
820
  `QueryAssistanceClient.query:autocomplete:200`,
@@ -820,7 +838,7 @@ var QueryAssistanceClient = class {
820
838
  case 400: {
821
839
  const responseValue = await response.body("json");
822
840
  try {
823
- const errorBody = transformResponse(responseValue, []);
841
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
824
842
  throw new ErrorEnvelopeError(
825
843
  `400`,
826
844
  response,
@@ -848,7 +866,7 @@ var QueryAssistanceClient = class {
848
866
  case 500: {
849
867
  const responseValue = await response.body("json");
850
868
  try {
851
- const errorBody = transformResponse(responseValue, []);
869
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
852
870
  throw new ErrorEnvelopeError(
853
871
  `500`,
854
872
  response,
@@ -969,13 +987,16 @@ var toQueryString = (rawQuery, flags = {}) => {
969
987
  // packages/client/query/src/lib/apis/query-execution-api.ts
970
988
  var QueryExecutionClient = class {
971
989
  httpClient;
990
+ shouldTransformDates = true;
972
991
  /**
973
992
  * @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryExecutionClient. Custom http client should implement {HttpClient} interface.
993
+ * @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
974
994
  * @example
975
995
  * const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
976
996
  */
977
- constructor(httpClientImplementation) {
997
+ constructor(httpClientImplementation, options) {
978
998
  this.httpClient = httpClientImplementation;
999
+ this.shouldTransformDates = options?.transformDates ?? true;
979
1000
  }
980
1001
  /**
981
1002
  * Retrieves query status and final result from Grail.
@@ -1039,12 +1060,16 @@ var QueryExecutionClient = class {
1039
1060
  },
1040
1061
  { explode: { "request-token": false, "request-timeout-milliseconds": false } }
1041
1062
  );
1063
+ const headerParameters = {
1064
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
1065
+ };
1042
1066
  try {
1043
1067
  const response = await this.httpClient.send({
1044
1068
  url: `/platform/storage/query/v1/query:poll${query}`,
1045
1069
  method: "GET",
1046
1070
  headers: {
1047
- Accept: "application/json"
1071
+ Accept: "application/json",
1072
+ ...headerParameters
1048
1073
  },
1049
1074
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
1050
1075
  statusValidator: (status) => {
@@ -1053,7 +1078,7 @@ var QueryExecutionClient = class {
1053
1078
  });
1054
1079
  const responseValue = await response.body("json");
1055
1080
  try {
1056
- return transformResponse(responseValue, [
1081
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1057
1082
  ["result.records.*.start", { datetime: true }],
1058
1083
  ["result.records.*.end", { datetime: true }],
1059
1084
  ["result.records.**.start", { datetime: true }],
@@ -1062,7 +1087,7 @@ var QueryExecutionClient = class {
1062
1087
  ["result.records.*.end", { datetime: true }],
1063
1088
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1064
1089
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1065
- ]);
1090
+ ]) : responseValue;
1066
1091
  } catch (err) {
1067
1092
  throw new import_shared_errors4.InvalidResponseError(
1068
1093
  `QueryExecutionClient.query:poll:200`,
@@ -1086,7 +1111,7 @@ var QueryExecutionClient = class {
1086
1111
  case 400: {
1087
1112
  const responseValue = await response.body("json");
1088
1113
  try {
1089
- const errorBody = transformResponse(responseValue, []);
1114
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1090
1115
  throw new ErrorEnvelopeError(
1091
1116
  `400`,
1092
1117
  response,
@@ -1125,7 +1150,7 @@ var QueryExecutionClient = class {
1125
1150
  case 500: {
1126
1151
  const responseValue = await response.body("json");
1127
1152
  try {
1128
- const errorBody = transformResponse(responseValue, []);
1153
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1129
1154
  throw new ErrorEnvelopeError(
1130
1155
  `500`,
1131
1156
  response,
@@ -1239,8 +1264,14 @@ var QueryExecutionClient = class {
1239
1264
  if (!config) {
1240
1265
  throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
1241
1266
  }
1242
- const encodedBody = transformRequest(config.body, []);
1267
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
1243
1268
  const query = toQueryString({ enrich: config.enrich });
1269
+ const headerParameters = {
1270
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) },
1271
+ ...config.enforceQueryConsumptionLimit !== void 0 && {
1272
+ "enforce-query-consumption-limit": String(config.enforceQueryConsumptionLimit)
1273
+ }
1274
+ };
1244
1275
  try {
1245
1276
  const response = await this.httpClient.send({
1246
1277
  url: `/platform/storage/query/v1/query:execute${query}`,
@@ -1249,7 +1280,8 @@ var QueryExecutionClient = class {
1249
1280
  body: encodedBody,
1250
1281
  headers: {
1251
1282
  "Content-Type": "application/json",
1252
- Accept: "application/json"
1283
+ Accept: "application/json",
1284
+ ...headerParameters
1253
1285
  },
1254
1286
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
1255
1287
  statusValidator: (status) => {
@@ -1260,7 +1292,7 @@ var QueryExecutionClient = class {
1260
1292
  case 200: {
1261
1293
  const responseValue = await response.body("json");
1262
1294
  try {
1263
- return transformResponse(responseValue, [
1295
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1264
1296
  ["result.records.*.start", { datetime: true }],
1265
1297
  ["result.records.*.end", { datetime: true }],
1266
1298
  ["result.records.**.start", { datetime: true }],
@@ -1269,7 +1301,7 @@ var QueryExecutionClient = class {
1269
1301
  ["result.records.*.end", { datetime: true }],
1270
1302
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1271
1303
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1272
- ]);
1304
+ ]) : responseValue;
1273
1305
  } catch (err) {
1274
1306
  throw new import_shared_errors4.InvalidResponseError(
1275
1307
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1284,7 +1316,7 @@ var QueryExecutionClient = class {
1284
1316
  case 202: {
1285
1317
  const responseValue = await response.body("json");
1286
1318
  try {
1287
- return transformResponse(responseValue, [
1319
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1288
1320
  ["result.records.*.start", { datetime: true }],
1289
1321
  ["result.records.*.end", { datetime: true }],
1290
1322
  ["result.records.**.start", { datetime: true }],
@@ -1293,7 +1325,7 @@ var QueryExecutionClient = class {
1293
1325
  ["result.records.*.end", { datetime: true }],
1294
1326
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1295
1327
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1296
- ]);
1328
+ ]) : responseValue;
1297
1329
  } catch (err) {
1298
1330
  throw new import_shared_errors4.InvalidResponseError(
1299
1331
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1346,7 +1378,7 @@ var QueryExecutionClient = class {
1346
1378
  case 400: {
1347
1379
  const responseValue = await response.body("json");
1348
1380
  try {
1349
- const errorBody = transformResponse(responseValue, []);
1381
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1350
1382
  throw new ErrorEnvelopeError(
1351
1383
  `400`,
1352
1384
  response,
@@ -1374,7 +1406,7 @@ var QueryExecutionClient = class {
1374
1406
  case 403: {
1375
1407
  const responseValue = await response.body("json");
1376
1408
  try {
1377
- const errorBody = transformResponse(responseValue, []);
1409
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1378
1410
  throw new InsufficientPermission(
1379
1411
  `403`,
1380
1412
  response,
@@ -1399,7 +1431,7 @@ var QueryExecutionClient = class {
1399
1431
  case 429: {
1400
1432
  const responseValue = await response.body("json");
1401
1433
  try {
1402
- const errorBody = transformResponse(responseValue, []);
1434
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1403
1435
  throw new ErrorEnvelopeError(
1404
1436
  `429`,
1405
1437
  response,
@@ -1424,7 +1456,7 @@ var QueryExecutionClient = class {
1424
1456
  case 500: {
1425
1457
  const responseValue = await response.body("json");
1426
1458
  try {
1427
- const errorBody = transformResponse(responseValue, []);
1459
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1428
1460
  throw new ErrorEnvelopeError(
1429
1461
  `500`,
1430
1462
  response,
@@ -1449,7 +1481,7 @@ var QueryExecutionClient = class {
1449
1481
  case 503: {
1450
1482
  const responseValue = await response.body("json");
1451
1483
  try {
1452
- const errorBody = transformResponse(responseValue, []);
1484
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1453
1485
  throw new ErrorEnvelopeError(
1454
1486
  `503`,
1455
1487
  response,
@@ -1475,7 +1507,7 @@ var QueryExecutionClient = class {
1475
1507
  if (response.status >= 400 && response.status <= 499) {
1476
1508
  const responseValue = await response.body("json");
1477
1509
  try {
1478
- const errorBody = transformResponse(responseValue, []);
1510
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1479
1511
  throw new ErrorEnvelopeError(
1480
1512
  `${response.status}`,
1481
1513
  response,
@@ -1499,7 +1531,7 @@ var QueryExecutionClient = class {
1499
1531
  } else if (response.status >= 500 && response.status <= 599) {
1500
1532
  const responseValue = await response.body("json");
1501
1533
  try {
1502
- const errorBody = transformResponse(responseValue, []);
1534
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1503
1535
  throw new ErrorEnvelopeError(
1504
1536
  `${response.status}`,
1505
1537
  response,
@@ -1611,12 +1643,16 @@ var QueryExecutionClient = class {
1611
1643
  { "request-token": config.requestToken, enrich: config.enrich },
1612
1644
  { explode: { "request-token": false } }
1613
1645
  );
1646
+ const headerParameters = {
1647
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
1648
+ };
1614
1649
  try {
1615
1650
  const response = await this.httpClient.send({
1616
1651
  url: `/platform/storage/query/v1/query:cancel${query}`,
1617
1652
  method: "POST",
1618
1653
  headers: {
1619
- Accept: "application/json"
1654
+ Accept: "application/json",
1655
+ ...headerParameters
1620
1656
  },
1621
1657
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
1622
1658
  statusValidator: (status) => {
@@ -1627,7 +1663,7 @@ var QueryExecutionClient = class {
1627
1663
  case 200: {
1628
1664
  const responseValue = await response.body("json");
1629
1665
  try {
1630
- return transformResponse(responseValue, [
1666
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1631
1667
  ["result.records.*.start", { datetime: true }],
1632
1668
  ["result.records.*.end", { datetime: true }],
1633
1669
  ["result.records.**.start", { datetime: true }],
@@ -1636,7 +1672,7 @@ var QueryExecutionClient = class {
1636
1672
  ["result.records.*.end", { datetime: true }],
1637
1673
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1638
1674
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1639
- ]);
1675
+ ]) : responseValue;
1640
1676
  } catch (err) {
1641
1677
  throw new import_shared_errors4.InvalidResponseError(
1642
1678
  `QueryExecutionClient.query:cancel:${response.status}`,
@@ -1692,7 +1728,7 @@ var QueryExecutionClient = class {
1692
1728
  case 400: {
1693
1729
  const responseValue = await response.body("json");
1694
1730
  try {
1695
- const errorBody = transformResponse(responseValue, []);
1731
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1696
1732
  throw new ErrorEnvelopeError(
1697
1733
  `400`,
1698
1734
  response,
@@ -1731,7 +1767,7 @@ var QueryExecutionClient = class {
1731
1767
  case 500: {
1732
1768
  const responseValue = await response.body("json");
1733
1769
  try {
1734
- const errorBody = transformResponse(responseValue, []);
1770
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1735
1771
  throw new ErrorEnvelopeError(
1736
1772
  `500`,
1737
1773
  response,
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "dynagen": {
3
- "version": "0.17.0",
4
- "generatedAt": "",
3
+ "version": "0.18.0",
4
+ "generatedAt": "2025-03-31T11:21:40.514Z",
5
5
  "template": {
6
6
  "name": "@dynatrace-sdk/template-typescript-client",
7
- "version": "0.31.1"
7
+ "version": "0.33.2"
8
8
  },
9
9
  "featureFlags": {
10
10
  "typeguards": true
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "spec": {
14
14
  "title": "DQL Query",
15
- "version": "1.14.0",
15
+ "version": "1.15.0",
16
16
  "baseUrl": "/platform/storage/query/v1"
17
17
  }
18
18
  }
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,10 @@ 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;
231
+ const headerParameters = {
232
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
233
+ };
228
234
  try {
229
235
  const response = await this.httpClient.send({
230
236
  url: `/platform/storage/query/v1/query:verify`,
@@ -233,7 +239,8 @@ var QueryAssistanceClient = class {
233
239
  body: encodedBody,
234
240
  headers: {
235
241
  "Content-Type": "application/json",
236
- Accept: "application/json"
242
+ Accept: "application/json",
243
+ ...headerParameters
237
244
  },
238
245
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
239
246
  statusValidator: (status) => {
@@ -242,7 +249,7 @@ var QueryAssistanceClient = class {
242
249
  });
243
250
  const responseValue = await response.body("json");
244
251
  try {
245
- return transformResponse(responseValue, []);
252
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
246
253
  } catch (err) {
247
254
  throw new InvalidResponseError(
248
255
  `QueryAssistanceClient.query:verify:200`,
@@ -266,7 +273,7 @@ var QueryAssistanceClient = class {
266
273
  case 400: {
267
274
  const responseValue = await response.body("json");
268
275
  try {
269
- const errorBody = transformResponse(responseValue, []);
276
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
270
277
  throw new ErrorEnvelopeError(
271
278
  `400`,
272
279
  response,
@@ -291,7 +298,7 @@ var QueryAssistanceClient = class {
291
298
  case 500: {
292
299
  const responseValue = await response.body("json");
293
300
  try {
294
- const errorBody = transformResponse(responseValue, []);
301
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
295
302
  throw new ErrorEnvelopeError(
296
303
  `500`,
297
304
  response,
@@ -560,7 +567,10 @@ var QueryAssistanceClient = class {
560
567
  if (!config) {
561
568
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
562
569
  }
563
- const encodedBody = transformRequest(config.body, []);
570
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
571
+ const headerParameters = {
572
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
573
+ };
564
574
  try {
565
575
  const response = await this.httpClient.send({
566
576
  url: `/platform/storage/query/v1/query:parse`,
@@ -569,7 +579,8 @@ var QueryAssistanceClient = class {
569
579
  body: encodedBody,
570
580
  headers: {
571
581
  "Content-Type": "application/json",
572
- Accept: "application/json"
582
+ Accept: "application/json",
583
+ ...headerParameters
573
584
  },
574
585
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
575
586
  statusValidator: (status) => {
@@ -578,7 +589,7 @@ var QueryAssistanceClient = class {
578
589
  });
579
590
  const responseValue = await response.body("json");
580
591
  try {
581
- return transformResponse(responseValue, []);
592
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
582
593
  } catch (err) {
583
594
  throw new InvalidResponseError(
584
595
  `QueryAssistanceClient.query:parse:200`,
@@ -602,7 +613,7 @@ var QueryAssistanceClient = class {
602
613
  case 400: {
603
614
  const responseValue = await response.body("json");
604
615
  try {
605
- const errorBody = transformResponse(responseValue, []);
616
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
606
617
  throw new ErrorEnvelopeError(
607
618
  `400`,
608
619
  response,
@@ -630,7 +641,7 @@ var QueryAssistanceClient = class {
630
641
  case 500: {
631
642
  const responseValue = await response.body("json");
632
643
  try {
633
- const errorBody = transformResponse(responseValue, []);
644
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
634
645
  throw new ErrorEnvelopeError(
635
646
  `500`,
636
647
  response,
@@ -743,7 +754,13 @@ var QueryAssistanceClient = class {
743
754
  if (!config) {
744
755
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
745
756
  }
746
- const encodedBody = transformRequest(config.body, []);
757
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
758
+ const headerParameters = {
759
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) },
760
+ ...config.enforceQueryConsumptionLimit !== void 0 && {
761
+ "enforce-query-consumption-limit": String(config.enforceQueryConsumptionLimit)
762
+ }
763
+ };
747
764
  try {
748
765
  const response = await this.httpClient.send({
749
766
  url: `/platform/storage/query/v1/query:autocomplete`,
@@ -752,7 +769,8 @@ var QueryAssistanceClient = class {
752
769
  body: encodedBody,
753
770
  headers: {
754
771
  "Content-Type": "application/json",
755
- Accept: "application/json"
772
+ Accept: "application/json",
773
+ ...headerParameters
756
774
  },
757
775
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
758
776
  statusValidator: (status) => {
@@ -761,7 +779,7 @@ var QueryAssistanceClient = class {
761
779
  });
762
780
  const responseValue = await response.body("json");
763
781
  try {
764
- return transformResponse(responseValue, []);
782
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
765
783
  } catch (err) {
766
784
  throw new InvalidResponseError(
767
785
  `QueryAssistanceClient.query:autocomplete:200`,
@@ -785,7 +803,7 @@ var QueryAssistanceClient = class {
785
803
  case 400: {
786
804
  const responseValue = await response.body("json");
787
805
  try {
788
- const errorBody = transformResponse(responseValue, []);
806
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
789
807
  throw new ErrorEnvelopeError(
790
808
  `400`,
791
809
  response,
@@ -813,7 +831,7 @@ var QueryAssistanceClient = class {
813
831
  case 500: {
814
832
  const responseValue = await response.body("json");
815
833
  try {
816
- const errorBody = transformResponse(responseValue, []);
834
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
817
835
  throw new ErrorEnvelopeError(
818
836
  `500`,
819
837
  response,
@@ -944,13 +962,16 @@ var toQueryString = (rawQuery, flags = {}) => {
944
962
  // packages/client/query/src/lib/apis/query-execution-api.ts
945
963
  var QueryExecutionClient = class {
946
964
  httpClient;
965
+ shouldTransformDates = true;
947
966
  /**
948
967
  * @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryExecutionClient. Custom http client should implement {HttpClient} interface.
968
+ * @param {ApiClientOptions} [options] - Optional configuration for SDK Client.
949
969
  * @example
950
970
  * const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
951
971
  */
952
- constructor(httpClientImplementation) {
972
+ constructor(httpClientImplementation, options) {
953
973
  this.httpClient = httpClientImplementation;
974
+ this.shouldTransformDates = options?.transformDates ?? true;
954
975
  }
955
976
  /**
956
977
  * Retrieves query status and final result from Grail.
@@ -1014,12 +1035,16 @@ var QueryExecutionClient = class {
1014
1035
  },
1015
1036
  { explode: { "request-token": false, "request-timeout-milliseconds": false } }
1016
1037
  );
1038
+ const headerParameters = {
1039
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
1040
+ };
1017
1041
  try {
1018
1042
  const response = await this.httpClient.send({
1019
1043
  url: `/platform/storage/query/v1/query:poll${query}`,
1020
1044
  method: "GET",
1021
1045
  headers: {
1022
- Accept: "application/json"
1046
+ Accept: "application/json",
1047
+ ...headerParameters
1023
1048
  },
1024
1049
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
1025
1050
  statusValidator: (status) => {
@@ -1028,7 +1053,7 @@ var QueryExecutionClient = class {
1028
1053
  });
1029
1054
  const responseValue = await response.body("json");
1030
1055
  try {
1031
- return transformResponse(responseValue, [
1056
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1032
1057
  ["result.records.*.start", { datetime: true }],
1033
1058
  ["result.records.*.end", { datetime: true }],
1034
1059
  ["result.records.**.start", { datetime: true }],
@@ -1037,7 +1062,7 @@ var QueryExecutionClient = class {
1037
1062
  ["result.records.*.end", { datetime: true }],
1038
1063
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1039
1064
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1040
- ]);
1065
+ ]) : responseValue;
1041
1066
  } catch (err) {
1042
1067
  throw new InvalidResponseError2(
1043
1068
  `QueryExecutionClient.query:poll:200`,
@@ -1061,7 +1086,7 @@ var QueryExecutionClient = class {
1061
1086
  case 400: {
1062
1087
  const responseValue = await response.body("json");
1063
1088
  try {
1064
- const errorBody = transformResponse(responseValue, []);
1089
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1065
1090
  throw new ErrorEnvelopeError(
1066
1091
  `400`,
1067
1092
  response,
@@ -1100,7 +1125,7 @@ var QueryExecutionClient = class {
1100
1125
  case 500: {
1101
1126
  const responseValue = await response.body("json");
1102
1127
  try {
1103
- const errorBody = transformResponse(responseValue, []);
1128
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1104
1129
  throw new ErrorEnvelopeError(
1105
1130
  `500`,
1106
1131
  response,
@@ -1214,8 +1239,14 @@ var QueryExecutionClient = class {
1214
1239
  if (!config) {
1215
1240
  throw new ApiClientError2("API client error", "API client call is missing mandatory config parameter");
1216
1241
  }
1217
- const encodedBody = transformRequest(config.body, []);
1242
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
1218
1243
  const query = toQueryString({ enrich: config.enrich });
1244
+ const headerParameters = {
1245
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) },
1246
+ ...config.enforceQueryConsumptionLimit !== void 0 && {
1247
+ "enforce-query-consumption-limit": String(config.enforceQueryConsumptionLimit)
1248
+ }
1249
+ };
1219
1250
  try {
1220
1251
  const response = await this.httpClient.send({
1221
1252
  url: `/platform/storage/query/v1/query:execute${query}`,
@@ -1224,7 +1255,8 @@ var QueryExecutionClient = class {
1224
1255
  body: encodedBody,
1225
1256
  headers: {
1226
1257
  "Content-Type": "application/json",
1227
- Accept: "application/json"
1258
+ Accept: "application/json",
1259
+ ...headerParameters
1228
1260
  },
1229
1261
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
1230
1262
  statusValidator: (status) => {
@@ -1235,7 +1267,7 @@ var QueryExecutionClient = class {
1235
1267
  case 200: {
1236
1268
  const responseValue = await response.body("json");
1237
1269
  try {
1238
- return transformResponse(responseValue, [
1270
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1239
1271
  ["result.records.*.start", { datetime: true }],
1240
1272
  ["result.records.*.end", { datetime: true }],
1241
1273
  ["result.records.**.start", { datetime: true }],
@@ -1244,7 +1276,7 @@ var QueryExecutionClient = class {
1244
1276
  ["result.records.*.end", { datetime: true }],
1245
1277
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1246
1278
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1247
- ]);
1279
+ ]) : responseValue;
1248
1280
  } catch (err) {
1249
1281
  throw new InvalidResponseError2(
1250
1282
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1259,7 +1291,7 @@ var QueryExecutionClient = class {
1259
1291
  case 202: {
1260
1292
  const responseValue = await response.body("json");
1261
1293
  try {
1262
- return transformResponse(responseValue, [
1294
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1263
1295
  ["result.records.*.start", { datetime: true }],
1264
1296
  ["result.records.*.end", { datetime: true }],
1265
1297
  ["result.records.**.start", { datetime: true }],
@@ -1268,7 +1300,7 @@ var QueryExecutionClient = class {
1268
1300
  ["result.records.*.end", { datetime: true }],
1269
1301
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1270
1302
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1271
- ]);
1303
+ ]) : responseValue;
1272
1304
  } catch (err) {
1273
1305
  throw new InvalidResponseError2(
1274
1306
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1321,7 +1353,7 @@ var QueryExecutionClient = class {
1321
1353
  case 400: {
1322
1354
  const responseValue = await response.body("json");
1323
1355
  try {
1324
- const errorBody = transformResponse(responseValue, []);
1356
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1325
1357
  throw new ErrorEnvelopeError(
1326
1358
  `400`,
1327
1359
  response,
@@ -1349,7 +1381,7 @@ var QueryExecutionClient = class {
1349
1381
  case 403: {
1350
1382
  const responseValue = await response.body("json");
1351
1383
  try {
1352
- const errorBody = transformResponse(responseValue, []);
1384
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1353
1385
  throw new InsufficientPermission(
1354
1386
  `403`,
1355
1387
  response,
@@ -1374,7 +1406,7 @@ var QueryExecutionClient = class {
1374
1406
  case 429: {
1375
1407
  const responseValue = await response.body("json");
1376
1408
  try {
1377
- const errorBody = transformResponse(responseValue, []);
1409
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1378
1410
  throw new ErrorEnvelopeError(
1379
1411
  `429`,
1380
1412
  response,
@@ -1399,7 +1431,7 @@ var QueryExecutionClient = class {
1399
1431
  case 500: {
1400
1432
  const responseValue = await response.body("json");
1401
1433
  try {
1402
- const errorBody = transformResponse(responseValue, []);
1434
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1403
1435
  throw new ErrorEnvelopeError(
1404
1436
  `500`,
1405
1437
  response,
@@ -1424,7 +1456,7 @@ var QueryExecutionClient = class {
1424
1456
  case 503: {
1425
1457
  const responseValue = await response.body("json");
1426
1458
  try {
1427
- const errorBody = transformResponse(responseValue, []);
1459
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1428
1460
  throw new ErrorEnvelopeError(
1429
1461
  `503`,
1430
1462
  response,
@@ -1450,7 +1482,7 @@ var QueryExecutionClient = class {
1450
1482
  if (response.status >= 400 && response.status <= 499) {
1451
1483
  const responseValue = await response.body("json");
1452
1484
  try {
1453
- const errorBody = transformResponse(responseValue, []);
1485
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1454
1486
  throw new ErrorEnvelopeError(
1455
1487
  `${response.status}`,
1456
1488
  response,
@@ -1474,7 +1506,7 @@ var QueryExecutionClient = class {
1474
1506
  } else if (response.status >= 500 && response.status <= 599) {
1475
1507
  const responseValue = await response.body("json");
1476
1508
  try {
1477
- const errorBody = transformResponse(responseValue, []);
1509
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1478
1510
  throw new ErrorEnvelopeError(
1479
1511
  `${response.status}`,
1480
1512
  response,
@@ -1586,12 +1618,16 @@ var QueryExecutionClient = class {
1586
1618
  { "request-token": config.requestToken, enrich: config.enrich },
1587
1619
  { explode: { "request-token": false } }
1588
1620
  );
1621
+ const headerParameters = {
1622
+ ...config.dtClientContext !== void 0 && { "dt-client-context": String(config.dtClientContext) }
1623
+ };
1589
1624
  try {
1590
1625
  const response = await this.httpClient.send({
1591
1626
  url: `/platform/storage/query/v1/query:cancel${query}`,
1592
1627
  method: "POST",
1593
1628
  headers: {
1594
- Accept: "application/json"
1629
+ Accept: "application/json",
1630
+ ...headerParameters
1595
1631
  },
1596
1632
  abortSignal: config instanceof EventTarget ? config : config.abortSignal,
1597
1633
  statusValidator: (status) => {
@@ -1602,7 +1638,7 @@ var QueryExecutionClient = class {
1602
1638
  case 200: {
1603
1639
  const responseValue = await response.body("json");
1604
1640
  try {
1605
- return transformResponse(responseValue, [
1641
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1606
1642
  ["result.records.*.start", { datetime: true }],
1607
1643
  ["result.records.*.end", { datetime: true }],
1608
1644
  ["result.records.**.start", { datetime: true }],
@@ -1611,7 +1647,7 @@ var QueryExecutionClient = class {
1611
1647
  ["result.records.*.end", { datetime: true }],
1612
1648
  ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1613
1649
  ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1614
- ]);
1650
+ ]) : responseValue;
1615
1651
  } catch (err) {
1616
1652
  throw new InvalidResponseError2(
1617
1653
  `QueryExecutionClient.query:cancel:${response.status}`,
@@ -1667,7 +1703,7 @@ var QueryExecutionClient = class {
1667
1703
  case 400: {
1668
1704
  const responseValue = await response.body("json");
1669
1705
  try {
1670
- const errorBody = transformResponse(responseValue, []);
1706
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1671
1707
  throw new ErrorEnvelopeError(
1672
1708
  `400`,
1673
1709
  response,
@@ -1706,7 +1742,7 @@ var QueryExecutionClient = class {
1706
1742
  case 500: {
1707
1743
  const responseValue = await response.body("json");
1708
1744
  try {
1709
- const errorBody = transformResponse(responseValue, []);
1745
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1710
1746
  throw new ErrorEnvelopeError(
1711
1747
  `500`,
1712
1748
  response,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace-sdk/client-query",
3
- "version": "1.18.1",
3
+ "version": "1.20.0",
4
4
  "description": "Exposes an API to fetch records stored in Grail.",
5
5
  "license": "Apache-2.0",
6
6
  "dependencies": {
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Configuration for generated TypeScript SDK clients
3
+ * @param {boolean} transformDates - Flag to control date transformations, enabled by default.
4
+ */
5
+ export interface ApiClientOptions {
6
+ transformDates: boolean;
7
+ }
@@ -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
  *
@@ -45,6 +48,7 @@ export declare class QueryAssistanceClient {
45
48
  */
46
49
  queryVerify(config: {
47
50
  body: VerifyRequest;
51
+ /** The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. */ dtClientContext?: string;
48
52
  abortSignal?: AbortSignal;
49
53
  }): Promise<VerifyResponse>;
50
54
  /**
@@ -261,6 +265,7 @@ export declare class QueryAssistanceClient {
261
265
  */
262
266
  queryParse(config: {
263
267
  body: ParseRequest;
268
+ /** The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. */ dtClientContext?: string;
264
269
  abortSignal?: AbortSignal;
265
270
  }): Promise<DQLNode>;
266
271
  /**
@@ -321,6 +326,8 @@ export declare class QueryAssistanceClient {
321
326
  */
322
327
  queryAutocomplete(config: {
323
328
  body: AutocompleteRequest;
329
+ /** The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. */ dtClientContext?: string;
330
+ /** If set, query consumption limit will be enforced. */ enforceQueryConsumptionLimit?: boolean;
324
331
  abortSignal?: AbortSignal;
325
332
  }): Promise<AutocompleteResponse>;
326
333
  }
@@ -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
  *
@@ -67,6 +70,7 @@ export declare class QueryExecutionClient {
67
70
  /** The request-token of the query. */ requestToken: string;
68
71
  /** The time a client is willing to wait for the query result. In case the query finishes within the specified timeout, the query result is returned. Otherwise, the query status is returned. */ requestTimeoutMilliseconds?: number;
69
72
  /** If set additional data will be available in the metadata section. */ enrich?: string;
73
+ /** The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. */ dtClientContext?: string;
70
74
  abortSignal?: AbortSignal;
71
75
  }): Promise<QueryPollResponse>;
72
76
  /**
@@ -129,6 +133,8 @@ export declare class QueryExecutionClient {
129
133
  queryExecute(config: {
130
134
  body: ExecuteRequest;
131
135
  /** If set additional data will be available in the metadata section. */ enrich?: string;
136
+ /** The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. */ dtClientContext?: string;
137
+ /** If set, query consumption limit will be enforced. */ enforceQueryConsumptionLimit?: boolean;
132
138
  abortSignal?: AbortSignal;
133
139
  }): Promise<QueryStartResponse>;
134
140
  /**
@@ -186,6 +192,7 @@ export declare class QueryExecutionClient {
186
192
  queryCancel(config: {
187
193
  /** The request-token of the query. */ requestToken: string;
188
194
  /** If set additional data will be available in the metadata section. */ enrich?: string;
195
+ /** The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. */ dtClientContext?: string;
189
196
  abortSignal?: AbortSignal;
190
197
  }): Promise<QueryPollResponse | void>;
191
198
  }
@@ -34,7 +34,7 @@ export interface ExecuteRequest {
34
34
  */
35
35
  fetchTimeoutSeconds?: number;
36
36
  /**
37
- * The time a client is willing to wait for the query result. In case the query finishes within the specified timeout, the query result is returned. Otherwise, the requestToken is returned, allowing polling for the result.
37
+ * The maximum time the response will be delayed to wait for a result. (This excludes the sending time and time spent in any services between the query-frontend and the client.) If the query finishes within the specified timeout, the query result is returned. Otherwise, the requestToken is returned, allowing polling for the result.
38
38
  */
39
39
  requestTimeoutMilliseconds?: number;
40
40
  /**
@@ -57,4 +57,8 @@ export interface ExecuteRequest {
57
57
  * Represents a collection of filter segments.
58
58
  */
59
59
  filterSegments?: FilterSegments;
60
+ /**
61
+ * Parameter to exclude the type information from the query result. In case not specified, the type information will be included.
62
+ */
63
+ includeTypes?: boolean;
60
64
  }