@shirokasoke/webapi-sdk 2.9.0-beta2-0.11-test2 → 2.9.0-beta3-0.12-pre
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/client.d.ts +2 -2
- package/dist/client.js +3 -3
- package/dist/esm/client.js +3 -3
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class WebApiClient {
|
|
|
9
9
|
private baseUrl;
|
|
10
10
|
private authToken?;
|
|
11
11
|
private fetchImpl;
|
|
12
|
-
SSE: boolean;
|
|
12
|
+
SSE: boolean | undefined;
|
|
13
13
|
constructor(options: WebApiClientOptions);
|
|
14
14
|
private request;
|
|
15
15
|
/**
|
|
@@ -39,7 +39,7 @@ export declare class WebApiClient {
|
|
|
39
39
|
* @returns 服务端 SSE 可用返回 `true`,否则返回 `false`
|
|
40
40
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/test/SSETestHandler.java)
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
checkSSE(timeoutMs?: number): Promise<boolean>;
|
|
43
43
|
/**
|
|
44
44
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/TPSHandler.java)
|
|
45
45
|
* @returns 使用 `Joi.object().pattern(Joi.string(), {@link TPSInfoSchema})` 验证
|
package/dist/client.js
CHANGED
|
@@ -19,7 +19,7 @@ function unwrapApiResponse(body) {
|
|
|
19
19
|
}
|
|
20
20
|
class WebApiClient {
|
|
21
21
|
constructor(options) {
|
|
22
|
-
this.SSE =
|
|
22
|
+
this.SSE = undefined;
|
|
23
23
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
24
24
|
this.authToken = options.authToken;
|
|
25
25
|
const globalFetch = typeof globalThis !== "undefined" ? globalThis.fetch : undefined;
|
|
@@ -130,8 +130,8 @@ class WebApiClient {
|
|
|
130
130
|
* @returns 服务端 SSE 可用返回 `true`,否则返回 `false`
|
|
131
131
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/test/SSETestHandler.java)
|
|
132
132
|
*/
|
|
133
|
-
|
|
134
|
-
if (this.SSE)
|
|
133
|
+
checkSSE(timeoutMs = 500) {
|
|
134
|
+
if (this.SSE != undefined)
|
|
135
135
|
return Promise.resolve(this.SSE);
|
|
136
136
|
return new Promise(resolve => {
|
|
137
137
|
let controller;
|
package/dist/esm/client.js
CHANGED
|
@@ -16,7 +16,7 @@ function unwrapApiResponse(body) {
|
|
|
16
16
|
}
|
|
17
17
|
export class WebApiClient {
|
|
18
18
|
constructor(options) {
|
|
19
|
-
this.SSE =
|
|
19
|
+
this.SSE = undefined;
|
|
20
20
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
21
21
|
this.authToken = options.authToken;
|
|
22
22
|
const globalFetch = typeof globalThis !== "undefined" ? globalThis.fetch : undefined;
|
|
@@ -127,8 +127,8 @@ export class WebApiClient {
|
|
|
127
127
|
* @returns 服务端 SSE 可用返回 `true`,否则返回 `false`
|
|
128
128
|
* @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/test/SSETestHandler.java)
|
|
129
129
|
*/
|
|
130
|
-
|
|
131
|
-
if (this.SSE)
|
|
130
|
+
checkSSE(timeoutMs = 500) {
|
|
131
|
+
if (this.SSE != undefined)
|
|
132
132
|
return Promise.resolve(this.SSE);
|
|
133
133
|
return new Promise(resolve => {
|
|
134
134
|
let controller;
|
package/package.json
CHANGED