@esri/solution-common 6.6.1-next.63 → 6.6.1-next.65
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/featureServiceHelpers.js +0 -3
- package/dist/cjs/restHelpers.d.ts +30 -14
- package/dist/cjs/restHelpers.js +60 -31
- package/dist/esm/featureServiceHelpers.js +0 -3
- package/dist/esm/restHelpers.d.ts +30 -14
- package/dist/esm/restHelpers.js +55 -28
- package/dist/solution.js_commit.txt +8 -5
- package/package.json +2 -2
|
@@ -461,9 +461,6 @@ function setNamesAndTitles(templates) {
|
|
|
461
461
|
let baseName = t.item.name || t.item.title;
|
|
462
462
|
// If the name already contains a GUID remove it
|
|
463
463
|
baseName = baseName.replace(/_[0-9A-F]{32}/gi, "");
|
|
464
|
-
// Replace characters that are not allowed in a feature service name with "_"
|
|
465
|
-
// Disallowed: '#', '%', '&', '"', '\', '/', '+', '?', ':', '*', '<', '>', ' ', '\t'
|
|
466
|
-
baseName = baseName.replace(/[#%&"\\/+?:*<> \t]/g, "_");
|
|
467
464
|
// The name length limit is 98
|
|
468
465
|
// Limit the baseName to 50 characters before the _<guid>
|
|
469
466
|
// If the baseName includes '{{params' it is likely being used in a template replacement, so do not truncate.
|
|
@@ -90,6 +90,28 @@ export declare function convertToISearchOptions(search: string | ISearchOptions
|
|
|
90
90
|
* @private
|
|
91
91
|
*/
|
|
92
92
|
export declare function _validateExtent(extent: IExtent): IExtent;
|
|
93
|
+
/**
|
|
94
|
+
* The geometry service can resolve a projection request successfully but still
|
|
95
|
+
* return "NaN" coordinate values or no geometry at all. This check is used to
|
|
96
|
+
* decide whether a projected extent can be used for a service's initial and full
|
|
97
|
+
* extents.
|
|
98
|
+
*
|
|
99
|
+
* @param extent the extent to test
|
|
100
|
+
* @returns true if the extent has numeric xmin, ymin, xmax, and ymax values
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
export declare function _extentIsValid(extent: any): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Removes the templatized extent from a template's layers and tables.
|
|
106
|
+
*
|
|
107
|
+
* Used when the organization's default extent cannot be projected into the
|
|
108
|
+
* service's spatial reference so that the layers and tables are created without an
|
|
109
|
+
* extent rather than with an unresolved template variable.
|
|
110
|
+
*
|
|
111
|
+
* @param itemTemplate the template whose layer and table extents should be removed
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
export declare function _removeLayerExtents(itemTemplate: IItemTemplate): void;
|
|
93
115
|
/**
|
|
94
116
|
* If the request to convert the extent fails it has commonly been due to an invalid extent.
|
|
95
117
|
* This function will first attempt to use the provided extent. If it fails it will default to
|
|
@@ -107,7 +129,6 @@ export declare function _validateExtent(extent: IExtent): IExtent;
|
|
|
107
129
|
export declare function convertExtentWithFallback(extent: IExtent, fallbackExtent: any, outSR: ISpatialReference, geometryServiceUrl: string, authentication: UserSession): Promise<any>;
|
|
108
130
|
/**
|
|
109
131
|
* Converts an extent to a specified spatial reference.
|
|
110
|
-
*
|
|
111
132
|
* @param extent Extent object to check and (possibly) to project
|
|
112
133
|
* @param outSR Desired spatial reference
|
|
113
134
|
* @param geometryServiceUrl Path to geometry service providing `findTransformations` and `project` services
|
|
@@ -528,6 +549,14 @@ export declare function _addItemMetadataFile(itemId: string, metadataFile: File,
|
|
|
528
549
|
* @private
|
|
529
550
|
*/
|
|
530
551
|
export declare function _countRelationships(layers: any[]): number;
|
|
552
|
+
/**
|
|
553
|
+
* Remove spaces and replace other characters that are not allowed in a feature service name with "_".
|
|
554
|
+
* Spaces are removed entirely. Disallowed (replaced with "_"): '#', '%', '&', '"', '\', '/', '+', '?', ':', '*', '<', '>', '\t'
|
|
555
|
+
*
|
|
556
|
+
* @param name The candidate service name
|
|
557
|
+
* @returns The sanitized name, or the input unchanged if it is not a string
|
|
558
|
+
*/
|
|
559
|
+
export declare function sanitizeFeatureServiceName(name: string): string;
|
|
531
560
|
/**
|
|
532
561
|
* Gets the full definitions of the layers affiliated with a hosted service.
|
|
533
562
|
*
|
|
@@ -538,19 +567,6 @@ export declare function _countRelationships(layers: any[]): number;
|
|
|
538
567
|
* @private
|
|
539
568
|
*/
|
|
540
569
|
export declare function _getCreateServiceOptions(newItemTemplate: IItemTemplate, authentication: UserSession, templateDictionary: any): Promise<any>;
|
|
541
|
-
/**
|
|
542
|
-
* When the services spatial reference does not match that of it's default extent
|
|
543
|
-
* use the out SRs default extent if it exists in the templateDictionary
|
|
544
|
-
* this should be set when adding a custom out wkid to the params before calling deploy
|
|
545
|
-
* this will help avoid situations where the orgs default extent and default world extent
|
|
546
|
-
* will not project successfully to the out SR
|
|
547
|
-
*
|
|
548
|
-
* @param serviceInfo the object that contains the spatial reference to evaluate
|
|
549
|
-
* @param templateDictionary the template dictionary
|
|
550
|
-
* @returns the extent to use as the fallback
|
|
551
|
-
* @private
|
|
552
|
-
*/
|
|
553
|
-
export declare function _getFallbackExtent(serviceInfo: any, templateDictionary: any): any;
|
|
554
570
|
/**
|
|
555
571
|
* Add relationships to all layers in one call to retain fully functioning composite relationships
|
|
556
572
|
*
|
package/dist/cjs/restHelpers.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports._updateItemURL = exports._updateIndexesForRelationshipKeyFields = exports._setItemProperties = exports._reportVariablesInItem = exports._lowercaseDomain = exports._getUpdate = exports._getSubtypeUpdates = exports._getContingentValuesUpdates = exports._getRelationshipUpdates = exports.
|
|
18
|
+
exports._addItemDataFile = exports.updateItemURL = exports.updateItemTemplateFromDictionary = exports.updateItemExtended = exports.updateGroup = exports.updateItem = exports.shareItem = exports.removeUsers = exports.reassignGroup = exports.searchGroupContents = exports.searchGroupAllContents = exports.searchAllGroups = exports.searchGroups = exports.searchAllItems = exports.searchItems = exports.removeItemOrGroup = exports.removeItem = exports.removeGroup = exports.removeFolder = exports.hasInvalidGroupDesignations = exports._parseAdminServiceData = exports.setWorkflowConfigurationZip = exports.getWorkflowConfigurationZip = exports.getFeatureServiceProperties = exports.getServiceLayersAndTables = exports.getRequest = exports._sortRelationships = exports.moveItemsToFolder = exports.moveItemToFolder = exports.getLayerUpdates = exports.getLayers = exports.extractDependencies = exports.createUniqueGroup = exports.createUniqueFolder = exports.createItemWithData = exports.createFullItem = exports.createFeatureService = exports.convertExtent = exports.convertExtentWithFallback = exports._removeLayerExtents = exports._extentIsValid = exports._validateExtent = exports.convertToISearchOptions = exports.checkRequestStatus = exports.addToServiceDefinition = exports.addTokenToUrl = exports.addForwardItemRelationships = exports.addForwardItemRelationship = exports.getUserSession = exports.addItemData = void 0;
|
|
19
|
+
exports._updateItemURL = exports._updateIndexesForRelationshipKeyFields = exports._setItemProperties = exports._reportVariablesInItem = exports._lowercaseDomain = exports._getUpdate = exports._getSubtypeUpdates = exports._getContingentValuesUpdates = exports._getRelationshipUpdates = exports._getCreateServiceOptions = exports.sanitizeFeatureServiceName = exports._countRelationships = exports._addItemMetadataFile = void 0;
|
|
20
20
|
/**
|
|
21
21
|
* Provides common functions involving the arcgis-rest-js library.
|
|
22
22
|
*
|
|
@@ -261,6 +261,38 @@ function _validateExtent(extent) {
|
|
|
261
261
|
return extent;
|
|
262
262
|
}
|
|
263
263
|
exports._validateExtent = _validateExtent;
|
|
264
|
+
/**
|
|
265
|
+
* The geometry service can resolve a projection request successfully but still
|
|
266
|
+
* return "NaN" coordinate values or no geometry at all. This check is used to
|
|
267
|
+
* decide whether a projected extent can be used for a service's initial and full
|
|
268
|
+
* extents.
|
|
269
|
+
*
|
|
270
|
+
* @param extent the extent to test
|
|
271
|
+
* @returns true if the extent has numeric xmin, ymin, xmax, and ymax values
|
|
272
|
+
* @private
|
|
273
|
+
*/
|
|
274
|
+
function _extentIsValid(extent) {
|
|
275
|
+
return (!!extent &&
|
|
276
|
+
[extent.xmin, extent.ymin, extent.xmax, extent.ymax].every((coordinate) => typeof coordinate === "number" && !isNaN(coordinate)));
|
|
277
|
+
}
|
|
278
|
+
exports._extentIsValid = _extentIsValid;
|
|
279
|
+
/**
|
|
280
|
+
* Removes the templatized extent from a template's layers and tables.
|
|
281
|
+
*
|
|
282
|
+
* Used when the organization's default extent cannot be projected into the
|
|
283
|
+
* service's spatial reference so that the layers and tables are created without an
|
|
284
|
+
* extent rather than with an unresolved template variable.
|
|
285
|
+
*
|
|
286
|
+
* @param itemTemplate the template whose layer and table extents should be removed
|
|
287
|
+
* @private
|
|
288
|
+
*/
|
|
289
|
+
function _removeLayerExtents(itemTemplate) {
|
|
290
|
+
["properties.layers", "properties.tables"].forEach((path) => {
|
|
291
|
+
const items = (0, generalHelpers_1.getProp)(itemTemplate, path) || [];
|
|
292
|
+
items.forEach((item) => (0, generalHelpers_1.deleteProp)(item, "extent"));
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
exports._removeLayerExtents = _removeLayerExtents;
|
|
264
296
|
/**
|
|
265
297
|
* If the request to convert the extent fails it has commonly been due to an invalid extent.
|
|
266
298
|
* This function will first attempt to use the provided extent. If it fails it will default to
|
|
@@ -305,7 +337,6 @@ function convertExtentWithFallback(extent, fallbackExtent, outSR, geometryServic
|
|
|
305
337
|
exports.convertExtentWithFallback = convertExtentWithFallback;
|
|
306
338
|
/**
|
|
307
339
|
* Converts an extent to a specified spatial reference.
|
|
308
|
-
*
|
|
309
340
|
* @param extent Extent object to check and (possibly) to project
|
|
310
341
|
* @param outSR Desired spatial reference
|
|
311
342
|
* @param geometryServiceUrl Path to geometry service providing `findTransformations` and `project` services
|
|
@@ -1660,6 +1691,17 @@ function _countRelationships(layers) {
|
|
|
1660
1691
|
return layers.reduce(reducer, 0);
|
|
1661
1692
|
}
|
|
1662
1693
|
exports._countRelationships = _countRelationships;
|
|
1694
|
+
/**
|
|
1695
|
+
* Remove spaces and replace other characters that are not allowed in a feature service name with "_".
|
|
1696
|
+
* Spaces are removed entirely. Disallowed (replaced with "_"): '#', '%', '&', '"', '\', '/', '+', '?', ':', '*', '<', '>', '\t'
|
|
1697
|
+
*
|
|
1698
|
+
* @param name The candidate service name
|
|
1699
|
+
* @returns The sanitized name, or the input unchanged if it is not a string
|
|
1700
|
+
*/
|
|
1701
|
+
function sanitizeFeatureServiceName(name) {
|
|
1702
|
+
return typeof name === "string" ? name.replace(/ /g, "").replace(/[#%&"\\/+?:*<>\t]/g, "_") : name;
|
|
1703
|
+
}
|
|
1704
|
+
exports.sanitizeFeatureServiceName = sanitizeFeatureServiceName;
|
|
1663
1705
|
/**
|
|
1664
1706
|
* Gets the full definitions of the layers affiliated with a hosted service.
|
|
1665
1707
|
*
|
|
@@ -1676,7 +1718,6 @@ function _getCreateServiceOptions(newItemTemplate, authentication, templateDicti
|
|
|
1676
1718
|
const isPortal = templateDictionary.isPortal;
|
|
1677
1719
|
const itemId = newItemTemplate.itemId;
|
|
1678
1720
|
(0, featureServiceHelpers_1.validateSpatialReferenceAndExtent)(serviceInfo, newItemTemplate, templateDictionary);
|
|
1679
|
-
const fallbackExtent = _getFallbackExtent(serviceInfo, templateDictionary);
|
|
1680
1721
|
const params = {};
|
|
1681
1722
|
const itemInfo = {
|
|
1682
1723
|
title: newItemTemplate.item.title,
|
|
@@ -1695,12 +1736,23 @@ function _getCreateServiceOptions(newItemTemplate, authentication, templateDicti
|
|
|
1695
1736
|
createOptions.item = !(0, trackingHelpers_1.isTrackingViewTemplate)(newItemTemplate)
|
|
1696
1737
|
? _setItemProperties(createOptions.item, newItemTemplate, serviceInfo, params, isPortal)
|
|
1697
1738
|
: (0, trackingHelpers_1.setTrackingOptions)(newItemTemplate, createOptions, templateDictionary);
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1739
|
+
convertExtent(_validateExtent(templateDictionary.organization.defaultExtent), serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
|
|
1740
|
+
if (_extentIsValid(extent)) {
|
|
1741
|
+
templateDictionary[itemId].solutionExtent = extent;
|
|
1742
|
+
(0, featureServiceHelpers_1.setDefaultSpatialReference)(templateDictionary, itemId, extent.spatialReference);
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
// The org's default extent could not be projected into the service's spatial
|
|
1746
|
+
// reference, so remove the templatized extent properties from the service and
|
|
1747
|
+
// its layers and tables
|
|
1748
|
+
(0, generalHelpers_1.deleteProp)(createOptions.item, "initialExtent");
|
|
1749
|
+
(0, generalHelpers_1.deleteProp)(createOptions.item, "fullExtent");
|
|
1750
|
+
_removeLayerExtents(newItemTemplate);
|
|
1751
|
+
(0, featureServiceHelpers_1.setDefaultSpatialReference)(templateDictionary, itemId, serviceInfo.service.spatialReference);
|
|
1752
|
+
}
|
|
1702
1753
|
createOptions.item = (0, templatization_1.replaceInTemplate)(createOptions.item, templateDictionary);
|
|
1703
1754
|
createOptions.params = (0, templatization_1.replaceInTemplate)(createOptions.params, templateDictionary);
|
|
1755
|
+
createOptions.item.name = sanitizeFeatureServiceName(createOptions.item.name);
|
|
1704
1756
|
if (newItemTemplate.item.thumbnail) {
|
|
1705
1757
|
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
1706
1758
|
createOptions.params.thumbnail = newItemTemplate.item.thumbnail;
|
|
@@ -1710,29 +1762,6 @@ function _getCreateServiceOptions(newItemTemplate, authentication, templateDicti
|
|
|
1710
1762
|
});
|
|
1711
1763
|
}
|
|
1712
1764
|
exports._getCreateServiceOptions = _getCreateServiceOptions;
|
|
1713
|
-
/**
|
|
1714
|
-
* When the services spatial reference does not match that of it's default extent
|
|
1715
|
-
* use the out SRs default extent if it exists in the templateDictionary
|
|
1716
|
-
* this should be set when adding a custom out wkid to the params before calling deploy
|
|
1717
|
-
* this will help avoid situations where the orgs default extent and default world extent
|
|
1718
|
-
* will not project successfully to the out SR
|
|
1719
|
-
*
|
|
1720
|
-
* @param serviceInfo the object that contains the spatial reference to evaluate
|
|
1721
|
-
* @param templateDictionary the template dictionary
|
|
1722
|
-
* @returns the extent to use as the fallback
|
|
1723
|
-
* @private
|
|
1724
|
-
*/
|
|
1725
|
-
function _getFallbackExtent(serviceInfo, templateDictionary) {
|
|
1726
|
-
const serviceSR = serviceInfo.service.spatialReference;
|
|
1727
|
-
const serviceInfoWkid = (0, generalHelpers_1.getProp)(serviceInfo, "defaultExtent.spatialReference.wkid");
|
|
1728
|
-
const customDefaultExtent = (0, generalHelpers_1.getProp)(templateDictionary, "params.defaultExtent");
|
|
1729
|
-
return serviceInfoWkid && serviceInfoWkid === serviceSR.wkid
|
|
1730
|
-
? serviceInfo.defaultExtent
|
|
1731
|
-
: customDefaultExtent
|
|
1732
|
-
? customDefaultExtent
|
|
1733
|
-
: serviceInfo.defaultExtent;
|
|
1734
|
-
}
|
|
1735
|
-
exports._getFallbackExtent = _getFallbackExtent;
|
|
1736
1765
|
/**
|
|
1737
1766
|
* Add relationships to all layers in one call to retain fully functioning composite relationships
|
|
1738
1767
|
*
|
|
@@ -443,9 +443,6 @@ export function setNamesAndTitles(templates) {
|
|
|
443
443
|
let baseName = t.item.name || t.item.title;
|
|
444
444
|
// If the name already contains a GUID remove it
|
|
445
445
|
baseName = baseName.replace(/_[0-9A-F]{32}/gi, "");
|
|
446
|
-
// Replace characters that are not allowed in a feature service name with "_"
|
|
447
|
-
// Disallowed: '#', '%', '&', '"', '\', '/', '+', '?', ':', '*', '<', '>', ' ', '\t'
|
|
448
|
-
baseName = baseName.replace(/[#%&"\\/+?:*<> \t]/g, "_");
|
|
449
446
|
// The name length limit is 98
|
|
450
447
|
// Limit the baseName to 50 characters before the _<guid>
|
|
451
448
|
// If the baseName includes '{{params' it is likely being used in a template replacement, so do not truncate.
|
|
@@ -90,6 +90,28 @@ export declare function convertToISearchOptions(search: string | ISearchOptions
|
|
|
90
90
|
* @private
|
|
91
91
|
*/
|
|
92
92
|
export declare function _validateExtent(extent: IExtent): IExtent;
|
|
93
|
+
/**
|
|
94
|
+
* The geometry service can resolve a projection request successfully but still
|
|
95
|
+
* return "NaN" coordinate values or no geometry at all. This check is used to
|
|
96
|
+
* decide whether a projected extent can be used for a service's initial and full
|
|
97
|
+
* extents.
|
|
98
|
+
*
|
|
99
|
+
* @param extent the extent to test
|
|
100
|
+
* @returns true if the extent has numeric xmin, ymin, xmax, and ymax values
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
export declare function _extentIsValid(extent: any): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Removes the templatized extent from a template's layers and tables.
|
|
106
|
+
*
|
|
107
|
+
* Used when the organization's default extent cannot be projected into the
|
|
108
|
+
* service's spatial reference so that the layers and tables are created without an
|
|
109
|
+
* extent rather than with an unresolved template variable.
|
|
110
|
+
*
|
|
111
|
+
* @param itemTemplate the template whose layer and table extents should be removed
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
export declare function _removeLayerExtents(itemTemplate: IItemTemplate): void;
|
|
93
115
|
/**
|
|
94
116
|
* If the request to convert the extent fails it has commonly been due to an invalid extent.
|
|
95
117
|
* This function will first attempt to use the provided extent. If it fails it will default to
|
|
@@ -107,7 +129,6 @@ export declare function _validateExtent(extent: IExtent): IExtent;
|
|
|
107
129
|
export declare function convertExtentWithFallback(extent: IExtent, fallbackExtent: any, outSR: ISpatialReference, geometryServiceUrl: string, authentication: UserSession): Promise<any>;
|
|
108
130
|
/**
|
|
109
131
|
* Converts an extent to a specified spatial reference.
|
|
110
|
-
*
|
|
111
132
|
* @param extent Extent object to check and (possibly) to project
|
|
112
133
|
* @param outSR Desired spatial reference
|
|
113
134
|
* @param geometryServiceUrl Path to geometry service providing `findTransformations` and `project` services
|
|
@@ -528,6 +549,14 @@ export declare function _addItemMetadataFile(itemId: string, metadataFile: File,
|
|
|
528
549
|
* @private
|
|
529
550
|
*/
|
|
530
551
|
export declare function _countRelationships(layers: any[]): number;
|
|
552
|
+
/**
|
|
553
|
+
* Remove spaces and replace other characters that are not allowed in a feature service name with "_".
|
|
554
|
+
* Spaces are removed entirely. Disallowed (replaced with "_"): '#', '%', '&', '"', '\', '/', '+', '?', ':', '*', '<', '>', '\t'
|
|
555
|
+
*
|
|
556
|
+
* @param name The candidate service name
|
|
557
|
+
* @returns The sanitized name, or the input unchanged if it is not a string
|
|
558
|
+
*/
|
|
559
|
+
export declare function sanitizeFeatureServiceName(name: string): string;
|
|
531
560
|
/**
|
|
532
561
|
* Gets the full definitions of the layers affiliated with a hosted service.
|
|
533
562
|
*
|
|
@@ -538,19 +567,6 @@ export declare function _countRelationships(layers: any[]): number;
|
|
|
538
567
|
* @private
|
|
539
568
|
*/
|
|
540
569
|
export declare function _getCreateServiceOptions(newItemTemplate: IItemTemplate, authentication: UserSession, templateDictionary: any): Promise<any>;
|
|
541
|
-
/**
|
|
542
|
-
* When the services spatial reference does not match that of it's default extent
|
|
543
|
-
* use the out SRs default extent if it exists in the templateDictionary
|
|
544
|
-
* this should be set when adding a custom out wkid to the params before calling deploy
|
|
545
|
-
* this will help avoid situations where the orgs default extent and default world extent
|
|
546
|
-
* will not project successfully to the out SR
|
|
547
|
-
*
|
|
548
|
-
* @param serviceInfo the object that contains the spatial reference to evaluate
|
|
549
|
-
* @param templateDictionary the template dictionary
|
|
550
|
-
* @returns the extent to use as the fallback
|
|
551
|
-
* @private
|
|
552
|
-
*/
|
|
553
|
-
export declare function _getFallbackExtent(serviceInfo: any, templateDictionary: any): any;
|
|
554
570
|
/**
|
|
555
571
|
* Add relationships to all layers in one call to retain fully functioning composite relationships
|
|
556
572
|
*
|
package/dist/esm/restHelpers.js
CHANGED
|
@@ -248,6 +248,36 @@ export function _validateExtent(extent) {
|
|
|
248
248
|
}
|
|
249
249
|
return extent;
|
|
250
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* The geometry service can resolve a projection request successfully but still
|
|
253
|
+
* return "NaN" coordinate values or no geometry at all. This check is used to
|
|
254
|
+
* decide whether a projected extent can be used for a service's initial and full
|
|
255
|
+
* extents.
|
|
256
|
+
*
|
|
257
|
+
* @param extent the extent to test
|
|
258
|
+
* @returns true if the extent has numeric xmin, ymin, xmax, and ymax values
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
export function _extentIsValid(extent) {
|
|
262
|
+
return (!!extent &&
|
|
263
|
+
[extent.xmin, extent.ymin, extent.xmax, extent.ymax].every((coordinate) => typeof coordinate === "number" && !isNaN(coordinate)));
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Removes the templatized extent from a template's layers and tables.
|
|
267
|
+
*
|
|
268
|
+
* Used when the organization's default extent cannot be projected into the
|
|
269
|
+
* service's spatial reference so that the layers and tables are created without an
|
|
270
|
+
* extent rather than with an unresolved template variable.
|
|
271
|
+
*
|
|
272
|
+
* @param itemTemplate the template whose layer and table extents should be removed
|
|
273
|
+
* @private
|
|
274
|
+
*/
|
|
275
|
+
export function _removeLayerExtents(itemTemplate) {
|
|
276
|
+
["properties.layers", "properties.tables"].forEach((path) => {
|
|
277
|
+
const items = getProp(itemTemplate, path) || [];
|
|
278
|
+
items.forEach((item) => deleteProp(item, "extent"));
|
|
279
|
+
});
|
|
280
|
+
}
|
|
251
281
|
/**
|
|
252
282
|
* If the request to convert the extent fails it has commonly been due to an invalid extent.
|
|
253
283
|
* This function will first attempt to use the provided extent. If it fails it will default to
|
|
@@ -291,7 +321,6 @@ export function convertExtentWithFallback(extent, fallbackExtent, outSR, geometr
|
|
|
291
321
|
}
|
|
292
322
|
/**
|
|
293
323
|
* Converts an extent to a specified spatial reference.
|
|
294
|
-
*
|
|
295
324
|
* @param extent Extent object to check and (possibly) to project
|
|
296
325
|
* @param outSR Desired spatial reference
|
|
297
326
|
* @param geometryServiceUrl Path to geometry service providing `findTransformations` and `project` services
|
|
@@ -1606,6 +1635,16 @@ export function _countRelationships(layers) {
|
|
|
1606
1635
|
const reducer = (accumulator, currentLayer) => accumulator + (currentLayer.relationships ? currentLayer.relationships.length : 0);
|
|
1607
1636
|
return layers.reduce(reducer, 0);
|
|
1608
1637
|
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Remove spaces and replace other characters that are not allowed in a feature service name with "_".
|
|
1640
|
+
* Spaces are removed entirely. Disallowed (replaced with "_"): '#', '%', '&', '"', '\', '/', '+', '?', ':', '*', '<', '>', '\t'
|
|
1641
|
+
*
|
|
1642
|
+
* @param name The candidate service name
|
|
1643
|
+
* @returns The sanitized name, or the input unchanged if it is not a string
|
|
1644
|
+
*/
|
|
1645
|
+
export function sanitizeFeatureServiceName(name) {
|
|
1646
|
+
return typeof name === "string" ? name.replace(/ /g, "").replace(/[#%&"\\/+?:*<>\t]/g, "_") : name;
|
|
1647
|
+
}
|
|
1609
1648
|
/**
|
|
1610
1649
|
* Gets the full definitions of the layers affiliated with a hosted service.
|
|
1611
1650
|
*
|
|
@@ -1622,7 +1661,6 @@ export function _getCreateServiceOptions(newItemTemplate, authentication, templa
|
|
|
1622
1661
|
const isPortal = templateDictionary.isPortal;
|
|
1623
1662
|
const itemId = newItemTemplate.itemId;
|
|
1624
1663
|
validateSpatialReferenceAndExtent(serviceInfo, newItemTemplate, templateDictionary);
|
|
1625
|
-
const fallbackExtent = _getFallbackExtent(serviceInfo, templateDictionary);
|
|
1626
1664
|
const params = {};
|
|
1627
1665
|
const itemInfo = {
|
|
1628
1666
|
title: newItemTemplate.item.title,
|
|
@@ -1641,12 +1679,23 @@ export function _getCreateServiceOptions(newItemTemplate, authentication, templa
|
|
|
1641
1679
|
createOptions.item = !isTrackingViewTemplate(newItemTemplate)
|
|
1642
1680
|
? _setItemProperties(createOptions.item, newItemTemplate, serviceInfo, params, isPortal)
|
|
1643
1681
|
: setTrackingOptions(newItemTemplate, createOptions, templateDictionary);
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1682
|
+
convertExtent(_validateExtent(templateDictionary.organization.defaultExtent), serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
|
|
1683
|
+
if (_extentIsValid(extent)) {
|
|
1684
|
+
templateDictionary[itemId].solutionExtent = extent;
|
|
1685
|
+
setDefaultSpatialReference(templateDictionary, itemId, extent.spatialReference);
|
|
1686
|
+
}
|
|
1687
|
+
else {
|
|
1688
|
+
// The org's default extent could not be projected into the service's spatial
|
|
1689
|
+
// reference, so remove the templatized extent properties from the service and
|
|
1690
|
+
// its layers and tables
|
|
1691
|
+
deleteProp(createOptions.item, "initialExtent");
|
|
1692
|
+
deleteProp(createOptions.item, "fullExtent");
|
|
1693
|
+
_removeLayerExtents(newItemTemplate);
|
|
1694
|
+
setDefaultSpatialReference(templateDictionary, itemId, serviceInfo.service.spatialReference);
|
|
1695
|
+
}
|
|
1648
1696
|
createOptions.item = replaceInTemplate(createOptions.item, templateDictionary);
|
|
1649
1697
|
createOptions.params = replaceInTemplate(createOptions.params, templateDictionary);
|
|
1698
|
+
createOptions.item.name = sanitizeFeatureServiceName(createOptions.item.name);
|
|
1650
1699
|
if (newItemTemplate.item.thumbnail) {
|
|
1651
1700
|
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
1652
1701
|
createOptions.params.thumbnail = newItemTemplate.item.thumbnail;
|
|
@@ -1655,28 +1704,6 @@ export function _getCreateServiceOptions(newItemTemplate, authentication, templa
|
|
|
1655
1704
|
}, (e) => reject(fail(e)));
|
|
1656
1705
|
});
|
|
1657
1706
|
}
|
|
1658
|
-
/**
|
|
1659
|
-
* When the services spatial reference does not match that of it's default extent
|
|
1660
|
-
* use the out SRs default extent if it exists in the templateDictionary
|
|
1661
|
-
* this should be set when adding a custom out wkid to the params before calling deploy
|
|
1662
|
-
* this will help avoid situations where the orgs default extent and default world extent
|
|
1663
|
-
* will not project successfully to the out SR
|
|
1664
|
-
*
|
|
1665
|
-
* @param serviceInfo the object that contains the spatial reference to evaluate
|
|
1666
|
-
* @param templateDictionary the template dictionary
|
|
1667
|
-
* @returns the extent to use as the fallback
|
|
1668
|
-
* @private
|
|
1669
|
-
*/
|
|
1670
|
-
export function _getFallbackExtent(serviceInfo, templateDictionary) {
|
|
1671
|
-
const serviceSR = serviceInfo.service.spatialReference;
|
|
1672
|
-
const serviceInfoWkid = getProp(serviceInfo, "defaultExtent.spatialReference.wkid");
|
|
1673
|
-
const customDefaultExtent = getProp(templateDictionary, "params.defaultExtent");
|
|
1674
|
-
return serviceInfoWkid && serviceInfoWkid === serviceSR.wkid
|
|
1675
|
-
? serviceInfo.defaultExtent
|
|
1676
|
-
: customDefaultExtent
|
|
1677
|
-
? customDefaultExtent
|
|
1678
|
-
: serviceInfo.defaultExtent;
|
|
1679
|
-
}
|
|
1680
1707
|
/**
|
|
1681
1708
|
* Add relationships to all layers in one call to retain fully functioning composite relationships
|
|
1682
1709
|
*
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
Built 06/
|
|
1
|
+
Built 06/11/2026 20:42:42.68
|
|
2
2
|
develop
|
|
3
|
-
commit
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
commit c863f76817a8ca40b8aa7c94e5ce094365a58f0a
|
|
4
|
+
Merge: 4ff447205 48c692aa4
|
|
5
|
+
Author: John Hauck <jhauck@esri.com>
|
|
6
|
+
Date: Thu Jun 11 18:36:20 2026 -0600
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Merge pull request #1589 from Esri/add-seperate-build-solution-param
|
|
9
|
+
|
|
10
|
+
add buildSolution param to deploy solution
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-common",
|
|
3
|
-
"version": "6.6.1-next.
|
|
3
|
+
"version": "6.6.1-next.65",
|
|
4
4
|
"description": "Provides general helper functions for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"esri",
|
|
97
97
|
"ES6"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "c863f76817a8ca40b8aa7c94e5ce094365a58f0a"
|
|
100
100
|
}
|