ag-common 0.0.721 → 0.0.722
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/api/helpers/s3.js +2 -1
- package/dist/api/helpers/validateOpenApi.js +1 -1
- package/dist/common/helpers/object.d.ts +1 -0
- package/dist/common/helpers/object.js +3 -1
- package/dist/ui/components/BarChart/getLegendItems.js +2 -1
- package/dist/ui/components/LineChart/getLegendItems.js +2 -1
- package/package.json +1 -1
package/dist/api/helpers/s3.js
CHANGED
|
@@ -27,6 +27,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
|
|
|
27
27
|
const s3_presigned_post_1 = require("@aws-sdk/s3-presigned-post");
|
|
28
28
|
const array_1 = require("../../common/helpers/array");
|
|
29
29
|
const log_1 = require("../../common/helpers/log");
|
|
30
|
+
const object_1 = require("../../common/helpers/object");
|
|
30
31
|
const setS3 = (region) => {
|
|
31
32
|
const raw = new client_s3_1.S3Client({ region });
|
|
32
33
|
return raw;
|
|
@@ -191,7 +192,7 @@ function getPresignedPostURL(_a) {
|
|
|
191
192
|
['starts-with', '$Content-Type', 'image/'],
|
|
192
193
|
],
|
|
193
194
|
});
|
|
194
|
-
const fields =
|
|
195
|
+
const fields = (0, object_1.copy)(ps.fields);
|
|
195
196
|
return { data: { fields, url: ps.url } };
|
|
196
197
|
}
|
|
197
198
|
catch (e) {
|
|
@@ -40,7 +40,7 @@ const getOperation = ({ path, method, resource, schema, }) => {
|
|
|
40
40
|
const re = new RegExp(resourcePath
|
|
41
41
|
.replace(/\//gim, `\\/`)
|
|
42
42
|
.replace(/\{(.+?)\}/gim, '(?<$1>[^\\\\]+)'), 'i').exec(path);
|
|
43
|
-
const pathParams = (re === null || re === void 0 ? void 0 : re.groups) &&
|
|
43
|
+
const pathParams = (re === null || re === void 0 ? void 0 : re.groups) && (0, object_1.copy)(re.groups);
|
|
44
44
|
return { operation, pathParams };
|
|
45
45
|
};
|
|
46
46
|
function validateOpenApi(_a) {
|
|
@@ -65,3 +65,4 @@ export declare const removeUndefValuesFromObjectAdditional: <T>(orig: Record<str
|
|
|
65
65
|
*/
|
|
66
66
|
export declare const castStringlyObject: (orig: Record<string, string | string[] | undefined>) => Record<string, string>;
|
|
67
67
|
export declare const isObject: (o: any) => any;
|
|
68
|
+
export declare const copy: <T>(v: T) => T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObjectAdditional = exports.removeUndefValuesFromObject = exports.filterObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
|
|
3
|
+
exports.copy = exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObjectAdditional = exports.removeUndefValuesFromObject = exports.filterObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
|
|
4
4
|
const tryJsonParse = (str, defaultValue) => {
|
|
5
5
|
if (!str) {
|
|
6
6
|
return null;
|
|
@@ -193,3 +193,5 @@ exports.castStringlyObject = castStringlyObject;
|
|
|
193
193
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
194
|
const isObject = (o) => o && typeof o === 'object' && !Array.isArray(o);
|
|
195
195
|
exports.isObject = isObject;
|
|
196
|
+
const copy = (v) => JSON.parse(JSON.stringify(v));
|
|
197
|
+
exports.copy = copy;
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getLegendItems = void 0;
|
|
4
4
|
const array_1 = require("../../../common/helpers/array");
|
|
5
5
|
const math_1 = require("../../../common/helpers/math");
|
|
6
|
+
const object_1 = require("../../../common/helpers/object");
|
|
6
7
|
const getLegendItems = ({ data, selectedKey, }) => {
|
|
7
8
|
const min = data.total * 0.1;
|
|
8
9
|
const shownResults = 4;
|
|
9
10
|
const part = (0, array_1.take)(data.values.filter((r) => r.value > min), shownResults).part;
|
|
10
|
-
const rest =
|
|
11
|
+
const rest = (0, object_1.copy)(data.values).filter((r) => !part.find((p) => p.name === r.name));
|
|
11
12
|
//if we want to ensure this value exists in the returned results
|
|
12
13
|
if (selectedKey) {
|
|
13
14
|
const pi = part.findIndex((r) => r.name === selectedKey);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getLegendItems = void 0;
|
|
4
4
|
const array_1 = require("../../../common/helpers/array");
|
|
5
5
|
const math_1 = require("../../../common/helpers/math");
|
|
6
|
+
const object_1 = require("../../../common/helpers/object");
|
|
6
7
|
const shownResults = 4;
|
|
7
8
|
const getTopItems = ({ data, colours, }) => {
|
|
8
9
|
const val = {};
|
|
@@ -41,7 +42,7 @@ const getLegendItems = (p) => {
|
|
|
41
42
|
let rest = [];
|
|
42
43
|
if (part.length > shownResults) {
|
|
43
44
|
part = (0, array_1.take)(part.filter((r) => r.y > min), shownResults).part;
|
|
44
|
-
rest =
|
|
45
|
+
rest = (0, object_1.copy)(values).filter((r) => !part.find((p) => p.name === r.name));
|
|
45
46
|
}
|
|
46
47
|
const restTotal = (0, math_1.sumArray)(rest.map((s) => s.y));
|
|
47
48
|
return { part, rest, restTotal, total };
|
package/package.json
CHANGED