@esri/solution-common 5.2.3 → 5.2.4

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 (192) hide show
  1. package/dist/cjs/completeItem.d.ts +29 -0
  2. package/dist/cjs/completeItem.js +92 -0
  3. package/dist/cjs/completeItem.js.map +1 -0
  4. package/dist/cjs/create-hub-request-options.d.ts +29 -0
  5. package/dist/cjs/create-hub-request-options.js +64 -0
  6. package/dist/cjs/create-hub-request-options.js.map +1 -0
  7. package/dist/cjs/deleteHelpers/deleteEmptyGroups.d.ts +24 -0
  8. package/dist/cjs/deleteHelpers/deleteEmptyGroups.js +42 -0
  9. package/dist/cjs/deleteHelpers/deleteEmptyGroups.js.map +1 -0
  10. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.d.ts +27 -0
  11. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js +97 -0
  12. package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js.map +1 -0
  13. package/dist/cjs/deleteHelpers/deleteSolutionContents.d.ts +38 -0
  14. package/dist/cjs/deleteHelpers/deleteSolutionContents.js +130 -0
  15. package/dist/cjs/deleteHelpers/deleteSolutionContents.js.map +1 -0
  16. package/dist/cjs/deleteHelpers/deleteSolutionFolder.d.ts +29 -0
  17. package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +79 -0
  18. package/dist/cjs/deleteHelpers/deleteSolutionFolder.js.map +1 -0
  19. package/dist/cjs/deleteHelpers/deleteSolutionItem.d.ts +30 -0
  20. package/dist/cjs/deleteHelpers/deleteSolutionItem.js +54 -0
  21. package/dist/cjs/deleteHelpers/deleteSolutionItem.js.map +1 -0
  22. package/dist/cjs/deleteHelpers/index.d.ts +22 -0
  23. package/dist/cjs/deleteHelpers/index.js +26 -0
  24. package/dist/cjs/deleteHelpers/index.js.map +1 -0
  25. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.d.ts +27 -0
  26. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js +34 -0
  27. package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js.map +1 -0
  28. package/dist/cjs/deleteHelpers/removeItems.d.ts +34 -0
  29. package/dist/cjs/deleteHelpers/removeItems.js +112 -0
  30. package/dist/cjs/deleteHelpers/removeItems.js.map +1 -0
  31. package/dist/cjs/deleteHelpers/reportProgress.d.ts +27 -0
  32. package/dist/cjs/deleteHelpers/reportProgress.js +46 -0
  33. package/dist/cjs/deleteHelpers/reportProgress.js.map +1 -0
  34. package/dist/cjs/deleteSolution.d.ts +55 -0
  35. package/dist/cjs/deleteSolution.js +107 -0
  36. package/dist/cjs/deleteSolution.js.map +1 -0
  37. package/dist/cjs/dependencies.d.ts +26 -0
  38. package/dist/cjs/dependencies.js +171 -0
  39. package/dist/cjs/dependencies.js.map +1 -0
  40. package/dist/cjs/featureServiceHelpers.d.ts +799 -0
  41. package/dist/cjs/featureServiceHelpers.js +2438 -0
  42. package/dist/cjs/featureServiceHelpers.js.map +1 -0
  43. package/dist/cjs/formHelpers.d.ts +41 -0
  44. package/dist/cjs/formHelpers.js +78 -0
  45. package/dist/cjs/formHelpers.js.map +1 -0
  46. package/dist/cjs/generalHelpers.d.ts +433 -0
  47. package/dist/cjs/generalHelpers.js +925 -0
  48. package/dist/cjs/generalHelpers.js.map +1 -0
  49. package/dist/cjs/get-subscription-info.d.ts +27 -0
  50. package/dist/cjs/get-subscription-info.js +39 -0
  51. package/dist/cjs/get-subscription-info.js.map +1 -0
  52. package/dist/cjs/getDeletableSolutionInfo.d.ts +29 -0
  53. package/dist/cjs/getDeletableSolutionInfo.js +53 -0
  54. package/dist/cjs/getDeletableSolutionInfo.js.map +1 -0
  55. package/dist/cjs/getItemTypeAbbrev.d.ts +19 -0
  56. package/dist/cjs/getItemTypeAbbrev.js +186 -0
  57. package/dist/cjs/getItemTypeAbbrev.js.map +1 -0
  58. package/dist/cjs/getSolutionSummary.d.ts +27 -0
  59. package/dist/cjs/getSolutionSummary.js +101 -0
  60. package/dist/cjs/getSolutionSummary.js.map +1 -0
  61. package/dist/cjs/index.d.ts +46 -0
  62. package/dist/cjs/index.js +50 -0
  63. package/dist/cjs/index.js.map +1 -0
  64. package/dist/cjs/interfaces.d.ts +1362 -0
  65. package/dist/cjs/interfaces.js +77 -0
  66. package/dist/cjs/interfaces.js.map +1 -0
  67. package/dist/cjs/libConnectors.d.ts +73 -0
  68. package/dist/cjs/libConnectors.js +115 -0
  69. package/dist/cjs/libConnectors.js.map +1 -0
  70. package/dist/cjs/migrations/apply-schema.d.ts +24 -0
  71. package/dist/cjs/migrations/apply-schema.js +36 -0
  72. package/dist/cjs/migrations/apply-schema.js.map +1 -0
  73. package/dist/cjs/migrations/is-legacy-solution.d.ts +24 -0
  74. package/dist/cjs/migrations/is-legacy-solution.js +40 -0
  75. package/dist/cjs/migrations/is-legacy-solution.js.map +1 -0
  76. package/dist/cjs/migrations/upgrade-three-dot-one.d.ts +27 -0
  77. package/dist/cjs/migrations/upgrade-three-dot-one.js +49 -0
  78. package/dist/cjs/migrations/upgrade-three-dot-one.js.map +1 -0
  79. package/dist/cjs/migrations/upgrade-three-dot-zero.d.ts +27 -0
  80. package/dist/cjs/migrations/upgrade-three-dot-zero.js +43 -0
  81. package/dist/cjs/migrations/upgrade-three-dot-zero.js.map +1 -0
  82. package/dist/cjs/migrations/upgrade-two-dot-five.d.ts +24 -0
  83. package/dist/cjs/migrations/upgrade-two-dot-five.js +73 -0
  84. package/dist/cjs/migrations/upgrade-two-dot-five.js.map +1 -0
  85. package/dist/cjs/migrations/upgrade-two-dot-four.d.ts +24 -0
  86. package/dist/cjs/migrations/upgrade-two-dot-four.js +72 -0
  87. package/dist/cjs/migrations/upgrade-two-dot-four.js.map +1 -0
  88. package/dist/cjs/migrations/upgrade-two-dot-one.d.ts +7 -0
  89. package/dist/cjs/migrations/upgrade-two-dot-one.js +39 -0
  90. package/dist/cjs/migrations/upgrade-two-dot-one.js.map +1 -0
  91. package/dist/cjs/migrations/upgrade-two-dot-seven.d.ts +23 -0
  92. package/dist/cjs/migrations/upgrade-two-dot-seven.js +58 -0
  93. package/dist/cjs/migrations/upgrade-two-dot-seven.js.map +1 -0
  94. package/dist/cjs/migrations/upgrade-two-dot-six.d.ts +27 -0
  95. package/dist/cjs/migrations/upgrade-two-dot-six.js +61 -0
  96. package/dist/cjs/migrations/upgrade-two-dot-six.js.map +1 -0
  97. package/dist/cjs/migrations/upgrade-two-dot-three.d.ts +23 -0
  98. package/dist/cjs/migrations/upgrade-two-dot-three.js +55 -0
  99. package/dist/cjs/migrations/upgrade-two-dot-three.js.map +1 -0
  100. package/dist/cjs/migrations/upgrade-two-dot-two.d.ts +23 -0
  101. package/dist/cjs/migrations/upgrade-two-dot-two.js +58 -0
  102. package/dist/cjs/migrations/upgrade-two-dot-two.js.map +1 -0
  103. package/dist/cjs/migrations/upgrade-two-dot-zero.d.ts +44 -0
  104. package/dist/cjs/migrations/upgrade-two-dot-zero.js +95 -0
  105. package/dist/cjs/migrations/upgrade-two-dot-zero.js.map +1 -0
  106. package/dist/cjs/migrator.d.ts +25 -0
  107. package/dist/cjs/migrator.js +77 -0
  108. package/dist/cjs/migrator.js.map +1 -0
  109. package/dist/cjs/package.json +3 -0
  110. package/dist/cjs/resourceHelpers.d.ts +191 -0
  111. package/dist/cjs/resourceHelpers.js +384 -0
  112. package/dist/cjs/resourceHelpers.js.map +1 -0
  113. package/dist/cjs/resources/add-resource-from-blob.d.ts +26 -0
  114. package/dist/cjs/resources/add-resource-from-blob.js +52 -0
  115. package/dist/cjs/resources/add-resource-from-blob.js.map +1 -0
  116. package/dist/cjs/resources/addMetadataFromBlob.d.ts +25 -0
  117. package/dist/cjs/resources/addMetadataFromBlob.js +43 -0
  118. package/dist/cjs/resources/addMetadataFromBlob.js.map +1 -0
  119. package/dist/cjs/resources/convert-item-resource-to-storage-resource.d.ts +32 -0
  120. package/dist/cjs/resources/convert-item-resource-to-storage-resource.js +70 -0
  121. package/dist/cjs/resources/convert-item-resource-to-storage-resource.js.map +1 -0
  122. package/dist/cjs/resources/convert-storage-resource-to-item-resource.d.ts +29 -0
  123. package/dist/cjs/resources/convert-storage-resource-to-item-resource.js +70 -0
  124. package/dist/cjs/resources/convert-storage-resource-to-item-resource.js.map +1 -0
  125. package/dist/cjs/resources/copyAssociatedFiles.d.ts +67 -0
  126. package/dist/cjs/resources/copyAssociatedFiles.js +304 -0
  127. package/dist/cjs/resources/copyAssociatedFiles.js.map +1 -0
  128. package/dist/cjs/resources/copyDataIntoItem.d.ts +33 -0
  129. package/dist/cjs/resources/copyDataIntoItem.js +62 -0
  130. package/dist/cjs/resources/copyDataIntoItem.js.map +1 -0
  131. package/dist/cjs/resources/copyMetadataIntoItem.d.ts +26 -0
  132. package/dist/cjs/resources/copyMetadataIntoItem.js +46 -0
  133. package/dist/cjs/resources/copyMetadataIntoItem.js.map +1 -0
  134. package/dist/cjs/resources/copyResourceIntoZip.d.ts +33 -0
  135. package/dist/cjs/resources/copyResourceIntoZip.js +78 -0
  136. package/dist/cjs/resources/copyResourceIntoZip.js.map +1 -0
  137. package/dist/cjs/resources/copyZipIntoItem.d.ts +25 -0
  138. package/dist/cjs/resources/copyZipIntoItem.js +54 -0
  139. package/dist/cjs/resources/copyZipIntoItem.js.map +1 -0
  140. package/dist/cjs/resources/createCopyResults.d.ts +25 -0
  141. package/dist/cjs/resources/createCopyResults.js +36 -0
  142. package/dist/cjs/resources/createCopyResults.js.map +1 -0
  143. package/dist/cjs/resources/get-blob.d.ts +26 -0
  144. package/dist/cjs/resources/get-blob.js +27 -0
  145. package/dist/cjs/resources/get-blob.js.map +1 -0
  146. package/dist/cjs/resources/getItemResourcesFilesFromPaths.d.ts +24 -0
  147. package/dist/cjs/resources/getItemResourcesFilesFromPaths.js +49 -0
  148. package/dist/cjs/resources/getItemResourcesFilesFromPaths.js.map +1 -0
  149. package/dist/cjs/resources/getItemResourcesPaths.d.ts +26 -0
  150. package/dist/cjs/resources/getItemResourcesPaths.js +76 -0
  151. package/dist/cjs/resources/getItemResourcesPaths.js.map +1 -0
  152. package/dist/cjs/resources/index.d.ts +29 -0
  153. package/dist/cjs/resources/index.js +33 -0
  154. package/dist/cjs/resources/index.js.map +1 -0
  155. package/dist/cjs/resources/solution-resource.d.ts +35 -0
  156. package/dist/cjs/resources/solution-resource.js +31 -0
  157. package/dist/cjs/resources/solution-resource.js.map +1 -0
  158. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.d.ts +56 -0
  159. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js +146 -0
  160. package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js.map +1 -0
  161. package/dist/cjs/restHelpers.d.ts +607 -0
  162. package/dist/cjs/restHelpers.js +1954 -0
  163. package/dist/cjs/restHelpers.js.map +1 -0
  164. package/dist/cjs/restHelpersGet.d.ts +288 -0
  165. package/dist/cjs/restHelpersGet.js +804 -0
  166. package/dist/cjs/restHelpersGet.js.map +1 -0
  167. package/dist/cjs/sharing/index.d.ts +16 -0
  168. package/dist/cjs/sharing/index.js +20 -0
  169. package/dist/cjs/sharing/index.js.map +1 -0
  170. package/dist/cjs/sharing/share-item-to-groups.d.ts +26 -0
  171. package/dist/cjs/sharing/share-item-to-groups.js +44 -0
  172. package/dist/cjs/sharing/share-item-to-groups.js.map +1 -0
  173. package/dist/cjs/templatization.d.ts +139 -0
  174. package/dist/cjs/templatization.js +316 -0
  175. package/dist/cjs/templatization.js.map +1 -0
  176. package/dist/cjs/trackingHelpers.d.ts +116 -0
  177. package/dist/cjs/trackingHelpers.js +217 -0
  178. package/dist/cjs/trackingHelpers.js.map +1 -0
  179. package/dist/cjs/velocityHelpers.d.ts +57 -0
  180. package/dist/cjs/velocityHelpers.js +135 -0
  181. package/dist/cjs/velocityHelpers.js.map +1 -0
  182. package/dist/cjs/workflowHelpers.d.ts +37 -0
  183. package/dist/cjs/workflowHelpers.js +77 -0
  184. package/dist/cjs/workflowHelpers.js.map +1 -0
  185. package/dist/cjs/workforceHelpers.d.ts +115 -0
  186. package/dist/cjs/workforceHelpers.js +749 -0
  187. package/dist/cjs/workforceHelpers.js.map +1 -0
  188. package/dist/cjs/zip-utils.d.ts +76 -0
  189. package/dist/cjs/zip-utils.js +142 -0
  190. package/dist/cjs/zip-utils.js.map +1 -0
  191. package/dist/esm/package.json +3 -0
  192. package/package.json +2 -2
