@dynatrace-sdk/client-query 1.3.0 → 1.4.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.
- package/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/cjs/index.js +101 -19
- package/docs/DOCS.md +251 -1356
- package/dynatrace-metadata.json +3 -3
- package/esm/index.js +101 -19
- package/package.json +2 -2
- package/types/packages/client/query/src/lib/error-envelopes/get-error-message.d.ts +1 -0
- package/types/packages/client/query/src/lib/error-envelopes/index.d.ts +1 -0
- package/types/packages/client/query/src/lib/models/execute-request.d.ts +4 -0
- package/types/packages/client/query/src/lib/models/execute-request.transformation.d.ts +1 -0
package/dynatrace-metadata.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dynagen": {
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.10",
|
|
4
4
|
"generatedAt": "",
|
|
5
5
|
"template": {
|
|
6
6
|
"name": "@dynatrace-sdk/template-typescript-client",
|
|
7
|
-
"version": "0.17.
|
|
7
|
+
"version": "0.17.6"
|
|
8
8
|
},
|
|
9
9
|
"featureFlags": {
|
|
10
10
|
"typeguards": true
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"spec": {
|
|
14
14
|
"title": "Storage – Query Service",
|
|
15
|
-
"version": "1.
|
|
15
|
+
"version": "1.3.0",
|
|
16
16
|
"baseUrl": "/platform/storage/query/v1"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/esm/index.js
CHANGED
|
@@ -112,6 +112,27 @@ function getOptionalErrorRef(body) {
|
|
|
112
112
|
return {};
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
// packages/client/query/src/lib/error-envelopes/get-error-message.ts
|
|
116
|
+
function getMessagesFromErrorDetails(details) {
|
|
117
|
+
const messages = [];
|
|
118
|
+
Object.entries(details).forEach(([name, data]) => {
|
|
119
|
+
switch (name) {
|
|
120
|
+
case "missingScopes":
|
|
121
|
+
messages.push(`Missing scopes: ${data}`);
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
messages.push(`${name}: ${data}`);
|
|
125
|
+
}
|
|
126
|
+
}, []);
|
|
127
|
+
return messages;
|
|
128
|
+
}
|
|
129
|
+
function getErrorMessage(errorBody, defaultMessage) {
|
|
130
|
+
const error = errorBody;
|
|
131
|
+
const msg = error?.error?.message || defaultMessage;
|
|
132
|
+
const details = error?.error?.details || {};
|
|
133
|
+
return [msg, ...getMessagesFromErrorDetails(details)].join(". ");
|
|
134
|
+
}
|
|
135
|
+
|
|
115
136
|
// packages/client/query/src/lib/error-envelopes/invalid-response-error.ts
|
|
116
137
|
var InvalidResponseError = class extends ApiClientError {
|
|
117
138
|
responseBody;
|
|
@@ -127,6 +148,9 @@ var InvalidResponseError = class extends ApiClientError {
|
|
|
127
148
|
this.expectedType = expectedType;
|
|
128
149
|
}
|
|
129
150
|
};
|
|
151
|
+
function isInvalidResponseError(e) {
|
|
152
|
+
return e instanceof InvalidResponseError;
|
|
153
|
+
}
|
|
130
154
|
|
|
131
155
|
// packages/client/query/src/lib/models/autocomplete-request.transformation.ts
|
|
132
156
|
var autocomplete_request_transformation_exports = {};
|
|
@@ -1455,7 +1479,12 @@ var QueryAssistanceClient = class {
|
|
|
1455
1479
|
const responseValue = await response.body("json");
|
|
1456
1480
|
try {
|
|
1457
1481
|
const errorBody = fromJson15(responseValue);
|
|
1458
|
-
throw new ErrorEnvelopeError(
|
|
1482
|
+
throw new ErrorEnvelopeError(
|
|
1483
|
+
"400",
|
|
1484
|
+
response,
|
|
1485
|
+
errorBody,
|
|
1486
|
+
getErrorMessage(errorBody, "The supplied request is wrong.")
|
|
1487
|
+
);
|
|
1459
1488
|
} catch (err) {
|
|
1460
1489
|
if (err instanceof ErrorEnvelopeError) {
|
|
1461
1490
|
throw err;
|
|
@@ -1473,7 +1502,12 @@ var QueryAssistanceClient = class {
|
|
|
1473
1502
|
const responseValue = await response.body("json");
|
|
1474
1503
|
try {
|
|
1475
1504
|
const errorBody = fromJson15(responseValue);
|
|
1476
|
-
throw new ErrorEnvelopeError(
|
|
1505
|
+
throw new ErrorEnvelopeError(
|
|
1506
|
+
"500",
|
|
1507
|
+
response,
|
|
1508
|
+
errorBody,
|
|
1509
|
+
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
1510
|
+
);
|
|
1477
1511
|
} catch (err) {
|
|
1478
1512
|
if (err instanceof ErrorEnvelopeError) {
|
|
1479
1513
|
throw err;
|
|
@@ -1507,7 +1541,7 @@ var QueryAssistanceClient = class {
|
|
|
1507
1541
|
`${response.status}`,
|
|
1508
1542
|
response,
|
|
1509
1543
|
responseValue,
|
|
1510
|
-
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
1544
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1511
1545
|
);
|
|
1512
1546
|
}
|
|
1513
1547
|
}
|
|
@@ -1547,7 +1581,10 @@ var QueryAssistanceClient = class {
|
|
|
1547
1581
|
"400",
|
|
1548
1582
|
response,
|
|
1549
1583
|
errorBody,
|
|
1550
|
-
|
|
1584
|
+
getErrorMessage(
|
|
1585
|
+
errorBody,
|
|
1586
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
1587
|
+
)
|
|
1551
1588
|
);
|
|
1552
1589
|
} catch (err) {
|
|
1553
1590
|
if (err instanceof ErrorEnvelopeError) {
|
|
@@ -1566,7 +1603,12 @@ var QueryAssistanceClient = class {
|
|
|
1566
1603
|
const responseValue = await response.body("json");
|
|
1567
1604
|
try {
|
|
1568
1605
|
const errorBody = fromJson15(responseValue);
|
|
1569
|
-
throw new ErrorEnvelopeError(
|
|
1606
|
+
throw new ErrorEnvelopeError(
|
|
1607
|
+
"500",
|
|
1608
|
+
response,
|
|
1609
|
+
errorBody,
|
|
1610
|
+
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
1611
|
+
);
|
|
1570
1612
|
} catch (err) {
|
|
1571
1613
|
if (err instanceof ErrorEnvelopeError) {
|
|
1572
1614
|
throw err;
|
|
@@ -1600,7 +1642,7 @@ var QueryAssistanceClient = class {
|
|
|
1600
1642
|
`${response.status}`,
|
|
1601
1643
|
response,
|
|
1602
1644
|
responseValue,
|
|
1603
|
-
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
1645
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1604
1646
|
);
|
|
1605
1647
|
}
|
|
1606
1648
|
}
|
|
@@ -1640,7 +1682,10 @@ var QueryAssistanceClient = class {
|
|
|
1640
1682
|
"400",
|
|
1641
1683
|
response,
|
|
1642
1684
|
errorBody,
|
|
1643
|
-
|
|
1685
|
+
getErrorMessage(
|
|
1686
|
+
errorBody,
|
|
1687
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
1688
|
+
)
|
|
1644
1689
|
);
|
|
1645
1690
|
} catch (err) {
|
|
1646
1691
|
if (err instanceof ErrorEnvelopeError) {
|
|
@@ -1659,7 +1704,12 @@ var QueryAssistanceClient = class {
|
|
|
1659
1704
|
const responseValue = await response.body("json");
|
|
1660
1705
|
try {
|
|
1661
1706
|
const errorBody = fromJson15(responseValue);
|
|
1662
|
-
throw new ErrorEnvelopeError(
|
|
1707
|
+
throw new ErrorEnvelopeError(
|
|
1708
|
+
"500",
|
|
1709
|
+
response,
|
|
1710
|
+
errorBody,
|
|
1711
|
+
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
1712
|
+
);
|
|
1663
1713
|
} catch (err) {
|
|
1664
1714
|
if (err instanceof ErrorEnvelopeError) {
|
|
1665
1715
|
throw err;
|
|
@@ -1693,7 +1743,7 @@ var QueryAssistanceClient = class {
|
|
|
1693
1743
|
`${response.status}`,
|
|
1694
1744
|
response,
|
|
1695
1745
|
responseValue,
|
|
1696
|
-
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
1746
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1697
1747
|
);
|
|
1698
1748
|
}
|
|
1699
1749
|
}
|
|
@@ -1729,6 +1779,7 @@ function isExecuteRequest(value) {
|
|
|
1729
1779
|
"timezone",
|
|
1730
1780
|
"locale",
|
|
1731
1781
|
"maxResultRecords",
|
|
1782
|
+
"maxResultBytes",
|
|
1732
1783
|
"fetchTimeoutSeconds",
|
|
1733
1784
|
"requestTimeoutMilliseconds",
|
|
1734
1785
|
"enablePreview",
|
|
@@ -1743,6 +1794,7 @@ function isExecuteRequest(value) {
|
|
|
1743
1794
|
"timezone",
|
|
1744
1795
|
"locale",
|
|
1745
1796
|
"maxResultRecords",
|
|
1797
|
+
"maxResultBytes",
|
|
1746
1798
|
"fetchTimeoutSeconds",
|
|
1747
1799
|
"requestTimeoutMilliseconds",
|
|
1748
1800
|
"enablePreview",
|
|
@@ -1771,6 +1823,7 @@ function isJson20(value) {
|
|
|
1771
1823
|
"timezone",
|
|
1772
1824
|
"locale",
|
|
1773
1825
|
"maxResultRecords",
|
|
1826
|
+
"maxResultBytes",
|
|
1774
1827
|
"fetchTimeoutSeconds",
|
|
1775
1828
|
"requestTimeoutMilliseconds",
|
|
1776
1829
|
"enablePreview",
|
|
@@ -1785,6 +1838,7 @@ function isJson20(value) {
|
|
|
1785
1838
|
"timezone",
|
|
1786
1839
|
"locale",
|
|
1787
1840
|
"maxResultRecords",
|
|
1841
|
+
"maxResultBytes",
|
|
1788
1842
|
"fetchTimeoutSeconds",
|
|
1789
1843
|
"requestTimeoutMilliseconds",
|
|
1790
1844
|
"enablePreview",
|
|
@@ -1804,6 +1858,7 @@ function fromJson20($model) {
|
|
|
1804
1858
|
timezone,
|
|
1805
1859
|
locale,
|
|
1806
1860
|
maxResultRecords,
|
|
1861
|
+
maxResultBytes,
|
|
1807
1862
|
fetchTimeoutSeconds,
|
|
1808
1863
|
requestTimeoutMilliseconds,
|
|
1809
1864
|
enablePreview,
|
|
@@ -1817,6 +1872,7 @@ function fromJson20($model) {
|
|
|
1817
1872
|
timezone,
|
|
1818
1873
|
locale,
|
|
1819
1874
|
maxResultRecords,
|
|
1875
|
+
maxResultBytes,
|
|
1820
1876
|
fetchTimeoutSeconds,
|
|
1821
1877
|
requestTimeoutMilliseconds,
|
|
1822
1878
|
enablePreview,
|
|
@@ -1832,6 +1888,7 @@ function toJson20($model) {
|
|
|
1832
1888
|
timezone,
|
|
1833
1889
|
locale,
|
|
1834
1890
|
maxResultRecords,
|
|
1891
|
+
maxResultBytes,
|
|
1835
1892
|
fetchTimeoutSeconds,
|
|
1836
1893
|
requestTimeoutMilliseconds,
|
|
1837
1894
|
enablePreview,
|
|
@@ -1845,6 +1902,7 @@ function toJson20($model) {
|
|
|
1845
1902
|
timezone,
|
|
1846
1903
|
locale,
|
|
1847
1904
|
maxResultRecords,
|
|
1905
|
+
maxResultBytes,
|
|
1848
1906
|
fetchTimeoutSeconds,
|
|
1849
1907
|
requestTimeoutMilliseconds,
|
|
1850
1908
|
enablePreview,
|
|
@@ -2966,14 +3024,19 @@ var QueryExecutionClient = class {
|
|
|
2966
3024
|
`410`,
|
|
2967
3025
|
response,
|
|
2968
3026
|
responseValue,
|
|
2969
|
-
`The query for the given request-token is not available anymore.`
|
|
3027
|
+
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
2970
3028
|
);
|
|
2971
3029
|
}
|
|
2972
3030
|
case 500: {
|
|
2973
3031
|
const responseValue = await response.body("json");
|
|
2974
3032
|
try {
|
|
2975
3033
|
const errorBody = fromJson15(responseValue);
|
|
2976
|
-
throw new ErrorEnvelopeError(
|
|
3034
|
+
throw new ErrorEnvelopeError(
|
|
3035
|
+
"500",
|
|
3036
|
+
response,
|
|
3037
|
+
errorBody,
|
|
3038
|
+
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
3039
|
+
);
|
|
2977
3040
|
} catch (err) {
|
|
2978
3041
|
if (err instanceof ErrorEnvelopeError) {
|
|
2979
3042
|
throw err;
|
|
@@ -3007,7 +3070,7 @@ var QueryExecutionClient = class {
|
|
|
3007
3070
|
`${response.status}`,
|
|
3008
3071
|
response,
|
|
3009
3072
|
responseValue,
|
|
3010
|
-
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
3073
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3011
3074
|
);
|
|
3012
3075
|
}
|
|
3013
3076
|
}
|
|
@@ -3048,7 +3111,10 @@ var QueryExecutionClient = class {
|
|
|
3048
3111
|
"400",
|
|
3049
3112
|
response,
|
|
3050
3113
|
errorBody,
|
|
3051
|
-
|
|
3114
|
+
getErrorMessage(
|
|
3115
|
+
errorBody,
|
|
3116
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3117
|
+
)
|
|
3052
3118
|
);
|
|
3053
3119
|
} catch (err) {
|
|
3054
3120
|
if (err instanceof ErrorEnvelopeError) {
|
|
@@ -3067,7 +3133,12 @@ var QueryExecutionClient = class {
|
|
|
3067
3133
|
const responseValue = await response.body("json");
|
|
3068
3134
|
try {
|
|
3069
3135
|
const errorBody = fromJson15(responseValue);
|
|
3070
|
-
throw new ErrorEnvelopeError(
|
|
3136
|
+
throw new ErrorEnvelopeError(
|
|
3137
|
+
"500",
|
|
3138
|
+
response,
|
|
3139
|
+
errorBody,
|
|
3140
|
+
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
3141
|
+
);
|
|
3071
3142
|
} catch (err) {
|
|
3072
3143
|
if (err instanceof ErrorEnvelopeError) {
|
|
3073
3144
|
throw err;
|
|
@@ -3085,7 +3156,12 @@ var QueryExecutionClient = class {
|
|
|
3085
3156
|
const responseValue = await response.body("json");
|
|
3086
3157
|
try {
|
|
3087
3158
|
const errorBody = fromJson15(responseValue);
|
|
3088
|
-
throw new ErrorEnvelopeError(
|
|
3159
|
+
throw new ErrorEnvelopeError(
|
|
3160
|
+
"503",
|
|
3161
|
+
response,
|
|
3162
|
+
errorBody,
|
|
3163
|
+
getErrorMessage(errorBody, "Service is unavailable.")
|
|
3164
|
+
);
|
|
3089
3165
|
} catch (err) {
|
|
3090
3166
|
if (err instanceof ErrorEnvelopeError) {
|
|
3091
3167
|
throw err;
|
|
@@ -3133,7 +3209,7 @@ var QueryExecutionClient = class {
|
|
|
3133
3209
|
`${response.status}`,
|
|
3134
3210
|
response,
|
|
3135
3211
|
responseValue,
|
|
3136
|
-
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
3212
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3137
3213
|
);
|
|
3138
3214
|
}
|
|
3139
3215
|
}
|
|
@@ -3164,14 +3240,19 @@ var QueryExecutionClient = class {
|
|
|
3164
3240
|
`410`,
|
|
3165
3241
|
response,
|
|
3166
3242
|
responseValue,
|
|
3167
|
-
`The query for the given request-token is not available anymore.`
|
|
3243
|
+
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3168
3244
|
);
|
|
3169
3245
|
}
|
|
3170
3246
|
case 500: {
|
|
3171
3247
|
const responseValue = await response.body("json");
|
|
3172
3248
|
try {
|
|
3173
3249
|
const errorBody = fromJson15(responseValue);
|
|
3174
|
-
throw new ErrorEnvelopeError(
|
|
3250
|
+
throw new ErrorEnvelopeError(
|
|
3251
|
+
"500",
|
|
3252
|
+
response,
|
|
3253
|
+
errorBody,
|
|
3254
|
+
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
3255
|
+
);
|
|
3175
3256
|
} catch (err) {
|
|
3176
3257
|
if (err instanceof ErrorEnvelopeError) {
|
|
3177
3258
|
throw err;
|
|
@@ -3208,7 +3289,7 @@ var QueryExecutionClient = class {
|
|
|
3208
3289
|
`${response.status}`,
|
|
3209
3290
|
response,
|
|
3210
3291
|
responseValue,
|
|
3211
|
-
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
3292
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3212
3293
|
);
|
|
3213
3294
|
}
|
|
3214
3295
|
}
|
|
@@ -3339,6 +3420,7 @@ export {
|
|
|
3339
3420
|
isApiClientError,
|
|
3340
3421
|
isClientRequestError,
|
|
3341
3422
|
isErrorEnvelopeError,
|
|
3423
|
+
isInvalidResponseError,
|
|
3342
3424
|
queryAssistanceClient,
|
|
3343
3425
|
queryExecutionClient
|
|
3344
3426
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorMessage(errorBody: unknown, defaultMessage: string): string;
|
|
@@ -23,6 +23,10 @@ export interface ExecuteRequest {
|
|
|
23
23
|
* The maximum number of result records that this query will return.
|
|
24
24
|
*/
|
|
25
25
|
maxResultRecords?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The maximum number of result bytes that this query will return.
|
|
28
|
+
*/
|
|
29
|
+
maxResultBytes?: number;
|
|
26
30
|
/**
|
|
27
31
|
* The query will stop after reaching the fetch-timeout.
|
|
28
32
|
*/
|