@aliyun-obv/api 0.3.4 → 0.3.6
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/dist/api.es.js +80 -35
- package/package.json +1 -1
package/dist/api.es.js
CHANGED
|
@@ -203,34 +203,97 @@ class BaseFetch {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
var _a$1, _b, _c;
|
|
207
|
+
const isLocal = (_a$1 = window == null ? void 0 : window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _a$1.LOCAL;
|
|
208
|
+
const isPre = ((_b = window == null ? void 0 : window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _b.fEnv) === "pre" || ((_c = window == null ? void 0 : window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _c.ENV) === "pre";
|
|
209
|
+
function is4Service(location2) {
|
|
210
|
+
return location2.hostname.match(
|
|
211
|
+
/(4service|4bjzwy|4finance)(\.console)?(\.aliyun|\.alibabacloud)\.com$/
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function getSLSdomain() {
|
|
215
|
+
var _a2, _b2;
|
|
216
|
+
if ((_a2 = window == null ? void 0 : window.__CONSOLE_OBVIZ_DOMAIN__) == null ? void 0 : _a2.getSlsDomain) {
|
|
217
|
+
return window.__CONSOLE_OBVIZ_DOMAIN__.getSlsDomain();
|
|
218
|
+
}
|
|
219
|
+
if (isLocal) {
|
|
220
|
+
if (window.location.hostname.includes("stg")) {
|
|
221
|
+
return `http://sls-stg:${window.location.port}`;
|
|
212
222
|
}
|
|
213
|
-
|
|
223
|
+
if (location.hostname.includes("observability")) {
|
|
224
|
+
return `http://pre-sls:${window.location.port}`;
|
|
225
|
+
}
|
|
226
|
+
return window.location.origin;
|
|
214
227
|
}
|
|
215
228
|
const host = window.location.host;
|
|
216
|
-
if (((
|
|
229
|
+
if (((_b2 = window == null ? void 0 : window.ALIYUN_SLS_CONSOLE_CONFIG) == null ? void 0 : _b2.isSlsConsole) || host.includes("sls") && host.includes("console.aliyun.com")) {
|
|
217
230
|
return void 0;
|
|
218
231
|
}
|
|
219
|
-
if (
|
|
232
|
+
if (isPre) {
|
|
233
|
+
if (is4Service(window.location)) {
|
|
234
|
+
return `https://pre-sls4service.console.aliyun.com`;
|
|
235
|
+
}
|
|
236
|
+
if (window.location.hostname.includes("stg")) {
|
|
237
|
+
return `https://sls-stg.console.aliyun.com`;
|
|
238
|
+
}
|
|
239
|
+
return "https://pre-sls.console.aliyun.com";
|
|
240
|
+
}
|
|
241
|
+
if (is4Service(window.location)) {
|
|
242
|
+
return `https://sls4service.console.aliyun.com`;
|
|
243
|
+
}
|
|
244
|
+
return "https://sls.console.aliyun.com";
|
|
245
|
+
}
|
|
246
|
+
function getObvDomain() {
|
|
247
|
+
var _a2, _b2;
|
|
248
|
+
if ((_a2 = window == null ? void 0 : window.__CONSOLE_OBVIZ_DOMAIN__) == null ? void 0 : _a2.getObvDomain) {
|
|
249
|
+
return window.__CONSOLE_OBVIZ_DOMAIN__.getObvDomain();
|
|
250
|
+
}
|
|
251
|
+
const { slsHost } = urijs(window.location.search).escapeQuerySpace(false).query(true);
|
|
252
|
+
if ((_b2 = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _b2.LOCAL) {
|
|
220
253
|
if (slsHost != null && slsHost != "") {
|
|
221
254
|
return slsHost;
|
|
222
255
|
}
|
|
223
|
-
|
|
256
|
+
if (location.hostname === "localhost") {
|
|
257
|
+
return `http://pre-observability:${window.location.port}`;
|
|
258
|
+
}
|
|
259
|
+
if (location.hostname.includes("observability")) {
|
|
260
|
+
return `http://${location.hostname}:${window.location.port}`;
|
|
261
|
+
}
|
|
262
|
+
if (window.location.hostname.includes("stg")) {
|
|
263
|
+
return `http://pre-stg-observability:${window.location.port}`;
|
|
264
|
+
}
|
|
265
|
+
return `http://pre-observability:${window.location.port}`;
|
|
224
266
|
}
|
|
225
|
-
|
|
267
|
+
if (isPre) {
|
|
268
|
+
if (slsHost != null && slsHost != "") {
|
|
269
|
+
return slsHost;
|
|
270
|
+
}
|
|
271
|
+
if (is4Service(window.location)) {
|
|
272
|
+
return `https://pre-observability4service.console.aliyun.com`;
|
|
273
|
+
}
|
|
274
|
+
if (location.hostname.includes("observability")) {
|
|
275
|
+
return location.origin;
|
|
276
|
+
}
|
|
277
|
+
if (window.location.hostname.includes("stg")) {
|
|
278
|
+
return `https://pre-stg-observability.console.aliyun.com`;
|
|
279
|
+
}
|
|
280
|
+
return `https://pre-observability.console.aliyun.com`;
|
|
281
|
+
}
|
|
282
|
+
if (is4Service(window.location)) {
|
|
283
|
+
return `https://observability4service.console.aliyun.com`;
|
|
284
|
+
}
|
|
285
|
+
if (location.hostname.includes("observability")) {
|
|
286
|
+
return location.origin;
|
|
287
|
+
}
|
|
288
|
+
return `https://observability.console.aliyun.com`;
|
|
226
289
|
}
|
|
227
290
|
function getConfig(key) {
|
|
228
291
|
window.ALIYUN_SLS_CONSOLE_CONFIG = window.ALIYUN_SLS_CONSOLE_CONFIG || {};
|
|
229
292
|
return window.ALIYUN_SLS_CONSOLE_CONFIG[key] !== void 0 ? window.ALIYUN_SLS_CONSOLE_CONFIG[key] : "";
|
|
230
293
|
}
|
|
231
294
|
function extraActionAndResource(message) {
|
|
232
|
-
var
|
|
233
|
-
const arr = (
|
|
295
|
+
var _a2;
|
|
296
|
+
const arr = (_a2 = message.match(/denied by sts or ram[\S\s]+action:\s(\S+:\S+),[\S\s]+resource:\s(\S+)/)) != null ? _a2 : [];
|
|
234
297
|
if (arr.length === 3) {
|
|
235
298
|
return {
|
|
236
299
|
action: arr[1],
|
|
@@ -280,11 +343,6 @@ function getOauthCallbackUrl(url = window.location.href) {
|
|
|
280
343
|
function createNoPermissionContent() {
|
|
281
344
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "sls-custom-container" }, /* @__PURE__ */ React.createElement("div", { className: "sls-custom-title" }, i18n.UNAUTHORIZEDOPERMSG)));
|
|
282
345
|
}
|
|
283
|
-
function is4Service(location) {
|
|
284
|
-
return location.hostname.match(
|
|
285
|
-
/(4service|4bjzwy|4finance)(\.console)?(\.aliyun|\.alibabacloud)\.com$/
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
346
|
|
|
289
347
|
var __defProp$3 = Object.defineProperty;
|
|
290
348
|
var __defProps$3 = Object.defineProperties;
|
|
@@ -401,7 +459,7 @@ function showCSRFDialog(config) {
|
|
|
401
459
|
type: "primary",
|
|
402
460
|
onClick: () => {
|
|
403
461
|
var _a;
|
|
404
|
-
commonEasyFetch.get(`${(_a =
|
|
462
|
+
commonEasyFetch.get(`${(_a = getSLSdomain()) != null ? _a : ""}/console/ajax/getSecToken.json`).then((res) => {
|
|
405
463
|
if ((res == null ? void 0 : res.code) === "200") {
|
|
406
464
|
window.ALIYUN_SLS_CONSOLE_CONFIG.SEC_TOKEN = res.data;
|
|
407
465
|
dialog.hide();
|
|
@@ -477,7 +535,7 @@ function showNeedLoginDialog(config) {
|
|
|
477
535
|
spm_btn_type: "getSecToken",
|
|
478
536
|
spm_loginUrl: loginUrl
|
|
479
537
|
});
|
|
480
|
-
commonEasyFetch.get(`${(_a =
|
|
538
|
+
commonEasyFetch.get(`${(_a = getSLSdomain()) != null ? _a : ""}/console/ajax/getSecToken.json`).then((res) => {
|
|
481
539
|
if (res && res.code === "200") {
|
|
482
540
|
window.ALIYUN_SLS_CONSOLE_CONFIG.SEC_TOKEN = res.data;
|
|
483
541
|
dialog.hide();
|
|
@@ -762,7 +820,7 @@ var __async$6 = (__this, __arguments, generator) => {
|
|
|
762
820
|
const slsEasyFetch = new BaseFetch(finalFetch);
|
|
763
821
|
slsEasyFetch.defaults.postDefaultInit.headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
764
822
|
slsEasyFetch.defaults.postDefaultInit.headers["Accept"] = "application/json";
|
|
765
|
-
slsEasyFetch.defaults.baseURL =
|
|
823
|
+
slsEasyFetch.defaults.baseURL = getSLSdomain();
|
|
766
824
|
slsEasyFetch.defaults.errorHandler = errorHandler;
|
|
767
825
|
slsEasyFetch.defaults.beforeRequest = (url, params, init, options) => __async$6(void 0, null, function* () {
|
|
768
826
|
var _a;
|
|
@@ -823,23 +881,10 @@ slsEasyFetch.defaults.afterResponse = (r, options) => __async$6(void 0, null, fu
|
|
|
823
881
|
return composedData;
|
|
824
882
|
});
|
|
825
883
|
|
|
826
|
-
function getBaseUrl() {
|
|
827
|
-
var _a, _b, _c;
|
|
828
|
-
if ((_a = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _a.LOCAL) {
|
|
829
|
-
return `http://pre-observability:${window.location.port}`;
|
|
830
|
-
}
|
|
831
|
-
if (((_b = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _b.ENV) === "pre" || ((_c = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _c.fEnv) === "pre") {
|
|
832
|
-
return `https://pre-observability.console.aliyun.com`;
|
|
833
|
-
}
|
|
834
|
-
if (is4Service(window.location)) {
|
|
835
|
-
return `https://observability4service.console.aliyun.com`;
|
|
836
|
-
}
|
|
837
|
-
return `https://observability.console.aliyun.com`;
|
|
838
|
-
}
|
|
839
884
|
const obsEasyFetch = new BaseFetch(finalFetch);
|
|
840
885
|
obsEasyFetch.defaults.postDefaultInit.headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
841
886
|
obsEasyFetch.defaults.postDefaultInit.headers["Accept"] = "application/json";
|
|
842
|
-
obsEasyFetch.defaults.baseURL =
|
|
887
|
+
obsEasyFetch.defaults.baseURL = getObvDomain();
|
|
843
888
|
obsEasyFetch.defaults.errorHandler = errorHandler;
|
|
844
889
|
obsEasyFetch.defaults.beforeRequest = slsEasyFetch.defaults.beforeRequest;
|
|
845
890
|
obsEasyFetch.defaults.afterResponse = slsEasyFetch.defaults.afterResponse;
|
package/package.json
CHANGED