@kinotic-ai/core 1.4.0 → 1.5.0
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/index.cjs +13 -2
- package/dist/index.js +13 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -152,6 +152,7 @@ var import_stompjs = require("@stomp/stompjs");
|
|
|
152
152
|
var import_debug = __toESM(require("debug"));
|
|
153
153
|
var import_rxjs = require("rxjs");
|
|
154
154
|
var import_uuid = require("uuid");
|
|
155
|
+
var SESSION_CHECK_PATH = "/api/me";
|
|
155
156
|
|
|
156
157
|
class StompConnectionManager {
|
|
157
158
|
lastWebsocketError = null;
|
|
@@ -216,6 +217,16 @@ class StompConnectionManager {
|
|
|
216
217
|
reconnectTimeMode: import_stompjs.ReconnectionTimeMode.EXPONENTIAL,
|
|
217
218
|
webSocketFactory: userWebSocketFactory ? () => preparedSocket : undefined,
|
|
218
219
|
beforeConnect: async () => {
|
|
220
|
+
if (!userWebSocketFactory) {
|
|
221
|
+
const sessionCheckUrl = "http" + (connectionInfo.useSSL ? "s" : "") + "://" + connectionInfo.host + (connectionInfo.port ? ":" + connectionInfo.port : "") + SESSION_CHECK_PATH;
|
|
222
|
+
try {
|
|
223
|
+
const res = await fetch(sessionCheckUrl, { credentials: "include" });
|
|
224
|
+
if (res.status === 401) {
|
|
225
|
+
await this.signalFatal(new Error("Authentication required"));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
} catch {}
|
|
229
|
+
}
|
|
219
230
|
if (connectionInfo?.maxConnectionAttempts) {
|
|
220
231
|
this.connectionAttempts++;
|
|
221
232
|
if (this.connectionAttempts > connectionInfo.maxConnectionAttempts) {
|
|
@@ -983,7 +994,7 @@ var import_operators2 = require("rxjs/operators");
|
|
|
983
994
|
// packages/core/package.json
|
|
984
995
|
var package_default = {
|
|
985
996
|
name: "@kinotic-ai/core",
|
|
986
|
-
version: "1.
|
|
997
|
+
version: "1.5.0",
|
|
987
998
|
type: "module",
|
|
988
999
|
files: [
|
|
989
1000
|
"dist"
|
|
@@ -1040,7 +1051,7 @@ var package_default = {
|
|
|
1040
1051
|
dependencies: {
|
|
1041
1052
|
"@opentelemetry/api": "^1.9.1",
|
|
1042
1053
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
1043
|
-
"@stomp/rx-stomp": "^2.
|
|
1054
|
+
"@stomp/rx-stomp": "^2.4.0",
|
|
1044
1055
|
"@stomp/stompjs": "^7.3.0",
|
|
1045
1056
|
"@types/debug": "^4.1.13",
|
|
1046
1057
|
debug: "^4.4.3",
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ import { ReconnectionTimeMode } from "@stomp/stompjs";
|
|
|
53
53
|
import debug from "debug";
|
|
54
54
|
import { Subject } from "rxjs";
|
|
55
55
|
import { v4 as uuidv4 } from "uuid";
|
|
56
|
+
var SESSION_CHECK_PATH = "/api/me";
|
|
56
57
|
|
|
57
58
|
class StompConnectionManager {
|
|
58
59
|
lastWebsocketError = null;
|
|
@@ -117,6 +118,16 @@ class StompConnectionManager {
|
|
|
117
118
|
reconnectTimeMode: ReconnectionTimeMode.EXPONENTIAL,
|
|
118
119
|
webSocketFactory: userWebSocketFactory ? () => preparedSocket : undefined,
|
|
119
120
|
beforeConnect: async () => {
|
|
121
|
+
if (!userWebSocketFactory) {
|
|
122
|
+
const sessionCheckUrl = "http" + (connectionInfo.useSSL ? "s" : "") + "://" + connectionInfo.host + (connectionInfo.port ? ":" + connectionInfo.port : "") + SESSION_CHECK_PATH;
|
|
123
|
+
try {
|
|
124
|
+
const res = await fetch(sessionCheckUrl, { credentials: "include" });
|
|
125
|
+
if (res.status === 401) {
|
|
126
|
+
await this.signalFatal(new Error("Authentication required"));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
} catch {}
|
|
130
|
+
}
|
|
120
131
|
if (connectionInfo?.maxConnectionAttempts) {
|
|
121
132
|
this.connectionAttempts++;
|
|
122
133
|
if (this.connectionAttempts > connectionInfo.maxConnectionAttempts) {
|
|
@@ -887,7 +898,7 @@ import { first, map as map2 } from "rxjs/operators";
|
|
|
887
898
|
// packages/core/package.json
|
|
888
899
|
var package_default = {
|
|
889
900
|
name: "@kinotic-ai/core",
|
|
890
|
-
version: "1.
|
|
901
|
+
version: "1.5.0",
|
|
891
902
|
type: "module",
|
|
892
903
|
files: [
|
|
893
904
|
"dist"
|
|
@@ -944,7 +955,7 @@ var package_default = {
|
|
|
944
955
|
dependencies: {
|
|
945
956
|
"@opentelemetry/api": "^1.9.1",
|
|
946
957
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
947
|
-
"@stomp/rx-stomp": "^2.
|
|
958
|
+
"@stomp/rx-stomp": "^2.4.0",
|
|
948
959
|
"@stomp/stompjs": "^7.3.0",
|
|
949
960
|
"@types/debug": "^4.1.13",
|
|
950
961
|
debug: "^4.4.3",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@opentelemetry/api": "^1.9.1",
|
|
59
59
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
60
|
-
"@stomp/rx-stomp": "^2.
|
|
60
|
+
"@stomp/rx-stomp": "^2.4.0",
|
|
61
61
|
"@stomp/stompjs": "^7.3.0",
|
|
62
62
|
"@types/debug": "^4.1.13",
|
|
63
63
|
"debug": "^4.4.3",
|