@dynatrace-sdk/client-query 1.17.0 → 1.18.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +5 -4
  3. package/cjs/index.js +451 -3357
  4. package/dynatrace-metadata.json +3 -3
  5. package/esm/index.js +189 -3104
  6. package/package.json +1 -1
  7. package/types/packages/client/query/src/lib/models/autocomplete-suggestion-part.d.ts +1 -1
  8. package/types/packages/client/query/src/lib/models/dql-terminal-node.d.ts +1 -1
  9. package/types/packages/client/query/src/lib/models/index.d.ts +0 -40
  10. package/types/packages/client/query/src/lib/models/metric-metadata.d.ts +4 -0
  11. package/types/packages/client/query/src/lib/models/token-type.d.ts +4 -0
  12. package/types/packages/client/query/src/lib/utils/transformations.d.ts +7 -0
  13. package/types/packages/client/query/src/lib/error-envelopes/error-serializer.d.ts +0 -3
  14. package/types/packages/client/query/src/lib/models/autocomplete-request.transformation.d.ts +0 -14
  15. package/types/packages/client/query/src/lib/models/autocomplete-response.transformation.d.ts +0 -11
  16. package/types/packages/client/query/src/lib/models/autocomplete-suggestion-part.transformation.d.ts +0 -12
  17. package/types/packages/client/query/src/lib/models/autocomplete-suggestion.transformation.d.ts +0 -11
  18. package/types/packages/client/query/src/lib/models/dql-alternative-node.transformation.d.ts +0 -9
  19. package/types/packages/client/query/src/lib/models/dql-container-node.transformation.d.ts +0 -10
  20. package/types/packages/client/query/src/lib/models/dql-node-node-type.transformation.d.ts +0 -5
  21. package/types/packages/client/query/src/lib/models/dql-node.transformation.d.ts +0 -17
  22. package/types/packages/client/query/src/lib/models/dql-terminal-node.transformation.d.ts +0 -12
  23. package/types/packages/client/query/src/lib/models/error-envelope.transformation.d.ts +0 -12
  24. package/types/packages/client/query/src/lib/models/error-response-details-constraint-violations-item.transformation.d.ts +0 -10
  25. package/types/packages/client/query/src/lib/models/error-response-details.transformation.d.ts +0 -21
  26. package/types/packages/client/query/src/lib/models/error-response.transformation.d.ts +0 -11
  27. package/types/packages/client/query/src/lib/models/execute-request.transformation.d.ts +0 -23
  28. package/types/packages/client/query/src/lib/models/field-type-type.transformation.d.ts +0 -5
  29. package/types/packages/client/query/src/lib/models/field-type.transformation.d.ts +0 -11
  30. package/types/packages/client/query/src/lib/models/filter-segment-variable-definition.transformation.d.ts +0 -9
  31. package/types/packages/client/query/src/lib/models/filter-segment.transformation.d.ts +0 -10
  32. package/types/packages/client/query/src/lib/models/filter-segments.transformation.d.ts +0 -6
  33. package/types/packages/client/query/src/lib/models/geo-point.transformation.d.ts +0 -9
  34. package/types/packages/client/query/src/lib/models/grail-metadata.transformation.d.ts +0 -22
  35. package/types/packages/client/query/src/lib/models/metadata-notification.transformation.d.ts +0 -15
  36. package/types/packages/client/query/src/lib/models/metadata.transformation.d.ts +0 -11
  37. package/types/packages/client/query/src/lib/models/metric-metadata.transformation.d.ts +0 -15
  38. package/types/packages/client/query/src/lib/models/parse-request.transformation.d.ts +0 -12
  39. package/types/packages/client/query/src/lib/models/position-info.transformation.d.ts +0 -10
  40. package/types/packages/client/query/src/lib/models/query-options.transformation.d.ts +0 -8
  41. package/types/packages/client/query/src/lib/models/query-poll-response.transformation.d.ts +0 -13
  42. package/types/packages/client/query/src/lib/models/query-result.transformation.d.ts +0 -13
  43. package/types/packages/client/query/src/lib/models/query-start-response.transformation.d.ts +0 -14
  44. package/types/packages/client/query/src/lib/models/query-state.transformation.d.ts +0 -5
  45. package/types/packages/client/query/src/lib/models/ranged-field-types-mappings.transformation.d.ts +0 -9
  46. package/types/packages/client/query/src/lib/models/ranged-field-types.transformation.d.ts +0 -10
  47. package/types/packages/client/query/src/lib/models/result-record-value.transformation.d.ts +0 -26
  48. package/types/packages/client/query/src/lib/models/result-record.transformation.d.ts +0 -9
  49. package/types/packages/client/query/src/lib/models/timeframe.transformation.d.ts +0 -9
  50. package/types/packages/client/query/src/lib/models/token-position.transformation.d.ts +0 -13
  51. package/types/packages/client/query/src/lib/models/token-type.transformation.d.ts +0 -5
  52. package/types/packages/client/query/src/lib/models/verify-request.transformation.d.ts +0 -13
  53. package/types/packages/client/query/src/lib/models/verify-response.transformation.d.ts +0 -11
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
@@ -35,64 +35,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
35
35
  // packages/client/query/src/index.ts
36
36
  var src_exports = {};
37
37
  __export(src_exports, {
38
- ApiClientError: () => import_shared_errors6.ApiClientError,
39
- ApiGatewayError: () => import_shared_errors6.ApiGatewayError,
40
- ClientRequestError: () => import_shared_errors6.ClientRequestError,
38
+ ApiClientError: () => import_shared_errors5.ApiClientError,
39
+ ApiGatewayError: () => import_shared_errors5.ApiGatewayError,
40
+ ClientRequestError: () => import_shared_errors5.ClientRequestError,
41
41
  DQLNodeNodeType: () => DQLNodeNodeType,
42
42
  ErrorEnvelopeError: () => ErrorEnvelopeError,
43
43
  FieldTypeType: () => FieldTypeType,
44
44
  InsufficientPermission: () => InsufficientPermission,
45
- InvalidResponseError: () => import_shared_errors6.InvalidResponseError,
45
+ InvalidResponseError: () => import_shared_errors5.InvalidResponseError,
46
46
  QueryAssistanceClient: () => QueryAssistanceClient,
47
47
  QueryExecutionClient: () => QueryExecutionClient,
48
48
  QueryState: () => QueryState,
49
49
  TokenType: () => TokenType,
50
- _AutocompleteRequestTransformation: () => autocomplete_request_transformation_exports,
51
- _AutocompleteResponseTransformation: () => autocomplete_response_transformation_exports,
52
- _AutocompleteSuggestionPartTransformation: () => autocomplete_suggestion_part_transformation_exports,
53
- _AutocompleteSuggestionTransformation: () => autocomplete_suggestion_transformation_exports,
54
- _DQLAlternativeNodeTransformation: () => dql_alternative_node_transformation_exports,
55
- _DQLContainerNodeTransformation: () => dql_container_node_transformation_exports,
56
- _DQLNodeNodeTypeTransformation: () => dql_node_node_type_transformation_exports,
57
- _DQLNodeTransformation: () => dql_node_transformation_exports,
58
- _DQLTerminalNodeTransformation: () => dql_terminal_node_transformation_exports,
59
- _ErrorEnvelopeTransformation: () => error_envelope_transformation_exports,
60
- _ErrorResponseDetailsConstraintViolationsItemTransformation: () => error_response_details_constraint_violations_item_transformation_exports,
61
- _ErrorResponseDetailsTransformation: () => error_response_details_transformation_exports,
62
- _ErrorResponseTransformation: () => error_response_transformation_exports,
63
- _ExecuteRequestTransformation: () => execute_request_transformation_exports,
64
- _FieldTypeTransformation: () => field_type_transformation_exports,
65
- _FieldTypeTypeTransformation: () => field_type_type_transformation_exports,
66
- _FilterSegmentTransformation: () => filter_segment_transformation_exports,
67
- _FilterSegmentVariableDefinitionTransformation: () => filter_segment_variable_definition_transformation_exports,
68
- _FilterSegmentsTransformation: () => filter_segments_transformation_exports,
69
- _GeoPointTransformation: () => geo_point_transformation_exports,
70
- _GrailMetadataTransformation: () => grail_metadata_transformation_exports,
71
- _MetadataNotificationTransformation: () => metadata_notification_transformation_exports,
72
- _MetadataTransformation: () => metadata_transformation_exports,
73
- _MetricMetadataTransformation: () => metric_metadata_transformation_exports,
74
- _ParseRequestTransformation: () => parse_request_transformation_exports,
75
- _PositionInfoTransformation: () => position_info_transformation_exports,
76
- _QueryOptionsTransformation: () => query_options_transformation_exports,
77
- _QueryPollResponseTransformation: () => query_poll_response_transformation_exports,
78
- _QueryResultTransformation: () => query_result_transformation_exports,
79
- _QueryStartResponseTransformation: () => query_start_response_transformation_exports,
80
- _QueryStateTransformation: () => query_state_transformation_exports,
81
- _RangedFieldTypesMappingsTransformation: () => ranged_field_types_mappings_transformation_exports,
82
- _RangedFieldTypesTransformation: () => ranged_field_types_transformation_exports,
83
- _ResultRecordTransformation: () => result_record_transformation_exports,
84
- _ResultRecordValueTransformation: () => result_record_value_transformation_exports,
85
- _TimeframeTransformation: () => timeframe_transformation_exports,
86
- _TokenPositionTransformation: () => token_position_transformation_exports,
87
- _TokenTypeTransformation: () => token_type_transformation_exports,
88
- _VerifyRequestTransformation: () => verify_request_transformation_exports,
89
- _VerifyResponseTransformation: () => verify_response_transformation_exports,
90
- isApiClientError: () => import_shared_errors6.isApiClientError,
91
- isApiGatewayError: () => import_shared_errors6.isApiGatewayError,
92
- isClientRequestError: () => import_shared_errors6.isClientRequestError,
50
+ isApiClientError: () => import_shared_errors5.isApiClientError,
51
+ isApiGatewayError: () => import_shared_errors5.isApiGatewayError,
52
+ isClientRequestError: () => import_shared_errors5.isClientRequestError,
93
53
  isErrorEnvelopeError: () => isErrorEnvelopeError,
94
54
  isInsufficientPermission: () => isInsufficientPermission,
95
- isInvalidResponseError: () => import_shared_errors6.isInvalidResponseError,
55
+ isInvalidResponseError: () => import_shared_errors5.isInvalidResponseError,
96
56
  queryAssistanceClient: () => queryAssistanceClient,
97
57
  queryExecutionClient: () => queryExecutionClient
98
58
  });
@@ -100,7 +60,7 @@ module.exports = __toCommonJS(src_exports);
100
60
 
101
61
  // packages/client/query/src/lib/apis/query-assistance-api.ts
102
62
  var import_http_client = require("@dynatrace-sdk/http-client");
103
- var import_shared_errors4 = require("@dynatrace-sdk/shared-errors");
63
+ var import_shared_errors3 = require("@dynatrace-sdk/shared-errors");
104
64
 
105
65
  // packages/client/query/src/lib/error-envelopes/api-gateway-errors-handler.ts
106
66
  var import_shared_errors = require("@dynatrace-sdk/shared-errors");
@@ -120,47 +80,6 @@ function isErrorEnvelopeError(e) {
120
80
  return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorEnvelopeError === true && e instanceof Error;
121
81
  }
122
82
 
123
- // packages/client/query/src/lib/error-envelopes/error-serializer.ts
124
- var import_error_handlers = require("@dynatrace-sdk/error-handlers");
125
- var import_shared_errors3 = require("@dynatrace-sdk/shared-errors");
126
- var apiClientErrorSerializer = async (error) => {
127
- if ((0, import_shared_errors3.isClientRequestError)(error)) {
128
- const status = error.response.status;
129
- const message = error.message;
130
- return {
131
- name: error.name,
132
- status,
133
- message,
134
- stack: error.stack,
135
- type: import_error_handlers.ErrorType.HTTP,
136
- body: error.body,
137
- cause: error.cause,
138
- ...getOptionalErrorRef(error.body)
139
- };
140
- } else if ((0, import_shared_errors3.isApiClientError)(error)) {
141
- return {
142
- name: error.name,
143
- message: error.message,
144
- stack: error.stack,
145
- type: import_error_handlers.ErrorType.COMMON,
146
- cause: error.cause
147
- };
148
- }
149
- };
150
- var errorSerializerAdded = false;
151
- function registerGlobalErrorSerializer(serializer) {
152
- if (!errorSerializerAdded && (0, import_error_handlers.isGlobalErrorSerializerSupported)()) {
153
- errorSerializerAdded = true;
154
- (0, import_error_handlers.addGlobalErrorSerializer)(serializer);
155
- }
156
- }
157
- function getOptionalErrorRef(body) {
158
- if (body && typeof body === "object" && body.error?.details?.errorRef) {
159
- return { errorRef: body.error.details.errorRef };
160
- }
161
- return {};
162
- }
163
-
164
83
  // packages/client/query/src/lib/error-envelopes/get-error-message.ts
