@swan-admin/swan-ai-measurements 1.1.68 → 1.1.69
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/esm/measurement.js +4 -4
- package/dist/measurement.js +4 -4
- package/package.json +1 -1
- package/src/measurement.ts +5 -4
package/dist/esm/measurement.js
CHANGED
|
@@ -56,14 +56,14 @@ class Measurement {
|
|
|
56
56
|
if (!checkParameters(scanId)) {
|
|
57
57
|
throw new Error(REQUIRED_MESSAGE);
|
|
58
58
|
}
|
|
59
|
-
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_handleSocket).call(this, { onOpen, scanId, onSuccess, onError, onClose, paramsKey: "scanId", isFallback: true });
|
|
59
|
+
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_handleSocket).call(this, { onOpen, scanId, onSuccess, onError, onClose, paramsKey: "scanId", isFallback: true, delay: 5000 });
|
|
60
60
|
}
|
|
61
61
|
handlFaceScaneSocket(options) {
|
|
62
62
|
const { faceScanId, onError, onSuccess, onClose, onOpen } = options;
|
|
63
63
|
if (!checkParameters(faceScanId)) {
|
|
64
64
|
throw new Error(REQUIRED_MESSAGE);
|
|
65
65
|
}
|
|
66
|
-
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_handleSocket).call(this, { onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false });
|
|
66
|
+
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_handleSocket).call(this, { onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false, delay: 0 });
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
_Measurement_measurementSocketRef = new WeakMap(), _Measurement_timerPollingRef = new WeakMap(), _Measurement_timerWaitingRef = new WeakMap(), _Measurement_count = new WeakMap(), _Measurement_accessKey = new WeakMap(), _Measurement_stagingUrl = new WeakMap(), _Measurement_instances = new WeakSet(), _Measurement_getMeasurementsCheck = function _Measurement_getMeasurementsCheck(options) {
|
|
@@ -121,7 +121,7 @@ _Measurement_measurementSocketRef = new WeakMap(), _Measurement_timerPollingRef
|
|
|
121
121
|
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_handlePolling).call(this, { scanId, onSuccess, onError });
|
|
122
122
|
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_disconnectSocket).call(this);
|
|
123
123
|
}, 2 * 60000), "f");
|
|
124
|
-
}, _Measurement_handleSocket = function _Measurement_handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId }) {
|
|
124
|
+
}, _Measurement_handleSocket = function _Measurement_handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay }) {
|
|
125
125
|
setTimeout(() => {
|
|
126
126
|
__classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_disconnectSocket).call(this);
|
|
127
127
|
const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: __classPrivateFieldGet(this, _Measurement_stagingUrl, "f") })}${API_ENDPOINTS.SCANNING}?${paramsKey}=${scanId || faceScanId}`;
|
|
@@ -153,6 +153,6 @@ _Measurement_measurementSocketRef = new WeakMap(), _Measurement_timerPollingRef
|
|
|
153
153
|
__classPrivateFieldGet(this, _Measurement_measurementSocketRef, "f").onerror = (event) => {
|
|
154
154
|
// onError?.(event);
|
|
155
155
|
};
|
|
156
|
-
},
|
|
156
|
+
}, delay);
|
|
157
157
|
};
|
|
158
158
|
export default Measurement;
|
package/dist/measurement.js
CHANGED
|
@@ -93,16 +93,16 @@ class Measurement {
|
|
|
93
93
|
if (!(0, utils_js_1.checkParameters)(scanId)) {
|
|
94
94
|
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
95
95
|
}
|
|
96
|
-
this.#handleSocket({ onOpen, scanId, onSuccess, onError, onClose, paramsKey: "scanId", isFallback: true });
|
|
96
|
+
this.#handleSocket({ onOpen, scanId, onSuccess, onError, onClose, paramsKey: "scanId", isFallback: true, delay: 5000 });
|
|
97
97
|
}
|
|
98
98
|
handlFaceScaneSocket(options) {
|
|
99
99
|
const { faceScanId, onError, onSuccess, onClose, onOpen } = options;
|
|
100
100
|
if (!(0, utils_js_1.checkParameters)(faceScanId)) {
|
|
101
101
|
throw new Error(constants_js_1.REQUIRED_MESSAGE);
|
|
102
102
|
}
|
|
103
|
-
this.#handleSocket({ onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false });
|
|
103
|
+
this.#handleSocket({ onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false, delay: 0 });
|
|
104
104
|
}
|
|
105
|
-
#handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId }) {
|
|
105
|
+
#handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay }) {
|
|
106
106
|
setTimeout(() => {
|
|
107
107
|
this.#disconnectSocket();
|
|
108
108
|
const url = `${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.SCANNING}?${paramsKey}=${scanId || faceScanId}`;
|
|
@@ -134,7 +134,7 @@ class Measurement {
|
|
|
134
134
|
this.#measurementSocketRef.onerror = (event) => {
|
|
135
135
|
// onError?.(event);
|
|
136
136
|
};
|
|
137
|
-
},
|
|
137
|
+
}, delay);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
exports.default = Measurement;
|
package/package.json
CHANGED
package/src/measurement.ts
CHANGED
|
@@ -24,6 +24,7 @@ interface HandleSocket extends Callbacks {
|
|
|
24
24
|
scanId?: string;
|
|
25
25
|
faceScanId?: string;
|
|
26
26
|
paramsKey?: string;
|
|
27
|
+
delay:number
|
|
27
28
|
}
|
|
28
29
|
interface GetMeasurementsCheckOptions {
|
|
29
30
|
scanId: string;
|
|
@@ -140,7 +141,7 @@ class Measurement {
|
|
|
140
141
|
if (!checkParameters(scanId)) {
|
|
141
142
|
throw new Error(REQUIRED_MESSAGE);
|
|
142
143
|
}
|
|
143
|
-
this.#handleSocket({ onOpen, scanId, onSuccess, onError, onClose, paramsKey: "scanId", isFallback: true });
|
|
144
|
+
this.#handleSocket({ onOpen, scanId, onSuccess, onError, onClose, paramsKey: "scanId", isFallback: true,delay:5000 });
|
|
144
145
|
}
|
|
145
146
|
handlFaceScaneSocket(options: FaceScanSocketOptions): void {
|
|
146
147
|
const { faceScanId, onError, onSuccess, onClose, onOpen } = options;
|
|
@@ -148,9 +149,9 @@ class Measurement {
|
|
|
148
149
|
if (!checkParameters(faceScanId)) {
|
|
149
150
|
throw new Error(REQUIRED_MESSAGE);
|
|
150
151
|
}
|
|
151
|
-
this.#handleSocket({ onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false });
|
|
152
|
+
this.#handleSocket({ onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false,delay:0 });
|
|
152
153
|
}
|
|
153
|
-
#handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId }: HandleSocket) {
|
|
154
|
+
#handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId,delay }: HandleSocket) {
|
|
154
155
|
setTimeout(() => {
|
|
155
156
|
this.#disconnectSocket();
|
|
156
157
|
const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.SCANNING}?${paramsKey}=${scanId || faceScanId}`;
|
|
@@ -184,7 +185,7 @@ class Measurement {
|
|
|
184
185
|
this.#measurementSocketRef.onerror = (event: Event) => {
|
|
185
186
|
// onError?.(event);
|
|
186
187
|
};
|
|
187
|
-
},
|
|
188
|
+
}, delay);
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|