apn-app-manager 1.2.0-beta.2 → 1.2.0-beta.anynamespace

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apn-app-manager",
3
- "version": "1.2.0-beta.2",
3
+ "version": "1.2.0-beta.anynamespace",
4
4
  "description": "Appian App Manager",
5
5
  "license": "Apache-2.0",
6
6
  "preferGlobal": true,
@@ -26,7 +26,7 @@
26
26
  "npm": "^8.18.0",
27
27
  "npm-run": "^5.0.1",
28
28
  "path": "^0.12.7",
29
- "prompts": "^2.3.0",
29
+ "prompts": "^2.4.2",
30
30
  "properties-parser": "^0.3.1",
31
31
  "set-immediate-shim": "^2.0.0",
32
32
  "uuid": "^9.0.0",
@@ -88,8 +88,20 @@ function mapNamespaces(namespaceCollector, onComplete) {
88
88
  } else {
89
89
  message = `Select another namespace`;
90
90
  }
91
- prompt.promptList(message, namespacesToChooseFrom, function (answer) {
92
- let chosenNamespace = answer;
91
+ let namespacesToChooseFromMap = {};
92
+ namespacesToChooseFrom.forEach(namespace => {
93
+ let subNamespaceCount =
94
+ lodash.filter(namespacesToChooseFrom, function (otherNamespace) {
95
+ return otherNamespace.startsWith(namespace);
96
+ }).length - 1;
97
+ let formattedNamespace =
98
+ namespace == cons.noNamespace
99
+ ? namespace
100
+ : `${" ".repeat(namespace.split("_").length)}${namespace} [including ${subNamespaceCount} matching sub-namespace(s)]`;
101
+ namespacesToChooseFromMap[formattedNamespace] = namespace;
102
+ });
103
+ prompt.promptList(message, Object.keys(namespacesToChooseFromMap), function (answer) {
104
+ let chosenNamespace = namespacesToChooseFromMap[answer];
93
105
  promptNamespace(
94
106
  `Namespace: ${chosenNamespace}. Enter a new namespace to clone these objects. Enter nothing to keep them as-is.`,
95
107
  function (answer) {
package/src/cons.js CHANGED
@@ -25,7 +25,7 @@ module.exports = {
25
25
  },
26
26
 
27
27
  yesNo: ["Yes", "No"],
28
- none: "None",
28
+ none: "[None]",
29
29
 
30
30
  // Testing of this regex can be found here: https://regexr.com/6sgu6
31
31
  // Note that we can assume any UUID that "must be cloned" must be wrapped in either >uuid< or "uuid"
@@ -21,10 +21,13 @@ module.exports = {
21
21
  };
22
22
 
23
23
  function selectFile(promptText, fileTypes, optional, callback) {
24
- let files = optional ? [cons.none] : [];
24
+ let files = [];
25
25
  util.handleDirFiles(cons.curDir, fileTypes, 1, 1, function (filePath) {
26
26
  files.push(path.basename(filePath));
27
27
  });
28
+ if (optional) {
29
+ files.push(cons.none);
30
+ }
28
31
  prompt.promptList(promptText, files, function (answer) {
29
32
  let answerPath = answer == cons.none ? null : path.resolve(cons.curDir, answer);
30
33
  util.execCallback(callback, answerPath);