@dxos/client 2.29.1 → 2.29.2-dev.f64f2a6f
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/api/party-proxy.d.ts +4 -4
- package/dist/src/api/party-proxy.d.ts.map +1 -1
- package/dist/src/api/party-proxy.js +15 -15
- package/dist/src/api/party-proxy.js.map +1 -1
- package/dist/src/client/client.d.ts +1 -1
- package/dist/src/client/client.d.ts.map +1 -1
- package/dist/src/client/client.test.js +2 -1
- package/dist/src/client/client.test.js.map +1 -1
- package/dist/src/client/service-host/services/halo.d.ts.map +1 -1
- package/dist/src/client/service-host/services/halo.js +4 -1
- package/dist/src/client/service-host/services/halo.js.map +1 -1
- package/dist/src/devtools/items.js +2 -2
- package/dist/src/devtools/items.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -30
- package/src/api/party-proxy.ts +20 -20
- package/src/client/client.test.ts +2 -2
- package/src/client/service-host/services/halo.ts +5 -2
- package/src/devtools/items.ts +2 -2
- package/src/index.ts +1 -1
- package/src/shims.d.ts +0 -2
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.2-dev.f64f2a6f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "DXOS.org",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -9,26 +9,32 @@
|
|
|
9
9
|
"dist",
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"prebuild": "node -p \"'export const DXOS_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
14
|
+
"build": "npm run prebuild && toolchain build",
|
|
15
|
+
"build:test": "toolchain build:test",
|
|
16
|
+
"lint": "toolchain lint",
|
|
17
|
+
"test": "toolchain test"
|
|
18
|
+
},
|
|
12
19
|
"dependencies": {
|
|
13
|
-
"@dxos/async": "
|
|
14
|
-
"@dxos/codec-protobuf": "
|
|
15
|
-
"@dxos/config": "
|
|
16
|
-
"@dxos/credentials": "
|
|
17
|
-
"@dxos/crypto": "
|
|
18
|
-
"@dxos/debug": "
|
|
19
|
-
"@dxos/echo-db": "
|
|
20
|
-
"@dxos/echo-protocol": "
|
|
21
|
-
"@dxos/feed-store": "
|
|
22
|
-
"@dxos/model-factory": "
|
|
23
|
-
"@dxos/network-manager": "
|
|
24
|
-
"@dxos/object-model": "
|
|
25
|
-
"@dxos/protocols": "
|
|
26
|
-
"@dxos/rpc": "
|
|
27
|
-
"@dxos/util": "
|
|
20
|
+
"@dxos/async": "workspace:*",
|
|
21
|
+
"@dxos/codec-protobuf": "workspace:*",
|
|
22
|
+
"@dxos/config": "workspace:*",
|
|
23
|
+
"@dxos/credentials": "workspace:*",
|
|
24
|
+
"@dxos/crypto": "workspace:*",
|
|
25
|
+
"@dxos/debug": "workspace:*",
|
|
26
|
+
"@dxos/echo-db": "workspace:*",
|
|
27
|
+
"@dxos/echo-protocol": "workspace:*",
|
|
28
|
+
"@dxos/feed-store": "workspace:*",
|
|
29
|
+
"@dxos/model-factory": "workspace:*",
|
|
30
|
+
"@dxos/network-manager": "workspace:*",
|
|
31
|
+
"@dxos/object-model": "workspace:*",
|
|
32
|
+
"@dxos/protocols": "workspace:*",
|
|
33
|
+
"@dxos/rpc": "workspace:*",
|
|
34
|
+
"@dxos/util": "workspace:*",
|
|
28
35
|
"@polkadot/keyring": "6.11.1",
|
|
29
36
|
"@polkadot/util": "6.11.1",
|
|
30
37
|
"@polkadot/util-crypto": "6.11.1",
|
|
31
|
-
"@wirelineio/registry-client": "~1.1.0-beta.3",
|
|
32
38
|
"abstract-leveldown": "~7.0.0",
|
|
33
39
|
"assert": "^2.0.0",
|
|
34
40
|
"debug": "^4.3.3",
|
|
@@ -42,9 +48,9 @@
|
|
|
42
48
|
},
|
|
43
49
|
"devDependencies": {
|
|
44
50
|
"@dxos/eslint-plugin": "~1.0.27",
|
|
45
|
-
"@dxos/protocols-toolchain": "
|
|
46
|
-
"@dxos/random-access-multi-storage": "
|
|
47
|
-
"@dxos/testutils": "
|
|
51
|
+
"@dxos/protocols-toolchain": "workspace:*",
|
|
52
|
+
"@dxos/random-access-multi-storage": "workspace:*",
|
|
53
|
+
"@dxos/testutils": "workspace:*",
|
|
48
54
|
"@types/debug": "^4.1.7",
|
|
49
55
|
"@types/jest": "^26.0.7",
|
|
50
56
|
"@types/level-js": "~4.0.1",
|
|
@@ -64,13 +70,5 @@
|
|
|
64
70
|
},
|
|
65
71
|
"toolchain": {
|
|
66
72
|
"testingFramework": "mocha"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
"prebuild": "node -p \"'export const DXOS_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
70
|
-
"build": "npm run prebuild && toolchain build",
|
|
71
|
-
"build:test": "toolchain build:test",
|
|
72
|
-
"lint": "toolchain lint",
|
|
73
|
-
"test": "toolchain test"
|
|
74
|
-
},
|
|
75
|
-
"readme": "# @dxos/client\n\n[](https://github.com/standard/semistandard)\n[](https://github.com/RichardLitt/standard-readme)\n\nDescription...\n\n## Install\n\n## Usage\n\n...\n\n## Contributing\n\nPRs accepted.\n\n## License\n\nAGPL-3.0 © DXOS\n"
|
|
76
|
-
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/api/party-proxy.ts
CHANGED
|
@@ -69,6 +69,26 @@ export class Party {
|
|
|
69
69
|
return this._invitationProxy;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
get key () {
|
|
73
|
+
return this._key;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get isOpen () {
|
|
77
|
+
return this._isOpen;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get isActive () {
|
|
81
|
+
return this._isActive;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get database (): Database {
|
|
85
|
+
if (!this._database) {
|
|
86
|
+
throw Error('Party not open.');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return this._database;
|
|
90
|
+
}
|
|
91
|
+
|
|
72
92
|
/**
|
|
73
93
|
* Called by EchoProxy open.
|
|
74
94
|
*/
|
|
@@ -90,26 +110,6 @@ export class Party {
|
|
|
90
110
|
}
|
|
91
111
|
}
|
|
92
112
|
|
|
93
|
-
get key () {
|
|
94
|
-
return this._key;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
get isOpen () {
|
|
98
|
-
return this._isOpen;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
get isActive () {
|
|
102
|
-
return this._isActive;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
get database (): Database {
|
|
106
|
-
if (!this._database) {
|
|
107
|
-
throw Error('Party not open.');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return this._database;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
113
|
async open () {
|
|
114
114
|
return this.setOpen(true);
|
|
115
115
|
}
|
|
@@ -313,11 +313,11 @@ describe('Client', () => {
|
|
|
313
313
|
const client = new Client(config);
|
|
314
314
|
await client.initialize();
|
|
315
315
|
client.registerModel(TestModel);
|
|
316
|
+
// TODO(burdon): Better error if halo is not created.
|
|
316
317
|
await client.halo.createProfile({ username: 'test-user' });
|
|
317
318
|
const party = await client.echo.createParty();
|
|
318
319
|
const item = await party.database.createItem({ model: TestModel, type: 'test' });
|
|
319
320
|
await item.model.set('prop', 'value1');
|
|
320
|
-
|
|
321
321
|
await client.destroy();
|
|
322
322
|
}
|
|
323
323
|
|
|
@@ -330,7 +330,7 @@ describe('Client', () => {
|
|
|
330
330
|
client.registerModel(TestModel);
|
|
331
331
|
|
|
332
332
|
const party = client.echo.queryParties().first;
|
|
333
|
-
const result = party.database.select({ type: 'test' }).
|
|
333
|
+
const result = party.database.select({ type: 'test' }).exec();
|
|
334
334
|
await result.update.waitForCondition(() => result.entities.length > 0);
|
|
335
335
|
const item = result.expectOne();
|
|
336
336
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
// TODO(burdon): Factor out polkadot deps (plugin?)
|
|
5
6
|
import PolkadotKeyring from '@polkadot/keyring';
|
|
6
7
|
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
|
7
8
|
import assert from 'assert';
|
|
@@ -59,11 +60,11 @@ export class HaloService implements IHaloService {
|
|
|
59
60
|
assert(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), 'Key not inserted correctly.');
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
// TODO(burdon): Factor out polkadot deps (plugin?)
|
|
62
64
|
private async polkadotSign (key: KeyRecord, payload: Uint8Array): Promise<SignResponse> {
|
|
63
65
|
await cryptoWaitReady();
|
|
64
66
|
|
|
65
67
|
assert(key.secretKey, 'Secret key is missing.');
|
|
66
|
-
|
|
67
68
|
const keyring = new PolkadotKeyring({ type: 'sr25519' });
|
|
68
69
|
const keypair = keyring.addFromUri(key.secretKey.toString());
|
|
69
70
|
|
|
@@ -72,6 +73,7 @@ export class HaloService implements IHaloService {
|
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
// TODO(burdon): Factor out polkadot deps (plugin?)
|
|
75
77
|
async sign (request: SignRequest): Promise<SignResponse> {
|
|
76
78
|
assert(request.publicKey, 'Provide a publicKey of the key that should be used for signing.');
|
|
77
79
|
const key = await this.echo.halo.keyring.getFullKey(request.publicKey);
|
|
@@ -80,7 +82,8 @@ export class HaloService implements IHaloService {
|
|
|
80
82
|
assert(request.payload, 'No payload to sign.');
|
|
81
83
|
return this.polkadotSign(key, request.payload);
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
|
|
86
|
+
throw new Error('Only DXNS address key signing is supported.');
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
async setGlobalPreference (request: SetPreferenceRequest): Promise<void> {
|
package/src/devtools/items.ts
CHANGED
|
@@ -19,7 +19,7 @@ const getData = (echo: DevtoolsServiceDependencies['echo']): SubscribeToItemsRes
|
|
|
19
19
|
items: []
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const queryResult = party.database.select().
|
|
22
|
+
const queryResult = party.database.select().exec();
|
|
23
23
|
for (const item of queryResult.entities) {
|
|
24
24
|
partyInfo.items.push({
|
|
25
25
|
id: item.id,
|
|
@@ -48,7 +48,7 @@ export const subscribeToItems = ({ echo }: DevtoolsServiceDependencies) => {
|
|
|
48
48
|
const unsubscribe = echo.queryParties().subscribe((parties) => {
|
|
49
49
|
parties.forEach(party => {
|
|
50
50
|
if (!partySubscriptions[party.key.toHex()]) {
|
|
51
|
-
const sub = party.database.select().
|
|
51
|
+
const sub = party.database.select().exec().update.on(() => {
|
|
52
52
|
// Send updates on items changes.
|
|
53
53
|
update();
|
|
54
54
|
});
|
package/src/index.ts
CHANGED
package/src/shims.d.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "2.
|
|
1
|
+
export const DXOS_VERSION = "2.29.1";
|