@dynatrace-sdk/client-query 1.10.0 → 1.11.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 +23 -0
- package/README.md +1169 -4
- package/cjs/index.js +80 -62
- package/docs/DOCS.md +509 -327
- package/dynatrace-metadata.json +3 -3
- package/esm/index.js +80 -62
- package/package.json +1 -1
- package/types/packages/client/query/src/lib/apis/query-assistance-api.d.ts +0 -3
- package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +0 -1
- package/types/packages/client/query/src/lib/models/execute-request.d.ts +2 -2
- package/types/packages/client/query/src/lib/models/verify-request.d.ts +1 -0
- package/types/packages/client/query/src/lib/models/verify-request.transformation.d.ts +1 -0
- package/types/packages/client/query/src/lib/models/verify-response.d.ts +1 -0
- package/types/packages/client/query/src/lib/models/verify-response.transformation.d.ts +1 -0
- package/types/packages/client/query/src/lib/utils/url-helpers.d.ts +4 -1
- package/types/packages/http-client/src/index.d.ts +1 -1
- package/types/packages/http-client/src/lib/platform/http-client.d.ts +11 -0
- package/types/packages/http-client/src/lib/platform/index.d.ts +1 -0
- package/types/packages/http-client/src/lib/platform/oauth-http-client.d.ts +41 -0
package/dynatrace-metadata.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dynagen": {
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"generatedAt": "",
|
|
5
5
|
"template": {
|
|
6
6
|
"name": "@dynatrace-sdk/template-typescript-client",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.19.1"
|
|
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.10.0",
|
|
16
16
|
"baseUrl": "/platform/storage/query/v1"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/esm/index.js
CHANGED
|
@@ -118,6 +118,8 @@ function serializeData(data) {
|
|
|
118
118
|
function getMessagesFromErrorDetails(details) {
|
|
119
119
|
const messages = [];
|
|
120
120
|
Object.entries(details).forEach(([name, data]) => {
|
|
121
|
+
if (!data)
|
|
122
|
+
return;
|
|
121
123
|
const serializedData = serializeData(data);
|
|
122
124
|
switch (name) {
|
|
123
125
|
case "missingScopes":
|
|
@@ -1333,10 +1335,10 @@ function isVerifyRequest(value) {
|
|
|
1333
1335
|
if (Array.isArray(value)) {
|
|
1334
1336
|
return false;
|
|
1335
1337
|
}
|
|
1336
|
-
const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions"]);
|
|
1338
|
+
const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions", "generateCanonicalQuery"]);
|
|
1337
1339
|
const hasAdditionalProperties = false;
|
|
1338
1340
|
const requiredKeys = ["query"];
|
|
1339
|
-
const optionalKeys = ["timezone", "locale", "queryOptions"];
|
|
1341
|
+
const optionalKeys = ["timezone", "locale", "queryOptions", "generateCanonicalQuery"];
|
|
1340
1342
|
const valKeys = new Set(Object.keys(value));
|
|
1341
1343
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
1342
1344
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -1353,10 +1355,10 @@ function isJson18(value) {
|
|
|
1353
1355
|
if (Array.isArray(value)) {
|
|
1354
1356
|
return false;
|
|
1355
1357
|
}
|
|
1356
|
-
const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions"]);
|
|
1358
|
+
const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions", "generateCanonicalQuery"]);
|
|
1357
1359
|
const hasAdditionalProperties = false;
|
|
1358
1360
|
const requiredKeys = ["query"];
|
|
1359
|
-
const optionalKeys = ["timezone", "locale", "queryOptions"];
|
|
1361
|
+
const optionalKeys = ["timezone", "locale", "queryOptions", "generateCanonicalQuery"];
|
|
1360
1362
|
const valKeys = new Set(Object.keys(value));
|
|
1361
1363
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
1362
1364
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -1364,21 +1366,23 @@ function isJson18(value) {
|
|
|
1364
1366
|
return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
|
|
1365
1367
|
}
|
|
1366
1368
|
function fromJson18($model) {
|
|
1367
|
-
const { query, timezone, locale, queryOptions } = $model;
|
|
1369
|
+
const { query, timezone, locale, queryOptions, generateCanonicalQuery } = $model;
|
|
1368
1370
|
return {
|
|
1369
1371
|
query,
|
|
1370
1372
|
timezone,
|
|
1371
1373
|
locale,
|
|
1372
|
-
queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0
|
|
1374
|
+
queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0,
|
|
1375
|
+
generateCanonicalQuery
|
|
1373
1376
|
};
|
|
1374
1377
|
}
|
|
1375
1378
|
function toJson18($model) {
|
|
1376
|
-
const { query, timezone, locale, queryOptions } = $model;
|
|
1379
|
+
const { query, timezone, locale, queryOptions, generateCanonicalQuery } = $model;
|
|
1377
1380
|
return {
|
|
1378
1381
|
query,
|
|
1379
1382
|
timezone,
|
|
1380
1383
|
locale,
|
|
1381
|
-
queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0
|
|
1384
|
+
queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0,
|
|
1385
|
+
generateCanonicalQuery
|
|
1382
1386
|
};
|
|
1383
1387
|
}
|
|
1384
1388
|
|
|
@@ -1523,10 +1527,10 @@ function isVerifyResponse(value) {
|
|
|
1523
1527
|
if (Array.isArray(value)) {
|
|
1524
1528
|
return false;
|
|
1525
1529
|
}
|
|
1526
|
-
const modelKeys = /* @__PURE__ */ new Set(["valid", "notifications"]);
|
|
1530
|
+
const modelKeys = /* @__PURE__ */ new Set(["valid", "canonicalQuery", "notifications"]);
|
|
1527
1531
|
const hasAdditionalProperties = false;
|
|
1528
1532
|
const requiredKeys = ["valid"];
|
|
1529
|
-
const optionalKeys = ["notifications"];
|
|
1533
|
+
const optionalKeys = ["canonicalQuery", "notifications"];
|
|
1530
1534
|
const valKeys = new Set(Object.keys(value));
|
|
1531
1535
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
1532
1536
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -1543,10 +1547,10 @@ function isJson20(value) {
|
|
|
1543
1547
|
if (Array.isArray(value)) {
|
|
1544
1548
|
return false;
|
|
1545
1549
|
}
|
|
1546
|
-
const modelKeys = /* @__PURE__ */ new Set(["valid", "notifications"]);
|
|
1550
|
+
const modelKeys = /* @__PURE__ */ new Set(["valid", "canonicalQuery", "notifications"]);
|
|
1547
1551
|
const hasAdditionalProperties = false;
|
|
1548
1552
|
const requiredKeys = ["valid"];
|
|
1549
|
-
const optionalKeys = ["notifications"];
|
|
1553
|
+
const optionalKeys = ["canonicalQuery", "notifications"];
|
|
1550
1554
|
const valKeys = new Set(Object.keys(value));
|
|
1551
1555
|
const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
|
|
1552
1556
|
const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
|
|
@@ -1554,16 +1558,18 @@ function isJson20(value) {
|
|
|
1554
1558
|
return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
|
|
1555
1559
|
}
|
|
1556
1560
|
function fromJson20($model) {
|
|
1557
|
-
const { valid, notifications } = $model;
|
|
1561
|
+
const { valid, canonicalQuery, notifications } = $model;
|
|
1558
1562
|
return {
|
|
1559
1563
|
valid,
|
|
1564
|
+
canonicalQuery,
|
|
1560
1565
|
notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => fromJson19(innerValue)) : void 0
|
|
1561
1566
|
};
|
|
1562
1567
|
}
|
|
1563
1568
|
function toJson20($model) {
|
|
1564
|
-
const { valid, notifications } = $model;
|
|
1569
|
+
const { valid, canonicalQuery, notifications } = $model;
|
|
1565
1570
|
return {
|
|
1566
1571
|
valid,
|
|
1572
|
+
canonicalQuery,
|
|
1567
1573
|
notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => toJson19(innerValue)) : void 0
|
|
1568
1574
|
};
|
|
1569
1575
|
}
|
|
@@ -1580,9 +1586,6 @@ var QueryAssistanceClient = class {
|
|
|
1580
1586
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
1581
1587
|
}
|
|
1582
1588
|
const encodedBody = toJson18(config.body);
|
|
1583
|
-
const headerParameters = {
|
|
1584
|
-
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1585
|
-
};
|
|
1586
1589
|
try {
|
|
1587
1590
|
const response = await this.httpClient.send({
|
|
1588
1591
|
url: `/platform/storage/query/v1/query:verify`,
|
|
@@ -1591,8 +1594,7 @@ var QueryAssistanceClient = class {
|
|
|
1591
1594
|
body: encodedBody,
|
|
1592
1595
|
headers: {
|
|
1593
1596
|
"Content-Type": "application/json",
|
|
1594
|
-
Accept: "application/json"
|
|
1595
|
-
...headerParameters
|
|
1597
|
+
Accept: "application/json"
|
|
1596
1598
|
},
|
|
1597
1599
|
abortSignal: config.abortSignal,
|
|
1598
1600
|
statusValidator: (status) => {
|
|
@@ -1625,7 +1627,7 @@ var QueryAssistanceClient = class {
|
|
|
1625
1627
|
try {
|
|
1626
1628
|
const errorBody = fromJson16(responseValue);
|
|
1627
1629
|
throw new ErrorEnvelopeError(
|
|
1628
|
-
|
|
1630
|
+
`400`,
|
|
1629
1631
|
response,
|
|
1630
1632
|
errorBody,
|
|
1631
1633
|
getErrorMessage(errorBody, "The supplied request is wrong."),
|
|
@@ -1649,7 +1651,7 @@ var QueryAssistanceClient = class {
|
|
|
1649
1651
|
try {
|
|
1650
1652
|
const errorBody = fromJson16(responseValue);
|
|
1651
1653
|
throw new ErrorEnvelopeError(
|
|
1652
|
-
|
|
1654
|
+
`500`,
|
|
1653
1655
|
response,
|
|
1654
1656
|
errorBody,
|
|
1655
1657
|
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
@@ -1686,9 +1688,6 @@ var QueryAssistanceClient = class {
|
|
|
1686
1688
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
1687
1689
|
}
|
|
1688
1690
|
const encodedBody = toJson17(config.body);
|
|
1689
|
-
const headerParameters = {
|
|
1690
|
-
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1691
|
-
};
|
|
1692
1691
|
try {
|
|
1693
1692
|
const response = await this.httpClient.send({
|
|
1694
1693
|
url: `/platform/storage/query/v1/query:parse`,
|
|
@@ -1697,8 +1696,7 @@ var QueryAssistanceClient = class {
|
|
|
1697
1696
|
body: encodedBody,
|
|
1698
1697
|
headers: {
|
|
1699
1698
|
"Content-Type": "application/json",
|
|
1700
|
-
Accept: "application/json"
|
|
1701
|
-
...headerParameters
|
|
1699
|
+
Accept: "application/json"
|
|
1702
1700
|
},
|
|
1703
1701
|
abortSignal: config.abortSignal,
|
|
1704
1702
|
statusValidator: (status) => {
|
|
@@ -1731,7 +1729,7 @@ var QueryAssistanceClient = class {
|
|
|
1731
1729
|
try {
|
|
1732
1730
|
const errorBody = fromJson16(responseValue);
|
|
1733
1731
|
throw new ErrorEnvelopeError(
|
|
1734
|
-
|
|
1732
|
+
`400`,
|
|
1735
1733
|
response,
|
|
1736
1734
|
errorBody,
|
|
1737
1735
|
getErrorMessage(
|
|
@@ -1758,7 +1756,7 @@ var QueryAssistanceClient = class {
|
|
|
1758
1756
|
try {
|
|
1759
1757
|
const errorBody = fromJson16(responseValue);
|
|
1760
1758
|
throw new ErrorEnvelopeError(
|
|
1761
|
-
|
|
1759
|
+
`500`,
|
|
1762
1760
|
response,
|
|
1763
1761
|
errorBody,
|
|
1764
1762
|
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
@@ -1795,9 +1793,6 @@ var QueryAssistanceClient = class {
|
|
|
1795
1793
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
1796
1794
|
}
|
|
1797
1795
|
const encodedBody = toJson2(config.body);
|
|
1798
|
-
const headerParameters = {
|
|
1799
|
-
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1800
|
-
};
|
|
1801
1796
|
try {
|
|
1802
1797
|
const response = await this.httpClient.send({
|
|
1803
1798
|
url: `/platform/storage/query/v1/query:autocomplete`,
|
|
@@ -1806,8 +1801,7 @@ var QueryAssistanceClient = class {
|
|
|
1806
1801
|
body: encodedBody,
|
|
1807
1802
|
headers: {
|
|
1808
1803
|
"Content-Type": "application/json",
|
|
1809
|
-
Accept: "application/json"
|
|
1810
|
-
...headerParameters
|
|
1804
|
+
Accept: "application/json"
|
|
1811
1805
|
},
|
|
1812
1806
|
abortSignal: config.abortSignal,
|
|
1813
1807
|
statusValidator: (status) => {
|
|
@@ -1840,7 +1834,7 @@ var QueryAssistanceClient = class {
|
|
|
1840
1834
|
try {
|
|
1841
1835
|
const errorBody = fromJson16(responseValue);
|
|
1842
1836
|
throw new ErrorEnvelopeError(
|
|
1843
|
-
|
|
1837
|
+
`400`,
|
|
1844
1838
|
response,
|
|
1845
1839
|
errorBody,
|
|
1846
1840
|
getErrorMessage(
|
|
@@ -1867,7 +1861,7 @@ var QueryAssistanceClient = class {
|
|
|
1867
1861
|
try {
|
|
1868
1862
|
const errorBody = fromJson16(responseValue);
|
|
1869
1863
|
throw new ErrorEnvelopeError(
|
|
1870
|
-
|
|
1864
|
+
`500`,
|
|
1871
1865
|
response,
|
|
1872
1866
|
errorBody,
|
|
1873
1867
|
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
@@ -3214,15 +3208,25 @@ var encodeQueryParam = (key, value) => {
|
|
|
3214
3208
|
const encodedKey = encodeURIComponent(key);
|
|
3215
3209
|
return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : String(value))}`;
|
|
3216
3210
|
};
|
|
3217
|
-
var
|
|
3211
|
+
var addExplodedArrayQueryParam = (query, key) => {
|
|
3218
3212
|
const arrayValue = query[key];
|
|
3219
3213
|
return arrayValue.map((value) => encodeQueryParam(key, value)).join("&");
|
|
3220
3214
|
};
|
|
3215
|
+
var addNonExplodedArrayQueryParams = (query, key) => {
|
|
3216
|
+
const encodedKey = encodeURIComponent(key);
|
|
3217
|
+
const encodedParamsList = query[key].map((value) => encodeURIComponent(typeof value === "number" ? value : String(value))).join(",");
|
|
3218
|
+
return `${encodedKey}=${encodedParamsList}`;
|
|
3219
|
+
};
|
|
3221
3220
|
var addQueryParam = (query, key) => encodeQueryParam(key, query[key]);
|
|
3222
|
-
var
|
|
3221
|
+
var arrayQueryParams = (query, key, explode) => {
|
|
3222
|
+
return explode ? addExplodedArrayQueryParam(query, key) : addNonExplodedArrayQueryParams(query, key);
|
|
3223
|
+
};
|
|
3224
|
+
var toQueryString = (rawQuery, flags = {}) => {
|
|
3223
3225
|
const query = rawQuery || {};
|
|
3224
3226
|
const keys = Object.keys(query).filter((key) => typeof query[key] !== "undefined");
|
|
3225
|
-
const queryString = keys.map(
|
|
3227
|
+
const queryString = keys.map(
|
|
3228
|
+
(key) => Array.isArray(query[key]) ? arrayQueryParams(query, key, flags.explode?.hasOwnProperty(key) ? flags.explode[key] : true) : addQueryParam(query, key)
|
|
3229
|
+
).join("&");
|
|
3226
3230
|
return queryString ? `?${queryString}` : "";
|
|
3227
3231
|
};
|
|
3228
3232
|
|
|
@@ -3237,11 +3241,14 @@ var QueryExecutionClient = class {
|
|
|
3237
3241
|
if (!config) {
|
|
3238
3242
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
3239
3243
|
}
|
|
3240
|
-
const query = toQueryString(
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3244
|
+
const query = toQueryString(
|
|
3245
|
+
{
|
|
3246
|
+
"request-token": config.requestToken,
|
|
3247
|
+
"request-timeout-milliseconds": config.requestTimeoutMilliseconds,
|
|
3248
|
+
enrich: config.enrich
|
|
3249
|
+
},
|
|
3250
|
+
{ explode: { "request-token": false, "request-timeout-milliseconds": false } }
|
|
3251
|
+
);
|
|
3245
3252
|
try {
|
|
3246
3253
|
const response = await this.httpClient.send({
|
|
3247
3254
|
url: `/platform/storage/query/v1/query:poll${query}`,
|
|
@@ -3274,7 +3281,7 @@ var QueryExecutionClient = class {
|
|
|
3274
3281
|
try {
|
|
3275
3282
|
const errorBody = fromJson16(responseValue);
|
|
3276
3283
|
throw new ErrorEnvelopeError(
|
|
3277
|
-
|
|
3284
|
+
`400`,
|
|
3278
3285
|
response,
|
|
3279
3286
|
errorBody,
|
|
3280
3287
|
getErrorMessage(
|
|
@@ -3310,7 +3317,7 @@ var QueryExecutionClient = class {
|
|
|
3310
3317
|
try {
|
|
3311
3318
|
const errorBody = fromJson16(responseValue);
|
|
3312
3319
|
throw new ErrorEnvelopeError(
|
|
3313
|
-
|
|
3320
|
+
`500`,
|
|
3314
3321
|
response,
|
|
3315
3322
|
errorBody,
|
|
3316
3323
|
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
@@ -3348,9 +3355,6 @@ var QueryExecutionClient = class {
|
|
|
3348
3355
|
}
|
|
3349
3356
|
const encodedBody = toJson21(config.body);
|
|
3350
3357
|
const query = toQueryString({ enrich: config.enrich });
|
|
3351
|
-
const headerParameters = {
|
|
3352
|
-
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
3353
|
-
};
|
|
3354
3358
|
try {
|
|
3355
3359
|
const response = await this.httpClient.send({
|
|
3356
3360
|
url: `/platform/storage/query/v1/query:execute${query}`,
|
|
@@ -3359,8 +3363,7 @@ var QueryExecutionClient = class {
|
|
|
3359
3363
|
body: encodedBody,
|
|
3360
3364
|
headers: {
|
|
3361
3365
|
"Content-Type": "application/json",
|
|
3362
|
-
Accept: "application/json"
|
|
3363
|
-
...headerParameters
|
|
3366
|
+
Accept: "application/json"
|
|
3364
3367
|
},
|
|
3365
3368
|
abortSignal: config.abortSignal,
|
|
3366
3369
|
statusValidator: (status) => {
|
|
@@ -3420,7 +3423,7 @@ var QueryExecutionClient = class {
|
|
|
3420
3423
|
try {
|
|
3421
3424
|
const errorBody = fromJson16(responseValue);
|
|
3422
3425
|
throw new ErrorEnvelopeError(
|
|
3423
|
-
|
|
3426
|
+
`400`,
|
|
3424
3427
|
response,
|
|
3425
3428
|
errorBody,
|
|
3426
3429
|
getErrorMessage(
|
|
@@ -3447,7 +3450,7 @@ var QueryExecutionClient = class {
|
|
|
3447
3450
|
try {
|
|
3448
3451
|
const errorBody = fromJson16(responseValue);
|
|
3449
3452
|
throw new ErrorEnvelopeError(
|
|
3450
|
-
|
|
3453
|
+
`403`,
|
|
3451
3454
|
response,
|
|
3452
3455
|
errorBody,
|
|
3453
3456
|
getErrorMessage(errorBody, "Insufficient permissions."),
|
|
@@ -3471,7 +3474,7 @@ var QueryExecutionClient = class {
|
|
|
3471
3474
|
try {
|
|
3472
3475
|
const errorBody = fromJson16(responseValue);
|
|
3473
3476
|
throw new ErrorEnvelopeError(
|
|
3474
|
-
|
|
3477
|
+
`429`,
|
|
3475
3478
|
response,
|
|
3476
3479
|
errorBody,
|
|
3477
3480
|
getErrorMessage(errorBody, "Too many requests."),
|
|
@@ -3495,7 +3498,7 @@ var QueryExecutionClient = class {
|
|
|
3495
3498
|
try {
|
|
3496
3499
|
const errorBody = fromJson16(responseValue);
|
|
3497
3500
|
throw new ErrorEnvelopeError(
|
|
3498
|
-
|
|
3501
|
+
`500`,
|
|
3499
3502
|
response,
|
|
3500
3503
|
errorBody,
|
|
3501
3504
|
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
@@ -3519,7 +3522,7 @@ var QueryExecutionClient = class {
|
|
|
3519
3522
|
try {
|
|
3520
3523
|
const errorBody = fromJson16(responseValue);
|
|
3521
3524
|
throw new ErrorEnvelopeError(
|
|
3522
|
-
|
|
3525
|
+
`503`,
|
|
3523
3526
|
response,
|
|
3524
3527
|
errorBody,
|
|
3525
3528
|
getErrorMessage(errorBody, "Service is unavailable."),
|
|
@@ -3543,13 +3546,19 @@ var QueryExecutionClient = class {
|
|
|
3543
3546
|
const responseValue = await response.body("json");
|
|
3544
3547
|
try {
|
|
3545
3548
|
const errorBody = fromJson16(responseValue);
|
|
3546
|
-
throw new ErrorEnvelopeError(
|
|
3549
|
+
throw new ErrorEnvelopeError(
|
|
3550
|
+
`${response.status}`,
|
|
3551
|
+
response,
|
|
3552
|
+
errorBody,
|
|
3553
|
+
getErrorMessage(errorBody, "Client error."),
|
|
3554
|
+
e
|
|
3555
|
+
);
|
|
3547
3556
|
} catch (err) {
|
|
3548
3557
|
if (err instanceof ErrorEnvelopeError) {
|
|
3549
3558
|
throw err;
|
|
3550
3559
|
}
|
|
3551
3560
|
throw new InvalidResponseError(
|
|
3552
|
-
`QueryExecutionClient.query:execute
|
|
3561
|
+
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3553
3562
|
err,
|
|
3554
3563
|
responseValue,
|
|
3555
3564
|
"ErrorEnvelope",
|
|
@@ -3560,13 +3569,19 @@ var QueryExecutionClient = class {
|
|
|
3560
3569
|
const responseValue = await response.body("json");
|
|
3561
3570
|
try {
|
|
3562
3571
|
const errorBody = fromJson16(responseValue);
|
|
3563
|
-
throw new ErrorEnvelopeError(
|
|
3572
|
+
throw new ErrorEnvelopeError(
|
|
3573
|
+
`${response.status}`,
|
|
3574
|
+
response,
|
|
3575
|
+
errorBody,
|
|
3576
|
+
getErrorMessage(errorBody, "Server error."),
|
|
3577
|
+
e
|
|
3578
|
+
);
|
|
3564
3579
|
} catch (err) {
|
|
3565
3580
|
if (err instanceof ErrorEnvelopeError) {
|
|
3566
3581
|
throw err;
|
|
3567
3582
|
}
|
|
3568
3583
|
throw new InvalidResponseError(
|
|
3569
|
-
`QueryExecutionClient.query:execute
|
|
3584
|
+
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3570
3585
|
err,
|
|
3571
3586
|
responseValue,
|
|
3572
3587
|
"ErrorEnvelope",
|
|
@@ -3593,7 +3608,10 @@ var QueryExecutionClient = class {
|
|
|
3593
3608
|
if (!config) {
|
|
3594
3609
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
3595
3610
|
}
|
|
3596
|
-
const query = toQueryString(
|
|
3611
|
+
const query = toQueryString(
|
|
3612
|
+
{ "request-token": config.requestToken, enrich: config.enrich },
|
|
3613
|
+
{ explode: { "request-token": false } }
|
|
3614
|
+
);
|
|
3597
3615
|
try {
|
|
3598
3616
|
const response = await this.httpClient.send({
|
|
3599
3617
|
url: `/platform/storage/query/v1/query:cancel${query}`,
|
|
@@ -3648,7 +3666,7 @@ var QueryExecutionClient = class {
|
|
|
3648
3666
|
try {
|
|
3649
3667
|
const errorBody = fromJson16(responseValue);
|
|
3650
3668
|
throw new ErrorEnvelopeError(
|
|
3651
|
-
|
|
3669
|
+
`400`,
|
|
3652
3670
|
response,
|
|
3653
3671
|
errorBody,
|
|
3654
3672
|
getErrorMessage(
|
|
@@ -3684,7 +3702,7 @@ var QueryExecutionClient = class {
|
|
|
3684
3702
|
try {
|
|
3685
3703
|
const errorBody = fromJson16(responseValue);
|
|
3686
3704
|
throw new ErrorEnvelopeError(
|
|
3687
|
-
|
|
3705
|
+
`500`,
|
|
3688
3706
|
response,
|
|
3689
3707
|
errorBody,
|
|
3690
3708
|
getErrorMessage(errorBody, "An internal server error has occurred."),
|
package/package.json
CHANGED
|
@@ -40,7 +40,6 @@ export declare class QueryAssistanceClient {
|
|
|
40
40
|
*/
|
|
41
41
|
queryVerify(config: {
|
|
42
42
|
body: VerifyRequest;
|
|
43
|
-
/** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
|
|
44
43
|
abortSignal?: AbortSignal;
|
|
45
44
|
}): Promise<VerifyResponse>;
|
|
46
45
|
/**
|
|
@@ -252,7 +251,6 @@ export declare class QueryAssistanceClient {
|
|
|
252
251
|
*/
|
|
253
252
|
queryParse(config: {
|
|
254
253
|
body: ParseRequest;
|
|
255
|
-
/** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
|
|
256
254
|
abortSignal?: AbortSignal;
|
|
257
255
|
}): Promise<DQLNode>;
|
|
258
256
|
/**
|
|
@@ -308,7 +306,6 @@ export declare class QueryAssistanceClient {
|
|
|
308
306
|
*/
|
|
309
307
|
queryAutocomplete(config: {
|
|
310
308
|
body: AutocompleteRequest;
|
|
311
|
-
/** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
|
|
312
309
|
abortSignal?: AbortSignal;
|
|
313
310
|
}): Promise<AutocompleteResponse>;
|
|
314
311
|
}
|
|
@@ -118,7 +118,6 @@ export declare class QueryExecutionClient {
|
|
|
118
118
|
queryExecute(config: {
|
|
119
119
|
body: ExecuteRequest;
|
|
120
120
|
/** If set additional data will be available in the metadata section. */ enrich?: string;
|
|
121
|
-
/** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
|
|
122
121
|
abortSignal?: AbortSignal;
|
|
123
122
|
}): Promise<QueryStartResponse>;
|
|
124
123
|
/**
|
|
@@ -5,11 +5,11 @@ export interface ExecuteRequest {
|
|
|
5
5
|
*/
|
|
6
6
|
query: string;
|
|
7
7
|
/**
|
|
8
|
-
* The query timeframe 'start' timestamp in ISO-8601 or
|
|
8
|
+
* The query timeframe 'start' timestamp in ISO-8601 or RFC3339 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>
|
|
9
9
|
*/
|
|
10
10
|
defaultTimeframeStart?: string;
|
|
11
11
|
/**
|
|
12
|
-
* The query timeframe 'end' timestamp in ISO-8601 or
|
|
12
|
+
* The query timeframe 'end' timestamp in ISO-8601 or RFC3339 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>
|
|
13
13
|
*/
|
|
14
14
|
defaultTimeframeEnd?: string;
|
|
15
15
|
/**
|
|
@@ -5,6 +5,7 @@ export interface AsJson {
|
|
|
5
5
|
timezone?: string;
|
|
6
6
|
locale?: string;
|
|
7
7
|
queryOptions?: _QueryOptionsTransformation.AsJson;
|
|
8
|
+
generateCanonicalQuery?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare function isVerifyRequest(value: any): value is VerifyRequest;
|
|
10
11
|
export declare function isJson(value: any): value is AsJson;
|
|
@@ -2,6 +2,7 @@ import * as _MetadataNotificationTransformation from './metadata-notification.tr
|
|
|
2
2
|
import { VerifyResponse } from './verify-response';
|
|
3
3
|
export interface AsJson {
|
|
4
4
|
valid: boolean;
|
|
5
|
+
canonicalQuery?: string;
|
|
5
6
|
notifications?: _MetadataNotificationTransformation.AsJson[];
|
|
6
7
|
}
|
|
7
8
|
export declare function isVerifyResponse(value: any): value is VerifyResponse;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
declare type QueryParamsType = Record<string | number, any>;
|
|
2
|
-
|
|
2
|
+
interface ParametersFlags {
|
|
3
|
+
explode?: Record<string, boolean>;
|
|
4
|
+
}
|
|
5
|
+
export declare const toQueryString: (rawQuery?: QueryParamsType, flags?: ParametersFlags) => string;
|
|
3
6
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AbortController, AbortSignal, BaseError, Binary, BinaryFormDataRequestField, BinaryFormDataResponseField, DataTypeError, DataTypes, FormDataRequestBody, FormDataRequestField, FormDataResponseBody, FormDataResponseField, Headers, HttpClient, HttpClientAbortError, HttpClientNetworkError, HttpClientRequestError, HttpClientRequestOptions, HttpClientResponse, HttpClientResponseError, JsonFormDataRequestField, RequestBodyTypes, ResponseBodyTypes, StatusValidator, TextFormDataRequestField, TextFormDataResponseField, UnsupportedOperationError, isHttpClientResponseError, isHttpClientAbortError, isHttpClientNetworkError, isHttpClientRequestError, } from './lib/types';
|
|
2
|
-
export { AbortController as PlatformAbortController, AbortSignal as PlatformAbortSignal, BaseError as PlatformBaseError, Binary as PlatformBinary, DataTypeError as PlatformDataTypeError, HttpClient as PlatformHttpClient, HttpClientAbortError as PlatformHttpClientAbortError, HttpClientRequestError as PlatformHttpClientRequestError, HttpClientResponse as PlatformHttpClientResponse, HttpClientResponseError as PlatformHttpClientResponseError, UnsupportedOperationError as PlatformUnsupportedOperationError, httpClient, } from './lib/platform';
|
|
2
|
+
export { AbortController as PlatformAbortController, AbortSignal as PlatformAbortSignal, BaseError as PlatformBaseError, Binary as PlatformBinary, DataTypeError as PlatformDataTypeError, HttpClient as PlatformHttpClient, HttpClientAbortError as PlatformHttpClientAbortError, HttpClientRequestError as PlatformHttpClientRequestError, HttpClientResponse as PlatformHttpClientResponse, HttpClientResponseError as PlatformHttpClientResponseError, OAuthHttpClient as _OAuthHttpClient, OAuthHttpClientConfig as _OAuthHttpClientConfig, UnsupportedOperationError as PlatformUnsupportedOperationError, httpClient, } from './lib/platform';
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import * as types from '../types';
|
|
2
|
+
interface HttpClientConfiguration {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
}
|
|
2
5
|
export declare class HttpClient implements types.HttpClient {
|
|
6
|
+
private _baseUrl;
|
|
7
|
+
constructor(options?: HttpClientConfiguration);
|
|
8
|
+
/**
|
|
9
|
+
* Sets HTTP Client Instance baseUrl param to the incoming value `baseUrl`.
|
|
10
|
+
* @param baseUrl Base URL used in the request path.
|
|
11
|
+
*/
|
|
12
|
+
_setBaseURL(baseUrl: string): void;
|
|
3
13
|
send<T extends keyof types.RequestBodyTypes = 'json'>(options: types.HttpClientRequestOptions<T>): Promise<types.HttpClientResponse>;
|
|
4
14
|
}
|
|
5
15
|
export declare const httpClient: HttpClient;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as types from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* DO NOT USE - internal use only.
|
|
4
|
+
*/
|
|
5
|
+
export interface OAuthHttpClientConfig {
|
|
6
|
+
clientId: string;
|
|
7
|
+
secret: string;
|
|
8
|
+
scopes: string[];
|
|
9
|
+
environmentUrl: string;
|
|
10
|
+
authUrl: string;
|
|
11
|
+
}
|
|
12
|
+
export interface OAuthTokenResponse {
|
|
13
|
+
scope: string;
|
|
14
|
+
token_type: string;
|
|
15
|
+
expires_in: number;
|
|
16
|
+
access_token: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* DO NOT USE - internal use only.
|
|
20
|
+
*/
|
|
21
|
+
export declare class OAuthToken {
|
|
22
|
+
private readonly _scope;
|
|
23
|
+
private readonly _tokenType;
|
|
24
|
+
private readonly _expirationDate;
|
|
25
|
+
private readonly _accessToken;
|
|
26
|
+
constructor(oauthTokenResponse: OAuthTokenResponse);
|
|
27
|
+
get scope(): string;
|
|
28
|
+
get tokenType(): string;
|
|
29
|
+
isExpired(): boolean;
|
|
30
|
+
get accessToken(): string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* DO NOT USE - internal use only.
|
|
34
|
+
*/
|
|
35
|
+
export declare class OAuthHttpClient implements types.HttpClient {
|
|
36
|
+
private readonly config;
|
|
37
|
+
private oauthToken?;
|
|
38
|
+
constructor(config: OAuthHttpClientConfig);
|
|
39
|
+
send<T extends keyof types.RequestBodyTypes = 'json'>(options: types.HttpClientRequestOptions<T>): Promise<types.HttpClientResponse>;
|
|
40
|
+
private requestToken;
|
|
41
|
+
}
|