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