Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@esri/arcgis-rest-feature-service

Package Overview
Dependencies
Maintainers
16
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/arcgis-rest-feature-service - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

dist/.DS_Store

259

dist/esm/features.d.ts

@@ -1,39 +0,50 @@

import { esriGeometryType, IFeature, IGeometry, ISpatialReference, IFeatureSet } from "@esri/arcgis-rest-common-types";
import { esriGeometryType, SpatialRelationship, IFeature, IGeometry, ISpatialReference, IFeatureSet, esriUnits } from "@esri/arcgis-rest-common-types";
import { IRequestOptions } from "@esri/arcgis-rest-request";
/**
* parameters required to get a feature by id
*
* @param url - layer service url
* @param id - feature id
* Request options to fetch a feature by id.
*/
export interface IFeatureRequestOptions extends IRequestOptions {
/**
* Layer service url.
*/
url: string;
/**
* Unique identifier of the feature.
*/
id: number;
}
/**
* @param statisticType - statistical operation to perform (count, sum, min, max, avg, stddev, var)
* @param onStatisticField - field on which to perform the statistical operation
* @param outStatisticFieldName - a field name for the returned statistic field. If outStatisticFieldName is empty or missing, the server will assign one. A valid field name can only contain alphanumeric characters and an underscore. If the outStatisticFieldName is a reserved keyword of the underlying DBMS, the operation can fail. Try specifying an alternative outStatisticFieldName.
*/
export interface IStatisticDefinition {
/**
* Statistical operation to perform (count, sum, min, max, avg, stddev, var).
*/
statisticType: "count" | "sum" | "min" | "max" | "avg" | "stddev" | "var";
/**
* Field on which to perform the statistical operation.
*/
onStatisticField: string;
/**
* Field name for the returned statistic field. If outStatisticFieldName is empty or missing, the server will assign one. A valid field name can only contain alphanumeric characters and an underscore. If the outStatisticFieldName is a reserved keyword of the underlying DBMS, the operation can fail. Try specifying an alternative outStatisticFieldName.
*/
outStatisticFieldName: string;
}
/**
* feature query parameters
*
* See https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm
*/
export interface IQueryFeaturesParams {
export interface ISharedQueryParams {
where?: string;
objectIds?: number[];
geometry?: IGeometry;
geometryType?: esriGeometryType;
inSR?: string | ISpatialReference;
spatialRel?: "esriSpatialRelIntersects" | "esriSpatialRelContains" | "esriSpatialRelCrosses" | "esriSpatialRelEnvelopeIntersects" | "esriSpatialRelIndexIntersects" | "esriSpatialRelOverlaps" | "esriSpatialRelTouches" | "esriSpatialRelWithin";
spatialRel?: SpatialRelationship;
}
/**
* feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.
*/
export interface IQueryFeaturesRequestOptions extends ISharedQueryParams, IRequestOptions {
/**
* Layer service url.
*/
url: string;
objectIds?: number[];
relationParam?: string;
time?: Date | Date[];
distance?: number;
units?: "esriSRUnit_Meter" | "esriSRUnit_StatuteMile" | "esriSRUnit_Foot" | "esriSRUnit_Kilometer" | "esriSRUnit_NauticalMile" | "esriSRUnit_USNauticalMile";
units?: esriUnits;
outFields?: "*" | string[];

@@ -60,17 +71,8 @@ returnGeometry?: boolean;

resultType?: "none" | "standard" | "tile";
historicMoment?: Date;
historicMoment?: number;
returnTrueCurves?: false;
sqlFormat?: "none" | "standard" | "native";
returnExceededLimitFeatures?: boolean;
[key: string]: any;
}
/**
* feature query request options
*
* @param url - layer service url
* @param params - query parameters to be sent to the feature service
*/
export interface IQueryFeaturesRequestOptions extends IRequestOptions {
url: string;
params?: IQueryFeaturesParams;
}
export interface IQueryFeaturesResponse extends IFeatureSet {

@@ -82,2 +84,16 @@ exceededTransferLimit?: boolean;

*
* ```js
* import { getFeature } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0";
*
* getFeature({
* url,
* id: 42
* };)
* .then(feature => {
* console.log(feature.attributes.FID); // 42
* });
* ```
*
* @param requestOptions - Options for the request

@@ -90,2 +106,16 @@ * @returns A Promise that will resolve with the feature.

*
* ```js
* import { queryFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3";
*
* queryFeatures({
* url,
* where: "STATE_NAME = 'Alaska"
* };)
* .then(feature => {
* console.log(feature.attributes.FID); // 42
* });
* ```
*
* @param requestOptions - Options for the request

@@ -95,1 +125,170 @@ * @returns A Promise that will resolve with the query response.

export declare function queryFeatures(requestOptions: IQueryFeaturesRequestOptions): Promise<IQueryFeaturesResponse>;
/**
* Add, update and delete features result Object.
*/
export interface IEditFeatureResult {
objectId: number;
globalId?: string;
success: boolean;
}
/**
* Common add and update features parameters.
*/
export interface IEditFeaturesParams {
/**
* The geodatabase version to apply the edits.
*/
gdbVersion?: string;
/**
* Optional parameter specifying whether the response will report the time features were added.
*/
returnEditMoment?: boolean;
/**
* Optional parameter to specify if the edits should be applied only if all submitted edits succeed.
*/
rollbackOnFailure?: boolean;
}
/**
* Add features request options.
*
* @param url - Feature service url.
* @param adds - Array of JSON features to add.
* @param params - Query parameters to be sent to the feature service via the request.
*/
export interface IAddFeaturesRequestOptions extends IEditFeaturesParams, IRequestOptions {
/**
* Feature service url.
*/
url: string;
/**
* Array of JSON features to add.
*/
adds: IFeature[];
}
/**
* Add features results.
*/
export interface IAddFeaturesResult {
/**
* Array of JSON response Object(s) for each feature added.
*/
addResults?: IEditFeatureResult[];
}
/**
* Add features request.
*
* @param requestOptions - Options for the request.
* ```js
* import { addFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* addFeatures({
* url,
* adds: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the addFeatures response.
*/
export declare function addFeatures(requestOptions: IAddFeaturesRequestOptions): Promise<IAddFeaturesResult>;
/**
* Update features request options.
*
* @param url - Feature service url.
* @param updates - Array of JSON features to update.
* @param params - Query parameters to be sent to the feature service via the request.
*/
export interface IUpdateFeaturesRequestOptions extends IEditFeaturesParams, IRequestOptions {
/**
* Feature service url.
*/
url: string;
/**
* Array of JSON features to update.
*/
updates: IFeature[];
}
/**
* Update features results.
*/
export interface IUpdateFeaturesResult {
/**
* Array of JSON response Object(s) for each feature updated.
*/
updateResults?: IEditFeatureResult[];
}
/**
* Update features request.
*
* ```js
* import { updateFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* updateFeatures({
* url,
* updates: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the updateFeatures response.
*/
export declare function updateFeatures(requestOptions: IUpdateFeaturesRequestOptions): Promise<IUpdateFeaturesResult>;
/**
* Delete features parameters.
*/
export interface IDeleteFeaturesParams extends IEditFeaturesParams, ISharedQueryParams {
}
/**
* Delete features request options.
*
* @param url - Feature service url.
* @param deletes - Array of objectIds to delete.
* @param params - Query parameters to be sent to the feature service via the request.
*/
export interface IDeleteFeaturesRequestOptions extends IDeleteFeaturesParams, IRequestOptions {
/**
* Feature service url.
*/
url: string;
/**
* Array of objectIds to delete.
*/
deletes: number[];
}
/**
* Delete features results.
*/
export interface IDeleteFeaturesResult {
/**
* Array of JSON response Object(s) for each feature deleted.
*/
deleteResults?: IEditFeatureResult[];
}
/**
* Delete features request.
*
* ```js
* import { deleteFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* deleteFeatures({
* url,
* deletes: [1,2,3]
* });
* ```
*
* @param deleteFeaturesRequestOptions - Options for the request.
* @returns A Promise that will resolve with the deleteFeatures response.
*/
export declare function deleteFeatures(requestOptions: IDeleteFeaturesRequestOptions): Promise<IDeleteFeaturesResult>;

@@ -6,2 +6,16 @@ import * as tslib_1 from "tslib";

*
* ```js
* import { getFeature } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0";
*
* getFeature({
* url,
* id: 42
* };)
* .then(feature => {
* console.log(feature.attributes.FID); // 42
* });
* ```
*
* @param requestOptions - Options for the request

@@ -19,2 +33,16 @@ * @returns A Promise that will resolve with the feature.

*
* ```js
* import { queryFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3";
*
* queryFeatures({
* url,
* where: "STATE_NAME = 'Alaska"
* };)
* .then(feature => {
* console.log(feature.attributes.FID); // 42
* });
* ```
*
* @param requestOptions - Options for the request

@@ -24,8 +52,6 @@ * @returns A Promise that will resolve with the query response.

export function queryFeatures(requestOptions) {
// default to a GET request
var options = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions);
appendCustomParams(requestOptions, options);
// set default query parameters
// and default to a GET request
var options = tslib_1.__assign({
params: {},
httpMethod: "GET"
}, requestOptions);
if (!options.params.where) {

@@ -37,5 +63,106 @@ options.params.where = "1=1";

}
// TODO: do we need to serialize any of the array/object params?
return request(requestOptions.url + "/query", options);
return request(options.url + "/query", options);
}
/**
* Add features request.
*
* @param requestOptions - Options for the request.
* ```js
* import { addFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* addFeatures({
* url,
* adds: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the addFeatures response.
*/
export function addFeatures(requestOptions) {
var url = requestOptions.url + "/addFeatures";
// edit operations are POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
// mixin, don't overwrite
options.params.features = requestOptions.adds;
return request(url, options);
}
/**
* Update features request.
*
* ```js
* import { updateFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* updateFeatures({
* url,
* updates: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the updateFeatures response.
*/
export function updateFeatures(requestOptions) {
var url = requestOptions.url + "/updateFeatures";
// edit operations are POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
// mixin, don't overwrite
options.params.features = requestOptions.updates;
return request(url, options);
}
/**
* Delete features request.
*
* ```js
* import { deleteFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* deleteFeatures({
* url,
* deletes: [1,2,3]
* });
* ```
*
* @param deleteFeaturesRequestOptions - Options for the request.
* @returns A Promise that will resolve with the deleteFeatures response.
*/
export function deleteFeatures(requestOptions) {
var url = requestOptions.url + "/deleteFeatures";
// edit operations POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
// mixin, don't overwrite
options.params.objectIds = requestOptions.deletes;
return request(url, options);
}
function appendCustomParams(oldOptions, newOptions) {
// pass query parameters through in the request, not generic IRequestOptions props
for (var property in oldOptions) {
/* istanbul ignore else */
if (oldOptions.hasOwnProperty(property)) {
if (property !== 'url' &&
property !== 'params' &&
property !== 'authentication' &&
property !== 'httpMethod' &&
property !== 'fetch' &&
property !== 'portal' &&
property !== 'maxUrlLength') {
newOptions.params[property] = oldOptions[property];
}
}
}
}
//# sourceMappingURL=features.js.map

@@ -5,1 +5,5 @@ export * from "./query";

export * from "./delete";
export * from "./getAttachments";
export * from "./addAttachment";
export * from "./updateAttachment";
export * from "./deleteAttachments";

@@ -5,2 +5,6 @@ export * from "./query";

export * from "./delete";
export * from "./getAttachments";
export * from "./addAttachment";
export * from "./updateAttachment";
export * from "./deleteAttachments";
//# sourceMappingURL=index.js.map

10

dist/esm/query.d.ts

@@ -1,2 +0,2 @@

import { ISpatialReference, IFeatureSet, IFeature, esriUnits } from "@esri/arcgis-rest-common-types";
import { ISpatialReference, IFeatureSet, IFeature, esriUnits, IExtent } from "@esri/arcgis-rest-common-types";
import { IRequestOptions } from "@esri/arcgis-rest-request";

@@ -73,2 +73,8 @@ import { ISharedQueryParams } from "./helpers";

}
export interface IQueryResponse {
count?: number;
extent?: IExtent;
objectIdFieldName?: string;
objectIds?: number[];
}
/**

@@ -115,2 +121,2 @@ * Get a feature by id.

*/
export declare function queryFeatures(requestOptions: IQueryFeaturesRequestOptions): Promise<IQueryFeaturesResponse>;
export declare function queryFeatures(requestOptions: IQueryFeaturesRequestOptions): Promise<IQueryFeaturesResponse | IQueryResponse>;

