@dxos/client-protocol 0.1.58-main.f5feb2a → 0.1.58-main.f69fa2f
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 +41 -16
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +28 -0
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/echo.d.ts +5 -0
- package/dist/types/src/echo.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/proto/gen/schema.d.ts +15 -0
- package/dist/types/src/proto/gen/schema.d.ts.map +1 -0
- package/dist/types/src/proto/index.d.ts +2 -0
- package/dist/types/src/proto/index.d.ts.map +1 -0
- package/package.json +20 -14
- package/src/echo.ts +10 -0
- package/src/index.ts +1 -0
- package/src/proto/gen/schema.ts +34 -0
- package/src/proto/index.ts +5 -0
- package/src/proto/schema.proto +16 -0
|
@@ -19,6 +19,9 @@ var ENV_DX_CONFIG = "DX_CONFIG";
|
|
|
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
|
+
|
|
22
25
|
// packages/sdk/client-protocol/src/invitations/encoder.ts
|
|
23
26
|
import base from "base-x";
|
|
24
27
|
import { schema } from "@dxos/protocols";
|
|
@@ -91,35 +94,54 @@ var wrapObservable = async (observable) => {
|
|
|
91
94
|
});
|
|
92
95
|
};
|
|
93
96
|
|
|
97
|
+
// packages/sdk/client-protocol/src/proto/gen/schema.ts
|
|
98
|
+
import * as dxos_echo_schema from "@dxos/echo-schema";
|
|
99
|
+
var schemaJson = '{"nested":{"dxos":{"nested":{"sdk":{"nested":{"client":{"nested":{"Properties":{"options":{"(object)":true},"fields":{"name":{"type":"string","id":1}}}}}}}}}}}';
|
|
100
|
+
var schema2 = dxos_echo_schema.EchoSchema.fromJson(schemaJson);
|
|
101
|
+
var Properties = class _Properties extends dxos_echo_schema.TypedObject {
|
|
102
|
+
static {
|
|
103
|
+
this.type = schema2.getType("dxos.sdk.client.Properties");
|
|
104
|
+
}
|
|
105
|
+
static filter(opts) {
|
|
106
|
+
return _Properties.type.createFilter(opts);
|
|
107
|
+
}
|
|
108
|
+
constructor(initValues, opts) {
|
|
109
|
+
super({
|
|
110
|
+
...initValues
|
|
111
|
+
}, _Properties.type, opts);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
schema2.registerPrototype(Properties);
|
|
115
|
+
|
|
94
116
|
// packages/sdk/client-protocol/src/service-definitions.ts
|
|
95
|
-
import { schema as
|
|
117
|
+
import { schema as schema3 } from "@dxos/protocols";
|
|
96
118
|
import { createServiceBundle } from "@dxos/rpc";
|
|
97
119
|
var clientServiceBundle = createServiceBundle({
|
|
98
|
-
SystemService:
|
|
99
|
-
NetworkService:
|
|
100
|
-
LoggingService:
|
|
101
|
-
IdentityService:
|
|
102
|
-
InvitationsService:
|
|
103
|
-
DevicesService:
|
|
104
|
-
SpacesService:
|
|
105
|
-
DataService:
|
|
120
|
+
SystemService: schema3.getService("dxos.client.services.SystemService"),
|
|
121
|
+
NetworkService: schema3.getService("dxos.client.services.NetworkService"),
|
|
122
|
+
LoggingService: schema3.getService("dxos.client.services.LoggingService"),
|
|
123
|
+
IdentityService: schema3.getService("dxos.client.services.IdentityService"),
|
|
124
|
+
InvitationsService: schema3.getService("dxos.client.services.InvitationsService"),
|
|
125
|
+
DevicesService: schema3.getService("dxos.client.services.DevicesService"),
|
|
126
|
+
SpacesService: schema3.getService("dxos.client.services.SpacesService"),
|
|
127
|
+
DataService: schema3.getService("dxos.echo.service.DataService"),
|
|
106
128
|
// Agent-only.
|
|
107
|
-
FunctionRegistryService:
|
|
129
|
+
FunctionRegistryService: schema3.getService("dxos.agent.functions.FunctionRegistryService"),
|
|
108
130
|
// TODO(burdon): Deprecated.
|
|
109
|
-
DevtoolsHost:
|
|
110
|
-
TracingService:
|
|
131
|
+
DevtoolsHost: schema3.getService("dxos.devtools.host.DevtoolsHost"),
|
|
132
|
+
TracingService: schema3.getService("dxos.tracing.TracingService")
|
|
111
133
|
});
|
|
112
134
|
var iframeServiceBundle = {
|
|
113
|
-
BridgeService:
|
|
135
|
+
BridgeService: schema3.getService("dxos.mesh.bridge.BridgeService")
|
|
114
136
|
};
|
|
115
137
|
var workerServiceBundle = {
|
|
116
|
-
WorkerService:
|
|
138
|
+
WorkerService: schema3.getService("dxos.iframe.WorkerService")
|
|
117
139
|
};
|
|
118
140
|
var appServiceBundle = {
|
|
119
|
-
AppService:
|
|
141
|
+
AppService: schema3.getService("dxos.iframe.AppService")
|
|
120
142
|
};
|
|
121
143
|
var shellServiceBundle = {
|
|
122
|
-
ShellService:
|
|
144
|
+
ShellService: schema3.getService("dxos.iframe.ShellService")
|
|
123
145
|
};
|
|
124
146
|
|
|
125
147
|
// packages/sdk/client-protocol/src/timeouts.ts
|
|
@@ -155,13 +177,16 @@ export {
|
|
|
155
177
|
LOAD_CONTROL_FEEDS_TIMEOUT,
|
|
156
178
|
LOAD_PROPERTIES_TIMEOUT,
|
|
157
179
|
PROXY_CONNECTION_TIMEOUT,
|
|
180
|
+
Properties,
|
|
158
181
|
RESOURCE_LOCK_TIMEOUT,
|
|
159
182
|
STATUS_TIMEOUT,
|
|
160
183
|
appServiceBundle,
|
|
161
184
|
clientServiceBundle,
|
|
162
185
|
defaultConfig,
|
|
186
|
+
defaultKey,
|
|
163
187
|
getProfilePath,
|
|
164
188
|
iframeServiceBundle,
|
|
189
|
+
schema2 as schema,
|
|
165
190
|
shellServiceBundle,
|
|
166
191
|
workerServiceBundle,
|
|
167
192
|
wrapObservable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { 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\nexport const DEFAULT_VAULT_ORIGIN = 'https://halo.dxos.org';\nexport const DEFAULT_VAULT_URL = DEFAULT_VAULT_ORIGIN + '/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_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 return codec.decode(base62.decode(text));\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 }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, Observable, 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\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 { Context } from '@dxos/context';\nimport { schema } from '@dxos/protocols';\nimport { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport { 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 { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { createServiceBundle, ServiceBundle } 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 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 descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n open(ctx: Context): Promise<void>;\n close(ctx: Context): 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 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 = 3_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAE9B,IAAMC,uBAAuB;AAC7B,IAAMC,oBAAoBD,uBAAuB;AAEjD,IAAME,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,iBAAiB;AACvB,IAAMC,yBAAyB;;;
|
|
6
|
-
"names": ["DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_ORIGIN", "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_PROFILE", "ENV_DX_PROFILE_DEFAULT", "base", "schema", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "encode", "invitation", "invitationId", "type", "kind", "authMethod", "swarmKey", "state", "timeout", "MulticastObservable", "invariant", "Invitation", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "constructor", "subscriber", "initialInvitation", "onCancel", "_onCancel", "cancel", "AuthenticatingInvitation", "onAuthenticate", "_onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "invitation", "state", "State", "SUCCESS", "unsubscribe", "err", "schema", "createServiceBundle", "clientServiceBundle", "createServiceBundle", "SystemService", "schema", "getService", "NetworkService", "LoggingService", "IdentityService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "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"]
|
|
3
|
+
"sources": ["../../../src/config.ts", "../../../src/echo.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/proto/gen/schema.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { 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\nexport const DEFAULT_VAULT_ORIGIN = 'https://halo.dxos.org';\nexport const DEFAULT_VAULT_URL = DEFAULT_VAULT_ORIGIN + '/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_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 { EchoSchema } from '@dxos/echo-schema';\nimport type { PublicKey } from '@dxos/keys';\nimport type { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nimport type { AuthenticatingInvitation } from './invitations';\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 key.\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(): 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 * Adds a schema to ECHO.\n */\n addSchema(schema: EchoSchema): void;\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 return codec.decode(base62.decode(text));\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 }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, Observable, 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\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 * @generated @dxos/echo-typegen src/proto/schema.proto\n **/\n\nimport * as dxos_echo_schema from \"@dxos/echo-schema\";\n\nconst schemaJson =\n '{\"nested\":{\"dxos\":{\"nested\":{\"sdk\":{\"nested\":{\"client\":{\"nested\":{\"Properties\":{\"options\":{\"(object)\":true},\"fields\":{\"name\":{\"type\":\"string\",\"id\":1}}}}}}}}}}}';\n\nexport const schema = dxos_echo_schema.EchoSchema.fromJson(schemaJson);\n\nexport type PropertiesProps = {\n name: string;\n};\n\nexport class Properties extends dxos_echo_schema.TypedObject<PropertiesProps> {\n static readonly type = schema.getType(\"dxos.sdk.client.Properties\");\n\n static filter(\n opts?: Partial<PropertiesProps>\n ): dxos_echo_schema.TypeFilter<Properties> {\n return Properties.type.createFilter(opts);\n }\n\n constructor(\n initValues?: Partial<PropertiesProps>,\n opts?: dxos_echo_schema.TypedObjectOpts\n ) {\n super({ ...initValues }, Properties.type, opts);\n }\n declare name: string;\n}\n\nschema.registerPrototype(Properties);\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { Context } from '@dxos/context';\nimport { schema } from '@dxos/protocols';\nimport { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport { 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 { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { createServiceBundle, ServiceBundle } 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 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 descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n open(ctx: Context): Promise<void>;\n close(ctx: Context): 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 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 = 3_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAE9B,IAAMC,uBAAuB;AAC7B,IAAMC,oBAAoBD,uBAAuB;AAEjD,IAAME,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,O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EAG3CS,cAAcV,QAAOC,WAAW,iCAAA;EAEhCU,gBAAgBX,QAAOC,WAAW,6BAAA;AACpC,CAAA;AAMO,IAAMW,sBAA0D;EACrEC,eAAeb,QAAOC,WAAW,gCAAA;AACnC;AAMO,IAAMa,sBAA0D;EACrEC,eAAef,QAAOC,WAAW,2BAAA;AACnC;AAMO,IAAMe,mBAAoD;EAC/DC,YAAYjB,QAAOC,WAAW,wBAAA;AAChC;AAMO,IAAMiB,qBAAwD;EACnEC,cAAcnB,QAAOC,WAAW,0BAAA;AAClC;;;ACvGO,IAAMmB,2BAA2B;AAKjC,IAAMC,eAAe;AAKrB,IAAMC,iBAAiB;AAKvB,IAAMC,wBAAwB;AAM9B,IAAMC,0BAA0B;AAKhC,IAAMC,uBAAuB;AAK7B,IAAMC,6BAA6B;",
|
|
6
|
+
"names": ["DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_ORIGIN", "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_PROFILE", "ENV_DX_PROFILE_DEFAULT", "defaultKey", "base", "schema", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "encode", "invitation", "invitationId", "type", "kind", "authMethod", "swarmKey", "state", "timeout", "MulticastObservable", "invariant", "Invitation", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "constructor", "subscriber", "initialInvitation", "onCancel", "_onCancel", "cancel", "AuthenticatingInvitation", "onAuthenticate", "_onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "invitation", "state", "State", "SUCCESS", "unsubscribe", "err", "dxos_echo_schema", "schemaJson", "schema", "EchoSchema", "fromJson", "Properties", "TypedObject", "type", "getType", "filter", "opts", "createFilter", "constructor", "initValues", "registerPrototype", "schema", "createServiceBundle", "clientServiceBundle", "createServiceBundle", "SystemService", "schema", "getService", "NetworkService", "LoggingService", "IdentityService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "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"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5848,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5848,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":2780,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/halo.ts":{"bytes":1687,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytes":3446,"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytes":7737,"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":578,"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/proto/gen/schema.ts":{"bytes":3164,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/proto/index.ts":{"bytes":480,"imports":[{"path":"packages/sdk/client-protocol/src/proto/gen/schema.ts","kind":"import-statement","original":"./gen/schema"}],"format":"esm"},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytes":8188,"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":1004,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/space.ts":{"bytes":3784,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/timeouts.ts":{"bytes":3134,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/index.ts":{"bytes":1167,"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/proto/index.ts","kind":"import-statement","original":"./proto"},{"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"}],"format":"esm"}},"outputs":{"packages/sdk/client-protocol/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17749},"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/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/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/rpc","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_ORIGIN","DEFAULT_VAULT_URL","DX_CACHE","DX_CONFIG","DX_DATA","DX_RUNTIME","DX_STATE","ENV_DX_CONFIG","ENV_DX_PROFILE","ENV_DX_PROFILE_DEFAULT","EXPECTED_CONFIG_VERSION","INVITATION_TIMEOUT","InvitationEncoder","LOAD_CONTROL_FEEDS_TIMEOUT","LOAD_PROPERTIES_TIMEOUT","PROXY_CONNECTION_TIMEOUT","Properties","RESOURCE_LOCK_TIMEOUT","STATUS_TIMEOUT","appServiceBundle","clientServiceBundle","defaultConfig","defaultKey","getProfilePath","iframeServiceBundle","schema","shellServiceBundle","workerServiceBundle","wrapObservable"],"entryPoint":"packages/sdk/client-protocol/src/index.ts","inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytesInOutput":797},"packages/sdk/client-protocol/src/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/echo.ts":{"bytesInOutput":32},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytesInOutput":663},"packages/sdk/client-protocol/src/invitations/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytesInOutput":1495},"packages/sdk/client-protocol/src/proto/gen/schema.ts":{"bytesInOutput":671},"packages/sdk/client-protocol/src/proto/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytesInOutput":1426},"packages/sdk/client-protocol/src/timeouts.ts":{"bytesInOutput":224}},"bytes":6516}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -54,13 +54,16 @@ __export(src_exports, {
|
|
|
54
54
|
LOAD_CONTROL_FEEDS_TIMEOUT: () => LOAD_CONTROL_FEEDS_TIMEOUT,
|
|
55
55
|
LOAD_PROPERTIES_TIMEOUT: () => LOAD_PROPERTIES_TIMEOUT,
|
|
56
56
|
PROXY_CONNECTION_TIMEOUT: () => PROXY_CONNECTION_TIMEOUT,
|
|
57
|
+
Properties: () => Properties,
|
|
57
58
|
RESOURCE_LOCK_TIMEOUT: () => RESOURCE_LOCK_TIMEOUT,
|
|
58
59
|
STATUS_TIMEOUT: () => STATUS_TIMEOUT,
|
|
59
60
|
appServiceBundle: () => appServiceBundle,
|
|
60
61
|
clientServiceBundle: () => clientServiceBundle,
|
|
61
62
|
defaultConfig: () => defaultConfig,
|
|
63
|
+
defaultKey: () => defaultKey,
|
|
62
64
|
getProfilePath: () => getProfilePath,
|
|
63
65
|
iframeServiceBundle: () => iframeServiceBundle,
|
|
66
|
+
schema: () => schema2,
|
|
64
67
|
shellServiceBundle: () => shellServiceBundle,
|
|
65
68
|
workerServiceBundle: () => workerServiceBundle,
|
|
66
69
|
wrapObservable: () => wrapObservable
|
|
@@ -88,6 +91,9 @@ var ENV_DX_CONFIG = "DX_CONFIG";
|
|
|
88
91
|
var ENV_DX_PROFILE = "DX_PROFILE";
|
|
89
92
|
var ENV_DX_PROFILE_DEFAULT = "default";
|
|
90
93
|
|
|
94
|
+
// packages/sdk/client-protocol/src/echo.ts
|
|
95
|
+
var defaultKey = "__DEFAULT__";
|
|
96
|
+
|
|
91
97
|
// packages/sdk/client-protocol/src/invitations/encoder.ts
|
|
92
98
|
var import_base_x = __toESM(require("base-x"));
|
|
93
99
|
var import_protocols = require("@dxos/protocols");
|
|
@@ -160,6 +166,25 @@ var wrapObservable = async (observable) => {
|
|
|
160
166
|
});
|
|
161
167
|
};
|
|
162
168
|
|
|
169
|
+
// packages/sdk/client-protocol/src/proto/gen/schema.ts
|
|
170
|
+
var dxos_echo_schema = __toESM(require("@dxos/echo-schema"));
|
|
171
|
+
var schemaJson = '{"nested":{"dxos":{"nested":{"sdk":{"nested":{"client":{"nested":{"Properties":{"options":{"(object)":true},"fields":{"name":{"type":"string","id":1}}}}}}}}}}}';
|
|
172
|
+
var schema2 = dxos_echo_schema.EchoSchema.fromJson(schemaJson);
|
|
173
|
+
var Properties = class _Properties extends dxos_echo_schema.TypedObject {
|
|
174
|
+
static {
|
|
175
|
+
this.type = schema2.getType("dxos.sdk.client.Properties");
|
|
176
|
+
}
|
|
177
|
+
static filter(opts) {
|
|
178
|
+
return _Properties.type.createFilter(opts);
|
|
179
|
+
}
|
|
180
|
+
constructor(initValues, opts) {
|
|
181
|
+
super({
|
|
182
|
+
...initValues
|
|
183
|
+
}, _Properties.type, opts);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
schema2.registerPrototype(Properties);
|
|
187
|
+
|
|
163
188
|
// packages/sdk/client-protocol/src/service-definitions.ts
|
|
164
189
|
var import_protocols2 = require("@dxos/protocols");
|
|
165
190
|
var import_rpc = require("@dxos/rpc");
|
|
@@ -225,13 +250,16 @@ var LOAD_CONTROL_FEEDS_TIMEOUT = 3e3;
|
|
|
225
250
|
LOAD_CONTROL_FEEDS_TIMEOUT,
|
|
226
251
|
LOAD_PROPERTIES_TIMEOUT,
|
|
227
252
|
PROXY_CONNECTION_TIMEOUT,
|
|
253
|
+
Properties,
|
|
228
254
|
RESOURCE_LOCK_TIMEOUT,
|
|
229
255
|
STATUS_TIMEOUT,
|
|
230
256
|
appServiceBundle,
|
|
231
257
|
clientServiceBundle,
|
|
232
258
|
defaultConfig,
|
|
259
|
+
defaultKey,
|
|
233
260
|
getProfilePath,
|
|
234
261
|
iframeServiceBundle,
|
|
262
|
+
schema,
|
|
235
263
|
shellServiceBundle,
|
|
236
264
|
workerServiceBundle,
|
|
237
265
|
wrapObservable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/index.ts", "../../../src/config.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from './config';\nexport * from './echo';\nexport * from './halo';\nexport * from './invitations';\nexport * from './service-definitions';\nexport * from './shell';\nexport * from './space';\nexport * from './timeouts';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { 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\nexport const DEFAULT_VAULT_ORIGIN = 'https://halo.dxos.org';\nexport const DEFAULT_VAULT_URL = DEFAULT_VAULT_ORIGIN + '/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_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 return codec.decode(base62.decode(text));\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 }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, Observable, 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\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 { Context } from '@dxos/context';\nimport { schema } from '@dxos/protocols';\nimport { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport { 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 { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { createServiceBundle, ServiceBundle } 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 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 descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n open(ctx: Context): Promise<void>;\n close(ctx: Context): 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 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 = 3_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
6
|
-
"names": ["DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_ORIGIN", "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_PROFILE", "ENV_DX_PROFILE_DEFAULT", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "encode", "invitation", "invitationId", "type", "kind", "authMethod", "swarmKey", "state", "timeout", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "MulticastObservable", "constructor", "subscriber", "initialInvitation", "onCancel", "_onCancel", "cancel", "AuthenticatingInvitation", "onAuthenticate", "_onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "invitation", "invariant", "state", "Invitation", "State", "SUCCESS", "unsubscribe", "err", "import_protocols", "clientServiceBundle", "createServiceBundle", "SystemService", "schema", "getService", "NetworkService", "LoggingService", "IdentityService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "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"]
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/config.ts", "../../../src/echo.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/proto/gen/schema.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from './config';\nexport * from './echo';\nexport * from './halo';\nexport * from './invitations';\nexport * from './proto';\nexport * from './service-definitions';\nexport * from './shell';\nexport * from './space';\nexport * from './timeouts';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { 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\nexport const DEFAULT_VAULT_ORIGIN = 'https://halo.dxos.org';\nexport const DEFAULT_VAULT_URL = DEFAULT_VAULT_ORIGIN + '/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_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 { EchoSchema } from '@dxos/echo-schema';\nimport type { PublicKey } from '@dxos/keys';\nimport type { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nimport type { AuthenticatingInvitation } from './invitations';\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 key.\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(): 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 * Adds a schema to ECHO.\n */\n addSchema(schema: EchoSchema): void;\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 return codec.decode(base62.decode(text));\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 }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, Observable, 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\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 * @generated @dxos/echo-typegen src/proto/schema.proto\n **/\n\nimport * as dxos_echo_schema from \"@dxos/echo-schema\";\n\nconst schemaJson =\n '{\"nested\":{\"dxos\":{\"nested\":{\"sdk\":{\"nested\":{\"client\":{\"nested\":{\"Properties\":{\"options\":{\"(object)\":true},\"fields\":{\"name\":{\"type\":\"string\",\"id\":1}}}}}}}}}}}';\n\nexport const schema = dxos_echo_schema.EchoSchema.fromJson(schemaJson);\n\nexport type PropertiesProps = {\n name: string;\n};\n\nexport class Properties extends dxos_echo_schema.TypedObject<PropertiesProps> {\n static readonly type = schema.getType(\"dxos.sdk.client.Properties\");\n\n static filter(\n opts?: Partial<PropertiesProps>\n ): dxos_echo_schema.TypeFilter<Properties> {\n return Properties.type.createFilter(opts);\n }\n\n constructor(\n initValues?: Partial<PropertiesProps>,\n opts?: dxos_echo_schema.TypedObjectOpts\n ) {\n super({ ...initValues }, Properties.type, opts);\n }\n declare name: string;\n}\n\nschema.registerPrototype(Properties);\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { Context } from '@dxos/context';\nimport { schema } from '@dxos/protocols';\nimport { FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';\nimport {\n DevicesService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport { 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 { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { createServiceBundle, ServiceBundle } 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 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 descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n open(ctx: Context): Promise<void>;\n close(ctx: Context): 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 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 = 3_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAAA;EAAA;;;;;;;ACMO,IAAMC,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAE9B,IAAMC,uBAAuB;AAC7B,IAAMC,oBAAoBD,uBAAuB;AAEjD,IAAME,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,IA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A;AACnC;AAMO,IAAMa,sBAA0D;EACrEC,eAAef,yBAAOC,WAAW,2BAAA;AACnC;AAMO,IAAMe,mBAAoD;EAC/DC,YAAYjB,yBAAOC,WAAW,wBAAA;AAChC;AAMO,IAAMiB,qBAAwD;EACnEC,cAAcnB,yBAAOC,WAAW,0BAAA;AAClC;;;ACvGO,IAAMmB,2BAA2B;AAKjC,IAAMC,eAAe;AAKrB,IAAMC,iBAAiB;AAKvB,IAAMC,wBAAwB;AAM9B,IAAMC,0BAA0B;AAKhC,IAAMC,uBAAuB;AAK7B,IAAMC,6BAA6B;",
|
|
6
|
+
"names": ["schema", "DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_VAULT_ORIGIN", "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_PROFILE", "ENV_DX_PROFILE_DEFAULT", "defaultKey", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "encode", "invitation", "invitationId", "type", "kind", "authMethod", "swarmKey", "state", "timeout", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "MulticastObservable", "constructor", "subscriber", "initialInvitation", "onCancel", "_onCancel", "cancel", "AuthenticatingInvitation", "onAuthenticate", "_onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "invitation", "invariant", "state", "Invitation", "State", "SUCCESS", "unsubscribe", "err", "schemaJson", "schema", "EchoSchema", "fromJson", "Properties", "TypedObject", "type", "getType", "filter", "opts", "createFilter", "constructor", "initValues", "registerPrototype", "import_protocols", "clientServiceBundle", "createServiceBundle", "SystemService", "schema", "getService", "NetworkService", "LoggingService", "IdentityService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "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"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5848,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/client-protocol/src/config.ts":{"bytes":5848,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/echo.ts":{"bytes":2780,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/halo.ts":{"bytes":1687,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytes":3446,"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytes":7737,"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":578,"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/proto/gen/schema.ts":{"bytes":3164,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/client-protocol/src/proto/index.ts":{"bytes":480,"imports":[{"path":"packages/sdk/client-protocol/src/proto/gen/schema.ts","kind":"import-statement","original":"./gen/schema"}],"format":"esm"},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytes":8188,"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":1004,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/space.ts":{"bytes":3784,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/timeouts.ts":{"bytes":3134,"imports":[],"format":"esm"},"packages/sdk/client-protocol/src/index.ts":{"bytes":1167,"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/proto/index.ts","kind":"import-statement","original":"./proto"},{"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"}],"format":"esm"}},"outputs":{"packages/sdk/client-protocol/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18094},"packages/sdk/client-protocol/dist/lib/node/index.cjs":{"imports":[{"path":"base-x","kind":"require-call","external":true},{"path":"@dxos/protocols","kind":"require-call","external":true},{"path":"@dxos/async","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"require-call","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"require-call","external":true},{"path":"@dxos/echo-schema","kind":"require-call","external":true},{"path":"@dxos/protocols","kind":"require-call","external":true},{"path":"@dxos/rpc","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/sdk/client-protocol/src/index.ts","inputs":{"packages/sdk/client-protocol/src/index.ts":{"bytesInOutput":1782},"packages/sdk/client-protocol/src/config.ts":{"bytesInOutput":797},"packages/sdk/client-protocol/src/echo.ts":{"bytesInOutput":32},"packages/sdk/client-protocol/src/invitations/encoder.ts":{"bytesInOutput":732},"packages/sdk/client-protocol/src/invitations/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/invitations/invitations.ts":{"bytesInOutput":1548},"packages/sdk/client-protocol/src/proto/gen/schema.ts":{"bytesInOutput":678},"packages/sdk/client-protocol/src/proto/index.ts":{"bytesInOutput":0},"packages/sdk/client-protocol/src/service-definitions.ts":{"bytesInOutput":1686},"packages/sdk/client-protocol/src/timeouts.ts":{"bytesInOutput":224}},"bytes":10198}}}
|
package/dist/types/src/echo.d.ts
CHANGED
|
@@ -4,10 +4,15 @@ import type { PublicKey } from '@dxos/keys';
|
|
|
4
4
|
import type { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
5
5
|
import type { AuthenticatingInvitation } from './invitations';
|
|
6
6
|
import type { Space } from './space';
|
|
7
|
+
export declare const defaultKey = "__DEFAULT__";
|
|
7
8
|
/**
|
|
8
9
|
* TODO(burdon): Public API (move comments here).
|
|
9
10
|
*/
|
|
10
11
|
export interface Echo extends MulticastObservable<Space[]> {
|
|
12
|
+
/**
|
|
13
|
+
* Resolves when the default space is available.
|
|
14
|
+
*/
|
|
15
|
+
get isReady(): MulticastObservable<boolean>;
|
|
11
16
|
/**
|
|
12
17
|
* Returns the list of spaces.
|
|
13
18
|
*/
|
|
@@ -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,E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AM,EAAE,UAAU,GAAG,IAAI,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated @dxos/echo-typegen src/proto/schema.proto
|
|
3
|
+
**/
|
|
4
|
+
import * as dxos_echo_schema from "@dxos/echo-schema";
|
|
5
|
+
export declare const schema: dxos_echo_schema.EchoSchema;
|
|
6
|
+
export type PropertiesProps = {
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class Properties extends dxos_echo_schema.TypedObject<PropertiesProps> {
|
|
10
|
+
static readonly type: dxos_echo_schema.EchoSchemaType;
|
|
11
|
+
static filter(opts?: Partial<PropertiesProps>): dxos_echo_schema.TypeFilter<Properties>;
|
|
12
|
+
constructor(initValues?: Partial<PropertiesProps>, opts?: dxos_echo_schema.TypedObjectOpts);
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../src/proto/gen/schema.ts"],"names":[],"mappings":"AAAA;;IAEI;AAEJ,OAAO,KAAK,gBAAgB,MAAM,mBAAmB,CAAC;AAKtD,eAAO,MAAM,MAAM,6BAAmD,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,UAAW,SAAQ,gBAAgB,CAAC,WAAW,CAAC,eAAe,CAAC;IAC3E,MAAM,CAAC,QAAQ,CAAC,IAAI,kCAAgD;IAEpE,MAAM,CAAC,MAAM,CACX,IAAI,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAC9B,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC;gBAKxC,UAAU,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACrC,IAAI,CAAC,EAAE,gBAAgB,CAAC,eAAe;IAIjC,IAAI,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/proto/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-protocol",
|
|
3
|
-
"version": "0.1.58-main.
|
|
3
|
+
"version": "0.1.58-main.f69fa2f",
|
|
4
4
|
"description": "Core DXOS Client API.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -18,21 +18,27 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"base-x": "~3.0.9",
|
|
21
|
-
"@dxos/async": "0.1.58-main.
|
|
22
|
-
"@dxos/config": "0.1.58-main.
|
|
23
|
-
"@dxos/context": "0.1.58-main.
|
|
24
|
-
"@dxos/document-model": "0.1.58-main.
|
|
25
|
-
"@dxos/echo-db": "0.1.58-main.
|
|
26
|
-
"@dxos/echo-schema": "0.1.58-main.
|
|
27
|
-
"@dxos/invariant": "0.1.58-main.
|
|
28
|
-
"@dxos/keys": "0.1.58-main.
|
|
29
|
-
"@dxos/model-factory": "0.1.58-main.
|
|
30
|
-
"@dxos/node-std": "0.1.58-main.
|
|
31
|
-
"@dxos/protocols": "0.1.58-main.
|
|
32
|
-
"@dxos/rpc": "0.1.58-main.
|
|
33
|
-
"@dxos/text-model": "0.1.58-main.
|
|
21
|
+
"@dxos/async": "0.1.58-main.f69fa2f",
|
|
22
|
+
"@dxos/config": "0.1.58-main.f69fa2f",
|
|
23
|
+
"@dxos/context": "0.1.58-main.f69fa2f",
|
|
24
|
+
"@dxos/document-model": "0.1.58-main.f69fa2f",
|
|
25
|
+
"@dxos/echo-db": "0.1.58-main.f69fa2f",
|
|
26
|
+
"@dxos/echo-schema": "0.1.58-main.f69fa2f",
|
|
27
|
+
"@dxos/invariant": "0.1.58-main.f69fa2f",
|
|
28
|
+
"@dxos/keys": "0.1.58-main.f69fa2f",
|
|
29
|
+
"@dxos/model-factory": "0.1.58-main.f69fa2f",
|
|
30
|
+
"@dxos/node-std": "0.1.58-main.f69fa2f",
|
|
31
|
+
"@dxos/protocols": "0.1.58-main.f69fa2f",
|
|
32
|
+
"@dxos/rpc": "0.1.58-main.f69fa2f",
|
|
33
|
+
"@dxos/text-model": "0.1.58-main.f69fa2f"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@dxos/echo-typegen": "0.1.58-main.f69fa2f"
|
|
34
37
|
},
|
|
35
38
|
"publishConfig": {
|
|
36
39
|
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"prebuild": "dxtype src/proto/schema.proto src/proto/gen/schema.ts"
|
|
37
43
|
}
|
|
38
44
|
}
|
package/src/echo.ts
CHANGED
|
@@ -10,6 +10,10 @@ import type { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
|
10
10
|
import type { AuthenticatingInvitation } from './invitations';
|
|
11
11
|
import type { Space } from './space';
|
|
12
12
|
|
|
13
|
+
// Space properties key for default metadata.
|
|
14
|
+
// TODO(wittjosiah): Remove. Default space should be indicated by data in HALO space.
|
|
15
|
+
export const defaultKey = '__DEFAULT__';
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
18
|
* TODO(burdon): Public API (move comments here).
|
|
15
19
|
*/
|
|
@@ -17,6 +21,12 @@ import type { Space } from './space';
|
|
|
17
21
|
// https://ts.dev/style/#naming-style
|
|
18
22
|
// ClientApi? ClientProtocol?
|
|
19
23
|
export interface Echo extends MulticastObservable<Space[]> {
|
|
24
|
+
/**
|
|
25
|
+
* Resolves when the default space is available.
|
|
26
|
+
*/
|
|
27
|
+
// TODO(wittjosiah): Remove. Ensure default space is always available.
|
|
28
|
+
get isReady(): MulticastObservable<boolean>;
|
|
29
|
+
|
|
20
30
|
/**
|
|
21
31
|
* Returns the list of spaces.
|
|
22
32
|
*/
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated @dxos/echo-typegen src/proto/schema.proto
|
|
3
|
+
**/
|
|
4
|
+
|
|
5
|
+
import * as dxos_echo_schema from "@dxos/echo-schema";
|
|
6
|
+
|
|
7
|
+
const schemaJson =
|
|
8
|
+
'{"nested":{"dxos":{"nested":{"sdk":{"nested":{"client":{"nested":{"Properties":{"options":{"(object)":true},"fields":{"name":{"type":"string","id":1}}}}}}}}}}}';
|
|
9
|
+
|
|
10
|
+
export const schema = dxos_echo_schema.EchoSchema.fromJson(schemaJson);
|
|
11
|
+
|
|
12
|
+
export type PropertiesProps = {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export class Properties extends dxos_echo_schema.TypedObject<PropertiesProps> {
|
|
17
|
+
static readonly type = schema.getType("dxos.sdk.client.Properties");
|
|
18
|
+
|
|
19
|
+
static filter(
|
|
20
|
+
opts?: Partial<PropertiesProps>
|
|
21
|
+
): dxos_echo_schema.TypeFilter<Properties> {
|
|
22
|
+
return Properties.type.createFilter(opts);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
initValues?: Partial<PropertiesProps>,
|
|
27
|
+
opts?: dxos_echo_schema.TypedObjectOpts
|
|
28
|
+
) {
|
|
29
|
+
super({ ...initValues }, Properties.type, opts);
|
|
30
|
+
}
|
|
31
|
+
declare name: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
schema.registerPrototype(Properties);
|