@lotics/cli 0.321.62 → 0.321.64
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/src/cli.js +6 -6
- package/docs/design.md +2 -2
- package/docs/workflows.md +22 -15
- package/package.json +1 -1
package/docs/design.md
CHANGED
|
@@ -128,7 +128,7 @@ or its entity is read-only (`edit: false`); a stepped status is not, since Acts
|
|
|
128
128
|
- `create` (boolean | list of alias (at least one)): The fields an add asks
|
|
129
129
|
- `columns` (list of (alias | Edit column)): Fields read after the row's title, each drawn though no row holds it
|
|
130
130
|
- `label` (text): The register's name in the app's lists and tab strip
|
|
131
|
-
- `filters` (list of (alias | Tiered filter | Listed filter) (at most
|
|
131
|
+
- `filters` (list of (alias | Tiered filter | Listed filter) (at most 8)): Fields the reader narrows by every day, beside the stage chips, at most 3
|
|
132
132
|
- `children` (list of (Tab | Reading | Export | Act | List) (at least one)): Its Tabs, band Readings, Exports and Acts over ticked rows or every row in view
|
|
133
133
|
- `key` (alias): Names the List among its siblings and in a Query's `list`
|
|
134
134
|
- `sort` (Sort key | list of Sort key (at least one)): The rows' order
|
|
@@ -422,7 +422,7 @@ matter; or tasks, where only how many are done counts (`records.task`). A pipeli
|
|
|
422
422
|
`records.status.stages` — its `owner` (a member field, a link's member field, or `{ "group": <id> }`, a member group) and its target
|
|
423
423
|
`within` days — and the server holds it: only the owner's Acts move the row on, and a row created at a stage past the first is a move into that stage from nothing, which the stage's owner, an unowned stage's writer or a workspace admin (loading history) may make, on every path a row is written by, and a level an amount skips stands
|
|
424
424
|
named with why. A move forward passes each owned stage between that binds the row, each its owner's. A stage's `when`
|
|
425
|
-
names the rows it binds, held as an Act's `when` holds them on the row's own fields, as the row stood before a write
|
|
425
|
+
names the rows it binds, held as an Act's `when` holds them on the row's own fields (a total a rollup sums or a yes/no a formula yields among them), as the row stood before a write
|
|
426
426
|
and as the write leaves it; with none, it binds every row. Expense claims over a limit wait for the finance group while
|
|
427
427
|
smaller ones go straight to payment: `"finance_review": { "owner": { "group": <id> }, "when": { "amount": { "gt": 5000000 } } }`.
|
|
428
428
|
A row at a stage leaves it by its owner whatever its `when`; `dropped` names the closed options
|
package/docs/workflows.md
CHANGED
|
@@ -239,11 +239,13 @@ prefix `! -`.
|
|
|
239
239
|
- Destructuring — `const { status, name } = record;` binds each name. Renames
|
|
240
240
|
(`{ status: s }`), quoted keys (`{ "ref": ref }`), array patterns with holes
|
|
241
241
|
(`const [first, , third] = xs;`) and defaults (`{ note = "" }`, which apply on null too) work on
|
|
242
|
-
`const`, `let
|
|
242
|
+
`const`, `let`, `for (const { id } of rows)` and a `const` inside a block. A tool result destructures directly:
|
|
243
243
|
`const { records } = await query_records({...});`. `const a = 1, b = 2;` declares both. Nested
|
|
244
244
|
patterns and rest are refused.
|
|
245
|
-
- Spread — `[...a, b]` and `{ ...a, b: 1 }` (later keys win), in a tool input's values too (`records: [{ a: 1, ...extra }]`)
|
|
246
|
-
|
|
245
|
+
- Spread — `[...a, b]` and `{ ...a, b: 1 }` (later keys win), in a tool input's values too (`records: [{ a: 1, ...extra }]`).
|
|
246
|
+
At the top of a tool input each input is named, so a spread there reads a `const` bound to an object written in the
|
|
247
|
+
body (`const common = { table_id: "orders" }; await update_records({ ...common, set: { ... } });`); any other spread
|
|
248
|
+
there is refused.
|
|
247
249
|
- Shorthand — `{ table_id }` is `{ table_id: table_id }`.
|
|
248
250
|
- `xs.push(a, b);` appends, also on a key (`o.items.push(v)`); `o.a.b = v;` sets a nested key;
|
|
249
251
|
`x ??= v`, `x ||= v` and `x &&= v` assign. A `const` may be pushed to or have a key set, as in
|
|
@@ -255,11 +257,16 @@ prefix `! -`.
|
|
|
255
257
|
object's own keys, or a list's indexes and `length`.
|
|
256
258
|
- A filter node may leave out `node_type` when its keys say which it is: `field_key` / `operator` /
|
|
257
259
|
`value` a condition, `logic` / `children` a group, `path` / `condition` a traversal.
|
|
258
|
-
- `function name(p = <default>) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
- `function name(p = <default>) { ... }` or `const name = (p = <default>) => ...` — top level only, expanded at
|
|
261
|
+
every call (a call may come before a `function`; a `const` is declared above the statement that first calls it).
|
|
262
|
+
A parameter takes its type from a default or an annotation (`p: number`). The body is an expression, or a block of
|
|
263
|
+
`const`, `if`/`else` and `return`, reading only its parameters, helpers and the reserved roots — never the caller's
|
|
264
|
+
names, nor `index`. A parameter and a block's `const` are written out where they are read: a value read on no path
|
|
265
|
+
is not computed, a `const` nothing reads is refused, and a value from `now()` or a random helper is read once
|
|
266
|
+
(bind it in a `const` before the call to read it more). No recursion; a function never called is refused. A body
|
|
267
|
+
read back shows the expression at each call, not the function.
|
|
268
|
+
- `(() => { ... })()` — an arrow called where it is written, with no parameters: its block is expanded in place the
|
|
269
|
+
same way, and reads the names in scope there.
|
|
263
270
|
|
|
264
271
|
**try / catch.** `try { ... } catch (e) { ... }` catches a tool error or an expression error inside the
|
|
265
272
|
body; `e` is `{ message, type, step_id?, detail? }`. A failed `validate` and a `return` are not
|
|
@@ -279,10 +286,10 @@ the same block is refused; shadowing in a nested block is allowed. A `let` keeps
|
|
|
279
286
|
(unbounded matching: use the string methods), `Math.random`, `Date.now()` and `new Date()` (use `now()` and
|
|
280
287
|
`parseDate`), a tool or helper as a value or a computed callee (callees are named), `new` of anything,
|
|
281
288
|
`instanceof`, `delete`, `void`, rest elements, computed keys, classes, `throw`, `finally`, `import`,
|
|
282
|
-
`export`, `eval`, labels, and a function as a value
|
|
289
|
+
`export`, `eval`, labels, and a function as a value anywhere but a top-level `const` (pass the arrow to the helper
|
|
283
290
|
that takes it). `xs.sort(...)` on a name or path is refused too, since a value is never changed in place:
|
|
284
|
-
write `xs.toSorted(...)` or `[...xs].sort(...)`. Inside a
|
|
285
|
-
|
|
291
|
+
write `xs.toSorted(...)` or `[...xs].sort(...)`. Inside a block a loop, `let` and a reassignment are refused: use a
|
|
292
|
+
helper, or compute the value before the callback.
|
|
286
293
|
|
|
287
294
|
## Typing
|
|
288
295
|
|
|
@@ -373,10 +380,10 @@ const rows = orders.records.map((o) => {
|
|
|
373
380
|
return({ status: "success", message: text(rows.length) });
|
|
374
381
|
```
|
|
375
382
|
|
|
376
|
-
A block's `const` behaves as a top-level `const` does
|
|
377
|
-
|
|
378
|
-
compute the value before the callback. A declared
|
|
379
|
-
|
|
383
|
+
A block's `const` behaves as a top-level `const` does, and destructures as one (`const { qty, price } = o.data;`).
|
|
384
|
+
Inside a block a loop, `let`, a reassignment, `switch` and `try` are refused: use a helper (`map`, `filter`, `find`,
|
|
385
|
+
`reduce`) or compute the value before the callback. A declared function and an arrow called where it is written take
|
|
386
|
+
the same block; a table check takes none. `async` and named function expressions are refused.
|
|
380
387
|
|
|
381
388
|
Look a row up by key rather than filtering for it: a `filter` inside a callback walks its whole list again
|
|
382
389
|
for every item, so a thousand items against a few hundred rows is hundreds of thousands of calls. Group the
|