@vertigis/arcgis-extensions 54.2.0 → 54.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/Entity.d.ts +1 -1
  2. package/Hyperlink.d.ts +6 -6
  3. package/Hyperlink.js +1 -1
  4. package/LanguageResources.d.ts +1 -1
  5. package/LanguageResources.js +1 -1
  6. package/PortalUri.d.ts +2 -2
  7. package/data/Attachment.d.ts +9 -9
  8. package/data/Feature.js +1 -1
  9. package/data/RelationshipBase.d.ts +3 -3
  10. package/data/Schema.js +1 -1
  11. package/data/_Relationship.d.ts +4 -4
  12. package/data/_Relationship.js +1 -1
  13. package/data/support/_lpkxConverter.js +1 -1
  14. package/data/support/lpkxInterfaces.d.ts +8 -0
  15. package/declarations/arcgis-js-api-extensions/index.d.ts +7 -7
  16. package/docs/html/assets/search.js +1 -1
  17. package/docs/html/classes/PortalUri.PortalUri.html +4 -4
  18. package/docs/html/classes/data_RelationshipBase.RelationshipBase.html +2 -2
  19. package/docs/html/classes/support_Cancellable.Cancellation.html +2 -2
  20. package/docs/html/classes/tasks_identify_ArcGISSublayerIdentifyProvider.ArcGISSublayerIdentifyProvider.html +2 -2
  21. package/docs/html/classes/tasks_identify_ArcGISSublayerQueryIdentifyProvider.ArcGISSublayerQueryIdentifyProvider.html +2 -2
  22. package/docs/html/classes/tasks_identify_BuildingComponentSublayerClientSideIdentifyProvider.BuildingComponentSublayerClientSideIdentifyProvider.html +2 -2
  23. package/docs/html/classes/tasks_identify_BuildingComponentSublayerHitTestIdentifyProvider.BuildingComponentSublayerHitTestIdentifyProvider.html +2 -2
  24. package/docs/html/classes/tasks_identify_CSVLayer3DHitTestIdentifyProvider.CSVLayer3DHitTestIdentifyProvider.html +2 -2
  25. package/docs/html/classes/tasks_identify_CSVLayerClientSideQueryIdentifyProvider.CSVLayerClientSideQueryIdentifyProvider.html +2 -2
  26. package/docs/html/classes/tasks_identify_ClientSideIdentifyProvider.ClientSideIdentifyProvider.html +2 -2
  27. package/docs/html/classes/tasks_identify_FeatureLayer3DHitTestIdentifyProvider.FeatureLayer3DHitTestIdentifyProvider.html +2 -2
  28. package/docs/html/classes/tasks_identify_FeatureLayerClientSideIdentifyProvider.FeatureLayerClientSideIdentifyProvider.html +2 -2
  29. package/docs/html/classes/tasks_identify_FeatureLayerQueryIdentifyProvider.FeatureLayerQueryIdentifyProvider.html +2 -2
  30. package/docs/html/classes/tasks_identify_GeoJSONLayer3DHitTestIdentifyProvider.GeoJSONLayer3DHitTestIdentifyProvider.html +2 -2
  31. package/docs/html/classes/tasks_identify_GeoJSONLayerClientSideQueryIdentifyProvider.GeoJSONLayerClientSideQueryIdentifyProvider.html +2 -2
  32. package/docs/html/classes/tasks_identify_GeoRSSLayerIdentifyProvider.GeoRSSLayerIdentifyProvider.html +2 -2
  33. package/docs/html/classes/tasks_identify_GraphicsLayerQueryIdentifyProvider.GraphicsLayerQueryIdentifyProvider.html +2 -2
  34. package/docs/html/classes/tasks_identify_HitTestIdentifyProvider.HitTestIdentifyProvider.html +2 -2
  35. package/docs/html/classes/tasks_identify_IdentifyProviderBase.IdentifyProviderBase.html +2 -2
  36. package/docs/html/classes/tasks_identify_ImageryLayerIdentifyProvider.ImageryLayerIdentifyProvider.html +2 -2
  37. package/docs/html/classes/tasks_identify_KMLLayerQueryIdentifyProvider.KMLLayerQueryIdentifyProvider.html +2 -2
  38. package/docs/html/classes/tasks_identify_MapNotesSublayerQueryIdentifyProvider.MapNotesSublayerQueryIdentifyProvider.html +2 -2
  39. package/docs/html/classes/tasks_identify_PointCloudLayerHitTestIdentifyProvider.PointCloudLayerHitTestIdentifyProvider.html +2 -2
  40. package/docs/html/classes/tasks_identify_RouteLayerQueryIdentifyProvider.RouteLayerQueryIdentifyProvider.html +2 -2
  41. package/docs/html/classes/tasks_identify_SceneLayerClientSideIdentifyProvider.SceneLayerClientSideIdentifyProvider.html +2 -2
  42. package/docs/html/classes/tasks_identify_SceneLayerHitTestIdentifyProvider.SceneLayerHitTestIdentifyProvider.html +2 -2
  43. package/docs/html/classes/tasks_identify_SceneLayerQueryIdentifyProvider.SceneLayerQueryIdentifyProvider.html +2 -2
  44. package/docs/html/classes/tasks_identify_StreamLayerClientSideQueryIdentifyProvider.StreamLayerClientSideQueryIdentifyProvider.html +2 -2
  45. package/docs/html/classes/tasks_identify_SubtypeSublayerClientSideIdentifyProvider.SubtypeSublayerClientSideIdentifyProvider.html +2 -2
  46. package/docs/html/classes/tasks_identify_WFSLayerClientSideIdentifyProvider.WFSLayerClientSideIdentifyProvider.html +2 -2
  47. package/docs/html/classes/tasks_identify_WFSLayerQueryIdentifyProvider.WFSLayerQueryIdentifyProvider.html +2 -2
  48. package/docs/html/classes/tasks_identify_WMSLayerFeatureInfoIdentifyProvider.WMSLayerFeatureInfoIdentifyProvider.html +2 -2
  49. package/docs/html/classes/tasks_identify_WMSSublayerIdentifyProvider.WMSSublayerIdentifyProvider.html +2 -2
  50. package/docs/html/classes/tasks_query_ArcGISRelationship.ArcGISRelationship.html +2 -2
  51. package/docs/html/classes/tasks_query_QueryBasedRelationship.QueryBasedRelationship.html +2 -2
  52. package/docs/html/classes/tasks_search_ArcGISGeocoderSearchProvider.ArcGISGeocoderSearchProvider.html +3 -3
  53. package/docs/html/classes/tasks_search_GeocoderSearchProvider.GeocoderSearchProvider.html +3 -3
  54. package/docs/html/classes/utilities_CaseInsensitiveObservableMap.CaseInsensitiveObservableMap.html +2 -2
  55. package/docs/html/functions/data__Relationship.fromEsriApiCardinality.html +1 -1
  56. package/docs/html/functions/data__Relationship.toEsriApiCardinality.html +1 -1
  57. package/docs/html/functions/support_InitializableBase.initializeCollection.html +1 -1
  58. package/docs/html/functions/support_Serializable.filterJSONProperties.html +1 -1
  59. package/docs/html/interfaces/data_Attachment.AttachmentInfo.html +8 -8
  60. package/docs/html/interfaces/data__Relationship.Relationship-1.html +5 -5
  61. package/docs/html/interfaces/data_support_lpkxInterfaces.LyrxLayerDefinition.html +7 -4
  62. package/docs/html/interfaces/support_InitializableBase.InitializeWarningEvent.html +3 -3
  63. package/docs/html/types/support_Serializable.SerializableClass.html +1 -1
  64. package/docs/html/variables/version.version.html +1 -1
  65. package/layer-preset/LayerPreset.d.ts +7 -7
  66. package/layer-preset/LayerPreset.js +1 -1
  67. package/locale/language.d.ts +4 -4
  68. package/locale/language.js +1 -1
  69. package/mapping/Bookmark.d.ts +3 -3
  70. package/mapping/support/featureService.js +1 -1
  71. package/menus/Menu.d.ts +1 -1
  72. package/menus/Menu.js +1 -1
  73. package/menus/MenuItem.d.ts +12 -12
  74. package/menus/MenuItem.js +1 -1
  75. package/package.json +1 -1
  76. package/support/Cancellable.d.ts +2 -2
  77. package/support/InitializableBase.d.ts +1 -1
  78. package/support/InitializableBase.js +1 -1
  79. package/support/Serializable.d.ts +3 -2
  80. package/support/Serializable.js +1 -1
  81. package/support/_ArcGISRelationshipCollection.js +1 -1
  82. package/support/_featureEdit.js +1 -1
  83. package/support/_graphicsQuery.js +1 -1
  84. package/support/_query.js +1 -1
  85. package/tasks/identify/ArcGISSublayerQueryIdentifyProvider.js +1 -1
  86. package/tasks/identify/CSVLayerClientSideQueryIdentifyProvider.js +1 -1
  87. package/tasks/identify/ClientSideIdentifyProvider.d.ts +1 -1
  88. package/tasks/identify/ClientSideIdentifyProvider.js +1 -1
  89. package/tasks/identify/FeatureLayerClientSideIdentifyProvider.js +1 -1
  90. package/tasks/identify/FeatureLayerQueryIdentifyProvider.js +1 -1
  91. package/tasks/identify/GeoJSONLayerClientSideQueryIdentifyProvider.js +1 -1
  92. package/tasks/identify/HitTestIdentifyProvider.d.ts +1 -1
  93. package/tasks/identify/HitTestIdentifyProvider.js +1 -1
  94. package/tasks/identify/IdentifyProviderBase.d.ts +1 -1
  95. package/tasks/identify/IdentifyService.js +1 -1
  96. package/tasks/identify/ImageryLayerIdentifyProvider.js +1 -1
  97. package/tasks/identify/SubtypeSublayerQueryIdentifyProvider.js +1 -1
  98. package/tasks/identify/WFSLayerQueryIdentifyProvider.js +1 -1
  99. package/tasks/identify/WMSLayerFeatureInfoIdentifyProvider.js +1 -1
  100. package/tasks/identify/WMSSublayerIdentifyProvider.js +1 -1
  101. package/tasks/query/ArcGISRelationship.js +1 -1
  102. package/tasks/query/ArcGISSublayerQueryProvider.js +1 -1
  103. package/tasks/query/CSVLayerClientSideQueryProvider.js +1 -1
  104. package/tasks/query/ClientSideQueryProvider.js +1 -1
  105. package/tasks/query/FeatureLayerQueryProvider.js +1 -1
  106. package/tasks/query/GeoJSONLayerClientSideQueryProvider.js +1 -1
  107. package/tasks/query/SceneLayerQueryProvider.js +1 -1
  108. package/tasks/query/SubtypeSublayerQueryProvider.js +1 -1
  109. package/tasks/query/WFSLayerQueryProvider.js +1 -1
  110. package/tasks/search/ArcGISGeocoderSearchProvider.d.ts +2 -1
  111. package/tasks/search/ArcGISGeocoderSearchProvider.js +1 -1
  112. package/tasks/search/GeocoderSearchProvider.d.ts +4 -3
  113. package/tasks/search/GeocoderSearchProvider.js +1 -1
  114. package/tasks/search/SearchProviderBase.js +1 -1
  115. package/tasks/search/SearchService.js +1 -1
  116. package/tasks/search/_utilities.js +1 -1
  117. package/utilities/CaseInsensitiveObservableMap.d.ts +2 -2
  118. package/utilities/CaseInsensitiveObservableMap.js +1 -1
  119. package/utilities/arcade.js +1 -1
  120. package/utilities/uri.d.ts +1 -1
  121. package/utilities/uri.js +1 -1
  122. package/version.d.ts +1 -1
  123. package/version.js +1 -1
package/Entity.d.ts CHANGED
@@ -57,7 +57,7 @@ export declare abstract class EntityBase<TProperties extends EntityBasePropertie
57
57
  /**
58
58
  * The unique ID for this entity. Once set, this should never change.
59
59
  */
60
- protected _id: string;
60
+ protected _id: string | undefined;
61
61
  /**
62
62
  * Creates a new instance of the entity and assigns the given properties.
63
63
  *
package/Hyperlink.d.ts CHANGED
@@ -43,18 +43,18 @@ export declare class Hyperlink extends Hyperlink_base {
43
43
  /**
44
44
  * An optional URL to an icon image that will be displayed with the link.
45
45
  */
46
- get iconUrl(): string;
47
- set iconUrl(iconUrl: string);
46
+ get iconUrl(): string | undefined;
47
+ set iconUrl(iconUrl: string | undefined);
48
48
  /**
49
49
  * The target for the link (e.g. "_blank").
50
50
  */
51
- get target(): string;
52
- set target(target: string);
51
+ get target(): string | undefined;
52
+ set target(target: string | undefined);
53
53
  /**
54
54
  * A tooltip that will appear when a user hovers over the link.
55
55
  */
56
- get tooltip(): string;
57
- set tooltip(tooltip: string);
56
+ get tooltip(): string | undefined;
57
+ set tooltip(tooltip: string | undefined);
58
58
  private _url;
59
59
  private _text;
60
60
  private _iconUrl;
