@vertigis/arcgis-extensions 34.5.0 → 34.6.0

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 (72) hide show
  1. package/data/support/attachments.js +1 -1
  2. package/declarations/arcgis-js-api-extensions/index.d.ts +1 -0
  3. package/docs/html/assets/search.js +1 -1
  4. package/docs/html/classes/data_FeatureStream.FeatureStream.html +1 -1
  5. package/docs/html/classes/mapping_BuildingSceneLayerExtension.BuildingSceneLayerReadOnlySchema.html +3 -3
  6. package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerSchema.html +4 -4
  7. package/docs/html/classes/mapping_StreamLayerExtension.StreamLayerSchema.html +4 -4
  8. package/docs/html/classes/mapping_TileLayerExtension.TileLayerExtension.html +13 -13
  9. package/docs/html/classes/mapping_WMTSLayerExtension.WMTSLayerExtension.html +12 -12
  10. package/docs/html/classes/mapping__LayerExtension.ArrayWrappedCollection.html +2 -2
  11. package/docs/html/classes/mapping__LayerExtension.LayerExtensionSchema.html +5 -5
  12. package/docs/html/classes/mapping_support_LayerListSettings.ExtensionBaseLayerListSettings.html +9 -9
  13. package/docs/html/classes/utilities_asyncIterable.AsyncQueue.html +1 -1
  14. package/docs/html/enums/support_esri.WellKnownBasemap.html +1 -1
  15. package/docs/html/interfaces/data__TableExtension.TableProperties.html +1 -1
  16. package/docs/html/interfaces/data_support_attachments.AttachmentEnabledLayer.html +4 -2
  17. package/docs/html/interfaces/mapping_FeatureLayerExtension.FeatureLayerProperties.html +1 -1
  18. package/docs/html/interfaces/mapping_FeatureLayerExtensionBase.FeatureLayerBaseProperties.html +1 -1
  19. package/docs/html/interfaces/mapping_TileLayerExtension.TileLayerExtensionProperties.html +1 -1
  20. package/docs/html/interfaces/mapping_TileLayerExtension.TileLayerProperties.html +1 -1
  21. package/docs/html/interfaces/mapping_WMTSLayerExtension.WMTSLayerExtensionProperties.html +2 -2
  22. package/docs/html/interfaces/mapping_WMTSLayerExtension.WMTSSublayerExtensionCollection.html +3 -3
  23. package/docs/html/interfaces/portal_FeatureLayer.FeatureLayer-1.html +1 -1
  24. package/docs/html/interfaces/portal_FormInfo.FormAttachmentElement.html +8 -8
  25. package/docs/html/interfaces/portal_FormInfo.FormBarcodeScannerInput.html +4 -4
  26. package/docs/html/interfaces/portal_FormInfo.FormComboBoxInput.html +4 -4
  27. package/docs/html/interfaces/portal_FormInfo.FormDateTimePickerInput.html +5 -5
  28. package/docs/html/interfaces/portal_FormInfo.FormExpressionInfo.html +5 -5
  29. package/docs/html/interfaces/portal_FormInfo.FormFieldElement.html +10 -10
  30. package/docs/html/interfaces/portal_FormInfo.FormGroupElement.html +7 -7
  31. package/docs/html/interfaces/portal_FormInfo.FormInfo-1.html +13 -0
  32. package/docs/html/interfaces/portal_FormInfo.FormRadioButtonsInput.html +4 -4
  33. package/docs/html/interfaces/portal_FormInfo.FormRelationshipElement.html +8 -8
  34. package/docs/html/interfaces/portal_FormInfo.FormSwitchInput.html +4 -4
  35. package/docs/html/interfaces/portal_FormInfo.FormTextAreaInput.html +4 -4
  36. package/docs/html/interfaces/portal_FormInfo.FormTextBoxInput.html +4 -4
  37. package/docs/html/interfaces/portal_MapServiceLayer.MapServiceLayer-1.html +7 -7
  38. package/docs/html/interfaces/portal_StreamLayer.StreamLayer-1.html +1 -1
  39. package/docs/html/interfaces/portal_Table.Table.html +1 -1
  40. package/docs/html/interfaces/support_esri.AccessorLike.html +4 -4
  41. package/docs/html/interfaces/support_esri.ChangeEvent.html +4 -4
  42. package/docs/html/interfaces/support_esri.LayerWithSublayers.html +1 -1
  43. package/docs/html/interfaces/support_esri.PointCloudLayerCachedStatistics.html +1 -1
  44. package/docs/html/interfaces/support_esri.PointCloudLayerCachedStatisticsFrequentValues.html +1 -1
  45. package/docs/html/interfaces/support_esri.PointCloudLayerCachedStatisticsHistogram.html +1 -1
  46. package/docs/html/interfaces/support_esri.PointCloudLayerCachedStatisticsLabel.html +1 -1
  47. package/docs/html/interfaces/support_esri.PointCloudLayerCachedStatisticsLabels.html +1 -1
  48. package/docs/html/interfaces/support_esri.PointCloudLayerCachedStatisticsStats.html +1 -1
  49. package/docs/html/interfaces/support_esri.SublayerLike.html +14 -14
  50. package/docs/html/modules/mapping__LayerExtension.html +1 -1
  51. package/docs/html/modules/mapping_support_LayerListSettings.html +1 -1
  52. package/docs/html/modules/portal_FormInfo.FormInfo.html +11 -0
  53. package/docs/html/modules/portal_FormInfo.html +1 -1
  54. package/docs/html/modules/support_esri.html +10 -10
  55. package/docs/html/modules/version.html +1 -1
  56. package/mapping/TileLayerExtension.d.ts +5 -0
  57. package/mapping/TileLayerExtension.js +1 -1
  58. package/mapping/WMTSLayerExtension.d.ts +5 -0
  59. package/mapping/WMTSLayerExtension.js +1 -1
  60. package/mapping/_LayerExtension.js +1 -1
  61. package/mapping/support/LayerListSettings.d.ts +12 -1
  62. package/mapping/support/LayerListSettings.js +1 -1
  63. package/package.json +1 -1
  64. package/portal/FeatureLayer.d.ts +1 -1
  65. package/portal/FeatureLayer.js +1 -1
  66. package/portal/FormInfo.d.ts +17 -0
  67. package/portal/FormInfo.js +1 -1
  68. package/portal/MapServiceLayer.js +1 -1
  69. package/support/esri.d.ts +1 -0
  70. package/version.d.ts +1 -1
  71. package/version.js +1 -1
  72. package/docs/html/interfaces/portal_FormInfo.FormInfo.html +0 -13
