@dxos/client-protocol 0.8.4-main.fffef41 → 0.9.0

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.
Files changed (44) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/chunk-46734GVM.mjs +39 -0
  3. package/dist/lib/browser/chunk-46734GVM.mjs.map +7 -0
  4. package/dist/lib/browser/index.mjs +32 -28
  5. package/dist/lib/browser/index.mjs.map +3 -3
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/types/index.mjs +7 -5
  8. package/dist/lib/node-esm/chunk-UTEDAJQA.mjs +41 -0
  9. package/dist/lib/node-esm/chunk-UTEDAJQA.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +32 -28
  11. package/dist/lib/node-esm/index.mjs.map +3 -3
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/types/index.mjs +7 -5
  14. package/dist/types/src/config.d.ts +24 -8
  15. package/dist/types/src/config.d.ts.map +1 -1
  16. package/dist/types/src/echo.d.ts +11 -17
  17. package/dist/types/src/echo.d.ts.map +1 -1
  18. package/dist/types/src/invitations/encoder.d.ts.map +1 -1
  19. package/dist/types/src/invitations/invitations.d.ts +2 -2
  20. package/dist/types/src/invitations/invitations.d.ts.map +1 -1
  21. package/dist/types/src/service.d.ts +17 -6
  22. package/dist/types/src/service.d.ts.map +1 -1
  23. package/dist/types/src/space.d.ts +35 -11
  24. package/dist/types/src/space.d.ts.map +1 -1
  25. package/dist/types/src/types/SpaceProperties.d.ts +47 -0
  26. package/dist/types/src/types/SpaceProperties.d.ts.map +1 -0
  27. package/dist/types/src/types/index.d.ts +1 -1
  28. package/dist/types/src/types/index.d.ts.map +1 -1
  29. package/dist/types/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +19 -25
  31. package/src/config.ts +33 -14
  32. package/src/echo.ts +9 -21
  33. package/src/invitations/encoder.test.ts +16 -0
  34. package/src/service.ts +24 -7
  35. package/src/space.ts +40 -14
  36. package/src/types/SpaceProperties.ts +57 -0
  37. package/src/types/index.ts +1 -1
  38. package/dist/lib/browser/chunk-HIQWFHOK.mjs +0 -25
  39. package/dist/lib/browser/chunk-HIQWFHOK.mjs.map +0 -7
  40. package/dist/lib/node-esm/chunk-TN3JZMTK.mjs +0 -27
  41. package/dist/lib/node-esm/chunk-TN3JZMTK.mjs.map +0 -7
  42. package/dist/types/src/types/Properties.d.ts +0 -22
  43. package/dist/types/src/types/Properties.d.ts.map +0 -1
  44. 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.fffef41",
3
+ "version": "0.9.0",
4
4
  "description": "Core DXOS Client API.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
- "repository": "github:dxos/dxos",
8
- "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
11
+ "license": "FSL-1.1-Apache-2.0",
9
12
  "author": "DXOS.org",
10
- "sideEffects": true,
13
+ "sideEffects": false,
11
14
  "type": "module",
12
15
  "exports": {
13
16
  ".": {
@@ -24,34 +27,25 @@
24
27
  }
25
28
  },
26
29
  "types": "dist/types/src/index.d.ts",
27
- "typesVersions": {
28
- "*": {
29
- "./types": [
30
- "./dist/types/src/types/index.d.ts"
31
- ]
32
- }
33
- },
34
30
  "files": [
35
31
  "dist",
36
32
  "src"
37
33
  ],
