@dynatrace-sdk/client-query 1.5.0 → 1.7.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 +25 -0
- package/README.md +1 -1
- package/cjs/index.js +696 -528
- package/docs/DOCS.md +7 -6
- package/dynatrace-metadata.json +3 -3
- package/esm/index.js +704 -530
- package/package.json +1 -1
- package/types/packages/client/query/src/lib/apis/query-assistance-api.d.ts +1 -1
- package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +2 -1
- 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/platform/http-client-response-error.d.ts +4 -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/types/packages/platform/error-handlers/src/lib/types/common-serialized-error.d.ts +2 -0
- package/types/packages/platform/error-handlers/src/lib/types/http-serialized-error.d.ts +3 -0
package/cjs/index.js
CHANGED
|
@@ -109,11 +109,12 @@ function getAddGlobalErrorSerializer() {
|
|
|
109
109
|
|
|
110
110
|
// packages/client/query/src/lib/error-envelopes/api-client-error.ts
|
|
111
111
|
var ApiClientError = class extends Error {
|
|
112
|
-
|
|
113
|
-
constructor(name, message) {
|
|
112
|
+
constructor(name, message, cause) {
|
|
114
113
|
super(message);
|
|
114
|
+
this.cause = cause;
|
|
115
115
|
this.name = name;
|
|
116
116
|
}
|
|
117
|
+
errorType = "JS Error" /* COMMON */;
|
|
117
118
|
};
|
|
118
119
|
function isApiClientError(e) {
|
|
119
120
|
return e instanceof ApiClientError;
|
|
@@ -123,8 +124,8 @@ function isApiClientError(e) {
|
|
|
123
124
|
var ClientRequestError = class extends ApiClientError {
|
|
124
125
|
body;
|
|
125
126
|
response;
|
|
126
|
-
constructor(name, response, body, message) {
|
|
127
|
-
super(name, message);
|
|
127
|
+
constructor(name, response, body, message, cause) {
|
|
128
|
+
super(name, message, cause);
|
|
128
129
|
this.errorType = "Http Error" /* HTTP */;
|
|
129
130
|
this.body = body;
|
|
130
131
|
this.response = response;
|
|
@@ -153,6 +154,7 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
153
154
|
stack: error.stack,
|
|
154
155
|
type: "Http Error" /* HTTP */,
|
|
155
156
|
body: error.body,
|
|
157
|
+
cause: error.cause,
|
|
156
158
|
...getOptionalErrorRef(error.body)
|
|
157
159
|
};
|
|
158
160
|
} else if (isApiClientError(error)) {
|
|
@@ -160,7 +162,8 @@ var apiClientErrorSerializer = async (error) => {
|
|
|
160
162
|
name: error.name,
|
|
161
163
|
message: error.message,
|
|
162
164
|
stack: error.stack,
|
|
163
|
-
type: "JS Error" /* COMMON
|
|
165
|
+
type: "JS Error" /* COMMON */,
|
|
166
|
+
cause: error.cause
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
169
|
};
|
|
@@ -179,15 +182,23 @@ function getOptionalErrorRef(body) {
|
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
// packages/client/query/src/lib/error-envelopes/get-error-message.ts
|
|
185
|
+
function serializeData(data) {
|
|
186
|
+
try {
|
|
187
|
+
return JSON.stringify(data);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
return String(data);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
182
192
|
function getMessagesFromErrorDetails(details) {
|
|
183
193
|
const messages = [];
|
|
184
194
|
Object.entries(details).forEach(([name, data]) => {
|
|
195
|
+
const serializedData = serializeData(data);
|
|
185
196
|
switch (name) {
|
|
186
197
|
case "missingScopes":
|
|
187
|
-
messages.push(`Missing scopes: ${
|
|
198
|
+
messages.push(`Missing scopes: ${serializedData}`);
|
|
188
199
|
break;
|
|
189
200
|
default:
|
|
190
|
-
messages.push(`${name}: ${
|
|
201
|
+
messages.push(`${name}: ${serializedData}`);
|
|
191
202
|
}
|
|
192
203
|
}, []);
|
|
193
204
|
return messages;
|
|
@@ -1555,94 +1566,102 @@ var QueryAssistanceClient = class {
|
|
|
1555
1566
|
const headerParameters = {
|
|
1556
1567
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1557
1568
|
};
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
return
|
|
1569
|
+
try {
|
|
1570
|
+
const response = await this.httpClient.send({
|
|
1571
|
+
url: `/platform/storage/query/v1/query:verify`,
|
|
1572
|
+
method: "POST",
|
|
1573
|
+
requestBodyType: "json",
|
|
1574
|
+
body: encodedBody,
|
|
1575
|
+
headers: {
|
|
1576
|
+
"Content-Type": "application/json",
|
|
1577
|
+
Accept: "application/json",
|
|
1578
|
+
...headerParameters
|
|
1579
|
+
},
|
|
1580
|
+
abortSignal: config.abortSignal,
|
|
1581
|
+
statusValidator: (status) => {
|
|
1582
|
+
return [200].includes(status);
|
|
1572
1583
|
}
|
|
1573
|
-
|
|
1584
|
+
});
|
|
1585
|
+
const responseValue = await response.body("json");
|
|
1586
|
+
try {
|
|
1587
|
+
return fromJson19(responseValue);
|
|
1588
|
+
} catch (err) {
|
|
1589
|
+
throw new InvalidResponseError(
|
|
1590
|
+
`QueryAssistanceClient.query:verify:200`,
|
|
1591
|
+
err,
|
|
1592
|
+
responseValue,
|
|
1593
|
+
void 0,
|
|
1594
|
+
void 0
|
|
1595
|
+
);
|
|
1574
1596
|
}
|
|
1575
|
-
})
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1597
|
+
} catch (e) {
|
|
1598
|
+
if (isInvalidResponseError(e)) {
|
|
1599
|
+
throw e;
|
|
1600
|
+
}
|
|
1601
|
+
if (!(0, import_http_client.isHttpClientResponseError)(e)) {
|
|
1602
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
1603
|
+
}
|
|
1604
|
+
const response = e.response;
|
|
1605
|
+
switch (response.status) {
|
|
1606
|
+
case 400: {
|
|
1607
|
+
const responseValue = await response.body("json");
|
|
1608
|
+
try {
|
|
1609
|
+
const errorBody = fromJson15(responseValue);
|
|
1610
|
+
throw new ErrorEnvelopeError(
|
|
1611
|
+
"400",
|
|
1612
|
+
response,
|
|
1613
|
+
errorBody,
|
|
1614
|
+
getErrorMessage(errorBody, "The supplied request is wrong."),
|
|
1615
|
+
e
|
|
1616
|
+
);
|
|
1617
|
+
} catch (err) {
|
|
1618
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1619
|
+
throw err;
|
|
1620
|
+
}
|
|
1621
|
+
throw new InvalidResponseError(
|
|
1622
|
+
`QueryAssistanceClient.query:verify:400`,
|
|
1623
|
+
err,
|
|
1624
|
+
responseValue,
|
|
1625
|
+
"ErrorEnvelope",
|
|
1626
|
+
void 0
|
|
1627
|
+
);
|
|
1590
1628
|
}
|
|
1591
|
-
throw new InvalidResponseError(
|
|
1592
|
-
`QueryAssistanceClient.query:verify:400`,
|
|
1593
|
-
err,
|
|
1594
|
-
responseValue,
|
|
1595
|
-
"ErrorEnvelope",
|
|
1596
|
-
void 0
|
|
1597
|
-
);
|
|
1598
1629
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1630
|
+
case 500: {
|
|
1631
|
+
const responseValue = await response.body("json");
|
|
1632
|
+
try {
|
|
1633
|
+
const errorBody = fromJson15(responseValue);
|
|
1634
|
+
throw new ErrorEnvelopeError(
|
|
1635
|
+
"500",
|
|
1636
|
+
response,
|
|
1637
|
+
errorBody,
|
|
1638
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
1639
|
+
e
|
|
1640
|
+
);
|
|
1641
|
+
} catch (err) {
|
|
1642
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1643
|
+
throw err;
|
|
1644
|
+
}
|
|
1645
|
+
throw new InvalidResponseError(
|
|
1646
|
+
`QueryAssistanceClient.query:verify:500`,
|
|
1647
|
+
err,
|
|
1648
|
+
responseValue,
|
|
1649
|
+
"ErrorEnvelope",
|
|
1650
|
+
void 0
|
|
1651
|
+
);
|
|
1613
1652
|
}
|
|
1614
|
-
throw new InvalidResponseError(
|
|
1615
|
-
`QueryAssistanceClient.query:verify:500`,
|
|
1616
|
-
err,
|
|
1617
|
-
responseValue,
|
|
1618
|
-
"ErrorEnvelope",
|
|
1619
|
-
void 0
|
|
1620
|
-
);
|
|
1621
1653
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
} catch (err) {
|
|
1628
|
-
throw new InvalidResponseError(
|
|
1629
|
-
`QueryAssistanceClient.query:verify:${response.status}`,
|
|
1630
|
-
err,
|
|
1654
|
+
default: {
|
|
1655
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
1656
|
+
throw new ClientRequestError(
|
|
1657
|
+
`${response.status}`,
|
|
1658
|
+
response,
|
|
1631
1659
|
responseValue,
|
|
1632
|
-
|
|
1633
|
-
|
|
1660
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
1661
|
+
e
|
|
1634
1662
|
);
|
|
1635
1663
|
}
|
|
1636
1664
|
}
|
|
1637
|
-
default: {
|
|
1638
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
1639
|
-
throw new ClientRequestError(
|
|
1640
|
-
`${response.status}`,
|
|
1641
|
-
response,
|
|
1642
|
-
responseValue,
|
|
1643
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
1665
|
}
|
|
1647
1666
|
}
|
|
1648
1667
|
async queryParse(config) {
|
|
@@ -1653,97 +1672,105 @@ var QueryAssistanceClient = class {
|
|
|
1653
1672
|
const headerParameters = {
|
|
1654
1673
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1655
1674
|
};
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
return
|
|
1675
|
+
try {
|
|
1676
|
+
const response = await this.httpClient.send({
|
|
1677
|
+
url: `/platform/storage/query/v1/query:parse`,
|
|
1678
|
+
method: "POST",
|
|
1679
|
+
requestBodyType: "json",
|
|
1680
|
+
body: encodedBody,
|
|
1681
|
+
headers: {
|
|
1682
|
+
"Content-Type": "application/json",
|
|
1683
|
+
Accept: "application/json",
|
|
1684
|
+
...headerParameters
|
|
1685
|
+
},
|
|
1686
|
+
abortSignal: config.abortSignal,
|
|
1687
|
+
statusValidator: (status) => {
|
|
1688
|
+
return [200].includes(status);
|
|
1670
1689
|
}
|
|
1671
|
-
|
|
1690
|
+
});
|
|
1691
|
+
const responseValue = await response.body("json");
|
|
1692
|
+
try {
|
|
1693
|
+
return fromJson6(responseValue);
|
|
1694
|
+
} catch (err) {
|
|
1695
|
+
throw new InvalidResponseError(
|
|
1696
|
+
`QueryAssistanceClient.query:parse:200`,
|
|
1697
|
+
err,
|
|
1698
|
+
responseValue,
|
|
1699
|
+
void 0,
|
|
1700
|
+
void 0
|
|
1701
|
+
);
|
|
1672
1702
|
}
|
|
1673
|
-
})
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1703
|
+
} catch (e) {
|
|
1704
|
+
if (isInvalidResponseError(e)) {
|
|
1705
|
+
throw e;
|
|
1706
|
+
}
|
|
1707
|
+
if (!(0, import_http_client.isHttpClientResponseError)(e)) {
|
|
1708
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
1709
|
+
}
|
|
1710
|
+
const response = e.response;
|
|
1711
|
+
switch (response.status) {
|
|
1712
|
+
case 400: {
|
|
1713
|
+
const responseValue = await response.body("json");
|
|
1714
|
+
try {
|
|
1715
|
+
const errorBody = fromJson15(responseValue);
|
|
1716
|
+
throw new ErrorEnvelopeError(
|
|
1717
|
+
"400",
|
|
1718
|
+
response,
|
|
1684
1719
|
errorBody,
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1720
|
+
getErrorMessage(
|
|
1721
|
+
errorBody,
|
|
1722
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
1723
|
+
),
|
|
1724
|
+
e
|
|
1725
|
+
);
|
|
1726
|
+
} catch (err) {
|
|
1727
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1728
|
+
throw err;
|
|
1729
|
+
}
|
|
1730
|
+
throw new InvalidResponseError(
|
|
1731
|
+
`QueryAssistanceClient.query:parse:400`,
|
|
1732
|
+
err,
|
|
1733
|
+
responseValue,
|
|
1734
|
+
"ErrorEnvelope",
|
|
1735
|
+
void 0
|
|
1736
|
+
);
|
|
1691
1737
|
}
|
|
1692
|
-
throw new InvalidResponseError(
|
|
1693
|
-
`QueryAssistanceClient.query:parse:400`,
|
|
1694
|
-
err,
|
|
1695
|
-
responseValue,
|
|
1696
|
-
"ErrorEnvelope",
|
|
1697
|
-
void 0
|
|
1698
|
-
);
|
|
1699
1738
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1739
|
+
case 500: {
|
|
1740
|
+
const responseValue = await response.body("json");
|
|
1741
|
+
try {
|
|
1742
|
+
const errorBody = fromJson15(responseValue);
|
|
1743
|
+
throw new ErrorEnvelopeError(
|
|
1744
|
+
"500",
|
|
1745
|
+
response,
|
|
1746
|
+
errorBody,
|
|
1747
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
1748
|
+
e
|
|
1749
|
+
);
|
|
1750
|
+
} catch (err) {
|
|
1751
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1752
|
+
throw err;
|
|
1753
|
+
}
|
|
1754
|
+
throw new InvalidResponseError(
|
|
1755
|
+
`QueryAssistanceClient.query:parse:500`,
|
|
1756
|
+
err,
|
|
1757
|
+
responseValue,
|
|
1758
|
+
"ErrorEnvelope",
|
|
1759
|
+
void 0
|
|
1760
|
+
);
|
|
1714
1761
|
}
|
|
1715
|
-
throw new InvalidResponseError(
|
|
1716
|
-
`QueryAssistanceClient.query:parse:500`,
|
|
1717
|
-
err,
|
|
1718
|
-
responseValue,
|
|
1719
|
-
"ErrorEnvelope",
|
|
1720
|
-
void 0
|
|
1721
|
-
);
|
|
1722
1762
|
}
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
} catch (err) {
|
|
1729
|
-
throw new InvalidResponseError(
|
|
1730
|
-
`QueryAssistanceClient.query:parse:${response.status}`,
|
|
1731
|
-
err,
|
|
1763
|
+
default: {
|
|
1764
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
1765
|
+
throw new ClientRequestError(
|
|
1766
|
+
`${response.status}`,
|
|
1767
|
+
response,
|
|
1732
1768
|
responseValue,
|
|
1733
|
-
|
|
1734
|
-
|
|
1769
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
1770
|
+
e
|
|
1735
1771
|
);
|
|
1736
1772
|
}
|
|
1737
1773
|
}
|
|
1738
|
-
default: {
|
|
1739
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
1740
|
-
throw new ClientRequestError(
|
|
1741
|
-
`${response.status}`,
|
|
1742
|
-
response,
|
|
1743
|
-
responseValue,
|
|
1744
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1745
|
-
);
|
|
1746
|
-
}
|
|
1747
1774
|
}
|
|
1748
1775
|
}
|
|
1749
1776
|
async queryAutocomplete(config) {
|
|
@@ -1754,97 +1781,105 @@ var QueryAssistanceClient = class {
|
|
|
1754
1781
|
const headerParameters = {
|
|
1755
1782
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
1756
1783
|
};
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
return
|
|
1784
|
+
try {
|
|
1785
|
+
const response = await this.httpClient.send({
|
|
1786
|
+
url: `/platform/storage/query/v1/query:autocomplete`,
|
|
1787
|
+
method: "POST",
|
|
1788
|
+
requestBodyType: "json",
|
|
1789
|
+
body: encodedBody,
|
|
1790
|
+
headers: {
|
|
1791
|
+
"Content-Type": "application/json",
|
|
1792
|
+
Accept: "application/json",
|
|
1793
|
+
...headerParameters
|
|
1794
|
+
},
|
|
1795
|
+
abortSignal: config.abortSignal,
|
|
1796
|
+
statusValidator: (status) => {
|
|
1797
|
+
return [200].includes(status);
|
|
1771
1798
|
}
|
|
1772
|
-
|
|
1799
|
+
});
|
|
1800
|
+
const responseValue = await response.body("json");
|
|
1801
|
+
try {
|
|
1802
|
+
return fromJson5(responseValue);
|
|
1803
|
+
} catch (err) {
|
|
1804
|
+
throw new InvalidResponseError(
|
|
1805
|
+
`QueryAssistanceClient.query:autocomplete:200`,
|
|
1806
|
+
err,
|
|
1807
|
+
responseValue,
|
|
1808
|
+
void 0,
|
|
1809
|
+
void 0
|
|
1810
|
+
);
|
|
1773
1811
|
}
|
|
1774
|
-
})
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1812
|
+
} catch (e) {
|
|
1813
|
+
if (isInvalidResponseError(e)) {
|
|
1814
|
+
throw e;
|
|
1815
|
+
}
|
|
1816
|
+
if (!(0, import_http_client.isHttpClientResponseError)(e)) {
|
|
1817
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
1818
|
+
}
|
|
1819
|
+
const response = e.response;
|
|
1820
|
+
switch (response.status) {
|
|
1821
|
+
case 400: {
|
|
1822
|
+
const responseValue = await response.body("json");
|
|
1823
|
+
try {
|
|
1824
|
+
const errorBody = fromJson15(responseValue);
|
|
1825
|
+
throw new ErrorEnvelopeError(
|
|
1826
|
+
"400",
|
|
1827
|
+
response,
|
|
1785
1828
|
errorBody,
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1829
|
+
getErrorMessage(
|
|
1830
|
+
errorBody,
|
|
1831
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
1832
|
+
),
|
|
1833
|
+
e
|
|
1834
|
+
);
|
|
1835
|
+
} catch (err) {
|
|
1836
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1837
|
+
throw err;
|
|
1838
|
+
}
|
|
1839
|
+
throw new InvalidResponseError(
|
|
1840
|
+
`QueryAssistanceClient.query:autocomplete:400`,
|
|
1841
|
+
err,
|
|
1842
|
+
responseValue,
|
|
1843
|
+
"ErrorEnvelope",
|
|
1844
|
+
void 0
|
|
1845
|
+
);
|
|
1792
1846
|
}
|
|
1793
|
-
throw new InvalidResponseError(
|
|
1794
|
-
`QueryAssistanceClient.query:autocomplete:400`,
|
|
1795
|
-
err,
|
|
1796
|
-
responseValue,
|
|
1797
|
-
"ErrorEnvelope",
|
|
1798
|
-
void 0
|
|
1799
|
-
);
|
|
1800
1847
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1848
|
+
case 500: {
|
|
1849
|
+
const responseValue = await response.body("json");
|
|
1850
|
+
try {
|
|
1851
|
+
const errorBody = fromJson15(responseValue);
|
|
1852
|
+
throw new ErrorEnvelopeError(
|
|
1853
|
+
"500",
|
|
1854
|
+
response,
|
|
1855
|
+
errorBody,
|
|
1856
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
1857
|
+
e
|
|
1858
|
+
);
|
|
1859
|
+
} catch (err) {
|
|
1860
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
1861
|
+
throw err;
|
|
1862
|
+
}
|
|
1863
|
+
throw new InvalidResponseError(
|
|
1864
|
+
`QueryAssistanceClient.query:autocomplete:500`,
|
|
1865
|
+
err,
|
|
1866
|
+
responseValue,
|
|
1867
|
+
"ErrorEnvelope",
|
|
1868
|
+
void 0
|
|
1869
|
+
);
|
|
1815
1870
|
}
|
|
1816
|
-
throw new InvalidResponseError(
|
|
1817
|
-
`QueryAssistanceClient.query:autocomplete:500`,
|
|
1818
|
-
err,
|
|
1819
|
-
responseValue,
|
|
1820
|
-
"ErrorEnvelope",
|
|
1821
|
-
void 0
|
|
1822
|
-
);
|
|
1823
1871
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
} catch (err) {
|
|
1830
|
-
throw new InvalidResponseError(
|
|
1831
|
-
`QueryAssistanceClient.query:autocomplete:${response.status}`,
|
|
1832
|
-
err,
|
|
1872
|
+
default: {
|
|
1873
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
1874
|
+
throw new ClientRequestError(
|
|
1875
|
+
`${response.status}`,
|
|
1876
|
+
response,
|
|
1833
1877
|
responseValue,
|
|
1834
|
-
|
|
1835
|
-
|
|
1878
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
1879
|
+
e
|
|
1836
1880
|
);
|
|
1837
1881
|
}
|
|
1838
1882
|
}
|
|
1839
|
-
default: {
|
|
1840
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
1841
|
-
throw new ClientRequestError(
|
|
1842
|
-
`${response.status}`,
|
|
1843
|
-
response,
|
|
1844
|
-
responseValue,
|
|
1845
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
1846
|
-
);
|
|
1847
|
-
}
|
|
1848
1883
|
}
|
|
1849
1884
|
}
|
|
1850
1885
|
};
|
|
@@ -3128,102 +3163,104 @@ var QueryExecutionClient = class {
|
|
|
3128
3163
|
"request-timeout-milliseconds": config.requestTimeoutMilliseconds,
|
|
3129
3164
|
enrich: config.enrich
|
|
3130
3165
|
});
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
return
|
|
3166
|
+
try {
|
|
3167
|
+
const response = await this.httpClient.send({
|
|
3168
|
+
url: `/platform/storage/query/v1/query:poll${query}`,
|
|
3169
|
+
method: "GET",
|
|
3170
|
+
headers: {
|
|
3171
|
+
Accept: "application/json"
|
|
3172
|
+
},
|
|
3173
|
+
abortSignal: config.abortSignal,
|
|
3174
|
+
statusValidator: (status) => {
|
|
3175
|
+
return [200].includes(status);
|
|
3141
3176
|
}
|
|
3142
|
-
|
|
3177
|
+
});
|
|
3178
|
+
const responseValue = await response.body("json");
|
|
3179
|
+
try {
|
|
3180
|
+
return fromJson34(responseValue);
|
|
3181
|
+
} catch (err) {
|
|
3182
|
+
throw new InvalidResponseError(`QueryExecutionClient.query:poll:200`, err, responseValue, void 0, void 0);
|
|
3143
3183
|
}
|
|
3144
|
-
})
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3184
|
+
} catch (e) {
|
|
3185
|
+
if (isInvalidResponseError(e)) {
|
|
3186
|
+
throw e;
|
|
3187
|
+
}
|
|
3188
|
+
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
3189
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
3190
|
+
}
|
|
3191
|
+
const response = e.response;
|
|
3192
|
+
switch (response.status) {
|
|
3193
|
+
case 400: {
|
|
3194
|
+
const responseValue = await response.body("json");
|
|
3195
|
+
try {
|
|
3196
|
+
const errorBody = fromJson15(responseValue);
|
|
3197
|
+
throw new ErrorEnvelopeError(
|
|
3198
|
+
"400",
|
|
3199
|
+
response,
|
|
3155
3200
|
errorBody,
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3201
|
+
getErrorMessage(
|
|
3202
|
+
errorBody,
|
|
3203
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3204
|
+
),
|
|
3205
|
+
e
|
|
3206
|
+
);
|
|
3207
|
+
} catch (err) {
|
|
3208
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3209
|
+
throw err;
|
|
3210
|
+
}
|
|
3211
|
+
throw new InvalidResponseError(
|
|
3212
|
+
`QueryExecutionClient.query:poll:400`,
|
|
3213
|
+
err,
|
|
3214
|
+
responseValue,
|
|
3215
|
+
"ErrorEnvelope",
|
|
3216
|
+
void 0
|
|
3217
|
+
);
|
|
3162
3218
|
}
|
|
3163
|
-
throw new InvalidResponseError(
|
|
3164
|
-
`QueryExecutionClient.query:poll:400`,
|
|
3165
|
-
err,
|
|
3166
|
-
responseValue,
|
|
3167
|
-
"ErrorEnvelope",
|
|
3168
|
-
void 0
|
|
3169
|
-
);
|
|
3170
3219
|
}
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
`410`,
|
|
3176
|
-
response,
|
|
3177
|
-
responseValue,
|
|
3178
|
-
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3179
|
-
);
|
|
3180
|
-
}
|
|
3181
|
-
case 500: {
|
|
3182
|
-
const responseValue = await response.body("json");
|
|
3183
|
-
try {
|
|
3184
|
-
const errorBody = fromJson15(responseValue);
|
|
3185
|
-
throw new ErrorEnvelopeError(
|
|
3186
|
-
"500",
|
|
3220
|
+
case 410: {
|
|
3221
|
+
const responseValue = await response.body("text");
|
|
3222
|
+
throw new ClientRequestError(
|
|
3223
|
+
`410`,
|
|
3187
3224
|
response,
|
|
3188
|
-
errorBody,
|
|
3189
|
-
getErrorMessage(errorBody, "An internal server error has occurred.")
|
|
3190
|
-
);
|
|
3191
|
-
} catch (err) {
|
|
3192
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3193
|
-
throw err;
|
|
3194
|
-
}
|
|
3195
|
-
throw new InvalidResponseError(
|
|
3196
|
-
`QueryExecutionClient.query:poll:500`,
|
|
3197
|
-
err,
|
|
3198
3225
|
responseValue,
|
|
3199
|
-
|
|
3200
|
-
void 0
|
|
3226
|
+
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3201
3227
|
);
|
|
3202
3228
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3229
|
+
case 500: {
|
|
3230
|
+
const responseValue = await response.body("json");
|
|
3231
|
+
try {
|
|
3232
|
+
const errorBody = fromJson15(responseValue);
|
|
3233
|
+
throw new ErrorEnvelopeError(
|
|
3234
|
+
"500",
|
|
3235
|
+
response,
|
|
3236
|
+
errorBody,
|
|
3237
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
3238
|
+
e
|
|
3239
|
+
);
|
|
3240
|
+
} catch (err) {
|
|
3241
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3242
|
+
throw err;
|
|
3243
|
+
}
|
|
3244
|
+
throw new InvalidResponseError(
|
|
3245
|
+
`QueryExecutionClient.query:poll:500`,
|
|
3246
|
+
err,
|
|
3247
|
+
responseValue,
|
|
3248
|
+
"ErrorEnvelope",
|
|
3249
|
+
void 0
|
|
3250
|
+
);
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
default: {
|
|
3254
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3255
|
+
throw new ClientRequestError(
|
|
3256
|
+
`${response.status}`,
|
|
3257
|
+
response,
|
|
3212
3258
|
responseValue,
|
|
3213
|
-
|
|
3214
|
-
|
|
3259
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
3260
|
+
e
|
|
3215
3261
|
);
|
|
3216
3262
|
}
|
|
3217
3263
|
}
|
|
3218
|
-
default: {
|
|
3219
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
3220
|
-
throw new ClientRequestError(
|
|
3221
|
-
`${response.status}`,
|
|
3222
|
-
response,
|
|
3223
|
-
responseValue,
|
|
3224
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3225
|
-
);
|
|
3226
|
-
}
|
|
3227
3264
|
}
|
|
3228
3265
|
}
|
|
3229
3266
|
async queryExecute(config) {
|
|
@@ -3235,133 +3272,241 @@ var QueryExecutionClient = class {
|
|
|
3235
3272
|
const headerParameters = {
|
|
3236
3273
|
...config.authorization !== void 0 && { Authorization: String(config.authorization) }
|
|
3237
3274
|
};
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
return
|
|
3275
|
+
try {
|
|
3276
|
+
const response = await this.httpClient.send({
|
|
3277
|
+
url: `/platform/storage/query/v1/query:execute${query}`,
|
|
3278
|
+
method: "POST",
|
|
3279
|
+
requestBodyType: "json",
|
|
3280
|
+
body: encodedBody,
|
|
3281
|
+
headers: {
|
|
3282
|
+
"Content-Type": "application/json",
|
|
3283
|
+
Accept: "application/json",
|
|
3284
|
+
...headerParameters
|
|
3285
|
+
},
|
|
3286
|
+
abortSignal: config.abortSignal,
|
|
3287
|
+
statusValidator: (status) => {
|
|
3288
|
+
return [200, 202].includes(status);
|
|
3252
3289
|
}
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3268
|
-
)
|
|
3269
|
-
);
|
|
3270
|
-
} catch (err) {
|
|
3271
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3272
|
-
throw err;
|
|
3290
|
+
});
|
|
3291
|
+
switch (response.status) {
|
|
3292
|
+
case 200: {
|
|
3293
|
+
const responseValue = await response.body("json");
|
|
3294
|
+
try {
|
|
3295
|
+
return fromJson35(responseValue);
|
|
3296
|
+
} catch (err) {
|
|
3297
|
+
throw new InvalidResponseError(
|
|
3298
|
+
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3299
|
+
err,
|
|
3300
|
+
responseValue,
|
|
3301
|
+
void 0,
|
|
3302
|
+
void 0
|
|
3303
|
+
);
|
|
3273
3304
|
}
|
|
3274
|
-
throw new InvalidResponseError(
|
|
3275
|
-
`QueryExecutionClient.query:execute:400`,
|
|
3276
|
-
err,
|
|
3277
|
-
responseValue,
|
|
3278
|
-
"ErrorEnvelope",
|
|
3279
|
-
void 0
|
|
3280
|
-
);
|
|
3281
3305
|
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3295
|
-
throw err;
|
|
3306
|
+
case 202: {
|
|
3307
|
+
const responseValue = await response.body("json");
|
|
3308
|
+
try {
|
|
3309
|
+
return fromJson35(responseValue);
|
|
3310
|
+
} catch (err) {
|
|
3311
|
+
throw new InvalidResponseError(
|
|
3312
|
+
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3313
|
+
err,
|
|
3314
|
+
responseValue,
|
|
3315
|
+
void 0,
|
|
3316
|
+
void 0
|
|
3317
|
+
);
|
|
3296
3318
|
}
|
|
3297
|
-
throw new InvalidResponseError(
|
|
3298
|
-
`QueryExecutionClient.query:execute:500`,
|
|
3299
|
-
err,
|
|
3300
|
-
responseValue,
|
|
3301
|
-
"ErrorEnvelope",
|
|
3302
|
-
void 0
|
|
3303
|
-
);
|
|
3304
3319
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
const errorBody = fromJson15(responseValue);
|
|
3310
|
-
throw new ErrorEnvelopeError(
|
|
3311
|
-
"503",
|
|
3320
|
+
default: {
|
|
3321
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3322
|
+
throw new ClientRequestError(
|
|
3323
|
+
`${response.status}`,
|
|
3312
3324
|
response,
|
|
3313
|
-
errorBody,
|
|
3314
|
-
getErrorMessage(errorBody, "Service is unavailable.")
|
|
3315
|
-
);
|
|
3316
|
-
} catch (err) {
|
|
3317
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3318
|
-
throw err;
|
|
3319
|
-
}
|
|
3320
|
-
throw new InvalidResponseError(
|
|
3321
|
-
`QueryExecutionClient.query:execute:503`,
|
|
3322
|
-
err,
|
|
3323
3325
|
responseValue,
|
|
3324
|
-
"
|
|
3325
|
-
void 0
|
|
3326
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3326
3327
|
);
|
|
3327
3328
|
}
|
|
3328
3329
|
}
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
return fromJson35(responseValue);
|
|
3333
|
-
} catch (err) {
|
|
3334
|
-
throw new InvalidResponseError(
|
|
3335
|
-
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3336
|
-
err,
|
|
3337
|
-
responseValue,
|
|
3338
|
-
void 0,
|
|
3339
|
-
void 0
|
|
3340
|
-
);
|
|
3341
|
-
}
|
|
3330
|
+
} catch (e) {
|
|
3331
|
+
if (isClientRequestError(e) || isInvalidResponseError(e)) {
|
|
3332
|
+
throw e;
|
|
3342
3333
|
}
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
try {
|
|
3346
|
-
return fromJson35(responseValue);
|
|
3347
|
-
} catch (err) {
|
|
3348
|
-
throw new InvalidResponseError(
|
|
3349
|
-
`QueryExecutionClient.query:execute:${response.status}`,
|
|
3350
|
-
err,
|
|
3351
|
-
responseValue,
|
|
3352
|
-
void 0,
|
|
3353
|
-
void 0
|
|
3354
|
-
);
|
|
3355
|
-
}
|
|
3334
|
+
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
3335
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
3356
3336
|
}
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3337
|
+
const response = e.response;
|
|
3338
|
+
switch (response.status) {
|
|
3339
|
+
case 400: {
|
|
3340
|
+
const responseValue = await response.body("json");
|
|
3341
|
+
try {
|
|
3342
|
+
const errorBody = fromJson15(responseValue);
|
|
3343
|
+
throw new ErrorEnvelopeError(
|
|
3344
|
+
"400",
|
|
3345
|
+
response,
|
|
3346
|
+
errorBody,
|
|
3347
|
+
getErrorMessage(
|
|
3348
|
+
errorBody,
|
|
3349
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3350
|
+
),
|
|
3351
|
+
e
|
|
3352
|
+
);
|
|
3353
|
+
} catch (err) {
|
|
3354
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3355
|
+
throw err;
|
|
3356
|
+
}
|
|
3357
|
+
throw new InvalidResponseError(
|
|
3358
|
+
`QueryExecutionClient.query:execute:400`,
|
|
3359
|
+
err,
|
|
3360
|
+
responseValue,
|
|
3361
|
+
"ErrorEnvelope",
|
|
3362
|
+
void 0
|
|
3363
|
+
);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
case 403: {
|
|
3367
|
+
const responseValue = await response.body("json");
|
|
3368
|
+
try {
|
|
3369
|
+
const errorBody = fromJson15(responseValue);
|
|
3370
|
+
throw new ErrorEnvelopeError(
|
|
3371
|
+
"403",
|
|
3372
|
+
response,
|
|
3373
|
+
errorBody,
|
|
3374
|
+
getErrorMessage(errorBody, "Insufficient permissions."),
|
|
3375
|
+
e
|
|
3376
|
+
);
|
|
3377
|
+
} catch (err) {
|
|
3378
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3379
|
+
throw err;
|
|
3380
|
+
}
|
|
3381
|
+
throw new InvalidResponseError(
|
|
3382
|
+
`QueryExecutionClient.query:execute:403`,
|
|
3383
|
+
err,
|
|
3384
|
+
responseValue,
|
|
3385
|
+
"ErrorEnvelope",
|
|
3386
|
+
void 0
|
|
3387
|
+
);
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
case 429: {
|
|
3391
|
+
const responseValue = await response.body("json");
|
|
3392
|
+
try {
|
|
3393
|
+
const errorBody = fromJson15(responseValue);
|
|
3394
|
+
throw new ErrorEnvelopeError(
|
|
3395
|
+
"429",
|
|
3396
|
+
response,
|
|
3397
|
+
errorBody,
|
|
3398
|
+
getErrorMessage(errorBody, "Too many requests."),
|
|
3399
|
+
e
|
|
3400
|
+
);
|
|
3401
|
+
} catch (err) {
|
|
3402
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3403
|
+
throw err;
|
|
3404
|
+
}
|
|
3405
|
+
throw new InvalidResponseError(
|
|
3406
|
+
`QueryExecutionClient.query:execute:429`,
|
|
3407
|
+
err,
|
|
3408
|
+
responseValue,
|
|
3409
|
+
"ErrorEnvelope",
|
|
3410
|
+
void 0
|
|
3411
|
+
);
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
case 500: {
|
|
3415
|
+
const responseValue = await response.body("json");
|
|
3416
|
+
try {
|
|
3417
|
+
const errorBody = fromJson15(responseValue);
|
|
3418
|
+
throw new ErrorEnvelopeError(
|
|
3419
|
+
"500",
|
|
3420
|
+
response,
|
|
3421
|
+
errorBody,
|
|
3422
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
3423
|
+
e
|
|
3424
|
+
);
|
|
3425
|
+
} catch (err) {
|
|
3426
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3427
|
+
throw err;
|
|
3428
|
+
}
|
|
3429
|
+
throw new InvalidResponseError(
|
|
3430
|
+
`QueryExecutionClient.query:execute:500`,
|
|
3431
|
+
err,
|
|
3432
|
+
responseValue,
|
|
3433
|
+
"ErrorEnvelope",
|
|
3434
|
+
void 0
|
|
3435
|
+
);
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
case 503: {
|
|
3439
|
+
const responseValue = await response.body("json");
|
|
3440
|
+
try {
|
|
3441
|
+
const errorBody = fromJson15(responseValue);
|
|
3442
|
+
throw new ErrorEnvelopeError(
|
|
3443
|
+
"503",
|
|
3444
|
+
response,
|
|
3445
|
+
errorBody,
|
|
3446
|
+
getErrorMessage(errorBody, "Service is unavailable."),
|
|
3447
|
+
e
|
|
3448
|
+
);
|
|
3449
|
+
} catch (err) {
|
|
3450
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3451
|
+
throw err;
|
|
3452
|
+
}
|
|
3453
|
+
throw new InvalidResponseError(
|
|
3454
|
+
`QueryExecutionClient.query:execute:503`,
|
|
3455
|
+
err,
|
|
3456
|
+
responseValue,
|
|
3457
|
+
"ErrorEnvelope",
|
|
3458
|
+
void 0
|
|
3459
|
+
);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
default: {
|
|
3463
|
+
if (response.status >= 400 && response.status <= 499) {
|
|
3464
|
+
const responseValue = await response.body("json");
|
|
3465
|
+
try {
|
|
3466
|
+
const errorBody = fromJson15(responseValue);
|
|
3467
|
+
throw new ErrorEnvelopeError("4XX", response, errorBody, getErrorMessage(errorBody, "Client error."), e);
|
|
3468
|
+
} catch (err) {
|
|
3469
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3470
|
+
throw err;
|
|
3471
|
+
}
|
|
3472
|
+
throw new InvalidResponseError(
|
|
3473
|
+
`QueryExecutionClient.query:execute:4XX`,
|
|
3474
|
+
err,
|
|
3475
|
+
responseValue,
|
|
3476
|
+
"ErrorEnvelope",
|
|
3477
|
+
void 0
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3480
|
+
} else if (response.status >= 500 && response.status <= 599) {
|
|
3481
|
+
const responseValue = await response.body("json");
|
|
3482
|
+
try {
|
|
3483
|
+
const errorBody = fromJson15(responseValue);
|
|
3484
|
+
throw new ErrorEnvelopeError("5XX", response, errorBody, getErrorMessage(errorBody, "Server error."), e);
|
|
3485
|
+
} catch (err) {
|
|
3486
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3487
|
+
throw err;
|
|
3488
|
+
}
|
|
3489
|
+
throw new InvalidResponseError(
|
|
3490
|
+
`QueryExecutionClient.query:execute:5XX`,
|
|
3491
|
+
err,
|
|
3492
|
+
responseValue,
|
|
3493
|
+
"ErrorEnvelope",
|
|
3494
|
+
void 0
|
|
3495
|
+
);
|
|
3496
|
+
}
|
|
3497
|
+
} else {
|
|
3498
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3499
|
+
throw new ClientRequestError(
|
|
3500
|
+
`${response.status}`,
|
|
3501
|
+
response,
|
|
3502
|
+
responseValue,
|
|
3503
|
+
getErrorMessage(
|
|
3504
|
+
responseValue,
|
|
3505
|
+
`Unexpected api response: code=${response.status} body="${responseValue}"`
|
|
3506
|
+
)
|
|
3507
|
+
);
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3365
3510
|
}
|
|
3366
3511
|
}
|
|
3367
3512
|
}
|
|
@@ -3369,106 +3514,127 @@ var QueryExecutionClient = class {
|
|
|
3369
3514
|
if (!config) {
|
|
3370
3515
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
3371
3516
|
}
|
|
3372
|
-
const query = toQueryString({ "request-token": config.requestToken });
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
return
|
|
3517
|
+
const query = toQueryString({ "request-token": config.requestToken, enrich: config.enrich });
|
|
3518
|
+
try {
|
|
3519
|
+
const response = await this.httpClient.send({
|
|
3520
|
+
url: `/platform/storage/query/v1/query:cancel${query}`,
|
|
3521
|
+
method: "POST",
|
|
3522
|
+
headers: {
|
|
3523
|
+
Accept: "application/json"
|
|
3524
|
+
},
|
|
3525
|
+
abortSignal: config.abortSignal,
|
|
3526
|
+
statusValidator: (status) => {
|
|
3527
|
+
return [200, 202].includes(status);
|
|
3383
3528
|
}
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3399
|
-
)
|
|
3400
|
-
);
|
|
3401
|
-
} catch (err) {
|
|
3402
|
-
if (err instanceof ErrorEnvelopeError) {
|
|
3403
|
-
throw err;
|
|
3529
|
+
});
|
|
3530
|
+
switch (response.status) {
|
|
3531
|
+
case 200: {
|
|
3532
|
+
const responseValue = await response.body("json");
|
|
3533
|
+
try {
|
|
3534
|
+
return fromJson34(responseValue);
|
|
3535
|
+
} catch (err) {
|
|
3536
|
+
throw new InvalidResponseError(
|
|
3537
|
+
`QueryExecutionClient.query:cancel:${response.status}`,
|
|
3538
|
+
err,
|
|
3539
|
+
responseValue,
|
|
3540
|
+
void 0,
|
|
3541
|
+
void 0
|
|
3542
|
+
);
|
|
3404
3543
|
}
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3544
|
+
}
|
|
3545
|
+
case 202: {
|
|
3546
|
+
return;
|
|
3547
|
+
}
|
|
3548
|
+
default: {
|
|
3549
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3550
|
+
throw new ClientRequestError(
|
|
3551
|
+
`${response.status}`,
|
|
3552
|
+
response,
|
|
3408
3553
|
responseValue,
|
|
3409
|
-
"
|
|
3410
|
-
void 0
|
|
3554
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3411
3555
|
);
|
|
3412
3556
|
}
|
|
3413
3557
|
}
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
throw
|
|
3417
|
-
`410`,
|
|
3418
|
-
response,
|
|
3419
|
-
responseValue,
|
|
3420
|
-
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3421
|
-
);
|
|
3558
|
+
} catch (e) {
|
|
3559
|
+
if (isClientRequestError(e) || isInvalidResponseError(e)) {
|
|
3560
|
+
throw e;
|
|
3422
3561
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3562
|
+
if (!(0, import_http_client2.isHttpClientResponseError)(e)) {
|
|
3563
|
+
throw new ApiClientError("UnexpectedError", "Unexpected error", e);
|
|
3564
|
+
}
|
|
3565
|
+
const response = e.response;
|
|
3566
|
+
switch (response.status) {
|
|
3567
|
+
case 400: {
|
|
3568
|
+
const responseValue = await response.body("json");
|
|
3569
|
+
try {
|
|
3570
|
+
const errorBody = fromJson15(responseValue);
|
|
3571
|
+
throw new ErrorEnvelopeError(
|
|
3572
|
+
"400",
|
|
3573
|
+
response,
|
|
3574
|
+
errorBody,
|
|
3575
|
+
getErrorMessage(
|
|
3576
|
+
errorBody,
|
|
3577
|
+
"The supplied request is wrong. Either the query itself or other parameters are wrong."
|
|
3578
|
+
),
|
|
3579
|
+
e
|
|
3580
|
+
);
|
|
3581
|
+
} catch (err) {
|
|
3582
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3583
|
+
throw err;
|
|
3584
|
+
}
|
|
3585
|
+
throw new InvalidResponseError(
|
|
3586
|
+
`QueryExecutionClient.query:cancel:400`,
|
|
3587
|
+
err,
|
|
3588
|
+
responseValue,
|
|
3589
|
+
"ErrorEnvelope",
|
|
3590
|
+
void 0
|
|
3591
|
+
);
|
|
3436
3592
|
}
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3593
|
+
}
|
|
3594
|
+
case 410: {
|
|
3595
|
+
const responseValue = await response.body("text");
|
|
3596
|
+
throw new ClientRequestError(
|
|
3597
|
+
`410`,
|
|
3598
|
+
response,
|
|
3440
3599
|
responseValue,
|
|
3441
|
-
|
|
3442
|
-
void 0
|
|
3600
|
+
getErrorMessage(responseValue, `The query for the given request-token is not available anymore.`)
|
|
3443
3601
|
);
|
|
3444
3602
|
}
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3603
|
+
case 500: {
|
|
3604
|
+
const responseValue = await response.body("json");
|
|
3605
|
+
try {
|
|
3606
|
+
const errorBody = fromJson15(responseValue);
|
|
3607
|
+
throw new ErrorEnvelopeError(
|
|
3608
|
+
"500",
|
|
3609
|
+
response,
|
|
3610
|
+
errorBody,
|
|
3611
|
+
getErrorMessage(errorBody, "An internal server error has occurred."),
|
|
3612
|
+
e
|
|
3613
|
+
);
|
|
3614
|
+
} catch (err) {
|
|
3615
|
+
if (err instanceof ErrorEnvelopeError) {
|
|
3616
|
+
throw err;
|
|
3617
|
+
}
|
|
3618
|
+
throw new InvalidResponseError(
|
|
3619
|
+
`QueryExecutionClient.query:cancel:500`,
|
|
3620
|
+
err,
|
|
3621
|
+
responseValue,
|
|
3622
|
+
"ErrorEnvelope",
|
|
3623
|
+
void 0
|
|
3624
|
+
);
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
default: {
|
|
3628
|
+
const responseValue = await response.body("text").catch(() => "");
|
|
3629
|
+
throw new ClientRequestError(
|
|
3630
|
+
`${response.status}`,
|
|
3631
|
+
response,
|
|
3454
3632
|
responseValue,
|
|
3455
|
-
|
|
3456
|
-
|
|
3633
|
+
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`),
|
|
3634
|
+
e
|
|
3457
3635
|
);
|
|
3458
3636
|
}
|
|
3459
3637
|
}
|
|
3460
|
-
case 202: {
|
|
3461
|
-
return;
|
|
3462
|
-
}
|
|
3463
|
-
default: {
|
|
3464
|
-
const responseValue = await response.body("text").catch(() => "");
|
|
3465
|
-
throw new ClientRequestError(
|
|
3466
|
-
`${response.status}`,
|
|
3467
|
-
response,
|
|
3468
|
-
responseValue,
|
|
3469
|
-
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`)
|
|
3470
|
-
);
|
|
3471
|
-
}
|
|
3472
3638
|
}
|
|
3473
3639
|
}
|
|
3474
3640
|
};
|
|
@@ -3496,6 +3662,7 @@ var FieldTypeType = /* @__PURE__ */ ((FieldTypeType2) => {
|
|
|
3496
3662
|
FieldTypeType2["GeoPoint"] = "geo_point";
|
|
3497
3663
|
FieldTypeType2["Array"] = "array";
|
|
3498
3664
|
FieldTypeType2["Record"] = "record";
|
|
3665
|
+
FieldTypeType2["Uid"] = "uid";
|
|
3499
3666
|
FieldTypeType2["Undefined"] = "undefined";
|
|
3500
3667
|
return FieldTypeType2;
|
|
3501
3668
|
})(FieldTypeType || {});
|
|
@@ -3550,5 +3717,6 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
|
3550
3717
|
TokenType2["MetricKey"] = "METRIC_KEY";
|
|
3551
3718
|
TokenType2["Variable"] = "VARIABLE";
|
|
3552
3719
|
TokenType2["EndComment"] = "END_COMMENT";
|
|
3720
|
+
TokenType2["UidValue"] = "UID_VALUE";
|
|
3553
3721
|
return TokenType2;
|
|
3554
3722
|
})(TokenType || {});
|