@lotics/cli 0.290.0 → 0.291.0

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.
@@ -129,8 +129,8 @@ What `create_table` (on the CLI or in chat) and `update_table` take in `add_fiel
129
129
  `select_record_link`, `files`, `formula`, `rollup`, `lookup`, `autonumber`. `button` is retired: an
130
130
  existing button field keeps running, but none is created, converted to or edited.
131
131
 
132
- A URL, an email, markdown, a checkbox, a datetime, a currency or a percentage is a `format` on
133
- another type, never a `type`:
132
+ A URL, an email, markdown, a checkbox, a datetime, money, a quantity or a percentage is a `format`
133
+ or a `notation` on another type, never a `type`:
134
134
 
135
135
  | Wanted | Field |
136
136
  |---|---|
@@ -138,8 +138,9 @@ another type, never a `type`:
138
138
  | Email or phone | `{ type: "text" }` |
139
139
  | Markdown | `{ type: "text", format: "markdown" }` |
140
140
  | Checkbox | `{ type: "boolean" }` |
141
- | Money | `{ type: "number", format: "currency", currency: "USD" }` |
142
- | Percentage | `{ type: "number", format: "percentage" }` |
141
+ | Money | `{ type: "number", notation: { style: "currency", currency: "USD" } }` |
142
+ | Quantity | `{ type: "number", notation: { style: "unit", unit: "kg" } }` |
143
+ | Percentage | `{ type: "number", notation: { style: "unit", unit: "percent" } }` |
143
144
  | Datetime | `{ type: "date", format: "datetime" }` |
144
145
  | Date range | `{ type: "date", format: "date_range" }` |
145
146
 
@@ -150,14 +151,18 @@ may itself hold an object (`formula`, `aggregate_option`, `filter`, `order_by`);
150
151
  inside it. Each type takes only its own:
151
152
 
152
153
  - **text** — `format?` (`"text"` | `"link"` | `"markdown"`), `unique?`, `default_value?` (a string).
153
- - **number** — `format?` (`"number"` | `"currency"` | `"percentage"`), `currency?` (an ISO 4217
154
- code), `unit?`, `unit_field?`, `currency_field?`, `default_value?` (a number). On `update_fields`,
155
- null clears `currency`, `unit`, `unit_field` or `currency_field`.
156
- - `unit`, beside format `"number"`: a measured code — g, kg, t, l, m3, cbm, mm, cm, m, km, m2,
157
- min, h, day — or a counted noun such as `kiện`. A change between two units of one dimension
158
- converts every stored figure; any other change relabels.
159
- - `unit_field`: A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row's unit: every option label is a unit as `unit` takes one. In place of `unit`; only beside format "number".
160
- - `currency_field`: A single select on the same row, or a lookup of one through a one-link, whose chosen option is that row's currency: every option label is an ISO 4217 code. In place of `currency`; only beside format "currency".
154
+ - **number** — `notation?`, `default_value?` (a number). `notation` is how the figure reads, one
155
+ of three; on `update_fields` a stated one replaces the field's whole.
156
+ - `{ style: "decimal" }` — a plain number, as a field stating none reads.
157
+ - `{ style: "currency", currency: "VND" }` — money in an ISO 4217 code.
158
+ - `{ style: "unit", unit }` — a quantity: `"percent"` (10 reads "10%", never multiplied), a
159
+ measured code — g, kg, t, l, m3, cbm, mm, cm, m, km, m2, min, h, day — or a counted noun such
160
+ as `kiện`. A change between two units of one dimension converts every stored figure; any other
161
+ change relabels.
162
+ - A currency or unit read on each row is `{ per_row: "ĐVT" }` in its place: a single select on
163
+ the same row, or a lookup of one through a one-link, named by name or key, whose chosen option
164
+ is that row's currency or unit — every option label an ISO 4217 code, or a unit as `unit`
165
+ takes one.
161
166
  - **date** — `format?` (`"date"` | `"datetime"` | `"date_range"` | `"datetime_range"`), `timezone?`,
162
167
  `derive_from?`, `default_value?` (a date string). `derive_from: "created_at"` stamps the row's
163
168
  creation once, `"updated_at"` re-stamps on every update; the field is then read-only, takes no
@@ -186,7 +191,7 @@ not exist yet, and option keys (`opt_…`) in `update_fields`.
186
191
  Read-only in records. `formula` is one key holding an object; a rollup's and a lookup's properties
187
192
  are separate keys on the field — `rollup: {…}` and `lookup: {…}` are refused as unrecognized.
188
193
 
189
- formula: { expression, format?, currency?, unit?, unit_field?, currency_field? }
194
+ formula: { expression, notation?, link? }
190
195
 
191
196
  - `{Field Name}` or `{fld_key}` names a field of the same table, stored as its key, so a rename never
192
197
  breaks the formula. A reference to no field, or a call to something that is no helper, is refused.
@@ -194,9 +199,10 @@ formula: { expression, format?, currency?, unit?, unit_field?, currency_field? }
194
199
  `includes({Tags}, "opt_…")` for a multi.
195
200
  - The operators, the helpers and how an empty cell reads are the `model` reference, section `formula` — a model
196
201
  names fields by alias where a table tool names them by name or key; the language is the same.
197
- - On `update_fields` a key left out keeps its stored value, and null clears `currency`, `unit`,
198
- `unit_field` or `currency_field`. `get_table` marks a formula that is null when every field it
199
- reads is empty.
202
+ - `notation` is how a number result reads, as a number field's; `link: true` says the result is a
203
+ URL, drawn as a link that opens.
204
+ - On `update_fields` a key left out keeps its stored value, and a stated `notation` replaces the
205
+ stored one whole. `get_table` marks a formula that is null when every field it reads is empty.
200
206
 
201
207
  rollup — `source_field_key`, `aggregate_option: { field_key?, operation }`, `filter?`
202
208
 
@@ -207,9 +213,10 @@ rollup — `source_field_key`, `aggregate_option: { field_key?, operation }`, `f
207
213
  `min`, `max`, `range`; date: `earliest`, `latest`, `date_range`.
