@dxos/client 2.33.8-dev.c77ba621 → 2.33.9-dev.2637427f
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/browser.js +98368 -0
- package/dist/src/api/client.d.ts +2 -2
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +3 -3
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/client.test.js +7 -7
- package/dist/src/api/client.test.js.map +1 -1
- package/dist/src/api/invitations/invitation-proxy.js +4 -4
- package/dist/src/api/invitations/invitation-proxy.js.map +1 -1
- package/dist/src/api/invitations/invitation-request.js +2 -2
- package/dist/src/api/invitations/invitation-request.js.map +1 -1
- package/dist/src/api/proxies/echo-proxy.js +4 -4
- package/dist/src/api/proxies/echo-proxy.js.map +1 -1
- package/dist/src/api/proxies/halo-proxy.d.ts +6 -3
- package/dist/src/api/proxies/halo-proxy.d.ts.map +1 -1
- package/dist/src/api/proxies/halo-proxy.js +15 -3
- package/dist/src/api/proxies/halo-proxy.js.map +1 -1
- package/dist/src/index.d.ts +5 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -14
- package/dist/src/index.js.map +1 -1
- package/dist/src/proto/index.d.ts +3 -0
- package/dist/src/proto/index.d.ts.map +1 -0
- package/dist/src/proto/index.js +35 -0
- package/dist/src/proto/index.js.map +1 -0
- package/dist/src/proto/substitutions.d.ts +2 -2
- package/dist/src/proto/substitutions.d.ts.map +1 -1
- package/dist/src/proto/substitutions.js +1 -2
- package/dist/src/proto/substitutions.js.map +1 -1
- package/dist/src/services/impl/halo.d.ts.map +1 -1
- package/dist/src/services/impl/halo.js +14 -12
- package/dist/src/services/impl/halo.js.map +1 -1
- package/dist/src/services/impl/party.js +6 -6
- package/dist/src/services/impl/party.js.map +1 -1
- package/dist/src/services/impl/profile.d.ts.map +1 -1
- package/dist/src/services/impl/profile.js +6 -5
- package/dist/src/services/impl/profile.js.map +1 -1
- package/dist/src/services/impl/types.d.ts +1 -1
- package/dist/src/services/impl/types.d.ts.map +1 -1
- package/dist/src/services/services.test.js +2 -2
- package/dist/src/services/services.test.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -22
- package/src/api/client.test.ts +3 -3
- package/src/api/client.ts +2 -2
- package/src/api/invitations/invitation-proxy.ts +1 -1
- package/src/api/invitations/invitation-request.ts +1 -1
- package/src/api/proxies/echo-proxy.ts +3 -3
- package/src/api/proxies/halo-proxy.ts +22 -4
- package/src/index.ts +15 -3
- package/src/proto/index.ts +6 -0
- package/src/proto/substitutions.ts +1 -2
- package/src/services/impl/halo.ts +3 -1
- package/src/services/impl/party.ts +1 -1
- package/src/services/impl/profile.ts +2 -1
- package/src/services/impl/types.ts +1 -1
- package/src/services/services.test.ts +1 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.9-dev.2637427f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "DXOS.org",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
8
|
+
"browser": {
|
|
9
|
+
"./dist/src/index.js": "./dist/browser.js",
|
|
10
|
+
"node:assert": "assert"
|
|
11
|
+
},
|
|
8
12
|
"files": [
|
|
9
13
|
"dist",
|
|
10
14
|
"src"
|
|
11
15
|
],
|
|
12
16
|
"dependencies": {
|
|
13
|
-
"@dxos/async": "2.33.
|
|
14
|
-
"@dxos/codec-protobuf": "2.33.
|
|
15
|
-
"@dxos/config": "2.33.
|
|
16
|
-
"@dxos/
|
|
17
|
-
"@dxos/
|
|
18
|
-
"@dxos/
|
|
19
|
-
"@dxos/
|
|
20
|
-
"@dxos/
|
|
21
|
-
"@dxos/feed-store": "2.33.8-dev.c77ba621",
|
|
22
|
-
"@dxos/model-factory": "2.33.8-dev.c77ba621",
|
|
23
|
-
"@dxos/network-manager": "2.33.8-dev.c77ba621",
|
|
24
|
-
"@dxos/object-model": "2.33.8-dev.c77ba621",
|
|
25
|
-
"@dxos/protocols": "2.33.8-dev.c77ba621",
|
|
26
|
-
"@dxos/rpc": "2.33.8-dev.c77ba621",
|
|
27
|
-
"@dxos/util": "2.33.8-dev.c77ba621",
|
|
17
|
+
"@dxos/async": "2.33.9-dev.2637427f",
|
|
18
|
+
"@dxos/codec-protobuf": "2.33.9-dev.2637427f",
|
|
19
|
+
"@dxos/config": "2.33.9-dev.2637427f",
|
|
20
|
+
"@dxos/debug": "2.33.9-dev.2637427f",
|
|
21
|
+
"@dxos/model-factory": "2.33.9-dev.2637427f",
|
|
22
|
+
"@dxos/protocols": "2.33.9-dev.2637427f",
|
|
23
|
+
"@dxos/rpc": "2.33.9-dev.2637427f",
|
|
24
|
+
"@dxos/util": "2.33.9-dev.2637427f",
|
|
28
25
|
"abstract-leveldown": "~7.0.0",
|
|
29
26
|
"assert": "^2.0.0",
|
|
30
27
|
"debug": "^4.3.3",
|
|
@@ -37,12 +34,20 @@
|
|
|
37
34
|
"uuid": "^8.3.2"
|
|
38
35
|
},
|
|
39
36
|
"devDependencies": {
|
|
37
|
+
"@dxos/credentials": "2.33.9-dev.2637427f",
|
|
38
|
+
"@dxos/crypto": "2.33.9-dev.2637427f",
|
|
39
|
+
"@dxos/echo-db": "2.33.9-dev.2637427f",
|
|
40
|
+
"@dxos/echo-protocol": "2.33.9-dev.2637427f",
|
|
40
41
|
"@dxos/eslint-plugin": "~1.0.34",
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
42
|
+
"@dxos/feed-store": "2.33.9-dev.2637427f",
|
|
43
|
+
"@dxos/network-manager": "2.33.9-dev.2637427f",
|
|
44
|
+
"@dxos/object-model": "2.33.9-dev.2637427f",
|
|
45
|
+
"@dxos/protocols-toolchain": "2.33.8",
|
|
46
|
+
"@dxos/random-access-multi-storage": "2.33.9-dev.2637427f",
|
|
47
|
+
"@dxos/testutils": "2.33.8",
|
|
48
|
+
"@koush/wrtc": "^0.5.3",
|
|
44
49
|
"@types/debug": "^4.1.7",
|
|
45
|
-
"@types/jest": "^
|
|
50
|
+
"@types/jest": "^28.1.6",
|
|
46
51
|
"@types/level-js": "~4.0.1",
|
|
47
52
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
48
53
|
"@types/memdown": "^3.0.0",
|
|
@@ -52,6 +57,7 @@
|
|
|
52
57
|
"@types/uuid": "~8.3.3",
|
|
53
58
|
"eslint": "^7.12.1",
|
|
54
59
|
"expect": "~27.0.2",
|
|
60
|
+
"jsonify": "^0.0.0",
|
|
55
61
|
"mocha": "~8.4.0",
|
|
56
62
|
"typescript": "^4.7.2",
|
|
57
63
|
"wait-for-expect": "^3.0.2"
|
|
@@ -60,12 +66,21 @@
|
|
|
60
66
|
"access": "public"
|
|
61
67
|
},
|
|
62
68
|
"toolchain": {
|
|
69
|
+
"bundlePackages": [
|
|
70
|
+
"@dxos/credentials",
|
|
71
|
+
"@dxos/crypto",
|
|
72
|
+
"@dxos/echo-db",
|
|
73
|
+
"@dxos/echo-protocol",
|
|
74
|
+
"@dxos/feed-store",
|
|
75
|
+
"@dxos/network-manager",
|
|
76
|
+
"@dxos/object-model"
|
|
77
|
+
],
|
|
63
78
|
"testingFramework": "mocha"
|
|
64
79
|
},
|
|
65
80
|
"scripts": {
|
|
66
81
|
"prebuild": "node -p \"'export const DXOS_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
67
|
-
"build": "npm run prebuild && toolchain
|
|
68
|
-
"build:test": "toolchain build:test",
|
|
82
|
+
"build": "npm run prebuild && toolchain bundle:library",
|
|
83
|
+
"build:test": "toolchain build:test --bundle",
|
|
69
84
|
"lint": "toolchain lint",
|
|
70
85
|
"test": "toolchain test"
|
|
71
86
|
}
|
package/src/api/client.test.ts
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import assert from 'assert';
|
|
6
5
|
import expect from 'expect';
|
|
7
6
|
import { it as test } from 'mocha';
|
|
7
|
+
import assert from 'node:assert';
|
|
8
8
|
import waitForExpect from 'wait-for-expect';
|
|
9
9
|
|
|
10
10
|
import { sleep, waitForCondition } from '@dxos/async';
|
|
11
11
|
import { ConfigObject } from '@dxos/config';
|
|
12
|
-
import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/
|
|
12
|
+
import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/credentials';
|
|
13
13
|
import { throwUnhandledRejection } from '@dxos/debug';
|
|
14
14
|
import { InvitationDescriptor } from '@dxos/echo-db';
|
|
15
|
-
import { Timeframe } from '@dxos/echo-protocol';
|
|
16
15
|
import { TestModel } from '@dxos/model-factory';
|
|
17
16
|
import { ObjectModel } from '@dxos/object-model';
|
|
17
|
+
import { Timeframe } from '@dxos/protocols';
|
|
18
18
|
import { createBundledRpcServer, createLinkedPorts } from '@dxos/rpc';
|
|
19
19
|
import { afterTest } from '@dxos/testutils';
|
|
20
20
|
|
package/src/api/client.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import assert from 'assert';
|
|
6
5
|
import debug from 'debug';
|
|
6
|
+
import assert from 'node:assert';
|
|
7
7
|
|
|
8
8
|
import { synchronized } from '@dxos/async';
|
|
9
9
|
import { Config, ConfigObject } from '@dxos/config';
|
|
@@ -65,10 +65,10 @@ export class Client {
|
|
|
65
65
|
private readonly _options: ClientOptions;
|
|
66
66
|
private readonly _mode: Runtime.Client.Mode;
|
|
67
67
|
|
|
68
|
+
private _initialized = false;
|
|
68
69
|
private _serviceProvider!: ClientServiceProvider;
|
|
69
70
|
private _halo!: HaloProxy;
|
|
70
71
|
private _echo!: EchoProxy;
|
|
71
|
-
private _initialized = false;
|
|
72
72
|
|
|
73
73
|
// TODO(burdon): Expose some kind of stable ID (e.g., from HALO).
|
|
74
74
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import assert from 'assert';
|
|
5
|
+
import assert from 'node:assert';
|
|
6
6
|
|
|
7
7
|
import { Event, latch } from '@dxos/async';
|
|
8
8
|
import { failUndefined } from '@dxos/debug';
|
|
@@ -54,8 +54,8 @@ export class EchoProxy implements Echo {
|
|
|
54
54
|
private readonly _serviceProvider: ClientServiceProvider,
|
|
55
55
|
private readonly _haloProxy: HaloProxy
|
|
56
56
|
) {
|
|
57
|
-
this._modelFactory =
|
|
58
|
-
|
|
57
|
+
this._modelFactory = _serviceProvider instanceof ClientServiceHost
|
|
58
|
+
? _serviceProvider.echo.modelFactory : new ModelFactory();
|
|
59
59
|
|
|
60
60
|
this._modelFactory.registerModel(ObjectModel); // Register object-model by default.
|
|
61
61
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
|
-
import { DeviceInfo, KeyRecord } from '@dxos/credentials';
|
|
6
|
+
import { DeviceInfo, keyPairFromSeedPhrase, KeyRecord } from '@dxos/credentials';
|
|
7
7
|
import { Contact, CreateProfileOptions, InvitationDescriptor, PartyMember, ResultSet } from '@dxos/echo-db';
|
|
8
8
|
import { PublicKey } from '@dxos/protocols';
|
|
9
9
|
import { SubscriptionGroup } from '@dxos/util';
|
|
@@ -90,11 +90,29 @@ export class HaloProxy implements Halo {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Create Profile.
|
|
94
|
-
*
|
|
93
|
+
* Create Profile.
|
|
94
|
+
* Add Identity key if public and secret key are provided.
|
|
95
|
+
* Then initializes profile with given username.
|
|
96
|
+
* If no public and secret key or seedphrase are provided it relies on keyring to contain an identity key.
|
|
97
|
+
* Seedphrase must not be specified with existing keys.
|
|
95
98
|
* @returns User profile info.
|
|
96
99
|
*/
|
|
97
|
-
async createProfile ({
|
|
100
|
+
async createProfile ({
|
|
101
|
+
publicKey,
|
|
102
|
+
secretKey,
|
|
103
|
+
username,
|
|
104
|
+
seedphrase
|
|
105
|
+
}: CreateProfileOptions = {}): Promise<Profile> {
|
|
106
|
+
if (seedphrase && (publicKey || secretKey)) {
|
|
107
|
+
throw new Error('Seedphrase must not be specified with existing keys');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (seedphrase) {
|
|
111
|
+
const keyPair = keyPairFromSeedPhrase(seedphrase);
|
|
112
|
+
publicKey = keyPair.publicKey;
|
|
113
|
+
secretKey = keyPair.secretKey;
|
|
114
|
+
}
|
|
115
|
+
|
|
98
116
|
this._profile = await this._serviceProvider.services.ProfileService.createProfile({ publicKey, secretKey, username });
|
|
99
117
|
return this._profile;
|
|
100
118
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
export { generateSeedPhrase } from '@dxos/credentials';
|
|
6
|
+
|
|
5
7
|
export {
|
|
6
8
|
PARTY_ITEM_TYPE, // TODO(burdon): Remove?
|
|
9
|
+
TYPE_SCHEMA,
|
|
7
10
|
Entity,
|
|
8
11
|
Item,
|
|
9
12
|
Link,
|
|
@@ -15,7 +18,11 @@ export {
|
|
|
15
18
|
InvitationDescriptorType,
|
|
16
19
|
OpenProgress,
|
|
17
20
|
PartyMember,
|
|
18
|
-
ResultSet
|
|
21
|
+
ResultSet,
|
|
22
|
+
Schema,
|
|
23
|
+
SchemaDef,
|
|
24
|
+
SchemaField,
|
|
25
|
+
SchemaRef
|
|
19
26
|
} from '@dxos/echo-db';
|
|
20
27
|
|
|
21
28
|
export {
|
|
@@ -24,13 +31,18 @@ export {
|
|
|
24
31
|
} from '@dxos/echo-protocol';
|
|
25
32
|
|
|
26
33
|
export {
|
|
27
|
-
ObjectModel
|
|
34
|
+
ObjectModel,
|
|
35
|
+
OrderedList
|
|
28
36
|
} from '@dxos/object-model';
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
// TODO(wittjosiah): Remove.
|
|
39
|
+
export {
|
|
40
|
+
NetworkManager
|
|
41
|
+
} from '@dxos/network-manager';
|
|
31
42
|
|
|
32
43
|
export * from './api';
|
|
33
44
|
export * from './devtools';
|
|
45
|
+
export * from './proto';
|
|
34
46
|
export * from './services';
|
|
35
47
|
export * from './util';
|
|
36
48
|
export * from './version';
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { anySubstitutions, timestampSubstitutions } from '@dxos/codec-protobuf';
|
|
6
6
|
import { codec, Message } from '@dxos/credentials';
|
|
7
|
-
import { timeframeSubstitutions } from '@dxos/echo-protocol';
|
|
8
7
|
import type { ConnectionEvent } from '@dxos/network-manager';
|
|
9
|
-
import { publicKeySubstitutions } from '@dxos/protocols';
|
|
8
|
+
import { publicKeySubstitutions, timeframeSubstitutions } from '@dxos/protocols';
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
11
|
...timestampSubstitutions,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import assert from 'assert';
|
|
5
|
+
import assert from 'node:assert';
|
|
6
6
|
|
|
7
7
|
import { Stream } from '@dxos/codec-protobuf';
|
|
8
8
|
import { ECHO } from '@dxos/echo-db';
|
|
@@ -47,6 +47,8 @@ export class HaloService implements IHaloService {
|
|
|
47
47
|
assert(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), 'Key not inserted correctly.');
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// TODO(burdon): subscribeToContacts or just query/contacts with subscription object.
|
|
51
|
+
// ResultSet vs Stream?
|
|
50
52
|
subscribeContacts (): Stream<Contacts> {
|
|
51
53
|
if (this.echo.halo.identity) {
|
|
52
54
|
return resultSetToStream(this.echo.halo.queryContacts(), (contacts): Contacts => ({ contacts }));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import assert from 'assert';
|
|
5
|
+
import assert from 'node:assert';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
7
|
|
|
8
8
|
import { latch } from '@dxos/async';
|
|
@@ -30,6 +30,7 @@ import { CreateServicesOpts, InviteeInvitation, InviteeInvitations } from './typ
|
|
|
30
30
|
export class ProfileService implements IProfileService {
|
|
31
31
|
private inviteeInvitations: InviteeInvitations = new Map();
|
|
32
32
|
|
|
33
|
+
// TODO(burdon): Pass in HALO.
|
|
33
34
|
constructor (
|
|
34
35
|
private readonly echo: ECHO
|
|
35
36
|
) {}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Config } from '@dxos/config';
|
|
6
|
-
import { KeyRecord } from '@dxos/credentials';
|
|
7
6
|
import { ECHO } from '@dxos/echo-db';
|
|
8
7
|
|
|
9
8
|
import { SignRequest, SignResponse } from '../../proto/gen/dxos/client';
|
|
9
|
+
import { KeyRecord } from '../../proto/gen/dxos/halo/keys';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Signer plugin.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "2.33.
|
|
1
|
+
export const DXOS_VERSION = "2.33.8";
|