@listen-fire/engine-contracts 0.12.12 → 0.13.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.
- package/dist/adapter.d.ts +64 -180
- package/dist/arrivals.d.ts +75 -0
- package/dist/arrivals.js +9 -0
- package/dist/catalog.d.ts +387 -57
- package/dist/catalog.js +686 -78
- package/dist/config_blocks.d.ts +99 -0
- package/dist/config_blocks.js +76 -0
- package/dist/conformance/expression-samples.json +815 -0
- package/dist/conformance/index.d.ts +1 -0
- package/dist/conformance/index.js +3 -1
- package/dist/conformance/listen-arrivals.json +1683 -0
- package/dist/conformance/listen-field-names.json +47 -0
- package/dist/conformance/listen-hears.json +11 -0
- package/dist/conformance/listen-landings.json +98 -0
- package/dist/conformance/listen-pipelines.json +98 -0
- package/dist/conformance/listen_arrivals.d.ts +26 -0
- package/dist/conformance/listen_arrivals.js +34 -0
- package/dist/conformance/recording.d.ts +166 -128
- package/dist/conformance/recording.js +20 -12
- package/dist/conformance/store-waits.json +695 -0
- package/dist/conformance/taken-comparisons.json +911 -0
- package/dist/event.d.ts +26 -2
- package/dist/event.js +15 -2
- package/dist/expression/expression.js +17 -8
- package/dist/expression/schemas.d.ts +106 -74
- package/dist/expression/schemas.js +18 -2
- package/dist/file_ref.js +3 -0
- package/dist/host_families.d.ts +63 -10
- package/dist/host_families.js +2 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/listen_plan.d.ts +91 -0
- package/dist/listen_plan.js +52 -0
- package/dist/park_state.d.ts +19 -17
- package/dist/park_state.js +1 -1
- package/dist/protocol.d.ts +608 -201
- package/dist/protocol.js +249 -109
- package/dist/run_input.d.ts +5 -7
- package/dist/run_input.js +1 -1
- package/dist/slots/movements.d.ts +1 -1
- package/dist/slots/movements.js +2 -2
- package/dist/slots/secrets.d.ts +1 -1
- package/dist/slots/secrets.js +4 -4
- package/dist/slots/wire.d.ts +1 -1
- package/dist/slots/wire.js +1 -1
- package/dist/versions.d.ts +13 -12
- package/dist/versions.js +14 -8
- package/package.json +2 -2
- package/dist/awaitable.d.ts +0 -65
- package/dist/awaitable.js +0 -13
- package/dist/callback.d.ts +0 -24
- package/dist/callback.js +0 -19
- package/dist/trigger_config.d.ts +0 -154
- package/dist/trigger_config.js +0 -116
package/dist/adapter.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { ExternalRecordRef, FieldEvidence, Resource } from './records';
|
|
2
2
|
import type { TriggerEvent, TriggerType } from './event';
|
|
3
3
|
import type { MutationContext } from './mutation_context';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Arrival, ArrivalsCapability } from './arrivals';
|
|
5
5
|
import type { Actor } from './mutation_context';
|
|
6
6
|
import type { UniquenessConstraints } from './uniqueness';
|
|
7
|
-
import type { ConfigBlock } from './
|
|
7
|
+
import type { ConfigBlock } from './config_blocks';
|
|
8
8
|
import type { HandbookSection } from './handbook_section';
|
|
9
9
|
import type { WireCheckInboundInputShape } from './protocol';
|
|
10
10
|
import type { SchemaEntryPoint, SchemaTypeDescriptor, SourcePosition } from './catalog';
|
|
11
11
|
import type { Expression } from '@listen-fire/movement-lang/expression/types';
|
|
12
|
-
|
|
12
|
+
import type { SettingsBecome } from '@listen-fire/movement-lang';
|
|
13
|
+
export type { ConfigBlock } from './config_blocks';
|
|
13
14
|
export { fileDescriptorOf, fileHandle, fileValue, fileValueOf, filesAtType, isFileValue, ownedFileSource } from './file_ref';
|
|
14
15
|
export type { EarlierFileSource, FileRef, FileSource, FileValue } from './file_ref';
|
|
15
16
|
export type { ExternalRecordRef, Fact, FieldEvidence, Resource, ResourceProvenance } from './records';
|
|
@@ -213,29 +214,6 @@ export interface AdapterManifest {
|
|
|
213
214
|
* shipping something that can never fire. Absent ⇒ nothing missing.
|
|
214
215
|
*/
|
|
215
216
|
configurationGap?: string;
|
|
216
|
-
/**
|
|
217
|
-
* Config BLOCKS rendered for this adapter's TRIGGER role — the per-trigger
|
|
218
|
-
* config on the automation detail page. An ordered {@link ConfigBlock} list:
|
|
219
|
-
* value blocks (input/slug/select) collect values that persist to
|
|
220
|
-
* `automations.trigger.config`; presentation blocks (section) frame them; an
|
|
221
|
-
* action block (rare here) dispatches to an app handler. Carried on the
|
|
222
|
-
* manifest so construction-free readers (the movement catalog's listen
|
|
223
|
-
* vocabulary, provisioning, the adapters/trigger views) can see it without
|
|
224
|
-
* building the adapter. The adapter instance's `triggerConfig` references it.
|
|
225
|
-
*
|
|
226
|
-
* This is the widened successor to the former `triggerConfigSchema`
|
|
227
|
-
* (`TriggerConfigField[]`) — value blocks ARE that union; section/action are
|
|
228
|
-
* the new arms. It is also where an adapter declares its INBOUND ROUTING KEY
|
|
229
|
-
* (a value block marked `routingKey`) — the de-named successor to the former
|
|
230
|
-
* `inboundChannel: 'forwarding-address'` flag. An adapter whose events arrive
|
|
231
|
-
* addressed by a key (email's plus-suffix `key`) declares that block here,
|
|
232
|
-
* and the framework routes generically off the declaration; there is no named
|
|
233
|
-
* "forwarding address" concept in the engine.
|
|
234
|
-
*
|
|
235
|
-
* Omitted ⇒ the adapter's trigger role needs no user-editable config.
|
|
236
|
-
*
|
|
237
|
-
*/
|
|
238
|
-
triggerConfig?: readonly ConfigBlock[];
|
|
239
217
|
/**
|
|
240
218
|
* Config BLOCKS rendered for this adapter's CONSTRUCTION role — shown at an
|
|
241
219
|
* adapter-instance slot in the movement editor (and the chat equivalent).
|
|
@@ -247,52 +225,15 @@ export interface AdapterManifest {
|
|
|
247
225
|
*/
|
|
248
226
|
construction?: readonly ConfigBlock[];
|
|
249
227
|
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* - subscription provisioning: `ensureEventSubscription` receives the
|
|
258
|
-
* union of the events the team's listens actually want.
|
|
259
|
-
* Omitted ⇒ the adapter declares no subscribable events (its channel is
|
|
260
|
-
* push-free or interpreted elsewhere — inbound email routed by its
|
|
261
|
-
* `key`, the web Send box).
|
|
262
|
-
*/
|
|
263
|
-
subscribableEvents?: readonly string[];
|
|
264
|
-
/**
|
|
265
|
-
* The `events:` selection a listen WITHOUT one is subscribed to — the
|
|
266
|
-
* adapter's own dispatch default, declared so the checker derives the same
|
|
267
|
-
* event type the runtime will deliver. WhatsApp is the motivating case: a
|
|
268
|
-
* config-less listen receives MESSAGES ONLY (`triggerAcceptsWhatsappKind`),
|
|
269
|
-
* so reactions/locations never fire a movement that didn't opt in — and the
|
|
270
|
-
* checker must not type a config-less listen as delivering them. Absent ⇒
|
|
271
|
-
* every subscribable event (the attio/airtable registration default).
|
|
272
|
-
*/
|
|
273
|
-
defaultSubscribedEvents?: readonly string[];
|
|
274
|
-
/**
|
|
275
|
-
* Listen-config keys whose VALUES jointly scope an external subscription
|
|
276
|
-
* channel, beyond the (adapter, credential) pair. Airtable's `['base',
|
|
277
|
-
* 'table']` is the motivating case: webhooks are per-(base, table), so two
|
|
278
|
-
* listens on different tables need distinct registrations. The listen
|
|
279
|
-
* reconciler folds these config values into the channel key (one
|
|
280
|
-
* `webhook_subscription` row + external webhook per distinct scope) and passes
|
|
281
|
-
* them as `EnsureEventSubscriptionInput.scope`. Omitted ⇒ one channel per
|
|
282
|
-
* (adapter, credential) — the Attio default.
|
|
283
|
-
*
|
|
284
|
-
*/
|
|
285
|
-
subscriptionScopeKeys?: readonly string[];
|
|
286
|
-
/**
|
|
287
|
-
* Additional listen routing-config keys this adapter declares, beyond
|
|
288
|
-
* the derived ones (the inbound routing `key` from `triggerConfigSchema`,
|
|
289
|
-
* the subscribable `events`). Each entry names the key, whether a listen MUST carry it,
|
|
290
|
-
* and an optional value format the checker validates statically
|
|
291
|
-
* (`'cron'` — a five-field cron expression, see movement-lang/cron).
|
|
292
|
-
* The cron adapter's `schedule` is the motivating case:
|
|
293
|
-
* `listen to timer { schedule: "0 9 * * 1" } fire digest`.
|
|
228
|
+
* What a 0.12 settings listen on this module becomes as a traversal in 0.13
|
|
229
|
+
* (`listen to x { events: [...] }` → `listen to x-[n:Notifications WHERE
|
|
230
|
+
* n.Reason IN [...]]->`): the edges from the connection to the listened
|
|
231
|
+
* edge, an alias per hop, the 0.12 event position a fired parameter was
|
|
232
|
+
* typed as, and the hop and field each settings key narrows.
|
|
233
|
+
* `listen-fire upgrade` rewrites a settings listen by it; a key it does not
|
|
234
|
+
* map leaves the listen for the author.
|
|
294
235
|
*/
|
|
295
|
-
|
|
236
|
+
listenSettingsBecome?: SettingsBecome;
|
|
296
237
|
/**
|
|
297
238
|
* Plain-language truth about WHAT a listener on this adapter actually fires
|
|
298
239
|
* on — surfaced to the authoring agent via `describeInstance` so it grounds
|
|
@@ -327,6 +268,12 @@ export interface AdapterManifest {
|
|
|
327
268
|
* describeInstance costs upstream API calls, so callers should scope with
|
|
328
269
|
* `types`. Absent/false = the schema is static and describing is free. */
|
|
329
270
|
introspectedSchema?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* How long, in seconds, the provider may re-send an arrival it already sent
|
|
273
|
+
* (Stripe retries an event for three days): the host drops a repeat inside
|
|
274
|
+
* it by identity. A default: lf.yaml overrides it per connection.
|
|
275
|
+
*/
|
|
276
|
+
resendWindowSeconds?: number;
|
|
330
277
|
/**
|
|
331
278
|
* Construction args that pick the instance's ENTRY POSITION — the node the
|
|
332
279
|
* cursor starts at, instead of the meta node (Sheets' `spreadsheet:`,
|
|
@@ -377,8 +324,8 @@ export interface EventPhraseTemplate {
|
|
|
377
324
|
}
|
|
378
325
|
/**
|
|
379
326
|
* The adapter's event-phrasing vocabulary — "When an email arrives at …",
|
|
380
|
-
* "When a record changes in Attio". Keyed by the adapter's own
|
|
381
|
-
*
|
|
327
|
+
* "When a record changes in Attio". Keyed by the adapter's own event
|
|
328
|
+
* names where it has discrete events (Attio's
|
|
382
329
|
* `record.created`, the KG's `create`); `default` is rendered when the
|
|
383
330
|
* config's selected events don't match a more specific key, or the adapter
|
|
384
331
|
* has no discrete event vocabulary at all (email, Slack — one implicit
|
|
@@ -404,79 +351,25 @@ interface PositionArg {
|
|
|
404
351
|
/** Author-facing label (defaults to `name`). */
|
|
405
352
|
label?: string;
|
|
406
353
|
}
|
|
407
|
-
/**
|
|
408
|
-
*
|
|
409
|
-
|
|
410
|
-
key: string;
|
|
411
|
-
/** A listen on this adapter must carry the key. */
|
|
412
|
-
required?: boolean;
|
|
413
|
-
/** Static value validation the movement checker applies. `'cron'` = a
|
|
414
|
-
* five-field cron expression; `'timezone'` = an IANA time-zone id;
|
|
415
|
-
* `'fields'` = a list of BARE property names, validated against the position
|
|
416
|
-
* the listen's address lands on (the changed-attribute filter — any adapter
|
|
417
|
-
* with a "only fire when one of these changed" surface declares it);
|
|
418
|
-
* `'strings'` = a non-empty list of non-empty quoted strings (Gmail's
|
|
419
|
-
* `labels`); `'type'` = a node the program declares (`payload: <Payment>`),
|
|
420
|
-
* which the listen's events are typed as; `'field'` = one quoted field name
|
|
421
|
-
* of the record the listen's address lands on; `'field-value'` = a literal
|
|
422
|
-
* value of the field the `'field'`-format key names, held to that field's
|
|
423
|
-
* type (an adapter declaring it declares exactly one `'field'` key). */
|
|
424
|
-
format?: 'cron' | 'timezone' | 'fields' | 'strings' | 'type' | 'field' | 'field-value';
|
|
425
|
-
/**
|
|
426
|
-
* This key is one HOP of the address that narrows the event's record edge.
|
|
427
|
-
*
|
|
428
|
-
* A listen is shorthand for a WHERE. `listen to at { base: "appDevLoop",
|
|
429
|
-
* table: "tblDeals" }` says which table the event's `record` edge lands on,
|
|
430
|
-
* so the author must not have to restate it in the movement — the config IS
|
|
431
|
-
* the address.
|
|
432
|
-
*
|
|
433
|
-
* The keys that declare `narrows` form a PATH, in declaration order, each hop
|
|
434
|
-
* selecting a member of `collection` whose published data has `matchField`
|
|
435
|
-
* equal to the config value:
|
|
436
|
-
*
|
|
437
|
-
* -[:Base WHERE `Id` == "appDevLoop"]->-[:Table WHERE `Id` == "tblDeals"]->
|
|
438
|
-
*
|
|
439
|
-
* A path, NOT one hop with a compound WHERE — that is the whole cost
|
|
440
|
-
* argument. Read as one hop, "narrowed by (base, table)" must know the valid
|
|
441
|
-
* (base, table) pairs, which is a `listTables` per base: the 1+N this plan
|
|
442
|
-
* exists to kill. As a path the base resolves first (1 call) and only THAT
|
|
443
|
-
* base's tables are walked (1 call).
|
|
444
|
-
*
|
|
445
|
-
* The final hop's `collection` is the type the record edge narrows FROM —
|
|
446
|
-
* an event edge targeting it is retargeted at whatever the walk landed on.
|
|
447
|
-
*
|
|
448
|
-
*/
|
|
449
|
-
narrows?: {
|
|
450
|
-
/** The meta-graph collection whose members this hop selects from
|
|
451
|
-
* (Airtable's `Base`, then `Table`). */
|
|
452
|
-
collection: string;
|
|
453
|
-
/** The field of a member's PUBLISHED DATA the config value is matched
|
|
454
|
-
* against. A listen names things by ID while type-space addresses by NAME,
|
|
455
|
-
* so this is normally the id field — and the adapter must publish it on
|
|
456
|
-
* the member's position or nothing can narrow. */
|
|
457
|
-
matchField: string;
|
|
458
|
-
};
|
|
459
|
-
}
|
|
354
|
+
/** A subscription for one listenable edge's arrivals (adapter protocol
|
|
355
|
+
* 2.6), made once for every listen on the same connection, edge, filter and
|
|
356
|
+
* scope, when the edge declares `delivery: connection` or `scope`. */
|
|
460
357
|
export interface EnsureEventSubscriptionInput {
|
|
461
|
-
/** The
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
358
|
+
/** The edge, by its name in the schema (`Notes`). */
|
|
359
|
+
edge: string;
|
|
360
|
+
/** The part of the listens' WHERE on the edge the adapter takes; absent
|
|
361
|
+
* when it takes none of it. */
|
|
362
|
+
filter?: unknown;
|
|
363
|
+
/** The record the edge hangs off, by its id, when the listens watch it
|
|
364
|
+
* under one; absent for the whole connection. */
|
|
365
|
+
scope?: string;
|
|
366
|
+
/** The stable per-subscription URL the source should POST to. */
|
|
466
367
|
callbackUrl: string;
|
|
467
|
-
/** The registration currently held for this URL, when one exists
|
|
468
|
-
*
|
|
368
|
+
/** The registration currently held for this URL, when one exists: keep
|
|
369
|
+
* it rather than adding another. */
|
|
469
370
|
current?: {
|
|
470
371
|
externalId?: string;
|
|
471
|
-
events: string[];
|
|
472
372
|
};
|
|
473
|
-
/**
|
|
474
|
-
* The channel's adapter-declared scope (the `subscriptionScopeKeys` config
|
|
475
|
-
* values) — e.g. Airtable's `{ base, table }`. Empty/absent for adapters
|
|
476
|
-
* whose channel is just (adapter, credential). The adapter reads what it
|
|
477
|
-
* declared; the reconciler passes it through opaquely.
|
|
478
|
-
*/
|
|
479
|
-
scope?: Record<string, string>;
|
|
480
373
|
}
|
|
481
374
|
/** What the source issued — the platform persists it on the subscription
|
|
482
375
|
* row (the secret verifies inbound signatures). Returning `undefined`
|
|
@@ -494,7 +387,7 @@ export interface EventSubscriptionRegistration {
|
|
|
494
387
|
export interface RefreshEventSubscriptionInput {
|
|
495
388
|
/** The source-issued id of the subscription to extend. */
|
|
496
389
|
externalId: string;
|
|
497
|
-
/**
|
|
390
|
+
/** A 0.12 settings listen's webhook's scope (Airtable's `{ base, table }`). */
|
|
498
391
|
scope?: Record<string, string>;
|
|
499
392
|
}
|
|
500
393
|
/** A refreshed subscription: when it now expires, when the source says. */
|
|
@@ -505,22 +398,22 @@ export interface RemoveEventSubscriptionInput {
|
|
|
505
398
|
callbackUrl: string;
|
|
506
399
|
/** The source-issued id held for this URL, when one exists. */
|
|
507
400
|
externalId?: string;
|
|
508
|
-
/**
|
|
509
|
-
*
|
|
510
|
-
*
|
|
401
|
+
/** A 0.12 settings listen's webhook's adapter-declared scope: Airtable's
|
|
402
|
+
* per-base delete needs the `base` to address the webhook. Absent for
|
|
403
|
+
* unscoped channels. */
|
|
511
404
|
scope?: Record<string, string>;
|
|
512
405
|
}
|
|
513
406
|
export interface Adapter {
|
|
514
407
|
/** Stable identifier — matches `MutationContext.source.adapterType`. */
|
|
515
408
|
readonly adapterType: string;
|
|
516
409
|
/**
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
410
|
+
* Arrivals (adapter protocol 2.5) — present on adapters with listenable
|
|
411
|
+
* edges. It names the key each record's edge is waited on under; what
|
|
412
|
+
* lands there the adapter reports with the inbound delivery it read
|
|
413
|
+
* (`preprocessInbound`'s or `checkInbound`'s `arrivals`) or at the `wake`
|
|
414
|
+
* door. The host keeps the waits and the log of arrivals.
|
|
522
415
|
*/
|
|
523
|
-
readonly
|
|
416
|
+
readonly arrivals?: ArrivalsCapability;
|
|
524
417
|
/**
|
|
525
418
|
* Triggers this adapter declares it can fire (P11). Poll is universal
|
|
526
419
|
* fallback, not framework default. Snapshot/changes-feed/webhook/mutation
|
|
@@ -634,23 +527,11 @@ export interface Adapter {
|
|
|
634
527
|
*/
|
|
635
528
|
readonly metaRecordType?: string;
|
|
636
529
|
/**
|
|
637
|
-
*
|
|
638
|
-
* {@link ConfigBlock} list a user's automation-detail form renders for a
|
|
639
|
-
* `automations.trigger` whose `kind` resolves to this adapter (e.g. the
|
|
640
|
-
* inbound-email forwarding-address framing + slug). One declaration drives
|
|
641
|
-
* the form, the write-path validation (`updateTriggerConfig`), and the
|
|
642
|
-
* runtime config-validity check. Pure config; omitted by adapters whose
|
|
643
|
-
* trigger role needs no user-editable settings. Mirrors the manifest's
|
|
644
|
-
* `triggerConfig`.
|
|
645
|
-
*
|
|
646
|
-
*/
|
|
647
|
-
readonly triggerConfig?: readonly ConfigBlock[];
|
|
648
|
-
/**
|
|
649
|
-
* Ensure the source system delivers the named events to `callbackUrl` —
|
|
530
|
+
* Ensure the source system delivers an edge's arrivals to `callbackUrl` —
|
|
650
531
|
* the listen-reconciliation seam (see the module-level event-subscription
|
|
651
|
-
* notes above `EnsureEventSubscriptionInput`). Idempotent: called
|
|
652
|
-
* the
|
|
653
|
-
*
|
|
532
|
+
* notes above `EnsureEventSubscriptionInput`). Idempotent: called each time
|
|
533
|
+
* the listens sharing the subscription change; the adapter keeps
|
|
534
|
+
* `current` where it is still registered.
|
|
654
535
|
* Implemented for real where the source has a subscription API (attio
|
|
655
536
|
* webhooks); a documented no-op (return undefined) where it doesn't;
|
|
656
537
|
* omitted where events need no external registration at all.
|
|
@@ -728,22 +609,14 @@ export interface Adapter {
|
|
|
728
609
|
checkpoint?: unknown;
|
|
729
610
|
}): Promise<{
|
|
730
611
|
events: DiscriminableEvent[];
|
|
612
|
+
/** What the delivery says landed on listenable edges (2.5). */
|
|
613
|
+
arrivals?: Arrival[];
|
|
731
614
|
checkpoint?: unknown;
|
|
732
615
|
}>;
|
|
733
|
-
/**
|
|
734
|
-
* The wake door, separate from `preprocessInbound`'s events: the correlation
|
|
735
|
-
* keys (as `awaitable.resolveAwait` names them when pending) that this raw
|
|
736
|
-
* inbound payload may have resolved. The engine resumes whatever is parked on
|
|
737
|
-
* them; a key nothing waits on is a no-op. No ordering against the events —
|
|
738
|
-
* a resumed await re-checks live, so it never relies on the payload.
|
|
739
|
-
*/
|
|
740
|
-
wakeKeys?(input: {
|
|
741
|
-
raw: unknown;
|
|
742
|
-
}): Promise<string[]>;
|
|
743
616
|
/**
|
|
744
617
|
* The module checks its own inbound requests (its manifest declares
|
|
745
618
|
* `inbound.scheme: module`): one request at its door, raw, in place of the
|
|
746
|
-
* host's signature check
|
|
619
|
+
* host's signature check and `preprocessInbound`. The answer is
|
|
747
620
|
* its events, a refusal, or a reply the host sends as it is (a handshake).
|
|
748
621
|
*/
|
|
749
622
|
checkInbound?(input: InboundCheckInput): Promise<InboundCheck>;
|
|
@@ -1572,22 +1445,33 @@ export type InboundCheckInput = WireCheckInboundInputShape;
|
|
|
1572
1445
|
export type InboundCheck = {
|
|
1573
1446
|
outcome: 'accepted';
|
|
1574
1447
|
events: DiscriminableEvent[];
|
|
1575
|
-
|
|
1448
|
+
/** What the request says landed on listenable edges (2.5). */
|
|
1449
|
+
arrivals?: Arrival[];
|
|
1576
1450
|
checkpoint?: unknown;
|
|
1577
1451
|
/** The provider's id for this delivery: a redelivery under an id the
|
|
1578
1452
|
* host kept before is acked and runs nothing. */
|
|
1579
1453
|
deliveryId?: string;
|
|
1454
|
+
/** What the door answers once the delivery is kept, in place of its
|
|
1455
|
+
* own acknowledgement: a 2xx with `text`, `html` or `json`. */
|
|
1456
|
+
reply?: {
|
|
1457
|
+
status: number;
|
|
1458
|
+
text?: string;
|
|
1459
|
+
html?: string;
|
|
1460
|
+
json?: unknown;
|
|
1461
|
+
};
|
|
1580
1462
|
}
|
|
1581
1463
|
/** The host answers `status` (401 when absent) with `signature_invalid`. */
|
|
1582
1464
|
| {
|
|
1583
1465
|
outcome: 'refused';
|
|
1584
1466
|
status?: number;
|
|
1585
1467
|
}
|
|
1586
|
-
/** Sent as it is, nothing run: `text` as text/plain, `
|
|
1468
|
+
/** Sent as it is, nothing run: `text` as text/plain, `html` as text/html,
|
|
1469
|
+
* `json` as JSON. */
|
|
1587
1470
|
| {
|
|
1588
1471
|
outcome: 'reply';
|
|
1589
1472
|
status: number;
|
|
1590
1473
|
text?: string;
|
|
1474
|
+
html?: string;
|
|
1591
1475
|
json?: unknown;
|
|
1592
1476
|
};
|
|
1593
1477
|
export interface ReadInput {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** A record a run waits on: the id its write answered, the data it
|
|
2
|
+
* carried (Slack keys a thread by the channel in it, not by its id), and its
|
|
3
|
+
* record type, as the module names it, wherever the host knows it (2.6). A
|
|
4
|
+
* module whose ids collide across its record types qualifies its keys by it,
|
|
5
|
+
* in the answer and in each arrival's `key` alike. */
|
|
6
|
+
export interface AwaitHead {
|
|
7
|
+
recordId: string;
|
|
8
|
+
headData?: Record<string, unknown>;
|
|
9
|
+
recordType?: string;
|
|
10
|
+
}
|
|
11
|
+
/** The key one head's edge is waited on under, or the record is gone and
|
|
12
|
+
* nothing more arrives on it. */
|
|
13
|
+
export type AwaitKey = {
|
|
14
|
+
key: string;
|
|
15
|
+
} | {
|
|
16
|
+
gone: true;
|
|
17
|
+
};
|
|
18
|
+
/** One landing along a listenable edge. Its `fields` are read back through
|
|
19
|
+
* the module's own `getFieldValue` for `recordType`. */
|
|
20
|
+
export interface AwaitLanding {
|
|
21
|
+
recordId?: string;
|
|
22
|
+
recordType?: string;
|
|
23
|
+
fields: Record<string, unknown>;
|
|
24
|
+
/** The fields the module could not read for it (a lookup its provider did
|
|
25
|
+
* not answer: Slack's channel `Name`, a message's `Mentions App`): a
|
|
26
|
+
* listen whose filter reads one cannot be judged, and the host reports it
|
|
27
|
+
* (2.6). Whatever `fields` holds for one is not read by the judge. */
|
|
28
|
+
unknown?: string[];
|
|
29
|
+
}
|
|
30
|
+
/** One arrival on the edge of the record `key` names. `identity` is the
|
|
31
|
+
* landing's value of the field the edge declares as its identity; `version`
|
|
32
|
+
* of its version field. A gone arrival says the record went: nothing more
|
|
33
|
+
* arrives on its edges. */
|
|
34
|
+
export type Arrival = {
|
|
35
|
+
edge: string;
|
|
36
|
+
/** The record whose edge it landed on; absent on one of the
|
|
37
|
+
* connection's root edges (2.6), which no wait is on. */
|
|
38
|
+
key?: string;
|
|
39
|
+
identity: string;
|
|
40
|
+
version?: string;
|
|
41
|
+
landing: AwaitLanding;
|
|
42
|
+
/** The records it carries from the earlier hops the edge declares
|
|
43
|
+
* (`carries`), in that order; null for one it cannot carry (2.6). */
|
|
44
|
+
parents?: (AwaitLanding | null)[];
|
|
45
|
+
/** The record the arrival is about, when that is not its landing: a
|
|
46
|
+
* change to a row names the row (2.6). */
|
|
47
|
+
about?: {
|
|
48
|
+
recordType: string;
|
|
49
|
+
externalId: string;
|
|
50
|
+
};
|
|
51
|
+
/** The listen it must not run, by its pipeline (on listen-fire
|
|
52
|
+
* `listen:<file>:<movement>:<digest>`, the first 8 hex digits of the
|
|
53
|
+
* sha256 of the listen's identity): its own failure, reported to the
|
|
54
|
+
* listens on the edge it failed on (2.6). */
|
|
55
|
+
notFor?: string;
|
|
56
|
+
/** The module applied the listen's taken filter before reporting it
|
|
57
|
+
* (a filtered poll or subscription): the host does not judge it again (2.6). */
|
|
58
|
+
takenApplied?: boolean;
|
|
59
|
+
/** When it happened at its provider (an ISO instant), where the
|
|
60
|
+
* provider says: a host measures from it whether a run's write caused
|
|
61
|
+
* it, however late a poll finds it (2.6). */
|
|
62
|
+
occurredAt?: string;
|
|
63
|
+
} | {
|
|
64
|
+
edge: string;
|
|
65
|
+
key: string;
|
|
66
|
+
gone: true;
|
|
67
|
+
};
|
|
68
|
+
export interface ArrivalsCapability {
|
|
69
|
+
/** The key each head's `edge` is waited on under, in the order of `heads`.
|
|
70
|
+
* Computed from the heads alone: no call to the system. */
|
|
71
|
+
awaitKeys(input: {
|
|
72
|
+
edge: string;
|
|
73
|
+
heads: AwaitHead[];
|
|
74
|
+
}): Promise<AwaitKey[]>;
|
|
75
|
+
}
|
package/dist/arrivals.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Arrivals (adapter protocol 2.5; 2.6 for root edges, carried parents and
|
|
3
|
+
// listens): what lands on a listenable edge, reported by the module that owns it. The host keeps the waiting state: a log of
|
|
4
|
+
// arrivals per record's edge, and a wait per run that reads it. The module
|
|
5
|
+
// answers two things only. Which key names the edge of each record a run
|
|
6
|
+
// waits on (`awaitKeys`), and, with each inbound delivery it reads, what
|
|
7
|
+
// arrived on which key (`arrivals` on its acceptance, or the `wake` door).
|
|
8
|
+
// No run identity crosses into the module.
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|