@esri/arcgis-rest-feature-service
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -1,3 +0,3 @@ | ||
import { esriGeometryType, IFeature, IGeometry, ISpatialReference, IFeatureSet } from "@esri/arcgis-rest-common-types"; | ||
import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
import { esriGeometryType, SpatialRelationship, IFeature, IGeometry, ISpatialReference, IFeatureSet } from "@esri/arcgis-rest-common-types"; | ||
import { IRequestOptions, IParams } from "@esri/arcgis-rest-request"; | ||
/** | ||
@@ -23,2 +23,9 @@ * parameters required to get a feature by id | ||
} | ||
export interface ISharedQueryParams extends IParams { | ||
where?: string; | ||
geometry?: IGeometry; | ||
geometryType?: esriGeometryType; | ||
inSR?: string | ISpatialReference; | ||
spatialRel?: SpatialRelationship; | ||
} | ||
/** | ||
@@ -29,9 +36,4 @@ * feature query parameters | ||
*/ | ||
export interface IQueryFeaturesParams { | ||
where?: string; | ||
export interface IQueryFeaturesParams extends ISharedQueryParams { | ||
objectIds?: number[]; | ||
geometry?: IGeometry; | ||
geometryType?: esriGeometryType; | ||
inSR?: string | ISpatialReference; | ||
spatialRel?: "esriSpatialRelIntersects" | "esriSpatialRelContains" | "esriSpatialRelCrosses" | "esriSpatialRelEnvelopeIntersects" | "esriSpatialRelIndexIntersects" | "esriSpatialRelOverlaps" | "esriSpatialRelTouches" | "esriSpatialRelWithin"; | ||
relationParam?: string; | ||
@@ -94,1 +96,133 @@ time?: Date | Date[]; | ||
export declare function queryFeatures(requestOptions: IQueryFeaturesRequestOptions): Promise<IQueryFeaturesResponse>; | ||
/** | ||
* add, update and delete features results | ||
*/ | ||
export interface IEditFeatureResult { | ||
objectId: number; | ||
globalId?: string; | ||
success: boolean; | ||
} | ||
/** | ||
* add and update features update parameters | ||
*/ | ||
export interface IEditFeaturesParams extends IParams { | ||
gdbVersion?: string; | ||
returnEditMoment?: boolean; | ||
rollbackOnFailure?: boolean; | ||
} | ||
/** | ||
* add features request options | ||
* | ||
* @param url - layer service url | ||
* @param params - query parameters to be sent to the feature service | ||
*/ | ||
export interface IAddFeaturesRequestOptions extends IRequestOptions { | ||
url: string; | ||
adds: IFeature[]; | ||
params?: IEditFeaturesParams; | ||
} | ||
/** | ||
* add features results | ||
*/ | ||
export interface IAddFeaturesResult { | ||
addResults?: IEditFeatureResult[]; | ||
} | ||
/** | ||
* Add features | ||
* | ||
* ```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 - layer service url | ||
* @param params - query parameters to be sent to the feature service | ||
*/ | ||
export interface IUpdateFeaturesRequestOptions extends IRequestOptions { | ||
url: string; | ||
updates: IFeature[]; | ||
params?: IEditFeaturesParams; | ||
} | ||
/** | ||
* update features results | ||
*/ | ||
export interface IUpdateFeaturesResult { | ||
updateResults?: IEditFeatureResult[]; | ||
} | ||
/** | ||
* Update features | ||
* | ||
* ```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 - layer service url | ||
* @param params - query parameters to be sent to the feature service | ||
*/ | ||
export interface IDeleteFeaturesRequestOptions extends IRequestOptions { | ||
url: string; | ||
deletes: number[]; | ||
params?: IDeleteFeaturesParams; | ||
} | ||
/** | ||
* update features results | ||
*/ | ||
export interface IDeleteFeaturesResult { | ||
deleteResults?: IEditFeatureResult[]; | ||
} | ||
/** | ||
* Delete features | ||
* | ||
* ```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>; |
@@ -22,4 +22,3 @@ import * as tslib_1 from "tslib"; | ||
export function queryFeatures(requestOptions) { | ||
// set default query parameters | ||
// and default to a GET request | ||
// default to a GET request | ||
var options = tslib_1.__assign({ | ||
@@ -29,2 +28,3 @@ params: {}, | ||
}, requestOptions); | ||
// set default query parameters | ||
if (!options.params.where) { | ||
@@ -36,5 +36,85 @@ options.params.where = "1=1"; | ||
} | ||
// TODO: do we need to serialize any of the array/object params? | ||
return request(requestOptions.url + "/query", options); | ||
} | ||
/** | ||
* Add features | ||
* | ||
* ```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); | ||
// mixin, don't overwrite | ||
options.params.features = requestOptions.adds; | ||
return request(url, options); | ||
} | ||
/** | ||
* Update features | ||
* | ||
* ```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); | ||
// mixin, don't overwrite | ||
options.params.features = requestOptions.updates; | ||
return request(url, options); | ||
} | ||
/** | ||
* Delete features | ||
* | ||
* ```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); | ||
// mixin, don't overwrite | ||
options.params.objectIds = requestOptions.deletes; | ||
return request(url, options); | ||
} | ||
//# sourceMappingURL=features.js.map |
@@ -25,4 +25,3 @@ "use strict"; | ||
function queryFeatures(requestOptions) { | ||
// set default query parameters | ||
// and default to a GET request | ||
// default to a GET request | ||
var options = tslib_1.__assign({ | ||
@@ -32,2 +31,3 @@ params: {}, | ||
}, requestOptions); | ||
// set default query parameters | ||
if (!options.params.where) { | ||
@@ -39,6 +39,89 @@ options.params.where = "1=1"; | ||
} | ||
// TODO: do we need to serialize any of the array/object params? | ||
return arcgis_rest_request_1.request(requestOptions.url + "/query", options); | ||
} | ||
exports.queryFeatures = queryFeatures; | ||
/** | ||
* Add features | ||
* | ||
* ```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); | ||
// mixin, don't overwrite | ||
options.params.features = requestOptions.adds; | ||
return arcgis_rest_request_1.request(url, options); | ||
} | ||
exports.addFeatures = addFeatures; | ||
/** | ||
* Update features | ||
* | ||
* ```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); | ||
// mixin, don't overwrite | ||
options.params.features = requestOptions.updates; | ||
return arcgis_rest_request_1.request(url, options); | ||
} | ||
exports.updateFeatures = updateFeatures; | ||
/** | ||
* Delete features | ||
* | ||
* ```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); | ||
// mixin, don't overwrite | ||
options.params.objectIds = requestOptions.deletes; | ||
return arcgis_rest_request_1.request(url, options); | ||
} | ||
exports.deleteFeatures = deleteFeatures; | ||
//# sourceMappingURL=features.js.map |
@@ -1,2 +0,2 @@ | ||
/* @esri/arcgis-rest-feature-service - v1.1.2 - Wed May 02 2018 13:58:27 GMT-0700 (PDT) | ||
/* @esri/arcgis-rest-feature-service - v1.1.2 - Mon May 14 2018 16:55:18 GMT-0700 (PDT) | ||
* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
@@ -55,4 +55,3 @@ * Apache-2.0 */ | ||
function queryFeatures(requestOptions) { | ||
// set default query parameters | ||
// and default to a GET request | ||
// default to a GET request | ||
var options = __assign({ | ||
@@ -62,2 +61,3 @@ params: {}, | ||
}, requestOptions); | ||
// set default query parameters | ||
if (!options.params.where) { | ||
@@ -69,8 +69,52 @@ options.params.where = "1=1"; | ||
} | ||
// TODO: do we need to serialize any of the array/object params? | ||
return arcgisRestRequest.request(requestOptions.url + "/query", options); | ||
} | ||
/** | ||
* Add features | ||
* | ||
* @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 = __assign({ params: {} }, requestOptions); | ||
// mixin, don't overwrite | ||
options.params.features = requestOptions.adds; | ||
return arcgisRestRequest.request(url, options); | ||
} | ||
/** | ||
* Update features | ||
* | ||
* @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 = __assign({ params: {} }, requestOptions); | ||
// mixin, don't overwrite | ||
options.params.features = requestOptions.updates; | ||
return arcgisRestRequest.request(url, options); | ||
} | ||
/** | ||
* Delete features | ||
* | ||
* @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 = __assign({ params: {} }, requestOptions); | ||
// mixin, don't overwrite | ||
options.params.objectIds = requestOptions.deletes; | ||
return arcgisRestRequest.request(url, options); | ||
} | ||
exports.getFeature = getFeature; | ||
exports.queryFeatures = queryFeatures; | ||
exports.addFeatures = addFeatures; | ||
exports.updateFeatures = updateFeatures; | ||
exports.deleteFeatures = deleteFeatures; | ||
@@ -77,0 +121,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,5 +0,5 @@ | ||
/* @esri/arcgis-rest-feature-service - v1.1.2 - Wed May 02 2018 13:58:29 GMT-0700 (PDT) | ||
/* @esri/arcgis-rest-feature-service - v1.1.2 - Mon May 14 2018 16:55:19 GMT-0700 (PDT) | ||
* Copyright (c) 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,s=arguments.length;t<s;t++)for(var u in r=arguments[t])Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u]);return e};e.getFeature=function(e){var s=e.url+"/"+e.id,u=t({httpMethod:"GET"},e);return r.request(s,u).then(function(e){return e.feature})},e.queryFeatures=function(e){var s=t({params:{},httpMethod:"GET"},e);return s.params.where||(s.params.where="1=1"),s.params.outFields||(s.params.outFields="*"),r.request(e.url+"/query",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 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})}); | ||
//# sourceMappingURL=arcgis-rest-feature-service.umd.min.js.map |
{ | ||
"name": "@esri/arcgis-rest-feature-service", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Feature service helpers for @esri/arcgis-rest-request", | ||
"main": "dist/node/index.js", | ||
"browser": "dist/umd/arcgis-rest-feature-service.umd.js", | ||
"browser": "dist/umd/feature-service.umd.js", | ||
"module": "dist/esm/index.js", | ||
@@ -22,4 +22,4 @@ "js:next": "dist/esm/index.js", | ||
"devDependencies": { | ||
"@esri/arcgis-rest-common-types": "^1.1.2", | ||
"@esri/arcgis-rest-request": "^1.1.2" | ||
"@esri/arcgis-rest-common-types": "^1.2.0", | ||
"@esri/arcgis-rest-request": "^1.2.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
76625
20
754
2
2