@@ -8,2 +8,16 @@ "use strict";

*
* ```js
* import { getFeature } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0";
*
* getFeature({
* url,
* id: 42
* };)
* .then(feature => {
* console.log(feature.attributes.FID); // 42
* });
* ```
*
* @param requestOptions - Options for the request

@@ -22,2 +36,16 @@ * @returns A Promise that will resolve with the feature.

*
* ```js
* import { queryFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3";
*
* queryFeatures({
* url,
* where: "STATE_NAME = 'Alaska"
* };)
* .then(feature => {
* console.log(feature.attributes.FID); // 42
* });
* ```
*
* @param requestOptions - Options for the request

@@ -27,8 +55,6 @@ * @returns A Promise that will resolve with the query response.

function queryFeatures(requestOptions) {
// default to a GET request
var options = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions);
appendCustomParams(requestOptions, options);
// set default query parameters
// and default to a GET request
var options = tslib_1.__assign({
params: {},
httpMethod: "GET"
}, requestOptions);
if (!options.params.where) {

@@ -40,6 +66,110 @@ options.params.where = "1=1";

}
// TODO: do we need to serialize any of the array/object params?
return arcgis_rest_request_1.request(requestOptions.url + "/query", options);
return arcgis_rest_request_1.request(options.url + "/query", options);
}
exports.queryFeatures = queryFeatures;
/**
* Add features request.
*
* @param requestOptions - Options for the request.
* ```js
* import { addFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* addFeatures({
* url,
* adds: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the addFeatures response.
*/
function addFeatures(requestOptions) {
var url = requestOptions.url + "/addFeatures";
// edit operations are POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
// mixin, don't overwrite
options.params.features = requestOptions.adds;
return arcgis_rest_request_1.request(url, options);
}
exports.addFeatures = addFeatures;
/**
* Update features request.
*
* ```js
* import { updateFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* updateFeatures({
* url,
* updates: [{
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
* attributes: { status: "alive" }
* }]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the updateFeatures response.
*/
function updateFeatures(requestOptions) {
var url = requestOptions.url + "/updateFeatures";
// edit operations are POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
// mixin, don't overwrite
options.params.features = requestOptions.updates;
return arcgis_rest_request_1.request(url, options);
}
exports.updateFeatures = updateFeatures;
/**
* Delete features request.
*
* ```js
* import { deleteFeatures } from '@esri/arcgis-rest-feature-service';
*
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
*
* deleteFeatures({
* url,
* deletes: [1,2,3]
* });
* ```
*
* @param deleteFeaturesRequestOptions - Options for the request.
* @returns A Promise that will resolve with the deleteFeatures response.
*/
function deleteFeatures(requestOptions) {
var url = requestOptions.url + "/deleteFeatures";
// edit operations POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
// mixin, don't overwrite
options.params.objectIds = requestOptions.deletes;
return arcgis_rest_request_1.request(url, options);
}
exports.deleteFeatures = deleteFeatures;
function appendCustomParams(oldOptions, newOptions) {
// pass query parameters through in the request, not generic IRequestOptions props
for (var property in oldOptions) {
/* istanbul ignore else */
if (oldOptions.hasOwnProperty(property)) {
if (property !== 'url' &&
property !== 'params' &&
property !== 'authentication' &&
property !== 'httpMethod' &&
property !== 'fetch' &&
property !== 'portal' &&
property !== 'maxUrlLength') {
newOptions.params[property] = oldOptions[property];
}
}
}
}
//# sourceMappingURL=features.js.map

