@esri/arcgis-rest-feature-service
Advanced tools
| import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
| import { IField } from "@esri/arcgis-rest-common-types"; | ||
| import { IQueryFeaturesResponse } from "./query"; | ||
| /** | ||
| * Request options to fetch a feature by id. | ||
| */ | ||
| export interface IDecodeValuesRequestOptions extends IRequestOptions { | ||
| /** | ||
| * Layer service url. | ||
| */ | ||
| url: string; | ||
| /** | ||
| * Unique identifier of the feature. | ||
| */ | ||
| queryResponse: IQueryFeaturesResponse; | ||
| /** | ||
| * * If a fieldset is provided, no internal metadata check will be issued to gather info about coded value domains. | ||
| * | ||
| * getFeatureService(url) | ||
| * .then(metadata => { | ||
| * queryFeatures({ url }) | ||
| * .then(response => { | ||
| * decodeValues({ | ||
| * url, | ||
| * queryResponse, | ||
| * fields: metadata.fields | ||
| * }) | ||
| * .then(decodedResponse) | ||
| * }) | ||
| * }) | ||
| */ | ||
| fields?: IField[]; | ||
| } | ||
| /** | ||
| * Replaces the raw coded domain values in a query response with descriptions (for legibility). | ||
| * | ||
| * ```js | ||
| * import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * queryFeatures({ url }) | ||
| * .then(queryResponse => { | ||
| * decodeValues({ | ||
| * url, | ||
| * queryResponse | ||
| * }) | ||
| * .then(decodedResponse) | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| export declare function decodeValues(requestOptions: IDecodeValuesRequestOptions): Promise<IQueryFeaturesResponse>; |
| /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
| import { getLayer } from "./getLayer"; | ||
| /** | ||
| * Replaces the raw coded domain values in a query response with descriptions (for legibility). | ||
| * | ||
| * ```js | ||
| * import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * queryFeatures({ url }) | ||
| * .then(queryResponse => { | ||
| * decodeValues({ | ||
| * url, | ||
| * queryResponse | ||
| * }) | ||
| * .then(decodedResponse) | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| 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) { | ||
| // turn the fields array into a POJO to avoid multiple calls to Array.find() | ||
| var fieldsObject = {}; | ||
| var fieldsArray = fields; | ||
| fieldsArray.forEach(function (field) { | ||
| fieldsObject[field.name] = field; | ||
| }); | ||
| // dont mutate original response | ||
| var clonedResponse = JSON.parse(JSON.stringify(requestOptions.queryResponse)); | ||
| clonedResponse.features.forEach(function (feature) { | ||
| for (var key in feature.attributes) { | ||
| /* istanbul ignore next */ | ||
| if (!feature.attributes.hasOwnProperty(key)) | ||
| continue; | ||
| feature.attributes[key] = convertAttribute(feature.attributes, fieldsObject[key]); | ||
| } | ||
| }); | ||
| return clonedResponse; | ||
| }); | ||
| } | ||
| /** | ||
| * ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L193-L220 | ||
| * | ||
| * Decodes an attributes CVD and standardizes any date fields | ||
| * | ||
| * @params {object} attribute - a single esri feature attribute | ||
| * @params {object} field - the field metadata describing that attribute | ||
| * @returns {object} outAttribute - the converted attribute | ||
| * @private | ||
| */ | ||
| function convertAttribute(attribute, field) { | ||
| var inValue = attribute[field.name]; | ||
| var value; | ||
| if (inValue === null) | ||
| return inValue; | ||
| if (field.domain && field.domain.type === "codedValue") { | ||
| value = cvd(inValue, field); | ||
| } | ||
| else { | ||
| value = inValue; | ||
| } | ||
| return value; | ||
| } | ||
| /** | ||
| * also ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L222-L235 | ||
| * | ||
| * Looks up a value from a coded domain | ||
| * | ||
| * @params {integer} value - The original field value | ||
| * @params {object} field - metadata describing the attribute field | ||
| * @returns {string/integerfloat} - The decoded field value | ||
| * @private | ||
| */ | ||
| function cvd(value, field) { | ||
| var domain = field.domain.codedValues.find(function (d) { | ||
| return value === d.code; | ||
| }); | ||
| return domain ? domain.name : value; | ||
| } | ||
| //# sourceMappingURL=decodeValues.js.map |
| {"version":3,"file":"decodeValues.js","sourceRoot":"","sources":["../../src/decodeValues.ts"],"names":[],"mappings":"AAAA;gBACgB;AAShB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAiCtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY,CAC1B,cAA2C;IAE3C,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO;QACxB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;YAC1B,OAAO,QAAQ,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,IAAI,CACtD,UAAC,QAA0B;gBACzB,OAAO,CAAC,CAAC,cAAc,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACrD,CAAC,CACF,CAAC;SACH;aAAM;YACL,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SAChC;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,UAAA,MAAM;QACZ,4EAA4E;QAC5E,IAAM,YAAY,GAAQ,EAAE,CAAC;QAC7B,IAAM,WAAW,GAAG,MAAkB,CAAC;QACvC,WAAW,CAAC,OAAO,CAAC,UAAC,KAAa;YAChC,YAA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,IAAI,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACtC,CAAC"} |
| import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
| import { ILayerDefinition } from "@esri/arcgis-rest-common-types"; | ||
| /** | ||
| * Layer (Feature Service) request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) for more information. | ||
| * | ||
| * ```js | ||
| * import { getLayer } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * getLayer(url) | ||
| * .then(response) // { name: "311", id: 0, ... } | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| export declare function getLayer(url: string, requestOptions?: IRequestOptions): Promise<ILayerDefinition>; |
| /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
| import { request } from "@esri/arcgis-rest-request"; | ||
| /** | ||
| * Layer (Feature Service) request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) for more information. | ||
| * | ||
| * ```js | ||
| * import { getLayer } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * getLayer(url) | ||
| * .then(response) // { name: "311", id: 0, ... } | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| export function getLayer(url, requestOptions) { | ||
| return request(url, requestOptions); | ||
| } | ||
| //# sourceMappingURL=getLayer.js.map |
| {"version":3,"file":"getLayer.js","sourceRoot":"","sources":["../../src/getLayer.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EAAE,OAAO,EAAmB,MAAM,2BAA2B,CAAC;AAGrE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAW,EACX,cAAgC;IAEhC,OAAO,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AACtC,CAAC"} |
| "use strict"; | ||
| /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var getLayer_1 = require("./getLayer"); | ||
| /** | ||
| * Replaces the raw coded domain values in a query response with descriptions (for legibility). | ||
| * | ||
| * ```js | ||
| * import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * queryFeatures({ url }) | ||
| * .then(queryResponse => { | ||
| * decodeValues({ | ||
| * url, | ||
| * queryResponse | ||
| * }) | ||
| * .then(decodedResponse) | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| function decodeValues(requestOptions) { | ||
| return new Promise(function (resolve) { | ||
| if (!requestOptions.fields) { | ||
| return getLayer_1.getLayer(requestOptions.url, requestOptions).then(function (metadata) { | ||
| resolve((requestOptions.fields = metadata.fields)); | ||
| }); | ||
| } | ||
| else { | ||
| resolve(requestOptions.fields); | ||
| } | ||
| }).then(function (fields) { | ||
| // turn the fields array into a POJO to avoid multiple calls to Array.find() | ||
| var fieldsObject = {}; | ||
| var fieldsArray = fields; | ||
| fieldsArray.forEach(function (field) { | ||
| fieldsObject[field.name] = field; | ||
| }); | ||
| // dont mutate original response | ||
| var clonedResponse = JSON.parse(JSON.stringify(requestOptions.queryResponse)); | ||
| clonedResponse.features.forEach(function (feature) { | ||
| for (var key in feature.attributes) { | ||
| /* istanbul ignore next */ | ||
| if (!feature.attributes.hasOwnProperty(key)) | ||
| continue; | ||
| feature.attributes[key] = convertAttribute(feature.attributes, fieldsObject[key]); | ||
| } | ||
| }); | ||
| return clonedResponse; | ||
| }); | ||
| } | ||
| exports.decodeValues = decodeValues; | ||
| /** | ||
| * ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L193-L220 | ||
| * | ||
| * Decodes an attributes CVD and standardizes any date fields | ||
| * | ||
| * @params {object} attribute - a single esri feature attribute | ||
| * @params {object} field - the field metadata describing that attribute | ||
| * @returns {object} outAttribute - the converted attribute | ||
| * @private | ||
| */ | ||
| function convertAttribute(attribute, field) { | ||
| var inValue = attribute[field.name]; | ||
| var value; | ||
| if (inValue === null) | ||
| return inValue; | ||
| if (field.domain && field.domain.type === "codedValue") { | ||
| value = cvd(inValue, field); | ||
| } | ||
| else { | ||
| value = inValue; | ||
| } | ||
| return value; | ||
| } | ||
| /** | ||
| * also ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L222-L235 | ||
| * | ||
| * Looks up a value from a coded domain | ||
| * | ||
| * @params {integer} value - The original field value | ||
| * @params {object} field - metadata describing the attribute field | ||
| * @returns {string/integerfloat} - The decoded field value | ||
| * @private | ||
| */ | ||
| function cvd(value, field) { | ||
| var domain = field.domain.codedValues.find(function (d) { | ||
| return value === d.code; | ||
| }); | ||
| return domain ? domain.name : value; | ||
| } | ||
| //# sourceMappingURL=decodeValues.js.map |
| {"version":3,"file":"decodeValues.js","sourceRoot":"","sources":["../../src/decodeValues.ts"],"names":[],"mappings":";AAAA;gBACgB;;AAShB,uCAAsC;AAiCtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,YAAY,CAC1B,cAA2C;IAE3C,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO;QACxB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;YAC1B,OAAO,mBAAQ,CAAC,cAA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KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IAErC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE;QACtD,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC7B;SAAM;QACL,KAAK,GAAG,OAAO,CAAC;KACjB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;GASG;AAEH,SAAS,GAAG,CAAC,KAAU,EAAE,KAAa;IACpC,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,UAAC,CAAM;QAClD,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACtC,CAAC"} |
| "use strict"; | ||
| /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var arcgis_rest_request_1 = require("@esri/arcgis-rest-request"); | ||
| /** | ||
| * Layer (Feature Service) request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) for more information. | ||
| * | ||
| * ```js | ||
| * import { getLayer } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * getLayer(url) | ||
| * .then(response) // { name: "311", id: 0, ... } | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| function getLayer(url, requestOptions) { | ||
| return arcgis_rest_request_1.request(url, requestOptions); | ||
| } | ||
| exports.getLayer = getLayer; | ||
| //# sourceMappingURL=getLayer.js.map |
| {"version":3,"file":"getLayer.js","sourceRoot":"","sources":["../../src/getLayer.ts"],"names":[],"mappings":";AAAA;gBACgB;;AAEhB,iEAAqE;AAGrE;;;;;;;;;;;;;;GAcG;AACH,SAAgB,QAAQ,CACtB,GAAW,EACX,cAAgC;IAEhC,OAAO,6BAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AACtC,CAAC;AALD,4BAKC"} |
@@ -10,1 +10,3 @@ export * from "./query"; | ||
| export * from "./queryRelated"; | ||
| export * from "./getLayer"; | ||
| export * from "./decodeValues"; |
@@ -12,2 +12,4 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| export * from "./queryRelated"; | ||
| export * from "./getLayer"; | ||
| export * from "./decodeValues"; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"} |
@@ -109,3 +109,3 @@ import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
| * url, | ||
| * where: "STATE_NAME = 'Alaska" | ||
| * where: "STATE_NAME = 'Alaska'" | ||
| * }).then(result => { | ||
@@ -112,0 +112,0 @@ * console.log(result.features); // array of features |
+9
-10
@@ -1,2 +0,2 @@ | ||
| /* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
| /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
@@ -40,3 +40,3 @@ import * as tslib_1 from "tslib"; | ||
| * url, | ||
| * where: "STATE_NAME = 'Alaska" | ||
| * where: "STATE_NAME = 'Alaska'" | ||
| * }).then(result => { | ||
@@ -51,14 +51,13 @@ * console.log(result.features); // array of features | ||
| export function queryFeatures(requestOptions) { | ||
| // default to a GET request | ||
| var options = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
| appendCustomParams(requestOptions, options); | ||
| var queryOptions = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
| appendCustomParams(requestOptions, queryOptions); | ||
| // set default query parameters | ||
| if (!options.params.where) { | ||
| options.params.where = "1=1"; | ||
| if (!queryOptions.params.where) { | ||
| queryOptions.params.where = "1=1"; | ||
| } | ||
| if (!options.params.outFields) { | ||
| options.params.outFields = "*"; | ||
| if (!queryOptions.params.outFields) { | ||
| queryOptions.params.outFields = "*"; | ||
| } | ||
| return request(options.url + "/query", options); | ||
| return request(queryOptions.url + "/query", queryOptions); | ||
| } | ||
| //# sourceMappingURL=query.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/query.ts"],"names":[],"mappings":"AAAA;gBACgB;;AAEhB,OAAO,EACL,OAAO,EAEP,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AAgGnC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CACxB,cAAsC;IAEtC,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,SAAI,cAAc,CAAC,EAAI,CAAC;IAEzD,2BAA2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AG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,QAAQ,CAAC,OAAO,EAAhB,CAAgB,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa,CAC3B,cAA4C;IAE5C,IAAM,YAAY,sBAChB,MAAM,EAAE,EAAE,EACV,UAAU,EAAE,KAAK,EACjB,GAAG,EAAE,cAAc,CAAC,GAAG,IACpB,cAAc,CAClB,CAAC;IAEF,kBAAkB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAEjD,+BAA+B;IAC/B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE;QAC9B,YAAY,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;KACnC;IACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE;QAClC,YAAY,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;KACrC;IAED,OAAO,OAAO,CAAI,YAAY,CAAC,GAAG,WAAQ,EAAE,YAAY,CAAC,CAAC;AAC5D,CAAC"} |
@@ -15,2 +15,4 @@ "use strict"; | ||
| tslib_1.__exportStar(require("./queryRelated"), exports); | ||
| tslib_1.__exportStar(require("./getLayer"), exports); | ||
| tslib_1.__exportStar(require("./decodeValues"), exports); | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,kDAAwB;AACxB,gDAAsB;AACtB,mDAAyB;AACzB,mDAAyB;AACzB,2DAAiC;AACjC,0DAAgC;AAChC,6DAAmC;AACnC,8DAAoC;AACpC,yDAA+B"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,kDAAwB;AACxB,gDAAsB;AACtB,mDAAyB;AACzB,mDAAyB;AACzB,2DAAiC;AACjC,0DAAgC;AAChC,6DAAmC;AACnC,8DAAoC;AACpC,yDAA+B;AAC/B,qDAA2B;AAC3B,yDAA+B"} |
+9
-10
| "use strict"; | ||
| /* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
| /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
@@ -43,3 +43,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
| * url, | ||
| * where: "STATE_NAME = 'Alaska" | ||
| * where: "STATE_NAME = 'Alaska'" | ||
| * }).then(result => { | ||
@@ -54,15 +54,14 @@ * console.log(result.features); // array of features | ||
| function queryFeatures(requestOptions) { | ||
| // default to a GET request | ||
| var options = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
| arcgis_rest_request_1.appendCustomParams(requestOptions, options); | ||
| var queryOptions = tslib_1.__assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
| arcgis_rest_request_1.appendCustomParams(requestOptions, queryOptions); | ||
| // set default query parameters | ||
| if (!options.params.where) { | ||
| options.params.where = "1=1"; | ||
| if (!queryOptions.params.where) { | ||
| queryOptions.params.where = "1=1"; | ||
| } | ||
| if (!options.params.outFields) { | ||
| options.params.outFields = "*"; | ||
| if (!queryOptions.params.outFields) { | ||
| queryOptions.params.outFields = "*"; | ||
| } | ||
| return arcgis_rest_request_1.request(options.url + "/query", options); | ||
| return arcgis_rest_request_1.request(queryOptions.url + "/query", queryOptions); | ||
| } | ||
| exports.queryFeatures = queryFeatures; | ||
| //# sourceMappingURL=query.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/query.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,iEAImC;AAgGnC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,UAAU,CACxB,cAAsC;IAEtC,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG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,6BAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,QAAQ,CAAC,OAAO,EAAhB,CAAgB,CAAC,CAAC;AACzE,CAAC;AAXD,gCAWC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,aAAa,CAC3B,cAA4C;IAE5C,IAAM,YAAY,sBAChB,MAAM,EAAE,EAAE,EACV,UAAU,EAAE,KAAK,EACjB,GAAG,EAAE,cAAc,CAAC,GAAG,IACpB,cAAc,CAClB,CAAC;IAEF,wCAAkB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAEjD,+BAA+B;IAC/B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE;QAC9B,YAAY,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;KACnC;IACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE;QAClC,YAAY,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;KACrC;IAED,OAAO,6BAAO,CAAI,YAAY,CAAC,GAAG,WAAQ,EAAE,YAAY,CAAC,CAAC;AAC5D,CAAC;AArBD,sCAqBC"} |
| /* @preserve | ||
| * @esri/arcgis-rest-feature-service - v1.13.2 - Apache-2.0 | ||
| * @esri/arcgis-rest-feature-service - v1.14.0 - Apache-2.0 | ||
| * Copyright (c) 2017-2018 Esri, Inc. | ||
| * Fri Nov 02 2018 15:54:14 GMT-0700 (Pacific Daylight Time) | ||
| * Wed Nov 14 2018 14:40:06 GMT-0800 (Pacific Standard Time) | ||
| */ | ||
@@ -27,11 +27,14 @@ (function (global, factory) { | ||
| var __assign = Object.assign || function __assign(t) { | ||
| for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
| s = arguments[i]; | ||
| for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
| } | ||
| return t; | ||
| var __assign = function() { | ||
| __assign = Object.assign || function __assign(t) { | ||
| for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
| s = arguments[i]; | ||
| for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
| } | ||
| return t; | ||
| }; | ||
| return __assign.apply(this, arguments); | ||
| }; | ||
| /* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
| /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
@@ -73,3 +76,3 @@ /** | ||
| * url, | ||
| * where: "STATE_NAME = 'Alaska" | ||
| * where: "STATE_NAME = 'Alaska'" | ||
| * }).then(result => { | ||
@@ -84,13 +87,12 @@ * console.log(result.features); // array of features | ||
| function queryFeatures(requestOptions) { | ||
| // default to a GET request | ||
| var options = __assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
| arcgisRestRequest.appendCustomParams(requestOptions, options); | ||
| var queryOptions = __assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
| arcgisRestRequest.appendCustomParams(requestOptions, queryOptions); | ||
| // set default query parameters | ||
| if (!options.params.where) { | ||
| options.params.where = "1=1"; | ||
| if (!queryOptions.params.where) { | ||
| queryOptions.params.where = "1=1"; | ||
| } | ||
| if (!options.params.outFields) { | ||
| options.params.outFields = "*"; | ||
| if (!queryOptions.params.outFields) { | ||
| queryOptions.params.outFields = "*"; | ||
| } | ||
| return arcgisRestRequest.request(options.url + "/query", options); | ||
| return arcgisRestRequest.request(queryOptions.url + "/query", queryOptions); | ||
| } | ||
@@ -333,3 +335,117 @@ | ||
| * Apache-2.0 */ | ||
| /** | ||
| * Layer (Feature Service) request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) for more information. | ||
| * | ||
| * ```js | ||
| * import { getLayer } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * getLayer(url) | ||
| * .then(response) // { name: "311", id: 0, ... } | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| function getLayer(url, requestOptions) { | ||
| return arcgisRestRequest.request(url, requestOptions); | ||
| } | ||
| /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
| /** | ||
| * Replaces the raw coded domain values in a query response with descriptions (for legibility). | ||
| * | ||
| * ```js | ||
| * import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service'; | ||
| * | ||
| * const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0"; | ||
| * | ||
| * queryFeatures({ url }) | ||
| * .then(queryResponse => { | ||
| * decodeValues({ | ||
| * url, | ||
| * queryResponse | ||
| * }) | ||
| * .then(decodedResponse) | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @param requestOptions - Options for the request. | ||
| * @returns A Promise that will resolve with the addFeatures response. | ||
| */ | ||
| 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) { | ||
| // turn the fields array into a POJO to avoid multiple calls to Array.find() | ||
| var fieldsObject = {}; | ||
| var fieldsArray = fields; | ||
| fieldsArray.forEach(function (field) { | ||
| fieldsObject[field.name] = field; | ||
| }); | ||
| // dont mutate original response | ||
| var clonedResponse = JSON.parse(JSON.stringify(requestOptions.queryResponse)); | ||
| clonedResponse.features.forEach(function (feature) { | ||
| for (var key in feature.attributes) { | ||
| /* istanbul ignore next */ | ||
| if (!feature.attributes.hasOwnProperty(key)) | ||
| continue; | ||
| feature.attributes[key] = convertAttribute(feature.attributes, fieldsObject[key]); | ||
| } | ||
| }); | ||
| return clonedResponse; | ||
| }); | ||
| } | ||
| /** | ||
| * ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L193-L220 | ||
| * | ||
| * Decodes an attributes CVD and standardizes any date fields | ||
| * | ||
| * @params {object} attribute - a single esri feature attribute | ||
| * @params {object} field - the field metadata describing that attribute | ||
| * @returns {object} outAttribute - the converted attribute | ||
| * @private | ||
| */ | ||
| function convertAttribute(attribute, field) { | ||
| var inValue = attribute[field.name]; | ||
| var value; | ||
| if (inValue === null) | ||
| return inValue; | ||
| if (field.domain && field.domain.type === "codedValue") { | ||
| value = cvd(inValue, field); | ||
| } | ||
| else { | ||
| value = inValue; | ||
| } | ||
| return value; | ||
| } | ||
| /** | ||
| * also ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L222-L235 | ||
| * | ||
| * Looks up a value from a coded domain | ||
| * | ||
| * @params {integer} value - The original field value | ||
| * @params {object} field - metadata describing the attribute field | ||
| * @returns {string/integerfloat} - The decoded field value | ||
| * @private | ||
| */ | ||
| function cvd(value, field) { | ||
| var domain = field.domain.codedValues.find(function (d) { | ||
| return value === d.code; | ||
| }); | ||
| return domain ? domain.name : value; | ||
| } | ||
| /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
| * Apache-2.0 */ | ||
| exports.getFeature = getFeature; | ||
@@ -345,2 +461,4 @@ exports.queryFeatures = queryFeatures; | ||
| exports.queryRelated = queryRelated; | ||
| exports.getLayer = getLayer; | ||
| exports.decodeValues = decodeValues; | ||
@@ -347,0 +465,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"feature-service.umd.js","sources":["../../src/query.ts","../../src/add.ts","../../src/update.ts","../../src/delete.ts","../../src/getAttachments.ts","../../src/addAttachment.ts","../../src/updateAttachment.ts","../../src/deleteAttachments.ts","../../src/queryRelated.ts","../../src/index.ts"],"sourcesContent":["/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeatureSet,\n IFeature,\n esriUnits,\n IExtent\n} from \"@esri/arcgis-rest-common-types\";\nimport { ISharedQueryParams } from \"./helpers\";\n\n/**\n * Request options to fetch a feature by id.\n */\nexport interface IFeatureRequestOptions extends IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n /**\n * Unique identifier of the feature.\n */\n id: number;\n}\n\nexport interface IStatisticDefinition {\n /**\n * Statistical operation to perform (count, sum, min, max, avg, stddev, var).\n */\n statisticType: \"count\" | \"sum\" | \"min\" | \"max\" | \"avg\" | \"stddev\" | \"var\";\n /**\n * Field on which to perform the statistical operation.\n */\n onStatisticField: string;\n /**\n * 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.\n */\n outStatisticFieldName: string;\n}\n\n/**\n * feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n */\nexport interface IQueryFeaturesRequestOptions\n extends ISharedQueryParams,\n IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n objectIds?: number[];\n relationParam?: string;\n // NOTE: either time=1199145600000 or time=1199145600000, 1230768000000\n time?: number | number[];\n distance?: number;\n units?: esriUnits;\n outFields?: \"*\" | string[];\n returnGeometry?: boolean;\n maxAllowableOffset?: number;\n geometryPrecision?: number;\n // NOTE: either WKID or ISpatialReference\n outSR?: string | ISpatialReference;\n gdbVersion?: string;\n returnDistinctValues?: boolean;\n returnIdsOnly?: boolean;\n returnCountOnly?: boolean;\n returnExtentOnly?: boolean;\n orderByFields?: string;\n groupByFieldsForStatistics?: string;\n outStatistics?: IStatisticDefinition[];\n returnZ?: boolean;\n returnM?: boolean;\n multipatchOption?: \"xyFootprint\";\n resultOffset?: number;\n resultRecordCount?: number;\n // TODO: IQuantizationParameters?\n quantizationParameters?: any;\n returnCentroid?: boolean;\n resultType?: \"none\" | \"standard\" | \"tile\";\n // to do: convert from Date() to epoch time internally\n historicMoment?: number;\n returnTrueCurves?: false;\n sqlFormat?: \"none\" | \"standard\" | \"native\";\n returnExceededLimitFeatures?: boolean;\n}\n\nexport interface IQueryFeaturesResponse extends IFeatureSet {\n exceededTransferLimit?: boolean;\n}\n\nexport interface IQueryResponse {\n count?: number;\n extent?: IExtent;\n objectIdFieldName?: string;\n objectIds?: number[];\n}\n\n/**\n * Get a feature by id.\n *\n * ```js\n * import { getFeature } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0\";\n *\n * getFeature({\n * url,\n * id: 42\n * }).then(feature => {\n * console.log(feature.attributes.FID); // 42\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the feature.\n */\nexport function getFeature(\n requestOptions: IFeatureRequestOptions\n): Promise<IFeature> {\n const url = `${requestOptions.url}/${requestOptions.id}`;\n\n // default to a GET request\n const options: IFeatureRequestOptions = {\n ...{ httpMethod: \"GET\" },\n ...requestOptions\n };\n return request(url, options).then((response: any) => response.feature);\n}\n\n/**\n * Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n *\n * ```js\n * import { queryFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3\";\n *\n * queryFeatures({\n * url,\n * where: \"STATE_NAME = 'Alaska\"\n * }).then(result => {\n * console.log(result.features); // array of features\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the query response.\n */\nexport function queryFeatures(\n requestOptions: IQueryFeaturesRequestOptions\n): Promise<IQueryFeaturesResponse | IQueryResponse> {\n // default to a GET request\n const options: IQueryFeaturesRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // set default query parameters\n if (!options.params.where) {\n options.params.where = \"1=1\";\n }\n if (!options.params.outFields) {\n options.params.outFields = \"*\";\n }\n return request(`${options.url}/query`, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Add features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param adds - Array of JSON features to add.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IAddFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to add.\n */\n adds: IFeature[];\n}\n\n/**\n * Add features results.\n */\nexport interface IAddFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature added.\n */\n addResults?: IEditFeatureResult[];\n}\n\n/**\n * Add features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * ```js\n * import { addFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * addFeatures({\n * url,\n * adds: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function addFeatures(\n requestOptions: IAddFeaturesRequestOptions\n): Promise<IAddFeaturesResult> {\n const url = `${requestOptions.url}/addFeatures`;\n\n // edit operations are POST only\n const options: IAddFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.adds;\n delete options.params.adds;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param updates - Array of JSON features to update.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IUpdateFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to update.\n */\n updates: IFeature[];\n}\n\n/**\n * Update features results.\n */\nexport interface IUpdateFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature updated.\n */\n updateResults?: IEditFeatureResult[];\n}\n\n/**\n * Update features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * ```js\n * import { updateFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * updateFeatures({\n * url,\n * updates: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the updateFeatures response.\n */\nexport function updateFeatures(\n requestOptions: IUpdateFeaturesRequestOptions\n): Promise<IUpdateFeaturesResult> {\n const url = `${requestOptions.url}/updateFeatures`;\n\n // edit operations are POST only\n const options: IUpdateFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.updates;\n delete options.params.updates;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n IEditFeaturesParams,\n IEditFeatureResult,\n ISharedQueryParams\n} from \"./helpers\";\n\n/**\n * Delete features parameters.\n */\nexport interface IDeleteFeaturesParams\n extends IEditFeaturesParams,\n ISharedQueryParams {}\n\n/**\n * Delete features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param deletes - Array of objectIds to delete.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IDeleteFeaturesRequestOptions\n extends IDeleteFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of objectIds to delete.\n */\n deletes: number[];\n}\n\n/**\n * Delete features results.\n */\nexport interface IDeleteFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature deleted.\n */\n deleteResults?: IEditFeatureResult[];\n}\n\n/**\n * Delete features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * ```js\n * import { deleteFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * deleteFeatures({\n * url,\n * deletes: [1,2,3]\n * });\n * ```\n *\n * @param deleteFeaturesRequestOptions - Options for the request.\n * @returns A Promise that will resolve with the deleteFeatures response.\n */\nexport function deleteFeatures(\n requestOptions: IDeleteFeaturesRequestOptions\n): Promise<IDeleteFeaturesResult> {\n const url = `${requestOptions.url}/deleteFeatures`;\n\n // edit operations POST only\n const options: IDeleteFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.objectIds = requestOptions.deletes;\n delete options.params.deletes;\n\n return request(url, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\n\n/**\n * 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.\n *\n */\nexport interface IGetAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to request related `attachmentInfos`.\n */\n featureId: number;\n}\n\n/**\n * Attachment, a.k.a. `attachmentInfo`. See [Attachment](https://developers.arcgis.com/rest/services-reference/attachment-feature-service-.htm) for more information.\n */\nexport interface IAttachmentInfo {\n id: number;\n contentType: string;\n size: number;\n name: string;\n}\n\n/**\n * `getAttachments()` request response.\n */\nexport interface IGetAttachmentsResponse {\n /**\n * Array of `attachmentInfo` Object(s) for each related attachment. Empty Array means no attachments.\n */\n attachmentInfos: IAttachmentInfo[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { getAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * getAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `getAttachments()` response.\n */\nexport function getAttachments(\n requestOptions: IGetAttachmentsOptions\n): Promise<IGetAttachmentsResponse> {\n // pass through\n return request(\n `${requestOptions.url}/${requestOptions.featureId}/attachments`,\n requestOptions\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IAddAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to add related attachment.\n */\n featureId: number;\n /**\n * File to be attached.\n */\n attachment: File;\n}\n\n/**\n * `addAttachment()` request response.\n */\nexport interface IAddAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n addAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * Attach a file to a feature by id. See [Add Attachment](https://developers.arcgis.com/rest/services-reference/add-attachment.htm) for more information.\n *\n * ```js\n * import { addAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * addAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `addAttachment()` response.\n */\nexport function addAttachment(\n requestOptions: IAddAttachmentOptions\n): Promise<IAddAttachmentResponse> {\n const options: IAddAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` --> params: {}\n options.params.attachment = requestOptions.attachment;\n\n return request(`${options.url}/${options.featureId}/addAttachment`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IUpdateAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to update related attachment.\n */\n featureId: number;\n /**\n * File to be updated.\n */\n attachment: File;\n /**\n * Unique identifier of the attachment.\n */\n attachmentId: number;\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IUpdateAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n updateAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * 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.\n *\n * ```js\n * import { updateAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * updateAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0],\n * attachmentId: 306\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `updateAttachment()` response.\n */\nexport function updateAttachment(\n requestOptions: IUpdateAttachmentOptions\n): Promise<IUpdateAttachmentResponse> {\n const options: IUpdateAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` and `attachmentId` --> params: {}\n options.params.attachment = requestOptions.attachment;\n options.params.attachmentId = requestOptions.attachmentId;\n\n return request(\n `${options.url}/${options.featureId}/updateAttachment`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IDeleteAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to delete related attachment(s).\n */\n featureId: number;\n /**\n * Array of unique identifiers of attachments to delete.\n */\n attachmentIds: number[];\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IDeleteAttachmentsResponse {\n /**\n * Array of standard AGS add/update/edit result Object(s) for the attachment(s).\n */\n deleteAttachmentResults: IEditFeatureResult[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { deleteAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * deleteAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachmentIds: [306]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `deleteAttachments()` response.\n */\nexport function deleteAttachments(\n requestOptions: IDeleteAttachmentsOptions\n): Promise<IDeleteAttachmentsResponse> {\n const options: IDeleteAttachmentsOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachmentIds` --> params: {}\n options.params.attachmentIds = requestOptions.attachmentIds;\n\n return request(\n `${options.url}/${options.featureId}/deleteAttachments`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeature,\n IHasZM,\n esriGeometryType,\n IField\n} from \"@esri/arcgis-rest-common-types\";\n\n/**\n * 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.\n */\nexport interface IQueryRelatedRequestOptions extends IRequestOptions {\n url: string;\n relationshipId?: number;\n objectIds?: number[];\n outFields?: \"*\" | string[];\n definitionExpression?: string;\n}\n\n/**\n * Related record data structure\n */\n\nexport interface IRelatedRecordGroup {\n objectId: number;\n relatedRecords?: IFeature[];\n count?: number;\n}\n\n/**\n * Related record response structure\n */\n\nexport interface IQueryRelatedResponse extends IHasZM {\n geometryType?: esriGeometryType;\n spatialReference?: ISpatialReference;\n fields?: IField[];\n relatedRecordGroups: IRelatedRecordGroup[];\n}\n/**\n * Query the related records for a feature service. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-records-feature-service-.htm) for more information.\n *\n * ```js\n * import { queryRelated } from '@esri/arcgis-rest-feature-service'\n *\n * const url = \"http://services.myserver/OrgID/ArcGIS/rest/services/Petroleum/KSPetro/FeatureServer/0\"\n *\n * queryRelated({\n * url: url,\n * relationshipId: 1,\n * params: { returnCountOnly: true }\n * })\n * .then(response => {\n * console.log(response.relatedRecords)\n * })\n * ```\n *\n * @param requestOptions\n * @returns A Promise that will resolve with the query response\n */\nexport function queryRelated(\n requestOptions: IQueryRelatedRequestOptions\n): Promise<IQueryRelatedResponse> {\n const options: IQueryRelatedRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n if (!options.params.definitionExpression) {\n options.params.definitionExpression = \"1=1\";\n }\n\n if (!options.params.outFields) {\n options.params.outFields = \"*\";\n }\n\n if (!options.params.relationshipId) {\n options.params.relationshipId = 0;\n }\n\n return request(`${options.url}/queryRelatedRecords`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nexport * from \"./query\";\nexport * from \"./add\";\nexport * from \"./update\";\nexport * from \"./delete\";\nexport * from \"./getAttachments\";\nexport * from \"./addAttachment\";\nexport * from \"./updateAttachment\";\nexport * from \"./deleteAttachments\";\nexport * from \"./queryRelated\";\n"],"names":["request","appendCustomParams"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;IAuGA;;;;;;;;;;;;;;;;;;;AAmBA,wBACE,cAAsC;QAEtC,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,SAAI,cAAc,CAAC,EAAI,CAAC;;QAGzD,IAAM,OAAO,YACR,EAAE,UAAU,EAAE,KAAK,EAAE,EACrB,cAAc,CAClB,CAAC;QACF,OAAOA,yBAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,QAAQ,CAAC,OAAO,GAAA,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{"version":3,"file":"feature-service.umd.js","sources":["../../src/query.ts","../../src/add.ts","../../src/update.ts","../../src/delete.ts","../../src/getAttachments.ts","../../src/addAttachment.ts","../../src/updateAttachment.ts","../../src/deleteAttachments.ts","../../src/queryRelated.ts","../../src/getLayer.ts","../../src/decodeValues.ts","../../src/index.ts"],"sourcesContent":["/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeatureSet,\n IFeature,\n esriUnits,\n IExtent\n} from \"@esri/arcgis-rest-common-types\";\n\nimport { ISharedQueryParams } from \"./helpers\";\n\n/**\n * Request options to fetch a feature by id.\n */\nexport interface IFeatureRequestOptions extends IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n /**\n * Unique identifier of the feature.\n */\n id: number;\n}\n\nexport interface IStatisticDefinition {\n /**\n * Statistical operation to perform (count, sum, min, max, avg, stddev, var).\n */\n statisticType: \"count\" | \"sum\" | \"min\" | \"max\" | \"avg\" | \"stddev\" | \"var\";\n /**\n * Field on which to perform the statistical operation.\n */\n onStatisticField: string;\n /**\n * 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.\n */\n outStatisticFieldName: string;\n}\n\n/**\n * feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n */\nexport interface IQueryFeaturesRequestOptions\n extends ISharedQueryParams,\n IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n objectIds?: number[];\n relationParam?: string;\n // NOTE: either time=1199145600000 or time=1199145600000, 1230768000000\n time?: number | number[];\n distance?: number;\n units?: esriUnits;\n outFields?: \"*\" | string[];\n returnGeometry?: boolean;\n maxAllowableOffset?: number;\n geometryPrecision?: number;\n // NOTE: either WKID or ISpatialReference\n outSR?: string | ISpatialReference;\n gdbVersion?: string;\n returnDistinctValues?: boolean;\n returnIdsOnly?: boolean;\n returnCountOnly?: boolean;\n returnExtentOnly?: boolean;\n orderByFields?: string;\n groupByFieldsForStatistics?: string;\n outStatistics?: IStatisticDefinition[];\n returnZ?: boolean;\n returnM?: boolean;\n multipatchOption?: \"xyFootprint\";\n resultOffset?: number;\n resultRecordCount?: number;\n // TODO: IQuantizationParameters?\n quantizationParameters?: any;\n returnCentroid?: boolean;\n resultType?: \"none\" | \"standard\" | \"tile\";\n // to do: convert from Date() to epoch time internally\n historicMoment?: number;\n returnTrueCurves?: false;\n sqlFormat?: \"none\" | \"standard\" | \"native\";\n returnExceededLimitFeatures?: boolean;\n /**\n * someday...\n *\n * If 'true' the query will be preceded by a metadata check to gather info about coded value domains and result values will be decoded. If a fieldset is provided it will be used to decode values and no internal metadata request will be issued.\n */\n // decodeValues?: boolean | IField[];\n}\n\nexport interface IQueryFeaturesResponse extends IFeatureSet {\n exceededTransferLimit?: boolean;\n}\n\nexport interface IQueryResponse {\n count?: number;\n extent?: IExtent;\n objectIdFieldName?: string;\n objectIds?: number[];\n}\n\n/**\n * Get a feature by id.\n *\n * ```js\n * import { getFeature } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0\";\n *\n * getFeature({\n * url,\n * id: 42\n * }).then(feature => {\n * console.log(feature.attributes.FID); // 42\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the feature.\n */\nexport function getFeature(\n requestOptions: IFeatureRequestOptions\n): Promise<IFeature> {\n const url = `${requestOptions.url}/${requestOptions.id}`;\n\n // default to a GET request\n const options: IFeatureRequestOptions = {\n ...{ httpMethod: \"GET\" },\n ...requestOptions\n };\n return request(url, options).then((response: any) => response.feature);\n}\n\n/**\n * Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n *\n * ```js\n * import { queryFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3\";\n *\n * queryFeatures({\n * url,\n * where: \"STATE_NAME = 'Alaska'\"\n * }).then(result => {\n * console.log(result.features); // array of features\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the query response.\n */\nexport function queryFeatures(\n requestOptions: IQueryFeaturesRequestOptions\n): Promise<IQueryFeaturesResponse | IQueryResponse> {\n const queryOptions: IQueryFeaturesRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, queryOptions);\n\n // set default query parameters\n if (!queryOptions.params.where) {\n queryOptions.params.where = \"1=1\";\n }\n if (!queryOptions.params.outFields) {\n queryOptions.params.outFields = \"*\";\n }\n\n return request(`${queryOptions.url}/query`, queryOptions);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Add features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param adds - Array of JSON features to add.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IAddFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to add.\n */\n adds: IFeature[];\n}\n\n/**\n * Add features results.\n */\nexport interface IAddFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature added.\n */\n addResults?: IEditFeatureResult[];\n}\n\n/**\n * Add features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * ```js\n * import { addFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * addFeatures({\n * url,\n * adds: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function addFeatures(\n requestOptions: IAddFeaturesRequestOptions\n): Promise<IAddFeaturesResult> {\n const url = `${requestOptions.url}/addFeatures`;\n\n // edit operations are POST only\n const options: IAddFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.adds;\n delete options.params.adds;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param updates - Array of JSON features to update.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IUpdateFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to update.\n */\n updates: IFeature[];\n}\n\n/**\n * Update features results.\n */\nexport interface IUpdateFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature updated.\n */\n updateResults?: IEditFeatureResult[];\n}\n\n/**\n * Update features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * ```js\n * import { updateFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * updateFeatures({\n * url,\n * updates: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the updateFeatures response.\n */\nexport function updateFeatures(\n requestOptions: IUpdateFeaturesRequestOptions\n): Promise<IUpdateFeaturesResult> {\n const url = `${requestOptions.url}/updateFeatures`;\n\n // edit operations are POST only\n const options: IUpdateFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.updates;\n delete options.params.updates;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n IEditFeaturesParams,\n IEditFeatureResult,\n ISharedQueryParams\n} from \"./helpers\";\n\n/**\n * Delete features parameters.\n */\nexport interface IDeleteFeaturesParams\n extends IEditFeaturesParams,\n ISharedQueryParams {}\n\n/**\n * Delete features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param deletes - Array of objectIds to delete.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IDeleteFeaturesRequestOptions\n extends IDeleteFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of objectIds to delete.\n */\n deletes: number[];\n}\n\n/**\n * Delete features results.\n */\nexport interface IDeleteFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature deleted.\n */\n deleteResults?: IEditFeatureResult[];\n}\n\n/**\n * Delete features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * ```js\n * import { deleteFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * deleteFeatures({\n * url,\n * deletes: [1,2,3]\n * });\n * ```\n *\n * @param deleteFeaturesRequestOptions - Options for the request.\n * @returns A Promise that will resolve with the deleteFeatures response.\n */\nexport function deleteFeatures(\n requestOptions: IDeleteFeaturesRequestOptions\n): Promise<IDeleteFeaturesResult> {\n const url = `${requestOptions.url}/deleteFeatures`;\n\n // edit operations POST only\n const options: IDeleteFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.objectIds = requestOptions.deletes;\n delete options.params.deletes;\n\n return request(url, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\n\n/**\n * 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.\n *\n */\nexport interface IGetAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to request related `attachmentInfos`.\n */\n featureId: number;\n}\n\n/**\n * Attachment, a.k.a. `attachmentInfo`. See [Attachment](https://developers.arcgis.com/rest/services-reference/attachment-feature-service-.htm) for more information.\n */\nexport interface IAttachmentInfo {\n id: number;\n contentType: string;\n size: number;\n name: string;\n}\n\n/**\n * `getAttachments()` request response.\n */\nexport interface IGetAttachmentsResponse {\n /**\n * Array of `attachmentInfo` Object(s) for each related attachment. Empty Array means no attachments.\n */\n attachmentInfos: IAttachmentInfo[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { getAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * getAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `getAttachments()` response.\n */\nexport function getAttachments(\n requestOptions: IGetAttachmentsOptions\n): Promise<IGetAttachmentsResponse> {\n // pass through\n return request(\n `${requestOptions.url}/${requestOptions.featureId}/attachments`,\n requestOptions\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IAddAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to add related attachment.\n */\n featureId: number;\n /**\n * File to be attached.\n */\n attachment: File;\n}\n\n/**\n * `addAttachment()` request response.\n */\nexport interface IAddAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n addAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * Attach a file to a feature by id. See [Add Attachment](https://developers.arcgis.com/rest/services-reference/add-attachment.htm) for more information.\n *\n * ```js\n * import { addAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * addAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `addAttachment()` response.\n */\nexport function addAttachment(\n requestOptions: IAddAttachmentOptions\n): Promise<IAddAttachmentResponse> {\n const options: IAddAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` --> params: {}\n options.params.attachment = requestOptions.attachment;\n\n return request(`${options.url}/${options.featureId}/addAttachment`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IUpdateAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to update related attachment.\n */\n featureId: number;\n /**\n * File to be updated.\n */\n attachment: File;\n /**\n * Unique identifier of the attachment.\n */\n attachmentId: number;\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IUpdateAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n updateAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * 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.\n *\n * ```js\n * import { updateAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * updateAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0],\n * attachmentId: 306\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `updateAttachment()` response.\n */\nexport function updateAttachment(\n requestOptions: IUpdateAttachmentOptions\n): Promise<IUpdateAttachmentResponse> {\n const options: IUpdateAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` and `attachmentId` --> params: {}\n options.params.attachment = requestOptions.attachment;\n options.params.attachmentId = requestOptions.attachmentId;\n\n return request(\n `${options.url}/${options.featureId}/updateAttachment`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IDeleteAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to delete related attachment(s).\n */\n featureId: number;\n /**\n * Array of unique identifiers of attachments to delete.\n */\n attachmentIds: number[];\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IDeleteAttachmentsResponse {\n /**\n * Array of standard AGS add/update/edit result Object(s) for the attachment(s).\n */\n deleteAttachmentResults: IEditFeatureResult[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { deleteAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * deleteAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachmentIds: [306]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `deleteAttachments()` response.\n */\nexport function deleteAttachments(\n requestOptions: IDeleteAttachmentsOptions\n): Promise<IDeleteAttachmentsResponse> {\n const options: IDeleteAttachmentsOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachmentIds` --> params: {}\n options.params.attachmentIds = requestOptions.attachmentIds;\n\n return request(\n `${options.url}/${options.featureId}/deleteAttachments`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeature,\n IHasZM,\n esriGeometryType,\n IField\n} from \"@esri/arcgis-rest-common-types\";\n\n/**\n * 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.\n */\nexport interface IQueryRelatedRequestOptions extends IRequestOptions {\n url: string;\n relationshipId?: number;\n objectIds?: number[];\n outFields?: \"*\" | string[];\n definitionExpression?: string;\n}\n\n/**\n * Related record data structure\n */\n\nexport interface IRelatedRecordGroup {\n objectId: number;\n relatedRecords?: IFeature[];\n count?: number;\n}\n\n/**\n * Related record response structure\n */\n\nexport interface IQueryRelatedResponse extends IHasZM {\n geometryType?: esriGeometryType;\n spatialReference?: ISpatialReference;\n fields?: IField[];\n relatedRecordGroups: IRelatedRecordGroup[];\n}\n/**\n * Query the related records for a feature service. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-records-feature-service-.htm) for more information.\n *\n * ```js\n * import { queryRelated } from '@esri/arcgis-rest-feature-service'\n *\n * const url = \"http://services.myserver/OrgID/ArcGIS/rest/services/Petroleum/KSPetro/FeatureServer/0\"\n *\n * queryRelated({\n * url: url,\n * relationshipId: 1,\n * params: { returnCountOnly: true }\n * })\n * .then(response => {\n * console.log(response.relatedRecords)\n * })\n * ```\n *\n * @param requestOptions\n * @returns A Promise that will resolve with the query response\n */\nexport function queryRelated(\n requestOptions: IQueryRelatedRequestOptions\n): Promise<IQueryRelatedResponse> {\n const options: IQueryRelatedRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n if (!options.params.definitionExpression) {\n options.params.definitionExpression = \"1=1\";\n }\n\n if (!options.params.outFields) {\n options.params.outFields = \"*\";\n }\n\n if (!options.params.relationshipId) {\n options.params.relationshipId = 0;\n }\n\n return request(`${options.url}/queryRelatedRecords`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { ILayerDefinition } from \"@esri/arcgis-rest-common-types\";\n\n/**\n * Layer (Feature Service) request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) for more information.\n *\n * ```js\n * import { getLayer } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * getLayer(url)\n * .then(response) // { name: \"311\", id: 0, ... }\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function getLayer(\n url: string,\n requestOptions?: IRequestOptions\n): Promise<ILayerDefinition> {\n return request(url, requestOptions);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport {\n IField,\n ILayerDefinition,\n IFeature\n} from \"@esri/arcgis-rest-common-types\";\nimport { IQueryFeaturesResponse } from \"./query\";\nimport { getLayer } from \"./getLayer\";\n\n/**\n * Request options to fetch a feature by id.\n */\nexport interface IDecodeValuesRequestOptions extends IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n /**\n * Unique identifier of the feature.\n */\n queryResponse: IQueryFeaturesResponse;\n /**\n * * If a fieldset is provided, no internal metadata check will be issued to gather info about coded value domains.\n *\n * getFeatureService(url)\n * .then(metadata => {\n * queryFeatures({ url })\n * .then(response => {\n * decodeValues({\n * url,\n * queryResponse,\n * fields: metadata.fields\n * })\n * .then(decodedResponse)\n * })\n * })\n */\n fields?: IField[];\n}\n\n/**\n * Replaces the raw coded domain values in a query response with descriptions (for legibility).\n *\n * ```js\n * import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * queryFeatures({ url })\n * .then(queryResponse => {\n * decodeValues({\n * url,\n * queryResponse\n * })\n * .then(decodedResponse)\n * })\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function decodeValues(\n requestOptions: IDecodeValuesRequestOptions\n): Promise<IQueryFeaturesResponse> {\n return new Promise(resolve => {\n if (!requestOptions.fields) {\n return getLayer(requestOptions.url, requestOptions).then(\n (metadata: ILayerDefinition) => {\n resolve((requestOptions.fields = metadata.fields));\n }\n );\n } else {\n resolve(requestOptions.fields);\n }\n }).then(fields => {\n // turn the fields array into a POJO to avoid multiple calls to Array.find()\n const fieldsObject: any = {};\n const fieldsArray = fields as IField[];\n fieldsArray.forEach((field: IField) => {\n fieldsObject[field.name] = field;\n });\n\n // dont mutate original response\n const clonedResponse = JSON.parse(\n JSON.stringify(requestOptions.queryResponse)\n );\n\n clonedResponse.features.forEach((feature: IFeature) => {\n for (const key in feature.attributes) {\n /* istanbul ignore next */\n if (!feature.attributes.hasOwnProperty(key)) continue;\n feature.attributes[key] = convertAttribute(\n feature.attributes,\n fieldsObject[key]\n );\n }\n });\n return clonedResponse;\n });\n}\n\n/**\n * ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L193-L220\n *\n * Decodes an attributes CVD and standardizes any date fields\n *\n * @params {object} attribute - a single esri feature attribute\n * @params {object} field - the field metadata describing that attribute\n * @returns {object} outAttribute - the converted attribute\n * @private\n */\n\nfunction convertAttribute(attribute: any, field: IField) {\n const inValue = attribute[field.name];\n let value;\n\n if (inValue === null) return inValue;\n\n if (field.domain && field.domain.type === \"codedValue\") {\n value = cvd(inValue, field);\n } else {\n value = inValue;\n }\n return value;\n}\n\n/**\n * also ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L222-L235\n *\n * Looks up a value from a coded domain\n *\n * @params {integer} value - The original field value\n * @params {object} field - metadata describing the attribute field\n * @returns {string/integerfloat} - The decoded field value\n * @private\n */\n\nfunction cvd(value: any, field: IField) {\n const domain = field.domain.codedValues.find((d: any) => {\n return value === d.code;\n });\n return domain ? domain.name : value;\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nexport * from \"./query\";\nexport * from \"./add\";\nexport * from \"./update\";\nexport * from \"./delete\";\nexport * from \"./getAttachments\";\nexport * from \"./addAttachment\";\nexport * from \"./updateAttachment\";\nexport * from \"./deleteAttachments\";\nexport * from \"./queryRelated\";\nexport * from \"./getLayer\";\nexport * from \"./decodeValues\";\n"],"names":["request","appendCustomParams"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;IA8GA;;;;;;;;;;;;;;;;;;;AAmBA,wBACE,cAAsC;QAEtC,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,SAAI,cAAc,CAAC,EAAI,CAAC;;QAGzD,IAAM,OAAO,YACR,EAAE,UAAU,EAAE,KAAK,EAAE,EACrB,cAAc,CAClB,CAAC;QACF,OAAOA,yBAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,QAAQ,CAAC,OAAO,GAAA,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;;;;;;;;AAmBA,2BACE,cAA4C;QAE5C,IAAM,YAAY,cAChB,MAAM,EAAE,EAAE,EACV,UAAU,EAAE,KAAK,EACjB,GAAG,EAAE,cAAc,CAAC,GAAG,IACpB,cAAc,CAClB,CAAC;QAEFC,oCAAkB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;;QAGjD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE;YAC9B,YAAY,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACnC;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE;YAClC,YAAY,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;SACrC;QAED,OAAOD,yBAAO,CAAI,YAAY,CAAC,GAAG,WAAQ,EAAE,YAAY,CAAC,CAAC;IAC5D,CAAC;;ICtLD;;IAyCA;;;;;;;;;;;;;;;;;;;;AAoBA,yBACE,cAA0C;QAE1C,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,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,KAAK,CAAC;IACtC,CAAC;;ICjJD;oBACgB;;;;;;;;;;;;;;;;;;;;;;;"} |
| /* @preserve | ||
| * @esri/arcgis-rest-feature-service - v1.13.2 - Apache-2.0 | ||
| * @esri/arcgis-rest-feature-service - v1.14.0 - Apache-2.0 | ||
| * Copyright (c) 2017-2018 Esri, Inc. | ||
| * Fri Nov 02 2018 15:54:17 GMT-0700 (Pacific Daylight Time) | ||
| * Wed Nov 14 2018 14:40:09 GMT-0800 (Pacific Standard Time) | ||
| */ | ||
| !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 s in t=arguments[a])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e};e.getFeature=function(e){var r=e.url+"/"+e.id,s=a({httpMethod:"GET"},e);return t.request(r,s).then(function(e){return e.feature})},e.queryFeatures=function(e){var r=a({params:{},httpMethod:"GET",url:e.url},e);return t.appendCustomParams(e,r),r.params.where||(r.params.where="1=1"),r.params.outFields||(r.params.outFields="*"),t.request(r.url+"/query",r)},e.addFeatures=function(e){var r=e.url+"/addFeatures",s=a({params:{}},e);return t.appendCustomParams(e,s),s.params.features=e.adds,delete s.params.adds,t.request(r,s)},e.updateFeatures=function(e){var r=e.url+"/updateFeatures",s=a({params:{}},e);return t.appendCustomParams(e,s),s.params.features=e.updates,delete s.params.updates,t.request(r,s)},e.deleteFeatures=function(e){var r=e.url+"/deleteFeatures",s=a({params:{}},e);return t.appendCustomParams(e,s),s.params.objectIds=e.deletes,delete s.params.deletes,t.request(r,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)},e.queryRelated=function(e){var r=a({params:{},httpMethod:"GET",url:e.url},e);return t.appendCustomParams(e,r),r.params.definitionExpression||(r.params.definitionExpression="1=1"),r.params.outFields||(r.params.outFields="*"),r.params.relationshipId||(r.params.relationshipId=0),t.request(r.url+"/queryRelatedRecords",r)},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 r=function(){return(r=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function a(e,r){return t.request(e,r)}e.getFeature=function(e){var a=e.url+"/"+e.id,n=r({httpMethod:"GET"},e);return t.request(a,n).then(function(e){return e.feature})},e.queryFeatures=function(e){var a=r({params:{},httpMethod:"GET",url:e.url},e);return t.appendCustomParams(e,a),a.params.where||(a.params.where="1=1"),a.params.outFields||(a.params.outFields="*"),t.request(a.url+"/query",a)},e.addFeatures=function(e){var a=e.url+"/addFeatures",n=r({params:{}},e);return t.appendCustomParams(e,n),n.params.features=e.adds,delete n.params.adds,t.request(a,n)},e.updateFeatures=function(e){var a=e.url+"/updateFeatures",n=r({params:{}},e);return t.appendCustomParams(e,n),n.params.features=e.updates,delete n.params.updates,t.request(a,n)},e.deleteFeatures=function(e){var a=e.url+"/deleteFeatures",n=r({params:{}},e);return t.appendCustomParams(e,n),n.params.objectIds=e.deletes,delete n.params.deletes,t.request(a,n)},e.getAttachments=function(e){return t.request(e.url+"/"+e.featureId+"/attachments",e)},e.addAttachment=function(e){var a=r({params:{}},e);return a.params.attachment=e.attachment,t.request(a.url+"/"+a.featureId+"/addAttachment",a)},e.updateAttachment=function(e){var a=r({params:{}},e);return a.params.attachment=e.attachment,a.params.attachmentId=e.attachmentId,t.request(a.url+"/"+a.featureId+"/updateAttachment",a)},e.deleteAttachments=function(e){var a=r({params:{}},e);return a.params.attachmentIds=e.attachmentIds,t.request(a.url+"/"+a.featureId+"/deleteAttachments",a)},e.queryRelated=function(e){var a=r({params:{},httpMethod:"GET",url:e.url},e);return t.appendCustomParams(e,a),a.params.definitionExpression||(a.params.definitionExpression="1=1"),a.params.outFields||(a.params.outFields="*"),a.params.relationshipId||(a.params.relationshipId=0),t.request(a.url+"/queryRelatedRecords",a)},e.getLayer=a,e.decodeValues=function(e){return new Promise(function(t){if(!e.fields)return a(e.url,e).then(function(r){t(e.fields=r.fields)});t(e.fields)}).then(function(t){var r={};t.forEach(function(e){r[e.name]=e});var a=JSON.parse(JSON.stringify(e.queryResponse));return a.features.forEach(function(e){for(var t in e.attributes)e.attributes.hasOwnProperty(t)&&(e.attributes[t]=(a=e.attributes,n=r[t],void 0,null===(s=a[n.name])?s:n.domain&&"codedValue"===n.domain.type?function(e,t){var r=t.domain.codedValues.find(function(t){return e===t.code});return r?r.name:e}(s,n):s));var a,n,s}),a})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
| //# sourceMappingURL=feature-service.umd.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"feature-service.umd.min.js","sources":["../../src/query.ts","../../src/add.ts","../../src/update.ts","../../src/delete.ts","../../src/getAttachments.ts","../../src/addAttachment.ts","../../src/updateAttachment.ts","../../src/deleteAttachments.ts","../../src/queryRelated.ts"],"sourcesContent":["/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeatureSet,\n IFeature,\n esriUnits,\n IExtent\n} from \"@esri/arcgis-rest-common-types\";\nimport { ISharedQueryParams } from \"./helpers\";\n\n/**\n * Request options to fetch a feature by id.\n */\nexport interface IFeatureRequestOptions extends IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n /**\n * Unique identifier of the feature.\n */\n id: number;\n}\n\nexport interface IStatisticDefinition {\n /**\n * Statistical operation to perform (count, sum, min, max, avg, stddev, var).\n */\n statisticType: \"count\" | \"sum\" | \"min\" | \"max\" | \"avg\" | \"stddev\" | \"var\";\n /**\n * Field on which to perform the statistical operation.\n */\n onStatisticField: string;\n /**\n * 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.\n */\n outStatisticFieldName: string;\n}\n\n/**\n * feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n */\nexport interface IQueryFeaturesRequestOptions\n extends ISharedQueryParams,\n IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n objectIds?: number[];\n relationParam?: string;\n // NOTE: either time=1199145600000 or time=1199145600000, 1230768000000\n time?: number | number[];\n distance?: number;\n units?: esriUnits;\n outFields?: \"*\" | string[];\n returnGeometry?: boolean;\n maxAllowableOffset?: number;\n geometryPrecision?: number;\n // NOTE: either WKID or ISpatialReference\n outSR?: string | ISpatialReference;\n gdbVersion?: string;\n returnDistinctValues?: boolean;\n returnIdsOnly?: boolean;\n returnCountOnly?: boolean;\n returnExtentOnly?: boolean;\n orderByFields?: string;\n groupByFieldsForStatistics?: string;\n outStatistics?: IStatisticDefinition[];\n returnZ?: boolean;\n returnM?: boolean;\n multipatchOption?: \"xyFootprint\";\n resultOffset?: number;\n resultRecordCount?: number;\n // TODO: IQuantizationParameters?\n quantizationParameters?: any;\n returnCentroid?: boolean;\n resultType?: \"none\" | \"standard\" | \"tile\";\n // to do: convert from Date() to epoch time internally\n historicMoment?: number;\n returnTrueCurves?: false;\n sqlFormat?: \"none\" | \"standard\" | \"native\";\n returnExceededLimitFeatures?: boolean;\n}\n\nexport interface IQueryFeaturesResponse extends IFeatureSet {\n exceededTransferLimit?: boolean;\n}\n\nexport interface IQueryResponse {\n count?: number;\n extent?: IExtent;\n objectIdFieldName?: string;\n objectIds?: number[];\n}\n\n/**\n * Get a feature by id.\n *\n * ```js\n * import { getFeature } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0\";\n *\n * getFeature({\n * url,\n * id: 42\n * }).then(feature => {\n * console.log(feature.attributes.FID); // 42\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the feature.\n */\nexport function getFeature(\n requestOptions: IFeatureRequestOptions\n): Promise<IFeature> {\n const url = `${requestOptions.url}/${requestOptions.id}`;\n\n // default to a GET request\n const options: IFeatureRequestOptions = {\n ...{ httpMethod: \"GET\" },\n ...requestOptions\n };\n return request(url, options).then((response: any) => response.feature);\n}\n\n/**\n * Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n *\n * ```js\n * import { queryFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3\";\n *\n * queryFeatures({\n * url,\n * where: \"STATE_NAME = 'Alaska\"\n * }).then(result => {\n * console.log(result.features); // array of features\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the query response.\n */\nexport function queryFeatures(\n requestOptions: IQueryFeaturesRequestOptions\n): Promise<IQueryFeaturesResponse | IQueryResponse> {\n // default to a GET request\n const options: IQueryFeaturesRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // set default query parameters\n if (!options.params.where) {\n options.params.where = \"1=1\";\n }\n if (!options.params.outFields) {\n options.params.outFields = \"*\";\n }\n return request(`${options.url}/query`, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Add features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param adds - Array of JSON features to add.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IAddFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to add.\n */\n adds: IFeature[];\n}\n\n/**\n * Add features results.\n */\nexport interface IAddFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature added.\n */\n addResults?: IEditFeatureResult[];\n}\n\n/**\n * Add features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * ```js\n * import { addFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * addFeatures({\n * url,\n * adds: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function addFeatures(\n requestOptions: IAddFeaturesRequestOptions\n): Promise<IAddFeaturesResult> {\n const url = `${requestOptions.url}/addFeatures`;\n\n // edit operations are POST only\n const options: IAddFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.adds;\n delete options.params.adds;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param updates - Array of JSON features to update.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IUpdateFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to update.\n */\n updates: IFeature[];\n}\n\n/**\n * Update features results.\n */\nexport interface IUpdateFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature updated.\n */\n updateResults?: IEditFeatureResult[];\n}\n\n/**\n * Update features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * ```js\n * import { updateFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * updateFeatures({\n * url,\n * updates: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the updateFeatures response.\n */\nexport function updateFeatures(\n requestOptions: IUpdateFeaturesRequestOptions\n): Promise<IUpdateFeaturesResult> {\n const url = `${requestOptions.url}/updateFeatures`;\n\n // edit operations are POST only\n const options: IUpdateFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.updates;\n delete options.params.updates;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n IEditFeaturesParams,\n IEditFeatureResult,\n ISharedQueryParams\n} from \"./helpers\";\n\n/**\n * Delete features parameters.\n */\nexport interface IDeleteFeaturesParams\n extends IEditFeaturesParams,\n ISharedQueryParams {}\n\n/**\n * Delete features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param deletes - Array of objectIds to delete.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IDeleteFeaturesRequestOptions\n extends IDeleteFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of objectIds to delete.\n */\n deletes: number[];\n}\n\n/**\n * Delete features results.\n */\nexport interface IDeleteFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature deleted.\n */\n deleteResults?: IEditFeatureResult[];\n}\n\n/**\n * Delete features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * ```js\n * import { deleteFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * deleteFeatures({\n * url,\n * deletes: [1,2,3]\n * });\n * ```\n *\n * @param deleteFeaturesRequestOptions - Options for the request.\n * @returns A Promise that will resolve with the deleteFeatures response.\n */\nexport function deleteFeatures(\n requestOptions: IDeleteFeaturesRequestOptions\n): Promise<IDeleteFeaturesResult> {\n const url = `${requestOptions.url}/deleteFeatures`;\n\n // edit operations POST only\n const options: IDeleteFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.objectIds = requestOptions.deletes;\n delete options.params.deletes;\n\n return request(url, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\n\n/**\n * 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.\n *\n */\nexport interface IGetAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to request related `attachmentInfos`.\n */\n featureId: number;\n}\n\n/**\n * Attachment, a.k.a. `attachmentInfo`. See [Attachment](https://developers.arcgis.com/rest/services-reference/attachment-feature-service-.htm) for more information.\n */\nexport interface IAttachmentInfo {\n id: number;\n contentType: string;\n size: number;\n name: string;\n}\n\n/**\n * `getAttachments()` request response.\n */\nexport interface IGetAttachmentsResponse {\n /**\n * Array of `attachmentInfo` Object(s) for each related attachment. Empty Array means no attachments.\n */\n attachmentInfos: IAttachmentInfo[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { getAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * getAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `getAttachments()` response.\n */\nexport function getAttachments(\n requestOptions: IGetAttachmentsOptions\n): Promise<IGetAttachmentsResponse> {\n // pass through\n return request(\n `${requestOptions.url}/${requestOptions.featureId}/attachments`,\n requestOptions\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IAddAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to add related attachment.\n */\n featureId: number;\n /**\n * File to be attached.\n */\n attachment: File;\n}\n\n/**\n * `addAttachment()` request response.\n */\nexport interface IAddAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n addAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * Attach a file to a feature by id. See [Add Attachment](https://developers.arcgis.com/rest/services-reference/add-attachment.htm) for more information.\n *\n * ```js\n * import { addAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * addAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `addAttachment()` response.\n */\nexport function addAttachment(\n requestOptions: IAddAttachmentOptions\n): Promise<IAddAttachmentResponse> {\n const options: IAddAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` --> params: {}\n options.params.attachment = requestOptions.attachment;\n\n return request(`${options.url}/${options.featureId}/addAttachment`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IUpdateAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to update related attachment.\n */\n featureId: number;\n /**\n * File to be updated.\n */\n attachment: File;\n /**\n * Unique identifier of the attachment.\n */\n attachmentId: number;\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IUpdateAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n updateAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * 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.\n *\n * ```js\n * import { updateAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * updateAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0],\n * attachmentId: 306\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `updateAttachment()` response.\n */\nexport function updateAttachment(\n requestOptions: IUpdateAttachmentOptions\n): Promise<IUpdateAttachmentResponse> {\n const options: IUpdateAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` and `attachmentId` --> params: {}\n options.params.attachment = requestOptions.attachment;\n options.params.attachmentId = requestOptions.attachmentId;\n\n return request(\n `${options.url}/${options.featureId}/updateAttachment`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IDeleteAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to delete related attachment(s).\n */\n featureId: number;\n /**\n * Array of unique identifiers of attachments to delete.\n */\n attachmentIds: number[];\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IDeleteAttachmentsResponse {\n /**\n * Array of standard AGS add/update/edit result Object(s) for the attachment(s).\n */\n deleteAttachmentResults: IEditFeatureResult[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { deleteAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * deleteAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachmentIds: [306]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `deleteAttachments()` response.\n */\nexport function deleteAttachments(\n requestOptions: IDeleteAttachmentsOptions\n): Promise<IDeleteAttachmentsResponse> {\n const options: IDeleteAttachmentsOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachmentIds` --> params: {}\n options.params.attachmentIds = requestOptions.attachmentIds;\n\n return request(\n `${options.url}/${options.featureId}/deleteAttachments`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeature,\n IHasZM,\n esriGeometryType,\n IField\n} from \"@esri/arcgis-rest-common-types\";\n\n/**\n * 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.\n */\nexport interface IQueryRelatedRequestOptions extends IRequestOptions {\n url: string;\n relationshipId?: number;\n objectIds?: number[];\n outFields?: \"*\" | string[];\n definitionExpression?: string;\n}\n\n/**\n * Related record data structure\n */\n\nexport interface IRelatedRecordGroup {\n objectId: number;\n relatedRecords?: IFeature[];\n count?: number;\n}\n\n/**\n * Related record response structure\n */\n\nexport interface IQueryRelatedResponse extends IHasZM {\n geometryType?: esriGeometryType;\n spatialReference?: ISpatialReference;\n fields?: IField[];\n relatedRecordGroups: IRelatedRecordGroup[];\n}\n/**\n * Query the related records for a feature service. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-records-feature-service-.htm) for more information.\n *\n * ```js\n * import { queryRelated } from '@esri/arcgis-rest-feature-service'\n *\n * const url = \"http://services.myserver/OrgID/ArcGIS/rest/services/Petroleum/KSPetro/FeatureServer/0\"\n *\n * queryRelated({\n * url: url,\n * relationshipId: 1,\n * params: { returnCountOnly: true }\n * })\n * .then(response => {\n * console.log(response.relatedRecords)\n * })\n * ```\n *\n * @param requestOptions\n * @returns A Promise that will resolve with the query response\n */\nexport function queryRelated(\n requestOptions: IQueryRelatedRequestOptions\n): Promise<IQueryRelatedResponse> {\n const options: IQueryRelatedRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n if (!options.params.definitionExpression) {\n options.params.definitionExpression = \"1=1\";\n }\n\n if (!options.params.outFields) {\n options.params.outFields = \"*\";\n }\n\n if (!options.params.relationshipId) {\n options.params.relationshipId = 0;\n }\n\n return request(`${options.url}/queryRelatedRecords`, options);\n}\n"],"names":["requestOptions","url","id","options","httpMethod","request","then","response","feature","params","appendCustomParams","where","outFields","features","adds","updates","objectIds","deletes","featureId","attachment","attachmentId","attachmentIds","definitionExpression","relationshipId"],"mappings":";;;;;wdA2HEA,GAEA,IAAMC,EAASD,EAAeC,QAAOD,EAAeE,GAG9CC,KACCC,WAAY,OACdJ,GAEL,OAAOK,UAAQJ,EAAKE,GAASG,KAAK,SAACC,GAAkB,OAAAA,EAASC,oCAuB9DR,GAGA,IAAMG,KACJM,UACAL,WAAY,MACZH,IAAKD,EAAeC,KACjBD,GAYL,OATAU,qBAAmBV,EAAgBG,GAG9BA,EAAQM,OAAOE,QAClBR,EAAQM,OAAOE,MAAQ,OAEpBR,EAAQM,OAAOG,YAClBT,EAAQM,OAAOG,UAAY,KAEtBP,UAAWF,EAAQF,aAAaE,2BChHvCH,GAEA,IAAMC,EAASD,EAAeC,mBAGxBE,KACJM,WACGT,GASL,OANAU,qBAAmBV,EAAgBG,GAGnCA,EAAQM,OAAOI,SAAWb,EAAec,YAClCX,EAAQM,OAAOK,KAEfT,UAAQJ,EAAKE,8BChBpBH,GAEA,IAAMC,EAASD,EAAeC,sBAGxBE,KACJM,WACGT,GASL,OANAU,qBAAmBV,EAAgBG,GAGnCA,EAAQM,OAAOI,SAAWb,EAAee,eAClCZ,EAAQM,OAAOM,QAEfV,UAAQJ,EAAKE,8BCTpBH,GAEA,IAAMC,EAASD,EAAeC,sBAGxBE,KACJM,WACGT,GASL,OANAU,qBAAmBV,EAAgBG,GAGnCA,EAAQM,OAAOO,UAAYhB,EAAeiB,eACnCd,EAAQM,OAAOQ,QAEfZ,UAAQJ,EAAKE,8BC7BpBH,GAGA,OAAOK,UACFL,EAAeC,QAAOD,EAAekB,yBACxClB,6BCTFA,GAEA,IAAMG,KACJM,WACGT,GAML,OAFAG,EAAQM,OAAOU,WAAanB,EAAemB,WAEpCd,UAAWF,EAAQF,QAAOE,EAAQe,2BAA2Bf,gCCLpEH,GAEA,IAAMG,KACJM,WACGT,GAOL,OAHAG,EAAQM,OAAOU,WAAanB,EAAemB,WAC3ChB,EAAQM,OAAOW,aAAepB,EAAeoB,aAEtCf,UACFF,EAAQF,QAAOE,EAAQe,8BAC1Bf,iCClBFH,GAEA,IAAMG,KACJM,WACGT,GAML,OAFAG,EAAQM,OAAOY,cAAgBrB,EAAeqB,cAEvChB,UACFF,EAAQF,QAAOE,EAAQe,+BAC1Bf,4BCKFH,GAEA,IAAMG,KACJM,UACAL,WAAY,MACZH,IAAKD,EAAeC,KACjBD,GAiBL,OAdAU,qBAAmBV,EAAgBG,GAE9BA,EAAQM,OAAOa,uBAClBnB,EAAQM,OAAOa,qBAAuB,OAGnCnB,EAAQM,OAAOG,YAClBT,EAAQM,OAAOG,UAAY,KAGxBT,EAAQM,OAAOc,iBAClBpB,EAAQM,OAAOc,eAAiB,GAG3BlB,UAAWF,EAAQF,2BAA2BE"} | ||
| {"version":3,"file":"feature-service.umd.min.js","sources":["../../src/getLayer.ts","../../src/query.ts","../../src/add.ts","../../src/update.ts","../../src/delete.ts","../../src/getAttachments.ts","../../src/addAttachment.ts","../../src/updateAttachment.ts","../../src/deleteAttachments.ts","../../src/queryRelated.ts","../../src/decodeValues.ts"],"sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { ILayerDefinition } from \"@esri/arcgis-rest-common-types\";\n\n/**\n * Layer (Feature Service) request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/layer-feature-service-.htm) for more information.\n *\n * ```js\n * import { getLayer } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * getLayer(url)\n * .then(response) // { name: \"311\", id: 0, ... }\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function getLayer(\n url: string,\n requestOptions?: IRequestOptions\n): Promise<ILayerDefinition> {\n return request(url, requestOptions);\n}\n","/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeatureSet,\n IFeature,\n esriUnits,\n IExtent\n} from \"@esri/arcgis-rest-common-types\";\n\nimport { ISharedQueryParams } from \"./helpers\";\n\n/**\n * Request options to fetch a feature by id.\n */\nexport interface IFeatureRequestOptions extends IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n /**\n * Unique identifier of the feature.\n */\n id: number;\n}\n\nexport interface IStatisticDefinition {\n /**\n * Statistical operation to perform (count, sum, min, max, avg, stddev, var).\n */\n statisticType: \"count\" | \"sum\" | \"min\" | \"max\" | \"avg\" | \"stddev\" | \"var\";\n /**\n * Field on which to perform the statistical operation.\n */\n onStatisticField: string;\n /**\n * 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.\n */\n outStatisticFieldName: string;\n}\n\n/**\n * feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n */\nexport interface IQueryFeaturesRequestOptions\n extends ISharedQueryParams,\n IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n objectIds?: number[];\n relationParam?: string;\n // NOTE: either time=1199145600000 or time=1199145600000, 1230768000000\n time?: number | number[];\n distance?: number;\n units?: esriUnits;\n outFields?: \"*\" | string[];\n returnGeometry?: boolean;\n maxAllowableOffset?: number;\n geometryPrecision?: number;\n // NOTE: either WKID or ISpatialReference\n outSR?: string | ISpatialReference;\n gdbVersion?: string;\n returnDistinctValues?: boolean;\n returnIdsOnly?: boolean;\n returnCountOnly?: boolean;\n returnExtentOnly?: boolean;\n orderByFields?: string;\n groupByFieldsForStatistics?: string;\n outStatistics?: IStatisticDefinition[];\n returnZ?: boolean;\n returnM?: boolean;\n multipatchOption?: \"xyFootprint\";\n resultOffset?: number;\n resultRecordCount?: number;\n // TODO: IQuantizationParameters?\n quantizationParameters?: any;\n returnCentroid?: boolean;\n resultType?: \"none\" | \"standard\" | \"tile\";\n // to do: convert from Date() to epoch time internally\n historicMoment?: number;\n returnTrueCurves?: false;\n sqlFormat?: \"none\" | \"standard\" | \"native\";\n returnExceededLimitFeatures?: boolean;\n /**\n * someday...\n *\n * If 'true' the query will be preceded by a metadata check to gather info about coded value domains and result values will be decoded. If a fieldset is provided it will be used to decode values and no internal metadata request will be issued.\n */\n // decodeValues?: boolean | IField[];\n}\n\nexport interface IQueryFeaturesResponse extends IFeatureSet {\n exceededTransferLimit?: boolean;\n}\n\nexport interface IQueryResponse {\n count?: number;\n extent?: IExtent;\n objectIdFieldName?: string;\n objectIds?: number[];\n}\n\n/**\n * Get a feature by id.\n *\n * ```js\n * import { getFeature } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0\";\n *\n * getFeature({\n * url,\n * id: 42\n * }).then(feature => {\n * console.log(feature.attributes.FID); // 42\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the feature.\n */\nexport function getFeature(\n requestOptions: IFeatureRequestOptions\n): Promise<IFeature> {\n const url = `${requestOptions.url}/${requestOptions.id}`;\n\n // default to a GET request\n const options: IFeatureRequestOptions = {\n ...{ httpMethod: \"GET\" },\n ...requestOptions\n };\n return request(url, options).then((response: any) => response.feature);\n}\n\n/**\n * Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.\n *\n * ```js\n * import { queryFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3\";\n *\n * queryFeatures({\n * url,\n * where: \"STATE_NAME = 'Alaska'\"\n * }).then(result => {\n * console.log(result.features); // array of features\n * });\n * ```\n *\n * @param requestOptions - Options for the request\n * @returns A Promise that will resolve with the query response.\n */\nexport function queryFeatures(\n requestOptions: IQueryFeaturesRequestOptions\n): Promise<IQueryFeaturesResponse | IQueryResponse> {\n const queryOptions: IQueryFeaturesRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, queryOptions);\n\n // set default query parameters\n if (!queryOptions.params.where) {\n queryOptions.params.where = \"1=1\";\n }\n if (!queryOptions.params.outFields) {\n queryOptions.params.outFields = \"*\";\n }\n\n return request(`${queryOptions.url}/query`, queryOptions);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Add features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param adds - Array of JSON features to add.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IAddFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to add.\n */\n adds: IFeature[];\n}\n\n/**\n * Add features results.\n */\nexport interface IAddFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature added.\n */\n addResults?: IEditFeatureResult[];\n}\n\n/**\n * Add features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information.\n *\n * ```js\n * import { addFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * addFeatures({\n * url,\n * adds: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function addFeatures(\n requestOptions: IAddFeaturesRequestOptions\n): Promise<IAddFeaturesResult> {\n const url = `${requestOptions.url}/addFeatures`;\n\n // edit operations are POST only\n const options: IAddFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.adds;\n delete options.params.adds;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IFeature } from \"@esri/arcgis-rest-common-types\";\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport { IEditFeaturesParams, IEditFeatureResult } from \"./helpers\";\n\n/**\n * Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param updates - Array of JSON features to update.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IUpdateFeaturesRequestOptions\n extends IEditFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of JSON features to update.\n */\n updates: IFeature[];\n}\n\n/**\n * Update features results.\n */\nexport interface IUpdateFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature updated.\n */\n updateResults?: IEditFeatureResult[];\n}\n\n/**\n * Update features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.\n *\n * ```js\n * import { updateFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * updateFeatures({\n * url,\n * updates: [{\n * geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },\n * attributes: { status: \"alive\" }\n * }]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the updateFeatures response.\n */\nexport function updateFeatures(\n requestOptions: IUpdateFeaturesRequestOptions\n): Promise<IUpdateFeaturesResult> {\n const url = `${requestOptions.url}/updateFeatures`;\n\n // edit operations are POST only\n const options: IUpdateFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.features = requestOptions.updates;\n delete options.params.updates;\n\n return request(url, options);\n}\n","/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n IEditFeaturesParams,\n IEditFeatureResult,\n ISharedQueryParams\n} from \"./helpers\";\n\n/**\n * Delete features parameters.\n */\nexport interface IDeleteFeaturesParams\n extends IEditFeaturesParams,\n ISharedQueryParams {}\n\n/**\n * Delete features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * @param url - Feature service url.\n * @param deletes - Array of objectIds to delete.\n * @param params - Query parameters to be sent to the feature service via the request.\n */\nexport interface IDeleteFeaturesRequestOptions\n extends IDeleteFeaturesParams,\n IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Array of objectIds to delete.\n */\n deletes: number[];\n}\n\n/**\n * Delete features results.\n */\nexport interface IDeleteFeaturesResult {\n /**\n * Array of JSON response Object(s) for each feature deleted.\n */\n deleteResults?: IEditFeatureResult[];\n}\n\n/**\n * Delete features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information.\n *\n * ```js\n * import { deleteFeatures } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * deleteFeatures({\n * url,\n * deletes: [1,2,3]\n * });\n * ```\n *\n * @param deleteFeaturesRequestOptions - Options for the request.\n * @returns A Promise that will resolve with the deleteFeatures response.\n */\nexport function deleteFeatures(\n requestOptions: IDeleteFeaturesRequestOptions\n): Promise<IDeleteFeaturesResult> {\n const url = `${requestOptions.url}/deleteFeatures`;\n\n // edit operations POST only\n const options: IDeleteFeaturesRequestOptions = {\n params: {},\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n // mixin, don't overwrite\n options.params.objectIds = requestOptions.deletes;\n delete options.params.deletes;\n\n return request(url, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\n\n/**\n * 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.\n *\n */\nexport interface IGetAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to request related `attachmentInfos`.\n */\n featureId: number;\n}\n\n/**\n * Attachment, a.k.a. `attachmentInfo`. See [Attachment](https://developers.arcgis.com/rest/services-reference/attachment-feature-service-.htm) for more information.\n */\nexport interface IAttachmentInfo {\n id: number;\n contentType: string;\n size: number;\n name: string;\n}\n\n/**\n * `getAttachments()` request response.\n */\nexport interface IGetAttachmentsResponse {\n /**\n * Array of `attachmentInfo` Object(s) for each related attachment. Empty Array means no attachments.\n */\n attachmentInfos: IAttachmentInfo[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { getAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * getAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `getAttachments()` response.\n */\nexport function getAttachments(\n requestOptions: IGetAttachmentsOptions\n): Promise<IGetAttachmentsResponse> {\n // pass through\n return request(\n `${requestOptions.url}/${requestOptions.featureId}/attachments`,\n requestOptions\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IAddAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to add related attachment.\n */\n featureId: number;\n /**\n * File to be attached.\n */\n attachment: File;\n}\n\n/**\n * `addAttachment()` request response.\n */\nexport interface IAddAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n addAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * Attach a file to a feature by id. See [Add Attachment](https://developers.arcgis.com/rest/services-reference/add-attachment.htm) for more information.\n *\n * ```js\n * import { addAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * addAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `addAttachment()` response.\n */\nexport function addAttachment(\n requestOptions: IAddAttachmentOptions\n): Promise<IAddAttachmentResponse> {\n const options: IAddAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` --> params: {}\n options.params.attachment = requestOptions.attachment;\n\n return request(`${options.url}/${options.featureId}/addAttachment`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IUpdateAttachmentOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to update related attachment.\n */\n featureId: number;\n /**\n * File to be updated.\n */\n attachment: File;\n /**\n * Unique identifier of the attachment.\n */\n attachmentId: number;\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IUpdateAttachmentResponse {\n /**\n * Standard AGS add/update/edit result Object for the attachment.\n */\n updateAttachmentResult: IEditFeatureResult;\n}\n\n/**\n * 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.\n *\n * ```js\n * import { updateAttachment } from '@esri/arcgis-rest-feature-service';\n *\n * updateAttachment({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachment: myFileInput.files[0],\n * attachmentId: 306\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `updateAttachment()` response.\n */\nexport function updateAttachment(\n requestOptions: IUpdateAttachmentOptions\n): Promise<IUpdateAttachmentResponse> {\n const options: IUpdateAttachmentOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachment` and `attachmentId` --> params: {}\n options.params.attachment = requestOptions.attachment;\n options.params.attachmentId = requestOptions.attachmentId;\n\n return request(\n `${options.url}/${options.featureId}/updateAttachment`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport { IEditFeatureResult } from \"./helpers\";\n\n/**\n * 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.\n *\n */\nexport interface IDeleteAttachmentsOptions extends IRequestOptions {\n /**\n * Feature service url.\n */\n url: string;\n /**\n * Unique identifier of feature to delete related attachment(s).\n */\n featureId: number;\n /**\n * Array of unique identifiers of attachments to delete.\n */\n attachmentIds: number[];\n}\n\n/**\n * `updateAttachment()` request response.\n */\nexport interface IDeleteAttachmentsResponse {\n /**\n * Array of standard AGS add/update/edit result Object(s) for the attachment(s).\n */\n deleteAttachmentResults: IEditFeatureResult[];\n}\n\n/**\n * 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.\n *\n * ```js\n * import { deleteAttachments } from '@esri/arcgis-rest-feature-service';\n *\n * deleteAttachments({\n * url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\",\n * featureId: 8484,\n * attachmentIds: [306]\n * });\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the `deleteAttachments()` response.\n */\nexport function deleteAttachments(\n requestOptions: IDeleteAttachmentsOptions\n): Promise<IDeleteAttachmentsResponse> {\n const options: IDeleteAttachmentsOptions = {\n params: {},\n ...requestOptions\n };\n\n // `attachmentIds` --> params: {}\n options.params.attachmentIds = requestOptions.attachmentIds;\n\n return request(\n `${options.url}/${options.featureId}/deleteAttachments`,\n options\n );\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n IRequestOptions,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\nimport {\n ISpatialReference,\n IFeature,\n IHasZM,\n esriGeometryType,\n IField\n} from \"@esri/arcgis-rest-common-types\";\n\n/**\n * 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.\n */\nexport interface IQueryRelatedRequestOptions extends IRequestOptions {\n url: string;\n relationshipId?: number;\n objectIds?: number[];\n outFields?: \"*\" | string[];\n definitionExpression?: string;\n}\n\n/**\n * Related record data structure\n */\n\nexport interface IRelatedRecordGroup {\n objectId: number;\n relatedRecords?: IFeature[];\n count?: number;\n}\n\n/**\n * Related record response structure\n */\n\nexport interface IQueryRelatedResponse extends IHasZM {\n geometryType?: esriGeometryType;\n spatialReference?: ISpatialReference;\n fields?: IField[];\n relatedRecordGroups: IRelatedRecordGroup[];\n}\n/**\n * Query the related records for a feature service. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-records-feature-service-.htm) for more information.\n *\n * ```js\n * import { queryRelated } from '@esri/arcgis-rest-feature-service'\n *\n * const url = \"http://services.myserver/OrgID/ArcGIS/rest/services/Petroleum/KSPetro/FeatureServer/0\"\n *\n * queryRelated({\n * url: url,\n * relationshipId: 1,\n * params: { returnCountOnly: true }\n * })\n * .then(response => {\n * console.log(response.relatedRecords)\n * })\n * ```\n *\n * @param requestOptions\n * @returns A Promise that will resolve with the query response\n */\nexport function queryRelated(\n requestOptions: IQueryRelatedRequestOptions\n): Promise<IQueryRelatedResponse> {\n const options: IQueryRelatedRequestOptions = {\n params: {},\n httpMethod: \"GET\",\n url: requestOptions.url,\n ...requestOptions\n };\n\n appendCustomParams(requestOptions, options);\n\n if (!options.params.definitionExpression) {\n options.params.definitionExpression = \"1=1\";\n }\n\n if (!options.params.outFields) {\n options.params.outFields = \"*\";\n }\n\n if (!options.params.relationshipId) {\n options.params.relationshipId = 0;\n }\n\n return request(`${options.url}/queryRelatedRecords`, options);\n}\n","/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { IRequestOptions } from \"@esri/arcgis-rest-request\";\nimport {\n IField,\n ILayerDefinition,\n IFeature\n} from \"@esri/arcgis-rest-common-types\";\nimport { IQueryFeaturesResponse } from \"./query\";\nimport { getLayer } from \"./getLayer\";\n\n/**\n * Request options to fetch a feature by id.\n */\nexport interface IDecodeValuesRequestOptions extends IRequestOptions {\n /**\n * Layer service url.\n */\n url: string;\n /**\n * Unique identifier of the feature.\n */\n queryResponse: IQueryFeaturesResponse;\n /**\n * * If a fieldset is provided, no internal metadata check will be issued to gather info about coded value domains.\n *\n * getFeatureService(url)\n * .then(metadata => {\n * queryFeatures({ url })\n * .then(response => {\n * decodeValues({\n * url,\n * queryResponse,\n * fields: metadata.fields\n * })\n * .then(decodedResponse)\n * })\n * })\n */\n fields?: IField[];\n}\n\n/**\n * Replaces the raw coded domain values in a query response with descriptions (for legibility).\n *\n * ```js\n * import { queryFeatures, decodeValues } from '@esri/arcgis-rest-feature-service';\n *\n * const url = \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0\";\n *\n * queryFeatures({ url })\n * .then(queryResponse => {\n * decodeValues({\n * url,\n * queryResponse\n * })\n * .then(decodedResponse)\n * })\n * ```\n *\n * @param requestOptions - Options for the request.\n * @returns A Promise that will resolve with the addFeatures response.\n */\nexport function decodeValues(\n requestOptions: IDecodeValuesRequestOptions\n): Promise<IQueryFeaturesResponse> {\n return new Promise(resolve => {\n if (!requestOptions.fields) {\n return getLayer(requestOptions.url, requestOptions).then(\n (metadata: ILayerDefinition) => {\n resolve((requestOptions.fields = metadata.fields));\n }\n );\n } else {\n resolve(requestOptions.fields);\n }\n }).then(fields => {\n // turn the fields array into a POJO to avoid multiple calls to Array.find()\n const fieldsObject: any = {};\n const fieldsArray = fields as IField[];\n fieldsArray.forEach((field: IField) => {\n fieldsObject[field.name] = field;\n });\n\n // dont mutate original response\n const clonedResponse = JSON.parse(\n JSON.stringify(requestOptions.queryResponse)\n );\n\n clonedResponse.features.forEach((feature: IFeature) => {\n for (const key in feature.attributes) {\n /* istanbul ignore next */\n if (!feature.attributes.hasOwnProperty(key)) continue;\n feature.attributes[key] = convertAttribute(\n feature.attributes,\n fieldsObject[key]\n );\n }\n });\n return clonedResponse;\n });\n}\n\n/**\n * ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L193-L220\n *\n * Decodes an attributes CVD and standardizes any date fields\n *\n * @params {object} attribute - a single esri feature attribute\n * @params {object} field - the field metadata describing that attribute\n * @returns {object} outAttribute - the converted attribute\n * @private\n */\n\nfunction convertAttribute(attribute: any, field: IField) {\n const inValue = attribute[field.name];\n let value;\n\n if (inValue === null) return inValue;\n\n if (field.domain && field.domain.type === \"codedValue\") {\n value = cvd(inValue, field);\n } else {\n value = inValue;\n }\n return value;\n}\n\n/**\n * also ripped off from https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L222-L235\n *\n * Looks up a value from a coded domain\n *\n * @params {integer} value - The original field value\n * @params {object} field - metadata describing the attribute field\n * @returns {string/integerfloat} - The decoded field value\n * @private\n */\n\nfunction cvd(value: any, field: IField) {\n const domain = field.domain.codedValues.find((d: any) => {\n return value === d.code;\n });\n return domain ? domain.name : value;\n}\n"],"names":["url","requestOptions","request","id","options","httpMethod","then","response","feature","queryOptions","params","appendCustomParams","where","outFields","features","adds","updates","objectIds","deletes","featureId","attachment","attachmentId","attachmentIds","definitionExpression","relationshipId","Promise","resolve","fields","getLayer","metadata","fieldsObject","forEach","field","name","clonedResponse","JSON","parse","stringify","queryResponse","key","attributes","hasOwnProperty","attribute","inValue","domain","type","value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EAAEC,OAErB,OAAON,EAASA,EAAOX,KAAOa,EAtBpBK,CAAIR,EAASX,GAEbW,IATZ,IAA0BD,EAAgBV,EAClCW,IAhBGT"} |
+3
-3
| { | ||
| "name": "@esri/arcgis-rest-feature-service", | ||
| "version": "1.13.2", | ||
| "version": "1.14.0", | ||
| "description": "Feature service helpers for @esri/arcgis-rest-request", | ||
@@ -18,4 +18,4 @@ "main": "dist/node/index.js", | ||
| "devDependencies": { | ||
| "@esri/arcgis-rest-common-types": "^1.13.2", | ||
| "@esri/arcgis-rest-request": "^1.13.2" | ||
| "@esri/arcgis-rest-common-types": "^1.14.0", | ||
| "@esri/arcgis-rest-request": "^1.14.0" | ||
| }, | ||
@@ -22,0 +22,0 @@ "peerDependencies": { |
| import { esriGeometryType, SpatialRelationship, IFeature, IGeometry, ISpatialReference, IFeatureSet, esriUnits } from "@esri/arcgis-rest-common-types"; | ||
| import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
| /** | ||
| * 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; | ||
| } | ||
| 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; | ||
| } | ||
| export interface ISharedQueryParams { | ||
| where?: string; | ||
| geometry?: IGeometry; | ||
| geometryType?: esriGeometryType; | ||
| inSR?: string | ISpatialReference; | ||
| 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?: esriUnits; | ||
| outFields?: "*" | string[]; | ||
| returnGeometry?: boolean; | ||
| maxAllowableOffset?: number; | ||
| geometryPrecision?: number; | ||
| outSR?: string | ISpatialReference; | ||
| gdbVersion?: string; | ||
| returnDistinctValues?: boolean; | ||
| returnIdsOnly?: boolean; | ||
| returnCountOnly?: boolean; | ||
| returnExtentOnly?: boolean; | ||
| orderByFields?: string; | ||
| groupByFieldsForStatistics?: string; | ||
| outStatistics?: IStatisticDefinition[]; | ||
| returnZ?: boolean; | ||
| returnM?: boolean; | ||
| multipatchOption?: "xyFootprint"; | ||
| resultOffset?: number; | ||
| resultRecordCount?: number; | ||
| quantizationParameters?: any; | ||
| returnCentroid?: boolean; | ||
| resultType?: "none" | "standard" | "tile"; | ||
| historicMoment?: number; | ||
| returnTrueCurves?: false; | ||
| sqlFormat?: "none" | "standard" | "native"; | ||
| returnExceededLimitFeatures?: boolean; | ||
| [key: string]: any; | ||
| } | ||
| export interface IQueryFeaturesResponse extends IFeatureSet { | ||
| exceededTransferLimit?: boolean; | ||
| } | ||
| /** | ||
| * Get a feature by id | ||
| * | ||
| * ```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 | ||
| * @returns A Promise that will resolve with the feature. | ||
| */ | ||
| export declare function getFeature(requestOptions: IFeatureRequestOptions): Promise<IFeature>; | ||
| /** | ||
| * Query features | ||
| * | ||
| * ```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 | ||
| * @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>; |
| import * as tslib_1 from "tslib"; | ||
| import { request } from "@esri/arcgis-rest-request"; | ||
| /** | ||
| * Get a feature by id | ||
| * | ||
| * ```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 | ||
| * @returns A Promise that will resolve with the feature. | ||
| */ | ||
| export function getFeature(requestOptions) { | ||
| var url = requestOptions.url + "/" + requestOptions.id; | ||
| // default to a GET request | ||
| var options = tslib_1.__assign({ httpMethod: "GET" }, requestOptions); | ||
| return request(url, options).then(function (response) { return response.feature; }); | ||
| } | ||
| /** | ||
| * Query features | ||
| * | ||
| * ```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 | ||
| * @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 | ||
| if (!options.params.where) { | ||
| options.params.where = "1=1"; | ||
| } | ||
| if (!options.params.outFields) { | ||
| options.params.outFields = "*"; | ||
| } | ||
| 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 |
| {"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/features.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,OAAO,EAA4B,MAAM,2BAA2B,CAAC;AAwF9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,qBACJ,cAAsC;IAEtC,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,SAAI,cAAc,CAAC,EAAI,CAAC;IAEzD,2BAA2B;IAC3B,IAAM,OAAO,oBACR,EAAE,UAAU,EAAE,KAAK,EAAE,EACrB,cAAc,CAClB,CAAC;IACF,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,QAAQ,CAAC,OAAO,EAAhB,CAAgB,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,wBACJ,cAA4C;IAE5C,2BAA2B;IAC3B,IAAM,OAAO,sBACX,MAAM,EAAE,EAAE,EACV,UAAU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,CAAC,CAAC;AAC/B,CAAC;AAqCD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,yBACJ,cAA6C;IAE7C,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,oBAAiB,CAAC;IAEnD,4BAA4B;IAC5B,IAAM,OAAO,sBACX,MAAM,EAAE,EAAE,IACP,cAAc,CAClB,CAAC;IAEF,kBAAkB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAE5C,yBAAyB;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC;IAElD,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED,4BAA4B,UAAuC,EAAE,UAA0B;IAC7F,kFAAkF;IAClF,KAAK,IAAM,QAAQ,IAAI,UAAU,EAAE;QACjC,0BAA0B;QAC1B,IAAI,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;YACvC,IACE,QAAQ,KAAK,KAAK;gBAClB,QAAQ,KAAK,QAAQ;gBACrB,QAAQ,KAAK,gBAAgB;gBAC7B,QAAQ,KAAK,YAAY;gBACzB,QAAQ,KAAK,OAAO;gBACpB,QAAQ,KAAK,QAAQ;gBACrB,QAAQ,KAAK,cAAc,EAC3B;gBACA,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;aACpD;SACF;KACF;AACH,CAAC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var tslib_1 = require("tslib"); | ||
| var arcgis_rest_request_1 = require("@esri/arcgis-rest-request"); | ||
| /** | ||
| * Get a feature by id | ||
| * | ||
| * ```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 | ||
| * @returns A Promise that will resolve with the feature. | ||
| */ | ||
| function getFeature(requestOptions) { | ||
| var url = requestOptions.url + "/" + requestOptions.id; | ||
| // default to a GET request | ||
| var options = tslib_1.__assign({ httpMethod: "GET" }, requestOptions); | ||
| return arcgis_rest_request_1.request(url, options).then(function (response) { return response.feature; }); | ||
| } | ||
| exports.getFeature = getFeature; | ||
| /** | ||
| * Query features | ||
| * | ||
| * ```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 | ||
| * @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 | ||
| if (!options.params.where) { | ||
| options.params.where = "1=1"; | ||
| } | ||
| if (!options.params.outFields) { | ||
| options.params.outFields = "*"; | ||
| } | ||
| 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 |
| {"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/features.ts"],"names":[],"mappings":";;;AAYA,iEAA8E;AAwF9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,oBACE,cAAsC;IAEtC,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,SAAI,cAAc,CAAC,EAAI,CAAC;IAEzD,2BAA2B;IAC3B,IAAM,OAAO,oBACR,EAAE,UAAU,EAAE,KAAK,EAAE,EACrB,cAAc,CAClB,CAAC;IACF,OAAO,6BAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,QAAQ,CAAC,OAAO,EAAhB,CAAgB,CAAC,CAAC;AACzE,CAAC;AAXD,gCAWC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uBACE,cAA4C;IAE5C,2BAA2B;IAC3B,IAAM,OAAO,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AO,CAAC;IAEjD,OAAO,6BAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAjBD,wCAiBC;AAqCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBACE,cAA6C;IAE7C,IAAM,GAAG,GAAM,cAAc,CAAC,GAAG,oBAAiB,CAAC;IAEnD,4BAA4B;IAC5B,IAAM,OAAO,sBACX,MAAM,EAAE,EAAE,IACP,cAAc,CAClB,CAAC;IAEF,kBAAkB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAE5C,yBAAyB;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC;IAElD,OAAO,6BAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAjBD,wCAiBC;AAED,4BAA4B,UAAuC,EAAE,UAA0B;IAC7F,kFAAkF;IAClF,KAAK,IAAM,QAAQ,IAAI,UAAU,EAAE;QACjC,0BAA0B;QAC1B,IAAI,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;YACvC,IACE,QAAQ,KAAK,KAAK;gBAClB,QAAQ,KAAK,QAAQ;gBACrB,QAAQ,KAAK,gBAAgB;gBAC7B,QAAQ,KAAK,YAAY;gBACzB,QAAQ,KAAK,OAAO;gBACpB,QAAQ,KAAK,QAAQ;gBACrB,QAAQ,KAAK,cAAc,EAC3B;gBACA,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;aACpD;SACF;KACF;AACH,CAAC"} |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
174427
2.81%72
5.88%3
-40%1997
-8.85%6
20%