@tdxvolt/volt-client-grpc 0.20.21 → 0.20.27

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
@@ -756,11 +756,14 @@ package tdx.volt_api.data.v1;
756
756
  import "tdx/volt_api/volt/v1/status.proto";
757
757
  import "tdx/volt_api/volt/v1/volt.proto";
758
758
 
759
- // The Sqlite Server API provides database management functions.
760
- // Use the VoltAPI DeleteResource function to delete a database.
759
+ // The Sqlite Server API provides database and view management functions.
760
+ // Use the VoltAPI DeleteResource function to delete a database or data view.
761
761
  service SqliteServerAPI {
762
762
  // Create a new database resource.
763
763
  rpc CreateDatabase(CreateDatabaseRequest) returns (CreateDatabaseResponse);
764
+
765
+ // Create or update a data view resource.
766
+ rpc SaveDataView(SaveDataViewRequest) returns (SaveDataViewResponse);
764
767
  }
765
768
 
766
769
  message CreateDatabaseRequest {
@@ -799,6 +802,55 @@ message CreateDatabaseResponse {
799
802
  tdx.volt_api.volt.v1.Resource resource = 2;
800
803
  }
801
804
 
805
+ message DataViewParameter {
806
+ // The parameter name referenced in the SQL template.
807
+ string name = 1;
808
+
809
+ // The parameter data type.
810
+ tdx.volt_api.volt.v1.AttributeDataType data_type = 2;
811
+
812
+ // Optional default value for the parameter.
813
+ tdx.volt_api.volt.v1.AttributeValue default_value = 3;
814
+
815
+ // Set when default_value should be applied.
816
+ bool include_default_value = 4;
817
+ }
818
+
819
+ message SaveDataViewRequest {
820
+ // Details of the data view to save.
821
+ tdx.volt_api.volt.v1.Resource resource = 1;
822
+
823
+ // Set to indicate this is a new data view.
824
+ bool create = 2;
825
+
826
+ // The id of the folder resource in which a new data view should be created.
827
+ // If omitted, the home folder of the currently authenticated identity will be used.
828
+ string create_in_parent_id = 3;
829
+
830
+ // Set to indicate the resource attributes should be purged before saving the resource.
831
+ bool purge_attributes = 4;
832
+
833
+ // The id of the source database on which this view is based.
834
+ // The authenticated account must have the relevant access to the source database, for example to create a 'SELECT' view the account must have 'volt:database-read' access to the source database. To create an 'INSERT' view the account must have 'volt:database-write' access to the source database.
835
+ string source_database_id = 5;
836
+
837
+ // The SQL template for the view.
838
+ string sql = 6;
839
+
840
+ // Set to allow sub-selects in the view SQL.
841
+ bool allow_sub_select = 7;
842
+
843
+ // Parameters defined for the view SQL template.
844
+ repeated DataViewParameter parameter = 8;
845
+ }
846
+
847
+ message SaveDataViewResponse {
848
+ // Details of any error that occurred on the call.
849
+ tdx.volt_api.volt.v1.Status status = 1;
850
+
851
+ // The saved data view resource.
852
+ tdx.volt_api.volt.v1.Resource resource = 2;
853
+ }
802
854
  `;
803
855
  const proto_db_sync = `syntax = "proto3";
804
856
 
@@ -1570,6 +1622,13 @@ message ResolveDIDRequest {
1570
1622
 
1571
1623
  // Set to search all known registries rather than just the local registry.
1572
1624
  bool include_registries = 2;
1625
+
1626
+ // Per-DID document version. 0 = latest; 1..N = ordinal in the op log.
1627
+ uint64 version = 3;
1628
+
1629
+ // Milliseconds since epoch. Resolves the document active at that time.
1630
+ // Mutually exclusive with version.
1631
+ uint64 at_timestamp = 4;
1573
1632
  }
1574
1633
 
1575
1634
  message ResolveDIDResponse {
@@ -1708,6 +1767,18 @@ service SyncAPI {
1708
1767
 
1709
1768
  // Write a single value to a given synapse JSON path.
1710
1769
  rpc WriteSynapsePath(WriteSynapsePathRequest) returns (WriteSynapsePathResponse);
1770
+
1771
+ // List stored versions of a document in a sync database.
1772
+ rpc ListSyncDocumentVersions(ListSyncDocumentVersionsRequest) returns (ListSyncDocumentVersionsResponse);
1773
+
1774
+ // Get a stored version of a document in a sync database.
1775
+ rpc GetSyncDocumentVersion(GetSyncDocumentVersionRequest) returns (GetSyncDocumentVersionResponse);
1776
+
1777
+ // Create a version checkpoint for a document in a sync database.
1778
+ rpc CreateSyncDocumentVersion(CreateSyncDocumentVersionRequest) returns (CreateSyncDocumentVersionResponse);
1779
+
1780
+ // Revert a document in a sync database to a stored version.
1781
+ rpc RevertSyncDocumentVersion(RevertSyncDocumentVersionRequest) returns (RevertSyncDocumentVersionResponse);
1711
1782
  }
1712
1783
 
1713
1784
  message CreateSynapseConnectionRequest {
@@ -1821,8 +1892,8 @@ message SaveSyncDatabaseRequest {
1821
1892
  // Set to audit all INSERT, UPDATE, and DELETE database operations.
1822
1893
  bool write_audit = 7;
1823
1894
 
1824
- // By default, yjs updates are periodically compressed and stored as snapshots. Set this flag to disable snapshots. This will reduce the size of the database and improve performance, but will also reduce the ability to rollback to a previous state.
1825
- bool no_snapshots = 8;
1895
+ // By default, yjs updates are periodically compacted. Set this flag to disable compaction. This will reduce the size of the database but will remove the ability to version the documents in the database.
1896
+ bool no_compaction = 8;
1826
1897
 
1827
1898
  // The number of updates to batch before flushing to the database. Defaults to 100.
1828
1899
  uint32 batch_size = 9;
@@ -1859,8 +1930,8 @@ message SaveSynapseRequest {
1859
1930
  // Set to audit all INSERT, UPDATE, and DELETE synapse operations.
1860
1931
  bool write_audit = 7;
1861
1932
 
1862
- // By default, yjs updates are periodically compressed and stored as snapshots. Set this flag to disable snapshots. This will reduce the size of the synapse and improve performance, but will also reduce the ability to rollback to a previous state.
1863
- bool no_snapshots = 8;
1933
+ // By default, yjs updates are periodically compacted. Set this flag to disable compaction. This will reduce the size of the database but will remove the ability to version the documents in the database.
1934
+ bool no_compaction = 8;
1864
1935
  }
1865
1936
 
1866
1937
  message SaveSynapseResponse {
@@ -1897,6 +1968,14 @@ message SetSynapseDocumentMetadataRequest {
1897
1968
 
1898
1969
  // Any additional application-specific JSON to attach to the document.
1899
1970
  string json = 4;
1971
+
1972
+ // Set to true when the caller intends to write the document's content
1973
+ // separately, after this metadata call (a metadata-first create). The sync
1974
+ // server uses this to defer __hash bootstrapping until the content actually
1975
+ // arrives, so the hash is not computed over an empty document. Leave false
1976
+ // (the default) for empty documents or content-first flows where the content
1977
+ // is already present.
1978
+ bool content_pending = 6;
1900
1979
  }
1901
1980
 
1902
1981
  message SetSynapseDocumentMetadataResponse {
@@ -2052,6 +2131,83 @@ message WriteSynapsePathResponse {
2052
2131
  tdx.volt_api.volt.v1.Status status = 1;
2053
2132
  }
2054
2133
 
2134
+ message SyncDocumentVersionSummary {
2135
+ // Globally unique version identifier (UUID).
2136
+ string version_id = 1;
2137
+
2138
+ // Milliseconds since Unix epoch when the version was created.
2139
+ uint64 timestamp = 2;
2140
+
2141
+ // Identity that created the version.
2142
+ string identity = 3;
2143
+
2144
+ // Optional user-provided label.
2145
+ string label = 4;
2146
+
2147
+ // Document hash (__hash) at the time of the version, when available.
2148
+ string document_hash = 5;
2149
+ }
2150
+
2151
+ message ListSyncDocumentVersionsRequest {
2152
+ // The id of the sync database that contains the document.
2153
+ string database_id = 1;
2154
+
2155
+ // The id of the document.
2156
+ string document_id = 2;
2157
+
2158
+ // Maximum number of versions to return. Defaults to 50.
2159
+ uint32 limit = 3;
2160
+
2161
+ // Number of versions to skip from the newest end.
2162
+ uint32 offset = 4;
2163
+ }
2164
+
2165
+ message ListSyncDocumentVersionsResponse {
2166
+ tdx.volt_api.volt.v1.Status status = 1;
2167
+ repeated SyncDocumentVersionSummary versions = 2;
2168
+ }
2169
+
2170
+ message GetSyncDocumentVersionRequest {
2171
+ string database_id = 1;
2172
+ string document_id = 2;
2173
+ string version_id = 3;
2174
+ }
2175
+
2176
+ message GetSyncDocumentVersionResponse {
2177
+ tdx.volt_api.volt.v1.Status status = 1;
2178
+ SyncDocumentVersionSummary info = 2;
2179
+
2180
+ // Full Yjs v2 document state at this version. Clients materialize locally.
2181
+ bytes state_update = 3;
2182
+ }
2183
+
2184
+ message CreateSyncDocumentVersionRequest {
2185
+ string database_id = 1;
2186
+ string document_id = 2;
2187
+ string label = 3;
2188
+ }
2189
+
2190
+ message CreateSyncDocumentVersionResponse {
2191
+ tdx.volt_api.volt.v1.Status status = 1;
2192
+ string version_id = 2;
2193
+ }
2194
+
2195
+ message RevertSyncDocumentVersionRequest {
2196
+ string database_id = 1;
2197
+ string document_id = 2;
2198
+ string version_id = 3;
2199
+
2200
+ // Optional label for the audit version created after revert.
2201
+ string label = 4;
2202
+ }
2203
+
2204
+ message RevertSyncDocumentVersionResponse {
2205
+ tdx.volt_api.volt.v1.Status status = 1;
2206
+
2207
+ // Version id of the audit checkpoint created after revert.
2208
+ string version_id = 2;
2209
+ }
2210
+
2055
2211
  `;
2056
2212
  const terminal_api = `syntax = "proto3";
2057
2213
 
@@ -2061,6 +2217,7 @@ import "tdx/volt_api/volt/v1/status.proto";
2061
2217
 
2062
2218
  service TerminalAPI {
2063
2219
  // Bidirectional streaming RPC for real-time terminal control and data exchange.
2220
+ // Note that \`volt:command-invoke\` access is required to invoke this API. An optional allow-list of comma-separated commands can be specified in the \`extra\` string of the access policy.
2064
2221
  rpc CommandStream(stream CommandStreamRequest) returns (stream CommandStreamResponse);
2065
2222
  }
2066
2223
 
@@ -2716,7 +2873,18 @@ message Access {
2716
2873
  // Requested access.
2717
2874
  string access = 10;
2718
2875
 
2719
- // Optional extra data.
2876
+ // Optional extra data that further constrains the access being granted. How this string is interpreted depends on the value of \`access\` above:
2877
+ //
2878
+ // - \`volt:api-call\`: a single API method name. The access only applies when the invoked API method matches this value (policy attribute \`volt:action-api-call\`). Leave empty to allow all API methods.
2879
+ //
2880
+ // - \`volt:command-invoke\` (CommandStream API): a comma-separated allow-list of commands. The access is permitted (or denied depending on the rule decision) when the invoked command matches any entry in the list (policy attribute \`volt:action-command\`). A trailing \`*\` acts as a prefix wildcard (e.g. \`/usr/bin/*\` allows any command beginning with \`/usr/bin/\`). Leave empty to allow all commands.
2881
+ // Example: "ls,git,/usr/bin/python3"
2882
+ //
2883
+ // - Otherwise: a comma-separated list of \`[attributeId]|[value]\` pairs, each matched against the named resource attribute (trailing \`*\` acts as a prefix wildcard). The sync-database case below is a specialisation of this general form.
2884
+ //
2885
+ // - Sync databases (\`volt:sync-database\` resources, e.g. with \`volt:database-read\` / \`volt:database-write\` access): a comma-separated list of \`[attributeId]|[value]\` pairs restricting the access to specific documents. Document ids use the \`volt:resource-sync-document-id\` attribute id, so each entry has the form \`volt:resource-sync-document-id|[documentId]\`. A trailing \`*\` on the value acts as a prefix wildcard. Leave empty to target all documents in the database.
2886
+ // Example: "volt:resource-sync-document-id|doc-123,volt:resource-sync-document-id|report-*"
2887
+ //
2720
2888
  string extra = 11;
2721
2889
 
2722
2890
  // Assigned decision.
@@ -2891,8 +3059,9 @@ service VoltAPI {
2891
3059
  rpc DiscoverServices(DiscoverServicesRequest) returns (DiscoverServicesResponse);
2892
3060
 
2893
3061
  // Get access rule details.
2894
- // Only rules in which the authenticated identity participates will be retrieved, in addition to any rules that target a resource that is owned by the authenticated identity.
2895
3062
  // If the authenticated identity is the Volt root, all rules will be retrieved that match the criteria.
3063
+ // All rules for which the authenticated account has volt:api-call / volt:get-access permission to the rule resource will be retrieved.
3064
+ // Otherwise, only rules in which the authenticated identity participates will be retrieved, in addition to any rules that target a resource that is owned by the authenticated identity.
2896
3065
  rpc GetAccess(GetAccessRequest) returns (GetAccessResponse);
2897
3066
 
2898
3067
  // Retrieve identities matching the given criteria.
@@ -2949,8 +3118,14 @@ service VoltAPI {
2949
3118
  rpc SaveHttpFileServer(SaveHttpFileServerRequest) returns (SaveHttpFileServerResponse);
2950
3119
 
2951
3120
  // Create or update an HTTP forwarder resource.
3121
+ // This is a privileged API call and requires volt:api-call / volt:save-http-forwarder permission.
2952
3122
  rpc SaveHttpForwarder(SaveHttpForwarderRequest) returns (SaveHttpForwarderResponse);
2953
3123
 
3124
+ // Create or update an OAuth/OIDC client registration (used when this Volt
3125
+ // acts as an OpenID Provider). Clients are stored as \`volt:oidc-client\`
3126
+ // resources.
3127
+ rpc SaveOidcClient(SaveOidcClientRequest) returns (SaveOidcClientResponse);
3128
+
2954
3129
  // Create or update an HTTP REST API server.
2955
3130
  // This is a privileged API call and requires volt:api-call / volt:save-http-rest-api-server permission.
2956
3131
  rpc SaveHttpRestApiServer(SaveHttpRestApiServerRequest) returns (SaveHttpRestApiServerResponse);
@@ -3102,6 +3277,10 @@ message CanAccessResourceRequest {
3102
3277
 
3103
3278
  // The type of access that is required.
3104
3279
  string access = 4;
3280
+
3281
+ // Optional additional information about the access request.
3282
+ // For volt:api-call, the extra data is the API method lookup, e.g. volt:get-access.
3283
+ string extra = 5;
3105
3284
  }
3106
3285
 
3107
3286
  message CanAccessResourceResponse {
@@ -3937,6 +4116,51 @@ message SaveHttpForwarderRequest {
3937
4116
  string host = 6;
3938
4117
  int32 port = 7;
3939
4118
  bool forward_host = 8;
4119
+
4120
+ // Optional path prefix (e.g. "/myapp") for path-based forwarding. May be used
4121
+ // on its own (path forwarding on the Volt's own host) or together with
4122
+ // \`domain\` (sub-domain + path, e.g. sub.acme.com/myapp). At least one of
4123
+ // \`domain\` or \`path\` must be set.
4124
+ string path = 9;
4125
+
4126
+ // When a \`path\` prefix is configured, controls whether that prefix is removed
4127
+ // from the request path before forwarding (standard reverse-proxy behaviour).
4128
+ // Defaults to true when unset: the target then receives the request at its
4129
+ // own root (e.g. "/drive/assets/x.js" -> "/assets/x.js"), which suits plain
4130
+ // static file servers and root-mounted backends. Set to false for targets
4131
+ // that are themselves configured under the same sub-path and expect to
4132
+ // receive the prefix. The \`X-Forwarded-Prefix\` header is always sent.
4133
+ optional bool strip_path = 10;
4134
+
4135
+ // When true, incoming requests to this forwarder must carry a valid
4136
+ // authenticated session (established via the OIDC sign-in flow) and pass the
4137
+ // policy check before being proxied to the target. Unauthenticated requests
4138
+ // are redirected to the configured OpenID Provider. The session is never
4139
+ // exposed to the target (the session cookie is stripped before forwarding).
4140
+ bool auth_enabled = 11;
4141
+
4142
+ // OpenID Provider issuer URL used for discovery
4143
+ // (\`<issuer>/.well-known/openid-configuration\`). May be a Volt acting as an
4144
+ // OpenID Provider, or any external OIDC provider. Required when
4145
+ // \`auth_enabled\` is set.
4146
+ string oidc_issuer = 12;
4147
+
4148
+ // OAuth 2.0 client identifier registered with the OpenID Provider.
4149
+ string oidc_client_id = 13;
4150
+
4151
+ // OAuth 2.0 client secret. Stored encrypted and redacted on read.
4152
+ string oidc_client_secret = 14;
4153
+
4154
+ // Space separated OAuth scopes. Defaults to "openid email" when empty.
4155
+ string oidc_scopes = 15;
4156
+
4157
+ // Optional override for the reserved callback path on the app host. Defaults
4158
+ // to "/__volt-auth/oidc/callback".
4159
+ string oidc_redirect_path = 16;
4160
+
4161
+ // Email verification mode for OIDC-gated sign-in when the OpenID Provider is
4162
+ // a Volt: "link" (default) or "code".
4163
+ string email_verification_mode = 17;
3940
4164
  }
3941
4165
 
3942
4166
  message SaveHttpForwarderResponse {
@@ -3944,6 +4168,33 @@ message SaveHttpForwarderResponse {
3944
4168
  Resource resource = 2;
3945
4169
  }
3946
4170
 
4171
+ message SaveOidcClientRequest {
4172
+ Resource resource = 1;
4173
+ bool create = 2;
4174
+ string create_in_parent_id = 3;
4175
+ bool purge_attributes = 4;
4176
+
4177
+ // Human-friendly name for the client (also used as resource name when the
4178
+ // resource name is empty).
4179
+ string client_name = 5;
4180
+
4181
+ // OAuth 2.0 client_id. Required.
4182
+ string client_id = 6;
4183
+
4184
+ // OAuth 2.0 client_secret. Stored encrypted and redacted on read. Only
4185
+ // (re)written when non-empty so updates can omit it to keep the existing
4186
+ // secret.
4187
+ string client_secret = 7;
4188
+
4189
+ // Comma- or space-separated list of allowed redirect URIs.
4190
+ string redirect_uris = 8;
4191
+ }
4192
+
4193
+ message SaveOidcClientResponse {
4194
+ tdx.volt_api.volt.v1.Status status = 1;
4195
+ Resource resource = 2;
4196
+ }
4197
+
3947
4198
  message SaveHttpFileServerRequest {
3948
4199
  Resource resource = 1;
3949
4200
  bool create = 2;
@@ -3956,6 +4207,7 @@ message SaveHttpFileServerRequest {
3956
4207
  int32 cache_timeout = 9;
3957
4208
  bool catch_all_enabled = 10;
3958
4209
  string catch_all = 11;
4210
+ bool dynamic_index_enabled = 12;
3959
4211
  }
3960
4212
 
3961
4213
  message SaveHttpFileServerResponse {
@@ -3972,6 +4224,11 @@ message SaveHttpRestApiServerRequest {
3972
4224
  int32 port = 6;
3973
4225
  bool enabled = 7;
3974
4226
  bool cors_enabled = 8;
4227
+ bool is_literal = 9;
4228
+ string literal_json = 10;
4229
+ string database_id = 11;
4230
+ string sql = 12;
4231
+ repeated string parameter = 13;
3975
4232
  }
3976
4233
 
3977
4234
  message SaveHttpRestApiServerResponse {
@@ -5809,7 +6066,10 @@ class VoltCredential {
5809
6066
  if (!this._voltPublicKey) {
5810
6067
  // Extract the public key from the Volt CA cert.
5811
6068
  const voltCA = new crypto__default["default"].X509Certificate(this._voltConfig.ca_pem);
5812
- this._voltPublicKey = voltCA.publicKey.export({ type: 'spki', format: 'pem' });
6069
+ this._voltPublicKey = voltCA.publicKey.export({
6070
+ type: "spki",
6071
+ format: "pem"
6072
+ });
5813
6073
  }
5814
6074
 
5815
6075
  const voltKey = keyFromPem(this._voltPublicKey).publicKey;
@@ -5921,7 +6181,7 @@ class VoltCredential {
5921
6181
  }
5922
6182
 
5923
6183
  saveCache() {
5924
- this._config = {...this._config, credential: { ...this._cryptoCache } };
6184
+ this._config.credential = {...this._cryptoCache};
5925
6185
  const clone = { ...this._config };
5926
6186
  if (this._config.p) {
5927
6187
  // A passphrase option exists => encrypt the key before writing the cache file.
@@ -6519,6 +6779,10 @@ class VoltClient extends EventEmitter__default["default"] {
6519
6779
  return unaryCallInternal.call(this, "CreateDatabase", request);
6520
6780
  }
6521
6781
 
6782
+ SaveDataView(request) {
6783
+ return unaryCallInternal.call(this, "SaveDataView", request);
6784
+ }
6785
+
6522
6786
  /**
6523
6787
  * SqliteDatabaseAPI
6524
6788
  */
@@ -6628,6 +6892,10 @@ class VoltClient extends EventEmitter__default["default"] {
6628
6892
  return publishCall.start(grpcClient, request);
6629
6893
  }
6630
6894
 
6895
+ SaveWire(request) {
6896
+ return unaryCallInternal.call(this, "SaveWire", request);
6897
+ }
6898
+
6631
6899
  SubscribeWire(request) {
6632
6900
  const grpcClient = this.getVoltAPIClient();
6633
6901
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.20.21",
6
+ "version": "0.20.27",
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.21",
37
- "@tdxvolt/volt-utility": "^0.20.21",
36
+ "@tdxvolt/volt-client-web": "^0.20.27",
37
+ "@tdxvolt/volt-utility": "^0.20.27",
38
38
  "debug": "^4.1.1",
39
39
  "ip": "^1.1.5",
40
40
  "jsonwebtoken": "^8.5.1",
@@ -597,6 +597,10 @@ export class VoltClient extends EventEmitter {
597
597
  return unaryCallInternal.call(this, "CreateDatabase", request);
598
598
  }
599
599
 
600
+ SaveDataView(request) {
601
+ return unaryCallInternal.call(this, "SaveDataView", request);
602
+ }
603
+
600
604
  /**
601
605
  * SqliteDatabaseAPI
602
606
  */
@@ -706,6 +710,10 @@ export class VoltClient extends EventEmitter {
706
710
  return publishCall.start(grpcClient, request);
707
711
  }
708
712
 
713
+ SaveWire(request) {
714
+ return unaryCallInternal.call(this, "SaveWire", request);
715
+ }
716
+
709
717
  SubscribeWire(request) {
710
718
  const grpcClient = this.getVoltAPIClient();
711
719
 
@@ -58,7 +58,10 @@ export class VoltCredential {
58
58
  if (!this._voltPublicKey) {
59
59
  // Extract the public key from the Volt CA cert.
60
60
  const voltCA = new crypto.X509Certificate(this._voltConfig.ca_pem);
61
- this._voltPublicKey = voltCA.publicKey.export({ type: 'spki', format: 'pem' });
61
+ this._voltPublicKey = voltCA.publicKey.export({
62
+ type: "spki",
63
+ format: "pem"
64
+ });
62
65
  }
63
66
 
64
67
  const voltKey = keyFromPem(this._voltPublicKey).publicKey;
@@ -170,7 +173,7 @@ export class VoltCredential {
170
173
  }
171
174
 
172
175
  saveCache() {
173
- this._config = {...this._config, credential: { ...this._cryptoCache } };
176
+ this._config.credential = {...this._cryptoCache};
174
177
  const clone = { ...this._config };
175
178
  if (this._config.p) {
176
179
  // A passphrase option exists => encrypt the key before writing the cache file.
@@ -208,11 +208,14 @@ package tdx.volt_api.data.v1;
208
208
  import "tdx/volt_api/volt/v1/status.proto";
209
209
  import "tdx/volt_api/volt/v1/volt.proto";
210
210
 
211
- // The Sqlite Server API provides database management functions.
212
- // Use the VoltAPI DeleteResource function to delete a database.
211
+ // The Sqlite Server API provides database and view management functions.
212
+ // Use the VoltAPI DeleteResource function to delete a database or data view.
213
213
  service SqliteServerAPI {
214
214
  // Create a new database resource.
215
215
  rpc CreateDatabase(CreateDatabaseRequest) returns (CreateDatabaseResponse);
216
+
217
+ // Create or update a data view resource.
218
+ rpc SaveDataView(SaveDataViewRequest) returns (SaveDataViewResponse);
216
219
  }
217
220
 
218
221
  message CreateDatabaseRequest {
@@ -251,6 +254,55 @@ message CreateDatabaseResponse {
251
254
  tdx.volt_api.volt.v1.Resource resource = 2;
252
255
  }
253
256
 
257
+ message DataViewParameter {
258
+ // The parameter name referenced in the SQL template.
259
+ string name = 1;
260
+
261
+ // The parameter data type.
262
+ tdx.volt_api.volt.v1.AttributeDataType data_type = 2;
263
+
264
+ // Optional default value for the parameter.
265
+ tdx.volt_api.volt.v1.AttributeValue default_value = 3;
266
+
267
+ // Set when default_value should be applied.
268
+ bool include_default_value = 4;
269
+ }
270
+
271
+ message SaveDataViewRequest {
272
+ // Details of the data view to save.
273
+ tdx.volt_api.volt.v1.Resource resource = 1;
274
+
275
+ // Set to indicate this is a new data view.
276
+ bool create = 2;
277
+
278
+ // The id of the folder resource in which a new data view should be created.
279
+ // If omitted, the home folder of the currently authenticated identity will be used.
280
+ string create_in_parent_id = 3;
281
+
282
+ // Set to indicate the resource attributes should be purged before saving the resource.
283
+ bool purge_attributes = 4;
284
+
285
+ // The id of the source database on which this view is based.
286
+ // The authenticated account must have the relevant access to the source database, for example to create a 'SELECT' view the account must have 'volt:database-read' access to the source database. To create an 'INSERT' view the account must have 'volt:database-write' access to the source database.
287
+ string source_database_id = 5;
288
+
289
+ // The SQL template for the view.
290
+ string sql = 6;
291
+
292
+ // Set to allow sub-selects in the view SQL.
293
+ bool allow_sub_select = 7;
294
+
295
+ // Parameters defined for the view SQL template.
296
+ repeated DataViewParameter parameter = 8;
297
+ }
298
+
299
+ message SaveDataViewResponse {
300
+ // Details of any error that occurred on the call.
301
+ tdx.volt_api.volt.v1.Status status = 1;
302
+
303
+ // The saved data view resource.
304
+ tdx.volt_api.volt.v1.Resource resource = 2;
305
+ }
254
306
  `;
255
307
  export const proto_db_sync = `syntax = "proto3";
256
308
 
@@ -1022,6 +1074,13 @@ message ResolveDIDRequest {
1022
1074
 
1023
1075
  // Set to search all known registries rather than just the local registry.
1024
1076
  bool include_registries = 2;
1077
+
1078
+ // Per-DID document version. 0 = latest; 1..N = ordinal in the op log.
1079
+ uint64 version = 3;
1080
+
1081
+ // Milliseconds since epoch. Resolves the document active at that time.
1082
+ // Mutually exclusive with version.
1083
+ uint64 at_timestamp = 4;
1025
1084
  }
1026
1085
 
1027
1086
  message ResolveDIDResponse {
@@ -1160,6 +1219,18 @@ service SyncAPI {
1160
1219
 
1161
1220
  // Write a single value to a given synapse JSON path.
1162
1221
  rpc WriteSynapsePath(WriteSynapsePathRequest) returns (WriteSynapsePathResponse);
1222
+
1223
+ // List stored versions of a document in a sync database.
1224
+ rpc ListSyncDocumentVersions(ListSyncDocumentVersionsRequest) returns (ListSyncDocumentVersionsResponse);
1225
+
1226
+ // Get a stored version of a document in a sync database.
1227
+ rpc GetSyncDocumentVersion(GetSyncDocumentVersionRequest) returns (GetSyncDocumentVersionResponse);
1228
+
1229
+ // Create a version checkpoint for a document in a sync database.
1230
+ rpc CreateSyncDocumentVersion(CreateSyncDocumentVersionRequest) returns (CreateSyncDocumentVersionResponse);
1231
+
1232
+ // Revert a document in a sync database to a stored version.
1233
+ rpc RevertSyncDocumentVersion(RevertSyncDocumentVersionRequest) returns (RevertSyncDocumentVersionResponse);
1163
1234
  }
1164
1235
 
1165
1236
  message CreateSynapseConnectionRequest {
@@ -1273,8 +1344,8 @@ message SaveSyncDatabaseRequest {
1273
1344
  // Set to audit all INSERT, UPDATE, and DELETE database operations.
1274
1345
  bool write_audit = 7;
1275
1346
 
1276
- // By default, yjs updates are periodically compressed and stored as snapshots. Set this flag to disable snapshots. This will reduce the size of the database and improve performance, but will also reduce the ability to rollback to a previous state.
1277
- bool no_snapshots = 8;
1347
+ // By default, yjs updates are periodically compacted. Set this flag to disable compaction. This will reduce the size of the database but will remove the ability to version the documents in the database.
1348
+ bool no_compaction = 8;
1278
1349
 
1279
1350
  // The number of updates to batch before flushing to the database. Defaults to 100.
1280
1351
  uint32 batch_size = 9;
@@ -1311,8 +1382,8 @@ message SaveSynapseRequest {
1311
1382
  // Set to audit all INSERT, UPDATE, and DELETE synapse operations.
1312
1383
  bool write_audit = 7;
1313
1384
 
1314
- // By default, yjs updates are periodically compressed and stored as snapshots. Set this flag to disable snapshots. This will reduce the size of the synapse and improve performance, but will also reduce the ability to rollback to a previous state.
1315
- bool no_snapshots = 8;
1385
+ // By default, yjs updates are periodically compacted. Set this flag to disable compaction. This will reduce the size of the database but will remove the ability to version the documents in the database.
1386
+ bool no_compaction = 8;
1316
1387
  }
1317
1388
 
1318
1389
  message SaveSynapseResponse {
@@ -1349,6 +1420,14 @@ message SetSynapseDocumentMetadataRequest {
1349
1420
 
1350
1421
  // Any additional application-specific JSON to attach to the document.
1351
1422
  string json = 4;
1423
+
1424
+ // Set to true when the caller intends to write the document's content
1425
+ // separately, after this metadata call (a metadata-first create). The sync
1426
+ // server uses this to defer __hash bootstrapping until the content actually
1427
+ // arrives, so the hash is not computed over an empty document. Leave false
1428
+ // (the default) for empty documents or content-first flows where the content
1429
+ // is already present.
1430
+ bool content_pending = 6;
1352
1431
  }
1353
1432
 
1354
1433
  message SetSynapseDocumentMetadataResponse {
@@ -1504,6 +1583,83 @@ message WriteSynapsePathResponse {
1504
1583
  tdx.volt_api.volt.v1.Status status = 1;
1505
1584
  }
1506
1585
 
1586
+ message SyncDocumentVersionSummary {
1587
+ // Globally unique version identifier (UUID).
1588
+ string version_id = 1;
1589
+
1590
+ // Milliseconds since Unix epoch when the version was created.
1591
+ uint64 timestamp = 2;
1592
+
1593
+ // Identity that created the version.
1594
+ string identity = 3;
1595
+
1596
+ // Optional user-provided label.
1597
+ string label = 4;
1598
+
1599
+ // Document hash (__hash) at the time of the version, when available.
1600
+ string document_hash = 5;
1601
+ }
1602
+
1603
+ message ListSyncDocumentVersionsRequest {
1604
+ // The id of the sync database that contains the document.
1605
+ string database_id = 1;
1606
+
1607
+ // The id of the document.
1608
+ string document_id = 2;
1609
+
1610
+ // Maximum number of versions to return. Defaults to 50.
1611
+ uint32 limit = 3;
1612
+
1613
+ // Number of versions to skip from the newest end.
1614
+ uint32 offset = 4;
1615
+ }
1616
+
1617
+ message ListSyncDocumentVersionsResponse {
1618
+ tdx.volt_api.volt.v1.Status status = 1;
1619
+ repeated SyncDocumentVersionSummary versions = 2;
1620
+ }
1621
+
1622
+ message GetSyncDocumentVersionRequest {
1623
+ string database_id = 1;
1624
+ string document_id = 2;
1625
+ string version_id = 3;
1626
+ }
1627
+
1628
+ message GetSyncDocumentVersionResponse {
1629
+ tdx.volt_api.volt.v1.Status status = 1;
1630
+ SyncDocumentVersionSummary info = 2;
1631
+
1632
+ // Full Yjs v2 document state at this version. Clients materialize locally.
1633
+ bytes state_update = 3;
1634
+ }
1635
+
1636
+ message CreateSyncDocumentVersionRequest {
1637
+ string database_id = 1;
1638
+ string document_id = 2;
1639
+ string label = 3;
1640
+ }
1641
+
1642
+ message CreateSyncDocumentVersionResponse {
1643
+ tdx.volt_api.volt.v1.Status status = 1;
1644
+ string version_id = 2;
1645
+ }
1646
+
1647
+ message RevertSyncDocumentVersionRequest {
1648
+ string database_id = 1;
1649
+ string document_id = 2;
1650
+ string version_id = 3;
1651
+
1652
+ // Optional label for the audit version created after revert.
1653
+ string label = 4;
1654
+ }
1655
+
1656
+ message RevertSyncDocumentVersionResponse {
1657
+ tdx.volt_api.volt.v1.Status status = 1;
1658
+
1659
+ // Version id of the audit checkpoint created after revert.
1660
+ string version_id = 2;
1661
+ }
1662
+
1507
1663
  `;
1508
1664
  export const terminal_api = `syntax = "proto3";
1509
1665
 
@@ -1513,6 +1669,7 @@ import "tdx/volt_api/volt/v1/status.proto";
1513
1669
 
1514
1670
  service TerminalAPI {
1515
1671
  // Bidirectional streaming RPC for real-time terminal control and data exchange.
1672
+ // Note that \`volt:command-invoke\` access is required to invoke this API. An optional allow-list of comma-separated commands can be specified in the \`extra\` string of the access policy.
1516
1673
  rpc CommandStream(stream CommandStreamRequest) returns (stream CommandStreamResponse);
1517
1674
  }
1518
1675
 
@@ -2168,7 +2325,18 @@ message Access {
2168
2325
  // Requested access.
2169
2326
  string access = 10;
2170
2327
 
2171
- // Optional extra data.
2328
+ // Optional extra data that further constrains the access being granted. How this string is interpreted depends on the value of \`access\` above:
2329
+ //
2330
+ // - \`volt:api-call\`: a single API method name. The access only applies when the invoked API method matches this value (policy attribute \`volt:action-api-call\`). Leave empty to allow all API methods.
2331
+ //
2332
+ // - \`volt:command-invoke\` (CommandStream API): a comma-separated allow-list of commands. The access is permitted (or denied depending on the rule decision) when the invoked command matches any entry in the list (policy attribute \`volt:action-command\`). A trailing \`*\` acts as a prefix wildcard (e.g. \`/usr/bin/*\` allows any command beginning with \`/usr/bin/\`). Leave empty to allow all commands.
2333
+ // Example: "ls,git,/usr/bin/python3"
2334
+ //
2335
+ // - Otherwise: a comma-separated list of \`[attributeId]|[value]\` pairs, each matched against the named resource attribute (trailing \`*\` acts as a prefix wildcard). The sync-database case below is a specialisation of this general form.
2336
+ //
2337
+ // - Sync databases (\`volt:sync-database\` resources, e.g. with \`volt:database-read\` / \`volt:database-write\` access): a comma-separated list of \`[attributeId]|[value]\` pairs restricting the access to specific documents. Document ids use the \`volt:resource-sync-document-id\` attribute id, so each entry has the form \`volt:resource-sync-document-id|[documentId]\`. A trailing \`*\` on the value acts as a prefix wildcard. Leave empty to target all documents in the database.
2338
+ // Example: "volt:resource-sync-document-id|doc-123,volt:resource-sync-document-id|report-*"
2339
+ //
2172
2340
  string extra = 11;
2173
2341
 
2174
2342
  // Assigned decision.
@@ -2343,8 +2511,9 @@ service VoltAPI {
2343
2511
  rpc DiscoverServices(DiscoverServicesRequest) returns (DiscoverServicesResponse);
2344
2512
 
2345
2513
  // Get access rule details.
2346
- // Only rules in which the authenticated identity participates will be retrieved, in addition to any rules that target a resource that is owned by the authenticated identity.
2347
2514
  // If the authenticated identity is the Volt root, all rules will be retrieved that match the criteria.
2515
+ // All rules for which the authenticated account has volt:api-call / volt:get-access permission to the rule resource will be retrieved.
2516
+ // Otherwise, only rules in which the authenticated identity participates will be retrieved, in addition to any rules that target a resource that is owned by the authenticated identity.
2348
2517
  rpc GetAccess(GetAccessRequest) returns (GetAccessResponse);
2349
2518
 
2350
2519
  // Retrieve identities matching the given criteria.
@@ -2401,8 +2570,14 @@ service VoltAPI {
2401
2570
  rpc SaveHttpFileServer(SaveHttpFileServerRequest) returns (SaveHttpFileServerResponse);
2402
2571
 
2403
2572
  // Create or update an HTTP forwarder resource.
2573
+ // This is a privileged API call and requires volt:api-call / volt:save-http-forwarder permission.
2404
2574
  rpc SaveHttpForwarder(SaveHttpForwarderRequest) returns (SaveHttpForwarderResponse);
2405
2575
 
2576
+ // Create or update an OAuth/OIDC client registration (used when this Volt
2577
+ // acts as an OpenID Provider). Clients are stored as \`volt:oidc-client\`
2578
+ // resources.
2579
+ rpc SaveOidcClient(SaveOidcClientRequest) returns (SaveOidcClientResponse);
2580
+
2406
2581
  // Create or update an HTTP REST API server.
2407
2582
  // This is a privileged API call and requires volt:api-call / volt:save-http-rest-api-server permission.
2408
2583
  rpc SaveHttpRestApiServer(SaveHttpRestApiServerRequest) returns (SaveHttpRestApiServerResponse);
@@ -2554,6 +2729,10 @@ message CanAccessResourceRequest {
2554
2729
 
2555
2730
  // The type of access that is required.
2556
2731
  string access = 4;
2732
+
2733
+ // Optional additional information about the access request.
2734
+ // For volt:api-call, the extra data is the API method lookup, e.g. volt:get-access.
2735
+ string extra = 5;
2557
2736
  }
2558
2737
 
2559
2738
  message CanAccessResourceResponse {
@@ -3389,6 +3568,51 @@ message SaveHttpForwarderRequest {
3389
3568
  string host = 6;
3390
3569
  int32 port = 7;
3391
3570
  bool forward_host = 8;
3571
+
3572
+ // Optional path prefix (e.g. "/myapp") for path-based forwarding. May be used
3573
+ // on its own (path forwarding on the Volt's own host) or together with
3574
+ // \`domain\` (sub-domain + path, e.g. sub.acme.com/myapp). At least one of
3575
+ // \`domain\` or \`path\` must be set.
3576
+ string path = 9;
3577
+
3578
+ // When a \`path\` prefix is configured, controls whether that prefix is removed
3579
+ // from the request path before forwarding (standard reverse-proxy behaviour).
3580
+ // Defaults to true when unset: the target then receives the request at its
3581
+ // own root (e.g. "/drive/assets/x.js" -> "/assets/x.js"), which suits plain
3582
+ // static file servers and root-mounted backends. Set to false for targets
3583
+ // that are themselves configured under the same sub-path and expect to
3584
+ // receive the prefix. The \`X-Forwarded-Prefix\` header is always sent.
3585
+ optional bool strip_path = 10;
3586
+
3587
+ // When true, incoming requests to this forwarder must carry a valid
3588
+ // authenticated session (established via the OIDC sign-in flow) and pass the
3589
+ // policy check before being proxied to the target. Unauthenticated requests
3590
+ // are redirected to the configured OpenID Provider. The session is never
3591
+ // exposed to the target (the session cookie is stripped before forwarding).
3592
+ bool auth_enabled = 11;
3593
+
3594
+ // OpenID Provider issuer URL used for discovery
3595
+ // (\`<issuer>/.well-known/openid-configuration\`). May be a Volt acting as an
3596
+ // OpenID Provider, or any external OIDC provider. Required when
3597
+ // \`auth_enabled\` is set.
3598
+ string oidc_issuer = 12;
3599
+
3600
+ // OAuth 2.0 client identifier registered with the OpenID Provider.
3601
+ string oidc_client_id = 13;
3602
+
3603
+ // OAuth 2.0 client secret. Stored encrypted and redacted on read.
3604
+ string oidc_client_secret = 14;
3605
+
3606
+ // Space separated OAuth scopes. Defaults to "openid email" when empty.
3607
+ string oidc_scopes = 15;
3608
+
3609
+ // Optional override for the reserved callback path on the app host. Defaults
3610
+ // to "/__volt-auth/oidc/callback".
3611
+ string oidc_redirect_path = 16;
3612
+
3613
+ // Email verification mode for OIDC-gated sign-in when the OpenID Provider is
3614
+ // a Volt: "link" (default) or "code".
3615
+ string email_verification_mode = 17;
3392
3616
  }
3393
3617
 
3394
3618
  message SaveHttpForwarderResponse {
@@ -3396,6 +3620,33 @@ message SaveHttpForwarderResponse {
3396
3620
  Resource resource = 2;
3397
3621
  }
3398
3622
 
3623
+ message SaveOidcClientRequest {
3624
+ Resource resource = 1;
3625
+ bool create = 2;
3626
+ string create_in_parent_id = 3;
3627
+ bool purge_attributes = 4;
3628
+
3629
+ // Human-friendly name for the client (also used as resource name when the
3630
+ // resource name is empty).
3631
+ string client_name = 5;
3632
+
3633
+ // OAuth 2.0 client_id. Required.
3634
+ string client_id = 6;
3635
+
3636
+ // OAuth 2.0 client_secret. Stored encrypted and redacted on read. Only
3637
+ // (re)written when non-empty so updates can omit it to keep the existing
3638
+ // secret.
3639
+ string client_secret = 7;
3640
+
3641
+ // Comma- or space-separated list of allowed redirect URIs.
3642
+ string redirect_uris = 8;
3643
+ }
3644
+
3645
+ message SaveOidcClientResponse {
3646
+ tdx.volt_api.volt.v1.Status status = 1;
3647
+ Resource resource = 2;
3648
+ }
3649
+
3399
3650
  message SaveHttpFileServerRequest {
3400
3651
  Resource resource = 1;
3401
3652
  bool create = 2;
@@ -3408,6 +3659,7 @@ message SaveHttpFileServerRequest {
3408
3659
  int32 cache_timeout = 9;
3409
3660
  bool catch_all_enabled = 10;
3410
3661
  string catch_all = 11;
3662
+ bool dynamic_index_enabled = 12;
3411
3663
  }
3412
3664
 
3413
3665
  message SaveHttpFileServerResponse {
@@ -3424,6 +3676,11 @@ message SaveHttpRestApiServerRequest {
3424
3676
  int32 port = 6;
3425
3677
  bool enabled = 7;
3426
3678
  bool cors_enabled = 8;
3679
+ bool is_literal = 9;
3680
+ string literal_json = 10;
3681
+ string database_id = 11;
3682
+ string sql = 12;
3683
+ repeated string parameter = 13;
3427
3684
  }
3428
3685
 
3429
3686
  message SaveHttpRestApiServerResponse {