@ryuzaki13/react-foundation-lib 2.11.0 → 2.12.0
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/chunks/{formatters-DVE1YVNQ.js → formatters-BJ6VySIq.js} +346 -450
- package/dist/chunks/formatters-BJ6VySIq.js.map +1 -0
- package/dist/chunks/{validate-DyzojM0w.js → validate-DnkaY38p.js} +213 -93
- package/dist/chunks/validate-DnkaY38p.js.map +1 -0
- package/dist/error-report/index.js +1 -1
- package/dist/excel/index.js +18 -18
- package/dist/excel/index.js.map +1 -1
- package/dist/formatters/index.js +5 -5
- package/dist/formatters/pipeline/clone.d.ts.map +1 -1
- package/dist/formatters/pipeline/dependencies.d.ts +1 -0
- package/dist/formatters/pipeline/dependencies.d.ts.map +1 -1
- package/dist/formatters/pipeline/execute.d.ts +1 -1
- package/dist/formatters/pipeline/execute.d.ts.map +1 -1
- package/dist/formatters/pipeline/normalize.d.ts.map +1 -1
- package/dist/formatters/pipeline/rekey.d.ts.map +1 -1
- package/dist/formatters/pipeline/runtime.d.ts.map +1 -1
- package/dist/formatters/pipeline/types.d.ts +28 -4
- package/dist/formatters/pipeline/types.d.ts.map +1 -1
- package/dist/formatters/pipeline/validate.d.ts +1 -1
- package/dist/formatters/pipeline/validate.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/formatters/pipeline/README.mdx +35 -2
- package/dist/chunks/formatters-DVE1YVNQ.js.map +0 -1
- package/dist/chunks/validate-DyzojM0w.js.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Lt as e } from "./odata-service-CWkHASdw.js";
|
|
2
|
-
|
|
2
|
+
import { validateTableFormulaDependencies as t } from "../formulas/index.js";
|
|
3
|
+
var n = {
|
|
3
4
|
decimals: 1,
|
|
4
5
|
decimalSeparator: ",",
|
|
5
6
|
grouping: !0,
|
|
6
7
|
groupingSeparator: new Intl.NumberFormat("ru-RU").formatToParts(1e3).find((e) => e.type === "group")?.value ?? "\xA0",
|
|
7
8
|
groupingSize: 3
|
|
8
|
-
},
|
|
9
|
+
}, r = Object.freeze({
|
|
9
10
|
integer: "integer",
|
|
10
11
|
decimal: "decimal",
|
|
11
12
|
decimal2: "decimal-2",
|
|
@@ -20,7 +21,7 @@ var t = {
|
|
|
20
21
|
compactPercentRound: "compact-percent-round",
|
|
21
22
|
compactTonnage: "compact-tonnage",
|
|
22
23
|
compactTonnageRound: "compact-tonnage-round"
|
|
23
|
-
}),
|
|
24
|
+
}), i = [
|
|
24
25
|
{
|
|
25
26
|
name: "integer",
|
|
26
27
|
decimals: 0,
|
|
@@ -86,39 +87,145 @@ var t = {
|
|
|
86
87
|
roundingMode: "round"
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
],
|
|
90
|
-
function
|
|
91
|
-
for (let e of
|
|
92
|
-
...
|
|
90
|
+
], a = /* @__PURE__ */ new Map();
|
|
91
|
+
function o() {
|
|
92
|
+
for (let e of i) a.set(e.name, {
|
|
93
|
+
...n,
|
|
93
94
|
...e
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
function
|
|
98
|
-
return
|
|
97
|
+
o();
|
|
98
|
+
function s(e) {
|
|
99
|
+
return a.get(e);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
return Array.from(
|
|
101
|
+
function c() {
|
|
102
|
+
return Array.from(a.keys());
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
let
|
|
105
|
-
...
|
|
104
|
+
function l(e) {
|
|
105
|
+
let t = {
|
|
106
|
+
...n,
|
|
106
107
|
...e
|
|
107
108
|
};
|
|
108
|
-
return
|
|
109
|
+
return a.set(t.name, t), t;
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
111
|
+
function u() {
|
|
112
|
+
a.clear(), o();
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
+
function d(e) {
|
|
114
115
|
if (typeof e != "string") return e;
|
|
115
|
-
let t =
|
|
116
|
+
let t = s(e);
|
|
116
117
|
if (!t) throw Error(`Предустановка "${e}" не найдена`);
|
|
117
118
|
return t;
|
|
118
119
|
}
|
|
119
120
|
//#endregion
|
|
121
|
+
//#region src/formatters/pipeline/clone.ts
|
|
122
|
+
function f(e) {
|
|
123
|
+
return e ? { ...e } : void 0;
|
|
124
|
+
}
|
|
125
|
+
function p(e) {
|
|
126
|
+
return e ? { ...e } : void 0;
|
|
127
|
+
}
|
|
128
|
+
function m(e) {
|
|
129
|
+
return e.mode === "formula" ? {
|
|
130
|
+
...e,
|
|
131
|
+
dependencyIds: e.dependencyIds ? [...e.dependencyIds] : void 0
|
|
132
|
+
} : { ...e };
|
|
133
|
+
}
|
|
134
|
+
function h(e) {
|
|
135
|
+
return {
|
|
136
|
+
resolver: e.resolver.kind === "fixed" ? {
|
|
137
|
+
kind: "fixed",
|
|
138
|
+
entries: { ...e.resolver.entries },
|
|
139
|
+
fallbackState: e.resolver.fallbackState
|
|
140
|
+
} : {
|
|
141
|
+
kind: "threshold",
|
|
142
|
+
thresholds: e.resolver.thresholds.map((e) => typeof e == "number" ? e : { ...e }),
|
|
143
|
+
states: [...e.resolver.states],
|
|
144
|
+
invalidState: e.resolver.invalidState
|
|
145
|
+
},
|
|
146
|
+
valueSource: e.valueSource?.kind === "formula" ? {
|
|
147
|
+
...e.valueSource,
|
|
148
|
+
dependencyIds: [...e.valueSource.dependencyIds]
|
|
149
|
+
} : e.valueSource ? { ...e.valueSource } : void 0,
|
|
150
|
+
icon: e.icon ? { ...e.icon } : void 0
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function g(e) {
|
|
154
|
+
switch (e.type) {
|
|
155
|
+
case "typedValueFormat": return {
|
|
156
|
+
...e,
|
|
157
|
+
config: f(e.config)
|
|
158
|
+
};
|
|
159
|
+
case "normalizeLeadingZeros": return {
|
|
160
|
+
...e,
|
|
161
|
+
config: p(e.config)
|
|
162
|
+
};
|
|
163
|
+
case "rowBasedOverride": return {
|
|
164
|
+
...e,
|
|
165
|
+
config: m(e.config)
|
|
166
|
+
};
|
|
167
|
+
case "resolveValueState": return {
|
|
168
|
+
...e,
|
|
169
|
+
config: h(e.config)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
throw Error(`Недопустимый тип '${e?.type}' для шага FormatterPipeline`);
|
|
173
|
+
}
|
|
174
|
+
function _(e, t) {
|
|
175
|
+
switch (e.type) {
|
|
176
|
+
case "typedValueFormat": return {
|
|
177
|
+
...e,
|
|
178
|
+
position: { ...t },
|
|
179
|
+
config: f(e.config)
|
|
180
|
+
};
|
|
181
|
+
case "normalizeLeadingZeros": return {
|
|
182
|
+
...e,
|
|
183
|
+
position: { ...t },
|
|
184
|
+
config: p(e.config)
|
|
185
|
+
};
|
|
186
|
+
case "rowBasedOverride": return {
|
|
187
|
+
...e,
|
|
188
|
+
position: { ...t },
|
|
189
|
+
config: m(e.config)
|
|
190
|
+
};
|
|
191
|
+
case "resolveValueState": return {
|
|
192
|
+
...e,
|
|
193
|
+
position: { ...t },
|
|
194
|
+
config: h(e.config)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
throw Error(`Недопустимый тип '${e?.type}' для шага FormatterPipeline`);
|
|
198
|
+
}
|
|
199
|
+
function v(e) {
|
|
200
|
+
switch (e.type) {
|
|
201
|
+
case "source":
|
|
202
|
+
case "sink": return {
|
|
203
|
+
...e,
|
|
204
|
+
position: { ...e.position }
|
|
205
|
+
};
|
|
206
|
+
default: return _(e, e.position);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function y(e) {
|
|
210
|
+
return {
|
|
211
|
+
nodes: e.nodes.map(v),
|
|
212
|
+
edges: e.edges.map((e) => ({ ...e })),
|
|
213
|
+
viewport: e.viewport ? { ...e.viewport } : void 0
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function b(e) {
|
|
217
|
+
return { steps: e.steps.map(g) };
|
|
218
|
+
}
|
|
219
|
+
function x(e) {
|
|
220
|
+
if (e) return {
|
|
221
|
+
version: e.version,
|
|
222
|
+
graph: e.graph ? y(e.graph) : void 0,
|
|
223
|
+
plan: e.plan ? b(e.plan) : void 0
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
120
227
|
//#region src/formatters/rowBased/context.ts
|
|
121
|
-
function
|
|
228
|
+
function S(t) {
|
|
122
229
|
let n = [...t.keys ?? []], r = (e) => {
|
|
123
230
|
if (!Number.isInteger(e) || e < 0) {
|
|
124
231
|
t.instrumentation?.onOutOfRangeIndex?.(e);
|
|
@@ -147,7 +254,7 @@ function d(t) {
|
|
|
147
254
|
}
|
|
148
255
|
//#endregion
|
|
149
256
|
//#region src/formatters/rowBased/registry.ts
|
|
150
|
-
function
|
|
257
|
+
function C(e) {
|
|
151
258
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
152
259
|
for (let r of e) {
|
|
153
260
|
let e = r.id.trim();
|
|
@@ -166,50 +273,50 @@ function f(e) {
|
|
|
166
273
|
byId: t
|
|
167
274
|
});
|
|
168
275
|
}
|
|
169
|
-
var
|
|
170
|
-
function
|
|
171
|
-
|
|
276
|
+
var w = C([]);
|
|
277
|
+
function T(e) {
|
|
278
|
+
w = e;
|
|
172
279
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
280
|
+
function E() {
|
|
281
|
+
return w.list;
|
|
175
282
|
}
|
|
176
|
-
function
|
|
283
|
+
function D(e) {
|
|
177
284
|
let t = e?.trim();
|
|
178
|
-
if (t) return
|
|
285
|
+
if (t) return w.byId.get(t);
|
|
179
286
|
}
|
|
180
287
|
//#endregion
|
|
181
288
|
//#region src/formatters/pipeline/validate.ts
|
|
182
|
-
function
|
|
289
|
+
function O(e, t, n) {
|
|
183
290
|
e.errors.push({
|
|
184
291
|
code: t,
|
|
185
292
|
message: n
|
|
186
293
|
});
|
|
187
294
|
}
|
|
188
|
-
function
|
|
295
|
+
function k(e, t, n) {
|
|
189
296
|
e.warnings.push({
|
|
190
297
|
code: t,
|
|
191
298
|
message: n
|
|
192
299
|
});
|
|
193
300
|
}
|
|
194
|
-
function
|
|
301
|
+
function A(e) {
|
|
195
302
|
return [...e].sort((e, t) => e - t);
|
|
196
303
|
}
|
|
197
|
-
function
|
|
304
|
+
function j(e, t) {
|
|
198
305
|
return e.reduce((e, n, r) => (e[n] = (r + 1) * t, e), {});
|
|
199
306
|
}
|
|
200
|
-
function
|
|
307
|
+
function M(e, t) {
|
|
201
308
|
if (!e.formulaId.trim()) {
|
|
202
|
-
|
|
309
|
+
O(t, "step_row_based_override_formula_id_empty", "Для rowBasedOverride (formula) необходимо заполнить formulaId.");
|
|
203
310
|
return;
|
|
204
311
|
}
|
|
205
|
-
let n =
|
|
312
|
+
let n = D(e.formulaId), r = [...e.dependencyIds ?? []];
|
|
206
313
|
if (!n) {
|
|
207
|
-
|
|
314
|
+
O(t, "step_row_based_override_formula_not_found", "Формула rowBasedOverride не найдена в реестре.");
|
|
208
315
|
return;
|
|
209
316
|
}
|
|
210
317
|
let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = 0, s = (e) => {
|
|
211
318
|
try {
|
|
212
|
-
let t =
|
|
319
|
+
let t = S({
|
|
213
320
|
rowData: e,
|
|
214
321
|
rawValue: 100,
|
|
215
322
|
columnId: "__validation__",
|
|
@@ -228,13 +335,38 @@ function x(e, t) {
|
|
|
228
335
|
o += 1;
|
|
229
336
|
}
|
|
230
337
|
};
|
|
231
|
-
s(
|
|
232
|
-
let c =
|
|
233
|
-
a.size > 0 &&
|
|
338
|
+
s(j(r, 100)), s(j(r, -100));
|
|
339
|
+
let c = A(i), l = c.length > 0 ? c[c.length - 1] + 1 : 0;
|
|
340
|
+
a.size > 0 && O(t, "step_row_based_override_dependency_index_out_of_range", `Формула rowBasedOverride обращается к несуществующим индексам. Минимально требуется зависимостей: ${l}, выбрано: ${r.length}.`), c.length === 0 && k(t, "step_row_based_override_formula_does_not_use_dependencies", "Формула rowBasedOverride не использует dependencyIds.");
|
|
234
341
|
let u = r.filter((e, t) => !i.has(t));
|
|
235
|
-
u.length > 0 &&
|
|
342
|
+
u.length > 0 && k(t, "step_row_based_override_unused_dependencies", `Выбраны, но не используются формулой rowBasedOverride: ${u.join(", ")}.`), o > 0 && k(t, "step_row_based_override_formula_runtime_error", "На тестовых данных формула rowBasedOverride завершилась с ошибкой.");
|
|
343
|
+
}
|
|
344
|
+
function N(e, n) {
|
|
345
|
+
if (!e.formulaId.trim()) {
|
|
346
|
+
O(n, "step_value_state_formula_id_empty", "Для источника состояния необходимо выбрать формулу.");
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (e.dependencyIds.some((e) => !e.trim())) {
|
|
350
|
+
O(n, "step_value_state_dependency_id_empty", "Зависимость формулы состояния не может иметь пустой id.");
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
let r = t({
|
|
354
|
+
formulaId: e.formulaId,
|
|
355
|
+
dependencies: e.dependencyIds,
|
|
356
|
+
availableColumnIds: e.dependencyIds
|
|
357
|
+
});
|
|
358
|
+
for (let e of r.errors) e.code === "formula_not_found" ? O(n, "step_value_state_formula_not_found", "Формула источника состояния не найдена в реестре.") : e.code === "dependency_index_out_of_range" && O(n, "step_value_state_dependency_index_out_of_range", e.message);
|
|
359
|
+
for (let e of r.warnings) switch (e.code) {
|
|
360
|
+
case "unused_dependencies":
|
|
361
|
+
k(n, "step_value_state_unused_dependencies", e.message);
|
|
362
|
+
break;
|
|
363
|
+
case "formula_does_not_use_dependencies":
|
|
364
|
+
k(n, "step_value_state_formula_does_not_use_dependencies", e.message);
|
|
365
|
+
break;
|
|
366
|
+
case "formula_runtime_error": k(n, "step_value_state_formula_runtime_error", e.message);
|
|
367
|
+
}
|
|
236
368
|
}
|
|
237
|
-
function
|
|
369
|
+
function P(e, t) {
|
|
238
370
|
let n = /* @__PURE__ */ new Set(), r = {
|
|
239
371
|
normalizeLeadingZeros: 0,
|
|
240
372
|
rowBasedOverride: 0,
|
|
@@ -244,99 +376,99 @@ function S(e, t) {
|
|
|
244
376
|
for (let i of e) {
|
|
245
377
|
let e = i.id.trim();
|
|
246
378
|
if (!e) {
|
|
247
|
-
|
|
379
|
+
O(t, "step_id_duplicate", "Шаг pipeline не может иметь пустой id.");
|
|
248
380
|
continue;
|
|
249
381
|
}
|
|
250
|
-
switch (n.has(e) &&
|
|
382
|
+
switch (n.has(e) && O(t, "step_id_duplicate", `Найден дублирующийся id шага pipeline: ${e}.`), n.add(e), i.type) {
|
|
251
383
|
case "normalizeLeadingZeros":
|
|
252
384
|
r.normalizeLeadingZeros += 1;
|
|
253
385
|
break;
|
|
254
386
|
case "rowBasedOverride":
|
|
255
|
-
r.rowBasedOverride += 1, i.config.mode === "field" && !i.config.fieldKey.trim() &&
|
|
387
|
+
r.rowBasedOverride += 1, i.config.mode === "field" && !i.config.fieldKey.trim() && O(t, "step_row_based_override_field_key_empty", "Для rowBasedOverride (field) необходимо заполнить fieldKey."), i.config.mode === "formula" && M(i.config, t);
|
|
256
388
|
break;
|
|
257
389
|
case "resolveValueState":
|
|
258
|
-
r.resolveValueState += 1, i.config.resolver.kind === "threshold" && i.config.resolver.states.length !== i.config.resolver.thresholds.length + 1 &&
|
|
390
|
+
r.resolveValueState += 1, i.config.valueSource?.kind === "formula" && N(i.config.valueSource, t), i.config.resolver.kind === "threshold" && i.config.resolver.states.length !== i.config.resolver.thresholds.length + 1 && O(t, "step_threshold_states_count_invalid", "Для threshold-резолвера количество states должно быть равно thresholds + 1.");
|
|
259
391
|
break;
|
|
260
392
|
case "typedValueFormat": if (r.typedValueFormat += 1, i.config?.numberPresetName !== void 0) {
|
|
261
393
|
let e = i.config.numberPresetName.trim();
|
|
262
394
|
if (!e) {
|
|
263
|
-
|
|
395
|
+
O(t, "step_typed_value_format_preset_empty", "Для typedValueFormat указан пустой numberPresetName.");
|
|
264
396
|
break;
|
|
265
397
|
}
|
|
266
|
-
|
|
398
|
+
s(e) || O(t, "step_typed_value_format_preset_not_found", `Для typedValueFormat указан неизвестный пресет: ${e}.`);
|
|
267
399
|
}
|
|
268
400
|
}
|
|
269
401
|
}
|
|
270
|
-
r.normalizeLeadingZeros > 1 &&
|
|
402
|
+
r.normalizeLeadingZeros > 1 && O(t, "step_normalize_leading_zeros_multiple", "В pipeline может быть только один шаг normalizeLeadingZeros."), r.rowBasedOverride > 1 && O(t, "step_row_based_override_multiple", "В pipeline может быть только один шаг rowBasedOverride."), r.resolveValueState > 1 && O(t, "step_resolve_value_state_multiple", "В pipeline может быть только один шаг resolveValueState."), r.typedValueFormat > 1 && O(t, "step_typed_value_format_multiple", "В pipeline может быть только один шаг typedValueFormat.");
|
|
271
403
|
let i = e.findIndex((e) => e.type === "resolveValueState"), a = e.findIndex((e) => e.type === "typedValueFormat");
|
|
272
|
-
i !== -1 && a !== -1 && a < i &&
|
|
273
|
-
for (let n of e) n.type === "resolveValueState" && !n.config.icon?.enabled && n.config.icon?.showValue === !1 &&
|
|
404
|
+
i !== -1 && a !== -1 && a < i && O(t, "step_typed_before_value_state", "Шаг typedValueFormat не может выполняться до шага resolveValueState.");
|
|
405
|
+
for (let n of e) n.type === "resolveValueState" && !n.config.icon?.enabled && n.config.icon?.showValue === !1 && k(t, "step_value_hidden_without_icon", "Для resolveValueState установлено showValue=false при выключенной иконке: значение не будет отображаться.");
|
|
274
406
|
}
|
|
275
|
-
function
|
|
407
|
+
function F(e) {
|
|
276
408
|
let t = {
|
|
277
409
|
errors: [],
|
|
278
410
|
warnings: []
|
|
279
411
|
};
|
|
280
|
-
return
|
|
412
|
+
return P(e.steps, t), {
|
|
281
413
|
ok: t.errors.length === 0,
|
|
282
414
|
errors: t.errors,
|
|
283
415
|
warnings: t.warnings,
|
|
284
416
|
plan: t.errors.length === 0 ? { steps: [...e.steps] } : void 0
|
|
285
417
|
};
|
|
286
418
|
}
|
|
287
|
-
function
|
|
419
|
+
function I(e, t, n) {
|
|
288
420
|
let r = new Map(e.map((e) => [e.id, e])), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
289
421
|
for (let t of e) i.set(t.id, []), a.set(t.id, []);
|
|
290
422
|
for (let e of t) {
|
|
291
423
|
let t = e.source.trim(), o = e.target.trim();
|
|
292
424
|
if (!r.has(t) || !r.has(o)) {
|
|
293
|
-
|
|
425
|
+
O(n, "edge_node_not_found", `Ребро ${e.id} ссылается на несуществующий узел: ${t} -> ${o}.`);
|
|
294
426
|
continue;
|
|
295
427
|
}
|
|
296
428
|
i.get(t)?.push(o), a.get(o)?.push(t);
|
|
297
429
|
}
|
|
298
430
|
let o = e.filter((e) => e.type === "source"), s = e.filter((e) => e.type === "sink");
|
|
299
|
-
if (o.length !== 1 &&
|
|
431
|
+
if (o.length !== 1 && O(n, "source_count_invalid", "В графе должен быть ровно один узел source."), s.length !== 1 && O(n, "sink_count_invalid", "В графе должен быть ровно один узел sink."), n.errors.length > 0) return;
|
|
300
432
|
let c = o[0].id, l = s[0].id;
|
|
301
433
|
for (let t of e) {
|
|
302
434
|
let e = a.get(t.id)?.length ?? 0, r = i.get(t.id)?.length ?? 0;
|
|
303
435
|
if (t.type === "source") {
|
|
304
|
-
e !== 0 &&
|
|
436
|
+
e !== 0 && O(n, "source_incoming_invalid", "Узел source не должен иметь входящих рёбер."), r !== 1 && O(n, "node_degree_invalid", "Узел source должен иметь ровно одно исходящее ребро.");
|
|
305
437
|
continue;
|
|
306
438
|
}
|
|
307
439
|
if (t.type === "sink") {
|
|
308
|
-
r !== 0 &&
|
|
440
|
+
r !== 0 && O(n, "sink_outgoing_invalid", "Узел sink не должен иметь исходящих рёбер."), e !== 1 && O(n, "node_degree_invalid", "Узел sink должен иметь ровно одно входящее ребро.");
|
|
309
441
|
continue;
|
|
310
442
|
}
|
|
311
|
-
(e !== 1 || r !== 1) &&
|
|
443
|
+
(e !== 1 || r !== 1) && O(n, "node_degree_invalid", `Узел ${t.id} должен иметь ровно одно входящее и одно исходящее ребро для линейного pipeline.`);
|
|
312
444
|
}
|
|
313
445
|
if (n.errors.length > 0) return;
|
|
314
446
|
let u = /* @__PURE__ */ new Set(), d = [], f = c;
|
|
315
447
|
for (;;) {
|
|
316
448
|
if (u.has(f)) {
|
|
317
|
-
|
|
449
|
+
O(n, "path_cycle_detected", "В графе pipeline обнаружен цикл.");
|
|
318
450
|
return;
|
|
319
451
|
}
|
|
320
452
|
if (u.add(f), d.push(f), f === l) break;
|
|
321
453
|
let e = i.get(f) ?? [];
|
|
322
454
|
if (e.length !== 1) {
|
|
323
|
-
|
|
455
|
+
O(n, "path_broken", "Не удалось построить линейный путь от source к sink.");
|
|
324
456
|
return;
|
|
325
457
|
}
|
|
326
458
|
f = e[0];
|
|
327
459
|
}
|
|
328
460
|
if (u.size !== e.length) {
|
|
329
|
-
|
|
461
|
+
O(n, "path_disconnected_nodes", "Граф содержит узлы, которые не входят в линейный путь source -> sink.");
|
|
330
462
|
return;
|
|
331
463
|
}
|
|
332
464
|
return d;
|
|
333
465
|
}
|
|
334
|
-
function
|
|
466
|
+
function L(e) {
|
|
335
467
|
let t = {
|
|
336
468
|
errors: [],
|
|
337
469
|
warnings: []
|
|
338
470
|
};
|
|
339
|
-
if (!e.nodes.length) return
|
|
471
|
+
if (!e.nodes.length) return O(t, "path_broken", "Граф pipeline не содержит узлов."), {
|
|
340
472
|
ok: !1,
|
|
341
473
|
errors: t.errors,
|
|
342
474
|
warnings: t.warnings
|
|
@@ -345,11 +477,11 @@ function T(e) {
|
|
|
345
477
|
for (let r of e.nodes) {
|
|
346
478
|
let e = r.id.trim();
|
|
347
479
|
if (!e) {
|
|
348
|
-
|
|
480
|
+
O(t, "node_id_duplicate", "Узел pipeline не может иметь пустой id.");
|
|
349
481
|
continue;
|
|
350
482
|
}
|
|
351
483
|
if (n.has(e)) {
|
|
352
|
-
|
|
484
|
+
O(t, "node_id_duplicate", `Найден дублирующийся id узла pipeline: ${e}.`);
|
|
353
485
|
continue;
|
|
354
486
|
}
|
|
355
487
|
n.set(e, r);
|
|
@@ -358,11 +490,11 @@ function T(e) {
|
|
|
358
490
|
for (let n of e.edges) {
|
|
359
491
|
let e = n.id.trim();
|
|
360
492
|
if (!e) {
|
|
361
|
-
|
|
493
|
+
O(t, "edge_id_duplicate", "Ребро pipeline не может иметь пустой id.");
|
|
362
494
|
continue;
|
|
363
495
|
}
|
|
364
496
|
if (r.has(e)) {
|
|
365
|
-
|
|
497
|
+
O(t, "edge_id_duplicate", `Найден дублирующийся id ребра pipeline: ${e}.`);
|
|
366
498
|
continue;
|
|
367
499
|
}
|
|
368
500
|
r.add(e);
|
|
@@ -372,7 +504,7 @@ function T(e) {
|
|
|
372
504
|
errors: t.errors,
|
|
373
505
|
warnings: t.warnings
|
|
374
506
|
};
|
|
375
|
-
let i =
|
|
507
|
+
let i = I(e.nodes, e.edges, t);
|
|
376
508
|
if (!i) return {
|
|
377
509
|
ok: !1,
|
|
378
510
|
errors: t.errors,
|
|
@@ -403,19 +535,7 @@ function T(e) {
|
|
|
403
535
|
a.push({
|
|
404
536
|
id: t.id,
|
|
405
537
|
type: "resolveValueState",
|
|
406
|
-
config:
|
|
407
|
-
resolver: t.config.resolver.kind === "fixed" ? {
|
|
408
|
-
kind: "fixed",
|
|
409
|
-
entries: { ...t.config.resolver.entries },
|
|
410
|
-
fallbackState: t.config.resolver.fallbackState
|
|
411
|
-
} : {
|
|
412
|
-
kind: "threshold",
|
|
413
|
-
thresholds: t.config.resolver.thresholds.map((e) => typeof e == "number" ? e : { ...e }),
|
|
414
|
-
states: [...t.config.resolver.states],
|
|
415
|
-
invalidState: t.config.resolver.invalidState
|
|
416
|
-
},
|
|
417
|
-
icon: t.config.icon ? { ...t.config.icon } : void 0
|
|
418
|
-
}
|
|
538
|
+
config: h(t.config)
|
|
419
539
|
});
|
|
420
540
|
break;
|
|
421
541
|
case "typedValueFormat": a.push({
|
|
@@ -425,42 +545,42 @@ function T(e) {
|
|
|
425
545
|
});
|
|
426
546
|
}
|
|
427
547
|
}
|
|
428
|
-
return
|
|
548
|
+
return P(a, t), {
|
|
429
549
|
ok: t.errors.length === 0,
|
|
430
550
|
errors: t.errors,
|
|
431
551
|
warnings: t.warnings,
|
|
432
552
|
plan: t.errors.length === 0 ? { steps: a } : void 0
|
|
433
553
|
};
|
|
434
554
|
}
|
|
435
|
-
function
|
|
555
|
+
function R(e) {
|
|
436
556
|
let t = {
|
|
437
557
|
errors: [],
|
|
438
558
|
warnings: []
|
|
439
559
|
};
|
|
440
|
-
if (!e) return
|
|
560
|
+
if (!e) return O(t, "config_not_defined", "Конфигурация pipeline не задана."), {
|
|
441
561
|
ok: !1,
|
|
442
562
|
errors: t.errors,
|
|
443
563
|
warnings: t.warnings
|
|
444
564
|
};
|
|
445
|
-
if (e.version !== 1) return
|
|
565
|
+
if (e.version !== 1) return O(t, "unsupported_version", `Неподдерживаемая версия pipeline: ${String(e.version)}.`), {
|
|
446
566
|
ok: !1,
|
|
447
567
|
errors: t.errors,
|
|
448
568
|
warnings: t.warnings
|
|
449
569
|
};
|
|
450
|
-
if (!e.plan && !e.graph) return
|
|
570
|
+
if (!e.plan && !e.graph) return O(t, "graph_or_plan_required", "Для pipeline должен быть задан хотя бы один источник: graph или plan."), {
|
|
451
571
|
ok: !1,
|
|
452
572
|
errors: t.errors,
|
|
453
573
|
warnings: t.warnings
|
|
454
574
|
};
|
|
455
575
|
if (e.plan) {
|
|
456
|
-
let n =
|
|
576
|
+
let n = F(e.plan);
|
|
457
577
|
if (t.errors.push(...n.errors), t.warnings.push(...n.warnings), n.ok && n.plan) return {
|
|
458
578
|
ok: !0,
|
|
459
579
|
errors: t.errors,
|
|
460
580
|
warnings: t.warnings,
|
|
461
581
|
plan: n.plan
|
|
462
582
|
};
|
|
463
|
-
if (e.graph)
|
|
583
|
+
if (e.graph) k(t, "path_broken", "Линейный plan невалиден. Выполнена попытка построить план из graph."), t.errors.length = 0;
|
|
464
584
|
else return {
|
|
465
585
|
ok: !1,
|
|
466
586
|
errors: t.errors,
|
|
@@ -468,7 +588,7 @@ function E(e) {
|
|
|
468
588
|
};
|
|
469
589
|
}
|
|
470
590
|
if (e.graph) {
|
|
471
|
-
let n =
|
|
591
|
+
let n = L(e.graph);
|
|
472
592
|
return {
|
|
473
593
|
ok: n.ok,
|
|
474
594
|
errors: [...t.errors, ...n.errors],
|
|
@@ -483,6 +603,6 @@ function E(e) {
|
|
|
483
603
|
};
|
|
484
604
|
}
|
|
485
605
|
//#endregion
|
|
486
|
-
export {
|
|
606
|
+
export { d as S, n as _, C as a, l as b, S as c, x as d, p as f, r as g, f as h, T as i, g as l, m, L as n, D as o, h as p, F as r, E as s, R as t, _ as u, s as v, u as x, c as y };
|
|
487
607
|
|
|
488
|
-
//# sourceMappingURL=validate-
|
|
608
|
+
//# sourceMappingURL=validate-DnkaY38p.js.map
|