@dxos/client-protocol 0.5.9-main.94cc71c → 0.5.9-main.9a55396
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/index.mjs +3 -6
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +2 -4
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/echo.d.ts +1 -1
- package/dist/types/src/echo.d.ts.map +1 -1
- package/dist/types/src/service-definitions.d.ts +2 -1
- package/dist/types/src/service-definitions.d.ts.map +1 -1
- package/dist/types/src/shell.d.ts +2 -0
- package/dist/types/src/shell.d.ts.map +1 -1
- package/dist/types/src/space.d.ts +11 -2
- package/dist/types/src/space.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/echo.ts +2 -4
- package/src/schema.ts +2 -2
- package/src/service-definitions.ts +3 -0
- package/src/shell.ts +2 -0
- package/src/space.ts +19 -1
|
@@ -19,9 +19,6 @@ var ENV_DX_NO_AGENT = "DX_NO_AGENT";
|
|
|
19
19
|
var ENV_DX_PROFILE = "DX_PROFILE";
|
|
20
20
|
var ENV_DX_PROFILE_DEFAULT = "default";
|
|
21
21
|
|
|
22
|
-
// packages/sdk/client-protocol/src/echo.ts
|
|
23
|
-
var defaultKey = "__DEFAULT__";
|
|
24
|
-
|
|
25
22
|
// packages/sdk/client-protocol/src/invitations/encoder.ts
|
|
26
23
|
import base from "base-x";
|
|
27
24
|
import { schema } from "@dxos/protocols";
|
|
@@ -129,6 +126,7 @@ var clientServiceBundle = createServiceBundle({
|
|
|
129
126
|
DevicesService: schema2.getService("dxos.client.services.DevicesService"),
|
|
130
127
|
SpacesService: schema2.getService("dxos.client.services.SpacesService"),
|
|
131
128
|
DataService: schema2.getService("dxos.echo.service.DataService"),
|
|
129
|
+
ContactsService: schema2.getService("dxos.client.services.ContactsService"),
|
|
132
130
|
// Agent-only.
|
|
133
131
|
FunctionRegistryService: schema2.getService("dxos.agent.functions.FunctionRegistryService"),
|
|
134
132
|
// TODO(burdon): Deprecated.
|
|
@@ -158,9 +156,9 @@ var CREATE_SPACE_TIMEOUT = 5e3;
|
|
|
158
156
|
var LOAD_CONTROL_FEEDS_TIMEOUT = 3e3;
|
|
159
157
|
|
|
160
158
|
// packages/sdk/client-protocol/src/schema.ts
|
|
161
|
-
import { S, TypedObject } from "@dxos/echo-schema";
|
|
159
|
+
import { S, TYPE_PROPERTIES, TypedObject } from "@dxos/echo-schema";
|
|
162
160
|
var PropertiesType = class extends TypedObject({
|
|
163
|
-
typename:
|
|
161
|
+
typename: TYPE_PROPERTIES,
|
|
164
162
|
version: "0.1.0"
|
|
165
163
|
})({
|
|
166
164
|
name: S.optional(S.String)
|
|
@@ -199,7 +197,6 @@ export {
|
|
|
199
197
|
appServiceBundle,
|
|
200
198
|
clientServiceBundle,
|
|
201
199
|
defaultConfig,
|
|
202
|
-
defaultKey,
|
|
203
200
|
getProfilePath,
|
|
204
201
|
iframeServiceBundle,
|
|
205
202
|
shellServiceBundle,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config.ts", "../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { type ConfigProto } from '@dxos/config';\n\nexport const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';\nexport const DEFAULT_CLIENT_CHANNEL = 'dxos:app';\nexport const DEFAULT_SHELL_CHANNEL = 'dxos:shell';\n\n/**\n * @deprecated\n */\nexport const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';\n\nexport const EXPECTED_CONFIG_VERSION = 1;\nexport const defaultConfig: ConfigProto = { version: 1 };\n\n// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.\nconst HOME = typeof process !== 'undefined' ? process?.env?.HOME ?? '' : '';\n\n// Base directories.\n// TODO(burdon): Consider Windows, Linux, OSX.\n// https://wiki.archlinux.org/title/XDG_Base_Directory\n// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.\nexport const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>\n `${root}/profile/${profile}` + (file ? `/${file}` : '');\n\n// XDG_CONFIG_HOME (Analogous to /etc.)\nexport const DX_CONFIG = `${HOME}/.config/dx`;\n\n// XDG_CACHE_HOME (Analogous to /var/cache).\nexport const DX_CACHE = `${HOME}/.cache/dx`;\n\n// TODO(burdon): Storage should use this by default (make path optional).\n// XDG_DATA_HOME (Analogous to /usr/share).\nexport const DX_DATA = `${HOME}/.local/share/dx`;\n\n// XDG_STATE_HOME (Analogous to /var/lib).\nexport const DX_STATE = `${HOME}/.local/state/dx`;\n\n// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)\nexport const DX_RUNTIME = '/tmp/dx/run';\n\nexport const ENV_DX_CONFIG = 'DX_CONFIG';\nexport const ENV_DX_NO_AGENT = 'DX_NO_AGENT';\nexport const ENV_DX_PROFILE = 'DX_PROFILE';\nexport const ENV_DX_PROFILE_DEFAULT = 'default';\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport type { MulticastObservable } from '@dxos/async';\nimport type { FilterSource, Query } from '@dxos/echo-db';\nimport type { PublicKey, SpaceId } from '@dxos/keys';\nimport type { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport type { QueryOptions } from '@dxos/protocols/proto/dxos/echo/filter';\n\nimport type { AuthenticatingInvitation } from './invitations';\nimport type { PropertiesTypeProps } from './schema';\nimport type { Space } from './space';\n\n// Space properties key for default metadata.\n// TODO(wittjosiah): Remove. Default space should be indicated by data in HALO space.\nexport const defaultKey = '__DEFAULT__';\n\n/**\n * TODO(burdon): Public API (move comments here).\n */\n// TODO(wittjosiah): Rename?\n// https://ts.dev/style/#naming-style\n// ClientApi? ClientProtocol?\nexport interface Echo extends MulticastObservable<Space[]> {\n /**\n * Resolves when the default space is available.\n */\n // TODO(wittjosiah): Remove. Ensure default space is always available.\n get isReady(): MulticastObservable<boolean>;\n\n /**\n * Returns the list of spaces.\n */\n get(): Space[];\n\n /**\n * Returns the space with the given id.\n */\n get(id: SpaceId): Space | undefined;\n\n /**\n * Returns the space with the given key.\n * @deprecated Use `get(id: SpaceId)`.\n */\n get(spaceKey: PublicKey): Space | undefined;\n\n /**\n * Returns the default space.\n */\n get default(): Space;\n\n /**\n * Creates a new space.\n */\n create(meta?: PropertiesTypeProps): Promise<Space>;\n\n /**\n * Creates a space from the given snapshot.\n */\n // clone(snapshot: SpaceSnapshot): Promise<Space>;\n\n /**\n * Joins an existing space using the given invitation.\n */\n join(invitation: Invitation | string): AuthenticatingInvitation;\n\n /**\n * Query all spaces.\n * @param filter\n * @param options\n */\n query<T extends {} = any>(filter?: FilterSource<T>, options?: QueryOptions): Query<T>;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport base from 'base-x';\n\nimport { schema } from '@dxos/protocols';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\n// Encode with URL-safe alpha-numeric characters.\nconst base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');\n\nconst codec = schema.getCodecForType('dxos.client.services.Invitation');\n\n/**\n * Encodes and decodes an invitation proto into/from alphanumeric chars.\n */\nexport class InvitationEncoder {\n static decode(text: string): Invitation {\n const decodedInvitation = codec.decode(base62.decode(text));\n if (decodedInvitation.type === Invitation.Type.MULTIUSE) {\n decodedInvitation.type = Invitation.Type.INTERACTIVE;\n decodedInvitation.multiUse = true;\n }\n return decodedInvitation;\n }\n\n static encode(invitation: Invitation): string {\n return base62.encode(\n codec.encode({\n invitationId: invitation.invitationId,\n type: invitation.type,\n kind: invitation.kind,\n authMethod: invitation.authMethod,\n swarmKey: invitation.swarmKey,\n state: invitation.state,\n timeout: invitation.timeout,\n guestKeypair: invitation.guestKeypair,\n // TODO(wittjosiah): Make these optional to encode for greater privacy.\n ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),\n ...(invitation.target ? { target: invitation.target } : {}),\n }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, type Observable, type Subscriber } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nexport const AUTHENTICATION_CODE_LENGTH = 6;\n\nexport const INVITATION_TIMEOUT = 3 * 60_000; // 3 mins.\n\nexport interface Invitations {\n created: MulticastObservable<CancellableInvitation[]>;\n accepted: MulticastObservable<AuthenticatingInvitation[]>;\n share(options?: Partial<Invitation>): CancellableInvitation;\n join(invitation: Invitation): AuthenticatingInvitation;\n}\n\n/**\n * Base class for all invitation observables and providers.\n */\nexport class CancellableInvitation extends MulticastObservable<Invitation> {\n private readonly _onCancel: () => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n }) {\n super(subscriber, initialInvitation);\n this._onCancel = onCancel;\n }\n\n cancel(): Promise<void> {\n return this._onCancel();\n }\n\n get expired() {\n const invitation = this.get();\n return (\n invitation.created &&\n invitation.lifetime &&\n invitation.lifetime !== 0 &&\n invitation.created.getTime() + invitation.lifetime * 1000 < Date.now()\n );\n }\n\n get expiry() {\n const invitation = this.get();\n return invitation.created && invitation.lifetime && invitation.lifetime !== 0\n ? new Date(invitation.created.getTime() + invitation.lifetime * 1000)\n : undefined;\n }\n}\n\n/**\n * Cancelable observer that relays authentication requests.\n */\nexport class AuthenticatingInvitation extends CancellableInvitation {\n private readonly _onAuthenticate: (authCode: string) => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n onAuthenticate,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n onAuthenticate: (authCode: string) => Promise<void>;\n }) {\n super({ subscriber, initialInvitation, onCancel });\n this._onAuthenticate = onAuthenticate;\n }\n\n async authenticate(authCode: string): Promise<void> {\n return this._onAuthenticate(authCode);\n }\n}\n\n/**\n * Testing util to wrap non-authenticating observable with promise.\n * Don't use this in production code.\n * @deprecated\n */\n// TODO(wittjosiah): Move to testing.\nexport const wrapObservable = async (observable: CancellableInvitation): Promise<Invitation> => {\n return new Promise((resolve, reject) => {\n const subscription = observable.subscribe(\n (invitation: Invitation | undefined) => {\n // TODO(burdon): Throw error if auth requested.\n invariant(invitation?.state === Invitation.State.SUCCESS);\n subscription.unsubscribe();\n resolve(invitation);\n },\n (err: Error) => {\n subscription.unsubscribe();\n reject(err);\n },\n );\n });\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { schema } from '@dxos/protocols';\nimport type { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport type {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService } from '@dxos/protocols/proto/dxos/echo/service';\nimport type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';\nimport type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';\nimport type { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { type ServiceBundle, createServiceBundle } from '@dxos/rpc';\n\n//\n// NOTE: Should contain client/proxy dependencies only.\n//\n\nexport type ClientServices = {\n SystemService: SystemService;\n NetworkService: NetworkService;\n LoggingService: LoggingService;\n\n IdentityService: IdentityService;\n InvitationsService: InvitationsService;\n QueryService: QueryService;\n DevicesService: DevicesService;\n SpacesService: SpacesService;\n DataService: DataService;\n\n FunctionRegistryService: FunctionRegistryService;\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: DevtoolsHost;\n\n TracingService: TracingService;\n};\n\n/**\n * Provide access to client services definitions and service handler.\n */\nexport interface ClientServicesProvider {\n /**\n * The connection to the services provider was terminated.\n * This should fire if the services disconnect unexpectedly or during a client reset.\n */\n closed: Event<Error | undefined>;\n descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n // TODO(burdon): Should take context from parent?\n open(): Promise<void>;\n close(): Promise<void>;\n}\n\n/**\n * Services supported by host.\n */\nexport const clientServiceBundle = createServiceBundle<ClientServices>({\n SystemService: schema.getService('dxos.client.services.SystemService'),\n NetworkService: schema.getService('dxos.client.services.NetworkService'),\n LoggingService: schema.getService('dxos.client.services.LoggingService'),\n\n IdentityService: schema.getService('dxos.client.services.IdentityService'),\n QueryService: schema.getService('dxos.echo.query.QueryService'),\n InvitationsService: schema.getService('dxos.client.services.InvitationsService'),\n DevicesService: schema.getService('dxos.client.services.DevicesService'),\n SpacesService: schema.getService('dxos.client.services.SpacesService'),\n DataService: schema.getService('dxos.echo.service.DataService'),\n\n // Agent-only.\n FunctionRegistryService: schema.getService('dxos.agent.functions.FunctionRegistryService'),\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),\n\n TracingService: schema.getService('dxos.tracing.TracingService'),\n});\n\nexport type IframeServiceBundle = {\n BridgeService: BridgeService;\n};\n\nexport const iframeServiceBundle: ServiceBundle<IframeServiceBundle> = {\n BridgeService: schema.getService('dxos.mesh.bridge.BridgeService'),\n};\n\nexport type WorkerServiceBundle = {\n WorkerService: WorkerService;\n};\n\nexport const workerServiceBundle: ServiceBundle<WorkerServiceBundle> = {\n WorkerService: schema.getService('dxos.iframe.WorkerService'),\n};\n\nexport type AppServiceBundle = {\n AppService: AppService;\n};\n\nexport const appServiceBundle: ServiceBundle<AppServiceBundle> = {\n AppService: schema.getService('dxos.iframe.AppService'),\n};\n\nexport type ShellServiceBundle = {\n ShellService: ShellService;\n};\n\nexport const shellServiceBundle: ServiceBundle<ShellServiceBundle> = {\n ShellService: schema.getService('dxos.iframe.ShellService'),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for making rpc connections from remote proxies.\n */\nexport const PROXY_CONNECTION_TIMEOUT = 30_000;\n\n/**\n * Timeout for the device to be added to the trusted set during auth.\n */\nexport const AUTH_TIMEOUT = 30_000;\n\n/**\n * Timeout for how long the remote client will wait before assuming the connection is lost.\n */\nexport const STATUS_TIMEOUT = 10_000;\n\n/**\n * Timeout for waiting before stealing resource lock.\n */\nexport const RESOURCE_LOCK_TIMEOUT = 3_000;\n\n/**\n * Timeout for space properties to be loaded in the set of tracked items.\n * Accounts for latency between SpaceService reporting the space as READY and DataService streaming the item states.\n */\nexport const LOAD_PROPERTIES_TIMEOUT = 3_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const CREATE_SPACE_TIMEOUT = 5_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\nexport class PropertiesType extends TypedObject({ typename: 'dxos.sdk.client.Properties', version: '0.1.0' })(\n {\n name: S.optional(S.String),\n },\n { record: true },\n) {}\n\n// TODO(burdon): Rename?\nexport type PropertiesTypeProps = Pick<PropertiesType, 'name'>;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAK9B,IAAMC,oBAAoB;AAE1B,IAAMC,0BAA0B;AAChC,IAAMC,gBAA6B;EAAEC,SAAS;AAAE;AAGvD,IAAMC,OAAO,OAAOC,YAAY,cAAcA,SAASC,KAAKF,QAAQ,KAAK;AAMlE,IAAMG,iBAAiB,CAACC,MAAcC,SAAiBC,OAA2BC,WACvF,GAAGH,IAAAA,YAAgBC,OAAAA,MAAaC,OAAO,IAAIA,IAAAA,KAAS;AAG/C,IAAME,YAAY,GAAGR,IAAAA;AAGrB,IAAMS,WAAW,GAAGT,IAAAA;AAIpB,IAAMU,UAAU,GAAGV,IAAAA;AAGnB,IAAMW,WAAW,GAAGX,IAAAA;AAGpB,IAAMY,aAAa;AAEnB,IAAMC,gBAAgB;AACtB,IAAMC,kBAAkB;AACxB,IAAMC,iBAAiB;AACvB,IAAMC,yBAAyB;;;
|
|
6
|
-
"names": ["DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_URL", "EXPECTED_CONFIG_VERSION", "defaultConfig", "version", "HOME", "process", "env", "getProfilePath", "root", "profile", "file", "undefined", "DX_CONFIG", "DX_CACHE", "DX_DATA", "DX_STATE", "DX_RUNTIME", "ENV_DX_CONFIG", "ENV_DX_NO_AGENT", "ENV_DX_PROFILE", "ENV_DX_PROFILE_DEFAULT", "
|
|
3
|
+
"sources": ["../../../src/config.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts", "../../../src/schema.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { type ConfigProto } from '@dxos/config';\n\nexport const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';\nexport const DEFAULT_CLIENT_CHANNEL = 'dxos:app';\nexport const DEFAULT_SHELL_CHANNEL = 'dxos:shell';\n\n/**\n * @deprecated\n */\nexport const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';\n\nexport const EXPECTED_CONFIG_VERSION = 1;\nexport const defaultConfig: ConfigProto = { version: 1 };\n\n// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.\nconst HOME = typeof process !== 'undefined' ? process?.env?.HOME ?? '' : '';\n\n// Base directories.\n// TODO(burdon): Consider Windows, Linux, OSX.\n// https://wiki.archlinux.org/title/XDG_Base_Directory\n// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.\nexport const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>\n `${root}/profile/${profile}` + (file ? `/${file}` : '');\n\n// XDG_CONFIG_HOME (Analogous to /etc.)\nexport const DX_CONFIG = `${HOME}/.config/dx`;\n\n// XDG_CACHE_HOME (Analogous to /var/cache).\nexport const DX_CACHE = `${HOME}/.cache/dx`;\n\n// TODO(burdon): Storage should use this by default (make path optional).\n// XDG_DATA_HOME (Analogous to /usr/share).\nexport const DX_DATA = `${HOME}/.local/share/dx`;\n\n// XDG_STATE_HOME (Analogous to /var/lib).\nexport const DX_STATE = `${HOME}/.local/state/dx`;\n\n// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)\nexport const DX_RUNTIME = '/tmp/dx/run';\n\nexport const ENV_DX_CONFIG = 'DX_CONFIG';\nexport const ENV_DX_NO_AGENT = 'DX_NO_AGENT';\nexport const ENV_DX_PROFILE = 'DX_PROFILE';\nexport const ENV_DX_PROFILE_DEFAULT = 'default';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport base from 'base-x';\n\nimport { schema } from '@dxos/protocols';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\n// Encode with URL-safe alpha-numeric characters.\nconst base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');\n\nconst codec = schema.getCodecForType('dxos.client.services.Invitation');\n\n/**\n * Encodes and decodes an invitation proto into/from alphanumeric chars.\n */\nexport class InvitationEncoder {\n static decode(text: string): Invitation {\n const decodedInvitation = codec.decode(base62.decode(text));\n if (decodedInvitation.type === Invitation.Type.MULTIUSE) {\n decodedInvitation.type = Invitation.Type.INTERACTIVE;\n decodedInvitation.multiUse = true;\n }\n return decodedInvitation;\n }\n\n static encode(invitation: Invitation): string {\n return base62.encode(\n codec.encode({\n invitationId: invitation.invitationId,\n type: invitation.type,\n kind: invitation.kind,\n authMethod: invitation.authMethod,\n swarmKey: invitation.swarmKey,\n state: invitation.state,\n timeout: invitation.timeout,\n guestKeypair: invitation.guestKeypair,\n // TODO(wittjosiah): Make these optional to encode for greater privacy.\n ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),\n ...(invitation.target ? { target: invitation.target } : {}),\n }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, type Observable, type Subscriber } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nexport const AUTHENTICATION_CODE_LENGTH = 6;\n\nexport const INVITATION_TIMEOUT = 3 * 60_000; // 3 mins.\n\nexport interface Invitations {\n created: MulticastObservable<CancellableInvitation[]>;\n accepted: MulticastObservable<AuthenticatingInvitation[]>;\n share(options?: Partial<Invitation>): CancellableInvitation;\n join(invitation: Invitation): AuthenticatingInvitation;\n}\n\n/**\n * Base class for all invitation observables and providers.\n */\nexport class CancellableInvitation extends MulticastObservable<Invitation> {\n private readonly _onCancel: () => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n }) {\n super(subscriber, initialInvitation);\n this._onCancel = onCancel;\n }\n\n cancel(): Promise<void> {\n return this._onCancel();\n }\n\n get expired() {\n const invitation = this.get();\n return (\n invitation.created &&\n invitation.lifetime &&\n invitation.lifetime !== 0 &&\n invitation.created.getTime() + invitation.lifetime * 1000 < Date.now()\n );\n }\n\n get expiry() {\n const invitation = this.get();\n return invitation.created && invitation.lifetime && invitation.lifetime !== 0\n ? new Date(invitation.created.getTime() + invitation.lifetime * 1000)\n : undefined;\n }\n}\n\n/**\n * Cancelable observer that relays authentication requests.\n */\nexport class AuthenticatingInvitation extends CancellableInvitation {\n private readonly _onAuthenticate: (authCode: string) => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n onAuthenticate,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n onAuthenticate: (authCode: string) => Promise<void>;\n }) {\n super({ subscriber, initialInvitation, onCancel });\n this._onAuthenticate = onAuthenticate;\n }\n\n async authenticate(authCode: string): Promise<void> {\n return this._onAuthenticate(authCode);\n }\n}\n\n/**\n * Testing util to wrap non-authenticating observable with promise.\n * Don't use this in production code.\n * @deprecated\n */\n// TODO(wittjosiah): Move to testing.\nexport const wrapObservable = async (observable: CancellableInvitation): Promise<Invitation> => {\n return new Promise((resolve, reject) => {\n const subscription = observable.subscribe(\n (invitation: Invitation | undefined) => {\n // TODO(burdon): Throw error if auth requested.\n invariant(invitation?.state === Invitation.State.SUCCESS);\n subscription.unsubscribe();\n resolve(invitation);\n },\n (err: Error) => {\n subscription.unsubscribe();\n reject(err);\n },\n );\n });\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { schema } from '@dxos/protocols';\nimport type { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport type {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n ContactsService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService } from '@dxos/protocols/proto/dxos/echo/service';\nimport type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';\nimport type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';\nimport type { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { type ServiceBundle, createServiceBundle } from '@dxos/rpc';\n\n//\n// NOTE: Should contain client/proxy dependencies only.\n//\n\nexport type ClientServices = {\n SystemService: SystemService;\n NetworkService: NetworkService;\n LoggingService: LoggingService;\n\n IdentityService: IdentityService;\n InvitationsService: InvitationsService;\n QueryService: QueryService;\n DevicesService: DevicesService;\n SpacesService: SpacesService;\n DataService: DataService;\n ContactsService: ContactsService;\n\n FunctionRegistryService: FunctionRegistryService;\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: DevtoolsHost;\n\n TracingService: TracingService;\n};\n\n/**\n * Provide access to client services definitions and service handler.\n */\nexport interface ClientServicesProvider {\n /**\n * The connection to the services provider was terminated.\n * This should fire if the services disconnect unexpectedly or during a client reset.\n */\n closed: Event<Error | undefined>;\n descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n // TODO(burdon): Should take context from parent?\n open(): Promise<void>;\n close(): Promise<void>;\n}\n\n/**\n * Services supported by host.\n */\nexport const clientServiceBundle = createServiceBundle<ClientServices>({\n SystemService: schema.getService('dxos.client.services.SystemService'),\n NetworkService: schema.getService('dxos.client.services.NetworkService'),\n LoggingService: schema.getService('dxos.client.services.LoggingService'),\n\n IdentityService: schema.getService('dxos.client.services.IdentityService'),\n QueryService: schema.getService('dxos.echo.query.QueryService'),\n InvitationsService: schema.getService('dxos.client.services.InvitationsService'),\n DevicesService: schema.getService('dxos.client.services.DevicesService'),\n SpacesService: schema.getService('dxos.client.services.SpacesService'),\n DataService: schema.getService('dxos.echo.service.DataService'),\n ContactsService: schema.getService('dxos.client.services.ContactsService'),\n\n // Agent-only.\n FunctionRegistryService: schema.getService('dxos.agent.functions.FunctionRegistryService'),\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),\n\n TracingService: schema.getService('dxos.tracing.TracingService'),\n});\n\nexport type IframeServiceBundle = {\n BridgeService: BridgeService;\n};\n\nexport const iframeServiceBundle: ServiceBundle<IframeServiceBundle> = {\n BridgeService: schema.getService('dxos.mesh.bridge.BridgeService'),\n};\n\nexport type WorkerServiceBundle = {\n WorkerService: WorkerService;\n};\n\nexport const workerServiceBundle: ServiceBundle<WorkerServiceBundle> = {\n WorkerService: schema.getService('dxos.iframe.WorkerService'),\n};\n\nexport type AppServiceBundle = {\n AppService: AppService;\n};\n\nexport const appServiceBundle: ServiceBundle<AppServiceBundle> = {\n AppService: schema.getService('dxos.iframe.AppService'),\n};\n\nexport type ShellServiceBundle = {\n ShellService: ShellService;\n};\n\nexport const shellServiceBundle: ServiceBundle<ShellServiceBundle> = {\n ShellService: schema.getService('dxos.iframe.ShellService'),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for making rpc connections from remote proxies.\n */\nexport const PROXY_CONNECTION_TIMEOUT = 30_000;\n\n/**\n * Timeout for the device to be added to the trusted set during auth.\n */\nexport const AUTH_TIMEOUT = 30_000;\n\n/**\n * Timeout for how long the remote client will wait before assuming the connection is lost.\n */\nexport const STATUS_TIMEOUT = 10_000;\n\n/**\n * Timeout for waiting before stealing resource lock.\n */\nexport const RESOURCE_LOCK_TIMEOUT = 3_000;\n\n/**\n * Timeout for space properties to be loaded in the set of tracked items.\n * Accounts for latency between SpaceService reporting the space as READY and DataService streaming the item states.\n */\nexport const LOAD_PROPERTIES_TIMEOUT = 3_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const CREATE_SPACE_TIMEOUT = 5_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TYPE_PROPERTIES, TypedObject } from '@dxos/echo-schema';\n\nexport class PropertiesType extends TypedObject({ typename: TYPE_PROPERTIES, version: '0.1.0' })(\n {\n name: S.optional(S.String),\n },\n { record: true },\n) {}\n\n// TODO(burdon): Rename?\nexport type PropertiesTypeProps = Pick<PropertiesType, 'name'>;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAK9B,IAAMC,oBAAoB;AAE1B,IAAMC,0BAA0B;AAChC,IAAMC,gBAA6B;EAAEC,SAAS;AAAE;AAGvD,IAAMC,OAAO,OAAOC,YAAY,cAAcA,SAASC,KAAKF,QAAQ,K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INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_URL", "EXPECTED_CONFIG_VERSION", "defaultConfig", "version", "HOME", "process", "env", "getProfilePath", "root", "profile", "file", "undefined", "DX_CONFIG", "DX_CACHE", "DX_DATA", "DX_STATE", "DX_RUNTIME", "ENV_DX_CONFIG", "ENV_DX_NO_AGENT", "ENV_DX_PROFILE", "ENV_DX_PROFILE_DEFAULT", "base", "schema", "Invitation", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "decodedInvitation", "type", "Invitation", "Type", "MULTIUSE", "INTERACTIVE", "multiUse", "encode", "invitation", "invitationId", "kind", "authMethod", "swarmKey", "state", "timeout", "guestKeypair", "spaceKey", "target", "MulticastObservable", "invariant", "Invitation", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "constructor", "subscriber", "initialInvitation", "onCancel", "_onCancel", "cancel", "expired", "invitation", "get", "created", "lifetime", "getTime", "Date", "now", "expiry", "undefined", "AuthenticatingInvitation", "onAuthenticate", "_onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "state", "State", "SUCCESS", "unsubscribe", "err", "schema", "createServiceBundle", "clientServiceBundle", "createServiceBundle", "SystemService", "schema", "getService", "NetworkService", "LoggingService", "IdentityService", "QueryService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "ContactsService", "FunctionRegistryService", "DevtoolsHost", "TracingService", "iframeServiceBundle", "BridgeService", "workerServiceBundle", "WorkerService", "appServiceBundle", "AppService", "shellServiceBundle", "ShellService", "PROXY_CONNECTION_TIMEOUT", "AUTH_TIMEOUT", "STATUS_TIMEOUT", "RESOURCE_LOCK_TIMEOUT", "LOAD_PROPERTIES_TIMEOUT", "CREATE_SPACE_TIMEOUT", "LOAD_CONTROL_FEEDS_TIMEOUT", "S", "TYPE_PROPERTIES", "TypedObject", "PropertiesType", "TypedObject", "typename", "TYPE_PROPERTIES", "version", "name", "S", "optional", "String", "record"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5942,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5942,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":3182,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/halo.ts":{"bytes":2809,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytes":5481,"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytes":9600,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/invitations/index.ts":{"bytes":610,"imports":[{"path":"packages/sdk/client-protocol/src/invitations/encoder.ts","kind":"import-statement","original":"./encoder"},{"path":"packages/sdk/client-protocol/src/invitations/invitations.ts","kind":"import-statement","original":"./invitations"}],"format":"esm"},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytes":9301,"imports":[{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/shell.ts":{"bytes":1500,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/space.ts":{"bytes":4931,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/timeouts.ts":{"bytes":3194,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/schema.ts":{"bytes":1505,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/index.ts":{"bytes":1408,"imports":[{"path":"packages/sdk/client-protocol/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/sdk/client-protocol/src/echo.ts","kind":"import-statement","original":"./echo"},{"path":"packages/sdk/client-protocol/src/halo.ts","kind":"import-statement","original":"./halo"},{"path":"packages/sdk/client-protocol/src/invitations/index.ts","kind":"import-statement","original":"./invitations"},{"path":"packages/sdk/client-protocol/src/service-definitions.ts","kind":"import-statement","original":"./service-definitions"},{"path":"packages/sdk/client-protocol/src/shell.ts","kind":"import-statement","original":"./shell"},{"path":"packages/sdk/client-protocol/src/space.ts","kind":"import-statement","original":"./space"},{"path":"packages/sdk/client-protocol/src/timeouts.ts","kind":"import-statement","original":"./timeouts"},{"path":"packages/sdk/client-protocol/src/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"}},"outputs":{"packages/sdk/client-protocol/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17687},"packages/sdk/client-protocol/dist/lib/browser/index.mjs":{"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["AUTHENTICATION_CODE_LENGTH","AUTH_TIMEOUT","AuthenticatingInvitation","CREATE_SPACE_TIMEOUT","CancellableInvitation","DEFAULT_CLIENT_CHANNEL","DEFAULT_INTERNAL_CHANNEL","DEFAULT_SHELL_CHANNEL","DEFAULT_VAULT_URL","DX_CACHE","DX_CONFIG","DX_DATA","DX_RUNTIME","DX_STATE","ENV_DX_CONFIG","ENV_DX_NO_AGENT","ENV_DX_PROFILE","ENV_DX_PROFILE_DEFAULT","EXPECTED_CONFIG_VERSION","INVITATION_TIMEOUT","InvitationEncoder","LOAD_CONTROL_FEEDS_TIMEOUT","LOAD_PROPERTIES_TIMEOUT","PROXY_CONNECTION_TIMEOUT","PropertiesType","RESOURCE_LOCK_TIMEOUT","STATUS_TIMEOUT","appServiceBundle","clientServiceBundle","defaultConfig","getProfilePath","iframeServiceBundle","shellServiceBundle","workerServiceBundle","wrapObservable"],"entryPoint":"packages/sdk/client-protocol/src/index.ts","inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytesInOutput":780},"packages/sdk/client-protocol/src/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytesInOutput":1242},"packages/sdk/client-protocol/src/invitations/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytesInOutput":1941},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytesInOutput":1573},"packages/sdk/client-protocol/src/timeouts.ts":{"bytesInOutput":224},"packages/sdk/client-protocol/src/schema.ts":{"bytesInOutput":228}},"bytes":7105}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -58,7 +58,6 @@ __export(node_exports, {
|
|
|
58
58
|
appServiceBundle: () => appServiceBundle,
|
|
59
59
|
clientServiceBundle: () => clientServiceBundle,
|
|
60
60
|
defaultConfig: () => defaultConfig,
|
|
61
|
-
defaultKey: () => defaultKey,
|
|
62
61
|
getProfilePath: () => getProfilePath,
|
|
63
62
|
iframeServiceBundle: () => iframeServiceBundle,
|
|
64
63
|
shellServiceBundle: () => shellServiceBundle,
|
|
@@ -94,7 +93,6 @@ var ENV_DX_CONFIG = "DX_CONFIG";
|
|
|
94
93
|
var ENV_DX_NO_AGENT = "DX_NO_AGENT";
|
|
95
94
|
var ENV_DX_PROFILE = "DX_PROFILE";
|
|
96
95
|
var ENV_DX_PROFILE_DEFAULT = "default";
|
|
97
|
-
var defaultKey = "__DEFAULT__";
|
|
98
96
|
var base62 = (0, import_base_x.default)("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
99
97
|
var codec = import_protocols.schema.getCodecForType("dxos.client.services.Invitation");
|
|
100
98
|
var InvitationEncoder = class {
|
|
@@ -189,6 +187,7 @@ var clientServiceBundle = (0, import_rpc.createServiceBundle)({
|
|
|
189
187
|
DevicesService: import_protocols2.schema.getService("dxos.client.services.DevicesService"),
|
|
190
188
|
SpacesService: import_protocols2.schema.getService("dxos.client.services.SpacesService"),
|
|
191
189
|
DataService: import_protocols2.schema.getService("dxos.echo.service.DataService"),
|
|
190
|
+
ContactsService: import_protocols2.schema.getService("dxos.client.services.ContactsService"),
|
|
192
191
|
// Agent-only.
|
|
193
192
|
FunctionRegistryService: import_protocols2.schema.getService("dxos.agent.functions.FunctionRegistryService"),
|
|
194
193
|
// TODO(burdon): Deprecated.
|
|
@@ -215,7 +214,7 @@ var LOAD_PROPERTIES_TIMEOUT = 3e3;
|
|
|
215
214
|
var CREATE_SPACE_TIMEOUT = 5e3;
|
|
216
215
|
var LOAD_CONTROL_FEEDS_TIMEOUT = 3e3;
|
|
217
216
|
var PropertiesType = class extends (0, import_echo_schema.TypedObject)({
|
|
218
|
-
typename:
|
|
217
|
+
typename: import_echo_schema.TYPE_PROPERTIES,
|
|
219
218
|
version: "0.1.0"
|
|
220
219
|
})({
|
|
221
220
|
name: import_echo_schema.S.optional(import_echo_schema.S.String)
|
|
@@ -255,7 +254,6 @@ var PropertiesType = class extends (0, import_echo_schema.TypedObject)({
|
|
|
255
254
|
appServiceBundle,
|
|
256
255
|
clientServiceBundle,
|
|
257
256
|
defaultConfig,
|
|
258
|
-
defaultKey,
|
|
259
257
|
getProfilePath,
|
|
260
258
|
iframeServiceBundle,
|
|
261
259
|
shellServiceBundle,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config.ts", "../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { type ConfigProto } from '@dxos/config';\n\nexport const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';\nexport const DEFAULT_CLIENT_CHANNEL = 'dxos:app';\nexport const DEFAULT_SHELL_CHANNEL = 'dxos:shell';\n\n/**\n * @deprecated\n */\nexport const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';\n\nexport const EXPECTED_CONFIG_VERSION = 1;\nexport const defaultConfig: ConfigProto = { version: 1 };\n\n// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.\nconst HOME = typeof process !== 'undefined' ? process?.env?.HOME ?? '' : '';\n\n// Base directories.\n// TODO(burdon): Consider Windows, Linux, OSX.\n// https://wiki.archlinux.org/title/XDG_Base_Directory\n// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.\nexport const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>\n `${root}/profile/${profile}` + (file ? `/${file}` : '');\n\n// XDG_CONFIG_HOME (Analogous to /etc.)\nexport const DX_CONFIG = `${HOME}/.config/dx`;\n\n// XDG_CACHE_HOME (Analogous to /var/cache).\nexport const DX_CACHE = `${HOME}/.cache/dx`;\n\n// TODO(burdon): Storage should use this by default (make path optional).\n// XDG_DATA_HOME (Analogous to /usr/share).\nexport const DX_DATA = `${HOME}/.local/share/dx`;\n\n// XDG_STATE_HOME (Analogous to /var/lib).\nexport const DX_STATE = `${HOME}/.local/state/dx`;\n\n// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)\nexport const DX_RUNTIME = '/tmp/dx/run';\n\nexport const ENV_DX_CONFIG = 'DX_CONFIG';\nexport const ENV_DX_NO_AGENT = 'DX_NO_AGENT';\nexport const ENV_DX_PROFILE = 'DX_PROFILE';\nexport const ENV_DX_PROFILE_DEFAULT = 'default';\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport type { MulticastObservable } from '@dxos/async';\nimport type { FilterSource, Query } from '@dxos/echo-db';\nimport type { PublicKey, SpaceId } from '@dxos/keys';\nimport type { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport type { QueryOptions } from '@dxos/protocols/proto/dxos/echo/filter';\n\nimport type { AuthenticatingInvitation } from './invitations';\nimport type { PropertiesTypeProps } from './schema';\nimport type { Space } from './space';\n\n// Space properties key for default metadata.\n// TODO(wittjosiah): Remove. Default space should be indicated by data in HALO space.\nexport const defaultKey = '__DEFAULT__';\n\n/**\n * TODO(burdon): Public API (move comments here).\n */\n// TODO(wittjosiah): Rename?\n// https://ts.dev/style/#naming-style\n// ClientApi? ClientProtocol?\nexport interface Echo extends MulticastObservable<Space[]> {\n /**\n * Resolves when the default space is available.\n */\n // TODO(wittjosiah): Remove. Ensure default space is always available.\n get isReady(): MulticastObservable<boolean>;\n\n /**\n * Returns the list of spaces.\n */\n get(): Space[];\n\n /**\n * Returns the space with the given id.\n */\n get(id: SpaceId): Space | undefined;\n\n /**\n * Returns the space with the given key.\n * @deprecated Use `get(id: SpaceId)`.\n */\n get(spaceKey: PublicKey): Space | undefined;\n\n /**\n * Returns the default space.\n */\n get default(): Space;\n\n /**\n * Creates a new space.\n */\n create(meta?: PropertiesTypeProps): Promise<Space>;\n\n /**\n * Creates a space from the given snapshot.\n */\n // clone(snapshot: SpaceSnapshot): Promise<Space>;\n\n /**\n * Joins an existing space using the given invitation.\n */\n join(invitation: Invitation | string): AuthenticatingInvitation;\n\n /**\n * Query all spaces.\n * @param filter\n * @param options\n */\n query<T extends {} = any>(filter?: FilterSource<T>, options?: QueryOptions): Query<T>;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport base from 'base-x';\n\nimport { schema } from '@dxos/protocols';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\n// Encode with URL-safe alpha-numeric characters.\nconst base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');\n\nconst codec = schema.getCodecForType('dxos.client.services.Invitation');\n\n/**\n * Encodes and decodes an invitation proto into/from alphanumeric chars.\n */\nexport class InvitationEncoder {\n static decode(text: string): Invitation {\n const decodedInvitation = codec.decode(base62.decode(text));\n if (decodedInvitation.type === Invitation.Type.MULTIUSE) {\n decodedInvitation.type = Invitation.Type.INTERACTIVE;\n decodedInvitation.multiUse = true;\n }\n return decodedInvitation;\n }\n\n static encode(invitation: Invitation): string {\n return base62.encode(\n codec.encode({\n invitationId: invitation.invitationId,\n type: invitation.type,\n kind: invitation.kind,\n authMethod: invitation.authMethod,\n swarmKey: invitation.swarmKey,\n state: invitation.state,\n timeout: invitation.timeout,\n guestKeypair: invitation.guestKeypair,\n // TODO(wittjosiah): Make these optional to encode for greater privacy.\n ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),\n ...(invitation.target ? { target: invitation.target } : {}),\n }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, type Observable, type Subscriber } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nexport const AUTHENTICATION_CODE_LENGTH = 6;\n\nexport const INVITATION_TIMEOUT = 3 * 60_000; // 3 mins.\n\nexport interface Invitations {\n created: MulticastObservable<CancellableInvitation[]>;\n accepted: MulticastObservable<AuthenticatingInvitation[]>;\n share(options?: Partial<Invitation>): CancellableInvitation;\n join(invitation: Invitation): AuthenticatingInvitation;\n}\n\n/**\n * Base class for all invitation observables and providers.\n */\nexport class CancellableInvitation extends MulticastObservable<Invitation> {\n private readonly _onCancel: () => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n }) {\n super(subscriber, initialInvitation);\n this._onCancel = onCancel;\n }\n\n cancel(): Promise<void> {\n return this._onCancel();\n }\n\n get expired() {\n const invitation = this.get();\n return (\n invitation.created &&\n invitation.lifetime &&\n invitation.lifetime !== 0 &&\n invitation.created.getTime() + invitation.lifetime * 1000 < Date.now()\n );\n }\n\n get expiry() {\n const invitation = this.get();\n return invitation.created && invitation.lifetime && invitation.lifetime !== 0\n ? new Date(invitation.created.getTime() + invitation.lifetime * 1000)\n : undefined;\n }\n}\n\n/**\n * Cancelable observer that relays authentication requests.\n */\nexport class AuthenticatingInvitation extends CancellableInvitation {\n private readonly _onAuthenticate: (authCode: string) => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n onAuthenticate,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n onAuthenticate: (authCode: string) => Promise<void>;\n }) {\n super({ subscriber, initialInvitation, onCancel });\n this._onAuthenticate = onAuthenticate;\n }\n\n async authenticate(authCode: string): Promise<void> {\n return this._onAuthenticate(authCode);\n }\n}\n\n/**\n * Testing util to wrap non-authenticating observable with promise.\n * Don't use this in production code.\n * @deprecated\n */\n// TODO(wittjosiah): Move to testing.\nexport const wrapObservable = async (observable: CancellableInvitation): Promise<Invitation> => {\n return new Promise((resolve, reject) => {\n const subscription = observable.subscribe(\n (invitation: Invitation | undefined) => {\n // TODO(burdon): Throw error if auth requested.\n invariant(invitation?.state === Invitation.State.SUCCESS);\n subscription.unsubscribe();\n resolve(invitation);\n },\n (err: Error) => {\n subscription.unsubscribe();\n reject(err);\n },\n );\n });\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { schema } from '@dxos/protocols';\nimport type { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport type {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService } from '@dxos/protocols/proto/dxos/echo/service';\nimport type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';\nimport type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';\nimport type { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { type ServiceBundle, createServiceBundle } from '@dxos/rpc';\n\n//\n// NOTE: Should contain client/proxy dependencies only.\n//\n\nexport type ClientServices = {\n SystemService: SystemService;\n NetworkService: NetworkService;\n LoggingService: LoggingService;\n\n IdentityService: IdentityService;\n InvitationsService: InvitationsService;\n QueryService: QueryService;\n DevicesService: DevicesService;\n SpacesService: SpacesService;\n DataService: DataService;\n\n FunctionRegistryService: FunctionRegistryService;\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: DevtoolsHost;\n\n TracingService: TracingService;\n};\n\n/**\n * Provide access to client services definitions and service handler.\n */\nexport interface ClientServicesProvider {\n /**\n * The connection to the services provider was terminated.\n * This should fire if the services disconnect unexpectedly or during a client reset.\n */\n closed: Event<Error | undefined>;\n descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n // TODO(burdon): Should take context from parent?\n open(): Promise<void>;\n close(): Promise<void>;\n}\n\n/**\n * Services supported by host.\n */\nexport const clientServiceBundle = createServiceBundle<ClientServices>({\n SystemService: schema.getService('dxos.client.services.SystemService'),\n NetworkService: schema.getService('dxos.client.services.NetworkService'),\n LoggingService: schema.getService('dxos.client.services.LoggingService'),\n\n IdentityService: schema.getService('dxos.client.services.IdentityService'),\n QueryService: schema.getService('dxos.echo.query.QueryService'),\n InvitationsService: schema.getService('dxos.client.services.InvitationsService'),\n DevicesService: schema.getService('dxos.client.services.DevicesService'),\n SpacesService: schema.getService('dxos.client.services.SpacesService'),\n DataService: schema.getService('dxos.echo.service.DataService'),\n\n // Agent-only.\n FunctionRegistryService: schema.getService('dxos.agent.functions.FunctionRegistryService'),\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),\n\n TracingService: schema.getService('dxos.tracing.TracingService'),\n});\n\nexport type IframeServiceBundle = {\n BridgeService: BridgeService;\n};\n\nexport const iframeServiceBundle: ServiceBundle<IframeServiceBundle> = {\n BridgeService: schema.getService('dxos.mesh.bridge.BridgeService'),\n};\n\nexport type WorkerServiceBundle = {\n WorkerService: WorkerService;\n};\n\nexport const workerServiceBundle: ServiceBundle<WorkerServiceBundle> = {\n WorkerService: schema.getService('dxos.iframe.WorkerService'),\n};\n\nexport type AppServiceBundle = {\n AppService: AppService;\n};\n\nexport const appServiceBundle: ServiceBundle<AppServiceBundle> = {\n AppService: schema.getService('dxos.iframe.AppService'),\n};\n\nexport type ShellServiceBundle = {\n ShellService: ShellService;\n};\n\nexport const shellServiceBundle: ServiceBundle<ShellServiceBundle> = {\n ShellService: schema.getService('dxos.iframe.ShellService'),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for making rpc connections from remote proxies.\n */\nexport const PROXY_CONNECTION_TIMEOUT = 30_000;\n\n/**\n * Timeout for the device to be added to the trusted set during auth.\n */\nexport const AUTH_TIMEOUT = 30_000;\n\n/**\n * Timeout for how long the remote client will wait before assuming the connection is lost.\n */\nexport const STATUS_TIMEOUT = 10_000;\n\n/**\n * Timeout for waiting before stealing resource lock.\n */\nexport const RESOURCE_LOCK_TIMEOUT = 3_000;\n\n/**\n * Timeout for space properties to be loaded in the set of tracked items.\n * Accounts for latency between SpaceService reporting the space as READY and DataService streaming the item states.\n */\nexport const LOAD_PROPERTIES_TIMEOUT = 3_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const CREATE_SPACE_TIMEOUT = 5_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\nexport class PropertiesType extends TypedObject({ typename: 'dxos.sdk.client.Properties', version: '0.1.0' })(\n {\n name: S.optional(S.String),\n },\n { record: true },\n) {}\n\n// TODO(burdon): Rename?\nexport type PropertiesTypeProps = Pick<PropertiesType, 'name'>;\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_services", "import_protocols", "DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_URL", "EXPECTED_CONFIG_VERSION", "defaultConfig", "version", "HOME", "process", "env", "getProfilePath", "root", "profile", "file", "undefined", "DX_CONFIG", "DX_CACHE", "DX_DATA", "DX_STATE", "DX_RUNTIME", "ENV_DX_CONFIG", "ENV_DX_NO_AGENT", "ENV_DX_PROFILE", "ENV_DX_PROFILE_DEFAULT", "
|
|
3
|
+
"sources": ["../../../src/config.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts", "../../../src/schema.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { type ConfigProto } from '@dxos/config';\n\nexport const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';\nexport const DEFAULT_CLIENT_CHANNEL = 'dxos:app';\nexport const DEFAULT_SHELL_CHANNEL = 'dxos:shell';\n\n/**\n * @deprecated\n */\nexport const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';\n\nexport const EXPECTED_CONFIG_VERSION = 1;\nexport const defaultConfig: ConfigProto = { version: 1 };\n\n// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.\nconst HOME = typeof process !== 'undefined' ? process?.env?.HOME ?? '' : '';\n\n// Base directories.\n// TODO(burdon): Consider Windows, Linux, OSX.\n// https://wiki.archlinux.org/title/XDG_Base_Directory\n// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.\nexport const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>\n `${root}/profile/${profile}` + (file ? `/${file}` : '');\n\n// XDG_CONFIG_HOME (Analogous to /etc.)\nexport const DX_CONFIG = `${HOME}/.config/dx`;\n\n// XDG_CACHE_HOME (Analogous to /var/cache).\nexport const DX_CACHE = `${HOME}/.cache/dx`;\n\n// TODO(burdon): Storage should use this by default (make path optional).\n// XDG_DATA_HOME (Analogous to /usr/share).\nexport const DX_DATA = `${HOME}/.local/share/dx`;\n\n// XDG_STATE_HOME (Analogous to /var/lib).\nexport const DX_STATE = `${HOME}/.local/state/dx`;\n\n// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)\nexport const DX_RUNTIME = '/tmp/dx/run';\n\nexport const ENV_DX_CONFIG = 'DX_CONFIG';\nexport const ENV_DX_NO_AGENT = 'DX_NO_AGENT';\nexport const ENV_DX_PROFILE = 'DX_PROFILE';\nexport const ENV_DX_PROFILE_DEFAULT = 'default';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport base from 'base-x';\n\nimport { schema } from '@dxos/protocols';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\n// Encode with URL-safe alpha-numeric characters.\nconst base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');\n\nconst codec = schema.getCodecForType('dxos.client.services.Invitation');\n\n/**\n * Encodes and decodes an invitation proto into/from alphanumeric chars.\n */\nexport class InvitationEncoder {\n static decode(text: string): Invitation {\n const decodedInvitation = codec.decode(base62.decode(text));\n if (decodedInvitation.type === Invitation.Type.MULTIUSE) {\n decodedInvitation.type = Invitation.Type.INTERACTIVE;\n decodedInvitation.multiUse = true;\n }\n return decodedInvitation;\n }\n\n static encode(invitation: Invitation): string {\n return base62.encode(\n codec.encode({\n invitationId: invitation.invitationId,\n type: invitation.type,\n kind: invitation.kind,\n authMethod: invitation.authMethod,\n swarmKey: invitation.swarmKey,\n state: invitation.state,\n timeout: invitation.timeout,\n guestKeypair: invitation.guestKeypair,\n // TODO(wittjosiah): Make these optional to encode for greater privacy.\n ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),\n ...(invitation.target ? { target: invitation.target } : {}),\n }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, type Observable, type Subscriber } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nexport const AUTHENTICATION_CODE_LENGTH = 6;\n\nexport const INVITATION_TIMEOUT = 3 * 60_000; // 3 mins.\n\nexport interface Invitations {\n created: MulticastObservable<CancellableInvitation[]>;\n accepted: MulticastObservable<AuthenticatingInvitation[]>;\n share(options?: Partial<Invitation>): CancellableInvitation;\n join(invitation: Invitation): AuthenticatingInvitation;\n}\n\n/**\n * Base class for all invitation observables and providers.\n */\nexport class CancellableInvitation extends MulticastObservable<Invitation> {\n private readonly _onCancel: () => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n }) {\n super(subscriber, initialInvitation);\n this._onCancel = onCancel;\n }\n\n cancel(): Promise<void> {\n return this._onCancel();\n }\n\n get expired() {\n const invitation = this.get();\n return (\n invitation.created &&\n invitation.lifetime &&\n invitation.lifetime !== 0 &&\n invitation.created.getTime() + invitation.lifetime * 1000 < Date.now()\n );\n }\n\n get expiry() {\n const invitation = this.get();\n return invitation.created && invitation.lifetime && invitation.lifetime !== 0\n ? new Date(invitation.created.getTime() + invitation.lifetime * 1000)\n : undefined;\n }\n}\n\n/**\n * Cancelable observer that relays authentication requests.\n */\nexport class AuthenticatingInvitation extends CancellableInvitation {\n private readonly _onAuthenticate: (authCode: string) => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n onAuthenticate,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n onAuthenticate: (authCode: string) => Promise<void>;\n }) {\n super({ subscriber, initialInvitation, onCancel });\n this._onAuthenticate = onAuthenticate;\n }\n\n async authenticate(authCode: string): Promise<void> {\n return this._onAuthenticate(authCode);\n }\n}\n\n/**\n * Testing util to wrap non-authenticating observable with promise.\n * Don't use this in production code.\n * @deprecated\n */\n// TODO(wittjosiah): Move to testing.\nexport const wrapObservable = async (observable: CancellableInvitation): Promise<Invitation> => {\n return new Promise((resolve, reject) => {\n const subscription = observable.subscribe(\n (invitation: Invitation | undefined) => {\n // TODO(burdon): Throw error if auth requested.\n invariant(invitation?.state === Invitation.State.SUCCESS);\n subscription.unsubscribe();\n resolve(invitation);\n },\n (err: Error) => {\n subscription.unsubscribe();\n reject(err);\n },\n );\n });\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { schema } from '@dxos/protocols';\nimport type { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport type {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n ContactsService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService } from '@dxos/protocols/proto/dxos/echo/service';\nimport type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';\nimport type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';\nimport type { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { type ServiceBundle, createServiceBundle } from '@dxos/rpc';\n\n//\n// NOTE: Should contain client/proxy dependencies only.\n//\n\nexport type ClientServices = {\n SystemService: SystemService;\n NetworkService: NetworkService;\n LoggingService: LoggingService;\n\n IdentityService: IdentityService;\n InvitationsService: InvitationsService;\n QueryService: QueryService;\n DevicesService: DevicesService;\n SpacesService: SpacesService;\n DataService: DataService;\n ContactsService: ContactsService;\n\n FunctionRegistryService: FunctionRegistryService;\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: DevtoolsHost;\n\n TracingService: TracingService;\n};\n\n/**\n * Provide access to client services definitions and service handler.\n */\nexport interface ClientServicesProvider {\n /**\n * The connection to the services provider was terminated.\n * This should fire if the services disconnect unexpectedly or during a client reset.\n */\n closed: Event<Error | undefined>;\n descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n // TODO(burdon): Should take context from parent?\n open(): Promise<void>;\n close(): Promise<void>;\n}\n\n/**\n * Services supported by host.\n */\nexport const clientServiceBundle = createServiceBundle<ClientServices>({\n SystemService: schema.getService('dxos.client.services.SystemService'),\n NetworkService: schema.getService('dxos.client.services.NetworkService'),\n LoggingService: schema.getService('dxos.client.services.LoggingService'),\n\n IdentityService: schema.getService('dxos.client.services.IdentityService'),\n QueryService: schema.getService('dxos.echo.query.QueryService'),\n InvitationsService: schema.getService('dxos.client.services.InvitationsService'),\n DevicesService: schema.getService('dxos.client.services.DevicesService'),\n SpacesService: schema.getService('dxos.client.services.SpacesService'),\n DataService: schema.getService('dxos.echo.service.DataService'),\n ContactsService: schema.getService('dxos.client.services.ContactsService'),\n\n // Agent-only.\n FunctionRegistryService: schema.getService('dxos.agent.functions.FunctionRegistryService'),\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),\n\n TracingService: schema.getService('dxos.tracing.TracingService'),\n});\n\nexport type IframeServiceBundle = {\n BridgeService: BridgeService;\n};\n\nexport const iframeServiceBundle: ServiceBundle<IframeServiceBundle> = {\n BridgeService: schema.getService('dxos.mesh.bridge.BridgeService'),\n};\n\nexport type WorkerServiceBundle = {\n WorkerService: WorkerService;\n};\n\nexport const workerServiceBundle: ServiceBundle<WorkerServiceBundle> = {\n WorkerService: schema.getService('dxos.iframe.WorkerService'),\n};\n\nexport type AppServiceBundle = {\n AppService: AppService;\n};\n\nexport const appServiceBundle: ServiceBundle<AppServiceBundle> = {\n AppService: schema.getService('dxos.iframe.AppService'),\n};\n\nexport type ShellServiceBundle = {\n ShellService: ShellService;\n};\n\nexport const shellServiceBundle: ServiceBundle<ShellServiceBundle> = {\n ShellService: schema.getService('dxos.iframe.ShellService'),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for making rpc connections from remote proxies.\n */\nexport const PROXY_CONNECTION_TIMEOUT = 30_000;\n\n/**\n * Timeout for the device to be added to the trusted set during auth.\n */\nexport const AUTH_TIMEOUT = 30_000;\n\n/**\n * Timeout for how long the remote client will wait before assuming the connection is lost.\n */\nexport const STATUS_TIMEOUT = 10_000;\n\n/**\n * Timeout for waiting before stealing resource lock.\n */\nexport const RESOURCE_LOCK_TIMEOUT = 3_000;\n\n/**\n * Timeout for space properties to be loaded in the set of tracked items.\n * Accounts for latency between SpaceService reporting the space as READY and DataService streaming the item states.\n */\nexport const LOAD_PROPERTIES_TIMEOUT = 3_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const CREATE_SPACE_TIMEOUT = 5_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TYPE_PROPERTIES, TypedObject } from '@dxos/echo-schema';\n\nexport class PropertiesType extends TypedObject({ typename: TYPE_PROPERTIES, version: '0.1.0' })(\n {\n name: S.optional(S.String),\n },\n { record: true },\n) {}\n\n// TODO(burdon): Rename?\nexport type PropertiesTypeProps = Pick<PropertiesType, 'name'>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,oBAAiB;AAEjB,uBAAuB;AACvB,sBAA2B;ACH3B,mBAAsE;AACtE,uBAA0B;AAC1B,IAAAA,mBAA2B;ACD3B,IAAAC,oBAAuB;AAkBvB,iBAAwD;AEnBxD,yBAAgD;ALEzC,IAAMC,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAK9B,IAAMC,oB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EAC5F;EACEkH,MAAMC,qBAAEC,SAASD,qBAAEE,MAAM;AAC3B,GACA;EAAEC,QAAQ;AAAK,CAAA,EAAA;AACd;",
|
|
6
|
+
"names": ["import_services", "import_protocols", "DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_URL", "EXPECTED_CONFIG_VERSION", "defaultConfig", "version", "HOME", "process", "env", "getProfilePath", "root", "profile", "file", "undefined", "DX_CONFIG", "DX_CACHE", "DX_DATA", "DX_STATE", "DX_RUNTIME", "ENV_DX_CONFIG", "ENV_DX_NO_AGENT", "ENV_DX_PROFILE", "ENV_DX_PROFILE_DEFAULT", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "decodedInvitation", "type", "Invitation", "Type", "MULTIUSE", "INTERACTIVE", "multiUse", "encode", "invitation", "invitationId", "kind", "authMethod", "swarmKey", "state", "timeout", "guestKeypair", "spaceKey", "target", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "MulticastObservable", "constructor", "subscriber", "initialInvitation", "onCancel", "_onCancel", "cancel", "expired", "get", "created", "lifetime", "getTime", "Date", "now", "expiry", "AuthenticatingInvitation", "onAuthenticate", "_onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "invariant", "State", "SUCCESS", "unsubscribe", "err", "clientServiceBundle", "createServiceBundle", "SystemService", "getService", "NetworkService", "LoggingService", "IdentityService", "QueryService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "ContactsService", "FunctionRegistryService", "DevtoolsHost", "TracingService", "iframeServiceBundle", "BridgeService", "workerServiceBundle", "WorkerService", "appServiceBundle", "AppService", "shellServiceBundle", "ShellService", "PROXY_CONNECTION_TIMEOUT", "AUTH_TIMEOUT", "STATUS_TIMEOUT", "RESOURCE_LOCK_TIMEOUT", "LOAD_PROPERTIES_TIMEOUT", "CREATE_SPACE_TIMEOUT", "LOAD_CONTROL_FEEDS_TIMEOUT", "PropertiesType", "TypedObject", "typename", "TYPE_PROPERTIES", "name", "S", "optional", "String", "record"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5942,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5942,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":3182,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/halo.ts":{"bytes":2809,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytes":5481,"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytes":9600,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/invitations/index.ts":{"bytes":610,"imports":[{"path":"packages/sdk/client-protocol/src/invitations/encoder.ts","kind":"import-statement","original":"./encoder"},{"path":"packages/sdk/client-protocol/src/invitations/invitations.ts","kind":"import-statement","original":"./invitations"}],"format":"esm"},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytes":9301,"imports":[{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/shell.ts":{"bytes":1500,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/space.ts":{"bytes":4931,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/timeouts.ts":{"bytes":3194,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/schema.ts":{"bytes":1505,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/index.ts":{"bytes":1408,"imports":[{"path":"packages/sdk/client-protocol/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/sdk/client-protocol/src/echo.ts","kind":"import-statement","original":"./echo"},{"path":"packages/sdk/client-protocol/src/halo.ts","kind":"import-statement","original":"./halo"},{"path":"packages/sdk/client-protocol/src/invitations/index.ts","kind":"import-statement","original":"./invitations"},{"path":"packages/sdk/client-protocol/src/service-definitions.ts","kind":"import-statement","original":"./service-definitions"},{"path":"packages/sdk/client-protocol/src/shell.ts","kind":"import-statement","original":"./shell"},{"path":"packages/sdk/client-protocol/src/space.ts","kind":"import-statement","original":"./space"},{"path":"packages/sdk/client-protocol/src/timeouts.ts","kind":"import-statement","original":"./timeouts"},{"path":"packages/sdk/client-protocol/src/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"}},"outputs":{"packages/sdk/client-protocol/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17687},"packages/sdk/client-protocol/dist/lib/node/index.cjs":{"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["AUTHENTICATION_CODE_LENGTH","AUTH_TIMEOUT","AuthenticatingInvitation","CREATE_SPACE_TIMEOUT","CancellableInvitation","DEFAULT_CLIENT_CHANNEL","DEFAULT_INTERNAL_CHANNEL","DEFAULT_SHELL_CHANNEL","DEFAULT_VAULT_URL","DX_CACHE","DX_CONFIG","DX_DATA","DX_RUNTIME","DX_STATE","ENV_DX_CONFIG","ENV_DX_NO_AGENT","ENV_DX_PROFILE","ENV_DX_PROFILE_DEFAULT","EXPECTED_CONFIG_VERSION","INVITATION_TIMEOUT","InvitationEncoder","LOAD_CONTROL_FEEDS_TIMEOUT","LOAD_PROPERTIES_TIMEOUT","PROXY_CONNECTION_TIMEOUT","PropertiesType","RESOURCE_LOCK_TIMEOUT","STATUS_TIMEOUT","appServiceBundle","clientServiceBundle","defaultConfig","getProfilePath","iframeServiceBundle","shellServiceBundle","workerServiceBundle","wrapObservable"],"entryPoint":"packages/sdk/client-protocol/src/index.ts","inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytesInOutput":780},"packages/sdk/client-protocol/src/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytesInOutput":1242},"packages/sdk/client-protocol/src/invitations/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytesInOutput":1941},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytesInOutput":1573},"packages/sdk/client-protocol/src/timeouts.ts":{"bytesInOutput":224},"packages/sdk/client-protocol/src/schema.ts":{"bytesInOutput":228}},"bytes":7105}}}
|
package/dist/types/src/echo.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type { QueryOptions } from '@dxos/protocols/proto/dxos/echo/filter';
|
|
|
6
6
|
import type { AuthenticatingInvitation } from './invitations';
|
|
7
7
|
import type { PropertiesTypeProps } from './schema';
|
|
8
8
|
import type { Space } from './space';
|
|
9
|
-
export declare const defaultKey = "__DEFAULT__";
|
|
10
9
|
/**
|
|
11
10
|
* TODO(burdon): Public API (move comments here).
|
|
12
11
|
*/
|
|
@@ -43,6 +42,7 @@ export interface Echo extends MulticastObservable<Space[]> {
|
|
|
43
42
|
* Joins an existing space using the given invitation.
|
|
44
43
|
*/
|
|
45
44
|
join(invitation: Invitation | string): AuthenticatingInvitation;
|
|
45
|
+
joinBySpaceKey(spaceKey: PublicKey): Promise<Space>;
|
|
46
46
|
/**
|
|
47
47
|
* Query all spaces.
|
|
48
48
|
* @param filter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../src/echo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../src/echo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;GAEG;AAIH,MAAM,WAAW,IAAK,SAAQ,mBAAmB,CAAC,KAAK,EAAE,CAAC;IACxD;;OAEG;IAEH,IAAI,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE5C;;OAEG;IACH,GAAG,IAAI,KAAK,EAAE,CAAC;IAEf;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IAEpC;;;OAGG;IACH,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;IAE5C;;OAEG;IACH,IAAI,OAAO,IAAI,KAAK,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAEnD;;OAEG;IAGH;;OAEG;IACH,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,wBAAwB,CAAC;IAEhE,cAAc,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAEpD;;;;OAIG;IACH,KAAK,CAAC,CAAC,SAAS,EAAE,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;CACvF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Event } from '@dxos/async';
|
|
2
2
|
import type { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';
|
|
3
|
-
import type { DevicesService, IdentityService, InvitationsService, LoggingService, NetworkService, SpacesService, SystemService } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
|
+
import type { DevicesService, IdentityService, InvitationsService, LoggingService, NetworkService, SpacesService, SystemService, ContactsService } from '@dxos/protocols/proto/dxos/client/services';
|
|
4
4
|
import type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';
|
|
5
5
|
import type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';
|
|
6
6
|
import type { DataService } from '@dxos/protocols/proto/dxos/echo/service';
|
|
@@ -18,6 +18,7 @@ export type ClientServices = {
|
|
|
18
18
|
DevicesService: DevicesService;
|
|
19
19
|
SpacesService: SpacesService;
|
|
20
20
|
DataService: DataService;
|
|
21
|
+
ContactsService: ContactsService;
|
|
21
22
|
FunctionRegistryService: FunctionRegistryService;
|
|
22
23
|
DevtoolsHost: DevtoolsHost;
|
|
23
24
|
TracingService: TracingService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-definitions.d.ts","sourceRoot":"","sources":["../../../src/service-definitions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"service-definitions.d.ts","sourceRoot":"","sources":["../../../src/service-definitions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,eAAe,EAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EA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;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,mBAAmB,CAElE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,gBAAgB,CAE5D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,kBAAkB,CAEhE,CAAC"}
|
|
@@ -5,7 +5,9 @@ export interface ShellRuntime {
|
|
|
5
5
|
layoutUpdate: Event<LayoutRequest>;
|
|
6
6
|
invitationUrlUpdate: Event<InvitationUrlRequest>;
|
|
7
7
|
layout: ShellLayout;
|
|
8
|
+
/** @deprecated Use spaceId. */
|
|
8
9
|
spaceKey?: PublicKey;
|
|
10
|
+
spaceId?: string;
|
|
9
11
|
target?: string;
|
|
10
12
|
invitationCode?: string;
|
|
11
13
|
invitationUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/shell.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACnC,mBAAmB,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MA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IAAI,CAAC,CAAC;CAC9D"}
|
|
@@ -2,14 +2,22 @@ import { type MulticastObservable, type UnsubscribeCallback } from '@dxos/async'
|
|
|
2
2
|
import { type EchoDatabase } from '@dxos/echo-db';
|
|
3
3
|
import { type EchoReactiveObject } from '@dxos/echo-schema';
|
|
4
4
|
import { type PublicKey, type SpaceId } from '@dxos/keys';
|
|
5
|
-
import { type Invitation, type Space as SpaceData, type SpaceMember, type SpaceState, type UpdateMemberRoleRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
5
|
+
import { type CreateEpochRequest, type Invitation, type Space as SpaceData, type SpaceMember, type SpaceState, type UpdateMemberRoleRequest, type Contact } from '@dxos/protocols/proto/dxos/client/services';
|
|
6
6
|
import { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
7
7
|
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
8
8
|
import { type CancellableInvitation } from './invitations';
|
|
9
|
+
export type CreateEpochOptions = {
|
|
10
|
+
migration?: CreateEpochRequest.Migration;
|
|
11
|
+
automergeRootUrl?: string;
|
|
12
|
+
};
|
|
9
13
|
export interface SpaceInternal {
|
|
10
14
|
get data(): SpaceData;
|
|
11
|
-
createEpoch(): Promise<void>;
|
|
15
|
+
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
12
16
|
removeMember(memberKey: PublicKey): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Migrate space data to the latest version.
|
|
19
|
+
*/
|
|
20
|
+
migrate(): Promise<void>;
|
|
13
21
|
}
|
|
14
22
|
export interface Space {
|
|
15
23
|
/**
|
|
@@ -62,6 +70,7 @@ export interface Space {
|
|
|
62
70
|
waitUntilReady(): Promise<this>;
|
|
63
71
|
createSnapshot(): Promise<SpaceSnapshot>;
|
|
64
72
|
share(options?: Partial<Invitation>): CancellableInvitation;
|
|
73
|
+
admitContact(contact: Contact): Promise<void>;
|
|
65
74
|
updateMemberRole(request: Omit<UpdateMemberRoleRequest, 'spaceKey'>): Promise<void>;
|
|
66
75
|
postMessage: (channel: string, message: any) => Promise<void>;
|
|
67
76
|
listen: (channel: string, callback: (message: GossipMessage) => void) => UnsubscribeCallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,KAAK,IAAI,SAAS,EACvB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,KAAK,IAAI,SAAS,EACvB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,OAAO,EACb,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iDAAiD,CAAC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ACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAGzC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,qBAAqB,CAAC;IAE5D,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGpF,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,KAAK,mBAAmB,CAAC;CAC9F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-protocol",
|
|
3
|
-
"version": "0.5.9-main.
|
|
3
|
+
"version": "0.5.9-main.9a55396",
|
|
4
4
|
"description": "Core DXOS Client API.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"base-x": "~3.0.9",
|
|
21
|
-
"@dxos/async": "0.5.9-main.
|
|
22
|
-
"@dxos/config": "0.5.9-main.
|
|
23
|
-
"@dxos/context": "0.5.9-main.
|
|
24
|
-
"@dxos/echo-
|
|
25
|
-
"@dxos/
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/keys": "0.5.9-main.
|
|
28
|
-
"@dxos/node-std": "0.5.9-main.
|
|
29
|
-
"@dxos/rpc": "0.5.9-main.
|
|
30
|
-
"@dxos/protocols": "0.5.9-main.
|
|
21
|
+
"@dxos/async": "0.5.9-main.9a55396",
|
|
22
|
+
"@dxos/config": "0.5.9-main.9a55396",
|
|
23
|
+
"@dxos/context": "0.5.9-main.9a55396",
|
|
24
|
+
"@dxos/echo-schema": "0.5.9-main.9a55396",
|
|
25
|
+
"@dxos/echo-db": "0.5.9-main.9a55396",
|
|
26
|
+
"@dxos/invariant": "0.5.9-main.9a55396",
|
|
27
|
+
"@dxos/keys": "0.5.9-main.9a55396",
|
|
28
|
+
"@dxos/node-std": "0.5.9-main.9a55396",
|
|
29
|
+
"@dxos/rpc": "0.5.9-main.9a55396",
|
|
30
|
+
"@dxos/protocols": "0.5.9-main.9a55396"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@dxos/echo-typegen": "0.5.9-main.
|
|
33
|
+
"@dxos/echo-typegen": "0.5.9-main.9a55396"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
package/src/echo.ts
CHANGED
|
@@ -12,10 +12,6 @@ import type { AuthenticatingInvitation } from './invitations';
|
|
|
12
12
|
import type { PropertiesTypeProps } from './schema';
|
|
13
13
|
import type { Space } from './space';
|
|
14
14
|
|
|
15
|
-
// Space properties key for default metadata.
|
|
16
|
-
// TODO(wittjosiah): Remove. Default space should be indicated by data in HALO space.
|
|
17
|
-
export const defaultKey = '__DEFAULT__';
|
|
18
|
-
|
|
19
15
|
/**
|
|
20
16
|
* TODO(burdon): Public API (move comments here).
|
|
21
17
|
*/
|
|
@@ -65,6 +61,8 @@ export interface Echo extends MulticastObservable<Space[]> {
|
|
|
65
61
|
*/
|
|
66
62
|
join(invitation: Invitation | string): AuthenticatingInvitation;
|
|
67
63
|
|
|
64
|
+
joinBySpaceKey(spaceKey: PublicKey): Promise<Space>;
|
|
65
|
+
|
|
68
66
|
/**
|
|
69
67
|
* Query all spaces.
|
|
70
68
|
* @param filter
|
package/src/schema.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { S, TypedObject } from '@dxos/echo-schema';
|
|
5
|
+
import { S, TYPE_PROPERTIES, TypedObject } from '@dxos/echo-schema';
|
|
6
6
|
|
|
7
|
-
export class PropertiesType extends TypedObject({ typename:
|
|
7
|
+
export class PropertiesType extends TypedObject({ typename: TYPE_PROPERTIES, version: '0.1.0' })(
|
|
8
8
|
{
|
|
9
9
|
name: S.optional(S.String),
|
|
10
10
|
},
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
NetworkService,
|
|
14
14
|
SpacesService,
|
|
15
15
|
SystemService,
|
|
16
|
+
ContactsService,
|
|
16
17
|
} from '@dxos/protocols/proto/dxos/client/services';
|
|
17
18
|
import type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';
|
|
18
19
|
import type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';
|
|
@@ -37,6 +38,7 @@ export type ClientServices = {
|
|
|
37
38
|
DevicesService: DevicesService;
|
|
38
39
|
SpacesService: SpacesService;
|
|
39
40
|
DataService: DataService;
|
|
41
|
+
ContactsService: ContactsService;
|
|
40
42
|
|
|
41
43
|
FunctionRegistryService: FunctionRegistryService;
|
|
42
44
|
|
|
@@ -77,6 +79,7 @@ export const clientServiceBundle = createServiceBundle<ClientServices>({
|
|
|
77
79
|
DevicesService: schema.getService('dxos.client.services.DevicesService'),
|
|
78
80
|
SpacesService: schema.getService('dxos.client.services.SpacesService'),
|
|
79
81
|
DataService: schema.getService('dxos.echo.service.DataService'),
|
|
82
|
+
ContactsService: schema.getService('dxos.client.services.ContactsService'),
|
|
80
83
|
|
|
81
84
|
// Agent-only.
|
|
82
85
|
FunctionRegistryService: schema.getService('dxos.agent.functions.FunctionRegistryService'),
|
package/src/shell.ts
CHANGED
|
@@ -15,7 +15,9 @@ export interface ShellRuntime {
|
|
|
15
15
|
layoutUpdate: Event<LayoutRequest>;
|
|
16
16
|
invitationUrlUpdate: Event<InvitationUrlRequest>;
|
|
17
17
|
layout: ShellLayout;
|
|
18
|
+
/** @deprecated Use spaceId. */
|
|
18
19
|
spaceKey?: PublicKey;
|
|
20
|
+
spaceId?: string;
|
|
19
21
|
target?: string;
|
|
20
22
|
invitationCode?: string;
|
|
21
23
|
invitationUrl: string;
|
package/src/space.ts
CHANGED
|
@@ -7,24 +7,36 @@ import { type EchoDatabase } from '@dxos/echo-db';
|
|
|
7
7
|
import { type EchoReactiveObject } from '@dxos/echo-schema';
|
|
8
8
|
import { type PublicKey, type SpaceId } from '@dxos/keys';
|
|
9
9
|
import {
|
|
10
|
+
type CreateEpochRequest,
|
|
10
11
|
type Invitation,
|
|
11
12
|
type Space as SpaceData,
|
|
12
13
|
type SpaceMember,
|
|
13
14
|
type SpaceState,
|
|
14
15
|
type UpdateMemberRoleRequest,
|
|
16
|
+
type Contact,
|
|
15
17
|
} from '@dxos/protocols/proto/dxos/client/services';
|
|
16
18
|
import { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
17
19
|
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
18
20
|
|
|
19
21
|
import { type CancellableInvitation } from './invitations';
|
|
20
22
|
|
|
23
|
+
export type CreateEpochOptions = {
|
|
24
|
+
migration?: CreateEpochRequest.Migration;
|
|
25
|
+
automergeRootUrl?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
21
28
|
export interface SpaceInternal {
|
|
22
29
|
get data(): SpaceData;
|
|
23
30
|
|
|
24
31
|
// TODO(dmaretskyi): Return epoch info.
|
|
25
|
-
createEpoch(): Promise<void>;
|
|
32
|
+
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
26
33
|
|
|
27
34
|
removeMember(memberKey: PublicKey): Promise<void>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Migrate space data to the latest version.
|
|
38
|
+
*/
|
|
39
|
+
migrate(): Promise<void>;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
// TODO(burdon): Separate public API form implementation (move comments here).
|
|
@@ -43,6 +55,7 @@ export interface Space {
|
|
|
43
55
|
* Echo database.
|
|
44
56
|
*/
|
|
45
57
|
get db(): EchoDatabase;
|
|
58
|
+
|
|
46
59
|
get isOpen(): boolean;
|
|
47
60
|
|
|
48
61
|
/**
|
|
@@ -63,6 +76,7 @@ export interface Space {
|
|
|
63
76
|
get pipeline(): MulticastObservable<SpaceData.PipelineState>;
|
|
64
77
|
|
|
65
78
|
get invitations(): MulticastObservable<CancellableInvitation[]>;
|
|
79
|
+
|
|
66
80
|
get members(): MulticastObservable<SpaceMember[]>;
|
|
67
81
|
|
|
68
82
|
/**
|
|
@@ -77,6 +91,7 @@ export interface Space {
|
|
|
77
91
|
* The setting is persisted on the local device.
|
|
78
92
|
*/
|
|
79
93
|
open(): Promise<void>;
|
|
94
|
+
|
|
80
95
|
/**
|
|
81
96
|
* Deactivates the space stopping replication with other peers.
|
|
82
97
|
* The space will not auto-open on the next app launch.
|
|
@@ -93,6 +108,9 @@ export interface Space {
|
|
|
93
108
|
|
|
94
109
|
// TODO(burdon): Create invitation?
|
|
95
110
|
share(options?: Partial<Invitation>): CancellableInvitation;
|
|
111
|
+
|
|
112
|
+
admitContact(contact: Contact): Promise<void>;
|
|
113
|
+
|
|
96
114
|
updateMemberRole(request: Omit<UpdateMemberRoleRequest, 'spaceKey'>): Promise<void>;
|
|
97
115
|
|
|
98
116
|
// TODO(wittjosiah): Gather into messaging abstraction?
|