@casual-simulation/aux-vm-client 2.0.23 → 2.0.30
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/managers/RemoteSimulationImpl.d.ts +1 -1
- package/managers/RemoteSimulationImpl.js +3 -3
- package/managers/RemoteSimulationImpl.js.map +1 -1
- package/package.json +8 -8
- package/partitions/PartitionFactories.d.ts +2 -2
- package/partitions/PartitionFactories.js +21 -12
- package/partitions/PartitionFactories.js.map +1 -1
|
@@ -11,6 +11,6 @@ export declare class RemoteSimulationImpl extends BaseSimulation implements Remo
|
|
|
11
11
|
get login(): LoginManager;
|
|
12
12
|
get portals(): PortalManager;
|
|
13
13
|
constructor(id: string, config: AuxConfig['config'], partitions: AuxPartitionConfig, createVm: (config: AuxConfig) => AuxVM);
|
|
14
|
-
protected
|
|
14
|
+
protected _beforeVmInit(): void;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=RemoteSimulationImpl.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseSimulation, LoginManager, } from '@casual-simulation/aux-vm';
|
|
2
|
-
import { PortalManager
|
|
2
|
+
import { PortalManager } from '@casual-simulation/aux-vm/managers';
|
|
3
3
|
/**
|
|
4
4
|
* Defines a class that provides an implementation of RemoteSimulation.
|
|
5
5
|
*/
|
|
@@ -14,8 +14,8 @@ export class RemoteSimulationImpl extends BaseSimulation {
|
|
|
14
14
|
get portals() {
|
|
15
15
|
return this._portals;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
super.
|
|
17
|
+
_beforeVmInit() {
|
|
18
|
+
super._beforeVmInit();
|
|
19
19
|
this._portals = new PortalManager(this._vm);
|
|
20
20
|
this._subscriptions.push(this._portals);
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteSimulationImpl.js","sourceRoot":"","sources":["RemoteSimulationImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,cAAc,EACd,YAAY,GAEf,MAAM,2BAA2B,CAAC;AAGnC,OAAO,
|
|
1
|
+
{"version":3,"file":"RemoteSimulationImpl.js","sourceRoot":"","sources":["RemoteSimulationImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,cAAc,EACd,YAAY,GAEf,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE;;GAEG;AACH,MAAM,OAAO,oBACT,SAAQ,cAAc;IActB,YACI,EAAU,EACV,MAA2B,EAC3B,UAA8B,EAC9B,QAAsC;QAEtC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAhBD,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAYS,aAAa;QACnB,KAAK,CAAC,aAAa,EAAE,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/aux-vm-client",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.30",
|
|
4
4
|
"description": "A set of utilities required to securely run an AUX as a client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aux"
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"url": "https://github.com/casual-simulation/casualos/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@casual-simulation/aux-common": "^2.0.
|
|
44
|
-
"@casual-simulation/aux-vm": "^2.0.
|
|
45
|
-
"@casual-simulation/causal-tree-client-apiary": "^2.0.
|
|
46
|
-
"@casual-simulation/causal-tree-client-
|
|
43
|
+
"@casual-simulation/aux-common": "^2.0.30",
|
|
44
|
+
"@casual-simulation/aux-vm": "^2.0.30",
|
|
45
|
+
"@casual-simulation/causal-tree-client-apiary": "^2.0.30",
|
|
46
|
+
"@casual-simulation/causal-tree-client-websocket": "^2.0.30",
|
|
47
47
|
"@casual-simulation/causal-trees": "^2.0.22",
|
|
48
48
|
"@casual-simulation/crypto": "^2.0.22",
|
|
49
|
-
"
|
|
49
|
+
"@casual-simulation/websocket": "^2.0.30",
|
|
50
|
+
"axios": "0.24.0",
|
|
50
51
|
"lodash": "4.17.21",
|
|
51
52
|
"rxjs": "^6.5.2",
|
|
52
|
-
"socket.io-client": "2.1.1",
|
|
53
53
|
"uuid": "^8.3.2"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "02da28eafc22129f482dc302859ce036a6ae7578"
|
|
56
56
|
}
|
|
@@ -13,10 +13,10 @@ export declare function getClientForHostAndProtocol(host: string, user: User, pr
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function getAWSApiaryClientForHostAndProtocol(host: string, user: User): CausalRepoClient;
|
|
15
15
|
/**
|
|
16
|
-
* Gets the causal repo client that should be used for the given host when connecting over the
|
|
16
|
+
* Gets the causal repo client that should be used for the given host when connecting over the websocket protocol.
|
|
17
17
|
* @param host The host.
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function getWebSocketClientForHost(host: string, user: User): CausalRepoClient;
|
|
20
20
|
/**
|
|
21
21
|
* Attempts to create a CausalTree2Partition from the given config.
|
|
22
22
|
* @param config The config.
|
|
@@ -8,20 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { CausalRepoClient } from '@casual-simulation/causal-trees/core2';
|
|
11
|
-
import { SocketManager as SocketIOSocketManager, SocketIOConnectionClient, } from '@casual-simulation/causal-tree-client-socketio';
|
|
12
11
|
import { BotHttpClient } from './BotHttpClient';
|
|
13
12
|
import { RemoteCausalRepoPartitionImpl, BotPartitionImpl, OtherPlayersPartitionImpl, RemoteYjsPartitionImpl, } from '@casual-simulation/aux-common';
|
|
14
|
-
import {
|
|
13
|
+
import { AwsSocket, ApiaryConnectionClient, } from '@casual-simulation/causal-tree-client-apiary';
|
|
14
|
+
import { WebSocketConnectionClient } from '@casual-simulation/causal-tree-client-websocket';
|
|
15
|
+
import { SocketManager as WebSocketManager } from '@casual-simulation/websocket';
|
|
15
16
|
/**
|
|
16
17
|
* A map of hostnames to CausalRepoClients.
|
|
17
18
|
* Helps prevent duplicating websocket connections to the same host.
|
|
18
19
|
*/
|
|
19
|
-
let
|
|
20
|
+
let awsApiaryClientCache = new Map();
|
|
20
21
|
/**
|
|
21
22
|
* A map of hostnames to CausalRepoClients.
|
|
22
23
|
* Helps prevent duplicating websocket connections to the same host.
|
|
23
24
|
*/
|
|
24
|
-
let
|
|
25
|
+
let websocketClientCache = new Map();
|
|
25
26
|
/**
|
|
26
27
|
* Gets the causal repo client that should be used for the given host.
|
|
27
28
|
* @param host The host.
|
|
@@ -31,7 +32,7 @@ export function getClientForHostAndProtocol(host, user, protocol) {
|
|
|
31
32
|
return getAWSApiaryClientForHostAndProtocol(host, user);
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
|
-
return
|
|
35
|
+
return getWebSocketClientForHost(host, user);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
@@ -42,7 +43,7 @@ export function getClientForHostAndProtocol(host, user, protocol) {
|
|
|
42
43
|
export function getAWSApiaryClientForHostAndProtocol(host, user) {
|
|
43
44
|
let client = awsApiaryClientCache.get(host);
|
|
44
45
|
if (!client) {
|
|
45
|
-
const manager = new
|
|
46
|
+
const manager = new WebSocketManager(host);
|
|
46
47
|
manager.init();
|
|
47
48
|
const socket = new AwsSocket(manager.socket);
|
|
48
49
|
const connection = new ApiaryConnectionClient(socket, user);
|
|
@@ -53,17 +54,25 @@ export function getAWSApiaryClientForHostAndProtocol(host, user) {
|
|
|
53
54
|
return client;
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
|
-
* Gets the causal repo client that should be used for the given host when connecting over the
|
|
57
|
+
* Gets the causal repo client that should be used for the given host when connecting over the websocket protocol.
|
|
57
58
|
* @param host The host.
|
|
58
59
|
*/
|
|
59
|
-
export function
|
|
60
|
-
let client =
|
|
60
|
+
export function getWebSocketClientForHost(host, user) {
|
|
61
|
+
let client = websocketClientCache.get(host);
|
|
61
62
|
if (!client) {
|
|
62
|
-
const
|
|
63
|
+
const url = new URL('/websocket', host);
|
|
64
|
+
if (url.protocol === 'http:') {
|
|
65
|
+
url.protocol = 'ws:';
|
|
66
|
+
}
|
|
67
|
+
else if (url.protocol === 'https:') {
|
|
68
|
+
url.protocol = 'wss:';
|
|
69
|
+
}
|
|
70
|
+
const manager = new WebSocketManager(url.href);
|
|
63
71
|
manager.init();
|
|
64
|
-
const connection = new
|
|
72
|
+
const connection = new WebSocketConnectionClient(manager.socket, user);
|
|
65
73
|
client = new CausalRepoClient(connection);
|
|
66
|
-
|
|
74
|
+
websocketClientCache.set(host, client);
|
|
75
|
+
connection.connect();
|
|
67
76
|
}
|
|
68
77
|
return client;
|
|
69
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionFactories.js","sourceRoot":"","sources":["PartitionFactories.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"PartitionFactories.js","sourceRoot":"","sources":["PartitionFactories.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;A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