package/Hyperlink.js CHANGED
@@ -1 +1 @@
1
- import{__decorate as t}from"tslib";import{serializable as i,SerializableBase as r}from"./support/Serializable.js";import{observable as e}from"./support/observableUtils.js";import{checkArg as s}from"./utilities/checkArg.js";import{getAllReferencedFieldNames as o}from"./utilities/esri.js";let l=class extends(e(r)){get url(){return this._url}set url(t){this._url=t}get text(){return this._text}set text(t){this._text=t}get iconUrl(){return this._iconUrl}set iconUrl(t){this._iconUrl=t}get target(){return this._target}set target(t){this._target=t}get tooltip(){return this._tooltip}set tooltip(t){this._tooltip=t}_url;_text;_iconUrl;_target;_tooltip;constructor(t){s("properties",t).isNotMissing(),s("properties.url",t.url).isNotMissing(),s("properties.text",t.text).isNotMissing(),super(t)}getReferencedFields(){return o({content:[].concat(this.text,this.url,this.iconUrl,this.tooltip).join()})}_getSerializableProperties(){return{...super._getSerializableProperties(),url:"initial",text:"initial",iconUrl:"initial",target:"initial",tooltip:"initial"}}};l=t([i],l);export{l as Hyperlink};
1
+ import{__decorate as t}from"tslib";import{serializable as i,SerializableBase as r}from"./support/Serializable.js";import{observable as e}from"./support/observableUtils.js";import{checkArg as s}from"./utilities/checkArg.js";import{getAllReferencedFieldNames as o}from"./utilities/esri.js";let l=class extends(e(r)){get url(){return this._url}set url(t){this._url=t}get text(){return this._text}set text(t){this._text=t}get iconUrl(){return this._iconUrl}set iconUrl(t){this._iconUrl=t}get target(){return this._target}set target(t){this._target=t}get tooltip(){return this._tooltip}set tooltip(t){this._tooltip=t}_url;_text;_iconUrl;_target;_tooltip;constructor(t){s("properties",t).isNotMissing(),s("properties.url",t.url).isNotMissing(),s("properties.text",t.text).isNotMissing(),super(t)}getReferencedFields(){return o({content:"".concat(this.text,this.url,this.iconUrl??"",this.tooltip??"")})}_getSerializableProperties(){return{...super._getSerializableProperties(),url:"initial",text:"initial",iconUrl:"initial",target:"initial",tooltip:"initial"}}};l=t([i],l);export{l as Hyperlink};
@@ -39,7 +39,7 @@ export declare class LanguageResources extends SerializableBase<LanguageResource
39
39
  /**
40
40
  * The unique ID for this entity. Once set, this should never change.
41
41
  */
42
- protected _id: string;
42
+ protected _id: string | undefined;
43
43
  private readonly _locale;
44
44
  private readonly _values;
45
45
  /**
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import{ItemType as i}from"./ItemType.js";import{INVARIANT as t}from"./locale.js";import{serializable as s,SerializableBase as r}from"./support/Serializable.js";import{ObservableMap as l}from"./utilities/ObservableMap.js";import{generateUuid as o}from"./utilities/uuid.js";let a=class extends r{get id(){return this._id||(this._id=o()),this._id}get locale(){return this._locale}get values(){return this._values}get itemType(){return i.LANGUAGE_RESOURCES}_id;_locale=t;_values=new l;constructor(e){super(e),this._id=e?.id,e?.locale&&(this._locale=e.locale)}toItemUri(){return`item://${encodeURIComponent(this.itemType)}/${encodeURIComponent(this.id)}`}_getSerializableProperties(){return{...super._getSerializableProperties(),id:{serializeModes:["initial"],deserialize:!1},locale:{serializeModes:["initial"],deserialize:!1},values:{serializeModes:["initial"],serialize:()=>{const e={};for(const[i,t]of this.values.entries())e[i]=t;return e},deserialize:e=>{this._values.clear();for(const i of Object.keys(e))this._values.set(i,e[i])}}}}};a=e([s],a);export{a as LanguageResources};
1
+ import{__decorate as e}from"tslib";import{ItemType as i}from"./ItemType.js";import{INVARIANT as t}from"./locale.js";import{serializable as r,SerializableBase as s}from"./support/Serializable.js";import{ObservableMap as l}from"./utilities/ObservableMap.js";import{generateUuid as o}from"./utilities/uuid.js";let a=class extends s{get id(){return this._id||(this._id=o()),this._id}get locale(){return this._locale}get values(){return this._values}get itemType(){return i.LANGUAGE_RESOURCES}_id;_locale=t;_values=new l;constructor(e){super(e),this._id=e?.id,e?.locale&&(this._locale=e.locale)}toItemUri(){return`item://${encodeURIComponent(this.itemType)}/${encodeURIComponent(this.id)}`}_getSerializableProperties(){return{...super._getSerializableProperties(),id:{serializeModes:["initial"],deserialize:!1},locale:{serializeModes:["initial"],deserialize:!1},values:{serializeModes:["initial"],serialize:()=>{const e={};for(const[i,t]of this.values.entries())e[i]=t;return e},deserialize:e=>{if(this._values.clear(),e)for(const[i,t]of Object.entries(e))this._values.set(i,t)}}}}};a=e([r],a);export{a as LanguageResources};
package/PortalUri.d.ts CHANGED
@@ -7,12 +7,12 @@ export declare class PortalUri {
7
7
  /**
8
8
  * The item's id.
9
9
  */
10
- itemId: string;
10
+ itemId?: string;
11
11
  /**
12
12
  * The unique ID of the portal where the item is located. See
13
13
  * {@link config!Config.portals}.
14
14
  */
15
- portalId: string;
15
+ portalId?: string;
16
16
  /**
17
17
  * Creates a new PortalUri object.
18
18
  *
@@ -8,23 +8,23 @@ export interface AttachmentInfo {
8
8
  /**
9
9
  * Id of the attachment.
10
10
  */
11
- id?: number;
11
+ id: number;
12
12
  /**
13
13
  * The MIME content type of the attachment, e.g. "application/pdf".
14
14
  */
15
- contentType?: string;
15
+ contentType: string;
16
16
  /**
17
17
  * The size of the attachment in bytes.
18
18
  */
19
- size?: number;
19
+ size: number;
20
20
  /**
21
21
  * The name of the attachment.
22
22
  */
23
- name?: string;
23
+ name: string;
24
24
  /**
25
25
  * The URL of the attachment.
26
26
  */
27
- url?: string;
27
+ url?: string | null;
28
28
  }
29
29
  /**
30
30
  * Properties that can be passed to the constructor of
@@ -55,19 +55,19 @@ export declare class Attachment extends EntityBase<AttachmentProperties> {
55
55
  /**
56
56
  * The MIME content type of the attachment, e.g. "application/pdf".
57
57
  */
58
- contentType: string;
58
+ contentType: string | undefined;
59
59
  /**
60
60
  * The size of the attachment in bytes.
61
61
  */
62
- size: number;
62
+ size: number | undefined;
63
63
  /**
64
64
  * A human-readable title for the attachment.
65
65
  */
66
- title: string;
66
+ title: string | undefined;
67
67
  /**
68
68
  * The URL that can be used to download the attachment data.
69
69
  */
70
- url: string;
70
+ url: string | undefined;
71
71
  /**
72
72
  * @inheritDoc
73
73
  */
