pub.techne.draft.query.composeRecords
Up to 12 generic reads in one call. Each step is a pub.techne.draft.query.listRecords call (a list step) or a pub.techne.draft.query.getRecords call (a get step) and answers exactly as that method would for the same caller. A step runs once the steps it binds to have answered (at most 4 at once); the answer does not depend on which finished first. A binding, a string `$<step>.<output>` in a list step's `params` or among a get step's `uris`, stands for that output over the earlier step's records, deduplicated in the order first seen (possibly empty). Outputs: `uri`, `author`, `type`, `space`, `subject`, `references`, and `value.<path>` (string values only). A param may mix literals and bindings and stands for their union. A bound param is a list, so the query uses it with `in` on an indexed role; bind indexed outputs (they never hold a comma) rather than free text. A literal param may not start with `$`. A wrong shape refuses the whole call as InvalidRequest: more than 12 steps, a list step's `limit` over 50000, more than 500 literal `uris`, a `limit` or `cursor` on a `return: false` step. Once running, a step fails alone, its error under its name in `errors`: its method refuses it, a binding fills more than 500 `uris` or 2000 values, the steps read in one page answer more than 3000 records in all, a `return: false` step matches more than 50000, or the paged steps (a `limit` over 500, or `return: false`) read more than 50000 in all. Every step bound to a failed step is `Skipped`, naming the root failure; the others answer, and the call is 200. Budget: a signed-in caller has 20000 rows, refilled at 500 a second. A call is charged up front its declared maximum (a list step's `limit`, else its query's limit or 50, 500 for a `queryUri` or paged step; a get step's URIs, 500 if bound; at most 3000) plus 1000 per `count` step, is given back what it did not read, and is charged afterwards, into debt if need be, for what it read beyond that. A call the budget cannot cover now is RateLimitExceeded. Anonymous callers spend a budget per client IP (one shared budget ten times the size when the IP is unknown). `handles` and `curation` on a list step answer as getRecords does. The body must be application/json, else 415 before it is parsed or charged. A procedure only for its body size: nothing is written, and anyone may call it, signed in or not. Draft tier.
Details · procedure
| Kind | procedure |
|---|---|
| Authority | query.draft.techne.pub |
| Commit rev | 3n3iob7u4ow2u |
| Indexed |
Procedure
procedure · POSTInput
application/jsonOutput
application/jsonErrors
InvalidRequest
HTTP 400. A malformed call, before any step runs (naming the step where there is one): no steps or more than 12, a name repeated or not of the pattern, a step that is neither a list step nor a get step or both, a binding to no earlier step or an unknown output, a list step's `limit` over 500, a get step's literal `uris` over 500, a malformed flag, `params`, `fields` or `envelope` (a name not among its known values). Also HTTP 415, under this name, for a body whose content-type is not application/json, refused before it is parsed or charged. What a step's method refuses is that step's error (`errors`), not the call's.
RateLimitExceeded
HTTP 429. A call whose charge (at most 15000) is more than what is left of its caller's row budget now: a signed-in caller's 20000 rows, refilled at 500 rows a second; an anonymous caller's the same per client IP, or, without a known client IP, the one budget all such callers share, ten times that size.
#record
objectOne answered record of a step: pub.techne.draft.query.listRecords#record with only `value` required. `uri` is present unless the step's `uri` is false; every other field is present as listRecords#record has it unless the step's `envelope` left it out; `fields` cuts `value`.
Properties
author
string · didThe DID whose repo holds the record.
cid
string · cidcollection
string · nsidcurated
booleanA public record that is a live curated record: a curator the commons root trusts merged it from its sources, and it is not superseded. Its `pub.techne.draft.provenance` (same author, subject this record) names who it is from. Always answered when the step's `envelope` includes it (or names none): false for every other record.
held
booleanThe caller's own permissioned record that the reach limit holds back from the people it would reach: a withheld act (a share or a circle add), answered to its author alone (to anyone else it is not found) until the limit admits it. Absent otherwise. A query with `held: true` answers only these.
matched
arrayAs listRecords#record has it: with a `location` `in` or `covers` condition, the stated locations that matched, at most 8.
maxLength: 8
measures
unknownThe numbers the query's operators produced for this record, by name (a `near` distance in metres, a `matches` rank).
signals
unknownThe server-side signals the query asked for, by name; a signal with no value for this record is absent.
source
stringWhether the record is public (on the firehose) or permissioned.
knownValues: public | permissioned
space
string · at-uriThe space a permissioned record counts in. Absent for a public record, and for a caller's own record that counts in none.
time
string · datetimeThe record's indexed time (the `written` role).
uri
string · at-uriThe record body.
#step
objectOne read. A list step has `query` or `queryUri` (and may have `params`, `limit`, `cursor`, `count`, `handles`, `curation`), as listRecords takes them; a get step has `uris` (and may have `curated`, `handles`, `curation`, `defaults`, `includeBlockedByMe`), as getRecords takes them. Exactly one of the two.
Properties
count
booleanList step: also count, as listRecords' `count`.
default: false
curated
booleanGet step: as getRecords' `curated`.
curation
booleanAs getRecords' `curation`: in a get step for its URIs, in a list step for the URIs of the records it answered.
cursor
stringList step: the cursor of a previous page of this step, as listRecords' `cursor`. Not allowed on a `return: false` step.
defaults
booleanGet step: as getRecords' `defaults`.
envelope
arrayThe record fields (#record) each answered record keeps besides `uri` (kept unless `uri` is false) and `value` (always kept): any of cid, author, collection, time, space, source, curated, held, measures, signals, matched and nothing else: the list is closed to these known values, and another name refuses the call as InvalidRequest. Without it every field comes back; `[]` keeps only `value` and, unless `uri` is false, `uri`. A field left out is absent, so a flag left out (`curated`, `held`) reads as false. Bindings read every field, before this selection.
maxLength: 11
knownValues: cid | author | collection | time | space | source | curated | held | measures | signals | matched
fields
arrayValue paths (`a`, `a.b`, `a[].b`): each answered record's `value` keeps only these. Bindings read the whole value, before this selection. The record's other fields come back as `envelope` says, and its `uri` as `uri` says.
minLength: 1maxLength: 32
maxLength: 256
handles
booleanAs getRecords' `handles`: in a get step for its URIs, in a list step for the URIs of the records it answered.
includeBlockedByMe
booleanGet step: as getRecords' `includeBlockedByMe`.
limit
integerList step: how many records, as listRecords' `limit`, up to 50000: past 500 (one listRecords page) the server reads listRecords' pages one after another on the same read path and answers them as one, with the `cursor` after the last record answered. Not allowed on a `return: false` step. The steps read past one page read at most 50000 records in all per call; the step whose page crosses that fails (InvalidRequest), and so does any such step that reads a page after it.
minimum: 1maximum: 50000
The step's name, unique in the call: a letter, then up to 31 letters, digits or `_` (^[A-Za-z][A-Za-z0-9_]{0,31}$). The key of its result and the `<step>` of a binding to it.
minLength: 1maxLength: 32
params
unknownList step: the query's parameters, an object of strings or lists of strings, as listRecords' `params` (an object here, not JSON in a string). A string `$<step>.<output>` is a binding and becomes a list; a list may mix literal strings and several bindings, and is their deduplicated union.
query
unknownList step: an inline pub.techne.draft.query object (not JSON in a string, as listRecords takes it). Give this or `queryUri`.
queryUri
string · at-uriList step: a published pub.techne.draft.query record to run. Give this or `query`.
return
booleanFalse: the step's records only feed later bindings and are not in the output. A list step asked `return: false` is read in full on the server (every record its query matches for the caller, page after page on listRecords' read path), so a later step binds to all of it; it takes no `limit` or `cursor`, and a query that matches more than 50000 records fails the step (InvalidRequest naming the step and the ceiling), never answered in part.
default: true
uri
booleanFalse: each answered record comes back without its `uri`, for a step whose records nobody reads by URI. Bindings read it, before this cut: `$<step>.uri` stands for the step's records' URIs either way. A get step's `resolved`, `curation` and `defaults` still name records by URI, so with `uri: false` they cannot be matched to the records answered.
default: true
uris
arrayGet step: the URIs to read, as getRecords' `uris`; each entry an AT-URI or a binding, which is replaced by its list. At most 500 after binding.
minLength: 1maxLength: 500
#stepError
objectWhy a step has no result: what its method refused (as that method would answer it), `Skipped` (424) for a step that binds to a failed one (it may already have run; its answer is dropped), or InvalidRequest (400) for a step past a call limit: its bindings fill a get step's `uris` past 500 or a bound list past 2000 values, or its records would take the call past 3000 answered across the steps read in one page, counted in step order, or it is a list step asked `return: false` whose query matches more than 50000 records, or a page it read took the records read by the call's steps read past one page past 50000; or InternalError (500) for a step read past one page whose pages stop advancing (a cursor that comes back twice).
Properties
The error name the step's method would answer (InvalidRequest, NotFound, ViewRequired and NotCurated for a list step, ...); InvalidRequest for a step past a call limit (#stepError); or `Skipped`: a step it binds to failed.
What went wrong, naming the step; for `Skipped`, `step <name>: skipped because <failed step> failed`, naming the step that failed itself (the root of the chain).
The HTTP status the step's method would answer alone; 400 for a step past a call limit (a get step's bound `uris` past 500, a bound list past 2000 values, the one-page steps' records past 3000, a `return: false` step matching past 50000, the call's paged reads past 50000); 424 for `Skipped`.
#stepResult
objectWhat the step's method answered: a list step's fields are listRecords' output, a get step's are getRecords' output.
Properties
capped
booleanList step, asked with `count`: as listRecords' `capped`.
count
integerList step, asked with `count`: as listRecords' `count`.
curation
arrayAsked with `curation`: as getRecords' `curation`.
cursor
stringList step: as listRecords' `cursor`.
defaults
arrayGet step, asked with `defaults`: as getRecords' `defaults`.
handles
arrayAsked with `handles`: as getRecords' `handles`.
List step: as listRecords' `notServedHere` (an empty list with it set means "not served here", not "nothing there").
As the step's method answers them, as #record: `value` always, `uri` unless the step's `uri` is false, every other record field unless the step's `envelope` left it out, and `value` cut to `fields` when given.
resolved
arrayGet step, asked with `curated`: as getRecords' `resolved`.
withheld
arrayGet step: as getRecords' `withheld`.
Similar lexicons
semantic matchLexicons whose schemas describe something close to this one. Check them before publishing a new one that overlaps.
-
The platform's generic list query: one page of the records a pub.techne.draft.query names, in its order. Every record is read through the platform's one read path, whatever the query says: no record of a hidden or suspended account is answered, nor, to a signed-in caller, another's record across a block either way (the caller blocked its author, or its author blocked the caller); a public record also leaves out anything moderation holds back (a trusted verdict or `!takedown`); a permissioned rec
-
pub.techne.draft.query
recordA query over indexed records, as data: sent inline to pub.techne.draft.query.listRecords or countRecords, or published as a record in an app's own repo and run by its URI, so what an app reads is public. The platform runs it only over what the caller may read: every query is scoped to the viewer by the platform (public records not hidden; permissioned records the caller's own, or in a space whose read policy admits the caller now and not an act the reach limit withholds for its author: a held sh
-
How many records a pub.techne.draft.query names: the records listRecords would answer for it (the same read path, the platform's `decide` on every record answered as written or permissioned, and a curated `location` `in`/`covers` match settled again over the locations the curated view trusts), each once, so the count is what paging the list to its end would answer. The count stops at 1000 (`capped`). The query's `order`, `limit` and `signals` are ignored, so a record without the role a list is o
-
Records by URI, as listRecords answers them: the query `{"view": "asWritten", "where": {"uri": {"in": uris}}}`, as written (a read scoped to named records), each only if the caller may read it. A URI the caller may not read, or that names nothing, is left out: as in every generic read, that includes a record whose author is blocked either way with a signed-in caller (see `includeBlockedByMe`), or whose account is hidden or suspended. In the order asked. With `curated`, each URI answers as the cu