@@ -172,13 +172,56 @@ export type FlowNodeExpressionRole =
172172 */
173173 | 'value' ;
174174
175+ /**
176+ * [#27968] The SIBLING blocks of a node's `config` a ledger path can be rooted
177+ * in, each with the one node type whose executor reads it.
178+ *
179+ * Two node types keep their contract in a declared block of `FlowNodeSchema`
180+ * beside `config` rather than in `config` (`flow-sibling-block-loose-keys.ts`):
181+ * `wait` (`waitEventConfig`) and `connector_action` (`connectorConfig`). Only
182+ * the second holds a value slot — `connectorConfig.input`, evaluated by the
183+ * `connector_action` executor through the same per-key resolver as every other
184+ * value map — so it is the one listed. `waitEventConfig` holds literals only.
185+ *
186+ * The marker that declares a slot here rides `FlowNodeSchema` itself (the
187+ * block's own Zod, `.meta({ xExpression })`), and the reconciliation ratchet
188+ * (`config-expression-ledger.test.ts` in `service-automation`) reads it from
189+ * there, mapping each block to its node type through this table — so a marker
190+ * on a block this table does not name fails it, and so does an entry rooted in
191+ * a block no marker declares.
192+ */
193+ export const FLOW_NODE_SIBLING_EXPRESSION_BLOCKS = {
194+ connectorConfig : 'connector_action' ,
195+ } as const satisfies Readonly < Record < string , string > > ;
196+
197+ /** A sibling block of `config` a ledger path can be rooted in ({@link FLOW_NODE_SIBLING_EXPRESSION_BLOCKS}). */
198+ export type FlowNodeSiblingExpressionBlock = keyof typeof FLOW_NODE_SIBLING_EXPRESSION_BLOCKS ;
199+
200+ /** The node block a ledger path is rooted in: `config`, or a declared sibling block. */
201+ export type FlowNodeExpressionBlock = 'config' | FlowNodeSiblingExpressionBlock ;
202+
203+ /**
204+ * [#27968] The sibling blocks of one node, as the resolvers read them — the
205+ * node itself satisfies it. A caller that hands none is answered for the
206+ * `config`-rooted entries only.
207+ */
208+ export type FlowNodeSiblingBlocks = { readonly [ Block in FlowNodeSiblingExpressionBlock ] ?: unknown } ;
209+
175210/** One expression-bearing config slot on a builtin flow node type. */
176211export interface FlowNodeExpressionPath {
177212 /** Registry node type the path belongs to (`node.type`). */
178213 readonly nodeType : string ;
179214 /**
180- * Dot path into `node.config`, using `[]` for "every element of this array"
181- * and a `*` segment for "every key of this object" (#14149).
215+ * [#27968] The node block the path is rooted in, when it is not `config`: a
216+ * declared sibling block ({@link FLOW_NODE_SIBLING_EXPRESSION_BLOCKS}) —
217+ * today `connectorConfig`, for a `connector_action` node's `input` map.
218+ * Absent means `config`, which every entry before #27968 is.
219+ */
220+ readonly block ?: FlowNodeSiblingExpressionBlock ;
221+ /**
222+ * Dot path into the node's {@link FlowNodeExpressionPath.block} — `config`
223+ * unless the entry names another — using `[]` for "every element of this
224+ * array" and a `*` segment for "every key of this object" (#14149).
182225 * `'fields[].visibleWhen'` reads `config.fields[i].visibleWhen` for each `i`;
183226 * `'assignments.*'` reads `config.assignments[k]` for each authored key `k`
184227 * — the spelling for a map whose keys are the author's own names (variable
@@ -337,6 +380,13 @@ export interface FlowNodeExpressionPath {
337380 * open map with no marker). The entry carries
338381 * {@link FlowNodeExpressionPath.filterOperands}: the walks emit each operand
339382 * at its own path, never the filter itself.
383+ *
384+ * So is, since #27968, a `connector_action` node's `input` map — the one entry
385+ * rooted outside `config` ({@link FlowNodeExpressionPath.block}): the node's
386+ * contract is its `connectorConfig` sibling block, and the executor hands each
387+ * value of `connectorConfig.input` to the action through the per-key resolver
388+ * the callee maps use. Declared on `FlowNodeSchema.connectorConfig`'s `input`
389+ * map value (`.meta({ xExpression: 'value' })`).
340390 */
341391export const FLOW_NODE_EXPRESSION_PATHS : readonly FlowNodeExpressionPath [ ] = [
342392 {
@@ -590,8 +640,37 @@ export const FLOW_NODE_EXPRESSION_PATHS: readonly FlowNodeExpressionPath[] = [
590640 label : 'delete_record filter operand' ,
591641 filterOperands : true ,
592642 } ,
643+ {
644+ // [#27968] The input map a `connector_action` node hands to the action —
645+ // `{ <action input>: <value> }`, keys named by the connector's action —
646+ // evaluated in the run's scope before dispatch, through the one per-key
647+ // resolver the callee maps above use (`resolveValueSlotMap`). Rooted in the
648+ // node's `connectorConfig` sibling block, not `config`: that block is the
649+ // node's whole contract, and the executor reads nothing else. Declared
650+ // through the block's own Zod (`FlowNodeSchema.connectorConfig`'s `input`
651+ // map value carries `.meta({ xExpression: 'value' })`).
652+ nodeType : 'connector_action' ,
653+ block : 'connectorConfig' ,
654+ path : 'input.*' ,
655+ role : 'value' ,
656+ label : 'connector_action input value' ,
657+ } ,
593658] ;
594659
660+ /** The block `entry`'s path is rooted in. */
661+ export function flowNodeExpressionBlock ( entry : FlowNodeExpressionPath ) : FlowNodeExpressionBlock {
662+ return entry . block ?? 'config' ;
663+ }
664+
665+ /**
666+ * The value `entry`'s path is walked from on one node: its `config`, or — for
667+ * an entry rooted in a sibling block — that block, read off `siblings`
668+ * (`undefined` when the caller handed none).
669+ */
670+ function entryRoot ( entry : FlowNodeExpressionPath , config : unknown , siblings : FlowNodeSiblingBlocks | undefined ) : unknown {
671+ return entry . block === undefined ? config : siblings ?. [ entry . block ] ;
672+ }
673+
595674/** One operand of a flow node's query filter ({@link flowFilterOperands}). */
596675export interface FlowFilterOperand {
597676 /**
@@ -703,7 +782,14 @@ function operandPath(prefix: string, path: readonly (string | number)[]): string
703782export interface ResolvedFlowNodeExpression {
704783 /** The ledger entry that matched. */
705784 readonly entry : FlowNodeExpressionPath ;
706- /** Concrete location, with array indices filled in (`fields[1].visibleWhen`). */
785+ /**
786+ * [#27968] The node block {@link ResolvedFlowNodeExpression.path} is inside
787+ * — `config`, or the entry's sibling block — so a consumer locates the value
788+ * as `<block>.<path>` (`config.fields[1].visibleWhen`,
789+ * `connectorConfig.input.ticket`).
790+ */
791+ readonly block : FlowNodeExpressionBlock ;
792+ /** Concrete location inside {@link ResolvedFlowNodeExpression.block}, with array indices filled in (`fields[1].visibleWhen`). */
707793 readonly path : string ;
708794 /** The authored value sitting at that location. */
709795 readonly value : unknown ;
@@ -786,28 +872,38 @@ export function isExpressionEnvelopeShaped(value: unknown): value is { dialect:
786872 * each element of an array as a value of its own, at its index (#19939). An
787873 * entry with {@link FlowNodeExpressionPath.filterOperands} reads each operand
788874 * of the filter as a value of its own, at its path (#19939).
875+ *
876+ * [#27968] An entry rooted in a sibling block ({@link FlowNodeExpressionPath.block})
877+ * is walked from that block, read off `siblings` — pass the node itself — and
878+ * each result names the block it is in ({@link ResolvedFlowNodeExpression.block}).
879+ * A caller that hands no `siblings` is answered for the `config`-rooted entries
880+ * only: every door that judges a whole node (`FlowSchema.parse`,
881+ * `AutomationEngine.registerFlow`, `objectstack validate`) hands the node.
789882 */
790883export function resolveFlowNodeExpressions (
791884 nodeType : string ,
792885 config : unknown ,
886+ siblings ?: FlowNodeSiblingBlocks ,
793887) : ResolvedFlowNodeExpression [ ] {
794- if ( config == null || typeof config !== 'object' ) return [ ] ;
795888 const out : ResolvedFlowNodeExpression [ ] = [ ] ;
796889 for ( const entry of FLOW_NODE_EXPRESSION_PATHS ) {
797- if ( entry . nodeType !== nodeType || ! readOn ( entry , config ) ) continue ;
798- walk ( config as Record < string , unknown > , entry . path . split ( '.' ) , '' , slotEmitter ( entry , ( path , value ) => {
890+ if ( entry . nodeType !== nodeType ) continue ;
891+ const root = entryRoot ( entry , config , siblings ) ;
892+ if ( root == null || typeof root !== 'object' || ! readOn ( entry , root ) ) continue ;
893+ const block = flowNodeExpressionBlock ( entry ) ;
894+ walk ( root , entry . path . split ( '.' ) , '' , slotEmitter ( entry , ( path , value ) => {
799895 if ( entry . role === 'value' ) {
800- if ( isExpressionEnvelopeShaped ( value ) ) out . push ( { entry, path, value } ) ;
896+ if ( isExpressionEnvelopeShaped ( value ) ) out . push ( { entry, block , path, value } ) ;
801897 } else if ( typeof value === 'string' ) {
802898 // #17493 — every string in a `predicate` slot is emitted, a BLANK one
803899 // included, for the consumer to refuse (see `predicateSlotRefusal`).
804- out . push ( { entry, path, value } ) ;
900+ out . push ( { entry, block , path, value } ) ;
805901 } else if ( value != null || entry . required ) {
806902 // #15572 — a non-string in a predicate slot. Emitted so a consumer can
807903 // REFUSE it (see `predicateSlotRefusal`), never so it can be parsed.
808904 // #19961 — on a REQUIRED slot, absent and `null` are emitted too: the
809905 // walk hands over `undefined` for a key an existing element lacks.
810- out . push ( { entry, path, value } ) ;
906+ out . push ( { entry, block , path, value } ) ;
811907 }
812908 } ) ) ;
813909 }
@@ -832,15 +928,22 @@ export function resolveFlowNodeExpressions(
832928 * filter at its own path.
833929 *
834930 * Pure path resolution, like its sibling — no judgement about what a value
835- * says.
931+ * says. Reads a sibling-block entry off `siblings` exactly as its sibling does
932+ * (#27968).
836933 */
837- export function resolveFlowNodeValueSlots ( nodeType : string , config : unknown ) : ResolvedFlowNodeExpression [ ] {
838- if ( config == null || typeof config !== 'object' ) return [ ] ;
934+ export function resolveFlowNodeValueSlots (
935+ nodeType : string ,
936+ config : unknown ,
937+ siblings ?: FlowNodeSiblingBlocks ,
938+ ) : ResolvedFlowNodeExpression [ ] {
839939 const out : ResolvedFlowNodeExpression [ ] = [ ] ;
840940 for ( const entry of FLOW_NODE_EXPRESSION_PATHS ) {
841- if ( entry . nodeType !== nodeType || entry . role !== 'value' || ! readOn ( entry , config ) ) continue ;
842- walk ( config as Record < string , unknown > , entry . path . split ( '.' ) , '' , slotEmitter ( entry , ( path , value ) => {
843- if ( value !== undefined ) out . push ( { entry, path, value } ) ;
941+ if ( entry . nodeType !== nodeType || entry . role !== 'value' ) continue ;
942+ const root = entryRoot ( entry , config , siblings ) ;
943+ if ( root == null || typeof root !== 'object' || ! readOn ( entry , root ) ) continue ;
944+ const block = flowNodeExpressionBlock ( entry ) ;
945+ walk ( root , entry . path . split ( '.' ) , '' , slotEmitter ( entry , ( path , value ) => {
946+ if ( value !== undefined ) out . push ( { entry, block, path, value } ) ;
844947 } ) ) ;
845948 }
846949 return out ;
0 commit comments