added conflict forwarding

also fixed personal connection icon starting as unknown
This commit is contained in:
Michael Peters 2021-12-02 19:08:05 -06:00
parent 03f28ebf59
commit 1592a38c7c
8 changed files with 160 additions and 137 deletions

View File

@ -171,6 +171,9 @@ export class AutoVerifier<T> {
if (primaryResult) {
resolve(primaryResult);
resolved = true;
if (this.trustedStatus === 'verified') {
return;
}
}
//@ts-ignore (could be changed by an unverify during primaryPromise)

View File

@ -285,7 +285,7 @@ export class Resource implements WithEquals<Resource> {
private constructor(
public readonly id: string,
public readonly data: Buffer,
public readonly hash: string
public readonly hash: Buffer
) {}
static fromDBData(dataResource: any) {
@ -299,7 +299,7 @@ export class Resource implements WithEquals<Resource> {
equals(other: Resource) {
return (
this.id === other.id &&
this.hash === other.hash
this.hash.toString('hex') === other.hash.toString('hex')
);
}
}

View File

@ -23,124 +23,130 @@ export default class PairVerifierFetchable extends EventEmitter<Conflictable> im
private readonly fetchMessagesAfterVerifier: AutoVerifierWithArg<Message[], PartialMessageListQuery>;
constructor(
primary: Fetchable & Lackable,
trusted: Fetchable
private primary: Fetchable & Lackable,
private trusted: Fetchable
) {
super();
if (trusted instanceof PairVerifierFetchable) {
// handle trusted conflicts
trusted.on('conflict-metadata', this.handleMetadataConflict.bind(this));
trusted.on('conflict-members', this.handleMembersConflict.bind(this) );
trusted.on('conflict-channels', this.handleChannelsConflict.bind(this));
trusted.on('conflict-tokens', this.handleTokensConflict.bind(this) );
trusted.on('conflict-resource', this.handleResourceConflict.bind(this));
trusted.on('conflict-messages', this.handleMessagesConflict.bind(this));
}
this.fetchMetadataVerifier = AutoVerifier.createStandardSingleAutoVerifier<GuildMetadata>(
async () => await primary.fetchMetadata(),
async () => await trusted.fetchMetadata(),
async (changesType: AutoVerifierChangesType, primaryMetadata: GuildMetadata | null, trustedMetadata: GuildMetadata | null) => {
if (changesType === AutoVerifierChangesType.TRUSTED_ONLY) {
await primary.handleMetadataChanged(trustedMetadata as GuildMetadata);
} else if (changesType === AutoVerifierChangesType.CONFLICT) {
await primary.handleMetadataChanged(trustedMetadata as GuildMetadata);
this.emit('conflict-metadata', primaryMetadata as GuildMetadata, trustedMetadata as GuildMetadata);
}
}
async () => await this.primary.fetchMetadata(),
async () => await this.trusted.fetchMetadata(),
this.handleMetadataConflict.bind(this)
)
this.fetchMembersVerifier = AutoVerifier.createStandardListAutoVerifier<Member>(
async () => await primary.fetchMembers(),
async () => await trusted.fetchMembers(),
async (changesType: AutoVerifierChangesType, changes: Changes<Member>) => {
if (changes.added.length > 0) await primary.handleMembersAdded(changes.added);
if (changes.updated.length > 0) await primary.handleMembersChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await primary.handleMembersDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-members', changes);
}
}
async () => await this.primary.fetchMembers(),
async () => await this.trusted.fetchMembers(),
this.handleMembersConflict.bind(this)
);
this.fetchChannelsVerifier = AutoVerifier.createStandardListAutoVerifier<Channel>(
async () => await primary.fetchChannels(),
async () => await trusted.fetchChannels(),
async (changesType: AutoVerifierChangesType, changes: Changes<Channel>) => {
if (changes.added.length > 0) await primary.handleChannelsAdded(changes.added);
if (changes.updated.length > 0) await primary.handleChannelsChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await primary.handleChannelsDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-channels', changes);
}
}
async () => await this.primary.fetchChannels(),
async () => await this.trusted.fetchChannels(),
this.handleChannelsConflict.bind(this)
);
this.fetchTokensVerifier = AutoVerifier.createStandardListAutoVerifier<Token>(
async () => await primary.fetchTokens(),
async () => await trusted.fetchTokens(),
async (changesType: AutoVerifierChangesType, changes: Changes<Token>) => {
if (changes.added.length > 0) await primary.handleTokensAdded(changes.added);
if (changes.updated.length > 0) await primary.handleTokensChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await primary.handleTokensDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-tokens', changes);
}
}
async () => await this.primary.fetchTokens(),
async () => await this.trusted.fetchTokens(),
this.handleTokensConflict.bind(this)
);
this.fetchResourceVerifier = AutoVerifierWithArg.createStandardIDQueriedSingleAutoVerifier<Resource>(
async (query: IDQuery) => await primary.fetchResource(query.id),
async (query: IDQuery) => await trusted.fetchResource(query.id),
async (query: IDQuery, changesType: AutoVerifierChangesType, primaryResource: Resource | null, trustedResource: Resource | null) => {
if (changesType === AutoVerifierChangesType.PRIMARY_ONLY) {
await primary.handleResourceDeleted(trustedResource as Resource);
} else if (changesType === AutoVerifierChangesType.TRUSTED_ONLY) {
await primary.handleResourceAdded(trustedResource as Resource);
} else if (changesType === AutoVerifierChangesType.CONFLICT) {
await primary.handleResourceChanged(trustedResource as Resource);
this.emit('conflict-resource', primaryResource as Resource, trustedResource as Resource);
}
}
async (query: IDQuery) => await this.primary.fetchResource(query.id),
async (query: IDQuery) => await this.trusted.fetchResource(query.id),
this.handleResourceConflict.bind(this)
);
this.fetchMessagesRecentVerifier = AutoVerifierWithArg.createStandardPartialMessageListAutoVerifier(
async (query: PartialMessageListQuery) => await primary.fetchMessagesRecent(query.channelId, query.number),
async (query: PartialMessageListQuery) => await trusted.fetchMessagesRecent(query.channelId, query.number),
async (query: PartialMessageListQuery, changesType: AutoVerifierChangesType, changes: Changes<Message>) => {
if (changes.added.length > 0) await primary.handleMessagesAdded(changes.added);
if (changes.updated.length > 0) await primary.handleMessagesChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await primary.handleMessagesDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-messages', changes);
}
}
async (query: PartialMessageListQuery) => await this.primary.fetchMessagesRecent(query.channelId, query.number),
async (query: PartialMessageListQuery) => await this.trusted.fetchMessagesRecent(query.channelId, query.number),
this.handleMessagesConflict.bind(this)
);
this.fetchMessagesBeforeVerifier = AutoVerifierWithArg.createStandardPartialMessageListAutoVerifier(
async (query: PartialMessageListQuery) => await primary.fetchMessagesBefore(query.channelId, query.messageId as string, query.number),
async (query: PartialMessageListQuery) => await trusted.fetchMessagesBefore(query.channelId, query.messageId as string, query.number),
async (query: PartialMessageListQuery, changesType: AutoVerifierChangesType, changes: Changes<Message>) => {
if (changes.added.length > 0) await primary.handleMessagesAdded(changes.added);
if (changes.updated.length > 0) await primary.handleMessagesChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await primary.handleMessagesDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-messages', changes);
}
}
async (query: PartialMessageListQuery) => await this.primary.fetchMessagesBefore(query.channelId, query.messageId as string, query.number),
async (query: PartialMessageListQuery) => await this.trusted.fetchMessagesBefore(query.channelId, query.messageId as string, query.number),
this.handleMessagesConflict.bind(this)
);
this.fetchMessagesAfterVerifier = AutoVerifierWithArg.createStandardPartialMessageListAutoVerifier(
async (query: PartialMessageListQuery) => await primary.fetchMessagesAfter(query.channelId, query.messageId as string, query.number),
async (query: PartialMessageListQuery) => await trusted.fetchMessagesAfter(query.channelId, query.messageId as string, query.number),
async (query: PartialMessageListQuery, changesType: AutoVerifierChangesType, changes: Changes<Message>) => {
if (changes.added.length > 0) await primary.handleMessagesAdded(changes.added);
if (changes.updated.length > 0) await primary.handleMessagesChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await primary.handleMessagesDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-messages', changes);
}
}
async (query: PartialMessageListQuery) => await this.primary.fetchMessagesAfter(query.channelId, query.messageId as string, query.number),
async (query: PartialMessageListQuery) => await this.trusted.fetchMessagesAfter(query.channelId, query.messageId as string, query.number),
this.handleMessagesConflict.bind(this)
);
}
async handleMetadataConflict(changesType: AutoVerifierChangesType, primaryMetadata: GuildMetadata | null, trustedMetadata: GuildMetadata | null): Promise<void> {
if (changesType === AutoVerifierChangesType.TRUSTED_ONLY) {
await this.primary.handleMetadataChanged(trustedMetadata as GuildMetadata);
} else if (changesType === AutoVerifierChangesType.CONFLICT) {
await this.primary.handleMetadataChanged(trustedMetadata as GuildMetadata);
this.emit('conflict-metadata', changesType, primaryMetadata as GuildMetadata, trustedMetadata as GuildMetadata);
}
}
async handleMembersConflict(changesType: AutoVerifierChangesType, changes: Changes<Member>): Promise<void>{
if (changes.added.length > 0) await this.primary.handleMembersAdded(changes.added);
if (changes.updated.length > 0) await this.primary.handleMembersChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await this.primary.handleMembersDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-members', changesType, changes);
}
}
async handleChannelsConflict(changesType: AutoVerifierChangesType, changes: Changes<Channel>): Promise<void> {
if (changes.added.length > 0) await this.primary.handleChannelsAdded(changes.added);
if (changes.updated.length > 0) await this.primary.handleChannelsChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await this.primary.handleChannelsDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-channels', changesType, changes);
}
}
async handleTokensConflict(changesType: AutoVerifierChangesType, changes: Changes<Token>): Promise<void> {
if (changes.added.length > 0) await this.primary.handleTokensAdded(changes.added);
if (changes.updated.length > 0) await this.primary.handleTokensChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await this.primary.handleTokensDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-tokens', changesType, changes);
}
}
async handleResourceConflict(query: IDQuery, changesType: AutoVerifierChangesType, primaryResource: Resource | null, trustedResource: Resource | null): Promise<void> {
if (changesType === AutoVerifierChangesType.PRIMARY_ONLY) {
await this.primary.handleResourceDeleted(trustedResource as Resource);
} else if (changesType === AutoVerifierChangesType.TRUSTED_ONLY) {
await this.primary.handleResourceAdded(trustedResource as Resource);
} else if (changesType === AutoVerifierChangesType.CONFLICT) {
await this.primary.handleResourceChanged(trustedResource as Resource);
this.emit('conflict-resource', changesType, primaryResource as Resource, trustedResource as Resource);
}
}
async handleMessagesConflict(query: PartialMessageListQuery, changesType: AutoVerifierChangesType, changes: Changes<Message>): Promise<void> {
if (changes.added.length > 0) await this.primary.handleMessagesAdded(changes.added);
if (changes.updated.length > 0) await this.primary.handleMessagesChanged(changes.updated.map(change => change.newDataPoint));
if (changes.deleted.length > 0) await this.primary.handleMessagesDeleted(changes.deleted);
if (changesType === AutoVerifierChangesType.CONFLICT) {
this.emit('conflict-messages', changesType, changes);
}
}
unverify() {
this.fetchMetadataVerifier.unverify();
this.fetchMembersVerifier.unverify();
@ -152,6 +158,10 @@ export default class PairVerifierFetchable extends EventEmitter<Conflictable> im
this.fetchMessagesRecentVerifier.unverifyAll();
this.fetchMessagesBeforeVerifier.unverifyAll();
this.fetchMessagesAfterVerifier.unverifyAll();
if (this.trusted instanceof PairVerifierFetchable) {
this.trusted.unverify();
}
}
async fetchMetadata(): Promise<GuildMetadata | null> {

View File

@ -17,14 +17,15 @@ import { Connectable, AsyncGuaranteedFetchable, Conflictable, AsyncRequestable }
import PairVerifierFetchable from './fetchable-pair-verifier';
import EnsuredFetchable from './fetchable-ensured';
import { EventEmitter } from 'tsee';
import { AutoVerifierChangesType } from './auto-verifier';
export default class CombinedGuild extends EventEmitter<Connectable & Conflictable> implements AsyncGuaranteedFetchable, AsyncRequestable {
private readonly ramGuild: RAMGuild;
private readonly personalDBGuild: PersonalDBGuild;
private readonly socketGuild: SocketGuild;
private readonly pairVerifiers: PairVerifierFetchable[];
private readonly fetchable: AsyncGuaranteedFetchable;
private readonly mainPairVerifier: PairVerifierFetchable;
constructor(
public readonly id: number,
@ -113,38 +114,37 @@ export default class CombinedGuild extends EventEmitter<Connectable & Conflictab
this.emit('update-messages', messages);
});
let personalDBSocketPairVerifier = new PairVerifierFetchable(this.personalDBGuild, this.socketGuild);
let ramPersonalDBSocketPairVerifier = new PairVerifierFetchable(this.ramGuild, personalDBSocketPairVerifier);
let diskSocket = new PairVerifierFetchable(this.personalDBGuild, this.socketGuild);
let ramDiskSocket = new PairVerifierFetchable(this.ramGuild, diskSocket);
// Forward the conflict events from the last verifier in the chain
ramPersonalDBSocketPairVerifier.on('conflict-metadata', (oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => {
ramDiskSocket.on('conflict-metadata', (changesType: AutoVerifierChangesType, oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => {
LOG.info(`g#${this.id} metadata conflict`, { oldGuildMeta, newGuildMeta });
this.emit('conflict-metadata', oldGuildMeta, newGuildMeta);
this.emit('conflict-metadata', changesType, oldGuildMeta, newGuildMeta);
});
ramPersonalDBSocketPairVerifier.on('conflict-members', (changes: Changes<Member>) => {
LOG.info(`g#${this.id} members conflict`, { changes });
this.emit('conflict-members', changes);
ramDiskSocket.on('conflict-members', (changesType: AutoVerifierChangesType, changes: Changes<Member>) => {
LOG.info(`g#${this.id} members conflict`);
this.emit('conflict-members', changesType, changes);
});
ramPersonalDBSocketPairVerifier.on('conflict-channels', (changes: Changes<Channel>) => {
ramDiskSocket.on('conflict-channels', (changesType: AutoVerifierChangesType, changes: Changes<Channel>) => {
LOG.info(`g#${this.id} channels conflict`, { changes });
this.emit('conflict-channels', changes);
this.emit('conflict-channels', changesType, changes);
});
ramPersonalDBSocketPairVerifier.on('conflict-messages', (changes: Changes<Message>) => {
ramDiskSocket.on('conflict-messages', (changesType: AutoVerifierChangesType, changes: Changes<Message>) => {
LOG.info(`g#${this.id} messages conflict`, { changes });
this.emit('conflict-messages', changes);
this.emit('conflict-messages', changesType, changes);
});
ramPersonalDBSocketPairVerifier.on('conflict-tokens', (changes: Changes<Token>) => {
ramDiskSocket.on('conflict-tokens', (changesType: AutoVerifierChangesType, changes: Changes<Token>) => {
LOG.info(`g#${this.id} tokens conflict`, { changes });
this.emit('conflict-tokens', changes);
this.emit('conflict-tokens', changesType, changes);
});
ramPersonalDBSocketPairVerifier.on('conflict-resource', (oldResource: Resource, newResource: Resource) => {
ramDiskSocket.on('conflict-resource', (changesType: AutoVerifierChangesType, oldResource: Resource, newResource: Resource) => {
LOG.warn(`g#${this.id} resource conflict`, { oldResource, newResource });
this.emit('conflict-resource', oldResource, newResource);
this.emit('conflict-resource', changesType, oldResource, newResource);
});
this.pairVerifiers = [ personalDBSocketPairVerifier, ramPersonalDBSocketPairVerifier ];
this.fetchable = new EnsuredFetchable(ramPersonalDBSocketPairVerifier);
this.fetchable = new EnsuredFetchable(ramDiskSocket);
this.mainPairVerifier = ramDiskSocket;
}
static async create(
@ -190,9 +190,7 @@ export default class CombinedGuild extends EventEmitter<Connectable & Conflictab
}
private unverify(): void {
for (let pairVerifier of this.pairVerifiers) {
pairVerifier.unverify();
}
this.mainPairVerifier.unverify();
}
public disconnect(): void {

View File

@ -1,5 +1,6 @@
import { Changes, Channel, GuildMetadata, Member, Message, Resource, Token } from './data-types';
import { DefaultEventMap, EventEmitter } from 'tsee';
import { AutoVerifierChangesType } from './auto-verifier';
// Fetchable
@ -131,12 +132,12 @@ export type Connectable = {
// A Conflictable could emit conflict-based events if data changed based on verification
// These events should be emitted *after* the conflicts have been resolved
export type Conflictable = {
'conflict-metadata': (oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => void;
'conflict-channels': (changes: Changes<Channel>) => void;
'conflict-members': (changes: Changes<Member>) => void;
'conflict-messages': (changes: Changes<Message>) => void;
'conflict-tokens': (changes: Changes<Token>) => void;
'conflict-resource': (oldResource: Resource, newResource: Resource) => void;
'conflict-metadata': (changesType: AutoVerifierChangesType, oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => void;
'conflict-channels': (changesType: AutoVerifierChangesType, changes: Changes<Channel>) => void;
'conflict-members': (changesType: AutoVerifierChangesType, changes: Changes<Member>) => void;
'conflict-messages': (changesType: AutoVerifierChangesType, changes: Changes<Message>) => void;
'conflict-tokens': (changesType: AutoVerifierChangesType, changes: Changes<Token>) => void;
'conflict-resource': (changesType: AutoVerifierChangesType, oldResource: Resource, newResource: Resource) => void;
}
export const GuildEventNames = [
@ -155,7 +156,7 @@ export const GuildEventNames = [
'remove-messages',
'conflict-metadata',
'conflict-channels',
'conflict-memberts',
'conflict-members',
'conflict-messages',
'conflict-tokens',
'conflict-resource',

View File

@ -17,6 +17,7 @@ import PersonalDB from './personal-db';
import MessageRAMCache from './message-ram-cache';
import ResourceRAMCache from './resource-ram-cache';
import { GuildEventNames } from './guild-types';
import { AutoVerifierChangesType } from './auto-verifier';
export default class GuildsManager extends EventEmitter<{
'connect': (guild: CombinedGuild) => void;
@ -37,12 +38,12 @@ export default class GuildsManager extends EventEmitter<{
'update-messages': (guild: CombinedGuild, updatedMessages: Message[]) => void;
'remove-messages': (guild: CombinedGuild, removedMessages: Message[]) => void;
'conflict-metadata': (guild: CombinedGuild, oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => void;
'conflict-channels': (guild: CombinedGuild, changes: Changes<Channel>) => void;
'conflict-members': (guild: CombinedGuild, changes: Changes<Member>) => void;
'conflict-messages': (guild: CombinedGuild, changes: Changes<Message>) => void;
'conflict-tokens': (guild: CombinedGuild, changes: Changes<Token>) => void;
'conflict-resource': (guild: CombinedGuild, oldResource: Resource, newResource: Resource) => void;
'conflict-metadata': (guild: CombinedGuild, changesType: AutoVerifierChangesType, oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => void;
'conflict-channels': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Channel>) => void;
'conflict-members': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Member>) => void;
'conflict-messages': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Message>) => void;
'conflict-tokens': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Token>) => void;
'conflict-resource': (guild: CombinedGuild, changesType: AutoVerifierChangesType, oldResource: Resource, newResource: Resource) => void;
}> {
public guilds: CombinedGuild[] = [];

View File

@ -26,6 +26,7 @@ import PersonalDB from './personal-db';
import MessageRAMCache from './message-ram-cache';
import ResourceRAMCache from './resource-ram-cache';
import CombinedGuild from './guild-combined';
import { AutoVerifierChangesType } from './auto-verifier';
LOG.silly('modules loaded');
@ -208,7 +209,7 @@ window.addEventListener('DOMContentLoaded', () => {
// Conflict Events
guildsManager.on('conflict-metadata', async (guild: CombinedGuild, guildMeta: GuildMetadata) => {
guildsManager.on('conflict-metadata', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, guildMeta: GuildMetadata) => {
LOG.debug('metadata conflict', { newMetadata: guildMeta });
(async () => { await ui.updateGuildName(guild, guildMeta.name); })();
(async () => {
@ -217,33 +218,42 @@ window.addEventListener('DOMContentLoaded', () => {
})();
});
guildsManager.on('conflict-channels', async (guild: CombinedGuild, changes: Changes<Channel>) => {
guildsManager.on('conflict-channels', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Channel>) => {
LOG.debug('channels conflict', { changes });
if (changes.deleted.length > 0) await ui.deleteChannels(guild, changes.deleted);
if (changes.added.length > 0) await ui.addChannels(guild, changes.added);
if (changes.updated.length > 0) await ui.updateChannels(guild, changes.updated.map(pair => pair.newDataPoint));
});
guildsManager.on('conflict-members', async (guild: CombinedGuild, changes: Changes<Member>) => {
LOG.debug('members conflict', { changes });
guildsManager.on('conflict-members', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Member>) => {
//LOG.debug('members conflict', { changes });
if (changes.deleted.length > 0) await ui.deleteMembers(guild, changes.deleted);
if (changes.added.length > 0) await ui.addMembers(guild, changes.added);
if (changes.updated.length > 0) await ui.updateMembers(guild, changes.updated.map(pair => pair.newDataPoint));
if (changes.updated.length > 0) {
(async () => {
await ui.updateMembers(guild, changes.updated.map(pair => pair.newDataPoint));
})();
(async () => {
LOG.debug('updating conflict members connection...');
// Likely getting called before the ram is updated
await Actions.fetchAndUpdateConnection(ui, guild);
})();
}
});
guildsManager.on('conflict-messages', async (guild: CombinedGuild, changes: Changes<Message>) => {
LOG.debug('messages conflict', { changes });
guildsManager.on('conflict-messages', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Message>) => {
//LOG.debug('messages conflict', { changes });
if (changes.deleted.length > 0) await ui.deleteMessages(guild, changes.deleted);
if (changes.added.length > 0) await ui.addMessages(guild, changes.added);
if (changes.updated.length > 0) await ui.updateMessages(guild, changes.updated.map(pair => pair.newDataPoint));
});
guildsManager.on('conflict-tokens', async (guild: CombinedGuild, changes: Changes<Token>) => {
guildsManager.on('conflict-tokens', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes<Token>) => {
LOG.debug('tokens conflict', { changes });
// TODO
});
guildsManager.on('conflict-resource', async (guild: CombinedGuild, oldResource: Resource, newResource: Resource) => {
guildsManager.on('conflict-resource', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, oldResource: Resource, newResource: Resource) => {
LOG.debug('resource conflict', { oldResource, newResource });
// TODO (these changes should not happen often if at all)
});

View File

@ -237,7 +237,7 @@ export default class Logger {
// Use the source map to create a typescript version of the stack
// This will be printed asynchronously because SourceMapConsumer
} else {
let s = util.inspect(data, { colors: true, depth: 5 });
let s = util.inspect(data, { colors: true, depth: 3 });
s = s.split('\n').map(o => `${prefix}$ ${o}`).join('\n');
out += s;
}