@casual-simulation/aux-vm-client 3.2.6 → 3.2.7-alpha.6226622763
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/RemoteSimulation.d.ts +13 -1
- package/managers/RemoteSimulationImpl.d.ts +6 -2
- package/managers/RemoteSimulationImpl.js +14 -3
- package/managers/RemoteSimulationImpl.js.map +1 -1
- package/package.json +7 -7
- package/partitions/PartitionFactories.d.ts +8 -15
- package/partitions/PartitionFactories.js +25 -50
- package/partitions/PartitionFactories.js.map +1 -1
- package/partitions/index.d.ts +0 -1
- package/partitions/index.js +0 -1
- package/partitions/index.js.map +1 -1
- package/vm/RemoteAuxChannel.d.ts +5 -4
- package/vm/RemoteAuxChannel.js +8 -8
- package/vm/RemoteAuxChannel.js.map +1 -1
- package/vm/RemoteAuxVM.d.ts +4 -6
- package/vm/RemoteAuxVM.js +3 -17
- package/vm/RemoteAuxVM.js.map +1 -1
- package/partitions/BotHttpClient.d.ts +0 -9
- package/partitions/BotHttpClient.js +0 -58
- package/partitions/BotHttpClient.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Simulation, LoginManager, PortalManager } from '@casual-simulation/aux-vm';
|
|
1
|
+
import { Simulation, LoginManager, PortalManager, SimulationOrigin } from '@casual-simulation/aux-vm';
|
|
2
2
|
/**
|
|
3
3
|
* Defines an interface for simulations that interface with remote instances.
|
|
4
4
|
*/
|
|
@@ -11,5 +11,17 @@ export interface RemoteSimulation extends Simulation {
|
|
|
11
11
|
* Gets the portal manager.
|
|
12
12
|
*/
|
|
13
13
|
portals: PortalManager;
|
|
14
|
+
/**
|
|
15
|
+
* The origin of the simulation.
|
|
16
|
+
*/
|
|
17
|
+
origin: SimulationOrigin;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the record name that the simulation is connected to.
|
|
20
|
+
*/
|
|
21
|
+
get recordName(): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the instance that the simulation is connected to.
|
|
24
|
+
*/
|
|
25
|
+
get inst(): string;
|
|
14
26
|
}
|
|
15
27
|
//# sourceMappingURL=RemoteSimulation.d.ts.map
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { AuxVM, BaseSimulation, LoginManager } from '@casual-simulation/aux-vm';
|
|
2
2
|
import { RemoteSimulation } from './RemoteSimulation';
|
|
3
|
-
import { PortalManager } from '@casual-simulation/aux-vm/managers';
|
|
3
|
+
import { PortalManager, SimulationOrigin } from '@casual-simulation/aux-vm/managers';
|
|
4
4
|
/**
|
|
5
5
|
* Defines a class that provides an implementation of RemoteSimulation.
|
|
6
6
|
*/
|
|
7
7
|
export declare class RemoteSimulationImpl extends BaseSimulation implements RemoteSimulation {
|
|
8
8
|
private _login;
|
|
9
9
|
private _portals;
|
|
10
|
+
private _origin;
|
|
10
11
|
get login(): LoginManager;
|
|
11
12
|
get portals(): PortalManager;
|
|
12
|
-
constructor(id: string, vm: AuxVM);
|
|
13
|
+
constructor(id: string, origin: SimulationOrigin, vm: AuxVM);
|
|
14
|
+
get origin(): SimulationOrigin;
|
|
15
|
+
get recordName(): string;
|
|
16
|
+
get inst(): string;
|
|
13
17
|
protected _beforeVmInit(): void;
|
|
14
18
|
}
|
|
15
19
|
//# sourceMappingURL=RemoteSimulationImpl.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseSimulation, LoginManager
|
|
2
|
-
import { PortalManager } from '@casual-simulation/aux-vm/managers';
|
|
1
|
+
import { BaseSimulation, LoginManager } from '@casual-simulation/aux-vm';
|
|
2
|
+
import { PortalManager, } from '@casual-simulation/aux-vm/managers';
|
|
3
3
|
/**
|
|
4
4
|
* Defines a class that provides an implementation of RemoteSimulation.
|
|
5
5
|
*/
|
|
@@ -10,10 +10,21 @@ export class RemoteSimulationImpl extends BaseSimulation {
|
|
|
10
10
|
get portals() {
|
|
11
11
|
return this._portals;
|
|
12
12
|
}
|
|
13
|
-
constructor(id, vm) {
|
|
13
|
+
constructor(id, origin, vm) {
|
|
14
14
|
super(id, vm);
|
|
15
|
+
this._origin = origin;
|
|
15
16
|
this._login = new LoginManager(this._vm);
|
|
16
17
|
}
|
|
18
|
+
get origin() {
|
|
19
|
+
return this._origin;
|
|
20
|
+
}
|
|
21
|
+
get recordName() {
|
|
22
|
+
return this.origin.recordName;
|
|
23
|
+
}
|
|
24
|
+
get inst() {
|
|
25
|
+
var _a;
|
|
26
|
+
return (_a = this.origin.inst) !== null && _a !== void 0 ? _a : this.id;
|
|
27
|
+
}
|
|
17
28
|
_beforeVmInit() {
|
|
18
29
|
super._beforeVmInit();
|
|
19
30
|
this._portals = new PortalManager(this._vm);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteSimulationImpl.js","sourceRoot":"","sources":["RemoteSimulationImpl.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RemoteSimulationImpl.js","sourceRoot":"","sources":["RemoteSimulationImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,EACH,aAAa,GAEhB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,oBACT,SAAQ,cAAc;IAOtB,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,YAAY,EAAU,EAAE,MAAwB,EAAE,EAAS;QACvD,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAClC,CAAC;IAED,IAAI,IAAI;;QACJ,OAAO,MAAA,IAAI,CAAC,MAAM,CAAC,IAAI,mCAAI,IAAI,CAAC,EAAE,CAAC;IACvC,CAAC;IAES,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": "3.2.
|
|
3
|
+
"version": "3.2.7-alpha.6226622763",
|
|
4
4
|
"description": "A set of utilities required to securely run an AUX as a client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aux"
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"url": "https://github.com/casual-simulation/casualos/issues"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@casual-simulation/aux-common": "^3.2.
|
|
43
|
-
"@casual-simulation/aux-
|
|
44
|
-
"@casual-simulation/
|
|
45
|
-
"@casual-simulation/
|
|
46
|
-
"@casual-simulation/
|
|
42
|
+
"@casual-simulation/aux-common": "^3.2.7-alpha.6226622763",
|
|
43
|
+
"@casual-simulation/aux-runtime": "^3.2.7-alpha.6226622763",
|
|
44
|
+
"@casual-simulation/aux-vm": "^3.2.7-alpha.6226622763",
|
|
45
|
+
"@casual-simulation/aux-websocket": "^3.2.7-alpha.6226622763",
|
|
46
|
+
"@casual-simulation/aux-websocket-aws": "^3.2.7-alpha.6226622763",
|
|
47
47
|
"@casual-simulation/crypto": "^3.2.0",
|
|
48
48
|
"@casual-simulation/timesync": "^3.1.28",
|
|
49
49
|
"@casual-simulation/websocket": "^3.1.11",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"rxjs": "7.5.7",
|
|
54
54
|
"uuid": "^8.3.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "90c8d333924255b93b9654dc100fc74181b6138b"
|
|
57
57
|
}
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PartitionConfig, RemoteCausalRepoPartition, BotPartition, OtherPlayersPartition, RemoteCausalRepoProtocol, YjsPartition } from '@casual-simulation/aux-common';
|
|
1
|
+
import { ConnectionIndicator, InstRecordsClient } from '@casual-simulation/aux-common';
|
|
2
|
+
import { PartitionConfig, OtherPlayersPartition, RemoteCausalRepoProtocol, YjsPartition } from '@casual-simulation/aux-common';
|
|
4
3
|
import { AuxTimeSyncConfiguration } from '@casual-simulation/aux-vm';
|
|
5
4
|
import { TimeSyncController } from '@casual-simulation/timesync';
|
|
6
5
|
/**
|
|
7
6
|
* Gets the causal repo client that should be used for the given host.
|
|
8
7
|
* @param host The host.
|
|
9
8
|
*/
|
|
10
|
-
export declare function getClientForHostAndProtocol(host: string,
|
|
9
|
+
export declare function getClientForHostAndProtocol(host: string, indicator: ConnectionIndicator, protocol: RemoteCausalRepoProtocol): InstRecordsClient;
|
|
11
10
|
/**
|
|
12
11
|
* Gets the casual repo client that should be used for the given host when connecting over the AWS Apiary protocol.
|
|
13
12
|
* @param host The URl that should be connected to.
|
|
14
13
|
* @param user The user that the connection should be made with.
|
|
15
14
|
*/
|
|
16
|
-
export declare function getAWSApiaryClientForHostAndProtocol(host: string,
|
|
15
|
+
export declare function getAWSApiaryClientForHostAndProtocol(host: string, indicator: ConnectionIndicator): InstRecordsClient;
|
|
17
16
|
/**
|
|
18
17
|
* Gets the causal repo client that should be used for the given host when connecting over the websocket protocol.
|
|
19
18
|
* @param host The host.
|
|
20
19
|
*/
|
|
21
|
-
export declare function getWebSocketClientForHost(host: string,
|
|
20
|
+
export declare function getWebSocketClientForHost(host: string, indicator: ConnectionIndicator): InstRecordsClient;
|
|
22
21
|
/**
|
|
23
22
|
* Attempts to create a CausalTree2Partition from the given config.
|
|
24
23
|
* @param config The config.
|
|
25
24
|
*/
|
|
26
|
-
export declare function
|
|
25
|
+
export declare function createRemoteYjsPartition(config: PartitionConfig, indicator: ConnectionIndicator, useCache?: boolean): Promise<YjsPartition>;
|
|
27
26
|
/**
|
|
28
27
|
* Attempts to create a CausalTree2Partition from the given config.
|
|
29
28
|
* @param config The config.
|
|
30
29
|
*/
|
|
31
|
-
export declare function
|
|
32
|
-
|
|
33
|
-
* Attempts to create a CausalTree2Partition from the given config.
|
|
34
|
-
* @param config The config.
|
|
35
|
-
*/
|
|
36
|
-
export declare function createOtherPlayersRepoPartition(config: PartitionConfig, user: User, useCache?: boolean): Promise<OtherPlayersPartition>;
|
|
37
|
-
export declare function createBotPartition(config: PartitionConfig): Promise<BotPartition>;
|
|
38
|
-
export declare function createTimeSyncController(config: AuxTimeSyncConfiguration, user: User): TimeSyncController;
|
|
30
|
+
export declare function createOtherPlayersRepoPartition(config: PartitionConfig, indicator: ConnectionIndicator, useCache?: boolean): Promise<OtherPlayersPartition>;
|
|
31
|
+
export declare function createTimeSyncController(config: AuxTimeSyncConfiguration, indicator: ConnectionIndicator): TimeSyncController;
|
|
39
32
|
//# sourceMappingURL=PartitionFactories.d.ts.map
|
|
@@ -7,11 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { WebSocketConnectionClient } from '@casual-simulation/causal-tree-client-websocket';
|
|
10
|
+
import { AuthenticatedConnectionClient, InstRecordsClient, InstRecordsClientTimeSyncConnection, } from '@casual-simulation/aux-common';
|
|
11
|
+
import { ApiGatewayWebsocketConnectionClient } from '@casual-simulation/aux-websocket-aws';
|
|
12
|
+
import { WebsocketConnectionClient } from '@casual-simulation/aux-websocket';
|
|
13
|
+
import { OtherPlayersPartitionImpl, RemoteYjsPartitionImpl, } from '@casual-simulation/aux-common';
|
|
15
14
|
import { SocketManager as WebSocketManager } from '@casual-simulation/websocket';
|
|
16
15
|
import { TimeSyncController } from '@casual-simulation/timesync';
|
|
17
16
|
/**
|
|
@@ -28,12 +27,12 @@ let websocketClientCache = new Map();
|
|
|
28
27
|
* Gets the causal repo client that should be used for the given host.
|
|
29
28
|
* @param host The host.
|
|
30
29
|
*/
|
|
31
|
-
export function getClientForHostAndProtocol(host,
|
|
30
|
+
export function getClientForHostAndProtocol(host, indicator, protocol) {
|
|
32
31
|
if (protocol === 'apiary-aws') {
|
|
33
|
-
return getAWSApiaryClientForHostAndProtocol(host,
|
|
32
|
+
return getAWSApiaryClientForHostAndProtocol(host, indicator);
|
|
34
33
|
}
|
|
35
34
|
else {
|
|
36
|
-
return getWebSocketClientForHost(host,
|
|
35
|
+
return getWebSocketClientForHost(host, indicator);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
@@ -41,16 +40,16 @@ export function getClientForHostAndProtocol(host, user, protocol) {
|
|
|
41
40
|
* @param host The URl that should be connected to.
|
|
42
41
|
* @param user The user that the connection should be made with.
|
|
43
42
|
*/
|
|
44
|
-
export function getAWSApiaryClientForHostAndProtocol(host,
|
|
43
|
+
export function getAWSApiaryClientForHostAndProtocol(host, indicator) {
|
|
45
44
|
let client = awsApiaryClientCache.get(host);
|
|
46
45
|
if (!client) {
|
|
47
46
|
const manager = new WebSocketManager(host);
|
|
48
47
|
manager.init();
|
|
49
|
-
const
|
|
50
|
-
const connection = new
|
|
51
|
-
client = new
|
|
48
|
+
const awsConnection = new ApiGatewayWebsocketConnectionClient(manager.socket);
|
|
49
|
+
const connection = new AuthenticatedConnectionClient(awsConnection, indicator);
|
|
50
|
+
client = new InstRecordsClient(connection);
|
|
52
51
|
awsApiaryClientCache.set(host, client);
|
|
53
|
-
|
|
52
|
+
connection.connect();
|
|
54
53
|
}
|
|
55
54
|
return client;
|
|
56
55
|
}
|
|
@@ -58,7 +57,7 @@ export function getAWSApiaryClientForHostAndProtocol(host, user) {
|
|
|
58
57
|
* Gets the causal repo client that should be used for the given host when connecting over the websocket protocol.
|
|
59
58
|
* @param host The host.
|
|
60
59
|
*/
|
|
61
|
-
export function getWebSocketClientForHost(host,
|
|
60
|
+
export function getWebSocketClientForHost(host, indicator) {
|
|
62
61
|
let client = websocketClientCache.get(host);
|
|
63
62
|
if (!client) {
|
|
64
63
|
const url = new URL('/websocket', host);
|
|
@@ -70,8 +69,9 @@ export function getWebSocketClientForHost(host, user) {
|
|
|
70
69
|
}
|
|
71
70
|
const manager = new WebSocketManager(url.href);
|
|
72
71
|
manager.init();
|
|
73
|
-
const
|
|
74
|
-
|
|
72
|
+
const inner = new WebsocketConnectionClient(manager.socket);
|
|
73
|
+
const connection = new AuthenticatedConnectionClient(inner, indicator);
|
|
74
|
+
client = new InstRecordsClient(connection);
|
|
75
75
|
websocketClientCache.set(host, client);
|
|
76
76
|
connection.connect();
|
|
77
77
|
}
|
|
@@ -81,26 +81,11 @@ export function getWebSocketClientForHost(host, user) {
|
|
|
81
81
|
* Attempts to create a CausalTree2Partition from the given config.
|
|
82
82
|
* @param config The config.
|
|
83
83
|
*/
|
|
84
|
-
export function
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
if (config.type === 'remote_causal_repo') {
|
|
87
|
-
const client = getClientForHostAndProtocol(config.host, user, config.connectionProtocol);
|
|
88
|
-
const partition = new RemoteCausalRepoPartitionImpl(user, client, config);
|
|
89
|
-
yield partition.init();
|
|
90
|
-
return partition;
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Attempts to create a CausalTree2Partition from the given config.
|
|
97
|
-
* @param config The config.
|
|
98
|
-
*/
|
|
99
|
-
export function createRemoteYjsPartition(config, user, useCache = true) {
|
|
84
|
+
export function createRemoteYjsPartition(config, indicator, useCache = true) {
|
|
100
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
86
|
if (config.type === 'remote_yjs') {
|
|
102
|
-
const client = getClientForHostAndProtocol(config.host,
|
|
103
|
-
const partition = new RemoteYjsPartitionImpl(
|
|
87
|
+
const client = getClientForHostAndProtocol(config.host, indicator, config.connectionProtocol);
|
|
88
|
+
const partition = new RemoteYjsPartitionImpl(client, config);
|
|
104
89
|
yield partition.init();
|
|
105
90
|
return partition;
|
|
106
91
|
}
|
|
@@ -111,30 +96,20 @@ export function createRemoteYjsPartition(config, user, useCache = true) {
|
|
|
111
96
|
* Attempts to create a CausalTree2Partition from the given config.
|
|
112
97
|
* @param config The config.
|
|
113
98
|
*/
|
|
114
|
-
export function createOtherPlayersRepoPartition(config,
|
|
99
|
+
export function createOtherPlayersRepoPartition(config, indicator, useCache = true) {
|
|
115
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
101
|
if (config.type === 'other_players_repo') {
|
|
117
|
-
const client = getClientForHostAndProtocol(config.host,
|
|
118
|
-
const partition = new OtherPlayersPartitionImpl(
|
|
119
|
-
return partition;
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
export function createBotPartition(config) {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
if (config.type === 'bot') {
|
|
127
|
-
const client = new BotHttpClient(config.host);
|
|
128
|
-
const partition = new BotPartitionImpl(client, config);
|
|
102
|
+
const client = getClientForHostAndProtocol(config.host, indicator, config.connectionProtocol);
|
|
103
|
+
const partition = new OtherPlayersPartitionImpl(client, config);
|
|
129
104
|
return partition;
|
|
130
105
|
}
|
|
131
106
|
return undefined;
|
|
132
107
|
});
|
|
133
108
|
}
|
|
134
|
-
export function createTimeSyncController(config,
|
|
109
|
+
export function createTimeSyncController(config, indicator) {
|
|
135
110
|
if (config.host) {
|
|
136
|
-
const client = getClientForHostAndProtocol(config.host,
|
|
137
|
-
return new TimeSyncController(new
|
|
111
|
+
const client = getClientForHostAndProtocol(config.host, indicator, config.connectionProtocol);
|
|
112
|
+
return new TimeSyncController(new InstRecordsClientTimeSyncConnection(client));
|
|
138
113
|
}
|
|
139
114
|
return undefined;
|
|
140
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionFactories.js","sourceRoot":"","sources":["PartitionFactories.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PartitionFactories.js","sourceRoot":"","sources":["PartitionFactories.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,6BAA6B,EAE7B,iBAAiB,EACjB,mCAAmC,GAEtC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAKH,yBAAyB,EAEzB,sBAAsB,GAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;;GAGG;AACH,IAAI,oBAAoB,GAAG,IAAI,GAAG,EAA6B,CAAC;AAEhE;;;GAGG;AACH,IAAI,oBAAoB,GAAG,IAAI,GAAG,EAA6B,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACvC,IAAY,EACZ,SAA8B,EAC9B,QAAkC;IAElC,IAAI,QAAQ,KAAK,YAAY,EAAE;QAC3B,OAAO,oCAAoC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KAChE;SAAM;QACH,OAAO,yBAAyB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KACrD;AACL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AAC,IAAI,EACX,SAAS,EACT,MAAM,CAAC,kBAAkB,CAC5B,CAAC;QACF,OAAO,IAAI,kBAAkB,CACzB,IAAI,mCAAmC,CAAC,MAAM,CAAC,CAClD,CAAC;KACL;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
package/partitions/index.d.ts
CHANGED
package/partitions/index.js
CHANGED
package/partitions/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
package/vm/RemoteAuxChannel.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { LocalActions, PartitionConfig, AuxPartition,
|
|
2
|
-
import { AuxConfig, BaseAuxChannel,
|
|
1
|
+
import { LocalActions, PartitionConfig, AuxPartition, ConnectionIndicator } from '@casual-simulation/aux-common';
|
|
2
|
+
import { AuxConfig, BaseAuxChannel, AuxChannelOptions } from '@casual-simulation/aux-vm';
|
|
3
3
|
import { TimeSyncController } from '@casual-simulation/timesync';
|
|
4
|
+
import { AuxRuntime } from '@casual-simulation/aux-runtime';
|
|
4
5
|
export interface RemoteAuxChannelOptions extends AuxChannelOptions {
|
|
5
6
|
}
|
|
6
7
|
export declare class RemoteAuxChannel extends BaseAuxChannel {
|
|
7
|
-
constructor(
|
|
8
|
+
constructor(indicator: ConnectionIndicator, config: AuxConfig, options: RemoteAuxChannelOptions);
|
|
8
9
|
protected _createPartition(config: PartitionConfig): Promise<AuxPartition>;
|
|
9
10
|
protected _createTimeSyncController(): TimeSyncController;
|
|
10
11
|
protected _handleError(error: any): void;
|
|
11
12
|
protected _handleLocalEvents(e: LocalActions[]): void;
|
|
12
|
-
protected _createSubChannel(
|
|
13
|
+
protected _createSubChannel(indicator: ConnectionIndicator, runtime: AuxRuntime, config: AuxConfig): BaseAuxChannel;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=RemoteAuxChannel.d.ts.map
|
package/vm/RemoteAuxChannel.js
CHANGED
|
@@ -7,22 +7,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { createAuxPartition, createMemoryPartition,
|
|
10
|
+
import { createAuxPartition, createMemoryPartition, iteratePartitions, createOtherPlayersClientPartition, createYjsPartition, createRemoteClientYjsPartition, } from '@casual-simulation/aux-common';
|
|
11
11
|
import { BaseAuxChannel, } from '@casual-simulation/aux-vm';
|
|
12
|
-
import {
|
|
12
|
+
import { createOtherPlayersRepoPartition, createRemoteYjsPartition, createTimeSyncController, } from '../partitions';
|
|
13
13
|
export class RemoteAuxChannel extends BaseAuxChannel {
|
|
14
|
-
constructor(
|
|
15
|
-
super(
|
|
14
|
+
constructor(indicator, config, options) {
|
|
15
|
+
super(indicator, config, options);
|
|
16
16
|
}
|
|
17
17
|
_createPartition(config) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
return yield createAuxPartition(config, createMemoryPartition, (config) =>
|
|
19
|
+
return yield createAuxPartition(config, createMemoryPartition, (config) => createOtherPlayersClientPartition(config), (config) => createOtherPlayersRepoPartition(config, this.indicator), (config) => createYjsPartition(config), (config) => createRemoteYjsPartition(config, this.indicator), (config) => createRemoteClientYjsPartition(config));
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
_createTimeSyncController() {
|
|
23
23
|
var _a, _b, _c;
|
|
24
24
|
if ((_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.timesync) {
|
|
25
|
-
return ((_c = createTimeSyncController(this._config.config.timesync, this.
|
|
25
|
+
return ((_c = createTimeSyncController(this._config.config.timesync, this.indicator)) !== null && _c !== void 0 ? _c : super._createTimeSyncController());
|
|
26
26
|
}
|
|
27
27
|
return super._createTimeSyncController();
|
|
28
28
|
}
|
|
@@ -49,8 +49,8 @@ export class RemoteAuxChannel extends BaseAuxChannel {
|
|
|
49
49
|
}
|
|
50
50
|
super._handleLocalEvents(e);
|
|
51
51
|
}
|
|
52
|
-
_createSubChannel(
|
|
53
|
-
const channel = new RemoteAuxChannel(
|
|
52
|
+
_createSubChannel(indicator, runtime, config) {
|
|
53
|
+
const channel = new RemoteAuxChannel(indicator, config, this._options);
|
|
54
54
|
channel._runtime = runtime;
|
|
55
55
|
return channel;
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteAuxChannel.js","sourceRoot":"","sources":["RemoteAuxChannel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAIH,kBAAkB,EAClB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"RemoteAuxChannel.js","sourceRoot":"","sources":["RemoteAuxChannel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAIH,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,iCAAiC,EACjC,kBAAkB,EAClB,8BAA8B,GAEjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEH,cAAc,GAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AAOvB,MAAM,OAAO,gBAAiB,SAAQ,cAAc;IAChD,YACI,SAA8B,EAC9B,MAAiB,EACjB,OAAgC;QAEhC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAEe,gBAAgB,CAC5B,MAAuB;;YAEvB,OAAO,MAAM,kBAAkB,CAC3B,MAAM,EACN,qBAAqB,EACrB,CAAC,MAAM,EAAE,EAAE,CAAC,iCAAiC,CAAC,MAAM,CAAC,EACrD,CAAC,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CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAES,iBAAiB,CACvB,SAA8B,EAC9B,OAAmB,EACnB,MAAiB;QAEjB,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC3B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
|
package/vm/RemoteAuxVM.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuxUser } from '@casual-simulation/aux-vm/AuxUser';
|
|
1
|
+
import { StateUpdatedEvent, BotAction, StoredAux } from '@casual-simulation/aux-common';
|
|
3
2
|
import { AuxChannel, AuxChannelErrorType, AuxSubVM, AuxVM, ChannelActionResult } from '@casual-simulation/aux-vm/vm';
|
|
4
|
-
import { DeviceAction, StatusUpdate } from '@casual-simulation/
|
|
3
|
+
import { DeviceAction, StatusUpdate } from '@casual-simulation/aux-common';
|
|
5
4
|
import { Observable } from 'rxjs';
|
|
6
5
|
import { Remote } from 'comlink';
|
|
6
|
+
import { RuntimeActions, RuntimeStateVersion } from '@casual-simulation/aux-runtime';
|
|
7
7
|
/**
|
|
8
8
|
* Defines a VM that is able to wrap a remote aux channel.
|
|
9
9
|
*/
|
|
@@ -39,15 +39,13 @@ export declare class RemoteAuxVM implements AuxVM {
|
|
|
39
39
|
/**
|
|
40
40
|
* The observable list of events that should be produced locally.
|
|
41
41
|
*/
|
|
42
|
-
get localEvents(): Observable<
|
|
42
|
+
get localEvents(): Observable<RuntimeActions[]>;
|
|
43
43
|
get deviceEvents(): Observable<DeviceAction[]>;
|
|
44
44
|
/**
|
|
45
45
|
* The observable list of bot state updates from this simulation.
|
|
46
46
|
*/
|
|
47
47
|
get stateUpdated(): Observable<StateUpdatedEvent>;
|
|
48
48
|
get versionUpdated(): Observable<RuntimeStateVersion>;
|
|
49
|
-
setUser(user: AuxUser): Promise<void>;
|
|
50
|
-
setGrant(grant: string): Promise<void>;
|
|
51
49
|
/**
|
|
52
50
|
* Sends the given list of events to the simulation.
|
|
53
51
|
* @param events The events to send to the simulation.
|
package/vm/RemoteAuxVM.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { remapProgressPercent, } from '@casual-simulation/
|
|
10
|
+
import { remapProgressPercent, } from '@casual-simulation/aux-common';
|
|
11
11
|
import { Subject } from 'rxjs';
|
|
12
12
|
import { proxy, createEndpoint } from 'comlink';
|
|
13
13
|
/**
|
|
@@ -73,20 +73,6 @@ export class RemoteAuxVM {
|
|
|
73
73
|
get versionUpdated() {
|
|
74
74
|
return this._versionUpdated;
|
|
75
75
|
}
|
|
76
|
-
setUser(user) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
if (!this._proxy)
|
|
79
|
-
return null;
|
|
80
|
-
return yield this._proxy.setUser(user);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
setGrant(grant) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
if (!this._proxy)
|
|
86
|
-
return null;
|
|
87
|
-
return yield this._proxy.setGrant(grant);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
76
|
/**
|
|
91
77
|
* Sends the given list of events to the simulation.
|
|
92
78
|
* @param events The events to send to the simulation.
|
|
@@ -174,11 +160,11 @@ export class RemoteAuxVM {
|
|
|
174
160
|
}
|
|
175
161
|
_handleAddedSubChannel(subChannel) {
|
|
176
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
const { id,
|
|
163
|
+
const { id, indicator } = yield subChannel.getInfo();
|
|
178
164
|
const channel = (yield subChannel.getChannel());
|
|
179
165
|
const subVM = {
|
|
180
166
|
id,
|
|
181
|
-
|
|
167
|
+
indicator,
|
|
182
168
|
vm: this._createSubVM(channel),
|
|
183
169
|
channel,
|
|
184
170
|
};
|
package/vm/RemoteAuxVM.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteAuxVM.js","sourceRoot":"","sources":["RemoteAuxVM.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RemoteAuxVM.js","sourceRoot":"","sources":["RemoteAuxVM.ts"],"names":[],"mappings":";;;;;;;;;AAeA,OAAO,EAEH,oBAAoB,GAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAU,cAAc,EAAE,MAAM,SAAS,CAAC;AAMxD;;GAEG;AACH,MAAM,OAAO,WAAW;IAyBpB;;OAEG;IACH,YAAY,OAA2B;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,OAAO,EAAoB,CAAC;QACpD,IAAI,CAAC,aAAa,GAAG,IAAI,OAAO,EAAkB,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,IAAI,OAAO,EAAqB,CAAC;QACtD,IAAI,CAAC,eAAe,GAAG,IAAI,OAAO,EAAuB,CAAC;QAC1D,IAAI,CAAC,uBAAuB,GAAG,IAAI,OAAO,EAAgB,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,EAAuB,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,IAAI,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,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,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;KAAA;IAEa,wBAAwB,CAAC,SAAiB;;YACpD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACzC,IAAI,EAAE,EAAE;gBACJ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBACjC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aAC/B;QACL,CAAC;KAAA;CACJ"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Bot, TagFilter, BotClient } from '@casual-simulation/aux-common';
|
|
2
|
-
export declare class BotHttpClient implements BotClient {
|
|
3
|
-
host: string;
|
|
4
|
-
constructor(host: string);
|
|
5
|
-
addBots(inst: string, added: Bot[]): Promise<void>;
|
|
6
|
-
clearBots(inst: string): Promise<void>;
|
|
7
|
-
lookupBots(inst: string, tags: TagFilter[]): Promise<Bot[]>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=BotHttpClient.d.ts.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import axios from 'axios';
|
|
11
|
-
export class BotHttpClient {
|
|
12
|
-
constructor(host) {
|
|
13
|
-
this.host = host;
|
|
14
|
-
}
|
|
15
|
-
addBots(inst, added) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const request = {
|
|
18
|
-
namespace: inst,
|
|
19
|
-
bots: added,
|
|
20
|
-
};
|
|
21
|
-
try {
|
|
22
|
-
const response = yield axios.post(`${this.host}/api/bots/upload`, request);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
console.error('[BotHttpClient] Unable to upload bots:', err);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
clearBots(inst) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const request = {
|
|
32
|
-
namespace: inst,
|
|
33
|
-
};
|
|
34
|
-
try {
|
|
35
|
-
const response = yield axios.post(`${this.host}/api/bots/clear`, request);
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
console.error('[BotHttpClient] Unable to clear bots:', err);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
lookupBots(inst, tags) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const request = {
|
|
45
|
-
namespace: inst,
|
|
46
|
-
tags: tags,
|
|
47
|
-
};
|
|
48
|
-
try {
|
|
49
|
-
const response = yield axios.post(`${this.host}/api/bots`, request);
|
|
50
|
-
return response.data;
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
console.error('[BotHttpClient] Unable to lookup bots:', err);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=BotHttpClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BotHttpClient.js","sourceRoot":"","sources":["BotHttpClient.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,a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