@sonamu-kit/websocket-redis-adapter 0.12.0 → 0.13.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/cluster-bus.js +2 -3
- package/dist/connection.js +1 -2
- package/dist/deadline.js +1 -2
- package/dist/index.js +1 -2
- package/dist/options.js +1 -2
- package/dist/presence-store.js +2 -3
- package/dist/scripts.js +1 -2
- package/package.json +22 -23
package/dist/cluster-bus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withDeadline } from "./deadline.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
3
|
+
// src/cluster-bus.ts
|
|
4
4
|
/**
|
|
5
5
|
* 노드별 pub/sub 채널. 채널에는 client keyPrefix가 붙지 않으므로 어댑터 prefix만으로 앱을 구분한다.
|
|
6
6
|
*/
|
|
@@ -194,7 +194,6 @@ var RedisWebSocketClusterBus = class {
|
|
|
194
194
|
return withDeadline(() => subscriber.unsubscribe(this.channel, this.listener), this.connection.options.commandDeadlineMs);
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
-
|
|
198
|
-
export { RedisWebSocketClusterBus };
|
|
197
|
+
export { RedisWebSocketClusterBus, nodeChannelOf, parseClusterEnvelope };
|
|
199
198
|
|
|
200
199
|
//# sourceMappingURL=cluster-bus.js.map
|
package/dist/connection.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RedisWebSocketDeadlineError, withDeadline } from "./deadline.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { createClient } from "redis";
|
|
4
|
-
|
|
4
|
+
// src/connection.ts
|
|
5
5
|
function isSentinelInput(input) {
|
|
6
6
|
return "getMasterNode" in input;
|
|
7
7
|
}
|
|
@@ -310,7 +310,6 @@ var RedisWebSocketConnection = class {
|
|
|
310
310
|
return loading;
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
|
-
//#endregion
|
|
314
313
|
export { RedisWebSocketConnection };
|
|
315
314
|
|
|
316
315
|
//# sourceMappingURL=connection.js.map
|
package/dist/deadline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/deadline.ts
|
|
2
2
|
var RedisWebSocketDeadlineError = class extends Error {
|
|
3
3
|
name = "RedisWebSocketDeadlineError";
|
|
4
4
|
constructor(deadlineMs) {
|
|
@@ -25,7 +25,6 @@ function withDeadline(operation, deadlineMs) {
|
|
|
25
25
|
clearTimeout(timer);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { RedisWebSocketDeadlineError, withDeadline };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=deadline.js.map
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { RedisWebSocketClusterBus } from "./cluster-bus.js";
|
|
|
3
3
|
import { RedisWebSocketConnection } from "./connection.js";
|
|
4
4
|
import { REDIS_WEBSOCKET_ADAPTER_DEFAULTS, resolveAdapterOptions } from "./options.js";
|
|
5
5
|
import { RedisWebSocketPresenceStore } from "./presence-store.js";
|
|
6
|
-
|
|
6
|
+
// src/index.ts
|
|
7
7
|
/**
|
|
8
8
|
* Redis presence store와 cluster bus를 만든다. 결과를 WebSocket 런타임 옵션에 그대로 펼쳐 넣으면
|
|
9
9
|
* runtime, store, bus가 같은 nodeId를 쓴다.
|
|
@@ -26,7 +26,6 @@ function createRedisWebSocketAdapter(options) {
|
|
|
26
26
|
clusterBus: new RedisWebSocketClusterBus(connection)
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { REDIS_WEBSOCKET_ADAPTER_DEFAULTS, RedisWebSocketClusterBus, RedisWebSocketDeadlineError, RedisWebSocketPresenceStore, createRedisWebSocketAdapter };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=index.js.map
|
package/dist/options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createWebSocketNodeId } from "sonamu";
|
|
2
|
-
|
|
2
|
+
// src/options.ts
|
|
3
3
|
const REDIS_WEBSOCKET_ADAPTER_DEFAULTS = {
|
|
4
4
|
prefix: "sonamu:ws",
|
|
5
5
|
heartbeatIntervalMs: 5e3,
|
|
@@ -35,7 +35,6 @@ function resolveAdapterOptions(options) {
|
|
|
35
35
|
}
|
|
36
36
|
return resolved;
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { REDIS_WEBSOCKET_ADAPTER_DEFAULTS, resolveAdapterOptions };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=options.js.map
|
package/dist/presence-store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APPLY_SESSION_SCRIPT, COUNT_AUDIENCE_SCRIPT, REBUILD_NODE_SCRIPT } from "./scripts.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { parseWebSocketSessionNodeId } from "sonamu";
|
|
4
|
-
|
|
4
|
+
// src/presence-store.ts
|
|
5
5
|
const REBUILD_DEBOUNCE_MS = 200;
|
|
6
6
|
/**
|
|
7
7
|
* 노드별 키는 해시태그 `{nodeId}`를 공유해 Redis Cluster에서도 한 slot에 놓인다.
|
|
@@ -444,7 +444,6 @@ var RedisWebSocketPresenceStore = class {
|
|
|
444
444
|
return promise;
|
|
445
445
|
}
|
|
446
446
|
};
|
|
447
|
-
|
|
448
|
-
export { RedisWebSocketPresenceStore };
|
|
447
|
+
export { RedisWebSocketPresenceStore, nodeKeysOf };
|
|
449
448
|
|
|
450
449
|
//# sourceMappingURL=presence-store.js.map
|
package/dist/scripts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
2
|
+
// src/scripts.ts
|
|
3
3
|
function defineScript(name, source) {
|
|
4
4
|
return {
|
|
5
5
|
name,
|
|
@@ -175,7 +175,6 @@ for _, leaf in ipairs(leaves) do
|
|
|
175
175
|
end
|
|
176
176
|
return total
|
|
177
177
|
`);
|
|
178
|
-
//#endregion
|
|
179
178
|
export { APPLY_SESSION_SCRIPT, COUNT_AUDIENCE_SCRIPT, REBUILD_NODE_SCRIPT };
|
|
180
179
|
|
|
181
180
|
//# sourceMappingURL=scripts.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonamu-kit/websocket-redis-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Redis presence store and cluster bus for Sonamu multi-node WebSocket delivery",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "CartaNova <dev@cartanova.ai>",
|
|
@@ -24,35 +24,34 @@
|
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsdown && tsc --emitDeclarationOnly",
|
|
29
|
-
"prepack": "pnpm run build",
|
|
30
|
-
"typecheck": "pnpm run check:type",
|
|
31
|
-
"check": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json && tsc -p tsconfig.tools.json && oxlint src tests && oxfmt --check src tests *.json *.ts",
|
|
32
|
-
"check:type": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json && tsc -p tsconfig.tools.json",
|
|
33
|
-
"check:format": "oxfmt src tests *.json *.ts",
|
|
34
|
-
"test": "vitest run --passWithNoTests",
|
|
35
|
-
"test:watch": "vitest watch"
|
|
36
|
-
},
|
|
37
27
|
"dependencies": {
|
|
38
|
-
"zod": "
|
|
28
|
+
"zod": "^4.6.7"
|
|
39
29
|
},
|
|
40
30
|
"devDependencies": {
|
|
41
|
-
"@types/node": "
|
|
42
|
-
"oxfmt": "
|
|
43
|
-
"oxlint": "
|
|
44
|
-
"redis": "
|
|
45
|
-
"sonamu": "
|
|
46
|
-
"testcontainers": "
|
|
47
|
-
"tsdown": "
|
|
48
|
-
"typescript": "
|
|
49
|
-
"vitest": "
|
|
31
|
+
"@types/node": "26.6.5",
|
|
32
|
+
"oxfmt": "^0.74.0",
|
|
33
|
+
"oxlint": "1.89.0",
|
|
34
|
+
"redis": "^6.3.0",
|
|
35
|
+
"sonamu": "0.13.0",
|
|
36
|
+
"testcontainers": "^12.0.0",
|
|
37
|
+
"tsdown": "^0.23.1",
|
|
38
|
+
"typescript": "7.1.0-dev.20260831.1",
|
|
39
|
+
"vitest": "^5.0.5"
|
|
50
40
|
},
|
|
51
41
|
"peerDependencies": {
|
|
52
|
-
"redis": "
|
|
42
|
+
"redis": "^6.3.0",
|
|
53
43
|
"sonamu": ">=0.12.0"
|
|
54
44
|
},
|
|
55
45
|
"engines": {
|
|
56
46
|
"node": ">=22.0.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsdown && tsc --emitDeclarationOnly",
|
|
50
|
+
"typecheck": "pnpm run check:type",
|
|
51
|
+
"check": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json && tsc -p tsconfig.tools.json && oxlint src tests && oxfmt --check src tests *.json *.ts",
|
|
52
|
+
"check:type": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json && tsc -p tsconfig.tools.json",
|
|
53
|
+
"check:format": "oxfmt src tests *.json *.ts",
|
|
54
|
+
"test": "vitest run --passWithNoTests",
|
|
55
|
+
"test:watch": "vitest watch"
|
|
57
56
|
}
|
|
58
|
-
}
|
|
57
|
+
}
|