un-cli 0.0.83 → 0.0.84
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/index.mjs +57 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { AdminLog } from "./adminlog.mjs"
|
|
|
7
7
|
import logger from "./logger.mjs"
|
|
8
8
|
import fetch from "node-fetch"
|
|
9
9
|
//update version
|
|
10
|
-
let version = "0.0.
|
|
10
|
+
let version = "0.0.84";
|
|
11
11
|
const GENERATE_TOKEN_TIME_MIN = 30;
|
|
12
12
|
|
|
13
13
|
let rl = null;
|
|
@@ -170,6 +170,7 @@ const inputs = {
|
|
|
170
170
|
"topology --disable" : "Disable topology",
|
|
171
171
|
"topology --enable" : "Enable topology",
|
|
172
172
|
"topology --validate" : "Validate topology (full extent)",
|
|
173
|
+
"update subnetworks --subnetwork": "Update the input subnetwork synchronously",
|
|
173
174
|
"update subnetworks --all": "Update all dirty subnetworks synchronously",
|
|
174
175
|
"update subnetworks --deleted": "Update all deleted dirty subnetworks synchronously",
|
|
175
176
|
"update subnetworks --all --async": "Update all dirty subnetworks asynchronously",
|
|
@@ -184,6 +185,7 @@ const inputs = {
|
|
|
184
185
|
"reconcile --version <version name>": "Reconcile the input version synchronously",
|
|
185
186
|
"reconcile --withpost --version <version name>": "Reconcile & Post the input version synchronously, oldest common ancestor first",
|
|
186
187
|
"reconcile --all": "Reconcile all versions available to the current user synchronously, oldest common ancestor first",
|
|
188
|
+
"reconcile --all --withpost": "Reconcile and post all versions available to the current user synchronously, oldest common ancestor first",
|
|
187
189
|
"reconcile --all --withpost --async": "Reconcile and post all versions available to the current user asynchronously, oldest common ancestor first",
|
|
188
190
|
"reconcile --all --async": "Reconcile all versions available to the current user asynchronously, oldest common ancestor first",
|
|
189
191
|
"count": "Lists the number of rows in all feature layers and tables.",
|
|
@@ -276,7 +278,7 @@ const inputs = {
|
|
|
276
278
|
return;
|
|
277
279
|
}
|
|
278
280
|
|
|
279
|
-
const subs = versions.versions.filter( a => a.reconcileDate
|
|
281
|
+
const subs = versions.versions.filter( a => a.reconcileDate == null ).sort ( (a,b)=> (a?.commonAncestorDate - b?.commonAncestorDate) ). map( (a) => {
|
|
280
282
|
return {"versionName": a.versionName, "Id": a.versionId, "guid" : a.versionGuid, "modified": new Date(a.modifiedDate), "common": a.commonAncestorDate ? new Date( a.commonAncestorDate) : 'N/A' , "reconciled": a.reconcileDate ? new Date(a.reconcileDate) : 'N/A'};
|
|
281
283
|
})
|
|
282
284
|
|
|
@@ -324,7 +326,7 @@ const inputs = {
|
|
|
324
326
|
|
|
325
327
|
summary.totalVersions = versions.versions.length;
|
|
326
328
|
|
|
327
|
-
summary.unreconciledVersions = versions.versions.filter( a => a.reconcileDate
|
|
329
|
+
summary.unreconciledVersions = versions.versions.filter( a => a.reconcileDate == null ).length
|
|
328
330
|
|
|
329
331
|
summary.versionsBehindDefault = versions.versions.filter( a => defaultVersion.modifiedDate > a?.commonAncestorDate ).length
|
|
330
332
|
|
|
@@ -416,6 +418,24 @@ const inputs = {
|
|
|
416
418
|
logger.info (`Reconciled ${numberWithCommas(rowCount)} versions.`)
|
|
417
419
|
},
|
|
418
420
|
|
|
421
|
+
|
|
422
|
+
"^reconcile --all --withpost$": async () => {
|
|
423
|
+
|
|
424
|
+
let versions = await un.versions()
|
|
425
|
+
versions.versions = versions.versions.sort ( (a,b)=> (a?.commonAncestorDate - b?.commonAncestorDate) )
|
|
426
|
+
|
|
427
|
+
for (let v = 0; v < versions.versions.length; v++)
|
|
428
|
+
{
|
|
429
|
+
if (versions.versions[v].versionName.toString().toUpperCase() === "SDE.DEFAULT") continue;
|
|
430
|
+
logger.info (`Reconciling version ${versions.versions[v].versionName} Common Ancestor ${new Date(versions.versions[v].commonAncestorDate)} ...`)
|
|
431
|
+
|
|
432
|
+
const result = await un.reconcile(versions.versions[v].versionGuid, true, false, true, false);
|
|
433
|
+
logger.info(JSON.stringify(result))
|
|
434
|
+
}
|
|
435
|
+
const rowCount = versions.versions.length;
|
|
436
|
+
logger.info (`Reconciled ${numberWithCommas(rowCount)} versions.`)
|
|
437
|
+
},
|
|
438
|
+
|
|
419
439
|
"^reconcile --all --async$": async () => {
|
|
420
440
|
//async
|
|
421
441
|
let versions = await un.versions()
|
|
@@ -662,6 +682,40 @@ const inputs = {
|
|
|
662
682
|
logger.info (`${numberWithCommas(rowCount)} rows returned.`)
|
|
663
683
|
},
|
|
664
684
|
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
"^update subnetworks --subnetwork" : async (input) => {
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
const inputParam = input.match(/--subnetwork .*/gm)
|
|
693
|
+
let subnetworkName = null;
|
|
694
|
+
if (inputParam != null && inputParam.length > 0)
|
|
695
|
+
subnetworkName = inputParam[0].replace("--subnetwork ", "")
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
let subnetworks = await un.queryDistinct(500002, "domainnetworkname,tiername,subnetworkname", "1=1 AND subnetworkname = '" + subnetworkName + "'","domainnetworkname,tiername,subnetworkname");
|
|
700
|
+
logger.info(`Discovered ${subnetworks.features.length} subnetworks.`);
|
|
701
|
+
for (let i = 0; i < subnetworks.features.length; i++) {
|
|
702
|
+
const f = subnetworks.features[i]
|
|
703
|
+
logger.info("Updating Subnetwork " + v(f.attributes,"subnetworkName"));
|
|
704
|
+
|
|
705
|
+
const fromDate = new Date();
|
|
706
|
+
|
|
707
|
+
const subnetworkResult = await un.updateSubnetworks(v(f.attributes,"domainNetworkName"), v(f.attributes,"tierName"), v(f.attributes,"subnetworkName"),false);
|
|
708
|
+
|
|
709
|
+
//code
|
|
710
|
+
|
|
711
|
+
const toDate = new Date();
|
|
712
|
+
const timeEnable = toDate.getTime() - fromDate.getTime();
|
|
713
|
+
subnetworkResult.duration = numberWithCommas(Math.round(timeEnable)) + " ms"
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
logger.info(`Result ${JSON.stringify(subnetworkResult)}`)
|
|
717
|
+
}
|
|
718
|
+
},
|
|
665
719
|
"^update subnetworks --deleted$" : async () => {
|
|
666
720
|
logger.info("Querying all subnetworks that are dirty and deleted.");
|
|
667
721
|
let subnetworks = await un.queryDistinct(500002, "domainnetworkname,tiername,subnetworkname", "isdirty=1 and isdeleted=1","domainnetworkname,tiername,subnetworkname");
|