@esri/solution-common 6.6.1-next.62 → 6.6.1-next.64

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.
@@ -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
@@ -538,19 +559,6 @@ export declare function _countRelationships(layers: any[]): number;
538
559
  * @private
539
560
  */
540
561
  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
562
  /**
555
563
  * Add relationships to all layers in one call to retain fully functioning composite relationships
556
564
  *
@@ -15,8 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports._countRelationships = exports._addItemMetadataFile = 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._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._getFallbackExtent = exports._getCreateServiceOptions = void 0;
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._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
@@ -1676,7 +1707,6 @@ function _getCreateServiceOptions(newItemTemplate, authentication, templateDicti
1676
1707
  const isPortal = templateDictionary.isPortal;
1677
1708
  const itemId = newItemTemplate.itemId;
1678
1709
  (0, featureServiceHelpers_1.validateSpatialReferenceAndExtent)(serviceInfo, newItemTemplate, templateDictionary);
1679
- const fallbackExtent = _getFallbackExtent(serviceInfo, templateDictionary);
1680
1710
  const params = {};
1681
1711
  const itemInfo = {
1682
1712
  title: newItemTemplate.item.title,
@@ -1695,10 +1725,20 @@ function _getCreateServiceOptions(newItemTemplate, authentication, templateDicti
1695
1725
  createOptions.item = !(0, trackingHelpers_1.isTrackingViewTemplate)(newItemTemplate)
1696
1726
  ? _setItemProperties(createOptions.item, newItemTemplate, serviceInfo, params, isPortal)
1697
1727
  : (0, trackingHelpers_1.setTrackingOptions)(newItemTemplate, createOptions, templateDictionary);
1698
- // project the portals extent to match that of the service
1699
- convertExtentWithFallback(templateDictionary.organization.defaultExtent, fallbackExtent, serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
1700
- templateDictionary[itemId].solutionExtent = extent;
1701
- (0, featureServiceHelpers_1.setDefaultSpatialReference)(templateDictionary, itemId, extent.spatialReference);
1728
+ convertExtent(_validateExtent(templateDictionary.organization.defaultExtent), serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
1729
+ if (_extentIsValid(extent)) {
1730
+ templateDictionary[itemId].solutionExtent = extent;
1731
+ (0, featureServiceHelpers_1.setDefaultSpatialReference)(templateDictionary, itemId, extent.spatialReference);
1732
+ }
1733
+ else {
1734
+ // The org's default extent could not be projected into the service's spatial
1735
+ // reference, so remove the templatized extent properties from the service and
1736
+ // its layers and tables
1737
+ (0, generalHelpers_1.deleteProp)(createOptions.item, "initialExtent");
1738
+ (0, generalHelpers_1.deleteProp)(createOptions.item, "fullExtent");
1739
+ _removeLayerExtents(newItemTemplate);
1740
+ (0, featureServiceHelpers_1.setDefaultSpatialReference)(templateDictionary, itemId, serviceInfo.service.spatialReference);
1741
+ }
1702
1742
  createOptions.item = (0, templatization_1.replaceInTemplate)(createOptions.item, templateDictionary);
1703
1743
  createOptions.params = (0, templatization_1.replaceInTemplate)(createOptions.params, templateDictionary);
1704
1744
  if (newItemTemplate.item.thumbnail) {
@@ -1710,29 +1750,6 @@ function _getCreateServiceOptions(newItemTemplate, authentication, templateDicti
1710
1750
  });
1711
1751
  }
1712
1752
  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
1753
  /**
1737
1754
  * Add relationships to all layers in one call to retain fully functioning composite relationships
1738
1755
  *
@@ -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
@@ -538,19 +559,6 @@ export declare function _countRelationships(layers: any[]): number;
538
559
  * @private
539
560
  */
540
561
  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
