@dxos/client-services 0.1.52 → 0.1.53-main.00be1a9
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-C3SPTMW3.mjs → chunk-RKD47ENR.mjs} +678 -638
- package/dist/lib/browser/chunk-RKD47ENR.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +94 -119
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +6 -6
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +739 -726
- 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 +650 -612
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- 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/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -21
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/package.json +33 -32
- package/src/packlets/devtools/devtools.ts +2 -2
- package/src/packlets/identity/identity-manager.test.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +8 -8
- package/src/packlets/identity/identity-service.ts +2 -2
- package/src/packlets/identity/identity.test.ts +1 -1
- package/src/packlets/identity/identity.ts +2 -2
- package/src/packlets/invitations/device-invitation-protocol.ts +4 -4
- package/src/packlets/invitations/invitation-extension.ts +5 -5
- package/src/packlets/invitations/invitations-handler.ts +6 -6
- package/src/packlets/invitations/invitations-service.ts +3 -3
- package/src/packlets/invitations/space-invitation-protocol.ts +9 -9
- package/src/packlets/locks/node.ts +2 -2
- package/src/packlets/logging/logging-service.ts +4 -4
- package/src/packlets/services/service-context.test.ts +1 -1
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +19 -10
- package/src/packlets/spaces/data-space-manager.ts +5 -6
- package/src/packlets/spaces/notarization-plugin.ts +4 -4
- package/src/packlets/spaces/spaces-service.ts +20 -24
- package/src/packlets/testing/invitation-utils.ts +2 -2
- package/src/packlets/testing/test-builder.ts +1 -2
- package/src/packlets/vault/iframe-host-runtime.ts +2 -2
- package/src/packlets/vault/iframe-proxy-runtime.ts +2 -2
- package/src/packlets/vault/shell-runtime.ts +3 -49
- package/src/packlets/vault/worker-session.ts +2 -2
- package/dist/lib/browser/chunk-C3SPTMW3.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -44,7 +44,6 @@ __export(src_exports, {
|
|
|
44
44
|
InvitationsHandler: () => InvitationsHandler,
|
|
45
45
|
InvitationsServiceImpl: () => InvitationsServiceImpl,
|
|
46
46
|
Lock: () => Lock,
|
|
47
|
-
MemoryShellRuntime: () => MemoryShellRuntime,
|
|
48
47
|
ServiceContext: () => ServiceContext,
|
|
49
48
|
ServiceRegistry: () => ServiceRegistry,
|
|
50
49
|
ShellRuntimeImpl: () => ShellRuntimeImpl,
|
|
@@ -54,6 +53,7 @@ __export(src_exports, {
|
|
|
54
53
|
WorkerRuntime: () => WorkerRuntime,
|
|
55
54
|
WorkerSession: () => WorkerSession,
|
|
56
55
|
createAuthProvider: () => createAuthProvider,
|
|
56
|
+
createDefaultModelFactory: () => createDefaultModelFactory,
|
|
57
57
|
createStorageObjects: () => createStorageObjects,
|
|
58
58
|
getNetworkPeers: () => getNetworkPeers,
|
|
59
59
|
isLocked: () => isLocked,
|
|
@@ -315,8 +315,10 @@ var DevtoolsServiceImpl = class {
|
|
|
315
315
|
});
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
getConfig(request) {
|
|
319
|
-
|
|
318
|
+
async getConfig(request) {
|
|
319
|
+
return {
|
|
320
|
+
config: JSON.stringify(this.params.config.values)
|
|
321
|
+
};
|
|
320
322
|
}
|
|
321
323
|
async getStorageInfo() {
|
|
322
324
|
var _a, _b, _c, _d, _e;
|
|
@@ -417,6 +419,7 @@ var import_context2 = require("@dxos/context");
|
|
|
417
419
|
var import_credentials = require("@dxos/credentials");
|
|
418
420
|
var import_log = require("@dxos/log");
|
|
419
421
|
var import_protocols = require("@dxos/protocols");
|
|
422
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
420
423
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
421
424
|
const credential = await signer.createCredential({
|
|
422
425
|
assertion: {
|
|
@@ -442,20 +445,20 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
442
445
|
(0, import_log.log)("authenticating...", {
|
|
443
446
|
credential
|
|
444
447
|
}, {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
448
|
+
F: __dxlog_file,
|
|
449
|
+
L: 57,
|
|
450
|
+
S: this,
|
|
451
|
+
C: (f, a) => f(...a)
|
|
449
452
|
});
|
|
450
453
|
const result = await (0, import_credentials.verifyCredential)(credential);
|
|
451
454
|
if (result.kind === "fail") {
|
|
452
455
|
(0, import_log.log)("Invalid credential", {
|
|
453
456
|
result
|
|
454
457
|
}, {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
458
|
+
F: __dxlog_file,
|
|
459
|
+
L: 61,
|
|
460
|
+
S: this,
|
|
461
|
+
C: (f, a) => f(...a)
|
|
459
462
|
});
|
|
460
463
|
return false;
|
|
461
464
|
}
|
|
@@ -464,10 +467,10 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
464
467
|
nonce,
|
|
465
468
|
credential
|
|
466
469
|
}, {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
F: __dxlog_file,
|
|
471
|
+
L: 66,
|
|
472
|
+
S: this,
|
|
473
|
+
C: (f, a) => f(...a)
|
|
471
474
|
});
|
|
472
475
|
return false;
|
|
473
476
|
}
|
|
@@ -475,10 +478,10 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
475
478
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
476
479
|
key: credential.issuer
|
|
477
480
|
}, {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
481
|
+
F: __dxlog_file,
|
|
482
|
+
L: 71,
|
|
483
|
+
S: this,
|
|
484
|
+
C: (f, a) => f(...a)
|
|
482
485
|
});
|
|
483
486
|
return true;
|
|
484
487
|
}
|
|
@@ -491,20 +494,20 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
491
494
|
(0, import_log.log)("auth success", {
|
|
492
495
|
key: credential.issuer
|
|
493
496
|
}, {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
497
|
+
F: __dxlog_file,
|
|
498
|
+
L: 82,
|
|
499
|
+
S: this,
|
|
500
|
+
C: (f, a) => f(...a)
|
|
498
501
|
});
|
|
499
502
|
trigger.wake(true);
|
|
500
503
|
} else {
|
|
501
504
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
502
505
|
key: credential.issuer
|
|
503
506
|
}, {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
F: __dxlog_file,
|
|
508
|
+
L: 85,
|
|
509
|
+
S: this,
|
|
510
|
+
C: (f, a) => f(...a)
|
|
508
511
|
});
|
|
509
512
|
}
|
|
510
513
|
});
|
|
@@ -526,7 +529,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
526
529
|
};
|
|
527
530
|
|
|
528
531
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
529
|
-
var
|
|
532
|
+
var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
530
533
|
var import_async5 = require("@dxos/async");
|
|
531
534
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
532
535
|
var import_credentials2 = require("@dxos/credentials");
|
|
@@ -534,6 +537,7 @@ var import_debug = require("@dxos/debug");
|
|
|
534
537
|
var import_feed_store2 = require("@dxos/feed-store");
|
|
535
538
|
var import_log2 = require("@dxos/log");
|
|
536
539
|
var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
540
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
537
541
|
var Identity = class {
|
|
538
542
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
539
543
|
this.stateUpdate = new import_async5.Event();
|
|
@@ -608,7 +612,7 @@ var Identity = class {
|
|
|
608
612
|
* Requires identity to be ready.
|
|
609
613
|
*/
|
|
610
614
|
getIdentityCredentialSigner() {
|
|
611
|
-
(0,
|
|
615
|
+
(0, import_tiny_invariant.default)(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
|
|
612
616
|
return (0, import_credentials2.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.processor.deviceCredentialChain, this.deviceKey);
|
|
613
617
|
}
|
|
614
618
|
/**
|
|
@@ -625,10 +629,10 @@ var Identity = class {
|
|
|
625
629
|
controlFeedKey,
|
|
626
630
|
dataFeedKey
|
|
627
631
|
}, {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
+
F: __dxlog_file2,
|
|
633
|
+
L: 156,
|
|
634
|
+
S: this,
|
|
635
|
+
C: (f, a) => f(...a)
|
|
632
636
|
});
|
|
633
637
|
const signer = this.getIdentityCredentialSigner();
|
|
634
638
|
await (0, import_feed_store2.writeMessages)(this.controlPipeline.writer, [
|
|
@@ -669,7 +673,7 @@ var Identity = class {
|
|
|
669
673
|
};
|
|
670
674
|
|
|
671
675
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
672
|
-
var
|
|
676
|
+
var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
|
|
673
677
|
var import_async6 = require("@dxos/async");
|
|
674
678
|
var import_credentials4 = require("@dxos/credentials");
|
|
675
679
|
var import_keys4 = require("@dxos/keys");
|
|
@@ -677,6 +681,7 @@ var import_log3 = require("@dxos/log");
|
|
|
677
681
|
var import_protocols2 = require("@dxos/protocols");
|
|
678
682
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
679
683
|
var import_util2 = require("@dxos/util");
|
|
684
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
680
685
|
var IdentityManager = class {
|
|
681
686
|
// TODO(burdon): IdentityManagerParams.
|
|
682
687
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
@@ -696,20 +701,20 @@ var IdentityManager = class {
|
|
|
696
701
|
import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
|
|
697
702
|
id: traceId
|
|
698
703
|
}), {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
704
|
+
F: __dxlog_file3,
|
|
705
|
+
L: 70,
|
|
706
|
+
S: this,
|
|
707
|
+
C: (f, a) => f(...a)
|
|
703
708
|
});
|
|
704
709
|
await this._metadataStore.load();
|
|
705
710
|
const identityRecord = this._metadataStore.getIdentityRecord();
|
|
706
711
|
(0, import_log3.log)("identity record", {
|
|
707
712
|
identityRecord
|
|
708
713
|
}, {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
714
|
+
F: __dxlog_file3,
|
|
715
|
+
L: 74,
|
|
716
|
+
S: this,
|
|
717
|
+
C: (f, a) => f(...a)
|
|
713
718
|
});
|
|
714
719
|
if (identityRecord) {
|
|
715
720
|
this._identity = await this._constructIdentity(identityRecord);
|
|
@@ -719,20 +724,20 @@ var IdentityManager = class {
|
|
|
719
724
|
identityKey: identityRecord.identityKey,
|
|
720
725
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
721
726
|
}, {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
727
|
+
F: __dxlog_file3,
|
|
728
|
+
L: 79,
|
|
729
|
+
S: this,
|
|
730
|
+
C: (f, a) => f(...a)
|
|
726
731
|
});
|
|
727
732
|
this.stateUpdate.emit();
|
|
728
733
|
}
|
|
729
734
|
import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.end({
|
|
730
735
|
id: traceId
|
|
731
736
|
}), {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
737
|
+
F: __dxlog_file3,
|
|
738
|
+
L: 85,
|
|
739
|
+
S: this,
|
|
740
|
+
C: (f, a) => f(...a)
|
|
736
741
|
});
|
|
737
742
|
}
|
|
738
743
|
async close() {
|
|
@@ -741,12 +746,12 @@ var IdentityManager = class {
|
|
|
741
746
|
}
|
|
742
747
|
async createIdentity({ displayName } = {}) {
|
|
743
748
|
var _a;
|
|
744
|
-
(0,
|
|
745
|
-
(0, import_log3.log)("creating identity...",
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
749
|
+
(0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
|
|
750
|
+
(0, import_log3.log)("creating identity...", void 0, {
|
|
751
|
+
F: __dxlog_file3,
|
|
752
|
+
L: 94,
|
|
753
|
+
S: this,
|
|
754
|
+
C: (f, a) => f(...a)
|
|
750
755
|
});
|
|
751
756
|
const controlFeedKey = await this._keyring.createKey();
|
|
752
757
|
const identityRecord = {
|
|
@@ -763,8 +768,8 @@ var IdentityManager = class {
|
|
|
763
768
|
await identity.open();
|
|
764
769
|
{
|
|
765
770
|
const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
766
|
-
(0,
|
|
767
|
-
(0,
|
|
771
|
+
(0, import_tiny_invariant2.default)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
|
|
772
|
+
(0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
|
|
768
773
|
const credentials = [
|
|
769
774
|
// Space genesis.
|
|
770
775
|
...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
|
|
@@ -792,20 +797,20 @@ var IdentityManager = class {
|
|
|
792
797
|
identityKey: identityRecord.identityKey,
|
|
793
798
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
794
799
|
}, {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
800
|
+
F: __dxlog_file3,
|
|
801
|
+
L: 149,
|
|
802
|
+
S: this,
|
|
803
|
+
C: (f, a) => f(...a)
|
|
799
804
|
});
|
|
800
805
|
this.stateUpdate.emit();
|
|
801
806
|
(0, import_log3.log)("created identity", {
|
|
802
807
|
identityKey: identity.identityKey,
|
|
803
808
|
deviceKey: identity.deviceKey
|
|
804
809
|
}, {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
810
|
+
F: __dxlog_file3,
|
|
811
|
+
L: 155,
|
|
812
|
+
S: this,
|
|
813
|
+
C: (f, a) => f(...a)
|
|
809
814
|
});
|
|
810
815
|
return identity;
|
|
811
816
|
}
|
|
@@ -817,12 +822,12 @@ var IdentityManager = class {
|
|
|
817
822
|
(0, import_log3.log)("accepting identity", {
|
|
818
823
|
params
|
|
819
824
|
}, {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
825
|
+
F: __dxlog_file3,
|
|
826
|
+
L: 163,
|
|
827
|
+
S: this,
|
|
828
|
+
C: (f, a) => f(...a)
|
|
824
829
|
});
|
|
825
|
-
(0,
|
|
830
|
+
(0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
|
|
826
831
|
const identityRecord = {
|
|
827
832
|
identityKey: params.identityKey,
|
|
828
833
|
deviceKey: params.deviceKey,
|
|
@@ -843,38 +848,38 @@ var IdentityManager = class {
|
|
|
843
848
|
identityKey: identityRecord.identityKey,
|
|
844
849
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
845
850
|
}, {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
851
|
+
F: __dxlog_file3,
|
|
852
|
+
L: 183,
|
|
853
|
+
S: this,
|
|
854
|
+
C: (f, a) => f(...a)
|
|
850
855
|
});
|
|
851
856
|
this.stateUpdate.emit();
|
|
852
857
|
(0, import_log3.log)("accepted identity", {
|
|
853
858
|
identityKey: identity.identityKey,
|
|
854
859
|
deviceKey: identity.deviceKey
|
|
855
860
|
}, {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
861
|
+
F: __dxlog_file3,
|
|
862
|
+
L: 189,
|
|
863
|
+
S: this,
|
|
864
|
+
C: (f, a) => f(...a)
|
|
860
865
|
});
|
|
861
866
|
return identity;
|
|
862
867
|
}
|
|
863
868
|
async _constructIdentity(identityRecord) {
|
|
864
|
-
(0,
|
|
869
|
+
(0, import_tiny_invariant2.default)(!this._identity);
|
|
865
870
|
(0, import_log3.log)("constructing identity", {
|
|
866
871
|
identityRecord
|
|
867
872
|
}, {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
873
|
+
F: __dxlog_file3,
|
|
874
|
+
L: 195,
|
|
875
|
+
S: this,
|
|
876
|
+
C: (f, a) => f(...a)
|
|
872
877
|
});
|
|
873
|
-
(0,
|
|
878
|
+
(0, import_tiny_invariant2.default)(identityRecord.haloSpace.controlFeedKey);
|
|
874
879
|
const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
|
|
875
880
|
writable: true
|
|
876
881
|
});
|
|
877
|
-
(0,
|
|
882
|
+
(0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey);
|
|
878
883
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
879
884
|
writable: true,
|
|
880
885
|
sparse: true
|
|
@@ -899,10 +904,10 @@ var IdentityManager = class {
|
|
|
899
904
|
(0, import_log3.log)("done", {
|
|
900
905
|
identityKey: identityRecord.identityKey
|
|
901
906
|
}, {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
907
|
+
F: __dxlog_file3,
|
|
908
|
+
L: 226,
|
|
909
|
+
S: this,
|
|
910
|
+
C: (f, a) => f(...a)
|
|
906
911
|
});
|
|
907
912
|
if (identityRecord.haloSpace.controlTimeframe) {
|
|
908
913
|
identity.controlPipeline.state.setTargetTimeframe(identityRecord.haloSpace.controlTimeframe);
|
|
@@ -919,11 +924,11 @@ var IdentityManager = class {
|
|
|
919
924
|
onNetworkConnection: () => {
|
|
920
925
|
},
|
|
921
926
|
onAuthFailure: () => {
|
|
922
|
-
import_log3.log.warn("auth failure",
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
+
import_log3.log.warn("auth failure", void 0, {
|
|
928
|
+
F: __dxlog_file3,
|
|
929
|
+
L: 245,
|
|
930
|
+
S: this,
|
|
931
|
+
C: (f, a) => f(...a)
|
|
927
932
|
});
|
|
928
933
|
},
|
|
929
934
|
memberKey: identityKey
|
|
@@ -932,7 +937,7 @@ var IdentityManager = class {
|
|
|
932
937
|
};
|
|
933
938
|
|
|
934
939
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
935
|
-
var
|
|
940
|
+
var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
|
|
936
941
|
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
937
942
|
var import_credentials6 = require("@dxos/credentials");
|
|
938
943
|
var import_debug2 = require("@dxos/debug");
|
|
@@ -968,7 +973,7 @@ var IdentityServiceImpl = class {
|
|
|
968
973
|
};
|
|
969
974
|
}
|
|
970
975
|
async signPresentation({ presentation, nonce }) {
|
|
971
|
-
(0,
|
|
976
|
+
(0, import_tiny_invariant3.default)(this._serviceContext.identityManager.identity, "Identity not initialized.");
|
|
972
977
|
return await (0, import_credentials6.signPresentation)({
|
|
973
978
|
presentation,
|
|
974
979
|
signer: this._serviceContext.keyring,
|
|
@@ -980,7 +985,7 @@ var IdentityServiceImpl = class {
|
|
|
980
985
|
};
|
|
981
986
|
|
|
982
987
|
// packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
|
|
983
|
-
var
|
|
988
|
+
var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
|
|
984
989
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
985
990
|
var DeviceInvitationProtocol = class {
|
|
986
991
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
@@ -997,7 +1002,7 @@ var DeviceInvitationProtocol = class {
|
|
|
997
1002
|
};
|
|
998
1003
|
}
|
|
999
1004
|
async admit(request) {
|
|
1000
|
-
(0,
|
|
1005
|
+
(0, import_tiny_invariant4.default)(request.device);
|
|
1001
1006
|
const identity = this._getIdentity();
|
|
1002
1007
|
await identity.admitDevice(request.device);
|
|
1003
1008
|
return {
|
|
@@ -1025,9 +1030,9 @@ var DeviceInvitationProtocol = class {
|
|
|
1025
1030
|
};
|
|
1026
1031
|
}
|
|
1027
1032
|
async accept(response, request) {
|
|
1028
|
-
(0,
|
|
1033
|
+
(0, import_tiny_invariant4.default)(response.device);
|
|
1029
1034
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1030
|
-
(0,
|
|
1035
|
+
(0, import_tiny_invariant4.default)(request.device);
|
|
1031
1036
|
const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
|
|
1032
1037
|
await this._acceptIdentity({
|
|
1033
1038
|
identityKey,
|
|
@@ -1045,7 +1050,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1045
1050
|
};
|
|
1046
1051
|
|
|
1047
1052
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1048
|
-
var
|
|
1053
|
+
var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
|
|
1049
1054
|
var import_async8 = require("@dxos/async");
|
|
1050
1055
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
1051
1056
|
var import_context4 = require("@dxos/context");
|
|
@@ -1059,7 +1064,7 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
1059
1064
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1060
1065
|
|
|
1061
1066
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1062
|
-
var
|
|
1067
|
+
var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
|
|
1063
1068
|
var import_async7 = require("@dxos/async");
|
|
1064
1069
|
var import_context3 = require("@dxos/context");
|
|
1065
1070
|
var import_errors = require("@dxos/errors");
|
|
@@ -1069,6 +1074,7 @@ var import_protocols3 = require("@dxos/protocols");
|
|
|
1069
1074
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1070
1075
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1071
1076
|
var import_teleport = require("@dxos/teleport");
|
|
1077
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
|
|
1072
1078
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1073
1079
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1074
1080
|
var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
@@ -1096,7 +1102,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1096
1102
|
// Perhaps in the future we will have more complex logic here.
|
|
1097
1103
|
InvitationHostService: {
|
|
1098
1104
|
options: async (options) => {
|
|
1099
|
-
(0,
|
|
1105
|
+
(0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
|
|
1100
1106
|
this._remoteOptions = options;
|
|
1101
1107
|
this._remoteOptionsTrigger.wake();
|
|
1102
1108
|
},
|
|
@@ -1106,20 +1112,20 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1106
1112
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
|
|
1107
1113
|
id: traceId
|
|
1108
1114
|
}), {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1115
|
+
F: __dxlog_file4,
|
|
1116
|
+
L: 98,
|
|
1117
|
+
S: this,
|
|
1118
|
+
C: (f, a) => f(...a)
|
|
1113
1119
|
});
|
|
1114
1120
|
const invitation = await this._callbacks.resolveInvitation(request);
|
|
1115
1121
|
if (!invitation) {
|
|
1116
1122
|
import_log4.log.warn("invitation not found", {
|
|
1117
1123
|
invitationId
|
|
1118
1124
|
}, {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1125
|
+
F: __dxlog_file4,
|
|
1126
|
+
L: 102,
|
|
1127
|
+
S: this,
|
|
1128
|
+
C: (f, a) => f(...a)
|
|
1123
1129
|
});
|
|
1124
1130
|
this._callbacks.onError(new Error("Invitation not found."));
|
|
1125
1131
|
return {
|
|
@@ -1130,10 +1136,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1130
1136
|
(0, import_log4.log)("guest introduced itself", {
|
|
1131
1137
|
guestProfile: profile
|
|
1132
1138
|
}, {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1139
|
+
F: __dxlog_file4,
|
|
1140
|
+
L: 111,
|
|
1141
|
+
S: this,
|
|
1142
|
+
C: (f, a) => f(...a)
|
|
1137
1143
|
});
|
|
1138
1144
|
this.guestProfile = profile;
|
|
1139
1145
|
this._callbacks.onStateUpdate({
|
|
@@ -1143,10 +1149,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1143
1149
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
|
|
1144
1150
|
id: traceId
|
|
1145
1151
|
}), {
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1152
|
+
F: __dxlog_file4,
|
|
1153
|
+
L: 118,
|
|
1154
|
+
S: this,
|
|
1155
|
+
C: (f, a) => f(...a)
|
|
1150
1156
|
});
|
|
1151
1157
|
return {
|
|
1152
1158
|
spaceKey: this.invitation.authMethod === import_services2.Invitation.AuthMethod.NONE ? this.invitation.spaceKey : void 0,
|
|
@@ -1158,28 +1164,28 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1158
1164
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
|
|
1159
1165
|
id: traceId
|
|
1160
1166
|
}), {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1167
|
+
F: __dxlog_file4,
|
|
1168
|
+
L: 127,
|
|
1169
|
+
S: this,
|
|
1170
|
+
C: (f, a) => f(...a)
|
|
1165
1171
|
});
|
|
1166
1172
|
(0, import_log4.log)("received authentication request", {
|
|
1167
1173
|
authCode: code
|
|
1168
1174
|
}, {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1175
|
+
F: __dxlog_file4,
|
|
1176
|
+
L: 128,
|
|
1177
|
+
S: this,
|
|
1178
|
+
C: (f, a) => f(...a)
|
|
1173
1179
|
});
|
|
1174
1180
|
let status = import_invitations.AuthenticationResponse.Status.OK;
|
|
1175
|
-
(0,
|
|
1181
|
+
(0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
|
|
1176
1182
|
switch (this.invitation.authMethod) {
|
|
1177
1183
|
case import_services2.Invitation.AuthMethod.NONE: {
|
|
1178
|
-
(0, import_log4.log)("authentication not required",
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1184
|
+
(0, import_log4.log)("authentication not required", void 0, {
|
|
1185
|
+
F: __dxlog_file4,
|
|
1186
|
+
L: 134,
|
|
1187
|
+
S: this,
|
|
1188
|
+
C: (f, a) => f(...a)
|
|
1183
1189
|
});
|
|
1184
1190
|
return {
|
|
1185
1191
|
status: import_invitations.AuthenticationResponse.Status.OK
|
|
@@ -1201,10 +1207,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1201
1207
|
import_log4.log.error("invalid authentication method", {
|
|
1202
1208
|
authMethod: this.invitation.authMethod
|
|
1203
1209
|
}, {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1210
|
+
F: __dxlog_file4,
|
|
1211
|
+
L: 152,
|
|
1212
|
+
S: this,
|
|
1213
|
+
C: (f, a) => f(...a)
|
|
1208
1214
|
});
|
|
1209
1215
|
status = import_invitations.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
1210
1216
|
break;
|
|
@@ -1216,10 +1222,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1216
1222
|
status
|
|
1217
1223
|
}
|
|
1218
1224
|
}), {
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1225
|
+
F: __dxlog_file4,
|
|
1226
|
+
L: 158,
|
|
1227
|
+
S: this,
|
|
1228
|
+
C: (f, a) => f(...a)
|
|
1223
1229
|
});
|
|
1224
1230
|
return {
|
|
1225
1231
|
status
|
|
@@ -1230,13 +1236,13 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1230
1236
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
|
|
1231
1237
|
id: traceId
|
|
1232
1238
|
}), {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1239
|
+
F: __dxlog_file4,
|
|
1240
|
+
L: 164,
|
|
1241
|
+
S: this,
|
|
1242
|
+
C: (f, a) => f(...a)
|
|
1237
1243
|
});
|
|
1238
1244
|
try {
|
|
1239
|
-
(0,
|
|
1245
|
+
(0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
|
|
1240
1246
|
if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
|
|
1241
1247
|
throw new Error("Not authenticated");
|
|
1242
1248
|
}
|
|
@@ -1244,10 +1250,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1244
1250
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
|
|
1245
1251
|
id: traceId
|
|
1246
1252
|
}), {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1253
|
+
F: __dxlog_file4,
|
|
1254
|
+
L: 175,
|
|
1255
|
+
S: this,
|
|
1256
|
+
C: (f, a) => f(...a)
|
|
1251
1257
|
});
|
|
1252
1258
|
return response;
|
|
1253
1259
|
} catch (err) {
|
|
@@ -1301,7 +1307,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1301
1307
|
return {
|
|
1302
1308
|
InvitationHostService: {
|
|
1303
1309
|
options: async (options) => {
|
|
1304
|
-
(0,
|
|
1310
|
+
(0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
|
|
1305
1311
|
this._remoteOptions = options;
|
|
1306
1312
|
this._remoteOptionsTrigger.wake();
|
|
1307
1313
|
},
|
|
@@ -1321,11 +1327,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1321
1327
|
var _a;
|
|
1322
1328
|
await super.onOpen(context);
|
|
1323
1329
|
try {
|
|
1324
|
-
(0, import_log4.log)("begin options",
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1330
|
+
(0, import_log4.log)("begin options", void 0, {
|
|
1331
|
+
F: __dxlog_file4,
|
|
1332
|
+
L: 263,
|
|
1333
|
+
S: this,
|
|
1334
|
+
C: (f, a) => f(...a)
|
|
1329
1335
|
});
|
|
1330
1336
|
await (0, import_context3.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
1331
1337
|
role: import_invitations.Options.Role.GUEST
|
|
@@ -1333,11 +1339,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1333
1339
|
await (0, import_context3.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1334
1340
|
timeout: OPTIONS_TIMEOUT
|
|
1335
1341
|
}));
|
|
1336
|
-
(0, import_log4.log)("end options",
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1342
|
+
(0, import_log4.log)("end options", void 0, {
|
|
1343
|
+
F: __dxlog_file4,
|
|
1344
|
+
L: 266,
|
|
1345
|
+
S: this,
|
|
1346
|
+
C: (f, a) => f(...a)
|
|
1341
1347
|
});
|
|
1342
1348
|
if (((_a = this._remoteOptions) == null ? void 0 : _a.role) !== import_invitations.Options.Role.HOST) {
|
|
1343
1349
|
throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
|
|
@@ -1348,20 +1354,20 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1348
1354
|
this._callbacks.onOpen(this._ctx);
|
|
1349
1355
|
} catch (err) {
|
|
1350
1356
|
(0, import_log4.log)("openError", err, {
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1357
|
+
F: __dxlog_file4,
|
|
1358
|
+
L: 276,
|
|
1359
|
+
S: this,
|
|
1360
|
+
C: (f, a) => f(...a)
|
|
1355
1361
|
});
|
|
1356
1362
|
this._callbacks.onError(err);
|
|
1357
1363
|
}
|
|
1358
1364
|
}
|
|
1359
1365
|
async onClose() {
|
|
1360
|
-
(0, import_log4.log)("onClose",
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1366
|
+
(0, import_log4.log)("onClose", void 0, {
|
|
1367
|
+
F: __dxlog_file4,
|
|
1368
|
+
L: 282,
|
|
1369
|
+
S: this,
|
|
1370
|
+
C: (f, a) => f(...a)
|
|
1365
1371
|
});
|
|
1366
1372
|
await this._ctx.dispose();
|
|
1367
1373
|
}
|
|
@@ -1369,6 +1375,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1369
1375
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
|
|
1370
1376
|
|
|
1371
1377
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1378
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
1372
1379
|
var InvitationsHandler = class {
|
|
1373
1380
|
/**
|
|
1374
1381
|
* @internal
|
|
@@ -1380,7 +1387,7 @@ var InvitationsHandler = class {
|
|
|
1380
1387
|
var _a;
|
|
1381
1388
|
const { invitationId = import_keys6.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys6.PublicKey.random() } = options != null ? options : {};
|
|
1382
1389
|
const authCode = (_a = options == null ? void 0 : options.authCode) != null ? _a : authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0;
|
|
1383
|
-
(0,
|
|
1390
|
+
(0, import_tiny_invariant6.default)(protocol);
|
|
1384
1391
|
const invitation = {
|
|
1385
1392
|
invitationId,
|
|
1386
1393
|
type,
|
|
@@ -1402,10 +1409,10 @@ var InvitationsHandler = class {
|
|
|
1402
1409
|
(0, import_log5.log)("complete", {
|
|
1403
1410
|
...protocol.toJSON()
|
|
1404
1411
|
}, {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1412
|
+
F: __dxlog_file5,
|
|
1413
|
+
L: 99,
|
|
1414
|
+
S: this,
|
|
1415
|
+
C: (f, a) => f(...a)
|
|
1409
1416
|
});
|
|
1410
1417
|
stream.complete();
|
|
1411
1418
|
});
|
|
@@ -1427,7 +1434,7 @@ var InvitationsHandler = class {
|
|
|
1427
1434
|
var _a2, _b, _c;
|
|
1428
1435
|
try {
|
|
1429
1436
|
const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
|
|
1430
|
-
(0,
|
|
1437
|
+
(0, import_tiny_invariant6.default)(deviceKey);
|
|
1431
1438
|
const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
|
|
1432
1439
|
extension.completedTrigger.wake(deviceKey);
|
|
1433
1440
|
return admissionResponse;
|
|
@@ -1443,18 +1450,18 @@ var InvitationsHandler = class {
|
|
|
1443
1450
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1444
1451
|
id: traceId
|
|
1445
1452
|
}), {
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1453
|
+
F: __dxlog_file5,
|
|
1454
|
+
L: 138,
|
|
1455
|
+
S: this,
|
|
1456
|
+
C: (f, a) => f(...a)
|
|
1450
1457
|
});
|
|
1451
1458
|
(0, import_log5.log)("connected", {
|
|
1452
1459
|
...protocol.toJSON()
|
|
1453
1460
|
}, {
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1461
|
+
F: __dxlog_file5,
|
|
1462
|
+
L: 139,
|
|
1463
|
+
S: this,
|
|
1464
|
+
C: (f, a) => f(...a)
|
|
1458
1465
|
});
|
|
1459
1466
|
stream.next({
|
|
1460
1467
|
...invitation,
|
|
@@ -1467,10 +1474,10 @@ var InvitationsHandler = class {
|
|
|
1467
1474
|
guest: deviceKey,
|
|
1468
1475
|
...protocol.toJSON()
|
|
1469
1476
|
}, {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1477
|
+
F: __dxlog_file5,
|
|
1478
|
+
L: 142,
|
|
1479
|
+
S: this,
|
|
1480
|
+
C: (f, a) => f(...a)
|
|
1474
1481
|
});
|
|
1475
1482
|
stream.next({
|
|
1476
1483
|
...invitation,
|
|
@@ -1479,20 +1486,20 @@ var InvitationsHandler = class {
|
|
|
1479
1486
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1480
1487
|
id: traceId
|
|
1481
1488
|
}), {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1489
|
+
F: __dxlog_file5,
|
|
1490
|
+
L: 144,
|
|
1491
|
+
S: this,
|
|
1492
|
+
C: (f, a) => f(...a)
|
|
1486
1493
|
});
|
|
1487
1494
|
} catch (err) {
|
|
1488
1495
|
if (err instanceof import_async8.TimeoutError) {
|
|
1489
1496
|
(0, import_log5.log)("timeout", {
|
|
1490
1497
|
...protocol.toJSON()
|
|
1491
1498
|
}, {
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1499
|
+
F: __dxlog_file5,
|
|
1500
|
+
L: 147,
|
|
1501
|
+
S: this,
|
|
1502
|
+
C: (f, a) => f(...a)
|
|
1496
1503
|
});
|
|
1497
1504
|
stream.next({
|
|
1498
1505
|
...invitation,
|
|
@@ -1500,10 +1507,10 @@ var InvitationsHandler = class {
|
|
|
1500
1507
|
});
|
|
1501
1508
|
} else {
|
|
1502
1509
|
import_log5.log.error("failed", err, {
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1510
|
+
F: __dxlog_file5,
|
|
1511
|
+
L: 150,
|
|
1512
|
+
S: this,
|
|
1513
|
+
C: (f, a) => f(...a)
|
|
1507
1514
|
});
|
|
1508
1515
|
stream.error(err);
|
|
1509
1516
|
}
|
|
@@ -1511,10 +1518,10 @@ var InvitationsHandler = class {
|
|
|
1511
1518
|
id: traceId,
|
|
1512
1519
|
error: err
|
|
1513
1520
|
}), {
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1521
|
+
F: __dxlog_file5,
|
|
1522
|
+
L: 153,
|
|
1523
|
+
S: this,
|
|
1524
|
+
C: (f, a) => f(...a)
|
|
1518
1525
|
});
|
|
1519
1526
|
} finally {
|
|
1520
1527
|
if (type !== import_services3.Invitation.Type.MULTIUSE) {
|
|
@@ -1532,10 +1539,10 @@ var InvitationsHandler = class {
|
|
|
1532
1539
|
(0, import_log5.log)("timeout", {
|
|
1533
1540
|
...protocol.toJSON()
|
|
1534
1541
|
}, {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1542
|
+
F: __dxlog_file5,
|
|
1543
|
+
L: 168,
|
|
1544
|
+
S: this,
|
|
1545
|
+
C: (f, a) => f(...a)
|
|
1539
1546
|
});
|
|
1540
1547
|
stream.next({
|
|
1541
1548
|
...invitation,
|
|
@@ -1543,10 +1550,10 @@ var InvitationsHandler = class {
|
|
|
1543
1550
|
});
|
|
1544
1551
|
} else {
|
|
1545
1552
|
import_log5.log.error("failed", err, {
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1553
|
+
F: __dxlog_file5,
|
|
1554
|
+
L: 171,
|
|
1555
|
+
S: this,
|
|
1556
|
+
C: (f, a) => f(...a)
|
|
1550
1557
|
});
|
|
1551
1558
|
stream.error(err);
|
|
1552
1559
|
}
|
|
@@ -1586,13 +1593,13 @@ var InvitationsHandler = class {
|
|
|
1586
1593
|
}
|
|
1587
1594
|
acceptInvitation(protocol, invitation) {
|
|
1588
1595
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
1589
|
-
(0,
|
|
1596
|
+
(0, import_tiny_invariant6.default)(protocol);
|
|
1590
1597
|
const authenticated = new import_async8.Trigger();
|
|
1591
1598
|
let admitted = false;
|
|
1592
1599
|
let currentState;
|
|
1593
1600
|
const stream = new import_async8.PushStream();
|
|
1594
1601
|
const setState = (newData) => {
|
|
1595
|
-
(0,
|
|
1602
|
+
(0, import_tiny_invariant6.default)(newData.state !== void 0);
|
|
1596
1603
|
currentState = newData.state;
|
|
1597
1604
|
stream.next({
|
|
1598
1605
|
...invitation,
|
|
@@ -1605,20 +1612,20 @@ var InvitationsHandler = class {
|
|
|
1605
1612
|
(0, import_log5.log)("timeout", {
|
|
1606
1613
|
...protocol.toJSON()
|
|
1607
1614
|
}, {
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1615
|
+
F: __dxlog_file5,
|
|
1616
|
+
L: 230,
|
|
1617
|
+
S: this,
|
|
1618
|
+
C: (f, a) => f(...a)
|
|
1612
1619
|
});
|
|
1613
1620
|
setState({
|
|
1614
1621
|
state: import_services3.Invitation.State.TIMEOUT
|
|
1615
1622
|
});
|
|
1616
1623
|
} else {
|
|
1617
1624
|
import_log5.log.warn("auth failed", err, {
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1625
|
+
F: __dxlog_file5,
|
|
1626
|
+
L: 233,
|
|
1627
|
+
S: this,
|
|
1628
|
+
C: (f, a) => f(...a)
|
|
1622
1629
|
});
|
|
1623
1630
|
stream.error(err);
|
|
1624
1631
|
}
|
|
@@ -1629,10 +1636,10 @@ var InvitationsHandler = class {
|
|
|
1629
1636
|
(0, import_log5.log)("complete", {
|
|
1630
1637
|
...protocol.toJSON()
|
|
1631
1638
|
}, {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1639
|
+
F: __dxlog_file5,
|
|
1640
|
+
L: 241,
|
|
1641
|
+
S: this,
|
|
1642
|
+
C: (f, a) => f(...a)
|
|
1636
1643
|
});
|
|
1637
1644
|
stream.complete();
|
|
1638
1645
|
});
|
|
@@ -1644,10 +1651,10 @@ var InvitationsHandler = class {
|
|
|
1644
1651
|
(0, import_log5.log)("extension disposed", {
|
|
1645
1652
|
currentState
|
|
1646
1653
|
}, {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1654
|
+
F: __dxlog_file5,
|
|
1655
|
+
L: 251,
|
|
1656
|
+
S: this,
|
|
1657
|
+
C: (f, a) => f(...a)
|
|
1651
1658
|
});
|
|
1652
1659
|
if (!admitted) {
|
|
1653
1660
|
stream.error(new Error("Remote peer disconnected."));
|
|
@@ -1659,10 +1666,10 @@ var InvitationsHandler = class {
|
|
|
1659
1666
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
1660
1667
|
id: traceId
|
|
1661
1668
|
}), {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1669
|
+
F: __dxlog_file5,
|
|
1670
|
+
L: 260,
|
|
1671
|
+
S: this,
|
|
1672
|
+
C: (f, a) => f(...a)
|
|
1666
1673
|
});
|
|
1667
1674
|
if (++connectionCount > 1) {
|
|
1668
1675
|
throw new Error(`multiple connections detected: ${connectionCount}`);
|
|
@@ -1671,10 +1678,10 @@ var InvitationsHandler = class {
|
|
|
1671
1678
|
(0, import_log5.log)("connected", {
|
|
1672
1679
|
...protocol.toJSON()
|
|
1673
1680
|
}, {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1681
|
+
F: __dxlog_file5,
|
|
1682
|
+
L: 268,
|
|
1683
|
+
S: this,
|
|
1684
|
+
C: (f, a) => f(...a)
|
|
1678
1685
|
});
|
|
1679
1686
|
setState({
|
|
1680
1687
|
state: import_services3.Invitation.State.CONNECTED
|
|
@@ -1682,20 +1689,20 @@ var InvitationsHandler = class {
|
|
|
1682
1689
|
(0, import_log5.log)("introduce", {
|
|
1683
1690
|
...protocol.toJSON()
|
|
1684
1691
|
}, {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1692
|
+
F: __dxlog_file5,
|
|
1693
|
+
L: 272,
|
|
1694
|
+
S: this,
|
|
1695
|
+
C: (f, a) => f(...a)
|
|
1689
1696
|
});
|
|
1690
1697
|
const introductionResponse = await extension.rpc.InvitationHostService.introduce(protocol.createIntroduction());
|
|
1691
1698
|
(0, import_log5.log)("introduce response", {
|
|
1692
1699
|
...protocol.toJSON(),
|
|
1693
1700
|
response: introductionResponse
|
|
1694
1701
|
}, {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1702
|
+
F: __dxlog_file5,
|
|
1703
|
+
L: 276,
|
|
1704
|
+
S: this,
|
|
1705
|
+
C: (f, a) => f(...a)
|
|
1699
1706
|
});
|
|
1700
1707
|
invitation.authMethod = introductionResponse.authMethod;
|
|
1701
1708
|
if (introductionResponse.spaceKey) {
|
|
@@ -1703,11 +1710,11 @@ var InvitationsHandler = class {
|
|
|
1703
1710
|
}
|
|
1704
1711
|
if (isAuthenticationRequired(invitation)) {
|
|
1705
1712
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1706
|
-
(0, import_log5.log)("guest waiting for authentication code...",
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1713
|
+
(0, import_log5.log)("guest waiting for authentication code...", void 0, {
|
|
1714
|
+
F: __dxlog_file5,
|
|
1715
|
+
L: 285,
|
|
1716
|
+
S: this,
|
|
1717
|
+
C: (f, a) => f(...a)
|
|
1711
1718
|
});
|
|
1712
1719
|
setState({
|
|
1713
1720
|
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
@@ -1715,11 +1722,11 @@ var InvitationsHandler = class {
|
|
|
1715
1722
|
const authCode = await authenticated.wait({
|
|
1716
1723
|
timeout
|
|
1717
1724
|
});
|
|
1718
|
-
(0, import_log5.log)("sending authentication request",
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1725
|
+
(0, import_log5.log)("sending authentication request", void 0, {
|
|
1726
|
+
F: __dxlog_file5,
|
|
1727
|
+
L: 289,
|
|
1728
|
+
S: this,
|
|
1729
|
+
C: (f, a) => f(...a)
|
|
1723
1730
|
});
|
|
1724
1731
|
setState({
|
|
1725
1732
|
state: import_services3.Invitation.State.AUTHENTICATING
|
|
@@ -1737,10 +1744,10 @@ var InvitationsHandler = class {
|
|
|
1737
1744
|
(0, import_log5.log)("retrying invalid code", {
|
|
1738
1745
|
attempt
|
|
1739
1746
|
}, {
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1747
|
+
F: __dxlog_file5,
|
|
1748
|
+
L: 300,
|
|
1749
|
+
S: this,
|
|
1750
|
+
C: (f, a) => f(...a)
|
|
1744
1751
|
});
|
|
1745
1752
|
authenticated.reset();
|
|
1746
1753
|
}
|
|
@@ -1754,10 +1761,10 @@ var InvitationsHandler = class {
|
|
|
1754
1761
|
(0, import_log5.log)("request admission", {
|
|
1755
1762
|
...protocol.toJSON()
|
|
1756
1763
|
}, {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1764
|
+
F: __dxlog_file5,
|
|
1765
|
+
L: 311,
|
|
1766
|
+
S: this,
|
|
1767
|
+
C: (f, a) => f(...a)
|
|
1761
1768
|
});
|
|
1762
1769
|
const admissionRequest = await protocol.createAdmissionRequest();
|
|
1763
1770
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
@@ -1766,10 +1773,10 @@ var InvitationsHandler = class {
|
|
|
1766
1773
|
(0, import_log5.log)("admitted by host", {
|
|
1767
1774
|
...protocol.toJSON()
|
|
1768
1775
|
}, {
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1776
|
+
F: __dxlog_file5,
|
|
1777
|
+
L: 322,
|
|
1778
|
+
S: this,
|
|
1779
|
+
C: (f, a) => f(...a)
|
|
1773
1780
|
});
|
|
1774
1781
|
setState({
|
|
1775
1782
|
...result,
|
|
@@ -1778,30 +1785,30 @@ var InvitationsHandler = class {
|
|
|
1778
1785
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
1779
1786
|
id: traceId
|
|
1780
1787
|
}), {
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1788
|
+
F: __dxlog_file5,
|
|
1789
|
+
L: 324,
|
|
1790
|
+
S: this,
|
|
1791
|
+
C: (f, a) => f(...a)
|
|
1785
1792
|
});
|
|
1786
1793
|
} catch (err) {
|
|
1787
1794
|
if (err instanceof import_async8.TimeoutError) {
|
|
1788
1795
|
(0, import_log5.log)("timeout", {
|
|
1789
1796
|
...protocol.toJSON()
|
|
1790
1797
|
}, {
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1798
|
+
F: __dxlog_file5,
|
|
1799
|
+
L: 327,
|
|
1800
|
+
S: this,
|
|
1801
|
+
C: (f, a) => f(...a)
|
|
1795
1802
|
});
|
|
1796
1803
|
setState({
|
|
1797
1804
|
state: import_services3.Invitation.State.TIMEOUT
|
|
1798
1805
|
});
|
|
1799
1806
|
} else {
|
|
1800
1807
|
(0, import_log5.log)("auth failed", err, {
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1808
|
+
F: __dxlog_file5,
|
|
1809
|
+
L: 330,
|
|
1810
|
+
S: this,
|
|
1811
|
+
C: (f, a) => f(...a)
|
|
1805
1812
|
});
|
|
1806
1813
|
stream.error(err);
|
|
1807
1814
|
}
|
|
@@ -1809,10 +1816,10 @@ var InvitationsHandler = class {
|
|
|
1809
1816
|
id: traceId,
|
|
1810
1817
|
error: err
|
|
1811
1818
|
}), {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1819
|
+
F: __dxlog_file5,
|
|
1820
|
+
L: 333,
|
|
1821
|
+
S: this,
|
|
1822
|
+
C: (f, a) => f(...a)
|
|
1816
1823
|
});
|
|
1817
1824
|
} finally {
|
|
1818
1825
|
await ctx.dispose();
|
|
@@ -1827,20 +1834,20 @@ var InvitationsHandler = class {
|
|
|
1827
1834
|
(0, import_log5.log)("timeout", {
|
|
1828
1835
|
...protocol.toJSON()
|
|
1829
1836
|
}, {
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1837
|
+
F: __dxlog_file5,
|
|
1838
|
+
L: 344,
|
|
1839
|
+
S: this,
|
|
1840
|
+
C: (f, a) => f(...a)
|
|
1834
1841
|
});
|
|
1835
1842
|
setState({
|
|
1836
1843
|
state: import_services3.Invitation.State.TIMEOUT
|
|
1837
1844
|
});
|
|
1838
1845
|
} else {
|
|
1839
1846
|
(0, import_log5.log)("auth failed", err, {
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1847
|
+
F: __dxlog_file5,
|
|
1848
|
+
L: 347,
|
|
1849
|
+
S: this,
|
|
1850
|
+
C: (f, a) => f(...a)
|
|
1844
1851
|
});
|
|
1845
1852
|
stream.error(err);
|
|
1846
1853
|
}
|
|
@@ -1849,7 +1856,7 @@ var InvitationsHandler = class {
|
|
|
1849
1856
|
return extension;
|
|
1850
1857
|
};
|
|
1851
1858
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1852
|
-
(0,
|
|
1859
|
+
(0, import_tiny_invariant6.default)(invitation.swarmKey);
|
|
1853
1860
|
const topic = invitation.swarmKey;
|
|
1854
1861
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
1855
1862
|
topic,
|
|
@@ -1882,11 +1889,12 @@ var InvitationsHandler = class {
|
|
|
1882
1889
|
};
|
|
1883
1890
|
|
|
1884
1891
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
1885
|
-
var
|
|
1892
|
+
var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
|
|
1886
1893
|
var import_async9 = require("@dxos/async");
|
|
1887
1894
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
1888
1895
|
var import_log6 = require("@dxos/log");
|
|
1889
1896
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1897
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
1890
1898
|
var InvitationsServiceImpl = class {
|
|
1891
1899
|
constructor(_invitationsHandler, _getHandler) {
|
|
1892
1900
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -1947,35 +1955,35 @@ var InvitationsServiceImpl = class {
|
|
|
1947
1955
|
});
|
|
1948
1956
|
}
|
|
1949
1957
|
async authenticate({ invitationId, authCode }) {
|
|
1950
|
-
(0, import_log6.log)("authenticating...",
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1958
|
+
(0, import_log6.log)("authenticating...", void 0, {
|
|
1959
|
+
F: __dxlog_file6,
|
|
1960
|
+
L: 103,
|
|
1961
|
+
S: this,
|
|
1962
|
+
C: (f, a) => f(...a)
|
|
1955
1963
|
});
|
|
1956
|
-
(0,
|
|
1964
|
+
(0, import_tiny_invariant7.default)(invitationId);
|
|
1957
1965
|
const observable = this._acceptInvitations.get(invitationId);
|
|
1958
1966
|
if (!observable) {
|
|
1959
1967
|
import_log6.log.warn("invalid invitation", {
|
|
1960
1968
|
invitationId
|
|
1961
1969
|
}, {
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1970
|
+
F: __dxlog_file6,
|
|
1971
|
+
L: 107,
|
|
1972
|
+
S: this,
|
|
1973
|
+
C: (f, a) => f(...a)
|
|
1966
1974
|
});
|
|
1967
1975
|
} else {
|
|
1968
1976
|
await observable.authenticate(authCode);
|
|
1969
1977
|
}
|
|
1970
1978
|
}
|
|
1971
1979
|
async cancelInvitation({ invitationId }) {
|
|
1972
|
-
(0, import_log6.log)("deleting...",
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1980
|
+
(0, import_log6.log)("deleting...", void 0, {
|
|
1981
|
+
F: __dxlog_file6,
|
|
1982
|
+
L: 114,
|
|
1983
|
+
S: this,
|
|
1984
|
+
C: (f, a) => f(...a)
|
|
1977
1985
|
});
|
|
1978
|
-
(0,
|
|
1986
|
+
(0, import_tiny_invariant7.default)(invitationId);
|
|
1979
1987
|
const created = this._createInvitations.get(invitationId);
|
|
1980
1988
|
const accepted = this._acceptInvitations.get(invitationId);
|
|
1981
1989
|
if (created) {
|
|
@@ -1990,10 +1998,10 @@ var InvitationsServiceImpl = class {
|
|
|
1990
1998
|
import_log6.log.warn("invalid invitation", {
|
|
1991
1999
|
invitationId
|
|
1992
2000
|
}, {
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2001
|
+
F: __dxlog_file6,
|
|
2002
|
+
L: 127,
|
|
2003
|
+
S: this,
|
|
2004
|
+
C: (f, a) => f(...a)
|
|
1997
2005
|
});
|
|
1998
2006
|
}
|
|
1999
2007
|
}
|
|
@@ -2050,11 +2058,12 @@ var InvitationsServiceImpl = class {
|
|
|
2050
2058
|
};
|
|
2051
2059
|
|
|
2052
2060
|
// packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
|
|
2053
|
-
var
|
|
2061
|
+
var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
|
|
2054
2062
|
var import_credentials8 = require("@dxos/credentials");
|
|
2055
2063
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
2056
2064
|
var import_log7 = require("@dxos/log");
|
|
2057
2065
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2066
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2058
2067
|
var SpaceInvitationProtocol = class {
|
|
2059
2068
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
2060
2069
|
this._spaceManager = _spaceManager;
|
|
@@ -2076,24 +2085,24 @@ var SpaceInvitationProtocol = class {
|
|
|
2076
2085
|
}
|
|
2077
2086
|
async admit(request, guestProfile) {
|
|
2078
2087
|
var _a;
|
|
2079
|
-
(0,
|
|
2088
|
+
(0, import_tiny_invariant8.default)(this._spaceKey);
|
|
2080
2089
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2081
|
-
(0,
|
|
2082
|
-
(0,
|
|
2090
|
+
(0, import_tiny_invariant8.default)(space);
|
|
2091
|
+
(0, import_tiny_invariant8.default)(request.space);
|
|
2083
2092
|
const { identityKey, deviceKey } = request.space;
|
|
2084
2093
|
(0, import_log7.log)("writing guest credentials", {
|
|
2085
2094
|
host: this._signingContext.deviceKey,
|
|
2086
2095
|
guest: deviceKey
|
|
2087
2096
|
}, {
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2097
|
+
F: __dxlog_file7,
|
|
2098
|
+
L: 50,
|
|
2099
|
+
S: this,
|
|
2100
|
+
C: (f, a) => f(...a)
|
|
2092
2101
|
});
|
|
2093
2102
|
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2094
|
-
(0,
|
|
2103
|
+
(0, import_tiny_invariant8.default)(credentials[0].credential);
|
|
2095
2104
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2096
|
-
(0,
|
|
2105
|
+
(0, import_tiny_invariant8.default)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
|
|
2097
2106
|
await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
|
|
2098
2107
|
return {
|
|
2099
2108
|
space: {
|
|
@@ -2121,11 +2130,11 @@ var SpaceInvitationProtocol = class {
|
|
|
2121
2130
|
};
|
|
2122
2131
|
}
|
|
2123
2132
|
async accept(response) {
|
|
2124
|
-
(0,
|
|
2133
|
+
(0, import_tiny_invariant8.default)(response.space);
|
|
2125
2134
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
2126
2135
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2127
|
-
(0,
|
|
2128
|
-
(0,
|
|
2136
|
+
(0, import_tiny_invariant8.default)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
|
|
2137
|
+
(0, import_tiny_invariant8.default)(credential.subject.id.equals(this._signingContext.identityKey));
|
|
2129
2138
|
await this._spaceManager.acceptSpace({
|
|
2130
2139
|
spaceKey: assertion.spaceKey,
|
|
2131
2140
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -2140,7 +2149,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2140
2149
|
};
|
|
2141
2150
|
|
|
2142
2151
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
2143
|
-
var
|
|
2152
|
+
var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
|
|
2144
2153
|
var import_async14 = require("@dxos/async");
|
|
2145
2154
|
var import_credentials13 = require("@dxos/credentials");
|
|
2146
2155
|
var import_debug6 = require("@dxos/debug");
|
|
@@ -2154,7 +2163,7 @@ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
2154
2163
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
2155
2164
|
|
|
2156
2165
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2157
|
-
var
|
|
2166
|
+
var import_tiny_invariant10 = __toESM(require("tiny-invariant"));
|
|
2158
2167
|
var import_async12 = require("@dxos/async");
|
|
2159
2168
|
var import_context7 = require("@dxos/context");
|
|
2160
2169
|
var import_credentials12 = require("@dxos/credentials");
|
|
@@ -2180,7 +2189,7 @@ var import_timeframe = require("@dxos/timeframe");
|
|
|
2180
2189
|
var import_util4 = require("@dxos/util");
|
|
2181
2190
|
|
|
2182
2191
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2183
|
-
var
|
|
2192
|
+
var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
|
|
2184
2193
|
var import_async10 = require("@dxos/async");
|
|
2185
2194
|
var import_context5 = require("@dxos/context");
|
|
2186
2195
|
var import_keys7 = require("@dxos/keys");
|
|
@@ -2188,6 +2197,7 @@ var import_log8 = require("@dxos/log");
|
|
|
2188
2197
|
var import_protocols5 = require("@dxos/protocols");
|
|
2189
2198
|
var import_teleport2 = require("@dxos/teleport");
|
|
2190
2199
|
var import_util3 = require("@dxos/util");
|
|
2200
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
2191
2201
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
2192
2202
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
2193
2203
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -2212,22 +2222,22 @@ var NotarizationPlugin = class {
|
|
|
2212
2222
|
(0, import_log8.log)("notarize", {
|
|
2213
2223
|
credentials
|
|
2214
2224
|
}, {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2225
|
+
F: __dxlog_file8,
|
|
2226
|
+
L: 87,
|
|
2227
|
+
S: this,
|
|
2228
|
+
C: (f, a) => f(...a)
|
|
2219
2229
|
});
|
|
2220
|
-
(0,
|
|
2230
|
+
(0, import_tiny_invariant9.default)(credentials.every((credential) => credential.id), "Credentials must have an id");
|
|
2221
2231
|
const errors = new import_async10.Trigger();
|
|
2222
2232
|
const ctx = this._ctx.derive({
|
|
2223
2233
|
onError: (err) => {
|
|
2224
2234
|
import_log8.log.warn("Notarization error", {
|
|
2225
2235
|
err
|
|
2226
2236
|
}, {
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2237
|
+
F: __dxlog_file8,
|
|
2238
|
+
L: 96,
|
|
2239
|
+
S: this,
|
|
2240
|
+
C: (f, a) => f(...a)
|
|
2231
2241
|
});
|
|
2232
2242
|
void ctx.dispose();
|
|
2233
2243
|
errors.throw(err);
|
|
@@ -2240,10 +2250,10 @@ var NotarizationPlugin = class {
|
|
|
2240
2250
|
timeout,
|
|
2241
2251
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
2242
2252
|
}, {
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2253
|
+
F: __dxlog_file8,
|
|
2254
|
+
L: 108,
|
|
2255
|
+
S: this,
|
|
2256
|
+
C: (f, a) => f(...a)
|
|
2247
2257
|
});
|
|
2248
2258
|
void ctx.dispose();
|
|
2249
2259
|
errors.throw(new import_async10.TimeoutError(timeout, "Notarization timed out"));
|
|
@@ -2263,10 +2273,10 @@ var NotarizationPlugin = class {
|
|
|
2263
2273
|
import_log8.log.warn("Exhausted all peers to notarize with", {
|
|
2264
2274
|
retryIn: retryTimeout
|
|
2265
2275
|
}, {
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2276
|
+
F: __dxlog_file8,
|
|
2277
|
+
L: 133,
|
|
2278
|
+
S: this,
|
|
2279
|
+
C: (f, a) => f(...a)
|
|
2270
2280
|
});
|
|
2271
2281
|
peersTried.clear();
|
|
2272
2282
|
(0, import_async10.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
@@ -2277,28 +2287,28 @@ var NotarizationPlugin = class {
|
|
|
2277
2287
|
peer: peer.localPeerId,
|
|
2278
2288
|
credentialId: credentials.map((credential) => credential.id)
|
|
2279
2289
|
}, {
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2290
|
+
F: __dxlog_file8,
|
|
2291
|
+
L: 140,
|
|
2292
|
+
S: this,
|
|
2293
|
+
C: (f, a) => f(...a)
|
|
2284
2294
|
});
|
|
2285
2295
|
await peer.rpc.NotarizationService.notarize({
|
|
2286
2296
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
2287
2297
|
});
|
|
2288
|
-
(0, import_log8.log)("success",
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2298
|
+
(0, import_log8.log)("success", void 0, {
|
|
2299
|
+
F: __dxlog_file8,
|
|
2300
|
+
L: 144,
|
|
2301
|
+
S: this,
|
|
2302
|
+
C: (f, a) => f(...a)
|
|
2293
2303
|
});
|
|
2294
2304
|
await (0, import_async10.sleep)(successDelay);
|
|
2295
2305
|
} catch (err) {
|
|
2296
2306
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2297
2307
|
import_log8.log.warn("error notarizing (recoverable)", err, {
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2308
|
+
F: __dxlog_file8,
|
|
2309
|
+
L: 148,
|
|
2310
|
+
S: this,
|
|
2311
|
+
C: (f, a) => f(...a)
|
|
2302
2312
|
});
|
|
2303
2313
|
}
|
|
2304
2314
|
notarizeTask.schedule();
|
|
@@ -2312,11 +2322,11 @@ var NotarizationPlugin = class {
|
|
|
2312
2322
|
allNotarized,
|
|
2313
2323
|
errors.wait()
|
|
2314
2324
|
]);
|
|
2315
|
-
(0, import_log8.log)("done",
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2325
|
+
(0, import_log8.log)("done", void 0, {
|
|
2326
|
+
F: __dxlog_file8,
|
|
2327
|
+
L: 159,
|
|
2328
|
+
S: this,
|
|
2329
|
+
C: (f, a) => f(...a)
|
|
2320
2330
|
});
|
|
2321
2331
|
} finally {
|
|
2322
2332
|
await ctx.dispose();
|
|
@@ -2335,7 +2345,7 @@ var NotarizationPlugin = class {
|
|
|
2335
2345
|
this._processCredentialsTriggers.delete(credential.id);
|
|
2336
2346
|
}
|
|
2337
2347
|
setWriter(writer) {
|
|
2338
|
-
(0,
|
|
2348
|
+
(0, import_tiny_invariant9.default)(!this._writer, "Writer already set.");
|
|
2339
2349
|
this._writer = writer;
|
|
2340
2350
|
}
|
|
2341
2351
|
async _waitUntilProcessed(id) {
|
|
@@ -2353,7 +2363,7 @@ var NotarizationPlugin = class {
|
|
|
2353
2363
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
2354
2364
|
}
|
|
2355
2365
|
for (const credential of (_a = request.credentials) != null ? _a : []) {
|
|
2356
|
-
(0,
|
|
2366
|
+
(0, import_tiny_invariant9.default)(credential.id, "Credential must have an id");
|
|
2357
2367
|
if (this._processedCredentials.has(credential.id)) {
|
|
2358
2368
|
continue;
|
|
2359
2369
|
}
|
|
@@ -2366,10 +2376,10 @@ var NotarizationPlugin = class {
|
|
|
2366
2376
|
(0, import_log8.log)("extension opened", {
|
|
2367
2377
|
peer: extension.localPeerId
|
|
2368
2378
|
}, {
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2379
|
+
F: __dxlog_file8,
|
|
2380
|
+
L: 208,
|
|
2381
|
+
S: this,
|
|
2382
|
+
C: (f, a) => f(...a)
|
|
2373
2383
|
});
|
|
2374
2384
|
this._extensions.add(extension);
|
|
2375
2385
|
this._extensionOpened.emit();
|
|
@@ -2378,10 +2388,10 @@ var NotarizationPlugin = class {
|
|
|
2378
2388
|
(0, import_log8.log)("extension closed", {
|
|
2379
2389
|
peer: extension.localPeerId
|
|
2380
2390
|
}, {
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2391
|
+
F: __dxlog_file8,
|
|
2392
|
+
L: 213,
|
|
2393
|
+
S: this,
|
|
2394
|
+
C: (f, a) => f(...a)
|
|
2385
2395
|
});
|
|
2386
2396
|
this._extensions.delete(extension);
|
|
2387
2397
|
},
|
|
@@ -2422,7 +2432,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
2422
2432
|
};
|
|
2423
2433
|
|
|
2424
2434
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2425
|
-
|
|
2435
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
2426
2436
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2427
2437
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2428
2438
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2431,7 +2441,8 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
2431
2441
|
if (d = decorators[i])
|
|
2432
2442
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2433
2443
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2434
|
-
}
|
|
2444
|
+
}
|
|
2445
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
2435
2446
|
var DataSpace = class DataSpace2 {
|
|
2436
2447
|
constructor(params) {
|
|
2437
2448
|
this._ctx = new import_context6.Context();
|
|
@@ -2518,18 +2529,18 @@ var DataSpace = class DataSpace2 {
|
|
|
2518
2529
|
} catch (err) {
|
|
2519
2530
|
if (err instanceof import_errors3.CancelledError) {
|
|
2520
2531
|
(0, import_log9.log)("Data pipeline initialization cancelled", err, {
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2532
|
+
F: __dxlog_file9,
|
|
2533
|
+
L: 173,
|
|
2534
|
+
S: this,
|
|
2535
|
+
C: (f, a) => f(...a)
|
|
2525
2536
|
});
|
|
2526
2537
|
return;
|
|
2527
2538
|
}
|
|
2528
2539
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2540
|
+
F: __dxlog_file9,
|
|
2541
|
+
L: 177,
|
|
2542
|
+
S: this,
|
|
2543
|
+
C: (f, a) => f(...a)
|
|
2533
2544
|
});
|
|
2534
2545
|
this._state = import_services6.SpaceState.ERROR;
|
|
2535
2546
|
this.error = err;
|
|
@@ -2551,11 +2562,11 @@ var DataSpace = class DataSpace2 {
|
|
|
2551
2562
|
});
|
|
2552
2563
|
this.metrics.controlPipelineReady = new Date();
|
|
2553
2564
|
await this._createWritableFeeds();
|
|
2554
|
-
(0, import_log9.log)("Writable feeds created",
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2565
|
+
(0, import_log9.log)("Writable feeds created", void 0, {
|
|
2566
|
+
F: __dxlog_file9,
|
|
2567
|
+
L: 201,
|
|
2568
|
+
S: this,
|
|
2569
|
+
C: (f, a) => f(...a)
|
|
2559
2570
|
});
|
|
2560
2571
|
this.stateUpdate.emit();
|
|
2561
2572
|
this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
|
|
@@ -2566,22 +2577,22 @@ var DataSpace = class DataSpace2 {
|
|
|
2566
2577
|
await this._inner.initializeDataPipeline();
|
|
2567
2578
|
this.metrics.dataPipelineOpen = new Date();
|
|
2568
2579
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
2569
|
-
(0, import_log9.log)("waiting for data pipeline to reach target timeframe",
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2580
|
+
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
2581
|
+
F: __dxlog_file9,
|
|
2582
|
+
L: 220,
|
|
2583
|
+
S: this,
|
|
2584
|
+
C: (f, a) => f(...a)
|
|
2574
2585
|
});
|
|
2575
2586
|
await this._inner.dataPipeline.pipelineState.waitUntilReachedTargetTimeframe({
|
|
2576
2587
|
ctx: this._ctx,
|
|
2577
2588
|
breakOnStall: false
|
|
2578
2589
|
});
|
|
2579
2590
|
this.metrics.dataPipelineReady = new Date();
|
|
2580
|
-
(0, import_log9.log)("data pipeline ready",
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2591
|
+
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
2592
|
+
F: __dxlog_file9,
|
|
2593
|
+
L: 229,
|
|
2594
|
+
S: this,
|
|
2595
|
+
C: (f, a) => f(...a)
|
|
2585
2596
|
});
|
|
2586
2597
|
await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
|
|
2587
2598
|
this._state = import_services6.SpaceState.READY;
|
|
@@ -2660,10 +2671,10 @@ var DataSpace = class DataSpace2 {
|
|
|
2660
2671
|
}
|
|
2661
2672
|
}
|
|
2662
2673
|
};
|
|
2663
|
-
|
|
2674
|
+
_ts_decorate([
|
|
2664
2675
|
(0, import_debug3.timed)(1e4)
|
|
2665
2676
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
2666
|
-
DataSpace =
|
|
2677
|
+
DataSpace = _ts_decorate([
|
|
2667
2678
|
(0, import_async11.trackLeaks)("open", "close")
|
|
2668
2679
|
], DataSpace);
|
|
2669
2680
|
|
|
@@ -2738,7 +2749,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
2738
2749
|
};
|
|
2739
2750
|
|
|
2740
2751
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2741
|
-
|
|
2752
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
2742
2753
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2743
2754
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2744
2755
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2747,7 +2758,8 @@ var __decorate2 = function(decorators, target, key, desc) {
|
|
|
2747
2758
|
if (d = decorators[i])
|
|
2748
2759
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2749
2760
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2750
|
-
}
|
|
2761
|
+
}
|
|
2762
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
2751
2763
|
var DataSpaceManager = class DataSpaceManager2 {
|
|
2752
2764
|
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
|
|
2753
2765
|
this._spaceManager = _spaceManager;
|
|
@@ -2767,38 +2779,38 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2767
2779
|
return this._spaces;
|
|
2768
2780
|
}
|
|
2769
2781
|
async open() {
|
|
2770
|
-
(0, import_log10.log)("open",
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2782
|
+
(0, import_log10.log)("open", void 0, {
|
|
2783
|
+
F: __dxlog_file10,
|
|
2784
|
+
L: 80,
|
|
2785
|
+
S: this,
|
|
2786
|
+
C: (f, a) => f(...a)
|
|
2775
2787
|
});
|
|
2776
2788
|
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.begin({
|
|
2777
2789
|
id: this._instanceId
|
|
2778
2790
|
}), {
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2791
|
+
F: __dxlog_file10,
|
|
2792
|
+
L: 81,
|
|
2793
|
+
S: this,
|
|
2794
|
+
C: (f, a) => f(...a)
|
|
2783
2795
|
});
|
|
2784
2796
|
await this._metadataStore.load();
|
|
2785
2797
|
(0, import_log10.log)("metadata loaded", {
|
|
2786
2798
|
spaces: this._metadataStore.spaces.length
|
|
2787
2799
|
}, {
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2800
|
+
F: __dxlog_file10,
|
|
2801
|
+
L: 83,
|
|
2802
|
+
S: this,
|
|
2803
|
+
C: (f, a) => f(...a)
|
|
2792
2804
|
});
|
|
2793
2805
|
for (const spaceMetadata of this._metadataStore.spaces) {
|
|
2794
2806
|
try {
|
|
2795
2807
|
(0, import_log10.log)("load space", {
|
|
2796
2808
|
spaceMetadata
|
|
2797
2809
|
}, {
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2810
|
+
F: __dxlog_file10,
|
|
2811
|
+
L: 87,
|
|
2812
|
+
S: this,
|
|
2813
|
+
C: (f, a) => f(...a)
|
|
2802
2814
|
});
|
|
2803
2815
|
const space = await this._constructSpace(spaceMetadata);
|
|
2804
2816
|
space.initializeDataPipelineAsync();
|
|
@@ -2807,10 +2819,10 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2807
2819
|
spaceMetadata,
|
|
2808
2820
|
err
|
|
2809
2821
|
}, {
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2822
|
+
F: __dxlog_file10,
|
|
2823
|
+
L: 91,
|
|
2824
|
+
S: this,
|
|
2825
|
+
C: (f, a) => f(...a)
|
|
2814
2826
|
});
|
|
2815
2827
|
}
|
|
2816
2828
|
}
|
|
@@ -2819,18 +2831,18 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2819
2831
|
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.end({
|
|
2820
2832
|
id: this._instanceId
|
|
2821
2833
|
}), {
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2834
|
+
F: __dxlog_file10,
|
|
2835
|
+
L: 97,
|
|
2836
|
+
S: this,
|
|
2837
|
+
C: (f, a) => f(...a)
|
|
2826
2838
|
});
|
|
2827
2839
|
}
|
|
2828
2840
|
async close() {
|
|
2829
|
-
(0, import_log10.log)("close",
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2841
|
+
(0, import_log10.log)("close", void 0, {
|
|
2842
|
+
F: __dxlog_file10,
|
|
2843
|
+
L: 102,
|
|
2844
|
+
S: this,
|
|
2845
|
+
C: (f, a) => f(...a)
|
|
2834
2846
|
});
|
|
2835
2847
|
this._isOpen = false;
|
|
2836
2848
|
await this._ctx.dispose();
|
|
@@ -2842,7 +2854,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2842
2854
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
2843
2855
|
*/
|
|
2844
2856
|
async createSpace() {
|
|
2845
|
-
(0,
|
|
2857
|
+
(0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
|
|
2846
2858
|
const spaceKey = await this._keyring.createKey();
|
|
2847
2859
|
const controlFeedKey = await this._keyring.createKey();
|
|
2848
2860
|
const dataFeedKey = await this._keyring.createKey();
|
|
@@ -2855,16 +2867,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2855
2867
|
(0, import_log10.log)("creating space...", {
|
|
2856
2868
|
spaceKey
|
|
2857
2869
|
}, {
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2870
|
+
F: __dxlog_file10,
|
|
2871
|
+
L: 126,
|
|
2872
|
+
S: this,
|
|
2873
|
+
C: (f, a) => f(...a)
|
|
2862
2874
|
});
|
|
2863
2875
|
const space = await this._constructSpace(metadata);
|
|
2864
2876
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
|
|
2865
2877
|
await this._metadataStore.addSpace(metadata);
|
|
2866
2878
|
const memberCredential = credentials[1];
|
|
2867
|
-
(0,
|
|
2879
|
+
(0, import_tiny_invariant10.default)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
|
|
2868
2880
|
await this._signingContext.recordCredential(memberCredential);
|
|
2869
2881
|
await space.initializeDataPipeline();
|
|
2870
2882
|
this.updated.emit();
|
|
@@ -2875,13 +2887,13 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2875
2887
|
(0, import_log10.log)("accept space", {
|
|
2876
2888
|
opts
|
|
2877
2889
|
}, {
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2890
|
+
F: __dxlog_file10,
|
|
2891
|
+
L: 145,
|
|
2892
|
+
S: this,
|
|
2893
|
+
C: (f, a) => f(...a)
|
|
2882
2894
|
});
|
|
2883
|
-
(0,
|
|
2884
|
-
(0,
|
|
2895
|
+
(0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
|
|
2896
|
+
(0, import_tiny_invariant10.default)(!this._spaces.has(opts.spaceKey), "Space already exists.");
|
|
2885
2897
|
const metadata = {
|
|
2886
2898
|
key: opts.spaceKey,
|
|
2887
2899
|
genesisFeedKey: opts.genesisFeedKey,
|
|
@@ -2909,10 +2921,10 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2909
2921
|
(0, import_log10.log)("construct space", {
|
|
2910
2922
|
metadata
|
|
2911
2923
|
}, {
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2924
|
+
F: __dxlog_file10,
|
|
2925
|
+
L: 180,
|
|
2926
|
+
S: this,
|
|
2927
|
+
C: (f, a) => f(...a)
|
|
2916
2928
|
});
|
|
2917
2929
|
const gossip = new import_teleport_extension_gossip.Gossip({
|
|
2918
2930
|
localPeerId: this._signingContext.deviceKey
|
|
@@ -2944,11 +2956,11 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2944
2956
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
2945
2957
|
},
|
|
2946
2958
|
onAuthFailure: () => {
|
|
2947
|
-
import_log10.log.warn("auth failure",
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2959
|
+
import_log10.log.warn("auth failure", void 0, {
|
|
2960
|
+
F: __dxlog_file10,
|
|
2961
|
+
L: 211,
|
|
2962
|
+
S: this,
|
|
2963
|
+
C: (f, a) => f(...a)
|
|
2952
2964
|
});
|
|
2953
2965
|
},
|
|
2954
2966
|
memberKey: this._signingContext.identityKey
|
|
@@ -2968,10 +2980,10 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2968
2980
|
(0, import_log10.log)("before space ready", {
|
|
2969
2981
|
space: space.key
|
|
2970
2982
|
}, {
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2983
|
+
F: __dxlog_file10,
|
|
2984
|
+
L: 228,
|
|
2985
|
+
S: this,
|
|
2986
|
+
C: (f, a) => f(...a)
|
|
2975
2987
|
});
|
|
2976
2988
|
this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
|
|
2977
2989
|
},
|
|
@@ -2980,10 +2992,10 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2980
2992
|
space: space.key,
|
|
2981
2993
|
open: this._isOpen
|
|
2982
2994
|
}, {
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2995
|
+
F: __dxlog_file10,
|
|
2996
|
+
L: 235,
|
|
2997
|
+
S: this,
|
|
2998
|
+
C: (f, a) => f(...a)
|
|
2987
2999
|
});
|
|
2988
3000
|
if (this._isOpen) {
|
|
2989
3001
|
this.updated.emit();
|
|
@@ -3003,19 +3015,19 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3003
3015
|
return dataSpace;
|
|
3004
3016
|
}
|
|
3005
3017
|
};
|
|
3006
|
-
|
|
3018
|
+
_ts_decorate2([
|
|
3007
3019
|
import_async12.synchronized
|
|
3008
3020
|
], DataSpaceManager.prototype, "open", null);
|
|
3009
|
-
|
|
3021
|
+
_ts_decorate2([
|
|
3010
3022
|
import_async12.synchronized
|
|
3011
3023
|
], DataSpaceManager.prototype, "close", null);
|
|
3012
|
-
|
|
3024
|
+
_ts_decorate2([
|
|
3013
3025
|
import_async12.synchronized
|
|
3014
3026
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
3015
|
-
|
|
3027
|
+
_ts_decorate2([
|
|
3016
3028
|
import_async12.synchronized
|
|
3017
3029
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
3018
|
-
DataSpaceManager =
|
|
3030
|
+
DataSpaceManager = _ts_decorate2([
|
|
3019
3031
|
(0, import_async12.trackLeaks)("open", "close")
|
|
3020
3032
|
], DataSpaceManager);
|
|
3021
3033
|
|
|
@@ -3028,7 +3040,7 @@ var import_log11 = require("@dxos/log");
|
|
|
3028
3040
|
var import_protocols7 = require("@dxos/protocols");
|
|
3029
3041
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3030
3042
|
var import_util6 = require("@dxos/util");
|
|
3031
|
-
var
|
|
3043
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
3032
3044
|
var SpacesServiceImpl = class {
|
|
3033
3045
|
constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
|
|
3034
3046
|
this._identityManager = _identityManager;
|
|
@@ -3042,28 +3054,30 @@ var SpacesServiceImpl = class {
|
|
|
3042
3054
|
}
|
|
3043
3055
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3044
3056
|
const space = await dataSpaceManager.createSpace();
|
|
3045
|
-
return this.
|
|
3057
|
+
return this._serializeSpace(space);
|
|
3046
3058
|
}
|
|
3047
3059
|
async updateSpace(request) {
|
|
3048
3060
|
(0, import_debug5.todo)();
|
|
3049
3061
|
}
|
|
3050
3062
|
querySpaces() {
|
|
3051
3063
|
return new import_codec_protobuf9.Stream(({ next, ctx }) => {
|
|
3052
|
-
const
|
|
3064
|
+
const scheduler = new import_async13.UpdateScheduler(ctx, async () => {
|
|
3053
3065
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3054
|
-
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this.
|
|
3066
|
+
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
3055
3067
|
(0, import_log11.log)("update", {
|
|
3056
3068
|
spaces
|
|
3057
3069
|
}, {
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3070
|
+
F: __dxlog_file11,
|
|
3071
|
+
L: 60,
|
|
3072
|
+
S: this,
|
|
3073
|
+
C: (f, a) => f(...a)
|
|
3062
3074
|
});
|
|
3063
3075
|
next({
|
|
3064
3076
|
spaces
|
|
3065
3077
|
});
|
|
3066
|
-
}
|
|
3078
|
+
}, {
|
|
3079
|
+
maxFrequency: 2
|
|
3080
|
+
});
|
|
3067
3081
|
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3068
3082
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3069
3083
|
const subscriptions = new import_async13.EventSubscriptions();
|
|
@@ -3071,21 +3085,21 @@ var SpacesServiceImpl = class {
|
|
|
3071
3085
|
const subscribeSpaces = () => {
|
|
3072
3086
|
subscriptions.clear();
|
|
3073
3087
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
3074
|
-
subscriptions.add(space.stateUpdate.on(ctx,
|
|
3075
|
-
subscriptions.add(space.presence.updated.on(ctx,
|
|
3076
|
-
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx,
|
|
3077
|
-
space.inner.controlPipeline.state.timeframeUpdate.
|
|
3088
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.trigger()));
|
|
3089
|
+
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
3090
|
+
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
3091
|
+
space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
|
|
3078
3092
|
if (space.dataPipeline.pipelineState) {
|
|
3079
|
-
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.
|
|
3093
|
+
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3080
3094
|
}
|
|
3081
3095
|
}
|
|
3082
3096
|
};
|
|
3083
3097
|
dataSpaceManager.updated.on(ctx, () => {
|
|
3084
3098
|
subscribeSpaces();
|
|
3085
|
-
|
|
3099
|
+
scheduler.trigger();
|
|
3086
3100
|
});
|
|
3087
3101
|
subscribeSpaces();
|
|
3088
|
-
|
|
3102
|
+
scheduler.trigger();
|
|
3089
3103
|
});
|
|
3090
3104
|
if (!this._identityManager.identity) {
|
|
3091
3105
|
next({
|
|
@@ -3143,7 +3157,7 @@ var SpacesServiceImpl = class {
|
|
|
3143
3157
|
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug5.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
|
|
3144
3158
|
await space.createEpoch();
|
|
3145
3159
|
}
|
|
3146
|
-
|
|
3160
|
+
_serializeSpace(space) {
|
|
3147
3161
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
3148
3162
|
return {
|
|
3149
3163
|
spaceKey: space.key,
|
|
@@ -3183,6 +3197,7 @@ var SpacesServiceImpl = class {
|
|
|
3183
3197
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
3184
3198
|
|
|
3185
3199
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
3200
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
3186
3201
|
var ServiceContext = class {
|
|
3187
3202
|
// prettier-ignore
|
|
3188
3203
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -3226,17 +3241,17 @@ var ServiceContext = class {
|
|
|
3226
3241
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.begin({
|
|
3227
3242
|
id: this._instanceId
|
|
3228
3243
|
}), {
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3244
|
+
F: __dxlog_file12,
|
|
3245
|
+
L: 126,
|
|
3246
|
+
S: this,
|
|
3247
|
+
C: (f, a) => f(...a)
|
|
3233
3248
|
});
|
|
3234
3249
|
await this._checkStorageVersion();
|
|
3235
|
-
(0, import_log12.log)("opening...",
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3250
|
+
(0, import_log12.log)("opening...", void 0, {
|
|
3251
|
+
F: __dxlog_file12,
|
|
3252
|
+
L: 130,
|
|
3253
|
+
S: this,
|
|
3254
|
+
C: (f, a) => f(...a)
|
|
3240
3255
|
});
|
|
3241
3256
|
await this.signalManager.open();
|
|
3242
3257
|
await this.networkManager.open();
|
|
@@ -3245,28 +3260,28 @@ var ServiceContext = class {
|
|
|
3245
3260
|
if (this.identityManager.identity) {
|
|
3246
3261
|
await this._initialize();
|
|
3247
3262
|
}
|
|
3248
|
-
(0, import_log12.log)("opened",
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3263
|
+
(0, import_log12.log)("opened", void 0, {
|
|
3264
|
+
F: __dxlog_file12,
|
|
3265
|
+
L: 138,
|
|
3266
|
+
S: this,
|
|
3267
|
+
C: (f, a) => f(...a)
|
|
3253
3268
|
});
|
|
3254
3269
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.end({
|
|
3255
3270
|
id: this._instanceId
|
|
3256
3271
|
}), {
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3272
|
+
F: __dxlog_file12,
|
|
3273
|
+
L: 139,
|
|
3274
|
+
S: this,
|
|
3275
|
+
C: (f, a) => f(...a)
|
|
3261
3276
|
});
|
|
3262
3277
|
}
|
|
3263
3278
|
async close() {
|
|
3264
3279
|
var _a, _b;
|
|
3265
|
-
(0, import_log12.log)("closing...",
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3280
|
+
(0, import_log12.log)("closing...", void 0, {
|
|
3281
|
+
F: __dxlog_file12,
|
|
3282
|
+
L: 143,
|
|
3283
|
+
S: this,
|
|
3284
|
+
C: (f, a) => f(...a)
|
|
3270
3285
|
});
|
|
3271
3286
|
await ((_a = this._deviceSpaceSync) == null ? void 0 : _a.close());
|
|
3272
3287
|
await ((_b = this.dataSpaceManager) == null ? void 0 : _b.close());
|
|
@@ -3276,11 +3291,11 @@ var ServiceContext = class {
|
|
|
3276
3291
|
await this.networkManager.close();
|
|
3277
3292
|
await this.signalManager.close();
|
|
3278
3293
|
this.dataServiceSubscriptions.clear();
|
|
3279
|
-
(0, import_log12.log)("closed",
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3294
|
+
(0, import_log12.log)("closed", void 0, {
|
|
3295
|
+
F: __dxlog_file12,
|
|
3296
|
+
L: 152,
|
|
3297
|
+
S: this,
|
|
3298
|
+
C: (f, a) => f(...a)
|
|
3284
3299
|
});
|
|
3285
3300
|
}
|
|
3286
3301
|
async createIdentity(params = {}) {
|
|
@@ -3290,7 +3305,7 @@ var ServiceContext = class {
|
|
|
3290
3305
|
}
|
|
3291
3306
|
getInvitationHandler(invitation) {
|
|
3292
3307
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3293
|
-
(0,
|
|
3308
|
+
(0, import_tiny_invariant11.default)(factory, `Unknown invitation kind: ${invitation.kind}`);
|
|
3294
3309
|
return factory(invitation);
|
|
3295
3310
|
}
|
|
3296
3311
|
async _acceptIdentity(params) {
|
|
@@ -3307,11 +3322,11 @@ var ServiceContext = class {
|
|
|
3307
3322
|
// Called when identity is created.
|
|
3308
3323
|
async _initialize() {
|
|
3309
3324
|
var _a;
|
|
3310
|
-
(0, import_log12.log)("initializing spaces...",
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3325
|
+
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
3326
|
+
F: __dxlog_file12,
|
|
3327
|
+
L: 185,
|
|
3328
|
+
S: this,
|
|
3329
|
+
C: (f, a) => f(...a)
|
|
3315
3330
|
});
|
|
3316
3331
|
const identity = (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
|
|
3317
3332
|
const signingContext = {
|
|
@@ -3330,7 +3345,7 @@ var ServiceContext = class {
|
|
|
3330
3345
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
3331
3346
|
await this.dataSpaceManager.open();
|
|
3332
3347
|
this._handlerFactories.set(import_services9.Invitation.Kind.SPACE, (invitation) => {
|
|
3333
|
-
(0,
|
|
3348
|
+
(0, import_tiny_invariant11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
|
|
3334
3349
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3335
3350
|
});
|
|
3336
3351
|
this.initialized.wake();
|
|
@@ -3347,10 +3362,10 @@ var ServiceContext = class {
|
|
|
3347
3362
|
(0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
3348
3363
|
details: assertion
|
|
3349
3364
|
}, {
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3365
|
+
F: __dxlog_file12,
|
|
3366
|
+
L: 224,
|
|
3367
|
+
S: this,
|
|
3368
|
+
C: (f, a) => f(...a)
|
|
3354
3369
|
});
|
|
3355
3370
|
return;
|
|
3356
3371
|
}
|
|
@@ -3358,10 +3373,10 @@ var ServiceContext = class {
|
|
|
3358
3373
|
(0, import_log12.log)("space already exists, ignoring space admission", {
|
|
3359
3374
|
details: assertion
|
|
3360
3375
|
}, {
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3376
|
+
F: __dxlog_file12,
|
|
3377
|
+
L: 228,
|
|
3378
|
+
S: this,
|
|
3379
|
+
C: (f, a) => f(...a)
|
|
3365
3380
|
});
|
|
3366
3381
|
return;
|
|
3367
3382
|
}
|
|
@@ -3369,21 +3384,21 @@ var ServiceContext = class {
|
|
|
3369
3384
|
(0, import_log12.log)("accepting space recorded in halo", {
|
|
3370
3385
|
details: assertion
|
|
3371
3386
|
}, {
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3387
|
+
F: __dxlog_file12,
|
|
3388
|
+
L: 233,
|
|
3389
|
+
S: this,
|
|
3390
|
+
C: (f, a) => f(...a)
|
|
3376
3391
|
});
|
|
3377
3392
|
await this.dataSpaceManager.acceptSpace({
|
|
3378
3393
|
spaceKey: assertion.spaceKey,
|
|
3379
3394
|
genesisFeedKey: assertion.genesisFeedKey
|
|
3380
3395
|
});
|
|
3381
3396
|
} catch (err) {
|
|
3382
|
-
import_log12.log.catch(err,
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3397
|
+
import_log12.log.catch(err, void 0, {
|
|
3398
|
+
F: __dxlog_file12,
|
|
3399
|
+
L: 239,
|
|
3400
|
+
S: this,
|
|
3401
|
+
C: (f, a) => f(...a)
|
|
3387
3402
|
});
|
|
3388
3403
|
}
|
|
3389
3404
|
}
|
|
@@ -3393,16 +3408,19 @@ var ServiceContext = class {
|
|
|
3393
3408
|
};
|
|
3394
3409
|
|
|
3395
3410
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3396
|
-
var
|
|
3411
|
+
var import_tiny_invariant13 = __toESM(require("tiny-invariant"));
|
|
3397
3412
|
var import_async17 = require("@dxos/async");
|
|
3398
3413
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3414
|
+
var import_document_model = require("@dxos/document-model");
|
|
3399
3415
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
3400
3416
|
var import_keys11 = require("@dxos/keys");
|
|
3401
3417
|
var import_log15 = require("@dxos/log");
|
|
3402
3418
|
var import_messaging = require("@dxos/messaging");
|
|
3419
|
+
var import_model_factory = require("@dxos/model-factory");
|
|
3403
3420
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
3404
3421
|
var import_protocols9 = require("@dxos/protocols");
|
|
3405
3422
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3423
|
+
var import_text_model = require("@dxos/text-model");
|
|
3406
3424
|
|
|
3407
3425
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3408
3426
|
var import_async15 = require("@dxos/async");
|
|
@@ -3452,10 +3470,10 @@ var DevicesServiceImpl = class {
|
|
|
3452
3470
|
};
|
|
3453
3471
|
|
|
3454
3472
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
3455
|
-
var
|
|
3473
|
+
var import_tiny_invariant12 = __toESM(require("tiny-invariant"));
|
|
3456
3474
|
var import_lock_file = require("@dxos/lock-file");
|
|
3457
3475
|
var import_log13 = require("@dxos/log");
|
|
3458
|
-
|
|
3476
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
3459
3477
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3460
3478
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3461
3479
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3464,7 +3482,8 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
3464
3482
|
if (d = decorators[i])
|
|
3465
3483
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3466
3484
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3467
|
-
}
|
|
3485
|
+
}
|
|
3486
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
3468
3487
|
var Lock = class {
|
|
3469
3488
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
3470
3489
|
this._lockPath = lockPath;
|
|
@@ -3476,29 +3495,29 @@ var Lock = class {
|
|
|
3476
3495
|
}
|
|
3477
3496
|
async acquire() {
|
|
3478
3497
|
var _a;
|
|
3479
|
-
(0, import_log13.log)("acquiring lock...",
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3498
|
+
(0, import_log13.log)("acquiring lock...", void 0, {
|
|
3499
|
+
F: __dxlog_file13,
|
|
3500
|
+
L: 32,
|
|
3501
|
+
S: this,
|
|
3502
|
+
C: (f, a) => f(...a)
|
|
3484
3503
|
});
|
|
3485
3504
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
3486
3505
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3487
|
-
(0, import_log13.log)("acquired lock",
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3506
|
+
(0, import_log13.log)("acquired lock", void 0, {
|
|
3507
|
+
F: __dxlog_file13,
|
|
3508
|
+
L: 37,
|
|
3509
|
+
S: this,
|
|
3510
|
+
C: (f, a) => f(...a)
|
|
3492
3511
|
});
|
|
3493
3512
|
}
|
|
3494
3513
|
async release() {
|
|
3495
3514
|
var _a;
|
|
3496
3515
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3497
|
-
(0,
|
|
3516
|
+
(0, import_tiny_invariant12.default)(this._fileHandle, "Lock is not acquired");
|
|
3498
3517
|
await import_lock_file.LockFile.release(this._fileHandle);
|
|
3499
3518
|
}
|
|
3500
3519
|
};
|
|
3501
|
-
|
|
3520
|
+
_ts_decorate3([
|
|
3502
3521
|
import_log13.logInfo
|
|
3503
3522
|
], Lock.prototype, "lockKey", null);
|
|
3504
3523
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
@@ -3530,7 +3549,7 @@ var LoggingServiceImpl = class {
|
|
|
3530
3549
|
if (LOG_PROCESSING > 0) {
|
|
3531
3550
|
return;
|
|
3532
3551
|
}
|
|
3533
|
-
if (((_a = entry2.meta) == null ? void 0 : _a.
|
|
3552
|
+
if (((_a = entry2.meta) == null ? void 0 : _a.F.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
|
|
3534
3553
|
return;
|
|
3535
3554
|
}
|
|
3536
3555
|
if (!shouldLog(entry2, request)) {
|
|
@@ -3542,8 +3561,8 @@ var LoggingServiceImpl = class {
|
|
|
3542
3561
|
timestamp: new Date(),
|
|
3543
3562
|
meta: {
|
|
3544
3563
|
// TODO(dmaretskyi): Fix proto.
|
|
3545
|
-
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.
|
|
3546
|
-
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.
|
|
3564
|
+
file: (_c = (_b = entry2.meta) == null ? void 0 : _b.F) != null ? _c : "",
|
|
3565
|
+
line: (_e = (_d = entry2.meta) == null ? void 0 : _d.L) != null ? _e : 0
|
|
3547
3566
|
}
|
|
3548
3567
|
};
|
|
3549
3568
|
try {
|
|
@@ -3573,7 +3592,7 @@ var shouldLog = (entry2, request) => {
|
|
|
3573
3592
|
} else {
|
|
3574
3593
|
return request.filters.some((filter) => {
|
|
3575
3594
|
var _a2, _b;
|
|
3576
|
-
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.
|
|
3595
|
+
return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.F) != null ? _b : "", options);
|
|
3577
3596
|
});
|
|
3578
3597
|
}
|
|
3579
3598
|
};
|
|
@@ -3723,10 +3742,24 @@ var ServiceRegistry = class {
|
|
|
3723
3742
|
};
|
|
3724
3743
|
|
|
3725
3744
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3745
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
3746
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3747
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3748
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3749
|
+
else
|
|
3750
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
3751
|
+
if (d = decorators[i])
|
|
3752
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3753
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3754
|
+
}
|
|
3755
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
3756
|
+
var createDefaultModelFactory = () => {
|
|
3757
|
+
return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
|
|
3758
|
+
};
|
|
3726
3759
|
var ClientServicesHost = class {
|
|
3727
3760
|
constructor({
|
|
3728
3761
|
config,
|
|
3729
|
-
modelFactory =
|
|
3762
|
+
modelFactory = createDefaultModelFactory(),
|
|
3730
3763
|
// TODO(burdon): Create ApolloLink abstraction (see Client).
|
|
3731
3764
|
transportFactory,
|
|
3732
3765
|
signalManager,
|
|
@@ -3798,9 +3831,9 @@ var ClientServicesHost = class {
|
|
|
3798
3831
|
*/
|
|
3799
3832
|
initialize({ config, ...options }) {
|
|
3800
3833
|
var _a, _b, _c;
|
|
3801
|
-
(0,
|
|
3834
|
+
(0, import_tiny_invariant13.default)(!this._open, "service host is open");
|
|
3802
3835
|
if (config) {
|
|
3803
|
-
(0,
|
|
3836
|
+
(0, import_tiny_invariant13.default)(!this._config, "config already set");
|
|
3804
3837
|
this._config = config;
|
|
3805
3838
|
if (!this._storage) {
|
|
3806
3839
|
this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
|
|
@@ -3810,7 +3843,7 @@ var ClientServicesHost = class {
|
|
|
3810
3843
|
iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
|
|
3811
3844
|
}), signalManager = new import_messaging.WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
|
|
3812
3845
|
this._signalManager = signalManager;
|
|
3813
|
-
(0,
|
|
3846
|
+
(0, import_tiny_invariant13.default)(!this._networkManager, "network manager already set");
|
|
3814
3847
|
this._networkManager = new import_network_manager2.NetworkManager({
|
|
3815
3848
|
log: connectionLog,
|
|
3816
3849
|
transportFactory,
|
|
@@ -3826,23 +3859,23 @@ var ClientServicesHost = class {
|
|
|
3826
3859
|
import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.begin({
|
|
3827
3860
|
id: traceId
|
|
3828
3861
|
}), {
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
});
|
|
3834
|
-
(0,
|
|
3835
|
-
(0,
|
|
3836
|
-
(0,
|
|
3837
|
-
(0,
|
|
3862
|
+
F: __dxlog_file14,
|
|
3863
|
+
L: 195,
|
|
3864
|
+
S: this,
|
|
3865
|
+
C: (f, a) => f(...a)
|
|
3866
|
+
});
|
|
3867
|
+
(0, import_tiny_invariant13.default)(this._config, "config not set");
|
|
3868
|
+
(0, import_tiny_invariant13.default)(this._storage, "storage not set");
|
|
3869
|
+
(0, import_tiny_invariant13.default)(this._signalManager, "signal manager not set");
|
|
3870
|
+
(0, import_tiny_invariant13.default)(this._networkManager, "network manager not set");
|
|
3838
3871
|
this._opening = true;
|
|
3839
3872
|
(0, import_log15.log)("opening...", {
|
|
3840
3873
|
lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
|
|
3841
3874
|
}, {
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3875
|
+
F: __dxlog_file14,
|
|
3876
|
+
L: 203,
|
|
3877
|
+
S: this,
|
|
3878
|
+
C: (f, a) => f(...a)
|
|
3846
3879
|
});
|
|
3847
3880
|
await ((_b = this._resourceLock) == null ? void 0 : _b.acquire());
|
|
3848
3881
|
await this._loggingService.open();
|
|
@@ -3874,18 +3907,18 @@ var ClientServicesHost = class {
|
|
|
3874
3907
|
(0, import_log15.log)("opened", {
|
|
3875
3908
|
deviceKey
|
|
3876
3909
|
}, {
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3910
|
+
F: __dxlog_file14,
|
|
3911
|
+
L: 258,
|
|
3912
|
+
S: this,
|
|
3913
|
+
C: (f, a) => f(...a)
|
|
3881
3914
|
});
|
|
3882
3915
|
import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.end({
|
|
3883
3916
|
id: traceId
|
|
3884
3917
|
}), {
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3918
|
+
F: __dxlog_file14,
|
|
3919
|
+
L: 259,
|
|
3920
|
+
S: this,
|
|
3921
|
+
C: (f, a) => f(...a)
|
|
3889
3922
|
});
|
|
3890
3923
|
}
|
|
3891
3924
|
async close() {
|
|
@@ -3897,10 +3930,10 @@ var ClientServicesHost = class {
|
|
|
3897
3930
|
(0, import_log15.log)("closing...", {
|
|
3898
3931
|
deviceKey
|
|
3899
3932
|
}, {
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3933
|
+
F: __dxlog_file14,
|
|
3934
|
+
L: 269,
|
|
3935
|
+
S: this,
|
|
3936
|
+
C: (f, a) => f(...a)
|
|
3904
3937
|
});
|
|
3905
3938
|
this._serviceRegistry.setServices({
|
|
3906
3939
|
SystemService: this._systemService
|
|
@@ -3912,10 +3945,10 @@ var ClientServicesHost = class {
|
|
|
3912
3945
|
(0, import_log15.log)("closed", {
|
|
3913
3946
|
deviceKey
|
|
3914
3947
|
}, {
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3948
|
+
F: __dxlog_file14,
|
|
3949
|
+
L: 275,
|
|
3950
|
+
S: this,
|
|
3951
|
+
C: (f, a) => f(...a)
|
|
3919
3952
|
});
|
|
3920
3953
|
}
|
|
3921
3954
|
async reset() {
|
|
@@ -3924,35 +3957,41 @@ var ClientServicesHost = class {
|
|
|
3924
3957
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
|
|
3925
3958
|
id: traceId
|
|
3926
3959
|
}), {
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3960
|
+
F: __dxlog_file14,
|
|
3961
|
+
L: 280,
|
|
3962
|
+
S: this,
|
|
3963
|
+
C: (f, a) => f(...a)
|
|
3931
3964
|
});
|
|
3932
|
-
(0, import_log15.log)("resetting...",
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3965
|
+
(0, import_log15.log)("resetting...", void 0, {
|
|
3966
|
+
F: __dxlog_file14,
|
|
3967
|
+
L: 282,
|
|
3968
|
+
S: this,
|
|
3969
|
+
C: (f, a) => f(...a)
|
|
3937
3970
|
});
|
|
3938
3971
|
await ((_a = this._serviceContext) == null ? void 0 : _a.close());
|
|
3939
3972
|
await this._storage.reset();
|
|
3940
|
-
(0, import_log15.log)("reset",
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3973
|
+
(0, import_log15.log)("reset", void 0, {
|
|
3974
|
+
F: __dxlog_file14,
|
|
3975
|
+
L: 285,
|
|
3976
|
+
S: this,
|
|
3977
|
+
C: (f, a) => f(...a)
|
|
3945
3978
|
});
|
|
3946
3979
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.end({
|
|
3947
3980
|
id: traceId
|
|
3948
3981
|
}), {
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3982
|
+
F: __dxlog_file14,
|
|
3983
|
+
L: 286,
|
|
3984
|
+
S: this,
|
|
3985
|
+
C: (f, a) => f(...a)
|
|
3953
3986
|
});
|
|
3954
3987
|
}
|
|
3955
3988
|
};
|
|
3989
|
+
_ts_decorate4([
|
|
3990
|
+
import_async17.synchronized
|
|
3991
|
+
], ClientServicesHost.prototype, "open", null);
|
|
3992
|
+
_ts_decorate4([
|
|
3993
|
+
import_async17.synchronized
|
|
3994
|
+
], ClientServicesHost.prototype, "close", null);
|
|
3956
3995
|
|
|
3957
3996
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3958
3997
|
var import_async19 = require("@dxos/async");
|
|
@@ -4016,7 +4055,7 @@ var ClientRpcServer = class {
|
|
|
4016
4055
|
};
|
|
4017
4056
|
|
|
4018
4057
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
4019
|
-
var
|
|
4058
|
+
var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
|
|
4020
4059
|
var import_async18 = require("@dxos/async");
|
|
4021
4060
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
4022
4061
|
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
@@ -4046,7 +4085,7 @@ var ShellRuntimeImpl = class {
|
|
|
4046
4085
|
});
|
|
4047
4086
|
}
|
|
4048
4087
|
async setAppContext(context) {
|
|
4049
|
-
(0,
|
|
4088
|
+
(0, import_tiny_invariant14.default)(this._appRpc, "runtime not open");
|
|
4050
4089
|
await this._appRpc.rpc.AppService.setContext(context);
|
|
4051
4090
|
}
|
|
4052
4091
|
async open() {
|
|
@@ -4073,39 +4112,9 @@ var ShellRuntimeImpl = class {
|
|
|
4073
4112
|
this._appRpc = void 0;
|
|
4074
4113
|
}
|
|
4075
4114
|
};
|
|
4076
|
-
var MemoryShellRuntime = class {
|
|
4077
|
-
constructor({ layout, invitationCode, spaceKey } = {}) {
|
|
4078
|
-
this.layoutUpdate = new import_async18.Event();
|
|
4079
|
-
this.contextUpdate = new import_async18.Event();
|
|
4080
|
-
this._layout = layout != null ? layout : import_iframe.ShellLayout.DEFAULT;
|
|
4081
|
-
this._invitationCode = invitationCode;
|
|
4082
|
-
this._spaceKey = spaceKey;
|
|
4083
|
-
}
|
|
4084
|
-
get layout() {
|
|
4085
|
-
return this._layout;
|
|
4086
|
-
}
|
|
4087
|
-
get invitationCode() {
|
|
4088
|
-
return this._invitationCode;
|
|
4089
|
-
}
|
|
4090
|
-
get spaceKey() {
|
|
4091
|
-
return this._spaceKey;
|
|
4092
|
-
}
|
|
4093
|
-
setLayout(layout, options = {}) {
|
|
4094
|
-
this._layout = layout;
|
|
4095
|
-
this._invitationCode = options.invitationCode;
|
|
4096
|
-
this._spaceKey = options.spaceKey;
|
|
4097
|
-
this.layoutUpdate.emit({
|
|
4098
|
-
layout,
|
|
4099
|
-
...options
|
|
4100
|
-
});
|
|
4101
|
-
}
|
|
4102
|
-
async setAppContext(context) {
|
|
4103
|
-
this.contextUpdate.emit(context);
|
|
4104
|
-
}
|
|
4105
|
-
};
|
|
4106
4115
|
|
|
4107
4116
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
4108
|
-
|
|
4117
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
4109
4118
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4110
4119
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4111
4120
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4114,7 +4123,8 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
4114
4123
|
if (d = decorators[i])
|
|
4115
4124
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4116
4125
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4117
|
-
}
|
|
4126
|
+
}
|
|
4127
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
|
|
4118
4128
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
4119
4129
|
var IFrameHostRuntime = class {
|
|
4120
4130
|
constructor({ config, origin, appPort, shellPort }) {
|
|
@@ -4135,11 +4145,11 @@ var IFrameHostRuntime = class {
|
|
|
4135
4145
|
}
|
|
4136
4146
|
async start() {
|
|
4137
4147
|
var _a;
|
|
4138
|
-
(0, import_log16.log)("starting...",
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4148
|
+
(0, import_log16.log)("starting...", void 0, {
|
|
4149
|
+
F: __dxlog_file15,
|
|
4150
|
+
L: 70,
|
|
4151
|
+
S: this,
|
|
4152
|
+
C: (f, a) => f(...a)
|
|
4143
4153
|
});
|
|
4144
4154
|
try {
|
|
4145
4155
|
this._config = await (0, import_util9.getAsyncValue)(this._configProvider);
|
|
@@ -4184,42 +4194,42 @@ var IFrameHostRuntime = class {
|
|
|
4184
4194
|
(_a = this._shellRuntime) == null ? void 0 : _a.open()
|
|
4185
4195
|
]);
|
|
4186
4196
|
this._ready.wake(void 0);
|
|
4187
|
-
(0, import_log16.log)("started",
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4197
|
+
(0, import_log16.log)("started", void 0, {
|
|
4198
|
+
F: __dxlog_file15,
|
|
4199
|
+
L: 113,
|
|
4200
|
+
S: this,
|
|
4201
|
+
C: (f, a) => f(...a)
|
|
4192
4202
|
});
|
|
4193
4203
|
} catch (err) {
|
|
4194
4204
|
this._ready.wake(err);
|
|
4195
|
-
import_log16.log.catch(err,
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4205
|
+
import_log16.log.catch(err, void 0, {
|
|
4206
|
+
F: __dxlog_file15,
|
|
4207
|
+
L: 116,
|
|
4208
|
+
S: this,
|
|
4209
|
+
C: (f, a) => f(...a)
|
|
4200
4210
|
});
|
|
4201
4211
|
}
|
|
4202
4212
|
}
|
|
4203
4213
|
async stop() {
|
|
4204
4214
|
var _a;
|
|
4205
|
-
(0, import_log16.log)("stopping...",
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4215
|
+
(0, import_log16.log)("stopping...", void 0, {
|
|
4216
|
+
F: __dxlog_file15,
|
|
4217
|
+
L: 121,
|
|
4218
|
+
S: this,
|
|
4219
|
+
C: (f, a) => f(...a)
|
|
4210
4220
|
});
|
|
4211
4221
|
await this._clientRpc.close();
|
|
4212
4222
|
await this._clientServices.close();
|
|
4213
4223
|
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
4214
|
-
(0, import_log16.log)("stopped",
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4224
|
+
(0, import_log16.log)("stopped", void 0, {
|
|
4225
|
+
F: __dxlog_file15,
|
|
4226
|
+
L: 125,
|
|
4227
|
+
S: this,
|
|
4228
|
+
C: (f, a) => f(...a)
|
|
4219
4229
|
});
|
|
4220
4230
|
}
|
|
4221
4231
|
};
|
|
4222
|
-
|
|
4232
|
+
_ts_decorate5([
|
|
4223
4233
|
import_log16.logInfo
|
|
4224
4234
|
], IFrameHostRuntime.prototype, "origin", void 0);
|
|
4225
4235
|
|
|
@@ -4231,6 +4241,7 @@ var import_log17 = require("@dxos/log");
|
|
|
4231
4241
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
4232
4242
|
var import_rpc3 = require("@dxos/rpc");
|
|
4233
4243
|
var import_util10 = require("@dxos/util");
|
|
4244
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
|
|
4234
4245
|
var IFrameProxyRuntime = class {
|
|
4235
4246
|
constructor({ config, systemPort, shellPort }) {
|
|
4236
4247
|
this._id = String(Math.floor(Math.random() * 1e6));
|
|
@@ -4278,11 +4289,11 @@ var IFrameProxyRuntime = class {
|
|
|
4278
4289
|
lockKey
|
|
4279
4290
|
});
|
|
4280
4291
|
} catch (err) {
|
|
4281
|
-
import_log17.log.catch(err,
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4292
|
+
import_log17.log.catch(err, void 0, {
|
|
4293
|
+
F: __dxlog_file16,
|
|
4294
|
+
L: 85,
|
|
4295
|
+
S: this,
|
|
4296
|
+
C: (f, a) => f(...a)
|
|
4286
4297
|
});
|
|
4287
4298
|
throw new import_errors5.RemoteServiceConnectionError("Failed to connect to worker");
|
|
4288
4299
|
}
|
|
@@ -4307,13 +4318,13 @@ var import_messaging3 = require("@dxos/messaging");
|
|
|
4307
4318
|
var import_network_manager5 = require("@dxos/network-manager");
|
|
4308
4319
|
|
|
4309
4320
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
4310
|
-
var
|
|
4321
|
+
var import_tiny_invariant15 = __toESM(require("tiny-invariant"));
|
|
4311
4322
|
var import_async21 = require("@dxos/async");
|
|
4312
4323
|
var import_client_protocol9 = require("@dxos/client-protocol");
|
|
4313
4324
|
var import_log18 = require("@dxos/log");
|
|
4314
4325
|
var import_rpc4 = require("@dxos/rpc");
|
|
4315
4326
|
var import_util11 = require("@dxos/util");
|
|
4316
|
-
|
|
4327
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
4317
4328
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4318
4329
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4319
4330
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4322,12 +4333,13 @@ var __decorate5 = function(decorators, target, key, desc) {
|
|
|
4322
4333
|
if (d = decorators[i])
|
|
4323
4334
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4324
4335
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4325
|
-
}
|
|
4336
|
+
}
|
|
4337
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
|
|
4326
4338
|
var WorkerSession = class {
|
|
4327
4339
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
4328
4340
|
this._startTrigger = new import_async21.Trigger();
|
|
4329
4341
|
this.onClose = new import_util11.Callback();
|
|
4330
|
-
(0,
|
|
4342
|
+
(0, import_tiny_invariant15.default)(serviceHost);
|
|
4331
4343
|
this._serviceHost = serviceHost;
|
|
4332
4344
|
const middleware = {
|
|
4333
4345
|
handleCall: async (method, params, handler) => {
|
|
@@ -4374,11 +4386,11 @@ var WorkerSession = class {
|
|
|
4374
4386
|
try {
|
|
4375
4387
|
await this.close();
|
|
4376
4388
|
} catch (err) {
|
|
4377
|
-
import_log18.log.catch(err,
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4389
|
+
import_log18.log.catch(err, void 0, {
|
|
4390
|
+
F: __dxlog_file17,
|
|
4391
|
+
L: 100,
|
|
4392
|
+
S: this,
|
|
4393
|
+
C: (f, a) => f(...a)
|
|
4382
4394
|
});
|
|
4383
4395
|
}
|
|
4384
4396
|
});
|
|
@@ -4391,11 +4403,11 @@ var WorkerSession = class {
|
|
|
4391
4403
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
4392
4404
|
}
|
|
4393
4405
|
async open() {
|
|
4394
|
-
import_log18.log.info("opening..",
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4406
|
+
import_log18.log.info("opening..", void 0, {
|
|
4407
|
+
F: __dxlog_file17,
|
|
4408
|
+
L: 114,
|
|
4409
|
+
S: this,
|
|
4410
|
+
C: (f, a) => f(...a)
|
|
4399
4411
|
});
|
|
4400
4412
|
await Promise.all([
|
|
4401
4413
|
this._clientRpc.open(),
|
|
@@ -4410,20 +4422,20 @@ var WorkerSession = class {
|
|
|
4410
4422
|
}
|
|
4411
4423
|
}
|
|
4412
4424
|
async close() {
|
|
4413
|
-
import_log18.log.info("closing..",
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4425
|
+
import_log18.log.info("closing..", void 0, {
|
|
4426
|
+
F: __dxlog_file17,
|
|
4427
|
+
L: 124,
|
|
4428
|
+
S: this,
|
|
4429
|
+
C: (f, a) => f(...a)
|
|
4418
4430
|
});
|
|
4419
4431
|
try {
|
|
4420
4432
|
await this.onClose.callIfSet();
|
|
4421
4433
|
} catch (err) {
|
|
4422
|
-
import_log18.log.catch(err,
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4434
|
+
import_log18.log.catch(err, void 0, {
|
|
4435
|
+
F: __dxlog_file17,
|
|
4436
|
+
L: 128,
|
|
4437
|
+
S: this,
|
|
4438
|
+
C: (f, a) => f(...a)
|
|
4427
4439
|
});
|
|
4428
4440
|
}
|
|
4429
4441
|
await Promise.all([
|
|
@@ -4435,11 +4447,11 @@ var WorkerSession = class {
|
|
|
4435
4447
|
try {
|
|
4436
4448
|
await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
4437
4449
|
} catch (e) {
|
|
4438
|
-
import_log18.log.info("No shell connected.",
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4450
|
+
import_log18.log.info("No shell connected.", void 0, {
|
|
4451
|
+
F: __dxlog_file17,
|
|
4452
|
+
L: 138,
|
|
4453
|
+
S: this,
|
|
4454
|
+
C: (f, a) => f(...a)
|
|
4443
4455
|
});
|
|
4444
4456
|
}
|
|
4445
4457
|
}
|
|
@@ -4448,14 +4460,15 @@ var WorkerSession = class {
|
|
|
4448
4460
|
}).then(callback);
|
|
4449
4461
|
}
|
|
4450
4462
|
};
|
|
4451
|
-
|
|
4463
|
+
_ts_decorate6([
|
|
4452
4464
|
import_log18.logInfo
|
|
4453
4465
|
], WorkerSession.prototype, "origin", void 0);
|
|
4454
|
-
|
|
4466
|
+
_ts_decorate6([
|
|
4455
4467
|
import_log18.logInfo
|
|
4456
4468
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
4457
4469
|
|
|
4458
4470
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
4471
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
|
|
4459
4472
|
var WorkerRuntime = class {
|
|
4460
4473
|
// prettier-ignore
|
|
4461
4474
|
constructor(_configProvider) {
|
|
@@ -4469,11 +4482,11 @@ var WorkerRuntime = class {
|
|
|
4469
4482
|
return this._clientServices;
|
|
4470
4483
|
}
|
|
4471
4484
|
async start() {
|
|
4472
|
-
(0, import_log19.log)("starting...",
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4485
|
+
(0, import_log19.log)("starting...", void 0, {
|
|
4486
|
+
F: __dxlog_file18,
|
|
4487
|
+
L: 48,
|
|
4488
|
+
S: this,
|
|
4489
|
+
C: (f, a) => f(...a)
|
|
4477
4490
|
});
|
|
4478
4491
|
try {
|
|
4479
4492
|
this._config = await this._configProvider();
|
|
@@ -4485,19 +4498,19 @@ var WorkerRuntime = class {
|
|
|
4485
4498
|
});
|
|
4486
4499
|
await this._clientServices.open();
|
|
4487
4500
|
this._ready.wake(void 0);
|
|
4488
|
-
(0, import_log19.log)("started",
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4501
|
+
(0, import_log19.log)("started", void 0, {
|
|
4502
|
+
F: __dxlog_file18,
|
|
4503
|
+
L: 62,
|
|
4504
|
+
S: this,
|
|
4505
|
+
C: (f, a) => f(...a)
|
|
4493
4506
|
});
|
|
4494
4507
|
} catch (err) {
|
|
4495
4508
|
this._ready.wake(err);
|
|
4496
|
-
import_log19.log.catch(err,
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4509
|
+
import_log19.log.catch(err, void 0, {
|
|
4510
|
+
F: __dxlog_file18,
|
|
4511
|
+
L: 65,
|
|
4512
|
+
S: this,
|
|
4513
|
+
C: (f, a) => f(...a)
|
|
4501
4514
|
});
|
|
4502
4515
|
}
|
|
4503
4516
|
}
|
|
@@ -4527,11 +4540,11 @@ var WorkerRuntime = class {
|
|
|
4527
4540
|
* Selects one of the existing session fro WebRTC networking.
|
|
4528
4541
|
*/
|
|
4529
4542
|
_reconnectWebrtc() {
|
|
4530
|
-
(0, import_log19.log)("reconnecting webrtc...",
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4543
|
+
(0, import_log19.log)("reconnecting webrtc...", void 0, {
|
|
4544
|
+
F: __dxlog_file18,
|
|
4545
|
+
L: 102,
|
|
4546
|
+
S: this,
|
|
4547
|
+
C: (f, a) => f(...a)
|
|
4535
4548
|
});
|
|
4536
4549
|
if (this._sessionForNetworking) {
|
|
4537
4550
|
if (!this.sessions.has(this._sessionForNetworking)) {
|
|
@@ -4565,7 +4578,6 @@ var WorkerRuntime = class {
|
|
|
4565
4578
|
InvitationsHandler,
|
|
4566
4579
|
InvitationsServiceImpl,
|
|
4567
4580
|
Lock,
|
|
4568
|
-
MemoryShellRuntime,
|
|
4569
4581
|
ServiceContext,
|
|
4570
4582
|
ServiceRegistry,
|
|
4571
4583
|
ShellRuntimeImpl,
|
|
@@ -4575,6 +4587,7 @@ var WorkerRuntime = class {
|
|
|
4575
4587
|
WorkerRuntime,
|
|
4576
4588
|
WorkerSession,
|
|
4577
4589
|
createAuthProvider,
|
|
4590
|
+
createDefaultModelFactory,
|
|
4578
4591
|
createStorageObjects,
|
|
4579
4592
|
getNetworkPeers,
|
|
4580
4593
|
isLocked,
|