package/data/Feature.js CHANGED
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import t from"@arcgis/core/Graphic";import s from"@arcgis/core/core/Collection";import{fromJSON as i}from"@arcgis/core/geometry/support/jsonUtils";import{EntityBase as r}from"../Entity.js";import{Hyperlink as a}from"../Hyperlink.js";import{InvalidOperationError as o}from"../InvalidOperationError.js";import{isLayerExtension as n,isSublayerExtension as l,isTableExtension as h,ItemType as u}from"../ItemType.js";import{handles as c}from"../support/HandlesMixin.js";import{serializable as p}from"../support/Serializable.js";import{createIHandle as m,notifyChange as f,onWatch as d,watch as g,watchEvent as y}from"../support/observableUtils.js";import{CaseInsensitiveObservableMap as _}from"../utilities/CaseInsensitiveObservableMap.js";import{MapTransformCollection as b}from"../utilities/MapTransformCollection.js";import{ObservableMap as F}from"../utilities/ObservableMap.js";import{ReadOnlyMap as x}from"../utilities/ReadOnlyMap.js";import{Time as w}from"../utilities/Time.js";import{flatten as v,groupBy as I}from"../utilities/array.js";import{checkArg as S}from"../utilities/checkArg.js";import{compare as A}from"../utilities/collection.js";import{isCodedValueDomain as z,isGeometry as E}from"../utilities/esri.js";import{getArcadeExpressionFromField as j,getRelationshipFromField as T,isArcadeExpressionField as k}from"../utilities/field.js";import{esriFormatToGeocortexFormat as R,parse as O}from"../utilities/format/date.js";import{NumberFormat as M}from"../utilities/format/formats.js";import{parse as N}from"../utilities/format/number.js";import{format as D}from"../utilities/format/string.js";import{esriFormatToGeocortexFormat as V,parse as U}from"../utilities/format/time.js";import{find as P,map as C}from"../utilities/iterable.js";import{getLogger as G}from"../utilities/log.js";import{map as H}from"../utilities/promise.js";import{caseInsensitiveEquals as L}from"../utilities/string.js";import{FeatureSettings as Z}from"./FeatureSettings.js";import{Schema as $}from"./Schema.js";const K=G("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let J=class extends r{attributes;get geometry(){return this._geometry}set geometry(e){this._geometry=E(e)||!e?e:i(e),this.schema.spatialReference=this._geometry?.spatialReference,f(this,"geometryType")}settings;schema;attachments;expressionFieldValues;_itemType=u.FEATURE;get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source===e||null==this._source&&null==e||(this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0),f(this,"attachmentsInitialized"),f(this,"relatedFeaturesInitialized"))}get primaryKey(){const e=this.attributes.get(this.schema.primaryKeyField);return null!=e?`${e}`:void 0}get hasGlobalId(){return!!this.schema.fields.find((e=>"global-id"===e.type))}get globalId(){const e=this.schema.fields.find((e=>"global-id"===e.type));return e?this.attributes.get(e.name):void 0}set globalId(e){const t=this.schema.fields.find((e=>"global-id"===e.type));if(!t)throw new o("Cannot set global ID on feature -- no global ID field.");this.attributes.set(t.name,e)}get presentableAttributes(){return null==this._presentableAttributes&&(this._presentableAttributes=new q(this)),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new re(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find((t=>t.id===e))}}get subtype(){if(this.schema.subtypeField&&this.attributes.has(this.schema.subtypeField)){const e=this.attributes.get(this.schema.subtypeField);return this.schema.subtypes.find((t=>t.code===e))}}get attachmentsInitialized(){return!this.source||this._attachmentsInitialized}get relatedFeaturesInitialized(){return!this.source||this.source.relationships.every((e=>this._initializedRelationships.has(e)))}get expressionsInitialized(){return!this.settings.popupTemplate?.expressionInfos?.length||this._expressionsInitialized}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _key(){return`${this.source?.id}//${this.primaryKey??this.globalId??this.id}`}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find((e=>"text"===e.type));if(e)return e.text}}return""}_geometry;_source;_presentableAttributes;_hyperlinks;_featureHydrationStatus;_relatedFeatures;_expressionFieldValues=new F;_expressionValuesUpdatePending=!1;_attachmentsInitialized=!1;_expressionsInitialized=!1;_initializedRelationships=new WeakSet;constructor(e){super(e),this.settings=new Z,this.settings._setFeature(this),this.schema=new $,this.schema._featureSettings=this.settings,this.attachments=new s,this.attributes=new _,this._relatedFeatures=new F,this.expressionFieldValues=new W(this._expressionFieldValues,this),this._handles.add([g(this.settings,"popupTemplate",(()=>{this._expressionsInitialized=!1,f(this,"expressionsInitialized")}),{sync:!0}),d(this,"title",(()=>{const e=g(this.settings,"popupTemplate.title",(()=>f(this,"title")),{sync:!0}),t=this.presentableAttributes.on("change",(()=>f(this,"title")));return m([e,t])})),d(this,"description",(()=>{const e=g(this.settings,"popupTemplate.content",(()=>f(this,"description")),{sync:!0}),t=this.presentableAttributes.on("change",(()=>f(this,"description")));return m([e,t])})),d(this,"relatedFeaturesInitialized",(()=>y(this,"source.relationships",["after-changes",()=>{f(this,"relatedFeaturesInitialized")}])))])}format(e,...t){let s="string"==typeof e?{format:e}:e;S("options",s).isNotMissing();const{format:i}=s;S("format",i).isNotMissing();let r=s.format.replace(ee,te);return r=r.replace(X,((e,t,i,r,a)=>oe(this,t||i,r,{...s,format:a?`{0:${a}}`:"{0}"}))),r=r.replace(se,"{{"),s={...s},s.format=r,D(s,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}toGraphic(){return toGraphic(this)}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(!t)return;const{runAsyncArcadeExpression:s}=await import("../utilities/arcade.js");if(await Promise.all(t.map((async e=>{try{const t=this.source?.layer??this.source?.sublayer;let i=this.source?.mapExtension;if(!i){const e=this.source?.layerExtension;i=e?.mapExtension}this._expressionFieldValues.set(e.name,await s(e.expression,{layer:t,map:i?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,ie)}}))),e)return this.attributes.on("change",(async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout((async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()}),0))}));this._expressionsInitialized=!0,f(this,"expressionsInitialized")}async fetchRelatedFeatures(e,t){if(!this.source)return;let s=[];if(e){const t=new Set(Array.isArray(e)?e:[e]);for(const e of t){const t="string"==typeof e?this.source.relationships.find((t=>t.id===e)):e;if(!t||!this.source.relationships.includes(t))throw new o("Relationship not found in feature source.");s.push(t)}}else s=this.source.relationships.toArray();const i=await H(s,(async e=>[e,await(async()=>{const s=await e.getRelatedFeatures(this,t);return this._initializedRelationships.add(e),s})()]));for(const e of i)this._relatedFeatures.set(e[0],e[1]);f(this,"relatedFeaturesInitialized")}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);A(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>{this.attachments.remove(e)},onNew:(e,t)=>{this.attachments.add(e)},onMatch:(e,t,s,i)=>{this.attachments.splice(s,1,t)}}),this._attachmentsInitialized=!0,f(this,"attachmentsInitialized")}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&(this.source?.capabilities).supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map||e instanceof F)e.forEach(((e,t)=>{this.attributes.set(t,e)}));else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("geometry"):this.geometry?.toJSON(),deserialize:e=>{E(e)?this.geometry=e:this.geometry=e?i(e):void 0}},settings:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map((e=>e.id)).toArray():[],s=[];for(const i of e)t.includes(i)?s.push(this.fetchRelatedFeatures(i)):K.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(s)}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const i=s.replace(ee,te);for(;e=Y.exec(i),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};J=e([p],J);export{J as Feature};export function toFeature(e,t){const s=new J(t);if(e.attributes){const t=e.attributes;for(const[e,i]of Object.entries(t))s.attributes.set(e,i)}return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const s=new t;s.attributes={};for(const t of e.attributes.keys())s.attributes[t]=e.attributes.get(t);return n(e.source)&&e.source.layer?s.layer=e.source.layer:l(e.source)&&e.source.sublayer&&(s.layer=e.source.sublayer),h(e.source)&&e.source.table&&(s.layer=e.source.table),s.geometry=e.geometry,e.settings.popupTemplate&&(s.popupTemplate=e.settings.popupTemplate),s}const Q="Presentable attributes are read-only.",B="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class W extends x{_feature;_pending=new Set;constructor(e,t){super(e),this._feature=t}get(e){return super.has(e)||this._calcExpressionValue(e),super.get(e)}async _calcExpressionValue(e){if(!this._pending.has(e)){this._pending.add(e);try{const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find((t=>t.name===e));if(!s)return;const{isArcadeScriptAsync:i,runAsyncArcadeExpression:r,arcadeScriptUsesGeometry:a,runArcadeExpression:o}=await import("../utilities/arcade.js");try{if(i(s.expression,t)){const i=this._feature.source?.layer??this._feature.source?.sublayer;let a=this._feature.source?.mapExtension;if(!a){const e=this._feature.source?.layerExtension;a=e?.mapExtension}this._originalMap.set(e,await r(s.expression,{feature:this._feature,layer:i,map:a?.map,spatialReference:t}))}else{if(a(s.expression,t)){const{enableGeometrySupport:e}=await import("@arcgis/core/arcade/arcade");await e()}this._originalMap.set(e,o(s.expression,{feature:this._feature,spatialReference:t}))}}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,ie)}}finally{this._pending.delete(e)}}}}class q extends x{get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}_feature;_numObservers;_onAllObserversRemoved;constructor(e){super(new _),this._feature=e,this._handles.add([d(this,"size",(()=>g(this._feature.attributes,"size",(()=>f(this,"size")),{sync:!0}))),d(this,"size",(()=>g(this._feature.schema.fields,"_expressionFieldsLength",(()=>f(this,"size")),{sync:!0})))])}destroy(){this._onAllObserversRemoved?.(),this._numObservers=0,super.destroy()}clear(){throw new o(Q)}delete(e){throw new o(Q)}forEach(e,t){S("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){for(const t of this.keys())if(L(t,e))return!0;return!1}set(...e){throw new o(Q)}*entries(){yield*C(this.keys(),(e=>[e,this.get(e)]))}*keys(){yield*this._feature.attributes.keys();for(const e of this._feature.schema.fields.expressionFields)yield e.name;if(null!=this._feature.source?.relationships)for(const e of this._feature.source.relationships)if("one-to-one"===e.cardinality||"many-to-one"===e.cardinality)for(const t of e.relatedSource.schema.fields)yield`relationships/${e.id}/${t.name}`}*values(){yield*C(this.keys(),(e=>this.get(e)))}[Symbol.iterator](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(S("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{for(const e of t)e.remove();t.clear()};let i;const r=()=>{const t=()=>{i&&(window.clearTimeout(i),i=void 0)};t(),i=window.setTimeout((()=>{const s=[],i=[];for(const[t,i]of this.entries())i!==e.get(t)&&s.push([t,i]);for(const[t,s]of e.entries())this.has(t)&&s===this.get(t)||i.push([t,s]);if(s.length||i.length){const e={added:s,removed:i,target:this};if(this.hasEventListener("after-add"))for(const e of s)this.emit("after-add",{target:this,item:e});if(this.hasEventListener("after-remove"))for(const e of i)this.emit("after-remove",{target:this,item:e});this.emit("change",e),a()}t()}))},a=()=>{e.clear(),s();for(const s of this.keys()){const i=this._getFieldExtension(s);let a="{0}";if(i){const e=g(i,"format",r);t.add(e),i.format&&(a=i.format)}e.set(s,this._formatAttribute(s,a))}};a();const o=this._feature.attributes.on("change",r),n=this._feature.schema.fieldExtensions.on("change",r),l=[g(this._feature.settings.formatSettings,"numberFormat",r),g(this._feature.settings.formatSettings,"dateFormat",r),g(this._feature.settings.formatSettings,"timeFormat",r),g(this._feature.settings.formatSettings,"locale",r)],h=this._feature.expressionFieldValues.on("change",r),u=this._feature.schema.fields.on("change",(e=>{(e.added?.some((e=>k(e.name)))||e.removed?.some((e=>k(e.name))))&&r()})),c=g(this._feature.settings,"popupTemplate",r);this._onAllObserversRemoved=()=>{h.remove(),o.remove(),n.remove(),u.remove();for(const e of l)e.remove();c.remove(),e.clear(),s()}}const s=super.on(e,t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=j(e);if(null!=s)return oe(this._feature,"expression",s,{format:t});const[i,r]=T(e);return null!=i?oe(this._feature,i,r,{format:t}):oe(this._feature,void 0,e,{format:t})}}const X=/\{(?:relationships[\\/]([\w-]*)[\\/])?(?:(expression)[\\/])?([_a-zA-ZÀ-ÖØ-öø-ÿ][._a-zA-ZÀ-ÖØ-öø-ÿ0-9()]*)(?::([^}]*))?\}/gi,Y=/\{relationships\/([\w-]*)[\\/]([^}]*)\}/gi,ee=/{{/g,te="\0MAGIC\0",se=new RegExp(te,"g"),ie="#INVALID";class re extends b{_feature;_hyperlinks;constructor(e){super(e.settings.hyperlinkTemplates,(e=>this._getHyperlink(e))),this._feature=e}destroy(){for(const e of this)e.destroy();super.destroy()}_getHyperlink(e){return null==this._hyperlinks&&(this._hyperlinks=new WeakMap),this._hyperlinks.has(e)||this._hyperlinks.set(e,new ae(this._feature,e)),this._hyperlinks.get(e)}}let ae=class extends(c(a)){get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new o(B)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new o(B)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new o(B)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new o(B)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new o(B)}_feature;_template;constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t,this._handles.add(d(this,(e=>{const t=g(this._template,e,(()=>f(this,e)),{sync:!0}),s=this._feature.presentableAttributes.on("change",(()=>{f(this,e)})),i=this._feature.relatedFeatures.on("change",(()=>{f(this,e)}));return m([t,s,i])})))}_getSerializableProperties(){return{}}};function oe(e,t,s,i={format:"{0}"}){if(!L(t,"expression")){if(t){const r=P(e.relatedFeatures.keys(),(e=>L(e.id,t)));if(!r)return K.debug("Could not resolve related field '{0}/{1}",t,s),ie;const a=Array.from(e.relatedFeatures.get(r));return"many-to-one"===r.cardinality||"one-to-one"===r.cardinality?a.length<1?(K.debug("Could not resolve related field '{0}/{1}",t,s),ie):ne(a[0],s,i):a.map((e=>ne(e,s,i))).filter((e=>""!==e)).join(",")}return ne(e,s,i)}if(!e.settings.popupTemplate?.expressionInfos?.find((e=>L(e.name,s))))return K.debug("Could not find expression '{0}'.",s),ie;try{const t=e.expressionFieldValues.get(s)??i.defaultExpressionValue??"",r=e.schema.findFieldByName(`expression/${s}`),a=null==r?void 0:e.schema.fieldExtensions.forField(r);return le(e,t,s,a?.formatSettings,i)}catch(e){if(e instanceof Error)return K.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),ie;throw e}}function ne(e,t,s){let i;if(i=e.attributes.get(t),null==i)return"";const r=e.schema.findFieldByName(t);let a,o;if(void 0===e.schema.subtypeField){a=e.schema.typeIdField;const t=e.schema.types;o=t.filter((t=>t?.id?.toString()===e.type?.id?.toString()))?.getItemAt(0)}else{a=e.schema.subtypeField;const t=e.schema.subtypes;o=t.filter((t=>t?.code?.toString()===e.subtype?.code?.toString()))?.getItemAt(0)}const n=o?.domains?.[r?.name??t],l=e=>e.codedValues?.find((e=>e.code.toString()===i.toString()))?.name??i;let h;if(L(t,a)){const e=n&&"inherited"!==n.type?n:r?.domain;i="coded-value"===e?.type?l(e):o?.name??i}else if(n&&z(n))i=l(n);else if(r?.domain&&z(r.domain))i=l(r.domain);else if(r){switch(r.type){case"integer":case"small-integer":case"big-integer":case"single":case"double":i=N(i);break;case"date":i=O({timeZone:e.schema.timeZone},i);break;case"timestamp-offset":case"date-only":i=O({},i),"date-only"===r.type&&(s.isDateOnly=!0);break;case"time-only":i=U(i);break;default:i=`${i.toString()}`}const t=e.schema.fieldExtensions.forField(r);t&&(h=t.formatSettings)}return le(e,i,t,h,s)}function le(e,t,s,i,r){if("string"==typeof t&&(null==r.format||"{0}"===r.format))return t;const a={...r};if("number"==typeof t||t instanceof Date||t instanceof w){null==a.locale&&(a.locale=i?.locale??e.settings.formatSettings.locale);const r=e.settings.popupTemplate?.fieldInfos?.find((e=>L(e.fieldName,s)))?.format;"number"==typeof t?function(e,t,s,i){null==e.currency&&(e.currency=t?.currency??i.settings.formatSettings.currency);null==e.numberFormat&&(e.numberFormat=t?.numberFormat,null==e.numberFormat&&(e.numberFormat=null==s?i.settings.formatSettings.numberFormat:s.digitSeparator?M.NUMBER:M.FIXED_POINT));null==e.fractionalDigits&&(e.fractionalDigits=t?.fractionalDigits,null==e.fractionalDigits&&(e.fractionalDigits=null==s?i.settings.formatSettings.fractionalDigits:s.places))}(a,i,r,e):t instanceof Date?function(e,t,s,i){null==e.dateFormat&&(e.dateFormat=t?.dateFormat,null==e.dateFormat&&(e.dateFormat=null==s?i.settings.formatSettings.dateFormat:R(s.dateFormat)));null==e.timeZone&&(e.timeZone=t?.timeZone??i.settings.formatSettings.timeZone)}(a,i,r,e):function(e,t,s,i){null==e.timeFormat&&(e.timeFormat=t?.timeFormat,null==e.timeFormat&&(e.timeFormat=null==s?i.settings.formatSettings.timeFormat:V(s.dateFormat)))}(a,i,r,e)}return D(a,t)}ae=e([p],ae);export async function resolveRelatedFeatures(e){const t=I(e,(e=>e.source));await Promise.all(v([...t.keys()].map((e=>e.relationships.toArray()))).map((e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach((([t,s])=>{t.relatedFeatures.set(e,s)}))})(e))))}
1
+ import{__decorate as e}from"tslib";import t from"@arcgis/core/Graphic";import s from"@arcgis/core/core/Collection";import{fromJSON as i}from"@arcgis/core/geometry/support/jsonUtils";import{EntityBase as r}from"../Entity.js";import{Hyperlink as a}from"../Hyperlink.js";import{InvalidOperationError as o}from"../InvalidOperationError.js";import{isLayerExtension as n,isSublayerExtension as l,isTableExtension as h,ItemType as u}from"../ItemType.js";import{handles as c}from"../support/HandlesMixin.js";import{serializable as p}from"../support/Serializable.js";import{createIHandle as m,notifyChange as f,onWatch as d,watch as g,watchEvent as y}from"../support/observableUtils.js";import{CaseInsensitiveObservableMap as _}from"../utilities/CaseInsensitiveObservableMap.js";import{MapTransformCollection as b}from"../utilities/MapTransformCollection.js";import{ObservableMap as F}from"../utilities/ObservableMap.js";import{ReadOnlyMap as x}from"../utilities/ReadOnlyMap.js";import{Time as w}from"../utilities/Time.js";import{flatten as v,groupBy as I}from"../utilities/array.js";import{checkArg as S}from"../utilities/checkArg.js";import{compare as A}from"../utilities/collection.js";import{isCodedValueDomain as z,isGeometry as E}from"../utilities/esri.js";import{getArcadeExpressionFromField as j,getRelationshipFromField as T,isArcadeExpressionField as k}from"../utilities/field.js";import{esriFormatToGeocortexFormat as R,parse as O}from"../utilities/format/date.js";import{NumberFormat as M}from"../utilities/format/formats.js";import{parse as N}from"../utilities/format/number.js";import{format as D}from"../utilities/format/string.js";import{esriFormatToGeocortexFormat as V,parse as U}from"../utilities/format/time.js";import{find as P,map as C}from"../utilities/iterable.js";import{getLogger as G}from"../utilities/log.js";import{map as H}from"../utilities/promise.js";import{caseInsensitiveEquals as L}from"../utilities/string.js";import{FeatureSettings as Z}from"./FeatureSettings.js";import{Schema as $}from"./Schema.js";const K=G("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let J=class extends r{attributes;get geometry(){return this._geometry}set geometry(e){this._geometry=E(e)||!e?e:i(e),this.schema.spatialReference=this._geometry?.spatialReference,f(this,"geometryType")}settings;schema;attachments;expressionFieldValues;_itemType=u.FEATURE;get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source===e||null==this._source&&null==e||(this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0),f(this,"attachmentsInitialized"),f(this,"relatedFeaturesInitialized"))}get primaryKey(){const{primaryKeyField:e}=this.schema;if(!e)return;const t=this.attributes.get(e);return null!=t?`${t}`:void 0}get hasGlobalId(){return!!this.schema.fields.find((e=>"global-id"===e.type))}get globalId(){const e=this.schema.fields.find((e=>"global-id"===e.type));return e?this.attributes.get(e.name):void 0}set globalId(e){const t=this.schema.fields.find((e=>"global-id"===e.type));if(!t)throw new o("Cannot set global ID on feature -- no global ID field.");this.attributes.set(t.name,e)}get presentableAttributes(){return null==this._presentableAttributes&&(this._presentableAttributes=new q(this)),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new re(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find((t=>t.id===e))}}get subtype(){if(this.schema.subtypeField&&this.attributes.has(this.schema.subtypeField)){const e=this.attributes.get(this.schema.subtypeField);return this.schema.subtypes.find((t=>t.code===e))}}get attachmentsInitialized(){return!this.source||this._attachmentsInitialized}get relatedFeaturesInitialized(){return!this.source||this.source.relationships.every((e=>this._initializedRelationships.has(e)))}get expressionsInitialized(){return!this.settings.popupTemplate?.expressionInfos?.length||this._expressionsInitialized}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _key(){return`${this.source?.id}//${this.primaryKey??this.globalId??this.id}`}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find((e=>"text"===e.type));if(e)return e.text}}return""}_geometry;_source;_presentableAttributes;_hyperlinks;_featureHydrationStatus;_relatedFeatures;_expressionFieldValues=new F;_expressionValuesUpdatePending=!1;_attachmentsInitialized=!1;_expressionsInitialized=!1;_initializedRelationships=new WeakSet;constructor(e){super(e),this.settings=new Z,this.settings._setFeature(this),this.schema=new $,this.schema._featureSettings=this.settings,this.attachments=new s,this.attributes=new _,this._relatedFeatures=new F,this.expressionFieldValues=new W(this._expressionFieldValues,this),this._handles.add([g(this.settings,"popupTemplate",(()=>{this._expressionsInitialized=!1,f(this,"expressionsInitialized")}),{sync:!0}),d(this,"title",(()=>{const e=g(this.settings,"popupTemplate.title",(()=>f(this,"title")),{sync:!0}),t=this.presentableAttributes.on("change",(()=>f(this,"title")));return m([e,t])})),d(this,"description",(()=>{const e=g(this.settings,"popupTemplate.content",(()=>f(this,"description")),{sync:!0}),t=this.presentableAttributes.on("change",(()=>f(this,"description")));return m([e,t])})),d(this,"relatedFeaturesInitialized",(()=>y(this,"source.relationships",["after-changes",()=>{f(this,"relatedFeaturesInitialized")}])))])}format(e,...t){let s="string"==typeof e?{format:e}:e;S("options",s).isNotMissing();const{format:i}=s;S("format",i).isNotMissing();let r=s.format.replace(ee,te);return r=r.replace(X,((e,t,i,r,a)=>oe(this,t||i,r,{...s,format:a?`{0:${a}}`:"{0}"}))),r=r.replace(se,"{{"),s={...s},s.format=r,D(s,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}toGraphic(){return toGraphic(this)}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(!t)return;const{runAsyncArcadeExpression:s}=await import("../utilities/arcade.js");if(await Promise.all(t.map((async e=>{try{const t=this.source?.layer??this.source?.sublayer;let i=this.source?.mapExtension;if(!i){const e=this.source?.layerExtension;i=e?.mapExtension}this._expressionFieldValues.set(e.name,await s(e.expression,{layer:t,map:i?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,ie)}}))),e)return this.attributes.on("change",(async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout((async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()}),0))}));this._expressionsInitialized=!0,f(this,"expressionsInitialized")}async fetchRelatedFeatures(e,t){if(!this.source)return;let s=[];if(e){const t=new Set(Array.isArray(e)?e:[e]);for(const e of t){const t="string"==typeof e?this.source.relationships.find((t=>t.id===e)):e;if(!t||!this.source.relationships.includes(t))throw new o("Relationship not found in feature source.");s.push(t)}}else s=this.source.relationships.toArray();const i=await H(s,(async e=>[e,await(async()=>{const s=await e.getRelatedFeatures(this,t);return this._initializedRelationships.add(e),s})()]));for(const e of i)this._relatedFeatures.set(e[0],e[1]);f(this,"relatedFeaturesInitialized")}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);A(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>{this.attachments.remove(e)},onNew:(e,t)=>{this.attachments.add(e)},onMatch:(e,t,s,i)=>{this.attachments.splice(s,1,t)}}),this._attachmentsInitialized=!0,f(this,"attachmentsInitialized")}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&(this.source?.capabilities).supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map||e instanceof F)e.forEach(((e,t)=>{this.attributes.set(t,e)}));else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("geometry"):this.geometry?.toJSON(),deserialize:e=>{E(e)?this.geometry=e:this.geometry=e?i(e):void 0}},settings:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map((e=>e.id)).toArray():[],s=[];for(const i of e)t.includes(i)?s.push(this.fetchRelatedFeatures(i)):K.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(s)}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const i=s.replace(ee,te);for(;e=Y.exec(i),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};J=e([p],J);export{J as Feature};export function toFeature(e,t){const s=new J(t);if(e.attributes){const t=e.attributes;for(const[e,i]of Object.entries(t))s.attributes.set(e,i)}return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const s=new t;s.attributes={};for(const t of e.attributes.keys())s.attributes[t]=e.attributes.get(t);return n(e.source)&&e.source.layer?s.layer=e.source.layer:l(e.source)&&e.source.sublayer&&(s.layer=e.source.sublayer),h(e.source)&&e.source.table&&(s.layer=e.source.table),s.geometry=e.geometry,e.settings.popupTemplate&&(s.popupTemplate=e.settings.popupTemplate),s}const Q="Presentable attributes are read-only.",B="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class W extends x{_feature;_pending=new Set;constructor(e,t){super(e),this._feature=t}get(e){return super.has(e)||this._calcExpressionValue(e),super.get(e)}async _calcExpressionValue(e){if(!this._pending.has(e)){this._pending.add(e);try{const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find((t=>t.name===e));if(!s)return;const{isArcadeScriptAsync:i,runAsyncArcadeExpression:r,arcadeScriptUsesGeometry:a,runArcadeExpression:o}=await import("../utilities/arcade.js");try{if(i(s.expression,t)){const i=this._feature.source?.layer??this._feature.source?.sublayer;let a=this._feature.source?.mapExtension;if(!a){const e=this._feature.source?.layerExtension;a=e?.mapExtension}this._originalMap.set(e,await r(s.expression,{feature:this._feature,layer:i,map:a?.map,spatialReference:t}))}else{if(a(s.expression,t)){const{enableGeometrySupport:e}=await import("@arcgis/core/arcade/arcade");await e()}this._originalMap.set(e,o(s.expression,{feature:this._feature,spatialReference:t}))}}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,ie)}}finally{this._pending.delete(e)}}}}class q extends x{get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}_feature;_numObservers;_onAllObserversRemoved;constructor(e){super(new _),this._feature=e,this._handles.add([d(this,"size",(()=>g(this._feature.attributes,"size",(()=>f(this,"size")),{sync:!0}))),d(this,"size",(()=>g(this._feature.schema.fields,"_expressionFieldsLength",(()=>f(this,"size")),{sync:!0})))])}destroy(){this._onAllObserversRemoved?.(),this._numObservers=0,super.destroy()}clear(){throw new o(Q)}delete(e){throw new o(Q)}forEach(e,t){S("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){for(const t of this.keys())if(L(t,e))return!0;return!1}set(...e){throw new o(Q)}*entries(){yield*C(this.keys(),(e=>[e,this.get(e)]))}*keys(){yield*this._feature.attributes.keys();for(const e of this._feature.schema.fields.expressionFields)yield e.name;if(null!=this._feature.source?.relationships)for(const e of this._feature.source.relationships)if("one-to-one"===e.cardinality||"many-to-one"===e.cardinality)for(const t of e.relatedSource.schema.fields)yield`relationships/${e.id}/${t.name}`}*values(){yield*C(this.keys(),(e=>this.get(e)))}[Symbol.iterator](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(S("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{for(const e of t)e.remove();t.clear()};let i;const r=()=>{const t=()=>{i&&(window.clearTimeout(i),i=void 0)};t(),i=window.setTimeout((()=>{const s=[],i=[];for(const[t,i]of this.entries())i!==e.get(t)&&s.push([t,i]);for(const[t,s]of e.entries())this.has(t)&&s===this.get(t)||i.push([t,s]);if(s.length||i.length){const e={added:s,removed:i,target:this};if(this.hasEventListener("after-add"))for(const e of s)this.emit("after-add",{target:this,item:e});if(this.hasEventListener("after-remove"))for(const e of i)this.emit("after-remove",{target:this,item:e});this.emit("change",e),a()}t()}))},a=()=>{e.clear(),s();for(const s of this.keys()){const i=this._getFieldExtension(s);let a="{0}";if(i){const e=g(i,"format",r);t.add(e),i.format&&(a=i.format)}e.set(s,this._formatAttribute(s,a))}};a();const o=this._feature.attributes.on("change",r),n=this._feature.schema.fieldExtensions.on("change",r),l=[g(this._feature.settings.formatSettings,"numberFormat",r),g(this._feature.settings.formatSettings,"dateFormat",r),g(this._feature.settings.formatSettings,"timeFormat",r),g(this._feature.settings.formatSettings,"locale",r)],h=this._feature.expressionFieldValues.on("change",r),u=this._feature.schema.fields.on("change",(e=>{(e.added?.some((e=>k(e.name)))||e.removed?.some((e=>k(e.name))))&&r()})),c=g(this._feature.settings,"popupTemplate",r);this._onAllObserversRemoved=()=>{h.remove(),o.remove(),n.remove(),u.remove();for(const e of l)e.remove();c.remove(),e.clear(),s()}}const s=super.on(e,t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=j(e);if(null!=s)return oe(this._feature,"expression",s,{format:t});const[i,r]=T(e);return null!=i?oe(this._feature,i,r,{format:t}):oe(this._feature,void 0,e,{format:t})}}const X=/\{(?:relationships[\\/]([\w-]*)[\\/])?(?:(expression)[\\/])?([_a-zA-ZÀ-ÖØ-öø-ÿ][._a-zA-ZÀ-ÖØ-öø-ÿ0-9()]*)(?::([^}]*))?\}/gi,Y=/\{relationships\/([\w-]*)[\\/]([^}]*)\}/gi,ee=/{{/g,te="\0MAGIC\0",se=new RegExp(te,"g"),ie="#INVALID";class re extends b{_feature;_hyperlinks;constructor(e){super(e.settings.hyperlinkTemplates,(e=>this._getHyperlink(e))),this._feature=e}destroy(){for(const e of this)e.destroy();super.destroy()}_getHyperlink(e){return null==this._hyperlinks&&(this._hyperlinks=new WeakMap),this._hyperlinks.has(e)||this._hyperlinks.set(e,new ae(this._feature,e)),this._hyperlinks.get(e)}}let ae=class extends(c(a)){get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new o(B)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new o(B)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new o(B)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new o(B)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new o(B)}_feature;_template;constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t,this._handles.add(d(this,(e=>{const t=g(this._template,e,(()=>f(this,e)),{sync:!0}),s=this._feature.presentableAttributes.on("change",(()=>{f(this,e)})),i=this._feature.relatedFeatures.on("change",(()=>{f(this,e)}));return m([t,s,i])})))}_getSerializableProperties(){return{}}};function oe(e,t,s,i={format:"{0}"}){if(!L(t,"expression")){if(t){const r=P(e.relatedFeatures.keys(),(e=>L(e.id,t)));if(!r)return K.debug("Could not resolve related field '{0}/{1}",t,s),ie;const a=Array.from(e.relatedFeatures.get(r));return"many-to-one"===r.cardinality||"one-to-one"===r.cardinality?a.length<1?(K.debug("Could not resolve related field '{0}/{1}",t,s),ie):ne(a[0],s,i):a.map((e=>ne(e,s,i))).filter((e=>""!==e)).join(",")}return ne(e,s,i)}if(!e.settings.popupTemplate?.expressionInfos?.find((e=>L(e.name,s))))return K.debug("Could not find expression '{0}'.",s),ie;try{const t=e.expressionFieldValues.get(s)??i.defaultExpressionValue??"",r=e.schema.findFieldByName(`expression/${s}`),a=null==r?void 0:e.schema.fieldExtensions.forField(r);return le(e,t,s,a?.formatSettings,i)}catch(e){if(e instanceof Error)return K.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),ie;throw e}}function ne(e,t,s){let i;if(i=e.attributes.get(t),null==i)return"";const r=e.schema.findFieldByName(t);let a,o;if(void 0===e.schema.subtypeField){a=e.schema.typeIdField;const t=e.schema.types;o=t.filter((t=>t?.id?.toString()===e.type?.id?.toString()))?.getItemAt(0)}else{a=e.schema.subtypeField;const t=e.schema.subtypes;o=t.filter((t=>t?.code?.toString()===e.subtype?.code?.toString()))?.getItemAt(0)}const n=o?.domains?.[r?.name??t],l=e=>e.codedValues?.find((e=>e.code.toString()===i.toString()))?.name??i;let h;if(L(t,a)){const e=n&&"inherited"!==n.type?n:r?.domain;i="coded-value"===e?.type?l(e):o?.name??i}else if(n&&z(n))i=l(n);else if(r?.domain&&z(r.domain))i=l(r.domain);else if(r){switch(r.type){case"integer":case"small-integer":case"big-integer":case"single":case"double":i=N(i);break;case"date":i=O({timeZone:e.schema.timeZone},i);break;case"timestamp-offset":case"date-only":i=O({},i),"date-only"===r.type&&(s.isDateOnly=!0);break;case"time-only":i=U(i);break;default:i=`${i.toString()}`}const t=e.schema.fieldExtensions.forField(r);t&&(h=t.formatSettings)}return le(e,i,t,h,s)}function le(e,t,s,i,r){if("string"==typeof t&&(null==r.format||"{0}"===r.format))return t;const a={...r};if("number"==typeof t||t instanceof Date||t instanceof w){null==a.locale&&(a.locale=i?.locale??e.settings.formatSettings.locale);const r=e.settings.popupTemplate?.fieldInfos?.find((e=>L(e.fieldName,s)))?.format;"number"==typeof t?function(e,t,s,i){null==e.currency&&(e.currency=t?.currency??i.settings.formatSettings.currency);null==e.numberFormat&&(e.numberFormat=t?.numberFormat,null==e.numberFormat&&(e.numberFormat=null==s?i.settings.formatSettings.numberFormat:s.digitSeparator?M.NUMBER:M.FIXED_POINT));null==e.fractionalDigits&&(e.fractionalDigits=t?.fractionalDigits,null==e.fractionalDigits&&(e.fractionalDigits=null==s?i.settings.formatSettings.fractionalDigits:s.places))}(a,i,r,e):t instanceof Date?function(e,t,s,i){null==e.dateFormat&&(e.dateFormat=t?.dateFormat,null==e.dateFormat&&(e.dateFormat=null==s?i.settings.formatSettings.dateFormat:R(s.dateFormat)));null==e.timeZone&&(e.timeZone=t?.timeZone??i.settings.formatSettings.timeZone)}(a,i,r,e):function(e,t,s,i){null==e.timeFormat&&(e.timeFormat=t?.timeFormat,null==e.timeFormat&&(e.timeFormat=null==s?i.settings.formatSettings.timeFormat:V(s.dateFormat)))}(a,i,r,e)}return D(a,t)}ae=e([p],ae);export async function resolveRelatedFeatures(e){const t=I(e,(e=>e.source));await Promise.all(v([...t.keys()].map((e=>e.relationships.toArray()))).map((e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach((([t,s])=>{t.relatedFeatures.set(e,s)}))})(e))))}
@@ -12,11 +12,11 @@ export declare abstract class RelationshipBase<TProperties extends RelationshipP
12
12
  /**
13
13
  * @inheritDoc
14
14
  */