@@ -8,2 +8,6 @@ "use strict";

tslib_1.__exportStar(require("./delete"), exports);
tslib_1.__exportStar(require("./getAttachments"), exports);
tslib_1.__exportStar(require("./addAttachment"), exports);
tslib_1.__exportStar(require("./updateAttachment"), exports);
tslib_1.__exportStar(require("./deleteAttachments"), exports);
//# sourceMappingURL=index.js.map
/* @preserve
* @esri/arcgis-rest-feature-service - v1.5.1 - Thu Jul 12 2018 08:28:46 GMT-0700 (PDT)
* @esri/arcgis-rest-feature-service - v1.6.0 - Fri Jul 27 2018 15:12:35 GMT-0700 (PDT)
* Copyright (c) 2017 - 2018 Environmental Systems Research Institute, Inc.

@@ -215,2 +215,101 @@ * Apache-2.0

/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
/**
* Request `attachmentInfos` of a feature by id. See [Attachment Infos](https://developers.arcgis.com/rest/services-reference/attachment-infos-feature-service-.htm) for more information.
*
* ```js
* import { getAttachments } from '@esri/arcgis-rest-feature-service';
*
* getAttachments({
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0",
* featureId: 8484
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the `getAttachments()` response.
*/
function getAttachments(requestOptions) {
// pass through
return arcgisRestRequest.request(requestOptions.url + "/" + requestOptions.featureId + "/attachments", requestOptions);
}
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
/**
* Attach a file to a feature by id. See [Add Attachment](https://developers.arcgis.com/rest/services-reference/add-attachment.htm) for more information.
*
* ```js
* import { addAttachment } from '@esri/arcgis-rest-feature-service';
*
* addAttachment({
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0",
* featureId: 8484,
* attachment: myFileInput.files[0]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the `addAttachment()` response.
*/
function addAttachment(requestOptions) {
var options = __assign({ params: {} }, requestOptions);
// `attachment` --> params: {}
options.params.attachment = requestOptions.attachment;
return arcgisRestRequest.request(options.url + "/" + options.featureId + "/addAttachment", options);
}
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
/**
* Update a related attachment to a feature by id. See [Update Attachment](https://developers.arcgis.com/rest/services-reference/update-attachment.htm) for more information.
*
* ```js
* import { updateAttachment } from '@esri/arcgis-rest-feature-service';
*
* updateAttachment({
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0",
* featureId: 8484,
* attachment: myFileInput.files[0],
* attachmentId: 306
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the `updateAttachment()` response.
*/
function updateAttachment(requestOptions) {
var options = __assign({ params: {} }, requestOptions);
// `attachment` and `attachmentId` --> params: {}
options.params.attachment = requestOptions.attachment;
options.params.attachmentId = requestOptions.attachmentId;
return arcgisRestRequest.request(options.url + "/" + options.featureId + "/updateAttachment", options);
}
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
/**
* Delete existing attachment files of a feature by id. See [Delete Attachments](https://developers.arcgis.com/rest/services-reference/delete-attachments.htm) for more information.
*
* ```js
* import { deleteAttachments } from '@esri/arcgis-rest-feature-service';
*
* deleteAttachments({
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0",
* featureId: 8484,
* attachmentIds: [306]
* });
* ```
*
* @param requestOptions - Options for the request.
* @returns A Promise that will resolve with the `deleteAttachments()` response.
*/
function deleteAttachments(requestOptions) {
var options = __assign({ params: {} }, requestOptions);
// `attachmentIds` --> params: {}
options.params.attachmentIds = requestOptions.attachmentIds;
return arcgisRestRequest.request(options.url + "/" + options.featureId + "/deleteAttachments", options);
}
exports.getFeature = getFeature;

