@esri/solution-common 1.1.2 → 1.2.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.
Files changed (258) hide show
  1. package/dist/esm/completeItem.js +6 -7
  2. package/dist/esm/completeItem.js.map +1 -1
  3. package/dist/esm/create-hub-request-options.d.ts +4 -4
  4. package/dist/esm/create-hub-request-options.js +9 -12
  5. package/dist/esm/create-hub-request-options.js.map +1 -1
  6. package/dist/esm/deleteHelpers/deleteEmptyGroups.js +2 -2
  7. package/dist/esm/deleteHelpers/deleteEmptyGroups.js.map +1 -1
  8. package/dist/esm/deleteHelpers/deleteGroupIfEmpty.js +15 -15
  9. package/dist/esm/deleteHelpers/deleteGroupIfEmpty.js.map +1 -1
  10. package/dist/esm/deleteHelpers/deleteSolutionContents.js +20 -22
  11. package/dist/esm/deleteHelpers/deleteSolutionContents.js.map +1 -1
  12. package/dist/esm/deleteHelpers/deleteSolutionFolder.js +10 -10
  13. package/dist/esm/deleteHelpers/deleteSolutionFolder.js.map +1 -1
  14. package/dist/esm/deleteHelpers/deleteSolutionItem.js +4 -4
  15. package/dist/esm/deleteHelpers/deleteSolutionItem.js.map +1 -1
  16. package/dist/esm/deleteHelpers/reconstructBuildOrderIds.js +1 -1
  17. package/dist/esm/deleteHelpers/reconstructBuildOrderIds.js.map +1 -1
  18. package/dist/esm/deleteHelpers/removeItems.js +20 -29
  19. package/dist/esm/deleteHelpers/removeItems.js.map +1 -1
  20. package/dist/esm/deleteHelpers/reportProgress.js +3 -6
  21. package/dist/esm/deleteHelpers/reportProgress.js.map +1 -1
  22. package/dist/esm/deleteSolution.js +10 -12
  23. package/dist/esm/deleteSolution.js.map +1 -1
  24. package/dist/esm/dependencies.js +27 -19
  25. package/dist/esm/dependencies.js.map +1 -1
  26. package/dist/esm/featureServiceHelpers.d.ts +6 -0
  27. package/dist/esm/featureServiceHelpers.js +530 -500
  28. package/dist/esm/featureServiceHelpers.js.map +1 -1
  29. package/dist/esm/generalHelpers.js +72 -76
  30. package/dist/esm/generalHelpers.js.map +1 -1
  31. package/dist/esm/get-subscription-info.js +5 -3
  32. package/dist/esm/get-subscription-info.js.map +1 -1
  33. package/dist/esm/getDeletableSolutionInfo.js +6 -10
  34. package/dist/esm/getDeletableSolutionInfo.js.map +1 -1
  35. package/dist/esm/getSolutionSummary.js +15 -19
  36. package/dist/esm/getSolutionSummary.js.map +1 -1
  37. package/dist/esm/index.d.ts +1 -0
  38. package/dist/esm/index.js +1 -0
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/interfaces.d.ts +39 -1
  41. package/dist/esm/interfaces.js +3 -3
  42. package/dist/esm/interfaces.js.map +1 -1
  43. package/dist/esm/libConnectors.js +5 -7
  44. package/dist/esm/libConnectors.js.map +1 -1
  45. package/dist/esm/migrations/apply-schema.js +3 -3
  46. package/dist/esm/migrations/apply-schema.js.map +1 -1
  47. package/dist/esm/migrations/is-legacy-solution.js +2 -2
  48. package/dist/esm/migrations/is-legacy-solution.js.map +1 -1
  49. package/dist/esm/migrations/upgrade-three-dot-one.js +3 -3
  50. package/dist/esm/migrations/upgrade-three-dot-one.js.map +1 -1
  51. package/dist/esm/migrations/upgrade-three-dot-zero.js +1 -1
  52. package/dist/esm/migrations/upgrade-three-dot-zero.js.map +1 -1
  53. package/dist/esm/migrations/upgrade-two-dot-five.js +17 -8
  54. package/dist/esm/migrations/upgrade-two-dot-five.js.map +1 -1
  55. package/dist/esm/migrations/upgrade-two-dot-four.js +12 -12
  56. package/dist/esm/migrations/upgrade-two-dot-four.js.map +1 -1
  57. package/dist/esm/migrations/upgrade-two-dot-one.js +1 -1
  58. package/dist/esm/migrations/upgrade-two-dot-one.js.map +1 -1
  59. package/dist/esm/migrations/upgrade-two-dot-seven.js +1 -1
  60. package/dist/esm/migrations/upgrade-two-dot-seven.js.map +1 -1
  61. package/dist/esm/migrations/upgrade-two-dot-six.js +9 -12
  62. package/dist/esm/migrations/upgrade-two-dot-six.js.map +1 -1
  63. package/dist/esm/migrations/upgrade-two-dot-three.js +3 -3
  64. package/dist/esm/migrations/upgrade-two-dot-three.js.map +1 -1
  65. package/dist/esm/migrations/upgrade-two-dot-two.js +3 -3
  66. package/dist/esm/migrations/upgrade-two-dot-two.js.map +1 -1
  67. package/dist/esm/migrations/upgrade-two-dot-zero.js +8 -9
  68. package/dist/esm/migrations/upgrade-two-dot-zero.js.map +1 -1
  69. package/dist/esm/migrator.js +5 -7
  70. package/dist/esm/migrator.js.map +1 -1
  71. package/dist/esm/polyfills.js +5 -5
  72. package/dist/esm/polyfills.js.map +1 -1
  73. package/dist/esm/resourceHelpers.js +54 -57
  74. package/dist/esm/resourceHelpers.js.map +1 -1
  75. package/dist/esm/resources/add-resource-from-blob.js +2 -2
  76. package/dist/esm/resources/add-resource-from-blob.js.map +1 -1
  77. package/dist/esm/resources/addMetadataFromBlob.js +1 -1
  78. package/dist/esm/resources/addMetadataFromBlob.js.map +1 -1
  79. package/dist/esm/resources/convert-item-resource-to-storage-resource.js +6 -7
  80. package/dist/esm/resources/convert-item-resource-to-storage-resource.js.map +1 -1
  81. package/dist/esm/resources/convert-storage-resource-to-item-resource.js +8 -9
  82. package/dist/esm/resources/convert-storage-resource-to-item-resource.js.map +1 -1
  83. package/dist/esm/resources/copyAssociatedFiles.js +44 -53
  84. package/dist/esm/resources/copyAssociatedFiles.js.map +1 -1
  85. package/dist/esm/resources/copyDataIntoItem.js +5 -11
  86. package/dist/esm/resources/copyDataIntoItem.js.map +1 -1
  87. package/dist/esm/resources/copyMetadataIntoItem.js +4 -10
  88. package/dist/esm/resources/copyMetadataIntoItem.js.map +1 -1
  89. package/dist/esm/resources/copyResourceIntoZip.js +5 -7
  90. package/dist/esm/resources/copyResourceIntoZip.js.map +1 -1
  91. package/dist/esm/resources/copyZipIntoItem.js +5 -9
  92. package/dist/esm/resources/copyZipIntoItem.js.map +1 -1
  93. package/dist/esm/resources/createCopyResults.js +5 -2
  94. package/dist/esm/resources/createCopyResults.js.map +1 -1
  95. package/dist/esm/resources/get-blob.js +7 -5
  96. package/dist/esm/resources/get-blob.js.map +1 -1
  97. package/dist/esm/resources/getItemResourcesFilesFromPaths.js +7 -7
  98. package/dist/esm/resources/getItemResourcesFilesFromPaths.js.map +1 -1
  99. package/dist/esm/resources/getItemResourcesPaths.js +7 -8
  100. package/dist/esm/resources/getItemResourcesPaths.js.map +1 -1
  101. package/dist/esm/resources/transform-resource-paths-to-solution-resources.js +8 -9
  102. package/dist/esm/resources/transform-resource-paths-to-solution-resources.js.map +1 -1
  103. package/dist/esm/restHelpers.d.ts +65 -5
  104. package/dist/esm/restHelpers.js +422 -276
  105. package/dist/esm/restHelpers.js.map +1 -1
  106. package/dist/esm/restHelpersGet.js +102 -111
  107. package/dist/esm/restHelpersGet.js.map +1 -1
  108. package/dist/esm/sharing/share-item-to-groups.d.ts +2 -1
  109. package/dist/esm/sharing/share-item-to-groups.js +12 -6
  110. package/dist/esm/sharing/share-item-to-groups.js.map +1 -1
  111. package/dist/esm/templatization.js +64 -40
  112. package/dist/esm/templatization.js.map +1 -1
  113. package/dist/esm/trackingHelpers.d.ts +116 -0
  114. package/dist/esm/trackingHelpers.js +205 -0
  115. package/dist/esm/trackingHelpers.js.map +1 -0
  116. package/dist/esm/velocityHelpers.d.ts +2 -0
  117. package/dist/esm/velocityHelpers.js +30 -12
  118. package/dist/esm/velocityHelpers.js.map +1 -1
  119. package/dist/esm/workforceHelpers.d.ts +11 -0
  120. package/dist/esm/workforceHelpers.js +208 -180
  121. package/dist/esm/workforceHelpers.js.map +1 -1
  122. package/dist/node/completeItem.js +8 -9
  123. package/dist/node/completeItem.js.map +1 -1
  124. package/dist/node/create-hub-request-options.d.ts +4 -4
  125. package/dist/node/create-hub-request-options.js +11 -14
  126. package/dist/node/create-hub-request-options.js.map +1 -1
  127. package/dist/node/deleteHelpers/deleteEmptyGroups.js +3 -3
  128. package/dist/node/deleteHelpers/deleteEmptyGroups.js.map +1 -1
  129. package/dist/node/deleteHelpers/deleteGroupIfEmpty.js +16 -16
  130. package/dist/node/deleteHelpers/deleteGroupIfEmpty.js.map +1 -1
  131. package/dist/node/deleteHelpers/deleteSolutionContents.js +26 -28
  132. package/dist/node/deleteHelpers/deleteSolutionContents.js.map +1 -1
  133. package/dist/node/deleteHelpers/deleteSolutionFolder.js +11 -11
  134. package/dist/node/deleteHelpers/deleteSolutionFolder.js.map +1 -1
  135. package/dist/node/deleteHelpers/deleteSolutionItem.js +6 -6
  136. package/dist/node/deleteHelpers/deleteSolutionItem.js.map +1 -1
  137. package/dist/node/deleteHelpers/index.js +1 -1
  138. package/dist/node/deleteHelpers/reconstructBuildOrderIds.js +2 -2
  139. package/dist/node/deleteHelpers/reconstructBuildOrderIds.js.map +1 -1
  140. package/dist/node/deleteHelpers/removeItems.js +26 -35
  141. package/dist/node/deleteHelpers/removeItems.js.map +1 -1
  142. package/dist/node/deleteHelpers/reportProgress.js +4 -7
  143. package/dist/node/deleteHelpers/reportProgress.js.map +1 -1
  144. package/dist/node/deleteSolution.js +12 -14
  145. package/dist/node/deleteSolution.js.map +1 -1
  146. package/dist/node/dependencies.js +29 -21
  147. package/dist/node/dependencies.js.map +1 -1
  148. package/dist/node/featureServiceHelpers.d.ts +6 -0
  149. package/dist/node/featureServiceHelpers.js +535 -504
  150. package/dist/node/featureServiceHelpers.js.map +1 -1
  151. package/dist/node/generalHelpers.js +75 -79
  152. package/dist/node/generalHelpers.js.map +1 -1
  153. package/dist/node/get-subscription-info.js +7 -5
  154. package/dist/node/get-subscription-info.js.map +1 -1
  155. package/dist/node/getDeletableSolutionInfo.js +8 -12
  156. package/dist/node/getDeletableSolutionInfo.js.map +1 -1
  157. package/dist/node/getSolutionSummary.js +19 -23
  158. package/dist/node/getSolutionSummary.js.map +1 -1
  159. package/dist/node/index.d.ts +1 -0
  160. package/dist/node/index.js +2 -1
  161. package/dist/node/index.js.map +1 -1
  162. package/dist/node/interfaces.d.ts +39 -1
  163. package/dist/node/interfaces.js.map +1 -1
  164. package/dist/node/libConnectors.js +8 -10
  165. package/dist/node/libConnectors.js.map +1 -1
  166. package/dist/node/migrations/apply-schema.js +4 -4
  167. package/dist/node/migrations/apply-schema.js.map +1 -1
  168. package/dist/node/migrations/is-legacy-solution.js +3 -3
  169. package/dist/node/migrations/is-legacy-solution.js.map +1 -1
  170. package/dist/node/migrations/upgrade-three-dot-one.js +5 -5
  171. package/dist/node/migrations/upgrade-three-dot-one.js.map +1 -1
  172. package/dist/node/migrations/upgrade-three-dot-zero.js +2 -2
  173. package/dist/node/migrations/upgrade-three-dot-zero.js.map +1 -1
  174. package/dist/node/migrations/upgrade-two-dot-five.js +18 -9
  175. package/dist/node/migrations/upgrade-two-dot-five.js.map +1 -1
  176. package/dist/node/migrations/upgrade-two-dot-four.js +13 -13
  177. package/dist/node/migrations/upgrade-two-dot-four.js.map +1 -1
  178. package/dist/node/migrations/upgrade-two-dot-one.js +2 -2
  179. package/dist/node/migrations/upgrade-two-dot-one.js.map +1 -1
  180. package/dist/node/migrations/upgrade-two-dot-seven.js +2 -2
  181. package/dist/node/migrations/upgrade-two-dot-seven.js.map +1 -1
  182. package/dist/node/migrations/upgrade-two-dot-six.js +10 -13
  183. package/dist/node/migrations/upgrade-two-dot-six.js.map +1 -1
  184. package/dist/node/migrations/upgrade-two-dot-three.js +5 -5
  185. package/dist/node/migrations/upgrade-two-dot-three.js.map +1 -1
  186. package/dist/node/migrations/upgrade-two-dot-two.js +5 -5
  187. package/dist/node/migrations/upgrade-two-dot-two.js.map +1 -1
  188. package/dist/node/migrations/upgrade-two-dot-zero.js +9 -10
  189. package/dist/node/migrations/upgrade-two-dot-zero.js.map +1 -1
  190. package/dist/node/migrator.js +16 -18
  191. package/dist/node/migrator.js.map +1 -1
  192. package/dist/node/polyfills.js +5 -5
  193. package/dist/node/polyfills.js.map +1 -1
  194. package/dist/node/resourceHelpers.js +62 -65
  195. package/dist/node/resourceHelpers.js.map +1 -1
  196. package/dist/node/resources/add-resource-from-blob.js +4 -4
  197. package/dist/node/resources/add-resource-from-blob.js.map +1 -1
  198. package/dist/node/resources/addMetadataFromBlob.js +2 -2
  199. package/dist/node/resources/addMetadataFromBlob.js.map +1 -1
  200. package/dist/node/resources/convert-item-resource-to-storage-resource.js +6 -7
  201. package/dist/node/resources/convert-item-resource-to-storage-resource.js.map +1 -1
  202. package/dist/node/resources/convert-storage-resource-to-item-resource.js +9 -10
  203. package/dist/node/resources/convert-storage-resource-to-item-resource.js.map +1 -1
  204. package/dist/node/resources/copyAssociatedFiles.js +52 -61
  205. package/dist/node/resources/copyAssociatedFiles.js.map +1 -1
  206. package/dist/node/resources/copyDataIntoItem.js +9 -15
  207. package/dist/node/resources/copyDataIntoItem.js.map +1 -1
  208. package/dist/node/resources/copyMetadataIntoItem.js +7 -13
  209. package/dist/node/resources/copyMetadataIntoItem.js.map +1 -1
  210. package/dist/node/resources/copyResourceIntoZip.js +7 -9
  211. package/dist/node/resources/copyResourceIntoZip.js.map +1 -1
  212. package/dist/node/resources/copyZipIntoItem.js +8 -12
  213. package/dist/node/resources/copyZipIntoItem.js.map +1 -1
  214. package/dist/node/resources/createCopyResults.js +5 -2
  215. package/dist/node/resources/createCopyResults.js.map +1 -1
  216. package/dist/node/resources/get-blob.js +8 -6
  217. package/dist/node/resources/get-blob.js.map +1 -1
  218. package/dist/node/resources/getItemResourcesFilesFromPaths.js +8 -8
  219. package/dist/node/resources/getItemResourcesFilesFromPaths.js.map +1 -1
  220. package/dist/node/resources/getItemResourcesPaths.js +9 -10
  221. package/dist/node/resources/getItemResourcesPaths.js.map +1 -1
  222. package/dist/node/resources/index.js +1 -1
  223. package/dist/node/resources/transform-resource-paths-to-solution-resources.js +10 -11
  224. package/dist/node/resources/transform-resource-paths-to-solution-resources.js.map +1 -1
  225. package/dist/node/restHelpers.d.ts +65 -5
  226. package/dist/node/restHelpers.js +437 -285
  227. package/dist/node/restHelpers.js.map +1 -1
  228. package/dist/node/restHelpersGet.js +107 -116
  229. package/dist/node/restHelpersGet.js.map +1 -1
  230. package/dist/node/sharing/index.js +1 -1
  231. package/dist/node/sharing/share-item-to-groups.d.ts +2 -1
  232. package/dist/node/sharing/share-item-to-groups.js +13 -7
  233. package/dist/node/sharing/share-item-to-groups.js.map +1 -1
  234. package/dist/node/templatization.js +61 -37
  235. package/dist/node/templatization.js.map +1 -1
  236. package/dist/node/trackingHelpers.d.ts +116 -0
  237. package/dist/node/trackingHelpers.js +217 -0
  238. package/dist/node/trackingHelpers.js.map +1 -0
  239. package/dist/node/velocityHelpers.d.ts +2 -0
  240. package/dist/node/velocityHelpers.js +33 -15
  241. package/dist/node/velocityHelpers.js.map +1 -1
  242. package/dist/node/workforceHelpers.d.ts +11 -0
  243. package/dist/node/workforceHelpers.js +214 -185
  244. package/dist/node/workforceHelpers.js.map +1 -1
  245. package/dist/umd/common.umd.js +14830 -14466
  246. package/dist/umd/common.umd.js.map +1 -1
  247. package/dist/umd/common.umd.min.js +3 -3
  248. package/dist/umd/common.umd.min.js.map +1 -1
  249. package/dist/umd/create-hub-request-options.d.ts +4 -4
  250. package/dist/umd/featureServiceHelpers.d.ts +6 -0
  251. package/dist/umd/index.d.ts +1 -0
  252. package/dist/umd/interfaces.d.ts +39 -1
  253. package/dist/umd/restHelpers.d.ts +65 -5
  254. package/dist/umd/sharing/share-item-to-groups.d.ts +2 -1
  255. package/dist/umd/trackingHelpers.d.ts +116 -0
  256. package/dist/umd/velocityHelpers.d.ts +2 -0
  257. package/dist/umd/workforceHelpers.d.ts +11 -0
  258. package/package.json +24 -24
