@digiform/builder 0.1.7 → 0.2.1
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.d.ts +18 -0
- 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.map +1 -1
- package/configReader-CbGTKRUP.cjs.map +1 -1
- 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.d.ts +35 -0
- 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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FormWizardConfig } from '../../../core/src/index.ts';
|
|
2
|
+
import { FormConfig, FormStorageConfig } from '../config/types';
|
|
3
|
+
/**
|
|
4
|
+
* Save operation result
|
|
5
|
+
*/
|
|
6
|
+
export interface SaveResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
error?: {
|
|
9
|
+
message: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
};
|
|
12
|
+
metadata?: {
|
|
13
|
+
filePath?: string;
|
|
14
|
+
savedAt?: Date;
|
|
15
|
+
size?: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Load operation result
|
|
20
|
+
*/
|
|
21
|
+
export interface LoadResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
data?: FormWizardConfig;
|
|
24
|
+
error?: {
|
|
25
|
+
message: string;
|
|
26
|
+
code?: string;
|
|
27
|
+
};
|
|
28
|
+
metadata?: {
|
|
29
|
+
source?: "filesystem" | "api" | "cache";
|
|
30
|
+
lastModified?: Date;
|
|
31
|
+
size?: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Form save provider interface - implement this for different frameworks
|
|
36
|
+
*/
|
|
37
|
+
export interface FormSaveProvider {
|
|
38
|
+
/**
|
|
39
|
+
* Save a form configuration
|
|
40
|
+
*/
|
|
41
|
+
saveForm(projectId: string, wizardId: string, config: FormWizardConfig, storageConfig: FormStorageConfig): Promise<SaveResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Load a form configuration
|
|
44
|
+
*/
|
|
45
|
+
loadForm(projectId: string, wizardId: string, storageConfig: FormStorageConfig): Promise<LoadResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a form exists
|
|
48
|
+
*/
|
|
49
|
+
formExists?(projectId: string, wizardId: string, storageConfig: FormStorageConfig): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Delete a form
|
|
52
|
+
*/
|
|
53
|
+
deleteForm?(projectId: string, wizardId: string, storageConfig: FormStorageConfig): Promise<SaveResult>;
|
|
54
|
+
/**
|
|
55
|
+
* List forms in a project
|
|
56
|
+
*/
|
|
57
|
+
listForms?(projectId: string, storageConfig: FormStorageConfig): Promise<{
|
|
58
|
+
forms: string[];
|
|
59
|
+
success: boolean;
|
|
60
|
+
error?: {
|
|
61
|
+
message: string;
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Default file system save provider (works with Vite dev server and similar setups)
|
|
67
|
+
* This is the fallback implementation that uses HTTP endpoints
|
|
68
|
+
*/
|
|
69
|
+
export declare class HttpEndpointSaveProvider implements FormSaveProvider {
|
|
70
|
+
saveForm(projectId: string, wizardId: string, config: FormWizardConfig, storageConfig: FormStorageConfig): Promise<SaveResult>;
|
|
71
|
+
loadForm(projectId: string, wizardId: string, storageConfig: FormStorageConfig): Promise<LoadResult>;
|
|
72
|
+
formExists(projectId: string, wizardId: string, storageConfig: FormStorageConfig): Promise<boolean>;
|
|
73
|
+
deleteForm(projectId: string, wizardId: string, storageConfig: FormStorageConfig): Promise<SaveResult>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Form configuration loader - reads from form.config.json
|
|
77
|
+
*/
|
|
78
|
+
export declare class FormConfigLoader {
|
|
79
|
+
private static instance;
|
|
80
|
+
private configCache;
|
|
81
|
+
private configPromise;
|
|
82
|
+
static getInstance(): FormConfigLoader;
|
|
83
|
+
/**
|
|
84
|
+
* Load form configuration from form.config.json
|
|
85
|
+
*/
|
|
86
|
+
loadConfig(): Promise<FormConfig>;
|
|
87
|
+
private fetchConfig;
|
|
88
|
+
private getDefaultConfig;
|
|
89
|
+
/**
|
|
90
|
+
* Clear cached config (useful for testing or hot reloading)
|
|
91
|
+
*/
|
|
92
|
+
clearCache(): void;
|
|
93
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic form save providers
|
|
3
|
+
* Export all providers and utilities for easy importing
|
|
4
|
+
*/
|
|
5
|
+
export type { FormConfig, FormStorageConfig } from '../config/types';
|
|
6
|
+
export * from './FormSaveContext';
|
|
7
|
+
export type { FormSaveProvider, LoadResult, SaveResult, } from './FormSaveProvider';
|
|
8
|
+
export * from './FormSaveProvider';
|
|
9
|
+
export { ThemeProvider, useTheme, useThemeConfig } from './ThemeProvider';
|
package/server.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server entry point for @formbuilder/builder
|
|
3
|
+
* Contains storage providers that require Node.js APIs (node:fs, node:path).
|
|
4
|
+
* Only import this in server-side code (Node.js, Next.js Server Components, API routes).
|
|
5
|
+
*/
|
|
6
|
+
export { FilesystemStorageProvider } from './storage/FilesystemStorageProvider';
|
|
7
|
+
export { type DataConsistencyProvider, type ProviderCapabilities, StorageProviderFactory, } from './storage/StorageProviderFactory';
|
|
8
|
+
export type { CreateFormRequest, CreateProjectRequest, FormMetadata, FormStorageConfig, FormStorageProvider, StorageResult, } from './storage/types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormConfig } from '../config/types';
|
|
2
|
+
import { CreateProjectRequest, FormMetadata, FormStorageConfig, FormStorageProvider, StorageResult } from './types';
|
|
3
|
+
export declare class FilesystemStorageProvider implements FormStorageProvider {
|
|
4
|
+
private config;
|
|
5
|
+
private basePath;
|
|
6
|
+
initialize(config: FormStorageConfig): Promise<void>;
|
|
7
|
+
listForms(): Promise<StorageResult<FormMetadata[]>>;
|
|
8
|
+
loadForm(projectId: string, wizardId: string): Promise<StorageResult<FormConfig>>;
|
|
9
|
+
saveForm(projectId: string, wizardId: string, config: FormConfig): Promise<StorageResult>;
|
|
10
|
+
createProject(request: CreateProjectRequest): Promise<StorageResult>;
|
|
11
|
+
deleteForm(projectId: string, wizardId: string): Promise<StorageResult>;
|
|
12
|
+
getType(): string;
|
|
13
|
+
private ensureDirectoryExists;
|
|
14
|
+
/**
|
|
15
|
+
* Set the base path for the storage provider
|
|
16
|
+
* This allows applications to configure where forms are stored
|
|
17
|
+
*/
|
|
18
|
+
setBasePath(basePath: string): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormStorageConfig, FormStorageProvider, StorageResult } from './types';
|
|
2
|
+
export declare class NullStorageProvider implements FormStorageProvider {
|
|
3
|
+
getType(): string;
|
|
4
|
+
initialize(_config: FormStorageConfig): Promise<void>;
|
|
5
|
+
listForms(): Promise<StorageResult>;
|
|
6
|
+
loadForm(_projectId: string, _wizardId: string): Promise<StorageResult>;
|
|
7
|
+
saveForm(_projectId: string, _wizardId: string, _config: Record<string, unknown>): Promise<StorageResult>;
|
|
8
|
+
deleteForm(_projectId: string, _wizardId: string): Promise<StorageResult>;
|
|
9
|
+
listProjects(): Promise<StorageResult>;
|
|
10
|
+
createProject(_request: {
|
|
11
|
+
name: string;
|
|
12
|
+
directoryName?: string;
|
|
13
|
+
}): Promise<StorageResult>;
|
|
14
|
+
deleteProject(_projectId: string): Promise<StorageResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CreateProjectRequest, FormMetadata, FormStorageConfig, FormStorageProvider, StorageResult } from './types';
|
|
2
|
+
export interface PgLiteSyncConfig {
|
|
3
|
+
persistence?: "indexeddb" | "memory";
|
|
4
|
+
}
|
|
5
|
+
export declare class PgLiteSyncProvider implements FormStorageProvider {
|
|
6
|
+
private localDb;
|
|
7
|
+
private config;
|
|
8
|
+
private isInitialized;
|
|
9
|
+
constructor(config: PgLiteSyncConfig);
|
|
10
|
+
initialize(_config: FormStorageConfig): Promise<void>;
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
private migrateSchemaIfNeeded;
|
|
13
|
+
private migrateExistingData;
|
|
14
|
+
private createTables;
|
|
15
|
+
/**
|
|
16
|
+
* Initialize SERIAL sequences to handle any existing data
|
|
17
|
+
*/
|
|
18
|
+
private initializeSequences;
|
|
19
|
+
saveForm(projectId: string, wizardId: string, config: Record<string, unknown>): Promise<StorageResult>;
|
|
20
|
+
loadForm(projectId: string, wizardId: string): Promise<StorageResult<Record<string, unknown>>>;
|
|
21
|
+
listProjects(): Promise<StorageResult<Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
created_at: string;
|
|
26
|
+
updated_at: string;
|
|
27
|
+
}>>>;
|
|
28
|
+
listForms(): Promise<StorageResult<FormMetadata[]>>;
|
|
29
|
+
deleteForm(projectId: string, wizardId: string): Promise<StorageResult>;
|
|
30
|
+
createProject(request: CreateProjectRequest): Promise<StorageResult>;
|
|
31
|
+
deleteProject(projectId: string): Promise<StorageResult>;
|
|
32
|
+
private ensureProject;
|
|
33
|
+
private ensureInitialized;
|
|
34
|
+
getStats(): Promise<{
|
|
35
|
+
projects: number;
|
|
36
|
+
forms: number;
|
|
37
|
+
}>;
|
|
38
|
+
exportData(): Promise<string>;
|
|
39
|
+
getType(): string;
|
|
40
|
+
close(): Promise<void>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FormStorageConfig, FormStorageProvider } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Provider capabilities interface for UI components
|
|
4
|
+
*/
|
|
5
|
+
export interface ProviderCapabilities {
|
|
6
|
+
strategy: "filesystem" | "database" | "none";
|
|
7
|
+
isLive: boolean;
|
|
8
|
+
hasSync: boolean;
|
|
9
|
+
isZeroConfig: boolean;
|
|
10
|
+
supportsOffline: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Interface for providers that support data consistency validation
|
|
14
|
+
*/
|
|
15
|
+
export interface DataConsistencyProvider {
|
|
16
|
+
validateDataConsistency(): Promise<boolean>;
|
|
17
|
+
reconcileConflicts(): Promise<boolean>;
|
|
18
|
+
resetLocalData(): Promise<boolean>;
|
|
19
|
+
getDataIntegrityStatus(): {
|
|
20
|
+
status: "consistent" | "inconsistent" | "unknown";
|
|
21
|
+
reconciling: boolean;
|
|
22
|
+
lastValidation: string | null;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class StorageProviderFactory {
|
|
26
|
+
private static instance;
|
|
27
|
+
private currentProvider;
|
|
28
|
+
private currentConfig;
|
|
29
|
+
private isInitializing;
|
|
30
|
+
private initializationPromise;
|
|
31
|
+
/**
|
|
32
|
+
* Get singleton instance
|
|
33
|
+
*/
|
|
34
|
+
static getInstance(): StorageProviderFactory;
|
|
35
|
+
/**
|
|
36
|
+
* Create and initialize a storage provider based on configuration
|
|
37
|
+
*/
|
|
38
|
+
createProvider(config: FormStorageConfig): Promise<FormStorageProvider>;
|
|
39
|
+
/**
|
|
40
|
+
* Internal provider creation method
|
|
41
|
+
*/
|
|
42
|
+
private doCreateProvider;
|
|
43
|
+
/**
|
|
44
|
+
* Type guard to check if provider supports data consistency validation
|
|
45
|
+
*/
|
|
46
|
+
private isDataConsistencyProvider;
|
|
47
|
+
/**
|
|
48
|
+
* Check if the current configuration is compatible with a new config
|
|
49
|
+
*/
|
|
50
|
+
private isConfigCompatible;
|
|
51
|
+
/**
|
|
52
|
+
* Create a filesystem provider based on environment
|
|
53
|
+
* Uses dynamic import for FilesystemStorageProvider to avoid bundling node:fs in client code
|
|
54
|
+
*/
|
|
55
|
+
private createFilesystemProvider;
|
|
56
|
+
/**
|
|
57
|
+
* Create a database provider - always uses PgLiteSyncProvider for local-first approach
|
|
58
|
+
* Database connection is mandatory - no offline-only mode
|
|
59
|
+
*/
|
|
60
|
+
private createDatabaseProvider;
|
|
61
|
+
/**
|
|
62
|
+
* Get the current provider
|
|
63
|
+
*/
|
|
64
|
+
getCurrentProvider(): FormStorageProvider | null;
|
|
65
|
+
/**
|
|
66
|
+
* Get the current provider with data consistency capabilities
|
|
67
|
+
*/
|
|
68
|
+
getCurrentDataConsistencyProvider(): DataConsistencyProvider | null;
|
|
69
|
+
/**
|
|
70
|
+
* Get capabilities of the current provider for UI components
|
|
71
|
+
*/
|
|
72
|
+
getProviderCapabilities(): ProviderCapabilities | null;
|
|
73
|
+
/**
|
|
74
|
+
* Create a provider without caching it (useful for testing or migration)
|
|
75
|
+
*/
|
|
76
|
+
static createStandaloneProvider(config: FormStorageConfig): Promise<FormStorageProvider>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { CreateProjectRequest, FormMetadata, FormStorageConfig, FormStorageProvider, StorageResult } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Capabilities of the current environment
|
|
4
|
+
*/
|
|
5
|
+
interface EnvironmentCapabilities {
|
|
6
|
+
/** Whether File System Access API is available */
|
|
7
|
+
hasFileSystemAccess: boolean;
|
|
8
|
+
/** Whether we're in a secure context (required for File System Access API) */
|
|
9
|
+
isSecureContext: boolean;
|
|
10
|
+
/** Whether we're in development mode */
|
|
11
|
+
isDevelopment: boolean;
|
|
12
|
+
/** Primary storage method to use */
|
|
13
|
+
primaryMethod: "file-system-access" | "localstorage-download";
|
|
14
|
+
}
|
|
15
|
+
export declare class ZeroConfigFilesystemStorageProvider implements FormStorageProvider {
|
|
16
|
+
private config;
|
|
17
|
+
private capabilities;
|
|
18
|
+
private directoryHandle;
|
|
19
|
+
private userMessage;
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Detect what filesystem capabilities are available in this environment
|
|
23
|
+
*/
|
|
24
|
+
private detectEnvironmentCapabilities;
|
|
25
|
+
/**
|
|
26
|
+
* Generate user-friendly message about current capabilities
|
|
27
|
+
*/
|
|
28
|
+
private generateUserMessage;
|
|
29
|
+
initialize(config: FormStorageConfig): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if localStorage is available and working
|
|
32
|
+
*/
|
|
33
|
+
private ensureLocalStorageAvailable;
|
|
34
|
+
/**
|
|
35
|
+
* Request directory access for File System Access API
|
|
36
|
+
* @param userInitiated - Whether this request is user-initiated (required for SecurityError handling)
|
|
37
|
+
*/
|
|
38
|
+
private requestDirectoryAccess;
|
|
39
|
+
listForms(): Promise<StorageResult<FormMetadata[]>>;
|
|
40
|
+
/**
|
|
41
|
+
* List forms from server/filesystem via HTTP (for existing files)
|
|
42
|
+
*/
|
|
43
|
+
private listFormsFromServer;
|
|
44
|
+
/**
|
|
45
|
+
* Discover forms by trying common project/form combinations
|
|
46
|
+
*/
|
|
47
|
+
private discoverFormsFromServer;
|
|
48
|
+
/**
|
|
49
|
+
* Process forms from a manifest file
|
|
50
|
+
*/
|
|
51
|
+
private processManifestForms;
|
|
52
|
+
/**
|
|
53
|
+
* Merge forms lists, with server forms taking priority over local storage
|
|
54
|
+
*/
|
|
55
|
+
private mergeFormsLists;
|
|
56
|
+
/**
|
|
57
|
+
* List forms using LocalStorage
|
|
58
|
+
*/
|
|
59
|
+
private listFormsLocalStorage;
|
|
60
|
+
loadForm(projectId: string, wizardId: string): Promise<StorageResult<Record<string, unknown>>>;
|
|
61
|
+
/**
|
|
62
|
+
* Load form using File System Access API
|
|
63
|
+
*/
|
|
64
|
+
private loadFormFileSystemAccess;
|
|
65
|
+
/**
|
|
66
|
+
* Load form using HTTP from the server filesystem
|
|
67
|
+
*/
|
|
68
|
+
private loadFormHttp;
|
|
69
|
+
/**
|
|
70
|
+
* Load form using LocalStorage
|
|
71
|
+
*/
|
|
72
|
+
private loadFormLocalStorage;
|
|
73
|
+
saveForm(projectId: string, wizardId: string, config: Record<string, unknown>): Promise<StorageResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Save form using File System Access API
|
|
76
|
+
*/
|
|
77
|
+
private saveFormFileSystemAccess;
|
|
78
|
+
/**
|
|
79
|
+
* Save form using HTTP to the server filesystem
|
|
80
|
+
*/
|
|
81
|
+
private saveFormHttp;
|
|
82
|
+
/**
|
|
83
|
+
* Delete form using HTTP DELETE request
|
|
84
|
+
*/
|
|
85
|
+
private deleteFormHttp;
|
|
86
|
+
/**
|
|
87
|
+
* Save form using LocalStorage with automatic download
|
|
88
|
+
*/
|
|
89
|
+
private saveFormLocalStorage;
|
|
90
|
+
/**
|
|
91
|
+
* Download form as a file (backup for localStorage method)
|
|
92
|
+
*/
|
|
93
|
+
private downloadFormAsFile;
|
|
94
|
+
createProject(request: CreateProjectRequest): Promise<StorageResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Create project using File System Access API
|
|
97
|
+
*/
|
|
98
|
+
private createProjectFileSystemAccess;
|
|
99
|
+
/**
|
|
100
|
+
* Create project using HTTP to the server filesystem
|
|
101
|
+
*/
|
|
102
|
+
private createProjectHttp;
|
|
103
|
+
/**
|
|
104
|
+
* Create project using LocalStorage (no-op since directories don't exist)
|
|
105
|
+
*/
|
|
106
|
+
private createProjectLocalStorage;
|
|
107
|
+
deleteForm(projectId: string, wizardId: string): Promise<StorageResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Delete form using File System Access API
|
|
110
|
+
*/
|
|
111
|
+
private deleteFormFileSystemAccess;
|
|
112
|
+
/**
|
|
113
|
+
* Delete form using LocalStorage
|
|
114
|
+
*/
|
|
115
|
+
private deleteFormLocalStorage;
|
|
116
|
+
/**
|
|
117
|
+
* Delete an entire project and all its forms
|
|
118
|
+
*/
|
|
119
|
+
deleteProject(projectId: string): Promise<StorageResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Delete project using HTTP DELETE request
|
|
122
|
+
*/
|
|
123
|
+
private deleteProjectHttp;
|
|
124
|
+
/**
|
|
125
|
+
* Delete project using File System Access API
|
|
126
|
+
*/
|
|
127
|
+
private deleteProjectFileSystemAccess;
|
|
128
|
+
/**
|
|
129
|
+
* Delete project using LocalStorage (removes all forms in project)
|
|
130
|
+
*/
|
|
131
|
+
private deleteProjectLocalStorage;
|
|
132
|
+
getType(): string;
|
|
133
|
+
/**
|
|
134
|
+
* Manually enable filesystem access (user-initiated)
|
|
135
|
+
*/
|
|
136
|
+
enableFilesystemAccess(): Promise<{
|
|
137
|
+
success: boolean;
|
|
138
|
+
error?: string;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Get current capabilities and user message
|
|
142
|
+
*/
|
|
143
|
+
getCapabilities(): {
|
|
144
|
+
capabilities: EnvironmentCapabilities;
|
|
145
|
+
userMessage: string;
|
|
146
|
+
hasDirectoryAccess: boolean;
|
|
147
|
+
canUpgradeToFilesystem: boolean;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Export all forms as a downloadable backup
|
|
151
|
+
*/
|
|
152
|
+
exportFormsBackup(): Promise<StorageResult<{
|
|
153
|
+
fileName: string;
|
|
154
|
+
count: number;
|
|
155
|
+
}>>;
|
|
156
|
+
}
|
|
157
|
+
export {};
|