@esri/solution-common 5.2.1 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +4 -7
  2. package/dist/esm/completeItem.js +3 -3
  3. package/dist/esm/completeItem.js.map +1 -1
  4. package/dist/esm/formHelpers.d.ts +41 -0
  5. package/dist/esm/formHelpers.js +71 -0
  6. package/dist/esm/formHelpers.js.map +1 -0
  7. package/dist/esm/generalHelpers.d.ts +33 -0
  8. package/dist/esm/generalHelpers.js +44 -1
  9. package/dist/esm/generalHelpers.js.map +1 -1
  10. package/dist/esm/index.d.ts +2 -0
  11. package/dist/esm/index.js +2 -0
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/interfaces.d.ts +19 -1
  14. package/dist/esm/interfaces.js.map +1 -1
  15. package/dist/esm/restHelpers.d.ts +10 -1
  16. package/dist/esm/restHelpers.js +25 -1
  17. package/dist/esm/restHelpers.js.map +1 -1
  18. package/dist/esm/templatization.js +5 -3
  19. package/dist/esm/templatization.js.map +1 -1
  20. package/dist/esm/workflowHelpers.d.ts +21 -1
  21. package/dist/esm/workflowHelpers.js +48 -48
  22. package/dist/esm/workflowHelpers.js.map +1 -1
  23. package/dist/esm/zip-utils.d.ts +44 -17
  24. package/dist/esm/zip-utils.js +73 -24
  25. package/dist/esm/zip-utils.js.map +1 -1
  26. package/package.json +3 -3
  27. package/dist/cjs/completeItem.d.ts +0 -29
  28. package/dist/cjs/completeItem.js +0 -92
  29. package/dist/cjs/completeItem.js.map +0 -1
  30. package/dist/cjs/create-hub-request-options.d.ts +0 -29
  31. package/dist/cjs/create-hub-request-options.js +0 -64
  32. package/dist/cjs/create-hub-request-options.js.map +0 -1
  33. package/dist/cjs/deleteHelpers/deleteEmptyGroups.d.ts +0 -24
  34. package/dist/cjs/deleteHelpers/deleteEmptyGroups.js +0 -42
  35. package/dist/cjs/deleteHelpers/deleteEmptyGroups.js.map +0 -1
  36. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.d.ts +0 -27
  37. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js +0 -97
  38. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js.map +0 -1
  39. package/dist/cjs/deleteHelpers/deleteSolutionContents.d.ts +0 -38
  40. package/dist/cjs/deleteHelpers/deleteSolutionContents.js +0 -130
  41. package/dist/cjs/deleteHelpers/deleteSolutionContents.js.map +0 -1
  42. package/dist/cjs/deleteHelpers/deleteSolutionFolder.d.ts +0 -29
  43. package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +0 -79
  44. package/dist/cjs/deleteHelpers/deleteSolutionFolder.js.map +0 -1
  45. package/dist/cjs/deleteHelpers/deleteSolutionItem.d.ts +0 -30
  46. package/dist/cjs/deleteHelpers/deleteSolutionItem.js +0 -54
  47. package/dist/cjs/deleteHelpers/deleteSolutionItem.js.map +0 -1
  48. package/dist/cjs/deleteHelpers/index.d.ts +0 -22
  49. package/dist/cjs/deleteHelpers/index.js +0 -26
  50. package/dist/cjs/deleteHelpers/index.js.map +0 -1
  51. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.d.ts +0 -27
  52. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js +0 -34
  53. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js.map +0 -1
  54. package/dist/cjs/deleteHelpers/removeItems.d.ts +0 -34
  55. package/dist/cjs/deleteHelpers/removeItems.js +0 -112
  56. package/dist/cjs/deleteHelpers/removeItems.js.map +0 -1
  57. package/dist/cjs/deleteHelpers/reportProgress.d.ts +0 -27
  58. package/dist/cjs/deleteHelpers/reportProgress.js +0 -46
  59. package/dist/cjs/deleteHelpers/reportProgress.js.map +0 -1
  60. package/dist/cjs/deleteSolution.d.ts +0 -55
  61. package/dist/cjs/deleteSolution.js +0 -107
  62. package/dist/cjs/deleteSolution.js.map +0 -1
  63. package/dist/cjs/dependencies.d.ts +0 -26
  64. package/dist/cjs/dependencies.js +0 -171
  65. package/dist/cjs/dependencies.js.map +0 -1
  66. package/dist/cjs/featureServiceHelpers.d.ts +0 -799
  67. package/dist/cjs/featureServiceHelpers.js +0 -2438
  68. package/dist/cjs/featureServiceHelpers.js.map +0 -1
  69. package/dist/cjs/generalHelpers.d.ts +0 -400
  70. package/dist/cjs/generalHelpers.js +0 -877
  71. package/dist/cjs/generalHelpers.js.map +0 -1
  72. package/dist/cjs/get-subscription-info.d.ts +0 -27
  73. package/dist/cjs/get-subscription-info.js +0 -39
  74. package/dist/cjs/get-subscription-info.js.map +0 -1
  75. package/dist/cjs/getDeletableSolutionInfo.d.ts +0 -29
  76. package/dist/cjs/getDeletableSolutionInfo.js +0 -53
  77. package/dist/cjs/getDeletableSolutionInfo.js.map +0 -1
  78. package/dist/cjs/getItemTypeAbbrev.d.ts +0 -19
  79. package/dist/cjs/getItemTypeAbbrev.js +0 -186
  80. package/dist/cjs/getItemTypeAbbrev.js.map +0 -1
  81. package/dist/cjs/getSolutionSummary.d.ts +0 -27
  82. package/dist/cjs/getSolutionSummary.js +0 -101
  83. package/dist/cjs/getSolutionSummary.js.map +0 -1
  84. package/dist/cjs/index.d.ts +0 -44
  85. package/dist/cjs/index.js +0 -48
  86. package/dist/cjs/index.js.map +0 -1
  87. package/dist/cjs/interfaces.d.ts +0 -1344
  88. package/dist/cjs/interfaces.js +0 -77
  89. package/dist/cjs/interfaces.js.map +0 -1
  90. package/dist/cjs/libConnectors.d.ts +0 -73
  91. package/dist/cjs/libConnectors.js +0 -115
  92. package/dist/cjs/libConnectors.js.map +0 -1
  93. package/dist/cjs/migrations/apply-schema.d.ts +0 -24
  94. package/dist/cjs/migrations/apply-schema.js +0 -36
  95. package/dist/cjs/migrations/apply-schema.js.map +0 -1
  96. package/dist/cjs/migrations/is-legacy-solution.d.ts +0 -24
  97. package/dist/cjs/migrations/is-legacy-solution.js +0 -40
  98. package/dist/cjs/migrations/is-legacy-solution.js.map +0 -1
  99. package/dist/cjs/migrations/upgrade-three-dot-one.d.ts +0 -27
  100. package/dist/cjs/migrations/upgrade-three-dot-one.js +0 -49
  101. package/dist/cjs/migrations/upgrade-three-dot-one.js.map +0 -1
  102. package/dist/cjs/migrations/upgrade-three-dot-zero.d.ts +0 -27
  103. package/dist/cjs/migrations/upgrade-three-dot-zero.js +0 -43
  104. package/dist/cjs/migrations/upgrade-three-dot-zero.js.map +0 -1
  105. package/dist/cjs/migrations/upgrade-two-dot-five.d.ts +0 -24
  106. package/dist/cjs/migrations/upgrade-two-dot-five.js +0 -73
  107. package/dist/cjs/migrations/upgrade-two-dot-five.js.map +0 -1
  108. package/dist/cjs/migrations/upgrade-two-dot-four.d.ts +0 -24
  109. package/dist/cjs/migrations/upgrade-two-dot-four.js +0 -72
  110. package/dist/cjs/migrations/upgrade-two-dot-four.js.map +0 -1
  111. package/dist/cjs/migrations/upgrade-two-dot-one.d.ts +0 -7
  112. package/dist/cjs/migrations/upgrade-two-dot-one.js +0 -39
  113. package/dist/cjs/migrations/upgrade-two-dot-one.js.map +0 -1
  114. package/dist/cjs/migrations/upgrade-two-dot-seven.d.ts +0 -23
  115. package/dist/cjs/migrations/upgrade-two-dot-seven.js +0 -58
  116. package/dist/cjs/migrations/upgrade-two-dot-seven.js.map +0 -1
  117. package/dist/cjs/migrations/upgrade-two-dot-six.d.ts +0 -27
  118. package/dist/cjs/migrations/upgrade-two-dot-six.js +0 -61
  119. package/dist/cjs/migrations/upgrade-two-dot-six.js.map +0 -1
  120. package/dist/cjs/migrations/upgrade-two-dot-three.d.ts +0 -23
  121. package/dist/cjs/migrations/upgrade-two-dot-three.js +0 -55
  122. package/dist/cjs/migrations/upgrade-two-dot-three.js.map +0 -1
  123. package/dist/cjs/migrations/upgrade-two-dot-two.d.ts +0 -23
  124. package/dist/cjs/migrations/upgrade-two-dot-two.js +0 -58
  125. package/dist/cjs/migrations/upgrade-two-dot-two.js.map +0 -1
  126. package/dist/cjs/migrations/upgrade-two-dot-zero.d.ts +0 -44
  127. package/dist/cjs/migrations/upgrade-two-dot-zero.js +0 -95
  128. package/dist/cjs/migrations/upgrade-two-dot-zero.js.map +0 -1
  129. package/dist/cjs/migrator.d.ts +0 -25
  130. package/dist/cjs/migrator.js +0 -77
  131. package/dist/cjs/migrator.js.map +0 -1
  132. package/dist/cjs/resourceHelpers.d.ts +0 -191
  133. package/dist/cjs/resourceHelpers.js +0 -384
  134. package/dist/cjs/resourceHelpers.js.map +0 -1
  135. package/dist/cjs/resources/add-resource-from-blob.d.ts +0 -26
  136. package/dist/cjs/resources/add-resource-from-blob.js +0 -52
  137. package/dist/cjs/resources/add-resource-from-blob.js.map +0 -1
  138. package/dist/cjs/resources/addMetadataFromBlob.d.ts +0 -25
  139. package/dist/cjs/resources/addMetadataFromBlob.js +0 -43
  140. package/dist/cjs/resources/addMetadataFromBlob.js.map +0 -1
  141. package/dist/cjs/resources/convert-item-resource-to-storage-resource.d.ts +0 -32
  142. package/dist/cjs/resources/convert-item-resource-to-storage-resource.js +0 -70
  143. package/dist/cjs/resources/convert-item-resource-to-storage-resource.js.map +0 -1
  144. package/dist/cjs/resources/convert-storage-resource-to-item-resource.d.ts +0 -29
  145. package/dist/cjs/resources/convert-storage-resource-to-item-resource.js +0 -70
  146. package/dist/cjs/resources/convert-storage-resource-to-item-resource.js.map +0 -1
  147. package/dist/cjs/resources/copyAssociatedFiles.d.ts +0 -67
  148. package/dist/cjs/resources/copyAssociatedFiles.js +0 -304
  149. package/dist/cjs/resources/copyAssociatedFiles.js.map +0 -1
  150. package/dist/cjs/resources/copyDataIntoItem.d.ts +0 -33
  151. package/dist/cjs/resources/copyDataIntoItem.js +0 -62
  152. package/dist/cjs/resources/copyDataIntoItem.js.map +0 -1
  153. package/dist/cjs/resources/copyMetadataIntoItem.d.ts +0 -26
  154. package/dist/cjs/resources/copyMetadataIntoItem.js +0 -46
  155. package/dist/cjs/resources/copyMetadataIntoItem.js.map +0 -1
  156. package/dist/cjs/resources/copyResourceIntoZip.d.ts +0 -33
  157. package/dist/cjs/resources/copyResourceIntoZip.js +0 -78
  158. package/dist/cjs/resources/copyResourceIntoZip.js.map +0 -1
  159. package/dist/cjs/resources/copyZipIntoItem.d.ts +0 -25
  160. package/dist/cjs/resources/copyZipIntoItem.js +0 -54
  161. package/dist/cjs/resources/copyZipIntoItem.js.map +0 -1
  162. package/dist/cjs/resources/createCopyResults.d.ts +0 -25
  163. package/dist/cjs/resources/createCopyResults.js +0 -36
  164. package/dist/cjs/resources/createCopyResults.js.map +0 -1
  165. package/dist/cjs/resources/get-blob.d.ts +0 -26
  166. package/dist/cjs/resources/get-blob.js +0 -27
  167. package/dist/cjs/resources/get-blob.js.map +0 -1
  168. package/dist/cjs/resources/getItemResourcesFilesFromPaths.d.ts +0 -24
  169. package/dist/cjs/resources/getItemResourcesFilesFromPaths.js +0 -49
  170. package/dist/cjs/resources/getItemResourcesFilesFromPaths.js.map +0 -1
  171. package/dist/cjs/resources/getItemResourcesPaths.d.ts +0 -26
  172. package/dist/cjs/resources/getItemResourcesPaths.js +0 -76
  173. package/dist/cjs/resources/getItemResourcesPaths.js.map +0 -1
  174. package/dist/cjs/resources/index.d.ts +0 -29
  175. package/dist/cjs/resources/index.js +0 -33
  176. package/dist/cjs/resources/index.js.map +0 -1
  177. package/dist/cjs/resources/solution-resource.d.ts +0 -35
  178. package/dist/cjs/resources/solution-resource.js +0 -31
  179. package/dist/cjs/resources/solution-resource.js.map +0 -1
  180. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.d.ts +0 -56
  181. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js +0 -146
  182. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js.map +0 -1
  183. package/dist/cjs/restHelpers.d.ts +0 -598
  184. package/dist/cjs/restHelpers.js +0 -1929
  185. package/dist/cjs/restHelpers.js.map +0 -1
  186. package/dist/cjs/restHelpersGet.d.ts +0 -288
  187. package/dist/cjs/restHelpersGet.js +0 -804
  188. package/dist/cjs/restHelpersGet.js.map +0 -1
  189. package/dist/cjs/sharing/index.d.ts +0 -16
  190. package/dist/cjs/sharing/index.js +0 -20
  191. package/dist/cjs/sharing/index.js.map +0 -1
  192. package/dist/cjs/sharing/share-item-to-groups.d.ts +0 -26
  193. package/dist/cjs/sharing/share-item-to-groups.js +0 -44
  194. package/dist/cjs/sharing/share-item-to-groups.js.map +0 -1
  195. package/dist/cjs/templatization.d.ts +0 -139
  196. package/dist/cjs/templatization.js +0 -314
  197. package/dist/cjs/templatization.js.map +0 -1
  198. package/dist/cjs/trackingHelpers.d.ts +0 -116
  199. package/dist/cjs/trackingHelpers.js +0 -217
  200. package/dist/cjs/trackingHelpers.js.map +0 -1
  201. package/dist/cjs/velocityHelpers.d.ts +0 -57
  202. package/dist/cjs/velocityHelpers.js +0 -135
  203. package/dist/cjs/velocityHelpers.js.map +0 -1
  204. package/dist/cjs/workflowHelpers.d.ts +0 -17
  205. package/dist/cjs/workflowHelpers.js +0 -76
  206. package/dist/cjs/workflowHelpers.js.map +0 -1
  207. package/dist/cjs/workforceHelpers.d.ts +0 -115
  208. package/dist/cjs/workforceHelpers.js +0 -749
  209. package/dist/cjs/workforceHelpers.js.map +0 -1
  210. package/dist/cjs/zip-utils.d.ts +0 -49
  211. package/dist/cjs/zip-utils.js +0 -89
  212. package/dist/cjs/zip-utils.js.map +0 -1
