@eyepop.ai/eyepop 1.5.7 → 1.6.1
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/eyepop.index.mjs
CHANGED
|
@@ -8639,6 +8639,7 @@ var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
|
|
|
8639
8639
|
EndpointState2["Authenticating"] = "Authenticating";
|
|
8640
8640
|
EndpointState2["FetchConfig"] = "FetchConfig";
|
|
8641
8641
|
EndpointState2["Error"] = "Error";
|
|
8642
|
+
EndpointState2["NotAvailable"] = "NotAvailable";
|
|
8642
8643
|
return EndpointState2;
|
|
8643
8644
|
})(EndpointState || {});
|
|
8644
8645
|
|
|
@@ -9913,6 +9914,7 @@ var Endpoint = class {
|
|
|
9913
9914
|
this._statusRetryHandlers.set(401, this.statusHandler401);
|
|
9914
9915
|
this._limit = new Semaphore(this._options.jobQueueLength ?? 1024);
|
|
9915
9916
|
this._state = "Idle" /* Idle */;
|
|
9917
|
+
this._message = null;
|
|
9916
9918
|
this._stateChangeHandler = null;
|
|
9917
9919
|
let rootLogger;
|
|
9918
9920
|
if (options.logger) {
|
|
@@ -9940,11 +9942,14 @@ var Endpoint = class {
|
|
|
9940
9942
|
state() {
|
|
9941
9943
|
return this._state;
|
|
9942
9944
|
}
|
|
9945
|
+
lastMessage() {
|
|
9946
|
+
return this._message;
|
|
9947
|
+
}
|
|
9943
9948
|
onStateChanged(handler) {
|
|
9944
9949
|
this._stateChangeHandler = handler;
|
|
9945
9950
|
return this;
|
|
9946
9951
|
}
|
|
9947
|
-
updateState(newState = void 0) {
|
|
9952
|
+
updateState(newState = void 0, message = void 0) {
|
|
9948
9953
|
const fromState = this._state;
|
|
9949
9954
|
if (newState == void 0) {
|
|
9950
9955
|
if (this._limit.getPermits() == this._options.jobQueueLength) {
|
|
@@ -9954,6 +9959,7 @@ var Endpoint = class {
|
|
|
9954
9959
|
}
|
|
9955
9960
|
}
|
|
9956
9961
|
this._state = newState;
|
|
9962
|
+
this._message = message ? message : null;
|
|
9957
9963
|
if (this._stateChangeHandler) {
|
|
9958
9964
|
this._stateChangeHandler(fromState, this._state);
|
|
9959
9965
|
}
|
|
@@ -10419,8 +10425,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10419
10425
|
});
|
|
10420
10426
|
}
|
|
10421
10427
|
if (response.status != 200) {
|
|
10422
|
-
this.updateState("Error" /* Error */);
|
|
10423
10428
|
const message = await response.text();
|
|
10429
|
+
if (response.status == 429) {
|
|
10430
|
+
this.updateState("NotAvailable" /* NotAvailable */, message);
|
|
10431
|
+
} else {
|
|
10432
|
+
this.updateState("Error" /* Error */, message);
|
|
10433
|
+
}
|
|
10424
10434
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10425
10435
|
}
|
|
10426
10436
|
let config = await response.json();
|