@dynatrace-sdk/client-query 1.7.0 → 1.7.2
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 +12 -0
- package/README.md +1 -1
- package/cjs/index.js +15 -31
- package/docs/DOCS.md +1 -1
- package/dynatrace-metadata.json +1 -1
- package/esm/index.js +21 -31
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
@dynatrace-sdk/client-query
|
|
4
4
|
|
|
5
|
+
## 1.7.2
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- Fixed a bug that caused abort errors from http-client to be wrapped in ApiClientError('UnexpectedError').
|
|
10
|
+
|
|
11
|
+
## 1.7.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Update dependencies.
|
|
16
|
+
|
|
5
17
|
## 1.7.0
|
|
6
18
|
|
|
7
19
|
### 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.7.2)
|
|
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)) {
|
|
@@ -3182,7 +3166,7 @@ var QueryExecutionClient = class {
|
|
|
3182
3166
|
throw new InvalidResponseError(`QueryExecutionClient.query:poll:200`, err, responseValue, void 0, void 0);
|
|
3183
3167
|
}
|
|
3184
3168
|
} catch (e) {
|
|
3185
|
-
if (isInvalidResponseError(e)) {
|
|
3169
|
+
if ((0, import_http_client2.isHttpClientAbortError)(e) || isInvalidResponseError(e)) {
|
|
3186
3170
|
throw e;
|
|
3187
3171
|
}
|
|
3188
3172
|
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
@@ -3328,7 +3312,7 @@ var QueryExecutionClient = class {
|
|
|
3328
3312
|
}
|
|
3329
3313
|
}
|
|
3330
3314
|
} catch (e) {
|
|
3331
|
-
if (
|
|
3315
|
+
if ((0, import_http_client2.isHttpClientAbortError)(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3332
3316
|
throw e;
|
|
3333
3317
|
}
|
|
3334
3318
|
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
@@ -3556,7 +3540,7 @@ var QueryExecutionClient = class {
|
|
|
3556
3540
|
}
|
|
3557
3541
|
}
|
|
3558
3542
|
} catch (e) {
|
|
3559
|
-
if (
|
|
3543
|
+
if ((0, import_http_client2.isHttpClientAbortError)(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3560
3544
|
throw e;
|
|
3561
3545
|
}
|
|
3562
3546
|
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.7.
|
|
20
|
+
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.7.2">v1.7.2</a>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
|
package/dynatrace-metadata.json
CHANGED
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
|
|
@@ -3122,7 +3112,7 @@ var QueryExecutionClient = class {
|
|
|
3122
3112
|
throw new InvalidResponseError(`QueryExecutionClient.query:poll:200`, err, responseValue, void 0, void 0);
|
|
3123
3113
|
}
|
|
3124
3114
|
} catch (e) {
|
|
3125
|
-
if (isInvalidResponseError(e)) {
|
|
3115
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e)) {
|
|
3126
3116
|
throw e;
|
|
3127
3117
|
}
|
|
3128
3118
|
if (!isHttpClientResponseError2(e)) {
|
|
@@ -3268,7 +3258,7 @@ var QueryExecutionClient = class {
|
|
|
3268
3258
|
}
|
|
3269
3259
|
}
|
|
3270
3260
|
} catch (e) {
|
|
3271
|
-
if (
|
|
3261
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3272
3262
|
throw e;
|
|
3273
3263
|
}
|
|
3274
3264
|
if (!isHttpClientResponseError2(e)) {
|
|
@@ -3496,7 +3486,7 @@ var QueryExecutionClient = class {
|
|
|
3496
3486
|
}
|
|
3497
3487
|
}
|
|
3498
3488
|
} catch (e) {
|
|
3499
|
-
if (
|
|
3489
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3500
3490
|
throw e;
|
|
3501
3491
|
}
|
|
3502
3492
|
if (!isHttpClientResponseError2(e)) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace-sdk/client-query",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
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",
|