redux-cluster 2.0.3 → 2.0.4
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/package.json +10 -8
- package/dist/cjs/package.json +0 -1
- package/dist/esm/core/backup.d.ts +0 -10
- package/dist/esm/core/backup.d.ts.map +0 -1
- package/dist/esm/core/redux-cluster.d.ts +0 -47
- package/dist/esm/core/redux-cluster.d.ts.map +0 -1
- package/dist/esm/index.d.ts +0 -22
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/network/client.d.ts +0 -23
- package/dist/esm/network/client.d.ts.map +0 -1
- package/dist/esm/network/server.d.ts +0 -39
- package/dist/esm/network/server.d.ts.map +0 -1
- package/dist/esm/package.json +0 -1
- package/dist/esm/types/index.d.ts +0 -125
- package/dist/esm/types/index.d.ts.map +0 -1
- package/dist/esm/utils/crypto.d.ts +0 -22
- package/dist/esm/utils/crypto.d.ts.map +0 -1
- /package/dist/{cjs → types}/core/backup.d.ts +0 -0
- /package/dist/{cjs → types}/core/backup.d.ts.map +0 -0
- /package/dist/{cjs → types}/core/redux-cluster.d.ts +0 -0
- /package/dist/{cjs → types}/core/redux-cluster.d.ts.map +0 -0
- /package/dist/{cjs → types}/index.d.ts +0 -0
- /package/dist/{cjs → types}/index.d.ts.map +0 -0
- /package/dist/{cjs → types}/network/client.d.ts +0 -0
- /package/dist/{cjs → types}/network/client.d.ts.map +0 -0
- /package/dist/{cjs → types}/network/server.d.ts +0 -0
- /package/dist/{cjs → types}/network/server.d.ts.map +0 -0
- /package/dist/{cjs → types}/types/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/index.d.ts.map +0 -0
- /package/dist/{cjs → types}/utils/crypto.d.ts +0 -0
- /package/dist/{cjs → types}/utils/crypto.d.ts.map +0 -0
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-cluster",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
8
|
-
"types": "dist/
|
|
8
|
+
"types": "dist/types/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
|
-
"types": "./dist/
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
13
|
"default": "./dist/esm/index.js"
|
|
14
14
|
},
|
|
15
15
|
"require": {
|
|
16
|
-
"types": "./dist/
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"default": "./dist/cjs/index.js"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist/esm
|
|
23
|
-
"dist/cjs
|
|
22
|
+
"dist/esm/**/*.js",
|
|
23
|
+
"dist/cjs/**/*.js",
|
|
24
|
+
"dist/types/**/*",
|
|
24
25
|
"README.md",
|
|
25
26
|
"LICENSE"
|
|
26
27
|
],
|
|
@@ -43,7 +44,8 @@
|
|
|
43
44
|
}
|
|
44
45
|
],
|
|
45
46
|
"scripts": {
|
|
46
|
-
"build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:pkg",
|
|
47
|
+
"build": "npm run clean && npm run build:types && npm run build:esm && npm run build:cjs && npm run build:pkg",
|
|
48
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
47
49
|
"build:esm": "tsc",
|
|
48
50
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
49
51
|
"build:pkg": "./scripts/create-package-files.sh",
|
|
@@ -92,7 +94,7 @@
|
|
|
92
94
|
"homepage": "https://github.com/siarheidudko/redux-cluster#readme",
|
|
93
95
|
"dependencies": {
|
|
94
96
|
"@sergdudko/objectstream": "^3.2.26",
|
|
95
|
-
"protoobject": "^2.0.
|
|
97
|
+
"protoobject": "^2.0.1",
|
|
96
98
|
"redux": "^5.0.1"
|
|
97
99
|
},
|
|
98
100
|
"devDependencies": {
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BackupSettings, ReduxClusterStore } from "../types";
|
|
2
|
-
export declare class BackupManager<S = any> {
|
|
3
|
-
private store;
|
|
4
|
-
private settings;
|
|
5
|
-
private createBackupInstance?;
|
|
6
|
-
constructor(store: ReduxClusterStore<S>, settings: BackupSettings);
|
|
7
|
-
initialize(): Promise<boolean>;
|
|
8
|
-
private loadBackup;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=backup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../../src/core/backup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAe,MAAM,UAAU,CAAC;AAG1E,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,47 +0,0 @@
|
|
|
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";
|
|
5
|
-
export declare class ReduxCluster<S = any, A extends Action = Action> implements ReduxClusterStore<S, A> {
|
|
6
|
-
readonly dispatch: Store<S, A>["dispatch"];
|
|
7
|
-
readonly getState: Store<S, A>["getState"];
|
|
8
|
-
readonly subscribe: Store<S, A>["subscribe"];
|
|
9
|
-
readonly replaceReducer: Store<S, A>["replaceReducer"];
|
|
10
|
-
readonly [Symbol.observable]: Store<S, A>[typeof Symbol.observable];
|
|
11
|
-
readonly RCHash: string;
|
|
12
|
-
readonly version: string;
|
|
13
|
-
readonly homepage: string;
|
|
14
|
-
readonly role: Role[];
|
|
15
|
-
connected: boolean;
|
|
16
|
-
mode: SyncMode;
|
|
17
|
-
resync: number;
|
|
18
|
-
stderr: ErrorHandler;
|
|
19
|
-
readonly config: ReduxClusterConfig;
|
|
20
|
-
private readonly altReducer;
|
|
21
|
-
private readonly defaultState;
|
|
22
|
-
private readonly store;
|
|
23
|
-
private readonly allsock;
|
|
24
|
-
private counter?;
|
|
25
|
-
private dispatchNEW?;
|
|
26
|
-
private unsubscribe?;
|
|
27
|
-
private classRegistry;
|
|
28
|
-
constructor(reducer: Reducer<S, A>, config?: ReduxClusterConfig);
|
|
29
|
-
private internalSync;
|
|
30
|
-
_internalSync(payload: S): void;
|
|
31
|
-
private createNewReducer;
|
|
32
|
-
private updateCounter;
|
|
33
|
-
private sendActionsToNodes;
|
|
34
|
-
private initializeClusterRole;
|
|
35
|
-
private initializeMaster;
|
|
36
|
-
private initializeWorker;
|
|
37
|
-
private handleMasterMessage;
|
|
38
|
-
private handleWorkerMessage;
|
|
39
|
-
sendtoall(message?: ClusterMessage): void;
|
|
40
|
-
sendtoallsock(message?: ClusterMessage): void;
|
|
41
|
-
createServer(settings?: ServerSettings): ClusterServer;
|
|
42
|
-
createClient(settings?: ClientSettings): ClusterClient;
|
|
43
|
-
backup(settings: BackupSettings): Promise<boolean>;
|
|
44
|
-
registerClass(name: string, classConstructor: any): void;
|
|
45
|
-
getRegisteredClasses(): string[];
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=redux-cluster.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-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@
|
|
|
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";
|
|
5
|
-
export * from "redux";
|
|
6
|
-
export * from "./types";
|
|
7
|
-
export declare const functions: {
|
|
8
|
-
hasher: typeof hasher;
|
|
9
|
-
};
|
|
10
|
-
export declare function createStore<S = any, A extends Action = Action>(reducer: Reducer<S, A>, config?: ReduxClusterConfig): ReduxCluster<S, A>;
|
|
11
|
-
declare const _default: {
|
|
12
|
-
createStore: typeof createStore;
|
|
13
|
-
functions: {
|
|
14
|
-
hasher: typeof hasher;
|
|
15
|
-
};
|
|
16
|
-
combineReducers: typeof combineReducers;
|
|
17
|
-
bindActionCreators: typeof bindActionCreators;
|
|
18
|
-
applyMiddleware: typeof applyMiddleware;
|
|
19
|
-
compose: typeof compose;
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,cAAc,OAAO,CAAC;AAGtB,cAAc,SAAS,CAAC;AAGxB,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,23 +0,0 @@
|
|
|
1
|
-
import { ReduxClusterStore, ClientSettings } from "../types";
|
|
2
|
-
export declare class ClusterClient {
|
|
3
|
-
private store;
|
|
4
|
-
private settings;
|
|
5
|
-
login?: string;
|
|
6
|
-
password?: string;
|
|
7
|
-
private client;
|
|
8
|
-
private listenOptions;
|
|
9
|
-
private shouldReconnect;
|
|
10
|
-
private reconnectTimeout?;
|
|
11
|
-
constructor(store: ReduxClusterStore, settings?: ClientSettings);
|
|
12
|
-
private setupCredentials;
|
|
13
|
-
private setupConnection;
|
|
14
|
-
private getListenOptions;
|
|
15
|
-
private setupEventHandlers;
|
|
16
|
-
private handleConnection;
|
|
17
|
-
private handleDisconnection;
|
|
18
|
-
private setupPipeline;
|
|
19
|
-
private handleServerMessage;
|
|
20
|
-
private connectToServer;
|
|
21
|
-
disconnect(): void;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/network/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAe,MAAM,UAAU,CAAC;AAG1E,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,39 +0,0 @@
|
|
|
1
|
-
import { ServerSettings, ReduxClusterStore, ClusterMessage, ClusterSocket } from "../types";
|
|
2
|
-
export declare class ClusterServer {
|
|
3
|
-
private store;
|
|
4
|
-
private settings;
|
|
5
|
-
readonly uid: string;
|
|
6
|
-
readonly sockets: Record<string, ClusterSocket>;
|
|
7
|
-
readonly database: Record<string, string>;
|
|
8
|
-
readonly ip2ban: Record<string, {
|
|
9
|
-
time: number;
|
|
10
|
-
count: number;
|
|
11
|
-
}>;
|
|
12
|
-
private readonly ip2banTimeout;
|
|
13
|
-
private readonly ip2banGC;
|
|
14
|
-
private server;
|
|
15
|
-
private unsubscribe?;
|
|
16
|
-
private shouldAutoRestart;
|
|
17
|
-
constructor(store: ReduxClusterStore, settings?: ServerSettings);
|
|
18
|
-
private setupDatabase;
|
|
19
|
-
private setupBanSystem;
|
|
20
|
-
private cleanupBannedIPs;
|
|
21
|
-
private setupServer;
|
|
22
|
-
private getListenOptions;
|
|
23
|
-
private startListening;
|
|
24
|
-
private handleNewConnection;
|
|
25
|
-
private isIPBanned;
|
|
26
|
-
private rejectConnection;
|
|
27
|
-
private setupSocket;
|
|
28
|
-
private setupSocketPipeline;
|
|
29
|
-
private handleSocketMessage;
|
|
30
|
-
private handleAuthentication;
|
|
31
|
-
private recordFailedLogin;
|
|
32
|
-
private closeSocket;
|
|
33
|
-
private setupStoreIntegration;
|
|
34
|
-
sendtoall(message?: ClusterMessage): void;
|
|
35
|
-
ip2banGCStop(): void;
|
|
36
|
-
private cleanup;
|
|
37
|
-
close(): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,UAAU,CAAC;AAGlB,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"}
|
package/dist/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { Store, Action } from "redux";
|
|
2
|
-
export declare enum SerializationMode {
|
|
3
|
-
JSON = "json",
|
|
4
|
-
PROTOOBJECT = "protoobject"
|
|
5
|
-
}
|
|
6
|
-
export interface ReduxClusterConfig {
|
|
7
|
-
serializationMode?: SerializationMode;
|
|
8
|
-
debug?: boolean;
|
|
9
|
-
mode?: SyncMode;
|
|
10
|
-
syncMode?: "ipc" | "tcp";
|
|
11
|
-
role?: Role[];
|
|
12
|
-
server?: ServerSettings;
|
|
13
|
-
client?: ClientSettings;
|
|
14
|
-
backup?: BackupSettings;
|
|
15
|
-
stderr?: ErrorHandler;
|
|
16
|
-
resync?: number;
|
|
17
|
-
}
|
|
18
|
-
export type ProtoObjectState = any;
|
|
19
|
-
export declare enum MessageType {
|
|
20
|
-
CONN_STATUS = "REDUX_CLUSTER_CONNSTATUS",
|
|
21
|
-
MSG_TO_WORKER = "REDUX_CLUSTER_MSGTOWORKER",
|
|
22
|
-
MSG_TO_MASTER = "REDUX_CLUSTER_MSGTOMASTER",
|
|
23
|
-
SOCKET_AUTH = "REDUX_CLUSTER_SOCKET_AUTH",
|
|
24
|
-
SOCKET_AUTH_STATE = "REDUX_CLUSTER_SOCKET_AUTHSTATE",
|
|
25
|
-
START = "REDUX_CLUSTER_START",
|
|
26
|
-
SYNC = "REDUX_CLUSTER_SYNC"
|
|
27
|
-
}
|
|
28
|
-
export interface BaseMessage {
|
|
29
|
-
_msg: MessageType;
|
|
30
|
-
_hash: string;
|
|
31
|
-
}
|
|
32
|
-
export interface ConnectionStatusMessage extends BaseMessage {
|
|
33
|
-
_msg: MessageType.CONN_STATUS;
|
|
34
|
-
_connected: boolean;
|
|
35
|
-
}
|
|
36
|
-
export interface ActionToWorkerMessage extends BaseMessage {
|
|
37
|
-
_msg: MessageType.MSG_TO_WORKER;
|
|
38
|
-
_action: Action;
|
|
39
|
-
}
|
|
40
|
-
export interface ActionToMasterMessage extends BaseMessage {
|
|
41
|
-
_msg: MessageType.MSG_TO_MASTER;
|
|
42
|
-
_action: Action;
|
|
43
|
-
}
|
|
44
|
-
export interface SocketAuthMessage extends BaseMessage {
|
|
45
|
-
_msg: MessageType.SOCKET_AUTH;
|
|
46
|
-
_login: string;
|
|
47
|
-
_password: string;
|
|
48
|
-
}
|
|
49
|
-
export interface SocketAuthStateMessage extends BaseMessage {
|
|
50
|
-
_msg: MessageType.SOCKET_AUTH_STATE;
|
|
51
|
-
_value: boolean;
|
|
52
|
-
_banned?: boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface StartMessage extends BaseMessage {
|
|
55
|
-
_msg: MessageType.START;
|
|
56
|
-
}
|
|
57
|
-
export type ClusterMessage = ConnectionStatusMessage | ActionToWorkerMessage | ActionToMasterMessage | SocketAuthMessage | SocketAuthStateMessage | StartMessage;
|
|
58
|
-
export type SyncMode = "action" | "snapshot";
|
|
59
|
-
export type Role = "master" | "worker" | "server" | "client";
|
|
60
|
-
export interface ServerSettings {
|
|
61
|
-
host?: string;
|
|
62
|
-
port?: number;
|
|
63
|
-
path?: string;
|
|
64
|
-
logins?: Record<string, string>;
|
|
65
|
-
}
|
|
66
|
-
export interface ClientSettings {
|
|
67
|
-
host?: string;
|
|
68
|
-
port?: number;
|
|
69
|
-
path?: string;
|
|
70
|
-
login?: string;
|
|
71
|
-
password?: string;
|
|
72
|
-
}
|
|
73
|
-
export interface BackupSettings {
|
|
74
|
-
path: string;
|
|
75
|
-
key?: string;
|
|
76
|
-
timeout?: number;
|
|
77
|
-
count?: number;
|
|
78
|
-
}
|
|
79
|
-
export interface ReduxClusterStore<S = any, A extends Action = Action> extends Store<S, A> {
|
|
80
|
-
readonly RCHash: string;
|
|
81
|
-
readonly version: string;
|
|
82
|
-
readonly homepage: string;
|
|
83
|
-
readonly role: Role[];
|
|
84
|
-
connected: boolean;
|
|
85
|
-
mode: SyncMode;
|
|
86
|
-
resync: number;
|
|
87
|
-
stderr: (message: string) => void;
|
|
88
|
-
readonly config: ReduxClusterConfig;
|
|
89
|
-
createServer(settings?: ServerSettings): ClusterServer;
|
|
90
|
-
createClient(settings?: ClientSettings): ClusterClient;
|
|
91
|
-
backup(settings: BackupSettings): Promise<boolean>;
|
|
92
|
-
sendtoall(message?: ClusterMessage): void;
|
|
93
|
-
sendtoallsock(message?: ClusterMessage): void;
|
|
94
|
-
registerClass?(name: string, classConstructor: any): void;
|
|
95
|
-
getRegisteredClasses?(): string[];
|
|
96
|
-
}
|
|
97
|
-
export interface ClusterServer {
|
|
98
|
-
readonly uid: string;
|
|
99
|
-
readonly sockets: Record<string, any>;
|
|
100
|
-
readonly database: Record<string, string>;
|
|
101
|
-
readonly ip2ban: Record<string, {
|
|
102
|
-
time: number;
|
|
103
|
-
count: number;
|
|
104
|
-
}>;
|
|
105
|
-
sendtoall(message?: ClusterMessage): void;
|
|
106
|
-
ip2banGCStop(): void;
|
|
107
|
-
}
|
|
108
|
-
export interface ClusterClient {
|
|
109
|
-
login?: string;
|
|
110
|
-
password?: string;
|
|
111
|
-
}
|
|
112
|
-
export interface ClusterSocket {
|
|
113
|
-
uid: string;
|
|
114
|
-
writeNEW: (data: any) => boolean;
|
|
115
|
-
write(data: any): boolean;
|
|
116
|
-
on(event: string, listener: (...args: any[]) => void): any;
|
|
117
|
-
pipe(...args: any[]): any;
|
|
118
|
-
end(): void;
|
|
119
|
-
remoteAddress?: string;
|
|
120
|
-
}
|
|
121
|
-
export type HasherFunction = (data: string, algorithm?: string) => string | undefined;
|
|
122
|
-
export type EncrypterFunction = (data: string, pass: string) => string;
|
|
123
|
-
export type DecrypterFunction = (data: string, pass: string) => string;
|
|
124
|
-
export type ErrorHandler = (message: string) => void;
|
|
125
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGtC,oBAAY,iBAAiB;IAC3B,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAGD,MAAM,WAAW,kBAAkB;IAEjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAEzB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IAEd,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAGnC,oBAAY,WAAW;IACrB,WAAW,6BAA6B;IACxC,aAAa,8BAA8B;IAC3C,aAAa,8BAA8B;IAC3C,WAAW,8BAA8B;IACzC,iBAAiB,mCAAmC;IACpD,KAAK,wBAAwB;IAC7B,IAAI,uBAAuB;CAC5B;AAGD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,IAAI,EAAE,WAAW,CAAC,WAAW,CAAC;IAC9B,UAAU,EAAE,OAA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,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAGvE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as crypto from "crypto";
|
|
2
|
-
import { Transform } from "stream";
|
|
3
|
-
import { SerializationMode } from "../types";
|
|
4
|
-
export declare function hasher(input: string): string;
|
|
5
|
-
export declare function createCipher(key: string): crypto.Cipher;
|
|
6
|
-
export declare function createDecipher(key: string, iv: Buffer): crypto.Decipher;
|
|
7
|
-
export declare function encrypter(data: string, password: string): string;
|
|
8
|
-
export declare function decrypter(encryptedData: string, password: string): string;
|
|
9
|
-
export declare function deepClone(obj: any): any;
|
|
10
|
-
export declare function universalClone(obj: any, mode: SerializationMode, _classRegistry?: Map<string, any>): any;
|
|
11
|
-
export declare function protoObjectClone(obj: any): any;
|
|
12
|
-
export declare function universalSerialize(obj: any, mode: SerializationMode, classRegistry?: Map<string, any>): string;
|
|
13
|
-
export declare function universalDeserialize(str: string, mode: SerializationMode, classRegistry?: Map<string, any>): any;
|
|
14
|
-
export declare function serializeProtoObject(obj: any, classRegistry?: Map<string, any>): string;
|
|
15
|
-
export declare function deserializeProtoObject(str: string, classRegistry?: Map<string, any>): any;
|
|
16
|
-
export declare function createClassRegistry(): Map<string, any>;
|
|
17
|
-
export declare function createObjectStreamParser(): Transform | null;
|
|
18
|
-
export declare function createObjectStreamStringifier(): Transform | null;
|
|
19
|
-
export declare function createObjectStream(): Transform | null;
|
|
20
|
-
export declare function createDeserializationStream(mode: SerializationMode, classRegistry?: Map<string, any>): Transform;
|
|
21
|
-
export declare function createSerializationStream(mode: SerializationMode, classRegistry?: Map<string, any>): Transform;
|
|
22
|
-
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"m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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"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|