@dxos/client-services 0.6.14-staging.e15392e → 0.7.0
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-UNN7JEOU.mjs → chunk-GP5GD22Z.mjs} +169 -142
- package/dist/lib/browser/chunk-GP5GD22Z.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +9 -2
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-4BJB67XI.cjs → chunk-3ERQHVZE.cjs} +177 -150
- package/dist/lib/node/chunk-3ERQHVZE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +16 -9
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/{chunk-Z3GXONTZ.mjs → chunk-UTJ4HL4J.mjs} +169 -142
- package/dist/lib/node-esm/chunk-UTJ4HL4J.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +9 -2
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/packlets/devices/devices-service.d.ts +3 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +1 -0
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +1 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +38 -38
- package/src/packlets/devices/devices-service.ts +18 -7
- package/src/packlets/identity/identity.test.ts +16 -5
- package/src/packlets/invitations/edge-invitation-handler.ts +6 -3
- package/src/packlets/invitations/invitation-guest-extenstion.ts +5 -5
- package/src/packlets/invitations/invitation-host-extension.ts +7 -10
- package/src/packlets/invitations/invitations-handler.test.ts +3 -6
- package/src/packlets/invitations/invitations-handler.ts +34 -28
- package/src/packlets/invitations/invitations-manager.ts +5 -3
- package/src/packlets/invitations/invitations-service.ts +5 -1
- package/src/packlets/services/service-context.ts +2 -2
- package/src/packlets/services/service-host.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.test.ts +12 -7
- package/src/packlets/spaces/edge-feed-replicator.ts +9 -5
- package/src/packlets/testing/invitation-utils.ts +7 -0
- package/src/version.ts +5 -1
- package/dist/lib/browser/chunk-UNN7JEOU.mjs.map +0 -7
- package/dist/lib/node/chunk-4BJB67XI.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z3GXONTZ.mjs.map +0 -7
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
InvitationsManager,
|
|
7
7
|
ServiceContext,
|
|
8
8
|
SpaceInvitationProtocol
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-UTJ4HL4J.mjs";
|
|
10
10
|
|
|
11
11
|
// packages/sdk/client-services/src/packlets/testing/credential-utils.ts
|
|
12
12
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -36,6 +36,7 @@ var sanitizeInvitation = (invitation) => {
|
|
|
36
36
|
var performInvitation = ({ host, guest, options, hooks, guestDeviceProfile, codeInputDelay }) => {
|
|
37
37
|
let guestError = false;
|
|
38
38
|
let guestConnected = false;
|
|
39
|
+
let wereConnected = false;
|
|
39
40
|
const hostComplete = new Trigger();
|
|
40
41
|
const guestComplete = new Trigger();
|
|
41
42
|
const authCode = new Trigger();
|
|
@@ -44,6 +45,11 @@ var performInvitation = ({ host, guest, options, hooks, guestDeviceProfile, code
|
|
|
44
45
|
switch (hostInvitation.state) {
|
|
45
46
|
case Invitation.State.CONNECTING: {
|
|
46
47
|
if (guestConnected) {
|
|
48
|
+
if (wereConnected) {
|
|
49
|
+
hostComplete.wake({
|
|
50
|
+
invitation: hostInvitation
|
|
51
|
+
});
|
|
52
|
+
}
|
|
47
53
|
break;
|
|
48
54
|
}
|
|
49
55
|
guestConnected = true;
|
|
@@ -59,7 +65,7 @@ var performInvitation = ({ host, guest, options, hooks, guestDeviceProfile, code
|
|
|
59
65
|
}
|
|
60
66
|
invariant(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
|
|
61
67
|
F: __dxlog_file,
|
|
62
|
-
L:
|
|
68
|
+
L: 95,
|
|
63
69
|
S: void 0,
|
|
64
70
|
A: [
|
|
65
71
|
"hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!)",
|
|
@@ -131,6 +137,7 @@ var performInvitation = ({ host, guest, options, hooks, guestDeviceProfile, code
|
|
|
131
137
|
break;
|
|
132
138
|
}
|
|
133
139
|
case Invitation.State.CONNECTED: {
|
|
140
|
+
wereConnected = true;
|
|
134
141
|
hooks?.host?.onConnected?.(hostObservable);
|
|
135
142
|
break;
|
|
136
143
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/packlets/testing/credential-utils.ts", "../../../../src/packlets/testing/invitation-utils.ts", "../../../../src/packlets/testing/test-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createCredential } from '@dxos/credentials';\nimport { type Signer } from '@dxos/crypto';\nimport { PublicKey } from '@dxos/keys';\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nexport const createMockCredential = async ({\n signer,\n issuer,\n}: {\n signer: Signer;\n issuer: PublicKey;\n}): Promise<Credential> =>\n createCredential({\n signer,\n issuer,\n subject: new PublicKey(Buffer.from('test')),\n assertion: {\n '@type': 'example.testing.rpc.MessageWithAny',\n payload: {\n '@type': 'google.protobuf.Any',\n value: Buffer.from('test'),\n },\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Trigger } from '@dxos/async';\nimport { InvitationEncoder, type AuthenticatingInvitation, type CancellableInvitation } from '@dxos/client-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nimport { ServiceContext } from '../services';\n\n/**\n * Strip secrets from invitation before giving it to the peer.\n */\nexport const sanitizeInvitation = (invitation: Invitation): Invitation => {\n return InvitationEncoder.decode(InvitationEncoder.encode(invitation));\n};\n\nexport type InvitationHost = {\n share(options?: Partial<Invitation>): CancellableInvitation;\n};\n\nexport type InvitationGuest = {\n join(invitation: Invitation | string, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;\n};\n\nexport type PerformInvitationCallbacks<T> = {\n onConnecting?: (value: T) => boolean | void;\n onConnected?: (value: T) => boolean | void;\n onReady?: (value: T) => boolean | void;\n onAuthenticating?: (value: T) => boolean | void;\n onSuccess?: (value: T) => boolean | void;\n onCancelled?: (value: T) => boolean | void;\n onTimeout?: (value: T) => boolean | void;\n onError?: (value: T) => boolean | void;\n};\n\nexport type PerformInvitationParams = {\n host: ServiceContext | InvitationHost;\n guest: ServiceContext | InvitationGuest;\n options?: Partial<Invitation>;\n hooks?: {\n host?: PerformInvitationCallbacks<CancellableInvitation>;\n guest?: PerformInvitationCallbacks<AuthenticatingInvitation>;\n };\n guestDeviceProfile?: DeviceProfileDocument;\n codeInputDelay?: number;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\n// TODO(burdon): Make async.\n// TODO(burdon): Rename startInvitation.\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n codeInputDelay,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n let guestError = false;\n let guestConnected = false;\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n void createInvitation(host, options).then((hostObservable) => {\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (guestConnected) {\n break;\n }\n guestConnected = true;\n if (hooks?.host?.onConnecting?.(hostObservable)) {\n break;\n }\n const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);\n guestObservable.subscribe(\n async (guestInvitation: Invitation) => {\n switch (guestInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.guest?.onConnecting?.(guestObservable)) {\n break;\n }\n invariant(hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!));\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.guest?.onConnected?.(guestObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.guest?.onReady?.(guestObservable)) {\n break;\n }\n const code = await authCode.wait();\n if (codeInputDelay == null) {\n await guestObservable.authenticate(code);\n } else {\n setTimeout(async () => {\n if (!guestError) {\n await guestObservable.authenticate(code);\n }\n }, codeInputDelay);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.guest?.onAuthenticating?.(guestObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.guest?.onSuccess?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.guest?.onCancelled?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.guest?.onTimeout?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ invitation: guestInvitation });\n }\n }\n },\n (error: Error) => {\n guestError = true;\n if (hooks?.guest?.onError?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ error });\n },\n );\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.host?.onConnected?.(hostObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.host?.onReady?.(hostObservable)) {\n break;\n }\n if (hostInvitation.authCode) {\n authCode.wake(hostInvitation.authCode);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.host?.onAuthenticating?.(hostObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.host?.onSuccess?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.host?.onCancelled?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.host?.onTimeout?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n }\n },\n (error: Error) => {\n if (hooks?.host?.onError?.(hostObservable)) {\n return;\n }\n hostComplete.wake({ error });\n },\n );\n });\n\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nexport const createInvitation = async (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): Promise<CancellableInvitation> => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n return host.invitationsManager.createInvitation({\n kind: Invitation.Kind.SPACE,\n ...options,\n });\n }\n\n return host.share(options);\n};\n\nexport const acceptInvitation = (\n guest: ServiceContext | InvitationGuest,\n invitation: Invitation,\n guestDeviceProfile?: DeviceProfileDocument,\n): AuthenticatingInvitation => {\n invitation = sanitizeInvitation(invitation);\n\n if (guest instanceof ServiceContext) {\n return guest.invitationsManager.acceptInvitation({\n invitation,\n deviceProfile: guestDeviceProfile,\n });\n }\n\n return guest.join(invitation, guestDeviceProfile);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Config } from '@dxos/config';\nimport { Context } from '@dxos/context';\nimport { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';\nimport { failUndefined } from '@dxos/debug';\nimport { EchoHost, MetadataStore, SpaceManager, valueEncoding, MeshEchoReplicator } from '@dxos/echo-pipeline';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { type LevelDB } from '@dxos/kv-store';\nimport { createTestLevel } from '@dxos/kv-store/testing';\nimport { MemorySignalManager, MemorySignalManagerContext, type SignalManager } from '@dxos/messaging';\nimport { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { InvitationsHandler, InvitationsManager, SpaceInvitationProtocol } from '../invitations';\nimport { ClientServicesHost, ServiceContext, type ServiceContextRuntimeParams } from '../services';\nimport { DataSpaceManager, type DataSpaceManagerRuntimeParams, type SigningContext } from '../spaces';\n\n//\n// TODO(burdon): Replace with test builder.\n//\n\nexport const createServiceHost = (config: Config, signalManagerContext: MemorySignalManagerContext) => {\n return new ClientServicesHost({\n config,\n signalManager: new MemorySignalManager(signalManagerContext),\n transportFactory: MemoryTransportFactory,\n });\n};\n\nexport const createServiceContext = async ({\n signalManagerFactory = async () => {\n const signalContext = new MemorySignalManagerContext();\n return new MemorySignalManager(signalContext);\n },\n storage = createStorage({ type: StorageType.RAM }),\n runtimeParams,\n}: {\n signalManagerFactory?: () => Promise<SignalManager>;\n storage?: Storage;\n runtimeParams?: ServiceContextRuntimeParams;\n} = {}) => {\n const signalManager = await signalManagerFactory();\n const networkManager = new SwarmNetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n const level = createTestLevel();\n await level.open();\n\n return new ServiceContext(storage, level, networkManager, signalManager, undefined, undefined, {\n invitationConnectionDefaultParams: { teleport: { controlHeartbeatInterval: 200 } },\n ...runtimeParams,\n });\n};\n\nexport const createPeers = async (numPeers: number, signalManagerFactory?: () => Promise<SignalManager>) => {\n if (!signalManagerFactory) {\n const signalContext = new MemorySignalManagerContext();\n signalManagerFactory = async () => new MemorySignalManager(signalContext);\n }\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = await createServiceContext({ signalManagerFactory });\n await peer.open(new Context());\n return peer;\n }),\n );\n};\n\nexport const createIdentity = async (peer: ServiceContext) => {\n await peer.createIdentity();\n return peer;\n};\n\nexport class TestBuilder {\n public readonly signalContext = new MemorySignalManagerContext();\n private readonly _ctx = new Context();\n\n createPeer(peerOptions?: TestPeerOpts): TestPeer {\n const peer = new TestPeer(this.signalContext, peerOptions);\n this._ctx.onDispose(async () => peer.destroy());\n return peer;\n }\n\n async destroy() {\n await this._ctx.dispose();\n }\n}\n\nexport type TestPeerOpts = {\n dataStore?: StorageType;\n dataSpaceParams?: DataSpaceManagerRuntimeParams;\n};\n\nexport type TestPeerProps = {\n storage?: Storage;\n level?: LevelDB;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: SwarmNetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\n meshEchoReplicator?: MeshEchoReplicator;\n invitationsManager?: InvitationsManager;\n};\n\nexport class TestPeer {\n private _props: TestPeerProps = {};\n\n constructor(\n private readonly _signalContext: MemorySignalManagerContext,\n private readonly _opts: TestPeerOpts = { dataStore: StorageType.RAM },\n ) {}\n\n get props() {\n return this._props;\n }\n\n get storage() {\n return (this._props.storage ??= createStorage({ type: this._opts.dataStore }));\n }\n\n get keyring() {\n return (this._props.keyring ??= new Keyring(this.storage.createDirectory('keyring')));\n }\n\n get level() {\n return (this._props.level ??= createTestLevel());\n }\n\n get feedStore() {\n return (this._props.feedStore ??= new FeedStore({\n factory: new FeedFactory({\n root: this.storage.createDirectory('feeds'),\n signer: this.keyring,\n hypercore: {\n valueEncoding,\n },\n }),\n }));\n }\n\n get metadataStore() {\n return (this._props.metadataStore ??= new MetadataStore(this.storage.createDirectory('metadata')));\n }\n\n get blobStore() {\n return (this._props.blobStore ??= new BlobStore(this.storage.createDirectory('blobs')));\n }\n\n get networkManager() {\n return (this._props.networkManager ??= new SwarmNetworkManager({\n signalManager: new MemorySignalManager(this._signalContext),\n transportFactory: MemoryTransportFactory,\n }));\n }\n\n get spaceManager() {\n return (this._props.spaceManager ??= new SpaceManager({\n feedStore: this.feedStore,\n networkManager: this.networkManager,\n metadataStore: this.metadataStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get echoHost() {\n return (this._props.echoHost ??= new EchoHost({ kv: this.level }));\n }\n\n get meshEchoReplicator() {\n return (this._props.meshEchoReplicator ??= new MeshEchoReplicator());\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager({\n spaceManager: this.spaceManager,\n metadataStore: this.metadataStore,\n keyring: this.keyring,\n signingContext: this.identity,\n feedStore: this.feedStore,\n echoHost: this.echoHost,\n invitationsManager: this.invitationsManager,\n edgeConnection: undefined,\n meshReplicator: this.meshEchoReplicator,\n echoEdgeReplicator: undefined,\n runtimeParams: this._opts.dataSpaceParams,\n }));\n }\n\n get invitationsManager() {\n return (this._props.invitationsManager ??= new InvitationsManager(\n new InvitationsHandler(this.networkManager),\n (invitation) => {\n if (invitation.kind === Invitation.Kind.SPACE) {\n return new SpaceInvitationProtocol(this.dataSpaceManager, this.identity!, this.keyring, invitation.spaceKey!);\n } else {\n throw new Error('not implemented');\n }\n },\n this.metadataStore,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n this.networkManager.setPeerInfo({\n identityKey: this._props.signingContext.identityKey.toHex(),\n peerKey: this._props.signingContext.deviceKey.toHex(),\n });\n }\n\n async destroy() {\n await this.level.close();\n await this.storage.reset();\n }\n}\n\nexport const createSigningContext = async (keyring: Keyring): Promise<SigningContext> => {\n const identityKey = await keyring.createKey();\n const deviceKey = await keyring.createKey();\n\n return {\n identityKey,\n deviceKey,\n credentialSigner: createCredentialSignerWithChain(\n keyring,\n {\n credential: await new CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey),\n },\n deviceKey,\n ),\n recordCredential: async () => {}, // No-op.\n getProfile: () => undefined,\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAIA,SAASA,wBAAwB;AAEjC,SAASC,iBAAiB;AAGnB,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,OAAM,MAKNC,iBAAiB;EACfF;EACAC;EACAE,SAAS,IAAIC,UAAUC,OAAOC,KAAK,MAAA,CAAA;EACnCC,WAAW;IACT,SAAS;IACTC,SAAS;MACP,SAAS;MACTC,OAAOJ,OAAOC,KAAK,MAAA;IACrB;EACF;AACF,CAAA;;;ACvBF,SAASI,eAAe;AACxB,SAASC,yBAAoF;AAC7F,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;;AAQpB,IAAMC,qBAAqB,CAACC,eAAAA;AACjC,SAAOC,kBAAkBC,OAAOD,kBAAkBE,OAAOH,UAAAA,CAAAA;AAC3D;AAqCO,IAAMI,oBAAoB,CAAC,EAChCC,MACAC,OACAC,SACAC,OACAC,oBACAC,eAAc,MACU;AACxB,MAAIC,aAAa;AACjB,MAAIC,iBAAiB;AACrB,QAAMC,eAAe,IAAIC,QAAAA;AACzB,QAAMC,gBAAgB,IAAID,QAAAA;AAC1B,QAAME,WAAW,IAAIF,QAAAA;AAErB,OAAKG,
|
|
6
|
-
"names": ["createCredential", "PublicKey", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "Trigger", "InvitationEncoder", "invariant", "Invitation", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "codeInputDelay", "guestError", "guestConnected", "hostComplete", "Trigger", "guestComplete", "authCode", "createInvitation", "then", "hostObservable", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "code", "wait", "authenticate", "setTimeout", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createCredential } from '@dxos/credentials';\nimport { type Signer } from '@dxos/crypto';\nimport { PublicKey } from '@dxos/keys';\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nexport const createMockCredential = async ({\n signer,\n issuer,\n}: {\n signer: Signer;\n issuer: PublicKey;\n}): Promise<Credential> =>\n createCredential({\n signer,\n issuer,\n subject: new PublicKey(Buffer.from('test')),\n assertion: {\n '@type': 'example.testing.rpc.MessageWithAny',\n payload: {\n '@type': 'google.protobuf.Any',\n value: Buffer.from('test'),\n },\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Trigger } from '@dxos/async';\nimport { InvitationEncoder, type AuthenticatingInvitation, type CancellableInvitation } from '@dxos/client-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nimport { ServiceContext } from '../services';\n\n/**\n * Strip secrets from invitation before giving it to the peer.\n */\nexport const sanitizeInvitation = (invitation: Invitation): Invitation => {\n return InvitationEncoder.decode(InvitationEncoder.encode(invitation));\n};\n\nexport type InvitationHost = {\n share(options?: Partial<Invitation>): CancellableInvitation;\n};\n\nexport type InvitationGuest = {\n join(invitation: Invitation | string, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;\n};\n\nexport type PerformInvitationCallbacks<T> = {\n onConnecting?: (value: T) => boolean | void;\n onConnected?: (value: T) => boolean | void;\n onReady?: (value: T) => boolean | void;\n onAuthenticating?: (value: T) => boolean | void;\n onSuccess?: (value: T) => boolean | void;\n onCancelled?: (value: T) => boolean | void;\n onTimeout?: (value: T) => boolean | void;\n onError?: (value: T) => boolean | void;\n};\n\nexport type PerformInvitationParams = {\n host: ServiceContext | InvitationHost;\n guest: ServiceContext | InvitationGuest;\n options?: Partial<Invitation>;\n hooks?: {\n host?: PerformInvitationCallbacks<CancellableInvitation>;\n guest?: PerformInvitationCallbacks<AuthenticatingInvitation>;\n };\n guestDeviceProfile?: DeviceProfileDocument;\n codeInputDelay?: number;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\n// TODO(burdon): Make async.\n// TODO(burdon): Rename startInvitation.\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n codeInputDelay,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n let guestError = false;\n let guestConnected = false;\n let wereConnected = false;\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n void createInvitation(host, options).then((hostObservable) => {\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (guestConnected) {\n if (wereConnected) {\n hostComplete.wake({ invitation: hostInvitation });\n }\n break;\n }\n\n guestConnected = true;\n if (hooks?.host?.onConnecting?.(hostObservable)) {\n break;\n }\n\n const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);\n guestObservable.subscribe(\n async (guestInvitation: Invitation) => {\n switch (guestInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.guest?.onConnecting?.(guestObservable)) {\n break;\n }\n invariant(hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!));\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.guest?.onConnected?.(guestObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.guest?.onReady?.(guestObservable)) {\n break;\n }\n const code = await authCode.wait();\n if (codeInputDelay == null) {\n await guestObservable.authenticate(code);\n } else {\n setTimeout(async () => {\n if (!guestError) {\n await guestObservable.authenticate(code);\n }\n }, codeInputDelay);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.guest?.onAuthenticating?.(guestObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.guest?.onSuccess?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.guest?.onCancelled?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.guest?.onTimeout?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ invitation: guestInvitation });\n }\n }\n },\n (error: Error) => {\n guestError = true;\n if (hooks?.guest?.onError?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ error });\n },\n );\n break;\n }\n\n case Invitation.State.CONNECTED: {\n wereConnected = true;\n hooks?.host?.onConnected?.(hostObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.host?.onReady?.(hostObservable)) {\n break;\n }\n if (hostInvitation.authCode) {\n authCode.wake(hostInvitation.authCode);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.host?.onAuthenticating?.(hostObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.host?.onSuccess?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.host?.onCancelled?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.host?.onTimeout?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n }\n },\n (error: Error) => {\n if (hooks?.host?.onError?.(hostObservable)) {\n return;\n }\n hostComplete.wake({ error });\n },\n );\n });\n\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nexport const createInvitation = async (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): Promise<CancellableInvitation> => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n return host.invitationsManager.createInvitation({\n kind: Invitation.Kind.SPACE,\n ...options,\n });\n }\n\n return host.share(options);\n};\n\nexport const acceptInvitation = (\n guest: ServiceContext | InvitationGuest,\n invitation: Invitation,\n guestDeviceProfile?: DeviceProfileDocument,\n): AuthenticatingInvitation => {\n invitation = sanitizeInvitation(invitation);\n\n if (guest instanceof ServiceContext) {\n return guest.invitationsManager.acceptInvitation({\n invitation,\n deviceProfile: guestDeviceProfile,\n });\n }\n\n return guest.join(invitation, guestDeviceProfile);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Config } from '@dxos/config';\nimport { Context } from '@dxos/context';\nimport { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';\nimport { failUndefined } from '@dxos/debug';\nimport { EchoHost, MetadataStore, SpaceManager, valueEncoding, MeshEchoReplicator } from '@dxos/echo-pipeline';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { type LevelDB } from '@dxos/kv-store';\nimport { createTestLevel } from '@dxos/kv-store/testing';\nimport { MemorySignalManager, MemorySignalManagerContext, type SignalManager } from '@dxos/messaging';\nimport { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { InvitationsHandler, InvitationsManager, SpaceInvitationProtocol } from '../invitations';\nimport { ClientServicesHost, ServiceContext, type ServiceContextRuntimeParams } from '../services';\nimport { DataSpaceManager, type DataSpaceManagerRuntimeParams, type SigningContext } from '../spaces';\n\n//\n// TODO(burdon): Replace with test builder.\n//\n\nexport const createServiceHost = (config: Config, signalManagerContext: MemorySignalManagerContext) => {\n return new ClientServicesHost({\n config,\n signalManager: new MemorySignalManager(signalManagerContext),\n transportFactory: MemoryTransportFactory,\n });\n};\n\nexport const createServiceContext = async ({\n signalManagerFactory = async () => {\n const signalContext = new MemorySignalManagerContext();\n return new MemorySignalManager(signalContext);\n },\n storage = createStorage({ type: StorageType.RAM }),\n runtimeParams,\n}: {\n signalManagerFactory?: () => Promise<SignalManager>;\n storage?: Storage;\n runtimeParams?: ServiceContextRuntimeParams;\n} = {}) => {\n const signalManager = await signalManagerFactory();\n const networkManager = new SwarmNetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n const level = createTestLevel();\n await level.open();\n\n return new ServiceContext(storage, level, networkManager, signalManager, undefined, undefined, {\n invitationConnectionDefaultParams: { teleport: { controlHeartbeatInterval: 200 } },\n ...runtimeParams,\n });\n};\n\nexport const createPeers = async (numPeers: number, signalManagerFactory?: () => Promise<SignalManager>) => {\n if (!signalManagerFactory) {\n const signalContext = new MemorySignalManagerContext();\n signalManagerFactory = async () => new MemorySignalManager(signalContext);\n }\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = await createServiceContext({ signalManagerFactory });\n await peer.open(new Context());\n return peer;\n }),\n );\n};\n\nexport const createIdentity = async (peer: ServiceContext) => {\n await peer.createIdentity();\n return peer;\n};\n\nexport class TestBuilder {\n public readonly signalContext = new MemorySignalManagerContext();\n private readonly _ctx = new Context();\n\n createPeer(peerOptions?: TestPeerOpts): TestPeer {\n const peer = new TestPeer(this.signalContext, peerOptions);\n this._ctx.onDispose(async () => peer.destroy());\n return peer;\n }\n\n async destroy() {\n await this._ctx.dispose();\n }\n}\n\nexport type TestPeerOpts = {\n dataStore?: StorageType;\n dataSpaceParams?: DataSpaceManagerRuntimeParams;\n};\n\nexport type TestPeerProps = {\n storage?: Storage;\n level?: LevelDB;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: SwarmNetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\n meshEchoReplicator?: MeshEchoReplicator;\n invitationsManager?: InvitationsManager;\n};\n\nexport class TestPeer {\n private _props: TestPeerProps = {};\n\n constructor(\n private readonly _signalContext: MemorySignalManagerContext,\n private readonly _opts: TestPeerOpts = { dataStore: StorageType.RAM },\n ) {}\n\n get props() {\n return this._props;\n }\n\n get storage() {\n return (this._props.storage ??= createStorage({ type: this._opts.dataStore }));\n }\n\n get keyring() {\n return (this._props.keyring ??= new Keyring(this.storage.createDirectory('keyring')));\n }\n\n get level() {\n return (this._props.level ??= createTestLevel());\n }\n\n get feedStore() {\n return (this._props.feedStore ??= new FeedStore({\n factory: new FeedFactory({\n root: this.storage.createDirectory('feeds'),\n signer: this.keyring,\n hypercore: {\n valueEncoding,\n },\n }),\n }));\n }\n\n get metadataStore() {\n return (this._props.metadataStore ??= new MetadataStore(this.storage.createDirectory('metadata')));\n }\n\n get blobStore() {\n return (this._props.blobStore ??= new BlobStore(this.storage.createDirectory('blobs')));\n }\n\n get networkManager() {\n return (this._props.networkManager ??= new SwarmNetworkManager({\n signalManager: new MemorySignalManager(this._signalContext),\n transportFactory: MemoryTransportFactory,\n }));\n }\n\n get spaceManager() {\n return (this._props.spaceManager ??= new SpaceManager({\n feedStore: this.feedStore,\n networkManager: this.networkManager,\n metadataStore: this.metadataStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get echoHost() {\n return (this._props.echoHost ??= new EchoHost({ kv: this.level }));\n }\n\n get meshEchoReplicator() {\n return (this._props.meshEchoReplicator ??= new MeshEchoReplicator());\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager({\n spaceManager: this.spaceManager,\n metadataStore: this.metadataStore,\n keyring: this.keyring,\n signingContext: this.identity,\n feedStore: this.feedStore,\n echoHost: this.echoHost,\n invitationsManager: this.invitationsManager,\n edgeConnection: undefined,\n meshReplicator: this.meshEchoReplicator,\n echoEdgeReplicator: undefined,\n runtimeParams: this._opts.dataSpaceParams,\n }));\n }\n\n get invitationsManager() {\n return (this._props.invitationsManager ??= new InvitationsManager(\n new InvitationsHandler(this.networkManager),\n (invitation) => {\n if (invitation.kind === Invitation.Kind.SPACE) {\n return new SpaceInvitationProtocol(this.dataSpaceManager, this.identity!, this.keyring, invitation.spaceKey!);\n } else {\n throw new Error('not implemented');\n }\n },\n this.metadataStore,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n this.networkManager.setPeerInfo({\n identityKey: this._props.signingContext.identityKey.toHex(),\n peerKey: this._props.signingContext.deviceKey.toHex(),\n });\n }\n\n async destroy() {\n await this.level.close();\n await this.storage.reset();\n }\n}\n\nexport const createSigningContext = async (keyring: Keyring): Promise<SigningContext> => {\n const identityKey = await keyring.createKey();\n const deviceKey = await keyring.createKey();\n\n return {\n identityKey,\n deviceKey,\n credentialSigner: createCredentialSignerWithChain(\n keyring,\n {\n credential: await new CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey),\n },\n deviceKey,\n ),\n recordCredential: async () => {}, // No-op.\n getProfile: () => undefined,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAIA,SAASA,wBAAwB;AAEjC,SAASC,iBAAiB;AAGnB,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,OAAM,MAKNC,iBAAiB;EACfF;EACAC;EACAE,SAAS,IAAIC,UAAUC,OAAOC,KAA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oBtD,SAAS4C,aAAaG,SAAAA,EAAWQ,0BAA0BR,SAAAA;IACvG,GACAA,SAAAA;IAEFS,kBAAkB,YAAA;IAAa;IAC/BC,YAAY,MAAMrF;EACpB;AACF;",
|
|
6
|
+
"names": ["createCredential", "PublicKey", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "Trigger", "InvitationEncoder", "invariant", "Invitation", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "codeInputDelay", "guestError", "guestConnected", "wereConnected", "hostComplete", "Trigger", "guestComplete", "authCode", "createInvitation", "then", "hostObservable", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "wake", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "code", "wait", "authenticate", "setTimeout", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "deviceProfile", "join", "Context", "createCredentialSignerWithChain", "CredentialGenerator", "failUndefined", "EchoHost", "MetadataStore", "SpaceManager", "valueEncoding", "MeshEchoReplicator", "FeedFactory", "FeedStore", "Keyring", "createTestLevel", "MemorySignalManager", "MemorySignalManagerContext", "MemoryTransportFactory", "SwarmNetworkManager", "Invitation", "createStorage", "StorageType", "BlobStore", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalManagerFactory", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "runtimeParams", "networkManager", "SwarmNetworkManager", "level", "createTestLevel", "open", "ServiceContext", "undefined", "invitationConnectionDefaultParams", "teleport", "controlHeartbeatInterval", "createPeers", "numPeers", "Promise", "all", "Array", "from", "map", "peer", "Context", "createIdentity", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "_signalContext", "_opts", "dataStore", "_props", "props", "keyring", "Keyring", "createDirectory", "feedStore", "FeedStore", "factory", "FeedFactory", "root", "signer", "hypercore", "valueEncoding", "metadataStore", "MetadataStore", "blobStore", "BlobStore", "spaceManager", "SpaceManager", "identity", "signingContext", "failUndefined", "echoHost", "EchoHost", "kv", "meshEchoReplicator", "MeshEchoReplicator", "dataSpaceManager", "DataSpaceManager", "invitationsManager", "edgeConnection", "meshReplicator", "echoEdgeReplicator", "dataSpaceParams", "InvitationsManager", "InvitationsHandler", "invitation", "kind", "Invitation", "Kind", "SPACE", "SpaceInvitationProtocol", "spaceKey", "Error", "createSigningContext", "setPeerInfo", "identityKey", "toHex", "peerKey", "deviceKey", "close", "reset", "createKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile"]
|
|
7
7
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
+
import { type EdgeConnection } from '@dxos/edge-client';
|
|
2
3
|
import { Device, type DevicesService, type QueryDevicesResponse } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
4
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
4
5
|
import { type IdentityManager } from '../identity';
|
|
5
6
|
export declare class DevicesServiceImpl implements DevicesService {
|
|
6
7
|
private readonly _identityManager;
|
|
7
|
-
|
|
8
|
+
private readonly _edgeConnection?;
|
|
9
|
+
constructor(_identityManager: IdentityManager, _edgeConnection?: EdgeConnection | undefined);
|
|
8
10
|
updateDevice(profile: DeviceProfileDocument): Promise<Device>;
|
|
9
11
|
queryDevices(): Stream<QueryDevicesResponse>;
|
|
10
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devices-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devices/devices-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"devices-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devices/devices-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EACL,MAAM,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,kBAAmB,YAAW,cAAc;IAErD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;gBADhB,gBAAgB,EAAE,eAAe,EACjC,eAAe,CAAC,EAAE,cAAc,YAAA;IAG7C,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAInE,YAAY,IAAI,MAAM,CAAC,oBAAoB,CAAC;CA+E7C"}
|
|
@@ -7,6 +7,7 @@ import { type FlowLockHolder, type GuardedInvitationState } from './invitation-s
|
|
|
7
7
|
export interface EdgeInvitationHandlerCallbacks {
|
|
8
8
|
onInvitationSuccess(response: AdmissionResponse, request: AdmissionRequest): Promise<void>;
|
|
9
9
|
}
|
|
10
|
+
export declare const MAX_RETRIES_PER_INVITATION = 5;
|
|
10
11
|
export declare const DEFAULT_REQUEST_RETRY_INTERVAL_MS = 3000;
|
|
11
12
|
export declare const DEFAULT_REQUEST_RETRY_JITTER_MS = 500;
|
|
12
13
|
export type EdgeInvitationConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-invitation-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/edge-invitation-handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAYxD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAEtB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGtF,MAAM,WAAW,8BAA8B;IAC7C,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5F;AAED,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,qBAAa,qBAAsB,YAAW,cAAc;IAQxD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAR7B,OAAO,CAAC,SAAS,CAAyB;IAE1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAGpC,MAAM,EAAE,oBAAoB,GAAG,SAAS,EACvB,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,UAAU,EAAE,8BAA8B;IAMtD,MAAM,CACX,GAAG,EAAE,OAAO,EACZ,YAAY,EAAE,sBAAsB,EACpC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EACnC,UAAU,EAAE,8BAA8B;IAMtD,MAAM,CACX,GAAG,EAAE,OAAO,EACZ,YAAY,EAAE,sBAAsB,EACpC,QAAQ,EAAE,kBAAkB,EAC5B,aAAa,CAAC,EAAE,qBAAqB;YAqDzB,0BAA0B;YA6B1B,uBAAuB;YAUvB,sBAAsB;IA0B7B,WAAW,IAAI,OAAO;IAI7B,OAAO,CAAC,qBAAqB;CAG9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-host-extension.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-host-extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAmB,OAAO,EAAgB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAqB,OAAO,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAE3B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,KAAK,gCAAgC,GAAG;IACtC,gBAAgB,EAAE,UAAU,GAAG,IAAI,CAAC;IAGpC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEhC,aAAa,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC;IAEpD,KAAK,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,qBAAa,uBACX,SAAQ,YAAY,CAClB;IAAE,qBAAqB,EAAE,qBAAqB,CAAA;CAAE,EAChD;IAAE,qBAAqB,EAAE,qBAAqB,CAAA;CAAE,CAElD,YAAW,cAAc;IA+BvB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IA1B7B,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,qBAAqB,CAAiB;IAE9C,OAAO,CAAC,UAAU,CAAC,CAAqB;IAEjC,YAAY,CAAC,EAAE,eAAe,CAAa;IAE3C,oBAAoB,UAAS;IAEpC;;OAEG;IACI,mBAAmB,SAAK;IAE/B;;OAEG;IACI,gBAAgB,qBAA4B;IAEnD;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAA2B;gBAGnC,oBAAoB,EAAE,KAAK,EAC3B,UAAU,EAAE,gCAAgC;IAYxD,WAAW,IAAI,OAAO;cAIJ,WAAW,IAAI,OAAO,CAAC;QAAE,qBAAqB,EAAE,qBAAqB,CAAA;KAAE,CAAC;IAuIlF,MAAM,CAAC,OAAO,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"invitation-host-extension.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-host-extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAmB,OAAO,EAAgB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAqB,OAAO,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,KAAK,gBAAgB,EACr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CAAC;IA2BjF,qBAAqB,IAAI,UAAU,EAAE;IAIrC,sBAAsB,IAAI,UAAU,EAAE;IAItC,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI;IAQhE,OAAO,CAAC,iBAAiB;IAyCzB,OAAO,CAAC,2BAA2B;IAuBnC,OAAO,CAAC,oCAAoC;YAkC9B,kBAAkB;YAclB,qBAAqB;IAQnC,OAAO,CAAC,qBAAqB;CAO9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"invitations-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;AAGpD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;GAEG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,kBAAkB;IAGpE,iBAAiB;IAMjB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAYzD,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAOhE,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,gBAAgB,CAAC,OAAO,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,gBAAgB,IAAI,MAAM,CAAC,wBAAwB,CAAC;CAsErD"}
|
|
@@ -22,6 +22,7 @@ export declare class EdgeFeedReplicator extends Resource {
|
|
|
22
22
|
private _pushMutex;
|
|
23
23
|
constructor({ messenger, spaceId }: EdgeFeedReplicatorParams);
|
|
24
24
|
protected _open(): Promise<void>;
|
|
25
|
+
private _handleReconnect;
|
|
25
26
|
protected _close(): Promise<void>;
|
|
26
27
|
private _startReplication;
|
|
27
28
|
private _resetConnection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-feed-replicator.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/edge-feed-replicator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAW,QAAQ,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAWrD,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAG5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+D;IAEtF,OAAO,CAAC,cAAc,CAAC,CAAsB;IAC7C,OAAO,CAAC,UAAU,CAAS;IAC3B;;OAEG;IACH,OAAO,CAAC,aAAa,CAAqD;IAE1E;;OAEG;IACH,OAAO,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AqB,CAAC,CAAC;QACzD,KAAK,CAAC,EAAE,0BAA0B,CAAC,wBAAwB,CAAC,CAAC;KAC9D,CAAC;IACF,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IAAE,UAAU,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAIhE,eAAO,MAAM,iBAAiB,yEAO3B,uBAAuB,KAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CA2J7D,CAAC;AAEF,eAAO,MAAM,gBAAgB,SACrB,cAAc,GAAG,cAAc,YAC3B,OAAO,CAAC,UAAU,CAAC,KAC5B,OAAO,CAAC,qBAAqB,CAc/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,UACpB,cAAc,GAAG,eAAe,cAC3B,UAAU,uBACD,qBAAqB,KACzC,wBAWF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.
|
|
1
|
+
export declare const DXOS_VERSION = "0.7.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -42,48 +42,48 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"cbor-x": "^1.5.4",
|
|
44
44
|
"platform": "^1.3.6",
|
|
45
|
-
"@dxos/async": "0.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/echo-
|
|
55
|
-
"@dxos/echo-
|
|
56
|
-
"@dxos/echo-
|
|
57
|
-
"@dxos/echo-
|
|
58
|
-
"@dxos/edge-client": "0.
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/invariant": "0.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/lock-file": "0.
|
|
66
|
-
"@dxos/log": "0.
|
|
67
|
-
"@dxos/messaging": "0.
|
|
68
|
-
"@dxos/network-manager": "0.
|
|
69
|
-
"@dxos/node-std": "0.
|
|
70
|
-
"@dxos/protocols": "0.
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/teleport": "0.
|
|
74
|
-
"@dxos/teleport-extension-object-sync": "0.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/util": "0.
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/websocket-rpc": "0.
|
|
45
|
+
"@dxos/async": "0.7.0",
|
|
46
|
+
"@dxos/automerge": "0.7.0",
|
|
47
|
+
"@dxos/config": "0.7.0",
|
|
48
|
+
"@dxos/codec-protobuf": "0.7.0",
|
|
49
|
+
"@dxos/client-protocol": "0.7.0",
|
|
50
|
+
"@dxos/context": "0.7.0",
|
|
51
|
+
"@dxos/credentials": "0.7.0",
|
|
52
|
+
"@dxos/debug": "0.7.0",
|
|
53
|
+
"@dxos/crypto": "0.7.0",
|
|
54
|
+
"@dxos/echo-pipeline": "0.7.0",
|
|
55
|
+
"@dxos/echo-db": "0.7.0",
|
|
56
|
+
"@dxos/echo-protocol": "0.7.0",
|
|
57
|
+
"@dxos/echo-schema": "0.7.0",
|
|
58
|
+
"@dxos/edge-client": "0.7.0",
|
|
59
|
+
"@dxos/indexing": "0.7.0",
|
|
60
|
+
"@dxos/feed-store": "0.7.0",
|
|
61
|
+
"@dxos/invariant": "0.7.0",
|
|
62
|
+
"@dxos/keyring": "0.7.0",
|
|
63
|
+
"@dxos/keys": "0.7.0",
|
|
64
|
+
"@dxos/kv-store": "0.7.0",
|
|
65
|
+
"@dxos/lock-file": "0.7.0",
|
|
66
|
+
"@dxos/log": "0.7.0",
|
|
67
|
+
"@dxos/messaging": "0.7.0",
|
|
68
|
+
"@dxos/network-manager": "0.7.0",
|
|
69
|
+
"@dxos/node-std": "0.7.0",
|
|
70
|
+
"@dxos/protocols": "0.7.0",
|
|
71
|
+
"@dxos/random-access-storage": "0.7.0",
|
|
72
|
+
"@dxos/rpc": "0.7.0",
|
|
73
|
+
"@dxos/teleport-extension-gossip": "0.7.0",
|
|
74
|
+
"@dxos/teleport-extension-object-sync": "0.7.0",
|
|
75
|
+
"@dxos/teleport": "0.7.0",
|
|
76
|
+
"@dxos/timeframe": "0.7.0",
|
|
77
|
+
"@dxos/util": "0.7.0",
|
|
78
|
+
"@dxos/tracing": "0.7.0",
|
|
79
|
+
"@dxos/websocket-rpc": "0.7.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/platform": "^1.3.4",
|
|
83
83
|
"@types/readable-stream": "^2.3.9",
|
|
84
84
|
"get-port-please": "^3.1.1",
|
|
85
|
-
"@dxos/signal": "0.
|
|
86
|
-
"@dxos/test-utils": "0.
|
|
85
|
+
"@dxos/signal": "0.7.0",
|
|
86
|
+
"@dxos/test-utils": "0.7.0"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { EventSubscriptions } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf';
|
|
7
|
+
import { type EdgeConnection } from '@dxos/edge-client';
|
|
7
8
|
import { invariant } from '@dxos/invariant';
|
|
8
9
|
import {
|
|
9
10
|
Device,
|
|
@@ -16,7 +17,10 @@ import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/cred
|
|
|
16
17
|
import { type IdentityManager } from '../identity';
|
|
17
18
|
|
|
18
19
|
export class DevicesServiceImpl implements DevicesService {
|
|
19
|
-
constructor(
|
|
20
|
+
constructor(
|
|
21
|
+
private readonly _identityManager: IdentityManager,
|
|
22
|
+
private readonly _edgeConnection?: EdgeConnection,
|
|
23
|
+
) {}
|
|
20
24
|
|
|
21
25
|
async updateDevice(profile: DeviceProfileDocument): Promise<Device> {
|
|
22
26
|
return this._identityManager.updateDeviceProfile(profile);
|
|
@@ -34,17 +38,24 @@ export class DevicesServiceImpl implements DevicesService {
|
|
|
34
38
|
next({
|
|
35
39
|
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
36
40
|
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
37
|
-
|
|
41
|
+
let presence;
|
|
42
|
+
if (isMe) {
|
|
43
|
+
presence = Device.PresenceState.ONLINE;
|
|
44
|
+
} else if (profile.os?.toUpperCase() === 'EDGE') {
|
|
45
|
+
presence = this._edgeConnection?.isConnected
|
|
46
|
+
? Device.PresenceState.ONLINE
|
|
47
|
+
: Device.PresenceState.OFFLINE;
|
|
48
|
+
} else {
|
|
49
|
+
presence = peers.some((peer) => peer.identityKey.equals(key))
|
|
50
|
+
? Device.PresenceState.ONLINE
|
|
51
|
+
: Device.PresenceState.OFFLINE;
|
|
52
|
+
}
|
|
38
53
|
|
|
39
54
|
return {
|
|
40
55
|
deviceKey: key,
|
|
41
56
|
kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind.CURRENT : DeviceKind.TRUSTED,
|
|
42
57
|
profile,
|
|
43
|
-
presence
|
|
44
|
-
? Device.PresenceState.ONLINE
|
|
45
|
-
: peerState
|
|
46
|
-
? Device.PresenceState.ONLINE
|
|
47
|
-
: Device.PresenceState.OFFLINE,
|
|
58
|
+
presence,
|
|
48
59
|
};
|
|
49
60
|
}),
|
|
50
61
|
});
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { onTestFinished, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { Event } from '@dxos/async';
|
|
8
7
|
import { Context } from '@dxos/context';
|
|
9
8
|
import { CredentialGenerator, verifyCredential } from '@dxos/credentials';
|
|
10
9
|
import {
|
|
@@ -108,13 +107,24 @@ describe('identity/identity', () => {
|
|
|
108
107
|
|
|
109
108
|
test('edge feed replicator', async () => {
|
|
110
109
|
let replicationStarted = false;
|
|
111
|
-
|
|
110
|
+
let isConnected = false;
|
|
111
|
+
const listeners: Array<() => void> = [];
|
|
112
112
|
const setup = await setupIdentity({
|
|
113
113
|
edgeConnection: {
|
|
114
|
-
|
|
114
|
+
onReconnected: (listener) => {
|
|
115
|
+
if (isConnected) {
|
|
116
|
+
listener();
|
|
117
|
+
} else {
|
|
118
|
+
listeners.push(listener);
|
|
119
|
+
}
|
|
120
|
+
return () => {};
|
|
121
|
+
},
|
|
122
|
+
get isConnected() {
|
|
123
|
+
return isConnected;
|
|
124
|
+
},
|
|
115
125
|
open: async () => {},
|
|
116
126
|
close: async () => {},
|
|
117
|
-
|
|
127
|
+
onMessage: (_: MessageListener): (() => void) => {
|
|
118
128
|
return () => {};
|
|
119
129
|
},
|
|
120
130
|
send: async (_) => {
|
|
@@ -124,7 +134,8 @@ describe('identity/identity', () => {
|
|
|
124
134
|
});
|
|
125
135
|
|
|
126
136
|
await writeGenesisCredential(setup);
|
|
127
|
-
|
|
137
|
+
listeners.forEach((callback) => callback());
|
|
138
|
+
isConnected = true;
|
|
128
139
|
|
|
129
140
|
await expect.poll(() => replicationStarted).toBeTruthy();
|
|
130
141
|
});
|
|
@@ -32,6 +32,7 @@ export interface EdgeInvitationHandlerCallbacks {
|
|
|
32
32
|
onInvitationSuccess(response: AdmissionResponse, request: AdmissionRequest): Promise<void>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export const MAX_RETRIES_PER_INVITATION = 5;
|
|
35
36
|
export const DEFAULT_REQUEST_RETRY_INTERVAL_MS = 3000;
|
|
36
37
|
export const DEFAULT_REQUEST_RETRY_JITTER_MS = 500;
|
|
37
38
|
|
|
@@ -85,7 +86,9 @@ export class EdgeInvitationHandler implements FlowLockHolder {
|
|
|
85
86
|
this._flowLock = undefined;
|
|
86
87
|
});
|
|
87
88
|
|
|
89
|
+
let requestCount = 0;
|
|
88
90
|
const tryHandleInvitation = async () => {
|
|
91
|
+
requestCount++;
|
|
89
92
|
const admissionRequest = await protocol.createAdmissionRequest(deviceProfile);
|
|
90
93
|
if (admissionRequest.space) {
|
|
91
94
|
try {
|
|
@@ -97,10 +100,10 @@ export class EdgeInvitationHandler implements FlowLockHolder {
|
|
|
97
100
|
retryable: error.isRetryable,
|
|
98
101
|
after: error.retryAfterMs ?? this._calculateNextRetryMs(),
|
|
99
102
|
});
|
|
100
|
-
if (error.isRetryable) {
|
|
103
|
+
if (error.isRetryable && requestCount < MAX_RETRIES_PER_INVITATION) {
|
|
101
104
|
scheduleTask(ctx, tryHandleInvitation, error.retryAfterMs ?? this._calculateNextRetryMs());
|
|
102
105
|
}
|
|
103
|
-
} else {
|
|
106
|
+
} else if (requestCount < MAX_RETRIES_PER_INVITATION) {
|
|
104
107
|
log.info('failed to handle invitation with edge', { error });
|
|
105
108
|
scheduleTask(ctx, tryHandleInvitation, this._calculateNextRetryMs());
|
|
106
109
|
}
|
|
@@ -119,7 +122,7 @@ export class EdgeInvitationHandler implements FlowLockHolder {
|
|
|
119
122
|
try {
|
|
120
123
|
log('edge invitation flow');
|
|
121
124
|
this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
|
|
122
|
-
log('edge invitation flow acquired the lock');
|
|
125
|
+
log.verbose('edge invitation flow acquired the lock');
|
|
123
126
|
|
|
124
127
|
guardedState.set(this, Invitation.State.CONNECTING);
|
|
125
128
|
|
|
@@ -86,16 +86,16 @@ export class InvitationGuestExtension
|
|
|
86
86
|
await super.onOpen(context);
|
|
87
87
|
|
|
88
88
|
try {
|
|
89
|
-
log('guest acquire lock');
|
|
89
|
+
log.verbose('guest acquire lock');
|
|
90
90
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
91
|
-
log('guest lock acquired');
|
|
91
|
+
log.verbose('guest lock acquired');
|
|
92
92
|
await cancelWithContext(
|
|
93
93
|
this._ctx,
|
|
94
94
|
this.rpc.InvitationHostService.options({ role: InvitationOptions.Role.GUEST }),
|
|
95
95
|
);
|
|
96
|
-
log('options sent');
|
|
96
|
+
log.verbose('options sent');
|
|
97
97
|
await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
|
|
98
|
-
log('options received');
|
|
98
|
+
log.verbose('options received');
|
|
99
99
|
if (this._remoteOptions?.role !== InvitationOptions.Role.HOST) {
|
|
100
100
|
throw new InvalidInvitationExtensionRoleError(undefined, {
|
|
101
101
|
expected: InvitationOptions.Role.HOST,
|
|
@@ -128,7 +128,7 @@ export class InvitationGuestExtension
|
|
|
128
128
|
if (this._invitationFlowLock != null) {
|
|
129
129
|
this._invitationFlowLock.release();
|
|
130
130
|
this._invitationFlowLock = null;
|
|
131
|
-
log('invitation flow lock released');
|
|
131
|
+
log.verbose('invitation flow lock released');
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|