@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,433 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Database API Generator is a utility library for Thunderstorm.
|
|
3
|
+
*
|
|
4
|
+
* Given proper configurations it will dynamically generate APIs to your Firestore
|
|
5
|
+
* collections, will assert uniqueness and restrict deletion... and more
|
|
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 { _keys, arrayToMap, BadImplementationException, dbObjectToId, deleteKeysObject, exists, filterDuplicates, KeysOfDB_Object, lastElement, Logger, LogLevel, Module, sortArray, tsValidateResult, ValidationException, voidFunction } from '@nu-art/ts-common';
|
|
22
|
+
import { composeDbObjectUniqueId } from '@nu-art/firebase-shared';
|
|
23
|
+
import { getModuleFEConfigV3 } from '../../core/db-api-gen/db-def.js';
|
|
24
|
+
import { DataStatus, EventType_Create, EventType_Delete, EventType_DeleteMulti, EventType_Patch, EventType_Query, EventType_Unique, EventType_Update, EventType_UpsertAll, syncDispatcher } from '../../core/db-api-gen/consts.js';
|
|
25
|
+
import { StorageKey } from '../ModuleFE_LocalStorage.js';
|
|
26
|
+
import { ModuleFE_IDBManager } from '../../core/IndexedDBV4/ModuleFE_IDBManager.js';
|
|
27
|
+
export class ModuleFE_BaseDB extends Module {
|
|
28
|
+
validator;
|
|
29
|
+
cache;
|
|
30
|
+
IDB;
|
|
31
|
+
dbDef;
|
|
32
|
+
dataStatus;
|
|
33
|
+
defaultDispatcher;
|
|
34
|
+
syncType;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
ModuleFE_BaseDB = true;
|
|
37
|
+
constructor(dbDef, defaultDispatcher, syncType, customMemCreators) {
|
|
38
|
+
super();
|
|
39
|
+
this.syncType = syncType;
|
|
40
|
+
this.defaultDispatcher = defaultDispatcher;
|
|
41
|
+
const config = getModuleFEConfigV3(dbDef);
|
|
42
|
+
this.validator = config.validator;
|
|
43
|
+
this.dbDef = dbDef;
|
|
44
|
+
//Set Statuses
|
|
45
|
+
this.dataStatus = DataStatus.NoData;
|
|
46
|
+
this.setDefaultConfig(config);
|
|
47
|
+
this.cache = customMemCreators?.memCache ? customMemCreators?.memCache(config, this) : new MemCache(this, config.dbConfig.uniqueKeys);
|
|
48
|
+
this.IDB = customMemCreators?.idbCache
|
|
49
|
+
? customMemCreators?.idbCache(this.config.dbConfig, this.config.key)
|
|
50
|
+
: new IDBCache(this.config.dbConfig, this.config.key);
|
|
51
|
+
this.upgradeInstances.bind(this);
|
|
52
|
+
this.registerVersionUpgradeProcessor.bind(this);
|
|
53
|
+
}
|
|
54
|
+
init() {
|
|
55
|
+
super.init();
|
|
56
|
+
this.IDB.init();
|
|
57
|
+
this.attachOnLastSyncUpdatedListener();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Upgrade processor functionality in the FE module will allow us to validate the items we cache in memory or
|
|
61
|
+
* idb is up-to-date in case the data source is not coming directly from Storm managed backend (like the csv sync manager)
|
|
62
|
+
*/
|
|
63
|
+
/* Private */
|
|
64
|
+
versionUpgrades = {};
|
|
65
|
+
/**
|
|
66
|
+
* Upgrades the entity from the given version to the next one (to the same version if the given version is the latest)
|
|
67
|
+
* @param version - The version we start from
|
|
68
|
+
* @param processor
|
|
69
|
+
*/
|
|
70
|
+
registerVersionUpgradeProcessor(version, processor) {
|
|
71
|
+
this.versionUpgrades[version] = processor;
|
|
72
|
+
}
|
|
73
|
+
/* Public */
|
|
74
|
+
async upgradeInstances(instances, force = false) {
|
|
75
|
+
if (!_keys(this.versionUpgrades).length) {
|
|
76
|
+
this.logVerbose(`No registered upgrade processors for this module ${this.dbDef.dbKey}`);
|
|
77
|
+
return instances;
|
|
78
|
+
}
|
|
79
|
+
//Make sure all items start out with a version
|
|
80
|
+
instances.forEach(instance => {
|
|
81
|
+
if (!instance._v)
|
|
82
|
+
instance._v = lastElement(this.config.versions);
|
|
83
|
+
});
|
|
84
|
+
let instancesToSave = [];
|
|
85
|
+
for (let i = this.config.versions.length - 1; i >= 0; i--) {
|
|
86
|
+
const version = this.config.versions[i];
|
|
87
|
+
const instancesToUpgrade = instances.filter(instance => instance._v === version);
|
|
88
|
+
const nextVersion = this.config.versions[i - 1] ?? version;
|
|
89
|
+
const versionTransition = `${version} => ${nextVersion}`;
|
|
90
|
+
if (instancesToUpgrade.length === 0) {
|
|
91
|
+
this.logVerbose(`No instances to upgrade from ${versionTransition}`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const upgradeProcessor = this.versionUpgrades[version];
|
|
95
|
+
if (!upgradeProcessor) {
|
|
96
|
+
this.logVerbose(`Will not update ${instancesToUpgrade.length} instances of version ${versionTransition}`);
|
|
97
|
+
this.logVerbose(`No upgrade processor for: ${versionTransition}`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.logVerbose(`Upgrade instances(${instancesToUpgrade.length}): ${versionTransition}`);
|
|
101
|
+
await upgradeProcessor?.(instancesToUpgrade);
|
|
102
|
+
instancesToSave.push(...instancesToUpgrade);
|
|
103
|
+
}
|
|
104
|
+
instancesToSave = filterDuplicates(instancesToSave);
|
|
105
|
+
instancesToUpgrade.forEach(instance => instance._v = nextVersion);
|
|
106
|
+
}
|
|
107
|
+
return force ? instances : instancesToSave;
|
|
108
|
+
}
|
|
109
|
+
attachOnLastSyncUpdatedListener = () => {
|
|
110
|
+
this.IDB.onLastUpdateListener(this.onLastSyncUpdatedListener);
|
|
111
|
+
};
|
|
112
|
+
detachOnLastSyncUpdatedListener = () => {
|
|
113
|
+
this.IDB.onLastUpdateListener(voidFunction);
|
|
114
|
+
};
|
|
115
|
+
onLastSyncUpdatedListener = async (after, before) => {
|
|
116
|
+
if (!exists(after) || after === before)
|
|
117
|
+
return;
|
|
118
|
+
await this.cache.load();
|
|
119
|
+
this.defaultDispatcher.dispatchAll('update', {});
|
|
120
|
+
this.OnDataStatusChanged();
|
|
121
|
+
};
|
|
122
|
+
setDataStatus(status) {
|
|
123
|
+
this.logDebug(`Data status updated: ${DataStatus[this.dataStatus]} => ${DataStatus[status]}`);
|
|
124
|
+
if (this.dataStatus === status)
|
|
125
|
+
return;
|
|
126
|
+
this.dataStatus = status;
|
|
127
|
+
this.OnDataStatusChanged();
|
|
128
|
+
}
|
|
129
|
+
OnDataStatusChanged() {
|
|
130
|
+
syncDispatcher.dispatchModule(this);
|
|
131
|
+
syncDispatcher.dispatchUI(this);
|
|
132
|
+
}
|
|
133
|
+
getDataStatus() {
|
|
134
|
+
return this.dataStatus;
|
|
135
|
+
}
|
|
136
|
+
async __onClearWebsiteData() {
|
|
137
|
+
await this.IDB.clear();
|
|
138
|
+
this.setDataStatus(DataStatus.NoData);
|
|
139
|
+
}
|
|
140
|
+
getCollectionName = () => {
|
|
141
|
+
return this.config.dbConfig.name;
|
|
142
|
+
};
|
|
143
|
+
getCollectionKey = () => {
|
|
144
|
+
return this.dbDef.dbKey;
|
|
145
|
+
};
|
|
146
|
+
dispatchSingle = (event, item) => {
|
|
147
|
+
this.defaultDispatcher?.dispatchModule(event, item);
|
|
148
|
+
this.defaultDispatcher?.dispatchUI(event, item);
|
|
149
|
+
};
|
|
150
|
+
dispatchMulti = (event, items) => {
|
|
151
|
+
this.defaultDispatcher?.dispatchModule(event, items);
|
|
152
|
+
this.defaultDispatcher?.dispatchUI(event, items);
|
|
153
|
+
};
|
|
154
|
+
onEntriesDeleted = async (items) => {
|
|
155
|
+
await this.IDB.syncIndexDb([], items);
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
this.cache.onEntriesDeleted(items);
|
|
158
|
+
this.dispatchMulti(EventType_DeleteMulti, items);
|
|
159
|
+
};
|
|
160
|
+
onEntryDeleted = async (item) => {
|
|
161
|
+
await this.IDB.syncIndexDb([], [item]);
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
this.cache.onEntriesDeleted([item]);
|
|
164
|
+
this.dispatchSingle(EventType_Delete, item);
|
|
165
|
+
};
|
|
166
|
+
onEntriesUpdated = async (items, updateIDBLastSynced = true) => {
|
|
167
|
+
items = await this.upgradeInstances(items);
|
|
168
|
+
await this.IDB.syncIndexDb(items);
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
this.cache.onEntriesUpdated(items);
|
|
171
|
+
// update the collection last updated
|
|
172
|
+
const lastUpdated = items.reduce((toRet, current) => Math.max(toRet, current.__updated), 0);
|
|
173
|
+
if ((!this.IDB.getLastSync() && lastUpdated !== 0 || lastUpdated) && updateIDBLastSynced)
|
|
174
|
+
this.IDB.setLastUpdated(lastUpdated);
|
|
175
|
+
this.dispatchMulti(EventType_UpsertAll, items.map(item => item));
|
|
176
|
+
};
|
|
177
|
+
onEntryUpdated = async (item, original, updateIDBLastSynced = true) => {
|
|
178
|
+
item = (await this.upgradeInstances([item]))[0];
|
|
179
|
+
return this.onEntryUpdatedImpl(original._id ? EventType_Update : EventType_Create, item, updateIDBLastSynced);
|
|
180
|
+
};
|
|
181
|
+
onEntryPatched = async (item, updateIDBLastSynced = true) => {
|
|
182
|
+
item = (await this.upgradeInstances([item]))[0];
|
|
183
|
+
return this.onEntryUpdatedImpl(EventType_Patch, item, updateIDBLastSynced);
|
|
184
|
+
};
|
|
185
|
+
validateImpl(_instance) {
|
|
186
|
+
let _generatedProps = this.dbDef.generatedProps;
|
|
187
|
+
if (!_generatedProps) {
|
|
188
|
+
if (typeof this.dbDef.generatedPropsValidator !== 'object')
|
|
189
|
+
throw new BadImplementationException('while using generated props as a function you must provide generated props in db-def explicitly');
|
|
190
|
+
_generatedProps = _keys(this.dbDef.generatedPropsValidator);
|
|
191
|
+
}
|
|
192
|
+
const instance = deleteKeysObject(_instance, [...KeysOfDB_Object, ..._generatedProps]);
|
|
193
|
+
const results = tsValidateResult(instance, this.validator);
|
|
194
|
+
if (results) {
|
|
195
|
+
this.onValidationError(instance, results);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
validateInternal(_instance) {
|
|
199
|
+
this.validateImpl(_instance);
|
|
200
|
+
}
|
|
201
|
+
onValidationError(instance, results) {
|
|
202
|
+
this.logError(`Error validating object:`, instance, 'With Error: ', results);
|
|
203
|
+
throw new ValidationException('Error validating object', instance, results);
|
|
204
|
+
}
|
|
205
|
+
async onEntryUpdatedImpl(event, item, updateIDBLastSynced = true) {
|
|
206
|
+
await this.IDB.syncIndexDb([item]);
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
this.cache.onEntriesUpdated([item]);
|
|
209
|
+
// set last updated if needed
|
|
210
|
+
const lastUpdated = item.__updated;
|
|
211
|
+
if ((!this.IDB.getLastSync() && lastUpdated !== 0 || lastUpdated) && updateIDBLastSynced)
|
|
212
|
+
this.IDB.setLastUpdated(lastUpdated);
|
|
213
|
+
this.dispatchSingle(event, item);
|
|
214
|
+
}
|
|
215
|
+
onGotUnique = async (item) => {
|
|
216
|
+
return this.onEntryUpdatedImpl(EventType_Unique, item);
|
|
217
|
+
};
|
|
218
|
+
onQueryReturned = async (toUpdate, toDelete = []) => {
|
|
219
|
+
toUpdate = await this.upgradeInstances(toUpdate);
|
|
220
|
+
await this.IDB.syncIndexDb(toUpdate, toDelete);
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
this.cache.onEntriesUpdated(toUpdate);
|
|
223
|
+
// @ts-ignore
|
|
224
|
+
this.cache.onEntriesDeleted(toDelete);
|
|
225
|
+
this.dispatchMulti(EventType_Query, toUpdate);
|
|
226
|
+
};
|
|
227
|
+
setCacheFilter = (filter) => {
|
|
228
|
+
this.cache.setCacheFilter(filter);
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
export class IDBCache extends Logger {
|
|
232
|
+
storeWrapper;
|
|
233
|
+
lastSync;
|
|
234
|
+
lastVersion;
|
|
235
|
+
dbConfig;
|
|
236
|
+
constructor(dbConfig, dbKey) {
|
|
237
|
+
super(`indexdb-${dbKey}`);
|
|
238
|
+
this.dbConfig = dbConfig;
|
|
239
|
+
this.setMinLevel(LogLevel.Verbose);
|
|
240
|
+
this.lastSync = new StorageKey('last-sync--' + dbKey);
|
|
241
|
+
this.lastVersion = new StorageKey('last-version--' + dbKey);
|
|
242
|
+
}
|
|
243
|
+
init() {
|
|
244
|
+
const currentVersion = this.dbConfig.version[0];
|
|
245
|
+
const onOpenedCallback = async () => {
|
|
246
|
+
const previousVersion = this.lastVersion.get();
|
|
247
|
+
const exists = await this.storeWrapper.exists();
|
|
248
|
+
if (!exists) {
|
|
249
|
+
this.logInfo(`Database doesn't exist.. reset last sync timestamp`);
|
|
250
|
+
this.lastSync.delete();
|
|
251
|
+
}
|
|
252
|
+
if (exists && (!previousVersion || previousVersion === currentVersion))
|
|
253
|
+
return;
|
|
254
|
+
this.lastSync.delete();
|
|
255
|
+
this.logInfo(`Cleaning up & Sync...`);
|
|
256
|
+
try {
|
|
257
|
+
await this.clear();
|
|
258
|
+
this.logInfo(`Cleaning up & Sync: Completed`);
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
this.logError(`Cleaning up & Sync: ERROR`, e);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
// @ts-ignore
|
|
265
|
+
this['storeWrapper'] = ModuleFE_IDBManager.register(this.dbConfig, onOpenedCallback);
|
|
266
|
+
}
|
|
267
|
+
setLastSyncTimestampStorageKey(newLastSyncStorageKey) {
|
|
268
|
+
this.lastSync = newLastSyncStorageKey;
|
|
269
|
+
}
|
|
270
|
+
onLastUpdateListener(onChangeListener) {
|
|
271
|
+
this.lastSync.onChange(onChangeListener);
|
|
272
|
+
}
|
|
273
|
+
forEach = async (processor) => {
|
|
274
|
+
const allItems = await this.query();
|
|
275
|
+
allItems.forEach(processor);
|
|
276
|
+
return allItems;
|
|
277
|
+
};
|
|
278
|
+
clear = async () => {
|
|
279
|
+
this.lastSync.delete();
|
|
280
|
+
return this.storeWrapper.clearStore();
|
|
281
|
+
};
|
|
282
|
+
delete = async () => {
|
|
283
|
+
this.lastSync.delete();
|
|
284
|
+
return this.storeWrapper.clearStore();
|
|
285
|
+
};
|
|
286
|
+
query = async (query, indexKey) => (await this.storeWrapper.query({
|
|
287
|
+
query,
|
|
288
|
+
indexKey
|
|
289
|
+
})) || [];
|
|
290
|
+
/**
|
|
291
|
+
* Iterates over all DB objects in the related collection, and returns all the items that pass the filter
|
|
292
|
+
*
|
|
293
|
+
* @param {function} filter - Boolean returning function, to determine which objects to return.
|
|
294
|
+
* @param {Object} [query] - A query object
|
|
295
|
+
*
|
|
296
|
+
* @return Array of items or empty array
|
|
297
|
+
*/
|
|
298
|
+
filter = async (filter, query) => this.storeWrapper.queryFilter(filter, query);
|
|
299
|
+
/**
|
|
300
|
+
* Iterates over all DB objects in the related collection, and returns the first item that passes the filter
|
|
301
|
+
*
|
|
302
|
+
* @param {function} filter - Boolean returning function, to determine which object to return.
|
|
303
|
+
*
|
|
304
|
+
* @return a single item or undefined
|
|
305
|
+
*/
|
|
306
|
+
find = async (filter) => this.storeWrapper.queryFind(filter);
|
|
307
|
+
/**
|
|
308
|
+
* Iterates over all DB objects in the related collection, and returns an array of items based on the mapper.
|
|
309
|
+
*
|
|
310
|
+
* @param {function} mapper - Function that returns data to map for the object
|
|
311
|
+
* @param {function} [filter] - Boolean returning function, to determine which item to map.
|
|
312
|
+
* @param {Object} [query] - A query object
|
|
313
|
+
*
|
|
314
|
+
* @return An array of mapped items
|
|
315
|
+
*/
|
|
316
|
+
map = async (mapper, filter, query) => this.storeWrapper.WIP_queryMap(mapper, filter, query);
|
|
317
|
+
/**
|
|
318
|
+
* iterates over all DB objects in the related collection, and reduces them to a single value based on the reducer.
|
|
319
|
+
* @param {function} reducer - Function that determines who to reduce the array.
|
|
320
|
+
* @param {*} initialValue - An initial value for the reducer
|
|
321
|
+
* @param {function} [filter] - Function that determines which DB objects to reduce.
|
|
322
|
+
* @param {Object} [query] - A query Object.
|
|
323
|
+
*
|
|
324
|
+
* @return a single reduced value.
|
|
325
|
+
*/
|
|
326
|
+
reduce = async (reducer, initialValue, filter, query) => this.storeWrapper.queryReduce(reducer, initialValue, filter, query);
|
|
327
|
+
unique = async (_key) => {
|
|
328
|
+
if (_key === undefined)
|
|
329
|
+
return _key;
|
|
330
|
+
const key = typeof _key === 'string' ? { _id: _key } : _key;
|
|
331
|
+
return this.storeWrapper.get(key);
|
|
332
|
+
};
|
|
333
|
+
getLastSync() {
|
|
334
|
+
return this.lastSync.get(0);
|
|
335
|
+
}
|
|
336
|
+
setLastUpdated(lastUpdated) {
|
|
337
|
+
this.lastSync.set(lastUpdated);
|
|
338
|
+
}
|
|
339
|
+
async syncIndexDb(toUpdate, toDelete = []) {
|
|
340
|
+
await this.storeWrapper.upsertAll(toUpdate);
|
|
341
|
+
await this.storeWrapper.deleteAll(toDelete);
|
|
342
|
+
}
|
|
343
|
+
async count() {
|
|
344
|
+
return await this.storeWrapper.count();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
export class MemCache {
|
|
348
|
+
module;
|
|
349
|
+
keys;
|
|
350
|
+
loaded = false;
|
|
351
|
+
_map;
|
|
352
|
+
_array;
|
|
353
|
+
cacheFilter;
|
|
354
|
+
constructor(module, keys) {
|
|
355
|
+
this.module = module;
|
|
356
|
+
this.keys = keys;
|
|
357
|
+
this.clear(); // initiate an empty array
|
|
358
|
+
}
|
|
359
|
+
setCacheFilter = (filter) => {
|
|
360
|
+
this.cacheFilter = filter;
|
|
361
|
+
};
|
|
362
|
+
forEach = (processor) => {
|
|
363
|
+
this._array.forEach(processor);
|
|
364
|
+
};
|
|
365
|
+
clear = () => {
|
|
366
|
+
this.setCache([]);
|
|
367
|
+
};
|
|
368
|
+
async load(cacheFilter) {
|
|
369
|
+
const moduleName = this.module.getName();
|
|
370
|
+
this.module.logDebug(`${moduleName} cache is loading`);
|
|
371
|
+
let allItems;
|
|
372
|
+
this.cacheFilter = cacheFilter;
|
|
373
|
+
if (this.cacheFilter)
|
|
374
|
+
allItems = await this.module.IDB.filter(this.cacheFilter);
|
|
375
|
+
else
|
|
376
|
+
allItems = await this.module.IDB.query();
|
|
377
|
+
const frozenItems = allItems.map((item) => Object.freeze(item));
|
|
378
|
+
this.setCache(frozenItems);
|
|
379
|
+
this.loaded = true;
|
|
380
|
+
this.module.logDebug(`${moduleName} cache finished loading, count: ${this.all().length}`);
|
|
381
|
+
}
|
|
382
|
+
uniqueAssert = (_key) => {
|
|
383
|
+
const item = this.unique(_key);
|
|
384
|
+
if (!item)
|
|
385
|
+
throw new BadImplementationException(`Missing expected item for keys: ${JSON.stringify(_key)}`);
|
|
386
|
+
return item;
|
|
387
|
+
};
|
|
388
|
+
unique = (_key) => {
|
|
389
|
+
if (_key === undefined)
|
|
390
|
+
return _key;
|
|
391
|
+
const _id = typeof _key === 'string' ? _key : (('_id' in _key && typeof _key['_id'] === 'string') ? _key['_id'] : composeDbObjectUniqueId(_key, this.keys));
|
|
392
|
+
return this._map[_id];
|
|
393
|
+
};
|
|
394
|
+
all = () => {
|
|
395
|
+
return this._array;
|
|
396
|
+
};
|
|
397
|
+
allMutable = () => {
|
|
398
|
+
return [...this._array];
|
|
399
|
+
};
|
|
400
|
+
filter = (filter) => {
|
|
401
|
+
return this.all().filter(filter);
|
|
402
|
+
};
|
|
403
|
+
byIds = (ids) => {
|
|
404
|
+
return ids.map(id => this.unique(id));
|
|
405
|
+
};
|
|
406
|
+
find = (filter) => {
|
|
407
|
+
return this.all().find(filter);
|
|
408
|
+
};
|
|
409
|
+
map = (mapper) => {
|
|
410
|
+
return this.all().map(mapper);
|
|
411
|
+
};
|
|
412
|
+
sort = (map = i => i, invert = false) => {
|
|
413
|
+
return sortArray(this.allMutable(), map, invert);
|
|
414
|
+
};
|
|
415
|
+
arrayToMap = (getKey, map = {}) => arrayToMap(this.allMutable(), getKey, map);
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
onEntriesDeleted(itemsDeleted) {
|
|
418
|
+
const ids = new Set(itemsDeleted.map(dbObjectToId));
|
|
419
|
+
this.setCache(this.filter(i => !ids.has(i._id)));
|
|
420
|
+
}
|
|
421
|
+
// @ts-ignore
|
|
422
|
+
onEntriesUpdated(itemsUpdated) {
|
|
423
|
+
const frozenItems = itemsUpdated.map(item => Object.freeze(item));
|
|
424
|
+
const ids = new Set(itemsUpdated.map(dbObjectToId));
|
|
425
|
+
const toCache = this.filter(i => !ids.has(i._id));
|
|
426
|
+
toCache.push(...frozenItems);
|
|
427
|
+
this.setCache(toCache);
|
|
428
|
+
}
|
|
429
|
+
setCache(cacheArray) {
|
|
430
|
+
this._map = Object.freeze({ ...arrayToMap(cacheArray, dbObjectToId) });
|
|
431
|
+
this._array = Object.freeze(cacheArray);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DBProto } from '@nu-art/ts-common';
|
|
2
|
+
import { DBApiFEConfig } from '../../core/db-api-gen/db-def.js';
|
|
3
|
+
import { DBConfigV3 } from '../../core/IndexedDBV4/types.js';
|
|
4
|
+
import { IDBCache, MemCache, ModuleFE_BaseDB } from './ModuleFE_BaseDB.js';
|
|
5
|
+
export declare enum ModuleSyncType {
|
|
6
|
+
NoSync = 0,
|
|
7
|
+
CSVSync = 1,
|
|
8
|
+
APISync = 2
|
|
9
|
+
}
|
|
10
|
+
export type CustomMemCreators<Proto extends DBProto<any>> = {
|
|
11
|
+
memCache?: (_config: DBApiFEConfig<Proto>, _this: ModuleFE_BaseDB<Proto, any>) => MemCache<Proto>;
|
|
12
|
+
idbCache?: (dbConfig: DBConfigV3<Proto>, dbKey: string) => IDBCache<Proto>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var ModuleSyncType;
|
|
2
|
+
(function (ModuleSyncType) {
|
|
3
|
+
ModuleSyncType[ModuleSyncType["NoSync"] = 0] = "NoSync";
|
|
4
|
+
ModuleSyncType[ModuleSyncType["CSVSync"] = 1] = "CSVSync";
|
|
5
|
+
ModuleSyncType[ModuleSyncType["APISync"] = 2] = "APISync";
|
|
6
|
+
})(ModuleSyncType || (ModuleSyncType = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ApiDef, TypedApi } from '@nu-art/thunderstorm-shared';
|
|
2
|
+
import { BaseHttpModule_Class, BaseHttpRequest } from '@nu-art/thunderstorm-shared';
|
|
3
|
+
import { ApiError_GeneralErrorMessage, ApiErrorResponse, ResponseError } from '@nu-art/ts-common/core/exceptions/types';
|
|
4
|
+
export declare class ModuleFE_XHR_Class extends BaseHttpModule_Class {
|
|
5
|
+
init(): void;
|
|
6
|
+
createRequest<API extends TypedApi<any, any, any, any>>(apiDef: ApiDef<API>, data?: string): XhrHttpRequest<API>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ModuleFE_XHR: ModuleFE_XHR_Class;
|
|
9
|
+
declare class XhrHttpRequest<Binder extends TypedApi<any, any, any, any>> extends BaseHttpRequest<Binder> {
|
|
10
|
+
private readonly xhr?;
|
|
11
|
+
constructor(requestKey: string, requestData?: string, shouldCompress?: boolean);
|
|
12
|
+
getStatus(): number;
|
|
13
|
+
protected getResponse(): any;
|
|
14
|
+
protected abortImpl(): void;
|
|
15
|
+
getErrorResponse(): ApiErrorResponse<ResponseError | ApiError_GeneralErrorMessage>;
|
|
16
|
+
protected prepareJsonBody(bodyObject: any): string;
|
|
17
|
+
protected executeImpl(): Promise<void>;
|
|
18
|
+
_getResponseHeader(headerKey: string): string | string[] | undefined;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { BadImplementationException, composeUrl } from '@nu-art/ts-common';
|
|
2
|
+
// noinspection TypeScriptPreferShortImport
|
|
3
|
+
import { BaseHttpModule_Class, BaseHttpRequest, HttpException } from '@nu-art/thunderstorm-shared';
|
|
4
|
+
// noinspection TypeScriptPreferShortImport
|
|
5
|
+
import { gzipSync } from 'zlib';
|
|
6
|
+
export class ModuleFE_XHR_Class extends BaseHttpModule_Class {
|
|
7
|
+
init() {
|
|
8
|
+
super.init();
|
|
9
|
+
let origin = this.config.origin;
|
|
10
|
+
if (!origin)
|
|
11
|
+
throw new BadImplementationException('Did yo\ forget to set the origin config key for the HttpModule?');
|
|
12
|
+
if (origin?.endsWith('/'))
|
|
13
|
+
origin = origin.substring(0, origin.length - 1);
|
|
14
|
+
this.origin = origin;
|
|
15
|
+
}
|
|
16
|
+
createRequest(apiDef, data) {
|
|
17
|
+
const request = new XhrHttpRequest(apiDef.path, data, this.shouldCompress())
|
|
18
|
+
.setLogger(this)
|
|
19
|
+
.setMethod(apiDef.method)
|
|
20
|
+
.setTimeout(this.timeout)
|
|
21
|
+
.setOnCompleted(this.defaultOnComplete)
|
|
22
|
+
.setOnError(this.defaultOnError)
|
|
23
|
+
.addHeaders(this.getDefaultHeaders());
|
|
24
|
+
if (apiDef.fullUrl)
|
|
25
|
+
request.setUrl(apiDef.fullUrl);
|
|
26
|
+
else
|
|
27
|
+
request
|
|
28
|
+
.setOrigin(apiDef.baseUrl ?? this.origin)
|
|
29
|
+
.setRelativeUrl(apiDef.path);
|
|
30
|
+
return request;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export const ModuleFE_XHR = new ModuleFE_XHR_Class();
|
|
34
|
+
class XhrHttpRequest extends BaseHttpRequest {
|
|
35
|
+
xhr;
|
|
36
|
+
constructor(requestKey, requestData, shouldCompress) {
|
|
37
|
+
super(requestKey, requestData);
|
|
38
|
+
this.compress = shouldCompress === undefined ? true : shouldCompress;
|
|
39
|
+
}
|
|
40
|
+
getStatus() {
|
|
41
|
+
const xhr = this.xhr;
|
|
42
|
+
if (!xhr)
|
|
43
|
+
throw new BadImplementationException('No xhr object!');
|
|
44
|
+
return xhr.status;
|
|
45
|
+
}
|
|
46
|
+
getResponse() {
|
|
47
|
+
const xhr = this.xhr;
|
|
48
|
+
if (!xhr)
|
|
49
|
+
throw new BadImplementationException('No xhr object!');
|
|
50
|
+
return xhr.response;
|
|
51
|
+
}
|
|
52
|
+
abortImpl() {
|
|
53
|
+
this.xhr?.abort();
|
|
54
|
+
}
|
|
55
|
+
getErrorResponse() {
|
|
56
|
+
const rawResponse = this.getResponse();
|
|
57
|
+
let response = undefined;
|
|
58
|
+
if (rawResponse) {
|
|
59
|
+
try {
|
|
60
|
+
response = rawResponse && JSON.parse(rawResponse);
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
response = { debugMessage: rawResponse };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
prepareJsonBody(bodyObject) {
|
|
69
|
+
return JSON.stringify(bodyObject);
|
|
70
|
+
}
|
|
71
|
+
// private buildXHR = () => {
|
|
72
|
+
// const xhr = new XMLHttpRequest();
|
|
73
|
+
// const fullUrl = composeUrl(this.url, this.params);
|
|
74
|
+
// xhr.open(this.method, fullUrl);
|
|
75
|
+
// xhr.timeout = this.timeout;
|
|
76
|
+
// Object.keys(this.headers).forEach((key) => {
|
|
77
|
+
// xhr.setRequestHeader(key, this.headers[key].join('; '));
|
|
78
|
+
// });
|
|
79
|
+
// return xhr;
|
|
80
|
+
// };
|
|
81
|
+
executeImpl() {
|
|
82
|
+
//loop through whatever preprocessor
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
if (this.aborted)
|
|
85
|
+
return resolve();
|
|
86
|
+
const xhr = new XMLHttpRequest();
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
// noinspection JSConstantReassignment
|
|
89
|
+
this.xhr = xhr;
|
|
90
|
+
this.xhr.onreadystatechange = () => {
|
|
91
|
+
if (xhr.readyState !== 4)
|
|
92
|
+
return;
|
|
93
|
+
resolve();
|
|
94
|
+
};
|
|
95
|
+
this.xhr.onerror = (err) => {
|
|
96
|
+
if (xhr.readyState === 4 && xhr.status === 0) {
|
|
97
|
+
reject(new HttpException(404, this.url));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
reject(err);
|
|
101
|
+
};
|
|
102
|
+
const fullUrl = composeUrl(this.url, this.params);
|
|
103
|
+
this.xhr.ontimeout = (err) => {
|
|
104
|
+
// console.log(`${this.url} - Request timeout`);
|
|
105
|
+
reject(err);
|
|
106
|
+
};
|
|
107
|
+
this.xhr.onload = (err) => {
|
|
108
|
+
// HttpModule.logVerbose("onload");
|
|
109
|
+
};
|
|
110
|
+
this.xhr.onloadstart = (err) => {
|
|
111
|
+
// HttpModule.logVerbose("onloadstart");
|
|
112
|
+
};
|
|
113
|
+
this.xhr.onloadend = (err) => {
|
|
114
|
+
// HttpModule.logVerbose("onloadend");
|
|
115
|
+
};
|
|
116
|
+
this.xhr.onabort = (err) => {
|
|
117
|
+
// HttpModule.logVerbose("onabort");
|
|
118
|
+
};
|
|
119
|
+
// TODO: investigate which one should work
|
|
120
|
+
this.xhr.onprogress = this.onProgressListener;
|
|
121
|
+
this.xhr.upload.onprogress = this.onProgressListener;
|
|
122
|
+
this.xhr.open(this.method, fullUrl);
|
|
123
|
+
// console.log(`${this.url} - setting XHR timeout: ${this.timeout}`);
|
|
124
|
+
this.xhr.timeout = this.timeout;
|
|
125
|
+
Object.keys(this.headers).forEach((key) => {
|
|
126
|
+
xhr.setRequestHeader(key, this.headers[key].join('; '));
|
|
127
|
+
});
|
|
128
|
+
let body = this.body;
|
|
129
|
+
if (typeof body === 'string' && this.compress)
|
|
130
|
+
try {
|
|
131
|
+
body = gzipSync(this.body);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
return reject(error);
|
|
135
|
+
}
|
|
136
|
+
return this.xhr.send(body);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// stream() {
|
|
140
|
+
// const readable = new Readable();
|
|
141
|
+
// const xhr = this.buildXHR();
|
|
142
|
+
// let lastPosition = 0;
|
|
143
|
+
//
|
|
144
|
+
// // @ts-ignore
|
|
145
|
+
// // noinspection JSConstantReassignment
|
|
146
|
+
// this.xhr = xhr;
|
|
147
|
+
//
|
|
148
|
+
// this.xhr.onreadystatechange = () => {
|
|
149
|
+
// //If Loading
|
|
150
|
+
// if (xhr.readyState === 3) {
|
|
151
|
+
// const currentChunk = xhr.responseText.substring(lastPosition);
|
|
152
|
+
// lastPosition = xhr.responseText.length;
|
|
153
|
+
// readable.push(currentChunk);
|
|
154
|
+
// } else if (xhr.readyState === 4) {
|
|
155
|
+
// readable.push(null);
|
|
156
|
+
// }
|
|
157
|
+
// };
|
|
158
|
+
//
|
|
159
|
+
// let body: any = this.body;
|
|
160
|
+
// if (typeof body === 'string' && this.compress)
|
|
161
|
+
// try {
|
|
162
|
+
// this.body = gzipSync(this.body);
|
|
163
|
+
// } catch (error) {
|
|
164
|
+
// throw error;
|
|
165
|
+
// }
|
|
166
|
+
//
|
|
167
|
+
// this.xhr.send(body);
|
|
168
|
+
// return readable;
|
|
169
|
+
// }
|
|
170
|
+
_getResponseHeader(headerKey) {
|
|
171
|
+
if (!this.xhr)
|
|
172
|
+
throw new BadImplementationException('No xhr object!');
|
|
173
|
+
return this.xhr.getResponseHeader(headerKey) || undefined;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ThunderDispatcher } from '../../core/thunder-dispatcher.js';
|
|
2
|
+
export interface OnLocationChanged {
|
|
3
|
+
__onLocationChanged: (path: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const dispatch_onLocationChanged: ThunderDispatcher<OnLocationChanged, "__onLocationChanged", [path: string], void>;
|
|
6
|
+
export declare const LocationChangeListener: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { ThunderDispatcher } from '../../core/thunder-dispatcher.js';
|
|
5
|
+
import { ModuleFE_RoutingV2 } from './ModuleFE_RoutingV2.js';
|
|
6
|
+
export const dispatch_onLocationChanged = new ThunderDispatcher('__onLocationChanged');
|
|
7
|
+
export const LocationChangeListener = () => {
|
|
8
|
+
const location = useLocation();
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
dispatch_onLocationChanged.dispatchUI(location.pathname);
|
|
12
|
+
}, [location]);
|
|
13
|
+
ModuleFE_RoutingV2.setNavigate(navigate);
|
|
14
|
+
return _jsx(_Fragment, {});
|
|
15
|
+
};
|