@nu-art/thunderstorm-frontend 0.400.5
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/_ats/ATS_ActionProcessor/ATS_ActionProcessor.d.ts +17 -0
- package/_ats/ATS_ActionProcessor/ATS_ActionProcessor.js +52 -0
- package/_ats/ATS_ActionProcessor/ATS_ActionProcessor.scss +43 -0
- package/_ats/ATS_AppConfigEditor/ATS_AppConfigEditor.d.ts +25 -0
- package/_ats/ATS_AppConfigEditor/ATS_AppConfigEditor.js +88 -0
- package/_ats/ATS_AppConfigEditor/ATS_AppConfigEditor.scss +117 -0
- package/_ats/ATS_CollectionUpgrades/ATS_CollectionUpgrades.d.ts +17 -0
- package/_ats/ATS_CollectionUpgrades/ATS_CollectionUpgrades.js +45 -0
- package/_ats/ATS_CollectionUpgrades/ATS_CollectionUpgrades.scss +24 -0
- package/_ats/ATS_CrudOperations/ATS_CrudOperations.d.ts +29 -0
- package/_ats/ATS_CrudOperations/ATS_CrudOperations.js +93 -0
- package/_ats/ATS_CrudOperations/ATS_CrudOperations.scss +46 -0
- package/_ats/ATS_CrudOperations/ui-components.d.ts +24 -0
- package/_ats/ATS_CrudOperations/ui-components.js +11 -0
- package/_ats/ATS_EditableItem/ATS_EditableItem.d.ts +16 -0
- package/_ats/ATS_EditableItem/ATS_EditableItem.js +48 -0
- package/_ats/ATS_IDBCacheComparison/ATS_IDBCacheComparison.d.ts +18 -0
- package/_ats/ATS_IDBCacheComparison/ATS_IDBCacheComparison.js +28 -0
- package/_ats/ATS_IDBCacheComparison/ATS_IDBCacheComparison.scss +7 -0
- package/_ats/ATS_IDBCacheComparison/Component_CollectionGrid.d.ts +23 -0
- package/_ats/ATS_IDBCacheComparison/Component_CollectionGrid.js +66 -0
- package/_ats/ATS_IDBCacheComparison/Component_CollectionGrid.scss +52 -0
- package/_ats/ATS_IDBCacheComparison/Dialog_IDBCacheComparison.d.ts +17 -0
- package/_ats/ATS_IDBCacheComparison/Dialog_IDBCacheComparison.js +30 -0
- package/_ats/ATS_IDBCacheComparison/Dialog_IDBCacheComparison.scss +25 -0
- package/_ats/ATS_Printables/ATS_AbstractPrintable.d.ts +16 -0
- package/_ats/ATS_Printables/ATS_AbstractPrintable.js +37 -0
- package/_ats/ATS_Printables/ATS_Printable.d.ts +13 -0
- package/_ats/ATS_Printables/ATS_Printable.js +45 -0
- package/_ats/ATS_Printables/ATS_Printable.scss +40 -0
- package/_ats/ATS_ProtoComponent/ATS_ProtoComponent.d.ts +33 -0
- package/_ats/ATS_ProtoComponent/ATS_ProtoComponent.js +80 -0
- package/_ats/ATS_ProtoComponent/ATS_ProtoComponent.scss +19 -0
- package/_ats/ATS_SyncEnv/ATS_SyncEnv.d.ts +51 -0
- package/_ats/ATS_SyncEnv/ATS_SyncEnv.js +215 -0
- package/_ats/ATS_SyncEnv/ATS_SyncEnv.scss +172 -0
- package/_ats/ATS_Toaster/ATS_Toaster.d.ts +23 -0
- package/_ats/ATS_Toaster/ATS_Toaster.js +48 -0
- package/_ats/ATS_Toaster/ATS_Toaster.scss +2 -0
- package/_ats/ATS_Toaster/index.d.ts +1 -0
- package/_ats/ATS_Toaster/index.js +1 -0
- package/_ats/dialogs/Dialog_ActionProcessorConfirmation/Dialog_ActionProcessorConfirmation.d.ts +18 -0
- package/_ats/dialogs/Dialog_ActionProcessorConfirmation/Dialog_ActionProcessorConfirmation.js +41 -0
- package/_ats/dialogs/Dialog_ActionProcessorConfirmation/Dialog_ActionProcessorConfirmation.scss +71 -0
- package/_ats/dialogs/index.d.ts +1 -0
- package/_ats/dialogs/index.js +1 -0
- package/_ats/index.d.ts +8 -0
- package/_ats/index.js +8 -0
- package/_entity/app-config/ModuleFE_AppConfig.d.ts +24 -0
- package/_entity/app-config/ModuleFE_AppConfig.js +52 -0
- package/_entity/app-config/index.d.ts +2 -0
- package/_entity/app-config/index.js +2 -0
- package/_entity/app-config/module-pack.d.ts +1 -0
- package/_entity/app-config/module-pack.js +2 -0
- package/_entity/editable-test/ModuleFE_EditableTest.d.ts +11 -0
- package/_entity/editable-test/ModuleFE_EditableTest.js +12 -0
- package/_entity/editable-test/index.d.ts +2 -0
- package/_entity/editable-test/index.js +2 -0
- package/_entity/editable-test/module-pack.d.ts +1 -0
- package/_entity/editable-test/module-pack.js +2 -0
- package/_entity/editable-test/ui-components.d.ts +37 -0
- package/_entity/editable-test/ui-components.js +21 -0
- package/_entity.d.ts +2 -0
- package/_entity.js +2 -0
- package/_to-refactor/MenuAndButton.d.ts +1 -0
- package/_to-refactor/MenuAndButton.js +87 -0
- package/behavior-functions/index.d.ts +1 -0
- package/behavior-functions/index.js +1 -0
- package/behavior-functions/scroll-into-view.d.ts +6 -0
- package/behavior-functions/scroll-into-view.js +55 -0
- package/component-modules/ModuleFE_Dialog.d.ts +27 -0
- package/component-modules/ModuleFE_Dialog.js +48 -0
- package/component-modules/ModuleFE_Notifications.d.ts +45 -0
- package/component-modules/ModuleFE_Notifications.js +133 -0
- package/component-modules/ModuleFE_Toaster.d.ts +28 -0
- package/component-modules/ModuleFE_Toaster.js +97 -0
- package/component-modules/mouse-interactivity/ModuleFE_MouseInteractivity.d.ts +9 -0
- package/component-modules/mouse-interactivity/ModuleFE_MouseInteractivity.js +35 -0
- package/component-modules/mouse-interactivity/helper-functions.d.ts +108 -0
- package/component-modules/mouse-interactivity/helper-functions.js +339 -0
- package/component-modules/mouse-interactivity/index.d.ts +3 -0
- package/component-modules/mouse-interactivity/index.js +3 -0
- package/component-modules/mouse-interactivity/types.d.ts +37 -0
- package/component-modules/mouse-interactivity/types.js +2 -0
- package/components/ActionButton.d.ts +7 -0
- package/components/ActionButton.js +29 -0
- package/components/AwaitModules/AwaitModules.d.ts +40 -0
- package/components/AwaitModules/AwaitModules.js +95 -0
- package/components/AwaitModules/AwaitModules.scss +53 -0
- package/components/AwaitSync/AwaitSync.d.ts +18 -0
- package/components/AwaitSync/AwaitSync.js +25 -0
- package/components/AwaitSync/AwaitSync.scss +13 -0
- package/components/Button/ATS_Button.d.ts +21 -0
- package/components/Button/ATS_Button.js +66 -0
- package/components/Button/ATS_Button.scss +19 -0
- package/components/Button/Button.d.ts +40 -0
- package/components/Button/Button.js +94 -0
- package/components/Button/Button.scss +151 -0
- package/components/FrameLayout/FrameLayout.d.ts +7 -0
- package/components/FrameLayout/FrameLayout.js +10 -0
- package/components/FrameLayout/FrameLayout.scss +5 -0
- package/components/FrameLayout/index.d.ts +1 -0
- package/components/FrameLayout/index.js +1 -0
- package/components/GenericDropDown/GenericDropDownV3.d.ts +108 -0
- package/components/GenericDropDown/GenericDropDownV3.js +98 -0
- package/components/GenericDropDown/index.d.ts +1 -0
- package/components/GenericDropDown/index.js +1 -0
- package/components/GenericRenderer/Component_GenericRenderer.d.ts +15 -0
- package/components/GenericRenderer/Component_GenericRenderer.js +13 -0
- package/components/HeightBounder.d.ts +11 -0
- package/components/HeightBounder.js +25 -0
- package/components/Label/ATS_Label.d.ts +12 -0
- package/components/Label/ATS_Label.js +34 -0
- package/components/Label/ATS_Label.scss +24 -0
- package/components/Label/Label.d.ts +30 -0
- package/components/Label/Label.js +84 -0
- package/components/Label/Label.scss +89 -0
- package/components/Layouts/Layouts.d.ts +38 -0
- package/components/Layouts/Layouts.js +56 -0
- package/components/Layouts/_Layouts.scss +53 -0
- package/components/Layouts/_Layouts_.scss +69 -0
- package/components/Layouts/index.d.ts +1 -0
- package/components/Layouts/index.js +21 -0
- package/components/Page_ItemsEditor/Page_ItemsEditor.d.ts +66 -0
- package/components/Page_ItemsEditor/Page_ItemsEditor.js +134 -0
- package/components/Page_ItemsEditor/Page_ItemsEditor.scss +104 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_DefaultFilter/ItemEditor_DefaultFilter.d.ts +16 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_DefaultFilter/ItemEditor_DefaultFilter.js +15 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_DefaultFilter/ItemEditor_DefaultFilter.scss +4 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_DefaultFilter/index.d.ts +1 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_DefaultFilter/index.js +1 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_ListRenderer/ItemEditor_DefaultList.d.ts +26 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_ListRenderer/ItemEditor_DefaultList.js +68 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_ListRenderer/ItemEditor_DefaultList.scss +4 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_ListRenderer/index.d.ts +1 -0
- package/components/Page_ItemsEditor/defaults/ItemEditor_ListRenderer/index.js +1 -0
- package/components/Page_ItemsEditor/index.d.ts +1 -0
- package/components/Page_ItemsEditor/index.js +1 -0
- package/components/Page_ItemsEditor/types.d.ts +4 -0
- package/components/Page_ItemsEditor/types.js +1 -0
- package/components/RelativeLayout/RelativeLayout.d.ts +7 -0
- package/components/RelativeLayout/RelativeLayout.js +10 -0
- package/components/RelativeLayout/RelativeLayout.scss +3 -0
- package/components/RelativeLayout/index.d.ts +1 -0
- package/components/RelativeLayout/index.js +1 -0
- package/components/Show.d.ts +20 -0
- package/components/Show.js +30 -0
- package/components/TS_AppTools/TS_AppTools.d.ts +30 -0
- package/components/TS_AppTools/TS_AppTools.js +144 -0
- package/components/TS_AppTools/TS_AppTools.scss +193 -0
- package/components/TS_AppTools/TS_AppTools_Default.d.ts +7 -0
- package/components/TS_AppTools/TS_AppTools_Default.js +16 -0
- package/components/TS_AppTools/index.d.ts +2 -0
- package/components/TS_AppTools/index.js +22 -0
- package/components/TS_AppTools/types.d.ts +19 -0
- package/components/TS_AppTools/types.js +6 -0
- package/components/TS_ButtonGroup/TS_ButtonGroup.d.ts +12 -0
- package/components/TS_ButtonGroup/TS_ButtonGroup.js +94 -0
- package/components/TS_ButtonGroup/TS_ButtonGroup.scss +58 -0
- package/components/TS_ButtonGroup/index.d.ts +2 -0
- package/components/TS_ButtonGroup/index.js +2 -0
- package/components/TS_ButtonGroup/types.d.ts +38 -0
- package/components/TS_ButtonGroup/types.js +1 -0
- package/components/TS_ButtonLoader/TS_ButtonLoader.d.ts +5 -0
- package/components/TS_ButtonLoader/TS_ButtonLoader.js +8 -0
- package/components/TS_ButtonLoader/TS_ButtonLoader.scss +63 -0
- package/components/TS_ButtonLoader/index.d.ts +1 -0
- package/components/TS_ButtonLoader/index.js +1 -0
- package/components/TS_Card/TS_Card.d.ts +7 -0
- package/components/TS_Card/TS_Card.js +14 -0
- package/components/TS_Card/TS_Card.scss +7 -0
- package/components/TS_Card/index.d.ts +1 -0
- package/components/TS_Card/index.js +1 -0
- package/components/TS_Checkbox/ATS_CheckboxV2.d.ts +3 -0
- package/components/TS_Checkbox/ATS_CheckboxV2.js +30 -0
- package/components/TS_Checkbox/ATS_CheckboxV2.scss +4 -0
- package/components/TS_Checkbox/TS_Checkbox.d.ts +48 -0
- package/components/TS_Checkbox/TS_Checkbox.js +46 -0
- package/components/TS_Checkbox/TS_Checkbox.scss +62 -0
- package/components/TS_Checkbox/TS_CheckboxV2.d.ts +37 -0
- package/components/TS_Checkbox/TS_CheckboxV2.js +53 -0
- package/components/TS_Checkbox/TS_CheckboxV2.scss +97 -0
- package/components/TS_Checkbox/index.d.ts +1 -0
- package/components/TS_Checkbox/index.js +21 -0
- package/components/TS_CheckboxGroup/ATS_CheckboxGroup.d.ts +19 -0
- package/components/TS_CheckboxGroup/ATS_CheckboxGroup.js +89 -0
- package/components/TS_CheckboxGroup/ATS_CheckboxGroup.scss +6 -0
- package/components/TS_CheckboxGroup/TS_CheckboxGroup.d.ts +35 -0
- package/components/TS_CheckboxGroup/TS_CheckboxGroup.js +47 -0
- package/components/TS_CheckboxGroup/TS_CheckboxGroup.scss +32 -0
- package/components/TS_CheckboxGroup/index.d.ts +1 -0
- package/components/TS_CheckboxGroup/index.js +1 -0
- package/components/TS_CollapsableContainer/TS_CollapsableContainer.d.ts +44 -0
- package/components/TS_CollapsableContainer/TS_CollapsableContainer.js +80 -0
- package/components/TS_CollapsableContainer/TS_CollapsableContainer.scss +47 -0
- package/components/TS_CollapsableContainer/index.d.ts +1 -0
- package/components/TS_CollapsableContainer/index.js +1 -0
- package/components/TS_CollapsableContainerV2/TS_CollapsableContainerV2.d.ts +36 -0
- package/components/TS_CollapsableContainerV2/TS_CollapsableContainerV2.js +46 -0
- package/components/TS_CollapsableContainerV2/TS_CollapsableContainerV2.scss +66 -0
- package/components/TS_CollapsableContainerV2/ats.d.ts +3 -0
- package/components/TS_CollapsableContainerV2/ats.js +39 -0
- package/components/TS_CollapsableContainerV2/ats.scss +35 -0
- package/components/TS_CollapsableContainerV2/index.d.ts +2 -0
- package/components/TS_CollapsableContainerV2/index.js +2 -0
- package/components/TS_ComponentTransition/TS_ComponentTransition.d.ts +25 -0
- package/components/TS_ComponentTransition/TS_ComponentTransition.js +65 -0
- package/components/TS_ComponentTransition/index.d.ts +1 -0
- package/components/TS_ComponentTransition/index.js +1 -0
- package/components/TS_CopyToClipboard/TS_CopyToClipboard.d.ts +4 -0
- package/components/TS_CopyToClipboard/TS_CopyToClipboard.js +11 -0
- package/components/TS_CopyToClipboard/index.d.ts +1 -0
- package/components/TS_CopyToClipboard/index.js +21 -0
- package/components/TS_Dialog/TS_Dialog.d.ts +89 -0
- package/components/TS_Dialog/TS_Dialog.js +140 -0
- package/components/TS_Dialog/TS_Dialog.scss +116 -0
- package/components/TS_Dialog/TS_DialogOverlay.d.ts +15 -0
- package/components/TS_Dialog/TS_DialogOverlay.js +48 -0
- package/components/TS_Dialog/TS_DialogOverlay.scss +41 -0
- package/components/TS_Dialog/TS_SimpleDialog.d.ts +21 -0
- package/components/TS_Dialog/TS_SimpleDialog.js +37 -0
- package/components/TS_Dialog/TS_SimpleDialog.scss +5 -0
- package/components/TS_Dialog/TS_SimpleDialogue.d.ts +28 -0
- package/components/TS_Dialog/TS_SimpleDialogue.js +38 -0
- package/components/TS_Dialog/index.d.ts +2 -0
- package/components/TS_Dialog/index.js +22 -0
- package/components/TS_DragAndDrop/TS_DragAndDrop.d.ts +48 -0
- package/components/TS_DragAndDrop/TS_DragAndDrop.js +105 -0
- package/components/TS_DragAndDrop/TS_DragAndDrop.scss +61 -0
- package/components/TS_DragAndDrop/index.d.ts +1 -0
- package/components/TS_DragAndDrop/index.js +21 -0
- package/components/TS_Dropdown/TS_DropDown.d.ts +120 -0
- package/components/TS_Dropdown/TS_DropDown.js +332 -0
- package/components/TS_Dropdown/TS_DropDown.scss +134 -0
- package/components/TS_Dropdown/index.d.ts +1 -0
- package/components/TS_Dropdown/index.js +21 -0
- package/components/TS_EditableContent/TS_EditableContent.d.ts +19 -0
- package/components/TS_EditableContent/TS_EditableContent.js +32 -0
- package/components/TS_EditableContent/types.d.ts +4 -0
- package/components/TS_EditableContent/types.js +1 -0
- package/components/TS_EditableItemComponent/TS_EditableItemComponent.d.ts +23 -0
- package/components/TS_EditableItemComponent/TS_EditableItemComponent.js +47 -0
- package/components/TS_EditableItemController/TS_EditableItemController.d.ts +36 -0
- package/components/TS_EditableItemController/TS_EditableItemController.js +54 -0
- package/components/TS_EditableItemController/TS_EditableItemController.scss +3 -0
- package/components/TS_EditableItemController/index.d.ts +1 -0
- package/components/TS_EditableItemController/index.js +1 -0
- package/components/TS_EditableItemControllerProto/TS_EditableItemControllerProto.d.ts +32 -0
- package/components/TS_EditableItemControllerProto/TS_EditableItemControllerProto.js +53 -0
- package/components/TS_EditableItemControllerProto/TS_EditableItemControllerProto.scss +3 -0
- package/components/TS_EditableItemControllerProto/index.d.ts +1 -0
- package/components/TS_EditableItemControllerProto/index.js +1 -0
- package/components/TS_EditableItemStatus/TS_EditableItemStatus.d.ts +20 -0
- package/components/TS_EditableItemStatus/TS_EditableItemStatus.js +34 -0
- package/components/TS_EditableText/TS_EditableText.d.ts +57 -0
- package/components/TS_EditableText/TS_EditableText.js +100 -0
- package/components/TS_EditableText/TS_EditableText.scss +90 -0
- package/components/TS_EditableText/index.d.ts +1 -0
- package/components/TS_EditableText/index.js +1 -0
- package/components/TS_ErrorBoundary/TS_ErrorBoundary.d.ts +54 -0
- package/components/TS_ErrorBoundary/TS_ErrorBoundary.js +103 -0
- package/components/TS_ErrorBoundary/TS_ErrorBoundary.scss +95 -0
- package/components/TS_ErrorBoundary/index.d.ts +1 -0
- package/components/TS_ErrorBoundary/index.js +21 -0
- package/components/TS_Form/TS_Form.d.ts +9 -0
- package/components/TS_Form/TS_Form.js +11 -0
- package/components/TS_Form/TS_Form.scss +0 -0
- package/components/TS_Form/consts.d.ts +1 -0
- package/components/TS_Form/consts.js +1 -0
- package/components/TS_Form/index.d.ts +3 -0
- package/components/TS_Form/index.js +3 -0
- package/components/TS_Form/types.d.ts +13 -0
- package/components/TS_Form/types.js +1 -0
- package/components/TS_GridTableProto/TS_GridTableProto.d.ts +18 -0
- package/components/TS_GridTableProto/TS_GridTableProto.js +22 -0
- package/components/TS_GridTableProto/TS_GridTableProto.scss +4 -0
- package/components/TS_GridTableProto/index.d.ts +1 -0
- package/components/TS_GridTableProto/index.js +1 -0
- package/components/TS_Input/ATS_TextArea.d.ts +14 -0
- package/components/TS_Input/ATS_TextArea.js +24 -0
- package/components/TS_Input/ATS_TextArea.scss +24 -0
- package/components/TS_Input/TS_BaseInput.d.ts +44 -0
- package/components/TS_Input/TS_BaseInput.js +47 -0
- package/components/TS_Input/TS_Input.d.ts +24 -0
- package/components/TS_Input/TS_Input.js +53 -0
- package/components/TS_Input/TS_Input.scss +64 -0
- package/components/TS_Input/TS_TextArea.d.ts +14 -0
- package/components/TS_Input/TS_TextArea.js +72 -0
- package/components/TS_Input/TS_TextArea.scss +41 -0
- package/components/TS_Input/index.d.ts +4 -0
- package/components/TS_Input/index.js +25 -0
- package/components/TS_JSONViewer/TS_JSONViewer.d.ts +18 -0
- package/components/TS_JSONViewer/TS_JSONViewer.js +64 -0
- package/components/TS_JSONViewer/TS_JSONViewer.scss +87 -0
- package/components/TS_JSONViewer/types.d.ts +10 -0
- package/components/TS_JSONViewer/types.js +1 -0
- package/components/TS_Link/TS_Link.d.ts +15 -0
- package/components/TS_Link/TS_Link.js +36 -0
- package/components/TS_Link/TS_Link.scss +32 -0
- package/components/TS_Link/index.d.ts +1 -0
- package/components/TS_Link/index.js +21 -0
- package/components/TS_ListOrganizer/TS_ListOrganizer.d.ts +33 -0
- package/components/TS_ListOrganizer/TS_ListOrganizer.js +64 -0
- package/components/TS_ListOrganizer/TS_ListOrganizer.scss +37 -0
- package/components/TS_ListOrganizer/index.d.ts +1 -0
- package/components/TS_ListOrganizer/index.js +21 -0
- package/components/TS_Loader/TS_Loader.d.ts +6 -0
- package/components/TS_Loader/TS_Loader.js +9 -0
- package/components/TS_Loader/TS_Loader.scss +71 -0
- package/components/TS_Loader/index.d.ts +1 -0
- package/components/TS_Loader/index.js +1 -0
- package/components/TS_MemoryMonitor/TS_MemoryMonitor.d.ts +10 -0
- package/components/TS_MemoryMonitor/TS_MemoryMonitor.js +48 -0
- package/components/TS_MemoryMonitor/TS_MemoryMonitor.scss +31 -0
- package/components/TS_MemoryMonitor/index.d.ts +1 -0
- package/components/TS_MemoryMonitor/index.js +21 -0
- package/components/TS_MouseInteractivity/TS_PopUp/TS_PopUp.d.ts +9 -0
- package/components/TS_MouseInteractivity/TS_PopUp/TS_PopUp.js +28 -0
- package/components/TS_MouseInteractivity/TS_PopUp/TS_PopUp.scss +53 -0
- package/components/TS_MouseInteractivity/TS_Tooltip/TS_ToolTip.d.ts +12 -0
- package/components/TS_MouseInteractivity/TS_Tooltip/TS_ToolTip.js +65 -0
- package/components/TS_MouseInteractivity/TS_Tooltip/TS_ToolTip.scss +46 -0
- package/components/TS_MouseInteractivity/base/TS_MouseInteractivity.d.ts +18 -0
- package/components/TS_MouseInteractivity/base/TS_MouseInteractivity.js +100 -0
- package/components/TS_MouseInteractivity/index.d.ts +2 -0
- package/components/TS_MouseInteractivity/index.js +22 -0
- package/components/TS_MultiSelect/TS_MultiSelect.scss +34 -0
- package/components/TS_MultiSelect/TS_MultiSelect_V2.d.ts +36 -0
- package/components/TS_MultiSelect/TS_MultiSelect_V2.js +41 -0
- package/components/TS_MultiSelect/index.d.ts +1 -0
- package/components/TS_MultiSelect/index.js +21 -0
- package/components/TS_Notifications/TS_Notifications.d.ts +22 -0
- package/components/TS_Notifications/TS_Notifications.js +96 -0
- package/components/TS_Notifications/TS_Notifications.scss +120 -0
- package/components/TS_Notifications/genericNotificationAction.d.ts +8 -0
- package/components/TS_Notifications/genericNotificationAction.js +16 -0
- package/components/TS_Notifications/index.d.ts +2 -0
- package/components/TS_Notifications/index.js +2 -0
- package/components/TS_Overlay/TS_Overlay.d.ts +12 -0
- package/components/TS_Overlay/TS_Overlay.js +32 -0
- package/components/TS_Overlay/TS_Overlay.scss +41 -0
- package/components/TS_Overlay/index.d.ts +1 -0
- package/components/TS_Overlay/index.js +21 -0
- package/components/TS_Printable/TS_Printable.d.ts +13 -0
- package/components/TS_Printable/TS_Printable.js +20 -0
- package/components/TS_Printable/TS_Printable.scss +47 -0
- package/components/TS_Printable/index.d.ts +1 -0
- package/components/TS_Printable/index.js +21 -0
- package/components/TS_ProgressBar/TS_ProgressBar.d.ts +22 -0
- package/components/TS_ProgressBar/TS_ProgressBar.js +47 -0
- package/components/TS_ProgressBar/TS_ProgressBar.scss +79 -0
- package/components/TS_ProgressBar/index.d.ts +1 -0
- package/components/TS_ProgressBar/index.js +1 -0
- package/components/TS_PropRenderer/TS_PropRenderer.d.ts +18 -0
- package/components/TS_PropRenderer/TS_PropRenderer.js +36 -0
- package/components/TS_PropRenderer/TS_PropRenderer.scss +19 -0
- package/components/TS_PropRenderer/index.d.ts +1 -0
- package/components/TS_PropRenderer/index.js +1 -0
- package/components/TS_Radio/TS_Radio.d.ts +34 -0
- package/components/TS_Radio/TS_Radio.js +49 -0
- package/components/TS_Radio/TS_Radio.scss +68 -0
- package/components/TS_Radio/index.d.ts +1 -0
- package/components/TS_Radio/index.js +1 -0
- package/components/TS_ReadMore/TS_ReadMore.d.ts +26 -0
- package/components/TS_ReadMore/TS_ReadMore.js +86 -0
- package/components/TS_ReadMore/TS_ReadMore.scss +36 -0
- package/components/TS_ReadMore/index.d.ts +1 -0
- package/components/TS_ReadMore/index.js +1 -0
- package/components/TS_Slider/TS_Slider.d.ts +26 -0
- package/components/TS_Slider/TS_Slider.js +42 -0
- package/components/TS_Slider/TS_Slider.scss +68 -0
- package/components/TS_Slider/index.d.ts +1 -0
- package/components/TS_Slider/index.js +1 -0
- package/components/TS_Space/TS_Space.d.ts +8 -0
- package/components/TS_Space/TS_Space.js +8 -0
- package/components/TS_Space/index.d.ts +1 -0
- package/components/TS_Space/index.js +1 -0
- package/components/TS_Space/ts-space.scss +3 -0
- package/components/TS_Table/TS_Table.d.ts +42 -0
- package/components/TS_Table/TS_Table.js +74 -0
- package/components/TS_Table/TS_Table.scss +51 -0
- package/components/TS_Table/index.d.ts +1 -0
- package/components/TS_Table/index.js +21 -0
- package/components/TS_Tabs/TS_Tabs.d.ts +55 -0
- package/components/TS_Tabs/TS_Tabs.js +102 -0
- package/components/TS_Tabs/TS_Tabs.scss +103 -0
- package/components/TS_Tabs/index.d.ts +1 -0
- package/components/TS_Tabs/index.js +21 -0
- package/components/TS_Toaster/TS_Toast.d.ts +5 -0
- package/components/TS_Toaster/TS_Toast.js +9 -0
- package/components/TS_Toaster/TS_Toast.scss +80 -0
- package/components/TS_Toaster/TS_ToastOverlay.d.ts +16 -0
- package/components/TS_Toaster/TS_ToastOverlay.js +26 -0
- package/components/TS_Toaster/TS_ToastOverlay.scss +33 -0
- package/components/TS_Toaster/index.d.ts +2 -0
- package/components/TS_Toaster/index.js +22 -0
- package/components/TS_Toggle/ATS_Toggle.d.ts +11 -0
- package/components/TS_Toggle/ATS_Toggle.js +18 -0
- package/components/TS_Toggle/TS_Toggle.d.ts +21 -0
- package/components/TS_Toggle/TS_Toggle.js +26 -0
- package/components/TS_Toggle/TS_Toggle.scss +56 -0
- package/components/TS_Toggle/index.d.ts +2 -0
- package/components/TS_Toggle/index.js +2 -0
- package/components/TS_Toggler/TS_Toggler.d.ts +23 -0
- package/components/TS_Toggler/TS_Toggler.js +50 -0
- package/components/TS_Toggler/TS_Toggler.scss +83 -0
- package/components/TS_Toggler/index.d.ts +1 -0
- package/components/TS_Toggler/index.js +1 -0
- package/components/TS_Tree/SimpleTreeNodeRenderer.d.ts +9 -0
- package/components/TS_Tree/SimpleTreeNodeRenderer.js +53 -0
- package/components/TS_Tree/TS_Tree.d.ts +68 -0
- package/components/TS_Tree/TS_Tree.js +174 -0
- package/components/TS_Tree/TS_Tree.scss +44 -0
- package/components/TS_Tree/index.d.ts +3 -0
- package/components/TS_Tree/index.js +23 -0
- package/components/TS_Tree/types.d.ts +4 -0
- package/components/TS_Tree/types.js +21 -0
- package/components/TS_V2_Input/TS_InputV2.d.ts +93 -0
- package/components/TS_V2_Input/TS_InputV2.js +220 -0
- package/components/TS_V2_Input/index.d.ts +1 -0
- package/components/TS_V2_Input/index.js +21 -0
- package/components/TS_V2_TextArea/TS_BaseInput.d.ts +42 -0
- package/components/TS_V2_TextArea/TS_BaseInput.js +46 -0
- package/components/TS_V2_TextArea/TS_TextAreaV2.d.ts +78 -0
- package/components/TS_V2_TextArea/TS_TextAreaV2.js +178 -0
- package/components/TS_V2_TextArea/TS_TextAreaV2.scss +49 -0
- package/components/TS_V2_TextArea/index.d.ts +2 -0
- package/components/TS_V2_TextArea/index.js +22 -0
- package/components/TS_VirtualizedList/TS_VirtualizedList.d.ts +14 -0
- package/components/TS_VirtualizedList/TS_VirtualizedList.js +22 -0
- package/components/TS_VirtualizedList/index.d.ts +1 -0
- package/components/TS_VirtualizedList/index.js +1 -0
- package/components/Video/Video.d.ts +16 -0
- package/components/Video/Video.js +40 -0
- package/components/Video/VideoDialog.d.ts +20 -0
- package/components/Video/VideoDialog.js +44 -0
- package/components/Video/VideoDialog.scss +31 -0
- package/components/Video/types.d.ts +20 -0
- package/components/Video/types.js +1 -0
- package/components/_TS_MultiSelect/DBItemDropDownMultiSelector.d.ts +57 -0
- package/components/_TS_MultiSelect/DBItemDropDownMultiSelector.js +63 -0
- package/components/adapter/Adapter.d.ts +139 -0
- package/components/adapter/Adapter.js +259 -0
- package/components/adapter/BaseRenderer.d.ts +24 -0
- package/components/adapter/BaseRenderer.js +31 -0
- package/components/ats-group.d.ts +2 -0
- package/components/ats-group.js +14 -0
- package/components/form/Form.d.ts +24 -0
- package/components/form/Form.js +34 -0
- package/components/form/types.d.ts +23 -0
- package/components/form/types.js +21 -0
- package/components/formv3/FormV3.d.ts +25 -0
- package/components/formv3/FormV3.js +23 -0
- package/components/formv3/types.d.ts +29 -0
- package/components/formv3/types.js +1 -0
- package/components/treeicons.d.ts +10 -0
- package/components/treeicons.js +3 -0
- package/components/types.d.ts +23 -0
- package/components/types.js +22 -0
- package/components/utils.d.ts +1 -0
- package/components/utils.js +7 -0
- package/consts.d.ts +2 -0
- package/consts.js +2 -0
- package/core/AppPage.d.ts +11 -0
- package/core/AppPage.js +52 -0
- package/core/AppPageV2.d.ts +9 -0
- package/core/AppPageV2.js +53 -0
- package/core/AppWrapper.d.ts +4 -0
- package/core/AppWrapper.js +34 -0
- package/core/ComponentAsync.d.ts +16 -0
- package/core/ComponentAsync.js +64 -0
- package/core/ComponentBase.d.ts +28 -0
- package/core/ComponentBase.js +152 -0
- package/core/ComponentSync.d.ts +13 -0
- package/core/ComponentSync.js +49 -0
- package/core/Controller.d.ts +13 -0
- package/core/Controller.js +28 -0
- package/core/IndexedDB.d.ts +42 -0
- package/core/IndexedDB.js +259 -0
- package/core/IndexedDBV3.d.ts +43 -0
- package/core/IndexedDBV3.js +259 -0
- package/core/IndexedDBV4/IndexedDB_Database.d.ts +20 -0
- package/core/IndexedDBV4/IndexedDB_Database.js +268 -0
- package/core/IndexedDBV4/IndexedDB_Store.d.ts +34 -0
- package/core/IndexedDBV4/IndexedDB_Store.js +207 -0
- package/core/IndexedDBV4/ModuleFE_IDBManager.d.ts +11 -0
- package/core/IndexedDBV4/ModuleFE_IDBManager.js +19 -0
- package/core/IndexedDBV4/types.d.ts +16 -0
- package/core/IndexedDBV4/types.js +1 -0
- package/core/SimpleScriptInjector.d.ts +13 -0
- package/core/SimpleScriptInjector.js +42 -0
- package/core/Thunder.d.ts +37 -0
- package/core/Thunder.js +139 -0
- package/core/ThunderstormDefaultApp.d.ts +12 -0
- package/core/ThunderstormDefaultApp.js +29 -0
- package/core/consts.d.ts +6 -0
- package/core/consts.js +2 -0
- package/core/db-api-gen/consts.d.ts +22 -0
- package/core/db-api-gen/consts.js +25 -0
- package/core/db-api-gen/db-def.d.ts +9 -0
- package/core/db-api-gen/db-def.js +16 -0
- package/core/db-api-gen/types.d.ts +23 -0
- package/core/db-api-gen/types.js +3 -0
- package/core/proto-component/ProtoComponent.d.ts +57 -0
- package/core/proto-component/ProtoComponent.js +73 -0
- package/core/proto-component/UrlState.d.ts +42 -0
- package/core/proto-component/UrlState.js +59 -0
- package/core/proto-component/index.d.ts +2 -0
- package/core/proto-component/index.js +2 -0
- package/core/proto-component/types.d.ts +25 -0
- package/core/proto-component/types.js +15 -0
- package/core/thunder-dispatcher.d.ts +13 -0
- package/core/thunder-dispatcher.js +69 -0
- package/core/thunder-helpers.d.ts +7 -0
- package/core/thunder-helpers.js +171 -0
- package/core/thunder-modulepack.d.ts +3 -0
- package/core/thunder-modulepack.js +34 -0
- package/core/typed-api.d.ts +6 -0
- package/core/typed-api.js +41 -0
- package/core/types.d.ts +6 -0
- package/core/types.js +1 -0
- package/editable-item.d.ts +7 -0
- package/editable-item.js +7 -0
- package/index.d.ts +112 -0
- package/index.js +134 -0
- package/modules/ModuleFE_BaseTheme.d.ts +18 -0
- package/modules/ModuleFE_BaseTheme.js +27 -0
- package/modules/ModuleFE_BroadcastChannel/ModuleFE_BroadcastChannel.d.ts +20 -0
- package/modules/ModuleFE_BroadcastChannel/ModuleFE_BroadcastChannel.js +66 -0
- package/modules/ModuleFE_BrowserHistory.d.ts +46 -0
- package/modules/ModuleFE_BrowserHistory.js +165 -0
- package/modules/ModuleFE_BrowserHistoryV2.d.ts +43 -0
- package/modules/ModuleFE_BrowserHistoryV2.js +113 -0
- package/modules/ModuleFE_CSVParser.d.ts +12 -0
- package/modules/ModuleFE_CSVParser.js +52 -0
- package/modules/ModuleFE_CollectionActions.d.ts +10 -0
- package/modules/ModuleFE_CollectionActions.js +18 -0
- package/modules/ModuleFE_ConnectivityModule.d.ts +15 -0
- package/modules/ModuleFE_ConnectivityModule.js +31 -0
- package/modules/ModuleFE_ForceUpgrade.d.ts +20 -0
- package/modules/ModuleFE_ForceUpgrade.js +54 -0
- package/modules/ModuleFE_LocalStorage.d.ts +46 -0
- package/modules/ModuleFE_LocalStorage.js +179 -0
- package/modules/ModuleFE_Locale.d.ts +44 -0
- package/modules/ModuleFE_Locale.js +83 -0
- package/modules/ModuleFE_Print.d.ts +16 -0
- package/modules/ModuleFE_Print.js +116 -0
- package/modules/ModuleFE_StorageCleaner.d.ts +17 -0
- package/modules/ModuleFE_StorageCleaner.js +90 -0
- package/modules/ModuleFE_Thunderstorm.d.ts +31 -0
- package/modules/ModuleFE_Thunderstorm.js +122 -0
- package/modules/ModuleFE_Utils/ModuleFE_Utils.d.ts +29 -0
- package/modules/ModuleFE_Utils/ModuleFE_Utils.js +43 -0
- package/modules/ModuleFE_Window.d.ts +19 -0
- package/modules/ModuleFE_Window.js +42 -0
- package/modules/ModuleFE_WindowMessenger.d.ts +62 -0
- package/modules/ModuleFE_WindowMessenger.js +128 -0
- package/modules/action-processor/ModuleFE_ActionProcessor.d.ts +9 -0
- package/modules/action-processor/ModuleFE_ActionProcessor.js +14 -0
- package/modules/archiving/ModuleFE_Archiving.d.ts +8 -0
- package/modules/archiving/ModuleFE_Archiving.js +15 -0
- package/modules/clearWebsiteDataDispatcher.d.ts +5 -0
- package/modules/clearWebsiteDataDispatcher.js +2 -0
- package/modules/component-loader/ReactEntryComponentInjector.d.ts +23 -0
- package/modules/component-loader/ReactEntryComponentInjector.js +59 -0
- package/modules/component-loader/entry-component-loading-module.d.ts +7 -0
- package/modules/component-loader/entry-component-loading-module.js +52 -0
- package/modules/component-loader/index.d.ts +2 -0
- package/modules/component-loader/index.js +2 -0
- package/modules/db-api-gen/ModuleFE_BaseApi.d.ts +45 -0
- package/modules/db-api-gen/ModuleFE_BaseApi.js +152 -0
- package/modules/db-api-gen/ModuleFE_BaseDB.d.ts +146 -0
- package/modules/db-api-gen/ModuleFE_BaseDB.js +433 -0
- package/modules/db-api-gen/types.d.ts +13 -0
- package/modules/db-api-gen/types.js +6 -0
- package/modules/http/ModuleFE_XHR.d.ts +20 -0
- package/modules/http/ModuleFE_XHR.js +175 -0
- package/modules/routing/LocationChangeListener.d.ts +6 -0
- package/modules/routing/LocationChangeListener.js +15 -0
- package/modules/routing/ModuleFE_Routing.d.ts +30 -0
- package/modules/routing/ModuleFE_Routing.js +122 -0
- package/modules/routing/ModuleFE_RoutingV2.d.ts +25 -0
- package/modules/routing/ModuleFE_RoutingV2.js +143 -0
- package/modules/routing/index.d.ts +5 -0
- package/modules/routing/index.js +5 -0
- package/modules/routing/route.d.ts +22 -0
- package/modules/routing/route.js +83 -0
- package/modules/routing/types.d.ts +20 -0
- package/modules/routing/types.js +1 -0
- package/modules/sync-env/ModuleFE_SyncEnvV2.d.ts +8 -0
- package/modules/sync-env/ModuleFE_SyncEnvV2.js +18 -0
- package/modules/sync-manager/ModuleFE_SyncManager.d.ts +59 -0
- package/modules/sync-manager/ModuleFE_SyncManager.js +378 -0
- package/modules/sync-manager/ModuleFE_SyncManager_CSV.d.ts +11 -0
- package/modules/sync-manager/ModuleFE_SyncManager_CSV.js +121 -0
- package/package.json +107 -0
- package/server-info/Button_VersionUpdate.d.ts +15 -0
- package/server-info/Button_VersionUpdate.js +29 -0
- package/server-info/Button_VersionUpdate.scss +29 -0
- package/server-info/ModuleFE_ServerInfo.d.ts +26 -0
- package/server-info/ModuleFE_ServerInfo.js +73 -0
- package/server-info/index.d.ts +2 -0
- package/server-info/index.js +2 -0
- package/shared.d.ts +1 -0
- package/shared.js +21 -0
- package/styles/declaration/basic.scss +155 -0
- package/styles/declaration/mixins.scss +58 -0
- package/styles/impl/basic.scss +141 -0
- package/styles/impl/icons.scss +34 -0
- package/styles.scss +40 -0
- package/utils/EditableItem.d.ts +240 -0
- package/utils/EditableItem.js +552 -0
- package/utils/console/LogClient_ConsoleInterceptor.d.ts +5 -0
- package/utils/console/LogClient_ConsoleInterceptor.js +70 -0
- package/utils/perform-action/genereteToasts.d.ts +3 -0
- package/utils/perform-action/genereteToasts.js +14 -0
- package/utils/perform-action/index.d.ts +2 -0
- package/utils/perform-action/index.js +2 -0
- package/utils/perform-action/notification-dispatchers.d.ts +6 -0
- package/utils/perform-action/notification-dispatchers.js +2 -0
- package/utils/perform-action/performAction.d.ts +34 -0
- package/utils/perform-action/performAction.js +77 -0
- package/utils/perform-action/resolve-dependency-toast/ResolveDependencyToast.d.ts +8 -0
- package/utils/perform-action/resolve-dependency-toast/ResolveDependencyToast.js +11 -0
- package/utils/perform-action/resolve-dependency-toast/ResolveDependencyToast.scss +12 -0
- package/utils/tools.d.ts +31 -0
- package/utils/tools.js +138 -0
- package/utils/types.d.ts +3 -0
- package/utils/types.js +1 -0
- package/widgets/FieldEditor.d.ts +29 -0
- package/widgets/FieldEditor.js +47 -0
- package/widgets/FieldEditorClick.d.ts +33 -0
- package/widgets/FieldEditorClick.js +49 -0
- package/widgets/FieldEditorWithButtons.d.ts +32 -0
- package/widgets/FieldEditorWithButtons.js +42 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { Logger, LogLevel, md5, sortArray } from '@nu-art/ts-common';
|
|
2
|
+
import { StorageKey } from '../../modules/ModuleFE_LocalStorage.js';
|
|
3
|
+
//@ts-ignore - set IDBAPI as indexedDB regardless of browser
|
|
4
|
+
const IDBAPI = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
5
|
+
export class IndexedDB_Database extends Logger {
|
|
6
|
+
dbName;
|
|
7
|
+
db;
|
|
8
|
+
openPromise;
|
|
9
|
+
registeredStores = [];
|
|
10
|
+
// ######################## Init ########################
|
|
11
|
+
constructor(dbName) {
|
|
12
|
+
super(`IDB_Database-${dbName}`);
|
|
13
|
+
this.setMinLevel(LogLevel.Info);
|
|
14
|
+
this.dbName = dbName;
|
|
15
|
+
}
|
|
16
|
+
// ######################## DB Interaction ########################
|
|
17
|
+
clearDB = async () => {
|
|
18
|
+
const t0 = performance.now?.() ?? Date.now();
|
|
19
|
+
this.logInfo(`[CLEAR] Requested clear for DB="${this.dbName}"`);
|
|
20
|
+
return new Promise(async (resolve, reject) => {
|
|
21
|
+
try {
|
|
22
|
+
//db is closed & not awaiting opening
|
|
23
|
+
if (!this.db && !this.openPromise) {
|
|
24
|
+
this.logDebug(`[CLEAR DB] DB not open and no openPromise pending — nothing to clear`);
|
|
25
|
+
return resolve();
|
|
26
|
+
}
|
|
27
|
+
if (this.openPromise) {
|
|
28
|
+
this.logDebug(`[CLEAR-DB] Awaiting ongoing openPromise before clearing`);
|
|
29
|
+
await this.openPromise;
|
|
30
|
+
}
|
|
31
|
+
const storeNames = Array.from(this.db.objectStoreNames);
|
|
32
|
+
this.logInfo(`[CLEAR-DB] Deleting ${storeNames.length} stores: ${storeNames.join(', ') || '(none)'}`);
|
|
33
|
+
storeNames.forEach(storeName => {
|
|
34
|
+
this.db.deleteObjectStore(storeName);
|
|
35
|
+
});
|
|
36
|
+
this.db.close();
|
|
37
|
+
const dt = (performance.now?.() ?? Date.now()) - t0;
|
|
38
|
+
this.logInfo(`[CLEAR-DB] Completed in ${Math.round(dt)}ms`);
|
|
39
|
+
resolve();
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
this.logErrorBold(`[CLEAR-DB] Failed: ${err}`);
|
|
43
|
+
reject(err);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
// ######################## Store Interaction ########################
|
|
48
|
+
registerStore = (dbConfig, onDBOpenCallback) => {
|
|
49
|
+
const registeredStore = { config: dbConfig, onDBOpenCallback };
|
|
50
|
+
(this.registeredStores || (this.registeredStores = [])).push(registeredStore);
|
|
51
|
+
this.logDebug('[REGISTER-STORE]', `Store: ${dbConfig.name}`, `Group: ${dbConfig.group}`, `Auto Increment: ${!!dbConfig.autoIncrement}`, `Indices: ${dbConfig.indices?.length ?? 0}`);
|
|
52
|
+
};
|
|
53
|
+
async getStore(config, write = false, _store) {
|
|
54
|
+
if (_store)
|
|
55
|
+
return _store;
|
|
56
|
+
try {
|
|
57
|
+
this.logDebug(`[GET-STORE] Request for "${config.name}"`, `write: ${write}`);
|
|
58
|
+
await this.open();
|
|
59
|
+
const tx = this.db.transaction(config.name, write ? 'readwrite' : 'readonly');
|
|
60
|
+
const store = tx.objectStore(config.name);
|
|
61
|
+
this.logVerboseBold(`[GET-STORE] OK "${config.name}"`, `(mode: ${write ? 'rw' : 'ro'})`);
|
|
62
|
+
return store;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
this.logError(`Failed to get store for collection '${config.group}/${config.name}'`);
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
storeExists = async (storeName) => {
|
|
70
|
+
await this.open();
|
|
71
|
+
const exists = this.db.objectStoreNames.contains(storeName);
|
|
72
|
+
this.logDebug(`[STORE-EXISTS] store="${storeName}" => ${exists}`, '');
|
|
73
|
+
return exists;
|
|
74
|
+
};
|
|
75
|
+
async open() {
|
|
76
|
+
if (this.db) {
|
|
77
|
+
this.logDebug(`[OPEN] Already open: returning existing connection`, `DB Name: ${this.db.name}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (this.openPromise) {
|
|
81
|
+
this.logDebug(`[OPEN] Re-entrant call — awaiting existing openPromise`, `DB Name: ${this.dbName}`);
|
|
82
|
+
return this.openPromise;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
return await this.open_Impl();
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
if (err instanceof DOMException && err.name === 'VersionError') {
|
|
89
|
+
return this.open_Impl(true);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
throw new Error(`Error opening IDB - ${this.dbName}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
open_Impl = (ignoreCurrentVersion = false) => {
|
|
97
|
+
const start = performance.now?.() ?? Date.now();
|
|
98
|
+
const openId = Math.random().toString(36).slice(2, 8); // useful when correlating logs
|
|
99
|
+
this.logInfo(`[OPEN: ${openId}] - Starting open`, '');
|
|
100
|
+
return this.openPromise = new Promise((resolve, reject) => {
|
|
101
|
+
if (!IDBAPI) {
|
|
102
|
+
this.logErrorBold(`[OPEN:${openId}] Error — current browser does not support IndexedDB`);
|
|
103
|
+
delete this.openPromise;
|
|
104
|
+
return reject(new Error('Error - current browser does not support IndexedDB'));
|
|
105
|
+
}
|
|
106
|
+
let nextVersion;
|
|
107
|
+
if (!ignoreCurrentVersion) {
|
|
108
|
+
const nextVersion = this.getNextVersionData();
|
|
109
|
+
const currentVersionData = this.getCurrentVersionData();
|
|
110
|
+
this.logDebug(`[OPEN: ${openId}] Attempting open DB: "${this.dbName}"`, `currentVersion: ${currentVersionData?.version ?? 0}, nextVersion: ${nextVersion.version},`, `currentHash: ${currentVersionData?.hash ?? '-'}, nextHash: ${nextVersion.hash}`);
|
|
111
|
+
}
|
|
112
|
+
const request = IDBAPI.open(this.dbName, nextVersion?.version);
|
|
113
|
+
request.onblocked = (e) => {
|
|
114
|
+
this.logWarningBold(`[OPEN:${openId}] onblocked — Another tab/process holds the old version open`, e);
|
|
115
|
+
};
|
|
116
|
+
request.onupgradeneeded = async () => {
|
|
117
|
+
const upStart = performance.now?.() ?? Date.now();
|
|
118
|
+
this.logInfo(`[OPEN:${openId}] onupgradeneeded`, `Current Version: ${this.getCurrentVersionData()?.version ?? 0}`, `Next Version: ${nextVersion?.version ?? 'N/A'}`);
|
|
119
|
+
const db = request.result;
|
|
120
|
+
const duplicatedStores = new Set();
|
|
121
|
+
try {
|
|
122
|
+
this.registeredStores.forEach(registeredStore => {
|
|
123
|
+
//Don't create a store that already exists
|
|
124
|
+
if (db.objectStoreNames.contains(registeredStore.config.name)) {
|
|
125
|
+
this.logVerboseBold(`[OPEN:${openId}] Store already exists!`, `Store Name: ${registeredStore.config.name}`);
|
|
126
|
+
return duplicatedStores.add(registeredStore.config.name);
|
|
127
|
+
}
|
|
128
|
+
const options = {
|
|
129
|
+
autoIncrement: registeredStore.config.autoIncrement,
|
|
130
|
+
keyPath: registeredStore.config.uniqueKeys
|
|
131
|
+
};
|
|
132
|
+
const store = db.createObjectStore(registeredStore.config.name, options);
|
|
133
|
+
this.logDebug(`[OPEN:${openId}] Created store`, `Store Name: ${registeredStore.config.name}`, `KeyPath: ${JSON.stringify(options.keyPath)}`, `AutoIncrement: ${!!options.autoIncrement}`);
|
|
134
|
+
registeredStore.config.indices?.forEach(index => {
|
|
135
|
+
store.createIndex(index.id, index.keys, {
|
|
136
|
+
multiEntry: index.params?.multiEntry,
|
|
137
|
+
unique: index.params?.unique
|
|
138
|
+
});
|
|
139
|
+
this.logDebug(`[OPEN:${openId}] Index`, `IndexID: ${index.id}`, `Keys: ${JSON.stringify(index.keys)}`, `Unique: ${!!index.params?.unique}`, `Multi: ${!!index.params?.multiEntry}`);
|
|
140
|
+
});
|
|
141
|
+
try {
|
|
142
|
+
registeredStore.config.upgradeProcessor?.(store);
|
|
143
|
+
if (registeredStore.config.upgradeProcessor)
|
|
144
|
+
this.logDebug(`[OPEN:${openId}] UpgradeProcessor Executed for`, `Store Name: ${registeredStore.config.name}`);
|
|
145
|
+
}
|
|
146
|
+
catch (upgradeErr) {
|
|
147
|
+
this.logErrorBold(`[OPEN:${openId}] UpgradeProcessor Failed for`, `Store Name: ${registeredStore.config.name}`, `Error: ${JSON.stringify(upgradeErr)}`);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
this.setCurrentVersionData({ version: db.version, hash: this.generateVersionHash() });
|
|
151
|
+
if (duplicatedStores.size)
|
|
152
|
+
this.logWarningBold(`[OPEN:${openId}] Duplicate store registrations detected`, ...Array.from(duplicatedStores));
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
this.logErrorBold(`[OPEN:${openId}] onupgradeneeded failed`, e);
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
const upDt = (performance.now?.() ?? Date.now()) - upStart;
|
|
159
|
+
this.logInfo(`[OPEN:${openId}] onupgradeneeded completed in ${Math.round(upDt)}ms`);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
request.onsuccess = async () => {
|
|
163
|
+
const tConn = (performance.now?.() ?? Date.now()) - start;
|
|
164
|
+
try {
|
|
165
|
+
const storesLength = request.result.objectStoreNames.length;
|
|
166
|
+
this.logInfo(`[OPEN:${openId}] OnSuccess — Opened`, `dbName: ${this.dbName}`, `Store Amount: ${storesLength}`, `Completion Time: ${Math.round(tConn)}ms`);
|
|
167
|
+
this.db = request.result;
|
|
168
|
+
// Defensive: log connection lifecycle events
|
|
169
|
+
this.db.onversionchange = (ev) => {
|
|
170
|
+
this.logWarningBold(`[OPEN:${openId}] db.onversionchange fired — closing connection`, ev);
|
|
171
|
+
try {
|
|
172
|
+
this.db.close();
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
this.db.onclose = () => this.logInfo(`[OPEN:${openId}] db.onclose`);
|
|
178
|
+
this.db.onerror = (ev) => this.logErrorBold(`[OPEN:${openId}] db.onerror`, ev);
|
|
179
|
+
// Run open callbacks with full timing & error capture
|
|
180
|
+
await this.onDBOpen(openId);
|
|
181
|
+
resolve(this);
|
|
182
|
+
delete this.openPromise;
|
|
183
|
+
// Persist version (again) to ensure it’s set even if there was no upgrade
|
|
184
|
+
this.setCurrentVersionData({ version: this.db.version, hash: this.generateVersionHash() });
|
|
185
|
+
this.logDebug(`[OPEN:${openId}] Completed open()`, '');
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
this.logErrorBold(`[OPEN:${openId}] Failure during onDBOpen(): ${err}`);
|
|
189
|
+
delete this.openPromise;
|
|
190
|
+
reject(err);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
request.onerror = (e) => {
|
|
194
|
+
this.logErrorBold(`[OPEN:${openId}] request.onerror — failed to open DB "${this.dbName}"`, e);
|
|
195
|
+
delete this.openPromise;
|
|
196
|
+
reject(request.error);
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
onDBOpen = async (openId) => {
|
|
201
|
+
const tag = openId ? `OPEN:${openId}` : `OPEN`;
|
|
202
|
+
const allStart = performance.now?.() ?? Date.now();
|
|
203
|
+
if (!this.registeredStores?.length) {
|
|
204
|
+
this.logDebug(`[${tag}] onDBOpen`, 'No registered stores — nothing to notify');
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this.logInfo(`[${tag}] onDBOpen`, `Invoking ${this.registeredStores.length} store callbacks`);
|
|
208
|
+
for (const store of this.registeredStores) {
|
|
209
|
+
const name = store.config?.name ?? '(unknown-store)';
|
|
210
|
+
if (!store.onDBOpenCallback) {
|
|
211
|
+
this.logDebug(`[${tag}] onDBOpen: Store "${name}" has no callback`, '');
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const cbStart = performance.now?.() ?? Date.now();
|
|
215
|
+
let returned;
|
|
216
|
+
let isAsync = false;
|
|
217
|
+
try {
|
|
218
|
+
returned = store.onDBOpenCallback();
|
|
219
|
+
isAsync = !!returned && typeof returned.then === 'function';
|
|
220
|
+
this.logDebug(`[${tag}] onDBOpen: "${name}" Callback Invoked`, `Async: ${isAsync}`);
|
|
221
|
+
// Always await to preserve ordering
|
|
222
|
+
await returned;
|
|
223
|
+
const cbDt = (performance.now?.() ?? Date.now()) - cbStart;
|
|
224
|
+
this.logVerboseBold(`[${tag}] onDBOpen: "${name}" Callback Completed`, `Completion Time: ${Math.round(cbDt)}ms`);
|
|
225
|
+
}
|
|
226
|
+
catch (err) {
|
|
227
|
+
const cbDt = (performance.now?.() ?? Date.now()) - cbStart;
|
|
228
|
+
this.logErrorBold(`[${tag}] onDBOpen: "${name}" Callback FAILED`, `Elapsed Time: ${Math.round(cbDt)}ms`, err);
|
|
229
|
+
throw err;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const allDt = (performance.now?.() ?? Date.now()) - allStart;
|
|
233
|
+
this.logInfo(`[${tag}] onDBOpen: All callbacks completed`, `Completion Time: ${Math.round(allDt)}ms`);
|
|
234
|
+
};
|
|
235
|
+
// ######################## Version Control ########################
|
|
236
|
+
getCurrentVersionData = () => {
|
|
237
|
+
const storage = new StorageKey(`idb-version-data__${this.dbName}`);
|
|
238
|
+
const data = storage.get();
|
|
239
|
+
this.logDebug(`[VERSION] getCurrentVersionData => v=${data?.version ?? '-'}`, `Hash: ${data?.hash ?? '-'}`);
|
|
240
|
+
return data;
|
|
241
|
+
};
|
|
242
|
+
setCurrentVersionData = (versionData) => {
|
|
243
|
+
const storage = new StorageKey(`idb-version-data__${this.dbName}`);
|
|
244
|
+
storage.set(versionData);
|
|
245
|
+
this.logDebug(`[VERSION] setCurrentVersionData => v=${versionData.version}`, `Hash: ${versionData.hash}`);
|
|
246
|
+
return versionData;
|
|
247
|
+
};
|
|
248
|
+
generateVersionHash = () => {
|
|
249
|
+
const stores = sortArray(this.registeredStores, i => i.config.name);
|
|
250
|
+
const hash = md5(stores.map(i => i.config.name).join(','));
|
|
251
|
+
this.logDebug(`[VER] generateVersionHash => ${hash} from [${stores.map(s => s.config.name).join(', ')}]`, '');
|
|
252
|
+
return hash;
|
|
253
|
+
};
|
|
254
|
+
getNextVersionData = () => {
|
|
255
|
+
const currentVersionData = this.getCurrentVersionData();
|
|
256
|
+
const hash = this.generateVersionHash();
|
|
257
|
+
if (hash === currentVersionData?.hash) {
|
|
258
|
+
this.logDebug(`[VER] Hash unchanged — keeping version ${currentVersionData.version}`, '');
|
|
259
|
+
return currentVersionData;
|
|
260
|
+
}
|
|
261
|
+
const next = {
|
|
262
|
+
version: ((currentVersionData?.version ?? 0) + 1),
|
|
263
|
+
hash
|
|
264
|
+
};
|
|
265
|
+
this.logInfo(`[VER] Hash changed — bumping version to ${next.version}`, '');
|
|
266
|
+
return next;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DBProto, IndexKeys, Logger } from '@nu-art/ts-common';
|
|
2
|
+
import { DBConfigV3, IndexDb_Query_V3, ReduceFunction_V3 } from './types.js';
|
|
3
|
+
type StoreResolver<Proto extends DBProto<any>> = (dbConfig: DBConfigV3<Proto>, write?: boolean, store?: IDBObjectStore) => Promise<IDBObjectStore>;
|
|
4
|
+
type StoreExistsResolver<Proto extends DBProto<any>> = (dbConfig: DBConfigV3<Proto>) => Promise<boolean>;
|
|
5
|
+
export declare class IndexedDB_Store<Proto extends DBProto<any>> extends Logger {
|
|
6
|
+
private config;
|
|
7
|
+
private storeResolver;
|
|
8
|
+
private storeExistsResolver;
|
|
9
|
+
constructor(config: DBConfigV3<Proto>, storeResolver: StoreResolver<Proto>, storeExistsResolver: StoreExistsResolver<Proto>);
|
|
10
|
+
getStore: (write?: boolean, store?: IDBObjectStore) => Promise<IDBObjectStore>;
|
|
11
|
+
exists: () => Promise<boolean>;
|
|
12
|
+
count: () => Promise<number>;
|
|
13
|
+
private getCursor;
|
|
14
|
+
private cursorHandler;
|
|
15
|
+
insert(value: Proto['dbType'], _store?: IDBObjectStore): Promise<Proto['dbType']>;
|
|
16
|
+
insertAll(values: Proto['dbType'][], _store?: IDBObjectStore): Promise<void>;
|
|
17
|
+
upsert(value: Proto['dbType'], _store?: IDBObjectStore): Promise<Proto['dbType']>;
|
|
18
|
+
upsertAll(values: Proto['dbType'][], _store?: IDBObjectStore): Promise<void>;
|
|
19
|
+
get(key: IndexKeys<Proto['dbType'], keyof Proto['dbType']>): Promise<Proto['dbType'] | undefined>;
|
|
20
|
+
query(query: IndexDb_Query_V3): Promise<Proto['dbType'][] | undefined>;
|
|
21
|
+
queryFilter(filter: (item: Proto['dbType']) => boolean, query?: IndexDb_Query_V3): Promise<Proto['dbType'][]>;
|
|
22
|
+
WIP_queryMapNew<Type>(mapper: (item: Proto['dbType']) => Type, filter?: (item: Proto['dbType']) => boolean, query?: IndexDb_Query_V3): Promise<Type[]>;
|
|
23
|
+
WIP_queryMap<Type>(mapper: (item: Proto['dbType']) => Type, filter?: (item: Proto['dbType']) => boolean, query?: IndexDb_Query_V3): Promise<Type[]>;
|
|
24
|
+
queryFind(filter: (item: Proto['dbType']) => boolean): Promise<Proto['dbType'] | undefined>;
|
|
25
|
+
queryReduce<ReturnType>(reducer: ReduceFunction_V3<Proto['dbType'], ReturnType>, initialValue: ReturnType, filter?: (item: Proto['dbType']) => boolean, query?: IndexDb_Query_V3): Promise<ReturnType>;
|
|
26
|
+
clearStore(): Promise<void>;
|
|
27
|
+
deleteAll(keys: (IndexKeys<Proto['dbType'], keyof Proto['dbType']> | Proto['dbType'])[]): Promise<Proto['dbType'][]>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete by the uniqueKey of this collection - usually _id.
|
|
30
|
+
* Pass the _id of the item to delete.
|
|
31
|
+
*/
|
|
32
|
+
delete(key: (IndexKeys<Proto['dbType'], keyof Proto['dbType']> | Proto['dbType'])): Promise<Proto['dbType']>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { Logger, MUSTNeverHappenException } from '@nu-art/ts-common';
|
|
2
|
+
export class IndexedDB_Store extends Logger {
|
|
3
|
+
config;
|
|
4
|
+
storeResolver;
|
|
5
|
+
storeExistsResolver;
|
|
6
|
+
// ######################## Init ########################
|
|
7
|
+
constructor(config, storeResolver, storeExistsResolver) {
|
|
8
|
+
super(`IDB_Store-${config.group}`);
|
|
9
|
+
this.storeResolver = storeResolver;
|
|
10
|
+
this.storeExistsResolver = storeExistsResolver;
|
|
11
|
+
this.config = {
|
|
12
|
+
...config,
|
|
13
|
+
autoIncrement: config.autoIncrement || false,
|
|
14
|
+
version: config.version
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// ######################## DB Interaction ########################
|
|
18
|
+
getStore = async (write = false, store) => this.storeResolver(this.config, write, store);
|
|
19
|
+
exists = async () => this.storeExistsResolver(this.config);
|
|
20
|
+
count = async () => {
|
|
21
|
+
const store = await this.getStore();
|
|
22
|
+
return await new Promise((resolve, reject) => {
|
|
23
|
+
const countRequest = store.count();
|
|
24
|
+
countRequest.onsuccess = () => {
|
|
25
|
+
resolve(countRequest.result);
|
|
26
|
+
};
|
|
27
|
+
countRequest.onerror = () => {
|
|
28
|
+
this.logError(`Failed getting count of idb store ${this.config.name}`);
|
|
29
|
+
resolve(-1);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
// ######################## Cursor Interaction ########################
|
|
34
|
+
getCursor = async (query) => {
|
|
35
|
+
const store = await this.getStore();
|
|
36
|
+
let cursorRequest;
|
|
37
|
+
if (query?.indexKey) {
|
|
38
|
+
const idbIndex = store.index(query.indexKey);
|
|
39
|
+
if (!idbIndex)
|
|
40
|
+
throw new MUSTNeverHappenException('Could not find index for the given indexKey');
|
|
41
|
+
cursorRequest = idbIndex.openCursor();
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
cursorRequest = store.openCursor();
|
|
45
|
+
return cursorRequest;
|
|
46
|
+
};
|
|
47
|
+
cursorHandler = (cursorRequest, perValueCallback, endCallback, limiterCallback) => {
|
|
48
|
+
cursorRequest.onsuccess = (event) => {
|
|
49
|
+
const cursor = event.target.result;
|
|
50
|
+
//If reached the end or reached limit, call endCallback
|
|
51
|
+
if (!cursor || limiterCallback?.())
|
|
52
|
+
return endCallback();
|
|
53
|
+
//run value through the value callback
|
|
54
|
+
perValueCallback(cursor.value);
|
|
55
|
+
//Continue to next value
|
|
56
|
+
cursor.continue();
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
// ######################### Data insertion functions #########################
|
|
60
|
+
async insert(value, _store) {
|
|
61
|
+
const store = await this.getStore(true, _store);
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
const request = store.add(value);
|
|
64
|
+
request.onerror = () => reject(new Error(`Error inserting item in DB - ${this.config.name}`));
|
|
65
|
+
request.onsuccess = () => resolve(request.result);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async insertAll(values, _store) {
|
|
69
|
+
const store = await this.getStore(true, _store);
|
|
70
|
+
for (const value of values) {
|
|
71
|
+
await this.insert(value, store);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async upsert(value, _store) {
|
|
75
|
+
const store = await this.getStore(true, _store);
|
|
76
|
+
try {
|
|
77
|
+
const request = store.put(value);
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
request.onerror = () => reject(new Error(`Error upserting item in DB - ${this.config.name}`));
|
|
80
|
+
request.onsuccess = () => resolve(request.result);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
this.logError('trying to upsert: ', value);
|
|
85
|
+
throw e;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async upsertAll(values, _store) {
|
|
89
|
+
const store = await this.getStore(true, _store);
|
|
90
|
+
for (const value of values) {
|
|
91
|
+
await this.upsert(value, store);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// ######################### Data collection functions #########################
|
|
95
|
+
async get(key) {
|
|
96
|
+
const map = this.config.uniqueKeys.map(k => key[k]);
|
|
97
|
+
const request = (await this.getStore()).get(map);
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
request.onerror = () => reject(new Error(`Error getting item from DB - ${this.config.name}`));
|
|
100
|
+
request.onsuccess = () => resolve(request.result);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async query(query) {
|
|
104
|
+
const store = await this.getStore();
|
|
105
|
+
return new Promise((resolve, reject) => {
|
|
106
|
+
let request;
|
|
107
|
+
if (query.indexKey)
|
|
108
|
+
request = store.index(query.indexKey).getAll(query.query, query.limit);
|
|
109
|
+
else
|
|
110
|
+
request = store.getAll(query.query, query.limit);
|
|
111
|
+
request.onsuccess = () => {
|
|
112
|
+
resolve(request.result);
|
|
113
|
+
};
|
|
114
|
+
request.onerror = () => {
|
|
115
|
+
reject(new Error(`Error querying DB - ${this.config.name}`));
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async queryFilter(filter, query) {
|
|
120
|
+
const limit = query?.limit || 0;
|
|
121
|
+
const cursorRequest = await this.getCursor(query);
|
|
122
|
+
const matches = [];
|
|
123
|
+
return new Promise((resolve, reject) => {
|
|
124
|
+
this.cursorHandler(cursorRequest, (value) => {
|
|
125
|
+
if (filter(value))
|
|
126
|
+
matches.push(value);
|
|
127
|
+
}, () => resolve(matches), () => limit > 0 && matches.length >= limit);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async WIP_queryMapNew(mapper, filter, query) {
|
|
131
|
+
const limit = query?.limit || 0;
|
|
132
|
+
const cursorRequest = await this.getCursor(query);
|
|
133
|
+
const matches = [];
|
|
134
|
+
return new Promise((resolve, reject) => {
|
|
135
|
+
this.cursorHandler(cursorRequest, (item) => {
|
|
136
|
+
if (filter ? filter(item) : true)
|
|
137
|
+
matches.push(mapper(item));
|
|
138
|
+
}, () => resolve(matches), () => limit > 0 && matches.length >= limit);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async WIP_queryMap(mapper, filter, query) {
|
|
142
|
+
const limit = query?.limit || 0;
|
|
143
|
+
const cursorRequest = await this.getCursor(query);
|
|
144
|
+
const matches = [];
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
this.cursorHandler(cursorRequest, (item) => {
|
|
147
|
+
if (filter ? filter(item) : true)
|
|
148
|
+
matches.push(mapper(item));
|
|
149
|
+
}, () => resolve(matches), () => limit > 0 && matches.length >= limit);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async queryFind(filter) {
|
|
153
|
+
let match = undefined;
|
|
154
|
+
const cursorRequest = await this.getCursor();
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
this.cursorHandler(cursorRequest, (value) => {
|
|
157
|
+
if (filter(value))
|
|
158
|
+
match = value;
|
|
159
|
+
}, () => resolve(match), () => !!match);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async queryReduce(reducer, initialValue, filter, query) {
|
|
163
|
+
let acc = initialValue;
|
|
164
|
+
const alwaysTrue = () => true;
|
|
165
|
+
const _filter = filter || alwaysTrue;
|
|
166
|
+
const matches = await this.queryFilter(_filter, query);
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
|
+
matches.forEach((item, index) => acc = reducer(acc, item, index, matches));
|
|
169
|
+
resolve(acc);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
// ######################### Data deletion functions #########################
|
|
173
|
+
async clearStore() {
|
|
174
|
+
if (!(await this.exists()))
|
|
175
|
+
return;
|
|
176
|
+
const store = await this.getStore(true);
|
|
177
|
+
return new Promise((resolve, reject) => {
|
|
178
|
+
const request = store.clear();
|
|
179
|
+
request.onsuccess = () => resolve();
|
|
180
|
+
request.onerror = reject;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
async deleteAll(keys) {
|
|
184
|
+
return await Promise.all(keys.map(key => this.delete(key)));
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Delete by the uniqueKey of this collection - usually _id.
|
|
188
|
+
* Pass the _id of the item to delete.
|
|
189
|
+
*/
|
|
190
|
+
async delete(key) {
|
|
191
|
+
const keys = this.config.uniqueKeys.map(k => key[k]);
|
|
192
|
+
const store = await this.getStore(true);
|
|
193
|
+
return new Promise((resolve, reject) => {
|
|
194
|
+
const itemRequest = store.get(keys);
|
|
195
|
+
itemRequest.onerror = () => reject(new Error(`Error getting item in DB - ${this.config.name}`));
|
|
196
|
+
itemRequest.onsuccess = () => {
|
|
197
|
+
// @ts-ignore
|
|
198
|
+
if (key.__updated !== undefined && itemRequest.result?.__updated > key.__updated) {
|
|
199
|
+
return resolve(itemRequest.result);
|
|
200
|
+
}
|
|
201
|
+
const deleteRequest = store.delete(keys);
|
|
202
|
+
deleteRequest.onerror = () => reject(new Error(`Error deleting item in DB - ${this.config.name}`));
|
|
203
|
+
deleteRequest.onsuccess = () => resolve(itemRequest.result);
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AsyncVoidFunction, DBProto, TypedMap } from '@nu-art/ts-common';
|
|
2
|
+
import { IndexedDB_Database } from './IndexedDB_Database.js';
|
|
3
|
+
import { DBConfigV3 } from './types.js';
|
|
4
|
+
import { IndexedDB_Store } from './IndexedDB_Store.js';
|
|
5
|
+
export declare class ModuleFE_IDBManager_Class {
|
|
6
|
+
databases: TypedMap<IndexedDB_Database>;
|
|
7
|
+
register<Proto extends DBProto<any>>(dbConfig: DBConfigV3<Proto>, onDBOpenCallback: AsyncVoidFunction): IndexedDB_Store<Proto>;
|
|
8
|
+
private storeResolver;
|
|
9
|
+
private storeExistsResolver;
|
|
10
|
+
}
|
|
11
|
+
export declare const ModuleFE_IDBManager: ModuleFE_IDBManager_Class;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IndexedDB_Database } from './IndexedDB_Database.js';
|
|
2
|
+
import { IndexedDB_Store } from './IndexedDB_Store.js';
|
|
3
|
+
export class ModuleFE_IDBManager_Class {
|
|
4
|
+
databases = {};
|
|
5
|
+
register(dbConfig, onDBOpenCallback) {
|
|
6
|
+
const indexDb = this.databases[dbConfig.group] || (this.databases[dbConfig.group] = new IndexedDB_Database(dbConfig.group));
|
|
7
|
+
indexDb.registerStore(dbConfig, onDBOpenCallback);
|
|
8
|
+
return new IndexedDB_Store(dbConfig, this.storeResolver, this.storeExistsResolver);
|
|
9
|
+
}
|
|
10
|
+
storeResolver = async (dbConfig, write = false, store) => {
|
|
11
|
+
const dbWrapper = this.databases[dbConfig.group];
|
|
12
|
+
return dbWrapper.getStore(dbConfig, write, store);
|
|
13
|
+
};
|
|
14
|
+
storeExistsResolver = async (dbConfig) => {
|
|
15
|
+
const dbWrapper = this.databases[dbConfig.group];
|
|
16
|
+
return await dbWrapper.storeExists(dbConfig.name);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export const ModuleFE_IDBManager = new ModuleFE_IDBManager_Class();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DBIndex, DBProto } from '@nu-art/ts-common';
|
|
2
|
+
export type ReduceFunction_V3<ItemType, ReturnType> = (accumulator: ReturnType, arrayItem: ItemType, index?: number, array?: ItemType[]) => ReturnType;
|
|
3
|
+
export type DBConfigV3<Proto extends DBProto<any>> = {
|
|
4
|
+
name: string;
|
|
5
|
+
group: string;
|
|
6
|
+
version: string;
|
|
7
|
+
autoIncrement?: boolean;
|
|
8
|
+
uniqueKeys: (keyof Proto['dbType'])[];
|
|
9
|
+
indices?: DBIndex<Proto['dbType']>[];
|
|
10
|
+
upgradeProcessor?: (store: IDBObjectStore) => void;
|
|
11
|
+
};
|
|
12
|
+
export type IndexDb_Query_V3 = {
|
|
13
|
+
query?: string | number | string[] | number[];
|
|
14
|
+
indexKey?: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
src: string;
|
|
4
|
+
onLoaded: (src: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare class SimpleScriptInjector extends React.Component<Props> {
|
|
7
|
+
static readonly injected: {
|
|
8
|
+
[src: string]: HTMLScriptElement;
|
|
9
|
+
};
|
|
10
|
+
componentDidMount(): void;
|
|
11
|
+
render(): string;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Thunderstorm is a full web app framework!
|
|
3
|
+
*
|
|
4
|
+
* Typescript & Express backend infrastructure that natively runs on firebase function
|
|
5
|
+
* Typescript & React frontend infrastructure
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { _setTimeout } from '@nu-art/ts-common';
|
|
23
|
+
export class SimpleScriptInjector extends React.Component {
|
|
24
|
+
static injected = {};
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
if (SimpleScriptInjector.injected[this.props.src]) {
|
|
27
|
+
_setTimeout(() => this.props.onLoaded(this.props.src));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const script = document.createElement('script');
|
|
31
|
+
script.type = 'text/javascript';
|
|
32
|
+
script.src = this.props.src;
|
|
33
|
+
script.async = true;
|
|
34
|
+
script.id = this.props.src;
|
|
35
|
+
script.onload = () => this.props.onLoaded(this.props.src);
|
|
36
|
+
document.body.appendChild(script);
|
|
37
|
+
SimpleScriptInjector.injected[this.props.src] = script;
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AsyncVoidFunction, ModuleManager } from '@nu-art/ts-common';
|
|
3
|
+
import '../styles/impl/basic.scss';
|
|
4
|
+
import '../styles/impl/icons.scss';
|
|
5
|
+
import { ThunderAppWrapperProps } from './types.js';
|
|
6
|
+
import { StorageKey } from '../modules/ModuleFE_LocalStorage.js';
|
|
7
|
+
export declare const Storage_AppVersion: StorageKey<string>;
|
|
8
|
+
export type ThunderConfig = {
|
|
9
|
+
defaultConfigUrl?: string;
|
|
10
|
+
configUrl: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class Thunder extends ModuleManager {
|
|
13
|
+
private listeners;
|
|
14
|
+
private renderFunc;
|
|
15
|
+
private props;
|
|
16
|
+
private preBuildActions;
|
|
17
|
+
readonly innerConfig: Readonly<ThunderConfig>;
|
|
18
|
+
constructor(config: ThunderConfig);
|
|
19
|
+
static getInstance(): Thunder;
|
|
20
|
+
init(): this;
|
|
21
|
+
private fetchConfig;
|
|
22
|
+
protected addUIListener(listener: any): void;
|
|
23
|
+
protected removeUIListener(listener: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Set up the entry point for the app.
|
|
26
|
+
* @param mainApp - The entry point into the application, what will be rendered directly under root (usually App.tsx)
|
|
27
|
+
* @param props - The props to go with the supplied main app
|
|
28
|
+
* @param renderFunc - The app wrapper, which will usually provide a router. by default is "appWithJSX" which will just return the app
|
|
29
|
+
*/
|
|
30
|
+
setMainApp<P extends {}>(mainApp: React.ElementType<P>, props?: P, renderFunc?: (props: ThunderAppWrapperProps) => React.ReactElement): Thunder;
|
|
31
|
+
build(onStarted?: () => void): void;
|
|
32
|
+
setVersion(version: string): this;
|
|
33
|
+
getConfig(): any;
|
|
34
|
+
addPreBuildAction: (func: AsyncVoidFunction) => this;
|
|
35
|
+
logStuff: () => void;
|
|
36
|
+
getEnvironment(): string;
|
|
37
|
+
}
|