@hautechai/sdk 0.3.7 → 0.3.8
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/sdk/index.d.ts
CHANGED
|
@@ -1218,7 +1218,7 @@ export declare const createSDK: (options: SDKOptions) => {
|
|
|
1218
1218
|
metadata?: PoseMetadata;
|
|
1219
1219
|
}) => Promise<void>;
|
|
1220
1220
|
};
|
|
1221
|
-
close: () => void
|
|
1221
|
+
close: () => Promise<void>;
|
|
1222
1222
|
};
|
|
1223
1223
|
export type SDK = ReturnType<typeof createSDK>;
|
|
1224
1224
|
export interface CollectionMetadata {
|
package/dist/sdk/index.js
CHANGED
|
@@ -57,8 +57,8 @@ export const createSDK = (options) => {
|
|
|
57
57
|
storage: storage(optionsWithTokenRefresher),
|
|
58
58
|
utils: utils(optionsWithTokenRefresher),
|
|
59
59
|
poses: poses(optionsWithTokenRefresher),
|
|
60
|
-
close: () => {
|
|
61
|
-
operationsListener.close();
|
|
60
|
+
close: async () => {
|
|
61
|
+
await operationsListener.close();
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
};
|
|
@@ -18,7 +18,7 @@ export class OperationsListener {
|
|
|
18
18
|
this.allowPollingFallback = allowPollingFallback;
|
|
19
19
|
}
|
|
20
20
|
async getOperation(id) {
|
|
21
|
-
const fallbackToPolling = this.allowPollingFallback && !(this.ws?.readyState ===
|
|
21
|
+
const fallbackToPolling = this.allowPollingFallback && !(this.ws?.readyState === WebSocketClient.OPEN);
|
|
22
22
|
if (!this.operationsStore[id] || fallbackToPolling) {
|
|
23
23
|
const api = await this.operations();
|
|
24
24
|
const operation = await api.operationsControllerGetOperationV1(id);
|
|
@@ -94,7 +94,8 @@ export class OperationsListener {
|
|
|
94
94
|
this.operationsStore = {};
|
|
95
95
|
this.ws = null;
|
|
96
96
|
}
|
|
97
|
-
close() {
|
|
97
|
+
async close() {
|
|
98
98
|
this.ws?.close();
|
|
99
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
99
100
|
}
|
|
100
101
|
}
|