@dxos/echo-db 2.33.7-dev.c2ba88fb → 2.33.8-dev.6bc74570
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/dist/src/echo.d.ts +1 -1
- package/dist/src/echo.d.ts.map +1 -1
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js +13 -13
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/contact-manager.d.ts.map +1 -1
- package/dist/src/halo/contact-manager.js +2 -2
- package/dist/src/halo/contact-manager.js.map +1 -1
- package/dist/src/halo/halo-factory.d.ts +1 -1
- package/dist/src/halo/halo-factory.d.ts.map +1 -1
- package/dist/src/halo/halo-factory.js +4 -4
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo-party.d.ts +1 -1
- package/dist/src/halo/halo-party.d.ts.map +1 -1
- package/dist/src/halo/halo-party.js.map +1 -1
- package/dist/src/halo/halo.d.ts +1 -1
- package/dist/src/halo/halo.d.ts.map +1 -1
- package/dist/src/halo/halo.js +3 -2
- package/dist/src/halo/halo.js.map +1 -1
- package/dist/src/halo/halo.test.js +9 -9
- package/dist/src/halo/halo.test.js.map +1 -1
- package/dist/src/halo/preferences.d.ts +1 -1
- package/dist/src/halo/preferences.d.ts.map +1 -1
- package/dist/src/halo/preferences.js +3 -3
- package/dist/src/halo/preferences.js.map +1 -1
- package/dist/src/halo/types.d.ts +1 -0
- package/dist/src/halo/types.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.d.ts +1 -1
- package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.js +7 -7
- package/dist/src/invitations/greeting-initiator.js.map +1 -1
- package/dist/src/invitations/greeting-protocol-provider.js +2 -2
- package/dist/src/invitations/greeting-protocol-provider.js.map +1 -1
- package/dist/src/invitations/greeting-responder.d.ts.map +1 -1
- package/dist/src/invitations/greeting-responder.js +7 -6
- package/dist/src/invitations/greeting-responder.js.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.d.ts +1 -1
- package/dist/src/invitations/halo-recovery-initiator.d.ts.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js +6 -5
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/invitation-descriptor.d.ts +1 -1
- package/dist/src/invitations/invitation-descriptor.d.ts.map +1 -1
- package/dist/src/invitations/invitation-descriptor.js +6 -5
- package/dist/src/invitations/invitation-descriptor.js.map +1 -1
- package/dist/src/invitations/invitation-factory.d.ts +1 -1
- package/dist/src/invitations/invitation-factory.d.ts.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.d.ts.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js +6 -5
- package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
- package/dist/src/packlets/database/data-mirror.d.ts +1 -1
- package/dist/src/packlets/database/data-mirror.d.ts.map +1 -1
- package/dist/src/packlets/database/data-mirror.js.map +1 -1
- package/dist/src/packlets/database/data-mirror.test.js +5 -5
- package/dist/src/packlets/database/data-mirror.test.js.map +1 -1
- package/dist/src/packlets/database/data-service-host.d.ts.map +1 -1
- package/dist/src/packlets/database/data-service-host.js +3 -3
- package/dist/src/packlets/database/data-service-host.js.map +1 -1
- package/dist/src/packlets/database/database.d.ts +1 -1
- package/dist/src/packlets/database/database.d.ts.map +1 -1
- package/dist/src/packlets/database/database.js.map +1 -1
- package/dist/src/packlets/database/item-demuxer.test.js +7 -6
- package/dist/src/packlets/database/item-demuxer.test.js.map +1 -1
- package/dist/src/packlets/database/item-manager.d.ts +1 -1
- package/dist/src/packlets/database/item-manager.d.ts.map +1 -1
- package/dist/src/packlets/database/item-manager.js.map +1 -1
- package/dist/src/packlets/database/item-manager.test.js +11 -10
- package/dist/src/packlets/database/item-manager.test.js.map +1 -1
- package/dist/src/packlets/database/selection/selection.test.js +2 -2
- package/dist/src/packlets/database/selection/selection.test.js.map +1 -1
- package/dist/src/packlets/database/testing.d.ts.map +1 -1
- package/dist/src/packlets/database/testing.js +5 -5
- package/dist/src/packlets/database/testing.js.map +1 -1
- package/dist/src/packlets/errors/errors.d.ts +22 -0
- package/dist/src/packlets/errors/errors.d.ts.map +1 -0
- package/dist/src/packlets/errors/errors.js +44 -0
- package/dist/src/packlets/errors/errors.js.map +1 -0
- package/dist/src/packlets/errors/index.d.ts +1 -21
- package/dist/src/packlets/errors/index.d.ts.map +1 -1
- package/dist/src/packlets/errors/index.js +16 -39
- package/dist/src/packlets/errors/index.js.map +1 -1
- package/dist/src/parties/data-party.d.ts +1 -1
- package/dist/src/parties/data-party.d.ts.map +1 -1
- package/dist/src/parties/data-party.js.map +1 -1
- package/dist/src/parties/data-party.test.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts +1 -1
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +3 -2
- package/dist/src/parties/party-factory.js.map +1 -1
- package/dist/src/parties/party-manager.d.ts +1 -1
- package/dist/src/parties/party-manager.d.ts.map +1 -1
- package/dist/src/parties/party-manager.js +2 -2
- package/dist/src/parties/party-manager.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +10 -9
- package/dist/src/parties/party-manager.test.js.map +1 -1
- package/dist/src/pipeline/feed-muxer.d.ts.map +1 -1
- package/dist/src/pipeline/feed-muxer.js +5 -4
- package/dist/src/pipeline/feed-muxer.js.map +1 -1
- package/dist/src/pipeline/feed-muxer.test.js +5 -4
- package/dist/src/pipeline/feed-muxer.test.js.map +1 -1
- package/dist/src/pipeline/message-selector.d.ts.map +1 -1
- package/dist/src/pipeline/message-selector.js +3 -3
- package/dist/src/pipeline/message-selector.js.map +1 -1
- package/dist/src/pipeline/metadata-store.d.ts +1 -1
- package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
- package/dist/src/pipeline/metadata-store.js.map +1 -1
- package/dist/src/pipeline/metadata-store.test.js +14 -14
- package/dist/src/pipeline/metadata-store.test.js.map +1 -1
- package/dist/src/pipeline/party-feed-provider.d.ts +1 -1
- package/dist/src/pipeline/party-feed-provider.d.ts.map +1 -1
- package/dist/src/pipeline/party-feed-provider.js.map +1 -1
- package/dist/src/pipeline/party-pipeline.d.ts +1 -1
- package/dist/src/pipeline/party-pipeline.d.ts.map +1 -1
- package/dist/src/pipeline/party-pipeline.js.map +1 -1
- package/dist/src/pipeline/party-pipeline.test.js +5 -4
- package/dist/src/pipeline/party-pipeline.test.js.map +1 -1
- package/dist/src/pipeline/party-processor.d.ts +1 -1
- package/dist/src/pipeline/party-processor.d.ts.map +1 -1
- package/dist/src/protocol/auth-plugin.d.ts +1 -1
- package/dist/src/protocol/auth-plugin.d.ts.map +1 -1
- package/dist/src/protocol/auth-plugin.js.map +1 -1
- package/dist/src/protocol/halo-recovery-plugin.d.ts +1 -1
- package/dist/src/protocol/halo-recovery-plugin.d.ts.map +1 -1
- package/dist/src/protocol/identity-credentials.d.ts.map +1 -1
- package/dist/src/protocol/identity-credentials.js +2 -1
- package/dist/src/protocol/identity-credentials.js.map +1 -1
- package/dist/src/protocol/offline-invitation-plugin.d.ts +1 -1
- package/dist/src/protocol/offline-invitation-plugin.d.ts.map +1 -1
- package/dist/src/protocol/party-protocol-factory.d.ts +1 -1
- package/dist/src/protocol/party-protocol-factory.d.ts.map +1 -1
- package/dist/src/protocol/party-protocol-factory.js +1 -1
- package/dist/src/protocol/party-protocol-factory.js.map +1 -1
- package/dist/src/protocol/replicator-plugin.d.ts.map +1 -1
- package/dist/src/protocol/replicator-plugin.js +1 -2
- package/dist/src/protocol/replicator-plugin.js.map +1 -1
- package/dist/src/snapshots/snapshot-generator.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-generator.js +2 -1
- package/dist/src/snapshots/snapshot-generator.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-store.js +2 -2
- package/dist/src/snapshots/snapshot-store.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.test.js +2 -1
- package/dist/src/snapshots/snapshot-store.test.js.map +1 -1
- package/dist/src/snapshots/snapshot.test.js +4 -4
- package/dist/src/snapshots/snapshot.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/echo.test.ts +13 -11
- package/src/echo.ts +1 -1
- package/src/halo/contact-manager.ts +1 -1
- package/src/halo/halo-factory.ts +3 -2
- package/src/halo/halo-party.ts +1 -1
- package/src/halo/halo.test.ts +9 -7
- package/src/halo/halo.ts +3 -2
- package/src/halo/preferences.ts +1 -1
- package/src/halo/types.ts +1 -0
- package/src/invitations/greeting-initiator.ts +3 -3
- package/src/invitations/greeting-protocol-provider.ts +2 -2
- package/src/invitations/greeting-responder.ts +5 -4
- package/src/invitations/halo-recovery-initiator.ts +4 -3
- package/src/invitations/invitation-descriptor.ts +6 -5
- package/src/invitations/invitation-factory.ts +1 -1
- package/src/invitations/offline-invitation-claimer.ts +4 -3
- package/src/packlets/database/data-mirror.test.ts +1 -1
- package/src/packlets/database/data-mirror.ts +1 -1
- package/src/packlets/database/data-service-host.ts +1 -1
- package/src/packlets/database/database.ts +1 -1
- package/src/packlets/database/item-demuxer.test.ts +2 -1
- package/src/packlets/database/item-manager.test.ts +2 -1
- package/src/packlets/database/item-manager.ts +2 -1
- package/src/packlets/database/selection/selection.test.ts +1 -1
- package/src/packlets/database/testing.ts +1 -1
- package/src/packlets/errors/errors.ts +43 -0
- package/src/packlets/errors/index.ts +2 -40
- package/src/parties/data-party.test.ts +1 -1
- package/src/parties/data-party.ts +1 -1
- package/src/parties/party-factory.ts +4 -3
- package/src/parties/party-manager.test.ts +9 -7
- package/src/parties/party-manager.ts +1 -1
- package/src/pipeline/feed-muxer.test.ts +2 -1
- package/src/pipeline/feed-muxer.ts +3 -2
- package/src/pipeline/message-selector.ts +1 -1
- package/src/pipeline/metadata-store.test.ts +1 -1
- package/src/pipeline/metadata-store.ts +1 -1
- package/src/pipeline/party-feed-provider.ts +1 -1
- package/src/pipeline/party-pipeline.test.ts +2 -1
- package/src/pipeline/party-pipeline.ts +1 -1
- package/src/pipeline/party-processor.ts +1 -1
- package/src/protocol/auth-plugin.ts +1 -1
- package/src/protocol/halo-recovery-plugin.ts +1 -1
- package/src/protocol/identity-credentials.ts +2 -1
- package/src/protocol/offline-invitation-plugin.ts +1 -1
- package/src/protocol/party-protocol-factory.ts +3 -2
- package/src/protocol/replicator-plugin.ts +1 -2
- package/src/snapshots/snapshot-generator.ts +3 -1
- package/src/snapshots/snapshot-store.test.ts +2 -1
- package/src/snapshots/snapshot-store.ts +2 -2
- package/src/snapshots/snapshot.test.ts +1 -1
|
@@ -1,43 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import { DXOSError } from '@dxos/debug';
|
|
7
|
-
import { ItemID } from '@dxos/echo-protocol';
|
|
8
|
-
|
|
9
|
-
export class PartyNotFoundError extends DXOSError {
|
|
10
|
-
constructor (partyKey: PublicKey) {
|
|
11
|
-
super('PARTY_NOT_FOUND', `Party with key not found: ${partyKey}`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class EntityNotFoundError extends DXOSError {
|
|
16
|
-
constructor (entityId: ItemID) {
|
|
17
|
-
super('ENTITY_NOT_FOUND', `Entitiy not found: ${entityId}`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class UnknownModelError extends DXOSError {
|
|
22
|
-
constructor (model: string) {
|
|
23
|
-
super('UNKNOWN_MODEL', `Unknown model ${model}.`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class IdentityNotInitializedError extends DXOSError {
|
|
28
|
-
constructor () {
|
|
29
|
-
super('IDENTITY_NOT_INITIALIZED', 'Identity not initialized.');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class InvalidInvitationError extends DXOSError {
|
|
34
|
-
constructor () {
|
|
35
|
-
super('INVALID_INVITATION', 'Invitation is invalid.');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class InvalidStorageVersionError extends DXOSError {
|
|
40
|
-
constructor (expected: number, actual: number) {
|
|
41
|
-
super('INVALID_STORAGE_VERSION', `Invalid storage version: Expected ${expected}, actual ${actual}.`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
5
|
+
export * from './errors';
|
|
@@ -6,12 +6,12 @@ import expect from 'expect';
|
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
8
|
import { createKeyAdmitMessage, createPartyGenesisMessage, defaultSecretProvider, Keyring, KeyType, codec as haloCodec } from '@dxos/credentials';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { codec } from '@dxos/echo-protocol';
|
|
11
10
|
import { FeedStore } from '@dxos/feed-store';
|
|
12
11
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
12
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
13
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
|
+
import { PublicKey } from '@dxos/protocols';
|
|
15
15
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
16
16
|
|
|
17
17
|
import { createDataPartyAdmissionMessages, defaultInvitationAuthenticator, GreetingInitiator } from '../invitations';
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
|
|
7
7
|
import { synchronized, Event } from '@dxos/async';
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { timed } from '@dxos/debug';
|
|
10
9
|
import { PartyKey, PartySnapshot, Timeframe } from '@dxos/echo-protocol';
|
|
11
10
|
import { FeedDescriptor } from '@dxos/feed-store';
|
|
12
11
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
12
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
13
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
|
+
import { PublicKey } from '@dxos/protocols';
|
|
15
15
|
|
|
16
16
|
import { ResultSet } from '../api';
|
|
17
17
|
import { ActivationOptions, PartyPreferences, Preferences } from '../halo';
|
|
@@ -13,12 +13,13 @@ import {
|
|
|
13
13
|
SecretProvider,
|
|
14
14
|
wrapMessage
|
|
15
15
|
} from '@dxos/credentials';
|
|
16
|
-
import { humanize
|
|
16
|
+
import { humanize } from '@dxos/crypto';
|
|
17
17
|
import { failUndefined, raise, timed } from '@dxos/debug';
|
|
18
18
|
import { createFeedWriter, FeedMessage, PartyKey, PartySnapshot, Timeframe } from '@dxos/echo-protocol';
|
|
19
19
|
import { ModelFactory } from '@dxos/model-factory';
|
|
20
20
|
import { NetworkManager } from '@dxos/network-manager';
|
|
21
21
|
import { ObjectModel } from '@dxos/object-model';
|
|
22
|
+
import { PublicKey } from '@dxos/protocols';
|
|
22
23
|
|
|
23
24
|
import {
|
|
24
25
|
createDataPartyAdmissionMessages,
|
|
@@ -153,8 +154,8 @@ export class PartyFactory {
|
|
|
153
154
|
const invitationClaimer = new OfflineInvitationClaimer(this._networkManager, invitationDescriptor);
|
|
154
155
|
await invitationClaimer.connect();
|
|
155
156
|
invitationDescriptor = await invitationClaimer.claim();
|
|
156
|
-
log(`Party invitation ${
|
|
157
|
-
`at ${
|
|
157
|
+
log(`Party invitation ${PublicKey.stringify(originalInvitation.invitation)} triggered interactive Greeting`,
|
|
158
|
+
`at ${PublicKey.stringify(invitationDescriptor.invitation)}`);
|
|
158
159
|
await invitationClaimer.destroy();
|
|
159
160
|
}
|
|
160
161
|
|
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
SecretValidator
|
|
19
19
|
} from '@dxos/credentials';
|
|
20
20
|
import {
|
|
21
|
-
createKeyPair,
|
|
21
|
+
createKeyPair,
|
|
22
|
+
humanize,
|
|
22
23
|
randomBytes,
|
|
23
24
|
sign,
|
|
24
25
|
SIGNATURE_LENGTH, verify
|
|
@@ -29,6 +30,7 @@ import { createWritableFeedStream, FeedStore } from '@dxos/feed-store';
|
|
|
29
30
|
import { ModelFactory } from '@dxos/model-factory';
|
|
30
31
|
import { NetworkManager } from '@dxos/network-manager';
|
|
31
32
|
import { ObjectModel } from '@dxos/object-model';
|
|
33
|
+
import { PublicKey } from '@dxos/protocols';
|
|
32
34
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
33
35
|
import { afterTest, testTimeout } from '@dxos/testutils';
|
|
34
36
|
|
|
@@ -318,11 +320,11 @@ describe('Party manager', () => {
|
|
|
318
320
|
expect(members.length).toBe(2);
|
|
319
321
|
for (const member of members) {
|
|
320
322
|
if (identityA.identityKey!.publicKey.equals(member.publicKey)) {
|
|
321
|
-
expect(member.displayName).toEqual(identityA.identityKey!.publicKey
|
|
323
|
+
expect(member.displayName).toEqual(humanize(identityA.identityKey!.publicKey));
|
|
322
324
|
expect(member.displayName).toEqual(identityA.displayName);
|
|
323
325
|
}
|
|
324
326
|
if (identityB.identityKey!.publicKey.equals(member.publicKey)) {
|
|
325
|
-
expect(member.displayName).toEqual(identityB.identityKey!.publicKey
|
|
327
|
+
expect(member.displayName).toEqual(humanize(identityB.identityKey!.publicKey));
|
|
326
328
|
expect(member.displayName).toEqual(identityB.displayName);
|
|
327
329
|
}
|
|
328
330
|
}
|
|
@@ -399,10 +401,10 @@ describe('Party manager', () => {
|
|
|
399
401
|
expect(members.length).toBe(2);
|
|
400
402
|
for (const member of members) {
|
|
401
403
|
if (identityA.identityKey!.publicKey.equals(member.publicKey)) {
|
|
402
|
-
expect(member.displayName).toEqual(identityA.identityKey!.publicKey
|
|
404
|
+
expect(member.displayName).toEqual(humanize(identityA.identityKey!.publicKey));
|
|
403
405
|
}
|
|
404
406
|
if (identityB.identityKey!.publicKey.equals(member.publicKey)) {
|
|
405
|
-
expect(member.displayName).toEqual(identityB.identityKey!.publicKey
|
|
407
|
+
expect(member.displayName).toEqual(humanize(identityB.identityKey!.publicKey));
|
|
406
408
|
}
|
|
407
409
|
}
|
|
408
410
|
}
|
|
@@ -456,11 +458,11 @@ describe('Party manager', () => {
|
|
|
456
458
|
expect(members.length).toBe(2);
|
|
457
459
|
for (const member of members) {
|
|
458
460
|
if (identityA.identityKey!.publicKey.equals(member.publicKey)) {
|
|
459
|
-
expect(member.displayName).toEqual(identityA.identityKey!.publicKey
|
|
461
|
+
expect(member.displayName).toEqual(humanize(identityA.identityKey!.publicKey));
|
|
460
462
|
expect(member.displayName).toEqual(identityA.displayName);
|
|
461
463
|
}
|
|
462
464
|
if (identityB.identityKey!.publicKey.equals(member.publicKey)) {
|
|
463
|
-
expect(member.displayName).toEqual(identityB.identityKey!.publicKey
|
|
465
|
+
expect(member.displayName).toEqual(humanize(identityB.identityKey!.publicKey));
|
|
464
466
|
expect(member.displayName).toEqual(identityB.displayName);
|
|
465
467
|
}
|
|
466
468
|
}
|
|
@@ -8,9 +8,9 @@ import unionWith from 'lodash.unionwith';
|
|
|
8
8
|
|
|
9
9
|
import { Event, synchronized } from '@dxos/async';
|
|
10
10
|
import { KeyHint, KeyType, SecretProvider } from '@dxos/credentials';
|
|
11
|
-
import { PublicKey } from '@dxos/crypto';
|
|
12
11
|
import { failUndefined, timed } from '@dxos/debug';
|
|
13
12
|
import { PartyKey, PartySnapshot } from '@dxos/echo-protocol';
|
|
13
|
+
import { PublicKey } from '@dxos/protocols';
|
|
14
14
|
import { ComplexMap, boolGuard } from '@dxos/util';
|
|
15
15
|
|
|
16
16
|
import { InvitationDescriptor } from '../invitations';
|
|
@@ -8,10 +8,11 @@ import { it as test } from 'mocha';
|
|
|
8
8
|
|
|
9
9
|
import { waitForCondition, latch } from '@dxos/async';
|
|
10
10
|
import { createPartyGenesisMessage, Keyring, KeyType } from '@dxos/credentials';
|
|
11
|
-
import { createId, createKeyPair
|
|
11
|
+
import { createId, createKeyPair } from '@dxos/crypto';
|
|
12
12
|
import { codec, createFeedWriter, FeedSelector, FeedStoreIterator, IEchoStream, Timeframe } from '@dxos/echo-protocol';
|
|
13
13
|
import { FeedStore, createWritableFeedStream } from '@dxos/feed-store';
|
|
14
14
|
import { createSetPropertyMutation } from '@dxos/model-factory';
|
|
15
|
+
import { PublicKey } from '@dxos/protocols';
|
|
15
16
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
16
17
|
import { jsonReplacer } from '@dxos/util';
|
|
17
18
|
|
|
@@ -7,11 +7,11 @@ import debug from 'debug';
|
|
|
7
7
|
|
|
8
8
|
import { Event } from '@dxos/async';
|
|
9
9
|
import { Message as HaloMessage } from '@dxos/credentials';
|
|
10
|
-
import { keyToString, PublicKey } from '@dxos/crypto';
|
|
11
10
|
import { checkType } from '@dxos/debug';
|
|
12
11
|
import {
|
|
13
12
|
createFeedMeta, EchoEnvelope, FeedMessage, FeedStoreIterator, FeedWriter, IEchoStream, mapFeedWriter, Timeframe
|
|
14
13
|
} from '@dxos/echo-protocol';
|
|
14
|
+
import { PublicKey } from '@dxos/protocols';
|
|
15
15
|
import { jsonReplacer } from '@dxos/util';
|
|
16
16
|
|
|
17
17
|
import { EchoProcessor, TimeframeClock } from '../packlets/database';
|
|
@@ -138,7 +138,8 @@ export class FeedMuxer {
|
|
|
138
138
|
|
|
139
139
|
if (message.echo) {
|
|
140
140
|
const memberKey = this._partyProcessor.getFeedOwningMember(PublicKey.from(block.key));
|
|
141
|
-
|
|
141
|
+
// TODO(wittjosiah): Is actually a Buffer for some reason. See todo in IFeedGenericBlock.
|
|
142
|
+
assert(memberKey, `Ownership of feed ${PublicKey.stringify(block.key as unknown as Buffer)} could not be determined.`);
|
|
142
143
|
|
|
143
144
|
// Validate messge.
|
|
144
145
|
const { itemId } = message.echo;
|
|
@@ -6,8 +6,8 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { getPartyCredentialMessageType, PartyCredential } from '@dxos/credentials';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { MessageSelector } from '@dxos/echo-protocol';
|
|
10
|
+
import { PublicKey } from '@dxos/protocols';
|
|
11
11
|
|
|
12
12
|
import { TimeframeClock } from '../packlets/database';
|
|
13
13
|
import { PartyStateProvider } from './party-processor';
|
|
@@ -6,9 +6,9 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { synchronized } from '@dxos/async';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { failUndefined } from '@dxos/debug';
|
|
11
10
|
import { EchoMetadata, PartyMetadata, schema, Timeframe } from '@dxos/echo-protocol';
|
|
11
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
12
|
import { Directory } from '@dxos/random-access-multi-storage';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -7,9 +7,9 @@ import debug from 'debug';
|
|
|
7
7
|
|
|
8
8
|
import { Event, synchronized } from '@dxos/async';
|
|
9
9
|
import { Keyring, KeyType } from '@dxos/credentials';
|
|
10
|
-
import { PublicKey } from '@dxos/crypto';
|
|
11
10
|
import { FeedSelector, FeedStoreIterator, MessageSelector, Timeframe } from '@dxos/echo-protocol';
|
|
12
11
|
import { FeedDescriptor, FeedStore } from '@dxos/feed-store';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
import { ComplexMap } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { MetadataStore } from './metadata-store';
|
|
@@ -7,13 +7,14 @@ import { it as test } from 'mocha';
|
|
|
7
7
|
|
|
8
8
|
import { promiseTimeout } from '@dxos/async';
|
|
9
9
|
import { createFeedAdmitMessage, createPartyGenesisMessage, Keyring, KeyType } from '@dxos/credentials';
|
|
10
|
-
import { createId
|
|
10
|
+
import { createId } from '@dxos/crypto';
|
|
11
11
|
import { checkType } from '@dxos/debug';
|
|
12
12
|
import { codec, FeedMessage, Timeframe } from '@dxos/echo-protocol';
|
|
13
13
|
import { FeedStore } from '@dxos/feed-store';
|
|
14
14
|
import { createTestProtocolPair } from '@dxos/mesh-protocol';
|
|
15
15
|
import { ModelFactory } from '@dxos/model-factory';
|
|
16
16
|
import { ObjectModel } from '@dxos/object-model';
|
|
17
|
+
import { PublicKey } from '@dxos/protocols';
|
|
17
18
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
18
19
|
import { afterTest } from '@dxos/testutils';
|
|
19
20
|
|
|
@@ -6,10 +6,10 @@ import assert from 'assert';
|
|
|
6
6
|
|
|
7
7
|
import { synchronized } from '@dxos/async';
|
|
8
8
|
import { KeyType, Message as HaloMessage } from '@dxos/credentials';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { timed } from '@dxos/debug';
|
|
11
10
|
import { createFeedWriter, DatabaseSnapshot, FeedSelector, FeedWriter, PartyKey, PartySnapshot, Timeframe } from '@dxos/echo-protocol';
|
|
12
11
|
import { ModelFactory } from '@dxos/model-factory';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
import { SubscriptionGroup } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { createMessageSelector, PartyProcessor, PartyFeedProvider, FeedMuxer } from '.';
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
PartyEventType,
|
|
16
16
|
SignedMessage
|
|
17
17
|
} from '@dxos/credentials';
|
|
18
|
-
import { PublicKey } from '@dxos/crypto';
|
|
19
18
|
import { FeedKey, IHaloStream, PartyKey, HaloStateSnapshot } from '@dxos/echo-protocol';
|
|
19
|
+
import { PublicKey } from '@dxos/protocols';
|
|
20
20
|
import { jsonReplacer } from '@dxos/util';
|
|
21
21
|
|
|
22
22
|
const log = debug('dxos:echo-db:party-processor');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Authenticator, AuthPlugin } from '@dxos/credentials';
|
|
6
|
-
import { PublicKey } from '@dxos/crypto';
|
|
7
6
|
import { Replicator } from '@dxos/protocol-plugin-replicator';
|
|
7
|
+
import { PublicKey } from '@dxos/protocols';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates authenticator network-protocol plugin that guards access to the replicator.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createIdentityInfoMessage, createKeyAdmitMessage, createPartyGenesisMessage, KeyChain, KeyRecord, Keyring, KeyType, SignedMessage } from '@dxos/credentials';
|
|
6
|
+
import { humanize } from '@dxos/crypto';
|
|
6
7
|
|
|
7
8
|
import { ContactManager, Preferences } from '../halo';
|
|
8
9
|
import { CredentialsSigner } from './credentials-signer';
|
|
@@ -38,7 +39,7 @@ export const createTestIdentityCredentials = async (keyring: Keyring): Promise<I
|
|
|
38
39
|
messageMap.set(deviceKey.publicKey.toHex(), partyGenesis);
|
|
39
40
|
const deviceKeyChain = Keyring.buildKeyChain(deviceKey.publicKey, messageMap, [feedKey.publicKey]);
|
|
40
41
|
|
|
41
|
-
const displayName = identityKey.publicKey
|
|
42
|
+
const displayName = humanize(identityKey.publicKey);
|
|
42
43
|
const identityInfo = createIdentityInfoMessage(keyring, displayName, identityKey);
|
|
43
44
|
|
|
44
45
|
return {
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
|
-
import { discoveryKey
|
|
7
|
+
import { discoveryKey } from '@dxos/crypto';
|
|
8
8
|
import { PartyKey } from '@dxos/echo-protocol';
|
|
9
9
|
import { Protocol } from '@dxos/mesh-protocol';
|
|
10
10
|
import { MMSTTopology, NetworkManager, Plugin } from '@dxos/network-manager';
|
|
11
11
|
import { PresencePlugin } from '@dxos/protocol-plugin-presence';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
13
|
|
|
13
14
|
import { CredentialsProvider } from '.';
|
|
14
15
|
|
|
@@ -92,7 +93,7 @@ export class PartyProtocolFactory {
|
|
|
92
93
|
|
|
93
94
|
userSession: {
|
|
94
95
|
// TODO(burdon): See deprecated `protocolFactory` in HALO.
|
|
95
|
-
peerId:
|
|
96
|
+
peerId: this._peerId.toHex(),
|
|
96
97
|
// TODO(telackey): This ought to be the CredentialsProvider itself, so that fresh credentials can be minted.
|
|
97
98
|
credentials: this._credentials.get().toString('base64')
|
|
98
99
|
},
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
|
-
import { keyToString } from '@dxos/crypto';
|
|
8
7
|
import { Replicator } from '@dxos/protocol-plugin-replicator';
|
|
9
8
|
|
|
10
9
|
import { PartyFeedProvider } from '../pipeline';
|
|
@@ -18,7 +17,7 @@ export const createReplicatorPlugin = (feedProvider: PartyFeedProvider) =>
|
|
|
18
17
|
new Replicator({
|
|
19
18
|
load: async () => {
|
|
20
19
|
const feeds = feedProvider.getFeeds();
|
|
21
|
-
log(`Loading feeds: ${feeds.map(feed =>
|
|
20
|
+
log(`Loading feeds: ${feeds.map(feed => feed.key.toHex())}`);
|
|
22
21
|
return feeds.map((feed) => ({ discoveryKey: feed.feed.discoveryKey }));
|
|
23
22
|
},
|
|
24
23
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
|
+
import { humanize } from '@dxos/crypto';
|
|
8
|
+
|
|
7
9
|
import { TimeframeClock } from '../packlets/database';
|
|
8
10
|
import { PartyPipeline } from '../pipeline';
|
|
9
11
|
import { SnapshotStore } from './snapshot-store';
|
|
@@ -13,7 +15,7 @@ const log = debug('dxos:snapshot-generator');
|
|
|
13
15
|
export const createAutomaticSnapshots = (party: PartyPipeline, clock: TimeframeClock, store: SnapshotStore, interval: number) => clock.update.on(async timeframe => {
|
|
14
16
|
const totalMessages = timeframe.totalMessages();
|
|
15
17
|
if (totalMessages > 0 && totalMessages % interval === 0) {
|
|
16
|
-
log(`Saving snapshot of ${party.key
|
|
18
|
+
log(`Saving snapshot of ${humanize(party.key)}...`);
|
|
17
19
|
try {
|
|
18
20
|
const snapshot = party.createSnapshot();
|
|
19
21
|
await store.save(snapshot);
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
|
-
import { createId, createKeyPair
|
|
8
|
+
import { createId, createKeyPair } from '@dxos/crypto';
|
|
9
9
|
import { PartySnapshot } from '@dxos/echo-protocol';
|
|
10
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
11
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
11
12
|
|
|
12
13
|
import { SnapshotStore } from './snapshot-store';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
|
-
import { keyToString } from '@dxos/crypto';
|
|
9
8
|
import { schema, PartyKey, PartySnapshot } from '@dxos/echo-protocol';
|
|
9
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
10
|
import { Directory } from '@dxos/random-access-multi-storage';
|
|
11
11
|
|
|
12
12
|
const log = debug('dxos:snapshot-store');
|
|
@@ -44,7 +44,7 @@ export class SnapshotStore {
|
|
|
44
44
|
|
|
45
45
|
async save (snapshot: PartySnapshot) {
|
|
46
46
|
assert(snapshot.partyKey);
|
|
47
|
-
const file = this._directory.createOrOpen(
|
|
47
|
+
const file = this._directory.createOrOpen(PublicKey.stringify(snapshot.partyKey), { truncate: true, size: 0 });
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
50
|
const data = schema.getCodecForType('dxos.echo.snapshot.PartySnapshot').encode(snapshot);
|
|
@@ -7,10 +7,10 @@ import expect from 'expect';
|
|
|
7
7
|
import { it as test } from 'mocha';
|
|
8
8
|
|
|
9
9
|
import { waitForCondition } from '@dxos/async';
|
|
10
|
-
import { PublicKey } from '@dxos/crypto';
|
|
11
10
|
import { schema, ItemID, MockFeedWriter, PartyKey } from '@dxos/echo-protocol';
|
|
12
11
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
12
|
import { ObjectModel, ValueUtil } from '@dxos/object-model';
|
|
13
|
+
import { PublicKey } from '@dxos/protocols';
|
|
14
14
|
|
|
15
15
|
import { ItemDemuxer, ItemManager } from '../packlets/database';
|
|
16
16
|
import { createTestInstance } from '../testing';
|