@tdxvolt/volt-client-grpc 0.20.10 → 0.20.12

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
@@ -10,12 +10,12 @@ var debug = require('debug');
10
10
  var Protobuf = require('protobufjs');
11
11
  var camelCase = require('lodash.camelcase');
12
12
  var descriptor = require('protobufjs/ext/descriptor/index.js');
13
+ var voltUtility = require('@tdxvolt/volt-utility');
13
14
  var EventEmitter = require('events');
14
15
  var fs = require('fs');
15
16
  var path = require('path');
16
17
  var jwt = require('jsonwebtoken');
17
18
  var crypto = require('crypto');
18
- var voltUtility = require('@tdxvolt/volt-utility');
19
19
 
20
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
21
 
@@ -1266,128 +1266,6 @@ message RemoteResponse {
1266
1266
  HttpRequest http_request = 5;
1267
1267
  }
1268
1268
  }
1269
- `;
1270
- const spark_api = `syntax = "proto3";
1271
-
1272
- package tdx.volt_api.volt.v1;
1273
-
1274
- import "tdx/volt_api/volt/v1/status.proto";
1275
-
1276
- // The Spark API allows clients to start and communicate with Spark VMs.
1277
- service SparkAPI {
1278
- // Start or connect to a spark VM and establish a long-lived communication channel.
1279
- rpc Spark(stream SparkRequest) returns (stream SparkResponse);
1280
-
1281
- // Get details of running spark VMs.
1282
- rpc GetSpark(GetSparkRequest) returns (GetSparkResponse);
1283
- }
1284
-
1285
- // Start a resource-hosted spark.
1286
- // Provenance is determined from the resource owner.
1287
- message StartSparkResource {
1288
- // The id of the resource containing the VM byte code.
1289
- string resource_id = 1;
1290
-
1291
- // JSON-encoded payload to parameterise the spark.
1292
- string payload = 2;
1293
-
1294
- // Envelope signature.
1295
- string signature = 3;
1296
- }
1297
-
1298
- // Start a spark from byte code included in the payload, along with issuer/developer claims and signature.
1299
- message StartSparkAdhoc {
1300
- // Ad-hoc byte code of VM to run.
1301
- bytes byte_code = 1;
1302
-
1303
- // Verifiable credentials associated with this spark.
1304
- repeated string credential = 2;
1305
-
1306
- // Envelope signature.
1307
- string signature = 3;
1308
-
1309
- // JSON-encoded payload to parameterise the spark.
1310
- string payload = 4;
1311
- }
1312
-
1313
- // Send commands and payloads to communicate with a running spark.
1314
- message SparkCommand {
1315
- // Optional id to associate with this command.
1316
- // If this is omitted, an id will be assigned and returned in the command acknowledgement.
1317
- string command_id = 1;
1318
-
1319
- // The command to send to the spark.
1320
- string command = 2;
1321
-
1322
- // The command payload.
1323
- string payload = 3;
1324
-
1325
- // Command verifiable credential.
1326
- string credential = 4;
1327
-
1328
- // Command signature.
1329
- string signature = 5;
1330
- }
1331
-
1332
- // The request must contain one of the messages indicated below.
1333
- message SparkRequest {
1334
- oneof payload {
1335
- StartSparkResource start_resource = 1;
1336
- StartSparkAdhoc start_adhoc = 2;
1337
- SparkCommand command = 3;
1338
- }
1339
- }
1340
-
1341
- // Receive events and payload from a running spark.
1342
- message SparkData {
1343
- // The command id to which this data corresponds.
1344
- string command_id = 1;
1345
-
1346
- oneof payload {
1347
- // Acknowledges receipt of a spark command.
1348
- bool acknowledge = 2;
1349
-
1350
- // Indicates the command has completed.
1351
- bool ended = 3;
1352
-
1353
- // Will contain error details on command failure.
1354
- string error = 4;
1355
-
1356
- // Data emitted by a command, usually in stringified JSON format.
1357
- string data = 5;
1358
- }
1359
- }
1360
-
1361
- // Details of a spark instance.
1362
- message SparkInstance {
1363
- // The UUID assigned to the spark instance.
1364
- string spark_id = 1;
1365
- }
1366
-
1367
- // The response will contain one of the messages indicated below.
1368
- message SparkResponse {
1369
- oneof payload {
1370
- // Details of any error that occurred on the call.
1371
- tdx.volt_api.volt.v1.Status status = 1;
1372
-
1373
- // Details of the spark instance, sent in response to a start command.
1374
- SparkInstance spark_instance = 2;
1375
-
1376
- // Payload data emitted by the spark.
1377
- SparkData spark_data = 3;
1378
- }
1379
- }
1380
-
1381
- message GetSparkRequest {
1382
- string spark_id = 1;
1383
- }
1384
-
1385
- // One of the following fields will be present in the response.
1386
- message GetSparkResponse {
1387
- // Details of any error that occurred on the call.
1388
- tdx.volt_api.volt.v1.Status status = 1;
1389
- }
1390
-
1391
1269
  `;
1392
1270
  const ssi = `syntax = "proto3";
1393
1271
 
