diff --git a/client/webapp/auto-verifier.ts b/client/webapp/auto-verifier.ts index 541817a..038b2b1 100644 --- a/client/webapp/auto-verifier.ts +++ b/client/webapp/auto-verifier.ts @@ -171,6 +171,9 @@ export class AutoVerifier { if (primaryResult) { resolve(primaryResult); resolved = true; + if (this.trustedStatus === 'verified') { + return; + } } //@ts-ignore (could be changed by an unverify during primaryPromise) diff --git a/client/webapp/data-types.ts b/client/webapp/data-types.ts index 856bb85..4be9dd7 100644 --- a/client/webapp/data-types.ts +++ b/client/webapp/data-types.ts @@ -285,7 +285,7 @@ export class Resource implements WithEquals { 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 { equals(other: Resource) { return ( this.id === other.id && - this.hash === other.hash + this.hash.toString('hex') === other.hash.toString('hex') ); } } diff --git a/client/webapp/fetchable-pair-verifier.ts b/client/webapp/fetchable-pair-verifier.ts index a1fe833..4216942 100644 --- a/client/webapp/fetchable-pair-verifier.ts +++ b/client/webapp/fetchable-pair-verifier.ts @@ -23,124 +23,130 @@ export default class PairVerifierFetchable extends EventEmitter im private readonly fetchMessagesAfterVerifier: AutoVerifierWithArg; 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( - 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( - async () => await primary.fetchMembers(), - async () => await trusted.fetchMembers(), - async (changesType: AutoVerifierChangesType, changes: Changes) => { - 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( - async () => await primary.fetchChannels(), - async () => await trusted.fetchChannels(), - async (changesType: AutoVerifierChangesType, changes: Changes) => { - 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( - async () => await primary.fetchTokens(), - async () => await trusted.fetchTokens(), - async (changesType: AutoVerifierChangesType, changes: Changes) => { - 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( - 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) => { - 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) => { - 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) => { - 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 { + 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): Promise{ + 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): Promise { + 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): Promise { + 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 { + 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): Promise { + 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 im this.fetchMessagesRecentVerifier.unverifyAll(); this.fetchMessagesBeforeVerifier.unverifyAll(); this.fetchMessagesAfterVerifier.unverifyAll(); + + if (this.trusted instanceof PairVerifierFetchable) { + this.trusted.unverify(); + } } async fetchMetadata(): Promise { diff --git a/client/webapp/guild-combined.ts b/client/webapp/guild-combined.ts index 895b51d..fa0dd1a 100644 --- a/client/webapp/guild-combined.ts +++ b/client/webapp/guild-combined.ts @@ -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 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 { + 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) => { - LOG.info(`g#${this.id} members conflict`, { changes }); - this.emit('conflict-members', changes); + ramDiskSocket.on('conflict-members', (changesType: AutoVerifierChangesType, changes: Changes) => { + LOG.info(`g#${this.id} members conflict`); + this.emit('conflict-members', changesType, changes); }); - ramPersonalDBSocketPairVerifier.on('conflict-channels', (changes: Changes) => { + ramDiskSocket.on('conflict-channels', (changesType: AutoVerifierChangesType, changes: Changes) => { 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) => { + ramDiskSocket.on('conflict-messages', (changesType: AutoVerifierChangesType, changes: Changes) => { 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) => { + ramDiskSocket.on('conflict-tokens', (changesType: AutoVerifierChangesType, changes: Changes) => { 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 void; - 'conflict-channels': (changes: Changes) => void; - 'conflict-members': (changes: Changes) => void; - 'conflict-messages': (changes: Changes) => void; - 'conflict-tokens': (changes: Changes) => void; - 'conflict-resource': (oldResource: Resource, newResource: Resource) => void; + 'conflict-metadata': (changesType: AutoVerifierChangesType, oldGuildMeta: GuildMetadata, newGuildMeta: GuildMetadata) => void; + 'conflict-channels': (changesType: AutoVerifierChangesType, changes: Changes) => void; + 'conflict-members': (changesType: AutoVerifierChangesType, changes: Changes) => void; + 'conflict-messages': (changesType: AutoVerifierChangesType, changes: Changes) => void; + 'conflict-tokens': (changesType: AutoVerifierChangesType, changes: Changes) => 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', diff --git a/client/webapp/guilds-manager.ts b/client/webapp/guilds-manager.ts index c71a008..ecdb506 100644 --- a/client/webapp/guilds-manager.ts +++ b/client/webapp/guilds-manager.ts @@ -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) => void; - 'conflict-members': (guild: CombinedGuild, changes: Changes) => void; - 'conflict-messages': (guild: CombinedGuild, changes: Changes) => void; - 'conflict-tokens': (guild: CombinedGuild, changes: Changes) => 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) => void; + 'conflict-members': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => void; + 'conflict-messages': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => void; + 'conflict-tokens': (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => void; + 'conflict-resource': (guild: CombinedGuild, changesType: AutoVerifierChangesType, oldResource: Resource, newResource: Resource) => void; }> { public guilds: CombinedGuild[] = []; diff --git a/client/webapp/preload.ts b/client/webapp/preload.ts index 272959f..2c6d4a4 100644 --- a/client/webapp/preload.ts +++ b/client/webapp/preload.ts @@ -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) => { + guildsManager.on('conflict-channels', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => { 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) => { - LOG.debug('members conflict', { changes }); + guildsManager.on('conflict-members', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => { + //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) => { - LOG.debug('messages conflict', { changes }); + guildsManager.on('conflict-messages', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => { + //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) => { + guildsManager.on('conflict-tokens', async (guild: CombinedGuild, changesType: AutoVerifierChangesType, changes: Changes) => { 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) }); diff --git a/logger/logger.ts b/logger/logger.ts index e8a30a2..b57ef75 100644 --- a/logger/logger.ts +++ b/logger/logger.ts @@ -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; }