208
214
  - The cell's type comes from the OPERATION: `earliest` and `latest` hold a date, every other
209
215
  operation a number (`date_range` counts days). A "most recent linked date" is `latest` — `min` and
210
- `max` are numeric and refuse a date. A rollup takes no format, currency or unit of its own: `sum`
211
- over money carries the aggregated field's currency, over a weight its unit.
212
- - Over a figure read in each row's own unit or currency (`unit_field` / `currency_field`), `sum`,
216
+ `max` are numeric and refuse a date. A rollup takes no notation of its own: `sum` over money
217
+ reads in the aggregated field's currency, over a weight in its unit, a count as a plain number
218
+ and a `percent_*` in the unit `percent`.
219
+ - Over a figure read in each row's own unit or currency (a notation's `per_row`), `sum`,
213
220
  `avg`, `median`, `min`, `max` and `range` hold only where that select is a lookup, through the
214
221
  link paired with `source_field_key`, of a single select on this table — the total reads in this
215
222
  row's option of it. A lookup of such a field has no unit.
@@ -227,13 +234,14 @@ lookup — `source_field_key`, `lookup_field_key`, `order_by?`
227
234
  ### Examples
228
235
 
229
236
  ```
230
- { name: "Giá bán", type: "number", format: "currency", currency: "VND" }
231
- { name: "Trọng lượng", type: "number", unit: "kg" }
232
- { name: "Số lượng", type: "number", unit_field: "ĐVT" }
237
+ { name: "Giá bán", type: "number", notation: { style: "currency", currency: "VND" } }
238
+ { name: "Trọng lượng", type: "number", notation: { style: "unit", unit: "kg" } }
239
+ { name: "Số lượng", type: "number", notation: { style: "unit", unit: { per_row: "ĐVT" } } }
240
+ { name: "Chiết khấu", type: "number", notation: { style: "unit", unit: "percent" } }
233
241
  { name: "Trạng thái", type: "select", options: [{ name: "Mới" }, { name: "Xong" }] }
234
242
  { name: "Mã đơn", type: "autonumber", template: "SR-{YEAR}-{N:4}" }
235
243
  { name: "Khách hàng", type: "select_record_link", table_id: "tbl_x", sync_both_ways: true }
236
- { name: "Total", type: "formula", formula: { expression: "{Price} * {Qty}", format: "currency", currency: "VND" } }
244
+ { name: "Total", type: "formula", formula: { expression: "{Price} * {Qty}", notation: { style: "currency", currency: "VND" } } }
237
245
  { name: "SL đã giao", type: "rollup", source_field_key: "Giao hàng", aggregate_option: { operation: "sum", field_key: "Số lượng" } }
238
246
  { name: "Customer Name", type: "lookup", source_field_key: "Customer", lookup_field_key: "Name" }
239
247
  { name: "Latest note", type: "lookup", source_field_key: "Calls", lookup_field_key: "Note", order_by: { field_key: "At", direction: "desc" } }
package/docs/examples.md CHANGED
@@ -35,7 +35,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
35
35
  {"alias": "booked_on", "type": "date"},
36
36
  {"alias": "parts_ready_on", "type": "date"},
37
37
  {"alias": "arrived_on", "type": "date"},
38
- {"alias": "hours", "type": "number", "format": "number", "unit": "h"},
38
+ {"alias": "hours", "type": "number", "notation": {"style": "unit", "unit": "h"}},
39
39
  {"alias": "report", "type": "text", "format": "markdown"},
40
40
  {"alias": "completed_on", "type": "date"}
41
41
  ]
@@ -120,7 +120,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
120
120
  {"alias": "booked_on", "type": "date"},
121
121
  {"alias": "parts_ready_on", "type": "date"},
122
122
  {"alias": "arrived_on", "type": "date"},
123
- {"alias": "hours", "type": "number", "format": "number", "unit": "h"},
123
+ {"alias": "hours", "type": "number", "notation": {"style": "unit", "unit": "h"}},
124
124
  {"alias": "completed_on", "type": "date"}
125
125
  ]
126
126
  },
@@ -379,7 +379,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
379
379
  },
380
380
  {"alias": "on_hand", "type": "number"},
381
381
  {"alias": "minimum", "type": "number"},
382
- {"alias": "price", "type": "number", "format": "currency", "currency": "USD"},
382
+ {"alias": "price", "type": "number", "notation": {"style": "currency", "currency": "USD"}},
383
383
  {"alias": "supplier_page", "type": "text", "format": "link"},
384
384
  {"alias": "last_counted", "type": "date"},
385
385
  {"alias": "counted_by", "type": "select_member"},
@@ -394,7 +394,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
394
394
  {"alias": "quantity", "type": "number"},
395
395
  {"alias": "shipped", "type": "number"},
396
396
  {"alias": "picked", "type": "number"},
397
- {"alias": "unit_price", "type": "number", "format": "currency", "currency": "USD"},
397
+ {"alias": "unit_price", "type": "number", "notation": {"style": "currency", "currency": "USD"}},
398
398
  {"alias": "amount", "type": "formula"},
399
399
  {"alias": "category", "type": "lookup"}
400
400
  ]
@@ -493,7 +493,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
493
493
  {"alias": "phone", "type": "text"},
494
494
  {"alias": "website", "type": "text", "format": "link"},
495
495
  {"alias": "account_manager", "type": "select_member"},
496
- {"alias": "credit_limit", "type": "number", "format": "currency", "currency": "USD"},
496
+ {"alias": "credit_limit", "type": "number", "notation": {"style": "currency", "currency": "USD"}},
497
497
  {"alias": "outstanding", "type": "rollup"},
498
498
  {"alias": "over_limit", "type": "formula"},
499
499
  {
@@ -746,7 +746,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
746
746
  {"alias": "sale", "type": "select_member"},
747
747
  {"alias": "xu_ly", "type": "select_member"},
748
748
  {"alias": "can_bo_sung", "type": "boolean"},
749
- {"alias": "phi_dich_vu", "type": "number", "format": "currency", "currency": "VND"},
749
+ {"alias": "phi_dich_vu", "type": "number", "notation": {"style": "currency", "currency": "VND"}},
750
750
  {
751
751
  "alias": "loai_can",
752
752
  "type": "select",
@@ -758,7 +758,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
758
758
  ]
759
759
  },
760
760
  {"alias": "can_boc", "type": "text"},
761
- {"alias": "hoa_hong_sale", "type": "number", "format": "currency", "currency": "VND"},
761
+ {"alias": "hoa_hong_sale", "type": "number", "notation": {"style": "currency", "currency": "VND"}},
762
762
  {"alias": "ngay_thu_phi", "type": "date"},
763
763
  {"alias": "ngay_nhan_giay_to", "type": "date"},
764
764
  {"alias": "ngay_lap_ho_so", "type": "date"},
@@ -812,7 +812,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
812
812
  },
813
813
  {"alias": "ngay_sinh", "type": "date"},
814
814
  {"alias": "cccd", "type": "text"},
815
- {"alias": "thu_nhap", "type": "number", "format": "currency", "currency": "VND"}
815
+ {"alias": "thu_nhap", "type": "number", "notation": {"style": "currency", "currency": "VND"}}
816
816
  ]
817
817
  },
818
818
  {
@@ -828,7 +828,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
828
828
  ]
829
829
  },
830
830
  {"alias": "ho_so", "type": "select_record_link", "target_entity": "ho_so", "cardinality": "one"},
831
- {"alias": "so_tien", "type": "number", "format": "currency", "currency": "VND"},
831
+ {"alias": "so_tien", "type": "number", "notation": {"style": "currency", "currency": "VND"}},
832
832
  {
833
833
  "alias": "hinh_thuc",
834
834
  "type": "select",
@@ -1471,7 +1471,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
1471
1471
  "target_entity": "nha_cung_cap",
1472
1472
  "cardinality": "one"
1473
1473
  },
1474
- {"alias": "so_tien", "type": "number", "format": "currency", "currency": "VND"},
1474
+ {"alias": "so_tien", "type": "number", "notation": {"style": "currency", "currency": "VND"}},
1475
1475
  {"alias": "han_thanh_toan", "type": "date"},
1476
1476
  {
1477
1477
  "alias": "trang_thai",
@@ -1520,6 +1520,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
1520
1520
  "register": {
1521
1521
  "columns": ["nguoi_de_nghi"],
1522
1522
  "filters": ["nguoi_de_nghi", "du_an"],
1523
+ "group": "du_an",
1523
1524
  "create": ["noi_dung", "loai", "du_an", "nha_cung_cap", "so_tien", "han_thanh_toan", "nguoi_de_nghi"],
1524
1525
  "readings": [
1525
1526
  {
@@ -1595,7 +1596,7 @@ Every key: the `model` reference, at the pages each section names under **Keys**
1595
1596
  "type": "select",
1596
1597
  "options": [{"alias": "thu", "color": "green"}, {"alias": "chi", "color": "rose"}]
1597
1598
  },
1598
- {"alias": "so_tien", "type": "number", "format": "currency", "currency": "VND"},
1599
+ {"alias": "so_tien", "type": "number", "notation": {"style": "currency", "currency": "VND"}},
1599
1600
  {"alias": "bien_dong", "type": "formula"},
1600
1601
  {
1601
1602
  "alias": "doi_tuong",
package/docs/filters.md CHANGED
@@ -49,8 +49,9 @@ pass the whole list in one condition rather than splitting it across calls.
49
49
  | `equals`, `not_equals`, `greater_than`, `less_than`, `greater_than_or_equal_to`, `less_than_or_equal_to` | a number |
50
50
  | `is_empty`, `is_not_empty` | none |
51
51
 
52
- A number whose field states `unit_field` or `currency_field` is read in each row's own unit or
53
- currency, so a comparison on it states `unit_option`: the option of that select its value is in.
52
+ A number whose `notation` reads its unit or currency on each row (`{ "per_row": <select> }`) is
53
+ read in each row's own, so a comparison on it states `unit_option`: the option of that select its
54
+ value is in.
54
55
  Rows holding another option are out; measured units of one dimension convert.
55
56
 
56
57
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.290.0",
3
+ "version": "0.291.0",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {