@dxos/client-protocol 0.4.9 → 0.4.10-main.05b9ab6

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 (36) hide show
  1. package/dist/lib/browser/index.mjs +19 -43
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +19 -43
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/types/src/echo.d.ts +8 -4
  8. package/dist/types/src/echo.d.ts.map +1 -1
  9. package/dist/types/src/halo.d.ts +18 -5
  10. package/dist/types/src/halo.d.ts.map +1 -1
  11. package/dist/types/src/index.d.ts +0 -1
  12. package/dist/types/src/index.d.ts.map +1 -1
  13. package/dist/types/src/invitations/encoder.d.ts +1 -1
  14. package/dist/types/src/invitations/encoder.d.ts.map +1 -1
  15. package/dist/types/src/schema.d.ts +19 -9
  16. package/dist/types/src/schema.d.ts.map +1 -1
  17. package/dist/types/src/service-definitions.d.ts +3 -2
  18. package/dist/types/src/service-definitions.d.ts.map +1 -1
  19. package/dist/types/src/space.d.ts +6 -6
  20. package/dist/types/src/space.d.ts.map +1 -1
  21. package/package.json +12 -17
  22. package/src/echo.ts +8 -5
  23. package/src/halo.ts +22 -5
  24. package/src/index.ts +1 -1
  25. package/src/invitations/encoder.test.ts +29 -23
  26. package/src/invitations/encoder.ts +8 -2
  27. package/src/schema.ts +9 -9
  28. package/src/service-definitions.ts +3 -3
  29. package/src/space.ts +7 -7
  30. package/dist/types/src/proto/gen/schema.d.ts +0 -15
  31. package/dist/types/src/proto/gen/schema.d.ts.map +0 -1
  32. package/dist/types/src/proto/index.d.ts +0 -2
  33. package/dist/types/src/proto/index.d.ts.map +0 -1
  34. package/src/proto/gen/schema.ts +0 -41
  35. package/src/proto/index.ts +0 -5
  36. package/src/proto/schema.proto +0 -16
@@ -1,8 +1,10 @@
1
1
  import type { MulticastObservable } from '@dxos/async';
2
- import type { TypeCollection } from '@dxos/echo-schema';
2
+ import type { FilterSource, Query } from '@dxos/echo-db';
3
3
  import type { PublicKey } from '@dxos/keys';
4
4
  import type { Invitation } from '@dxos/protocols/proto/dxos/client/services';
5
+ import type { QueryOptions } from '@dxos/protocols/proto/dxos/echo/filter';
5
6
  import type { AuthenticatingInvitation } from './invitations';
7
+ import type { PropertiesProps } from './schema';
6
8
  import type { Space } from './space';
7
9
  export declare const defaultKey = "__DEFAULT__";
8
10
  /**
@@ -28,7 +30,7 @@ export interface Echo extends MulticastObservable<Space[]> {
28
30
  /**
29
31
  * Creates a new space.
30
32
  */
31
- create(): Promise<Space>;
33
+ create(meta?: PropertiesProps): Promise<Space>;
32
34
  /**
33
35
  * Creates a space from the given snapshot.
34
36
  */
@@ -37,8 +39,10 @@ export interface Echo extends MulticastObservable<Space[]> {
37
39
  */
38
40
  join(invitation: Invitation | string): AuthenticatingInvitation;
39
41
  /**
40
- * Adds a schema to ECHO.
42
+ * Query all spaces.
43
+ * @param filter
44
+ * @param options
41
45
  */
42
- addSchema(schema: TypeCollection): void;
46
+ query<T extends {} = any>(filter?: FilterSource<T>, options?: QueryOptions): Query<T>;
43
47
  }
44
48
  //# sourceMappingURL=echo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../src/echo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAE7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIrC,eAAO,MAAM,UAAU,g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EH,IAAI,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE5C;;OAEG;IACH,GAAG,IAAI,KAAK,EAAE,CAAC;IAEf;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;IAE5C;;OAEG;IACH,IAAI,OAAO,IAAI,KAAK,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAE/C;;OAEG;IAGH;;OAEG;IACH,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,wBAAwB,CAAC;IAEhE;;;;OAIG;IACH,KAAK,CAAC,CAAC,SAAS,EAAE,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;CACvF"}
