@lotics/cli 0.321.58 → 0.321.60
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 +3 -3
- package/docs/workflow_steps.md +1 -1
- package/docs/workflows.md +32 -10
- package/package.json +1 -1
package/docs/workflow_steps.md
CHANGED
|
@@ -3909,7 +3909,7 @@ above. A provider's refusal carries the provider's own words.
|
|
|
3909
3909
|
### send_notification (workflow step)
|
|
3910
3910
|
|
|
3911
3911
|
- Notify workspace members.
|
|
3912
|
-
-
|
|
3912
|
+
- Each recipient sees it in their Lotics inbox; it is also mailed to a recipient who has chosen email for their notifications, and to no other.
|
|
3913
3913
|
- A member is named by the member_id get_workspace kind member lists. (chat, MCP, CLI)
|
|
3914
3914
|
- In a workflow body, every member is { type: "organization", id: runtime.organization_id } and the member who started the run { type: "member", id: runtime.triggered_by_member_id }; a run a schedule, a webhook or an email starts was started by no member; the card and its email name the member who started the run. blocks draw under the message: text, stat, chart, fields, link, and record (table_id and record_id; the card shows the record's own title, read as the sender can read it). actions are buttons: each runs workflow_id under its owner's access when pressed, and its owner or an admin may name it.
|
|
3915
3915
|
- A workflow a card can run declares notification inputs. inputs are the values the sender fixes; asks are the values the presser answers, each ask key an input of the workflow that inputs does not fix; every required input of the workflow is fixed or asked as required. decision is "any" (one decision for all recipients: the first press decides it) or "each" (every recipient decides alone); it is required with actions and refused without.
|
package/docs/workflows.md
CHANGED
|
@@ -96,9 +96,10 @@ caller can use. The app's owner must be able to use that connection, so a
|
|
|
96
96
|
save, and one read from an input, a record or a call is refused. A template may come from data; a run refuses one its
|
|
97
97
|
owner cannot use.
|
|
98
98
|
|
|
99
|
-
In a workflow,
|
|
100
|
-
|
|
101
|
-
`kind: "member"` lists them), member groups or the whole organization. Mail
|
|
99
|
+
In a workflow, the step `send_notification` reaches a member of the workspace: the member sees it in their Lotics
|
|
100
|
+
inbox, and it is mailed only to a member who has chosen email for their notifications. Its recipients are members by
|
|
101
|
+
`member_id` (`get_workspace` with `kind: "member"` lists them), member groups or the whole organization. Mail that
|
|
102
|
+
must arrive, to a member or anyone else, goes from a
|
|
102
103
|
connected Gmail or Outlook (`gmail_send_email`, `outlook_send_email`), which leaves an unsent draft unless `draft` is
|
|
103
104
|
`false`.
|
|
104
105
|
|
|
@@ -210,8 +211,12 @@ A body names a table or document template by its alias (`query_records({ table_i
|
|
|
210
211
|
- A record reads in its declared shape wherever it comes from — the trigger, a tool result, a `let`, a
|
|
211
212
|
callback parameter: a single select as its option alias or null, a member as its id, a link as its ids. A property read
|
|
212
213
|
by alias (`x.order.quantity`, `xs[0]["quantity"]`, `y.quantity`) also names the record's field when the record is held in an
|
|
213
|
-
object, a list or a spread (`{ order: record }`, `[record]`, `{ ...record }`)
|
|
214
|
-
|
|
214
|
+
object, a list or a spread (`{ order: record }`, `[record]`, `{ ...record }`). A field is named by alias wherever the
|
|
215
|
+
row's table is known: also through `map`, `push`, a conditional or `??`, where a row's data is held on its own
|
|
216
|
+
(`{ item: row.data }`, read `p.item.state`), and where it is destructured (`const { state } = p.item.data`). It is not
|
|
217
|
+
known for rows of two tables, for rows of a call whose `table_id` is not written out, for `linked()` over a link read off
|
|
218
|
+
such a held row (read the link while the row is in hand), and a helper's field-path text reads the rows of a records
|
|
219
|
+
tool and a loop over them only (over rows held in objects, pass a callback). (The record tools called outside a workflow return the stored arrays instead.)
|
|
215
220
|
- `linked(record["link"])[n]["x"]` fetches the n-th linked row and reads a field of it; bare
|
|
216
221
|
`linked(record["link"])` is every linked row, one fetch per row. Its argument is a path ending on
|
|
217
222
|
a link field and carries the guard: `linked(record?.["link"])[0]`.
|
|
@@ -237,8 +242,8 @@ prefix `! -`.
|
|
|
237
242
|
`const`, `let` and `for (const { id } of rows)`. A tool result destructures directly:
|
|
238
243
|
`const { records } = await query_records({...});`. `const a = 1, b = 2;` declares both. Nested
|
|
239
244
|
patterns and rest are refused.
|
|
240
|
-
- Spread — `[...a, b]` and `{ ...a, b: 1 }` (later keys win)
|
|
241
|
-
|
|
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 is refused.
|
|
242
247
|
- Shorthand — `{ table_id }` is `{ table_id: table_id }`.
|
|
243
248
|
- `xs.push(a, b);` appends, also on a key (`o.items.push(v)`); `o.a.b = v;` sets a nested key;
|
|
244
249
|
`x ??= v`, `x ||= v` and `x &&= v` assign. A `const` may be pushed to or have a key set, as in
|
|
@@ -276,7 +281,8 @@ the same block is refused; shadowing in a nested block is allowed. A `let` keeps
|
|
|
276
281
|
`instanceof`, `delete`, `void`, rest elements, computed keys, classes, `throw`, `finally`, `import`,
|
|
277
282
|
`export`, `eval`, labels, and a function as a value (`const f = (x) => ...`: pass the arrow to the helper
|
|
278
283
|
that takes it). `xs.sort(...)` on a name or path is refused too, since a value is never changed in place:
|
|
279
|
-
write `xs.toSorted(...)` or `[...xs].sort(...)`.
|
|
284
|
+
write `xs.toSorted(...)` or `[...xs].sort(...)`. Inside a callback's block a loop, `let`, a reassignment and a
|
|
285
|
+
destructuring pattern are refused: use a helper, or compute the value before the callback.
|
|
280
286
|
|
|
281
287
|
## Typing
|
|
282
288
|
|
|
@@ -353,8 +359,24 @@ writing it: `differenceInCalendarDays(a, b) ?? 0`.
|
|
|
353
359
|
(`filter(record.items, x => x.Status == "open" && x.Amount > 100)`); `reduce` takes a callback and an
|
|
354
360
|
initial value. A callback gets `(item, idx)` (`reduce`: `(acc, item, idx)`) and reads `record`,
|
|
355
361
|
`runtime`, the names in scope, loop items and an enclosing callback's parameters. Its body is one
|
|
356
|
-
expression — `(x) => <expr
|
|
357
|
-
|
|
362
|
+
expression — `(x) => <expr>` — or a block of `const` declarations, `if`/`else` and `return`, every path
|
|
363
|
+
ending in `return <expr>;` (`(x) => { … }` or `function (x) { … }`):
|
|
364
|
+
|
|
365
|
+
```js
|
|
366
|
+
const orders = await query_records({ table_id: "orders" });
|
|
367
|
+
const customers = await query_records({ table_id: "customers" });
|
|
368
|
+
const rows = orders.records.map((o) => {
|
|
369
|
+
const c = find(customers.records, (x) => x.id == o.data.customer[0]);
|
|
370
|
+
if (c == null) { return null; }
|
|
371
|
+
return { name: c.data.name, total: o.data.qty * o.data.price };
|
|
372
|
+
});
|
|
373
|
+
return({ status: "success", message: text(rows.length) });
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
A block's `const` behaves as a top-level `const` does. Inside a block a loop, `let`, a reassignment, a
|
|
377
|
+
destructuring pattern, `switch` and `try` are refused: use a helper (`map`, `filter`, `find`, `reduce`) or
|
|
378
|
+
compute the value before the callback. A declared `function` is one `return <expr>;`, and a table check
|
|
379
|
+
takes no block. `async` and named function expressions are refused.
|
|
358
380
|
|
|
359
381
|
Look a row up by key rather than filtering for it: a `filter` inside a callback walks its whole list again
|
|
360
382
|
for every item, so a thousand items against a few hundred rows is hundreds of thousands of calls. Group the
|