@protobase/cli 0.98.1 → 0.98.2
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/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.2",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.98.
|
|
47
|
-
"@protobase/layout": "0.98.
|
|
48
|
-
"@protobase/query": "0.98.
|
|
49
|
-
"@protobase/schema": "0.98.
|
|
50
|
-
"@protobase/server": "0.98.
|
|
51
|
-
"@protobase/ui": "0.98.
|
|
52
|
-
"@protobase/workflows": "0.98.
|
|
46
|
+
"@protobase/config": "0.98.2",
|
|
47
|
+
"@protobase/layout": "0.98.2",
|
|
48
|
+
"@protobase/query": "0.98.2",
|
|
49
|
+
"@protobase/schema": "0.98.2",
|
|
50
|
+
"@protobase/server": "0.98.2",
|
|
51
|
+
"@protobase/ui": "0.98.2",
|
|
52
|
+
"@protobase/workflows": "0.98.2",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -8,7 +8,7 @@ The API every resource gets, with filters, writes, errors and the typed client.
|
|
|
8
8
|
- [OpenAPI and reference](../reference/api.md#meta-and-openapi-per-caller): An OpenAPI 3.1 document and an API reference page, each showing only what the caller may see and do.
|
|
9
9
|
- [Filters](../reference/api.md#filters): AIP-160 filters and ordering, with word search across a resource's search fields, lists of values and relative dates.
|
|
10
10
|
- [Lists under a record](../reference/api.md#lists-under-a-record): `/objectives/40/tasks` lists what belongs to one record, by a relation or a declared link, after reading that record as the caller would.
|
|
11
|
-
- [Filtering through related records](../reference/api.md#filtering-through-related-records): A list asks for the records that belong to another with a subfilter, such as an objective's tasks, in one read under the caller's access, instead of sending a list of keys.
|
|
11
|
+
- [Filtering through related records](../reference/api.md#filtering-through-related-records): A list asks for the records that belong to another with a subfilter, such as an objective's tasks, in one read under the caller's access, instead of sending a list of keys. The filter can keep to one page of those records, with their sort, limit and page token, and follow a JSON list of keys they hold.
|
|
12
12
|
- [Counts, facets and charts](../reference/api.md#routes): Endpoints for value counts, grouped sums and averages, records over time, histograms and paging to any row.
|
|
13
13
|
- [Map queries](../reference/api.md#maps): The records inside a map's view, or counts per area when there are many.
|
|
14
14
|
- [Related names and photos](../reference/api.md#related-names): A list response can carry the names of related records and each record's first photos.
|
|
@@ -144,7 +144,7 @@ The queue is an `AuditQueue`, `{ publish(event): Promise<void> }`, the default e
|
|
|
144
144
|
|
|
145
145
|
## Filters
|
|
146
146
|
|
|
147
|
-
`filter` and `order_by` are AIP-160 and AIP-132 text, checked against the model (filterable and sortable fields only). Functions: `in(field, v, ...)`, `search("text")` and bare words (every word, ignoring case, anywhere inside one of the resource's search fields, so `port` finds "Portfolio"; `%`, `_` and `\` are literal; a [`digitsEnd`](data-config.md#resource) field matches only the end of its digits), `similar(field, "text")`, `regex(field, "pattern")`, `isNull(field)`, `now()` with offsets such as `now() - 7d`, and [`related(field, resource.key, (filter))`](#filtering-through-related-records). A filter is capped at 10,000 characters in a query string and 200,000 in a `:search` body. A proxy in front of the API can refuse a long URL sooner with a `431`, counting the headers too: Protobase Cloud refused about 8,000 characters. So send a long filter to `:search`, as `client.list` does when its query string passes 4,000 characters.
|
|
147
|
+
`filter` and `order_by` are AIP-160 and AIP-132 text, checked against the model (filterable and sortable fields only). Functions: `in(field, v, ...)`, `search("text")` and bare words (every word, ignoring case, anywhere inside one of the resource's search fields, so `port` finds "Portfolio"; `%`, `_` and `\` are literal; a [`digitsEnd`](data-config.md#resource) field matches only the end of its digits), `similar(field, "text")`, `regex(field, "pattern")`, `isNull(field)`, `now()` with offsets such as `now() - 7d`, and [`related(field, resource.key, (filter), "order_by", limit, "page_token")`](#filtering-through-related-records). A filter is capped at 10,000 characters in a query string and 200,000 in a `:search` body. A proxy in front of the API can refuse a long URL sooner with a `431`, counting the headers too: Protobase Cloud refused about 8,000 characters. So send a long filter to `:search`, as `client.list` does when its query string passes 4,000 characters.
|
|
148
148
|
|
|
149
149
|
### Filtering through related records
|
|
150
150
|
|
|
@@ -158,13 +158,25 @@ preconditions related(task_id, tasks.id, (state != "done" AND related(id, object
|
|
|
158
158
|
|
|
159
159
|
It works in the `filter` of a list, `:search`, `:seek`, `:facets`, `:aggregate`, `:series`, `:histogram` and `:map`, in `/api/v1` and in MCP's `list_records` and `count_records`, and `where.related('task_id', 'objective_tasks', 'task_id', where.eq('objective_id', 40))` builds it in code.
|
|
160
160
|
|
|
161
|
-
- `field` is a filterable field of the resource read, and `key` one of `resource`. Both point at one resource: each is a relation to it, or its own single key. A null `field` does not match.
|
|
161
|
+
- `field` is a filterable field of the resource read, and `key` one of `resource`. Both point at one resource: each is a relation to it, or its own single key, or `key` is a JSON list of its keys. A null `field` does not match.
|
|
162
162
|
- It is a term ANDed at the top of the filter or of a subfilter. `NOT` and `OR` refuse it, as does anything else that takes a filter: access rules, role filters, a view's opening filter, events, subscriptions, workflow conditions and page conditions.
|
|
163
163
|
- A filter holds at most 3 terms, those in subfilters included, and nests at most 2 levels.
|
|
164
164
|
- It may do only what the caller could do in two steps, listing `resource` with the subfilter and then filtering with `in(field, ...)`: the [access](access.md#related-records-in-filters) rules apply to both sides, and a resource the caller cannot list answers as one that does not exist.
|
|
165
|
-
- The [scan guard](#safety) judges both tables. Besides `field` and the subfilter's columns, `key` needs a btree index under what the subfilter pins
|
|
165
|
+
- The [scan guard](#safety) judges both tables. Besides `field` and the subfilter's columns, `key` needs a btree index under what the subfilter pins, unless it is a JSON list, and the first field of `order_by` needs one as in a list of `resource`.
|
|
166
166
|
- A [list across organizations](access.md#lists-across-organizations) with a term reads the session's own organization alone, and so does the term.
|
|
167
167
|
|
|
168
|
+
After the subfilter it can take the `order_by`, `limit` and `page_token` of a list of `resource`, each needing the one before it, so a child read keeps to the children of exactly the records one page of that list shows:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
task_claims related(task_id, tasks.id, (state != "done"), "created_at desc", 20)
|
|
172
|
+
task_claims related(task_id, tasks.id, (state != "done"), "created_at desc", 20, "<next_page_token>")
|
|
173
|
+
tasks related(id, tasks.waits, (state != "done"), "created_at desc", 20)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- `order_by` is the list's AIP-132 text, `""` for its default order; `limit` is its `page_size`, a whole number from 1, capped at 500 as a page is; `page_token` is a `next_page_token` of the list of `resource` with the same subfilter and order, and with any other it is a `400` `invalid-cursor`. The subfilter is optional here too: `related(task_id, tasks.id, "created_at desc", 20)`.
|
|
177
|
+
- `where.related(..., filter, { orderBy: 'created_at desc', limit: 20, pageToken })` builds it in code.
|
|
178
|
+
- A JSON `key`, such as a task's `waits`, lists keys of the resource `field` points at: a record matches when its `field` is in the list of any record the term reads. A null, empty or non-list value adds no keys, and neither does an item that is no valid key, such as `"x"` among integer keys. It needs Postgres 16 or later, which tells a valid key from one that is not (`pg_input_is_valid`).
|
|
179
|
+
|
|
168
180
|
### Lists under a record
|
|
169
181
|
|
|
170
182
|
`GET /{parent}/{key}/{resource}` is the list of `resource` that belongs to one record, with the same parameters as its own list: `/objectives/40/tasks?filter=state != "done"`. The other list methods work too: `/objectives/40/tasks:facets`, `POST /objectives/40/tasks:search` and the rest. It is a filter the path spells out, and a record keeps its one address, `/tasks/7`.
|
|
@@ -139,7 +139,7 @@ A record's related records repeat under it as a list: a `ReferenceManyField` hol
|
|
|
139
139
|
|
|
140
140
|
Each entry is a record of the stack while its children draw, so `Field`, `Show`, `{{path}}` placeholders and nested lists inside it read it, and `@index`, `@first` and `@last` count its place in the list. A text item of an `ArrayField`, such as a label, is read as `this`; an object item by its keys, which no model describes, so the build does not check them, and it warns when an item's key could shadow a field of a record further out. A list ties itself to the record around it by a field of that record: `source`, `id` of the nearest record by default. `filter` and `sort` take AIP-160 and AIP-132 text, or the objects react-admin writes: `{ status: 'open' }` is `status = "open"`, its fields ANDed, and `{ field: 'claimed_at', order: 'DESC' }` is `claimed_at desc`. Without `sort`, a list is in its key's order, descending, as react-admin's is. `pagination="more"` adds a button that reads the next `perPage` records into the same list. The [blocks reference](blocks.md#related-records) lists every prop.
|
|
141
141
|
|
|
142
|
-
<gap>A list block cannot read its records at page load, beside the records around it, because planning a page's reads is not implemented; each reads once the record around it has drawn.</gap>
|
|
142
|
+
<gap>A list block cannot read its records at page load, beside the records around it, because planning a page's reads is not implemented; each reads once the record around it has drawn.</gap>
|
|
143
143
|
|
|
144
144
|
## Field values
|
|
145
145
|
|