@dxos/client-services 0.8.1 → 0.8.2-main.10c050d
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-MHDASPY5.mjs → chunk-LY3V7LMQ.mjs} +535 -551
- package/dist/lib/browser/chunk-LY3V7LMQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-A2WCOW6P.cjs → chunk-LYHT7662.cjs} +704 -709
- package/dist/lib/node/chunk-LYHT7662.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/{chunk-SK52YZK7.mjs → chunk-LLRVFL7L.mjs} +535 -540
- package/dist/lib/node-esm/chunk-LLRVFL7L.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/browser.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/node.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +3 -1
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +1 -0
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-registry.d.ts.map +1 -1
- package/dist/types/src/packlets/services/util.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +1 -1
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -38
- package/src/packlets/agents/edge-agent-manager.ts +6 -6
- package/src/packlets/agents/edge-agent-service.ts +8 -11
- package/src/packlets/devices/devices-service.ts +5 -3
- package/src/packlets/identity/authenticator.ts +2 -2
- package/src/packlets/identity/default-space-state-machine.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +13 -9
- package/src/packlets/identity/identity-recovery-manager.ts +6 -4
- package/src/packlets/identity/identity-service.ts +4 -4
- package/src/packlets/identity/identity.test.ts +9 -6
- package/src/packlets/identity/identity.ts +5 -5
- package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
- package/src/packlets/invitations/edge-invitation-handler.ts +3 -3
- package/src/packlets/invitations/invitation-guest-extenstion.ts +3 -3
- package/src/packlets/invitations/invitation-host-extension.ts +5 -5
- package/src/packlets/invitations/invitation-topology.ts +1 -1
- package/src/packlets/invitations/invitations-handler.ts +2 -2
- package/src/packlets/invitations/invitations-manager.ts +15 -4
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
- package/src/packlets/locks/browser.ts +4 -4
- package/src/packlets/locks/node.ts +2 -2
- package/src/packlets/logging/logging-service.ts +2 -2
- package/src/packlets/network/network-service.ts +11 -17
- package/src/packlets/services/client-rpc-server.ts +2 -2
- package/src/packlets/services/service-context.ts +10 -6
- package/src/packlets/services/service-host.ts +13 -5
- package/src/packlets/services/service-registry.ts +3 -3
- package/src/packlets/space-export/space-archive-reader.ts +2 -1
- package/src/packlets/space-export/space-archive-writer.ts +3 -3
- package/src/packlets/spaces/automerge-space-state.ts +3 -3
- package/src/packlets/spaces/data-space-manager.ts +47 -41
- package/src/packlets/spaces/data-space.ts +27 -20
- package/src/packlets/spaces/edge-feed-replicator.test.ts +2 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +14 -13
- package/src/packlets/spaces/epoch-migrations.ts +3 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +1 -1
- package/src/packlets/spaces/notarization-plugin.ts +18 -18
- package/src/packlets/spaces/spaces-service.ts +7 -6
- package/src/packlets/storage/profile-archive.ts +2 -1
- package/src/packlets/system/system-service.ts +2 -2
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/worker/worker-runtime.ts +4 -4
- package/src/packlets/worker/worker-session.ts +3 -3
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-MHDASPY5.mjs.map +0 -7
- package/dist/lib/node/chunk-A2WCOW6P.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SK52YZK7.mjs.map +0 -7
|
@@ -106,7 +106,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
setActiveEdgePollingEnabled(enabled: boolean) {
|
|
109
|
+
setActiveEdgePollingEnabled(enabled: boolean): void {
|
|
110
110
|
const client = this._edgeClient;
|
|
111
111
|
invariant(client);
|
|
112
112
|
this._activeEdgePollingEnabled = enabled;
|
|
@@ -123,7 +123,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
123
123
|
return !!this._writer;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
protected override async _open() {
|
|
126
|
+
protected override async _open(): Promise<void> {
|
|
127
127
|
if (this._edgeClient) {
|
|
128
128
|
if (this._activeEdgePollingEnabled) {
|
|
129
129
|
this._startPeriodicEdgePolling(this._edgeClient);
|
|
@@ -134,7 +134,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
protected override async _close() {
|
|
137
|
+
protected override async _close(): Promise<void> {
|
|
138
138
|
this._stopPeriodicEdgePolling();
|
|
139
139
|
await this._ctx.dispose();
|
|
140
140
|
}
|
|
@@ -149,7 +149,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
149
149
|
retryTimeout = DEFAULT_RETRY_TIMEOUT,
|
|
150
150
|
successDelay = DEFAULT_SUCCESS_DELAY,
|
|
151
151
|
edgeRetryJitter,
|
|
152
|
-
}: NotarizeParams) {
|
|
152
|
+
}: NotarizeParams): Promise<void> {
|
|
153
153
|
log('notarize', { credentials });
|
|
154
154
|
invariant(
|
|
155
155
|
credentials.every((credential) => credential.id),
|
|
@@ -194,7 +194,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
194
194
|
ctx: Context,
|
|
195
195
|
credentials: Credential[],
|
|
196
196
|
{ retryTimeout, successDelay }: NotarizationTimeouts,
|
|
197
|
-
) {
|
|
197
|
+
): void {
|
|
198
198
|
const peersTried = new Set<NotarizationTeleportExtension>();
|
|
199
199
|
|
|
200
200
|
// Repeatable task that tries to notarize credentials with one of the available peers.
|
|
@@ -238,7 +238,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
238
238
|
client: EdgeHttpClient,
|
|
239
239
|
credentials: Credential[],
|
|
240
240
|
timeouts: NotarizationTimeouts & { jitter?: number },
|
|
241
|
-
) {
|
|
241
|
+
): void {
|
|
242
242
|
const encodedCredentials = credentials.map((credential) => {
|
|
243
243
|
const binary = credentialCodec.encode(credential);
|
|
244
244
|
return Buffer.from(binary).toString('base64');
|
|
@@ -261,7 +261,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
261
261
|
/**
|
|
262
262
|
* Called with credentials arriving from the control pipeline.
|
|
263
263
|
*/
|
|
264
|
-
async processCredential(credential: Credential) {
|
|
264
|
+
async processCredential(credential: Credential): Promise<void> {
|
|
265
265
|
if (!credential.id) {
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
@@ -270,7 +270,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
270
270
|
this._processCredentialsTriggers.delete(credential.id);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
setWriter(writer: FeedWriter<Credential>) {
|
|
273
|
+
setWriter(writer: FeedWriter<Credential>): void {
|
|
274
274
|
invariant(!this._writer, 'Writer already set.');
|
|
275
275
|
this._writer = writer;
|
|
276
276
|
if (this._edgeClient && this.isOpen) {
|
|
@@ -278,7 +278,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
private _startPeriodicEdgePolling(client: EdgeHttpClient) {
|
|
281
|
+
private _startPeriodicEdgePolling(client: EdgeHttpClient): void {
|
|
282
282
|
this._activeEdgePollingIntervalHandle = setInterval(() => {
|
|
283
283
|
if (this._writer) {
|
|
284
284
|
this._notarizePendingEdgeCredentials(client, this._writer);
|
|
@@ -286,7 +286,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
286
286
|
}, this._activeEdgePollingInterval);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
private _stopPeriodicEdgePolling() {
|
|
289
|
+
private _stopPeriodicEdgePolling(): void {
|
|
290
290
|
if (this._activeEdgePollingIntervalHandle) {
|
|
291
291
|
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
292
292
|
this._activeEdgePollingIntervalHandle = undefined;
|
|
@@ -299,7 +299,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
299
299
|
* this method will fix it on the next space open.
|
|
300
300
|
* Given how rarely this happens there's no need to poll the endpoint.
|
|
301
301
|
*/
|
|
302
|
-
private _notarizePendingEdgeCredentials(client: EdgeHttpClient, writer: FeedWriter<Credential>) {
|
|
302
|
+
private _notarizePendingEdgeCredentials(client: EdgeHttpClient, writer: FeedWriter<Credential>): void {
|
|
303
303
|
scheduleMicroTask(this._ctx, async () => {
|
|
304
304
|
try {
|
|
305
305
|
const response = await client.getCredentialsForNotarization(this._spaceId, {
|
|
@@ -328,7 +328,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
private async _waitUntilProcessed(id: PublicKey) {
|
|
331
|
+
private async _waitUntilProcessed(id: PublicKey): Promise<void> {
|
|
332
332
|
if (this._processedCredentials.has(id)) {
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
@@ -338,14 +338,14 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
338
338
|
/**
|
|
339
339
|
* Requests from other peers to notarize credentials.
|
|
340
340
|
*/
|
|
341
|
-
private async _onNotarize(request: NotarizeRequest) {
|
|
341
|
+
private async _onNotarize(request: NotarizeRequest): Promise<void> {
|
|
342
342
|
if (!this._writer) {
|
|
343
343
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
344
344
|
}
|
|
345
345
|
await this._notarizeCredentials(this._writer, request.credentials ?? []);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
private async _notarizeCredentials(writer: FeedWriter<Credential>, credentials: Credential[]) {
|
|
348
|
+
private async _notarizeCredentials(writer: FeedWriter<Credential>, credentials: Credential[]): Promise<void> {
|
|
349
349
|
for (const credential of credentials) {
|
|
350
350
|
invariant(credential.id, 'Credential must have an id');
|
|
351
351
|
if (this._processedCredentials.has(credential.id)) {
|
|
@@ -359,7 +359,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
createExtension() {
|
|
362
|
+
createExtension(): NotarizationTeleportExtension {
|
|
363
363
|
const extension = new NotarizationTeleportExtension({
|
|
364
364
|
onOpen: async () => {
|
|
365
365
|
log('extension opened', { peer: extension.localPeerId });
|
|
@@ -375,7 +375,7 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
|
|
|
375
375
|
return extension;
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
private _scheduleTimeout(ctx: Context, errors: Trigger, timeout: number) {
|
|
378
|
+
private _scheduleTimeout(ctx: Context, errors: Trigger, timeout: number): void {
|
|
379
379
|
scheduleTask(
|
|
380
380
|
ctx,
|
|
381
381
|
() => {
|
|
@@ -427,12 +427,12 @@ export class NotarizationTeleportExtension extends RpcExtension<Services, Servic
|
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
override async onOpen(ctx: ExtensionContext) {
|
|
430
|
+
override async onOpen(ctx: ExtensionContext): Promise<void> {
|
|
431
431
|
await super.onOpen(ctx);
|
|
432
432
|
await this._params.onOpen();
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
override async onClose(err?: Error | undefined) {
|
|
435
|
+
override async onClose(err?: Error | undefined): Promise<void> {
|
|
436
436
|
await this._params.onClose();
|
|
437
437
|
await super.onClose(err);
|
|
438
438
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type { AutomergeUrl } from '@automerge/automerge-repo';
|
|
6
|
+
|
|
5
7
|
import { SubscriptionList, UpdateScheduler, scheduleTask } from '@dxos/async';
|
|
6
|
-
import type { AutomergeUrl } from '@dxos/automerge/automerge-repo';
|
|
7
8
|
import { Stream } from '@dxos/codec-protobuf/stream';
|
|
8
9
|
import {
|
|
9
10
|
type CredentialProcessor,
|
|
@@ -72,7 +73,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
72
73
|
return this._serializeSpace(space);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
async updateSpace({ spaceKey, state, edgeReplication }: UpdateSpaceRequest) {
|
|
76
|
+
async updateSpace({ spaceKey, state, edgeReplication }: UpdateSpaceRequest): Promise<void> {
|
|
76
77
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
77
78
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
|
|
78
79
|
|
|
@@ -184,13 +185,13 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
187
|
|
|
187
|
-
async postMessage({ spaceKey, channel, message }: PostMessageRequest) {
|
|
188
|
+
async postMessage({ spaceKey, channel, message }: PostMessageRequest): Promise<void> {
|
|
188
189
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
189
190
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
|
|
190
191
|
await space.postMessage(getChannelId(channel), message);
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
subscribeMessages({ spaceKey, channel }: SubscribeMessagesRequest) {
|
|
194
|
+
subscribeMessages({ spaceKey, channel }: SubscribeMessagesRequest): Stream<GossipMessage> {
|
|
194
195
|
return new Stream<GossipMessage>(({ ctx, next }) => {
|
|
195
196
|
scheduleTask(ctx, async () => {
|
|
196
197
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
@@ -222,7 +223,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
222
223
|
});
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
async writeCredentials({ spaceKey, credentials }: WriteCredentialsRequest) {
|
|
226
|
+
async writeCredentials({ spaceKey, credentials }: WriteCredentialsRequest): Promise<void> {
|
|
226
227
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
|
|
227
228
|
for (const credential of credentials ?? []) {
|
|
228
229
|
if (credential.proof) {
|
|
@@ -373,7 +374,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
373
374
|
return this._identityManager.identity;
|
|
374
375
|
}
|
|
375
376
|
|
|
376
|
-
private async _updateMetrics() {
|
|
377
|
+
private async _updateMetrics(): Promise<void> {
|
|
377
378
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
378
379
|
const identity = this._identityManager.identity?.identityKey.truncate();
|
|
379
380
|
if (identity) {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { cbor } from '@
|
|
5
|
+
import { cbor } from '@automerge/automerge-repo';
|
|
6
|
+
|
|
6
7
|
import { invariant } from '@dxos/invariant';
|
|
7
8
|
import type { LevelDB } from '@dxos/kv-store';
|
|
8
9
|
import { log } from '@dxos/log';
|
|
@@ -79,7 +79,7 @@ export class SystemServiceImpl implements SystemService {
|
|
|
79
79
|
return getPlatform();
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
async updateStatus({ status }: UpdateStatusRequest) {
|
|
82
|
+
async updateStatus({ status }: UpdateStatusRequest): Promise<void> {
|
|
83
83
|
await this._onUpdateStatus(status);
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -100,7 +100,7 @@ export class SystemServiceImpl implements SystemService {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
async reset() {
|
|
103
|
+
async reset(): Promise<void> {
|
|
104
104
|
await this._onReset();
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -88,7 +88,7 @@ export class TestBuilder {
|
|
|
88
88
|
return peer;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
async destroy() {
|
|
91
|
+
async destroy(): Promise<void> {
|
|
92
92
|
await this._ctx.dispose();
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -216,7 +216,7 @@ export class TestPeer {
|
|
|
216
216
|
));
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
async createIdentity() {
|
|
219
|
+
async createIdentity(): Promise<void> {
|
|
220
220
|
this._props.signingContext ??= await createSigningContext(this.keyring);
|
|
221
221
|
this.networkManager.setPeerInfo({
|
|
222
222
|
identityKey: this._props.signingContext.identityKey.toHex(),
|
|
@@ -224,7 +224,7 @@ export class TestPeer {
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
async destroy() {
|
|
227
|
+
async destroy(): Promise<void> {
|
|
228
228
|
await this.level.close();
|
|
229
229
|
await this.storage.reset();
|
|
230
230
|
}
|
|
@@ -80,7 +80,7 @@ export class WorkerRuntime {
|
|
|
80
80
|
return this._clientServices;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
async start() {
|
|
83
|
+
async start(): Promise<void> {
|
|
84
84
|
log('starting...');
|
|
85
85
|
try {
|
|
86
86
|
this._broadcastChannel = new BroadcastChannel(this._channel);
|
|
@@ -120,7 +120,7 @@ export class WorkerRuntime {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
async stop() {
|
|
123
|
+
async stop(): Promise<void> {
|
|
124
124
|
// Release the lock to notify remote clients that the worker is terminating.
|
|
125
125
|
this._releaseLock();
|
|
126
126
|
this._broadcastChannel?.close();
|
|
@@ -132,7 +132,7 @@ export class WorkerRuntime {
|
|
|
132
132
|
/**
|
|
133
133
|
* Create a new session.
|
|
134
134
|
*/
|
|
135
|
-
async createSession({ appPort, systemPort, shellPort }: CreateSessionParams) {
|
|
135
|
+
async createSession({ appPort, systemPort, shellPort }: CreateSessionParams): Promise<void> {
|
|
136
136
|
const session = new WorkerSession({
|
|
137
137
|
serviceHost: this._clientServices,
|
|
138
138
|
appPort,
|
|
@@ -171,7 +171,7 @@ export class WorkerRuntime {
|
|
|
171
171
|
/**
|
|
172
172
|
* Selects one of the existing session for WebRTC networking.
|
|
173
173
|
*/
|
|
174
|
-
private _reconnectWebrtc() {
|
|
174
|
+
private _reconnectWebrtc(): void {
|
|
175
175
|
log('reconnecting webrtc...');
|
|
176
176
|
// Check if current session is already closed.
|
|
177
177
|
if (this._sessionForNetworking) {
|
|
@@ -118,7 +118,7 @@ export class WorkerSession {
|
|
|
118
118
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
async open() {
|
|
121
|
+
async open(): Promise<void> {
|
|
122
122
|
log.info('opening...');
|
|
123
123
|
await Promise.all([this._clientRpc.open(), this._iframeRpc.open(), this._maybeOpenShell()]);
|
|
124
124
|
|
|
@@ -133,7 +133,7 @@ export class WorkerSession {
|
|
|
133
133
|
log.info('opened');
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
async close() {
|
|
136
|
+
async close(): Promise<void> {
|
|
137
137
|
log.info('closing...');
|
|
138
138
|
try {
|
|
139
139
|
await this.onClose.callIfSet();
|
|
@@ -145,7 +145,7 @@ export class WorkerSession {
|
|
|
145
145
|
log.info('closed');
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
private async _maybeOpenShell() {
|
|
148
|
+
private async _maybeOpenShell(): Promise<void> {
|
|
149
149
|
try {
|
|
150
150
|
this._shellClientRpc && (await asyncTimeout(this._shellClientRpc.open(), 1_000));
|
|
151
151
|
} catch {
|
package/src/version.ts
CHANGED