fba-cli 1.0.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/README.md +101 -0
- package/dist/adltRemoteClient.js +430 -0
- package/dist/adltRemoteClient.js.map +1 -0
- package/dist/cmdExec.js +452 -0
- package/dist/cmdExec.js.map +1 -0
- package/dist/execReport.js +155 -0
- package/dist/execReport.js.map +1 -0
- package/dist/fbaFormat.js +434 -0
- package/dist/fbaFormat.js.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/remote_types.js +504 -0
- package/dist/remote_types.js.map +1 -0
- package/dist/util.js +26 -0
- package/dist/util.js.map +1 -0
- package/jest.config.ts +9 -0
- package/package.json +62 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import * as yaml from 'js-yaml';
|
|
2
|
+
import ShortUniqueId from 'short-unique-id';
|
|
3
|
+
import * as zlib from 'zlib';
|
|
4
|
+
export const currentFBAFileVersion = '0.7';
|
|
5
|
+
export const rqUriDecode = (rq) => {
|
|
6
|
+
const res = {
|
|
7
|
+
path: '',
|
|
8
|
+
commands: [],
|
|
9
|
+
};
|
|
10
|
+
if (!rq || rq.length === 0) {
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
const indexOfQ = rq?.indexOf('?');
|
|
14
|
+
if (indexOfQ > 0) {
|
|
15
|
+
res.path = rq.slice(0, indexOfQ + 1); // + '\n'
|
|
16
|
+
const options = rq.slice(indexOfQ + 1);
|
|
17
|
+
const optionArr = options.split('&');
|
|
18
|
+
for (const commandStr of optionArr) {
|
|
19
|
+
const eqIdx = commandStr.indexOf('=');
|
|
20
|
+
const command = commandStr.slice(0, eqIdx);
|
|
21
|
+
const commandParams = decodeURIComponent(commandStr.slice(eqIdx + 1));
|
|
22
|
+
res.commands.push({ cmd: command, param: commandParams });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
res.path = rq;
|
|
27
|
+
}
|
|
28
|
+
return res;
|
|
29
|
+
};
|
|
30
|
+
export const rqUriEncode = (rq) => {
|
|
31
|
+
let toRet = rq.path;
|
|
32
|
+
if (rq.commands.length > 0) {
|
|
33
|
+
if (!toRet.endsWith('?')) {
|
|
34
|
+
toRet += '?';
|
|
35
|
+
}
|
|
36
|
+
toRet += rq.commands.map((rqCmd) => rqCmd.cmd + '=' + encodeURIComponent(rqCmd.param)).join('&');
|
|
37
|
+
/*
|
|
38
|
+
for (const [idx, rqCmd] of rq.commands.entries()) {
|
|
39
|
+
const cmdStr = rqCmd.cmd + '=' + encodeURIComponent(rqCmd.param)
|
|
40
|
+
if (idx > 0) {
|
|
41
|
+
toRet += '&'
|
|
42
|
+
}
|
|
43
|
+
toRet += cmdStr
|
|
44
|
+
}*/
|
|
45
|
+
}
|
|
46
|
+
return toRet;
|
|
47
|
+
};
|
|
48
|
+
const uid = new ShortUniqueId.default({ length: 8 });
|
|
49
|
+
export function getFBDataFromText(text) {
|
|
50
|
+
// here we do return the data that we pass as data=... to the Fishbone
|
|
51
|
+
// our document is a yaml document.
|
|
52
|
+
// representing a single object with properties:
|
|
53
|
+
// type <- expect "fba"
|
|
54
|
+
// version <- 0.4 (currentFBAFileVersion)
|
|
55
|
+
// title
|
|
56
|
+
// fishbone : array of effect objects
|
|
57
|
+
// attributes
|
|
58
|
+
let yamlObj = undefined;
|
|
59
|
+
if (text.trim().length === 0) {
|
|
60
|
+
yamlObj = {
|
|
61
|
+
type: 'fba',
|
|
62
|
+
version: currentFBAFileVersion,
|
|
63
|
+
title: '<no title>',
|
|
64
|
+
fishbone: [
|
|
65
|
+
{
|
|
66
|
+
fbUid: uid.rnd(),
|
|
67
|
+
name: '<enter effect to analyse>',
|
|
68
|
+
categories: [
|
|
69
|
+
{
|
|
70
|
+
fbUid: uid.rnd(),
|
|
71
|
+
name: 'category 1',
|
|
72
|
+
rootCauses: [],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
attributes: [],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
yamlObj = yaml.load(text, { schema: yaml.JSON_SCHEMA });
|
|
82
|
+
}
|
|
83
|
+
if (typeof yamlObj !== 'object') {
|
|
84
|
+
throw new Error(`content is no 'object' but '${typeof yamlObj}'`);
|
|
85
|
+
}
|
|
86
|
+
// console.log(`getFBDataFromText(len=${text.length}) type=${yamlObj.type}, version=${yamlObj.version}, title=${yamlObj.title}`)
|
|
87
|
+
// convert data from prev. versions?
|
|
88
|
+
const convertv01Effects = (effects) => {
|
|
89
|
+
return effects.map((effectsPair) => {
|
|
90
|
+
return {
|
|
91
|
+
name: effectsPair[0],
|
|
92
|
+
categories: effectsPair[1].map((catPair) => {
|
|
93
|
+
return {
|
|
94
|
+
name: catPair[0],
|
|
95
|
+
rootCauses: catPair[1].map((rootCause) => {
|
|
96
|
+
if (typeof rootCause === 'object' && rootCause.type === 'nested') {
|
|
97
|
+
const newRootCause = { ...rootCause };
|
|
98
|
+
newRootCause.data = convertv01Effects(rootCause.data);
|
|
99
|
+
return newRootCause;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return rootCause;
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
// todo remove duplicate... to async version
|
|
111
|
+
const deepRootCausesForEachNonAsync = (fishbone, parents, fn) => {
|
|
112
|
+
for (const effect of fishbone) {
|
|
113
|
+
const nrCats = effect?.categories?.length;
|
|
114
|
+
if (nrCats > 0) {
|
|
115
|
+
for (let c = 0; c < nrCats; ++c) {
|
|
116
|
+
const category = effect.categories[c];
|
|
117
|
+
let nrRcs = category?.rootCauses?.length;
|
|
118
|
+
if (nrRcs > 0) {
|
|
119
|
+
for (let r = 0; r < nrRcs; ++r) {
|
|
120
|
+
const rc = category.rootCauses[r];
|
|
121
|
+
let modRc = fn(rc, parents); // we call the callback in any case
|
|
122
|
+
if (modRc === undefined) {
|
|
123
|
+
// no change
|
|
124
|
+
modRc = rc;
|
|
125
|
+
}
|
|
126
|
+
else if (modRc === null) {
|
|
127
|
+
// delete this rc.
|
|
128
|
+
category.rootCauses.splice(r, 1);
|
|
129
|
+
--nrRcs;
|
|
130
|
+
modRc = undefined;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// update
|
|
134
|
+
category.rootCauses[r] = modRc;
|
|
135
|
+
}
|
|
136
|
+
if (modRc !== undefined) {
|
|
137
|
+
// and if its a nested we do nest automatically:
|
|
138
|
+
if (modRc?.type === 'nested') {
|
|
139
|
+
deepRootCausesForEachNonAsync(modRc.data, [...parents, modRc], fn);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
// convert data from prev. version 0.2
|
|
149
|
+
const convertv02TextFields = (yamlObj) => {
|
|
150
|
+
// we have to modify directly the yamlObj passed: and not return a new obj.
|
|
151
|
+
console.warn(`FBAEditorProvider.convertv02TextFields converting from v02 to v03 ...`);
|
|
152
|
+
// update instructions, backgroundDescription and comments;
|
|
153
|
+
deepRootCausesForEachNonAsync(yamlObj.fishbone, [], (rootCause) => {
|
|
154
|
+
// Updating fields
|
|
155
|
+
try {
|
|
156
|
+
if (rootCause.props && typeof rootCause.props.instructions === 'string') {
|
|
157
|
+
rootCause.props.instructions = { textValue: rootCause.props.instructions };
|
|
158
|
+
}
|
|
159
|
+
if (rootCause.props && typeof rootCause.props.backgroundDescription === 'string') {
|
|
160
|
+
rootCause.props.backgroundDescription = { textValue: rootCause.props.backgroundDescription };
|
|
161
|
+
}
|
|
162
|
+
if (rootCause.props && typeof rootCause.props.comments === 'string') {
|
|
163
|
+
rootCause.props.comments = { textValue: rootCause.props.comments };
|
|
164
|
+
}
|
|
165
|
+
return rootCause;
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
console.warn(` FBAEditorProvider.convertv02TextFields got error ${e.type}:${e.message} migrating ${JSON.stringify(rootCause)}`);
|
|
169
|
+
return null; // this root cause will be deleted!
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
//console.log(`FBAEditorProvider.convertv02TextFields converting from v02 to v03 ... done`)
|
|
173
|
+
yamlObj.version = '0.3';
|
|
174
|
+
};
|
|
175
|
+
// convert data from prev v0.3:
|
|
176
|
+
const convertv03RestParameters = (yamlObj) => {
|
|
177
|
+
// we have to modify directly the yamlObj passed: and not return a new obj.
|
|
178
|
+
console.assert(yamlObj.version === '0.3', `logical error! unexpected version=${yamlObj.version}`);
|
|
179
|
+
if (yamlObj.version === '0.3') {
|
|
180
|
+
//console.warn(`FBAEditorProvider.convertv03RestParameters converting from v03 to v04 ...`)
|
|
181
|
+
const updateSource = (obj) => {
|
|
182
|
+
// old format was as well: source.url=...
|
|
183
|
+
const srcString = typeof obj.source === 'string' ? obj.source : typeof obj.source?.url === 'string' ? obj.source.url : '';
|
|
184
|
+
if (srcString.startsWith('ext:mbehr1.dlt-logs')) {
|
|
185
|
+
// split into the components: path?cmd1=parm1&cmd2=parm2&...
|
|
186
|
+
// parmx needs to be uri encoded
|
|
187
|
+
const indexOfQ = srcString.indexOf('?');
|
|
188
|
+
if (indexOfQ > 0) {
|
|
189
|
+
const commandsNew = [];
|
|
190
|
+
const options = srcString.slice(indexOfQ + 1);
|
|
191
|
+
const optionArr = options.split('&');
|
|
192
|
+
for (const commandStr of optionArr) {
|
|
193
|
+
const eqIdx = commandStr.indexOf('=');
|
|
194
|
+
const command = commandStr.slice(0, eqIdx);
|
|
195
|
+
const commandParams = commandStr.slice(eqIdx + 1);
|
|
196
|
+
commandsNew.push(`${command}=${encodeURIComponent(commandParams)}`);
|
|
197
|
+
}
|
|
198
|
+
const newRequest = `${srcString.slice(0, indexOfQ)}?${commandsNew.join('&')}`;
|
|
199
|
+
//console.warn(` converted (uri encoded)\n ${JSON.stringify(obj)} to .source=\n '${newRequest}'`)
|
|
200
|
+
obj.source = newRequest;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
if (typeof obj.source !== 'string') {
|
|
205
|
+
// to get rid of the "source.url ones..."
|
|
206
|
+
//console.warn(` converted (.source.url to .source)\n ${JSON.stringify(obj)} to .source=\n '${srcString}'`)
|
|
207
|
+
obj.source = srcString;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
// update all badge.source, badge2.source, filter.source for ext...dlt-logs...
|
|
212
|
+
deepRootCausesForEachNonAsync(yamlObj.fishbone, [], (rc) => {
|
|
213
|
+
try {
|
|
214
|
+
if (rc.type === 'react' && rc.element === 'FBACheckbox' && typeof rc.props === 'object') {
|
|
215
|
+
if ('filter' in rc.props && 'badge' in rc.props.filter) {
|
|
216
|
+
if (!('badge' in rc.props)) {
|
|
217
|
+
rc.props.badge = rc.props.filter.badge;
|
|
218
|
+
delete rc.props.filter['badge'];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if ('filter' in rc.props && 'badge2' in rc.props.filter) {
|
|
222
|
+
if (!('badge2' in rc.props)) {
|
|
223
|
+
rc.props.badge2 = rc.props.filter.badge2;
|
|
224
|
+
delete rc.props.filter['badge2'];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if ('badge' in rc.props && 'source' in rc.props.badge) {
|
|
228
|
+
updateSource(rc.props.badge);
|
|
229
|
+
}
|
|
230
|
+
if ('badge2' in rc.props && 'source' in rc.props.badge2) {
|
|
231
|
+
updateSource(rc.props.badge2);
|
|
232
|
+
}
|
|
233
|
+
if ('filter' in rc.props && 'source' in rc.props.filter) {
|
|
234
|
+
updateSource(rc.props.filter);
|
|
235
|
+
}
|
|
236
|
+
// prev. we had filter.apply. -> change it consistently to filter.source as well.
|
|
237
|
+
if ('filter' in rc.props && 'apply' in rc.props.filter) {
|
|
238
|
+
if (!('source' in rc.props.filter)) {
|
|
239
|
+
// if its there already we dont overwrite
|
|
240
|
+
rc.props.filter.source = rc.props.filter.apply;
|
|
241
|
+
updateSource(rc.props.filter);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
console.warn(` FBAEditorProvider.convertv03RestParameters deleting filter.apply as filter.source already exists while migrating ${JSON.stringify(rc)}`);
|
|
245
|
+
}
|
|
246
|
+
delete rc.props.filter['apply']; // we delete anyhow to cleanup
|
|
247
|
+
}
|
|
248
|
+
return rc;
|
|
249
|
+
}
|
|
250
|
+
return undefined; // no change
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
253
|
+
console.warn(` FBAEditorProvider.convertv03RestParameters got error ${e.type}:${e.message} migrating ${JSON.stringify(rc)}`);
|
|
254
|
+
return null; // this root cause will be deleted!
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
// update all attributes with
|
|
258
|
+
// <key>.dataProvider: {
|
|
259
|
+
// source: 'ext:mbehr1.dlt-logs/get/docs?ecu="${attributes.ecu}"',
|
|
260
|
+
if (Array.isArray(yamlObj.attributes) && yamlObj.attributes.length > 0) {
|
|
261
|
+
yamlObj.attributes.forEach((attr) => {
|
|
262
|
+
const keyObj = attr[Object.keys(attr)[0]];
|
|
263
|
+
if ('dataProvider' in keyObj && 'source' in keyObj.dataProvider) {
|
|
264
|
+
updateSource(keyObj.dataProvider);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
//console.log(`FBAEditorProvider.convertv03RestParameters converting from v03 to v04 ... done`)
|
|
269
|
+
yamlObj.version = '0.4';
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
// convert data from prev v0.4: attributes change values to query only for current doc
|
|
273
|
+
const convertv04Attributes = (yamlObj) => {
|
|
274
|
+
if (yamlObj.version === '0.4') {
|
|
275
|
+
//console.warn(`FBAEditorProvider.convertv04Attributes converting from v04 to v05 ...`)
|
|
276
|
+
if (Array.isArray(yamlObj.attributes) && yamlObj.attributes.length > 0) {
|
|
277
|
+
yamlObj.attributes.forEach((attr) => {
|
|
278
|
+
const attrId = Object.keys(attr)[0];
|
|
279
|
+
const keyObj = attr[attrId];
|
|
280
|
+
if ('dataProvider' in keyObj) {
|
|
281
|
+
switch (attrId) {
|
|
282
|
+
case 'ecu':
|
|
283
|
+
keyObj.dataProvider = {
|
|
284
|
+
source: 'ext:mbehr1.dlt-logs/get/docs/0',
|
|
285
|
+
jsonPath: '$.data.attributes.ecus[*].name',
|
|
286
|
+
};
|
|
287
|
+
break;
|
|
288
|
+
case 'sw':
|
|
289
|
+
keyObj.dataProvider = {
|
|
290
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
291
|
+
source: `ext:mbehr1.dlt-logs/get/docs/0/ecus?ecu=${encodeURIComponent('"${attributes.ecu}"')}`,
|
|
292
|
+
jsonPath: '$.data[*].attributes.sws[*]',
|
|
293
|
+
};
|
|
294
|
+
break;
|
|
295
|
+
case 'lifecycles':
|
|
296
|
+
keyObj.dataProvider = {
|
|
297
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
298
|
+
source: `ext:mbehr1.dlt-logs/get/docs/0/ecus?ecu=${encodeURIComponent('"${attributes.ecu}"')}`,
|
|
299
|
+
jsonPath: '$.data[*].attributes.lifecycles[*].attributes',
|
|
300
|
+
};
|
|
301
|
+
break;
|
|
302
|
+
default:
|
|
303
|
+
break; // skip
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
//console.warn(`FBAEditorProvider.convertv04Attributes converting from v04 to v05 ... done`)
|
|
309
|
+
yamlObj.version = '0.5';
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
// convert from prev. known formats:
|
|
313
|
+
if (yamlObj?.version === '0.1') {
|
|
314
|
+
// the effects storage has changed:
|
|
315
|
+
if (yamlObj.fishbone) {
|
|
316
|
+
const fbv02 = convertv01Effects(yamlObj.fishbone);
|
|
317
|
+
console.log(`fbv02=`, fbv02);
|
|
318
|
+
yamlObj.fishbone = fbv02;
|
|
319
|
+
}
|
|
320
|
+
yamlObj.version = '0.2';
|
|
321
|
+
}
|
|
322
|
+
if (yamlObj?.version === '0.2') {
|
|
323
|
+
// the instruction, background and comment field has changed from string to object:
|
|
324
|
+
convertv02TextFields(yamlObj);
|
|
325
|
+
}
|
|
326
|
+
if (yamlObj?.version === '0.3') {
|
|
327
|
+
// uri encoded parameter for dlt-logs rest queries:
|
|
328
|
+
convertv03RestParameters(yamlObj);
|
|
329
|
+
}
|
|
330
|
+
if (yamlObj?.version === '0.4') {
|
|
331
|
+
convertv04Attributes(yamlObj);
|
|
332
|
+
}
|
|
333
|
+
if (yamlObj?.version === '0.5') {
|
|
334
|
+
yamlObj.version = '0.6'; // change from js-yaml lib 3.x to 4.x
|
|
335
|
+
// no further migration needed but to identify files in case of errors we create a backup
|
|
336
|
+
if (yamlObj.backups === undefined) {
|
|
337
|
+
yamlObj.backups = [];
|
|
338
|
+
}
|
|
339
|
+
yamlObj.backups.push({
|
|
340
|
+
date: Date.now(),
|
|
341
|
+
reason: `conversion from v0.5 to v0.6`,
|
|
342
|
+
textDeflated: zlib.deflateSync(text).toString('base64'),
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (yamlObj?.version === '0.6') {
|
|
346
|
+
//console.warn(`FBAEditorProvider converting from v0.6 to v0.7 ...`)
|
|
347
|
+
try {
|
|
348
|
+
iterateAllFBElements(yamlObj.fishbone, [], (type, elem, parent) => {
|
|
349
|
+
if (typeof elem !== 'object') {
|
|
350
|
+
// some rcs are just strings
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (!('fbUid' in elem)) {
|
|
354
|
+
elem.fbUid = uid.rnd();
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
if (Array.isArray(yamlObj.attributes) && yamlObj.attributes.length > 0) {
|
|
358
|
+
for (const attr of yamlObj.attributes) {
|
|
359
|
+
if (typeof attr === 'object' && !('fbUid' in attr)) {
|
|
360
|
+
attr.fbUid = uid.rnd();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (yamlObj.backups === undefined) {
|
|
365
|
+
yamlObj.backups = [];
|
|
366
|
+
}
|
|
367
|
+
yamlObj.backups.push({
|
|
368
|
+
date: Date.now(),
|
|
369
|
+
reason: `conversion from v0.6 to v0.7`,
|
|
370
|
+
textDeflated: zlib.deflateSync(text).toString('base64'),
|
|
371
|
+
});
|
|
372
|
+
yamlObj.version = '0.7';
|
|
373
|
+
//console.log(`FBAEditorProvider converting from v0.6 to v0.7 done`)
|
|
374
|
+
}
|
|
375
|
+
catch (e) {
|
|
376
|
+
console.error(`FBAEditorProvider converting from v0.6 to v0.7 got error: '${e}'`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// we're not forwards compatible.
|
|
380
|
+
if (yamlObj?.version !== currentFBAFileVersion) {
|
|
381
|
+
const msg = `Fishbone: The document uses unknown version ${yamlObj?.version}. Please check whether an extension update is available.`;
|
|
382
|
+
throw new Error(msg);
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
// todo return type and version as well! (will this cause harm?)
|
|
386
|
+
// why not return yamlObj directly?
|
|
387
|
+
attributes: yamlObj?.attributes,
|
|
388
|
+
fishbone: yamlObj.fishbone,
|
|
389
|
+
title: yamlObj.title || '<please add title to .fba>',
|
|
390
|
+
backups: yamlObj.backups || [],
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/// but don't allow delete. callback fn can modify directly
|
|
394
|
+
export const iterateAllFBElements = (fishbone, parents, fn) => {
|
|
395
|
+
for (const effect of fishbone) {
|
|
396
|
+
fn('effect', effect, fishbone);
|
|
397
|
+
if (effect?.categories?.length) {
|
|
398
|
+
for (const category of effect.categories) {
|
|
399
|
+
fn('category', category, effect);
|
|
400
|
+
if (category?.rootCauses?.length) {
|
|
401
|
+
for (const rc of category.rootCauses) {
|
|
402
|
+
fn('rc', rc, category);
|
|
403
|
+
if (rc.type === 'nested') {
|
|
404
|
+
iterateAllFBElements(rc.data, [...parents, rc], fn);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
export function fbaToString(fba) {
|
|
413
|
+
return yaml.dump(fba, { schema: yaml.JSON_SCHEMA, forceQuotes: true });
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* parse a text as yaml and return the raw object.
|
|
417
|
+
* This is supposed to be a fishbone/fba format but actually
|
|
418
|
+
* does parse yet any yaml.
|
|
419
|
+
*
|
|
420
|
+
* @param text persisted text to parse as fba yaml
|
|
421
|
+
* @returns raw object. no conversions/checks done yet.
|
|
422
|
+
* @throws Error if the text is not valid yaml or not a valid fba
|
|
423
|
+
*/
|
|
424
|
+
export function fbaYamlFromText(text) {
|
|
425
|
+
try {
|
|
426
|
+
const fbaYaml = yaml.load(text, { schema: yaml.JSON_SCHEMA });
|
|
427
|
+
return fbaYaml;
|
|
428
|
+
}
|
|
429
|
+
catch (e) {
|
|
430
|
+
console.error(`fbaYamlFromText: Could not parse text. Context is not valid yaml e=${e.name}:${e.message}`);
|
|
431
|
+
throw e;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
//# sourceMappingURL=fbaFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fbaFormat.js","sourceRoot":"","sources":["../src/fbaFormat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAC/B,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAA;AAiF1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAU,EAAM,EAAE;IAC5C,MAAM,GAAG,GAAO;QACd,IAAI,EAAE,EAAE;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I,QAAQ,CAAC,UAAU,EAAE;wBACpC,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAA;wBACtB,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,EAAE;4BACxB,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;yBACpD;qBACF;iBACF;aACF;SACF;KACF;AACH,CAAC,CAAA;AAED,MAAM,UAAU,WAAW,CAAC,GAAa;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;AACxE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QAC7D,OAAO,OAAO,CAAA;KACf;IAAC,OAAO,CAAM,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;QAC1G,MAAM,CAAC,CAAA;KACR;AACH,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* todos:
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { version } from './util.js';
|
|
7
|
+
import { cmdExec } from './cmdExec.js';
|
|
8
|
+
try {
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program
|
|
11
|
+
.name('fba-cli')
|
|
12
|
+
.version(version())
|
|
13
|
+
.description('A CLI (command line interface) to execute FBA (fishbone analysis) files with DLT-logs/adlt')
|
|
14
|
+
.showHelpAfterError();
|
|
15
|
+
program // todo or move to cmdExec?
|
|
16
|
+
.command('exec')
|
|
17
|
+
.description('execute FBA files with DLT-logs')
|
|
18
|
+
.option('-c, --config <config>', 'json config file with object key dlt-logs.plugins')
|
|
19
|
+
.option('-p, --port <port>', 'adlt remote host:port e.g. 127.0.0.1:7777. Otherwise an adlt if in path will be started locally.')
|
|
20
|
+
// .option('-j, --junit <output>', 'junit output filename ')
|
|
21
|
+
.argument('<files...>', 'FBA and DLT files to be processed')
|
|
22
|
+
.action(cmdExec);
|
|
23
|
+
program.parse();
|
|
24
|
+
const options = program.opts();
|
|
25
|
+
// console.log('options:', options)
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
console.error(`got error:${e}`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,IAAI;IACF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;IAE7B,OAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,OAAO,CAAC,OAAO,EAAE,CAAC;SAClB,WAAW,CAAC,4FAA4F,CAAC;SACzG,kBAAkB,EAAE,CAAA;IAEvB,OAAO,CAAC,2BAA2B;SAChC,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,iCAAiC,CAAC;SAC9C,MAAM,CAAC,uBAAuB,EAAE,mDAAmD,CAAC;SACpF,MAAM,CAAC,mBAAmB,EAAE,kGAAkG,CAAC;QAChI,4DAA4D;SAC3D,QAAQ,CAAC,YAAY,EAAE,mCAAmC,CAAC;SAC3D,MAAM,CAAC,OAAO,CAAC,CAAA;IAElB,OAAO,CAAC,KAAK,EAAE,CAAA;IACf,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IAE9B,mCAAmC;CACpC;AAAC,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;CAChC"}
|