165
84
  function serializeData(data) {
166
85
  try {
@@ -192,1520 +111,110 @@ function getErrorMessage(errorBody, defaultMessage) {
192
111
  return [msg, ...getMessagesFromErrorDetails(details)].join(". ");
193
112
  }
194
113
 
195
- // packages/client/query/src/lib/models/autocomplete-request.transformation.ts
196
- var autocomplete_request_transformation_exports = {};
197
- __export(autocomplete_request_transformation_exports, {
198
- fromJson: () => fromJson2,
199
- isAutocompleteRequest: () => isAutocompleteRequest,
200
- isJson: () => isJson2,
201
- toJson: () => toJson2
202
- });
203
-
204
- // packages/client/query/src/lib/models/query-options.transformation.ts
205
- var query_options_transformation_exports = {};
206
- __export(query_options_transformation_exports, {
207
- fromJson: () => fromJson,
208
- isJson: () => isJson,
209
- isQueryOptions: () => isQueryOptions,
210
- toJson: () => toJson
211
- });
212
- function isQueryOptions(value) {
213
- if (value === null) {
214
- return false;
215
- }
216
- if (value === void 0) {
217
- return false;
218
- }
219
- if (Array.isArray(value)) {
220
- return false;
221
- }
222
- const modelKeys = /* @__PURE__ */ new Set([]);
223
- const hasAdditionalProperties = true;
224
- const requiredKeys = [];
225
- const optionalKeys = [];
226
- const valKeys = new Set(Object.keys(value));
227
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
228
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
229
- const allPropertiesMatchFormat = true;
230
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
231
- }
232
- function isJson(value) {
233
- if (value === null) {
234
- return false;
235
- }
236
- if (value === void 0) {
237
- return false;
238
- }
239
- if (Array.isArray(value)) {
240
- return false;
241
- }
242
- const modelKeys = /* @__PURE__ */ new Set([]);
243
- const hasAdditionalProperties = true;
244
- const requiredKeys = [];
245
- const optionalKeys = [];
246
- const valKeys = new Set(Object.keys(value));
247
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
248
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
249
- const allPropertiesMatchFormat = true;
250
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
251
- }
252
- function fromJson($model) {
253
- const additionalProps = $model;
254
- return {
255
- ...additionalProps
256
- };
257
- }
258
- function toJson($model) {
259
- const additionalProps = $model;
260
- return {
261
- ...additionalProps
262
- };
263
- }
264
-
265
- // packages/client/query/src/lib/models/autocomplete-request.transformation.ts
266
- function isAutocompleteRequest(value) {
267
- if (value === null) {
268
- return false;
269
- }
270
- if (value === void 0) {
271
- return false;
272
- }
273
- if (Array.isArray(value)) {
274
- return false;
275
- }
276
- const modelKeys = /* @__PURE__ */ new Set([
277
- "query",
278
- "cursorPosition",
279
- "timezone",
280
- "locale",
281
- "maxDataSuggestions",
282
- "queryOptions"
283
- ]);
284
- const hasAdditionalProperties = false;
285
- const requiredKeys = ["query"];
286
- const optionalKeys = ["cursorPosition", "timezone", "locale", "maxDataSuggestions", "queryOptions"];
287
- const valKeys = new Set(Object.keys(value));
288
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
289
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
290
- const allPropertiesMatchFormat = true;
291
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
292
- }
293
- function isJson2(value) {
294
- if (value === null) {
295
- return false;
296
- }
297
- if (value === void 0) {
298
- return false;
299
- }
300
- if (Array.isArray(value)) {
301
- return false;
302
- }
303
- const modelKeys = /* @__PURE__ */ new Set([
304
- "query",
305
- "cursorPosition",
306
- "timezone",
307
- "locale",
308
- "maxDataSuggestions",
309
- "queryOptions"
310
- ]);
311
- const hasAdditionalProperties = false;
312
- const requiredKeys = ["query"];
313
- const optionalKeys = ["cursorPosition", "timezone", "locale", "maxDataSuggestions", "queryOptions"];
314
- const valKeys = new Set(Object.keys(value));
315
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
316
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
317
- const allPropertiesMatchFormat = true;
318
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
319
- }
320
- function fromJson2($model) {
321
- const { query, cursorPosition, timezone, locale, maxDataSuggestions, queryOptions } = $model;
322
- return {
323
- query,
324
- cursorPosition,
325
- timezone,
326
- locale,
327
- maxDataSuggestions,
328
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0
329
- };
330
- }
331
- function toJson2($model) {
332
- const { query, cursorPosition, timezone, locale, maxDataSuggestions, queryOptions } = $model;
333
- return {
334
- query,
335
- cursorPosition,
336
- timezone,
337
- locale,
338
- maxDataSuggestions,
339
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0
340
- };
341
- }
342
-
343
- // packages/client/query/src/lib/models/autocomplete-response.transformation.ts
344
- var autocomplete_response_transformation_exports = {};
345
- __export(autocomplete_response_transformation_exports, {
346
- fromJson: () => fromJson6,
347
- isAutocompleteResponse: () => isAutocompleteResponse,
348
- isJson: () => isJson6,
349
- toJson: () => toJson6
350
- });
351
-
352
- // packages/client/query/src/lib/models/autocomplete-suggestion.transformation.ts
353
- var autocomplete_suggestion_transformation_exports = {};
354
- __export(autocomplete_suggestion_transformation_exports, {
355
- fromJson: () => fromJson5,
356
- isAutocompleteSuggestion: () => isAutocompleteSuggestion,
357
- isJson: () => isJson5,
358
- toJson: () => toJson5
359
- });
360
-
361
- // packages/client/query/src/lib/models/autocomplete-suggestion-part.transformation.ts
362
- var autocomplete_suggestion_part_transformation_exports = {};
363
- __export(autocomplete_suggestion_part_transformation_exports, {
364
- fromJson: () => fromJson4,
365
- isAutocompleteSuggestionPart: () => isAutocompleteSuggestionPart,
366
- isJson: () => isJson4,
367
- toJson: () => toJson4
368
- });
369
-
370
- // packages/client/query/src/lib/models/token-type.transformation.ts
371
- var token_type_transformation_exports = {};
372
- __export(token_type_transformation_exports, {
373
- fromJson: () => fromJson3,
374
- isJson: () => isJson3,
375
- isSpaceLinebreakIndentPipeDotColonCommaAssignmentBraceOpenBraceCloseBracketOpenBracketCloseParenthesisOpenParenthesisCloseQuoteSingleQuoteSlashBooleanTrueBooleanFalseNullCommandNameParameterKeyParameterValueScopeFunctionNameTimeseriesAggregationTimeseriesAggregationExpressionOperatorTraversalOperatorTraversalRelationNameTraversalHopCountSimpleIdentifierDataObjectNumberStringTimeUnitTimestampValueMetricKeyVariableEndCommentUidValueParsePatternFieldPatternEntitySelectorPartFieldModifierEntityTypeEntityAttributeSmartscapeIdValue: () => isSpaceLinebreakIndentPipeDotColonCommaAssignmentBraceOpenBraceCloseBracketOpenBracketCloseParenthesisOpenParenthesisCloseQuoteSingleQuoteSlashBooleanTrueBooleanFalseNullCommandNameParameterKeyParameterValueScopeFunctionNameTimeseriesAggregationTimeseriesAggregationExpressionOperatorTraversalOperatorTraversalRelationNameTraversalHopCountSimpleIdentifierDataObjectNumberStringTimeUnitTimestampValueMetricKeyVariableEndCommentUidValueParsePatternFieldPatternEntitySelectorPartFieldModifierEntityTypeEntityAttributeSmartscapeIdValue,
376
- toJson: () => toJson3
377
- });
378
- function isSpaceLinebreakIndentPipeDotColonCommaAssignmentBraceOpenBraceCloseBracketOpenBracketCloseParenthesisOpenParenthesisCloseQuoteSingleQuoteSlashBooleanTrueBooleanFalseNullCommandNameParameterKeyParameterValueScopeFunctionNameTimeseriesAggregationTimeseriesAggregationExpressionOperatorTraversalOperatorTraversalRelationNameTraversalHopCountSimpleIdentifierDataObjectNumberStringTimeUnitTimestampValueMetricKeyVariableEndCommentUidValueParsePatternFieldPatternEntitySelectorPartFieldModifierEntityTypeEntityAttributeSmartscapeIdValue(value) {
379
- return typeof value === "string";
380
- }
381
- function isJson3(value) {
382
- return typeof value === "string";
383
- }
384
- function fromJson3($model) {
385
- return String($model);
386
- }
387
- function toJson3($model) {
388
- return String($model);
389
- }
390
-
391
- // packages/client/query/src/lib/models/autocomplete-suggestion-part.transformation.ts
392
- function isAutocompleteSuggestionPart(value) {
393
- if (value === null) {
394
- return false;
395
- }
396
- if (value === void 0) {
397
- return false;
398
- }
399
- if (Array.isArray(value)) {
400
- return false;
401
- }
402
- const modelKeys = /* @__PURE__ */ new Set(["type", "info", "synopsis", "suggestion"]);
403
- const hasAdditionalProperties = false;
404
- const requiredKeys = ["suggestion", "type"];
405
- const optionalKeys = ["info", "synopsis"];
406
- const valKeys = new Set(Object.keys(value));
407
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
408
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
409
- const allPropertiesMatchFormat = true;
410
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
411
- }
412
- function isJson4(value) {
413
- if (value === null) {
414
- return false;
415
- }
416
- if (value === void 0) {
417
- return false;
418
- }
419
- if (Array.isArray(value)) {
420
- return false;
421
- }
422
- const modelKeys = /* @__PURE__ */ new Set(["type", "info", "synopsis", "suggestion"]);
423
- const hasAdditionalProperties = false;
424
- const requiredKeys = ["suggestion", "type"];
425
- const optionalKeys = ["info", "synopsis"];
426
- const valKeys = new Set(Object.keys(value));
427
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
428
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
429
- const allPropertiesMatchFormat = true;
430
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
431
- }
432
- function fromJson4($model) {
433
- const { type, info, synopsis, suggestion } = $model;
434
- return {
435
- type: fromJson3(type),
436
- info,
437
- synopsis,
438
- suggestion
439
- };
440
- }
441
- function toJson4($model) {
442
- const { type, info, synopsis, suggestion } = $model;
443
- return {
444
- type: toJson3(type),
445
- info,
446
- synopsis,
447
- suggestion
448
- };
449
- }
450
-
451
- // packages/client/query/src/lib/models/autocomplete-suggestion.transformation.ts
452
- function isAutocompleteSuggestion(value) {
453
- if (value === null) {
454
- return false;
455
- }
456
- if (value === void 0) {
457
- return false;
458
- }
459
- if (Array.isArray(value)) {
460
- return false;
461
- }
462
- const modelKeys = /* @__PURE__ */ new Set(["parts", "alreadyTypedCharacters", "suggestion"]);
463
- const hasAdditionalProperties = false;
464
- const requiredKeys = ["alreadyTypedCharacters", "parts", "suggestion"];
465
- const optionalKeys = [];
466
- const valKeys = new Set(Object.keys(value));
467
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
468
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
469
- const allPropertiesMatchFormat = true;
470
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
471
- }
472
- function isJson5(value) {
473
- if (value === null) {
474
- return false;
475
- }
476
- if (value === void 0) {
477
- return false;
478
- }
479
- if (Array.isArray(value)) {
480
- return false;
481
- }
482
- const modelKeys = /* @__PURE__ */ new Set(["parts", "alreadyTypedCharacters", "suggestion"]);
483
- const hasAdditionalProperties = false;
484
- const requiredKeys = ["alreadyTypedCharacters", "parts", "suggestion"];
485
- const optionalKeys = [];
486
- const valKeys = new Set(Object.keys(value));
487
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
488
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
489
- const allPropertiesMatchFormat = true;
490
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
491
- }
492
- function fromJson5($model) {
493
- const { parts, alreadyTypedCharacters, suggestion } = $model;
494
- return {
495
- parts: parts?.map((innerValue) => fromJson4(innerValue)),
496
- alreadyTypedCharacters,
497
- suggestion
498
- };
499
- }
500
- function toJson5($model) {
501
- const { parts, alreadyTypedCharacters, suggestion } = $model;
502
- return {
503
- parts: parts?.map((innerValue) => toJson4(innerValue)),
504
- alreadyTypedCharacters,
505
- suggestion
506
- };
507
- }
508
-
509
- // packages/client/query/src/lib/models/autocomplete-response.transformation.ts
510
- function isAutocompleteResponse(value) {
511
- if (value === null) {
512
- return false;
513
- }
514
- if (value === void 0) {
515
- return false;
516
- }
517
- if (Array.isArray(value)) {
518
- return false;
519
- }
520
- const modelKeys = /* @__PURE__ */ new Set(["optional", "suggestions", "suggestedTtlSeconds"]);
521
- const hasAdditionalProperties = false;
522
- const requiredKeys = ["optional", "suggestions"];
523
- const optionalKeys = ["suggestedTtlSeconds"];
524
- const valKeys = new Set(Object.keys(value));
525
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
526
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
527
- const allPropertiesMatchFormat = true;
528
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
529
- }
530
- function isJson6(value) {
531
- if (value === null) {
532
- return false;
533
- }
534
- if (value === void 0) {
535
- return false;
536
- }
537
- if (Array.isArray(value)) {
538
- return false;
539
- }
540
- const modelKeys = /* @__PURE__ */ new Set(["optional", "suggestions", "suggestedTtlSeconds"]);
541
- const hasAdditionalProperties = false;
542
- const requiredKeys = ["optional", "suggestions"];
543
- const optionalKeys = ["suggestedTtlSeconds"];
544
- const valKeys = new Set(Object.keys(value));
545
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
546
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
547
- const allPropertiesMatchFormat = true;
548
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
549
- }
550
- function fromJson6($model) {
551
- const { optional, suggestions, suggestedTtlSeconds } = $model;
552
- return {
553
- optional,
554
- suggestions: suggestions?.map((innerValue) => fromJson5(innerValue)),
555
- suggestedTtlSeconds
556
- };
557
- }
558
- function toJson6($model) {
559
- const { optional, suggestions, suggestedTtlSeconds } = $model;
560
- return {
561
- optional,
562
- suggestions: suggestions?.map((innerValue) => toJson5(innerValue)),
563
- suggestedTtlSeconds
564
- };
565
- }
566
-
567
- // packages/client/query/src/lib/models/dql-node.transformation.ts
568
- var dql_node_transformation_exports = {};
569
- __export(dql_node_transformation_exports, {
570
- fromJson: () => fromJson7,
571
- isDqlAlternativeNode: () => isDqlAlternativeNode2,
572
- isDqlContainerNode: () => isDqlContainerNode2,
573
- isDqlTerminalNode: () => isDqlTerminalNode2,
574
- isJson: () => isJson13,
575
- toJson: () => toJson7
576
- });
577
-
578
- // packages/client/query/src/lib/models/dql-alternative-node.transformation.ts
579
- var dql_alternative_node_transformation_exports = {};
580
- __export(dql_alternative_node_transformation_exports, {
581
- fromJson: () => fromJson8,
582
- isDqlAlternativeNode: () => isDqlAlternativeNode,
583
- isJson: () => isJson7,
584
- toJson: () => toJson8
585
- });
586
- function isDqlAlternativeNode(value) {
587
- if (value === null) {
588
- return false;
589
- }
590
- if (value === void 0) {
591
- return false;
592
- }
593
- if (Array.isArray(value)) {
594
- return false;
595
- }
596
- const modelKeys = /* @__PURE__ */ new Set([]);
597
- const hasAdditionalProperties = false;
598
- const requiredKeys = ["alternatives", "isOptional", "nodeType"];
599
- const optionalKeys = [];
600
- const valKeys = new Set(Object.keys(value));
601
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
602
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
603
- const allPropertiesMatchFormat = true;
604
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
605
- }
606
- function isJson7(value) {
607
- if (value === null) {
608
- return false;
609
- }
610
- if (value === void 0) {
611
- return false;
612
- }
613
- if (Array.isArray(value)) {
614
- return false;
615
- }
616
- const modelKeys = /* @__PURE__ */ new Set([]);
617
- const hasAdditionalProperties = false;
618
- const requiredKeys = ["alternatives", "isOptional", "nodeType"];
619
- const optionalKeys = [];
620
- const valKeys = new Set(Object.keys(value));
621
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
622
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
623
- const allPropertiesMatchFormat = true;
624
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
625
- }
626
- function fromJson8($model) {
627
- const { alternatives } = $model;
628
- return {
629
- ...fromJson7($model, false),
630
- alternatives
631
- };
632
- }
633
- function toJson8($model) {
634
- const { alternatives } = $model;
635
- return {
636
- ...toJson7($model, false),
637
- alternatives
638
- };
639
- }
640
-
641
- // packages/client/query/src/lib/models/dql-container-node.transformation.ts
642
- var dql_container_node_transformation_exports = {};
643
- __export(dql_container_node_transformation_exports, {
644
- fromJson: () => fromJson9,
645
- isDqlContainerNode: () => isDqlContainerNode,
646
- isJson: () => isJson8,
647
- toJson: () => toJson9
648
- });
649
- function isDqlContainerNode(value) {
650
- if (value === null) {
651
- return false;
652
- }
653
- if (value === void 0) {
654
- return false;
655
- }
656
- if (Array.isArray(value)) {
657
- return false;
658
- }
659
- const modelKeys = /* @__PURE__ */ new Set([]);
660
- const hasAdditionalProperties = false;
661
- const requiredKeys = ["children", "isOptional", "nodeType", "type"];
662
- const optionalKeys = [];
663
- const valKeys = new Set(Object.keys(value));
664
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
665
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
666
- const allPropertiesMatchFormat = true;
667
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
668
- }
669
- function isJson8(value) {
670
- if (value === null) {
671
- return false;
672
- }
673
- if (value === void 0) {
674
- return false;
675
- }
676
- if (Array.isArray(value)) {
677
- return false;
678
- }
679
- const modelKeys = /* @__PURE__ */ new Set([]);
680
- const hasAdditionalProperties = false;
681
- const requiredKeys = ["children", "isOptional", "nodeType", "type"];
682
- const optionalKeys = [];
683
- const valKeys = new Set(Object.keys(value));
684
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
685
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
686
- const allPropertiesMatchFormat = true;
687
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
688
- }
689
- function fromJson9($model) {
690
- const { type, children } = $model;
691
- return {
692
- ...fromJson7($model, false),
693
- type,
694
- children: children !== void 0 && children !== null ? children?.map((innerValue) => fromJson7(innerValue)) : void 0
695
- };
696
- }
697
- function toJson9($model) {
698
- const { type, children } = $model;
699
- return {
700
- ...toJson7($model, false),
701
- type,
702
- children: children !== void 0 && children !== null ? children?.map((innerValue) => toJson7(innerValue)) : void 0
703
- };
704
- }
705
-
706
- // packages/client/query/src/lib/models/dql-node-node-type.transformation.ts
707
- var dql_node_node_type_transformation_exports = {};
708
- __export(dql_node_node_type_transformation_exports, {
709
- fromJson: () => fromJson10,
710
- isJson: () => isJson9,
711
- isTerminalContainerAlternative: () => isTerminalContainerAlternative,
712
- toJson: () => toJson10
713
- });
714
- function isTerminalContainerAlternative(value) {
715
- return typeof value === "string";
716
- }
717
- function isJson9(value) {
718
- return typeof value === "string";
719
- }
720
- function fromJson10($model) {
721
- return String($model);
722
- }
723
- function toJson10($model) {
724
- return String($model);
725
- }
726
-
727
- // packages/client/query/src/lib/models/dql-terminal-node.transformation.ts
728
- var dql_terminal_node_transformation_exports = {};
729
- __export(dql_terminal_node_transformation_exports, {
730
- fromJson: () => fromJson11,
731
- isDqlTerminalNode: () => isDqlTerminalNode,
732
- isJson: () => isJson10,
733
- toJson: () => toJson11
734
- });
735
- function isDqlTerminalNode(value) {
736
- if (value === null) {
737
- return false;
738
- }
739
- if (value === void 0) {
740
- return false;
741
- }
742
- if (Array.isArray(value)) {
743
- return false;
744
- }
745
- const modelKeys = /* @__PURE__ */ new Set([]);
746
- const hasAdditionalProperties = false;
747
- const requiredKeys = ["canonicalString", "isMandatoryOnUserOrder", "isOptional", "nodeType", "type"];
748
- const optionalKeys = [];
749
- const valKeys = new Set(Object.keys(value));
750
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
751
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
752
- const allPropertiesMatchFormat = true;
753
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
754
- }
755
- function isJson10(value) {
756
- if (value === null) {
757
- return false;
758
- }
759
- if (value === void 0) {
760
- return false;
761
- }
762
- if (Array.isArray(value)) {
763
- return false;
764
- }
765
- const modelKeys = /* @__PURE__ */ new Set([]);
766
- const hasAdditionalProperties = false;
767
- const requiredKeys = ["canonicalString", "isMandatoryOnUserOrder", "isOptional", "nodeType", "type"];
768
- const optionalKeys = [];
769
- const valKeys = new Set(Object.keys(value));
770
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
771
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
772
- const allPropertiesMatchFormat = true;
773
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
774
- }
775
- function fromJson11($model) {
776
- const { type, isMandatoryOnUserOrder, canonicalString } = $model;
777
- return {
778
- ...fromJson7($model, false),
779
- type: type !== void 0 && type !== null ? fromJson3(type) : void 0,
780
- isMandatoryOnUserOrder,
781
- canonicalString
782
- };
783
- }
784
- function toJson11($model) {
785
- const { type, isMandatoryOnUserOrder, canonicalString } = $model;
786
- return {
787
- ...toJson7($model, false),
788
- type: type !== void 0 && type !== null ? toJson3(type) : void 0,
789
- isMandatoryOnUserOrder,
790
- canonicalString
791
- };
792
- }
793
-
794
- // packages/client/query/src/lib/models/token-position.transformation.ts
795
- var token_position_transformation_exports = {};
796
- __export(token_position_transformation_exports, {
797
- fromFormData: () => fromFormData,
798
- fromJson: () => fromJson13,
799
- isJson: () => isJson12,
800
- isTokenPosition: () => isTokenPosition,
801
- toFormData: () => toFormData,
802
- toJson: () => toJson13
803
- });
804
-
805
- // packages/client/query/src/lib/models/position-info.transformation.ts
806
- var position_info_transformation_exports = {};
807
- __export(position_info_transformation_exports, {
808
- fromJson: () => fromJson12,
809
- isJson: () => isJson11,
810
- isPositionInfo: () => isPositionInfo,
811
- toJson: () => toJson12
812
- });
813
- function isPositionInfo(value) {
814
- if (value === null) {
815
- return false;
816
- }
817
- if (value === void 0) {
818
- return false;
819
- }
820
- if (Array.isArray(value)) {
821
- return false;
822
- }
823
- const modelKeys = /* @__PURE__ */ new Set(["column", "index", "line"]);
824
- const hasAdditionalProperties = false;
825
- const requiredKeys = ["column", "index", "line"];
826
- const optionalKeys = [];
827
- const valKeys = new Set(Object.keys(value));
828
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
829
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
830
- const allPropertiesMatchFormat = true;
831
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
832
- }
833
- function isJson11(value) {
834
- if (value === null) {
835
- return false;
836
- }
837
- if (value === void 0) {
838
- return false;
839
- }
840
- if (Array.isArray(value)) {
841
- return false;
842
- }
843
- const modelKeys = /* @__PURE__ */ new Set(["column", "index", "line"]);
844
- const hasAdditionalProperties = false;
845
- const requiredKeys = ["column", "index", "line"];
846
- const optionalKeys = [];
847
- const valKeys = new Set(Object.keys(value));
848
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
849
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
850
- const allPropertiesMatchFormat = true;
851
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
852
- }
853
- function fromJson12($model) {
854
- const { column, index, line } = $model;
855
- return {
856
- column,
857
- index,
858
- line
859
- };
860
- }
861
- function toJson12($model) {
862
- const { column, index, line } = $model;
863
- return {
864
- column,
865
- index,
866
- line
867
- };
868
- }
869
-
870
- // packages/client/query/src/lib/models/token-position.transformation.ts
871
- function isTokenPosition(value) {
872
- if (value === null) {
873
- return false;
874
- }
875
- if (value === void 0) {
876
- return false;
877
- }
878
- if (Array.isArray(value)) {
879
- return false;
880
- }
881
- const modelKeys = /* @__PURE__ */ new Set(["start", "end"]);
882
- const hasAdditionalProperties = false;
883
- const requiredKeys = ["end", "start"];
884
- const optionalKeys = [];
885
- const valKeys = new Set(Object.keys(value));
886
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
887
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
888
- const allPropertiesMatchFormat = true;
889
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
890
- }
891
- function isJson12(value) {
892
- if (value === null) {
893
- return false;
894
- }
895
- if (value === void 0) {
896
- return false;
897
- }
898
- if (Array.isArray(value)) {
899
- return false;
900
- }
901
- const modelKeys = /* @__PURE__ */ new Set(["start", "end"]);
902
- const hasAdditionalProperties = false;
903
- const requiredKeys = ["end", "start"];
904
- const optionalKeys = [];
905
- const valKeys = new Set(Object.keys(value));
906
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
907
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
908
- const allPropertiesMatchFormat = true;
909
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
910
- }
911
- function fromJson13($model) {
912
- const { start, end } = $model;
913
- return {
914
- start: fromJson12(start),
915
- end: fromJson12(end)
916
- };
917
- }
918
- function toJson13($model) {
919
- const { start, end } = $model;
920
- return {
921
- start: toJson12(start),
922
- end: toJson12(end)
923
- };
924
- }
925
- function fromFormData(formData) {
926
- const formDataEntries = Object.fromEntries(formData.map((data) => [data.name, data.value]));
927
- return {
928
- start: fromJson12(JSON.parse(formDataEntries["start"])),
929
- end: fromJson12(JSON.parse(formDataEntries["end"]))
930
- };
931
- }
932
- function toFormData($model) {
933
- const json = toJson13($model);
934
- const body = [
935
- { name: "start", type: "json", value: json["start"] },
936
- { name: "end", type: "json", value: json["end"] }
937
- ];
938
- return body;
939
- }
940
-
941
- // packages/client/query/src/lib/models/dql-node.transformation.ts
942
- function isDqlTerminalNode2($model) {
943
- return $model["nodeType"] === "TERMINAL";
944
- }
945
- function isDqlContainerNode2($model) {
946
- return $model["nodeType"] === "CONTAINER";
947
- }
948
- function isDqlAlternativeNode2($model) {
949
- return $model["nodeType"] === "ALTERNATIVE";
950
- }
951
- function isJson13(value) {
952
- if (value === null) {
953
- return false;
954
- }
955
- if (value === void 0) {
956
- return false;
957
- }
958
- if (Array.isArray(value)) {
959
- return false;
960
- }
961
- const modelKeys = /* @__PURE__ */ new Set(["nodeType", "tokenPosition", "isOptional"]);
962
- const hasAdditionalProperties = false;
963
- const requiredKeys = ["isOptional", "nodeType"];
964
- const optionalKeys = ["tokenPosition"];
965
- const valKeys = new Set(Object.keys(value));
966
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
967
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
968
- const allPropertiesMatchFormat = true;
969
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
970
- }
971
- function fromJson7($model, includeChildProps = true) {
972
- if (includeChildProps) {
973
- switch ($model.nodeType) {
974
- case "TERMINAL":
975
- return fromJson11($model);
976
- case "CONTAINER":
977
- return fromJson9($model);
978
- case "ALTERNATIVE":
979
- return fromJson8($model);
980
- default:
981
- return fromJson7($model, false);
114
+ // packages/client/query/src/lib/utils/transformations.ts
115
+ var defaultRuleConfig = {
116
+ force: false,
117
+ datetime: false
118
+ };
119
+ function mergeKeys(key1, key2) {
120
+ if (!key1)
121
+ return key2;
122
+ if (!key2)
123
+ return key1;
124
+ return `${key1}.${key2}`;
125
+ }
126
+ function matchKey(key, keys) {
127
+ const match = keys.find((k) => {
128
+ const ruleKey = Array.isArray(k) ? k[0] : k;
129
+ if (key === ruleKey) {
130
+ return true;
982
131
  }
983
- }
984
- const { nodeType, tokenPosition, isOptional } = $model;
985
- return {
986
- nodeType: fromJson10(nodeType),
987
- tokenPosition: tokenPosition !== void 0 && tokenPosition !== null ? fromJson13(tokenPosition) : void 0,
988
- isOptional
989
- };
990
- }
991
- function toJson7($model, includeChildProps = true) {
992
- if (includeChildProps) {
993
- switch ($model.nodeType) {
994
- case "TERMINAL":
995
- return toJson11($model);
996
- case "CONTAINER":
997
- return toJson9($model);
998
- case "ALTERNATIVE":
999
- return toJson8($model);
1000
- default:
1001
- return toJson7($model, false);
132
+ if (!key || !ruleKey) {
133
+ return false;
1002
134
  }
135
+ const [keyParts, ruleKeyParts] = [key.split("."), ruleKey.split(".")];
136
+ const [keyPartsReversed, ruleKeyPartsReversed] = [[...keyParts].reverse(), [...ruleKeyParts].reverse()];
137
+ let wildcard = false;
138
+ let matchResult = true;
139
+ keyParts.forEach((keyPart, idx) => {
140
+ if (keyPart !== ruleKeyParts[idx] && !wildcard) {
141
+ if (ruleKeyParts[idx] === "**") {
142
+ wildcard = true;
143
+ } else if (ruleKeyParts[idx] === "*") {
144
+ wildcard = true;
145
+ } else {
146
+ matchResult = false;
147
+ }
148
+ }
149
+ });
150
+ wildcard = false;
151
+ keyPartsReversed.forEach((keyPart, idx) => {
152
+ if (keyPart !== ruleKeyPartsReversed[idx] && !wildcard) {
153
+ if (ruleKeyPartsReversed[idx] === "**") {
154
+ wildcard = true;
155
+ } else if (ruleKeyPartsReversed[idx] === "*") {
156
+ wildcard = true;
157
+ } else {
158
+ matchResult = false;
159
+ }
160
+ }
161
+ });
162
+ return matchResult;
163
+ });
164
+ if (match) {
165
+ return Array.isArray(match) ? match : [match, defaultRuleConfig];
166
+ }
167
+ return null;
168
+ }
169
+ var dateTimePattern = /^((?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[+-]\d{2}:\d{2})?)$/i;
170
+ function isDateLike(value) {
171
+ if (typeof value === "string") {
172
+ return dateTimePattern.test(value);
173
+ }
174
+ return false;
175
+ }
176
+ function transformValue(value, rules, direction) {
177
+ const { force, datetime } = rules;
178
+ if (direction === "to") {
179
+ return force || isDateLike(value) ? new Date(value) : value;
180
+ }
181
+ if (value instanceof Date) {
182
+ const iso = value.toISOString();
183
+ return datetime ? iso : iso.split("T")[0];
184
+ }
185
+ return value;
186
+ }
187
+ function transform(direction, object, keys) {
188
+ function walk(obj, currentKey = "") {
189
+ if (Array.isArray(obj)) {
190
+ obj.forEach((item, idx) => {
191
+ const match = matchKey(currentKey, keys);
192
+ if (typeof item === "object" && item !== null) {
193
+ walk(item, currentKey);
194
+ } else if (match) {
195
+ obj[idx] = transformValue(obj[idx], match[1], direction);
196
+ }
197
+ });
198
+ }
199
+ if (typeof obj === "object" && obj !== null && !Array.isArray(obj)) {
200
+ for (const key of Object.keys(obj)) {
201
+ const mergedKey = mergeKeys(currentKey, key);
202
+ const match = matchKey(mergedKey, keys);
203
+ if (match) {
204
+ obj[key] = transformValue(obj[key], match[1], direction);
205
+ }
206
+ walk(obj[key], mergedKey);
207
+ }
208
+ }
209
+ return obj;
1003
210
  }
1004
- const { nodeType, tokenPosition, isOptional } = $model;
1005
- return {
1006
- nodeType: toJson10(nodeType),
1007
- tokenPosition: tokenPosition !== void 0 && tokenPosition !== null ? toJson13(tokenPosition) : void 0,
1008
- isOptional
1009
- };
1010
- }
1011
-
1012
- // packages/client/query/src/lib/models/error-envelope.transformation.ts
1013
- var error_envelope_transformation_exports = {};
1014
- __export(error_envelope_transformation_exports, {
1015
- fromFormData: () => fromFormData2,
1016
- fromJson: () => fromJson17,
1017
- isErrorEnvelope: () => isErrorEnvelope,
1018
- isJson: () => isJson17,
1019
- toFormData: () => toFormData2,
1020
- toJson: () => toJson17
1021
- });
1022
-
1023
- // packages/client/query/src/lib/models/error-response.transformation.ts
1024
- var error_response_transformation_exports = {};
1025
- __export(error_response_transformation_exports, {
1026
- fromJson: () => fromJson16,
1027
- isErrorResponse: () => isErrorResponse,
1028
- isJson: () => isJson16,
1029
- toJson: () => toJson16
1030
- });
1031
-
1032
- // packages/client/query/src/lib/models/error-response-details.transformation.ts
1033
- var error_response_details_transformation_exports = {};
1034
- __export(error_response_details_transformation_exports, {
1035
- fromJson: () => fromJson15,
1036
- isErrorResponseDetails: () => isErrorResponseDetails,
1037
- isJson: () => isJson15,
1038
- toJson: () => toJson15
1039
- });
1040
-
1041
- // packages/client/query/src/lib/models/error-response-details-constraint-violations-item.transformation.ts
1042
- var error_response_details_constraint_violations_item_transformation_exports = {};
1043
- __export(error_response_details_constraint_violations_item_transformation_exports, {
1044
- fromJson: () => fromJson14,
1045
- isErrorResponseDetailsConstraintViolationsItem: () => isErrorResponseDetailsConstraintViolationsItem,
1046
- isJson: () => isJson14,
1047
- toJson: () => toJson14
1048
- });
1049
- function isErrorResponseDetailsConstraintViolationsItem(value) {
1050
- if (value === null) {
1051
- return false;
1052
- }
1053
- if (value === void 0) {
1054
- return false;
1055
- }
1056
- if (Array.isArray(value)) {
1057
- return false;
1058
- }
1059
- const modelKeys = /* @__PURE__ */ new Set(["message", "parameterLocation", "parameterDescriptor"]);
1060
- const hasAdditionalProperties = false;
1061
- const requiredKeys = ["message"];
1062
- const optionalKeys = ["parameterLocation", "parameterDescriptor"];
1063
- const valKeys = new Set(Object.keys(value));
1064
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1065
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1066
- const allPropertiesMatchFormat = true;
1067
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1068
- }
1069
- function isJson14(value) {
1070
- if (value === null) {
1071
- return false;
1072
- }
1073
- if (value === void 0) {
1074
- return false;
1075
- }
1076
- if (Array.isArray(value)) {
1077
- return false;
1078
- }
1079
- const modelKeys = /* @__PURE__ */ new Set(["message", "parameterLocation", "parameterDescriptor"]);
1080
- const hasAdditionalProperties = false;
1081
- const requiredKeys = ["message"];
1082
- const optionalKeys = ["parameterLocation", "parameterDescriptor"];
1083
- const valKeys = new Set(Object.keys(value));
1084
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1085
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1086
- const allPropertiesMatchFormat = true;
1087
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1088
- }
1089
- function fromJson14($model) {
1090
- const { message, parameterLocation, parameterDescriptor } = $model;
1091
- return {
1092
- message,
1093
- parameterLocation,
1094
- parameterDescriptor
1095
- };
1096
- }
1097
- function toJson14($model) {
1098
- const { message, parameterLocation, parameterDescriptor } = $model;
1099
- return {
1100
- message,
1101
- parameterLocation,
1102
- parameterDescriptor
1103
- };
1104
- }
1105
-
1106
- // packages/client/query/src/lib/models/error-response-details.transformation.ts
1107
- function isErrorResponseDetails(value) {
1108
- if (value === null) {
1109
- return false;
1110
- }
1111
- if (value === void 0) {
1112
- return false;
1113
- }
1114
- if (Array.isArray(value)) {
1115
- return false;
1116
- }
1117
- const modelKeys = /* @__PURE__ */ new Set([
1118
- "exceptionType",
1119
- "syntaxErrorPosition",
1120
- "errorType",
1121
- "errorMessage",
1122
- "arguments",
1123
- "queryString",
1124
- "errorMessageFormatSpecifierTypes",
1125
- "errorMessageFormat",
1126
- "queryId",
1127
- "constraintViolations",
1128
- "missingScopes",
1129
- "missingPermissions"
1130
- ]);
1131
- const hasAdditionalProperties = false;
1132
- const requiredKeys = [];
1133
- const optionalKeys = [
1134
- "exceptionType",
1135
- "syntaxErrorPosition",
1136
- "errorType",
1137
- "errorMessage",
1138
- "arguments",
1139
- "queryString",
1140
- "errorMessageFormatSpecifierTypes",
1141
- "errorMessageFormat",
1142
- "queryId",
1143
- "constraintViolations",
1144
- "missingScopes",
1145
- "missingPermissions"
1146
- ];
1147
- const valKeys = new Set(Object.keys(value));
1148
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1149
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1150
- const allPropertiesMatchFormat = true;
1151
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1152
- }
1153
- function isJson15(value) {
1154
- if (value === null) {
1155
- return false;
1156
- }
1157
- if (value === void 0) {
1158
- return false;
1159
- }
1160
- if (Array.isArray(value)) {
1161
- return false;
1162
- }
1163
- const modelKeys = /* @__PURE__ */ new Set([
1164
- "exceptionType",
1165
- "syntaxErrorPosition",
1166
- "errorType",
1167
- "errorMessage",
1168
- "arguments",
1169
- "queryString",
1170
- "errorMessageFormatSpecifierTypes",
1171
- "errorMessageFormat",
1172
- "queryId",
1173
- "constraintViolations",
1174
- "missingScopes",
1175
- "missingPermissions"
1176
- ]);
1177
- const hasAdditionalProperties = false;
1178
- const requiredKeys = [];
1179
- const optionalKeys = [
1180
- "exceptionType",
1181
- "syntaxErrorPosition",
1182
- "errorType",
1183
- "errorMessage",
1184
- "arguments",
1185
- "queryString",
1186
- "errorMessageFormatSpecifierTypes",
1187
- "errorMessageFormat",
1188
- "queryId",
1189
- "constraintViolations",
1190
- "missingScopes",
1191
- "missingPermissions"
1192
- ];
1193
- const valKeys = new Set(Object.keys(value));
1194
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1195
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1196
- const allPropertiesMatchFormat = true;
1197
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1198
- }
1199
- function fromJson15($model) {
1200
- const {
1201
- exceptionType,
1202
- syntaxErrorPosition,
1203
- errorType,
1204
- errorMessage,
1205
- arguments: _arguments,
1206
- queryString,
1207
- errorMessageFormatSpecifierTypes,
1208
- errorMessageFormat,
1209
- queryId,
1210
- constraintViolations,
1211
- missingScopes,
1212
- missingPermissions
1213
- } = $model;
1214
- return {
1215
- exceptionType,
1216
- syntaxErrorPosition: syntaxErrorPosition !== void 0 && syntaxErrorPosition !== null ? fromJson13(syntaxErrorPosition) : void 0,
1217
- errorType,
1218
- errorMessage,
1219
- arguments: _arguments !== void 0 && _arguments !== null ? _arguments?.slice(0) : void 0,
1220
- queryString,
1221
- errorMessageFormatSpecifierTypes: errorMessageFormatSpecifierTypes !== void 0 && errorMessageFormatSpecifierTypes !== null ? errorMessageFormatSpecifierTypes?.slice(0) : void 0,
1222
- errorMessageFormat,
1223
- queryId,
1224
- constraintViolations: constraintViolations !== void 0 && constraintViolations !== null ? constraintViolations?.map(
1225
- (innerValue) => fromJson14(innerValue)
1226
- ) : void 0,
1227
- missingScopes: missingScopes !== void 0 && missingScopes !== null ? missingScopes?.slice(0) : void 0,
1228
- missingPermissions: missingPermissions !== void 0 && missingPermissions !== null ? missingPermissions?.slice(0) : void 0
1229
- };
1230
- }
1231
- function toJson15($model) {
1232
- const {
1233
- exceptionType,
1234
- syntaxErrorPosition,
1235
- errorType,
1236
- errorMessage,
1237
- arguments: _arguments,
1238
- queryString,
1239
- errorMessageFormatSpecifierTypes,
1240
- errorMessageFormat,
1241
- queryId,
1242
- constraintViolations,
1243
- missingScopes,
1244
- missingPermissions
1245
- } = $model;
1246
- return {
1247
- exceptionType,
1248
- syntaxErrorPosition: syntaxErrorPosition !== void 0 && syntaxErrorPosition !== null ? toJson13(syntaxErrorPosition) : void 0,
1249
- errorType,
1250
- errorMessage,
1251
- arguments: _arguments !== void 0 && _arguments !== null ? _arguments?.slice(0) : void 0,
1252
- queryString,
1253
- errorMessageFormatSpecifierTypes: errorMessageFormatSpecifierTypes !== void 0 && errorMessageFormatSpecifierTypes !== null ? errorMessageFormatSpecifierTypes?.slice(0) : void 0,
1254
- errorMessageFormat,
1255
- queryId,
1256
- constraintViolations: constraintViolations !== void 0 && constraintViolations !== null ? constraintViolations?.map(
1257
- (innerValue) => toJson14(innerValue)
1258
- ) : void 0,
1259
- missingScopes: missingScopes !== void 0 && missingScopes !== null ? missingScopes?.slice(0) : void 0,
1260
- missingPermissions: missingPermissions !== void 0 && missingPermissions !== null ? missingPermissions?.slice(0) : void 0
1261
- };
1262
- }
1263
-
1264
- // packages/client/query/src/lib/models/error-response.transformation.ts
1265
- function isErrorResponse(value) {
1266
- if (value === null) {
1267
- return false;
1268
- }
1269
- if (value === void 0) {
1270
- return false;
1271
- }
1272
- if (Array.isArray(value)) {
1273
- return false;
1274
- }
1275
- const modelKeys = /* @__PURE__ */ new Set(["message", "details", "code"]);
1276
- const hasAdditionalProperties = false;
1277
- const requiredKeys = ["code", "message"];
1278
- const optionalKeys = ["details"];
1279
- const valKeys = new Set(Object.keys(value));
1280
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1281
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1282
- const allPropertiesMatchFormat = true;
1283
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1284
- }
1285
- function isJson16(value) {
1286
- if (value === null) {
1287
- return false;
1288
- }
1289
- if (value === void 0) {
1290
- return false;
1291
- }
1292
- if (Array.isArray(value)) {
1293
- return false;
1294
- }
1295
- const modelKeys = /* @__PURE__ */ new Set(["message", "details", "code"]);
1296
- const hasAdditionalProperties = false;
1297
- const requiredKeys = ["code", "message"];
1298
- const optionalKeys = ["details"];
1299
- const valKeys = new Set(Object.keys(value));
1300
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1301
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1302
- const allPropertiesMatchFormat = true;
1303
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1304
- }
1305
- function fromJson16($model) {
1306
- const { message, details, code } = $model;
1307
- return {
1308
- message,
1309
- details: details !== void 0 && details !== null ? fromJson15(details) : void 0,
1310
- code
1311
- };
1312
- }
1313
- function toJson16($model) {
1314
- const { message, details, code } = $model;
1315
- return {
1316
- message,
1317
- details: details !== void 0 && details !== null ? toJson15(details) : void 0,
1318
- code
1319
- };
1320
- }
1321
-
1322
- // packages/client/query/src/lib/models/error-envelope.transformation.ts
1323
- function isErrorEnvelope(value) {
1324
- if (value === null) {
1325
- return false;
1326
- }
1327
- if (value === void 0) {
1328
- return false;
1329
- }
1330
- if (Array.isArray(value)) {
1331
- return false;
1332
- }
1333
- const modelKeys = /* @__PURE__ */ new Set(["error"]);
1334
- const hasAdditionalProperties = false;
1335
- const requiredKeys = ["error"];
1336
- const optionalKeys = [];
1337
- const valKeys = new Set(Object.keys(value));
1338
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1339
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1340
- const allPropertiesMatchFormat = true;
1341
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1342
- }
1343
- function isJson17(value) {
1344
- if (value === null) {
1345
- return false;
1346
- }
1347
- if (value === void 0) {
1348
- return false;
1349
- }
1350
- if (Array.isArray(value)) {
1351
- return false;
1352
- }
1353
- const modelKeys = /* @__PURE__ */ new Set(["error"]);
1354
- const hasAdditionalProperties = false;
1355
- const requiredKeys = ["error"];
1356
- const optionalKeys = [];
1357
- const valKeys = new Set(Object.keys(value));
1358
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1359
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1360
- const allPropertiesMatchFormat = true;
1361
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1362
- }
1363
- function fromJson17($model) {
1364
- const { error } = $model;
1365
- return {
1366
- error: fromJson16(error)
1367
- };
1368
- }
1369
- function toJson17($model) {
1370
- const { error } = $model;
1371
- return {
1372
- error: toJson16(error)
1373
- };
1374
- }
1375
- function fromFormData2(formData) {
1376
- const formDataEntries = Object.fromEntries(formData.map((data) => [data.name, data.value]));
1377
- return {
1378
- error: fromJson16(JSON.parse(formDataEntries["error"]))
1379
- };
1380
- }
1381
- function toFormData2($model) {
1382
- const json = toJson17($model);
1383
- const body = [{ name: "error", type: "json", value: json["error"] }];
1384
- return body;
1385
- }
1386
-
1387
- // packages/client/query/src/lib/models/parse-request.transformation.ts
1388
- var parse_request_transformation_exports = {};
1389
- __export(parse_request_transformation_exports, {
1390
- fromJson: () => fromJson18,
1391
- isJson: () => isJson18,
1392
- isParseRequest: () => isParseRequest,
1393
- toJson: () => toJson18
1394
- });
1395
- function isParseRequest(value) {
1396
- if (value === null) {
1397
- return false;
1398
- }
1399
- if (value === void 0) {
1400
- return false;
1401
- }
1402
- if (Array.isArray(value)) {
1403
- return false;
1404
- }
1405
- const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions"]);
1406
- const hasAdditionalProperties = false;
1407
- const requiredKeys = ["query"];
1408
- const optionalKeys = ["timezone", "locale", "queryOptions"];
1409
- const valKeys = new Set(Object.keys(value));
1410
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1411
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1412
- const allPropertiesMatchFormat = true;
1413
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1414
- }
1415
- function isJson18(value) {
1416
- if (value === null) {
1417
- return false;
1418
- }
1419
- if (value === void 0) {
1420
- return false;
1421
- }
1422
- if (Array.isArray(value)) {
1423
- return false;
1424
- }
1425
- const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions"]);
1426
- const hasAdditionalProperties = false;
1427
- const requiredKeys = ["query"];
1428
- const optionalKeys = ["timezone", "locale", "queryOptions"];
1429
- const valKeys = new Set(Object.keys(value));
1430
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1431
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1432
- const allPropertiesMatchFormat = true;
1433
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1434
- }
1435
- function fromJson18($model) {
1436
- const { query, timezone, locale, queryOptions } = $model;
1437
- return {
1438
- query,
1439
- timezone,
1440
- locale,
1441
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0
1442
- };
1443
- }
1444
- function toJson18($model) {
1445
- const { query, timezone, locale, queryOptions } = $model;
1446
- return {
1447
- query,
1448
- timezone,
1449
- locale,
1450
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0
1451
- };
1452
- }
1453
-
1454
- // packages/client/query/src/lib/models/verify-request.transformation.ts
1455
- var verify_request_transformation_exports = {};
1456
- __export(verify_request_transformation_exports, {
1457
- fromJson: () => fromJson19,
1458
- isJson: () => isJson19,
1459
- isVerifyRequest: () => isVerifyRequest,
1460
- toJson: () => toJson19
1461
- });
1462
- function isVerifyRequest(value) {
1463
- if (value === null) {
1464
- return false;
1465
- }
1466
- if (value === void 0) {
1467
- return false;
1468
- }
1469
- if (Array.isArray(value)) {
1470
- return false;
1471
- }
1472
- const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions", "generateCanonicalQuery"]);
1473
- const hasAdditionalProperties = false;
1474
- const requiredKeys = ["query"];
1475
- const optionalKeys = ["timezone", "locale", "queryOptions", "generateCanonicalQuery"];
1476
- const valKeys = new Set(Object.keys(value));
1477
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1478
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1479
- const allPropertiesMatchFormat = true;
1480
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1481
- }
1482
- function isJson19(value) {
1483
- if (value === null) {
1484
- return false;
1485
- }
1486
- if (value === void 0) {
1487
- return false;
1488
- }
1489
- if (Array.isArray(value)) {
1490
- return false;
1491
- }
1492
- const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions", "generateCanonicalQuery"]);
1493
- const hasAdditionalProperties = false;
1494
- const requiredKeys = ["query"];
1495
- const optionalKeys = ["timezone", "locale", "queryOptions", "generateCanonicalQuery"];
1496
- const valKeys = new Set(Object.keys(value));
1497
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1498
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1499
- const allPropertiesMatchFormat = true;
1500
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1501
- }
1502
- function fromJson19($model) {
1503
- const { query, timezone, locale, queryOptions, generateCanonicalQuery } = $model;
1504
- return {
1505
- query,
1506
- timezone,
1507
- locale,
1508
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0,
1509
- generateCanonicalQuery
1510
- };
1511
- }
1512
- function toJson19($model) {
1513
- const { query, timezone, locale, queryOptions, generateCanonicalQuery } = $model;
1514
- return {
1515
- query,
1516
- timezone,
1517
- locale,
1518
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0,
1519
- generateCanonicalQuery
1520
- };
1521
- }
1522
-
1523
- // packages/client/query/src/lib/models/verify-response.transformation.ts
1524
- var verify_response_transformation_exports = {};
1525
- __export(verify_response_transformation_exports, {
1526
- fromJson: () => fromJson21,
1527
- isJson: () => isJson21,
1528
- isVerifyResponse: () => isVerifyResponse,
1529
- toJson: () => toJson21
1530
- });
1531
-
1532
- // packages/client/query/src/lib/models/metadata-notification.transformation.ts
1533
- var metadata_notification_transformation_exports = {};
1534
- __export(metadata_notification_transformation_exports, {
1535
- fromJson: () => fromJson20,
1536
- isJson: () => isJson20,
1537
- isMetadataNotification: () => isMetadataNotification,
1538
- toJson: () => toJson20
1539
- });
1540
- function isMetadataNotification(value) {
1541
- if (value === null) {
1542
- return false;
1543
- }
1544
- if (value === void 0) {
1545
- return false;
1546
- }
1547
- if (Array.isArray(value)) {
1548
- return false;
1549
- }
1550
- const modelKeys = /* @__PURE__ */ new Set([
1551
- "severity",
1552
- "messageFormat",
1553
- "syntaxPosition",
1554
- "messageFormatSpecifierTypes",
1555
- "arguments",
1556
- "notificationType",
1557
- "message"
1558
- ]);
1559
- const hasAdditionalProperties = false;
1560
- const requiredKeys = [];
1561
- const optionalKeys = [
1562
- "severity",
1563
- "messageFormat",
1564
- "syntaxPosition",
1565
- "messageFormatSpecifierTypes",
1566
- "arguments",
1567
- "notificationType",
1568
- "message"
1569
- ];
1570
- const valKeys = new Set(Object.keys(value));
1571
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1572
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1573
- const allPropertiesMatchFormat = true;
1574
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1575
- }
1576
- function isJson20(value) {
1577
- if (value === null) {
1578
- return false;
1579
- }
1580
- if (value === void 0) {
1581
- return false;
1582
- }
1583
- if (Array.isArray(value)) {
1584
- return false;
1585
- }
1586
- const modelKeys = /* @__PURE__ */ new Set([
1587
- "severity",
1588
- "messageFormat",
1589
- "syntaxPosition",
1590
- "messageFormatSpecifierTypes",
1591
- "arguments",
1592
- "notificationType",
1593
- "message"
1594
- ]);
1595
- const hasAdditionalProperties = false;
1596
- const requiredKeys = [];
1597
- const optionalKeys = [
1598
- "severity",
1599
- "messageFormat",
1600
- "syntaxPosition",
1601
- "messageFormatSpecifierTypes",
1602
- "arguments",
1603
- "notificationType",
1604
- "message"
1605
- ];
1606
- const valKeys = new Set(Object.keys(value));
1607
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1608
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1609
- const allPropertiesMatchFormat = true;
1610
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1611
- }
1612
- function fromJson20($model) {
1613
- const {
1614
- severity,
1615
- messageFormat,
1616
- syntaxPosition,
1617
- messageFormatSpecifierTypes,
1618
- arguments: _arguments,
1619
- notificationType,
1620
- message
1621
- } = $model;
1622
- return {
1623
- severity,
1624
- messageFormat,
1625
- syntaxPosition: syntaxPosition !== void 0 && syntaxPosition !== null ? fromJson13(syntaxPosition) : void 0,
1626
- messageFormatSpecifierTypes: messageFormatSpecifierTypes !== void 0 && messageFormatSpecifierTypes !== null ? messageFormatSpecifierTypes?.slice(0) : void 0,
1627
- arguments: _arguments !== void 0 && _arguments !== null ? _arguments?.slice(0) : void 0,
1628
- notificationType,
1629
- message
1630
- };
1631
- }
1632
- function toJson20($model) {
1633
- const {
1634
- severity,
1635
- messageFormat,
1636
- syntaxPosition,
1637
- messageFormatSpecifierTypes,
1638
- arguments: _arguments,
1639
- notificationType,
1640
- message
1641
- } = $model;
1642
- return {
1643
- severity,
1644
- messageFormat,
1645
- syntaxPosition: syntaxPosition !== void 0 && syntaxPosition !== null ? toJson13(syntaxPosition) : void 0,
1646
- messageFormatSpecifierTypes: messageFormatSpecifierTypes !== void 0 && messageFormatSpecifierTypes !== null ? messageFormatSpecifierTypes?.slice(0) : void 0,
1647
- arguments: _arguments !== void 0 && _arguments !== null ? _arguments?.slice(0) : void 0,
1648
- notificationType,
1649
- message
1650
- };
1651
- }
1652
-
1653
- // packages/client/query/src/lib/models/verify-response.transformation.ts
1654
- function isVerifyResponse(value) {
1655
- if (value === null) {
1656
- return false;
1657
- }
1658
- if (value === void 0) {
1659
- return false;
1660
- }
1661
- if (Array.isArray(value)) {
1662
- return false;
1663
- }
1664
- const modelKeys = /* @__PURE__ */ new Set(["valid", "canonicalQuery", "notifications"]);
1665
- const hasAdditionalProperties = false;
1666
- const requiredKeys = ["valid"];
1667
- const optionalKeys = ["canonicalQuery", "notifications"];
1668
- const valKeys = new Set(Object.keys(value));
1669
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1670
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1671
- const allPropertiesMatchFormat = true;
1672
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1673
- }
1674
- function isJson21(value) {
1675
- if (value === null) {
1676
- return false;
1677
- }
1678
- if (value === void 0) {
1679
- return false;
1680
- }
1681
- if (Array.isArray(value)) {
1682
- return false;
1683
- }
1684
- const modelKeys = /* @__PURE__ */ new Set(["valid", "canonicalQuery", "notifications"]);
1685
- const hasAdditionalProperties = false;
1686
- const requiredKeys = ["valid"];
1687
- const optionalKeys = ["canonicalQuery", "notifications"];
1688
- const valKeys = new Set(Object.keys(value));
1689
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1690
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
1691
- const allPropertiesMatchFormat = true;
1692
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
211
+ return walk(object);
1693
212
  }
1694
- function fromJson21($model) {
1695
- const { valid, canonicalQuery, notifications } = $model;
1696
- return {
1697
- valid,
1698
- canonicalQuery,
1699
- notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => fromJson20(innerValue)) : void 0
1700
- };
213
+ function transformRequest(object, keys) {
214
+ return transform("from", object, keys);
1701
215
  }
1702
- function toJson21($model) {
1703
- const { valid, canonicalQuery, notifications } = $model;
1704
- return {
1705
- valid,
1706
- canonicalQuery,
1707
- notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => toJson20(innerValue)) : void 0
1708
- };
216
+ function transformResponse(object, keys) {
217
+ return transform("to", object, keys);
1709
218
  }
1710
219
 
1711
220
  // packages/client/query/src/lib/apis/query-assistance-api.ts
@@ -1718,7 +227,6 @@ var QueryAssistanceClient = class {
1718
227
  */
1719
228
  constructor(httpClientImplementation) {
1720
229
  this.httpClient = httpClientImplementation;
1721
- registerGlobalErrorSerializer(apiClientErrorSerializer);
1722
230
  }
1723
231
  /**
1724
232
  * Verifies a query without executing it.
@@ -1749,9 +257,9 @@ var QueryAssistanceClient = class {
1749
257
  */
1750
258
  async queryVerify(config) {
1751
259
  if (!config) {
1752
- throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
260
+ throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
1753
261
  }
1754
- const encodedBody = toJson19(config.body);
262
+ const encodedBody = transformRequest(config.body, []);
1755
263
  try {
1756
264
  const response = await this.httpClient.send({
1757
265
  url: `/platform/storage/query/v1/query:verify`,
@@ -1769,9 +277,9 @@ var QueryAssistanceClient = class {
1769
277
  });
1770
278
  const responseValue = await response.body("json");
1771
279
  try {
1772
- return fromJson21(responseValue);
280
+ return transformResponse(responseValue, []);
1773
281
  } catch (err) {
1774
- throw new import_shared_errors4.InvalidResponseError(
282
+ throw new import_shared_errors3.InvalidResponseError(
1775
283
  `QueryAssistanceClient.query:verify:200`,
1776
284
  err,
1777
285
  responseValue,
@@ -1781,19 +289,19 @@ var QueryAssistanceClient = class {
1781
289
  );
1782
290
  }
1783
291
  } catch (e) {
1784
- if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) {
292
+ if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors3.isInvalidResponseError)(e)) {
1785
293
  throw e;
1786
294
  }
1787
295
  if (!(0, import_http_client.isHttpClientResponseError)(e)) {
1788
- throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e);
296
+ throw new import_shared_errors3.ApiClientError("UnexpectedError", "Unexpected error", e);
1789
297
  }
1790
298
  const response = e.response;
1791
- apiGatewayErrorsHandler(response);
299
+ await apiGatewayErrorsHandler(response);
1792
300
  switch (response.status) {
1793
301
  case 400: {
1794
302
  const responseValue = await response.body("json");
1795
303
  try {
1796
- const errorBody = fromJson17(responseValue);
304
+ const errorBody = transformResponse(responseValue, []);
1797
305
  throw new ErrorEnvelopeError(
1798
306
  `400`,
1799
307
  response,
@@ -1805,7 +313,7 @@ var QueryAssistanceClient = class {
1805
313
  if (err instanceof ErrorEnvelopeError) {
1806
314
  throw err;
1807
315
  }
1808
- throw new import_shared_errors4.InvalidResponseError(
316
+ throw new import_shared_errors3.InvalidResponseError(
1809
317
  `QueryAssistanceClient.query:verify:400`,
1810
318
  err,
1811
319
  responseValue,
@@ -1818,7 +326,7 @@ var QueryAssistanceClient = class {
1818
326
  case 500: {
1819
327
  const responseValue = await response.body("json");
1820
328
  try {
1821
- const errorBody = fromJson17(responseValue);
329
+ const errorBody = transformResponse(responseValue, []);
1822
330
  throw new ErrorEnvelopeError(
1823
331
  `500`,
1824
332
  response,
@@ -1830,7 +338,7 @@ var QueryAssistanceClient = class {
1830
338
  if (err instanceof ErrorEnvelopeError) {
1831
339
  throw err;
1832
340
  }
1833
- throw new import_shared_errors4.InvalidResponseError(
341
+ throw new import_shared_errors3.InvalidResponseError(
1834
342
  `QueryAssistanceClient.query:verify:500`,
1835
343
  err,
1836
344
  responseValue,
@@ -1843,7 +351,7 @@ var QueryAssistanceClient = class {
1843
351
  default: {
1844
352
  try {
1845
353
  const responseValue = await response.body("json");
1846
- throw new import_shared_errors4.ClientRequestError(
354
+ throw new import_shared_errors3.ClientRequestError(
1847
355
  `${response.status}`,
1848
356
  response,
1849
357
  responseValue,
@@ -1854,11 +362,11 @@ var QueryAssistanceClient = class {
1854
362
  e
1855
363
  );
1856
364
  } catch (error) {
1857
- if (error instanceof import_shared_errors4.ClientRequestError) {
365
+ if (error instanceof import_shared_errors3.ClientRequestError) {
1858
366
  throw error;
1859
367
  }
1860
368
  const responseValue = await response.body("text").catch(() => "");
1861
- throw new import_shared_errors4.InvalidResponseError(
369
+ throw new import_shared_errors3.InvalidResponseError(
1862
370
  `${response.status}`,
1863
371
  error,
1864
372
  responseValue,
@@ -2085,9 +593,9 @@ var QueryAssistanceClient = class {
2085
593
  */
2086
594
  async queryParse(config) {
2087
595
  if (!config) {
2088
- throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
596
+ throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
2089
597
  }
2090
- const encodedBody = toJson18(config.body);
598
+ const encodedBody = transformRequest(config.body, []);
2091
599
  try {
2092
600
  const response = await this.httpClient.send({
2093
601
  url: `/platform/storage/query/v1/query:parse`,
@@ -2105,193 +613,10 @@ var QueryAssistanceClient = class {
2105
613
  });
2106
614
  const responseValue = await response.body("json");
2107
615
  try {
2108
- return fromJson7(responseValue);
2109
- } catch (err) {
2110
- throw new import_shared_errors4.InvalidResponseError(
2111
- `QueryAssistanceClient.query:parse:200`,
2112
- err,
2113
- responseValue,
2114
- void 0,
2115
- void 0,
2116
- response
2117
- );
2118
- }
2119
- } catch (e) {
2120
- if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) {
2121
- throw e;
2122
- }
2123
- if (!(0, import_http_client.isHttpClientResponseError)(e)) {
2124
- throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e);
2125
- }
2126
- const response = e.response;
2127
- apiGatewayErrorsHandler(response);
2128
- switch (response.status) {
2129
- case 400: {
2130
- const responseValue = await response.body("json");
2131
- try {
2132
- const errorBody = fromJson17(responseValue);
2133
- throw new ErrorEnvelopeError(
2134
- `400`,
2135
- response,
2136
- errorBody,
2137
- getErrorMessage(
2138
- errorBody,
2139
- "The supplied request is wrong. Either the query itself or other parameters are wrong."
2140
- ),
2141
- e
2142
- );
2143
- } catch (err) {
2144
- if (err instanceof ErrorEnvelopeError) {
2145
- throw err;
2146
- }
2147
- throw new import_shared_errors4.InvalidResponseError(
2148
- `QueryAssistanceClient.query:parse:400`,
2149
- err,
2150
- responseValue,
2151
- "ErrorEnvelope",
2152
- void 0,
2153
- response
2154
- );
2155
- }
2156
- }
2157
- case 500: {
2158
- const responseValue = await response.body("json");
2159
- try {
2160
- const errorBody = fromJson17(responseValue);
2161
- throw new ErrorEnvelopeError(
2162
- `500`,
2163
- response,
2164
- errorBody,
2165
- getErrorMessage(errorBody, "An internal server error has occurred."),
2166
- e
2167
- );
2168
- } catch (err) {
2169
- if (err instanceof ErrorEnvelopeError) {
2170
- throw err;
2171
- }
2172
- throw new import_shared_errors4.InvalidResponseError(
2173
- `QueryAssistanceClient.query:parse:500`,
2174
- err,
2175
- responseValue,
2176
- "ErrorEnvelope",
2177
- void 0,
2178
- response
2179
- );
2180
- }
2181
- }
2182
- default: {
2183
- try {
2184
- const responseValue = await response.body("json");
2185
- throw new import_shared_errors4.ClientRequestError(
2186
- `${response.status}`,
2187
- response,
2188
- responseValue,
2189
- getErrorMessage(
2190
- responseValue,
2191
- `Unexpected api response: code=${response.status} body="${responseValue}"`
2192
- ),
2193
- e
2194
- );
2195
- } catch (error) {
2196
- if (error instanceof import_shared_errors4.ClientRequestError) {
2197
- throw error;
2198
- }
2199
- const responseValue = await response.body("text").catch(() => "");
2200
- throw new import_shared_errors4.InvalidResponseError(
2201
- `${response.status}`,
2202
- error,
2203
- responseValue,
2204
- "json",
2205
- "Unexpected api response",
2206
- response
2207
- );
2208
- }
2209
- }
2210
- }
2211
- }
2212
- }
2213
- /**
2214
- * Get a structured list of suggestions for the query at the given position.
2215
- *
2216
- * For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
2217
- *
2218
- * ## Overview
2219
- *
2220
- * We provide a list of suggestions that may be used after the cursor position. The following queries will all provide the
2221
- * same results:
2222
- *
2223
- * * `query: "f"`
2224
- * * `query: "f", cursorPosition:1`
2225
- * * `query: "fetch ", cursorPosition:1`
2226
- *
2227
- * Available fields:
2228
- *
2229
- * | Field | Description |
2230
- * |-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2231
- * | suggestions | a list of suggestions. Each item is a separate possible suggestion, despite they might have the same outputs. |
2232
- * | optional | whether the suggestion is optional. If `true`, the query until the cursor position might work. If `false`, the query is definitely incomplete or invalid if cut at the cursor position. |
2233
- *
2234
- * Fields in the `suggestions`
2235
- *
2236
- * | Field | Description |
2237
- * |------------------------|------------------------------------------------------------------------------------------------------------|
2238
- * | suggestion | a string representing the whole suggestion. This information could also be derived from the parts. |
2239
- * | alreadyTypedCharacters | how many characters of this suggestion have already been typed (and will be overridden by the suggestion). |
2240
- * | parts | a list of semantically enriched information on what are the parts of a suggestion. |
2241
- *
2242
- * Fields in `parts`
2243
- *
2244
- * | Field | Description |
2245
- * |------------|-----------------------------------------------------------|
2246
- * | suggestion | a string representing the current part of the suggestion. |
2247
- * | type | current types: SPACE, PIPE, COMMAND (may be extended) |
2248
- *
2249
- * The `type` helps to treat specific parts of the suggestion different to others; either by a different visualization,
2250
- * a link to docs, etc.
2251
- *
2252
- * @returns {Promise<AutocompleteResponse>} A list of structured autocomplete suggestions.
2253
- *
2254
- * @example <caption>Code example</caption>
2255
- * import { queryAssistanceClient } from "@dynatrace-sdk/client-query";
2256
- *
2257
- * const data = await queryAssistanceClient.queryAutocomplete({
2258
- * body: {
2259
- * query:
2260
- * 'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
2261
- * },
2262
- * });
2263
- *
2264
- * @throws {ErrorEnvelopeError} The supplied request is wrong. Either the query itself or other parameters are wrong. | An internal server error has occurred.
2265
- * @throws {InvalidResponseError}
2266
- * @throws {ApiClientError}
2267
- * @throws {ClientRequestError}
2268
- */
2269
- async queryAutocomplete(config) {
2270
- if (!config) {
2271
- throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
2272
- }
2273
- const encodedBody = toJson2(config.body);
2274
- try {
2275
- const response = await this.httpClient.send({
2276
- url: `/platform/storage/query/v1/query:autocomplete`,
2277
- method: "POST",
2278
- requestBodyType: "json",
2279
- body: encodedBody,
2280
- headers: {
2281
- "Content-Type": "application/json",
2282
- Accept: "application/json"
2283
- },
2284
- abortSignal: config instanceof EventTarget ? config : config.abortSignal,
2285
- statusValidator: (status) => {
2286
- return [200].includes(status);
2287
- }
2288
- });
2289
- const responseValue = await response.body("json");
2290
- try {
2291
- return fromJson6(responseValue);
2292
- } catch (err) {
2293
- throw new import_shared_errors4.InvalidResponseError(
2294
- `QueryAssistanceClient.query:autocomplete:200`,
616
+ return transformResponse(responseValue, []);
617
+ } catch (err) {
618
+ throw new import_shared_errors3.InvalidResponseError(
619
+ `QueryAssistanceClient.query:parse:200`,
2295
620
  err,
2296
621
  responseValue,
2297
622
  void 0,
@@ -2300,19 +625,19 @@ var QueryAssistanceClient = class {
2300
625
  );
2301
626
  }
2302
627
  } catch (e) {
2303
- if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) {
628
+ if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors3.isInvalidResponseError)(e)) {
2304
629
  throw e;
2305
630
  }
2306
631
  if (!(0, import_http_client.isHttpClientResponseError)(e)) {
2307
- throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e);
632
+ throw new import_shared_errors3.ApiClientError("UnexpectedError", "Unexpected error", e);
2308
633
  }
2309
634
  const response = e.response;
2310
- apiGatewayErrorsHandler(response);
635
+ await apiGatewayErrorsHandler(response);
2311
636
  switch (response.status) {
2312
637
  case 400: {
2313
638
  const responseValue = await response.body("json");
2314
639
  try {
2315
- const errorBody = fromJson17(responseValue);
640
+ const errorBody = transformResponse(responseValue, []);
2316
641
  throw new ErrorEnvelopeError(
2317
642
  `400`,
2318
643
  response,
@@ -2327,8 +652,8 @@ var QueryAssistanceClient = class {
2327
652
  if (err instanceof ErrorEnvelopeError) {
2328
653
  throw err;
2329
654
  }
2330
- throw new import_shared_errors4.InvalidResponseError(
2331
- `QueryAssistanceClient.query:autocomplete:400`,
655
+ throw new import_shared_errors3.InvalidResponseError(
656
+ `QueryAssistanceClient.query:parse:400`,
2332
657
  err,
2333
658
  responseValue,
2334
659
  "ErrorEnvelope",
@@ -2340,7 +665,7 @@ var QueryAssistanceClient = class {
2340
665
  case 500: {
2341
666
  const responseValue = await response.body("json");
2342
667
  try {
2343
- const errorBody = fromJson17(responseValue);
668
+ const errorBody = transformResponse(responseValue, []);
2344
669
  throw new ErrorEnvelopeError(
2345
670
  `500`,
2346
671
  response,
@@ -2352,8 +677,8 @@ var QueryAssistanceClient = class {
2352
677
  if (err instanceof ErrorEnvelopeError) {
2353
678
  throw err;
2354
679
  }
2355
- throw new import_shared_errors4.InvalidResponseError(
2356
- `QueryAssistanceClient.query:autocomplete:500`,
680
+ throw new import_shared_errors3.InvalidResponseError(
681
+ `QueryAssistanceClient.query:parse:500`,
2357
682
  err,
2358
683
  responseValue,
2359
684
  "ErrorEnvelope",
@@ -2365,7 +690,7 @@ var QueryAssistanceClient = class {
2365
690
  default: {
2366
691
  try {
2367
692
  const responseValue = await response.body("json");
2368
- throw new import_shared_errors4.ClientRequestError(
693
+ throw new import_shared_errors3.ClientRequestError(
2369
694
  `${response.status}`,
2370
695
  response,
2371
696
  responseValue,
@@ -2375,1491 +700,221 @@ var QueryAssistanceClient = class {
2375
700
  ),
2376
701
  e
2377
702
  );
2378
- } catch (error) {
2379
- if (error instanceof import_shared_errors4.ClientRequestError) {
2380
- throw error;
2381
- }
2382
- const responseValue = await response.body("text").catch(() => "");
2383
- throw new import_shared_errors4.InvalidResponseError(
2384
- `${response.status}`,
2385
- error,
2386
- responseValue,
2387
- "json",
2388
- "Unexpected api response",
2389
- response
2390
- );
2391
- }
2392
- }
2393
- }
2394
- }
2395
- }
2396
- };
2397
- var queryAssistanceClient = /* @__PURE__ */ new QueryAssistanceClient(import_http_client.httpClient);
2398
-
2399
- // packages/client/query/src/lib/apis/query-execution-api.ts
2400
- var import_http_client2 = require("@dynatrace-sdk/http-client");
2401
- var import_shared_errors5 = require("@dynatrace-sdk/shared-errors");
2402
-
2403
- // packages/client/query/src/lib/error-envelopes/responses/insufficient-permission.ts
2404
- var InsufficientPermission = class extends ErrorEnvelopeError {
2405
- isInsufficientPermission = true;
2406
- name = "InsufficientPermission";
2407
- };
2408
- function isInsufficientPermission(e) {
2409
- return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorEnvelopeError === true && e?.isInsufficientPermission === true && e instanceof Error;
2410
- }
2411
-
2412
- // packages/client/query/src/lib/models/execute-request.transformation.ts
2413
- var execute_request_transformation_exports = {};
2414
- __export(execute_request_transformation_exports, {
2415
- fromJson: () => fromJson25,
2416
- isExecuteRequest: () => isExecuteRequest,
2417
- isJson: () => isJson24,
2418
- toJson: () => toJson25
2419
- });
2420
-
2421
- // packages/client/query/src/lib/models/filter-segments.transformation.ts
2422
- var filter_segments_transformation_exports = {};
2423
- __export(filter_segments_transformation_exports, {
2424
- fromJson: () => fromJson24,
2425
- toJson: () => toJson24
2426
- });
2427
-
2428
- // packages/client/query/src/lib/models/filter-segment.transformation.ts
2429
- var filter_segment_transformation_exports = {};
2430
- __export(filter_segment_transformation_exports, {
2431
- fromJson: () => fromJson23,
2432
- isFilterSegment: () => isFilterSegment,
2433
- isJson: () => isJson23,
2434
- toJson: () => toJson23
2435
- });
2436
-
2437
- // packages/client/query/src/lib/models/filter-segment-variable-definition.transformation.ts
2438
- var filter_segment_variable_definition_transformation_exports = {};
2439
- __export(filter_segment_variable_definition_transformation_exports, {
2440
- fromJson: () => fromJson22,
2441
- isFilterSegmentVariableDefinition: () => isFilterSegmentVariableDefinition,
2442
- isJson: () => isJson22,
2443
- toJson: () => toJson22
2444
- });
2445
- function isFilterSegmentVariableDefinition(value) {
2446
- if (value === null) {
2447
- return false;
2448
- }
2449
- if (value === void 0) {
2450
- return false;
2451
- }
2452
- if (Array.isArray(value)) {
2453
- return false;
2454
- }
2455
- const modelKeys = /* @__PURE__ */ new Set(["name", "values"]);
2456
- const hasAdditionalProperties = false;
2457
- const requiredKeys = ["name", "values"];
2458
- const optionalKeys = [];
2459
- const valKeys = new Set(Object.keys(value));
2460
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2461
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2462
- const allPropertiesMatchFormat = true;
2463
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2464
- }
2465
- function isJson22(value) {
2466
- if (value === null) {
2467
- return false;
2468
- }
2469
- if (value === void 0) {
2470
- return false;
2471
- }
2472
- if (Array.isArray(value)) {
2473
- return false;
2474
- }
2475
- const modelKeys = /* @__PURE__ */ new Set(["name", "values"]);
2476
- const hasAdditionalProperties = false;
2477
- const requiredKeys = ["name", "values"];
2478
- const optionalKeys = [];
2479
- const valKeys = new Set(Object.keys(value));
2480
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2481
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2482
- const allPropertiesMatchFormat = true;
2483
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2484
- }
2485
- function fromJson22($model) {
2486
- const { name: _name, values } = $model;
2487
- return {
2488
- name: _name,
2489
- values: values?.slice(0)
2490
- };
2491
- }
2492
- function toJson22($model) {
2493
- const { name: _name, values } = $model;
2494
- return {
2495
- name: _name,
2496
- values: values?.slice(0)
2497
- };
2498
- }
2499
-
2500
- // packages/client/query/src/lib/models/filter-segment.transformation.ts
2501
- function isFilterSegment(value) {
2502
- if (value === null) {
2503
- return false;
2504
- }
2505
- if (value === void 0) {
2506
- return false;
2507
- }
2508
- if (Array.isArray(value)) {
2509
- return false;
2510
- }
2511
- const modelKeys = /* @__PURE__ */ new Set(["id", "variables"]);
2512
- const hasAdditionalProperties = false;
2513
- const requiredKeys = ["id"];
2514
- const optionalKeys = ["variables"];
2515
- const valKeys = new Set(Object.keys(value));
2516
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2517
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2518
- const allPropertiesMatchFormat = true;
2519
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2520
- }
2521
- function isJson23(value) {
2522
- if (value === null) {
2523
- return false;
2524
- }
2525
- if (value === void 0) {
2526
- return false;
2527
- }
2528
- if (Array.isArray(value)) {
2529
- return false;
2530
- }
2531
- const modelKeys = /* @__PURE__ */ new Set(["id", "variables"]);
2532
- const hasAdditionalProperties = false;
2533
- const requiredKeys = ["id"];
2534
- const optionalKeys = ["variables"];
2535
- const valKeys = new Set(Object.keys(value));
2536
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2537
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2538
- const allPropertiesMatchFormat = true;
2539
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2540
- }
2541
- function fromJson23($model) {
2542
- const { id, variables } = $model;
2543
- return {
2544
- id,
2545
- variables: variables !== void 0 && variables !== null ? variables?.map((innerValue) => fromJson22(innerValue)) : void 0
2546
- };
2547
- }
2548
- function toJson23($model) {
2549
- const { id, variables } = $model;
2550
- return {
2551
- id,
2552
- variables: variables !== void 0 && variables !== null ? variables?.map((innerValue) => toJson22(innerValue)) : void 0
2553
- };
2554
- }
2555
-
2556
- // packages/client/query/src/lib/models/filter-segments.transformation.ts
2557
- function fromJson24($model) {
2558
- return [...$model.map((innerValue) => fromJson23(innerValue))];
2559
- }
2560
- function toJson24($model) {
2561
- return [...$model.map((innerValue) => toJson23(innerValue))];
2562
- }
2563
-
2564
- // packages/client/query/src/lib/models/execute-request.transformation.ts
2565
- function isExecuteRequest(value) {
2566
- if (value === null) {
2567
- return false;
2568
- }
2569
- if (value === void 0) {
2570
- return false;
2571
- }
2572
- if (Array.isArray(value)) {
2573
- return false;
2574
- }
2575
- const modelKeys = /* @__PURE__ */ new Set([
2576
- "query",
2577
- "defaultTimeframeStart",
2578
- "defaultTimeframeEnd",
2579
- "timezone",
2580
- "locale",
2581
- "maxResultRecords",
2582
- "maxResultBytes",
2583
- "fetchTimeoutSeconds",
2584
- "requestTimeoutMilliseconds",
2585
- "enablePreview",
2586
- "defaultSamplingRatio",
2587
- "defaultScanLimitGbytes",
2588
- "queryOptions",
2589
- "filterSegments"
2590
- ]);
2591
- const hasAdditionalProperties = false;
2592
- const requiredKeys = ["query"];
2593
- const optionalKeys = [
2594
- "defaultTimeframeStart",
2595
- "defaultTimeframeEnd",
2596
- "timezone",
2597
- "locale",
2598
- "maxResultRecords",
2599
- "maxResultBytes",
2600
- "fetchTimeoutSeconds",
2601
- "requestTimeoutMilliseconds",
2602
- "enablePreview",
2603
- "defaultSamplingRatio",
2604
- "defaultScanLimitGbytes",
2605
- "queryOptions",
2606
- "filterSegments"
2607
- ];
2608
- const valKeys = new Set(Object.keys(value));
2609
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2610
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2611
- const allPropertiesMatchFormat = true;
2612
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2613
- }
2614
- function isJson24(value) {
2615
- if (value === null) {
2616
- return false;
2617
- }
2618
- if (value === void 0) {
2619
- return false;
2620
- }
2621
- if (Array.isArray(value)) {
2622
- return false;
2623
- }
2624
- const modelKeys = /* @__PURE__ */ new Set([
2625
- "query",
2626
- "defaultTimeframeStart",
2627
- "defaultTimeframeEnd",
2628
- "timezone",
2629
- "locale",
2630
- "maxResultRecords",
2631
- "maxResultBytes",
2632
- "fetchTimeoutSeconds",
2633
- "requestTimeoutMilliseconds",
2634
- "enablePreview",
2635
- "defaultSamplingRatio",
2636
- "defaultScanLimitGbytes",
2637
- "queryOptions",
2638
- "filterSegments"
2639
- ]);
2640
- const hasAdditionalProperties = false;
2641
- const requiredKeys = ["query"];
2642
- const optionalKeys = [
2643
- "defaultTimeframeStart",
2644
- "defaultTimeframeEnd",
2645
- "timezone",
2646
- "locale",
2647
- "maxResultRecords",
2648
- "maxResultBytes",
2649
- "fetchTimeoutSeconds",
2650
- "requestTimeoutMilliseconds",
2651
- "enablePreview",
2652
- "defaultSamplingRatio",
2653
- "defaultScanLimitGbytes",
2654
- "queryOptions",
2655
- "filterSegments"
2656
- ];
2657
- const valKeys = new Set(Object.keys(value));
2658
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2659
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2660
- const allPropertiesMatchFormat = true;
2661
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2662
- }
2663
- function fromJson25($model) {
2664
- const {
2665
- query,
2666
- defaultTimeframeStart,
2667
- defaultTimeframeEnd,
2668
- timezone,
2669
- locale,
2670
- maxResultRecords,
2671
- maxResultBytes,
2672
- fetchTimeoutSeconds,
2673
- requestTimeoutMilliseconds,
2674
- enablePreview,
2675
- defaultSamplingRatio,
2676
- defaultScanLimitGbytes,
2677
- queryOptions,
2678
- filterSegments
2679
- } = $model;
2680
- return {
2681
- query,
2682
- defaultTimeframeStart,
2683
- defaultTimeframeEnd,
2684
- timezone,
2685
- locale,
2686
- maxResultRecords,
2687
- maxResultBytes,
2688
- fetchTimeoutSeconds,
2689
- requestTimeoutMilliseconds,
2690
- enablePreview,
2691
- defaultSamplingRatio,
2692
- defaultScanLimitGbytes,
2693
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0,
2694
- filterSegments: filterSegments !== void 0 && filterSegments !== null ? fromJson24(filterSegments) : void 0
2695
- };
2696
- }
2697
- function toJson25($model) {
2698
- const {
2699
- query,
2700
- defaultTimeframeStart,
2701
- defaultTimeframeEnd,
2702
- timezone,
2703
- locale,
2704
- maxResultRecords,
2705
- maxResultBytes,
2706
- fetchTimeoutSeconds,
2707
- requestTimeoutMilliseconds,
2708
- enablePreview,
2709
- defaultSamplingRatio,
2710
- defaultScanLimitGbytes,
2711
- queryOptions,
2712
- filterSegments
2713
- } = $model;
2714
- return {
2715
- query,
2716
- defaultTimeframeStart,
2717
- defaultTimeframeEnd,
2718
- timezone,
2719
- locale,
2720
- maxResultRecords,
2721
- maxResultBytes,
2722
- fetchTimeoutSeconds,
2723
- requestTimeoutMilliseconds,
2724
- enablePreview,
2725
- defaultSamplingRatio,
2726
- defaultScanLimitGbytes,
2727
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0,
2728
- filterSegments: filterSegments !== void 0 && filterSegments !== null ? toJson24(filterSegments) : void 0
2729
- };
2730
- }
2731
-
2732
- // packages/client/query/src/lib/models/query-poll-response.transformation.ts
2733
- var query_poll_response_transformation_exports = {};
2734
- __export(query_poll_response_transformation_exports, {
2735
- fromJson: () => fromJson39,
2736
- isJson: () => isJson38,
2737
- isQueryPollResponse: () => isQueryPollResponse,
2738
- toJson: () => toJson39
2739
- });
2740
-
2741
- // packages/client/query/src/lib/models/query-result.transformation.ts
2742
- var query_result_transformation_exports = {};
2743
- __export(query_result_transformation_exports, {
2744
- fromJson: () => fromJson37,
2745
- isJson: () => isJson36,
2746
- isQueryResult: () => isQueryResult,
2747
- toJson: () => toJson37
2748
- });
2749
-
2750
- // packages/client/query/src/lib/models/metadata.transformation.ts
2751
- var metadata_transformation_exports = {};
2752
- __export(metadata_transformation_exports, {
2753
- fromJson: () => fromJson29,
2754
- isJson: () => isJson28,
2755
- isMetadata: () => isMetadata,
2756
- toJson: () => toJson29
2757
- });
2758
-
2759
- // packages/client/query/src/lib/models/grail-metadata.transformation.ts
2760
- var grail_metadata_transformation_exports = {};
2761
- __export(grail_metadata_transformation_exports, {
2762
- fromJson: () => fromJson27,
2763
- isGrailMetadata: () => isGrailMetadata,
2764
- isJson: () => isJson26,
2765
- toJson: () => toJson27
2766
- });
2767
-
2768
- // packages/client/query/src/lib/models/timeframe.transformation.ts
2769
- var timeframe_transformation_exports = {};
2770
- __export(timeframe_transformation_exports, {
2771
- fromJson: () => fromJson26,
2772
- isJson: () => isJson25,
2773
- isTimeframe: () => isTimeframe,
2774
- toJson: () => toJson26
2775
- });
2776
- function isTimeframe(value) {
2777
- if (value === null) {
2778
- return false;
2779
- }
2780
- if (value === void 0) {
2781
- return false;
2782
- }
2783
- if (Array.isArray(value)) {
2784
- return false;
2785
- }
2786
- const modelKeys = /* @__PURE__ */ new Set(["start", "end"]);
2787
- const hasAdditionalProperties = false;
2788
- const requiredKeys = [];
2789
- const optionalKeys = ["start", "end"];
2790
- const valKeys = new Set(Object.keys(value));
2791
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2792
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2793
- const allPropertiesMatchFormat = value.start instanceof Date && value.end instanceof Date;
2794
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2795
- }
2796
- function isJson25(value) {
2797
- if (value === null) {
2798
- return false;
2799
- }
2800
- if (value === void 0) {
2801
- return false;
2802
- }
2803
- if (Array.isArray(value)) {
2804
- return false;
2805
- }
2806
- const modelKeys = /* @__PURE__ */ new Set(["start", "end"]);
2807
- const hasAdditionalProperties = false;
2808
- const requiredKeys = [];
2809
- const optionalKeys = ["start", "end"];
2810
- const valKeys = new Set(Object.keys(value));
2811
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2812
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2813
- const allPropertiesMatchFormat = /^((?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[+-]\d{2}:\d{2})?)$/i.test(value.start) && /^((?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[+-]\d{2}:\d{2})?)$/i.test(value.end);
2814
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2815
- }
2816
- function fromJson26($model) {
2817
- const { start, end } = $model;
2818
- return {
2819
- start: start !== void 0 && start !== null ? new Date(start) : void 0,
2820
- end: end !== void 0 && end !== null ? new Date(end) : void 0
2821
- };
2822
- }
2823
- function toJson26($model) {
2824
- const { start, end } = $model;
2825
- return {
2826
- start: start !== void 0 && start !== null ? start.toISOString() : void 0,
2827
- end: end !== void 0 && end !== null ? end.toISOString() : void 0
2828
- };
2829
- }
2830
-
2831
- // packages/client/query/src/lib/models/grail-metadata.transformation.ts
2832
- function isGrailMetadata(value) {
2833
- if (value === null) {
2834
- return false;
2835
- }
2836
- if (value === void 0) {
2837
- return false;
2838
- }
2839
- if (Array.isArray(value)) {
2840
- return false;
2841
- }
2842
- const modelKeys = /* @__PURE__ */ new Set([
2843
- "canonicalQuery",
2844
- "timezone",
2845
- "query",
2846
- "scannedRecords",
2847
- "dqlVersion",
2848
- "scannedBytes",
2849
- "scannedDataPoints",
2850
- "analysisTimeframe",
2851
- "locale",
2852
- "executionTimeMilliseconds",
2853
- "notifications",
2854
- "queryId",
2855
- "sampled"
2856
- ]);
2857
- const hasAdditionalProperties = false;
2858
- const requiredKeys = [];
2859
- const optionalKeys = [
2860
- "canonicalQuery",
2861
- "timezone",
2862
- "query",
2863
- "scannedRecords",
2864
- "dqlVersion",
2865
- "scannedBytes",
2866
- "scannedDataPoints",
2867
- "analysisTimeframe",
2868
- "locale",
2869
- "executionTimeMilliseconds",
2870
- "notifications",
2871
- "queryId",
2872
- "sampled"
2873
- ];
2874
- const valKeys = new Set(Object.keys(value));
2875
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2876
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2877
- const allPropertiesMatchFormat = true;
2878
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2879
- }
2880
- function isJson26(value) {
2881
- if (value === null) {
2882
- return false;
2883
- }
2884
- if (value === void 0) {
2885
- return false;
2886
- }
2887
- if (Array.isArray(value)) {
2888
- return false;
2889
- }
2890
- const modelKeys = /* @__PURE__ */ new Set([
2891
- "canonicalQuery",
2892
- "timezone",
2893
- "query",
2894
- "scannedRecords",
2895
- "dqlVersion",
2896
- "scannedBytes",
2897
- "scannedDataPoints",
2898
- "analysisTimeframe",
2899
- "locale",
2900
- "executionTimeMilliseconds",
2901
- "notifications",
2902
- "queryId",
2903
- "sampled"
2904
- ]);
2905
- const hasAdditionalProperties = false;
2906
- const requiredKeys = [];
2907
- const optionalKeys = [
2908
- "canonicalQuery",
2909
- "timezone",
2910
- "query",
2911
- "scannedRecords",
2912
- "dqlVersion",
2913
- "scannedBytes",
2914
- "scannedDataPoints",
2915
- "analysisTimeframe",
2916
- "locale",
2917
- "executionTimeMilliseconds",
2918
- "notifications",
2919
- "queryId",
2920
- "sampled"
2921
- ];
2922
- const valKeys = new Set(Object.keys(value));
2923
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
2924
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
2925
- const allPropertiesMatchFormat = true;
2926
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
2927
- }
2928
- function fromJson27($model) {
2929
- const {
2930
- canonicalQuery,
2931
- timezone,
2932
- query,
2933
- scannedRecords,
2934
- dqlVersion,
2935
- scannedBytes,
2936
- scannedDataPoints,
2937
- analysisTimeframe,
2938
- locale,
2939
- executionTimeMilliseconds,
2940
- notifications,
2941
- queryId,
2942
- sampled
2943
- } = $model;
2944
- return {
2945
- canonicalQuery,
2946
- timezone,
2947
- query,
2948
- scannedRecords,
2949
- dqlVersion,
2950
- scannedBytes,
2951
- scannedDataPoints,
2952
- analysisTimeframe: analysisTimeframe !== void 0 && analysisTimeframe !== null ? fromJson26(analysisTimeframe) : void 0,
2953
- locale,
2954
- executionTimeMilliseconds,
2955
- notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => fromJson20(innerValue)) : void 0,
2956
- queryId,
2957
- sampled
2958
- };
2959
- }
2960
- function toJson27($model) {
2961
- const {
2962
- canonicalQuery,
2963
- timezone,
2964
- query,
2965
- scannedRecords,
2966
- dqlVersion,
2967
- scannedBytes,
2968
- scannedDataPoints,
2969
- analysisTimeframe,
2970
- locale,
2971
- executionTimeMilliseconds,
2972
- notifications,
2973
- queryId,
2974
- sampled
2975
- } = $model;
2976
- return {
2977
- canonicalQuery,
2978
- timezone,
2979
- query,
2980
- scannedRecords,
2981
- dqlVersion,
2982
- scannedBytes,
2983
- scannedDataPoints,
2984
- analysisTimeframe: analysisTimeframe !== void 0 && analysisTimeframe !== null ? toJson26(analysisTimeframe) : void 0,
2985
- locale,
2986
- executionTimeMilliseconds,
2987
- notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => toJson20(innerValue)) : void 0,
2988
- queryId,
2989
- sampled
2990
- };
2991
- }
2992
-
2993
- // packages/client/query/src/lib/models/metric-metadata.transformation.ts
2994
- var metric_metadata_transformation_exports = {};
2995
- __export(metric_metadata_transformation_exports, {
2996
- fromJson: () => fromJson28,
2997
- isJson: () => isJson27,
2998
- isMetricMetadata: () => isMetricMetadata,
2999
- toJson: () => toJson28
3000
- });
3001
- function isMetricMetadata(value) {
3002
- if (value === null) {
3003
- return false;
3004
- }
3005
- if (value === void 0) {
3006
- return false;
3007
- }
3008
- if (Array.isArray(value)) {
3009
- return false;
3010
- }
3011
- const modelKeys = /* @__PURE__ */ new Set([
3012
- "metric.key",
3013
- "displayName",
3014
- "description",
3015
- "unit",
3016
- "fieldName",
3017
- "rollup",
3018
- "rate",
3019
- "shifted"
3020
- ]);
3021
- const hasAdditionalProperties = false;
3022
- const requiredKeys = [];
3023
- const optionalKeys = [
3024
- "metric.key",
3025
- "displayName",
3026
- "description",
3027
- "unit",
3028
- "fieldName",
3029
- "rollup",
3030
- "rate",
3031
- "shifted"
3032
- ];
3033
- const valKeys = new Set(Object.keys(value));
3034
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3035
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3036
- const allPropertiesMatchFormat = true;
3037
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3038
- }
3039
- function isJson27(value) {
3040
- if (value === null) {
3041
- return false;
3042
- }
3043
- if (value === void 0) {
3044
- return false;
3045
- }
3046
- if (Array.isArray(value)) {
3047
- return false;
3048
- }
3049
- const modelKeys = /* @__PURE__ */ new Set([
3050
- "metric.key",
3051
- "displayName",
3052
- "description",
3053
- "unit",
3054
- "fieldName",
3055
- "rollup",
3056
- "rate",
3057
- "shifted"
3058
- ]);
3059
- const hasAdditionalProperties = false;
3060
- const requiredKeys = [];
3061
- const optionalKeys = [
3062
- "metric.key",
3063
- "displayName",
3064
- "description",
3065
- "unit",
3066
- "fieldName",
3067
- "rollup",
3068
- "rate",
3069
- "shifted"
3070
- ];
3071
- const valKeys = new Set(Object.keys(value));
3072
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3073
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3074
- const allPropertiesMatchFormat = true;
3075
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3076
- }
3077
- function fromJson28($model) {
3078
- const { "metric.key": metricKey, displayName, description, unit, fieldName, rollup, rate, shifted } = $model;
3079
- return {
3080
- "metric.key": metricKey,
3081
- displayName,
3082
- description,
3083
- unit,
3084
- fieldName,
3085
- rollup,
3086
- rate,
3087
- shifted
3088
- };
3089
- }
3090
- function toJson28($model) {
3091
- const { "metric.key": metricKey, displayName, description, unit, fieldName, rollup, rate, shifted } = $model;
3092
- return {
3093
- "metric.key": metricKey,
3094
- displayName,
3095
- description,
3096
- unit,
3097
- fieldName,
3098
- rollup,
3099
- rate,
3100
- shifted
3101
- };
3102
- }
3103
-
3104
- // packages/client/query/src/lib/models/metadata.transformation.ts
3105
- function isMetadata(value) {
3106
- if (value === null) {
3107
- return false;
3108
- }
3109
- if (value === void 0) {
3110
- return false;
3111
- }
3112
- if (Array.isArray(value)) {
3113
- return false;
3114
- }
3115
- const modelKeys = /* @__PURE__ */ new Set(["grail", "metrics"]);
3116
- const hasAdditionalProperties = false;
3117
- const requiredKeys = [];
3118
- const optionalKeys = ["grail", "metrics"];
3119
- const valKeys = new Set(Object.keys(value));
3120
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3121
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3122
- const allPropertiesMatchFormat = true;
3123
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3124
- }
3125
- function isJson28(value) {
3126
- if (value === null) {
3127
- return false;
3128
- }
3129
- if (value === void 0) {
3130
- return false;
3131
- }
3132
- if (Array.isArray(value)) {
3133
- return false;
3134
- }
3135
- const modelKeys = /* @__PURE__ */ new Set(["grail", "metrics"]);
3136
- const hasAdditionalProperties = false;
3137
- const requiredKeys = [];
3138
- const optionalKeys = ["grail", "metrics"];
3139
- const valKeys = new Set(Object.keys(value));
3140
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3141
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3142
- const allPropertiesMatchFormat = true;
3143
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3144
- }
3145
- function fromJson29($model) {
3146
- const { grail, metrics } = $model;
3147
- return {
3148
- grail: grail !== void 0 && grail !== null ? fromJson27(grail) : void 0,
3149
- metrics: metrics !== void 0 && metrics !== null ? metrics?.map((innerValue) => fromJson28(innerValue)) : void 0
3150
- };
3151
- }
3152
- function toJson29($model) {
3153
- const { grail, metrics } = $model;
3154
- return {
3155
- grail: grail !== void 0 && grail !== null ? toJson27(grail) : void 0,
3156
- metrics: metrics !== void 0 && metrics !== null ? metrics?.map((innerValue) => toJson28(innerValue)) : void 0
3157
- };
3158
- }
3159
-
3160
- // packages/client/query/src/lib/models/ranged-field-types.transformation.ts
3161
- var ranged_field_types_transformation_exports = {};
3162
- __export(ranged_field_types_transformation_exports, {
3163
- fromJson: () => fromJson31,
3164
- isJson: () => isJson32,
3165
- isRangedFieldTypes: () => isRangedFieldTypes,
3166
- toJson: () => toJson31
3167
- });
3168
-
3169
- // packages/client/query/src/lib/models/ranged-field-types-mappings.transformation.ts
3170
- var ranged_field_types_mappings_transformation_exports = {};
3171
- __export(ranged_field_types_mappings_transformation_exports, {
3172
- fromJson: () => fromJson33,
3173
- isJson: () => isJson31,
3174
- isRangedFieldTypesMappings: () => isRangedFieldTypesMappings,
3175
- toJson: () => toJson33
3176
- });
3177
-
3178
- // packages/client/query/src/lib/models/field-type.transformation.ts
3179
- var field_type_transformation_exports = {};
3180
- __export(field_type_transformation_exports, {
3181
- fromJson: () => fromJson32,
3182
- isFieldType: () => isFieldType,
3183
- isJson: () => isJson30,
3184
- toJson: () => toJson32
3185
- });
3186
-
3187
- // packages/client/query/src/lib/models/field-type-type.transformation.ts
3188
- var field_type_type_transformation_exports = {};
3189
- __export(field_type_type_transformation_exports, {
3190
- fromJson: () => fromJson30,
3191
- isBooleanStringDoubleLongTimestampTimeframeDurationBinaryIpAddressGeoPointArrayRecordUidSmartscapeIdUndefined: () => isBooleanStringDoubleLongTimestampTimeframeDurationBinaryIpAddressGeoPointArrayRecordUidSmartscapeIdUndefined,
3192
- isJson: () => isJson29,
3193
- toJson: () => toJson30
3194
- });
3195
- function isBooleanStringDoubleLongTimestampTimeframeDurationBinaryIpAddressGeoPointArrayRecordUidSmartscapeIdUndefined(value) {
3196
- return typeof value === "string";
3197
- }
3198
- function isJson29(value) {
3199
- return typeof value === "string";
3200
- }
3201
- function fromJson30($model) {
3202
- return String($model);
3203
- }
3204
- function toJson30($model) {
3205
- return String($model);
3206
- }
3207
-
3208
- // packages/client/query/src/lib/models/field-type.transformation.ts
3209
- function isFieldType(value) {
3210
- if (value === null) {
3211
- return false;
3212
- }
3213
- if (value === void 0) {
3214
- return false;
3215
- }
3216
- if (Array.isArray(value)) {
3217
- return false;
3218
- }
3219
- const modelKeys = /* @__PURE__ */ new Set(["type", "types"]);
3220
- const hasAdditionalProperties = false;
3221
- const requiredKeys = ["type"];
3222
- const optionalKeys = ["types"];
3223
- const valKeys = new Set(Object.keys(value));
3224
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3225
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3226
- const allPropertiesMatchFormat = true;
3227
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3228
- }
3229
- function isJson30(value) {
3230
- if (value === null) {
3231
- return false;
3232
- }
3233
- if (value === void 0) {
3234
- return false;
3235
- }
3236
- if (Array.isArray(value)) {
3237
- return false;
3238
- }
3239
- const modelKeys = /* @__PURE__ */ new Set(["type", "types"]);
3240
- const hasAdditionalProperties = false;
3241
- const requiredKeys = ["type"];
3242
- const optionalKeys = ["types"];
3243
- const valKeys = new Set(Object.keys(value));
3244
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3245
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3246
- const allPropertiesMatchFormat = true;
3247
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3248
- }
3249
- function fromJson32($model) {
3250
- const { type, types } = $model;
3251
- return {
3252
- type: fromJson30(type),
3253
- types: types !== void 0 && types !== null ? types?.map((innerValue) => fromJson31(innerValue)) : void 0
3254
- };
3255
- }
3256
- function toJson32($model) {
3257
- const { type, types } = $model;
3258
- return {
3259
- type: toJson30(type),
3260
- types: types !== void 0 && types !== null ? types?.map((innerValue) => toJson31(innerValue)) : void 0
3261
- };
3262
- }
3263
-
3264
- // packages/client/query/src/lib/models/ranged-field-types-mappings.transformation.ts
3265
- function isRangedFieldTypesMappings(value) {
3266
- if (value === null) {
3267
- return false;
3268
- }
3269
- if (value === void 0) {
3270
- return false;
3271
- }
3272
- if (Array.isArray(value)) {
3273
- return false;
3274
- }
3275
- const modelKeys = /* @__PURE__ */ new Set([]);
3276
- const hasAdditionalProperties = true;
3277
- const requiredKeys = [];
3278
- const optionalKeys = [];
3279
- const valKeys = new Set(Object.keys(value));
3280
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3281
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3282
- const allPropertiesMatchFormat = true;
3283
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3284
- }
3285
- function isJson31(value) {
3286
- if (value === null) {
3287
- return false;
3288
- }
3289
- if (value === void 0) {
3290
- return false;
3291
- }
3292
- if (Array.isArray(value)) {
3293
- return false;
3294
- }
3295
- const modelKeys = /* @__PURE__ */ new Set([]);
3296
- const hasAdditionalProperties = true;
3297
- const requiredKeys = [];
3298
- const optionalKeys = [];
3299
- const valKeys = new Set(Object.keys(value));
3300
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3301
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3302
- const allPropertiesMatchFormat = true;
3303
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3304
- }
3305
- function fromJson33($model) {
3306
- const additionalProps = $model;
3307
- return {
3308
- ...Object.fromEntries(
3309
- Object.entries(additionalProps).map(([propName, value]) => [
3310
- propName,
3311
- value !== void 0 && value !== null ? fromJson32(value) : void 0
3312
- ])
3313
- )
3314
- };
3315
- }
3316
- function toJson33($model) {
3317
- const additionalProps = $model;
3318
- return {
3319
- ...Object.fromEntries(
3320
- Object.entries(additionalProps).map(([propName, value]) => [
3321
- propName,
3322
- value !== void 0 && value !== null ? toJson32(value) : void 0
3323
- ])
3324
- )
3325
- };
3326
- }
3327
-
3328
- // packages/client/query/src/lib/models/ranged-field-types.transformation.ts
3329
- function isRangedFieldTypes(value) {
3330
- if (value === null) {
3331
- return false;
3332
- }
3333
- if (value === void 0) {
3334
- return false;
3335
- }
3336
- if (Array.isArray(value)) {
3337
- return false;
3338
- }
3339
- const modelKeys = /* @__PURE__ */ new Set(["mappings", "indexRange"]);
3340
- const hasAdditionalProperties = false;
3341
- const requiredKeys = ["mappings"];
3342
- const optionalKeys = ["indexRange"];
3343
- const valKeys = new Set(Object.keys(value));
3344
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3345
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3346
- const allPropertiesMatchFormat = true;
3347
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3348
- }
3349
- function isJson32(value) {
3350
- if (value === null) {
3351
- return false;
3352
- }
3353
- if (value === void 0) {
3354
- return false;
3355
- }
3356
- if (Array.isArray(value)) {
3357
- return false;
3358
- }
3359
- const modelKeys = /* @__PURE__ */ new Set(["mappings", "indexRange"]);
3360
- const hasAdditionalProperties = false;
3361
- const requiredKeys = ["mappings"];
3362
- const optionalKeys = ["indexRange"];
3363
- const valKeys = new Set(Object.keys(value));
3364
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3365
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3366
- const allPropertiesMatchFormat = true;
3367
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3368
- }
3369
- function fromJson31($model) {
3370
- const { mappings, indexRange } = $model;
3371
- return {
3372
- mappings: fromJson33(mappings),
3373
- indexRange: indexRange !== void 0 && indexRange !== null ? indexRange?.slice(0) : void 0
3374
- };
3375
- }
3376
- function toJson31($model) {
3377
- const { mappings, indexRange } = $model;
3378
- return {
3379
- mappings: toJson33(mappings),
3380
- indexRange: indexRange !== void 0 && indexRange !== null ? indexRange?.slice(0) : void 0
3381
- };
3382
- }
3383
-
3384
- // packages/client/query/src/lib/models/result-record.transformation.ts
3385
- var result_record_transformation_exports = {};
3386
- __export(result_record_transformation_exports, {
3387
- fromJson: () => fromJson35,
3388
- isJson: () => isJson34,
3389
- isResultRecord: () => isResultRecord,
3390
- toJson: () => toJson35
3391
- });
3392
-
3393
- // packages/client/query/src/lib/models/result-record-value.transformation.ts
3394
- var result_record_value_transformation_exports = {};
3395
- __export(result_record_value_transformation_exports, {
3396
- checkArrayResultRecordValue: () => checkArrayResultRecordValue,
3397
- checkArrayResultRecordValueAsJson: () => checkArrayResultRecordValueAsJson,
3398
- checkArrayResultRecordValueNullItemDatatype: () => checkArrayResultRecordValueNullItemDatatype,
3399
- checkArrayResultRecordValueTransformationAsJsonNullItemDatatype: () => checkArrayResultRecordValueTransformationAsJsonNullItemDatatype,
3400
- checkBoolean: () => checkBoolean,
3401
- checkGeoPoint: () => checkGeoPoint,
3402
- checkGeoPointAsJson: () => checkGeoPointAsJson,
3403
- checkNumber: () => checkNumber,
3404
- checkResultRecord: () => checkResultRecord,
3405
- checkResultRecordAsJson: () => checkResultRecordAsJson,
3406
- checkString: () => checkString,
3407
- checkTimeframe: () => checkTimeframe,
3408
- checkTimeframeAsJson: () => checkTimeframeAsJson,
3409
- fromJson: () => fromJson36,
3410
- isJson: () => isJson35,
3411
- isResultRecordValue: () => isResultRecordValue,
3412
- toJson: () => toJson36
3413
- });
3414
-
3415
- // packages/client/query/src/lib/models/geo-point.transformation.ts
3416
- var geo_point_transformation_exports = {};
3417
- __export(geo_point_transformation_exports, {
3418
- fromJson: () => fromJson34,
3419
- isGeoPoint: () => isGeoPoint,
3420
- isJson: () => isJson33,
3421
- toJson: () => toJson34
3422
- });
3423
- function isGeoPoint(value) {
3424
- if (value === null) {
3425
- return false;
3426
- }
3427
- if (value === void 0) {
3428
- return false;
3429
- }
3430
- if (Array.isArray(value)) {
3431
- return false;
3432
- }
3433
- const modelKeys = /* @__PURE__ */ new Set(["latitude", "longitude"]);
3434
- const hasAdditionalProperties = false;
3435
- const requiredKeys = ["latitude", "longitude"];
3436
- const optionalKeys = [];
3437
- const valKeys = new Set(Object.keys(value));
3438
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3439
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3440
- const allPropertiesMatchFormat = true;
3441
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3442
- }
3443
- function isJson33(value) {
3444
- if (value === null) {
3445
- return false;
3446
- }
3447
- if (value === void 0) {
3448
- return false;
3449
- }
3450
- if (Array.isArray(value)) {
3451
- return false;
3452
- }
3453
- const modelKeys = /* @__PURE__ */ new Set(["latitude", "longitude"]);
3454
- const hasAdditionalProperties = false;
3455
- const requiredKeys = ["latitude", "longitude"];
3456
- const optionalKeys = [];
3457
- const valKeys = new Set(Object.keys(value));
3458
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3459
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3460
- const allPropertiesMatchFormat = true;
3461
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3462
- }
3463
- function fromJson34($model) {
3464
- const { latitude, longitude } = $model;
3465
- return {
3466
- latitude,
3467
- longitude
3468
- };
3469
- }
3470
- function toJson34($model) {
3471
- const { latitude, longitude } = $model;
3472
- return {
3473
- latitude,
3474
- longitude
3475
- };
3476
- }
3477
-
3478
- // packages/client/query/src/lib/models/result-record-value.transformation.ts
3479
- function checkBoolean(value) {
3480
- return typeof value === "boolean";
3481
- }
3482
- function checkNumber(value) {
3483
- return typeof value === "number";
3484
- }
3485
- function checkString(value) {
3486
- return typeof value === "string";
3487
- }
3488
- function checkTimeframe(value) {
3489
- return isTimeframe(value);
3490
- }
3491
- function checkGeoPoint(value) {
3492
- return isGeoPoint(value);
3493
- }
3494
- function checkResultRecord(value) {
3495
- return isResultRecord(value);
3496
- }
3497
- function checkArrayResultRecordValueNullItemDatatype(value) {
3498
- return isResultRecordValue(value);
3499
- }
3500
- function checkArrayResultRecordValue(value) {
3501
- const datatypeMatch = (val) => checkArrayResultRecordValueNullItemDatatype(val);
3502
- return Array.isArray(value) && value.every(datatypeMatch);
3503
- }
3504
- function isResultRecordValue(value) {
3505
- return checkBoolean(value) || checkNumber(value) || checkString(value) || checkTimeframe(value) || checkGeoPoint(value) || checkResultRecord(value) || checkArrayResultRecordValue(value) || value === null;
3506
- }
3507
- function checkTimeframeAsJson(value) {
3508
- return isJson25(value);
3509
- }
3510
- function checkGeoPointAsJson(value) {
3511
- return isJson33(value);
3512
- }
3513
- function checkResultRecordAsJson(value) {
3514
- return isJson34(value);
3515
- }
3516
- function checkArrayResultRecordValueTransformationAsJsonNullItemDatatype(value) {
3517
- return isResultRecordValue(value);
3518
- }
3519
- function checkArrayResultRecordValueAsJson(value) {
3520
- const datatypeMatch = (val) => checkArrayResultRecordValueTransformationAsJsonNullItemDatatype(val);
3521
- return Array.isArray(value) && value.every(datatypeMatch);
3522
- }
3523
- function isJson35(value) {
3524
- return checkBoolean(value) || checkNumber(value) || checkString(value) || checkTimeframeAsJson(value) || checkGeoPointAsJson(value) || checkResultRecordAsJson(value) || checkArrayResultRecordValueAsJson(value) || value === null;
3525
- }
3526
- function fromJson36($model) {
3527
- if (!isJson35($model)) {
3528
- throw new TypeError("_ResultRecordValueTransformation.fromJson: value's datatype does not match");
3529
- }
3530
- if ($model === null) {
3531
- return null;
3532
- }
3533
- if (checkBoolean($model)) {
3534
- return Boolean($model);
3535
- }
3536
- if (checkNumber($model)) {
3537
- return Number($model);
3538
- }
3539
- if (checkString($model)) {
3540
- return String($model);
3541
- }
3542
- if (checkTimeframeAsJson($model)) {
3543
- return fromJson26($model);
3544
- }
3545
- if (checkGeoPointAsJson($model)) {
3546
- return fromJson34($model);
3547
- }
3548
- if (checkResultRecordAsJson($model)) {
3549
- return fromJson35($model);
3550
- }
3551
- if (checkArrayResultRecordValue($model)) {
3552
- return $model.map((el) => fromJson36(el));
3553
- }
3554
- throw new TypeError("Unable to deserialize value");
3555
- }
3556
- function toJson36($model) {
3557
- if (!isResultRecordValue($model)) {
3558
- throw new TypeError("_ResultRecordValueTransformation.toJson: value's datatype does not match");
3559
- }
3560
- if ($model === null) {
3561
- return null;
3562
- }
3563
- if (checkBoolean($model)) {
3564
- return Boolean($model);
3565
- }
3566
- if (checkNumber($model)) {
3567
- return Number($model);
3568
- }
3569
- if (checkString($model)) {
3570
- return String($model);
3571
- }
3572
- if (checkTimeframe($model)) {
3573
- return toJson26($model);
3574
- }
3575
- if (checkGeoPoint($model)) {
3576
- return toJson34($model);
3577
- }
3578
- if (checkResultRecord($model)) {
3579
- return toJson35($model);
3580
- }
3581
- if (checkArrayResultRecordValue($model)) {
3582
- return $model.map((el) => toJson36(el));
3583
- }
3584
- throw new TypeError("Unable to serialize value");
3585
- }
3586
-
3587
- // packages/client/query/src/lib/models/result-record.transformation.ts
3588
- function isResultRecord(value) {
3589
- if (value === null) {
3590
- return true;
3591
- }
3592
- if (value === void 0) {
3593
- return false;
3594
- }
3595
- if (Array.isArray(value)) {
3596
- return false;
3597
- }
3598
- const modelKeys = /* @__PURE__ */ new Set([]);
3599
- const hasAdditionalProperties = true;
3600
- const requiredKeys = [];
3601
- const optionalKeys = [];
3602
- const valKeys = new Set(Object.keys(value));
3603
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3604
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3605
- const allPropertiesMatchFormat = true;
3606
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3607
- }
3608
- function isJson34(value) {
3609
- if (value === null) {
3610
- return true;
3611
- }
3612
- if (value === void 0) {
3613
- return false;
3614
- }
3615
- if (Array.isArray(value)) {
3616
- return false;
3617
- }
3618
- const modelKeys = /* @__PURE__ */ new Set([]);
3619
- const hasAdditionalProperties = true;
3620
- const requiredKeys = [];
3621
- const optionalKeys = [];
3622
- const valKeys = new Set(Object.keys(value));
3623
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3624
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3625
- const allPropertiesMatchFormat = true;
3626
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3627
- }
3628
- function fromJson35($model) {
3629
- if ($model === null) {
3630
- return null;
3631
- }
3632
- const additionalProps = $model;
3633
- return {
3634
- ...Object.fromEntries(
3635
- Object.entries(additionalProps).map(([propName, value]) => [
3636
- propName,
3637
- value !== void 0 ? fromJson36(value) : void 0
3638
- ])
3639
- )
3640
- };
3641
- }
3642
- function toJson35($model) {
3643
- if ($model === null) {
3644
- return null;
3645
- }
3646
- const additionalProps = $model;
3647
- return {
3648
- ...Object.fromEntries(
3649
- Object.entries(additionalProps).map(([propName, value]) => [
3650
- propName,
3651
- value !== void 0 && value !== null ? toJson36(value) : void 0
3652
- ])
3653
- )
3654
- };
3655
- }
3656
-
3657
- // packages/client/query/src/lib/models/query-result.transformation.ts
3658
- function isQueryResult(value) {
3659
- if (value === null) {
3660
- return false;
3661
- }
3662
- if (value === void 0) {
3663
- return false;
3664
- }
3665
- if (Array.isArray(value)) {
3666
- return false;
3667
- }
3668
- const modelKeys = /* @__PURE__ */ new Set(["records", "metadata", "types"]);
3669
- const hasAdditionalProperties = false;
3670
- const requiredKeys = ["metadata", "records", "types"];
3671
- const optionalKeys = [];
3672
- const valKeys = new Set(Object.keys(value));
3673
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3674
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3675
- const allPropertiesMatchFormat = true;
3676
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3677
- }
3678
- function isJson36(value) {
3679
- if (value === null) {
3680
- return false;
3681
- }
3682
- if (value === void 0) {
3683
- return false;
703
+ } catch (error) {
704
+ if (error instanceof import_shared_errors3.ClientRequestError) {
705
+ throw error;
706
+ }
707
+ const responseValue = await response.body("text").catch(() => "");
708
+ throw new import_shared_errors3.InvalidResponseError(
709
+ `${response.status}`,
710
+ error,
711
+ responseValue,
712
+ "json",
713
+ "Unexpected api response",
714
+ response
715
+ );
716
+ }
717
+ }
718
+ }
719
+ }
3684
720
  }
3685
- if (Array.isArray(value)) {
3686
- return false;
721
+ /**
722
+ * Get a structured list of suggestions for the query at the given position.
723
+ *
724
+ * For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
725
+ *
726
+ * ## Overview
727
+ *
728
+ * We provide a list of suggestions that may be used after the cursor position. The following queries will all provide the
729
+ * same results:
730
+ *
731
+ * * `query: "f"`
732
+ * * `query: "f", cursorPosition:1`
733
+ * * `query: "fetch ", cursorPosition:1`
734
+ *
735
+ * Available fields:
736
+ *
737
+ * | Field | Description |
738
+ * |-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
739
+ * | suggestions | a list of suggestions. Each item is a separate possible suggestion, despite they might have the same outputs. |
740
+ * | optional | whether the suggestion is optional. If `true`, the query until the cursor position might work. If `false`, the query is definitely incomplete or invalid if cut at the cursor position. |
741
+ *
742
+ * Fields in the `suggestions`
743
+ *
744
+ * | Field | Description |
745
+ * |------------------------|------------------------------------------------------------------------------------------------------------|
746
+ * | suggestion | a string representing the whole suggestion. This information could also be derived from the parts. |
747
+ * | alreadyTypedCharacters | how many characters of this suggestion have already been typed (and will be overridden by the suggestion). |
748
+ * | parts | a list of semantically enriched information on what are the parts of a suggestion. |
749
+ *
750
+ * Fields in `parts`
751
+ *
752
+ * | Field | Description |
753
+ * |------------|-----------------------------------------------------------|
754
+ * | suggestion | a string representing the current part of the suggestion. |
755
+ * | type | current types: SPACE, PIPE, COMMAND (may be extended) |
756
+ *
757
+ * The `type` helps to treat specific parts of the suggestion different to others; either by a different visualization,
758
+ * a link to docs, etc.
759
+ *
760
+ * @returns {Promise<AutocompleteResponse>} A list of structured autocomplete suggestions.
761
+ *
762
+ * @example <caption>Code example</caption>
763
+ * import { queryAssistanceClient } from "@dynatrace-sdk/client-query";
764
+ *
765
+ * const data = await queryAssistanceClient.queryAutocomplete({
766
+ * body: {
767
+ * query:
768
+ * 'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
769
+ * },
770
+ * });
771
+ *
772
+ * @throws {ErrorEnvelopeError} The supplied request is wrong. Either the query itself or other parameters are wrong. | An internal server error has occurred.
773
+ * @throws {InvalidResponseError}
774
+ * @throws {ApiClientError}
775
+ * @throws {ClientRequestError}
776
+ */
777
+ async queryAutocomplete(config) {
778
+ if (!config) {
779
+ throw new import_shared_errors3.ApiClientError("API client error", "API client call is missing mandatory config parameter");
780
+ }
781
+ const encodedBody = transformRequest(config.body, []);
782
+ try {
783
+ const response = await this.httpClient.send({
784
+ url: `/platform/storage/query/v1/query:autocomplete`,
785
+ method: "POST",
786
+ requestBodyType: "json",
787
+ body: encodedBody,
788
+ headers: {
789
+ "Content-Type": "application/json",
790
+ Accept: "application/json"
791
+ },
792
+ abortSignal: config instanceof EventTarget ? config : config.abortSignal,
793
+ statusValidator: (status) => {
794
+ return [200].includes(status);
795
+ }
796
+ });
797
+ const responseValue = await response.body("json");
798
+ try {
799
+ return transformResponse(responseValue, []);
800
+ } catch (err) {
801
+ throw new import_shared_errors3.InvalidResponseError(
802
+ `QueryAssistanceClient.query:autocomplete:200`,
803
+ err,
804
+ responseValue,
805
+ void 0,
806
+ void 0,
807
+ response
808
+ );
809
+ }
810
+ } catch (e) {
811
+ if ((0, import_http_client.isHttpClientAbortError)(e) || (0, import_shared_errors3.isInvalidResponseError)(e)) {
812
+ throw e;
813
+ }
814
+ if (!(0, import_http_client.isHttpClientResponseError)(e)) {
815
+ throw new import_shared_errors3.ApiClientError("UnexpectedError", "Unexpected error", e);
816
+ }
817
+ const response = e.response;
818
+ await apiGatewayErrorsHandler(response);
819
+ switch (response.status) {
820
+ case 400: {
821
+ const responseValue = await response.body("json");
822
+ try {
823
+ const errorBody = transformResponse(responseValue, []);
824
+ throw new ErrorEnvelopeError(
825
+ `400`,
826
+ response,
827
+ errorBody,
828
+ getErrorMessage(
829
+ errorBody,
830
+ "The supplied request is wrong. Either the query itself or other parameters are wrong."
831
+ ),
832
+ e
833
+ );
834
+ } catch (err) {
835
+ if (err instanceof ErrorEnvelopeError) {
836
+ throw err;
837
+ }
838
+ throw new import_shared_errors3.InvalidResponseError(
839
+ `QueryAssistanceClient.query:autocomplete:400`,
840
+ err,
841
+ responseValue,
842
+ "ErrorEnvelope",
843
+ void 0,
844
+ response
845
+ );
846
+ }
847
+ }
848
+ case 500: {
849
+ const responseValue = await response.body("json");
850
+ try {
851
+ const errorBody = transformResponse(responseValue, []);
852
+ throw new ErrorEnvelopeError(
853
+ `500`,
854
+ response,
855
+ errorBody,
856
+ getErrorMessage(errorBody, "An internal server error has occurred."),
857
+ e
858
+ );
859
+ } catch (err) {
860
+ if (err instanceof ErrorEnvelopeError) {
861
+ throw err;
862
+ }
863
+ throw new import_shared_errors3.InvalidResponseError(
864
+ `QueryAssistanceClient.query:autocomplete:500`,
865
+ err,
866
+ responseValue,
867
+ "ErrorEnvelope",
868
+ void 0,
869
+ response
870
+ );
871
+ }
872
+ }
873
+ default: {
874
+ try {
875
+ const responseValue = await response.body("json");
876
+ throw new import_shared_errors3.ClientRequestError(
877
+ `${response.status}`,
878
+ response,
879
+ responseValue,
880
+ getErrorMessage(
881
+ responseValue,
882
+ `Unexpected api response: code=${response.status} body="${responseValue}"`
883
+ ),
884
+ e
885
+ );
886
+ } catch (error) {
887
+ if (error instanceof import_shared_errors3.ClientRequestError) {
888
+ throw error;
889
+ }
890
+ const responseValue = await response.body("text").catch(() => "");
891
+ throw new import_shared_errors3.InvalidResponseError(
892
+ `${response.status}`,
893
+ error,
894
+ responseValue,
895
+ "json",
896
+ "Unexpected api response",
897
+ response
898
+ );
899
+ }
900
+ }
901
+ }
902
+ }
3687
903
  }
3688
- const modelKeys = /* @__PURE__ */ new Set(["records", "metadata", "types"]);
3689
- const hasAdditionalProperties = false;
3690
- const requiredKeys = ["metadata", "records", "types"];
3691
- const optionalKeys = [];
3692
- const valKeys = new Set(Object.keys(value));
3693
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3694
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3695
- const allPropertiesMatchFormat = true;
3696
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3697
- }
3698
- function fromJson37($model) {
3699
- const { records, metadata, types } = $model;
3700
- return {
3701
- records: records?.map((innerValue) => fromJson35(innerValue)),
3702
- metadata: fromJson29(metadata),
3703
- types: types?.map((innerValue) => fromJson31(innerValue))
3704
- };
3705
- }
3706
- function toJson37($model) {
3707
- const { records, metadata, types } = $model;
3708
- return {
3709
- records: records?.map((innerValue) => toJson35(innerValue)),
3710
- metadata: toJson29(metadata),
3711
- types: types?.map((innerValue) => toJson31(innerValue))
3712
- };
3713
- }
3714
-
3715
- // packages/client/query/src/lib/models/query-state.transformation.ts
3716
- var query_state_transformation_exports = {};
3717
- __export(query_state_transformation_exports, {
3718
- fromJson: () => fromJson38,
3719
- isJson: () => isJson37,
3720
- isNotStartedRunningSucceededResultGoneCancelledFailed: () => isNotStartedRunningSucceededResultGoneCancelledFailed,
3721
- toJson: () => toJson38
3722
- });
3723
- function isNotStartedRunningSucceededResultGoneCancelledFailed(value) {
3724
- return typeof value === "string";
3725
- }
3726
- function isJson37(value) {
3727
- return typeof value === "string";
3728
- }
3729
- function fromJson38($model) {
3730
- return String($model);
3731
- }
3732
- function toJson38($model) {
3733
- return String($model);
3734
- }
904
+ };
905
+ var queryAssistanceClient = /* @__PURE__ */ new QueryAssistanceClient(import_http_client.httpClient);
3735
906
 
3736
- // packages/client/query/src/lib/models/query-poll-response.transformation.ts
3737
- function isQueryPollResponse(value) {
3738
- if (value === null) {
3739
- return false;
3740
- }
3741
- if (value === void 0) {
3742
- return false;
3743
- }
3744
- if (Array.isArray(value)) {
3745
- return false;
3746
- }
3747
- const modelKeys = /* @__PURE__ */ new Set(["result", "ttlSeconds", "progress", "state"]);
3748
- const hasAdditionalProperties = false;
3749
- const requiredKeys = ["state"];
3750
- const optionalKeys = ["result", "ttlSeconds", "progress"];
3751
- const valKeys = new Set(Object.keys(value));
3752
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3753
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3754
- const allPropertiesMatchFormat = true;
3755
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3756
- }
3757
- function isJson38(value) {
3758
- if (value === null) {
3759
- return false;
3760
- }
3761
- if (value === void 0) {
3762
- return false;
3763
- }
3764
- if (Array.isArray(value)) {
3765
- return false;
3766
- }
3767
- const modelKeys = /* @__PURE__ */ new Set(["result", "ttlSeconds", "progress", "state"]);
3768
- const hasAdditionalProperties = false;
3769
- const requiredKeys = ["state"];
3770
- const optionalKeys = ["result", "ttlSeconds", "progress"];
3771
- const valKeys = new Set(Object.keys(value));
3772
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3773
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3774
- const allPropertiesMatchFormat = true;
3775
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3776
- }
3777
- function fromJson39($model) {
3778
- const { result, ttlSeconds, progress, state } = $model;
3779
- return {
3780
- result: result !== void 0 && result !== null ? fromJson37(result) : void 0,
3781
- ttlSeconds,
3782
- progress,
3783
- state: fromJson38(state)
3784
- };
3785
- }
3786
- function toJson39($model) {
3787
- const { result, ttlSeconds, progress, state } = $model;
3788
- return {
3789
- result: result !== void 0 && result !== null ? toJson37(result) : void 0,
3790
- ttlSeconds,
3791
- progress,
3792
- state: toJson38(state)
3793
- };
3794
- }
907
+ // packages/client/query/src/lib/apis/query-execution-api.ts
908
+ var import_http_client2 = require("@dynatrace-sdk/http-client");
909
+ var import_shared_errors4 = require("@dynatrace-sdk/shared-errors");
3795
910
 
3796
- // packages/client/query/src/lib/models/query-start-response.transformation.ts
3797
- var query_start_response_transformation_exports = {};
3798
- __export(query_start_response_transformation_exports, {
3799
- fromJson: () => fromJson40,
3800
- isJson: () => isJson39,
3801
- isQueryStartResponse: () => isQueryStartResponse,
3802
- toJson: () => toJson40
3803
- });
3804
- function isQueryStartResponse(value) {
3805
- if (value === null) {
3806
- return false;
3807
- }
3808
- if (value === void 0) {
3809
- return false;
3810
- }
3811
- if (Array.isArray(value)) {
3812
- return false;
3813
- }
3814
- const modelKeys = /* @__PURE__ */ new Set(["result", "ttlSeconds", "progress", "requestToken", "state"]);
3815
- const hasAdditionalProperties = false;
3816
- const requiredKeys = ["state"];
3817
- const optionalKeys = ["result", "ttlSeconds", "progress", "requestToken"];
3818
- const valKeys = new Set(Object.keys(value));
3819
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3820
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3821
- const allPropertiesMatchFormat = true;
3822
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3823
- }
3824
- function isJson39(value) {
3825
- if (value === null) {
3826
- return false;
3827
- }
3828
- if (value === void 0) {
3829
- return false;
3830
- }
3831
- if (Array.isArray(value)) {
3832
- return false;
3833
- }
3834
- const modelKeys = /* @__PURE__ */ new Set(["result", "ttlSeconds", "progress", "requestToken", "state"]);
3835
- const hasAdditionalProperties = false;
3836
- const requiredKeys = ["state"];
3837
- const optionalKeys = ["result", "ttlSeconds", "progress", "requestToken"];
3838
- const valKeys = new Set(Object.keys(value));
3839
- const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
3840
- const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
3841
- const allPropertiesMatchFormat = true;
3842
- return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
3843
- }
3844
- function fromJson40($model) {
3845
- const { result, ttlSeconds, progress, requestToken, state } = $model;
3846
- return {
3847
- result: result !== void 0 && result !== null ? fromJson37(result) : void 0,
3848
- ttlSeconds,
3849
- progress,
3850
- requestToken,
3851
- state: fromJson38(state)
3852
- };
3853
- }
3854
- function toJson40($model) {
3855
- const { result, ttlSeconds, progress, requestToken, state } = $model;
3856
- return {
3857
- result: result !== void 0 && result !== null ? toJson37(result) : void 0,
3858
- ttlSeconds,
3859
- progress,
3860
- requestToken,
3861
- state: toJson38(state)
3862
- };
911
+ // packages/client/query/src/lib/error-envelopes/responses/insufficient-permission.ts
912
+ var InsufficientPermission = class extends ErrorEnvelopeError {
913
+ isInsufficientPermission = true;
914
+ name = "InsufficientPermission";
915
+ };
916
+ function isInsufficientPermission(e) {
917
+ return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorEnvelopeError === true && e?.isInsufficientPermission === true && e instanceof Error;
3863
918
  }
3864
919
 
3865
920
  // packages/client/query/src/lib/utils/encoding.ts
@@ -3921,7 +976,6 @@ var QueryExecutionClient = class {
3921
976
  */
3922
977
  constructor(httpClientImplementation) {
3923
978
  this.httpClient = httpClientImplementation;
3924
- registerGlobalErrorSerializer(apiClientErrorSerializer);
3925
979
  }
3926
980
  /**
3927
981
  * Retrieves query status and final result from Grail.
@@ -3975,7 +1029,7 @@ var QueryExecutionClient = class {
3975
1029
  */
3976
1030
  async queryPoll(config) {
3977
1031
  if (!config) {
3978
- throw new import_shared_errors5.ApiClientError("API client error", "API client call is missing mandatory config parameter");
1032
+ throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
3979
1033
  }
3980
1034
  const query = toQueryString(
3981
1035
  {
@@ -3999,9 +1053,18 @@ var QueryExecutionClient = class {
3999
1053
  });
4000
1054
  const responseValue = await response.body("json");
4001
1055
  try {
4002
- return fromJson39(responseValue);
1056
+ return transformResponse(responseValue, [
1057
+ ["result.records.*.start", { datetime: true }],
1058
+ ["result.records.*.end", { datetime: true }],
1059
+ ["result.records.**.start", { datetime: true }],
1060
+ ["result.records.**.end", { datetime: true }],
1061
+ ["result.records.*.start", { datetime: true }],
1062
+ ["result.records.*.end", { datetime: true }],
1063
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1064
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1065
+ ]);
4003
1066
  } catch (err) {
4004
- throw new import_shared_errors5.InvalidResponseError(
1067
+ throw new import_shared_errors4.InvalidResponseError(
4005
1068
  `QueryExecutionClient.query:poll:200`,
4006
1069
  err,
4007
1070
  responseValue,
@@ -4011,19 +1074,19 @@ var QueryExecutionClient = class {
4011
1074
  );
4012
1075
  }
4013
1076
  } catch (e) {
4014
- if ((0, import_http_client2.isHttpClientAbortError)(e) || (0, import_shared_errors5.isInvalidResponseError)(e)) {
1077
+ if ((0, import_http_client2.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e)) {
4015
1078
  throw e;
4016
1079
  }
4017
1080
  if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
4018
- throw new import_shared_errors5.ApiClientError("UnexpectedError", "Unexpected error", e);
1081
+ throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e);
4019
1082
  }
4020
1083
  const response = e.response;
4021
- apiGatewayErrorsHandler(response);
1084
+ await apiGatewayErrorsHandler(response);
4022
1085
  switch (response.status) {
4023
1086
  case 400: {
4024
1087
  const responseValue = await response.body("json");
4025
1088
  try {
4026
- const errorBody = fromJson17(responseValue);
1089
+ const errorBody = transformResponse(responseValue, []);
4027
1090
  throw new ErrorEnvelopeError(
4028
1091
  `400`,
4029
1092
  response,
@@ -4038,7 +1101,7 @@ var QueryExecutionClient = class {
4038
1101
  if (err instanceof ErrorEnvelopeError) {
4039
1102
  throw err;
4040
1103
  }
4041
- throw new import_shared_errors5.InvalidResponseError(
1104
+ throw new import_shared_errors4.InvalidResponseError(
4042
1105
  `QueryExecutionClient.query:poll:400`,
4043
1106
  err,
4044
1107
  responseValue,
@@ -4052,7 +1115,7 @@ var QueryExecutionClient = class {
4052
1115
  const contentType = response.headers["content-type"];
4053
1116
  const encoding = mimeTypeToEncoding(contentType, "text" /* Text */);
4054
1117
  const responseValue = await response.body(encoding);
4055
- throw new import_shared_errors5.ClientRequestError(
1118
+ throw new import_shared_errors4.ClientRequestError(
4056
1119
  `410`,
4057
1120
  response,
4058
1121
  responseValue,
@@ -4062,7 +1125,7 @@ var QueryExecutionClient = class {
4062
1125
  case 500: {
4063
1126
  const responseValue = await response.body("json");
4064
1127
  try {
4065
- const errorBody = fromJson17(responseValue);
1128
+ const errorBody = transformResponse(responseValue, []);
4066
1129
  throw new ErrorEnvelopeError(
4067
1130
  `500`,
4068
1131
  response,
@@ -4074,7 +1137,7 @@ var QueryExecutionClient = class {
4074
1137
  if (err instanceof ErrorEnvelopeError) {
4075
1138
  throw err;
4076
1139
  }
4077
- throw new import_shared_errors5.InvalidResponseError(
1140
+ throw new import_shared_errors4.InvalidResponseError(
4078
1141
  `QueryExecutionClient.query:poll:500`,
4079
1142
  err,
4080
1143
  responseValue,
@@ -4087,7 +1150,7 @@ var QueryExecutionClient = class {
4087
1150
  default: {
4088
1151
  try {
4089
1152
  const responseValue = await response.body("json");
4090
- throw new import_shared_errors5.ClientRequestError(
1153
+ throw new import_shared_errors4.ClientRequestError(
4091
1154
  `${response.status}`,
4092
1155
  response,
4093
1156
  responseValue,
@@ -4098,11 +1161,11 @@ var QueryExecutionClient = class {
4098
1161
  e
4099
1162
  );
4100
1163
  } catch (error) {
4101
- if (error instanceof import_shared_errors5.ClientRequestError) {
1164
+ if (error instanceof import_shared_errors4.ClientRequestError) {
4102
1165
  throw error;
4103
1166
  }
4104
1167
  const responseValue = await response.body("text").catch(() => "");
4105
- throw new import_shared_errors5.InvalidResponseError(
1168
+ throw new import_shared_errors4.InvalidResponseError(
4106
1169
  `${response.status}`,
4107
1170
  error,
4108
1171
  responseValue,
@@ -4174,9 +1237,9 @@ var QueryExecutionClient = class {
4174
1237
  */
4175
1238
  async queryExecute(config) {
4176
1239
  if (!config) {
4177
- throw new import_shared_errors5.ApiClientError("API client error", "API client call is missing mandatory config parameter");
1240
+ throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
4178
1241
  }
4179
- const encodedBody = toJson25(config.body);
1242
+ const encodedBody = transformRequest(config.body, []);
4180
1243
  const query = toQueryString({ enrich: config.enrich });
4181
1244
  try {
4182
1245
  const response = await this.httpClient.send({
@@ -4197,9 +1260,18 @@ var QueryExecutionClient = class {
4197
1260
  case 200: {
4198
1261
  const responseValue = await response.body("json");
4199
1262
  try {
4200
- return fromJson40(responseValue);
1263
+ return transformResponse(responseValue, [
1264
+ ["result.records.*.start", { datetime: true }],
1265
+ ["result.records.*.end", { datetime: true }],
1266
+ ["result.records.**.start", { datetime: true }],
1267
+ ["result.records.**.end", { datetime: true }],
1268
+ ["result.records.*.start", { datetime: true }],
1269
+ ["result.records.*.end", { datetime: true }],
1270
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1271
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1272
+ ]);
4201
1273
  } catch (err) {
4202
- throw new import_shared_errors5.InvalidResponseError(
1274
+ throw new import_shared_errors4.InvalidResponseError(
4203
1275
  `QueryExecutionClient.query:execute:${response.status}`,
4204
1276
  err,
4205
1277
  responseValue,
@@ -4212,9 +1284,18 @@ var QueryExecutionClient = class {
4212
1284
  case 202: {
4213
1285
  const responseValue = await response.body("json");
4214
1286
  try {
4215
- return fromJson40(responseValue);
1287
+ return transformResponse(responseValue, [
1288
+ ["result.records.*.start", { datetime: true }],
1289
+ ["result.records.*.end", { datetime: true }],
1290
+ ["result.records.**.start", { datetime: true }],
1291
+ ["result.records.**.end", { datetime: true }],
1292
+ ["result.records.*.start", { datetime: true }],
1293
+ ["result.records.*.end", { datetime: true }],
1294
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1295
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1296
+ ]);
4216
1297
  } catch (err) {
4217
- throw new import_shared_errors5.InvalidResponseError(
1298
+ throw new import_shared_errors4.InvalidResponseError(
4218
1299
  `QueryExecutionClient.query:execute:${response.status}`,
4219
1300
  err,
4220
1301
  responseValue,
@@ -4227,7 +1308,7 @@ var QueryExecutionClient = class {
4227
1308
  default: {
4228
1309
  try {
4229
1310
  const responseValue = await response.body("json");
4230
- throw new import_shared_errors5.ClientRequestError(
1311
+ throw new import_shared_errors4.ClientRequestError(
4231
1312
  `${response.status}`,
4232
1313
  response,
4233
1314
  responseValue,
@@ -4237,11 +1318,11 @@ var QueryExecutionClient = class {
4237
1318
  )
4238
1319
  );
4239
1320
  } catch (error) {
4240
- if (error instanceof import_shared_errors5.ClientRequestError) {
1321
+ if (error instanceof import_shared_errors4.ClientRequestError) {
4241
1322
  throw error;
4242
1323
  }
4243
1324
  const responseValue = await response.body("text").catch(() => "");
4244
- throw new import_shared_errors5.InvalidResponseError(
1325
+ throw new import_shared_errors4.InvalidResponseError(
4245
1326
  `${response.status}`,
4246
1327
  error,
4247
1328
  responseValue,
@@ -4253,19 +1334,19 @@ var QueryExecutionClient = class {
4253
1334
  }
4254
1335
  }
4255
1336
  } catch (e) {
4256
- if ((0, import_http_client2.isHttpClientAbortError)(e) || (0, import_shared_errors5.isInvalidResponseError)(e) || (0, import_shared_errors5.isClientRequestError)(e)) {
1337
+ if ((0, import_http_client2.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e) || (0, import_shared_errors4.isClientRequestError)(e)) {
4257
1338
  throw e;
4258
1339
  }
4259
1340
  if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
4260
- throw new import_shared_errors5.ApiClientError("UnexpectedError", "Unexpected error", e);
1341
+ throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e);
4261
1342
  }
4262
1343
  const response = e.response;
4263
- apiGatewayErrorsHandler(response);
1344
+ await apiGatewayErrorsHandler(response);
4264
1345
  switch (response.status) {
4265
1346
  case 400: {
4266
1347
  const responseValue = await response.body("json");
4267
1348
  try {
4268
- const errorBody = fromJson17(responseValue);
1349
+ const errorBody = transformResponse(responseValue, []);
4269
1350
  throw new ErrorEnvelopeError(
4270
1351
  `400`,
4271
1352
  response,
@@ -4280,7 +1361,7 @@ var QueryExecutionClient = class {
4280
1361
  if (err instanceof ErrorEnvelopeError) {
4281
1362
  throw err;
4282
1363
  }
4283
- throw new import_shared_errors5.InvalidResponseError(
1364
+ throw new import_shared_errors4.InvalidResponseError(
4284
1365
  `QueryExecutionClient.query:execute:400`,
4285
1366
  err,
4286
1367
  responseValue,
@@ -4293,7 +1374,7 @@ var QueryExecutionClient = class {
4293
1374
  case 403: {
4294
1375
  const responseValue = await response.body("json");
4295
1376
  try {
4296
- const errorBody = fromJson17(responseValue);
1377
+ const errorBody = transformResponse(responseValue, []);
4297
1378
  throw new InsufficientPermission(
4298
1379
  `403`,
4299
1380
  response,
@@ -4305,7 +1386,7 @@ var QueryExecutionClient = class {
4305
1386
  if (err instanceof InsufficientPermission) {
4306
1387
  throw err;
4307
1388
  }
4308
- throw new import_shared_errors5.InvalidResponseError(
1389
+ throw new import_shared_errors4.InvalidResponseError(
4309
1390
  `QueryExecutionClient.query:execute:403`,
4310
1391
  err,
4311
1392
  responseValue,
@@ -4318,7 +1399,7 @@ var QueryExecutionClient = class {
4318
1399
  case 429: {
4319
1400
  const responseValue = await response.body("json");
4320
1401
  try {
4321
- const errorBody = fromJson17(responseValue);
1402
+ const errorBody = transformResponse(responseValue, []);
4322
1403
  throw new ErrorEnvelopeError(
4323
1404
  `429`,
4324
1405
  response,
@@ -4330,7 +1411,7 @@ var QueryExecutionClient = class {
4330
1411
  if (err instanceof ErrorEnvelopeError) {
4331
1412
  throw err;
4332
1413
  }
4333
- throw new import_shared_errors5.InvalidResponseError(
1414
+ throw new import_shared_errors4.InvalidResponseError(
4334
1415
  `QueryExecutionClient.query:execute:429`,
4335
1416
  err,
4336
1417
  responseValue,
@@ -4343,7 +1424,7 @@ var QueryExecutionClient = class {
4343
1424
  case 500: {
4344
1425
  const responseValue = await response.body("json");
4345
1426
  try {
4346
- const errorBody = fromJson17(responseValue);
1427
+ const errorBody = transformResponse(responseValue, []);
4347
1428
  throw new ErrorEnvelopeError(
4348
1429
  `500`,
4349
1430
  response,
@@ -4355,7 +1436,7 @@ var QueryExecutionClient = class {
4355
1436
  if (err instanceof ErrorEnvelopeError) {
4356
1437
  throw err;
4357
1438
  }
4358
- throw new import_shared_errors5.InvalidResponseError(
1439
+ throw new import_shared_errors4.InvalidResponseError(
4359
1440
  `QueryExecutionClient.query:execute:500`,
4360
1441
  err,
4361
1442
  responseValue,
@@ -4368,7 +1449,7 @@ var QueryExecutionClient = class {
4368
1449
  case 503: {
4369
1450
  const responseValue = await response.body("json");
4370
1451
  try {
4371
- const errorBody = fromJson17(responseValue);
1452
+ const errorBody = transformResponse(responseValue, []);
4372
1453
  throw new ErrorEnvelopeError(
4373
1454
  `503`,
4374
1455
  response,
@@ -4380,7 +1461,7 @@ var QueryExecutionClient = class {
4380
1461
  if (err instanceof ErrorEnvelopeError) {
4381
1462
  throw err;
4382
1463
  }
4383
- throw new import_shared_errors5.InvalidResponseError(
1464
+ throw new import_shared_errors4.InvalidResponseError(
4384
1465
  `QueryExecutionClient.query:execute:503`,
4385
1466
  err,
4386
1467
  responseValue,
@@ -4394,7 +1475,7 @@ var QueryExecutionClient = class {
4394
1475
  if (response.status >= 400 && response.status <= 499) {
4395
1476
  const responseValue = await response.body("json");
4396
1477
  try {
4397
- const errorBody = fromJson17(responseValue);
1478
+ const errorBody = transformResponse(responseValue, []);
4398
1479
  throw new ErrorEnvelopeError(
4399
1480
  `${response.status}`,
4400
1481
  response,
@@ -4406,7 +1487,7 @@ var QueryExecutionClient = class {
4406
1487
  if (err instanceof ErrorEnvelopeError) {
4407
1488
  throw err;
4408
1489
  }
4409
- throw new import_shared_errors5.InvalidResponseError(
1490
+ throw new import_shared_errors4.InvalidResponseError(
4410
1491
  `QueryExecutionClient.query:execute:${response.status}`,
4411
1492
  err,
4412
1493
  responseValue,
@@ -4418,7 +1499,7 @@ var QueryExecutionClient = class {
4418
1499
  } else if (response.status >= 500 && response.status <= 599) {
4419
1500
  const responseValue = await response.body("json");
4420
1501
  try {
4421
- const errorBody = fromJson17(responseValue);
1502
+ const errorBody = transformResponse(responseValue, []);
4422
1503
  throw new ErrorEnvelopeError(
4423
1504
  `${response.status}`,
4424
1505
  response,
@@ -4430,7 +1511,7 @@ var QueryExecutionClient = class {
4430
1511
  if (err instanceof ErrorEnvelopeError) {
4431
1512
  throw err;
4432
1513
  }
4433
- throw new import_shared_errors5.InvalidResponseError(
1514
+ throw new import_shared_errors4.InvalidResponseError(
4434
1515
  `QueryExecutionClient.query:execute:${response.status}`,
4435
1516
  err,
4436
1517
  responseValue,
@@ -4442,7 +1523,7 @@ var QueryExecutionClient = class {
4442
1523
  } else {
4443
1524
  try {
4444
1525
  const responseValue = await response.body("json");
4445
- throw new import_shared_errors5.ClientRequestError(
1526
+ throw new import_shared_errors4.ClientRequestError(
4446
1527
  `${response.status}`,
4447
1528
  response,
4448
1529
  responseValue,
@@ -4452,11 +1533,11 @@ var QueryExecutionClient = class {
4452
1533
  )
4453
1534
  );
4454
1535
  } catch (error) {
4455
- if (error instanceof import_shared_errors5.ClientRequestError) {
1536
+ if (error instanceof import_shared_errors4.ClientRequestError) {
4456
1537
  throw error;
4457
1538
  }
4458
1539
  const responseValue = await response.body("text").catch(() => "");
4459
- throw new import_shared_errors5.InvalidResponseError(
1540
+ throw new import_shared_errors4.InvalidResponseError(
4460
1541
  `${response.status}`,
4461
1542
  error,
4462
1543
  responseValue,
@@ -4524,7 +1605,7 @@ var QueryExecutionClient = class {
4524
1605
  */
4525
1606
  async queryCancel(config) {
4526
1607
  if (!config) {
4527
- throw new import_shared_errors5.ApiClientError("API client error", "API client call is missing mandatory config parameter");
1608
+ throw new import_shared_errors4.ApiClientError("API client error", "API client call is missing mandatory config parameter");
4528
1609
  }
4529
1610
  const query = toQueryString(
4530
1611
  { "request-token": config.requestToken, enrich: config.enrich },
@@ -4546,9 +1627,18 @@ var QueryExecutionClient = class {
4546
1627
  case 200: {
4547
1628
  const responseValue = await response.body("json");
4548
1629
  try {
4549
- return fromJson39(responseValue);
1630
+ return transformResponse(responseValue, [
1631
+ ["result.records.*.start", { datetime: true }],
1632
+ ["result.records.*.end", { datetime: true }],
1633
+ ["result.records.**.start", { datetime: true }],
1634
+ ["result.records.**.end", { datetime: true }],
1635
+ ["result.records.*.start", { datetime: true }],
1636
+ ["result.records.*.end", { datetime: true }],
1637
+ ["result.metadata.grail.analysisTimeframe.start", { datetime: true }],
1638
+ ["result.metadata.grail.analysisTimeframe.end", { datetime: true }]
1639
+ ]);
4550
1640
  } catch (err) {
4551
- throw new import_shared_errors5.InvalidResponseError(
1641
+ throw new import_shared_errors4.InvalidResponseError(
4552
1642
  `QueryExecutionClient.query:cancel:${response.status}`,
4553
1643
  err,
4554
1644
  responseValue,
@@ -4564,7 +1654,7 @@ var QueryExecutionClient = class {
4564
1654
  default: {
4565
1655
  try {
4566
1656
  const responseValue = await response.body("json");
4567
- throw new import_shared_errors5.ClientRequestError(
1657
+ throw new import_shared_errors4.ClientRequestError(
4568
1658
  `${response.status}`,
4569
1659
  response,
4570
1660
  responseValue,
@@ -4574,11 +1664,11 @@ var QueryExecutionClient = class {
4574
1664
  )
4575
1665
  );
4576
1666
  } catch (error) {
4577
- if (error instanceof import_shared_errors5.ClientRequestError) {
1667
+ if (error instanceof import_shared_errors4.ClientRequestError) {
4578
1668
  throw error;
4579
1669
  }
4580
1670
  const responseValue = await response.body("text").catch(() => "");
4581
- throw new import_shared_errors5.InvalidResponseError(
1671
+ throw new import_shared_errors4.InvalidResponseError(
4582
1672
  `${response.status}`,
4583
1673
  error,
4584
1674
  responseValue,
@@ -4590,19 +1680,19 @@ var QueryExecutionClient = class {
4590
1680
  }
4591
1681
  }
4592
1682
  } catch (e) {
4593
- if ((0, import_http_client2.isHttpClientAbortError)(e) || (0, import_shared_errors5.isInvalidResponseError)(e) || (0, import_shared_errors5.isClientRequestError)(e)) {
1683
+ if ((0, import_http_client2.isHttpClientAbortError)(e) || (0, import_shared_errors4.isInvalidResponseError)(e) || (0, import_shared_errors4.isClientRequestError)(e)) {
4594
1684
  throw e;
4595
1685
  }
4596
1686
  if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
4597
- throw new import_shared_errors5.ApiClientError("UnexpectedError", "Unexpected error", e);
1687
+ throw new import_shared_errors4.ApiClientError("UnexpectedError", "Unexpected error", e);
4598
1688
  }
4599
1689
  const response = e.response;
4600
- apiGatewayErrorsHandler(response);
1690
+ await apiGatewayErrorsHandler(response);
4601
1691
  switch (response.status) {
4602
1692
  case 400: {
4603
1693
  const responseValue = await response.body("json");
4604
1694
  try {
4605
- const errorBody = fromJson17(responseValue);
1695
+ const errorBody = transformResponse(responseValue, []);
4606
1696
  throw new ErrorEnvelopeError(
4607
1697
  `400`,
4608
1698
  response,
@@ -4617,7 +1707,7 @@ var QueryExecutionClient = class {
4617
1707
  if (err instanceof ErrorEnvelopeError) {
4618
1708
  throw err;
4619
1709
  }
4620
- throw new import_shared_errors5.InvalidResponseError(
1710
+ throw new import_shared_errors4.InvalidResponseError(
4621
1711
  `QueryExecutionClient.query:cancel:400`,
4622
1712
  err,
4623
1713
  responseValue,
@@ -4631,7 +1721,7 @@ var QueryExecutionClient = class {
4631
1721
  const contentType = response.headers["content-type"];
4632
1722
  const encoding = mimeTypeToEncoding(contentType, "text" /* Text */);
4633
1723
  const responseValue = await response.body(encoding);
4634
- throw new import_shared_errors5.ClientRequestError(
1724
+ throw new import_shared_errors4.ClientRequestError(
4635
1725
  `410`,
4636
1726
  response,
4637
1727
  responseValue,
@@ -4641,7 +1731,7 @@ var QueryExecutionClient = class {
4641
1731
  case 500: {
4642
1732
  const responseValue = await response.body("json");
4643
1733
  try {
4644
- const errorBody = fromJson17(responseValue);
1734
+ const errorBody = transformResponse(responseValue, []);
4645
1735
  throw new ErrorEnvelopeError(
4646
1736
  `500`,
4647
1737
  response,
@@ -4653,7 +1743,7 @@ var QueryExecutionClient = class {
4653
1743
  if (err instanceof ErrorEnvelopeError) {
4654
1744
  throw err;
4655
1745
  }
4656
- throw new import_shared_errors5.InvalidResponseError(
1746
+ throw new import_shared_errors4.InvalidResponseError(
4657
1747
  `QueryExecutionClient.query:cancel:500`,
4658
1748
  err,
4659
1749
  responseValue,
@@ -4666,7 +1756,7 @@ var QueryExecutionClient = class {
4666
1756
  default: {
4667
1757
  try {
4668
1758
  const responseValue = await response.body("json");
4669
- throw new import_shared_errors5.ClientRequestError(
1759
+ throw new import_shared_errors4.ClientRequestError(
4670
1760
  `${response.status}`,
4671
1761
  response,
4672
1762
  responseValue,
@@ -4677,11 +1767,11 @@ var QueryExecutionClient = class {
4677
1767
  e
4678
1768
  );
4679
1769
  } catch (error) {
4680
- if (error instanceof import_shared_errors5.ClientRequestError) {
1770
+ if (error instanceof import_shared_errors4.ClientRequestError) {
4681
1771
  throw error;
4682
1772
  }
4683
1773
  const responseValue = await response.body("text").catch(() => "");
4684
- throw new import_shared_errors5.InvalidResponseError(
1774
+ throw new import_shared_errors4.InvalidResponseError(
4685
1775
  `${response.status}`,
4686
1776
  error,
4687
1777
  responseValue,
@@ -4698,7 +1788,7 @@ var QueryExecutionClient = class {
4698
1788
  var queryExecutionClient = /* @__PURE__ */ new QueryExecutionClient(import_http_client2.httpClient);
4699
1789
 
4700
1790
  // packages/client/query/src/lib/error-envelopes/index.ts
4701
- var import_shared_errors6 = require("@dynatrace-sdk/shared-errors");
1791
+ var import_shared_errors5 = require("@dynatrace-sdk/shared-errors");
4702
1792
 
4703
1793
  // packages/client/query/src/lib/models/dql-node-node-type.ts
4704
1794
  var DQLNodeNodeType = /* @__PURE__ */ ((DQLNodeNodeType2) => {
@@ -4768,6 +1858,7 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
4768
1858
  TokenType2["TimeseriesAggregation"] = "TIMESERIES_AGGREGATION";
4769
1859
  TokenType2["TimeseriesAggregationExpression"] = "TIMESERIES_AGGREGATION_EXPRESSION";
4770
1860
  TokenType2["Operator"] = "OPERATOR";
1861
+ TokenType2["SearchOperator"] = "SEARCH_OPERATOR";
4771
1862
  TokenType2["TraversalOperator"] = "TRAVERSAL_OPERATOR";
4772
1863
  TokenType2["TraversalRelationName"] = "TRAVERSAL_RELATION_NAME";
4773
1864
  TokenType2["TraversalHopCount"] = "TRAVERSAL_HOP_COUNT";
@@ -4783,7 +1874,10 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
4783
1874
  TokenType2["UidValue"] = "UID_VALUE";
4784
1875
  TokenType2["ParsePattern"] = "PARSE_PATTERN";
4785
1876
  TokenType2["FieldPattern"] = "FIELD_PATTERN";
1877
+ TokenType2["SearchPattern"] = "SEARCH_PATTERN";
4786
1878
  TokenType2["EntitySelectorPart"] = "ENTITY_SELECTOR_PART";
1879
+ TokenType2["SavedTableName"] = "SAVED_TABLE_NAME";
1880
+ TokenType2["ParameterModifier"] = "PARAMETER_MODIFIER";
4787
1881
  TokenType2["FieldModifier"] = "FIELD_MODIFIER";
4788
1882
  TokenType2["EntityType"] = "ENTITY_TYPE";
4789
1883
  TokenType2["EntityAttribute"] = "ENTITY_ATTRIBUTE";