38
34
  "dependencies": {
39
- "base-x": "~3.0.9",
40
- "effect": "3.18.3",
41
- "@dxos/async": "0.8.4-main.fffef41",
42
- "@dxos/config": "0.8.4-main.fffef41",
43
- "@dxos/context": "0.8.4-main.fffef41",
44
- "@dxos/credentials": "0.8.4-main.fffef41",
45
- "@dxos/echo-db": "0.8.4-main.fffef41",
46
- "@dxos/echo": "0.8.4-main.fffef41",
47
- "@dxos/keys": "0.8.4-main.fffef41",
48
- "@dxos/node-std": "0.8.4-main.fffef41",
49
- "@dxos/invariant": "0.8.4-main.fffef41",
50
- "@dxos/protocols": "0.8.4-main.fffef41",
51
- "@dxos/rpc": "0.8.4-main.fffef41"
35
+ "base-x": "~3.0.11",
36
+ "effect": "3.21.3",
37
+ "@dxos/async": "0.9.0",
38
+ "@dxos/credentials": "0.9.0",
39
+ "@dxos/echo": "0.9.0",
40
+ "@dxos/invariant": "0.9.0",
41
+ "@dxos/echo-client": "0.9.0",
42
+ "@dxos/keys": "0.9.0",
43
+ "@dxos/node-std": "0.9.0",
44
+ "@dxos/protocols": "0.9.0",
45
+ "@dxos/rpc": "0.9.0"
52
46
  },
53
47
  "peerDependencies": {
54
- "effect": "^3.13.3"
48
+ "effect": "3.21.3"
55
49
  },
