@dynatrace-sdk/client-query 1.17.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 CHANGED
@@ -2,6 +2,29 @@
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
+
15
+ ## 1.18.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Fix date-time format serialization. (APPDEV-11661)
20
+
21
+ ## 1.18.0
22
+
23
+ ### Minor Changes
24
+
25
+ - Add `scalar` parameter to `MetricMetadata`
26
+ - Add `SEARCH_OPERATOR`, `SEARCH_PATTERN`, `SAVED_TABLE_NAME` and `PARAMETER_MODIFIER` to the `TokenType` enum
27
+
5
28
  ## 1.17.1
6
29
 
7
30
  ### 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.17.1-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.17.1)
3
+ [![npm](https://img.shields.io/badge/npm-v1.19.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.19.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
@@ -786,7 +786,7 @@ Part of the suggestion.
786
786
  |info|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The type of the suggestion. |
787
787
  |suggestion<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The suggested continuation of the query. |
788
788
  |synopsis|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The synopsis of the suggestion. |
789
- |type<sup>*required</sup>|"SPACE" &#124; "LINEBREAK" &#124; "INDENT" &#124; "PIPE" &#124; "DOT" &#124; "COLON" &#124; "COMMA" &#124; "ASSIGNMENT" &#124; "BRACE_OPEN" &#124; "BRACE_CLOSE" &#124; "BRACKET_OPEN" &#124; "BRACKET_CLOSE" &#124; "PARENTHESIS_OPEN" &#124; "PARENTHESIS_CLOSE" &#124; "QUOTE" &#124; "SINGLE_QUOTE" &#124; "SLASH" &#124; "BOOLEAN_TRUE" &#124; "BOOLEAN_FALSE" &#124; "NULL" &#124; "COMMAND_NAME" &#124; "PARAMETER_KEY" &#124; "PARAMETER_VALUE_SCOPE" &#124; "FUNCTION_NAME" &#124; "TIMESERIES_AGGREGATION" &#124; "TIMESERIES_AGGREGATION_EXPRESSION" &#124; "OPERATOR" &#124; "TRAVERSAL_OPERATOR" &#124; "TRAVERSAL_RELATION_NAME" &#124; "TRAVERSAL_HOP_COUNT" &#124; "SIMPLE_IDENTIFIER" &#124; "DATA_OBJECT" &#124; "NUMBER" &#124; "STRING" &#124; "TIME_UNIT" &#124; "TIMESTAMP_VALUE" &#124; "METRIC_KEY" &#124; "VARIABLE" &#124; "END_COMMENT" &#124; "UID_VALUE" &#124; "PARSE_PATTERN" &#124; "FIELD_PATTERN" &#124; "ENTITY_SELECTOR_PART" &#124; "FIELD_MODIFIER" &#124; "ENTITY_TYPE" &#124; "ENTITY_ATTRIBUTE" &#124; "SMARTSCAPE_ID_VALUE"|The type of the autocomplete token. |
789
+ |type<sup>*required</sup>|"SPACE" &#124; "LINEBREAK" &#124; "INDENT" &#124; "PIPE" &#124; "DOT" &#124; "COLON" &#124; "COMMA" &#124; "ASSIGNMENT" &#124; "BRACE_OPEN" &#124; "BRACE_CLOSE" &#124; "BRACKET_OPEN" &#124; "BRACKET_CLOSE" &#124; "PARENTHESIS_OPEN" &#124; "PARENTHESIS_CLOSE" &#124; "QUOTE" &#124; "SINGLE_QUOTE" &#124; "SLASH" &#124; "BOOLEAN_TRUE" &#124; "BOOLEAN_FALSE" &#124; "NULL" &#124; "COMMAND_NAME" &#124; "PARAMETER_KEY" &#124; "PARAMETER_VALUE_SCOPE" &#124; "FUNCTION_NAME" &#124; "TIMESERIES_AGGREGATION" &#124; "TIMESERIES_AGGREGATION_EXPRESSION" &#124; "OPERATOR" &#124; "SEARCH_OPERATOR" &#124; "TRAVERSAL_OPERATOR" &#124; "TRAVERSAL_RELATION_NAME" &#124; "TRAVERSAL_HOP_COUNT" &#124; "SIMPLE_IDENTIFIER" &#124; "DATA_OBJECT" &#124; "NUMBER" &#124; "STRING" &#124; "TIME_UNIT" &#124; "TIMESTAMP_VALUE" &#124; "METRIC_KEY" &#124; "VARIABLE" &#124; "END_COMMENT" &#124; "UID_VALUE" &#124; "PARSE_PATTERN" &#124; "FIELD_PATTERN" &#124; "SEARCH_PATTERN" &#124; "ENTITY_SELECTOR_PART" &#124; "SAVED_TABLE_NAME" &#124; "PARAMETER_MODIFIER" &#124; "FIELD_MODIFIER" &#124; "ENTITY_TYPE" &#124; "ENTITY_ATTRIBUTE" &#124; "SMARTSCAPE_ID_VALUE"|The type of the autocomplete token. |
790
790
 
791
791
  ### DQLAlternativeNode
792
792
 
@@ -832,7 +832,7 @@ Node that represents single token.
832
832
  |isOptional<sup>*required</sup>|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|True if the node is optional. |
833
833
  |nodeType<sup>*required</sup>|"TERMINAL" &#124; "CONTAINER" &#124; "ALTERNATIVE"|The type of the node. |
834
834
  |tokenPosition|<a href="#tokenposition" target="_blank" rel="noopener noreferrer">TokenPosition</a>|The position of a token in a query string used for errors and notification to map the message to a specific part of the query. |
835
- |type|"SPACE" &#124; "LINEBREAK" &#124; "INDENT" &#124; "PIPE" &#124; "DOT" &#124; "COLON" &#124; "COMMA" &#124; "ASSIGNMENT" &#124; "BRACE_OPEN" &#124; "BRACE_CLOSE" &#124; "BRACKET_OPEN" &#124; "BRACKET_CLOSE" &#124; "PARENTHESIS_OPEN" &#124; "PARENTHESIS_CLOSE" &#124; "QUOTE" &#124; "SINGLE_QUOTE" &#124; "SLASH" &#124; "BOOLEAN_TRUE" &#124; "BOOLEAN_FALSE" &#124; "NULL" &#124; "COMMAND_NAME" &#124; "PARAMETER_KEY" &#124; "PARAMETER_VALUE_SCOPE" &#124; "FUNCTION_NAME" &#124; "TIMESERIES_AGGREGATION" &#124; "TIMESERIES_AGGREGATION_EXPRESSION" &#124; "OPERATOR" &#124; "TRAVERSAL_OPERATOR" &#124; "TRAVERSAL_RELATION_NAME" &#124; "TRAVERSAL_HOP_COUNT" &#124; "SIMPLE_IDENTIFIER" &#124; "DATA_OBJECT" &#124; "NUMBER" &#124; "STRING" &#124; "TIME_UNIT" &#124; "TIMESTAMP_VALUE" &#124; "METRIC_KEY" &#124; "VARIABLE" &#124; "END_COMMENT" &#124; "UID_VALUE" &#124; "PARSE_PATTERN" &#124; "FIELD_PATTERN" &#124; "ENTITY_SELECTOR_PART" &#124; "FIELD_MODIFIER" &#124; "ENTITY_TYPE" &#124; "ENTITY_ATTRIBUTE" &#124; "SMARTSCAPE_ID_VALUE"|The type of the autocomplete token. |
835
+ |type|"SPACE" &#124; "LINEBREAK" &#124; "INDENT" &#124; "PIPE" &#124; "DOT" &#124; "COLON" &#124; "COMMA" &#124; "ASSIGNMENT" &#124; "BRACE_OPEN" &#124; "BRACE_CLOSE" &#124; "BRACKET_OPEN" &#124; "BRACKET_CLOSE" &#124; "PARENTHESIS_OPEN" &#124; "PARENTHESIS_CLOSE" &#124; "QUOTE" &#124; "SINGLE_QUOTE" &#124; "SLASH" &#124; "BOOLEAN_TRUE" &#124; "BOOLEAN_FALSE" &#124; "NULL" &#124; "COMMAND_NAME" &#124; "PARAMETER_KEY" &#124; "PARAMETER_VALUE_SCOPE" &#124; "FUNCTION_NAME" &#124; "TIMESERIES_AGGREGATION" &#124; "TIMESERIES_AGGREGATION_EXPRESSION" &#124; "OPERATOR" &#124; "SEARCH_OPERATOR" &#124; "TRAVERSAL_OPERATOR" &#124; "TRAVERSAL_RELATION_NAME" &#124; "TRAVERSAL_HOP_COUNT" &#124; "SIMPLE_IDENTIFIER" &#124; "DATA_OBJECT" &#124; "NUMBER" &#124; "STRING" &#124; "TIME_UNIT" &#124; "TIMESTAMP_VALUE" &#124; "METRIC_KEY" &#124; "VARIABLE" &#124; "END_COMMENT" &#124; "UID_VALUE" &#124; "PARSE_PATTERN" &#124; "FIELD_PATTERN" &#124; "SEARCH_PATTERN" &#124; "ENTITY_SELECTOR_PART" &#124; "SAVED_TABLE_NAME" &#124; "PARAMETER_MODIFIER" &#124; "FIELD_MODIFIER" &#124; "ENTITY_TYPE" &#124; "ENTITY_ATTRIBUTE" &#124; "SMARTSCAPE_ID_VALUE"|The type of the autocomplete token. |
836
836
 
837
837
  ### ErrorEnvelope
838
838
 
@@ -995,6 +995,7 @@ An object that defines additional metric metadata.
995
995
  |metric.key|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The metric key. |
996
996
  |rate|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The specified rate normalization parameter. |
997
997
  |rollup|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|Metadata about the rollup type. |
998
+ |scalar|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Indicates whether the scalar parameter was set to true in the timeseries aggregation function. |
998
999
  |shifted|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Indicates if the shifted parameter was used. |
999
1000
  |unit|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The unit used. |
1000
1001
 
@@ -1182,7 +1183,7 @@ The type of the autocomplete token.
1182
1183
 
1183
1184
  <div class="padding-left--md">
1184
1185
 
1185
- `Assignment` | `BooleanFalse` | `BooleanTrue` | `BraceClose` | `BraceOpen` | `BracketClose` | `BracketOpen` | `Colon` | `Comma` | `CommandName` | `DataObject` | `Dot` | `EndComment` | `EntityAttribute` | `EntitySelectorPart` | `EntityType` | `FieldModifier` | `FieldPattern` | `FunctionName` | `Indent` | `Linebreak` | `MetricKey` | `Null` | `Number` | `Operator` | `ParameterKey` | `ParameterValueScope` | `ParenthesisClose` | `ParenthesisOpen` | `ParsePattern` | `Pipe` | `Quote` | `SimpleIdentifier` | `SingleQuote` | `Slash` | `SmartscapeIdValue` | `Space` | `String` | `TimeUnit` | `TimeseriesAggregation` | `TimeseriesAggregationExpression` | `TimestampValue` | `TraversalHopCount` | `TraversalOperator` | `TraversalRelationName` | `UidValue` | `Variable`
1186
+ `Assignment` | `BooleanFalse` | `BooleanTrue` | `BraceClose` | `BraceOpen` | `BracketClose` | `BracketOpen` | `Colon` | `Comma` | `CommandName` | `DataObject` | `Dot` | `EndComment` | `EntityAttribute` | `EntitySelectorPart` | `EntityType` | `FieldModifier` | `FieldPattern` | `FunctionName` | `Indent` | `Linebreak` | `MetricKey` | `Null` | `Number` | `Operator` | `ParameterKey` | `ParameterModifier` | `ParameterValueScope` | `ParenthesisClose` | `ParenthesisOpen` | `ParsePattern` | `Pipe` | `Quote` | `SavedTableName` | `SearchOperator` | `SearchPattern` | `SimpleIdentifier` | `SingleQuote` | `Slash` | `SmartscapeIdValue` | `Space` | `String` | `TimeUnit` | `TimeseriesAggregation` | `TimeseriesAggregationExpression` | `TimestampValue` | `TraversalHopCount` | `TraversalOperator` | `TraversalRelationName` | `UidValue` | `Variable`
1186
1187
 
1187
1188
  </div>
1188
1189
 
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2023-2024 Dynatrace LLC
3
+ * Copyright 2023-2025 Dynatrace LLC
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
6
6
  * You may obtain a copy of the License at
@@ -113,7 +113,8 @@ function getErrorMessage(errorBody, defaultMessage) {
113
113
 
114
114
  // packages/client/query/src/lib/utils/transformations.ts
115
115
  var defaultRuleConfig = {
116
- force: false
116
+ force: false,
117
+ datetime: false
117
118
  };
118
119
  function mergeKeys(key1, key2) {
119
120
  if (!key1)
@@ -173,11 +174,15 @@ function isDateLike(value) {
173
174
  return false;
174
175
  }
175
176
  function transformValue(value, rules, direction) {
176
- const { force } = rules;
177
+ const { force, datetime } = rules;
177
178
  if (direction === "to") {
178
179
  return force || isDateLike(value) ? new Date(value) : value;
179
180
  }
180
- return value instanceof Date ? value.toISOString() : value;
181
+ if (value instanceof Date) {
182
+ const iso = value.toISOString();
183
+ return datetime ? iso : iso.split("T")[0];
184
+ }
185
+ return value;
181
186
  }
182
187
  function transform(direction, object, keys) {
183
188
  function walk(obj, currentKey = "") {
@@ -215,13 +220,16 @@ function transformResponse(object, keys) {
215
220
  // packages/client/query/src/lib/apis/query-assistance-api.ts
216
221
  var QueryAssistanceClient = class {
217
222
  httpClient;
223
+ shouldTransformDates = true;
218
224
  /**
219
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.
220
227
  * @example
221
228
  * const queryAssistanceClientNodeJs = new QueryAssistanceClient(yourCustomImplementation);
222
229
  */
223
- constructor(httpClientImplementation) {
230
+ constructor(httpClientImplementation, options) {
224
231
  this.httpClient = httpClientImplementation;
232
+ this.shouldTransformDates = options?.transformDates ?? true;
225
233
  }
226
234
  /**
227
235
  * Verifies a query without executing it.
@@ -254,7 +262,7 @@ var QueryAssistanceClient = class {
254
262
  if (!config) {
255
263
  throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
256
264
  }
257
- const encodedBody = transformRequest(config.body, []);
265
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
258
266
  try {
259
267
  const response = await this.httpClient.send({
260
268
  url: `/platform/storage/query/v1/query:verify`,
@@ -272,7 +280,7 @@ var QueryAssistanceClient = class {
272
280
  });
273
281
  const responseValue = await response.body("json");
274
282
  try {
275
- return transformResponse(responseValue, []);
283
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
276
284
  } catch (err) {
277
285
  throw new import_shared_errors3.InvalidResponseError(
278
286
  `QueryAssistanceClient.query:verify:200`,
@@ -296,7 +304,7 @@ var QueryAssistanceClient = class {
296
304
  case 400: {
297
305
  const responseValue = await response.body("json");
298
306
  try {
299
- const errorBody = transformResponse(responseValue, []);
307
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
300
308
  throw new ErrorEnvelopeError(
301
309
  `400`,
302
310
  response,
@@ -321,7 +329,7 @@ var QueryAssistanceClient = class {
321
329
  case 500: {
322
330
  const responseValue = await response.body("json");
323
331
  try {
324
- const errorBody = transformResponse(responseValue, []);
332
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
325
333
  throw new ErrorEnvelopeError(
326
334
  `500`,
327
335
  response,
@@ -590,7 +598,7 @@ var QueryAssistanceClient = class {
590
598
  if (!config) {
591
599
  throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
592
600
  }
593
- const encodedBody = transformRequest(config.body, []);
601
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
594
602
  try {
595
603
  const response = await this.httpClient.send({
596
604
  url: `/platform/storage/query/v1/query:parse`,
@@ -608,7 +616,7 @@ var QueryAssistanceClient = class {
608
616
  });
609
617
  const responseValue = await response.body("json");
610
618
  try {
611
- return transformResponse(responseValue, []);
619
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
612
620
  } catch (err) {
613
621
  throw new import_shared_errors3.InvalidResponseError(
614
622
  `QueryAssistanceClient.query:parse:200`,
@@ -632,7 +640,7 @@ var QueryAssistanceClient = class {
632
640
  case 400: {
633
641
  const responseValue = await response.body("json");
634
642
  try {
635
- const errorBody = transformResponse(responseValue, []);
643
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
636
644
  throw new ErrorEnvelopeError(
637
645
  `400`,
638
646
  response,
@@ -660,7 +668,7 @@ var QueryAssistanceClient = class {
660
668
  case 500: {
661
669
  const responseValue = await response.body("json");
662
670
  try {
663
- const errorBody = transformResponse(responseValue, []);
671
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
664
672
  throw new ErrorEnvelopeError(
665
673
  `500`,
666
674
  response,
@@ -773,7 +781,7 @@ var QueryAssistanceClient = class {
773
781
  if (!config) {
774
782
  throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
775
783
  }
776
- const encodedBody = transformRequest(config.body, []);
784
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
777
785
  try {
778
786
  const response = await this.httpClient.send({
779
787
  url: `/platform/storage/query/v1/query:autocomplete`,
@@ -791,7 +799,7 @@ var QueryAssistanceClient = class {
791
799
  });
792
800
  const responseValue = await response.body("json");
793
801
  try {
794
- return transformResponse(responseValue, []);
802
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
795
803
  } catch (err) {
796
804
  throw new import_shared_errors3.InvalidResponseError(
797
805
  `QueryAssistanceClient.query:autocomplete:200`,
@@ -815,7 +823,7 @@ var QueryAssistanceClient = class {
815
823
  case 400: {
816
824
  const responseValue = await response.body("json");
817
825
  try {
818
- const errorBody = transformResponse(responseValue, []);
826
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
819
827
  throw new ErrorEnvelopeError(
820
828
  `400`,
821
829
  response,
@@ -843,7 +851,7 @@ var QueryAssistanceClient = class {
843
851
  case 500: {
844
852
  const responseValue = await response.body("json");
845
853
  try {
846
- const errorBody = transformResponse(responseValue, []);
854
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
847
855
  throw new ErrorEnvelopeError(
848
856
  `500`,
849
857
  response,
@@ -964,13 +972,16 @@ var toQueryString = (rawQuery, flags = {}) => {
964
972
  // packages/client/query/src/lib/apis/query-execution-api.ts
965
973
  var QueryExecutionClient = class {
966
974
  httpClient;
975
+ shouldTransformDates = true;
967
976
  /**
968
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.
969
979
  * @example
970
980
  * const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
971
981
  */
972
- constructor(httpClientImplementation) {
982
+ constructor(httpClientImplementation, options) {
973
983
  this.httpClient = httpClientImplementation;
984
+ this.shouldTransformDates = options?.transformDates ?? true;
974
985
  }
975
986
  /**
976
987
  * Retrieves query status and final result from Grail.
@@ -1048,14 +1059,16 @@ var QueryExecutionClient = class {
1048
1059
  });
1049
1060
  const responseValue = await response.body("json");
1050
1061
  try {
1051
- return transformResponse(responseValue, [
1052
- "result.records.*.start",
1053
- "result.records.*.end",
1054
- "result.records.**.start",
1055
- "result.records.**.end",
1056
- "result.metadata.grail.analysisTimeframe.start",
1057
- "result.metadata.grail.analysisTimeframe.end"
1058
- ]);
1062
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1063
+ ["result.records.*.start", { datetime: true }],
1064
+ ["result.records.*.end", { datetime: true }],
1065
+ ["result.records.**.start", { datetime: true }],
1066
+ ["result.records.**.end", { datetime: true }],
1067
+ ["result.records.*.start", { datetime: true }],
1068
+ ["result.records.*.end", { datetime: true }],
1069
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1070
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1071
+ ]) : responseValue;
1059
1072
  } catch (err) {
1060
1073
  throw new import_shared_errors4.InvalidResponseError(
1061
1074
  `QueryExecutionClient.query:poll:200`,
@@ -1079,7 +1092,7 @@ var QueryExecutionClient = class {
1079
1092
  case 400: {
1080
1093
  const responseValue = await response.body("json");
1081
1094
  try {
1082
- const errorBody = transformResponse(responseValue, []);
1095
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1083
1096
  throw new ErrorEnvelopeError(
1084
1097
  `400`,
1085
1098
  response,
@@ -1118,7 +1131,7 @@ var QueryExecutionClient = class {
1118
1131
  case 500: {
1119
1132
  const responseValue = await response.body("json");
1120
1133
  try {
1121
- const errorBody = transformResponse(responseValue, []);
1134
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1122
1135
  throw new ErrorEnvelopeError(
1123
1136
  `500`,
1124
1137
  response,
@@ -1232,7 +1245,7 @@ var QueryExecutionClient = class {
1232
1245
  if (!config) {
1233
1246
  throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
1234
1247
  }
1235
- const encodedBody = transformRequest(config.body, []);
1248
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
1236
1249
  const query = toQueryString({ enrich: config.enrich });
1237
1250
  try {
1238
1251
  const response = await this.httpClient.send({
@@ -1253,14 +1266,16 @@ var QueryExecutionClient = class {
1253
1266
  case 200: {
1254
1267
  const responseValue = await response.body("json");
1255
1268
  try {
1256
- return transformResponse(responseValue, [
1257
- "result.records.*.start",
1258
- "result.records.*.end",
1259
- "result.records.**.start",
1260
- "result.records.**.end",
1261
- "result.metadata.grail.analysisTimeframe.start",
1262
- "result.metadata.grail.analysisTimeframe.end"
1263
- ]);
1269
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1270
+ ["result.records.*.start", { datetime: true }],
1271
+ ["result.records.*.end", { datetime: true }],
1272
+ ["result.records.**.start", { datetime: true }],
1273
+ ["result.records.**.end", { datetime: true }],
1274
+ ["result.records.*.start", { datetime: true }],
1275
+ ["result.records.*.end", { datetime: true }],
1276
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1277
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1278
+ ]) : responseValue;
1264
1279
  } catch (err) {
1265
1280
  throw new import_shared_errors4.InvalidResponseError(
1266
1281
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1275,14 +1290,16 @@ var QueryExecutionClient = class {
1275
1290
  case 202: {
1276
1291
  const responseValue = await response.body("json");
1277
1292
  try {
1278
- return transformResponse(responseValue, [
1279
- "result.records.*.start",
1280
- "result.records.*.end",
1281
- "result.records.**.start",
1282
- "result.records.**.end",
1283
- "result.metadata.grail.analysisTimeframe.start",
1284
- "result.metadata.grail.analysisTimeframe.end"
1285
- ]);
1293
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1294
+ ["result.records.*.start", { datetime: true }],
1295
+ ["result.records.*.end", { datetime: true }],
1296
+ ["result.records.**.start", { datetime: true }],
1297
+ ["result.records.**.end", { datetime: true }],
1298
+ ["result.records.*.start", { datetime: true }],
1299
+ ["result.records.*.end", { datetime: true }],
1300
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1301
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1302
+ ]) : responseValue;
1286
1303
  } catch (err) {
1287
1304
  throw new import_shared_errors4.InvalidResponseError(
1288
1305
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1335,7 +1352,7 @@ var QueryExecutionClient = class {
1335
1352
  case 400: {
1336
1353
  const responseValue = await response.body("json");
1337
1354
  try {
1338
- const errorBody = transformResponse(responseValue, []);
1355
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1339
1356
  throw new ErrorEnvelopeError(
1340
1357
  `400`,
1341
1358
  response,
@@ -1363,7 +1380,7 @@ var QueryExecutionClient = class {
1363
1380
  case 403: {
1364
1381
  const responseValue = await response.body("json");
1365
1382
  try {
1366
- const errorBody = transformResponse(responseValue, []);
1383
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1367
1384
  throw new InsufficientPermission(
1368
1385
  `403`,
1369
1386
  response,
@@ -1388,7 +1405,7 @@ var QueryExecutionClient = class {
1388
1405
  case 429: {
1389
1406
  const responseValue = await response.body("json");
1390
1407
  try {
1391
- const errorBody = transformResponse(responseValue, []);
1408
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1392
1409
  throw new ErrorEnvelopeError(
1393
1410
  `429`,
1394
1411
  response,
@@ -1413,7 +1430,7 @@ var QueryExecutionClient = class {
1413
1430
  case 500: {
1414
1431
  const responseValue = await response.body("json");
1415
1432
  try {
1416
- const errorBody = transformResponse(responseValue, []);
1433
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1417
1434
  throw new ErrorEnvelopeError(
1418
1435
  `500`,
1419
1436
  response,
@@ -1438,7 +1455,7 @@ var QueryExecutionClient = class {
1438
1455
  case 503: {
1439
1456
  const responseValue = await response.body("json");
1440
1457
  try {
1441
- const errorBody = transformResponse(responseValue, []);
1458
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1442
1459
  throw new ErrorEnvelopeError(
1443
1460
  `503`,
1444
1461
  response,
@@ -1464,7 +1481,7 @@ var QueryExecutionClient = class {
1464
1481
  if (response.status >= 400 && response.status <= 499) {
1465
1482
  const responseValue = await response.body("json");
1466
1483
  try {
1467
- const errorBody = transformResponse(responseValue, []);
1484
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1468
1485
  throw new ErrorEnvelopeError(
1469
1486
  `${response.status}`,
1470
1487
  response,
@@ -1488,7 +1505,7 @@ var QueryExecutionClient = class {
1488
1505
  } else if (response.status >= 500 && response.status <= 599) {
1489
1506
  const responseValue = await response.body("json");
1490
1507
  try {
1491
- const errorBody = transformResponse(responseValue, []);
1508
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1492
1509
  throw new ErrorEnvelopeError(
1493
1510
  `${response.status}`,
1494
1511
  response,
@@ -1616,14 +1633,16 @@ var QueryExecutionClient = class {
1616
1633
  case 200: {
1617
1634
  const responseValue = await response.body("json");
1618
1635
  try {
1619
- return transformResponse(responseValue, [
1620
- "result.records.*.start",
1621
- "result.records.*.end",
1622
- "result.records.**.start",
1623
- "result.records.**.end",
1624
- "result.metadata.grail.analysisTimeframe.start",
1625
- "result.metadata.grail.analysisTimeframe.end"
1626
- ]);
1636
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1637
+ ["result.records.*.start", { datetime: true }],
1638
+ ["result.records.*.end", { datetime: true }],
1639
+ ["result.records.**.start", { datetime: true }],
1640
+ ["result.records.**.end", { datetime: true }],
1641
+ ["result.records.*.start", { datetime: true }],
1642
+ ["result.records.*.end", { datetime: true }],
1643
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1644
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1645
+ ]) : responseValue;
1627
1646
  } catch (err) {
1628
1647
  throw new import_shared_errors4.InvalidResponseError(
1629
1648
  `QueryExecutionClient.query:cancel:${response.status}`,
@@ -1679,7 +1698,7 @@ var QueryExecutionClient = class {
1679
1698
  case 400: {
1680
1699
  const responseValue = await response.body("json");
1681
1700
  try {
1682
- const errorBody = transformResponse(responseValue, []);
1701
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1683
1702
  throw new ErrorEnvelopeError(
1684
1703
  `400`,
1685
1704
  response,
@@ -1718,7 +1737,7 @@ var QueryExecutionClient = class {
1718
1737
  case 500: {
1719
1738
  const responseValue = await response.body("json");
1720
1739
  try {
1721
- const errorBody = transformResponse(responseValue, []);
1740
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1722
1741
  throw new ErrorEnvelopeError(
1723
1742
  `500`,
1724
1743
  response,
@@ -1845,6 +1864,7 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
1845
1864
  TokenType2["TimeseriesAggregation"] = "TIMESERIES_AGGREGATION";
1846
1865
  TokenType2["TimeseriesAggregationExpression"] = "TIMESERIES_AGGREGATION_EXPRESSION";
1847
1866
  TokenType2["Operator"] = "OPERATOR";
1867
+ TokenType2["SearchOperator"] = "SEARCH_OPERATOR";
1848
1868
  TokenType2["TraversalOperator"] = "TRAVERSAL_OPERATOR";
1849
1869
  TokenType2["TraversalRelationName"] = "TRAVERSAL_RELATION_NAME";
1850
1870
  TokenType2["TraversalHopCount"] = "TRAVERSAL_HOP_COUNT";
@@ -1860,7 +1880,10 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
1860
1880
  TokenType2["UidValue"] = "UID_VALUE";
1861
1881
  TokenType2["ParsePattern"] = "PARSE_PATTERN";
1862
1882
  TokenType2["FieldPattern"] = "FIELD_PATTERN";
1883
+ TokenType2["SearchPattern"] = "SEARCH_PATTERN";
1863
1884
  TokenType2["EntitySelectorPart"] = "ENTITY_SELECTOR_PART";
1885
+ TokenType2["SavedTableName"] = "SAVED_TABLE_NAME";
1886
+ TokenType2["ParameterModifier"] = "PARAMETER_MODIFIER";
1864
1887
  TokenType2["FieldModifier"] = "FIELD_MODIFIER";
1865
1888
  TokenType2["EntityType"] = "ENTITY_TYPE";
1866
1889
  TokenType2["EntityAttribute"] = "ENTITY_ATTRIBUTE";
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "dynagen": {
3
- "version": "0.16.3",
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.30.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.13.0",
15
+ "version": "1.14.0",
16
16
  "baseUrl": "/platform/storage/query/v1"
17
17
  }
18
18
  }
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2023-2024 Dynatrace LLC
3
+ * Copyright 2023-2025 Dynatrace LLC
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
6
6
  * You may obtain a copy of the License at
@@ -78,7 +78,8 @@ function getErrorMessage(errorBody, defaultMessage) {
78
78
 
79
79
  // packages/client/query/src/lib/utils/transformations.ts
80
80
  var defaultRuleConfig = {
81
- force: false
81
+ force: false,
82
+ datetime: false
82
83
  };
83
84
  function mergeKeys(key1, key2) {
84
85
  if (!key1)
@@ -138,11 +139,15 @@ function isDateLike(value) {
138
139
  return false;
139
140
  }
140
141
  function transformValue(value, rules, direction) {
141
- const { force } = rules;
142
+ const { force, datetime } = rules;
142
143
  if (direction === "to") {
143
144
  return force || isDateLike(value) ? new Date(value) : value;
144
145
  }
145
- return value instanceof Date ? value.toISOString() : value;
146
+ if (value instanceof Date) {
147
+ const iso = value.toISOString();
148
+ return datetime ? iso : iso.split("T")[0];
149
+ }
150
+ return value;
146
151
  }
147
152
  function transform(direction, object, keys) {
148
153
  function walk(obj, currentKey = "") {
@@ -180,13 +185,16 @@ function transformResponse(object, keys) {
180
185
  // packages/client/query/src/lib/apis/query-assistance-api.ts
181
186
  var QueryAssistanceClient = class {
182
187
  httpClient;
188
+ shouldTransformDates = true;
183
189
  /**
184
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.
185
192
  * @example
186
193
  * const queryAssistanceClientNodeJs = new QueryAssistanceClient(yourCustomImplementation);
187
194
  */
188
- constructor(httpClientImplementation) {
195
+ constructor(httpClientImplementation, options) {
189
196
  this.httpClient = httpClientImplementation;
197
+ this.shouldTransformDates = options?.transformDates ?? true;
190
198
  }
191
199
  /**
192
200
  * Verifies a query without executing it.
@@ -219,7 +227,7 @@ var QueryAssistanceClient = class {
219
227
  if (!config) {
220
228
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
221
229
  }
222
- const encodedBody = transformRequest(config.body, []);
230
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
223
231
  try {
224
232
  const response = await this.httpClient.send({
225
233
  url: `/platform/storage/query/v1/query:verify`,
@@ -237,7 +245,7 @@ var QueryAssistanceClient = class {
237
245
  });
238
246
  const responseValue = await response.body("json");
239
247
  try {
240
- return transformResponse(responseValue, []);
248
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
241
249
  } catch (err) {
242
250
  throw new InvalidResponseError(
243
251
  `QueryAssistanceClient.query:verify:200`,
@@ -261,7 +269,7 @@ var QueryAssistanceClient = class {
261
269
  case 400: {
262
270
  const responseValue = await response.body("json");
263
271
  try {
264
- const errorBody = transformResponse(responseValue, []);
272
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
265
273
  throw new ErrorEnvelopeError(
266
274
  `400`,
267
275
  response,
@@ -286,7 +294,7 @@ var QueryAssistanceClient = class {
286
294
  case 500: {
287
295
  const responseValue = await response.body("json");
288
296
  try {
289
- const errorBody = transformResponse(responseValue, []);
297
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
290
298
  throw new ErrorEnvelopeError(
291
299
  `500`,
292
300
  response,
@@ -555,7 +563,7 @@ var QueryAssistanceClient = class {
555
563
  if (!config) {
556
564
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
557
565
  }
558
- const encodedBody = transformRequest(config.body, []);
566
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
559
567
  try {
560
568
  const response = await this.httpClient.send({
561
569
  url: `/platform/storage/query/v1/query:parse`,
@@ -573,7 +581,7 @@ var QueryAssistanceClient = class {
573
581
  });
574
582
  const responseValue = await response.body("json");
575
583
  try {
576
- return transformResponse(responseValue, []);
584
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
577
585
  } catch (err) {
578
586
  throw new InvalidResponseError(
579
587
  `QueryAssistanceClient.query:parse:200`,
@@ -597,7 +605,7 @@ var QueryAssistanceClient = class {
597
605
  case 400: {
598
606
  const responseValue = await response.body("json");
599
607
  try {
600
- const errorBody = transformResponse(responseValue, []);
608
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
601
609
  throw new ErrorEnvelopeError(
602
610
  `400`,
603
611
  response,
@@ -625,7 +633,7 @@ var QueryAssistanceClient = class {
625
633
  case 500: {
626
634
  const responseValue = await response.body("json");
627
635
  try {
628
- const errorBody = transformResponse(responseValue, []);
636
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
629
637
  throw new ErrorEnvelopeError(
630
638
  `500`,
631
639
  response,
@@ -738,7 +746,7 @@ var QueryAssistanceClient = class {
738
746
  if (!config) {
739
747
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
740
748
  }
741
- const encodedBody = transformRequest(config.body, []);
749
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
742
750
  try {
743
751
  const response = await this.httpClient.send({
744
752
  url: `/platform/storage/query/v1/query:autocomplete`,
@@ -756,7 +764,7 @@ var QueryAssistanceClient = class {
756
764
  });
757
765
  const responseValue = await response.body("json");
758
766
  try {
759
- return transformResponse(responseValue, []);
767
+ return this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
760
768
  } catch (err) {
761
769
  throw new InvalidResponseError(
762
770
  `QueryAssistanceClient.query:autocomplete:200`,
@@ -780,7 +788,7 @@ var QueryAssistanceClient = class {
780
788
  case 400: {
781
789
  const responseValue = await response.body("json");
782
790
  try {
783
- const errorBody = transformResponse(responseValue, []);
791
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
784
792
  throw new ErrorEnvelopeError(
785
793
  `400`,
786
794
  response,
@@ -808,7 +816,7 @@ var QueryAssistanceClient = class {
808
816
  case 500: {
809
817
  const responseValue = await response.body("json");
810
818
  try {
811
- const errorBody = transformResponse(responseValue, []);
819
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
812
820
  throw new ErrorEnvelopeError(
813
821
  `500`,
814
822
  response,
@@ -939,13 +947,16 @@ var toQueryString = (rawQuery, flags = {}) => {
939
947
  // packages/client/query/src/lib/apis/query-execution-api.ts
940
948
  var QueryExecutionClient = class {
941
949
  httpClient;
950
+ shouldTransformDates = true;
942
951
  /**
943
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.
944
954
  * @example
945
955
  * const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
946
956
  */
947
- constructor(httpClientImplementation) {
957
+ constructor(httpClientImplementation, options) {
948
958
  this.httpClient = httpClientImplementation;
959
+ this.shouldTransformDates = options?.transformDates ?? true;
949
960
  }
950
961
  /**
951
962
  * Retrieves query status and final result from Grail.
@@ -1023,14 +1034,16 @@ var QueryExecutionClient = class {
1023
1034
  });
1024
1035
  const responseValue = await response.body("json");
1025
1036
  try {
1026
- return transformResponse(responseValue, [
1027
- "result.records.*.start",
1028
- "result.records.*.end",
1029
- "result.records.**.start",
1030
- "result.records.**.end",
1031
- "result.metadata.grail.analysisTimeframe.start",
1032
- "result.metadata.grail.analysisTimeframe.end"
1033
- ]);
1037
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1038
+ ["result.records.*.start", { datetime: true }],
1039
+ ["result.records.*.end", { datetime: true }],
1040
+ ["result.records.**.start", { datetime: true }],
1041
+ ["result.records.**.end", { datetime: true }],
1042
+ ["result.records.*.start", { datetime: true }],
1043
+ ["result.records.*.end", { datetime: true }],
1044
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1045
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1046
+ ]) : responseValue;
1034
1047
  } catch (err) {
1035
1048
  throw new InvalidResponseError2(
1036
1049
  `QueryExecutionClient.query:poll:200`,
@@ -1054,7 +1067,7 @@ var QueryExecutionClient = class {
1054
1067
  case 400: {
1055
1068
  const responseValue = await response.body("json");
1056
1069
  try {
1057
- const errorBody = transformResponse(responseValue, []);
1070
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1058
1071
  throw new ErrorEnvelopeError(
1059
1072
  `400`,
1060
1073
  response,
@@ -1093,7 +1106,7 @@ var QueryExecutionClient = class {
1093
1106
  case 500: {
1094
1107
  const responseValue = await response.body("json");
1095
1108
  try {
1096
- const errorBody = transformResponse(responseValue, []);
1109
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1097
1110
  throw new ErrorEnvelopeError(
1098
1111
  `500`,
1099
1112
  response,
@@ -1207,7 +1220,7 @@ var QueryExecutionClient = class {
1207
1220
  if (!config) {
1208
1221
  throw new ApiClientError2("API client error", "API client call is missing mandatory config parameter");
1209
1222
  }
1210
- const encodedBody = transformRequest(config.body, []);
1223
+ const encodedBody = this.shouldTransformDates ? transformRequest(config.body, []) : config.body;
1211
1224
  const query = toQueryString({ enrich: config.enrich });
1212
1225
  try {
1213
1226
  const response = await this.httpClient.send({
@@ -1228,14 +1241,16 @@ var QueryExecutionClient = class {
1228
1241
  case 200: {
1229
1242
  const responseValue = await response.body("json");
1230
1243
  try {
1231
- return transformResponse(responseValue, [
1232
- "result.records.*.start",
1233
- "result.records.*.end",
1234
- "result.records.**.start",
1235
- "result.records.**.end",
1236
- "result.metadata.grail.analysisTimeframe.start",
1237
- "result.metadata.grail.analysisTimeframe.end"
1238
- ]);
1244
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1245
+ ["result.records.*.start", { datetime: true }],
1246
+ ["result.records.*.end", { datetime: true }],
1247
+ ["result.records.**.start", { datetime: true }],
1248
+ ["result.records.**.end", { datetime: true }],
1249
+ ["result.records.*.start", { datetime: true }],
1250
+ ["result.records.*.end", { datetime: true }],
1251
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1252
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1253
+ ]) : responseValue;
1239
1254
  } catch (err) {
1240
1255
  throw new InvalidResponseError2(
1241
1256
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1250,14 +1265,16 @@ var QueryExecutionClient = class {
1250
1265
  case 202: {
1251
1266
  const responseValue = await response.body("json");
1252
1267
  try {
1253
- return transformResponse(responseValue, [
1254
- "result.records.*.start",
1255
- "result.records.*.end",
1256
- "result.records.**.start",
1257
- "result.records.**.end",
1258
- "result.metadata.grail.analysisTimeframe.start",
1259
- "result.metadata.grail.analysisTimeframe.end"
1260
- ]);
1268
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1269
+ ["result.records.*.start", { datetime: true }],
1270
+ ["result.records.*.end", { datetime: true }],
1271
+ ["result.records.**.start", { datetime: true }],
1272
+ ["result.records.**.end", { datetime: true }],
1273
+ ["result.records.*.start", { datetime: true }],
1274
+ ["result.records.*.end", { datetime: true }],
1275
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1276
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1277
+ ]) : responseValue;
1261
1278
  } catch (err) {
1262
1279
  throw new InvalidResponseError2(
1263
1280
  `QueryExecutionClient.query:execute:${response.status}`,
@@ -1310,7 +1327,7 @@ var QueryExecutionClient = class {
1310
1327
  case 400: {
1311
1328
  const responseValue = await response.body("json");
1312
1329
  try {
1313
- const errorBody = transformResponse(responseValue, []);
1330
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1314
1331
  throw new ErrorEnvelopeError(
1315
1332
  `400`,
1316
1333
  response,
@@ -1338,7 +1355,7 @@ var QueryExecutionClient = class {
1338
1355
  case 403: {
1339
1356
  const responseValue = await response.body("json");
1340
1357
  try {
1341
- const errorBody = transformResponse(responseValue, []);
1358
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1342
1359
  throw new InsufficientPermission(
1343
1360
  `403`,
1344
1361
  response,
@@ -1363,7 +1380,7 @@ var QueryExecutionClient = class {
1363
1380
  case 429: {
1364
1381
  const responseValue = await response.body("json");
1365
1382
  try {
1366
- const errorBody = transformResponse(responseValue, []);
1383
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1367
1384
  throw new ErrorEnvelopeError(
1368
1385
  `429`,
1369
1386
  response,
@@ -1388,7 +1405,7 @@ var QueryExecutionClient = class {
1388
1405
  case 500: {
1389
1406
  const responseValue = await response.body("json");
1390
1407
  try {
1391
- const errorBody = transformResponse(responseValue, []);
1408
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1392
1409
  throw new ErrorEnvelopeError(
1393
1410
  `500`,
1394
1411
  response,
@@ -1413,7 +1430,7 @@ var QueryExecutionClient = class {
1413
1430
  case 503: {
1414
1431
  const responseValue = await response.body("json");
1415
1432
  try {
1416
- const errorBody = transformResponse(responseValue, []);
1433
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1417
1434
  throw new ErrorEnvelopeError(
1418
1435
  `503`,
1419
1436
  response,
@@ -1439,7 +1456,7 @@ var QueryExecutionClient = class {
1439
1456
  if (response.status >= 400 && response.status <= 499) {
1440
1457
  const responseValue = await response.body("json");
1441
1458
  try {
1442
- const errorBody = transformResponse(responseValue, []);
1459
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1443
1460
  throw new ErrorEnvelopeError(
1444
1461
  `${response.status}`,
1445
1462
  response,
@@ -1463,7 +1480,7 @@ var QueryExecutionClient = class {
1463
1480
  } else if (response.status >= 500 && response.status <= 599) {
1464
1481
  const responseValue = await response.body("json");
1465
1482
  try {
1466
- const errorBody = transformResponse(responseValue, []);
1483
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1467
1484
  throw new ErrorEnvelopeError(
1468
1485
  `${response.status}`,
1469
1486
  response,
@@ -1591,14 +1608,16 @@ var QueryExecutionClient = class {
1591
1608
  case 200: {
1592
1609
  const responseValue = await response.body("json");
1593
1610
  try {
1594
- return transformResponse(responseValue, [
1595
- "result.records.*.start",
1596
- "result.records.*.end",
1597
- "result.records.**.start",
1598
- "result.records.**.end",
1599
- "result.metadata.grail.analysisTimeframe.start",
1600
- "result.metadata.grail.analysisTimeframe.end"
1601
- ]);
1611
+ return this.shouldTransformDates ? transformResponse(responseValue, [
1612
+ ["result.records.*.start", { datetime: true }],
1613
+ ["result.records.*.end", { datetime: true }],
1614
+ ["result.records.**.start", { datetime: true }],
1615
+ ["result.records.**.end", { datetime: true }],
1616
+ ["result.records.*.start", { datetime: true }],
1617
+ ["result.records.*.end", { datetime: true }],
1618
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1619
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1620
+ ]) : responseValue;
1602
1621
  } catch (err) {
1603
1622
  throw new InvalidResponseError2(
1604
1623
  `QueryExecutionClient.query:cancel:${response.status}`,
@@ -1654,7 +1673,7 @@ var QueryExecutionClient = class {
1654
1673
  case 400: {
1655
1674
  const responseValue = await response.body("json");
1656
1675
  try {
1657
- const errorBody = transformResponse(responseValue, []);
1676
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1658
1677
  throw new ErrorEnvelopeError(
1659
1678
  `400`,
1660
1679
  response,
@@ -1693,7 +1712,7 @@ var QueryExecutionClient = class {
1693
1712
  case 500: {
1694
1713
  const responseValue = await response.body("json");
1695
1714
  try {
1696
- const errorBody = transformResponse(responseValue, []);
1715
+ const errorBody = this.shouldTransformDates ? transformResponse(responseValue, []) : responseValue;
1697
1716
  throw new ErrorEnvelopeError(
1698
1717
  `500`,
1699
1718
  response,
@@ -1829,6 +1848,7 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
1829
1848
  TokenType2["TimeseriesAggregation"] = "TIMESERIES_AGGREGATION";
1830
1849
  TokenType2["TimeseriesAggregationExpression"] = "TIMESERIES_AGGREGATION_EXPRESSION";
1831
1850
  TokenType2["Operator"] = "OPERATOR";
1851
+ TokenType2["SearchOperator"] = "SEARCH_OPERATOR";
1832
1852
  TokenType2["TraversalOperator"] = "TRAVERSAL_OPERATOR";
1833
1853
  TokenType2["TraversalRelationName"] = "TRAVERSAL_RELATION_NAME";
1834
1854
  TokenType2["TraversalHopCount"] = "TRAVERSAL_HOP_COUNT";
@@ -1844,7 +1864,10 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
1844
1864
  TokenType2["UidValue"] = "UID_VALUE";
1845
1865
  TokenType2["ParsePattern"] = "PARSE_PATTERN";
1846
1866
  TokenType2["FieldPattern"] = "FIELD_PATTERN";
1867
+ TokenType2["SearchPattern"] = "SEARCH_PATTERN";
1847
1868
  TokenType2["EntitySelectorPart"] = "ENTITY_SELECTOR_PART";
1869
+ TokenType2["SavedTableName"] = "SAVED_TABLE_NAME";
1870
+ TokenType2["ParameterModifier"] = "PARAMETER_MODIFIER";
1848
1871
  TokenType2["FieldModifier"] = "FIELD_MODIFIER";
1849
1872
  TokenType2["EntityType"] = "ENTITY_TYPE";
1850
1873
  TokenType2["EntityAttribute"] = "ENTITY_ATTRIBUTE";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace-sdk/client-query",
3
- "version": "1.17.1",
3
+ "version": "1.19.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
  *
@@ -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
  *
@@ -5,7 +5,7 @@ export interface AutocompleteSuggestionPart {
5
5
  /**
6
6
  * The type of the autocomplete token.
7
7
  */
8
- type: 'SPACE' | 'LINEBREAK' | 'INDENT' | 'PIPE' | 'DOT' | 'COLON' | 'COMMA' | 'ASSIGNMENT' | 'BRACE_OPEN' | 'BRACE_CLOSE' | 'BRACKET_OPEN' | 'BRACKET_CLOSE' | 'PARENTHESIS_OPEN' | 'PARENTHESIS_CLOSE' | 'QUOTE' | 'SINGLE_QUOTE' | 'SLASH' | 'BOOLEAN_TRUE' | 'BOOLEAN_FALSE' | 'NULL' | 'COMMAND_NAME' | 'PARAMETER_KEY' | 'PARAMETER_VALUE_SCOPE' | 'FUNCTION_NAME' | 'TIMESERIES_AGGREGATION' | 'TIMESERIES_AGGREGATION_EXPRESSION' | 'OPERATOR' | 'TRAVERSAL_OPERATOR' | 'TRAVERSAL_RELATION_NAME' | 'TRAVERSAL_HOP_COUNT' | 'SIMPLE_IDENTIFIER' | 'DATA_OBJECT' | 'NUMBER' | 'STRING' | 'TIME_UNIT' | 'TIMESTAMP_VALUE' | 'METRIC_KEY' | 'VARIABLE' | 'END_COMMENT' | 'UID_VALUE' | 'PARSE_PATTERN' | 'FIELD_PATTERN' | 'ENTITY_SELECTOR_PART' | 'FIELD_MODIFIER' | 'ENTITY_TYPE' | 'ENTITY_ATTRIBUTE' | 'SMARTSCAPE_ID_VALUE';
8
+ type: 'SPACE' | 'LINEBREAK' | 'INDENT' | 'PIPE' | 'DOT' | 'COLON' | 'COMMA' | 'ASSIGNMENT' | 'BRACE_OPEN' | 'BRACE_CLOSE' | 'BRACKET_OPEN' | 'BRACKET_CLOSE' | 'PARENTHESIS_OPEN' | 'PARENTHESIS_CLOSE' | 'QUOTE' | 'SINGLE_QUOTE' | 'SLASH' | 'BOOLEAN_TRUE' | 'BOOLEAN_FALSE' | 'NULL' | 'COMMAND_NAME' | 'PARAMETER_KEY' | 'PARAMETER_VALUE_SCOPE' | 'FUNCTION_NAME' | 'TIMESERIES_AGGREGATION' | 'TIMESERIES_AGGREGATION_EXPRESSION' | 'OPERATOR' | 'SEARCH_OPERATOR' | 'TRAVERSAL_OPERATOR' | 'TRAVERSAL_RELATION_NAME' | 'TRAVERSAL_HOP_COUNT' | 'SIMPLE_IDENTIFIER' | 'DATA_OBJECT' | 'NUMBER' | 'STRING' | 'TIME_UNIT' | 'TIMESTAMP_VALUE' | 'METRIC_KEY' | 'VARIABLE' | 'END_COMMENT' | 'UID_VALUE' | 'PARSE_PATTERN' | 'FIELD_PATTERN' | 'SEARCH_PATTERN' | 'ENTITY_SELECTOR_PART' | 'SAVED_TABLE_NAME' | 'PARAMETER_MODIFIER' | 'FIELD_MODIFIER' | 'ENTITY_TYPE' | 'ENTITY_ATTRIBUTE' | 'SMARTSCAPE_ID_VALUE';
9
9
  /**
10
10
  * The type of the suggestion.
11
11
  */
@@ -6,7 +6,7 @@ export interface DQLTerminalNode extends DQLNode {
6
6
  /**
7
7
  * The type of the autocomplete token.
8
8
  */
9
- type?: 'SPACE' | 'LINEBREAK' | 'INDENT' | 'PIPE' | 'DOT' | 'COLON' | 'COMMA' | 'ASSIGNMENT' | 'BRACE_OPEN' | 'BRACE_CLOSE' | 'BRACKET_OPEN' | 'BRACKET_CLOSE' | 'PARENTHESIS_OPEN' | 'PARENTHESIS_CLOSE' | 'QUOTE' | 'SINGLE_QUOTE' | 'SLASH' | 'BOOLEAN_TRUE' | 'BOOLEAN_FALSE' | 'NULL' | 'COMMAND_NAME' | 'PARAMETER_KEY' | 'PARAMETER_VALUE_SCOPE' | 'FUNCTION_NAME' | 'TIMESERIES_AGGREGATION' | 'TIMESERIES_AGGREGATION_EXPRESSION' | 'OPERATOR' | 'TRAVERSAL_OPERATOR' | 'TRAVERSAL_RELATION_NAME' | 'TRAVERSAL_HOP_COUNT' | 'SIMPLE_IDENTIFIER' | 'DATA_OBJECT' | 'NUMBER' | 'STRING' | 'TIME_UNIT' | 'TIMESTAMP_VALUE' | 'METRIC_KEY' | 'VARIABLE' | 'END_COMMENT' | 'UID_VALUE' | 'PARSE_PATTERN' | 'FIELD_PATTERN' | 'ENTITY_SELECTOR_PART' | 'FIELD_MODIFIER' | 'ENTITY_TYPE' | 'ENTITY_ATTRIBUTE' | 'SMARTSCAPE_ID_VALUE';
9
+ type?: 'SPACE' | 'LINEBREAK' | 'INDENT' | 'PIPE' | 'DOT' | 'COLON' | 'COMMA' | 'ASSIGNMENT' | 'BRACE_OPEN' | 'BRACE_CLOSE' | 'BRACKET_OPEN' | 'BRACKET_CLOSE' | 'PARENTHESIS_OPEN' | 'PARENTHESIS_CLOSE' | 'QUOTE' | 'SINGLE_QUOTE' | 'SLASH' | 'BOOLEAN_TRUE' | 'BOOLEAN_FALSE' | 'NULL' | 'COMMAND_NAME' | 'PARAMETER_KEY' | 'PARAMETER_VALUE_SCOPE' | 'FUNCTION_NAME' | 'TIMESERIES_AGGREGATION' | 'TIMESERIES_AGGREGATION_EXPRESSION' | 'OPERATOR' | 'SEARCH_OPERATOR' | 'TRAVERSAL_OPERATOR' | 'TRAVERSAL_RELATION_NAME' | 'TRAVERSAL_HOP_COUNT' | 'SIMPLE_IDENTIFIER' | 'DATA_OBJECT' | 'NUMBER' | 'STRING' | 'TIME_UNIT' | 'TIMESTAMP_VALUE' | 'METRIC_KEY' | 'VARIABLE' | 'END_COMMENT' | 'UID_VALUE' | 'PARSE_PATTERN' | 'FIELD_PATTERN' | 'SEARCH_PATTERN' | 'ENTITY_SELECTOR_PART' | 'SAVED_TABLE_NAME' | 'PARAMETER_MODIFIER' | 'FIELD_MODIFIER' | 'ENTITY_TYPE' | 'ENTITY_ATTRIBUTE' | 'SMARTSCAPE_ID_VALUE';
10
10
  /**
11
11
  * For optional items only: whether this node becomes mandatory when user order is used. True only for some optional 'ghost braces'
12
12
  */
@@ -34,4 +34,8 @@ export interface MetricMetadata {
34
34
  * Indicates if the shifted parameter was used.
35
35
  */
36
36
  shifted?: boolean;
37
+ /**
38
+ * Indicates whether the scalar parameter was set to true in the timeseries aggregation function.
39
+ */
40
+ scalar?: boolean;
37
41
  }
@@ -31,6 +31,7 @@ export declare enum TokenType {
31
31
  TimeseriesAggregation = "TIMESERIES_AGGREGATION",
32
32
  TimeseriesAggregationExpression = "TIMESERIES_AGGREGATION_EXPRESSION",
33
33
  Operator = "OPERATOR",
34
+ SearchOperator = "SEARCH_OPERATOR",
34
35
  TraversalOperator = "TRAVERSAL_OPERATOR",
35
36
  TraversalRelationName = "TRAVERSAL_RELATION_NAME",
36
37
  TraversalHopCount = "TRAVERSAL_HOP_COUNT",
@@ -46,7 +47,10 @@ export declare enum TokenType {
46
47
  UidValue = "UID_VALUE",
47
48
  ParsePattern = "PARSE_PATTERN",
48
49
  FieldPattern = "FIELD_PATTERN",
50
+ SearchPattern = "SEARCH_PATTERN",
49
51
  EntitySelectorPart = "ENTITY_SELECTOR_PART",
52
+ SavedTableName = "SAVED_TABLE_NAME",
53
+ ParameterModifier = "PARAMETER_MODIFIER",
50
54
  FieldModifier = "FIELD_MODIFIER",
51
55
  EntityType = "ENTITY_TYPE",
52
56
  EntityAttribute = "ENTITY_ATTRIBUTE",
@@ -1,5 +1,6 @@
1
1
  type TransformRuleConfig = {
2
2
  force?: boolean;
3
+ datetime?: boolean;
3
4
  };
4
5
  export declare function transformRequest<T = any>(object: T, keys: Array<string | [string, TransformRuleConfig]>): T;
5
6
  export declare function transformResponse<T = any>(object: T, keys: Array<string | [string, TransformRuleConfig]>): T;