Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
user: AuxUser,
config: AuxConfig,
options: RemoteAuxChannelOptions
) {
super(user, config, options);
this._partitionOptions = {
...(options.partitionOptions || {
defaultHost: null,
}),
treeOptions: {
filter: filterAtomFactory(() => this.helper),
},
};
// {
// defaultHost: defaultHost,
// store: options.store,
// crypto: options.crypto,
// treeOptions: {
// filter: filterAtomFactory(() => this.helper),
// },
// };
}
private async _setupChannel(
info: RealtimeChannelInfo,
event: SetupChannelAction
) {
try {
const newChannelInfo = {
id: getTreeName(event.channel),
type: 'aux',
};
const hasChannel = await this._channelManager.hasChannel(
newChannelInfo
);
if (!hasChannel) {
console.log(
`[SetupChannelModule] Setting up new channel ${
event.channel
}`
);
const channel = await this._channelManager.loadChannel(
newChannelInfo
);
if (event.botOrMod) {
export async function createRemoteCausalRepoPartition(
config: PartitionConfig,
user: User
): Promise {
if (config.type === 'remote_causal_repo') {
const manager = new SocketManager(config.host);
manager.init();
const connection = new SocketIOConnectionClient(manager.socket, user);
const client = new CausalRepoClient(connection);
const partition = new RemoteCausalRepoPartitionImpl(
user,
client,
config
);
await partition.init();
return partition;
}
return undefined;
}
export function nodeSimulationForRemote(
host: string,
user: AuxUser,
id: string,
config: FormulaLibraryOptions['config']
): RemoteSimulation {
const parsedId = parseSimulationId(id);
return new RemoteSimulationImpl(
id,
config,
{
shared: {
type: 'remote_causal_tree',
host: host,
id: id,
treeName: getTreeName(parsedId.channel),
},
},
cfg =>
new AuxVMNode(
new RemoteAuxChannel(user, cfg, {
sandboxFactory: lib => getSandbox(lib),
partitionOptions: {
defaultHost: host,
store: new NullCausalTreeStore(),
crypto: new NodeSigningCryptoImpl(
'ECDSA-SHA256-NISTP256'
),
},
})
)
);
beforeEach(async () => {
vm = new TestAuxVM(userId);
vm.processEvents = true;
helper = new BotHelper(vm);
helper.userId = userId;
selection = new SelectionManager(helper);
recent = new RecentBotManager(helper);
index = new BotIndex();
watcher = new BotWatcher(helper, index, vm.stateUpdated);
await vm.sendEvents([botAdded(createBot('user'))]);
manager = new BotPanelManager(watcher, helper, selection, recent);
});
beforeEach(async () => {
vm = new TestAuxVM();
helper = new BotHelper(vm);
helper.userId = 'user';
recent = new RecentBotManager(helper);
});
constructor() {
this._progress = new BehaviorSubject(null);
this._initOffline();
this._simulationManager = new SimulationManager(id => {
return new BotManager(this._user, id, this._config);
});
this._userSubject = new BehaviorSubject(null);
this._db = new AppDatabase();
}
constructor() {
this._progress = new BehaviorSubject(null);
this._initOffline();
this._simulationManager = new SimulationManager(id => {
return new FileManager(this._user, id, this._config);
});
this._userSubject = new BehaviorSubject(null);
this._db = new AppDatabase();
}
protected async _createPartition(
config: PartitionConfig
): Promise {
return await createAuxPartition(
config,
createRemoteCausalTreePartitionFactory(
this._partitionOptions,
this.user
),
createMemoryPartition,
config => createCausalRepoPartition(config, this.user),
config => createRemoteCausalRepoPartition(config, this.user),
config => createCausalRepoClientPartition(config, this.user)
);
}
protected async _createPartition(
config: PartitionConfig
): Promise {
return await createAuxPartition(
config,
createLocalCausalTreePartitionFactory(
{
treeOptions: {
filter: filterAtomFactory(() => this.helper),
},
},
this.user,
this._device
),
createMemoryPartition,
config => createCausalRepoPartition(config, this.user)
);
}