@dxos/client-services 0.6.14-main.2b6a0f3 → 0.6.14-main.f49f251
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-BBLK6AUB.mjs → chunk-Z3SSMM5X.mjs} +488 -174
- package/dist/lib/browser/chunk-Z3SSMM5X.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +43 -314
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -2
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-SJEDBF7U.cjs → chunk-ZORMUE2S.cjs} +755 -433
- package/dist/lib/node/chunk-ZORMUE2S.cjs.map +7 -0
- package/dist/lib/node/index.cjs +95 -366
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-A6GS6OOD.mjs → chunk-4NBD4YSD.mjs} +488 -166
- package/dist/lib/node-esm/chunk-4NBD4YSD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +43 -314
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +43 -49
- package/src/packlets/invitations/device-invitation-protocol.ts +3 -1
- package/src/packlets/invitations/invitation-state.ts +13 -12
- package/src/packlets/invitations/invitations-handler.ts +34 -5
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-BBLK6AUB.mjs.map +0 -7
- package/dist/lib/node/chunk-SJEDBF7U.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-A6GS6OOD.mjs.map +0 -7
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
|
-
// inject-globals:@inject-globals
|
|
4
|
-
import {
|
|
5
|
-
global,
|
|
6
|
-
Buffer,
|
|
7
|
-
process
|
|
8
|
-
} from "@dxos/node-std/inject-globals";
|
|
9
|
-
|
|
10
3
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
11
4
|
import { EventSubscriptions } from "@dxos/async";
|
|
12
5
|
import { Stream } from "@dxos/codec-protobuf";
|
|
@@ -404,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
404
397
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
405
398
|
|
|
406
399
|
// packages/sdk/client-services/src/version.ts
|
|
407
|
-
var DXOS_VERSION = "0.6.14-main.
|
|
400
|
+
var DXOS_VERSION = "0.6.14-main.f49f251";
|
|
408
401
|
|
|
409
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
410
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -649,6 +642,47 @@ var safeClose = (channel) => {
|
|
|
649
642
|
}
|
|
650
643
|
};
|
|
651
644
|
|
|
645
|
+
// packages/sdk/client-services/src/packlets/diagnostics/diagnostics-collector.ts
|
|
646
|
+
import { ClientServicesProviderResource } from "@dxos/client-protocol";
|
|
647
|
+
import { ConfigResource } from "@dxos/config";
|
|
648
|
+
import { GetDiagnosticsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
649
|
+
import { TRACE_PROCESSOR as TRACE_PROCESSOR2 } from "@dxos/tracing";
|
|
650
|
+
import { jsonKeyReplacer, nonNullable } from "@dxos/util";
|
|
651
|
+
var GET_DIAGNOSTICS_RPC_TIMEOUT = 1e4;
|
|
652
|
+
var DiagnosticsCollector = class {
|
|
653
|
+
static {
|
|
654
|
+
this.broadcastSender = createCollectDiagnosticsBroadcastSender();
|
|
655
|
+
}
|
|
656
|
+
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
657
|
+
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
658
|
+
keys: options.humanize ? GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
659
|
+
}, {
|
|
660
|
+
timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
|
|
661
|
+
});
|
|
662
|
+
const clientDiagnostics = {
|
|
663
|
+
config,
|
|
664
|
+
trace: TRACE_PROCESSOR2.getDiagnostics()
|
|
665
|
+
};
|
|
666
|
+
const diagnostics = serviceDiagnostics != null ? {
|
|
667
|
+
client: clientDiagnostics,
|
|
668
|
+
services: serviceDiagnostics
|
|
669
|
+
} : {
|
|
670
|
+
client: clientDiagnostics,
|
|
671
|
+
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
672
|
+
};
|
|
673
|
+
return JSON.parse(JSON.stringify(diagnostics, jsonKeyReplacer(options)));
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
var findSystemServiceProvider = () => {
|
|
677
|
+
const serviceProviders = TRACE_PROCESSOR2.findResourcesByAnnotation(ClientServicesProviderResource);
|
|
678
|
+
const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
|
|
679
|
+
return providerResource?.instance?.deref() ?? null;
|
|
680
|
+
};
|
|
681
|
+
var findConfigs = () => {
|
|
682
|
+
const configs = TRACE_PROCESSOR2.findResourcesByAnnotation(ConfigResource);
|
|
683
|
+
return configs.map((r) => r.instance.deref()).filter(nonNullable);
|
|
684
|
+
};
|
|
685
|
+
|
|
652
686
|
// packages/sdk/client-services/src/packlets/identity/authenticator.ts
|
|
653
687
|
import { Trigger as Trigger2 } from "@dxos/async";
|
|
654
688
|
import { Context as Context2 } from "@dxos/context";
|
|
@@ -4644,7 +4678,9 @@ var DeviceInvitationProtocol = class {
|
|
|
4644
4678
|
this._acceptIdentity = _acceptIdentity;
|
|
4645
4679
|
}
|
|
4646
4680
|
toJSON() {
|
|
4647
|
-
return {
|
|
4681
|
+
return {
|
|
4682
|
+
kind: "device"
|
|
4683
|
+
};
|
|
4648
4684
|
}
|
|
4649
4685
|
checkCanInviteNewMembers() {
|
|
4650
4686
|
return void 0;
|
|
@@ -4663,7 +4699,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4663
4699
|
async admit(_, request) {
|
|
4664
4700
|
invariant10(request.device, void 0, {
|
|
4665
4701
|
F: __dxlog_file16,
|
|
4666
|
-
L:
|
|
4702
|
+
L: 53,
|
|
4667
4703
|
S: this,
|
|
4668
4704
|
A: [
|
|
4669
4705
|
"request.device",
|
|
@@ -4674,7 +4710,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4674
4710
|
const credential = await identity.admitDevice(request.device);
|
|
4675
4711
|
invariant10(getCredentialAssertion4(credential)["@type"] === "dxos.halo.credentials.AuthorizedDevice", void 0, {
|
|
4676
4712
|
F: __dxlog_file16,
|
|
4677
|
-
L:
|
|
4713
|
+
L: 56,
|
|
4678
4714
|
S: this,
|
|
4679
4715
|
A: [
|
|
4680
4716
|
"getCredentialAssertion(credential)['@type'] === 'dxos.halo.credentials.AuthorizedDevice'",
|
|
@@ -4719,7 +4755,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4719
4755
|
async accept(response, request) {
|
|
4720
4756
|
invariant10(response.device, void 0, {
|
|
4721
4757
|
F: __dxlog_file16,
|
|
4722
|
-
L:
|
|
4758
|
+
L: 100,
|
|
4723
4759
|
S: this,
|
|
4724
4760
|
A: [
|
|
4725
4761
|
"response.device",
|
|
@@ -4729,7 +4765,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4729
4765
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
4730
4766
|
invariant10(request.device, void 0, {
|
|
4731
4767
|
F: __dxlog_file16,
|
|
4732
|
-
L:
|
|
4768
|
+
L: 103,
|
|
4733
4769
|
S: this,
|
|
4734
4770
|
A: [
|
|
4735
4771
|
"request.device",
|
|
@@ -5453,6 +5489,7 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5453
5489
|
},
|
|
5454
5490
|
// disposing context prevents any further state updates
|
|
5455
5491
|
complete: (newState) => {
|
|
5492
|
+
logStateUpdate(currentInvitation, void 0, invitation.state);
|
|
5456
5493
|
currentInvitation = {
|
|
5457
5494
|
...currentInvitation,
|
|
5458
5495
|
...newState
|
|
@@ -5475,7 +5512,7 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5475
5512
|
},
|
|
5476
5513
|
error: (lockHolder, error) => {
|
|
5477
5514
|
if (isStateChangeAllowed(lockHolder)) {
|
|
5478
|
-
logStateUpdate(currentInvitation, lockHolder, Invitation6.State.ERROR);
|
|
5515
|
+
logStateUpdate(currentInvitation, lockHolder, Invitation6.State.ERROR, error);
|
|
5479
5516
|
currentInvitation = {
|
|
5480
5517
|
...currentInvitation,
|
|
5481
5518
|
state: Invitation6.State.ERROR
|
|
@@ -5489,26 +5526,26 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5489
5526
|
}
|
|
5490
5527
|
};
|
|
5491
5528
|
};
|
|
5492
|
-
var logStateUpdate = (invitation, actor, newState) => {
|
|
5529
|
+
var logStateUpdate = (invitation, actor, newState, error) => {
|
|
5530
|
+
const logContext = {
|
|
5531
|
+
invitationId: invitation.invitationId,
|
|
5532
|
+
actor: actor?.constructor.name,
|
|
5533
|
+
newState: stateToString(newState),
|
|
5534
|
+
oldState: stateToString(invitation.state),
|
|
5535
|
+
error: error?.message,
|
|
5536
|
+
errorStack: error?.stack
|
|
5537
|
+
};
|
|
5493
5538
|
if (isNonTerminalState(newState)) {
|
|
5494
|
-
log17("
|
|
5495
|
-
actor: actor?.constructor.name,
|
|
5496
|
-
newState: stateToString(newState),
|
|
5497
|
-
oldState: stateToString(invitation.state)
|
|
5498
|
-
}, {
|
|
5539
|
+
log17.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5499
5540
|
F: __dxlog_file20,
|
|
5500
|
-
L:
|
|
5541
|
+
L: 98,
|
|
5501
5542
|
S: void 0,
|
|
5502
5543
|
C: (f, a) => f(...a)
|
|
5503
5544
|
});
|
|
5504
5545
|
} else {
|
|
5505
|
-
log17.info("
|
|
5506
|
-
actor: actor?.constructor.name,
|
|
5507
|
-
newState: stateToString(newState),
|
|
5508
|
-
oldState: stateToString(invitation.state)
|
|
5509
|
-
}, {
|
|
5546
|
+
log17.info("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5510
5547
|
F: __dxlog_file20,
|
|
5511
|
-
L:
|
|
5548
|
+
L: 100,
|
|
5512
5549
|
S: void 0,
|
|
5513
5550
|
C: (f, a) => f(...a)
|
|
5514
5551
|
});
|
|
@@ -5616,6 +5653,17 @@ var InvitationsHandler = class {
|
|
|
5616
5653
|
this._connectionParams = _connectionParams;
|
|
5617
5654
|
}
|
|
5618
5655
|
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
5656
|
+
log19.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
|
|
5657
|
+
state: invitation.state,
|
|
5658
|
+
invitationId: invitation.invitationId,
|
|
5659
|
+
kind: invitation.kind,
|
|
5660
|
+
type: invitation.type
|
|
5661
|
+
}, {
|
|
5662
|
+
F: __dxlog_file22,
|
|
5663
|
+
L: 83,
|
|
5664
|
+
S: this,
|
|
5665
|
+
C: (f, a) => f(...a)
|
|
5666
|
+
});
|
|
5619
5667
|
metrics.increment("dxos.invitation.created");
|
|
5620
5668
|
const guardedState = createGuardedInvitationState(ctx, invitation, stream);
|
|
5621
5669
|
const createExtension = () => {
|
|
@@ -5629,10 +5677,19 @@ var InvitationsHandler = class {
|
|
|
5629
5677
|
},
|
|
5630
5678
|
admit: async (admissionRequest) => {
|
|
5631
5679
|
try {
|
|
5680
|
+
log19.verbose("dxos.sdk.invitations-handler.host.admit", {
|
|
5681
|
+
invitationId: invitation.invitationId,
|
|
5682
|
+
...protocol.toJSON()
|
|
5683
|
+
}, {
|
|
5684
|
+
F: __dxlog_file22,
|
|
5685
|
+
L: 105,
|
|
5686
|
+
S: this,
|
|
5687
|
+
C: (f, a) => f(...a)
|
|
5688
|
+
});
|
|
5632
5689
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
5633
5690
|
invariant15(deviceKey, void 0, {
|
|
5634
5691
|
F: __dxlog_file22,
|
|
5635
|
-
L:
|
|
5692
|
+
L: 110,
|
|
5636
5693
|
S: this,
|
|
5637
5694
|
A: [
|
|
5638
5695
|
"deviceKey",
|
|
@@ -5661,7 +5718,7 @@ var InvitationsHandler = class {
|
|
|
5661
5718
|
id: traceId
|
|
5662
5719
|
}), {
|
|
5663
5720
|
F: __dxlog_file22,
|
|
5664
|
-
L:
|
|
5721
|
+
L: 135,
|
|
5665
5722
|
S: this,
|
|
5666
5723
|
C: (f, a) => f(...a)
|
|
5667
5724
|
});
|
|
@@ -5669,7 +5726,7 @@ var InvitationsHandler = class {
|
|
|
5669
5726
|
...protocol.toJSON()
|
|
5670
5727
|
}, {
|
|
5671
5728
|
F: __dxlog_file22,
|
|
5672
|
-
L:
|
|
5729
|
+
L: 136,
|
|
5673
5730
|
S: this,
|
|
5674
5731
|
C: (f, a) => f(...a)
|
|
5675
5732
|
});
|
|
@@ -5681,7 +5738,7 @@ var InvitationsHandler = class {
|
|
|
5681
5738
|
...protocol.toJSON()
|
|
5682
5739
|
}, {
|
|
5683
5740
|
F: __dxlog_file22,
|
|
5684
|
-
L:
|
|
5741
|
+
L: 138,
|
|
5685
5742
|
S: this,
|
|
5686
5743
|
C: (f, a) => f(...a)
|
|
5687
5744
|
});
|
|
@@ -5691,7 +5748,7 @@ var InvitationsHandler = class {
|
|
|
5691
5748
|
id: traceId
|
|
5692
5749
|
}), {
|
|
5693
5750
|
F: __dxlog_file22,
|
|
5694
|
-
L:
|
|
5751
|
+
L: 141,
|
|
5695
5752
|
S: this,
|
|
5696
5753
|
C: (f, a) => f(...a)
|
|
5697
5754
|
});
|
|
@@ -5707,7 +5764,7 @@ var InvitationsHandler = class {
|
|
|
5707
5764
|
...protocol.toJSON()
|
|
5708
5765
|
}, {
|
|
5709
5766
|
F: __dxlog_file22,
|
|
5710
|
-
L:
|
|
5767
|
+
L: 151,
|
|
5711
5768
|
S: this,
|
|
5712
5769
|
C: (f, a) => f(...a)
|
|
5713
5770
|
});
|
|
@@ -5717,7 +5774,7 @@ var InvitationsHandler = class {
|
|
|
5717
5774
|
metrics.increment("dxos.invitation.failed");
|
|
5718
5775
|
log19.error("failed", err, {
|
|
5719
5776
|
F: __dxlog_file22,
|
|
5720
|
-
L:
|
|
5777
|
+
L: 156,
|
|
5721
5778
|
S: this,
|
|
5722
5779
|
C: (f, a) => f(...a)
|
|
5723
5780
|
});
|
|
@@ -5728,7 +5785,7 @@ var InvitationsHandler = class {
|
|
|
5728
5785
|
error: err
|
|
5729
5786
|
}), {
|
|
5730
5787
|
F: __dxlog_file22,
|
|
5731
|
-
L:
|
|
5788
|
+
L: 159,
|
|
5732
5789
|
S: this,
|
|
5733
5790
|
C: (f, a) => f(...a)
|
|
5734
5791
|
});
|
|
@@ -5742,7 +5799,7 @@ var InvitationsHandler = class {
|
|
|
5742
5799
|
...err.context
|
|
5743
5800
|
}, {
|
|
5744
5801
|
F: __dxlog_file22,
|
|
5745
|
-
L:
|
|
5802
|
+
L: 167,
|
|
5746
5803
|
S: this,
|
|
5747
5804
|
C: (f, a) => f(...a)
|
|
5748
5805
|
});
|
|
@@ -5755,7 +5812,7 @@ var InvitationsHandler = class {
|
|
|
5755
5812
|
err
|
|
5756
5813
|
}, {
|
|
5757
5814
|
F: __dxlog_file22,
|
|
5758
|
-
L:
|
|
5815
|
+
L: 173,
|
|
5759
5816
|
S: this,
|
|
5760
5817
|
C: (f, a) => f(...a)
|
|
5761
5818
|
});
|
|
@@ -5765,7 +5822,7 @@ var InvitationsHandler = class {
|
|
|
5765
5822
|
metrics.increment("dxos.invitation.failed");
|
|
5766
5823
|
log19.error("failed", err, {
|
|
5767
5824
|
F: __dxlog_file22,
|
|
5768
|
-
L:
|
|
5825
|
+
L: 178,
|
|
5769
5826
|
S: this,
|
|
5770
5827
|
C: (f, a) => f(...a)
|
|
5771
5828
|
});
|
|
@@ -5779,7 +5836,7 @@ var InvitationsHandler = class {
|
|
|
5779
5836
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
5780
5837
|
log19.warn("invitation has already expired", void 0, {
|
|
5781
5838
|
F: __dxlog_file22,
|
|
5782
|
-
L:
|
|
5839
|
+
L: 189,
|
|
5783
5840
|
S: this,
|
|
5784
5841
|
C: (f, a) => f(...a)
|
|
5785
5842
|
});
|
|
@@ -5799,11 +5856,22 @@ var InvitationsHandler = class {
|
|
|
5799
5856
|
});
|
|
5800
5857
|
}
|
|
5801
5858
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
5859
|
+
log19.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
|
|
5860
|
+
state: invitation.state,
|
|
5861
|
+
invitationId: invitation.invitationId,
|
|
5862
|
+
kind: invitation.kind,
|
|
5863
|
+
type: invitation.type
|
|
5864
|
+
}, {
|
|
5865
|
+
F: __dxlog_file22,
|
|
5866
|
+
L: 220,
|
|
5867
|
+
S: this,
|
|
5868
|
+
C: (f, a) => f(...a)
|
|
5869
|
+
});
|
|
5802
5870
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
5803
5871
|
if (deviceProfile) {
|
|
5804
5872
|
invariant15(invitation.kind === Invitation7.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5805
5873
|
F: __dxlog_file22,
|
|
5806
|
-
L:
|
|
5874
|
+
L: 229,
|
|
5807
5875
|
S: this,
|
|
5808
5876
|
A: [
|
|
5809
5877
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5821,7 +5889,7 @@ var InvitationsHandler = class {
|
|
|
5821
5889
|
triedPeers: triedPeersIds.size
|
|
5822
5890
|
}, {
|
|
5823
5891
|
F: __dxlog_file22,
|
|
5824
|
-
L:
|
|
5892
|
+
L: 237,
|
|
5825
5893
|
S: this,
|
|
5826
5894
|
C: (f, a) => f(...a)
|
|
5827
5895
|
});
|
|
@@ -5848,7 +5916,7 @@ var InvitationsHandler = class {
|
|
|
5848
5916
|
currentState: guardedState.current.state
|
|
5849
5917
|
}, {
|
|
5850
5918
|
F: __dxlog_file22,
|
|
5851
|
-
L:
|
|
5919
|
+
L: 265,
|
|
5852
5920
|
S: this,
|
|
5853
5921
|
C: (f, a) => f(...a)
|
|
5854
5922
|
});
|
|
@@ -5866,7 +5934,7 @@ var InvitationsHandler = class {
|
|
|
5866
5934
|
id: traceId
|
|
5867
5935
|
}), {
|
|
5868
5936
|
F: __dxlog_file22,
|
|
5869
|
-
L:
|
|
5937
|
+
L: 277,
|
|
5870
5938
|
S: this,
|
|
5871
5939
|
C: (f, a) => f(...a)
|
|
5872
5940
|
});
|
|
@@ -5874,20 +5942,21 @@ var InvitationsHandler = class {
|
|
|
5874
5942
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
5875
5943
|
extensionCtx.close();
|
|
5876
5944
|
}, timeout);
|
|
5877
|
-
log19("connected", {
|
|
5945
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.connected", {
|
|
5878
5946
|
...protocol.toJSON()
|
|
5879
5947
|
}, {
|
|
5880
5948
|
F: __dxlog_file22,
|
|
5881
|
-
L:
|
|
5949
|
+
L: 288,
|
|
5882
5950
|
S: this,
|
|
5883
5951
|
C: (f, a) => f(...a)
|
|
5884
5952
|
});
|
|
5885
5953
|
guardedState.set(extension, Invitation7.State.CONNECTED);
|
|
5886
|
-
log19("introduce", {
|
|
5954
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.introduce", {
|
|
5955
|
+
invitationId: invitation.invitationId,
|
|
5887
5956
|
...protocol.toJSON()
|
|
5888
5957
|
}, {
|
|
5889
5958
|
F: __dxlog_file22,
|
|
5890
|
-
L:
|
|
5959
|
+
L: 292,
|
|
5891
5960
|
S: this,
|
|
5892
5961
|
C: (f, a) => f(...a)
|
|
5893
5962
|
});
|
|
@@ -5895,12 +5964,13 @@ var InvitationsHandler = class {
|
|
|
5895
5964
|
invitationId: invitation.invitationId,
|
|
5896
5965
|
...protocol.createIntroduction()
|
|
5897
5966
|
});
|
|
5898
|
-
log19("introduce
|
|
5967
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
|
|
5968
|
+
invitationId: invitation.invitationId,
|
|
5899
5969
|
...protocol.toJSON(),
|
|
5900
|
-
|
|
5970
|
+
authMethod: introductionResponse.authMethod
|
|
5901
5971
|
}, {
|
|
5902
5972
|
F: __dxlog_file22,
|
|
5903
|
-
L:
|
|
5973
|
+
L: 300,
|
|
5904
5974
|
S: this,
|
|
5905
5975
|
C: (f, a) => f(...a)
|
|
5906
5976
|
});
|
|
@@ -5917,11 +5987,12 @@ var InvitationsHandler = class {
|
|
|
5917
5987
|
break;
|
|
5918
5988
|
}
|
|
5919
5989
|
}
|
|
5920
|
-
log19("request
|
|
5990
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
|
|
5991
|
+
invitationId: invitation.invitationId,
|
|
5921
5992
|
...protocol.toJSON()
|
|
5922
5993
|
}, {
|
|
5923
5994
|
F: __dxlog_file22,
|
|
5924
|
-
L:
|
|
5995
|
+
L: 330,
|
|
5925
5996
|
S: this,
|
|
5926
5997
|
C: (f, a) => f(...a)
|
|
5927
5998
|
});
|
|
@@ -5929,11 +6000,12 @@ var InvitationsHandler = class {
|
|
|
5929
6000
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
5930
6001
|
admitted = true;
|
|
5931
6002
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
5932
|
-
log19("admitted
|
|
6003
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
|
|
6004
|
+
invitationId: invitation.invitationId,
|
|
5933
6005
|
...protocol.toJSON()
|
|
5934
6006
|
}, {
|
|
5935
6007
|
F: __dxlog_file22,
|
|
5936
|
-
L:
|
|
6008
|
+
L: 344,
|
|
5937
6009
|
S: this,
|
|
5938
6010
|
C: (f, a) => f(...a)
|
|
5939
6011
|
});
|
|
@@ -5946,7 +6018,7 @@ var InvitationsHandler = class {
|
|
|
5946
6018
|
id: traceId
|
|
5947
6019
|
}), {
|
|
5948
6020
|
F: __dxlog_file22,
|
|
5949
|
-
L:
|
|
6021
|
+
L: 353,
|
|
5950
6022
|
S: this,
|
|
5951
6023
|
C: (f, a) => f(...a)
|
|
5952
6024
|
});
|
|
@@ -5956,7 +6028,7 @@ var InvitationsHandler = class {
|
|
|
5956
6028
|
...protocol.toJSON()
|
|
5957
6029
|
}, {
|
|
5958
6030
|
F: __dxlog_file22,
|
|
5959
|
-
L:
|
|
6031
|
+
L: 356,
|
|
5960
6032
|
S: this,
|
|
5961
6033
|
C: (f, a) => f(...a)
|
|
5962
6034
|
});
|
|
@@ -5964,7 +6036,7 @@ var InvitationsHandler = class {
|
|
|
5964
6036
|
} else {
|
|
5965
6037
|
log19("auth failed", err, {
|
|
5966
6038
|
F: __dxlog_file22,
|
|
5967
|
-
L:
|
|
6039
|
+
L: 359,
|
|
5968
6040
|
S: this,
|
|
5969
6041
|
C: (f, a) => f(...a)
|
|
5970
6042
|
});
|
|
@@ -5976,7 +6048,7 @@ var InvitationsHandler = class {
|
|
|
5976
6048
|
error: err
|
|
5977
6049
|
}), {
|
|
5978
6050
|
F: __dxlog_file22,
|
|
5979
|
-
L:
|
|
6051
|
+
L: 363,
|
|
5980
6052
|
S: this,
|
|
5981
6053
|
C: (f, a) => f(...a)
|
|
5982
6054
|
});
|
|
@@ -5992,7 +6064,7 @@ var InvitationsHandler = class {
|
|
|
5992
6064
|
...protocol.toJSON()
|
|
5993
6065
|
}, {
|
|
5994
6066
|
F: __dxlog_file22,
|
|
5995
|
-
L:
|
|
6067
|
+
L: 372,
|
|
5996
6068
|
S: this,
|
|
5997
6069
|
C: (f, a) => f(...a)
|
|
5998
6070
|
});
|
|
@@ -6000,7 +6072,7 @@ var InvitationsHandler = class {
|
|
|
6000
6072
|
} else {
|
|
6001
6073
|
log19("auth failed", err, {
|
|
6002
6074
|
F: __dxlog_file22,
|
|
6003
|
-
L:
|
|
6075
|
+
L: 375,
|
|
6004
6076
|
S: this,
|
|
6005
6077
|
C: (f, a) => f(...a)
|
|
6006
6078
|
});
|
|
@@ -6017,7 +6089,7 @@ var InvitationsHandler = class {
|
|
|
6017
6089
|
...protocol.toJSON()
|
|
6018
6090
|
}, {
|
|
6019
6091
|
F: __dxlog_file22,
|
|
6020
|
-
L:
|
|
6092
|
+
L: 387,
|
|
6021
6093
|
S: this,
|
|
6022
6094
|
C: (f, a) => f(...a)
|
|
6023
6095
|
});
|
|
@@ -6037,7 +6109,7 @@ var InvitationsHandler = class {
|
|
|
6037
6109
|
} else {
|
|
6038
6110
|
invariant15(invitation.swarmKey, void 0, {
|
|
6039
6111
|
F: __dxlog_file22,
|
|
6040
|
-
L:
|
|
6112
|
+
L: 399,
|
|
6041
6113
|
S: this,
|
|
6042
6114
|
A: [
|
|
6043
6115
|
"invitation.swarmKey",
|
|
@@ -6081,7 +6153,7 @@ var InvitationsHandler = class {
|
|
|
6081
6153
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6082
6154
|
log19("guest waiting for authentication code...", void 0, {
|
|
6083
6155
|
F: __dxlog_file22,
|
|
6084
|
-
L:
|
|
6156
|
+
L: 451,
|
|
6085
6157
|
S: this,
|
|
6086
6158
|
C: (f, a) => f(...a)
|
|
6087
6159
|
});
|
|
@@ -6089,7 +6161,7 @@ var InvitationsHandler = class {
|
|
|
6089
6161
|
const authCode = await authenticated.wait(options);
|
|
6090
6162
|
log19("sending authentication request", void 0, {
|
|
6091
6163
|
F: __dxlog_file22,
|
|
6092
|
-
L:
|
|
6164
|
+
L: 455,
|
|
6093
6165
|
S: this,
|
|
6094
6166
|
C: (f, a) => f(...a)
|
|
6095
6167
|
});
|
|
@@ -6108,7 +6180,7 @@ var InvitationsHandler = class {
|
|
|
6108
6180
|
attempt
|
|
6109
6181
|
}, {
|
|
6110
6182
|
F: __dxlog_file22,
|
|
6111
|
-
L:
|
|
6183
|
+
L: 466,
|
|
6112
6184
|
S: this,
|
|
6113
6185
|
C: (f, a) => f(...a)
|
|
6114
6186
|
});
|
|
@@ -6126,7 +6198,7 @@ var InvitationsHandler = class {
|
|
|
6126
6198
|
}
|
|
6127
6199
|
log19("sending authentication request", void 0, {
|
|
6128
6200
|
F: __dxlog_file22,
|
|
6129
|
-
L:
|
|
6201
|
+
L: 485,
|
|
6130
6202
|
S: this,
|
|
6131
6203
|
C: (f, a) => f(...a)
|
|
6132
6204
|
});
|
|
@@ -6262,6 +6334,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6262
6334
|
}
|
|
6263
6335
|
toJSON() {
|
|
6264
6336
|
return {
|
|
6337
|
+
kind: "space",
|
|
6265
6338
|
deviceKey: this._signingContext.deviceKey,
|
|
6266
6339
|
spaceKey: this._spaceKey
|
|
6267
6340
|
};
|
|
@@ -6282,7 +6355,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6282
6355
|
getInvitationContext() {
|
|
6283
6356
|
invariant16(this._spaceKey, void 0, {
|
|
6284
6357
|
F: __dxlog_file23,
|
|
6285
|
-
L:
|
|
6358
|
+
L: 64,
|
|
6286
6359
|
S: this,
|
|
6287
6360
|
A: [
|
|
6288
6361
|
"this._spaceKey",
|
|
@@ -6292,7 +6365,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6292
6365
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6293
6366
|
invariant16(space, void 0, {
|
|
6294
6367
|
F: __dxlog_file23,
|
|
6295
|
-
L:
|
|
6368
|
+
L: 66,
|
|
6296
6369
|
S: this,
|
|
6297
6370
|
A: [
|
|
6298
6371
|
"space",
|
|
@@ -6308,7 +6381,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6308
6381
|
async admit(invitation, request, guestProfile) {
|
|
6309
6382
|
invariant16(this._spaceKey && request.space, void 0, {
|
|
6310
6383
|
F: __dxlog_file23,
|
|
6311
|
-
L:
|
|
6384
|
+
L: 79,
|
|
6312
6385
|
S: this,
|
|
6313
6386
|
A: [
|
|
6314
6387
|
"this._spaceKey && request.space",
|
|
@@ -6320,7 +6393,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6320
6393
|
guest: request.space.deviceKey
|
|
6321
6394
|
}, {
|
|
6322
6395
|
F: __dxlog_file23,
|
|
6323
|
-
L:
|
|
6396
|
+
L: 80,
|
|
6324
6397
|
S: this,
|
|
6325
6398
|
C: (f, a) => f(...a)
|
|
6326
6399
|
});
|
|
@@ -6342,7 +6415,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6342
6415
|
async delegate(invitation) {
|
|
6343
6416
|
invariant16(this._spaceKey, void 0, {
|
|
6344
6417
|
F: __dxlog_file23,
|
|
6345
|
-
L:
|
|
6418
|
+
L: 100,
|
|
6346
6419
|
S: this,
|
|
6347
6420
|
A: [
|
|
6348
6421
|
"this._spaceKey",
|
|
@@ -6352,7 +6425,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6352
6425
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6353
6426
|
invariant16(space, void 0, {
|
|
6354
6427
|
F: __dxlog_file23,
|
|
6355
|
-
L:
|
|
6428
|
+
L: 102,
|
|
6356
6429
|
S: this,
|
|
6357
6430
|
A: [
|
|
6358
6431
|
"space",
|
|
@@ -6362,7 +6435,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6362
6435
|
if (invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6363
6436
|
invariant16(invitation.guestKeypair?.publicKey, void 0, {
|
|
6364
6437
|
F: __dxlog_file23,
|
|
6365
|
-
L:
|
|
6438
|
+
L: 104,
|
|
6366
6439
|
S: this,
|
|
6367
6440
|
A: [
|
|
6368
6441
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6375,7 +6448,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6375
6448
|
id: invitation.invitationId
|
|
6376
6449
|
}, {
|
|
6377
6450
|
F: __dxlog_file23,
|
|
6378
|
-
L:
|
|
6451
|
+
L: 107,
|
|
6379
6452
|
S: this,
|
|
6380
6453
|
C: (f, a) => f(...a)
|
|
6381
6454
|
});
|
|
@@ -6390,7 +6463,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6390
6463
|
});
|
|
6391
6464
|
invariant16(credential.credential, void 0, {
|
|
6392
6465
|
F: __dxlog_file23,
|
|
6393
|
-
L:
|
|
6466
|
+
L: 127,
|
|
6394
6467
|
S: this,
|
|
6395
6468
|
A: [
|
|
6396
6469
|
"credential.credential",
|
|
@@ -6405,7 +6478,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6405
6478
|
async cancelDelegation(invitation) {
|
|
6406
6479
|
invariant16(this._spaceKey, void 0, {
|
|
6407
6480
|
F: __dxlog_file23,
|
|
6408
|
-
L:
|
|
6481
|
+
L: 133,
|
|
6409
6482
|
S: this,
|
|
6410
6483
|
A: [
|
|
6411
6484
|
"this._spaceKey",
|
|
@@ -6414,7 +6487,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6414
6487
|
});
|
|
6415
6488
|
invariant16(invitation.type === Invitation8.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6416
6489
|
F: __dxlog_file23,
|
|
6417
|
-
L:
|
|
6490
|
+
L: 134,
|
|
6418
6491
|
S: this,
|
|
6419
6492
|
A: [
|
|
6420
6493
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6424,7 +6497,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6424
6497
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6425
6498
|
invariant16(space, void 0, {
|
|
6426
6499
|
F: __dxlog_file23,
|
|
6427
|
-
L:
|
|
6500
|
+
L: 136,
|
|
6428
6501
|
S: this,
|
|
6429
6502
|
A: [
|
|
6430
6503
|
"space",
|
|
@@ -6436,14 +6509,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6436
6509
|
id: invitation.invitationId
|
|
6437
6510
|
}, {
|
|
6438
6511
|
F: __dxlog_file23,
|
|
6439
|
-
L:
|
|
6512
|
+
L: 138,
|
|
6440
6513
|
S: this,
|
|
6441
6514
|
C: (f, a) => f(...a)
|
|
6442
6515
|
});
|
|
6443
6516
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6444
6517
|
invariant16(credential.credential, void 0, {
|
|
6445
6518
|
F: __dxlog_file23,
|
|
6446
|
-
L:
|
|
6519
|
+
L: 145,
|
|
6447
6520
|
S: this,
|
|
6448
6521
|
A: [
|
|
6449
6522
|
"credential.credential",
|
|
@@ -6482,7 +6555,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6482
6555
|
async accept(response) {
|
|
6483
6556
|
invariant16(response.space, void 0, {
|
|
6484
6557
|
F: __dxlog_file23,
|
|
6485
|
-
L:
|
|
6558
|
+
L: 180,
|
|
6486
6559
|
S: this,
|
|
6487
6560
|
A: [
|
|
6488
6561
|
"response.space",
|
|
@@ -6493,7 +6566,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6493
6566
|
const assertion = getCredentialAssertion5(credential);
|
|
6494
6567
|
invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6495
6568
|
F: __dxlog_file23,
|
|
6496
|
-
L:
|
|
6569
|
+
L: 183,
|
|
6497
6570
|
S: this,
|
|
6498
6571
|
A: [
|
|
6499
6572
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6502,7 +6575,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6502
6575
|
});
|
|
6503
6576
|
invariant16(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6504
6577
|
F: __dxlog_file23,
|
|
6505
|
-
L:
|
|
6578
|
+
L: 184,
|
|
6506
6579
|
S: this,
|
|
6507
6580
|
A: [
|
|
6508
6581
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -7016,6 +7089,83 @@ var isLocked = (lockPath) => {
|
|
|
7016
7089
|
throw new Error("Not implemented");
|
|
7017
7090
|
};
|
|
7018
7091
|
|
|
7092
|
+
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
7093
|
+
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
7094
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
7095
|
+
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
7096
|
+
import { MapCounter, trace as trace8 } from "@dxos/tracing";
|
|
7097
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
7098
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7099
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7100
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7101
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7102
|
+
}
|
|
7103
|
+
var ClientRpcServer = class {
|
|
7104
|
+
constructor(params) {
|
|
7105
|
+
this._handlerCache = /* @__PURE__ */ new Map();
|
|
7106
|
+
this._callMetrics = new MapCounter();
|
|
7107
|
+
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
7108
|
+
this._handleCall = handleCall;
|
|
7109
|
+
this._handleStream = handleStream;
|
|
7110
|
+
this._serviceRegistry = serviceRegistry;
|
|
7111
|
+
this._rpcPeer = new RpcPeer({
|
|
7112
|
+
...rpcOptions,
|
|
7113
|
+
callHandler: (method, params2) => {
|
|
7114
|
+
const [serviceName, methodName] = parseMethodName(method);
|
|
7115
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
7116
|
+
this._callMetrics.inc(`${serviceName}.${methodName} request`);
|
|
7117
|
+
if (this._handleCall) {
|
|
7118
|
+
return this._handleCall(methodName, params2, handler);
|
|
7119
|
+
} else {
|
|
7120
|
+
return handler(methodName, params2);
|
|
7121
|
+
}
|
|
7122
|
+
},
|
|
7123
|
+
streamHandler: (method, params2) => {
|
|
7124
|
+
const [serviceName, methodName] = parseMethodName(method);
|
|
7125
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
7126
|
+
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
7127
|
+
if (this._handleStream) {
|
|
7128
|
+
return Stream10.map(Stream10.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
7129
|
+
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
7130
|
+
return data;
|
|
7131
|
+
});
|
|
7132
|
+
} else {
|
|
7133
|
+
return handler(methodName, params2);
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
});
|
|
7137
|
+
}
|
|
7138
|
+
get _services() {
|
|
7139
|
+
return Object.keys(this._serviceRegistry.services);
|
|
7140
|
+
}
|
|
7141
|
+
async open() {
|
|
7142
|
+
await this._rpcPeer.open();
|
|
7143
|
+
}
|
|
7144
|
+
async close() {
|
|
7145
|
+
await this._rpcPeer.close();
|
|
7146
|
+
}
|
|
7147
|
+
_getServiceHandler(serviceName) {
|
|
7148
|
+
if (!this._handlerCache.has(serviceName)) {
|
|
7149
|
+
const [key, descriptor] = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName) ?? raise2(new Error(`Service not available: ${serviceName}`));
|
|
7150
|
+
const service = this._serviceRegistry.services[key];
|
|
7151
|
+
if (!service) {
|
|
7152
|
+
throw new Error(`Service not available: ${serviceName}`);
|
|
7153
|
+
}
|
|
7154
|
+
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
7155
|
+
}
|
|
7156
|
+
return this._handlerCache.get(serviceName);
|
|
7157
|
+
}
|
|
7158
|
+
};
|
|
7159
|
+
_ts_decorate8([
|
|
7160
|
+
trace8.metricsCounter()
|
|
7161
|
+
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
7162
|
+
_ts_decorate8([
|
|
7163
|
+
trace8.info()
|
|
7164
|
+
], ClientRpcServer.prototype, "_services", null);
|
|
7165
|
+
ClientRpcServer = _ts_decorate8([
|
|
7166
|
+
trace8.resource()
|
|
7167
|
+
], ClientRpcServer);
|
|
7168
|
+
|
|
7019
7169
|
// packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts
|
|
7020
7170
|
import { DeferredTask as DeferredTask2, Event as Event9, scheduleTask as scheduleTask8, synchronized as synchronized3 } from "@dxos/async";
|
|
7021
7171
|
import { Resource as Resource6 } from "@dxos/context";
|
|
@@ -7024,7 +7174,7 @@ import { PublicKey as PublicKey13 } from "@dxos/keys";
|
|
|
7024
7174
|
import { log as log23 } from "@dxos/log";
|
|
7025
7175
|
import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
|
|
7026
7176
|
import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7027
|
-
function
|
|
7177
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
7028
7178
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7029
7179
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7030
7180
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -7230,12 +7380,12 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7230
7380
|
});
|
|
7231
7381
|
}
|
|
7232
7382
|
};
|
|
7233
|
-
|
|
7383
|
+
_ts_decorate9([
|
|
7234
7384
|
synchronized3
|
|
7235
7385
|
], EdgeAgentManager.prototype, "createAgent", null);
|
|
7236
7386
|
|
|
7237
7387
|
// packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
|
|
7238
|
-
import { Stream as
|
|
7388
|
+
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
7239
7389
|
import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
|
|
7240
7390
|
import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
7241
7391
|
var EdgeAgentServiceImpl = class {
|
|
@@ -7246,7 +7396,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7246
7396
|
return (await this._agentManagerProvider()).createAgent();
|
|
7247
7397
|
}
|
|
7248
7398
|
queryAgentStatus() {
|
|
7249
|
-
return new
|
|
7399
|
+
return new Stream11(({ ctx, next }) => {
|
|
7250
7400
|
next({
|
|
7251
7401
|
status: QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7252
7402
|
});
|
|
@@ -7288,7 +7438,7 @@ import { invariant as invariant20 } from "@dxos/invariant";
|
|
|
7288
7438
|
import { Keyring } from "@dxos/keyring";
|
|
7289
7439
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
7290
7440
|
import { log as log25 } from "@dxos/log";
|
|
7291
|
-
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as
|
|
7441
|
+
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
|
|
7292
7442
|
import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7293
7443
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
7294
7444
|
import { trace as Trace3 } from "@dxos/tracing";
|
|
@@ -7405,7 +7555,7 @@ var decodeCredential = (credentialBase64) => {
|
|
|
7405
7555
|
};
|
|
7406
7556
|
|
|
7407
7557
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
7408
|
-
function
|
|
7558
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
7409
7559
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7410
7560
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7411
7561
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -7546,7 +7696,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7546
7696
|
S: this,
|
|
7547
7697
|
C: (f, a) => f(...a)
|
|
7548
7698
|
});
|
|
7549
|
-
log25.trace("dxos.sdk.service-context.open",
|
|
7699
|
+
log25.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
7550
7700
|
id: this._instanceId
|
|
7551
7701
|
}), {
|
|
7552
7702
|
F: __dxlog_file28,
|
|
@@ -7581,7 +7731,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7581
7731
|
S: this,
|
|
7582
7732
|
C: (f, a) => f(...a)
|
|
7583
7733
|
});
|
|
7584
|
-
log25.trace("dxos.sdk.service-context.open",
|
|
7734
|
+
log25.trace("dxos.sdk.service-context.open", trace9.end({
|
|
7585
7735
|
id: this._instanceId
|
|
7586
7736
|
}), {
|
|
7587
7737
|
F: __dxlog_file28,
|
|
@@ -7836,13 +7986,13 @@ var ServiceContext = class extends Resource7 {
|
|
|
7836
7986
|
}
|
|
7837
7987
|
}
|
|
7838
7988
|
};
|
|
7839
|
-
|
|
7989
|
+
_ts_decorate10([
|
|
7840
7990
|
Trace3.span()
|
|
7841
7991
|
], ServiceContext.prototype, "_open", null);
|
|
7842
|
-
|
|
7992
|
+
_ts_decorate10([
|
|
7843
7993
|
Trace3.span()
|
|
7844
7994
|
], ServiceContext.prototype, "_initialize", null);
|
|
7845
|
-
ServiceContext =
|
|
7995
|
+
ServiceContext = _ts_decorate10([
|
|
7846
7996
|
safeInstanceof("dxos.client-services.ServiceContext"),
|
|
7847
7997
|
Trace3.resource()
|
|
7848
7998
|
], ServiceContext);
|
|
@@ -7945,27 +8095,186 @@ var createLevel = async (config) => {
|
|
|
7945
8095
|
return level;
|
|
7946
8096
|
};
|
|
7947
8097
|
|
|
8098
|
+
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
8099
|
+
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
8100
|
+
import { invariant as invariant21 } from "@dxos/invariant";
|
|
8101
|
+
import { log as log26 } from "@dxos/log";
|
|
8102
|
+
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
8103
|
+
import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
|
|
8104
|
+
var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
8105
|
+
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
8106
|
+
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
8107
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
8108
|
+
const archive = {
|
|
8109
|
+
storage: [],
|
|
8110
|
+
meta: {
|
|
8111
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8112
|
+
}
|
|
8113
|
+
};
|
|
8114
|
+
{
|
|
8115
|
+
const directory = await storage.createDirectory();
|
|
8116
|
+
const files = await directory.list();
|
|
8117
|
+
log26.info("begin exporting files", {
|
|
8118
|
+
count: files.length
|
|
8119
|
+
}, {
|
|
8120
|
+
F: __dxlog_file29,
|
|
8121
|
+
L: 30,
|
|
8122
|
+
S: void 0,
|
|
8123
|
+
C: (f, a) => f(...a)
|
|
8124
|
+
});
|
|
8125
|
+
for (const filename of files) {
|
|
8126
|
+
const file = await directory.getOrCreateFile(filename);
|
|
8127
|
+
const { size } = await file.stat();
|
|
8128
|
+
const data = await file.read(0, size);
|
|
8129
|
+
archive.storage.push({
|
|
8130
|
+
type: ProfileArchiveEntryType.FILE,
|
|
8131
|
+
key: filename,
|
|
8132
|
+
value: data
|
|
8133
|
+
});
|
|
8134
|
+
}
|
|
8135
|
+
log26.info("done exporting files", {
|
|
8136
|
+
count: files.length
|
|
8137
|
+
}, {
|
|
8138
|
+
F: __dxlog_file29,
|
|
8139
|
+
L: 41,
|
|
8140
|
+
S: void 0,
|
|
8141
|
+
C: (f, a) => f(...a)
|
|
8142
|
+
});
|
|
8143
|
+
}
|
|
8144
|
+
{
|
|
8145
|
+
log26.info("begin exporting kv pairs", void 0, {
|
|
8146
|
+
F: __dxlog_file29,
|
|
8147
|
+
L: 45,
|
|
8148
|
+
S: void 0,
|
|
8149
|
+
C: (f, a) => f(...a)
|
|
8150
|
+
});
|
|
8151
|
+
const iter = await level.iterator({
|
|
8152
|
+
keyEncoding: "binary",
|
|
8153
|
+
valueEncoding: "binary"
|
|
8154
|
+
});
|
|
8155
|
+
let count = 0;
|
|
8156
|
+
for await (const [key, value] of iter) {
|
|
8157
|
+
archive.storage.push({
|
|
8158
|
+
type: ProfileArchiveEntryType.KEY_VALUE,
|
|
8159
|
+
key,
|
|
8160
|
+
value
|
|
8161
|
+
});
|
|
8162
|
+
count++;
|
|
8163
|
+
}
|
|
8164
|
+
log26.info("done exporting kv pairs", {
|
|
8165
|
+
count
|
|
8166
|
+
}, {
|
|
8167
|
+
F: __dxlog_file29,
|
|
8168
|
+
L: 56,
|
|
8169
|
+
S: void 0,
|
|
8170
|
+
C: (f, a) => f(...a)
|
|
8171
|
+
});
|
|
8172
|
+
}
|
|
8173
|
+
return archive;
|
|
8174
|
+
};
|
|
8175
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
8176
|
+
let batch = level.batch();
|
|
8177
|
+
let count = 0;
|
|
8178
|
+
for (const entry2 of archive.storage) {
|
|
8179
|
+
switch (entry2.type) {
|
|
8180
|
+
case ProfileArchiveEntryType.FILE: {
|
|
8181
|
+
const directory = await storage.createDirectory();
|
|
8182
|
+
invariant21(typeof entry2.key === "string", "Invalid key type", {
|
|
8183
|
+
F: __dxlog_file29,
|
|
8184
|
+
L: 79,
|
|
8185
|
+
S: void 0,
|
|
8186
|
+
A: [
|
|
8187
|
+
"typeof entry.key === 'string'",
|
|
8188
|
+
"'Invalid key type'"
|
|
8189
|
+
]
|
|
8190
|
+
});
|
|
8191
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
8192
|
+
invariant21(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8193
|
+
F: __dxlog_file29,
|
|
8194
|
+
L: 81,
|
|
8195
|
+
S: void 0,
|
|
8196
|
+
A: [
|
|
8197
|
+
"entry.value instanceof Uint8Array",
|
|
8198
|
+
"'Invalid value type'"
|
|
8199
|
+
]
|
|
8200
|
+
});
|
|
8201
|
+
await file.write(0, arrayToBuffer2(entry2.value));
|
|
8202
|
+
await file.close();
|
|
8203
|
+
break;
|
|
8204
|
+
}
|
|
8205
|
+
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
8206
|
+
invariant21(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
8207
|
+
F: __dxlog_file29,
|
|
8208
|
+
L: 87,
|
|
8209
|
+
S: void 0,
|
|
8210
|
+
A: [
|
|
8211
|
+
"entry.key instanceof Uint8Array",
|
|
8212
|
+
"'Invalid key type'"
|
|
8213
|
+
]
|
|
8214
|
+
});
|
|
8215
|
+
invariant21(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8216
|
+
F: __dxlog_file29,
|
|
8217
|
+
L: 88,
|
|
8218
|
+
S: void 0,
|
|
8219
|
+
A: [
|
|
8220
|
+
"entry.value instanceof Uint8Array",
|
|
8221
|
+
"'Invalid value type'"
|
|
8222
|
+
]
|
|
8223
|
+
});
|
|
8224
|
+
batch.put(entry2.key, entry2.value, {
|
|
8225
|
+
keyEncoding: "binary",
|
|
8226
|
+
valueEncoding: "binary"
|
|
8227
|
+
});
|
|
8228
|
+
break;
|
|
8229
|
+
}
|
|
8230
|
+
default:
|
|
8231
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
8232
|
+
}
|
|
8233
|
+
if (++count % 1e3 === 0) {
|
|
8234
|
+
await batch.write();
|
|
8235
|
+
batch = level.batch();
|
|
8236
|
+
log26.info("importing", {
|
|
8237
|
+
count,
|
|
8238
|
+
total: archive.storage.length,
|
|
8239
|
+
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
8240
|
+
}, {
|
|
8241
|
+
F: __dxlog_file29,
|
|
8242
|
+
L: 101,
|
|
8243
|
+
S: void 0,
|
|
8244
|
+
C: (f, a) => f(...a)
|
|
8245
|
+
});
|
|
8246
|
+
}
|
|
8247
|
+
}
|
|
8248
|
+
log26.info("committing changes..", void 0, {
|
|
8249
|
+
F: __dxlog_file29,
|
|
8250
|
+
L: 109,
|
|
8251
|
+
S: void 0,
|
|
8252
|
+
C: (f, a) => f(...a)
|
|
8253
|
+
});
|
|
8254
|
+
await batch.write();
|
|
8255
|
+
};
|
|
8256
|
+
|
|
7948
8257
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
7949
8258
|
import { Event as Event11, synchronized as synchronized4 } from "@dxos/async";
|
|
7950
8259
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
7951
8260
|
import { Context as Context10 } from "@dxos/context";
|
|
7952
8261
|
import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
|
|
7953
|
-
import { invariant as
|
|
8262
|
+
import { invariant as invariant23 } from "@dxos/invariant";
|
|
7954
8263
|
import { PublicKey as PublicKey19 } from "@dxos/keys";
|
|
7955
|
-
import { log as
|
|
8264
|
+
import { log as log28 } from "@dxos/log";
|
|
7956
8265
|
import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
|
|
7957
8266
|
import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
|
|
7958
|
-
import { trace as
|
|
8267
|
+
import { trace as trace10 } from "@dxos/protocols";
|
|
7959
8268
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
7960
|
-
import { TRACE_PROCESSOR as
|
|
8269
|
+
import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/tracing";
|
|
7961
8270
|
import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
7962
8271
|
|
|
7963
8272
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
7964
8273
|
import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
7965
|
-
import { Stream as
|
|
7966
|
-
import { invariant as
|
|
8274
|
+
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
8275
|
+
import { invariant as invariant22 } from "@dxos/invariant";
|
|
7967
8276
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7968
|
-
var
|
|
8277
|
+
var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
7969
8278
|
var DevicesServiceImpl = class {
|
|
7970
8279
|
constructor(_identityManager) {
|
|
7971
8280
|
this._identityManager = _identityManager;
|
|
@@ -7974,7 +8283,7 @@ var DevicesServiceImpl = class {
|
|
|
7974
8283
|
return this._identityManager.updateDeviceProfile(profile);
|
|
7975
8284
|
}
|
|
7976
8285
|
queryDevices() {
|
|
7977
|
-
return new
|
|
8286
|
+
return new Stream12(({ next }) => {
|
|
7978
8287
|
const update = () => {
|
|
7979
8288
|
const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
|
|
7980
8289
|
if (!deviceKeys) {
|
|
@@ -7982,8 +8291,8 @@ var DevicesServiceImpl = class {
|
|
|
7982
8291
|
devices: []
|
|
7983
8292
|
});
|
|
7984
8293
|
} else {
|
|
7985
|
-
|
|
7986
|
-
F:
|
|
8294
|
+
invariant22(this._identityManager.identity?.presence, "presence not present", {
|
|
8295
|
+
F: __dxlog_file30,
|
|
7987
8296
|
L: 32,
|
|
7988
8297
|
S: this,
|
|
7989
8298
|
A: [
|
|
@@ -8044,7 +8353,7 @@ var DevicesServiceImpl = class {
|
|
|
8044
8353
|
|
|
8045
8354
|
// packages/sdk/client-services/src/packlets/identity/contacts-service.ts
|
|
8046
8355
|
import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
|
|
8047
|
-
import { Stream as
|
|
8356
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
8048
8357
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
8049
8358
|
import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
|
|
8050
8359
|
var ContactsServiceImpl = class {
|
|
@@ -8095,7 +8404,7 @@ var ContactsServiceImpl = class {
|
|
|
8095
8404
|
}
|
|
8096
8405
|
queryContacts() {
|
|
8097
8406
|
const subscribedSpaceKeySet = new ComplexSet6(PublicKey17.hash);
|
|
8098
|
-
return new
|
|
8407
|
+
return new Stream13(({ next, ctx }) => {
|
|
8099
8408
|
const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
|
|
8100
8409
|
const contacts = await this.getContacts();
|
|
8101
8410
|
next(contacts);
|
|
@@ -8127,9 +8436,9 @@ var ContactsServiceImpl = class {
|
|
|
8127
8436
|
|
|
8128
8437
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
8129
8438
|
import { Event as Event10 } from "@dxos/async";
|
|
8130
|
-
import { Stream as
|
|
8439
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
8131
8440
|
import { PublicKey as PublicKey18 } from "@dxos/keys";
|
|
8132
|
-
import { getContextFromEntry, log as
|
|
8441
|
+
import { getContextFromEntry, log as log27 } from "@dxos/log";
|
|
8133
8442
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
8134
8443
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
8135
8444
|
var LoggingServiceImpl = class {
|
|
@@ -8142,11 +8451,11 @@ var LoggingServiceImpl = class {
|
|
|
8142
8451
|
};
|
|
8143
8452
|
}
|
|
8144
8453
|
async open() {
|
|
8145
|
-
|
|
8454
|
+
log27.runtimeConfig.processors.push(this._logProcessor);
|
|
8146
8455
|
}
|
|
8147
8456
|
async close() {
|
|
8148
|
-
const index =
|
|
8149
|
-
|
|
8457
|
+
const index = log27.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
8458
|
+
log27.runtimeConfig.processors.splice(index, 1);
|
|
8150
8459
|
}
|
|
8151
8460
|
async controlMetrics({ reset, record }) {
|
|
8152
8461
|
if (reset) {
|
|
@@ -8172,7 +8481,7 @@ var LoggingServiceImpl = class {
|
|
|
8172
8481
|
stats: numericalValues(events, "duration")
|
|
8173
8482
|
};
|
|
8174
8483
|
};
|
|
8175
|
-
return new
|
|
8484
|
+
return new Stream14(({ next }) => {
|
|
8176
8485
|
const update = () => {
|
|
8177
8486
|
const metrics2 = {
|
|
8178
8487
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -8194,7 +8503,7 @@ var LoggingServiceImpl = class {
|
|
|
8194
8503
|
});
|
|
8195
8504
|
}
|
|
8196
8505
|
queryLogs(request) {
|
|
8197
|
-
return new
|
|
8506
|
+
return new Stream14(({ ctx, next }) => {
|
|
8198
8507
|
const handler = (entry2) => {
|
|
8199
8508
|
if (LOG_PROCESSING > 0) {
|
|
8200
8509
|
return;
|
|
@@ -8250,14 +8559,14 @@ var shouldLog = (entry2, request) => {
|
|
|
8250
8559
|
var LOG_PROCESSING = 0;
|
|
8251
8560
|
|
|
8252
8561
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
8253
|
-
import { Stream as
|
|
8562
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf";
|
|
8254
8563
|
var NetworkServiceImpl = class {
|
|
8255
8564
|
constructor(networkManager, signalManager) {
|
|
8256
8565
|
this.networkManager = networkManager;
|
|
8257
8566
|
this.signalManager = signalManager;
|
|
8258
8567
|
}
|
|
8259
8568
|
queryStatus() {
|
|
8260
|
-
return new
|
|
8569
|
+
return new Stream15(({ next }) => {
|
|
8261
8570
|
const update = () => {
|
|
8262
8571
|
next({
|
|
8263
8572
|
swarm: this.networkManager.connectionState,
|
|
@@ -8283,9 +8592,9 @@ var NetworkServiceImpl = class {
|
|
|
8283
8592
|
};
|
|
8284
8593
|
|
|
8285
8594
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
8286
|
-
import { Stream as
|
|
8287
|
-
import { GetDiagnosticsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
8288
|
-
import { jsonKeyReplacer } from "@dxos/util";
|
|
8595
|
+
import { Stream as Stream16 } from "@dxos/codec-protobuf";
|
|
8596
|
+
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
8597
|
+
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
8289
8598
|
var SystemServiceImpl = class {
|
|
8290
8599
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
8291
8600
|
this._config = config;
|
|
@@ -8305,9 +8614,9 @@ var SystemServiceImpl = class {
|
|
|
8305
8614
|
const diagnostics = await this._getDiagnostics();
|
|
8306
8615
|
return {
|
|
8307
8616
|
timestamp: /* @__PURE__ */ new Date(),
|
|
8308
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics,
|
|
8309
|
-
truncate: keys ===
|
|
8310
|
-
humanize: keys ===
|
|
8617
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, jsonKeyReplacer2({
|
|
8618
|
+
truncate: keys === GetDiagnosticsRequest2.KEY_OPTION.TRUNCATE,
|
|
8619
|
+
humanize: keys === GetDiagnosticsRequest2.KEY_OPTION.HUMANIZE
|
|
8311
8620
|
})))
|
|
8312
8621
|
};
|
|
8313
8622
|
}
|
|
@@ -8319,7 +8628,7 @@ var SystemServiceImpl = class {
|
|
|
8319
8628
|
}
|
|
8320
8629
|
// TODO(burdon): Standardize interval option in stream request?
|
|
8321
8630
|
queryStatus({ interval = 3e3 } = {}) {
|
|
8322
|
-
return new
|
|
8631
|
+
return new Stream16(({ next }) => {
|
|
8323
8632
|
const update = () => {
|
|
8324
8633
|
next({
|
|
8325
8634
|
status: this._getCurrentStatus()
|
|
@@ -8340,13 +8649,13 @@ var SystemServiceImpl = class {
|
|
|
8340
8649
|
};
|
|
8341
8650
|
|
|
8342
8651
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
8343
|
-
function
|
|
8652
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
8344
8653
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8345
8654
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8346
8655
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8347
8656
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8348
8657
|
}
|
|
8349
|
-
var
|
|
8658
|
+
var __dxlog_file31 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
8350
8659
|
var ClientServicesHost = class {
|
|
8351
8660
|
constructor({
|
|
8352
8661
|
config,
|
|
@@ -8359,7 +8668,7 @@ var ClientServicesHost = class {
|
|
|
8359
8668
|
callbacks,
|
|
8360
8669
|
runtimeParams
|
|
8361
8670
|
} = {}) {
|
|
8362
|
-
this._tracingService =
|
|
8671
|
+
this._tracingService = TRACE_PROCESSOR3.createTraceSender();
|
|
8363
8672
|
this._statusUpdate = new Event11();
|
|
8364
8673
|
this._edgeConnection = void 0;
|
|
8365
8674
|
this._edgeHttpClient = void 0;
|
|
@@ -8386,7 +8695,7 @@ var ClientServicesHost = class {
|
|
|
8386
8695
|
onAcquire: () => {
|
|
8387
8696
|
if (!this._opening) {
|
|
8388
8697
|
void this.open(new Context10(void 0, {
|
|
8389
|
-
F:
|
|
8698
|
+
F: __dxlog_file31,
|
|
8390
8699
|
L: 137
|
|
8391
8700
|
}));
|
|
8392
8701
|
}
|
|
@@ -8443,8 +8752,8 @@ var ClientServicesHost = class {
|
|
|
8443
8752
|
* Can only be called once.
|
|
8444
8753
|
*/
|
|
8445
8754
|
initialize({ config, ...options }) {
|
|
8446
|
-
|
|
8447
|
-
F:
|
|
8755
|
+
invariant23(!this._open, "service host is open", {
|
|
8756
|
+
F: __dxlog_file31,
|
|
8448
8757
|
L: 203,
|
|
8449
8758
|
S: this,
|
|
8450
8759
|
A: [
|
|
@@ -8452,15 +8761,15 @@ var ClientServicesHost = class {
|
|
|
8452
8761
|
"'service host is open'"
|
|
8453
8762
|
]
|
|
8454
8763
|
});
|
|
8455
|
-
|
|
8456
|
-
F:
|
|
8764
|
+
log28("initializing...", void 0, {
|
|
8765
|
+
F: __dxlog_file31,
|
|
8457
8766
|
L: 204,
|
|
8458
8767
|
S: this,
|
|
8459
8768
|
C: (f, a) => f(...a)
|
|
8460
8769
|
});
|
|
8461
8770
|
if (config) {
|
|
8462
|
-
|
|
8463
|
-
F:
|
|
8771
|
+
invariant23(!this._config, "config already set", {
|
|
8772
|
+
F: __dxlog_file31,
|
|
8464
8773
|
L: 207,
|
|
8465
8774
|
S: this,
|
|
8466
8775
|
A: [
|
|
@@ -8474,8 +8783,8 @@ var ClientServicesHost = class {
|
|
|
8474
8783
|
}
|
|
8475
8784
|
}
|
|
8476
8785
|
if (!options.signalManager) {
|
|
8477
|
-
|
|
8478
|
-
F:
|
|
8786
|
+
log28.warn("running signaling without telemetry metadata.", void 0, {
|
|
8787
|
+
F: __dxlog_file31,
|
|
8479
8788
|
L: 215,
|
|
8480
8789
|
S: this,
|
|
8481
8790
|
C: (f, a) => f(...a)
|
|
@@ -8494,8 +8803,8 @@ var ClientServicesHost = class {
|
|
|
8494
8803
|
edgeConnection: this._edgeConnection
|
|
8495
8804
|
}) : new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
8496
8805
|
this._signalManager = signalManager;
|
|
8497
|
-
|
|
8498
|
-
F:
|
|
8806
|
+
invariant23(!this._networkManager, "network manager already set", {
|
|
8807
|
+
F: __dxlog_file31,
|
|
8499
8808
|
L: 237,
|
|
8500
8809
|
S: this,
|
|
8501
8810
|
A: [
|
|
@@ -8512,8 +8821,8 @@ var ClientServicesHost = class {
|
|
|
8512
8821
|
peerKey: this._edgeConnection.peerKey
|
|
8513
8822
|
} : void 0
|
|
8514
8823
|
});
|
|
8515
|
-
|
|
8516
|
-
F:
|
|
8824
|
+
log28("initialized", void 0, {
|
|
8825
|
+
F: __dxlog_file31,
|
|
8517
8826
|
L: 250,
|
|
8518
8827
|
S: this,
|
|
8519
8828
|
C: (f, a) => f(...a)
|
|
@@ -8524,16 +8833,16 @@ var ClientServicesHost = class {
|
|
|
8524
8833
|
return;
|
|
8525
8834
|
}
|
|
8526
8835
|
const traceId = PublicKey19.random().toHex();
|
|
8527
|
-
|
|
8836
|
+
log28.trace("dxos.client-services.host.open", trace10.begin({
|
|
8528
8837
|
id: traceId
|
|
8529
8838
|
}), {
|
|
8530
|
-
F:
|
|
8839
|
+
F: __dxlog_file31,
|
|
8531
8840
|
L: 261,
|
|
8532
8841
|
S: this,
|
|
8533
8842
|
C: (f, a) => f(...a)
|
|
8534
8843
|
});
|
|
8535
|
-
|
|
8536
|
-
F:
|
|
8844
|
+
invariant23(this._config, "config not set", {
|
|
8845
|
+
F: __dxlog_file31,
|
|
8537
8846
|
L: 263,
|
|
8538
8847
|
S: this,
|
|
8539
8848
|
A: [
|
|
@@ -8541,8 +8850,8 @@ var ClientServicesHost = class {
|
|
|
8541
8850
|
"'config not set'"
|
|
8542
8851
|
]
|
|
8543
8852
|
});
|
|
8544
|
-
|
|
8545
|
-
F:
|
|
8853
|
+
invariant23(this._storage, "storage not set", {
|
|
8854
|
+
F: __dxlog_file31,
|
|
8546
8855
|
L: 264,
|
|
8547
8856
|
S: this,
|
|
8548
8857
|
A: [
|
|
@@ -8550,8 +8859,8 @@ var ClientServicesHost = class {
|
|
|
8550
8859
|
"'storage not set'"
|
|
8551
8860
|
]
|
|
8552
8861
|
});
|
|
8553
|
-
|
|
8554
|
-
F:
|
|
8862
|
+
invariant23(this._signalManager, "signal manager not set", {
|
|
8863
|
+
F: __dxlog_file31,
|
|
8555
8864
|
L: 265,
|
|
8556
8865
|
S: this,
|
|
8557
8866
|
A: [
|
|
@@ -8559,8 +8868,8 @@ var ClientServicesHost = class {
|
|
|
8559
8868
|
"'signal manager not set'"
|
|
8560
8869
|
]
|
|
8561
8870
|
});
|
|
8562
|
-
|
|
8563
|
-
F:
|
|
8871
|
+
invariant23(this._networkManager, "network manager not set", {
|
|
8872
|
+
F: __dxlog_file31,
|
|
8564
8873
|
L: 266,
|
|
8565
8874
|
S: this,
|
|
8566
8875
|
A: [
|
|
@@ -8569,10 +8878,10 @@ var ClientServicesHost = class {
|
|
|
8569
8878
|
]
|
|
8570
8879
|
});
|
|
8571
8880
|
this._opening = true;
|
|
8572
|
-
|
|
8881
|
+
log28("opening...", {
|
|
8573
8882
|
lockKey: this._resourceLock?.lockKey
|
|
8574
8883
|
}, {
|
|
8575
|
-
F:
|
|
8884
|
+
F: __dxlog_file31,
|
|
8576
8885
|
L: 269,
|
|
8577
8886
|
S: this,
|
|
8578
8887
|
C: (f, a) => f(...a)
|
|
@@ -8630,18 +8939,18 @@ var ClientServicesHost = class {
|
|
|
8630
8939
|
this._open = true;
|
|
8631
8940
|
this._statusUpdate.emit();
|
|
8632
8941
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
8633
|
-
|
|
8942
|
+
log28("opened", {
|
|
8634
8943
|
deviceKey
|
|
8635
8944
|
}, {
|
|
8636
|
-
F:
|
|
8945
|
+
F: __dxlog_file31,
|
|
8637
8946
|
L: 366,
|
|
8638
8947
|
S: this,
|
|
8639
8948
|
C: (f, a) => f(...a)
|
|
8640
8949
|
});
|
|
8641
|
-
|
|
8950
|
+
log28.trace("dxos.client-services.host.open", trace10.end({
|
|
8642
8951
|
id: traceId
|
|
8643
8952
|
}), {
|
|
8644
|
-
F:
|
|
8953
|
+
F: __dxlog_file31,
|
|
8645
8954
|
L: 367,
|
|
8646
8955
|
S: this,
|
|
8647
8956
|
C: (f, a) => f(...a)
|
|
@@ -8652,10 +8961,10 @@ var ClientServicesHost = class {
|
|
|
8652
8961
|
return;
|
|
8653
8962
|
}
|
|
8654
8963
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
8655
|
-
|
|
8964
|
+
log28("closing...", {
|
|
8656
8965
|
deviceKey
|
|
8657
8966
|
}, {
|
|
8658
|
-
F:
|
|
8967
|
+
F: __dxlog_file31,
|
|
8659
8968
|
L: 378,
|
|
8660
8969
|
S: this,
|
|
8661
8970
|
C: (f, a) => f(...a)
|
|
@@ -8670,10 +8979,10 @@ var ClientServicesHost = class {
|
|
|
8670
8979
|
await this._level?.close();
|
|
8671
8980
|
this._open = false;
|
|
8672
8981
|
this._statusUpdate.emit();
|
|
8673
|
-
|
|
8982
|
+
log28("closed", {
|
|
8674
8983
|
deviceKey
|
|
8675
8984
|
}, {
|
|
8676
|
-
F:
|
|
8985
|
+
F: __dxlog_file31,
|
|
8677
8986
|
L: 387,
|
|
8678
8987
|
S: this,
|
|
8679
8988
|
C: (f, a) => f(...a)
|
|
@@ -8681,16 +8990,16 @@ var ClientServicesHost = class {
|
|
|
8681
8990
|
}
|
|
8682
8991
|
async reset() {
|
|
8683
8992
|
const traceId = PublicKey19.random().toHex();
|
|
8684
|
-
|
|
8993
|
+
log28.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
8685
8994
|
id: traceId
|
|
8686
8995
|
}), {
|
|
8687
|
-
F:
|
|
8996
|
+
F: __dxlog_file31,
|
|
8688
8997
|
L: 392,
|
|
8689
8998
|
S: this,
|
|
8690
8999
|
C: (f, a) => f(...a)
|
|
8691
9000
|
});
|
|
8692
|
-
|
|
8693
|
-
F:
|
|
9001
|
+
log28.info("resetting...", void 0, {
|
|
9002
|
+
F: __dxlog_file31,
|
|
8694
9003
|
L: 394,
|
|
8695
9004
|
S: this,
|
|
8696
9005
|
C: (f, a) => f(...a)
|
|
@@ -8699,16 +9008,16 @@ var ClientServicesHost = class {
|
|
|
8699
9008
|
this._statusUpdate.emit();
|
|
8700
9009
|
await this._serviceContext?.close();
|
|
8701
9010
|
await this._storage.reset();
|
|
8702
|
-
|
|
8703
|
-
F:
|
|
9011
|
+
log28.info("reset", void 0, {
|
|
9012
|
+
F: __dxlog_file31,
|
|
8704
9013
|
L: 401,
|
|
8705
9014
|
S: this,
|
|
8706
9015
|
C: (f, a) => f(...a)
|
|
8707
9016
|
});
|
|
8708
|
-
|
|
9017
|
+
log28.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
8709
9018
|
id: traceId
|
|
8710
9019
|
}), {
|
|
8711
|
-
F:
|
|
9020
|
+
F: __dxlog_file31,
|
|
8712
9021
|
L: 402,
|
|
8713
9022
|
S: this,
|
|
8714
9023
|
C: (f, a) => f(...a)
|
|
@@ -8721,29 +9030,28 @@ var ClientServicesHost = class {
|
|
|
8721
9030
|
return identity;
|
|
8722
9031
|
}
|
|
8723
9032
|
};
|
|
8724
|
-
|
|
9033
|
+
_ts_decorate11([
|
|
8725
9034
|
Trace4.info()
|
|
8726
9035
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
8727
|
-
|
|
9036
|
+
_ts_decorate11([
|
|
8728
9037
|
Trace4.info()
|
|
8729
9038
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
8730
|
-
|
|
9039
|
+
_ts_decorate11([
|
|
8731
9040
|
Trace4.info()
|
|
8732
9041
|
], ClientServicesHost.prototype, "_resetting", void 0);
|
|
8733
|
-
|
|
9042
|
+
_ts_decorate11([
|
|
8734
9043
|
synchronized4,
|
|
8735
9044
|
Trace4.span()
|
|
8736
9045
|
], ClientServicesHost.prototype, "open", null);
|
|
8737
|
-
|
|
9046
|
+
_ts_decorate11([
|
|
8738
9047
|
synchronized4,
|
|
8739
9048
|
Trace4.span()
|
|
8740
9049
|
], ClientServicesHost.prototype, "close", null);
|
|
8741
|
-
ClientServicesHost =
|
|
9050
|
+
ClientServicesHost = _ts_decorate11([
|
|
8742
9051
|
Trace4.resource()
|
|
8743
9052
|
], ClientServicesHost);
|
|
8744
9053
|
|
|
8745
9054
|
export {
|
|
8746
|
-
Buffer,
|
|
8747
9055
|
subscribeToFeeds,
|
|
8748
9056
|
subscribeToFeedBlocks,
|
|
8749
9057
|
subscribeToNetworkStatus,
|
|
@@ -8757,6 +9065,7 @@ export {
|
|
|
8757
9065
|
createDiagnostics,
|
|
8758
9066
|
createCollectDiagnosticsBroadcastSender,
|
|
8759
9067
|
createCollectDiagnosticsBroadcastHandler,
|
|
9068
|
+
DiagnosticsCollector,
|
|
8760
9069
|
createAuthProvider,
|
|
8761
9070
|
TrustedKeySetAuthVerifier,
|
|
8762
9071
|
EdgeFeedReplicator,
|
|
@@ -8774,12 +9083,17 @@ export {
|
|
|
8774
9083
|
InvitationsManager,
|
|
8775
9084
|
Lock,
|
|
8776
9085
|
isLocked,
|
|
9086
|
+
ClientRpcServer,
|
|
8777
9087
|
EdgeAgentManager,
|
|
8778
9088
|
EdgeAgentServiceImpl,
|
|
8779
9089
|
ServiceContext,
|
|
8780
9090
|
ServiceRegistry,
|
|
8781
9091
|
createStorageObjects,
|
|
8782
9092
|
createLevel,
|
|
9093
|
+
encodeProfileArchive,
|
|
9094
|
+
decodeProfileArchive,
|
|
9095
|
+
exportProfileData,
|
|
9096
|
+
importProfileData,
|
|
8783
9097
|
ClientServicesHost
|
|
8784
9098
|
};
|
|
8785
|
-
//# sourceMappingURL=chunk-
|
|
9099
|
+
//# sourceMappingURL=chunk-Z3SSMM5X.mjs.map
|