@esri/solution-common 6.1.3 → 6.1.5

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 (404) hide show
  1. package/dist/cjs/arcgisRestJS.d.ts +63 -0
  2. package/dist/cjs/arcgisRestJS.js +158 -0
  3. package/dist/cjs/arcgisRestJS.js.map +1 -0
  4. package/dist/cjs/completeItem.d.ts +30 -0
  5. package/dist/cjs/completeItem.js +72 -0
  6. package/dist/cjs/completeItem.js.map +1 -0
  7. package/dist/cjs/create-hub-request-options.d.ts +29 -0
  8. package/dist/cjs/create-hub-request-options.js +64 -0
  9. package/dist/cjs/create-hub-request-options.js.map +1 -0
  10. package/dist/cjs/deleteHelpers/deleteEmptyGroups.d.ts +24 -0
  11. package/dist/cjs/deleteHelpers/deleteEmptyGroups.js +42 -0
  12. package/dist/cjs/deleteHelpers/deleteEmptyGroups.js.map +1 -0
  13. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.d.ts +27 -0
  14. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js +99 -0
  15. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js.map +1 -0
  16. package/dist/cjs/deleteHelpers/deleteSolutionContents.d.ts +39 -0
  17. package/dist/cjs/deleteHelpers/deleteSolutionContents.js +127 -0
  18. package/dist/cjs/deleteHelpers/deleteSolutionContents.js.map +1 -0
  19. package/dist/cjs/deleteHelpers/deleteSolutionFolder.d.ts +29 -0
  20. package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +81 -0
  21. package/dist/cjs/deleteHelpers/deleteSolutionFolder.js.map +1 -0
  22. package/dist/cjs/deleteHelpers/deleteSolutionItem.d.ts +31 -0
  23. package/dist/cjs/deleteHelpers/deleteSolutionItem.js +52 -0
  24. package/dist/cjs/deleteHelpers/deleteSolutionItem.js.map +1 -0
  25. package/dist/cjs/deleteHelpers/index.d.ts +22 -0
  26. package/dist/cjs/deleteHelpers/index.js +26 -0
  27. package/dist/cjs/deleteHelpers/index.js.map +1 -0
  28. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.d.ts +27 -0
  29. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js +34 -0
  30. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js.map +1 -0
  31. package/dist/cjs/deleteHelpers/removeItems.d.ts +35 -0
  32. package/dist/cjs/deleteHelpers/removeItems.js +116 -0
  33. package/dist/cjs/deleteHelpers/removeItems.js.map +1 -0
  34. package/dist/cjs/deleteHelpers/reportProgress.d.ts +27 -0
  35. package/dist/cjs/deleteHelpers/reportProgress.js +46 -0
  36. package/dist/cjs/deleteHelpers/reportProgress.js.map +1 -0
  37. package/dist/cjs/deleteSolution.d.ts +56 -0
  38. package/dist/cjs/deleteSolution.js +107 -0
  39. package/dist/cjs/deleteSolution.js.map +1 -0
  40. package/dist/cjs/dependencies.d.ts +26 -0
  41. package/dist/cjs/dependencies.js +171 -0
  42. package/dist/cjs/dependencies.js.map +1 -0
  43. package/dist/cjs/featureServiceHelpers.d.ts +847 -0
  44. package/dist/cjs/featureServiceHelpers.js +2553 -0
  45. package/dist/cjs/featureServiceHelpers.js.map +1 -0
  46. package/dist/cjs/formHelpers.d.ts +26 -0
  47. package/dist/cjs/formHelpers.js +40 -0
  48. package/dist/cjs/formHelpers.js.map +1 -0
  49. package/dist/cjs/generalHelpers.d.ts +447 -0
  50. package/dist/cjs/generalHelpers.js +959 -0
  51. package/dist/cjs/generalHelpers.js.map +1 -0
  52. package/dist/cjs/get-subscription-info.d.ts +27 -0
  53. package/dist/cjs/get-subscription-info.js +38 -0
  54. package/dist/cjs/get-subscription-info.js.map +1 -0
  55. package/dist/cjs/getDeletableSolutionInfo.d.ts +30 -0
  56. package/dist/cjs/getDeletableSolutionInfo.js +53 -0
  57. package/dist/cjs/getDeletableSolutionInfo.js.map +1 -0
  58. package/dist/cjs/getItemTypeAbbrev.d.ts +19 -0
  59. package/dist/cjs/getItemTypeAbbrev.js +186 -0
  60. package/dist/cjs/getItemTypeAbbrev.js.map +1 -0
  61. package/dist/cjs/getSolutionSummary.d.ts +28 -0
  62. package/dist/cjs/getSolutionSummary.js +100 -0
  63. package/dist/cjs/getSolutionSummary.js.map +1 -0
  64. package/dist/cjs/index.d.ts +49 -0
  65. package/dist/cjs/index.js +53 -0
  66. package/dist/cjs/index.js.map +1 -0
  67. package/dist/cjs/interfaces.d.ts +1446 -0
  68. package/dist/cjs/interfaces.js +72 -0
  69. package/dist/cjs/interfaces.js.map +1 -0
  70. package/dist/cjs/item-reuse.d.ts +140 -0
  71. package/dist/cjs/item-reuse.js +176 -0
  72. package/dist/cjs/item-reuse.js.map +1 -0
  73. package/dist/cjs/libConnectors.d.ts +73 -0
  74. package/dist/cjs/libConnectors.js +115 -0
  75. package/dist/cjs/libConnectors.js.map +1 -0
  76. package/dist/cjs/migrations/apply-schema.d.ts +24 -0
  77. package/dist/cjs/migrations/apply-schema.js +36 -0
  78. package/dist/cjs/migrations/apply-schema.js.map +1 -0
  79. package/dist/cjs/migrations/is-legacy-solution.d.ts +24 -0
  80. package/dist/cjs/migrations/is-legacy-solution.js +39 -0
  81. package/dist/cjs/migrations/is-legacy-solution.js.map +1 -0
  82. package/dist/cjs/migrations/upgrade-three-dot-one.d.ts +26 -0
  83. package/dist/cjs/migrations/upgrade-three-dot-one.js +48 -0
  84. package/dist/cjs/migrations/upgrade-three-dot-one.js.map +1 -0
  85. package/dist/cjs/migrations/upgrade-three-dot-zero.d.ts +27 -0
  86. package/dist/cjs/migrations/upgrade-three-dot-zero.js +43 -0
  87. package/dist/cjs/migrations/upgrade-three-dot-zero.js.map +1 -0
  88. package/dist/cjs/migrations/upgrade-two-dot-five.d.ts +24 -0
  89. package/dist/cjs/migrations/upgrade-two-dot-five.js +73 -0
  90. package/dist/cjs/migrations/upgrade-two-dot-five.js.map +1 -0
  91. package/dist/cjs/migrations/upgrade-two-dot-four.d.ts +24 -0
  92. package/dist/cjs/migrations/upgrade-two-dot-four.js +72 -0
  93. package/dist/cjs/migrations/upgrade-two-dot-four.js.map +1 -0
  94. package/dist/cjs/migrations/upgrade-two-dot-one.d.ts +7 -0
  95. package/dist/cjs/migrations/upgrade-two-dot-one.js +39 -0
  96. package/dist/cjs/migrations/upgrade-two-dot-one.js.map +1 -0
  97. package/dist/cjs/migrations/upgrade-two-dot-seven.d.ts +23 -0
  98. package/dist/cjs/migrations/upgrade-two-dot-seven.js +58 -0
  99. package/dist/cjs/migrations/upgrade-two-dot-seven.js.map +1 -0
  100. package/dist/cjs/migrations/upgrade-two-dot-six.d.ts +27 -0
  101. package/dist/cjs/migrations/upgrade-two-dot-six.js +61 -0
  102. package/dist/cjs/migrations/upgrade-two-dot-six.js.map +1 -0
  103. package/dist/cjs/migrations/upgrade-two-dot-three.d.ts +23 -0
  104. package/dist/cjs/migrations/upgrade-two-dot-three.js +55 -0
  105. package/dist/cjs/migrations/upgrade-two-dot-three.js.map +1 -0
  106. package/dist/cjs/migrations/upgrade-two-dot-two.d.ts +23 -0
  107. package/dist/cjs/migrations/upgrade-two-dot-two.js +58 -0
  108. package/dist/cjs/migrations/upgrade-two-dot-two.js.map +1 -0
  109. package/dist/cjs/migrations/upgrade-two-dot-zero.d.ts +44 -0
  110. package/dist/cjs/migrations/upgrade-two-dot-zero.js +95 -0
  111. package/dist/cjs/migrations/upgrade-two-dot-zero.js.map +1 -0
  112. package/dist/cjs/migrator.d.ts +25 -0
  113. package/dist/cjs/migrator.js +75 -0
  114. package/dist/cjs/migrator.js.map +1 -0
  115. package/dist/cjs/resourceHelpers.d.ts +192 -0
  116. package/dist/cjs/resourceHelpers.js +380 -0
  117. package/dist/cjs/resourceHelpers.js.map +1 -0
  118. package/dist/cjs/resources/add-resource.d.ts +38 -0
  119. package/dist/cjs/resources/add-resource.js +84 -0
  120. package/dist/cjs/resources/add-resource.js.map +1 -0
  121. package/dist/cjs/resources/addMetadataFromBlob.d.ts +25 -0
  122. package/dist/cjs/resources/addMetadataFromBlob.js +43 -0
  123. package/dist/cjs/resources/addMetadataFromBlob.js.map +1 -0
  124. package/dist/cjs/resources/convert-item-resource-to-storage-resource.d.ts +32 -0
  125. package/dist/cjs/resources/convert-item-resource-to-storage-resource.js +70 -0
  126. package/dist/cjs/resources/convert-item-resource-to-storage-resource.js.map +1 -0
  127. package/dist/cjs/resources/convert-storage-resource-to-item-resource.d.ts +29 -0
  128. package/dist/cjs/resources/convert-storage-resource-to-item-resource.js +70 -0
  129. package/dist/cjs/resources/convert-storage-resource-to-item-resource.js.map +1 -0
  130. package/dist/cjs/resources/copyAssociatedFiles.d.ts +79 -0
  131. package/dist/cjs/resources/copyAssociatedFiles.js +348 -0
  132. package/dist/cjs/resources/copyAssociatedFiles.js.map +1 -0
  133. package/dist/cjs/resources/copyDataIntoItem.d.ts +34 -0
  134. package/dist/cjs/resources/copyDataIntoItem.js +45 -0
  135. package/dist/cjs/resources/copyDataIntoItem.js.map +1 -0
  136. package/dist/cjs/resources/copyMetadataIntoItem.d.ts +27 -0
  137. package/dist/cjs/resources/copyMetadataIntoItem.js +44 -0
  138. package/dist/cjs/resources/copyMetadataIntoItem.js.map +1 -0
  139. package/dist/cjs/resources/copyResourceIntoZip.d.ts +34 -0
  140. package/dist/cjs/resources/copyResourceIntoZip.js +74 -0
  141. package/dist/cjs/resources/copyResourceIntoZip.js.map +1 -0
  142. package/dist/cjs/resources/copyZipIntoItem.d.ts +26 -0
  143. package/dist/cjs/resources/copyZipIntoItem.js +53 -0
  144. package/dist/cjs/resources/copyZipIntoItem.js.map +1 -0
  145. package/dist/cjs/resources/createCopyResults.d.ts +25 -0
  146. package/dist/cjs/resources/createCopyResults.js +36 -0
  147. package/dist/cjs/resources/createCopyResults.js.map +1 -0
  148. package/dist/cjs/resources/get-blob.d.ts +25 -0
  149. package/dist/cjs/resources/get-blob.js +42 -0
  150. package/dist/cjs/resources/get-blob.js.map +1 -0
  151. package/dist/cjs/resources/getItemResourcesFilesFromPaths.d.ts +25 -0
  152. package/dist/cjs/resources/getItemResourcesFilesFromPaths.js +49 -0
  153. package/dist/cjs/resources/getItemResourcesFilesFromPaths.js.map +1 -0
  154. package/dist/cjs/resources/getItemResourcesPaths.d.ts +27 -0
  155. package/dist/cjs/resources/getItemResourcesPaths.js +80 -0
  156. package/dist/cjs/resources/getItemResourcesPaths.js.map +1 -0
  157. package/dist/cjs/resources/index.d.ts +30 -0
  158. package/dist/cjs/resources/index.js +34 -0
  159. package/dist/cjs/resources/index.js.map +1 -0
  160. package/dist/cjs/resources/solution-resource.d.ts +35 -0
  161. package/dist/cjs/resources/solution-resource.js +31 -0
  162. package/dist/cjs/resources/solution-resource.js.map +1 -0
  163. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.d.ts +56 -0
  164. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js +140 -0
  165. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js.map +1 -0
  166. package/dist/cjs/resources/update-resource.d.ts +27 -0
  167. package/dist/cjs/resources/update-resource.js +52 -0
  168. package/dist/cjs/resources/update-resource.js.map +1 -0
  169. package/dist/cjs/restHelpers.d.ts +634 -0
  170. package/dist/cjs/restHelpers.js +2008 -0
  171. package/dist/cjs/restHelpers.js.map +1 -0
  172. package/dist/cjs/restHelpersGet.d.ts +303 -0
  173. package/dist/cjs/restHelpersGet.js +835 -0
  174. package/dist/cjs/restHelpersGet.js.map +1 -0
  175. package/dist/cjs/sharing/index.d.ts +16 -0
  176. package/dist/cjs/sharing/index.js +20 -0
  177. package/dist/cjs/sharing/index.js.map +1 -0
  178. package/dist/cjs/sharing/share-item-to-groups.d.ts +26 -0
  179. package/dist/cjs/sharing/share-item-to-groups.js +44 -0
  180. package/dist/cjs/sharing/share-item-to-groups.js.map +1 -0
  181. package/dist/cjs/templatization.d.ts +139 -0
  182. package/dist/cjs/templatization.js +311 -0
  183. package/dist/cjs/templatization.js.map +1 -0
  184. package/dist/cjs/trackingHelpers.d.ts +115 -0
  185. package/dist/cjs/trackingHelpers.js +212 -0
  186. package/dist/cjs/trackingHelpers.js.map +1 -0
  187. package/dist/cjs/velocityHelpers.d.ts +68 -0
  188. package/dist/cjs/velocityHelpers.js +151 -0
  189. package/dist/cjs/velocityHelpers.js.map +1 -0
  190. package/dist/cjs/webtoolHelpers.d.ts +57 -0
  191. package/dist/cjs/webtoolHelpers.js +102 -0
  192. package/dist/cjs/webtoolHelpers.js.map +1 -0
  193. package/dist/cjs/workflowHelpers.d.ts +112 -0
  194. package/dist/cjs/workflowHelpers.js +284 -0
  195. package/dist/cjs/workflowHelpers.js.map +1 -0
  196. package/dist/cjs/workforceHelpers.d.ts +121 -0
  197. package/dist/cjs/workforceHelpers.js +720 -0
  198. package/dist/cjs/workforceHelpers.js.map +1 -0
  199. package/dist/cjs/zip-utils.d.ts +85 -0
  200. package/dist/cjs/zip-utils.js +154 -0
  201. package/dist/cjs/zip-utils.js.map +1 -0
  202. package/dist/esm/arcgisRestJS.d.ts +63 -0
  203. package/dist/esm/arcgisRestJS.js +110 -0
  204. package/dist/esm/arcgisRestJS.js.map +1 -0
  205. package/dist/esm/completeItem.d.ts +30 -0
  206. package/dist/esm/completeItem.js +67 -0
  207. package/dist/esm/completeItem.js.map +1 -0
  208. package/dist/esm/create-hub-request-options.d.ts +29 -0
  209. package/dist/esm/create-hub-request-options.js +60 -0
  210. package/dist/esm/create-hub-request-options.js.map +1 -0
  211. package/dist/esm/deleteHelpers/deleteEmptyGroups.d.ts +24 -0
  212. package/dist/esm/deleteHelpers/deleteEmptyGroups.js +38 -0
  213. package/dist/esm/deleteHelpers/deleteEmptyGroups.js.map +1 -0
  214. package/dist/esm/deleteHelpers/deleteGroupIfEmpty.d.ts +27 -0
  215. package/dist/esm/deleteHelpers/deleteGroupIfEmpty.js +95 -0
  216. package/dist/esm/deleteHelpers/deleteGroupIfEmpty.js.map +1 -0
  217. package/dist/esm/deleteHelpers/deleteSolutionContents.d.ts +39 -0
  218. package/dist/esm/deleteHelpers/deleteSolutionContents.js +122 -0
  219. package/dist/esm/deleteHelpers/deleteSolutionContents.js.map +1 -0
  220. package/dist/esm/deleteHelpers/deleteSolutionFolder.d.ts +29 -0
  221. package/dist/esm/deleteHelpers/deleteSolutionFolder.js +77 -0
  222. package/dist/esm/deleteHelpers/deleteSolutionFolder.js.map +1 -0
  223. package/dist/esm/deleteHelpers/deleteSolutionItem.d.ts +31 -0
  224. package/dist/esm/deleteHelpers/deleteSolutionItem.js +48 -0
  225. package/dist/esm/deleteHelpers/deleteSolutionItem.js.map +1 -0
  226. package/dist/esm/deleteHelpers/index.d.ts +22 -0
  227. package/dist/esm/deleteHelpers/index.js +23 -0
  228. package/dist/esm/deleteHelpers/index.js.map +1 -0
  229. package/dist/esm/deleteHelpers/reconstructBuildOrderIds.d.ts +27 -0
  230. package/dist/esm/deleteHelpers/reconstructBuildOrderIds.js +29 -0
  231. package/dist/esm/deleteHelpers/reconstructBuildOrderIds.js.map +1 -0
  232. package/dist/esm/deleteHelpers/removeItems.d.ts +35 -0
  233. package/dist/esm/deleteHelpers/removeItems.js +111 -0
  234. package/dist/esm/deleteHelpers/removeItems.js.map +1 -0
  235. package/dist/esm/deleteHelpers/reportProgress.d.ts +27 -0
  236. package/dist/esm/deleteHelpers/reportProgress.js +42 -0
  237. package/dist/esm/deleteHelpers/reportProgress.js.map +1 -0
  238. package/dist/esm/deleteSolution.d.ts +56 -0
  239. package/dist/esm/deleteSolution.js +101 -0
  240. package/dist/esm/deleteSolution.js.map +1 -0
  241. package/dist/esm/dependencies.d.ts +26 -0
  242. package/dist/esm/dependencies.js +167 -0
  243. package/dist/esm/dependencies.js.map +1 -0
  244. package/dist/esm/featureServiceHelpers.d.ts +847 -0
  245. package/dist/esm/featureServiceHelpers.js +2466 -0
  246. package/dist/esm/featureServiceHelpers.js.map +1 -0
  247. package/dist/esm/formHelpers.d.ts +26 -0
  248. package/dist/esm/formHelpers.js +35 -0
  249. package/dist/esm/formHelpers.js.map +1 -0
  250. package/dist/esm/generalHelpers.d.ts +447 -0
  251. package/dist/esm/generalHelpers.js +903 -0
  252. package/dist/esm/generalHelpers.js.map +1 -0
  253. package/dist/esm/get-subscription-info.d.ts +27 -0
  254. package/dist/esm/get-subscription-info.js +34 -0
  255. package/dist/esm/get-subscription-info.js.map +1 -0
  256. package/dist/esm/getDeletableSolutionInfo.d.ts +30 -0
  257. package/dist/esm/getDeletableSolutionInfo.js +48 -0
  258. package/dist/esm/getDeletableSolutionInfo.js.map +1 -0
  259. package/dist/esm/getItemTypeAbbrev.d.ts +19 -0
  260. package/dist/esm/getItemTypeAbbrev.js +182 -0
  261. package/dist/esm/getItemTypeAbbrev.js.map +1 -0
  262. package/dist/esm/getSolutionSummary.d.ts +28 -0
  263. package/dist/esm/getSolutionSummary.js +95 -0
  264. package/dist/esm/getSolutionSummary.js.map +1 -0
  265. package/dist/esm/index.d.ts +49 -0
  266. package/dist/esm/index.js +50 -0
  267. package/dist/esm/index.js.map +1 -0
  268. package/dist/esm/interfaces.d.ts +1446 -0
  269. package/dist/esm/interfaces.js +69 -0
  270. package/dist/esm/interfaces.js.map +1 -0
  271. package/dist/esm/item-reuse.d.ts +140 -0
  272. package/dist/esm/item-reuse.js +167 -0
  273. package/dist/esm/item-reuse.js.map +1 -0
  274. package/dist/esm/libConnectors.d.ts +73 -0
  275. package/dist/esm/libConnectors.js +105 -0
  276. package/dist/esm/libConnectors.js.map +1 -0
  277. package/dist/esm/migrations/apply-schema.d.ts +24 -0
  278. package/dist/esm/migrations/apply-schema.js +32 -0
  279. package/dist/esm/migrations/apply-schema.js.map +1 -0
  280. package/dist/esm/migrations/is-legacy-solution.d.ts +24 -0
  281. package/dist/esm/migrations/is-legacy-solution.js +35 -0
  282. package/dist/esm/migrations/is-legacy-solution.js.map +1 -0
  283. package/dist/esm/migrations/upgrade-three-dot-one.d.ts +26 -0
  284. package/dist/esm/migrations/upgrade-three-dot-one.js +44 -0
  285. package/dist/esm/migrations/upgrade-three-dot-one.js.map +1 -0
  286. package/dist/esm/migrations/upgrade-three-dot-zero.d.ts +27 -0
  287. package/dist/esm/migrations/upgrade-three-dot-zero.js +39 -0
  288. package/dist/esm/migrations/upgrade-three-dot-zero.js.map +1 -0
  289. package/dist/esm/migrations/upgrade-two-dot-five.d.ts +24 -0
  290. package/dist/esm/migrations/upgrade-two-dot-five.js +69 -0
  291. package/dist/esm/migrations/upgrade-two-dot-five.js.map +1 -0
  292. package/dist/esm/migrations/upgrade-two-dot-four.d.ts +24 -0
  293. package/dist/esm/migrations/upgrade-two-dot-four.js +68 -0
  294. package/dist/esm/migrations/upgrade-two-dot-four.js.map +1 -0
  295. package/dist/esm/migrations/upgrade-two-dot-one.d.ts +7 -0
  296. package/dist/esm/migrations/upgrade-two-dot-one.js +35 -0
  297. package/dist/esm/migrations/upgrade-two-dot-one.js.map +1 -0
  298. package/dist/esm/migrations/upgrade-two-dot-seven.d.ts +23 -0
  299. package/dist/esm/migrations/upgrade-two-dot-seven.js +54 -0
  300. package/dist/esm/migrations/upgrade-two-dot-seven.js.map +1 -0
  301. package/dist/esm/migrations/upgrade-two-dot-six.d.ts +27 -0
  302. package/dist/esm/migrations/upgrade-two-dot-six.js +57 -0
  303. package/dist/esm/migrations/upgrade-two-dot-six.js.map +1 -0
  304. package/dist/esm/migrations/upgrade-two-dot-three.d.ts +23 -0
  305. package/dist/esm/migrations/upgrade-two-dot-three.js +51 -0
  306. package/dist/esm/migrations/upgrade-two-dot-three.js.map +1 -0
  307. package/dist/esm/migrations/upgrade-two-dot-two.d.ts +23 -0
  308. package/dist/esm/migrations/upgrade-two-dot-two.js +54 -0
  309. package/dist/esm/migrations/upgrade-two-dot-two.js.map +1 -0
  310. package/dist/esm/migrations/upgrade-two-dot-zero.d.ts +44 -0
  311. package/dist/esm/migrations/upgrade-two-dot-zero.js +88 -0
  312. package/dist/esm/migrations/upgrade-two-dot-zero.js.map +1 -0
  313. package/dist/esm/migrator.d.ts +25 -0
  314. package/dist/esm/migrator.js +71 -0
  315. package/dist/esm/migrator.js.map +1 -0
  316. package/dist/esm/resourceHelpers.d.ts +192 -0
  317. package/dist/esm/resourceHelpers.js +361 -0
  318. package/dist/esm/resourceHelpers.js.map +1 -0
  319. package/dist/esm/resources/add-resource.d.ts +38 -0
  320. package/dist/esm/resources/add-resource.js +79 -0
  321. package/dist/esm/resources/add-resource.js.map +1 -0
  322. package/dist/esm/resources/addMetadataFromBlob.d.ts +25 -0
  323. package/dist/esm/resources/addMetadataFromBlob.js +39 -0
  324. package/dist/esm/resources/addMetadataFromBlob.js.map +1 -0
  325. package/dist/esm/resources/convert-item-resource-to-storage-resource.d.ts +32 -0
  326. package/dist/esm/resources/convert-item-resource-to-storage-resource.js +66 -0
  327. package/dist/esm/resources/convert-item-resource-to-storage-resource.js.map +1 -0
  328. package/dist/esm/resources/convert-storage-resource-to-item-resource.d.ts +29 -0
  329. package/dist/esm/resources/convert-storage-resource-to-item-resource.js +66 -0
  330. package/dist/esm/resources/convert-storage-resource-to-item-resource.js.map +1 -0
  331. package/dist/esm/resources/copyAssociatedFiles.d.ts +79 -0
  332. package/dist/esm/resources/copyAssociatedFiles.js +339 -0
  333. package/dist/esm/resources/copyAssociatedFiles.js.map +1 -0
  334. package/dist/esm/resources/copyDataIntoItem.d.ts +34 -0
  335. package/dist/esm/resources/copyDataIntoItem.js +40 -0
  336. package/dist/esm/resources/copyDataIntoItem.js.map +1 -0
  337. package/dist/esm/resources/copyMetadataIntoItem.d.ts +27 -0
  338. package/dist/esm/resources/copyMetadataIntoItem.js +40 -0
  339. package/dist/esm/resources/copyMetadataIntoItem.js.map +1 -0
  340. package/dist/esm/resources/copyResourceIntoZip.d.ts +34 -0
  341. package/dist/esm/resources/copyResourceIntoZip.js +69 -0
  342. package/dist/esm/resources/copyResourceIntoZip.js.map +1 -0
  343. package/dist/esm/resources/copyZipIntoItem.d.ts +26 -0
  344. package/dist/esm/resources/copyZipIntoItem.js +49 -0
  345. package/dist/esm/resources/copyZipIntoItem.js.map +1 -0
  346. package/dist/esm/resources/createCopyResults.d.ts +25 -0
  347. package/dist/esm/resources/createCopyResults.js +32 -0
  348. package/dist/esm/resources/createCopyResults.js.map +1 -0
  349. package/dist/esm/resources/get-blob.d.ts +25 -0
  350. package/dist/esm/resources/get-blob.js +38 -0
  351. package/dist/esm/resources/get-blob.js.map +1 -0
  352. package/dist/esm/resources/getItemResourcesFilesFromPaths.d.ts +25 -0
  353. package/dist/esm/resources/getItemResourcesFilesFromPaths.js +45 -0
  354. package/dist/esm/resources/getItemResourcesFilesFromPaths.js.map +1 -0
  355. package/dist/esm/resources/getItemResourcesPaths.d.ts +27 -0
  356. package/dist/esm/resources/getItemResourcesPaths.js +76 -0
  357. package/dist/esm/resources/getItemResourcesPaths.js.map +1 -0
  358. package/dist/esm/resources/index.d.ts +30 -0
  359. package/dist/esm/resources/index.js +31 -0
  360. package/dist/esm/resources/index.js.map +1 -0
  361. package/dist/esm/resources/solution-resource.d.ts +35 -0
  362. package/dist/esm/resources/solution-resource.js +28 -0
  363. package/dist/esm/resources/solution-resource.js.map +1 -0
  364. package/dist/esm/resources/transform-resource-paths-to-solution-resources.d.ts +56 -0
  365. package/dist/esm/resources/transform-resource-paths-to-solution-resources.js +132 -0
  366. package/dist/esm/resources/transform-resource-paths-to-solution-resources.js.map +1 -0
  367. package/dist/esm/resources/update-resource.d.ts +27 -0
  368. package/dist/esm/resources/update-resource.js +48 -0
  369. package/dist/esm/resources/update-resource.js.map +1 -0
  370. package/dist/esm/restHelpers.d.ts +634 -0
  371. package/dist/esm/restHelpers.js +1943 -0
  372. package/dist/esm/restHelpers.js.map +1 -0
  373. package/dist/esm/restHelpersGet.d.ts +303 -0
  374. package/dist/esm/restHelpersGet.js +793 -0
  375. package/dist/esm/restHelpersGet.js.map +1 -0
  376. package/dist/esm/sharing/index.d.ts +16 -0
  377. package/dist/esm/sharing/index.js +17 -0
  378. package/dist/esm/sharing/index.js.map +1 -0
  379. package/dist/esm/sharing/share-item-to-groups.d.ts +26 -0
  380. package/dist/esm/sharing/share-item-to-groups.js +40 -0
  381. package/dist/esm/sharing/share-item-to-groups.js.map +1 -0
  382. package/dist/esm/templatization.d.ts +139 -0
  383. package/dist/esm/templatization.js +291 -0
  384. package/dist/esm/templatization.js.map +1 -0
  385. package/dist/esm/trackingHelpers.d.ts +115 -0
  386. package/dist/esm/trackingHelpers.js +200 -0
  387. package/dist/esm/trackingHelpers.js.map +1 -0
  388. package/dist/esm/velocityHelpers.d.ts +68 -0
  389. package/dist/esm/velocityHelpers.js +144 -0
  390. package/dist/esm/velocityHelpers.js.map +1 -0
  391. package/dist/esm/webtoolHelpers.d.ts +57 -0
  392. package/dist/esm/webtoolHelpers.js +95 -0
  393. package/dist/esm/webtoolHelpers.js.map +1 -0
  394. package/dist/esm/workflowHelpers.d.ts +112 -0
  395. package/dist/esm/workflowHelpers.js +270 -0
  396. package/dist/esm/workflowHelpers.js.map +1 -0
  397. package/dist/esm/workforceHelpers.d.ts +121 -0
  398. package/dist/esm/workforceHelpers.js +691 -0
  399. package/dist/esm/workforceHelpers.js.map +1 -0
  400. package/dist/esm/zip-utils.d.ts +85 -0
  401. package/dist/esm/zip-utils.js +142 -0
  402. package/dist/esm/zip-utils.js.map +1 -0
  403. package/dist/solution.js_commit.txt +7 -0
  404. package/package.json +2 -2