@@ -0,0 +1,46 @@
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.copyMetadataIntoItem = void 0;
19
+ const addMetadataFromBlob_1 = require("./addMetadataFromBlob");
20
+ const createCopyResults_1 = require("./createCopyResults");
21
+ const get_blob_1 = require("./get-blob");
22
+ // ------------------------------------------------------------------------------------------------------------------ //
23
+ /**
24
+ * Copies metadata into an AGO item.
25
+ *
26
+ * @param fileInfo Information about the source and destination of the file such as its URL, folder, filename
27
+ * @param sourceAuthentication Credentials for the request to the source
28
+ * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail
29
+ * @param destinationAuthentication Credentials for the request to the storage
30
+ * @returns A promise which resolves to the result of the copy
31
+ */
32
+ function copyMetadataIntoItem(fileInfo, sourceAuthentication, destinationItemId, destinationAuthentication) {
33
+ return new Promise(resolve => {
34
+ (0, get_blob_1.getBlob)(fileInfo.url, sourceAuthentication).then(blob => {
35
+ if (blob.type !== "text/xml" && blob.type !== "application/xml") {
36
+ resolve((0, createCopyResults_1.createCopyResults)(fileInfo, false)); // unable to get resource
37
+ return;
38
+ }
39
+ (0, addMetadataFromBlob_1.addMetadataFromBlob)(blob, destinationItemId, destinationAuthentication).then(() => resolve((0, createCopyResults_1.createCopyResults)(fileInfo, true, true)), () => resolve((0, createCopyResults_1.createCopyResults)(fileInfo, true, false)) // unable to add resource
40
+ );
41
+ }, () => resolve((0, createCopyResults_1.createCopyResults)(fileInfo, false)) // unable to get resource
42
+ );
43
+ });
44
+ }
45
+ exports.copyMetadataIntoItem = copyMetadataIntoItem;
46
+ //# sourceMappingURL=copyMetadataIntoItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyMetadataIntoItem.js","sourceRoot":"","sources":["../../../src/resources/copyMetadataIntoItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAOH,+DAA4D;AAC5D,2DAAwD;AACxD,yCAAqC;AAErC,wHAAwH;AAExH;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,QAA6B,EAC7B,oBAAiC,EACjC,iBAAyB,EACzB,yBAAsC;IAEtC,OAAO,IAAI,OAAO,CAA6B,OAAO,CAAC,EAAE;QACvD,IAAA,kBAAO,EAAC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAC9C,IAAI,CAAC,EAAE;YACL,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB,EAAE;gBAC/D,OAAO,CACL,IAAA,qCAAiB,EAAC,QAAQ,EAAE,KAAK,CAA+B,CACjE,CAAC,CAAC,yBAAyB;gBAC5B,OAAO;aACR;YACD,IAAA,yCAAmB,EACjB,IAAI,EACJ,iBAAiB,EACjB,yBAAyB,CAC1B,CAAC,IAAI,CACJ,GAAG,EAAE,CACH,OAAO,CACL,IAAA,qCAAiB,EACf,QAAQ,EACR,IAAI,EACJ,IAAI,CACyB,CAChC,EACH,GAAG,EAAE,CACH,OAAO,CACL,IAAA,qCAAiB,EACf,QAAQ,EACR,IAAI,EACJ,KAAK,CACwB,CAChC,CAAC,yBAAyB;aAC9B,CAAC;QACJ,CAAC,EACD,GAAG,EAAE,CACH,OAAO,CACL,IAAA,qCAAiB,EAAC,QAAQ,EAAE,KAAK,CAA+B,CACjE,CAAC,yBAAyB;SAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,oDA4CC"}
@@ -0,0 +1,33 @@
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 { IAssociatedFileCopyResults, IAssociatedFileInfo, ISourceFile, IZipInfo, UserSession } from "../interfaces";
17
+ /**
18
+ * Copies a resource into a zipfile.
19
+ *
20
+ * @param file Information about the source and destination of the file such as its URL, folder, filename
21
+ * @param zipInfo Information about a zipfile such as its name and its zip object
22
+ * @returns The result of the copy
23
+ */
24
+ export declare function copyResourceIntoZip(file: ISourceFile, zipInfo: IZipInfo): IAssociatedFileCopyResults;
25
+ /**
26
+ * Copies a resource into a zipfile.
27
+ *
28
+ * @param fileInfo Information about the source and destination of the file such as its URL, folder, filename
29
+ * @param sourceAuthentication Credentials for the request to the source
30
+ * @param zipInfo Information about a zipfile such as its name and its zip object
31
+ * @returns A promise which resolves to the result of the copy
32
+ */
33
+ export declare function copyResourceIntoZipFromInfo(fileInfo: IAssociatedFileInfo, sourceAuthentication: UserSession, zipInfo: IZipInfo): Promise<IAssociatedFileCopyResults>;
@@ -0,0 +1,78 @@
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.copyResourceIntoZipFromInfo = exports.copyResourceIntoZip = void 0;
19
+ const createCopyResults_1 = require("./createCopyResults");
20
+ const restHelpersGet_1 = require("../restHelpersGet");
21
+ // ------------------------------------------------------------------------------------------------------------------ //
22
+ /**
23
+ * Copies a resource into a zipfile.
24
+ *
25
+ * @param file Information about the source and destination of the file such as its URL, folder, filename
26
+ * @param zipInfo Information about a zipfile such as its name and its zip object
27
+ * @returns The result of the copy
28
+ */
29
+ function copyResourceIntoZip(file, zipInfo) {
30
+ // Add it to the zip
31
+ if (file.folder) {
32
+ zipInfo.zip
33
+ .folder(file.folder)
34
+ .file(file.filename, file.file, { binary: true });
35
+ }
36
+ else {
37
+ zipInfo.zip.file(file.filename, file.file, { binary: true });
38
+ }
39
+ zipInfo.filelist.push(file);
40
+ return (0, createCopyResults_1.createCopyResults)(file, true);
41
+ }
42
+ exports.copyResourceIntoZip = copyResourceIntoZip;
43
+ /**
44
+ * Copies a resource into a zipfile.
45
+ *
46
+ * @param fileInfo Information about the source and destination of the file such as its URL, folder, filename
47
+ * @param sourceAuthentication Credentials for the request to the source
48
+ * @param zipInfo Information about a zipfile such as its name and its zip object
49
+ * @returns A promise which resolves to the result of the copy
50
+ */
51
+ function copyResourceIntoZipFromInfo(fileInfo, sourceAuthentication, zipInfo) {
52
+ return new Promise(resolve => {
53
+ let filePromise;
54
+ if (fileInfo.file) {
55
+ filePromise = Promise.resolve(fileInfo.file);
56
+ }
57
+ else {
58
+ filePromise = (0, restHelpersGet_1.getBlobAsFile)(fileInfo.url, fileInfo.filename, sourceAuthentication);
59
+ }
60
+ filePromise.then((file) => {
61
+ // And add it to the zip
62
+ if (fileInfo.folder) {
63
+ zipInfo.zip
64
+ .folder(fileInfo.folder)
65
+ .file(fileInfo.filename, file, { binary: true });
66
+ }
67
+ else {
68
+ zipInfo.zip.file(fileInfo.filename, file, { binary: true });
69
+ }
70
+ zipInfo.filelist.push(fileInfo);
71
+ resolve((0, createCopyResults_1.createCopyResults)(fileInfo, true));
72
+ }, () => resolve(
73
+ // unable to get resource
74
+ (0, createCopyResults_1.createCopyResults)(fileInfo, false)));
75
+ });
76
+ }
77
+ exports.copyResourceIntoZipFromInfo = copyResourceIntoZipFromInfo;
78
+ //# sourceMappingURL=copyResourceIntoZip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyResourceIntoZip.js","sourceRoot":"","sources":["../../../src/resources/copyResourceIntoZip.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AASH,2DAAwD;AACxD,sDAAkD;AAElD,wHAAwH;AAExH;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,IAAiB,EACjB,OAAiB;IAEjB,oBAAoB;IACpB,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,OAAO,CAAC,GAAG;aACR,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;aACnB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;KACrD;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;KAC9D;IACD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,IAAA,qCAAiB,EAAC,IAAI,EAAE,IAAI,CAA+B,CAAC;AACrE,CAAC;AAdD,kDAcC;AAED;;;;;;;GAOG;AACH,SAAgB,2BAA2B,CACzC,QAA6B,EAC7B,oBAAiC,EACjC,OAAiB;IAEjB,OAAO,IAAI,OAAO,CAA6B,OAAO,CAAC,EAAE;QACvD,IAAI,WAAyB,CAAC;QAC9B,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SAC9C;aAAM;YACL,WAAW,GAAG,IAAA,8BAAa,EAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;SACpF;QAED,WAAW,CAAC,IAAI,CACd,CAAC,IAAS,EAAE,EAAE;YACZ,wBAAwB;YACxB,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,OAAO,CAAC,GAAG;qBACR,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;qBACvB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACpD;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aAC7D;YACD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO,CACL,IAAA,qCAAiB,EAAC,QAAQ,EAAE,IAAI,CAA+B,CAChE,CAAC;QACJ,CAAC,EACD,GAAG,EAAE,CACH,OAAO;QACL,yBAAyB;QACzB,IAAA,qCAAiB,EAAC,QAAQ,EAAE,KAAK,CAA+B,CACjE,CACJ,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAnCD,kEAmCC"}
@@ -0,0 +1,25 @@
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 { IZipCopyResults, IZipInfo, UserSession } from "../interfaces";
17
+ /**
18
+ * Copies a zipfile into an AGO item.
19
+ *
20
+ * @param zipInfo Information about a zipfile such as its name and its zip object
21
+ * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail
22
+ * @param destinationAuthentication Credentials for the request to the storage
23
+ * @returns A promise which resolves to the result of the copy
24
+ */
25
+ export declare function copyZipIntoItem(zipInfo: IZipInfo, destinationItemId: string, destinationAuthentication: UserSession): Promise<IZipCopyResults>;
@@ -0,0 +1,54 @@
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.copyZipIntoItem = void 0;
19
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
20
+ const generalHelpers_1 = require("../generalHelpers");
21
+ const createCopyResults_1 = require("./createCopyResults");
22
+ // ------------------------------------------------------------------------------------------------------------------ //
23
+ /**
24
+ * Copies a zipfile into an AGO item.
25
+ *
26
+ * @param zipInfo Information about a zipfile such as its name and its zip object
27
+ * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail
28
+ * @param destinationAuthentication Credentials for the request to the storage
29
+ * @returns A promise which resolves to the result of the copy
30
+ */
31
+ function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication) {
32
+ return new Promise(resolve => {
33
+ zipInfo.zip
34
+ .generateAsync({ type: "blob" })
35
+ .then((content) => {
36
+ return (0, generalHelpers_1.blobToFile)(content, zipInfo.filename, "application/zip");
37
+ })
38
+ .then((zipfile) => {
39
+ const addResourceOptions = {
40
+ id: destinationItemId,
41
+ resource: zipfile,
42
+ authentication: destinationAuthentication,
43
+ params: {
44
+ archive: true
45
+ }
46
+ };
47
+ return (0, arcgis_rest_portal_1.addItemResource)(addResourceOptions);
48
+ })
49
+ .then(() => resolve((0, createCopyResults_1.createCopyResults)(zipInfo, true, true)), () => resolve((0, createCopyResults_1.createCopyResults)(zipInfo, true, false)) // unable to add resource
50
+ );
51
+ });
52
+ }
53
+ exports.copyZipIntoItem = copyZipIntoItem;
54
+ //# sourceMappingURL=copyZipIntoItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyZipIntoItem.js","sourceRoot":"","sources":["../../../src/resources/copyZipIntoItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,iEAGkC;AAClC,sDAA+C;AAC/C,2DAAwD;AAExD,wHAAwH;AAExH;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,OAAiB,EACjB,iBAAyB,EACzB,yBAAsC;IAEtC,OAAO,IAAI,OAAO,CAAkB,OAAO,CAAC,EAAE;QAC5C,OAAO,CAAC,GAAG;aACR,aAAa,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;aAC/B,IAAI,CAAC,CAAC,OAAa,EAAE,EAAE;YACtB,OAAO,IAAA,2BAAU,EAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAClE,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,OAAa,EAAE,EAAE;YACtB,MAAM,kBAAkB,GAAyB;gBAC/C,EAAE,EAAE,iBAAiB;gBACrB,QAAQ,EAAE,OAAO;gBACjB,cAAc,EAAE,yBAAyB;gBACzC,MAAM,EAAE;oBACN,OAAO,EAAE,IAAI;iBACd;aACF,CAAC;YACF,OAAO,IAAA,oCAAe,EAAC,kBAAkB,CAAC,CAAC;QAC7C,CAAC,CAAC;aACD,IAAI,CACH,GAAG,EAAE,CACH,OAAO,CAAC,IAAA,qCAAiB,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAoB,CAAC,EACpE,GAAG,EAAE,CACH,OAAO,CAAC,IAAA,qCAAiB,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAoB,CAAC,CAAC,yBAAyB;SAChG,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC;AA7BD,0CA6BC"}
@@ -0,0 +1,25 @@
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 { IAssociatedFileCopyResults, IZipCopyResults } from "../interfaces";
17
+ /**
18
+ * Generates IAssociatedFileCopyResults object.
19
+ *
20
+ * @param fileInfo Info about item that was to be copied
21
+ * @param fetchedFromSource Status of fetching item from source
22
+ * @param copiedToDestination Status of copying item to destination
23
+ * @returns IAssociatedFileCopyResults object
24
+ */
25
+ export declare function createCopyResults(fileInfo: any, fetchedFromSource: boolean, copiedToDestination?: boolean): IAssociatedFileCopyResults | IZipCopyResults;
@@ -0,0 +1,36 @@
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.createCopyResults = void 0;
19
+ // ------------------------------------------------------------------------------------------------------------------ //
20
+ /**
21
+ * Generates IAssociatedFileCopyResults object.
22
+ *
23
+ * @param fileInfo Info about item that was to be copied
24
+ * @param fetchedFromSource Status of fetching item from source
25
+ * @param copiedToDestination Status of copying item to destination
26
+ * @returns IAssociatedFileCopyResults object
27
+ */
28
+ function createCopyResults(fileInfo, fetchedFromSource, copiedToDestination) {
29
+ return {
30
+ ...fileInfo,
31
+ fetchedFromSource,
32
+ copiedToDestination
33
+ };
34
+ }
35
+ exports.createCopyResults = createCopyResults;
36
+ //# sourceMappingURL=createCopyResults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCopyResults.js","sourceRoot":"","sources":["../../../src/resources/createCopyResults.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,wHAAwH;AAExH;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,QAAa,EACb,iBAA0B,EAC1B,mBAA6B;IAE7B,OAAO;QACL,GAAG,QAAQ;QACX,iBAAiB;QACjB,mBAAmB;KACpB,CAAC;AACJ,CAAC;AAVD,8CAUC"}
@@ -0,0 +1,26 @@
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 { IRequestOptions } from "@esri/arcgis-rest-request";
18
+ /**
19
+ * Gets a Blob from a web site.
20
+ *
21
+ * @param url Address of Blob
22
+ * @param authentication Credentials for the request
23
+ * @param requestOptions - Options for the request, including parameters relevant to the endpoint.
24
+ * @returns Promise that will resolve with Blob or an AGO-style JSON failure response
25
+ */
26
+ export declare function getBlob(url: string, authentication: UserSession, requestOptions?: IRequestOptions): Promise<Blob>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBlob = void 0;
4
+ const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
5
+ /**
6
+ * Gets a Blob from a web site.
7
+ *
8
+ * @param url Address of Blob
9
+ * @param authentication Credentials for the request
10
+ * @param requestOptions - Options for the request, including parameters relevant to the endpoint.
11
+ * @returns Promise that will resolve with Blob or an AGO-style JSON failure response
12
+ */
13
+ function getBlob(url, authentication, requestOptions = {}) {
14
+ if (!url) {
15
+ return Promise.reject("Url must be provided");
16
+ }
17
+ const blobRequestOptions = {
18
+ authentication: authentication,
19
+ rawResponse: true,
20
+ ...requestOptions
21
+ };
22
+ return (0, arcgis_rest_request_1.request)(url, blobRequestOptions).then(response => {
23
+ return response.blob();
24
+ });
25
+ }
26
+ exports.getBlob = getBlob;
27
+ //# sourceMappingURL=get-blob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-blob.js","sourceRoot":"","sources":["../../../src/resources/get-blob.ts"],"names":[],"mappings":";;;AAgBA,mEAAqE;AACrE;;;;;;;GAOG;AACH,SAAgB,OAAO,CACrB,GAAW,EACX,cAA2B,EAC3B,iBAAkC,EAAE;IAEpC,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;KAC/C;IAED,MAAM,kBAAkB,GAAG;QACzB,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,IAAI;QACjB,GAAG,cAAc;KACC,CAAC;IAErB,OAAO,IAAA,6BAAO,EAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QACtD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,0BAkBC"}
@@ -0,0 +1,24 @@
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 { ISourceFile, ISourceFileCopyPath, UserSession } from "../interfaces";
17
+ /**
18
+ * Fetches a set of resources defined by paths.
19
+ *
20
+ * @param resourceItemFilePaths Paths to resources in source
21
+ * @param authentication Credentials for the request to the source
22
+ * @returns A promise which resolves with an array of resource files
23
+ */
24
+ export declare function getItemResourcesFilesFromPaths(resourceItemFilePaths: ISourceFileCopyPath[], authentication: UserSession): Promise<ISourceFile[]>;
@@ -0,0 +1,49 @@
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.getItemResourcesFilesFromPaths = void 0;
19
+ const restHelpersGet_1 = require("../restHelpersGet");
20
+ // ------------------------------------------------------------------------------------------------------------------ //
21
+ /**
22
+ * Fetches a set of resources defined by paths.
23
+ *
24
+ * @param resourceItemFilePaths Paths to resources in source
25
+ * @param authentication Credentials for the request to the source
26
+ * @returns A promise which resolves with an array of resource files
27
+ */
28
+ function getItemResourcesFilesFromPaths(resourceItemFilePaths, authentication) {
29
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
30
+ return Promise.all(resourceItemFilePaths.map(fileInfo => {
31
+ return new Promise(resolve => {
32
+ (0, restHelpersGet_1.getBlobAsFile)(fileInfo.url, fileInfo.filename, authentication).then(file => {
33
+ resolve({
34
+ itemId: fileInfo.itemId,
35
+ file,
36
+ folder: fileInfo.folder,
37
+ filename: fileInfo.filename
38
+ });
39
+ }, () => {
40
+ resolve(null);
41
+ });
42
+ });
43
+ })).then((files) => {
44
+ // Discard failures
45
+ return files.filter(file => !!file);
46
+ });
47
+ }
48
+ exports.getItemResourcesFilesFromPaths = getItemResourcesFilesFromPaths;
49
+ //# sourceMappingURL=getItemResourcesFilesFromPaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getItemResourcesFilesFromPaths.js","sourceRoot":"","sources":["../../../src/resources/getItemResourcesFilesFromPaths.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,sDAAkD;AAElD,wHAAwH;AAExH;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAC5C,qBAA4C,EAC5C,cAA2B;IAE3B,mEAAmE;IACnE,OAAO,OAAO,CAAC,GAAG,CAChB,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACnC,OAAO,IAAI,OAAO,CAAc,OAAO,CAAC,EAAE;YACxC,IAAA,8BAAa,EAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,IAAI,CACjE,IAAI,CAAC,EAAE;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,IAAI;oBACJ,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;iBACb,CAAC,CAAC;YACpB,CAAC,EACD,GAAG,EAAE;gBACH,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,KAAoB,EAAE,EAAE;QAC9B,mBAAmB;QACnB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AA3BD,wEA2BC"}
@@ -0,0 +1,26 @@
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { IItemTemplate, ISourceFileCopyPath, UserSession } from "../interfaces";
17
+ /**
18
+ * Updates the solution item with resources from the itemTemplate
19
+ *
20
+ * @param itemTemplate Template for AGOL item
21
+ * @param solutionItemId item id for the solution
22
+ * @param authentication Credentials for the request to the storage
23
+ * @param storageVersion Version of the Solution template
24
+ * @returns A promise which resolves with an array of paths to resources for the item
25
+ */
26
+ export declare function getItemResourcesPaths(itemTemplate: IItemTemplate, solutionItemId: string, authentication: UserSession, storageVersion?: number): Promise<ISourceFileCopyPath[]>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2020 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.getItemResourcesPaths = void 0;
19
+ const restHelpersGet_1 = require("../restHelpersGet");
20
+ const resourceHelpers_1 = require("../resourceHelpers");
21
+ // ------------------------------------------------------------------------------------------------------------------ //
22
+ /**
23
+ * Updates the solution item with resources from the itemTemplate
24
+ *
25
+ * @param itemTemplate Template for AGOL item
26
+ * @param solutionItemId item id for the solution
27
+ * @param authentication Credentials for the request to the storage
28
+ * @param storageVersion Version of the Solution template
29
+ * @returns A promise which resolves with an array of paths to resources for the item
30
+ */
31
+ function getItemResourcesPaths(itemTemplate, solutionItemId, authentication, storageVersion = 0) {
32
+ // get the resources for the item
33
+ return (0, restHelpersGet_1.getItemResources)(itemTemplate.itemId, authentication).then(resourceResponse => {
34
+ // map out the resource names and filter for things we
35
+ // don't want transferred at this time
36
+ const itemResources = resourceResponse.resources
37
+ .map((r) => r.resource)
38
+ .filter((res) => {
39
+ let result = true;
40
+ // Certain types have resources that must be interpolated or removed and can not be
41
+ // directly copied, so they must be filtered out. Sub-optimal as it spreads
42
+ // type specific logic around the app, but until we refactor how resources
43
+ // are handled, this is necessary
44
+ // Hub Sites
45
+ if (itemTemplate.type === "Hub Site Application") {
46
+ if (res.match(/^draft-(\d+).json$/)) {
47
+ result = false;
48
+ }
49
+ }
50
+ // Storymaps
51
+ if (itemTemplate.type === "StoryMap") {
52
+ if (["oembed.json", "oembed.xml"].indexOf(res) !== -1) {
53
+ result = false;
54
+ }
55
+ if (res.match(/^draft_[\s\S]*.json$/)) {
56
+ result = false;
57
+ }
58
+ if (res === "published_data.json") {
59
+ result = false;
60
+ }
61
+ }
62
+ // Web Experiences
63
+ if (itemTemplate.type === "Web Experience") {
64
+ if (res === "config/config.json") {
65
+ result = false;
66
+ }
67
+ }
68
+ return result;
69
+ });
70
+ // create the filePaths
71
+ const resourceItemFilePaths = (0, resourceHelpers_1.generateSourceFilePaths)(authentication.portal, itemTemplate.itemId, itemTemplate.item.thumbnail, itemResources, itemTemplate.type === "Group", storageVersion);
72
+ return Promise.resolve(resourceItemFilePaths);
73
+ });
74
+ }
75
+ exports.getItemResourcesPaths = getItemResourcesPaths;
76
+ //# sourceMappingURL=getItemResourcesPaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getItemResourcesPaths.js","sourceRoot":"","sources":["../../../src/resources/getItemResourcesPaths.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sDAAqD;AACrD,wDAA6D;AAG7D,wHAAwH;AAExH;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,YAA2B,EAC3B,cAAsB,EACtB,cAA2B,EAC3B,cAAc,GAAG,CAAC;IAElB,iCAAiC;IACjC,OAAO,IAAA,iCAAgB,EAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,IAAI,CAC/D,gBAAgB,CAAC,EAAE;QACjB,sDAAsD;QACtD,sCAAsC;QACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS;aAC7C,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;aAC3B,MAAM,CAAC,CAAC,GAAQ,EAAE,EAAE;YACnB,IAAI,MAAM,GAAG,IAAI,CAAC;YAClB,mFAAmF;YACnF,2EAA2E;YAC3E,0EAA0E;YAC1E,iCAAiC;YAEjC,YAAY;YACZ,IAAI,YAAY,CAAC,IAAI,KAAK,sBAAsB,EAAE;gBAChD,IAAI,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE;oBACnC,MAAM,GAAG,KAAK,CAAC;iBAChB;aACF;YAED,YAAY;YACZ,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE;gBACpC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;oBACrD,MAAM,GAAG,KAAK,CAAC;iBAChB;gBACD,IAAI,GAAG,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE;oBACrC,MAAM,GAAG,KAAK,CAAC;iBAChB;gBACD,IAAI,GAAG,KAAK,qBAAqB,EAAE;oBACjC,MAAM,GAAG,KAAK,CAAC;iBAChB;aACF;YAED,kBAAkB;YAClB,IAAI,YAAY,CAAC,IAAI,KAAK,gBAAgB,EAAE;gBAC1C,IAAI,GAAG,KAAK,oBAAoB,EAAE;oBAChC,MAAM,GAAG,KAAK,CAAC;iBAChB;aACF;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QACL,uBAAuB;QACvB,MAAM,qBAAqB,GAA0B,IAAA,yCAAuB,EAC1E,cAAc,CAAC,MAAM,EACrB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,IAAI,CAAC,SAAS,EAC3B,aAAa,EACb,YAAY,CAAC,IAAI,KAAK,OAAO,EAC7B,cAAc,CACf,CAAC;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChD,CAAC,CACF,CAAC;AACJ,CAAC;AA7DD,sDA6DC"}
@@ -0,0 +1,29 @@
1
+ /** @license
2
+ * Copyright 2020 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
+ export * from "./addMetadataFromBlob";
17
+ export * from "./add-resource-from-blob";
18
+ export * from "./convert-item-resource-to-storage-resource";
19
+ export * from "./convert-storage-resource-to-item-resource";
20
+ export * from "./copyAssociatedFiles";
21
+ export * from "./copyDataIntoItem";
22
+ export * from "./copyMetadataIntoItem";
23
+ export * from "./copyResourceIntoZip";
24
+ export * from "./copyZipIntoItem";
25
+ export * from "./createCopyResults";
26
+ export * from "./get-blob";
27
+ export * from "./getItemResourcesFilesFromPaths";
28
+ export * from "./getItemResourcesPaths";
29
+ export * from "./solution-resource";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2020 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
+ const tslib_1 = require("tslib");
19
+ tslib_1.__exportStar(require("./addMetadataFromBlob"), exports);
20
+ tslib_1.__exportStar(require("./add-resource-from-blob"), exports);
21
+ tslib_1.__exportStar(require("./convert-item-resource-to-storage-resource"), exports);
22
+ tslib_1.__exportStar(require("./convert-storage-resource-to-item-resource"), exports);
23
+ tslib_1.__exportStar(require("./copyAssociatedFiles"), exports);
24
+ tslib_1.__exportStar(require("./copyDataIntoItem"), exports);
25
+ tslib_1.__exportStar(require("./copyMetadataIntoItem"), exports);
26
+ tslib_1.__exportStar(require("./copyResourceIntoZip"), exports);
27
+ tslib_1.__exportStar(require("./copyZipIntoItem"), exports);
28
+ tslib_1.__exportStar(require("./createCopyResults"), exports);
29
+ tslib_1.__exportStar(require("./get-blob"), exports);
30
+ tslib_1.__exportStar(require("./getItemResourcesFilesFromPaths"), exports);
31
+ tslib_1.__exportStar(require("./getItemResourcesPaths"), exports);
32
+ tslib_1.__exportStar(require("./solution-resource"), exports);
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,gEAAsC;AACtC,mEAAyC;AACzC,sFAA4D;AAC5D,sFAA4D;AAC5D,gEAAsC;AACtC,6DAAmC;AACnC,iEAAuC;AACvC,gEAAsC;AACtC,4DAAkC;AAClC,8DAAoC;AACpC,qDAA2B;AAC3B,2EAAiD;AACjD,kEAAwC;AACxC,8DAAoC"}