n8n-nodes-base
Version:
Base nodes of n8n
54 lines (51 loc) • 1.47 kB
text/typescript
/**
* Switch Node - Version 2
* Discriminator: mode=rules
*/
/** Rules decide how to route data */
export type SwitchV2RulesParams = {
mode: 'rules';
/**
* The type of data to route on
* @default number
*/
dataType?: 'boolean' | 'dateTime' | 'number' | 'string' | Expression<string>;
/**
* The value to compare with the first one
* @displayOptions.show { dataType: ["boolean"] }
* @default false
*/
value1?: boolean | Expression<boolean>;
/**
* Routing Rules
* @displayOptions.show { dataType: ["boolean"] }
* @default {}
*/
rules?: {
/** Boolean
*/
rules?: Array<{
/** Operation to decide where the data should be mapped to
* @default equal
*/
operation?: 'equal' | 'notEqual' | Expression<string>;
/** The value to compare with the first one
* @default false
*/
value2?: boolean | Expression<boolean>;
/** The label of output to which to send data to if rule matches
*/
outputKey?: string | Expression<string> | PlaceholderValue;
}>;
};
/**
* The output to which to route all items which do not match any of the rules. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.
* @default -1
*/
fallbackOutput?: string | Expression<string>;
};
export type SwitchV2RulesNode = {
type: 'n8n-nodes-base.switch';
version: 2;
config: NodeConfig<SwitchV2RulesParams>;
};