@fogpipe/forma-core 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -5,8 +5,42 @@
5
5
  * Provides types, FEEL expression evaluation, and form state engines.
6
6
  */
7
7
 
8
- // Types
9
- export * from "./types.js";
8
+ // Types (explicit type-only exports)
9
+ export type {
10
+ // FEEL
11
+ FEELExpression,
12
+ // JSON Schema
13
+ JSONSchema,
14
+ JSONSchemaProperty,
15
+ JSONSchemaBase,
16
+ JSONSchemaString,
17
+ JSONSchemaNumber,
18
+ JSONSchemaInteger,
19
+ JSONSchemaBoolean,
20
+ JSONSchemaArray,
21
+ JSONSchemaObject,
22
+ JSONSchemaEnum,
23
+ // Field types
24
+ FieldType,
25
+ ValidationRule,
26
+ SelectOption,
27
+ FieldDefinition,
28
+ ComputedField,
29
+ PageDefinition,
30
+ FormMeta,
31
+ Forma,
32
+ // Evaluation
33
+ EvaluationContext,
34
+ // Results
35
+ VisibilityResult,
36
+ RequiredResult,
37
+ RequiredFieldsResult,
38
+ EnabledResult,
39
+ FieldError,
40
+ ValidationResult,
41
+ CalculationError,
42
+ CalculationResult,
43
+ } from "./types.js";
10
44
 
11
45
  // FEEL expression evaluation
12
46
  export * from "./feel/index.js";