15
- title: string;
15
+ title?: string;
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
19
- get source(): FeatureSource;
19
+ get source(): FeatureSource | undefined;
20
20
  /**
21
21
  * @inheritDoc
22
22
  */
@@ -36,7 +36,7 @@ export declare abstract class RelationshipBase<TProperties extends RelationshipP
36
36
  /**
37
37
  * @inheritDoc
38
38
  */
39
- protected _source: FeatureSource;
39
+ protected _source: FeatureSource | undefined;
40
40
  private readonly _getRelatedFeaturesPromises;
41
41
  /**
42
42
  * @inheritDoc
package/data/Schema.js CHANGED
@@ -1 +1 @@
1
- var e;import{__decorate as i}from"tslib";import t from"@arcgis/core/PopupTemplate";import s from"@arcgis/core/core/Collection";import o from"@arcgis/core/layers/support/FeatureType";import l from"@arcgis/core/layers/support/Field";import d from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError as n}from"../InvalidOperationError.js";import{isFieldExtension as r}from"../ItemType.js";import{jsonToGeometryType as a}from"../json/GeometryJson.js";import{InitializableCollectionProxy as h}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as m,isDefault as f,serializable as p,shouldExcludeDefaults as c}from"../support/Serializable.js";import{Settings as _}from"../support/Settings.js";import{createIHandle as u,notifyChange as g,onWatch as F,watch as y}from"../support/observableUtils.js";import{CaseInsensitiveObservableMap as x}from"../utilities/CaseInsensitiveObservableMap.js";import{CollectionProxy as v}from"../utilities/CollectionProxy.js";import{ReadOnlyCollection as b}from"../utilities/ReadOnlyCollection.js";import S from"../utilities/_ReferenceCountedHandle.js";import{checkArg as T}from"../utilities/checkArg.js";import{compare as w}from"../utilities/collection.js";import{isFeatureType as z,isField as I}from"../utilities/esri.js";import{fieldWithArcadeXRegex as N,fieldWithRelationshipRegex as E,getArcadeExpressionFromField as A}from"../utilities/field.js";import{ERR_TIME_ZONE_INVALID as j,isValidTimeZone as H}from"../utilities/format/date.js";import{objectKeys as C}from"../utilities/object.js";import{caseInsensitiveEquals as R}from"../utilities/string.js";import{_fieldExtensionMap as M,FieldExtension as K}from"./FieldExtension.js";const O=new Map;O.set("objectid","oid"),O.set("oid","oid"),O.set("fid","oid"),O.set("shape","geometry"),O.set("shape__length","double"),O.set("shape_length","double"),O.set("shape__area","double"),O.set("shape_area","double"),O.set("area","double"),O.set("perimeter","double"),O.set("length","double"),O.set("fnode_","double"),O.set("tnode_","double"),O.set("lpoly_","double"),O.set("rpoly_","double"),O.set("cover_","integer"),O.set("cover_id","integer"),O.set("idtic","integer"),O.set("xtic","double"),O.set("ytic","double"),O.set("xmin","double"),O.set("ymin","double"),O.set("xmax","double"),O.set("ymax","double"),O.set("arc_","double"),O.set("subclass_","integer"),O.set("subclass_id","integer"),O.set("routelink","integer"),O.set("arclink","integer"),O.set("f_meas","double"),O.set("t_meas","double"),O.set("f_pos","double"),O.set("t_pos","double"),O.set("f_meas","double"),O.set("globalid","global-id"),O.set("guid","guid");export{N as fieldWithArcadeXRegex,E as fieldWithRelationshipRegex};const B=new WeakMap;let P=e=class extends _{fieldExtensions;fields;_featureSettings;_alwaysSerializeFieldExtensions;_watchHandles=[];_primaryKeyField;get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){if(!this._primaryKeyField){const e=this._getSetting("primaryKeyField");if(e)this._primaryKeyField=e;else{const e=this.fields.filter((e=>"oid"===e.type));1===e.length&&(this._primaryKeyField=e.getItemAt(0).name)}}return this._primaryKeyField}set primaryKeyField(e){this._primaryKeyField=e,this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){T("timeZone",e).satisfies((e=>H(e)),j(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get subtypes(){return this._getCollectionSetting("subtypes")}get subtypeField(){return this._getSetting("subtypeField")}set subtypeField(e){this._setSetting("subtypeField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}constructor(e){super(e),this.fieldExtensions=new J(this),this.fields=new Z(this),this._primaryKeyField=void 0,this._handles.add(this.fields.on("before-changes",(()=>{this._primaryKeyField=void 0})))}static createFieldInfoFromField(e){let i=!0;const t=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||O.has(t)&&O.get(t)===e.type)&&(i=!1),new d({visible:i,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0,isEditable:e.editable})}destroy(){this.parent=void 0,this.fieldExtensions?.destroy(),this.fields?.destroy(),super.destroy()}findFieldByName(e){return this.fields.findFieldByName(e)}toJSON(e="all"){const i=m(this._getSerializableProperties(),this,e)||{};let t=i.fieldExtensions;this.parent&&(t=t?.filter((e=>{const i=this.parent;return!i?.fieldExtensions?.some((i=>i.id===e.id))})));const{fields:s}=i;if(i)for(const e of C(i))this.isModified(e)||delete i[e];if(s&&(i.fields=s),t?.length&&(i.fieldExtensions=t),!c(e)||!f(i))return i}createPopupTemplate(){const e=this.createAllFieldInfos();return new t({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((i=>e.createFieldInfoFromField(i)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=e?a(e):void 0}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial","project"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>e.toJSON())):void 0,deserialize:e=>{if(!e)return;const i=e.map((e=>I(e)?e:l.fromJSON(e)));w(this.fields,i,{onNew:(e,i)=>{this.fields.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.alias=i.alias,e.editable=i.editable,e.length=i.length,e.nullable=i.nullable,e.type=i.type),t!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,i)=>R(e.name,i.name)})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.toArray().map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))),deserialize:e=>{e&&w(this.fieldExtensions,e,{onNew:(e,i)=>{this.fieldExtensions.add(r(e)?e:new K(e),i)},onMatch:(e,i,t,s)=>{r(i)||e.assignProperties(i),t!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,i)=>r(i)?i===e:!(!i?.field||!K.matchesRef(e,i.field))||e.id===i.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const i=e.map((e=>z(e)||!e?e:o.fromJSON(e)));w(this.types,i,{onNew:(e,i)=>{this.types.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.name=i.name,e.templates=i.templates?[...i.templates]:[],e.domains=i.domains),t!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,i)=>e.id===i.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};P=e=i([p],P);export{P as Schema};export function schemaHasSubtypes(e){return!(!e.subtypeField||!e.subtypes?.length)}class Z extends v{_schema;_fieldNameToField=new x;_expressionFields=new s;_expressionFieldsReadOnly=new b(this._expressionFields);get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){return this._expressionFieldsReadOnly}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}constructor(e){super(new s),this._schema=e,this._handles.add(F(this,"length",(()=>y(this._schema,"_fields.length",(()=>g(this,"length")),{sync:!0})))),this._handles.add(y(this._schema,"_fields",(e=>{if(this._handles.remove("schema-field-collection-schema-fields"),null!=e){this._handles.add([e.on("after-add",(i=>{this._collection.add(i.item,e.indexOf(i.item)),this._fieldNameToField.set(i.item.name,i.item)})),e.on("after-remove",(e=>{this._collection.remove(e.item),this._fieldNameToField.delete(e.item.name)}))],"schema-field-collection-schema-fields");for(const i of this._collection)e.includes(i)||(this._collection.remove(i),this._fieldNameToField.delete(i.name));for(const i of e)this._collection.includes(i)||(this._collection.add(i),this._fieldNameToField.set(i.name,i))}else for(const e of this._collection.filter((e=>!this._expressionFields.includes(e))))this._collection.remove(e),this._fieldNameToField.delete(e.name)}),{sync:!0,initial:!0})),this._generateExpressionFields(),this._handles.add([y(this._schema,"_featureSettings.popupTemplate.fieldInfos",(()=>{this._generateExpressionFields()}),{sync:!0}),y(this._schema,"_featureSettings.popupTemplate.expressionInfos",(()=>{this._generateExpressionFields()}),{sync:!0})])}clone(){return new Z(this._schema)}add(e,i){T("field",e).isNotMissing();const t=A(e.name);if(t){if(!this._popupTemplate)throw new n("Cannot create a field that references an arcade expression without a feature source and popup template.");const i=this._popupTemplate.expressionInfos.find((e=>R(e.name,t)));if(!i)throw new n("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((i=>R(i.fieldName,e.name)));s||(s=new d({fieldName:e.name,label:i.title}),this._popupTemplate.fieldInfos.push(s));const o=B.get(s);B.set(s,e),null!=this._expressionFields&&(this._expressionFields.remove(o),this._expressionFields.includes(e)||(this._expressionFields.add(e),this._collection.add(e),this._fieldNameToField.set(e.name,e))),g(this,"_expressionFieldsLength")}else this._schema._fields.add(e,i);return this}destroy(){this._fieldNameToField.clear(),this._expressionFields.removeAll(),this._collection.removeAll(),super.destroy()}removeAt(e){T("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;if(A(i.name)){const e=this._popupTemplate.fieldInfos.findIndex((e=>R(e.fieldName,i.name)));this._popupTemplate.fieldInfos.splice(e,1),this._expressionFields.remove(i),this._collection.remove(i),this._fieldNameToField.delete(i.name),g(this,"_expressionFieldsLength")}else this._schema._fields.remove(i);return i}reorder(e,i){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,i),this._collection.reorder(e,i),e}sort(e){return this._schema._fields.sort(e),this._collection.sort(((i,t)=>this._expressionFields.includes(i)&&this._expressionFields.includes(t)?0:this._expressionFields.includes(i)?1:this._expressionFields.includes(t)?-1:e(i,t))),this}findFieldByName(e){return this._fieldNameToField.get(e)}_generateExpressionFields(){if(!this._popupTemplate?.fieldInfos||!this._popupTemplate?.expressionInfos){for(const e of this._expressionFields)this._collection.remove(e),this._fieldNameToField.delete(e.name);return void this._expressionFields.removeAll()}const e=this._expressionFields.slice();for(const i of this._popupTemplate.fieldInfos){const t=A(i.fieldName);if(null==t)continue;const s=this._popupTemplate.expressionInfos.find((e=>R(e.name,t)));if(null==s)continue;let o=B.get(i);null==o&&(o=new l({name:i.fieldName,alias:i.label||s.title||i.fieldName,type:"number"===s.returnType?"double":"string",editable:!1})),this._expressionFields.includes(o)?e.remove(o):(B.set(i,o),this._expressionFields.add(o),this._collection.add(o),this._fieldNameToField.set(o.name,o),e.remove(o))}for(const i of e)this._expressionFields.remove(i),this._collection.remove(i),this._fieldNameToField.delete(i.name)}}class J extends h{get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}_schema;_uninitializedFieldExtensions=new Set;_onChangeSchemaFieldsHandle=new S((()=>this._schema.fields.on("change",(e=>{const i={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",i)}))));_onBeforeAddSchemaFieldsHandle=new S((()=>this._schema.fields.on("before-add",(e=>{this.emit("before-add",{...e,item:this._forField(e.item)})}))));_onBeforeRemoveSchemaFieldsHandle=new S((()=>this._schema.fields.on("before-remove",(e=>{this.emit("before-remove",{...e,item:this._forField(e.item)})}))));_onBeforeChangesSchemaFieldsHandle=new S((()=>this._schema.fields.on("before-changes",(e=>{this.emit("before-changes",{...e,item:this._forField(e.item)})}))));_onAfterAddSchemaFieldsHandle=new S((()=>this._schema.fields.on("after-add",(e=>{this.emit("after-add",{...e,item:this._forField(e.item)})}))));_onAfterRemoveSchemaFieldsHandle=new S((()=>this._schema.fields.on("after-remove",(e=>{this.emit("after-remove",{...e,item:this._forField(e.item)})}))));_onAfterChangesSchemaFieldsHandle=new S((()=>this._schema.fields.on("after-changes",(e=>{this.emit("after-changes",{...e,target:this})}))));constructor(e){super(),this._schema=e,this._handles.add(F(this,"length",(()=>y(this._schema.fields,"length",(()=>g(this,"length")),{sync:!0}))))}async destroy(){this._onChangeSchemaFieldsHandle.destroy(),this._onBeforeAddSchemaFieldsHandle.destroy(),this._onBeforeRemoveSchemaFieldsHandle.destroy(),this._onBeforeChangesSchemaFieldsHandle.destroy(),this._onAfterAddSchemaFieldsHandle.destroy(),this._onAfterRemoveSchemaFieldsHandle.destroy(),this._onAfterChangesSchemaFieldsHandle.destroy();const e=[];for(const i of this._schema.fields){const t=M.get(i);t&&t.schema===this._schema&&(M.delete(i),this._onRemoved(t),e.push(t.destroy()))}this._uninitializedFieldExtensions.forEach((i=>{this._onRemoved(i),e.push(i.destroy())})),this._uninitializedFieldExtensions.clear(),await Promise.all(e),super.destroy()}forField(e){if(T("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,i){if(T("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const t=M.get(e.field);if(M.set(e.field,e),t&&t!==e&&this._onRemoved(t),this._schema.fields.includes(e.field))if(void 0===i){const i={added:[e],moved:[],removed:t?[t]:[],target:this};this.emit("change",i),this.emit("after-add",{item:e}),this.emit("after-changes",{})}else this._schema.fields.reorder(e.field,i);else this._schema.fields.add(e.field,i)}else{this._uninitializedFieldExtensions.add(e);const i={added:[e],moved:[],removed:[],target:this};this.emit("change",i),this.emit("after-add",{item:e}),this.emit("after-changes",{})}return this._onAdded(e),this}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedFieldExtensions.has(i)){this._uninitializedFieldExtensions.delete(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e),this.emit("after-remove",{item:i}),this.emit("after-changes",{})}else this._schema.fields.remove(i.field);return this._onRemoved(i),i}}reorder(e,i){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,i),e}sort(e){return this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t)))),this}on(e,i){const t=[];return"change"===e?t.push(this._onChangeSchemaFieldsHandle.add()):"before-add"===e?t.push(this._onBeforeAddSchemaFieldsHandle.add()):"before-remove"===e?t.push(this._onBeforeRemoveSchemaFieldsHandle.add()):"before-changes"===e?t.push(this._onBeforeChangesSchemaFieldsHandle.add()):"after-add"===e?t.push(this._onAfterAddSchemaFieldsHandle.add()):"after-remove"===e?t.push(this._onAfterRemoveSchemaFieldsHandle.add()):"after-changes"===e&&t.push(this._onAfterChangesSchemaFieldsHandle.add()),t.push(super.on(e,i)),u(t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(M.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!M.has(e)){const i=new K({field:e});M.set(e,i),i._setSchema(this._schema),this._onAdded(i),i.initialize()}return M.get(e)}}
1
+ var e;import{__decorate as i}from"tslib";import t from"@arcgis/core/PopupTemplate";import s from"@arcgis/core/core/Collection";import l from"@arcgis/core/layers/support/FeatureType";import o from"@arcgis/core/layers/support/Field";import n from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError as d}from"../InvalidOperationError.js";import{isFieldExtension as r}from"../ItemType.js";import{jsonToGeometryType as a}from"../json/GeometryJson.js";import{InitializableCollectionProxy as h}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as m,isDefault as f,serializable as p,shouldExcludeDefaults as c}from"../support/Serializable.js";import{Settings as _}from"../support/Settings.js";import{createIHandle as u,notifyChange as g,onWatch as F,watch as y}from"../support/observableUtils.js";import{CaseInsensitiveObservableMap as x}from"../utilities/CaseInsensitiveObservableMap.js";import{CollectionProxy as v}from"../utilities/CollectionProxy.js";import{ReadOnlyCollection as b}from"../utilities/ReadOnlyCollection.js";import S from"../utilities/_ReferenceCountedHandle.js";import{checkArg as T}from"../utilities/checkArg.js";import{compare as w}from"../utilities/collection.js";import{isFeatureType as z,isField as I}from"../utilities/esri.js";import{fieldWithArcadeXRegex as N,fieldWithRelationshipRegex as E,getArcadeExpressionFromField as A}from"../utilities/field.js";import{ERR_TIME_ZONE_INVALID as j,isValidTimeZone as H}from"../utilities/format/date.js";import{objectKeys as C}from"../utilities/object.js";import{caseInsensitiveEquals as R}from"../utilities/string.js";import{_fieldExtensionMap as M,FieldExtension as K}from"./FieldExtension.js";const O=new Map;O.set("objectid","oid"),O.set("oid","oid"),O.set("fid","oid"),O.set("shape","geometry"),O.set("shape__length","double"),O.set("shape_length","double"),O.set("shape__area","double"),O.set("shape_area","double"),O.set("area","double"),O.set("perimeter","double"),O.set("length","double"),O.set("fnode_","double"),O.set("tnode_","double"),O.set("lpoly_","double"),O.set("rpoly_","double"),O.set("cover_","integer"),O.set("cover_id","integer"),O.set("idtic","integer"),O.set("xtic","double"),O.set("ytic","double"),O.set("xmin","double"),O.set("ymin","double"),O.set("xmax","double"),O.set("ymax","double"),O.set("arc_","double"),O.set("subclass_","integer"),O.set("subclass_id","integer"),O.set("routelink","integer"),O.set("arclink","integer"),O.set("f_meas","double"),O.set("t_meas","double"),O.set("f_pos","double"),O.set("t_pos","double"),O.set("f_meas","double"),O.set("globalid","global-id"),O.set("guid","guid");export{N as fieldWithArcadeXRegex,E as fieldWithRelationshipRegex};const B=new WeakMap;let P=e=class extends _{fieldExtensions;fields;_featureSettings;_alwaysSerializeFieldExtensions;_watchHandles=[];_primaryKeyField;get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){if(!this._primaryKeyField){const e=this._getSetting("primaryKeyField");if(e)this._primaryKeyField=e;else{const e=this.fields.filter((e=>"oid"===e.type));1===e.length&&(this._primaryKeyField=e.getItemAt(0).name)}}return this._primaryKeyField}set primaryKeyField(e){this._primaryKeyField=e,this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){T("timeZone",e).satisfies((e=>H(e)),j(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get subtypes(){return this._getCollectionSetting("subtypes")}get subtypeField(){return this._getSetting("subtypeField")}set subtypeField(e){this._setSetting("subtypeField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}constructor(e){super(e),this.fieldExtensions=new J(this),this.fields=new Z(this),this._primaryKeyField=void 0,this._handles.add(this.fields.on("before-changes",(()=>{this._primaryKeyField=void 0})))}static createFieldInfoFromField(e){let i=!0;const t=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||O.has(t)&&O.get(t)===e.type)&&(i=!1),new n({visible:i,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0,isEditable:e.editable})}destroy(){this.parent=void 0,this.fieldExtensions?.destroy(),this.fields?.destroy(),super.destroy()}findFieldByName(e){return this.fields.findFieldByName(e)}toJSON(e="all"){const i=m(this._getSerializableProperties(),this,e)||{};let t=i.fieldExtensions;this.parent&&(t=t?.filter((e=>{const i=this.parent;return!i?.fieldExtensions?.some((i=>i.id===e.id))})));const{fields:s}=i;if(i)for(const e of C(i))this.isModified(e)||delete i[e];if(s&&(i.fields=s),t?.length&&(i.fieldExtensions=t),!c(e)||!f(i))return i}createPopupTemplate(){const e=this.createAllFieldInfos();return new t({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((i=>e.createFieldInfoFromField(i)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=e?a(e):void 0}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial","project"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>e.toJSON())):void 0,deserialize:e=>{if(!e)return;const i=e.map((e=>I(e)?e:o.fromJSON(e)));w(this.fields,i,{onNew:(e,i)=>{this.fields.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.alias=i.alias,e.editable=i.editable,e.length=i.length,e.nullable=i.nullable,e.type=i.type),t!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,i)=>R(e.name,i.name)})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.toArray().map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))),deserialize:e=>{e&&w(this.fieldExtensions,e,{onNew:(e,i)=>{this.fieldExtensions.add(r(e)?e:new K(e),i)},onMatch:(e,i,t,s)=>{r(i)||e.assignProperties(i),t!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,i)=>r(i)?i===e:!(!i?.field||!K.matchesRef(e,i.field))||e.id===i.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const i=e.map((e=>z(e)||!e?e:l.fromJSON(e)));w(this.types,i,{onNew:(e,i)=>{this.types.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.name=i.name,e.templates=i.templates?[...i.templates]:[],e.domains=i.domains),t!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,i)=>e.id===i.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};P=e=i([p],P);export{P as Schema};export function schemaHasSubtypes(e){return!(!e.subtypeField||!e.subtypes?.length)}class Z extends v{_schema;_fieldNameToField=new x;_expressionFields=new s;_expressionFieldsReadOnly=new b(this._expressionFields);get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){return this._expressionFieldsReadOnly}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}constructor(e){super(new s),this._schema=e,this._handles.add(F(this,"length",(()=>y(this._schema,"_fields.length",(()=>g(this,"length")),{sync:!0})))),this._handles.add(y(this._schema,"_fields",(e=>{if(this._handles.remove("schema-field-collection-schema-fields"),null!=e){this._handles.add([e.on("after-add",(i=>{this._collection.add(i.item,e.indexOf(i.item)),null!=i.item.name&&this._fieldNameToField.set(i.item.name,i.item)})),e.on("after-remove",(e=>{this._collection.remove(e.item),null!=e.item.name&&this._fieldNameToField.delete(e.item.name)}))],"schema-field-collection-schema-fields");for(const i of this._collection)e.includes(i)||(this._collection.remove(i),null!=i.name&&this._fieldNameToField.delete(i.name));for(const i of e)this._collection.includes(i)||(this._collection.add(i),null!=i.name&&this._fieldNameToField.set(i.name,i))}else for(const e of this._collection.filter((e=>!this._expressionFields.includes(e))))this._collection.remove(e),null!=e.name&&this._fieldNameToField.delete(e.name)}),{sync:!0,initial:!0})),this._generateExpressionFields(),this._handles.add([y(this._schema,"_featureSettings.popupTemplate.fieldInfos",(()=>{this._generateExpressionFields()}),{sync:!0}),y(this._schema,"_featureSettings.popupTemplate.expressionInfos",(()=>{this._generateExpressionFields()}),{sync:!0})])}clone(){return new Z(this._schema)}add(e,i){T("field",e).isNotMissing();const t=A(e.name);if(t){if(!this._popupTemplate)throw new d("Cannot create a field that references an arcade expression without a feature source and popup template.");const i=this._popupTemplate.expressionInfos.find((e=>R(e.name,t)));if(!i)throw new d("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((i=>R(i.fieldName,e.name)));s||(s=new n({fieldName:e.name,label:i.title}),this._popupTemplate.fieldInfos.push(s));const l=B.get(s);B.set(s,e),null!=this._expressionFields&&(this._expressionFields.remove(l),this._expressionFields.includes(e)||(this._expressionFields.add(e),this._collection.add(e),null!=e.name&&this._fieldNameToField.set(e.name,e))),g(this,"_expressionFieldsLength")}else this._schema._fields.add(e,i);return this}destroy(){this._fieldNameToField.clear(),this._expressionFields.removeAll(),this._collection.removeAll(),super.destroy()}removeAt(e){T("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;if(A(i.name)){const e=this._popupTemplate.fieldInfos.findIndex((e=>R(e.fieldName,i.name)));this._popupTemplate.fieldInfos.splice(e,1),this._expressionFields.remove(i),this._collection.remove(i),null!=i.name&&this._fieldNameToField.delete(i.name),g(this,"_expressionFieldsLength")}else this._schema._fields.remove(i);return i}reorder(e,i){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,i),this._collection.reorder(e,i),e}sort(e){return this._schema._fields.sort(e),this._collection.sort(((i,t)=>this._expressionFields.includes(i)&&this._expressionFields.includes(t)?0:this._expressionFields.includes(i)?1:this._expressionFields.includes(t)?-1:e(i,t))),this}findFieldByName(e){return this._fieldNameToField.get(e)}_generateExpressionFields(){if(!this._popupTemplate?.fieldInfos||!this._popupTemplate?.expressionInfos){for(const e of this._expressionFields)this._collection.remove(e),null!=e.name&&this._fieldNameToField.delete(e.name);return void this._expressionFields.removeAll()}const e=this._expressionFields.slice();for(const i of this._popupTemplate.fieldInfos){const t=A(i.fieldName);if(null==t)continue;const s=this._popupTemplate.expressionInfos.find((e=>R(e.name,t)));if(null==s)continue;let l=B.get(i);null==l&&(l=new o({name:i.fieldName,alias:i.label||s.title||i.fieldName,type:"number"===s.returnType?"double":"string",editable:!1})),this._expressionFields.includes(l)?e.remove(l):(B.set(i,l),this._expressionFields.add(l),this._collection.add(l),null!=l.name&&this._fieldNameToField.set(l.name,l),e.remove(l))}for(const i of e)this._expressionFields.remove(i),this._collection.remove(i),null!=i.name&&this._fieldNameToField.delete(i.name)}}class J extends h{get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}_schema;_uninitializedFieldExtensions=new Set;_onChangeSchemaFieldsHandle=new S((()=>this._schema.fields.on("change",(e=>{const i={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",i)}))));_onBeforeAddSchemaFieldsHandle=new S((()=>this._schema.fields.on("before-add",(e=>{this.emit("before-add",{...e,item:this._forField(e.item)})}))));_onBeforeRemoveSchemaFieldsHandle=new S((()=>this._schema.fields.on("before-remove",(e=>{this.emit("before-remove",{...e,item:this._forField(e.item)})}))));_onBeforeChangesSchemaFieldsHandle=new S((()=>this._schema.fields.on("before-changes",(e=>{this.emit("before-changes",{...e,item:this._forField(e.item)})}))));_onAfterAddSchemaFieldsHandle=new S((()=>this._schema.fields.on("after-add",(e=>{this.emit("after-add",{...e,item:this._forField(e.item)})}))));_onAfterRemoveSchemaFieldsHandle=new S((()=>this._schema.fields.on("after-remove",(e=>{this.emit("after-remove",{...e,item:this._forField(e.item)})}))));_onAfterChangesSchemaFieldsHandle=new S((()=>this._schema.fields.on("after-changes",(e=>{this.emit("after-changes",{...e,target:this})}))));constructor(e){super(),this._schema=e,this._handles.add(F(this,"length",(()=>y(this._schema.fields,"length",(()=>g(this,"length")),{sync:!0}))))}async destroy(){this._onChangeSchemaFieldsHandle.destroy(),this._onBeforeAddSchemaFieldsHandle.destroy(),this._onBeforeRemoveSchemaFieldsHandle.destroy(),this._onBeforeChangesSchemaFieldsHandle.destroy(),this._onAfterAddSchemaFieldsHandle.destroy(),this._onAfterRemoveSchemaFieldsHandle.destroy(),this._onAfterChangesSchemaFieldsHandle.destroy();const e=[];for(const i of this._schema.fields){const t=M.get(i);t&&t.schema===this._schema&&(M.delete(i),this._onRemoved(t),e.push(t.destroy()))}this._uninitializedFieldExtensions.forEach((i=>{this._onRemoved(i),e.push(i.destroy())})),this._uninitializedFieldExtensions.clear(),await Promise.all(e),super.destroy()}forField(e){if(T("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,i){if(T("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const t=M.get(e.field);if(M.set(e.field,e),t&&t!==e&&this._onRemoved(t),this._schema.fields.includes(e.field))if(void 0===i){const i={added:[e],moved:[],removed:t?[t]:[],target:this};this.emit("change",i),this.emit("after-add",{item:e}),this.emit("after-changes",{})}else this._schema.fields.reorder(e.field,i);else this._schema.fields.add(e.field,i)}else{this._uninitializedFieldExtensions.add(e);const i={added:[e],moved:[],removed:[],target:this};this.emit("change",i),this.emit("after-add",{item:e}),this.emit("after-changes",{})}return this._onAdded(e),this}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedFieldExtensions.has(i)){this._uninitializedFieldExtensions.delete(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e),this.emit("after-remove",{item:i}),this.emit("after-changes",{})}else this._schema.fields.remove(i.field);return this._onRemoved(i),i}}reorder(e,i){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,i),e}sort(e){return this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t)))),this}on(e,i){const t=[];return"change"===e?t.push(this._onChangeSchemaFieldsHandle.add()):"before-add"===e?t.push(this._onBeforeAddSchemaFieldsHandle.add()):"before-remove"===e?t.push(this._onBeforeRemoveSchemaFieldsHandle.add()):"before-changes"===e?t.push(this._onBeforeChangesSchemaFieldsHandle.add()):"after-add"===e?t.push(this._onAfterAddSchemaFieldsHandle.add()):"after-remove"===e?t.push(this._onAfterRemoveSchemaFieldsHandle.add()):"after-changes"===e&&t.push(this._onAfterChangesSchemaFieldsHandle.add()),t.push(super.on(e,i)),u(t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(M.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!M.has(e)){const i=new K({field:e});M.set(e,i),i._setSchema(this._schema),this._onAdded(i),i.initialize()}return M.get(e)}}
@@ -27,11 +27,11 @@ export interface Relationship extends Entity, Serializable<RelationshipPropertie
27
27
  /**
28
28
  * The human-readable name for the relationship.
29
29
  */
