@northern.tech/store 0.30.1 → 0.30.2

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.
@@ -167,14 +167,7 @@ declare const abortDeployment: _$_reduxjs_toolkit0.AsyncThunk<[{
167
167
  fulfilledMeta?: unknown;
168
168
  rejectedMeta?: unknown;
169
169
  }>;
170
- declare const updateDeploymentControlMap: _$_reduxjs_toolkit0.AsyncThunk<_$_reduxjs_toolkit0.PayloadAction<{
171
- payload: Deployment;
172
- type: "deployments/receivedDeployment";
173
- }, string, {
174
- arg: string;
175
- requestId: string;
176
- requestStatus: "fulfilled";
177
- }, never> | _$_reduxjs_toolkit0.PayloadAction<unknown, string, {
170
+ declare const updateDeploymentControlMap: _$_reduxjs_toolkit0.AsyncThunk<_$_reduxjs_toolkit0.PayloadAction<unknown, string, {
178
171
  arg: string;
179
172
  requestId: string;
180
173
  requestStatus: "rejected";
@@ -184,7 +177,14 @@ declare const updateDeploymentControlMap: _$_reduxjs_toolkit0.AsyncThunk<_$_redu
184
177
  rejectedWithValue: true;
185
178
  } | ({
186
179
  rejectedWithValue: false;
187
- } & {})), _$_reduxjs_toolkit0.SerializedError>, {
180
+ } & {})), _$_reduxjs_toolkit0.SerializedError> | _$_reduxjs_toolkit0.PayloadAction<{
181
+ payload: Deployment;
182
+ type: "deployments/receivedDeployment";
183
+ }, string, {
184
+ arg: string;
185
+ requestId: string;
186
+ requestStatus: "fulfilled";
187
+ }, never>, {
188
188
  deploymentId: string;
189
189
  updateControlMap: DeploymentV1["update_control_map"];
190
190
  }, {
@@ -167,14 +167,7 @@ declare const abortDeployment: _$_reduxjs_toolkit0.AsyncThunk<[{
167
167
  fulfilledMeta?: unknown;
168
168
  rejectedMeta?: unknown;
169
169
  }>;
170
- declare const updateDeploymentControlMap: _$_reduxjs_toolkit0.AsyncThunk<_$_reduxjs_toolkit0.PayloadAction<{
171
- payload: Deployment;
172
- type: "deployments/receivedDeployment";
173
- }, string, {
174
- arg: string;
175
- requestId: string;
176
- requestStatus: "fulfilled";
177
- }, never> | _$_reduxjs_toolkit0.PayloadAction<unknown, string, {
170
+ declare const updateDeploymentControlMap: _$_reduxjs_toolkit0.AsyncThunk<_$_reduxjs_toolkit0.PayloadAction<unknown, string, {
178
171
  arg: string;
179
172
  requestId: string;
180
173
  requestStatus: "rejected";
@@ -184,7 +177,14 @@ declare const updateDeploymentControlMap: _$_reduxjs_toolkit0.AsyncThunk<_$_redu
184
177
  rejectedWithValue: true;
185
178
  } | ({
186
179
  rejectedWithValue: false;
187
- } & {})), _$_reduxjs_toolkit0.SerializedError>, {
180
+ } & {})), _$_reduxjs_toolkit0.SerializedError> | _$_reduxjs_toolkit0.PayloadAction<{
181
+ payload: Deployment;
182
+ type: "deployments/receivedDeployment";
183
+ }, string, {
184
+ arg: string;
185
+ requestId: string;
186
+ requestStatus: "fulfilled";
187
+ }, never>, {
188
188
  deploymentId: string;
189
189
  updateControlMap: DeploymentV1["update_control_map"];
190
190
  }, {
package/dist/store.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ErrorWithResponse } from "./utils-B4I595rf.cjs";
1
+ import { n as ErrorWithResponse } from "./utils-CpPfqW0Q.cjs";
2
2
  import { a as commonErrorHandler, c as sessionReducer, d as useAppSelector, i as commonErrorFallback, l as store, n as MenderEnvironment, o as createAppAsyncThunk, r as RootState, s as getConfiguredStore, t as AppDispatch, u as useAppDispatch } from "./store-BiIA0r0A.cjs";
3
3
  export { AppDispatch, ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
package/dist/store.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ErrorWithResponse } from "./utils-DNnSR4S_.js";
1
+ import { n as ErrorWithResponse } from "./utils-CO_CpGFP.js";
2
2
  import { a as commonErrorHandler, c as sessionReducer, d as useAppSelector, i as commonErrorFallback, l as store, n as MenderEnvironment, o as createAppAsyncThunk, r as RootState, s as getConfiguredStore, t as AppDispatch, u as useAppDispatch } from "./store-BQxOSRC1.js";