@@ -1,6 +1,7 @@
1
- import { type MulticastObservable } from '@dxos/async';
1
+ import { type ObservableProvider, type MulticastObservable } from '@dxos/async';
2
+ import { type PublicKey } from '@dxos/keys';
2
3
  import { type Contact, type Device, type Identity, type Invitation } from '@dxos/protocols/proto/dxos/client/services';
3
- import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
4
+ import { type DeviceProfileDocument, type Credential, type Presentation, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
4
5
  import { type AuthenticatingInvitation, type CancellableInvitation } from './invitations';
5
6
  /**
6
7
  * TODO(burdon): Public API (move comments here).
@@ -11,10 +12,22 @@ export interface Halo {
11
12
  get device(): Device | undefined;
12
13
  get contacts(): MulticastObservable<Contact[]>;
13
14
  get invitations(): MulticastObservable<CancellableInvitation[]>;
14
- createIdentity(options?: ProfileDocument): Promise<Identity>;
15
+ createIdentity(options?: ProfileDocument, deviceProfile?: DeviceProfileDocument): Promise<Identity>;
15
16
  recoverIdentity(recoveryKey: Uint8Array): Promise<Identity>;
16
17
  updateProfile(profile: ProfileDocument): Promise<Identity>;
17
- share(): CancellableInvitation;
18
- join(invitation: Invitation): AuthenticatingInvitation;
18
+ share(options?: Partial<Invitation>): CancellableInvitation;
19
+ join(invitation: Invitation, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;
20
+ queryCredentials(options?: {
21
+ ids?: PublicKey[];
22
+ type?: string;
23
+ }): ObservableProvider<{
24
+ onUpdate: (credentials: Credential[]) => void;
25
+ onError: (error?: Error) => void;
26
+ }, Credential[]>;
27
+ writeCredentials(credentials: Credential[]): Promise<void>;
28
+ presentCredentials(options: {
29
+ ids: PublicKey[];
30
+ nonce?: Uint8Array;
31
+ }): Promise<Presentation>;
19
32
  }
20
33
  //# sourceMappingURL=halo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"halo.d.ts","sourceRoot":"","sources":["../../../src/halo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACvH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,QAAQ,IAAI,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACrD,IAAI,OAAO,IAAI,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,QAAQ,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/C,IAAI,WAAW,IAAI,mBAAmB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAEh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,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpG,eAAe,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5D,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE3D,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,qBAAqB,CAAC;IAC5D,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,qBAAqB,GAAG,wBAAwB,CAAC;IAG9F,gBAAgB,CAAC,OAAO,CAAC,EAAE;QACzB,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,kBAAkB,CACpB;QAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;QAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;KAAE,EACnF,UAAU,EAAE,CACb,CAAC;IACF,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,kBAAkB,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,SAAS,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC9F"}
@@ -2,7 +2,6 @@ export * from './config';
2
2
  export * from './echo';
3
3
  export * from './halo';
4
4
  export * from './invitations';
5
- export * from './proto';
6
5
  export * from './service-definitions';
7
6
  export * from './shell';
8
7
  export * from './space';
@@ -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,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,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,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type Invitation } from '@dxos/protocols/proto/dxos/client/services';
1
+ import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
2
2
  /**
3
3
  * Encodes and decodes an invitation proto into/from alphanumeric chars.
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../../src/invitations/encoder.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAO7E;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAIvC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;CAgB9C"}
1
+ {"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../../src/invitations/encoder.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAOxE;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IASvC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;CAiB9C"}
@@ -1,16 +1,26 @@
1
- import * as S from '@effect/schema/Schema';
2
- import * as E from '@dxos/echo-schema';
3
- export declare const PropertiesSchema: S.Schema<{
1
+ import { S } from '@dxos/echo-schema';
2
+ declare const _Properties: S.Schema<{
3
+ [x: string]: any;
4
4
  readonly id: string;
5
5
  name?: string | undefined;
6
- "composer.dxos.org.opened"?: number | undefined;
7
- "composer.dxos.org.version"?: string | number | undefined;
8
- "braneframe.Folder"?: E.AnyEchoObject | undefined;
9
6
  }, {
7
+ [x: string]: any;
10
8
  readonly id: string;
11
9
  name?: string | undefined;
12
- "composer.dxos.org.opened"?: number | undefined;
13
- "composer.dxos.org.version"?: string | number | undefined;
14
- "braneframe.Folder"?: E.AnyEchoObject | undefined;
15
10
  }, never>;
11
+ export interface Properties extends S.Schema.Type<typeof _Properties> {
12
+ }
13
+ export declare const Properties: S.Schema<{
14
+ [x: string]: any;
15
+ readonly id: string;
16
+ name?: string | undefined;
17
+ }, {
18
+ [x: string]: any;
19
+ readonly id: string;
20
+ name?: string | undefined;
21
+ }, never>;
22
+ export type PropertiesProps = {
23
+ name?: string;
24
+ };
25
+ export {};
16
26
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,OAAO,KAAK,CAAC,MAAM,mBAAmB,CAAC;AAEvC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;SAM+B,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAA,MAAM,WAAW;;;;;;;;SAEhB,CAAC;AACF,MAAM,WAAW,UAAW,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC;CAAG;AACxE,eAAO,MAAM,UAAU;;;;;;;;SAAc,CAAC;AAEtC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { type Event } from '@dxos/async';
2
2
  import { type Context } from '@dxos/context';
3
3
  import { type FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';
4
- import { type IndexService, type DevicesService, type IdentityService, type InvitationsService, type LoggingService, type NetworkService, type SpacesService, type SystemService } from '@dxos/protocols/proto/dxos/client/services';
4
+ import { type DevicesService, type IdentityService, type InvitationsService, type LoggingService, type NetworkService, type SpacesService, type SystemService } from '@dxos/protocols/proto/dxos/client/services';
5
5
  import { type DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';
6
+ import { type QueryService } from '@dxos/protocols/proto/dxos/echo/query';
6
7
  import { type DataService } from '@dxos/protocols/proto/dxos/echo/service';
7
8
  import type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';
8
9
  import type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';
@@ -14,7 +15,7 @@ export type ClientServices = {
14
15
  LoggingService: LoggingService;
15
16
  IdentityService: IdentityService;
16
17
  InvitationsService: InvitationsService;
17
- IndexService: IndexService;
18
+ QueryService: QueryService;
18
19
  DevicesService: DevicesService;
19
20
  SpacesService: SpacesService;
20
21
  DataService: DataService;
@@ -1 +1 @@
1
- {"version":3,"file":"service-definitions.d.ts","sourceRoot":"","sources":["../../../src/service-definitions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,K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AG;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,15 +1,12 @@
1
1
  import { type MulticastObservable, type UnsubscribeCallback } from '@dxos/async';
2
- import { type EchoDatabase, type TypedObject } from '@dxos/echo-schema';
2
+ import { type EchoDatabase } from '@dxos/echo-db';
3
+ import { type EchoReactiveObject } from '@dxos/echo-schema';
3
4
  import { type PublicKey } from '@dxos/keys';
4
5
  import { type Invitation, type Space as SpaceData, type SpaceMember, type SpaceState } from '@dxos/protocols/proto/dxos/client/services';
5
6
  import { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
6
7
  import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
7
8
  import { type CancellableInvitation } from './invitations';
8
9
  export interface SpaceInternal {
9
- /**
10
- * @deprecated
11
- */
12
- get db(): never;
13
10
  get data(): SpaceData;
14
11
  /**
15
12
  * Activates the space enabling the use of the database and starts replication with peers.
@@ -35,7 +32,7 @@ export interface Space {
35
32
  /**
36
33
  * Properties object.
37
34
  */
38
- get properties(): TypedObject;
35
+ get properties(): EchoReactiveObject<any>;
39
36
  /**
40
37
  * Current state of the space.
41
38
  * The database is ready to be used in `SpaceState.READY` state.
@@ -48,6 +45,9 @@ export interface Space {
48
45
  get pipeline(): MulticastObservable<SpaceData.PipelineState>;
49
46
  get invitations(): MulticastObservable<CancellableInvitation[]>;
50
47
  get members(): MulticastObservable<SpaceMember[]>;
48
+ /**
49
+ * @deprecated
50
+ */
51
51
  get internal(): SpaceInternal;
52
52
  open(): Promise<void>;
53
53
  close(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,KAAK,UAAU,EACf,KAAK,KAAK,IAAI,SAAS,EACvB,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,KAAK,CAAC;IAEhB,IAAI,IAAI,IAAI,SAAS,CAAC;IAEtB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAGvB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAGD,MAAM,WAAW,KAAK;IACpB,IAAI,GAAG,IAAI,SAAS,CAAC;IAErB;;OAEG;IACH,IAAI,EAAE,IAAI,YAAY,CAAC;IACvB,IAAI,MAAM,IAAI,OAAO,CAAC;IAEtB;;OAEG;IACH,IAAI,UAAU,IAAI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AAC,IAAI,CAAC,CAAC;IAGhC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,KAAK,mBAAmB,CAAC;IAE7F,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,qBAAqB,CAAC;IAE5D,cAAc,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CAC1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client-protocol",
3
- "version": "0.4.9",
3
+ "version": "0.4.10-main.05b9ab6",
4
4
  "description": "Core DXOS Client API.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -17,27 +17,22 @@
17
17
  "src"
18
18
  ],
19
19
  "dependencies": {
20
- "@effect/schema": "0.64.7",
21
20
  "base-x": "~3.0.9",
22
- "effect": "2.4.9",
23
- "@dxos/async": "0.4.9",
24
- "@dxos/config": "0.4.9",
25
- "@dxos/context": "0.4.9",
26
- "@dxos/echo-schema": "0.4.9",
27
- "@dxos/echo-db": "0.4.9",
28
- "@dxos/invariant": "0.4.9",
29
- "@dxos/keys": "0.4.9",
30
- "@dxos/protocols": "0.4.9",
31
- "@dxos/node-std": "0.4.9",
32
- "@dxos/rpc": "0.4.9"
21
+ "@dxos/async": "0.4.10-main.05b9ab6",
22
+ "@dxos/config": "0.4.10-main.05b9ab6",
23
+ "@dxos/context": "0.4.10-main.05b9ab6",
24
+ "@dxos/echo-db": "0.4.10-main.05b9ab6",
25
+ "@dxos/echo-schema": "0.4.10-main.05b9ab6",
26
+ "@dxos/invariant": "0.4.10-main.05b9ab6",
27
+ "@dxos/keys": "0.4.10-main.05b9ab6",
28
+ "@dxos/protocols": "0.4.10-main.05b9ab6",
29
+ "@dxos/node-std": "0.4.10-main.05b9ab6",
30
+ "@dxos/rpc": "0.4.10-main.05b9ab6"
33
31
  },
34
32
  "devDependencies": {
35
- "@dxos/echo-typegen": "0.4.9"
33
+ "@dxos/echo-typegen": "0.4.10-main.05b9ab6"
36
34
  },
37
35
  "publishConfig": {
38
36
  "access": "public"
39
- },
40
- "scripts": {
41
- "prebuild": "dxtype src/proto/schema.proto src/proto/gen/schema.ts"
42
37
  }
43
38
  }