30
- title: string;
30
+ title?: string;
31
31
  /**
32
32
  * The feature source that owns this relationship.
33
33
  */
34
- readonly source: FeatureSource;
34
+ readonly source?: FeatureSource;
35
35
  /**
36
36
  * The feature source with related data, if available.
37
37
  */
@@ -77,14 +77,14 @@ export type Cardinality = "one-to-one" | "one-to-many" | "many-to-one" | "many-t
77
77
  *
78
78
  * @param type The Geodatabase Relationship Cardinality type.
79
79
  */
80
- export declare function toEsriApiCardinality(type: string): Cardinality;
80
+ export declare function toEsriApiCardinality(type: Cardinality | GeodatabaseCardinality): Cardinality;
81
81
  /**
82
82
  * Converts ESRI JS API Relationship Cardinality type to the Geodatabase
83
83
  * Cardinality type.
84
84
  *
85
85
  * @param type The ESRI JS API Relationship Cardinality type.
86
86
  */
87
- export declare function fromEsriApiCardinality(type: string): GeodatabaseCardinality;
87
+ export declare function fromEsriApiCardinality(type: Cardinality | GeodatabaseCardinality): GeodatabaseCardinality;
88
88
  /**
89
89
  * Relationship cardinality type values for Geodatabase tables.
90
90
  */
