@dxos/protocols 0.6.1 → 0.6.2-main.8a232a5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/proto/gen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAgEhE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AA2jB7C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,wk6GAAwk6G,CAAC,CAAC,CAAC;AACjo6G,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAkB,UAAU,EAAE,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/proto/gen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAgEhE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAujB7C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,416GAA416G,CAAC,CAAC,CAAC;AACr56G,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAkB,UAAU,EAAE,aAAa,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/protocols",
3
- "version": "0.6.1",
3
+ "version": "0.6.2-main.8a232a5",
4
4
  "description": "Protobuf definitions for DXOS protocols.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -34,11 +34,11 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@effect/schema": "^0.67.16",
37
- "@dxos/codec-protobuf": "0.6.1",
38
- "@dxos/keys": "0.6.1",
39
- "@dxos/timeframe": "0.6.1",
40
- "@dxos/util": "0.6.1",
41
- "@dxos/invariant": "0.6.1"
37
+ "@dxos/codec-protobuf": "0.6.2-main.8a232a5",
38
+ "@dxos/keys": "0.6.2-main.8a232a5",
39
+ "@dxos/timeframe": "0.6.2-main.8a232a5",
40
+ "@dxos/util": "0.6.2-main.8a232a5",
41
+ "@dxos/invariant": "0.6.2-main.8a232a5"
42
42
  },