@@ -1463,12 +1341,12 @@ const ssi_api = `syntax = "proto3";
1463
1341
 
1464
1342
  package tdx.volt_api.volt.v1;
1465
1343
 
1466
- import "tdx/volt_api/volt/v1/status.proto";
1467
1344
  import "tdx/volt_api/volt/v1/ssi.proto";
1345
+ import "tdx/volt_api/volt/v1/status.proto";
1468
1346
 
1469
1347
  service SsiAPI {
1470
- // Get a short-lived, one-time token that can be used to authenticate with the Volt and potentially create verifiable credential(s).
1471
- rpc CreateExchangeToken(CreateExchangeTokenRequest) returns (CreateExchangeTokenResponse);
1348
+ // Creates a verifiable credential binding an email address to an identity.
1349
+ rpc CreateEmailCredential(CreateEmailCredentialRequest) returns (CreateEmailCredentialResponse);
1472
1350
 
1473
1351
  // Delete a DID document or all DID documents originating from a given Volt.
1474
1352
  // Requires \`volt:delete-did\` API privilege.
@@ -1499,20 +1377,26 @@ service SsiAPI {
1499
1377
  rpc SearchDIDRegistry(SearchDIDRegistryRequest) returns (SearchDIDRegistryResponse);
1500
1378
  }
1501
1379
 
1502
- message CreateExchangeTokenRequest {
1503
- // The VC template to use to create a verifiable credential.
1504
- string vc_template = 1;
1380
+ message CreateEmailCredentialRequest {
1381
+ // The DID of the identity to bind to. If not specified the DID of the currently authenticated account is used.
1382
+ string identity_did = 1;
1383
+
1384
+ // The email address to bind to the identity.
1385
+ string email_address = 2;
1505
1386
 
1506
- // The time to live for the token, in seconds.
1507
- uint32 ttl = 2;
1387
+ // The identity provider to use.
1388
+ string identity_provider = 3;
1389
+
1390
+ // The passphrase for the identity key, if required (i.e. the key is encrypted).
1391
+ string key_passphrase = 4;
1508
1392
  }
1509
1393
 
1510
- message CreateExchangeTokenResponse {
1394
+ message CreateEmailCredentialResponse {
1511
1395
  // Details of any error that occurred on the call.
1512
1396
  tdx.volt_api.volt.v1.Status status = 1;
1513
1397
 
1514
- // The one-time token.
1515
- string token = 2;
1398
+ // The verifiable credential resource id.
1399
+ string vc_id = 2;
1516
1400
  }
1517
1401
 
1518
1402
  message DeleteDIDRequest {
@@ -1714,14 +1598,57 @@ const sync_api = `syntax = "proto3";
1714
1598
  package tdx.volt_api.volt.v1;
1715
1599
 
1716
1600
  import "tdx/volt_api/volt/v1/status.proto";
1601
+ import "tdx/volt_api/volt/v1/volt_api.proto";
1717
1602
 
1718
1603
  // The Sync API allows clients to collaboratively read and write JSON data to a shared resource.
1719
1604
  service SyncAPI {
1605
+ // Create a synapse connection resource.
1606
+ // A synapse connection defines a bi-directional syncronisation between two Volt databases. The connection is created as a child of the local synapse resource, and a symbolic link is also placed in the system-wide 'connection' folder.
1607
+ // The remote Volt is identified by its DID or address. If a relay address is provided, the connection will be established via the relay.
1608
+ // The authenticated account must have \`volt:resource-create\` access to the local synapse resource.
1609
+ rpc CreateSynapseConnection(SaveResourceRequest) returns (SaveResourceResponse);
1610
+
1611
+ // Set the metadata for a synapse document.
1612
+ rpc SetSynapseDocumentMetadata(SetSynapseDocumentMetadataRequest) returns (SetSynapseDocumentMetadataResponse);
1613
+
1720
1614
  // Bidirectional streaming RPC for real-time document synchronization
1721
1615
  rpc SyncDocument(stream SyncDocumentRequest) returns (stream SyncDocumentResponse);
1722
1616
 
1723
- // Simple RPC to fetch current document state as JSON
1724
- rpc GetDocumentJSON(GetDocumentJSONRequest) returns (GetDocumentJSONResponse);
1617
+ // Watch synapse paths for changes.
1618
+ rpc WatchSynapsePath(stream WatchSynapsePathRequest) returns (stream WatchSynapsePathResponse);
1619
+
1620
+ // Write a single value to a given synapse JSON path.
1621
+ rpc WriteSynapsePath(WriteSynapsePathRequest) returns (WriteSynapsePathResponse);
1622
+ }
1623
+
1624
+
1625
+ message SynapseDocumentMetadata {
1626
+ // The name of the top-level shared type in the document.
1627
+ string name = 1;
1628
+
1629
+ // The type of the shared type, e.g. "map", "array" or "text".
1630
+ string type = 2;
1631
+
1632
+ // The JSON schema that describes the data that is stored in this shared type.
1633
+ string json_schema = 3;
1634
+ }
1635
+
1636
+ message SetSynapseDocumentMetadataRequest {
1637
+ // The id of the synapse.
1638
+ string database_id = 1;
1639
+
1640
+ // The id of the document to set the metadata for.
1641
+ string document_id = 2;
1642
+
1643
+ // The metadata to set for the document.
1644
+ repeated SynapseDocumentMetadata metadata = 3;
1645
+
1646
+ // Any additional application-specific JSON to attach to the document.
1647
+ string json = 4;
1648
+ }
1649
+
1650
+ message SetSynapseDocumentMetadataResponse {
1651
+ tdx.volt_api.volt.v1.Status status = 1;
1725
1652
  }
