@monkvision/network 5.3.4 → 5.3.6
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/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkvision/network",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.5",
|
|
4
4
|
"license": "BSD-3-Clause-Clear",
|
|
5
5
|
"packageManager": "yarn@3.2.4",
|
|
6
6
|
"description": "MonkJs core package used to communicate with the API",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@monkvision/common": "5.3.
|
|
32
|
-
"@monkvision/sights": "5.3.
|
|
31
|
+
"@monkvision/common": "5.3.5",
|
|
32
|
+
"@monkvision/sights": "5.3.5",
|
|
33
33
|
"jsonwebtoken": "^9.0.2",
|
|
34
34
|
"jwt-decode": "^4.0.0",
|
|
35
35
|
"ky": "^1.2.0",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@auth0/auth0-react": "^2.2.4",
|
|
46
|
-
"@monkvision/eslint-config-base": "5.3.
|
|
47
|
-
"@monkvision/eslint-config-typescript": "5.3.
|
|
48
|
-
"@monkvision/jest-config": "5.3.
|
|
49
|
-
"@monkvision/prettier-config": "5.3.
|
|
50
|
-
"@monkvision/types": "5.3.
|
|
51
|
-
"@monkvision/typescript-config": "5.3.
|
|
46
|
+
"@monkvision/eslint-config-base": "5.3.5",
|
|
47
|
+
"@monkvision/eslint-config-typescript": "5.3.5",
|
|
48
|
+
"@monkvision/jest-config": "5.3.5",
|
|
49
|
+
"@monkvision/prettier-config": "5.3.5",
|
|
50
|
+
"@monkvision/types": "5.3.5",
|
|
51
|
+
"@monkvision/typescript-config": "5.3.5",
|
|
52
52
|
"@testing-library/dom": "^10.4.1",
|
|
53
53
|
"@testing-library/react": "^16.3.0",
|
|
54
54
|
"@types/jest": "^30",
|
|
@@ -72,6 +72,7 @@ export interface UpdateAdditionalDataOptions {
|
|
|
72
72
|
id: string;
|
|
73
73
|
/**
|
|
74
74
|
* Callback function that takes optional additional data and returns the updated additional data.
|
|
75
|
+
* If the callback has no parameters, the current additional data is not fetched from the API.
|
|
75
76
|
*/
|
|
76
77
|
callback: (additionalData?: AdditionalData) => AdditionalData;
|
|
77
78
|
}
|
|
@@ -79,6 +80,9 @@ export interface UpdateAdditionalDataOptions {
|
|
|
79
80
|
* Update the additional data of inspection with the given options.
|
|
80
81
|
* See the `UpdateAdditionalDataOptions` interface for more details.
|
|
81
82
|
*
|
|
83
|
+
* If the callback function has no parameters (callback.length === 0),
|
|
84
|
+
* the current additional data is not fetched from the API for better performance.
|
|
85
|
+
*
|
|
82
86
|
* @param options The options of the request.
|
|
83
87
|
* @param config The API config.
|
|
84
88
|
* @param [dispatch] Optional MonkState dispatch function that you can pass if you want this request to handle React
|
|
@@ -126,6 +126,9 @@ function createInspection(options, config, _dispatch) {
|
|
|
126
126
|
* Update the additional data of inspection with the given options.
|
|
127
127
|
* See the `UpdateAdditionalDataOptions` interface for more details.
|
|
128
128
|
*
|
|
129
|
+
* If the callback function has no parameters (callback.length === 0),
|
|
130
|
+
* the current additional data is not fetched from the API for better performance.
|
|
131
|
+
*
|
|
129
132
|
* @param options The options of the request.
|
|
130
133
|
* @param config The API config.
|
|
131
134
|
* @param [dispatch] Optional MonkState dispatch function that you can pass if you want this request to handle React
|
|
@@ -134,23 +137,28 @@ function createInspection(options, config, _dispatch) {
|
|
|
134
137
|
*/
|
|
135
138
|
function updateAdditionalData(options, config, dispatch) {
|
|
136
139
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var entities, inspection, newAdditionalData, kyOptions, response, body;
|
|
140
|
+
var currentAdditionalData, entities, inspection, newAdditionalData, kyOptions, response, body;
|
|
138
141
|
return __generator(this, function (_a) {
|
|
139
142
|
switch (_a.label) {
|
|
140
|
-
case 0:
|
|
143
|
+
case 0:
|
|
144
|
+
if (!(options.callback.length > 0)) return [3 /*break*/, 2];
|
|
145
|
+
return [4 /*yield*/, getInspection({ id: options.id }, config)];
|
|
141
146
|
case 1:
|
|
142
147
|
entities = (_a.sent()).entities;
|
|
143
148
|
inspection = entities.inspections.find(function (i) { return i.id === options.id; });
|
|
144
149
|
if (!inspection) {
|
|
145
150
|
throw new Error('Inspection does not exist');
|
|
146
151
|
}
|
|
147
|
-
|
|
152
|
+
currentAdditionalData = inspection.additionalData;
|
|
153
|
+
_a.label = 2;
|
|
154
|
+
case 2:
|
|
155
|
+
newAdditionalData = options.callback(currentAdditionalData);
|
|
148
156
|
kyOptions = (0, config_1.getDefaultOptions)(config);
|
|
149
157
|
return [4 /*yield*/, ky_1.default.patch("inspections/".concat(options.id), __assign(__assign({}, kyOptions), { json: { additional_data: newAdditionalData } }))];
|
|
150
|
-
case
|
|
158
|
+
case 3:
|
|
151
159
|
response = _a.sent();
|
|
152
160
|
return [4 /*yield*/, response.json()];
|
|
153
|
-
case
|
|
161
|
+
case 4:
|
|
154
162
|
body = _a.sent();
|
|
155
163
|
dispatch === null || dispatch === void 0 ? void 0 : dispatch({
|
|
156
164
|
type: common_1.MonkActionType.UPDATED_ONE_INSPECTION_ADDITIONAL_DATA,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkvision/network",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.6",
|
|
4
4
|
"license": "BSD-3-Clause-Clear",
|
|
5
5
|
"packageManager": "yarn@3.2.4",
|
|
6
6
|
"description": "MonkJs core package used to communicate with the API",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@monkvision/common": "5.3.
|
|
32
|
-
"@monkvision/sights": "5.3.
|
|
31
|
+
"@monkvision/common": "5.3.6",
|
|
32
|
+
"@monkvision/sights": "5.3.6",
|
|
33
33
|
"jsonwebtoken": "^9.0.2",
|
|
34
34
|
"jwt-decode": "^4.0.0",
|
|
35
35
|
"ky": "^1.2.0",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@auth0/auth0-react": "^2.2.4",
|
|
46
|
-
"@monkvision/eslint-config-base": "5.3.
|
|
47
|
-
"@monkvision/eslint-config-typescript": "5.3.
|
|
48
|
-
"@monkvision/jest-config": "5.3.
|
|
49
|
-
"@monkvision/prettier-config": "5.3.
|
|
50
|
-
"@monkvision/types": "5.3.
|
|
51
|
-
"@monkvision/typescript-config": "5.3.
|
|
46
|
+
"@monkvision/eslint-config-base": "5.3.6",
|
|
47
|
+
"@monkvision/eslint-config-typescript": "5.3.6",
|
|
48
|
+
"@monkvision/jest-config": "5.3.6",
|
|
49
|
+
"@monkvision/prettier-config": "5.3.6",
|
|
50
|
+
"@monkvision/types": "5.3.6",
|
|
51
|
+
"@monkvision/typescript-config": "5.3.6",
|
|
52
52
|
"@testing-library/dom": "^10.4.1",
|
|
53
53
|
"@testing-library/react": "^16.3.0",
|
|
54
54
|
"@types/jest": "^30",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"url": "https://github.com/monkvision/monkjs/issues"
|
|
91
91
|
},
|
|
92
92
|
"homepage": "https://github.com/monkvision/monkjs",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "c325284471cdae050f187893ceb06a3a1fbfb011"
|
|
94
94
|
}
|