@esri/arcgis-rest-routing 3.4.1 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +4 -5
  2. package/dist/bundled/routing.esm.js +736 -0
  3. package/dist/bundled/routing.esm.js.map +1 -0
  4. package/dist/bundled/routing.esm.min.js +12 -0
  5. package/dist/bundled/routing.esm.min.js.map +1 -0
  6. package/dist/bundled/routing.umd.js +754 -0
  7. package/dist/bundled/routing.umd.js.map +1 -0
  8. package/dist/bundled/routing.umd.min.js +12 -0
  9. package/dist/bundled/routing.umd.min.js.map +1 -0
  10. package/dist/{node → cjs}/closestFacility.js +18 -18
  11. package/dist/cjs/closestFacility.js.map +1 -0
  12. package/dist/{node → cjs}/helpers.js +11 -11
  13. package/dist/cjs/helpers.js.map +1 -0
  14. package/dist/cjs/index.js +11 -0
  15. package/dist/cjs/index.js.map +1 -0
  16. package/dist/{node → cjs}/originDestinationMatrix.js +22 -23
  17. package/dist/cjs/originDestinationMatrix.js.map +1 -0
  18. package/dist/{node → cjs}/serviceArea.js +15 -16
  19. package/dist/cjs/serviceArea.js.map +1 -0
  20. package/dist/{node → cjs}/solveRoute.js +16 -17
  21. package/dist/cjs/solveRoute.js.map +1 -0
  22. package/dist/esm/closestFacility.d.ts +3 -2
  23. package/dist/esm/closestFacility.js +9 -9
  24. package/dist/esm/closestFacility.js.map +1 -1
  25. package/dist/esm/helpers.d.ts +1 -2
  26. package/dist/esm/helpers.js +15 -15
  27. package/dist/esm/helpers.js.map +1 -1
  28. package/dist/esm/index.d.ts +6 -6
  29. package/dist/esm/index.js +5 -5
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/originDestinationMatrix.d.ts +2 -2
  32. package/dist/esm/originDestinationMatrix.js +8 -9
  33. package/dist/esm/originDestinationMatrix.js.map +1 -1
  34. package/dist/esm/serviceArea.d.ts +2 -2
  35. package/dist/esm/serviceArea.js +8 -9
  36. package/dist/esm/serviceArea.js.map +1 -1
  37. package/dist/esm/solveRoute.d.ts +2 -2
  38. package/dist/esm/solveRoute.js +10 -11
  39. package/dist/esm/solveRoute.js.map +1 -1
  40. package/package.json +45 -41
  41. package/dist/node/closestFacility.js.map +0 -1
  42. package/dist/node/helpers.js.map +0 -1
  43. package/dist/node/index.js +0 -11
  44. package/dist/node/index.js.map +0 -1
  45. package/dist/node/originDestinationMatrix.js.map +0 -1
  46. package/dist/node/serviceArea.js.map +0 -1
  47. package/dist/node/solveRoute.js.map +0 -1
  48. package/dist/umd/routing.umd.js +0 -779
  49. package/dist/umd/routing.umd.js.map +0 -1
  50. package/dist/umd/routing.umd.min.js +0 -12
  51. package/dist/umd/routing.umd.min.js.map +0 -1
@@ -3,10 +3,9 @@
3
3
  * Apache-2.0 */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.originDestinationMatrix = void 0;
6
- var tslib_1 = require("tslib");
7
- var arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
8
- var helpers_1 = require("./helpers");
9
- var arcgis_1 = require("@terraformer/arcgis");
6
+ const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
7
+ const helpers_js_1 = require("./helpers.js");
8
+ const arcgis_1 = require("@terraformer/arcgis");
10
9
  /**
11
10
  * ```js
12
11
  * import { originDestinationMatrix } from '@esri/arcgis-rest-routing';
@@ -32,9 +31,9 @@ var arcgis_1 = require("@terraformer/arcgis");
32
31
  * @restlink https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm
33
32
  */
