@aliyun-obv/api 0.3.45-beta.1 → 0.3.46

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.d.ts CHANGED
@@ -88,6 +88,9 @@ type SSEClientOptions = Omit<RequestInit, 'signal'> & {
88
88
  hideErrorAlert?: boolean;
89
89
  onOpen?: (response: Response) => Promise<void>;
90
90
  onClose?: () => void;
91
+ openWhenHidden?: boolean;
92
+ fetch?: typeof fetch;
93
+ fetchEventSourceConfig?: Record<string, any>;
91
94
  };
92
95
  interface IsseClient extends Omit<SSEClientOptions, 'headers'> {
93
96
  region?: string;
package/dist/api.es.js CHANGED
@@ -212,15 +212,6 @@ class BaseFetch {
212
212
  }
213
213
 
214
214
  var _a$2, _b$1, _c;
215
- const {
216
- links: {
217
- LOG4FINANCECONSOLE,
218
- SLS4SERVICECONSOLE,
219
- SLSCONSOLE,
220
- CMSNEXTCONSOLE,
221
- CMSNEXT4SERVICECONSOLE
222
- }
223
- } = slsConsoleRuntime;
224
215
  const isLocal = (_a$2 = window == null ? void 0 : window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _a$2.LOCAL;
225
216
  const isPre = ((_b$1 = window == null ? void 0 : window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _b$1.fEnv) === "pre" || ((_c = window == null ? void 0 : window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _c.ENV) === "pre";
226
217
  function is4Service(location2) {
@@ -250,7 +241,7 @@ function getSLSdomain() {
250
241
  return window.location.origin;
251
242
  }
252
243
  const host = window.location.host;
253
- if (((_b2 = window == null ? void 0 : window.ALIYUN_SLS_CONSOLE_CONFIG) == null ? void 0 : _b2.isSlsConsole) || host.includes("sls") && (host.includes("console.aliyun.com") || host.includes("console.alibabacloud.com"))) {
244
+ if (((_b2 = window == null ? void 0 : window.ALIYUN_SLS_CONSOLE_CONFIG) == null ? void 0 : _b2.isSlsConsole) || host.includes("sls") && host.includes("console.aliyun.com")) {
254
245
  return void 0;
255
246
  }
256
247
  if (isPre) {
@@ -266,12 +257,12 @@ function getSLSdomain() {
266
257
  return "https://pre-sls.console.aliyun.com";
267
258
  }
268
259
  if (is4Finance(window.location)) {
269
- return `https:${LOG4FINANCECONSOLE}`;
260
+ return `https://log4finance.console.aliyun.com`;
270
261
  }
271
262
  if (is4Service(window.location)) {
272
- return `https:${SLS4SERVICECONSOLE}`;
263
+ return `https://sls4service.console.aliyun.com`;
273
264
  }
274
- return `https:${SLSCONSOLE}`;
265
+ return "https://sls.console.aliyun.com";
275
266
  }
276
267
  function getObvDomain() {
277
268
  var _a2, _b2;
@@ -303,15 +294,15 @@ function getObvDomain() {
303
294
  return `https://pre-cmsnext.console.aliyun.com`;
304
295
  }
305
296
  if (is4Finance(window.location)) {
306
- return `https:${CMSNEXTCONSOLE}`;
297
+ return `https://cmsnext.console.aliyun.com`;
307
298
  }
308
299
  if (is4Service(window.location)) {
309
- return `https:${CMSNEXT4SERVICECONSOLE}`;
300
+ return `https://cmsnext4service.console.aliyun.com`;
310
301
  }
311
302
  if (location.hostname.includes("observability") || location.hostname.includes("cmsnext")) {
312
303
  return location.origin;
313
304
  }
314
- return `https:${CMSNEXTCONSOLE}`;
305
+ return `https://cmsnext.console.aliyun.com`;
315
306
  }
316
307
  function getConfig(key) {
317
308
  window.ALIYUN_SLS_CONSOLE_CONFIG = window.ALIYUN_SLS_CONSOLE_CONFIG || {};
@@ -997,8 +988,9 @@ class SSEClient {
997
988
  }
998
989
  connect() {
999
990
  return __async$6(this, null, function* () {
991
+ var _a2, _b;
1000
992
  try {
1001
- fetchEventSource(this.finalUrl, {
993
+ fetchEventSource(this.finalUrl, __spreadValues$1({
1002
994
  method: this.options.method,
1003
995
  headers: this.options.headers,
1004
996
  body: this.getRequestBody(),
@@ -1006,6 +998,9 @@ class SSEClient {
1006
998
  credentials: "include",
1007
999
  onopen: this.options.onOpen,
1008
1000
  onmessage: this.options.onMessage,
1001
+ // 切换tab,请求不中断
1002
+ openWhenHidden: (_a2 = this.options.openWhenHidden) != null ? _a2 : true,
1003
+ fetch: this.options.fetch,
1009
1004
  onerror: (error) => {
1010
1005
  if (this.options.onError) {
1011
1006
  this.options.onError(error);
@@ -1016,7 +1011,7 @@ class SSEClient {
1016
1011
  throw error;
1017
1012
  },
1018
1013
  onclose: this.options.onClose
1019
- });
1014
+ }, (_b = this.options.fetchEventSourceConfig) != null ? _b : {}));
1020
1015
  } catch (error) {
1021
1016
  throw error;
1022
1017
  }
package/package.json CHANGED
@@ -15,5 +15,5 @@
15
15
  "styled-components": "^5.2.0",
16
16
  "urijs": "^1.19.1"
17
17
  },
18
- "version": "0.3.45-beta.1"
18
+ "version": "0.3.46"
19
19
  }