@@ -1,258 +0,0 @@
1
- import { m as Forma, t as CalculationResult, n as VisibilityResult, o as RequiredFieldsResult, p as EnabledResult, r as ValidationResult, q as FieldError } from '../types-Bs3CG9JZ.cjs';
2
-
3
- /**
4
- * Calculation Engine
5
- *
6
- * Evaluates computed fields based on form data.
7
- * Computed values are derived from form data using FEEL expressions.
8
- */
9
-
10
- /**
11
- * Calculate all computed values from form data
12
- *
13
- * Evaluates each computed field's FEEL expression and returns the results.
14
- * Errors are collected rather than thrown, allowing partial results.
15
- *
16
- * @param data - Current form data
17
- * @param spec - Form specification with computed fields
18
- * @returns Computed values and any calculation errors
19
- *
20
- * @example
21
- * const spec = {
22
- * computed: {
23
- * bmi: {
24
- * expression: "weight / (height / 100) ** 2",
25
- * label: "BMI",
26
- * format: "decimal(1)"
27
- * },
28
- * isObese: {
29
- * expression: "$computed.bmi >= 30"
30
- * }
31
- * }
32
- * };
33
- *
34
- * const result = calculate({ weight: 85, height: 175 }, spec);
35
- * // => { values: { bmi: 27.76, isObese: false }, errors: [] }
36
- */
37
- declare function calculate(data: Record<string, unknown>, spec: Forma): Record<string, unknown>;
38
- /**
39
- * Calculate computed values with error reporting
40
- *
41
- * Same as calculate() but also returns any errors that occurred.
42
- *
43
- * @param data - Current form data
44
- * @param spec - Form specification
45
- * @returns Values and errors
46
- */
47
- declare function calculateWithErrors(data: Record<string, unknown>, spec: Forma): CalculationResult;
48
- /**
49
- * Get a computed value formatted according to its format specification
50
- *
51
- * @param fieldName - Name of the computed field
52
- * @param data - Current form data
53
- * @param spec - Form specification
54
- * @returns Formatted string or null if not displayable
55
- */
56
- declare function getFormattedValue(fieldName: string, data: Record<string, unknown>, spec: Forma): string | null;
57
- /**
58
- * Calculate a single computed field
59
- *
60
- * @param fieldName - Name of the computed field
61
- * @param data - Current form data
62
- * @param spec - Form specification
63
- * @returns Computed value or null if calculation failed
64
- */
65
- declare function calculateField(fieldName: string, data: Record<string, unknown>, spec: Forma): unknown;
66
-
67
- /**
68
- * Visibility Engine
69
- *
70
- * Determines which fields should be visible based on form data
71
- * and Forma visibility rules.
72
- */
73
-
74
- interface VisibilityOptions {
75
- /** Pre-calculated computed values (avoids recalculation) */
76
- computed?: Record<string, unknown>;
77
- }
78
- /**
79
- * Determine visibility for all fields in a form
80
- *
81
- * Returns a map of field paths to boolean visibility states.
82
- * Fields without visibleWhen expressions are always visible.
83
- *
84
- * @param data - Current form data
85
- * @param spec - Form specification
86
- * @param options - Optional pre-calculated computed values
87
- * @returns Map of field paths to visibility states
88
- *
89
- * @example
90
- * const visibility = getVisibility(
91
- * { age: 21, hasLicense: true },
92
- * forma
93
- * );
94
- * // => { age: true, hasLicense: true, vehicleType: true, ... }
95
- */
96
- declare function getVisibility(data: Record<string, unknown>, spec: Forma, options?: VisibilityOptions): VisibilityResult;
97
- /**
98
- * Check if a single field is visible
99
- *
100
- * Useful for checking visibility of one field without computing all.
101
- *
102
- * @param fieldPath - Field path to check
103
- * @param data - Current form data
104
- * @param spec - Form specification
105
- * @param options - Optional pre-calculated computed values
106
- * @returns True if the field is visible
107
- */
108
- declare function isFieldVisible(fieldPath: string, data: Record<string, unknown>, spec: Forma, options?: VisibilityOptions): boolean;
109
- /**
110
- * Determine which pages are visible in a wizard form
111
- *
112
- * @param data - Current form data
113
- * @param spec - Form specification with pages
114
- * @param options - Optional pre-calculated computed values
115
- * @returns Map of page IDs to visibility states
116
- */
117
- declare function getPageVisibility(data: Record<string, unknown>, spec: Forma, options?: VisibilityOptions): Record<string, boolean>;
118
-
119
- /**
120
- * Required Fields Engine
121
- *
122
- * Determines which fields are currently required based on
123
- * conditional requiredWhen expressions and schema required array.
124
- */
125
-
126
- interface RequiredOptions {
127
- /** Pre-calculated computed values */
128
- computed?: Record<string, unknown>;
129
- }
130
- /**
131
- * Determine which fields are currently required
132
- *
133
- * Returns a map of field paths to boolean required states.
134
- * Evaluates requiredWhen expressions for conditional requirements.
135
- *
136
- * @param data - Current form data
137
- * @param spec - Form specification
138
- * @param options - Optional pre-calculated computed values
139
- * @returns Map of field paths to required states
140
- *
141
- * @example
142
- * const required = getRequired(
143
- * { hasInsurance: true },
144
- * forma
145
- * );
146
- * // => { hasInsurance: true, insuranceProvider: true, policyNumber: true }
147
- */
148
- declare function getRequired(data: Record<string, unknown>, spec: Forma, options?: RequiredOptions): RequiredFieldsResult;
149
- /**
150
- * Check if a single field is currently required
151
- *
152
- * @param fieldPath - Path to the field
153
- * @param data - Current form data
154
- * @param spec - Form specification
155
- * @returns True if the field is required
156
- */
157
- declare function isRequired(fieldPath: string, data: Record<string, unknown>, spec: Forma): boolean;
158
-
159
- /**
160
- * Enabled Fields Engine
161
- *
162
- * Determines which fields are currently enabled (editable) based on
163
- * conditional enabledWhen expressions.
164
- */
165
-
166
- interface EnabledOptions {
167
- /** Pre-calculated computed values */
168
- computed?: Record<string, unknown>;
169
- }
170
- /**
171
- * Determine which fields are currently enabled (editable)
172
- *
173
- * Returns a map of field paths to boolean enabled states.
174
- * Fields without enabledWhen expressions are always enabled.
175
- *
176
- * @param data - Current form data
177
- * @param spec - Form specification
178
- * @param options - Optional pre-calculated computed values
179
- * @returns Map of field paths to enabled states
180
- *
181
- * @example
182
- * const enabled = getEnabled(
183
- * { isLocked: true },
184
- * forma
185
- * );
186
- * // => { isLocked: true, lockedField: false, ... }
187
- */
188
- declare function getEnabled(data: Record<string, unknown>, spec: Forma, options?: EnabledOptions): EnabledResult;
189
- /**
190
- * Check if a single field is currently enabled
191
- *
192
- * @param fieldPath - Path to the field
193
- * @param data - Current form data
194
- * @param spec - Form specification
195
- * @returns True if the field is enabled
196
- */
197
- declare function isEnabled(fieldPath: string, data: Record<string, unknown>, spec: Forma): boolean;
198
-
199
- /**
200
- * Validation Engine
201
- *
202
- * Validates form data against Forma rules including:
203
- * - JSON Schema type validation
204
- * - Required field validation (with conditional requiredWhen)
205
- * - Custom FEEL validation rules
206
- * - Array item validation
207
- */
208
-
209
- interface ValidateOptions {
210
- /** Pre-calculated computed values */
211
- computed?: Record<string, unknown>;
212
- /** Pre-calculated visibility */
213
- visibility?: Record<string, boolean>;
214
- /** Only validate visible fields (default: true) */
215
- onlyVisible?: boolean;
216
- }
217
- /**
218
- * Validate form data against a Forma
219
- *
220
- * Performs comprehensive validation including:
221
- * - Required field checks (respecting conditional requiredWhen)
222
- * - JSON Schema type validation
223
- * - Custom FEEL validation rules
224
- * - Array min/max items validation
225
- * - Array item field validation
226
- *
227
- * By default, only visible fields are validated.
228
- *
229
- * @param data - Current form data
230
- * @param spec - Form specification
231
- * @param options - Validation options
232
- * @returns Validation result with valid flag and errors array
233
- *
234
- * @example
235
- * const result = validate(
236
- * { name: "", age: 15 },
237
- * forma
238
- * );
239
- * // => {
240
- * // valid: false,
241
- * // errors: [
242
- * // { field: "name", message: "Name is required", severity: "error" },
243
- * // { field: "age", message: "Must be 18 or older", severity: "error" }
244
- * // ]
245
- * // }
246
- */
247
- declare function validate(data: Record<string, unknown>, spec: Forma, options?: ValidateOptions): ValidationResult;
248
- /**
249
- * Validate a single field
250
- *
251
- * @param fieldPath - Path to the field
252
- * @param data - Current form data
253
- * @param spec - Form specification
254
- * @returns Array of errors for this field
255
- */
256
- declare function validateSingleField(fieldPath: string, data: Record<string, unknown>, spec: Forma): FieldError[];
257
-
258
- export { type EnabledOptions, type RequiredOptions, type ValidateOptions, type VisibilityOptions, calculate, calculateField, calculateWithErrors, getEnabled, getFormattedValue, getPageVisibility, getRequired, getVisibility, isEnabled, isFieldVisible, isRequired, validate, validateSingleField };
@@ -1,105 +0,0 @@
1
- import { F as FEELExpression, E as EvaluationContext } from '../types-Bs3CG9JZ.cjs';
2
-
3
- /**
4
- * FEEL Expression Evaluator
5
- *
6
- * Wraps the feelin library to provide FEEL expression evaluation
7
- * with Forma context conventions.
8
- *
9
- * Context variable conventions:
10
- * - `fieldName` - Direct field value access
11
- * - `computed.name` - Computed value access
12
- * - `ref.path` - Reference data lookup (external lookup tables)
13
- * - `item.fieldName` - Array item field access (within array context)
14
- * - `itemIndex` - Current array item index (0-based)
15
- * - `value` - Current field value (in validation expressions)
16
- */
17
-
18
- interface EvaluateResult<T = unknown> {
19
- success: true;
20
- value: T;
21
- }
22
- interface EvaluateError {
23
- success: false;
24
- error: string;
25
- expression: string;
26
- }
27
- type EvaluationOutcome<T = unknown> = EvaluateResult<T> | EvaluateError;
28
- /**
29
- * Evaluate a FEEL expression and return the result
30
- *
31
- * @param expression - FEEL expression string
32
- * @param context - Evaluation context with form data, computed values, etc.
33
- * @returns Evaluation outcome with success/value or error
34
- *
35
- * @example
36
- * // Simple field comparison
37
- * evaluate("age >= 18", { data: { age: 21 } })
38
- * // => { success: true, value: true }
39
- *
40
- * @example
41
- * // Computed value reference
42
- * evaluate("computed.bmi > 30", { data: {}, computed: { bmi: 32.5 } })
43
- * // => { success: true, value: true }
44
- *
45
- * @example
46
- * // Array item context
47
- * evaluate("item.frequency = \"daily\"", { data: {}, item: { frequency: "daily" } })
48
- * // => { success: true, value: true }
49
- */
50
- declare function evaluate<T = unknown>(expression: FEELExpression, context: EvaluationContext): EvaluationOutcome<T>;
51
- /**
52
- * Evaluate a FEEL expression expecting a boolean result
53
- *
54
- * Used for visibility, required, and enabled conditions.
55
- * Returns false on error or non-boolean result for safety.
56
- *
57
- * @param expression - FEEL expression that should return boolean
58
- * @param context - Evaluation context
59
- * @returns Boolean result (false on error)
60
- */
61
- declare function evaluateBoolean(expression: FEELExpression, context: EvaluationContext): boolean;
62
- /**
63
- * Evaluate a FEEL expression expecting a numeric result
64
- *
65
- * Used for computed values that return numbers.
66
- *
67
- * @param expression - FEEL expression that should return number
68
- * @param context - Evaluation context
69
- * @returns Numeric result or null on error
70
- */
71
- declare function evaluateNumber(expression: FEELExpression, context: EvaluationContext): number | null;
72
- /**
73
- * Evaluate a FEEL expression expecting a string result
74
- *
75
- * @param expression - FEEL expression that should return string
76
- * @param context - Evaluation context
77
- * @returns String result or null on error
78
- */
79
- declare function evaluateString(expression: FEELExpression, context: EvaluationContext): string | null;
80
- /**
81
- * Evaluate multiple FEEL expressions at once
82
- *
83
- * Useful for evaluating all visibility conditions in a form.
84
- *
85
- * @param expressions - Map of field names to FEEL expressions
86
- * @param context - Evaluation context
87
- * @returns Map of field names to boolean results
88
- */
89
- declare function evaluateBooleanBatch(expressions: Record<string, FEELExpression>, context: EvaluationContext): Record<string, boolean>;
90
- /**
91
- * Check if a FEEL expression is syntactically valid
92
- *
93
- * @param expression - FEEL expression to validate
94
- * @returns True if the expression can be parsed
95
- */
96
- declare function isValidExpression(expression: FEELExpression): boolean;
97
- /**
98
- * Validate a FEEL expression and return any parsing errors
99
- *
100
- * @param expression - FEEL expression to validate
101
- * @returns Null if valid, error message if invalid
102
- */
103
- declare function validateExpression(expression: FEELExpression): string | null;
104
-
105
- export { type EvaluateError, type EvaluateResult, type EvaluationOutcome, evaluate, evaluateBoolean, evaluateBooleanBatch, evaluateNumber, evaluateString, isValidExpression, validateExpression };
package/dist/index.d.cts DELETED
@@ -1,3 +0,0 @@
1
- export { s as CalculationError, t as CalculationResult, C as ComputedField, p as EnabledResult, E as EvaluationContext, F as FEELExpression, k as FieldDefinition, q as FieldError, j as FieldType, l as FormMeta, m as Forma, J as JSONSchema, g as JSONSchemaArray, b as JSONSchemaBase, f as JSONSchemaBoolean, i as JSONSchemaEnum, e as JSONSchemaInteger, d as JSONSchemaNumber, h as JSONSchemaObject, a as JSONSchemaProperty, c as JSONSchemaString, P as PageDefinition, o as RequiredFieldsResult, R as RequiredResult, S as SelectOption, r as ValidationResult, V as ValidationRule, n as VisibilityResult } from './types-Bs3CG9JZ.cjs';
2
- export { EvaluateError, EvaluateResult, EvaluationOutcome, evaluate, evaluateBoolean, evaluateBooleanBatch, evaluateNumber, evaluateString, isValidExpression, validateExpression } from './feel/index.cjs';
3
- export { EnabledOptions, RequiredOptions, ValidateOptions, VisibilityOptions, calculate, calculateField, calculateWithErrors, getEnabled, getFormattedValue, getPageVisibility, getRequired, getVisibility, isEnabled, isFieldVisible, isRequired, validate, validateSingleField } from './engine/index.cjs';
@@ -1,283 +0,0 @@
1
- /**
2
- * Core Forma Type Definitions
3
- *
4
- * This module defines the complete type system for Forma specifications.
5
- * All conditional logic uses FEEL (Friendly Enough Expression Language).
6
- */
7
- /**
8
- * FEEL expression - a string that will be evaluated at runtime.
9
- *
10
- * Available context variables:
11
- * - `fieldName` - Any field value by name
12
- * - `computed.name` - Computed value by name
13
- * - `ref.path` - Reference data lookup (external lookup tables)
14
- * - `item.fieldName` - Field within current array item
15
- * - `itemIndex` - Current item index (0-based)
16
- * - `value` - Current field value (in validation expressions)
17
- *
18
- * @example
19
- * "age >= 18"
20
- * "claimType = \"Auto\" and wasDriver = true"
21
- * "computed.bmi > 30"
22
- * "item.frequency = \"daily\""
23
- */
24
- type FEELExpression = string;
25
- /**
26
- * Standard JSON Schema (subset we support)
27
- */
28
- interface JSONSchema {
29
- type: "object";
30
- properties: Record<string, JSONSchemaProperty>;
31
- required?: string[];
32
- $defs?: Record<string, JSONSchemaProperty>;
33
- }
34
- type JSONSchemaProperty = JSONSchemaString | JSONSchemaNumber | JSONSchemaInteger | JSONSchemaBoolean | JSONSchemaArray | JSONSchemaObject | JSONSchemaEnum;
35
- interface JSONSchemaBase {
36
- description?: string;
37
- title?: string;
38
- }
39
- interface JSONSchemaString extends JSONSchemaBase {
40
- type: "string";
41
- minLength?: number;
42
- maxLength?: number;
43
- pattern?: string;
44
- format?: "date" | "date-time" | "email" | "uri" | "uuid";
45
- enum?: string[];
46
- }
47
- interface JSONSchemaNumber extends JSONSchemaBase {
48
- type: "number";
49
- minimum?: number;
50
- maximum?: number;
51
- exclusiveMinimum?: number;
52
- exclusiveMaximum?: number;
53
- }
54
- interface JSONSchemaInteger extends JSONSchemaBase {
55
- type: "integer";
56
- minimum?: number;
57
- maximum?: number;
58
- }
59
- interface JSONSchemaBoolean extends JSONSchemaBase {
60
- type: "boolean";
61
- }
62
- interface JSONSchemaArray extends JSONSchemaBase {
63
- type: "array";
64
- items: JSONSchemaProperty;
65
- minItems?: number;
66
- maxItems?: number;
67
- }
68
- interface JSONSchemaObject extends JSONSchemaBase {
69
- type: "object";
70
- properties: Record<string, JSONSchemaProperty>;
71
- required?: string[];
72
- }
73
- interface JSONSchemaEnum extends JSONSchemaBase {
74
- type: "string";
75
- enum: string[];
76
- }
77
- /**
78
- * Field type enumeration - maps to UI component types
79
- */
80
- type FieldType = "text" | "password" | "number" | "integer" | "boolean" | "select" | "multiselect" | "date" | "datetime" | "email" | "url" | "textarea" | "array" | "object" | "computed";
81
- /**
82
- * Validation rule with FEEL expression
83
- */
84
- interface ValidationRule {
85
- /** FEEL expression that should evaluate to true for valid data */
86
- rule: FEELExpression;
87
- /** Error message shown when validation fails */
88
- message: string;
89
- /** Severity level - errors block submission, warnings are informational */
90
- severity?: "error" | "warning";
91
- }
92
- /**
93
- * Option for select/multiselect fields
94
- */
95
- interface SelectOption {
96
- /** Option value - can be string or number to match schema types */
97
- value: string | number;
98
- label: string;
99
- /** When to show this option */
100
- visibleWhen?: FEELExpression;
101
- }
102
- /**
103
- * Field definition with all conditional logic
104
- */
105
- interface FieldDefinition {
106
- /** Display label for the field */
107
- label?: string;
108
- /** Help text or description */
109
- description?: string;
110
- /** Placeholder text for input fields */
111
- placeholder?: string;
112
- /** Field type override (inferred from schema if not provided) */
113
- type?: FieldType;
114
- /** When to show this field. If omitted, always visible. */
115
- visibleWhen?: FEELExpression;
116
- /** When this field is required. If omitted, uses schema required. */
117
- requiredWhen?: FEELExpression;
118
- /** When this field is editable. If omitted, always enabled. */
119
- enabledWhen?: FEELExpression;
120
- /** Custom validation rules using FEEL expressions */
121
- validations?: ValidationRule[];
122
- /** For array fields: field definitions for each item. Requires type: "array" */
123
- itemFields?: Record<string, FieldDefinition>;
124
- /** Minimum number of items (overrides schema) */
125
- minItems?: number;
126
- /** Maximum number of items (overrides schema) */
127
- maxItems?: number;
128
- /** For select fields: available options */
129
- options?: SelectOption[];
130
- }
131
- /**
132
- * Computed field definition - derived values from form data
133
- */
134
- interface ComputedField {
135
- /** FEEL expression to calculate the value */
136
- expression: FEELExpression;
137
- /** Display label */
138
- label?: string;
139
- /** Display format (e.g., "decimal(1)", "currency", "percent") */
140
- format?: string;
141
- /** Whether to display this value in the form */
142
- display?: boolean;
143
- }
144
- /**
145
- * Page definition for multi-step wizard forms
146
- */
147
- interface PageDefinition {
148
- /** Unique page identifier */
149
- id: string;
150
- /** Page title */
151
- title: string;
152
- /** Page description/instructions */
153
- description?: string;
154
- /** When to show this page */
155
- visibleWhen?: FEELExpression;
156
- /** Field paths to include on this page */
157
- fields: string[];
158
- }
159
- /**
160
- * Form metadata
161
- */
162
- interface FormMeta {
163
- /** Unique form identifier */
164
- id: string;
165
- /** Form title */
166
- title: string;
167
- /** Form description */
168
- description?: string;
169
- /** Form version */
170
- version?: string;
171
- }
172
- /**
173
- * Complete Form Specification
174
- *
175
- * This is the root type that defines an entire form including:
176
- * - Data schema (JSON Schema)
177
- * - Computed values
178
- * - Reference data (lookup tables for calculations)
179
- * - Field-level configuration and conditional logic
180
- * - Field ordering
181
- * - Optional wizard/page structure
182
- */
183
- interface Forma {
184
- /** Schema version identifier */
185
- $schema?: string;
186
- /** Spec version */
187
- version: "1.0";
188
- /** Form metadata */
189
- meta: FormMeta;
190
- /** JSON Schema defining the data structure */
191
- schema: JSONSchema;
192
- /** Computed/calculated values */
193
- computed?: Record<string, ComputedField>;
194
- /** Reference data for lookups (external data sources, lookup tables) */
195
- referenceData?: Record<string, unknown>;
196
- /** Field-level definitions and rules */
197
- fields: Record<string, FieldDefinition>;
198
- /** Order in which fields should be displayed */
199
- fieldOrder: string[];
200
- /** Optional multi-page wizard structure */
201
- pages?: PageDefinition[];
202
- }
203
- /**
204
- * Context provided when evaluating FEEL expressions
205
- */
206
- interface EvaluationContext {
207
- /** Current form data */
208
- data: Record<string, unknown>;
209
- /** Computed values (calculated before field evaluation) */
210
- computed?: Record<string, unknown>;
211
- /** Reference data for lookups (external data sources, lookup tables) */
212
- referenceData?: Record<string, unknown>;
213
- /** Current array item (when evaluating within array context) */
214
- item?: Record<string, unknown>;
215
- /** Current array item index (0-based) */
216
- itemIndex?: number;
217
- /** Current field value (for validation expressions) */
218
- value?: unknown;
219
- }
220
- /**
221
- * Field visibility result - map of field path to visibility state
222
- */
223
- interface VisibilityResult {
224
- [fieldPath: string]: boolean;
225
- }
226
- /**
227
- * Required fields result - map of field path to required state
228
- */
229
- interface RequiredResult {
230
- [fieldPath: string]: boolean;
231
- }
232
- /**
233
- * Alias for RequiredResult (backwards compatibility)
234
- */
235
- type RequiredFieldsResult = RequiredResult;
236
- /**
237
- * Enabled fields result - map of field path to enabled state
238
- */
239
- interface EnabledResult {
240
- [fieldPath: string]: boolean;
241
- }
242
- /**
243
- * Field validation error
244
- */
245
- interface FieldError {
246
- /** Field path that has the error */
247
- field: string;
248
- /** Error message */
249
- message: string;
250
- /** Error severity */
251
- severity: "error" | "warning";
252
- }
253
- /**
254
- * Validation result
255
- */
256
- interface ValidationResult {
257
- /** Whether the form data is valid */
258
- valid: boolean;
259
- /** List of validation errors */
260
- errors: FieldError[];
261
- }
262
- /**
263
- * Calculation error
264
- */
265
- interface CalculationError {
266
- /** Computed field name */
267
- field: string;
268
- /** Error message */
269
- message: string;
270
- /** The expression that failed */
271
- expression: string;
272
- }
273
- /**
274
- * Calculation result with potential errors
275
- */
276
- interface CalculationResult {
277
- /** Computed values */
278
- values: Record<string, unknown>;
279
- /** Errors encountered during calculation */
280
- errors: CalculationError[];
281
- }
282
-
283
- export type { ComputedField as C, EvaluationContext as E, FEELExpression as F, JSONSchema as J, PageDefinition as P, RequiredResult as R, SelectOption as S, ValidationRule as V, JSONSchemaProperty as a, JSONSchemaBase as b, JSONSchemaString as c, JSONSchemaNumber as d, JSONSchemaInteger as e, JSONSchemaBoolean as f, JSONSchemaArray as g, JSONSchemaObject as h, JSONSchemaEnum as i, FieldType as j, FieldDefinition as k, FormMeta as l, Forma as m, VisibilityResult as n, RequiredFieldsResult as o, EnabledResult as p, FieldError as q, ValidationResult as r, CalculationError as s, CalculationResult as t };