@dxos/client-services 0.5.8-main.f69e6e4 → 0.5.8-next.4b7fabd
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-BHK4D7JV.mjs → chunk-ACQUT3OK.mjs} +27 -34
- package/dist/lib/browser/chunk-ACQUT3OK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -4
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-PIZD2NZ4.cjs → chunk-IBTSMFQY.cjs} +27 -34
- package/dist/lib/node/chunk-IBTSMFQY.cjs.map +7 -0
- package/dist/lib/node/index.cjs +44 -44
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +10 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/network.d.ts +4 -4
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +2 -2
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +5 -4
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +0 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +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 +3 -3
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/devtools/network.ts +4 -4
- package/src/packlets/identity/identity-manager.test.ts +2 -2
- package/src/packlets/identity/identity.test.ts +4 -8
- package/src/packlets/invitations/invitations-handler.ts +2 -2
- package/src/packlets/network/network-service.ts +2 -2
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +7 -6
- package/src/packlets/spaces/data-space.ts +1 -11
- package/src/packlets/spaces/spaces-service.ts +0 -1
- package/src/packlets/testing/test-builder.ts +4 -4
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-BHK4D7JV.mjs.map +0 -7
- package/dist/lib/node/chunk-PIZD2NZ4.cjs.map +0 -7
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
InvitationsManager,
|
|
8
8
|
ServiceContext,
|
|
9
9
|
SpaceInvitationProtocol
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-ACQUT3OK.mjs";
|
|
11
11
|
|
|
12
12
|
// packages/sdk/client-services/src/packlets/testing/credential-utils.ts
|
|
13
13
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -224,7 +224,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
|
224
224
|
import { Keyring } from "@dxos/keyring";
|
|
225
225
|
import { createTestLevel } from "@dxos/kv-store/testing";
|
|
226
226
|
import { MemorySignalManager, MemorySignalManagerContext } from "@dxos/messaging";
|
|
227
|
-
import { MemoryTransportFactory,
|
|
227
|
+
import { MemoryTransportFactory, NetworkManager } from "@dxos/network-manager";
|
|
228
228
|
import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
229
229
|
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
230
230
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
@@ -239,7 +239,7 @@ var createServiceContext = async ({ signalContext = new MemorySignalManagerConte
|
|
|
239
239
|
type: StorageType.RAM
|
|
240
240
|
}) } = {}) => {
|
|
241
241
|
const signalManager = new MemorySignalManager(signalContext);
|
|
242
|
-
const networkManager = new
|
|
242
|
+
const networkManager = new NetworkManager({
|
|
243
243
|
signalManager,
|
|
244
244
|
transportFactory: MemoryTransportFactory
|
|
245
245
|
});
|
|
@@ -322,7 +322,7 @@ var TestPeer = class {
|
|
|
322
322
|
return this._props.snapshotStore ??= new SnapshotStore(this.storage.createDirectory("snapshots"));
|
|
323
323
|
}
|
|
324
324
|
get networkManager() {
|
|
325
|
-
return this._props.networkManager ??= new
|
|
325
|
+
return this._props.networkManager ??= new NetworkManager({
|
|
326
326
|
signalManager: new MemorySignalManager(this.signalContext),
|
|
327
327
|
transportFactory: MemoryTransportFactory
|
|
328
328
|
});
|
|
@@ -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\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\nconst 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\nconst 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 } from '@dxos/echo-db';\nimport { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } 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 } 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 } from '../services';\nimport { DataSpaceManager, 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 signalContext = new MemorySignalManagerContext(),\n storage = createStorage({ type: StorageType.RAM }),\n}: {\n signalContext?: MemorySignalManagerContext;\n storage?: Storage;\n} = {}) => {\n const signalManager = new MemorySignalManager(signalContext);\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, {\n invitationConnectionDefaultParams: { controlHeartbeatInterval: 200 },\n });\n};\n\nexport const createPeers = async (numPeers: number) => {\n const signalContext = new MemorySignalManagerContext();\n\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = await createServiceContext({ signalContext });\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};\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 snapshotStore?: SnapshotStore;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\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 snapshotStore() {\n return (this._props.snapshotStore ??= new SnapshotStore(this.storage.createDirectory('snapshots')));\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 snapshotStore: this.snapshotStore,\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({\n kv: this.level,\n storage: this.storage,\n }));\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n this.keyring,\n this.identity,\n this.feedStore,\n this.echoHost,\n this.invitationsManager,\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 }\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;AAmCO,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,Q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AwBC,
|
|
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", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "deviceProfile", "join", "Context", "createCredentialSignerWithChain", "CredentialGenerator", "failUndefined", "EchoHost", "MetadataStore", "SnapshotStore", "SpaceManager", "valueEncoding", "FeedFactory", "FeedStore", "Keyring", "createTestLevel", "MemorySignalManager", "MemorySignalManagerContext", "MemoryTransportFactory", "
|
|
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\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\nconst 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\nconst 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 } from '@dxos/echo-db';\nimport { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } 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 } from '@dxos/messaging';\nimport { MemoryTransportFactory, NetworkManager } 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 } from '../services';\nimport { DataSpaceManager, 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 signalContext = new MemorySignalManagerContext(),\n storage = createStorage({ type: StorageType.RAM }),\n}: {\n signalContext?: MemorySignalManagerContext;\n storage?: Storage;\n} = {}) => {\n const signalManager = new MemorySignalManager(signalContext);\n const networkManager = new NetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n const level = createTestLevel();\n await level.open();\n\n return new ServiceContext(storage, level, networkManager, signalManager, {\n invitationConnectionDefaultParams: { controlHeartbeatInterval: 200 },\n });\n};\n\nexport const createPeers = async (numPeers: number) => {\n const signalContext = new MemorySignalManagerContext();\n\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = await createServiceContext({ signalContext });\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};\n\nexport type TestPeerProps = {\n storage?: Storage;\n level?: LevelDB;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: NetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n snapshotStore?: SnapshotStore;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\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 snapshotStore() {\n return (this._props.snapshotStore ??= new SnapshotStore(this.storage.createDirectory('snapshots')));\n }\n\n get networkManager() {\n return (this._props.networkManager ??= new NetworkManager({\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 snapshotStore: this.snapshotStore,\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({\n kv: this.level,\n storage: this.storage,\n }));\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n this.keyring,\n this.identity,\n this.feedStore,\n this.echoHost,\n this.invitationsManager,\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 }\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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S8B,WAAWM,QAAQ;MAC7G,OAAO;AACL,cAAM,IAAIC,MAAM,iBAAA;MAClB;IACF,GACA,KAAK1B,aAAa;EAEtB;EAEA,MAAMzB,iBAAiB;AACrB,SAAKY,OAAOsB,mBAAmB,MAAMkB,qBAAqB,KAAKtC,OAAO;EACxE;EAEA,MAAMP,UAAU;AACd,UAAM,KAAKtB,MAAMoE,MAAK;AACtB,UAAM,KAAK3E,QAAQ4E,MAAK;EAC1B;AACF;AAEO,IAAMF,uBAAuB,OAAOtC,YAAAA;AACzC,QAAMyC,cAAc,MAAMzC,QAAQ0C,UAAS;AAC3C,QAAMC,YAAY,MAAM3C,QAAQ0C,UAAS;AAEzC,SAAO;IACLD;IACAE;IACAC,kBAAkBC,gCAChB7C,SACA;MACE8C,YAAY,MAAM,IAAIC,oBAAoB/C,SAASyC,aAAaE,SAAAA,EAAWK,0BAA0BL,SAAAA;IACvG,GACAA,SAAAA;IAEFM,kBAAkB,YAAA;IAAa;IAC/BC,YAAY,MAAMC;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", "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", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "deviceProfile", "join", "Context", "createCredentialSignerWithChain", "CredentialGenerator", "failUndefined", "EchoHost", "MetadataStore", "SnapshotStore", "SpaceManager", "valueEncoding", "FeedFactory", "FeedStore", "Keyring", "createTestLevel", "MemorySignalManager", "MemorySignalManagerContext", "MemoryTransportFactory", "NetworkManager", "Invitation", "createStorage", "StorageType", "BlobStore", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "networkManager", "NetworkManager", "level", "createTestLevel", "open", "ServiceContext", "invitationConnectionDefaultParams", "controlHeartbeatInterval", "createPeers", "numPeers", "Promise", "all", "Array", "from", "map", "peer", "Context", "createIdentity", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "opts", "dataStore", "_props", "props", "keyring", "Keyring", "createDirectory", "feedStore", "FeedStore", "factory", "FeedFactory", "root", "signer", "hypercore", "valueEncoding", "metadataStore", "MetadataStore", "blobStore", "BlobStore", "snapshotStore", "SnapshotStore", "spaceManager", "SpaceManager", "identity", "signingContext", "failUndefined", "echoHost", "EchoHost", "kv", "dataSpaceManager", "DataSpaceManager", "invitationsManager", "InvitationsManager", "InvitationsHandler", "invitation", "kind", "Invitation", "Kind", "SPACE", "SpaceInvitationProtocol", "spaceKey", "Error", "createSigningContext", "close", "reset", "identityKey", "createKey", "deviceKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile", "undefined"]
|
|
7
7
|
}
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_IBTSMFQY_exports = {};
|
|
30
|
+
__export(chunk_IBTSMFQY_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -67,7 +67,7 @@ __export(chunk_PIZD2NZ4_exports, {
|
|
|
67
67
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
68
68
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
69
69
|
});
|
|
70
|
-
module.exports = __toCommonJS(
|
|
70
|
+
module.exports = __toCommonJS(chunk_IBTSMFQY_exports);
|
|
71
71
|
var import_async = require("@dxos/async");
|
|
72
72
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
73
73
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -3776,14 +3776,11 @@ var DataSpace = class {
|
|
|
3776
3776
|
state: import_services9.SpaceState[this._state]
|
|
3777
3777
|
}, {
|
|
3778
3778
|
F: __dxlog_file13,
|
|
3779
|
-
L:
|
|
3779
|
+
L: 141,
|
|
3780
3780
|
S: this,
|
|
3781
3781
|
C: (f, a) => f(...a)
|
|
3782
3782
|
});
|
|
3783
3783
|
}
|
|
3784
|
-
get id() {
|
|
3785
|
-
return this._inner.id;
|
|
3786
|
-
}
|
|
3787
3784
|
get key() {
|
|
3788
3785
|
return this._inner.key;
|
|
3789
3786
|
}
|
|
@@ -3829,7 +3826,7 @@ var DataSpace = class {
|
|
|
3829
3826
|
state: import_services9.SpaceState[this._state]
|
|
3830
3827
|
}, {
|
|
3831
3828
|
F: __dxlog_file13,
|
|
3832
|
-
L:
|
|
3829
|
+
L: 199,
|
|
3833
3830
|
S: this,
|
|
3834
3831
|
C: (f, a) => f(...a)
|
|
3835
3832
|
});
|
|
@@ -3847,7 +3844,7 @@ var DataSpace = class {
|
|
|
3847
3844
|
state: import_services9.SpaceState[this._state]
|
|
3848
3845
|
}, {
|
|
3849
3846
|
F: __dxlog_file13,
|
|
3850
|
-
L:
|
|
3847
|
+
L: 213,
|
|
3851
3848
|
S: this,
|
|
3852
3849
|
C: (f, a) => f(...a)
|
|
3853
3850
|
});
|
|
@@ -3879,7 +3876,7 @@ var DataSpace = class {
|
|
|
3879
3876
|
if (err instanceof import_protocols8.CancelledError || err instanceof import_context9.ContextDisposedError) {
|
|
3880
3877
|
(0, import_log10.log)("data pipeline initialization cancelled", err, {
|
|
3881
3878
|
F: __dxlog_file13,
|
|
3882
|
-
L:
|
|
3879
|
+
L: 246,
|
|
3883
3880
|
S: this,
|
|
3884
3881
|
C: (f, a) => f(...a)
|
|
3885
3882
|
});
|
|
@@ -3887,7 +3884,7 @@ var DataSpace = class {
|
|
|
3887
3884
|
}
|
|
3888
3885
|
import_log10.log.error("Error initializing data pipeline", err, {
|
|
3889
3886
|
F: __dxlog_file13,
|
|
3890
|
-
L:
|
|
3887
|
+
L: 250,
|
|
3891
3888
|
S: this,
|
|
3892
3889
|
C: (f, a) => f(...a)
|
|
3893
3890
|
});
|
|
@@ -3896,7 +3893,7 @@ var DataSpace = class {
|
|
|
3896
3893
|
state: import_services9.SpaceState[this._state]
|
|
3897
3894
|
}, {
|
|
3898
3895
|
F: __dxlog_file13,
|
|
3899
|
-
L:
|
|
3896
|
+
L: 252,
|
|
3900
3897
|
S: this,
|
|
3901
3898
|
C: (f, a) => f(...a)
|
|
3902
3899
|
});
|
|
@@ -3916,7 +3913,7 @@ var DataSpace = class {
|
|
|
3916
3913
|
state: import_services9.SpaceState[this._state]
|
|
3917
3914
|
}, {
|
|
3918
3915
|
F: __dxlog_file13,
|
|
3919
|
-
L:
|
|
3916
|
+
L: 268,
|
|
3920
3917
|
S: this,
|
|
3921
3918
|
C: (f, a) => f(...a)
|
|
3922
3919
|
});
|
|
@@ -3926,7 +3923,7 @@ var DataSpace = class {
|
|
|
3926
3923
|
await (0, import_context9.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3927
3924
|
(0, import_log10.log)("data pipeline ready", void 0, {
|
|
3928
3925
|
F: __dxlog_file13,
|
|
3929
|
-
L:
|
|
3926
|
+
L: 280,
|
|
3930
3927
|
S: this,
|
|
3931
3928
|
C: (f, a) => f(...a)
|
|
3932
3929
|
});
|
|
@@ -3936,7 +3933,7 @@ var DataSpace = class {
|
|
|
3936
3933
|
state: import_services9.SpaceState[this._state]
|
|
3937
3934
|
}, {
|
|
3938
3935
|
F: __dxlog_file13,
|
|
3939
|
-
L:
|
|
3936
|
+
L: 284,
|
|
3940
3937
|
S: this,
|
|
3941
3938
|
C: (f, a) => f(...a)
|
|
3942
3939
|
});
|
|
@@ -3952,7 +3949,7 @@ var DataSpace = class {
|
|
|
3952
3949
|
await this._createWritableFeeds();
|
|
3953
3950
|
(0, import_log10.log)("writable feeds created", void 0, {
|
|
3954
3951
|
F: __dxlog_file13,
|
|
3955
|
-
L:
|
|
3952
|
+
L: 300,
|
|
3956
3953
|
S: this,
|
|
3957
3954
|
C: (f, a) => f(...a)
|
|
3958
3955
|
});
|
|
@@ -4015,7 +4012,7 @@ var DataSpace = class {
|
|
|
4015
4012
|
rootUrl
|
|
4016
4013
|
}, {
|
|
4017
4014
|
F: __dxlog_file13,
|
|
4018
|
-
L:
|
|
4015
|
+
L: 366,
|
|
4019
4016
|
S: this,
|
|
4020
4017
|
C: (f, a) => f(...a)
|
|
4021
4018
|
});
|
|
@@ -4045,7 +4042,7 @@ var DataSpace = class {
|
|
|
4045
4042
|
rootUrl
|
|
4046
4043
|
}, {
|
|
4047
4044
|
F: __dxlog_file13,
|
|
4048
|
-
L:
|
|
4045
|
+
L: 393,
|
|
4049
4046
|
S: this,
|
|
4050
4047
|
C: (f, a) => f(...a)
|
|
4051
4048
|
});
|
|
@@ -4060,7 +4057,7 @@ var DataSpace = class {
|
|
|
4060
4057
|
err
|
|
4061
4058
|
}, {
|
|
4062
4059
|
F: __dxlog_file13,
|
|
4063
|
-
L:
|
|
4060
|
+
L: 399,
|
|
4064
4061
|
S: this,
|
|
4065
4062
|
C: (f, a) => f(...a)
|
|
4066
4063
|
});
|
|
@@ -4115,7 +4112,7 @@ var DataSpace = class {
|
|
|
4115
4112
|
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
4116
4113
|
(0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4117
4114
|
F: __dxlog_file13,
|
|
4118
|
-
L:
|
|
4115
|
+
L: 449,
|
|
4119
4116
|
S: this,
|
|
4120
4117
|
A: [
|
|
4121
4118
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4134,7 +4131,7 @@ var DataSpace = class {
|
|
|
4134
4131
|
{
|
|
4135
4132
|
import_log10.log.info("Fragmenting", void 0, {
|
|
4136
4133
|
F: __dxlog_file13,
|
|
4137
|
-
L:
|
|
4134
|
+
L: 461,
|
|
4138
4135
|
S: this,
|
|
4139
4136
|
C: (f, a) => f(...a)
|
|
4140
4137
|
});
|
|
@@ -4146,7 +4143,7 @@ var DataSpace = class {
|
|
|
4146
4143
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4147
4144
|
(0, import_invariant11.invariant)(properties, "Properties not found", {
|
|
4148
4145
|
F: __dxlog_file13,
|
|
4149
|
-
L:
|
|
4146
|
+
L: 471,
|
|
4150
4147
|
S: this,
|
|
4151
4148
|
A: [
|
|
4152
4149
|
"properties",
|
|
@@ -4162,14 +4159,14 @@ var DataSpace = class {
|
|
|
4162
4159
|
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4163
4160
|
(0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4164
4161
|
F: __dxlog_file13,
|
|
4165
|
-
L:
|
|
4162
|
+
L: 476,
|
|
4166
4163
|
S: this,
|
|
4167
4164
|
A: [
|
|
4168
4165
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
4169
4166
|
""
|
|
4170
4167
|
]
|
|
4171
4168
|
});
|
|
4172
|
-
const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(
|
|
4169
|
+
const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
|
|
4173
4170
|
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
4174
4171
|
rootUrl: newRoot.url
|
|
4175
4172
|
});
|
|
@@ -4231,7 +4228,7 @@ var DataSpace = class {
|
|
|
4231
4228
|
state: import_services9.SpaceState[this._state]
|
|
4232
4229
|
}, {
|
|
4233
4230
|
F: __dxlog_file13,
|
|
4234
|
-
L:
|
|
4231
|
+
L: 542,
|
|
4235
4232
|
S: this,
|
|
4236
4233
|
C: (f, a) => f(...a)
|
|
4237
4234
|
});
|
|
@@ -4241,9 +4238,6 @@ var DataSpace = class {
|
|
|
4241
4238
|
_ts_decorate4([
|
|
4242
4239
|
import_tracing4.trace.info()
|
|
4243
4240
|
], DataSpace.prototype, "_inner", void 0);
|
|
4244
|
-
_ts_decorate4([
|
|
4245
|
-
import_tracing4.trace.info()
|
|
4246
|
-
], DataSpace.prototype, "id", null);
|
|
4247
4241
|
_ts_decorate4([
|
|
4248
4242
|
import_tracing4.trace.info()
|
|
4249
4243
|
], DataSpace.prototype, "key", null);
|
|
@@ -5023,7 +5017,6 @@ var SpacesServiceImpl = class {
|
|
|
5023
5017
|
}
|
|
5024
5018
|
_serializeSpace(space) {
|
|
5025
5019
|
return {
|
|
5026
|
-
id: space.id,
|
|
5027
5020
|
spaceKey: space.key,
|
|
5028
5021
|
state: space.state,
|
|
5029
5022
|
error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
|
|
@@ -5369,7 +5362,7 @@ var ServiceRegistry = class {
|
|
|
5369
5362
|
delete this._handlers[name];
|
|
5370
5363
|
}
|
|
5371
5364
|
};
|
|
5372
|
-
var DXOS_VERSION = "0.5.8-
|
|
5365
|
+
var DXOS_VERSION = "0.5.8-next.4b7fabd";
|
|
5373
5366
|
var getPlatform = () => {
|
|
5374
5367
|
if (process.browser) {
|
|
5375
5368
|
if (typeof window !== "undefined") {
|
|
@@ -6062,7 +6055,7 @@ var ClientServicesHost = class {
|
|
|
6062
6055
|
"'network manager already set'"
|
|
6063
6056
|
]
|
|
6064
6057
|
});
|
|
6065
|
-
this._networkManager = new import_network_manager2.
|
|
6058
|
+
this._networkManager = new import_network_manager2.NetworkManager({
|
|
6066
6059
|
log: connectionLog,
|
|
6067
6060
|
transportFactory,
|
|
6068
6061
|
signalManager
|
|
@@ -6273,11 +6266,11 @@ var ClientServicesHost = class {
|
|
|
6273
6266
|
""
|
|
6274
6267
|
]
|
|
6275
6268
|
});
|
|
6276
|
-
const document = this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
|
|
6269
|
+
const document = await this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
|
|
6277
6270
|
await document.whenReady();
|
|
6278
6271
|
const properties = {
|
|
6279
6272
|
system: {
|
|
6280
|
-
type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.
|
|
6273
|
+
type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.Properties))
|
|
6281
6274
|
},
|
|
6282
6275
|
data: {
|
|
6283
6276
|
[import_client_protocol5.defaultKey]: identity.identityKey.toHex()
|
|
@@ -6390,4 +6383,4 @@ var findConfigs = () => {
|
|
|
6390
6383
|
subscribeToSpaces,
|
|
6391
6384
|
subscribeToSwarmInfo
|
|
6392
6385
|
});
|
|
6393
|
-
//# sourceMappingURL=chunk-
|
|
6386
|
+
//# sourceMappingURL=chunk-IBTSMFQY.cjs.map
|