@listen-fire/engine-contracts 0.12.9 → 0.12.10

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 CHANGED
@@ -416,8 +416,12 @@ export interface ListenConfigKey {
416
416
  * the listen's address lands on (the changed-attribute filter — any adapter
417
417
  * with a "only fire when one of these changed" surface declares it);
418
418
  * `'strings'` = a non-empty list of non-empty quoted strings (Gmail's
419
- * `labels`). */
420
- format?: 'cron' | 'timezone' | 'fields' | 'strings';
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';
421
425
  /**
422
426
  * This key is one HOP of the address that narrows the event's record edge.
423
427
  *
@@ -482,6 +486,20 @@ export interface EventSubscriptionRegistration {
482
486
  externalId?: string;
483
487
  /** HMAC secret for inbound signature verification, when issued. */
484
488
  secret?: string;
489
+ /** When the source lets the subscription lapse unless it is refreshed
490
+ * ({@link Adapter.refreshEventSubscription}), as an ISO time. Absent for
491
+ * one that never expires. */
492
+ expiresAt?: string;
493
+ }
494
+ export interface RefreshEventSubscriptionInput {
495
+ /** The source-issued id of the subscription to extend. */
496
+ externalId: string;
497
+ /** The channel's scope (mirrors {@link EnsureEventSubscriptionInput.scope}). */
498
+ scope?: Record<string, string>;
499
+ }
500
+ /** A refreshed subscription: when it now expires, when the source says. */
501
+ export interface EventSubscriptionRefresh {
502
+ expiresAt?: string;
485
503
  }
