@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-db",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.8-dev.6bc74570",
|
|
4
4
|
"description": "ECHO database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dxos/async": "2.33.
|
|
14
|
-
"@dxos/codec-protobuf": "2.33.
|
|
15
|
-
"@dxos/credentials": "2.33.
|
|
16
|
-
"@dxos/crypto": "2.33.
|
|
17
|
-
"@dxos/debug": "2.33.
|
|
18
|
-
"@dxos/echo-protocol": "2.33.
|
|
19
|
-
"@dxos/feed-store": "2.33.
|
|
20
|
-
"@dxos/mesh-protocol": "2.33.
|
|
21
|
-
"@dxos/model-factory": "2.33.
|
|
22
|
-
"@dxos/network-manager": "2.33.
|
|
23
|
-
"@dxos/object-model": "2.33.
|
|
24
|
-
"@dxos/protocol-plugin-presence": "2.33.
|
|
25
|
-
"@dxos/protocol-plugin-replicator": "2.33.
|
|
26
|
-
"@dxos/protocols": "2.33.
|
|
27
|
-
"@dxos/random-access-multi-storage": "2.33.
|
|
28
|
-
"@dxos/util": "2.33.
|
|
13
|
+
"@dxos/async": "2.33.8-dev.6bc74570",
|
|
14
|
+
"@dxos/codec-protobuf": "2.33.8-dev.6bc74570",
|
|
15
|
+
"@dxos/credentials": "2.33.8-dev.6bc74570",
|
|
16
|
+
"@dxos/crypto": "2.33.8-dev.6bc74570",
|
|
17
|
+
"@dxos/debug": "2.33.8-dev.6bc74570",
|
|
18
|
+
"@dxos/echo-protocol": "2.33.8-dev.6bc74570",
|
|
19
|
+
"@dxos/feed-store": "2.33.8-dev.6bc74570",
|
|
20
|
+
"@dxos/mesh-protocol": "2.33.8-dev.6bc74570",
|
|
21
|
+
"@dxos/model-factory": "2.33.8-dev.6bc74570",
|
|
22
|
+
"@dxos/network-manager": "2.33.8-dev.6bc74570",
|
|
23
|
+
"@dxos/object-model": "2.33.8-dev.6bc74570",
|
|
24
|
+
"@dxos/protocol-plugin-presence": "2.33.8-dev.6bc74570",
|
|
25
|
+
"@dxos/protocol-plugin-replicator": "2.33.8-dev.6bc74570",
|
|
26
|
+
"@dxos/protocols": "2.33.8-dev.6bc74570",
|
|
27
|
+
"@dxos/random-access-multi-storage": "2.33.8-dev.6bc74570",
|
|
28
|
+
"@dxos/util": "2.33.8-dev.6bc74570",
|
|
29
29
|
"base-x": "~3.0.9",
|
|
30
30
|
"buffer-json-encoding": "^1.0.2",
|
|
31
31
|
"debug": "^4.3.3",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"pify": "~5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@dxos/browser-mocha": "2.33.
|
|
38
|
+
"@dxos/browser-mocha": "2.33.7",
|
|
39
39
|
"@dxos/eslint-plugin": "~1.0.34",
|
|
40
|
-
"@dxos/protocols-toolchain": "2.33.
|
|
41
|
-
"@dxos/testutils": "2.33.
|
|
40
|
+
"@dxos/protocols-toolchain": "2.33.7",
|
|
41
|
+
"@dxos/testutils": "2.33.7",
|
|
42
42
|
"@types/columnify": "^1.5.1",
|
|
43
43
|
"@types/debug": "^4.1.7",
|
|
44
44
|
"@types/faker": "^5.5.1",
|
package/src/echo.test.ts
CHANGED
|
@@ -8,8 +8,10 @@ import expect from 'expect';
|
|
|
8
8
|
import { it as test } from 'mocha';
|
|
9
9
|
|
|
10
10
|
import { latch, promiseTimeout, waitForCondition } from '@dxos/async';
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
defaultSecretProvider, defaultSecretValidator, generateSeedPhrase, keyPairFromSeedPhrase
|
|
13
|
+
} from '@dxos/credentials';
|
|
14
|
+
import { humanize } from '@dxos/crypto';
|
|
13
15
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
16
|
import { afterTest } from '@dxos/testutils';
|
|
15
17
|
|
|
@@ -43,7 +45,7 @@ describe('ECHO', () => {
|
|
|
43
45
|
test('create party and update properties.', async () => {
|
|
44
46
|
const echo = await setup({ createProfile: true });
|
|
45
47
|
const parties = echo.queryParties({ open: true });
|
|
46
|
-
log('Parties:', parties.value.map(party => party.key
|
|
48
|
+
log('Parties:', parties.value.map(party => humanize(party.key)));
|
|
47
49
|
expect(parties.value).toHaveLength(0);
|
|
48
50
|
|
|
49
51
|
const party = await echo.createParty();
|
|
@@ -55,12 +57,12 @@ describe('ECHO', () => {
|
|
|
55
57
|
test('create party and items.', async () => {
|
|
56
58
|
const echo = await setup({ createProfile: true });
|
|
57
59
|
const parties = echo.queryParties({ open: true });
|
|
58
|
-
log('Parties:', parties.value.map(party => party.key
|
|
60
|
+
log('Parties:', parties.value.map(party => humanize(party.key)));
|
|
59
61
|
expect(parties.value).toHaveLength(0);
|
|
60
62
|
|
|
61
63
|
const [updated, onUpdate] = latch();
|
|
62
64
|
const unsubscribe = parties.subscribe(async parties => {
|
|
63
|
-
log('Updated:', parties.map(party => party.key
|
|
65
|
+
log('Updated:', parties.map(party => humanize(party.key)));
|
|
64
66
|
|
|
65
67
|
// TODO(burdon): Update currently called after all mutations below have completed?
|
|
66
68
|
expect(parties).toHaveLength(1);
|
|
@@ -83,7 +85,7 @@ describe('ECHO', () => {
|
|
|
83
85
|
const members = party.queryMembers().value;
|
|
84
86
|
expect(members.length).toBe(1);
|
|
85
87
|
// Within this test, we use the humanized key as the name.
|
|
86
|
-
expect(members[0].displayName).toEqual(members[0].publicKey
|
|
88
|
+
expect(members[0].displayName).toEqual(humanize(members[0].publicKey));
|
|
87
89
|
|
|
88
90
|
// TODO(burdon): Test item mutations.
|
|
89
91
|
await party.database.createItem({ model: ObjectModel, type: 'example:item/document' });
|
|
@@ -98,12 +100,12 @@ describe('ECHO', () => {
|
|
|
98
100
|
const echo = await setup({ createProfile: true });
|
|
99
101
|
|
|
100
102
|
const parties = echo.queryParties({ open: true });
|
|
101
|
-
log('Parties:', parties.value.map(party => party.key
|
|
103
|
+
log('Parties:', parties.value.map(party => humanize(party.key)));
|
|
102
104
|
expect(parties.value).toHaveLength(0);
|
|
103
105
|
|
|
104
106
|
const [updated, onUpdate] = latch();
|
|
105
107
|
const unsubscribe = parties.subscribe(async parties => {
|
|
106
|
-
log('Updated:', parties.map(party => party.key
|
|
108
|
+
log('Updated:', parties.map(party => humanize(party.key)));
|
|
107
109
|
|
|
108
110
|
expect(parties).toHaveLength(1);
|
|
109
111
|
parties.map(async party => {
|
|
@@ -126,7 +128,7 @@ describe('ECHO', () => {
|
|
|
126
128
|
const members = party.queryMembers().value;
|
|
127
129
|
expect(members.length).toBe(1);
|
|
128
130
|
// Within this test, we use the humanized key as the name.
|
|
129
|
-
expect(members[0].displayName).toEqual(members[0].publicKey
|
|
131
|
+
expect(members[0].displayName).toEqual(humanize(members[0].publicKey));
|
|
130
132
|
|
|
131
133
|
const parent = await party.database.createItem({ model: ObjectModel, type: 'example:item/document' });
|
|
132
134
|
await party.database.createItem({ model: ObjectModel, parent: parent.id });
|
|
@@ -139,7 +141,7 @@ describe('ECHO', () => {
|
|
|
139
141
|
const echo = await setup({ createProfile: true });
|
|
140
142
|
|
|
141
143
|
const parties = echo.queryParties({ open: true });
|
|
142
|
-
log('Parties:', parties.value.map(party => party.key
|
|
144
|
+
log('Parties:', parties.value.map(party => humanize(party.key)));
|
|
143
145
|
expect(parties.value).toHaveLength(0);
|
|
144
146
|
|
|
145
147
|
const party = await echo.createParty();
|
|
@@ -148,7 +150,7 @@ describe('ECHO', () => {
|
|
|
148
150
|
const members = party.queryMembers().value;
|
|
149
151
|
expect(members.length).toBe(1);
|
|
150
152
|
// Within this test, we use the humanized key as the name.
|
|
151
|
-
expect(members[0].displayName).toEqual(members[0].publicKey
|
|
153
|
+
expect(members[0].displayName).toEqual(humanize(members[0].publicKey));
|
|
152
154
|
|
|
153
155
|
const parentA = await party.database.createItem({ model: ObjectModel, type: 'example:item/document' });
|
|
154
156
|
const childA = await party.database.createItem({ model: ObjectModel, parent: parentA.id });
|
package/src/echo.ts
CHANGED
|
@@ -8,13 +8,13 @@ import memdown from 'memdown';
|
|
|
8
8
|
|
|
9
9
|
import { synchronized } from '@dxos/async';
|
|
10
10
|
import { Keyring, KeyStore, SecretProvider } from '@dxos/credentials';
|
|
11
|
-
import { PublicKey } from '@dxos/crypto';
|
|
12
11
|
import { InvalidStateError, raise } from '@dxos/debug';
|
|
13
12
|
import { codec, DataService, PartyKey, PartySnapshot } from '@dxos/echo-protocol';
|
|
14
13
|
import { FeedStore } from '@dxos/feed-store';
|
|
15
14
|
import { ModelFactory } from '@dxos/model-factory';
|
|
16
15
|
import { NetworkManager, NetworkManagerOptions } from '@dxos/network-manager';
|
|
17
16
|
import { ObjectModel } from '@dxos/object-model';
|
|
17
|
+
import { PublicKey } from '@dxos/protocols';
|
|
18
18
|
import { Storage, createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
19
19
|
import { SubscriptionGroup } from '@dxos/util';
|
|
20
20
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
|
-
import { PublicKey } from '@dxos/crypto';
|
|
7
6
|
import { raise } from '@dxos/debug';
|
|
8
7
|
import { ObjectModel } from '@dxos/object-model';
|
|
8
|
+
import { PublicKey } from '@dxos/protocols';
|
|
9
9
|
|
|
10
10
|
import { ResultSet } from '../api';
|
|
11
11
|
import { Database, Item } from '../packlets/database';
|
package/src/halo/halo-factory.ts
CHANGED
|
@@ -10,15 +10,16 @@ import {
|
|
|
10
10
|
createIdentityInfoMessage,
|
|
11
11
|
createKeyAdmitMessage,
|
|
12
12
|
createPartyGenesisMessage,
|
|
13
|
+
keyPairFromSeedPhrase,
|
|
13
14
|
Keyring,
|
|
14
15
|
KeyType,
|
|
15
16
|
Filter,
|
|
16
17
|
SecretProvider
|
|
17
18
|
} from '@dxos/credentials';
|
|
18
|
-
import { keyToString, PublicKey, keyPairFromSeedPhrase } from '@dxos/crypto';
|
|
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 { createHaloPartyAdmissionMessage, GreetingInitiator, HaloRecoveryInitiator, InvitationDescriptor, InvitationDescriptorType, OfflineInvitationClaimer } from '../invitations';
|
|
24
25
|
import { PARTY_ITEM_TYPE } from '../parties';
|
|
@@ -150,7 +151,7 @@ export class HaloFactory {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
private async _joinHalo (invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider) {
|
|
153
|
-
log(`Admitting device with invitation: ${
|
|
154
|
+
log(`Admitting device with invitation: ${PublicKey.stringify(invitationDescriptor.invitation)}`);
|
|
154
155
|
assert(invitationDescriptor.identityKey);
|
|
155
156
|
|
|
156
157
|
let identityKey = this._keyring.findKey(Keyring.signingFilter({ type: KeyType.IDENTITY }));
|
package/src/halo/halo-party.ts
CHANGED
|
@@ -6,11 +6,11 @@ import assert from 'assert';
|
|
|
6
6
|
|
|
7
7
|
import { Event, synchronized } from '@dxos/async';
|
|
8
8
|
import { KeyHint } from '@dxos/credentials';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { timed } from '@dxos/debug';
|
|
11
10
|
import { Timeframe } from '@dxos/echo-protocol';
|
|
12
11
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
12
|
import { NetworkManager } from '@dxos/network-manager';
|
|
13
|
+
import { PublicKey } from '@dxos/protocols';
|
|
14
14
|
|
|
15
15
|
import { InvitationAuthenticator, InvitationDescriptor, InvitationFactory, InvitationOptions } from '../invitations';
|
|
16
16
|
import { PARTY_ITEM_TYPE } from '../parties';
|
package/src/halo/halo.test.ts
CHANGED
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
defaultSecretProvider, generateSeedPhrase, keyPairFromSeedPhrase, Keyring
|
|
10
|
+
} from '@dxos/credentials';
|
|
10
11
|
import { codec } from '@dxos/echo-protocol';
|
|
11
12
|
import { FeedStore } from '@dxos/feed-store';
|
|
12
13
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
14
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
15
|
import { ObjectModel } from '@dxos/object-model';
|
|
16
|
+
import { PublicKey } from '@dxos/protocols';
|
|
15
17
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
16
18
|
import { afterTest, testTimeout } from '@dxos/testutils';
|
|
17
19
|
|
|
@@ -40,12 +42,12 @@ describe('HALO', () => {
|
|
|
40
42
|
);
|
|
41
43
|
|
|
42
44
|
return new HALO({
|
|
43
|
-
keyring
|
|
44
|
-
networkManager
|
|
45
|
-
metadataStore
|
|
45
|
+
keyring,
|
|
46
|
+
networkManager,
|
|
47
|
+
metadataStore,
|
|
46
48
|
feedProviderFactory,
|
|
47
|
-
modelFactory
|
|
48
|
-
snapshotStore
|
|
49
|
+
modelFactory,
|
|
50
|
+
snapshotStore,
|
|
49
51
|
options: {}
|
|
50
52
|
});
|
|
51
53
|
};
|
package/src/halo/halo.ts
CHANGED
|
@@ -7,10 +7,11 @@ import debug from 'debug';
|
|
|
7
7
|
|
|
8
8
|
import { synchronized } from '@dxos/async';
|
|
9
9
|
import { KeyRecord, Keyring, KeyType, SecretProvider } from '@dxos/credentials';
|
|
10
|
-
import { createKeyPair,
|
|
10
|
+
import { createKeyPair, humanize, KeyPair } from '@dxos/crypto';
|
|
11
11
|
import { raise } from '@dxos/debug';
|
|
12
12
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
13
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
|
+
import { PublicKey } from '@dxos/protocols';
|
|
14
15
|
|
|
15
16
|
import { ResultSet } from '../api';
|
|
16
17
|
import { InvitationAuthenticator, InvitationDescriptor, InvitationOptions } from '../invitations';
|
|
@@ -194,7 +195,7 @@ export class HALO {
|
|
|
194
195
|
|
|
195
196
|
const identityKey = this._identityManager.getIdentityKey() ?? raise(new Error('Cannot create HALO. Identity key not found.'));
|
|
196
197
|
await this._identityManager.createHalo({
|
|
197
|
-
identityDisplayName: displayName || identityKey.publicKey
|
|
198
|
+
identityDisplayName: displayName || humanize(identityKey.publicKey)
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
|
package/src/halo/preferences.ts
CHANGED
|
@@ -8,9 +8,9 @@ import defaultsDeep from 'lodash.defaultsdeep';
|
|
|
8
8
|
|
|
9
9
|
import { Event } from '@dxos/async';
|
|
10
10
|
import { KeyHint } from '@dxos/credentials';
|
|
11
|
-
import { PublicKey } from '@dxos/crypto';
|
|
12
11
|
import { raise } from '@dxos/debug';
|
|
13
12
|
import { ObjectModel } from '@dxos/object-model';
|
|
13
|
+
import { PublicKey } from '@dxos/protocols';
|
|
14
14
|
|
|
15
15
|
import { ResultSet } from '../api';
|
|
16
16
|
import { Database, Item } from '../packlets/database';
|
package/src/halo/types.ts
CHANGED
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
SignedMessage,
|
|
24
24
|
NotarizeResponse
|
|
25
25
|
} from '@dxos/credentials';
|
|
26
|
-
import { keyToString, PublicKey } from '@dxos/crypto';
|
|
27
26
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
27
|
+
import { PublicKey } from '@dxos/protocols';
|
|
28
28
|
|
|
29
29
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
30
30
|
import { greetingProtocolProvider } from './greeting-protocol-provider';
|
|
@@ -87,10 +87,10 @@ export class GreetingInitiator {
|
|
|
87
87
|
// Therefore at present the greeter discovers the invitation id from session metadata, via the invitee's peer id.
|
|
88
88
|
// TODO(dboreham): Invitation is actually invitationID.
|
|
89
89
|
const localPeerId = invitation;
|
|
90
|
-
log('Local PeerId:',
|
|
90
|
+
log('Local PeerId:', PublicKey.stringify(localPeerId));
|
|
91
91
|
this._greeterPlugin = new GreetingCommandPlugin(Buffer.from(localPeerId), new Greeter().createMessageHandler());
|
|
92
92
|
|
|
93
|
-
log(
|
|
93
|
+
log(PublicKey.stringify(localPeerId), 'connecting to', PublicKey.stringify(swarmKey));
|
|
94
94
|
|
|
95
95
|
const peerJoinedWaiter = waitForEvent(this._greeterPlugin, 'peer:joined',
|
|
96
96
|
(remotePeerId: any) => remotePeerId && Buffer.from(responderPeerId).equals(remotePeerId),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { keyToString } from '@dxos/crypto';
|
|
6
5
|
import { protocolFactory } from '@dxos/network-manager';
|
|
6
|
+
import { PublicKey } from '@dxos/protocols';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a duplex connection with a single peer using a common rendezvous key as topic.
|
|
@@ -16,6 +16,6 @@ import { protocolFactory } from '@dxos/network-manager';
|
|
|
16
16
|
// TODO(dboreham): Write a test to check resources are released (no resource leaks).
|
|
17
17
|
export const greetingProtocolProvider = (rendezvousKey: any, peerId: Buffer | Uint8Array, protocolPlugins: any[]) => protocolFactory({
|
|
18
18
|
getTopics: () => [rendezvousKey],
|
|
19
|
-
session: { peerId:
|
|
19
|
+
session: { peerId: PublicKey.stringify(peerId) },
|
|
20
20
|
plugins: protocolPlugins
|
|
21
21
|
});
|
|
@@ -16,9 +16,10 @@ import {
|
|
|
16
16
|
SecretValidator
|
|
17
17
|
, Message as HaloMessage
|
|
18
18
|
} from '@dxos/credentials';
|
|
19
|
-
import {
|
|
19
|
+
import { randomBytes } from '@dxos/crypto';
|
|
20
20
|
import { FeedWriter, SwarmKey } from '@dxos/echo-protocol';
|
|
21
21
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
22
|
+
import { PublicKey } from '@dxos/protocols';
|
|
22
23
|
|
|
23
24
|
import { PartyStateProvider } from '../pipeline';
|
|
24
25
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
@@ -129,11 +130,11 @@ export class GreetingResponder {
|
|
|
129
130
|
// TODO(dboreham): Add tests for idempotence and transactional integrity over the greet flow.
|
|
130
131
|
(this._greeterPlugin as any).once('peer:joined', (joinedPeerId: Buffer) => {
|
|
131
132
|
if (joinedPeerId.equals(invitation.id)) {
|
|
132
|
-
log(`Initiator connected: ${
|
|
133
|
+
log(`Initiator connected: ${PublicKey.stringify(joinedPeerId)}`);
|
|
133
134
|
this._state = GreetingState.CONNECTED;
|
|
134
135
|
this.connected.emit(invitation.id);
|
|
135
136
|
} else {
|
|
136
|
-
log(`Unexpected initiator connected: ${
|
|
137
|
+
log(`Unexpected initiator connected: ${PublicKey.stringify(joinedPeerId)}`);
|
|
137
138
|
}
|
|
138
139
|
});
|
|
139
140
|
|
|
@@ -157,7 +158,7 @@ export class GreetingResponder {
|
|
|
157
158
|
label: 'Greeting responder'
|
|
158
159
|
});
|
|
159
160
|
|
|
160
|
-
log(`Greeting for: ${this._partyProcessor.partyKey.toHex()} on swarmKey ${
|
|
161
|
+
log(`Greeting for: ${this._partyProcessor.partyKey.toHex()} on swarmKey ${PublicKey.stringify(this._swarmKey)}`);
|
|
161
162
|
|
|
162
163
|
this._state = GreetingState.LISTENING;
|
|
163
164
|
log('Listening');
|
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
SignedMessage,
|
|
20
20
|
codec
|
|
21
21
|
} from '@dxos/credentials';
|
|
22
|
-
import {
|
|
22
|
+
import { randomBytes, verify } from '@dxos/crypto';
|
|
23
23
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
24
|
+
import { PublicKey } from '@dxos/protocols';
|
|
24
25
|
|
|
25
26
|
import { InvalidInvitationError } from '../packlets/errors';
|
|
26
27
|
import { CredentialsSigner } from '../protocol';
|
|
@@ -65,7 +66,7 @@ export class HaloRecoveryInitiator {
|
|
|
65
66
|
|
|
66
67
|
// This is a temporary connection, there is no need to any special or permanent ID.
|
|
67
68
|
this._peerId = randomBytes();
|
|
68
|
-
log('Local PeerId:',
|
|
69
|
+
log('Local PeerId:', PublicKey.stringify(this._peerId));
|
|
69
70
|
|
|
70
71
|
const swarmKey = this._credentialsSigner.getIdentityKey().publicKey.asBuffer();
|
|
71
72
|
|
|
@@ -101,7 +102,7 @@ export class HaloRecoveryInitiator {
|
|
|
101
102
|
|
|
102
103
|
// Send to the first peer (any peer will do).
|
|
103
104
|
const peer = this._greeterPlugin.peers[0];
|
|
104
|
-
const responderPeerId =
|
|
105
|
+
const responderPeerId = PublicKey.bufferize(peer.getSession().peerId);
|
|
105
106
|
|
|
106
107
|
// Synthesize an "invitationID" which is the signature of both peerIds signed by our Identity key.
|
|
107
108
|
const signature = this._credentialsSigner.signer.rawSign(
|
|
@@ -6,9 +6,10 @@ import assert from 'assert';
|
|
|
6
6
|
import base from 'base-x';
|
|
7
7
|
import stableStringify from 'json-stable-stringify';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { ripemd160 } from '@dxos/crypto';
|
|
10
10
|
import { SwarmKey } from '@dxos/echo-protocol';
|
|
11
11
|
import * as proto from '@dxos/echo-protocol';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
13
|
|
|
13
14
|
import { InvalidInvitationError } from '../packlets/errors';
|
|
14
15
|
|
|
@@ -45,8 +46,8 @@ export class InvitationDescriptor {
|
|
|
45
46
|
static fromQueryParameters (queryParameters: InvitationQueryParameters): InvitationDescriptor {
|
|
46
47
|
const { hash, swarmKey, invitation, identityKey, type } = queryParameters;
|
|
47
48
|
|
|
48
|
-
const descriptor = new InvitationDescriptor(parseInvitationType(type),
|
|
49
|
-
|
|
49
|
+
const descriptor = new InvitationDescriptor(parseInvitationType(type), PublicKey.bufferize(swarmKey),
|
|
50
|
+
PublicKey.bufferize(invitation), identityKey ? PublicKey.from(identityKey) : undefined);
|
|
50
51
|
|
|
51
52
|
if (hash !== descriptor.hash) {
|
|
52
53
|
throw new InvalidInvitationError();
|
|
@@ -103,8 +104,8 @@ export class InvitationDescriptor {
|
|
|
103
104
|
*/
|
|
104
105
|
toQueryParameters (): InvitationQueryParameters {
|
|
105
106
|
const query: Partial<InvitationQueryParameters> = {
|
|
106
|
-
swarmKey:
|
|
107
|
-
invitation:
|
|
107
|
+
swarmKey: PublicKey.stringify(this.swarmKey),
|
|
108
|
+
invitation: PublicKey.stringify(this.invitation),
|
|
108
109
|
type: stringifyInvitationType(this.type)
|
|
109
110
|
};
|
|
110
111
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
|
|
7
7
|
import { createPartyInvitationMessage, Message as HaloMessage } from '@dxos/credentials';
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { FeedWriter } from '@dxos/echo-protocol';
|
|
10
9
|
import { NetworkManager } from '@dxos/network-manager';
|
|
10
|
+
import { PublicKey } from '@dxos/protocols';
|
|
11
11
|
|
|
12
12
|
import { PartyStateProvider } from '../pipeline';
|
|
13
13
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
@@ -20,8 +20,9 @@ import {
|
|
|
20
20
|
SignedMessage,
|
|
21
21
|
codec
|
|
22
22
|
} from '@dxos/credentials';
|
|
23
|
-
import {
|
|
23
|
+
import { randomBytes } from '@dxos/crypto';
|
|
24
24
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
25
|
+
import { PublicKey } from '@dxos/protocols';
|
|
25
26
|
|
|
26
27
|
import { InvalidInvitationError } from '../packlets/errors';
|
|
27
28
|
import { CredentialsSigner } from '../protocol';
|
|
@@ -65,7 +66,7 @@ export class OfflineInvitationClaimer {
|
|
|
65
66
|
|
|
66
67
|
// This is a temporary connection, there is no need to any special or permanent ID.
|
|
67
68
|
const localPeerId = randomBytes();
|
|
68
|
-
log('Local PeerId:',
|
|
69
|
+
log('Local PeerId:', PublicKey.stringify(localPeerId));
|
|
69
70
|
|
|
70
71
|
this._greeterPlugin = new GreetingCommandPlugin(localPeerId, async () => false);
|
|
71
72
|
|
|
@@ -99,7 +100,7 @@ export class OfflineInvitationClaimer {
|
|
|
99
100
|
const { invitation: invitationID } = this._invitationDescriptor;
|
|
100
101
|
|
|
101
102
|
// Send to the first peer (any peer will do).
|
|
102
|
-
const responderPeerId =
|
|
103
|
+
const responderPeerId = PublicKey.bufferize(this._greeterPlugin.peers[0].getSession().peerId);
|
|
103
104
|
|
|
104
105
|
// We expect to receive a new swarm/rendezvousKey to use for the full Greeting process.
|
|
105
106
|
const claimResponse = await this._greeterPlugin.send(
|
|
@@ -6,10 +6,10 @@ import expect from 'expect';
|
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
8
|
import { promiseTimeout } from '@dxos/async';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { EchoEnvelope, MockFeedWriter, Timeframe } from '@dxos/echo-protocol';
|
|
11
10
|
import { ModelFactory } from '@dxos/model-factory';
|
|
12
11
|
import { ObjectModel } from '@dxos/object-model';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
|
|
14
14
|
import { DataMirror } from './data-mirror';
|
|
15
15
|
import { DataServiceHost } from './data-service-host';
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { failUndefined } from '@dxos/debug';
|
|
10
9
|
import { DataService } from '@dxos/echo-protocol';
|
|
11
10
|
import { Model } from '@dxos/model-factory';
|
|
11
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
12
|
|
|
13
13
|
import { Entity } from './entity';
|
|
14
14
|
import { ItemManager } from './item-manager';
|
|
@@ -6,7 +6,6 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { Stream } from '@dxos/codec-protobuf';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { failUndefined, raise } from '@dxos/debug';
|
|
11
10
|
import {
|
|
12
11
|
EchoEnvelope,
|
|
@@ -17,6 +16,7 @@ import {
|
|
|
17
16
|
SubscribeEntityStreamRequest,
|
|
18
17
|
SubscribeEntityStreamResponse
|
|
19
18
|
} from '@dxos/echo-protocol';
|
|
19
|
+
import { PublicKey } from '@dxos/protocols';
|
|
20
20
|
|
|
21
21
|
import { EntityNotFoundError } from '../errors';
|
|
22
22
|
import { Item } from './item';
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
|
|
7
7
|
import { Event, synchronized } from '@dxos/async';
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
10
9
|
import { Model, ModelConstructor, ModelFactory, validateModelClass } from '@dxos/model-factory';
|
|
11
10
|
import { ObjectModel } from '@dxos/object-model';
|
|
11
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
12
|
|
|
13
13
|
import { DataServiceHost } from './data-service-host';
|
|
14
14
|
import { DatabaseBackend } from './database-backend';
|
|
@@ -7,11 +7,12 @@ import expect from 'expect';
|
|
|
7
7
|
import { it as test } from 'mocha';
|
|
8
8
|
|
|
9
9
|
import { latch } from '@dxos/async';
|
|
10
|
-
import { createId
|
|
10
|
+
import { createId } from '@dxos/crypto';
|
|
11
11
|
import { checkType } from '@dxos/debug';
|
|
12
12
|
import { EchoEnvelope, MockFeedWriter, Timeframe } from '@dxos/echo-protocol';
|
|
13
13
|
import { ModelFactory, TestModel } from '@dxos/model-factory';
|
|
14
14
|
import { ObjectModel } from '@dxos/object-model';
|
|
15
|
+
import { PublicKey } from '@dxos/protocols';
|
|
15
16
|
|
|
16
17
|
import { Item } from './item';
|
|
17
18
|
import { ItemDemuxer } from './item-demuxer';
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
|
-
import { createId
|
|
8
|
+
import { createId } from '@dxos/crypto';
|
|
9
9
|
import { MockFeedWriter } from '@dxos/echo-protocol';
|
|
10
10
|
import { ModelFactory } from '@dxos/model-factory';
|
|
11
11
|
import { ObjectModel } from '@dxos/object-model';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
13
|
|
|
13
14
|
import { ItemManager } from './item-manager';
|
|
14
15
|
|
|
@@ -6,10 +6,11 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { Event, trigger } from '@dxos/async';
|
|
9
|
-
import { createId
|
|
9
|
+
import { createId } from '@dxos/crypto';
|
|
10
10
|
import { timed } from '@dxos/debug';
|
|
11
11
|
import { EchoEnvelope, FeedWriter, ItemID, ItemType, mapFeedWriter, ModelSnapshot } from '@dxos/echo-protocol';
|
|
12
12
|
import { Model, ModelFactory, ModelMessage, ModelType, StateManager } from '@dxos/model-factory';
|
|
13
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
14
|
|
|
14
15
|
import { UnknownModelError } from '../errors';
|
|
15
16
|
import { Entity } from './entity';
|
|
@@ -6,10 +6,10 @@ import expect from 'expect';
|
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
8
|
import { Event, promiseTimeout } from '@dxos/async';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
11
10
|
import { ModelFactory } from '@dxos/model-factory';
|
|
12
11
|
import { ObjectModel } from '@dxos/object-model';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
|
|
14
14
|
import { Entity } from '../entity';
|
|
15
15
|
import { Item } from '../item';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { PublicKey } from '@dxos/crypto';
|
|
6
5
|
import { EchoEnvelope, MockFeedWriter, Timeframe } from '@dxos/echo-protocol';
|
|
7
6
|
import { ModelFactory } from '@dxos/model-factory';
|
|
7
|
+
import { PublicKey } from '@dxos/protocols';
|
|
8
8
|
|
|
9
9
|
import { DataServiceHost } from './data-service-host';
|
|
10
10
|
import { DataServiceRouter } from './data-service-router';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { DXOSError } from '@dxos/debug';
|
|
6
|
+
import { ItemID } from '@dxos/echo-protocol';
|
|
7
|
+
import { PublicKey } from '@dxos/protocols';
|
|
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
|
+
}
|