@kestra-io/ui-libs 0.0.194 → 0.0.196
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/FlowYamlUtils-BCoMPOUZ.cjs +2 -0
- package/dist/FlowYamlUtils-BCoMPOUZ.cjs.map +1 -0
- package/dist/{FlowYamlUtils-2NapKS0O.js → FlowYamlUtils-BHh3dCqD.js} +759 -718
- package/dist/FlowYamlUtils-BHh3dCqD.js.map +1 -0
- package/dist/kestra-flowyamlutils.cjs.js +1 -1
- package/dist/kestra-flowyamlutils.es.js +23 -22
- package/dist/kestra-index.cjs.js +1 -1
- package/dist/kestra-index.es.js +1 -1
- package/dist/utils/FlowYamlUtils.d.ts +6 -1
- package/dist/utils/FlowYamlUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/utils/FlowYamlUtils.test.ts +69 -0
- package/src/utils/FlowYamlUtils.ts +71 -0
- package/dist/FlowYamlUtils-2NapKS0O.js.map +0 -1
- package/dist/FlowYamlUtils-4gn3tdFh.cjs +0 -2
- package/dist/FlowYamlUtils-4gn3tdFh.cjs.map +0 -1
package/dist/kestra-index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import js, { Document as zs, YAMLMap as hr } from "yaml";
|
|
2
|
-
import { g as Vp, e as Up, d as Hp, r as Gp, a as Bp, f as pf, b as Wp, c as jp, h as zp, u as Kp, i as Yp, j as Xp, k as Zp, l as Jp, m as Qp, n as em, s as tm, p as nm, o as rm, q as im, t as mf, v as am, w as om, x as Ks, y as Ys, z as sm, A as lm, B as vn, C as gf, D as ls, E as um, F as Bn, G as cm, H as us, I as cs, J as He, K as Wn, L as jn, M as _n, N as Vt, O as ds, P as zn, Q as fs, R as dm, S as vf, T as hs, U as fm, V as Ut, W as _f, X as hm, Y as yf, Z as pm, _ as mm, $ as Ef, a0 as ps, a1 as gm, a2 as vm, a3 as _m, a4 as Kn, a5 as ym, a6 as Em, a7 as bm, a8 as Cm, a9 as wm, aa as Sm, ab as bf, ac as km, ad as Lm, ae as Tm } from "./FlowYamlUtils-
|
|
2
|
+
import { g as Vp, e as Up, d as Hp, r as Gp, a as Bp, f as pf, b as Wp, c as jp, h as zp, u as Kp, i as Yp, j as Xp, k as Zp, l as Jp, m as Qp, n as em, s as tm, p as nm, o as rm, q as im, t as mf, v as am, w as om, x as Ks, y as Ys, z as sm, A as lm, B as vn, C as gf, D as ls, E as um, F as Bn, G as cm, H as us, I as cs, J as He, K as Wn, L as jn, M as _n, N as Vt, O as ds, P as zn, Q as fs, R as dm, S as vf, T as hs, U as fm, V as Ut, W as _f, X as hm, Y as yf, Z as pm, _ as mm, $ as Ef, a0 as ps, a1 as gm, a2 as vm, a3 as _m, a4 as Kn, a5 as ym, a6 as Em, a7 as bm, a8 as Cm, a9 as wm, aa as Sm, ab as bf, ac as km, ad as Lm, ae as Tm } from "./FlowYamlUtils-BHh3dCqD.js";
|
|
3
3
|
import { createElementBlock as k, openBlock as E, mergeProps as ie, createElementVNode as O, createCommentVNode as M, toDisplayString as z, getCurrentInstance as tn, inject as Om, ref as _e, shallowRef as In, computed as pe, watch as ct, onMounted as Yn, onUnmounted as Cf, defineComponent as Re, h as nn, createVNode as K, Text as dn, Fragment as Me, nextTick as ms, onBeforeUnmount as wf, renderSlot as ye, createTextVNode as Et, normalizeClass as he, createBlock as ue, withCtx as te, normalizeStyle as fn, unref as W, toRef as Xs, resolveComponent as An, effectScope as Nm, reactive as Sf, resolveDynamicComponent as Ht, renderList as _t, createSlots as kf, normalizeProps as Im, guardReactiveProps as Am, withModifiers as Lf, withAsyncContext as Zs, toRaw as Rm, defineAsyncComponent as Dm, Comment as Pm, Suspense as Mm } from "vue";
|
|
4
4
|
import $m from "humanize-duration";
|
|
5
5
|
import cn from "moment";
|
|
@@ -3,6 +3,11 @@ export declare function parse<T = any>(item?: string, throwIfError?: boolean): T
|
|
|
3
3
|
export declare function stringify(item: any): string;
|
|
4
4
|
export declare function sort(value: Record<string, any>): string[];
|
|
5
5
|
export declare function pairsToMap(pairs?: any[]): YAMLMap<unknown, unknown>;
|
|
6
|
+
export declare function getPathFromSectionAndId({ source, section, id, }: {
|
|
7
|
+
source: string;
|
|
8
|
+
section: string;
|
|
9
|
+
id: string;
|
|
10
|
+
}): string | undefined;
|
|
6
11
|
export declare function extractBlock({ source, section, key, keyName }: {
|
|
7
12
|
source: string;
|
|
8
13
|
section: string;
|
|
@@ -84,7 +89,7 @@ export declare function getLastBlock({ source, section, parentKey, keyName, subB
|
|
|
84
89
|
export declare function updateMetadata(source: string, metadata: Record<string, any>): string;
|
|
85
90
|
export declare const FLOW_SECTION_KEYS: readonly ["tasks", "triggers", "errors", "finally", "afterExecution", "pluginDefaults"];
|
|
86
91
|
export type FlowSectionKeys = typeof FLOW_SECTION_KEYS[number];
|
|
87
|
-
export declare const ORDERED_FLOW_ROOT_KEYS: readonly ["id", "namespace", "description", "retry", "labels", "inputs", "variables", "tasks", "triggers", "errors", "finally", "afterExecution", "pluginDefaults", "taskDefaults", "concurrency", "outputs", "disabled"];
|
|
92
|
+
export declare const ORDERED_FLOW_ROOT_KEYS: readonly ["id", "namespace", "description", "retry", "labels", "inputs", "variables", "tasks", "triggers", "errors", "finally", "afterExecution", "pluginDefaults", "taskDefaults", "concurrency", "sla", "outputs", "disabled"];
|
|
88
93
|
export type FlowRootKeys = typeof ORDERED_FLOW_ROOT_KEYS[number];
|
|
89
94
|
export declare function cleanMetadata(source: string): string;
|
|
90
95
|
export declare function getMetadata(source: string): Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowYamlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FlowYamlUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,OAAO,EAWP,KAAK,EACR,MAAM,MAAM,CAAC;AAGd,wBAAgB,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,UAAO,GAAG,CAAC,GAA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 @@ describe("replaceBlockWithPath", () => {
|
|
|
1206
1206
|
`)
|
|
1207
1207
|
})
|
|
1208
1208
|
})
|
|
1209
|
+
|
|
1210
|
+
describe("getPathFromSectionAndId", () => {
|
|
1211
|
+
test("get path from id", () => {
|
|
1212
|
+
const yamlString = `
|
|
1213
|
+
tasks:
|
|
1214
|
+
- id: plugin1
|
|
1215
|
+
type: type1
|
|
1216
|
+
name: Plugin 1
|
|
1217
|
+
- id: plugin2
|
|
1218
|
+
type: type2
|
|
1219
|
+
name: Plugin 2
|
|
1220
|
+
`;
|
|
1221
|
+
const result = YamlUtils.getPathFromSectionAndId({
|
|
1222
|
+
source: yamlString,
|
|
1223
|
+
section: "tasks",
|
|
1224
|
+
id: "plugin2"
|
|
1225
|
+
});
|
|
1226
|
+
expect(result).toBe("tasks[1]");
|
|
1227
|
+
})
|
|
1228
|
+
|
|
1229
|
+
test("get path from id with subtask", () => {
|
|
1230
|
+
const yamlString = `
|
|
1231
|
+
tasks:
|
|
1232
|
+
- id: plugin1
|
|
1233
|
+
type: type1
|
|
1234
|
+
name: Plugin 1
|
|
1235
|
+
tasks:
|
|
1236
|
+
- id: plugin2
|
|
1237
|
+
type: type2
|
|
1238
|
+
name: Plugin 2
|
|
1239
|
+
- id: plugin3
|
|
1240
|
+
type: type3
|
|
1241
|
+
name: Plugin 3
|
|
1242
|
+
`;
|
|
1243
|
+
const result = YamlUtils.getPathFromSectionAndId({
|
|
1244
|
+
source: yamlString,
|
|
1245
|
+
section: "tasks",
|
|
1246
|
+
id: "plugin3"
|
|
1247
|
+
});
|
|
1248
|
+
expect(result).toBe("tasks[0].tasks[1]");
|
|
1249
|
+
})
|
|
1250
|
+
|
|
1251
|
+
test("get path from id with subCondition", () => {
|
|
1252
|
+
const yamlString = `
|
|
1253
|
+
triggers:
|
|
1254
|
+
- id: plugin1
|
|
1255
|
+
type: type1
|
|
1256
|
+
name: Plugin 1
|
|
1257
|
+
conditions:
|
|
1258
|
+
- id: plugin2
|
|
1259
|
+
type: type2
|
|
1260
|
+
name: Plugin 2
|
|
1261
|
+
- id: plugin3
|
|
1262
|
+
type: type3
|
|
1263
|
+
name: Plugin 3
|
|
1264
|
+
- id: plugin4
|
|
1265
|
+
type: type4
|
|
1266
|
+
name: Plugin 4
|
|
1267
|
+
|
|
1268
|
+
`;
|
|
1269
|
+
const result = YamlUtils.getPathFromSectionAndId({
|
|
1270
|
+
source: yamlString,
|
|
1271
|
+
section: "triggers",
|
|
1272
|
+
id: "plugin3"
|
|
1273
|
+
});
|
|
1274
|
+
expect(result).toBe("triggers[0].conditions[1]");
|
|
1275
|
+
})
|
|
1276
|
+
|
|
1277
|
+
})
|
|
@@ -123,6 +123,76 @@ function getSectionFromDocument({yamlDoc, section}:
|
|
|
123
123
|
return sectionNode?.value;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
function getPathFromId({node, id} : {
|
|
127
|
+
node: Node,
|
|
128
|
+
id: string
|
|
129
|
+
}): (string | number)[] {
|
|
130
|
+
// recursively search for the id in the node
|
|
131
|
+
if (isSeq<{ value: Node }>(node)) {
|
|
132
|
+
let index = 0
|
|
133
|
+
for (const item of node.items) {
|
|
134
|
+
if (isMap<{ value: string }, Node>(item)) {
|
|
135
|
+
const itemId = item.get("id") as string | undefined;
|
|
136
|
+
if (itemId === id) {
|
|
137
|
+
return [index];
|
|
138
|
+
} else {
|
|
139
|
+
const path = getPathFromId({node: item, id});
|
|
140
|
+
if (path.length > 0) {
|
|
141
|
+
return [index, ...path];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
index++;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if( isMap<{ value: string }, Node>(node)) {
|
|
150
|
+
const itemId = node.get("id") as string | undefined;
|
|
151
|
+
if (itemId === id) {
|
|
152
|
+
return [];
|
|
153
|
+
} else {
|
|
154
|
+
for (const item of node.items) {
|
|
155
|
+
if(item.value) {
|
|
156
|
+
const path = getPathFromId({node: item.value, id});
|
|
157
|
+
if (path.length > 0) {
|
|
158
|
+
return [item.key.value, ...path];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return []
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function getPathFromSectionAndId({
|
|
169
|
+
source,
|
|
170
|
+
section,
|
|
171
|
+
id,
|
|
172
|
+
}: {
|
|
173
|
+
source: string,
|
|
174
|
+
section: string,
|
|
175
|
+
id: string
|
|
176
|
+
}): string | undefined {
|
|
177
|
+
const {sectionNode} = getSectionNodeAndDocumentFromSource({source, section});
|
|
178
|
+
if (!sectionNode) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const pathArray = getPathFromId({node: sectionNode, id})
|
|
183
|
+
const path = pathArray.map((e) => {
|
|
184
|
+
if (typeof e === "string") {
|
|
185
|
+
return `.${e}`;
|
|
186
|
+
} else {
|
|
187
|
+
return `[${e}]`;
|
|
188
|
+
}
|
|
189
|
+
}).join("");
|
|
190
|
+
|
|
191
|
+
return `${section}${path}`;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
126
196
|
export function extractBlock({source, section, key, keyName}: {
|
|
127
197
|
source: string,
|
|
128
198
|
section: string,
|
|
@@ -718,6 +788,7 @@ export const ORDERED_FLOW_ROOT_KEYS = [
|
|
|
718
788
|
...FLOW_SECTION_KEYS,
|
|
719
789
|
"taskDefaults",
|
|
720
790
|
"concurrency",
|
|
791
|
+
"sla",
|
|
721
792
|
"outputs",
|
|
722
793
|
"disabled",
|
|
723
794
|
] as const
|