43
43
  "devDependencies": {
44
44
  "glob": "~7.1.6"
@@ -4,75 +4,68 @@
4
4
 
5
5
  syntax = "proto3";
6
6
 
7
- import "dxos/echo/object.proto";
8
- import "dxos/echo/snapshot.proto";
9
- import "dxos/echo/timeframe.proto";
10
7
  import "dxos/keys.proto";
8
+ import "google/protobuf/empty.proto";
11
9
 
12
10
  package dxos.echo.service;
13
11
 
14
12
  message SubscribeRequest {
15
- dxos.keys.PublicKey space_key = 1;
13
+ string subscription_id = 1;
16
14
  }
17
15
 
18
- message EchoEvent {
19
- /// If this event comes as a response to this client wirting the mutation, this field will be set to the tag in the mutation.
20
- optional string client_tag = 1;
21
-
22
- /// For mutations read from the feed store those fields will be set to the position of the mutation in the feed.
23
- optional dxos.keys.PublicKey feed_key = 2;
24
- optional int32 seq = 3;
25
-
26
- enum DatabaseAction {
27
- RESET = 0;
28
- }
29
-
30
- optional DatabaseAction action = 4;
16
+ message BatchedDocumentUpdates {
17
+ repeated DocumentUpdate updates = 1;
18
+ }
31
19
 
32
- dxos.echo.object.EchoObjectBatch batch = 10;
20
+ message UpdateRequest {
21
+ string subscription_id = 1;
22
+ repeated DocumentUpdate updates = 2;
33
23
  }
34
24
 
35
- message WriteRequest {
36
- dxos.keys.PublicKey space_key = 1;
37
-
38
- /// Ephermal tag to correlate events in the subscription.
39
- optional string client_tag = 2;
25
+ message UpdateSubscriptionRequest {
26
+ /**
27
+ * Id of the subscription to update.
28
+ * Subscription id is returned by `Subscribe` rpc.
29
+ */
30
+ string subscription_id = 1;
40
31
 
41
- dxos.echo.object.EchoObjectBatch batch = 10;
42
- }
32
+ /**
33
+ * Automerge document ids to subscribe for updates.
34
+ * Used for already existing documents.
35
+ * To add new document use `write` rpc.
36
+ */
37
+ repeated string add_ids = 3;
43
38
 
44
- message MutationReceipt {
45
- dxos.keys.PublicKey feed_key = 1;
46
- int32 seq = 2;
39
+ /**
40
+ * Automerge document ids to unsubscribe from.
41
+ */
42
+ repeated string remove_ids = 4;
47
43
  }
48
44
 
49
45
  message FlushRequest {
50
- message DocState {
51
- string document_id = 1;
52
- repeated string heads = 2;
53
- }
54
-
55
- // TODO(dmaretskyi): Does not appear to be used.
56
- optional dxos.keys.PublicKey space_key = 1;
57
46
  /**
58
47
  * Automerge specific document ids to wait to flush.
59
48
  */
60
- repeated DocState states = 2;
61
- }
62
-
63
- // Automerge specific.
64
- message HostInfo {
65
- string peer_id = 1;
49
+ repeated string document_ids = 1;
66
50
  }
67
51
 
68
- message SyncRepoRequest {
69
- string id = 1;
52
+ message DocumentUpdate {
53
+ /**
54
+ * Automerge document id.
55
+ */
56
+ string document_id = 1;
70
57
 
71
- optional bytes sync_message = 2;
72
- }
58
+ /**
59
+ * Automerge document incremental update.
60
+ * Value returned by `Automerge.saveSince()`.
61
+ */
62
+ bytes mutation = 2;
73
63
 
74
- message SyncRepoResponse {
75
- optional bytes sync_message = 1;
64
+ /**
65
+ * Set to true for init mutation of document.
66
+ * default: undefined.
67
+ */
68
+ optional bool is_new = 3;
76
69
  }
77
70
 
78
71
  message DocHeadsList {
@@ -101,15 +94,25 @@ message ReIndexHeadsRequest {
101
94
  }
102
95
 
103
96
  service DataService {
104
- rpc Subscribe(SubscribeRequest) returns (stream EchoEvent);
105
- rpc Write(WriteRequest) returns (MutationReceipt); // TODO(burdon): Rename SubmitMutation.
106
- rpc Flush(FlushRequest) returns (google.protobuf.Empty);
97
+ /**
98
+ * Subscribe to incremental updates of multiple automerge socuments.
99
+ * Which documents are subscribed to is defined in the `UpdateSubscription`.
100
+ * Used to propagate changes from services to client.
101
+ */
102
+ rpc Subscribe(SubscribeRequest) returns (stream BatchedDocumentUpdates);
107
103
 
108
- // Automerge specific.
104
+ /**
105
+ * Change which documents are subscribed to for specific subscription.
106
+ */
107
+ rpc UpdateSubscription(UpdateSubscriptionRequest) returns (google.protobuf.Empty);
109
108
 
110
- rpc GetHostInfo(google.protobuf.Empty) returns (HostInfo);
111
- rpc SyncRepo(SyncRepoRequest) returns (stream SyncRepoResponse);
112
- rpc SendSyncMessage(SyncRepoRequest) returns (google.protobuf.Empty); // TODO(dmaretskyi): Bidirectional streams.
109
+ /**
110
+ * Write incremental updates to multiple automerge documents.
111
+ * Used to propagate changes from client to services.
112
+ */
113
+ rpc Update(UpdateRequest) returns (google.protobuf.Empty);
114
+ rpc Flush(FlushRequest) returns (google.protobuf.Empty);
115
+
113
116
  rpc GetDocumentHeads(GetDocumentHeadsRequest) returns (GetDocumentHeadsResponse);
114
117
 
115
118
  /// Wait until the we have the specified changes on the worker locally. Does not take into account the index or client.
@@ -67,125 +67,76 @@ import * as google_protobuf from "../../google/protobuf";
67
67
  * {@link file://./../../../dxos/echo/service.proto}
68
68
  */
69
69
  export interface SubscribeRequest {
70
- spaceKey: ReturnType<(typeof substitutions)["dxos.keys.PublicKey"]["decode"]>;
70
+ subscriptionId: string;
71
71
  }
72
72
  /**
73
73
  * Defined in:
74
74
  * {@link file://./../../../dxos/echo/service.proto}
75
75
  */
76
- export interface EchoEvent {
77
- /**
78
- * If this event comes as a response to this client wirting the mutation, this field will be set to the tag in the mutation.
79
- *
80
- * Options:
81
- * - proto3_optional = true
82
- */
83
- clientTag?: string;
84
- /**
85
- * For mutations read from the feed store those fields will be set to the position of the mutation in the feed.
86
- *
87
- * Options:
88
- * - proto3_optional = true
89
- */
90
- feedKey?: ReturnType<(typeof substitutions)["dxos.keys.PublicKey"]["decode"]>;
91
- /**
92
- * Options:
93
- * - proto3_optional = true
94
- */
95
- seq?: number;
96
- /**
97
- * Options:
98
- * - proto3_optional = true
99
- */
100
- action?: EchoEvent.DatabaseAction;
101
- batch: dxos_echo_object.EchoObjectBatch;
102
- }
103
- export namespace EchoEvent {
104
- /**
105
- * Defined in:
106
- * {@link file://./../../../dxos/echo/service.proto}
107
- */
108
- export enum DatabaseAction {
109
- RESET = 0
110
- }
76
+ export interface BatchedDocumentUpdates {
77
+ updates?: DocumentUpdate[];
111
78
  }
112
79
  /**
113
80
  * Defined in:
114
81
  * {@link file://./../../../dxos/echo/service.proto}
115
82
  */
116
- export interface WriteRequest {
117
- spaceKey: ReturnType<(typeof substitutions)["dxos.keys.PublicKey"]["decode"]>;
118
- /**
119
- * Ephermal tag to correlate events in the subscription.
120
- *
121
- * Options:
122
- * - proto3_optional = true
123
- */
124
- clientTag?: string;
125
- batch: dxos_echo_object.EchoObjectBatch;
83
+ export interface UpdateRequest {
84
+ subscriptionId: string;
85
+ updates?: DocumentUpdate[];
126
86
  }
127
87
  /**
128
88
  * Defined in:
129
89
  * {@link file://./../../../dxos/echo/service.proto}
130
90
  */
131
- export interface MutationReceipt {
132
- feedKey: ReturnType<(typeof substitutions)["dxos.keys.PublicKey"]["decode"]>;
133
- seq: number;
134
- }
135
- /**
136
- * Defined in:
137
- * {@link file://./../../../dxos/echo/service.proto}
138
- */
139
- export interface FlushRequest {
91
+ export interface UpdateSubscriptionRequest {
140
92
  /**
141
- * Options:
142
- * - proto3_optional = true
93
+ * Id of the subscription to update.
94
+ * Subscription id is returned by `Subscribe` rpc.
143
95
  */
144
- spaceKey?: ReturnType<(typeof substitutions)["dxos.keys.PublicKey"]["decode"]>;
96
+ subscriptionId: string;
145
97
  /**
146
- * Automerge specific document ids to wait to flush.
98
+ * Automerge document ids to subscribe for updates.
99
+ * Used for already existing documents.
100
+ * To add new document use `write` rpc.
147
101
  */
148
- states?: FlushRequest.DocState[];
149
- }
150
- export namespace FlushRequest {
102
+ addIds?: string[];
151
103
  /**
152
- * Defined in:
153
- * {@link file://./../../../dxos/echo/service.proto}
104
+ * Automerge document ids to unsubscribe from.
154
105
  */
155
- export interface DocState {
156
- documentId: string;
157
- heads?: string[];
158
- }
159
- }
160
- /**
161
- * Defined in:
162
- * {@link file://./../../../dxos/echo/service.proto}
163
- */
164
- export interface HostInfo {
165
- peerId: string;
106
+ removeIds?: string[];
166
107
  }
167
108
  /**
168
109
  * Defined in:
169
110
  * {@link file://./../../../dxos/echo/service.proto}
170
111
  */
171
- export interface SyncRepoRequest {
172
- id: string;
112
+ export interface FlushRequest {
173
113
  /**
174
- * Options:
175
- * - proto3_optional = true
114
+ * Automerge specific document ids to wait to flush.
176
115
  */
177
- syncMessage?: Uint8Array;
116
+ documentIds?: string[];
178
117
  }
179
118
  /**
180
119
  * Defined in:
181
120
  * {@link file://./../../../dxos/echo/service.proto}
182
121
  */
183
- export interface SyncRepoResponse {
122
+ export interface DocumentUpdate {
123
+ /**
124
+ * Automerge document id.
125
+ */
126
+ documentId: string;
127
+ /**
128
+ * Automerge document incremental update.
129
+ * Value returned by `Automerge.saveSince()`.
130
+ */
131
+ mutation: Uint8Array;
184
132
  /**
133
+ * Set to true for init mutation of document.
134
+ * default: undefined.
135
+ *
185
136
  * Options:
186
137
  * - proto3_optional = true
187
138
  */
188
- syncMessage?: Uint8Array;
139
+ isNew?: boolean;
189
140
  }
190
141
  /**
191
142
  * Defined in:
@@ -237,12 +188,22 @@ export interface ReIndexHeadsRequest {
237
188
  * {@link file://./../../../dxos/echo/service.proto}
238
189
  */
239
190
  export interface DataService {
240
- subscribe: (request: SubscribeRequest, options?: RequestOptions) => Stream<EchoEvent>;
241
- write: (request: WriteRequest, options?: RequestOptions) => Promise<MutationReceipt>;
191
+ /**
192
+ * Subscribe to incremental updates of multiple automerge socuments.
193
+ * Which documents are subscribed to is defined in the `UpdateSubscription`.
194
+ * Used to propagate changes from services to client.
195
+ */
196
+ subscribe: (request: SubscribeRequest, options?: RequestOptions) => Stream<BatchedDocumentUpdates>;
197
+ /**
198
+ * Change which documents are subscribed to for specific subscription.
199
+ */
200
+ updateSubscription: (request: UpdateSubscriptionRequest, options?: RequestOptions) => Promise<void>;
201
+ /**
202
+ * Write incremental updates to multiple automerge documents.
203
+ * Used to propagate changes from client to services.
204
+ */
205
+ update: (request: UpdateRequest, options?: RequestOptions) => Promise<void>;
242
206
  flush: (request: FlushRequest, options?: RequestOptions) => Promise<void>;
243
- getHostInfo: (request: void, options?: RequestOptions) => Promise<HostInfo>;
244
- syncRepo: (request: SyncRepoRequest, options?: RequestOptions) => Stream<SyncRepoResponse>;
245
- sendSyncMessage: (request: SyncRepoRequest, options?: RequestOptions) => Promise<void>;
246
207
  getDocumentHeads: (request: GetDocumentHeadsRequest, options?: RequestOptions) => Promise<GetDocumentHeadsResponse>;
247
208
  /**
248
209
  * Wait until the we have the specified changes on the worker locally. Does not take into account the index or client.
@@ -81,14 +81,14 @@ export enum NullValue {
81
81
  export interface ListValue {
82
82
  values?: Value[];
83
83
  }
84
- export interface Timestamp {
85
- seconds: string;
86
- nanos: number;
87
- }
88
84
  export interface Any {
89
85
  type_url: string;
90
86
  value: Uint8Array;
91
87
  }
88
+ export interface Timestamp {
89
+ seconds: string;
90
+ nanos: number;
91
+ }
92
92
  export interface FileDescriptorSet {
93
93
  file?: FileDescriptorProto[];
94
94
  }