@tdxvolt/volt-client-grpc 0.20.29 → 0.20.31

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 CHANGED
@@ -1784,6 +1784,15 @@ service SyncAPI {
1784
1784
 
1785
1785
  // Revert a document in a sync database to a stored version.
1786
1786
  rpc RevertSyncDocumentVersion(RevertSyncDocumentVersionRequest) returns (RevertSyncDocumentVersionResponse);
1787
+
1788
+ // Check whether a content-addressed blob exists in a synapse.
1789
+ rpc HasSynapseBlob(HasSynapseBlobRequest) returns (HasSynapseBlobResponse);
1790
+
1791
+ // 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.
1792
+ rpc PutSynapseBlob(stream PutSynapseBlobRequest) returns (stream PutSynapseBlobResponse);
1793
+
1794
+ // Download a content-addressed blob by hash.
1795
+ rpc GetSynapseBlob(GetSynapseBlobRequest) returns (stream GetSynapseBlobResponse);
1787
1796
  }
1788
1797
 
1789
1798
  message CreateSynapseConnectionRequest {
@@ -1951,36 +1960,31 @@ message SynapseDocumentMetadata {
1951
1960
  // The name of the top-level shared type in the document.
1952
1961
  string name = 1;
1953
1962
 
1954
- // The type of the shared type, e.g. "map", "array" or "text".
1963
+ // 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
1964
  string type = 2;
1956
1965
 
1957
- // The JSON schema that describes the data that is stored in this shared type.
1966
+ // The JSON schema that describes the data stored in this shared type.
1958
1967
  string json_schema = 3;
1959
1968
  }
1960
1969
 
1961
1970
  message SetSynapseDocumentMetadataRequest {
1962
- // DEPRECATED: Use synapse_id instead.
1963
- string database_id = 1;
1964
-
1965
1971
  // The id of the synapse that contains the document.
1966
1972
  string synapse_id = 5;
1967
1973
 
1968
1974
  // The id of the document to set the metadata for.
1969
1975
  string document_id = 2;
1970
1976
 
1971
- // The metadata to set for the document.
1977
+ // 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
1978
  repeated SynapseDocumentMetadata metadata = 3;
1973
1979
 
1974
1980
  // Any additional application-specific JSON to attach to the document.
1975
1981
  string json = 4;
1976
1982
 
1977
- // Set to true when the caller intends to write the document's content
1978
- // separately, after this metadata call (a metadata-first create). The sync
1979
- // server uses this to defer __hash bootstrapping until the content actually
1980
- // arrives, so the hash is not computed over an empty document. Leave false
1981
- // (the default) for empty documents or content-first flows where the content
1982
- // is already present.
1983
- bool content_pending = 6;
1983
+ // Set to true when the document content is already present (content-first) or the document is intentionally empty, so the server bootstraps \`__hash\` immediately. Leave false (the default) when content will be written after this call.
1984
+ bool content_ready = 6;
1985
+
1986
+ // 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.
1987
+ string blob_hash = 7;
1984
1988
  }
1985
1989
 
1986
1990
  message SetSynapseDocumentMetadataResponse {
@@ -2213,6 +2217,64 @@ message RevertSyncDocumentVersionResponse {
2213
2217
  string version_id = 2;
2214
2218
  }
2215
2219
 
2220
+ message HasSynapseBlobRequest {
2221
+ // The id of the synapse that stores the blob.
2222
+ string synapse_id = 1;
2223
+
2224
+ // sha256 of the raw file bytes, encoded as unpadded base64url (same family
2225
+ // as VoltDrive content hashes).
2226
+ string hash = 2;
2227
+ }
2228
+
2229
+ message HasSynapseBlobResponse {
2230
+ tdx.volt_api.volt.v1.Status status = 1;
2231
+
2232
+ // True if a blob with this hash is already stored.
2233
+ bool exists = 2;
2234
+ }
2235
+
2236
+ message PutSynapseBlobStart {
2237
+ string synapse_id = 1;
2238
+
2239
+ // Expected sha256 (base64url) of the concatenated payload bytes.
2240
+ string hash = 2;
2241
+
2242
+ // Total payload size in bytes. Zero means no blob row (empty file).
2243
+ uint64 size = 3;
2244
+ }
2245
+
2246
+ message PutSynapseBlobRequest {
2247
+ oneof payload {
2248
+ // Must be sent as the first message.
2249
+ PutSynapseBlobStart start = 1;
2250
+
2251
+ // The next chunk of blob data.
2252
+ bytes block = 2;
2253
+ }
2254
+ }
2255
+
2256
+ message PutSynapseBlobResponse {
2257
+ tdx.volt_api.volt.v1.Status status = 1;
2258
+
2259
+ // Number of payload blocks received. Zero until the stream finishes.
2260
+ uint32 ack = 2;
2261
+
2262
+ // True if the hash was already present (put is a no-op).
2263
+ bool exists = 3;
2264
+ }
2265
+
2266
+ message GetSynapseBlobRequest {
2267
+ string synapse_id = 1;
2268
+ string hash = 2;
2269
+ }
2270
+
2271
+ message GetSynapseBlobResponse {
2272
+ oneof payload {
2273
+ bytes block = 1;
2274
+ tdx.volt_api.volt.v1.Status status = 2;
2275
+ }
2276
+ }
2277
+
2216
2278
  `;
2217
2279
  const terminal_api = `syntax = "proto3";
2218
2280
 
@@ -7066,6 +7128,32 @@ class VoltClient extends EventEmitter__default["default"] {
7066
7128
  WriteSynapsePath(request) {
7067
7129
  return unaryCallInternal.call(this, "WriteSynapsePath", request);
7068
7130
  }
7131
+
7132
+ HasSynapseBlob(request) {
7133
+ return unaryCallInternal.call(this, "HasSynapseBlob", request);
7134
+ }
7135
+
7136
+ PutSynapseBlob(request) {
7137
+ const grpcClient = this.getVoltAPIClient();
7138
+
7139
+ const putBlobCall = new GRPCCall(
7140
+ this,
7141
+ "PutSynapseBlob",
7142
+ "METHOD_TYPE_BIDI"
7143
+ );
7144
+ return putBlobCall.start(grpcClient, request);
7145
+ }
7146
+
7147
+ GetSynapseBlob(request) {
7148
+ const grpcClient = this.getVoltAPIClient();
7149
+
7150
+ const getBlobCall = new GRPCCall(
7151
+ this,
7152
+ "GetSynapseBlob",
7153
+ "METHOD_TYPE_SERVER_STREAM"
7154
+ );
7155
+ return getBlobCall.start(grpcClient, request);
7156
+ }
7069
7157
  }
7070
7158
 
7071
7159
  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.29",
6
+ "version": "0.20.31",
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.29",
37
- "@tdxvolt/volt-utility": "^0.20.29",
36
+ "@tdxvolt/volt-client-web": "^0.20.31",
37
+ "@tdxvolt/volt-utility": "^0.20.31",
38
38
  "debug": "^4.1.1",
39
39
  "ip": "^1.1.5",
40
40
  "jsonwebtoken": "^8.5.1",
@@ -788,4 +788,30 @@ export class VoltClient extends EventEmitter {
788
788
  WriteSynapsePath(request) {
789
789
  return unaryCallInternal.call(this, "WriteSynapsePath", request);
790
790
  }
791
+
792
+ HasSynapseBlob(request) {
793
+ return unaryCallInternal.call(this, "HasSynapseBlob", request);
794
+ }
795
+
796
+ PutSynapseBlob(request) {
797
+ const grpcClient = this.getVoltAPIClient();
798
+
799
+ const putBlobCall = new GRPCCall(
800
+ this,
801
+ "PutSynapseBlob",
802
+ "METHOD_TYPE_BIDI"
803
+ );
804
+ return putBlobCall.start(grpcClient, request);
805
+ }
806
+
807
+ GetSynapseBlob(request) {
808
+ const grpcClient = this.getVoltAPIClient();
809
+
810
+ const getBlobCall = new GRPCCall(
811
+ this,
812
+ "GetSynapseBlob",
813
+ "METHOD_TYPE_SERVER_STREAM"
814
+ );
815
+ return getBlobCall.start(grpcClient, request);
816
+ }
791
817
  }
@@ -1236,6 +1236,15 @@ service SyncAPI {
1236
1236
 
1237
1237
  // Revert a document in a sync database to a stored version.
1238
1238
  rpc RevertSyncDocumentVersion(RevertSyncDocumentVersionRequest) returns (RevertSyncDocumentVersionResponse);
1239
+
1240
+ // Check whether a content-addressed blob exists in a synapse.
1241
+ rpc HasSynapseBlob(HasSynapseBlobRequest) returns (HasSynapseBlobResponse);
1242
+
1243
+ // 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.
1244
+ rpc PutSynapseBlob(stream PutSynapseBlobRequest) returns (stream PutSynapseBlobResponse);
1245
+
1246
+ // Download a content-addressed blob by hash.
1247
+ rpc GetSynapseBlob(GetSynapseBlobRequest) returns (stream GetSynapseBlobResponse);
1239
1248
  }
1240
1249
 
1241
1250
  message CreateSynapseConnectionRequest {
@@ -1403,36 +1412,31 @@ message SynapseDocumentMetadata {
1403
1412
  // The name of the top-level shared type in the document.
1404
1413
  string name = 1;
1405
1414
 
1406
- // The type of the shared type, e.g. "map", "array" or "text".
1415
+ // 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
1416
  string type = 2;
1408
1417
 
1409
- // The JSON schema that describes the data that is stored in this shared type.
1418
+ // The JSON schema that describes the data stored in this shared type.
1410
1419
  string json_schema = 3;
1411
1420
  }
1412
1421
 
1413
1422
  message SetSynapseDocumentMetadataRequest {
1414
- // DEPRECATED: Use synapse_id instead.
1415
- string database_id = 1;
1416
-
1417
1423
  // The id of the synapse that contains the document.
1418
1424
  string synapse_id = 5;
1419
1425
 
1420
1426
  // The id of the document to set the metadata for.
1421
1427
  string document_id = 2;
1422
1428
 
1423
- // The metadata to set for the document.
1429
+ // 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
1430
  repeated SynapseDocumentMetadata metadata = 3;
1425
1431
 
1426
1432
  // Any additional application-specific JSON to attach to the document.
1427
1433
  string json = 4;
1428
1434
 
1429
- // Set to true when the caller intends to write the document's content
1430
- // separately, after this metadata call (a metadata-first create). The sync
1431
- // server uses this to defer __hash bootstrapping until the content actually
1432
- // arrives, so the hash is not computed over an empty document. Leave false
1433
- // (the default) for empty documents or content-first flows where the content
1434
- // is already present.
1435
- bool content_pending = 6;
1435
+ // Set to true when the document content is already present (content-first) or the document is intentionally empty, so the server bootstraps \`__hash\` immediately. Leave false (the default) when content will be written after this call.
1436
+ bool content_ready = 6;
1437
+
1438
+ // 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.
1439
+ string blob_hash = 7;
1436
1440
  }
1437
1441
 
1438
1442
  message SetSynapseDocumentMetadataResponse {
@@ -1665,6 +1669,64 @@ message RevertSyncDocumentVersionResponse {
1665
1669
  string version_id = 2;
1666
1670
  }
1667
1671
 
1672
+ message HasSynapseBlobRequest {
1673
+ // The id of the synapse that stores the blob.
1674
+ string synapse_id = 1;
1675
+
1676
+ // sha256 of the raw file bytes, encoded as unpadded base64url (same family
1677
+ // as VoltDrive content hashes).
1678
+ string hash = 2;
1679
+ }
1680
+
1681
+ message HasSynapseBlobResponse {
1682
+ tdx.volt_api.volt.v1.Status status = 1;
1683
+
1684
+ // True if a blob with this hash is already stored.
1685
+ bool exists = 2;
1686
+ }
1687
+
1688
+ message PutSynapseBlobStart {
1689
+ string synapse_id = 1;
1690
+
1691
+ // Expected sha256 (base64url) of the concatenated payload bytes.
1692
+ string hash = 2;
1693
+
1694
+ // Total payload size in bytes. Zero means no blob row (empty file).
1695
+ uint64 size = 3;
1696
+ }
1697
+
1698
+ message PutSynapseBlobRequest {
1699
+ oneof payload {
1700
+ // Must be sent as the first message.
1701
+ PutSynapseBlobStart start = 1;
1702
+
1703
+ // The next chunk of blob data.
1704
+ bytes block = 2;
1705
+ }
1706
+ }
1707
+
1708
+ message PutSynapseBlobResponse {
1709
+ tdx.volt_api.volt.v1.Status status = 1;
1710
+
1711
+ // Number of payload blocks received. Zero until the stream finishes.
1712
+ uint32 ack = 2;
1713
+
1714
+ // True if the hash was already present (put is a no-op).
1715
+ bool exists = 3;
1716
+ }
1717
+
1718
+ message GetSynapseBlobRequest {
1719
+ string synapse_id = 1;
1720
+ string hash = 2;
1721
+ }
1722
+
1723
+ message GetSynapseBlobResponse {
1724
+ oneof payload {
1725
+ bytes block = 1;
1726
+ tdx.volt_api.volt.v1.Status status = 2;
1727
+ }
1728
+ }
1729
+
1668
1730
  `;
1669
1731
  export const terminal_api = `syntax = "proto3";
1670
1732