@dxos/client-services 0.1.53-main.972e6e3 → 0.1.53-main.a67c9cf
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/lib/browser/{chunk-CPSUVMSC.mjs → chunk-6ITWCQIT.mjs} +16 -15
- package/dist/lib/browser/{chunk-CPSUVMSC.mjs.map → chunk-6ITWCQIT.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +14 -13
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +14 -13
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/packlets/spaces/spaces-service.ts +20 -24
|
@@ -20,6 +20,6 @@ export declare class SpacesServiceImpl implements SpacesService {
|
|
|
20
20
|
queryCredentials({ spaceKey }: QueryCredentialsRequest): Stream<Credential>;
|
|
21
21
|
writeCredentials({ spaceKey, credentials }: WriteCredentialsRequest): Promise<void>;
|
|
22
22
|
createEpoch({ spaceKey }: CreateEpochRequest): Promise<void>;
|
|
23
|
-
private
|
|
23
|
+
private _serializeSpace;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=spaces-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaces-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/spaces-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAGjG,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,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Aa,EAAE,YAAY,EAC3B,yBAAyB,EAAE,wBAAwB,EACnD,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAGtE,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;IAU7B,WAAW,CAAC,OAAO,EAAE,kBAAkB;IAI7C,WAAW,IAAI,MAAM,CAAC,mBAAmB,CAAC;IAmDpC,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB;IAMpE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,wBAAwB;IAajE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAcrE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAOnE,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB;IAMlD,OAAO,CAAC,eAAe;CAsCxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.1.53-main.
|
|
3
|
+
"version": "0.1.53-main.a67c9cf",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -21,40 +21,40 @@
|
|
|
21
21
|
"src"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dxos/async": "0.1.53-main.
|
|
25
|
-
"@dxos/client-protocol": "0.1.53-main.
|
|
26
|
-
"@dxos/codec-protobuf": "0.1.53-main.
|
|
27
|
-
"@dxos/config": "0.1.53-main.
|
|
28
|
-
"@dxos/context": "0.1.53-main.
|
|
29
|
-
"@dxos/credentials": "0.1.53-main.
|
|
30
|
-
"@dxos/crypto": "0.1.53-main.
|
|
31
|
-
"@dxos/debug": "0.1.53-main.
|
|
32
|
-
"@dxos/document-model": "0.1.53-main.
|
|
33
|
-
"@dxos/echo-db": "0.1.53-main.
|
|
34
|
-
"@dxos/echo-pipeline": "0.1.53-main.
|
|
35
|
-
"@dxos/errors": "0.1.53-main.
|
|
36
|
-
"@dxos/feed-store": "0.1.53-main.
|
|
37
|
-
"@dxos/keyring": "0.1.53-main.
|
|
38
|
-
"@dxos/keys": "0.1.53-main.
|
|
39
|
-
"@dxos/lock-file": "0.1.53-main.
|
|
40
|
-
"@dxos/log": "0.1.53-main.
|
|
41
|
-
"@dxos/messaging": "0.1.53-main.
|
|
42
|
-
"@dxos/model-factory": "0.1.53-main.
|
|
43
|
-
"@dxos/network-manager": "0.1.53-main.
|
|
44
|
-
"@dxos/node-std": "0.1.53-main.
|
|
45
|
-
"@dxos/protocols": "0.1.53-main.
|
|
46
|
-
"@dxos/random-access-storage": "0.1.53-main.
|
|
47
|
-
"@dxos/rpc": "0.1.53-main.
|
|
48
|
-
"@dxos/teleport": "0.1.53-main.
|
|
49
|
-
"@dxos/teleport-extension-gossip": "0.1.53-main.
|
|
50
|
-
"@dxos/teleport-extension-object-sync": "0.1.53-main.
|
|
51
|
-
"@dxos/text-model": "0.1.53-main.
|
|
52
|
-
"@dxos/timeframe": "0.1.53-main.
|
|
53
|
-
"@dxos/util": "0.1.53-main.
|
|
24
|
+
"@dxos/async": "0.1.53-main.a67c9cf",
|
|
25
|
+
"@dxos/client-protocol": "0.1.53-main.a67c9cf",
|
|
26
|
+
"@dxos/codec-protobuf": "0.1.53-main.a67c9cf",
|
|
27
|
+
"@dxos/config": "0.1.53-main.a67c9cf",
|
|
28
|
+
"@dxos/context": "0.1.53-main.a67c9cf",
|
|
29
|
+
"@dxos/credentials": "0.1.53-main.a67c9cf",
|
|
30
|
+
"@dxos/crypto": "0.1.53-main.a67c9cf",
|
|
31
|
+
"@dxos/debug": "0.1.53-main.a67c9cf",
|
|
32
|
+
"@dxos/document-model": "0.1.53-main.a67c9cf",
|
|
33
|
+
"@dxos/echo-db": "0.1.53-main.a67c9cf",
|
|
34
|
+
"@dxos/echo-pipeline": "0.1.53-main.a67c9cf",
|
|
35
|
+
"@dxos/errors": "0.1.53-main.a67c9cf",
|
|
36
|
+
"@dxos/feed-store": "0.1.53-main.a67c9cf",
|
|
37
|
+
"@dxos/keyring": "0.1.53-main.a67c9cf",
|
|
38
|
+
"@dxos/keys": "0.1.53-main.a67c9cf",
|
|
39
|
+
"@dxos/lock-file": "0.1.53-main.a67c9cf",
|
|
40
|
+
"@dxos/log": "0.1.53-main.a67c9cf",
|
|
41
|
+
"@dxos/messaging": "0.1.53-main.a67c9cf",
|
|
42
|
+
"@dxos/model-factory": "0.1.53-main.a67c9cf",
|
|
43
|
+
"@dxos/network-manager": "0.1.53-main.a67c9cf",
|
|
44
|
+
"@dxos/node-std": "0.1.53-main.a67c9cf",
|
|
45
|
+
"@dxos/protocols": "0.1.53-main.a67c9cf",
|
|
46
|
+
"@dxos/random-access-storage": "0.1.53-main.a67c9cf",
|
|
47
|
+
"@dxos/rpc": "0.1.53-main.a67c9cf",
|
|
48
|
+
"@dxos/teleport": "0.1.53-main.a67c9cf",
|
|
49
|
+
"@dxos/teleport-extension-gossip": "0.1.53-main.a67c9cf",
|
|
50
|
+
"@dxos/teleport-extension-object-sync": "0.1.53-main.a67c9cf",
|
|
51
|
+
"@dxos/text-model": "0.1.53-main.a67c9cf",
|
|
52
|
+
"@dxos/timeframe": "0.1.53-main.a67c9cf",
|
|
53
|
+
"@dxos/util": "0.1.53-main.a67c9cf"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/readable-stream": "^2.3.9",
|
|
57
|
-
"@dxos/signal": "0.1.53-main.
|
|
57
|
+
"@dxos/signal": "0.1.53-main.a67c9cf"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { EventSubscriptions, scheduleTask } from '@dxos/async';
|
|
5
|
+
import { EventSubscriptions, UpdateScheduler, scheduleTask } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf';
|
|
7
7
|
import { raise, todo } from '@dxos/debug';
|
|
8
8
|
import { DataServiceSubscriptions, SpaceManager, SpaceNotFoundError } from '@dxos/echo-pipeline';
|
|
@@ -28,8 +28,6 @@ import { IdentityManager } from '../identity';
|
|
|
28
28
|
import { DataSpace } from './data-space';
|
|
29
29
|
import { DataSpaceManager } from './data-space-manager';
|
|
30
30
|
|
|
31
|
-
const TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
|
|
32
|
-
|
|
33
31
|
export class SpacesServiceImpl implements SpacesService {
|
|
34
32
|
constructor(
|
|
35
33
|
private readonly _identityManager: IdentityManager,
|
|
@@ -45,7 +43,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
45
43
|
|
|
46
44
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
47
45
|
const space = await dataSpaceManager.createSpace();
|
|
48
|
-
return this.
|
|
46
|
+
return this._serializeSpace(space);
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
async updateSpace(request: UpdateSpaceRequest) {
|
|
@@ -54,12 +52,16 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
54
52
|
|
|
55
53
|
querySpaces(): Stream<QuerySpacesResponse> {
|
|
56
54
|
return new Stream<QuerySpacesResponse>(({ next, ctx }) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
const scheduler = new UpdateScheduler(
|
|
56
|
+
ctx,
|
|
57
|
+
async () => {
|
|
58
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
59
|
+
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
60
|
+
log('update', { spaces });
|
|
61
|
+
next({ spaces });
|
|
62
|
+
},
|
|
63
|
+
{ maxFrequency: 2 },
|
|
64
|
+
);
|
|
63
65
|
|
|
64
66
|
scheduleTask(ctx, async () => {
|
|
65
67
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
@@ -72,31 +74,25 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
72
74
|
subscriptions.clear();
|
|
73
75
|
|
|
74
76
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
75
|
-
subscriptions.add(space.stateUpdate.on(ctx,
|
|
76
|
-
subscriptions.add(space.presence.updated.on(ctx,
|
|
77
|
-
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx,
|
|
77
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.trigger()));
|
|
78
|
+
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
79
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
78
80
|
|
|
79
81
|
// Pipeline progress.
|
|
80
|
-
space.inner.controlPipeline.state.timeframeUpdate
|
|
81
|
-
.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME)
|
|
82
|
-
.on(ctx, onUpdate);
|
|
82
|
+
space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
|
|
83
83
|
if (space.dataPipeline.pipelineState) {
|
|
84
|
-
subscriptions.add(
|
|
85
|
-
space.dataPipeline.pipelineState.timeframeUpdate
|
|
86
|
-
.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME)
|
|
87
|
-
.on(ctx, onUpdate),
|
|
88
|
-
);
|
|
84
|
+
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
87
|
};
|
|
92
88
|
|
|
93
89
|
dataSpaceManager.updated.on(ctx, () => {
|
|
94
90
|
subscribeSpaces();
|
|
95
|
-
|
|
91
|
+
scheduler.trigger();
|
|
96
92
|
});
|
|
97
93
|
subscribeSpaces();
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
scheduler.trigger();
|
|
100
96
|
});
|
|
101
97
|
|
|
102
98
|
if (!this._identityManager.identity) {
|
|
@@ -151,7 +147,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
151
147
|
await space.createEpoch();
|
|
152
148
|
}
|
|
153
149
|
|
|
154
|
-
private
|
|
150
|
+
private _serializeSpace(space: DataSpace): Space {
|
|
155
151
|
return {
|
|
156
152
|
spaceKey: space.key,
|
|
157
153
|
state: space.state,
|