Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 7429e22

Browse files
authored
Create find.js
1 parent 590e0ba commit 7429e22

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

examples/backup/find.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
const request = require("requestretry");
3+
const async = require('async');
4+
const fs = require('fs-extra');
5+
const moment = require('moment');
6+
const path = require("path");
7+
8+
const backupFile = require("./backup.json");
9+
10+
const findHierarchicalEntities = (value) =>{
11+
12+
const hierarchicalEntityObjects = value.entities.filter(entity => {
13+
if (entity.children) {
14+
return entity.name;
15+
}
16+
});
17+
18+
return hierarchicalEntityObjects.map(x => x.name);
19+
}
20+
21+
const findCompositeEntities = (value) =>{
22+
23+
return value.composites.map(composite => {
24+
return composite.name;
25+
});
26+
}
27+
28+
// find all apps with heirarchical entities
29+
backupFile.apps.forEach(app => {
30+
31+
app.properties.forEach(property => {
32+
33+
if(property.route == 'versionExports'){
34+
35+
// get version name
36+
property.values.forEach(value => {
37+
38+
// check version for deprecated items
39+
const name = value.name;
40+
const version = value.versionId;
41+
42+
const hierarchicalEntities = findHierarchicalEntities(value);
43+
hierarchicalEntities.length>0? console.log(`'${name}' '${version}' 'HIER=${hierarchicalEntities.join(",")}'`) : null;
44+
45+
const compositeEntities = findCompositeEntities(value);
46+
compositeEntities.length>0? console.log(`'${name}' '${version}' 'COMP=${compositeEntities.join(",")}'`) : null;
47+
})
48+
}
49+
});
50+
});

0 commit comments

Comments
 (0)