@qrvey/utils 1.16.0-6 → 1.16.0-7-AN-25240
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/charts/adapters/RequestAdapterMetric.js +8 -4
- package/dist/charts/interfaces/IRequestAdapterMetric.d.ts +3 -1
- package/dist/cjs/charts/adapters/RequestAdapterMetric.js +8 -4
- package/dist/cjs/charts/interfaces/IRequestAdapterMetric.d.ts +3 -1
- package/dist/cjs/format/duration/durationFormatter.js +4 -1
- package/dist/cjs/formulas/constants/FORMULA.d.ts +5 -0
- package/dist/cjs/formulas/constants/FORMULA.js +6 -1
- package/dist/format/duration/durationFormatter.js +4 -1
- package/dist/formulas/constants/FORMULA.d.ts +5 -0
- package/dist/formulas/constants/FORMULA.js +5 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FORMULA_SCOPE } from "../../formulas";
|
|
1
2
|
import { isEmpty } from "../../general";
|
|
2
3
|
import { TIME_PERIOD, TP_CUSTOM_RANGE } from "../../interfaces";
|
|
3
4
|
import { RELATIVE_OBJECT_BY_TIME_LABEL } from "../constants/REQUEST_ADAPTER";
|
|
@@ -30,12 +31,15 @@ const getFilterLogic = (filters) => (filters === null || filters === void 0 ? vo
|
|
|
30
31
|
* @returns A metric value object
|
|
31
32
|
*/
|
|
32
33
|
const metricMakeValue = (data) => {
|
|
33
|
-
var _a, _b, _c;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
const isAggregateFormula = ((_a = data === null || data === void 0 ? void 0 : data.value) === null || _a === void 0 ? void 0 : _a.formulaInputType) === FORMULA_SCOPE.AGGREGATE;
|
|
36
|
+
const metricValue = {
|
|
37
|
+
questionid: (_b = data === null || data === void 0 ? void 0 : data.value) === null || _b === void 0 ? void 0 : _b.id,
|
|
37
38
|
property: ((_c = data === null || data === void 0 ? void 0 : data.value) === null || _c === void 0 ? void 0 : _c.property) || null,
|
|
38
39
|
};
|
|
40
|
+
if (!isAggregateFormula)
|
|
41
|
+
metricValue.aggregate = (_d = data === null || data === void 0 ? void 0 : data.valueAggregate) === null || _d === void 0 ? void 0 : _d.label;
|
|
42
|
+
return metricValue;
|
|
39
43
|
};
|
|
40
44
|
/**
|
|
41
45
|
* If data is truthy and data.dateColumn is truthy, return true, otherwise return false.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IBColumn, IColumnType } from "../../columns";
|
|
2
2
|
import { IDateGroupingProperty, RelativeCursor } from "../../dates";
|
|
3
3
|
import { IFBLogic } from "../../filters";
|
|
4
|
+
import { IFormulaScope } from "../../formulas";
|
|
4
5
|
import { TimePeriod, TP_CUSTOM_RANGE } from "../../interfaces";
|
|
5
6
|
import { AGGREGATE_LABEL } from "../constants";
|
|
6
7
|
export interface MetricRequestPayload {
|
|
@@ -18,7 +19,7 @@ export interface MetricRequestPayload {
|
|
|
18
19
|
* property "answered".
|
|
19
20
|
*/
|
|
20
21
|
export type MetricValue = {
|
|
21
|
-
aggregate
|
|
22
|
+
aggregate?: AGGREGATE_LABEL;
|
|
22
23
|
questionid: string;
|
|
23
24
|
property?: string | null;
|
|
24
25
|
};
|
|
@@ -109,6 +110,7 @@ export type MetricConfigData = {
|
|
|
109
110
|
value: {
|
|
110
111
|
id: string;
|
|
111
112
|
property: string;
|
|
113
|
+
formulaInputType?: IFormulaScope;
|
|
112
114
|
};
|
|
113
115
|
valueAggregate: {
|
|
114
116
|
label: AGGREGATE_LABEL;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.metricMakeTimeData = exports.makeBodyRequestMetrics = void 0;
|
|
4
|
+
const formulas_1 = require("../../formulas");
|
|
4
5
|
const general_1 = require("../../general");
|
|
5
6
|
const interfaces_1 = require("../../interfaces");
|
|
6
7
|
const REQUEST_ADAPTER_1 = require("../constants/REQUEST_ADAPTER");
|
|
@@ -34,12 +35,15 @@ const getFilterLogic = (filters) => (filters === null || filters === void 0 ? vo
|
|
|
34
35
|
* @returns A metric value object
|
|
35
36
|
*/
|
|
36
37
|
const metricMakeValue = (data) => {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
const isAggregateFormula = ((_a = data === null || data === void 0 ? void 0 : data.value) === null || _a === void 0 ? void 0 : _a.formulaInputType) === formulas_1.FORMULA_SCOPE.AGGREGATE;
|
|
40
|
+
const metricValue = {
|
|
41
|
+
questionid: (_b = data === null || data === void 0 ? void 0 : data.value) === null || _b === void 0 ? void 0 : _b.id,
|
|
41
42
|
property: ((_c = data === null || data === void 0 ? void 0 : data.value) === null || _c === void 0 ? void 0 : _c.property) || null,
|
|
42
43
|
};
|
|
44
|
+
if (!isAggregateFormula)
|
|
45
|
+
metricValue.aggregate = (_d = data === null || data === void 0 ? void 0 : data.valueAggregate) === null || _d === void 0 ? void 0 : _d.label;
|
|
46
|
+
return metricValue;
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* If data is truthy and data.dateColumn is truthy, return true, otherwise return false.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IBColumn, IColumnType } from "../../columns";
|
|
2
2
|
import { IDateGroupingProperty, RelativeCursor } from "../../dates";
|
|
3
3
|
import { IFBLogic } from "../../filters";
|
|
4
|
+
import { IFormulaScope } from "../../formulas";
|
|
4
5
|
import { TimePeriod, TP_CUSTOM_RANGE } from "../../interfaces";
|
|
5
6
|
import { AGGREGATE_LABEL } from "../constants";
|
|
6
7
|
export interface MetricRequestPayload {
|
|
@@ -18,7 +19,7 @@ export interface MetricRequestPayload {
|
|
|
18
19
|
* property "answered".
|
|
19
20
|
*/
|
|
20
21
|
export type MetricValue = {
|
|
21
|
-
aggregate
|
|
22
|
+
aggregate?: AGGREGATE_LABEL;
|
|
22
23
|
questionid: string;
|
|
23
24
|
property?: string | null;
|
|
24
25
|
};
|
|
@@ -109,6 +110,7 @@ export type MetricConfigData = {
|
|
|
109
110
|
value: {
|
|
110
111
|
id: string;
|
|
111
112
|
property: string;
|
|
113
|
+
formulaInputType?: IFormulaScope;
|
|
112
114
|
};
|
|
113
115
|
valueAggregate: {
|
|
114
116
|
label: AGGREGATE_LABEL;
|
|
@@ -131,7 +131,10 @@ class DurationFormatter {
|
|
|
131
131
|
let _number = number;
|
|
132
132
|
_number *= this.numberFactor;
|
|
133
133
|
const durationParts = this.parts.reduce((store, part) => {
|
|
134
|
-
|
|
134
|
+
const roundDuration = Math.floor(Math.abs(_number / part.ms));
|
|
135
|
+
const durationValid = roundDuration * (_number < 0 ? -1 : 1);
|
|
136
|
+
store[part.symbol] =
|
|
137
|
+
durationValid === 0 ? Math.abs(durationValid) : durationValid;
|
|
135
138
|
_number %= part.ms;
|
|
136
139
|
return store;
|
|
137
140
|
}, {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COLUMN_BY_FORMULA = exports.FORMULA = void 0;
|
|
3
|
+
exports.FORMULA_SCOPE = exports.COLUMN_BY_FORMULA = exports.FORMULA = void 0;
|
|
4
4
|
const COLUMN_1 = require("../../columns/constants/COLUMN");
|
|
5
5
|
var FORMULA;
|
|
6
6
|
(function (FORMULA) {
|
|
@@ -15,3 +15,8 @@ exports.COLUMN_BY_FORMULA = {
|
|
|
15
15
|
[FORMULA.TEXT]: COLUMN_1.COLUMN.TEXT_FORMULA,
|
|
16
16
|
[FORMULA.BOOLEAN]: COLUMN_1.COLUMN.TEXT_FORMULA,
|
|
17
17
|
};
|
|
18
|
+
var FORMULA_SCOPE;
|
|
19
|
+
(function (FORMULA_SCOPE) {
|
|
20
|
+
FORMULA_SCOPE["RAW"] = "RAW";
|
|
21
|
+
FORMULA_SCOPE["AGGREGATE"] = "AGGREGATE";
|
|
22
|
+
})(FORMULA_SCOPE || (exports.FORMULA_SCOPE = FORMULA_SCOPE = {}));
|
|
@@ -128,7 +128,10 @@ export class DurationFormatter {
|
|
|
128
128
|
let _number = number;
|
|
129
129
|
_number *= this.numberFactor;
|
|
130
130
|
const durationParts = this.parts.reduce((store, part) => {
|
|
131
|
-
|
|
131
|
+
const roundDuration = Math.floor(Math.abs(_number / part.ms));
|
|
132
|
+
const durationValid = roundDuration * (_number < 0 ? -1 : 1);
|
|
133
|
+
store[part.symbol] =
|
|
134
|
+
durationValid === 0 ? Math.abs(durationValid) : durationValid;
|
|
132
135
|
_number %= part.ms;
|
|
133
136
|
return store;
|
|
134
137
|
}, {});
|
|
@@ -12,3 +12,8 @@ export const COLUMN_BY_FORMULA = {
|
|
|
12
12
|
[FORMULA.TEXT]: COLUMN.TEXT_FORMULA,
|
|
13
13
|
[FORMULA.BOOLEAN]: COLUMN.TEXT_FORMULA,
|
|
14
14
|
};
|
|
15
|
+
export var FORMULA_SCOPE;
|
|
16
|
+
(function (FORMULA_SCOPE) {
|
|
17
|
+
FORMULA_SCOPE["RAW"] = "RAW";
|
|
18
|
+
FORMULA_SCOPE["AGGREGATE"] = "AGGREGATE";
|
|
19
|
+
})(FORMULA_SCOPE || (FORMULA_SCOPE = {}));
|