@flowrunner/cli 0.1.12-dev.1 → 0.1.12-dev.2

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.
@@ -6,7 +6,7 @@ import type { SharedExtensionMethod } from '../model/model-types';
6
6
  import { MethodParams } from '../params';
7
7
  import { ResultSpec } from '../result';
8
8
  import type { ProviderPayload } from '../types';
9
- import type { RealtimeTriggerProps } from './types';
9
+ import type { RealtimeInstance, RealtimeTriggerProps } from './types';
10
10
  export declare class RealtimeTriggerMethod extends ExtensionMethod implements LoaderOwner {
11
11
  private readonly props;
12
12
  readonly params: MethodParams;
@@ -22,12 +22,15 @@ export declare class RealtimeTriggerMethod extends ExtensionMethod implements Lo
22
22
  claims(providerEventName: string): boolean;
23
23
  extendEventData(requestBody: ProviderPayload, providerEventData: ProviderPayload): Record<string, unknown> | undefined;
24
24
  /**
25
- * Whether `extendMatchData` should run for an event about to be matched against `instanceCount` instances.
26
- * Only when something will READ its result: with no instances there is nothing to decide, and with no
27
- * `match` every instance fires regardless — either way the API call would be pure cost.
25
+ * Whether `extendMatchData` should run before these instances are matched. Only when something will READ its
26
+ * result — otherwise the API call is pure cost, paid on every event:
27
+ * - no instances, or no `match` → nothing to decide (with no `match` every instance fires);
28
+ * - declarative `match`, and no instance fills any of its params → every instance matches regardless,
29
+ * since an empty param means "any". This is the v1 rule: read the resource only when a flow filters.
30
+ * A predicate `match` is opaque, so the hook runs and receives the instances to make that call itself.
28
31
  */
29
- needsMatchData(instanceCount: number): boolean;
30
- extendMatchData(providerEventData: ProviderPayload, ctx: ExecutionContext, webhookData?: ProviderPayload): Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
32
+ needsMatchData(instances: RealtimeInstance[]): boolean;
33
+ extendMatchData(providerEventData: ProviderPayload, instances: RealtimeInstance[], ctx: ExecutionContext, webhookData?: ProviderPayload): Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
31
34
  /**
32
35
  * Whether one CONFIGURED INSTANCE of this trigger cares about an event. Declarative form: type-coerced
33
36
  * equality per filled param, where an empty param means "any" — that is what lets a user leave a filter
@@ -119,6 +119,7 @@ export interface RealtimeTriggerProps<TShape extends ExtensionShape = AnyShape,
119
119
  extendMatchData?: (bag: HandlerBag<TShape> & {
120
120
  providerEventData: ProviderPayload;
121
121
  webhookData: ProviderPayload;
122
+ instances: RealtimeInstance<Infer<TParams>>[];
122
123
  }) => Record<string, unknown> | void | Promise<Record<string, unknown> | void>;
123
124
  match?: Record<string, string> | ((bag: {
124
125
  params: Infer<TParams>;
@@ -133,6 +134,10 @@ export interface RealtimeTriggerProps<TShape extends ExtensionShape = AnyShape,
133
134
  logo?: string;
134
135
  appearanceColors?: [string, string];
135
136
  }
137
+ export interface RealtimeInstance<TParams = Record<string, unknown>> {
138
+ id: string;
139
+ params: TParams;
140
+ }
136
141
  export interface RealtimeInvocation {
137
142
  callbackUrl?: string;
138
143
  events?: {