redux-cluster 2.0.18 → 2.0.20
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/cjs/core/backup.js +5 -5
- package/dist/cjs/core/redux-cluster.js +35 -35
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/network/client.js +11 -11
- package/dist/cjs/network/server.js +19 -19
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/utils/crypto.js +6 -6
- package/dist/esm/core/backup.js +2 -2
- package/dist/esm/core/redux-cluster.js +5 -5
- package/dist/esm/index.js +3 -3
- package/dist/esm/network/client.js +2 -2
- package/dist/esm/network/server.js +2 -2
- package/dist/esm/package.json +1 -0
- package/dist/esm/utils/crypto.js +1 -1
- package/dist/types/core/backup.d.ts +1 -1
- package/dist/types/core/backup.d.ts.map +1 -1
- package/dist/types/core/redux-cluster.d.ts +3 -3
- package/dist/types/core/redux-cluster.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/network/client.d.ts +1 -1
- package/dist/types/network/client.d.ts.map +1 -1
- package/dist/types/network/server.d.ts +1 -1
- package/dist/types/network/server.d.ts.map +1 -1
- package/dist/types/utils/crypto.d.ts +1 -1
- package/dist/types/utils/crypto.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/core/backup.js
CHANGED
|
@@ -35,8 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.BackupManager = void 0;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const index_js_1 = require("../types/index.js");
|
|
39
|
+
const crypto_js_1 = require("../utils/crypto.js");
|
|
40
40
|
class BackupManager {
|
|
41
41
|
constructor(store, settings) {
|
|
42
42
|
this.store = store;
|
|
@@ -67,7 +67,7 @@ class BackupManager {
|
|
|
67
67
|
let content = data.toString();
|
|
68
68
|
// Decrypt if key is provided
|
|
69
69
|
if (this.settings.key) {
|
|
70
|
-
content = (0,
|
|
70
|
+
content = (0, crypto_js_1.decrypter)(content, this.settings.key);
|
|
71
71
|
}
|
|
72
72
|
const state = JSON.parse(content);
|
|
73
73
|
// Restore state using internal method
|
|
@@ -80,7 +80,7 @@ class BackupManager {
|
|
|
80
80
|
if ("dispatchNEW" in this.store &&
|
|
81
81
|
typeof this.store.dispatchNEW === "function") {
|
|
82
82
|
this.store.dispatchNEW({
|
|
83
|
-
type:
|
|
83
|
+
type: index_js_1.MessageType.SYNC,
|
|
84
84
|
payload: state,
|
|
85
85
|
_internal: true,
|
|
86
86
|
});
|
|
@@ -132,7 +132,7 @@ class BackupInstance {
|
|
|
132
132
|
let content = JSON.stringify(this.store.getState());
|
|
133
133
|
// Encrypt if key is provided
|
|
134
134
|
if (this.settings.key) {
|
|
135
|
-
content = (0,
|
|
135
|
+
content = (0, crypto_js_1.encrypter)(content, this.settings.key);
|
|
136
136
|
}
|
|
137
137
|
this.writeToFile(content, callback);
|
|
138
138
|
}
|
|
@@ -8,11 +8,11 @@ const redux_1 = require("redux");
|
|
|
8
8
|
const cluster_1 = __importDefault(require("cluster"));
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const path_1 = require("path");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
11
|
+
const crypto_js_1 = require("../utils/crypto.js");
|
|
12
|
+
const index_js_1 = require("../types/index.js");
|
|
13
|
+
const server_js_1 = require("../network/server.js");
|
|
14
|
+
const client_js_1 = require("../network/client.js");
|
|
15
|
+
const backup_js_1 = require("./backup.js");
|
|
16
16
|
// Global reducers registry to prevent name conflicts
|
|
17
17
|
const reducers = {};
|
|
18
18
|
class ReduxCluster {
|
|
@@ -23,12 +23,12 @@ class ReduxCluster {
|
|
|
23
23
|
this.resync = 1000;
|
|
24
24
|
this.stderr = console.error;
|
|
25
25
|
this.allsock = {};
|
|
26
|
-
this.classRegistry = (0,
|
|
26
|
+
this.classRegistry = (0, crypto_js_1.createClassRegistry)();
|
|
27
27
|
this.altReducer = reducer;
|
|
28
|
-
this.RCHash = (0,
|
|
28
|
+
this.RCHash = (0, crypto_js_1.hasher)(reducer.name) || "";
|
|
29
29
|
// Set configuration with defaults
|
|
30
30
|
this.config = {
|
|
31
|
-
serializationMode:
|
|
31
|
+
serializationMode: index_js_1.SerializationMode.JSON,
|
|
32
32
|
debug: false,
|
|
33
33
|
...config,
|
|
34
34
|
};
|
|
@@ -42,8 +42,8 @@ class ReduxCluster {
|
|
|
42
42
|
if (config.resync)
|
|
43
43
|
this.resync = config.resync;
|
|
44
44
|
// Initialize class registry only if ProtoObject mode is enabled
|
|
45
|
-
if (this.config.serializationMode ===
|
|
46
|
-
this.classRegistry = (0,
|
|
45
|
+
if (this.config.serializationMode === index_js_1.SerializationMode.PROTOOBJECT) {
|
|
46
|
+
this.classRegistry = (0, crypto_js_1.createClassRegistry)();
|
|
47
47
|
}
|
|
48
48
|
// Load package info
|
|
49
49
|
try {
|
|
@@ -96,7 +96,7 @@ class ReduxCluster {
|
|
|
96
96
|
// Internal method for sync actions
|
|
97
97
|
internalSync(payload) {
|
|
98
98
|
this.store.dispatch({
|
|
99
|
-
type:
|
|
99
|
+
type: index_js_1.MessageType.SYNC,
|
|
100
100
|
payload,
|
|
101
101
|
_internal: true,
|
|
102
102
|
});
|
|
@@ -108,11 +108,11 @@ class ReduxCluster {
|
|
|
108
108
|
createNewReducer() {
|
|
109
109
|
return (state = this.defaultState, action) => {
|
|
110
110
|
// Handle sync action (internal use only)
|
|
111
|
-
if (action.type ===
|
|
111
|
+
if (action.type === index_js_1.MessageType.SYNC) {
|
|
112
112
|
// Check if this is an internal sync call
|
|
113
113
|
const syncAction = action;
|
|
114
114
|
if (syncAction._internal) {
|
|
115
|
-
return (0,
|
|
115
|
+
return (0, crypto_js_1.universalClone)(syncAction.payload, this.config.serializationMode, this.classRegistry);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
118
|
throw new Error("Please don't use REDUX_CLUSTER_SYNC action type!");
|
|
@@ -146,14 +146,14 @@ class ReduxCluster {
|
|
|
146
146
|
sendActionsToNodes(action) {
|
|
147
147
|
if (this.role.includes("master")) {
|
|
148
148
|
setTimeout(() => this.sendtoall({
|
|
149
|
-
_msg:
|
|
149
|
+
_msg: index_js_1.MessageType.MSG_TO_WORKER,
|
|
150
150
|
_hash: this.RCHash,
|
|
151
151
|
_action: action,
|
|
152
152
|
}), 1);
|
|
153
153
|
}
|
|
154
154
|
if (this.role.includes("server")) {
|
|
155
155
|
setTimeout(() => this.sendtoallsock({
|
|
156
|
-
_msg:
|
|
156
|
+
_msg: index_js_1.MessageType.MSG_TO_WORKER,
|
|
157
157
|
_hash: this.RCHash,
|
|
158
158
|
_action: action,
|
|
159
159
|
}), 1);
|
|
@@ -199,7 +199,7 @@ class ReduxCluster {
|
|
|
199
199
|
this.dispatch = (action) => {
|
|
200
200
|
if (process.send) {
|
|
201
201
|
process.send({
|
|
202
|
-
_msg:
|
|
202
|
+
_msg: index_js_1.MessageType.MSG_TO_MASTER,
|
|
203
203
|
_hash: this.RCHash,
|
|
204
204
|
_action: action,
|
|
205
205
|
});
|
|
@@ -213,7 +213,7 @@ class ReduxCluster {
|
|
|
213
213
|
// Request initial state
|
|
214
214
|
if (process.send) {
|
|
215
215
|
process.send({
|
|
216
|
-
_msg:
|
|
216
|
+
_msg: index_js_1.MessageType.START,
|
|
217
217
|
_hash: this.RCHash,
|
|
218
218
|
});
|
|
219
219
|
}
|
|
@@ -221,8 +221,8 @@ class ReduxCluster {
|
|
|
221
221
|
handleMasterMessage(message, worker) {
|
|
222
222
|
if (message._hash === this.RCHash) {
|
|
223
223
|
switch (message._msg) {
|
|
224
|
-
case
|
|
225
|
-
if (message._action.type ===
|
|
224
|
+
case index_js_1.MessageType.MSG_TO_MASTER:
|
|
225
|
+
if (message._action.type === index_js_1.MessageType.SYNC &&
|
|
226
226
|
!message._action._internal) {
|
|
227
227
|
throw new Error("Please don't use REDUX_CLUSTER_SYNC action type!");
|
|
228
228
|
}
|
|
@@ -230,7 +230,7 @@ class ReduxCluster {
|
|
|
230
230
|
let action = message._action;
|
|
231
231
|
if (message._serialized) {
|
|
232
232
|
try {
|
|
233
|
-
action = (0,
|
|
233
|
+
action = (0, crypto_js_1.universalDeserialize)(message._serialized, this.config.serializationMode, this.classRegistry)._action;
|
|
234
234
|
}
|
|
235
235
|
catch {
|
|
236
236
|
// Fallback to regular action
|
|
@@ -239,19 +239,19 @@ class ReduxCluster {
|
|
|
239
239
|
}
|
|
240
240
|
this.store.dispatch(action);
|
|
241
241
|
break;
|
|
242
|
-
case
|
|
242
|
+
case index_js_1.MessageType.START:
|
|
243
243
|
const responseMsg = {
|
|
244
|
-
_msg:
|
|
244
|
+
_msg: index_js_1.MessageType.MSG_TO_WORKER,
|
|
245
245
|
_hash: this.RCHash,
|
|
246
246
|
_action: {
|
|
247
|
-
type:
|
|
247
|
+
type: index_js_1.MessageType.SYNC,
|
|
248
248
|
payload: this.getState(),
|
|
249
249
|
_internal: true,
|
|
250
250
|
},
|
|
251
251
|
};
|
|
252
252
|
const serializedResponse = {
|
|
253
253
|
...responseMsg,
|
|
254
|
-
_serialized: (0,
|
|
254
|
+
_serialized: (0, crypto_js_1.universalSerialize)(responseMsg, this.config.serializationMode, this.classRegistry),
|
|
255
255
|
};
|
|
256
256
|
if (worker && cluster_1.default.workers && cluster_1.default.workers[worker.id]) {
|
|
257
257
|
cluster_1.default.workers[worker.id].send(serializedResponse);
|
|
@@ -273,7 +273,7 @@ class ReduxCluster {
|
|
|
273
273
|
if (data._serialized) {
|
|
274
274
|
try {
|
|
275
275
|
processedData = JSON.parse(data._serialized);
|
|
276
|
-
processedData = (0,
|
|
276
|
+
processedData = (0, crypto_js_1.universalDeserialize)(data._serialized, this.config.serializationMode, this.classRegistry);
|
|
277
277
|
}
|
|
278
278
|
catch {
|
|
279
279
|
// Fallback to regular data if deserialization fails
|
|
@@ -281,12 +281,12 @@ class ReduxCluster {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
switch (processedData._msg) {
|
|
284
|
-
case
|
|
284
|
+
case index_js_1.MessageType.MSG_TO_WORKER:
|
|
285
285
|
if (this.dispatchNEW) {
|
|
286
286
|
this.dispatchNEW(processedData._action);
|
|
287
287
|
}
|
|
288
288
|
break;
|
|
289
|
-
case
|
|
289
|
+
case index_js_1.MessageType.CONN_STATUS:
|
|
290
290
|
this.connected = processedData._connected;
|
|
291
291
|
break;
|
|
292
292
|
default:
|
|
@@ -298,10 +298,10 @@ class ReduxCluster {
|
|
|
298
298
|
sendtoall(message) {
|
|
299
299
|
if (cluster_1.default.isPrimary && cluster_1.default.workers) {
|
|
300
300
|
const msg = message || {
|
|
301
|
-
_msg:
|
|
301
|
+
_msg: index_js_1.MessageType.MSG_TO_WORKER,
|
|
302
302
|
_hash: this.RCHash,
|
|
303
303
|
_action: {
|
|
304
|
-
type:
|
|
304
|
+
type: index_js_1.MessageType.SYNC,
|
|
305
305
|
payload: this.getState(),
|
|
306
306
|
_internal: true,
|
|
307
307
|
},
|
|
@@ -309,7 +309,7 @@ class ReduxCluster {
|
|
|
309
309
|
// Serialize ProtoObject instances for IPC
|
|
310
310
|
const serializedMsg = {
|
|
311
311
|
...msg,
|
|
312
|
-
_serialized: (0,
|
|
312
|
+
_serialized: (0, crypto_js_1.universalSerialize)(msg, this.config.serializationMode, this.classRegistry),
|
|
313
313
|
};
|
|
314
314
|
for (const id in cluster_1.default.workers) {
|
|
315
315
|
if (cluster_1.default.workers[id]) {
|
|
@@ -334,7 +334,7 @@ class ReduxCluster {
|
|
|
334
334
|
this.role.push("server");
|
|
335
335
|
}
|
|
336
336
|
this.connected = false;
|
|
337
|
-
return new
|
|
337
|
+
return new server_js_1.ClusterServer(this, settings);
|
|
338
338
|
}
|
|
339
339
|
createClient(settings) {
|
|
340
340
|
if (this.role.includes("client")) {
|
|
@@ -344,14 +344,14 @@ class ReduxCluster {
|
|
|
344
344
|
this.role.push("client");
|
|
345
345
|
}
|
|
346
346
|
this.connected = false;
|
|
347
|
-
return new
|
|
347
|
+
return new client_js_1.ClusterClient(this, settings);
|
|
348
348
|
}
|
|
349
349
|
backup(settings) {
|
|
350
|
-
return new
|
|
350
|
+
return new backup_js_1.BackupManager(this, settings).initialize();
|
|
351
351
|
}
|
|
352
352
|
// Register custom ProtoObject classes for proper serialization
|
|
353
353
|
registerClass(name, classConstructor) {
|
|
354
|
-
if (this.config.serializationMode ===
|
|
354
|
+
if (this.config.serializationMode === index_js_1.SerializationMode.PROTOOBJECT) {
|
|
355
355
|
this.classRegistry.set(name, classConstructor);
|
|
356
356
|
}
|
|
357
357
|
else {
|
|
@@ -360,7 +360,7 @@ class ReduxCluster {
|
|
|
360
360
|
}
|
|
361
361
|
// Get registered classes (useful for debugging)
|
|
362
362
|
getRegisteredClasses() {
|
|
363
|
-
if (this.config.serializationMode ===
|
|
363
|
+
if (this.config.serializationMode === index_js_1.SerializationMode.PROTOOBJECT) {
|
|
364
364
|
return Array.from(this.classRegistry.keys());
|
|
365
365
|
}
|
|
366
366
|
return [];
|
package/dist/cjs/index.js
CHANGED
|
@@ -17,19 +17,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.functions = void 0;
|
|
18
18
|
exports.createStore = createStore;
|
|
19
19
|
const redux_1 = require("redux");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const redux_cluster_js_1 = require("./core/redux-cluster.js");
|
|
21
|
+
const crypto_js_1 = require("./utils/crypto.js");
|
|
22
22
|
// Re-export Redux functions and types
|
|
23
23
|
__exportStar(require("redux"), exports);
|
|
24
24
|
// Export our types
|
|
25
|
-
__exportStar(require("./types"), exports);
|
|
25
|
+
__exportStar(require("./types/index.js"), exports);
|
|
26
26
|
// Export utility functions
|
|
27
27
|
exports.functions = {
|
|
28
|
-
hasher:
|
|
28
|
+
hasher: crypto_js_1.hasher,
|
|
29
29
|
};
|
|
30
30
|
// Main function to create a ReduxCluster store
|
|
31
31
|
function createStore(reducer, config) {
|
|
32
|
-
return new
|
|
32
|
+
return new redux_cluster_js_1.ReduxCluster(reducer, config);
|
|
33
33
|
}
|
|
34
34
|
// Default export for CommonJS compatibility
|
|
35
35
|
exports.default = {
|
|
@@ -39,8 +39,8 @@ const os = __importStar(require("os"));
|
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
40
|
const zlib = __importStar(require("zlib"));
|
|
41
41
|
const stream = __importStar(require("stream"));
|
|
42
|
-
const
|
|
43
|
-
const
|
|
42
|
+
const index_js_1 = require("../types/index.js");
|
|
43
|
+
const crypto_js_1 = require("../utils/crypto.js");
|
|
44
44
|
class ClusterClient {
|
|
45
45
|
constructor(store, settings = {}) {
|
|
46
46
|
this.store = store;
|
|
@@ -52,10 +52,10 @@ class ClusterClient {
|
|
|
52
52
|
}
|
|
53
53
|
setupCredentials() {
|
|
54
54
|
if (typeof this.settings.login === "string") {
|
|
55
|
-
this.login = (0,
|
|
55
|
+
this.login = (0, crypto_js_1.hasher)(`REDUX_CLUSTER${this.settings.login}`);
|
|
56
56
|
}
|
|
57
57
|
if (typeof this.settings.password === "string") {
|
|
58
|
-
this.password = (0,
|
|
58
|
+
this.password = (0, crypto_js_1.hasher)(`REDUX_CLUSTER${this.settings.password}`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
setupConnection() {
|
|
@@ -97,7 +97,7 @@ class ClusterClient {
|
|
|
97
97
|
handleConnection() {
|
|
98
98
|
this.store.connected = true;
|
|
99
99
|
this.store.sendtoall({
|
|
100
|
-
_msg:
|
|
100
|
+
_msg: index_js_1.MessageType.CONN_STATUS,
|
|
101
101
|
_hash: this.store.RCHash,
|
|
102
102
|
_connected: true,
|
|
103
103
|
});
|
|
@@ -120,14 +120,14 @@ class ClusterClient {
|
|
|
120
120
|
// Override dispatch to send actions to server
|
|
121
121
|
this.store.dispatch = (action) => {
|
|
122
122
|
this.client.write({
|
|
123
|
-
_msg:
|
|
123
|
+
_msg: index_js_1.MessageType.MSG_TO_MASTER,
|
|
124
124
|
_hash: this.store.RCHash,
|
|
125
125
|
_action: action,
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
// Authenticate with server
|
|
129
129
|
this.client.write({
|
|
130
|
-
_msg:
|
|
130
|
+
_msg: index_js_1.MessageType.SOCKET_AUTH,
|
|
131
131
|
_hash: this.store.RCHash,
|
|
132
132
|
_login: this.login,
|
|
133
133
|
_password: this.password,
|
|
@@ -136,7 +136,7 @@ class ClusterClient {
|
|
|
136
136
|
handleDisconnection() {
|
|
137
137
|
this.store.connected = false;
|
|
138
138
|
this.store.sendtoall({
|
|
139
|
-
_msg:
|
|
139
|
+
_msg: index_js_1.MessageType.CONN_STATUS,
|
|
140
140
|
_hash: this.store.RCHash,
|
|
141
141
|
_connected: false,
|
|
142
142
|
});
|
|
@@ -192,7 +192,7 @@ class ClusterClient {
|
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
switch (data._msg) {
|
|
195
|
-
case
|
|
195
|
+
case index_js_1.MessageType.MSG_TO_WORKER:
|
|
196
196
|
// Always use dispatchNEW (original dispatch) for local state updates
|
|
197
197
|
// because the regular dispatch is overridden to send to server
|
|
198
198
|
if (this.store.dispatchNEW) {
|
|
@@ -207,11 +207,11 @@ class ClusterClient {
|
|
|
207
207
|
this.store.stderr("dispatchNEW method not available");
|
|
208
208
|
}
|
|
209
209
|
break;
|
|
210
|
-
case
|
|
210
|
+
case index_js_1.MessageType.SOCKET_AUTH_STATE:
|
|
211
211
|
if (data._value === true) {
|
|
212
212
|
// Authentication successful, request initial state
|
|
213
213
|
this.client.write({
|
|
214
|
-
_msg:
|
|
214
|
+
_msg: index_js_1.MessageType.START,
|
|
215
215
|
_hash: this.store.RCHash,
|
|
216
216
|
});
|
|
217
217
|
}
|
|
@@ -41,8 +41,8 @@ const fs = __importStar(require("fs"));
|
|
|
41
41
|
const zlib = __importStar(require("zlib"));
|
|
42
42
|
const stream = __importStar(require("stream"));
|
|
43
43
|
const crypto = __importStar(require("crypto"));
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const index_js_1 = require("../types/index.js");
|
|
45
|
+
const crypto_js_1 = require("../utils/crypto.js");
|
|
46
46
|
class ClusterServer {
|
|
47
47
|
constructor(store, settings = {}) {
|
|
48
48
|
this.store = store;
|
|
@@ -64,8 +64,8 @@ class ClusterServer {
|
|
|
64
64
|
setupDatabase() {
|
|
65
65
|
if (this.settings.logins) {
|
|
66
66
|
for (const login in this.settings.logins) {
|
|
67
|
-
const hashedLogin = (0,
|
|
68
|
-
const hashedPassword = (0,
|
|
67
|
+
const hashedLogin = (0, crypto_js_1.hasher)(`REDUX_CLUSTER${login}`);
|
|
68
|
+
const hashedPassword = (0, crypto_js_1.hasher)(`REDUX_CLUSTER${this.settings.logins[login]}`);
|
|
69
69
|
if (hashedLogin && hashedPassword) {
|
|
70
70
|
this.database[hashedLogin] = hashedPassword;
|
|
71
71
|
}
|
|
@@ -91,7 +91,7 @@ class ClusterServer {
|
|
|
91
91
|
this.server.on("listening", () => {
|
|
92
92
|
this.store.connected = true;
|
|
93
93
|
this.store.sendtoall({
|
|
94
|
-
_msg:
|
|
94
|
+
_msg: index_js_1.MessageType.CONN_STATUS,
|
|
95
95
|
_hash: this.store.RCHash,
|
|
96
96
|
_connected: true,
|
|
97
97
|
});
|
|
@@ -99,7 +99,7 @@ class ClusterServer {
|
|
|
99
99
|
this.server.on("close", () => {
|
|
100
100
|
this.store.connected = false;
|
|
101
101
|
this.store.sendtoall({
|
|
102
|
-
_msg:
|
|
102
|
+
_msg: index_js_1.MessageType.CONN_STATUS,
|
|
103
103
|
_hash: this.store.RCHash,
|
|
104
104
|
_connected: false,
|
|
105
105
|
});
|
|
@@ -155,7 +155,7 @@ class ClusterServer {
|
|
|
155
155
|
}
|
|
156
156
|
handleNewConnection(socket) {
|
|
157
157
|
// Hash IP address for security using hasher function
|
|
158
|
-
const clientIP = socket.remoteAddress ? (0,
|
|
158
|
+
const clientIP = socket.remoteAddress ? (0, crypto_js_1.hasher)(socket.remoteAddress) : "";
|
|
159
159
|
const uid = crypto.randomUUID();
|
|
160
160
|
const clusterSocket = socket;
|
|
161
161
|
clusterSocket.uid = uid;
|
|
@@ -176,7 +176,7 @@ class ClusterServer {
|
|
|
176
176
|
rejectConnection(socket, banned = false) {
|
|
177
177
|
// Create rejection message
|
|
178
178
|
const rejectionMessage = {
|
|
179
|
-
_msg:
|
|
179
|
+
_msg: index_js_1.MessageType.SOCKET_AUTH_STATE,
|
|
180
180
|
_hash: this.store.RCHash,
|
|
181
181
|
_value: false,
|
|
182
182
|
...(banned && { _banned: true }),
|
|
@@ -256,9 +256,9 @@ class ClusterServer {
|
|
|
256
256
|
if (data._hash !== this.store.RCHash)
|
|
257
257
|
return;
|
|
258
258
|
switch (data._msg) {
|
|
259
|
-
case
|
|
259
|
+
case index_js_1.MessageType.MSG_TO_MASTER:
|
|
260
260
|
if (this.sockets[socket.uid]) {
|
|
261
|
-
if (data._action.type ===
|
|
261
|
+
if (data._action.type === index_js_1.MessageType.SYNC &&
|
|
262
262
|
!data._action._internal) {
|
|
263
263
|
throw new Error("Please don't use REDUX_CLUSTER_SYNC action type!");
|
|
264
264
|
}
|
|
@@ -267,20 +267,20 @@ class ClusterServer {
|
|
|
267
267
|
this.store.dispatch(data._action);
|
|
268
268
|
}
|
|
269
269
|
break;
|
|
270
|
-
case
|
|
270
|
+
case index_js_1.MessageType.START:
|
|
271
271
|
if (this.sockets[socket.uid]) {
|
|
272
272
|
socket.write({
|
|
273
|
-
_msg:
|
|
273
|
+
_msg: index_js_1.MessageType.MSG_TO_WORKER,
|
|
274
274
|
_hash: this.store.RCHash,
|
|
275
275
|
_action: {
|
|
276
|
-
type:
|
|
276
|
+
type: index_js_1.MessageType.SYNC,
|
|
277
277
|
payload: this.store.getState(),
|
|
278
278
|
_internal: true,
|
|
279
279
|
},
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
break;
|
|
283
|
-
case
|
|
283
|
+
case index_js_1.MessageType.SOCKET_AUTH:
|
|
284
284
|
this.handleAuthentication(data, socket, clientIP);
|
|
285
285
|
break;
|
|
286
286
|
default:
|
|
@@ -295,7 +295,7 @@ class ClusterServer {
|
|
|
295
295
|
// No authentication required
|
|
296
296
|
this.sockets[socket.uid] = socket;
|
|
297
297
|
socket.write({
|
|
298
|
-
_msg:
|
|
298
|
+
_msg: index_js_1.MessageType.SOCKET_AUTH_STATE,
|
|
299
299
|
_hash: this.store.RCHash,
|
|
300
300
|
_value: true,
|
|
301
301
|
});
|
|
@@ -313,7 +313,7 @@ class ClusterServer {
|
|
|
313
313
|
}
|
|
314
314
|
// Use the custom write method that should be set up by now
|
|
315
315
|
socket.write({
|
|
316
|
-
_msg:
|
|
316
|
+
_msg: index_js_1.MessageType.SOCKET_AUTH_STATE,
|
|
317
317
|
_hash: this.store.RCHash,
|
|
318
318
|
_value: true,
|
|
319
319
|
});
|
|
@@ -325,7 +325,7 @@ class ClusterServer {
|
|
|
325
325
|
}
|
|
326
326
|
// Use the custom write method that should be set up by now
|
|
327
327
|
socket.write({
|
|
328
|
-
_msg:
|
|
328
|
+
_msg: index_js_1.MessageType.SOCKET_AUTH_STATE,
|
|
329
329
|
_hash: this.store.RCHash,
|
|
330
330
|
_value: false,
|
|
331
331
|
});
|
|
@@ -366,10 +366,10 @@ class ClusterServer {
|
|
|
366
366
|
}
|
|
367
367
|
sendtoall(message) {
|
|
368
368
|
const msg = message || {
|
|
369
|
-
_msg:
|
|
369
|
+
_msg: index_js_1.MessageType.MSG_TO_WORKER,
|
|
370
370
|
_hash: this.store.RCHash,
|
|
371
371
|
_action: {
|
|
372
|
-
type:
|
|
372
|
+
type: index_js_1.MessageType.SYNC,
|
|
373
373
|
payload: this.store.getState(),
|
|
374
374
|
_internal: true,
|
|
375
375
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
package/dist/cjs/utils/crypto.js
CHANGED
|
@@ -53,7 +53,7 @@ exports.createDeserializationStream = createDeserializationStream;
|
|
|
53
53
|
exports.createSerializationStream = createSerializationStream;
|
|
54
54
|
const crypto = __importStar(require("crypto"));
|
|
55
55
|
const stream_1 = require("stream");
|
|
56
|
-
const
|
|
56
|
+
const index_js_1 = require("../types/index.js");
|
|
57
57
|
// Import ObjectStream components - optional dependency
|
|
58
58
|
let Stringifer = null;
|
|
59
59
|
let Parser = null;
|
|
@@ -135,7 +135,7 @@ function deepClone(obj) {
|
|
|
135
135
|
}
|
|
136
136
|
// Universal cloning function based on mode
|
|
137
137
|
function universalClone(obj, mode, _classRegistry) {
|
|
138
|
-
if (mode ===
|
|
138
|
+
if (mode === index_js_1.SerializationMode.PROTOOBJECT && isProtoObjectAvailable()) {
|
|
139
139
|
return protoObjectClone(obj);
|
|
140
140
|
}
|
|
141
141
|
return deepClone(obj);
|
|
@@ -178,7 +178,7 @@ function protoObjectClone(obj) {
|
|
|
178
178
|
}
|
|
179
179
|
// Universal serialization function
|
|
180
180
|
function universalSerialize(obj, mode, classRegistry) {
|
|
181
|
-
if (mode ===
|
|
181
|
+
if (mode === index_js_1.SerializationMode.PROTOOBJECT && isProtoObjectAvailable()) {
|
|
182
182
|
return serializeProtoObject(obj, classRegistry);
|
|
183
183
|
}
|
|
184
184
|
// Default JSON serialization
|
|
@@ -186,7 +186,7 @@ function universalSerialize(obj, mode, classRegistry) {
|
|
|
186
186
|
}
|
|
187
187
|
// Universal deserialization function
|
|
188
188
|
function universalDeserialize(str, mode, classRegistry) {
|
|
189
|
-
if (mode ===
|
|
189
|
+
if (mode === index_js_1.SerializationMode.PROTOOBJECT && isProtoObjectAvailable()) {
|
|
190
190
|
return deserializeProtoObject(str, classRegistry);
|
|
191
191
|
}
|
|
192
192
|
// Default JSON deserialization
|
|
@@ -294,7 +294,7 @@ function createDeserializationStream(mode, classRegistry) {
|
|
|
294
294
|
objectMode: true,
|
|
295
295
|
transform(chunk, encoding, callback) {
|
|
296
296
|
try {
|
|
297
|
-
if (mode ===
|
|
297
|
+
if (mode === index_js_1.SerializationMode.PROTOOBJECT &&
|
|
298
298
|
isProtoObjectAvailable()) {
|
|
299
299
|
const deserialized = deserializeFromObject(chunk, classRegistry);
|
|
300
300
|
callback(null, deserialized);
|
|
@@ -315,7 +315,7 @@ function createSerializationStream(mode, classRegistry) {
|
|
|
315
315
|
objectMode: true,
|
|
316
316
|
transform(chunk, encoding, callback) {
|
|
317
317
|
try {
|
|
318
|
-
if (mode ===
|
|
318
|
+
if (mode === index_js_1.SerializationMode.PROTOOBJECT &&
|
|
319
319
|
isProtoObjectAvailable()) {
|
|
320
320
|
const serialized = serializeToObject(chunk, classRegistry);
|
|
321
321
|
callback(null, serialized);
|
package/dist/esm/core/backup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
|
-
import { MessageType } from "../types";
|
|
3
|
-
import { encrypter, decrypter } from "../utils/crypto";
|
|
2
|
+
import { MessageType } from "../types/index.js";
|
|
3
|
+
import { encrypter, decrypter } from "../utils/crypto.js";
|
|
4
4
|
export class BackupManager {
|
|
5
5
|
constructor(store, settings) {
|
|
6
6
|
this.store = store;
|
|
@@ -2,11 +2,11 @@ import { createStore } from "redux";
|
|
|
2
2
|
import cluster from "cluster";
|
|
3
3
|
import { readFileSync } from "fs";
|
|
4
4
|
import { join } from "path";
|
|
5
|
-
import { hasher, universalClone, universalSerialize, universalDeserialize, createClassRegistry, } from "../utils/crypto";
|
|
6
|
-
import { MessageType, SerializationMode, } from "../types";
|
|
7
|
-
import { ClusterServer } from "../network/server";
|
|
8
|
-
import { ClusterClient } from "../network/client";
|
|
9
|
-
import { BackupManager } from "./backup";
|
|
5
|
+
import { hasher, universalClone, universalSerialize, universalDeserialize, createClassRegistry, } from "../utils/crypto.js";
|
|
6
|
+
import { MessageType, SerializationMode, } from "../types/index.js";
|
|
7
|
+
import { ClusterServer } from "../network/server.js";
|
|
8
|
+
import { ClusterClient } from "../network/client.js";
|
|
9
|
+
import { BackupManager } from "./backup.js";
|
|
10
10
|
// Global reducers registry to prevent name conflicts
|
|
11
11
|
const reducers = {};
|
|
12
12
|
export class ReduxCluster {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { combineReducers, bindActionCreators, applyMiddleware, compose, } from "redux";
|
|
2
|
-
import { ReduxCluster } from "./core/redux-cluster";
|
|
3
|
-
import { hasher } from "./utils/crypto";
|
|
2
|
+
import { ReduxCluster } from "./core/redux-cluster.js";
|
|
3
|
+
import { hasher } from "./utils/crypto.js";
|
|
4
4
|
// Re-export Redux functions and types
|
|
5
5
|
export * from "redux";
|
|
6
6
|
// Export our types
|
|
7
|
-
export * from "./types";
|
|
7
|
+
export * from "./types/index.js";
|
|
8
8
|
// Export utility functions
|
|
9
9
|
export const functions = {
|
|
10
10
|
hasher,
|
|
@@ -3,8 +3,8 @@ import * as os from "os";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import * as zlib from "zlib";
|
|
5
5
|
import * as stream from "stream";
|
|
6
|
-
import { MessageType } from "../types";
|
|
7
|
-
import { hasher } from "../utils/crypto";
|
|
6
|
+
import { MessageType } from "../types/index.js";
|
|
7
|
+
import { hasher } from "../utils/crypto.js";
|
|
8
8
|
export class ClusterClient {
|
|
9
9
|
constructor(store, settings = {}) {
|
|
10
10
|
this.store = store;
|
|
@@ -5,8 +5,8 @@ import * as fs from "fs";
|
|
|
5
5
|
import * as zlib from "zlib";
|
|
6
6
|
import * as stream from "stream";
|
|
7
7
|
import * as crypto from "crypto";
|
|
8
|
-
import { MessageType, } from "../types";
|
|
9
|
-
import { hasher } from "../utils/crypto";
|
|
8
|
+
import { MessageType, } from "../types/index.js";
|
|
9
|
+
import { hasher } from "../utils/crypto.js";
|
|
10
10
|
export class ClusterServer {
|
|
11
11
|
constructor(store, settings = {}) {
|
|
12
12
|
this.store = store;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/dist/esm/utils/crypto.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
2
|
import { Transform } from "stream";
|
|
3
|
-
import { SerializationMode } from "../types";
|
|
3
|
+
import { SerializationMode } from "../types/index.js";
|
|
4
4
|
// Import ObjectStream components - optional dependency
|
|
5
5
|
let Stringifer = null;
|
|
6
6
|
let Parser = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../../src/core/backup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../../src/core/backup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAe,MAAM,mBAAmB,CAAC;AAGnF,qBAAa,aAAa,CAAC,CAAC,GAAG,GAAG;IAI9B,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IAJlB,OAAO,CAAC,oBAAoB,CAAC,CAAoB;gBAGvC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC3B,QAAQ,EAAE,cAAc;IAGrB,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;YAiB7B,UAAU;CA+CzB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Store, Reducer, Action } from "redux";
|
|
2
|
-
import { ReduxClusterStore, SyncMode, Role, ClusterMessage, ServerSettings, ClientSettings, BackupSettings, ErrorHandler, ReduxClusterConfig } from "../types";
|
|
3
|
-
import { ClusterServer } from "../network/server";
|
|
4
|
-
import { ClusterClient } from "../network/client";
|
|
2
|
+
import { ReduxClusterStore, SyncMode, Role, ClusterMessage, ServerSettings, ClientSettings, BackupSettings, ErrorHandler, ReduxClusterConfig } from "../types/index.js";
|
|
3
|
+
import { ClusterServer } from "../network/server.js";
|
|
4
|
+
import { ClusterClient } from "../network/client.js";
|
|
5
5
|
export declare class ReduxCluster<S = any, A extends Action = Action> implements ReduxClusterStore<S, A> {
|
|
6
6
|
readonly dispatch: Store<S, A>["dispatch"];
|
|
7
7
|
readonly getState: Store<S, A>["getState"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redux-cluster.d.ts","sourceRoot":"","sources":["../../../src/core/redux-cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAW5D,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,cAAc,EAEd,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,kBAAkB,EAEnB,MAAM,
|
|
1
|
+
{"version":3,"file":"redux-cluster.d.ts","sourceRoot":"","sources":["../../../src/core/redux-cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAW5D,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,cAAc,EAEd,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD,qBAAa,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,CAC1D,YAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;IAGlC,SAAgB,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAClD,SAAgB,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAClD,SAAgB,SAAS,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACpD,SAAgB,cAAc,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC9D,SAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC;IAG3E,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,IAAI,EAAE,IAAI,EAAE,CAAM;IAC3B,SAAS,UAAS;IAClB,IAAI,EAAE,QAAQ,CAAY;IAC1B,MAAM,SAAQ;IACd,MAAM,EAAE,YAAY,CAAiB;IAC5C,SAAgB,MAAM,EAAE,kBAAkB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAI;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,WAAW,CAAC,CAA0B;IAC9C,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,aAAa,CAAyB;gBAElC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,GAAE,kBAAuB;IA4EnE,OAAO,CAAC,YAAY;IASb,aAAa,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI;IAItC,OAAO,CAAC,gBAAgB;IA2BxB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,kBAAkB;IA0B1B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,mBAAmB;IA4D3B,OAAO,CAAC,mBAAmB;IAoCpB,SAAS,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IA8BzC,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAW7C,YAAY,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa;IAetD,YAAY,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa;IAetD,MAAM,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAG,IAAI;IASxD,oBAAoB,IAAI,MAAM,EAAE;CAMxC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Reducer, Action, combineReducers, bindActionCreators, applyMiddleware, compose } from "redux";
|
|
2
|
-
import { ReduxCluster } from "./core/redux-cluster";
|
|
3
|
-
import { ReduxClusterConfig } from "./types";
|
|
4
|
-
import { hasher } from "./utils/crypto";
|
|
2
|
+
import { ReduxCluster } from "./core/redux-cluster.js";
|
|
3
|
+
import { ReduxClusterConfig } from "./types/index.js";
|
|
4
|
+
import { hasher } from "./utils/crypto.js";
|
|
5
5
|
export * from "redux";
|
|
6
|
-
export * from "./types";
|
|
6
|
+
export * from "./types/index.js";
|
|
7
7
|
export declare const functions: {
|
|
8
8
|
hasher: typeof hasher;
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,cAAc,OAAO,CAAC;AAGtB,cAAc,kBAAkB,CAAC;AAGjC,eAAO,MAAM,SAAS;;CAErB,CAAC;AAGF,wBAAgB,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC5D,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAEpB;;;;;;;;;;;AAGD,wBAQE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/network/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/network/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAe,MAAM,mBAAmB,CAAC;AAGnF,qBAAa,aAAa;IAUtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IAVX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,gBAAgB,CAAC,CAAiB;gBAGhC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,GAAE,cAAmB;IAOvC,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,gBAAgB;IA6CxB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,aAAa;IA2DrB,OAAO,CAAC,mBAAmB;IA4C3B,OAAO,CAAC,eAAe;IAIhB,UAAU,IAAI,IAAI;CAmB1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerSettings, ReduxClusterStore, ClusterMessage, ClusterSocket } from "../types";
|
|
1
|
+
import { ServerSettings, ReduxClusterStore, ClusterMessage, ClusterSocket } from "../types/index.js";
|
|
2
2
|
export declare class ClusterServer {
|
|
3
3
|
private store;
|
|
4
4
|
private settings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/network/server.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,aAAa,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/network/server.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,aAAa,EACd,MAAM,mBAAmB,CAAC;AAG3B,qBAAa,aAAa;IAatB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IAblB,SAAgB,GAAG,EAAE,MAAM,CAAC;IAC5B,SAAgB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAM;IAC5D,SAAgB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IACtD,SAAgB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAM;IAE7E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAY;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,iBAAiB,CAAiB;gBAGhC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,GAAE,cAAmB;IAavC,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,WAAW;IA8CnB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,mBAAmB;IA2D3B,OAAO,CAAC,mBAAmB;IA8C3B,OAAO,CAAC,oBAAoB;IAyD5B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,qBAAqB;IActB,SAAS,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAgBzC,YAAY,IAAI,IAAI;IAI3B,OAAO,CAAC,OAAO;IAQR,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAiD9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
2
|
import { Transform } from "stream";
|
|
3
|
-
import { SerializationMode } from "../types";
|
|
3
|
+
import { SerializationMode } from "../types/index.js";
|
|
4
4
|
export declare function hasher(input: string): string;
|
|
5
5
|
export declare function createCipher(key: string): crypto.Cipher;
|
|
6
6
|
export declare function createDecipher(key: string, iv: Buffer): crypto.Decipher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAoDtD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C;AAGD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAGvD;AAGD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,QAAQ,CAEvE;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAShE;AAGD,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWzE;AAGD,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAKvC;AAGD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,EACvB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,GAAG,CAKL;AAGD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAsC9C;AAGD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,EACvB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,MAAM,CAMR;AAGD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,EACvB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,GAAG,CAML;AAGD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,GAAG,EACR,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,MAAM,CAmCR;AAGD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,GAAG,CAqCL;AAGD,wBAAgB,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAEtD;AAKD,wBAAgB,wBAAwB,IAAI,SAAS,GAAG,IAAI,CAK3D;AAGD,wBAAgB,6BAA6B,IAAI,SAAS,GAAG,IAAI,CAKhE;AAGD,wBAAgB,kBAAkB,IAAI,SAAS,GAAG,IAAI,CAErD;AAGD,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,iBAAiB,EACvB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,SAAS,CAuBX;AAGD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,iBAAiB,EACvB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,SAAS,CAuBX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-cluster",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript cluster module for Redux that synchronizes Redux stores across cluster processes via IPC and TCP sockets",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist/esm/**/*.js",
|
|
23
|
-
"dist/cjs/**/*.js",
|
|
22
|
+
"dist/esm/**/*.js{,on}",
|
|
23
|
+
"dist/cjs/**/*.js{,on}",
|
|
24
24
|
"dist/types/**/*",
|
|
25
25
|
"README.md",
|
|
26
26
|
"LICENSE"
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"typescript": "^5.5.4"
|
|
108
108
|
},
|
|
109
109
|
"engines": {
|
|
110
|
-
"node": ">=
|
|
110
|
+
"node": ">=16.0.0"
|
|
111
111
|
},
|
|
112
112
|
"overrides": {
|
|
113
113
|
"debug": ">=4.3.7"
|