@dxos/client-protocol 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client-protocol",
3
- "version": "0.8.4-main.d05539e30a",
3
+ "version": "0.8.4-main.d9fc60f731",
4
4
  "description": "Core DXOS Client API.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -33,20 +33,19 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "base-x": "~3.0.11",
36
- "effect": "3.20.0",
37
- "@dxos/async": "0.8.4-main.d05539e30a",
38
- "@dxos/context": "0.8.4-main.d05539e30a",
39
- "@dxos/echo-db": "0.8.4-main.d05539e30a",
40
- "@dxos/credentials": "0.8.4-main.d05539e30a",
41
- "@dxos/invariant": "0.8.4-main.d05539e30a",
42
- "@dxos/keys": "0.8.4-main.d05539e30a",
43
- "@dxos/echo": "0.8.4-main.d05539e30a",
44
- "@dxos/node-std": "0.8.4-main.d05539e30a",
45
- "@dxos/rpc": "0.8.4-main.d05539e30a",
46
- "@dxos/protocols": "0.8.4-main.d05539e30a"
36
+ "effect": "3.21.2",
37
+ "@dxos/credentials": "0.8.4-main.d9fc60f731",
38
+ "@dxos/async": "0.8.4-main.d9fc60f731",
39
+ "@dxos/echo": "0.8.4-main.d9fc60f731",
40
+ "@dxos/echo-db": "0.8.4-main.d9fc60f731",
41
+ "@dxos/keys": "0.8.4-main.d9fc60f731",
42
+ "@dxos/invariant": "0.8.4-main.d9fc60f731",
43
+ "@dxos/node-std": "0.8.4-main.d9fc60f731",
44
+ "@dxos/protocols": "0.8.4-main.d9fc60f731",
45
+ "@dxos/rpc": "0.8.4-main.d9fc60f731"
47
46
  },
48
47
  "peerDependencies": {
49
- "effect": "3.20.0"
48
+ "effect": "3.21.2"
50
49
  },
51
50
  "publishConfig": {
52
51
  "access": "public"
@@ -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/space.ts CHANGED
@@ -154,6 +154,13 @@ export interface Space extends Messenger {
154
154
  */
155
155
  close(): Promise<void>;
156
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
+
157
164
  /**
158
165
  * Waits until the space is in the ready state, with database initialized.
159
166
  */
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { Annotation, Feed, Ref, Type } from '@dxos/echo';
7
+ import { Annotation, DXN, Feed, Ref, Type } from '@dxos/echo';
8
8
 
9
9
  /**
10
10
  * Where do triggers get executed.
@@ -12,65 +12,46 @@ import { Annotation, Feed, Ref, Type } from '@dxos/echo';
12
12
  export const ComputeEnvironment = Schema.Literal('disabled', 'local', 'edge');
13
13
  export type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;
14
14
 
15
- export const SpacePropertiesSchema = Schema.Struct(
16
- {
17
- //
18
- // System properties.
19
- //
20
-
21
- archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),
22
- // TODO(burdon): Change to mode (no booleans?)
23
- // TODO(wittjosiah): Make optional with default value.
24
- edgeReplication: Schema.optional(Schema.Boolean),
25
-
26
- /**
27
- * @deprecated
28
- */
29
- invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),
30
-
31
- /**
32
- * Preference for trigger execution.
33
- * *disabled* - triggers do not run locally or on EDGE.
34
- * *local* - triggers are executed locally on the client, edge is not running triggers.
35
- * *edge* - triggers are executed on the edge, triggers are not run locally.
36
- */
37
- computeEnvironment: Schema.optional(ComputeEnvironment),
38
-
39
- //
40
- // User properties.
41
- //
42
-
43
- name: Schema.optional(Schema.String),
44
- icon: Schema.optional(Schema.String),
45
- hue: Schema.optional(Schema.String),
46
- },
47
- {
48
- key: Schema.String,
49
- value: Schema.Any,
50
- },
51
- );
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
+ });
52
47
 
53
48
  export type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;
54
49
 
55
- /** @deprecated Use SpaceProperties instead. */
56
- export const LegacySpaceProperties = SpacePropertiesSchema.pipe(
57
- Type.object({
58
- typename: 'org.dxos.type.space-properties',
59
- version: '0.1.0',
60
- }),
61
- Annotation.SystemTypeAnnotation.set(true),
62
- );
63
-
64
- export interface LegacySpaceProperties extends Schema.Schema.Type<typeof LegacySpaceProperties> {}
65
-
66
50
  // TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?
67
51
  // TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?
68
52
  export const SpaceProperties = SpacePropertiesSchema.pipe(
69
- Type.object({
70
- typename: 'org.dxos.type.spaceProperties',
71
- version: '0.1.0',
72
- }),
73
- Annotation.SystemTypeAnnotation.set(true),
53
+ Annotation.HiddenAnnotation.set(true),
54
+ Type.makeObject(DXN.make('org.dxos.type.spaceProperties', '0.1.0')),
74
55
  );
75
56
 
