Skip to content

ChainGraph API Documentation / @badaitech/chaingraph-types / PortEnum

Function: PortEnum()

PortEnum(config): PropertyDecorator

Defined in: packages/chaingraph-types/src/decorator/enum.decorator.ts:35

PortEnum decorator for defining an enum port.

This decorator automatically sets the port type to "enum". The provided configuration should include an "options" array with each option having its own id, defaultValue, type, and title, as well as any other desired settings.

For example:

@PortEnum({ options: [ { id: 'red', type: 'string', defaultValue: 'red', title: 'Red' }, { id: 'green', type: 'string', defaultValue: 'green', title: 'Green' }, { id: 'blue', type: 'string', defaultValue: 'blue', title: 'Blue' } ], defaultValue: 'red' }) public colorEnum: string;

Parameters

config

Omit<PortDecoratorOptions<"enum">, "type">

The configuration object for the enum port (excluding the "type" property).

Returns

PropertyDecorator

Licensed under BUSL-1.1