@@ -1 +1 @@
1
- import{InvalidOperationError as n}from"../InvalidOperationError.js";import{assertNever as e}from"../utilities/checkArg.js";export var Relationship;!function(e){e.create=function(r){if(!e.factory)throw new n("Cannot create relationship: no relationship factory has been registered.");return e.factory.create(r)}}(Relationship||(Relationship={}));export function toEsriApiCardinality(n){if(!n)return;return!!t(n)?n:r(n,new Error("Unknown relationship cardinality type."))}export function fromEsriApiCardinality(n){if(!n)return;return!!r(n)?n:t(n,new Error("Unknown relationship cardinality type."))}function r(n,r){const t=n;switch(t){case"esriRelCardinalityOneToOne":return"one-to-one";case"esriRelCardinalityOneToMany":return"one-to-many";case"esriRelCardinalityManyToOne":return"many-to-one";case"esriRelCardinalityManyToMany":return"many-to-many";default:return e(t,r)}}function t(n,r){const t=n;switch(t){case"one-to-one":return"esriRelCardinalityOneToOne";case"one-to-many":return"esriRelCardinalityOneToMany";case"many-to-one":return"esriRelCardinalityManyToOne";case"many-to-many":return"esriRelCardinalityManyToMany";default:return e(t,r)}}
1
+ import{InvalidOperationError as n}from"../InvalidOperationError.js";export var Relationship;!function(e){e.create=function(r){if(!e.factory)throw new n("Cannot create relationship: no relationship factory has been registered.");return e.factory.create(r)}}(Relationship||(Relationship={}));export function toEsriApiCardinality(n){if(function(n){switch(n){case"one-to-one":case"one-to-many":case"many-to-one":case"many-to-many":return!0}}(n))return n;const e=function(n){switch(n){case"esriRelCardinalityOneToOne":return"one-to-one";case"esriRelCardinalityOneToMany":return"one-to-many";case"esriRelCardinalityManyToOne":return"many-to-one";case"esriRelCardinalityManyToMany":return"many-to-many"}}(n);if(!e)throw new Error("Unknown relationship cardinality type.");return e}export function fromEsriApiCardinality(n){if(function(n){switch(n){case"esriRelCardinalityOneToOne":case"esriRelCardinalityOneToMany":case"esriRelCardinalityManyToOne":case"esriRelCardinalityManyToMany":return!0}}(n))return n;const e=function(n){switch(n){case"one-to-one":return"esriRelCardinalityOneToOne";case"one-to-many":return"esriRelCardinalityOneToMany";case"many-to-one":return"esriRelCardinalityManyToOne";case"many-to-many":return"esriRelCardinalityManyToMany"}}(n);if(!e)throw new Error("Unknown relationship cardinality type.");return e}
@@ -1 +1 @@
1
- import e from"@arcgis/core/Color.js";import r from"@arcgis/core/geometry/Extent.js";import o from"@arcgis/core/geometry/SpatialReference.js";import t from"@arcgis/core/layers/MapImageLayer";import n from"@arcgis/core/renderers/SimpleRenderer.js";import l from"@arcgis/core/renderers/UniqueValueRenderer";import i from"@arcgis/core/symbols/Font.js";import a from"@arcgis/core/symbols/TextSymbol.js";import{getDefaultSymbol as s}from"../convert.js";let y=0,m="";export function createLpkxLayer(e,i,a){const s=a,y=e.lyrxJson.layerDefinitions,f=e.createdFeatureClasses.split(";"),p=y.flatMap(((r,o)=>{if("CIMGroupLayer"===r.type)return[];const t=function(e){if(!e)return;if("CIMSimpleRenderer"===e.type){const r=c(e.symbol?.symbol);if(!r)return;return new n({symbol:r})}if("CIMUniqueValueRenderer"===e.type){const r=e.fields?.[0];if(!r)return;const o=[];return e.groups?.forEach((e=>{e.classes?.forEach((e=>{const r=c(e.symbol?.symbol);r&&e.values?.forEach((e=>{o.push({value:e.fieldValues?.[0],symbol:r})}))}))})),new l({field:r,uniqueValueInfos:o})}return}(r.renderer),i=r.featureTable?.dataConnection?.dataset,a=f.find((e=>e.endsWith(`_${i}`)));return[{id:o,title:r.name,source:{type:"data-layer",dataSource:{type:"table",workspaceId:e.workspaceId,dataSourceName:a,gdbVersion:""}},renderer:t,labelingInfo:u(r,m),showLabels:!0,geometryType:m}]}));p.sort(((e,r)=>{const o=e=>"point"===e?0:"polyline"===e?1:"polygon"===e?2:3;return o(e.geometryType)-o(r.geometryType)}));const b=(i instanceof File?i.name:"lpkx-layer").replace(/[^a-zA-Z0-9_.-]/g,"_"),d=e.bbox||[],g=new r({xmin:d[0],ymin:d[1],xmax:d[2],ymax:d[3],spatialReference:new o({wkid:Number(e.outCrs||o.WebMercator)})});return new t({title:b,url:s,sublayers:p.reverse(),visible:!0,fullExtent:g})}function c(e){if(e)return"CIMPolygonSymbol"===e.type?(m="polygon",function(e){return{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:e.symbolLayers??[]}}}}(e)):"CIMLineSymbol"===e.type?(m="polyline",function(e){return{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:e.symbolLayers??[]}}}}(e)):"CIMPointSymbol"===e.type?(m="point",function(e){return{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:e.symbolLayers}}}}(e)):void 0}function u(e,r){return(e.labelClasses??[]).map((o=>{const t=(n=o.textSymbol?.symbol,n&&"object"==typeof n&&"CIMTextSymbol"===n.type?n:void 0);var n;return{labelExpression:p(o,e),labelPlacement:f(r),where:o.whereClause??"",minScale:o.minScale??0,maxScale:o.maxScale??0,symbol:new a({color:b(t)??s(y++,"polygon").color,haloSize:h(t),haloColor:I(t),kerning:C(t?.kerning),...S(t),font:g(t)})}}))}function f(e){return"point"===e||"Points"===e?"above-right":"polyline"===e||"Polylines"===e?"center-along":"polygon"===e||"Polygons"===e?"always-horizontal":"above-right"}function p(e,r){return e.expression??`$feature.${r.displayField}`}function b(e){const r=e?.symbol?.symbolLayers?.find((e=>"CIMSolidFill"===e.type)),o=r;return d(o?.color)}function d(r){if(!r)return;let o;if(Array.isArray(r))o=r;else{const e=r.values;if(!e)return;"function"==typeof e?o=Array.from(e()):Array.isArray(e)?o=e:Symbol.iterator in Object(e)&&(o=Array.from(e))}if(!o)return;if("CIMHSVColor"===(Array.isArray(r)?void 0:r.type)){let[r=0,t=0,n=0,l=100]=o;t/=100,n/=100;const i=n*(1-t/2),a=0===i||1===i?0:(n-i)/Math.min(i,1-i),s=new e(`hsla(${r}, ${100*a}%, ${100*i}%, ${l/100})`);return[s.r,s.g,s.b,s.a]}return o}function g(e){const r=e?.fontStyleName??"";return new i({family:e?.fontFamilyName,size:e?.height,weight:r.includes("Bold")?"bold":"normal",style:r.includes("Italic")?"italic":"normal"})}function S(e){return{horizontalAlignment:e?.horizontalAlignment?.toLowerCase(),verticalAlignment:e?.verticalAlignment?.toLowerCase()}}function C(e){return"boolean"==typeof e?e:void 0}function h(e){const r=e?.haloSize;if(null==r)return;const o="string"==typeof r?parseFloat(r):Number(r);return Number.isFinite(o)?o:void 0}function I(e){const r=e?.haloSymbol,o=r?.symbolLayers?.find((e=>"CIMSolidFill"===e.type)),t=o;return d(t?.color)}
1
+ import e from"@arcgis/core/Color.js";import r from"@arcgis/core/geometry/Extent.js";import o from"@arcgis/core/geometry/SpatialReference.js";import t from"@arcgis/core/layers/MapImageLayer";import n from"@arcgis/core/renderers/SimpleRenderer.js";import l from"@arcgis/core/renderers/UniqueValueRenderer";import i from"@arcgis/core/symbols/Font.js";import a from"@arcgis/core/symbols/TextSymbol.js";import{getDefaultSymbol as s}from"../convert.js";let y=0,m="";export function createLpkxLayer(e,i,b){const h=b,x=e.lyrxJson.layerDefinitions,M=e.createdFeatureClasses.split(";"),w=x.flatMap(((r,o)=>{if("CIMGroupLayer"===r.type)return[];const t="CIMAnnotationLayer"===r.type;let i;t?m="point":i=function(e){if(!e)return;if("CIMSimpleRenderer"===e.type){const r=c(e.symbol?.symbol);if(!r)return;return new n({symbol:r})}if("CIMUniqueValueRenderer"===e.type){const r=e.fields?.[0];if(!r)return;const o=[];return e.groups?.forEach((e=>{e.classes?.forEach((e=>{const r=c(e.symbol?.symbol);r&&e.values?.forEach((e=>{o.push({value:e.fieldValues?.[0],symbol:r})}))}))})),new l({field:r,uniqueValueInfos:o})}return}(r.renderer);const b=r.featureTable?.dataConnection?.dataset,h=M.find((e=>e.endsWith(`_${b}`)));let x=function(e,r){return(e.labelClasses??[]).map((o=>{const t=(n=o.textSymbol?.symbol,n&&"object"==typeof n&&"CIMTextSymbol"===n.type?n:void 0);var n;return{labelExpression:p(o,e),labelPlacement:u(r),where:o.whereClause??"",minScale:o.minScale??0,maxScale:o.maxScale??0,symbol:new a({color:f(t)??s(y++,"polygon").color,haloSize:C(t),haloColor:I(t),kerning:S(t?.kerning),...g(t),font:d(t)})}}))}(r,m);if(t&&(!x||0===x.length)){x=[{labelExpressionInfo:{expression:`$feature.${r.displayField??r.featureTable?.displayField??"TextString"}`},labelPlacement:u("point")}]}return[{id:o,title:r.name,source:{type:"data-layer",dataSource:{type:"table",workspaceId:e.workspaceId,dataSourceName:h,gdbVersion:""}},renderer:i,labelingInfo:x,labelsVisible:t,opacity:t?0:1,geometryType:m}]}));w.sort(((e,r)=>{const o=e=>"point"===e?0:"polyline"===e?1:"polygon"===e?2:3;return o(e.geometryType)-o(r.geometryType)}));const L=(i instanceof File?i.name:"lpkx-layer").replace(/[^a-zA-Z0-9_.-]/g,"_"),v=e.bbox||[],A=new r({xmin:v[0],ymin:v[1],xmax:v[2],ymax:v[3],spatialReference:new o({wkid:Number(e.outCrs||o.WebMercator)})});return new t({title:L,url:h,sublayers:w.reverse(),visible:!0,fullExtent:A})}function c(e){if(e)return"CIMPolygonSymbol"===e.type?(m="polygon",function(e){return{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:e.symbolLayers??[]}}}}(e)):"CIMLineSymbol"===e.type?(m="polyline",function(e){return{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:e.symbolLayers??[]}}}}(e)):"CIMPointSymbol"===e.type?(m="point",function(e){return{type:"cim",data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:e.symbolLayers}}}}(e)):void 0}function u(e){return"point"===e||"Points"===e?"above-right":"polyline"===e||"Polylines"===e?"center-along":"polygon"===e||"Polygons"===e?"always-horizontal":"above-right"}function p(e,r){return e.expression??`$feature.${r.displayField}`}function f(e){const r=e?.symbol?.symbolLayers?.find((e=>"CIMSolidFill"===e.type)),o=r;return b(o?.color)}function b(r){if(!r)return;let o;if(Array.isArray(r))o=r;else{const e=r.values;if(!e)return;"function"==typeof e?o=Array.from(e()):Array.isArray(e)?o=e:Symbol.iterator in Object(e)&&(o=Array.from(e))}if(!o)return;if("CIMHSVColor"===(Array.isArray(r)?void 0:r.type)){let[r=0,t=0,n=0,l=100]=o;t/=100,n/=100;const i=n*(1-t/2),a=0===i||1===i?0:(n-i)/Math.min(i,1-i),s=new e(`hsla(${r}, ${100*a}%, ${100*i}%, ${l/100})`);return[s.r,s.g,s.b,s.a]}return o}function d(e){const r=e?.fontStyleName??"";return new i({family:e?.fontFamilyName,size:e?.height,weight:r.includes("Bold")?"bold":"normal",style:r.includes("Italic")?"italic":"normal"})}function g(e){return{horizontalAlignment:e?.horizontalAlignment?.toLowerCase(),verticalAlignment:e?.verticalAlignment?.toLowerCase()}}function S(e){return"boolean"==typeof e?e:void 0}function C(e){const r=e?.haloSize;if(null==r)return;const o="string"==typeof r?parseFloat(r):Number(r);return Number.isFinite(o)?o:void 0}function I(e){const r=e?.haloSymbol,o=r?.symbolLayers?.find((e=>"CIMSolidFill"===e.type)),t=o;return b(t?.color)}
@@ -98,6 +98,10 @@ export interface LyrxLayerDefinition {
98
98
  * The name of the layer.
99
99
  */
100
100
  name: "Points" | "Polylines" | "Polygons";
101
+ /**
102
+ * The type of the layer.
103
+ */
104
+ type?: "CIMGroupLayer" | "CIMAnnotationLayer" | "CIMFeatureLayer";
101
105
  /**
102
106
  * The renderer configuration for the layer.
103
107
  */
@@ -117,6 +121,10 @@ export interface LyrxLayerDefinition {
117
121
  dataConnection?: {
118
122
  dataset?: string;
119
123
  };
124
+ /**
125
+ * The display field for the feature table.
126
+ */
127
+ displayField?: string;
120
128
  };
121
129
  }