1726
1653
 
1727
1654
  enum SyncState {
@@ -1785,20 +1712,88 @@ message SyncDocumentResponse {
1785
1712
  bool is_read_only = 5;
1786
1713
  }
1787
1714
 
1788
- message GetDocumentJSONRequest {
1715
+ // Parameters to start watching synapse paths. Sent as the first message.
1716
+ message WatchSynapsePathStart {
1717
+ // The id of the database that contains the document.
1789
1718
  string database_id = 1;
1719
+
1720
+ // The id of the document to watch.
1790
1721
  string document_id = 2;
1722
+
1723
+ // The JSON paths to watch.
1724
+ repeated string path = 3;
1725
+ }
1726
+
1727
+ message WatchSynapsePathRequest {
1728
+ oneof payload {
1729
+ // Start watching the given paths; must be sent as the first message.
1730
+ WatchSynapsePathStart start = 1;
1731
+
1732
+ // Request to stop the watch.
1733
+ bool stop = 2;
1734
+ }
1791
1735
  }
1792
1736
 
1793
- message GetDocumentJSONResponse {
1737
+ enum SynapsePathUpdateType {
1738
+ SYNAPSE_PATH_UPDATE_TYPE_UNKNOWN = 0;
1739
+ SYNAPSE_PATH_UPDATE_TYPE_ADD = 1;
1740
+ SYNAPSE_PATH_UPDATE_TYPE_UPDATE = 2;
1741
+ SYNAPSE_PATH_UPDATE_TYPE_DELETE = 3;
1742
+ }
1743
+
1744
+ message WatchSynapsePathUpdate {
1745
+ // The JSON path that was updated.
1746
+ string watch_path = 1;
1747
+
1748
+ // The actual JSON path for this match (e.g. $.content["Atlantic Star"].lat).
1749
+ // Enables clients to identify which array element or map key the update refers to when using wildcard matches such as $.content[*]
1750
+ string event_path = 2;
1751
+
1752
+ // The type of update.
1753
+ SynapsePathUpdateType update_type = 3;
1754
+
1755
+ // The JSON value that was updated.
1756
+ string value = 4;
1757
+
1758
+ // The previous JSON value before the update.
1759
+ string previous_value = 5;
1760
+
1761
+ // The zero-based index of the update.
1762
+ uint32 index = 6;
1763
+
1764
+ // The total number of updates.
1765
+ uint32 total = 7;
1766
+ }
1767
+
1768
+ message WatchSynapsePathResponse {
1794
1769
  oneof result {
1795
1770
  // Details of any error that occurred on the call.
1796
- tdx.volt_api.volt.v1.Status error = 1;
1771
+ tdx.volt_api.volt.v1.Status status = 1;
1797
1772
 
1798
- // The current JSON snapshot of the document
1799
- string json = 2;
1773
+ // The update to the path.
1774
+ WatchSynapsePathUpdate update = 2;
1800
1775
  }
1801
1776
  }
1777
+
1778
+ message WriteSynapsePathRequest {
1779
+ // The id of the database that contains the document.
1780
+ string database_id = 1;
1781
+
1782
+ // The id of the document to write to.
1783
+ string document_id = 2;
1784
+
1785
+ // The JSON path to write to.
1786
+ string path = 3;
1787
+
1788
+ // The JSON value to write.
1789
+ string json = 4;
1790
+ }
1791
+
1792
+ message WriteSynapsePathResponse {
1793
+ // Details of any error that occurred on the call.
1794
+ tdx.volt_api.volt.v1.Status status = 1;
1795
+ }
1796
+
1802
1797
  `;
1803
1798
  const terminal_api = `syntax = "proto3";
1804
1799
 
@@ -2556,6 +2551,9 @@ import "tdx/volt_api/volt/v1/volt.proto";
2556
2551
  // A client certificate can be obtained from the \`Authenticate\` method.
2557
2552
  // All methods include a \`tdx.volt_api.volt.v1.Status\` in the response. If the status contains a non-OK error code the client should assume the remainder of the message is invalid, unless otherwise indicated in the response documentation.
2558
2553
  service VoltAPI {
2554
+ // Add a relay connection resource to this volt.
2555
+ rpc AddRelay(SaveResourceRequest) returns (SaveResourceResponse);
2556
+
2559
2557
  // Issues a request to authenticate on the volt.
2560
2558
  // All clients must successfully authenticate in order to gain any kind of access.
2561
2559
  // A client certificate is optional for this RPC, if omitted a JWT must be provided in the call metadata.
@@ -2645,17 +2643,35 @@ service VoltAPI {
2645
2643
  rpc SaveAccess(SaveAccessRequest) returns (SaveAccessResponse);
2646
2644
 
2647
2645
  // Create or update a static file HTTP server.
2648
- rpc SaveHttpFileServer(SaveResourceRequest) returns (SaveResourceResponse);
2646
+ rpc SaveHttpFileServer(SaveHttpFileServerRequest) returns (SaveHttpFileServerResponse);
2647
+
2648
+ // Create or update an HTTP forwarder resource.
2649
+ rpc SaveHttpForwarder(SaveHttpForwarderRequest) returns (SaveHttpForwarderResponse);
2649
2650
 
2650
2651
  // Create or update an HTTP REST API server.
2651
- rpc SaveHttpApiServer(SaveResourceRequest) returns (SaveResourceResponse);
2652
+ rpc SaveHttpRestApiServer(SaveHttpRestApiServerRequest) returns (SaveHttpRestApiServerResponse);
2653
+
2654
+ // Create or update an HTTP REST API node.
2655
+ rpc SaveHttpRestApiNode(SaveHttpRestApiNodeRequest) returns (SaveHttpRestApiNodeResponse);
2652
2656
 
2653
2657
  // Create or update an identity.
2654
2658
  rpc SaveIdentity(SaveIdentityRequest) returns (SaveIdentityResponse);
2655
2659
 
2660
+ // Create or update a database resource.
2661
+ rpc SaveDatabase(SaveDatabaseRequest) returns (SaveDatabaseResponse);
2662
+
2656
2663
  // Create or update a mirrored link resource.
2657
2664
  rpc SaveMirroredLink(SaveResourceRequest) returns (SaveResourceResponse);
2658
2665
 
2666
+ // Create or update a sync database resource.
2667
+ rpc SaveSyncDatabase(SaveSyncDatabaseRequest) returns (SaveSyncDatabaseResponse);
2668
+
2669
+ // Create or update a synapse resource.
2670
+ rpc SaveSynapse(SaveSynapseRequest) returns (SaveSynapseResponse);
2671
+
2672
+ // Create a synapse connection resource.
2673
+ rpc CreateSynapseConnection(CreateSynapseConnectionRequest) returns (CreateSynapseConnectionResponse);
2674
+
2659
2675
  // Update Volt parameters.
2660
2676
  // This is a privileged call that requires Volt root access.
2661
2677
  rpc SaveParameters(SaveParametersRequest) returns (SaveParametersResponse);
@@ -2714,7 +2730,7 @@ message AuthenticateRequest {
2714
2730
  // A human-readable name of the entity requesting to authenticate.
2715
2731
  string client_name = 6;
2716
2732
 
2717
- // Optional challenge code, hashed using SHA-256 and base64 encoded.
2733
+ // Optional challenge code, hashed using SHA-256 and base64 URL encoded (no padding).
2718
2734
  string challenge = 7;
2719
2735
 
2720
2736
  // The host name to add as a SAN to the issued certificate.
@@ -3572,6 +3588,143 @@ message SaveResourceResponse {
3572
3588
  Resource resource = 2;
3573
3589
  }
3574
3590
 
3591
+ message SaveDatabaseRequest {
3592
+ Resource resource = 1;
3593
+ bool create = 2;
3594
+ string create_in_parent_id = 3;
3595
+ bool purge_attributes = 4;
3596
+ bool encrypted = 5;
3597
+ bool read_audit = 6;
3598
+ bool write_audit = 7;
3599
+ }
3600
+
3601
+ message SaveDatabaseResponse {
3602
+ tdx.volt_api.volt.v1.Status status = 1;
3603
+ Resource resource = 2;
3604
+ }
3605
+
3606
+ message SaveSyncDatabaseRequest {
3607
+ Resource resource = 1;
3608
+ bool create = 2;
3609
+ string create_in_parent_id = 3;
3610
+ bool purge_attributes = 4;
3611
+ bool encrypted = 5;
3612
+ bool read_audit = 6;
3613
+ bool write_audit = 7;
3614
+ bool no_snapshots = 8;
3615
+ }
3616
+
3617
+ message SaveSyncDatabaseResponse {
3618
+ tdx.volt_api.volt.v1.Status status = 1;
3619
+ Resource resource = 2;
3620
+ }
3621
+
3622
+ message SaveSynapseRequest {
3623
+ Resource resource = 1;
3624
+ bool create = 2;
3625
+ string create_in_parent_id = 3;
3626
+ bool purge_attributes = 4;
3627
+ bool encrypted = 5;
3628
+ bool read_audit = 6;
3629
+ bool write_audit = 7;
3630
+ bool no_snapshots = 8;
3631
+ }
3632
+
3633
+ message SaveSynapseResponse {
3634
+ tdx.volt_api.volt.v1.Status status = 1;
3635
+ Resource resource = 2;
3636
+ }
3637
+
3638
+ message SaveHttpForwarderRequest {
3639
+ Resource resource = 1;
3640
+ bool create = 2;
3641
+ string create_in_parent_id = 3;
3642
+ bool purge_attributes = 4;
3643
+ string domain = 5;
3644
+ string host = 6;
3645
+ int32 port = 7;
3646
+ bool forward_host = 8;
3647
+ }
3648
+
3649
+ message SaveHttpForwarderResponse {
3650
+ tdx.volt_api.volt.v1.Status status = 1;
3651
+ Resource resource = 2;
3652
+ }
3653
+
3654
+ message SaveHttpFileServerRequest {
3655
+ Resource resource = 1;
3656
+ bool create = 2;
3657
+ string create_in_parent_id = 3;
3658
+ bool purge_attributes = 4;
3659
+ string path = 5;
3660
+ string host = 6;
3661
+ int32 port = 7;
3662
+ bool enabled = 8;
3663
+ int32 cache_timeout = 9;
3664
+ bool catch_all_enabled = 10;
3665
+ string catch_all = 11;
3666
+ }
3667
+
3668
+ message SaveHttpFileServerResponse {
3669
+ tdx.volt_api.volt.v1.Status status = 1;
3670
+ Resource resource = 2;
3671
+ }
3672
+
3673
+ message SaveHttpRestApiServerRequest {
3674
+ Resource resource = 1;
3675
+ bool create = 2;
3676
+ string create_in_parent_id = 3;
3677
+ bool purge_attributes = 4;
3678
+ string host = 5;
3679
+ int32 port = 6;
3680
+ bool enabled = 7;
3681
+ bool cors_enabled = 8;
3682
+ }
3683
+
3684
+ message SaveHttpRestApiServerResponse {
3685
+ tdx.volt_api.volt.v1.Status status = 1;
3686
+ Resource resource = 2;
3687
+ }
3688
+
3689
+ message SaveHttpRestApiNodeRequest {
3690
+ Resource resource = 1;
3691
+ bool create = 2;
3692
+ string create_in_parent_id = 3;
3693
+ bool purge_attributes = 4;
3694
+ bool is_literal = 5;
3695
+ string literal_json = 6;
3696
+ string database_id = 7;
3697
+ string sql = 8;
3698
+ repeated string parameter = 9;
3699
+ }
3700
+
3701
+ message SaveHttpRestApiNodeResponse {
3702
+ tdx.volt_api.volt.v1.Status status = 1;
3703
+ Resource resource = 2;
3704
+ }
3705
+
3706
+ message CreateSynapseConnectionRequest {
3707
+ Resource resource = 1;
3708
+ bool create = 2;
3709
+ string create_in_parent_id = 3;
3710
+ bool purge_attributes = 4;
3711
+ string local_synapse_id = 5;
3712
+ string remote_synapse_id = 6;
3713
+ string remote_volt_identity = 7;
3714
+ string remote_volt_address = 8;
3715
+ string remote_volt_http_address = 9;
3716
+ string remote_volt_ca = 10;
3717
+ string remote_identity = 11;
3718
+ string relay_address = 12;
3719
+ string relay_ca = 13;
3720
+ string relay_challenge = 14;
3721
+ }
3722
+
3723
+ message CreateSynapseConnectionResponse {
3724
+ tdx.volt_api.volt.v1.Status status = 1;
3725
+ Resource resource = 2;
3726
+ }
3727
+
3575
3728
  message SaveSessionRequest {
3576
3729
  Session session = 1;
3577
3730
  }
@@ -3678,17 +3831,47 @@ const wire_api = `syntax = "proto3";
3678
3831
  package tdx.volt_api.volt.v1;
3679
3832
 
3680
3833
  import "tdx/volt_api/volt/v1/status.proto";
3834
+ import "tdx/volt_api/volt/v1/volt.proto";
3681
3835
 
3682
3836
  // The Wire API allows clients to subscribe and publish to Volt wire resources.
3683
3837
  service WireAPI {
3838
+
3684
3839
  // Establishes a client-streaming call to the wire resource.
3685
3840
  rpc PublishWire(stream PublishWireRequest) returns (stream PublishWireResponse);
3686
3841
 
3842
+ // Saves a wire resource.
3843
+ rpc SaveWire(SaveWireRequest) returns (SaveWireResponse);
3844
+
3687
3845
  // Establishes a bi-directional streaming call to the wire resource.
3688
3846
  // Although we're only really interested in receiving data from the wire, a bi-directional stream is required so that we can gracefully stop the subscription.
3689
3847
  rpc SubscribeWire(stream SubscribeWireRequest) returns (stream SubscribeWireResponse);
3690
3848
  }
3691
3849
 
3850
+ message SaveWireRequest {
3851
+ // The wire resource to save.
3852
+ Resource resource = 1;
3853
+
3854
+ // Set to create a new wire resource.
3855
+ bool create = 2;
3856
+
3857
+ // The id of the folder resource in which to create the wire resource.
3858
+ string create_in_parent_id = 3;
3859
+
3860
+ // Set to purge the wire resource attributes before saving.
3861
+ bool purge_attributes = 4;
3862
+
3863
+ // Set to persist the wire messages.
3864
+ bool persist = 5;
3865
+
3866
+ // The table to persist the wire messages to.
3867
+ string persist_table = 6;
3868
+ }
3869
+
3870
+ message SaveWireResponse {
3871
+ tdx.volt_api.volt.v1.Status status = 1;
3872
+ tdx.volt_api.volt.v1.Resource resource = 2;
3873
+ }
3874
+
3692
3875
  // Because the publish RPC is streaming, the policy will not be checked until the first message arrives. This can mean that the \`PublishWire\` call appears to succeed but then fails after the first attempt to publish a message.
3693
3876
  // To avoid this, clients can immediately send a message with the \`wire_id\` set and no \`chunk\` set. This will establish that the correct permissions are in place and fail fast if not.
3694
3877
  message PublishWireRequest {
@@ -3730,7 +3913,7 @@ message SubscribeWireResponse {
3730
3913
  }
3731
3914
 
3732
3915
  `;
3733
- const voltProtos = [sqlite, sqlite_database_api, sqlite_server_api, proto_db_sync, proxy_api, relay_api, discovery_api, file, file_api, remote, spark_api, ssi, ssi_api, status, sync_api, terminal_api, volt, volt_api, wire_api];
3916
+ const voltProtos = [sqlite, sqlite_database_api, sqlite_server_api, proto_db_sync, proxy_api, relay_api, discovery_api, file, file_api, remote, ssi, ssi_api, status, sync_api, terminal_api, volt, volt_api, wire_api];
3734
3917
 
3735
3918
  debug__default["default"]("volt-client-grpc:proto-utils");
3736
3919
 
@@ -4151,11 +4334,6 @@ class GRPCCall extends EventEmitter__default["default"] {
4151
4334
  );
4152
4335
 
4153
4336
  this._call.on("data", (streamResponse) => {
4154
- if (this._ended) {
4155
- log$5("ignoring data after end on %s", this._methodName);
4156
- return;
4157
- }
4158
-
4159
4337
  try {
4160
4338
  const parsedResponse = _parseResponse.call(
4161
4339
  this,
@@ -4163,6 +4341,13 @@ class GRPCCall extends EventEmitter__default["default"] {
4163
4341
  this._initialRequest.meta,
4164
4342
  streamResponse
4165
4343
  );
4344
+
4345
+ if (this._ended && !parsedResponse.ended) {
4346
+ log$5("ignoring data after end on %s", this._methodName);
4347
+ log$5(parsedResponse);
4348
+ return;
4349
+ }
4350
+
4166
4351
  if (parsedResponse.key_exchange) {
4167
4352
  const peerKey = keyFromPem$2(
4168
4353
  parsedResponse.key_exchange.encryption_key
@@ -4194,9 +4379,6 @@ class GRPCCall extends EventEmitter__default["default"] {
4194
4379
  } else if (parsedResponse.ended) {
4195
4380
  if (parsedResponse.error) {
4196
4381
  this.emit("error", new Error(parsedResponse.error));
4197
- } else {
4198
- // Not sure this is necessary - we should receive "end" from grpc soon...
4199
- this.emit("end");
4200
4382
  }
4201
4383
  } else {
4202
4384
  log$5("method id is %s", parsedResponse.methodId);
@@ -4672,6 +4854,7 @@ function _cleanUp(immediateReconnect) {
4672
4854
  }
4673
4855
 
4674
4856
  if (this._dying) {
4857
+ log$3("dying - clearing reconnect timer");
4675
4858
  clearTimeout(this._reconnectTimer);
4676
4859
  } else if (immediateReconnect || (this._autoRetry && !this._reconnectTimer)) {
4677
4860
  this._reconnectTimer = setTimeout(
@@ -4684,6 +4867,7 @@ function _cleanUp(immediateReconnect) {
4684
4867
  }
4685
4868
 
4686
4869
  if (this.call?.writable) {
4870
+ log$3("ending Connect call");
4687
4871
  this.call.end();
4688
4872
  }
4689
4873
  }
@@ -4774,9 +4958,7 @@ function _doConnect(connectHello) {
4774
4958
  });
4775
4959
 
4776
4960
  this.call.on("end", () => {
4777
- if (this._connectionId) {
4778
- this.emit("connected", false);
4779
- }
4961
+ this.emit("connected", false);
4780
4962
  _cleanUp.call(this);
4781
4963
  });
4782
4964
 
@@ -5106,18 +5288,18 @@ function connectInternal(helloPayload) {
5106
5288
  this._voltConnection.on("connected", (session) => {
5107
5289
  this._session = session;
5108
5290
  this._connected = !!session;
5291
+ this.emit("connected", session);
5109
5292
  if (!this._connected) {
5110
5293
  onDisconnected();
5111
5294
  }
5112
- this.emit("connected", session);
5113
5295
  });
5114
5296
 
5115
5297
  this._voltConnection.on("error", (err) => {
5116
5298
  // Should auto-reconnect.
5117
5299
  log$2("Volt connection error [%s]", err.message);
5118
5300
  if (this._connected) {
5119
- onDisconnected();
5120
5301
  this.emit("connected", false);
5302
+ onDisconnected();
5121
5303
  }
5122
5304
 
5123
5305
  if (err.message.endsWith("session invalid")) {
@@ -5546,12 +5728,19 @@ class VoltClient extends EventEmitter__default["default"] {
5546
5728
  * instead of a DID-based authentication session.
5547
5729
  * @param {string} [options.exchangeToken] - optional token to exchange in return for an authenticated session.
5548
5730
  * @param {boolean} [options.waitForAuth] - whether to block and poll on 'prompt' authenticate decisions. Default is true.
5731
+ * @param {boolean} [options.noResolve] - whether to skip resolving the Volt configuration. Default is false.
5549
5732
  */
5550
5733
  async initialise(config, options = {}) {
5551
5734
  log("initialise ", config, options);
5552
5735
 
5553
- const { ownDID, noDID, didRegistryList, exchangeToken, extraConfig } =
5554
- options;
5736
+ const {
5737
+ ownDID,
5738
+ noDID,
5739
+ didRegistryList,
5740
+ exchangeToken,
5741
+ extraConfig,
5742
+ noResolve
5743
+ } = options;
5555
5744
  const waitForAuth =
5556
5745
  options.waitForAuth === undefined ? true : !!options.waitForAuth;
5557
5746
 
@@ -5601,10 +5790,12 @@ class VoltClient extends EventEmitter__default["default"] {
5601
5790
  throw new Error("client_name property required in config");
5602
5791
  }
5603
5792
 
5604
- this._config.volt = await voltUtility.resolveVoltConfig(
5605
- this._config.volt,
5606
- didRegistryList
5607
- );
5793
+ if (!noResolve) {
5794
+ this._config.volt = await voltUtility.resolveVoltConfig(
5795
+ this._config.volt,
5796
+ didRegistryList
5797
+ );
5798
+ }
5608
5799
 
5609
5800
  this._voltConfig = this._config.volt;
5610
5801
 
@@ -5667,7 +5858,7 @@ class VoltClient extends EventEmitter__default["default"] {
5667
5858
  this._credential.saveCache();
5668
5859
  }
5669
5860
 
5670
- return Promise.resolve(this._config);
5861
+ return Promise.resolve(this.credential.config);
5671
5862
  } catch (err) {
5672
5863
  log("failure starting Volt client [%s]", err.message);
5673
5864
  throw err;
@@ -5782,10 +5973,18 @@ class VoltClient extends EventEmitter__default["default"] {
5782
5973
  * VoltAPI - resource management
5783
5974
  */
5784
5975
 
5976
+ AddRelay(request) {
5977
+ return unaryCallInternal.call(this, "AddRelay", request);
5978
+ }
5979
+
5785
5980
  CanAccessResource(request) {
5786
5981
  return unaryCallInternal.call(this, "CanAccessResource", request);
5787
5982
  }
5788
5983
 
5984
+ CopyResource(request) {
5985
+ return unaryCallInternal.call(this, "CopyResource", request);
5986
+ }
5987
+
5789
5988
  DeleteResource(request) {
5790
5989
  return unaryCallInternal.call(this, "DeleteResource", request);
5791
5990
  }
@@ -5810,6 +6009,10 @@ class VoltClient extends EventEmitter__default["default"] {
5810
6009
  return unaryCallInternal.call(this, "GetResourceDescendants", request);
5811
6010
  }
5812
6011
 
6012
+ MoveResource(request) {
6013
+ return unaryCallInternal.call(this, "MoveResource", request);
6014
+ }
6015
+
5813
6016
  RequestAccess(request) {
5814
6017
  return unaryCallInternal.call(this, "RequestAccess", request);
5815
6018
  }
@@ -5818,8 +6021,44 @@ class VoltClient extends EventEmitter__default["default"] {
5818
6021
  return unaryCallInternal.call(this, "SaveResource", request);
5819
6022
  }
5820
6023
 
5821
- SaveResourceAttribute(request) {
5822
- return unaryCallInternal.call(this, "SaveResourceAttribute", request);
6024
+ SaveDatabase(request) {
6025
+ return unaryCallInternal.call(this, "SaveDatabase", request);
6026
+ }
6027
+
6028
+ SaveHttpFileServer(request) {
6029
+ return unaryCallInternal.call(this, "SaveHttpFileServer", request);
6030
+ }
6031
+
6032
+ SaveHttpForwarder(request) {
6033
+ return unaryCallInternal.call(this, "SaveHttpForwarder", request);
6034
+ }
6035
+
6036
+ SaveHttpRestApiServer(request) {
6037
+ return unaryCallInternal.call(this, "SaveHttpRestApiServer", request);
6038
+ }
6039
+
6040
+ SaveHttpRestApiNode(request) {
6041
+ return unaryCallInternal.call(this, "SaveHttpRestApiNode", request);
6042
+ }
6043
+
6044
+ SaveMirroredLink(request) {
6045
+ return unaryCallInternal.call(this, "SaveMirroredLink", request);
6046
+ }
6047
+
6048
+ SaveSyncDatabase(request) {
6049
+ return unaryCallInternal.call(this, "SaveSyncDatabase", request);
6050
+ }
6051
+
6052
+ SaveSynapse(request) {
6053
+ return unaryCallInternal.call(this, "SaveSynapse", request);
6054
+ }
6055
+
6056
+ CreateSynapseConnection(request) {
6057
+ return unaryCallInternal.call(this, "CreateSynapseConnection", request);
6058
+ }
6059
+
6060
+ SaveSymbolicLink(request) {
6061
+ return unaryCallInternal.call(this, "SaveSymbolicLink", request);
5823
6062
  }
5824
6063
 
5825
6064
  SetServiceStatus(request) {
@@ -5834,26 +6073,18 @@ class VoltClient extends EventEmitter__default["default"] {
5834
6073
  return unaryCallInternal.call(this, "Authenticate", request);
5835
6074
  }
5836
6075
 
5837
- Bind(request) {
5838
- return unaryCallInternal.call(this, "Bind", request);
6076
+ CheckCompatibility(request) {
6077
+ return unaryCallInternal.call(this, "CheckCompatibility", request);
5839
6078
  }
5840
6079
 
5841
6080
  DeleteAccess(request) {
5842
6081
  return unaryCallInternal.call(this, "DeleteAccess", request);
5843
6082
  }
5844
6083
 
5845
- DeleteVolt(request) {
5846
- return unaryCallInternal.call(this, "DeleteVolt", request);
5847
- }
5848
-
5849
6084
  GetAccess(request) {
5850
6085
  return unaryCallInternal.call(this, "GetAccess", request);
5851
6086
  }
5852
6087
 
5853
- GetBindings(request) {
5854
- return unaryCallInternal.call(this, "GetBindings", request);
5855
- }
5856
-
5857
6088
  GetIdentities(request) {
5858
6089
  return unaryCallInternal.call(this, "GetIdentities", request);
5859
6090
  }
@@ -5862,40 +6093,44 @@ class VoltClient extends EventEmitter__default["default"] {
5862
6093
  return unaryCallInternal.call(this, "GetIdentity", request);
5863
6094
  }
5864
6095
 
5865
- GetIdentityToken(request) {
5866
- return unaryCallInternal.call(this, "GetIdentityToken", request);
6096
+ GetOneTimeToken(request) {
6097
+ return unaryCallInternal.call(this, "GetOneTimeToken", request);
6098
+ }
6099
+
6100
+ GetParameters(request) {
6101
+ return unaryCallInternal.call(this, "GetParameters", request);
5867
6102
  }
5868
6103
 
5869
6104
  GetPolicy(request) {
5870
6105
  return unaryCallInternal.call(this, "GetPolicy", request);
5871
6106
  }
5872
6107
 
5873
- GetSettings(request) {
5874
- return unaryCallInternal.call(this, "GetSettings", request);
6108
+ GetSessions(request) {
6109
+ return unaryCallInternal.call(this, "GetSessions", request);
5875
6110
  }
5876
6111
 
5877
6112
  SaveAccess(request) {
5878
6113
  return unaryCallInternal.call(this, "SaveAccess", request);
5879
6114
  }
5880
6115
 
5881
- SaveCloudConnection(request) {
5882
- return unaryCallInternal.call(this, "SaveCloudConnection", request);
5883
- }
5884
-
5885
6116
  SaveIdentity(request) {
5886
6117
  return unaryCallInternal.call(this, "SaveIdentity", request);
5887
6118
  }
5888
6119
 
5889
- SaveSettings(request) {
5890
- return unaryCallInternal.call(this, "SaveSettings", request);
6120
+ SaveParameters(request) {
6121
+ return unaryCallInternal.call(this, "SaveParameters", request);
6122
+ }
6123
+
6124
+ SaveSession(request) {
6125
+ return unaryCallInternal.call(this, "SaveSession", request);
5891
6126
  }
5892
6127
 
5893
6128
  SetAccessRequestDecision(request) {
5894
6129
  return unaryCallInternal.call(this, "SetAccessRequestDecision", request);
5895
6130
  }
5896
6131
 
5897
- SetBindingDecision(request) {
5898
- return unaryCallInternal.call(this, "SetBindingDecision", request);
6132
+ SetPolicy(request) {
6133
+ return unaryCallInternal.call(this, "SetPolicy", request);
5899
6134
  }
5900
6135
 
5901
6136
  Shutdown(request) {
@@ -5906,6 +6141,16 @@ class VoltClient extends EventEmitter__default["default"] {
5906
6141
  return unaryCallInternal.call(this, "SignVerify", request);
5907
6142
  }
5908
6143
 
6144
+ /**
6145
+ * VoltAPI - streaming (bidi). Use connect() for Connect stream.
6146
+ * Invoke is for relay proxying; returns a duplex stream of InvokeRequest/InvokeResponse.
6147
+ */
6148
+ Invoke(request) {
6149
+ const grpcClient = this.getVoltAPIClient();
6150
+ const invokeCall = new GRPCCall(this, "Invoke", "METHOD_TYPE_BIDI");
6151
+ return invokeCall.start(grpcClient, request);
6152
+ }
6153
+
5909
6154
  /**
5910
6155
  * FileAPI
5911
6156
  */
@@ -6120,6 +6365,9 @@ class VoltClient extends EventEmitter__default["default"] {
6120
6365
  return subscribeCall.start(grpcClient, request);
6121
6366
  }
6122
6367
 
6368
+ /**
6369
+ * SyncAPI
6370
+ */
6123
6371
  SyncDocument(request) {
6124
6372
  const grpcClient = this.getVoltAPIClient();
6125
6373
 
@@ -6130,6 +6378,25 @@ class VoltClient extends EventEmitter__default["default"] {
6130
6378
  );
6131
6379
  return syncDocumentCall.start(grpcClient, request);
6132
6380
  }
6381
+
6382
+ SetSynapseDocumentMetadata(request) {
6383
+ return unaryCallInternal.call(this, "SetSynapseDocumentMetadata", request);
6384
+ }
6385
+
6386
+ WatchSynapsePath(request) {
6387
+ const grpcClient = this.getVoltAPIClient();
6388
+
6389
+ const watchPathCall = new GRPCCall(
6390
+ this,
6391
+ "WatchSynapsePath",
6392
+ "METHOD_TYPE_BIDI"
6393
+ );
6394
+ return watchPathCall.start(grpcClient, request);
6395
+ }
6396
+
6397
+ WriteSynapsePath(request) {
6398
+ return unaryCallInternal.call(this, "WriteSynapsePath", request);
6399
+ }
6133
6400
  }
6134
6401
 
6135
6402
  Object.defineProperty(exports, 'SyncProvider', {