@@ -221,2 +320,6 @@ exports.queryFeatures = queryFeatures;

exports.deleteFeatures = deleteFeatures;
exports.getAttachments = getAttachments;
exports.addAttachment = addAttachment;
exports.updateAttachment = updateAttachment;
exports.deleteAttachments = deleteAttachments;

@@ -223,0 +326,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

/* @preserve
* @esri/arcgis-rest-feature-service - v1.5.1 - Thu Jul 12 2018 08:28:48 GMT-0700 (PDT)
* @esri/arcgis-rest-feature-service - v1.6.0 - Fri Jul 27 2018 15:12:37 GMT-0700 (PDT)
* Copyright (c) 2017 - 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0
*/
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],r):r(e.arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,function(e,r){"use strict";var t=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var s in r=arguments[t])Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);return e};function a(e,r){Object.keys(e).forEach(function(t){"url"!==t&&"params"!==t&&"authentication"!==t&&"httpMethod"!==t&&"fetch"!==t&&"portal"!==t&&"maxUrlLength"!==t&&(r.params[t]=e[t])})}e.getFeature=function(e){var a=e.url+"/"+e.id,s=t({httpMethod:"GET"},e);return r.request(a,s).then(function(e){return e.feature})},e.queryFeatures=function(e){var s=t({params:{},httpMethod:"GET",url:e.url},e);return a(e,s),s.params.where||(s.params.where="1=1"),s.params.outFields||(s.params.outFields="*"),r.request(s.url+"/query",s)},e.addFeatures=function(e){var s=e.url+"/addFeatures",u=t({params:{}},e);return a(e,u),u.params.features=e.adds,delete u.params.adds,r.request(s,u)},e.updateFeatures=function(e){var s=e.url+"/updateFeatures",u=t({params:{}},e);return a(e,u),u.params.features=e.updates,delete u.params.updates,r.request(s,u)},e.deleteFeatures=function(e){var s=e.url+"/deleteFeatures",u=t({params:{}},e);return a(e,u),u.params.objectIds=e.deletes,delete u.params.deletes,r.request(s,u)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],t):t(e.arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,function(e,t){"use strict";var a=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var u in t=arguments[a])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e};function r(e,t){Object.keys(e).forEach(function(a){"url"!==a&&"params"!==a&&"authentication"!==a&&"httpMethod"!==a&&"fetch"!==a&&"portal"!==a&&"maxUrlLength"!==a&&(t.params[a]=e[a])})}e.getFeature=function(e){var r=e.url+"/"+e.id,u=a({httpMethod:"GET"},e);return t.request(r,u).then(function(e){return e.feature})},e.queryFeatures=function(e){var u=a({params:{},httpMethod:"GET",url:e.url},e);return r(e,u),u.params.where||(u.params.where="1=1"),u.params.outFields||(u.params.outFields="*"),t.request(u.url+"/query",u)},e.addFeatures=function(e){var u=e.url+"/addFeatures",s=a({params:{}},e);return r(e,s),s.params.features=e.adds,delete s.params.adds,t.request(u,s)},e.updateFeatures=function(e){var u=e.url+"/updateFeatures",s=a({params:{}},e);return r(e,s),s.params.features=e.updates,delete s.params.updates,t.request(u,s)},e.deleteFeatures=function(e){var u=e.url+"/deleteFeatures",s=a({params:{}},e);return r(e,s),s.params.objectIds=e.deletes,delete s.params.deletes,t.request(u,s)},e.getAttachments=function(e){return t.request(e.url+"/"+e.featureId+"/attachments",e)},e.addAttachment=function(e){var r=a({params:{}},e);return r.params.attachment=e.attachment,t.request(r.url+"/"+r.featureId+"/addAttachment",r)},e.updateAttachment=function(e){var r=a({params:{}},e);return r.params.attachment=e.attachment,r.params.attachmentId=e.attachmentId,t.request(r.url+"/"+r.featureId+"/updateAttachment",r)},e.deleteAttachments=function(e){var r=a({params:{}},e);return r.params.attachmentIds=e.attachmentIds,t.request(r.url+"/"+r.featureId+"/deleteAttachments",r)},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=feature-service.umd.min.js.map
{
"name": "@esri/arcgis-rest-feature-service",
"version": "1.5.1",
"version": "1.6.0",
"description": "Feature service helpers for @esri/arcgis-rest-request",

@@ -22,4 +22,4 @@ "main": "dist/node/index.js",

"devDependencies": {
"@esri/arcgis-rest-common-types": "^1.5.1",
"@esri/arcgis-rest-request": "^1.5.1"
"@esri/arcgis-rest-common-types": "^1.6.0",
"@esri/arcgis-rest-request": "^1.6.0"
},

@@ -26,0 +26,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc