@mdbase-dev/connect-protocol 0.1.0-beta.21 → 0.1.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connect-problems.generated.d.ts +1067 -0
- package/dist/connect-problems.generated.js +364 -0
- package/dist/files.d.ts +253 -0
- package/dist/files.js +417 -0
- package/dist/index.d.ts +97 -16
- package/dist/index.js +6 -1
- package/package.json +2 -2
- package/schemas/catalog.json +3 -0
- package/schemas/connect-problem.v1.schema.json +3893 -0
- package/schemas/connect-problems.v1.catalog.json +238 -0
- package/schemas/connect-protocol.v1.schema.json +15 -26
- package/schemas/encrypted-relay.v1.schema.json +3 -11
- package/schemas/files.v1.schema.json +502 -0
- package/schemas/mdbase-app.schema.json +48 -0
- package/schemas/sync.v1.schema.json +189 -4
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"oneOf": [
|
|
6
6
|
{ "$ref": "#/$defs/session" },
|
|
7
7
|
{ "$ref": "#/$defs/snapshotPage" },
|
|
8
|
+
{ "$ref": "#/$defs/fileSnapshotPage" },
|
|
8
9
|
{ "$ref": "#/$defs/changesPage" },
|
|
9
10
|
{ "$ref": "#/$defs/mutation" },
|
|
10
11
|
{ "$ref": "#/$defs/receipt" }
|
|
@@ -19,6 +20,9 @@
|
|
|
19
20
|
"type": "string",
|
|
20
21
|
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
21
22
|
},
|
|
23
|
+
"fileDescriptor": {
|
|
24
|
+
"$ref": "https://mdbase.dev/connect/schemas/files.v1.json#/$defs/fileDescriptor"
|
|
25
|
+
},
|
|
22
26
|
"collectionType": {
|
|
23
27
|
"type": "object",
|
|
24
28
|
"additionalProperties": false,
|
|
@@ -147,6 +151,20 @@
|
|
|
147
151
|
"next_page": { "type": "string", "pattern": "^[1-9][0-9]*$" }
|
|
148
152
|
}
|
|
149
153
|
},
|
|
154
|
+
"fileSnapshotPage": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"additionalProperties": false,
|
|
157
|
+
"required": ["protocol_version", "type", "snapshot_id", "scope_epoch", "cursor", "files"],
|
|
158
|
+
"properties": {
|
|
159
|
+
"protocol_version": { "const": 1 },
|
|
160
|
+
"type": { "const": "file_snapshot_page" },
|
|
161
|
+
"snapshot_id": { "$ref": "#/$defs/uuid" },
|
|
162
|
+
"scope_epoch": { "type": "integer", "minimum": 1 },
|
|
163
|
+
"cursor": { "type": "integer", "minimum": 0 },
|
|
164
|
+
"files": { "type": "array", "items": { "$ref": "#/$defs/fileDescriptor" } },
|
|
165
|
+
"next_page": { "type": "string", "pattern": "^[1-9][0-9]*$" }
|
|
166
|
+
}
|
|
167
|
+
},
|
|
150
168
|
"put": {
|
|
151
169
|
"type": "object",
|
|
152
170
|
"additionalProperties": false,
|
|
@@ -169,6 +187,28 @@
|
|
|
169
187
|
"revision": { "type": "string", "minLength": 1 }
|
|
170
188
|
}
|
|
171
189
|
},
|
|
190
|
+
"filePut": {
|
|
191
|
+
"type": "object",
|
|
192
|
+
"additionalProperties": false,
|
|
193
|
+
"required": ["sequence", "type", "file"],
|
|
194
|
+
"properties": {
|
|
195
|
+
"sequence": { "type": "integer", "minimum": 1 },
|
|
196
|
+
"type": { "const": "file_put" },
|
|
197
|
+
"file": { "$ref": "#/$defs/fileDescriptor" }
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"fileRemove": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"additionalProperties": false,
|
|
203
|
+
"required": ["sequence", "type", "file_id", "previous_path", "revision"],
|
|
204
|
+
"properties": {
|
|
205
|
+
"sequence": { "type": "integer", "minimum": 1 },
|
|
206
|
+
"type": { "const": "file_remove" },
|
|
207
|
+
"file_id": { "$ref": "#/$defs/uuid" },
|
|
208
|
+
"previous_path": { "type": "string", "minLength": 1 },
|
|
209
|
+
"revision": { "type": "string", "minLength": 1 }
|
|
210
|
+
}
|
|
211
|
+
},
|
|
172
212
|
"changesPage": {
|
|
173
213
|
"type": "object",
|
|
174
214
|
"additionalProperties": false,
|
|
@@ -176,14 +216,24 @@
|
|
|
176
216
|
"properties": {
|
|
177
217
|
"protocol_version": { "const": 1 },
|
|
178
218
|
"scope_epoch": { "type": "integer", "minimum": 1 },
|
|
179
|
-
"events": {
|
|
219
|
+
"events": {
|
|
220
|
+
"type": "array",
|
|
221
|
+
"items": {
|
|
222
|
+
"oneOf": [
|
|
223
|
+
{ "$ref": "#/$defs/put" },
|
|
224
|
+
{ "$ref": "#/$defs/remove" },
|
|
225
|
+
{ "$ref": "#/$defs/filePut" },
|
|
226
|
+
{ "$ref": "#/$defs/fileRemove" }
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
180
230
|
"cursor": { "type": "integer", "minimum": 0 },
|
|
181
231
|
"head": { "type": "integer", "minimum": 0 },
|
|
182
232
|
"has_more": { "type": "boolean" },
|
|
183
233
|
"reset_required": { "type": "boolean" }
|
|
184
234
|
}
|
|
185
235
|
},
|
|
186
|
-
"
|
|
236
|
+
"recordMutation": {
|
|
187
237
|
"type": "object",
|
|
188
238
|
"additionalProperties": false,
|
|
189
239
|
"required": ["mutation_id", "replica_id", "scope_epoch", "operation", "record_id", "input", "created_at"],
|
|
@@ -199,7 +249,76 @@
|
|
|
199
249
|
"causal_predecessor": { "$ref": "#/$defs/uuid" }
|
|
200
250
|
}
|
|
201
251
|
},
|
|
202
|
-
"
|
|
252
|
+
"filePutMutation": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"additionalProperties": false,
|
|
255
|
+
"required": [
|
|
256
|
+
"mutation_id", "replica_id", "scope_epoch", "operation", "file_id",
|
|
257
|
+
"path", "transfer_id", "content_digest", "size", "created_at"
|
|
258
|
+
],
|
|
259
|
+
"properties": {
|
|
260
|
+
"mutation_id": { "$ref": "#/$defs/uuid" },
|
|
261
|
+
"replica_id": { "$ref": "#/$defs/uuid" },
|
|
262
|
+
"scope_epoch": { "type": "integer", "minimum": 1 },
|
|
263
|
+
"operation": { "const": "file_put" },
|
|
264
|
+
"file_id": { "$ref": "#/$defs/uuid" },
|
|
265
|
+
"base_revision": { "type": "string", "minLength": 1 },
|
|
266
|
+
"path": { "type": "string", "minLength": 1 },
|
|
267
|
+
"transfer_id": { "$ref": "#/$defs/uuid" },
|
|
268
|
+
"content_digest": { "$ref": "#/$defs/digest" },
|
|
269
|
+
"size": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
|
|
270
|
+
"media_type": { "type": "string", "minLength": 1, "maxLength": 255 },
|
|
271
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
272
|
+
"causal_predecessor": { "$ref": "#/$defs/uuid" }
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"fileMoveMutation": {
|
|
276
|
+
"type": "object",
|
|
277
|
+
"additionalProperties": false,
|
|
278
|
+
"required": [
|
|
279
|
+
"mutation_id", "replica_id", "scope_epoch", "operation", "file_id",
|
|
280
|
+
"base_revision", "path", "update_references", "created_at"
|
|
281
|
+
],
|
|
282
|
+
"properties": {
|
|
283
|
+
"mutation_id": { "$ref": "#/$defs/uuid" },
|
|
284
|
+
"replica_id": { "$ref": "#/$defs/uuid" },
|
|
285
|
+
"scope_epoch": { "type": "integer", "minimum": 1 },
|
|
286
|
+
"operation": { "const": "file_move" },
|
|
287
|
+
"file_id": { "$ref": "#/$defs/uuid" },
|
|
288
|
+
"base_revision": { "type": "string", "minLength": 1 },
|
|
289
|
+
"path": { "type": "string", "minLength": 1 },
|
|
290
|
+
"update_references": { "type": "boolean" },
|
|
291
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
292
|
+
"causal_predecessor": { "$ref": "#/$defs/uuid" }
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"fileDeleteMutation": {
|
|
296
|
+
"type": "object",
|
|
297
|
+
"additionalProperties": false,
|
|
298
|
+
"required": [
|
|
299
|
+
"mutation_id", "replica_id", "scope_epoch", "operation", "file_id",
|
|
300
|
+
"base_revision", "created_at"
|
|
301
|
+
],
|
|
302
|
+
"properties": {
|
|
303
|
+
"mutation_id": { "$ref": "#/$defs/uuid" },
|
|
304
|
+
"replica_id": { "$ref": "#/$defs/uuid" },
|
|
305
|
+
"scope_epoch": { "type": "integer", "minimum": 1 },
|
|
306
|
+
"operation": { "const": "file_delete" },
|
|
307
|
+
"file_id": { "$ref": "#/$defs/uuid" },
|
|
308
|
+
"base_revision": { "type": "string", "minLength": 1 },
|
|
309
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
310
|
+
"causal_predecessor": { "$ref": "#/$defs/uuid" }
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"mutation": {
|
|
314
|
+
"oneOf": [
|
|
315
|
+
{ "$ref": "#/$defs/recordMutation" },
|
|
316
|
+
{ "$ref": "#/$defs/filePutMutation" },
|
|
317
|
+
{ "$ref": "#/$defs/fileMoveMutation" },
|
|
318
|
+
{ "$ref": "#/$defs/fileDeleteMutation" }
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
"recordReceipt": {
|
|
203
322
|
"oneOf": [
|
|
204
323
|
{
|
|
205
324
|
"type": "object",
|
|
@@ -225,7 +344,7 @@
|
|
|
225
344
|
"required": ["record_id", "mutation"],
|
|
226
345
|
"properties": {
|
|
227
346
|
"record_id": { "$ref": "#/$defs/uuid" },
|
|
228
|
-
"mutation": { "$ref": "#/$defs/
|
|
347
|
+
"mutation": { "$ref": "#/$defs/recordMutation" },
|
|
229
348
|
"current": { "$ref": "#/$defs/record" },
|
|
230
349
|
"current_revision": { "type": "string" }
|
|
231
350
|
}
|
|
@@ -251,6 +370,72 @@
|
|
|
251
370
|
}
|
|
252
371
|
}
|
|
253
372
|
]
|
|
373
|
+
},
|
|
374
|
+
"fileConflict": {
|
|
375
|
+
"type": "object",
|
|
376
|
+
"additionalProperties": false,
|
|
377
|
+
"required": ["file_id", "mutation"],
|
|
378
|
+
"properties": {
|
|
379
|
+
"file_id": { "$ref": "#/$defs/uuid" },
|
|
380
|
+
"mutation": {
|
|
381
|
+
"oneOf": [
|
|
382
|
+
{ "$ref": "#/$defs/filePutMutation" },
|
|
383
|
+
{ "$ref": "#/$defs/fileMoveMutation" },
|
|
384
|
+
{ "$ref": "#/$defs/fileDeleteMutation" }
|
|
385
|
+
]
|
|
386
|
+
},
|
|
387
|
+
"current": { "$ref": "#/$defs/fileDescriptor" },
|
|
388
|
+
"current_revision": { "type": "string", "minLength": 1 }
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"fileReceipt": {
|
|
392
|
+
"oneOf": [
|
|
393
|
+
{
|
|
394
|
+
"type": "object",
|
|
395
|
+
"additionalProperties": false,
|
|
396
|
+
"required": ["mutation_id", "status", "sequence"],
|
|
397
|
+
"properties": {
|
|
398
|
+
"mutation_id": { "$ref": "#/$defs/uuid" },
|
|
399
|
+
"status": { "enum": ["file_applied", "file_previously_applied"] },
|
|
400
|
+
"sequence": { "type": "integer", "minimum": 1 },
|
|
401
|
+
"file": { "$ref": "#/$defs/fileDescriptor" }
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"type": "object",
|
|
406
|
+
"additionalProperties": false,
|
|
407
|
+
"required": ["mutation_id", "status", "conflict"],
|
|
408
|
+
"properties": {
|
|
409
|
+
"mutation_id": { "$ref": "#/$defs/uuid" },
|
|
410
|
+
"status": { "const": "file_conflicted" },
|
|
411
|
+
"conflict": { "$ref": "#/$defs/fileConflict" }
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"type": "object",
|
|
416
|
+
"additionalProperties": false,
|
|
417
|
+
"required": ["mutation_id", "status", "error"],
|
|
418
|
+
"properties": {
|
|
419
|
+
"mutation_id": { "$ref": "#/$defs/uuid" },
|
|
420
|
+
"status": { "const": "file_rejected" },
|
|
421
|
+
"error": {
|
|
422
|
+
"type": "object",
|
|
423
|
+
"additionalProperties": false,
|
|
424
|
+
"required": ["code", "message"],
|
|
425
|
+
"properties": {
|
|
426
|
+
"code": { "type": "string", "minLength": 1 },
|
|
427
|
+
"message": { "type": "string" }
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
},
|
|
434
|
+
"receipt": {
|
|
435
|
+
"oneOf": [
|
|
436
|
+
{ "$ref": "#/$defs/recordReceipt" },
|
|
437
|
+
{ "$ref": "#/$defs/fileReceipt" }
|
|
438
|
+
]
|
|
254
439
|
}
|
|
255
440
|
}
|
|
256
441
|
}
|