@dashevo/dapi-grpc 4.2.0-dev.8 → 4.2.0-dev.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "4.2.0-dev.8",
3
+ "version": "4.2.0-dev.9",
4
4
  "description": "DAPI GRPC definition file and generated clients",
5
5
  "browser": "browser.js",
6
6
  "main": "node.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/dashevo/dapi-grpc#readme",
47
47
  "dependencies": {
48
- "@dashevo/grpc-common": "4.2.0-dev.8",
48
+ "@dashevo/grpc-common": "4.2.0-dev.9",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "^1.14.3",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -1253,6 +1253,86 @@ message GetDocumentsRequest {
1253
1253
  string outer_document_type = 2;
1254
1254
  }
1255
1255
  ChainedJoin chained = 13;
1256
+
1257
+ // Composite mode — a page plus sub-queries DERIVED from its
1258
+ // results, answered as ONE merged proof over one state root.
1259
+ //
1260
+ // Presence of any `sub_queries` selects composite mode: this
1261
+ // request's own `data_contract_id` / `document_type` /
1262
+ // `where_clauses` / `order_by` / `limit` describe the PAGE, and
1263
+ // every sub-query's `IN` clause is derived by the node from the
1264
+ // page's (or an earlier sub-query's) proven documents. The
1265
+ // verifier re-derives every sub-query from the proven page with
1266
+ // the same builders, re-merges, and verifies the whole
1267
+ // composition — so the composition cannot be steered by the
1268
+ // responding node, and a node that predates this field (proto3
1269
+ // unknown field) serves a page-only proof that FAILS CLOSED
1270
+ // client-side.
1271
+ //
1272
+ // Mode gates (rejected otherwise): `limit` is REQUIRED on the
1273
+ // page (at most 100 — it bounds every derived clause); `selects`
1274
+ // must be empty or a single DOCUMENTS projection; `group_by`,
1275
+ // `having`, time-range clauses, cursors and `offset` are
1276
+ // rejected (paginate with a range clause on the page's ordering
1277
+ // property); `chained` and `sub_queries` are mutually exclusive.
1278
+ // See `SubQuery` for the per-sub-query rules.
1279
+ message SubQuery {
1280
+ // The contract this sub-query targets. Empty = the page's own
1281
+ // contract; otherwise any contract (profiles keyed by owner,
1282
+ // names keyed by identity).
1283
+ bytes data_contract_id = 1;
1284
+ string document_type = 2;
1285
+ // The FIXED clauses — everything but the derived `IN`, which
1286
+ // must not be named here.
1287
+ repeated WhereClause where_clauses = 3;
1288
+ // Ordering (documents only). Every component of the merged proof
1289
+ // walks in the page's direction: a bound field missing from here
1290
+ // is appended in that direction by the node and the verifier
1291
+ // alike, and an ordering that disagrees with the page's direction
1292
+ // is refused (turning a limited lookup around would change the
1293
+ // rows it returns).
1294
+ repeated OrderClause order_by = 4;
1295
+ // Documents lookups on a non-unique index REQUIRE a limit: it
1296
+ // caps the rows the lookup returns in total, in walk order, like
1297
+ // an ordinary IN query's limit (at most 100). Lookups already
1298
+ // bounded by their values (a unique index, or an indexOnly
1299
+ // terminal with every prefix fixed), by-id joins (completeness is
1300
+ // set equality) and counts take none.
1301
+ optional uint32 limit = 5;
1302
+ enum Kind {
1303
+ // The matching documents.
1304
+ DOCUMENTS = 0;
1305
+ // One count per derived value from the `countable` index
1306
+ // covering the fixed clauses plus the bound field. Must be
1307
+ // bound, and must not share its index path with a documents
1308
+ // component (the count reads the value trees the documents
1309
+ // query descends past).
1310
+ COUNT = 1;
1311
+ }
1312
+ Kind kind = 6;
1313
+ // The derived clause `<field> IN <values>`. Absent = a SIBLING:
1314
+ // an independent documents query proven under the same root.
1315
+ message Binding {
1316
+ // Whose proven documents supply the values: `0` = the page,
1317
+ // `n` = `sub_queries[n - 1]` (which must precede this one and
1318
+ // be a DOCUMENTS sub-query).
1319
+ uint32 source = 1;
1320
+ // The source property read off each document: `$id`,
1321
+ // `$ownerId`, or an identifier-typed property (dotted paths
1322
+ // reach nested properties). Documents without it contribute
1323
+ // nothing.
1324
+ string source_property = 2;
1325
+ // The sub-query field receiving the `IN` clause. `$id` makes
1326
+ // this a by-id JOIN: the source property must then declare
1327
+ // `refersTo: permanentDocument` targeting this document type,
1328
+ // so every derived id resolves and a missing document is an
1329
+ // invalid proof. Otherwise `$ownerId` or an indexed property
1330
+ // (a LOOKUP, where absence is a proven fact).
1331
+ string field = 3;
1332
+ }
1333
+ Binding bind = 7;
1334
+ }
1335
+ repeated SubQuery sub_queries = 14;
1256
1336
  }
1257
1337
 
1258
1338
  oneof version {
@@ -1605,6 +1685,10 @@ message GetDocumentsResponse {
1605
1685
  // among the inner projections, deduplicated). Routed when
1606
1686
  // the request's `chained` message is present.
1607
1687
  ChainedDocuments chained = 6;
1688
+ // Composite-mode result: the page plus one result per
1689
+ // sub-query, in request order. Routed when the request
1690
+ // carries `sub_queries`.
1691
+ CompositeDocuments composite = 7;
1608
1692
  }
1609
1693
  }
1610
1694
 
@@ -1615,6 +1699,25 @@ message GetDocumentsResponse {
1615
1699
  repeated bytes outer_documents = 2;
1616
1700
  }
1617
1701
 
1702
+ // A composite query's page and per-sub-query results, documents
1703
+ // serialized with their own document type.
1704
+ message CompositeDocuments {
1705
+ // The page, exactly as the page query alone would return it.
1706
+ repeated bytes page_documents = 1;
1707
+ message SubQueryResult {
1708
+ oneof result {
1709
+ // DOCUMENTS: a by-id join in first-appearance order of the
1710
+ // derived ids; a lookup or sibling in query order.
1711
+ Documents documents = 1;
1712
+ // COUNT: one entry per derived value that has a count tree
1713
+ // (a value with no entry counts zero), keyed by the
1714
+ // value's index-key bytes.
1715
+ CountEntries counts = 2;
1716
+ }
1717
+ }
1718
+ repeated SubQueryResult sub_results = 2;
1719
+ }
1720
+
1618
1721
  oneof result {
1619
1722
  ResultData data = 1;
1620
1723
  Proof proof = 2;