@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.
- package/dist/cjs/completeItem.d.ts +29 -0
- package/dist/cjs/completeItem.js +92 -0
- package/dist/cjs/completeItem.js.map +1 -0
- package/dist/cjs/create-hub-request-options.d.ts +29 -0
- package/dist/cjs/create-hub-request-options.js +64 -0
- package/dist/cjs/create-hub-request-options.js.map +1 -0
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.d.ts +24 -0
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.js +42 -0
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.js.map +1 -0
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.d.ts +27 -0
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js +97 -0
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js.map +1 -0
- package/dist/cjs/deleteHelpers/deleteSolutionContents.d.ts +38 -0
- package/dist/cjs/deleteHelpers/deleteSolutionContents.js +130 -0
- package/dist/cjs/deleteHelpers/deleteSolutionContents.js.map +1 -0
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.d.ts +29 -0
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +79 -0
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.js.map +1 -0
- package/dist/cjs/deleteHelpers/deleteSolutionItem.d.ts +30 -0
- package/dist/cjs/deleteHelpers/deleteSolutionItem.js +54 -0
- package/dist/cjs/deleteHelpers/deleteSolutionItem.js.map +1 -0
- package/dist/cjs/deleteHelpers/index.d.ts +22 -0
- package/dist/cjs/deleteHelpers/index.js +26 -0
- package/dist/cjs/deleteHelpers/index.js.map +1 -0
- package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.d.ts +27 -0
- package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js +34 -0
- package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js.map +1 -0
- package/dist/cjs/deleteHelpers/removeItems.d.ts +34 -0
- package/dist/cjs/deleteHelpers/removeItems.js +112 -0
- package/dist/cjs/deleteHelpers/removeItems.js.map +1 -0
- package/dist/cjs/deleteHelpers/reportProgress.d.ts +27 -0
- package/dist/cjs/deleteHelpers/reportProgress.js +46 -0
- package/dist/cjs/deleteHelpers/reportProgress.js.map +1 -0
- package/dist/cjs/deleteSolution.d.ts +55 -0
- package/dist/cjs/deleteSolution.js +107 -0
- package/dist/cjs/deleteSolution.js.map +1 -0
- package/dist/cjs/dependencies.d.ts +26 -0
- package/dist/cjs/dependencies.js +171 -0
- package/dist/cjs/dependencies.js.map +1 -0
- package/dist/cjs/featureServiceHelpers.d.ts +799 -0
- package/dist/cjs/featureServiceHelpers.js +2438 -0
- package/dist/cjs/featureServiceHelpers.js.map +1 -0
- package/dist/cjs/formHelpers.d.ts +41 -0
- package/dist/cjs/formHelpers.js +78 -0
- package/dist/cjs/formHelpers.js.map +1 -0
- package/dist/cjs/generalHelpers.d.ts +433 -0
- package/dist/cjs/generalHelpers.js +925 -0
- package/dist/cjs/generalHelpers.js.map +1 -0
- package/dist/cjs/get-subscription-info.d.ts +27 -0
- package/dist/cjs/get-subscription-info.js +39 -0
- package/dist/cjs/get-subscription-info.js.map +1 -0
- package/dist/cjs/getDeletableSolutionInfo.d.ts +29 -0
- package/dist/cjs/getDeletableSolutionInfo.js +53 -0
- package/dist/cjs/getDeletableSolutionInfo.js.map +1 -0
- package/dist/cjs/getItemTypeAbbrev.d.ts +19 -0
- package/dist/cjs/getItemTypeAbbrev.js +186 -0
- package/dist/cjs/getItemTypeAbbrev.js.map +1 -0
- package/dist/cjs/getSolutionSummary.d.ts +27 -0
- package/dist/cjs/getSolutionSummary.js +101 -0
- package/dist/cjs/getSolutionSummary.js.map +1 -0
- package/dist/cjs/index.d.ts +46 -0
- package/dist/cjs/index.js +50 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces.d.ts +1362 -0
- package/dist/cjs/interfaces.js +77 -0
- package/dist/cjs/interfaces.js.map +1 -0
- package/dist/cjs/libConnectors.d.ts +73 -0
- package/dist/cjs/libConnectors.js +115 -0
- package/dist/cjs/libConnectors.js.map +1 -0
- package/dist/cjs/migrations/apply-schema.d.ts +24 -0
- package/dist/cjs/migrations/apply-schema.js +36 -0
- package/dist/cjs/migrations/apply-schema.js.map +1 -0
- package/dist/cjs/migrations/is-legacy-solution.d.ts +24 -0
- package/dist/cjs/migrations/is-legacy-solution.js +40 -0
- package/dist/cjs/migrations/is-legacy-solution.js.map +1 -0
- package/dist/cjs/migrations/upgrade-three-dot-one.d.ts +27 -0
- package/dist/cjs/migrations/upgrade-three-dot-one.js +49 -0
- package/dist/cjs/migrations/upgrade-three-dot-one.js.map +1 -0
- package/dist/cjs/migrations/upgrade-three-dot-zero.d.ts +27 -0
- package/dist/cjs/migrations/upgrade-three-dot-zero.js +43 -0
- package/dist/cjs/migrations/upgrade-three-dot-zero.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-five.d.ts +24 -0
- package/dist/cjs/migrations/upgrade-two-dot-five.js +73 -0
- package/dist/cjs/migrations/upgrade-two-dot-five.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-four.d.ts +24 -0
- package/dist/cjs/migrations/upgrade-two-dot-four.js +72 -0
- package/dist/cjs/migrations/upgrade-two-dot-four.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-one.d.ts +7 -0
- package/dist/cjs/migrations/upgrade-two-dot-one.js +39 -0
- package/dist/cjs/migrations/upgrade-two-dot-one.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-seven.d.ts +23 -0
- package/dist/cjs/migrations/upgrade-two-dot-seven.js +58 -0
- package/dist/cjs/migrations/upgrade-two-dot-seven.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-six.d.ts +27 -0
- package/dist/cjs/migrations/upgrade-two-dot-six.js +61 -0
- package/dist/cjs/migrations/upgrade-two-dot-six.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-three.d.ts +23 -0
- package/dist/cjs/migrations/upgrade-two-dot-three.js +55 -0
- package/dist/cjs/migrations/upgrade-two-dot-three.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-two.d.ts +23 -0
- package/dist/cjs/migrations/upgrade-two-dot-two.js +58 -0
- package/dist/cjs/migrations/upgrade-two-dot-two.js.map +1 -0
- package/dist/cjs/migrations/upgrade-two-dot-zero.d.ts +44 -0
- package/dist/cjs/migrations/upgrade-two-dot-zero.js +95 -0
- package/dist/cjs/migrations/upgrade-two-dot-zero.js.map +1 -0
- package/dist/cjs/migrator.d.ts +25 -0
- package/dist/cjs/migrator.js +77 -0
- package/dist/cjs/migrator.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/resourceHelpers.d.ts +191 -0
- package/dist/cjs/resourceHelpers.js +384 -0
- package/dist/cjs/resourceHelpers.js.map +1 -0
- package/dist/cjs/resources/add-resource-from-blob.d.ts +26 -0
- package/dist/cjs/resources/add-resource-from-blob.js +52 -0
- package/dist/cjs/resources/add-resource-from-blob.js.map +1 -0
- package/dist/cjs/resources/addMetadataFromBlob.d.ts +25 -0
- package/dist/cjs/resources/addMetadataFromBlob.js +43 -0
- package/dist/cjs/resources/addMetadataFromBlob.js.map +1 -0
- package/dist/cjs/resources/convert-item-resource-to-storage-resource.d.ts +32 -0
- package/dist/cjs/resources/convert-item-resource-to-storage-resource.js +70 -0
- package/dist/cjs/resources/convert-item-resource-to-storage-resource.js.map +1 -0
- package/dist/cjs/resources/convert-storage-resource-to-item-resource.d.ts +29 -0
- package/dist/cjs/resources/convert-storage-resource-to-item-resource.js +70 -0
- package/dist/cjs/resources/convert-storage-resource-to-item-resource.js.map +1 -0
- package/dist/cjs/resources/copyAssociatedFiles.d.ts +67 -0
- package/dist/cjs/resources/copyAssociatedFiles.js +304 -0
- package/dist/cjs/resources/copyAssociatedFiles.js.map +1 -0
- package/dist/cjs/resources/copyDataIntoItem.d.ts +33 -0
- package/dist/cjs/resources/copyDataIntoItem.js +62 -0
- package/dist/cjs/resources/copyDataIntoItem.js.map +1 -0
- package/dist/cjs/resources/copyMetadataIntoItem.d.ts +26 -0
- package/dist/cjs/resources/copyMetadataIntoItem.js +46 -0
- package/dist/cjs/resources/copyMetadataIntoItem.js.map +1 -0
- package/dist/cjs/resources/copyResourceIntoZip.d.ts +33 -0
- package/dist/cjs/resources/copyResourceIntoZip.js +78 -0
- package/dist/cjs/resources/copyResourceIntoZip.js.map +1 -0
- package/dist/cjs/resources/copyZipIntoItem.d.ts +25 -0
- package/dist/cjs/resources/copyZipIntoItem.js +54 -0
- package/dist/cjs/resources/copyZipIntoItem.js.map +1 -0
- package/dist/cjs/resources/createCopyResults.d.ts +25 -0
- package/dist/cjs/resources/createCopyResults.js +36 -0
- package/dist/cjs/resources/createCopyResults.js.map +1 -0
- package/dist/cjs/resources/get-blob.d.ts +26 -0
- package/dist/cjs/resources/get-blob.js +27 -0
- package/dist/cjs/resources/get-blob.js.map +1 -0
- package/dist/cjs/resources/getItemResourcesFilesFromPaths.d.ts +24 -0
- package/dist/cjs/resources/getItemResourcesFilesFromPaths.js +49 -0
- package/dist/cjs/resources/getItemResourcesFilesFromPaths.js.map +1 -0
- package/dist/cjs/resources/getItemResourcesPaths.d.ts +26 -0
- package/dist/cjs/resources/getItemResourcesPaths.js +76 -0
- package/dist/cjs/resources/getItemResourcesPaths.js.map +1 -0
- package/dist/cjs/resources/index.d.ts +29 -0
- package/dist/cjs/resources/index.js +33 -0
- package/dist/cjs/resources/index.js.map +1 -0
- package/dist/cjs/resources/solution-resource.d.ts +35 -0
- package/dist/cjs/resources/solution-resource.js +31 -0
- package/dist/cjs/resources/solution-resource.js.map +1 -0
- package/dist/cjs/resources/transform-resource-paths-to-solution-resources.d.ts +56 -0
- package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js +146 -0
- package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js.map +1 -0
- package/dist/cjs/restHelpers.d.ts +607 -0
- package/dist/cjs/restHelpers.js +1954 -0
- package/dist/cjs/restHelpers.js.map +1 -0
- package/dist/cjs/restHelpersGet.d.ts +288 -0
- package/dist/cjs/restHelpersGet.js +804 -0
- package/dist/cjs/restHelpersGet.js.map +1 -0
- package/dist/cjs/sharing/index.d.ts +16 -0
- package/dist/cjs/sharing/index.js +20 -0
- package/dist/cjs/sharing/index.js.map +1 -0
- package/dist/cjs/sharing/share-item-to-groups.d.ts +26 -0
- package/dist/cjs/sharing/share-item-to-groups.js +44 -0
- package/dist/cjs/sharing/share-item-to-groups.js.map +1 -0
- package/dist/cjs/templatization.d.ts +139 -0
- package/dist/cjs/templatization.js +316 -0
- package/dist/cjs/templatization.js.map +1 -0
- package/dist/cjs/trackingHelpers.d.ts +116 -0
- package/dist/cjs/trackingHelpers.js +217 -0
- package/dist/cjs/trackingHelpers.js.map +1 -0
- package/dist/cjs/velocityHelpers.d.ts +57 -0
- package/dist/cjs/velocityHelpers.js +135 -0
- package/dist/cjs/velocityHelpers.js.map +1 -0
- package/dist/cjs/workflowHelpers.d.ts +37 -0
- package/dist/cjs/workflowHelpers.js +77 -0
- package/dist/cjs/workflowHelpers.js.map +1 -0
- package/dist/cjs/workforceHelpers.d.ts +115 -0
- package/dist/cjs/workforceHelpers.js +749 -0
- package/dist/cjs/workforceHelpers.js.map +1 -0
- package/dist/cjs/zip-utils.d.ts +76 -0
- package/dist/cjs/zip-utils.js +142 -0
- package/dist/cjs/zip-utils.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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;
|
|
@@ -0,0 +1,146 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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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