@@ -1 +1 @@
1
- import{ArgumentError}from"../../ArgumentError.js";import{InvalidOperationError}from"../../InvalidOperationError.js";import{DefaultArcGISRequestHelper}from"../../support/ArcGISRequestHelper.js";import{checkArg}from"../../utilities/checkArg.js";import{isFeatureLayer}from"../../utilities/layers.js";import{toGraphic}from"../Feature.js";const requestHelper=new DefaultArcGISRequestHelper;export async function toAttachmentFile(t,e){var r,o;let a;if(t instanceof File)a=t;else if(null==t?void 0:t.url)try{const e=await requestHelper.request(t.url,{responseType:"blob"});a=new File([e.data],t.title,{type:t.contentType})}catch(t){throw new Error(`${null!==(r=`${e} `)&&void 0!==r?r:""}Failed to fetch attachment from url.`,{cause:t})}if(!a)throw new Error(`${null!==(o=`${e} `)&&void 0!==o?o:""}No attachment data found.`);return a}export function supportsAttachmentEditing(t){var e,r,o,a;return isFeatureLayer(t)&&!!(null===(r=null===(e=t.capabilities)||void 0===e?void 0:e.data)||void 0===r?void 0:r.supportsAttachment)&&((null===(o=t.capabilities.operations)||void 0===o?void 0:o.supportsUpdate)||(null===(a=t.capabilities.operations)||void 0===a?void 0:a.supportsAdd))}export async function addAttachment(t,e,r,o){var a,n,i,s,c,l;if(checkArg("feature",t).isDefined(),checkArg("layer",e).isDefined(),checkArg("attachment",r).isDefined(),t.source&&t.source.layer!==e&&t.source.table!==e)throw new ArgumentError("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(e))throw new InvalidOperationError("Cannot add attachment; the Table does not support attachments.");const d=`Failed to add attachment to ${null!==(a=t.primaryKey)&&void 0!==a?a:t.id} of source ${null!==(i=null===(n=t.source)||void 0===n?void 0:n.title)&&void 0!==i?i:null===(s=t.source)||void 0===s?void 0:s.id}.`,u=await toAttachmentFile(r,d),p=null===(l=null===(c=u.name)||void 0===c?void 0:c.split(".").pop())||void 0===l?void 0:l.toLowerCase();if((null==o?void 0:o.attachmentTypes)&&!isValidFileType(u,o.attachmentTypes))throw new ArgumentError("attachment",`The attachment type '${p}' does not exist in the set of accepted attachment types: ${o.attachmentTypes}.`);let h;const m=new FormData;m.append("attachment",u,u.name);try{const r=await e.addAttachment(toGraphic(t),m);if(r.error)throw new Error(r.error.message);h=`${r.objectId}`}catch(t){throw new Error(d,{cause:t})}return await t.fetchAttachments(),t.attachments.find((t=>t.id===h))}function isValidFileType(t,e){var r,o;if(!e.map((t=>t.toLowerCase())).includes(t.type.toLowerCase())){const a=e.filter((t=>!t.includes("/"))).map((t=>t.toLowerCase())),n=null===(o=null===(r=t.name)||void 0===r?void 0:r.split(".").pop())||void 0===o?void 0:o.toLowerCase();return a.includes(n)}return!0}export function isAttachmentTypeError(t){return ATTACHMENT_TYPE_ERROR_REGEX.test(t.message)}export const ATTACHMENT_TYPE_ERROR_REGEX=/^The attachment type .+ does not exist in the set of accepted attachment types: .+.$/;export async function deleteAttachments(t,e,r){var o,a,n,i;if(checkArg("feature",t).isDefined(),checkArg("layer",e).isDefined(),checkArg("attachments",r).isDefined(),t.source&&t.source.layer!==e&&t.source.table!==e)throw new ArgumentError("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(e))throw new InvalidOperationError("Cannot delete attachments; the layer/table does not support attachments.");const s=`Failed to delete attachment(s) from ${null!==(o=t.primaryKey)&&void 0!==o?o:t.id} of source ${null!==(n=null===(a=t.source)||void 0===a?void 0:a.title)&&void 0!==n?n:null===(i=t.source)||void 0===i?void 0:i.id}.`;try{const o=await e.deleteAttachments(toGraphic(t),r.map((t=>"string"==typeof t?+t:+t.id)));if(o.error)throw new Error(o.error.message)}catch(t){throw new Error(s,{cause:t})}await t.fetchAttachments()}
1
+ import{ArgumentError}from"../../ArgumentError.js";import{InvalidOperationError}from"../../InvalidOperationError.js";import{DefaultArcGISRequestHelper}from"../../support/ArcGISRequestHelper.js";import{checkArg}from"../../utilities/checkArg.js";import{isFeatureLayer}from"../../utilities/layers.js";import{toGraphic}from"../Feature.js";const requestHelper=new DefaultArcGISRequestHelper;export async function toAttachmentFile(e,t){var r,o;let a;if(e instanceof File)a=e;else if(null==e?void 0:e.url)try{const t=await requestHelper.request(e.url,{responseType:"blob"});a=new File([t.data],e.title,{type:e.contentType})}catch(e){throw new Error(`${null!==(r=`${t} `)&&void 0!==r?r:""}Failed to fetch attachment from url.`,{cause:e})}if(!a)throw new Error(`${null!==(o=`${t} `)&&void 0!==o?o:""}No attachment data found.`);return a}export function supportsAttachmentEditing(e){var t,r,o,a;return isFeatureLayer(e)&&!!(null===(r=null===(t=e.capabilities)||void 0===t?void 0:t.data)||void 0===r?void 0:r.supportsAttachment)&&((null===(o=e.capabilities.operations)||void 0===o?void 0:o.supportsUpdate)||(null===(a=e.capabilities.operations)||void 0===a?void 0:a.supportsAdd))}export async function addAttachment(e,t,r,o){var a,n,i,s,c,l;if(checkArg("feature",e).isDefined(),checkArg("layer",t).isDefined(),checkArg("attachment",r).isDefined(),e.source&&e.source.layer!==t&&e.source.table!==t)throw new ArgumentError("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(t))throw new InvalidOperationError("Cannot add attachment; the Table does not support attachments.");const d=`Failed to add attachment to ${null!==(a=e.primaryKey)&&void 0!==a?a:e.id} of source ${null!==(i=null===(n=e.source)||void 0===n?void 0:n.title)&&void 0!==i?i:null===(s=e.source)||void 0===s?void 0:s.id}.`,u=await toAttachmentFile(r,d),p=null===(l=null===(c=u.name)||void 0===c?void 0:c.split(".").pop())||void 0===l?void 0:l.toLowerCase();if((null==o?void 0:o.attachmentTypes)&&!isValidFileType(u,o.attachmentTypes))throw new ArgumentError("attachment",`The attachment type '${p}' does not exist in the set of accepted attachment types: ${o.attachmentTypes}.`);let h;const m=new FormData;m.append("attachment",u,u.name);try{const r=await t.addAttachment(toGraphic(e),m);if(r.error)throw new Error(r.error.message);h=`${r.objectId}`}catch(e){throw new Error(d,{cause:e})}return await e.fetchAttachments(),e.attachments.find((e=>e.id===h))}function isValidFileType(e,t){var r,o;if(!t.map((e=>e.toLowerCase())).includes(e.type.toLowerCase())){const a=t.filter((e=>!e.includes("/"))).map((e=>e.toLowerCase())),n=null===(o=null===(r=e.name)||void 0===r?void 0:r.split(".").pop())||void 0===o?void 0:o.toLowerCase();return a.includes(n)}return!0}export function isAttachmentTypeError(e){return ATTACHMENT_TYPE_ERROR_REGEX.test(e.message)}export const ATTACHMENT_TYPE_ERROR_REGEX=/^The attachment type .+ does not exist in the set of accepted attachment types: .+.$/;export async function deleteAttachments(e,t,r){var o,a,n,i;if(checkArg("feature",e).isDefined(),checkArg("layer",t).isDefined(),checkArg("attachments",r).isDefined(),e.source&&e.source.layer!==t&&e.source.table!==t)throw new ArgumentError("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(t))throw new InvalidOperationError("Cannot delete attachments; the layer/table does not support attachments.");const s=`Failed to delete attachment(s) from ${null!==(o=e.primaryKey)&&void 0!==o?o:e.id} of source ${null!==(n=null===(a=e.source)||void 0===a?void 0:a.title)&&void 0!==n?n:null===(i=e.source)||void 0===i?void 0:i.id}.`;try{const o=await t.deleteAttachments(toGraphic(e),r.map((e=>"string"==typeof e?+e:+e.id)));if((null==o?void 0:o.length)>1){const e=o.filter((e=>e.error));if(e.length>0)throw new AggregateError(e.map((e=>new Error(e.error.message))))}else if(null==o?void 0:o[0].error)throw new Error(null==o?void 0:o[0].error.message)}catch(e){throw new Error(s,{cause:e})}await e.fetchAttachments()}
@@ -223,6 +223,7 @@ declare namespace __esri {
223
223
  // Check if these properties exist in ESRI421.
224
224
  export interface FeatureLayer {
225
225
  mode: number;
226
+ deleteAttachments(feature: Graphic, attachmentIds: number[]): Promise<FeatureEditResult[]>;
226
227
  }
227
228
 
228
229
  export interface Renderer {