486
504
  export interface RemoveEventSubscriptionInput {
487
505
  callbackUrl: string;
@@ -641,6 +659,11 @@ export interface Adapter {
641
659
  /** Tear down the registration `ensureEventSubscription` created — called
642
660
  * when the last listen on the (adapter, credential) channel retires. */
643
661
  removeEventSubscription?(input: RemoveEventSubscriptionInput): Promise<void>;
662
+ /** Extend a subscription the source lets lapse (Airtable's webhooks expire
663
+ * 7 days after their last refresh): the host calls it before the
664
+ * `expiresAt` the registration or the last refresh returned. Adapter
665
+ * protocol 2.4. */
666
+ refreshEventSubscription?(input: RefreshEventSubscriptionInput): Promise<EventSubscriptionRefresh | undefined>;
644
667
  /**
645
668
  * Match an inbound record against existing linked_objects. The framework
646
669
  * supplies candidates filtered by adapterType + recordType; the adapter
@@ -1551,6 +1574,9 @@ export type InboundCheck = {
1551
1574
  events: DiscriminableEvent[];
1552
1575
  wakeKeys?: string[];
1553
1576
  checkpoint?: unknown;
1577
+ /** The provider's id for this delivery: a redelivery under an id the
1578
+ * host kept before is acked and runs nothing. */
1579
+ deliveryId?: string;
1554
1580
  }
1555
1581
  /** The host answers `status` (401 when absent) with `signature_invalid`. */
1556
1582
  | {
package/dist/catalog.d.ts CHANGED
@@ -381,6 +381,7 @@ declare const schemaFieldDescriptorSchema: z.ZodObject<{
381
381
  writable: z.ZodBoolean;
382
382
  readable: z.ZodOptional<z.ZodBoolean>;
383
383
  required: z.ZodBoolean;
384
+ pinned: z.ZodOptional<z.ZodBoolean>;
384
385
  anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
385
386
  kind: z.ZodLiteral<"node">;
386
387
  }, z.core.$strip>, z.ZodObject<{
@@ -494,6 +495,7 @@ declare const schemaReferenceDescriptorSchema: z.ZodObject<{
494
495
  writable: z.ZodBoolean;
495
496
  readable: z.ZodOptional<z.ZodBoolean>;
496
497
  required: z.ZodBoolean;
498
+ pinned: z.ZodOptional<z.ZodBoolean>;
497
499
  anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
498
500
  kind: z.ZodLiteral<"node">;
499
501
  }, z.core.$strip>, z.ZodObject<{
@@ -654,6 +656,7 @@ export declare const schemaTypeDescriptorSchema: z.ZodObject<{
654
656
  writable: z.ZodBoolean;
655
657
  readable: z.ZodOptional<z.ZodBoolean>;
656
658
  required: z.ZodBoolean;
659
+ pinned: z.ZodOptional<z.ZodBoolean>;
657
660
  anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
658
661
  kind: z.ZodLiteral<"node">;
659
662
  }, z.core.$strip>, z.ZodObject<{
@@ -766,6 +769,7 @@ export declare const schemaTypeDescriptorSchema: z.ZodObject<{
766
769
  writable: z.ZodBoolean;
767
770
  readable: z.ZodOptional<z.ZodBoolean>;
768
771
  required: z.ZodBoolean;
772
+ pinned: z.ZodOptional<z.ZodBoolean>;
769
773
  anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
770
774
  kind: z.ZodLiteral<"node">;
771
775
  }, z.core.$strip>, z.ZodObject<{
@@ -942,6 +946,7 @@ declare const schemaDescriptorSchema: z.ZodObject<{
942
946
  writable: z.ZodBoolean;
943
947
  readable: z.ZodOptional<z.ZodBoolean>;
944
948
  required: z.ZodBoolean;
949
+ pinned: z.ZodOptional<z.ZodBoolean>;
945
950
  anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
946
951
  kind: z.ZodLiteral<"node">;
947
952
  }, z.core.$strip>, z.ZodObject<{
@@ -1054,6 +1059,7 @@ declare const schemaDescriptorSchema: z.ZodObject<{
1054
1059
  writable: z.ZodBoolean;
1055
1060
  readable: z.ZodOptional<z.ZodBoolean>;
1056
1061
  required: z.ZodBoolean;
1062
+ pinned: z.ZodOptional<z.ZodBoolean>;
1057
1063
  anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1058
1064
  kind: z.ZodLiteral<"node">;
1059
1065
  }, z.core.$strip>, z.ZodObject<{
package/dist/catalog.js CHANGED
@@ -632,6 +632,14 @@ const schemaFieldDescriptorSchema = zod_1.z.object({
632
632
  */
633
633
  readable: zod_1.z.boolean().optional(),
634
634
  required: zod_1.z.boolean(),
635
+ /**
636
+ * A read of this type must pin this field in its WHERE with `==`
637
+ * (`-[r:search_issues WHERE r.query == …]->`): the source takes it as an
638
+ * argument of the read, not as a filter over records it could list. The
639
+ * checker refuses a read that does not (MOV_HOP_PIN_REQUIRED). Absent ⇒
640
+ * false. Writes are unaffected (`required` is the write's own rule).
641
+ */
642
+ pinned: zod_1.z.boolean().optional(),
635
643
  /**
636
644
  * Where this writable field lands at the adapter's write boundary.
637
645
  * Optional; omitted means node-anchored (the universal case for
@@ -12,30 +12,36 @@ export declare const ADAPTER_TEAM_HEADER = "x-listen-fire-team";
12
12
  export declare const MANIFEST_PROTOCOL_VERSION = 2;
13
13
  /** The highest minor of version 2 this release speaks: a host reads 2.0 to
14
14
  * 2.`PROTOCOL_MINOR` (docs/contracts/adapter-protocol.md "Minors of version 2"). */
15
- export declare const PROTOCOL_MINOR = 3;
16
- /** What a manifest shows of a feature: a method it lists, by name or by its
17
- * ending (`<slot>.watch`). Data, so the Rust twin
18
- * (module-wire `envelope::PROTOCOL_MINORS`) is test-held equal to it. */
15
+ export declare const PROTOCOL_MINOR = 4;
16
+ /** The method that names a minor's feature, by name or by its ending
17
+ * (`<slot>.watch`). Data, so the Rust twin (module-wire
18
+ * `envelope::PROTOCOL_MINORS`) is test-held equal to it. */
19
19
  export type ProtocolMinorUse = {
20
20
  method: string;
21
21
  } | {
22
22
  methodEndingWith: string;
23
23
  };
24
- /** Each minor of version 2 and the feature that a manifest using it lists. A
25
- * minor that is no feature a manifest shows has no row: 2.0, and 2.3 (a rule
26
- * for sources, labelled poll events, and a host behaviour; no module states
27
- * it). */
24
+ /** Each minor of version 2 whose hosts speak a method, and that method. A host
25
+ * speaking the minor may call it; a module offering it needs nothing of an
26
+ * older host, which never calls it, so offering one never raises the minor
27
+ * a module states. A minor that names no method has no row: 2.0, and 2.3
28
+ * (labelled poll events, a host behaviour). */
28
29
  export declare const PROTOCOL_MINORS: readonly {
29
30
  minor: number;
30
31
  feature: string;
31
32
  uses: ProtocolMinorUse;
32
33
  }[];
33
- /** The minor a manifest states: the highest among the features it lists, so a
34
- * module rebuilt with a newer kit is never refused by an older host for a
35
- * feature it does not use. */
34
+ /** The minor a manifest states: what it needs its host to speak. That is 0
35
+ * unless its author declares a host behaviour the module relies on
36
+ * (`protocolMinor`). The methods it lists never raise it: a host calls only
37
+ * the methods it speaks, so an older host leaves a newer one alone. */
36
38
  export declare function protocolMinorOf(manifest: {
37
- methods: readonly string[];
39
+ methods?: readonly string[];
40
+ protocolMinor?: number;
38
41
  }): number;
42
+ /** The minor whose hosts first speak `method`, for a host's refusal of a
43
+ * module that lacks a method the host needs (`movements.watch`, 2.1). */
44
+ export declare function minorIntroducing(method: string): number | undefined;
39
45
  /** A manifest's `protocolVersion`, shared by the server's `manifest` answer and
40
46
  * the installable manifest file so both refuse a module in the same words,
41
47
  * naming which way it is out of step. */
@@ -1355,8 +1361,9 @@ export declare const WireInvokeFieldFunctionInput: z.ZodObject<{
1355
1361
  * `eventType` is matched against them when routing);
1356
1362
  * - `defaultSubscribedEvents`: what a listen with no `events` receives
1357
1363
  * (absent ⇒ every subscribable event);
1358
- * - `listenConfig`: further keys, whether a listen must carry each, and a
1359
- * static value format the checker validates.
1364
+ * - `listenConfig`: further keys, whether a listen must carry each, a
1365
+ * static value format the checker validates, and whether the key is one
1366
+ * hop of the address the event is narrowed by (`narrows`).
1360
1367
  * All optional: an adapter declaring none leaves its listen config unchecked.
1361
1368
  */
1362
1369
  export declare const WireListenDeclarations: z.ZodObject<{
@@ -1365,12 +1372,19 @@ export declare const WireListenDeclarations: z.ZodObject<{
1365
1372
  listenConfig: z.ZodOptional<z.ZodArray<z.ZodObject<{
1366
1373
  key: z.ZodString;
1367
1374
  required: z.ZodOptional<z.ZodBoolean>;
1368
- format: z.ZodOptional<z.ZodEnum<{
1375
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1376
+ type: "type";
1377
+ field: "field";
1369
1378
  fields: "fields";
1370
1379
  cron: "cron";
1371
1380
  timezone: "timezone";
1372
1381
  strings: "strings";
1373
- }>>;
1382
+ "field-value": "field-value";
1383
+ }>, z.ZodString]>>;
1384
+ narrows: z.ZodOptional<z.ZodObject<{
1385
+ collection: z.ZodString;
1386
+ matchField: z.ZodString;
1387
+ }, z.core.$strip>>;
1374
1388
  }, z.core.$strip>>>;
1375
1389
  }, z.core.$strip>;
1376
1390
  /** One field a credential holds, by the name it is stored and sent under. */
@@ -1815,6 +1829,12 @@ export declare const WireManifestResult: z.ZodObject<{
1815
1829
  methods: z.ZodArray<z.ZodString>;
1816
1830
  webhookEventTypeId: z.ZodOptional<z.ZodString>;
1817
1831
  description: z.ZodOptional<z.ZodString>;
1832
+ positionArgs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1833
+ name: z.ZodString;
1834
+ optionsFrom: z.ZodString;
1835
+ label: z.ZodOptional<z.ZodString>;
1836
+ }, z.core.$strip>>>;
1837
+ subscriptionScopeKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1818
1838
  kind: z.ZodOptional<z.ZodEnum<{
1819
1839
  adapter: "adapter";
1820
1840
  plugin: "plugin";
@@ -1944,12 +1964,19 @@ export declare const WireManifestResult: z.ZodObject<{
1944
1964
  listenConfig: z.ZodOptional<z.ZodArray<z.ZodObject<{
1945
1965
  key: z.ZodString;
1946
1966
  required: z.ZodOptional<z.ZodBoolean>;
1947
- format: z.ZodOptional<z.ZodEnum<{
1967
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1968
+ type: "type";
1969
+ field: "field";
1948
1970
  fields: "fields";
1949
1971
  cron: "cron";
1950
1972
  timezone: "timezone";
1951
1973
  strings: "strings";
1952
- }>>;
1974
+ "field-value": "field-value";
1975
+ }>, z.ZodString]>>;
1976
+ narrows: z.ZodOptional<z.ZodObject<{
1977
+ collection: z.ZodString;
1978
+ matchField: z.ZodString;
1979
+ }, z.core.$strip>>;
1953
1980
  }, z.core.$strip>>>;
1954
1981
  }, z.core.$strip>;
1955
1982
  export type WireManifestResultShape = z.infer<typeof WireManifestResult>;
@@ -2245,6 +2272,15 @@ export declare const WireEnsureEventSubscriptionInput: z.ZodObject<{
2245
2272
  export declare const WireEventSubscriptionRegistration: z.ZodObject<{
2246
2273
  externalId: z.ZodOptional<z.ZodString>;
2247
2274
  secret: z.ZodOptional<z.ZodString>;
2275
+ expiresAt: z.ZodOptional<z.ZodString>;
2276
+ }, z.core.$strip>;
2277
+ export declare const WireRefreshEventSubscriptionInput: z.ZodObject<{
2278
+ externalId: z.ZodString;
2279
+ scope: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2280
+ }, z.core.$strip>;
2281
+ /** A refreshed subscription: when it now expires. */
2282
+ export declare const WireEventSubscriptionRefresh: z.ZodObject<{
2283
+ expiresAt: z.ZodOptional<z.ZodString>;
2248
2284
  }, z.core.$strip>;
2249
2285
  export declare const WireRemoveEventSubscriptionInput: z.ZodObject<{
2250
2286
  callbackUrl: z.ZodString;
@@ -2324,6 +2360,12 @@ export declare const METHODS: {
2324
2360
  methods: z.ZodArray<z.ZodString>;
2325
2361
  webhookEventTypeId: z.ZodOptional<z.ZodString>;
2326
2362
  description: z.ZodOptional<z.ZodString>;
2363
+ positionArgs: z.ZodOptional<z.ZodArray<z.ZodObject<{
2364
+ name: z.ZodString;
2365
+ optionsFrom: z.ZodString;
2366
+ label: z.ZodOptional<z.ZodString>;
2367
+ }, z.core.$strip>>>;
2368
+ subscriptionScopeKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
2327
2369
  kind: z.ZodOptional<z.ZodEnum<{
2328
2370
  adapter: "adapter";
2329
2371
  plugin: "plugin";
@@ -2453,12 +2495,19 @@ export declare const METHODS: {
2453
2495
  listenConfig: z.ZodOptional<z.ZodArray<z.ZodObject<{
2454
2496
  key: z.ZodString;
2455
2497
  required: z.ZodOptional<z.ZodBoolean>;
2456
- format: z.ZodOptional<z.ZodEnum<{
2498
+ format: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
2499
+ type: "type";
2500
+ field: "field";
2457
2501
  fields: "fields";
2458
2502
  cron: "cron";
2459
2503
  timezone: "timezone";
2460
2504
  strings: "strings";
2461
- }>>;
2505
+ "field-value": "field-value";
2506
+ }>, z.ZodString]>>;
2507
+ narrows: z.ZodOptional<z.ZodObject<{
2508
+ collection: z.ZodString;
2509
+ matchField: z.ZodString;
2510
+ }, z.core.$strip>>;
2462
2511
  }, z.core.$strip>>>;
2463
2512
  }, z.core.$strip>;
2464
2513
  };
@@ -3559,6 +3608,7 @@ export declare const METHODS: {
3559
3608
  readonly result: z.ZodNullable<z.ZodObject<{
3560
3609
  externalId: z.ZodOptional<z.ZodString>;
3561
3610
  secret: z.ZodOptional<z.ZodString>;
3611
+ expiresAt: z.ZodOptional<z.ZodString>;
3562
3612
  }, z.core.$strip>>;
3563
3613
  };
3564
3614
  readonly removeEventSubscription: {
@@ -3569,6 +3619,15 @@ export declare const METHODS: {
3569
3619
  }, z.core.$strip>;
3570
3620
  readonly result: z.ZodNull;
3571
3621
  };
3622
+ readonly refreshEventSubscription: {
3623
+ readonly params: z.ZodObject<{
3624
+ externalId: z.ZodString;
3625
+ scope: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3626
+ }, z.core.$strip>;
3627
+ readonly result: z.ZodNullable<z.ZodObject<{
3628
+ expiresAt: z.ZodOptional<z.ZodString>;
3629
+ }, z.core.$strip>>;
3630
+ };
3572
3631
  readonly resolveAwait: {
3573
3632
  readonly params: z.ZodObject<{
3574
3633
  recordId: z.ZodString;
package/dist/protocol.js CHANGED
@@ -20,8 +20,9 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.WireWriteResult = exports.WireDeleteInput = exports.WireUpdateInput = exports.WireWriteInput = exports.WireGetRelatedInput = exports.WireGetFieldValueInput = exports.WireResolveEntityResult = exports.WireResolveEntityInput = exports.WireEdgesFromResult = exports.WireSchemaTypeDescriptor = exports.WireSchemaEntryPoint = exports.WireSchemaReferenceDescriptor = exports.WireSchemaFieldDescriptor = exports.WireActorCandidate = exports.WireActorIdentity = exports.WireRelatedResult = exports.WireUniquenessConstraints = exports.WireMutationContext = exports.WireFieldEvidence = exports.WireResource = exports.WireResourceProvenance = exports.WireFact = exports.WireFileRef = exports.WireLinkedObject = exports.WireTriggerEvent = exports.WireExternalRecordRef = exports.WireInboundRecordRef = exports.WireActor = exports.WireLandedRecordPosition = exports.WireSourcePosition = exports.WireEphemeralOriginRef = exports.WirePositionIdentity = exports.RpcResponse = exports.WireRetryAfter = exports.CREDENTIAL_REFUSED_CODE = exports.RpcError = exports.RpcRequest = exports.WireHostLimitsDoor = exports.WireModuleSettingValues = exports.WireCostLine = exports.WireCredentialUpdate = exports.WireCredential = exports.WireCredentialFields = exports.WireManifestProtocolMinor = exports.WireManifestProtocolVersion = exports.PROTOCOL_MINORS = exports.PROTOCOL_MINOR = exports.MANIFEST_PROTOCOL_VERSION = exports.ADAPTER_TEAM_HEADER = exports.PROTOCOL_VERSION = void 0;
22
22
  exports.HostModelRequest = exports.WireInboundCheck = exports.WireCheckInboundInput = exports.WireInboundRequest = exports.AdapterWakeBody = exports.AdapterEmitBody = exports.ADAPTER_DOOR_MAX_BATCH = exports.WireDiscriminableEvent = exports.RelatedPage = exports.WireManifestResult = exports.WireModuleDeclarations = exports.WireDeclaredLimit = exports.WireLimitDuration = exports.WireLimitScope = exports.LIMIT_SCOPES = exports.WireModuleSetting = exports.WireCoreSlot = exports.CORE_SLOTS = exports.WireModuleKind = exports.MODULE_KINDS = exports.WirePluginsDeclaration = exports.WirePluginSpec = exports.WirePeriodicDeclaration = exports.WirePollDeclaration = exports.WireInboundDeclaration = exports.WireModuleCheckedInboundDeclaration = exports.WireSignedInboundDeclaration = exports.WireInboundIntercept = exports.INBOUND_INTERCEPTS = exports.WireInboundSignatureScheme = exports.INBOUND_SIGNATURE_SCHEMES = exports.WireCredentialDeclaration = exports.WireOAuth2Declaration = exports.WireCredentialField = exports.WireListenDeclarations = exports.WireInvokeFieldFunctionInput = exports.WireExtractActorInput = exports.WireGetActorCandidatesInput = exports.WireDescribeOpaqueIdInput = exports.WireGetDedupRulesInput = exports.WireDedupRules = exports.WireFilterTranslationResult = exports.WireTranslateFilterInput = exports.WireReadInput = exports.WireLinkRecordsInput = exports.WireDeleteResult = exports.WireUpdateResult = exports.WireUpdateWriteResult = exports.WireParentAssociation = exports.WireUpdateNotFound = void 0;
23
- exports.METHODS = exports.WirePluginResult = exports.WirePluginFile = exports.WireAwaitResolution = exports.WireAwaitLanding = exports.WireAwaitPoint = exports.WireRemoveEventSubscriptionInput = exports.WireEventSubscriptionRegistration = exports.WireEnsureEventSubscriptionInput = exports.WireEventType = exports.HostLimitGrant = exports.HostLimitRequest = exports.HostModelAnswer = exports.WireModelUsage = void 0;
23
+ exports.METHODS = exports.WirePluginResult = exports.WirePluginFile = exports.WireAwaitResolution = exports.WireAwaitLanding = exports.WireAwaitPoint = exports.WireRemoveEventSubscriptionInput = exports.WireEventSubscriptionRefresh = exports.WireRefreshEventSubscriptionInput = exports.WireEventSubscriptionRegistration = exports.WireEnsureEventSubscriptionInput = exports.WireEventType = exports.HostLimitGrant = exports.HostLimitRequest = exports.HostModelAnswer = exports.WireModelUsage = void 0;
24
24
  exports.protocolMinorOf = protocolMinorOf;
25
+ exports.minorIntroducing = minorIntroducing;
25
26
  exports.protocolStanding = protocolStanding;
26
27
  exports.refuseUnpairedDeclarations = refuseUnpairedDeclarations;
27
28
  const zod_1 = require("zod");
@@ -39,23 +40,28 @@ exports.ADAPTER_TEAM_HEADER = 'x-listen-fire-team';
39
40
  exports.MANIFEST_PROTOCOL_VERSION = 2;
40
41
  /** The highest minor of version 2 this release speaks: a host reads 2.0 to
41
42
  * 2.`PROTOCOL_MINOR` (docs/contracts/adapter-protocol.md "Minors of version 2"). */
42
- exports.PROTOCOL_MINOR = 3;
43
- /** Each minor of version 2 and the feature that a manifest using it lists. A
44
- * minor that is no feature a manifest shows has no row: 2.0, and 2.3 (a rule
45
- * for sources, labelled poll events, and a host behaviour; no module states
46
- * it). */
43
+ exports.PROTOCOL_MINOR = 4;
44
+ /** Each minor of version 2 whose hosts speak a method, and that method. A host
45
+ * speaking the minor may call it; a module offering it needs nothing of an
46
+ * older host, which never calls it, so offering one never raises the minor
47
+ * a module states. A minor that names no method has no row: 2.0, and 2.3
48
+ * (labelled poll events, a host behaviour). */
47
49
  exports.PROTOCOL_MINORS = [
48
50
  { minor: 1, feature: 'a <slot>.watch method', uses: { methodEndingWith: '.watch' } },
49
51
  { minor: 2, feature: 'work.enqueueIfAbsent', uses: { method: 'work.enqueueIfAbsent' } },
52
+ { minor: 4, feature: 'refreshEventSubscription', uses: { method: 'refreshEventSubscription' } },
50
53
  ];
51
- function lists(methods, uses) {
52
- return 'method' in uses ? methods.includes(uses.method) : methods.some((method) => method.endsWith(uses.methodEndingWith));
53
- }
54
- /** The minor a manifest states: the highest among the features it lists, so a
55
- * module rebuilt with a newer kit is never refused by an older host for a
56
- * feature it does not use. */
54
+ /** The minor a manifest states: what it needs its host to speak. That is 0
55
+ * unless its author declares a host behaviour the module relies on
56
+ * (`protocolMinor`). The methods it lists never raise it: a host calls only
57
+ * the methods it speaks, so an older host leaves a newer one alone. */
57
58
  function protocolMinorOf(manifest) {
58
- return exports.PROTOCOL_MINORS.reduce((highest, { minor, uses }) => (lists(manifest.methods, uses) ? Math.max(highest, minor) : highest), 0);
59
+ return manifest.protocolMinor ?? 0;
60
+ }
61
+ /** The minor whose hosts first speak `method`, for a host's refusal of a
62
+ * module that lacks a method the host needs (`movements.watch`, 2.1). */
63
+ function minorIntroducing(method) {
64
+ return exports.PROTOCOL_MINORS.find(({ uses }) => ('method' in uses ? uses.method === method : method.endsWith(uses.methodEndingWith)))?.minor;
59
65
  }
60
66
  function olderProtocolText(got, module) {
61
67
  return (`protocolVersion: expected ${exports.MANIFEST_PROTOCOL_VERSION}, got ${JSON.stringify(got) ?? 'nothing'} — ` +
@@ -621,8 +627,9 @@ exports.WireInvokeFieldFunctionInput = zod_1.z.object({
621
627
  * `eventType` is matched against them when routing);
622
628
  * - `defaultSubscribedEvents`: what a listen with no `events` receives
623
629
  * (absent ⇒ every subscribable event);
624
- * - `listenConfig`: further keys, whether a listen must carry each, and a
625
- * static value format the checker validates.
630
+ * - `listenConfig`: further keys, whether a listen must carry each, a
631
+ * static value format the checker validates, and whether the key is one
632
+ * hop of the address the event is narrowed by (`narrows`).
626
633
  * All optional: an adapter declaring none leaves its listen config unchecked.
627
634
  */
628
635
  exports.WireListenDeclarations = zod_1.z.object({
@@ -632,8 +639,19 @@ exports.WireListenDeclarations = zod_1.z.object({
632
639
  .array(zod_1.z.object({
633
640
  key: zod_1.z.string().min(1),
634
641
  required: zod_1.z.boolean().optional(),
635
- format: zod_1.z.enum(['cron', 'timezone', 'fields', 'strings']).optional(),
642
+ // Open: a format this release does not know is a newer module's, and
643
+ // its key's value goes unchecked rather than refusing the manifest.
644
+ format: zod_1.z
645
+ .union([zod_1.z.enum(['cron', 'timezone', 'fields', 'strings', 'type', 'field', 'field-value']), zod_1.z.string().min(1)])
646
+ .optional(),
647
+ // One hop of the address the listen's event is narrowed by
648
+ // (`ListenConfigKey.narrows`): the collection walked and the member
649
+ // field its value is matched on.
650
+ narrows: zod_1.z.object({ collection: zod_1.z.string().min(1), matchField: zod_1.z.string().min(1) }).optional(),
636
651
  }))
652
+ // A `field-value` key is a value of the field the `field` key names:
653
+ // paired by format, so there must be exactly one to pair with.
654
+ .refine((entries) => !entries.some((e) => e.format === 'field-value') || entries.filter((e) => e.format === 'field').length === 1, { message: "a 'field-value' listen key needs exactly one 'field' key to be a value of" })
637
655
  .optional(),
638
656
  });
639
657
  // ── Module declarations (within version 2: all optional) ─────────────────────
@@ -936,6 +954,17 @@ exports.WireManifestResult = zod_1.z.object({
936
954
  webhookEventTypeId: zod_1.z.string().optional(),
937
955
  /** What the adapter is, in one or two sentences: shown when an author hovers it. */
938
956
  description: zod_1.z.string().optional(),
957
+ /** Construction args that pin an entry position (an Airtable `base`): a host
958
+ * describes the module once per value a program constructs it with, and
959
+ * sends the value as the request's `settings`. */
960
+ positionArgs: zod_1.z
961
+ .array(zod_1.z.object({ name: zod_1.z.string().min(1), optionsFrom: zod_1.z.string().min(1), label: zod_1.z.string().optional() }))
962
+ .optional(),
963
+ /** The listen config keys whose values scope an event subscription (an
964
+ * Airtable webhook watches one `base` and `table`): a host keeps one
965
+ * subscription per credential and scope, and sends the scope as
966
+ * `ensureEventSubscription`'s and `removeEventSubscription`'s `scope`. */
967
+ subscriptionScopeKeys: zod_1.z.array(zod_1.z.string().min(1)).optional(),
939
968
  }).superRefine(refuseUnpairedDeclarations);
940
969
  // ── Streaming page shapes ────────────────────────────────────────────────────
941
970
  exports.RelatedPage = zod_1.z.object({
@@ -1087,6 +1116,17 @@ exports.WireEnsureEventSubscriptionInput = zod_1.z.object({
1087
1116
  exports.WireEventSubscriptionRegistration = zod_1.z.object({
1088
1117
  externalId: zod_1.z.string().optional(),
1089
1118
  secret: zod_1.z.string().optional(),
1119
+ /** When the source lets the subscription lapse unless it is refreshed (an
1120
+ * ISO time); absent for one that never expires. */
1121
+ expiresAt: zod_1.z.string().optional(),
1122
+ });
1123
+ exports.WireRefreshEventSubscriptionInput = zod_1.z.object({
1124
+ externalId: zod_1.z.string(),
1125
+ scope: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
1126
+ });
1127
+ /** A refreshed subscription: when it now expires. */
1128
+ exports.WireEventSubscriptionRefresh = zod_1.z.object({
1129
+ expiresAt: zod_1.z.string().optional(),
1090
1130
  });
1091
1131
  exports.WireRemoveEventSubscriptionInput = zod_1.z.object({
1092
1132
  callbackUrl: zod_1.z.string(),
@@ -1234,6 +1274,11 @@ exports.METHODS = {
1234
1274
  params: exports.WireRemoveEventSubscriptionInput,
1235
1275
  result: zod_1.z.null(),
1236
1276
  },
1277
+ // Adapter protocol 2.4: extend a subscription the source would let lapse.
1278
+ refreshEventSubscription: {
1279
+ params: exports.WireRefreshEventSubscriptionInput,
1280
+ result: exports.WireEventSubscriptionRefresh.nullable(),
1281
+ },
1237
1282
  resolveAwait: {
1238
1283
  params: exports.WireAwaitPoint,
1239
1284
  result: exports.WireAwaitResolution,
@@ -45,7 +45,7 @@ export declare const CONTRACTS: {
45
45
  readonly current: 2;
46
46
  readonly supported: readonly [2];
47
47
  readonly deprecated: readonly [];
48
- readonly minor: 3;
48
+ readonly minor: 4;
49
49
  };
50
50
  readonly 'system-caller': {
51
51
  readonly current: 1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@listen-fire/engine-contracts",
3
3
  "license": "Apache-2.0",
4
- "version": "0.12.9",
4
+ "version": "0.12.10",
5
5
  "description": "The contracts the movement engine speaks: the tenant id, the host families and entry-point inputs, the parked state, file descriptors, the adapter protocol, the adapter contract and its manifest, the catalog's schema types and positions, the Expression vocabulary, plugins as data and the model names. Runtime-neutral: no Node import, no ambient types.",
6
6
  "engines": {
7
7
  "node": ">=22.23.4 <23"
@@ -30,7 +30,7 @@
30
30
  "type": "commonjs",
31
31
  "dependencies": {
32
32
  "zod": "4.1.12",
33
- "@listen-fire/movement-lang": "^0.12.9"
33
+ "@listen-fire/movement-lang": "^0.12.10"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.16.5",