@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.
Files changed (105) hide show
  1. package/FormWizard.d.ts +10 -0
  2. package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts +23 -0
  3. package/features/api-integration/index.d.ts +12 -0
  4. package/features/api-integration/services/ActionExecutor.d.ts +18 -0
  5. package/features/api-integration/services/ApiCallExecutor.d.ts +2 -0
  6. package/features/api-integration/services/ApiCallService.d.ts +40 -0
  7. package/features/api-integration/services/DialogExecutor.d.ts +2 -0
  8. package/features/api-integration/services/GenericTriggerService.d.ts +118 -0
  9. package/features/api-integration/services/NavigationExecutor.d.ts +2 -0
  10. package/features/dialog-system/components/ActionDialog/ActionDialog.d.ts +11 -0
  11. package/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.d.ts +11 -0
  12. package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts +11 -0
  13. package/features/dialog-system/index.d.ts +8 -0
  14. package/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +19 -0
  15. package/features/form-runtime/FormWizard/FormWizard.d.ts +10 -0
  16. package/features/form-runtime/components/FormField.d.ts +7 -0
  17. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  18. package/features/form-runtime/components/FormHeader.d.ts +9 -0
  19. package/features/form-runtime/components/FormSection/FormSection.d.ts +6 -0
  20. package/features/form-runtime/components/FormStep/FormStep.d.ts +2 -0
  21. package/features/form-runtime/components/ProgressLoaderRuntime.d.ts +12 -0
  22. package/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.d.ts +2 -0
  23. package/features/form-runtime/components/displayValue/displayValue.d.ts +21 -0
  24. package/features/form-runtime/components/index.d.ts +3 -0
  25. package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts +7 -0
  26. package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +13 -0
  27. package/features/form-runtime/config/configResolver.d.ts +14 -0
  28. package/features/form-runtime/config/index.d.ts +9 -0
  29. package/features/form-runtime/config/templateConfig.d.ts +148 -0
  30. package/features/form-runtime/config/templateLoader.d.ts +25 -0
  31. package/features/form-runtime/config/templateUtils.d.ts +12 -0
  32. package/features/form-runtime/context/LoaderContext.d.ts +31 -0
  33. package/features/form-runtime/hooks/index.d.ts +1 -0
  34. package/features/form-runtime/hooks/useApiActions.d.ts +42 -0
  35. package/features/form-runtime/hooks/useComponentTriggers.d.ts +42 -0
  36. package/features/form-runtime/hooks/useComponentVisibility.d.ts +13 -0
  37. package/features/form-runtime/hooks/useFieldEventHandlers.d.ts +14 -0
  38. package/features/form-runtime/hooks/useFormContext.d.ts +4 -0
  39. package/features/form-runtime/hooks/useFormFieldState.d.ts +13 -0
  40. package/features/form-runtime/hooks/useValidationEvents.d.ts +13 -0
  41. package/features/form-runtime/index.d.ts +12 -0
  42. package/features/form-runtime/utils/componentDisplayValue.d.ts +9 -0
  43. package/features/form-runtime/utils/errorUtils.d.ts +13 -0
  44. package/features/form-runtime/utils/fieldHelpers.d.ts +38 -0
  45. package/features/form-runtime/utils/formDataBuilder.d.ts +7 -0
  46. package/features/form-runtime/utils/formDirtyStateSync.d.ts +77 -0
  47. package/features/form-runtime/utils/formSaver.d.ts +22 -0
  48. package/features/form-runtime/utils/index.d.ts +4 -0
  49. package/features/form-runtime/utils/logger.d.ts +70 -0
  50. package/features/form-runtime/utils/validation.d.ts +3 -0
  51. package/features/form-runtime/utils/validationUX.d.ts +70 -0
  52. package/features/form-runtime/utils/visibilityUtils.d.ts +13 -0
  53. package/features/index.d.ts +11 -0
  54. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +9 -0
  55. package/features/state-management/index.d.ts +8 -0
  56. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  57. package/features/state-management/machines/__tests__/testUtils.d.ts +78 -0
  58. package/features/state-management/machines/__tests__/vitest.config.d.ts +2 -0
  59. package/features/state-management/machines/actions/componentActions.d.ts +10 -0
  60. package/features/state-management/machines/actions/navigationActions.d.ts +50 -0
  61. package/features/state-management/machines/actions/saveActions.d.ts +38 -0
  62. package/features/state-management/machines/actions/validationActions.d.ts +68 -0
  63. package/features/state-management/machines/componentTriggerEngine.d.ts +90 -0
  64. package/features/state-management/machines/formMachine.d.ts +216 -0
  65. package/features/state-management/machines/guards/navigationGuards.d.ts +32 -0
  66. package/features/state-management/machines/guards/saveGuards.d.ts +55 -0
  67. package/features/state-management/machines/guards/triggerGuards.d.ts +24 -0
  68. package/features/state-management/machines/helpers/triggerHelpers.d.ts +14 -0
  69. package/features/state-management/machines/index.d.ts +4 -0
  70. package/features/state-management/machines/lazyLoading.d.ts +34 -0
  71. package/features/state-management/machines/performance.d.ts +80 -0
  72. package/features/state-management/machines/types.d.ts +315 -0
  73. package/features/state-management/machines/useFormMachine.d.ts +1508 -0
  74. package/features/state-management/machines/validation/index.d.ts +5 -0
  75. package/features/state-management/machines/validation/validateField.d.ts +2 -0
  76. package/features/state-management/machines/validation/validateForm.d.ts +2 -0
  77. package/features/state-management/machines/validation/validateSection.d.ts +2 -0
  78. package/features/state-management/machines/validation/validateStep.d.ts +2 -0
  79. package/features/state-management/machines/validation/validationTypes.d.ts +1 -0
  80. package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts +8 -0
  81. package/features/trigger-action-system/components/ActionManager.d.ts +6 -0
  82. package/features/trigger-action-system/components/ComponentAlert/ComponentAlert.d.ts +10 -0
  83. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +20 -0
  84. package/features/trigger-action-system/index.d.ts +10 -0
  85. package/features/trigger-action-system/utils/GenericTriggerEngine.d.ts +118 -0
  86. package/features/trigger-action-system/utils/triggerActionSystem.d.ts +193 -0
  87. package/features/validation-system/components/ValidationDebugger.d.ts +2 -0
  88. package/features/validation-system/index.d.ts +7 -0
  89. package/features/validation-system/validation/ActionValidation.d.ts +54 -0
  90. package/features/validation-system/validation/SchemaBuilder.d.ts +36 -0
  91. package/features/validation-system/validation/ValidationCache.d.ts +36 -0
  92. package/features/validation-system/validation/ValidationEngine.d.ts +86 -0
  93. package/features/validation-system/validation/ValidationExecutor.d.ts +36 -0
  94. package/features/validation-system/validation/index.d.ts +38 -0
  95. package/features/validation-system/validation/secureValidatorEngine.d.ts +64 -0
  96. package/features/validation-system/validation/tanstackSchemaAdapter.d.ts +15 -0
  97. package/features/validation-system/validation/validationService.d.ts +43 -0
  98. package/index.cjs +231 -284
  99. package/index.cjs.map +1 -1
  100. package/index.d.ts +8 -0
  101. package/index.js +231 -284
  102. package/index.js.map +1 -1
  103. package/package.json +1 -1
  104. package/styles/index.d.ts +0 -0
  105. 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>;