@northern.tech/store 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BillingProfile-ChP2_Sqw.d.cts +45 -0
- package/dist/BillingProfile-ChP2_Sqw.d.ts +45 -0
- package/dist/actions.cjs +2 -6
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.js +12 -12
- package/dist/api/general-api.cjs.map +1 -1
- package/dist/api/general-api.js +5 -5
- package/dist/api/users-api.cjs.map +1 -1
- package/dist/api/users-api.js +6 -6
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +7 -7
- package/dist/appSlice/constants.d.ts +7 -7
- package/dist/appSlice/constants.js +1 -1
- package/dist/appSlice/index.cjs +1 -3
- package/dist/appSlice/index.cjs.map +1 -1
- package/dist/appSlice/index.js +4 -4
- package/dist/appSlice/thunks.cjs +16 -26
- package/dist/appSlice/thunks.cjs.map +1 -1
- package/dist/appSlice/thunks.js +28 -27
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.js +4 -4
- package/dist/{chunk-LGNOTPUG.js → chunk-4RWZR3BN.js} +23 -25
- package/dist/{chunk-LGNOTPUG.js.map → chunk-4RWZR3BN.js.map} +1 -1
- package/dist/{chunk-TUACATJA.js → chunk-7YZCUAXZ.js} +2 -2
- package/dist/{chunk-7PVGDMNM.js → chunk-AFICTIVU.js} +3 -5
- package/dist/{chunk-7PVGDMNM.js.map → chunk-AFICTIVU.js.map} +1 -1
- package/dist/{chunk-YT73QWCN.js → chunk-AUBJUUP3.js} +3 -3
- package/dist/{chunk-VMNMD6KF.js → chunk-AVX7VVOK.js} +3 -3
- package/dist/{chunk-4B3IMP4I.js → chunk-BSN2TOQC.js} +1 -1
- package/dist/{chunk-4B3IMP4I.js.map → chunk-BSN2TOQC.js.map} +1 -1
- package/dist/{chunk-X7IEZBM4.js → chunk-DCEKU6UV.js} +2 -2
- package/dist/{chunk-HPBE6KYY.js → chunk-DGQKXSRI.js} +3 -3
- package/dist/{chunk-2JHFUQ6B.js → chunk-EQLHIPPR.js} +88 -85
- package/dist/chunk-EQLHIPPR.js.map +1 -0
- package/dist/{chunk-LTKOV26W.js → chunk-EYCORLYU.js} +30 -28
- package/dist/chunk-EYCORLYU.js.map +1 -0
- package/dist/{chunk-WXL7PVI5.js → chunk-FQDSV3NK.js} +4 -4
- package/dist/{chunk-TI2RL5P2.js → chunk-FRSA2YB5.js} +3 -3
- package/dist/{chunk-DCK2DBOA.js → chunk-FVCYB5OP.js} +22 -24
- package/dist/{chunk-DCK2DBOA.js.map → chunk-FVCYB5OP.js.map} +1 -1
- package/dist/{chunk-AMGWP7A4.js → chunk-GAI4VYRZ.js} +2 -2
- package/dist/{chunk-4XJMRVFI.js → chunk-GWJIY56H.js} +10 -12
- package/dist/chunk-GWJIY56H.js.map +1 -0
- package/dist/{chunk-2CYOM4BK.js → chunk-JO33IORF.js} +2 -2
- package/dist/chunk-K4MMUDYT.js +391 -0
- package/dist/chunk-K4MMUDYT.js.map +1 -0
- package/dist/{chunk-YDS36ALB.js → chunk-L3SY3J5M.js} +3 -3
- package/dist/{chunk-JAROCU6M.js → chunk-NCSKCF2S.js} +3 -3
- package/dist/{chunk-CYV6632F.js → chunk-NOQR3TE7.js} +2 -2
- package/dist/{chunk-C5NEDBJI.js → chunk-OEP2D6QL.js} +3 -3
- package/dist/{chunk-C5NEDBJI.js.map → chunk-OEP2D6QL.js.map} +1 -1
- package/dist/{chunk-LEMVXAYP.js → chunk-PAIB5V27.js} +15 -15
- package/dist/{chunk-FGKMJS3B.js → chunk-RX32WLVJ.js} +2 -4
- package/dist/chunk-RX32WLVJ.js.map +1 -0
- package/dist/{chunk-QRGTG4YB.js → chunk-X3GZILYD.js} +3 -3
- package/dist/{chunk-UWMYZNUB.js → chunk-Y575RZHR.js} +1 -1
- package/dist/{chunk-UWMYZNUB.js.map → chunk-Y575RZHR.js.map} +1 -1
- package/dist/{chunk-7JKWI5FK.js → chunk-ZWOAFHAR.js} +2 -2
- package/dist/{chunk-DAPAXWA5.js → chunk-ZZMFXRQK.js} +12 -12
- package/dist/commonConstants.cjs.map +1 -1
- package/dist/commonConstants.d.cts +1 -1
- package/dist/commonConstants.d.ts +1 -1
- package/dist/commonConstants.js +1 -1
- package/dist/commonSelectors.cjs +7 -11
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.d.cts +12 -11
- package/dist/commonSelectors.d.ts +12 -11
- package/dist/commonSelectors.js +11 -11
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/deploymentdevicehook.cjs +16 -26
- package/dist/deploymentdevicehook.cjs.map +1 -1
- package/dist/deploymentdevicehook.js +30 -29
- package/dist/deploymentdevicehook.js.map +1 -1
- package/dist/deploymentsSlice/constants.cjs.map +1 -1
- package/dist/deploymentsSlice/constants.js +3 -3
- package/dist/deploymentsSlice/index.cjs.map +1 -1
- package/dist/deploymentsSlice/index.js +4 -4
- package/dist/deploymentsSlice/selectors.cjs.map +1 -1
- package/dist/deploymentsSlice/selectors.js +4 -4
- package/dist/deploymentsSlice/thunks.cjs +16 -26
- package/dist/deploymentsSlice/thunks.cjs.map +1 -1
- package/dist/deploymentsSlice/thunks.js +28 -27
- package/dist/devicesSlice/constants.cjs.map +1 -1
- package/dist/devicesSlice/constants.js +3 -3
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.js +4 -4
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.js +4 -4
- package/dist/devicesSlice/thunks.cjs +16 -26
- package/dist/devicesSlice/thunks.cjs.map +1 -1
- package/dist/devicesSlice/thunks.js +28 -27
- package/dist/liststatehook.cjs +971 -0
- package/dist/liststatehook.cjs.map +1 -0
- package/dist/liststatehook.d.cts +246 -0
- package/dist/liststatehook.d.ts +246 -0
- package/dist/liststatehook.js +88 -0
- package/dist/liststatehook.js.map +1 -0
- package/dist/locationutils.cjs +942 -0
- package/dist/locationutils.cjs.map +1 -0
- package/dist/locationutils.d.cts +113 -0
- package/dist/locationutils.d.ts +113 -0
- package/dist/locationutils.js +46 -0
- package/dist/locationutils.js.map +1 -0
- package/dist/monitorSlice/constants.cjs.map +1 -1
- package/dist/monitorSlice/constants.js +3 -3
- package/dist/monitorSlice/index.cjs.map +1 -1
- package/dist/monitorSlice/index.js +4 -4
- package/dist/monitorSlice/thunks.cjs +15 -25
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.js +24 -24
- package/dist/onboardingSlice/index.cjs +1 -3
- package/dist/onboardingSlice/index.cjs.map +1 -1
- package/dist/onboardingSlice/index.js +1 -1
- package/dist/onboardingSlice/thunks.cjs +22 -35
- package/dist/onboardingSlice/thunks.cjs.map +1 -1
- package/dist/onboardingSlice/thunks.d.cts +1 -2
- package/dist/onboardingSlice/thunks.d.ts +1 -2
- package/dist/onboardingSlice/thunks.js +28 -29
- package/dist/organizationSlice/constants.cjs.map +1 -1
- package/dist/organizationSlice/constants.js +3 -3
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +2 -1
- package/dist/organizationSlice/index.d.ts +2 -1
- package/dist/organizationSlice/index.js +4 -4
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +2 -1
- package/dist/organizationSlice/selectors.d.ts +2 -1
- package/dist/organizationSlice/selectors.js +4 -4
- package/dist/organizationSlice/thunks.cjs +38 -44
- package/dist/organizationSlice/thunks.cjs.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +5 -5
- package/dist/organizationSlice/thunks.d.ts +5 -5
- package/dist/organizationSlice/thunks.js +28 -27
- package/dist/organizationSlice/types.cjs.map +1 -1
- package/dist/organizationSlice/types.d.cts +3 -112
- package/dist/organizationSlice/types.d.ts +3 -112
- package/dist/releasesSlice/index.cjs.map +1 -1
- package/dist/releasesSlice/index.js +4 -4
- package/dist/releasesSlice/selectors.cjs +6 -8
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.js +5 -5
- package/dist/releasesSlice/thunks.cjs +51 -46
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.js +25 -24
- package/dist/selectors.cjs +7 -11
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +2 -1
- package/dist/selectors.d.ts +2 -1
- package/dist/selectors.js +37 -37
- package/dist/sockethook.cjs +529 -0
- package/dist/sockethook.cjs.map +1 -0
- package/dist/sockethook.d.cts +10 -0
- package/dist/sockethook.d.ts +10 -0
- package/dist/sockethook.js +141 -0
- package/dist/sockethook.js.map +1 -0
- package/dist/store.cjs +2 -6
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +2 -1
- package/dist/store.d.ts +2 -1
- package/dist/store.js +14 -14
- package/dist/storehooks.cjs +86 -90
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.js +37 -48
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +83 -79
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +2 -2
- package/dist/thunks.d.ts +2 -2
- package/dist/thunks.js +28 -29
- package/dist/types-DBj17FZO.d.cts +135 -0
- package/dist/types-DnfZa6xd.d.ts +135 -0
- package/dist/usersSlice/constants.cjs.map +1 -1
- package/dist/usersSlice/constants.d.cts +6 -6
- package/dist/usersSlice/constants.d.ts +6 -6
- package/dist/usersSlice/constants.js +3 -3
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.js +4 -4
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.js +5 -5
- package/dist/usersSlice/thunks.cjs +16 -26
- package/dist/usersSlice/thunks.cjs.map +1 -1
- package/dist/usersSlice/thunks.js +28 -27
- package/dist/utils.cjs +6 -8
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +4 -4
- package/package.json +6 -5
- package/dist/chunk-2JHFUQ6B.js.map +0 -1
- package/dist/chunk-4XJMRVFI.js.map +0 -1
- package/dist/chunk-FGKMJS3B.js.map +0 -1
- package/dist/chunk-LTKOV26W.js.map +0 -1
- /package/dist/{chunk-TUACATJA.js.map → chunk-7YZCUAXZ.js.map} +0 -0
- /package/dist/{chunk-YT73QWCN.js.map → chunk-AUBJUUP3.js.map} +0 -0
- /package/dist/{chunk-VMNMD6KF.js.map → chunk-AVX7VVOK.js.map} +0 -0
- /package/dist/{chunk-X7IEZBM4.js.map → chunk-DCEKU6UV.js.map} +0 -0
- /package/dist/{chunk-HPBE6KYY.js.map → chunk-DGQKXSRI.js.map} +0 -0
- /package/dist/{chunk-WXL7PVI5.js.map → chunk-FQDSV3NK.js.map} +0 -0
- /package/dist/{chunk-TI2RL5P2.js.map → chunk-FRSA2YB5.js.map} +0 -0
- /package/dist/{chunk-AMGWP7A4.js.map → chunk-GAI4VYRZ.js.map} +0 -0
- /package/dist/{chunk-2CYOM4BK.js.map → chunk-JO33IORF.js.map} +0 -0
- /package/dist/{chunk-YDS36ALB.js.map → chunk-L3SY3J5M.js.map} +0 -0
- /package/dist/{chunk-JAROCU6M.js.map → chunk-NCSKCF2S.js.map} +0 -0
- /package/dist/{chunk-CYV6632F.js.map → chunk-NOQR3TE7.js.map} +0 -0
- /package/dist/{chunk-LEMVXAYP.js.map → chunk-PAIB5V27.js.map} +0 -0
- /package/dist/{chunk-QRGTG4YB.js.map → chunk-X3GZILYD.js.map} +0 -0
- /package/dist/{chunk-7JKWI5FK.js.map → chunk-ZWOAFHAR.js.map} +0 -0
- /package/dist/{chunk-DAPAXWA5.js.map → chunk-ZZMFXRQK.js.map} +0 -0
package/dist/selectors.d.cts
CHANGED
|
@@ -8,11 +8,12 @@ export { getAuditLog, getAuditLogEntry, getAuditLogSelectionState, getAuditlogSt
|
|
|
8
8
|
export { getHasReleases, getReleaseListState, getReleaseTags, getReleaseTagsById, getReleasesById, getReleasesList, getSelectedRelease, getUpdateTypes } from './releasesSlice/selectors.cjs';
|
|
9
9
|
export { getCurrentSession, getCurrentUser, getGlobalSettings, getHas2FA, getIdAttribute, getIsDarkMode, getOfflineThresholdSettings, getRolesById, getRolesList, getSelectedDeviceAttribute, getShowHelptips, getTooltipsById, getTooltipsState, getUserSettings, getUsersById, getUsersList } from './usersSlice/selectors.cjs';
|
|
10
10
|
import 'reselect';
|
|
11
|
+
import './types-DBj17FZO.cjs';
|
|
11
12
|
import './appSlice/constants.cjs';
|
|
12
13
|
import '@mui/material/OverridableComponent';
|
|
13
14
|
import '@mui/material';
|
|
15
|
+
import './BillingProfile-ChP2_Sqw.cjs';
|
|
14
16
|
import './store.cjs';
|
|
15
17
|
import '@reduxjs/toolkit';
|
|
16
18
|
import 'redux-thunk';
|
|
17
19
|
import 'redux';
|
|
18
|
-
import './organizationSlice/types.cjs';
|
package/dist/selectors.d.ts
CHANGED
|
@@ -8,11 +8,12 @@ export { getAuditLog, getAuditLogEntry, getAuditLogSelectionState, getAuditlogSt
|
|
|
8
8
|
export { getHasReleases, getReleaseListState, getReleaseTags, getReleaseTagsById, getReleasesById, getReleasesList, getSelectedRelease, getUpdateTypes } from './releasesSlice/selectors.js';
|
|
9
9
|
export { getCurrentSession, getCurrentUser, getGlobalSettings, getHas2FA, getIdAttribute, getIsDarkMode, getOfflineThresholdSettings, getRolesById, getRolesList, getSelectedDeviceAttribute, getShowHelptips, getTooltipsById, getTooltipsState, getUserSettings, getUsersById, getUsersList } from './usersSlice/selectors.js';
|
|
10
10
|
import 'reselect';
|
|
11
|
+
import './types-DnfZa6xd.js';
|
|
11
12
|
import './appSlice/constants.js';
|
|
12
13
|
import '@mui/material/OverridableComponent';
|
|
13
14
|
import '@mui/material';
|
|
15
|
+
import './BillingProfile-ChP2_Sqw.js';
|
|
14
16
|
import './store.js';
|
|
15
17
|
import '@reduxjs/toolkit';
|
|
16
18
|
import 'redux-thunk';
|
|
17
19
|
import 'redux';
|
|
18
|
-
import './organizationSlice/types.js';
|
package/dist/selectors.js
CHANGED
|
@@ -18,17 +18,16 @@ import {
|
|
|
18
18
|
getTenantCapabilities,
|
|
19
19
|
getUserCapabilities,
|
|
20
20
|
getUserRoles
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FVCYB5OP.js";
|
|
22
22
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from "./chunk-X7IEZBM4.js";
|
|
23
|
+
DEPLOYMENT_CUTOFF,
|
|
24
|
+
getDeploymentsById,
|
|
25
|
+
getDeploymentsByStatus,
|
|
26
|
+
getDeploymentsSelectionState,
|
|
27
|
+
getMappedDeploymentSelection,
|
|
28
|
+
getRecentDeployments,
|
|
29
|
+
getSelectedDeploymentDeviceIds
|
|
30
|
+
} from "./chunk-ZWOAFHAR.js";
|
|
32
31
|
import {
|
|
33
32
|
getCurrentSession,
|
|
34
33
|
getCurrentUser,
|
|
@@ -46,7 +45,7 @@ import {
|
|
|
46
45
|
getUserSettings,
|
|
47
46
|
getUsersById,
|
|
48
47
|
getUsersList
|
|
49
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-FQDSV3NK.js";
|
|
50
49
|
import {
|
|
51
50
|
getAuditLog,
|
|
52
51
|
getAuditLogEntry,
|
|
@@ -62,19 +61,32 @@ import {
|
|
|
62
61
|
getWebhookEventTotal,
|
|
63
62
|
getWebhookEvents,
|
|
64
63
|
getWebhooks
|
|
65
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-JO33IORF.js";
|
|
66
65
|
import {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
getHasReleases,
|
|
67
|
+
getReleaseListState,
|
|
68
|
+
getReleaseTags,
|
|
69
|
+
getReleaseTagsById,
|
|
70
|
+
getReleasesById,
|
|
71
|
+
getReleasesList,
|
|
72
|
+
getSelectedRelease,
|
|
73
|
+
getUpdateTypes
|
|
74
|
+
} from "./chunk-DCEKU6UV.js";
|
|
75
|
+
import {
|
|
76
|
+
getIssueCountsByType
|
|
77
|
+
} from "./chunk-YO22XLHI.js";
|
|
75
78
|
import {
|
|
76
79
|
getOnboarding
|
|
77
80
|
} from "./chunk-JIS4PA3R.js";
|
|
81
|
+
import {
|
|
82
|
+
getDocsVersion,
|
|
83
|
+
getFeatures,
|
|
84
|
+
getFullVersionInformation,
|
|
85
|
+
getIsPreview,
|
|
86
|
+
getSearchState,
|
|
87
|
+
getSearchedDevices,
|
|
88
|
+
getVersionInformation
|
|
89
|
+
} from "./chunk-LIJIIRON.js";
|
|
78
90
|
import {
|
|
79
91
|
getAcceptedDevices,
|
|
80
92
|
getAttributesList,
|
|
@@ -97,25 +109,13 @@ import {
|
|
|
97
109
|
getSelectedGroup,
|
|
98
110
|
getSelectedGroupInfo,
|
|
99
111
|
getSortedFilteringAttributes
|
|
100
|
-
} from "./chunk-
|
|
101
|
-
import
|
|
102
|
-
|
|
103
|
-
} from "./chunk-YO22XLHI.js";
|
|
104
|
-
import "./chunk-4XJMRVFI.js";
|
|
105
|
-
import {
|
|
106
|
-
getDocsVersion,
|
|
107
|
-
getFeatures,
|
|
108
|
-
getFullVersionInformation,
|
|
109
|
-
getIsPreview,
|
|
110
|
-
getSearchState,
|
|
111
|
-
getSearchedDevices,
|
|
112
|
-
getVersionInformation
|
|
113
|
-
} from "./chunk-LIJIIRON.js";
|
|
114
|
-
import "./chunk-C5NEDBJI.js";
|
|
112
|
+
} from "./chunk-L3SY3J5M.js";
|
|
113
|
+
import "./chunk-GWJIY56H.js";
|
|
114
|
+
import "./chunk-OEP2D6QL.js";
|
|
115
115
|
import "./chunk-CK6YE6AN.js";
|
|
116
116
|
import "./chunk-MRCFLG45.js";
|
|
117
|
-
import "./chunk-
|
|
118
|
-
import "./chunk-
|
|
117
|
+
import "./chunk-Y575RZHR.js";
|
|
118
|
+
import "./chunk-BSN2TOQC.js";
|
|
119
119
|
export {
|
|
120
120
|
DEPLOYMENT_CUTOFF,
|
|
121
121
|
getAcceptedDevices,
|
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/sockethook.ts
|
|
31
|
+
var sockethook_exports = {};
|
|
32
|
+
__export(sockethook_exports, {
|
|
33
|
+
useSession: () => useSession
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(sockethook_exports);
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_helpers = require("@northern.tech/utils/helpers");
|
|
38
|
+
var import_msgpack5 = __toESM(require("msgpack5"), 1);
|
|
39
|
+
var import_universal_cookie = __toESM(require("universal-cookie"), 1);
|
|
40
|
+
|
|
41
|
+
// src/appSlice/constants.ts
|
|
42
|
+
var import_icons_material = require("@mui/icons-material");
|
|
43
|
+
var startingDeviceCount = {
|
|
44
|
+
os: "for first 50 devices",
|
|
45
|
+
professional: "for first 250 devices"
|
|
46
|
+
};
|
|
47
|
+
var apiRoot = "/api/management";
|
|
48
|
+
var apiUrl = {
|
|
49
|
+
v1: `${apiRoot}/v1`,
|
|
50
|
+
v2: `${apiRoot}/v2`
|
|
51
|
+
};
|
|
52
|
+
var chartTypes = {
|
|
53
|
+
bar: { key: "bar", Icon: import_icons_material.BarChart },
|
|
54
|
+
pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
|
|
55
|
+
};
|
|
56
|
+
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
57
|
+
var defaultReportType = "distribution";
|
|
58
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
59
|
+
var PLANS = {
|
|
60
|
+
os: {
|
|
61
|
+
id: "os",
|
|
62
|
+
name: "Basic",
|
|
63
|
+
offer: true,
|
|
64
|
+
price: "$32 / month",
|
|
65
|
+
deviceCount: startingDeviceCount.os,
|
|
66
|
+
offerprice: "$23 / month for first 50 devices",
|
|
67
|
+
price2: "for first 6 months;\n$29/month thereafter",
|
|
68
|
+
features: ["Access to core features of Mender", "Basic support"]
|
|
69
|
+
},
|
|
70
|
+
professional: {
|
|
71
|
+
id: "professional",
|
|
72
|
+
name: "Professional",
|
|
73
|
+
offer: true,
|
|
74
|
+
price: "$269 / month",
|
|
75
|
+
deviceCount: startingDeviceCount.professional,
|
|
76
|
+
offerprice: "$200 / month for first 50 devices",
|
|
77
|
+
price2: "for first 6 months;\n$249/month thereafter",
|
|
78
|
+
features: ["Advanced OTA features", "Higher priority support"]
|
|
79
|
+
},
|
|
80
|
+
enterprise: {
|
|
81
|
+
id: "enterprise",
|
|
82
|
+
name: "Enterprise",
|
|
83
|
+
price: "Custom pricing",
|
|
84
|
+
deviceCount: "Unlimited devices",
|
|
85
|
+
features: ["All Mender features", "Advanced security features", "SLA-backed support"]
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var ADDONS = {
|
|
89
|
+
configure: {
|
|
90
|
+
id: "configure",
|
|
91
|
+
title: "Configure",
|
|
92
|
+
description: "Expand your plan with device configuration features",
|
|
93
|
+
needs: ["hasDeviceConfig"],
|
|
94
|
+
os: {
|
|
95
|
+
price: "$11/month",
|
|
96
|
+
deviceCount: startingDeviceCount.os
|
|
97
|
+
},
|
|
98
|
+
professional: {
|
|
99
|
+
price: "$65/month",
|
|
100
|
+
deviceCount: startingDeviceCount.professional
|
|
101
|
+
},
|
|
102
|
+
eligible: ["os", "professional", "enterprise"]
|
|
103
|
+
},
|
|
104
|
+
troubleshoot: {
|
|
105
|
+
id: "troubleshoot",
|
|
106
|
+
title: "Troubleshoot",
|
|
107
|
+
description: "Expand your plan with device troubleshooting features",
|
|
108
|
+
needs: ["hasDeviceConnect"],
|
|
109
|
+
os: {
|
|
110
|
+
price: "$27/month",
|
|
111
|
+
deviceCount: startingDeviceCount.os
|
|
112
|
+
},
|
|
113
|
+
professional: {
|
|
114
|
+
price: "$72/month",
|
|
115
|
+
deviceCount: startingDeviceCount.professional
|
|
116
|
+
},
|
|
117
|
+
eligible: ["os", "professional", "enterprise"]
|
|
118
|
+
},
|
|
119
|
+
monitor: {
|
|
120
|
+
id: "monitor",
|
|
121
|
+
title: "Monitor",
|
|
122
|
+
description: "Expand your plan with device monitoring features",
|
|
123
|
+
needs: ["hasMonitor"],
|
|
124
|
+
os: {
|
|
125
|
+
price: "-",
|
|
126
|
+
deviceCount: "-"
|
|
127
|
+
},
|
|
128
|
+
professional: {
|
|
129
|
+
price: "$86/month",
|
|
130
|
+
deviceCount: startingDeviceCount.professional
|
|
131
|
+
},
|
|
132
|
+
eligible: ["professional", "enterprise"]
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var BENEFITS = {
|
|
136
|
+
auditlog: { id: "auditlog", benefit: "trace change across your devices and access troubleshooting session replay", requiredPlan: PLANS.professional.id },
|
|
137
|
+
dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
|
|
138
|
+
deltaGeneration: {
|
|
139
|
+
id: "deltaGeneration",
|
|
140
|
+
benefit: "automatic delta artifacts generation to minimize data transfer and improve the update delivery",
|
|
141
|
+
requiredPlan: PLANS.enterprise.id
|
|
142
|
+
},
|
|
143
|
+
deviceConfiguration: { id: "deviceConfiguration", benefit: "device configuration features", requiredAddon: ADDONS.configure.id },
|
|
144
|
+
deviceMonitor: { id: "deviceMonitor", benefit: "device monitoring features", requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },
|
|
145
|
+
deviceTroubleshoot: { id: "deviceTroubleshoot", benefit: "device troubleshooting features", requiredAddon: ADDONS.troubleshoot.id },
|
|
146
|
+
dynamicGroups: { id: "dynamicGroups", benefit: "create dynamic groups to ease device management", requiredPlan: PLANS.enterprise.id },
|
|
147
|
+
fullFiltering: { id: "fullFiltering", benefit: "filtering by multiple attributes to improve the device overview", requiredPlan: PLANS.professional.id },
|
|
148
|
+
gateway: { id: "gateway", benefit: "see devices connected to your gateway device for easy access", requiredPlans: PLANS.professional.id },
|
|
149
|
+
pausedDeployments: {
|
|
150
|
+
id: "pausedDeployments",
|
|
151
|
+
benefit: "granular control about update rollout to allow synchronization across your fleet",
|
|
152
|
+
requiredPlan: PLANS.enterprise.id
|
|
153
|
+
},
|
|
154
|
+
phasedDeployments: { id: "phasedDeployments", benefit: "choose to roll out deployments in multiple phases", requiredPlan: PLANS.enterprise.id },
|
|
155
|
+
rbac: { id: "rbac", benefit: "granular role based access control", requiredPlan: PLANS.enterprise.id },
|
|
156
|
+
retryDeployments: { id: "retryDeployments", benefit: "optional retries for failed rollout attempts", requiredPlan: PLANS.professional.id },
|
|
157
|
+
scheduledDeployments: {
|
|
158
|
+
id: "scheduledDeployments",
|
|
159
|
+
benefit: "scheduled deployments to steer the distribution of your updates.",
|
|
160
|
+
requiredPlan: PLANS.professional.id
|
|
161
|
+
},
|
|
162
|
+
webhookEvents: {
|
|
163
|
+
id: "webhookEvents",
|
|
164
|
+
benefit: "receive inventory events and select which type(s) of events the webhook will receive",
|
|
165
|
+
requiredPlan: PLANS.professional.id
|
|
166
|
+
},
|
|
167
|
+
default: { id: "default", benefit: "gain access to this feature", requiredPlan: PLANS.enterprise.id }
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/commonConstants.tsx
|
|
171
|
+
var import_js = require("@mdi/js");
|
|
172
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
173
|
+
var timeUnits = {
|
|
174
|
+
days: "days",
|
|
175
|
+
minutes: "minutes",
|
|
176
|
+
hours: "hours"
|
|
177
|
+
};
|
|
178
|
+
var DEVICE_FILTERING_OPTIONS = {
|
|
179
|
+
$eq: { key: "$eq", title: "equals", shortform: "=" },
|
|
180
|
+
$ne: { key: "$ne", title: "not equal", shortform: "!=" },
|
|
181
|
+
$gt: {
|
|
182
|
+
key: "$gt",
|
|
183
|
+
title: ">",
|
|
184
|
+
shortform: ">",
|
|
185
|
+
help: 'The "greater than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
|
|
186
|
+
},
|
|
187
|
+
$gte: {
|
|
188
|
+
title: ">=",
|
|
189
|
+
shortform: ">=",
|
|
190
|
+
help: 'The "greater than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
|
|
191
|
+
},
|
|
192
|
+
$lt: {
|
|
193
|
+
key: "$lt",
|
|
194
|
+
title: "<",
|
|
195
|
+
shortform: "<",
|
|
196
|
+
help: 'The "lesser than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
|
|
197
|
+
},
|
|
198
|
+
$lte: {
|
|
199
|
+
title: "<=",
|
|
200
|
+
shortform: "<=",
|
|
201
|
+
help: 'The "lesser than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
|
|
202
|
+
},
|
|
203
|
+
$ltne: {
|
|
204
|
+
key: "$ltne",
|
|
205
|
+
title: "$ltne",
|
|
206
|
+
shortform: "ltne",
|
|
207
|
+
help: 'The "lesser than or does not exist" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
|
|
208
|
+
},
|
|
209
|
+
$in: {
|
|
210
|
+
key: "$in",
|
|
211
|
+
title: "in",
|
|
212
|
+
shortform: "in",
|
|
213
|
+
help: 'The "in" operator accepts a list of comma-separated values. It matches if the selected field is equal to one of the specified values.'
|
|
214
|
+
},
|
|
215
|
+
$nin: {
|
|
216
|
+
key: "$nin",
|
|
217
|
+
title: "not in",
|
|
218
|
+
shortform: "not in",
|
|
219
|
+
help: `The "not in" operator accepts a list of comma-separated values. It matches if the selected field's value is not equal to any of the specified options.`
|
|
220
|
+
},
|
|
221
|
+
$exists: {
|
|
222
|
+
key: "$exists",
|
|
223
|
+
title: "exists",
|
|
224
|
+
shortform: "exists",
|
|
225
|
+
value: true,
|
|
226
|
+
help: `The "exists" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`
|
|
227
|
+
},
|
|
228
|
+
$nexists: {
|
|
229
|
+
key: "$nexists",
|
|
230
|
+
title: `doesn't exist`,
|
|
231
|
+
shortform: `doesn't exist`,
|
|
232
|
+
value: true,
|
|
233
|
+
help: `The "doesn't exist" operator matches if the selected field's value has no value. No value needs to be provided for this operator.`
|
|
234
|
+
},
|
|
235
|
+
$regex: {
|
|
236
|
+
key: "$regex",
|
|
237
|
+
title: `matches regular expression`,
|
|
238
|
+
shortform: `matches`,
|
|
239
|
+
help: `The "regular expression" operator matches the selected field's value with a Perl compatible regular expression (PCRE), automatically anchored by ^. If the regular expression is not valid, the filter will produce no results. If you need to specify options and flags, you can provide the full regex in the format of /regex/flags, for example.`
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
var DEVICE_ISSUE_OPTIONS = {
|
|
243
|
+
issues: {
|
|
244
|
+
isCategory: true,
|
|
245
|
+
key: "issues",
|
|
246
|
+
title: "Devices with issues",
|
|
247
|
+
filterRule: {}
|
|
248
|
+
},
|
|
249
|
+
offline: {
|
|
250
|
+
issueCategory: "issues",
|
|
251
|
+
key: "offline",
|
|
252
|
+
needsFullFiltering: true,
|
|
253
|
+
needsMonitor: false,
|
|
254
|
+
needsReporting: false,
|
|
255
|
+
filterRule: {
|
|
256
|
+
scope: "system",
|
|
257
|
+
key: "check_in_time",
|
|
258
|
+
operator: DEVICE_FILTERING_OPTIONS.$ltne.key,
|
|
259
|
+
value: ({ offlineThreshold }) => offlineThreshold
|
|
260
|
+
},
|
|
261
|
+
title: "Offline devices"
|
|
262
|
+
},
|
|
263
|
+
failedLastUpdate: {
|
|
264
|
+
issueCategory: "issues",
|
|
265
|
+
key: "failedLastUpdate",
|
|
266
|
+
needsFullFiltering: false,
|
|
267
|
+
needsMonitor: false,
|
|
268
|
+
needsReporting: true,
|
|
269
|
+
filterRule: { scope: "monitor", key: "failed_last_update", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
|
|
270
|
+
title: "Deployment failed"
|
|
271
|
+
},
|
|
272
|
+
monitoring: {
|
|
273
|
+
issueCategory: "issues",
|
|
274
|
+
key: "monitoring",
|
|
275
|
+
needsFullFiltering: false,
|
|
276
|
+
needsMonitor: true,
|
|
277
|
+
needsReporting: false,
|
|
278
|
+
filterRule: { scope: "monitor", key: "alerts", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
|
|
279
|
+
title: "Monitoring alert"
|
|
280
|
+
},
|
|
281
|
+
authRequests: {
|
|
282
|
+
key: "authRequests",
|
|
283
|
+
needsFullFiltering: false,
|
|
284
|
+
needsMonitor: false,
|
|
285
|
+
needsReporting: true,
|
|
286
|
+
filterRule: { scope: "monitor", key: "auth_requests", operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },
|
|
287
|
+
title: "Devices with new authentication requests"
|
|
288
|
+
},
|
|
289
|
+
gatewayDevices: {
|
|
290
|
+
key: "gatewayDevices",
|
|
291
|
+
needsFullFiltering: false,
|
|
292
|
+
needsMonitor: false,
|
|
293
|
+
needsReporting: true,
|
|
294
|
+
filterRule: { scope: "inventory", key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: "true" },
|
|
295
|
+
title: "Gateway devices"
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
var oneSecond = 1e3;
|
|
299
|
+
var TIMEOUTS = {
|
|
300
|
+
debounceDefault: 700,
|
|
301
|
+
debounceShort: 300,
|
|
302
|
+
halfASecond: 0.5 * oneSecond,
|
|
303
|
+
oneSecond,
|
|
304
|
+
twoSeconds: 2 * oneSecond,
|
|
305
|
+
threeSeconds: 3 * oneSecond,
|
|
306
|
+
fiveSeconds: 5 * oneSecond,
|
|
307
|
+
refreshDefault: 10 * oneSecond,
|
|
308
|
+
refreshLong: 60 * oneSecond
|
|
309
|
+
};
|
|
310
|
+
var DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };
|
|
311
|
+
var ATTRIBUTE_SCOPES = {
|
|
312
|
+
inventory: "inventory",
|
|
313
|
+
identity: "identity",
|
|
314
|
+
monitor: "monitor",
|
|
315
|
+
system: "system",
|
|
316
|
+
tags: "tags"
|
|
317
|
+
};
|
|
318
|
+
var defaultIdAttribute = Object.freeze({ attribute: "id", scope: ATTRIBUTE_SCOPES.identity });
|
|
319
|
+
var credentialTypes = {
|
|
320
|
+
aws: "aws",
|
|
321
|
+
http: "http",
|
|
322
|
+
sas: "sas",
|
|
323
|
+
x509: "x509"
|
|
324
|
+
};
|
|
325
|
+
var EXTERNAL_PROVIDER = {
|
|
326
|
+
"iot-core": {
|
|
327
|
+
credentialsType: credentialTypes.aws,
|
|
328
|
+
icon: import_js.mdiAws,
|
|
329
|
+
title: "AWS IoT Core",
|
|
330
|
+
twinTitle: "Device Shadow",
|
|
331
|
+
provider: "iot-core",
|
|
332
|
+
enabled: true,
|
|
333
|
+
deviceTwin: true,
|
|
334
|
+
configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "For help finding your AWS IoT Core connection string, check the AWS IoT documentation." })
|
|
335
|
+
},
|
|
336
|
+
"iot-hub": {
|
|
337
|
+
credentialsType: credentialTypes.sas,
|
|
338
|
+
icon: import_js.mdiMicrosoftAzure,
|
|
339
|
+
title: "Azure IoT Hub",
|
|
340
|
+
twinTitle: "Device Twin",
|
|
341
|
+
provider: "iot-hub",
|
|
342
|
+
enabled: true,
|
|
343
|
+
deviceTwin: true,
|
|
344
|
+
configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
345
|
+
"For help finding your Azure IoT Hub connection string, look under 'Shared access policies' in the Microsoft Azure UI as described",
|
|
346
|
+
" ",
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
348
|
+
"a",
|
|
349
|
+
{
|
|
350
|
+
href: "https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn",
|
|
351
|
+
target: "_blank",
|
|
352
|
+
rel: "noopener noreferrer",
|
|
353
|
+
children: "here"
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
"."
|
|
357
|
+
] })
|
|
358
|
+
},
|
|
359
|
+
webhook: {
|
|
360
|
+
credentialsType: credentialTypes.http,
|
|
361
|
+
deviceTwin: false,
|
|
362
|
+
// disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
|
|
363
|
+
enabled: false,
|
|
364
|
+
provider: "webhook"
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
var emptyUiPermissions = Object.freeze({
|
|
368
|
+
auditlog: [],
|
|
369
|
+
deployments: [],
|
|
370
|
+
groups: Object.freeze({}),
|
|
371
|
+
releases: Object.freeze({}),
|
|
372
|
+
tenantManagement: [],
|
|
373
|
+
userManagement: []
|
|
374
|
+
});
|
|
375
|
+
var emptyRole = Object.freeze({
|
|
376
|
+
name: void 0,
|
|
377
|
+
description: "",
|
|
378
|
+
permissions: [],
|
|
379
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
// src/devicesSlice/constants.ts
|
|
383
|
+
var emptyFilter = { key: null, value: "", operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "inventory" };
|
|
384
|
+
var deviceAuthV2 = `${apiUrl.v2}/devauth`;
|
|
385
|
+
var deviceConnect = `${apiUrl.v1}/deviceconnect`;
|
|
386
|
+
var inventoryApiUrl = `${apiUrl.v1}/inventory`;
|
|
387
|
+
var inventoryApiUrlV2 = `${apiUrl.v2}/inventory`;
|
|
388
|
+
var deviceConfig = `${apiUrl.v1}/deviceconfig/configurations/device`;
|
|
389
|
+
var reportingApiUrl = `${apiUrl.v1}/reporting`;
|
|
390
|
+
var iotManagerBaseURL = `${apiUrl.v1}/iot-manager`;
|
|
391
|
+
var DEVICE_MESSAGE_PROTOCOLS = {
|
|
392
|
+
Shell: 1
|
|
393
|
+
};
|
|
394
|
+
var DEVICE_MESSAGE_TYPES = {
|
|
395
|
+
Delay: "delay",
|
|
396
|
+
New: "new",
|
|
397
|
+
Ping: "ping",
|
|
398
|
+
Pong: "pong",
|
|
399
|
+
Resize: "resize",
|
|
400
|
+
Shell: "shell",
|
|
401
|
+
Stop: "stop"
|
|
402
|
+
};
|
|
403
|
+
var geoAttributes = ["geo-lat", "geo-lon"].map((attribute) => ({ attribute, scope: "inventory" }));
|
|
404
|
+
|
|
405
|
+
// src/sockethook.ts
|
|
406
|
+
var cookies = new import_universal_cookie.default();
|
|
407
|
+
var MessagePack = (0, import_msgpack5.default)();
|
|
408
|
+
var useSession = ({ onClose, onHealthCheckFailed, onMessageReceived, onNotify, onOpen, token }) => {
|
|
409
|
+
const [sessionId, setSessionId] = (0, import_react.useState)();
|
|
410
|
+
const healthcheckTimeout = (0, import_react.useRef)();
|
|
411
|
+
const socketRef = (0, import_react.useRef)();
|
|
412
|
+
const sendMessage = (0, import_react.useCallback)(({ typ, body, props }) => {
|
|
413
|
+
if (!socketRef.current) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
const proto_header = { proto: DEVICE_MESSAGE_PROTOCOLS.Shell, typ, sid: socketRef.current.sessionId, props };
|
|
417
|
+
const encodedData = MessagePack.encode({ hdr: proto_header, body });
|
|
418
|
+
socketRef.current.send(encodedData);
|
|
419
|
+
}, []);
|
|
420
|
+
const close = (0, import_react.useCallback)(() => {
|
|
421
|
+
if (!socketRef.current || socketRef.current?.readyState !== WebSocket.OPEN) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
sendMessage({ typ: DEVICE_MESSAGE_TYPES.Stop, body: {}, props: {} });
|
|
425
|
+
socketRef.current.close();
|
|
426
|
+
setSessionId();
|
|
427
|
+
}, [sendMessage]);
|
|
428
|
+
const healthcheckFailed = (0, import_react.useCallback)(() => {
|
|
429
|
+
onHealthCheckFailed();
|
|
430
|
+
close();
|
|
431
|
+
}, [close, onHealthCheckFailed]);
|
|
432
|
+
const onSocketMessage = (0, import_react.useCallback)(
|
|
433
|
+
(event) => (0, import_helpers.blobToString)(event.data).then((data) => {
|
|
434
|
+
const {
|
|
435
|
+
hdr: { props = {}, proto, sid, typ },
|
|
436
|
+
body
|
|
437
|
+
} = MessagePack.decode(data);
|
|
438
|
+
if (proto !== DEVICE_MESSAGE_PROTOCOLS.Shell) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
switch (typ) {
|
|
442
|
+
case DEVICE_MESSAGE_TYPES.New: {
|
|
443
|
+
if (props.status == WebSocket.CLOSING) {
|
|
444
|
+
onNotify(`Error: ${(0, import_helpers.byteArrayToString)(body)}`);
|
|
445
|
+
setSessionId();
|
|
446
|
+
return close();
|
|
447
|
+
} else {
|
|
448
|
+
clearTimeout(healthcheckTimeout.current);
|
|
449
|
+
healthcheckTimeout.current = setTimeout(healthcheckFailed, 65 * TIMEOUTS.oneSecond);
|
|
450
|
+
socketRef.current.sessionId = sid;
|
|
451
|
+
return setSessionId(sid);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
case DEVICE_MESSAGE_TYPES.Shell:
|
|
455
|
+
return onMessageReceived(body);
|
|
456
|
+
case DEVICE_MESSAGE_TYPES.Stop:
|
|
457
|
+
return close();
|
|
458
|
+
case DEVICE_MESSAGE_TYPES.Ping: {
|
|
459
|
+
if (healthcheckTimeout.current) {
|
|
460
|
+
clearTimeout(healthcheckTimeout.current);
|
|
461
|
+
}
|
|
462
|
+
sendMessage({ typ: DEVICE_MESSAGE_TYPES.Pong });
|
|
463
|
+
const timeout = parseInt(props.timeout);
|
|
464
|
+
if (timeout > 0) {
|
|
465
|
+
healthcheckTimeout.current = setTimeout(healthcheckFailed, timeout * TIMEOUTS.oneSecond);
|
|
466
|
+
}
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
default:
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
}),
|
|
473
|
+
[close, healthcheckFailed, onMessageReceived, onNotify, sendMessage]
|
|
474
|
+
);
|
|
475
|
+
const onSocketError = (0, import_react.useCallback)(
|
|
476
|
+
(error) => {
|
|
477
|
+
onNotify(`WebSocket error: ${error.message}`);
|
|
478
|
+
close();
|
|
479
|
+
clearTimeout(healthcheckTimeout.current);
|
|
480
|
+
},
|
|
481
|
+
[close, onNotify]
|
|
482
|
+
);
|
|
483
|
+
const onSocketOpen = (0, import_react.useCallback)(() => {
|
|
484
|
+
sendMessage({ typ: DEVICE_MESSAGE_TYPES.New, props: {} });
|
|
485
|
+
onOpen(true);
|
|
486
|
+
}, [onOpen, sendMessage]);
|
|
487
|
+
const onSocketClose = (0, import_react.useCallback)(
|
|
488
|
+
(e) => {
|
|
489
|
+
console.log("closing");
|
|
490
|
+
onClose(e);
|
|
491
|
+
close();
|
|
492
|
+
},
|
|
493
|
+
[close, onClose]
|
|
494
|
+
);
|
|
495
|
+
const connect = (0, import_react.useCallback)(
|
|
496
|
+
(deviceId) => {
|
|
497
|
+
const uri = `wss://${window.location.host}${apiUrl.v1}/deviceconnect/devices/${deviceId}/connect`;
|
|
498
|
+
setSessionId();
|
|
499
|
+
cookies.set("JWT", token, { path: "/", secure: true, sameSite: "strict", maxAge: 5 });
|
|
500
|
+
try {
|
|
501
|
+
socketRef.current = new WebSocket(uri);
|
|
502
|
+
} catch (error) {
|
|
503
|
+
console.log(error);
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
[token]
|
|
507
|
+
);
|
|
508
|
+
(0, import_react.useEffect)(() => {
|
|
509
|
+
if (!socketRef.current) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
socketRef.current.addEventListener("close", onSocketClose);
|
|
513
|
+
socketRef.current.addEventListener("error", onSocketError);
|
|
514
|
+
socketRef.current.addEventListener("message", onSocketMessage);
|
|
515
|
+
socketRef.current.addEventListener("open", onSocketOpen);
|
|
516
|
+
return () => {
|
|
517
|
+
socketRef.current.removeEventListener("close", onSocketClose);
|
|
518
|
+
socketRef.current.removeEventListener("error", onSocketError);
|
|
519
|
+
socketRef.current.removeEventListener("message", onSocketMessage);
|
|
520
|
+
socketRef.current.removeEventListener("open", onSocketOpen);
|
|
521
|
+
};
|
|
522
|
+
}, [onSocketClose, onSocketError, onSocketMessage, onSocketOpen, socketRef.current?.readyState]);
|
|
523
|
+
return [connect, sendMessage, close, socketRef.current?.readyState ?? WebSocket.CLOSED, sessionId];
|
|
524
|
+
};
|
|
525
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
526
|
+
0 && (module.exports = {
|
|
527
|
+
useSession
|
|
528
|
+
});
|
|
529
|
+
//# sourceMappingURL=sockethook.cjs.map
|