@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
@@ -1,35 +0,0 @@
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
- /**
17
- * Denotes type information for a SolutionResource
18
- */
19
- export declare enum SolutionResourceType {
20
- thumbnail = 0,
21
- metadata = 1,
22
- resource = 2,
23
- data = 3,
24
- fakezip = 4,
25
- info = 5
26
- }
27
- /**
28
- * Solution Resource information
29
- */
30
- export interface ISolutionResource {
31
- filename: string;
32
- type: SolutionResourceType;
33
- path: string;
34
- sourceUrl?: string;
35
- }
@@ -1,31 +0,0 @@
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.SolutionResourceType = void 0;
19
- /**
20
- * Denotes type information for a SolutionResource
21
- */
22
- var SolutionResourceType;
23
- (function (SolutionResourceType) {
24
- SolutionResourceType[SolutionResourceType["thumbnail"] = 0] = "thumbnail";
25
- SolutionResourceType[SolutionResourceType["metadata"] = 1] = "metadata";
26
- SolutionResourceType[SolutionResourceType["resource"] = 2] = "resource";
27
- SolutionResourceType[SolutionResourceType["data"] = 3] = "data";
28
- SolutionResourceType[SolutionResourceType["fakezip"] = 4] = "fakezip";
29
- SolutionResourceType[SolutionResourceType["info"] = 5] = "info";
30
- })(SolutionResourceType || (exports.SolutionResourceType = SolutionResourceType = {}));
31
- //# sourceMappingURL=solution-resource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"solution-resource.js","sourceRoot":"","sources":["../../../src/resources/solution-resource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,yEAAS,CAAA;IACT,uEAAQ,CAAA;IACR,uEAAQ,CAAA;IACR,+DAAI,CAAA;IACJ,qEAAO,CAAA;IACP,+DAAI,CAAA;AACN,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B"}
@@ -1,56 +0,0 @@
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 { ISolutionResource, SolutionResourceType } from "./solution-resource";
17
- /**
18
- * Convert an array of resource strings into an array of ISolutionResources
19
- *
20
- * Used to migrate Solutions to a more extensible resource schema
21
- *
22
- * @param resourceStrings Array of resource paths
23
- */
24
- export declare function transformResourcePathsToSolutionResources(resourceStrings?: string[]): ISolutionResource[];
25
- /**
26
- * Convert a resource path to a ISolutionResource
27
- *
28
- * @param resourcePath String
29
- */
30
- export declare function transformResourcePathToSolutionResource(resourcePath: string): ISolutionResource;
31
- /**
32
- * Convert a resource path to a SolutionResourceType
33
- *
34
- * @param resourcePath String
35
- * @private
36
- */
37
- export declare function _getSolutionResourceTypeFromResourcePath(resourcePath: string): SolutionResourceType;
38
- /**
39
- * Extract the filename from a path
40
- *
41
- * @param path String that is a path
42
- * @private
43
- */
44
- export declare function _extractFilenameFromResourcePath(path: string): string;
45
- /**
46
- * Convert the resource path into the correct output path
47
- * (aka resource prefix)
48
- *
49
- * Original resource paths encoded information in the path
50
- * including actual sub-folders. The logic is kinda complex
51
- * thus this function has extensive tests
52
- *
53
- * @param path
54
- * @private
55
- */
56
- export declare function _extractPathFromResourcePath(resourcePath: string): string;
@@ -1,146 +0,0 @@
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._extractPathFromResourcePath = exports._extractFilenameFromResourcePath = exports._getSolutionResourceTypeFromResourcePath = exports.transformResourcePathToSolutionResource = exports.transformResourcePathsToSolutionResources = void 0;
19
- const solution_resource_1 = require("./solution-resource");
20
- const hub_common_1 = require("@esri/hub-common");
21
- /**
22
- * Convert an array of resource strings into an array of ISolutionResources
23
- *
24
- * Used to migrate Solutions to a more extensible resource schema
25
- *
26
- * @param resourceStrings Array of resource paths
27
- */
28
- function transformResourcePathsToSolutionResources(resourceStrings = []) {
29
- return resourceStrings.map(transformResourcePathToSolutionResource);
30
- }
31
- exports.transformResourcePathsToSolutionResources = transformResourcePathsToSolutionResources;
32
- /**
33
- * Convert a resource path to a ISolutionResource
34
- *
35
- * @param resourcePath String
36
- */
37
- function transformResourcePathToSolutionResource(resourcePath) {
38
- return {
39
- filename: _extractFilenameFromResourcePath(resourcePath),
40
- type: _getSolutionResourceTypeFromResourcePath(resourcePath),
41
- path: _extractPathFromResourcePath(resourcePath),
42
- sourceUrl: resourcePath
43
- };
44
- }
45
- exports.transformResourcePathToSolutionResource = transformResourcePathToSolutionResource;
46
- /**
47
- * Convert a resource path to a SolutionResourceType
48
- *
49
- * @param resourcePath String
50
- * @private
51
- */
52
- function _getSolutionResourceTypeFromResourcePath(resourcePath) {
53
- let type = solution_resource_1.SolutionResourceType.resource;
54
- const folder = resourcePath
55
- .split("/")
56
- .slice(0, -1)
57
- .join("/") || "";
58
- PATH_TO_TYPE_MAP.forEach(entry => {
59
- if (folder.endsWith(entry.ending)) {
60
- type = entry.type;
61
- }
62
- });
63
- return type;
64
- }
65
- exports._getSolutionResourceTypeFromResourcePath = _getSolutionResourceTypeFromResourcePath;
66
- /**
67
- * Mapping of strings that have been appended to the resource path to
68
- * encode the resource type
69
- */
70
- const PATH_TO_TYPE_MAP = [
71
- { ending: "_info_thumbnail", type: solution_resource_1.SolutionResourceType.thumbnail },
72
- { ending: "_info_metadata", type: solution_resource_1.SolutionResourceType.metadata },
73
- { ending: "_info_data", type: solution_resource_1.SolutionResourceType.data },
74
- { ending: "_info_dataz", type: solution_resource_1.SolutionResourceType.fakezip },
75
- { ending: "_info", type: solution_resource_1.SolutionResourceType.info }
76
- ];
77
- /**
78
- * Extract the filename from a path
79
- *
80
- * @param path String that is a path
81
- * @private
82
- */
83
- function _extractFilenameFromResourcePath(path) {
84
- // if we have path separators, split and grab last segment
85
- if (path.indexOf("/") > -1) {
86
- return path.split("/").reverse()[0];
87
- }
88
- else {
89
- // Hub resources are {guid}-{filename.ext}
90
- if (path.indexOf("-") === 32) {
91
- // start at 33 to remove the `-` between the filename and the guid
92
- return path.substr(33, path.length - 1);
93
- }
94
- else {
95
- // path is the filename
96
- return path;
97
- }
98
- }
99
- }
100
- exports._extractFilenameFromResourcePath = _extractFilenameFromResourcePath;
101
- /**
102
- * Convert the resource path into the correct output path
103
- * (aka resource prefix)
104
- *
105
- * Original resource paths encoded information in the path
106
- * including actual sub-folders. The logic is kinda complex
107
- * thus this function has extensive tests
108
- *
109
- * @param path
110
- * @private
111
- */
112
- function _extractPathFromResourcePath(resourcePath) {
113
- // default case
114
- let path = "";
115
- // parse up the path by splittins on `/` and dropping the last segment
116
- const parsedPath = resourcePath
117
- .split("/")
118
- .slice(0, -1)
119
- .join("/") || "";
120
- // if we got something...
121
- if (parsedPath) {
122
- // now we need to see if this has any of the well-known endings
123
- const isWellKnownPath = PATH_TO_TYPE_MAP.reduce((acc, entry) => {
124
- if (parsedPath.endsWith(entry.ending)) {
125
- acc = true;
126
- }
127
- return acc;
128
- }, false);
129
- // if it does not match a well-known path...
130
- if (!isWellKnownPath && parsedPath.indexOf("http") !== 0) {
131
- // see if there is another folder encoded...
132
- if (parsedPath.indexOf("_") > -1) {
133
- path = parsedPath.split("_")[1];
134
- }
135
- else {
136
- // if the path is not a naked guid, we return the parsed path
137
- if (!(0, hub_common_1.isGuid)(parsedPath)) {
138
- path = parsedPath;
139
- }
140
- }
141
- }
142
- }
143
- return path;
144
- }
145
- exports._extractPathFromResourcePath = _extractPathFromResourcePath;
146
- //# sourceMappingURL=transform-resource-paths-to-solution-resources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-resource-paths-to-solution-resources.js","sourceRoot":"","sources":["../../../src/resources/transform-resource-paths-to-solution-resources.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAA8E;AAC9E,iDAA0C;AAC1C;;;;;;GAMG;AACH,SAAgB,yCAAyC,CACvD,kBAA4B,EAAE;IAE9B,OAAO,eAAe,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AACtE,CAAC;AAJD,8FAIC;AAED;;;;GAIG;AACH,SAAgB,uCAAuC,CACrD,YAAoB;IAEpB,OAAO;QACL,QAAQ,EAAE,gCAAgC,CAAC,YAAY,CAAC;QACxD,IAAI,EAAE,wCAAwC,CAAC,YAAY,CAAC;QAC5D,IAAI,EAAE,4BAA4B,CAAC,YAAY,CAAC;QAChD,SAAS,EAAE,YAAY;KACH,CAAC;AACzB,CAAC;AATD,0FASC;AAED;;;;;GAKG;AACH,SAAgB,wCAAwC,CACtD,YAAoB;IAEpB,IAAI,IAAI,GAAG,wCAAoB,CAAC,QAAQ,CAAC;IAEzC,MAAM,MAAM,GACV,YAAY;SACT,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACZ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAErB,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC/B,IAAI,MAA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