@digiform/builder 0.1.7 → 0.2.4
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/FormBuilder.d.ts +24 -0
- package/client.cjs +1 -1
- package/client.d.ts +18 -0
- package/client.js +1 -1
- package/component-registry/components/alert.d.ts +4 -0
- package/component-registry/components/button.d.ts +4 -0
- package/component-registry/components/checkbox.d.ts +9 -0
- package/component-registry/components/code-input/code-input.d.ts +4 -0
- package/component-registry/components/dropdown.d.ts +1 -0
- package/component-registry/components/heading.d.ts +4 -0
- package/component-registry/components/index.d.ts +35 -0
- package/component-registry/components/paragraph.d.ts +4 -0
- package/component-registry/components/progress-loader.d.ts +4 -0
- package/component-registry/components/radioGroup.d.ts +1 -0
- package/component-registry/components/text.d.ts +2 -0
- package/component-registry/components/textarea.d.ts +2 -0
- package/component-registry/createFormFieldComponent.d.ts +52 -0
- package/component-registry/index.d.ts +3 -0
- package/component-registry/types.d.ts +42 -0
- package/component-registry/utils.d.ts +33 -0
- package/component-registry/validation.d.ts +141 -0
- package/component-registry/validationBridge.d.ts +10 -0
- package/components/ConnectionErrorScreen/ConnectionErrorScreen.d.ts +10 -0
- package/components/DatabaseStatusIndicator/DatabaseStatusIndicator.d.ts +24 -0
- package/config/SecureConfigLoader.d.ts +57 -0
- package/config/hooks.d.ts +2 -0
- package/config/index.d.ts +5 -0
- package/config/types.d.ts +94 -0
- package/{configReader-BkMPr3Ju.js → configReader-C49NagAF.js} +4936 -4988
- package/configReader-C49NagAF.js.map +1 -0
- package/{configReader-CbGTKRUP.cjs → configReader-CT1_bYSZ.cjs} +7 -7
- package/configReader-CT1_bYSZ.cjs.map +1 -0
- package/design-system/components/ComponentSourceBadge/ComponentSourceBadge.d.ts +15 -0
- package/design-system/components/FormFieldWrapper/FormFieldWrapper.d.ts +18 -0
- package/design-system/custom/config/date-preset.config.d.ts +7 -0
- package/design-system/custom/config/email-preset.config.d.ts +7 -0
- package/design-system/custom/config/index.d.ts +10 -0
- package/design-system/custom/config/number-preset.config.d.ts +7 -0
- package/design-system/custom/config/tel-preset.config.d.ts +7 -0
- package/design-system/custom/index.d.ts +17 -0
- package/design-system/custom/utils/create-preset-config.d.ts +74 -0
- package/design-system/generated/rhc-catalog.generated.d.ts +9360 -0
- package/design-system/index.d.ts +15 -0
- package/design-system/rhc/components.d.ts +12 -0
- package/design-system/rhc/config/alert.config.d.ts +5 -0
- package/design-system/rhc/config/button.config.d.ts +8 -0
- package/design-system/rhc/config/checkbox.config.d.ts +4 -0
- package/design-system/rhc/config/form-builder.config.d.ts +74 -0
- package/design-system/rhc/config/heading.config.d.ts +5 -0
- package/design-system/rhc/config/index.d.ts +9 -0
- package/design-system/rhc/config/paragraph.config.d.ts +8 -0
- package/design-system/rhc/config/radio-group.config.d.ts +5 -0
- package/design-system/rhc/config/select.config.d.ts +5 -0
- package/design-system/rhc/config/text-input.config.d.ts +5 -0
- package/design-system/rhc/config/textarea.config.d.ts +4 -0
- package/design-system/rhc/index.d.ts +1 -0
- package/design-system/rhc/utils/create-config.d.ts +76 -0
- package/design-system/rhc/utils/generate-schema.d.ts +20 -0
- package/design-system/types.d.ts +22 -0
- package/error-boundaries/BaseErrorBoundary/BaseErrorBoundary.d.ts +31 -0
- package/error-boundaries/ComponentErrorBoundary/ComponentErrorBoundary.d.ts +9 -0
- package/error-boundaries/ErrorBoundaryTest/ErrorBoundaryTest.d.ts +2 -0
- package/error-boundaries/FlowBuilderErrorBoundary/FlowBuilderErrorBoundary.d.ts +7 -0
- package/error-boundaries/index.d.ts +1 -0
- package/features/condition-editor/components/ConditionEditor/ConditionEditor.d.ts +17 -0
- package/features/condition-editor/components/ConditionItem/ConditionItem.d.ts +17 -0
- package/features/condition-editor/components/ConditionOperatorSelect/ConditionOperatorSelect.d.ts +8 -0
- package/features/condition-editor/components/ConditionRow/ConditionRow.d.ts +14 -0
- package/features/condition-editor/components/ConditionSummary/ConditionSummary.d.ts +7 -0
- package/features/condition-editor/components/ConditionTargetSelect/ConditionTargetSelect.d.ts +14 -0
- package/features/condition-editor/components/ConditionValueInput/ConditionValueInput.d.ts +10 -0
- package/features/condition-editor/components/EditConditionForm/EditConditionForm.d.ts +13 -0
- package/features/condition-editor/components/ExistingCondition/ExistingCondition.d.ts +13 -0
- package/features/condition-editor/components/LogicalConnector/LogicalConnector.d.ts +8 -0
- package/features/condition-editor/components/LogicalOperatorToggle/LogicalOperatorToggle.d.ts +13 -0
- package/features/condition-editor/components/NewConditionBuilder/NewConditionBuilder.d.ts +10 -0
- package/features/condition-editor/components/NewConditionRow/NewConditionRow.d.ts +15 -0
- package/features/condition-editor/components/VisibilityConditionBuilder/VisibilityConditionBuilder.d.ts +17 -0
- package/features/condition-editor/components/hooks/useTargetComponents.d.ts +6 -0
- package/features/condition-editor/components/utils/conditionUtils.d.ts +7 -0
- package/features/condition-editor/components/visibilityHelpers.d.ts +21 -0
- package/features/condition-editor/index.d.ts +17 -0
- package/features/dialog-system/components/ConfirmDialog.d.ts +12 -0
- package/features/dialog-system/components/DialogEditor/DialogEditor.d.ts +12 -0
- package/features/dialog-system/components/ModalDialog/ModalDialog.d.ts +12 -0
- package/features/dialog-system/components/VerifyEmailDialog/VerifyEmailDialog.d.ts +10 -0
- package/features/dialog-system/index.d.ts +4 -0
- package/features/form-builder/components/actions/ActionsPanel/ActionsPanel.d.ts +3 -0
- package/features/form-builder/components/actions/SortableActionItem/SortableActionItem.d.ts +9 -0
- package/features/form-builder/components/actions/index.d.ts +4 -0
- package/features/form-builder/components/actions-menu/FormBuilderActionsMenu/FormBuilderActionsMenu.d.ts +1 -0
- package/features/form-builder/components/actions-menu/index.d.ts +3 -0
- package/features/form-builder/components/actions-menu/items/CreateTemplateMenuItem/CreateTemplateMenuItem.d.ts +2 -0
- package/features/form-builder/components/actions-menu/items/ExampleMenuItem/ExampleMenuItem.d.ts +2 -0
- package/features/form-builder/components/actions-menu/items/index.d.ts +2 -0
- package/features/form-builder/components/actions-menu/registry.d.ts +9 -0
- package/features/form-builder/components/actions-menu/types.d.ts +44 -0
- package/features/form-builder/components/buttons/PreviewButton/PreviewButton.d.ts +74 -0
- package/features/form-builder/components/buttons/SaveDropdownButton/SaveDropdownButton.d.ts +8 -0
- package/features/form-builder/components/buttons/index.d.ts +6 -0
- package/features/form-builder/components/canvas/AdminRenderCanvasItems/AdminRenderCanvasItems.d.ts +15 -0
- package/features/form-builder/components/canvas/Canvas/Canvas.d.ts +3 -0
- package/features/form-builder/components/canvas/CanvasComponent/CanvasComponent.d.ts +16 -0
- package/features/form-builder/components/canvas/SortableComponent/SortableComponent.d.ts +13 -0
- package/features/form-builder/components/canvas/index.d.ts +8 -0
- package/features/form-builder/components/components-panel/FormWizardComponentItem/FormWizardComponentItem.d.ts +7 -0
- package/features/form-builder/components/components-panel/FormWizardComponentsPanel/FormWizardComponentsPanel.d.ts +6 -0
- package/features/form-builder/components/components-panel/SortableComponentItem/SortableComponentItem.d.ts +20 -0
- package/features/form-builder/components/components-panel/index.d.ts +6 -0
- package/features/form-builder/components/core/AdminFormContent/AdminFormContent.d.ts +5 -0
- package/features/form-builder/components/core/FormBuilder/FormBuilder.d.ts +23 -0
- package/features/form-builder/components/core/index.d.ts +4 -0
- package/features/form-builder/components/editors/AdminPropertiesPanel/AdminPropertiesPanel.d.ts +3 -0
- package/features/form-builder/components/editors/ConditionsTab/ConditionsTab.d.ts +10 -0
- package/features/form-builder/components/editors/NavigationEditor/NavigationEditor.d.ts +13 -0
- package/features/form-builder/components/editors/NavigationSettings/NavigationSettings.d.ts +2 -0
- package/features/form-builder/components/editors/SectionConfigEditor/SectionConfigEditor.d.ts +8 -0
- package/features/form-builder/components/editors/index.d.ts +10 -0
- package/features/form-builder/components/fields/FieldValueButton/FieldValueButton.d.ts +7 -0
- package/features/form-builder/components/fields/FormFieldSelector/FormFieldSelector.d.ts +19 -0
- package/features/form-builder/components/fields/index.d.ts +4 -0
- package/features/form-builder/components/index.d.ts +13 -0
- package/features/form-builder/components/layout/FormFooter.d.ts +11 -0
- package/features/form-builder/components/layout/FormFooterBase.d.ts +15 -0
- package/features/form-builder/components/layout/FormHeader/FormHeader.d.ts +35 -0
- package/features/form-builder/components/layout/index.d.ts +6 -0
- package/features/form-builder/components/panels/RightPanel/RightPanel.d.ts +1 -0
- package/features/form-builder/components/panels/index.d.ts +1 -0
- package/features/form-builder/components/sections/AdminFormSection/AdminFormSection.d.ts +14 -0
- package/features/form-builder/components/sections/SectionContainer/SectionContainer.d.ts +13 -0
- package/features/form-builder/components/sections/index.d.ts +4 -0
- package/features/form-builder/components/steps/AdminStepSettings/AdminStepSettings.d.ts +7 -0
- package/features/form-builder/components/steps/SortableStepItem/SortableStepItem.d.ts +18 -0
- package/features/form-builder/components/steps/StepLockIndicator/StepLockIndicator.d.ts +18 -0
- package/features/form-builder/components/steps/StepsList/StepsList.d.ts +3 -0
- package/features/form-builder/components/steps/index.d.ts +8 -0
- package/features/form-builder/context/FormBuilderContext.d.ts +30 -0
- package/features/form-builder/context/ResolvedStepContext.d.ts +9 -0
- package/features/form-builder/hooks/useCurrentStep.d.ts +18 -0
- package/features/form-builder/hooks/useDragAndDrop.d.ts +16 -0
- package/features/form-builder/hooks/useDragFeedback.d.ts +32 -0
- package/features/form-builder/hooks/useHoldToDrag.d.ts +18 -0
- package/features/form-builder/hooks/usePreviewConfig.d.ts +23 -0
- package/features/form-builder/hooks/useSectionOperations.d.ts +7 -0
- package/features/form-builder/index.d.ts +10 -0
- package/features/form-builder/providers/DragAndDropProvider/DragAndDropProvider.d.ts +8 -0
- package/features/form-builder/utils/PropertyLockIndicator/PropertyLockIndicator.d.ts +30 -0
- package/features/form-builder/utils/bodyConversionUtils.d.ts +35 -0
- package/features/form-builder/utils/collisionDetection.d.ts +6 -0
- package/features/form-management/components/FormBuilderView/FormBuilderView.d.ts +17 -0
- package/features/form-management/components/FormExplorer/FormExplorer.d.ts +38 -0
- package/features/form-management/components/FormExplorerCore/FormExplorerCore.d.ts +67 -0
- package/features/form-management/components/FormManager/FormManager.d.ts +43 -0
- package/features/form-management/components/FormSectionList/FormSectionList.d.ts +1 -0
- package/features/form-management/components/FormsView/FormsView.d.ts +40 -0
- package/features/form-management/components/NewFormDialog/NewFormDialog.d.ts +25 -0
- package/features/form-management/components/NewProjectDialog/NewProjectDialog.d.ts +23 -0
- package/features/form-management/components/ProjectCard/ProjectCard.d.ts +9 -0
- package/features/form-management/components/ProjectsView/ProjectsView.d.ts +20 -0
- package/features/form-management/components/SearchInput/SearchInput.d.ts +9 -0
- package/features/form-management/components/ViewCard/ViewCard.d.ts +40 -0
- package/features/form-management/components/pages/FormBuilderPage.d.ts +3 -0
- package/features/form-management/components/pages/FormsPage.d.ts +3 -0
- package/features/form-management/components/pages/ProjectsPage.d.ts +16 -0
- package/features/form-management/components/pages/index.d.ts +13 -0
- package/features/form-management/hooks/index.d.ts +9 -0
- package/features/form-management/hooks/useFormActions.d.ts +20 -0
- package/features/form-management/hooks/useFormData.d.ts +13 -0
- package/features/form-management/hooks/useFormExplorerState.d.ts +26 -0
- package/features/form-management/hooks/useFormOperations.d.ts +17 -0
- package/features/form-management/hooks/useFormsQuery.d.ts +50 -0
- package/features/form-management/hooks/useProjectActions.d.ts +25 -0
- package/features/form-management/hooks/useProjectOperations.d.ts +10 -0
- package/features/form-management/hooks/useProjectsData.d.ts +13 -0
- package/features/form-management/index.d.ts +29 -0
- package/features/form-management/layout/BaseHeader/BaseHeader.d.ts +1 -0
- package/features/form-management/layout/BaseLayout/BaseLayout.d.ts +25 -0
- package/features/form-management/providers/QueryProvider.d.ts +8 -0
- package/features/form-management/types/viewTypes.d.ts +53 -0
- package/features/form-management/utils/configInitializer.d.ts +4 -0
- package/features/index.d.ts +9 -0
- package/features/property-editors/components/ComponentValidationEditor/ComponentValidationEditor.d.ts +12 -0
- package/features/property-editors/components/GenericPropertyEditor/GenericPropertyEditor.d.ts +13 -0
- package/features/property-editors/components/ProgressLoaderEditor/ProgressLoaderEditor.d.ts +12 -0
- package/features/property-editors/components/RadioGroupEditor/RadioGroupEditor.d.ts +3 -0
- package/features/property-editors/components/SelectEditor/SelectEditor.d.ts +3 -0
- package/features/property-editors/components/ValidationRuleEditor/ValidationRuleEditor.d.ts +23 -0
- package/features/property-editors/components/ValidationRuleListItem/ValidationRuleListItem.d.ts +9 -0
- package/features/property-editors/components/ValidationRuleSheet/ValidationRuleSheet.d.ts +14 -0
- package/features/property-editors/index.d.ts +5 -0
- package/features/property-editors/types/schema.d.ts +66 -0
- package/features/property-editors/types/types.d.ts +23 -0
- package/features/template-system/components/CreateTemplateDialog/CreateTemplateDialog.d.ts +17 -0
- package/features/template-system/components/DeleteTemplateDialog/DeleteTemplateDialog.d.ts +11 -0
- package/features/template-system/components/DuplicateTemplateDialog/DuplicateTemplateDialog.d.ts +11 -0
- package/features/template-system/components/EditTemplateDialog/EditTemplateDialog.d.ts +10 -0
- package/features/template-system/components/EnhancedTemplateBrowser/EnhancedTemplateBrowser.d.ts +11 -0
- package/features/template-system/components/TemplateContextMenu/TemplateContextMenu.d.ts +12 -0
- package/features/template-system/hooks/useTemplateGovernance.d.ts +46 -0
- package/features/template-system/hooks/useTemplatePermissions.d.ts +104 -0
- package/features/template-system/hooks/useTemplateStepTitle.d.ts +5 -0
- package/features/template-system/index.d.ts +17 -0
- package/features/template-system/services/TemplateStorageService.d.ts +52 -0
- package/features/template-system/utils/templateApplication.d.ts +75 -0
- package/features/template-system/utils/templateCategories.d.ts +105 -0
- package/features/template-system/utils/templateConfig.d.ts +148 -0
- package/features/template-system/utils/templateDeletion.d.ts +44 -0
- package/features/template-system/utils/templateDuplication.d.ts +65 -0
- package/features/template-system/utils/templateGovernance.d.ts +54 -0
- package/features/template-system/utils/templateLoader.d.ts +25 -0
- package/features/template-system/utils/templateMetadataOperations.d.ts +40 -0
- package/features/template-system/utils/templateUtils.d.ts +12 -0
- package/features/trigger-action-system/components/ActionConfigurationSheet/ActionConfigurationSheet.d.ts +9 -0
- package/features/trigger-action-system/components/ActionEditor/ActionEditor.d.ts +15 -0
- package/features/trigger-action-system/components/ActionsList/ActionsList.d.ts +8 -0
- package/features/trigger-action-system/components/ComponentTriggerActionEditor/ComponentTriggerActionEditor.d.ts +8 -0
- package/features/trigger-action-system/components/TriggerContextSelector/TriggerContextSelector.d.ts +9 -0
- package/features/trigger-action-system/index.d.ts +5 -0
- package/features/visual-mapping/components/ApiCallEditor/ApiCallEditor.d.ts +15 -0
- package/features/visual-mapping/components/ApiResponsePreview/ApiResponsePreview.d.ts +8 -0
- package/features/visual-mapping/components/ApiStructureTree/ApiStructureTree.d.ts +10 -0
- package/features/visual-mapping/components/CompactApiTestButton/CompactApiTestButton.d.ts +11 -0
- package/features/visual-mapping/components/ConnectionCircle/ConnectionCircle.d.ts +8 -0
- package/features/visual-mapping/components/ConnectionLines/ConnectionLines.d.ts +8 -0
- package/features/visual-mapping/components/CurrentMappingsDisplay/CurrentMappingsDisplay.d.ts +5 -0
- package/features/visual-mapping/components/EmptyFormFieldsMessage/EmptyFormFieldsMessage.d.ts +1 -0
- package/features/visual-mapping/components/FormFieldItem/FormFieldItem.d.ts +9 -0
- package/features/visual-mapping/components/FormFieldsList/FormFieldsList.d.ts +9 -0
- package/features/visual-mapping/components/KeyValueEditor/KeyValueEditor.d.ts +39 -0
- package/features/visual-mapping/components/MappingActionsDropdownMenu/MappingActionsDropdownMenu.d.ts +9 -0
- package/features/visual-mapping/components/MappingConnections/MappingConnections.d.ts +10 -0
- package/features/visual-mapping/components/RequestBodyEditor/RequestBodyEditor.d.ts +10 -0
- package/features/visual-mapping/components/SearchBar/SearchBar.d.ts +25 -0
- package/features/visual-mapping/components/VisualApiMappingInterface/VisualApiMappingInterface.d.ts +9 -0
- package/features/visual-mapping/components/index.d.ts +2 -0
- package/features/visual-mapping/components/typeCompatibility.d.ts +4 -0
- package/features/visual-mapping/components/utils/getFormFieldDataType.d.ts +2 -0
- package/features/visual-mapping/index.d.ts +18 -0
- package/features/visual-mapping/utils/apiBodyUtils.d.ts +1 -0
- package/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +35 -0
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/integrations/NextJSIntegration.d.ts +23 -0
- package/integrations/ReactRouterIntegration.d.ts +16 -0
- package/integrations/index.d.ts +12 -0
- package/integrations/react-router/FormBuilderPage/FormBuilderPage.d.ts +23 -0
- package/integrations/react-router/FormsPage.d.ts +18 -0
- package/integrations/react-router/index.d.ts +11 -0
- package/package.json +1 -1
- package/providers/FormSaveContext.d.ts +20 -0
- package/providers/FormSaveProvider.d.ts +93 -0
- package/providers/ThemeProvider.d.ts +2 -0
- package/providers/index.d.ts +9 -0
- package/server.d.ts +8 -0
- package/storage/FilesystemStorageProvider.d.ts +19 -0
- package/storage/NullStorageProvider.d.ts +15 -0
- package/storage/PgLiteSyncProvider.d.ts +41 -0
- package/storage/StorageProviderFactory.d.ts +77 -0
- package/storage/ZeroConfigFilesystemStorageProvider.d.ts +157 -0
- package/storage/database-schemas.d.ts +17901 -0
- package/storage/database-types.d.ts +194 -0
- package/storage/index.d.ts +17 -0
- package/storage/types.d.ts +195 -0
- package/store/formBuilderStore.d.ts +287 -0
- package/store/index.d.ts +7 -0
- package/store/initialState/templates.d.ts +22 -0
- package/styles/index.d.ts +0 -0
- package/utils/configInitializer.d.ts +11 -0
- package/utils/configReader.d.ts +13 -0
- package/utils/fieldChangeValidation.d.ts +127 -0
- package/utils/fileStorage.d.ts +253 -0
- package/utils/formSaver.d.ts +22 -0
- package/utils/formsExplorer.d.ts +128 -0
- package/utils/index.d.ts +2 -0
- package/utils/routeUtils.d.ts +85 -0
- package/configReader-BkMPr3Ju.js.map +0 -1
- package/configReader-CbGTKRUP.cjs.map +0 -1
package/store/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form Builder Store
|
|
3
|
+
* Zustand-based store for form wizard admin functionality
|
|
4
|
+
*/
|
|
5
|
+
export type { ComponentConfig, FormSectionConfig, FormStepConfig, FormWizardConfig, StepNavigation, StepNavigationItem, } from '../../../core/src/index.ts';
|
|
6
|
+
export { generateId, useActionSheetOpen, useCanUndo, useCreatingActionTrigger, useCurrentSection, useCurrentStep, useCurrentStepLockState, useFormBuilderActions, useFormBuilderStore, useFormConfig, useFormFieldNodes, useFormFlowData, useFormSteps, useHasUnsavedChanges, useIsSaving, useLastSavedAt, useSaveError, useSelectedActionId, useSelectedComponentId, useSelectedSectionId, useSelectedStepId, useVisualMappings, } from './formBuilderStore';
|
|
7
|
+
export type { StepTemplate, TemplateHistoryEntry, } from './initialState/templates';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template initial state definitions
|
|
3
|
+
* Contains the template types and initial state for template management
|
|
4
|
+
*/
|
|
5
|
+
export interface StepTemplate {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TemplateHistoryEntry {
|
|
11
|
+
id: string;
|
|
12
|
+
type: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
operationData: {
|
|
15
|
+
templateId: string;
|
|
16
|
+
category: string;
|
|
17
|
+
templateName: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const initialTemplates: StepTemplate[];
|
|
22
|
+
export declare const initialTemplateHistory: TemplateHistoryEntry[];
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormWizardConfig } from '../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize the form configuration service
|
|
4
|
+
* This function sets up any necessary services, validates configuration,
|
|
5
|
+
* and prepares the system for form operations
|
|
6
|
+
*/
|
|
7
|
+
export declare function initializeFormConfiguration(): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new form configuration with default settings
|
|
10
|
+
*/
|
|
11
|
+
export declare function createDefaultFormConfig(title: string, formId: string): FormWizardConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormConfig } from '../config/types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves environment variables in configuration
|
|
4
|
+
* Supports ${VAR_NAME} syntax
|
|
5
|
+
*
|
|
6
|
+
* @param config - Raw configuration object that may contain environment variables
|
|
7
|
+
* @returns Resolved configuration with environment variables substituted
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveConfigVariables(config: unknown): FormConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Gets database configuration from a FormConfig
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDatabaseConfig(config: FormConfig): import('../config/types').DatabaseConfig | null | undefined;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field Change Validation System Types and Configurations
|
|
3
|
+
* Following SOLID principles for extensible validation architecture
|
|
4
|
+
*/
|
|
5
|
+
export interface FieldChangeValidationConfig {
|
|
6
|
+
id: string;
|
|
7
|
+
fieldId: string;
|
|
8
|
+
changeDetection: {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
compareStrategy: "strict" | "loose" | "custom";
|
|
11
|
+
customComparator?: (original: any, current: any) => boolean;
|
|
12
|
+
};
|
|
13
|
+
warningAlert?: {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
type: "info" | "warning" | "error";
|
|
17
|
+
position: "inline" | "tooltip" | "sidebar";
|
|
18
|
+
dismissible: boolean;
|
|
19
|
+
showDelay?: number;
|
|
20
|
+
};
|
|
21
|
+
saveVerification?: {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
triggerConditions: {
|
|
24
|
+
onlyIfChanged: boolean;
|
|
25
|
+
requiresValidation: boolean;
|
|
26
|
+
customCondition?: string;
|
|
27
|
+
};
|
|
28
|
+
verificationConfig: {
|
|
29
|
+
type: "email" | "sms" | "custom";
|
|
30
|
+
dialogTemplate: string;
|
|
31
|
+
templateConfig: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
conditions?: {
|
|
35
|
+
operator: "AND" | "OR";
|
|
36
|
+
rules: Array<{
|
|
37
|
+
field: string;
|
|
38
|
+
operator: "equals" | "notEquals" | "contains" | "empty" | "notEmpty";
|
|
39
|
+
value: any;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface FieldChangeState {
|
|
44
|
+
originalValue: any;
|
|
45
|
+
currentValue: any;
|
|
46
|
+
hasChanged: boolean;
|
|
47
|
+
changeTimestamp?: number;
|
|
48
|
+
validationWarnings: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
message: string;
|
|
51
|
+
type: string;
|
|
52
|
+
timestamp: number;
|
|
53
|
+
dismissible: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
export interface FieldWarning {
|
|
57
|
+
id: string;
|
|
58
|
+
fieldId: string;
|
|
59
|
+
message: string;
|
|
60
|
+
type: "info" | "warning" | "error";
|
|
61
|
+
position: "inline" | "tooltip" | "sidebar";
|
|
62
|
+
dismissible: boolean;
|
|
63
|
+
timestamp: number;
|
|
64
|
+
}
|
|
65
|
+
export interface VerificationStatus {
|
|
66
|
+
status: "pending" | "success" | "failed";
|
|
67
|
+
timestamp: number;
|
|
68
|
+
result?: any;
|
|
69
|
+
}
|
|
70
|
+
export interface FieldValidationState {
|
|
71
|
+
activeWarnings: string[];
|
|
72
|
+
pendingVerifications: string[];
|
|
73
|
+
verificationResults: Record<string, VerificationStatus>;
|
|
74
|
+
}
|
|
75
|
+
export interface FieldChangeContext {
|
|
76
|
+
fieldId: string;
|
|
77
|
+
originalValue: any;
|
|
78
|
+
currentValue: any;
|
|
79
|
+
hasChanged: boolean;
|
|
80
|
+
formData: Record<string, any>;
|
|
81
|
+
sectionId?: string;
|
|
82
|
+
stepId?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface ValidationResult {
|
|
85
|
+
fieldId: string;
|
|
86
|
+
shouldShowWarning: boolean;
|
|
87
|
+
warning?: FieldWarning;
|
|
88
|
+
shouldTriggerVerification: boolean;
|
|
89
|
+
verificationConfig?: FieldChangeValidationConfig["saveVerification"];
|
|
90
|
+
}
|
|
91
|
+
export interface SectionFieldValidationConfig {
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
validationRules: FieldChangeValidationConfig[];
|
|
94
|
+
globalSettings?: {
|
|
95
|
+
warningThrottle: number;
|
|
96
|
+
autoSaveOnVerification: boolean;
|
|
97
|
+
fallbackErrorHandling: "block" | "warn" | "ignore";
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface VerificationConfig {
|
|
101
|
+
type: "email" | "sms" | "custom";
|
|
102
|
+
dialogTemplate: string;
|
|
103
|
+
templateConfig: Record<string, any>;
|
|
104
|
+
onSuccess?: (result: any) => void;
|
|
105
|
+
onError?: (error: Error) => void;
|
|
106
|
+
onCancel?: () => void;
|
|
107
|
+
}
|
|
108
|
+
export interface IFieldChangeDetector {
|
|
109
|
+
registerComparator(strategy: string, comparator: (a: any, b: any) => boolean): void;
|
|
110
|
+
detectChange(fieldId: string, originalValue: any, currentValue: any, strategy?: string): boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface IFieldValidationEngine {
|
|
113
|
+
registerRule(rule: FieldChangeValidationConfig): void;
|
|
114
|
+
removeRule(fieldId: string): void;
|
|
115
|
+
evaluateFieldChange(fieldId: string, changeContext: FieldChangeContext): ValidationResult;
|
|
116
|
+
}
|
|
117
|
+
export interface IWarningManager {
|
|
118
|
+
showWarning(warning: FieldWarning): void;
|
|
119
|
+
dismissWarning(fieldId: string, warningId?: string): void;
|
|
120
|
+
getActiveWarnings(fieldId: string): FieldWarning[];
|
|
121
|
+
clearAllWarnings(fieldId?: string): void;
|
|
122
|
+
}
|
|
123
|
+
export interface IVerificationManager {
|
|
124
|
+
startVerification(fieldId: string, config: VerificationConfig): Promise<any>;
|
|
125
|
+
getVerificationStatus(fieldId: string): VerificationStatus | null;
|
|
126
|
+
clearVerificationResult(fieldId: string): void;
|
|
127
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { FormStepConfig, FormWizardConfig } from '../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* File-based storage types for FormBuilder
|
|
4
|
+
*/
|
|
5
|
+
export interface FormBuilderSettings {
|
|
6
|
+
/** Base directory where form configurations are stored */
|
|
7
|
+
formsDirectory: string;
|
|
8
|
+
/** Default form template to use when creating new forms */
|
|
9
|
+
defaultTemplate?: string;
|
|
10
|
+
/** Auto-save interval in milliseconds (0 to disable) */
|
|
11
|
+
autoSaveInterval?: number;
|
|
12
|
+
/** Whether to create backups before saving */
|
|
13
|
+
createBackups?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface FormFile {
|
|
16
|
+
/** Unique identifier for the form */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Display name of the form */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Relative path to the JSON file */
|
|
21
|
+
filePath: string;
|
|
22
|
+
/** Last modified timestamp */
|
|
23
|
+
lastModified?: number;
|
|
24
|
+
/** File size in bytes */
|
|
25
|
+
size?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface FormDirectory {
|
|
28
|
+
/** List of available forms */
|
|
29
|
+
forms: FormFile[];
|
|
30
|
+
/** Settings for the form builder */
|
|
31
|
+
settings: FormBuilderSettings;
|
|
32
|
+
}
|
|
33
|
+
export interface FileStorageError {
|
|
34
|
+
type: "READ_ERROR" | "WRITE_ERROR" | "PARSE_ERROR" | "NOT_FOUND" | "PERMISSION_ERROR" | "VALIDATION_ERROR" | "CONFIGURATION_ERROR";
|
|
35
|
+
message: string;
|
|
36
|
+
filePath?: string;
|
|
37
|
+
}
|
|
38
|
+
export type FileStorageResult<T> = {
|
|
39
|
+
success: true;
|
|
40
|
+
data: T;
|
|
41
|
+
} | {
|
|
42
|
+
success: false;
|
|
43
|
+
error: FileStorageError;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Template storage configuration
|
|
47
|
+
*/
|
|
48
|
+
export interface TemplateStorageConfig {
|
|
49
|
+
/** Team template storage location (configured by developers) */
|
|
50
|
+
team: string;
|
|
51
|
+
/** Generic/organization template storage location (built-in path, not configurable) */
|
|
52
|
+
generic?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Template metadata interface
|
|
56
|
+
*/
|
|
57
|
+
export interface TemplateMetadata {
|
|
58
|
+
/** Unique identifier for the template */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Display name of the template */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Detailed description of the template */
|
|
63
|
+
description?: string;
|
|
64
|
+
/** Template category */
|
|
65
|
+
category: TemplateCategory;
|
|
66
|
+
/** Tags for organizing and searching templates */
|
|
67
|
+
tags?: string[];
|
|
68
|
+
/** Creator information */
|
|
69
|
+
createdBy?: string;
|
|
70
|
+
/** Creation timestamp */
|
|
71
|
+
createdAt: number;
|
|
72
|
+
/** Last modified timestamp */
|
|
73
|
+
lastModified: number;
|
|
74
|
+
/** Template version */
|
|
75
|
+
version?: string;
|
|
76
|
+
/** Usage count for analytics */
|
|
77
|
+
usageCount?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Template categories
|
|
81
|
+
*/
|
|
82
|
+
export type TemplateCategory = "team" | "generic" | "personal" | "shared";
|
|
83
|
+
/**
|
|
84
|
+
* Base template interface
|
|
85
|
+
*/
|
|
86
|
+
export interface BaseTemplate {
|
|
87
|
+
/** Template metadata */
|
|
88
|
+
metadata: TemplateMetadata;
|
|
89
|
+
/** Step configuration data */
|
|
90
|
+
stepsData: FormStepConfig;
|
|
91
|
+
/** Template preview data */
|
|
92
|
+
preview?: {
|
|
93
|
+
componentCount: number;
|
|
94
|
+
sectionCount: number;
|
|
95
|
+
previewImage?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Personal template (editable by individual users)
|
|
100
|
+
*/
|
|
101
|
+
export interface PersonalTemplate extends BaseTemplate {
|
|
102
|
+
metadata: TemplateMetadata & {
|
|
103
|
+
category: "personal";
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Shared template (editable by authorized users)
|
|
108
|
+
*/
|
|
109
|
+
export interface SharedTemplate extends BaseTemplate {
|
|
110
|
+
metadata: TemplateMetadata & {
|
|
111
|
+
category: "shared";
|
|
112
|
+
};
|
|
113
|
+
/** Sharing configuration for collaborative templates */
|
|
114
|
+
sharing: {
|
|
115
|
+
/** Template owner */
|
|
116
|
+
owner: string;
|
|
117
|
+
/** Edit permissions */
|
|
118
|
+
editPermissions: "owner" | "team" | "public";
|
|
119
|
+
/** List of collaborators who can edit */
|
|
120
|
+
collaborators?: string[];
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Team template (editable by team members)
|
|
125
|
+
*/
|
|
126
|
+
export interface TeamTemplate extends BaseTemplate {
|
|
127
|
+
metadata: TemplateMetadata & {
|
|
128
|
+
category: "team";
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Generic/Organization template (read-only)
|
|
133
|
+
*/
|
|
134
|
+
export interface GenericTemplate extends BaseTemplate {
|
|
135
|
+
metadata: TemplateMetadata & {
|
|
136
|
+
category: "generic";
|
|
137
|
+
};
|
|
138
|
+
/** Governance information */
|
|
139
|
+
governance: {
|
|
140
|
+
/** Approval status */
|
|
141
|
+
approved: boolean;
|
|
142
|
+
/** Approval date */
|
|
143
|
+
approvedAt?: number;
|
|
144
|
+
/** Approver information */
|
|
145
|
+
approvedBy?: string;
|
|
146
|
+
/** Compliance tags */
|
|
147
|
+
complianceTags?: string[];
|
|
148
|
+
/** Is this template deprecated */
|
|
149
|
+
deprecated?: boolean;
|
|
150
|
+
/** Deprecation reason */
|
|
151
|
+
deprecationReason?: string;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Union type for all template types
|
|
156
|
+
*/
|
|
157
|
+
export type Template = PersonalTemplate | SharedTemplate | TeamTemplate | GenericTemplate;
|
|
158
|
+
/**
|
|
159
|
+
* Template file reference (for indexing)
|
|
160
|
+
*/
|
|
161
|
+
export interface TemplateFile {
|
|
162
|
+
/** Unique identifier for the template */
|
|
163
|
+
id: string;
|
|
164
|
+
/** Display name of the template */
|
|
165
|
+
name: string;
|
|
166
|
+
/** Detailed description of the template */
|
|
167
|
+
description?: string;
|
|
168
|
+
/** Template category */
|
|
169
|
+
category: TemplateCategory;
|
|
170
|
+
/** Tags for organizing and searching templates */
|
|
171
|
+
tags?: string[];
|
|
172
|
+
/** Creator information */
|
|
173
|
+
createdBy?: string;
|
|
174
|
+
/** Creation timestamp */
|
|
175
|
+
createdAt: number;
|
|
176
|
+
/** Last modified timestamp */
|
|
177
|
+
lastModified: number;
|
|
178
|
+
/** Template version */
|
|
179
|
+
version?: string;
|
|
180
|
+
/** Usage count for analytics */
|
|
181
|
+
usageCount?: number;
|
|
182
|
+
/** Relative path to the template JSON file */
|
|
183
|
+
filePath?: string;
|
|
184
|
+
/** File size in bytes */
|
|
185
|
+
size?: number;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Template directory structure
|
|
189
|
+
*/
|
|
190
|
+
export interface TemplateDirectory {
|
|
191
|
+
/** Template category */
|
|
192
|
+
category: TemplateCategory;
|
|
193
|
+
/** List of available templates */
|
|
194
|
+
templates: TemplateFile[];
|
|
195
|
+
/** Directory path */
|
|
196
|
+
path: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Default settings for file-based storage
|
|
200
|
+
*/
|
|
201
|
+
export declare const DEFAULT_SETTINGS: FormBuilderSettings;
|
|
202
|
+
/**
|
|
203
|
+
* Load settings from a settings.json file
|
|
204
|
+
*/
|
|
205
|
+
export declare function loadSettings(settingsPath?: string): Promise<FileStorageResult<FormBuilderSettings>>;
|
|
206
|
+
/**
|
|
207
|
+
* Save settings to a settings.json file
|
|
208
|
+
*/
|
|
209
|
+
export declare function saveSettings(settings: FormBuilderSettings, settingsPath?: string): Promise<FileStorageResult<void>>;
|
|
210
|
+
/**
|
|
211
|
+
* Load a form configuration from a JSON file
|
|
212
|
+
*/
|
|
213
|
+
export declare function loadForm(filePath: string): Promise<FileStorageResult<FormWizardConfig>>;
|
|
214
|
+
/**
|
|
215
|
+
* Save a form configuration to a JSON file
|
|
216
|
+
*/
|
|
217
|
+
export declare function saveForm(config: FormWizardConfig, filePath: string, createBackup?: boolean): Promise<FileStorageResult<void>>;
|
|
218
|
+
/**
|
|
219
|
+
* Create a backup of a form file
|
|
220
|
+
*/
|
|
221
|
+
export declare function createFormBackup(filePath: string): Promise<FileStorageResult<string>>;
|
|
222
|
+
/**
|
|
223
|
+
* List all forms in the forms directory
|
|
224
|
+
*/
|
|
225
|
+
export declare function listForms(settings: FormBuilderSettings): Promise<FileStorageResult<FormFile[]>>;
|
|
226
|
+
/**
|
|
227
|
+
* Create a new form file
|
|
228
|
+
*/
|
|
229
|
+
export declare function createForm(config: FormWizardConfig, settings: FormBuilderSettings): Promise<FileStorageResult<string>>;
|
|
230
|
+
/**
|
|
231
|
+
* Delete a form file
|
|
232
|
+
*/
|
|
233
|
+
export declare function deleteForm(formId: string, settings: FormBuilderSettings): Promise<FileStorageResult<void>>;
|
|
234
|
+
/**
|
|
235
|
+
* Load template storage configuration from form.config.json
|
|
236
|
+
*/
|
|
237
|
+
export declare function loadTemplateStorageConfig(): Promise<FileStorageResult<TemplateStorageConfig>>;
|
|
238
|
+
/**
|
|
239
|
+
* Save a template to the appropriate storage location
|
|
240
|
+
*/
|
|
241
|
+
export declare function saveTemplate(template: Template, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<string>>;
|
|
242
|
+
/**
|
|
243
|
+
* Load a template from storage
|
|
244
|
+
*/
|
|
245
|
+
export declare function loadTemplate(templateId: string, category: TemplateCategory, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<Template>>;
|
|
246
|
+
/**
|
|
247
|
+
* List all templates in a category
|
|
248
|
+
*/
|
|
249
|
+
export declare function listTemplates(category: TemplateCategory, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<TemplateFile[]>>;
|
|
250
|
+
/**
|
|
251
|
+
* Delete a template
|
|
252
|
+
*/
|
|
253
|
+
export declare function deleteTemplate(templateId: string, category: TemplateCategory, storageConfig: TemplateStorageConfig): Promise<FileStorageResult<void>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FormWizardConfig } from '../../../core/src/index.ts';
|
|
2
|
+
export interface SaveResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
error?: {
|
|
5
|
+
message: string;
|
|
6
|
+
code?: string;
|
|
7
|
+
};
|
|
8
|
+
metadata?: {
|
|
9
|
+
filePath?: string;
|
|
10
|
+
timestamp?: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Save form configuration using the pluggable save provider system
|
|
15
|
+
* This is a self-contained function that doesn't rely on external utilities
|
|
16
|
+
*/
|
|
17
|
+
export declare function saveFormConfig(projectId: string, wizardId: string, config: FormWizardConfig): Promise<SaveResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Load form configuration
|
|
20
|
+
* Companion function to saveFormConfig for loading saved forms
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadFormConfig(projectId: string, wizardId: string): Promise<FormWizardConfig | null>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { CreateFormRequest, CreateProjectRequest, FormMetadata, FormsIndex, FormWizardConfig, ProjectMetadata } from '../../../core/src/index.ts';
|
|
2
|
+
import { FormConfig } from '../config/types';
|
|
3
|
+
import { FormSaveProvider } from '../providers';
|
|
4
|
+
import { FormStorageConfig, FormStorageProvider } from '../storage/types';
|
|
5
|
+
/**
|
|
6
|
+
* Form operations configuration interface
|
|
7
|
+
* Uses unified FormConfig throughout the system
|
|
8
|
+
*/
|
|
9
|
+
export interface FormOperationsConfig {
|
|
10
|
+
/** Form configuration from context or props */
|
|
11
|
+
formConfig?: FormConfig;
|
|
12
|
+
/** Custom API base URL override */
|
|
13
|
+
apiBaseUrl?: string;
|
|
14
|
+
/** Custom storage provider override */
|
|
15
|
+
storageProvider?: "filesystem" | "database" | "memory";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Storage strategy abstraction for future extensibility
|
|
19
|
+
*/
|
|
20
|
+
export interface StorageStrategy {
|
|
21
|
+
name: "filesystem" | "database" | "memory";
|
|
22
|
+
saveForm(projectId: string, wizardId: string, config: FormWizardConfig, options?: FormOperationsConfig): Promise<boolean>;
|
|
23
|
+
loadForm(projectId: string, wizardId: string, options?: FormOperationsConfig): Promise<FormWizardConfig | null>;
|
|
24
|
+
deleteForm(projectId: string, wizardId: string, options?: FormOperationsConfig): Promise<boolean>;
|
|
25
|
+
createProject(request: CreateProjectRequest, options?: FormOperationsConfig): Promise<boolean>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Register a custom storage strategy
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerStorageStrategy(name: string, strategy: StorageStrategy): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set a global save provider for the forms explorer
|
|
33
|
+
* This allows framework-specific implementations to be plugged in
|
|
34
|
+
*/
|
|
35
|
+
export declare function setGlobalFormSaveProvider(provider: FormSaveProvider): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get the current save provider using the storage provider system
|
|
38
|
+
*/
|
|
39
|
+
export declare function getFormSaveProvider(): Promise<FormSaveProvider>;
|
|
40
|
+
/**
|
|
41
|
+
* Get form configuration - framework agnostic
|
|
42
|
+
* Supports both legacy and enhanced configuration
|
|
43
|
+
*/
|
|
44
|
+
export declare function getFormConfig(): Promise<FormConfig>;
|
|
45
|
+
/**
|
|
46
|
+
* Get base path for forms directory from configuration
|
|
47
|
+
*/
|
|
48
|
+
export declare function getFormsBasePath(options?: FormOperationsConfig): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Clear the scan cache - useful after data mutations
|
|
51
|
+
*/
|
|
52
|
+
export declare function clearScanCache(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Scan the forms directory structure and build an index with caching
|
|
55
|
+
*/
|
|
56
|
+
export declare function scanFormsDirectory(options?: FormOperationsConfig): Promise<FormsIndex>;
|
|
57
|
+
/**
|
|
58
|
+
* Load project index from project directory
|
|
59
|
+
*/
|
|
60
|
+
export declare function loadProjectIndex(projectId: string, options?: FormOperationsConfig): Promise<{
|
|
61
|
+
project: {
|
|
62
|
+
name?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
lastModified?: number;
|
|
65
|
+
};
|
|
66
|
+
forms: FormMetadata[];
|
|
67
|
+
} | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Scan a specific project directory
|
|
70
|
+
*/
|
|
71
|
+
export declare function scanProjectDirectory(projectId: string, options?: FormOperationsConfig): Promise<ProjectMetadata | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Format project ID to display name
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatProjectName(projectId: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Load a form configuration using the configured storage strategy
|
|
78
|
+
*/
|
|
79
|
+
export declare function loadFormConfigFromExplorer(projectId: string, wizardId: string, options?: FormOperationsConfig): Promise<FormWizardConfig | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Save a form configuration using the pluggable save provider
|
|
82
|
+
*/
|
|
83
|
+
export declare function saveFormConfig(projectId: string, wizardId: string, config: FormWizardConfig, options?: FormOperationsConfig): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Create a new project
|
|
86
|
+
*/
|
|
87
|
+
export declare function createProject(request: CreateProjectRequest): Promise<{
|
|
88
|
+
success: true;
|
|
89
|
+
projectId: string;
|
|
90
|
+
name: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
} | {
|
|
93
|
+
success: false;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Create a new form in a project
|
|
97
|
+
*/
|
|
98
|
+
export declare function createForm(request: CreateFormRequest, options?: FormOperationsConfig): Promise<FormWizardConfig | null>;
|
|
99
|
+
/**
|
|
100
|
+
* Delete a form from a project
|
|
101
|
+
*/
|
|
102
|
+
export declare function deleteForm(projectId: string, wizardId: string, options?: FormOperationsConfig): Promise<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* Get form URL for editing
|
|
105
|
+
*/
|
|
106
|
+
export declare function getFormEditUrl(projectId: string, wizardId: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Parse form URL parameters
|
|
109
|
+
*/
|
|
110
|
+
export declare function parseFormUrl(pathname: string): {
|
|
111
|
+
projectId: string;
|
|
112
|
+
wizardId: string;
|
|
113
|
+
} | null;
|
|
114
|
+
/**
|
|
115
|
+
* Get the current storage provider for operations
|
|
116
|
+
*/
|
|
117
|
+
export declare function getCurrentStorageProvider(options?: FormOperationsConfig): Promise<FormStorageProvider | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Get storage provider from configuration.
|
|
120
|
+
* Recommended replacement for getCurrentStorageProvider().
|
|
121
|
+
*
|
|
122
|
+
* Usage:
|
|
123
|
+
* const provider = await getStorageProvider(formConfig.storage);
|
|
124
|
+
*
|
|
125
|
+
* @param storageConfig - Storage configuration from form.config.ts
|
|
126
|
+
* @returns FormStorageProvider or null if initialization fails
|
|
127
|
+
*/
|
|
128
|
+
export declare function getStorageProvider(storageConfig: FormStorageConfig): Promise<FormStorageProvider | null>;
|
package/utils/index.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { FormConfig, RouteConfig } from '../config/types';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters that can be used in route patterns
|
|
4
|
+
*/
|
|
5
|
+
export interface RouteParams {
|
|
6
|
+
project?: string;
|
|
7
|
+
wizardId?: string;
|
|
8
|
+
[key: string]: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gets route configuration from FormConfig, falling back to defaults
|
|
12
|
+
*/
|
|
13
|
+
export declare function getRouteConfig(config?: FormConfig): Required<RouteConfig>;
|
|
14
|
+
/**
|
|
15
|
+
* Generates a URL from a route pattern by substituting parameters
|
|
16
|
+
*
|
|
17
|
+
* @param pattern - Route pattern with parameters (e.g., "/forms/:project/:wizardId")
|
|
18
|
+
* @param params - Parameters to substitute (e.g., { project: "myproject", wizardId: "form1" })
|
|
19
|
+
* @returns Generated URL with parameters substituted
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* generateUrl("/forms/:project/:wizardId", { project: "myproject", wizardId: "form1" })
|
|
23
|
+
* // Returns: "/forms/myproject/form1"
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateUrl(pattern: string, params?: RouteParams): string;
|
|
26
|
+
/**
|
|
27
|
+
* Route generator functions that use the configured routes
|
|
28
|
+
*/
|
|
29
|
+
export declare class RouteGenerator {
|
|
30
|
+
private routes;
|
|
31
|
+
constructor(config?: FormConfig);
|
|
32
|
+
/**
|
|
33
|
+
* Generate URL for projects page
|
|
34
|
+
*/
|
|
35
|
+
projects(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Generate URL for forms page
|
|
38
|
+
*/
|
|
39
|
+
forms(projectId: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Generate URL for form builder page
|
|
42
|
+
*/
|
|
43
|
+
builder(projectId: string, wizardId: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Generate URL for form preview page
|
|
46
|
+
*/
|
|
47
|
+
preview(projectId: string, wizardId: string): string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Navigation functions that work with any router
|
|
51
|
+
* These functions generate URLs but don't perform navigation - that's left to the routing system
|
|
52
|
+
*/
|
|
53
|
+
export interface NavigationUrls {
|
|
54
|
+
projects(): string;
|
|
55
|
+
forms(projectId: string): string;
|
|
56
|
+
builder(projectId: string, wizardId: string): string;
|
|
57
|
+
preview(projectId: string, wizardId: string): string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates navigation URL generators from configuration
|
|
61
|
+
*/
|
|
62
|
+
export declare function createNavigationUrls(config?: FormConfig): NavigationUrls;
|
|
63
|
+
/**
|
|
64
|
+
* Hook-like interface for navigation (compatible with React Router's useNavigate)
|
|
65
|
+
*/
|
|
66
|
+
export type NavigationHandler = (path: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Creates navigation functions that use a provided navigation handler
|
|
69
|
+
* Works with any routing system that provides a navigation function
|
|
70
|
+
*/
|
|
71
|
+
export declare function createNavigationFunctions(navigate: NavigationHandler, config?: FormConfig): {
|
|
72
|
+
navigateToProjects: () => void;
|
|
73
|
+
navigateToForms: (projectId: string) => void;
|
|
74
|
+
navigateToBuilder: (projectId: string, wizardId: string) => void;
|
|
75
|
+
navigateToPreview: (projectId: string, wizardId: string) => void;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Utility to check if a route pattern matches a given path
|
|
79
|
+
* Useful for determining which page is currently active
|
|
80
|
+
*/
|
|
81
|
+
export declare function matchesRoute(pattern: string, path: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Extract parameters from a path using a route pattern
|
|
84
|
+
*/
|
|
85
|
+
export declare function extractParams(pattern: string, path: string): RouteParams;
|