@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.
- package/ai-docs/instructions/service-code-format/09-realtime-triggers.md +18 -3
- package/dist/cli.js +38 -24
- package/dist/cli.js.map +2 -2
- package/dist/index.js +37 -23
- package/dist/index.js.map +2 -2
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/trigger-method.d.ts +9 -6
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/types.d.ts +5 -0
- package/package.json +1 -1
- package/runtime/index.js +37 -23
- package/runtime/index.js.map +2 -2
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/trigger-method.d.ts +9 -6
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/types.d.ts +5 -0
|
@@ -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
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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(
|
|
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?: {
|