namirasoft-bill-watch 1.4.6 → 1.4.7

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.
Files changed (122) hide show
  1. package/.ns-sdkg-dir-deep +7 -0
  2. package/.ns-sdkg-dir-keep +0 -0
  3. package/.ns-sdkg-file-keep +21 -0
  4. package/dist/NamirasoftBillWatchServer.js +1 -1
  5. package/dist/formula/BaseFormula.d.ts +14 -0
  6. package/dist/formula/BaseFormula.js +237 -0
  7. package/dist/formula/BaseFormula.js.map +1 -0
  8. package/dist/formula/CalculationResult.d.ts +7 -0
  9. package/dist/formula/CalculationResult.js +3 -0
  10. package/dist/formula/CalculationResult.js.map +1 -0
  11. package/dist/formula/ChangeType.d.ts +5 -0
  12. package/dist/formula/ChangeType.js +10 -0
  13. package/dist/formula/ChangeType.js.map +1 -0
  14. package/dist/formula/FormulaDefinitionRow.d.ts +12 -0
  15. package/dist/formula/FormulaDefinitionRow.js +3 -0
  16. package/dist/formula/FormulaDefinitionRow.js.map +1 -0
  17. package/dist/formula/FormulaRow.d.ts +8 -0
  18. package/dist/formula/FormulaRow.js +3 -0
  19. package/dist/formula/FormulaRow.js.map +1 -0
  20. package/dist/formula/statistical/Formula_InterquartileRange.d.ts +9 -0
  21. package/dist/formula/statistical/Formula_InterquartileRange.js +46 -0
  22. package/dist/formula/statistical/Formula_InterquartileRange.js.map +1 -0
  23. package/dist/formula/statistical/amount/Formula_AmountByAverage.d.ts +8 -0
  24. package/dist/formula/statistical/amount/Formula_AmountByAverage.js +22 -0
  25. package/dist/formula/statistical/amount/Formula_AmountByAverage.js.map +1 -0
  26. package/dist/formula/statistical/amount/Formula_AmountByLast.d.ts +8 -0
  27. package/dist/formula/statistical/amount/Formula_AmountByLast.js +22 -0
  28. package/dist/formula/statistical/amount/Formula_AmountByLast.js.map +1 -0
  29. package/dist/formula/statistical/amount/Formula_AmountByMax.d.ts +8 -0
  30. package/dist/formula/statistical/amount/Formula_AmountByMax.js +22 -0
  31. package/dist/formula/statistical/amount/Formula_AmountByMax.js.map +1 -0
  32. package/dist/formula/statistical/amount/Formula_AmountByMedian.d.ts +8 -0
  33. package/dist/formula/statistical/amount/Formula_AmountByMedian.js +22 -0
  34. package/dist/formula/statistical/amount/Formula_AmountByMedian.js.map +1 -0
  35. package/dist/formula/statistical/amount/Formula_AmountByMin.d.ts +8 -0
  36. package/dist/formula/statistical/amount/Formula_AmountByMin.js +22 -0
  37. package/dist/formula/statistical/amount/Formula_AmountByMin.js.map +1 -0
  38. package/dist/formula/statistical/percent/Formula_PercentageByAverage.d.ts +8 -0
  39. package/dist/formula/statistical/percent/Formula_PercentageByAverage.js +22 -0
  40. package/dist/formula/statistical/percent/Formula_PercentageByAverage.js.map +1 -0
  41. package/dist/formula/statistical/percent/Formula_PercentageByLast.d.ts +8 -0
  42. package/dist/formula/statistical/percent/Formula_PercentageByLast.js +22 -0
  43. package/dist/formula/statistical/percent/Formula_PercentageByLast.js.map +1 -0
  44. package/dist/formula/statistical/percent/Formula_PercentageByMax.d.ts +8 -0
  45. package/dist/formula/statistical/percent/Formula_PercentageByMax.js +22 -0
  46. package/dist/formula/statistical/percent/Formula_PercentageByMax.js.map +1 -0
  47. package/dist/formula/statistical/percent/Formula_PercentageByMedian.d.ts +8 -0
  48. package/dist/formula/statistical/percent/Formula_PercentageByMedian.js +22 -0
  49. package/dist/formula/statistical/percent/Formula_PercentageByMedian.js.map +1 -0
  50. package/dist/formula/statistical/percent/Formula_PercentageByMin.d.ts +8 -0
  51. package/dist/formula/statistical/percent/Formula_PercentageByMin.js +22 -0
  52. package/dist/formula/statistical/percent/Formula_PercentageByMin.js.map +1 -0
  53. package/dist/formula/statistical/z_score/Formula_GrubbsTest.d.ts +9 -0
  54. package/dist/formula/statistical/z_score/Formula_GrubbsTest.js +55 -0
  55. package/dist/formula/statistical/z_score/Formula_GrubbsTest.js.map +1 -0
  56. package/dist/formula/statistical/z_score/Formula_ModifiedZScore.d.ts +8 -0
  57. package/dist/formula/statistical/z_score/Formula_ModifiedZScore.js +30 -0
  58. package/dist/formula/statistical/z_score/Formula_ModifiedZScore.js.map +1 -0
  59. package/dist/formula/statistical/z_score/Formula_ZScore.d.ts +8 -0
  60. package/dist/formula/statistical/z_score/Formula_ZScore.js +30 -0
  61. package/dist/formula/statistical/z_score/Formula_ZScore.js.map +1 -0
  62. package/dist/formula/trend/Formula_RegressionResidual.d.ts +8 -0
  63. package/dist/formula/trend/Formula_RegressionResidual.js +41 -0
  64. package/dist/formula/trend/Formula_RegressionResidual.js.map +1 -0
  65. package/dist/formula/trend/Formula_TrendDeviation.d.ts +8 -0
  66. package/dist/formula/trend/Formula_TrendDeviation.js +37 -0
  67. package/dist/formula/trend/Formula_TrendDeviation.js.map +1 -0
  68. package/dist/index.d.ts +21 -0
  69. package/dist/index.js +21 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/meta/AWSMetaTable.js +1 -1
  72. package/dist/meta/AWSMetaTable.js.map +1 -1
  73. package/dist/meta/AzureMetaTable.js +1 -1
  74. package/dist/meta/AzureMetaTable.js.map +1 -1
  75. package/dist/meta/GCPMetaTable.js +1 -1
  76. package/dist/meta/GCPMetaTable.js.map +1 -1
  77. package/dist/meta/RuleMetaTable.js +1 -1
  78. package/dist/meta/RuleMetaTable.js.map +1 -1
  79. package/dist/row/AWSFullRow.d.ts +1 -1
  80. package/dist/row/AWSRow.d.ts +1 -1
  81. package/dist/row/AzureFullRow.d.ts +1 -1
  82. package/dist/row/AzureRow.d.ts +1 -1
  83. package/dist/row/GCPFullRow.d.ts +1 -1
  84. package/dist/row/GCPRow.d.ts +1 -1
  85. package/dist/row/RuleFullRow.d.ts +1 -1
  86. package/dist/row/RuleRow.d.ts +1 -1
  87. package/package.json +1 -1
  88. package/src/NamirasoftBillWatchServer.ts +1 -1
  89. package/src/formula/BaseFormula.ts +244 -0
  90. package/src/formula/CalculationResult.ts +5 -0
  91. package/src/formula/ChangeType.ts +6 -0
  92. package/src/formula/FormulaDefinitionRow.ts +13 -0
  93. package/src/formula/FormulaRow.ts +7 -0
  94. package/src/formula/statistical/Formula_InterquartileRange.ts +53 -0
  95. package/src/formula/statistical/amount/Formula_AmountByAverage.ts +25 -0
  96. package/src/formula/statistical/amount/Formula_AmountByLast.ts +25 -0
  97. package/src/formula/statistical/amount/Formula_AmountByMax.ts +25 -0
  98. package/src/formula/statistical/amount/Formula_AmountByMedian.ts +25 -0
  99. package/src/formula/statistical/amount/Formula_AmountByMin.ts +25 -0
  100. package/src/formula/statistical/percent/Formula_PercentageByAverage.ts +25 -0
  101. package/src/formula/statistical/percent/Formula_PercentageByLast.ts +25 -0
  102. package/src/formula/statistical/percent/Formula_PercentageByMax.ts +25 -0
  103. package/src/formula/statistical/percent/Formula_PercentageByMedian.ts +25 -0
  104. package/src/formula/statistical/percent/Formula_PercentageByMin.ts +25 -0
  105. package/src/formula/statistical/z_score/Formula_GrubbsTest.ts +65 -0
  106. package/src/formula/statistical/z_score/Formula_ModifiedZScore.ts +35 -0
  107. package/src/formula/statistical/z_score/Formula_ZScore.ts +35 -0
  108. package/src/formula/trend/Formula_RegressionResidual.ts +49 -0
  109. package/src/formula/trend/Formula_TrendDeviation.ts +45 -0
  110. package/src/index.ts +21 -0
  111. package/src/meta/AWSMetaTable.ts +1 -1
  112. package/src/meta/AzureMetaTable.ts +1 -1
  113. package/src/meta/GCPMetaTable.ts +1 -1
  114. package/src/meta/RuleMetaTable.ts +1 -1
  115. package/src/row/AWSFullRow.ts +1 -1
  116. package/src/row/AWSRow.ts +1 -1
  117. package/src/row/AzureFullRow.ts +1 -1
  118. package/src/row/AzureRow.ts +1 -1
  119. package/src/row/GCPFullRow.ts +1 -1
  120. package/src/row/GCPRow.ts +1 -1
  121. package/src/row/RuleFullRow.ts +1 -1
  122. package/src/row/RuleRow.ts +1 -1
