Skip to content

Commit da4d6a3

Browse files
committed
feat(evaluator): add const/string and const/boolean definitions
Adds native string and boolean constant nodes to coreDefinitions so they always appear in the flow graph sidebar palette with correct icons: - string: icon='type' (FiType) - boolean: icon='toggle' (FiToggleLeft) Previously these only existed in MOCK_FUNCTIONS and would disappear when real platform functions loaded from the database.
1 parent b1f4666 commit da4d6a3

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

packages/fbp-evaluator/src/definitions/core.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,35 @@ export const stringConcatDef: NodeDefinitionWithImpl = {
220220
}
221221
};
222222

223+
export const constStringDef: NodeDefinitionWithImpl = {
224+
context: 'js',
225+
name: 'string',
226+
category: 'const',
227+
icon: 'type',
228+
outputs: [{ name: 'value', type: 'string' }],
229+
props: [{ name: 'value', type: 'string', default: '' }],
230+
description: 'Outputs a constant string value',
231+
impl: (_inputs, props) => ({
232+
value: props.value ?? ''
233+
})
234+
};
235+
236+
export const constBooleanDef: NodeDefinitionWithImpl = {
237+
context: 'js',
238+
name: 'boolean',
239+
category: 'const',
240+
icon: 'toggle',
241+
outputs: [{ name: 'value', type: 'boolean' }],
242+
props: [{ name: 'value', type: 'boolean', default: false }],
243+
description: 'Outputs a constant boolean value',
244+
impl: (_inputs, props) => ({
245+
value: props.value ?? false
246+
})
247+
};
248+
223249
export const coreDefinitions: NodeDefinitionWithImpl[] = [
250+
constStringDef,
251+
constBooleanDef,
224252
jsonSelectDef,
225253
jsonObjectDef,
226254
flowGuardDef,

packages/fbp-evaluator/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export type { NodeImplFn, NodeDefinitionWithImpl, EvaluateOptions, PropDefinitio
44
// Re-export node definitions for convenience
55
export { mathDefinitions, constNumberDef, addDef, multiplyDef } from './definitions/math';
66
export { uiDefinitions, pageDef, formDef, inputDef, buttonDef, textDef, graphInputDef, graphOutputDef, graphPropDef } from './definitions/ui';
7-
export { coreDefinitions, jsonSelectDef, jsonObjectDef, flowGuardDef, stringTemplateDef, stringConcatDef } from './definitions/core';
7+
export { coreDefinitions, constStringDef, constBooleanDef, jsonSelectDef, jsonObjectDef, flowGuardDef, stringTemplateDef, stringConcatDef } from './definitions/core';
88
export { netDefinitions, graphqlRequestDef } from './definitions/net';

0 commit comments

Comments
 (0)