@dxos/client-services 0.4.9-main.76223f7 → 0.4.9-main.7750cb2
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-IVUA3ZSF.mjs → chunk-D6LYSGMU.mjs} +193 -254
- package/dist/lib/browser/chunk-D6LYSGMU.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 -10
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-XLFW2D2Q.cjs → chunk-FSN25IYL.cjs} +212 -273
- package/dist/lib/node/chunk-FSN25IYL.cjs.map +7 -0
- package/dist/lib/node/index.cjs +38 -38
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +10 -17
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +2 -3
- 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/automerge-space-state.d.ts +3 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +2 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +5 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -3
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +2 -6
- 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 +37 -37
- package/src/packlets/indexing/util.ts +2 -2
- package/src/packlets/invitations/space-invitation-protocol.test.ts +3 -12
- package/src/packlets/invitations/space-invitation-protocol.ts +0 -1
- package/src/packlets/services/automerge-host.test.ts +2 -5
- package/src/packlets/services/diagnostics.ts +2 -41
- package/src/packlets/services/service-context.test.ts +3 -76
- package/src/packlets/services/service-context.ts +5 -15
- package/src/packlets/services/service-host.ts +1 -5
- package/src/packlets/spaces/automerge-space-state.ts +9 -0
- package/src/packlets/spaces/data-space-manager.test.ts +3 -145
- package/src/packlets/spaces/data-space-manager.ts +3 -18
- package/src/packlets/spaces/data-space.ts +11 -43
- package/src/packlets/spaces/spaces-service.test.ts +4 -9
- package/src/packlets/spaces/spaces-service.ts +11 -15
- package/src/packlets/testing/test-builder.ts +2 -22
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-IVUA3ZSF.mjs.map +0 -7
- package/dist/lib/node/chunk-XLFW2D2Q.cjs.map +0 -7
|
@@ -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 const hostObservable = createInvitation(host, options);\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 return [hostComplete.wait(), guestComplete.wait()];\n};\n\nconst createInvitation = (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): CancellableInvitation => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n const hostHandler = host.getInvitationHandler({ kind: Invitation.Kind.SPACE, ...options });\n return host.invitations.createInvitation(hostHandler, options);\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 {\n SnapshotStore,\n type DataPipeline,\n MetadataStore,\n SpaceManager,\n valueEncoding,\n DataServiceSubscriptions,\n AutomergeHost,\n} from '@dxos/echo-pipeline';\nimport { testLocalDatabase } 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 { createStorage, type Storage, StorageType } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { ClientServicesHost, createDefaultModelFactory, 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 = ({\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\n const modelFactory = createDefaultModelFactory();\n return new ServiceContext(storage, networkManager, signalManager, modelFactory);\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 = 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\n// TODO(burdon): Remove @dxos/client-testing.\n// TODO(burdon): Create builder and make configurable.\n/**\n * @deprecated\n */\nexport const syncItemsLocal = async (db1: DataPipeline, db2: DataPipeline) => {\n await testLocalDatabase(db1, db2);\n await testLocalDatabase(db2, db1);\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 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 automergeHost?: AutomergeHost;\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 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 modelFactory: createDefaultModelFactory(),\n snapshotStore: this.snapshotStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get automergeHost() {\n return (this._props.automergeHost ??= new AutomergeHost({ directory: this.storage.createDirectory('automerge') }));\n }\n\n get dataSpaceManager() {\n return (this._props.dataSpaceManager ??= new DataSpaceManager(\n this.spaceManager,\n this.metadataStore,\n new DataServiceSubscriptions(),\n this.keyring,\n this.identity,\n this.feedStore,\n this.automergeHost,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n }\n\n async destroy() {\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": "
|
|
6
|
-
"names": ["import_credentials", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "hostComplete", "Trigger", "guestComplete", "authCode", "hostObservable", "createInvitation", "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", "hostHandler", "getInvitationHandler", "kind", "Kind", "SPACE", "invitations", "share", "guestHandler", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "networkManager", "NetworkManager", "modelFactory", "createDefaultModelFactory", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "open", "Context", "createIdentity", "
|
|
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 const hostObservable = createInvitation(host, options);\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 return [hostComplete.wait(), guestComplete.wait()];\n};\n\nconst createInvitation = (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): CancellableInvitation => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n const hostHandler = host.getInvitationHandler({ kind: Invitation.Kind.SPACE, ...options });\n return host.invitations.createInvitation(hostHandler, options);\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 { AutomergeHost, MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';\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 { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { ClientServicesHost, createDefaultModelFactory, 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 = ({\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\n const modelFactory = createDefaultModelFactory();\n return new ServiceContext(storage, networkManager, signalManager, modelFactory);\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 = 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 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 automergeHost?: AutomergeHost;\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 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 modelFactory: createDefaultModelFactory(),\n snapshotStore: this.snapshotStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get automergeHost() {\n return (this._props.automergeHost ??= new AutomergeHost({ directory: this.storage.createDirectory('automerge') }));\n }\n\n get 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.automergeHost,\n ));\n }\n\n async createIdentity() {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n }\n\n async destroy() {\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,yBAAiC;AAEjC,kBAA0B;ACF1B,mBAAwB;AACxB,6BAA6F;AAC7F,uBAA0B;AAC1B,sBAA2B;ACF3B,qBAAwB;AACxB,IAAAA,sBAAqE;AACrE,mBAA8B;AAC9B,2BAAyF;AACzF,wBAAuC;AACvC,qBAAwB;AACxB,uBAAgE;AAChE,6BAAuD;AACvD,mCAAyD;AACzD,4CAA0B;AFLnB,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,OAAM,UAKNC,qCAAiB;EACfF;EACAC;EACAE,SAAS,IAAIC,sBAAUC,OAAOC,KAAK,MAAA,CAAA;EACnCC,WAAW;IACT,SAAS;IACTC,SAAS;MACP,SAAS;MACTC,OAAOJ,OAAOC,KAAK,MAAA;IACrB;EACF;AACF,CAAA;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AKpB,OAAOqB,sBAAkBC,4BAAAA;EACvC;EAEA,IAAIC,gBAAgB;AAClB,WAAQ,KAAKvB,OAAOuB,kBAAkB,IAAIC,mCAAc;MAAEC,WAAW,KAAKvD,QAAQkC,gBAAgB,WAAA;IAAa,CAAA;EACjH;EAEA,IAAIsB,mBAAmB;AACrB,WAAQ,KAAK1B,OAAO0B,qBAAqB,IAAIC,uCAC3C,KAAKT,cACL,KAAKN,eACL,KAAKV,SACL,KAAKkB,UACL,KAAKf,WACL,KAAKkB,aAAa;EAEtB;EAEA,MAAMnC,iBAAiB;AACrB,SAAKY,OAAOqB,mBAAmB,MAAMO,qBAAqB,KAAK1B,OAAO;EACxE;EAEA,MAAMP,UAAU;AACd,UAAM,KAAKzB,QAAQ2D,MAAK;EAC1B;AACF;AAEO,IAAMD,uBAAuB,OAAO1B,YAAAA;AACzC,QAAM4B,cAAc,MAAM5B,QAAQ6B,UAAS;AAC3C,QAAMC,YAAY,MAAM9B,QAAQ6B,UAAS;AAEzC,SAAO;IACLD;IACAE;IACAC,sBAAkBC,qDAChBhC,SACA;MACEiC,YAAY,MAAM,IAAIC,wCAAoBlC,SAAS4B,aAAaE,SAAAA,EAAWK,0BAA0BL,SAAAA;IACvG,GACAA,SAAAA;IAEFM,kBAAkB,YAAA;IAAa;IAC/BC,YAAY,MAAMC;EACpB;AACF;",
|
|
6
|
+
"names": ["import_credentials", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "hostComplete", "Trigger", "guestComplete", "authCode", "hostObservable", "createInvitation", "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", "hostHandler", "getInvitationHandler", "kind", "Kind", "SPACE", "invitations", "share", "guestHandler", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "networkManager", "NetworkManager", "modelFactory", "createDefaultModelFactory", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "open", "Context", "createIdentity", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "constructor", "opts", "dataStore", "_props", "props", "keyring", "Keyring", "createDirectory", "feedStore", "FeedStore", "factory", "FeedFactory", "root", "hypercore", "valueEncoding", "metadataStore", "MetadataStore", "blobStore", "BlobStore", "snapshotStore", "SnapshotStore", "spaceManager", "SpaceManager", "identity", "signingContext", "failUndefined", "automergeHost", "AutomergeHost", "directory", "dataSpaceManager", "DataSpaceManager", "createSigningContext", "reset", "identityKey", "createKey", "deviceKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile", "undefined"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-invitation-protocol.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/space-invitation-protocol.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEvE,qBAAa,uBAAwB,YAAW,kBAAkB;IAE9D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAHV,aAAa,EAAE,gBAAgB,EAC/B,eAAe,EAAE,cAAc,EAC/B,QAAQ,EAAE,OAAO,EACjB,SAAS,CAAC,uBAAW;IAGxC,MAAM,IAAI,MAAM;IAOhB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;IAOhE,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,CAAC,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"space-invitation-protocol.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/space-invitation-protocol.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEvE,qBAAa,uBAAwB,YAAW,kBAAkB;IAE9D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAHV,aAAa,EAAE,gBAAgB,EAC/B,eAAe,EAAE,cAAc,EAC/B,QAAQ,EAAE,OAAO,EACjB,SAAS,CAAC,uBAAW;IAGxC,MAAM,IAAI,MAAM;IAOhB,oBAAoB,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;IAOhE,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,CAAC,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAiC9G,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;IAM/C,kBAAkB,IAAI,mBAAmB;IAMnC,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAenD,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CAuBxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/diagnostics.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/diagnostics.ts"],"names":[],"m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MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;QACrB,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB,CAAC;AAGF,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,SAAS,CAAC;IACf,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,EAAE,CAAC,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG;QAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG;QAAE,EAAE,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC,EAAE,CAAC;IACxC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,mBACZ,QAAQ,cAAc,CAAC,kBACvB,cAAc,UACtB,MAAM,KACb,QAAQ,WAAW,CAAC,UAAU,CAAC,CAsFjC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Trigger } from '@dxos/async';
|
|
2
2
|
import { Context } from '@dxos/context';
|
|
3
|
-
import {
|
|
3
|
+
import { AutomergeHost, MetadataStore, SnapshotStore, SpaceManager } from '@dxos/echo-pipeline';
|
|
4
4
|
import { FeedStore } from '@dxos/feed-store';
|
|
5
5
|
import { IndexMetadataStore, Indexer } from '@dxos/indexing';
|
|
6
6
|
import { Keyring } from '@dxos/keyring';
|
|
@@ -12,7 +12,7 @@ import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
|
12
12
|
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
13
13
|
import { type Storage } from '@dxos/random-access-storage';
|
|
14
14
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
15
|
-
import { type CreateIdentityOptions,
|
|
15
|
+
import { IdentityManager, type CreateIdentityOptions, type IdentityManagerRuntimeParams } from '../identity';
|
|
16
16
|
import { InvitationsHandler, type InvitationProtocol } from '../invitations';
|
|
17
17
|
import { DataSpaceManager, type DataSpaceManagerRuntimeParams } from '../spaces';
|
|
18
18
|
export type ServiceContextRuntimeParams = IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams;
|
|
@@ -26,7 +26,6 @@ export declare class ServiceContext {
|
|
|
26
26
|
readonly modelFactory: ModelFactory;
|
|
27
27
|
readonly _runtimeParams?: (IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams) | undefined;
|
|
28
28
|
readonly initialized: Trigger<void>;
|
|
29
|
-
readonly dataServiceSubscriptions: DataServiceSubscriptions;
|
|
30
29
|
readonly metadataStore: MetadataStore;
|
|
31
30
|
/**
|
|
32
31
|
* @deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,
|
|
1
|
+
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OA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essor, type SpecificCredential } from '@dxos/credentials';
|
|
2
3
|
import { type Credential, type Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
3
4
|
export declare class AutomergeSpaceState implements CredentialProcessor {
|
|
4
5
|
private readonly _onNewRoot;
|
|
5
6
|
rootUrl: string | undefined;
|
|
6
7
|
lastEpoch: SpecificCredential<Epoch> | undefined;
|
|
8
|
+
readonly onNewEpoch: Event<SpecificCredential<Epoch>>;
|
|
7
9
|
private _isProcessingRootDocs;
|
|
8
10
|
constructor(_onNewRoot: (rootUrl: string) => void);
|
|
9
11
|
processCredential(credential: Credential): Promise<void>;
|
|
10
12
|
startProcessingRootDocs(): void;
|
|
13
|
+
ensureEpochInitialized(): Promise<void>;
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=automerge-space-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automerge-space-state.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/automerge-space-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAE1F,qBAAa,mBAAoB,YAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"automerge-space-state.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/automerge-space-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAE1F,qBAAa,mBAAoB,YAAW,mBAAmB;IAQjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAPhC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAa;IACxC,SAAS,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAa;IAEpE,SAAgB,UAAU,mCAA0C;IAEpE,OAAO,CAAC,qBAAqB,CAAS;gBAET,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IAE5D,iBAAiB,CAAC,UAAU,EAAE,UAAU;IAiB9C,uBAAuB;IAWjB,sBAAsB;CAG7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
2
|
import { type CredentialSigner } from '@dxos/credentials';
|
|
3
|
-
import { type AutomergeHost, type
|
|
3
|
+
import { type AutomergeHost, type MetadataStore, type SpaceManager } from '@dxos/echo-pipeline';
|
|
4
4
|
import { type FeedStore } from '@dxos/feed-store';
|
|
5
5
|
import { type Keyring } from '@dxos/keyring';
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
@@ -37,7 +37,6 @@ export type DataSpaceManagerRuntimeParams = {
|
|
|
37
37
|
export declare class DataSpaceManager {
|
|
38
38
|
private readonly _spaceManager;
|
|
39
39
|
private readonly _metadataStore;
|
|
40
|
-
private readonly _dataServiceSubscriptions;
|
|
41
40
|
private readonly _keyring;
|
|
42
41
|
private readonly _signingContext;
|
|
43
42
|
private readonly _feedStore;
|
|
@@ -49,7 +48,7 @@ export declare class DataSpaceManager {
|
|
|
49
48
|
private readonly _instanceId;
|
|
50
49
|
private readonly _spaceMemberPresenceAnnounceInterval;
|
|
51
50
|
private readonly _spaceMemberPresenceOfflineTimeout;
|
|
52
|
-
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore,
|
|
51
|
+
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage>, _automergeHost: AutomergeHost, params?: DataSpaceManagerRuntimeParams);
|
|
53
52
|
get spaces(): ComplexMap<PublicKey, DataSpace>;
|
|
54
53
|
open(): Promise<void>;
|
|
55
54
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA4B,MAAM,aAAa,CAAC;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"data-space-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA4B,MAAM,aAAa,CAAC;AAE9D,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAc,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEpG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAA+B,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzC,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,SAAS,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,gBAAgB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D,UAAU,EAAE,MAAM,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED,MA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;IACG,mBAAmB,CAAC,QAAQ,EAAE,SAAS;YAU/B,eAAe;CAmF9B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
|
-
import { type MetadataStore, type Space, type
|
|
2
|
+
import { type MetadataStore, type Space, type AutomergeHost } from '@dxos/echo-pipeline';
|
|
3
3
|
import { type FeedStore } from '@dxos/feed-store';
|
|
4
4
|
import { type Keyring } from '@dxos/keyring';
|
|
5
5
|
import { PublicKey } from '@dxos/keys';
|
|
6
|
-
import { SpaceState, type Space as SpaceProto } from '@dxos/protocols/proto/dxos/client/services';
|
|
6
|
+
import { SpaceState, type Space as SpaceProto, CreateEpochRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
7
7
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
8
8
|
import { type SpaceCache } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
9
9
|
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
@@ -40,6 +40,9 @@ export type DataSpaceParams = {
|
|
|
40
40
|
cache?: SpaceCache;
|
|
41
41
|
automergeHost: AutomergeHost;
|
|
42
42
|
};
|
|
43
|
+
export type CreateEpochOptions = {
|
|
44
|
+
migration?: CreateEpochRequest.Migration;
|
|
45
|
+
};
|
|
43
46
|
export declare class DataSpace {
|
|
44
47
|
private _ctx;
|
|
45
48
|
private readonly _inner;
|
|
@@ -67,7 +70,6 @@ export declare class DataSpace {
|
|
|
67
70
|
get isOpen(): boolean;
|
|
68
71
|
get state(): SpaceState;
|
|
69
72
|
get inner(): Space;
|
|
70
|
-
get dataPipeline(): DataPipeline;
|
|
71
73
|
get presence(): Presence;
|
|
72
74
|
get notarizationPlugin(): NotarizationPlugin;
|
|
73
75
|
get cache(): SpaceCache | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"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AO,CAAC,MAAM,CAAqB;IAEnC;;OAEG;IACI,KAAK,EAAE,KAAK,GAAG,SAAS,CAAa;IAE5C,SAAgB,YAAY,EAAE,yBAAyB,CAAC;IACxD,SAAgB,WAAW,cAAe;IAEnC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAM;gBAE5B,MAAM,EAAE,eAAe;IA+BnC,IACI,GAAG,cAEN;IAED,IAAI,MAAM,YAET;IAED,IACI,KAAK,IAAI,UAAU,CAEtB;IAGD,IAAI,KAAK,UAER;IAED,IAAI,QAAQ,aAEX;IAED,IAAI,kBAAkB,uBAErB;IAED,IAAI,KAAK,2BAER;IAED,IAAI,mBAAmB,wBAEtB;IAGD,OAAO,KAAK,cAAc,GAKzB;IAGK,IAAI;YAII,KAAK;IAcb,KAAK;YAIG,MAAM;IAkBd,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAI/C,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;;;IAIlE;;OAEG;IACH,2BAA2B;IAuBrB,sBAAsB;YA6Bd,iCAAiC;YAyBjC,oBAAoB;IAiDlC,OAAO,CAAC,mBAAmB;IA8BrB,gBAAgB,CAAC,OAAO,EAAE,eAAe;IAWzC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB;IAiExC,QAAQ;IAWR,UAAU;CAYjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SpaceManager } from '@dxos/echo-pipeline';
|
|
3
3
|
import { type CreateEpochRequest, type PostMessageRequest, type QueryCredentialsRequest, type QuerySpacesResponse, type Space, type SpacesService, type SubscribeMessagesRequest, type UpdateSpaceRequest, type WriteCredentialsRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
4
4
|
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
5
5
|
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
@@ -9,9 +9,8 @@ import { type IdentityManager } from '../identity';
|
|
|
9
9
|
export declare class SpacesServiceImpl implements SpacesService {
|
|
10
10
|
private readonly _identityManager;
|
|
11
11
|
private readonly _spaceManager;
|
|
12
|
-
private readonly _dataServiceSubscriptions;
|
|
13
12
|
private readonly _getDataSpaceManager;
|
|
14
|
-
constructor(_identityManager: IdentityManager, _spaceManager: SpaceManager,
|
|
13
|
+
constructor(_identityManager: IdentityManager, _spaceManager: SpaceManager, _getDataSpaceManager: Provider<Promise<DataSpaceManager>>);
|
|
15
14
|
createSpace(): Promise<Space>;
|
|
16
15
|
updateSpace({ spaceKey, state }: UpdateSpaceRequest): Promise<void>;
|
|
17
16
|
querySpaces(): Stream<QuerySpacesResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaces-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/spaces-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"spaces-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/spaces-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAFpB,gBAAgB,EAAE,eAAe,EACjC,aAAa,EAAE,YAAY,EAC3B,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAGtE,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;IAU7B,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,kBAAkB;IAmBzD,WAAW,IAAI,MAAM,CAAC,mBAAmB,CAAC;IAkDpC,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB;IAMpE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,wBAAwB;IAajE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAmB7E,gBAAgB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAmBnE,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kBAAkB;IAM7D,OAAO,CAAC,eAAe;CA8CxB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Config } from '@dxos/config';
|
|
2
|
-
import {
|
|
2
|
+
import { AutomergeHost, MetadataStore, SnapshotStore, SpaceManager } from '@dxos/echo-pipeline';
|
|
3
3
|
import { FeedStore } from '@dxos/feed-store';
|
|
4
4
|
import { Keyring } from '@dxos/keyring';
|
|
5
5
|
import { MemorySignalManagerContext } from '@dxos/messaging';
|
|
6
6
|
import { NetworkManager } from '@dxos/network-manager';
|
|
7
|
-
import { type Storage
|
|
7
|
+
import { StorageType, type Storage } from '@dxos/random-access-storage';
|
|
8
8
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
9
9
|
import { ClientServicesHost, ServiceContext } from '../services';
|
|
10
10
|
import { DataSpaceManager, type SigningContext } from '../spaces';
|
|
@@ -15,10 +15,6 @@ export declare const createServiceContext: ({ signalContext, storage, }?: {
|
|
|
15
15
|
}) => ServiceContext;
|
|
16
16
|
export declare const createPeers: (numPeers: number) => Promise<ServiceContext[]>;
|
|
17
17
|
export declare const createIdentity: (peer: ServiceContext) => Promise<ServiceContext>;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
*/
|
|
21
|
-
export declare const syncItemsLocal: (db1: DataPipeline, db2: DataPipeline) => Promise<void>;
|
|
22
18
|
export declare class TestBuilder {
|
|
23
19
|
readonly signalContext: MemorySignalManagerContext;
|
|
24
20
|
private readonly _ctx;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,
|
|
1
|
+
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,qBAAqB,CAAC;AAC/G,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAuB,0BAA0B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C,EAAE,aAAa,CAAC;CAC/B,CAAC;AAEF,qBAAa,QAAQ;IAIjB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,MAAM,CAAqB;gBAGhB,aAAa,EAAE,0BAA0B,EACzC,IAAI,GAAE,YAA6C;IAGtE,IAAI,KAAK,kBAER;IAED,IAAI,OAAO,YAEV;IAED,IAAI,OAAO,YAEV;IAED,IAAI,SAAS,mBAUZ;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,SAAS,cAEZ;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,cAAc,mBAKjB;IAED,IAAI,YAAY,iBASf;IAED,IAAI,QAAQ,mBAEX;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,gBAAgB,qBASnB;IAEK,cAAc;IAId,OAAO;CAGd;AAED,eAAO,MAAM,oBAAoB,YAAmB,OAAO,KAAG,QAAQ,cAAc,CAiBnF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.4.9-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.4.9-main.7750cb2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.4.9-main.
|
|
3
|
+
"version": "0.4.9-main.7750cb2",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -22,46 +22,46 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"platform": "^1.3.6",
|
|
25
|
-
"@dxos/async": "0.4.9-main.
|
|
26
|
-
"@dxos/automerge": "0.4.9-main.
|
|
27
|
-
"@dxos/client-protocol": "0.4.9-main.
|
|
28
|
-
"@dxos/codec-protobuf": "0.4.9-main.
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/credentials": "0.4.9-main.
|
|
32
|
-
"@dxos/crypto": "0.4.9-main.
|
|
33
|
-
"@dxos/debug": "0.4.9-main.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/echo-schema": "0.4.9-main.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/keyring": "0.4.9-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/model-factory": "0.4.9-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/teleport
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/timeframe": "0.4.9-main.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
25
|
+
"@dxos/async": "0.4.9-main.7750cb2",
|
|
26
|
+
"@dxos/automerge": "0.4.9-main.7750cb2",
|
|
27
|
+
"@dxos/client-protocol": "0.4.9-main.7750cb2",
|
|
28
|
+
"@dxos/codec-protobuf": "0.4.9-main.7750cb2",
|
|
29
|
+
"@dxos/context": "0.4.9-main.7750cb2",
|
|
30
|
+
"@dxos/config": "0.4.9-main.7750cb2",
|
|
31
|
+
"@dxos/credentials": "0.4.9-main.7750cb2",
|
|
32
|
+
"@dxos/crypto": "0.4.9-main.7750cb2",
|
|
33
|
+
"@dxos/debug": "0.4.9-main.7750cb2",
|
|
34
|
+
"@dxos/document-model": "0.4.9-main.7750cb2",
|
|
35
|
+
"@dxos/echo-db": "0.4.9-main.7750cb2",
|
|
36
|
+
"@dxos/echo-pipeline": "0.4.9-main.7750cb2",
|
|
37
|
+
"@dxos/echo-schema": "0.4.9-main.7750cb2",
|
|
38
|
+
"@dxos/indexing": "0.4.9-main.7750cb2",
|
|
39
|
+
"@dxos/feed-store": "0.4.9-main.7750cb2",
|
|
40
|
+
"@dxos/invariant": "0.4.9-main.7750cb2",
|
|
41
|
+
"@dxos/keyring": "0.4.9-main.7750cb2",
|
|
42
|
+
"@dxos/keys": "0.4.9-main.7750cb2",
|
|
43
|
+
"@dxos/lock-file": "0.4.9-main.7750cb2",
|
|
44
|
+
"@dxos/log": "0.4.9-main.7750cb2",
|
|
45
|
+
"@dxos/messaging": "0.4.9-main.7750cb2",
|
|
46
|
+
"@dxos/model-factory": "0.4.9-main.7750cb2",
|
|
47
|
+
"@dxos/node-std": "0.4.9-main.7750cb2",
|
|
48
|
+
"@dxos/network-manager": "0.4.9-main.7750cb2",
|
|
49
|
+
"@dxos/protocols": "0.4.9-main.7750cb2",
|
|
50
|
+
"@dxos/random-access-storage": "0.4.9-main.7750cb2",
|
|
51
|
+
"@dxos/rpc": "0.4.9-main.7750cb2",
|
|
52
|
+
"@dxos/teleport-extension-gossip": "0.4.9-main.7750cb2",
|
|
53
|
+
"@dxos/teleport": "0.4.9-main.7750cb2",
|
|
54
|
+
"@dxos/text-model": "0.4.9-main.7750cb2",
|
|
55
|
+
"@dxos/teleport-extension-object-sync": "0.4.9-main.7750cb2",
|
|
56
|
+
"@dxos/timeframe": "0.4.9-main.7750cb2",
|
|
57
|
+
"@dxos/tracing": "0.4.9-main.7750cb2",
|
|
58
|
+
"@dxos/websocket-rpc": "0.4.9-main.7750cb2",
|
|
59
|
+
"@dxos/util": "0.4.9-main.7750cb2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/platform": "^1.3.4",
|
|
63
63
|
"@types/readable-stream": "^2.3.9",
|
|
64
|
-
"@dxos/signal": "0.4.9-main.
|
|
64
|
+
"@dxos/signal": "0.4.9-main.7750cb2"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
@@ -24,8 +24,8 @@ export const createLoadDocuments = (automergeHost: AutomergeHost) =>
|
|
|
24
24
|
const handle = automergeHost.repo.find(documentId as any);
|
|
25
25
|
await warnAfterTimeout(5000, 'to long to load doc', () => handle.whenReady());
|
|
26
26
|
const doc = handle.docSync();
|
|
27
|
-
const
|
|
28
|
-
yield [{ id, object: doc.objects[objectId], currentHash:
|
|
27
|
+
const hash = getHeads(doc).join('');
|
|
28
|
+
yield [{ id, object: doc.objects[objectId], currentHash: hash }];
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -6,13 +6,12 @@ import { expect } from 'chai';
|
|
|
6
6
|
|
|
7
7
|
import { asyncChain, Trigger } from '@dxos/async';
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
|
-
import { testLocalDatabase } from '@dxos/echo-pipeline/testing';
|
|
10
9
|
import { AlreadyJoinedError } from '@dxos/protocols';
|
|
11
10
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
12
11
|
import { afterTest, describe, test } from '@dxos/test';
|
|
13
12
|
|
|
14
13
|
import { type ServiceContext } from '../services';
|
|
15
|
-
import { createIdentity, createPeers
|
|
14
|
+
import { createIdentity, createPeers } from '../testing';
|
|
16
15
|
import { performInvitation } from '../testing/invitation-utils';
|
|
17
16
|
|
|
18
17
|
const closeAfterTest = async (peer: ServiceContext) => {
|
|
@@ -40,14 +39,6 @@ describe('services/space-invitations-protocol', () => {
|
|
|
40
39
|
await space.close();
|
|
41
40
|
});
|
|
42
41
|
|
|
43
|
-
test('genesis with database mutations', async () => {
|
|
44
|
-
const [peer] = await asyncChain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(1));
|
|
45
|
-
const space = await peer.dataSpaceManager!.createSpace();
|
|
46
|
-
afterTest(() => space.close());
|
|
47
|
-
|
|
48
|
-
await testLocalDatabase(space.dataPipeline);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
42
|
test('invitation with no auth', async () => {
|
|
52
43
|
const [host, guest] = await asyncChain<ServiceContext>([createIdentity, closeAfterTest])(createPeers(2));
|
|
53
44
|
|
|
@@ -65,7 +56,7 @@ describe('services/space-invitations-protocol', () => {
|
|
|
65
56
|
await host.dataSpaceManager?.waitUntilSpaceReady(space1.key);
|
|
66
57
|
await guest.dataSpaceManager?.waitUntilSpaceReady(space2.key);
|
|
67
58
|
|
|
68
|
-
await
|
|
59
|
+
await space2.inner.controlPipeline.state.waitUntilTimeframe(space1.inner.controlPipeline.state.timeframe);
|
|
69
60
|
|
|
70
61
|
await space1.close();
|
|
71
62
|
await space2.close();
|
|
@@ -149,7 +140,7 @@ describe('services/space-invitations-protocol', () => {
|
|
|
149
140
|
await host.dataSpaceManager?.waitUntilSpaceReady(space1.key);
|
|
150
141
|
await guest.dataSpaceManager?.waitUntilSpaceReady(space2.key);
|
|
151
142
|
|
|
152
|
-
await
|
|
143
|
+
await space2.inner.controlPipeline.state.waitUntilTimeframe(space1.inner.controlPipeline.state.timeframe);
|
|
153
144
|
|
|
154
145
|
await space1.close();
|
|
155
146
|
await space2.close();
|
|
@@ -72,7 +72,6 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
|
|
|
72
72
|
space: {
|
|
73
73
|
credential: spaceMemberCredential,
|
|
74
74
|
controlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
75
|
-
dataTimeframe: space.dataPipeline.pipelineState?.timeframe,
|
|
76
75
|
},
|
|
77
76
|
};
|
|
78
77
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
|
|
7
7
|
import { asyncTimeout, sleep } from '@dxos/async';
|
|
8
|
-
import { AutomergeHost, DataServiceImpl
|
|
8
|
+
import { AutomergeHost, DataServiceImpl } from '@dxos/echo-pipeline';
|
|
9
9
|
import { AutomergeContext } from '@dxos/echo-schema';
|
|
10
10
|
import { StorageType, createStorage } from '@dxos/random-access-storage';
|
|
11
11
|
import { afterTest, describe, test } from '@dxos/test';
|
|
@@ -23,10 +23,7 @@ describe('AutomergeHost', () => {
|
|
|
23
23
|
|
|
24
24
|
const host = new AutomergeHost({ directory: storageDirectory });
|
|
25
25
|
afterTest(() => host.close());
|
|
26
|
-
const dataService = new DataServiceImpl(
|
|
27
|
-
{} as DataServiceSubscriptions, // is not used in this test, just required argument
|
|
28
|
-
host,
|
|
29
|
-
);
|
|
26
|
+
const dataService = new DataServiceImpl(host);
|
|
30
27
|
const client = new AutomergeContext(dataService);
|
|
31
28
|
afterTest(() => client.close());
|
|
32
29
|
|