@lotics/cli 0.321.37 → 0.321.39
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/AGENTS.md +3 -3
- package/README.md +5 -5
- package/dist/src/cli.js +63 -48
- package/dist/src/client.d.ts +5 -6
- package/dist/src/client.js +4 -4
- package/docs/cli_reference.md +2 -2
- package/docs/design.md +1 -1
- package/docs/document_templates.md +1 -1
- package/docs/filters.md +1 -1
- package/package.json +1 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface AppQueryFilterCondition {
|
|
|
12
12
|
value?: unknown;
|
|
13
13
|
unit_option?: string;
|
|
14
14
|
ignore_accents?: boolean;
|
|
15
|
+
whole_words?: boolean;
|
|
15
16
|
}
|
|
16
17
|
/** A boolean group of filter nodes (wire shape — recursive). */
|
|
17
18
|
export interface AppQueryFilterGroup {
|
|
@@ -244,17 +245,15 @@ export type CliLoginState = {
|
|
|
244
245
|
workspace_id: string;
|
|
245
246
|
};
|
|
246
247
|
/**
|
|
247
|
-
* Ask Lotics
|
|
248
|
+
* Ask Lotics for a sign-in request, and read back whether it was confirmed.
|
|
248
249
|
*
|
|
249
250
|
* Plain functions rather than `LoticsClient` methods: there is no key to build
|
|
250
251
|
* a client around, and that is the whole point — this is the pair a terminal holding NO credential
|
|
251
252
|
* uses to obtain one. Sending an `Authorization` header would make the endpoint
|
|
252
|
-
* answerable only to callers who no longer need it.
|
|
253
|
-
*
|
|
254
|
-
* The same answer whether or not the address has an account: it would
|
|
255
|
-
* otherwise tell any stranger which emails are registered here.
|
|
253
|
+
* answerable only to callers who no longer need it. The request names nobody:
|
|
254
|
+
* whoever signs in on its page and confirms is the account it is for.
|
|
256
255
|
*/
|
|
257
|
-
export declare function startCliLogin(apiUrl: string
|
|
256
|
+
export declare function startCliLogin(apiUrl: string): Promise<CliLoginRequest>;
|
|
258
257
|
export declare function pollCliLogin(apiUrl: string, request_id: string, secret: string): Promise<CliLoginState>;
|
|
259
258
|
export declare class LoticsClient {
|
|
260
259
|
private apiKey;
|
package/dist/src/client.js
CHANGED
|
@@ -210,22 +210,22 @@ function errorCode(cause) {
|
|
|
210
210
|
}
|
|
211
211
|
var WEB_APP_URL = process.env.LOTICS_WEB_URL ?? "https://lotics.ai";
|
|
212
212
|
var PUBLIC_FETCH_TIMEOUT_MS = 1e4;
|
|
213
|
-
async function startCliLogin(apiUrl
|
|
213
|
+
async function startCliLogin(apiUrl) {
|
|
214
214
|
let response;
|
|
215
215
|
try {
|
|
216
216
|
response = await fetch(`${apiUrl}/v1/cli/login_requests`, {
|
|
217
217
|
method: "POST",
|
|
218
218
|
headers: { "Content-Type": "application/json" },
|
|
219
|
-
body: JSON.stringify({
|
|
219
|
+
body: JSON.stringify({}),
|
|
220
220
|
signal: AbortSignal.timeout(PUBLIC_FETCH_TIMEOUT_MS)
|
|
221
221
|
});
|
|
222
222
|
} catch (error) {
|
|
223
223
|
throw new Error(
|
|
224
|
-
`Could not reach Lotics to
|
|
224
|
+
`Could not reach Lotics to ask for a sign-in (${error instanceof Error ? error.message : String(error)}). Check your connection, or sign in at ${WEB_APP_URL}.`
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
if (!response.ok) {
|
|
228
|
-
throw new Error(`Lotics answered ${response.status} asking for a sign-in
|
|
228
|
+
throw new Error(`Lotics answered ${response.status} asking for a sign-in.`);
|
|
229
229
|
}
|
|
230
230
|
return await response.json();
|
|
231
231
|
}
|
package/docs/cli_reference.md
CHANGED
|
@@ -6,14 +6,14 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
6
6
|
|---|---|
|
|
7
7
|
| `lotics` / `lotics --help` | Show full help: capabilities, the verb list (§ COMMANDS), flags, config. `lotics <verb> --help` prints that verb's entries alone (`lotics app --help`, `lotics file download --help`); `lotics report --help` prints the report frame. |
|
|
8
8
|
| `lotics auth signup <email>` | Create account + org + API key, sends magic link email. Refused on a private instance, whose people arrive by invitation; prints that creating the account accepts the Terms and Privacy Policy. Registers the new org as a profile; `--local` pins this directory to it (pointer) instead of setting the global default. |
|
|
9
|
-
| `lotics auth login
|
|
9
|
+
| `lotics auth login` | Sign in an account that already exists, on a machine holding no key. It takes no argument and sends no mail. **Two steps, and it does not wait for the person.** The first prints the page to open — `https://lotics.ai/cli_login/<request_id>` — and the code that page must show, records the request, and exits 0. They sign in there if asked, check the code, pick the organization and press Confirm. **Then the next command that needs a credential collects the key** before it does its own work, so the second step is just re-running whatever was wanted; a command run before Confirm exits 1 naming the page and the code again, and once the 15 minutes are up it says to ask again. The handful that run WITHOUT a credential — `docs` among them — claim nothing, so one of those run after Confirm still answers as though signed out. `--wait` keeps one command instead, holding the terminal until Confirm; `--local` pins this directory to that org rather than setting the global default, and implies `--wait` (a pin names THIS directory, so only the terminal that stays in it can write one). `--json` prints `organization_id`, `workspace_id` and `organization_name` when it finishes signed in, and `request_id`, `confirm_url`, `code`, `expires_at` when it is the first step. The request's secret is never printed and the org's key never leaves the store. |
|
|
10
10
|
| — | **A flag is refused on a verb that does not read it**, naming the verbs that do, before any request or credential: `--check` on `lotics run` would otherwise be parsed and ignored, and the write it was meant to stop would run. `--json`, `--workspace`, `--api-key` and `--timeout` are read by every verb. |
|
|
11
11
|
| — | **Every call a verb makes waits for the server's answer**; `--timeout <ms>` (a whole number of milliseconds from 1 to 2147483647) stops each wait early. The wait ends without an answer when `--timeout` passes or no answer arrives from the server. A read with no answer changed nothing: the command exits non-zero naming the request id. A write with no answer exits non-zero with `error_code: "outcome_unknown"` and the request id under `--json`, because it cannot say whether the call took effect: read before running it again. The one fetch outside this is the download from an object-storage signed URL, which carries no request id and is stopped by `--timeout` alone. Under `--json` every error is one object on stdout: `error`, with `error_code` and `request_id` where the error has them. |
|
|
12
12
|
| `lotics auth api-key [key]` | `whoami` → **upsert** the key's org as a profile in the global store (never overwrites). The profile records the instance the key was verified against (`LOTICS_API_URL`, default `https://api.lotics.ai`), and every later command for that org goes there. `--local` additionally pins this directory to it (pointer) instead of setting the global default. |
|
|
13
13
|
| `lotics auth web` | Send a magic link email to access the web app (requires auth) |
|
|
14
14
|
| `lotics auth whoami` | Print active account name, email, org, resolved workspace, the instance the credential belongs to, which **kind** of credential this machine holds (a sign-in from `auth login`, or an API key — read from the saved profile, and from the server when the profile does not say, which covers `--api-key`/`LOTICS_API_KEY` and a profile saved before the field existed; unknown only when neither can say), and the resolution **source** (flag/env/local/app-manifest/global). `--json` adds `workspace_id`, `api_url`, `credential_kind` + `source`. |
|
|
15
15
|
| `lotics auth logout [<name\|id>]` | In a pinned dir: delete the local pin. Else: remove the profile (default the active org), `--all` for every one. What happens server-side depends on which KIND of credential it is. A **sign-in** (`auth login` / `auth signup`) is revoked — logging that terminal out ends its credential rather than leaving a live one behind; a server that cannot be reached, or a credential already dead, never blocks the local forget, and one line names the org and Settings → Security → *Keys and terminals*. An **API key** (`auth api-key`) is only forgotten here — an admin issued it and it is routinely on a server and on other machines, so one terminal signing out must not kill it for everyone; the line says it is still active and names both pages, because Settings → API keys is admin-only and the credential may well be the holder's own sign-in, which they revoke themselves at Settings → Security → *Keys and terminals*. A profile saved before the kind was recorded states nothing, so the SERVER is asked (`auth whoami`) and it is revoked only if the answer is a sign-in: an older server, a credential minted before the column, and a request that fails all leave it alone. |
|
|
16
|
-
| — | **A refused credential says which way it is dead, and names the remedy that ends its kind.** `This credential expired.` / `was revoked.` / `belongs to a member who is no longer active in this organization.` carries `Run \`lotics auth login
|
|
16
|
+
| — | **A refused credential says which way it is dead, and names the remedy that ends its kind.** `This credential expired.` / `was revoked.` / `belongs to a member who is no longer active in this organization.` carries `Run \`lotics auth login\` to sign in again.` for a sign-in and `Ask an admin for a new API key (Settings → API keys).` for an issued key. A credential minted before that was recorded still gets BOTH in one sentence, because nothing on the row tells them apart — so a headless box is never sent looking for a browser alone. A key the server does not recognize at all gets one flat `Invalid or disabled API key.` — deliberately, so a guessed key learns nothing, not even that it named a row. The body carries `reason` for a script to branch on, since the code stays `unauthorized` for every 401. Changing or resetting the account's password revokes its sign-ins, never an issued key. |
|
|
17
17
|
| `lotics org` | List saved orgs (profiles) from the global store with the instance each belongs to, marks active for this directory (a local pin wins over the global default). |
|
|
18
18
|
| `LOTICS_ORG=<name\|id>` | Scope every command in this shell to one saved org. **Resolved once, before any command dispatches**, so a value matching no saved credential refuses every verb with one sentence — a read, a write, and a local check that needs no credential alike — and refuses it before the first byte is written. It refuses even when a credential arrives another way, because `--api-key` / `LOTICS_API_KEY` outrank it in the precedence chain and a write must never fall through to whatever THOSE name while the variable says otherwise; when the variable resolves and a key is also given, the key decides and the command says so. The refusal lists the orgs this machine holds, so it is answerable without another command (`lotics org` is refused by the same rule). A name is whatever the credential was SAVED under — a server-side rename never moves it, and the new name resolves too, so both keep working and `lotics org` prints the pair. |
|
|
19
19
|
| `lotics org use <name\|id> [--local]` | Switch the active org by org name (case-insensitive, ambiguous → error) or id. No flag → global `active_org`; `--local` → a `.lotics/config.json` pointer in the current dir. |
|
package/docs/design.md
CHANGED
|
@@ -117,7 +117,7 @@ or its entity is read-only (`edit: false`); a stepped status never is, since Act
|
|
|
117
117
|
|
|
118
118
|
- `key` (alias, required): The app's alias, its name among apps
|
|
119
119
|
- `name` (text, required): The job, in the words of the people who do it
|
|
120
|
-
- `children` (list of (List | Sheet | Query | Workflow) (at least one)): The App's Views in order
|
|
120
|
+
- `children` (list of (List over a Query | List | Sheet | Query | Workflow) (at least one)): The App's Views in order
|
|
121
121
|
- `color` (colour): The launcher tile's colour
|
|
122
122
|
- `pages` (list of Record (at least one)): The page the rows of an entity open, one per entity, each a Record stating its `entity`
|
|
123
123
|
|
|
@@ -109,7 +109,7 @@ the `set_template` description for the reference; here is the capability:
|
|
|
109
109
|
also offer an auto-rendered `table` variable — declare its columns and pass an array, no
|
|
110
110
|
hand-written loop. Excel marks the rows that repeat with `{{#each items}}` and `{{/each}}`, each alone in a row above and
|
|
111
111
|
below them, or inline in the paper's own rows: `{{#each items}}` opens the first repeated row's first cell holding text
|
|
112
|
-
and `{{/each}}` closes the last one's last (a formula cell is passed over), so a one-row body reads `{{#each lines}}{{@ordinal}}` … `{{amount}}{{/each}}`.
|
|
112
|
+
and `{{/each}}` closes the last one's last (a formula cell is passed over), so a one-row body reads `{{#each lines}}{{@ordinal}}` … `{{amount}}{{/each}}`. A row repeats for one loop: two loops side by side in the same rows are refused, so put them in separate row bands or on separate sheets.
|
|
113
113
|
(Excel has no auto-rendered `table` type; its variable types are string/number/date/boolean/array.) Inside a loop the row's number counted from 1
|
|
114
114
|
is `{{@ordinal}}` (Excel, HTML, email) or `{{$ordinal}}` (Word), the innermost loop's: an STT column is a cell holding
|
|
115
115
|
`{{@ordinal}}` beside the row's other markers. `{{@index}}` counts from 0.
|
package/docs/filters.md
CHANGED
|
@@ -65,7 +65,7 @@ The depth a filter may nest is the depth you write: the groups an operator stand
|
|
|
65
65
|
{ "node_type": "condition", "field_key": "title", "operator": "is_any_of", "value": ["hello", "world"] }
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
`contains "cá"` finds `Cá hồi`, not `Cà chua`. Keeping accents reads `hòa` and `hoà` as one spelling. A condition with `ignore_accents: true` makes `contains`, `does_not_contain`, `starts_with`, `ends_with
|
|
68
|
+
`contains "cá"` finds `Cá hồi`, not `Cà chua`. Keeping accents reads `hòa` and `hoà` as one spelling. A condition with `ignore_accents: true` makes `contains`, `does_not_contain`, `starts_with`, `ends_with`, `contains_any_of` ignore accents too: `ca` and `cá` find both, and so on a record link's `contains`, `not_contains`, `starts_with` and `ends_with`. Any other operator refuses it. A condition with `whole_words: true` makes `contains` and `contains_any_of` on text, and `contains` on a record link (which reads each linked row's name), match a term only as a whole token: the character before and after the match is the edge of the text or an ASCII character that is no letter or digit (`2025SGSIN-1` is not in `2025SGSIN-12`; `ơng` is not in `Dương`, and a non-ASCII character never ends a token). Any other operator refuses it. A text value is a string, never an array; `is_any_of` matches several. Its array has no length cap —
|
|
69
69
|
pass the whole list in one condition rather than splitting it across calls.
|
|
70
70
|
|
|
71
71
|
## Number
|