56
50
  "publishConfig": {
57
51
  "access": "public"
package/src/config.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { type ConfigProto } from '@dxos/config';
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: ConfigProto = { version: 1 };
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 const ENV_DX_CONFIG = 'DX_CONFIG';
47
- export const ENV_DX_NO_AGENT = 'DX_NO_AGENT';
48
- export const ENV_DX_PROFILE = 'DX_PROFILE';
49
- export const ENV_DX_PROFILE_DEFAULT = 'default';
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
+ // Profile layout: profile/<name> is the profile dir; profile/<name>.yml is the config file.
64
+ export const getProfilePath = (root: string, profile: string, file?: string) =>
65
+ `${root}/profile/${profile}` + (file ? `/${file}` : '');
66
+
67
+ /** Path to the profile config file (profile/<name>.yml). */
68
+ export const getProfileConfigPath = (root: string, profile: string) => `${getProfilePath(root, profile)}.yml`;
package/src/echo.ts CHANGED
@@ -3,25 +3,20 @@
3
3
  //
4
4
 
5
5
  import type { MulticastObservable } from '@dxos/async';
6
- import type { Queryable } from '@dxos/echo-db';
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
+ import type { MembershipPolicy } from '@dxos/protocols/proto/dxos/halo/credentials';
9
10
 
10
11
  import type { AuthenticatingInvitation } from './invitations';
11
12
  import type { Space } from './space';
12
- import type { PropertiesTypeProps } from './types';
13
+ import type { SpaceProperties } from './types';
13
14
 
14
15
  /**
15
16
  * Public database API.
16
17
  */
17
18
  // TODO(wittjosiah): Rename Database (not product name).
18
- export interface Echo extends MulticastObservable<Space[]>, Queryable {
19
- /**
20
- * Observable which indicates when the default space is available.
21
- */
22
- // TODO(wittjosiah): Remove. Ensure default space is always available.
23
- get isReady(): MulticastObservable<boolean>;
24
-
19
+ export interface Echo extends MulticastObservable<Space[]>, Database.Queryable {
25
20
  /**
26
21
  * Returns the list of spaces.
27
22
  */
@@ -38,25 +33,18 @@ export interface Echo extends MulticastObservable<Space[]>, Queryable {
38
33
  */
39
34
  get(spaceKey: PublicKey): Space | undefined;
40
35
 
41
- /**
42
- * Returns the default space.
43
- */
44
- get default(): Space;
45
-
46
- /**
47
- * Resolves when the default space is available.
48
- */
49
- waitUntilReady(): Promise<void>;
50
-
51
36
  /**
52
37
  * Creates a new space.
53
38
  */
54
- create(meta?: PropertiesTypeProps): Promise<Space>;
39
+ create(
40
+ props?: Pick<SpaceProperties, 'name' | 'hue' | 'icon' | 'invocationTraceFeed'>,
41
+ options?: { tags?: string[]; membershipPolicy?: MembershipPolicy },
42
+ ): Promise<Space>;
55
43
 
56
44
  /**
57
45
  * Creates a space from the given archive.
58
46
  */
59
- import(archive: SpaceArchive): Promise<Space>;
47
+ import(archive: SpaceArchive, options?: { tags?: string[] }): Promise<Space>;
60
48
 
61
49
  /**
62
50
  * Joins an existing space using the given invitation.
@@ -58,4 +58,20 @@ describe('Invitation utils', () => {
58
58
  expect(decoded.identityKey).to.not.exist;
59
59
  expect(decoded).to.deep.eq(invitation);
60
60
  });
61
+
62
+ test('encodes and decodes a device invitation', () => {
63
+ const invitation: Invitation = {
64
+ invitationId: PublicKey.random().toHex(),
65
+ type: Invitation.Type.INTERACTIVE,
66
+ kind: Invitation.Kind.DEVICE,
67
+ authMethod: Invitation.AuthMethod.NONE,
68
+ state: Invitation.State.INIT,
69
+ swarmKey: PublicKey.random(),
70
+ created: CREATED,
71
+ lifetime: 86400,
72
+ };
73
+ const encoded = InvitationEncoder.encode(invitation);
74
+ const decoded = InvitationEncoder.decode(encoded);
75
+ expect(decoded).to.deep.eq(invitation);
76
+ });
61
77
  });
package/src/service.ts CHANGED
@@ -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';
@@ -20,9 +21,10 @@ import type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';
20
21
  import type { DataService } from '@dxos/protocols/proto/dxos/echo/service';
21
22
  import type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';
22
23
  import type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';
23
- import type { TracingService } from '@dxos/protocols/proto/dxos/tracing';
24
24
  import { type ServiceBundle, createServiceBundle } from '@dxos/rpc';
25
25
 
26
+ export type { QueueService } from '@dxos/protocols/proto/dxos/client/services';
27
+
26
28
  //
27
29
  // NOTE: Should contain client/proxy dependencies only.
28
30
  //
@@ -34,17 +36,18 @@ export type ClientServices = {
34
36
 
35
37
  IdentityService: IdentityService;
36
38
  InvitationsService: InvitationsService;
37
- QueryService: QueryService;
38
39
  DevicesService: DevicesService;
39
40
  SpacesService: SpacesService;
41
+
40
42
  DataService: DataService;
43
+ QueryService: QueryService;
44
+ QueueService: QueueService;
45
+
41
46
  ContactsService: ContactsService;
42
47
  EdgeAgentService: EdgeAgentService;
43
48
 
44
49
  // TODO(burdon): Deprecated.
45
50
  DevtoolsHost: DevtoolsHost;
46
-
47
- TracingService: TracingService;
48
51
  };
49
52
 
50
53
  /**
@@ -56,12 +59,26 @@ export interface ClientServicesProvider {
56
59
  * This should fire if the services disconnect unexpectedly or during a client reset.
57
60
  */
58
61
  closed: Event<Error | undefined>;
62
+
63
+ /**
64
+ * The underlying service connection was re-established.
65
+ * Fires after all reconnection callbacks have completed.
66
+ */
67
+ reconnected?: Event<void>;
68
+
69
+ /**
70
+ * Register a callback to be invoked when services reconnect.
71
+ * The callback should re-establish any RPC streams.
72
+ * Reconnection waits for all callbacks to complete before emitting `reconnected`.
73
+ */
74
+ onReconnect?: (callback: () => Promise<void>) => void;
75
+
59
76
  descriptors: ServiceBundle<ClientServices>;
60
77
  services: Partial<ClientServices>;
61
78
 
62
79
  // TODO(burdon): Should take context from parent?
63
- open(): Promise<void>;
64
- close(): Promise<void>;
80
+ open(): Promise<unknown>;
81
+ close(): Promise<unknown>;
65
82
  }
66
83
 
67
84
  /**
@@ -80,10 +97,10 @@ export const clientServiceBundle = createServiceBundle<ClientServices>({
80
97
  DataService: schema.getService('dxos.echo.service.DataService'),
81
98
  ContactsService: schema.getService('dxos.client.services.ContactsService'),
82
99
  EdgeAgentService: schema.getService('dxos.client.services.EdgeAgentService'),
100
+ QueueService: schema.getService('dxos.client.services.QueueService'),
83
101
 
84
102
  // TODO(burdon): Deprecated.
85
103
  DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),
86
- TracingService: schema.getService('dxos.tracing.TracingService'),
87
104
  });
88
105
 
89
106
  export type IframeServiceBundle = {
package/src/space.ts CHANGED
@@ -4,15 +4,17 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { type CleanupFn, type MulticastObservable } from '@dxos/async';
7
+ import { type MulticastObservable } from '@dxos/async';
8
8
  import { type SpecificCredential } from '@dxos/credentials';
9
- import { type AnyLiveObject, type EchoDatabase, type QueueFactory, type SpaceSyncState } from '@dxos/echo-db';
9
+ import { type Database, type Obj } from '@dxos/echo';
10
+ import { type EchoDatabase, type QueueFactory, type SpaceSyncState } from '@dxos/echo-client';
10
11
  import { type PublicKey, type SpaceId } from '@dxos/keys';
12
+ import { type Messenger } from '@dxos/protocols';
11
13
  import {
12
14
  type Contact,
13
15
  type CreateEpochRequest,
14
16
  type Invitation,
15
- type SpaceArchive,
17
+ SpaceArchive,
16
18
  type Space as SpaceData,
17
19
  type SpaceMember,
18
20
  type SpaceState,
@@ -20,17 +22,26 @@ import {
20
22
  } from '@dxos/protocols/proto/dxos/client/services';
21
23
  import { type EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
22
24
  import { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
23
- import { type Credential, type Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
24
- import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
25
+ import { type Credential, type Epoch, type MembershipPolicy } from '@dxos/protocols/proto/dxos/halo/credentials';
25
26
 
26
27
  import { type CancellableInvitation } from './invitations';
28
+ import { type SpaceProperties } from './types';
27
29
 
28
30
  export type CreateEpochOptions = {
29
31
  migration?: CreateEpochRequest.Migration;
30
32
  automergeRootUrl?: string;
31
33
  };
32
34
 
35
+ export type ExportSpaceOptions = {
36
+ /**
37
+ * Archive format.
38
+ * @default SpaceArchive.Format.BINARY
39
+ */
40
+ format?: SpaceArchive.Format;
41
+ };
42
+
33
43
  export interface SpaceInternal {
44
+ get db(): EchoDatabase;
34
45
  get data(): SpaceData;
35
46
 
36
47
  getCredentials(): Promise<Credential[]>;
@@ -43,7 +54,7 @@ export interface SpaceInternal {
43
54
  // TOOD(burdon): Start to factor out credentials.
44
55
  removeMember(memberKey: PublicKey): Promise<void>;
45
56
 
46
- export(): Promise<SpaceArchive>;
57
+ export(options?: ExportSpaceOptions): Promise<SpaceArchive>;
47
58
 
48
59
  /**
49
60
  * Migrate space data to the latest version.
@@ -64,7 +75,7 @@ export interface SpaceInternal {
64
75
 
65
76
  export const SPACE_TAG = Symbol('dxos.client.protocol.Space');
66
77
 
67
- export interface Space {
78
+ export interface Space extends Messenger {
68
79
  readonly [SPACE_TAG]: true;
69
80
 
70
81
  /**
@@ -80,7 +91,7 @@ export interface Space {
80
91
  /**
81
92
  * Echo database.
82
93
  */
83
- get db(): EchoDatabase;
94
+ get db(): Database.Database;
84
95
 
85
96
  /**
86
97
  * Access to queues.
@@ -90,6 +101,18 @@ export interface Space {
90
101
  // TODO(burdon): Replace with state?
91
102
  get isOpen(): boolean;
92
103
 
104
+ /**
105
+ * Immutable tags assigned at space creation time.
106
+ * Available on closed spaces.
107
+ */
108
+ get tags(): string[];
109
+
110
+ /**
111
+ * Immutable membership policy assigned at space creation time.
112
+ * Available on closed spaces.
113
+ */
114
+ get membershipPolicy(): MembershipPolicy;
115
+
93
116
  /**
94
117
  * Current state of the space.
95
118
  * The database is ready to be used in `SpaceState.SPACE_READY` state.
@@ -100,7 +123,7 @@ export interface Space {
100
123
  /**
101
124
  * Properties object.
102
125
  */
103
- get properties(): AnyLiveObject<any>;
126
+ get properties(): Obj.OfShape<SpaceProperties>;
104
127
 
105
128
  /**
106
129
  * Current state of space pipeline.
@@ -114,7 +137,7 @@ export interface Space {
114
137
  /**
115
138
  * @deprecated
116
139
  */
117
- // TODO(wittjosiah): Remove. This should not be exposed.
140
+ // TODO(wittjosiah): Audit and remove. This should not be exposed (or marked as internal).
118
141
  get internal(): SpaceInternal;
119
142
 
120
143
  /**
@@ -131,6 +154,13 @@ export interface Space {
131
154
  */
132
155
  close(): Promise<void>;
133
156
 
157
+ /**
158
+ * Tombstones (soft-deletes) the space and replicates the deletion to the user's other devices.
159
+ * Every device stops replicating and unloads the space. Underlying data is not removed until
160
+ * garbage collection (future work). This is terminal: the space cannot be re-opened via {@link open}.
161
+ */
162
+ delete(): Promise<void>;
163
+
134
164
  /**
135
165
  * Waits until the space is in the ready state, with database initialized.
136
166
  */
@@ -143,10 +173,6 @@ export interface Space {
143
173
  share(options?: Partial<Invitation>): CancellableInvitation;
144
174
  admitContact(contact: Contact): Promise<void>;
145
175
  updateMemberRole(request: Omit<UpdateMemberRoleRequest, 'spaceKey'>): Promise<void>;
146
-
147
- // TODO(wittjosiah): Gather into messaging abstraction?
148
- postMessage: (channel: string, message: any) => Promise<void>;
149
- listen: (channel: string, callback: (message: GossipMessage) => void) => CleanupFn;
150
176
  }
151
177
 
152
178
  export const isSpace = (object: unknown): object is Space =>
@@ -0,0 +1,57 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { Annotation, DXN, Feed, Ref, Type } from '@dxos/echo';
8
+
9
+ /**
10
+ * Where do triggers get executed.
11
+ */
12
+ export const ComputeEnvironment = Schema.Literal('disabled', 'local', 'edge');
13
+ export type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;
14
+
15
+ export const SpacePropertiesSchema = Schema.Struct({
16
+ //
17
+ // System properties.
18
+ //
19
+
20
+ // TODO(burdon): Change to mode (no booleans?)
21
+ // TODO(wittjosiah): Make optional with default value.
22
+ edgeReplication: Schema.optional(Schema.Boolean),
23
+
24
+ /**
25
+ * @deprecated
26
+ */
27
+ invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),
28
+
29
+ /**
30
+ * Preference for trigger execution.
31
+ * *disabled* - triggers do not run locally or on EDGE.
32
+ * *local* - triggers are executed locally on the client, edge is not running triggers.
33
+ * *edge* - triggers are executed on the edge, triggers are not run locally.
34
+ */
35
+ computeEnvironment: Schema.optional(ComputeEnvironment),
36
+
37
+ //
38
+ // User properties.
39
+ //
40
+
41
+ name: Schema.optional(Schema.String),
42
+ description: Schema.optional(Schema.String),
43
+ icon: Schema.optional(Schema.String),
44
+ iconHue: Schema.optional(Schema.String),
45
+ hue: Schema.optional(Schema.String),
46
+ });
47
+
48
+ export type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;
49
+
50
+ // TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?
51
+ // TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?
52
+ export const SpaceProperties = SpacePropertiesSchema.pipe(
53
+ Annotation.HiddenAnnotation.set(true),
54
+ Type.makeObject(DXN.make('org.dxos.type.spaceProperties', '0.1.0')),
55
+ );
56
+
57
+ export type SpaceProperties = Type.InstanceType<typeof SpaceProperties>;
@@ -2,4 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './Properties';
5
+ export * from './SpaceProperties';
@@ -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,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"}
@@ -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'>;