@aurabase/realtime 0.6.1 → 0.6.2
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 +17 -0
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +17 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -309,6 +309,11 @@ var AuraChannel = class {
|
|
|
309
309
|
* Retourne une fonction de désabonnement direct `() => void` qui proxy également l'instance du canal pour le chaînage fluide.
|
|
310
310
|
*/
|
|
311
311
|
on(type, filter, callback) {
|
|
312
|
+
if (type !== "postgres_changes" && type !== "broadcast" && type !== "presence") {
|
|
313
|
+
throw new TypeError(
|
|
314
|
+
`[aurabase] channel.on(): unknown listen type "${String(type)}". For table changes use .on('postgres_changes', { event: 'INSERT', schema: 'public', table: '<table>' }, callback); other types: 'broadcast', 'presence'.`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
312
317
|
const id = ++this._listenerIdCounter;
|
|
313
318
|
this._listeners.push({
|
|
314
319
|
id,
|
|
@@ -892,6 +897,9 @@ var RealtimeConnectionError = class _RealtimeConnectionError extends Error {
|
|
|
892
897
|
};
|
|
893
898
|
|
|
894
899
|
// src/HeartbeatManager.ts
|
|
900
|
+
function isUnrefable(value) {
|
|
901
|
+
return typeof value === "object" && value !== null && "unref" in value && typeof value.unref === "function";
|
|
902
|
+
}
|
|
895
903
|
var HeartbeatManager = class _HeartbeatManager {
|
|
896
904
|
_worker = null;
|
|
897
905
|
_workerUrl = null;
|
|
@@ -962,6 +970,9 @@ var HeartbeatManager = class _HeartbeatManager {
|
|
|
962
970
|
this._interval = setInterval(() => {
|
|
963
971
|
this._sendFn?.();
|
|
964
972
|
}, intervalMs);
|
|
973
|
+
if (isUnrefable(this._interval)) {
|
|
974
|
+
this._interval.unref();
|
|
975
|
+
}
|
|
965
976
|
}
|
|
966
977
|
_clearWatchdog() {
|
|
967
978
|
if (this._watchdog) {
|
|
@@ -1044,6 +1055,9 @@ function getTokenProjectId(token) {
|
|
|
1044
1055
|
var HEARTBEAT_INTERVAL_MS = 25e3;
|
|
1045
1056
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
1046
1057
|
var LIVENESS_GUARD_INTERVAL_MS = 3e4;
|
|
1058
|
+
function isUnrefable2(value) {
|
|
1059
|
+
return typeof value === "object" && value !== null && "unref" in value && typeof value.unref === "function";
|
|
1060
|
+
}
|
|
1047
1061
|
var CANAL_QUALIFIE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}:/;
|
|
1048
1062
|
var LIVENESS_MAX_SILENCE_MS = 9e4;
|
|
1049
1063
|
var RealtimeService = class _RealtimeService {
|
|
@@ -1298,6 +1312,9 @@ var RealtimeService = class _RealtimeService {
|
|
|
1298
1312
|
`Realtime : aucun message du serveur depuis ${Math.round(silence / 1e3)} s alors qu'il en pousse un toutes les 30 s \u2014 connexion consid\xE9r\xE9e morte. Reconnexion.`
|
|
1299
1313
|
);
|
|
1300
1314
|
}, LIVENESS_GUARD_INTERVAL_MS);
|
|
1315
|
+
if (isUnrefable2(this._livenessGuard)) {
|
|
1316
|
+
this._livenessGuard.unref();
|
|
1317
|
+
}
|
|
1301
1318
|
}
|
|
1302
1319
|
_stopLivenessGuard() {
|
|
1303
1320
|
if (this._livenessGuard) {
|
package/dist/index.d.cts
CHANGED
|
@@ -354,7 +354,6 @@ declare class RealtimeConnectionError extends Error {
|
|
|
354
354
|
* Le chien de garde porte sur le `ready`, PAS sur le premier battement : mesuré
|
|
355
355
|
* en Chromium réel, le démarrage d'un Worker peut dépasser 1,5 intervalle quand
|
|
356
356
|
* l'intervalle est court, ce qui faisait abandonner à tort un Worker
|
|
357
|
-
* parfaitement sain — et perdre silencieusement l'immunité au throttling, la
|
|
358
357
|
* seule raison d'être de ce Worker.
|
|
359
358
|
*/
|
|
360
359
|
declare class HeartbeatManager {
|
package/dist/index.d.ts
CHANGED
|
@@ -354,7 +354,6 @@ declare class RealtimeConnectionError extends Error {
|
|
|
354
354
|
* Le chien de garde porte sur le `ready`, PAS sur le premier battement : mesuré
|
|
355
355
|
* en Chromium réel, le démarrage d'un Worker peut dépasser 1,5 intervalle quand
|
|
356
356
|
* l'intervalle est court, ce qui faisait abandonner à tort un Worker
|
|
357
|
-
* parfaitement sain — et perdre silencieusement l'immunité au throttling, la
|
|
358
357
|
* seule raison d'être de ce Worker.
|
|
359
358
|
*/
|
|
360
359
|
declare class HeartbeatManager {
|
package/dist/index.js
CHANGED
|
@@ -307,6 +307,11 @@ var AuraChannel = class {
|
|
|
307
307
|
* Retourne une fonction de désabonnement direct `() => void` qui proxy également l'instance du canal pour le chaînage fluide.
|
|
308
308
|
*/
|
|
309
309
|
on(type, filter, callback) {
|
|
310
|
+
if (type !== "postgres_changes" && type !== "broadcast" && type !== "presence") {
|
|
311
|
+
throw new TypeError(
|
|
312
|
+
`[aurabase] channel.on(): unknown listen type "${String(type)}". For table changes use .on('postgres_changes', { event: 'INSERT', schema: 'public', table: '<table>' }, callback); other types: 'broadcast', 'presence'.`
|
|
313
|
+
);
|
|
314
|
+
}
|
|
310
315
|
const id = ++this._listenerIdCounter;
|
|
311
316
|
this._listeners.push({
|
|
312
317
|
id,
|
|
@@ -890,6 +895,9 @@ var RealtimeConnectionError = class _RealtimeConnectionError extends Error {
|
|
|
890
895
|
};
|
|
891
896
|
|
|
892
897
|
// src/HeartbeatManager.ts
|
|
898
|
+
function isUnrefable(value) {
|
|
899
|
+
return typeof value === "object" && value !== null && "unref" in value && typeof value.unref === "function";
|
|
900
|
+
}
|
|
893
901
|
var HeartbeatManager = class _HeartbeatManager {
|
|
894
902
|
_worker = null;
|
|
895
903
|
_workerUrl = null;
|
|
@@ -960,6 +968,9 @@ var HeartbeatManager = class _HeartbeatManager {
|
|
|
960
968
|
this._interval = setInterval(() => {
|
|
961
969
|
this._sendFn?.();
|
|
962
970
|
}, intervalMs);
|
|
971
|
+
if (isUnrefable(this._interval)) {
|
|
972
|
+
this._interval.unref();
|
|
973
|
+
}
|
|
963
974
|
}
|
|
964
975
|
_clearWatchdog() {
|
|
965
976
|
if (this._watchdog) {
|
|
@@ -1042,6 +1053,9 @@ function getTokenProjectId(token) {
|
|
|
1042
1053
|
var HEARTBEAT_INTERVAL_MS = 25e3;
|
|
1043
1054
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
1044
1055
|
var LIVENESS_GUARD_INTERVAL_MS = 3e4;
|
|
1056
|
+
function isUnrefable2(value) {
|
|
1057
|
+
return typeof value === "object" && value !== null && "unref" in value && typeof value.unref === "function";
|
|
1058
|
+
}
|
|
1045
1059
|
var CANAL_QUALIFIE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}:/;
|
|
1046
1060
|
var LIVENESS_MAX_SILENCE_MS = 9e4;
|
|
1047
1061
|
var RealtimeService = class _RealtimeService {
|
|
@@ -1296,6 +1310,9 @@ var RealtimeService = class _RealtimeService {
|
|
|
1296
1310
|
`Realtime : aucun message du serveur depuis ${Math.round(silence / 1e3)} s alors qu'il en pousse un toutes les 30 s \u2014 connexion consid\xE9r\xE9e morte. Reconnexion.`
|
|
1297
1311
|
);
|
|
1298
1312
|
}, LIVENESS_GUARD_INTERVAL_MS);
|
|
1313
|
+
if (isUnrefable2(this._livenessGuard)) {
|
|
1314
|
+
this._livenessGuard.unref();
|
|
1315
|
+
}
|
|
1299
1316
|
}
|
|
1300
1317
|
_stopLivenessGuard() {
|
|
1301
1318
|
if (this._livenessGuard) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurabase/realtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Service temps réel du SDK Aurabase (postgres_changes, broadcast, presence)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"author": "Aurabase",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "git+https://github.com/
|
|
34
|
+
"url": "git+https://github.com/Aurabase-cloud/Aurabase.git",
|
|
35
35
|
"directory": "aurabase-js/packages/realtime"
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://aurabase.cloud",
|
|
38
38
|
"bugs": {
|
|
39
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/Aurabase-cloud/Aurabase/issues"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"aurabase",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"realtime"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@aurabase/core": "0.6.
|
|
48
|
+
"@aurabase/core": "0.6.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "20.14.15",
|