@esri/arcgis-rest-feature-service
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -1,1 +0,4 @@ | ||
export * from "./features"; | ||
export * from "./query"; | ||
export * from "./add"; | ||
export * from "./update"; | ||
export * from "./delete"; |
@@ -1,2 +0,5 @@ | ||
export * from "./features"; | ||
export * from "./query"; | ||
export * from "./add"; | ||
export * from "./update"; | ||
export * from "./delete"; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./features"), exports); | ||
tslib_1.__exportStar(require("./query"), exports); | ||
tslib_1.__exportStar(require("./add"), exports); | ||
tslib_1.__exportStar(require("./update"), exports); | ||
tslib_1.__exportStar(require("./delete"), exports); | ||
//# sourceMappingURL=index.js.map |
/* @preserve | ||
* @esri/arcgis-rest-feature-service - v1.4.0 - Wed Jun 06 2018 09:52:03 GMT-0700 (PDT) | ||
* @esri/arcgis-rest-feature-service - v1.4.1 - Wed Jun 20 2018 09:27:01 GMT-0700 (PDT) | ||
* Copyright (c) 2017 - 2018 Environmental Systems Research Institute, Inc. | ||
@@ -39,4 +39,38 @@ * Apache-2.0 | ||
/** | ||
* Get a feature by id | ||
* Used internally by the package to ensure that first order request options are passed through as request parameters. | ||
*/ | ||
function appendCustomParams(oldOptions, newOptions) { | ||
// only pass query parameters through in the request, not generic IRequestOptions props | ||
Object.keys(oldOptions).forEach(function (key) { | ||
if (key !== "url" && | ||
key !== "params" && | ||
key !== "authentication" && | ||
key !== "httpMethod" && | ||
key !== "fetch" && | ||
key !== "portal" && | ||
key !== "maxUrlLength") { | ||
newOptions.params[key] = oldOptions[key]; | ||
} | ||
}); | ||
} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/** | ||
* 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 | ||
@@ -52,4 +86,18 @@ * @returns A Promise that will resolve with the feature. | ||
/** | ||
* Query features | ||
* Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information. | ||
* | ||
* ```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 | ||
@@ -60,6 +108,4 @@ * @returns A Promise that will resolve with the query response. | ||
// default to a GET request | ||
var options = __assign({ | ||
params: {}, | ||
httpMethod: "GET" | ||
}, requestOptions); | ||
var options = __assign({ params: {}, httpMethod: "GET", url: requestOptions.url }, requestOptions); | ||
appendCustomParams(requestOptions, options); | ||
// set default query parameters | ||
@@ -72,6 +118,9 @@ if (!options.params.where) { | ||
} | ||
return arcgisRestRequest.request(requestOptions.url + "/query", options); | ||
return arcgisRestRequest.request(options.url + "/query", options); | ||
} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/** | ||
* Add features request. | ||
* Add features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/add-features.htm) for more information. | ||
* | ||
@@ -100,2 +149,3 @@ * @param requestOptions - Options for the request. | ||
var options = __assign({ params: {} }, requestOptions); | ||
appendCustomParams(requestOptions, options); | ||
// mixin, don't overwrite | ||
@@ -105,4 +155,7 @@ options.params.features = requestOptions.adds; | ||
} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/** | ||
* Update features request. | ||
* Update features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information. | ||
* | ||
@@ -130,2 +183,3 @@ * ```js | ||
var options = __assign({ params: {} }, requestOptions); | ||
appendCustomParams(requestOptions, options); | ||
// mixin, don't overwrite | ||
@@ -135,4 +189,7 @@ options.params.features = requestOptions.updates; | ||
} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
/** | ||
* Delete features request. | ||
* Delete features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/delete-features.htm) for more information. | ||
* | ||
@@ -157,2 +214,3 @@ * ```js | ||
var options = __assign({ params: {} }, requestOptions); | ||
appendCustomParams(requestOptions, options); | ||
// mixin, don't overwrite | ||
@@ -159,0 +217,0 @@ options.params.objectIds = requestOptions.deletes; |
/* @preserve | ||
* @esri/arcgis-rest-feature-service - v1.4.0 - Wed Jun 06 2018 09:52:05 GMT-0700 (PDT) | ||
* @esri/arcgis-rest-feature-service - v1.4.1 - Wed Jun 20 2018 09:27:06 GMT-0700 (PDT) | ||
* Copyright (c) 2017 - 2018 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 | ||
*/ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],r):r(e.arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,function(e,r){"use strict";var t=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var s in r=arguments[t])Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);return e};e.getFeature=function(e){var a=e.url+"/"+e.id,s=t({httpMethod:"GET"},e);return r.request(a,s).then(function(e){return e.feature})},e.queryFeatures=function(e){var a=t({params:{},httpMethod:"GET"},e);return a.params.where||(a.params.where="1=1"),a.params.outFields||(a.params.outFields="*"),r.request(e.url+"/query",a)},e.addFeatures=function(e){var a=e.url+"/addFeatures",s=t({params:{}},e);return s.params.features=e.adds,r.request(a,s)},e.updateFeatures=function(e){var a=e.url+"/updateFeatures",s=t({params:{}},e);return s.params.features=e.updates,r.request(a,s)},e.deleteFeatures=function(e){var a=e.url+"/deleteFeatures",s=t({params:{}},e);return s.params.objectIds=e.deletes,r.request(a,s)},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],r):r(e.arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,function(e,r){"use strict";var t=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var u in r=arguments[t])Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u]);return e};function a(e,r){Object.keys(e).forEach(function(t){"url"!==t&&"params"!==t&&"authentication"!==t&&"httpMethod"!==t&&"fetch"!==t&&"portal"!==t&&"maxUrlLength"!==t&&(r.params[t]=e[t])})}e.getFeature=function(e){var a=e.url+"/"+e.id,u=t({httpMethod:"GET"},e);return r.request(a,u).then(function(e){return e.feature})},e.queryFeatures=function(e){var u=t({params:{},httpMethod:"GET",url:e.url},e);return a(e,u),u.params.where||(u.params.where="1=1"),u.params.outFields||(u.params.outFields="*"),r.request(u.url+"/query",u)},e.addFeatures=function(e){var u=e.url+"/addFeatures",s=t({params:{}},e);return a(e,s),s.params.features=e.adds,r.request(u,s)},e.updateFeatures=function(e){var u=e.url+"/updateFeatures",s=t({params:{}},e);return a(e,s),s.params.features=e.updates,r.request(u,s)},e.deleteFeatures=function(e){var u=e.url+"/deleteFeatures",s=t({params:{}},e);return a(e,s),s.params.objectIds=e.deletes,r.request(u,s)},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=feature-service.umd.min.js.map |
{ | ||
"name": "@esri/arcgis-rest-feature-service", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Feature service helpers for @esri/arcgis-rest-request", | ||
@@ -22,4 +22,4 @@ "main": "dist/node/index.js", | ||
"devDependencies": { | ||
"@esri/arcgis-rest-common-types": "^1.4.0", | ||
"@esri/arcgis-rest-request": "^1.4.0" | ||
"@esri/arcgis-rest-common-types": "^1.4.1", | ||
"@esri/arcgis-rest-request": "^1.4.1" | ||
}, | ||
@@ -26,0 +26,0 @@ "scripts": { |
@@ -24,3 +24,3 @@ [![npm version][npm-img]][npm-url] | ||
const params = { | ||
const options = { | ||
url: | ||
@@ -31,3 +31,3 @@ "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0", | ||
getFeature(params) | ||
getFeature(options) | ||
.then(feature => { | ||
@@ -34,0 +34,0 @@ console.log(feature.attributes.FID); // 42 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137582
47
1557
2