@vertigis/arcgis-extensions 38.0.3 → 38.0.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import TextContent from"@arcgis/core/popup/content/TextContent.js";import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isMenu,isRelationship}from"../ItemType.js";import{NotFoundError}from"../NotFoundError.js";import{FeatureReadOptions}from"../data/FeatureSource.js";import{Menu}from"../menus/Menu.js";import{initializeCollection}from"../support/InitializableBase.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{first}from"../utilities/asyncIterable.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{getLogger}from"../utilities/log.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";import{TaskSettings}from"./TaskSettings.js";import{Relationship}from"./_Relationship.js";const ERR_GET_FEATURES_NOT_SUPPORTED="Querying features is not supported.",ERR_ADD_FEATURES_NOT_SUPPORTED="Adding features is not supported.",ERR_ADD_ATTACHMENTS_NOT_SUPPORTED="Adding attachments is not supported.",ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED="Deleting attachments is not supported.",ERR_UPDATE_FEATURES_NOT_SUPPORTED="Updating features is not supported.",ERR_DELETE_FEATURES_NOT_SUPPORTED="Deleting features is not supported.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsAttachmentEditing:!1}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(t){super(t),this.featureSettings=this._createAndSetupFeatureSettings(),this.taskSettings=this._createTaskSettings(),this.schema=this._createAndSetupSchema(),this.relationships=this._createRelationships(),this.hyperlinks=this._createHyperlinks()}get featureActions(){return this._featureActions}set featureActions(t){this._featureActions=t,t&&this.isInitialized&&!t.isInitialized&&(async()=>{try{await t.initialize()}catch(t){t instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:t})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(t){return checkArg("feature",t).isNotMissing(),await this.initialize(),this._getAttachments(t)}async addAttachment(t,e){if(checkArg("feature",t).isNotMissing(),checkArg("attachment",e).isNotMissing(),t.source&&t.source!==this)throw new ArgumentError("feature",`Cannot add an attachment to a feature not of this source (${this.title??this.id})`);return await this.initialize(),this._addAttachment(t,e)}async deleteAttachments(t,e){if(checkArg("feature",t).isNotMissing(),checkArg("attachmentIds",e).isNotMissing(),t.source&&t.source!==this)throw new ArgumentError("feature",`Cannot delete attachments from a feature not of this source (${this.title??this.id})`);await this.initialize(),await this._deleteAttachments(t,e)}async getFeature(t,e){checkArg("id",t).isNotMissing();const i=this.getFeatures([t],e),s=await first(i);if(!s)throw new NotFoundError("No feature exists with ID '{0}'.",t);return s}getFeatures(t,e){checkArg("ids",t).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(t,{...FeatureReadOptions.DEFAULTS,...FeatureReadOptions.fromFeatureSource(i),...e})}()}async addFeature(t,e){checkArg("feature",t).isNotMissing(),await this.addFeatures([t])}async addFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED);await this._addFeatures(t,e)}async updateFeature(t,e){checkArg("feature",t).isNotMissing(),await this.updateFeatures([t])}async updateFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED);await this._updateFeatures(t,e)}async deleteFeature(t,e){checkArg("feature",t).isNotMissing(),await this.deleteFeatures([t])}async deleteFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED);const i=[];for(const e of t)i.push("string"==typeof e?e:e.primaryKey);await this._deleteFeatures(i,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:t=>{if(!t)return!0;if(t.constructor===Object){if(!Object.keys(t).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serializeModes:["initial"],serialize:t=>this.relationships?this.relationships.filter((t=>"ArcGISRelationship"!==t.relationshipType)).toArray():[],deserialize:t=>{compare(this.relationships,t,{onNew:t=>{isRelationship(t)?this.relationships.add(t):this.relationships.add(Relationship.create(t))},onMatch:(t,e)=>{isRelationship(t)&&t.assignProperties({title:e.title})},onMissing:t=>{"ArcGISRelationship"!==t.relationshipType&&this.relationships.remove(t)},equals:(t,e)=>t.id===e.id})},default:[]},hyperlinks:{serialize:!1,deserialize:t=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(t.map((t=>t instanceof Hyperlink?t:new Hyperlink(t))))}},featureActions:{serializeModes:["initial"],deserialize:t=>{t?isMenu(t)?this.featureActions=t:this.featureActions?this.featureActions.assignProperties(t):this.featureActions=Menu.create(t):this.featureActions=void 0}}}}*_initializableChildCollections(){yield*super._initializableChildCollections(),yield this.schema.fieldExtensions}async _onInitialize(){await super._onInitialize(),this.featureActions&&await this.featureActions.initialize()}async _postInitialize(){await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate(),this.featureSettings._isDefaultPopupTemplate=!0);const{popupTemplate:t}=this.featureSettings;"function"==typeof t.content&&(t.content=t.content()),t.content=await t.content,"string"==typeof t.content&&(t.content=[new TextContent({text:t.content})]),!t.title&&this.schema.displayField&&(t.title=`{${this.schema.displayField}}`),await initializeCollection(this.featureSettings.popupContentExtensions,{target:this,onInitializeWarning:t=>this.emit("initializeWarning",t)})}_createSchema(){return new Schema}_createFeatureSettings(){return new FeatureSettings}_createTaskSettings(){return new TaskSettings}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new Collection}async _getAttachments(t){return[]}async _addAttachment(t,e){throw new InvalidOperationError(ERR_ADD_ATTACHMENTS_NOT_SUPPORTED)}async _deleteAttachments(t,e){throw new InvalidOperationError(ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED)}_getFeatures(t,e){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=t.map((t=>`${i} = ${t}`)).join(" OR ");return this.queryService.query(this,s,e)}throw new InvalidOperationError(ERR_GET_FEATURES_NOT_SUPPORTED)}_addFeatures(t,e){throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED)}_updateFeatures(t,e){throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED)}_deleteFeatures(t,e){throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED)}_capabilities(){return DEFAULT_CAPABILITIES}_isRelationship(t){return"function"==typeof t.getRelatedFeatures}_createAndSetupSchema(){const t=this._createSchema();return t._featureSettings=this.featureSettings,t}_createAndSetupFeatureSettings(){const t=this._createFeatureSettings();return t._setFeatureSource(this),t}}export class RelationshipCollection extends CollectionProxy{constructor(t){super(new Collection),this._source=t}add(t,e){return checkArg("relationship",t).isNotMissing(),t.source&&t.source.relationships.remove(t),isRelationship(t)&&t._setSource(this._source),super.add(t,e)}removeAt(t){const e=super.removeAt(t);return isRelationship(e)&&e._setSource(void 0),e}}
|
|
1
|
+
import TextContent from"@arcgis/core/popup/content/TextContent.js";import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isMenu,isRelationship}from"../ItemType.js";import{NotFoundError}from"../NotFoundError.js";import{FeatureReadOptions}from"../data/FeatureSource.js";import{Menu}from"../menus/Menu.js";import{initializeCollection}from"../support/InitializableBase.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{first}from"../utilities/asyncIterable.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{getLogger}from"../utilities/log.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";import{TaskSettings}from"./TaskSettings.js";import{Relationship}from"./_Relationship.js";const ERR_GET_FEATURES_NOT_SUPPORTED="Querying features is not supported.",ERR_ADD_FEATURES_NOT_SUPPORTED="Adding features is not supported.",ERR_ADD_ATTACHMENTS_NOT_SUPPORTED="Adding attachments is not supported.",ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED="Deleting attachments is not supported.",ERR_UPDATE_FEATURES_NOT_SUPPORTED="Updating features is not supported.",ERR_DELETE_FEATURES_NOT_SUPPORTED="Deleting features is not supported.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsAttachmentEditing:!1}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(t){super(t),this.featureSettings=this._createAndSetupFeatureSettings(),this.taskSettings=this._createTaskSettings(),this.schema=this._createAndSetupSchema(),this.relationships=this._createRelationships(),this.hyperlinks=this._createHyperlinks()}get featureActions(){return this._featureActions}set featureActions(t){this._featureActions=t,t&&this.isInitialized&&!t.isInitialized&&(async()=>{try{await t.initialize()}catch(t){t instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:t})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(t){return checkArg("feature",t).isNotMissing(),await this.initialize(),this._getAttachments(t)}async addAttachment(t,e){if(checkArg("feature",t).isNotMissing(),checkArg("attachment",e).isNotMissing(),t.source&&t.source!==this)throw new ArgumentError("feature",`Cannot add an attachment to a feature not of this source (${this.title??this.id})`);return await this.initialize(),this._addAttachment(t,e)}async deleteAttachments(t,e){if(checkArg("feature",t).isNotMissing(),checkArg("attachmentIds",e).isNotMissing(),t.source&&t.source!==this)throw new ArgumentError("feature",`Cannot delete attachments from a feature not of this source (${this.title??this.id})`);await this.initialize(),await this._deleteAttachments(t,e)}async getFeature(t,e){checkArg("id",t).isNotMissing();const i=this.getFeatures([t],e),s=await first(i);if(!s)throw new NotFoundError("No feature exists with ID '{0}'.",t);return s}getFeatures(t,e){checkArg("ids",t).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(t,{...FeatureReadOptions.DEFAULTS,...FeatureReadOptions.fromFeatureSource(i),...e})}()}async addFeature(t,e){checkArg("feature",t).isNotMissing(),await this.addFeatures([t])}async addFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED);await this._addFeatures(t,e)}async updateFeature(t,e){checkArg("feature",t).isNotMissing(),await this.updateFeatures([t])}async updateFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED);await this._updateFeatures(t,e)}async deleteFeature(t,e){checkArg("feature",t).isNotMissing(),await this.deleteFeatures([t])}async deleteFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED);const i=[];for(const e of t)i.push("string"==typeof e?e:e.primaryKey);await this._deleteFeatures(i,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:t=>{if(!t)return!0;if(t.constructor===Object){if(!Object.keys(t).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serializeModes:["initial"],serialize:t=>this.relationships?this.relationships.filter((t=>"ArcGISRelationship"!==t.relationshipType)).toArray():[],deserialize:t=>{compare(this.relationships,t,{onNew:t=>{isRelationship(t)?this.relationships.add(t):this.relationships.add(Relationship.create(t))},onMatch:(t,e)=>{isRelationship(t)&&t.assignProperties({title:e.title})},onMissing:t=>{"ArcGISRelationship"!==t.relationshipType&&this.relationships.remove(t)},equals:(t,e)=>t.id===e.id})},default:[]},hyperlinks:{serialize:!1,deserialize:t=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(t.map((t=>t instanceof Hyperlink?t:new Hyperlink(t))))}},featureActions:{serializeModes:["initial"],deserialize:t=>{t?isMenu(t)?this.featureActions=t:this.featureActions?this.featureActions.assignProperties(t):this.featureActions=Menu.create(t):this.featureActions=void 0}}}}*_initializableChildCollections(){yield*super._initializableChildCollections(),yield this.schema.fieldExtensions}async _onInitialize(){await super._onInitialize(),this.featureActions&&await this.featureActions.initialize()}async _postInitialize(){await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate(),this.featureSettings._isDefaultPopupTemplate=!0);const{popupTemplate:t}=this.featureSettings;"function"==typeof t.content&&(t.content=t.content()),t.content=await t.content,"string"==typeof t.content&&(t.content=[new TextContent({text:t.content})]),!t.title&&this.schema.displayField&&(t.title=`{${this.schema.displayField}}`),await initializeCollection(this.featureSettings.popupContentExtensions,{target:this,onInitializeWarning:t=>this.emit("initializeWarning",t)}),await Promise.all(this.relationships.toArray().map((t=>t.relatedSource?.initialize())))}_createSchema(){return new Schema}_createFeatureSettings(){return new FeatureSettings}_createTaskSettings(){return new TaskSettings}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new Collection}async _getAttachments(t){return[]}async _addAttachment(t,e){throw new InvalidOperationError(ERR_ADD_ATTACHMENTS_NOT_SUPPORTED)}async _deleteAttachments(t,e){throw new InvalidOperationError(ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED)}_getFeatures(t,e){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=t.map((t=>`${i} = ${t}`)).join(" OR ");return this.queryService.query(this,s,e)}throw new InvalidOperationError(ERR_GET_FEATURES_NOT_SUPPORTED)}_addFeatures(t,e){throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED)}_updateFeatures(t,e){throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED)}_deleteFeatures(t,e){throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED)}_capabilities(){return DEFAULT_CAPABILITIES}_isRelationship(t){return"function"==typeof t.getRelatedFeatures}_createAndSetupSchema(){const t=this._createSchema();return t._featureSettings=this.featureSettings,t}_createAndSetupFeatureSettings(){const t=this._createFeatureSettings();return t._setFeatureSource(this),t}}export class RelationshipCollection extends CollectionProxy{constructor(t){super(new Collection),this._source=t}add(t,e){return checkArg("relationship",t).isNotMissing(),t.source&&t.source.relationships.remove(t),isRelationship(t)&&t._setSource(this._source),super.add(t,e)}removeAt(t){const e=super.removeAt(t);return isRelationship(e)&&e._setSource(void 0),e}}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<li><a href="../modules/version.html">version</a></li>
|
|
17
17
|
<li><a href="version.version.html">version</a></li></ul>
|
|
18
18
|
<h1>Variable version<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
19
|
-
<div class="tsd-signature">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"38.0.
|
|
19
|
+
<div class="tsd-signature">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"38.0.5"</span><span class="tsd-signature-symbol"> = "38.0.5"</span></div>
|
|
20
20
|
<div class="tsd-comment tsd-typography"><p>The current version of the Geocortex ArcGIS Extensions API.</p>
|
|
21
21
|
</div></div>
|
|
22
22
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Query from"@arcgis/core/rest/support/Query";import{executeQuery,executeCountByQuery}from"../../support/_query.js";import{isFeatureLayer}from"../../utilities/layers.js";import{QueryProviderBase}from"./QueryProviderBase.js";export class ArcGISServiceTableQueryProvider extends QueryProviderBase{isSupported(e){const{table:r}=e;return isFeatureLayer(r)&&e.capabilities.supportsQuery}_query(e,r,t){const{table:u}=e,s=u.createQuery();return s.where=r,s.outFields=t.outFields,s.num=t.maxResults,executeQuery(s,e,u,t.cancelToken)}_count(e,r,t){const{table:u}=e,s=new Query({returnGeometry:!1});return s.where=r,s.num=t.maxResults,executeCountByQuery(s,e,u,t.cancelToken)}}
|
|
1
|
+
import Query from"@arcgis/core/rest/support/Query";import{executeQuery,executeCountByQuery}from"../../support/_query.js";import{isFeatureLayer}from"../../utilities/layers.js";import{QueryProviderBase}from"./QueryProviderBase.js";export class ArcGISServiceTableQueryProvider extends QueryProviderBase{isSupported(e){const{table:r}=e;return isFeatureLayer(r)&&e.capabilities.supportsQuery}_query(e,r,t){const{table:u}=e,s=u.createQuery();return s.where=r,s.outFields=t.outFields,u.capabilities?.query?.supportsPagination&&(s.num=t.maxResults),executeQuery(s,e,u,t.cancelToken)}_count(e,r,t){const{table:u}=e,s=new Query({returnGeometry:!1});return s.where=r,u.capabilities?.query?.supportsPagination&&(s.num=t.maxResults),executeCountByQuery(s,e,u,t.cancelToken)}}
|
package/version.d.ts
CHANGED
package/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version="38.0.
|
|
1
|
+
export const version="38.0.5";
|