apn-app-manager 1.3.2 → 1.3.3

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.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Appian App Manager",
5
5
  "license": "Apache-2.0",
6
6
  "preferGlobal": true,
@@ -68,24 +68,28 @@ function renameObjectProp(curVal, haulField, curNamespace, newNamespace) {
68
68
  if (util.isBlank(curVal)) {
69
69
  return "";
70
70
  } else {
71
- let replacementRegexMap = buildNamespaceReplacementRegex(curNamespace, newNamespace, "gi");
71
+ let replacementRegexMap;
72
72
  let nampespaceReplacement;
73
73
  switch (haulField.type) {
74
74
  // UUIDs - just append the new namespace
75
75
  case obProps.propTypes.UUID:
76
+ replacementRegexMap = buildNamespaceReplacementRegex(curNamespace, newNamespace, "i");
76
77
  return `${curVal}-${util.toLower(newNamespace)}`;
77
78
  // URL_STUBs - attempt a replacement, but fall back to prefixing if unchanged to ensure they are unique
78
79
  case obProps.propTypes.URL_STUB:
80
+ replacementRegexMap = buildNamespaceReplacementRegex(curNamespace, newNamespace, "i");
79
81
  nampespaceReplacement = curVal.replace(replacementRegexMap.from, util.toLower(replacementRegexMap.to));
80
82
  return nampespaceReplacement != curVal ? nampespaceReplacement : `${util.toLower(newNamespace)}-${nampespaceReplacement}`;
81
83
  // NAMEs - attempt a replacement, but fall back to prefixing if unchanged to ensure they are unique
82
84
  case obProps.propTypes.NAME:
85
+ replacementRegexMap = buildNamespaceReplacementRegex(curNamespace, newNamespace, "i");
83
86
  nampespaceReplacement = curVal.replace(replacementRegexMap.from, replacementRegexMap.to);
84
87
  return nampespaceReplacement != curVal
85
88
  ? nampespaceReplacement
86
89
  : `${newNamespace}${util.firstMatch(curVal, new RegExp(cons.namespaceDelimiterRegex, "g"), "_")}${nampespaceReplacement}`;
87
90
  // TEXTs - just do a replacement, they do not need to be unique
88
91
  case obProps.propTypes.TEXT:
92
+ replacementRegexMap = buildNamespaceReplacementRegex(curNamespace, newNamespace, "g");
89
93
  return curVal.replace(replacementRegexMap.from, replacementRegexMap.to);
90
94
  }
91
95
  }
@@ -99,6 +103,11 @@ function removeFoundUuids(uuidCollector, haulField, uuids) {
99
103
  }
100
104
 
101
105
  // Creates the regex replacement for a namespace
106
+ // Note that:
107
+ // - UUID/URL_STUB/NAME calls of this pass "i" for flag because we can be case insensitive but we only want to replace the first match
108
+ // - e.g. Changing prefix COM to NEW, example endpoint change: com-write-comment -> new-write-comment
109
+ // - TEXT calls of this pass "g" for flag because we want to be case sensitive here and can change all instances
110
+ // - e.g. Changing prefix COM to NEW, example description change: "Creates COM_Comment and COM_CommentThread" -> "Creates NEW_Comment and NEW_CommentThread"
102
111
  function buildNamespaceReplacementRegex(curNamespace, newNamespace, regexTags) {
103
112
  if (curNamespace == cons.noNamespace) {
104
113
  return { from: "", to: "" };
@@ -118,7 +118,7 @@ const haulTypes = [
118
118
  {
119
119
  fieldName: fieldNames.DB_TABLE,
120
120
  xpath: `xsd:schema/xsd:complexType/xsd:annotation/xsd:appinfo[not(ns2:Metadata)]/node()`,
121
- type: propTypes.TEXT,
121
+ type: propTypes.NAME,
122
122
  usage: [usageTypes.CLONE, usageTypes.BUILD, usageTypes.RENAME],
123
123
  extractRegex: /(?<=")[^"]+(?=")/g,
124
124
  },
@@ -274,7 +274,7 @@ const haulTypes = [
274
274
  {
275
275
  fieldName: fieldNames.DB_TABLE,
276
276
  xpath: `recordTypeHaul/recordType/a:sourceConfiguration/friendlyName/node()`,
277
- type: propTypes.TEXT,
277
+ type: propTypes.NAME,
278
278
  usage: [usageTypes.CLONE, usageTypes.BUILD, usageTypes.RENAME],
279
279
  },
280
280
  {