@dxos/client-services 0.5.1-next.7f021b8 → 0.5.1-next.823fe3b
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-FKKPCNDO.mjs → chunk-CTZOR673.mjs} +57 -57
- package/dist/lib/browser/{chunk-FKKPCNDO.mjs.map → chunk-CTZOR673.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +2 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-Q6Z4BMTZ.cjs → chunk-SPPPL3BF.cjs} +61 -61
- package/dist/lib/node/chunk-SPPPL3BF.cjs.map +7 -0
- package/dist/lib/node/index.cjs +43 -43
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +9 -9
- package/dist/lib/node/packlets/testing/index.cjs.map +2 -2
- package/dist/types/src/packlets/services/service-context.d.ts +3 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +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.map +1 -1
- package/dist/types/src/packlets/storage/level.d.ts +1 -2
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +2 -1
- 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 -35
- package/src/packlets/services/automerge-host.test.ts +3 -1
- package/src/packlets/services/service-context.ts +2 -3
- package/src/packlets/services/service-host.ts +3 -4
- package/src/packlets/spaces/data-space.ts +2 -1
- package/src/packlets/storage/level.ts +2 -2
- package/src/packlets/testing/test-builder.ts +3 -2
- package/src/version.ts +1 -1
- package/dist/lib/node/chunk-Q6Z4BMTZ.cjs.map +0 -7
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
InvitationsManager,
|
|
8
8
|
ServiceContext,
|
|
9
9
|
SpaceInvitationProtocol
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-CTZOR673.mjs";
|
|
11
11
|
|
|
12
12
|
// packages/sdk/client-services/src/packlets/testing/credential-utils.ts
|
|
13
13
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -204,9 +204,9 @@ import { createCredentialSignerWithChain, CredentialGenerator } from "@dxos/cred
|
|
|
204
204
|
import { failUndefined } from "@dxos/debug";
|
|
205
205
|
import { EchoHost } from "@dxos/echo-db";
|
|
206
206
|
import { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
|
|
207
|
-
import { createTestLevel } from "@dxos/echo-pipeline/testing";
|
|
208
207
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
209
208
|
import { Keyring } from "@dxos/keyring";
|
|
209
|
+
import { createTestLevel } from "@dxos/kv-store/testing";
|
|
210
210
|
import { MemorySignalManager, MemorySignalManagerContext } from "@dxos/messaging";
|
|
211
211
|
import { MemoryTransportFactory, NetworkManager } from "@dxos/network-manager";
|
|
212
212
|
import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -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};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\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 (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 await guestObservable.authenticate(await authCode.wait());\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 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 const guestHandler = guest.getInvitationHandler({ kind: invitation.kind });\n return guest.invitations.acceptInvitation(guestHandler, invitation, guestDeviceProfile);\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, type LevelDB, SnapshotStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';\nimport { createTestLevel } from '@dxos/echo-pipeline/testing';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\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};\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,iBAAiB;AAC1B,SAASC,kBAAkB;;AAQpB,IAAMC,qBAAqB,CAACC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AC/C;QACF;QAEA,KAAKE,WAAWC,MAAMsB,SAAS;AAC7B,cAAInC,OAAOH,MAAMuC,YAAY5B,cAAAA,GAAiB;AAC5C;UACF;AACAN,uBAAa8B,KAAK;YAAExC,YAAYkB;UAAe,CAAA;AAC/C;QACF;MACF;IACF,GACA,CAAC2B,UAAAA;AACC,UAAIrC,OAAOH,MAAMyC,UAAU9B,cAAAA,GAAiB;AAC1C;MACF;AACAN,mBAAa8B,KAAK;QAAEK;MAAM,CAAA;IAC5B,CAAA;EAEJ,CAAA;AAEA,SAAO;IAACnC,aAAayB,KAAI;IAAIvB,cAAcuB,KAAI;;AACjD;AAEA,IAAMrB,mBAAmB,OACvBT,MACAE,YAAAA;AAEAA,cAAY;IACVwC,YAAY3B,WAAW4B,WAAWC;IAClC,GAAI1C,WAAW,CAAC;EAClB;AAEA,MAAIF,gBAAgB6C,gBAAgB;AAClC,WAAO7C,KAAK8C,mBAAmBrC,iBAAiB;MAC9CsC,MAAMhC,WAAWiC,KAAKC;MACtB,GAAG/C;IACL,CAAA;EACF;AAEA,SAAOF,KAAKkD,MAAMhD,OAAAA;AACpB;AAEA,IAAMkB,mBAAmB,CACvBnB,OACAN,YACAS,uBAAAA;AAEAT,eAAaD,mBAAmBC,UAAAA;AAEhC,MAAIM,iBAAiB4C,gBAAgB;AACnC,UAAMM,eAAelD,MAAMmD,qBAAqB;MAAEL,MAAMpD,WAAWoD;IAAK,CAAA;AACxE,WAAO9C,MAAMoD,YAAYjC,iBAAiB+B,cAAcxD,YAAYS,kBAAAA;EACtE;AAEA,SAAOH,MAAMqD,KAAK3D,YAAYS,kBAAAA;AAChC;;;AC1NA,SAASmD,eAAe;AACxB,SAASC,iCAAiCC,2BAA2B;AACrE,SAASC,qBAAqB;AAC9B,SAASC,gBAAgB;AACzB,SAASC,
|
|
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", "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", "authenticate", "wait", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "guestHandler", "getInvitationHandler", "invitations", "join", "Context", "createCredentialSignerWithChain", "CredentialGenerator", "failUndefined", "EchoHost", "MetadataStore", "SnapshotStore", "SpaceManager", "valueEncoding", "
|
|
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};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\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 (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 await guestObservable.authenticate(await authCode.wait());\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 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 const guestHandler = guest.getInvitationHandler({ kind: invitation.kind });\n return guest.invitations.acceptInvitation(guestHandler, invitation, guestDeviceProfile);\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};\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,iBAAiB;AAC1B,SAASC,kBAAkB;;AAQpB,IAAMC,qBAAqB,CAACC,eAAAA;AACjC,SAAOC,kBAAkBC,OAAOD,kBAAkBE,OAAOH,UAAAA,CAAAA;AAC3D;AAkCO,IAAMI,oBAAoB,CAAC,EAChCC,MACAC,OACAC,SACAC,OACAC,mBAAkB,MACM;AACxB,QAAMC,eAAe,IAAIC,QAAAA;AACzB,QAAMC,gBAAgB,IAAID,QAAAA;AAC1B,QAAME,WAAW,IAAIF,QAAAA;AAErB,OAAKG,iBAAiBT,MAAME,OAAAA,EAASQ,KAAK,CAACC,mBAAAA;AACzCA,mBAAeC,UACb,OAAOC,mBAAAA;AACL,cAAQA,eAAeC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KxB,OAAOwB,aAAa,IAAIC,SAAS;MAC5CC,IAAI,KAAKnD;MACTP,SAAS,KAAKA;IAChB,CAAA;EACF;EAEA,IAAI2D,mBAAqC;AACvC,WAAQ,KAAK3B,OAAO2B,qBAAqB,IAAIC,iBAC3C,KAAKT,cACL,KAAKN,eACL,KAAKX,SACL,KAAKmB,UACL,KAAKhB,WACL,KAAKmB,UACL,KAAKK,kBAAkB;EAE3B;EAEA,IAAIA,qBAAqB;AACvB,WAAQ,KAAK7B,OAAO6B,uBAAuB,IAAIC,mBAC7C,IAAIC,mBAAmB,KAAK1D,cAAc,GAC1C,CAAC2D,eAAAA;AACC,UAAIA,WAAWC,SAASC,YAAWC,KAAKC,OAAO;AAC7C,eAAO,IAAIC,wBAAwB,KAAKV,kBAAkB,KAAKN,UAAW,KAAKnB,SAAS8B,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,KAAKpB,MAAMkE,MAAK;AACtB,UAAM,KAAKzE,QAAQ0E,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", "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", "authenticate", "wait", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "wake", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "guestHandler", "getInvitationHandler", "invitations", "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", "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_SPPPL3BF_exports = {};
|
|
30
|
+
__export(chunk_SPPPL3BF_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -66,7 +66,7 @@ __export(chunk_Q6Z4BMTZ_exports, {
|
|
|
66
66
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
67
67
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
68
68
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
69
|
+
module.exports = __toCommonJS(chunk_SPPPL3BF_exports);
|
|
70
70
|
var import_async = require("@dxos/async");
|
|
71
71
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
72
72
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -237,7 +237,7 @@ var import_util8 = require("@dxos/util");
|
|
|
237
237
|
var import_async16 = require("@dxos/async");
|
|
238
238
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
239
239
|
var import_context11 = require("@dxos/context");
|
|
240
|
-
var
|
|
240
|
+
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
241
241
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
242
242
|
var import_invariant15 = require("@dxos/invariant");
|
|
243
243
|
var import_keys12 = require("@dxos/keys");
|
|
@@ -269,9 +269,9 @@ var import_random_access_storage = require("@dxos/random-access-storage");
|
|
|
269
269
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
270
270
|
var import_config3 = require("@dxos/protocols/proto/dxos/config");
|
|
271
271
|
var import_util11 = require("@dxos/util");
|
|
272
|
-
var import_level = require("level");
|
|
273
272
|
var import_node_path = __toESM(require("node:path"));
|
|
274
273
|
var import_keys14 = require("@dxos/keys");
|
|
274
|
+
var import_kv_store = require("@dxos/kv-store");
|
|
275
275
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
276
276
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
277
277
|
var import_util12 = require("@dxos/util");
|
|
@@ -3391,7 +3391,7 @@ var DataSpace = class {
|
|
|
3391
3391
|
state: import_services8.SpaceState[this._state]
|
|
3392
3392
|
}, {
|
|
3393
3393
|
F: __dxlog_file11,
|
|
3394
|
-
L:
|
|
3394
|
+
L: 136,
|
|
3395
3395
|
S: this,
|
|
3396
3396
|
C: (f, a) => f(...a)
|
|
3397
3397
|
});
|
|
@@ -3441,7 +3441,7 @@ var DataSpace = class {
|
|
|
3441
3441
|
state: import_services8.SpaceState[this._state]
|
|
3442
3442
|
}, {
|
|
3443
3443
|
F: __dxlog_file11,
|
|
3444
|
-
L:
|
|
3444
|
+
L: 194,
|
|
3445
3445
|
S: this,
|
|
3446
3446
|
C: (f, a) => f(...a)
|
|
3447
3447
|
});
|
|
@@ -3459,7 +3459,7 @@ var DataSpace = class {
|
|
|
3459
3459
|
state: import_services8.SpaceState[this._state]
|
|
3460
3460
|
}, {
|
|
3461
3461
|
F: __dxlog_file11,
|
|
3462
|
-
L:
|
|
3462
|
+
L: 208,
|
|
3463
3463
|
S: this,
|
|
3464
3464
|
C: (f, a) => f(...a)
|
|
3465
3465
|
});
|
|
@@ -3491,7 +3491,7 @@ var DataSpace = class {
|
|
|
3491
3491
|
if (err instanceof import_protocols7.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3492
3492
|
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3493
3493
|
F: __dxlog_file11,
|
|
3494
|
-
L:
|
|
3494
|
+
L: 241,
|
|
3495
3495
|
S: this,
|
|
3496
3496
|
C: (f, a) => f(...a)
|
|
3497
3497
|
});
|
|
@@ -3499,7 +3499,7 @@ var DataSpace = class {
|
|
|
3499
3499
|
}
|
|
3500
3500
|
import_log8.log.error("Error initializing data pipeline", err, {
|
|
3501
3501
|
F: __dxlog_file11,
|
|
3502
|
-
L:
|
|
3502
|
+
L: 245,
|
|
3503
3503
|
S: this,
|
|
3504
3504
|
C: (f, a) => f(...a)
|
|
3505
3505
|
});
|
|
@@ -3508,7 +3508,7 @@ var DataSpace = class {
|
|
|
3508
3508
|
state: import_services8.SpaceState[this._state]
|
|
3509
3509
|
}, {
|
|
3510
3510
|
F: __dxlog_file11,
|
|
3511
|
-
L:
|
|
3511
|
+
L: 247,
|
|
3512
3512
|
S: this,
|
|
3513
3513
|
C: (f, a) => f(...a)
|
|
3514
3514
|
});
|
|
@@ -3528,7 +3528,7 @@ var DataSpace = class {
|
|
|
3528
3528
|
state: import_services8.SpaceState[this._state]
|
|
3529
3529
|
}, {
|
|
3530
3530
|
F: __dxlog_file11,
|
|
3531
|
-
L:
|
|
3531
|
+
L: 263,
|
|
3532
3532
|
S: this,
|
|
3533
3533
|
C: (f, a) => f(...a)
|
|
3534
3534
|
});
|
|
@@ -3538,7 +3538,7 @@ var DataSpace = class {
|
|
|
3538
3538
|
await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3539
3539
|
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3540
3540
|
F: __dxlog_file11,
|
|
3541
|
-
L:
|
|
3541
|
+
L: 275,
|
|
3542
3542
|
S: this,
|
|
3543
3543
|
C: (f, a) => f(...a)
|
|
3544
3544
|
});
|
|
@@ -3548,7 +3548,7 @@ var DataSpace = class {
|
|
|
3548
3548
|
state: import_services8.SpaceState[this._state]
|
|
3549
3549
|
}, {
|
|
3550
3550
|
F: __dxlog_file11,
|
|
3551
|
-
L:
|
|
3551
|
+
L: 279,
|
|
3552
3552
|
S: this,
|
|
3553
3553
|
C: (f, a) => f(...a)
|
|
3554
3554
|
});
|
|
@@ -3564,7 +3564,7 @@ var DataSpace = class {
|
|
|
3564
3564
|
await this._createWritableFeeds();
|
|
3565
3565
|
(0, import_log8.log)("writable feeds created", void 0, {
|
|
3566
3566
|
F: __dxlog_file11,
|
|
3567
|
-
L:
|
|
3567
|
+
L: 295,
|
|
3568
3568
|
S: this,
|
|
3569
3569
|
C: (f, a) => f(...a)
|
|
3570
3570
|
});
|
|
@@ -3627,7 +3627,7 @@ var DataSpace = class {
|
|
|
3627
3627
|
rootUrl
|
|
3628
3628
|
}, {
|
|
3629
3629
|
F: __dxlog_file11,
|
|
3630
|
-
L:
|
|
3630
|
+
L: 361,
|
|
3631
3631
|
S: this,
|
|
3632
3632
|
C: (f, a) => f(...a)
|
|
3633
3633
|
});
|
|
@@ -3659,7 +3659,7 @@ var DataSpace = class {
|
|
|
3659
3659
|
err
|
|
3660
3660
|
}, {
|
|
3661
3661
|
F: __dxlog_file11,
|
|
3662
|
-
L:
|
|
3662
|
+
L: 384,
|
|
3663
3663
|
S: this,
|
|
3664
3664
|
C: (f, a) => f(...a)
|
|
3665
3665
|
});
|
|
@@ -3714,7 +3714,7 @@ var DataSpace = class {
|
|
|
3714
3714
|
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
3715
3715
|
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3716
3716
|
F: __dxlog_file11,
|
|
3717
|
-
L:
|
|
3717
|
+
L: 434,
|
|
3718
3718
|
S: this,
|
|
3719
3719
|
A: [
|
|
3720
3720
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3733,7 +3733,7 @@ var DataSpace = class {
|
|
|
3733
3733
|
{
|
|
3734
3734
|
import_log8.log.info("Fragmenting", void 0, {
|
|
3735
3735
|
F: __dxlog_file11,
|
|
3736
|
-
L:
|
|
3736
|
+
L: 446,
|
|
3737
3737
|
S: this,
|
|
3738
3738
|
C: (f, a) => f(...a)
|
|
3739
3739
|
});
|
|
@@ -3745,7 +3745,7 @@ var DataSpace = class {
|
|
|
3745
3745
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3746
3746
|
(0, import_invariant9.invariant)(properties, "Properties not found", {
|
|
3747
3747
|
F: __dxlog_file11,
|
|
3748
|
-
L:
|
|
3748
|
+
L: 456,
|
|
3749
3749
|
S: this,
|
|
3750
3750
|
A: [
|
|
3751
3751
|
"properties",
|
|
@@ -3761,7 +3761,7 @@ var DataSpace = class {
|
|
|
3761
3761
|
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
3762
3762
|
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3763
3763
|
F: __dxlog_file11,
|
|
3764
|
-
L:
|
|
3764
|
+
L: 461,
|
|
3765
3765
|
S: this,
|
|
3766
3766
|
A: [
|
|
3767
3767
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3830,7 +3830,7 @@ var DataSpace = class {
|
|
|
3830
3830
|
state: import_services8.SpaceState[this._state]
|
|
3831
3831
|
}, {
|
|
3832
3832
|
F: __dxlog_file11,
|
|
3833
|
-
L:
|
|
3833
|
+
L: 527,
|
|
3834
3834
|
S: this,
|
|
3835
3835
|
C: (f, a) => f(...a)
|
|
3836
3836
|
});
|
|
@@ -4587,7 +4587,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4587
4587
|
await this._checkStorageVersion();
|
|
4588
4588
|
(0, import_log12.log)("opening...", void 0, {
|
|
4589
4589
|
F: __dxlog_file14,
|
|
4590
|
-
L:
|
|
4590
|
+
L: 150,
|
|
4591
4591
|
S: this,
|
|
4592
4592
|
C: (f, a) => f(...a)
|
|
4593
4593
|
});
|
|
@@ -4595,7 +4595,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4595
4595
|
id: this._instanceId
|
|
4596
4596
|
}), {
|
|
4597
4597
|
F: __dxlog_file14,
|
|
4598
|
-
L:
|
|
4598
|
+
L: 151,
|
|
4599
4599
|
S: this,
|
|
4600
4600
|
C: (f, a) => f(...a)
|
|
4601
4601
|
});
|
|
@@ -4613,7 +4613,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4613
4613
|
count: loadedInvitations.invitations?.length
|
|
4614
4614
|
}, {
|
|
4615
4615
|
F: __dxlog_file14,
|
|
4616
|
-
L:
|
|
4616
|
+
L: 164,
|
|
4617
4617
|
S: this,
|
|
4618
4618
|
C: (f, a) => f(...a)
|
|
4619
4619
|
});
|
|
@@ -4621,13 +4621,13 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4621
4621
|
id: this._instanceId
|
|
4622
4622
|
}), {
|
|
4623
4623
|
F: __dxlog_file14,
|
|
4624
|
-
L:
|
|
4624
|
+
L: 166,
|
|
4625
4625
|
S: this,
|
|
4626
4626
|
C: (f, a) => f(...a)
|
|
4627
4627
|
});
|
|
4628
4628
|
(0, import_log12.log)("opened", void 0, {
|
|
4629
4629
|
F: __dxlog_file14,
|
|
4630
|
-
L:
|
|
4630
|
+
L: 167,
|
|
4631
4631
|
S: this,
|
|
4632
4632
|
C: (f, a) => f(...a)
|
|
4633
4633
|
});
|
|
@@ -4635,7 +4635,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4635
4635
|
async _close(ctx) {
|
|
4636
4636
|
(0, import_log12.log)("closing...", void 0, {
|
|
4637
4637
|
F: __dxlog_file14,
|
|
4638
|
-
L:
|
|
4638
|
+
L: 171,
|
|
4639
4639
|
S: this,
|
|
4640
4640
|
C: (f, a) => f(...a)
|
|
4641
4641
|
});
|
|
@@ -4652,7 +4652,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4652
4652
|
await this.signalManager.close();
|
|
4653
4653
|
(0, import_log12.log)("closed", void 0, {
|
|
4654
4654
|
F: __dxlog_file14,
|
|
4655
|
-
L:
|
|
4655
|
+
L: 183,
|
|
4656
4656
|
S: this,
|
|
4657
4657
|
C: (f, a) => f(...a)
|
|
4658
4658
|
});
|
|
@@ -4666,7 +4666,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4666
4666
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4667
4667
|
(0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4668
4668
|
F: __dxlog_file14,
|
|
4669
|
-
L:
|
|
4669
|
+
L: 194,
|
|
4670
4670
|
S: this,
|
|
4671
4671
|
A: [
|
|
4672
4672
|
"factory",
|
|
@@ -4698,7 +4698,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4698
4698
|
async _initialize(ctx) {
|
|
4699
4699
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4700
4700
|
F: __dxlog_file14,
|
|
4701
|
-
L:
|
|
4701
|
+
L: 225,
|
|
4702
4702
|
S: this,
|
|
4703
4703
|
C: (f, a) => f(...a)
|
|
4704
4704
|
});
|
|
@@ -4721,7 +4721,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4721
4721
|
this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
|
|
4722
4722
|
(0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4723
4723
|
F: __dxlog_file14,
|
|
4724
|
-
L:
|
|
4724
|
+
L: 250,
|
|
4725
4725
|
S: this,
|
|
4726
4726
|
A: [
|
|
4727
4727
|
"this.dataSpaceManager",
|
|
@@ -4745,7 +4745,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4745
4745
|
details: assertion
|
|
4746
4746
|
}, {
|
|
4747
4747
|
F: __dxlog_file14,
|
|
4748
|
-
L:
|
|
4748
|
+
L: 266,
|
|
4749
4749
|
S: this,
|
|
4750
4750
|
C: (f, a) => f(...a)
|
|
4751
4751
|
});
|
|
@@ -4756,7 +4756,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4756
4756
|
details: assertion
|
|
4757
4757
|
}, {
|
|
4758
4758
|
F: __dxlog_file14,
|
|
4759
|
-
L:
|
|
4759
|
+
L: 270,
|
|
4760
4760
|
S: this,
|
|
4761
4761
|
C: (f, a) => f(...a)
|
|
4762
4762
|
});
|
|
@@ -4767,7 +4767,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4767
4767
|
details: assertion
|
|
4768
4768
|
}, {
|
|
4769
4769
|
F: __dxlog_file14,
|
|
4770
|
-
L:
|
|
4770
|
+
L: 275,
|
|
4771
4771
|
S: this,
|
|
4772
4772
|
C: (f, a) => f(...a)
|
|
4773
4773
|
});
|
|
@@ -4778,7 +4778,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4778
4778
|
} catch (err) {
|
|
4779
4779
|
import_log12.log.catch(err, void 0, {
|
|
4780
4780
|
F: __dxlog_file14,
|
|
4781
|
-
L:
|
|
4781
|
+
L: 281,
|
|
4782
4782
|
S: this,
|
|
4783
4783
|
C: (f, a) => f(...a)
|
|
4784
4784
|
});
|
|
@@ -4820,7 +4820,7 @@ var ServiceRegistry = class {
|
|
|
4820
4820
|
delete this._handlers[name];
|
|
4821
4821
|
}
|
|
4822
4822
|
};
|
|
4823
|
-
var DXOS_VERSION = "0.5.1-next.
|
|
4823
|
+
var DXOS_VERSION = "0.5.1-next.823fe3b";
|
|
4824
4824
|
var getPlatform = () => {
|
|
4825
4825
|
if (process.browser) {
|
|
4826
4826
|
if (typeof window !== "undefined") {
|
|
@@ -5297,7 +5297,7 @@ var toStorageType = (type) => {
|
|
|
5297
5297
|
var createLevel = async (config) => {
|
|
5298
5298
|
const persistent = isPersistent(config);
|
|
5299
5299
|
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys14.PublicKey.random().toHex()}`;
|
|
5300
|
-
const level =
|
|
5300
|
+
const level = (0, import_kv_store.createLevel)(storagePath);
|
|
5301
5301
|
await level.open();
|
|
5302
5302
|
return level;
|
|
5303
5303
|
};
|
|
@@ -5453,7 +5453,7 @@ var ClientServicesHost = class {
|
|
|
5453
5453
|
initialize({ config, ...options }) {
|
|
5454
5454
|
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
5455
5455
|
F: __dxlog_file18,
|
|
5456
|
-
L:
|
|
5456
|
+
L: 189,
|
|
5457
5457
|
S: this,
|
|
5458
5458
|
A: [
|
|
5459
5459
|
"!this._open",
|
|
@@ -5462,14 +5462,14 @@ var ClientServicesHost = class {
|
|
|
5462
5462
|
});
|
|
5463
5463
|
(0, import_log13.log)("initializing...", void 0, {
|
|
5464
5464
|
F: __dxlog_file18,
|
|
5465
|
-
L:
|
|
5465
|
+
L: 190,
|
|
5466
5466
|
S: this,
|
|
5467
5467
|
C: (f, a) => f(...a)
|
|
5468
5468
|
});
|
|
5469
5469
|
if (config) {
|
|
5470
5470
|
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
5471
5471
|
F: __dxlog_file18,
|
|
5472
|
-
L:
|
|
5472
|
+
L: 193,
|
|
5473
5473
|
S: this,
|
|
5474
5474
|
A: [
|
|
5475
5475
|
"!this._config",
|
|
@@ -5484,7 +5484,7 @@ var ClientServicesHost = class {
|
|
|
5484
5484
|
if (!options.signalManager) {
|
|
5485
5485
|
import_log13.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
5486
5486
|
F: __dxlog_file18,
|
|
5487
|
-
L:
|
|
5487
|
+
L: 201,
|
|
5488
5488
|
S: this,
|
|
5489
5489
|
C: (f, a) => f(...a)
|
|
5490
5490
|
});
|
|
@@ -5495,7 +5495,7 @@ var ClientServicesHost = class {
|
|
|
5495
5495
|
this._signalManager = signalManager;
|
|
5496
5496
|
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
5497
5497
|
F: __dxlog_file18,
|
|
5498
|
-
L:
|
|
5498
|
+
L: 212,
|
|
5499
5499
|
S: this,
|
|
5500
5500
|
A: [
|
|
5501
5501
|
"!this._networkManager",
|
|
@@ -5509,7 +5509,7 @@ var ClientServicesHost = class {
|
|
|
5509
5509
|
});
|
|
5510
5510
|
(0, import_log13.log)("initialized", void 0, {
|
|
5511
5511
|
F: __dxlog_file18,
|
|
5512
|
-
L:
|
|
5512
|
+
L: 219,
|
|
5513
5513
|
S: this,
|
|
5514
5514
|
C: (f, a) => f(...a)
|
|
5515
5515
|
});
|
|
@@ -5523,13 +5523,13 @@ var ClientServicesHost = class {
|
|
|
5523
5523
|
id: traceId
|
|
5524
5524
|
}), {
|
|
5525
5525
|
F: __dxlog_file18,
|
|
5526
|
-
L:
|
|
5526
|
+
L: 230,
|
|
5527
5527
|
S: this,
|
|
5528
5528
|
C: (f, a) => f(...a)
|
|
5529
5529
|
});
|
|
5530
5530
|
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
5531
5531
|
F: __dxlog_file18,
|
|
5532
|
-
L:
|
|
5532
|
+
L: 232,
|
|
5533
5533
|
S: this,
|
|
5534
5534
|
A: [
|
|
5535
5535
|
"this._config",
|
|
@@ -5538,7 +5538,7 @@ var ClientServicesHost = class {
|
|
|
5538
5538
|
});
|
|
5539
5539
|
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
5540
5540
|
F: __dxlog_file18,
|
|
5541
|
-
L:
|
|
5541
|
+
L: 233,
|
|
5542
5542
|
S: this,
|
|
5543
5543
|
A: [
|
|
5544
5544
|
"this._storage",
|
|
@@ -5547,7 +5547,7 @@ var ClientServicesHost = class {
|
|
|
5547
5547
|
});
|
|
5548
5548
|
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
5549
5549
|
F: __dxlog_file18,
|
|
5550
|
-
L:
|
|
5550
|
+
L: 234,
|
|
5551
5551
|
S: this,
|
|
5552
5552
|
A: [
|
|
5553
5553
|
"this._signalManager",
|
|
@@ -5556,7 +5556,7 @@ var ClientServicesHost = class {
|
|
|
5556
5556
|
});
|
|
5557
5557
|
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
5558
5558
|
F: __dxlog_file18,
|
|
5559
|
-
L:
|
|
5559
|
+
L: 235,
|
|
5560
5560
|
S: this,
|
|
5561
5561
|
A: [
|
|
5562
5562
|
"this._networkManager",
|
|
@@ -5568,7 +5568,7 @@ var ClientServicesHost = class {
|
|
|
5568
5568
|
lockKey: this._resourceLock?.lockKey
|
|
5569
5569
|
}, {
|
|
5570
5570
|
F: __dxlog_file18,
|
|
5571
|
-
L:
|
|
5571
|
+
L: 238,
|
|
5572
5572
|
S: this,
|
|
5573
5573
|
C: (f, a) => f(...a)
|
|
5574
5574
|
});
|
|
@@ -5620,7 +5620,7 @@ var ClientServicesHost = class {
|
|
|
5620
5620
|
deviceKey
|
|
5621
5621
|
}, {
|
|
5622
5622
|
F: __dxlog_file18,
|
|
5623
|
-
L:
|
|
5623
|
+
L: 314,
|
|
5624
5624
|
S: this,
|
|
5625
5625
|
C: (f, a) => f(...a)
|
|
5626
5626
|
});
|
|
@@ -5628,7 +5628,7 @@ var ClientServicesHost = class {
|
|
|
5628
5628
|
id: traceId
|
|
5629
5629
|
}), {
|
|
5630
5630
|
F: __dxlog_file18,
|
|
5631
|
-
L:
|
|
5631
|
+
L: 315,
|
|
5632
5632
|
S: this,
|
|
5633
5633
|
C: (f, a) => f(...a)
|
|
5634
5634
|
});
|
|
@@ -5642,7 +5642,7 @@ var ClientServicesHost = class {
|
|
|
5642
5642
|
deviceKey
|
|
5643
5643
|
}, {
|
|
5644
5644
|
F: __dxlog_file18,
|
|
5645
|
-
L:
|
|
5645
|
+
L: 326,
|
|
5646
5646
|
S: this,
|
|
5647
5647
|
C: (f, a) => f(...a)
|
|
5648
5648
|
});
|
|
@@ -5660,7 +5660,7 @@ var ClientServicesHost = class {
|
|
|
5660
5660
|
deviceKey
|
|
5661
5661
|
}, {
|
|
5662
5662
|
F: __dxlog_file18,
|
|
5663
|
-
L:
|
|
5663
|
+
L: 335,
|
|
5664
5664
|
S: this,
|
|
5665
5665
|
C: (f, a) => f(...a)
|
|
5666
5666
|
});
|
|
@@ -5671,13 +5671,13 @@ var ClientServicesHost = class {
|
|
|
5671
5671
|
id: traceId
|
|
5672
5672
|
}), {
|
|
5673
5673
|
F: __dxlog_file18,
|
|
5674
|
-
L:
|
|
5674
|
+
L: 340,
|
|
5675
5675
|
S: this,
|
|
5676
5676
|
C: (f, a) => f(...a)
|
|
5677
5677
|
});
|
|
5678
5678
|
(0, import_log13.log)("resetting...", void 0, {
|
|
5679
5679
|
F: __dxlog_file18,
|
|
5680
|
-
L:
|
|
5680
|
+
L: 342,
|
|
5681
5681
|
S: this,
|
|
5682
5682
|
C: (f, a) => f(...a)
|
|
5683
5683
|
});
|
|
@@ -5685,7 +5685,7 @@ var ClientServicesHost = class {
|
|
|
5685
5685
|
await this._storage.reset();
|
|
5686
5686
|
(0, import_log13.log)("reset", void 0, {
|
|
5687
5687
|
F: __dxlog_file18,
|
|
5688
|
-
L:
|
|
5688
|
+
L: 345,
|
|
5689
5689
|
S: this,
|
|
5690
5690
|
C: (f, a) => f(...a)
|
|
5691
5691
|
});
|
|
@@ -5693,7 +5693,7 @@ var ClientServicesHost = class {
|
|
|
5693
5693
|
id: traceId
|
|
5694
5694
|
}), {
|
|
5695
5695
|
F: __dxlog_file18,
|
|
5696
|
-
L:
|
|
5696
|
+
L: 346,
|
|
5697
5697
|
S: this,
|
|
5698
5698
|
C: (f, a) => f(...a)
|
|
5699
5699
|
});
|
|
@@ -5706,7 +5706,7 @@ var ClientServicesHost = class {
|
|
|
5706
5706
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5707
5707
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5708
5708
|
F: __dxlog_file18,
|
|
5709
|
-
L:
|
|
5709
|
+
L: 358,
|
|
5710
5710
|
S: this,
|
|
5711
5711
|
A: [
|
|
5712
5712
|
"automergeIndex",
|
|
@@ -5717,7 +5717,7 @@ var ClientServicesHost = class {
|
|
|
5717
5717
|
await document.whenReady();
|
|
5718
5718
|
const properties = {
|
|
5719
5719
|
system: {
|
|
5720
|
-
type: (0,
|
|
5720
|
+
type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.Properties))
|
|
5721
5721
|
},
|
|
5722
5722
|
data: {
|
|
5723
5723
|
[import_client_protocol5.defaultKey]: identity.identityKey.toHex()
|
|
@@ -5826,4 +5826,4 @@ var findConfigs = () => {
|
|
|
5826
5826
|
subscribeToSpaces,
|
|
5827
5827
|
subscribeToSwarmInfo
|
|
5828
5828
|
});
|
|
5829
|
-
//# sourceMappingURL=chunk-
|
|
5829
|
+
//# sourceMappingURL=chunk-SPPPL3BF.cjs.map
|