@@ -16,7 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.shareItemToGroups = void 0;
19
- var arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
19
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
20
20
  /**
21
21
  * Share an item to one or more groups
22
22
  * Returns a promise for all the sharing calls
@@ -24,14 +24,20 @@ var arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
24
24
  * @param groups Array of Group Ids
25
25
  * @param itemId Item Id
26
26
  * @param authentication UserSession
27
+ * @param owner owner of the group when sharing tracking items (can be different from the deploying user)
27
28
  */
28
- function shareItemToGroups(groupIds, itemId, authentication) {
29
- return Promise.all(groupIds.map(function (groupId) {
30
- return (0, arcgis_rest_portal_1.shareItemWithGroup)({
29
+ function shareItemToGroups(groupIds, itemId, authentication, owner) {
30
+ return Promise.all(groupIds.map(groupId => {
31
+ const requestOptions = {
31
32
  id: itemId,
32
- groupId: groupId,
33
- authentication: authentication
34
- });
33
+ groupId,
34
+ authentication
35
+ };
36
+ /* istanbul ignore else */
37
+ if (owner) {
38
+ requestOptions.owner = owner;
39
+ }
40
+ return (0, arcgis_rest_portal_1.shareItemWithGroup)(requestOptions);
35
41
  }));
36
42
  }
37
43
  exports.shareItemToGroups = shareItemToGroups;
@@ -1 +1 @@
1
- {"version":3,"file":"share-item-to-groups.js","sourceRoot":"","sources":["../../../src/sharing/share-item-to-groups.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,+DAA8D;AAE9D;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,QAAkB,EAClB,MAAc,EACd,cAA2B;IAE3B,OAAO,OAAO,CAAC,GAAG,CAChB,QAAQ,CAAC,GAAG,CAAC,UAAA,OAAO;QAClB,OAAO,IAAA,uCAAkB,EAAC;YACxB,EAAE,EAAE,MAAM;YACV,OAAO,SAAA;YACP,cAAc,gBAAA;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAdD,8CAcC"}
1
+ {"version":3,"file":"share-item-to-groups.js","sourceRoot":"","sources":["../../../src/sharing/share-item-to-groups.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,iEAAoF;AAEpF;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,QAAkB,EAClB,MAAc,EACd,cAA2B,EAC3B,KAAc;IAEd,OAAO,OAAO,CAAC,GAAG,CAChB,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACrB,MAAM,cAAc,GAAyB;YAC3C,EAAE,EAAE,MAAM;YACV,OAAO;YACP,cAAc;SACf,CAAC;QACF,0BAA0B;QAC1B,IAAI,KAAK,EAAE;YACT,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;SAC9B;QACD,OAAO,IAAA,uCAAkB,EAAC,cAAc,CAAC,CAAC;IAC5C,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AApBD,8CAoBC"}
@@ -16,15 +16,14 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.templatizeIds = exports.templatizeFieldReferences = exports.templatizeToLowerCase = exports.templatizeTerm = exports.replaceTemplate = exports.replaceInTemplate = exports.removeTemplate = exports.getDefaultExtent = exports.getIdsInTemplatesList = exports.hasUnresolvedVariables = exports.findTemplateInList = exports.findTemplateIndexInList = exports.extractSolutionVersion = exports.createPlaceholderTemplate = exports.createInitializedItemTemplate = exports.createInitializedGroupTemplate = exports.placeholder = exports.TRANSFORMS = exports.PRINT_SERVER_NAME = exports.NA_SERVER_NAME = exports.GEOCODE_SERVER_NAME = exports.GEOMETRY_SERVER_NAME = exports.SERVER_NAME = void 0;
19
- var tslib_1 = require("tslib");
20
19
  /**
21
20
  * Provides common functions involving the adlib library.
22
21
  *
23
22
  * @module templatization
24
23
  */
25
- var hub_common_1 = require("@esri/hub-common");
26
- var adlib_1 = require("adlib");
27
- var generalHelpers_1 = require("./generalHelpers");
24
+ const hub_common_1 = require("@esri/hub-common");
25
+ const adlib_1 = require("adlib");
26
+ const generalHelpers_1 = require("./generalHelpers");
28
27
  // ------------------------------------------------------------------------------------------------------------------ //
29
28
  /**
30
29
  * A parameterized server name to replace the organization URL in a Web Mapping Application's URL to
@@ -59,10 +58,10 @@ exports.NA_SERVER_NAME = "organization.helperServices.route.url";
59
58
  */
60
59
  exports.PRINT_SERVER_NAME = "organization.helperServices.printTask.url";
61
60
  exports.TRANSFORMS = {
62
- getDefaultLocatorURL: function (key, val) {
61
+ getDefaultLocatorURL(key, val) {
63
62
  // get the url from the template dictionary or return the default template variable when it's not present
64
63
  // this fallback is needed when we detemplatize living atlas layers as a part of the create process
65
- return val ? val[0].url : "{{" + exports.GEOCODE_SERVER_NAME + "}}";
64
+ return val ? val[0].url : `{{${exports.GEOCODE_SERVER_NAME}}}`;
66
65
  }
67
66
  };
68
67
  /**
@@ -76,14 +75,42 @@ function placeholder(term) {
76
75
  }
77
76
  exports.placeholder = placeholder;
78
77
  function createInitializedGroupTemplate(itemInfo) {
79
- var itemTemplate = createPlaceholderTemplate(itemInfo.id, itemInfo.type);
80
- itemTemplate.item = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, itemTemplate.item), { description: itemInfo.description, snippet: itemInfo.snippet, tags: itemInfo.tags, title: itemInfo.title, thumbnail: itemInfo.thumbnail });
78
+ const itemTemplate = createPlaceholderTemplate(itemInfo.id, itemInfo.type);
79
+ itemTemplate.item = {
80
+ ...itemTemplate.item,
81
+ description: itemInfo.description,
82
+ snippet: itemInfo.snippet,
83
+ tags: itemInfo.tags,
84
+ title: itemInfo.title,
85
+ thumbnail: itemInfo.thumbnail
86
+ };
81
87
  return itemTemplate;
82
88
  }
83
89
  exports.createInitializedGroupTemplate = createInitializedGroupTemplate;
84
90
  function createInitializedItemTemplate(itemInfo) {
85
- var itemTemplate = createPlaceholderTemplate(itemInfo.id, itemInfo.type);
86
- itemTemplate.item = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, itemTemplate.item), { accessInformation: itemInfo.accessInformation, categories: itemInfo.categories, contentStatus: itemInfo.contentStatus, culture: itemInfo.culture, description: itemInfo.description, extent: getDefaultExtent(itemInfo), licenseInfo: itemInfo.licenseInfo, name: itemInfo.name, origUrl: itemInfo.origUrl, properties: itemInfo.properties, snippet: itemInfo.snippet, spatialReference: undefined, tags: itemInfo.tags, thumbnail: itemInfo.thumbnail, title: itemInfo.title, typeKeywords: itemInfo.typeKeywords, url: itemInfo.url });
91
+ const itemTemplate = createPlaceholderTemplate(itemInfo.id, itemInfo.type);
92
+ itemTemplate.item = {
93
+ ...itemTemplate.item,
94
+ accessInformation: itemInfo.accessInformation,
95
+ categories: itemInfo.categories,
96
+ contentStatus: itemInfo.contentStatus,
97
+ created: itemInfo.created,
98
+ culture: itemInfo.culture,
99
+ description: itemInfo.description,
100
+ extent: getDefaultExtent(itemInfo),
101
+ licenseInfo: itemInfo.licenseInfo,
102
+ modified: itemInfo.modified,
103
+ name: itemInfo.name,
104
+ origUrl: itemInfo.origUrl,
105
+ properties: itemInfo.properties,
106
+ snippet: itemInfo.snippet,
107
+ spatialReference: undefined,
108
+ tags: itemInfo.tags,
109
+ thumbnail: itemInfo.thumbnail,
110
+ title: itemInfo.title,
111
+ typeKeywords: itemInfo.typeKeywords,
112
+ url: itemInfo.url
113
+ };
87
114
  return itemTemplate;
88
115
  }
89
116
  exports.createInitializedItemTemplate = createInitializedItemTemplate;
@@ -94,15 +121,14 @@ exports.createInitializedItemTemplate = createInitializedItemTemplate;
94
121
  * @param type AGO item type; defaults to ""
95
122
  * @return Empty template containing supplied id, optional type, and a key created using the function createShortId()
96
123
  */
97
- function createPlaceholderTemplate(id, type) {
98
- if (type === void 0) { type = ""; }
124
+ function createPlaceholderTemplate(id, type = "") {
99
125
  return {
100
126
  itemId: id,
101
- type: type,
127
+ type,
102
128
  key: (0, generalHelpers_1.createShortId)(),
103
129
  item: {
104
- id: id,
105
- type: type
130
+ id,
131
+ type
106
132
  },
107
133
  data: {},
108
134
  resources: [],
@@ -120,7 +146,7 @@ exports.createPlaceholderTemplate = createPlaceholderTemplate;
120
146
  * @return Zero-based version number
121
147
  */
122
148
  function extractSolutionVersion(itemData) {
123
- var version = (0, generalHelpers_1.getProp)(itemData, "metadata.version");
149
+ let version = (0, generalHelpers_1.getProp)(itemData, "metadata.version");
124
150
  if (!version) {
125
151
  return 0;
126
152
  }
@@ -140,8 +166,8 @@ exports.extractSolutionVersion = extractSolutionVersion;
140
166
  * @protected
141
167
  */
142
168
  function findTemplateIndexInList(templates, id) {
143
- var baseId = id;
144
- return templates.findIndex(function (template) {
169
+ const baseId = id;
170
+ return templates.findIndex(template => {
145
171
  return baseId === template.itemId;
146
172
  });
147
173
  }
@@ -154,23 +180,23 @@ exports.findTemplateIndexInList = findTemplateIndexInList;
154
180
  * @return Matching template or null
155
181
  */
156
182
  function findTemplateInList(templates, id) {
157
- var iTemplate = findTemplateIndexInList(templates, id);
183
+ const iTemplate = findTemplateIndexInList(templates, id);
158
184
  return iTemplate >= 0 ? templates[iTemplate] : null;
159
185
  }
160
186
  exports.findTemplateInList = findTemplateInList;
161
187
  function hasUnresolvedVariables(data) {
162
- var getUnresolved = function (v) {
188
+ const getUnresolved = (v) => {
163
189
  return v ? JSON.stringify(v).match(/{{.+?}}/gim) || [] : [];
164
190
  };
165
191
  return getUnresolved(data).length > 0;
166
192
  }
167
193
  exports.hasUnresolvedVariables = hasUnresolvedVariables;
168
194
  function getIdsInTemplatesList(templates) {
169
- return templates.map(function (template) { return template.itemId; });
195
+ return templates.map(template => template.itemId);
170
196
  }
171
197
  exports.getIdsInTemplatesList = getIdsInTemplatesList;
172
198
  function getDefaultExtent(itemInfo) {
173
- var ext = itemInfo.extent;
199
+ const ext = itemInfo.extent;
174
200
  return ext === null || (Array.isArray(ext) && ext.length === 0)
175
201
  ? ext
176
202
  : "{{solutionItemExtent}}";
@@ -184,7 +210,7 @@ exports.getDefaultExtent = getDefaultExtent;
184
210
  * @protected
185
211
  */
186
212
  function removeTemplate(templates, id) {
187
- var i = findTemplateIndexInList(templates, id);
213
+ const i = findTemplateIndexInList(templates, id);
188
214
  if (i >= 0) {
189
215
  templates.splice(i, 1);
190
216
  }
@@ -211,7 +237,7 @@ exports.replaceInTemplate = replaceInTemplate;
211
237
  * @protected
212
238
  */
213
239
  function replaceTemplate(templates, id, template) {
214
- var i = findTemplateIndexInList(templates, id);
240
+ const i = findTemplateIndexInList(templates, id);
215
241
  if (i >= 0) {
216
242
  templates[i] = template;
217
243
  return true;
@@ -219,12 +245,11 @@ function replaceTemplate(templates, id, template) {
219
245
  return false;
220
246
  }
221
247
  exports.replaceTemplate = replaceTemplate;
222
- function templatizeTerm(context, term, suffix) {
223
- if (suffix === void 0) { suffix = ""; }
248
+ function templatizeTerm(context, term, suffix = "") {
224
249
  if (!context) {
225
250
  return context;
226
251
  }
227
- var pattern = new RegExp(term, "g");
252
+ const pattern = new RegExp(term, "g");
228
253
  return context.replace(pattern, "{{" + term + suffix + "}}");
229
254
  }
230
255
  exports.templatizeTerm = templatizeTerm;
@@ -253,11 +278,10 @@ exports.templatizeToLowerCase = templatizeToLowerCase;
253
278
  * "{NAME}"
254
279
  * "(NAME = value AND NAME2 = someOtherValue)"
255
280
  */
256
- function templatizeFieldReferences(obj, fields, basePath, templatizeKeys) {
257
- if (templatizeKeys === void 0) { templatizeKeys = false; }
258
- var objString = JSON.stringify(obj);
259
- fields.forEach(function (field) {
260
- var expression = "\\b" + field.name + "\\b(?![.])(?![}]{2})";
281
+ function templatizeFieldReferences(obj, fields, basePath, templatizeKeys = false) {
282
+ let objString = JSON.stringify(obj);
283
+ fields.forEach(field => {
284
+ let expression = "\\b" + field.name + "\\b(?![.])(?![}]{2})";
261
285
  if (!templatizeKeys) {
262
286
  expression += '(?!":)';
263
287
  }
@@ -271,14 +295,14 @@ function templatizeFieldReferences(obj, fields, basePath, templatizeKeys) {
271
295
  exports.templatizeFieldReferences = templatizeFieldReferences;
272
296
  function templatizeIds(obj) {
273
297
  // Convert object to string
274
- var objString = JSON.stringify(obj);
298
+ let objString = JSON.stringify(obj);
275
299
  // Find ids
276
- var idTest = /[0-9A-F]{32}/gim;
300
+ const idTest = /[0-9A-F]{32}/gim;
277
301
  if (obj && idTest.test(objString)) {
278
302
  // Templatize ids
279
- var ids = objString.match(idTest).filter(hub_common_1.unique);
280
- ids.forEach(function (id) {
281
- var regEx = new RegExp(id, "gm");
303
+ const ids = objString.match(idTest).filter(hub_common_1.unique);
304
+ ids.forEach(id => {
305
+ const regEx = new RegExp(id, "gm");
282
306
  objString = objString.replace(regEx, "{{" + id + ".itemId}}");
283
307
  });
284
308
  obj = JSON.parse(objString);
@@ -1 +1 @@
1
- {"version":3,"file":"templatization.js","sourceRoot":"","sources":["../../src/templatization.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,+CAA0C;AAC1C,+BAA8B;AAC9B,mDAA0D;AAG1D,wHAAwH;AAExH;;;;;;GAMG;AACU,QAAA,WAAW,GAAW,eAAe,CAAC;AAEnD;;;;GAIG;AACU,QAAA,oBAAoB,GAC/B,0CAA0C,CAAC;AAE7C;;;;GAIG;AACU,QAAA,mBAAmB,GAC9B,0DAA0D,CAAC;AAE7D;;;;GAIG;AACU,QAAA,cAAc,GAAW,uCAAuC,CAAC;AAE9E;;;;GAIG;AACU,QAAA,iBAAiB,GAC5B,2CAA2C,CAAC;AAEjC,QAAA,UAAU,GAAQ;IAC7B,oBAAoB,EAApB,UAAqB,GAAW,EAAE,GAAQ;QACxC,yGAAyG;QACzG,mGAAmG;QACnG,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAK,2BAAmB,OAAI,CAAC;IACzD,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5B,CAAC;AAFD,kCAEC;AAED,SAAgB,8BAA8B,CAAC,QAAa;IAC1D,IAAM,YAAY,GAAG,yBAAyB,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3E,YAAY,CAAC,IAAI,mDACZ,YAAY,CAAC,IAAI,KACpB,WAAW,EAAE,QAAQ,CAAC,WAAW,EACjC,OAAO,EAAE,QAAQ,CAAC,OAAO,EACz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,aAAa,CAAC,GAAQ;IACpC,2BAA2B;IAC3B,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAEpC,WAAW;IACX,MAAM,MAAM,GAAW,iBAAiB,CAAC;IACzC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QACjC,iBAAiB;QACjB,MAAM,GAAG,GAAa,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,mBAAM,CAAC,CAAC;QAC7D,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;YACf,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACnC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,GAAG,WAAW,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;KAC7B;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAhBD,sCAgBC"}
@@ -0,0 +1,116 @@
1
+ /** @license
2
+ * Copyright 2021 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { IItemTemplate, UserSession } from "./interfaces";
17
+ import { IItemUpdate } from "@esri/arcgis-rest-types";
18
+ import { ICreateServiceParams } from "@esri/arcgis-rest-service-admin";
19
+ /**
20
+ * Used by deploy to evaluate if we have everything we need to deploy tracking views.
21
+ *
22
+ * This function will update the input templateDictionary with a boolean
23
+ * indicating if tracking is enabled on the org and the user is an admin.
24
+ *
25
+ * @param portalResponse portal self response
26
+ * @param userResponse portal user response
27
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
28
+ * @param templates the list of IItemTemplates from the solution
29
+ *
30
+ * @protected
31
+ */
32
+ export declare function setLocationTrackingEnabled(portalResponse: any, userResponse: any, templateDictionary: any, templates?: IItemTemplate[]): void;
33
+ /**
34
+ * Used by deploy to evaluate if we have everything we need to deploy tracking views.
35
+ *
36
+ * An error is thrown to prevent additional deployment work if we have Tracking items and tracking is
37
+ * not enabled or the deployment user is not an admin in the organization.
38
+ *
39
+ * @param templates the list of IItemTemplates from the solution
40
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
41
+ *
42
+ * @protected
43
+ */
44
+ export declare function _validateTrackingTemplates(templates: IItemTemplate[], templateDictionary: any): void;
45
+ /**
46
+ * Used by deploy to determine the owner of the tracking service.
47
+ * Only one tracking service per org and all tracking views and tracking groups must be owned by the tracking service owner.
48
+ *
49
+ * This function will update the input templateDictionary with the owner as well as
50
+ * the item id for the source tracking service.
51
+ *
52
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
53
+ * @param authentication Credentials for the requests
54
+ *
55
+ * @protected
56
+ */
57
+ export declare function getTackingServiceOwner(templateDictionary: any, authentication: UserSession): Promise<boolean>;
58
+ /**
59
+ * Check key properties to understand if we are dealing with a tracking template
60
+ *
61
+ * @param itemTemplate the template to evaluate
62
+ * @param itemUpdate the item update to evaluate
63
+ *
64
+ * @protected
65
+ */
66
+ export declare function isTrackingViewTemplate(itemTemplate?: IItemTemplate, itemUpdate?: IItemUpdate): boolean;
67
+ /**
68
+ * Check key properties to understand if we are dealing with a tracking group template
69
+ *
70
+ * @param itemTemplate the template to evaluate
71
+ *
72
+ * @protected
73
+ */
74
+ export declare function isTrackingViewGroup(itemTemplate: IItemTemplate): boolean;
75
+ /**
76
+ * Templatize the tracker view group id and view name for location tracking views.
77
+ * This function will update the itemTemplate that is passed in when it's a tracking view.
78
+ *
79
+ * @param itemTemplate Template for feature service item
80
+ *
81
+ * @protected
82
+ */
83
+ export declare function templatizeTracker(itemTemplate: IItemTemplate): void;
84
+ /**
85
+ * Templatize the tracker view group id and view name for location tracking views.
86
+ * This function will update the itemTemplate that is passed in when it's a tracking view.
87
+ *
88
+ * @param itemTemplate Template for the tracker view
89
+ * @param path the path to the property that stores the current name
90
+ * @param groupId the id of the associated tracker group
91
+ * @param groupIdVar the variable to replace the existing name with
92
+ *
93
+ * @protected
94
+ */
95
+ export declare function _setName(itemTemplate: IItemTemplate, path: string, groupId: string, groupIdVar: string): void;
96
+ /**
97
+ * Templatize the tracker view serviceItemId
98
+ *
99
+ * This function will update the input obj with the templatized variable
100
+ *
101
+ * @param obj the object that stores the serviceItemId
102
+ * @param path the path to the property that stores the serviceItemId
103
+ *
104
+ * @protected
105
+ */
106
+ export declare function templatizeServiceItemId(obj: any, path: string): void;
107
+ /**
108
+ * Used by deploy to update the request options with key details for deploying tracker views
109
+ *
110
+ * @param itemTemplate Template for feature service item
111
+ * @param options the current request options to update
112
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
113
+ *
114
+ * @protected
115
+ */
116
+ export declare function setTrackingOptions(itemTemplate: IItemTemplate, options: any, templateDictionary: any): ICreateServiceParams;
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2021 Esri
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.setTrackingOptions = exports.templatizeServiceItemId = exports._setName = exports.templatizeTracker = exports.isTrackingViewGroup = exports.isTrackingViewTemplate = exports.getTackingServiceOwner = exports._validateTrackingTemplates = exports.setLocationTrackingEnabled = void 0;
19
+ const generalHelpers_1 = require("./generalHelpers");
20
+ const restHelpersGet_1 = require("./restHelpersGet");
21
+ const templatization_1 = require("./templatization");
22
+ /**
23
+ * Used by deploy to evaluate if we have everything we need to deploy tracking views.
24
+ *
25
+ * This function will update the input templateDictionary with a boolean
26
+ * indicating if tracking is enabled on the org and the user is an admin.
27
+ *
28
+ * @param portalResponse portal self response
29
+ * @param userResponse portal user response
30
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
31
+ * @param templates the list of IItemTemplates from the solution
32
+ *
33
+ * @protected
34
+ */
35
+ function setLocationTrackingEnabled(portalResponse, userResponse, templateDictionary, templates) {
36
+ // set locationTracking...contains service url and id
37
+ const locationTracking = (0, generalHelpers_1.getProp)(portalResponse, "helperServices.locationTracking");
38
+ /* istanbul ignore else */
39
+ if (locationTracking) {
40
+ templateDictionary.locationTracking = locationTracking;
41
+ }
42
+ // verify we have location tracking service and the user is an admin
43
+ templateDictionary.locationTrackingEnabled =
44
+ templateDictionary.locationTracking &&
45
+ (0, generalHelpers_1.getProp)(userResponse, "role") === "org_admin"
46
+ ? true
47
+ : false;
48
+ if (templates) {
49
+ _validateTrackingTemplates(templates, templateDictionary);
50
+ }
51
+ }
52
+ exports.setLocationTrackingEnabled = setLocationTrackingEnabled;
53
+ /**
54
+ * Used by deploy to evaluate if we have everything we need to deploy tracking views.
55
+ *
56
+ * An error is thrown to prevent additional deployment work if we have Tracking items and tracking is
57
+ * not enabled or the deployment user is not an admin in the organization.
58
+ *
59
+ * @param templates the list of IItemTemplates from the solution
60
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
61
+ *
62
+ * @protected
63
+ */
64
+ function _validateTrackingTemplates(templates, templateDictionary) {
65
+ /* istanbul ignore else */
66
+ if (!templateDictionary.locationTrackingEnabled &&
67
+ templates.some(template => {
68
+ const typeKeywords = (0, generalHelpers_1.getProp)(template, "item.typeKeywords") || [];
69
+ return typeKeywords.indexOf("Location Tracking View") > -1;
70
+ })) {
71
+ console.error("Location tracking not enabled or user is not admin.");
72
+ throw new Error("Location tracking not enabled or user is not admin.");
73
+ }
74
+ }
75
+ exports._validateTrackingTemplates = _validateTrackingTemplates;
76
+ /**
77
+ * Used by deploy to determine the owner of the tracking service.
78
+ * Only one tracking service per org and all tracking views and tracking groups must be owned by the tracking service owner.
79
+ *
80
+ * This function will update the input templateDictionary with the owner as well as
81
+ * the item id for the source tracking service.
82
+ *
83
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
84
+ * @param authentication Credentials for the requests
85
+ *
86
+ * @protected
87
+ */
88
+ function getTackingServiceOwner(templateDictionary, authentication) {
89
+ if (templateDictionary.locationTrackingEnabled) {
90
+ const locationTrackingId = templateDictionary.locationTracking.id;
91
+ return (0, restHelpersGet_1.getItemBase)(locationTrackingId, authentication).then(itemBase => {
92
+ templateDictionary.locationTracking.owner = itemBase.owner;
93
+ templateDictionary[itemBase.id] = {
94
+ itemId: itemBase.id
95
+ };
96
+ return Promise.resolve(itemBase && itemBase.owner === authentication.username);
97
+ }, () => Promise.resolve(false));
98
+ }
99
+ else {
100
+ return Promise.resolve(false);
101
+ }
102
+ }
103
+ exports.getTackingServiceOwner = getTackingServiceOwner;
104
+ /**
105
+ * Check key properties to understand if we are dealing with a tracking template
106
+ *
107
+ * @param itemTemplate the template to evaluate
108
+ * @param itemUpdate the item update to evaluate
109
+ *
110
+ * @protected
111
+ */
112
+ function isTrackingViewTemplate(itemTemplate, itemUpdate) {
113
+ const typeKeywords = (0, generalHelpers_1.getProp)(itemTemplate, "item.typeKeywords") ||
114
+ (0, generalHelpers_1.getProp)(itemUpdate, "typeKeywords");
115
+ const trackViewGroup = (0, generalHelpers_1.getProp)(itemTemplate, "item.properties.trackViewGroup") ||
116
+ (0, generalHelpers_1.getProp)(itemUpdate, "properties.trackViewGroup");
117
+ return (typeKeywords && typeKeywords.indexOf("Location Tracking View") > -1 && trackViewGroup) ? true : false;
118
+ }
119
+ exports.isTrackingViewTemplate = isTrackingViewTemplate;
120
+ /**
121
+ * Check key properties to understand if we are dealing with a tracking group template
122
+ *
123
+ * @param itemTemplate the template to evaluate
124
+ *
125
+ * @protected
126
+ */
127
+ function isTrackingViewGroup(itemTemplate) {
128
+ const typeKeywords = (0, generalHelpers_1.getProp)(itemTemplate, "item.tags");
129
+ return (typeKeywords && typeKeywords.indexOf("Location Tracking Group") > -1) ? true : false;
130
+ }
131
+ exports.isTrackingViewGroup = isTrackingViewGroup;
132
+ /**
133
+ * Templatize the tracker view group id and view name for location tracking views.
134
+ * This function will update the itemTemplate that is passed in when it's a tracking view.
135
+ *
136
+ * @param itemTemplate Template for feature service item
137
+ *
138
+ * @protected
139
+ */
140
+ function templatizeTracker(itemTemplate) {
141
+ /* istanbul ignore else */
142
+ if (isTrackingViewTemplate(itemTemplate)) {
143
+ const trackViewGroup = (0, generalHelpers_1.getProp)(itemTemplate, "item.properties.trackViewGroup");
144
+ itemTemplate.groups.push(trackViewGroup);
145
+ itemTemplate.dependencies.push(trackViewGroup);
146
+ const groupIdVar = (0, templatization_1.templatizeTerm)(trackViewGroup, trackViewGroup, ".itemId");
147
+ (0, generalHelpers_1.setProp)(itemTemplate, "item.properties.trackViewGroup", groupIdVar);
148
+ _setName(itemTemplate, "item.name", trackViewGroup, groupIdVar);
149
+ _setName(itemTemplate, "properties.service.adminServiceInfo.name", trackViewGroup, groupIdVar);
150
+ const layersAndTables = (itemTemplate.properties.layers || []).concat(itemTemplate.properties.tables || []);
151
+ layersAndTables.forEach(l => {
152
+ templatizeServiceItemId(l, "adminLayerInfo.viewLayerDefinition.sourceServiceItemId");
153
+ });
154
+ }
155
+ }
156
+ exports.templatizeTracker = templatizeTracker;
157
+ /**
158
+ * Templatize the tracker view group id and view name for location tracking views.
159
+ * This function will update the itemTemplate that is passed in when it's a tracking view.
160
+ *
161
+ * @param itemTemplate Template for the tracker view
162
+ * @param path the path to the property that stores the current name
163
+ * @param groupId the id of the associated tracker group
164
+ * @param groupIdVar the variable to replace the existing name with
165
+ *
166
+ * @protected
167
+ */
168
+ function _setName(itemTemplate, path, groupId, groupIdVar) {
169
+ const name = (0, generalHelpers_1.getProp)(itemTemplate, path);
170
+ /* istanbul ignore else */
171
+ if (name) {
172
+ (0, generalHelpers_1.setProp)(itemTemplate, path, name.replace(groupId, groupIdVar));
173
+ }
174
+ }
175
+ exports._setName = _setName;
176
+ /**
177
+ * Templatize the tracker view serviceItemId
178
+ *
179
+ * This function will update the input obj with the templatized variable
180
+ *
181
+ * @param obj the object that stores the serviceItemId
182
+ * @param path the path to the property that stores the serviceItemId
183
+ *
184
+ * @protected
185
+ */
186
+ function templatizeServiceItemId(obj, path) {
187
+ const serviceItemId = (0, generalHelpers_1.getProp)(obj, path);
188
+ /* istanbul ignore else */
189
+ if (serviceItemId) {
190
+ (0, generalHelpers_1.setProp)(obj, path, (0, templatization_1.templatizeTerm)(serviceItemId, serviceItemId, ".itemId"));
191
+ }
192
+ }
193
+ exports.templatizeServiceItemId = templatizeServiceItemId;
194
+ /**
195
+ * Used by deploy to update the request options with key details for deploying tracker views
196
+ *
197
+ * @param itemTemplate Template for feature service item
198
+ * @param options the current request options to update
199
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
200
+ *
201
+ * @protected
202
+ */
203
+ function setTrackingOptions(itemTemplate, options, templateDictionary) {
204
+ /* istanbul ignore else */
205
+ if (isTrackingViewTemplate(itemTemplate)) {
206
+ (0, generalHelpers_1.setCreateProp)(options, "owner", templateDictionary.locationTracking.owner);
207
+ (0, generalHelpers_1.setCreateProp)(options.item, "name", itemTemplate.item.name);
208
+ (0, generalHelpers_1.setCreateProp)(options.item, "isView", true);
209
+ (0, generalHelpers_1.setCreateProp)(options.item, "owner", templateDictionary.locationTracking.owner);
210
+ (0, generalHelpers_1.setCreateProp)(options.params, "isView", true);
211
+ (0, generalHelpers_1.setCreateProp)(options.params, "outputType", "locationTrackingService");
212
+ delete (options.folderId);
213
+ }
214
+ return options.item;
215
+ }
216
+ exports.setTrackingOptions = setTrackingOptions;
217
+ //# sourceMappingURL=trackingHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackingHelpers.js","sourceRoot":"","sources":["../../src/trackingHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,qDAAmE;AACnE,qDAA+C;AAC/C,qDAAkD;AAIlD;;;;;;;;;;;;GAYG;AACH,SAAgB,0BAA0B,CACxC,cAAmB,EACnB,YAAiB,EACjB,kBAAuB,EACvB,SAA2B;IAE3B,qDAAqD;IACrD,MAAM,gBAAgB,GAAG,IAAA,wBAAO,EAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC;IACpF,0BAA0B;IAC1B,IAAI,gBAAgB,EAAE;QACpB,kBAAkB,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KACxD;IAED,oEAAoE;IACpE,kBAAkB,CAAC,uBAAuB;QACxC,kBAAkB,CAAC,gBAAgB;YACnC,IAAA,wBAAO,EAAC,YAAY,EAAE,MAAM,CAAC,KAAK,WAAW;YAC3C,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,KAAK,CAAC;IAEV,IAAI,SAAS,EAAE;QACb,0BAA0B,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;KAC3D;AACL,CAAC;AAvBD,gEAuBC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,0BAA0B,CACxC,SAA0B,EAC1B,kBAAuB;IAEvB,0BAA0B;IAC1B,IACE,CAAC,kBAAkB,CAAC,uBAAuB;QAC3C,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACxB,MAAM,YAAY,GAChB,IAAA,wBAAO,EAAC,QAAQ,EAAE,mBAAmB,CAAC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I,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAA,8BAAa,EAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAA,8BAAa,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAEhF,IAAA,8BAAa,EAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC9C,IAAA,8BAAa,EAAC,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,yBAAyB,CAAC,CAAC;QAEvE,OAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC1B;IACD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAnBD,gDAmBC"}
@@ -14,6 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { UserSession } from "./interfaces";
17
+ export declare const BASE_NAMES: string[];
18
+ export declare const PROP_NAMES: string[];
17
19
  /**
18
20
  * Get the base velocity url from the current orgs subscription info
19
21
  *