WorkerInput
Class: WorkerInput
Defined in: packages/workout/src/core.ts:208
Represents an interactive input request sent to the user
Constructors
Constructor
new WorkerInput(
uuid,title,type?,validators?):WorkerInput
Defined in: packages/workout/src/core.ts:227
Create a new input request
Parameters
uuid
string
Unique identifier for this request
title
string
Prompt text shown to the user
type?
WorkerInputType = WorkerInputType.STRING
Input type (STRING, PASSWORD, CONFIRMATION, LIST)
validators?
(string | RegExp)[] = []
Optional validators as strings or RegExp instances
Returns
WorkerInput
Properties
title
title:
string
Defined in: packages/workout/src/core.ts:210
Prompt text shown to the user
type
type:
WorkerInputType
Defined in: packages/workout/src/core.ts:214
Input type controlling how the prompt is rendered
uuid
uuid:
string
Defined in: packages/workout/src/core.ts:216
Unique identifier for this input request
validators
validators:
RegExp[]
Defined in: packages/workout/src/core.ts:212
Regular expressions used to validate the user's answer
value?
optionalvalue?:string
Defined in: packages/workout/src/core.ts:218
Value entered by the user once the input is fulfilled
Methods
toJSON()
toJSON():
object
Defined in: packages/workout/src/core.ts:262
Serialize this input to JSON format
Returns
object
A plain object representation suitable for JSON serialization
title
title:
string
type
type:
WorkerInputType
uuid
uuid:
string
validators
validators:
string[]
value
value:
string
toMessage()
toMessage():
WorkerInput
Defined in: packages/workout/src/core.ts:254
Convert this input to a message format
Returns
WorkerInput
The WorkerInput instance itself
validate()
validate(
input):boolean
Defined in: packages/workout/src/core.ts:280
Validate an input value against the configured validators
Parameters
input
string
The string value to validate
Returns
boolean
True if the input matches at least one validator, or if no validators are configured