@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.
- package/README.md +4 -7
- package/dist/esm/completeItem.js +3 -3
- package/dist/esm/completeItem.js.map +1 -1
- package/dist/esm/formHelpers.d.ts +41 -0
- package/dist/esm/formHelpers.js +71 -0
- package/dist/esm/formHelpers.js.map +1 -0
- package/dist/esm/generalHelpers.d.ts +33 -0
- package/dist/esm/generalHelpers.js +44 -1
- package/dist/esm/generalHelpers.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces.d.ts +19 -1
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/esm/restHelpers.d.ts +10 -1
- package/dist/esm/restHelpers.js +25 -1
- package/dist/esm/restHelpers.js.map +1 -1
- package/dist/esm/templatization.js +5 -3
- package/dist/esm/templatization.js.map +1 -1
- package/dist/esm/workflowHelpers.d.ts +21 -1
- package/dist/esm/workflowHelpers.js +48 -48
- package/dist/esm/workflowHelpers.js.map +1 -1
- package/dist/esm/zip-utils.d.ts +44 -17
- package/dist/esm/zip-utils.js +73 -24
- package/dist/esm/zip-utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/completeItem.d.ts +0 -29
- package/dist/cjs/completeItem.js +0 -92
- package/dist/cjs/completeItem.js.map +0 -1
- package/dist/cjs/create-hub-request-options.d.ts +0 -29
- package/dist/cjs/create-hub-request-options.js +0 -64
- package/dist/cjs/create-hub-request-options.js.map +0 -1
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.d.ts +0 -24
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.js +0 -42
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.js.map +0 -1
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.d.ts +0 -27
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js +0 -97
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js.map +0 -1
- package/dist/cjs/deleteHelpers/deleteSolutionContents.d.ts +0 -38
- package/dist/cjs/deleteHelpers/deleteSolutionContents.js +0 -130
- package/dist/cjs/deleteHelpers/deleteSolutionContents.js.map +0 -1
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.d.ts +0 -29
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +0 -79
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.js.map +0 -1
- package/dist/cjs/deleteHelpers/deleteSolutionItem.d.ts +0 -30
- package/dist/cjs/deleteHelpers/deleteSolutionItem.js +0 -54
- package/dist/cjs/deleteHelpers/deleteSolutionItem.js.map +0 -1
- package/dist/cjs/deleteHelpers/index.d.ts +0 -22
- package/dist/cjs/deleteHelpers/index.js +0 -26
- package/dist/cjs/deleteHelpers/index.js.map +0 -1
- package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.d.ts +0 -27
- package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js +0 -34
- package/dist/cjs/deleteHelpers/reconstructBuildOrderIds.js.map +0 -1
- package/dist/cjs/deleteHelpers/removeItems.d.ts +0 -34
- package/dist/cjs/deleteHelpers/removeItems.js +0 -112
- package/dist/cjs/deleteHelpers/removeItems.js.map +0 -1
- package/dist/cjs/deleteHelpers/reportProgress.d.ts +0 -27
- package/dist/cjs/deleteHelpers/reportProgress.js +0 -46
- package/dist/cjs/deleteHelpers/reportProgress.js.map +0 -1
- package/dist/cjs/deleteSolution.d.ts +0 -55
- package/dist/cjs/deleteSolution.js +0 -107
- package/dist/cjs/deleteSolution.js.map +0 -1
- package/dist/cjs/dependencies.d.ts +0 -26
- package/dist/cjs/dependencies.js +0 -171
- package/dist/cjs/dependencies.js.map +0 -1
- package/dist/cjs/featureServiceHelpers.d.ts +0 -799
- package/dist/cjs/featureServiceHelpers.js +0 -2438
- package/dist/cjs/featureServiceHelpers.js.map +0 -1
- package/dist/cjs/generalHelpers.d.ts +0 -400
- package/dist/cjs/generalHelpers.js +0 -877
- package/dist/cjs/generalHelpers.js.map +0 -1
- package/dist/cjs/get-subscription-info.d.ts +0 -27
- package/dist/cjs/get-subscription-info.js +0 -39
- package/dist/cjs/get-subscription-info.js.map +0 -1
- package/dist/cjs/getDeletableSolutionInfo.d.ts +0 -29
- package/dist/cjs/getDeletableSolutionInfo.js +0 -53
- package/dist/cjs/getDeletableSolutionInfo.js.map +0 -1
- package/dist/cjs/getItemTypeAbbrev.d.ts +0 -19
- package/dist/cjs/getItemTypeAbbrev.js +0 -186
- package/dist/cjs/getItemTypeAbbrev.js.map +0 -1
- package/dist/cjs/getSolutionSummary.d.ts +0 -27
- package/dist/cjs/getSolutionSummary.js +0 -101
- package/dist/cjs/getSolutionSummary.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -44
- package/dist/cjs/index.js +0 -48
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/interfaces.d.ts +0 -1344
- package/dist/cjs/interfaces.js +0 -77
- package/dist/cjs/interfaces.js.map +0 -1
- package/dist/cjs/libConnectors.d.ts +0 -73
- package/dist/cjs/libConnectors.js +0 -115
- package/dist/cjs/libConnectors.js.map +0 -1
- package/dist/cjs/migrations/apply-schema.d.ts +0 -24
- package/dist/cjs/migrations/apply-schema.js +0 -36
- package/dist/cjs/migrations/apply-schema.js.map +0 -1
- package/dist/cjs/migrations/is-legacy-solution.d.ts +0 -24
- package/dist/cjs/migrations/is-legacy-solution.js +0 -40
- package/dist/cjs/migrations/is-legacy-solution.js.map +0 -1
- package/dist/cjs/migrations/upgrade-three-dot-one.d.ts +0 -27
- package/dist/cjs/migrations/upgrade-three-dot-one.js +0 -49
- package/dist/cjs/migrations/upgrade-three-dot-one.js.map +0 -1
- package/dist/cjs/migrations/upgrade-three-dot-zero.d.ts +0 -27
- package/dist/cjs/migrations/upgrade-three-dot-zero.js +0 -43
- package/dist/cjs/migrations/upgrade-three-dot-zero.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-five.d.ts +0 -24
- package/dist/cjs/migrations/upgrade-two-dot-five.js +0 -73
- package/dist/cjs/migrations/upgrade-two-dot-five.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-four.d.ts +0 -24
- package/dist/cjs/migrations/upgrade-two-dot-four.js +0 -72
- package/dist/cjs/migrations/upgrade-two-dot-four.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-one.d.ts +0 -7
- package/dist/cjs/migrations/upgrade-two-dot-one.js +0 -39
- package/dist/cjs/migrations/upgrade-two-dot-one.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-seven.d.ts +0 -23
- package/dist/cjs/migrations/upgrade-two-dot-seven.js +0 -58
- package/dist/cjs/migrations/upgrade-two-dot-seven.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-six.d.ts +0 -27
- package/dist/cjs/migrations/upgrade-two-dot-six.js +0 -61
- package/dist/cjs/migrations/upgrade-two-dot-six.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-three.d.ts +0 -23
- package/dist/cjs/migrations/upgrade-two-dot-three.js +0 -55
- package/dist/cjs/migrations/upgrade-two-dot-three.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-two.d.ts +0 -23
- package/dist/cjs/migrations/upgrade-two-dot-two.js +0 -58
- package/dist/cjs/migrations/upgrade-two-dot-two.js.map +0 -1
- package/dist/cjs/migrations/upgrade-two-dot-zero.d.ts +0 -44
- package/dist/cjs/migrations/upgrade-two-dot-zero.js +0 -95
- package/dist/cjs/migrations/upgrade-two-dot-zero.js.map +0 -1
- package/dist/cjs/migrator.d.ts +0 -25
- package/dist/cjs/migrator.js +0 -77
- package/dist/cjs/migrator.js.map +0 -1
- package/dist/cjs/resourceHelpers.d.ts +0 -191
- package/dist/cjs/resourceHelpers.js +0 -384
- package/dist/cjs/resourceHelpers.js.map +0 -1
- package/dist/cjs/resources/add-resource-from-blob.d.ts +0 -26
- package/dist/cjs/resources/add-resource-from-blob.js +0 -52
- package/dist/cjs/resources/add-resource-from-blob.js.map +0 -1
- package/dist/cjs/resources/addMetadataFromBlob.d.ts +0 -25
- package/dist/cjs/resources/addMetadataFromBlob.js +0 -43
- package/dist/cjs/resources/addMetadataFromBlob.js.map +0 -1
- package/dist/cjs/resources/convert-item-resource-to-storage-resource.d.ts +0 -32
- package/dist/cjs/resources/convert-item-resource-to-storage-resource.js +0 -70
- package/dist/cjs/resources/convert-item-resource-to-storage-resource.js.map +0 -1
- package/dist/cjs/resources/convert-storage-resource-to-item-resource.d.ts +0 -29
- package/dist/cjs/resources/convert-storage-resource-to-item-resource.js +0 -70
- package/dist/cjs/resources/convert-storage-resource-to-item-resource.js.map +0 -1
- package/dist/cjs/resources/copyAssociatedFiles.d.ts +0 -67
- package/dist/cjs/resources/copyAssociatedFiles.js +0 -304
- package/dist/cjs/resources/copyAssociatedFiles.js.map +0 -1
- package/dist/cjs/resources/copyDataIntoItem.d.ts +0 -33
- package/dist/cjs/resources/copyDataIntoItem.js +0 -62
- package/dist/cjs/resources/copyDataIntoItem.js.map +0 -1
- package/dist/cjs/resources/copyMetadataIntoItem.d.ts +0 -26
- package/dist/cjs/resources/copyMetadataIntoItem.js +0 -46
- package/dist/cjs/resources/copyMetadataIntoItem.js.map +0 -1
- package/dist/cjs/resources/copyResourceIntoZip.d.ts +0 -33
- package/dist/cjs/resources/copyResourceIntoZip.js +0 -78
- package/dist/cjs/resources/copyResourceIntoZip.js.map +0 -1
- package/dist/cjs/resources/copyZipIntoItem.d.ts +0 -25
- package/dist/cjs/resources/copyZipIntoItem.js +0 -54
- package/dist/cjs/resources/copyZipIntoItem.js.map +0 -1
- package/dist/cjs/resources/createCopyResults.d.ts +0 -25
- package/dist/cjs/resources/createCopyResults.js +0 -36
- package/dist/cjs/resources/createCopyResults.js.map +0 -1
- package/dist/cjs/resources/get-blob.d.ts +0 -26
- package/dist/cjs/resources/get-blob.js +0 -27
- package/dist/cjs/resources/get-blob.js.map +0 -1
- package/dist/cjs/resources/getItemResourcesFilesFromPaths.d.ts +0 -24
- package/dist/cjs/resources/getItemResourcesFilesFromPaths.js +0 -49
- package/dist/cjs/resources/getItemResourcesFilesFromPaths.js.map +0 -1
- package/dist/cjs/resources/getItemResourcesPaths.d.ts +0 -26
- package/dist/cjs/resources/getItemResourcesPaths.js +0 -76
- package/dist/cjs/resources/getItemResourcesPaths.js.map +0 -1
- package/dist/cjs/resources/index.d.ts +0 -29
- package/dist/cjs/resources/index.js +0 -33
- package/dist/cjs/resources/index.js.map +0 -1
- package/dist/cjs/resources/solution-resource.d.ts +0 -35
- package/dist/cjs/resources/solution-resource.js +0 -31
- package/dist/cjs/resources/solution-resource.js.map +0 -1
- package/dist/cjs/resources/transform-resource-paths-to-solution-resources.d.ts +0 -56
- package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js +0 -146
- package/dist/cjs/resources/transform-resource-paths-to-solution-resources.js.map +0 -1
- package/dist/cjs/restHelpers.d.ts +0 -598
- package/dist/cjs/restHelpers.js +0 -1929
- package/dist/cjs/restHelpers.js.map +0 -1
- package/dist/cjs/restHelpersGet.d.ts +0 -288
- package/dist/cjs/restHelpersGet.js +0 -804
- package/dist/cjs/restHelpersGet.js.map +0 -1
- package/dist/cjs/sharing/index.d.ts +0 -16
- package/dist/cjs/sharing/index.js +0 -20
- package/dist/cjs/sharing/index.js.map +0 -1
- package/dist/cjs/sharing/share-item-to-groups.d.ts +0 -26
- package/dist/cjs/sharing/share-item-to-groups.js +0 -44
- package/dist/cjs/sharing/share-item-to-groups.js.map +0 -1
- package/dist/cjs/templatization.d.ts +0 -139
- package/dist/cjs/templatization.js +0 -314
- package/dist/cjs/templatization.js.map +0 -1
- package/dist/cjs/trackingHelpers.d.ts +0 -116
- package/dist/cjs/trackingHelpers.js +0 -217
- package/dist/cjs/trackingHelpers.js.map +0 -1
- package/dist/cjs/velocityHelpers.d.ts +0 -57
- package/dist/cjs/velocityHelpers.js +0 -135
- package/dist/cjs/velocityHelpers.js.map +0 -1
- package/dist/cjs/workflowHelpers.d.ts +0 -17
- package/dist/cjs/workflowHelpers.js +0 -76
- package/dist/cjs/workflowHelpers.js.map +0 -1
- package/dist/cjs/workforceHelpers.d.ts +0 -115
- package/dist/cjs/workforceHelpers.js +0 -749
- package/dist/cjs/workforceHelpers.js.map +0 -1
- package/dist/cjs/zip-utils.d.ts +0 -49
- package/dist/cjs/zip-utils.js +0 -89
- package/dist/cjs/zip-utils.js.map +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2021 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { IItemTemplate, UserSession } from "./interfaces";
|
|
17
|
-
import { IItemUpdate } from "@esri/arcgis-rest-types";
|
|
18
|
-
import { ICreateServiceParams } from "@esri/arcgis-rest-service-admin";
|
|
19
|
-
/**
|
|
20
|
-
* Used by deploy to evaluate if we have everything we need to deploy tracking views.
|
|
21
|
-
*
|
|
22
|
-
* This function will update the input templateDictionary with a boolean
|
|
23
|
-
* indicating if tracking is enabled on the org and the user is an admin.
|
|
24
|
-
*
|
|
25
|
-
* @param portalResponse portal self response
|
|
26
|
-
* @param userResponse portal user response
|
|
27
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
28
|
-
* @param templates the list of IItemTemplates from the solution
|
|
29
|
-
*
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
export declare function setLocationTrackingEnabled(portalResponse: any, userResponse: any, templateDictionary: any, templates?: IItemTemplate[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Used by deploy to evaluate if we have everything we need to deploy tracking views.
|
|
35
|
-
*
|
|
36
|
-
* An error is thrown to prevent additional deployment work if we have Tracking items and tracking is
|
|
37
|
-
* not enabled or the deployment user is not an admin in the organization.
|
|
38
|
-
*
|
|
39
|
-
* @param templates the list of IItemTemplates from the solution
|
|
40
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
41
|
-
*
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
export declare function _validateTrackingTemplates(templates: IItemTemplate[], templateDictionary: any): void;
|
|
45
|
-
/**
|
|
46
|
-
* Used by deploy to determine the owner of the tracking service.
|
|
47
|
-
* Only one tracking service per org and all tracking views and tracking groups must be owned by the tracking service owner.
|
|
48
|
-
*
|
|
49
|
-
* This function will update the input templateDictionary with the owner as well as
|
|
50
|
-
* the item id for the source tracking service.
|
|
51
|
-
*
|
|
52
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
53
|
-
* @param authentication Credentials for the requests
|
|
54
|
-
*
|
|
55
|
-
* @private
|
|
56
|
-
*/
|
|
57
|
-
export declare function getTackingServiceOwner(templateDictionary: any, authentication: UserSession): Promise<boolean>;
|
|
58
|
-
/**
|
|
59
|
-
* Check key properties to understand if we are dealing with a tracking template
|
|
60
|
-
*
|
|
61
|
-
* @param itemTemplate the template to evaluate
|
|
62
|
-
* @param itemUpdate the item update to evaluate
|
|
63
|
-
*
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
export declare function isTrackingViewTemplate(itemTemplate?: IItemTemplate, itemUpdate?: IItemUpdate): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check key properties to understand if we are dealing with a tracking group template
|
|
69
|
-
*
|
|
70
|
-
* @param itemTemplate the template to evaluate
|
|
71
|
-
*
|
|
72
|
-
* @private
|
|
73
|
-
*/
|
|
74
|
-
export declare function isTrackingViewGroup(itemTemplate: IItemTemplate): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Templatize the tracker view group id and view name for location tracking views.
|
|
77
|
-
* This function will update the itemTemplate that is passed in when it's a tracking view.
|
|
78
|
-
*
|
|
79
|
-
* @param itemTemplate Template for feature service item
|
|
80
|
-
*
|
|
81
|
-
* @private
|
|
82
|
-
*/
|
|
83
|
-
export declare function templatizeTracker(itemTemplate: IItemTemplate): void;
|
|
84
|
-
/**
|
|
85
|
-
* Templatize the tracker view group id and view name for location tracking views.
|
|
86
|
-
* This function will update the itemTemplate that is passed in when it's a tracking view.
|
|
87
|
-
*
|
|
88
|
-
* @param itemTemplate Template for the tracker view
|
|
89
|
-
* @param path the path to the property that stores the current name
|
|
90
|
-
* @param groupId the id of the associated tracker group
|
|
91
|
-
* @param groupIdVar the variable to replace the existing name with
|
|
92
|
-
*
|
|
93
|
-
* @private
|
|
94
|
-
*/
|
|
95
|
-
export declare function _setName(itemTemplate: IItemTemplate, path: string, groupId: string, groupIdVar: string): void;
|
|
96
|
-
/**
|
|
97
|
-
* Templatize the tracker view serviceItemId
|
|
98
|
-
*
|
|
99
|
-
* This function will update the input obj with the templatized variable
|
|
100
|
-
*
|
|
101
|
-
* @param obj the object that stores the serviceItemId
|
|
102
|
-
* @param path the path to the property that stores the serviceItemId
|
|
103
|
-
*
|
|
104
|
-
* @private
|
|
105
|
-
*/
|
|
106
|
-
export declare function templatizeServiceItemId(obj: any, path: string): void;
|
|
107
|
-
/**
|
|
108
|
-
* Used by deploy to update the request options with key details for deploying tracker views
|
|
109
|
-
*
|
|
110
|
-
* @param itemTemplate Template for feature service item
|
|
111
|
-
* @param options the current request options to update
|
|
112
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
113
|
-
*
|
|
114
|
-
* @private
|
|
115
|
-
*/
|
|
116
|
-
export declare function setTrackingOptions(itemTemplate: IItemTemplate, options: any, templateDictionary: any): ICreateServiceParams;
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2021 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.setTrackingOptions = exports.templatizeServiceItemId = exports._setName = exports.templatizeTracker = exports.isTrackingViewGroup = exports.isTrackingViewTemplate = exports.getTackingServiceOwner = exports._validateTrackingTemplates = exports.setLocationTrackingEnabled = void 0;
|
|
19
|
-
const generalHelpers_1 = require("./generalHelpers");
|
|
20
|
-
const restHelpersGet_1 = require("./restHelpersGet");
|
|
21
|
-
const templatization_1 = require("./templatization");
|
|
22
|
-
/**
|
|
23
|
-
* Used by deploy to evaluate if we have everything we need to deploy tracking views.
|
|
24
|
-
*
|
|
25
|
-
* This function will update the input templateDictionary with a boolean
|
|
26
|
-
* indicating if tracking is enabled on the org and the user is an admin.
|
|
27
|
-
*
|
|
28
|
-
* @param portalResponse portal self response
|
|
29
|
-
* @param userResponse portal user response
|
|
30
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
31
|
-
* @param templates the list of IItemTemplates from the solution
|
|
32
|
-
*
|
|
33
|
-
* @private
|
|
34
|
-
*/
|
|
35
|
-
function setLocationTrackingEnabled(portalResponse, userResponse, templateDictionary, templates) {
|
|
36
|
-
// set locationTracking...contains service url and id
|
|
37
|
-
const locationTracking = (0, generalHelpers_1.getProp)(portalResponse, "helperServices.locationTracking");
|
|
38
|
-
/* istanbul ignore else */
|
|
39
|
-
if (locationTracking) {
|
|
40
|
-
templateDictionary.locationTracking = locationTracking;
|
|
41
|
-
}
|
|
42
|
-
// verify we have location tracking service and the user is an admin
|
|
43
|
-
templateDictionary.locationTrackingEnabled =
|
|
44
|
-
templateDictionary.locationTracking &&
|
|
45
|
-
(0, generalHelpers_1.getProp)(userResponse, "role") === "org_admin"
|
|
46
|
-
? true
|
|
47
|
-
: false;
|
|
48
|
-
if (templates) {
|
|
49
|
-
_validateTrackingTemplates(templates, templateDictionary);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.setLocationTrackingEnabled = setLocationTrackingEnabled;
|
|
53
|
-
/**
|
|
54
|
-
* Used by deploy to evaluate if we have everything we need to deploy tracking views.
|
|
55
|
-
*
|
|
56
|
-
* An error is thrown to prevent additional deployment work if we have Tracking items and tracking is
|
|
57
|
-
* not enabled or the deployment user is not an admin in the organization.
|
|
58
|
-
*
|
|
59
|
-
* @param templates the list of IItemTemplates from the solution
|
|
60
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
61
|
-
*
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
function _validateTrackingTemplates(templates, templateDictionary) {
|
|
65
|
-
/* istanbul ignore else */
|
|
66
|
-
if (!templateDictionary.locationTrackingEnabled &&
|
|
67
|
-
templates.some(template => {
|
|
68
|
-
const typeKeywords = (0, generalHelpers_1.getProp)(template, "item.typeKeywords") || [];
|
|
69
|
-
return typeKeywords.indexOf("Location Tracking View") > -1;
|
|
70
|
-
})) {
|
|
71
|
-
console.error("Location tracking not enabled or user is not admin.");
|
|
72
|
-
throw new Error("Location tracking not enabled or user is not admin.");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports._validateTrackingTemplates = _validateTrackingTemplates;
|
|
76
|
-
/**
|
|
77
|
-
* Used by deploy to determine the owner of the tracking service.
|
|
78
|
-
* Only one tracking service per org and all tracking views and tracking groups must be owned by the tracking service owner.
|
|
79
|
-
*
|
|
80
|
-
* This function will update the input templateDictionary with the owner as well as
|
|
81
|
-
* the item id for the source tracking service.
|
|
82
|
-
*
|
|
83
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
84
|
-
* @param authentication Credentials for the requests
|
|
85
|
-
*
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
function getTackingServiceOwner(templateDictionary, authentication) {
|
|
89
|
-
if (templateDictionary.locationTrackingEnabled) {
|
|
90
|
-
const locationTrackingId = templateDictionary.locationTracking.id;
|
|
91
|
-
return (0, restHelpersGet_1.getItemBase)(locationTrackingId, authentication).then(itemBase => {
|
|
92
|
-
templateDictionary.locationTracking.owner = itemBase.owner;
|
|
93
|
-
templateDictionary[itemBase.id] = {
|
|
94
|
-
itemId: itemBase.id
|
|
95
|
-
};
|
|
96
|
-
return Promise.resolve(itemBase && itemBase.owner === authentication.username);
|
|
97
|
-
}, () => Promise.resolve(false));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return Promise.resolve(false);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.getTackingServiceOwner = getTackingServiceOwner;
|
|
104
|
-
/**
|
|
105
|
-
* Check key properties to understand if we are dealing with a tracking template
|
|
106
|
-
*
|
|
107
|
-
* @param itemTemplate the template to evaluate
|
|
108
|
-
* @param itemUpdate the item update to evaluate
|
|
109
|
-
*
|
|
110
|
-
* @private
|
|
111
|
-
*/
|
|
112
|
-
function isTrackingViewTemplate(itemTemplate, itemUpdate) {
|
|
113
|
-
const typeKeywords = (0, generalHelpers_1.getProp)(itemTemplate, "item.typeKeywords") ||
|
|
114
|
-
(0, generalHelpers_1.getProp)(itemUpdate, "typeKeywords");
|
|
115
|
-
const trackViewGroup = (0, generalHelpers_1.getProp)(itemTemplate, "item.properties.trackViewGroup") ||
|
|
116
|
-
(0, generalHelpers_1.getProp)(itemUpdate, "properties.trackViewGroup");
|
|
117
|
-
return (typeKeywords && typeKeywords.indexOf("Location Tracking View") > -1 && trackViewGroup) ? true : false;
|
|
118
|
-
}
|
|
119
|
-
exports.isTrackingViewTemplate = isTrackingViewTemplate;
|
|
120
|
-
/**
|
|
121
|
-
* Check key properties to understand if we are dealing with a tracking group template
|
|
122
|
-
*
|
|
123
|
-
* @param itemTemplate the template to evaluate
|
|
124
|
-
*
|
|
125
|
-
* @private
|
|
126
|
-
*/
|
|
127
|
-
function isTrackingViewGroup(itemTemplate) {
|
|
128
|
-
const typeKeywords = (0, generalHelpers_1.getProp)(itemTemplate, "item.tags");
|
|
129
|
-
return (typeKeywords && typeKeywords.indexOf("Location Tracking Group") > -1) ? true : false;
|
|
130
|
-
}
|
|
131
|
-
exports.isTrackingViewGroup = isTrackingViewGroup;
|
|
132
|
-
/**
|
|
133
|
-
* Templatize the tracker view group id and view name for location tracking views.
|
|
134
|
-
* This function will update the itemTemplate that is passed in when it's a tracking view.
|
|
135
|
-
*
|
|
136
|
-
* @param itemTemplate Template for feature service item
|
|
137
|
-
*
|
|
138
|
-
* @private
|
|
139
|
-
*/
|
|
140
|
-
function templatizeTracker(itemTemplate) {
|
|
141
|
-
/* istanbul ignore else */
|
|
142
|
-
if (isTrackingViewTemplate(itemTemplate)) {
|
|
143
|
-
const trackViewGroup = (0, generalHelpers_1.getProp)(itemTemplate, "item.properties.trackViewGroup");
|
|
144
|
-
itemTemplate.groups.push(trackViewGroup);
|
|
145
|
-
itemTemplate.dependencies.push(trackViewGroup);
|
|
146
|
-
const groupIdVar = (0, templatization_1.templatizeTerm)(trackViewGroup, trackViewGroup, ".itemId");
|
|
147
|
-
(0, generalHelpers_1.setProp)(itemTemplate, "item.properties.trackViewGroup", groupIdVar);
|
|
148
|
-
_setName(itemTemplate, "item.name", trackViewGroup, groupIdVar);
|
|
149
|
-
_setName(itemTemplate, "properties.service.adminServiceInfo.name", trackViewGroup, groupIdVar);
|
|
150
|
-
const layersAndTables = (itemTemplate.properties.layers || []).concat(itemTemplate.properties.tables || []);
|
|
151
|
-
layersAndTables.forEach(l => {
|
|
152
|
-
templatizeServiceItemId(l, "adminLayerInfo.viewLayerDefinition.sourceServiceItemId");
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.templatizeTracker = templatizeTracker;
|
|
157
|
-
/**
|
|
158
|
-
* Templatize the tracker view group id and view name for location tracking views.
|
|
159
|
-
* This function will update the itemTemplate that is passed in when it's a tracking view.
|
|
160
|
-
*
|
|
161
|
-
* @param itemTemplate Template for the tracker view
|
|
162
|
-
* @param path the path to the property that stores the current name
|
|
163
|
-
* @param groupId the id of the associated tracker group
|
|
164
|
-
* @param groupIdVar the variable to replace the existing name with
|
|
165
|
-
*
|
|
166
|
-
* @private
|
|
167
|
-
*/
|
|
168
|
-
function _setName(itemTemplate, path, groupId, groupIdVar) {
|
|
169
|
-
const name = (0, generalHelpers_1.getProp)(itemTemplate, path);
|
|
170
|
-
/* istanbul ignore else */
|
|
171
|
-
if (name) {
|
|
172
|
-
(0, generalHelpers_1.setProp)(itemTemplate, path, name.replace(groupId, groupIdVar));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
exports._setName = _setName;
|
|
176
|
-
/**
|
|
177
|
-
* Templatize the tracker view serviceItemId
|
|
178
|
-
*
|
|
179
|
-
* This function will update the input obj with the templatized variable
|
|
180
|
-
*
|
|
181
|
-
* @param obj the object that stores the serviceItemId
|
|
182
|
-
* @param path the path to the property that stores the serviceItemId
|
|
183
|
-
*
|
|
184
|
-
* @private
|
|
185
|
-
*/
|
|
186
|
-
function templatizeServiceItemId(obj, path) {
|
|
187
|
-
const serviceItemId = (0, generalHelpers_1.getProp)(obj, path);
|
|
188
|
-
/* istanbul ignore else */
|
|
189
|
-
if (serviceItemId) {
|
|
190
|
-
(0, generalHelpers_1.setProp)(obj, path, (0, templatization_1.templatizeTerm)(serviceItemId, serviceItemId, ".itemId"));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
exports.templatizeServiceItemId = templatizeServiceItemId;
|
|
194
|
-
/**
|
|
195
|
-
* Used by deploy to update the request options with key details for deploying tracker views
|
|
196
|
-
*
|
|
197
|
-
* @param itemTemplate Template for feature service item
|
|
198
|
-
* @param options the current request options to update
|
|
199
|
-
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
200
|
-
*
|
|
201
|
-
* @private
|
|
202
|
-
*/
|
|
203
|
-
function setTrackingOptions(itemTemplate, options, templateDictionary) {
|
|
204
|
-
/* istanbul ignore else */
|
|
205
|
-
if (isTrackingViewTemplate(itemTemplate)) {
|
|
206
|
-
(0, generalHelpers_1.setCreateProp)(options, "owner", templateDictionary.locationTracking.owner);
|
|
207
|
-
(0, generalHelpers_1.setCreateProp)(options.item, "name", itemTemplate.item.name);
|
|
208
|
-
(0, generalHelpers_1.setCreateProp)(options.item, "isView", true);
|
|
209
|
-
(0, generalHelpers_1.setCreateProp)(options.item, "owner", templateDictionary.locationTracking.owner);
|
|
210
|
-
(0, generalHelpers_1.setCreateProp)(options.params, "isView", true);
|
|
211
|
-
(0, generalHelpers_1.setCreateProp)(options.params, "outputType", "locationTrackingService");
|
|
212
|
-
delete (options.folderId);
|
|
213
|
-
}
|
|
214
|
-
return options.item;
|
|
215
|
-
}
|
|
216
|
-
exports.setTrackingOptions = setTrackingOptions;
|
|
217
|
-
//# sourceMappingURL=trackingHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trackingHelpers.js","sourceRoot":"","sources":["../../src/trackingHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH,qDAAmE;AACnE,qDAA+C;AAC/C,qDAAkD;AAIlD;;;;;;;;;;;;GAYG;AACH,SAAgB,0BAA0B,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D,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAnBD,gDAmBC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2021 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { UserSession } from "./interfaces";
|
|
17
|
-
export declare const BASE_NAMES: string[];
|
|
18
|
-
export declare const PROP_NAMES: string[];
|
|
19
|
-
/**
|
|
20
|
-
* Get the base velocity url from the current orgs subscription info
|
|
21
|
-
*
|
|
22
|
-
* This function will update the input templateDictionary arg with the velocity url
|
|
23
|
-
* so we can reuse it without pinging the org again for subsequent requests to the
|
|
24
|
-
* velocity api.
|
|
25
|
-
*
|
|
26
|
-
* @param authentication Credentials for the requests
|
|
27
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
28
|
-
*
|
|
29
|
-
* @returns a promise that will resolve with the velocity url or an empty string when the org does not support velocity
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
export declare function getVelocityUrlBase(authentication: UserSession, templateDictionary: any): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Update any velocity urls found in the data
|
|
35
|
-
*
|
|
36
|
-
* This function can be extended to support any item type specific functions such as
|
|
37
|
-
* removing the itemId from operational layers in a webmap
|
|
38
|
-
*
|
|
39
|
-
* @param data The data object of the item
|
|
40
|
-
* @param type The item type
|
|
41
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
42
|
-
*
|
|
43
|
-
* @returns an updated instance of the data object that was supplied.
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
export declare function updateVelocityReferences(data: any, type: string, templateDictionary: any): any;
|
|
47
|
-
/**
|
|
48
|
-
* Helper function to update velocity urls found in the data
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* @param data The data object of the item
|
|
52
|
-
* @param velocityUrl The velocity url from the current organization
|
|
53
|
-
*
|
|
54
|
-
* @returns an updated instance of the data object that was supplied.
|
|
55
|
-
* @private
|
|
56
|
-
*/
|
|
57
|
-
export declare function _replaceVelocityUrls(data: any, velocityUrl: string): any;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2021 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports._replaceVelocityUrls = exports.updateVelocityReferences = exports.getVelocityUrlBase = exports.PROP_NAMES = exports.BASE_NAMES = void 0;
|
|
19
|
-
const get_subscription_info_1 = require("./get-subscription-info");
|
|
20
|
-
const generalHelpers_1 = require("./generalHelpers");
|
|
21
|
-
// Known base names if output, source, or feed name is missing
|
|
22
|
-
exports.BASE_NAMES = [
|
|
23
|
-
"feat-lyr-new",
|
|
24
|
-
"feat-lyr-existing",
|
|
25
|
-
"stream-lyr-new"
|
|
26
|
-
];
|
|
27
|
-
// Known prop paths that can contain item Ids
|
|
28
|
-
exports.PROP_NAMES = [
|
|
29
|
-
".portal.mapServicePortalItemID",
|
|
30
|
-
".portal.featureServicePortalItemID",
|
|
31
|
-
".portal.streamServicePortalItemID",
|
|
32
|
-
".portalItemId"
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Get the base velocity url from the current orgs subscription info
|
|
36
|
-
*
|
|
37
|
-
* This function will update the input templateDictionary arg with the velocity url
|
|
38
|
-
* so we can reuse it without pinging the org again for subsequent requests to the
|
|
39
|
-
* velocity api.
|
|
40
|
-
*
|
|
41
|
-
* @param authentication Credentials for the requests
|
|
42
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
43
|
-
*
|
|
44
|
-
* @returns a promise that will resolve with the velocity url or an empty string when the org does not support velocity
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
function getVelocityUrlBase(authentication, templateDictionary) {
|
|
48
|
-
// if we already have the base url no need to make any additional requests
|
|
49
|
-
if (templateDictionary.hasOwnProperty("velocityUrl")) {
|
|
50
|
-
return Promise.resolve(templateDictionary.velocityUrl);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// get the url from the orgs subscription info
|
|
54
|
-
return (0, get_subscription_info_1.getSubscriptionInfo)({ authentication }).then((subscriptionInfo) => {
|
|
55
|
-
let velocityUrl = "";
|
|
56
|
-
const orgCapabilities = (0, generalHelpers_1.getProp)(subscriptionInfo, "orgCapabilities");
|
|
57
|
-
/* istanbul ignore else */
|
|
58
|
-
if (Array.isArray(orgCapabilities)) {
|
|
59
|
-
orgCapabilities.some(c => {
|
|
60
|
-
/* istanbul ignore else */
|
|
61
|
-
if (c.id === "velocity" && c.status === "active" && c.velocityUrl) {
|
|
62
|
-
velocityUrl = c.velocityUrl;
|
|
63
|
-
}
|
|
64
|
-
return velocityUrl;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
// add the base url to the templateDictionary for reuse
|
|
68
|
-
templateDictionary.velocityUrl = velocityUrl;
|
|
69
|
-
return Promise.resolve(velocityUrl);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.getVelocityUrlBase = getVelocityUrlBase;
|
|
74
|
-
/**
|
|
75
|
-
* Update any velocity urls found in the data
|
|
76
|
-
*
|
|
77
|
-
* This function can be extended to support any item type specific functions such as
|
|
78
|
-
* removing the itemId from operational layers in a webmap
|
|
79
|
-
*
|
|
80
|
-
* @param data The data object of the item
|
|
81
|
-
* @param type The item type
|
|
82
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
83
|
-
*
|
|
84
|
-
* @returns an updated instance of the data object that was supplied.
|
|
85
|
-
*
|
|
86
|
-
*/
|
|
87
|
-
function updateVelocityReferences(data, type, templateDictionary) {
|
|
88
|
-
const velocityUrl = templateDictionary.velocityUrl;
|
|
89
|
-
if (data && type === "Web Map" && velocityUrl) {
|
|
90
|
-
const layersAndTables = (data.operationalLayers || []).concat(data.tables || []);
|
|
91
|
-
(layersAndTables).forEach((l) => {
|
|
92
|
-
if (l.url && l.url.indexOf(velocityUrl) > -1 && l.itemId) {
|
|
93
|
-
delete l.itemId;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return velocityUrl && data ? _replaceVelocityUrls(data, velocityUrl) : data;
|
|
98
|
-
}
|
|
99
|
-
exports.updateVelocityReferences = updateVelocityReferences;
|
|
100
|
-
/**
|
|
101
|
-
* Helper function to update velocity urls found in the data
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @param data The data object of the item
|
|
105
|
-
* @param velocityUrl The velocity url from the current organization
|
|
106
|
-
*
|
|
107
|
-
* @returns an updated instance of the data object that was supplied.
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
function _replaceVelocityUrls(data, velocityUrl) {
|
|
111
|
-
let dataString = JSON.stringify(data);
|
|
112
|
-
if (dataString.indexOf(velocityUrl) > -1) {
|
|
113
|
-
// replace any instance of the velocity base url
|
|
114
|
-
dataString = dataString.replace(new RegExp(`${velocityUrl}`, "gi"), "{{velocityUrl}}");
|
|
115
|
-
// add solutionItemId to any velocity service names
|
|
116
|
-
const regex = new RegExp("{{velocityUrl}}.+?(?=/[A-Za-z]+Server)", "gi");
|
|
117
|
-
const results = dataString.match(regex);
|
|
118
|
-
/* istanbul ignore else */
|
|
119
|
-
if (results) {
|
|
120
|
-
const uniqueResults = results.filter((v, i, self) => self.indexOf(v) === i);
|
|
121
|
-
uniqueResults.forEach(result => {
|
|
122
|
-
// these names can contain reserved characters for regex
|
|
123
|
-
// for example: http://something/name(something else)
|
|
124
|
-
// TypeScript for es2015 doesn't have a definition for `replaceAll`
|
|
125
|
-
dataString = dataString.replaceAll(result, `${result}_{{solutionItemId}}`);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
return JSON.parse(dataString);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
return data;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports._replaceVelocityUrls = _replaceVelocityUrls;
|
|
135
|
-
//# sourceMappingURL=velocityHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"velocityHelpers.js","sourceRoot":"","sources":["../../src/velocityHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,mEAGiC;AACjC,qDAA2C;AAE3C,8DAA8D;AACjD,QAAA,UAAU,GAAa;IAClC,cAAc;IACd,mBAAmB;IACnB,gBAAgB;CACjB,CAAC;AAEF,6CAA6C;AAChC,QAAA,UAAU,GAAc;IACnC,gCAAgC;IAChC,oCAAoC;IACpC,mCAAmC;IACnC,eAAe;CAChB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,SAAgB,kBAAkB,CAChC,cAA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,UAAU,GAAI,UAAkB,CAAC,UAAU,CACzC,MAAM,EACN,GAAG,MAAM,qBAAqB,CAC/B,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;KAC/B;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AA7BD,oDA6BC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2024 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 declare function compressWorkflowIntoZipFile(): Promise<File>;
|
|
17
|
-
export declare function extractWorkflowFromZipFile(zipFile: File): Promise<any>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2024 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.extractWorkflowFromZipFile = exports.compressWorkflowIntoZipFile = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
/**
|
|
21
|
-
* Provides common functions compressing and decompressing workflow configurations.
|
|
22
|
-
*
|
|
23
|
-
* @module workflowHelpers
|
|
24
|
-
*/
|
|
25
|
-
const zipUtils = tslib_1.__importStar(require("./zip-utils"));
|
|
26
|
-
// ------------------------------------------------------------------------------------------------------------------ //
|
|
27
|
-
function compressWorkflowIntoZipFile(
|
|
28
|
-
//workflow: any
|
|
29
|
-
) {
|
|
30
|
-
return Promise.resolve(new File([], ""));
|
|
31
|
-
}
|
|
32
|
-
exports.compressWorkflowIntoZipFile = compressWorkflowIntoZipFile;
|
|
33
|
-
async function extractWorkflowFromZipFile(zipFile) {
|
|
34
|
-
const files = zipUtils.getZipFileContents(await zipUtils.blobToZip(zipFile));
|
|
35
|
-
return Promise.resolve(files);
|
|
36
|
-
}
|
|
37
|
-
exports.extractWorkflowFromZipFile = extractWorkflowFromZipFile;
|
|
38
|
-
/*const body = {
|
|
39
|
-
"jobTemplateIds": [
|
|
40
|
-
"string"
|
|
41
|
-
],
|
|
42
|
-
"diagramIds": [
|
|
43
|
-
"string"
|
|
44
|
-
],
|
|
45
|
-
"includeOtherConfiguration": true,
|
|
46
|
-
"passphrase": "string"
|
|
47
|
-
};*/
|
|
48
|
-
/*
|
|
49
|
-
const diagramsUrl = `/${orgId}/${itemId}/diagrams`;
|
|
50
|
-
const individualDiagramUrl = `/${orgId}/${itemId}/diagrams/${diagramId}`;
|
|
51
|
-
|
|
52
|
-
const jobTemplatesUrl = `/${orgId}/${itemId}/jobTemplates`;
|
|
53
|
-
const individualJobTemplateUrl = `/${orgId}/${itemId}/jobTemplates/${jobTemplateId}`;
|
|
54
|
-
|
|
55
|
-
"diagrams": [
|
|
56
|
-
{
|
|
57
|
-
"diagramId": "string",
|
|
58
|
-
"diagramName": "string",
|
|
59
|
-
"description": "string",
|
|
60
|
-
"active": true,
|
|
61
|
-
"draft": true
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
"jobTemplates": [
|
|
65
|
-
{
|
|
66
|
-
"jobTemplateId": "string",
|
|
67
|
-
"jobTemplateName": "string",
|
|
68
|
-
"description": "string",
|
|
69
|
-
"category": "string",
|
|
70
|
-
"diagramId": "string",
|
|
71
|
-
"diagramName": "string",
|
|
72
|
-
"state": "Draft"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
}*/
|
|
76
|
-
//# sourceMappingURL=workflowHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflowHelpers.js","sourceRoot":"","sources":["../../src/workflowHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,8DAAwC;AAExC,wHAAwH;AAExH,SAAgB,2BAA2B;AACzC,eAAe;;IASf,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAXD,kEAWC;AAEM,KAAK,UAAU,0BAA0B,CAC5C,OAAa;IAEb,MAAM,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,MAAM,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAO7E,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAXD,gEAWC;AAGC;;;;;;;;;IASI;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BC"}
|