@ryuzaki13/react-foundation-lib 1.1.16 → 1.1.18
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/README.md +7 -5
- package/dist/chunks/{formatters-DCx4jhka.js → formatters-DeZh3JUD.js} +305 -305
- package/dist/chunks/{formatters-DCx4jhka.js.map → formatters-DeZh3JUD.js.map} +1 -1
- package/dist/chunks/{validate-B_ITGoAs.js → validate-DmeCsK9c.js} +11 -11
- package/dist/chunks/validate-DmeCsK9c.js.map +1 -0
- package/dist/error-report/errorInfo.d.ts.map +1 -1
- package/dist/error-report/index.js +133 -129
- package/dist/error-report/index.js.map +1 -1
- package/dist/excel/index.js +4 -4
- package/dist/formatters/index.js +3 -3
- package/dist/formatters/rowBased/registry.d.ts +9 -3
- package/dist/formatters/rowBased/registry.d.ts.map +1 -1
- package/dist/formulas/index.js +190 -2
- package/dist/formulas/index.js.map +1 -0
- package/dist/formulas/registry.d.ts +9 -3
- package/dist/formulas/registry.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/formulas-BxcH5Zjt.js +0 -279
- package/dist/chunks/formulas-BxcH5Zjt.js.map +0 -1
- package/dist/chunks/validate-B_ITGoAs.js.map +0 -1
- package/dist/formatters/rowBased/definitions/index.d.ts +0 -6
- package/dist/formatters/rowBased/definitions/index.d.ts.map +0 -1
- package/dist/formulas/definitions/base.d.ts +0 -7
- package/dist/formulas/definitions/base.d.ts.map +0 -1
- package/dist/formulas/definitions/index.d.ts +0 -3
- package/dist/formulas/definitions/index.d.ts.map +0 -1
- package/dist/formulas/definitions/sales.d.ts +0 -7
- package/dist/formulas/definitions/sales.d.ts.map +0 -1
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
//#endregion
|
|
2
|
-
//#region src/formulas/definitions/index.ts
|
|
3
|
-
var e = Object.freeze([
|
|
4
|
-
{
|
|
5
|
-
id: "divide",
|
|
6
|
-
name: "Деление",
|
|
7
|
-
description: "Legacy formula DIVIDE: [$0 / $1]",
|
|
8
|
-
fn: (e) => {
|
|
9
|
-
let t = e.num(0), n = e.num(1);
|
|
10
|
-
return n === 0 ? 0 : t / n;
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: "multiply",
|
|
15
|
-
name: "Умножение",
|
|
16
|
-
description: "Legacy formula MULTIPLY: $0 * $1",
|
|
17
|
-
fn: (e) => e.num(0) * e.num(1)
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: "substract",
|
|
21
|
-
name: "Вычитание",
|
|
22
|
-
description: "Legacy formula SUBSTRACT: $0 - $1",
|
|
23
|
-
fn: (e) => e.num(0) - e.num(1)
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: "add",
|
|
27
|
-
name: "Сложение",
|
|
28
|
-
description: "Legacy formula ADD: $0 + $1",
|
|
29
|
-
fn: (e) => e.num(0) + e.num(1)
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "percent",
|
|
33
|
-
name: "Процент",
|
|
34
|
-
description: "Рассчитывает стандартный процент по формуле: B / A * 100.",
|
|
35
|
-
fn: (e) => {
|
|
36
|
-
let t = e.num(0), n = e.num(1) / t;
|
|
37
|
-
return isFinite(n) ? n * 100 : 0;
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "markup",
|
|
42
|
-
name: "Наценка, %",
|
|
43
|
-
description: "Рассчитывает наценку по формуле: A / (B - A) * 100",
|
|
44
|
-
args: ["закупочная цена", "продажная цена"],
|
|
45
|
-
fn: (e) => {
|
|
46
|
-
let t = e.num(0), n = e.num(1) - t;
|
|
47
|
-
return n === 0 ? 0 : t / n * 100;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: "markup_ssc",
|
|
52
|
-
name: "Наценка ССЦ, %",
|
|
53
|
-
description: "Рассчитывает наценку по формуле: (A - B) / C",
|
|
54
|
-
args: [
|
|
55
|
-
"выручка",
|
|
56
|
-
"план ССЦ",
|
|
57
|
-
"план"
|
|
58
|
-
],
|
|
59
|
-
fn: (e) => {
|
|
60
|
-
let t = e.num(2);
|
|
61
|
-
return t === 0 ? 0 : (e.num(0) - e.num(1)) / t;
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "plan_deviation_percent",
|
|
66
|
-
name: "% отклонения факта от плана",
|
|
67
|
-
description: "Процент отклонения факта от плана/ГП относительного плана: legacy f1 '($0 - $1) / $1 * 100'",
|
|
68
|
-
fn: (e) => {
|
|
69
|
-
let t = e.num(0), n = e.num(1);
|
|
70
|
-
return (t - n) / n * 100;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "growth_percent",
|
|
75
|
-
name: "% прироста/снижения к АППГ",
|
|
76
|
-
description: "Процентная динамика к АППГ: legacy f2 '100 * $0 / $1 - 100'",
|
|
77
|
-
fn: (e) => {
|
|
78
|
-
let t = e.num(0), n = e.num(1);
|
|
79
|
-
return n === 0 ? 0 : 100 * t / n - 100;
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: "ssc_per_ton",
|
|
84
|
-
name: "ССЦ за тонну",
|
|
85
|
-
description: "ССЦ за тонну (выручка - МП) / тн: legacy f5 ($0 - $1) / $2",
|
|
86
|
-
fn: (e) => {
|
|
87
|
-
let t = e.num(0), n = e.num(1), r = e.num(2);
|
|
88
|
-
return r === 0 ? 0 : t * n / r;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
]);
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/formulas/registry.ts
|
|
94
|
-
function t(e) {
|
|
95
|
-
let t = /* @__PURE__ */ new Map(), n = [];
|
|
96
|
-
for (let r of e) {
|
|
97
|
-
let e = r.id.trim();
|
|
98
|
-
if (!e) throw Error("Formula v2 id не может быть пустым");
|
|
99
|
-
if (t.has(e)) throw Error(`Найден дублирующийся formulaId в v2: ${e}`);
|
|
100
|
-
let i = Object.freeze({
|
|
101
|
-
...r,
|
|
102
|
-
id: e,
|
|
103
|
-
name: r.name.trim(),
|
|
104
|
-
description: r.description.trim(),
|
|
105
|
-
examples: r.keywords ? [...r.keywords] : void 0
|
|
106
|
-
});
|
|
107
|
-
t.set(e, i), n.push(i);
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
list: Object.freeze(n),
|
|
111
|
-
byId: t
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
var n = t(e);
|
|
115
|
-
function r() {
|
|
116
|
-
return n.list;
|
|
117
|
-
}
|
|
118
|
-
function i(e) {
|
|
119
|
-
let t = e?.trim();
|
|
120
|
-
if (t) return n.byId.get(t);
|
|
121
|
-
}
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/formulas/execute.ts
|
|
124
|
-
function a(e) {
|
|
125
|
-
let t = Number(e);
|
|
126
|
-
return Number.isFinite(t) ? t : 0;
|
|
127
|
-
}
|
|
128
|
-
function o(e) {
|
|
129
|
-
let t = [...e.keys ?? []], n = (n) => {
|
|
130
|
-
if (!Number.isInteger(n) || n < 0) {
|
|
131
|
-
e.instrumentation?.onOutOfRangeIndex?.(n);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (e.instrumentation?.onReadIndex?.(n), n >= t.length) {
|
|
135
|
-
e.instrumentation?.onOutOfRangeIndex?.(n);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
return t[n];
|
|
139
|
-
}, r = (t) => {
|
|
140
|
-
let r = n(t);
|
|
141
|
-
if (r) return e.rowData[r];
|
|
142
|
-
};
|
|
143
|
-
return {
|
|
144
|
-
key: n,
|
|
145
|
-
value: r,
|
|
146
|
-
num: (e) => a(r(e))
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
function s(e) {
|
|
150
|
-
let t = i(e.formulaId);
|
|
151
|
-
if (!t) return {
|
|
152
|
-
ok: !1,
|
|
153
|
-
reason: "formula_not_found"
|
|
154
|
-
};
|
|
155
|
-
let n = [...e.keys ?? []], r = {}, o = {
|
|
156
|
-
key: (e) => Number.isInteger(e) && e >= 0 && e < n.length ? n[e] : void 0,
|
|
157
|
-
value: (e) => {
|
|
158
|
-
if (!Number.isInteger(e) || e < 0 || e >= n.length) return;
|
|
159
|
-
let t = n[e];
|
|
160
|
-
if (t) return r[t];
|
|
161
|
-
},
|
|
162
|
-
num: (e) => {
|
|
163
|
-
if (!Number.isInteger(e) || e < 0 || e >= n.length) return 0;
|
|
164
|
-
let t = n[e];
|
|
165
|
-
return t ? a(r[t]) : 0;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
return {
|
|
169
|
-
ok: !0,
|
|
170
|
-
execute: (e) => {
|
|
171
|
-
r = e;
|
|
172
|
-
try {
|
|
173
|
-
let e = t.fn(o);
|
|
174
|
-
return Number.isFinite(e) ? {
|
|
175
|
-
ok: !0,
|
|
176
|
-
value: e
|
|
177
|
-
} : {
|
|
178
|
-
ok: !1,
|
|
179
|
-
reason: "invalid_result"
|
|
180
|
-
};
|
|
181
|
-
} catch {
|
|
182
|
-
return {
|
|
183
|
-
ok: !1,
|
|
184
|
-
reason: "runtime_error"
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function c(e) {
|
|
191
|
-
let t = s({
|
|
192
|
-
formulaId: e.formulaId,
|
|
193
|
-
keys: e.keys
|
|
194
|
-
});
|
|
195
|
-
return t.ok ? t.execute(e.rowData) : {
|
|
196
|
-
ok: !1,
|
|
197
|
-
reason: t.reason
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
|
-
//#region src/formulas/validate.ts
|
|
202
|
-
function l(e) {
|
|
203
|
-
return [...e].sort((e, t) => e - t);
|
|
204
|
-
}
|
|
205
|
-
function u(e, t) {
|
|
206
|
-
return e.reduce((e, n, r) => (e[n] = (r + 1) * t, e), {});
|
|
207
|
-
}
|
|
208
|
-
function d(e) {
|
|
209
|
-
let t = [], n = [], r = i(e.formulaId), a = [...e.dependencies ?? []], s = e.availableColumnIds ?? [];
|
|
210
|
-
if (!r) return t.push({
|
|
211
|
-
code: "formula_not_found",
|
|
212
|
-
message: "Формула не найдена в реестре."
|
|
213
|
-
}), {
|
|
214
|
-
ok: !1,
|
|
215
|
-
errors: t,
|
|
216
|
-
warnings: n,
|
|
217
|
-
usage: {
|
|
218
|
-
usedDependencyIndexes: [],
|
|
219
|
-
usedDependencyIds: [],
|
|
220
|
-
requiredDependencyCount: 0
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
let c = new Set(s), d = a.filter((e) => !c.has(e));
|
|
224
|
-
d.length > 0 && t.push({
|
|
225
|
-
code: "dependency_not_available",
|
|
226
|
-
message: `Не найдены среди доступных полей: ${d.join(", ")}.`
|
|
227
|
-
});
|
|
228
|
-
let f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), m = 0, h = (e) => {
|
|
229
|
-
try {
|
|
230
|
-
let t = o({
|
|
231
|
-
rowData: e,
|
|
232
|
-
keys: a,
|
|
233
|
-
instrumentation: {
|
|
234
|
-
onReadIndex: (e) => {
|
|
235
|
-
f.add(e);
|
|
236
|
-
},
|
|
237
|
-
onOutOfRangeIndex: (e) => {
|
|
238
|
-
p.add(e);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
r.fn(t);
|
|
243
|
-
} catch {
|
|
244
|
-
m += 1;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
h(u(a, 100)), h(u(a, -100));
|
|
248
|
-
let g = l(f), _ = g.length > 0 ? g[g.length - 1] + 1 : 0;
|
|
249
|
-
p.size > 0 && t.push({
|
|
250
|
-
code: "dependency_index_out_of_range",
|
|
251
|
-
message: `Формула обращается к несуществующим индексам. Минимально требуется зависимостей: ${_}, выбрано: ${a.length}.`
|
|
252
|
-
}), g.length === 0 && n.push({
|
|
253
|
-
code: "formula_does_not_use_dependencies",
|
|
254
|
-
message: "Формула не использует dependencies."
|
|
255
|
-
});
|
|
256
|
-
let v = a.filter((e, t) => !f.has(t));
|
|
257
|
-
v.length > 0 && n.push({
|
|
258
|
-
code: "unused_dependencies",
|
|
259
|
-
message: `Выбраны, но не используются формулой: ${v.join(", ")}.`
|
|
260
|
-
}), m > 0 && n.push({
|
|
261
|
-
code: "formula_runtime_error",
|
|
262
|
-
message: "На тестовых данных формула завершилась с ошибкой."
|
|
263
|
-
});
|
|
264
|
-
let y = g.map((e) => a[e]).filter(Boolean);
|
|
265
|
-
return {
|
|
266
|
-
ok: t.length === 0,
|
|
267
|
-
errors: t,
|
|
268
|
-
warnings: n,
|
|
269
|
-
usage: {
|
|
270
|
-
usedDependencyIndexes: g,
|
|
271
|
-
usedDependencyIds: y,
|
|
272
|
-
requiredDependencyCount: _
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
//#endregion
|
|
277
|
-
export { t as a, c as i, s as n, i as o, o as r, r as s, d as t };
|
|
278
|
-
|
|
279
|
-
//# sourceMappingURL=formulas-BxcH5Zjt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formulas-BxcH5Zjt.js","names":[],"sources":["../../src/formulas/definitions/base.ts","../../src/formulas/definitions/sales.ts","../../src/formulas/definitions/index.ts","../../src/formulas/registry.ts","../../src/formulas/execute.ts","../../src/formulas/validate.ts"],"sourcesContent":["import type { TableFormulaDefinition } from \"../types\";\n\nexport const addFormula: TableFormulaDefinition = {\n\tid: \"add\",\n\tname: \"Сложение\",\n\tdescription: \"Legacy formula ADD: $0 + $1\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\treturn a + b;\n\t}\n};\n\nexport const substractFormula: TableFormulaDefinition = {\n\tid: \"substract\",\n\tname: \"Вычитание\",\n\tdescription: \"Legacy formula SUBSTRACT: $0 - $1\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\treturn a - b;\n\t}\n};\n\nexport const multiplyFormula: TableFormulaDefinition = {\n\tid: \"multiply\",\n\tname: \"Умножение\",\n\tdescription: \"Legacy formula MULTIPLY: $0 * $1\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\treturn a * b;\n\t}\n};\n\nexport const divideFormula: TableFormulaDefinition = {\n\tid: \"divide\",\n\tname: \"Деление\",\n\tdescription: \"Legacy formula DIVIDE: [$0 / $1]\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\tif (b === 0) return 0;\n\n\t\treturn a / b;\n\t}\n};\n\nexport const percentFormula: TableFormulaDefinition = {\n\tid: \"percent\",\n\tname: \"Процент\",\n\tdescription: \"Рассчитывает стандартный процент по формуле: B / A * 100.\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\t\tconst c = b / a;\n\n\t\tif (!isFinite(c)) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn c * 100;\n\t}\n};\n","import type { TableFormulaDefinition } from \"../types\";\n\nexport const markupFormula: TableFormulaDefinition = {\n\tid: \"markup\",\n\tname: \"Наценка, %\",\n\tdescription: \"Рассчитывает наценку по формуле: A / (B - A) * 100\",\n\targs: [\"закупочная цена\", \"продажная цена\"],\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\t\tconst c = b - a;\n\n\t\tif (c === 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\t// $0 / ($1 - $0) * 100\n\t\treturn (a / c) * 100;\n\t}\n};\n\nexport const markupSSCFormula: TableFormulaDefinition = {\n\tid: \"markup_ssc\",\n\tname: \"Наценка ССЦ, %\",\n\tdescription: \"Рассчитывает наценку по формуле: (A - B) / C\",\n\targs: [\"выручка\", \"план ССЦ\", \"план\"],\n\tfn: (ctx) => {\n\t\tconst c = ctx.num(2);\n\t\tif (c === 0) return 0;\n\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\t// ($0 - $1) / $2\n\t\treturn (a - b) / c;\n\t}\n};\n\nexport const planDeviationPercent: TableFormulaDefinition = {\n\tid: \"plan_deviation_percent\",\n\tname: \"% отклонения факта от плана\",\n\tdescription: \"Процент отклонения факта от плана/ГП относительного плана: legacy f1 '($0 - $1) / $1 * 100'\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\treturn ((a - b) / b) * 100;\n\t}\n};\n\nexport const growthPercent: TableFormulaDefinition = {\n\tid: \"growth_percent\",\n\tname: \"% прироста/снижения к АППГ\",\n\tdescription: \"Процентная динамика к АППГ: legacy f2 '100 * $0 / $1 - 100'\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\n\t\t// Предполагаем, что при b = 0 ожидается в результате 0, а не -100\n\t\tif (b === 0) return 0;\n\n\t\treturn (100 * a) / b - 100;\n\t}\n};\n\nexport const sscPerTon: TableFormulaDefinition = {\n\tid: \"ssc_per_ton\",\n\tname: \"ССЦ за тонну\",\n\tdescription: \"ССЦ за тонну (выручка - МП) / тн: legacy f5 ($0 - $1) / $2\",\n\tfn: (ctx) => {\n\t\tconst a = ctx.num(0);\n\t\tconst b = ctx.num(1);\n\t\tconst c = ctx.num(2);\n\n\t\tif (c === 0) return 0;\n\n\t\treturn (a * b) / c;\n\t}\n};\n","import { addFormula, divideFormula, multiplyFormula, percentFormula, substractFormula } from \"./base\";\nimport { growthPercent, markupFormula, markupSSCFormula, planDeviationPercent, sscPerTon } from \"./sales\";\n\nimport type { TableFormulaDefinition } from \"../types\";\n\nexport const tableFormulaDefinitions: readonly TableFormulaDefinition[] = Object.freeze([\n\tdivideFormula,\n\tmultiplyFormula,\n\tsubstractFormula,\n\taddFormula,\n\tpercentFormula,\n\n\tmarkupFormula,\n\tmarkupSSCFormula,\n\tplanDeviationPercent,\n\tgrowthPercent,\n\tsscPerTon\n]);\n","import { tableFormulaDefinitions } from \"./definitions\";\n\nimport type { TableFormulaDefinition } from \"./types\";\n\ntype TableFormulaRegistry = {\n\tlist: readonly TableFormulaDefinition[];\n\tbyId: ReadonlyMap<string, TableFormulaDefinition>;\n};\n\nexport function createTableFormulaRegistry(definitions: readonly TableFormulaDefinition[]): TableFormulaRegistry {\n\tconst byId = new Map<string, TableFormulaDefinition>();\n\tconst list: TableFormulaDefinition[] = [];\n\n\tfor (const definition of definitions) {\n\t\tconst normalizedId = definition.id.trim();\n\t\tif (!normalizedId) {\n\t\t\tthrow new Error(\"Formula v2 id не может быть пустым\");\n\t\t}\n\n\t\tif (byId.has(normalizedId)) {\n\t\t\tthrow new Error(`Найден дублирующийся formulaId в v2: ${normalizedId}`);\n\t\t}\n\n\t\tconst normalizedDefinition: TableFormulaDefinition = Object.freeze({\n\t\t\t...definition,\n\t\t\tid: normalizedId,\n\t\t\tname: definition.name.trim(),\n\t\t\tdescription: definition.description.trim(),\n\t\t\texamples: definition.keywords ? [...definition.keywords] : undefined\n\t\t});\n\n\t\tbyId.set(normalizedId, normalizedDefinition);\n\t\tlist.push(normalizedDefinition);\n\t}\n\n\treturn {\n\t\tlist: Object.freeze(list),\n\t\tbyId\n\t};\n}\n\nconst tableFormulaRegistry = createTableFormulaRegistry(tableFormulaDefinitions);\n\nexport function getTableFormulaList(): readonly TableFormulaDefinition[] {\n\treturn tableFormulaRegistry.list;\n}\n\nexport function getTableFormulaById(formulaId: string | undefined): TableFormulaDefinition | undefined {\n\tconst normalizedId = formulaId?.trim();\n\tif (!normalizedId) return undefined;\n\treturn tableFormulaRegistry.byId.get(normalizedId);\n}\n","import { getTableFormulaById } from \"./registry\";\n\nimport type { TableFormulaContext, TableFormulaRowData } from \"./types\";\n\ntype TableFormulaContextInstrumentation = {\n\tonReadIndex?: (index: number) => void;\n\tonOutOfRangeIndex?: (index: number) => void;\n};\n\nfunction toFiniteNumberOrZero(value: unknown): number {\n\tconst normalized = Number(value);\n\treturn Number.isFinite(normalized) ? normalized : 0;\n}\n\nexport function createTableFormulaContext(args: {\n\trowData: TableFormulaRowData;\n\tkeys?: readonly string[];\n\tinstrumentation?: TableFormulaContextInstrumentation;\n}): TableFormulaContext {\n\t// TODO: duplicate createRowBasedFormatterContext src\\shared\\lib\\formatters\\rowBased\\context.ts\n\tconst keys = [...(args.keys ?? [])];\n\n\tconst readKey = (index: number): string | undefined => {\n\t\tif (!Number.isInteger(index) || index < 0) {\n\t\t\targs.instrumentation?.onOutOfRangeIndex?.(index);\n\t\t\treturn undefined;\n\t\t}\n\n\t\targs.instrumentation?.onReadIndex?.(index);\n\n\t\tif (index >= keys.length) {\n\t\t\targs.instrumentation?.onOutOfRangeIndex?.(index);\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn keys[index];\n\t};\n\n\tconst readValue = (index: number): unknown => {\n\t\tconst key = readKey(index);\n\t\tif (!key) return undefined;\n\t\treturn args.rowData[key];\n\t};\n\n\treturn {\n\t\tkey: readKey,\n\t\tvalue: readValue,\n\t\tnum: (index) => toFiniteNumberOrZero(readValue(index))\n\t};\n}\n\nexport type TableFormulaExecutionResult =\n\t| {\n\t\t\tok: true;\n\t\t\tvalue: number;\n\t }\n\t| {\n\t\t\tok: false;\n\t\t\treason: \"formula_not_found\" | \"invalid_result\" | \"runtime_error\";\n\t };\n\nexport type TableFormulaCompiledExecutor = (rowData: TableFormulaRowData) => TableFormulaExecutionResult;\n\ntype CompileTableFormulaResult =\n\t| {\n\t\t\tok: true;\n\t\t\texecute: TableFormulaCompiledExecutor;\n\t }\n\t| {\n\t\t\tok: false;\n\t\t\treason: \"formula_not_found\";\n\t };\n\nexport function compileTableFormula(args: { formulaId: string | undefined; keys?: readonly string[] }): CompileTableFormulaResult {\n\tconst formula = getTableFormulaById(args.formulaId);\n\tif (!formula) {\n\t\treturn { ok: false, reason: \"formula_not_found\" };\n\t}\n\n\tconst keys = [...(args.keys ?? [])];\n\tlet rowDataRef: TableFormulaRowData = {};\n\tconst context: TableFormulaContext = {\n\t\tkey: (index) => (Number.isInteger(index) && index >= 0 && index < keys.length ? keys[index] : undefined),\n\t\tvalue: (index) => {\n\t\t\tif (!Number.isInteger(index) || index < 0 || index >= keys.length) return undefined;\n\t\t\tconst key = keys[index];\n\t\t\tif (!key) return undefined;\n\t\t\treturn rowDataRef[key];\n\t\t},\n\t\tnum: (index) => {\n\t\t\tif (!Number.isInteger(index) || index < 0 || index >= keys.length) return 0;\n\t\t\tconst key = keys[index];\n\t\t\tif (!key) return 0;\n\t\t\treturn toFiniteNumberOrZero(rowDataRef[key]);\n\t\t}\n\t};\n\n\treturn {\n\t\tok: true,\n\t\texecute: (rowData) => {\n\t\t\trowDataRef = rowData;\n\n\t\t\ttry {\n\t\t\t\tconst value = formula.fn(context);\n\t\t\t\tif (!Number.isFinite(value)) {\n\t\t\t\t\treturn { ok: false, reason: \"invalid_result\" };\n\t\t\t\t}\n\n\t\t\t\treturn { ok: true, value };\n\t\t\t} catch {\n\t\t\t\treturn { ok: false, reason: \"runtime_error\" };\n\t\t\t}\n\t\t}\n\t};\n}\n\nexport function executeTableFormula(args: {\n\tformulaId: string | undefined;\n\trowData: TableFormulaRowData;\n\tkeys?: readonly string[];\n}): TableFormulaExecutionResult {\n\tconst compiled = compileTableFormula({\n\t\tformulaId: args.formulaId,\n\t\tkeys: args.keys\n\t});\n\tif (!compiled.ok) {\n\t\treturn { ok: false, reason: compiled.reason };\n\t}\n\n\treturn compiled.execute(args.rowData);\n}\n","import { createTableFormulaContext } from \"./execute\";\nimport { getTableFormulaById } from \"./registry\";\n\ntype ValidationCode =\n\t| \"formula_not_found\"\n\t| \"dependency_index_out_of_range\"\n\t| \"dependency_not_available\"\n\t| \"unused_dependencies\"\n\t| \"formula_does_not_use_dependencies\"\n\t| \"formula_runtime_error\";\n\nexport interface TableFormulaValidationMessage {\n\tcode: ValidationCode;\n\tmessage: string;\n}\nexport interface TableFormulaDependenciesValidationResult {\n\tok: boolean;\n\terrors: TableFormulaValidationMessage[];\n\twarnings: TableFormulaValidationMessage[];\n\tusage: {\n\t\tusedDependencyIndexes: number[];\n\t\tusedDependencyIds: string[];\n\t\trequiredDependencyCount: number;\n\t};\n}\n\nfunction toSortedArray(items: Set<number>): number[] {\n\treturn [...items].sort((left, right) => left - right);\n}\n\nfunction createSampleRowData(dependencies: readonly string[], multiplier: number): Record<string, unknown> {\n\treturn dependencies.reduce<Record<string, unknown>>((acc, dependencyId, index) => {\n\t\tacc[dependencyId] = (index + 1) * multiplier;\n\t\treturn acc;\n\t}, {});\n}\n\nexport function validateTableFormulaDependencies(args: {\n\tformulaId: string | undefined;\n\tdependencies?: readonly string[];\n\tavailableColumnIds?: readonly string[];\n}): TableFormulaDependenciesValidationResult {\n\tconst errors: TableFormulaValidationMessage[] = [];\n\tconst warnings: TableFormulaValidationMessage[] = [];\n\n\tconst formula = getTableFormulaById(args.formulaId);\n\tconst dependencies = [...(args.dependencies ?? [])];\n\tconst availableColumnIds = args.availableColumnIds ?? [];\n\n\tif (!formula) {\n\t\terrors.push({\n\t\t\tcode: \"formula_not_found\",\n\t\t\tmessage: \"Формула не найдена в реестре.\"\n\t\t});\n\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors,\n\t\t\twarnings,\n\t\t\tusage: {\n\t\t\t\tusedDependencyIndexes: [],\n\t\t\t\tusedDependencyIds: [],\n\t\t\t\trequiredDependencyCount: 0\n\t\t\t}\n\t\t};\n\t}\n\n\tconst availableSet = new Set(availableColumnIds);\n\tconst missingDependencies = dependencies.filter((dependencyId) => !availableSet.has(dependencyId));\n\tif (missingDependencies.length > 0) {\n\t\terrors.push({\n\t\t\tcode: \"dependency_not_available\",\n\t\t\tmessage: `Не найдены среди доступных полей: ${missingDependencies.join(\", \")}.`\n\t\t});\n\t}\n\n\tconst usedIndexes = new Set<number>();\n\tconst outOfRangeIndexes = new Set<number>();\n\tlet runtimeErrorCount = 0;\n\n\tconst runValidationPass = (sampleRowData: Record<string, unknown>) => {\n\t\ttry {\n\t\t\tconst context = createTableFormulaContext({\n\t\t\t\trowData: sampleRowData,\n\t\t\t\tkeys: dependencies,\n\t\t\t\tinstrumentation: {\n\t\t\t\t\tonReadIndex: (index) => {\n\t\t\t\t\t\tusedIndexes.add(index);\n\t\t\t\t\t},\n\t\t\t\t\tonOutOfRangeIndex: (index) => {\n\t\t\t\t\t\toutOfRangeIndexes.add(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tformula.fn(context);\n\t\t} catch {\n\t\t\truntimeErrorCount += 1;\n\t\t}\n\t};\n\n\t// Несколько прогонов повышают шанс увидеть обращения к индексам в разных ветках формулы.\n\trunValidationPass(createSampleRowData(dependencies, 100));\n\trunValidationPass(createSampleRowData(dependencies, -100));\n\n\tconst sortedUsedIndexes = toSortedArray(usedIndexes);\n\tconst requiredDependencyCount = sortedUsedIndexes.length > 0 ? sortedUsedIndexes[sortedUsedIndexes.length - 1] + 1 : 0;\n\n\tif (outOfRangeIndexes.size > 0) {\n\t\terrors.push({\n\t\t\tcode: \"dependency_index_out_of_range\",\n\t\t\tmessage: `Формула обращается к несуществующим индексам. Минимально требуется зависимостей: ${requiredDependencyCount}, выбрано: ${dependencies.length}.`\n\t\t});\n\t}\n\n\tif (sortedUsedIndexes.length === 0) {\n\t\twarnings.push({\n\t\t\tcode: \"formula_does_not_use_dependencies\",\n\t\t\tmessage: \"Формула не использует dependencies.\"\n\t\t});\n\t}\n\n\tconst unusedDependencies = dependencies.filter((_, index) => !usedIndexes.has(index));\n\tif (unusedDependencies.length > 0) {\n\t\twarnings.push({\n\t\t\tcode: \"unused_dependencies\",\n\t\t\tmessage: `Выбраны, но не используются формулой: ${unusedDependencies.join(\", \")}.`\n\t\t});\n\t}\n\n\tif (runtimeErrorCount > 0) {\n\t\twarnings.push({\n\t\t\tcode: \"formula_runtime_error\",\n\t\t\tmessage: \"На тестовых данных формула завершилась с ошибкой.\"\n\t\t});\n\t}\n\n\tconst usedDependencyIds = sortedUsedIndexes.map((index) => dependencies[index]).filter(Boolean);\n\n\treturn {\n\t\tok: errors.length === 0,\n\t\terrors,\n\t\twarnings,\n\t\tusage: {\n\t\t\tusedDependencyIndexes: sortedUsedIndexes,\n\t\t\tusedDependencyIds,\n\t\t\trequiredDependencyCount\n\t\t}\n\t};\n}\n"],"mappings":";;AEKA,IAAa,IAA6D,OAAO,OAAO;CACvF;EFiCA,IAAI;EACJ,MAAM;EACN,aAAa;EACb,KAAK,MAAQ;GACZ,IAAM,IAAI,EAAI,IAAI,CAAC,GACb,IAAI,EAAI,IAAI,CAAC;GAInB,OAFI,MAAM,IAAU,IAEb,IAAI;EACZ;CE3CA;CACA;EFoBA,IAAI;EACJ,MAAM;EACN,aAAa;EACb,KAAK,MACM,EAAI,IAAI,CAGX,IAFG,EAAI,IAAI,CAEP;CE3BZ;CACA;EFOA,IAAI;EACJ,MAAM;EACN,aAAa;EACb,KAAK,MACM,EAAI,IAAI,CAGX,IAFG,EAAI,IAAI,CAEP;CEdZ;CACA;EFNA,IAAI;EACJ,MAAM;EACN,aAAa;EACb,KAAK,MACM,EAAI,IAAI,CAGX,IAFG,EAAI,IAAI,CAEP;CEDZ;CACA;EF2CA,IAAI;EACJ,MAAM;EACN,aAAa;EACb,KAAK,MAAQ;GACZ,IAAM,IAAI,EAAI,IAAI,CAAC,GAEb,IADI,EAAI,IAAI,CACR,IAAI;GAMd,OAJK,SAAS,CAAC,IAIR,IAAI,MAHH;EAIT;CExDA;CAEA;EDTA,IAAI;EACJ,MAAM;EACN,aAAa;EACb,MAAM,CAAC,mBAAmB,gBAAgB;EAC1C,KAAK,MAAQ;GACZ,IAAM,IAAI,EAAI,IAAI,CAAC,GAEb,IADI,EAAI,IAAI,CACR,IAAI;GAOd,OALI,MAAM,IACF,IAIA,IAAI,IAAK;EAClB;CCNA;CACA;EDSA,IAAI;EACJ,MAAM;EACN,aAAa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AM;EACN,SAAS,yCAAyC,EAAmB,KAAK,IAAI,EAAE;CACjF,CAAC,GAGE,IAAoB,KACvB,EAAS,KAAK;EACb,MAAM;EACN,SAAS;CACV,CAAC;CAGF,IAAM,IAAoB,EAAkB,KAAK,MAAU,EAAa,EAAM,CAAC,CAAC,OAAO,OAAO;CAE9F,OAAO;EACN,IAAI,EAAO,WAAW;EACtB;EACA;EACA,OAAO;GACN,uBAAuB;GACvB;GACA;EACD;CACD;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-B_ITGoAs.js","names":[],"sources":["../../src/formatters/number/presets.ts","../../src/formatters/rowBased/context.ts","../../src/formatters/rowBased/definitions/index.ts","../../src/formatters/rowBased/registry.ts","../../src/formatters/pipeline/validate.ts"],"sourcesContent":["import type { NumberFormatPreset, NumberFormatPresetConfig } from \"./types\";\n\n/** Символ группировки из ru-RU (U+00A0 или U+202F в зависимости от среды) */\nconst ruGroupChar = new Intl.NumberFormat(\"ru-RU\").formatToParts(1000).find((p) => p.type === \"group\")?.value ?? \"\\u00A0\";\n\n/** Значения по умолчанию — совпадают с ru-RU форматированием */\nexport const NUMBER_FORMAT_DEFAULTS: Omit<NumberFormatPreset, \"name\"> = {\n\tdecimals: 1,\n\tdecimalSeparator: \",\",\n\tgrouping: true,\n\tgroupingSeparator: ruGroupChar,\n\tgroupingSize: 3\n};\n\nexport const DEFAULT_NUMBER_PRESET_NAMES = Object.freeze({\n\tinteger: \"integer\",\n\tdecimal: \"decimal\",\n\tdecimal2: \"decimal-2\",\n\tdecimal3: \"decimal-3\",\n\tcurrency: \"currency\",\n\tprice: \"price\",\n\tpercent: \"percent\",\n\ttonnage: \"tonnage\",\n\tcompactCurrency: \"compact-currency\",\n\tcompactPercent: \"compact-percent\",\n\tcompactTonnage: \"compact-tonnage\"\n});\n\n/** Типовые предустановки (недостающие поля заполнятся из FORMAT_DEFAULTS) */\nconst BUILTIN: NumberFormatPresetConfig[] = [\n\t{ name: \"integer\", decimals: 0, decimalSeparator: \"\" },\n\t{ name: \"decimal\" },\n\t{ name: \"decimal-2\", decimals: 2 },\n\t{ name: \"decimal-3\", decimals: 3 },\n\t{ name: \"currency\", decimals: 0, decimalSeparator: \"\" },\n\t{ name: \"price\", decimals: 0, decimalSeparator: \"\" },\n\t{ name: \"percent\", decimals: 2 },\n\t{ name: \"tonnage\" },\n\t{ name: \"compact-currency\", decimals: 0, decimalSeparator: \"\", compact: {} },\n\t{ name: \"compact-percent\", decimals: 2, compact: { maxDecimals: 2 } },\n\t{ name: \"compact-tonnage\", compact: { maxDecimals: 1 } }\n];\n\nconst registry = new Map<string, NumberFormatPreset>();\n\nfunction init(): void {\n\tfor (const cfg of BUILTIN) {\n\t\tregistry.set(cfg.name, { ...NUMBER_FORMAT_DEFAULTS, ...cfg });\n\t}\n}\n\ninit();\n\nexport function getNumberPreset(name: string): NumberFormatPreset | undefined {\n\treturn registry.get(name);\n}\n\nexport function getNumberPresetNames(): string[] {\n\treturn Array.from(registry.keys());\n}\n\n/** Зарегистрировать или перезаписать предустановку. Недостающие поля берутся из FORMAT_DEFAULTS. */\nexport function registerNumberPreset(config: NumberFormatPresetConfig): NumberFormatPreset {\n\tconst preset: NumberFormatPreset = { ...NUMBER_FORMAT_DEFAULTS, ...config };\n\tregistry.set(preset.name, preset);\n\treturn preset;\n}\n\n/** Сбросить реестр к начальному состоянию (только типовые предустановки) */\nexport function resetNumberPresets(): void {\n\tregistry.clear();\n\tinit();\n}\n\nexport function resolveNumberPreset(presetOrName: string | NumberFormatPreset): NumberFormatPreset {\n\tif (typeof presetOrName !== \"string\") return presetOrName;\n\n\tconst found = getNumberPreset(presetOrName);\n\tif (!found) throw new Error(`Предустановка \"${presetOrName}\" не найдена`);\n\n\treturn found;\n}\n","import { parseNumber } from \"../number\";\n\nimport type { RowBasedFormatterContext, RowBasedFormatterContextInstrumentation } from \"./types\";\n\nexport function createRowBasedFormatterContext(args: {\n\trowData: Record<string, unknown>;\n\trawValue: unknown;\n\tcolumnId: string;\n\tkeys?: readonly string[];\n\tinstrumentation?: RowBasedFormatterContextInstrumentation;\n}): RowBasedFormatterContext {\n\t// TODO: duplicate createTableFormulaContext src\\shared\\lib\\formulas\\execute.ts\n\tconst keys = [...(args.keys ?? [])];\n\n\tconst readKey = (index: number): string | undefined => {\n\t\tif (!Number.isInteger(index) || index < 0) {\n\t\t\targs.instrumentation?.onOutOfRangeIndex?.(index);\n\t\t\treturn undefined;\n\t\t}\n\n\t\targs.instrumentation?.onReadIndex?.(index);\n\n\t\tif (index >= keys.length) {\n\t\t\targs.instrumentation?.onOutOfRangeIndex?.(index);\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn keys[index];\n\t};\n\n\tconst readValue = (index: number): unknown => {\n\t\tconst key = readKey(index);\n\t\tif (!key) return undefined;\n\t\treturn args.rowData[key];\n\t};\n\n\tconst readNum = (index: number): number => {\n\t\tconst key = readKey(index);\n\t\tif (!key) return 0;\n\t\treturn parseNumber(args.rowData[key]);\n\t};\n\n\treturn {\n\t\trowData: args.rowData,\n\t\trawValue: args.rawValue,\n\t\tcolumnId: args.columnId,\n\t\tkey: readKey,\n\t\tvalue: readValue,\n\t\tnum: readNum\n\t};\n}\n","import type { RowBasedFormatterDefinition } from \"../types\";\n\n/**\n * Базовые формулы подмены значения для групповых строк.\n */\nexport const rowBasedFormatterDefinitions: readonly RowBasedFormatterDefinition[] = Object.freeze([]);\n","import { rowBasedFormatterDefinitions } from \"./definitions\";\n\nimport type { RowBasedFormatterDefinition } from \"./types\";\n\ntype RowBasedFormatterRegistry = {\n\tlist: readonly RowBasedFormatterDefinition[];\n\tbyId: ReadonlyMap<string, RowBasedFormatterDefinition>;\n};\n\n/**\n * Создаёт реестр формул для подмены значения в групповой строке.\n */\nexport function createRowBasedFormatterRegistry(definitions: readonly RowBasedFormatterDefinition[]): RowBasedFormatterRegistry {\n\tconst byId = new Map<string, RowBasedFormatterDefinition>();\n\tconst list: RowBasedFormatterDefinition[] = [];\n\n\tfor (const definition of definitions) {\n\t\tconst normalizedId = definition.id.trim();\n\t\tif (!normalizedId) {\n\t\t\tthrow new Error(\"Formula id для RowBasedFormatter не может быть пустым\");\n\t\t}\n\n\t\tif (byId.has(normalizedId)) {\n\t\t\tthrow new Error(`Найден дублирующийся formulaId в RowBasedFormatter: ${normalizedId}`);\n\t\t}\n\n\t\tconst normalizedDefinition: RowBasedFormatterDefinition = Object.freeze({\n\t\t\t...definition,\n\t\t\tid: normalizedId,\n\t\t\tname: definition.name.trim(),\n\t\t\tdescription: definition.description.trim()\n\t\t});\n\n\t\tbyId.set(normalizedId, normalizedDefinition);\n\t\tlist.push(normalizedDefinition);\n\t}\n\n\treturn {\n\t\tlist: Object.freeze(list),\n\t\tbyId\n\t};\n}\n\nconst rowBasedFormatterRegistry = createRowBasedFormatterRegistry(rowBasedFormatterDefinitions);\n\n/**\n * Возвращает список доступных формул для групповой подмены.\n */\nexport function getRowBasedFormatterList(): readonly RowBasedFormatterDefinition[] {\n\treturn rowBasedFormatterRegistry.list;\n}\n\n/**\n * Возвращает формулу по id.\n */\nexport function getRowBasedFormatterById(formulaId: string | undefined): RowBasedFormatterDefinition | undefined {\n\tconst normalizedId = formulaId?.trim();\n\tif (!normalizedId) return undefined;\n\treturn rowBasedFormatterRegistry.byId.get(normalizedId);\n}\n","import { getNumberPreset } from \"../number\";\nimport { createRowBasedFormatterContext, getRowBasedFormatterById } from \"../rowBased\";\n\nimport type {\n\tFormattersPipelineConfig,\n\tFormattersPipelineEdge,\n\tFormattersPipelineGraph,\n\tFormattersPipelineNode,\n\tFormattersPipelinePlan,\n\tFormattersPipelineRowBasedOverrideFormulaConfig,\n\tFormattersPipelineStep\n} from \"./types\";\n\nexport type FormattersPipelineValidationCode =\n\t| \"config_not_defined\"\n\t| \"unsupported_version\"\n\t| \"graph_or_plan_required\"\n\t| \"node_id_duplicate\"\n\t| \"edge_id_duplicate\"\n\t| \"edge_node_not_found\"\n\t| \"source_count_invalid\"\n\t| \"sink_count_invalid\"\n\t| \"source_incoming_invalid\"\n\t| \"sink_outgoing_invalid\"\n\t| \"node_degree_invalid\"\n\t| \"path_broken\"\n\t| \"path_cycle_detected\"\n\t| \"path_disconnected_nodes\"\n\t| \"step_id_duplicate\"\n\t| \"step_resolve_value_state_multiple\"\n\t| \"step_typed_value_format_multiple\"\n\t| \"step_row_based_override_multiple\"\n\t| \"step_normalize_leading_zeros_multiple\"\n\t| \"step_typed_before_value_state\"\n\t| \"step_row_based_override_field_key_empty\"\n\t| \"step_row_based_override_formula_id_empty\"\n\t| \"step_row_based_override_formula_not_found\"\n\t| \"step_row_based_override_dependency_index_out_of_range\"\n\t| \"step_row_based_override_unused_dependencies\"\n\t| \"step_row_based_override_formula_does_not_use_dependencies\"\n\t| \"step_row_based_override_formula_runtime_error\"\n\t| \"step_threshold_states_count_invalid\"\n\t| \"step_value_hidden_without_icon\"\n\t| \"step_typed_value_format_preset_empty\"\n\t| \"step_typed_value_format_preset_not_found\";\n\nexport type FormattersPipelineValidationMessage = {\n\tcode: FormattersPipelineValidationCode;\n\tmessage: string;\n};\n\nexport type FormattersPipelineValidationResult = {\n\tok: boolean;\n\terrors: FormattersPipelineValidationMessage[];\n\twarnings: FormattersPipelineValidationMessage[];\n\tplan?: FormattersPipelinePlan;\n};\n\ntype MutableValidationState = {\n\terrors: FormattersPipelineValidationMessage[];\n\twarnings: FormattersPipelineValidationMessage[];\n};\n\nfunction pushError(state: MutableValidationState, code: FormattersPipelineValidationCode, message: string) {\n\tstate.errors.push({ code, message });\n}\n\nfunction pushWarning(state: MutableValidationState, code: FormattersPipelineValidationCode, message: string) {\n\tstate.warnings.push({ code, message });\n}\n\nfunction toSortedArray(items: Set<number>): number[] {\n\treturn [...items].sort((left, right) => left - right);\n}\n\nfunction createSampleRowData(dependencies: readonly string[], multiplier: number): Record<string, unknown> {\n\treturn dependencies.reduce<Record<string, unknown>>((acc, dependencyId, index) => {\n\t\tacc[dependencyId] = (index + 1) * multiplier;\n\t\treturn acc;\n\t}, {});\n}\n\nfunction validateRowBasedOverrideFormulaConfig(config: FormattersPipelineRowBasedOverrideFormulaConfig, state: MutableValidationState) {\n\tif (!config.formulaId.trim()) {\n\t\tpushError(state, \"step_row_based_override_formula_id_empty\", \"Для rowBasedOverride (formula) необходимо заполнить formulaId.\");\n\t\treturn;\n\t}\n\n\tconst formula = getRowBasedFormatterById(config.formulaId);\n\tconst dependencies = [...(config.dependencyIds ?? [])];\n\n\tif (!formula) {\n\t\tpushError(state, \"step_row_based_override_formula_not_found\", \"Формула rowBasedOverride не найдена в реестре.\");\n\t\treturn;\n\t}\n\n\tconst usedIndexes = new Set<number>();\n\tconst outOfRangeIndexes = new Set<number>();\n\tlet runtimeErrorCount = 0;\n\n\tconst runValidationPass = (sampleRowData: Record<string, unknown>) => {\n\t\ttry {\n\t\t\tconst context = createRowBasedFormatterContext({\n\t\t\t\trowData: sampleRowData,\n\t\t\t\trawValue: 100,\n\t\t\t\tcolumnId: \"__validation__\",\n\t\t\t\tkeys: dependencies,\n\t\t\t\tinstrumentation: {\n\t\t\t\t\tonReadIndex: (index) => {\n\t\t\t\t\t\tusedIndexes.add(index);\n\t\t\t\t\t},\n\t\t\t\t\tonOutOfRangeIndex: (index) => {\n\t\t\t\t\t\toutOfRangeIndexes.add(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tformula.fn(context);\n\t\t} catch {\n\t\t\truntimeErrorCount += 1;\n\t\t}\n\t};\n\n\t// Несколько прогонов повышают шанс увидеть обращения к индексам в разных ветках формулы.\n\trunValidationPass(createSampleRowData(dependencies, 100));\n\trunValidationPass(createSampleRowData(dependencies, -100));\n\n\tconst sortedUsedIndexes = toSortedArray(usedIndexes);\n\tconst requiredDependencyCount = sortedUsedIndexes.length > 0 ? sortedUsedIndexes[sortedUsedIndexes.length - 1] + 1 : 0;\n\n\tif (outOfRangeIndexes.size > 0) {\n\t\tpushError(\n\t\t\tstate,\n\t\t\t\"step_row_based_override_dependency_index_out_of_range\",\n\t\t\t`Формула rowBasedOverride обращается к несуществующим индексам. Минимально требуется зависимостей: ${requiredDependencyCount}, выбрано: ${dependencies.length}.`\n\t\t);\n\t}\n\n\tif (sortedUsedIndexes.length === 0) {\n\t\tpushWarning(\n\t\t\tstate,\n\t\t\t\"step_row_based_override_formula_does_not_use_dependencies\",\n\t\t\t\"Формула rowBasedOverride не использует dependencyIds.\"\n\t\t);\n\t}\n\n\tconst unusedDependencies = dependencies.filter((_, index) => !usedIndexes.has(index));\n\tif (unusedDependencies.length > 0) {\n\t\tpushWarning(\n\t\t\tstate,\n\t\t\t\"step_row_based_override_unused_dependencies\",\n\t\t\t`Выбраны, но не используются формулой rowBasedOverride: ${unusedDependencies.join(\", \")}.`\n\t\t);\n\t}\n\n\tif (runtimeErrorCount > 0) {\n\t\tpushWarning(\n\t\t\tstate,\n\t\t\t\"step_row_based_override_formula_runtime_error\",\n\t\t\t\"На тестовых данных формула rowBasedOverride завершилась с ошибкой.\"\n\t\t);\n\t}\n}\n\nfunction validateStepDefinitions(steps: readonly FormattersPipelineStep[], state: MutableValidationState) {\n\tconst stepIdSet = new Set<string>();\n\tconst counters = {\n\t\tnormalizeLeadingZeros: 0,\n\t\trowBasedOverride: 0,\n\t\tresolveValueState: 0,\n\t\ttypedValueFormat: 0\n\t};\n\n\tfor (const step of steps) {\n\t\tconst normalizedId = step.id.trim();\n\t\tif (!normalizedId) {\n\t\t\tpushError(state, \"step_id_duplicate\", \"Шаг pipeline не может иметь пустой id.\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (stepIdSet.has(normalizedId)) {\n\t\t\tpushError(state, \"step_id_duplicate\", `Найден дублирующийся id шага pipeline: ${normalizedId}.`);\n\t\t}\n\t\tstepIdSet.add(normalizedId);\n\n\t\tswitch (step.type) {\n\t\t\tcase \"normalizeLeadingZeros\":\n\t\t\t\tcounters.normalizeLeadingZeros += 1;\n\t\t\t\tbreak;\n\t\t\tcase \"rowBasedOverride\":\n\t\t\t\tcounters.rowBasedOverride += 1;\n\n\t\t\t\tif (step.config.mode === \"field\" && !step.config.fieldKey.trim()) {\n\t\t\t\t\tpushError(\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\"step_row_based_override_field_key_empty\",\n\t\t\t\t\t\t\"Для rowBasedOverride (field) необходимо заполнить fieldKey.\"\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (step.config.mode === \"formula\") {\n\t\t\t\t\tvalidateRowBasedOverrideFormulaConfig(step.config, state);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"resolveValueState\":\n\t\t\t\tcounters.resolveValueState += 1;\n\n\t\t\t\tif (\n\t\t\t\t\tstep.config.resolver.kind === \"threshold\" &&\n\t\t\t\t\tstep.config.resolver.states.length !== step.config.resolver.thresholds.length + 1\n\t\t\t\t) {\n\t\t\t\t\tpushError(\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\"step_threshold_states_count_invalid\",\n\t\t\t\t\t\t\"Для threshold-резолвера количество states должно быть равно thresholds + 1.\"\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"typedValueFormat\":\n\t\t\t\tcounters.typedValueFormat += 1;\n\t\t\t\tif (step.config?.numberPresetName !== undefined) {\n\t\t\t\t\tconst normalizedPresetName = step.config.numberPresetName.trim();\n\t\t\t\t\tif (!normalizedPresetName) {\n\t\t\t\t\t\tpushError(state, \"step_typed_value_format_preset_empty\", \"Для typedValueFormat указан пустой numberPresetName.\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!getNumberPreset(normalizedPresetName)) {\n\t\t\t\t\t\tpushError(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\"step_typed_value_format_preset_not_found\",\n\t\t\t\t\t\t\t`Для typedValueFormat указан неизвестный пресет: ${normalizedPresetName}.`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (counters.normalizeLeadingZeros > 1) {\n\t\tpushError(state, \"step_normalize_leading_zeros_multiple\", \"В pipeline может быть только один шаг normalizeLeadingZeros.\");\n\t}\n\n\tif (counters.rowBasedOverride > 1) {\n\t\tpushError(state, \"step_row_based_override_multiple\", \"В pipeline может быть только один шаг rowBasedOverride.\");\n\t}\n\n\tif (counters.resolveValueState > 1) {\n\t\tpushError(state, \"step_resolve_value_state_multiple\", \"В pipeline может быть только один шаг resolveValueState.\");\n\t}\n\n\tif (counters.typedValueFormat > 1) {\n\t\tpushError(state, \"step_typed_value_format_multiple\", \"В pipeline может быть только один шаг typedValueFormat.\");\n\t}\n\n\tconst resolveIndex = steps.findIndex((step) => step.type === \"resolveValueState\");\n\tconst typedIndex = steps.findIndex((step) => step.type === \"typedValueFormat\");\n\tif (resolveIndex !== -1 && typedIndex !== -1 && typedIndex < resolveIndex) {\n\t\tpushError(state, \"step_typed_before_value_state\", \"Шаг typedValueFormat не может выполняться до шага resolveValueState.\");\n\t}\n\n\tfor (const step of steps) {\n\t\tif (step.type !== \"resolveValueState\") continue;\n\t\tif (!step.config.icon?.enabled && step.config.icon?.showValue === false) {\n\t\t\tpushWarning(\n\t\t\t\tstate,\n\t\t\t\t\"step_value_hidden_without_icon\",\n\t\t\t\t\"Для resolveValueState установлено showValue=false при выключенной иконке: значение не будет отображаться.\"\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Валидация облегчённого плана pipeline.\n */\nexport function validateFormattersPipelinePlan(plan: FormattersPipelinePlan): FormattersPipelineValidationResult {\n\tconst state: MutableValidationState = { errors: [], warnings: [] };\n\n\tvalidateStepDefinitions(plan.steps, state);\n\n\treturn {\n\t\tok: state.errors.length === 0,\n\t\terrors: state.errors,\n\t\twarnings: state.warnings,\n\t\tplan: state.errors.length === 0 ? { steps: [...plan.steps] } : undefined\n\t};\n}\n\nfunction buildLinearPathFromGraph(\n\tnodes: readonly FormattersPipelineNode[],\n\tedges: readonly FormattersPipelineEdge[],\n\tstate: MutableValidationState\n): string[] | undefined {\n\tconst nodeById = new Map(nodes.map((node) => [node.id, node]));\n\tconst outgoing = new Map<string, string[]>();\n\tconst incoming = new Map<string, string[]>();\n\n\tfor (const node of nodes) {\n\t\toutgoing.set(node.id, []);\n\t\tincoming.set(node.id, []);\n\t}\n\n\tfor (const edge of edges) {\n\t\tconst source = edge.source.trim();\n\t\tconst target = edge.target.trim();\n\t\tif (!nodeById.has(source) || !nodeById.has(target)) {\n\t\t\tpushError(state, \"edge_node_not_found\", `Ребро ${edge.id} ссылается на несуществующий узел: ${source} -> ${target}.`);\n\t\t\tcontinue;\n\t\t}\n\n\t\toutgoing.get(source)?.push(target);\n\t\tincoming.get(target)?.push(source);\n\t}\n\n\tconst sources = nodes.filter((node) => node.type === \"source\");\n\tconst sinks = nodes.filter((node) => node.type === \"sink\");\n\n\tif (sources.length !== 1) {\n\t\tpushError(state, \"source_count_invalid\", \"В графе должен быть ровно один узел source.\");\n\t}\n\tif (sinks.length !== 1) {\n\t\tpushError(state, \"sink_count_invalid\", \"В графе должен быть ровно один узел sink.\");\n\t}\n\tif (state.errors.length > 0) return undefined;\n\n\tconst sourceNodeId = sources[0]!.id;\n\tconst sinkNodeId = sinks[0]!.id;\n\n\tfor (const node of nodes) {\n\t\tconst inDegree = incoming.get(node.id)?.length ?? 0;\n\t\tconst outDegree = outgoing.get(node.id)?.length ?? 0;\n\n\t\tif (node.type === \"source\") {\n\t\t\tif (inDegree !== 0) {\n\t\t\t\tpushError(state, \"source_incoming_invalid\", \"Узел source не должен иметь входящих рёбер.\");\n\t\t\t}\n\t\t\tif (outDegree !== 1) {\n\t\t\t\tpushError(state, \"node_degree_invalid\", \"Узел source должен иметь ровно одно исходящее ребро.\");\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (node.type === \"sink\") {\n\t\t\tif (outDegree !== 0) {\n\t\t\t\tpushError(state, \"sink_outgoing_invalid\", \"Узел sink не должен иметь исходящих рёбер.\");\n\t\t\t}\n\t\t\tif (inDegree !== 1) {\n\t\t\t\tpushError(state, \"node_degree_invalid\", \"Узел sink должен иметь ровно одно входящее ребро.\");\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (inDegree !== 1 || outDegree !== 1) {\n\t\t\tpushError(\n\t\t\t\tstate,\n\t\t\t\t\"node_degree_invalid\",\n\t\t\t\t`Узел ${node.id} должен иметь ровно одно входящее и одно исходящее ребро для линейного pipeline.`\n\t\t\t);\n\t\t}\n\t}\n\n\tif (state.errors.length > 0) return undefined;\n\n\tconst visited = new Set<string>();\n\tconst path: string[] = [];\n\tlet cursor = sourceNodeId;\n\n\twhile (true) {\n\t\tif (visited.has(cursor)) {\n\t\t\tpushError(state, \"path_cycle_detected\", \"В графе pipeline обнаружен цикл.\");\n\t\t\treturn undefined;\n\t\t}\n\t\tvisited.add(cursor);\n\t\tpath.push(cursor);\n\n\t\tif (cursor === sinkNodeId) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst nextCandidates = outgoing.get(cursor) ?? [];\n\t\tif (nextCandidates.length !== 1) {\n\t\t\tpushError(state, \"path_broken\", \"Не удалось построить линейный путь от source к sink.\");\n\t\t\treturn undefined;\n\t\t}\n\n\t\tcursor = nextCandidates[0]!;\n\t}\n\n\tif (visited.size !== nodes.length) {\n\t\tpushError(state, \"path_disconnected_nodes\", \"Граф содержит узлы, которые не входят в линейный путь source -> sink.\");\n\t\treturn undefined;\n\t}\n\n\treturn path;\n}\n\n/**\n * Валидация графа pipeline и построение линейного плана исполнения.\n */\nexport function validateFormattersPipelineGraph(graph: FormattersPipelineGraph): FormattersPipelineValidationResult {\n\tconst state: MutableValidationState = { errors: [], warnings: [] };\n\n\tif (!graph.nodes.length) {\n\t\tpushError(state, \"path_broken\", \"Граф pipeline не содержит узлов.\");\n\t\treturn { ok: false, errors: state.errors, warnings: state.warnings };\n\t}\n\n\tconst nodeById = new Map<string, FormattersPipelineNode>();\n\tfor (const node of graph.nodes) {\n\t\tconst normalizedId = node.id.trim();\n\t\tif (!normalizedId) {\n\t\t\tpushError(state, \"node_id_duplicate\", \"Узел pipeline не может иметь пустой id.\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (nodeById.has(normalizedId)) {\n\t\t\tpushError(state, \"node_id_duplicate\", `Найден дублирующийся id узла pipeline: ${normalizedId}.`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnodeById.set(normalizedId, node);\n\t}\n\n\tconst edgeIdSet = new Set<string>();\n\tfor (const edge of graph.edges) {\n\t\tconst normalizedEdgeId = edge.id.trim();\n\t\tif (!normalizedEdgeId) {\n\t\t\tpushError(state, \"edge_id_duplicate\", \"Ребро pipeline не может иметь пустой id.\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (edgeIdSet.has(normalizedEdgeId)) {\n\t\t\tpushError(state, \"edge_id_duplicate\", `Найден дублирующийся id ребра pipeline: ${normalizedEdgeId}.`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tedgeIdSet.add(normalizedEdgeId);\n\t}\n\n\tif (state.errors.length > 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors: state.errors,\n\t\t\twarnings: state.warnings\n\t\t};\n\t}\n\n\tconst path = buildLinearPathFromGraph(graph.nodes, graph.edges, state);\n\tif (!path) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors: state.errors,\n\t\t\twarnings: state.warnings\n\t\t};\n\t}\n\n\tconst steps: FormattersPipelineStep[] = [];\n\tfor (const nodeId of path) {\n\t\tconst node = nodeById.get(nodeId);\n\t\tif (!node || node.type === \"source\" || node.type === \"sink\") continue;\n\n\t\tswitch (node.type) {\n\t\t\tcase \"normalizeLeadingZeros\":\n\t\t\t\tsteps.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttype: \"normalizeLeadingZeros\",\n\t\t\t\t\tconfig: node.config ? { ...node.config } : undefined\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"rowBasedOverride\":\n\t\t\t\tsteps.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttype: \"rowBasedOverride\",\n\t\t\t\t\tconfig:\n\t\t\t\t\t\tnode.config.mode === \"formula\"\n\t\t\t\t\t\t\t? { ...node.config, dependencyIds: node.config.dependencyIds ? [...node.config.dependencyIds] : undefined }\n\t\t\t\t\t\t\t: { ...node.config }\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"resolveValueState\":\n\t\t\t\tsteps.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttype: \"resolveValueState\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tresolver:\n\t\t\t\t\t\t\tnode.config.resolver.kind === \"fixed\"\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tkind: \"fixed\",\n\t\t\t\t\t\t\t\t\t\tentries: { ...node.config.resolver.entries },\n\t\t\t\t\t\t\t\t\t\tfallbackState: node.config.resolver.fallbackState\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\tkind: \"threshold\",\n\t\t\t\t\t\t\t\t\t\tthresholds: node.config.resolver.thresholds.map((item) =>\n\t\t\t\t\t\t\t\t\t\t\ttypeof item === \"number\" ? item : { ...item }\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tstates: [...node.config.resolver.states],\n\t\t\t\t\t\t\t\t\t\tinvalidState: node.config.resolver.invalidState\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\ticon: node.config.icon ? { ...node.config.icon } : undefined\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"typedValueFormat\":\n\t\t\t\tsteps.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttype: \"typedValueFormat\",\n\t\t\t\t\tconfig: node.config ? { ...node.config } : undefined\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tvalidateStepDefinitions(steps, state);\n\n\treturn {\n\t\tok: state.errors.length === 0,\n\t\terrors: state.errors,\n\t\twarnings: state.warnings,\n\t\tplan: state.errors.length === 0 ? { steps } : undefined\n\t};\n}\n\n/**\n * Валидация конфигурации pipeline c выбором рабочего плана исполнения.\n *\n * Приоритет источника плана:\n * 1) `plan` из конфигурации;\n * 2) построение плана из `graph`.\n */\nexport function validateFormattersPipelineConfig(config: FormattersPipelineConfig | undefined): FormattersPipelineValidationResult {\n\tconst state: MutableValidationState = { errors: [], warnings: [] };\n\n\tif (!config) {\n\t\tpushError(state, \"config_not_defined\", \"Конфигурация pipeline не задана.\");\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors: state.errors,\n\t\t\twarnings: state.warnings\n\t\t};\n\t}\n\n\tif (config.version !== 1) {\n\t\tpushError(state, \"unsupported_version\", `Неподдерживаемая версия pipeline: ${String(config.version)}.`);\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors: state.errors,\n\t\t\twarnings: state.warnings\n\t\t};\n\t}\n\n\tif (!config.plan && !config.graph) {\n\t\tpushError(state, \"graph_or_plan_required\", \"Для pipeline должен быть задан хотя бы один источник: graph или plan.\");\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors: state.errors,\n\t\t\twarnings: state.warnings\n\t\t};\n\t}\n\n\tif (config.plan) {\n\t\tconst planResult = validateFormattersPipelinePlan(config.plan);\n\t\tstate.errors.push(...planResult.errors);\n\t\tstate.warnings.push(...planResult.warnings);\n\n\t\tif (planResult.ok && planResult.plan) {\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\terrors: state.errors,\n\t\t\t\twarnings: state.warnings,\n\t\t\t\tplan: planResult.plan\n\t\t\t};\n\t\t}\n\n\t\tif (config.graph) {\n\t\t\tpushWarning(state, \"path_broken\", \"Линейный plan невалиден. Выполнена попытка построить план из graph.\");\n\t\t\tstate.errors.length = 0;\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: state.errors,\n\t\t\t\twarnings: state.warnings\n\t\t\t};\n\t\t}\n\t}\n\n\tif (config.graph) {\n\t\tconst graphResult = validateFormattersPipelineGraph(config.graph);\n\t\treturn {\n\t\t\tok: graphResult.ok,\n\t\t\terrors: [...state.errors, ...graphResult.errors],\n\t\t\twarnings: [...state.warnings, ...graphResult.warnings],\n\t\t\tplan: graphResult.plan\n\t\t};\n\t}\n\n\treturn {\n\t\tok: false,\n\t\terrors: state.errors,\n\t\twarnings: state.warnings\n\t};\n}\n"],"mappings":";AAMA,IAAa,IAA2D;CACvE,UAAU;CACV,kBAAkB;CAClB,UAAU;CACV,mBAPmB,IAAI,KAAK,aAAa,OAAO,CAAC,CAAC,cAAc,GAAI,CAAC,CAAC,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC,EAAE,SAAS;CAQhH,cAAc;AACf,GAEa,IAA8B,OAAO,OAAO;CACxD,SAAS;CACT,SAAS;CACT,UAAU;CACV,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,SAAS;CACT,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;AACjB,CAAC,GAGK,IAAsC;CAC3C;EAAE,MAAM;EAAW,UAAU;EAAG,kBAAkB;CAAG;CACrD,EAAE,MAAM,UAAU;CAClB;EAAE,MAAM;EAAa,UAAU;CAAE;CACjC;EAAE,MAAM;EAAa,UAAU;CAAE;CACjC;EAAE,MAAM;EAAY,UAAU;EAAG,kBAAkB;CAAG;CACtD;EAAE,MAAM;EAAS,UAAU;EAAG,kBAAkB;CAAG;CACnD;EAAE,MAAM;EAAW,UAAU;CAAE;CAC/B,EAAE,MAAM,UAAU;CAClB;EAAE,MAAM;EAAoB,UAAU;EAAG,kBAAkB;EAAI,SAAS,CAAC;CAAE;CAC3E;EAAE,MAAM;EAAmB,UAAU;EAAG,SAAS,EAAE,aAAa,EAAE;CAAE;CACpE;EAAE,MAAM;EAAmB,SAAS,EAAE,aAAa,EAAE;CAAE;AACxD,GAEM,oBAAW,IAAI,IAAgC;AAErD,SAAS,IAAa;CACrB,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AAG,EAAY,QAAQ;GACrD,MAAM,EAAY;EACnB;CACD;CAEA,OAAO;EACN,IAAI;EACJ,QAAQ,EAAM;EACd,UAAU,EAAM;CACjB;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/formatters/rowBased/definitions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAAS,2BAA2B,EAAsB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TableFormulaDefinition } from "../types";
|
|
2
|
-
export declare const addFormula: TableFormulaDefinition;
|
|
3
|
-
export declare const substractFormula: TableFormulaDefinition;
|
|
4
|
-
export declare const multiplyFormula: TableFormulaDefinition;
|
|
5
|
-
export declare const divideFormula: TableFormulaDefinition;
|
|
6
|
-
export declare const percentFormula: TableFormulaDefinition;
|
|
7
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/formulas/definitions/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,UAAU,EAAE,sBAUxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,sBAU9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,sBAU7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,sBAY3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,sBAe5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formulas/definitions/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,uBAAuB,EAAE,SAAS,sBAAsB,EAYnE,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TableFormulaDefinition } from "../types";
|
|
2
|
-
export declare const markupFormula: TableFormulaDefinition;
|
|
3
|
-
export declare const markupSSCFormula: TableFormulaDefinition;
|
|
4
|
-
export declare const planDeviationPercent: TableFormulaDefinition;
|
|
5
|
-
export declare const growthPercent: TableFormulaDefinition;
|
|
6
|
-
export declare const sscPerTon: TableFormulaDefinition;
|
|
7
|
-
//# sourceMappingURL=sales.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sales.d.ts","sourceRoot":"","sources":["../../../src/formulas/definitions/sales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,sBAiB3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,sBAe9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,sBAUlC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,sBAa3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,sBAavB,CAAC"}
|