34
33
  function originDestinationMatrix(requestOptions) {
35
- var endpoint = requestOptions.endpoint || helpers_1.ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL;
36
- requestOptions.params = tslib_1.__assign({ outputType: "esriNAODOutputSparseMatrix", returnOrigins: true, returnDestinations: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true }, requestOptions.params);
37
- var options = arcgis_rest_request_1.appendCustomParams(requestOptions, [
34
+ const endpoint = requestOptions.endpoint || helpers_js_1.ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL;
35
+ requestOptions.params = Object.assign({ outputType: "esriNAODOutputSparseMatrix", returnOrigins: true, returnDestinations: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true }, requestOptions.params);
36
+ const options = (0, arcgis_rest_request_1.appendCustomParams)(requestOptions, [
38
37
  "outputType",
39
38
  "barriers",
40
39
  "polylineBarriers",
@@ -43,39 +42,39 @@ function originDestinationMatrix(requestOptions) {
43
42
  "returnDestinations",
44
43
  "returnBarriers",
45
44
  "returnPolylineBarriers",
46
- "returnPolygonBarriers",
45
+ "returnPolygonBarriers"
47
46
  ]);
48
47
  // the SAAS service does not support anonymous requests
49
48
  if (!requestOptions.authentication &&
50
- endpoint === helpers_1.ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL) {
49
+ endpoint === helpers_js_1.ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL) {
51
50
  return Promise.reject("Calculating the origin-destination cost matrix using the ArcGIS service requires authentication");
52
51
  }
53
52
  // use a formatting helper for input params of this type: Array<IPoint | ILocation | [number, number]>
54
- if (helpers_1.isFeatureSet(requestOptions.origins)) {
53
+ if ((0, helpers_js_1.isFeatureSet)(requestOptions.origins)) {
55
54
  options.params.origins = requestOptions.origins;
56
55
  }
57
56
  else {
58
- options.params.origins = helpers_1.normalizeLocationsList(requestOptions.origins).join(";");
57
+ options.params.origins = (0, helpers_js_1.normalizeLocationsList)(requestOptions.origins).join(";");
59
58
  }
60
- if (helpers_1.isFeatureSet(requestOptions.destinations)) {
59
+ if ((0, helpers_js_1.isFeatureSet)(requestOptions.destinations)) {
61
60
  options.params.destinations = requestOptions.destinations;
62
61
  }
63
62
  else {
64
- options.params.destinations = helpers_1.normalizeLocationsList(requestOptions.destinations).join(";");
63
+ options.params.destinations = (0, helpers_js_1.normalizeLocationsList)(requestOptions.destinations).join(";");
65
64
  }
66
65
  // optional input param that may need point geometry normalizing
67
66
  if (requestOptions.barriers) {
68
- if (helpers_1.isFeatureSet(requestOptions.barriers)) {
67
+ if ((0, helpers_js_1.isFeatureSet)(requestOptions.barriers)) {
69
68
  options.params.barriers = requestOptions.barriers;
70
69
  }
71
70
  else {
72
71
  // optional point geometry barriers must be normalized, too
73
72
  // but not if provided as IFeatureSet type
74
73
  // note that optional polylineBarriers and polygonBarriers do not need to be normalized
75
- options.params.barriers = helpers_1.normalizeLocationsList(requestOptions.barriers).join(";");
74
+ options.params.barriers = (0, helpers_js_1.normalizeLocationsList)(requestOptions.barriers).join(";");
76
75
  }
77
76
  }
78
- return arcgis_rest_request_1.request(arcgis_rest_request_1.cleanUrl(endpoint) + "/solveODCostMatrix", options).then(function (res) {
77
+ return (0, arcgis_rest_request_1.request)(`${(0, arcgis_rest_request_1.cleanUrl)(endpoint)}/solveODCostMatrix`, options).then(function (res) {
79
78
  return cleanResponse(res, options);
80
79
  });
81
80
  }
@@ -86,28 +85,28 @@ function cleanResponse(res, options) {
86
85
  if (options.params.outputType === "esriNAODOutputStraightLines" &&
87
86
  res.odLines &&
88
87
  res.odLines.spatialReference.wkid === 4326) {
89
- res.odLines.geoJson = arcgis_1.arcgisToGeoJSON(res.odLines);
88
+ res.odLines.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.odLines);
90
89
  }
91
90
  if (res.origins && res.origins.spatialReference.wkid === 4326) {
92
- res.origins.geoJson = arcgis_1.arcgisToGeoJSON(res.origins);
91
+ res.origins.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.origins);
93
92
  }
94
93
  if (res.destinations && res.destinations.spatialReference.wkid === 4326) {
95
- res.destinations.geoJson = arcgis_1.arcgisToGeoJSON(res.destinations);
94
+ res.destinations.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.destinations);
96
95
  }
97
96
  if (res.barriers && res.barriers.spatialReference.wkid === 4326) {
98
- res.barriers.geoJson = arcgis_1.arcgisToGeoJSON(res.barriers);
97
+ res.barriers.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.barriers);
99
98
  }
100
99
  if (res.polygonBarriers &&
101
100
  res.polygonBarriers.spatialReference.wkid === 4326) {
102
- res.polygonBarriers.geoJson = arcgis_1.arcgisToGeoJSON(res.polygonBarriers);
101
+ res.polygonBarriers.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.polygonBarriers);
103
102
  }
104
103
  if (res.polylineBarriers &&
105
104
  res.polylineBarriers.spatialReference.wkid === 4326) {
106
- res.polylineBarriers.geoJson = arcgis_1.arcgisToGeoJSON(res.polylineBarriers);
105
+ res.polylineBarriers.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.polylineBarriers);
107
106
  }
108
107
  return res;
109
108
  }
110
109
  exports.default = {
111
- originDestinationMatrix: originDestinationMatrix,
110
+ originDestinationMatrix
112
111
  };
113
112
  //# sourceMappingURL=originDestinationMatrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"originDestinationMatrix.js","sourceRoot":"","sources":["../../src/originDestinationMatrix.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,mEAQmC;AAEnC,6CAKsB;AAEtB,gDAAsD;AAiDtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,uBAAuB,CACrC,cAA+C;IAE/C,MAAM,QAAQ,GACZ,cAAc,CAAC,QAAQ,IAAI,wDAA2C,CAAC;IAEzE,cAAc,CAAC,MAAM,mBACnB,UAAU,EAAE,4BAA4B,EACxC,aAAa,EAAE,IAAI,EACnB,kBAAkB,EAAE,IAAI,EACxB,cAAc,EAAE,IAAI,EACpB,sBAAsB,EAAE,IAAI,EAC5B,qBAAqB,EAAE,IAAI,IACxB,cAAc,CAAC,MAAM,CACzB,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,wCAAkB,EAChC,cAAc,EACd;QACE,YAAY;QACZ,UAAU;QACV,kBAAkB;QAClB,iBAAiB;QACjB,eAAe;QACf,oBAAoB;QACpB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E,GAAG,CAAC,gBAAgB;QACpB,GAAG,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EACnD;QACA,GAAG,CAAC,gBAAgB,CAAC,OAAO,GAAG,IAAA,wBAAe,EAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;KACtE;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,kBAAe;IACb,uBAAuB;CACxB,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n cleanUrl,\n appendCustomParams,\n IRequestOptions,\n ILocation, \n IPoint, \n IFeatureSet\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL,\n IEndpointOptions,\n normalizeLocationsList,\n isFeatureSet\n} from \"./helpers.js\";\n\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\n\nexport interface IOriginDestinationMatrixOptions extends IEndpointOptions {\n /**\n * Specify the starting points from which to travel to the destinations.\n */\n origins: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify the ending point locations to travel to from the origins.\n */\n destinations: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify the type of output returned by the service. Defaults to \"esriNAODOutputSparseMatrix\".\n */\n outputType?:\n | \"esriNAODOutputSparseMatrix\"\n | \"esriNAODOutputStraightLines\"\n | \"esriNAODOutputNoLines\";\n barriers?: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n polylineBarriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n returnOrigins?: boolean;\n returnDestinations?: boolean;\n returnBarriers?: boolean;\n returnPolylineBarriers?: boolean;\n returnPolygonBarriers?: boolean;\n}\n\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\n geoJson?: any;\n}\n\nexport interface IOriginDestinationMatrixResponse {\n messages: [{ type: number; description: string }];\n /**\n * Only present if outputType is \"esriNAODOutputSparseMatrix\". Full description is available at https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm#ESRI_SECTION2_114F8364507C4B56B780DFAD505270FB.\n */\n odCostMatrix?: any;\n /**\n * Only present if outputType is \"esriNAODOutputStraightLines\" or \"esriNAODOutputNoLines\". Includes the geometry for the straight line connecting each origin-destination pair when the outputType is \"esriNAODOutputStraightLines\".\n */\n odLines?: IFeatureSetWithGeoJson;\n origins?: IFeatureSetWithGeoJson;\n destinations?: IFeatureSetWithGeoJson;\n barriers?: IFeatureSetWithGeoJson;\n polylineBarriers?: IFeatureSetWithGeoJson;\n polygonBarriers?: IFeatureSetWithGeoJson;\n}\n\n/**\n * ```js\n * import { originDestinationMatrix } from '@esri/arcgis-rest-routing';\n * //\n * originDestinationMatrix({\n * origins: [\n * [-90.404302, 38.600621],\n * [-90.364293, 38.620427],\n * ],\n * destinations: [\n * [-90.444716, 38.635501],\n * [-90.311919, 38.633523],\n * [-90.451147, 38.581107]\n * ],\n * authentication\n * })\n * .then(response) // => { ... }\n * ```\n * Used to create an origin-destination (OD) cost matrix from multiple origins to multiple destinations. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm) for more information.\n *\n * @param requestOptions Options to pass through to the routing service.\n * @returns A Promise that will resolve with travel time and/or distance for each origin-destination pair. It returns either odLines or odCostMatrix for this information depending on the outputType you specify.\n * @restlink https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm\n */\nexport function originDestinationMatrix(\n requestOptions: IOriginDestinationMatrixOptions\n): Promise<IOriginDestinationMatrixResponse> {\n const endpoint =\n requestOptions.endpoint || ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL;\n\n requestOptions.params = {\n outputType: \"esriNAODOutputSparseMatrix\",\n returnOrigins: true,\n returnDestinations: true,\n returnBarriers: true,\n returnPolylineBarriers: true,\n returnPolygonBarriers: true,\n ...requestOptions.params\n };\n\n const options = appendCustomParams<IOriginDestinationMatrixOptions>(\n requestOptions,\n [\n \"outputType\",\n \"barriers\",\n \"polylineBarriers\",\n \"polygonBarriers\",\n \"returnOrigins\",\n \"returnDestinations\",\n \"returnBarriers\",\n \"returnPolylineBarriers\",\n \"returnPolygonBarriers\"\n ]\n );\n\n // the SAAS service does not support anonymous requests\n if (\n !requestOptions.authentication &&\n endpoint === ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL\n ) {\n return Promise.reject(\n \"Calculating the origin-destination cost matrix using the ArcGIS service requires authentication\"\n );\n }\n\n // use a formatting helper for input params of this type: Array<IPoint | ILocation | [number, number]>\n if (isFeatureSet(requestOptions.origins)) {\n options.params.origins = requestOptions.origins;\n } else {\n options.params.origins = normalizeLocationsList(\n requestOptions.origins\n ).join(\";\");\n }\n\n if (isFeatureSet(requestOptions.destinations)) {\n options.params.destinations = requestOptions.destinations;\n } else {\n options.params.destinations = normalizeLocationsList(\n requestOptions.destinations\n ).join(\";\");\n }\n\n // optional input param that may need point geometry normalizing\n if (requestOptions.barriers) {\n if (isFeatureSet(requestOptions.barriers)) {\n options.params.barriers = requestOptions.barriers;\n } else {\n // optional point geometry barriers must be normalized, too\n // but not if provided as IFeatureSet type\n // note that optional polylineBarriers and polygonBarriers do not need to be normalized\n options.params.barriers = normalizeLocationsList(\n requestOptions.barriers\n ).join(\";\");\n }\n }\n\n return request(`${cleanUrl(endpoint)}/solveODCostMatrix`, options).then(\n function (res) {\n return cleanResponse(res, options);\n }\n );\n}\n\nfunction cleanResponse(\n res: any,\n options: IRequestOptions\n): IOriginDestinationMatrixResponse {\n // add \"geoJson\" property to each response property that is an arcgis featureSet\n\n // res.odLines only exists and only includes geometry in this condition (out of 3 possible options.params.outputType conditions)\n if (\n options.params.outputType === \"esriNAODOutputStraightLines\" &&\n res.odLines &&\n res.odLines.spatialReference.wkid === 4326\n ) {\n res.odLines.geoJson = arcgisToGeoJSON(res.odLines);\n }\n\n if (res.origins && res.origins.spatialReference.wkid === 4326) {\n res.origins.geoJson = arcgisToGeoJSON(res.origins);\n }\n\n if (res.destinations && res.destinations.spatialReference.wkid === 4326) {\n res.destinations.geoJson = arcgisToGeoJSON(res.destinations);\n }\n\n if (res.barriers && res.barriers.spatialReference.wkid === 4326) {\n res.barriers.geoJson = arcgisToGeoJSON(res.barriers);\n }\n\n if (\n res.polygonBarriers &&\n res.polygonBarriers.spatialReference.wkid === 4326\n ) {\n res.polygonBarriers.geoJson = arcgisToGeoJSON(res.polygonBarriers);\n }\n\n if (\n res.polylineBarriers &&\n res.polylineBarriers.spatialReference.wkid === 4326\n ) {\n res.polylineBarriers.geoJson = arcgisToGeoJSON(res.polylineBarriers);\n }\n\n return res;\n}\n\nexport default {\n originDestinationMatrix\n};\n"]}
@@ -3,10 +3,9 @@
3
3
  * Apache-2.0 */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.serviceArea = void 0;
6
- var tslib_1 = require("tslib");
7
- var arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
8
- var helpers_1 = require("./helpers");
9
- var arcgis_1 = require("@terraformer/arcgis");
6
+ const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
7
+ const helpers_js_1 = require("./helpers.js");
8
+ const arcgis_1 = require("@terraformer/arcgis");
10
9
  function getTravelDirection(key) {
11
10
  if (key === "incidentsToFacilities") {
12
11
  return "esriNATravelDirectionFromFacility";
@@ -36,9 +35,9 @@ function getTravelDirection(key) {
36
35
  * @restlink https://developers.arcgis.com/rest/network/api-reference/service-area-synchronous-service.htm
37
36
  */
38
37
  function serviceArea(requestOptions) {
39
- var endpoint = requestOptions.endpoint || helpers_1.ARCGIS_ONLINE_SERVICE_AREA_URL;
40
- requestOptions.params = tslib_1.__assign({ returnFacilities: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true, preserveObjectID: true }, requestOptions.params);
41
- var options = arcgis_rest_request_1.appendCustomParams(requestOptions, [
38
+ const endpoint = requestOptions.endpoint || helpers_js_1.ARCGIS_ONLINE_SERVICE_AREA_URL;
39
+ requestOptions.params = Object.assign({ returnFacilities: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true, preserveObjectID: true }, requestOptions.params);
40
+ const options = (0, arcgis_rest_request_1.appendCustomParams)(requestOptions, [
42
41
  "barriers",
43
42
  "polylineBarriers",
44
43
  "polygonBarriers",
@@ -47,7 +46,7 @@ function serviceArea(requestOptions) {
47
46
  "returnBarriers",
48
47
  "returnPolylineBarriers",
49
48
  "returnPolygonBarriers",
50
- "preserveObjectID",
49
+ "preserveObjectID"
51
50
  ]);
52
51
  // Set travelDirection
53
52
  if (requestOptions.travelDirection) {
@@ -55,28 +54,28 @@ function serviceArea(requestOptions) {
55
54
  }
56
55
  // the SAAS service does not support anonymous requests
57
56
  if (!requestOptions.authentication &&
58
- endpoint === helpers_1.ARCGIS_ONLINE_SERVICE_AREA_URL) {
57
+ endpoint === helpers_js_1.ARCGIS_ONLINE_SERVICE_AREA_URL) {
59
58
  return Promise.reject("Finding service areas using the ArcGIS service requires authentication");
60
59
  }
61
- if (helpers_1.isFeatureSet(requestOptions.facilities)) {
60
+ if ((0, helpers_js_1.isFeatureSet)(requestOptions.facilities)) {
62
61
  options.params.facilities = requestOptions.facilities;
63
62
  }
64
63
  else {
65
- options.params.facilities = helpers_1.normalizeLocationsList(requestOptions.facilities).join(";");
64
+ options.params.facilities = (0, helpers_js_1.normalizeLocationsList)(requestOptions.facilities).join(";");
66
65
  }
67
66
  // optional input param that may need point geometry normalizing
68
67
  if (requestOptions.barriers) {
69
- if (helpers_1.isFeatureSet(requestOptions.barriers)) {
68
+ if ((0, helpers_js_1.isFeatureSet)(requestOptions.barriers)) {
70
69
  options.params.barriers = requestOptions.barriers;
71
70
  }
72
71
  else {
73
72
  // optional point geometry barriers must be normalized, too
74
73
  // but not if provided as IFeatureSet type
75
74
  // note that optional polylineBarriers and polygonBarriers do not need to be normalized
76
- options.params.barriers = helpers_1.normalizeLocationsList(requestOptions.barriers).join(";");
75
+ options.params.barriers = (0, helpers_js_1.normalizeLocationsList)(requestOptions.barriers).join(";");
77
76
  }
78
77
  }
79
- return arcgis_rest_request_1.request(arcgis_rest_request_1.cleanUrl(endpoint) + "/solveServiceArea", options).then(cleanResponse);
78
+ return (0, arcgis_rest_request_1.request)(`${(0, arcgis_rest_request_1.cleanUrl)(endpoint)}/solveServiceArea`, options).then(cleanResponse);
80
79
  }
81
80
  exports.serviceArea = serviceArea;
82
81
  function cleanResponse(res) {
@@ -84,11 +83,11 @@ function cleanResponse(res) {
84
83
  delete res.saPolygons.fieldAliases;
85
84
  // add "geoJson" property to "saPolygons"
86
85
  if (res.saPolygons.spatialReference.wkid === 4326) {
87
- res.saPolygons.geoJson = arcgis_1.arcgisToGeoJSON(res.saPolygons);
86
+ res.saPolygons.geoJson = (0, arcgis_1.arcgisToGeoJSON)(res.saPolygons);
88
87
  }
89
88
  return res;
90
89
  }
91
90
  exports.default = {
92
- serviceArea: serviceArea,
91
+ serviceArea
93
92
  };
94
93
  //# sourceMappingURL=serviceArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceArea.js","sourceRoot":"","sources":["../../src/serviceArea.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,mEAOmC;AAEnC,6CAKsB;AAEtB,gDAAsD;AAoCtD,SAAS,kBAAkB,CACzB,GAAsD;IAEtD,IAAI,GAAG,KAAK,uBAAuB,EAAE;QACnC,OAAO,mCAAmC,CAAC;KAC5C;SAAM;QACL,OAAO,iCAAiC,CAAC;KAC1C;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,WAAW,CACzB,cAAmC;IAEnC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,2CAA8B,CAAC;IAE3E,cAAc,CAAC,MAAM,mBACnB,gBAAgB,EAAE,IAAI,EACtB,cAAc,EAAE,IAAI,EACpB,sBAAsB,EAAE,IAAI,EAC5B,qBAAqB,EAAE,IAAI,EAC3B,gBAAgB,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,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,IAAI,CACpE,aAAa,CACd,CAAC;AACJ,CAAC;AApED,kCAoEC;AAED,SAAS,aAAa,CAAC,GAAQ;IAC7B,yDAAyD;IACzD,OAAO,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;IAEnC,yCAAyC;IACzC,IAAI,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EAAE;QACjD,GAAG,CAAC,UAAU,CAAC,OAAO,GAAG,IAAA,wBAAe,EAAC,GAAG,CAAC,UAAU,CAAC,CAAC;KAC1D;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,kBAAe;IACb,WAAW;CACZ,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n cleanUrl,\n appendCustomParams,\n ILocation, \n IPoint, \n IFeatureSet\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_SERVICE_AREA_URL,\n IEndpointOptions,\n normalizeLocationsList,\n isFeatureSet\n} from \"./helpers.js\";\n\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\n\nexport interface IServiceAreaOptions extends IEndpointOptions {\n /**\n * Specify one or more locations around which service areas are generated.\n */\n facilities: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify if the service should return routes.\n */\n travelDirection?: \"incidentsToFacilities\" | \"facilitiesToIncidents\";\n barriers?: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n polylineBarriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n outputLines?: boolean;\n returnFacilities?: boolean;\n returnBarriers?: boolean;\n returnPolylineBarriers?: boolean;\n returnPolygonBarriers?: boolean;\n preserveObjectID?: boolean;\n}\n\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\n geoJson?: any;\n}\n\nexport interface IServiceAreaResponse {\n messages: string[];\n saPolygons?: IFeatureSetWithGeoJson;\n incidents?: IFeatureSet;\n facilities?: IFeatureSet;\n barriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n polylineBarriers?: IFeatureSet;\n}\n\nfunction getTravelDirection(\n key: \"incidentsToFacilities\" | \"facilitiesToIncidents\"\n): \"esriNATravelDirectionFromFacility\" | \"esriNATravelDirectionToFacility\" {\n if (key === \"incidentsToFacilities\") {\n return \"esriNATravelDirectionFromFacility\";\n } else {\n return \"esriNATravelDirectionToFacility\";\n }\n}\n\n/**\n * ```js\n * import { serviceArea } from '@esri/arcgis-rest-routing';\n * //\n * serviceArea({\n * facilities: [\n * [-90.444716, 38.635501],\n * [-90.311919, 38.633523],\n * [-90.451147, 38.581107]\n * ],\n * authentication\n * })\n * .then(response) // => {routes: {features: [{attributes: { ... }, geometry:{ ... }}]}\n * ```\n * Used to find the area that can be reached from the input location within a given travel time or travel distance. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/service-area-synchronous-service.htm) for more information.\n *\n * @param requestOptions Options to pass through to the routing service.\n * @returns A Promise that will resolve with service area polygons for the request.\n * @restlink https://developers.arcgis.com/rest/network/api-reference/service-area-synchronous-service.htm\n */\nexport function serviceArea(\n requestOptions: IServiceAreaOptions\n): Promise<IServiceAreaResponse> {\n const endpoint = requestOptions.endpoint || ARCGIS_ONLINE_SERVICE_AREA_URL;\n\n requestOptions.params = {\n returnFacilities: true,\n returnBarriers: true,\n returnPolylineBarriers: true,\n returnPolygonBarriers: true,\n preserveObjectID: true,\n ...requestOptions.params\n };\n\n const options = appendCustomParams<IServiceAreaOptions>(requestOptions, [\n \"barriers\",\n \"polylineBarriers\",\n \"polygonBarriers\",\n \"outputLines\",\n \"returnFacilities\",\n \"returnBarriers\",\n \"returnPolylineBarriers\",\n \"returnPolygonBarriers\",\n \"preserveObjectID\"\n ]);\n\n // Set travelDirection\n if (requestOptions.travelDirection) {\n options.params.travelDirection = getTravelDirection(\n requestOptions.travelDirection\n );\n }\n\n // the SAAS service does not support anonymous requests\n if (\n !requestOptions.authentication &&\n endpoint === ARCGIS_ONLINE_SERVICE_AREA_URL\n ) {\n return Promise.reject(\n \"Finding service areas using the ArcGIS service requires authentication\"\n );\n }\n\n if (isFeatureSet(requestOptions.facilities)) {\n options.params.facilities = requestOptions.facilities;\n } else {\n options.params.facilities = normalizeLocationsList(\n requestOptions.facilities\n ).join(\";\");\n }\n\n // optional input param that may need point geometry normalizing\n if (requestOptions.barriers) {\n if (isFeatureSet(requestOptions.barriers)) {\n options.params.barriers = requestOptions.barriers;\n } else {\n // optional point geometry barriers must be normalized, too\n // but not if provided as IFeatureSet type\n // note that optional polylineBarriers and polygonBarriers do not need to be normalized\n options.params.barriers = normalizeLocationsList(\n requestOptions.barriers\n ).join(\";\");\n }\n }\n\n return request(`${cleanUrl(endpoint)}/solveServiceArea`, options).then(\n cleanResponse\n );\n}\n\nfunction cleanResponse(res: any): IServiceAreaResponse {\n // remove \"fieldAliases\" because it does not do anything.\n delete res.saPolygons.fieldAliases;\n\n // add \"geoJson\" property to \"saPolygons\"\n if (res.saPolygons.spatialReference.wkid === 4326) {\n res.saPolygons.geoJson = arcgisToGeoJSON(res.saPolygons);\n }\n return res;\n}\n\nexport default {\n serviceArea\n};\n"]}
@@ -3,10 +3,9 @@
3
3
  * Apache-2.0 */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.solveRoute = void 0;
6
- var tslib_1 = require("tslib");
7
- var arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
8
- var helpers_1 = require("./helpers");
9
- var arcgis_1 = require("@terraformer/arcgis");
6
+ const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
7
+ const helpers_js_1 = require("./helpers.js");
8
+ const arcgis_1 = require("@terraformer/arcgis");
10
9
  function isLocationArray(coords) {
11
10
  return (coords.length === 2 ||
12
11
  coords.length === 3);
@@ -35,17 +34,17 @@ function isLocation(coords) {
35
34
  * @restlink https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm
36
35
  */
37
36
  function solveRoute(requestOptions) {
38
- var options = tslib_1.__assign({ endpoint: requestOptions.endpoint || helpers_1.ARCGIS_ONLINE_ROUTING_URL, params: {} }, requestOptions);
37
+ const options = Object.assign({ endpoint: requestOptions.endpoint || helpers_js_1.ARCGIS_ONLINE_ROUTING_URL, params: {} }, requestOptions);
39
38
  // the SAAS service does not support anonymous requests
40
39
  if (!requestOptions.authentication &&
41
- options.endpoint === helpers_1.ARCGIS_ONLINE_ROUTING_URL) {
40
+ options.endpoint === helpers_js_1.ARCGIS_ONLINE_ROUTING_URL) {
42
41
  return Promise.reject("Routing using the ArcGIS service requires authentication");
43
42
  }
44
- if (helpers_1.isFeatureSet(requestOptions.stops)) {
43
+ if ((0, helpers_js_1.isFeatureSet)(requestOptions.stops)) {
45
44
  options.params.stops = requestOptions.stops;
46
45
  }
47
46
  else {
48
- var stops = requestOptions.stops.map(function (coords) {
47
+ const stops = requestOptions.stops.map((coords) => {
49
48
  if (isLocationArray(coords)) {
50
49
  return coords.join();
51
50
  }
@@ -66,14 +65,14 @@ function solveRoute(requestOptions) {
66
65
  });
67
66
  options.params.stops = stops.join(";");
68
67
  }
69
- return arcgis_rest_request_1.request(arcgis_rest_request_1.cleanUrl(options.endpoint) + "/solve", options).then(cleanResponse);
68
+ return (0, arcgis_rest_request_1.request)(`${(0, arcgis_rest_request_1.cleanUrl)(options.endpoint)}/solve`, options).then(cleanResponse);
70
69
  }
71
70
  exports.solveRoute = solveRoute;
72
71
  function cleanResponse(res) {
73
72
  if (res.directions && res.directions.length > 0) {
74
- res.directions = res.directions.map(function (direction) {
75
- direction.features = direction.features.map(function (feature) {
76
- feature.geometry = helpers_1.decompressGeometry(feature.compressedGeometry);
73
+ res.directions = res.directions.map((direction) => {
74
+ direction.features = direction.features.map((feature) => {
75
+ feature.geometry = (0, helpers_js_1.decompressGeometry)(feature.compressedGeometry);
77
76
  return feature;
78
77
  });
79
78
  return direction;
@@ -81,21 +80,21 @@ function cleanResponse(res) {
81
80
  }
82
81
  // add "geoJson" property to "routes"
83
82
  if (res.routes.spatialReference.wkid === 4326) {
84
- var features = res.routes.features.map(function (feature) {
83
+ const features = res.routes.features.map((feature) => {
85
84
  return {
86
85
  type: "Feature",
87
- geometry: arcgis_1.arcgisToGeoJSON(feature.geometry),
88
- properties: Object.assign({}, feature.attributes),
86
+ geometry: (0, arcgis_1.arcgisToGeoJSON)(feature.geometry),
87
+ properties: Object.assign({}, feature.attributes)
89
88
  };
90
89
  });
91
90
  res.routes.geoJson = {
92
91
  type: "FeatureCollection",
93
- features: features,
92
+ features
94
93
  };
95
94
  }
96
95
  return res;
97
96
  }
98
97
  exports.default = {
99
- solveRoute: solveRoute,
98
+ solveRoute
100
99
  };
101
100
  //# sourceMappingURL=solveRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solveRoute.js","sourceRoot":"","sources":["../../src/solveRoute.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,mEAOmC;AAEnC,6CAKsB;AAEtB,gDAAsD;AA+BtD,SAAS,eAAe,CACtB,MAAwE;IAExE,OAAO,CACJ,MAA2B,CAAC,MAAM,KAAK,CAAC;QACxC,MAAmC,CAAC,MAAM,KAAK,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,MAAwE;IAExE,OAAO,CACJ,MAAoB,CAAC,QAAQ,KAAK,SAAS;QAC3C,MAAoB,CAAC,GAAG,KAAK,SAAS,CACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,UAAU,CACxB,cAAkC;IAElC,MAAM,OAAO,mBACX,QAAQ,EAAE,cAAc,CAAC,QAAQ,IAAI,sCAAyB,EAC9D,MAAM,EAAE,EAAE,IACP,cAAc,CAClB,CAAC;IAEF,uDAAuD;IACvD,IACE,CAAC,cAAc,CAAC,cAAc;QAC9B,OAAO,CAAC,QAAQ,KAAK,sCAAyB,EAC9C;QACA,OAAO,OAAO,CAAC,MAAM,CACnB,0DAA0D,CA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n IPoint,\r\n IFeature,\r\n IFeatureSet\r\n} from \"@esri/arcgis-rest-request\";\r\n\r\nimport {\r\n ARCGIS_ONLINE_ROUTING_URL,\r\n IEndpointOptions,\r\n decompressGeometry,\r\n isFeatureSet\r\n} from \"./helpers.js\";\r\n\r\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\r\n\r\ninterface IFeatureWithCompressedGeometry extends IFeature {\r\n compressedGeometry?: string;\r\n}\r\n\r\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\r\n geoJson?: {};\r\n}\r\n\r\nexport interface ISolveRouteOptions extends IEndpointOptions {\r\n /**\r\n * Specify two or more locations between which the route is to be found.\r\n */\r\n stops:\r\n | Array<IPoint | ILocation | [number, number] | [number, number, number]>\r\n | IFeatureSet;\r\n}\r\n\r\nexport interface ISolveRouteResponse {\r\n messages: string[];\r\n checksum: string;\r\n routes: IFeatureSetWithGeoJson;\r\n directions?: Array<{\r\n routeId: number;\r\n routeName: string;\r\n summary: object;\r\n features: IFeature[];\r\n }>;\r\n}\r\n\r\nfunction isLocationArray(\r\n coords: ILocation | IPoint | [number, number] | [number, number, number]\r\n): coords is [number, number] | [number, number, number] {\r\n return (\r\n (coords as [number, number]).length === 2 ||\r\n (coords as [number, number, number]).length === 3\r\n );\r\n}\r\n\r\nfunction isLocation(\r\n coords: ILocation | IPoint | [number, number] | [number, number, number]\r\n): coords is ILocation {\r\n return (\r\n (coords as ILocation).latitude !== undefined ||\r\n (coords as ILocation).lat !== undefined\r\n );\r\n}\r\n\r\n/**\r\n * ```js\r\n * import { solveRoute } from '@esri/arcgis-rest-routing';\r\n * //\r\n * solveRoute({\r\n * stops: [\r\n * [-117.195677, 34.056383],\r\n * [-117.918976, 33.812092],\r\n * ],\r\n * authentication\r\n * })\r\n * .then(response) // => {routes: {features: [{attributes: { ... }, geometry:{ ... }}]}\r\n * ```\r\n * Used to find the best way to get from one location to another or to visit several locations. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm) for more information.\r\n *\r\n * @param requestOptions Options to pass through to the routing service.\r\n * @returns A Promise that will resolve with routes and directions for the request.\r\n * @restlink https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm\r\n */\r\nexport function solveRoute(\r\n requestOptions: ISolveRouteOptions\r\n): Promise<ISolveRouteResponse> {\r\n const options: ISolveRouteOptions = {\r\n endpoint: requestOptions.endpoint || ARCGIS_ONLINE_ROUTING_URL,\r\n params: {},\r\n ...requestOptions\r\n };\r\n\r\n // the SAAS service does not support anonymous requests\r\n if (\r\n !requestOptions.authentication &&\r\n options.endpoint === ARCGIS_ONLINE_ROUTING_URL\r\n ) {\r\n return Promise.reject(\r\n \"Routing using the ArcGIS service requires authentication\"\r\n );\r\n }\r\n\r\n if (isFeatureSet(requestOptions.stops)) {\r\n options.params.stops = requestOptions.stops;\r\n } else {\r\n const stops: string[] = requestOptions.stops.map((coords) => {\r\n if (isLocationArray(coords)) {\r\n return coords.join();\r\n } else if (isLocation(coords)) {\r\n if (coords.lat) {\r\n return (\r\n coords.long + \",\" + coords.lat + (coords.z ? \",\" + coords.z : \"\")\r\n );\r\n } else {\r\n return (\r\n coords.longitude +\r\n \",\" +\r\n coords.latitude +\r\n (coords.z ? \",\" + coords.z : \"\")\r\n );\r\n }\r\n } else {\r\n return coords.x + \",\" + coords.y + (coords.z ? \",\" + coords.z : \"\");\r\n }\r\n });\r\n\r\n options.params.stops = stops.join(\";\");\r\n }\r\n\r\n return request(`${cleanUrl(options.endpoint)}/solve`, options).then(\r\n cleanResponse\r\n );\r\n}\r\n\r\nfunction cleanResponse(res: any): ISolveRouteResponse {\r\n if (res.directions && res.directions.length > 0) {\r\n res.directions = res.directions.map(\r\n (direction: {\r\n features: IFeatureWithCompressedGeometry[];\r\n routeId: number;\r\n routeName: string;\r\n summary: {};\r\n }) => {\r\n direction.features = direction.features.map(\r\n (feature: IFeatureWithCompressedGeometry) => {\r\n feature.geometry = decompressGeometry(feature.compressedGeometry);\r\n return feature;\r\n }\r\n );\r\n return direction;\r\n }\r\n );\r\n }\r\n\r\n // add \"geoJson\" property to \"routes\"\r\n if (res.routes.spatialReference.wkid === 4326) {\r\n const features = res.routes.features.map((feature: any) => {\r\n return {\r\n type: \"Feature\",\r\n geometry: arcgisToGeoJSON(feature.geometry),\r\n properties: Object.assign({}, feature.attributes)\r\n };\r\n });\r\n\r\n res.routes.geoJson = {\r\n type: \"FeatureCollection\",\r\n features\r\n };\r\n }\r\n return res;\r\n}\r\n\r\nexport default {\r\n solveRoute\r\n};\r\n"]}
@@ -1,5 +1,5 @@
1
- import { ILocation, IPoint, IFeature, IFeatureSet } from "@esri/arcgis-rest-types";
2
- import { IEndpointOptions } from "./helpers";
1
+ import { ILocation, IPoint, IFeature, IFeatureSet } from "@esri/arcgis-rest-request";
2
+ import { IEndpointOptions } from "./helpers.js";
3
3
  export interface IClosestFacilityOptions extends IEndpointOptions {
4
4
  /**
5
5
  * Specify one or more locations from which the service searches for the nearby locations. These locations are referred to as incidents.
@@ -69,6 +69,7 @@ export interface IClosestFacilityResponse {
69
69
  * @param requestOptions Options to pass through to the routing service.
70
70
  * @returns A Promise that will resolve with routes and directions for the request.
71
71
  * @restlink https://developers.arcgis.com/rest/network/api-reference/closest-facility-synchronous-service.htm
72
+ * @inline IClosestFacilityOptions
72
73
  */
73
74
  export declare function closestFacility(requestOptions: IClosestFacilityOptions): Promise<IClosestFacilityResponse>;
74
75
  declare const _default: {
@@ -1,8 +1,7 @@
1
1
  /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
2
2
  * Apache-2.0 */
3
- import { __assign } from "tslib";
4
- import { request, cleanUrl, appendCustomParams, } from "@esri/arcgis-rest-request";
5
- import { ARCGIS_ONLINE_CLOSEST_FACILITY_URL, normalizeLocationsList, isFeatureSet, } from "./helpers";
3
+ import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
4
+ import { ARCGIS_ONLINE_CLOSEST_FACILITY_URL, normalizeLocationsList, isFeatureSet } from "./helpers.js";
6
5
  import { arcgisToGeoJSON } from "@terraformer/arcgis";
7
6
  function getTravelDirection(key) {
8
7
  if (key === "incidentsToFacilities") {
@@ -35,11 +34,12 @@ function getTravelDirection(key) {
35
34
  * @param requestOptions Options to pass through to the routing service.
36
35
  * @returns A Promise that will resolve with routes and directions for the request.
37
36
  * @restlink https://developers.arcgis.com/rest/network/api-reference/closest-facility-synchronous-service.htm
37
+ * @inline IClosestFacilityOptions
38
38
  */
39
39
  export function closestFacility(requestOptions) {
40
- var endpoint = requestOptions.endpoint || ARCGIS_ONLINE_CLOSEST_FACILITY_URL;
41
- requestOptions.params = __assign({ returnFacilities: true, returnDirections: true, returnIncidents: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true, preserveObjectID: true }, requestOptions.params);
42
- var options = appendCustomParams(requestOptions, [
40
+ const endpoint = requestOptions.endpoint || ARCGIS_ONLINE_CLOSEST_FACILITY_URL;
41
+ requestOptions.params = Object.assign({ returnFacilities: true, returnDirections: true, returnIncidents: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true, preserveObjectID: true }, requestOptions.params);
42
+ const options = appendCustomParams(requestOptions, [
43
43
  "returnCFRoutes",
44
44
  // "travelDirection",
45
45
  "barriers",
@@ -54,7 +54,7 @@ export function closestFacility(requestOptions) {
54
54
  "returnBarriers",
55
55
  "returnPolylineBarriers",
56
56
  "returnPolygonBarriers",
57
- "preserveObjectID",
57
+ "preserveObjectID"
58
58
  ]);
59
59
  // Set travelDirection
60
60
  if (requestOptions.travelDirection) {
@@ -89,7 +89,7 @@ export function closestFacility(requestOptions) {
89
89
  options.params.barriers = normalizeLocationsList(requestOptions.barriers).join(";");
90
90
  }
91
91
  }
92
- return request(cleanUrl(endpoint) + "/solveClosestFacility", options).then(cleanResponse);
92
+ return request(`${cleanUrl(endpoint)}/solveClosestFacility`, options).then(cleanResponse);
93
93
  }
94
94
  function cleanResponse(res) {
95
95
  // add "geoJson" property to "routes"
@@ -99,6 +99,6 @@ function cleanResponse(res) {
99
99
  return res;
100
100
  }
101
101
  export default {
102
- closestFacility: closestFacility,
102
+ closestFacility
103
103
  };
104
104
  //# sourceMappingURL=closestFacility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"closestFacility.js","sourceRoot":"","sources":["../../src/closestFacility.ts"],"names":[],"mappings":"AAAA;gBACgB;;AAEhB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AASnC,OAAO,EACL,kCAAkC,EAElC,sBAAsB,EACtB,YAAY,GACb,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAsEtD,SAAS,kBAAkB,CACzB,GAAsD;IAEtD,IAAI,GAAG,KAAK,uBAAuB,EAAE;QACnC,OAAO,mCAAmC,CAAC;KAC5C;SAAM;QACL,OAAO,iCAAiC,CAAC;KAC1C;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAC7B,cAAuC;IAEvC,IAAM,QAAQ,GACZ,cAAc,CAAC,QAAQ,IAAI,kCAAkC,CAAC;IAEhE,cAAc,CAAC,MAAM,cACnB,gBAAgB,EAAE,IAAI,EACtB,gBAAgB,EAAE,IAAI,EACtB,eAAe,EAAE,IAAI,EACrB,cAAc,EAAE,IAAI,EACpB,sBAAsB,EAAE,IAAI,EAC5B,qBAAqB,EAAE,IAAI,EAC3B,gBAAgB,EAAE,IAAI,IACnB,cAAc,CAAC,MAAM,CACzB,CAAC;IAEF,IAAM,OAAO,GAAG,kBAAkB,CAA0B,cAAc,EAAE;QAC1E,gBAAgB;QAChB,qBAAqB;QACrB,UAAU;QACV,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB;QAClB,sBAAsB;QACtB,uBAAuB;QACvB,aAAa;QACb,kBAAkB;QAClB,iBAAiB;QACjB,gBAAgB;QAChB,wBAAwB;QACxB,uBAAuB;QACvB,kBAAkB;KACnB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YAC3D,0CAA0C;YAC1C,uFAAuF;YACvF,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,sBAAsB,CAC9C,cAAc,CAAC,QAAQ,CACxB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;KACF;IAED,OAAO,OAAO,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC,IAAI,CACxE,aAAa,CACd,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,GAAQ;IAC7B,qCAAqC;IACrC,IAAI,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EAAE;QAC7C,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KAClD;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe;IACb,eAAe;CAChB,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n cleanUrl,\n appendCustomParams,\n ILocation,\n IPoint,\n IFeature,\n IFeatureSet\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_CLOSEST_FACILITY_URL,\n IEndpointOptions,\n normalizeLocationsList,\n isFeatureSet\n} from \"./helpers.js\";\n\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\n\nexport interface IClosestFacilityOptions extends IEndpointOptions {\n /**\n * Specify one or more locations from which the service searches for the nearby locations. These locations are referred to as incidents.\n */\n incidents: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n\n /**\n * Specify one or more locations that are searched for when finding the closest location.\n */\n facilities: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify if the service should return routes.\n */\n returnCFRoutes: boolean;\n travelDirection?: \"incidentsToFacilities\" | \"facilitiesToIncidents\";\n barriers?: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n polylineBarriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n returnDirections?: boolean;\n directionsOutputType?:\n | \"esriDOTComplete\"\n | \"esriDOTCompleteNoEvents\"\n | \"esriDOTInstructionsOnly\"\n | \"esriDOTStandard\"\n | \"esriDOTSummaryOnly\"\n | \"esriDOTFeatureSets\";\n directionsLengthUnits?:\n | \"esriNAUCentimeters\"\n | \"esriNAUDecimalDegrees\"\n | \"esriNAUDecimeters\"\n | \"esriNAUFeet\"\n | \"esriNAUInches\"\n | \"esriNAUKilometers\"\n | \"esriNAUMeters\"\n | \"esriNAUMiles\"\n | \"esriNAUMillimeters\"\n | \"esriNAUNauticalMiles\"\n | \"esriNAUPoints\"\n | \"esriNAUYards\";\n outputLines?: boolean;\n returnFacilities?: boolean;\n returnIncidents?: boolean;\n returnBarriers?: boolean;\n returnPolylineBarriers?: boolean;\n returnPolygonBarriers?: boolean;\n preserveObjectID?: boolean;\n}\n\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\n geoJson?: any;\n}\n\nexport interface IClosestFacilityResponse {\n messages: string[];\n routes?: IFeatureSetWithGeoJson;\n directions?: Array<{\n routeId: number;\n routeName: string;\n summary: object;\n features: IFeature[];\n }>;\n incidents?: IFeatureSet;\n facilities?: IFeatureSet;\n barriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n polylineBarriers?: IFeatureSet;\n}\n\nfunction getTravelDirection(\n key: \"incidentsToFacilities\" | \"facilitiesToIncidents\"\n): \"esriNATravelDirectionFromFacility\" | \"esriNATravelDirectionToFacility\" {\n if (key === \"incidentsToFacilities\") {\n return \"esriNATravelDirectionFromFacility\";\n } else {\n return \"esriNATravelDirectionToFacility\";\n }\n}\n\n/**\n * ```js\n * import { closestFacility } from '@esri/arcgis-rest-routing';\n * //\n * closestFacility({\n * incidents: [\n * [-90.404302, 38.600621],\n * [-90.364293, 38.620427],\n * ],\n * facilities: [\n * [-90.444716, 38.635501],\n * [-90.311919, 38.633523],\n * [-90.451147, 38.581107]\n * ],\n * authentication\n * })\n * .then(response) // => {routes: {features: [{attributes: { ... }, geometry:{ ... }}]}\n * ```\n * Used to find a route to the nearest of several possible destinations. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/closest-facility-synchronous-service.htm) for more information.\n *\n * @param requestOptions Options to pass through to the routing service.\n * @returns A Promise that will resolve with routes and directions for the request.\n * @restlink https://developers.arcgis.com/rest/network/api-reference/closest-facility-synchronous-service.htm\n * @inline IClosestFacilityOptions\n */\nexport function closestFacility(\n requestOptions: IClosestFacilityOptions\n): Promise<IClosestFacilityResponse> {\n const endpoint =\n requestOptions.endpoint || ARCGIS_ONLINE_CLOSEST_FACILITY_URL;\n\n requestOptions.params = {\n returnFacilities: true,\n returnDirections: true,\n returnIncidents: true,\n returnBarriers: true,\n returnPolylineBarriers: true,\n returnPolygonBarriers: true,\n preserveObjectID: true,\n ...requestOptions.params\n };\n\n const options = appendCustomParams<IClosestFacilityOptions>(requestOptions, [\n \"returnCFRoutes\",\n // \"travelDirection\",\n \"barriers\",\n \"polylineBarriers\",\n \"polygonBarriers\",\n \"returnDirections\",\n \"directionsOutputType\",\n \"directionsLengthUnits\",\n \"outputLines\",\n \"returnFacilities\",\n \"returnIncidents\",\n \"returnBarriers\",\n \"returnPolylineBarriers\",\n \"returnPolygonBarriers\",\n \"preserveObjectID\"\n ]);\n\n // Set travelDirection\n if (requestOptions.travelDirection) {\n options.params.travelDirection = getTravelDirection(\n requestOptions.travelDirection\n );\n }\n\n // the SAAS service does not support anonymous requests\n if (\n !requestOptions.authentication &&\n endpoint === ARCGIS_ONLINE_CLOSEST_FACILITY_URL\n ) {\n return Promise.reject(\n \"Finding the closest facility using the ArcGIS service requires authentication\"\n );\n }\n\n if (isFeatureSet(requestOptions.incidents)) {\n options.params.incidents = requestOptions.incidents;\n } else {\n options.params.incidents = normalizeLocationsList(\n requestOptions.incidents\n ).join(\";\");\n }\n\n if (isFeatureSet(requestOptions.facilities)) {\n options.params.facilities = requestOptions.facilities;\n } else {\n options.params.facilities = normalizeLocationsList(\n requestOptions.facilities\n ).join(\";\");\n }\n\n // optional input param that may need point geometry normalizing\n if (requestOptions.barriers) {\n if (isFeatureSet(requestOptions.barriers)) {\n options.params.barriers = requestOptions.barriers;\n } else {\n // optional point geometry barriers must be normalized, too\n // but not if provided as IFeatureSet type\n // note that optional polylineBarriers and polygonBarriers do not need to be normalized\n options.params.barriers = normalizeLocationsList(\n requestOptions.barriers\n ).join(\";\");\n }\n }\n\n return request(`${cleanUrl(endpoint)}/solveClosestFacility`, options).then(\n cleanResponse\n );\n}\n\nfunction cleanResponse(res: any): IClosestFacilityResponse {\n // add \"geoJson\" property to \"routes\"\n if (res.routes.spatialReference.wkid === 4326) {\n res.routes.geoJson = arcgisToGeoJSON(res.routes);\n }\n return res;\n}\n\nexport default {\n closestFacility\n};\n"]}
@@ -1,5 +1,4 @@
1
- import { IRequestOptions } from "@esri/arcgis-rest-request";
2
- import { ILocation, IPoint, IPolyline, IFeatureSet } from "@esri/arcgis-rest-types";
1
+ import { IRequestOptions, ILocation, IPoint, IPolyline, IFeatureSet } from "@esri/arcgis-rest-request";
3
2
  export declare const ARCGIS_ONLINE_ROUTING_URL = "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World";
4
3
  export declare const ARCGIS_ONLINE_CLOSEST_FACILITY_URL = "https://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World";
5
4
  export declare const ARCGIS_ONLINE_SERVICE_AREA_URL = "https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World";
@@ -1,10 +1,10 @@
1
1
  /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
2
2
  * Apache-2.0 */
3
3
  // https always
4
- export var ARCGIS_ONLINE_ROUTING_URL = "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World";
5
- export var ARCGIS_ONLINE_CLOSEST_FACILITY_URL = "https://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World";
6
- export var ARCGIS_ONLINE_SERVICE_AREA_URL = "https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World";
7
- export var ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL = "https://route.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World";
4
+ export const ARCGIS_ONLINE_ROUTING_URL = "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World";
5
+ export const ARCGIS_ONLINE_CLOSEST_FACILITY_URL = "https://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World";
6
+ export const ARCGIS_ONLINE_SERVICE_AREA_URL = "https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World";
7
+ export const ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL = "https://route.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World";
8
8
  function isLocationArray(coords) {
9
9
  return (coords.length === 2 ||
10
10
  coords.length === 3);
@@ -14,7 +14,7 @@ function isLocation(coords) {
14
14
  coords.lat !== undefined);
15
15
  }
16
16
  export function normalizeLocationsList(locations) {
17
- return locations.map(function (coords) {
17
+ return locations.map((coords) => {
18
18
  if (isLocationArray(coords)) {
19
19
  return coords.join();
20
20
  }
@@ -32,16 +32,16 @@ export function normalizeLocationsList(locations) {
32
32
  });
33
33
  }
34
34
  export function decompressGeometry(str) {
35
- var xDiffPrev = 0;
36
- var yDiffPrev = 0;
37
- var points = [];
38
- var x;
39
- var y;
35
+ let xDiffPrev = 0;
36
+ let yDiffPrev = 0;
37
+ const points = [];
38
+ let x;
39
+ let y;
40
40
  // Split the string into an array on the + and - characters
41
- var strings = str.match(/((\+|-)[^+-]+)/g);
41
+ const strings = str.match(/((\+|-)[^+-]+)/g);
42
42
  // The first value is the coefficient in base 32
43
- var coefficient = parseInt(strings[0], 32);
44
- for (var j = 1; j < strings.length; j += 2) {
43
+ const coefficient = parseInt(strings[0], 32);
44
+ for (let j = 1; j < strings.length; j += 2) {
45
45
  // j is the offset for the x value
46
46
  // Convert the value from base 32 and add the previous x value
47
47
  x = parseInt(strings[j], 32) + xDiffPrev;
@@ -53,13 +53,13 @@ export function decompressGeometry(str) {
53
53
  points.push([x / coefficient, y / coefficient]);
54
54
  }
55
55
  return {
56
- paths: [points],
56
+ paths: [points]
57
57
  };
58
58
  }
59
59
  /**
60
60
  * User Defined Type Guard that verifies this is a featureSet
61
61
  */
62
62
  export function isFeatureSet(arg) {
63
- return Object.prototype.hasOwnProperty.call(arg, 'features');
63
+ return Object.prototype.hasOwnProperty.call(arg, "features");
64
64
  }
65
65
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA;gBACgB;AAWhB,eAAe;AACf,MAAM,CAAC,IAAM,yBAAyB,GACpC,gFAAgF,CAAC;AACnF,MAAM,CAAC,IAAM,kCAAkC,GAC7C,oGAAoG,CAAC;AACvG,MAAM,CAAC,IAAM,8BAA8B,GACzC,6FAA6F,CAAC;AAChG,MAAM,CAAC,IAAM,2CAA2C,GACtD,4HAA4H,CAAC;AAU/H,SAAS,eAAe,CACtB,MAAwE;IAExE,OAAO,CACJ,MAA2B,CAAC,MAAM,KAAK,CAAC;QACxC,MAAmC,CAAC,MAAM,KAAK,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,MAAwE;IAExE,OAAO,CACJ,MAAoB,CAAC,QAAQ,KAAK,SAAS;QAC3C,MAAoB,CAAC,GAAG,KAAK,SAAS,CACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,SAAuD;IAEvD,OAAO,SAAS,CAAC,GAAG,CAAC,UAAC,MAAM;QAC1B,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE;YAC3B,OAAO,MAAM,CAAC,IA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MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\r\n * Apache-2.0 */\r\n\r\nimport { \r\n IRequestOptions,\r\n ILocation,\r\n IPoint,\r\n IPolyline,\r\n Position2D,\r\n IFeatureSet\r\n} from \"@esri/arcgis-rest-request\";\r\n\r\n// https always\r\nexport const ARCGIS_ONLINE_ROUTING_URL =\r\n \"https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World\";\r\nexport const ARCGIS_ONLINE_CLOSEST_FACILITY_URL =\r\n \"https://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World\";\r\nexport const ARCGIS_ONLINE_SERVICE_AREA_URL =\r\n \"https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World\";\r\nexport const ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL =\r\n \"https://route.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World\";\r\n\r\n// nice to have: verify custom endpoints contain 'NAServer' and end in a '/'\r\nexport interface IEndpointOptions extends IRequestOptions {\r\n /**\r\n * Any ArcGIS Routing service (example: https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route/ ) to use for the routing service request.\r\n */\r\n endpoint?: string;\r\n}\r\n\r\nfunction isLocationArray(\r\n coords: ILocation | IPoint | [number, number] | [number, number, number]\r\n): coords is [number, number] | [number, number, number] {\r\n return (\r\n (coords as [number, number]).length === 2 ||\r\n (coords as [number, number, number]).length === 3\r\n );\r\n}\r\n\r\nfunction isLocation(\r\n coords: ILocation | IPoint | [number, number] | [number, number, number]\r\n): coords is ILocation {\r\n return (\r\n (coords as ILocation).latitude !== undefined ||\r\n (coords as ILocation).lat !== undefined\r\n );\r\n}\r\n\r\nexport function normalizeLocationsList(\r\n locations: Array<IPoint | ILocation | [number, number]>\r\n): string[] {\r\n return locations.map((coords) => {\r\n if (isLocationArray(coords)) {\r\n return coords.join();\r\n } else if (isLocation(coords)) {\r\n if (coords.lat) {\r\n return coords.long + \",\" + coords.lat;\r\n } else {\r\n return coords.longitude + \",\" + coords.latitude;\r\n }\r\n } else {\r\n return coords.x + \",\" + coords.y;\r\n }\r\n });\r\n}\r\n\r\nexport function decompressGeometry(str: string) {\r\n let xDiffPrev = 0;\r\n let yDiffPrev = 0;\r\n const points = [];\r\n let x;\r\n let y;\r\n\r\n // Split the string into an array on the + and - characters\r\n const strings = str.match(/((\\+|-)[^+-]+)/g);\r\n\r\n // The first value is the coefficient in base 32\r\n const coefficient = parseInt(strings[0], 32);\r\n\r\n for (let j = 1; j < strings.length; j += 2) {\r\n // j is the offset for the x value\r\n // Convert the value from base 32 and add the previous x value\r\n x = parseInt(strings[j], 32) + xDiffPrev;\r\n xDiffPrev = x;\r\n\r\n // j+1 is the offset for the y value\r\n // Convert the value from base 32 and add the previous y value\r\n y = parseInt(strings[j + 1], 32) + yDiffPrev;\r\n yDiffPrev = y;\r\n\r\n points.push([x / coefficient, y / coefficient] as Position2D);\r\n }\r\n\r\n return {\r\n paths: [points]\r\n } as IPolyline;\r\n}\r\n\r\n/**\r\n * User Defined Type Guard that verifies this is a featureSet\r\n */\r\nexport function isFeatureSet(arg: any): arg is IFeatureSet {\r\n return Object.prototype.hasOwnProperty.call(arg, \"features\");\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
- export * from "./solveRoute";
2
- export * from "./closestFacility";
3
- export * from "./serviceArea";
4
- export * from "./originDestinationMatrix";
5
- export * from "./helpers";
6
- export { ILocation, ISpatialReference, IPoint, IFeature, } from "@esri/arcgis-rest-types";
1
+ export * from "./solveRoute.js";
2
+ export * from "./closestFacility.js";
3
+ export * from "./serviceArea.js";
4
+ export * from "./originDestinationMatrix.js";
5
+ export * from "./helpers.js";
6
+ export type { IRequestOptions, ILocation, IPoint, IPolyline, Position2D, IFeatureSet, IFeature } from "@esri/arcgis-rest-request";
package/dist/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
2
2
  * Apache-2.0 */
3
- export * from "./solveRoute";
4
- export * from "./closestFacility";
5
- export * from "./serviceArea";
6
- export * from "./originDestinationMatrix";
7
- export * from "./helpers";
3
+ export * from "./solveRoute.js";
4
+ export * from "./closestFacility.js";
5
+ export * from "./serviceArea.js";
6
+ export * from "./originDestinationMatrix.js";
7
+ export * from "./helpers.js";
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\r\n * Apache-2.0 */\r\n\r\nexport * from \"./solveRoute.js\";\r\nexport * from \"./closestFacility.js\";\r\nexport * from \"./serviceArea.js\";\r\nexport * from \"./originDestinationMatrix.js\";\r\nexport * from \"./helpers.js\";\r\n\r\n// Types that are used in this package are re-exported for convenience and \r\n// to make the links work correctly in the documentation pages.\r\nexport type {\r\n IRequestOptions,\r\n ILocation,\r\n IPoint,\r\n IPolyline,\r\n Position2D,\r\n IFeatureSet,\r\n IFeature\r\n} from \"@esri/arcgis-rest-request\";"]}
@@ -1,5 +1,5 @@
1
- import { ILocation, IPoint, IFeatureSet } from "@esri/arcgis-rest-types";
2
- import { IEndpointOptions } from "./helpers";
1
+ import { ILocation, IPoint, IFeatureSet } from "@esri/arcgis-rest-request";
2
+ import { IEndpointOptions } from "./helpers.js";
3
3
  export interface IOriginDestinationMatrixOptions extends IEndpointOptions {
4
4
  /**
5
5
  * Specify the starting points from which to travel to the destinations.