@@ -0,0 +1,7 @@
1
+ /src
2
+ /src/formula
3
+ /src/formula/statistical
4
+ /src/formula/statistical/amount
5
+ /src/formula/statistical/percent
6
+ /src/formula/statistical/z_score
7
+ /src/formula/trend
File without changes
@@ -0,0 +1,21 @@
1
+ src/formula/BaseFormula.ts
2
+ src/formula/CalculationResult.ts
3
+ src/formula/ChangeType.ts
4
+ src/formula/FormulaDefinitionRow.ts
5
+ src/formula/FormulaRow.ts
6
+ src/formula/statistical/amount/Formula_AmountByMedian.ts
7
+ src/formula/statistical/amount/Formula_AmountByMax.ts
8
+ src/formula/statistical/amount/Formula_AmountByLast.ts
9
+ src/formula/statistical/amount/Formula_AmountByAverage.ts
10
+ src/formula/statistical/amount/Formula_AmountByMin.ts
11
+ src/formula/statistical/percent/Formula_PercentageByMin.ts
12
+ src/formula/statistical/percent/Formula_PercentageByMedian.ts
13
+ src/formula/statistical/percent/Formula_PercentageByMax.ts
14
+ src/formula/statistical/percent/Formula_PercentageByLast.ts
15
+ src/formula/statistical/percent/Formula_PercentageByAverage.ts
16
+ src/formula/statistical/z_score/Formula_GrubbsTest.ts
17
+ src/formula/statistical/z_score/Formula_ModifiedZScore.ts
18
+ src/formula/statistical/z_score/Formula_ZScore.ts
19
+ src/formula/statistical/Formula_InterquartileRange.ts
20
+ src/formula/trend/Formula_TrendDeviation.ts
21
+ src/formula/trend/Formula_RegressionResidual.ts
@@ -22,7 +22,7 @@ const NamirasoftBillWatchServerRuleTag_1 = require("./NamirasoftBillWatchServerR
22
22
  const NamirasoftBillWatchServerValue_1 = require("./NamirasoftBillWatchServerValue");
23
23
  class NamirasoftBillWatchServer extends namirasoft_account_1.NSABaseServer {
24
24
  constructor(base_url, manager, onError) {
25
- super(base_url, `1.4.6`, manager, onError);
25
+ super(base_url, `1.4.7`, manager, onError);
26
26
  this.healthz = new NamirasoftBillWatchServerHealthz_1.NamirasoftBillWatchServerHealthz(this);
27
27
  this.value = new NamirasoftBillWatchServerValue_1.NamirasoftBillWatchServerValue(this);
28
28
  this.a_w_s_category = new NamirasoftBillWatchServerAWSCategory_1.NamirasoftBillWatchServerAWSCategory(this);
@@ -0,0 +1,14 @@
1
+ import { CalculationResult } from "./CalculationResult";
2
+ import { ChangeType } from "./ChangeType";
3
+ import { FormulaDefinitionRow } from "./FormulaDefinitionRow";
4
+ export declare abstract class BaseFormula {
5
+ static ALL: FormulaDefinitionRow[];
6
+ checkLength(data: number[], min_length: number): CalculationResult | null;
7
+ checkChnage(change: ChangeType, difference: number, values: {
8
+ [name: string]: any;
9
+ }): CalculationResult | null;
10
+ protected static median(arr: number[]): number;
11
+ abstract evaluate(data: number[], value: number, change: ChangeType, parameters: {
12
+ [name: string]: number;
13
+ }): CalculationResult;
14
+ }
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseFormula = void 0;
4
+ const ChangeType_1 = require("./ChangeType");
5
+ const Formula_AmountByAverage_1 = require("./statistical/amount/Formula_AmountByAverage");
6
+ const Formula_AmountByLast_1 = require("./statistical/amount/Formula_AmountByLast");
7
+ const Formula_AmountByMax_1 = require("./statistical/amount/Formula_AmountByMax");
8
+ const Formula_AmountByMedian_1 = require("./statistical/amount/Formula_AmountByMedian");
9
+ const Formula_AmountByMin_1 = require("./statistical/amount/Formula_AmountByMin");
10
+ const Formula_InterquartileRange_1 = require("./statistical/Formula_InterquartileRange");
11
+ const Formula_PercentageByAverage_1 = require("./statistical/percent/Formula_PercentageByAverage");
12
+ const Formula_PercentageByLast_1 = require("./statistical/percent/Formula_PercentageByLast");
13
+ const Formula_PercentageByMax_1 = require("./statistical/percent/Formula_PercentageByMax");
14
+ const Formula_PercentageByMedian_1 = require("./statistical/percent/Formula_PercentageByMedian");
15
+ const Formula_PercentageByMin_1 = require("./statistical/percent/Formula_PercentageByMin");
16
+ const Formula_GrubbsTest_1 = require("./statistical/z_score/Formula_GrubbsTest");
17
+ const Formula_ModifiedZScore_1 = require("./statistical/z_score/Formula_ModifiedZScore");
18
+ const Formula_ZScore_1 = require("./statistical/z_score/Formula_ZScore");
19
+ const Formula_RegressionResidual_1 = require("./trend/Formula_RegressionResidual");
20
+ const Formula_TrendDeviation_1 = require("./trend/Formula_TrendDeviation");
21
+ class BaseFormula {
22
+ checkLength(data, min_length) {
23
+ if (data.length < min_length)
24
+ return {
25
+ value: null,
26
+ reason: `Not enough data to calculate.`,
27
+ values: { required: `atleast ${min_length}`, provided: data.length }
28
+ };
29
+ return null;
30
+ }
31
+ checkChnage(change, difference, values) {
32
+ if (change == ChangeType_1.ChangeType.Increased)
33
+ if (difference < 0)
34
+ return {
35
+ value: null,
36
+ reason: `Chnage Type is set to 'If Increased', but the difference is negative.`,
37
+ values
38
+ };
39
+ if (change == ChangeType_1.ChangeType.Decreased)
40
+ if (difference > 0)
41
+ return {
42
+ value: null,
43
+ reason: `Chnage Type is set to 'If Decreased', but the difference is positive.`,
44
+ values
45
+ };
46
+ return null;
47
+ }
48
+ static median(arr) {
49
+ if (arr.length === 0)
50
+ return NaN;
51
+ const sorted = [...arr].sort((a, b) => a - b);
52
+ const mid = Math.floor(sorted.length / 2);
53
+ if (sorted.length % 2 === 0)
54
+ return (sorted[mid - 1] + sorted[mid]) / 2;
55
+ return sorted[mid];
56
+ }
57
+ }
58
+ exports.BaseFormula = BaseFormula;
59
+ BaseFormula.ALL = [
60
+ {
61
+ name: "AmountByLast",
62
+ parameters: {
63
+ amount: {
64
+ default: 2,
65
+ min: 1,
66
+ max: 10000
67
+ }
68
+ },
69
+ getCalculator: () => new Formula_AmountByLast_1.Formula_AmountByLast()
70
+ },
71
+ {
72
+ name: "AmountByMin",
73
+ parameters: {
74
+ amount: {
75
+ default: 2,
76
+ min: 1,
77
+ max: 10000
78
+ }
79
+ },
80
+ getCalculator: () => new Formula_AmountByMin_1.Formula_AmountByMin()
81
+ },
82
+ {
83
+ name: "AmountByMax",
84
+ parameters: {
85
+ amount: {
86
+ default: 2,
87
+ min: 1,
88
+ max: 10000
89
+ }
90
+ },
91
+ getCalculator: () => new Formula_AmountByMax_1.Formula_AmountByMax()
92
+ },
93
+ {
94
+ name: "AmountByAverage",
95
+ parameters: {
96
+ amount: {
97
+ default: 2,
98
+ min: 1,
99
+ max: 10000
100
+ }
101
+ },
102
+ getCalculator: () => new Formula_AmountByAverage_1.Formula_AmountByAverage()
103
+ },
104
+ {
105
+ name: "AmountByMedian",
106
+ parameters: {
107
+ amount: {
108
+ default: 2,
109
+ min: 1,
110
+ max: 10000
111
+ }
112
+ },
113
+ getCalculator: () => new Formula_AmountByMedian_1.Formula_AmountByMedian()
114
+ },
115
+ {
116
+ name: "PercentageByLast",
117
+ parameters: {
118
+ percent: {
119
+ default: 5,
120
+ min: 1,
121
+ max: 100
122
+ }
123
+ },
124
+ getCalculator: () => new Formula_PercentageByLast_1.Formula_PercentageByLast()
125
+ },
126
+ {
127
+ name: "PercentageByMin",
128
+ parameters: {
129
+ percent: {
130
+ default: 5,
131
+ min: 1,
132
+ max: 100
133
+ }
134
+ },
135
+ getCalculator: () => new Formula_PercentageByMin_1.Formula_PercentageByMin()
136
+ },
137
+ {
138
+ name: "PercentageByMax",
139
+ parameters: {
140
+ percent: {
141
+ default: 5,
142
+ min: 1,
143
+ max: 100
144
+ }
145
+ },
146
+ getCalculator: () => new Formula_PercentageByMax_1.Formula_PercentageByMax()
147
+ },
148
+ {
149
+ name: "PercentageByAverage",
150
+ parameters: {
151
+ percent: {
152
+ default: 5,
153
+ min: 1,
154
+ max: 100
155
+ }
156
+ },
157
+ getCalculator: () => new Formula_PercentageByAverage_1.Formula_PercentageByAverage()
158
+ },
159
+ {
160
+ name: "PercentageByMedian",
161
+ parameters: {
162
+ percent: {
163
+ default: 5,
164
+ min: 1,
165
+ max: 100
166
+ }
167
+ },
168
+ getCalculator: () => new Formula_PercentageByMedian_1.Formula_PercentageByMedian()
169
+ },
170
+ {
171
+ name: "ZScore",
172
+ parameters: {
173
+ threshold: {
174
+ default: 2,
175
+ min: 1,
176
+ max: 5
177
+ }
178
+ },
179
+ getCalculator: () => new Formula_ZScore_1.Formula_ZScore()
180
+ },
181
+ {
182
+ name: "ModifiedZScore",
183
+ parameters: {
184
+ threshold: {
185
+ default: 3.5,
186
+ min: 2,
187
+ max: 5
188
+ }
189
+ },
190
+ getCalculator: () => new Formula_ModifiedZScore_1.Formula_ModifiedZScore()
191
+ },
192
+ {
193
+ name: "GrubbsTest",
194
+ parameters: {
195
+ rough_threshold: {
196
+ default: 0.05,
197
+ min: 0.001,
198
+ max: 0.1
199
+ }
200
+ },
201
+ getCalculator: () => new Formula_GrubbsTest_1.Formula_GrubbsTest()
202
+ },
203
+ {
204
+ name: "InterquartileRange",
205
+ parameters: {
206
+ multiplier: {
207
+ default: 1.5,
208
+ min: 1,
209
+ max: 3
210
+ }
211
+ },
212
+ getCalculator: () => new Formula_InterquartileRange_1.Formula_InterquartileRange()
213
+ },
214
+ {
215
+ name: "RegressionResidual",
216
+ parameters: {
217
+ threshold: {
218
+ default: 2,
219
+ min: 1,
220
+ max: 5
221
+ }
222
+ },
223
+ getCalculator: () => new Formula_RegressionResidual_1.Formula_RegressionResidual()
224
+ },
225
+ {
226
+ name: "TrendDeviation",
227
+ parameters: {
228
+ threshold: {
229
+ default: 1,
230
+ min: 0.1,
231
+ max: 2
232
+ }
233
+ },
234
+ getCalculator: () => new Formula_TrendDeviation_1.Formula_TrendDeviation()
235
+ },
236
+ ];
237
+ //# sourceMappingURL=BaseFormula.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseFormula.js","sourceRoot":"","sources":["../../src/formula/BaseFormula.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAE1C,0FAAuF;AACvF,oFAAiF;AACjF,kFAA+E;AAC/E,wFAAqF;AACrF,kFAA+E;AAC/E,yFAAsF;AACtF,mGAAgG;AAChG,6FAA0F;AAC1F,2FAAwF;AACxF,iGAA8F;AAC9F,2FAAwF;AACxF,iFAA8E;AAC9E,yFAAsF;AACtF,yEAAsE;AACtE,mFAAgF;AAChF,2EAAwE;AAExE,MAAsB,WAAW;IAoL7B,WAAW,CAAC,IAAc,EAAE,UAAkB;QAE1C,IAAI,IAAI,CAAC,M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E,GAAG,EAAE,CAAC,IAAI,+CAAsB,EAAE;KACpD;IACD;QACI,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE;YACR,eAAe,EAAE;gBACb,OAAO,EAAE,IAAI;gBACb,GAAG,EAAE,KAAK;gBACV,GAAG,EAAE,GAAG;aACX;SACJ;QACD,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,uCAAkB,EAAE;KAChD;IACD;QACI,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE;YACR,UAAU,EAAE;gBACR,OAAO,EAAE,GAAG;gBACZ,GAAG,EAAE,CAAC;gBACN,GAAG,EAAE,CAAC;aACT;SACJ;QACD,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,uDAA0B,EAAE;KACxD;IACD;QACI,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE;YACR,SAAS,EAAE;gBACP,OAAO,EAAE,CAAC;gBACV,GAAG,EAAE,CAAC;gBACN,GAAG,EAAE,CAAC;aACT;SACJ;QACD,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,uDAA0B,EAAE;KACxD;IACD;QACI,IAAI,EAAE,gBAAgB;QACtB,UAAU,EAAE;YACR,SAAS,EAAE;gBACP,OAAO,EAAE,CAAC;gBACV,GAAG,EAAE,GAAG;gBACR,GAAG,EAAE,CAAC;aACT;SACJ;QACD,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,+CAAsB,EAAE;KACpD;CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type CalculationResult = {
2
+ value: boolean | null;
3
+ reason?: string;
4
+ values: {
5
+ [name: string]: any;
6
+ };
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=CalculationResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculationResult.js","sourceRoot":"","sources":["../../src/formula/CalculationResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare enum ChangeType {
2
+ Increased = "Increased",
3
+ Decreased = "Decreased",
4
+ Any = "Any"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChangeType = void 0;
4
+ var ChangeType;
5
+ (function (ChangeType) {
6
+ ChangeType["Increased"] = "Increased";
7
+ ChangeType["Decreased"] = "Decreased";
8
+ ChangeType["Any"] = "Any";
9
+ })(ChangeType || (exports.ChangeType = ChangeType = {}));
10
+ //# sourceMappingURL=ChangeType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeType.js","sourceRoot":"","sources":["../../src/formula/ChangeType.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAKX;AALD,WAAY,UAAU;IAElB,qCAAuB,CAAA;IACvB,qCAAuB,CAAA;IACvB,yBAAW,CAAA;AACf,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB"}
@@ -0,0 +1,12 @@
1
+ import { BaseFormula } from "./BaseFormula";
2
+ export type FormulaDefinitionRow = {
3
+ name: string;
4
+ parameters: {
5
+ [name: string]: {
6
+ default: number;
7
+ min: number | null;
8
+ max: number | null;
9
+ };
10
+ };
11
+ getCalculator: () => BaseFormula;
12
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=FormulaDefinitionRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormulaDefinitionRow.js","sourceRoot":"","sources":["../../src/formula/FormulaDefinitionRow.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { ChangeType } from "./ChangeType";
2
+ export type FormulaRow = {
3
+ name: string;
4
+ change: ChangeType;
5
+ parameters: {
6
+ [name: string]: number;
7
+ };
8
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=FormulaRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormulaRow.js","sourceRoot":"","sources":["../../src/formula/FormulaRow.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { BaseFormula } from "../BaseFormula";
2
+ import { CalculationResult } from "../CalculationResult";
3
+ import { ChangeType } from "../ChangeType";
4
+ export declare class Formula_InterquartileRange extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ multiplier: number;
7
+ }): CalculationResult;
8
+ private calculatePercentile;
9
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formula_InterquartileRange = void 0;
4
+ const BaseFormula_1 = require("../BaseFormula");
5
+ class Formula_InterquartileRange extends BaseFormula_1.BaseFormula {
6
+ evaluate(data, value, change, parameters) {
7
+ let err = this.checkLength(data, 4);
8
+ if (err)
9
+ return err;
10
+ let sorted = [...data].sort((a, b) => a - b);
11
+ let q1 = this.calculatePercentile(sorted, 25);
12
+ let q3 = this.calculatePercentile(sorted, 75);
13
+ let iqr = q3 - q1;
14
+ if (iqr === 0)
15
+ return {
16
+ value: null,
17
+ reason: `IQR is zero.`,
18
+ values: { q1, q3, iqr }
19
+ };
20
+ let lower_bound = q1 - parameters.multiplier * iqr;
21
+ let upper_bound = q3 + parameters.multiplier * iqr;
22
+ let difference = 0;
23
+ if (value < lower_bound)
24
+ difference = value - lower_bound;
25
+ if (value > upper_bound)
26
+ difference = value - upper_bound;
27
+ err = this.checkChnage(change, difference, { q1, q3, iqr, lower_bound, upper_bound, difference });
28
+ if (err)
29
+ return err;
30
+ return {
31
+ value: value < lower_bound || value > upper_bound,
32
+ values: { q1, q3, iqr, lower_bound, upper_bound, difference }
33
+ };
34
+ }
35
+ calculatePercentile(sortedData, percentile) {
36
+ const index = (percentile / 100) * (sortedData.length - 1);
37
+ const lower = Math.floor(index);
38
+ const upper = Math.ceil(index);
39
+ const weight = index - lower;
40
+ if (upper >= sortedData.length)
41
+ return sortedData[lower];
42
+ return sortedData[lower] * (1 - weight) + sortedData[upper] * weight;
43
+ }
44
+ }
45
+ exports.Formula_InterquartileRange = Formula_InterquartileRange;
46
+ //# sourceMappingURL=Formula_InterquartileRange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula_InterquartileRange.js","sourceRoot":"","sources":["../../../src/formula/statistical/Formula_InterquartileRange.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAI7C,MAAa,0BAA2B,SAAQ,yBAAW;IAEvD,QAAQ,CAAC,IAAc,EAAE,KAAa,EAAE,MAAkB,EAAE,UAAkC;QAE1F,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,IAAI,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7C,IAAI,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC;QAElB,IAAI,GAAG,KAAK,CAAC;YACT,OAAO;gBACH,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE;aAC1B,CAAC;QAEN,IAAI,WAAW,GAAG,EAAE,GAAG,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC;QACnD,IAAI,WAAW,GAAG,EAAE,GAAG,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC;QACnD,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,KAAK,GAAG,WAAW;YACnB,UAAU,GAAG,KAAK,GAAG,WAAW,CAAC;QACrC,IAAI,KAAK,GAAG,WAAW;YACnB,UAAU,GAAG,KAAK,GAAG,WAAW,CAAC;QAErC,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;QAClG,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,OAAO;YACH,KAAK,EAAE,KAAK,GAAG,WAAW,IAAI,KAAK,GAAG,WAAW;YACjD,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE;SAChE,CAAC;IACN,CAAC;IAEO,mBAAmB,CAAC,UAAoB,EAAE,UAAkB;QAEhE,MAAM,KAAK,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;QAE7B,IAAI,KAAK,IAAI,UAAU,CAAC,MAAM;YAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;IACzE,CAAC;CACJ;AAhDD,gEAgDC"}
@@ -0,0 +1,8 @@
1
+ import { BaseFormula } from "../../BaseFormula";
2
+ import { CalculationResult } from "../../CalculationResult";
3
+ import { ChangeType } from "../../ChangeType";
4
+ export declare class Formula_AmountByAverage extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ amount: number;
7
+ }): CalculationResult;
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formula_AmountByAverage = void 0;
4
+ const BaseFormula_1 = require("../../BaseFormula");
5
+ class Formula_AmountByAverage extends BaseFormula_1.BaseFormula {
6
+ evaluate(data, value, change, parameters) {
7
+ let err = this.checkLength(data, 2);
8
+ if (err)
9
+ return err;
10
+ let mean = data.reduce((a, b) => a + b, 0) / data.length;
11
+ let difference = value - mean;
12
+ err = this.checkChnage(change, difference, { mean, difference });
13
+ if (err)
14
+ return err;
15
+ return {
16
+ value: Math.abs(difference) >= parameters.amount,
17
+ values: { mean, difference }
18
+ };
19
+ }
20
+ }
21
+ exports.Formula_AmountByAverage = Formula_AmountByAverage;
22
+ //# sourceMappingURL=Formula_AmountByAverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula_AmountByAverage.js","sourceRoot":"","sources":["../../../../src/formula/statistical/amount/Formula_AmountByAverage.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAIhD,MAAa,uBAAwB,SAAQ,yBAAW;IAEpD,QAAQ,CAAC,IAAc,EAAE,KAAa,EAAE,MAAkB,EAAE,UAA8B;QAEtF,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACzD,IAAI,UAAU,GAAG,KAAK,GAAG,IAAI,CAAC;QAE9B,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACjE,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM;YAChD,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;SAC/B,CAAC;IACN,CAAC;CACJ;AApBD,0DAoBC"}
@@ -0,0 +1,8 @@
1
+ import { BaseFormula } from "../../BaseFormula";
2
+ import { CalculationResult } from "../../CalculationResult";
3
+ import { ChangeType } from "../../ChangeType";
4
+ export declare class Formula_AmountByLast extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ amount: number;
7
+ }): CalculationResult;
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formula_AmountByLast = void 0;
4
+ const BaseFormula_1 = require("../../BaseFormula");
5
+ class Formula_AmountByLast extends BaseFormula_1.BaseFormula {
6
+ evaluate(data, value, change, parameters) {
7
+ let err = this.checkLength(data, 1);
8
+ if (err)
9
+ return err;
10
+ let last = data[data.length - 2];
11
+ let difference = value - last;
12
+ err = this.checkChnage(change, difference, { last, difference });
13
+ if (err)
14
+ return err;
15
+ return {
16
+ value: Math.abs(difference) >= parameters.amount,
17
+ values: { last, difference }
18
+ };
19
+ }
20
+ }
21
+ exports.Formula_AmountByLast = Formula_AmountByLast;
22
+ //# sourceMappingURL=Formula_AmountByLast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula_AmountByLast.js","sourceRoot":"","sources":["../../../../src/formula/statistical/amount/Formula_AmountByLast.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAIhD,MAAa,oBAAqB,SAAQ,yBAAW;IAEjD,QAAQ,CAAC,IAAc,EAAE,KAAa,EAAE,MAAkB,EAAE,UAA8B;QAEtF,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,IAAI,UAAU,GAAG,KAAK,GAAG,IAAI,CAAC;QAE9B,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACjE,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM;YAChD,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;SAC/B,CAAC;IACN,CAAC;CACJ;AApBD,oDAoBC"}
@@ -0,0 +1,8 @@
1
+ import { BaseFormula } from "../../BaseFormula";
2
+ import { CalculationResult } from "../../CalculationResult";
3
+ import { ChangeType } from "../../ChangeType";
4
+ export declare class Formula_AmountByMax extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ amount: number;
7
+ }): CalculationResult;
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formula_AmountByMax = void 0;
4
+ const BaseFormula_1 = require("../../BaseFormula");
5
+ class Formula_AmountByMax extends BaseFormula_1.BaseFormula {
6
+ evaluate(data, value, change, parameters) {
7
+ let err = this.checkLength(data, 2);
8
+ if (err)
9
+ return err;
10
+ let max = Math.max(...data);
11
+ let difference = value - max;
12
+ err = this.checkChnage(change, difference, { max, difference });
13
+ if (err)
14
+ return err;
15
+ return {
16
+ value: Math.abs(difference) >= parameters.amount,
17
+ values: { max, difference }
18
+ };
19
+ }
20
+ }
21
+ exports.Formula_AmountByMax = Formula_AmountByMax;
22
+ //# sourceMappingURL=Formula_AmountByMax.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula_AmountByMax.js","sourceRoot":"","sources":["../../../../src/formula/statistical/amount/Formula_AmountByMax.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAIhD,MAAa,mBAAoB,SAAQ,yBAAW;IAEhD,QAAQ,CAAC,IAAc,EAAE,KAAa,EAAE,MAAkB,EAAE,UAA8B;QAEtF,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5B,IAAI,UAAU,GAAG,KAAK,GAAG,GAAG,CAAC;QAE7B,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAChE,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM;YAChD,MAAM,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE;SAC9B,CAAC;IACN,CAAC;CACJ;AApBD,kDAoBC"}
@@ -0,0 +1,8 @@
1
+ import { BaseFormula } from "../../BaseFormula";
2
+ import { CalculationResult } from "../../CalculationResult";
3
+ import { ChangeType } from "../../ChangeType";
4
+ export declare class Formula_AmountByMedian extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ amount: number;
7
+ }): CalculationResult;
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formula_AmountByMedian = void 0;
4
+ const BaseFormula_1 = require("../../BaseFormula");
5
+ class Formula_AmountByMedian extends BaseFormula_1.BaseFormula {
6
+ evaluate(data, value, change, parameters) {
7
+ let err = this.checkLength(data, 2);
8
+ if (err)
9
+ return err;
10
+ let median = BaseFormula_1.BaseFormula.median(data);
11
+ let difference = value - median;
12
+ err = this.checkChnage(change, difference, { median, difference });
13
+ if (err)
14
+ return err;
15
+ return {
16
+ value: Math.abs(difference) >= parameters.amount,
17
+ values: { median, difference }
18
+ };
19
+ }
20
+ }
21
+ exports.Formula_AmountByMedian = Formula_AmountByMedian;
22
+ //# sourceMappingURL=Formula_AmountByMedian.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula_AmountByMedian.js","sourceRoot":"","sources":["../../../../src/formula/statistical/amount/Formula_AmountByMedian.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAIhD,MAAa,sBAAuB,SAAQ,yBAAW;IAEnD,QAAQ,CAAC,IAAc,EAAE,KAAa,EAAE,MAAkB,EAAE,UAA8B;QAEtF,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,IAAI,MAAM,GAAG,yBAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;QAEhC,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QACnE,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM;YAChD,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;SACjC,CAAC;IACN,CAAC;CACJ;AApBD,wDAoBC"}
@@ -0,0 +1,8 @@
1
+ import { BaseFormula } from "../../BaseFormula";
2
+ import { CalculationResult } from "../../CalculationResult";
3
+ import { ChangeType } from "../../ChangeType";
4
+ export declare class Formula_AmountByMin extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ amount: number;
7
+ }): CalculationResult;
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formula_AmountByMin = void 0;
4
+ const BaseFormula_1 = require("../../BaseFormula");
5
+ class Formula_AmountByMin extends BaseFormula_1.BaseFormula {
6
+ evaluate(data, value, change, parameters) {
7
+ let err = this.checkLength(data, 2);
8
+ if (err)
9
+ return err;
10
+ let min = Math.min(...data);
11
+ let difference = value - min;
12
+ err = this.checkChnage(change, difference, { min, difference });
13
+ if (err)
14
+ return err;
15
+ return {
16
+ value: Math.abs(difference) >= parameters.amount,
17
+ values: { min, difference }
18
+ };
19
+ }
20
+ }
21
+ exports.Formula_AmountByMin = Formula_AmountByMin;
22
+ //# sourceMappingURL=Formula_AmountByMin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula_AmountByMin.js","sourceRoot":"","sources":["../../../../src/formula/statistical/amount/Formula_AmountByMin.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAIhD,MAAa,mBAAoB,SAAQ,yBAAW;IAEhD,QAAQ,CAAC,IAAc,EAAE,KAAa,EAAE,MAAkB,EAAE,UAA8B;QAEtF,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5B,IAAI,UAAU,GAAG,KAAK,GAAG,GAAG,CAAC;QAE7B,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAChE,IAAI,GAAG;YACH,OAAO,GAAG,CAAC;QAEf,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM;YAChD,MAAM,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE;SAC9B,CAAC;IACN,CAAC;CACJ;AApBD,kDAoBC"}
@@ -0,0 +1,8 @@
1
+ import { BaseFormula } from "../../BaseFormula";
2
+ import { CalculationResult } from "../../CalculationResult";
3
+ import { ChangeType } from "../../ChangeType";
4
+ export declare class Formula_PercentageByAverage extends BaseFormula {
5
+ evaluate(data: number[], value: number, change: ChangeType, parameters: {
6
+ percent: number;
7
+ }): CalculationResult;
8
+ }