package/src/echo.ts CHANGED
@@ -3,11 +3,13 @@
3
3
  //
4
4
 
5
5
  import type { MulticastObservable } from '@dxos/async';
6
- import type { TypeCollection } from '@dxos/echo-schema';
6
+ import type { FilterSource, Query } from '@dxos/echo-db';
7
7
  import type { PublicKey } from '@dxos/keys';
8
8
  import type { Invitation } from '@dxos/protocols/proto/dxos/client/services';
9
+ import type { QueryOptions } from '@dxos/protocols/proto/dxos/echo/filter';
9
10
 
10
11
  import type { AuthenticatingInvitation } from './invitations';
12
+ import type { PropertiesProps } from './schema';
11
13
  import type { Space } from './space';
12
14
 
13
15
  // Space properties key for default metadata.
@@ -45,7 +47,7 @@ export interface Echo extends MulticastObservable<Space[]> {
45
47
  /**
46
48
  * Creates a new space.
47
49
  */
48
- create(): Promise<Space>;
50
+ create(meta?: PropertiesProps): Promise<Space>;
49
51
 
50
52
  /**
51
53
  * Creates a space from the given snapshot.
@@ -58,8 +60,9 @@ export interface Echo extends MulticastObservable<Space[]> {
58
60
  join(invitation: Invitation | string): AuthenticatingInvitation;
59
61
 
60
62
  /**
61
- * Adds a schema to ECHO.
63
+ * Query all spaces.
64
+ * @param filter
65
+ * @param options
62
66
  */
63
- // TODO(dmaretskyi): Rename `addTypes`.
64
- addSchema(schema: TypeCollection): void;
67
+ query<T extends {} = any>(filter?: FilterSource<T>, options?: QueryOptions): Query<T>;
65
68
  }
