@tdxvolt/volt-client-grpc 0.20.29 → 0.20.32
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/lib/index.cjs +216 -16
- package/package.json +3 -3
- package/src/volt-client.js +40 -0
- package/src/volt-proto-literals.js +176 -16
package/lib/index.cjs
CHANGED
|
@@ -1770,6 +1770,12 @@ service SyncAPI {
|
|
|
1770
1770
|
// Watch synapse paths for changes.
|
|
1771
1771
|
rpc WatchSynapsePath(stream WatchSynapsePathRequest) returns (stream WatchSynapsePathResponse);
|
|
1772
1772
|
|
|
1773
|
+
// Get the state of a synapse document on this Volt. Reports whether the content this Volt holds matches the \`__hash\` advertised in the synapse metadata.
|
|
1774
|
+
rpc GetSynapseDocumentState(GetSynapseDocumentStateRequest) returns (GetSynapseDocumentStateResponse);
|
|
1775
|
+
|
|
1776
|
+
// Watch synapse documents for state changes. The server sends the current state of every watched document before any subsequent transitions, so a watcher started after content lands does not miss it.
|
|
1777
|
+
rpc WatchSynapseDocumentState(stream WatchSynapseDocumentStateRequest) returns (stream WatchSynapseDocumentStateResponse);
|
|
1778
|
+
|
|
1773
1779
|
// Write a single value to a given synapse JSON path.
|
|
1774
1780
|
rpc WriteSynapsePath(WriteSynapsePathRequest) returns (WriteSynapsePathResponse);
|
|
1775
1781
|
|
|
@@ -1784,6 +1790,15 @@ service SyncAPI {
|
|
|
1784
1790
|
|
|
1785
1791
|
// Revert a document in a sync database to a stored version.
|
|
1786
1792
|
rpc RevertSyncDocumentVersion(RevertSyncDocumentVersionRequest) returns (RevertSyncDocumentVersionResponse);
|
|
1793
|
+
|
|
1794
|
+
// Check whether a content-addressed blob exists in a synapse.
|
|
1795
|
+
rpc HasSynapseBlob(HasSynapseBlobRequest) returns (HasSynapseBlobResponse);
|
|
1796
|
+
|
|
1797
|
+
// Upload a content-addressed blob. The first message must be \`start\` with the expected sha256 (base64url) hash and size; subsequent messages carry payload chunks. Idempotent if the hash is already stored. The server verifies the received bytes match \`hash\` before committing.
|
|
1798
|
+
rpc PutSynapseBlob(stream PutSynapseBlobRequest) returns (stream PutSynapseBlobResponse);
|
|
1799
|
+
|
|
1800
|
+
// Download a content-addressed blob by hash.
|
|
1801
|
+
rpc GetSynapseBlob(GetSynapseBlobRequest) returns (stream GetSynapseBlobResponse);
|
|
1787
1802
|
}
|
|
1788
1803
|
|
|
1789
1804
|
message CreateSynapseConnectionRequest {
|
|
@@ -1951,36 +1966,31 @@ message SynapseDocumentMetadata {
|
|
|
1951
1966
|
// The name of the top-level shared type in the document.
|
|
1952
1967
|
string name = 1;
|
|
1953
1968
|
|
|
1954
|
-
// The type of the shared
|
|
1969
|
+
// The type of the document root. Yjs shared types are "map", "array" or "text". The "blob" type means the payload is a content-addressed object in the synapse blob store (PutSynapseBlob / GetSynapseBlob). There is no Yjs shared type for a blob document. A blob document's schema must be a single entry of type "blob"; it cannot be mixed with map, array, or text roots. The server writes \`__hash\` when the document is bound to a stored blob (see SetSynapseDocumentMetadata.blob_hash).
|
|
1955
1970
|
string type = 2;
|
|
1956
1971
|
|
|
1957
|
-
// The JSON schema that describes the data
|
|
1972
|
+
// The JSON schema that describes the data stored in this shared type.
|
|
1958
1973
|
string json_schema = 3;
|
|
1959
1974
|
}
|
|
1960
1975
|
|
|
1961
1976
|
message SetSynapseDocumentMetadataRequest {
|
|
1962
|
-
// DEPRECATED: Use synapse_id instead.
|
|
1963
|
-
string database_id = 1;
|
|
1964
|
-
|
|
1965
1977
|
// The id of the synapse that contains the document.
|
|
1966
1978
|
string synapse_id = 5;
|
|
1967
1979
|
|
|
1968
1980
|
// The id of the document to set the metadata for.
|
|
1969
1981
|
string document_id = 2;
|
|
1970
1982
|
|
|
1971
|
-
// The metadata to set for the document.
|
|
1983
|
+
// The metadata to set for the document. Each entry names a top-level shared type (map/array/text). For a blob document this must contain exactly one entry with type "blob".
|
|
1972
1984
|
repeated SynapseDocumentMetadata metadata = 3;
|
|
1973
1985
|
|
|
1974
1986
|
// Any additional application-specific JSON to attach to the document.
|
|
1975
1987
|
string json = 4;
|
|
1976
1988
|
|
|
1977
|
-
// Set to true
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
//
|
|
1981
|
-
|
|
1982
|
-
// is already present.
|
|
1983
|
-
bool content_pending = 6;
|
|
1989
|
+
// Set to true to publish \`__hash\` immediately, because the content is already present (content-first) or the document is intentionally empty. Leave false (the default) when content will be written after this call, in which case the server publishes \`__hash\` once that content arrives. This is creator intent at create time; it says nothing about whether other Volts hold the content (see GetSynapseDocumentState).
|
|
1990
|
+
bool publish_hash = 6;
|
|
1991
|
+
|
|
1992
|
+
// For blob documents, the content hash to bind. The server verifies the blob is stored (or the hash is sha256 of empty bytes) and writes \`__hash\`. Omit for a metadata-first create. Must not be set for map/array/text documents; the server computes those hashes from Yjs content.
|
|
1993
|
+
string blob_hash = 7;
|
|
1984
1994
|
}
|
|
1985
1995
|
|
|
1986
1996
|
message SetSynapseDocumentMetadataResponse {
|
|
@@ -2050,9 +2060,6 @@ message SyncDocumentResponse {
|
|
|
2050
2060
|
|
|
2051
2061
|
// Parameters to start watching synapse paths. Sent as the first message.
|
|
2052
2062
|
message WatchSynapsePathStart {
|
|
2053
|
-
// DEPRECATED: Use synapse_id instead.
|
|
2054
|
-
string database_id = 1;
|
|
2055
|
-
|
|
2056
2063
|
// The id of the synapse that contains the document.
|
|
2057
2064
|
string synapse_id = 4;
|
|
2058
2065
|
|
|
@@ -2213,6 +2220,156 @@ message RevertSyncDocumentVersionResponse {
|
|
|
2213
2220
|
string version_id = 2;
|
|
2214
2221
|
}
|
|
2215
2222
|
|
|
2223
|
+
// The state of a synapse document. \`__hash\` in the synapse metadata says what the content is; this says whether this Volt holds it yet. Metadata replicates independently of content, so a document can be ANNOUNCED here and READY on the Volt that produced it.
|
|
2224
|
+
enum SynapseDocumentState {
|
|
2225
|
+
SYNAPSE_DOCUMENT_STATE_UNKNOWN = 0;
|
|
2226
|
+
|
|
2227
|
+
// No metadata entry for this document on this Volt.
|
|
2228
|
+
SYNAPSE_DOCUMENT_STATE_ABSENT = 1;
|
|
2229
|
+
|
|
2230
|
+
// Metadata entry exists but no \`__hash\` has been published yet, so no content has been committed. See SetSynapseDocumentMetadata.publish_hash.
|
|
2231
|
+
SYNAPSE_DOCUMENT_STATE_DRAFT = 2;
|
|
2232
|
+
|
|
2233
|
+
// \`__hash\` is published but the content this Volt holds does not match it. The content is still in flight; wait for READY before reading it.
|
|
2234
|
+
SYNAPSE_DOCUMENT_STATE_ANNOUNCED = 3;
|
|
2235
|
+
|
|
2236
|
+
// The content this Volt holds matches \`__hash\`. The document can be read.
|
|
2237
|
+
SYNAPSE_DOCUMENT_STATE_READY = 4;
|
|
2238
|
+
|
|
2239
|
+
// The metadata entry was removed.
|
|
2240
|
+
SYNAPSE_DOCUMENT_STATE_DELETED = 5;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
message GetSynapseDocumentStateRequest {
|
|
2244
|
+
// The id of the synapse that contains the document.
|
|
2245
|
+
string synapse_id = 1;
|
|
2246
|
+
|
|
2247
|
+
// The id of the document to query.
|
|
2248
|
+
string document_id = 2;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
message GetSynapseDocumentStateResponse {
|
|
2252
|
+
// Details of any error that occurred on the call.
|
|
2253
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
2254
|
+
|
|
2255
|
+
// The state of the document.
|
|
2256
|
+
SynapseDocumentState state = 2;
|
|
2257
|
+
|
|
2258
|
+
// The content hash advertised in the synapse metadata (\`__hash\`). Empty for ABSENT and DRAFT documents.
|
|
2259
|
+
string hash = 3;
|
|
2260
|
+
|
|
2261
|
+
// The content hash this Volt actually holds. Empty when no content has landed here yet. Equal to \`hash\` when the state is READY.
|
|
2262
|
+
string local_hash = 4;
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
// Parameters to start watching synapse document state. Sent as the first message.
|
|
2266
|
+
message WatchSynapseDocumentStateStart {
|
|
2267
|
+
// The id of the synapse to watch.
|
|
2268
|
+
string synapse_id = 1;
|
|
2269
|
+
|
|
2270
|
+
// The ids of the documents to watch. Leave empty to watch every document in the synapse, including documents added after the watch starts.
|
|
2271
|
+
repeated string document_id = 2;
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
message WatchSynapseDocumentStateRequest {
|
|
2275
|
+
oneof payload {
|
|
2276
|
+
// Start watching; must be sent as the first message.
|
|
2277
|
+
WatchSynapseDocumentStateStart start = 1;
|
|
2278
|
+
|
|
2279
|
+
// Request to stop the watch.
|
|
2280
|
+
bool stop = 2;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
message WatchSynapseDocumentStateUpdate {
|
|
2285
|
+
// The id of the document whose state changed.
|
|
2286
|
+
string document_id = 1;
|
|
2287
|
+
|
|
2288
|
+
SynapseDocumentState state = 2;
|
|
2289
|
+
|
|
2290
|
+
// The content hash advertised in the synapse metadata (\`__hash\`).
|
|
2291
|
+
string hash = 3;
|
|
2292
|
+
|
|
2293
|
+
// The content hash this Volt actually holds.
|
|
2294
|
+
string local_hash = 4;
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
message WatchSynapseDocumentStateResponse {
|
|
2298
|
+
oneof result {
|
|
2299
|
+
// Details of any error that occurred on the call.
|
|
2300
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
2301
|
+
|
|
2302
|
+
// A document state update.
|
|
2303
|
+
WatchSynapseDocumentStateUpdate update = 2;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
message HasSynapseBlobRequest {
|
|
2308
|
+
// The id of the synapse that stores the blob.
|
|
2309
|
+
string synapse_id = 1;
|
|
2310
|
+
|
|
2311
|
+
// SHA-256 of the raw file bytes, encoded as unpadded base64url.
|
|
2312
|
+
string hash = 2;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
message HasSynapseBlobResponse {
|
|
2316
|
+
// Details of any error that occurred on the call.
|
|
2317
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
2318
|
+
|
|
2319
|
+
// True if a blob with this hash is already stored.
|
|
2320
|
+
bool exists = 2;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
message PutSynapseBlobStart {
|
|
2324
|
+
// The id of the synapse that stores the blob.
|
|
2325
|
+
string synapse_id = 1;
|
|
2326
|
+
|
|
2327
|
+
// Expected sha256 (base64url) of the concatenated payload bytes.
|
|
2328
|
+
string hash = 2;
|
|
2329
|
+
|
|
2330
|
+
// Total payload size in bytes. Zero means no blob row (empty file).
|
|
2331
|
+
uint64 size = 3;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
message PutSynapseBlobRequest {
|
|
2335
|
+
oneof payload {
|
|
2336
|
+
// Must be sent as the first message.
|
|
2337
|
+
PutSynapseBlobStart start = 1;
|
|
2338
|
+
|
|
2339
|
+
// The next chunk of blob data.
|
|
2340
|
+
bytes block = 2;
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
message PutSynapseBlobResponse {
|
|
2345
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
2346
|
+
|
|
2347
|
+
// Number of payload blocks received. Zero until the stream finishes.
|
|
2348
|
+
uint32 ack = 2;
|
|
2349
|
+
|
|
2350
|
+
// True if the hash was already present (put is a no-op).
|
|
2351
|
+
bool exists = 3;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
message GetSynapseBlobRequest {
|
|
2355
|
+
// The id of the synapse that stores the blob.
|
|
2356
|
+
string synapse_id = 1;
|
|
2357
|
+
|
|
2358
|
+
// SHA-256 of the raw file bytes, encoded as unpadded base64url.
|
|
2359
|
+
string hash = 2;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
message GetSynapseBlobResponse {
|
|
2363
|
+
// The next chunk of blob data or details of any error that occurred on the call.
|
|
2364
|
+
oneof payload {
|
|
2365
|
+
// The next chunk of blob data.
|
|
2366
|
+
bytes block = 1;
|
|
2367
|
+
|
|
2368
|
+
// Details of any error that occurred on the call.
|
|
2369
|
+
tdx.volt_api.volt.v1.Status status = 2;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2216
2373
|
`;
|
|
2217
2374
|
const terminal_api = `syntax = "proto3";
|
|
2218
2375
|
|
|
@@ -2586,6 +2743,9 @@ message VoltParameters {
|
|
|
2586
2743
|
|
|
2587
2744
|
// Optional per-method gRPC rate limits (see GrpcRpcRateLimit). Keyed by peer identity or fingerprint.
|
|
2588
2745
|
repeated GrpcRpcRateLimit grpc_rpc_rate_limit = 57;
|
|
2746
|
+
|
|
2747
|
+
// Deadline in milliseconds for outbound unary gRPC calls made by this Volt (relay, synapse, mirroring, drive and DID registry calls). If unset or zero, the built-in defaults are used.
|
|
2748
|
+
uint32 grpc_unary_deadline = 58;
|
|
2589
2749
|
}
|
|
2590
2750
|
|
|
2591
2751
|
message VoltEndpoint {
|
|
@@ -7029,6 +7189,10 @@ class VoltClient extends EventEmitter__default["default"] {
|
|
|
7029
7189
|
);
|
|
7030
7190
|
}
|
|
7031
7191
|
|
|
7192
|
+
GetSynapseDocumentState(request) {
|
|
7193
|
+
return unaryCallInternal.call(this, "GetSynapseDocumentState", request);
|
|
7194
|
+
}
|
|
7195
|
+
|
|
7032
7196
|
SaveSynapse(request) {
|
|
7033
7197
|
return unaryCallInternal.call(this, "SaveSynapse", request);
|
|
7034
7198
|
}
|
|
@@ -7052,6 +7216,16 @@ class VoltClient extends EventEmitter__default["default"] {
|
|
|
7052
7216
|
return syncDocumentCall.start(grpcClient, request);
|
|
7053
7217
|
}
|
|
7054
7218
|
|
|
7219
|
+
WatchSynapseDocumentState(request) {
|
|
7220
|
+
this.getVoltAPIClient();
|
|
7221
|
+
|
|
7222
|
+
new GRPCCall(
|
|
7223
|
+
this,
|
|
7224
|
+
"WatchSynapseDocumentState",
|
|
7225
|
+
"METHOD_TYPE_BIDI"
|
|
7226
|
+
);
|
|
7227
|
+
}
|
|
7228
|
+
|
|
7055
7229
|
WatchSynapsePath(request) {
|
|
7056
7230
|
const grpcClient = this.getVoltAPIClient();
|
|
7057
7231
|
|
|
@@ -7066,6 +7240,32 @@ class VoltClient extends EventEmitter__default["default"] {
|
|
|
7066
7240
|
WriteSynapsePath(request) {
|
|
7067
7241
|
return unaryCallInternal.call(this, "WriteSynapsePath", request);
|
|
7068
7242
|
}
|
|
7243
|
+
|
|
7244
|
+
HasSynapseBlob(request) {
|
|
7245
|
+
return unaryCallInternal.call(this, "HasSynapseBlob", request);
|
|
7246
|
+
}
|
|
7247
|
+
|
|
7248
|
+
PutSynapseBlob(request) {
|
|
7249
|
+
const grpcClient = this.getVoltAPIClient();
|
|
7250
|
+
|
|
7251
|
+
const putBlobCall = new GRPCCall(
|
|
7252
|
+
this,
|
|
7253
|
+
"PutSynapseBlob",
|
|
7254
|
+
"METHOD_TYPE_BIDI"
|
|
7255
|
+
);
|
|
7256
|
+
return putBlobCall.start(grpcClient, request);
|
|
7257
|
+
}
|
|
7258
|
+
|
|
7259
|
+
GetSynapseBlob(request) {
|
|
7260
|
+
const grpcClient = this.getVoltAPIClient();
|
|
7261
|
+
|
|
7262
|
+
const getBlobCall = new GRPCCall(
|
|
7263
|
+
this,
|
|
7264
|
+
"GetSynapseBlob",
|
|
7265
|
+
"METHOD_TYPE_SERVER_STREAM"
|
|
7266
|
+
);
|
|
7267
|
+
return getBlobCall.start(grpcClient, request);
|
|
7268
|
+
}
|
|
7069
7269
|
}
|
|
7070
7270
|
|
|
7071
7271
|
Object.defineProperty(exports, 'SyncProvider', {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.20.
|
|
6
|
+
"version": "0.20.32",
|
|
7
7
|
"description": "tdx Volt library for nodejs clients",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"author": "toby.ealden@gmail.com",
|
|
34
34
|
"license": "ISC",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tdxvolt/volt-client-web": "^0.20.
|
|
37
|
-
"@tdxvolt/volt-utility": "^0.20.
|
|
36
|
+
"@tdxvolt/volt-client-web": "^0.20.32",
|
|
37
|
+
"@tdxvolt/volt-utility": "^0.20.32",
|
|
38
38
|
"debug": "^4.1.1",
|
|
39
39
|
"ip": "^1.1.5",
|
|
40
40
|
"jsonwebtoken": "^8.5.1",
|
package/src/volt-client.js
CHANGED
|
@@ -751,6 +751,10 @@ export class VoltClient extends EventEmitter {
|
|
|
751
751
|
);
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
+
GetSynapseDocumentState(request) {
|
|
755
|
+
return unaryCallInternal.call(this, "GetSynapseDocumentState", request);
|
|
756
|
+
}
|
|
757
|
+
|
|
754
758
|
SaveSynapse(request) {
|
|
755
759
|
return unaryCallInternal.call(this, "SaveSynapse", request);
|
|
756
760
|
}
|
|
@@ -774,6 +778,16 @@ export class VoltClient extends EventEmitter {
|
|
|
774
778
|
return syncDocumentCall.start(grpcClient, request);
|
|
775
779
|
}
|
|
776
780
|
|
|
781
|
+
WatchSynapseDocumentState(request) {
|
|
782
|
+
const grpcClient = this.getVoltAPIClient();
|
|
783
|
+
|
|
784
|
+
const watchDocumentStateCall = new GRPCCall(
|
|
785
|
+
this,
|
|
786
|
+
"WatchSynapseDocumentState",
|
|
787
|
+
"METHOD_TYPE_BIDI"
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
|
|
777
791
|
WatchSynapsePath(request) {
|
|
778
792
|
const grpcClient = this.getVoltAPIClient();
|
|
779
793
|
|
|
@@ -788,4 +802,30 @@ export class VoltClient extends EventEmitter {
|
|
|
788
802
|
WriteSynapsePath(request) {
|
|
789
803
|
return unaryCallInternal.call(this, "WriteSynapsePath", request);
|
|
790
804
|
}
|
|
805
|
+
|
|
806
|
+
HasSynapseBlob(request) {
|
|
807
|
+
return unaryCallInternal.call(this, "HasSynapseBlob", request);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
PutSynapseBlob(request) {
|
|
811
|
+
const grpcClient = this.getVoltAPIClient();
|
|
812
|
+
|
|
813
|
+
const putBlobCall = new GRPCCall(
|
|
814
|
+
this,
|
|
815
|
+
"PutSynapseBlob",
|
|
816
|
+
"METHOD_TYPE_BIDI"
|
|
817
|
+
);
|
|
818
|
+
return putBlobCall.start(grpcClient, request);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
GetSynapseBlob(request) {
|
|
822
|
+
const grpcClient = this.getVoltAPIClient();
|
|
823
|
+
|
|
824
|
+
const getBlobCall = new GRPCCall(
|
|
825
|
+
this,
|
|
826
|
+
"GetSynapseBlob",
|
|
827
|
+
"METHOD_TYPE_SERVER_STREAM"
|
|
828
|
+
);
|
|
829
|
+
return getBlobCall.start(grpcClient, request);
|
|
830
|
+
}
|
|
791
831
|
}
|
|
@@ -1222,6 +1222,12 @@ service SyncAPI {
|
|
|
1222
1222
|
// Watch synapse paths for changes.
|
|
1223
1223
|
rpc WatchSynapsePath(stream WatchSynapsePathRequest) returns (stream WatchSynapsePathResponse);
|
|
1224
1224
|
|
|
1225
|
+
// Get the state of a synapse document on this Volt. Reports whether the content this Volt holds matches the \`__hash\` advertised in the synapse metadata.
|
|
1226
|
+
rpc GetSynapseDocumentState(GetSynapseDocumentStateRequest) returns (GetSynapseDocumentStateResponse);
|
|
1227
|
+
|
|
1228
|
+
// Watch synapse documents for state changes. The server sends the current state of every watched document before any subsequent transitions, so a watcher started after content lands does not miss it.
|
|
1229
|
+
rpc WatchSynapseDocumentState(stream WatchSynapseDocumentStateRequest) returns (stream WatchSynapseDocumentStateResponse);
|
|
1230
|
+
|
|
1225
1231
|
// Write a single value to a given synapse JSON path.
|
|
1226
1232
|
rpc WriteSynapsePath(WriteSynapsePathRequest) returns (WriteSynapsePathResponse);
|
|
1227
1233
|
|
|
@@ -1236,6 +1242,15 @@ service SyncAPI {
|
|
|
1236
1242
|
|
|
1237
1243
|
// Revert a document in a sync database to a stored version.
|
|
1238
1244
|
rpc RevertSyncDocumentVersion(RevertSyncDocumentVersionRequest) returns (RevertSyncDocumentVersionResponse);
|
|
1245
|
+
|
|
1246
|
+
// Check whether a content-addressed blob exists in a synapse.
|
|
1247
|
+
rpc HasSynapseBlob(HasSynapseBlobRequest) returns (HasSynapseBlobResponse);
|
|
1248
|
+
|
|
1249
|
+
// Upload a content-addressed blob. The first message must be \`start\` with the expected sha256 (base64url) hash and size; subsequent messages carry payload chunks. Idempotent if the hash is already stored. The server verifies the received bytes match \`hash\` before committing.
|
|
1250
|
+
rpc PutSynapseBlob(stream PutSynapseBlobRequest) returns (stream PutSynapseBlobResponse);
|
|
1251
|
+
|
|
1252
|
+
// Download a content-addressed blob by hash.
|
|
1253
|
+
rpc GetSynapseBlob(GetSynapseBlobRequest) returns (stream GetSynapseBlobResponse);
|
|
1239
1254
|
}
|
|
1240
1255
|
|
|
1241
1256
|
message CreateSynapseConnectionRequest {
|
|
@@ -1403,36 +1418,31 @@ message SynapseDocumentMetadata {
|
|
|
1403
1418
|
// The name of the top-level shared type in the document.
|
|
1404
1419
|
string name = 1;
|
|
1405
1420
|
|
|
1406
|
-
// The type of the shared
|
|
1421
|
+
// The type of the document root. Yjs shared types are "map", "array" or "text". The "blob" type means the payload is a content-addressed object in the synapse blob store (PutSynapseBlob / GetSynapseBlob). There is no Yjs shared type for a blob document. A blob document's schema must be a single entry of type "blob"; it cannot be mixed with map, array, or text roots. The server writes \`__hash\` when the document is bound to a stored blob (see SetSynapseDocumentMetadata.blob_hash).
|
|
1407
1422
|
string type = 2;
|
|
1408
1423
|
|
|
1409
|
-
// The JSON schema that describes the data
|
|
1424
|
+
// The JSON schema that describes the data stored in this shared type.
|
|
1410
1425
|
string json_schema = 3;
|
|
1411
1426
|
}
|
|
1412
1427
|
|
|
1413
1428
|
message SetSynapseDocumentMetadataRequest {
|
|
1414
|
-
// DEPRECATED: Use synapse_id instead.
|
|
1415
|
-
string database_id = 1;
|
|
1416
|
-
|
|
1417
1429
|
// The id of the synapse that contains the document.
|
|
1418
1430
|
string synapse_id = 5;
|
|
1419
1431
|
|
|
1420
1432
|
// The id of the document to set the metadata for.
|
|
1421
1433
|
string document_id = 2;
|
|
1422
1434
|
|
|
1423
|
-
// The metadata to set for the document.
|
|
1435
|
+
// The metadata to set for the document. Each entry names a top-level shared type (map/array/text). For a blob document this must contain exactly one entry with type "blob".
|
|
1424
1436
|
repeated SynapseDocumentMetadata metadata = 3;
|
|
1425
1437
|
|
|
1426
1438
|
// Any additional application-specific JSON to attach to the document.
|
|
1427
1439
|
string json = 4;
|
|
1428
1440
|
|
|
1429
|
-
// Set to true
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
//
|
|
1433
|
-
|
|
1434
|
-
// is already present.
|
|
1435
|
-
bool content_pending = 6;
|
|
1441
|
+
// Set to true to publish \`__hash\` immediately, because the content is already present (content-first) or the document is intentionally empty. Leave false (the default) when content will be written after this call, in which case the server publishes \`__hash\` once that content arrives. This is creator intent at create time; it says nothing about whether other Volts hold the content (see GetSynapseDocumentState).
|
|
1442
|
+
bool publish_hash = 6;
|
|
1443
|
+
|
|
1444
|
+
// For blob documents, the content hash to bind. The server verifies the blob is stored (or the hash is sha256 of empty bytes) and writes \`__hash\`. Omit for a metadata-first create. Must not be set for map/array/text documents; the server computes those hashes from Yjs content.
|
|
1445
|
+
string blob_hash = 7;
|
|
1436
1446
|
}
|
|
1437
1447
|
|
|
1438
1448
|
message SetSynapseDocumentMetadataResponse {
|
|
@@ -1502,9 +1512,6 @@ message SyncDocumentResponse {
|
|
|
1502
1512
|
|
|
1503
1513
|
// Parameters to start watching synapse paths. Sent as the first message.
|
|
1504
1514
|
message WatchSynapsePathStart {
|
|
1505
|
-
// DEPRECATED: Use synapse_id instead.
|
|
1506
|
-
string database_id = 1;
|
|
1507
|
-
|
|
1508
1515
|
// The id of the synapse that contains the document.
|
|
1509
1516
|
string synapse_id = 4;
|
|
1510
1517
|
|
|
@@ -1665,6 +1672,156 @@ message RevertSyncDocumentVersionResponse {
|
|
|
1665
1672
|
string version_id = 2;
|
|
1666
1673
|
}
|
|
1667
1674
|
|
|
1675
|
+
// The state of a synapse document. \`__hash\` in the synapse metadata says what the content is; this says whether this Volt holds it yet. Metadata replicates independently of content, so a document can be ANNOUNCED here and READY on the Volt that produced it.
|
|
1676
|
+
enum SynapseDocumentState {
|
|
1677
|
+
SYNAPSE_DOCUMENT_STATE_UNKNOWN = 0;
|
|
1678
|
+
|
|
1679
|
+
// No metadata entry for this document on this Volt.
|
|
1680
|
+
SYNAPSE_DOCUMENT_STATE_ABSENT = 1;
|
|
1681
|
+
|
|
1682
|
+
// Metadata entry exists but no \`__hash\` has been published yet, so no content has been committed. See SetSynapseDocumentMetadata.publish_hash.
|
|
1683
|
+
SYNAPSE_DOCUMENT_STATE_DRAFT = 2;
|
|
1684
|
+
|
|
1685
|
+
// \`__hash\` is published but the content this Volt holds does not match it. The content is still in flight; wait for READY before reading it.
|
|
1686
|
+
SYNAPSE_DOCUMENT_STATE_ANNOUNCED = 3;
|
|
1687
|
+
|
|
1688
|
+
// The content this Volt holds matches \`__hash\`. The document can be read.
|
|
1689
|
+
SYNAPSE_DOCUMENT_STATE_READY = 4;
|
|
1690
|
+
|
|
1691
|
+
// The metadata entry was removed.
|
|
1692
|
+
SYNAPSE_DOCUMENT_STATE_DELETED = 5;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
message GetSynapseDocumentStateRequest {
|
|
1696
|
+
// The id of the synapse that contains the document.
|
|
1697
|
+
string synapse_id = 1;
|
|
1698
|
+
|
|
1699
|
+
// The id of the document to query.
|
|
1700
|
+
string document_id = 2;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
message GetSynapseDocumentStateResponse {
|
|
1704
|
+
// Details of any error that occurred on the call.
|
|
1705
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
1706
|
+
|
|
1707
|
+
// The state of the document.
|
|
1708
|
+
SynapseDocumentState state = 2;
|
|
1709
|
+
|
|
1710
|
+
// The content hash advertised in the synapse metadata (\`__hash\`). Empty for ABSENT and DRAFT documents.
|
|
1711
|
+
string hash = 3;
|
|
1712
|
+
|
|
1713
|
+
// The content hash this Volt actually holds. Empty when no content has landed here yet. Equal to \`hash\` when the state is READY.
|
|
1714
|
+
string local_hash = 4;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
// Parameters to start watching synapse document state. Sent as the first message.
|
|
1718
|
+
message WatchSynapseDocumentStateStart {
|
|
1719
|
+
// The id of the synapse to watch.
|
|
1720
|
+
string synapse_id = 1;
|
|
1721
|
+
|
|
1722
|
+
// The ids of the documents to watch. Leave empty to watch every document in the synapse, including documents added after the watch starts.
|
|
1723
|
+
repeated string document_id = 2;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
message WatchSynapseDocumentStateRequest {
|
|
1727
|
+
oneof payload {
|
|
1728
|
+
// Start watching; must be sent as the first message.
|
|
1729
|
+
WatchSynapseDocumentStateStart start = 1;
|
|
1730
|
+
|
|
1731
|
+
// Request to stop the watch.
|
|
1732
|
+
bool stop = 2;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
message WatchSynapseDocumentStateUpdate {
|
|
1737
|
+
// The id of the document whose state changed.
|
|
1738
|
+
string document_id = 1;
|
|
1739
|
+
|
|
1740
|
+
SynapseDocumentState state = 2;
|
|
1741
|
+
|
|
1742
|
+
// The content hash advertised in the synapse metadata (\`__hash\`).
|
|
1743
|
+
string hash = 3;
|
|
1744
|
+
|
|
1745
|
+
// The content hash this Volt actually holds.
|
|
1746
|
+
string local_hash = 4;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
message WatchSynapseDocumentStateResponse {
|
|
1750
|
+
oneof result {
|
|
1751
|
+
// Details of any error that occurred on the call.
|
|
1752
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
1753
|
+
|
|
1754
|
+
// A document state update.
|
|
1755
|
+
WatchSynapseDocumentStateUpdate update = 2;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
message HasSynapseBlobRequest {
|
|
1760
|
+
// The id of the synapse that stores the blob.
|
|
1761
|
+
string synapse_id = 1;
|
|
1762
|
+
|
|
1763
|
+
// SHA-256 of the raw file bytes, encoded as unpadded base64url.
|
|
1764
|
+
string hash = 2;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
message HasSynapseBlobResponse {
|
|
1768
|
+
// Details of any error that occurred on the call.
|
|
1769
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
1770
|
+
|
|
1771
|
+
// True if a blob with this hash is already stored.
|
|
1772
|
+
bool exists = 2;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
message PutSynapseBlobStart {
|
|
1776
|
+
// The id of the synapse that stores the blob.
|
|
1777
|
+
string synapse_id = 1;
|
|
1778
|
+
|
|
1779
|
+
// Expected sha256 (base64url) of the concatenated payload bytes.
|
|
1780
|
+
string hash = 2;
|
|
1781
|
+
|
|
1782
|
+
// Total payload size in bytes. Zero means no blob row (empty file).
|
|
1783
|
+
uint64 size = 3;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
message PutSynapseBlobRequest {
|
|
1787
|
+
oneof payload {
|
|
1788
|
+
// Must be sent as the first message.
|
|
1789
|
+
PutSynapseBlobStart start = 1;
|
|
1790
|
+
|
|
1791
|
+
// The next chunk of blob data.
|
|
1792
|
+
bytes block = 2;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
message PutSynapseBlobResponse {
|
|
1797
|
+
tdx.volt_api.volt.v1.Status status = 1;
|
|
1798
|
+
|
|
1799
|
+
// Number of payload blocks received. Zero until the stream finishes.
|
|
1800
|
+
uint32 ack = 2;
|
|
1801
|
+
|
|
1802
|
+
// True if the hash was already present (put is a no-op).
|
|
1803
|
+
bool exists = 3;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
message GetSynapseBlobRequest {
|
|
1807
|
+
// The id of the synapse that stores the blob.
|
|
1808
|
+
string synapse_id = 1;
|
|
1809
|
+
|
|
1810
|
+
// SHA-256 of the raw file bytes, encoded as unpadded base64url.
|
|
1811
|
+
string hash = 2;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
message GetSynapseBlobResponse {
|
|
1815
|
+
// The next chunk of blob data or details of any error that occurred on the call.
|
|
1816
|
+
oneof payload {
|
|
1817
|
+
// The next chunk of blob data.
|
|
1818
|
+
bytes block = 1;
|
|
1819
|
+
|
|
1820
|
+
// Details of any error that occurred on the call.
|
|
1821
|
+
tdx.volt_api.volt.v1.Status status = 2;
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1668
1825
|
`;
|
|
1669
1826
|
export const terminal_api = `syntax = "proto3";
|
|
1670
1827
|
|
|
@@ -2038,6 +2195,9 @@ message VoltParameters {
|
|
|
2038
2195
|
|
|
2039
2196
|
// Optional per-method gRPC rate limits (see GrpcRpcRateLimit). Keyed by peer identity or fingerprint.
|
|
2040
2197
|
repeated GrpcRpcRateLimit grpc_rpc_rate_limit = 57;
|
|
2198
|
+
|
|
2199
|
+
// Deadline in milliseconds for outbound unary gRPC calls made by this Volt (relay, synapse, mirroring, drive and DID registry calls). If unset or zero, the built-in defaults are used.
|
|
2200
|
+
uint32 grpc_unary_deadline = 58;
|
|
2041
2201
|
}
|
|
2042
2202
|
|
|
2043
2203
|
message VoltEndpoint {
|