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
6
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.19.2 to 4.0.0-beta.2

dist/bundled/feature-service.esm.js

31

dist/esm/add.d.ts

@@ -1,35 +0,14 @@

import { IFeature } from "@esri/arcgis-rest-common-types";
import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IEditFeaturesParams, IEditFeatureResult } from "./helpers";
import { IFeature } from "@esri/arcgis-rest-request";
import { ISharedEditOptions, IEditFeatureResult } from "./helpers.js";
/**
* Add features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.
*
* @param url - Feature service url.
* @param features - 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 {
export interface IAddFeaturesOptions extends ISharedEditOptions {
/**
* Feature service url.
*/
url: string;
/**
* Array of JSON features to add.
*/
features: IFeature[];
/**
* Deprecated. Please use `features` instead.
*/
adds?: IFeature[];
}
/**
* Add features results.
*/
export interface IAddFeaturesResult {
/**
* Array of JSON response Object(s) for each feature added.
*/
addResults?: IEditFeatureResult[];
}
/**
* ```js

@@ -52,2 +31,4 @@ * import { addFeatures } from '@esri/arcgis-rest-feature-service';

*/
export declare function addFeatures(requestOptions: IAddFeaturesRequestOptions): Promise<IAddFeaturesResult>;
export declare function addFeatures(requestOptions: IAddFeaturesOptions): Promise<{
addResults: IEditFeatureResult[];
}>;
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, appendCustomParams, cleanUrl, warn } from "@esri/arcgis-rest-request";
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
/**

@@ -24,14 +23,7 @@ * ```js

export function addFeatures(requestOptions) {
var url = cleanUrl(requestOptions.url) + "/addFeatures";
const url = `${cleanUrl(requestOptions.url)}/addFeatures`;
// edit operations are POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
if (options.params.adds && options.params.adds.length) {
// mixin, don't overwrite
options.params.features = requestOptions.adds;
delete options.params.adds;
warn("The `adds` parameter is deprecated and will be removed in a future release. Please use `features` instead.");
}
const options = appendCustomParams(requestOptions, ["features", "gdbVersion", "returnEditMoment", "rollbackOnFailure"], { params: Object.assign({}, requestOptions.params) });
return request(url, options);
}
//# sourceMappingURL=add.js.map

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

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IEditFeatureResult } from "./helpers";
import { IGetLayerOptions, IEditFeatureResult } from "./helpers.js";
/**

@@ -7,8 +6,4 @@ * Request options for adding a related attachment to a feature by id. See [Add Attachment](https://developers.arcgis.com/rest/services-reference/add-attachment.htm) for more information.

*/
export interface IAddAttachmentOptions extends IRequestOptions {
export interface IAddAttachmentOptions extends IGetLayerOptions {
/**
* Feature service url.
*/
url: string;
/**
* Unique identifier of feature to add related attachment.

@@ -23,11 +18,2 @@ */

/**
* `addAttachment()` request response.
*/
export interface IAddAttachmentResponse {
/**
* Standard AGS add/update/edit result Object for the attachment.
*/
addAttachmentResult: IEditFeatureResult;
}
/**
* ```js

@@ -48,2 +34,4 @@ * import { addAttachment } from '@esri/arcgis-rest-feature-service';

*/
export declare function addAttachment(requestOptions: IAddAttachmentOptions): Promise<IAddAttachmentResponse>;
export declare function addAttachment(requestOptions: IAddAttachmentOptions): Promise<{
addAttachmentResult: IEditFeatureResult;
}>;
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, cleanUrl } from "@esri/arcgis-rest-request";

@@ -22,7 +21,7 @@ /**

export function addAttachment(requestOptions) {
var options = tslib_1.__assign({ params: {} }, requestOptions);
const options = Object.assign({ params: {} }, requestOptions);
// `attachment` --> params: {}
options.params.attachment = requestOptions.attachment;
return request(cleanUrl(options.url) + "/" + options.featureId + "/addAttachment", options);
return request(`${cleanUrl(options.url)}/${options.featureId}/addAttachment`, options);
}
//# sourceMappingURL=addAttachment.js.map

@@ -1,8 +0,7 @@

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IField } from "@esri/arcgis-rest-common-types";
import { IQueryFeaturesResponse } from "./query";
import { IRequestOptions, IField } from "@esri/arcgis-rest-request";
import { IQueryFeaturesResponse } from "./query.js";
/**
* Request options to fetch a feature by id.
*/
export interface IDecodeValuesRequestOptions extends IRequestOptions {
export interface IDecodeValuesOptions extends IRequestOptions {
/**

@@ -53,2 +52,2 @@ * Layer service url.

*/
export declare function decodeValues(requestOptions: IDecodeValuesRequestOptions): Promise<IQueryFeaturesResponse>;
export declare function decodeValues(requestOptions: IDecodeValuesOptions): Promise<IQueryFeaturesResponse>;
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { getLayer } from "./getLayer";
import { getLayer } from "./getLayer.js";
/**

@@ -25,14 +24,14 @@ * ```js

export function decodeValues(requestOptions) {
return new Promise(function (resolve) {
if (!requestOptions.fields) {
return getLayer(requestOptions.url, requestOptions).then(function (metadata) {
resolve((requestOptions.fields = metadata.fields));
});
}
else {
resolve(requestOptions.fields);
}
}).then(function (fields) {
let prms;
if (requestOptions.fields) {
prms = Promise.resolve(requestOptions.fields);
}
else {
prms = getLayer({ url: requestOptions.url }).then((metadata) => {
return metadata.fields;
});
}
return prms.then((fields) => {
// extract coded value domains
var domains = extractCodedValueDomains(fields);
const domains = extractCodedValueDomains(fields);
if (Object.keys(domains).length < 1) {

@@ -43,10 +42,10 @@ // no values to decode

// don't mutate original features
var decodedFeatures = requestOptions.queryResponse.features.map(function (feature) {
var decodedAttributes = {};
for (var key in feature.attributes) {
const decodedFeatures = requestOptions.queryResponse.features.map((feature) => {
const decodedAttributes = {};
for (const key in feature.attributes) {
/* istanbul ignore next */
if (!feature.attributes.hasOwnProperty(key))
if (!Object.prototype.hasOwnProperty.call(feature.attributes, key))
continue;
var value = feature.attributes[key];
var domain = domains[key];
const value = feature.attributes[key];
const domain = domains[key];
decodedAttributes[key] =

@@ -56,11 +55,11 @@ value !== null && domain ? decodeValue(value, domain) : value;

// merge decoded attributes into the feature
return tslib_1.__assign({}, feature, { attributes: decodedAttributes });
return Object.assign(Object.assign({}, feature), { attributes: decodedAttributes });
});
// merge decoded features into the response
return tslib_1.__assign({}, requestOptions.queryResponse, { features: decodedFeatures });
return Object.assign(Object.assign({}, requestOptions.queryResponse), { features: decodedFeatures });
});
}
function extractCodedValueDomains(fields) {
return fields.reduce(function (domains, field) {
var domain = field.domain;
return fields.reduce((domains, field) => {
const domain = field.domain;
if (domain && domain.type === "codedValue") {

@@ -74,3 +73,3 @@ domains[field.name] = domain;

function decodeValue(value, domain) {
var codedValue = domain.codedValues.find(function (d) {
const codedValue = domain.codedValues.find((d) => {
return value === d.code;

@@ -77,0 +76,0 @@ });

@@ -1,39 +0,13 @@

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IEditFeaturesParams, IEditFeatureResult, ISharedQueryParams } from "./helpers";
import { ISharedEditOptions, IEditFeatureResult, ISharedQueryOptions } from "./helpers.js";
/**
* Delete features parameters.
*/
export interface IDeleteFeaturesParams extends IEditFeaturesParams, ISharedQueryParams {
}
/**
* Delete features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.
*
* @param url - Feature service url.
* @param objectIds - 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 {
export interface IDeleteFeaturesOptions extends ISharedEditOptions, ISharedQueryOptions {
/**
* Feature service url.
*/
url: string;
/**
* Array of objectIds to delete.
*/
objectIds: number[];
/**
* Deprecated. Please use `objectIds` instead.
*/
deletes?: number[];
}
/**
* Delete features results.
*/
export interface IDeleteFeaturesResult {
/**
* Array of JSON response Object(s) for each feature deleted.
*/
deleteResults?: IEditFeatureResult[];
}
/**
* ```js

@@ -52,2 +26,4 @@ * import { deleteFeatures } from '@esri/arcgis-rest-feature-service';

*/
export declare function deleteFeatures(requestOptions: IDeleteFeaturesRequestOptions): Promise<IDeleteFeaturesResult>;
export declare function deleteFeatures(requestOptions: IDeleteFeaturesOptions): Promise<{
deleteResults: IEditFeatureResult[];
}>;
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, appendCustomParams, cleanUrl, warn } from "@esri/arcgis-rest-request";
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
/**

@@ -20,14 +19,13 @@ * ```js

export function deleteFeatures(requestOptions) {
var url = cleanUrl(requestOptions.url) + "/deleteFeatures";
const url = `${cleanUrl(requestOptions.url)}/deleteFeatures`;
// edit operations POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
if (options.params.deletes && options.params.deletes.length) {
// mixin, don't overwrite
options.params.objectIds = requestOptions.deletes;
delete options.params.deletes;
warn("The `deletes` parameter is deprecated and will be removed in a future release. Please use `objectIds` instead.");
}
const options = appendCustomParams(requestOptions, [
"where",
"objectIds",
"gdbVersion",
"returnEditMoment",
"rollbackOnFailure"
], { params: Object.assign({}, requestOptions.params) });
return request(url, options);
}
//# sourceMappingURL=delete.js.map

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

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IEditFeatureResult } from "./helpers";
import { IGetLayerOptions, IEditFeatureResult } from "./helpers.js";
/**

@@ -7,8 +6,4 @@ * Request options to for deleting related attachments of a feature by id. See [Delete Attachments](https://developers.arcgis.com/rest/services-reference/delete-attachments.htm) for more information.

*/
export interface IDeleteAttachmentsOptions extends IRequestOptions {
export interface IDeleteAttachmentsOptions extends IGetLayerOptions {
/**
* Feature service url.
*/
url: string;
/**
* Unique identifier of feature to delete related attachment(s).

@@ -23,11 +18,2 @@ */

/**
* `updateAttachment()` request response.
*/
export interface IDeleteAttachmentsResponse {
/**
* Array of standard AGS add/update/edit result Object(s) for the attachment(s).
*/
deleteAttachmentResults: IEditFeatureResult[];
}
/**
* ```js

@@ -47,2 +33,4 @@ * import { deleteAttachments } from '@esri/arcgis-rest-feature-service';

*/
export declare function deleteAttachments(requestOptions: IDeleteAttachmentsOptions): Promise<IDeleteAttachmentsResponse>;
export declare function deleteAttachments(requestOptions: IDeleteAttachmentsOptions): Promise<{
deleteAttachmentResults: IEditFeatureResult[];
}>;
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, cleanUrl } from "@esri/arcgis-rest-request";

@@ -21,7 +20,7 @@ /**

export function deleteAttachments(requestOptions) {
var options = tslib_1.__assign({ params: {} }, requestOptions);
const options = Object.assign({ params: {} }, requestOptions);
// `attachmentIds` --> params: {}
options.params.attachmentIds = requestOptions.attachmentIds;
return request(cleanUrl(options.url) + "/" + options.featureId + "/deleteAttachments", options);
return request(`${cleanUrl(options.url)}/${options.featureId}/deleteAttachments`, options);
}
//# sourceMappingURL=deleteAttachments.js.map

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

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IGetLayerOptions } from "./helpers.js";
/**

@@ -6,8 +6,4 @@ * Request options to fetch `attachmentInfos` of a feature by id. See [Attachment Infos](https://developers.arcgis.com/rest/services-reference/attachment-infos-feature-service-.htm) for more information.

*/
export interface IGetAttachmentsOptions extends IRequestOptions {
export interface IGetAttachmentsOptions extends IGetLayerOptions {
/**
* Feature service url.
*/
url: string;
/**
* Unique identifier of feature to request related `attachmentInfos`.

@@ -27,11 +23,2 @@ */

/**
* `getAttachments()` request response.
*/
export interface IGetAttachmentsResponse {
/**
* Array of `attachmentInfo` Object(s) for each related attachment. Empty Array means no attachments.
*/
attachmentInfos: IAttachmentInfo[];
}
/**
* ```js

@@ -50,2 +37,4 @@ * import { getAttachments } from '@esri/arcgis-rest-feature-service';

*/
export declare function getAttachments(requestOptions: IGetAttachmentsOptions): Promise<IGetAttachmentsResponse>;
export declare function getAttachments(requestOptions: IGetAttachmentsOptions): Promise<{
attachmentInfos: IAttachmentInfo[];
}>;

@@ -19,5 +19,6 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.

export function getAttachments(requestOptions) {
const options = Object.assign({ httpMethod: "GET" }, requestOptions);
// pass through
return request(cleanUrl(requestOptions.url) + "/" + requestOptions.featureId + "/attachments", requestOptions);
return request(`${cleanUrl(options.url)}/${options.featureId}/attachments`, options);
}
//# sourceMappingURL=getAttachments.js.map

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

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { ILayerDefinition } from "@esri/arcgis-rest-common-types";
import { IGetLayerOptions, ILayerDefinition } from "./helpers.js";
/**

@@ -7,3 +6,5 @@ * ```js

* //
* getLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0")
* getLayer({
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"
* })
* .then(response) // { name: "311", id: 0, ... }

@@ -13,5 +14,5 @@ * ```

*
* @param requestOptions - Options for the request.
* @param options - Options for the request.
* @returns A Promise that will resolve with the addFeatures response.
*/
export declare function getLayer(url: string, requestOptions?: IRequestOptions): Promise<ILayerDefinition>;
export declare function getLayer(options: IGetLayerOptions): Promise<ILayerDefinition>;

@@ -8,3 +8,5 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.

* //
* getLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0")
* getLayer({
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"
* })
* .then(response) // { name: "311", id: 0, ... }

@@ -14,8 +16,8 @@ * ```

*
* @param requestOptions - Options for the request.
* @param options - Options for the request.
* @returns A Promise that will resolve with the addFeatures response.
*/
export function getLayer(url, requestOptions) {
return request(cleanUrl(url), requestOptions);
export function getLayer(options) {
return request(cleanUrl(options.url), options);
}
//# sourceMappingURL=getLayer.js.map

@@ -1,7 +0,22 @@

import { appendCustomParams } from "@esri/arcgis-rest-request";
import { esriGeometryType, SpatialRelationship, IGeometry, ISpatialReference } from "@esri/arcgis-rest-common-types";
export interface ISharedQueryParams {
import { IRequestOptions, GeometryType, IGeometry, ISpatialReference, IHasZM, IExtent, IField, IFeature } from "@esri/arcgis-rest-request";
/**
* The spatial relationship used to compare input geometries
*/
export declare type SpatialRelationship = "esriSpatialRelIntersects" | "esriSpatialRelContains" | "esriSpatialRelCrosses" | "esriSpatialRelEnvelopeIntersects" | "esriSpatialRelIndexIntersects" | "esriSpatialRelOverlaps" | "esriSpatialRelTouches" | "esriSpatialRelWithin";
/**
* Base options for making requests against feature layers
*/
export interface IGetLayerOptions extends IRequestOptions {
/**
* Layer service url.
*/
url: string;
}
export interface ISharedQueryOptions extends IGetLayerOptions {
/**
* A where clause for the query. Defaults to "1=1"
*/
where?: string;
geometry?: IGeometry;
geometryType?: esriGeometryType;
geometryType?: GeometryType;
inSR?: string | ISpatialReference;

@@ -19,5 +34,24 @@ spatialRel?: SpatialRelationship;

/**
* Common add and update features parameters.
* `globalId` always returned with attachments via apply edits.
*/
export interface IEditFeaturesParams {
export interface IApplyEditsAttachmentResult extends IEditFeatureResult {
globalId: string;
}
/**
* Apply edits result Object.
*/
export interface IApplyEditsResult {
addResults: IEditFeatureResult[];
updateResults: IEditFeatureResult[];
deleteResults: IEditFeatureResult[];
attachments?: {
addResults?: IApplyEditsAttachmentResult[];
updateResults?: IApplyEditsAttachmentResult[];
deleteResults?: IApplyEditsAttachmentResult[];
};
}
/**
* Common add, update, and delete features options.
*/
export interface ISharedEditOptions extends IGetLayerOptions {
/**

@@ -36,2 +70,563 @@ * The geodatabase version to apply the edits.

}
export { appendCustomParams };
/**
* Return the service url. If not matched, returns what was passed in
*/
export declare function parseServiceUrl(url: string): string;
export interface IStatisticDefinition {
/**
* Statistical operation to perform (count, sum, min, max, avg, stddev, var, percentile_cont, percentile_disc).
*/
statisticType: "count" | "sum" | "min" | "max" | "avg" | "stddev" | "var" | "percentile_cont" | "percentile_disc";
/**
* Parameters to be used along with statisticType. Currently, only applicable for percentile_cont (continuous percentile) and percentile_disc (discrete percentile).
*/
statisticParameters?: {
value: number;
orderBy?: "asc" | "desc";
};
/**
* 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;
}
export interface ILayer {
/** A unique identifying string for the layer. */
id: any;
/** Layer name */
name?: string;
/** Optional string containing the item ID of the service if it's registered on ArcGIS Online or your organization's portal. */
itemId?: string;
/** Indicates the layer type */
layerType: string;
/** Integer property used to determine the maximum scale at which the layer is displayed. */
maxScale?: number;
/** Integer property used to determine the minimum scale at which the layer is displayed. */
minScale?: number;
/** The degree of transparency applied to the layer on the client side, where 0 is full transparency and 1 is no transparency. */
opacity?: number;
/** Boolean property indicating whether to display in the legend. */
showLegend?: boolean;
/** A user-friendly string title for the layer that can be used in a table of contents. */
title?: string;
/**
* Deprecated, use layerType instead.
* @deprecated
*/
type?: string;
/** Boolean property determining whether the layer is initially visible in the web map. */
visibility?: boolean;
/** The URL to the layer. Not applicable to all layer types. */
url?: string;
}
/**
* Very generic structure representing the return value from the
* /arcgis/rest/admin/services/<service-name>/FeatureServer?f=json response
*/
export interface IServiceInfo extends Record<string, unknown> {
adminServiceInfo: {
name: string;
type: string;
status: string;
database: {
datasource: {
name: string;
};
};
};
layers: Record<string, unknown>[];
}
/**
* Individual View Source entry
*/
export interface IViewServiceSource {
name: string;
type: string;
url: string;
serviceItemId: string;
}
/**
* Response from the /sources end-point of a view service
*/
export interface IViewServiceSources {
currentVersion: number;
services: IViewServiceSource[];
}
/**
* `IFeatureServiceDefinition` can also be imported from the following packages:
*
* ```js
* import { IFeatureServiceDefinition } from "@esri/arcgis-rest-service-admin";
* import { IFeatureServiceDefinition } from "@esri/arcgis-rest-feature-service";
* ```
*/
export interface IFeatureServiceDefinition {
currentVersion?: number;
serviceDescription: string;
hasVersionedData: boolean;
supportsDisconnectedEditing: boolean;
supportsReturnDeleteResults: boolean;
/** Boolean value indicating whether data changes. True if it does not. */
hasStaticData?: boolean;
/** Numeric value indicating tbe maximum number of records that will be returned at once for a query. */
maxRecordCount: number;
/** String value indicating the output formats that are supported in a query. */
supportedQueryFormats: string;
supportsRelationshipsResource: boolean;
/** A comma separated list of supported capabilities, e.g. Query,Editing. */
capabilities: string;
/** String value of the layer as defined in the map service. */
description: string;
/** String value for the copyright text information for the layer. */
copyrightText: string;
advancedEditingCapabilities: {
[key: string]: boolean;
};
/** An object containing the WKID or WKT identifying the spatial reference of the layer's geometry. */
spatialReference: ISpatialReference;
initialExtent: IExtent;
fullExtent: IExtent;
/** Boolean value indicating whether the geometry of the features in the layer can be edited. */
allowGeometryUpdates: boolean;
units: string;
syncEnabled: boolean;
returnServiceEditsHaveSR?: boolean;
validationSystemLayers: {
validationPointErrorlayerId: number;
validationLineErrorlayerId: number;
validationPolygonErrorlayerId: number;
validationObjectErrortableId: number;
};
extractChangesCapabilities: {
supportsReturnIdsOnly: boolean;
supportsReturnExtentOnly: boolean;
supportsReturnAttachments: boolean;
supportsLayerQueries: boolean;
supportsSpatialFilter: boolean;
supportsReturnFeature: boolean;
};
syncCapabilities: {
supportsASync: boolean;
supportsRegisteringExistingData: boolean;
supportsSyncDirectionControl: boolean;
supportsPerLayerSync: boolean;
supportsPerReplicaSync: boolean;
supportsRollbackOnFailure: boolean;
supportedSyncDataOptions: number;
};
editorTrackingInfo: {
enableEditorTracking: boolean;
enableOwnershipAccessControl: boolean;
allowOthersToUpdate: boolean;
allowOthersToDelete: boolean;
};
documentInfo?: {
[key: string]: string;
};
layers: ILayerDefinition[];
tables: ITable[];
relationships: [
{
id: number;
name: string;
backwardPathLabel: string;
originLayerId: number;
originPrimaryKey: string;
forwardPathLabel: string;
destinationLayerId: number;
originForeignKey: string;
relationshipTableId: number;
destinationPrimaryKey: string;
destinationForeignKey: string;
rules: [
{
ruleID: number;
originSubtypeCode: number;
originMinimumCardinality: number;
originMaximumCardinality: number;
destinationSubtypeCode: number;
destinationMinimumCardinality: number;
destinationMaximumCardinality: number;
}
];
cardinality: "esriRelCardinalityOneToOne" | "esriRelCardinalityOneToMany" | "esriRelCardinalityManyToMany";
attributed: boolean;
composite: boolean;
}
];
enableZDefaults?: boolean;
isLocationTrackingService: boolean;
isLocationTrackingView: boolean;
zDefault?: number;
}
/**
* Root element in the web map specifying an array of table objects.
*
* `ITable` can also be imported from the following packages:
*
* ```js
* import { ITable } from "@esri-arcgis-rest-service-admin"
* ```
*/
export interface ITable {
/** Table name */
name?: string;
/** A comma-separated string listing which editing operations are allowed on an editable feature service. Available operations include: 'Create', 'Delete', 'Query', 'Update', and 'Editing'. */
capabilities?: string;
/** Object indicating the definitionEditor used as a layer's interactive filter. */
definitionEditor?: IDefinitionEditor;
/** Unique identifier for the table. */
id?: number;
/** Unique string value indicating an item registered in ArcGIS Online or your organization's portal. */
itemId?: string;
/** A layerDefinition object defining a definition expression for the table. */
layerDefinition?: ILayerDefinition;
/** An object defining the content of popup windows when you query a record and the sort option for child related records. */
popupInfo?: IPopupInfo;
/** String value for the title of the table. */
title?: string;
/** String value indicating the URL reference of the hosted table. */
url?: string;
}
export interface IDefinitionParameter {
/** The default value that is automatically given if nothing is provided. */
defaultValue?: number | string;
/** A string value representing the name of the field to query. */
fieldName?: string;
/** Number given to uniquely identify the specified parameter. */
parameterId?: any;
/** The field type for the specified field parameter. */
type?: "esriFieldTypeBlob" | "esriFieldTypeDate" | "esriFieldTypeDouble" | "esriFieldTypeGeometry" | "esriFieldTypeGlobalID" | "esriFieldTypeGUID" | "esriFieldTypeInteger" | "esriFieldTypeOID" | "esriFieldTypeRaster" | "esriFieldTypeSingle" | "esriFieldTypeSmallInteger" | "esriFieldTypeString" | "esriFieldTypeXML";
/** An integer value representing exact UNIX time used when defaultValue is a date string. */
utcValue?: number;
}
export interface IDefinitionInput {
/** A string value representing a hint for the input. */
hint?: string;
/** An array of parameter objects. */
parameters?: IDefinitionParameter[];
/** A string value representing the prompt for the input. */
prompt?: string;
}
/**
* The definitionEditor stores interactive filters at the same level as layerDefinition.
*/
export interface IDefinitionEditor {
/** An array of input objects. */
inputs?: IDefinitionInput[];
/** A string value representing the where clause for the interactive filter. */
parameterizedExpression?: string;
}
/**
* Arcade expression added to the pop-up.
*/
export interface IPopupExpressionInfo {
/** The Arcade expression. */
expression?: string;
/** Unique identifier for the expression. */
name?: string;
/** Return type of the Arcade expression, can be number or string. Defaults to string value. Number values are assumed to be double. This can be determined by the authoring client by executing the expression using a sample feature(s), although it can be corrected by the user. Knowing the returnType allows the authoring client to present fields in relevant contexts. For example, numeric fields in numeric contexts such as charts. */
returnType?: "number" | "string";
/** Title of the expression. */
title?: string;
}
/**
* The format object can be used with numerical or date fields to provide more detail about how values should be displayed in popup windows.
*/
export interface IFieldFormat {
/** A string used with date fields to specify how the date should appear in popup windows. */
dateFormat?: "shortDate" | "shortDateLE" | "longMonthDayYear" | "dayShortMonthYear" | "longDate" | "shortDateShortTime" | "shortDateLEShortTime" | "shortDateShortTime24" | "shortDateLEShortTime24" | "shortDateLongTime" | "shortDateLELongTime" | "shortDateLongTime24" | "shortDateLELongTime24" | "longMonthYear" | "shortMonthYear" | "year";
/**
* A Boolean used with numerical fields. A value of true allows the number to have a digit (or thousands) separator when the value appears in popup windows.
* Depending on the locale, this separator is a decimal point or a comma. A value of false means that no separator will be used.
*/
digitSeparator?: boolean;
/**
* An integer used with numerical fields to specify the number of supported decimal places that should appear in popup windows. Any places beyond this value are rounded.
*/
places?: number;
}
/**
* Defines how a field in the dataset participates (or does not participate) in a popup window.
*/
export interface IFieldInfo {
/** A string containing the field name as defined by the service. Anywhere that a fieldname is referenced as {field-name} in popupInfo, an Arcade expression can also be referenced as{expression/}`. */
fieldName?: any;
/** A format object used with numerical or date fields to provide more detail about how the value should be displayed in a web map popup window. */
format?: IFieldFormat;
/** A Boolean determining whether users can edit this field. Not applicable to Arcade expressions. */
isEditable?: boolean;
/** A string containing the field alias. This can be overridden by the web map author. Not applicable to Arcade expressions as title is used instead. */
label?: string;
/** A string determining what type of input box editors see when editing the field. Applies only to string fields. Not applicable to Arcade expressions. */
stringFieldOption?: "textbox" | "textarea" | "richtext";
/** A string providing an editing hint for editors of the field. Not applicable to Arcade expressions. */
tooltip?: string;
/** A Boolean determining whether the field is visible in the popup window. */
visible?: boolean;
}
/**
* Defines the look and feel of popup windows when a user clicks or queries a feature.
*/
export interface IPopupInfo {
/** A string that appears in the body of the popup window as a description. It is also possible to specify the description as HTML-formatted content. */
description?: string | null;
/** List of Arcade expressions added to the pop-up. */
expressionInfos?: IPopupExpressionInfo[];
/** Array of fieldInfo information properties. This information is provided by the service layer definition. When the description uses name/value pairs, the order of the array is how the fields display in the editable Map Viewer popup and the resulting popup. It is also possible to specify HTML-formatted content. */
fieldInfos?: IFieldInfo[];
/** Additional options that can be defined for the popup layer. */
layerOptions?: {
/** Indicates whether or not the NoData records should be displayed. */
showNoDataRecords: boolean;
};
/** Array of various mediaInfo to display. Can be of type image, piechart, barchart, columnchart, or linechart. The order given is the order in which is displays. */
mediaInfos?: IMediaInfo[];
/** An array of popupElement objects that represent an ordered list of popup elements. */
popupElements?: IPopupElement[];
/** Indicates whether to enable related records if they exist on a layer. */
relatedRecordsInfo?: IRelatedRecordsInfo;
/** Indicates whether attachments will be loaded for feature layers that have attachments. */
showAttachments?: boolean;
/** A string that appears at the top of the popup window as a title. */
title?: string;
}
/**
* The sort in the popupInfo for the parent feature. This impacts the sorting order for the returned child records.
*/
export interface IRelatedRecordsInfo {
/** Array of orderByFields objects indicating the field display order for the related records and whether they should be sorted in ascending 'asc' or descending 'desc' order. */
orderByFields?: IOrderByField[];
/** Required boolean value indicating whether to display related records. If true, client should let the user navigate to the related records. Defaults to true if the layer participates in a relationship AND the related layer/table has already been added to the map (either as an operationalLayer or as a table). */
showRelatedRecords: boolean;
}
/**
* Object indicating the field display order for the related records and whether they should be sorted in ascending or descending order.
*/
export interface IOrderByField {
/** The attribute value of the field selected that will drive the sorting of related records. */
field?: string;
/** Set the ascending or descending sort order of the returned related records. */
order?: "asc" | "desc";
}
/**
* The value object contains information for popup windows about how images should be retrieved or charts constructed.
*/
export interface IMediaInfoValue {
/** Used with charts. An array of strings, with each string containing the name of a field to display in the chart. */
fields?: string[];
/** Used with images. A string containing a URL to be launched in a browser when a user clicks the image. */
linkURL?: string;
/** Used with charts. An optional string containing the name of a field. The values of all fields in the chart will be normalized (divided) by the value of this field. */
normalizeField?: string;
/** Used with images. A string containing the URL to the image. */
sourceURL?: string;
/** String value indicating the tooltip for a chart specified from another field. This field is needed when related records are not sued. It is used for showing tooltips from another field in the same layer or related layer/table. */
tooltipField?: string;
}
/**
* Defines an image or a chart to be displayed in a popup window.
*/
export interface IMediaInfo {
/** A string caption describing the media. */
caption?: any;
/** Refresh interval of the layer in minutes. Non-zero value indicates automatic layer refresh at the specified interval. Value of 0 indicates auto refresh is not enabled. If the property does not exist, it's equivalent to having a value of 0. Only applicable when type is set to image. */
refreshInterval?: any;
/** A string title for the media. */
title?: string | null;
/** A string defining the type of media. */
type?: "image" | "barchart" | "columnchart" | "linechart" | "piechart";
/** A value object containing information about how the image should be retrieved or how the chart should be constructed. */
value?: IMediaInfoValue | null;
}
/**
* Popup elements allow users to author popups, using multiple elements such as tabular views, string description, media (charts and images), and attachments of the attributes
* and control the order in which they appear. Specifically, popupElements do the following:
* 1) provide the ability to explicitly add a field/ value table in addition to a description,
* 2) allow adding multiple description elements, and
* 3) allow a user to author and consume elements of a popup in the order of their choosing.
*/
export interface IPopupElement {
/**
* This property applies to elements of type attachments. A string value indicating how to display the attachment.
* Possible values are, preview, and list. If list is specified, attachments show as links.
*/
displayType?: "preview" | "list";
/**
* This property applies to elements of type fields. It is an array of popupInfo.fieldInfo objects representing a field/value pair displayed as a table within the popupElement.
* If the fieldInfos property is not provided, the popupElement will display whatever is specified directly in the popupInfo.fieldInfos property.
*/
fieldInfos?: IFieldInfo[];
/**
* This property applies to elements of type media. An array of popupInfo.mediaInfo objects representing an image or chart for display.
* If no mediaInfos property is provided, the popupElement will display whatever is specified in the popupInfo.mediaInfo property.
*/
mediaInfos?: IMediaInfo[];
/**
* This property applies to elements of type text. This is string value indicating the text to be displayed within the popupElement.
* If no text property is provided, the popupElement will display whatever is specified in the popupInfo.description property.
*/
text?: string;
/** String value indicating which elements to use. */
type?: "text" | "fields" | "media" | "attachments";
}
export interface IEditingInfo {
/** date of last edit to the layer */
lastEditDate?: number;
}
export declare type FeatureEditTool = "esriFeatureEditToolAutoCompletePolygon" | "esriFeatureEditToolPolygon" | "esriFeatureEditToolTriangle" | "esriFeatureEditToolRectangle" | "esriFeatureEditToolLeftArrow" | "esriFeatureEditToolRightArrow" | "esriFeatureEditToolEllipse" | "esriFeatureEditToolUpArrow" | "esriFeatureEditToolDownArrow" | "esriFeatureEditToolCircle" | "esriFeatureEditToolFreehand" | "esriFeatureEditToolLine" | "esriFeatureEditToolNone" | "esriFeatureEditToolText" | "esriFeatureEditToolPoint";
/**
* Templates describe features that can be created in a layer. They are generally used with feature collections and editable web-based CSV layers.
* Templates are not used with ArcGIS feature services as these already have templates defined in the service. They are also defined as properties
* of the layer definition when there are no defined types. Otherwise, templates are defined as properties of the types.
*/
export interface ITemplate {
/** A string value containing a detailed description of the template. */
description?: any;
/**
* An optional string that can define a client-side drawing tool to be used with this feature. For example, map notes used by the Online Map Viewer use this to represent the viewer's different drawing tools.
*/
drawingTool?: FeatureEditTool;
/** A string containing a user-friendly name for the template. */
name?: string;
/** A feature object representing a prototypical feature for the template. */
prototype?: IFeature;
}
/**
* `ILayerDefinition` can also be imported from the following packages:
*
* ```js
* import { ILayerDefinition } from "@esri/arcgis-rest-service-admin";
* import { ILayerDefinition } from "@esri/arcgis-rest-feature-service";
* ```
*/
export interface ILayerDefinition extends IHasZM {
/** Boolean value indicating whether the geometry of the features in the layer can be edited. */
allowGeometryUpdates?: boolean;
/** A comma separated list of supported capabilities, e.g. Query,Editing. */
capabilities?: string;
/** String value for the copyright text information for the layer. */
copyrightText?: string;
/** Numeric value indicating the server version of the layer. */
currentVersion?: number;
/** Boolean value indicating whether the layer's visibility is turned on. */
defaultVisibility?: boolean;
/** Stores interactive filters. */
definitionEditor?: IDefinitionEditor;
/** SQL-based definition expression string that narrows the data to be displayed in the layer. */
definitionExpression?: string;
/** String value of the layer as defined in the map service. */
description?: string;
/** A string value that summarizes the feature. */
displayField?: string;
/** Contains drawing, labeling, and transparency information. */
drawingInfo?: any;
/** An object defining the rectangular area. */
extent?: IExtent | null;
/** An object defining the editing info (last edit date). */
editingInfo?: IEditingInfo;
/** Feature reductions declutter the screen by hiding features that would otherwise intersect with other features on screen. */
featureReduction?: any;
/** An array of field objects containing information about the attribute fields for the feature collection or layer. */
fields?: IField[];
/** A string defining the type of geometry. Possible geometry types are: esriGeometryPoint, esriGeometryMultipoint, esriGeometryPolyline, esriGeometryPolygon, and esriGeometryEnvelope. */
geometryType?: GeometryType;
/** The unique identifier for a feature or table row within a geodatabase. */
globalIdField?: string;
/** Indicates whether attachments should be loaded for the layer. */
hasAttachments?: boolean;
/** Boolean value indicating whether data changes. True if it does not. */
hasStaticData?: boolean;
/** String value indicating the HTML popup type. */
htmlPopupType?: "esriServerHTMLPopupTypeNone" | "esriServerHTMLPopupTypeAsURL" | "esriServerHTMLPopupTypeAsHTMLText";
/** The identifier assigned to the layer. */
id?: number;
/** Boolean value indicating whether the data is versioned. */
isDataVersioned?: boolean;
/** Numeric value indicating tbe maximum number of records that will be returned at once for a query. */
maxRecordCount?: number;
/** Represents the maximum scale at which the layer definition will be applied. This does not apply to layers of type: ArcGISMapServiceLayer, ImageServiceVectorLayer or ImageServiceLayer. */
maxScale?: number;
/** Represents the minimum scale at which the layer definition will be applied. This does not apply to layers of type: ArcGISMapServiceLayer, ImageServiceVectorLayer or ImageServiceLayer. */
minScale?: number;
/** Contains a unique name for the layer that can be displayed in a legend. */
name?: string;
/** Indicates the name of the object ID field in the dataset. */
objectIdField?: string;
/** Dictates whether a client can support having an end user modify symbols on individual features. */
overrideSymbols?: boolean;
/** Indicates range information */
rangeInfos?: any;
/** An object indicating the layerDefinition's layer source. */
source?: any;
/** An object containing the WKID or WKT identifying the spatial reference of the layer's geometry. */
spatialReference?: ISpatialReference;
/** String value indicating the output formats that are supported in a query. */
supportedQueryFormats?: string;
/** Boolean value indicating whether the layer supports orderByFields in a query operation. */
supportsAdvancedQueries?: boolean;
/** Boolean value indicating whether the layer supports uploading attachments with the Uploads operation. This can then be used in the Add Attachment and Update Attachment operations. */
supportsAttachmentsByUploadId?: boolean;
/** Boolean value indicating whether the layer supports the Calculate REST operation when updating features. */
supportsCalculate?: boolean;
/** Boolean value indicating whether the layer supports rolling back edits made on a feature layer if some of the edits fail. */
supportsRollbackOnFailureParameter?: boolean;
/** Boolean value indicating whether feature layer query operations support statistical functions. */
supportsStatistics?: boolean;
/** Boolean value indicating whether the validateSQL operation is supported across a feature service layer. */
supportsValidateSql?: boolean;
/** A property of the layer definition when there are no types defined; otherwise, templates are defined as properties of the types. */
templates?: ITemplate[];
/** The time info metadata of the layer. May be set for feature layers inside a feature collection item. */
timeInfo?: any;
/** Indicates whether the layerDefinition applies to a Feature Layer or a Table. */
type?: "Feature Layer" | "Table";
/** Contains the name of the field holding the type ID for the features. */
typeIdField?: string;
/** Contains information about an attribute field. */
types?: any;
/** String value indicating the attribute field that is used to control the visibility of a feature.
* If applicable, when rendering a feature the client should use this field to control visibility.
* The field's values are 0 = do not display, 1 = display.
*/
visibilityField?: string;
relationships?: any[];
editFieldsInfo?: {
creationDateField?: string;
creatorField?: string;
editDateField?: string;
editorField?: string;
};
parentLayerId?: number;
ownershipBasedAccessControlForFeatures?: boolean;
syncCanReturnChanges?: boolean;
archivingInfo?: {
supportsQueryWithHistoricMoment?: boolean;
startArchivingMoment?: number;
};
supportsValidateSQL?: boolean;
advancedQueryCapabilities?: {
supportsPagination?: boolean;
supportsTrueCurve?: boolean;
supportsQueryWithDistance?: boolean;
supportsReturningQueryExtent?: boolean;
supportsStatistics?: boolean;
supportsOrderBy?: boolean;
supportsDistinct?: boolean;
supportsSqlExpression?: boolean;
supportsPercentileStatistics?: boolean;
};
allowTrueCurvesUpdates?: boolean;
onlyAllowTrueCurveUpdatesByTrueCurveClients?: boolean;
supportsApplyEditsWithGlobalIds?: boolean;
subtypeField?: string;
indexes?: any[];
dateFieldsTimeReference?: {
timeZone?: string;
respectsDaylightSaving?: boolean;
};
useStandardizedQueries?: boolean;
}

@@ -1,6 +0,21 @@

/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import { appendCustomParams } from "@esri/arcgis-rest-request";
// this function has been moved into @esri/request. it is re-exported here for backwards compatibility
export { appendCustomParams };
import { cleanUrl } from "@esri/arcgis-rest-request";
const serviceRegex = new RegExp(/.+(?:map|feature|image)server/i);
/**
* Return the service url. If not matched, returns what was passed in
*/
export function parseServiceUrl(url) {
const match = url.match(serviceRegex);
if (match) {
return match[0];
}
else {
return stripQueryString(url);
}
}
function stripQueryString(url) {
const stripped = url.split("?")[0];
return cleanUrl(stripped);
}
//# sourceMappingURL=helpers.js.map

@@ -1,11 +0,21 @@

export * from "./query";
export * from "./add";
export * from "./update";
export * from "./delete";
export * from "./getAttachments";
export * from "./addAttachment";
export * from "./updateAttachment";
export * from "./deleteAttachments";
export * from "./queryRelated";
export * from "./getLayer";
export * from "./decodeValues";
export * from "./add.js";
export * from "./addAttachment.js";
export * from "./addToServiceDefinition.js";
export * from "./applyEdits.js";
export * from "./createFeatureService.js";
export * from "./decodeValues.js";
export * from "./delete.js";
export * from "./deleteAttachments.js";
export * from "./getAllLayersAndTables.js";
export * from "./getAttachments.js";
export * from "./getLayer.js";
export * from "./getService.js";
export * from "./getServiceAdminInfo.js";
export * from "./getViewSources.js";
export * from "./helpers.js";
export * from "./query.js";
export * from "./queryRelated.js";
export * from "./update.js";
export * from "./updateAttachment.js";
export * from "./updateServiceDefinition.js";
export type { IFeature, ISpatialReference, IHasZM, GeometryType, IField, IFeatureSet, Units, IExtent, IGeometry } from "@esri/arcgis-rest-request";

@@ -1,14 +0,23 @@

/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
/* Copyright (c) 2018-2019 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
export * from "./query";
export * from "./add";
export * from "./update";
export * from "./delete";
export * from "./getAttachments";
export * from "./addAttachment";
export * from "./updateAttachment";
export * from "./deleteAttachments";
export * from "./queryRelated";
export * from "./getLayer";
export * from "./decodeValues";
export * from "./add.js";
export * from "./addAttachment.js";
export * from "./addToServiceDefinition.js";
export * from "./applyEdits.js";
export * from "./createFeatureService.js";
export * from "./decodeValues.js";
export * from "./delete.js";
export * from "./deleteAttachments.js";
export * from "./getAllLayersAndTables.js";
export * from "./getAttachments.js";
export * from "./getLayer.js";
export * from "./getService.js";
export * from "./getServiceAdminInfo.js";
export * from "./getViewSources.js";
export * from "./helpers.js";
export * from "./query.js";
export * from "./queryRelated.js";
export * from "./update.js";
export * from "./updateAttachment.js";
export * from "./updateServiceDefinition.js";
//# sourceMappingURL=index.js.map

@@ -1,13 +0,8 @@

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { ISpatialReference, IFeatureSet, IFeature, esriUnits, IExtent } from "@esri/arcgis-rest-common-types";
import { ISharedQueryParams } from "./helpers";
import { ISpatialReference, IFeatureSet, IFeature, Units, IExtent } from "@esri/arcgis-rest-request";
import { IGetLayerOptions, ISharedQueryOptions, IStatisticDefinition } from "./helpers.js";
/**
* Request options to fetch a feature by id.
*/
export interface IFeatureRequestOptions extends IRequestOptions {
export interface IGetFeatureOptions extends IGetLayerOptions {
/**
* Layer service url.
*/
url: string;
/**
* Unique identifier of the feature.

@@ -17,24 +12,6 @@ */

}
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 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;
export interface IQueryFeaturesOptions extends ISharedQueryOptions {
objectIds?: number[];

@@ -44,3 +21,6 @@ relationParam?: string;

distance?: number;
units?: esriUnits;
units?: Units;
/**
* Attribute fields to include in the response. Defaults to "*"
*/
outFields?: "*" | string[];

@@ -50,2 +30,3 @@ returnGeometry?: boolean;

geometryPrecision?: number;
inSR?: string | ISpatialReference;
outSR?: string | ISpatialReference;

@@ -72,2 +53,8 @@ gdbVersion?: string;

returnExceededLimitFeatures?: boolean;
/**
* Response format. Defaults to "json"
* NOTE: for "pbf" you must also supply `rawResponse: true`
* and parse the response yourself using `response.arrayBuffer()`
*/
f?: "json" | "geojson" | "pbf";
}

@@ -101,3 +88,3 @@ export interface IQueryFeaturesResponse extends IFeatureSet {

*/
export declare function getFeature(requestOptions: IFeatureRequestOptions): Promise<IFeature>;
export declare function getFeature(requestOptions: IGetFeatureOptions): Promise<IFeature>;
/**

@@ -118,2 +105,2 @@ * ```js

*/
export declare function queryFeatures(requestOptions: IQueryFeaturesRequestOptions): Promise<IQueryFeaturesResponse | IQueryResponse>;
export declare function queryFeatures(requestOptions: IQueryFeaturesOptions): Promise<IQueryFeaturesResponse | IQueryResponse>;
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, appendCustomParams, cleanUrl } from "@esri/arcgis-rest-request";
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
/**

@@ -24,6 +23,6 @@ * ```js

export function getFeature(requestOptions) {
var url = cleanUrl(requestOptions.url) + "/" + requestOptions.id;
const url = `${cleanUrl(requestOptions.url)}/${requestOptions.id}`;
// default to a GET request
var options = tslib_1.__assign({ httpMethod: "GET" }, requestOptions);
return request(url, options).then(function (response) {
const options = Object.assign({ httpMethod: "GET" }, requestOptions);
return request(url, options).then((response) => {
if (options.rawResponse) {

@@ -51,13 +50,47 @@ return response;

export function queryFeatures(requestOptions) {
var queryOptions = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions);
appendCustomParams(requestOptions, queryOptions);
// set default query parameters
if (!queryOptions.params.where) {
queryOptions.params.where = "1=1";
}
if (!queryOptions.params.outFields) {
queryOptions.params.outFields = "*";
}
return request(cleanUrl(queryOptions.url) + "/query", queryOptions);
const queryOptions = appendCustomParams(requestOptions, [
"where",
"objectIds",
"relationParam",
"time",
"distance",
"units",
"outFields",
"geometry",
"geometryType",
"spatialRel",
"returnGeometry",
"maxAllowableOffset",
"geometryPrecision",
"inSR",
"outSR",
"gdbVersion",
"returnDistinctValues",
"returnIdsOnly",
"returnCountOnly",
"returnExtentOnly",
"orderByFields",
"groupByFieldsForStatistics",
"outStatistics",
"returnZ",
"returnM",
"multipatchOption",
"resultOffset",
"resultRecordCount",
"quantizationParameters",
"returnCentroid",
"resultType",
"historicMoment",
"returnTrueCurves",
"sqlFormat",
"returnExceededLimitFeatures",
"f"
], {
httpMethod: "GET",
params: Object.assign({
// set default query parameters
where: "1=1", outFields: "*" }, requestOptions.params)
});
return request(`${cleanUrl(requestOptions.url)}/query`, queryOptions);
}
//# sourceMappingURL=query.js.map

@@ -1,8 +0,7 @@

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { ISpatialReference, IFeature, IHasZM, esriGeometryType, IField } from "@esri/arcgis-rest-common-types";
import { ISpatialReference, IFeature, IHasZM, GeometryType, IField } from "@esri/arcgis-rest-request";
import { IGetLayerOptions } from "./helpers.js";
/**
* Related record query request options. Additional arguments can be passed via the [params](/arcgis-rest-js/api/feature-service/IQueryRelatedRequestOptions/#params) property. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-feature-service-.htm) for more information and a full list of parameters.
* Related record query request options. Additional arguments can be passed via the [params](/arcgis-rest-js/api/feature-service/IQueryRelatedOptions/#params) property. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-feature-service-.htm) for more information and a full list of parameters.
*/
export interface IQueryRelatedRequestOptions extends IRequestOptions {
url: string;
export interface IQueryRelatedOptions extends IGetLayerOptions {
relationshipId?: number;

@@ -25,3 +24,3 @@ objectIds?: number[];

export interface IQueryRelatedResponse extends IHasZM {
geometryType?: esriGeometryType;
geometryType?: GeometryType;
spatialReference?: ISpatialReference;

@@ -48,2 +47,2 @@ fields?: IField[];

*/
export declare function queryRelated(requestOptions: IQueryRelatedRequestOptions): Promise<IQueryRelatedResponse>;
export declare function queryRelated(requestOptions: IQueryRelatedOptions): Promise<IQueryRelatedResponse>;
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, appendCustomParams, cleanUrl } from "@esri/arcgis-rest-request";
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
/**

@@ -23,15 +22,10 @@ *

export function queryRelated(requestOptions) {
var options = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions);
appendCustomParams(requestOptions, options);
if (!options.params.definitionExpression) {
options.params.definitionExpression = "1=1";
}
if (!options.params.outFields) {
options.params.outFields = "*";
}
if (!options.params.relationshipId) {
options.params.relationshipId = 0;
}
return request(cleanUrl(options.url) + "/queryRelatedRecords", options);
const options = appendCustomParams(requestOptions, ["objectIds", "relationshipId", "definitionExpression", "outFields"], {
httpMethod: "GET",
params: Object.assign({
// set default query parameters
definitionExpression: "1=1", outFields: "*", relationshipId: 0 }, requestOptions.params)
});
return request(`${cleanUrl(requestOptions.url)}/queryRelatedRecords`, options);
}
//# sourceMappingURL=queryRelated.js.map

@@ -1,17 +0,9 @@

import { IFeature } from "@esri/arcgis-rest-common-types";
import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IEditFeaturesParams, IEditFeatureResult } from "./helpers";
import { IFeature } from "@esri/arcgis-rest-request";
import { ISharedEditOptions, IEditFeatureResult } from "./helpers.js";
/**
* Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.
*
* @param url - Feature service url.
* @param features - 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 {
export interface IUpdateFeaturesOptions extends ISharedEditOptions {
/**
* Feature service url.
*/
url: string;
/**
* Array of JSON features to update.

@@ -21,16 +13,7 @@ */

/**
* Deprecated. Please use `features` instead.
* Optional parameter which is false by default is set by client to indicate to the server that client in true curve capable.
*/
updates?: IFeature[];
trueCurveClient?: boolean;
}
/**
* Update features results.
*/
export interface IUpdateFeaturesResult {
/**
* Array of JSON response Object(s) for each feature updated.
*/
updateResults?: IEditFeatureResult[];
}
/**
*

@@ -53,2 +36,4 @@ * ```js

*/
export declare function updateFeatures(requestOptions: IUpdateFeaturesRequestOptions): Promise<IUpdateFeaturesResult>;
export declare function updateFeatures(requestOptions: IUpdateFeaturesOptions): Promise<{
updateResults: IEditFeatureResult[];
}>;
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, appendCustomParams, cleanUrl, warn } from "@esri/arcgis-rest-request";
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
/**

@@ -24,14 +23,13 @@ *

export function updateFeatures(requestOptions) {
var url = cleanUrl(requestOptions.url) + "/updateFeatures";
const url = `${cleanUrl(requestOptions.url)}/updateFeatures`;
// edit operations are POST only
var options = tslib_1.__assign({ params: {} }, requestOptions);
appendCustomParams(requestOptions, options);
if (options.params.updates && options.params.updates.length) {
// mixin, don't overwrite
options.params.features = requestOptions.updates;
delete options.params.updates;
warn("The `updates` parameter is deprecated and will be removed in a future release. Please use `features` instead.");
}
const options = appendCustomParams(requestOptions, [
"features",
"gdbVersion",
"returnEditMoment",
"rollbackOnFailure",
"trueCurveClient"
], { params: Object.assign({}, requestOptions.params) });
return request(url, options);
}
//# sourceMappingURL=update.js.map

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

import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IEditFeatureResult } from "./helpers";
import { IGetLayerOptions, IEditFeatureResult } from "./helpers.js";
/**

@@ -7,8 +6,4 @@ * Request options to for updating a related attachment to a feature by id. See [Update Attachment](https://developers.arcgis.com/rest/services-reference/update-attachment.htm) for more information.

*/
export interface IUpdateAttachmentOptions extends IRequestOptions {
export interface IUpdateAttachmentOptions extends IGetLayerOptions {
/**
* Feature service url.
*/
url: string;
/**
* Unique identifier of feature to update related attachment.

@@ -27,11 +22,2 @@ */

/**
* `updateAttachment()` request response.
*/
export interface IUpdateAttachmentResponse {
/**
* Standard AGS add/update/edit result Object for the attachment.
*/
updateAttachmentResult: IEditFeatureResult;
}
/**
*

@@ -53,2 +39,4 @@ * ```js

*/
export declare function updateAttachment(requestOptions: IUpdateAttachmentOptions): Promise<IUpdateAttachmentResponse>;
export declare function updateAttachment(requestOptions: IUpdateAttachmentOptions): Promise<{
updateAttachmentResult: IEditFeatureResult;
}>;
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request, cleanUrl } from "@esri/arcgis-rest-request";

@@ -23,8 +22,8 @@ /**

export function updateAttachment(requestOptions) {
var options = tslib_1.__assign({ params: {} }, requestOptions);
const options = Object.assign({ params: {} }, requestOptions);
// `attachment` and `attachmentId` --> params: {}
options.params.attachment = requestOptions.attachment;
options.params.attachmentId = requestOptions.attachmentId;
return request(cleanUrl(options.url) + "/" + options.featureId + "/updateAttachment", options);
return request(`${cleanUrl(options.url)}/${options.featureId}/updateAttachment`, options);
}
//# sourceMappingURL=updateAttachment.js.map
{
"name": "@esri/arcgis-rest-feature-service",
"version": "1.19.2",
"description": "Feature service helpers for @esri/arcgis-rest-request",
"main": "dist/node/index.js",
"unpkg": "dist/umd/feature-service.umd.js",
"version": "4.0.0-beta.2",
"description": "Feature layer query and edit helpers for @esri/arcgis-rest-js",
"license": "Apache-2.0",
"keywords": [
"ES6",
"arcgis",
"esri",
"fetch",
"promise",
"typescript"
],
"type": "module",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"js:next": "dist/esm/index.js",
"unpkg": "dist/bundled/feature-layer.umd.min.js",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
},
"types": "dist/esm/index.d.ts",
"sideEffects": false,
"types": "dist/esm/index.d.ts",
"license": "Apache-2.0",
"files": [
"dist/**"
],
"scripts": {
"build": "npm-run-all --parallel build:*",
"postbuild": "node ../../scripts/create-dist-package-jsons.js",
"build:bundled": "rollup -c ../../rollup.js",
"build:cjs": "tsc --outDir ./dist/cjs -m commonjs",
"build:esm": "tsc --outDir ./dist/esm --declaration",
"dev": "npm-run-all --parallel dev:*",
"dev:bundled": "rollup -w -c ../../rollup.js",
"dev:cjs": "tsc -w --outDir ./dist/cjs -m commonjs",
"dev:esm": "tsc -w --outDir ./dist/esm --declaration"
},
"engines": {
"node": ">=12.20.0"
},
"dependencies": {
"tslib": "^1.9.3"
"tslib": "^2.3.0"
},
"devDependencies": {
"@esri/arcgis-rest-common-types": "^1.19.2",
"@esri/arcgis-rest-request": "^1.19.2"
},
"peerDependencies": {
"@esri/arcgis-rest-common-types": "^1.19.2",
"@esri/arcgis-rest-request": "^1.19.2"
"@esri/arcgis-rest-portal": "4.0.0-beta.2",
"@esri/arcgis-rest-request": "4.0.0-beta.2"
},
"scripts": {
"prepare": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc --module commonjs --outDir ./dist/node",
"dev:esm": "tsc -w --module es2015 --outDir ./dist/esm --declaration",
"dev:umd": "rollup -w -c ../../umd-base-profile.js",
"dev:node": "tsc -w --module commonjs --outDir ./dist/node"
"devDependencies": {
"@esri/arcgis-rest-portal": "4.0.0-beta.2",
"@esri/arcgis-rest-request": "4.0.0-beta.2"
},
"publishConfig": {
"access": "public"
},
"contributors": [
"Mike Tschudi <mtschudi@esri.com>",
"Tom Wayson <twayson@esri.com> (http://tomwayson.com/)"
],
"homepage": "https://github.com/Esri/arcgis-rest-js#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
"url": "git+https://github.com/Esri/arcgis-rest-js.git",
"directory": "packages/arcgis-rest-feature-service"
},
"contributors": [
{
"name": "Tom Wayson",
"email": "twayson@esri.com",
"url": "http://tomwayson.com/"
}
],
"bugs": {
"url": "https://github.com/Esri/arcgis-rest-js/issues"
},
"homepage": "https://github.com/Esri/arcgis-rest-js#readme",
"keywords": [
"typescript",
"promise",
"fetch",
"arcgis",
"esri",
"ES6"
]
"publishConfig": {
"access": "public"
}
}

@@ -11,3 +11,3 @@ [![npm version][npm-img]][npm-url]

[travis-url]: https://travis-ci.org/Esri/arcgis-rest-js
[gzip-image]: https://img.badgesize.io/https://unpkg.com/@esri/arcgis-rest-feature-service/dist/umd/feature-service.umd.min.js?compression=gzip
[gzip-image]: https://img.badgesize.io/https://unpkg.com/@esri/arcgis-rest-feature-service/dist/bundled/feature-layer.umd.min.js?compression=gzip
[coverage-img]: https://codecov.io/gh/Esri/arcgis-rest-js/branch/master/graph/badge.svg

@@ -18,3 +18,3 @@ [coverage-url]: https://codecov.io/gh/Esri/arcgis-rest-js

> A module for working with ArcGIS feature services that runs in Node.js and modern browsers.
> A module for querying, editing, and administering hosted feature layers and feature services.

@@ -29,21 +29,19 @@ ### Example

```js
import { getFeature } from '@esri/arcgis-rest-feature-service';
import { queryFeatures } from '@esri/arcgis-rest-feature-service';
const options = {
url:
"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0",
id: 42
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0",
where: "Species = 'Oak'"
};
getFeature(options)
.then(feature => {
console.log(feature.attributes.FID); // 42
});
queryFeatures(options).then((response) => {
console.log(response.features.length); // 500
});
```
### [API Reference](https://esri.github.io/arcgis-rest-js/api/feature-service/)
### [API Reference](https://esri.github.io/arcgis-rest-js/api/feature-layer/)
### Issues
If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/arcgis-rest-js/issues) first. Have you found a new bug? Want to request a new feature? We'd [**love**](https://github.com/Esri/arcgis-rest-js/issues/new) to hear from you.
If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/arcgis-rest-js/issues) first. Have you found a new bug? Want to request a new feature? We'd [**love**](https://github.com/Esri/arcgis-rest-js/issues/new) to hear from you.

@@ -50,0 +48,0 @@ If you're looking for help you can also post issues on [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-oss).

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