ducimusipsa 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.prettierignore +2 -0
- package/.travis.yml +34 -0
- package/.vscode/launch.json +24 -0
- package/.vscode/settings.json +3 -0
- package/demos/ago-node-cli/README.md +29 -0
- package/demos/ago-node-cli/ago.js +32 -0
- package/demos/ago-node-cli/index.js +11 -0
- package/demos/ago-node-cli/lib/item-export-command.js +48 -0
- package/demos/ago-node-cli/lib/item-search-command.js +35 -0
- package/demos/ago-node-cli/package-lock.json +180 -0
- package/demos/ago-node-cli/package.json +30 -0
- package/demos/attachments/README.md +5 -0
- package/demos/attachments/index.html +164 -0
- package/demos/attachments/package-lock.json +182 -0
- package/demos/attachments/package.json +18 -0
- package/demos/batch-geocoder-node/NYC_Restaurant_Inspection_Results.csv +100 -0
- package/demos/batch-geocoder-node/README.md +15 -0
- package/demos/batch-geocoder-node/batch-geocode.js +115 -0
- package/demos/batch-geocoder-node/config-template.js +18 -0
- package/demos/batch-geocoder-node/package-lock.json +109 -0
- package/demos/batch-geocoder-node/package.json +38 -0
- package/demos/express/README.md +15 -0
- package/demos/express/config.json.template +3 -0
- package/demos/express/package-lock.json +428 -0
- package/demos/express/package.json +18 -0
- package/demos/express/server.js +33 -0
- package/demos/feature-service-browser/README.md +6 -0
- package/demos/feature-service-browser/index.html +122 -0
- package/demos/feature-service-browser/package-lock.json +182 -0
- package/demos/feature-service-browser/package.json +18 -0
- package/demos/geocoder-browser/README.md +10 -0
- package/demos/geocoder-browser/config.js.template +1 -0
- package/demos/geocoder-browser/index.html +131 -0
- package/demos/geocoder-browser/package-lock.json +182 -0
- package/demos/geocoder-browser/package.json +19 -0
- package/demos/geocoder-browser/post-sign-in.html +25 -0
- package/demos/jsapi-integration/README.md +25 -0
- package/demos/jsapi-integration/config.js +6 -0
- package/demos/jsapi-integration/index.html +85 -0
- package/demos/jsapi-integration/package-lock.json +184 -0
- package/demos/jsapi-integration/package.json +19 -0
- package/demos/oauth2-browser/README.md +14 -0
- package/demos/oauth2-browser/authenticate.html +32 -0
- package/demos/oauth2-browser/config.js.template +6 -0
- package/demos/oauth2-browser/index.html +202 -0
- package/demos/oauth2-browser/logo.svg +4 -0
- package/demos/oauth2-browser/package-lock.json +163 -0
- package/demos/oauth2-browser/package.json +18 -0
- package/demos/oauth2-browser/style.css +36 -0
- package/demos/oauth2-browser-retry/README.md +25 -0
- package/demos/oauth2-browser-retry/authenticate.html +21 -0
- package/demos/oauth2-browser-retry/index.html +116 -0
- package/demos/oauth2-browser-retry/logo.svg +4 -0
- package/demos/vue/.env.example +11 -0
- package/demos/vue/.eslintrc.js +17 -0
- package/demos/vue/.postcssrc.js +5 -0
- package/demos/vue/README.md +17 -0
- package/demos/vue/babel.config.js +3 -0
- package/demos/vue/package-lock.json +11323 -0
- package/demos/vue/package.json +33 -0
- package/demos/vue/public/favicon.ico +0 -0
- package/demos/vue/public/index.html +24 -0
- package/demos/vue/src/assets/logo.svg +29 -0
- package/demos/vue/src/components/App.vue +308 -0
- package/demos/vue/src/components/Authenticate.vue +65 -0
- package/demos/vue/src/components/Loader.vue +230 -0
- package/demos/vue/src/main.js +92 -0
- package/docs/FAQ.md +28 -0
- package/docs/HISTORY.md +62 -0
- package/docs/acetate.config.js +223 -0
- package/docs/build-typedoc.js +303 -0
- package/docs/src/_layout.html +82 -0
- package/docs/src/api/_declaration.html +496 -0
- package/docs/src/api/_layout.html +127 -0
- package/docs/src/api/_package.html +13 -0
- package/docs/src/api/index.html +23 -0
- package/docs/src/guides/_layout.html +24 -0
- package/docs/src/guides/amd-requirejs-dojo.md +40 -0
- package/docs/src/guides/babel-and-rollup.md +30 -0
- package/docs/src/guides/babel-and-webpack.md +30 -0
- package/docs/src/guides/browser-authentication.md +41 -0
- package/docs/src/guides/browserify.md +9 -0
- package/docs/src/guides/cli-authentication.md +9 -0
- package/docs/src/guides/client-server-authentication.md +9 -0
- package/docs/src/guides/from-a-cdn.md +36 -0
- package/docs/src/guides/index.md +52 -0
- package/docs/src/guides/node.md +70 -0
- package/docs/src/guides/package-overview.md +8 -0
- package/docs/src/guides/server-authentication.md +9 -0
- package/docs/src/guides/typescript-and-webpack.md +9 -0
- package/docs/src/img/icons.png +0 -0
- package/docs/src/img/icons@2x.png +0 -0
- package/docs/src/index.html +12 -0
- package/docs/src/js/api-search.js +112 -0
- package/docs/src/js/nav-toggle.js +41 -0
- package/docs/src/sass/_highlight.scss +96 -0
- package/docs/src/sass/_icons.scss +157 -0
- package/docs/src/sass/style.scss +169 -0
- package/jasmine.json +7 -0
- package/karma.conf.js +100 -0
- package/lerna.json +8 -0
- package/notes/README.md +88 -0
- package/package.json +129 -0
- package/packages/arcgis-rest-auth/README.md +67 -0
- package/packages/arcgis-rest-auth/package-lock.json +11 -0
- package/packages/arcgis-rest-auth/package.json +53 -0
- package/packages/arcgis-rest-auth/src/ApplicationSession.ts +108 -0
- package/packages/arcgis-rest-auth/src/UserSession.ts +880 -0
- package/packages/arcgis-rest-auth/src/authenticated-request-options.ts +24 -0
- package/packages/arcgis-rest-auth/src/fetch-token.ts +52 -0
- package/packages/arcgis-rest-auth/src/generate-token.ts +39 -0
- package/packages/arcgis-rest-auth/src/index.ts +8 -0
- package/packages/arcgis-rest-auth/test/ApplicationSession.test.ts +124 -0
- package/packages/arcgis-rest-auth/test/UserSession.test.ts +1005 -0
- package/packages/arcgis-rest-auth/test/fetchToken.test.ts +112 -0
- package/packages/arcgis-rest-auth/test/generateToken.test.ts +130 -0
- package/packages/arcgis-rest-auth/test/utils.ts +14 -0
- package/packages/arcgis-rest-auth/tsconfig.json +6 -0
- package/packages/arcgis-rest-common/README.md +57 -0
- package/packages/arcgis-rest-common/package-lock.json +11 -0
- package/packages/arcgis-rest-common/package.json +41 -0
- package/packages/arcgis-rest-common/src/index.ts +10 -0
- package/packages/arcgis-rest-common/src/types/feature.ts +14 -0
- package/packages/arcgis-rest-common/src/types/geometry.ts +47 -0
- package/packages/arcgis-rest-common/src/types/symbol.ts +21 -0
- package/packages/arcgis-rest-common/src/util/location.ts +19 -0
- package/packages/arcgis-rest-common/test/location.test.ts +73 -0
- package/packages/arcgis-rest-common/tsconfig.json +6 -0
- package/packages/arcgis-rest-common-types/README.md +64 -0
- package/packages/arcgis-rest-common-types/package.json +40 -0
- package/packages/arcgis-rest-common-types/src/group.ts +54 -0
- package/packages/arcgis-rest-common-types/src/index.ts +469 -0
- package/packages/arcgis-rest-common-types/src/item.ts +47 -0
- package/packages/arcgis-rest-common-types/src/webmap.ts +1267 -0
- package/packages/arcgis-rest-common-types/tsconfig.json +11 -0
- package/packages/arcgis-rest-feature-service/README.md +73 -0
- package/packages/arcgis-rest-feature-service/package-lock.json +11 -0
- package/packages/arcgis-rest-feature-service/package.json +53 -0
- package/packages/arcgis-rest-feature-service/src/add.ts +90 -0
- package/packages/arcgis-rest-feature-service/src/addAttachment.ts +64 -0
- package/packages/arcgis-rest-feature-service/src/decodeValues.ts +129 -0
- package/packages/arcgis-rest-feature-service/src/delete.ts +97 -0
- package/packages/arcgis-rest-feature-service/src/deleteAttachments.ts +67 -0
- package/packages/arcgis-rest-feature-service/src/getAttachments.ts +64 -0
- package/packages/arcgis-rest-feature-service/src/getLayer.ts +27 -0
- package/packages/arcgis-rest-feature-service/src/helpers.ts +50 -0
- package/packages/arcgis-rest-feature-service/src/index.ts +14 -0
- package/packages/arcgis-rest-feature-service/src/query.ts +183 -0
- package/packages/arcgis-rest-feature-service/src/queryRelated.ts +94 -0
- package/packages/arcgis-rest-feature-service/src/update.ts +90 -0
- package/packages/arcgis-rest-feature-service/src/updateAttachment.ts +73 -0
- package/packages/arcgis-rest-feature-service/test/attachments.test.ts +203 -0
- package/packages/arcgis-rest-feature-service/test/crud.test.ts +263 -0
- package/packages/arcgis-rest-feature-service/test/decodeValues.test.ts +67 -0
- package/packages/arcgis-rest-feature-service/test/getLayer.test.ts +31 -0
- package/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts +225 -0
- package/packages/arcgis-rest-feature-service/test/mocks/feature.ts +281 -0
- package/packages/arcgis-rest-feature-service/test/mocks/fields.ts +779 -0
- package/packages/arcgis-rest-feature-service/test/mocks/foo.txt +1 -0
- package/packages/arcgis-rest-feature-service/test/mocks/service.ts +259 -0
- package/packages/arcgis-rest-feature-service/test/query.test.ts +140 -0
- package/packages/arcgis-rest-feature-service/tsconfig.json +6 -0
- package/packages/arcgis-rest-feature-service-admin/README.md +69 -0
- package/packages/arcgis-rest-feature-service-admin/package-lock.json +11 -0
- package/packages/arcgis-rest-feature-service-admin/package.json +56 -0
- package/packages/arcgis-rest-feature-service-admin/src/addTo.ts +74 -0
- package/packages/arcgis-rest-feature-service-admin/src/create.ts +207 -0
- package/packages/arcgis-rest-feature-service-admin/src/index.ts +2 -0
- package/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts +353 -0
- package/packages/arcgis-rest-feature-service-admin/test/create.test.ts +412 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts +79 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/move.ts +14 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/service.ts +72 -0
- package/packages/arcgis-rest-feature-service-admin/tsconfig.json +6 -0
- package/packages/arcgis-rest-geocoder/README.md +83 -0
- package/packages/arcgis-rest-geocoder/package-lock.json +11 -0
- package/packages/arcgis-rest-geocoder/package.json +55 -0
- package/packages/arcgis-rest-geocoder/src/bulk.ts +102 -0
- package/packages/arcgis-rest-geocoder/src/geocode.ts +130 -0
- package/packages/arcgis-rest-geocoder/src/helpers.ts +80 -0
- package/packages/arcgis-rest-geocoder/src/index.ts +8 -0
- package/packages/arcgis-rest-geocoder/src/reverse.ts +83 -0
- package/packages/arcgis-rest-geocoder/src/suggest.ts +69 -0
- package/packages/arcgis-rest-geocoder/test/bulk.test.ts +113 -0
- package/packages/arcgis-rest-geocoder/test/geocode.test.ts +176 -0
- package/packages/arcgis-rest-geocoder/test/helpers.test.ts +111 -0
- package/packages/arcgis-rest-geocoder/test/mocks/responses.ts +629 -0
- package/packages/arcgis-rest-geocoder/test/reverse.test.ts +126 -0
- package/packages/arcgis-rest-geocoder/test/suggest.test.ts +98 -0
- package/packages/arcgis-rest-geocoder/tsconfig.json +6 -0
- package/packages/arcgis-rest-groups/README.md +67 -0
- package/packages/arcgis-rest-groups/package-lock.json +11 -0
- package/packages/arcgis-rest-groups/package.json +55 -0
- package/packages/arcgis-rest-groups/src/create.ts +34 -0
- package/packages/arcgis-rest-groups/src/get.ts +95 -0
- package/packages/arcgis-rest-groups/src/helpers.ts +27 -0
- package/packages/arcgis-rest-groups/src/index.ts +11 -0
- package/packages/arcgis-rest-groups/src/notification.ts +77 -0
- package/packages/arcgis-rest-groups/src/protect.ts +40 -0
- package/packages/arcgis-rest-groups/src/remove.ts +23 -0
- package/packages/arcgis-rest-groups/src/search.ts +64 -0
- package/packages/arcgis-rest-groups/src/update.ts +36 -0
- package/packages/arcgis-rest-groups/test/crud.test.ts +134 -0
- package/packages/arcgis-rest-groups/test/get.test.ts +101 -0
- package/packages/arcgis-rest-groups/test/mocks/responses.ts +141 -0
- package/packages/arcgis-rest-groups/test/notification.test.ts +102 -0
- package/packages/arcgis-rest-groups/test/protect.test.ts +64 -0
- package/packages/arcgis-rest-groups/test/search.test.ts +85 -0
- package/packages/arcgis-rest-groups/tsconfig.json +6 -0
- package/packages/arcgis-rest-items/README.md +69 -0
- package/packages/arcgis-rest-items/package-lock.json +11 -0
- package/packages/arcgis-rest-items/package.json +55 -0
- package/packages/arcgis-rest-items/src/add.ts +103 -0
- package/packages/arcgis-rest-items/src/create.ts +110 -0
- package/packages/arcgis-rest-items/src/get.ts +79 -0
- package/packages/arcgis-rest-items/src/helpers.ts +147 -0
- package/packages/arcgis-rest-items/src/index.ts +11 -0
- package/packages/arcgis-rest-items/src/protect.ts +38 -0
- package/packages/arcgis-rest-items/src/remove.ts +58 -0
- package/packages/arcgis-rest-items/src/search.ts +78 -0
- package/packages/arcgis-rest-items/src/update.ts +134 -0
- package/packages/arcgis-rest-items/test/add.test.ts +256 -0
- package/packages/arcgis-rest-items/test/create.test.ts +371 -0
- package/packages/arcgis-rest-items/test/get.test.ts +181 -0
- package/packages/arcgis-rest-items/test/mocks/foo.zip +0 -0
- package/packages/arcgis-rest-items/test/mocks/item.ts +35 -0
- package/packages/arcgis-rest-items/test/mocks/resources.ts +31 -0
- package/packages/arcgis-rest-items/test/mocks/search.ts +62 -0
- package/packages/arcgis-rest-items/test/protect.test.ts +122 -0
- package/packages/arcgis-rest-items/test/remove.test.ts +161 -0
- package/packages/arcgis-rest-items/test/search.test.ts +159 -0
- package/packages/arcgis-rest-items/test/update.test.ts +450 -0
- package/packages/arcgis-rest-items/tsconfig.json +6 -0
- package/packages/arcgis-rest-request/README.md +68 -0
- package/packages/arcgis-rest-request/package-lock.json +11 -0
- package/packages/arcgis-rest-request/package.json +45 -0
- package/packages/arcgis-rest-request/src/index.ts +15 -0
- package/packages/arcgis-rest-request/src/request.ts +358 -0
- package/packages/arcgis-rest-request/src/utils/ArcGISRequestError.ts +76 -0
- package/packages/arcgis-rest-request/src/utils/ErrorTypes.ts +29 -0
- package/packages/arcgis-rest-request/src/utils/append-custom-params.ts +29 -0
- package/packages/arcgis-rest-request/src/utils/encode-form-data.ts +34 -0
- package/packages/arcgis-rest-request/src/utils/encode-query-string.ts +23 -0
- package/packages/arcgis-rest-request/src/utils/get-portal-url.ts +25 -0
- package/packages/arcgis-rest-request/src/utils/get-portal.ts +45 -0
- package/packages/arcgis-rest-request/src/utils/params.ts +52 -0
- package/packages/arcgis-rest-request/src/utils/process-params.ts +99 -0
- package/packages/arcgis-rest-request/src/utils/retryAuthError.ts +9 -0
- package/packages/arcgis-rest-request/src/utils/warn.ts +11 -0
- package/packages/arcgis-rest-request/test/mocks/errors.ts +68 -0
- package/packages/arcgis-rest-request/test/mocks/geojson-feature-collection.ts +13 -0
- package/packages/arcgis-rest-request/test/mocks/portal.ts +112 -0
- package/packages/arcgis-rest-request/test/mocks/sharing-rest-info.ts +41 -0
- package/packages/arcgis-rest-request/test/mocks/webmap.ts +41 -0
- package/packages/arcgis-rest-request/test/request.test.ts +323 -0
- package/packages/arcgis-rest-request/test/utils/ArcGISAuthError.test.ts +170 -0
- package/packages/arcgis-rest-request/test/utils/ArcGISRequestError.test.ts +51 -0
- package/packages/arcgis-rest-request/test/utils/check-for-errors.test.ts +111 -0
- package/packages/arcgis-rest-request/test/utils/encode-form-data.test.ts +133 -0
- package/packages/arcgis-rest-request/test/utils/get-portal-url.test.ts +37 -0
- package/packages/arcgis-rest-request/test/utils/portal.test.ts +97 -0
- package/packages/arcgis-rest-request/test/utils/process-params.test.ts +193 -0
- package/packages/arcgis-rest-request/tsconfig.json +6 -0
- package/packages/arcgis-rest-routing/README.md +71 -0
- package/packages/arcgis-rest-routing/package-lock.json +11 -0
- package/packages/arcgis-rest-routing/package.json +54 -0
- package/packages/arcgis-rest-routing/src/helpers.ts +16 -0
- package/packages/arcgis-rest-routing/src/index.ts +4 -0
- package/packages/arcgis-rest-routing/src/solveRoute.ts +102 -0
- package/packages/arcgis-rest-routing/test/mocks/responses.ts +825 -0
- package/packages/arcgis-rest-routing/test/solveRoute.test.ts +267 -0
- package/packages/arcgis-rest-routing/tsconfig.json +6 -0
- package/packages/arcgis-rest-sharing/README.md +70 -0
- package/packages/arcgis-rest-sharing/package-lock.json +11 -0
- package/packages/arcgis-rest-sharing/package.json +60 -0
- package/packages/arcgis-rest-sharing/src/access.ts +85 -0
- package/packages/arcgis-rest-sharing/src/group-sharing.ts +211 -0
- package/packages/arcgis-rest-sharing/src/helpers.ts +82 -0
- package/packages/arcgis-rest-sharing/src/index.ts +5 -0
- package/packages/arcgis-rest-sharing/test/access.test.ts +154 -0
- package/packages/arcgis-rest-sharing/test/group-sharing.test.ts +566 -0
- package/packages/arcgis-rest-sharing/test/helpers.test.ts +55 -0
- package/packages/arcgis-rest-sharing/test/mocks/sharing.ts +18 -0
- package/packages/arcgis-rest-sharing/tsconfig.json +6 -0
- package/packages/arcgis-rest-users/README.md +74 -0
- package/packages/arcgis-rest-users/package-lock.json +11 -0
- package/packages/arcgis-rest-users/package.json +54 -0
- package/packages/arcgis-rest-users/src/get.ts +69 -0
- package/packages/arcgis-rest-users/src/index.ts +6 -0
- package/packages/arcgis-rest-users/src/invitation.ts +166 -0
- package/packages/arcgis-rest-users/src/notification.ts +73 -0
- package/packages/arcgis-rest-users/test/get.test.ts +99 -0
- package/packages/arcgis-rest-users/test/invitation.test.ts +169 -0
- package/packages/arcgis-rest-users/test/mocks/invitation.ts +70 -0
- package/packages/arcgis-rest-users/test/mocks/notification.ts +34 -0
- package/packages/arcgis-rest-users/test/mocks/user.ts +173 -0
- package/packages/arcgis-rest-users/test/notification.test.ts +83 -0
- package/packages/arcgis-rest-users/tsconfig.json +6 -0
- package/support/changelog.js +394 -0
- package/support/deploy-doc-site.js +16 -0
- package/support/dev.sh +6 -0
- package/support/publish.sh +43 -0
- package/support/test-helpers.js +8 -0
- package/tsconfig.json +69 -0
- package/tslint.json +16 -0
- package/umd-base-profile.js +82 -0
- package/umd-production-profile.js +13 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
2
|
+
* Apache-2.0 */
|
3
|
+
|
4
|
+
import { appendCustomParams } from "@esri/arcgis-rest-request";
|
5
|
+
|
6
|
+
import {
|
7
|
+
esriGeometryType,
|
8
|
+
SpatialRelationship,
|
9
|
+
IGeometry,
|
10
|
+
ISpatialReference
|
11
|
+
} from "@esri/arcgis-rest-common-types";
|
12
|
+
|
13
|
+
export interface ISharedQueryParams {
|
14
|
+
where?: string;
|
15
|
+
geometry?: IGeometry;
|
16
|
+
geometryType?: esriGeometryType;
|
17
|
+
// NOTE: either WKID or ISpatialReference
|
18
|
+
inSR?: string | ISpatialReference;
|
19
|
+
spatialRel?: SpatialRelationship;
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Add, update and delete features result Object.
|
24
|
+
*/
|
25
|
+
export interface IEditFeatureResult {
|
26
|
+
objectId: number;
|
27
|
+
globalId?: string;
|
28
|
+
success: boolean;
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Common add and update features parameters.
|
33
|
+
*/
|
34
|
+
export interface IEditFeaturesParams {
|
35
|
+
/**
|
36
|
+
* The geodatabase version to apply the edits.
|
37
|
+
*/
|
38
|
+
gdbVersion?: string;
|
39
|
+
/**
|
40
|
+
* Optional parameter specifying whether the response will report the time features were added.
|
41
|
+
*/
|
42
|
+
returnEditMoment?: boolean;
|
43
|
+
/**
|
44
|
+
* Optional parameter to specify if the edits should be applied only if all submitted edits succeed.
|
45
|
+
*/
|
46
|
+
rollbackOnFailure?: boolean;
|
47
|
+
}
|
48
|
+
|
49
|
+
// this function has been moved into @esri/request. it is re-exported here for backwards compatibility
|
50
|
+
export { appendCustomParams };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
2
|
+
* Apache-2.0 */
|
3
|
+
|
4
|
+
export * from "./query";
|
5
|
+
export * from "./add";
|
6
|
+
export * from "./update";
|
7
|
+
export * from "./delete";
|
8
|
+
export * from "./getAttachments";
|
9
|
+
export * from "./addAttachment";
|
10
|
+
export * from "./updateAttachment";
|
11
|
+
export * from "./deleteAttachments";
|
12
|
+
export * from "./queryRelated";
|
13
|
+
export * from "./getLayer";
|
14
|
+
export * from "./decodeValues";
|
@@ -0,0 +1,183 @@
|
|
1
|
+
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
2
|
+
* Apache-2.0 */
|
3
|
+
|
4
|
+
import {
|
5
|
+
request,
|
6
|
+
IRequestOptions,
|
7
|
+
appendCustomParams
|
8
|
+
} from "@esri/arcgis-rest-request";
|
9
|
+
import {
|
10
|
+
ISpatialReference,
|
11
|
+
IFeatureSet,
|
12
|
+
IFeature,
|
13
|
+
esriUnits,
|
14
|
+
IExtent
|
15
|
+
} from "@esri/arcgis-rest-common-types";
|
16
|
+
|
17
|
+
import { ISharedQueryParams } from "./helpers";
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Request options to fetch a feature by id.
|
21
|
+
*/
|
22
|
+
export interface IFeatureRequestOptions extends IRequestOptions {
|
23
|
+
/**
|
24
|
+
* Layer service url.
|
25
|
+
*/
|
26
|
+
url: string;
|
27
|
+
/**
|
28
|
+
* Unique identifier of the feature.
|
29
|
+
*/
|
30
|
+
id: number;
|
31
|
+
}
|
32
|
+
|
33
|
+
export interface IStatisticDefinition {
|
34
|
+
/**
|
35
|
+
* Statistical operation to perform (count, sum, min, max, avg, stddev, var).
|
36
|
+
*/
|
37
|
+
statisticType: "count" | "sum" | "min" | "max" | "avg" | "stddev" | "var";
|
38
|
+
/**
|
39
|
+
* Field on which to perform the statistical operation.
|
40
|
+
*/
|
41
|
+
onStatisticField: string;
|
42
|
+
/**
|
43
|
+
* 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.
|
44
|
+
*/
|
45
|
+
outStatisticFieldName: string;
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* feature query request options. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.
|
50
|
+
*/
|
51
|
+
export interface IQueryFeaturesRequestOptions
|
52
|
+
extends ISharedQueryParams,
|
53
|
+
IRequestOptions {
|
54
|
+
/**
|
55
|
+
* Layer service url.
|
56
|
+
*/
|
57
|
+
url: string;
|
58
|
+
objectIds?: number[];
|
59
|
+
relationParam?: string;
|
60
|
+
// NOTE: either time=1199145600000 or time=1199145600000, 1230768000000
|
61
|
+
time?: number | number[];
|
62
|
+
distance?: number;
|
63
|
+
units?: esriUnits;
|
64
|
+
outFields?: "*" | string[];
|
65
|
+
returnGeometry?: boolean;
|
66
|
+
maxAllowableOffset?: number;
|
67
|
+
geometryPrecision?: number;
|
68
|
+
// NOTE: either WKID or ISpatialReference
|
69
|
+
outSR?: string | ISpatialReference;
|
70
|
+
gdbVersion?: string;
|
71
|
+
returnDistinctValues?: boolean;
|
72
|
+
returnIdsOnly?: boolean;
|
73
|
+
returnCountOnly?: boolean;
|
74
|
+
returnExtentOnly?: boolean;
|
75
|
+
orderByFields?: string;
|
76
|
+
groupByFieldsForStatistics?: string;
|
77
|
+
outStatistics?: IStatisticDefinition[];
|
78
|
+
returnZ?: boolean;
|
79
|
+
returnM?: boolean;
|
80
|
+
multipatchOption?: "xyFootprint";
|
81
|
+
resultOffset?: number;
|
82
|
+
resultRecordCount?: number;
|
83
|
+
// TODO: IQuantizationParameters?
|
84
|
+
quantizationParameters?: any;
|
85
|
+
returnCentroid?: boolean;
|
86
|
+
resultType?: "none" | "standard" | "tile";
|
87
|
+
// to do: convert from Date() to epoch time internally
|
88
|
+
historicMoment?: number;
|
89
|
+
returnTrueCurves?: false;
|
90
|
+
sqlFormat?: "none" | "standard" | "native";
|
91
|
+
returnExceededLimitFeatures?: boolean;
|
92
|
+
/**
|
93
|
+
* someday...
|
94
|
+
*
|
95
|
+
* 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.
|
96
|
+
*/
|
97
|
+
// decodeValues?: boolean | IField[];
|
98
|
+
}
|
99
|
+
|
100
|
+
export interface IQueryFeaturesResponse extends IFeatureSet {
|
101
|
+
exceededTransferLimit?: boolean;
|
102
|
+
}
|
103
|
+
|
104
|
+
export interface IQueryResponse {
|
105
|
+
count?: number;
|
106
|
+
extent?: IExtent;
|
107
|
+
objectIdFieldName?: string;
|
108
|
+
objectIds?: number[];
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Get a feature by id.
|
113
|
+
*
|
114
|
+
* ```js
|
115
|
+
* import { getFeature } from '@esri/arcgis-rest-feature-service';
|
116
|
+
*
|
117
|
+
* const url = "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0";
|
118
|
+
*
|
119
|
+
* getFeature({
|
120
|
+
* url,
|
121
|
+
* id: 42
|
122
|
+
* }).then(feature => {
|
123
|
+
* console.log(feature.attributes.FID); // 42
|
124
|
+
* });
|
125
|
+
* ```
|
126
|
+
*
|
127
|
+
* @param requestOptions - Options for the request
|
128
|
+
* @returns A Promise that will resolve with the feature.
|
129
|
+
*/
|
130
|
+
export function getFeature(
|
131
|
+
requestOptions: IFeatureRequestOptions
|
132
|
+
): Promise<IFeature> {
|
133
|
+
const url = `${requestOptions.url}/${requestOptions.id}`;
|
134
|
+
|
135
|
+
// default to a GET request
|
136
|
+
const options: IFeatureRequestOptions = {
|
137
|
+
...{ httpMethod: "GET" },
|
138
|
+
...requestOptions
|
139
|
+
};
|
140
|
+
return request(url, options).then((response: any) => response.feature);
|
141
|
+
}
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Query a feature service. See [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm) for more information.
|
145
|
+
*
|
146
|
+
* ```js
|
147
|
+
* import { queryFeatures } from '@esri/arcgis-rest-feature-service';
|
148
|
+
*
|
149
|
+
* const url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3";
|
150
|
+
*
|
151
|
+
* queryFeatures({
|
152
|
+
* url,
|
153
|
+
* where: "STATE_NAME = 'Alaska'"
|
154
|
+
* }).then(result => {
|
155
|
+
* console.log(result.features); // array of features
|
156
|
+
* });
|
157
|
+
* ```
|
158
|
+
*
|
159
|
+
* @param requestOptions - Options for the request
|
160
|
+
* @returns A Promise that will resolve with the query response.
|
161
|
+
*/
|
162
|
+
export function queryFeatures(
|
163
|
+
requestOptions: IQueryFeaturesRequestOptions
|
164
|
+
): Promise<IQueryFeaturesResponse | IQueryResponse> {
|
165
|
+
const queryOptions: IQueryFeaturesRequestOptions = {
|
166
|
+
params: {},
|
167
|
+
httpMethod: "GET",
|
168
|
+
url: requestOptions.url,
|
169
|
+
...requestOptions
|
170
|
+
};
|
171
|
+
|
172
|
+
appendCustomParams(requestOptions, queryOptions);
|
173
|
+
|
174
|
+
// set default query parameters
|
175
|
+
if (!queryOptions.params.where) {
|
176
|
+
queryOptions.params.where = "1=1";
|
177
|
+
}
|
178
|
+
if (!queryOptions.params.outFields) {
|
179
|
+
queryOptions.params.outFields = "*";
|
180
|
+
}
|
181
|
+
|
182
|
+
return request(`${queryOptions.url}/query`, queryOptions);
|
183
|
+
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
2
|
+
* Apache-2.0 */
|
3
|
+
|
4
|
+
import {
|
5
|
+
request,
|
6
|
+
IRequestOptions,
|
7
|
+
appendCustomParams
|
8
|
+
} from "@esri/arcgis-rest-request";
|
9
|
+
import {
|
10
|
+
ISpatialReference,
|
11
|
+
IFeature,
|
12
|
+
IHasZM,
|
13
|
+
esriGeometryType,
|
14
|
+
IField
|
15
|
+
} from "@esri/arcgis-rest-common-types";
|
16
|
+
|
17
|
+
/**
|
18
|
+
* 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.
|
19
|
+
*/
|
20
|
+
export interface IQueryRelatedRequestOptions extends IRequestOptions {
|
21
|
+
url: string;
|
22
|
+
relationshipId?: number;
|
23
|
+
objectIds?: number[];
|
24
|
+
outFields?: "*" | string[];
|
25
|
+
definitionExpression?: string;
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Related record data structure
|
30
|
+
*/
|
31
|
+
|
32
|
+
export interface IRelatedRecordGroup {
|
33
|
+
objectId: number;
|
34
|
+
relatedRecords?: IFeature[];
|
35
|
+
count?: number;
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Related record response structure
|
40
|
+
*/
|
41
|
+
|
42
|
+
export interface IQueryRelatedResponse extends IHasZM {
|
43
|
+
geometryType?: esriGeometryType;
|
44
|
+
spatialReference?: ISpatialReference;
|
45
|
+
fields?: IField[];
|
46
|
+
relatedRecordGroups: IRelatedRecordGroup[];
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* 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.
|
50
|
+
*
|
51
|
+
* ```js
|
52
|
+
* import { queryRelated } from '@esri/arcgis-rest-feature-service'
|
53
|
+
*
|
54
|
+
* const url = "http://services.myserver/OrgID/ArcGIS/rest/services/Petroleum/KSPetro/FeatureServer/0"
|
55
|
+
*
|
56
|
+
* queryRelated({
|
57
|
+
* url: url,
|
58
|
+
* relationshipId: 1,
|
59
|
+
* params: { returnCountOnly: true }
|
60
|
+
* })
|
61
|
+
* .then(response => {
|
62
|
+
* console.log(response.relatedRecords)
|
63
|
+
* })
|
64
|
+
* ```
|
65
|
+
*
|
66
|
+
* @param requestOptions
|
67
|
+
* @returns A Promise that will resolve with the query response
|
68
|
+
*/
|
69
|
+
export function queryRelated(
|
70
|
+
requestOptions: IQueryRelatedRequestOptions
|
71
|
+
): Promise<IQueryRelatedResponse> {
|
72
|
+
const options: IQueryRelatedRequestOptions = {
|
73
|
+
params: {},
|
74
|
+
httpMethod: "GET",
|
75
|
+
url: requestOptions.url,
|
76
|
+
...requestOptions
|
77
|
+
};
|
78
|
+
|
79
|
+
appendCustomParams(requestOptions, options);
|
80
|
+
|
81
|
+
if (!options.params.definitionExpression) {
|
82
|
+
options.params.definitionExpression = "1=1";
|
83
|
+
}
|
84
|
+
|
85
|
+
if (!options.params.outFields) {
|
86
|
+
options.params.outFields = "*";
|
87
|
+
}
|
88
|
+
|
89
|
+
if (!options.params.relationshipId) {
|
90
|
+
options.params.relationshipId = 0;
|
91
|
+
}
|
92
|
+
|
93
|
+
return request(`${options.url}/queryRelatedRecords`, options);
|
94
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
2
|
+
* Apache-2.0 */
|
3
|
+
|
4
|
+
import { IFeature } from "@esri/arcgis-rest-common-types";
|
5
|
+
import {
|
6
|
+
request,
|
7
|
+
IRequestOptions,
|
8
|
+
appendCustomParams,
|
9
|
+
warn
|
10
|
+
} from "@esri/arcgis-rest-request";
|
11
|
+
import { IEditFeaturesParams, IEditFeatureResult } from "./helpers";
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Update features request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.
|
15
|
+
*
|
16
|
+
* @param url - Feature service url.
|
17
|
+
* @param features - Array of JSON features to update.
|
18
|
+
* @param params - Query parameters to be sent to the feature service via the request.
|
19
|
+
*/
|
20
|
+
export interface IUpdateFeaturesRequestOptions
|
21
|
+
extends IEditFeaturesParams,
|
22
|
+
IRequestOptions {
|
23
|
+
/**
|
24
|
+
* Feature service url.
|
25
|
+
*/
|
26
|
+
url: string;
|
27
|
+
/**
|
28
|
+
* Array of JSON features to update.
|
29
|
+
*/
|
30
|
+
features: IFeature[];
|
31
|
+
/**
|
32
|
+
* Deprecated. Please use `features` instead.
|
33
|
+
*/
|
34
|
+
updates?: IFeature[];
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Update features results.
|
39
|
+
*/
|
40
|
+
export interface IUpdateFeaturesResult {
|
41
|
+
/**
|
42
|
+
* Array of JSON response Object(s) for each feature updated.
|
43
|
+
*/
|
44
|
+
updateResults?: IEditFeatureResult[];
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Update features request. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/update-features.htm) for more information.
|
49
|
+
*
|
50
|
+
* ```js
|
51
|
+
* import { updateFeatures } from '@esri/arcgis-rest-feature-service';
|
52
|
+
*
|
53
|
+
* const url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";
|
54
|
+
*
|
55
|
+
* updateFeatures({
|
56
|
+
* url,
|
57
|
+
* features: [{
|
58
|
+
* geometry: { x: -120, y: 45, spatialReference: { wkid: 4326 } },
|
59
|
+
* attributes: { status: "alive" }
|
60
|
+
* }]
|
61
|
+
* });
|
62
|
+
* ```
|
63
|
+
*
|
64
|
+
* @param requestOptions - Options for the request.
|
65
|
+
* @returns A Promise that will resolve with the updateFeatures response.
|
66
|
+
*/
|
67
|
+
export function updateFeatures(
|
68
|
+
requestOptions: IUpdateFeaturesRequestOptions
|
69
|
+
): Promise<IUpdateFeaturesResult> {
|
70
|
+
const url = `${requestOptions.url}/updateFeatures`;
|
71
|
+
|
72
|
+
// edit operations are POST only
|
73
|
+
const options: IUpdateFeaturesRequestOptions = {
|
74
|
+
params: {},
|
75
|
+
...requestOptions
|
76
|
+
};
|
77
|
+
|
78
|
+
appendCustomParams(requestOptions, options);
|
79
|
+
|
80
|
+
if (options.params.updates && options.params.updates.length) {
|
81
|
+
// mixin, don't overwrite
|
82
|
+
options.params.features = requestOptions.updates;
|
83
|
+
delete options.params.updates;
|
84
|
+
warn(
|
85
|
+
"The `updates` parameter is deprecated and will be removed in a future release. Please use `features` instead."
|
86
|
+
);
|
87
|
+
}
|
88
|
+
|
89
|
+
return request(url, options);
|
90
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
2
|
+
* Apache-2.0 */
|
3
|
+
|
4
|
+
import { request, IRequestOptions } from "@esri/arcgis-rest-request";
|
5
|
+
import { IEditFeatureResult } from "./helpers";
|
6
|
+
|
7
|
+
/**
|
8
|
+
* 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.
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
export interface IUpdateAttachmentOptions extends IRequestOptions {
|
12
|
+
/**
|
13
|
+
* Feature service url.
|
14
|
+
*/
|
15
|
+
url: string;
|
16
|
+
/**
|
17
|
+
* Unique identifier of feature to update related attachment.
|
18
|
+
*/
|
19
|
+
featureId: number;
|
20
|
+
/**
|
21
|
+
* File to be updated.
|
22
|
+
*/
|
23
|
+
attachment: File;
|
24
|
+
/**
|
25
|
+
* Unique identifier of the attachment.
|
26
|
+
*/
|
27
|
+
attachmentId: number;
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* `updateAttachment()` request response.
|
32
|
+
*/
|
33
|
+
export interface IUpdateAttachmentResponse {
|
34
|
+
/**
|
35
|
+
* Standard AGS add/update/edit result Object for the attachment.
|
36
|
+
*/
|
37
|
+
updateAttachmentResult: IEditFeatureResult;
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* 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.
|
42
|
+
*
|
43
|
+
* ```js
|
44
|
+
* import { updateAttachment } from '@esri/arcgis-rest-feature-service';
|
45
|
+
*
|
46
|
+
* updateAttachment({
|
47
|
+
* url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0",
|
48
|
+
* featureId: 8484,
|
49
|
+
* attachment: myFileInput.files[0],
|
50
|
+
* attachmentId: 306
|
51
|
+
* });
|
52
|
+
* ```
|
53
|
+
*
|
54
|
+
* @param requestOptions - Options for the request.
|
55
|
+
* @returns A Promise that will resolve with the `updateAttachment()` response.
|
56
|
+
*/
|
57
|
+
export function updateAttachment(
|
58
|
+
requestOptions: IUpdateAttachmentOptions
|
59
|
+
): Promise<IUpdateAttachmentResponse> {
|
60
|
+
const options: IUpdateAttachmentOptions = {
|
61
|
+
params: {},
|
62
|
+
...requestOptions
|
63
|
+
};
|
64
|
+
|
65
|
+
// `attachment` and `attachmentId` --> params: {}
|
66
|
+
options.params.attachment = requestOptions.attachment;
|
67
|
+
options.params.attachmentId = requestOptions.attachmentId;
|
68
|
+
|
69
|
+
return request(
|
70
|
+
`${options.url}/${options.featureId}/updateAttachment`,
|
71
|
+
options
|
72
|
+
);
|
73
|
+
}
|