From 6ab2e75a3b57ce77391da7f2a16ab57a3e781000 Mon Sep 17 00:00:00 2001 From: john gravois Date: Thu, 11 Apr 2019 14:12:19 -0700 Subject: [PATCH] refactor: deprecate common-types package (in favor of common) AFFECTS PACKAGES: @esri/arcgis-rest-auth @esri/arcgis-rest-common @esri/arcgis-rest-feature-service-admin @esri/arcgis-rest-feature-service @esri/arcgis-rest-geocoder @esri/arcgis-rest-groups @esri/arcgis-rest-items @esri/arcgis-rest-sharing @esri/arcgis-rest-users batch-geocoder BREAKING CHANGE: deprecate common-types package (in favor of common) --- README.md | 4 +- demos/batch-geocoder-node/package.json | 2 +- packages/arcgis-rest-auth/package.json | 4 +- packages/arcgis-rest-auth/src/UserSession.ts | 2 +- packages/arcgis-rest-common-types/README.md | 66 --- .../arcgis-rest-common-types/package.json | 48 -- .../arcgis-rest-common-types/src/index.ts | 472 ------------------ .../arcgis-rest-common-types/tsconfig.json | 11 - packages/arcgis-rest-common/README.md | 2 +- packages/arcgis-rest-common/src/index.ts | 4 + .../arcgis-rest-common/src/types/feature.ts | 16 +- .../arcgis-rest-common/src/types/geometry.ts | 185 ++++++- .../src/types}/group.ts | 0 .../src/types}/item.ts | 2 +- .../src/types/miscellaneous.ts | 91 ++++ .../arcgis-rest-common/src/types/symbol.ts | 155 +++++- .../src/types}/webmap.ts | 14 +- .../arcgis-rest-common/test/location.test.ts | 16 +- .../package.json | 4 +- .../src/addTo.ts | 12 +- .../src/create.ts | 2 +- .../test/addTo.test.ts | 2 +- .../test/mocks/layerDefinition.ts | 2 +- .../arcgis-rest-feature-service/package.json | 4 +- .../arcgis-rest-feature-service/src/add.ts | 2 +- .../src/decodeValues.ts | 6 +- .../arcgis-rest-feature-service/src/delete.ts | 3 +- .../src/getLayer.ts | 2 +- .../src/helpers.ts | 2 +- .../arcgis-rest-feature-service/src/query.ts | 2 +- .../src/queryRelated.ts | 2 +- .../arcgis-rest-feature-service/src/update.ts | 2 +- .../test/mocks/cvdQueryResponse.ts | 2 +- .../test/mocks/fields.ts | 2 +- .../test/mocks/service.ts | 2 +- packages/arcgis-rest-geocoder/package.json | 4 +- packages/arcgis-rest-geocoder/src/bulk.ts | 2 +- packages/arcgis-rest-geocoder/src/geocode.ts | 6 +- packages/arcgis-rest-geocoder/src/helpers.ts | 8 - packages/arcgis-rest-geocoder/src/reverse.ts | 24 +- packages/arcgis-rest-groups/package.json | 4 +- packages/arcgis-rest-groups/src/create.ts | 2 +- packages/arcgis-rest-groups/src/get.ts | 2 +- packages/arcgis-rest-groups/src/search.ts | 2 +- packages/arcgis-rest-groups/src/update.ts | 2 +- packages/arcgis-rest-groups/test/crud.test.ts | 2 +- .../test/mocks/responses.ts | 2 +- packages/arcgis-rest-items/package.json | 4 +- packages/arcgis-rest-items/src/create.ts | 2 +- packages/arcgis-rest-items/src/get.ts | 2 +- packages/arcgis-rest-items/src/helpers.ts | 2 +- packages/arcgis-rest-items/src/search.ts | 2 +- packages/arcgis-rest-items/src/update.ts | 2 +- packages/arcgis-rest-items/test/mocks/item.ts | 2 +- packages/arcgis-rest-sharing/package.json | 4 +- .../arcgis-rest-sharing/src/group-sharing.ts | 2 +- packages/arcgis-rest-sharing/src/helpers.ts | 2 +- packages/arcgis-rest-users/package.json | 4 +- packages/arcgis-rest-users/src/get.ts | 2 +- packages/arcgis-rest-users/src/invitation.ts | 2 +- packages/arcgis-rest-users/src/update.ts | 2 +- packages/arcgis-rest-users/test/mocks/user.ts | 2 +- 62 files changed, 523 insertions(+), 720 deletions(-) delete mode 100644 packages/arcgis-rest-common-types/README.md delete mode 100644 packages/arcgis-rest-common-types/package.json delete mode 100644 packages/arcgis-rest-common-types/src/index.ts delete mode 100644 packages/arcgis-rest-common-types/tsconfig.json rename packages/{arcgis-rest-common-types/src => arcgis-rest-common/src/types}/group.ts (100%) rename packages/{arcgis-rest-common-types/src => arcgis-rest-common/src/types}/item.ts (95%) create mode 100644 packages/arcgis-rest-common/src/types/miscellaneous.ts rename packages/{arcgis-rest-common-types/src => arcgis-rest-common/src/types}/webmap.ts (99%) diff --git a/README.md b/README.md index 54dd8a15c4..deeddacb28 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Some useful commands include: * [`@esri/arcgis-rest-request`](./packages/arcgis-rest-request/) - Underpins other packages and supports making low-level requests. * [`@esri/arcgis-rest-auth`](./packages/arcgis-rest-auth) - Provides methods for authenticating named users and applications. -* [`@esri/arcgis-rest-common-types`](./packages/arcgis-rest-common-types) - Stores objects common across the ArcGIS API. +* [`@esri/arcgis-rest-common`](./packages/arcgis-rest-common-types) - - Stores shared methods and types used throughout the ArcGIS API. * [`@esri/arcgis-rest-items`](./packages/arcgis-rest-items) - Methods for working with ArcGIS Online/Enterprise content. * [`@esri/arcgis-rest-groups`](./packages/arcgis-rest-groups) - Methods for working with ArcGIS Online/Enterprise groups. * [`@esri/arcgis-rest-users`](./packages/arcgis-rest-users) - Methods for working with ArcGIS Online/Enterprise users. @@ -80,8 +80,6 @@ Some useful commands include: * [`@esri/arcgis-rest-geocoder`](./packages/arcgis-rest-geocoder) - Geocoding wrapper for `@esri/arcgis-rest-js` * [`@esri/arcgis-rest-feature-service-admin`](./packages/arcgis-rest-feature-service-admin) - Functions for creating and updating feature services. * [`@esri/arcgis-rest-routing`](./packages/arcgis-rest-routing) - Routing and directions wrapper for `@esri/arcgis-rest-js`. -* [`@esri/arcgis-rest-common`](./packages/arcgis-rest-common) - Stores shared methods and types used throughout the ArcGIS API. - ### Frequently Asked Questions diff --git a/demos/batch-geocoder-node/package.json b/demos/batch-geocoder-node/package.json index fc76c83984..048c16853f 100644 --- a/demos/batch-geocoder-node/package.json +++ b/demos/batch-geocoder-node/package.json @@ -28,7 +28,7 @@ "homepage": "https://github.com/Esri/arcgis-rest-js#readme", "dependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-geocoder": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2", "isomorphic-fetch": "^2.2.1", diff --git a/packages/arcgis-rest-auth/package.json b/packages/arcgis-rest-auth/package.json index 442915f309..c8b96c0355 100644 --- a/packages/arcgis-rest-auth/package.json +++ b/packages/arcgis-rest-auth/package.json @@ -16,11 +16,11 @@ "tslib": "^1.9.3" }, "devDependencies": { - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "scripts": { diff --git a/packages/arcgis-rest-auth/src/UserSession.ts b/packages/arcgis-rest-auth/src/UserSession.ts index e84d19cdef..1cc640580a 100644 --- a/packages/arcgis-rest-auth/src/UserSession.ts +++ b/packages/arcgis-rest-auth/src/UserSession.ts @@ -23,7 +23,7 @@ import { } from "@esri/arcgis-rest-request"; import { generateToken } from "./generate-token"; import { fetchToken, IFetchTokenResponse } from "./fetch-token"; -import { IUser } from "@esri/arcgis-rest-common-types"; +import { IUser } from "@esri/arcgis-rest-common"; /** * Internal utility for resolving a Promise from outside its constructor. diff --git a/packages/arcgis-rest-common-types/README.md b/packages/arcgis-rest-common-types/README.md deleted file mode 100644 index 0e72b5f3b3..0000000000 --- a/packages/arcgis-rest-common-types/README.md +++ /dev/null @@ -1,66 +0,0 @@ -[![npm version][npm-img]][npm-url] -[![build status][travis-img]][travis-url] -[![Coverage Status][coverage-img]][coverage-url] -[![apache licensed](https://img.shields.io/badge/license-Apache-green.svg?style=flat-square)](https://raw.githubusercontent.com/Esri/arcgis-rest-js/master/LICENSE) - -[npm-img]: https://img.shields.io/npm/v/@esri/arcgis-rest-common-types.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/@esri/arcgis-rest-common-types -[travis-img]: https://img.shields.io/travis/Esri/arcgis-rest-js/master.svg?style=flat-square -[travis-url]: https://travis-ci.org/Esri/arcgis-rest-js -[coverage-img]: https://codecov.io/gh/Esri/arcgis-rest-js/branch/master/graph/badge.svg -[coverage-url]: https://codecov.io/gh/Esri/arcgis-rest-js - -# @esri/arcgis-rest-common-types - -> Common TypeScript types for [`@esri/arcgis-rest-*`](https://github.com/Esri/arcgis-rest-js) packages. - -### Example - -```bash -npm install @esri/arcgis-rest-common-types -``` - -```ts -import { IPoint } from '@esri/arcgis-rest-common-types'; - -const myPoint = { x: -118.409, y: 33.943 } as IPoint - -``` - -### [API Reference](https://esri.github.io/arcgis-rest-js/api/common-types/) - -### Issues - -If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/arcgis-rest-js/issues) first. Have you found a new bug? Want to request a new feature? We'd [**love**](https://github.com/Esri/arcgis-rest-js/issues/new) to hear from you. - -If you're looking for help you can also post issues on [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-oss). - -### Versioning - -For transparency into the release cycle and in striving to maintain backward compatibility, @esri/arcgis-rest-js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible. - -For more information on SemVer, please visit . - -### Contributing - -Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](CONTRIBUTING.md). - -### [Changelog](https://github.com/Esri/arcgis-rest-js/blob/master/CHANGELOG.md) - -### License - -Copyright © 2017-2019 Esri - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -> http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -A copy of the license is available in the repository's [LICENSE](../../LICENSE) file. diff --git a/packages/arcgis-rest-common-types/package.json b/packages/arcgis-rest-common-types/package.json deleted file mode 100644 index 0bfc083e8f..0000000000 --- a/packages/arcgis-rest-common-types/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@esri/arcgis-rest-common-types", - "version": "1.19.2", - "description": "Common TypeScript types for @esri/arcgis-rest-js packages.", - "types": "dist/types/index.d.ts", - "author": "", - "license": "Apache-2.0", - "files": [ - "dist/types/*.d.ts", - "src/**/*.ts" - ], - "scripts": { - "prepare": "npm run build", - "build": "npm run build:esm", - "build:esm": "tsc", - "dev:esm": "tsc -w" - }, - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Esri/arcgis-rest-js.git" - }, - "contributors": [ - { - "name": "Patrick Arlt", - "email": "parlt@esri.com", - "url": "http://patrickarlt.com/" - }, - { - "name": "Jeff Jacobson", - "url": "http://github.com/jeffjacobson" - } - ], - "bugs": { - "url": "https://github.com/Esri/arcgis-rest-js/issues" - }, - "homepage": "https://github.com/Esri/arcgis-rest-js#readme", - "keywords": [ - "typescript", - "promise", - "fetch", - "arcgis", - "esri", - "ES6" - ] -} diff --git a/packages/arcgis-rest-common-types/src/index.ts b/packages/arcgis-rest-common-types/src/index.ts deleted file mode 100644 index 4b101bda2e..0000000000 --- a/packages/arcgis-rest-common-types/src/index.ts +++ /dev/null @@ -1,472 +0,0 @@ -/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. - * Apache-2.0 */ - -import { IGroup } from "./group"; - -export * from "./webmap"; -export * from "./item"; -export * from "./group"; - -/** - * an arc can be represented as a JSON curve object - */ -export interface IArc { - a: [ - Position, // End point: x, y, , - Position2D, // Center point: center_x, center_y - number, // minor - number, // clockwise - number, // rotation - number, // axis - number // ratio - ]; -} - -/** - * a bezier curve can be represented as a JSON curve object - */ -export interface IBezierCurve { - b: [Position, Position2D, Position2D]; -} - -/** - * a circular arc can be represented as a JSON curve object - */ -export interface ICircularArc { - c: [Position, Position2D]; -} - -/** - * - */ -export type Color = [number, number, number, number]; - -/** - * - */ -export type ElipticArc = IArc; - -/** - * a spatial entity and its corresponding properties - */ -export interface IFeature { - geometry?: IGeometry; - attributes: { [key: string]: any }; - symbol?: ISymbol; -} - -/** - * Field type. - */ -export type esriFieldType = - | "esriFieldTypeBlob" - | "esriFieldTypeDate" - | "esriFieldTypeDouble" - | "esriFieldTypeGeometry" - | "esriFieldTypeGlobalID" - | "esriFieldTypeGUID" - | "esriFieldTypeInteger" - | "esriFieldTypeOID" - | "esriFieldTypeRaster" - | "esriFieldTypeSingle" - | "esriFieldTypeSmallInteger" - | "esriFieldTypeString" - | "esriFieldTypeXML"; - -/** - * Contains information about an attribute field. - */ -export interface IField { - /** A string defining the field name. */ - name: string; - /** A string defining the field type. */ - type: esriFieldType; - /** A string defining the field alias. */ - alias?: string; - /** The domain objects if applicable. */ - domain?: any; - /** A Boolean defining whether this field is editable. */ - editable?: boolean; - /** A Boolean defining whether or not the field is an exact match. */ - exactMatch?: boolean; - /** A number defining how many characters are allowed in a string. field. */ - length?: number; - /** A Boolean defining whether this field can have a null value. */ - nullable?: boolean; - /** The value written in for new records by default. */ - defaultValue?: any; -} - -/** - * a building block for discrete geometries - */ -export interface IGeometry { - spatialReference?: ISpatialReference; -} - -/** - * An envelope is a rectangle defined by a range of values for each coordinate and attribute. - */ -export interface IEnvelope extends IGeometry { - xmin: number; - xmax: number; - ymin: number; - ymax: number; - - zmin?: number; - zmax?: number; - - mmin?: number; - mmax?: number; -} - -/** - * - */ -export type GeometryType = // why is this type camelCased? - | "esriGeometryPoint" - | "esriGeometryMultipoint" - | "esriGeometryPolyline" - | "esriGeometryPolygon" - | "esriGeometryEnvelope"; - -/** - * The spatial relationship used to compare input geometries - */ -export type SpatialRelationship = - | "esriSpatialRelIntersects" - | "esriSpatialRelContains" - | "esriSpatialRelCrosses" - | "esriSpatialRelEnvelopeIntersects" - | "esriSpatialRelIndexIntersects" - | "esriSpatialRelOverlaps" - | "esriSpatialRelTouches" - | "esriSpatialRelWithin"; - -/** - * Extents are used to define rectangles and bounding boxes. - */ -export interface IExtent { - xmin: number; - ymin: number; - zmin?: number; - xmax: number; - ymax: number; - zmax?: number; - spatialReference?: ISpatialReference; -} - -/** - * - */ -export interface IHasZM { - hasZ?: boolean; - hasM?: boolean; -} - -/** - * - */ -export interface IFeatureSet extends IHasZM { - objectIdFieldName?: string; // optional - globalIdFieldName?: string; // optional - displayFieldName?: string; // optional - geometryType?: GeometryType; // for feature layers only - spatialReference?: ISpatialReference; // for feature layers only. - fields?: IField[]; - features: IFeature[]; -} - -/** - * - */ -export interface IFont { - family?: string; // ""; - size?: number; // ; - style?: "italic" | "normal" | "oblique"; - weight?: "bold" | "bolder" | "lighter" | "normal"; - decoration?: "line-through" | "underline" | "none"; -} - -/** - * - */ -export type JsonCurve = ICircularArc | IArc | IOldCircularArc | IBezierCurve; - -/** - * - */ -export interface IOldCircularArc { - a: [ - Position, // End point: x, y, , - Position2D, // Center point: center_x, center_y - number, // minor - number // clockwise - ]; -} - -/** - * - */ -export interface ISymbol { - type: SymbolType; - style?: string; -} - -/** - * - */ -export interface IMarkerSymbol extends ISymbol { - angle?: number; - xoffset?: number; - yoffset?: number; -} - -/** - * A multipoint contains an array of points. - */ -export interface IMultipoint extends IHasZM, IGeometry { - points: Position[]; -} - -/** - * Params for paging operations - */ -export interface IPagingParams { - start?: number; - num?: number; -} - -/** - * - */ -export interface IPictureSourced { - url?: string; // Relative URL for static layers and full URL for dynamic layers. Access relative URL using http:////images/ - imageData?: string; // ""; - contentType?: string; - width?: number; - height?: number; - angle?: number; - xoffset?: number; - yoffset?: number; -} - -/** - * - */ -export interface IPictureFillSymbol extends ISymbol, IPictureSourced { - type: "esriPFS"; - outline?: ISimpleLineSymbol; // if outline has been specified - xscale?: number; - yscale?: number; -} - -/** - * - */ -export interface IPictureMarkerSymbol extends IMarkerSymbol, IPictureSourced { - type: "esriPMS"; -} - -/** - * A simple point geometry, with spatial reference defined. - */ -export interface IPoint extends IHasZM, IGeometry { - x: number; - y: number; - z?: number; -} - -/** - * - */ -export interface IPolyline extends IHasZM, IGeometry { - paths: Position[][]; -} - -/** - * - */ -export interface IPolylineWithCurves extends IHasZM, IGeometry { - curvePaths: Array>; -} - -/** - * - */ -export interface IPolygon extends IHasZM, IGeometry { - rings: Position[][]; -} - -/** - * - */ -export interface IPolygonWithCurves extends IHasZM, IGeometry { - curveRings: Array>; -} - -/** - * - */ -export type Position = - | Position2D - | [number, number, number] - | [number, number, number, number]; - -/** - * - */ -export type Position2D = [number, number]; - -/** - * - */ -export type SimpleMarkerSymbolStyle = - | "esriSMSCircle" - | "esriSMSCross" - | "esriSMSDiamond" - | "esriSMSSquare" - | "esriSMSX" - | "esriSMSTriangle"; - -/** - * - */ -export type SimpleLineSymbolStyle = - | "esriSLSDash" - | "esriSLSDashDot" - | "esriSLSDashDotDot" - | "esriSLSDot" - | "esriSLSNull" - | "esriSLSSolid"; - -/** - * - */ -export type SimpleFillSymbolStyle = - | "esriSFSBackwardDiagonal" - | "esriSFSCross" - | "esriSFSDiagonalCross" - | "esriSFSForwardDiagonal" - | "esriSFSHorizontal" - | "esriSFSNull" - | "esriSFSSolid" - | "esriSFSVertical"; - -/** - * - */ -export type SymbolType = - | "esriSLS" - | "esriSMS" - | "esriSFS" - | "esriPMS" - | "esriPFS" - | "esriTS"; - -/** - * - */ -export interface ISimpleFillSymbol extends ISymbol { - type: "esriSFS"; - style?: SimpleFillSymbolStyle; - color?: Color; - outline?: ISimpleLineSymbol; // if outline has been specified -} - -/** - * - */ -export interface ISimpleLineSymbol extends ISymbol { - type: "esriSLS"; - style?: SimpleLineSymbolStyle; - color?: Color; - width?: number; -} - -/** - * - */ -export interface ISimpleMarkerSymbol extends IMarkerSymbol { - type: "esriSMS"; - style?: SimpleMarkerSymbolStyle; - color?: Color; - size?: number; - outline?: ISimpleLineSymbol; -} - -/** - * Spatial reference systems define mathematical transformations and coordinate systems for displaying spatial information in 2D and 3D. - */ -export interface ISpatialReference { - wkid?: number; - latestWkid?: number; - vcsWkid?: number; - latestVcsWkid?: number; - wkt?: string; - latestWkt?: string; -} - -/** - * - */ -export interface ITextSymbol extends IMarkerSymbol { - type: "esriTS"; - color?: Color; - backgroundColor?: Color; - borderLineSize?: number; // ; - borderLineColor?: Color; - haloSize?: number; // ; - haloColor?: Color; - verticalAlignment?: "baseline" | "top" | "middle" | "bottom"; - horizontalAlignment?: "left" | "right" | "center" | "justify"; - rightToLeft?: boolean; - kerning?: boolean; - font?: IFont; - text?: string; // only applicable when specified as a client-side graphic. -} - -/** - * An ArcGIS Online or Enterprise user - */ -export interface IUser { - username?: string; - fullName?: string; - availableCredits?: number; - assignedCredits?: number; - firstName?: string; - lastName?: string; - preferredView?: any; - description?: string; - email?: string; - idpUsername?: string; - favGroupId?: string; - lastLogin?: number; - mfaEnabled?: boolean; - access?: string; - storageUsage?: number; - storageQuota?: number; - orgId?: string; - role?: "org_admin" | "org_publisher" | "org_user"; - privileges?: string[]; - roleId?: string; - level?: string; - disabled?: boolean; - units?: string; - tags?: string[]; - culture?: string; - region?: string; - thumbnail?: string; - created?: number; - modified?: number; - groups?: IGroup[]; - provider?: "arcgis" | "enterprise" | "facebook" | "google"; -} - -export type esriUnits = - | "esriSRUnit_Meter" - | "esriSRUnit_StatuteMile" - | "esriSRUnit_Foot" - | "esriSRUnit_Kilometer" - | "esriSRUnit_NauticalMile" - | "esriSRUnit_USNauticalMile"; diff --git a/packages/arcgis-rest-common-types/tsconfig.json b/packages/arcgis-rest-common-types/tsconfig.json deleted file mode 100644 index 1395c7c366..0000000000 --- a/packages/arcgis-rest-common-types/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "module": "es2015", - "declaration": true, - "declarationDir": "./dist/types", - "emitDeclarationOnly": true - }, - "include": [ - "src/**/*.ts" - ] -} \ No newline at end of file diff --git a/packages/arcgis-rest-common/README.md b/packages/arcgis-rest-common/README.md index 0bcf01f286..17754ba697 100644 --- a/packages/arcgis-rest-common/README.md +++ b/packages/arcgis-rest-common/README.md @@ -44,7 +44,7 @@ Esri welcomes contributions from anyone and everyone. Please see our [guidelines ### License -Copyright © 2018 Esri +Copyright © 2018-2019 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/arcgis-rest-common/src/index.ts b/packages/arcgis-rest-common/src/index.ts index 6b6ec02ea2..78e1fb017b 100644 --- a/packages/arcgis-rest-common/src/index.ts +++ b/packages/arcgis-rest-common/src/index.ts @@ -8,3 +8,7 @@ export * from "./util/location"; export * from "./types/feature"; export * from "./types/geometry"; export * from "./types/symbol"; +export * from "./types/webmap"; +export * from "./types/item"; +export * from "./types/group"; +export * from "./types/miscellaneous"; diff --git a/packages/arcgis-rest-common/src/types/feature.ts b/packages/arcgis-rest-common/src/types/feature.ts index 62617bbe2a..30836f0332 100644 --- a/packages/arcgis-rest-common/src/types/feature.ts +++ b/packages/arcgis-rest-common/src/types/feature.ts @@ -1,8 +1,9 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IGeometry } from "./geometry"; +import { IGeometry, IHasZM, ISpatialReference, GeometryType } from "./geometry"; import { ISymbol } from "./symbol"; +import { IField } from "./miscellaneous"; /** * a spatial entity and its corresponding properties @@ -12,3 +13,16 @@ export interface IFeature { attributes: { [key: string]: any }; symbol?: ISymbol; } + +/** + * + */ +export interface IFeatureSet extends IHasZM { + objectIdFieldName?: string; // optional + globalIdFieldName?: string; // optional + displayFieldName?: string; // optional + geometryType?: GeometryType; // for feature layers only + spatialReference?: ISpatialReference; // for feature layers only. + fields?: IField[]; + features: IFeature[]; +} diff --git a/packages/arcgis-rest-common/src/types/geometry.ts b/packages/arcgis-rest-common/src/types/geometry.ts index 9e1830a4a2..cbda313ba1 100644 --- a/packages/arcgis-rest-common/src/types/geometry.ts +++ b/packages/arcgis-rest-common/src/types/geometry.ts @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 Environmental Systems Research Institute, Inc. +/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc. * Apache-2.0 */ /** @@ -47,3 +47,186 @@ export interface ILocation { long?: number; z?: number; } + +/** + * A simple point geometry, with spatial reference defined. + */ +export interface IPoint extends IHasZM, IGeometry { + x: number; + y: number; + z?: number; +} + +/** + * + */ +export interface IPolyline extends IHasZM, IGeometry { + paths: Position[][]; +} + +/** + * + */ +export interface IPolylineWithCurves extends IHasZM, IGeometry { + curvePaths: Array>; +} + +/** + * + */ +export interface IPolygon extends IHasZM, IGeometry { + rings: Position[][]; +} + +/** + * + */ +export interface IPolygonWithCurves extends IHasZM, IGeometry { + curveRings: Array>; +} + +/** + * + */ +export type Position = + | Position2D + | [number, number, number] + | [number, number, number, number]; + +/** + * + */ +export type Position2D = [number, number]; + +/** + * an arc can be represented as a JSON curve object + */ +export interface IArc { + a: [ + Position, // End point: x, y, , + Position2D, // Center point: center_x, center_y + number, // minor + number, // clockwise + number, // rotation + number, // axis + number // ratio + ]; +} + +/** + * a bezier curve can be represented as a JSON curve object + */ +export interface IBezierCurve { + b: [Position, Position2D, Position2D]; +} + +/** + * a circular arc can be represented as a JSON curve object + */ +export interface ICircularArc { + c: [Position, Position2D]; +} + +/** + * + */ +export type ElipticArc = IArc; + +/** + * a building block for discrete geometries + */ +export interface IGeometry { + spatialReference?: ISpatialReference; +} + +/** + * An envelope is a rectangle defined by a range of values for each coordinate and attribute. + */ +export interface IEnvelope extends IGeometry { + xmin: number; + xmax: number; + ymin: number; + ymax: number; + + zmin?: number; + zmax?: number; + + mmin?: number; + mmax?: number; +} + +/** + * + */ +export type GeometryType = // why is this type camelCased? + | "esriGeometryPoint" + | "esriGeometryMultipoint" + | "esriGeometryPolyline" + | "esriGeometryPolygon" + | "esriGeometryEnvelope"; + +/** + * The spatial relationship used to compare input geometries + */ +export type SpatialRelationship = + | "esriSpatialRelIntersects" + | "esriSpatialRelContains" + | "esriSpatialRelCrosses" + | "esriSpatialRelEnvelopeIntersects" + | "esriSpatialRelIndexIntersects" + | "esriSpatialRelOverlaps" + | "esriSpatialRelTouches" + | "esriSpatialRelWithin"; + +/** + * Extents are used to define rectangles and bounding boxes. + */ +export interface IExtent { + xmin: number; + ymin: number; + zmin?: number; + xmax: number; + ymax: number; + zmax?: number; + spatialReference?: ISpatialReference; +} + +/** + * + */ +export interface IHasZM { + hasZ?: boolean; + hasM?: boolean; +} + +/** + * + */ +export type JsonCurve = ICircularArc | IArc | IOldCircularArc | IBezierCurve; + +/** + * + */ +export interface IOldCircularArc { + a: [ + Position, // End point: x, y, , + Position2D, // Center point: center_x, center_y + number, // minor + number // clockwise + ]; +} + +/** + * A multipoint contains an array of points. + */ +export interface IMultipoint extends IHasZM, IGeometry { + points: Position[]; +} + +export type esriUnits = + | "esriSRUnit_Meter" + | "esriSRUnit_StatuteMile" + | "esriSRUnit_Foot" + | "esriSRUnit_Kilometer" + | "esriSRUnit_NauticalMile" + | "esriSRUnit_USNauticalMile"; diff --git a/packages/arcgis-rest-common-types/src/group.ts b/packages/arcgis-rest-common/src/types/group.ts similarity index 100% rename from packages/arcgis-rest-common-types/src/group.ts rename to packages/arcgis-rest-common/src/types/group.ts diff --git a/packages/arcgis-rest-common-types/src/item.ts b/packages/arcgis-rest-common/src/types/item.ts similarity index 95% rename from packages/arcgis-rest-common-types/src/item.ts rename to packages/arcgis-rest-common/src/types/item.ts index 4be5670fc4..1c0929731d 100644 --- a/packages/arcgis-rest-common-types/src/item.ts +++ b/packages/arcgis-rest-common/src/types/item.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { ISpatialReference } from "./index"; +import { ISpatialReference } from "./geometry"; /** * A Portal [Item](https://developers.arcgis.com/rest/users-groups-and-items/common-parameters.htm) that has not been created yet. diff --git a/packages/arcgis-rest-common/src/types/miscellaneous.ts b/packages/arcgis-rest-common/src/types/miscellaneous.ts new file mode 100644 index 0000000000..e21c091b27 --- /dev/null +++ b/packages/arcgis-rest-common/src/types/miscellaneous.ts @@ -0,0 +1,91 @@ +/* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc. + * Apache-2.0 */ + +import { IGroup } from "./group"; + +/** + * Field type. + */ +export type esriFieldType = + | "esriFieldTypeBlob" + | "esriFieldTypeDate" + | "esriFieldTypeDouble" + | "esriFieldTypeGeometry" + | "esriFieldTypeGlobalID" + | "esriFieldTypeGUID" + | "esriFieldTypeInteger" + | "esriFieldTypeOID" + | "esriFieldTypeRaster" + | "esriFieldTypeSingle" + | "esriFieldTypeSmallInteger" + | "esriFieldTypeString" + | "esriFieldTypeXML"; + +/** + * Contains information about an attribute field. + */ +export interface IField { + /** A string defining the field name. */ + name: string; + /** A string defining the field type. */ + type: esriFieldType; + /** A string defining the field alias. */ + alias?: string; + /** The domain objects if applicable. */ + domain?: any; + /** A Boolean defining whether this field is editable. */ + editable?: boolean; + /** A Boolean defining whether or not the field is an exact match. */ + exactMatch?: boolean; + /** A number defining how many characters are allowed in a string. field. */ + length?: number; + /** A Boolean defining whether this field can have a null value. */ + nullable?: boolean; + /** The value written in for new records by default. */ + defaultValue?: any; +} + +/** + * Params for paging operations + */ +export interface IPagingParams { + start?: number; + num?: number; +} + +/** + * An ArcGIS Online or Enterprise user + */ +export interface IUser { + username?: string; + fullName?: string; + availableCredits?: number; + assignedCredits?: number; + firstName?: string; + lastName?: string; + preferredView?: any; + description?: string; + email?: string; + idpUsername?: string; + favGroupId?: string; + lastLogin?: number; + mfaEnabled?: boolean; + access?: string; + storageUsage?: number; + storageQuota?: number; + orgId?: string; + role?: "org_admin" | "org_publisher" | "org_user"; + privileges?: string[]; + roleId?: string; + level?: string; + disabled?: boolean; + units?: string; + tags?: string[]; + culture?: string; + region?: string; + thumbnail?: string; + created?: number; + modified?: number; + groups?: IGroup[]; + provider?: "arcgis" | "enterprise" | "facebook" | "google"; +} diff --git a/packages/arcgis-rest-common/src/types/symbol.ts b/packages/arcgis-rest-common/src/types/symbol.ts index e450979aeb..7e71823722 100644 --- a/packages/arcgis-rest-common/src/types/symbol.ts +++ b/packages/arcgis-rest-common/src/types/symbol.ts @@ -1,6 +1,113 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ +/** + * + */ +export type Color = [number, number, number, number]; + +/** + * + */ +export interface IFont { + family?: string; // ""; + size?: number; // ; + style?: "italic" | "normal" | "oblique"; + weight?: "bold" | "bolder" | "lighter" | "normal"; + decoration?: "line-through" | "underline" | "none"; +} + +/** + * + */ +export interface IPictureSourced { + url?: string; // Relative URL for static layers and full URL for dynamic layers. Access relative URL using http:////images/ + imageData?: string; // ""; + contentType?: string; + width?: number; + height?: number; + angle?: number; + xoffset?: number; + yoffset?: number; +} + +/** + * + */ +export interface ISymbol { + type: SymbolType; + style?: string; +} + +/** + * + */ +export interface ISymbol { + type: SymbolType; + style?: string; +} + +/** + * + */ +export interface IMarkerSymbol extends ISymbol { + angle?: number; + xoffset?: number; + yoffset?: number; +} + +/** + * + */ +export interface IPictureFillSymbol extends ISymbol, IPictureSourced { + type: "esriPFS"; + outline?: ISimpleLineSymbol; // if outline has been specified + xscale?: number; + yscale?: number; +} + +/** + * + */ +export interface IPictureMarkerSymbol extends IMarkerSymbol, IPictureSourced { + type: "esriPMS"; +} + +/** + * + */ +export type SimpleMarkerSymbolStyle = + | "esriSMSCircle" + | "esriSMSCross" + | "esriSMSDiamond" + | "esriSMSSquare" + | "esriSMSX" + | "esriSMSTriangle"; + +/** + * + */ +export type SimpleLineSymbolStyle = + | "esriSLSDash" + | "esriSLSDashDot" + | "esriSLSDashDotDot" + | "esriSLSDot" + | "esriSLSNull" + | "esriSLSSolid"; + +/** + * + */ +export type SimpleFillSymbolStyle = + | "esriSFSBackwardDiagonal" + | "esriSFSCross" + | "esriSFSDiagonalCross" + | "esriSFSForwardDiagonal" + | "esriSFSHorizontal" + | "esriSFSNull" + | "esriSFSSolid" + | "esriSFSVertical"; + /** * */ @@ -15,7 +122,49 @@ export type SymbolType = /** * */ -export interface ISymbol { - type: SymbolType; - style?: string; +export interface ISimpleFillSymbol extends ISymbol { + type: "esriSFS"; + style?: SimpleFillSymbolStyle; + color?: Color; + outline?: ISimpleLineSymbol; // if outline has been specified +} + +/** + * + */ +export interface ISimpleLineSymbol extends ISymbol { + type: "esriSLS"; + style?: SimpleLineSymbolStyle; + color?: Color; + width?: number; +} + +/** + * + */ +export interface ISimpleMarkerSymbol extends IMarkerSymbol { + type: "esriSMS"; + style?: SimpleMarkerSymbolStyle; + color?: Color; + size?: number; + outline?: ISimpleLineSymbol; +} + +/** + * + */ +export interface ITextSymbol extends IMarkerSymbol { + type: "esriTS"; + color?: Color; + backgroundColor?: Color; + borderLineSize?: number; // ; + borderLineColor?: Color; + haloSize?: number; // ; + haloColor?: Color; + verticalAlignment?: "baseline" | "top" | "middle" | "bottom"; + horizontalAlignment?: "left" | "right" | "center" | "justify"; + rightToLeft?: boolean; + kerning?: boolean; + font?: IFont; + text?: string; // only applicable when specified as a client-side graphic. } diff --git a/packages/arcgis-rest-common-types/src/webmap.ts b/packages/arcgis-rest-common/src/types/webmap.ts similarity index 99% rename from packages/arcgis-rest-common-types/src/webmap.ts rename to packages/arcgis-rest-common/src/types/webmap.ts index e3cb3a7f25..211d7bce00 100644 --- a/packages/arcgis-rest-common-types/src/webmap.ts +++ b/packages/arcgis-rest-common/src/types/webmap.ts @@ -2,20 +2,24 @@ * Apache-2.0 */ import { - IFeatureSet, - IField, IExtent, ISpatialReference, GeometryType, IHasZM, - IFeature, IGeometry, - IPoint, + IPoint +} from "./geometry"; + +import { IFeature, IFeatureSet } from "./feature"; + +import { IField } from "./miscellaneous"; + +import { ISimpleLineSymbol, IPictureMarkerSymbol, ISimpleFillSymbol, Color -} from "./index"; +} from "./symbol"; /** * The format object can be used with numerical or date fields to provide more detail about how values should be displayed in popup windows. diff --git a/packages/arcgis-rest-common/test/location.test.ts b/packages/arcgis-rest-common/test/location.test.ts index 4ca47786c5..4753ac85d4 100644 --- a/packages/arcgis-rest-common/test/location.test.ts +++ b/packages/arcgis-rest-common/test/location.test.ts @@ -1,8 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IPoint } from "../../arcgis-rest-common-types/src"; -import { ILocation } from "../src/types/geometry"; +import { ILocation, IPoint } from "../src/types/geometry"; import { isLocation, isLocationArray } from "../src/util/location"; // -117.195677,34.056383;-117.918976,33.812092 @@ -51,19 +50,6 @@ const stopsObjectsLatitudeLongitude: ILocation[] = [ } ]; -const stopsObjectsLatitudeLongitude3: ILocation[] = [ - { - latitude: 34.056383, - longitude: -117.195677, - z: 10.11 - }, - { - latitude: 33.812092, - longitude: -117.918976, - z: 8.43 - } -]; - const stopsObjectsPoint: IPoint[] = [ { x: -117.195677, diff --git a/packages/arcgis-rest-feature-service-admin/package.json b/packages/arcgis-rest-feature-service-admin/package.json index 530e4b55ac..517f7f423b 100644 --- a/packages/arcgis-rest-feature-service-admin/package.json +++ b/packages/arcgis-rest-feature-service-admin/package.json @@ -17,13 +17,13 @@ }, "devDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-items": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-items": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, diff --git a/packages/arcgis-rest-feature-service-admin/src/addTo.ts b/packages/arcgis-rest-feature-service-admin/src/addTo.ts index 3d36f9815f..330efb0a11 100644 --- a/packages/arcgis-rest-feature-service-admin/src/addTo.ts +++ b/packages/arcgis-rest-feature-service-admin/src/addTo.ts @@ -3,11 +3,7 @@ import { request, cleanUrl } from "@esri/arcgis-rest-request"; import { IUserRequestOptions } from "@esri/arcgis-rest-auth"; -import { - ILayer, - ILayerDefinition, - ITable -} from "@esri/arcgis-rest-common-types"; +import { ILayer, ILayerDefinition, ITable } from "@esri/arcgis-rest-common"; export interface IAddToServiceDefinitionRequestOptions extends IUserRequestOptions { @@ -53,8 +49,10 @@ export function addToServiceDefinition( url: string, requestOptions: IAddToServiceDefinitionRequestOptions ): Promise { - const adminUrl = - `${cleanUrl(url).replace(`/rest/services`, `/rest/admin/services`)}/addToDefinition`; + const adminUrl = `${cleanUrl(url).replace( + `/rest/services`, + `/rest/admin/services` + )}/addToDefinition`; requestOptions.params = { addToDefinition: {}, diff --git a/packages/arcgis-rest-feature-service-admin/src/create.ts b/packages/arcgis-rest-feature-service-admin/src/create.ts index 5e15ef7da5..920bd1aa22 100644 --- a/packages/arcgis-rest-feature-service-admin/src/create.ts +++ b/packages/arcgis-rest-feature-service-admin/src/create.ts @@ -7,7 +7,7 @@ import { IItemCrudRequestOptions, determineOwner } from "@esri/arcgis-rest-items"; -import { IExtent, ISpatialReference } from "@esri/arcgis-rest-common-types"; +import { IExtent, ISpatialReference } from "@esri/arcgis-rest-common"; /** * A [`createParameters` JSON object for a new diff --git a/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts b/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts index 540bdcdecf..ddee37dfda 100644 --- a/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts +++ b/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts @@ -17,7 +17,7 @@ import { layerDefinitionSid } from "./mocks/layerDefinition"; import { UserSession } from "@esri/arcgis-rest-auth"; import { TOMORROW } from "@esri/arcgis-rest-auth/test/utils"; import { encodeParam, ErrorTypes } from "@esri/arcgis-rest-request"; -import { ILayer, ITable } from "@esri/arcgis-rest-common-types"; +import { ILayer, ITable } from "@esri/arcgis-rest-common"; describe("add to feature service", () => { afterEach(fetchMock.restore); diff --git a/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts b/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts index 2df6b9578b..8acad37070 100644 --- a/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts +++ b/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { ILayerDefinition, IExtent } from "@esri/arcgis-rest-common-types"; +import { ILayerDefinition, IExtent } from "@esri/arcgis-rest-common"; const defaultExtent: IExtent = { xmin: -180, diff --git a/packages/arcgis-rest-feature-service/package.json b/packages/arcgis-rest-feature-service/package.json index 9bd9da6f3d..ca82750425 100644 --- a/packages/arcgis-rest-feature-service/package.json +++ b/packages/arcgis-rest-feature-service/package.json @@ -16,11 +16,11 @@ "tslib": "^1.9.3" }, "devDependencies": { - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "scripts": { diff --git a/packages/arcgis-rest-feature-service/src/add.ts b/packages/arcgis-rest-feature-service/src/add.ts index a434332002..e4aec54737 100644 --- a/packages/arcgis-rest-feature-service/src/add.ts +++ b/packages/arcgis-rest-feature-service/src/add.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2017 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IFeature } from "@esri/arcgis-rest-common-types"; +import { IFeature } from "@esri/arcgis-rest-common"; import { request, IRequestOptions, diff --git a/packages/arcgis-rest-feature-service/src/decodeValues.ts b/packages/arcgis-rest-feature-service/src/decodeValues.ts index 170d68af70..327bb17e13 100644 --- a/packages/arcgis-rest-feature-service/src/decodeValues.ts +++ b/packages/arcgis-rest-feature-service/src/decodeValues.ts @@ -2,11 +2,7 @@ * Apache-2.0 */ import { IRequestOptions } from "@esri/arcgis-rest-request"; -import { - IField, - ILayerDefinition, - IFeature -} from "@esri/arcgis-rest-common-types"; +import { IField, ILayerDefinition, IFeature } from "@esri/arcgis-rest-common"; import { IQueryFeaturesResponse } from "./query"; import { getLayer } from "./getLayer"; diff --git a/packages/arcgis-rest-feature-service/src/delete.ts b/packages/arcgis-rest-feature-service/src/delete.ts index 4ca0e3ed23..c4cd4ea2ff 100644 --- a/packages/arcgis-rest-feature-service/src/delete.ts +++ b/packages/arcgis-rest-feature-service/src/delete.ts @@ -5,8 +5,7 @@ import { request, IRequestOptions, appendCustomParams, - cleanUrl, - warn + cleanUrl } from "@esri/arcgis-rest-request"; import { IEditFeaturesParams, diff --git a/packages/arcgis-rest-feature-service/src/getLayer.ts b/packages/arcgis-rest-feature-service/src/getLayer.ts index ffd7df4c7c..60d3c427e6 100644 --- a/packages/arcgis-rest-feature-service/src/getLayer.ts +++ b/packages/arcgis-rest-feature-service/src/getLayer.ts @@ -2,7 +2,7 @@ * Apache-2.0 */ import { request, IRequestOptions, cleanUrl } from "@esri/arcgis-rest-request"; -import { ILayerDefinition } from "@esri/arcgis-rest-common-types"; +import { ILayerDefinition } from "@esri/arcgis-rest-common"; /** * ```js diff --git a/packages/arcgis-rest-feature-service/src/helpers.ts b/packages/arcgis-rest-feature-service/src/helpers.ts index 9f22b53c0d..1adf90efdc 100644 --- a/packages/arcgis-rest-feature-service/src/helpers.ts +++ b/packages/arcgis-rest-feature-service/src/helpers.ts @@ -6,7 +6,7 @@ import { SpatialRelationship, IGeometry, ISpatialReference -} from "@esri/arcgis-rest-common-types"; +} from "@esri/arcgis-rest-common"; export interface ISharedQueryParams { where?: string; diff --git a/packages/arcgis-rest-feature-service/src/query.ts b/packages/arcgis-rest-feature-service/src/query.ts index 5876af4d2b..f4375d82d9 100644 --- a/packages/arcgis-rest-feature-service/src/query.ts +++ b/packages/arcgis-rest-feature-service/src/query.ts @@ -13,7 +13,7 @@ import { IFeature, esriUnits, IExtent -} from "@esri/arcgis-rest-common-types"; +} from "@esri/arcgis-rest-common"; import { ISharedQueryParams } from "./helpers"; diff --git a/packages/arcgis-rest-feature-service/src/queryRelated.ts b/packages/arcgis-rest-feature-service/src/queryRelated.ts index ab6ffdf622..6f5e99ae8a 100644 --- a/packages/arcgis-rest-feature-service/src/queryRelated.ts +++ b/packages/arcgis-rest-feature-service/src/queryRelated.ts @@ -13,7 +13,7 @@ import { IHasZM, GeometryType, IField -} from "@esri/arcgis-rest-common-types"; +} from "@esri/arcgis-rest-common"; /** * 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. diff --git a/packages/arcgis-rest-feature-service/src/update.ts b/packages/arcgis-rest-feature-service/src/update.ts index 3e2ca72d62..d022685971 100644 --- a/packages/arcgis-rest-feature-service/src/update.ts +++ b/packages/arcgis-rest-feature-service/src/update.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2017 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IFeature } from "@esri/arcgis-rest-common-types"; +import { IFeature } from "@esri/arcgis-rest-common"; import { request, IRequestOptions, diff --git a/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts b/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts index 50c7ab9a2f..4a8da94b23 100644 --- a/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts +++ b/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts @@ -2,7 +2,7 @@ * Apache-2.0 */ import { IQueryFeaturesResponse } from "../../src/query"; -import { IFeature, IGeometry } from "@esri/arcgis-rest-common-types"; +import { IFeature, IGeometry } from "@esri/arcgis-rest-common"; export const cvdQueryResponse: IQueryFeaturesResponse = { objectIdFieldName: "objectid", diff --git a/packages/arcgis-rest-feature-service/test/mocks/fields.ts b/packages/arcgis-rest-feature-service/test/mocks/fields.ts index 7ce4d994be..bed5bcbc70 100644 --- a/packages/arcgis-rest-feature-service/test/mocks/fields.ts +++ b/packages/arcgis-rest-feature-service/test/mocks/fields.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IField } from "@esri/arcgis-rest-common-types"; +import { IField } from "@esri/arcgis-rest-common"; export const cvdServiceFields: IField[] = [ { diff --git a/packages/arcgis-rest-feature-service/test/mocks/service.ts b/packages/arcgis-rest-feature-service/test/mocks/service.ts index f7b425264e..e0d027157a 100644 --- a/packages/arcgis-rest-feature-service/test/mocks/service.ts +++ b/packages/arcgis-rest-feature-service/test/mocks/service.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { ILayerDefinition } from "@esri/arcgis-rest-common-types"; +import { ILayerDefinition } from "@esri/arcgis-rest-common"; import { cvdServiceFields } from "./fields"; export const getFeatureServiceResponse: ILayerDefinition = { diff --git a/packages/arcgis-rest-geocoder/package.json b/packages/arcgis-rest-geocoder/package.json index 8595997758..3a294b854a 100644 --- a/packages/arcgis-rest-geocoder/package.json +++ b/packages/arcgis-rest-geocoder/package.json @@ -17,12 +17,12 @@ }, "devDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "scripts": { diff --git a/packages/arcgis-rest-geocoder/src/bulk.ts b/packages/arcgis-rest-geocoder/src/bulk.ts index 69e53f17ad..82d335ba1f 100644 --- a/packages/arcgis-rest-geocoder/src/bulk.ts +++ b/packages/arcgis-rest-geocoder/src/bulk.ts @@ -3,7 +3,7 @@ import { request, cleanUrl } from "@esri/arcgis-rest-request"; -import { ISpatialReference, IPoint } from "@esri/arcgis-rest-common-types"; +import { ISpatialReference, IPoint } from "@esri/arcgis-rest-common"; import { worldGeocoder, IEndpointRequestOptions } from "./helpers"; diff --git a/packages/arcgis-rest-geocoder/src/geocode.ts b/packages/arcgis-rest-geocoder/src/geocode.ts index e2a0fbf2b0..a77f9d4f8a 100644 --- a/packages/arcgis-rest-geocoder/src/geocode.ts +++ b/packages/arcgis-rest-geocoder/src/geocode.ts @@ -7,11 +7,7 @@ import { cleanUrl } from "@esri/arcgis-rest-request"; -import { - IExtent, - ISpatialReference, - IPoint -} from "@esri/arcgis-rest-common-types"; +import { IExtent, ISpatialReference, IPoint } from "@esri/arcgis-rest-common"; import { worldGeocoder, IEndpointRequestOptions } from "./helpers"; diff --git a/packages/arcgis-rest-geocoder/src/helpers.ts b/packages/arcgis-rest-geocoder/src/helpers.ts index ea5102b48d..023c4df4f1 100644 --- a/packages/arcgis-rest-geocoder/src/helpers.ts +++ b/packages/arcgis-rest-geocoder/src/helpers.ts @@ -7,14 +7,6 @@ import { request, IRequestOptions } from "@esri/arcgis-rest-request"; export const worldGeocoder = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/"; -// to do: remove at v2.0.0 (and import from arcgis-rest-common instead) -export interface ILocation { - latitude?: number; - longitude?: number; - lat?: number; - long?: number; -} - // nice to have: verify custom endpoints contain 'GeocodeServer' and end in a '/' export interface IEndpointRequestOptions extends IRequestOptions { /** diff --git a/packages/arcgis-rest-geocoder/src/reverse.ts b/packages/arcgis-rest-geocoder/src/reverse.ts index 003614c15e..9694b3c544 100644 --- a/packages/arcgis-rest-geocoder/src/reverse.ts +++ b/packages/arcgis-rest-geocoder/src/reverse.ts @@ -2,24 +2,14 @@ * Apache-2.0 */ import { request, cleanUrl } from "@esri/arcgis-rest-request"; -import { IPoint } from "@esri/arcgis-rest-common-types"; +import { + IPoint, + ILocation, + isLocation, + isLocationArray +} from "@esri/arcgis-rest-common"; -import { ILocation, worldGeocoder, IEndpointRequestOptions } from "./helpers"; - -// to do: remove utility functions and import from arcgis-rest-common at v2 -function isLocationArray( - coords: ILocation | IPoint | [number, number] -): coords is [number, number] { - return (coords as [number, number]).length === 2; -} -function isLocation( - coords: ILocation | IPoint | [number, number] -): coords is ILocation { - return ( - (coords as ILocation).latitude !== undefined || - (coords as ILocation).lat !== undefined - ); -} +import { worldGeocoder, IEndpointRequestOptions } from "./helpers"; export interface IReverseGeocodeResponse { address: { diff --git a/packages/arcgis-rest-groups/package.json b/packages/arcgis-rest-groups/package.json index c975106beb..3b6978fa30 100644 --- a/packages/arcgis-rest-groups/package.json +++ b/packages/arcgis-rest-groups/package.json @@ -17,12 +17,12 @@ }, "devDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "scripts": { diff --git a/packages/arcgis-rest-groups/src/create.ts b/packages/arcgis-rest-groups/src/create.ts index 783563965a..cf87920c42 100644 --- a/packages/arcgis-rest-groups/src/create.ts +++ b/packages/arcgis-rest-groups/src/create.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IGroupAdd, IGroup } from "@esri/arcgis-rest-common-types"; +import { IGroupAdd, IGroup } from "@esri/arcgis-rest-common"; export interface IGroupAddRequestOptions extends IRequestOptions { group: IGroupAdd; diff --git a/packages/arcgis-rest-groups/src/get.ts b/packages/arcgis-rest-groups/src/get.ts index 02c942a231..2a2ce28844 100644 --- a/packages/arcgis-rest-groups/src/get.ts +++ b/packages/arcgis-rest-groups/src/get.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IPagingParams, IGroup, IItem } from "@esri/arcgis-rest-common-types"; +import { IPagingParams, IGroup, IItem } from "@esri/arcgis-rest-common"; export interface IPagingParamsRequestOptions extends IRequestOptions { paging: IPagingParams; diff --git a/packages/arcgis-rest-groups/src/search.ts b/packages/arcgis-rest-groups/src/search.ts index 72a165b12f..ade297123e 100644 --- a/packages/arcgis-rest-groups/src/search.ts +++ b/packages/arcgis-rest-groups/src/search.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IPagingParams, IGroup } from "@esri/arcgis-rest-common-types"; +import { IPagingParams, IGroup } from "@esri/arcgis-rest-common"; export interface IGroupSearchRequest extends IPagingParams { q: string; diff --git a/packages/arcgis-rest-groups/src/update.ts b/packages/arcgis-rest-groups/src/update.ts index 6bdedcae3f..585d0e3b24 100644 --- a/packages/arcgis-rest-groups/src/update.ts +++ b/packages/arcgis-rest-groups/src/update.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IItemUpdate } from "@esri/arcgis-rest-common-types"; +import { IItemUpdate } from "@esri/arcgis-rest-common"; export interface IGroupUpdateRequestOptions extends IRequestOptions { group: IItemUpdate; diff --git a/packages/arcgis-rest-groups/test/crud.test.ts b/packages/arcgis-rest-groups/test/crud.test.ts index 7c461741aa..97be750ac2 100644 --- a/packages/arcgis-rest-groups/test/crud.test.ts +++ b/packages/arcgis-rest-groups/test/crud.test.ts @@ -10,7 +10,7 @@ import { GroupEditResponse } from "./mocks/responses"; import { encodeParam } from "@esri/arcgis-rest-request"; import { UserSession } from "@esri/arcgis-rest-auth"; import { TOMORROW } from "@esri/arcgis-rest-auth/test/utils"; -import { IGroupAdd } from "@esri/arcgis-rest-common-types"; +import { IGroupAdd } from "@esri/arcgis-rest-common"; import * as fetchMock from "fetch-mock"; describe("groups", () => { diff --git a/packages/arcgis-rest-groups/test/mocks/responses.ts b/packages/arcgis-rest-groups/test/mocks/responses.ts index 26eb39df2c..ad971ec5e4 100644 --- a/packages/arcgis-rest-groups/test/mocks/responses.ts +++ b/packages/arcgis-rest-groups/test/mocks/responses.ts @@ -4,7 +4,7 @@ import { IGroupSearchResult } from "../../src/search"; import { IGroupContentResult, IGroupUsersResult } from "../../src/get"; -import { IGroup } from "@esri/arcgis-rest-common-types"; +import { IGroup } from "@esri/arcgis-rest-common"; export const GroupSearchResponse: IGroupSearchResult = { query: "* AND owner:dcadmin", diff --git a/packages/arcgis-rest-items/package.json b/packages/arcgis-rest-items/package.json index 9ba72e5d3f..3a0ea2cbc7 100644 --- a/packages/arcgis-rest-items/package.json +++ b/packages/arcgis-rest-items/package.json @@ -17,12 +17,12 @@ }, "devDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "scripts": { diff --git a/packages/arcgis-rest-items/src/create.ts b/packages/arcgis-rest-items/src/create.ts index 36c155d57b..356dc46929 100644 --- a/packages/arcgis-rest-items/src/create.ts +++ b/packages/arcgis-rest-items/src/create.ts @@ -3,7 +3,7 @@ import { request, getPortalUrl } from "@esri/arcgis-rest-request"; -import { IItemAdd } from "@esri/arcgis-rest-common-types"; +import { IItemAdd } from "@esri/arcgis-rest-common"; import { IAddFolderResponse, diff --git a/packages/arcgis-rest-items/src/get.ts b/packages/arcgis-rest-items/src/get.ts index 35ab6ecaec..dd08163c9b 100644 --- a/packages/arcgis-rest-items/src/get.ts +++ b/packages/arcgis-rest-items/src/get.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IItem, IGroup } from "@esri/arcgis-rest-common-types"; +import { IItem, IGroup } from "@esri/arcgis-rest-common"; import { IItemDataRequestOptions, diff --git a/packages/arcgis-rest-items/src/helpers.ts b/packages/arcgis-rest-items/src/helpers.ts index 2042093c94..f6bfee9f91 100644 --- a/packages/arcgis-rest-items/src/helpers.ts +++ b/packages/arcgis-rest-items/src/helpers.ts @@ -3,7 +3,7 @@ import { IRequestOptions } from "@esri/arcgis-rest-request"; -import { IItemAdd, IItemUpdate, IItem } from "@esri/arcgis-rest-common-types"; +import { IItemAdd, IItemUpdate, IItem } from "@esri/arcgis-rest-common"; import { IUserRequestOptions } from "@esri/arcgis-rest-auth"; diff --git a/packages/arcgis-rest-items/src/search.ts b/packages/arcgis-rest-items/src/search.ts index aa4c0dacd3..07c8396f6c 100644 --- a/packages/arcgis-rest-items/src/search.ts +++ b/packages/arcgis-rest-items/src/search.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IPagingParams, IItem } from "@esri/arcgis-rest-common-types"; +import { IPagingParams, IItem } from "@esri/arcgis-rest-common"; // this interface still needs to be docced export interface ISearchRequest extends IPagingParams { diff --git a/packages/arcgis-rest-items/src/update.ts b/packages/arcgis-rest-items/src/update.ts index 4b2cecb3b1..f02fb128c3 100644 --- a/packages/arcgis-rest-items/src/update.ts +++ b/packages/arcgis-rest-items/src/update.ts @@ -7,7 +7,7 @@ import { IRequestOptions } from "@esri/arcgis-rest-request"; -import { IItemUpdate } from "@esri/arcgis-rest-common-types"; +import { IItemUpdate } from "@esri/arcgis-rest-common"; import { IItemCrudRequestOptions, diff --git a/packages/arcgis-rest-items/test/mocks/item.ts b/packages/arcgis-rest-items/test/mocks/item.ts index f548125bf7..4ad119ce26 100644 --- a/packages/arcgis-rest-items/test/mocks/item.ts +++ b/packages/arcgis-rest-items/test/mocks/item.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IItem } from "@esri/arcgis-rest-common-types"; +import { IItem } from "@esri/arcgis-rest-common"; import { IGetRelatedItemsResponse, IItemGroupResponse } from "../../src/get"; export const ItemSuccessResponse: any = { diff --git a/packages/arcgis-rest-sharing/package.json b/packages/arcgis-rest-sharing/package.json index d7d5b46e68..c75825c6c0 100644 --- a/packages/arcgis-rest-sharing/package.json +++ b/packages/arcgis-rest-sharing/package.json @@ -14,13 +14,13 @@ }, "devDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-groups": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-groups": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, diff --git a/packages/arcgis-rest-sharing/src/group-sharing.ts b/packages/arcgis-rest-sharing/src/group-sharing.ts index 4037ca681e..0b4bfe8161 100644 --- a/packages/arcgis-rest-sharing/src/group-sharing.ts +++ b/packages/arcgis-rest-sharing/src/group-sharing.ts @@ -2,7 +2,7 @@ * Apache-2.0 */ import { request, getPortalUrl } from "@esri/arcgis-rest-request"; -import { IItem } from "@esri/arcgis-rest-common-types"; +import { IItem } from "@esri/arcgis-rest-common"; import { ISharingRequestOptions, diff --git a/packages/arcgis-rest-sharing/src/helpers.ts b/packages/arcgis-rest-sharing/src/helpers.ts index 3945a4c8e6..cb579bcb71 100644 --- a/packages/arcgis-rest-sharing/src/helpers.ts +++ b/packages/arcgis-rest-sharing/src/helpers.ts @@ -3,7 +3,7 @@ import { IRequestOptions, getPortalUrl } from "@esri/arcgis-rest-request"; import { UserSession } from "@esri/arcgis-rest-auth"; -import { IGroup, IUser, GroupMembership } from "@esri/arcgis-rest-common-types"; +import { IGroup, IUser, GroupMembership } from "@esri/arcgis-rest-common"; import { getGroup } from "@esri/arcgis-rest-groups"; import { IGroupSharingRequestOptions } from "./group-sharing"; diff --git a/packages/arcgis-rest-users/package.json b/packages/arcgis-rest-users/package.json index e049586a34..10ebc6c7e1 100644 --- a/packages/arcgis-rest-users/package.json +++ b/packages/arcgis-rest-users/package.json @@ -17,12 +17,12 @@ }, "devDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "peerDependencies": { "@esri/arcgis-rest-auth": "^1.19.2", - "@esri/arcgis-rest-common-types": "^1.19.2", + "@esri/arcgis-rest-common": "^1.19.2", "@esri/arcgis-rest-request": "^1.19.2" }, "scripts": { diff --git a/packages/arcgis-rest-users/src/get.ts b/packages/arcgis-rest-users/src/get.ts index e40c471a98..1952a56661 100644 --- a/packages/arcgis-rest-users/src/get.ts +++ b/packages/arcgis-rest-users/src/get.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IUser } from "@esri/arcgis-rest-common-types"; +import { IUser } from "@esri/arcgis-rest-common"; import { UserSession } from "@esri/arcgis-rest-auth"; export interface IGetUserRequestOptions extends IRequestOptions { diff --git a/packages/arcgis-rest-users/src/invitation.ts b/packages/arcgis-rest-users/src/invitation.ts index 89300ad475..95d44bee04 100644 --- a/packages/arcgis-rest-users/src/invitation.ts +++ b/packages/arcgis-rest-users/src/invitation.ts @@ -4,7 +4,7 @@ import { request, getPortalUrl } from "@esri/arcgis-rest-request"; import { IUserRequestOptions } from "@esri/arcgis-rest-auth"; -import { IGroup } from "@esri/arcgis-rest-common-types"; +import { IGroup } from "@esri/arcgis-rest-common"; export interface IInvitation { id: string; diff --git a/packages/arcgis-rest-users/src/update.ts b/packages/arcgis-rest-users/src/update.ts index a1fd1e0794..c35343fd8a 100644 --- a/packages/arcgis-rest-users/src/update.ts +++ b/packages/arcgis-rest-users/src/update.ts @@ -7,7 +7,7 @@ import { getPortalUrl } from "@esri/arcgis-rest-request"; -import { IUser } from "@esri/arcgis-rest-common-types"; +import { IUser } from "@esri/arcgis-rest-common"; import { UserSession } from "@esri/arcgis-rest-auth"; export interface IUpdateUserRequestOptions extends IRequestOptions { diff --git a/packages/arcgis-rest-users/test/mocks/user.ts b/packages/arcgis-rest-users/test/mocks/user.ts index 3a14b80529..9b3c39d4df 100644 --- a/packages/arcgis-rest-users/test/mocks/user.ts +++ b/packages/arcgis-rest-users/test/mocks/user.ts @@ -1,7 +1,7 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ -import { IUser } from "@esri/arcgis-rest-common-types"; +import { IUser } from "@esri/arcgis-rest-common"; export const AnonUserResponse: IUser = { username: "jsmith",