76
- export interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {}
57
+ export type SpaceProperties = Type.InstanceType<typeof SpaceProperties>;
@@ -1,51 +0,0 @@
1
- // src/types/SpaceProperties.ts
2
- import * as Schema from "effect/Schema";
3
- import { Annotation, Feed, Ref, Type } from "@dxos/echo";
4
- var ComputeEnvironment = Schema.Literal("disabled", "local", "edge");
5
- var SpacePropertiesSchema = Schema.Struct({
6
- //
7
- // System properties.
8
- //
9
- archived: Schema.optional(Schema.Boolean.annotations({
10
- title: "Archive Space"
11
- })),
12
- // TODO(burdon): Change to mode (no booleans?)
13
- // TODO(wittjosiah): Make optional with default value.
14
- edgeReplication: Schema.optional(Schema.Boolean),
15
- /**
16
- * @deprecated
17
- */
18
- invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),
19
- /**
20
- * Preference for trigger execution.
21
- * *disabled* - triggers do not run locally or on EDGE.
22
- * *local* - triggers are executed locally on the client, edge is not running triggers.
23
- * *edge* - triggers are executed on the edge, triggers are not run locally.
24
- */
25
- computeEnvironment: Schema.optional(ComputeEnvironment),
26
- //
27
- // User properties.
28
- //
29
- name: Schema.optional(Schema.String),
30
- icon: Schema.optional(Schema.String),
31
- hue: Schema.optional(Schema.String)
32
- }, {
33
- key: Schema.String,
34
- value: Schema.Any
35
- });
36
- var LegacySpaceProperties = SpacePropertiesSchema.pipe(Type.object({
37
- typename: "org.dxos.type.space-properties",
38
- version: "0.1.0"
39
- }), Annotation.SystemTypeAnnotation.set(true));
40
- var SpaceProperties = SpacePropertiesSchema.pipe(Type.object({
41
- typename: "org.dxos.type.spaceProperties",
42
- version: "0.1.0"
43
- }), Annotation.SystemTypeAnnotation.set(true));
44
-
45
- export {
46
- ComputeEnvironment,
47
- SpacePropertiesSchema,
48
- LegacySpaceProperties,
49
- SpaceProperties
50
- };
51
- //# sourceMappingURL=chunk-GCBXMPTW.mjs.map
@@ -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, Feed, Ref, Type } from '@dxos/echo';\n\n/**\n * Where do triggers get executed.\n */\nexport const ComputeEnvironment = Schema.Literal('disabled', 'local', 'edge');\nexport type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;\n\nexport const SpacePropertiesSchema = Schema.Struct(\n {\n //\n // System properties.\n //\n\n archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),\n // TODO(burdon): Change to mode (no booleans?)\n // TODO(wittjosiah): Make optional with default value.\n edgeReplication: Schema.optional(Schema.Boolean),\n\n /**\n * @deprecated\n */\n invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),\n\n /**\n * Preference for trigger execution.\n * *disabled* - triggers do not run locally or on EDGE.\n * *local* - triggers are executed locally on the client, edge is not running triggers.\n * *edge* - triggers are executed on the edge, triggers are not run locally.\n */\n computeEnvironment: Schema.optional(ComputeEnvironment),\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/** @deprecated Use SpaceProperties instead. */\nexport const LegacySpaceProperties = SpacePropertiesSchema.pipe(\n Type.object({\n typename: 'org.dxos.type.space-properties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface LegacySpaceProperties extends Schema.Schema.Type<typeof LegacySpaceProperties> {}\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.object({\n typename: 'org.dxos.type.spaceProperties',\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,MAAMC,KAAKC,YAAY;AAKrC,IAAMC,qBAA4BC,eAAQ,YAAY,SAAS,MAAA;AAG/D,IAAMC,wBAA+BC,cAC1C;;;;EAKEC,UAAiBC,gBAAgBC,eAAQC,YAAY;IAAEC,OAAO;EAAgB,CAAA,CAAA;;;EAG9EC,iBAAwBJ,gBAAgBC,cAAO;;;;EAK/CI,qBAA4BL,gBAASP,IAAIA,IAAID,KAAKA,IAAI,CAAA;;;;;;;EAQtDc,oBAA2BN,gBAASL,kBAAAA;;;;EAMpCY,MAAaP,gBAAgBQ,aAAM;EACnCC,MAAaT,gBAAgBQ,aAAM;EACnCE,KAAYV,gBAAgBQ,aAAM;AACpC,GACA;EACEG,KAAYH;EACZI,OAAcC;AAChB,CAAA;AAMK,IAAMC,wBAAwBjB,sBAAsBkB,KACzDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;AAO/B,IAAMC,kBAAkBxB,sBAAsBkB,KACnDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;",
6
- "names": ["Schema", "Annotation", "Feed", "Ref", "Type", "ComputeEnvironment", "Literal", "SpacePropertiesSchema", "Struct", "archived", "optional", "Boolean", "annotations", "title", "edgeReplication", "invocationTraceFeed", "computeEnvironment", "name", "String", "icon", "hue", "key", "value", "Any", "LegacySpaceProperties", "pipe", "object", "typename", "version", "SystemTypeAnnotation", "set", "SpaceProperties"]
7
- }
@@ -1,53 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/types/SpaceProperties.ts
4
- import * as Schema from "effect/Schema";
5
- import { Annotation, Feed, Ref, Type } from "@dxos/echo";
6
- var ComputeEnvironment = Schema.Literal("disabled", "local", "edge");
7
- var SpacePropertiesSchema = Schema.Struct({
8
- //
9
- // System properties.
10
- //
11
- archived: Schema.optional(Schema.Boolean.annotations({
12
- title: "Archive Space"
13
- })),
14
- // TODO(burdon): Change to mode (no booleans?)
15
- // TODO(wittjosiah): Make optional with default value.
16
- edgeReplication: Schema.optional(Schema.Boolean),
17
- /**
18
- * @deprecated
19
- */
20
- invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),
21
- /**
22
- * Preference for trigger execution.
23
- * *disabled* - triggers do not run locally or on EDGE.
24
- * *local* - triggers are executed locally on the client, edge is not running triggers.
25
- * *edge* - triggers are executed on the edge, triggers are not run locally.
26
- */
27
- computeEnvironment: Schema.optional(ComputeEnvironment),
28
- //
29
- // User properties.
30
- //
31
- name: Schema.optional(Schema.String),
32
- icon: Schema.optional(Schema.String),
33
- hue: Schema.optional(Schema.String)
34
- }, {
35
- key: Schema.String,
36
- value: Schema.Any
37
- });
38
- var LegacySpaceProperties = SpacePropertiesSchema.pipe(Type.object({
39
- typename: "org.dxos.type.space-properties",
40
- version: "0.1.0"
41
- }), Annotation.SystemTypeAnnotation.set(true));
42
- var SpaceProperties = SpacePropertiesSchema.pipe(Type.object({
43
- typename: "org.dxos.type.spaceProperties",
44
- version: "0.1.0"
45
- }), Annotation.SystemTypeAnnotation.set(true));
46
-
47
- export {
48
- ComputeEnvironment,
49
- SpacePropertiesSchema,
50
- LegacySpaceProperties,
51
- SpaceProperties
52
- };
53
- //# sourceMappingURL=chunk-2RN4CLEW.mjs.map
@@ -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, Feed, Ref, Type } from '@dxos/echo';\n\n/**\n * Where do triggers get executed.\n */\nexport const ComputeEnvironment = Schema.Literal('disabled', 'local', 'edge');\nexport type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;\n\nexport const SpacePropertiesSchema = Schema.Struct(\n {\n //\n // System properties.\n //\n\n archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),\n // TODO(burdon): Change to mode (no booleans?)\n // TODO(wittjosiah): Make optional with default value.\n edgeReplication: Schema.optional(Schema.Boolean),\n\n /**\n * @deprecated\n */\n invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),\n\n /**\n * Preference for trigger execution.\n * *disabled* - triggers do not run locally or on EDGE.\n * *local* - triggers are executed locally on the client, edge is not running triggers.\n * *edge* - triggers are executed on the edge, triggers are not run locally.\n */\n computeEnvironment: Schema.optional(ComputeEnvironment),\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/** @deprecated Use SpaceProperties instead. */\nexport const LegacySpaceProperties = SpacePropertiesSchema.pipe(\n Type.object({\n typename: 'org.dxos.type.space-properties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface LegacySpaceProperties extends Schema.Schema.Type<typeof LegacySpaceProperties> {}\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.object({\n typename: 'org.dxos.type.spaceProperties',\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,MAAMC,KAAKC,YAAY;AAKrC,IAAMC,qBAA4BC,eAAQ,YAAY,SAAS,MAAA;AAG/D,IAAMC,wBAA+BC,cAC1C;;;;EAKEC,UAAiBC,gBAAgBC,eAAQC,YAAY;IAAEC,OAAO;EAAgB,CAAA,CAAA;;;EAG9EC,iBAAwBJ,gBAAgBC,cAAO;;;;EAK/CI,qBAA4BL,gBAASP,IAAIA,IAAID,KAAKA,IAAI,CAAA;;;;;;;EAQtDc,oBAA2BN,gBAASL,kBAAAA;;;;EAMpCY,MAAaP,gBAAgBQ,aAAM;EACnCC,MAAaT,gBAAgBQ,aAAM;EACnCE,KAAYV,gBAAgBQ,aAAM;AACpC,GACA;EACEG,KAAYH;EACZI,OAAcC;AAChB,CAAA;AAMK,IAAMC,wBAAwBjB,sBAAsBkB,KACzDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;AAO/B,IAAMC,kBAAkBxB,sBAAsBkB,KACnDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;",
6
- "names": ["Schema", "Annotation", "Feed", "Ref", "Type", "ComputeEnvironment", "Literal", "SpacePropertiesSchema", "Struct", "archived", "optional", "Boolean", "annotations", "title", "edgeReplication", "invocationTraceFeed", "computeEnvironment", "name", "String", "icon", "hue", "key", "value", "Any", "LegacySpaceProperties", "pipe", "object", "typename", "version", "SystemTypeAnnotation", "set", "SpaceProperties"]
7
- }