122
130
  /**
@@ -53,21 +53,21 @@ declare module "@arcgis/core/support/arcadeUtils" {
53
53
  unknownBoolean: true,
54
54
  variables: string[]
55
55
  ): Promise<void>;
56
- export function getViewInfo(params: { spatialReference: __esri.SpatialReference }): ArcadeViewInfo;
56
+ export function getViewInfo(params: { spatialReference?: __esri.SpatialReference }): ArcadeViewInfo;
57
57
  export function createFunction(syntaxTree: __esri.ArcadeScript, context: ArcadeContext): ArcadeFunction;
58
58
  export function executeAsyncFunction(arcadeFunction: ArcadeFunction, context: ArcadeContext): Promise<string>;
59
59
  export function createExecContext(graphic: Graphic, info: ArcadeViewInfo): ArcadeContext;
60
60
  export function convertMapToFeatureSetCollection(args: {
61
61
  map: __esri.Map;
62
- spatialReference: __esri.SpatialReference;
62
+ spatialReference?: __esri.SpatialReference;
63
63
  }): FeatureSetCollection;
64
64
  export function convertFeatureLayerToFeatureSet(args: {
65
65
  layer: __esri.Layer | __esri.Sublayer;
66
- spatialReference: __esri.SpatialReference;
66
+ spatialReference?: __esri.SpatialReference;
67
67
  }): FeatureSetCollection;
68
68
  export function convertServiceUrlToWorkspace(args: {
69
69
  url: string;
70
- spatialReference: __esri.SpatialReference;
70
+ spatialReference?: __esri.SpatialReference;
71
71
  }): FeatureSetCollection;
72
72
  }
73
73
 
@@ -144,11 +144,11 @@ declare module "@arcgis/core/views/draw/support/drawUtils" {
144
144
  declare namespace __esri {
145
145
  export interface ArcadeScript {
146
146
  // Enable async Arcade within the script.
147
- isAsync: boolean | number;
147
+ isAsync?: boolean | number;
148
148
  // Enable the use of FeatureSets within the script.
149
- usesFeatureSet: boolean | number;
149
+ usesFeatureSet?: boolean | number;
150
150
  // Enable the use of FeatureSets within the script.
151
- usesGeometry: boolean | number;
151
+ usesGeometry?: boolean | number;
152
152
  }
153
153
 
154
154
  export interface MapNotesSublayer extends __esri.GraphicsLayer {