562
  /**
555
563
  * Add relationships to all layers in one call to retain fully functioning composite relationships
556
564
  *
@@ -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
@@ -1622,7 +1651,6 @@ export function _getCreateServiceOptions(newItemTemplate, authentication, templa
1622
1651
  const isPortal = templateDictionary.isPortal;
1623
1652
  const itemId = newItemTemplate.itemId;
1624
1653
  validateSpatialReferenceAndExtent(serviceInfo, newItemTemplate, templateDictionary);
1625
- const fallbackExtent = _getFallbackExtent(serviceInfo, templateDictionary);
1626
1654
  const params = {};
1627
1655
  const itemInfo = {
1628
1656
  title: newItemTemplate.item.title,
@@ -1641,10 +1669,20 @@ export function _getCreateServiceOptions(newItemTemplate, authentication, templa
1641
1669
  createOptions.item = !isTrackingViewTemplate(newItemTemplate)
1642
1670
  ? _setItemProperties(createOptions.item, newItemTemplate, serviceInfo, params, isPortal)
1643
1671
  : setTrackingOptions(newItemTemplate, createOptions, templateDictionary);
1644
- // project the portals extent to match that of the service
1645
- convertExtentWithFallback(templateDictionary.organization.defaultExtent, fallbackExtent, serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
1646
- templateDictionary[itemId].solutionExtent = extent;
1647
- setDefaultSpatialReference(templateDictionary, itemId, extent.spatialReference);
1672
+ convertExtent(_validateExtent(templateDictionary.organization.defaultExtent), serviceInfo.service.spatialReference, templateDictionary.organization.helperServices.geometry.url, authentication).then((extent) => {
1673
+ if (_extentIsValid(extent)) {
1674
+ templateDictionary[itemId].solutionExtent = extent;
1675
+ setDefaultSpatialReference(templateDictionary, itemId, extent.spatialReference);
1676
+ }
1677
+ else {
1678
+ // The org's default extent could not be projected into the service's spatial
1679
+ // reference, so remove the templatized extent properties from the service and
1680
+ // its layers and tables
1681
+ deleteProp(createOptions.item, "initialExtent");
1682
+ deleteProp(createOptions.item, "fullExtent");
1683
+ _removeLayerExtents(newItemTemplate);
1684
+ setDefaultSpatialReference(templateDictionary, itemId, serviceInfo.service.spatialReference);
1685
+ }
1648
1686
  createOptions.item = replaceInTemplate(createOptions.item, templateDictionary);
1649
1687
  createOptions.params = replaceInTemplate(createOptions.params, templateDictionary);
1650
1688
  if (newItemTemplate.item.thumbnail) {
@@ -1655,28 +1693,6 @@ export function _getCreateServiceOptions(newItemTemplate, authentication, templa
1655
1693
  }, (e) => reject(fail(e)));
1656
1694
  });
1657
1695
  }
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
1696
  /**
1681
1697
  * Add relationships to all layers in one call to retain fully functioning composite relationships
1682
1698
  *
@@ -1,7 +1,10 @@
1
- Built 06/08/2026 20:42:30.68
1
+ Built 06/10/2026 20:42:40.90
2
2
  develop
3
- commit 5225c095db3744f89554123929df6ef66011f5a8
4
- Author: Ryan Cosby <ryan9313@esri.com>
5
- Date: Sun Jun 7 20:49:25 2026 -0700
3
+ commit d6a3ffbb5f139814a5703700efe2cb3e90cda142
4
+ Merge: 040dc8b18 8c2cd0b39
5
+ Author: John Hauck <jhauck@esri.com>
6
+ Date: Wed Jun 10 12:52:03 2026 -0600
6
7
 
7
- v6.6.1-next.61
8
+ Merge pull request #1588 from Esri/start-default-wkid
9
+
10
+ remove full and initial extent for create service when NaN
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-common",
3
- "version": "6.6.1-next.62",
3
+ "version": "6.6.1-next.64",
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": "5225c095db3744f89554123929df6ef66011f5a8"
99
+ "gitHead": "d6a3ffbb5f139814a5703700efe2cb3e90cda142"
100
100
  }