@listen-fire/handbook 0.13.0 → 0.13.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.
- package/dist/chapters/anatomy.js +30 -71
- package/dist/chapters/asks.js +80 -157
- package/dist/chapters/branching.js +11 -29
- package/dist/chapters/builtins.js +17 -44
- package/dist/chapters/expressions.js +38 -97
- package/dist/chapters/extraction.js +19 -45
- package/dist/chapters/foundations.js +5 -4
- package/dist/chapters/listeners.js +6 -12
- package/dist/chapters/patterns.js +24 -49
- package/dist/chapters/reference.js +6 -7
- package/dist/chapters/traversal.js +17 -38
- package/dist/chapters/use_cases.js +2 -5
- package/dist/chapters/writes.js +30 -74
- package/dist/front_page.js +6 -9
- package/dist/language_search.js +1 -1
- package/dist/prose_rules.js +1 -1
- package/dist/testing.js +20 -1
- package/package.json +1 -1
package/dist/chapters/anatomy.js
CHANGED
|
@@ -9,11 +9,8 @@ exports.anatomy = {
|
|
|
9
9
|
Write a file (extension \`.mvt\`) in four passes, top to bottom: imports, constructions, declarations, entry points.
|
|
10
10
|
|
|
11
11
|
\`\`\`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
inbox = connect email
|
|
16
|
-
crm = connect attio using acme_main
|
|
12
|
+
inbox = connect \`@lf/email\`
|
|
13
|
+
crm = connect \`@lf/attio\` using acme_main
|
|
17
14
|
|
|
18
15
|
function \`Inbound Intake\`(msg: <inbox-[:Emails]->>) {
|
|
19
16
|
write crm-[:Companies]-> {
|
|
@@ -25,21 +22,17 @@ function \`Inbound Intake\`(msg: <inbox-[:Emails]->>) {
|
|
|
25
22
|
listen to inbox-[e:Emails WHERE e.Key == "intake"]-> fire \`Inbound Intake\`
|
|
26
23
|
\`\`\`
|
|
27
24
|
|
|
28
|
-
Imports name
|
|
25
|
+
Imports name the plugins and the other files' declarations the file uses; \`connect\` turns a system, named by its adapter, into the concrete graph ("instance") you read and write; declarations hold the automations, record structures, and file-scope values; \`listen\` lines wire an automation to what fires it (see the listeners chapter). Comments start with \`#\`.
|
|
29
26
|
|
|
30
27
|
### imports
|
|
31
28
|
|
|
32
|
-
Import from
|
|
29
|
+
Import from two sources, one mechanism:
|
|
33
30
|
|
|
34
31
|
\`\`\`
|
|
35
|
-
import { \`@lf/attio\` as attio, \`@lf/email\` as email } from adapters
|
|
36
|
-
import { acme_main } from credentials
|
|
37
32
|
import { fetchUrl } from plugins
|
|
38
33
|
import { \`Log Lead\`, Lead as \`Inbound Lead\` } from "lib/intake-routines"
|
|
39
34
|
\`\`\`
|
|
40
35
|
|
|
41
|
-
- \`adapters\` — adapter *types*, the kinds of system you can construct.
|
|
42
|
-
- \`credentials\` — your workspace's stored connections, by name, named only after \`using\` in a \`connect\`.
|
|
43
36
|
- \`plugins\` — functions the platform ships, called as a function is, by position, with any other inputs in one settings record last: \`page = fetchUrl(c.website)\`, \`deck = fetchUrl(o.deck_url, { email: @user_email })\`.
|
|
44
37
|
- A quoted path — automations and record structures from another saved file. Only declarations it marks \`export\` are importable, and \`as\` renames locally.
|
|
45
38
|
|
|
@@ -47,11 +40,11 @@ The quoted path is the other file's saved name, matched exactly — no folders,
|
|
|
47
40
|
|
|
48
41
|
### constructions
|
|
49
42
|
|
|
50
|
-
\`connect\` an adapter
|
|
43
|
+
\`connect\` an adapter to get an instance — the graph you actually read and write. Name the adapter and your workspace's stored connection (its credential) right there; neither is imported:
|
|
51
44
|
|
|
52
45
|
\`\`\`
|
|
53
|
-
crm = connect attio using acme_main
|
|
54
|
-
inbox = connect email
|
|
46
|
+
crm = connect \`@lf/attio\` using acme_main
|
|
47
|
+
inbox = connect \`@lf/email\`
|
|
55
48
|
\`\`\`
|
|
56
49
|
|
|
57
50
|
A credential is only ever named after \`using\`; the host resolves it when the instance is used. It is never a value: read anywhere else (bound to a name, in a string, compared, passed on) it is refused. A credential is typed: an Attio credential cannot connect a Slack instance. Some sources need no credential and connect without \`using\`. Which record types and fields an instance offers depends on the workspace behind the credentials, so the schema is only known once it is connected. A connection is made at file scope only. A \`node\` you declare needs no connection: it names a structure, not a system.
|
|
@@ -59,7 +52,7 @@ A credential is only ever named after \`using\`; the host resolves it when the i
|
|
|
59
52
|
Every connection takes \`dryRun\` as well:
|
|
60
53
|
|
|
61
54
|
\`\`\`
|
|
62
|
-
crm = connect attio using acme_main { dryRun: true }
|
|
55
|
+
crm = connect \`@lf/attio\` using acme_main { dryRun: true }
|
|
63
56
|
\`\`\`
|
|
64
57
|
|
|
65
58
|
Writes to a dry-run instance are rehearsed — captured and reported instead of committed. Three traps:
|
|
@@ -335,11 +328,8 @@ function team_size(name: <text>, people: <{ name: text, manager: text }[]>): <nu
|
|
|
335
328
|
construct: 'recursion: a function calling itself from inside a map, with a declared return type',
|
|
336
329
|
status: 'runs',
|
|
337
330
|
probe: `
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
inbox = connect email
|
|
342
|
-
crm = connect attio using acme
|
|
331
|
+
inbox = connect \`@lf/email\`
|
|
332
|
+
crm = connect \`@lf/attio\` using acme
|
|
343
333
|
|
|
344
334
|
function team_size(name: <text>, people: <{ name: text, manager: text }[]>): <number> {
|
|
345
335
|
reports = filter(people, (p) => p.manager == name)
|
|
@@ -365,11 +355,8 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
365
355
|
construct: 'function calls (composition) with a graph<Shape> argument built in place',
|
|
366
356
|
status: 'runs',
|
|
367
357
|
probe: `
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
inbox = connect email
|
|
372
|
-
crm = connect attio using acme
|
|
358
|
+
inbox = connect \`@lf/email\`
|
|
359
|
+
crm = connect \`@lf/attio\` using acme
|
|
373
360
|
|
|
374
361
|
node Lead {
|
|
375
362
|
Name: <text>
|
|
@@ -391,11 +378,8 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
391
378
|
construct: "everything a run wrote, collected by returning each write's handle from map, then acted on member by member",
|
|
392
379
|
status: 'runs',
|
|
393
380
|
probe: `
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
inbox = connect email
|
|
398
|
-
chat = connect slack using team_workspace
|
|
381
|
+
inbox = connect \`@lf/email\`
|
|
382
|
+
chat = connect \`@lf/slack\` using team_workspace
|
|
399
383
|
|
|
400
384
|
function \`Post And Confirm\`(msg: <inbox-[:Emails]->>) {
|
|
401
385
|
deals = only(chat-[ch:Channels WHERE ch.Name == "deals"]->)
|
|
@@ -416,11 +400,8 @@ listen to inbox-[e:Emails WHERE e.Key == "intake"]-> fire \`Post And Confirm\`
|
|
|
416
400
|
construct: "a call's value — what the callee returned, bound and passed on",
|
|
417
401
|
status: 'runs',
|
|
418
402
|
probe: `
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
inbox = connect email
|
|
423
|
-
crm = connect attio using acme
|
|
403
|
+
inbox = connect \`@lf/email\`
|
|
404
|
+
crm = connect \`@lf/attio\` using acme
|
|
424
405
|
|
|
425
406
|
node Lead {
|
|
426
407
|
Name: <text>
|
|
@@ -448,11 +429,8 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
448
429
|
construct: 'a returned graph carrying several results — one entry read by dot, one walked as an edge',
|
|
449
430
|
status: 'runs',
|
|
450
431
|
probe: `
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
inbox = connect email
|
|
455
|
-
crm = connect attio using acme
|
|
432
|
+
inbox = connect \`@lf/email\`
|
|
433
|
+
crm = connect \`@lf/attio\` using acme
|
|
456
434
|
|
|
457
435
|
node Doc {
|
|
458
436
|
title: <text>
|
|
@@ -482,11 +460,8 @@ function \`Intake\`(msg: <inbox-[:Emails]->>) {
|
|
|
482
460
|
construct: 'multi-parameter library functions (any arity by call; entries stay arity-1)',
|
|
483
461
|
status: 'runs',
|
|
484
462
|
probe: `
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
inbox = connect email
|
|
489
|
-
crm = connect attio using acme
|
|
463
|
+
inbox = connect \`@lf/email\`
|
|
464
|
+
crm = connect \`@lf/attio\` using acme
|
|
490
465
|
|
|
491
466
|
node Lead {
|
|
492
467
|
Name: <text>
|
|
@@ -513,11 +488,8 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
513
488
|
construct: 'a graph literal TREE — a single synthesised edge, traversed by the callee',
|
|
514
489
|
status: 'runs',
|
|
515
490
|
probe: `
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
inbox = connect email
|
|
520
|
-
crm = connect attio using acme
|
|
491
|
+
inbox = connect \`@lf/email\`
|
|
492
|
+
crm = connect \`@lf/attio\` using acme
|
|
521
493
|
|
|
522
494
|
node Deal {
|
|
523
495
|
Title: <text>
|
|
@@ -545,11 +517,8 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
545
517
|
construct: 'a graph literal child built per record on a path (renamed landings)',
|
|
546
518
|
status: 'runs',
|
|
547
519
|
probe: `
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
inbox = connect email
|
|
552
|
-
crm = connect attio using acme
|
|
520
|
+
inbox = connect \`@lf/email\`
|
|
521
|
+
crm = connect \`@lf/attio\` using acme
|
|
553
522
|
|
|
554
523
|
node Doc {
|
|
555
524
|
Title: <text>
|
|
@@ -577,9 +546,6 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
577
546
|
construct: 'a write into a nested node of a typed empty graph the run built',
|
|
578
547
|
status: 'runs',
|
|
579
548
|
probe: `
|
|
580
|
-
import { \`@lf/manual\` as manual } from adapters
|
|
581
|
-
|
|
582
|
-
runs = connect manual
|
|
583
549
|
|
|
584
550
|
node Company: "each company named in the supplied text" {
|
|
585
551
|
name: <text> "the company's name"
|
|
@@ -593,7 +559,7 @@ node Found {
|
|
|
593
559
|
}
|
|
594
560
|
}
|
|
595
561
|
|
|
596
|
-
function \`Dedupe\`(go: <
|
|
562
|
+
function \`Dedupe\`(go: <manual-[:Invocation]->>) {
|
|
597
563
|
deduped = graph<Found> {}
|
|
598
564
|
|
|
599
565
|
map(extract([go.Text], Company), (c) => {
|
|
@@ -614,10 +580,9 @@ function \`Dedupe\`(go: <runs-[:Invocation]->>) {
|
|
|
614
580
|
construct: 'file imports (shared movement libraries)',
|
|
615
581
|
status: 'runs',
|
|
616
582
|
probe: `
|
|
617
|
-
import { \`@lf/email\` as email } from adapters
|
|
618
583
|
import { \`Log Lead\` } from "lib/intake-routines"
|
|
619
584
|
|
|
620
|
-
inbox = connect email
|
|
585
|
+
inbox = connect \`@lf/email\`
|
|
621
586
|
|
|
622
587
|
function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
623
588
|
\`Log Lead\`(m)
|
|
@@ -628,11 +593,8 @@ function \`Intake\`(m: <inbox-[:Emails]->>) {
|
|
|
628
593
|
construct: 'graph literals — graph<Shape> with path-with-field-body children, a bare-path reference, and a spread of a map',
|
|
629
594
|
status: 'runs',
|
|
630
595
|
probe: `
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
inbox = connect email
|
|
635
|
-
crm = connect attio using acme
|
|
596
|
+
inbox = connect \`@lf/email\`
|
|
597
|
+
crm = connect \`@lf/attio\` using acme
|
|
636
598
|
|
|
637
599
|
node Message {
|
|
638
600
|
Body: <text>
|
|
@@ -674,11 +636,8 @@ function \`Snapshot\`(m: <inbox-[:Emails]->>) {
|
|
|
674
636
|
construct: 'function convention — positional calls, value and record parameters, exact-case names',
|
|
675
637
|
status: 'runs',
|
|
676
638
|
probe: `
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
inbox = connect email
|
|
681
|
-
crm = connect attio using acme
|
|
639
|
+
inbox = connect \`@lf/email\`
|
|
640
|
+
crm = connect \`@lf/attio\` using acme
|
|
682
641
|
|
|
683
642
|
function \`Label\`(name: <text>, tags: <text[]>, cfg: <{ prefix: text, suffix?: text }>) {
|
|
684
643
|
return "\${cfg.prefix}\${name} (\${Text.join(tags, ", ")})"
|