@digiform/wizard 0.1.7 → 0.2.2
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/FormWizard.d.ts +10 -0
- package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts +23 -0
- package/features/api-integration/index.d.ts +12 -0
- package/features/api-integration/services/ActionExecutor.d.ts +18 -0
- package/features/api-integration/services/ApiCallExecutor.d.ts +2 -0
- package/features/api-integration/services/ApiCallService.d.ts +40 -0
- package/features/api-integration/services/DialogExecutor.d.ts +2 -0
- package/features/api-integration/services/GenericTriggerService.d.ts +118 -0
- package/features/api-integration/services/NavigationExecutor.d.ts +2 -0
- package/features/dialog-system/components/ActionDialog/ActionDialog.d.ts +11 -0
- package/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.d.ts +11 -0
- package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts +11 -0
- package/features/dialog-system/index.d.ts +8 -0
- package/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +19 -0
- package/features/form-runtime/FormWizard/FormWizard.d.ts +10 -0
- package/features/form-runtime/components/FormField.d.ts +7 -0
- package/features/form-runtime/components/FormFooter.d.ts +5 -0
- package/features/form-runtime/components/FormHeader.d.ts +9 -0
- package/features/form-runtime/components/FormSection/FormSection.d.ts +6 -0
- package/features/form-runtime/components/FormStep/FormStep.d.ts +2 -0
- package/features/form-runtime/components/ProgressLoaderRuntime.d.ts +12 -0
- package/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.d.ts +2 -0
- package/features/form-runtime/components/displayValue/displayValue.d.ts +21 -0
- package/features/form-runtime/components/index.d.ts +3 -0
- package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts +7 -0
- package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +13 -0
- package/features/form-runtime/config/configResolver.d.ts +14 -0
- package/features/form-runtime/config/index.d.ts +9 -0
- package/features/form-runtime/config/templateConfig.d.ts +148 -0
- package/features/form-runtime/config/templateLoader.d.ts +25 -0
- package/features/form-runtime/config/templateUtils.d.ts +12 -0
- package/features/form-runtime/context/LoaderContext.d.ts +31 -0
- package/features/form-runtime/hooks/index.d.ts +1 -0
- package/features/form-runtime/hooks/useApiActions.d.ts +42 -0
- package/features/form-runtime/hooks/useComponentTriggers.d.ts +42 -0
- package/features/form-runtime/hooks/useComponentVisibility.d.ts +13 -0
- package/features/form-runtime/hooks/useFieldEventHandlers.d.ts +14 -0
- package/features/form-runtime/hooks/useFormContext.d.ts +4 -0
- package/features/form-runtime/hooks/useFormFieldState.d.ts +13 -0
- package/features/form-runtime/hooks/useValidationEvents.d.ts +13 -0
- package/features/form-runtime/index.d.ts +12 -0
- package/features/form-runtime/utils/componentDisplayValue.d.ts +9 -0
- package/features/form-runtime/utils/errorUtils.d.ts +13 -0
- package/features/form-runtime/utils/fieldHelpers.d.ts +38 -0
- package/features/form-runtime/utils/formDataBuilder.d.ts +7 -0
- package/features/form-runtime/utils/formDirtyStateSync.d.ts +77 -0
- package/features/form-runtime/utils/formSaver.d.ts +22 -0
- package/features/form-runtime/utils/index.d.ts +4 -0
- package/features/form-runtime/utils/logger.d.ts +70 -0
- package/features/form-runtime/utils/validation.d.ts +3 -0
- package/features/form-runtime/utils/validationUX.d.ts +70 -0
- package/features/form-runtime/utils/visibilityUtils.d.ts +13 -0
- package/features/index.d.ts +11 -0
- package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +9 -0
- package/features/state-management/index.d.ts +8 -0
- package/features/state-management/machines/__tests__/setup.d.ts +0 -0
- package/features/state-management/machines/__tests__/testUtils.d.ts +78 -0
- package/features/state-management/machines/__tests__/vitest.config.d.ts +2 -0
- package/features/state-management/machines/actions/componentActions.d.ts +10 -0
- package/features/state-management/machines/actions/navigationActions.d.ts +50 -0
- package/features/state-management/machines/actions/saveActions.d.ts +38 -0
- package/features/state-management/machines/actions/validationActions.d.ts +68 -0
- package/features/state-management/machines/componentTriggerEngine.d.ts +90 -0
- package/features/state-management/machines/formMachine.d.ts +216 -0
- package/features/state-management/machines/guards/navigationGuards.d.ts +32 -0
- package/features/state-management/machines/guards/saveGuards.d.ts +55 -0
- package/features/state-management/machines/guards/triggerGuards.d.ts +24 -0
- package/features/state-management/machines/helpers/triggerHelpers.d.ts +14 -0
- package/features/state-management/machines/index.d.ts +4 -0
- package/features/state-management/machines/lazyLoading.d.ts +34 -0
- package/features/state-management/machines/performance.d.ts +80 -0
- package/features/state-management/machines/types.d.ts +315 -0
- package/features/state-management/machines/useFormMachine.d.ts +1508 -0
- package/features/state-management/machines/validation/index.d.ts +5 -0
- package/features/state-management/machines/validation/validateField.d.ts +2 -0
- package/features/state-management/machines/validation/validateForm.d.ts +2 -0
- package/features/state-management/machines/validation/validateSection.d.ts +2 -0
- package/features/state-management/machines/validation/validateStep.d.ts +2 -0
- package/features/state-management/machines/validation/validationTypes.d.ts +1 -0
- package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts +8 -0
- package/features/trigger-action-system/components/ActionManager.d.ts +6 -0
- package/features/trigger-action-system/components/ComponentAlert/ComponentAlert.d.ts +10 -0
- package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +20 -0
- package/features/trigger-action-system/index.d.ts +10 -0
- package/features/trigger-action-system/utils/GenericTriggerEngine.d.ts +118 -0
- package/features/trigger-action-system/utils/triggerActionSystem.d.ts +193 -0
- package/features/validation-system/components/ValidationDebugger.d.ts +2 -0
- package/features/validation-system/index.d.ts +7 -0
- package/features/validation-system/validation/ActionValidation.d.ts +54 -0
- package/features/validation-system/validation/SchemaBuilder.d.ts +36 -0
- package/features/validation-system/validation/ValidationCache.d.ts +36 -0
- package/features/validation-system/validation/ValidationEngine.d.ts +86 -0
- package/features/validation-system/validation/ValidationExecutor.d.ts +36 -0
- package/features/validation-system/validation/index.d.ts +38 -0
- package/features/validation-system/validation/secureValidatorEngine.d.ts +64 -0
- package/features/validation-system/validation/tanstackSchemaAdapter.d.ts +15 -0
- package/features/validation-system/validation/validationService.d.ts +43 -0
- package/index.cjs +231 -284
- package/index.cjs.map +1 -1
- package/index.d.ts +8 -0
- package/index.js +231 -284
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/index.d.ts +0 -0
- package/styles.css +10 -18
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Validation System
|
|
3
|
+
*
|
|
4
|
+
* This module provides a consolidated validation architecture that replaces
|
|
5
|
+
* the previous scattered validation logic with a single, performant ValidationEngine.
|
|
6
|
+
*
|
|
7
|
+
* Key Features:
|
|
8
|
+
* - Debounced validation (300ms default) for better performance
|
|
9
|
+
* - Schema caching with memoization to avoid re-creating schemas
|
|
10
|
+
* - Single API for field, step, and form-level validation
|
|
11
|
+
* - Support for both "withLabel" and "simple" validation message styles
|
|
12
|
+
* - TypeScript-first design with comprehensive type safety
|
|
13
|
+
*/
|
|
14
|
+
export { createTanStackSchema, validateWithTanStack, validateWithTanStackReturnArray, } from './tanstackSchemaAdapter';
|
|
15
|
+
export { createValidationEngine, defaultValidationEngine, type FieldValidationResult, ValidationEngine, type ValidationOptions, type ValidationResult, } from './ValidationEngine';
|
|
16
|
+
export { findComponentById, getAllComponents, getStepComponents, isFormValid, isStepValid, validateField, validateFieldReturnArray, validateForm, validateStep, } from './validationService';
|
|
17
|
+
/**
|
|
18
|
+
* Migration Guide:
|
|
19
|
+
*
|
|
20
|
+
* Old approach:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { createComponentSchema } from '../utils/createZodSchema';
|
|
23
|
+
* const schema = createComponentSchema(component, messageStyle);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* New approach:
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { ValidationEngine } from './validation';
|
|
29
|
+
* const engine = new ValidationEngine({ messageStyle });
|
|
30
|
+
* const schema = engine.getComponentSchema(component);
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Benefits of new approach:
|
|
34
|
+
* - Automatic schema caching
|
|
35
|
+
* - Debounced validation support
|
|
36
|
+
* - Better performance
|
|
37
|
+
* - Cleaner, more maintainable code
|
|
38
|
+
*/
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FlowData, FormFieldValue } from '../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for secure validator execution
|
|
4
|
+
*/
|
|
5
|
+
export interface SecureValidatorConfig {
|
|
6
|
+
/** Maximum execution time in milliseconds */
|
|
7
|
+
timeoutMs: number;
|
|
8
|
+
/** Whether to log security violations */
|
|
9
|
+
enableSecurityLogging: boolean;
|
|
10
|
+
/** Maximum recursion depth for object validation */
|
|
11
|
+
maxRecursionDepth: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Default configuration for secure validator
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_SECURE_VALIDATOR_CONFIG: SecureValidatorConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Result of secure validator execution
|
|
19
|
+
*/
|
|
20
|
+
export interface SecureValidatorResult {
|
|
21
|
+
isValid: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
securityViolation?: string;
|
|
24
|
+
executionTimeMs?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Type for secure custom validator function
|
|
28
|
+
* This replaces the unsafe string-based validators
|
|
29
|
+
*/
|
|
30
|
+
export type SecureCustomValidator = (value: FormFieldValue, formData?: FlowData) => boolean | Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Secure Custom Validator Engine
|
|
33
|
+
*
|
|
34
|
+
* Provides secure execution of custom validation functions with:
|
|
35
|
+
* - Input sanitization
|
|
36
|
+
* - Execution timeout
|
|
37
|
+
* - Output validation
|
|
38
|
+
* - Error handling
|
|
39
|
+
* - Security logging
|
|
40
|
+
*/
|
|
41
|
+
export declare class SecureValidatorEngine {
|
|
42
|
+
private config;
|
|
43
|
+
constructor(config?: Partial<SecureValidatorConfig>);
|
|
44
|
+
/**
|
|
45
|
+
* Executes a custom validator function securely
|
|
46
|
+
*/
|
|
47
|
+
executeValidator(validator: SecureCustomValidator, value: FormFieldValue, formData?: FlowData): Promise<SecureValidatorResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Synchronous validator execution (with timeout protection)
|
|
50
|
+
*/
|
|
51
|
+
executeValidatorSync(validator: SecureCustomValidator, value: FormFieldValue, formData?: FlowData): SecureValidatorResult;
|
|
52
|
+
/**
|
|
53
|
+
* Updates the security configuration
|
|
54
|
+
*/
|
|
55
|
+
updateConfig(newConfig: Partial<SecureValidatorConfig>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the current security configuration
|
|
58
|
+
*/
|
|
59
|
+
getConfig(): SecureValidatorConfig;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Default global secure validator engine instance
|
|
63
|
+
*/
|
|
64
|
+
export declare const defaultSecureValidatorEngine: SecureValidatorEngine;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Adapts a component's validation rules to a TanStack-compatible schema
|
|
4
|
+
*/
|
|
5
|
+
export declare function createTanStackSchema(component: ComponentConfig, messageStyle?: "withLabel" | "simple"): unknown;
|
|
6
|
+
/**
|
|
7
|
+
* Validates a field value using ValidationEngine
|
|
8
|
+
* Returns undefined if valid, or error message if invalid
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateWithTanStack(component: ComponentConfig, value: unknown, messageStyle?: "withLabel" | "simple"): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Validates a field value using ValidationEngine
|
|
13
|
+
* Returns array of error messages if invalid, empty array if valid
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateWithTanStackReturnArray(component: ComponentConfig, value: unknown): string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComponentConfig, FormData, FormWizardConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Validate a single field
|
|
4
|
+
* @returns undefined if valid, error message if invalid
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateField(component: ComponentConfig, value: unknown): Promise<string | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Validate a single field and return array of errors
|
|
9
|
+
* @returns Array of error messages, empty if valid
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateFieldReturnArray(component: ComponentConfig, value: unknown): Promise<string[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Find a component by ID in the form config
|
|
14
|
+
*/
|
|
15
|
+
export declare function findComponentById(config: FormWizardConfig, componentId: string): ComponentConfig | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Get all components in a specific step
|
|
18
|
+
*/
|
|
19
|
+
export declare function getStepComponents(config: FormWizardConfig, stepId: string): ComponentConfig[];
|
|
20
|
+
/**
|
|
21
|
+
* Get all components in the form
|
|
22
|
+
*/
|
|
23
|
+
export declare function getAllComponents(config: FormWizardConfig): ComponentConfig[];
|
|
24
|
+
/**
|
|
25
|
+
* Validate all fields in a step
|
|
26
|
+
* @returns Record of field IDs to arrays of error messages
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateStep(config: FormWizardConfig, stepId: string, data: FormData): Promise<Record<string, string[]>>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a step is valid
|
|
31
|
+
* @returns true if all fields in the step are valid
|
|
32
|
+
*/
|
|
33
|
+
export declare function isStepValid(config: FormWizardConfig, stepId: string, data: FormData): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Validate the entire form
|
|
36
|
+
* @returns Record of field IDs to arrays of error messages
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateForm(config: FormWizardConfig, data: FormData): Promise<Record<string, string[]>>;
|
|
39
|
+
/**
|
|
40
|
+
* Check if the entire form is valid
|
|
41
|
+
* @returns true if all fields in the form are valid
|
|
42
|
+
*/
|
|
43
|
+
export declare function isFormValid(config: FormWizardConfig, data: FormData): Promise<boolean>;
|