@dynatrace-sdk/client-query 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/cjs/index.js +43 -39
- package/docs/DOCS.md +10 -8
- package/dynatrace-metadata.json +3 -3
- package/esm/index.js +49 -39
- package/package.json +3 -2
- package/types/packages/client/query/src/lib/apis/query-assistance-api.d.ts +3 -3
- package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +3 -3
- package/types/packages/client/query/src/lib/models/execute-request.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/metric-metadata.d.ts +8 -0
- package/types/packages/client/query/src/lib/models/metric-metadata.transformation.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
@dynatrace-sdk/client-query
|
|
4
4
|
|
|
5
|
+
## 1.8.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- `rollup` and `rate` properties were added to the `MetricMetadata` object
|
|
10
|
+
|
|
11
|
+
## 1.7.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Fixed a bug that caused abort errors from http-client to be wrapped in ApiClientError('UnexpectedError').
|
|
16
|
+
|
|
17
|
+
## 1.7.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Update dependencies.
|
|
22
|
+
|
|
5
23
|
## 1.7.0
|
|
6
24
|
|
|
7
25
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dynatrace-sdk/client-query
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.8.0)
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
5
|
|
|
6
6
|
Exposes an API to fetch records stored in Grail
|
package/cjs/index.js
CHANGED
|
@@ -88,45 +88,28 @@ module.exports = __toCommonJS(src_exports);
|
|
|
88
88
|
// packages/client/query/src/lib/apis/query-assistance-api.ts
|
|
89
89
|
var import_http_client = require("@dynatrace-sdk/http-client");
|
|
90
90
|
|
|
91
|
-
// packages/platform/shared/utils/get-global-with-dt-runtime.ts
|
|
92
|
-
var getGlobalWithDtRuntime = () => typeof globalThis !== "undefined" ? globalThis : window;
|
|
93
|
-
|
|
94
|
-
// packages/platform/error-handlers/src/lib/add-global-error-serializer.ts
|
|
95
|
-
function addGlobalErrorSerializer(serializer) {
|
|
96
|
-
const addGlobalErrorSerializerFunc = getAddGlobalErrorSerializer();
|
|
97
|
-
if (typeof addGlobalErrorSerializerFunc === "function") {
|
|
98
|
-
addGlobalErrorSerializerFunc(serializer);
|
|
99
|
-
} else {
|
|
100
|
-
console.warn("Missing addGlobalErrorSerializer function from sdk-web-runtime.");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function isGlobalErrorSerializerSupported() {
|
|
104
|
-
return typeof getAddGlobalErrorSerializer() === "function";
|
|
105
|
-
}
|
|
106
|
-
function getAddGlobalErrorSerializer() {
|
|
107
|
-
return getGlobalWithDtRuntime().dtRuntime?.errorHandlers?.addGlobalErrorSerializer;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
91
|
// packages/client/query/src/lib/error-envelopes/api-client-error.ts
|
|
92
|
+
var import_error_handlers = require("@dynatrace-sdk/error-handlers");
|
|
111
93
|
var ApiClientError = class extends Error {
|
|
112
94
|
constructor(name, message, cause) {
|
|
113
95
|
super(message);
|
|
114
96
|
this.cause = cause;
|
|
115
97
|
this.name = name;
|
|
116
98
|
}
|
|
117
|
-
errorType =
|
|
99
|
+
errorType = import_error_handlers.ErrorType.COMMON;
|
|
118
100
|
};
|
|
119
101
|
function isApiClientError(e) {
|
|
120
102
|
return e instanceof ApiClientError;
|
|
121
103
|
}
|
|
122
104
|
|
|
123
105
|
// packages/client/query/src/lib/error-envelopes/client-request-error.ts
|
|
106
|
+
var import_error_handlers2 = require("@dynatrace-sdk/error-handlers");
|
|
124
107
|
var ClientRequestError = class extends ApiClientError {
|
|
125
108
|
body;
|
|
126
109
|
response;
|
|
127
110
|
constructor(name, response, body, message, cause) {
|
|
128
111
|
super(name, message, cause);
|
|
129
|
-
this.errorType =
|
|
112
|
+
this.errorType = import_error_handlers2.ErrorType.HTTP;
|
|
130
113
|
this.body = body;
|
|
131
114
|
this.response = response;
|
|
132
115
|
}
|
|
@@ -143,6 +126,7 @@ function isErrorEnvelopeError(e) {
|
|
|
143
126
|
}
|
|
144
127
|
|
|
145
128
|
// packages/client/query/src/lib/error-envelopes/error-serializer.ts
|
|
129
|
+
var import_error_handlers3 = require("@dynatrace-sdk/error-handlers");
|
|
146
130
|
var apiClientErrorSerializer = async (error) => {
|
|
147
131
|
if (isClientRequestError(error)) {
|
|
148
132
|
const status = error.response.status;
|
|
@@ -152,7 +136,7 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
152
136
|
status,
|
|
153
137
|
message,
|
|
154
138
|
stack: error.stack,
|
|
155
|
-
type:
|
|
139
|
+
type: import_error_handlers3.ErrorType.HTTP,
|
|
156
140
|
body: error.body,
|
|
157
141
|
cause: error.cause,
|
|
158
142
|
...getOptionalErrorRef(error.body)
|
|
@@ -162,16 +146,16 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
162
146
|
name: error.name,
|
|
163
147
|
message: error.message,
|
|
164
148
|
stack: error.stack,
|
|
165
|
-
type:
|
|
149
|
+
type: import_error_handlers3.ErrorType.COMMON,
|
|
166
150
|
cause: error.cause
|
|
167
151
|
};
|
|
168
152
|
}
|
|
169
153
|
};
|
|
170
154
|
var errorSerializerAdded = false;
|
|
171
155
|
function registerGlobalErrorSerializer(serializer) {
|
|
172
|
-
if (!errorSerializerAdded && isGlobalErrorSerializerSupported()) {
|
|
156
|
+
if (!errorSerializerAdded && (0, import_error_handlers3.isGlobalErrorSerializerSupported)()) {
|
|
173
157
|
errorSerializerAdded = true;
|
|
174
|
-
addGlobalErrorSerializer(serializer);
|
|
158
|
+
(0, import_error_handlers3.addGlobalErrorSerializer)(serializer);
|
|
175
159
|
}
|
|
176
160
|
}
|
|
177
161
|
function getOptionalErrorRef(body) {
|
|
@@ -1595,7 +1579,7 @@ var QueryAssistanceClient = class {
|
|
|
1595
1579
|
);
|
|
1596
1580
|
}
|
|
1597
1581
|
} catch (e) {
|
|
1598
|
-
if (isInvalidResponseError(e)) {
|
|
1582
|
+
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) {
|
|
1599
1583
|
throw e;
|
|
1600
1584
|
}
|
|
1601
1585
|
if (!(0, import_http_client.isHttpClientResponseError)(e)) {
|
|
@@ -1701,7 +1685,7 @@ var QueryAssistanceClient = class {
|
|
|
1701
1685
|
);
|
|
1702
1686
|
}
|
|
1703
1687
|
} catch (e) {
|
|
1704
|
-
if (isInvalidResponseError(e)) {
|
|
1688
|
+
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) {
|
|
1705
1689
|
throw e;
|
|
1706
1690
|
}
|
|
1707
1691
|
if (!(0, import_http_client.isHttpClientResponseError)(e)) {
|
|
@@ -1810,7 +1794,7 @@ var QueryAssistanceClient = class {
|
|
|
1810
1794
|
);
|
|
1811
1795
|
}
|
|
1812
1796
|
} catch (e) {
|
|
1813
|
-
if (isInvalidResponseError(e)) {
|
|
1797
|
+
if ((0, import_http_client.isHttpClientAbortError)(e) || isInvalidResponseError(e)) {
|
|
1814
1798
|
throw e;
|
|
1815
1799
|
}
|
|
1816
1800
|
if (!(0, import_http_client.isHttpClientResponseError)(e)) {
|
|
@@ -2318,10 +2302,18 @@ function isMetricMetadata(value) {
|
|
|
2318
2302
|
if (Array.isArray(value)) {
|
|
2319
2303
|
return false;
|
|
2320
2304
|
}
|
|
2321
|
-
const modelKeys = /* @__PURE__ */ new Set([
|
|
2305
|
+
const modelKeys = /* @__PURE__ */ new Set([
|
|
2306
|
+
"metric.key",
|
|
2307
|
+
"displayName",
|
|
2308
|
+
"description",
|
|
2309
|
+
"unit",
|
|
2310
|
+
"fieldName",
|
|
2311
|
+
"rollup",
|
|
2312
|
+
"rate"
|
|
2313
|
+
]);
|
|
2322
2314
|
const hasAdditionalProperties = false;
|
|
2323
2315
|
const requiredKeys = [];
|
|
2324
|
-
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName"];
|
|
2316
|
+
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName", "rollup", "rate"];
|
|
2325
2317
|
const valKeys = new Set(Object.keys(value));
|
|
2326
2318
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
2327
2319
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -2338,10 +2330,18 @@ function isJson23(value) {
|
|
|
2338
2330
|
if (Array.isArray(value)) {
|
|
2339
2331
|
return false;
|
|
2340
2332
|
}
|
|
2341
|
-
const modelKeys = /* @__PURE__ */ new Set([
|
|
2333
|
+
const modelKeys = /* @__PURE__ */ new Set([
|
|
2334
|
+
"metric.key",
|
|
2335
|
+
"displayName",
|
|
2336
|
+
"description",
|
|
2337
|
+
"unit",
|
|
2338
|
+
"fieldName",
|
|
2339
|
+
"rollup",
|
|
2340
|
+
"rate"
|
|
2341
|
+
]);
|
|
2342
2342
|
const hasAdditionalProperties = false;
|
|
2343
2343
|
const requiredKeys = [];
|
|
2344
|
-
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName"];
|
|
2344
|
+
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName", "rollup", "rate"];
|
|
2345
2345
|
const valKeys = new Set(Object.keys(value));
|
|
2346
2346
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
2347
2347
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -2349,23 +2349,27 @@ function isJson23(value) {
|
|
|
2349
2349
|
return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
|
|
2350
2350
|
}
|
|
2351
2351
|
function fromJson23($model) {
|
|
2352
|
-
const { "metric.key": metricKey, displayName, description, unit, fieldName } = $model;
|
|
2352
|
+
const { "metric.key": metricKey, displayName, description, unit, fieldName, rollup, rate } = $model;
|
|
2353
2353
|
return {
|
|
2354
2354
|
"metric.key": metricKey,
|
|
2355
2355
|
displayName,
|
|
2356
2356
|
description,
|
|
2357
2357
|
unit,
|
|
2358
|
-
fieldName
|
|
2358
|
+
fieldName,
|
|
2359
|
+
rollup,
|
|
2360
|
+
rate
|
|
2359
2361
|
};
|
|
2360
2362
|
}
|
|
2361
2363
|
function toJson23($model) {
|
|
2362
|
-
const { "metric.key": metricKey, displayName, description, unit, fieldName } = $model;
|
|
2364
|
+
const { "metric.key": metricKey, displayName, description, unit, fieldName, rollup, rate } = $model;
|
|
2363
2365
|
return {
|
|
2364
2366
|
"metric.key": metricKey,
|
|
2365
2367
|
displayName,
|
|
2366
2368
|
description,
|
|
2367
2369
|
unit,
|
|
2368
|
-
fieldName
|
|
2370
|
+
fieldName,
|
|
2371
|
+
rollup,
|
|
2372
|
+
rate
|
|
2369
2373
|
};
|
|
2370
2374
|
}
|
|
2371
2375
|
|
|
@@ -3182,7 +3186,7 @@ var QueryExecutionClient = class {
|
|
|
3182
3186
|
throw new InvalidResponseError(`QueryExecutionClient.query:poll:200`, err, responseValue, void 0, void 0);
|
|
3183
3187
|
}
|
|
3184
3188
|
} catch (e) {
|
|
3185
|
-
if (isInvalidResponseError(e)) {
|
|
3189
|
+
if ((0, import_http_client2.isHttpClientAbortError)(e) || isInvalidResponseError(e)) {
|
|
3186
3190
|
throw e;
|
|
3187
3191
|
}
|
|
3188
3192
|
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
@@ -3328,7 +3332,7 @@ var QueryExecutionClient = class {
|
|
|
3328
3332
|
}
|
|
3329
3333
|
}
|
|
3330
3334
|
} catch (e) {
|
|
3331
|
-
if (
|
|
3335
|
+
if ((0, import_http_client2.isHttpClientAbortError)(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3332
3336
|
throw e;
|
|
3333
3337
|
}
|
|
3334
3338
|
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
@@ -3556,7 +3560,7 @@ var QueryExecutionClient = class {
|
|
|
3556
3560
|
}
|
|
3557
3561
|
}
|
|
3558
3562
|
} catch (e) {
|
|
3559
|
-
if (
|
|
3563
|
+
if ((0, import_http_client2.isHttpClientAbortError)(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3560
3564
|
throw e;
|
|
3561
3565
|
}
|
|
3562
3566
|
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
package/docs/DOCS.md
CHANGED
|
@@ -17,7 +17,7 @@ import NpmLogo from '@site/static/img/npm-logo.png';
|
|
|
17
17
|
</a>
|
|
18
18
|
</div>
|
|
19
19
|
<div class="col" style={{textAlign: 'right'}}>
|
|
20
|
-
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.
|
|
20
|
+
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.8.0">v1.8.0</a>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
@@ -40,7 +40,7 @@ import { queryAssistanceClient } from "@dynatrace-sdk/client-query";
|
|
|
40
40
|
|
|
41
41
|
Get a structured list of suggestions for the query at the given position.
|
|
42
42
|
|
|
43
|
-
For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
43
|
+
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).
|
|
44
44
|
|
|
45
45
|
<h2> Overview</h2>
|
|
46
46
|
|
|
@@ -119,7 +119,7 @@ const data = await queryAssistanceClient.queryAutocomplete({
|
|
|
119
119
|
|
|
120
120
|
Get a structured tree of the canonical form of the query.
|
|
121
121
|
|
|
122
|
-
For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
122
|
+
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).
|
|
123
123
|
|
|
124
124
|
<h2> Overview</h2>
|
|
125
125
|
|
|
@@ -354,7 +354,7 @@ const data = await queryAssistanceClient.queryParse({
|
|
|
354
354
|
|
|
355
355
|
Verifies a query without executing it.
|
|
356
356
|
|
|
357
|
-
For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
357
|
+
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).
|
|
358
358
|
|
|
359
359
|
<h2> Overview</h2>
|
|
360
360
|
|
|
@@ -410,7 +410,7 @@ import { queryExecutionClient } from "@dynatrace-sdk/client-query";
|
|
|
410
410
|
|
|
411
411
|
Cancels the query and returns the result if the query was already finished, otherwise discards it.
|
|
412
412
|
|
|
413
|
-
For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
413
|
+
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).
|
|
414
414
|
|
|
415
415
|
<h3> Overview:</h3>
|
|
416
416
|
|
|
@@ -485,7 +485,7 @@ const data = await queryExecutionClient.queryCancel({
|
|
|
485
485
|
|
|
486
486
|
Starts a Grail query.
|
|
487
487
|
|
|
488
|
-
For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
488
|
+
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).
|
|
489
489
|
|
|
490
490
|
<h3> Overview:</h3>
|
|
491
491
|
|
|
@@ -565,7 +565,7 @@ const data = await queryExecutionClient.queryExecute({
|
|
|
565
565
|
|
|
566
566
|
Retrieves query status and final result from Grail.
|
|
567
567
|
|
|
568
|
-
For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
568
|
+
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).
|
|
569
569
|
|
|
570
570
|
<h3> Overview:</h3>
|
|
571
571
|
|
|
@@ -761,7 +761,7 @@ Detailed information about the error.
|
|
|
761
761
|
| defaultTimeframeEnd | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The query timeframe 'end' timestamp in ISO-8601 or RFC399 format. If the timeframe 'start' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em> |
|
|
762
762
|
| defaultTimeframeStart | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The query timeframe 'start' timestamp in ISO-8601 or RFC399 format. If the timeframe 'end' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em> |
|
|
763
763
|
| enablePreview | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Boolean">boolean</a> | Request preview results. If a preview is available within the requestTimeoutMilliseconds, then it will be returned as part of the response. |
|
|
764
|
-
| fetchTimeoutSeconds | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | The query will stop after reaching the fetch-timeout.
|
|
764
|
+
| fetchTimeoutSeconds | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | The query will stop reading data after reaching the fetch-timeout. The query execution will continue, providing a partial result based on the read data. |
|
|
765
765
|
| locale | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'. |
|
|
766
766
|
| maxResultBytes | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | The maximum number of result bytes that this query will return. |
|
|
767
767
|
| maxResultRecords | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | The maximum number of result records that this query will return. |
|
|
@@ -839,6 +839,8 @@ An object that defines additional metric metadata.
|
|
|
839
839
|
| displayName | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The display name of the metadata. |
|
|
840
840
|
| fieldName | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The name of the associated field used in the query. |
|
|
841
841
|
| metric.key | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The metric key. |
|
|
842
|
+
| rate | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The specified rate normalization parameter. |
|
|
843
|
+
| rollup | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Metadata about the rollup type. |
|
|
842
844
|
| unit | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | The unit used. |
|
|
843
845
|
|
|
844
846
|
### ParseRequest
|
package/dynatrace-metadata.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dynagen": {
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"generatedAt": "",
|
|
5
5
|
"template": {
|
|
6
6
|
"name": "@dynatrace-sdk/template-typescript-client",
|
|
7
|
-
"version": "0.18.
|
|
7
|
+
"version": "0.18.6"
|
|
8
8
|
},
|
|
9
9
|
"featureFlags": {
|
|
10
10
|
"typeguards": true
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"spec": {
|
|
14
14
|
"title": "DQL Query",
|
|
15
|
-
"version": "1.
|
|
15
|
+
"version": "1.7.0",
|
|
16
16
|
"baseUrl": "/platform/storage/query/v1"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/esm/index.js
CHANGED
|
@@ -22,48 +22,32 @@ var __export = (target, all) => {
|
|
|
22
22
|
// packages/client/query/src/lib/apis/query-assistance-api.ts
|
|
23
23
|
import {
|
|
24
24
|
httpClient as defaultHttpClient,
|
|
25
|
-
isHttpClientResponseError
|
|
25
|
+
isHttpClientResponseError,
|
|
26
|
+
isHttpClientAbortError
|
|
26
27
|
} from "@dynatrace-sdk/http-client";
|
|
27
28
|
|
|
28
|
-
// packages/platform/shared/utils/get-global-with-dt-runtime.ts
|
|
29
|
-
var getGlobalWithDtRuntime = () => typeof globalThis !== "undefined" ? globalThis : window;
|
|
30
|
-
|
|
31
|
-
// packages/platform/error-handlers/src/lib/add-global-error-serializer.ts
|
|
32
|
-
function addGlobalErrorSerializer(serializer) {
|
|
33
|
-
const addGlobalErrorSerializerFunc = getAddGlobalErrorSerializer();
|
|
34
|
-
if (typeof addGlobalErrorSerializerFunc === "function") {
|
|
35
|
-
addGlobalErrorSerializerFunc(serializer);
|
|
36
|
-
} else {
|
|
37
|
-
console.warn("Missing addGlobalErrorSerializer function from sdk-web-runtime.");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function isGlobalErrorSerializerSupported() {
|
|
41
|
-
return typeof getAddGlobalErrorSerializer() === "function";
|
|
42
|
-
}
|
|
43
|
-
function getAddGlobalErrorSerializer() {
|
|
44
|
-
return getGlobalWithDtRuntime().dtRuntime?.errorHandlers?.addGlobalErrorSerializer;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
29
|
// packages/client/query/src/lib/error-envelopes/api-client-error.ts
|
|
30
|
+
import { ErrorType } from "@dynatrace-sdk/error-handlers";
|
|
48
31
|
var ApiClientError = class extends Error {
|
|
49
32
|
constructor(name, message, cause) {
|
|
50
33
|
super(message);
|
|
51
34
|
this.cause = cause;
|
|
52
35
|
this.name = name;
|
|
53
36
|
}
|
|
54
|
-
errorType =
|
|
37
|
+
errorType = ErrorType.COMMON;
|
|
55
38
|
};
|
|
56
39
|
function isApiClientError(e) {
|
|
57
40
|
return e instanceof ApiClientError;
|
|
58
41
|
}
|
|
59
42
|
|
|
60
43
|
// packages/client/query/src/lib/error-envelopes/client-request-error.ts
|
|
44
|
+
import { ErrorType as ErrorType2 } from "@dynatrace-sdk/error-handlers";
|
|
61
45
|
var ClientRequestError = class extends ApiClientError {
|
|
62
46
|
body;
|
|
63
47
|
response;
|
|
64
48
|
constructor(name, response, body, message, cause) {
|
|
65
49
|
super(name, message, cause);
|
|
66
|
-
this.errorType =
|
|
50
|
+
this.errorType = ErrorType2.HTTP;
|
|
67
51
|
this.body = body;
|
|
68
52
|
this.response = response;
|
|
69
53
|
}
|
|
@@ -80,6 +64,11 @@ function isErrorEnvelopeError(e) {
|
|
|
80
64
|
}
|
|
81
65
|
|
|
82
66
|
// packages/client/query/src/lib/error-envelopes/error-serializer.ts
|
|
67
|
+
import {
|
|
68
|
+
ErrorType as ErrorType3,
|
|
69
|
+
addGlobalErrorSerializer,
|
|
70
|
+
isGlobalErrorSerializerSupported
|
|
71
|
+
} from "@dynatrace-sdk/error-handlers";
|
|
83
72
|
var apiClientErrorSerializer = async (error) => {
|
|
84
73
|
if (isClientRequestError(error)) {
|
|
85
74
|
const status = error.response.status;
|
|
@@ -89,7 +78,7 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
89
78
|
status,
|
|
90
79
|
message,
|
|
91
80
|
stack: error.stack,
|
|
92
|
-
type:
|
|
81
|
+
type: ErrorType3.HTTP,
|
|
93
82
|
body: error.body,
|
|
94
83
|
cause: error.cause,
|
|
95
84
|
...getOptionalErrorRef(error.body)
|
|
@@ -99,7 +88,7 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
99
88
|
name: error.name,
|
|
100
89
|
message: error.message,
|
|
101
90
|
stack: error.stack,
|
|
102
|
-
type:
|
|
91
|
+
type: ErrorType3.COMMON,
|
|
103
92
|
cause: error.cause
|
|
104
93
|
};
|
|
105
94
|
}
|
|
@@ -1532,7 +1521,7 @@ var QueryAssistanceClient = class {
|
|
|
1532
1521
|
);
|
|
1533
1522
|
}
|
|
1534
1523
|
} catch (e) {
|
|
1535
|
-
if (isInvalidResponseError(e)) {
|
|
1524
|
+
if (isHttpClientAbortError(e) || isInvalidResponseError(e)) {
|
|
1536
1525
|
throw e;
|
|
1537
1526
|
}
|
|
1538
1527
|
if (!isHttpClientResponseError(e)) {
|
|
@@ -1638,7 +1627,7 @@ var QueryAssistanceClient = class {
|
|
|
1638
1627
|
);
|
|
1639
1628
|
}
|
|
1640
1629
|
} catch (e) {
|
|
1641
|
-
if (isInvalidResponseError(e)) {
|
|
1630
|
+
if (isHttpClientAbortError(e) || isInvalidResponseError(e)) {
|
|
1642
1631
|
throw e;
|
|
1643
1632
|
}
|
|
1644
1633
|
if (!isHttpClientResponseError(e)) {
|
|
@@ -1747,7 +1736,7 @@ var QueryAssistanceClient = class {
|
|
|
1747
1736
|
);
|
|
1748
1737
|
}
|
|
1749
1738
|
} catch (e) {
|
|
1750
|
-
if (isInvalidResponseError(e)) {
|
|
1739
|
+
if (isHttpClientAbortError(e) || isInvalidResponseError(e)) {
|
|
1751
1740
|
throw e;
|
|
1752
1741
|
}
|
|
1753
1742
|
if (!isHttpClientResponseError(e)) {
|
|
@@ -1825,7 +1814,8 @@ var queryAssistanceClient = /* @__PURE__ */ new QueryAssistanceClient(defaultHtt
|
|
|
1825
1814
|
// packages/client/query/src/lib/apis/query-execution-api.ts
|
|
1826
1815
|
import {
|
|
1827
1816
|
httpClient as defaultHttpClient2,
|
|
1828
|
-
isHttpClientResponseError as isHttpClientResponseError2
|
|
1817
|
+
isHttpClientResponseError as isHttpClientResponseError2,
|
|
1818
|
+
isHttpClientAbortError as isHttpClientAbortError2
|
|
1829
1819
|
} from "@dynatrace-sdk/http-client";
|
|
1830
1820
|
|
|
1831
1821
|
// packages/client/query/src/lib/models/execute-request.transformation.ts
|
|
@@ -2258,10 +2248,18 @@ function isMetricMetadata(value) {
|
|
|
2258
2248
|
if (Array.isArray(value)) {
|
|
2259
2249
|
return false;
|
|
2260
2250
|
}
|
|
2261
|
-
const modelKeys = /* @__PURE__ */ new Set([
|
|
2251
|
+
const modelKeys = /* @__PURE__ */ new Set([
|
|
2252
|
+
"metric.key",
|
|
2253
|
+
"displayName",
|
|
2254
|
+
"description",
|
|
2255
|
+
"unit",
|
|
2256
|
+
"fieldName",
|
|
2257
|
+
"rollup",
|
|
2258
|
+
"rate"
|
|
2259
|
+
]);
|
|
2262
2260
|
const hasAdditionalProperties = false;
|
|
2263
2261
|
const requiredKeys = [];
|
|
2264
|
-
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName"];
|
|
2262
|
+
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName", "rollup", "rate"];
|
|
2265
2263
|
const valKeys = new Set(Object.keys(value));
|
|
2266
2264
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
2267
2265
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -2278,10 +2276,18 @@ function isJson23(value) {
|
|
|
2278
2276
|
if (Array.isArray(value)) {
|
|
2279
2277
|
return false;
|
|
2280
2278
|
}
|
|
2281
|
-
const modelKeys = /* @__PURE__ */ new Set([
|
|
2279
|
+
const modelKeys = /* @__PURE__ */ new Set([
|
|
2280
|
+
"metric.key",
|
|
2281
|
+
"displayName",
|
|
2282
|
+
"description",
|
|
2283
|
+
"unit",
|
|
2284
|
+
"fieldName",
|
|
2285
|
+
"rollup",
|
|
2286
|
+
"rate"
|
|
2287
|
+
]);
|
|
2282
2288
|
const hasAdditionalProperties = false;
|
|
2283
2289
|
const requiredKeys = [];
|
|
2284
|
-
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName"];
|
|
2290
|
+
const optionalKeys = ["metric.key", "displayName", "description", "unit", "fieldName", "rollup", "rate"];
|
|
2285
2291
|
const valKeys = new Set(Object.keys(value));
|
|
2286
2292
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
2287
2293
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -2289,23 +2295,27 @@ function isJson23(value) {
|
|
|
2289
2295
|
return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
|
|
2290
2296
|
}
|
|
2291
2297
|
function fromJson23($model) {
|
|
2292
|
-
const { "metric.key": metricKey, displayName, description, unit, fieldName } = $model;
|
|
2298
|
+
const { "metric.key": metricKey, displayName, description, unit, fieldName, rollup, rate } = $model;
|
|
2293
2299
|
return {
|
|
2294
2300
|
"metric.key": metricKey,
|
|
2295
2301
|
displayName,
|
|
2296
2302
|
description,
|
|
2297
2303
|
unit,
|
|
2298
|
-
fieldName
|
|
2304
|
+
fieldName,
|
|
2305
|
+
rollup,
|
|
2306
|
+
rate
|
|
2299
2307
|
};
|
|
2300
2308
|
}
|
|
2301
2309
|
function toJson23($model) {
|
|
2302
|
-
const { "metric.key": metricKey, displayName, description, unit, fieldName } = $model;
|
|
2310
|
+
const { "metric.key": metricKey, displayName, description, unit, fieldName, rollup, rate } = $model;
|
|
2303
2311
|
return {
|
|
2304
2312
|
"metric.key": metricKey,
|
|
2305
2313
|
displayName,
|
|
2306
2314
|
description,
|
|
2307
2315
|
unit,
|
|
2308
|
-
fieldName
|
|
2316
|
+
fieldName,
|
|
2317
|
+
rollup,
|
|
2318
|
+
rate
|
|
2309
2319
|
};
|
|
2310
2320
|
}
|
|
2311
2321
|
|
|
@@ -3122,7 +3132,7 @@ var QueryExecutionClient = class {
|
|
|
3122
3132
|
throw new InvalidResponseError(`QueryExecutionClient.query:poll:200`, err, responseValue, void 0, void 0);
|
|
3123
3133
|
}
|
|
3124
3134
|
} catch (e) {
|
|
3125
|
-
if (isInvalidResponseError(e)) {
|
|
3135
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e)) {
|
|
3126
3136
|
throw e;
|
|
3127
3137
|
}
|
|
3128
3138
|
if (!isHttpClientResponseError2(e)) {
|
|
@@ -3268,7 +3278,7 @@ var QueryExecutionClient = class {
|
|
|
3268
3278
|
}
|
|
3269
3279
|
}
|
|
3270
3280
|
} catch (e) {
|
|
3271
|
-
if (
|
|
3281
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3272
3282
|
throw e;
|
|
3273
3283
|
}
|
|
3274
3284
|
if (!isHttpClientResponseError2(e)) {
|
|
@@ -3496,7 +3506,7 @@ var QueryExecutionClient = class {
|
|
|
3496
3506
|
}
|
|
3497
3507
|
}
|
|
3498
3508
|
} catch (e) {
|
|
3499
|
-
if (
|
|
3509
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3500
3510
|
throw e;
|
|
3501
3511
|
}
|
|
3502
3512
|
if (!isHttpClientResponseError2(e)) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace-sdk/client-query",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Exposes an API to fetch records stored in Grail.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynatrace-sdk/
|
|
7
|
+
"@dynatrace-sdk/error-handlers": "^1.2.0",
|
|
8
|
+
"@dynatrace-sdk/http-client": "^1.0.9"
|
|
8
9
|
},
|
|
9
10
|
"main": "./cjs/index.js",
|
|
10
11
|
"module": "./esm/index.js",
|
|
@@ -19,7 +19,7 @@ export declare class QueryAssistanceClient {
|
|
|
19
19
|
/**
|
|
20
20
|
* Verifies a query without executing it.
|
|
21
21
|
*
|
|
22
|
-
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
22
|
+
* 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).
|
|
23
23
|
*
|
|
24
24
|
* ## Overview
|
|
25
25
|
*
|
|
@@ -46,7 +46,7 @@ export declare class QueryAssistanceClient {
|
|
|
46
46
|
/**
|
|
47
47
|
* Get a structured tree of the canonical form of the query.
|
|
48
48
|
*
|
|
49
|
-
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
49
|
+
* 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).
|
|
50
50
|
*
|
|
51
51
|
* ## Overview
|
|
52
52
|
*
|
|
@@ -258,7 +258,7 @@ export declare class QueryAssistanceClient {
|
|
|
258
258
|
/**
|
|
259
259
|
* Get a structured list of suggestions for the query at the given position.
|
|
260
260
|
*
|
|
261
|
-
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
261
|
+
* 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).
|
|
262
262
|
*
|
|
263
263
|
* ## Overview
|
|
264
264
|
*
|
|
@@ -16,7 +16,7 @@ export declare class QueryExecutionClient {
|
|
|
16
16
|
/**
|
|
17
17
|
* Retrieves query status and final result from Grail.
|
|
18
18
|
*
|
|
19
|
-
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
19
|
+
* 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).
|
|
20
20
|
*
|
|
21
21
|
* ### Overview:
|
|
22
22
|
*
|
|
@@ -67,7 +67,7 @@ export declare class QueryExecutionClient {
|
|
|
67
67
|
/**
|
|
68
68
|
* Starts a Grail query.
|
|
69
69
|
*
|
|
70
|
-
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
70
|
+
* 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).
|
|
71
71
|
*
|
|
72
72
|
* ### Overview:
|
|
73
73
|
*
|
|
@@ -124,7 +124,7 @@ export declare class QueryExecutionClient {
|
|
|
124
124
|
/**
|
|
125
125
|
* Cancels the query and returns the result if the query was already finished, otherwise discards it.
|
|
126
126
|
*
|
|
127
|
-
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://
|
|
127
|
+
* 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).
|
|
128
128
|
*
|
|
129
129
|
* ### Overview:
|
|
130
130
|
*
|
|
@@ -28,7 +28,7 @@ export interface ExecuteRequest {
|
|
|
28
28
|
*/
|
|
29
29
|
maxResultBytes?: number;
|
|
30
30
|
/**
|
|
31
|
-
* The query will stop after reaching the fetch-timeout.
|
|
31
|
+
* The query will stop reading data after reaching the fetch-timeout. The query execution will continue, providing a partial result based on the read data.
|
|
32
32
|
*/
|
|
33
33
|
fetchTimeoutSeconds?: number;
|
|
34
34
|
/**
|
|
@@ -22,4 +22,12 @@ export interface MetricMetadata {
|
|
|
22
22
|
* The name of the associated field used in the query.
|
|
23
23
|
*/
|
|
24
24
|
fieldName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Metadata about the rollup type.
|
|
27
|
+
*/
|
|
28
|
+
rollup?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The specified rate normalization parameter.
|
|
31
|
+
*/
|
|
32
|
+
rate?: string;
|
|
25
33
|
}
|
|
@@ -5,6 +5,8 @@ export interface AsJson {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
unit?: string;
|
|
7
7
|
fieldName?: string;
|
|
8
|
+
rollup?: string;
|
|
9
|
+
rate?: string;
|
|
8
10
|
}
|
|
9
11
|
export declare function isMetricMetadata(value: any): value is MetricMetadata;
|
|
10
12
|
export declare function isJson(value: any): value is AsJson;
|