@@ -15,24 +15,34 @@
15
15
  */
16
16
  import JSZip from "jszip";
17
17
  import { createMimeTypedFile } from "./resources/copyDataIntoItem";
18
- import { updateItem } from "./restHelpers";
18
+ import { getBlob } from "./resources/get-blob";
19
19
  // ------------------------------------------------------------------------------------------------------------------ //
20
20
  /**
21
21
  * Converts a blob to a zip file.
22
22
  *
23
23
  * @param blob Blob to convert
24
- * @returns Promise resolving to zip file
24
+ * @returns Promise resolving to zip object
25
25
  */
26
- export async function blobToZip(blob) {
27
- const zip = new JSZip();
28
- return zip.loadAsync(blob)
29
- .then(async (zip) => {
30
- return Promise.resolve(zip);
26
+ export async function blobToZipObject(blob) {
27
+ const zipObject = new JSZip();
28
+ return zipObject.loadAsync(blob)
29
+ .then(async (zipObject) => {
30
+ return Promise.resolve(zipObject);
31
31
  })
32
32
  .catch(() => {
33
33
  return Promise.reject();
34
34
  });
35
35
  }
36
+ /**
37
+ * Fetches a zip object.
38
+ *
39
+ * @param formZipFilePath Path to the zip file
40
+ * @param authentication Credentials to zip file
41
+ * @returns Promise resolving to zip object
42
+ */
43
+ export async function fetchZipObject(formZipFilePath, authentication) {
44
+ return blobToZipObject(await getBlob(formZipFilePath, authentication));
45
+ }
36
46
  /**
37
47
  * Gets the contents of the files in the zip.
38
48
  *
@@ -40,10 +50,10 @@ export async function blobToZip(blob) {
40
50
  * @param filesOfInterest Array of file names to extract from the zip file. If empty, all files are extracted.
41
51
  * @returns Promise that resolves to an array of objects containing the file name and contents
42
52
  */
43
- export async function getZipFileContents(zip, filesOfInterest = []) {
53
+ export async function getZipObjectContents(zipObject, filesOfInterest = []) {
44
54
  const extractedZipFiles = [];
45
55
  const fileContentsRetrievalPromises = [];
46
- zip.forEach((relativePath, file) => {
56
+ zipObject.forEach((relativePath, file) => {
47
57
  const getContents = async () => {
48
58
  if (filesOfInterest.length === 0 || filesOfInterest.includes(relativePath)) {
49
59
  const fileContentsFetch = file.async('string');
@@ -60,23 +70,62 @@ export async function getZipFileContents(zip, filesOfInterest = []) {
60
70
  return extractedZipFiles;
61
71
  }
62
72
  /**
63
- * Updates an item with a zip file.
73
+ * Converts a JSON object to a zip object.
64
74
  *
65
- * @param zip Zip file with which to update the item
66
- * @param destinationItemId Destination item id
67
- * @param destinationAuthentication Destination authentication
75
+ * @param zippedFileName Name of the file in the zip
76
+ * @param zippedFileJson JSON object to convert
77
+ * @returns Promise resolving to zip object
78
+ */
79
+ export async function jsonToZipObject(zippedFileName, zippedFileJson) {
80
+ const zipObject = new JSZip();
81
+ zipObject.file(zippedFileName, JSON.stringify(zippedFileJson));
82
+ return Promise.resolve(zipObject);
83
+ }
84
+ /**
85
+ * Converts a JSON object to a zip file.
86
+ *
87
+ * @param zippedFileName Name of the file in the zip file
88
+ * @param zippedFileJson JSON object to convert
89
+ * @param filename Name to use for zip file; ".zip" added if missing
90
+ * @returns Promise resolving to zip file
91
+ */
92
+ export async function jsonToZipFile(zippedFileName, zippedFileJson, filename) {
93
+ const zipObject = await jsonToZipObject(zippedFileName, zippedFileJson);
94
+ return zipObjectToZipFile(zipObject, filename);
95
+ }
96
+ /**
97
+ * Extracts files of interest from a zip object, calls a supplied function to modify them, and
98
+ * restores the files into the zip object.
99
+ *
100
+ * @param modificationCallback Function that modifies the specified files
101
+ * @param zip Zip file that contains the files to modify; modified in place
68
102
  * @param filesOfInterest Array of file names to extract from the zip file. If empty, all files are extracted.
69
- * @returns Promise that resolves to the update item response
103
+ * @returns Promise that resolves to the modified zip file if the swizzle was successful
104
+ */
105
+ export async function modifyFilesinZipObject(modificationCallback, zipObject, filesOfInterest = []) {
106
+ // Get the contents of the form.json file
107
+ const extractedZipFiles = await getZipObjectContents(zipObject, filesOfInterest);
108
+ extractedZipFiles.forEach((extractedZipFile) => {
109
+ // Run the modification callback
110
+ const content = modificationCallback(extractedZipFile);
111
+ // Update the zip file
112
+ zipObject.file(extractedZipFile.file, content);
113
+ });
114
+ return Promise.resolve(zipObject);
115
+ }
116
+ /**
117
+ * Converts a zip object to a zip file.
118
+ *
119
+ * @param zipObject Zip object
120
+ * @param filename Name to use for zip file; ".zip" added if missing
121
+ * @returns Promise resolving to zip file
70
122
  */
71
- export async function updateItemWithZip(zip, destinationItemId, destinationAuthentication) {
72
- const update = {
73
- id: destinationItemId,
74
- data: createMimeTypedFile({
75
- blob: await zip.generateAsync({ type: "blob" }),
76
- filename: `${destinationItemId}.zip`,
77
- mimeType: "application/zip"
78
- })
79
- };
80
- return updateItem(update, destinationAuthentication);
123
+ export async function zipObjectToZipFile(zipObject, filename) {
124
+ const completeFilename = filename.endsWith(".zip") ? filename : `${filename}.zip`;
125
+ return createMimeTypedFile({
126
+ blob: await zipObject.generateAsync({ type: "blob" }),
127
+ filename: completeFilename,
128
+ mimeType: "application/zip"
129
+ });
81
130
  }
82
131
  //# sourceMappingURL=zip-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zip-utils.js","sourceRoot":"","sources":["../../src/zip-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAW3C,wHAAwH;AAExH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAU;IAEV,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;IACxB,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;SACzB,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAClB,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAU,EACV,kBAA4B,EAAE;IAE9B,MAAM,iBAAiB,GAAsB,EAAE,CAAC;IAChD,MAAM,6BAA6B,GAA2B,EAAE,CAAC;IACjE,GAAG,CAAC,OAAO,CACT,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;YAC7B,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBAC1E,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC/C,6BAA6B,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBACtD,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Q,EAAE,iBAAiB;KAC5B,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-common",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "description": "Provides general helper functions for @esri/solution.js.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,7 +23,7 @@
23
23
  "@esri/arcgis-rest-portal": "^3.7.0",
24
24
  "@esri/arcgis-rest-request": "^3.7.0",
25
25
  "@esri/arcgis-rest-service-admin": "^3.7.0",
26
- "@esri/hub-common": "^14.74.1",
26
+ "@esri/hub-common": "^14.97.0",
27
27
  "@esri/hub-initiatives": "^14.0.0",
28
28
  "@esri/hub-sites": "^14.2.2",
29
29
  "@esri/hub-teams": "^14.1.0",
@@ -92,5 +92,5 @@
92
92
  "esri",
93
93
  "ES6"
94
94
  ],
95
- "gitHead": "0f2bb444de46482baa42621310bc4e8d94bcd11a"
95
+ "gitHead": "bcf0907f47cf8a2970f8da38f8e1e2a4ac7beccb"
96
96
  }
@@ -1,29 +0,0 @@
1
- /** @license
2
- * Copyright 2021 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Provides functions for accessing a complete item.
18
- *
19
- * @module completeItem
20
- */
21
- import { ICompleteItem, UserSession } from "./interfaces";
22
- /**
23
- * Gets everything about an item.
24
- *
25
- * @param itemId Id of an item whose information is sought
26
- * @param authentication Credentials for the request
27
- * @returns Promise that will resolve with everything known about the item
28
- */
29
- export declare function getCompleteItem(itemId: string, authentication: UserSession): Promise<ICompleteItem>;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2021 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getCompleteItem = void 0;
19
- const tslib_1 = require("tslib");
20
- const restHelpers = tslib_1.__importStar(require("./restHelpers"));
21
- const restHelpersGet = tslib_1.__importStar(require("./restHelpersGet"));
22
- const workflowHelpers = tslib_1.__importStar(require("./workflowHelpers"));
23
- // ------------------------------------------------------------------------------------------------------------------ //
24
- /**
25
- * Gets everything about an item.
26
- *
27
- * @param itemId Id of an item whose information is sought
28
- * @param authentication Credentials for the request
29
- * @returns Promise that will resolve with everything known about the item
30
- */
31
- function getCompleteItem(itemId, authentication) {
32
- let itemBase;
33
- let completeItem;
34
- return restHelpersGet
35
- .getItemBase(itemId, authentication)
36
- .then((response) => {
37
- itemBase = response;
38
- return Promise.all([
39
- restHelpersGet.getItemDataAsFile(itemId, itemBase.name, authentication),
40
- restHelpersGet.getItemThumbnailAsFile(itemId, itemBase.thumbnail, false, authentication),
41
- restHelpersGet.getItemMetadataAsFile(itemId, authentication),
42
- restHelpersGet.getItemResourcesFiles(itemId, authentication),
43
- restHelpersGet.getItemRelatedItemsInSameDirection(itemId, "forward", authentication),
44
- restHelpersGet.getItemRelatedItemsInSameDirection(itemId, "reverse", authentication)
45
- ]);
46
- })
47
- .then(responses => {
48
- const [itemData, itemThumbnail, itemMetadata, itemResources, itemFwdRelatedItems, itemRevRelatedItems] = responses;
49
- // Summarize what we have
50
- // ----------------------
51
- // (itemBase: IItem) text/plain JSON
52
- // (itemData: File) */*
53
- // (itemThumbnail: File) image/*
54
- // (itemMetadata: File) application/xml
55
- // (itemResources: File[]) list of */*
56
- // (itemFwdRelatedItems: IRelatedItems[]) list of forward relationshipType/relatedItems[] pairs
57
- // (itemRevRelatedItems: IRelatedItems[]) list of reverse relationshipType/relatedItems[] pairs
58
- completeItem = {
59
- base: itemBase,
60
- data: itemData,
61
- thumbnail: itemThumbnail,
62
- metadata: itemMetadata,
63
- resources: itemResources,
64
- fwdRelatedItems: itemFwdRelatedItems,
65
- revRelatedItems: itemRevRelatedItems
66
- };
67
- if (itemBase.type === "Feature Service") {
68
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
69
- return restHelpers.getFeatureServiceProperties(itemBase.url, authentication);
70
- }
71
- else if (itemBase.type === "Workflow") {
72
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
73
- return restHelpers.getWorkflowConfiguration(itemBase.id, authentication);
74
- }
75
- else {
76
- return Promise.resolve(null);
77
- }
78
- })
79
- .then((properties) => {
80
- if (properties) {
81
- if (completeItem.base.type === "Feature Service") {
82
- completeItem.featureServiceProperties = properties;
83
- }
84
- else if (completeItem.base.type === "Workflow") {
85
- completeItem.workflowConfiguration = workflowHelpers.extractWorkflowFromZipFile(properties);
86
- }
87
- }
88
- return Promise.resolve(completeItem);
89
- });
90
- }
91
- exports.getCompleteItem = getCompleteItem;
92
- //# sourceMappingURL=completeItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"completeItem.js","sourceRoot":"","sources":["../../src/completeItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAaH,mEAA6C;AAC7C,yEAAmD;AACnD,2EAAqD;AAErD,wHAAwH;AAExH;;;;;;GAMG;AACH,SAAgB,eAAe,CAC7B,MAAc,EACd,cAA2B;IAE3B,IAAI,QAAa,CAAC;IAClB,IAAI,YAAiB,CAAC;IAEtB,OAAO,cAAc;SAClB,WAAW,CAAC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QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE;YACvC,mEAAmE;YACnE,OAAO,WAAW,CAAC,wBAAwB,CACzC,QAAQ,CAAC,EAAE,EACX,cAAc,CACf,CAAC;SAEH;aAAM;YACL,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,UAA2C,EAAE,EAAE;QACpD,IAAI,UAAU,EAAE;YACd,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,EAAE;gBAChD,YAAY,CAAC,wBAAwB,GAAG,UAAU,CAAC;aACpD;iBAAM,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;gBAChD,YAAY,CAAC,qBAAqB,GAAG,eAAe,CAAC,0BAA0B,CAAC,UAAU,CAAC,CAAC;aAC7F;SACF;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACP,CAAC;AA1FD,0CA0FC"}
@@ -1,29 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { UserSession } from "./interfaces";
17
- import { IHubUserRequestOptions } from "@esri/hub-common";
18
- /**
19
- * Create a IHubUserRequestOptions object from
20
- * the UserSession
21
- * If passed, it will use `templateDictionary`
22
- * values instead of making additional requests
23
- *
24
- * @export
25
- * @param {UserSession} authentication
26
- * @param {*} templateDictionary
27
- * @returns {IHubUserRequestOptions}
28
- */
29
- export declare function createHubRequestOptions(authentication: UserSession, templateDictionary?: any): Promise<IHubUserRequestOptions>;
@@ -1,64 +0,0 @@
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.createHubRequestOptions = void 0;
19
- const hub_common_1 = require("@esri/hub-common");
20
- const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
21
- /**
22
- * Create a IHubUserRequestOptions object from
23
- * the UserSession
24
- * If passed, it will use `templateDictionary`
25
- * values instead of making additional requests
26
- *
27
- * @export
28
- * @param {UserSession} authentication
29
- * @param {*} templateDictionary
30
- * @returns {IHubUserRequestOptions}
31
- */
32
- function createHubRequestOptions(authentication, templateDictionary = {}) {
33
- // We used to pull the user
34
- // the template dictionary, but ran into issues
35
- // with the user.groups being filtered to groups
36
- // the user owns, vs all groups the user belongs to
37
- // this was problematic as we need to check if the user
38
- // can add more groups, based on how close they are to
39
- // the max 512 group limit.
40
- // At this time we are simply fetching the user directly
41
- const promises = [];
42
- if (templateDictionary.organization) {
43
- promises.push(Promise.resolve(templateDictionary.organization));
44
- }
45
- else {
46
- promises.push((0, arcgis_rest_portal_1.getSelf)({ authentication }));
47
- }
48
- // always get the user
49
- promises.push((0, arcgis_rest_portal_1.getUser)({ authentication }));
50
- return Promise.all(promises).then(([pSelf, user]) => {
51
- pSelf.user = user;
52
- const ro = {
53
- authentication,
54
- portalSelf: pSelf,
55
- isPortal: pSelf.isPortal
56
- };
57
- if (!pSelf.isPortal) {
58
- ro.hubApiUrl = (0, hub_common_1.getHubUrlFromPortal)(pSelf);
59
- }
60
- return ro;
61
- });
62
- }
63
- exports.createHubRequestOptions = createHubRequestOptions;
64
- //# sourceMappingURL=create-hub-request-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-hub-request-options.js","sourceRoot":"","sources":["../../src/create-hub-request-options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,iDAA+E;AAE/E,iEAA4D;AAE5D;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CACrC,cAA2B,EAC3B,qBAA0B,EAAE;IAE5B,2BAA2B;IAC3B,+CAA+C;IAC/C,gDAAgD;IAChD,mDAAmD;IACnD,uDAAuD;IACvD,sDAAsD;IACtD,2BAA2B;IAE3B,wDAAwD;IACxD,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,IAAI,kBAAkB,CAAC,YAAY,EAAE;QACnC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC;KACjE;SAAM;QACL,QAAQ,CAAC,IAAI,CAAC,IAAA,4BAAO,EAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;KAC5C;IACD,sBAAsB;IACtB,QAAQ,CAAC,IAAI,CAAC,IAAA,4BAAO,EAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;QAClD,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,MAAM,EAAE,GAAG;YACT,cAAc;YACd,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACC,CAAC;QAE5B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACnB,EAAE,CAAC,SAAS,GAAG,IAAA,gCAAmB,EAAC,KAAK,CAAC,CAAC;SAC3C;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,0DAoCC"}
@@ -1,24 +0,0 @@
1
- /** @license
2
- * Copyright 2021 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { UserSession } from "../interfaces";
17
- /**
18
- * Deletes a set of empty groups if they're empty and belong to the user in the authentication.
19
- *
20
- * @param groups Ids of the groups to be deleted
21
- * @param authentication Credentials for the request
22
- * @returns Promise that will resolve with the list of successfully deleted groups
23
- */
24
- export declare function deleteEmptyGroups(groups: string[], authentication: UserSession): Promise<string[]>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2021 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.deleteEmptyGroups = void 0;
19
- /**
20
- * @module deleteEmptyGroups
21
- */
22
- const deleteGroupIfEmpty_1 = require("./deleteGroupIfEmpty");
23
- // ------------------------------------------------------------------------------------------------------------------ //
24
- /**
25
- * Deletes a set of empty groups if they're empty and belong to the user in the authentication.
26
- *
27
- * @param groups Ids of the groups to be deleted
28
- * @param authentication Credentials for the request
29
- * @returns Promise that will resolve with the list of successfully deleted groups
30
- */
31
- function deleteEmptyGroups(groups, authentication) {
32
- if (groups.length === 0) {
33
- return Promise.resolve([]);
34
- }
35
- // Attempt to delete each group
36
- return Promise.all(groups.map(groupId => (0, deleteGroupIfEmpty_1.deleteGroupIfEmpty)(groupId, authentication))).then((responses) => {
37
- // Return just the group ids that succeeded
38
- return groups.filter((groupId, index) => responses[index]);
39
- });
40
- }
41
- exports.deleteEmptyGroups = deleteEmptyGroups;
42
- //# sourceMappingURL=deleteEmptyGroups.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteEmptyGroups.js","sourceRoot":"","sources":["../../../src/deleteHelpers/deleteEmptyGroups.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,6DAA0D;AAG1D,wHAAwH;AAExH;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,MAAgB,EAChB,cAA2B;IAE3B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;KAC5B;IAED,+BAA+B;IAC/B,OAAO,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAA,uCAAkB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CACnE,CAAC,IAAI,CAAC,CAAC,SAAoB,EAAE,EAAE;QAC9B,2CAA2C;QAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,OAAe,EAAE,KAAa,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,8CAeC"}
@@ -1,27 +0,0 @@
1
- /** @license
2
- * Copyright 2021 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * @module deleteGroupIfEmpty
18
- */
19
- import { UserSession } from "../interfaces";
20
- /**
21
- * Deletes a group if it's empty and belongs to the specified user.
22
- *
23
- * @param groupId Id of the group to be deleted
24
- * @param authentication Credentials for the request
25
- * @returns Promise indicating if group was deleted
26
- */
27
- export declare function deleteGroupIfEmpty(groupId: string, authentication: UserSession): Promise<boolean>;
@@ -1,97 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2021 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.deleteGroupIfEmpty = void 0;
19
- const tslib_1 = require("tslib");
20
- const portal = tslib_1.__importStar(require("@esri/arcgis-rest-portal"));
21
- // ------------------------------------------------------------------------------------------------------------------ //
22
- /**
23
- * Deletes a group if it's empty and belongs to the specified user.
24
- *
25
- * @param groupId Id of the group to be deleted
26
- * @param authentication Credentials for the request
27
- * @returns Promise indicating if group was deleted
28
- */
29
- function deleteGroupIfEmpty(groupId, authentication) {
30
- let username;
31
- let isGroupProtected;
32
- // Get the owner tied to the authentication
33
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
34
- return authentication
35
- .getUsername()
36
- .then(response => {
37
- username = response;
38
- // We need to know the owner and protection status of the group
39
- return portal.getGroup(groupId, { authentication });
40
- })
41
- .then((group) => {
42
- if (group.owner !== username) {
43
- return Promise.resolve(null); // don't delete a group we don't own
44
- }
45
- isGroupProtected = group.protected; // do we need to unprotect before deleting?
46
- // Get the number of items in the group
47
- const groupContentOptions = {
48
- paging: {
49
- num: 1 // only need 1 item to show that group is not empty
50
- },
51
- authentication
52
- };
53
- return portal.getGroupContent(groupId, groupContentOptions);
54
- })
55
- .then((groupContent) => {
56
- // should be IGroupContentResult; see https://github.com/Esri/arcgis-rest-js/pull/858/files
57
- // If groupContent is null, then we don't own the group; if the group is not empty, then we can't delete it
58
- if (!groupContent || groupContent.total > 0) {
59
- return Promise.resolve({ success: false }); // don't delete a group that's not empty
60
- }
61
- // We're going ahead with deletion; first unprotect it if necessary
62
- if (isGroupProtected) {
63
- const groupOptions = {
64
- id: groupId,
65
- authentication
66
- };
67
- return portal.unprotectGroup(groupOptions);
68
- }
69
- else {
70
- return Promise.resolve({ success: true });
71
- }
72
- })
73
- .then(response => {
74
- if (response.success) {
75
- // All is good so far: we own the group, it's empty, and it's unprotected; proceed with deletion
76
- const groupOptions = {
77
- id: groupId,
78
- authentication
79
- };
80
- return portal.removeGroup(groupOptions);
81
- }
82
- else {
83
- // We should not delete the group
84
- return Promise.resolve({ success: false });
85
- }
86
- })
87
- .then((response) => {
88
- // Return a simple response
89
- return Promise.resolve(response.success);
90
- })
91
- .catch(() => {
92
- // In case getGroup or getGroupContent fails
93
- return Promise.resolve(false);
94
- });
95
- }
96
- exports.deleteGroupIfEmpty = deleteGroupIfEmpty;
97
- //# sourceMappingURL=deleteGroupIfEmpty.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteGroupIfEmpty.js","sourceRoot":"","sources":["../../../src/deleteHelpers/deleteGroupIfEmpty.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAOH,yEAAmD;AAEnD,wHAAwH;AAExH;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,OAAe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IAAI,EAAE,CAAC,CAAC;SAC3C;IACH,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,EAAE;QACf,IAAI,QAAQ,CAAC,OAAO,EAAE;YACpB,gGAAgG;YAChG,MAAM,YAAY,GAA6B;gBAC7C,EAAE,EAAE,OAAO;gBACX,cAAc;aACf,CAAC;YACF,OAAO,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;SACzC;aAAM;YACL,iCAAiC;YACjC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;SAC5C;IACH,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,QAA8B,EAAE,EAAE;QACvC,2BAA2B;QAC3B,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,4CAA4C;QAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC;AAvED,gDAuEC"}
@@ -1,38 +0,0 @@
1
- /** @license
2
- * Copyright 2021 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Provides a function for deleting a deployed Solution item and all of the items that were created
18
- * as part of that deployment.
19
- *
20
- * @module deleteSolution
21
- */
22
- import { IDeleteSolutionOptions, ISolutionPrecis, UserSession } from "../interfaces";
23
- /**
24
- * Deletes a deployed Solution item and and all of the items that were created
25
- * as part of that deployment.
26
- *
27
- * @param solutionItemId Id of a deployed Solution
28
- * @param solutionSummary List of items in the solution that would be deleted
29
- * @param authentication Credentials for the request
30
- * @param options Progress reporting options
31
- * @returns Promise that will resolve with a list of two solution summaries: successful deletions
32
- * and failed deletions. Ignored items (e.g., already deleted) and items shared with more than
33
- * one Solution will not be in either list.
34
- * Note that Solution item and its deployment folder will only be deleted if all of its deployed
35
- * items were deleted (the failure list is empty). This makes it possible to re-attempted
36
- * deletion using the solutionItemId.
37
- */
38
- export declare function deleteSolutionContents(solutionItemId: string, solutionSummary: ISolutionPrecis, authentication: UserSession, options?: IDeleteSolutionOptions): Promise<ISolutionPrecis[]>;