@dynatrace-sdk/client-query 1.5.1 → 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 +31 -0
- package/README.md +1 -1
- package/cjs/index.js +703 -551
- package/docs/DOCS.md +7 -6
- package/dynatrace-metadata.json +3 -3
- package/esm/index.js +715 -551
- package/package.json +3 -2
- package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +1 -0
- package/types/packages/client/query/src/lib/error-envelopes/api-client-error.d.ts +2 -1
- package/types/packages/client/query/src/lib/error-envelopes/client-request-error.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/field-type-type.d.ts +1 -0
- package/types/packages/client/query/src/lib/models/token-type.d.ts +2 -1
- package/types/packages/http-client/src/index.d.ts +1 -1
- package/types/packages/http-client/src/lib/types/http-client-abort-error.d.ts +1 -0
- package/types/packages/http-client/src/lib/types/http-client-network-error.d.ts +1 -0
- package/types/packages/http-client/src/lib/types/http-client-request-error.d.ts +1 -0
- package/types/packages/http-client/src/lib/types/http-client-response-error.d.ts +1 -0
package/esm/index.js
CHANGED
|
@@ -20,46 +20,34 @@ var __export = (target, all) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// packages/client/query/src/lib/apis/query-assistance-api.ts
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// packages/platform/error-handlers/src/lib/add-global-error-serializer.ts
|
|
29
|
-
function addGlobalErrorSerializer(serializer) {
|
|
30
|
-
const addGlobalErrorSerializerFunc = getAddGlobalErrorSerializer();
|
|
31
|
-
if (typeof addGlobalErrorSerializerFunc === "function") {
|
|
32
|
-
addGlobalErrorSerializerFunc(serializer);
|
|
33
|
-
} else {
|
|
34
|
-
console.warn("Missing addGlobalErrorSerializer function from sdk-web-runtime.");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function isGlobalErrorSerializerSupported() {
|
|
38
|
-
return typeof getAddGlobalErrorSerializer() === "function";
|
|
39
|
-
}
|
|
40
|
-
function getAddGlobalErrorSerializer() {
|
|
41
|
-
return getGlobalWithDtRuntime().dtRuntime?.errorHandlers?.addGlobalErrorSerializer;
|
|
42
|
-
}
|
|
23
|
+
import {
|
|
24
|
+
httpClient as defaultHttpClient,
|
|
25
|
+
isHttpClientResponseError,
|
|
26
|
+
isHttpClientAbortError
|
|
27
|
+
} from "@dynatrace-sdk/http-client";
|
|
43
28
|
|
|
44
29
|
// packages/client/query/src/lib/error-envelopes/api-client-error.ts
|
|
30
|
+
import { ErrorType } from "@dynatrace-sdk/error-handlers";
|
|
45
31
|
var ApiClientError = class extends Error {
|
|
46
|
-
|
|
47
|
-
constructor(name, message) {
|
|
32
|
+
constructor(name, message, cause) {
|
|
48
33
|
super(message);
|
|
34
|
+
this.cause = cause;
|
|
49
35
|
this.name = name;
|
|
50
36
|
}
|
|
37
|
+
errorType = ErrorType.COMMON;
|
|
51
38
|
};
|
|
52
39
|
function isApiClientError(e) {
|
|
53
40
|
return e instanceof ApiClientError;
|
|
54
41
|
}
|
|
55
42
|
|
|
56
43
|
// packages/client/query/src/lib/error-envelopes/client-request-error.ts
|
|
44
|
+
import { ErrorType as ErrorType2 } from "@dynatrace-sdk/error-handlers";
|
|
57
45
|
var ClientRequestError = class extends ApiClientError {
|
|
58
46
|
body;
|
|
59
47
|
response;
|
|
60
|
-
constructor(name, response, body, message) {
|
|
61
|
-
super(name, message);
|
|
62
|
-
this.errorType =
|
|
48
|
+
constructor(name, response, body, message, cause) {
|
|
49
|
+
super(name, message, cause);
|
|
50
|
+
this.errorType = ErrorType2.HTTP;
|
|
63
51
|
this.body = body;
|
|
64
52
|
this.response = response;
|
|
65
53
|
}
|
|
@@ -76,6 +64,11 @@ function isErrorEnvelopeError(e) {
|
|
|
76
64
|
}
|
|
77
65
|
|
|
78
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";
|
|
79
72
|
var apiClientErrorSerializer = async (error) => {
|
|
80
73
|
if (isClientRequestError(error)) {
|
|
81
74
|
const status = error.response.status;
|
|
@@ -85,8 +78,9 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
85
78
|
status,
|
|
86
79
|
message,
|
|
87
80
|
stack: error.stack,
|
|
88
|
-
type:
|
|
81
|
+
type: ErrorType3.HTTP,
|
|
89
82
|
body: error.body,
|
|
83
|
+
cause: error.cause,
|
|
90
84
|
...getOptionalErrorRef(error.body)
|
|
91
85
|
};
|
|
92
86
|
} else if (isApiClientError(error)) {
|
|
@@ -94,7 +88,8 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
94
88
|
name: error.name,
|
|
95
89
|
message: error.message,
|
|
96
90
|
stack: error.stack,
|
|
97
|
-
type:
|
|
91
|
+
type: ErrorType3.COMMON,
|
|
92
|
+
cause: error.cause
|
|
98
93
|
};
|
|
99
94
|
}
|
|
100
95
|
};
|
|
@@ -113,15 +108,23 @@ function getOptionalErrorRef(body) {
|
|
|
113
108
|
}
|
|
114
109
|
|
|
115
110
|
// packages/client/query/src/lib/error-envelopes/get-error-message.ts
|
|
111
|
+
function serializeData(data) {
|
|
112
|
+
try {
|
|
113
|
+
return JSON.stringify(data);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
return String(data);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
116
118
|
function getMessagesFromErrorDetails(details) {
|
|
117
119
|
const messages = [];
|
|
118
120
|
Object.entries(details).forEach(([name, data]) => {
|
|
121
|
+
const serializedData = serializeData(data);
|
|
119
122
|
switch (name) {
|
|
120
123
|
case "missingScopes":
|
|
121
|
-
messages.push(`Missing scopes: ${
|
|
124
|
+
messages.push(`Missing scopes: ${serializedData}`);
|
|
122
125
|
break;
|
|
123
126
|
default:
|
|
124
|
-
messages.push(`${name}: ${
|
|
127
|
+
messages.push(`${name}: ${serializedData}`);
|
|
125
128
|
}
|
|
126
129
|
}, []);
|
|
127
130
|
return messages;
|
|
@@ -1489,94 +1492,102 @@ var QueryAssistanceClient = class {
|
|
|
1489
1492
|
const headerParameters = {
|
|
1490
1493
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1491
1494
|
};
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
return
|
|
1495
|
+
try {
|
|
1496
|
+
const response = await this.httpClient.send({
|
|
1497
|
+
url: `/platform/storage/query/v1/query:verify`,
|
|
1498
|
+
method: "POST",
|
|
1499
|
+
requestBodyType: "json",
|
|
1500
|
+
body: encodedBody,
|
|
1501
|
+
headers: {
|
|
1502
|
+
"Content-Type": "application/json",
|
|
1503
|
+
Accept: "application/json",
|
|
1504
|
+
...headerParameters
|
|
1505
|
+
},
|
|
1506
|
+
abortSignal: config.abortSignal,
|
|
1507
|
+
statusValidator: (status) => {
|
|
1508
|
+
return [200].includes(status);
|
|
1506
1509
|
}
|
|
1507
|
-
|
|
1510
|
+
});
|
|
1511
|
+
const responseValue = await response.body("json");
|
|
1512
|
+
try {
|
|
1513
|
+
return fromJson19(responseValue);
|
|
1514
|
+
} catch (err) {
|
|
1515
|
+
throw new InvalidResponseError(
|
|
1516
|
+
`QueryAssistanceClient.query:verify:200`,
|
|
1517
|
+
err,
|
|
1518
|
+
responseValue,
|
|
1519
|
+
void 0,
|
|
1520
|
+
void 0
|
|
1521
|
+
);
|
|
1508
1522
|
}
|
|
1509
|
-
})
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1523
|
+
} catch (e) {
|
|
1524
|
+
if (isHttpClientAbortError(e) || isInvalidResponseError(e)) {
|
|
1525
|
+
throw e;
|
|
1526
|
+
}
|
|
1527
|
+
if (!isHttpClientResponseError(e)) {
|
|
1528
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
1529
|
+
}
|
|
1530
|
+
const response = e.response;
|
|
1531
|
+
switch (response.status) {
|
|
1532
|
+
case 400: {
|
|
1533
|
+
const responseValue = await response.body("json");
|
|
1534
|
+
try {
|
|
1535
|
+
const errorBody = fromJson15(responseValue);
|
|
1536
|
+
throw new ErrorEnvelopeError(
|
|
1537
|
+
"400",
|
|
1538
|
+
response,
|
|
1539
|
+
errorBody,
|
|
1540
|
+
getErrorMessage(errorBody, "The supplied request is wrong."),
|
|
1541
|
+
e
|
|
1542
|
+
);
|
|
1543
|
+
} catch (err) {
|
|
1544
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1545
|
+
throw err;
|
|
1546
|
+
}
|
|
1547
|
+
throw new InvalidResponseError(
|
|
1548
|
+
`QueryAssistanceClient.query:verify:400`,
|
|
1549
|
+
err,
|
|
1550
|
+
responseValue,
|
|
1551
|
+
"ErrorEnvelope",
|
|
1552
|
+
void 0
|
|
1553
|
+
);
|
|
1524
1554
|
}
|
|
1525
|
-
throw new InvalidResponseError(
|
|
1526
|
-
`QueryAssistanceClient.query:verify:400`,
|
|
1527
|
-
err,
|
|
1528
|
-
responseValue,
|
|
1529
|
-
"ErrorEnvelope",
|
|
1530
|
-
void 0
|
|
1531
|
-
);
|
|
1532
1555
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1556
|
+
case 500: {
|
|
1557
|
+
const responseValue = await response.body("json");
|
|
1558
|
+
try {
|
|
1559
|
+
const errorBody = fromJson15(responseValue);
|
|
1560
|
+
throw new ErrorEnvelopeError(
|
|
1561
|
+
"500",
|
|
1562
|
+
response,
|
|
1563
|
+
errorBody,
|
|
1564
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
1565
|
+
e
|
|
1566
|
+
);
|
|
1567
|
+
} catch (err) {
|
|
1568
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1569
|
+
throw err;
|
|
1570
|
+
}
|
|
1571
|
+
throw new InvalidResponseError(
|
|
1572
|
+
`QueryAssistanceClient.query:verify:500`,
|
|
1573
|
+
err,
|
|
1574
|
+
responseValue,
|
|
1575
|
+
"ErrorEnvelope",
|
|
1576
|
+
void 0
|
|
1577
|
+
);
|
|
1547
1578
|
}
|
|
1548
|
-
throw new InvalidResponseError(
|
|
1549
|
-
`QueryAssistanceClient.query:verify:500`,
|
|
1550
|
-
err,
|
|
1551
|
-
responseValue,
|
|
1552
|
-
"ErrorEnvelope",
|
|
1553
|
-
void 0
|
|
1554
|
-
);
|
|
1555
1579
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
} catch (err) {
|
|
1562
|
-
throw new InvalidResponseError(
|
|
1563
|
-
`QueryAssistanceClient.query:verify:${response.status}`,
|
|
1564
|
-
err,
|
|
1580
|
+
default: {
|
|
1581
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
1582
|
+
throw new ClientRequestError(
|
|
1583
|
+
`${response.status}`,
|
|
1584
|
+
response,
|
|
1565
1585
|
responseValue,
|
|
1566
|
-
|
|
1567
|
-
|
|
1586
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
1587
|
+
e
|
|
1568
1588
|
);
|
|
1569
1589
|
}
|
|
1570
1590
|
}
|
|
1571
|
-
default: {
|
|
1572
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
1573
|
-
throw new ClientRequestError(
|
|
1574
|
-
`${response.status}`,
|
|
1575
|
-
response,
|
|
1576
|
-
responseValue,
|
|
1577
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1578
|
-
);
|
|
1579
|
-
}
|
|
1580
1591
|
}
|
|
1581
1592
|
}
|
|
1582
1593
|
async queryParse(config) {
|
|
@@ -1587,97 +1598,105 @@ var QueryAssistanceClient = class {
|
|
|
1587
1598
|
const headerParameters = {
|
|
1588
1599
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1589
1600
|
};
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
return
|
|
1601
|
+
try {
|
|
1602
|
+
const response = await this.httpClient.send({
|
|
1603
|
+
url: `/platform/storage/query/v1/query:parse`,
|
|
1604
|
+
method: "POST",
|
|
1605
|
+
requestBodyType: "json",
|
|
1606
|
+
body: encodedBody,
|
|
1607
|
+
headers: {
|
|
1608
|
+
"Content-Type": "application/json",
|
|
1609
|
+
Accept: "application/json",
|
|
1610
|
+
...headerParameters
|
|
1611
|
+
},
|
|
1612
|
+
abortSignal: config.abortSignal,
|
|
1613
|
+
statusValidator: (status) => {
|
|
1614
|
+
return [200].includes(status);
|
|
1604
1615
|
}
|
|
1605
|
-
|
|
1616
|
+
});
|
|
1617
|
+
const responseValue = await response.body("json");
|
|
1618
|
+
try {
|
|
1619
|
+
return fromJson6(responseValue);
|
|
1620
|
+
} catch (err) {
|
|
1621
|
+
throw new InvalidResponseError(
|
|
1622
|
+
`QueryAssistanceClient.query:parse:200`,
|
|
1623
|
+
err,
|
|
1624
|
+
responseValue,
|
|
1625
|
+
void 0,
|
|
1626
|
+
void 0
|
|
1627
|
+
);
|
|
1606
1628
|
}
|
|
1607
|
-
})
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1629
|
+
} catch (e) {
|
|
1630
|
+
if (isHttpClientAbortError(e) || isInvalidResponseError(e)) {
|
|
1631
|
+
throw e;
|
|
1632
|
+
}
|
|
1633
|
+
if (!isHttpClientResponseError(e)) {
|
|
1634
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
1635
|
+
}
|
|
1636
|
+
const response = e.response;
|
|
1637
|
+
switch (response.status) {
|
|
1638
|
+
case 400: {
|
|
1639
|
+
const responseValue = await response.body("json");
|
|
1640
|
+
try {
|
|
1641
|
+
const errorBody = fromJson15(responseValue);
|
|
1642
|
+
throw new ErrorEnvelopeError(
|
|
1643
|
+
"400",
|
|
1644
|
+
response,
|
|
1618
1645
|
errorBody,
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1646
|
+
getErrorMessage(
|
|
1647
|
+
errorBody,
|
|
1648
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
1649
|
+
),
|
|
1650
|
+
e
|
|
1651
|
+
);
|
|
1652
|
+
} catch (err) {
|
|
1653
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1654
|
+
throw err;
|
|
1655
|
+
}
|
|
1656
|
+
throw new InvalidResponseError(
|
|
1657
|
+
`QueryAssistanceClient.query:parse:400`,
|
|
1658
|
+
err,
|
|
1659
|
+
responseValue,
|
|
1660
|
+
"ErrorEnvelope",
|
|
1661
|
+
void 0
|
|
1662
|
+
);
|
|
1625
1663
|
}
|
|
1626
|
-
throw new InvalidResponseError(
|
|
1627
|
-
`QueryAssistanceClient.query:parse:400`,
|
|
1628
|
-
err,
|
|
1629
|
-
responseValue,
|
|
1630
|
-
"ErrorEnvelope",
|
|
1631
|
-
void 0
|
|
1632
|
-
);
|
|
1633
1664
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1665
|
+
case 500: {
|
|
1666
|
+
const responseValue = await response.body("json");
|
|
1667
|
+
try {
|
|
1668
|
+
const errorBody = fromJson15(responseValue);
|
|
1669
|
+
throw new ErrorEnvelopeError(
|
|
1670
|
+
"500",
|
|
1671
|
+
response,
|
|
1672
|
+
errorBody,
|
|
1673
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
1674
|
+
e
|
|
1675
|
+
);
|
|
1676
|
+
} catch (err) {
|
|
1677
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1678
|
+
throw err;
|
|
1679
|
+
}
|
|
1680
|
+
throw new InvalidResponseError(
|
|
1681
|
+
`QueryAssistanceClient.query:parse:500`,
|
|
1682
|
+
err,
|
|
1683
|
+
responseValue,
|
|
1684
|
+
"ErrorEnvelope",
|
|
1685
|
+
void 0
|
|
1686
|
+
);
|
|
1648
1687
|
}
|
|
1649
|
-
throw new InvalidResponseError(
|
|
1650
|
-
`QueryAssistanceClient.query:parse:500`,
|
|
1651
|
-
err,
|
|
1652
|
-
responseValue,
|
|
1653
|
-
"ErrorEnvelope",
|
|
1654
|
-
void 0
|
|
1655
|
-
);
|
|
1656
1688
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
} catch (err) {
|
|
1663
|
-
throw new InvalidResponseError(
|
|
1664
|
-
`QueryAssistanceClient.query:parse:${response.status}`,
|
|
1665
|
-
err,
|
|
1689
|
+
default: {
|
|
1690
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
1691
|
+
throw new ClientRequestError(
|
|
1692
|
+
`${response.status}`,
|
|
1693
|
+
response,
|
|
1666
1694
|
responseValue,
|
|
1667
|
-
|
|
1668
|
-
|
|
1695
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
1696
|
+
e
|
|
1669
1697
|
);
|
|
1670
1698
|
}
|
|
1671
1699
|
}
|
|
1672
|
-
default: {
|
|
1673
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
1674
|
-
throw new ClientRequestError(
|
|
1675
|
-
`${response.status}`,
|
|
1676
|
-
response,
|
|
1677
|
-
responseValue,
|
|
1678
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1679
|
-
);
|
|
1680
|
-
}
|
|
1681
1700
|
}
|
|
1682
1701
|
}
|
|
1683
1702
|
async queryAutocomplete(config) {
|
|
@@ -1688,104 +1707,116 @@ var QueryAssistanceClient = class {
|
|
|
1688
1707
|
const headerParameters = {
|
|
1689
1708
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1690
1709
|
};
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
return
|
|
1710
|
+
try {
|
|
1711
|
+
const response = await this.httpClient.send({
|
|
1712
|
+
url: `/platform/storage/query/v1/query:autocomplete`,
|
|
1713
|
+
method: "POST",
|
|
1714
|
+
requestBodyType: "json",
|
|
1715
|
+
body: encodedBody,
|
|
1716
|
+
headers: {
|
|
1717
|
+
"Content-Type": "application/json",
|
|
1718
|
+
Accept: "application/json",
|
|
1719
|
+
...headerParameters
|
|
1720
|
+
},
|
|
1721
|
+
abortSignal: config.abortSignal,
|
|
1722
|
+
statusValidator: (status) => {
|
|
1723
|
+
return [200].includes(status);
|
|
1705
1724
|
}
|
|
1706
|
-
|
|
1725
|
+
});
|
|
1726
|
+
const responseValue = await response.body("json");
|
|
1727
|
+
try {
|
|
1728
|
+
return fromJson5(responseValue);
|
|
1729
|
+
} catch (err) {
|
|
1730
|
+
throw new InvalidResponseError(
|
|
1731
|
+
`QueryAssistanceClient.query:autocomplete:200`,
|
|
1732
|
+
err,
|
|
1733
|
+
responseValue,
|
|
1734
|
+
void 0,
|
|
1735
|
+
void 0
|
|
1736
|
+
);
|
|
1707
1737
|
}
|
|
1708
|
-
})
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1738
|
+
} catch (e) {
|
|
1739
|
+
if (isHttpClientAbortError(e) || isInvalidResponseError(e)) {
|
|
1740
|
+
throw e;
|
|
1741
|
+
}
|
|
1742
|
+
if (!isHttpClientResponseError(e)) {
|
|
1743
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
1744
|
+
}
|
|
1745
|
+
const response = e.response;
|
|
1746
|
+
switch (response.status) {
|
|
1747
|
+
case 400: {
|
|
1748
|
+
const responseValue = await response.body("json");
|
|
1749
|
+
try {
|
|
1750
|
+
const errorBody = fromJson15(responseValue);
|
|
1751
|
+
throw new ErrorEnvelopeError(
|
|
1752
|
+
"400",
|
|
1753
|
+
response,
|
|
1719
1754
|
errorBody,
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1755
|
+
getErrorMessage(
|
|
1756
|
+
errorBody,
|
|
1757
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
1758
|
+
),
|
|
1759
|
+
e
|
|
1760
|
+
);
|
|
1761
|
+
} catch (err) {
|
|
1762
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1763
|
+
throw err;
|
|
1764
|
+
}
|
|
1765
|
+
throw new InvalidResponseError(
|
|
1766
|
+
`QueryAssistanceClient.query:autocomplete:400`,
|
|
1767
|
+
err,
|
|
1768
|
+
responseValue,
|
|
1769
|
+
"ErrorEnvelope",
|
|
1770
|
+
void 0
|
|
1771
|
+
);
|
|
1726
1772
|
}
|
|
1727
|
-
throw new InvalidResponseError(
|
|
1728
|
-
`QueryAssistanceClient.query:autocomplete:400`,
|
|
1729
|
-
err,
|
|
1730
|
-
responseValue,
|
|
1731
|
-
"ErrorEnvelope",
|
|
1732
|
-
void 0
|
|
1733
|
-
);
|
|
1734
1773
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1774
|
+
case 500: {
|
|
1775
|
+
const responseValue = await response.body("json");
|
|
1776
|
+
try {
|
|
1777
|
+
const errorBody = fromJson15(responseValue);
|
|
1778
|
+
throw new ErrorEnvelopeError(
|
|
1779
|
+
"500",
|
|
1780
|
+
response,
|
|
1781
|
+
errorBody,
|
|
1782
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
1783
|
+
e
|
|
1784
|
+
);
|
|
1785
|
+
} catch (err) {
|
|
1786
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1787
|
+
throw err;
|
|
1788
|
+
}
|
|
1789
|
+
throw new InvalidResponseError(
|
|
1790
|
+
`QueryAssistanceClient.query:autocomplete:500`,
|
|
1791
|
+
err,
|
|
1792
|
+
responseValue,
|
|
1793
|
+
"ErrorEnvelope",
|
|
1794
|
+
void 0
|
|
1795
|
+
);
|
|
1749
1796
|
}
|
|
1750
|
-
throw new InvalidResponseError(
|
|
1751
|
-
`QueryAssistanceClient.query:autocomplete:500`,
|
|
1752
|
-
err,
|
|
1753
|
-
responseValue,
|
|
1754
|
-
"ErrorEnvelope",
|
|
1755
|
-
void 0
|
|
1756
|
-
);
|
|
1757
1797
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
} catch (err) {
|
|
1764
|
-
throw new InvalidResponseError(
|
|
1765
|
-
`QueryAssistanceClient.query:autocomplete:${response.status}`,
|
|
1766
|
-
err,
|
|
1798
|
+
default: {
|
|
1799
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
1800
|
+
throw new ClientRequestError(
|
|
1801
|
+
`${response.status}`,
|
|
1802
|
+
response,
|
|
1767
1803
|
responseValue,
|
|
1768
|
-
|
|
1769
|
-
|
|
1804
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
1805
|
+
e
|
|
1770
1806
|
);
|
|
1771
1807
|
}
|
|
1772
1808
|
}
|
|
1773
|
-
default: {
|
|
1774
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
1775
|
-
throw new ClientRequestError(
|
|
1776
|
-
`${response.status}`,
|
|
1777
|
-
response,
|
|
1778
|
-
responseValue,
|
|
1779
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1780
|
-
);
|
|
1781
|
-
}
|
|
1782
1809
|
}
|
|
1783
1810
|
}
|
|
1784
1811
|
};
|
|
1785
1812
|
var queryAssistanceClient = /* @__PURE__ */ new QueryAssistanceClient(defaultHttpClient);
|
|
1786
1813
|
|
|
1787
1814
|
// packages/client/query/src/lib/apis/query-execution-api.ts
|
|
1788
|
-
import {
|
|
1815
|
+
import {
|
|
1816
|
+
httpClient as defaultHttpClient2,
|
|
1817
|
+
isHttpClientResponseError as isHttpClientResponseError2,
|
|
1818
|
+
isHttpClientAbortError as isHttpClientAbortError2
|
|
1819
|
+
} from "@dynatrace-sdk/http-client";
|
|
1789
1820
|
|
|
1790
1821
|
// packages/client/query/src/lib/models/execute-request.transformation.ts
|
|
1791
1822
|
var execute_request_transformation_exports = {};
|
|
@@ -3062,102 +3093,104 @@ var QueryExecutionClient = class {
|
|
|
3062
3093
|
"request-timeout-milliseconds": config.requestTimeoutMilliseconds,
|
|
3063
3094
|
enrich: config.enrich
|
|
3064
3095
|
});
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
return
|
|
3096
|
+
try {
|
|
3097
|
+
const response = await this.httpClient.send({
|
|
3098
|
+
url: `/platform/storage/query/v1/query:poll${query}`,
|
|
3099
|
+
method: "GET",
|
|
3100
|
+
headers: {
|
|
3101
|
+
Accept: "application/json"
|
|
3102
|
+
},
|
|
3103
|
+
abortSignal: config.abortSignal,
|
|
3104
|
+
statusValidator: (status) => {
|
|
3105
|
+
return [200].includes(status);
|
|
3075
3106
|
}
|
|
3076
|
-
|
|
3107
|
+
});
|
|
3108
|
+
const responseValue = await response.body("json");
|
|
3109
|
+
try {
|
|
3110
|
+
return fromJson34(responseValue);
|
|
3111
|
+
} catch (err) {
|
|
3112
|
+
throw new InvalidResponseError(`QueryExecutionClient.query:poll:200`, err, responseValue, void 0, void 0);
|
|
3077
3113
|
}
|
|
3078
|
-
})
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3114
|
+
} catch (e) {
|
|
3115
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e)) {
|
|
3116
|
+
throw e;
|
|
3117
|
+
}
|
|
3118
|
+
if (!isHttpClientResponseError2(e)) {
|
|
3119
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
3120
|
+
}
|
|
3121
|
+
const response = e.response;
|
|
3122
|
+
switch (response.status) {
|
|
3123
|
+
case 400: {
|
|
3124
|
+
const responseValue = await response.body("json");
|
|
3125
|
+
try {
|
|
3126
|
+
const errorBody = fromJson15(responseValue);
|
|
3127
|
+
throw new ErrorEnvelopeError(
|
|
3128
|
+
"400",
|
|
3129
|
+
response,
|
|
3089
3130
|
errorBody,
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3131
|
+
getErrorMessage(
|
|
3132
|
+
errorBody,
|
|
3133
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3134
|
+
),
|
|
3135
|
+
e
|
|
3136
|
+
);
|
|
3137
|
+
} catch (err) {
|
|
3138
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3139
|
+
throw err;
|
|
3140
|
+
}
|
|
3141
|
+
throw new InvalidResponseError(
|
|
3142
|
+
`QueryExecutionClient.query:poll:400`,
|
|
3143
|
+
err,
|
|
3144
|
+
responseValue,
|
|
3145
|
+
"ErrorEnvelope",
|
|
3146
|
+
void 0
|
|
3147
|
+
);
|
|
3096
3148
|
}
|
|
3097
|
-
throw new InvalidResponseError(
|
|
3098
|
-
`QueryExecutionClient.query:poll:400`,
|
|
3099
|
-
err,
|
|
3100
|
-
responseValue,
|
|
3101
|
-
"ErrorEnvelope",
|
|
3102
|
-
void 0
|
|
3103
|
-
);
|
|
3104
3149
|
}
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
`410`,
|
|
3110
|
-
response,
|
|
3111
|
-
responseValue,
|
|
3112
|
-
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3113
|
-
);
|
|
3114
|
-
}
|
|
3115
|
-
case 500: {
|
|
3116
|
-
const responseValue = await response.body("json");
|
|
3117
|
-
try {
|
|
3118
|
-
const errorBody = fromJson15(responseValue);
|
|
3119
|
-
throw new ErrorEnvelopeError(
|
|
3120
|
-
"500",
|
|
3150
|
+
case 410: {
|
|
3151
|
+
const responseValue = await response.body("text");
|
|
3152
|
+
throw new ClientRequestError(
|
|
3153
|
+
`410`,
|
|
3121
3154
|
response,
|
|
3122
|
-
errorBody,
|
|
3123
|
-
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
3124
|
-
);
|
|
3125
|
-
} catch (err) {
|
|
3126
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3127
|
-
throw err;
|
|
3128
|
-
}
|
|
3129
|
-
throw new InvalidResponseError(
|
|
3130
|
-
`QueryExecutionClient.query:poll:500`,
|
|
3131
|
-
err,
|
|
3132
3155
|
responseValue,
|
|
3133
|
-
|
|
3134
|
-
void 0
|
|
3156
|
+
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3135
3157
|
);
|
|
3136
3158
|
}
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3159
|
+
case 500: {
|
|
3160
|
+
const responseValue = await response.body("json");
|
|
3161
|
+
try {
|
|
3162
|
+
const errorBody = fromJson15(responseValue);
|
|
3163
|
+
throw new ErrorEnvelopeError(
|
|
3164
|
+
"500",
|
|
3165
|
+
response,
|
|
3166
|
+
errorBody,
|
|
3167
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
3168
|
+
e
|
|
3169
|
+
);
|
|
3170
|
+
} catch (err) {
|
|
3171
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3172
|
+
throw err;
|
|
3173
|
+
}
|
|
3174
|
+
throw new InvalidResponseError(
|
|
3175
|
+
`QueryExecutionClient.query:poll:500`,
|
|
3176
|
+
err,
|
|
3177
|
+
responseValue,
|
|
3178
|
+
"ErrorEnvelope",
|
|
3179
|
+
void 0
|
|
3180
|
+
);
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
default: {
|
|
3184
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3185
|
+
throw new ClientRequestError(
|
|
3186
|
+
`${response.status}`,
|
|
3187
|
+
response,
|
|
3146
3188
|
responseValue,
|
|
3147
|
-
|
|
3148
|
-
|
|
3189
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
3190
|
+
e
|
|
3149
3191
|
);
|
|
3150
3192
|
}
|
|
3151
3193
|
}
|
|
3152
|
-
default: {
|
|
3153
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
3154
|
-
throw new ClientRequestError(
|
|
3155
|
-
`${response.status}`,
|
|
3156
|
-
response,
|
|
3157
|
-
responseValue,
|
|
3158
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3159
|
-
);
|
|
3160
|
-
}
|
|
3161
3194
|
}
|
|
3162
3195
|
}
|
|
3163
3196
|
async queryExecute(config) {
|
|
@@ -3169,133 +3202,241 @@ var QueryExecutionClient = class {
|
|
|
3169
3202
|
const headerParameters = {
|
|
3170
3203
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
3171
3204
|
};
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
return
|
|
3205
|
+
try {
|
|
3206
|
+
const response = await this.httpClient.send({
|
|
3207
|
+
url: `/platform/storage/query/v1/query:execute${query}`,
|
|
3208
|
+
method: "POST",
|
|
3209
|
+
requestBodyType: "json",
|
|
3210
|
+
body: encodedBody,
|
|
3211
|
+
headers: {
|
|
3212
|
+
"Content-Type": "application/json",
|
|
3213
|
+
Accept: "application/json",
|
|
3214
|
+
...headerParameters
|
|
3215
|
+
},
|
|
3216
|
+
abortSignal: config.abortSignal,
|
|
3217
|
+
statusValidator: (status) => {
|
|
3218
|
+
return [200, 202].includes(status);
|
|
3186
3219
|
}
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3202
|
-
)
|
|
3203
|
-
);
|
|
3204
|
-
} catch (err) {
|
|
3205
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3206
|
-
throw err;
|
|
3220
|
+
});
|
|
3221
|
+
switch (response.status) {
|
|
3222
|
+
case 200: {
|
|
3223
|
+
const responseValue = await response.body("json");
|
|
3224
|
+
try {
|
|
3225
|
+
return fromJson35(responseValue);
|
|
3226
|
+
} catch (err) {
|
|
3227
|
+
throw new InvalidResponseError(
|
|
3228
|
+
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3229
|
+
err,
|
|
3230
|
+
responseValue,
|
|
3231
|
+
void 0,
|
|
3232
|
+
void 0
|
|
3233
|
+
);
|
|
3207
3234
|
}
|
|
3208
|
-
throw new InvalidResponseError(
|
|
3209
|
-
`QueryExecutionClient.query:execute:400`,
|
|
3210
|
-
err,
|
|
3211
|
-
responseValue,
|
|
3212
|
-
"ErrorEnvelope",
|
|
3213
|
-
void 0
|
|
3214
|
-
);
|
|
3215
3235
|
}
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3229
|
-
throw err;
|
|
3236
|
+
case 202: {
|
|
3237
|
+
const responseValue = await response.body("json");
|
|
3238
|
+
try {
|
|
3239
|
+
return fromJson35(responseValue);
|
|
3240
|
+
} catch (err) {
|
|
3241
|
+
throw new InvalidResponseError(
|
|
3242
|
+
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3243
|
+
err,
|
|
3244
|
+
responseValue,
|
|
3245
|
+
void 0,
|
|
3246
|
+
void 0
|
|
3247
|
+
);
|
|
3230
3248
|
}
|
|
3231
|
-
throw new InvalidResponseError(
|
|
3232
|
-
`QueryExecutionClient.query:execute:500`,
|
|
3233
|
-
err,
|
|
3234
|
-
responseValue,
|
|
3235
|
-
"ErrorEnvelope",
|
|
3236
|
-
void 0
|
|
3237
|
-
);
|
|
3238
3249
|
}
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
const errorBody = fromJson15(responseValue);
|
|
3244
|
-
throw new ErrorEnvelopeError(
|
|
3245
|
-
"503",
|
|
3250
|
+
default: {
|
|
3251
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3252
|
+
throw new ClientRequestError(
|
|
3253
|
+
`${response.status}`,
|
|
3246
3254
|
response,
|
|
3247
|
-
errorBody,
|
|
3248
|
-
getErrorMessage(errorBody, "Service is unavailable.")
|
|
3249
|
-
);
|
|
3250
|
-
} catch (err) {
|
|
3251
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3252
|
-
throw err;
|
|
3253
|
-
}
|
|
3254
|
-
throw new InvalidResponseError(
|
|
3255
|
-
`QueryExecutionClient.query:execute:503`,
|
|
3256
|
-
err,
|
|
3257
3255
|
responseValue,
|
|
3258
|
-
"
|
|
3259
|
-
void 0
|
|
3256
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3260
3257
|
);
|
|
3261
3258
|
}
|
|
3262
3259
|
}
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
return fromJson35(responseValue);
|
|
3267
|
-
} catch (err) {
|
|
3268
|
-
throw new InvalidResponseError(
|
|
3269
|
-
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3270
|
-
err,
|
|
3271
|
-
responseValue,
|
|
3272
|
-
void 0,
|
|
3273
|
-
void 0
|
|
3274
|
-
);
|
|
3275
|
-
}
|
|
3260
|
+
} catch (e) {
|
|
3261
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3262
|
+
throw e;
|
|
3276
3263
|
}
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
try {
|
|
3280
|
-
return fromJson35(responseValue);
|
|
3281
|
-
} catch (err) {
|
|
3282
|
-
throw new InvalidResponseError(
|
|
3283
|
-
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3284
|
-
err,
|
|
3285
|
-
responseValue,
|
|
3286
|
-
void 0,
|
|
3287
|
-
void 0
|
|
3288
|
-
);
|
|
3289
|
-
}
|
|
3264
|
+
if (!isHttpClientResponseError2(e)) {
|
|
3265
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
3290
3266
|
}
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3267
|
+
const response = e.response;
|
|
3268
|
+
switch (response.status) {
|
|
3269
|
+
case 400: {
|
|
3270
|
+
const responseValue = await response.body("json");
|
|
3271
|
+
try {
|
|
3272
|
+
const errorBody = fromJson15(responseValue);
|
|
3273
|
+
throw new ErrorEnvelopeError(
|
|
3274
|
+
"400",
|
|
3275
|
+
response,
|
|
3276
|
+
errorBody,
|
|
3277
|
+
getErrorMessage(
|
|
3278
|
+
errorBody,
|
|
3279
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3280
|
+
),
|
|
3281
|
+
e
|
|
3282
|
+
);
|
|
3283
|
+
} catch (err) {
|
|
3284
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3285
|
+
throw err;
|
|
3286
|
+
}
|
|
3287
|
+
throw new InvalidResponseError(
|
|
3288
|
+
`QueryExecutionClient.query:execute:400`,
|
|
3289
|
+
err,
|
|
3290
|
+
responseValue,
|
|
3291
|
+
"ErrorEnvelope",
|
|
3292
|
+
void 0
|
|
3293
|
+
);
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
case 403: {
|
|
3297
|
+
const responseValue = await response.body("json");
|
|
3298
|
+
try {
|
|
3299
|
+
const errorBody = fromJson15(responseValue);
|
|
3300
|
+
throw new ErrorEnvelopeError(
|
|
3301
|
+
"403",
|
|
3302
|
+
response,
|
|
3303
|
+
errorBody,
|
|
3304
|
+
getErrorMessage(errorBody, "Insufficient permissions."),
|
|
3305
|
+
e
|
|
3306
|
+
);
|
|
3307
|
+
} catch (err) {
|
|
3308
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3309
|
+
throw err;
|
|
3310
|
+
}
|
|
3311
|
+
throw new InvalidResponseError(
|
|
3312
|
+
`QueryExecutionClient.query:execute:403`,
|
|
3313
|
+
err,
|
|
3314
|
+
responseValue,
|
|
3315
|
+
"ErrorEnvelope",
|
|
3316
|
+
void 0
|
|
3317
|
+
);
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
case 429: {
|
|
3321
|
+
const responseValue = await response.body("json");
|
|
3322
|
+
try {
|
|
3323
|
+
const errorBody = fromJson15(responseValue);
|
|
3324
|
+
throw new ErrorEnvelopeError(
|
|
3325
|
+
"429",
|
|
3326
|
+
response,
|
|
3327
|
+
errorBody,
|
|
3328
|
+
getErrorMessage(errorBody, "Too many requests."),
|
|
3329
|
+
e
|
|
3330
|
+
);
|
|
3331
|
+
} catch (err) {
|
|
3332
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3333
|
+
throw err;
|
|
3334
|
+
}
|
|
3335
|
+
throw new InvalidResponseError(
|
|
3336
|
+
`QueryExecutionClient.query:execute:429`,
|
|
3337
|
+
err,
|
|
3338
|
+
responseValue,
|
|
3339
|
+
"ErrorEnvelope",
|
|
3340
|
+
void 0
|
|
3341
|
+
);
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
case 500: {
|
|
3345
|
+
const responseValue = await response.body("json");
|
|
3346
|
+
try {
|
|
3347
|
+
const errorBody = fromJson15(responseValue);
|
|
3348
|
+
throw new ErrorEnvelopeError(
|
|
3349
|
+
"500",
|
|
3350
|
+
response,
|
|
3351
|
+
errorBody,
|
|
3352
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
3353
|
+
e
|
|
3354
|
+
);
|
|
3355
|
+
} catch (err) {
|
|
3356
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3357
|
+
throw err;
|
|
3358
|
+
}
|
|
3359
|
+
throw new InvalidResponseError(
|
|
3360
|
+
`QueryExecutionClient.query:execute:500`,
|
|
3361
|
+
err,
|
|
3362
|
+
responseValue,
|
|
3363
|
+
"ErrorEnvelope",
|
|
3364
|
+
void 0
|
|
3365
|
+
);
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3368
|
+
case 503: {
|
|
3369
|
+
const responseValue = await response.body("json");
|
|
3370
|
+
try {
|
|
3371
|
+
const errorBody = fromJson15(responseValue);
|
|
3372
|
+
throw new ErrorEnvelopeError(
|
|
3373
|
+
"503",
|
|
3374
|
+
response,
|
|
3375
|
+
errorBody,
|
|
3376
|
+
getErrorMessage(errorBody, "Service is unavailable."),
|
|
3377
|
+
e
|
|
3378
|
+
);
|
|
3379
|
+
} catch (err) {
|
|
3380
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3381
|
+
throw err;
|
|
3382
|
+
}
|
|
3383
|
+
throw new InvalidResponseError(
|
|
3384
|
+
`QueryExecutionClient.query:execute:503`,
|
|
3385
|
+
err,
|
|
3386
|
+
responseValue,
|
|
3387
|
+
"ErrorEnvelope",
|
|
3388
|
+
void 0
|
|
3389
|
+
);
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
default: {
|
|
3393
|
+
if (response.status >= 400 && response.status <= 499) {
|
|
3394
|
+
const responseValue = await response.body("json");
|
|
3395
|
+
try {
|
|
3396
|
+
const errorBody = fromJson15(responseValue);
|
|
3397
|
+
throw new ErrorEnvelopeError("4XX", response, errorBody, getErrorMessage(errorBody, "Client error."), e);
|
|
3398
|
+
} catch (err) {
|
|
3399
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3400
|
+
throw err;
|
|
3401
|
+
}
|
|
3402
|
+
throw new InvalidResponseError(
|
|
3403
|
+
`QueryExecutionClient.query:execute:4XX`,
|
|
3404
|
+
err,
|
|
3405
|
+
responseValue,
|
|
3406
|
+
"ErrorEnvelope",
|
|
3407
|
+
void 0
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
} else if (response.status >= 500 && response.status <= 599) {
|
|
3411
|
+
const responseValue = await response.body("json");
|
|
3412
|
+
try {
|
|
3413
|
+
const errorBody = fromJson15(responseValue);
|
|
3414
|
+
throw new ErrorEnvelopeError("5XX", response, errorBody, getErrorMessage(errorBody, "Server error."), e);
|
|
3415
|
+
} catch (err) {
|
|
3416
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3417
|
+
throw err;
|
|
3418
|
+
}
|
|
3419
|
+
throw new InvalidResponseError(
|
|
3420
|
+
`QueryExecutionClient.query:execute:5XX`,
|
|
3421
|
+
err,
|
|
3422
|
+
responseValue,
|
|
3423
|
+
"ErrorEnvelope",
|
|
3424
|
+
void 0
|
|
3425
|
+
);
|
|
3426
|
+
}
|
|
3427
|
+
} else {
|
|
3428
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3429
|
+
throw new ClientRequestError(
|
|
3430
|
+
`${response.status}`,
|
|
3431
|
+
response,
|
|
3432
|
+
responseValue,
|
|
3433
|
+
getErrorMessage(
|
|
3434
|
+
responseValue,
|
|
3435
|
+
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
3436
|
+
)
|
|
3437
|
+
);
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3299
3440
|
}
|
|
3300
3441
|
}
|
|
3301
3442
|
}
|
|
@@ -3303,106 +3444,127 @@ var QueryExecutionClient = class {
|
|
|
3303
3444
|
if (!config) {
|
|
3304
3445
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
3305
3446
|
}
|
|
3306
|
-
const query = toQueryString({ "request-token": config.requestToken });
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
return
|
|
3447
|
+
const query = toQueryString({ "request-token": config.requestToken, enrich: config.enrich });
|
|
3448
|
+
try {
|
|
3449
|
+
const response = await this.httpClient.send({
|
|
3450
|
+
url: `/platform/storage/query/v1/query:cancel${query}`,
|
|
3451
|
+
method: "POST",
|
|
3452
|
+
headers: {
|
|
3453
|
+
Accept: "application/json"
|
|
3454
|
+
},
|
|
3455
|
+
abortSignal: config.abortSignal,
|
|
3456
|
+
statusValidator: (status) => {
|
|
3457
|
+
return [200, 202].includes(status);
|
|
3317
3458
|
}
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3333
|
-
)
|
|
3334
|
-
);
|
|
3335
|
-
} catch (err) {
|
|
3336
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3337
|
-
throw err;
|
|
3459
|
+
});
|
|
3460
|
+
switch (response.status) {
|
|
3461
|
+
case 200: {
|
|
3462
|
+
const responseValue = await response.body("json");
|
|
3463
|
+
try {
|
|
3464
|
+
return fromJson34(responseValue);
|
|
3465
|
+
} catch (err) {
|
|
3466
|
+
throw new InvalidResponseError(
|
|
3467
|
+
`QueryExecutionClient.query:cancel:${response.status}`,
|
|
3468
|
+
err,
|
|
3469
|
+
responseValue,
|
|
3470
|
+
void 0,
|
|
3471
|
+
void 0
|
|
3472
|
+
);
|
|
3338
3473
|
}
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3474
|
+
}
|
|
3475
|
+
case 202: {
|
|
3476
|
+
return;
|
|
3477
|
+
}
|
|
3478
|
+
default: {
|
|
3479
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3480
|
+
throw new ClientRequestError(
|
|
3481
|
+
`${response.status}`,
|
|
3482
|
+
response,
|
|
3342
3483
|
responseValue,
|
|
3343
|
-
"
|
|
3344
|
-
void 0
|
|
3484
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3345
3485
|
);
|
|
3346
3486
|
}
|
|
3347
3487
|
}
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
throw
|
|
3351
|
-
`410`,
|
|
3352
|
-
response,
|
|
3353
|
-
responseValue,
|
|
3354
|
-
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3355
|
-
);
|
|
3488
|
+
} catch (e) {
|
|
3489
|
+
if (isHttpClientAbortError2(e) || isInvalidResponseError(e) || isClientRequestError(e)) {
|
|
3490
|
+
throw e;
|
|
3356
3491
|
}
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3492
|
+
if (!isHttpClientResponseError2(e)) {
|
|
3493
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
3494
|
+
}
|
|
3495
|
+
const response = e.response;
|
|
3496
|
+
switch (response.status) {
|
|
3497
|
+
case 400: {
|
|
3498
|
+
const responseValue = await response.body("json");
|
|
3499
|
+
try {
|
|
3500
|
+
const errorBody = fromJson15(responseValue);
|
|
3501
|
+
throw new ErrorEnvelopeError(
|
|
3502
|
+
"400",
|
|
3503
|
+
response,
|
|
3504
|
+
errorBody,
|
|
3505
|
+
getErrorMessage(
|
|
3506
|
+
errorBody,
|
|
3507
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3508
|
+
),
|
|
3509
|
+
e
|
|
3510
|
+
);
|
|
3511
|
+
} catch (err) {
|
|
3512
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3513
|
+
throw err;
|
|
3514
|
+
}
|
|
3515
|
+
throw new InvalidResponseError(
|
|
3516
|
+
`QueryExecutionClient.query:cancel:400`,
|
|
3517
|
+
err,
|
|
3518
|
+
responseValue,
|
|
3519
|
+
"ErrorEnvelope",
|
|
3520
|
+
void 0
|
|
3521
|
+
);
|
|
3370
3522
|
}
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3523
|
+
}
|
|
3524
|
+
case 410: {
|
|
3525
|
+
const responseValue = await response.body("text");
|
|
3526
|
+
throw new ClientRequestError(
|
|
3527
|
+
`410`,
|
|
3528
|
+
response,
|
|
3374
3529
|
responseValue,
|
|
3375
|
-
|
|
3376
|
-
void 0
|
|
3530
|
+
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3377
3531
|
);
|
|
3378
3532
|
}
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3533
|
+
case 500: {
|
|
3534
|
+
const responseValue = await response.body("json");
|
|
3535
|
+
try {
|
|
3536
|
+
const errorBody = fromJson15(responseValue);
|
|
3537
|
+
throw new ErrorEnvelopeError(
|
|
3538
|
+
"500",
|
|
3539
|
+
response,
|
|
3540
|
+
errorBody,
|
|
3541
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
3542
|
+
e
|
|
3543
|
+
);
|
|
3544
|
+
} catch (err) {
|
|
3545
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3546
|
+
throw err;
|
|
3547
|
+
}
|
|
3548
|
+
throw new InvalidResponseError(
|
|
3549
|
+
`QueryExecutionClient.query:cancel:500`,
|
|
3550
|
+
err,
|
|
3551
|
+
responseValue,
|
|
3552
|
+
"ErrorEnvelope",
|
|
3553
|
+
void 0
|
|
3554
|
+
);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
default: {
|
|
3558
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3559
|
+
throw new ClientRequestError(
|
|
3560
|
+
`${response.status}`,
|
|
3561
|
+
response,
|
|
3388
3562
|
responseValue,
|
|
3389
|
-
|
|
3390
|
-
|
|
3563
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
3564
|
+
e
|
|
3391
3565
|
);
|
|
3392
3566
|
}
|
|
3393
3567
|
}
|
|
3394
|
-
case 202: {
|
|
3395
|
-
return;
|
|
3396
|
-
}
|
|
3397
|
-
default: {
|
|
3398
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
3399
|
-
throw new ClientRequestError(
|
|
3400
|
-
`${response.status}`,
|
|
3401
|
-
response,
|
|
3402
|
-
responseValue,
|
|
3403
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3404
|
-
);
|
|
3405
|
-
}
|
|
3406
3568
|
}
|
|
3407
3569
|
}
|
|
3408
3570
|
};
|
|
@@ -3430,6 +3592,7 @@ var FieldTypeType = /* @__PURE__ */ ((FieldTypeType2) => {
|
|
|
3430
3592
|
FieldTypeType2["GeoPoint"] = "geo_point";
|
|
3431
3593
|
FieldTypeType2["Array"] = "array";
|
|
3432
3594
|
FieldTypeType2["Record"] = "record";
|
|
3595
|
+
FieldTypeType2["Uid"] = "uid";
|
|
3433
3596
|
FieldTypeType2["Undefined"] = "undefined";
|
|
3434
3597
|
return FieldTypeType2;
|
|
3435
3598
|
})(FieldTypeType || {});
|
|
@@ -3484,6 +3647,7 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
|
3484
3647
|
TokenType2["MetricKey"] = "METRIC_KEY";
|
|
3485
3648
|
TokenType2["Variable"] = "VARIABLE";
|
|
3486
3649
|
TokenType2["EndComment"] = "END_COMMENT";
|
|
3650
|
+
TokenType2["UidValue"] = "UID_VALUE";
|
|
3487
3651
|
return TokenType2;
|
|
3488
3652
|
})(TokenType || {});
|
|
3489
3653
|
export {
|