@@ -0,0 +1,2008 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2018 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._countRelationships = exports._addItemMetadataFile = exports._addItemDataFile = exports.updateItemURL = exports.updateItemTemplateFromDictionary = exports.updateItemExtended = exports.updateGroup = exports.updateItem = exports.shareItem = exports.removeUsers = exports.reassignGroup = exports.searchGroupContents = exports.searchGroupAllContents = exports.searchAllGroups = exports.searchGroups = exports.searchAllItems = exports.searchItems = exports.removeItemOrGroup = exports.removeItem = exports.removeGroup = exports.removeFolder = exports.hasInvalidGroupDesignations = exports._parseAdminServiceData = exports.setWorkflowConfigurationZip = exports.getWorkflowConfigurationZip = exports.getFeatureServiceProperties = exports.getServiceLayersAndTables = exports.getRequest = exports._sortRelationships = exports.moveItemsToFolder = exports.moveItemToFolder = exports.getLayerUpdates = exports.getLayers = exports.extractDependencies = exports.createUniqueGroup = exports.createUniqueFolder = exports.createItemWithData = exports.createFullItem = exports.createFeatureService = exports.convertExtent = exports.convertExtentWithFallback = exports._validateExtent = exports.convertToISearchOptions = exports.checkRequestStatus = exports.addToServiceDefinition = exports.addTokenToUrl = exports.addForwardItemRelationships = exports.addForwardItemRelationship = exports.getUserSession = exports.addItemData = void 0;
19
+ exports._updateItemURL = exports._updateIndexesForRelationshipKeyFields = exports._setItemProperties = exports._reportVariablesInItem = exports._lowercaseDomain = exports._getUpdate = exports._getSubtypeUpdates = exports._getContingentValuesUpdates = exports._getRelationshipUpdates = exports._getFallbackExtent = exports._getCreateServiceOptions = void 0;
20
+ /**
21
+ * Provides common functions involving the arcgis-rest-js library.
22
+ *
23
+ * @module restHelpers
24
+ */
25
+ const featureServiceHelpers_1 = require("./featureServiceHelpers");
26
+ const generalHelpers_1 = require("./generalHelpers");
27
+ const arcgisRestJS_1 = require("./arcgisRestJS");
28
+ const libConnectors_1 = require("./libConnectors");
29
+ const restHelpersGet_1 = require("./restHelpersGet");
30
+ const workforceHelpers_1 = require("./workforceHelpers");
31
+ const templatization_1 = require("./templatization");
32
+ const trackingHelpers_1 = require("./trackingHelpers");
33
+ // ------------------------------------------------------------------------------------------------------------------ //
34
+ function addItemData(id, data, authentication) {
35
+ const addDataOptions = {
36
+ id,
37
+ data,
38
+ authentication,
39
+ };
40
+ return (0, arcgisRestJS_1.restAddItemData)(addDataOptions);
41
+ }
42
+ exports.addItemData = addItemData;
43
+ /**
44
+ * Creates a UserSession via a function so that the global arcgisSolution variable can access authentication.
45
+ *
46
+ * @param options See https://esri.github.io/arcgis-rest-js/api/auth/IUserSessionOptions/
47
+ * @returns UserSession
48
+ */
49
+ function getUserSession(options = {}) {
50
+ return new arcgisRestJS_1.UserSession(options);
51
+ }
52
+ exports.getUserSession = getUserSession;
53
+ /**
54
+ * Adds a forward relationship between two items.
55
+ *
56
+ * @param originItemId Origin of relationship
57
+ * @param destinationItemId Destination of relationship
58
+ * @param relationshipType Type of relationship
59
+ * @param authentication Credentials for the request
60
+ * @returns A Promise to add item resources.
61
+ */
62
+ function addForwardItemRelationship(originItemId, destinationItemId, relationshipType, authentication) {
63
+ return new Promise((resolve) => {
64
+ const requestOptions = {
65
+ originItemId,
66
+ destinationItemId,
67
+ relationshipType,
68
+ authentication,
69
+ };
70
+ (0, arcgisRestJS_1.addItemRelationship)(requestOptions).then((response) => {
71
+ resolve({
72
+ success: response.success,
73
+ itemId: originItemId,
74
+ });
75
+ }, () => {
76
+ resolve({
77
+ success: false,
78
+ itemId: originItemId,
79
+ });
80
+ });
81
+ });
82
+ }
83
+ exports.addForwardItemRelationship = addForwardItemRelationship;
84
+ /**
85
+ * Adds forward relationships for an item.
86
+ *
87
+ * @param originItemId Origin of relationship
88
+ * @param destinationRelationships Destinations
89
+ * @param authentication Credentials for the request
90
+ * @returns A Promise to add item resources.
91
+ */
92
+ function addForwardItemRelationships(originItemId, destinationRelationships, authentication) {
93
+ return new Promise((resolve) => {
94
+ // Set up relationships using updated relationship information
95
+ const relationshipPromises = new Array();
96
+ destinationRelationships.forEach((relationship) => {
97
+ relationship.relatedItemIds.forEach((relatedItemId) => {
98
+ relationshipPromises.push(addForwardItemRelationship(originItemId, relatedItemId, relationship.relationshipType, authentication));
99
+ });
100
+ });
101
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
102
+ Promise.all(relationshipPromises).then((responses) => resolve(responses));
103
+ });
104
+ }
105
+ exports.addForwardItemRelationships = addForwardItemRelationships;
106
+ /**
107
+ * Adds a token to the query parameters of a URL.
108
+ *
109
+ * @param url URL to use as base
110
+ * @param authentication Credentials to be used to generate token for URL
111
+ * @returns A promise that will resolve with the supplied URL with `token=<token>` added to its query params
112
+ * unless either the URL doesn't exist or the token can't be generated
113
+ */
114
+ function addTokenToUrl(url, authentication) {
115
+ return new Promise((resolve) => {
116
+ if (!url || !authentication) {
117
+ resolve(url);
118
+ }
119
+ else {
120
+ authentication.getToken(url).then((token) => {
121
+ /* istanbul ignore else */
122
+ if (token) {
123
+ url = (0, generalHelpers_1.appendQueryParam)(url, "token=" + token);
124
+ }
125
+ resolve(url);
126
+ }, () => resolve(url));
127
+ }
128
+ });
129
+ }
130
+ exports.addTokenToUrl = addTokenToUrl;
131
+ /**
132
+ * Calls addToDefinition for the service.
133
+ *
134
+ * Added retry due to some solutions failing to deploy in specific orgs/hives due to timeouts.
135
+ * On the first pass we will use the quicker sync request to add.
136
+ * If it fails we will use an async request that will avoid the timeout errors.
137
+ *
138
+ * @param url URL to use as base
139
+ * @param options the info to add to the services definition
140
+ * @param skipRetry a boolean to control if retry logic will be used. Defaults to false.
141
+ * @param useAsync a boolean to control if we will use an async request
142
+ * @returns A promise that will resolve when the request has completed
143
+ */
144
+ function addToServiceDefinition(url, options, skipRetry = false, useAsync = false) {
145
+ /* istanbul ignore else */
146
+ if (useAsync) {
147
+ options.params = { ...options.params, async: true };
148
+ }
149
+ return new Promise((resolve, reject) => {
150
+ (0, arcgisRestJS_1.svcAdminAddToServiceDefinition)(url, options).then((result) => {
151
+ checkRequestStatus(result, options.authentication).then(() => resolve(null), (e) => reject((0, generalHelpers_1.fail)(e)));
152
+ }, (e) => {
153
+ if (!skipRetry) {
154
+ addToServiceDefinition(url, options, true, true).then(() => resolve(null), (e) => reject(e));
155
+ }
156
+ else {
157
+ reject((0, generalHelpers_1.fail)(e));
158
+ }
159
+ });
160
+ });
161
+ }
162
+ exports.addToServiceDefinition = addToServiceDefinition;
163
+ /**
164
+ * When using an async request we need to poll the status url to know when the request has completed or failed.
165
+ *
166
+ * @param result the result returned from the addToDefinition request.
167
+ * This will contain a status url or the standard sync result.
168
+ * @param authentication Credentials to be used to generate token for URL
169
+ * @returns A promise that will resolve when the request has completed
170
+ */
171
+ function checkRequestStatus(result, authentication) {
172
+ return new Promise((resolve, reject) => {
173
+ const url = result.statusURL || result.statusUrl;
174
+ if (url) {
175
+ const checkStatus = setInterval(() => {
176
+ (0, arcgisRestJS_1.request)(url, { authentication }).then((r) => {
177
+ /* istanbul ignore else */
178
+ if (["completed", "success"].indexOf(r.status.toLowerCase()) > -1) {
179
+ clearInterval(checkStatus);
180
+ resolve();
181
+ }
182
+ else if (r.status.toLowerCase() === "failed") {
183
+ clearInterval(checkStatus);
184
+ reject(r);
185
+ }
186
+ }, (e) => {
187
+ clearInterval(checkStatus);
188
+ reject(e);
189
+ });
190
+ }, 2000);
191
+ }
192
+ else {
193
+ resolve();
194
+ }
195
+ });
196
+ }
197
+ exports.checkRequestStatus = checkRequestStatus;
198
+ /**
199
+ * Converts a general search into an ISearchOptions structure.
200
+ *
201
+ * @param search Search specified in one of three ways
202
+ * @returns Recast search
203
+ */
204
+ function convertToISearchOptions(search) {
205
+ // Convert the search into an ISearchOptions
206
+ let searchOptions = {
207
+ q: "",
208
+ start: 1,
209
+ num: 100,
210
+ };
211
+ if (typeof search === "string") {
212
+ // Insert query into defaults
213
+ searchOptions.q = search;
214
+ }
215
+ else if (search instanceof arcgisRestJS_1.SearchQueryBuilder) {
216
+ // Insert query into defaults
217
+ searchOptions.q = search.toParam();
218
+ }
219
+ else {
220
+ // search is ISearchOptions
221
+ searchOptions = {
222
+ ...searchOptions,
223
+ ...search, // request
224
+ };
225
+ }
226
+ // Remove the sortField if it's "relevance"; that's the default option and is not meant to be specified
227
+ if (searchOptions.sortField === "relevance") {
228
+ delete searchOptions.sortField;
229
+ }
230
+ return searchOptions;
231
+ }
232
+ exports.convertToISearchOptions = convertToISearchOptions;
233
+ /**
234
+ * Simple validate function to ensure all coordinates are numbers
235
+ * In some cases orgs can have null or undefined coordinate values associated with the org extent
236
+ *
237
+ * @param extent the extent to validate
238
+ * @returns the provided extent or a default global extent if some coordinates are not numbers
239
+ * @private
240
+ */
241
+ function _validateExtent(extent) {
242
+ // in some cases orgs can have invalid extents defined
243
+ // this is a simple validate function that will ensure coordiantes are numbers
244
+ // using -179,-89,179,89 because the project call is returning "NaN" when using -180,-90,180,90
245
+ const hasInvalid = typeof extent.xmin !== "number" ||
246
+ typeof extent.xmax !== "number" ||
247
+ typeof extent.ymax !== "number" ||
248
+ typeof extent.ymin !== "number";
249
+ if (hasInvalid) {
250
+ extent.xmin = -179;
251
+ extent.xmax = 179;
252
+ extent.ymax = 89;
253
+ extent.ymin = -89;
254
+ extent.spatialReference = { wkid: 4326 };
255
+ }
256
+ return extent;
257
+ }
258
+ exports._validateExtent = _validateExtent;
259
+ /**
260
+ * If the request to convert the extent fails it has commonly been due to an invalid extent.
261
+ * This function will first attempt to use the provided extent. If it fails it will default to
262
+ * the source items extent and if that fails it will then use a default global extent.
263
+ *
264
+ * @param extent the extent to convert
265
+ * @param fallbackExtent the extent to convert if the main extent does not project to the outSR
266
+ * @param outSR the spatial reference to project to
267
+ * @param geometryServiceUrl the service url for the geometry service to use
268
+ * @param authentication the credentials for the requests
269
+ * @returns the extent projected to the provided spatial reference
270
+ * or the world extent projected to the provided spatial reference
271
+ * @private
272
+ */
273
+ function convertExtentWithFallback(extent, fallbackExtent, outSR, geometryServiceUrl, authentication) {
274
+ return new Promise((resolve, reject) => {
275
+ const defaultExtent = {
276
+ xmin: -179,
277
+ xmax: 179,
278
+ ymin: -89,
279
+ ymax: 89,
280
+ spatialReference: { wkid: 4326 },
281
+ };
282
+ convertExtent(_validateExtent(extent), outSR, geometryServiceUrl, authentication).then((extentResponse) => {
283
+ // in some cases project will complete successfully but return "NaN" values
284
+ // check for this and call convert again if it does
285
+ const extentResponseString = JSON.stringify(extentResponse);
286
+ const validatedExtent = JSON.stringify(_validateExtent(extentResponse));
287
+ if (extentResponseString === validatedExtent) {
288
+ resolve(extentResponse);
289
+ }
290
+ else {
291
+ convertExtent(fallbackExtent || defaultExtent, outSR, geometryServiceUrl, authentication).then(resolve, (e) => reject((0, generalHelpers_1.fail)(e)));
292
+ }
293
+ },
294
+ // if convert fails try again with default global extent
295
+ () => {
296
+ convertExtent(defaultExtent, outSR, geometryServiceUrl, authentication).then(resolve, (e) => reject((0, generalHelpers_1.fail)(e)));
297
+ });
298
+ });
299
+ }
300
+ exports.convertExtentWithFallback = convertExtentWithFallback;
301
+ /**
302
+ * Converts an extent to a specified spatial reference.
303
+ *
304
+ * @param extent Extent object to check and (possibly) to project
305
+ * @param outSR Desired spatial reference
306
+ * @param geometryServiceUrl Path to geometry service providing `findTransformations` and `project` services
307
+ * @param authentication Credentials for the request
308
+ * @returns Original extent if it's already using outSR or the extents projected into the outSR
309
+ */
310
+ function convertExtent(extent, outSR, geometryServiceUrl, authentication) {
311
+ const _requestOptions = { authentication };
312
+ return new Promise((resolve, reject) => {
313
+ if (extent.spatialReference.wkid === outSR?.wkid || !outSR) {
314
+ resolve(extent);
315
+ }
316
+ else {
317
+ _requestOptions.params = {
318
+ f: "json",
319
+ inSR: extent.spatialReference.wkid,
320
+ outSR: outSR.wkid,
321
+ extentOfInterest: JSON.stringify(extent),
322
+ };
323
+ (0, arcgisRestJS_1.request)((0, generalHelpers_1.checkUrlPathTermination)(geometryServiceUrl) + "findTransformations", _requestOptions).then((response) => {
324
+ const transformations = response && response.transformations ? response.transformations : undefined;
325
+ let transformation;
326
+ if (transformations && transformations.length > 0) {
327
+ // if a forward single transformation is found use that...otherwise check for and use composite
328
+ transformation = transformations[0].wkid
329
+ ? transformations[0].wkid
330
+ : transformations[0].geoTransforms
331
+ ? transformations[0]
332
+ : undefined;
333
+ }
334
+ _requestOptions.params = {
335
+ f: "json",
336
+ outSR: outSR.wkid,
337
+ inSR: extent.spatialReference.wkid,
338
+ geometries: {
339
+ geometryType: "esriGeometryPoint",
340
+ geometries: [
341
+ { x: extent.xmin, y: extent.ymin },
342
+ { x: extent.xmax, y: extent.ymax },
343
+ ],
344
+ },
345
+ transformation: transformation,
346
+ };
347
+ (0, arcgisRestJS_1.request)((0, generalHelpers_1.checkUrlPathTermination)(geometryServiceUrl) + "project", _requestOptions).then((projectResponse) => {
348
+ const projectGeom = projectResponse.geometries.length === 2 ? projectResponse.geometries : undefined;
349
+ if (projectGeom) {
350
+ resolve({
351
+ xmin: projectGeom[0].x,
352
+ ymin: projectGeom[0].y,
353
+ xmax: projectGeom[1].x,
354
+ ymax: projectGeom[1].y,
355
+ spatialReference: outSR,
356
+ });
357
+ }
358
+ else {
359
+ resolve(undefined);
360
+ }
361
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
362
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
363
+ }
364
+ });
365
+ }
366
+ exports.convertExtent = convertExtent;
367
+ /**
368
+ * Publishes a feature service as an AGOL item; it does not include its layers and tables
369
+ *
370
+ * @param newItemTemplate Template of item to be created
371
+ * @param authentication Credentials for the request
372
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, user; .user.folders property contains a list
373
+ * @returns A promise that will resolve with an object reporting success and the Solution id
374
+ */
375
+ function createFeatureService(newItemTemplate, authentication, templateDictionary) {
376
+ return new Promise((resolve, reject) => {
377
+ // Create item
378
+ _getCreateServiceOptions(newItemTemplate, authentication, templateDictionary).then((createOptions) => {
379
+ (0, arcgisRestJS_1.svcAdminCreateFeatureService)(createOptions).then((createResponse) => {
380
+ // Federated servers may have inconsistent casing, so lowerCase it
381
+ createResponse.encodedServiceURL = _lowercaseDomain(createResponse.encodedServiceURL);
382
+ createResponse.serviceurl = _lowercaseDomain(createResponse.serviceurl);
383
+ resolve(createResponse);
384
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
385
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
386
+ });
387
+ }
388
+ exports.createFeatureService = createFeatureService;
389
+ /**
390
+ * Publishes an item and its data, metadata, and resources as an AGOL item.
391
+ *
392
+ * @param itemInfo Item's `item` section
393
+ * @param folderId Id of folder to receive item; null indicates that the item goes into the root
394
+ * folder; ignored for Group item type
395
+ * @param destinationAuthentication Credentials for for requests to where the item is to be created
396
+ * @param itemThumbnailUrl URL to image to use for item thumbnail
397
+ * @param itemThumbnailAuthentication Credentials for requests to the thumbnail source
398
+ * @param dataFile Item's `data` section
399
+ * @param metadataFile Item's metadata file
400
+ * @param resourcesFiles Item's resources
401
+ * @param access Access to set for item: "public", "org", "private"
402
+ * @returns A promise that will resolve with an object reporting success or failure and the Solution id
403
+ */
404
+ function createFullItem(itemInfo, folderId, destinationAuthentication, itemThumbnailUrl, itemThumbnailAuthentication, dataFile, metadataFile, resourcesFiles, access = "private") {
405
+ return new Promise((resolve, reject) => {
406
+ // Create item
407
+ const createOptions = {
408
+ item: {
409
+ ...itemInfo,
410
+ },
411
+ folderId,
412
+ authentication: destinationAuthentication,
413
+ };
414
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
415
+ addTokenToUrl(itemThumbnailUrl, itemThumbnailAuthentication).then((updatedThumbnailUrl) => {
416
+ /* istanbul ignore else */
417
+ if (updatedThumbnailUrl) {
418
+ createOptions.item.thumbnailUrl = (0, generalHelpers_1.appendQueryParam)(updatedThumbnailUrl, "w=400");
419
+ }
420
+ (0, arcgisRestJS_1.createItemInFolder)(createOptions).then((createResponse) => {
421
+ if (createResponse.success) {
422
+ let accessDef;
423
+ // Set access if it is not AGOL default
424
+ // Set the access manually since the access value in createItem appears to be ignored
425
+ // Need to run serially; will not work reliably if done in parallel with adding the data section
426
+ if (access !== "private") {
427
+ const accessOptions = {
428
+ id: createResponse.id,
429
+ access: access === "public" ? "public" : "org",
430
+ authentication: destinationAuthentication,
431
+ };
432
+ accessDef = (0, arcgisRestJS_1.setItemAccess)(accessOptions);
433
+ }
434
+ else {
435
+ accessDef = Promise.resolve({
436
+ itemId: createResponse.id,
437
+ });
438
+ }
439
+ // Now add attached items
440
+ accessDef.then(() => {
441
+ const updateDefs = [];
442
+ // Add the data section
443
+ if (dataFile) {
444
+ updateDefs.push(_addItemDataFile(createResponse.id, dataFile, destinationAuthentication));
445
+ }
446
+ // Add the resources via a zip because AGO sometimes loses resources if many are added at the
447
+ // same time to the same item
448
+ if (Array.isArray(resourcesFiles) && resourcesFiles.length > 0) {
449
+ updateDefs.push(new Promise((rsrcResolve, rsrcReject) => {
450
+ (0, libConnectors_1.createZip)("resources.zip", resourcesFiles).then((zipfile) => {
451
+ const addResourceOptions = {
452
+ id: createResponse.id,
453
+ resource: zipfile,
454
+ authentication: destinationAuthentication,
455
+ params: {
456
+ archive: true,
457
+ },
458
+ };
459
+ (0, arcgisRestJS_1.addItemResource)(addResourceOptions).then(rsrcResolve, rsrcReject);
460
+ }, rsrcReject);
461
+ }));
462
+ }
463
+ // Add the metadata section
464
+ if (metadataFile) {
465
+ updateDefs.push(_addItemMetadataFile(createResponse.id, metadataFile, destinationAuthentication));
466
+ }
467
+ // Wait until all adds are done
468
+ Promise.all(updateDefs).then(() => resolve(createResponse), (e) => reject((0, generalHelpers_1.fail)(e)));
469
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
470
+ }
471
+ else {
472
+ reject((0, generalHelpers_1.fail)());
473
+ }
474
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
475
+ });
476
+ });
477
+ }
478
+ exports.createFullItem = createFullItem;
479
+ /**
480
+ * Publishes an item and its data as an AGOL item.
481
+ *
482
+ * @param itemInfo Item's `item` section
483
+ * @param dataInfo Item's `data` section
484
+ * @param authentication Credentials for the request
485
+ * @param folderId Id of folder to receive item; null indicates that the item goes into the root
486
+ * folder; ignored for Group item type
487
+ * @param access Access to set for item: "public", "org", "private"
488
+ * @returns A promise that will resolve with an object reporting success and the Solution id
489
+ */
490
+ function createItemWithData(itemInfo, dataInfo, authentication, folderId, access = "private") {
491
+ return new Promise((resolve, reject) => {
492
+ // Create item
493
+ const createOptions = {
494
+ item: {
495
+ title: "_",
496
+ ...itemInfo,
497
+ data: dataInfo,
498
+ },
499
+ folderId,
500
+ authentication: authentication,
501
+ };
502
+ if (itemInfo.thumbnail) {
503
+ createOptions.params = {
504
+ // Pass thumbnail file in via params because item property is serialized, which discards a blob
505
+ thumbnail: itemInfo.thumbnail,
506
+ };
507
+ delete createOptions.item.thumbnail;
508
+ }
509
+ (0, arcgisRestJS_1.createItemInFolder)(createOptions).then((createResponse) => {
510
+ if (createResponse.success) {
511
+ if (access !== "private") {
512
+ // Set access if it is not AGOL default
513
+ // Set the access manually since the access value in createItem appears to be ignored
514
+ const accessOptions = {
515
+ id: createResponse.id,
516
+ access: access === "public" ? "public" : "org",
517
+ authentication: authentication,
518
+ };
519
+ (0, arcgisRestJS_1.setItemAccess)(accessOptions).then(() => {
520
+ resolve({
521
+ folder: createResponse.folder,
522
+ id: createResponse.id,
523
+ success: true,
524
+ });
525
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
526
+ }
527
+ else {
528
+ resolve({
529
+ folder: createResponse.folder,
530
+ id: createResponse.id,
531
+ success: true,
532
+ });
533
+ }
534
+ }
535
+ else {
536
+ reject((0, generalHelpers_1.fail)());
537
+ }
538
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
539
+ });
540
+ }
541
+ exports.createItemWithData = createItemWithData;
542
+ /**
543
+ * Creates a folder using a numeric suffix to ensure uniqueness if necessary.
544
+ *
545
+ * @param title Folder title, used as-is if possible and with suffix otherwise
546
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, user; .user.folders property contains a list
547
+ * of known folder names; function updates list with existing names not yet known, and creates .user.folders if it
548
+ * doesn't exist in the dictionary
549
+ * @param authentication Credentials for creating folder
550
+ * @returns Id of created folder
551
+ */
552
+ function createUniqueFolder(title, templateDictionary, authentication) {
553
+ return new Promise((resolve, reject) => {
554
+ // Get a title that is not already in use
555
+ const folderTitle = (0, generalHelpers_1.getUniqueTitle)(title, templateDictionary, "user.folders");
556
+ const folderCreationParam = {
557
+ title: folderTitle,
558
+ authentication: authentication,
559
+ };
560
+ (0, arcgisRestJS_1.createFolder)(folderCreationParam).then((ok) => resolve(ok), (err) => {
561
+ // If the name already exists, we'll try again
562
+ const errorDetails = (0, generalHelpers_1.getProp)(err, "response.error.details");
563
+ if (Array.isArray(errorDetails) && errorDetails.length > 0) {
564
+ const nameNotAvailMsg = "Folder title '" + folderTitle + "' not available.";
565
+ if (errorDetails.indexOf(nameNotAvailMsg) >= 0) {
566
+ // Create the user.folders property if it doesn't exist
567
+ /* istanbul ignore else */
568
+ if (!(0, generalHelpers_1.getProp)(templateDictionary, "user.folders")) {
569
+ (0, generalHelpers_1.setCreateProp)(templateDictionary, "user.folders", []);
570
+ }
571
+ templateDictionary.user.folders.push({
572
+ title: folderTitle,
573
+ });
574
+ createUniqueFolder(title, templateDictionary, authentication).then(resolve, reject);
575
+ }
576
+ else {
577
+ reject(err);
578
+ }
579
+ }
580
+ else {
581
+ // Otherwise, error out
582
+ reject(err);
583
+ }
584
+ });
585
+ });
586
+ }
587
+ exports.createUniqueFolder = createUniqueFolder;
588
+ /**
589
+ * Creates a group using numeric suffix to ensure uniqueness.
590
+ *
591
+ * @param title Group title, used as-is if possible and with suffix otherwise
592
+ * @param templateDictionary Hash of facts: org URL, adlib replacements, user
593
+ * @param authentication Credentials for creating group
594
+ * @param owner Optional arg for the Tracking owner
595
+ * If the tracking owner is not the one deploying the solution
596
+ * tracker groups will be created under the deployment user but
597
+ * will be reassigned to the tracking owner.
598
+ * @returns Information about created group
599
+ */
600
+ function createUniqueGroup(title, groupItem, templateDictionary, authentication, owner) {
601
+ return new Promise((resolve, reject) => {
602
+ let groupsPromise;
603
+ // when working with tracker we need to consider the groups of the deploying user as well as the groups
604
+ // of the tracking user...must be unique for both
605
+ if (owner && owner !== authentication.username) {
606
+ groupsPromise = searchAllGroups(`(owner:${owner}) orgid:${templateDictionary.organization.id}`, authentication);
607
+ }
608
+ else {
609
+ groupsPromise = Promise.resolve([]);
610
+ }
611
+ // first get the tracker owner groups
612
+ groupsPromise.then((groups) => {
613
+ templateDictionary["allGroups"] = groups.concat((0, generalHelpers_1.getProp)(templateDictionary, "user.groups"));
614
+ // Get a title that is not already in use
615
+ groupItem.title = (0, generalHelpers_1.getUniqueTitle)(title, templateDictionary, "allGroups");
616
+ const groupCreationParam = {
617
+ group: groupItem,
618
+ authentication: authentication,
619
+ };
620
+ (0, arcgisRestJS_1.createGroup)(groupCreationParam).then(resolve, (err) => {
621
+ // If the name already exists, we'll try again
622
+ const errorDetails = (0, generalHelpers_1.getProp)(err, "response.error.details");
623
+ if (Array.isArray(errorDetails) && errorDetails.length > 0) {
624
+ const nameNotAvailMsg = "You already have a group named '" + groupItem.title + "'. Try a different name.";
625
+ if (errorDetails.indexOf(nameNotAvailMsg) >= 0) {
626
+ templateDictionary.user.groups.push({
627
+ title: groupItem.title,
628
+ });
629
+ createUniqueGroup(title, groupItem, templateDictionary, authentication).then(resolve, reject);
630
+ }
631
+ else {
632
+ reject(err);
633
+ }
634
+ }
635
+ else {
636
+ // Otherwise, error out
637
+ reject(err);
638
+ }
639
+ });
640
+ }, (e) => reject(e));
641
+ });
642
+ }
643
+ exports.createUniqueGroup = createUniqueGroup;
644
+ /**
645
+ * Gets the ids of the dependencies of an AGOL feature service item.
646
+ * Dependencies will only exist when the service is a view.
647
+ *
648
+ * @param itemTemplate Template of item to be created
649
+ * @param authentication Credentials for the request
650
+ * @returns A promise that will resolve a list of dependencies
651
+ */
652
+ function extractDependencies(itemTemplate, authentication) {
653
+ const dependencies = [];
654
+ return new Promise((resolve, reject) => {
655
+ // Get service dependencies when the item is a view
656
+ // This step is skipped for tracker views as they will already have a source service in the org
657
+ if (itemTemplate.properties.service.isView && itemTemplate.item.url && !(0, trackingHelpers_1.isTrackingViewTemplate)(itemTemplate)) {
658
+ (0, arcgisRestJS_1.request)((0, generalHelpers_1.checkUrlPathTermination)(itemTemplate.item.url) + "sources?f=json", {
659
+ authentication: authentication,
660
+ }).then((response) => {
661
+ /* istanbul ignore else */
662
+ if (response && response.services) {
663
+ response.services.forEach((layer) => {
664
+ dependencies.push({
665
+ id: layer.serviceItemId,
666
+ name: layer.name,
667
+ });
668
+ });
669
+ }
670
+ resolve(dependencies);
671
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
672
+ }
673
+ else if ((0, workforceHelpers_1.isWorkforceProject)(itemTemplate)) {
674
+ resolve((0, workforceHelpers_1.getWorkforceDependencies)(itemTemplate, dependencies));
675
+ }
676
+ else {
677
+ resolve(dependencies);
678
+ }
679
+ });
680
+ }
681
+ exports.extractDependencies = extractDependencies;
682
+ /**
683
+ * Get json info for the services layers
684
+ *
685
+ * @param serviceUrl the url for the service
686
+ * @param layerList list of base layer info
687
+ * @param authentication Credentials for the request
688
+ * @returns A promise that will resolve a list of dependencies
689
+ */
690
+ function getLayers(serviceUrl, layerList, authentication) {
691
+ return new Promise((resolve, reject) => {
692
+ if (layerList.length === 0) {
693
+ resolve([]);
694
+ }
695
+ // get the admin URL
696
+ serviceUrl = serviceUrl.replace("/rest/services", "/rest/admin/services");
697
+ const requestsDfd = [];
698
+ layerList.forEach((layer) => {
699
+ const requestOptions = {
700
+ authentication: authentication,
701
+ };
702
+ requestsDfd.push((0, arcgisRestJS_1.request)((0, generalHelpers_1.checkUrlPathTermination)(serviceUrl) + layer["id"] + "?f=json", requestOptions));
703
+ });
704
+ // Wait until all layers are heard from
705
+ Promise.all(requestsDfd).then((layers) => resolve(layers), (e) => reject((0, generalHelpers_1.fail)(e)));
706
+ });
707
+ }
708
+ exports.getLayers = getLayers;
709
+ /**
710
+ * Add additional options to a layers definition.
711
+ *
712
+ * @param args The IPostProcessArgs for the request(s)
713
+ * @param isPortal boolean to indicate if we are deploying to portal
714
+ *
715
+ * @returns An array of update instructions
716
+ * @private
717
+ */
718
+ function getLayerUpdates(args, isPortal) {
719
+ const adminUrl = args.itemTemplate.item.url.replace("rest/services", "rest/admin/services");
720
+ const updates = [];
721
+ const refresh = _getUpdate(adminUrl, null, null, args, "refresh");
722
+ updates.push(refresh);
723
+ Object.keys(args.objects).forEach((id) => {
724
+ const obj = Object.assign({}, args.objects[id]);
725
+ // These properties cannot be set in the update definition when working with portal
726
+ if (isPortal) {
727
+ (0, generalHelpers_1.deleteProps)(obj, ["type", "id", "relationships", "sourceServiceFields"]);
728
+ }
729
+ // handle definition deletes
730
+ // removes previous editFieldsInfo fields if their names were changed
731
+ if (obj.hasOwnProperty("deleteFields")) {
732
+ updates.push(_getUpdate(adminUrl, id, obj, args, "delete"));
733
+ (0, generalHelpers_1.deleteProp)(obj, "deleteFields");
734
+ updates.push(_getUpdate(adminUrl, null, null, args, "refresh"));
735
+ }
736
+ });
737
+ const subtypeUpdates = _getSubtypeUpdates({
738
+ message: "add subtype updates",
739
+ objects: args.objects,
740
+ itemTemplate: args.itemTemplate,
741
+ authentication: args.authentication,
742
+ });
743
+ /* istanbul ignore else */
744
+ if (subtypeUpdates.length > 0 && isPortal) {
745
+ subtypeUpdates.forEach((subtypeUpdate) => {
746
+ updates.push(_getUpdate(adminUrl + subtypeUpdate.id, null, { subtypeField: subtypeUpdate.subtypeField }, args, "update"));
747
+ updates.push(_getUpdate(adminUrl + subtypeUpdate.id, null, { defaultSubtypeCode: subtypeUpdate.defaultSubtypeCode }, args, "update"));
748
+ updates.push(_getUpdate(adminUrl + subtypeUpdate.id, null, { subtypes: subtypeUpdate.subtypes }, args, "add"));
749
+ });
750
+ }
751
+ // issue: #706
752
+ // Add source service relationships
753
+ // views will now always add all layers in a single call and will inherit the relationships from the source service
754
+ if (!args.itemTemplate.properties.service.isView) {
755
+ const relUpdates = _getRelationshipUpdates({
756
+ message: "updated layer relationships",
757
+ objects: args.objects,
758
+ itemTemplate: args.itemTemplate,
759
+ authentication: args.authentication,
760
+ });
761
+ // issue: #724
762
+ // In portal the order the relationships are added needs to follow the layer order
763
+ // otherwise the relationship IDs will be reset
764
+ relUpdates.layers = _sortRelationships(args.itemTemplate.properties.layers, args.itemTemplate.properties.tables, relUpdates);
765
+ /* istanbul ignore else */
766
+ if (relUpdates.layers.length > 0) {
767
+ updates.push(_getUpdate(adminUrl, null, relUpdates, args, "add"));
768
+ updates.push(refresh);
769
+ }
770
+ // handle contingent values
771
+ const contingentValuesUpdates = _getContingentValuesUpdates({
772
+ message: "add layer contingent values",
773
+ objects: args.objects,
774
+ itemTemplate: args.itemTemplate,
775
+ authentication: args.authentication,
776
+ });
777
+ /* istanbul ignore else */
778
+ if (contingentValuesUpdates.length > 0) {
779
+ contingentValuesUpdates.forEach((conUpdate) => {
780
+ updates.push(_getUpdate(adminUrl + conUpdate.id, null, conUpdate.contingentValues, args, "add"));
781
+ });
782
+ }
783
+ }
784
+ // issue: https://devtopia.esri.com/WebGIS/solution-deployment-apps/issues/273
785
+ // For portal only...add specific indexes with existing supplementary addToDefinition call if it exists
786
+ // or with a new addToDefinition call if one doesn't already exist
787
+ if (isPortal) {
788
+ Object.keys(args.objects).forEach((id) => {
789
+ const obj = Object.assign({}, args.objects[id]);
790
+ let update;
791
+ if (Array.isArray(obj.indexes) && obj.indexes.length > 0) {
792
+ const layerHasExistingAdd = updates.some((u) => {
793
+ if (u.url.indexOf(`${id}/addToDefinition`) > -1) {
794
+ update = u;
795
+ return true;
796
+ }
797
+ });
798
+ if (layerHasExistingAdd) {
799
+ // append to existing addToDef
800
+ update.params.addToDefinition = {
801
+ ...update.params.addToDefinition,
802
+ indexes: obj.indexes,
803
+ };
804
+ }
805
+ else {
806
+ // create new addToDef
807
+ updates.push(_getUpdate((0, generalHelpers_1.checkUrlPathTermination)(adminUrl) + id, null, { indexes: obj.indexes }, args, "add"));
808
+ }
809
+ }
810
+ });
811
+ }
812
+ return updates.length === 1 ? [] : updates;
813
+ }
814
+ exports.getLayerUpdates = getLayerUpdates;
815
+ /**
816
+ * Moves an AGO item to a specified folder.
817
+ *
818
+ * @param itemId Id of item to move
819
+ * @param folderId Id of folder to receive item
820
+ * @param authentication Credentials for the request
821
+ * @returns A Promise resolving to the results of the move
822
+ */
823
+ async function moveItemToFolder(itemId, folderId, authentication) {
824
+ const moveOptions = {
825
+ itemId,
826
+ folderId,
827
+ authentication,
828
+ };
829
+ return (0, arcgisRestJS_1.moveItem)(moveOptions);
830
+ }
831
+ exports.moveItemToFolder = moveItemToFolder;
832
+ /**
833
+ * Moves a list of AGO items to a specified folder.
834
+ *
835
+ * @param itemIds Ids of items to move
836
+ * @param folderId Id of folder to receive item
837
+ * @param authentication Credentials for the request
838
+ * @returns A Promise resolving to the results of the moves
839
+ */
840
+ async function moveItemsToFolder(itemIds, folderId, authentication) {
841
+ const movePromises = new Array();
842
+ itemIds.forEach((itemId) => {
843
+ movePromises.push(moveItemToFolder(itemId, folderId, authentication));
844
+ });
845
+ return Promise.all(movePromises);
846
+ }
847
+ exports.moveItemsToFolder = moveItemsToFolder;
848
+ /**
849
+ * Sorts relationships based on order of supporting layers and tables in the service definition
850
+ *
851
+ * @param layers the layers from the service
852
+ * @param tables the tables from the service
853
+ * @param relUpdates the relationships to add for the service
854
+ *
855
+ * @returns An array with relationships that have been sorted
856
+ * @private
857
+ */
858
+ function _sortRelationships(layers, tables, relUpdates) {
859
+ const ids = [].concat(layers.map((l) => l.id), tables.map((t) => t.id));
860
+ // In portal the order the relationships are added needs to follow the layer order
861
+ // otherwise the relationship IDs will be reset
862
+ const _relUpdateLayers = [];
863
+ ids.forEach((id) => {
864
+ relUpdates.layers.some((relUpdate) => {
865
+ if (id === relUpdate.id) {
866
+ _relUpdateLayers.push(relUpdate);
867
+ return true;
868
+ }
869
+ else {
870
+ return false;
871
+ }
872
+ });
873
+ });
874
+ return _relUpdateLayers;
875
+ }
876
+ exports._sortRelationships = _sortRelationships;
877
+ /**
878
+ * Add additional options to a layers definition
879
+ *
880
+ * Added retry due to some solutions failing to deploy in specific orgs/hives
881
+ *
882
+ *
883
+ * @param Update will contain either add, update, or delete from service definition call
884
+ * @param skipRetry defaults to false. when true the retry logic will be ignored
885
+ * @returns A promise that will resolve when service definition call has completed
886
+ * @private
887
+ */
888
+ /* istanbul ignore else */
889
+ function getRequest(update, skipRetry = false, useAsync = false, isPortal = false) {
890
+ return new Promise((resolve, reject) => {
891
+ const options = {
892
+ params: update.params,
893
+ authentication: update.args.authentication,
894
+ };
895
+ /* istanbul ignore else */
896
+ if ((useAsync && update.url.indexOf("addToDefinition") > -1) ||
897
+ update.url.indexOf("updateDefinition") > -1 ||
898
+ update.url.indexOf("deleteFromDefinition") > -1) {
899
+ options.params = { ...options.params, async: true };
900
+ }
901
+ (0, arcgisRestJS_1.request)(update.url, options).then((result) => {
902
+ checkRequestStatus(result, options.authentication).then(() => resolve(null), (e) => reject((0, generalHelpers_1.fail)(e)));
903
+ }, (e) => {
904
+ if (!skipRetry) {
905
+ getRequest(update, true, true, isPortal).then(() => resolve(), (e) => reject(e));
906
+ }
907
+ else {
908
+ reject(e);
909
+ }
910
+ });
911
+ });
912
+ }
913
+ exports.getRequest = getRequest;
914
+ /**
915
+ * Fills in missing data, including full layer and table definitions, in a feature services' definition.
916
+ *
917
+ * @param itemTemplate Feature service item, data, dependencies definition to be modified
918
+ * @param authentication Credentials for the request to AGOL
919
+ * @returns A promise that will resolve when fullItem has been updated
920
+ * @private
921
+ */
922
+ function getServiceLayersAndTables(itemTemplate, authentication) {
923
+ return new Promise((resolve, reject) => {
924
+ // To have enough information for reconstructing the service, we'll supplement
925
+ // the item and data sections with sections for the service, full layers, and
926
+ // full tables
927
+ // Extra steps must be taken for workforce version 2
928
+ const isWorkforceService = (0, workforceHelpers_1.isWorkforceProject)(itemTemplate);
929
+ // Get the service description
930
+ if (itemTemplate.item.url) {
931
+ getFeatureServiceProperties(itemTemplate.item.url, authentication, isWorkforceService).then((properties) => {
932
+ itemTemplate.properties = properties;
933
+ resolve(itemTemplate);
934
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
935
+ }
936
+ else {
937
+ resolve(itemTemplate);
938
+ }
939
+ });
940
+ }
941
+ exports.getServiceLayersAndTables = getServiceLayersAndTables;
942
+ /**
943
+ * Get service properties for the given url and update key props
944
+ *
945
+ * @param serviceUrl the feature service url
946
+ * @param authentication Credentials for the request to AGOL
947
+ * @param workforceService boolean to indicate if extra workforce service steps should be handled
948
+ * @returns A promise that will resolve with the service properties
949
+ * @private
950
+ */
951
+ function getFeatureServiceProperties(serviceUrl, authentication, workforceService = false) {
952
+ return new Promise((resolve, reject) => {
953
+ const properties = {
954
+ service: {},
955
+ layers: [],
956
+ tables: [],
957
+ };
958
+ // get the admin URL
959
+ serviceUrl = serviceUrl.replace("/rest/services", "/rest/admin/services");
960
+ // Get the service description
961
+ (0, arcgisRestJS_1.request)(serviceUrl + "?f=json", {
962
+ authentication: authentication,
963
+ }).then((serviceData) => {
964
+ properties.service = _parseAdminServiceData(serviceData);
965
+ // Copy cacheMaxAge to top level so that AGO sees it when deploying the service
966
+ // serviceData may have set it if there isn't an adminServiceInfo
967
+ /* istanbul ignore else */
968
+ if (serviceData.adminServiceInfo?.cacheMaxAge) {
969
+ properties.service.cacheMaxAge = serviceData.adminServiceInfo.cacheMaxAge;
970
+ }
971
+ // Move the layers and tables out of the service's data section
972
+ /* istanbul ignore else */
973
+ if (serviceData.layers) {
974
+ properties.layers = serviceData.layers;
975
+ // Fill in properties that the service layer doesn't provide
976
+ // and remove properties that should not exist in the template
977
+ properties.layers.forEach((layer) => {
978
+ layer.serviceItemId = properties.service.serviceItemId;
979
+ layer.extent = null;
980
+ (0, featureServiceHelpers_1.removeLayerOptimization)(layer);
981
+ });
982
+ }
983
+ delete serviceData.layers;
984
+ /* istanbul ignore else */
985
+ if (serviceData.tables) {
986
+ properties.tables = serviceData.tables;
987
+ // Fill in properties that the service layer doesn't provide
988
+ properties.tables.forEach((table) => {
989
+ table.serviceItemId = properties.service.serviceItemId;
990
+ table.extent = null;
991
+ });
992
+ }
993
+ delete serviceData.tables;
994
+ // Ensure solution items have unique indexes on relationship key fields
995
+ _updateIndexesForRelationshipKeyFields(properties);
996
+ (0, featureServiceHelpers_1.processContingentValues)(properties, serviceUrl, authentication).then(() => {
997
+ if (workforceService) {
998
+ (0, workforceHelpers_1.getWorkforceServiceInfo)(properties, serviceUrl, authentication).then(resolve, reject);
999
+ }
1000
+ else {
1001
+ resolve(properties);
1002
+ }
1003
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
1004
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
1005
+ });
1006
+ }
1007
+ exports.getFeatureServiceProperties = getFeatureServiceProperties;
1008
+ /**
1009
+ * Fetches the configuration of a workflow.
1010
+ *
1011
+ * @param itemId Id of the workflow item
1012
+ * @param workflowBaseUrl URL of the workflow manager, e.g., "https://workflow.arcgis.com/orgId"
1013
+ * @param authentication Credentials for the request to AGOL
1014
+ * @returns Promise resolving with the workflow configuration in a zip file
1015
+ * @throws {WorkflowJsonExceptionDTO} if request to workflow manager fails
1016
+ */
1017
+ async function getWorkflowConfigurationZip(itemId, workflowBaseUrl, authentication) {
1018
+ const url = `${workflowBaseUrl}/admin/${itemId}/export`;
1019
+ return (0, arcgisRestJS_1.request)(url, {
1020
+ authentication,
1021
+ headers: {
1022
+ "Accept": "application/octet-stream",
1023
+ "Authorization": `Bearer ${authentication.token}`,
1024
+ "X-Esri-Authorization": `Bearer ${authentication.token}`,
1025
+ },
1026
+ params: {
1027
+ f: "zip",
1028
+ },
1029
+ });
1030
+ }
1031
+ exports.getWorkflowConfigurationZip = getWorkflowConfigurationZip;
1032
+ /**
1033
+ * Sets the configuration of a workflow.
1034
+ *
1035
+ * @param itemId Id of the workflow item
1036
+ * @param configurationZipFile Configuration files in a zip file
1037
+ * @param workflowBaseUrl URL of the workflow manager, e.g., "https://workflow.arcgis.com/orgId"
1038
+ * @param authentication Credentials for the request to AGOL
1039
+ * @returns Promise resolving with the workflow configuration in a zip file
1040
+ * @throws {WorkflowJsonExceptionDTO} if request to workflow manager fails
1041
+ */
1042
+ async function setWorkflowConfigurationZip(itemId, configurationZipFile, workflowBaseUrl, authentication) {
1043
+ const url = `${workflowBaseUrl}/admin/${itemId}/import`;
1044
+ return (0, arcgisRestJS_1.request)(url, {
1045
+ authentication,
1046
+ headers: {
1047
+ "Accept": "application/octet-stream",
1048
+ "Authorization": `Bearer ${authentication.token}`,
1049
+ "X-Esri-Authorization": `Bearer ${authentication.token}`,
1050
+ },
1051
+ params: {
1052
+ file: configurationZipFile,
1053
+ },
1054
+ });
1055
+ }
1056
+ exports.setWorkflowConfigurationZip = setWorkflowConfigurationZip;
1057
+ /**
1058
+ * Parses the layers array and will filter subsets of Layers and Tables
1059
+ * Layers and Tables are both returned in the layers array when we access a feature service from the admin api.
1060
+ *
1061
+ * @param adminData The data of the feature service
1062
+ * @returns A mutated version of the provided adminData
1063
+ * @private
1064
+ */
1065
+ function _parseAdminServiceData(adminData) {
1066
+ const layers = adminData.layers || [];
1067
+ const tables = adminData.tables || [];
1068
+ (0, generalHelpers_1.setCreateProp)(adminData, "layers", layers.filter((l) => l.type === "Feature Layer"));
1069
+ // TODO understand if the concat is necessary.
1070
+ // Not sure if the admin api will ever actually return a tables collection here.
1071
+ (0, generalHelpers_1.setCreateProp)(adminData, "tables", tables.concat(layers.filter((l) => l.type === "Table")));
1072
+ return adminData;
1073
+ }
1074
+ exports._parseAdminServiceData = _parseAdminServiceData;
1075
+ /**
1076
+ * livingatlas designation test.
1077
+ * These layers should not be templatized or depolyed
1078
+ *
1079
+ * @param groupDesignations the items group designations to evaluate
1080
+ * @returns A boolean indicating if the invalid designation is found in the item info
1081
+ */
1082
+ function hasInvalidGroupDesignations(groupDesignations) {
1083
+ const invalidGroupDesignations = ["livingatlas"];
1084
+ return groupDesignations ? invalidGroupDesignations.indexOf(groupDesignations) > -1 : false;
1085
+ }
1086
+ exports.hasInvalidGroupDesignations = hasInvalidGroupDesignations;
1087
+ /**
1088
+ * Removes a folder from AGO.
1089
+ *
1090
+ * @param folderId Id of a folder to delete
1091
+ * @param authentication Credentials for the request to AGO
1092
+ * @returns A promise that will resolve with the result of the request
1093
+ */
1094
+ function removeFolder(folderId, authentication) {
1095
+ return new Promise((resolve, reject) => {
1096
+ const requestOptions = {
1097
+ folderId: folderId,
1098
+ authentication: authentication,
1099
+ };
1100
+ (0, arcgisRestJS_1.restRemoveFolder)(requestOptions).then((result) => (result.success ? resolve(result) : reject(result)), reject);
1101
+ });
1102
+ }
1103
+ exports.removeFolder = removeFolder;
1104
+ /**
1105
+ * Removes a group from AGO.
1106
+ *
1107
+ * @param groupId Id of a group to delete
1108
+ * @param authentication Credentials for the request to AGO
1109
+ * @returns A promise that will resolve with the result of the request
1110
+ */
1111
+ function removeGroup(groupId, authentication) {
1112
+ return new Promise((resolve, reject) => {
1113
+ const requestOptions = {
1114
+ id: groupId,
1115
+ authentication: authentication,
1116
+ };
1117
+ (0, arcgisRestJS_1.restRemoveGroup)(requestOptions).then((result) => (result.success ? resolve(result) : reject(result)), reject);
1118
+ });
1119
+ }
1120
+ exports.removeGroup = removeGroup;
1121
+ /**
1122
+ * Removes an item from AGO.
1123
+ *
1124
+ * @param itemId Id of an item to delete
1125
+ * @param authentication Credentials for the request to AGO
1126
+ * @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
1127
+ * supports the recycle bin, the item will be put into the recycle bin
1128
+ * @returns A promise that will resolve with the result of the request
1129
+ */
1130
+ function removeItem(itemId, authentication, permanentDelete = true) {
1131
+ return new Promise((resolve, reject) => {
1132
+ const requestOptions = {
1133
+ id: itemId,
1134
+ authentication: authentication,
1135
+ params: {
1136
+ permanentDelete,
1137
+ },
1138
+ };
1139
+ (0, arcgisRestJS_1.restRemoveItem)(requestOptions).then((result) => (result.success ? resolve(result) : reject(result)), reject);
1140
+ });
1141
+ }
1142
+ exports.removeItem = removeItem;
1143
+ /**
1144
+ * Removes an item or group from AGO.
1145
+ *
1146
+ * @param itemId Id of an item or group to delete
1147
+ * @param authentication Credentials for the request to AGO
1148
+ * @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
1149
+ * supports the recycle bin, the item will be put into the recycle bin; note that this does not apply to groups
1150
+ * @returns A promise that will resolve with the result of the request
1151
+ */
1152
+ function removeItemOrGroup(itemId, authentication, permanentDelete = true) {
1153
+ return new Promise((resolve, reject) => {
1154
+ removeItem(itemId, authentication, permanentDelete).then(resolve, (error) => {
1155
+ removeGroup(itemId, authentication).then(resolve, () => reject(error));
1156
+ });
1157
+ });
1158
+ }
1159
+ exports.removeItemOrGroup = removeItemOrGroup;
1160
+ /**
1161
+ * Searches for items matching a query and that the caller has access to.
1162
+ *
1163
+ * @param search Search string (e.g., "q=redlands+map") or a more detailed structure that can include authentication
1164
+ * @returns Promise resolving with search results
1165
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search.htm
1166
+ */
1167
+ function searchItems(search) {
1168
+ return (0, arcgisRestJS_1.restSearchItems)(search);
1169
+ }
1170
+ exports.searchItems = searchItems;
1171
+ /**
1172
+ * Searches for items matching a query and that the caller has access to, continuing recursively until done.
1173
+ *
1174
+ * @param search Search string (e.g., "q=redlands+map") or a more detailed structure that can include authentication
1175
+ * @param accumulatedResponse Response built from previous requests
1176
+ * @returns Promise resolving with search results
1177
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search.htm
1178
+ */
1179
+ function searchAllItems(search, accumulatedResponse) {
1180
+ // Convert the search into an ISearchOptions
1181
+ const searchOptions = convertToISearchOptions(search);
1182
+ // Provide a base into which results can be concatenated
1183
+ const completeResponse = accumulatedResponse
1184
+ ? accumulatedResponse
1185
+ : {
1186
+ query: searchOptions.q,
1187
+ start: 1,
1188
+ num: 100,
1189
+ nextStart: -1,
1190
+ total: 0,
1191
+ results: [],
1192
+ };
1193
+ return new Promise((resolve, reject) => {
1194
+ searchItems(search).then((response) => {
1195
+ completeResponse.results = completeResponse.results.concat(response.results);
1196
+ completeResponse.num = completeResponse.total = completeResponse.results.length;
1197
+ if (response.nextStart > 0) {
1198
+ // Insert nextStart into next query
1199
+ searchOptions.start = response.nextStart;
1200
+ resolve(searchAllItems(searchOptions, completeResponse));
1201
+ }
1202
+ else {
1203
+ resolve(completeResponse);
1204
+ }
1205
+ }, (e) => reject(e));
1206
+ });
1207
+ }
1208
+ exports.searchAllItems = searchAllItems;
1209
+ /**
1210
+ * Searches for groups matching criteria.
1211
+ *
1212
+ * @param searchString Text for which to search, e.g., 'redlands+map', 'type:"Web Map" -type:"Web Mapping Application"'
1213
+ * @param authentication Credentials for the request to AGO
1214
+ * @param additionalSearchOptions Adjustments to search, such as tranche size
1215
+ * @returns A promise that will resolve with a structure with a tranche of results and
1216
+ * describing how many items are available
1217
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/group-search.htm
1218
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
1219
+ */
1220
+ function searchGroups(searchString, authentication, additionalSearchOptions) {
1221
+ const searchOptions = {
1222
+ q: searchString,
1223
+ params: {
1224
+ ...additionalSearchOptions,
1225
+ },
1226
+ authentication: authentication,
1227
+ };
1228
+ return (0, arcgisRestJS_1.restSearchGroups)(searchOptions);
1229
+ }
1230
+ exports.searchGroups = searchGroups;
1231
+ /**
1232
+ * Searches for groups matching criteria recurusively.
1233
+ *
1234
+ * @param searchString Text for which to search, e.g., 'redlands+map', 'type:"Web Map" -type:"Web Mapping Application"'
1235
+ * @param authentication Credentials for the request to AGO
1236
+ * @param groups List of groups that have been found from previous requests
1237
+ * @param inPagingParams The paging params for the recurisve searching
1238
+ *
1239
+ * @returns A promise that will resolve with all groups that meet the search criteria
1240
+ */
1241
+ function searchAllGroups(searchString, authentication, groups, inPagingParams) {
1242
+ const pagingParams = inPagingParams
1243
+ ? inPagingParams
1244
+ : {
1245
+ start: 1,
1246
+ num: 24,
1247
+ };
1248
+ const additionalSearchOptions = {
1249
+ sortField: "title",
1250
+ sortOrder: "asc",
1251
+ ...pagingParams,
1252
+ };
1253
+ // Provide a base onto which results can be concatenated
1254
+ let finalResults = groups ? groups : [];
1255
+ return new Promise((resolve, reject) => {
1256
+ searchGroups(searchString, authentication, additionalSearchOptions).then((response) => {
1257
+ finalResults = finalResults.concat(response.results);
1258
+ if (response.nextStart > 0) {
1259
+ pagingParams.start = response.nextStart;
1260
+ resolve(searchAllGroups(searchString, authentication, finalResults, pagingParams));
1261
+ }
1262
+ else {
1263
+ resolve(finalResults);
1264
+ }
1265
+ }, (e) => reject(e));
1266
+ });
1267
+ }
1268
+ exports.searchAllGroups = searchAllGroups;
1269
+ /**
1270
+ * Searches for group contents matching criteria recursively.
1271
+ *
1272
+ * @param groupId Group whose contents are to be searched
1273
+ * @param searchString Text for which to search, e.g., 'redlands+map', 'type:"Web Map" -type:"Web Mapping Application"'
1274
+ * @param authentication Credentials for the request to AGO
1275
+ * @param additionalSearchOptions Adjustments to search, such as tranche size and categories of interest; categories
1276
+ * are supplied as an array: each array element consists of one or more categories to be ORed; array elements are ANDed
1277
+ * @param portalUrl Rest Url of the portal to perform the search
1278
+ * @param accumulatedResponse Response built from previous requests
1279
+ * @returns A promise that will resolve with a structure with a tranche of results and
1280
+ * describing how many items are available
1281
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/group-content-search.htm
1282
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
1283
+ */
1284
+ function searchGroupAllContents(groupId, searchString, authentication, additionalSearchOptions, portalUrl, accumulatedResponse) {
1285
+ additionalSearchOptions = additionalSearchOptions ? additionalSearchOptions : {};
1286
+ // Provide a base into which results can be concatenated
1287
+ const completeResponse = accumulatedResponse
1288
+ ? accumulatedResponse
1289
+ : {
1290
+ query: searchString,
1291
+ start: 1,
1292
+ num: 100,
1293
+ nextStart: -1,
1294
+ total: 0,
1295
+ results: [],
1296
+ };
1297
+ // Remove the sortField if it's "relevance"; that's the default option and is not meant to be specified
1298
+ if (additionalSearchOptions.sortField === "relevance") {
1299
+ delete additionalSearchOptions.sortField;
1300
+ }
1301
+ return new Promise((resolve, reject) => {
1302
+ searchGroupContents(groupId, searchString, authentication, additionalSearchOptions, portalUrl).then((response) => {
1303
+ completeResponse.results = completeResponse.results.concat(response.results);
1304
+ completeResponse.num = completeResponse.total = completeResponse.results.length;
1305
+ if (response.nextStart > 0) {
1306
+ additionalSearchOptions.start = response.nextStart;
1307
+ resolve(searchGroupAllContents(groupId, searchString, authentication, additionalSearchOptions, portalUrl, completeResponse));
1308
+ }
1309
+ else {
1310
+ resolve(completeResponse);
1311
+ }
1312
+ }, (e) => reject(e));
1313
+ });
1314
+ }
1315
+ exports.searchGroupAllContents = searchGroupAllContents;
1316
+ /**
1317
+ * Searches for group contents matching criteria.
1318
+ *
1319
+ * @param groupId Group whose contents are to be searched
1320
+ * @param searchString Text for which to search, e.g., 'redlands+map', 'type:"Web Map" -type:"Web Mapping Application"'
1321
+ * @param authentication Credentials for the request to AGO
1322
+ * @param additionalSearchOptions Adjustments to search, such as tranche size and categories of interest; categories
1323
+ * are supplied as an array: each array element consists of one or more categories to be ORed; array elements are ANDed
1324
+ * @param portalUrl Rest Url of the portal to perform the search
1325
+ * @returns A promise that will resolve with a structure with a tranche of results and
1326
+ * describing how many items are available
1327
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/group-content-search.htm
1328
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
1329
+ */
1330
+ function searchGroupContents(groupId, searchString, authentication, additionalSearchOptions, portalUrl) {
1331
+ const searchOptions = {
1332
+ groupId,
1333
+ q: searchString,
1334
+ params: Object.assign({
1335
+ num: 100,
1336
+ }, additionalSearchOptions),
1337
+ authentication: authentication,
1338
+ portal: portalUrl,
1339
+ };
1340
+ // If search options include `categories`, switch to new arcgis-rest-js format
1341
+ /* istanbul ignore else */
1342
+ if (Array.isArray(searchOptions.params.categories)) {
1343
+ searchOptions.params.categories = searchOptions.params.categories.map((andGroup) => andGroup.split(","));
1344
+ }
1345
+ return (0, arcgisRestJS_1.searchGroupContent)(searchOptions);
1346
+ }
1347
+ exports.searchGroupContents = searchGroupContents;
1348
+ /**
1349
+ * Reassign ownership of a group
1350
+ *
1351
+ * @param groupId Group to remove users from
1352
+ * @param userName The new owner for the group
1353
+ * @param authentication Credentials for the request to
1354
+ *
1355
+ * @returns A promise that will resolve after the group ownership has been assigned
1356
+ *
1357
+ */
1358
+ function reassignGroup(groupId, userName, authentication) {
1359
+ const requestOptions = {
1360
+ authentication: authentication,
1361
+ params: {
1362
+ targetUsername: userName,
1363
+ },
1364
+ };
1365
+ return (0, arcgisRestJS_1.request)(`${authentication.portal}/community/groups/${groupId}/reassign`, requestOptions);
1366
+ }
1367
+ exports.reassignGroup = reassignGroup;
1368
+ /**
1369
+ * Remove users from a group
1370
+ *
1371
+ * @param groupId Group to remove users from
1372
+ * @param users List of users to remove from the group
1373
+ * @param authentication Credentials for the request to
1374
+ *
1375
+ * @returns A promise that will resolve after the users have been removed
1376
+ *
1377
+ */
1378
+ function removeUsers(groupId, users, authentication) {
1379
+ return (0, arcgisRestJS_1.removeGroupUsers)({
1380
+ id: groupId,
1381
+ users,
1382
+ authentication,
1383
+ });
1384
+ }
1385
+ exports.removeUsers = removeUsers;
1386
+ /**
1387
+ * Shares an item to the defined group
1388
+ *
1389
+ * @param groupId Group to share with
1390
+ * @param id the item id to share with the group
1391
+ * @param destinationAuthentication Credentials for the request to AGO
1392
+ * @param owner owner of the group when sharing tracking items (can be different from the deploying user)
1393
+ *
1394
+ * @returns A promise that will resolve after the item has been shared
1395
+ *
1396
+ */
1397
+ function shareItem(groupId, id, destinationAuthentication, owner) {
1398
+ return new Promise((resolve, reject) => {
1399
+ const shareOptions = {
1400
+ groupId,
1401
+ id,
1402
+ authentication: destinationAuthentication,
1403
+ };
1404
+ /* istanbul ignore else */
1405
+ if (owner) {
1406
+ shareOptions.owner = owner;
1407
+ }
1408
+ (0, arcgisRestJS_1.shareItemWithGroup)(shareOptions).then(() => resolve(null), (e) => reject((0, generalHelpers_1.fail)(e)));
1409
+ });
1410
+ }
1411
+ exports.shareItem = shareItem;
1412
+ /**
1413
+ * Updates an item.
1414
+ *
1415
+ * @param itemInfo The base info of an item; note that this content will be serialized, which doesn't work
1416
+ * for binary content
1417
+ * @param authentication Credentials for request
1418
+ * @param folderId Item's folder
1419
+ * @param additionalParams Updates that are put under the `params` property, which is not serialized
1420
+ * @return
1421
+ */
1422
+ function updateItem(itemInfo, authentication, folderId, additionalParams) {
1423
+ return new Promise((resolve, reject) => {
1424
+ const updateOptions = {
1425
+ item: itemInfo,
1426
+ folderId: folderId,
1427
+ authentication: authentication,
1428
+ params: {
1429
+ ...(additionalParams ?? {}),
1430
+ },
1431
+ };
1432
+ (0, arcgisRestJS_1.restUpdateItem)(updateOptions).then((response) => (response.success ? resolve(response) : reject(response)), (err) => reject(err));
1433
+ });
1434
+ }
1435
+ exports.updateItem = updateItem;
1436
+ /**
1437
+ * Updates a group.
1438
+ *
1439
+ * @param groupInfo The base info of a group; note that this content will be serialized, which doesn't work
1440
+ * for binary content
1441
+ * @param authentication Credentials for request
1442
+ * @param additionalParams Updates that are put under the `params` property, which is not serialized
1443
+ * @returns A Promise that will resolve with the success/failure status of the request
1444
+ */
1445
+ function updateGroup(groupInfo, authentication, additionalParams) {
1446
+ return new Promise((resolve, reject) => {
1447
+ const updateOptions = {
1448
+ group: groupInfo,
1449
+ authentication,
1450
+ params: {
1451
+ ...(additionalParams ?? {}),
1452
+ },
1453
+ };
1454
+ (0, arcgisRestJS_1.restUpdateGroup)(updateOptions).then((response) => (response.success ? resolve(response) : reject(response)), (err) => reject(err));
1455
+ });
1456
+ }
1457
+ exports.updateGroup = updateGroup;
1458
+ /**
1459
+ * Updates an item.
1460
+ *
1461
+ * @param itemInfo The base info of an item
1462
+ * @param data The items data section
1463
+ * @param authentication Credentials for requests
1464
+ * @param thumbnail optional thumbnail to update
1465
+ * @param access "public" or "org"
1466
+ * @return
1467
+ */
1468
+ function updateItemExtended(itemInfo, data, authentication, thumbnail, access, templateDictionary) {
1469
+ return new Promise((resolve, reject) => {
1470
+ const updateOptions = {
1471
+ item: itemInfo,
1472
+ params: {
1473
+ text: data || {}, // AGO ignores update if `data` is empty
1474
+ },
1475
+ authentication: authentication,
1476
+ };
1477
+ if (thumbnail) {
1478
+ updateOptions.params.thumbnail = thumbnail;
1479
+ }
1480
+ if ((0, trackingHelpers_1.isTrackingViewTemplate)(undefined, itemInfo) && templateDictionary) {
1481
+ updateOptions.owner = templateDictionary.locationTracking.owner;
1482
+ }
1483
+ (0, arcgisRestJS_1.restUpdateItem)(updateOptions).then((result) => {
1484
+ if (access && access !== "private") {
1485
+ // Set access if it is not AGOL default
1486
+ // Set the access manually since the access value in createItem appears to be ignored
1487
+ const accessOptions = {
1488
+ id: itemInfo.id,
1489
+ access: access === "public" ? "public" : "org",
1490
+ authentication: authentication,
1491
+ };
1492
+ (0, arcgisRestJS_1.setItemAccess)(accessOptions).then(() => resolve(result), (e) => reject((0, generalHelpers_1.fail)(e)));
1493
+ }
1494
+ else {
1495
+ resolve(result);
1496
+ }
1497
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
1498
+ });
1499
+ }
1500
+ exports.updateItemExtended = updateItemExtended;
1501
+ /**
1502
+ * Update an item's base and data using a dictionary.
1503
+ *
1504
+ * @param {string} itemId The item ID
1505
+ * @param {any} templateDictionary The template dictionary
1506
+ * @param {UserSession} authentication The destination session info
1507
+ * @returns Promise resolving to successfulness of update
1508
+ */
1509
+ function updateItemTemplateFromDictionary(itemId, templateDictionary, authentication) {
1510
+ return new Promise((resolve, reject) => {
1511
+ // Fetch the items as stored in AGO
1512
+ Promise.all([(0, restHelpersGet_1.getItemBase)(itemId, authentication), (0, restHelpersGet_1.getItemDataAsJson)(itemId, authentication)])
1513
+ .then(([item, data]) => {
1514
+ // Do they have any variables?
1515
+ if ((0, templatization_1.hasUnresolvedVariables)(item) || (0, templatization_1.hasUnresolvedVariables)(data)) {
1516
+ // Update if so
1517
+ const { item: updatedItem, data: updatedData } = (0, templatization_1.replaceInTemplate)({ item, data }, templateDictionary);
1518
+ _reportVariablesInItem(itemId, item.type, updatedItem, updatedData);
1519
+ return updateItemExtended(updatedItem, updatedData, authentication);
1520
+ }
1521
+ else {
1522
+ // Shortcut out if not
1523
+ return Promise.resolve({
1524
+ success: true,
1525
+ id: itemId,
1526
+ });
1527
+ }
1528
+ })
1529
+ .then((result) => resolve(result))
1530
+ .catch((error) => reject(error));
1531
+ });
1532
+ }
1533
+ exports.updateItemTemplateFromDictionary = updateItemTemplateFromDictionary;
1534
+ /**
1535
+ * Updates the URL of an item.
1536
+ *
1537
+ * @param id AGOL id of item to update
1538
+ * @param url URL to assign to item's base section
1539
+ * @param authentication Credentials for the request
1540
+ * @returns A promise that will resolve with the item id when the item has been updated or an AGO-style JSON failure
1541
+ * response
1542
+ */
1543
+ function updateItemURL(id, url, authentication) {
1544
+ const numAttempts = 3;
1545
+ return _updateItemURL(id, url, authentication, numAttempts);
1546
+ }
1547
+ exports.updateItemURL = updateItemURL;
1548
+ // ------------------------------------------------------------------------------------------------------------------ //
1549
+ /**
1550
+ * Adds a data section to an item.
1551
+ *
1552
+ * @param itemId Id of item to receive data file
1553
+ * @param dataFile Data to be added
1554
+ * @param authentication Credentials for the request
1555
+ * @returns Promise reporting success or failure
1556
+ * @private
1557
+ */
1558
+ function _addItemDataFile(itemId, dataFile, authentication) {
1559
+ return new Promise((resolve, reject) => {
1560
+ const _addItemData = (data) => {
1561
+ addItemData(itemId, data, authentication).then(resolve, reject);
1562
+ };
1563
+ // Item data has to be submitted as text or JSON for those file types
1564
+ if (dataFile.type.startsWith("text/plain")) {
1565
+ (0, generalHelpers_1.blobToText)(dataFile).then(_addItemData, reject);
1566
+ }
1567
+ else if (dataFile.type === "application/json") {
1568
+ (0, generalHelpers_1.blobToJson)(dataFile).then(_addItemData, reject);
1569
+ }
1570
+ else {
1571
+ _addItemData(dataFile);
1572
+ }
1573
+ });
1574
+ }
1575
+ exports._addItemDataFile = _addItemDataFile;
1576
+ /**
1577
+ * Adds a metadata file to an item.
1578
+ *
1579
+ * @param itemId Id of item to receive data file
1580
+ * @param metadataFile Metadata to be added
1581
+ * @param authentication Credentials for the request
1582
+ * @returns Promise reporting success or failure
1583
+ * @private
1584
+ */
1585
+ function _addItemMetadataFile(itemId, metadataFile, authentication) {
1586
+ return new Promise((resolve, reject) => {
1587
+ const addMetadataOptions = {
1588
+ item: {
1589
+ id: itemId,
1590
+ },
1591
+ params: {
1592
+ // Pass metadata in via params because item property is serialized, which discards a blob
1593
+ metadata: metadataFile,
1594
+ },
1595
+ authentication: authentication,
1596
+ };
1597
+ (0, arcgisRestJS_1.restUpdateItem)(addMetadataOptions).then(resolve, reject);
1598
+ });
1599
+ }
1600
+ exports._addItemMetadataFile = _addItemMetadataFile;
1601
+ /**
1602
+ * Accumulates the number of relationships in a collection of layers.
1603
+ *
1604
+ * @param List of layers to examine
1605
+ * @returns The number of relationships
1606
+ * @private
1607
+ */
1608
+ function _countRelationships(layers) {
1609
+ const reducer = (accumulator, currentLayer) => accumulator + (currentLayer.relationships ? currentLayer.relationships.length : 0);
1610
+ return layers.reduce(reducer, 0);
1611
+ }
1612
+ exports._countRelationships = _countRelationships;
1613
+ /**
1614
+ * Gets the full definitions of the layers affiliated with a hosted service.
1615
+ *
1616
+ * @param serviceUrl URL to hosted service
1617
+ * @param layerList List of layers at that service...must contain id
1618
+ * @param authentication Credentials for the request
1619
+ * @returns A promise that will resolve with a list of the layers from the admin api
1620
+ * @private
1621
+ */
1622
+ function _getCreateServiceOptions(newItemTemplate, authentication, templateDictionary) {
1623
+ return new Promise((resolve, reject) => {
1624
+ const serviceInfo = newItemTemplate.properties;
1625
+ const folderId = templateDictionary.folderId;
1626
+ const isPortal = templateDictionary.isPortal;
1627
+ const itemId = newItemTemplate.itemId;
1628
+ (0, featureServiceHelpers_1.validateSpatialReferenceAndExtent)(serviceInfo, newItemTemplate, templateDictionary);
1629
+ const fallbackExtent = _getFallbackExtent(serviceInfo, templateDictionary);
1630
+ const params = {};
1631
+ const itemInfo = {
1632
+ title: newItemTemplate.item.title,
1633
+ name: newItemTemplate.item.name,
1634
+ };
1635
+ const _item = {
1636
+ ...itemInfo,
1637
+ preserveLayerIds: true,
1638
+ };
1639
+ const createOptions = {
1640
+ item: _item,
1641
+ folderId,
1642
+ params,
1643
+ authentication: authentication,
1644
+ };
1645
+ createOptions.item = !(0, trackingHelpers_1.isTrackingViewTemplate)(newItemTemplate)
1646
+ ? _setItemProperties(createOptions.item, newItemTemplate, serviceInfo, params, isPortal)
1647
+ : (0, trackingHelpers_1.setTrackingOptions)(newItemTemplate, createOptions, templateDictionary);
1648
+ // project the portals extent to match that of the service
1649
+ convertExtentWithFallback(templateDictionary.organization.defaultExtent, fallbackExtent, serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
1650
+ templateDictionary[itemId].solutionExtent = extent;
1651
+ (0, featureServiceHelpers_1.setDefaultSpatialReference)(templateDictionary, itemId, extent.spatialReference);
1652
+ createOptions.item = (0, templatization_1.replaceInTemplate)(createOptions.item, templateDictionary);
1653
+ createOptions.params = (0, templatization_1.replaceInTemplate)(createOptions.params, templateDictionary);
1654
+ if (newItemTemplate.item.thumbnail) {
1655
+ // Pass thumbnail file in via params because item property is serialized, which discards a blob
1656
+ createOptions.params.thumbnail = newItemTemplate.item.thumbnail;
1657
+ }
1658
+ resolve(createOptions);
1659
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
1660
+ });
1661
+ }
1662
+ exports._getCreateServiceOptions = _getCreateServiceOptions;
1663
+ /**
1664
+ * When the services spatial reference does not match that of it's default extent
1665
+ * use the out SRs default extent if it exists in the templateDictionary
1666
+ * this should be set when adding a custom out wkid to the params before calling deploy
1667
+ * this will help avoid situations where the orgs default extent and default world extent
1668
+ * will not project successfully to the out SR
1669
+ *
1670
+ * @param serviceInfo the object that contains the spatial reference to evaluate
1671
+ * @param templateDictionary the template dictionary
1672
+ * @returns the extent to use as the fallback
1673
+ * @private
1674
+ */
1675
+ function _getFallbackExtent(serviceInfo, templateDictionary) {
1676
+ const serviceSR = serviceInfo.service.spatialReference;
1677
+ const serviceInfoWkid = (0, generalHelpers_1.getProp)(serviceInfo, "defaultExtent.spatialReference.wkid");
1678
+ const customDefaultExtent = (0, generalHelpers_1.getProp)(templateDictionary, "params.defaultExtent");
1679
+ return serviceInfoWkid && serviceInfoWkid === serviceSR.wkid
1680
+ ? serviceInfo.defaultExtent
1681
+ : customDefaultExtent
1682
+ ? customDefaultExtent
1683
+ : serviceInfo.defaultExtent;
1684
+ }
1685
+ exports._getFallbackExtent = _getFallbackExtent;
1686
+ /**
1687
+ * Add relationships to all layers in one call to retain fully functioning composite relationships
1688
+ *
1689
+ * @param args The IPostProcessArgs for the request(s)
1690
+ * @returns Any relationships that should be updated for the service
1691
+ * @private
1692
+ */
1693
+ function _getRelationshipUpdates(args) {
1694
+ const rels = {
1695
+ layers: [],
1696
+ };
1697
+ Object.keys(args.objects).forEach((k) => {
1698
+ const obj = args.objects[k];
1699
+ /* istanbul ignore else */
1700
+ if (obj.relationships && obj.relationships.length > 0) {
1701
+ rels.layers.push({
1702
+ id: obj.id,
1703
+ relationships: obj.relationships,
1704
+ });
1705
+ }
1706
+ (0, generalHelpers_1.deleteProp)(obj, "relationships");
1707
+ });
1708
+ return rels;
1709
+ }
1710
+ exports._getRelationshipUpdates = _getRelationshipUpdates;
1711
+ /**
1712
+ * Get the stored contingent values and structure them to be added to the services layers.
1713
+ *
1714
+ * @param args The IPostProcessArgs for the request(s)
1715
+ * @returns Any contingent values that should be added to the service.
1716
+ * @private
1717
+ */
1718
+ function _getContingentValuesUpdates(args) {
1719
+ const contingentValues = [];
1720
+ Object.keys(args.objects).forEach((k) => {
1721
+ const obj = args.objects[k];
1722
+ /* istanbul ignore else */
1723
+ if (obj.contingentValues) {
1724
+ contingentValues.push({
1725
+ id: obj.id,
1726
+ contingentValues: obj.contingentValues,
1727
+ });
1728
+ }
1729
+ (0, generalHelpers_1.deleteProp)(obj, "contingentValues");
1730
+ });
1731
+ return contingentValues;
1732
+ }
1733
+ exports._getContingentValuesUpdates = _getContingentValuesUpdates;
1734
+ /**
1735
+ * Get the stored subtype values and structure them to be added to the services layers.
1736
+ *
1737
+ * @param args The IPostProcessArgs for the request(s)
1738
+ * @returns Any subtype values that should be added to the service.
1739
+ * @private
1740
+ */
1741
+ function _getSubtypeUpdates(args) {
1742
+ const subtypeUpdates = [];
1743
+ Object.keys(args.objects).forEach((k) => {
1744
+ const obj = args.objects[k];
1745
+ /* istanbul ignore else */
1746
+ if (obj.subtypeField) {
1747
+ subtypeUpdates.push({
1748
+ id: obj.id,
1749
+ subtypeField: obj.subtypeField,
1750
+ subtypes: obj.subtypes,
1751
+ defaultSubtypeCode: obj.defaultSubtypeCode,
1752
+ });
1753
+ }
1754
+ (0, generalHelpers_1.deleteProp)(obj, "subtypeField");
1755
+ (0, generalHelpers_1.deleteProp)(obj, "subtypes");
1756
+ (0, generalHelpers_1.deleteProp)(obj, "defaultSubtypeCode");
1757
+ });
1758
+ return subtypeUpdates;
1759
+ }
1760
+ exports._getSubtypeUpdates = _getSubtypeUpdates;
1761
+ /**
1762
+ * Get refresh, add, update, or delete definition info
1763
+ *
1764
+ * @param url the base admin url for the service
1765
+ * @param id the id of the layer
1766
+ * @param obj parameters for the request
1767
+ * @param args various arguments to help support the request
1768
+ * @param type type of update the request will handle
1769
+ * @returns IUpdate that has the request url and arguments
1770
+ * @private
1771
+ */
1772
+ function _getUpdate(url, id, obj, args, type) {
1773
+ const ops = {
1774
+ delete: {
1775
+ url: (0, generalHelpers_1.checkUrlPathTermination)(url) + id + "/deleteFromDefinition",
1776
+ params: {
1777
+ deleteFromDefinition: {
1778
+ fields: obj && obj.hasOwnProperty("deleteFields") ? obj.deleteFields : [],
1779
+ },
1780
+ },
1781
+ },
1782
+ update: {
1783
+ url: (0, generalHelpers_1.checkUrlPathTermination)(url) + (id ? `${id}/updateDefinition` : "updateDefinition"),
1784
+ params: {
1785
+ updateDefinition: obj,
1786
+ },
1787
+ },
1788
+ add: {
1789
+ url: (0, generalHelpers_1.checkUrlPathTermination)(url) + "addToDefinition",
1790
+ params: {
1791
+ addToDefinition: obj,
1792
+ },
1793
+ },
1794
+ refresh: {
1795
+ url: (0, generalHelpers_1.checkUrlPathTermination)(url) + "refresh",
1796
+ params: {
1797
+ f: "json",
1798
+ },
1799
+ },
1800
+ };
1801
+ return {
1802
+ url: ops[type].url,
1803
+ params: ops[type].params,
1804
+ args: args,
1805
+ };
1806
+ }
1807
+ exports._getUpdate = _getUpdate;
1808
+ /**
1809
+ * Changes just the domain part of a URL to lowercase.
1810
+ *
1811
+ * @param url URL to modify
1812
+ * @return Adjusted URL
1813
+ * @see From `getServerRootUrl` in arcgis-rest-js' ArcGISIdentityManager.ts
1814
+ * @private
1815
+ */
1816
+ function _lowercaseDomain(url) {
1817
+ if (!url) {
1818
+ return url;
1819
+ }
1820
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1821
+ const [_, protocol, domainAndPath] = url.match(/(https?:\/\/)(.+)/);
1822
+ const [domain, ...path] = domainAndPath.split("/");
1823
+ // Only the domain is lowercased because in some cases an org id might be
1824
+ // in the path which cannot be lowercased.
1825
+ return `${protocol}${domain.toLowerCase()}/${path.join("/")}`;
1826
+ }
1827
+ exports._lowercaseDomain = _lowercaseDomain;
1828
+ /**
1829
+ * Checks the two main parts of an item for unresolved variables and reports any found.
1830
+ *
1831
+ * @param base Item's base section
1832
+ * @param data Item's data section
1833
+ * @private
1834
+ */
1835
+ function _reportVariablesInItem(itemId, itemType, base, data) {
1836
+ const getUnresolved = (v) => {
1837
+ return JSON.stringify(v).match(/{{.+?}}/gim);
1838
+ };
1839
+ // Provide feedback about any remaining unresolved variables
1840
+ /* istanbul ignore else */
1841
+ if (base && (0, templatization_1.hasUnresolvedVariables)(base)) {
1842
+ console.log(itemId + " (" + itemType + ") contains variables in base: " + JSON.stringify(getUnresolved(base)));
1843
+ }
1844
+ /* istanbul ignore else */
1845
+ if (data && (0, templatization_1.hasUnresolvedVariables)(data)) {
1846
+ console.log(itemId + " (" + itemType + ") contains variables in data: " + JSON.stringify(getUnresolved(data)));
1847
+ }
1848
+ }
1849
+ exports._reportVariablesInItem = _reportVariablesInItem;
1850
+ /**
1851
+ * Updates a feature service item.
1852
+ *
1853
+ * @param item Item to update
1854
+ * @param itemTemplate item template for the new item
1855
+ * @param serviceInfo Service information
1856
+ * @param params arcgis-rest-js params to update
1857
+ * @param isPortal Is the service hosted in a portal?
1858
+ * @returns Updated item
1859
+ * @private
1860
+ */
1861
+ function _setItemProperties(item, itemTemplate, serviceInfo, params, isPortal) {
1862
+ // Set the capabilities
1863
+ const portalCapabilities = ["Create", "Query", "Editing", "Update", "Delete", "Uploads", "Sync", "Extract"];
1864
+ const capabilities = (0, generalHelpers_1.getProp)(serviceInfo, "service.capabilities") || (isPortal ? "" : []);
1865
+ item.capabilities = isPortal
1866
+ ? capabilities
1867
+ .split(",")
1868
+ .filter((c) => portalCapabilities.indexOf(c) > -1)
1869
+ .join(",")
1870
+ : capabilities;
1871
+ if (serviceInfo.service.capabilities) {
1872
+ serviceInfo.service.capabilities = item.capabilities;
1873
+ }
1874
+ // Handle index update for any pre-published solution items that
1875
+ // have non-unique indexes on relationship key fields
1876
+ _updateIndexesForRelationshipKeyFields(serviceInfo);
1877
+ // set create options item properties
1878
+ const keyProperties = [
1879
+ "isView",
1880
+ "sourceSchemaChangesAllowed",
1881
+ "isUpdatableView",
1882
+ "capabilities",
1883
+ "isMultiServicesView",
1884
+ ];
1885
+ const deleteKeys = ["layers", "tables"];
1886
+ /* istanbul ignore else */
1887
+ if (isPortal) {
1888
+ // removed for issue #423 causing FS to fail to create
1889
+ deleteKeys.push("adminServiceInfo");
1890
+ }
1891
+ const itemKeys = Object.keys(item);
1892
+ const serviceKeys = Object.keys(serviceInfo.service);
1893
+ serviceKeys.forEach((k) => {
1894
+ /* istanbul ignore else */
1895
+ if (itemKeys.indexOf(k) === -1 && deleteKeys.indexOf(k) < 0) {
1896
+ item[k] = serviceInfo.service[k];
1897
+ // These need to be included via params otherwise...
1898
+ // addToDef calls fail when adding adminLayerInfo
1899
+ /* istanbul ignore else */
1900
+ if (serviceInfo.service.isView && keyProperties.indexOf(k) > -1) {
1901
+ params[k] = serviceInfo.service[k];
1902
+ }
1903
+ }
1904
+ });
1905
+ // Enable editor tracking on layer with related tables is not supported.
1906
+ /* istanbul ignore else */
1907
+ if (item.isMultiServicesView && (0, generalHelpers_1.getProp)(item, "editorTrackingInfo.enableEditorTracking")) {
1908
+ item.editorTrackingInfo.enableEditorTracking = false;
1909
+ params["editorTrackingInfo"] = item.editorTrackingInfo;
1910
+ }
1911
+ /* istanbul ignore else */
1912
+ if (isPortal) {
1913
+ // portal will fail when initialExtent is defined but null
1914
+ // removed for issue #449 causing FS to fail to create on portal
1915
+ /* istanbul ignore else */
1916
+ if (Object.keys(item).indexOf("initialExtent") > -1 && !item.initialExtent) {
1917
+ (0, generalHelpers_1.deleteProp)(item, "initialExtent");
1918
+ }
1919
+ }
1920
+ return item;
1921
+ }
1922
+ exports._setItemProperties = _setItemProperties;
1923
+ /**
1924
+ * Set isUnique as true for indexes that reference origin relationship keyFields.
1925
+ *
1926
+ * @param serviceInfo Service information
1927
+ * @private
1928
+ */
1929
+ function _updateIndexesForRelationshipKeyFields(serviceInfo) {
1930
+ const layersAndTables = (serviceInfo.layers || []).concat(serviceInfo.tables || []);
1931
+ layersAndTables.forEach((item) => {
1932
+ const relationships = item.relationships;
1933
+ const indexes = item.indexes;
1934
+ /* istanbul ignore else */
1935
+ if (relationships && relationships.length > 0 && indexes && indexes.length > 0) {
1936
+ const keyFields = relationships.reduce((acc, v) => {
1937
+ /* istanbul ignore else */
1938
+ if (v.role === "esriRelRoleOrigin" && v.keyField && acc.indexOf(v.keyField) < 0) {
1939
+ acc.push(v.keyField);
1940
+ }
1941
+ return acc;
1942
+ }, []);
1943
+ indexes.map((i) => {
1944
+ /* istanbul ignore else */
1945
+ if (keyFields.some((k) => {
1946
+ const regEx = new RegExp(`\\b${k}\\b`);
1947
+ return regEx.test(i.fields);
1948
+ })) {
1949
+ i.isUnique = true;
1950
+ }
1951
+ return i;
1952
+ });
1953
+ }
1954
+ });
1955
+ }
1956
+ exports._updateIndexesForRelationshipKeyFields = _updateIndexesForRelationshipKeyFields;
1957
+ /**
1958
+ * Updates the URL of an item.
1959
+ *
1960
+ * @param id AGOL id of item to update
1961
+ * @param url URL to assign to item's base section
1962
+ * @param authentication Credentials for the request
1963
+ * @param numAttempts Number of times to try to set the URL if AGO says that it updated the URL, but really didn't
1964
+ * @returns A promise that will resolve with the item id when the item has been updated or an AGO-style JSON failure
1965
+ * response
1966
+ * @private
1967
+ */
1968
+ function _updateItemURL(id, url, authentication, numAttempts = 1) {
1969
+ // Introduce a lag because AGO update appears to choke with rapid subsequent calls
1970
+ const msLag = 1000;
1971
+ return new Promise((resolve, reject) => {
1972
+ // Update the item's URL
1973
+ const options = { item: { id, url }, authentication: authentication };
1974
+ (0, arcgisRestJS_1.restUpdateItem)(options).then((result) => {
1975
+ if (!result.success) {
1976
+ reject((0, generalHelpers_1.fail)(result));
1977
+ }
1978
+ else {
1979
+ // Get the item to see if the URL really changed; we'll delay a bit before testing because AGO
1980
+ // has a timing problem with URL updates
1981
+ setTimeout(() => {
1982
+ (0, arcgisRestJS_1.getItem)(id, { authentication: authentication }).then((item) => {
1983
+ const iBrace = item.url.indexOf("{");
1984
+ if (iBrace > -1) {
1985
+ console.warn(id + " has template variable: " + item.url.substr(iBrace));
1986
+ }
1987
+ if (url === item.url) {
1988
+ resolve(id);
1989
+ }
1990
+ else {
1991
+ // If it fails, try again if we have sufficient attempts remaining
1992
+ const errorMsg = "URL not updated for " + item.type + " " + item.id + ": " + item.url + " (" + numAttempts + ")";
1993
+ if (--numAttempts > 0) {
1994
+ _updateItemURL(id, url, authentication, numAttempts).then(resolve, reject);
1995
+ }
1996
+ else {
1997
+ console.error(id + ": " + errorMsg + "; FAILED");
1998
+ reject(errorMsg);
1999
+ }
2000
+ }
2001
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
2002
+ }, msLag);
2003
+ }
2004
+ }, (e) => reject((0, generalHelpers_1.fail)(e)));
2005
+ });
2006
+ }
2007
+ exports._updateItemURL = _updateItemURL;
2008
+ //# sourceMappingURL=restHelpers.js.map