@corva/ui 3.15.0-8 → 3.15.0-rc.0
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/cjs-bundle/clients/index.js +1 -1
- package/cjs-bundle/clients/index.js.map +1 -1
- package/cjs-bundle/clients/subscriptions/constants.js +2 -0
- package/cjs-bundle/clients/subscriptions/constants.js.map +1 -0
- package/cjs-bundle/clients/subscriptions/get-channel-name.js +2 -0
- package/cjs-bundle/clients/subscriptions/get-channel-name.js.map +1 -0
- package/cjs-bundle/clients/subscriptions/socket-client.v2.js +2 -0
- package/cjs-bundle/clients/subscriptions/socket-client.v2.js.map +1 -0
- package/cjs-bundle/clients/subscriptions/subscriptions-client.dummy.js +2 -0
- package/cjs-bundle/clients/subscriptions/subscriptions-client.dummy.js.map +1 -0
- package/cjs-bundle/clients/subscriptions/subscriptions-client.factory.js +2 -0
- package/cjs-bundle/clients/subscriptions/subscriptions-client.factory.js.map +1 -0
- package/cjs-bundle/clients/subscriptions/subscriptions-client.js +2 -0
- package/cjs-bundle/clients/subscriptions/subscriptions-client.js.map +1 -0
- package/cjs-bundle/clients/subscriptions.js +1 -1
- package/cjs-bundle/clients/subscriptions.js.map +1 -1
- package/cjs-bundle/clients/subscriptions.v1.js +2 -0
- package/cjs-bundle/clients/subscriptions.v1.js.map +1 -0
- package/cjs-bundle/components/AddComment/Popover.js +1 -1
- package/cjs-bundle/components/AddComment/Popover.js.map +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js.map +1 -1
- package/cjs-bundle/components/AssetEditor/effects/index.js +1 -1
- package/cjs-bundle/components/AssetEditor/effects/index.js.map +1 -1
- package/cjs-bundle/components/AssetEditorV2/effects/index.js +1 -1
- package/cjs-bundle/components/AssetEditorV2/effects/index.js.map +1 -1
- package/cjs-bundle/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js +1 -1
- package/cjs-bundle/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js.map +1 -1
- package/cjs-bundle/components/Attachment/index.js +1 -1
- package/cjs-bundle/components/Attachment/index.js.map +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/CollapsableSidebar.js +1 -1
- package/cjs-bundle/components/CollapsableSidebar.js.map +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.js +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/NonPriorityMenus/NonPriorityMenus.js +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js.map +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/cjs-bundle/components/FeedItem/FeedItem.js +1 -1
- package/cjs-bundle/components/FeedItem/FeedItem.js.map +1 -1
- package/cjs-bundle/components/FeedItem/components/FeedComments.js +1 -1
- package/cjs-bundle/components/FeedItem/components/FeedComments.js.map +1 -1
- package/cjs-bundle/components/ImageViewer/index.js +1 -1
- package/cjs-bundle/components/ImageViewer/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/OffsetWellPickerV4.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/OffsetWellPickerV4.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/Filter/Filter.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/Filter/Filter.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js.map +1 -1
- package/cjs-bundle/components/Popover/Popover.js +1 -1
- package/cjs-bundle/components/Popper/Popper.js +1 -1
- package/cjs-bundle/components/RealTimeValuesSidebar/SidebarFooter.js +1 -1
- package/cjs-bundle/componentsV2/AppFooter/DqPopover/DqPopover.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/AppAssets/utils.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AssetSelector/AssetSelector.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/SettingsPopover/SettingsPopover.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js +1 -1
- package/cjs-bundle/componentsV2/PadModeSelect/PadModeSelect.js +1 -1
- package/cjs-bundle/effects/subscriptions/useSubscriptions.v1.js +2 -0
- package/cjs-bundle/effects/subscriptions/useSubscriptions.v1.js.map +1 -0
- package/cjs-bundle/effects/subscriptions/useSubscriptions.v2.js +2 -0
- package/cjs-bundle/effects/subscriptions/useSubscriptions.v2.js.map +1 -0
- package/cjs-bundle/effects/useSubscriptions.js +1 -1
- package/cjs-bundle/effects/useSubscriptions.js.map +1 -1
- package/cjs-bundle/testing/AppTestWrapper/AppTestWrapper.js +1 -1
- package/clients/index.d.ts +10 -3
- package/clients/index.d.ts.map +1 -1
- package/clients/index.js +1 -1
- package/clients/index.js.map +1 -1
- package/clients/subscriptions/__tests__/subscriptions-client.factory.test.d.ts +2 -0
- package/clients/subscriptions/__tests__/subscriptions-client.factory.test.d.ts.map +1 -0
- package/clients/subscriptions/__tests__/subscriptions-client.test.d.ts +2 -0
- package/clients/subscriptions/__tests__/subscriptions-client.test.d.ts.map +1 -0
- package/clients/subscriptions/constants.d.ts +5 -0
- package/clients/subscriptions/constants.d.ts.map +1 -0
- package/clients/subscriptions/constants.js +2 -0
- package/clients/subscriptions/constants.js.map +1 -0
- package/clients/subscriptions/get-channel-name.d.ts +3 -0
- package/clients/subscriptions/get-channel-name.d.ts.map +1 -0
- package/clients/subscriptions/get-channel-name.js +2 -0
- package/clients/subscriptions/get-channel-name.js.map +1 -0
- package/clients/subscriptions/socket-client.v2.d.ts +10 -0
- package/clients/subscriptions/socket-client.v2.d.ts.map +1 -0
- package/clients/subscriptions/socket-client.v2.js +2 -0
- package/clients/subscriptions/socket-client.v2.js.map +1 -0
- package/clients/subscriptions/subscriptions-client.d.ts +13 -0
- package/clients/subscriptions/subscriptions-client.d.ts.map +1 -0
- package/clients/subscriptions/subscriptions-client.dummy.d.ts +7 -0
- package/clients/subscriptions/subscriptions-client.dummy.d.ts.map +1 -0
- package/clients/subscriptions/subscriptions-client.dummy.js +2 -0
- package/clients/subscriptions/subscriptions-client.dummy.js.map +1 -0
- package/clients/subscriptions/subscriptions-client.factory.d.ts +7 -0
- package/clients/subscriptions/subscriptions-client.factory.d.ts.map +1 -0
- package/clients/subscriptions/subscriptions-client.factory.js +2 -0
- package/clients/subscriptions/subscriptions-client.factory.js.map +1 -0
- package/clients/subscriptions/subscriptions-client.js +2 -0
- package/clients/subscriptions/subscriptions-client.js.map +1 -0
- package/clients/subscriptions/types.d.ts +37 -0
- package/clients/subscriptions/types.d.ts.map +1 -0
- package/clients/subscriptions.d.ts +1 -8
- package/clients/subscriptions.d.ts.map +1 -1
- package/clients/subscriptions.js +1 -1
- package/clients/subscriptions.js.map +1 -1
- package/clients/subscriptions.v1.d.ts +9 -0
- package/clients/subscriptions.v1.d.ts.map +1 -0
- package/clients/subscriptions.v1.js +2 -0
- package/clients/subscriptions.v1.js.map +1 -0
- package/components/AddComment/Popover.js +1 -1
- package/components/AddComment/Popover.js.map +1 -1
- package/components/AddComment/components/Content.js +1 -1
- package/components/AddComment/components/Content.js.map +1 -1
- package/components/AssetEditor/effects/index.js +1 -1
- package/components/AssetEditor/effects/index.js.map +1 -1
- package/components/AssetEditorV2/effects/index.js +1 -1
- package/components/AssetEditorV2/effects/index.js.map +1 -1
- package/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js +1 -1
- package/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js.map +1 -1
- package/components/Attachment/index.js +1 -1
- package/components/Attachment/index.js.map +1 -1
- package/components/BICOffsetPickerDialog/index.js +1 -1
- package/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/components/CollapsableSidebar.js +1 -1
- package/components/CollapsableSidebar.js.map +1 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
- package/components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/components/NonPriorityMenus/NonPriorityMenus.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js.map +1 -1
- package/components/DocumentViewer/DocumentViewer.js +1 -1
- package/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/components/FeedItem/FeedItem.js +1 -1
- package/components/FeedItem/FeedItem.js.map +1 -1
- package/components/FeedItem/components/FeedComments.js +1 -1
- package/components/FeedItem/components/FeedComments.js.map +1 -1
- package/components/ImageViewer/index.js +1 -1
- package/components/ImageViewer/index.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js +1 -1
- package/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js +1 -1
- package/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/components/OffsetWellPickerV4/OffsetWellPickerV4.js +1 -1
- package/components/OffsetWellPickerV4/OffsetWellPickerV4.js.map +1 -1
- package/components/OffsetWellPickerV4/components/Filter/Filter.js +1 -1
- package/components/OffsetWellPickerV4/components/Filter/Filter.js.map +1 -1
- package/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js +1 -1
- package/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js.map +1 -1
- package/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js +1 -1
- package/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js.map +1 -1
- package/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js +1 -1
- package/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js.map +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/components/PinnableFilters/effects/index.js +1 -1
- package/components/PinnableFilters/effects/index.js.map +1 -1
- package/components/Popover/Popover.js +1 -1
- package/components/Popper/Popper.js +1 -1
- package/components/RealTimeValuesSidebar/SidebarFooter.js +1 -1
- package/componentsV2/AppFooter/DqPopover/DqPopover.js +1 -1
- package/componentsV2/AppHeader/AppAssets/utils.js +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
- package/componentsV2/AppHeader/V3/AssetSelector/AssetSelector.js +1 -1
- package/componentsV2/AppHeader/V3/SettingsPopover/SettingsPopover.js +1 -1
- package/componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js +1 -1
- package/componentsV2/PadModeSelect/PadModeSelect.js +1 -1
- package/effects/subscriptions/__tests__/useSubscriptions.v2.test.d.ts +2 -0
- package/effects/subscriptions/__tests__/useSubscriptions.v2.test.d.ts.map +1 -0
- package/effects/subscriptions/useSubscriptions.v1.d.ts +24 -0
- package/effects/subscriptions/useSubscriptions.v1.d.ts.map +1 -0
- package/effects/subscriptions/useSubscriptions.v1.js +2 -0
- package/effects/subscriptions/useSubscriptions.v1.js.map +1 -0
- package/effects/subscriptions/useSubscriptions.v2.d.ts +15 -0
- package/effects/subscriptions/useSubscriptions.v2.d.ts.map +1 -0
- package/effects/subscriptions/useSubscriptions.v2.js +2 -0
- package/effects/subscriptions/useSubscriptions.v2.js.map +1 -0
- package/effects/useSubscriptions.d.ts +10 -14
- package/effects/useSubscriptions.d.ts.map +1 -1
- package/effects/useSubscriptions.js +1 -1
- package/effects/useSubscriptions.js.map +1 -1
- package/effects/useWellnessAlerts.d.ts.map +1 -1
- package/package.json +4 -1
- package/testing/AppTestWrapper/AppTestWrapper.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSubscriptions.v1.js","sources":["../../../../src/effects/subscriptions/useSubscriptions.v1.js"],"sourcesContent":["// NOTE: This is a deprecated module, but is still used in the codebase (some devcenter apps)\n// We don't support it, dc devs should refactor their code to use socketClient directly\nimport { parse } from 'querystring';\n\nimport { useState, useEffect, useRef, useMemo } from 'react';\nimport uuidV1 from 'uuid/v1';\nimport { castArray, omit, differenceBy, concat, merge, mapValues } from 'lodash';\n\nimport { getSubscriptionId } from '../../clients/subscriptions.v1';\n\nimport { getAppKeyFromStackTrace } from '~/clients/utils';\nimport { getAppStorage, getDataAppStorage, getDataAppStorageAggregate } from '~/clients/jsonApi';\n\nfunction getSubscriptionWithId(sub, hookId, appKey) {\n const subId = getSubscriptionId(sub, hookId);\n return { ...sub, hookId, subId, appInstanceId: subId, app_key: appKey };\n}\n\nexport async function fetchInitialSubscriptionsDataDeprecated(\n subscriptions,\n { timeQuery, appKey }\n) {\n const requests = subscriptions.map(\n async ({ provider, collection, assetId, subscribeOnly, params }) => {\n if (subscribeOnly) return null;\n const queryFromParameters = params.query;\n const queryFromTime = timeQuery ? `{timestamp#lte#${timeQuery.timestamp.$lte}` : '';\n const separator = queryFromParameters && queryFromTime ? 'AND' : '';\n const query = `${queryFromParameters}${separator}${queryFromTime}`;\n\n try {\n return await getAppStorage(provider, collection, assetId, {\n ...params,\n ...(query ? { query } : {}),\n appKey,\n });\n } catch (e) {\n return [];\n }\n }\n );\n return Promise.all(requests);\n}\n\nexport async function fetchInitialSubscriptionsData(subscriptions, { timeQuery, appKey }) {\n const requests = subscriptions.map(\n async ({ provider, collection, assetId, subscribeOnly, params = {} }) => {\n if (subscribeOnly) return null;\n\n // NOTE: Use different endpoint for aggregate queries\n // https://data.qa.corva.ai/docs#/default/aggregate_api_v1_data__provider___dataset__aggregate__get\n if (params.aggregate)\n return getDataAppStorageAggregate(provider, collection, {\n ...mapValues(params.aggregate, JSON.stringify),\n });\n\n const query = JSON.stringify(merge({ asset_id: assetId }, params.query, timeQuery));\n const { limit = 1, sort = '{\"timestamp\": 1}' } = params;\n\n try {\n const options = {\n ...params,\n limit,\n sort,\n query,\n appKey,\n };\n\n return await getDataAppStorage(provider, collection, options);\n } catch (e) {\n return [];\n }\n }\n );\n return Promise.all(requests);\n}\n\n/**\n * A hook to subscribe to the corva socket updates\n * @param {Object | Object[]} subscriptions - subscription params\n * @param {number} subscriptions.limit - only save given amount of records\n * @param {boolean} subscriptions.subscribeOnly - do NOT send initial requests for the data\n * @param {boolean} subscriptions.alwaysSubscribe - will always subscribe, even when well timeline used\n * and do NOT store previously received data if true\n * @param {Object | Object} options - various hook options\n * @param {Object | Object} options.timestamp - requested time (usually from well timeline).\n * If provided only the initial request is being sent with the {\"timestamp\": {\"$lte\":time}} query added.\n */\nexport function useSubscriptionsV1(subscriptions, { timestamp, isOldApiUsed } = {}) {\n const [data, setData] = useState({});\n // NOTE: Declare this hook id to differentiate between hooks\n const hookIdRef = useRef();\n if (!hookIdRef.current) hookIdRef.current = uuidV1();\n const { subscribe, unsubscribe, socket } = window[Symbol.for('socket')];\n const appKey = useMemo(() => getAppKeyFromStackTrace(), []);\n\n // NOTE: Save previous subscriptions to detect added/removed subscriptions\n const prevSubscriptionsRef = useRef([]);\n const currentSubscriptions = castArray(subscriptions).map(sub =>\n getSubscriptionWithId(sub, hookIdRef.current, appKey)\n );\n\n // NOTE: This string is used to trigger effects\n const currentSubscriptionsIdsJoined = currentSubscriptions.map(sub => sub.subId).join();\n const timeQuery = useMemo(() => {\n if (timestamp) return { timestamp: { $lte: timestamp } };\n const timeFromLocation = parse(window.location.search).time;\n return timeFromLocation ? { timestamp: { $lte: new Date(timeFromLocation) / 1000 } } : null;\n }, [window.location.search, timestamp]);\n\n useEffect(() => {\n const onDataReceive = event => {\n // NOTE: Skip other effects subscriptions' events\n if (event.hookId !== hookIdRef.current) return;\n setData(prevData => {\n let nextData = event.data;\n if (event.subId in prevData && !event.subscribeOnly) {\n nextData = concat(prevData[event.subId], event.data);\n }\n\n if (event.params && event.params.limit) nextData = nextData.slice(-event.params.limit);\n\n return {\n ...prevData,\n [event.subId]: nextData,\n };\n });\n };\n if (socket) socket.on('data', onDataReceive);\n return () => {\n if (socket) socket.off('data', onDataReceive);\n };\n }, []);\n\n useEffect(() => {\n const { current: prevSubscriptions } = prevSubscriptionsRef;\n prevSubscriptions.forEach(unsubscribe);\n prevSubscriptionsRef.current = [];\n }, [timeQuery]);\n\n useEffect(() => {\n const { current: prevSubscriptions } = prevSubscriptionsRef;\n const addedSubscriptions = differenceBy(currentSubscriptions, prevSubscriptions, 'subId');\n const deletedSubscriptions = differenceBy(prevSubscriptions, currentSubscriptions, 'subId');\n addedSubscriptions.forEach(subscription => {\n // NOTE: only subscribe when the timestamp wasn't provided (well timeline wasn't used)\n if (!timeQuery || subscription.alwaysSubscribe) subscribe(subscription);\n });\n deletedSubscriptions.forEach(unsubscribe);\n\n prevSubscriptionsRef.current = currentSubscriptions;\n\n // NOTE: Migrate to new api after https://corvaqa.atlassian.net/browse/DC-1090 is done\n const fetchFunc = isOldApiUsed\n ? fetchInitialSubscriptionsDataDeprecated\n : fetchInitialSubscriptionsData;\n fetchFunc(addedSubscriptions, { timeQuery, appKey, isOldApiUsed }).then(subsData =>\n setData(prevData => {\n // NOTE: Here we omit data from deleted subscriptions\n const nextData = omit(\n prevData,\n deletedSubscriptions.map(sub => sub.subId)\n );\n\n addedSubscriptions.forEach((sub, idx) => {\n if (subsData[idx] !== null) nextData[sub.subId] = subsData[idx];\n });\n return nextData;\n })\n );\n }, [currentSubscriptionsIdsJoined, timeQuery]);\n\n // NOTE: Clear all subscriptions on unmounting\n useEffect(() => () => prevSubscriptionsRef.current.forEach(unsubscribe), []);\n\n return useMemo(\n () =>\n currentSubscriptions.map(({ subId }) => ({\n loading: !(subId in data),\n data: data[subId],\n })),\n [data, currentSubscriptionsIdsJoined]\n );\n}\n"],"names":["getSubscriptionWithId","sub","hookId","appKey","subId","getSubscriptionId","_objectSpread","appInstanceId","app_key","fetchInitialSubscriptionsDataDeprecated","_x","_x2","_fetchInitialSubscriptionsDataDeprecated","apply","this","arguments","_asyncToGenerator","_regeneratorRuntime","mark","subscriptions","_ref","timeQuery","requests","wrap","_context2","prev","next","map","_ref6","_callee","_ref5","provider","collection","assetId","subscribeOnly","params","queryFromParameters","queryFromTime","separator","query","_context","abrupt","timestamp","$lte","getAppStorage","sent","t0","stop","_x5","Promise","all","_callee2","fetchInitialSubscriptionsData","_x3","_x4","_fetchInitialSubscriptionsData","_ref2","_context4","_ref8","_callee3","_ref7","_ref7$params","_params$limit","limit","_params$sort","sort","options","_context3","aggregate","getDataAppStorageAggregate","mapValues","JSON","stringify","merge","asset_id","getDataAppStorage","_x6","_callee4","_ref3","length","undefined","isOldApiUsed","_useState","useState","_useState2","_slicedToArray","data","setData","hookIdRef","useRef","current","uuidV1","window","Symbol","for","subscribe","unsubscribe","socket","useMemo","getAppKeyFromStackTrace","prevSubscriptionsRef","currentSubscriptions","castArray","currentSubscriptionsIdsJoined","join","timeFromLocation","parse","location","search","time","Date","useEffect","onDataReceive","event","prevData","nextData","concat","slice","on","off","forEach","prevSubscriptions","addedSubscriptions","differenceBy","deletedSubscriptions","subscription","alwaysSubscribe","then","subsData","omit","idx","_ref4","loading"],"mappings":"opCAaA,SAASA,EAAsBC,EAAKC,EAAQC,GAC1C,IAAMC,EAAQC,EAAAA,kBAAkBJ,EAAKC,GACrC,OAAAI,EAAAA,EAAA,CAAA,EAAYL,GAAG,CAAA,EAAA,CAAEC,OAAAA,EAAQE,MAAAA,EAAOG,cAAeH,EAAOI,QAASL,GACjE,CAEA,SAAsBM,EAAuCC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAwB5D,SAAAH,IAAA,OAAAA,EAAAI,EAAA,QAAAC,UAAAC,MAxBM,WACLC,EAAaC,GAAA,IAAAC,EAAAlB,EAAAmB,EAAA,OAAAL,UAAAM,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAqBZ,OApBCL,EAAAA,EAAAA,UAAWlB,IAAAA,OAEPmB,EAAWH,EAAcQ,IAAG,WAAA,IAChCC,EAAAZ,EAAAA,QAAAC,EAAAA,QAAAC,MAAA,SAAAW,EAAAC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EA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AAA,EAAWlB,OAAAA,EAAQ8E,aAAAA,IAAgB8C,MAAK,SAAAC,GAAQ,OAC9EzC,GAAQ,SAAA2B,GAEN,IAAMC,EAAWc,EAAAA,KACff,EACAU,EAAqBjG,KAAI,SAAA1B,GAAG,OAAIA,EAAIG,KAAK,KAM3C,OAHAsH,EAAmBF,SAAQ,SAACvH,EAAKiI,GACT,OAAlBF,EAASE,KAAef,EAASlH,EAAIG,OAAS4H,EAASE,GAC7D,IACOf,CACT,MAEJ,GAAG,CAACZ,EAA+BlF,IAGnC0F,EAAAA,WAAU,WAAA,OAAM,WAAA,OAAMX,EAAqBV,QAAQ8B,QAAQxB,EAAY,CAAA,GAAE,IAElEE,EAAOA,SACZ,WAAA,OACEG,EAAqB1E,KAAI,SAAAwG,GAAA,IAAG/H,IAAAA,MAAK,MAAQ,CACvCgI,UAAWhI,KAASkF,GACpBA,KAAMA,EAAKlF,GACZ,GAAE,GACL,CAACkF,EAAMiB,GAEX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react"),n=require("../../clients/subscriptions/get-channel-name.js"),r=require("querystring"),i=require("../../clients/utils.js"),u=require("./useSubscriptions.v1.js"),s=require("../../clients/subscriptions/subscriptions-client.factory.js");exports.useSubscriptionsV2=function(a,c){var o=void 0===c?{}:c,f=o.timestamp,l=o.isOldApiUsed,m=a.map(n.getChannelName).join(","),p=Array.from(new Set(a.map(n.getChannelName))).sort().join(","),g=t.useState({}),d=g[0],h=g[1],b=t.useState(!0),y=b[0],v=b[1],S=t.useMemo((function(){return i.getAppKeyFromStackTrace()}),[]),j=s.SubscriptionsClientFactory.init(),q=t.useMemo((function(){return a.map(n.getChannelName)}),[m]),w=t.useMemo((function(){return Array.from(new Set(a.map(n.getChannelName)))}),[p]),_=t.useRef(!0),A=t.useMemo((function(){if(f)return{timestamp:{$lte:f}};var e=r.parse(window.location.search).time,t=Array.isArray(e)?e[0]:e;return t?{timestamp:{$lte:new Date(t).getTime()/1e3}}:null}),[window.location.search,f]);return t.useEffect((function(){return _.current=!0,function(){_.current=!1}}),[]),t.useEffect((function(){if(j&&0!==w.length&&!y){var t=w.map((function(t){return j.subscribe(t,(function(n){_.current&&h((function(r){var i;return e.__assign(e.__assign({},r),((i={})[t]=n,i))}))}))}));return function(){t.forEach((function(e){return e()}))}}}),[p,y]),t.useEffect((function(){(l?u.fetchInitialSubscriptionsDataDeprecated:u.fetchInitialSubscriptionsData)(a,{timeQuery:A,appKey:S}).then((function(e){if(_.current){var t=e.reduce((function(e,t,r){return e[n.getChannelName(a[r])]=t,e}),{});h(t),v(!1)}}))}),[m,A]),t.useMemo((function(){return 0===a.length?[]:q.map((function(e){var t=!(e in d);return t?{loading:t}:{loading:!1,data:d[e]}}))}),[d,m])};
|
|
2
|
+
//# sourceMappingURL=useSubscriptions.v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,kFAAkF,oCAAuC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=require("../clients/subscriptions/constants.js"),i=require("./subscriptions/useSubscriptions.v1.js"),r=require("./subscriptions/useSubscriptions.v2.js"),u=s.handleSubscriptionsVersion(i.useSubscriptionsV1,r.useSubscriptionsV2);module.exports=u;
|
|
2
2
|
//# sourceMappingURL=useSubscriptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscriptions.js","sources":["../../../src/effects/useSubscriptions.js"],"sourcesContent":["// NOTE: This is a deprecated module, but is still used in the codebase (some devcenter apps)\n// We don't support it, dc devs should refactor their code to use socketClient directly\nimport { parse } from 'querystring';\n\nimport { useState, useEffect, useRef, useMemo } from 'react';\nimport uuidV1 from 'uuid/v1';\nimport { castArray, omit, differenceBy, concat, merge, mapValues } from 'lodash';\n\nimport { getSubscriptionId } from '../clients/subscriptions';\n\nimport { getAppKeyFromStackTrace } from '~/clients/utils';\nimport { getAppStorage, getDataAppStorage, getDataAppStorageAggregate } from '~/clients/jsonApi';\n\nfunction getSubscriptionWithId(sub, hookId, appKey) {\n const subId = getSubscriptionId(sub, hookId);\n return { ...sub, hookId, subId, appInstanceId: subId, app_key: appKey };\n}\n\nasync function fetchInitialSubscriptionsDataDeprecated(subscriptions, { timeQuery, appKey }) {\n const requests = subscriptions.map(\n async ({ provider, collection, assetId, subscribeOnly, params }) => {\n if (subscribeOnly) return null;\n const queryFromParameters = params.query;\n const queryFromTime = timeQuery ? `{timestamp#lte#${timeQuery.timestamp.$lte}` : '';\n const separator = queryFromParameters && queryFromTime ? 'AND' : '';\n const query = `${queryFromParameters}${separator}${queryFromTime}`;\n\n try {\n return await getAppStorage(provider, collection, assetId, {\n ...params,\n ...(query ? { query } : {}),\n appKey,\n });\n } catch (e) {\n return [];\n }\n }\n );\n return Promise.all(requests);\n}\n\nasync function fetchInitialSubscriptionsData(subscriptions, { timeQuery, appKey }) {\n const requests = subscriptions.map(\n async ({ provider, collection, assetId, subscribeOnly, params = {} }) => {\n if (subscribeOnly) return null;\n\n // NOTE: Use different endpoint for aggregate queries\n // https://data.qa.corva.ai/docs#/default/aggregate_api_v1_data__provider___dataset__aggregate__get\n if (params.aggregate)\n return getDataAppStorageAggregate(provider, collection, {\n ...mapValues(params.aggregate, JSON.stringify),\n });\n\n const query = JSON.stringify(merge({ asset_id: assetId }, params.query, timeQuery));\n const { limit = 1, sort = '{\"timestamp\": 1}' } = params;\n\n try {\n const options = {\n ...params,\n limit,\n sort,\n query,\n appKey,\n };\n\n return await getDataAppStorage(provider, collection, options);\n } catch (e) {\n return [];\n }\n }\n );\n return Promise.all(requests);\n}\n\n/**\n * A hook to subscribe to the corva socket updates\n * @param {Object | Object[]} subscriptions - subscription params\n * @param {number} subscriptions.limit - only save given amount of records\n * @param {boolean} subscriptions.subscribeOnly - do NOT send initial requests for the data\n * @param {boolean} subscriptions.alwaysSubscribe - will always subscribe, even when well timeline used\n * and do NOT store previously received data if true\n * @param {Object | Object} options - various hook options\n * @param {Object | Object} options.timestamp - requested time (usually from well timeline).\n * If provided only the initial request is being sent with the {\"timestamp\": {\"$lte\":time}} query added.\n */\nfunction useSubscriptions(subscriptions, { timestamp, isOldApiUsed } = {}) {\n const [data, setData] = useState({});\n // NOTE: Declare this hook id to differentiate between hooks\n const hookIdRef = useRef();\n if (!hookIdRef.current) hookIdRef.current = uuidV1();\n const { subscribe, unsubscribe, socket } = window[Symbol.for('socket')];\n const appKey = useMemo(() => getAppKeyFromStackTrace(), []);\n\n // NOTE: Save previous subscriptions to detect added/removed subscriptions\n const prevSubscriptionsRef = useRef([]);\n const currentSubscriptions = castArray(subscriptions).map(sub =>\n getSubscriptionWithId(sub, hookIdRef.current, appKey)\n );\n\n // NOTE: This string is used to trigger effects\n const currentSubscriptionsIdsJoined = currentSubscriptions.map(sub => sub.subId).join();\n const timeQuery = useMemo(() => {\n if (timestamp) return { timestamp: { $lte: timestamp } };\n const timeFromLocation = parse(window.location.search).time;\n return timeFromLocation ? { timestamp: { $lte: new Date(timeFromLocation) / 1000 } } : null;\n }, [window.location.search, timestamp]);\n\n useEffect(() => {\n const onDataReceive = event => {\n // NOTE: Skip other effects subscriptions' events\n if (event.hookId !== hookIdRef.current) return;\n setData(prevData => {\n let nextData = event.data;\n if (event.subId in prevData && !event.subscribeOnly) {\n nextData = concat(prevData[event.subId], event.data);\n }\n\n if (event.params && event.params.limit) nextData = nextData.slice(-event.params.limit);\n\n return {\n ...prevData,\n [event.subId]: nextData,\n };\n });\n };\n if (socket) socket.on('data', onDataReceive);\n return () => {\n if (socket) socket.off('data', onDataReceive);\n };\n }, []);\n\n useEffect(() => {\n const { current: prevSubscriptions } = prevSubscriptionsRef;\n prevSubscriptions.forEach(unsubscribe);\n prevSubscriptionsRef.current = [];\n }, [timeQuery]);\n\n useEffect(() => {\n const { current: prevSubscriptions } = prevSubscriptionsRef;\n const addedSubscriptions = differenceBy(currentSubscriptions, prevSubscriptions, 'subId');\n const deletedSubscriptions = differenceBy(prevSubscriptions, currentSubscriptions, 'subId');\n addedSubscriptions.forEach(subscription => {\n // NOTE: only subscribe when the timestamp wasn't provided (well timeline wasn't used)\n if (!timeQuery || subscription.alwaysSubscribe) subscribe(subscription);\n });\n deletedSubscriptions.forEach(unsubscribe);\n\n prevSubscriptionsRef.current = currentSubscriptions;\n\n // NOTE: Migrate to new api after https://corvaqa.atlassian.net/browse/DC-1090 is done\n const fetchFunc = isOldApiUsed\n ? fetchInitialSubscriptionsDataDeprecated\n : fetchInitialSubscriptionsData;\n fetchFunc(addedSubscriptions, { timeQuery, appKey, isOldApiUsed }).then(subsData =>\n setData(prevData => {\n // NOTE: Here we omit data from deleted subscriptions\n const nextData = omit(\n prevData,\n deletedSubscriptions.map(sub => sub.subId)\n );\n\n addedSubscriptions.forEach((sub, idx) => {\n if (subsData[idx] !== null) nextData[sub.subId] = subsData[idx];\n });\n return nextData;\n })\n );\n }, [currentSubscriptionsIdsJoined, timeQuery]);\n\n // NOTE: Clear all subscriptions on unmounting\n useEffect(() => () => prevSubscriptionsRef.current.forEach(unsubscribe), []);\n\n return useMemo(\n () =>\n currentSubscriptions.map(({ subId }) => ({\n loading: !(subId in data),\n data: data[subId],\n })),\n [data, currentSubscriptionsIdsJoined]\n );\n}\n\nexport default useSubscriptions;\n"],"names":["getSubscriptionWithId","sub","hookId","appKey","subId","getSubscriptionId","_objectSpread","appInstanceId","app_key","fetchInitialSubscriptionsDataDeprecated","_x","_x2","_fetchInitialSubscriptionsDataDeprecated","apply","this","arguments","_asyncToGenerator","_regeneratorRuntime","mark","subscriptions","_ref","timeQuery","requests","wrap","_context2","prev","next","map","_ref6","_callee","_ref5","provider","collection","assetId","subscribeOnly","params","queryFromParameters","queryFromTime","separator","query","_context","abrupt","timestamp","$lte","getAppStorage","sent","t0","stop","_x5","Promise","all","_callee2","fetchInitialSubscriptionsData","_x3","_x4","_fetchInitialSubscriptionsData","_ref2","_context4","_ref8","_callee3","_ref7","_ref7$params","_params$limit","limit","_params$sort","sort","options","_context3","aggregate","getDataAppStorageAggregate","mapValues","JSON","stringify","merge","asset_id","getDataAppStorage","_x6","_callee4","_ref3","length","undefined","isOldApiUsed","_useState","useState","_useState2","_slicedToArray","data","setData","hookIdRef","useRef","current","uuidV1","window","Symbol","for","subscribe","unsubscribe","socket","useMemo","getAppKeyFromStackTrace","prevSubscriptionsRef","currentSubscriptions","castArray","currentSubscriptionsIdsJoined","join","timeFromLocation","parse","location","search","time","Date","useEffect","onDataReceive","event","prevData","nextData","concat","slice","on","off","forEach","prevSubscriptions","addedSubscriptions","differenceBy","deletedSubscriptions","subscription","alwaysSubscribe","then","subsData","omit","idx","_ref4","loading"],"mappings":"ilCAaA,SAASA,EAAsBC,EAAKC,EAAQC,GAC1C,IAAMC,EAAQC,EAAAA,kBAAkBJ,EAAKC,GACrC,OAAAI,EAAAA,EAAA,CAAA,EAAYL,GAAG,CAAA,EAAA,CAAEC,OAAAA,EAAQE,MAAAA,EAAOG,cAAeH,EAAOI,QAASL,GACjE,CAAC,SAEcM,EAAuCC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAAA,SAAAH,IAqBrD,OArBqDA,EAAAI,EAAA,QAAAC,UAAAC,MAAtD,WAAuDC,EAAaC,GAAA,IAAAC,EAAAlB,EAAAmB,EAAA,OAAAL,UAAAM,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAmBjE,OAnBqEL,EAAAA,EAAAA,UAAWlB,IAAAA,OAC3EmB,EAAWH,EAAcQ,IAAG,WAAA,IAChCC,EAAAZ,EAAAA,QAAAC,EAAAA,QAAAC,MAAA,SAAAW,EAAAC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAtB,UAAAM,MAAA,SAAAi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AAAC,GAAQ,OAC9EzC,GAAQ,SAAA2B,GAEN,IAAMC,EAAWc,EAAAA,KACff,EACAU,EAAqBjG,KAAI,SAAA1B,GAAG,OAAIA,EAAIG,KAAK,KAM3C,OAHAsH,EAAmBF,SAAQ,SAACvH,EAAKiI,GACT,OAAlBF,EAASE,KAAef,EAASlH,EAAIG,OAAS4H,EAASE,GAC7D,IACOf,CACT,MAEJ,GAAG,CAACZ,EAA+BlF,IAGnC0F,EAAAA,WAAU,WAAA,OAAM,WAAA,OAAMX,EAAqBV,QAAQ8B,QAAQxB,EAAY,CAAA,GAAE,IAElEE,EAAOA,SACZ,WAAA,OACEG,EAAqB1E,KAAI,SAAAwG,GAAA,IAAG/H,IAAAA,MAAK,MAAQ,CACvCgI,UAAWhI,KAASkF,GACpBA,KAAMA,EAAKlF,GACZ,GAAE,GACL,CAACkF,EAAMiB,GAEX"}
|
|
1
|
+
{"version":3,"file":"useSubscriptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../componentsV2/AppCommonsProvider/AppCommonsProvider.js");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var o=require("../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchProvider.js");require("react"),require("../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js"),require("../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.scss.js"),require("../../componentsV2/Text/Text.js"),require("../../componentsV2/Grid/Grid.js"),require("classnames"),require("../../componentsV2/Grid/Grid.scss.js"),require("../../componentsV2/Header/Header.scss.js"),require("../../componentsV2/Button/Button.js"),require("../../componentsV2/ButtonIcon/ButtonIcon.js"),require("@material-ui/core"),require("../../components/DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider/IsInsideIsolatedDcAppProvider.js"),require("../../components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/IsInsideDcFullscreenElemProvider.js"),require("../../components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js"),require("uuid"),require("../../componentsV2/Tooltip/Tooltip.scss.js"),require("../../componentsV2/Paper/Paper.js"),require("../../componentsV2/Popover/Popover.scss.js"),require("../../componentsV2/Radio/Radio.js"),require("../../componentsV2/RadioAndCheckboxGroup/RadioAndCheckboxGroup.scss.js"),require("../../componentsV2/Checkbox/Checkbox.js"),require("../../componentsV2/TextInput/TextInput.js"),require("lodash"),require("../../componentsV2/TextEndTruncated/TextEndTruncated.scss.js"),require("../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.constants.js"),require("../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.scss.js"),require("../../componentsV2/TextLink/TextLink.js"),require("../../componentsV2/Chip/Chip.js"),require("../../componentsV2/ChipAlert/ChipAlert.js"),require("../../componentsV2/ChipIndicator/ChipIndicator.js"),require("../../componentsV2/Avatar/Avatar.js"),require("../../componentsV2/Avatar/constants.js"),require("../../componentsV2/AvatarGroup/AvatarGroup.scss.js"),require("@material-ui/lab"),require("../../componentsV2/ToggleButtons/ToggleButtons.scss.js"),require("../../componentsV2/ModalWindow/ModalWindow.scss.js"),require("@icon-park/react/es/all"),require("../../icons/IconParkProvider.js"),require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../componentsV2/Modal/Modal.scss.js"),require("../../componentsV2/Menu/Menu.js"),require("../../componentsV2/Counter/Counter.js"),require("../../componentsV2/BadgeBase/BadgeBase.scss.js"),require("../../componentsV2/BadgeDot/BadgeDot.scss.js"),require("../../componentsV2/LoaderLinear/LoaderLinear.scss.js"),require("../../componentsV2/LoaderLogo/LoaderLogo.scss.js"),require("../../componentsV2/Switch/Switch.js"),require("../../componentsV2/Tabs/Tabs.js"),require("../../componentsV2/EmptyState/EmptyState.scss.js"),require("../../componentsV2/FileIcon/FileIcon.js"),require("react-dropzone"),require("../../utils/index.js"),require("../../componentsV2/FilesDropzone/FilesDropzone.scss.js"),require("../../componentsV2/FilesLoader/FilesLoader.scss.js"),require("../../componentsV2/FilesProcessor/FilesProcessor.scss.js"),require("../../componentsV2/Skeleton/Skeleton.scss.js"),require("../../utils/main.js"),require("../../componentsV2/CopyToClipboard/CopyToClipboard.scss.js"),require("../../componentsV2/Stepper/Step/Step.scss.js"),require("../../componentsV2/Stepper/Stepper.scss.js"),require("../../componentsV2/ButtonLive/ButtonLive.js"),require("../../componentsV2/LiveDotIndicator/LiveDotIndicator.scss.js"),require("../../componentsV2/IndicatorLive/IndicatorLive.scss.js"),require("../../componentsV2/Accordion/Accordion.scss.js"),require("../../componentsV2/Breadcrumbs/Breadcrumbs.scss.js"),require("../../componentsV2/BadgeComment/BadgeComment.js"),require("../../componentsV2/AppContainer/AppContainer.js"),require("../../componentsV2/AppContainer/AppContainer.constants.js"),require("../../componentsV2/AppFooter/AppFooter.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../utils/env.js"),require("../../components/GradientManager/configuration/constants.js"),require("../../componentsV2/AppHeader/AppHeader.constants.js"),require("../../componentsV2/AppHeader/AppBadge/AppBadge.scss.js"),require("../../components/DevCenter/DevCenterRouterContext/DevCenterRouterContext.js"),require("../../components/DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react-router"),require("../../componentsV2/AppHeader/AppAssets/utils.js"),require("../../componentsV2/AppHeader/AppAssets/AppAssets.scss.js"),require("../../components/PadModeSelect/PadModeSelect.js"),require("../../componentsV2/AppHeader/PadMode/PadMode.scss.js"),require("../../constants/streamSourceType.js"),require("../../types/shared/Completions.js"),require("../../components/PadModeSelect/types.js"),require("lodash/flatten"),require("lodash/partition"),require("../../componentsV2/PadModeSelect/FracModeLabel/FracModeLabel.js"),require("../../clients/jsonApi/index.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/subscriptions.js"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("../../componentsV2/PadModeSelect/WellStreamActivityStatus/WellStreamActivityStatus.scss.js"),require("../../componentsV2/PadModeSelect/PadModeSelect.scss.js"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("jsona"),require("../../components/StatusBadge/constants.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js"),require("../../componentsV2/UniversalLink/UniversalLink.scss.js"),require("../../componentsV2/AppHeader/V3/AssetChips/AssetChips.scss.js"),require("../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.js"),require("../../componentsV2/AppFooter/DqPopover/DqStatusIcon/DqStatusIcon.js"),require("../../componentsV2/AppDqPopover/DqAlertTooltip/DqAlertTooltip.scss.js"),require("../../componentsV2/AppDqPopover/DqAlert/DqAlert.scss.js"),require("../../componentsV2/AppDqPopover/DqAsset/DqAsset.scss.js"),require("../../componentsV2/AppDqPopover/AppDqPopover.scss.js"),require("../../components/AppIcon/AppIcon.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorChip/AssetSelectorChip.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/AssetSelectorSelect.scss.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/loadAssets.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelector.scss.js"),require("../../componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js"),require("../../componentsV2/AppHeader/V3/constants.scss.js"),require("@babel/runtime/helpers/typeof"),require("../../componentsV2/AppSizeProvider/AppSizeProvider.js"),require("../../componentsV2/AppSettings/AppSettings.js"),require("../../componentsV2/AppSettings/AppSettingsPinningContext.js"),require("../../componentsV2/AppHeader/V3/SettingsPopover/SettingsPopover.scss.js"),require("../../componentsV2/AppHeader/V3/Actions/Actions.scss.js"),require("../../componentsV2/AppHeader/V3/AppHeaderV3.scss.js"),require("../../componentsV2/AppHeader/AppHeader.scss.js"),require("../../componentsV2/OffsetWellsButton/OffsetWellsButton.scss.js"),require("../../componentsV2/Autocomplete/Autocomplete.scss.js"),require("../../componentsV2/Menu/MenuItem/MenuItem.scss.js");exports.AppTestWrapper=function(r){var n=r.children,t=r.commentsEnabled,i=r.app,c=r.appId,p=r.appSettings,u=r.onSettingChange,a=void 0===u?function(){}:u,m=r.onSettingsChange,q=void 0===m?function(){}:m,d=r.wells,l=r.well,j=r.rig,A=r.maximized,V=r.fracFleet,C=r.dashboardMeta,v=void 0===C?{v3:!1,isMultiAsset:!1,isMultiWell:!1}:C;return e.jsx(s.AppCommonsProvider,{app:i||{},appId:c||-1,appSettings:p||{},onSettingChange:a||function(){},onSettingsChange:q,wells:d,well:l,rig:j,maximized:!!A,fracFleet:V,dashboardMeta:v,setMaximized:function(){},children:e.jsx(o.CommentsSwitchProvider,{initial:t,children:n})})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../componentsV2/AppCommonsProvider/AppCommonsProvider.js");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var o=require("../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchProvider.js");require("react"),require("../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js"),require("../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.scss.js"),require("../../componentsV2/Text/Text.js"),require("../../componentsV2/Grid/Grid.js"),require("classnames"),require("../../componentsV2/Grid/Grid.scss.js"),require("../../componentsV2/Header/Header.scss.js"),require("../../componentsV2/Button/Button.js"),require("../../componentsV2/ButtonIcon/ButtonIcon.js"),require("@material-ui/core"),require("../../components/DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider/IsInsideIsolatedDcAppProvider.js"),require("../../components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/IsInsideDcFullscreenElemProvider.js"),require("../../components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js"),require("uuid"),require("../../componentsV2/Tooltip/Tooltip.scss.js"),require("../../componentsV2/Paper/Paper.js"),require("../../componentsV2/Popover/Popover.scss.js"),require("../../componentsV2/Radio/Radio.js"),require("../../componentsV2/RadioAndCheckboxGroup/RadioAndCheckboxGroup.scss.js"),require("../../componentsV2/Checkbox/Checkbox.js"),require("../../componentsV2/TextInput/TextInput.js"),require("lodash"),require("../../componentsV2/TextEndTruncated/TextEndTruncated.scss.js"),require("../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.constants.js"),require("../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.scss.js"),require("../../componentsV2/TextLink/TextLink.js"),require("../../componentsV2/Chip/Chip.js"),require("../../componentsV2/ChipAlert/ChipAlert.js"),require("../../componentsV2/ChipIndicator/ChipIndicator.js"),require("../../componentsV2/Avatar/Avatar.js"),require("../../componentsV2/Avatar/constants.js"),require("../../componentsV2/AvatarGroup/AvatarGroup.scss.js"),require("@material-ui/lab"),require("../../componentsV2/ToggleButtons/ToggleButtons.scss.js"),require("../../componentsV2/ModalWindow/ModalWindow.scss.js"),require("@icon-park/react/es/all"),require("../../icons/IconParkProvider.js"),require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../componentsV2/Modal/Modal.scss.js"),require("../../componentsV2/Menu/Menu.js"),require("../../componentsV2/Counter/Counter.js"),require("../../componentsV2/BadgeBase/BadgeBase.scss.js"),require("../../componentsV2/BadgeDot/BadgeDot.scss.js"),require("../../componentsV2/LoaderLinear/LoaderLinear.scss.js"),require("../../componentsV2/LoaderLogo/LoaderLogo.scss.js"),require("../../componentsV2/Switch/Switch.js"),require("../../componentsV2/Tabs/Tabs.js"),require("../../componentsV2/EmptyState/EmptyState.scss.js"),require("../../componentsV2/FileIcon/FileIcon.js"),require("react-dropzone"),require("../../utils/index.js"),require("../../componentsV2/FilesDropzone/FilesDropzone.scss.js"),require("../../componentsV2/FilesLoader/FilesLoader.scss.js"),require("../../componentsV2/FilesProcessor/FilesProcessor.scss.js"),require("../../componentsV2/Skeleton/Skeleton.scss.js"),require("../../utils/main.js"),require("../../componentsV2/CopyToClipboard/CopyToClipboard.scss.js"),require("../../componentsV2/Stepper/Step/Step.scss.js"),require("../../componentsV2/Stepper/Stepper.scss.js"),require("../../componentsV2/ButtonLive/ButtonLive.js"),require("../../componentsV2/LiveDotIndicator/LiveDotIndicator.scss.js"),require("../../componentsV2/IndicatorLive/IndicatorLive.scss.js"),require("../../componentsV2/Accordion/Accordion.scss.js"),require("../../componentsV2/Breadcrumbs/Breadcrumbs.scss.js"),require("../../componentsV2/BadgeComment/BadgeComment.js"),require("../../componentsV2/AppContainer/AppContainer.js"),require("../../componentsV2/AppContainer/AppContainer.constants.js"),require("../../componentsV2/AppFooter/AppFooter.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../utils/env.js"),require("../../components/GradientManager/configuration/constants.js"),require("../../componentsV2/AppHeader/AppHeader.constants.js"),require("../../componentsV2/AppHeader/AppBadge/AppBadge.scss.js"),require("../../components/DevCenter/DevCenterRouterContext/DevCenterRouterContext.js"),require("../../components/DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react-router"),require("../../componentsV2/AppHeader/AppAssets/utils.js"),require("../../componentsV2/AppHeader/AppAssets/AppAssets.scss.js"),require("../../components/PadModeSelect/PadModeSelect.js"),require("../../componentsV2/AppHeader/PadMode/PadMode.scss.js"),require("../../constants/streamSourceType.js"),require("../../types/shared/Completions.js"),require("../../components/PadModeSelect/types.js"),require("lodash/flatten"),require("lodash/partition"),require("../../componentsV2/PadModeSelect/FracModeLabel/FracModeLabel.js"),require("../../clients/jsonApi/index.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/subscriptions/constants.js"),require("../../clients/subscriptions.v1.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("../../componentsV2/PadModeSelect/WellStreamActivityStatus/WellStreamActivityStatus.scss.js"),require("../../componentsV2/PadModeSelect/PadModeSelect.scss.js"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("jsona"),require("../../components/StatusBadge/constants.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js"),require("../../componentsV2/UniversalLink/UniversalLink.scss.js"),require("../../componentsV2/AppHeader/V3/AssetChips/AssetChips.scss.js"),require("../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.js"),require("../../componentsV2/AppFooter/DqPopover/DqStatusIcon/DqStatusIcon.js"),require("../../componentsV2/AppDqPopover/DqAlertTooltip/DqAlertTooltip.scss.js"),require("../../componentsV2/AppDqPopover/DqAlert/DqAlert.scss.js"),require("../../componentsV2/AppDqPopover/DqAsset/DqAsset.scss.js"),require("../../componentsV2/AppDqPopover/AppDqPopover.scss.js"),require("../../components/AppIcon/AppIcon.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorChip/AssetSelectorChip.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/AssetSelectorSelect.scss.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/loadAssets.js"),require("../../componentsV2/AppHeader/V3/AssetSelector/AssetSelector.scss.js"),require("../../componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js"),require("../../componentsV2/AppHeader/V3/constants.scss.js"),require("@babel/runtime/helpers/typeof"),require("../../componentsV2/AppSizeProvider/AppSizeProvider.js"),require("../../componentsV2/AppSettings/AppSettings.js"),require("../../componentsV2/AppSettings/AppSettingsPinningContext.js"),require("../../componentsV2/AppHeader/V3/SettingsPopover/SettingsPopover.scss.js"),require("../../componentsV2/AppHeader/V3/Actions/Actions.scss.js"),require("../../componentsV2/AppHeader/V3/AppHeaderV3.scss.js"),require("../../componentsV2/AppHeader/AppHeader.scss.js"),require("../../componentsV2/OffsetWellsButton/OffsetWellsButton.scss.js"),require("../../componentsV2/Autocomplete/Autocomplete.scss.js"),require("../../componentsV2/Menu/MenuItem/MenuItem.scss.js");exports.AppTestWrapper=function(r){var n=r.children,t=r.commentsEnabled,i=r.app,c=r.appId,p=r.appSettings,u=r.onSettingChange,a=void 0===u?function(){}:u,m=r.onSettingsChange,q=void 0===m?function(){}:m,l=r.wells,d=r.well,j=r.rig,A=r.maximized,V=r.fracFleet,C=r.dashboardMeta,v=void 0===C?{v3:!1,isMultiAsset:!1,isMultiWell:!1}:C;return e.jsx(s.AppCommonsProvider,{app:i||{},appId:c||-1,appSettings:p||{},onSettingChange:a||function(){},onSettingsChange:q,wells:l,well:d,rig:j,maximized:!!A,fracFleet:V,dashboardMeta:v,setMaximized:function(){},children:e.jsx(o.CommentsSwitchProvider,{initial:t,children:n})})};
|
|
2
2
|
//# sourceMappingURL=AppTestWrapper.js.map
|
package/clients/index.d.ts
CHANGED
|
@@ -23,9 +23,16 @@ export namespace corvaDataAPI {
|
|
|
23
23
|
export function del_1(path: any, queryParams?: {}, requestOptions?: {}): Promise<any>;
|
|
24
24
|
export { del_1 as del };
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export const socketClient: {
|
|
27
|
+
subscribe: <O extends import("./subscriptions/types").SubscribeOptions = import("./subscriptions/types").SubscribeOptions, T = Record<string, any>>(subscription: O, { onDataReceive }: {
|
|
28
|
+
onDataReceive: (data: O & {
|
|
29
|
+
data: T;
|
|
30
|
+
}) => any;
|
|
31
|
+
}) => () => void;
|
|
32
|
+
disconnect: () => void;
|
|
33
|
+
} | {
|
|
34
|
+
subscribe: (subscription: any, { onDataReceive }?: {}) => (...args: any[]) => void;
|
|
35
|
+
};
|
|
29
36
|
import * as clientStorage from './clientStorage';
|
|
30
37
|
import * as jsonApi from './jsonApi';
|
|
31
38
|
import * as subscriptions from './subscriptions';
|
package/clients/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.js"],"names":[],"mappings":";;;IAiBO,6EAEJ;IACe;;;OAEf;IACI,2FAEJ;IACM,6FAEN;IACK,yEAEL;IACI,6EAEJ;;;IAII,sFAC2E;;IAC3E,oGACoF;;IAClF,sGACoF;;IACrF,kFACsE;;IACvE,sFAC2E;;;AAiDlF;;;;;;;;;EAAuF;+BA7FxD,iBAAiB;yBACvB,WAAW;+BACL,iBAAiB;2BAGrB,aAAa"}
|
package/clients/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/defineProperty";import{v4 as r}from"uuid";import{noop as o}from"lodash";import*as n from"./clientStorage/index.js";export{n as clientStorage};import*as e from"./jsonApi/index.js";export{e as jsonApi};import*as i from"./subscriptions.js";export{i as subscriptions};import{get as a,getWithHeaders as
|
|
1
|
+
import t from"@babel/runtime/helpers/defineProperty";import{v4 as r}from"uuid";import{noop as o}from"lodash";import*as n from"./clientStorage/index.js";export{n as clientStorage};import*as e from"./jsonApi/index.js";export{e as jsonApi};import*as i from"./subscriptions.js";export{i as subscriptions};import{get as a,getWithHeaders as c,put as p,patch as s,post as u,del as l}from"./api/apiCore.js";import{CORVA_API_URLS as d}from"./constants.js";import*as v from"./corvaUrls.js";export{v as corvaUrls};import{handleSubscriptionsVersion as f}from"./subscriptions/constants.js";import{socketClientV2 as g}from"./subscriptions/socket-client.v2.js";import*as h from"./sso/index.js";export{h as sso};export{attachHTTPHeaders,getAppKeyFromStackTrace,getAuthorizationHeaders,getAuthorizationToken}from"./utils.js";function m(t,r){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),o.push.apply(o,n)}return o}function b(r){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?m(Object(n),!0).forEach((function(o){t(r,o,n[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}var j={get:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a(t,r,o)},getWithHeaders:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(t,r,o)},put:function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p(t,r,o,n)},patch:function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return s(t,r,o,n)},post:function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(t,r,o)},del:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(t,r,o)}},A={get:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a(t,r,b({apiUrl:d.DATA_API},o))},put:function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p(t,r,o,b({apiUrl:d.DATA_API},n))},patch:function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return s(t,r,o,b({apiUrl:d.DATA_API},n))},post:function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(t,r,b({apiUrl:d.DATA_API},o))},del:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(t,r,b({apiUrl:d.DATA_API},o))}};function O(){if(window.xprops){var t,o,n,e,i,a=(null===(t=window.xprops)||void 0===t||null===(o=t.app)||void 0===o||null===(n=o.app)||void 0===n?void 0:n.id)||"unknown-app-id",c=(null===(e=window.xprops)||void 0===e||null===(i=e.app)||void 0===i?void 0:i.id)||"unknown-instance-id";return"".concat(a,":").concat(c,":").concat(r())}return"non-dc-app:".concat(r())}var w=f({subscribe:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.onDataReceive,e=window[Symbol.for("socket")]||{},i=e.subscribe,a=e.unsubscribe,c=e.socket;if(!c)return console.error("Socket is not initialized!"),o;var p=O(),s=b(b({},t),{},{collection:t.collection||t.dataset,appInstanceId:p}),u=n&&function(t){return t.appInstanceId===p&&n(t)};return i(s),u&&c.on("data",u),function(){u&&c.off("data",u),a(s)}}},g);export{j as corvaAPI,A as corvaDataAPI,w as socketClient};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/clients/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/clients/index.js"],"sourcesContent":["import { v4 as uuidV4 } from 'uuid';\nimport { noop } from 'lodash';\n\nimport * as clientStorage from './clientStorage';\nimport * as jsonApi from './jsonApi';\nimport * as subscriptions from './subscriptions';\nimport { get, put, patch, post, del, getWithHeaders } from './api/apiCore';\nimport { CORVA_API_URLS } from './constants';\nimport * as corvaUrls from './corvaUrls';\n\nexport { clientStorage, jsonApi, subscriptions, corvaUrls };\nexport * as sso from './sso';\nexport * from './utils';\n\nexport const corvaAPI = {\n get: (path, queryParams = {}, requestOptions = {}) => {\n return get(path, queryParams, requestOptions);\n },\n getWithHeaders: (path, queryParams = {}, requestOptions = {}) => {\n return getWithHeaders(path, queryParams, requestOptions);\n },\n put: (path, content, queryParams = {}, requestOptions = {}) => {\n return put(path, content, queryParams, requestOptions);\n },\n patch: (path, content, queryParams = {}, requestOptions = {}) => {\n return patch(path, content, queryParams, requestOptions);\n },\n post: (path, entity, requestOptions = {}) => {\n return post(path, entity, requestOptions);\n },\n del: (path, queryParams = {}, requestOptions = {}) => {\n return del(path, queryParams, requestOptions);\n },\n};\n\nexport const corvaDataAPI = {\n get: (path, queryParams = {}, requestOptions = {}) =>\n get(path, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n put: (path, content, queryParams = {}, requestOptions = {}) =>\n put(path, content, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n patch: (path, content, queryParams = {}, requestOptions = {}) =>\n patch(path, content, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n post: (path, entity, requestOptions = {}) =>\n post(path, entity, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n del: (path, queryParams = {}, requestOptions = {}) =>\n del(path, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n};\n\nconst SOCKET_NOT_INITIALIZED_ERROR = 'Socket is not initialized!';\n\nfunction getAppInstanceId() {\n if (window.xprops) {\n const appId = window.xprops?.app?.app?.id || 'unknown-app-id';\n const appInstanceId = window.xprops?.app?.id || 'unknown-instance-id';\n\n return `${appId}:${appInstanceId}:${uuidV4()}`;\n }\n\n return `non-dc-app:${uuidV4()}`;\n}\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/clients/index.js"],"sourcesContent":["import { v4 as uuidV4 } from 'uuid';\nimport { noop } from 'lodash';\n\nimport * as clientStorage from './clientStorage';\nimport * as jsonApi from './jsonApi';\nimport * as subscriptions from './subscriptions';\nimport { get, put, patch, post, del, getWithHeaders } from './api/apiCore';\nimport { CORVA_API_URLS } from './constants';\nimport * as corvaUrls from './corvaUrls';\nimport { handleSubscriptionsVersion } from './subscriptions/constants';\nimport { socketClientV2 } from './subscriptions/socket-client.v2';\n\nexport { clientStorage, jsonApi, subscriptions, corvaUrls };\nexport * as sso from './sso';\nexport * from './utils';\n\nexport const corvaAPI = {\n get: (path, queryParams = {}, requestOptions = {}) => {\n return get(path, queryParams, requestOptions);\n },\n getWithHeaders: (path, queryParams = {}, requestOptions = {}) => {\n return getWithHeaders(path, queryParams, requestOptions);\n },\n put: (path, content, queryParams = {}, requestOptions = {}) => {\n return put(path, content, queryParams, requestOptions);\n },\n patch: (path, content, queryParams = {}, requestOptions = {}) => {\n return patch(path, content, queryParams, requestOptions);\n },\n post: (path, entity, requestOptions = {}) => {\n return post(path, entity, requestOptions);\n },\n del: (path, queryParams = {}, requestOptions = {}) => {\n return del(path, queryParams, requestOptions);\n },\n};\n\nexport const corvaDataAPI = {\n get: (path, queryParams = {}, requestOptions = {}) =>\n get(path, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n put: (path, content, queryParams = {}, requestOptions = {}) =>\n put(path, content, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n patch: (path, content, queryParams = {}, requestOptions = {}) =>\n patch(path, content, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n post: (path, entity, requestOptions = {}) =>\n post(path, entity, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n del: (path, queryParams = {}, requestOptions = {}) =>\n del(path, queryParams, { apiUrl: CORVA_API_URLS.DATA_API, ...requestOptions }),\n};\n\nconst SOCKET_NOT_INITIALIZED_ERROR = 'Socket is not initialized!';\n\nfunction getAppInstanceId() {\n if (window.xprops) {\n const appId = window.xprops?.app?.app?.id || 'unknown-app-id';\n const appInstanceId = window.xprops?.app?.id || 'unknown-instance-id';\n\n return `${appId}:${appInstanceId}:${uuidV4()}`;\n }\n\n return `non-dc-app:${uuidV4()}`;\n}\n\nconst socketClientV1 = {\n subscribe: (subscription, { onDataReceive } = {}) => {\n const { subscribe, unsubscribe, socket } = window[Symbol.for('socket')] || {};\n\n if (!socket) {\n console.error(SOCKET_NOT_INITIALIZED_ERROR);\n // In some environments, like PDF Dashboard Report, socket is not initialized\n // But socketClient should not throw errors to prevent apps crashing\n return noop;\n }\n const subId = getAppInstanceId();\n const subscriptionWithId = {\n ...subscription,\n // NOTE: Add ability to pass dataset (because we don't use \"collection\" in new data api)\n collection: subscription.collection || subscription.dataset,\n // NOTE: Unique id is required for subscriptions server\n appInstanceId: subId,\n };\n\n const onData =\n onDataReceive && (event => event.appInstanceId === subId && onDataReceive(event));\n\n subscribe(subscriptionWithId);\n if (onData) socket.on('data', onData);\n\n // NOTE: Return unsubscribe\n return () => {\n if (onData) socket.off('data', onData);\n unsubscribe(subscriptionWithId);\n };\n },\n};\n\nexport const socketClient = handleSubscriptionsVersion(socketClientV1, socketClientV2);\n"],"names":["corvaAPI","get","path","queryParams","arguments","length","undefined","requestOptions","getWithHeaders","put","content","patch","post","entity","del","corvaDataAPI","_objectSpread","apiUrl","CORVA_API_URLS","DATA_API","getAppInstanceId","window","xprops","_window$xprops","_window$xprops$app","_window$xprops$app$ap","_window$xprops2","_window$xprops2$app","appId","app","id","appInstanceId","concat","uuidV4","socketClient","handleSubscriptionsVersion","subscribe","subscription","_ref","onDataReceive","Symbol","for","unsubscribe","socket","console","error","noop","subId","subscriptionWithId","collection","dataset","onData","event","on","off","socketClientV2"],"mappings":"u2CAgBO,IAAMA,EAAW,CACtBC,IAAK,SAACC,GAAgD,IAA1CC,EAAcC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAA,CAAA,EAAIG,EA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AAC,EAAAC,EAAAC,EAAAC,EACXC,GAAQ,QAAAL,EAAAF,OAAOC,cAAP,IAAAC,GAAkB,QAAlBC,EAAAD,EAAeM,WAAG,IAAAL,GAAK,QAALC,EAAlBD,EAAoBK,WAAG,IAAAJ,OAAvB,EAAAA,EAAyBK,KAAM,iBACvCC,GAAgB,QAAAV,EAAAA,OAAOC,cAAP,IAAAI,GAAkB,QAAlBC,EAAAD,EAAeG,WAAG,IAAAF,OAAlB,EAAAA,EAAoBG,KAAM,sBAEhD,MAAA,GAAAE,OAAUJ,EAAK,KAAAI,OAAID,EAAa,KAAAC,OAAIC,IACtC,CAEA,MAAA,cAAAD,OAAqBC,IACvB,CAEA,IAiCaC,EAAeC,EAjCL,CACrBC,UAAW,SAACC,GAAyC,IAAAC,EAAAlC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAP,CAAE,EAApBmC,IAAAA,cACiBlB,EAAAA,OAAOmB,OAAOC,IAAI,YAAc,CAAE,EAArEL,IAAAA,UAAWM,IAAAA,YAAaC,IAAAA,OAEhC,IAAKA,EAIH,OAHAC,QAAQC,MAlBuB,8BAqBxBC,EAET,IAAMC,EAAQ3B,IACR4B,SACDX,GAAY,GAAA,CAEfY,WAAYZ,EAAaY,YAAcZ,EAAaa,QAEpDnB,cAAegB,IAGXI,EACJZ,GAAkB,SAAAa,GAAK,OAAIA,EAAMrB,gBAAkBgB,GAASR,EAAca,IAM5E,OAJAhB,EAAUY,GACNG,GAAQR,EAAOU,GAAG,OAAQF,GAGvB,WACDA,GAAQR,EAAOW,IAAI,OAAQH,GAC/BT,EAAYM,GAEhB,GAGqEO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.factory.test.d.ts","sourceRoot":"","sources":["../../../../src/clients/subscriptions/__tests__/subscriptions-client.factory.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.test.d.ts","sourceRoot":"","sources":["../../../../src/clients/subscriptions/__tests__/subscriptions-client.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const handleSubscriptionsVersion: <V1, V2>(v1: V1, v2: V2) => V1 | V2;
|
|
2
|
+
export declare const getNamespace: () => string;
|
|
3
|
+
export declare const SUBSCRIPTIONS_URL: string;
|
|
4
|
+
export declare const IGNORED_ROUTES_REGEXP: RegExp;
|
|
5
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,0BAA0B,GAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAMhE,CAAC;AAEF,eAAO,MAAM,YAAY,cAKxB,CAAC;AAMF,eAAO,MAAM,iBAAiB,QAA4B,CAAC;AAC3D,eAAO,MAAM,qBAAqB,QAA6B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from"query-string";var s=r.parse(window.location.search),o=s.subscriptions_version||localStorage.getItem("subscriptions_version")||"1";localStorage.setItem("subscriptions_version",o);var t=function(r,s){return"1"===o?r:s},n=function(){return"1"===o?"/":"/".concat(o)},e=process.env.REACT_APP_SUBSCRIPTIONS_URL||s.subscriptions_url||"https://subscriptions.qa.corva.ai",i="".concat(e).concat(n()),c=new RegExp("^/reports.*$");export{c as IGNORED_ROUTES_REGEXP,i as SUBSCRIPTIONS_URL,n as getNamespace,t as handleSubscriptionsVersion};
|
|
2
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-channel-name.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/get-channel-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,cAAc,YAAa,gBAAgB,WAoBvD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var c=function(c){var e=c.collection||c.dataset;return c.companyId?c.userId?"company/".concat(c.companyId,"/").concat(e,"/user/").concat(c.userId):"company/".concat(c.companyId,"/").concat(e):c.feed&&c.feed.companyId?"feed/company/".concat(c.feed.companyId):c.feed&&c.feed.userId?"feed/user/".concat(c.feed.userId):"".concat(c.provider,"/").concat(e,"/").concat(c.assetId).concat(c.event?"/"+c.event:"")};export{c as getChannelName};
|
|
2
|
+
//# sourceMappingURL=get-channel-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-channel-name.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SubscribeOptions } from "./types";
|
|
2
|
+
export declare const socketClientV2: {
|
|
3
|
+
subscribe: <O extends SubscribeOptions = SubscribeOptions, T = Record<string, any>>(subscription: O, { onDataReceive }: {
|
|
4
|
+
onDataReceive: (data: O & {
|
|
5
|
+
data: T;
|
|
6
|
+
}) => any;
|
|
7
|
+
}) => () => void;
|
|
8
|
+
disconnect: () => void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=socket-client.v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket-client.v2.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/socket-client.v2.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,cAAc;gBACb,CAAC,SAAS,gBAAgB,qBAAqB,CAAC,sCAAsC,CAAC,qBAAqB;QAAE,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG;YAAE,IAAI,EAAE,CAAC,CAAA;SAAE,KAAK,GAAG,CAAA;KAAE;;CAW1K,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as n}from'./../../ext-esm/tslib/tslib.es6.js';import{getChannelName as t}from"./get-channel-name.js";import{SubscriptionsClientFactory as i}from"./subscriptions-client.factory.js";var e={subscribe:function(e,o){var r=o.onDataReceive,s=i.init(),c=t(e);return s.subscribe(c,(function(t){return r(n(n({},e),{data:t}))}))},disconnect:function(){i.init().disconnect()}};export{e as socketClientV2};
|
|
2
|
+
//# sourceMappingURL=socket-client.v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,yBAAyB,oCAAuC;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Socket } from "socket.io-client";
|
|
2
|
+
import { SubcriptionsClient, SubscriptionsClientV2Events, SubscriptionsClientV2ServerEvents, AcknowledgeCb, OnDataReceive } from "./types";
|
|
3
|
+
export declare class SubscriptionsClientV2 implements SubcriptionsClient {
|
|
4
|
+
private readonly _socket;
|
|
5
|
+
constructor(_socket: Socket<SubscriptionsClientV2Events, SubscriptionsClientV2ServerEvents>);
|
|
6
|
+
subscribe<T>(channel: string, onData: OnDataReceive<T>, ack?: AcknowledgeCb): () => void;
|
|
7
|
+
unsubscribe<T>(channel: string, onData: OnDataReceive<T>, ack?: AcknowledgeCb): void;
|
|
8
|
+
disconnect(): this;
|
|
9
|
+
private _validateArgs;
|
|
10
|
+
private _shouldEmitToServer;
|
|
11
|
+
private _emit;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=subscriptions-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/subscriptions-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3I,qBAAa,qBAAsB,YAAW,kBAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM,CAAC,2BAA2B,EAAE,iCAAiC,CAAC;IAE5G,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa;IAiB3E,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa;IAQ7E,UAAU;IAOV,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,KAAK;CAmBd"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AcknowledgeCb, OnDataReceive, SubcriptionsClient } from "./types";
|
|
2
|
+
export declare class DummySubscriptionsClient implements SubcriptionsClient {
|
|
3
|
+
subscribe<T>(channel: string, onData: OnDataReceive<T>, ack?: AcknowledgeCb): () => void;
|
|
4
|
+
unsubscribe<T>(channel: string, onData: OnDataReceive<T>, ack?: AcknowledgeCb): void;
|
|
5
|
+
disconnect(): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=subscriptions-client.dummy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.dummy.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/subscriptions-client.dummy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE3E,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,IAAI;IAIxF,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,IAAI;IAIpF,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.dummy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.factory.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/subscriptions-client.factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,0BAA0B;WACvB,IAAI;IAQlB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAC5C,OAAO,CAAC,MAAM,CAAC,MAAM;CAkDtB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{io as t}from"socket.io-client";import{IGNORED_ROUTES_REGEXP as n,SUBSCRIPTIONS_URL as e}from"./constants.js";import{SubscriptionsClientV2 as i}from"./subscriptions-client.js";import{DummySubscriptionsClient as r}from"./subscriptions-client.dummy.js";var c=function(){function c(){}return c.init=function(){return this.instance||(this.instance=this.create()),this.instance},c.create=function(){if(n.test(window.location.pathname))return new r;var c=t(e,{transports:["websocket"],autoConnect:!0}),o=0;return c.on("connect",(function(){(o+=1,c.recovered)||1!==o&&Object.keys(c._callbacks).filter((function(t){return t.startsWith("$data#")})).map((function(t){return t.replace("$data#","")})).forEach((function(t){c.emit("subscribe",{channel:t})}))})),new i(c)},c}();export{c as SubscriptionsClientFactory};
|
|
2
|
+
//# sourceMappingURL=subscriptions-client.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.factory.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var t=function(){function t(t){this._socket=t}return t.prototype.subscribe=function(t,e,n){var o=this;this._validateArgs(t,e,n),this._socket.on("data#".concat(t),e),this._emit("subscribe",t,n);var r=function(){return o.unsubscribe(t,e,n)};return Object.defineProperty(r,"name",{value:"unsubscribe_".concat(t.replace(/[^\w]/g,"_")),writable:!1}),r},t.prototype.unsubscribe=function(t,e,n){this._validateArgs(t,e,n),this._emit("unsubscribe",t,n),this._socket.off("data#".concat(t),e)},t.prototype.disconnect=function(){return this._socket.disconnect(),this._socket.removeAllListeners(),this},t.prototype._validateArgs=function(t,e,n){if("string"!=typeof t||!t)throw new Error("Channel must be a non-empty string");if("function"!=typeof e)throw new Error("onData handler must be a function");if(void 0!==n&&"function"!=typeof n)throw new Error("ack must be a function")},t.prototype._shouldEmitToServer=function(t){return 1===this._socket.listeners("data#".concat(t)).length},t.prototype._emit=function(t,e,n){if(!this._shouldEmitToServer(e))return null==n?void 0:n();n?this._socket.emitWithAck(t,{channel:e},(function(o){return o.ok?n():n(new Error("Failed to ".concat(t," to channel ").concat(e,": ").concat(o.error)))})):this._socket.emit(t,{channel:e})},t}();export{t as SubscriptionsClientV2};
|
|
2
|
+
//# sourceMappingURL=subscriptions-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-client.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type CollectionEvent = "" | 'update' | 'destroy';
|
|
2
|
+
export interface SubscribeOptions {
|
|
3
|
+
companyId?: number;
|
|
4
|
+
userId?: number;
|
|
5
|
+
feed?: {
|
|
6
|
+
companyId?: number;
|
|
7
|
+
userId?: number;
|
|
8
|
+
};
|
|
9
|
+
provider?: string;
|
|
10
|
+
collection?: string;
|
|
11
|
+
dataset?: string;
|
|
12
|
+
assetId?: number;
|
|
13
|
+
event?: CollectionEvent;
|
|
14
|
+
}
|
|
15
|
+
export interface AcknowledgeCb {
|
|
16
|
+
(err?: Error): void;
|
|
17
|
+
}
|
|
18
|
+
export interface OnDataReceive<T> {
|
|
19
|
+
(data: T): void | Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface SubscriptionsClientV2Events {
|
|
22
|
+
[event: `data#${string}`]: any;
|
|
23
|
+
}
|
|
24
|
+
export interface SubscriptionsClientV2ServerEvents {
|
|
25
|
+
subscribe: (opts: {
|
|
26
|
+
channel: string;
|
|
27
|
+
}, ack?: AcknowledgeCb) => void;
|
|
28
|
+
unsubscribe: (opts: {
|
|
29
|
+
channel: string;
|
|
30
|
+
}, ack?: AcknowledgeCb) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface SubcriptionsClient {
|
|
33
|
+
subscribe<T>(channel: string, onData: OnDataReceive<T>, ack?: AcknowledgeCb): () => void;
|
|
34
|
+
unsubscribe<T>(channel: string, onData: OnDataReceive<T>, ack?: AcknowledgeCb): void;
|
|
35
|
+
disconnect(): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/subscriptions/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,EAAE,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,2BAA2B;IAC1C,CAAC,KAAK,EAAE,QAAQ,MAAM,EAAE,GAAG,GAAG,CAAC;CAChC;AAED,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACpE,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,IAAI,CAAC;IACzF,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrF,UAAU,IAAI,IAAI,CAAC;CACpB"}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export function getSubscriptionsClient(): {
|
|
3
|
-
connect: any;
|
|
4
|
-
disconnect: any;
|
|
5
|
-
subscribe: any;
|
|
6
|
-
unsubscribe: any;
|
|
7
|
-
};
|
|
8
|
-
export function initializeSocketClient(): void;
|
|
1
|
+
export declare const initializeSocketClient: (({ onDataReceive, onResubscribe }?: {}) => void) | (() => import("./subscriptions/types").SubcriptionsClient);
|
|
9
2
|
//# sourceMappingURL=subscriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/clients/subscriptions.
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/clients/subscriptions.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,gHAAgG,CAAC"}
|
package/clients/subscriptions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{handleSubscriptionsVersion as i}from"./subscriptions/constants.js";import{initializeSocketClient as s}from"./subscriptions.v1.js";import{SubscriptionsClientFactory as t}from"./subscriptions/subscriptions-client.factory.js";var o=i(s,(function(){return t.init()}));export{o as initializeSocketClient};
|
|
2
2
|
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sources":[
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function getSubscriptionId(options: any, hookId?: string): string;
|
|
2
|
+
export function getSubscriptionsClient(): {
|
|
3
|
+
connect: any;
|
|
4
|
+
disconnect: any;
|
|
5
|
+
subscribe: any;
|
|
6
|
+
unsubscribe: any;
|
|
7
|
+
};
|
|
8
|
+
export function initializeSocketClient({ onDataReceive, onResubscribe }?: {}): void;
|
|
9
|
+
//# sourceMappingURL=subscriptions.v1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.v1.d.ts","sourceRoot":"","sources":["../../src/clients/subscriptions.v1.js"],"names":[],"mappings":"AAqCA,yEAIC;AAED;;;;;EAoEC;AAEM,oFAcN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import n from"socket.io-client";import*as c from"query-string";import o from"lodash/noop";var t=new RegExp("^/reports.*$"),e=c.parse(window.location.search).subscriptions_url||process.env.REACT_APP_SUBSCRIPTIONS_URL||"https://subscriptions.qa.corva.ai";function i(n){return t.test(window.location.pathname)?o:n}function r(n,c){return"".concat(n.appInstanceId||c,":").concat(n.companyId,":").concat(n.userId,":").concat(n.collection)}function s(n,c){return"".concat(n.appInstanceId||c,":").concat(n.companyId,":").concat(n.collection)}function a(n,c){return n.event?"".concat(n.appInstanceId||c,":").concat(n.provider,":").concat(n.collection,":").concat(n.assetId,":").concat(n.event):"".concat(n.appInstanceId||c,":").concat(n.provider,":").concat(n.collection,":").concat(n.assetId)}function u(n){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"userId"in n?r(n,c):"companyId"in n?s(n,c):a(n,c)}function d(){var c,o={},t=!1,r=i((function(n){if(!c)throw new Error("Not connected");var t=u(n);t in o&&(delete o[t],c.emit("unsubscribe",n))})),s=i((function(n){if(!c)throw new Error("Not connected");var e=u(n);o[e]=n,t&&c.emit("subscribe",n)})),a=i((function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.onDataReceive,a=void 0===r?void 0:r,u=i.onResubscribe,d=void 0===u?void 0:u,b=!1;return(c=n(e,{transports:["websocket"]})).on("authenticated",(function(){t=!0,Object.values(o).forEach((function(n){s(n),b&&d&&d(n)})),b=!1})),a&&c.on("data",a),c.on("reconnect",(function(){b=!0})),c}));return{connect:a,disconnect:i((function(){c&&(c.disconnect(),c=null)})),subscribe:s,unsubscribe:r}}var b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=n.onDataReceive,o=n.onResubscribe,t=window[Symbol.for("socket")];null!=t&&t.socket&&(console.warn("Existing socket, disconnecting."),t.disconnect());var e=d(),i=e.connect,r=e.disconnect,s=e.subscribe,a=e.unsubscribe,u=i({onDataReceive:c,onResubscribe:o});window[Symbol.for("socket")]={subscribe:s,unsubscribe:a,disconnect:r,socket:u}};export{u as getSubscriptionId,d as getSubscriptionsClient,b as initializeSocketClient};
|
|
2
|
+
//# sourceMappingURL=subscriptions.v1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.v1.js","sources":["../../src/clients/subscriptions.v1.js"],"sourcesContent":["import io from 'socket.io-client';\nimport * as queryString from 'query-string';\nimport noop from 'lodash/noop';\n\nconst REPORTS_ROUTE_REG_EXP = new RegExp('^/reports.*$');\n\nconst parameters = queryString.parse(window.location.search);\nconst socketUrl =\n parameters.subscriptions_url ||\n process.env.REACT_APP_SUBSCRIPTIONS_URL ||\n 'https://subscriptions.qa.corva.ai';\n\nfunction reportsDisableDecorator(func) {\n // NOTE: Disable subscription events on reports pages\n return REPORTS_ROUTE_REG_EXP.test(window.location.pathname) ? noop : func;\n}\n\nfunction getUserSubscriptionId(options, hookId) {\n return `${options.appInstanceId || hookId}:${options.companyId}:${options.userId}:${\n options.collection\n }`;\n}\n\nfunction getCompanySubscriptionId(options, hookId) {\n return `${options.appInstanceId || hookId}:${options.companyId}:${options.collection}`;\n}\n\nfunction getAssetSubscriptionId(options, hookId) {\n return options.event\n ? `${options.appInstanceId || hookId}:${options.provider}:${options.collection}:${\n options.assetId\n }:${options.event}`\n : `${options.appInstanceId || hookId}:${options.provider}:${options.collection}:${\n options.assetId\n }`;\n}\n\nexport function getSubscriptionId(options, hookId = '') {\n if ('userId' in options) return getUserSubscriptionId(options, hookId);\n else if ('companyId' in options) return getCompanySubscriptionId(options, hookId);\n return getAssetSubscriptionId(options, hookId);\n}\n\nexport function getSubscriptionsClient() {\n let socket;\n\n // NOTE: Is used in order to reset subscriptions in case of network failure\n const subscriptions = {};\n let isAuthenticated = false;\n\n const unsubscribe = reportsDisableDecorator(options => {\n if (!socket) {\n throw new Error('Not connected');\n }\n const subscriptionId = getSubscriptionId(options);\n\n if (subscriptionId in subscriptions) {\n delete subscriptions[subscriptionId];\n socket.emit('unsubscribe', options);\n }\n });\n\n const subscribe = reportsDisableDecorator(options => {\n if (!socket) {\n throw new Error('Not connected');\n }\n\n const subscriptionId = getSubscriptionId(options);\n subscriptions[subscriptionId] = options;\n\n // NOTE: Events could be:\n // 1) 'update' - fires in case of records are updated;\n // 2) 'destroy' - fires in case or records are destroyed;\n // 3) '' (empty) - fires in case of new records are created;\n if (isAuthenticated) {\n socket.emit('subscribe', options);\n }\n });\n\n const connect = reportsDisableDecorator(\n ({ onDataReceive = undefined, onResubscribe = undefined } = {}) => {\n let resubscribe = false;\n\n socket = io(socketUrl, { transports: ['websocket'] });\n // TODO: Once authentication is moved on connect, move this as well\n socket.on('authenticated', () => {\n isAuthenticated = true;\n Object.values(subscriptions).forEach(subscription => {\n subscribe(subscription);\n if (resubscribe && onResubscribe) onResubscribe(subscription);\n });\n resubscribe = false;\n });\n if (onDataReceive) socket.on('data', onDataReceive);\n\n socket.on('reconnect', () => {\n resubscribe = true;\n });\n\n return socket;\n }\n );\n\n const disconnect = reportsDisableDecorator(() => {\n if (socket) {\n socket.disconnect();\n socket = null;\n }\n });\n\n return { connect, disconnect, subscribe, unsubscribe };\n}\n\nexport const initializeSocketClient = ({ onDataReceive, onResubscribe } = {}) => {\n const existingSocket = window[Symbol.for('socket')];\n if (existingSocket?.socket) {\n console.warn('Existing socket, disconnecting.');\n existingSocket.disconnect();\n }\n const { connect, disconnect, subscribe, unsubscribe } = getSubscriptionsClient();\n const socket = connect({ onDataReceive, onResubscribe });\n window[Symbol.for('socket')] = {\n subscribe,\n unsubscribe,\n disconnect,\n socket,\n };\n};\n"],"names":["REPORTS_ROUTE_REG_EXP","RegExp","socketUrl","queryString","parse","window","location","search","subscriptions_url","process","env","REACT_APP_SUBSCRIPTIONS_URL","reportsDisableDecorator","func","test","pathname","noop","getUserSubscriptionId","options","hookId","concat","appInstanceId","companyId","userId","collection","getCompanySubscriptionId","getAssetSubscriptionId","event","provider","assetId","getSubscriptionId","getSubscriptionsClient","socket","subscriptions","isAuthenticated","unsubscribe","Error","subscriptionId","emit","subscribe","connect","_ref","arguments","length","undefined","_ref$onDataReceive","onDataReceive","_ref$onResubscribe","onResubscribe","resubscribe","io","transports","on","Object","values","forEach","subscription","disconnect","initializeSocketClient","_ref2","existingSocket","Symbol","for","console","warn","_getSubscriptionsClie"],"mappings":"0FAIA,IAAMA,EAAwB,IAAIC,OAAO,gBAGnCC,EADaC,EAAYC,MAAMC,OAAOC,SAASC,QAExCC,mBACXC,QAAQC,IAAIC,6BACZ,oCAEF,SAASC,EAAwBC,GAE/B,OAAOb,EAAsBc,KAAKT,OAAOC,SAASS,UAAYC,EAAOH,CACvE,CAEA,SAASI,EAAsBC,EAASC,GACtC,MAAA,GAAAC,OAAUF,EAAQG,eAAiBF,cAAUD,EAAQI,UAAS,KAAAF,OAAIF,EAAQK,OACxEL,KAAAA,OAAAA,EAAQM,WAEZ,CAEA,SAASC,EAAyBP,EAASC,GACzC,MAAA,GAAAC,OAAUF,EAAQG,eAAiBF,EAAM,KAAAC,OAAIF,EAAQI,UAAS,KAAAF,OAAIF,EAAQM,WAC5E,CAEA,SAASE,EAAuBR,EAASC,GACvC,OAAOD,EAAQS,gBACRT,EAAQG,eAAiBF,cAAUD,EAAQU,SAAYV,KAAAA,OAAAA,EAAQM,WAAU,KAAAJ,OAC1EF,EAAQW,oBACNX,EAAQS,OACTT,GAAAA,OAAAA,EAAQG,eAAiBF,EAAUD,KAAAA,OAAAA,EAAQU,SAAQ,KAAAR,OAAIF,EAAQM,uBAChEN,EAAQW,QAEhB,CAEO,SAASC,EAAkBZ,GAAsB,IAAbC,yDAAS,GAClD,MAAI,WAAYD,EAAgBD,EAAsBC,EAASC,GACtD,cAAeD,EAAgBO,EAAyBP,EAASC,GACnEO,EAAuBR,EAASC,EACzC,CAEO,SAASY,IACd,IAAIC,EAGEC,EAAgB,CAAA,EAClBC,GAAkB,EAEhBC,EAAcvB,GAAwB,SAAAM,GAC1C,IAAKc,EACH,MAAM,IAAII,MAAM,iBAElB,IAAMC,EAAiBP,EAAkBZ,GAErCmB,KAAkBJ,WACbA,EAAcI,GACrBL,EAAOM,KAAK,cAAepB,GAE/B,I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