3
3
  export { AppDispatch, ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
@@ -32,7 +32,17 @@ declare const parseEnvironmentInfo: _$_reduxjs_toolkit0.AsyncThunk<[{
32
32
  }, {
33
33
  payload: any;
34
34
  type: "app/setEnvironmentData";
35
- }, _$_reduxjs_toolkit0.PayloadAction<{
35
+ }, _$_reduxjs_toolkit0.PayloadAction<unknown, string, {
36
+ arg: void;
37
+ requestId: string;
38
+ requestStatus: "rejected";
39
+ aborted: boolean;
40
+ condition: boolean;
41
+ } & ({
42
+ rejectedWithValue: true;
43
+ } | ({
44
+ rejectedWithValue: false;
45
+ } & {})), _$_reduxjs_toolkit0.SerializedError> | _$_reduxjs_toolkit0.PayloadAction<{
36
46
  payload: {
37
47
  [key: string]: string | {
38
48
  releaseDate: string;
@@ -50,17 +60,7 @@ declare const parseEnvironmentInfo: _$_reduxjs_toolkit0.AsyncThunk<[{
50
60
  arg: void;
51
61
  requestId: string;
52
62
  requestStatus: "fulfilled";
53
- }, never> | _$_reduxjs_toolkit0.PayloadAction<unknown, string, {
54
- arg: void;
55
- requestId: string;
56
- requestStatus: "rejected";
57
- aborted: boolean;
58
- condition: boolean;
59
- } & ({
60
- rejectedWithValue: true;
61
- } | ({
62
- rejectedWithValue: false;
63
- } & {})), _$_reduxjs_toolkit0.SerializedError>], void, {
63
+ }, never>], void, {
64
64
  dispatch: AppDispatch;
65
65
  state: RootState;
66
66
  extra?: unknown;
@@ -32,7 +32,17 @@ declare const parseEnvironmentInfo: _$_reduxjs_toolkit0.AsyncThunk<[{
32
32
  }, {
33
33
  payload: any;
34
34
  type: "app/setEnvironmentData";
35
- }, _$_reduxjs_toolkit0.PayloadAction<{
35
+ }, _$_reduxjs_toolkit0.PayloadAction<unknown, string, {
36
+ arg: void;
37
+ requestId: string;
38
+ requestStatus: "rejected";
39
+ aborted: boolean;
40
+ condition: boolean;
41
+ } & ({
42
+ rejectedWithValue: true;
43
+ } | ({
44
+ rejectedWithValue: false;
45
+ } & {})), _$_reduxjs_toolkit0.SerializedError> | _$_reduxjs_toolkit0.PayloadAction<{
36
46
  payload: {
37
47
  [key: string]: string | {
38
48
  releaseDate: string;
@@ -50,17 +60,7 @@ declare const parseEnvironmentInfo: _$_reduxjs_toolkit0.AsyncThunk<[{
50
60
  arg: void;
51
61
  requestId: string;
52
62
  requestStatus: "fulfilled";
53
- }, never> | _$_reduxjs_toolkit0.PayloadAction<unknown, string, {
54
- arg: void;
55
- requestId: string;
56
- requestStatus: "rejected";
57
- aborted: boolean;
58
- condition: boolean;
59
- } & ({
60
- rejectedWithValue: true;
61
- } | ({
62
- rejectedWithValue: false;
63
- } & {})), _$_reduxjs_toolkit0.SerializedError>], void, {
63
+ }, never>], void, {
64
64
  dispatch: AppDispatch;
65
65
  state: RootState;
66
66
  extra?: unknown;
package/dist/thunks.cjs CHANGED
@@ -230,12 +230,45 @@ const trackDeploymentCreation = (totalDeploymentCount, hasDeployments, trial_exp
230
230
  });
231
231
  }
232
232
  };
233
+ const cleanPhases = (phases) => phases?.map(({ batch_size, batch_size_devices, start_ts }) => require_utils.stripUndefined({
234
+ batch_size,
235
+ batch_size_devices,
236
+ start_ts
237
+ }));
233
238
  const MAX_PREVIOUS_PHASES_COUNT = 5;
234
239
  const createDeployment = require_store.createAppAsyncThunk(`${require_deploymentsSlice_index.sliceName}/createDeployment`, ({ newDeployment, hasNewRetryDefault = false }, { dispatch, getState }) => {
235
240
  let request;
236
- if ("filter_id" in newDeployment && newDeployment.filter_id) request = require_api_general_api.default.post(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments`, newDeployment);
237
- else if ("group" in newDeployment && newDeployment.group) request = require_api_general_api.default.post(`${_northern_tech_utils_constants.deploymentsApiUrl}/deployments/group/${newDeployment.group}`, newDeployment);
238
- else request = require_api_general_api.default.post(`${_northern_tech_utils_constants.deploymentsApiUrl}/deployments`, newDeployment);
241
+ const { name, artifact_name, retries, update_control_map, autogenerate_delta } = newDeployment;
242
+ const common = require_utils.stripUndefined({
243
+ name,
244
+ artifact_name,
245
+ phases: cleanPhases(newDeployment.phases),
246
+ retries,
247
+ update_control_map,
248
+ autogenerate_delta
249
+ });
250
+ if ("filter_id" in newDeployment && newDeployment.filter_id) {
251
+ const { filter_id, max_devices } = newDeployment;
252
+ request = require_api_general_api.default.post(`${_northern_tech_utils_constants.deploymentsApiUrlV2}/deployments`, require_utils.stripUndefined({
253
+ ...common,
254
+ filter_id,
255
+ max_devices
256
+ }));
257
+ } else if ("group" in newDeployment && newDeployment.group) {
258
+ const { force_installation, group } = newDeployment;
259
+ request = require_api_general_api.default.post(`${_northern_tech_utils_constants.deploymentsApiUrl}/deployments/group/${group}`, require_utils.stripUndefined({
260
+ ...common,
261
+ force_installation
262
+ }));
263
+ } else {
264
+ const { devices, all_devices, force_installation } = newDeployment;
265
+ request = require_api_general_api.default.post(`${_northern_tech_utils_constants.deploymentsApiUrl}/deployments`, require_utils.stripUndefined({
266
+ ...common,
267
+ devices,
268
+ all_devices,
269
+ force_installation
270
+ }));
271
+ }
239
272
  const totalDeploymentCount = Object.values(require_deploymentsSlice_selectors.getDeploymentsByStatus(getState())).reduce((accu, item) => accu + item.total, 0);
240
273
  const { hasDeployments } = require_usersSlice_selectors.getGlobalSettings(getState());
241
274
  const { trial_expiration } = require_organizationSlice_selectors.getOrganization(getState());
@@ -1620,10 +1653,11 @@ const getTargetLocation = (key) => {
1620
1653
  };
1621
1654
  const devLocations = ["localhost", "docker.mender.io"];
1622
1655
  const createOrganizationTrial = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/createOrganizationTrial`, async (data, { dispatch }) => {
1623
- const { key } = require_appSlice_constants.locations[data.location];
1656
+ const { location, tos: _tos, ...trialPayload } = data;
1657
+ const { key } = require_appSlice_constants.locations[location];
1624
1658
  const targetLocation = getTargetLocation(key);
1625
1659
  const target = `${targetLocation}${_northern_tech_utils_constants.tenantadmApiUrlv2}/tenants/trial`;
1626
- const { headers } = await require_api_general_api.default.postUnauthorized(target, data).catch((err) => {
1660
+ const { headers } = await require_api_general_api.default.postUnauthorized(target, trialPayload).catch((err) => {
1627
1661
  if (err.response?.status >= 400 && err.response?.status < 500) dispatch(setSnackbar$1({
1628
1662
  message: err.response.data.error,
1629
1663
  autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
@@ -2043,10 +2077,18 @@ const removeUser = require_store.createAppAsyncThunk(`${require_usersSlice_index
2043
2077
  dispatch(getUserList()),
2044
2078
  dispatch(setSnackbar(userActions.remove.successMessage))
2045
2079
  ])).catch((err) => userActionErrorHandler(err, "remove", dispatch)));
2046
- const editUser = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/editUser`, ({ id, ...userData }, { dispatch, getState }) => require_api_general_api.default.put(`${_northern_tech_utils_constants.useradmApiUrl}/users/${id}`, userData).then(() => Promise.all([dispatch(require_usersSlice_index.actions.updatedUser({
2047
- ...userData,
2048
- id: id === "me" ? require_usersSlice_selectors.getCurrentUser(getState()).id : id
2049
- })), dispatch(setSnackbar(userActions.edit.successMessage))])).catch((err) => userActionErrorHandler(err, "edit", dispatch)));
2080
+ const editUser = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/editUser`, ({ id, email, password, current_password, roles }, { dispatch, getState }) => {
2081
+ const userData = require_utils.stripUndefined({
2082
+ email,
2083
+ password,
2084
+ current_password,
2085
+ roles
2086
+ });
2087
+ return require_api_general_api.default.put(`${_northern_tech_utils_constants.useradmApiUrl}/users/${id}`, userData).then(() => Promise.all([dispatch(require_usersSlice_index.actions.updatedUser({
2088
+ ...userData,
2089
+ id: id === "me" ? require_usersSlice_selectors.getCurrentUser(getState()).id : id
2090
+ })), dispatch(setSnackbar(userActions.edit.successMessage))])).catch((err) => userActionErrorHandler(err, "edit", dispatch));
2091
+ });
2050
2092
  const checkEmailExists = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/checkEmailExists`, async (email) => {
2051
2093
  return (await require_api_general_api.default.get(`${_northern_tech_utils_constants.useradmApiUrl}/users/exists?email=${encodeURIComponent(email)}`)).data.exists;
2052
2094
  });