@listen-fire/handbook 0.16.0 → 0.16.1
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.
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"gmail": {
|
|
32
32
|
"capturedAt": "2026-11-02",
|
|
33
33
|
"via": "lf catalog over a project connecting the real @lf/gmail module against fake-channels' Gmail: the whole gmail entry"
|
|
34
|
+
},
|
|
35
|
+
"airtable": {
|
|
36
|
+
"capturedAt": "2026-11-21",
|
|
37
|
+
"via": "reduced by hand from the real @lf/airtable module's describeTableChange (modules/airtable/schema_catalog.ts), through the projection's rules (a field of kind record becomes a record of the named position, mayBeAbsent becomes maybeAbsent): only the held record fields a probe reads (Previous, Current) and two of the table's own fields (Stage, Score), the whole entry otherwise absent. Exists so a probe can read a record held in a field."
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
},
|
|
@@ -441,6 +445,16 @@
|
|
|
441
445
|
}
|
|
442
446
|
}
|
|
443
447
|
}
|
|
448
|
+
},
|
|
449
|
+
"airtable": {
|
|
450
|
+
"constructionArgs": [
|
|
451
|
+
{
|
|
452
|
+
"name": "credentials",
|
|
453
|
+
"kind": "credential",
|
|
454
|
+
"required": true
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
"description": "Airtable bases and their tables' rows, and a change for each row an edit touched."
|
|
444
458
|
}
|
|
445
459
|
},
|
|
446
460
|
"schemas": {
|
|
@@ -4542,6 +4556,68 @@
|
|
|
4542
4556
|
}
|
|
4543
4557
|
},
|
|
4544
4558
|
"supportsInPlaceUpdate": true
|
|
4559
|
+
},
|
|
4560
|
+
"airtable": {
|
|
4561
|
+
"positions": {
|
|
4562
|
+
"Candidate": {
|
|
4563
|
+
"properties": {
|
|
4564
|
+
"Name": "text",
|
|
4565
|
+
"Stage": "text",
|
|
4566
|
+
"Score": {
|
|
4567
|
+
"kind": "maybeAbsent",
|
|
4568
|
+
"of": "number"
|
|
4569
|
+
}
|
|
4570
|
+
},
|
|
4571
|
+
"edges": {}
|
|
4572
|
+
},
|
|
4573
|
+
"Candidate Change": {
|
|
4574
|
+
"properties": {
|
|
4575
|
+
"Id": "text",
|
|
4576
|
+
"Kind": {
|
|
4577
|
+
"kind": "enum",
|
|
4578
|
+
"options": [
|
|
4579
|
+
"created",
|
|
4580
|
+
"updated",
|
|
4581
|
+
"deleted"
|
|
4582
|
+
]
|
|
4583
|
+
},
|
|
4584
|
+
"Current": {
|
|
4585
|
+
"kind": "maybeAbsent",
|
|
4586
|
+
"of": {
|
|
4587
|
+
"kind": "record",
|
|
4588
|
+
"position": {
|
|
4589
|
+
"kind": "position",
|
|
4590
|
+
"position": "Candidate"
|
|
4591
|
+
}
|
|
4592
|
+
}
|
|
4593
|
+
},
|
|
4594
|
+
"Previous": {
|
|
4595
|
+
"kind": "maybeAbsent",
|
|
4596
|
+
"of": {
|
|
4597
|
+
"kind": "record",
|
|
4598
|
+
"position": {
|
|
4599
|
+
"kind": "position",
|
|
4600
|
+
"position": "Candidate"
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
},
|
|
4605
|
+
"edges": {
|
|
4606
|
+
"Record": {
|
|
4607
|
+
"target": "Candidate"
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
},
|
|
4612
|
+
"collections": {
|
|
4613
|
+
"Candidates": {
|
|
4614
|
+
"target": "Candidate"
|
|
4615
|
+
},
|
|
4616
|
+
"Candidate Changes": {
|
|
4617
|
+
"target": "Candidate Change"
|
|
4618
|
+
}
|
|
4619
|
+
},
|
|
4620
|
+
"writableRoots": {}
|
|
4545
4621
|
}
|
|
4546
4622
|
}
|
|
4547
4623
|
}
|
package/dist/builtins.md
CHANGED
|
@@ -170,10 +170,10 @@ code = Text.upper(Text.trim(msg.Subject))
|
|
|
170
170
|
|
|
171
171
|
### Text.includes
|
|
172
172
|
|
|
173
|
-
`Text.includes(text, part)` → `boolean` — whether the text contains `part
|
|
173
|
+
`Text.includes(text, part)` → `boolean` — whether the text contains `part`. Letter case counts, as in JavaScript's `includes`; to ignore it, lower both sides. The same test as `CONTAINS` in a `WHERE`.
|
|
174
174
|
|
|
175
175
|
```
|
|
176
|
-
urgent = Text.includes(msg.Subject, "urgent")
|
|
176
|
+
urgent = Text.includes(Text.lower(msg.Subject), "urgent")
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
### Text.length
|
|
@@ -252,7 +252,7 @@ A separate and stronger thing is a value typed as *possibly not there at all*
|
|
|
252
252
|
- **a named \`match\`.** \`existing = match crm-[:Companies]-> { … }\` is the record or absent; test \`existing == null\` (the \`else\` arm sees it present) or \`!= null\` before reading a field off it or linking it;
|
|
253
253
|
- **a record held in a field.** A field may hold a record: a value with typed fields, such as a change's row before and after (\`c.Previous\`, \`c.Current\`). Its fields are read with \`.\` (\`c.Current.Stage\`); it has no edges, so the record as it is now is reached by its edge (\`c-[:Record]->\`). \`c.Previous\` is absent on a created row, and a field read through it with \`.\` is refused until tested: \`c.Previous?.Stage\` reads it (absent on a created row), or test it first, \`exists(c.Previous) && c.Previous.Stage == "Applied"\`, \`!exists(c.Previous) || c.Previous.Stage != "Interview"\`, or inside \`if (exists(c.Previous)) { … }\` (in a \`WHERE\`: \`AND\`, \`OR\`, \`NOT\`);
|
|
254
254
|
- **a \`race\` slot** — \`r[0]\` reads what the first arm of a \`race\` returned, and only the arm that settled first has its slot filled, so every slot off a \`race\` may be absent. (A \`map\` over a list of functions runs every one, so its slots are not.)
|
|
255
|
-
- **a field read off a record that may not be there.** \`details = extractOne(…)\` may have found nothing, so \`details.summary\` is refused, as TypeScript refuses it under strict null checks. Read it with \`details?.summary\`, which is \`text | absent\`: absent when \`details\` is, so \`details?.summary == null\` holds then. Or test \`exists(details)\` (or \`details != null\`) first and read \`details.summary\` after. \`details?.summary != null\` proves \`details\` present
|
|
255
|
+
- **a field read off a record that may not be there.** \`details = extractOne(…)\` may have found nothing, so \`details.summary\` is refused, as TypeScript refuses it under strict null checks. Read it with \`details?.summary\`, which is \`text | absent\`: absent when \`details\` is, so \`details?.summary == null\` holds then. Or test \`exists(details)\` (or \`details != null\`) first and read \`details.summary\` after. \`details?.summary != null\` proves \`details\` and \`details.summary\` present, so \`details.summary\` can be compared or written after it. A graph literal's required field refuses such a value too: declare the field \`<text | null>\`, or fall back.
|
|
256
256
|
- **a typed extracted field, and a lookup by a computed key.** A \`<number>\`, \`<date>\`, \`<boolean>\` or set-of-values field of an \`extract\` is something the model was asked for and may not have found, so reading one is \`T | absent\` — a write field takes it with the \`?:\` fill rather than plainly. A text field is never absent: one the model did not find reads as \`""\`, so test it with \`!= ""\` — a null test on it is refused. Annotate it \`<text | null>\` to have a missing one arrive null instead: it is then \`text | absent\` like the rest, and a null test narrows it. \`d[key]\` with a key worked out at run time is the same: a key that is not there reads nothing.
|
|
257
257
|
|
|
258
258
|
Reading such a value is always fine, and so is interpolating it — it prints as nothing. Testing it needs no guard either. \`==\` and \`!=\` take it on either side: a missing value equals only \`null\`, so \`o.stage == "Seed"\` is false and \`o.stage != "Seed"\` true when the model found nothing. A condition takes a \`<boolean>\` that may be missing and reads a missing one as false — \`if (o.viable) { … }\`, \`o.viable ? a : b\`, \`a && o.viable\`, \`!o.viable\`.
|
|
@@ -268,7 +268,7 @@ Four things discharge it, and one of them always fits:
|
|
|
268
268
|
\`\`\`
|
|
269
269
|
|
|
270
270
|
- **Gate on it with a traversal.** A block headed by the landing runs only when the landing is there, and everything inside it knows so: \`q-[a:Response]-> { … }\`.
|
|
271
|
-
- **Test it with \`==\`.** Comparing against \`null\` (\`x == null\` / \`x != null\`) is the dedicated presence test, and the one place \`==\` is deliberately loose: \`null\` and absent mean the same thing here, so it's legal against *any* possibly-missing value. Comparing against a present value works too and narrows the same way (\`if (a.Answer == "pursue") { … }\` is legal even though \`a.Answer\` may be absent). Either way, the arm that took the comparison knows the value is present — and for \`== null\` used as a guard clause (\`if (x == null) { fail("…") }\`), so does everything **after** the \`if\`, not just the arm. A test on a field read off a bound record proves the record
|
|
271
|
+
- **Test it with \`==\`.** Comparing against \`null\` (\`x == null\` / \`x != null\`) is the dedicated presence test, and the one place \`==\` is deliberately loose: \`null\` and absent mean the same thing here, so it's legal against *any* possibly-missing value. Comparing against a present value works too and narrows the same way (\`if (a.Answer == "pursue") { … }\` is legal even though \`a.Answer\` may be absent). Either way, the arm that took the comparison knows the value is present — and for \`== null\` used as a guard clause (\`if (x == null) { fail("…") }\`), so does everything **after** the \`if\`, not just the arm. A test on a field read off a bound record proves the record and the field (\`if (channel?.Topic != null)\`), so that arm may write off \`channel\` and read \`channel.Topic\`. A test proves the whole path, as TypeScript's does: \`c.Previous.Score != null\` proves \`c.Previous.Score\`, and a field of \`c.Previous\` that has no test of its own stays refused. A call written to the right of a test is checked under it, since a run reaches the call only when the test held: \`exists(c.Previous) && shout(c.Previous.Stage)\`. The value-level form \`x != null ? … : …\` narrows only its first branch. See *narrowing-past-a-guard* in the branching chapter.
|
|
272
272
|
- **Fall back with \`coalesce\`.** \`coalesce(a, b)\` answers the first of its arguments that has a value, so the moment one of them always does — a literal, or anything already known to be there — the result always does too: \`Name: coalesce(only(msg-[:Attachments]->.Name), "no attachment")\`. A \`coalesce\` whose arguments might *all* be empty is itself possibly-empty and is refused in the same places, so the one-argument form discharges nothing at all.
|
|
273
273
|
|
|
274
274
|
For a list that may hold absent members, drop them (\`List.sum(List.compact(xs))\`) or fill them (\`List.sum(map(xs, (x) => coalesce(x, 0)))\`) before folding.
|
|
@@ -697,6 +697,52 @@ function \`Gather\`(m: <inbox-[:Emails]->>, n: <number>) {
|
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
+
`,
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
construct: 'a test through ?. proves the field it reads, a held record bound to a name too',
|
|
704
|
+
status: 'runs',
|
|
705
|
+
probe: `
|
|
706
|
+
hr = connect \`@lf/airtable\` using hiring
|
|
707
|
+
|
|
708
|
+
function \`Strong\`(c: <hr-[:Candidate Changes]->>) {
|
|
709
|
+
held = c.Previous
|
|
710
|
+
if (held?.Score != null) {
|
|
711
|
+
strong = held.Score > 3
|
|
712
|
+
}
|
|
713
|
+
if (exists(c.Current?.Score)) {
|
|
714
|
+
now = c.Current.Score > 3
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
`,
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
construct: 'exists(c.Previous) && c.Previous.Stage, and a field of the held record tested in the same condition',
|
|
721
|
+
status: 'runs',
|
|
722
|
+
probe: `
|
|
723
|
+
hr = connect \`@lf/airtable\` using hiring
|
|
724
|
+
|
|
725
|
+
function \`Moved\`(c: <hr-[:Candidate Changes]->>) {
|
|
726
|
+
from_applied = exists(c.Previous) && c.Previous.Stage == "Applied"
|
|
727
|
+
not_interview = !exists(c.Previous) || c.Previous.Stage != "Interview"
|
|
728
|
+
was_strong = exists(c.Previous) && c.Previous.Score != null && c.Previous.Score > 3
|
|
729
|
+
}
|
|
730
|
+
`,
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
construct: 'a call to the right of a test sees what the test proved',
|
|
734
|
+
status: 'runs',
|
|
735
|
+
probe: `
|
|
736
|
+
hr = connect \`@lf/airtable\` using hiring
|
|
737
|
+
|
|
738
|
+
function shout(s: <text>) {
|
|
739
|
+
return Text.upper(s)
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function \`Loud\`(c: <hr-[:Candidate Changes]->>) {
|
|
743
|
+
was_loud = exists(c.Previous) && shout(c.Previous.Stage) == "APPLIED"
|
|
744
|
+
label = exists(c.Current) ? shout(c.Current.Stage) : ""
|
|
745
|
+
}
|
|
700
746
|
`,
|
|
701
747
|
},
|
|
702
748
|
],
|
|
@@ -155,14 +155,14 @@ fail("unexpected record kind") # abort the whole run with a re
|
|
|
155
155
|
n = only(company-[t:Notes WHERE t.Title == "Brief"]->) # T | absent — a lookup that might match nothing
|
|
156
156
|
d = first(company.Domains) # T | absent — same, over a field
|
|
157
157
|
t = n?.Title # reads through n: absent when n is
|
|
158
|
-
if (n?.Title != null) { … } # proves n present INSIDE this arm
|
|
158
|
+
if (n?.Title != null) { … } # proves n and n.Title present INSIDE this arm
|
|
159
159
|
if (n == null) { fail("no notes found") } # guard clause — n is present for every line after
|
|
160
160
|
if (n != null) { … } # narrows n present INSIDE this arm only
|
|
161
161
|
x = d != null ? "\${d}" : "" # narrows d present in the true arm only
|
|
162
162
|
Field ?: d # '?:' takes a maybe-absent value, no guard needed
|
|
163
163
|
\`\`\`
|
|
164
164
|
|
|
165
|
-
\`first\`/\`List.last\`/\`List.min\`/\`List.max\`/\`xs[n]\` over anything that can come up empty, and a named \`match\` that found nothing, type \`T | absent\`. Using such a value where a present one is required — a write or traversal target, a field read with \`.\`, an ordered comparison (\`<\` \`<=\` \`>\` \`>=\`) — is refused until narrowed, naming the fix. \`==\`/\`!=\` against \`null\` is the presence test (loose: \`null\` and absent mean the same thing); against any other value a maybe-absent side needs no guard (absent is never equal to a present value), and a condition (\`if\`, \`? :\`, \`&&\`/\`||\`/\`!\`) reads a missing boolean as false. Both sides must still match in kind. \`exists(…)\` takes related records (\`exists(msg-[:Attachments]->)\`) or a value (\`exists(x)\`, \`exists(x?.Field)\`: the same test as \`x?.Field != null\`); \`x != null\` and \`x == null\` take a bound name or a field read off one, and a proven field proves the record it came off. A field may hold a record, a value read with \`.\` (\`c.Current.Stage\`): it has fields only, no edges, and the record as it is now is reached by its edge (\`c-[:Record]->\`). A field is never read with \`.\` through a value that may be absent: any of the above, a call's result (\`only(…).F\`), an index read (\`xs[0].F\`), a change's row (\`c.Previous\` is absent on a created row) or a map member. Read it with \`?.\` (\`n?.Title\`, \`c.Previous?.Stage\`), absent when the value is, or test it first: \`exists(c.Previous) && c.Previous.Stage == "Applied"\`, \`!exists(c.Previous) || c.Previous.Stage != "Interview"\`, or inside \`if (exists(c.Previous)) { … }\`. A test of an index read at a literal (\`exists(xs[0])\`) proves every later \`xs[0]\`. A WHERE writes them \`AND\`, \`OR\`, \`NOT\`.
|
|
165
|
+
\`first\`/\`List.last\`/\`List.min\`/\`List.max\`/\`xs[n]\` over anything that can come up empty, and a named \`match\` that found nothing, type \`T | absent\`. Using such a value where a present one is required — a write or traversal target, a field read with \`.\`, an ordered comparison (\`<\` \`<=\` \`>\` \`>=\`) — is refused until narrowed, naming the fix. \`==\`/\`!=\` against \`null\` is the presence test (loose: \`null\` and absent mean the same thing); against any other value a maybe-absent side needs no guard (absent is never equal to a present value), and a condition (\`if\`, \`? :\`, \`&&\`/\`||\`/\`!\`) reads a missing boolean as false. Both sides must still match in kind. \`exists(…)\` takes related records (\`exists(msg-[:Attachments]->)\`) or a value (\`exists(x)\`, \`exists(x?.Field)\`: the same test as \`x?.Field != null\`); \`x != null\` and \`x == null\` take a bound name or a field read off one, and a proven field proves the record it came off, as a proven record proves the path to it (\`c.Previous.Score != null\`). A call to the right of a test (\`exists(c.Previous) && f(c.Previous.Stage)\`) is checked under it. A field may hold a record, a value read with \`.\` (\`c.Current.Stage\`): it has fields only, no edges, and the record as it is now is reached by its edge (\`c-[:Record]->\`). A field is never read with \`.\` through a value that may be absent: any of the above, a call's result (\`only(…).F\`), an index read (\`xs[0].F\`), a change's row (\`c.Previous\` is absent on a created row) or a map member. Read it with \`?.\` (\`n?.Title\`, \`c.Previous?.Stage\`), absent when the value is, or test it first: \`exists(c.Previous) && c.Previous.Stage == "Applied"\`, \`!exists(c.Previous) || c.Previous.Stage != "Interview"\`, or inside \`if (exists(c.Previous)) { … }\`. A test of an index read at a literal (\`exists(xs[0])\`) proves every later \`xs[0]\`. A WHERE writes them \`AND\`, \`OR\`, \`NOT\`.
|
|
166
166
|
|
|
167
167
|
### listeners
|
|
168
168
|
|
|
@@ -253,7 +253,7 @@ Content is a list (shared content first, record-specific content last, so repeat
|
|
|
253
253
|
- **Expecting one extraction per piece from a list.** \`extract(pieces, Shape)\` reads them all as a single job; \`map(pieces, (p) => extract([p], Shape))\` is the per-piece form.
|
|
254
254
|
- **Verifying from the target system only.** The run record shows what was sent and why; read provenance before editing the automation.
|
|
255
255
|
- **Using a maybe-absent value unguarded.** A write/traversal target, a link end, a field read with \`.\`, or an ordered comparison off a \`first\`/\`List.last\`/\`List.min\`/\`List.max\`/\`xs[n]\` result or a named \`match\` is refused until narrowed — guard with \`if (x == null) { fail(…) }\` (or an \`else\` arm), \`x != null\`, or \`?:\` on the write field, or read the field with \`x?.Field\`.
|
|
256
|
-
- **Binding a field just to test it.** \`x.Field != null\` reads the field directly (\`x?.Field != null\` when \`x\` may be absent, which proves \`x\` present
|
|
256
|
+
- **Binding a field just to test it.** \`x.Field != null\` reads the field directly (\`x?.Field != null\` when \`x\` may be absent, which proves \`x\` and \`x.Field\` present); no intermediate binding.
|
|
257
257
|
- **Keeping a closure as data.** A closure lives in a variable or a parameter, or is passed as an argument where it is written (\`map(xs, (x) => …)\`, \`all(f, g)\`). In a list, under a key, in a field or as what a \`map\` returns it is refused when you save.
|
|
258
258
|
- **Calling something that may not be a function.** A name is called when its type shows it is a closure (\`g = label\` then \`g()\`, a closure-typed parameter); a value that may be something else is refused when you save.`,
|
|
259
259
|
};
|
package/dist/testing.js
CHANGED
|
@@ -76,6 +76,7 @@ const CREDENTIAL_ADAPTERS = {
|
|
|
76
76
|
team_whatsapp: 'whatsapp',
|
|
77
77
|
my_github: 'github',
|
|
78
78
|
my_slack: 'slack',
|
|
79
|
+
hiring: 'airtable',
|
|
79
80
|
};
|
|
80
81
|
/**
|
|
81
82
|
* The package each captured adapter is installed from, which a `connect`
|
|
@@ -93,6 +94,7 @@ const CAPTURED_PACKAGES = {
|
|
|
93
94
|
github: '@lf/github',
|
|
94
95
|
forms: '@lf/forms',
|
|
95
96
|
gmail: '@lf/gmail',
|
|
97
|
+
airtable: '@lf/airtable',
|
|
96
98
|
};
|
|
97
99
|
const EMAIL_CLAIM = { kind: 'branded', of: 'text', brands: ['claim:email/address'] };
|
|
98
100
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listen-fire/handbook",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.1",
|
|
5
5
|
"description": "The movement language's handbook: the hand-written chapters, the front page, the routes into them and the language search over them. A host adds its own systems' and plugins' sections on top (the platform assembles system:* and plugin:* chapters). `testing` is the catalog every shown example is checked against, for a host's tests of its own sections.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22.23.4 <23"
|