Types
import type { FeatureIdentifier, FeatureEditResult, AttachmentEdit, Attachment, EditOptions } from "@arcgis/core/editing/types.js";

Type definitions

FeatureIdentifier

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

A feature identifier. Either objectId or globalId is required when this object is used as input for operations.

objectId

Property
Type
number | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The objectId of the feature or the attachmentId of the attachment that was added/edited/deleted.

globalId

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The globalId of the feature or the attachment that was edited.

FeatureEditResult

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

FeatureEditResult represents the result of adding, updating or deleting a feature or an attachment.

Supertypes
FeatureIdentifier

error

Property
Type
EsriError | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

If the edit failed, the edit result includes an error.

AttachmentEdit

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

AttachmentEdit represents an attachment that can be added, updated or deleted via FeatureLayer.applyEdits(). This object can be either pre-uploaded data or base 64 encoded data.

feature

Property
Type
Graphic | FeatureIdentifier
Since
ArcGIS Maps SDK for JavaScript 5.0

The feature, objectId or globalId of feature associated with the attachment.

attachment

Property
Type
Attachment
Since
ArcGIS Maps SDK for JavaScript 5.0

The attachment to be added, updated or deleted.

Attachment

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

globalId

Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 5.0

The globalId of the attachment to be added or updated. These Global IDs must be from the Global ID field created by ArcGIS. For more information on ArcGIS generated Global IDs, see the Global IDs and Attachments and relationship classes sections in the Data Preparation documentation.

name

Property
Type
string | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The name of the attachment. This parameter must be set if the attachment type is Blob.

contentType

Property
Type
string | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The content type of the attachment. For example, 'image/jpeg'. See the ArcGIS REST API documentation for more information on supported attachment types.

uploadId

Property
Type
string | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The id of pre-loaded attachment.

data

Property
Type
Blob | File | string | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The attachment data.

EditOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

gdbVersion

Property
Type
string | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The geodatabase version to apply the edits. This parameter applies only if the capabilities.data.isVersioned property of the layer is true. If the gdbVersion parameter is not specified, edits are made to the published map's version.

rollbackOnFailureEnabled

Property
Type
boolean | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether the edits should be applied only if all submitted edits succeed. If false, the server will apply the edits that succeed even if some of the submitted edits fail. If true, the server will apply the edits only if all edits succeed. The layer's capabilities.editing.supportsRollbackOnFailure property must be true if using this parameter. If supportsRollbackOnFailure is false for a layer, then rollbackOnFailureEnabled will always be true, regardless of how the parameter is set.

globalIdUsed

Property
Type
boolean | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether the edits can be applied using globalIds of features or attachments. This parameter applies only if the layer's capabilities.editing.supportsGlobalId property is true. When false, globalIds submitted with the features are ignored and the service assigns new globalIds to the new features. When true, the globalIds must be submitted with the new features. When updating existing features, if the globalIdUsed is false, the objectIds of the features to be updated must be provided. If the globalIdUsed is true, globalIds of features to be updated must be provided. When deleting existing features, set this property to false as deletes operation only accepts objectIds at the current version of the API.

When adding, updating or deleting attachments, globalIdUsed parameter must be set to true and the attachment globalId must be set. For new attachments, the user must provide globalIds. In order for an attachment to be updated or deleted, clients must include its globalId. Attachments are not supported in an edit payload when globalIdUsed is false.

// add an image attachments to features
function addAttachment(selectedFeature) {
const blob = new Blob(byteArrays, { type: "image/png" });
addAttachments.push({
feature: selectedFeature,
attachment: {
globalId: "8c4d6085-a33c-42a0-8e11-21e9528bca0d",
name: "brokenLight",
data: blob
}
});
const edits = {
addAttachments: addAttachments
};
const options = {
// globalIdUsed has to be true when adding, updating or deleting attachments
globalIdUsed: true,
rollbackOnFailureEnabled: true
};
featureLayer.applyEdits(edits, options).then(function(results) {
console.log("edits added: ", results);
});
}

returnEditMoment

Property
Type
boolean | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether the edit results should return the time edits were applied. If true, the feature service will return the time edits were applied in the edit result's editMoment property. Only applicable with ArcGIS Server services only. This option was added at the version 4.20.

returnServiceEditsOption

Property
Type
"none" | "original-and-current-features" | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

If set to original-and-current-features, the EditedFeatureResult parameter will be included in the applyEdits response. It contains all edited features participating in composite relationships in a database as result of editing a feature. Note that even for deletions, the geometry and attributes of the deleted feature are returned. The original-and-current-features option is only valid when rollbackOnFailureEnabled is true. The default value is none, which will not include the EditedFeatureResult parameter in the response. This is only applicable with ArcGIS Server services only. This option was added at the version 4.20.

editsRespectTrueCurves

Property
Type
boolean | undefined

Attests that the edits were prepared in a way that avoids the loss of true curve geometries. An app should only set this parameter to true if it can guarantee that the entire client-side chain of custody handles true curves properly.

Setting this parameter is only necessary when the feature service is configured to restrict updating of true curve geometries to clients that explicitly indicate support for true curve editing.