package/src/halo.ts CHANGED
@@ -2,9 +2,15 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import { type MulticastObservable } from '@dxos/async';
5
+ import { type ObservableProvider, type MulticastObservable } from '@dxos/async';
6
+ import { type PublicKey } from '@dxos/keys';
6
7
  import { type Contact, type Device, type Identity, type Invitation } from '@dxos/protocols/proto/dxos/client/services';
7
- import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
8
+ import {
9
+ type DeviceProfileDocument,
10
+ type Credential,
11
+ type Presentation,
12
+ type ProfileDocument,
13
+ } from '@dxos/protocols/proto/dxos/halo/credentials';
8
14
 
9
15
  import { type AuthenticatingInvitation, type CancellableInvitation } from './invitations';
10
16
 
@@ -18,10 +24,21 @@ export interface Halo {
18
24
  get contacts(): MulticastObservable<Contact[]>;
19
25
  get invitations(): MulticastObservable<CancellableInvitation[]>;
20
26
 
21
- createIdentity(options?: ProfileDocument): Promise<Identity>;
27
+ createIdentity(options?: ProfileDocument, deviceProfile?: DeviceProfileDocument): Promise<Identity>;
22
28
  recoverIdentity(recoveryKey: Uint8Array): Promise<Identity>;
23
29
  updateProfile(profile: ProfileDocument): Promise<Identity>;
24
30
 
25
- share(): CancellableInvitation;
26
- join(invitation: Invitation): AuthenticatingInvitation;
31
+ share(options?: Partial<Invitation>): CancellableInvitation;
32
+ join(invitation: Invitation, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;
33
+
34
+ // TODO(wittjosiah): Migrate to multicast observable.
35
+ queryCredentials(options?: {
36
+ ids?: PublicKey[];
37
+ type?: string;
38
+ }): ObservableProvider<
39
+ { onUpdate: (credentials: Credential[]) => void; onError: (error?: Error) => void },
40
+ Credential[]
41
+ >;
42
+ writeCredentials(credentials: Credential[]): Promise<void>;
43
+ presentCredentials(options: { ids: PublicKey[]; nonce?: Uint8Array }): Promise<Presentation>;
27
44
  }
package/src/index.ts CHANGED
@@ -6,9 +6,9 @@ export * from './config';
6
6
  export * from './echo';
7
7
  export * from './halo';
8
8
  export * from './invitations';
9
- export * from './proto';
10
9
  export * from './service-definitions';
11
10
  export * from './shell';
12
11
  export * from './space';
13
12
  export * from './timeouts';
14
13
  export * from './schema';
14
+ // This comment is here to bust NX cache. Remove it after the code changes.
@@ -10,42 +10,48 @@ import { describe, test } from '@dxos/test';
10
10
 
11
11
  import { InvitationEncoder } from './encoder';
12
12
 
13
+ const baseInvitation: Invitation = {
14
+ invitationId: PublicKey.random().toHex(),
15
+ type: Invitation.Type.INTERACTIVE,
16
+ kind: Invitation.Kind.SPACE,
17
+ authMethod: Invitation.AuthMethod.NONE,
18
+ state: Invitation.State.INIT,
19
+ swarmKey: PublicKey.random(),
20
+ spaceKey: PublicKey.random(),
21
+ };
22
+
13
23
  describe('Invitation utils', () => {
14
24
  test('encodes and decodes an invitation', () => {
15
- const invitation: Invitation = {
16
- invitationId: PublicKey.random().toHex(),
17
- type: Invitation.Type.INTERACTIVE,
18
- kind: Invitation.Kind.SPACE,
19
- authMethod: Invitation.AuthMethod.NONE,
20
- state: Invitation.State.INIT,
21
- swarmKey: PublicKey.random(),
22
- spaceKey: PublicKey.random(),
23
- };
24
-
25
- const encoded = InvitationEncoder.encode(invitation);
25
+ const encoded = InvitationEncoder.encode(baseInvitation);
26
26
  const decoded = InvitationEncoder.decode(encoded);
27
- expect(decoded).to.deep.eq(invitation);
27
+ expect(decoded).to.deep.eq(baseInvitation);
28
28
  });
29
29
 
30
30
  test('secrets are never encoded into invitation code', () => {
31
- const invitation: Invitation = {
32
- invitationId: PublicKey.random().toHex(),
33
- type: Invitation.Type.INTERACTIVE,
34
- kind: Invitation.Kind.SPACE,
35
- authMethod: Invitation.AuthMethod.NONE,
36
- state: Invitation.State.INIT,
37
- swarmKey: PublicKey.random(),
38
- spaceKey: PublicKey.random(),
39
- };
40
-
41
31
  const encoded = InvitationEncoder.encode({
42
- ...invitation,
32
+ ...baseInvitation,
43
33
  authCode: 'example',
44
34
  identityKey: PublicKey.random(),
45
35
  });
46
36
  const decoded = InvitationEncoder.decode(encoded);
47
37
  expect(decoded.authCode).to.not.exist;
48
38
  expect(decoded.identityKey).to.not.exist;
39
+ expect(decoded).to.deep.eq(baseInvitation);
40
+ });
41
+
42
+ test('guestKeypair for known public key auth method is encoded', () => {
43
+ const invitation: Invitation = {
44
+ ...baseInvitation,
45
+ guestKeypair: {
46
+ publicKey: PublicKey.random(),
47
+ privateKey: PublicKey.random().asBuffer(),
48
+ },
49
+ };
50
+
51
+ const encoded = InvitationEncoder.encode(invitation);
52
+ const decoded = InvitationEncoder.decode(encoded);
53
+ expect(decoded.authCode).to.not.exist;
54
+ expect(decoded.identityKey).to.not.exist;
49
55
  expect(decoded).to.deep.eq(invitation);
50
56
  });
51
57
  });
@@ -5,7 +5,7 @@
5
5
  import base from 'base-x';
6
6
 
7
7
  import { schema } from '@dxos/protocols';
8
- import { type Invitation } from '@dxos/protocols/proto/dxos/client/services';
8
+ import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
9
9
 
10
10
  // Encode with URL-safe alpha-numeric characters.
11
11
  const base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
@@ -17,7 +17,12 @@ const codec = schema.getCodecForType('dxos.client.services.Invitation');
17
17
  */
18
18
  export class InvitationEncoder {
19
19
  static decode(text: string): Invitation {
20
- return codec.decode(base62.decode(text));
20
+ const decodedInvitation = codec.decode(base62.decode(text));
21
+ if (decodedInvitation.type === Invitation.Type.MULTIUSE) {
22
+ decodedInvitation.type = Invitation.Type.INTERACTIVE;
23
+ decodedInvitation.multiUse = true;
24
+ }
25
+ return decodedInvitation;
21
26
  }
22
27
 
23
28
  static encode(invitation: Invitation): string {
@@ -30,6 +35,7 @@ export class InvitationEncoder {
30
35
  swarmKey: invitation.swarmKey,
31
36
  state: invitation.state,
32
37
  timeout: invitation.timeout,
38
+ guestKeypair: invitation.guestKeypair,
33
39
  // TODO(wittjosiah): Make these optional to encode for greater privacy.
34
40
  ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),
35
41
  ...(invitation.target ? { target: invitation.target } : {}),
package/src/schema.ts CHANGED
@@ -2,14 +2,14 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import * as S from '@effect/schema/Schema';
5
+ import { echoObject, S } from '@dxos/echo-schema';
6
6
 
7
- import * as E from '@dxos/echo-schema';
7
+ const _Properties = S.struct({ name: S.optional(S.string) }, { key: S.string, value: S.any }).pipe(
8
+ echoObject('dxos.sdk.client.Properties', '0.1.0'),
9
+ );
10
+ export interface Properties extends S.Schema.Type<typeof _Properties> {}
11
+ export const Properties = _Properties;
8
12
 
9
- export const PropertiesSchema = S.struct({
10
- name: S.optional(S.string),
11
- // TODO(dmaretskyi): Remove.
12
- 'composer.dxos.org.opened': S.optional(S.number),
13
- 'composer.dxos.org.version': S.optional(S.union(S.string, S.number)),
14
- 'braneframe.Folder': S.optional(E.ref(E.AnyEchoObject)),
15
- }).pipe(E.echoObject('dxos.sdk.client.Properties', '0.1.0'));
13
+ export type PropertiesProps = {
14
+ name?: string;
15
+ };
@@ -7,7 +7,6 @@ import { type Context } from '@dxos/context';
7
7
  import { schema } from '@dxos/protocols';
8
8
  import { type FunctionRegistryService } from '@dxos/protocols/proto/dxos/agent/functions';
9
9
  import {
10
- type IndexService,
11
10
  type DevicesService,
12
11
  type IdentityService,
13
12
  type InvitationsService,
@@ -17,6 +16,7 @@ import {
17
16
  type SystemService,
18
17
  } from '@dxos/protocols/proto/dxos/client/services';
19
18
  import { type DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';
19
+ import { type QueryService } from '@dxos/protocols/proto/dxos/echo/query';
20
20
  import { type DataService } from '@dxos/protocols/proto/dxos/echo/service';
21
21
  import type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';
22
22
  import type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';
@@ -34,7 +34,7 @@ export type ClientServices = {
34
34
 
35
35
  IdentityService: IdentityService;
36
36
  InvitationsService: InvitationsService;
37
- IndexService: IndexService;
37
+ QueryService: QueryService;
38
38
  DevicesService: DevicesService;
39
39
  SpacesService: SpacesService;
40
40
  DataService: DataService;
@@ -73,7 +73,7 @@ export const clientServiceBundle = createServiceBundle<ClientServices>({
73
73
  LoggingService: schema.getService('dxos.client.services.LoggingService'),
74
74
 
75
75
  IdentityService: schema.getService('dxos.client.services.IdentityService'),
76
- IndexService: schema.getService('dxos.client.services.IndexService'),
76
+ QueryService: schema.getService('dxos.echo.query.QueryService'),
77
77
  InvitationsService: schema.getService('dxos.client.services.InvitationsService'),
78
78
  DevicesService: schema.getService('dxos.client.services.DevicesService'),
79
79
  SpacesService: schema.getService('dxos.client.services.SpacesService'),
package/src/space.ts CHANGED
@@ -3,7 +3,8 @@
3
3
  //
4
4
 
5
5
  import { type MulticastObservable, type UnsubscribeCallback } from '@dxos/async';
6
- import { type EchoDatabase, type TypedObject } from '@dxos/echo-schema';
6
+ import { type EchoDatabase } from '@dxos/echo-db';
7
+ import { type EchoReactiveObject } from '@dxos/echo-schema';
7
8
  import { type PublicKey } from '@dxos/keys';
8
9
  import {
9
10
  type Invitation,
@@ -17,11 +18,6 @@ import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gos
17
18
  import { type CancellableInvitation } from './invitations';
18
19
 
19
20
  export interface SpaceInternal {
20
- /**
21
- * @deprecated
22
- */
23
- get db(): never;
24
-
25
21
  get data(): SpaceData;
26
22
 
27
23
  /**
@@ -56,7 +52,7 @@ export interface Space {
56
52
  /**
57
53
  * Properties object.
58
54
  */
59
- get properties(): TypedObject;
55
+ get properties(): EchoReactiveObject<any>;
60
56
 
61
57
  /**
62
58
  * Current state of the space.
@@ -73,6 +69,10 @@ export interface Space {
73
69
  get invitations(): MulticastObservable<CancellableInvitation[]>;
74
70
  get members(): MulticastObservable<SpaceMember[]>;
75
71
 
72
+ /**
73
+ * @deprecated
74
+ */
75
+ // TODO(wittjosiah): Remove. This should not be exposed.
76
76
  get internal(): SpaceInternal;
77
77
 
78
78
  open(): Promise<void>;
@@ -1,15 +0,0 @@
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 types: dxos_echo_schema.TypeCollection;
6
- export type PropertiesProps = {
7
- name: string;
8
- };
9
- export declare class Properties extends dxos_echo_schema.TypedObject<PropertiesProps> {
10
- static readonly schema: dxos_echo_schema.Schema;
11
- static filter(filter?: Partial<PropertiesProps> | dxos_echo_schema.OperatorFilter<Properties>): dxos_echo_schema.Filter<Properties>;
12
- constructor(initValues?: Partial<PropertiesProps>, opts?: dxos_echo_schema.TypedObjectOptions);
13
- name: string;
14
- }
15
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
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;AAEtD,eAAO,MAAM,KAAK,iCAAwC,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,UAAW,SAAQ,gBAAgB,CAAC,WAAW,CAAC,eAAe,CAAC;IAC3E,gBAAwB,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAExD,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,EACH,OAAO,CAAC,eAAe,CAAC,GACxB,gBAAgB,CAAC,cAAc,CAAC,UAAU,CAAC,GAC9C,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC;gBAQpC,UAAU,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACrC,IAAI,CAAC,EAAE,gBAAgB,CAAC,kBAAkB;IAIpC,IAAI,EAAE,MAAM,CAAC;CACtB"}
@@ -1,2 +0,0 @@
1
- export * from './gen/schema';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/proto/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}