@pioneer-platform/pioneer-events 8.12.6 → 8.12.12
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/CHANGELOG.md +48 -0
- package/lib/index.js +32 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @pioneer-platform/pioneer-events
|
|
2
2
|
|
|
3
|
+
## 8.12.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @pioneer-platform/pioneer-types@8.11.15
|
|
10
|
+
|
|
11
|
+
## 8.12.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @pioneer-platform/pioneer-types@8.11.14
|
|
18
|
+
|
|
19
|
+
## 8.12.10
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- chore: chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @pioneer-platform/pioneer-types@8.11.13
|
|
26
|
+
|
|
27
|
+
## 8.12.9
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- chore: chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
- @pioneer-platform/pioneer-types@8.11.12
|
|
34
|
+
|
|
35
|
+
## 8.12.8
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- chore: chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
|
|
40
|
+
- Updated dependencies
|
|
41
|
+
- @pioneer-platform/pioneer-types@8.11.11
|
|
42
|
+
|
|
43
|
+
## 8.12.7
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- chore: chore: chore: chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
|
|
48
|
+
- Updated dependencies
|
|
49
|
+
- @pioneer-platform/pioneer-types@8.11.10
|
|
50
|
+
|
|
3
51
|
## 8.12.6
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
package/lib/index.js
CHANGED
|
@@ -53,7 +53,7 @@ var Events = /** @class */ (function () {
|
|
|
53
53
|
this.events = new events_1.EventEmitter();
|
|
54
54
|
this.init = function () {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var tag, e_1;
|
|
56
|
+
var tag, connectionError_1, maxWaitTime, startTime, errorMsg, e_1;
|
|
57
57
|
var _this = this;
|
|
58
58
|
return __generator(this, function (_a) {
|
|
59
59
|
switch (_a.label) {
|
|
@@ -62,14 +62,28 @@ var Events = /** @class */ (function () {
|
|
|
62
62
|
_a.label = 1;
|
|
63
63
|
case 1:
|
|
64
64
|
_a.trys.push([1, 5, , 6]);
|
|
65
|
+
console.log(tag, 'checkpoint 2.1.1 - Attempting WebSocket connection to:', this.wss);
|
|
65
66
|
this.socket = io.connect(this.wss, {
|
|
66
67
|
reconnect: true,
|
|
67
68
|
rejectUnauthorized: false,
|
|
68
69
|
transports: ['websocket'],
|
|
70
|
+
timeout: 10000, // 10 second connection timeout
|
|
71
|
+
});
|
|
72
|
+
console.log(tag, 'checkpoint 2.1.2 - Socket.io connect called, waiting for connect event...');
|
|
73
|
+
connectionError_1 = null;
|
|
74
|
+
this.socket.on('connect_error', function (err) {
|
|
75
|
+
console.error(tag, '❌ WebSocket connection error:', err.message);
|
|
76
|
+
connectionError_1 = err;
|
|
77
|
+
});
|
|
78
|
+
this.socket.on('connect_timeout', function () {
|
|
79
|
+
console.error(tag, '❌ WebSocket connection timeout');
|
|
80
|
+
connectionError_1 = new Error('WebSocket connection timeout');
|
|
69
81
|
});
|
|
70
82
|
//sub
|
|
71
83
|
this.socket.on('connect', function () {
|
|
84
|
+
console.log(tag, '✅ WebSocket connected successfully');
|
|
72
85
|
_this.isConnected = true;
|
|
86
|
+
connectionError_1 = null; // Clear any previous errors
|
|
73
87
|
//rejoin
|
|
74
88
|
if (_this.username) {
|
|
75
89
|
_this.pair();
|
|
@@ -110,17 +124,31 @@ var Events = /** @class */ (function () {
|
|
|
110
124
|
this.socket.on('sync:complete', function (message) {
|
|
111
125
|
_this.events.emit('sync:complete', message);
|
|
112
126
|
});
|
|
127
|
+
maxWaitTime = 15000;
|
|
128
|
+
startTime = Date.now();
|
|
113
129
|
_a.label = 2;
|
|
114
130
|
case 2:
|
|
115
131
|
if (!!this.isConnected) return [3 /*break*/, 4];
|
|
116
|
-
return [4 /*yield*/, sleep(300)
|
|
132
|
+
return [4 /*yield*/, sleep(300)
|
|
133
|
+
// Check for timeout
|
|
134
|
+
];
|
|
117
135
|
case 3:
|
|
118
136
|
_a.sent();
|
|
137
|
+
// Check for timeout
|
|
138
|
+
if (Date.now() - startTime > maxWaitTime) {
|
|
139
|
+
errorMsg = connectionError_1
|
|
140
|
+
? "Pioneer Server WebSocket connection failed: ".concat(connectionError_1.message, ". Please ensure Pioneer Server is running at ").concat(this.wss)
|
|
141
|
+
: "Pioneer Server WebSocket connection timeout after ".concat(maxWaitTime, "ms. Please ensure Pioneer Server is running at ").concat(this.wss);
|
|
142
|
+
console.error(tag, '❌', errorMsg);
|
|
143
|
+
throw new Error(errorMsg);
|
|
144
|
+
}
|
|
119
145
|
return [3 /*break*/, 2];
|
|
120
|
-
case 4:
|
|
146
|
+
case 4:
|
|
147
|
+
console.log(tag, '✅ WebSocket initialization complete');
|
|
148
|
+
return [2 /*return*/, true];
|
|
121
149
|
case 5:
|
|
122
150
|
e_1 = _a.sent();
|
|
123
|
-
console.error(e_1);
|
|
151
|
+
console.error(tag, '❌ WebSocket initialization failed:', e_1);
|
|
124
152
|
throw e_1;
|
|
125
153
|
case 6: return [2 /*return*/];
|
|
126
154
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/pioneer-events",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.12",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pioneer-platform/pioneer-types": "^8.11.
|
|
17
|
+
"@pioneer-platform/pioneer-types": "^8.11.15",
|
|
18
18
|
"@types/node": "^18.15.11",
|
|
19
19
|
"cookie": "^1.0.2",
|
|
20
20
|
"dotenv": "^16.4.7",
|