Considerations for curve-aware editing include:

  • Prior to editing, the feature must be obtained from the service with its true curves intact, e.g. by a query with the Query.returnTrueCurves parameter set to true.
  • Ensure all spatial operations performed on the geometry preserve curves — i.e., avoids densifying curves into linear approximations.
  • Beware of code that references a geometry's Polygon.rings or Polyline.paths properties directly. Curve-aware iteration over the vertices of a geometry requires a conditional logic whereby Polygon.curveRings or Polyline.curvePaths are used when defined, and Polygon.rings or Polyline.paths are used otherwise.

Edits

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

addFeatures

Property
Type
Graphic[] | Collection<Graphic> | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

An array or a Collection of features to be added. Feature geometries must be of type Mesh. Values of non nullable fields must be provided when adding new features. Date fields must have numeric values representing universal time.

updateFeatures

Property
Type
Graphic[] | Collection<Graphic> | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

An array or a Collection of features to be updated. Each feature must have a valid objectId or globalId for attribute updates, while geometry updates must always use a valid globalId. Values of non nullable fields must be provided when updating features. Date fields must have numeric values representing universal time.

deleteFeatures

Property
Type
Graphic[] | Collection<Graphic> | FeatureIdentifier[] | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

An array or a Collection of features, or an array of objects with globalId of each feature to be deleted. When an array or collection of features is passed, each feature must have a valid globalId. When an array of objects is used, each object must have a valid value set for the globalId property.

addAttachments

Property
Type
AttachmentEdit[] | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of attachments to be added. Applies only when the options.globalIdUsed parameter is set to true. User must provide globalIds for all attachments to be added.

updateAttachments

Property
Type
AttachmentEdit[] | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of attachments to be updated. Applies only when the options.globalIdUsed parameter is set to true. User must provide globalIds for all attachments to be updated.

deleteAttachments

Property
Type
string[] | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of globalIds for attachments to be deleted. Applies only when the options.globalIdUsed parameter is set to true.

EditsResult

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

Results returned from the FeatureLayer.applyEdits() method.

addFeatureResults

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Result of adding features.

updateFeatureResults

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Result of updating features.

deleteFeatureResults

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Result of deleting features.

addAttachmentResults

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Result of adding attachments.

updateAttachmentResults

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Result of updating attachments.

deleteAttachmentResults

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Result of deleting attachments.

editedFeatureResults

Property
Type
EditedFeatureResult[] | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Edited features as result of editing a feature that participates in composite relationships in a database. This parameter is returned only when the returnServiceEditsOption parameter of the FeatureLayer.applyEdits() method is set to original-and-current-features. This parameter was added at 4.20.

editMoment

Property
Type
number | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The time edits were applied to the feature service. This parameter is returned only when the returnEditMoment parameter of the FeatureLayer.applyEdits() method is set to true. This option was added at the version 4.20.

EditedFeatureResult

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.20

Results returned from the FeatureLayer.applyEdits() method if the returnServiceEditsOption parameter is set to original-and-current-features. It contains features that were added, deleted or updated in different feature layers of a feature service as a result of editing a single feature that participates in a composite relationship in a database. The results are organized by each layer affected by the edit. For example, if a feature is deleted and it is the origin in a composite relationship, the edited features as a result of this deletion are returned.

The editedFeatures object returns full features including newly added features, the original features prior to delete, the original and current features for updates.

layerId

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 5.0

The layerId of the feature layer where features were edited.

editedFeatures

Property
Type
EditedFeatures
Since
ArcGIS Maps SDK for JavaScript 5.0

Object containing all edited features belonging to the specified layer.

EditedFeatures

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

adds

Property
Type
Graphic[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Newly added features as a result of editing a feature that participates in a composite relationship.

updates

Property
Type
EditedFeaturesUpdate[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Object containing original and updated features as a result of editing a feature that participates in a composite relationship.

deletes

Property
Type
Graphic[]
Since
ArcGIS Maps SDK for JavaScript 5.0

Deleted features as a result of editing a feature that participates in a composite relationship.

spatialReference

Property
Type
SpatialReference | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Edited features are returned in the spatial reference of the feature service.

EditedFeaturesUpdate

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

original

Property
Type
Graphic
Since
ArcGIS Maps SDK for JavaScript 5.0

Original feature before the update took place.

current

Property
Type
Graphic
Since
ArcGIS Maps SDK for JavaScript 5.0

Updated feature as a result of editing a feature that participates in a composite relationship.

EditsResultEvent

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0

addedFeatures

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of successfully added features.

updatedFeatures

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of successfully updated features.

deletedFeatures

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of successfully deleted features.

addedAttachments

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of successfully added attachments.

updatedAttachments

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of successfully updated attachments.

deletedAttachments

Property
Type
FeatureEditResult[]
Since
ArcGIS Maps SDK for JavaScript 5.0

An array of successfully deleted attachments.

editedFeatures

Property
Type
EditedFeatureResult[] | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

Edited features as result of editing a feature that participates in composite relationships in a database. This parameter is returned only when the returnServiceEditsOption parameter of the FeatureLayer.applyEdits() method is set to original-and-current-features. This parameter was added at 4.20.

exceededTransferLimit

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Returns true when the number of records returned exceeds the maximum number configured on the service.