@dxos/client-protocol 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44
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-N7EC364H.mjs +36 -0
- package/dist/lib/browser/chunk-N7EC364H.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +36 -16
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +5 -5
- package/dist/lib/node-esm/chunk-EM6VN4X6.mjs +38 -0
- package/dist/lib/node-esm/chunk-EM6VN4X6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +36 -16
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +5 -5
- package/dist/types/src/config.d.ts +22 -8
- package/dist/types/src/config.d.ts.map +1 -1
- package/dist/types/src/echo.d.ts +4 -4
- package/dist/types/src/echo.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/{service-definitions.d.ts → service.d.ts} +18 -5
- package/dist/types/src/service.d.ts.map +1 -0
- package/dist/types/src/space.d.ts +23 -17
- package/dist/types/src/space.d.ts.map +1 -1
- package/dist/types/src/types/SpaceProperties.d.ts +27 -0
- package/dist/types/src/types/SpaceProperties.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -16
- package/src/config.ts +33 -14
- package/src/echo.ts +4 -4
- package/src/index.ts +2 -2
- package/src/{service-definitions.ts → service.ts} +24 -3
- package/src/space.ts +42 -28
- package/src/types/SpaceProperties.ts +49 -0
- package/src/types/index.ts +1 -1
- package/dist/lib/browser/chunk-HIQWFHOK.mjs +0 -25
- package/dist/lib/browser/chunk-HIQWFHOK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TN3JZMTK.mjs +0 -27
- package/dist/lib/node-esm/chunk-TN3JZMTK.mjs.map +0 -7
- package/dist/types/src/service-definitions.d.ts.map +0 -1
- package/dist/types/src/types/Properties.d.ts +0 -22
- package/dist/types/src/types/Properties.d.ts.map +0 -1
- package/src/types/Properties.ts +0 -29
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.ef1bc66f44",
|
|
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,21 +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/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/invariant": "0.8.4-main.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/rpc": "0.8.4-main.e8ec1fe"
|
|
43
|
+
"effect": "3.19.16",
|
|
44
|
+
"@dxos/async": "0.8.4-main.ef1bc66f44",
|
|
45
|
+
"@dxos/credentials": "0.8.4-main.ef1bc66f44",
|
|
46
|
+
"@dxos/echo-db": "0.8.4-main.ef1bc66f44",
|
|
47
|
+
"@dxos/context": "0.8.4-main.ef1bc66f44",
|
|
48
|
+
"@dxos/echo": "0.8.4-main.ef1bc66f44",
|
|
49
|
+
"@dxos/keys": "0.8.4-main.ef1bc66f44",
|
|
50
|
+
"@dxos/invariant": "0.8.4-main.ef1bc66f44",
|
|
51
|
+
"@dxos/node-std": "0.8.4-main.ef1bc66f44",
|
|
52
|
+
"@dxos/protocols": "0.8.4-main.ef1bc66f44",
|
|
53
|
+
"@dxos/rpc": "0.8.4-main.ef1bc66f44"
|
|
52
54
|
},
|
|
53
55
|
"peerDependencies": {
|
|
54
|
-
"effect": "
|
|
56
|
+
"effect": "3.19.16"
|
|
55
57
|
},
|
|
56
58
|
"publishConfig": {
|
|
57
59
|
"access": "public"
|
package/src/config.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
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
|
-
export const defaultConfig
|
|
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/echo.ts
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import type { MulticastObservable } from '@dxos/async';
|
|
6
|
-
import type {
|
|
6
|
+
import type { Database } from '@dxos/echo';
|
|
7
7
|
import type { PublicKey, SpaceId } from '@dxos/keys';
|
|
8
8
|
import type { Invitation, SpaceArchive } from '@dxos/protocols/proto/dxos/client/services';
|
|
9
9
|
|
|
10
10
|
import type { AuthenticatingInvitation } from './invitations';
|
|
11
11
|
import type { Space } from './space';
|
|
12
|
-
import type {
|
|
12
|
+
import type { SpaceProperties } from './types';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Public database API.
|
|
16
16
|
*/
|
|
17
17
|
// TODO(wittjosiah): Rename Database (not product name).
|
|
18
|
-
export interface Echo extends MulticastObservable<Space[]>, Queryable {
|
|
18
|
+
export interface Echo extends MulticastObservable<Space[]>, Database.Queryable {
|
|
19
19
|
/**
|
|
20
20
|
* Observable which indicates when the default space is available.
|
|
21
21
|
*/
|
|
@@ -51,7 +51,7 @@ export interface Echo extends MulticastObservable<Space[]>, Queryable {
|
|
|
51
51
|
/**
|
|
52
52
|
* Creates a new space.
|
|
53
53
|
*/
|
|
54
|
-
create(
|
|
54
|
+
create(props?: Pick<SpaceProperties, 'name' | 'hue' | 'icon' | 'invocationTraceQueue'>): Promise<Space>;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates a space from the given archive.
|
package/src/index.ts
CHANGED
|
@@ -7,8 +7,8 @@ export * from './config';
|
|
|
7
7
|
export type * from './echo';
|
|
8
8
|
export type * from './halo';
|
|
9
9
|
export * from './invitations';
|
|
10
|
-
export * from './service
|
|
10
|
+
export * from './service';
|
|
11
11
|
export type * from './shell';
|
|
12
|
-
export
|
|
12
|
+
export * from './space';
|
|
13
13
|
export * from './timeouts';
|
|
14
14
|
export * from './types';
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
InvitationsService,
|
|
13
13
|
LoggingService,
|
|
14
14
|
NetworkService,
|
|
15
|
+
QueueService,
|
|
15
16
|
SpacesService,
|
|
16
17
|
SystemService,
|
|
17
18
|
} from '@dxos/protocols/proto/dxos/client/services';
|
|
@@ -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/proto/dxos/client/services';
|
|
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
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { type MulticastObservable } from '@dxos/async';
|
|
6
8
|
import { type SpecificCredential } from '@dxos/credentials';
|
|
7
|
-
import { type
|
|
9
|
+
import { type Database, type Obj } from '@dxos/echo';
|
|
10
|
+
import { type EchoDatabase, type QueueFactory, type SpaceSyncState } from '@dxos/echo-db';
|
|
8
11
|
import { type PublicKey, type SpaceId } from '@dxos/keys';
|
|
12
|
+
import { type Messenger } from '@dxos/protocols';
|
|
9
13
|
import {
|
|
10
14
|
type Contact,
|
|
11
15
|
type CreateEpochRequest,
|
|
@@ -19,9 +23,9 @@ import {
|
|
|
19
23
|
import { type EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
20
24
|
import { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
21
25
|
import { type Credential, type Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
22
|
-
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
23
26
|
|
|
24
27
|
import { type CancellableInvitation } from './invitations';
|
|
28
|
+
import { type SpaceProperties } from './types';
|
|
25
29
|
|
|
26
30
|
export type CreateEpochOptions = {
|
|
27
31
|
migration?: CreateEpochRequest.Migration;
|
|
@@ -29,17 +33,21 @@ export type CreateEpochOptions = {
|
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
export interface SpaceInternal {
|
|
36
|
+
get db(): EchoDatabase;
|
|
32
37
|
get data(): SpaceData;
|
|
33
38
|
|
|
34
|
-
// TODO(dmaretskyi): Return epoch info.
|
|
35
|
-
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
36
|
-
|
|
37
39
|
getCredentials(): Promise<Credential[]>;
|
|
38
40
|
|
|
39
41
|
getEpochs(): Promise<SpecificCredential<Epoch>[]>;
|
|
40
42
|
|
|
43
|
+
// TODO(dmaretskyi): Return epoch info.
|
|
44
|
+
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
45
|
+
|
|
46
|
+
// TOOD(burdon): Start to factor out credentials.
|
|
41
47
|
removeMember(memberKey: PublicKey): Promise<void>;
|
|
42
48
|
|
|
49
|
+
export(): Promise<SpaceArchive>;
|
|
50
|
+
|
|
43
51
|
/**
|
|
44
52
|
* Migrate space data to the latest version.
|
|
45
53
|
*/
|
|
@@ -55,39 +63,36 @@ export interface SpaceInternal {
|
|
|
55
63
|
onProgress: (state: SpaceSyncState.PeerState | undefined) => void;
|
|
56
64
|
timeout?: number;
|
|
57
65
|
}): Promise<void>;
|
|
58
|
-
|
|
59
|
-
export(): Promise<SpaceArchive>;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*/
|
|
67
|
-
get id(): SpaceId;
|
|
68
|
+
export const SPACE_TAG = Symbol('dxos.client.protocol.Space');
|
|
69
|
+
|
|
70
|
+
export interface Space extends Messenger {
|
|
71
|
+
readonly [SPACE_TAG]: true;
|
|
68
72
|
|
|
69
73
|
/**
|
|
70
74
|
* @deprecated Use `id`.
|
|
71
75
|
*/
|
|
72
76
|
get key(): PublicKey;
|
|
73
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Unique space identifier.
|
|
80
|
+
*/
|
|
81
|
+
get id(): SpaceId;
|
|
82
|
+
|
|
74
83
|
/**
|
|
75
84
|
* Echo database.
|
|
76
85
|
*/
|
|
77
|
-
get db():
|
|
86
|
+
get db(): Database.Database;
|
|
78
87
|
|
|
79
88
|
/**
|
|
80
89
|
* Access to queues.
|
|
81
90
|
*/
|
|
82
91
|
get queues(): QueueFactory;
|
|
83
92
|
|
|
93
|
+
// TODO(burdon): Replace with state?
|
|
84
94
|
get isOpen(): boolean;
|
|
85
95
|
|
|
86
|
-
/**
|
|
87
|
-
* Properties object.
|
|
88
|
-
*/
|
|
89
|
-
get properties(): AnyLiveObject<any>;
|
|
90
|
-
|
|
91
96
|
/**
|
|
92
97
|
* Current state of the space.
|
|
93
98
|
* The database is ready to be used in `SpaceState.SPACE_READY` state.
|
|
@@ -95,6 +100,11 @@ export interface Space {
|
|
|
95
100
|
*/
|
|
96
101
|
get state(): MulticastObservable<SpaceState>;
|
|
97
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Properties object.
|
|
105
|
+
*/
|
|
106
|
+
get properties(): Obj.Obj<SpaceProperties>;
|
|
107
|
+
|
|
98
108
|
/**
|
|
99
109
|
* Current state of space pipeline.
|
|
100
110
|
*/
|
|
@@ -107,14 +117,14 @@ export interface Space {
|
|
|
107
117
|
/**
|
|
108
118
|
* @deprecated
|
|
109
119
|
*/
|
|
110
|
-
// TODO(wittjosiah):
|
|
120
|
+
// TODO(wittjosiah): Audit and remove. This should not be exposed (or marked as internal).
|
|
111
121
|
get internal(): SpaceInternal;
|
|
112
122
|
|
|
113
|
-
// TODO(wittjosiah): Rename activate/deactivate?
|
|
114
123
|
/**
|
|
115
124
|
* Activates the space enabling the use of the database and starts replication with peers.
|
|
116
125
|
* The setting is persisted on the local device.
|
|
117
126
|
*/
|
|
127
|
+
// TODO(wittjosiah): Rename activate/deactivate?
|
|
118
128
|
open(): Promise<void>;
|
|
119
129
|
|
|
120
130
|
/**
|
|
@@ -132,13 +142,17 @@ export interface Space {
|
|
|
132
142
|
createSnapshot(): Promise<SpaceSnapshot>;
|
|
133
143
|
|
|
134
144
|
// TODO(burdon): Create invitation?
|
|
145
|
+
// TODO(burdon): Factor out membership, etc.
|
|
135
146
|
share(options?: Partial<Invitation>): CancellableInvitation;
|
|
136
|
-
|
|
137
147
|
admitContact(contact: Contact): Promise<void>;
|
|
138
|
-
|
|
139
148
|
updateMemberRole(request: Omit<UpdateMemberRoleRequest, 'spaceKey'>): Promise<void>;
|
|
140
|
-
|
|
141
|
-
// TODO(wittjosiah): Gather into messaging abstraction?
|
|
142
|
-
postMessage: (channel: string, message: any) => Promise<void>;
|
|
143
|
-
listen: (channel: string, callback: (message: GossipMessage) => void) => CleanupFn;
|
|
144
149
|
}
|
|
150
|
+
|
|
151
|
+
export const isSpace = (object: unknown): object is Space =>
|
|
152
|
+
typeof object === 'object' && object != null && (object as Space)[SPACE_TAG] === true;
|
|
153
|
+
|
|
154
|
+
// TODO(burdon): Create lower-level definition (HasId, db, etc.) and move to @dxos/echo.
|
|
155
|
+
export const SpaceSchema: Schema.Schema<Space> = Schema.Any.pipe(
|
|
156
|
+
Schema.filter((space) => isSpace(space)),
|
|
157
|
+
Schema.annotations({ title: 'Space' }),
|
|
158
|
+
);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Annotation, Type } from '@dxos/echo';
|
|
8
|
+
import { Queue } from '@dxos/echo-db';
|
|
9
|
+
|
|
10
|
+
export const SpacePropertiesSchema = Schema.Struct(
|
|
11
|
+
{
|
|
12
|
+
//
|
|
13
|
+
// System properties.
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),
|
|
17
|
+
// TODO(burdon): Change to mode (no booleans?)
|
|
18
|
+
// TODO(wittjosiah): Make optional with default value.
|
|
19
|
+
edgeReplication: Schema.optional(Schema.Boolean),
|
|
20
|
+
invocationTraceQueue: Schema.optional(Type.Ref(Queue)),
|
|
21
|
+
|
|
22
|
+
//
|
|
23
|
+
// User properties.
|
|
24
|
+
//
|
|
25
|
+
|
|
26
|
+
name: Schema.optional(Schema.String),
|
|
27
|
+
icon: Schema.optional(Schema.String),
|
|
28
|
+
hue: Schema.optional(Schema.String),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: Schema.String,
|
|
32
|
+
value: Schema.Any,
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;
|
|
37
|
+
|
|
38
|
+
// TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?
|
|
39
|
+
// TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?
|
|
40
|
+
export const SpaceProperties = SpacePropertiesSchema.pipe(
|
|
41
|
+
Type.object({
|
|
42
|
+
// TODO(burdon): Rename SpaceProperties.
|
|
43
|
+
typename: 'dxos.org/type/Properties',
|
|
44
|
+
version: '0.1.0',
|
|
45
|
+
}),
|
|
46
|
+
Annotation.SystemTypeAnnotation.set(true),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {}
|
package/src/types/index.ts
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/types/Properties.ts
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
import { Type } from "@dxos/echo";
|
|
4
|
-
import { TypedObject } from "@dxos/echo/internal";
|
|
5
|
-
import { Queue } from "@dxos/echo-db";
|
|
6
|
-
var TYPE_PROPERTIES = "dxos.org/type/Properties";
|
|
7
|
-
var PropertiesType = class extends TypedObject({
|
|
8
|
-
typename: TYPE_PROPERTIES,
|
|
9
|
-
version: "0.1.0"
|
|
10
|
-
})({
|
|
11
|
-
name: Schema.optional(Schema.String),
|
|
12
|
-
// TODO(wittjosiah): Make generic?
|
|
13
|
-
hue: Schema.optional(Schema.String),
|
|
14
|
-
icon: Schema.optional(Schema.String),
|
|
15
|
-
invocationTraceQueue: Schema.optional(Type.Ref(Queue))
|
|
16
|
-
}, {
|
|
17
|
-
record: true
|
|
18
|
-
}) {
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
TYPE_PROPERTIES,
|
|
23
|
-
PropertiesType
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-HIQWFHOK.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Properties.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Type } from '@dxos/echo';\nimport { TypedObject } from '@dxos/echo/internal';\nimport { Queue } from '@dxos/echo-db';\n\nexport const TYPE_PROPERTIES = 'dxos.org/type/Properties';\n\n// TODO(burdon): Factor out (co-locate with TYPE_PROPERTIES).\nexport class PropertiesType extends TypedObject({\n typename: TYPE_PROPERTIES,\n version: '0.1.0',\n})(\n {\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): Make generic?\n hue: Schema.optional(Schema.String),\n icon: Schema.optional(Schema.String),\n invocationTraceQueue: Schema.optional(Type.Ref(Queue)),\n },\n { record: true },\n) {}\n\n// TODO(burdon): Remove? Use PropertiesType instead?\nexport type PropertiesTypeProps = Pick<PropertiesType, 'name' | 'hue' | 'icon' | 'invocationTraceQueue'>;\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAC5B,SAASC,aAAa;AAEf,IAAMC,kBAAkB;AAGxB,IAAMC,iBAAN,cAA6BC,YAAY;EAC9CC,UAAUH;EACVI,SAAS;AACX,CAAA,EACE;EACEC,MAAaC,gBAAgBC,aAAM;;EAEnCC,KAAYF,gBAAgBC,aAAM;EAClCE,MAAaH,gBAAgBC,aAAM;EACnCG,sBAA6BJ,gBAASK,KAAKC,IAAIC,KAAAA,CAAAA;AACjD,GACA;EAAEC,QAAQ;AAAK,CAAA,EAAA;AACd;",
|
|
6
|
-
"names": ["Schema", "Type", "TypedObject", "Queue", "TYPE_PROPERTIES", "PropertiesType", "TypedObject", "typename", "version", "name", "optional", "String", "hue", "icon", "invocationTraceQueue", "Type", "Ref", "Queue", "record"]
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/types/Properties.ts
|
|
4
|
-
import * as Schema from "effect/Schema";
|
|
5
|
-
import { Type } from "@dxos/echo";
|
|
6
|
-
import { TypedObject } from "@dxos/echo/internal";
|
|
7
|
-
import { Queue } from "@dxos/echo-db";
|
|
8
|
-
var TYPE_PROPERTIES = "dxos.org/type/Properties";
|
|
9
|
-
var PropertiesType = class extends TypedObject({
|
|
10
|
-
typename: TYPE_PROPERTIES,
|
|
11
|
-
version: "0.1.0"
|
|
12
|
-
})({
|
|
13
|
-
name: Schema.optional(Schema.String),
|
|
14
|
-
// TODO(wittjosiah): Make generic?
|
|
15
|
-
hue: Schema.optional(Schema.String),
|
|
16
|
-
icon: Schema.optional(Schema.String),
|
|
17
|
-
invocationTraceQueue: Schema.optional(Type.Ref(Queue))
|
|
18
|
-
}, {
|
|
19
|
-
record: true
|
|
20
|
-
}) {
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
TYPE_PROPERTIES,
|
|
25
|
-
PropertiesType
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=chunk-TN3JZMTK.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Properties.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Type } from '@dxos/echo';\nimport { TypedObject } from '@dxos/echo/internal';\nimport { Queue } from '@dxos/echo-db';\n\nexport const TYPE_PROPERTIES = 'dxos.org/type/Properties';\n\n// TODO(burdon): Factor out (co-locate with TYPE_PROPERTIES).\nexport class PropertiesType extends TypedObject({\n typename: TYPE_PROPERTIES,\n version: '0.1.0',\n})(\n {\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): Make generic?\n hue: Schema.optional(Schema.String),\n icon: Schema.optional(Schema.String),\n invocationTraceQueue: Schema.optional(Type.Ref(Queue)),\n },\n { record: true },\n) {}\n\n// TODO(burdon): Remove? Use PropertiesType instead?\nexport type PropertiesTypeProps = Pick<PropertiesType, 'name' | 'hue' | 'icon' | 'invocationTraceQueue'>;\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAC5B,SAASC,aAAa;AAEf,IAAMC,kBAAkB;AAGxB,IAAMC,iBAAN,cAA6BC,YAAY;EAC9CC,UAAUH;EACVI,SAAS;AACX,CAAA,EACE;EACEC,MAAaC,gBAAgBC,aAAM;;EAEnCC,KAAYF,gBAAgBC,aAAM;EAClCE,MAAaH,gBAAgBC,aAAM;EACnCG,sBAA6BJ,gBAASK,KAAKC,IAAIC,KAAAA,CAAAA;AACjD,GACA;EAAEC,QAAQ;AAAK,CAAA,EAAA;AACd;",
|
|
6
|
-
"names": ["Schema", "Type", "TypedObject", "Queue", "TYPE_PROPERTIES", "PropertiesType", "TypedObject", "typename", "version", "name", "optional", "String", "hue", "icon", "invocationTraceQueue", "Type", "Ref", "Queue", "record"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-definitions.d.ts","sourceRoot":"","sources":["../../../src/service-definitions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACd,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,WAAW,CAAC;AAMpE,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,cAAc,CAAC;IAE/B,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,gBAAgB,EAAE,gBAAgB,CAAC;IAGnC,YAAY,EAAE,YAAY,CAAC;IAE3B,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,EAAE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACjC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAGlC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,+BAiB9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,mBAAmB,CAElE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,mBAAmB,CAElE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,gBAAgB,CAE5D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,kBAAkB,CAEhE,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
import { Type } from '@dxos/echo';
|
|
3
|
-
import { Queue } from '@dxos/echo-db';
|
|
4
|
-
export declare const TYPE_PROPERTIES = "dxos.org/type/Properties";
|
|
5
|
-
declare const PropertiesType_base: import("@dxos/echo/internal").TypedObjectPrototype<import("@dxos/echo/internal").TypedObjectFields<{
|
|
6
|
-
name: Schema.optional<typeof Schema.String>;
|
|
7
|
-
hue: Schema.optional<typeof Schema.String>;
|
|
8
|
-
icon: Schema.optional<typeof Schema.String>;
|
|
9
|
-
invocationTraceQueue: Schema.optional<Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>>;
|
|
10
|
-
}, {
|
|
11
|
-
record: true;
|
|
12
|
-
}>, Schema.Struct.Encoded<{
|
|
13
|
-
name: Schema.optional<typeof Schema.String>;
|
|
14
|
-
hue: Schema.optional<typeof Schema.String>;
|
|
15
|
-
icon: Schema.optional<typeof Schema.String>;
|
|
16
|
-
invocationTraceQueue: Schema.optional<Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>>;
|
|
17
|
-
}>>;
|
|
18
|
-
export declare class PropertiesType extends PropertiesType_base {
|
|
19
|
-
}
|
|
20
|
-
export type PropertiesTypeProps = Pick<PropertiesType, 'name' | 'hue' | 'icon' | 'invocationTraceQueue'>;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=Properties.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Properties.d.ts","sourceRoot":"","sources":["../../../../src/types/Properties.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,eAAO,MAAM,eAAe,6BAA6B,CAAC;;;;;;;;;;;;;;AAG1D,qBAAa,cAAe,SAAQ,mBAYnC;CAAG;AAGJ,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,sBAAsB,CAAC,CAAC"}
|
package/src/types/Properties.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { Type } from '@dxos/echo';
|
|
8
|
-
import { TypedObject } from '@dxos/echo/internal';
|
|
9
|
-
import { Queue } from '@dxos/echo-db';
|
|
10
|
-
|
|
11
|
-
export const TYPE_PROPERTIES = 'dxos.org/type/Properties';
|
|
12
|
-
|
|
13
|
-
// TODO(burdon): Factor out (co-locate with TYPE_PROPERTIES).
|
|
14
|
-
export class PropertiesType extends TypedObject({
|
|
15
|
-
typename: TYPE_PROPERTIES,
|
|
16
|
-
version: '0.1.0',
|
|
17
|
-
})(
|
|
18
|
-
{
|
|
19
|
-
name: Schema.optional(Schema.String),
|
|
20
|
-
// TODO(wittjosiah): Make generic?
|
|
21
|
-
hue: Schema.optional(Schema.String),
|
|
22
|
-
icon: Schema.optional(Schema.String),
|
|
23
|
-
invocationTraceQueue: Schema.optional(Type.Ref(Queue)),
|
|
24
|
-
},
|
|
25
|
-
{ record: true },
|
|
26
|
-
) {}
|
|
27
|
-
|
|
28
|
-
// TODO(burdon): Remove? Use PropertiesType instead?
|
|
29
|
-
export type PropertiesTypeProps = Pick<PropertiesType, 'name' | 'hue' | 'icon' | 'invocationTraceQueue'>;
|