@dxos/client-protocol 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-6IJFMEF3.mjs → chunk-N7EC364H.mjs} +4 -2
- package/dist/lib/browser/chunk-N7EC364H.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-WLB2RPCH.mjs → chunk-EM6VN4X6.mjs} +4 -2
- package/dist/lib/node-esm/chunk-EM6VN4X6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +20 -11
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/config.d.ts +19 -6
- package/dist/types/src/config.d.ts.map +1 -1
- package/dist/types/src/service.d.ts +17 -3
- package/dist/types/src/service.d.ts.map +1 -1
- package/dist/types/src/space.d.ts +3 -2
- package/dist/types/src/space.d.ts.map +1 -1
- package/dist/types/src/types/SpaceProperties.d.ts +9 -11
- package/dist/types/src/types/SpaceProperties.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -15
- package/src/config.ts +31 -12
- package/src/service.ts +24 -3
- package/src/space.ts +4 -3
- package/src/types/SpaceProperties.ts +4 -2
- package/dist/lib/browser/chunk-6IJFMEF3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WLB2RPCH.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-protocol",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
4
4
|
"description": "Core DXOS Client API.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"author": "DXOS.org",
|
|
10
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
11
14
|
"type": "module",
|
|
12
15
|
"exports": {
|
|
13
16
|
".": {
|
|
@@ -37,20 +40,20 @@
|
|
|
37
40
|
],
|
|
38
41
|
"dependencies": {
|
|
39
42
|
"base-x": "~3.0.9",
|
|
40
|
-
"effect": "3.
|
|
41
|
-
"@dxos/async": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/echo": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/invariant": "0.8.4-main.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
43
|
+
"effect": "3.19.11",
|
|
44
|
+
"@dxos/async": "0.8.4-main.937b3ca",
|
|
45
|
+
"@dxos/credentials": "0.8.4-main.937b3ca",
|
|
46
|
+
"@dxos/context": "0.8.4-main.937b3ca",
|
|
47
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
48
|
+
"@dxos/keys": "0.8.4-main.937b3ca",
|
|
49
|
+
"@dxos/echo-db": "0.8.4-main.937b3ca",
|
|
50
|
+
"@dxos/invariant": "0.8.4-main.937b3ca",
|
|
51
|
+
"@dxos/node-std": "0.8.4-main.937b3ca",
|
|
52
|
+
"@dxos/protocols": "0.8.4-main.937b3ca",
|
|
53
|
+
"@dxos/rpc": "0.8.4-main.937b3ca"
|
|
51
54
|
},
|
|
52
55
|
"peerDependencies": {
|
|
53
|
-
"effect": "
|
|
56
|
+
"effect": "3.19.11"
|
|
54
57
|
},
|
|
55
58
|
"publishConfig": {
|
|
56
59
|
"access": "public"
|
package/src/config.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
// TODO(wittjosiah): Factor out to @dxos/config.
|
|
6
6
|
|
|
7
|
-
export const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';
|
|
8
7
|
export const DEFAULT_CLIENT_CHANNEL = 'dxos:app';
|
|
8
|
+
export const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';
|
|
9
9
|
export const DEFAULT_SHELL_CHANNEL = 'dxos:shell';
|
|
10
10
|
export const DEFAULT_WORKER_BROADCAST_CHANNEL = 'dxos:shared-worker';
|
|
11
11
|
|
|
@@ -14,19 +14,18 @@ export const DEFAULT_WORKER_BROADCAST_CHANNEL = 'dxos:shared-worker';
|
|
|
14
14
|
*/
|
|
15
15
|
export const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
20
|
+
// TODO(burdon): Remove need (i.e., make undefined do the right thing).
|
|
21
|
+
export const DEFAULT_PROFILE = 'default';
|
|
22
|
+
|
|
17
23
|
export const EXPECTED_CONFIG_VERSION = 1;
|
|
18
24
|
export const defaultConfig = { version: 1 };
|
|
19
25
|
|
|
20
26
|
// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.
|
|
21
27
|
const HOME = typeof process !== 'undefined' ? (process?.env?.HOME ?? '') : '';
|
|
22
28
|
|
|
23
|
-
// Base directories.
|
|
24
|
-
// TODO(burdon): Consider Windows, Linux, OSX.
|
|
25
|
-
// https://wiki.archlinux.org/title/XDG_Base_Directory
|
|
26
|
-
// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.
|
|
27
|
-
export const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>
|
|
28
|
-
`${root}/profile/${profile}` + (file ? `/${file}` : '');
|
|
29
|
-
|
|
30
29
|
// XDG_CONFIG_HOME (Analogous to /etc.)
|
|
31
30
|
export const DX_CONFIG = `${HOME}/.config/dx`;
|
|
32
31
|
|
|
@@ -43,7 +42,27 @@ export const DX_STATE = `${HOME}/.local/state/dx`;
|
|
|
43
42
|
// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)
|
|
44
43
|
export const DX_RUNTIME = '/tmp/dx/run';
|
|
45
44
|
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
export enum DXEnv {
|
|
46
|
+
CONFIG = 'DX_CONFIG',
|
|
47
|
+
DEBUG = 'DX_DEBUG',
|
|
48
|
+
NO_AGENT = 'DX_NO_AGENT',
|
|
49
|
+
PROFILE = 'DX_PROFILE',
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export namespace DXEnv {
|
|
53
|
+
/**
|
|
54
|
+
* Helper to get the value from process.env
|
|
55
|
+
*/
|
|
56
|
+
export function get(variable: DXEnv): string | undefined;
|
|
57
|
+
export function get(variable: DXEnv, defaultValue: string): string;
|
|
58
|
+
export function get(variable: DXEnv, defaultValue?: string): string | undefined {
|
|
59
|
+
return process.env[variable] ?? defaultValue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Base directories.
|
|
64
|
+
// TODO(burdon): Consider Windows, Linux, OSX.
|
|
65
|
+
// https://wiki.archlinux.org/title/XDG_Base_Directory
|
|
66
|
+
// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.
|
|
67
|
+
export const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>
|
|
68
|
+
`${root}/profile/${profile}` + (file ? `/${file}` : '');
|
package/src/service.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Event } from '@dxos/async';
|
|
6
|
+
import { type QueueService } from '@dxos/protocols';
|
|
6
7
|
import { schema } from '@dxos/protocols/proto';
|
|
7
8
|
import type {
|
|
8
9
|
ContactsService,
|
|
@@ -23,6 +24,8 @@ import type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';
|
|
|
23
24
|
import type { TracingService } from '@dxos/protocols/proto/dxos/tracing';
|
|
24
25
|
import { type ServiceBundle, createServiceBundle } from '@dxos/rpc';
|
|
25
26
|
|
|
27
|
+
export { type QueueService } from '@dxos/protocols';
|
|
28
|
+
|
|
26
29
|
//
|
|
27
30
|
// NOTE: Should contain client/proxy dependencies only.
|
|
28
31
|
//
|
|
@@ -34,10 +37,13 @@ export type ClientServices = {
|
|
|
34
37
|
|
|
35
38
|
IdentityService: IdentityService;
|
|
36
39
|
InvitationsService: InvitationsService;
|
|
37
|
-
QueryService: QueryService;
|
|
38
40
|
DevicesService: DevicesService;
|
|
39
41
|
SpacesService: SpacesService;
|
|
42
|
+
|
|
40
43
|
DataService: DataService;
|
|
44
|
+
QueryService: QueryService;
|
|
45
|
+
QueueService: QueueService;
|
|
46
|
+
|
|
41
47
|
ContactsService: ContactsService;
|
|
42
48
|
EdgeAgentService: EdgeAgentService;
|
|
43
49
|
|
|
@@ -56,12 +62,26 @@ export interface ClientServicesProvider {
|
|
|
56
62
|
* This should fire if the services disconnect unexpectedly or during a client reset.
|
|
57
63
|
*/
|
|
58
64
|
closed: Event<Error | undefined>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The underlying service connection was re-established.
|
|
68
|
+
* Fires after all reconnection callbacks have completed.
|
|
69
|
+
*/
|
|
70
|
+
reconnected?: Event<void>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Register a callback to be invoked when services reconnect.
|
|
74
|
+
* The callback should re-establish any RPC streams.
|
|
75
|
+
* Reconnection waits for all callbacks to complete before emitting `reconnected`.
|
|
76
|
+
*/
|
|
77
|
+
onReconnect?: (callback: () => Promise<void>) => void;
|
|
78
|
+
|
|
59
79
|
descriptors: ServiceBundle<ClientServices>;
|
|
60
80
|
services: Partial<ClientServices>;
|
|
61
81
|
|
|
62
82
|
// TODO(burdon): Should take context from parent?
|
|
63
|
-
open(): Promise<
|
|
64
|
-
close(): Promise<
|
|
83
|
+
open(): Promise<unknown>;
|
|
84
|
+
close(): Promise<unknown>;
|
|
65
85
|
}
|
|
66
86
|
|
|
67
87
|
/**
|
|
@@ -80,6 +100,7 @@ export const clientServiceBundle = createServiceBundle<ClientServices>({
|
|
|
80
100
|
DataService: schema.getService('dxos.echo.service.DataService'),
|
|
81
101
|
ContactsService: schema.getService('dxos.client.services.ContactsService'),
|
|
82
102
|
EdgeAgentService: schema.getService('dxos.client.services.EdgeAgentService'),
|
|
103
|
+
QueueService: schema.getService('dxos.client.services.QueueService'),
|
|
83
104
|
|
|
84
105
|
// TODO(burdon): Deprecated.
|
|
85
106
|
DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),
|
package/src/space.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { type MulticastObservable } from '@dxos/async';
|
|
8
8
|
import { type SpecificCredential } from '@dxos/credentials';
|
|
9
|
-
import { type Obj } from '@dxos/echo';
|
|
9
|
+
import { type Database, type Obj } from '@dxos/echo';
|
|
10
10
|
import { type EchoDatabase, type QueueFactory, type SpaceSyncState } from '@dxos/echo-db';
|
|
11
11
|
import { type PublicKey, type SpaceId } from '@dxos/keys';
|
|
12
12
|
import { type Messenger } from '@dxos/protocols';
|
|
@@ -33,6 +33,7 @@ export type CreateEpochOptions = {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export interface SpaceInternal {
|
|
36
|
+
get db(): EchoDatabase;
|
|
36
37
|
get data(): SpaceData;
|
|
37
38
|
|
|
38
39
|
getCredentials(): Promise<Credential[]>;
|
|
@@ -82,7 +83,7 @@ export interface Space extends Messenger {
|
|
|
82
83
|
/**
|
|
83
84
|
* Echo database.
|
|
84
85
|
*/
|
|
85
|
-
get db():
|
|
86
|
+
get db(): Database.Database;
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
89
|
* Access to queues.
|
|
@@ -116,7 +117,7 @@ export interface Space extends Messenger {
|
|
|
116
117
|
/**
|
|
117
118
|
* @deprecated
|
|
118
119
|
*/
|
|
119
|
-
// TODO(wittjosiah):
|
|
120
|
+
// TODO(wittjosiah): Audit and remove. This should not be exposed (or marked as internal).
|
|
120
121
|
get internal(): SpaceInternal;
|
|
121
122
|
|
|
122
123
|
/**
|
|
@@ -14,7 +14,9 @@ export const SpacePropertiesSchema = Schema.Struct(
|
|
|
14
14
|
//
|
|
15
15
|
|
|
16
16
|
archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),
|
|
17
|
-
|
|
17
|
+
// TODO(burdon): Change to mode (no booleans?)
|
|
18
|
+
// TODO(wittjosiah): Make optional with default value.
|
|
19
|
+
edgeReplication: Schema.optional(Schema.Boolean),
|
|
18
20
|
invocationTraceQueue: Schema.optional(Type.Ref(Queue)),
|
|
19
21
|
|
|
20
22
|
//
|
|
@@ -36,7 +38,7 @@ export type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSch
|
|
|
36
38
|
// TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?
|
|
37
39
|
// TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?
|
|
38
40
|
export const SpaceProperties = SpacePropertiesSchema.pipe(
|
|
39
|
-
Type.
|
|
41
|
+
Type.object({
|
|
40
42
|
// TODO(burdon): Rename SpaceProperties.
|
|
41
43
|
typename: 'dxos.org/type/Properties',
|
|
42
44
|
version: '0.1.0',
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/SpaceProperties.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Type } from '@dxos/echo';\nimport { Queue } from '@dxos/echo-db';\n\nexport const SpacePropertiesSchema = Schema.Struct(\n {\n //\n // System properties.\n //\n\n archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),\n edgeReplication: Schema.optional(Schema.Boolean), // TODO(burdon): Change to mode (no booleans?)\n invocationTraceQueue: Schema.optional(Type.Ref(Queue)),\n\n //\n // User properties.\n //\n\n name: Schema.optional(Schema.String),\n icon: Schema.optional(Schema.String),\n hue: Schema.optional(Schema.String),\n },\n {\n key: Schema.String,\n value: Schema.Any,\n },\n);\n\nexport type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;\n\n// TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?\n// TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?\nexport const SpaceProperties = SpacePropertiesSchema.pipe(\n Type.Obj({\n // TODO(burdon): Rename SpaceProperties.\n typename: 'dxos.org/type/Properties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {}\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,YAAY;AACjC,SAASC,aAAa;AAEf,IAAMC,wBAA+BC,cAC1C;;;;EAKEC,UAAiBC,gBAAgBC,eAAQC,YAAY;IAAEC,OAAO;EAAgB,CAAA,CAAA;EAC9EC,iBAAwBJ,gBAAgBC,cAAO;EAC/CI,sBAA6BL,gBAASM,KAAKC,IAAIC,KAAAA,CAAAA;;;;EAM/CC,MAAaT,gBAAgBU,aAAM;EACnCC,MAAaX,gBAAgBU,aAAM;EACnCE,KAAYZ,gBAAgBU,aAAM;AACpC,GACA;EACEG,KAAYH;EACZI,OAAcC;AAChB,CAAA;AAOK,IAAMC,kBAAkBnB,sBAAsBoB,KACnDX,KAAKY,IAAI;;EAEPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,WAAWC,qBAAqBC,IAAI,IAAA,CAAA;",
|
|
6
|
-
"names": ["Schema", "Annotation", "Type", "Queue", "SpacePropertiesSchema", "Struct", "archived", "optional", "Boolean", "annotations", "title", "edgeReplication", "invocationTraceQueue", "Type", "Ref", "Queue", "name", "String", "icon", "hue", "key", "value", "Any", "SpaceProperties", "pipe", "Obj", "typename", "version", "Annotation", "SystemTypeAnnotation", "set"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/SpaceProperties.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Type } from '@dxos/echo';\nimport { Queue } from '@dxos/echo-db';\n\nexport const SpacePropertiesSchema = Schema.Struct(\n {\n //\n // System properties.\n //\n\n archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),\n edgeReplication: Schema.optional(Schema.Boolean), // TODO(burdon): Change to mode (no booleans?)\n invocationTraceQueue: Schema.optional(Type.Ref(Queue)),\n\n //\n // User properties.\n //\n\n name: Schema.optional(Schema.String),\n icon: Schema.optional(Schema.String),\n hue: Schema.optional(Schema.String),\n },\n {\n key: Schema.String,\n value: Schema.Any,\n },\n);\n\nexport type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;\n\n// TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?\n// TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?\nexport const SpaceProperties = SpacePropertiesSchema.pipe(\n Type.Obj({\n // TODO(burdon): Rename SpaceProperties.\n typename: 'dxos.org/type/Properties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {}\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,YAAY;AACjC,SAASC,aAAa;AAEf,IAAMC,wBAA+BC,cAC1C;;;;EAKEC,UAAiBC,gBAAgBC,eAAQC,YAAY;IAAEC,OAAO;EAAgB,CAAA,CAAA;EAC9EC,iBAAwBJ,gBAAgBC,cAAO;EAC/CI,sBAA6BL,gBAASM,KAAKC,IAAIC,KAAAA,CAAAA;;;;EAM/CC,MAAaT,gBAAgBU,aAAM;EACnCC,MAAaX,gBAAgBU,aAAM;EACnCE,KAAYZ,gBAAgBU,aAAM;AACpC,GACA;EACEG,KAAYH;EACZI,OAAcC;AAChB,CAAA;AAOK,IAAMC,kBAAkBnB,sBAAsBoB,KACnDX,KAAKY,IAAI;;EAEPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,WAAWC,qBAAqBC,IAAI,IAAA,CAAA;",
|
|
6
|
-
"names": ["Schema", "Annotation", "Type", "Queue", "SpacePropertiesSchema", "Struct", "archived", "optional", "Boolean", "annotations", "title", "edgeReplication", "invocationTraceQueue", "Type", "Ref", "Queue", "name", "String", "icon", "hue", "key", "value", "Any", "SpaceProperties", "pipe", "Obj", "typename", "version", "Annotation", "SystemTypeAnnotation", "set"]
|
|
7
|
-
}
|