@aws-amplify/geo 1.2.5-unstable.10 → 1.2.5-unstable.7

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 (39) hide show
  1. package/dist/aws-amplify-geo.js +80 -2104
  2. package/dist/aws-amplify-geo.js.map +1 -1
  3. package/dist/aws-amplify-geo.min.js +6 -6
  4. package/dist/aws-amplify-geo.min.js.map +1 -1
  5. package/lib/Geo.d.ts +3 -36
  6. package/lib/Geo.js +5 -153
  7. package/lib/Geo.js.map +1 -1
  8. package/lib/Providers/AmazonLocationServiceProvider.d.ts +1 -37
  9. package/lib/Providers/AmazonLocationServiceProvider.js +8 -425
  10. package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
  11. package/lib/types/AmazonLocationServiceProvider.d.ts +1 -21
  12. package/lib/types/Geo.d.ts +1 -49
  13. package/lib/types/Provider.d.ts +1 -5
  14. package/lib/types/Provider.js +12 -0
  15. package/lib/types/Provider.js.map +1 -1
  16. package/lib-esm/Geo.d.ts +3 -36
  17. package/lib-esm/Geo.js +5 -153
  18. package/lib-esm/Geo.js.map +1 -1
  19. package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +1 -37
  20. package/lib-esm/Providers/AmazonLocationServiceProvider.js +9 -426
  21. package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
  22. package/lib-esm/types/AmazonLocationServiceProvider.d.ts +1 -21
  23. package/lib-esm/types/Geo.d.ts +1 -49
  24. package/lib-esm/types/Provider.d.ts +1 -5
  25. package/lib-esm/types/Provider.js +12 -0
  26. package/lib-esm/types/Provider.js.map +1 -1
  27. package/package.json +4 -6
  28. package/src/Geo.ts +2 -123
  29. package/src/Providers/AmazonLocationServiceProvider.ts +6 -432
  30. package/src/types/AmazonLocationServiceProvider.ts +1 -56
  31. package/src/types/Geo.ts +2 -74
  32. package/src/types/Provider.ts +1 -31
  33. package/lib/util.d.ts +0 -6
  34. package/lib/util.js +0 -147
  35. package/lib/util.js.map +0 -1
  36. package/lib-esm/util.d.ts +0 -6
  37. package/lib-esm/util.js +0 -137
  38. package/lib-esm/util.js.map +0 -1
  39. package/src/util.ts +0 -180
@@ -24843,1035 +24843,6 @@ function locateWindow() {
24843
24843
  }
24844
24844
 
24845
24845
 
24846
- /***/ }),
24847
-
24848
- /***/ "../../node_modules/@turf/boolean-clockwise/dist/es/index.js":
24849
- /*!******************************************************************************!*\
24850
- !*** /root/amplify-js/node_modules/@turf/boolean-clockwise/dist/es/index.js ***!
24851
- \******************************************************************************/
24852
- /*! exports provided: default */
24853
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
24854
-
24855
- "use strict";
24856
- __webpack_require__.r(__webpack_exports__);
24857
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return booleanClockwise; });
24858
- /* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/invariant */ "../../node_modules/@turf/invariant/dist/es/index.js");
24859
-
24860
- /**
24861
- * Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise.
24862
- *
24863
- * @name booleanClockwise
24864
- * @param {Feature<LineString>|LineString|Array<Array<number>>} line to be evaluated
24865
- * @returns {boolean} true/false
24866
- * @example
24867
- * var clockwiseRing = turf.lineString([[0,0],[1,1],[1,0],[0,0]]);
24868
- * var counterClockwiseRing = turf.lineString([[0,0],[1,0],[1,1],[0,0]]);
24869
- *
24870
- * turf.booleanClockwise(clockwiseRing)
24871
- * //=true
24872
- * turf.booleanClockwise(counterClockwiseRing)
24873
- * //=false
24874
- */
24875
- function booleanClockwise(line) {
24876
- var ring = Object(_turf_invariant__WEBPACK_IMPORTED_MODULE_0__["getCoords"])(line);
24877
- var sum = 0;
24878
- var i = 1;
24879
- var prev;
24880
- var cur;
24881
- while (i < ring.length) {
24882
- prev = cur || ring[0];
24883
- cur = ring[i];
24884
- sum += (cur[0] - prev[0]) * (cur[1] + prev[1]);
24885
- i++;
24886
- }
24887
- return sum > 0;
24888
- }
24889
-
24890
-
24891
- /***/ }),
24892
-
24893
- /***/ "../../node_modules/@turf/helpers/dist/es/index.js":
24894
- /*!********************************************************************!*\
24895
- !*** /root/amplify-js/node_modules/@turf/helpers/dist/es/index.js ***!
24896
- \********************************************************************/
24897
- /*! exports provided: earthRadius, factors, unitsFactors, areaFactors, feature, geometry, point, points, polygon, polygons, lineString, lineStrings, featureCollection, multiLineString, multiPoint, multiPolygon, geometryCollection, round, radiansToLength, lengthToRadians, lengthToDegrees, bearingToAzimuth, radiansToDegrees, degreesToRadians, convertLength, convertArea, isNumber, isObject, validateBBox, validateId */
24898
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
24899
-
24900
- "use strict";
24901
- __webpack_require__.r(__webpack_exports__);
24902
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "earthRadius", function() { return earthRadius; });
24903
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "factors", function() { return factors; });
24904
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unitsFactors", function() { return unitsFactors; });
24905
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "areaFactors", function() { return areaFactors; });
24906
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "feature", function() { return feature; });
24907
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geometry", function() { return geometry; });
24908
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "point", function() { return point; });
24909
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "points", function() { return points; });
24910
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polygon", function() { return polygon; });
24911
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polygons", function() { return polygons; });
24912
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineString", function() { return lineString; });
24913
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineStrings", function() { return lineStrings; });
24914
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "featureCollection", function() { return featureCollection; });
24915
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiLineString", function() { return multiLineString; });
24916
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiPoint", function() { return multiPoint; });
24917
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiPolygon", function() { return multiPolygon; });
24918
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geometryCollection", function() { return geometryCollection; });
24919
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "round", function() { return round; });
24920
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "radiansToLength", function() { return radiansToLength; });
24921
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lengthToRadians", function() { return lengthToRadians; });
24922
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lengthToDegrees", function() { return lengthToDegrees; });
24923
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bearingToAzimuth", function() { return bearingToAzimuth; });
24924
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "radiansToDegrees", function() { return radiansToDegrees; });
24925
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "degreesToRadians", function() { return degreesToRadians; });
24926
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertLength", function() { return convertLength; });
24927
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertArea", function() { return convertArea; });
24928
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return isNumber; });
24929
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return isObject; });
24930
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateBBox", function() { return validateBBox; });
24931
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateId", function() { return validateId; });
24932
- /**
24933
- * @module helpers
24934
- */
24935
- /**
24936
- * Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
24937
- *
24938
- * @memberof helpers
24939
- * @type {number}
24940
- */
24941
- var earthRadius = 6371008.8;
24942
- /**
24943
- * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
24944
- *
24945
- * @memberof helpers
24946
- * @type {Object}
24947
- */
24948
- var factors = {
24949
- centimeters: earthRadius * 100,
24950
- centimetres: earthRadius * 100,
24951
- degrees: earthRadius / 111325,
24952
- feet: earthRadius * 3.28084,
24953
- inches: earthRadius * 39.37,
24954
- kilometers: earthRadius / 1000,
24955
- kilometres: earthRadius / 1000,
24956
- meters: earthRadius,
24957
- metres: earthRadius,
24958
- miles: earthRadius / 1609.344,
24959
- millimeters: earthRadius * 1000,
24960
- millimetres: earthRadius * 1000,
24961
- nauticalmiles: earthRadius / 1852,
24962
- radians: 1,
24963
- yards: earthRadius * 1.0936,
24964
- };
24965
- /**
24966
- * Units of measurement factors based on 1 meter.
24967
- *
24968
- * @memberof helpers
24969
- * @type {Object}
24970
- */
24971
- var unitsFactors = {
24972
- centimeters: 100,
24973
- centimetres: 100,
24974
- degrees: 1 / 111325,
24975
- feet: 3.28084,
24976
- inches: 39.37,
24977
- kilometers: 1 / 1000,
24978
- kilometres: 1 / 1000,
24979
- meters: 1,
24980
- metres: 1,
24981
- miles: 1 / 1609.344,
24982
- millimeters: 1000,
24983
- millimetres: 1000,
24984
- nauticalmiles: 1 / 1852,
24985
- radians: 1 / earthRadius,
24986
- yards: 1.0936133,
24987
- };
24988
- /**
24989
- * Area of measurement factors based on 1 square meter.
24990
- *
24991
- * @memberof helpers
24992
- * @type {Object}
24993
- */
24994
- var areaFactors = {
24995
- acres: 0.000247105,
24996
- centimeters: 10000,
24997
- centimetres: 10000,
24998
- feet: 10.763910417,
24999
- hectares: 0.0001,
25000
- inches: 1550.003100006,
25001
- kilometers: 0.000001,
25002
- kilometres: 0.000001,
25003
- meters: 1,
25004
- metres: 1,
25005
- miles: 3.86e-7,
25006
- millimeters: 1000000,
25007
- millimetres: 1000000,
25008
- yards: 1.195990046,
25009
- };
25010
- /**
25011
- * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
25012
- *
25013
- * @name feature
25014
- * @param {Geometry} geometry input geometry
25015
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25016
- * @param {Object} [options={}] Optional Parameters
25017
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25018
- * @param {string|number} [options.id] Identifier associated with the Feature
25019
- * @returns {Feature} a GeoJSON Feature
25020
- * @example
25021
- * var geometry = {
25022
- * "type": "Point",
25023
- * "coordinates": [110, 50]
25024
- * };
25025
- *
25026
- * var feature = turf.feature(geometry);
25027
- *
25028
- * //=feature
25029
- */
25030
- function feature(geom, properties, options) {
25031
- if (options === void 0) { options = {}; }
25032
- var feat = { type: "Feature" };
25033
- if (options.id === 0 || options.id) {
25034
- feat.id = options.id;
25035
- }
25036
- if (options.bbox) {
25037
- feat.bbox = options.bbox;
25038
- }
25039
- feat.properties = properties || {};
25040
- feat.geometry = geom;
25041
- return feat;
25042
- }
25043
- /**
25044
- * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.
25045
- * For GeometryCollection type use `helpers.geometryCollection`
25046
- *
25047
- * @name geometry
25048
- * @param {string} type Geometry Type
25049
- * @param {Array<any>} coordinates Coordinates
25050
- * @param {Object} [options={}] Optional Parameters
25051
- * @returns {Geometry} a GeoJSON Geometry
25052
- * @example
25053
- * var type = "Point";
25054
- * var coordinates = [110, 50];
25055
- * var geometry = turf.geometry(type, coordinates);
25056
- * // => geometry
25057
- */
25058
- function geometry(type, coordinates, _options) {
25059
- if (_options === void 0) { _options = {}; }
25060
- switch (type) {
25061
- case "Point":
25062
- return point(coordinates).geometry;
25063
- case "LineString":
25064
- return lineString(coordinates).geometry;
25065
- case "Polygon":
25066
- return polygon(coordinates).geometry;
25067
- case "MultiPoint":
25068
- return multiPoint(coordinates).geometry;
25069
- case "MultiLineString":
25070
- return multiLineString(coordinates).geometry;
25071
- case "MultiPolygon":
25072
- return multiPolygon(coordinates).geometry;
25073
- default:
25074
- throw new Error(type + " is invalid");
25075
- }
25076
- }
25077
- /**
25078
- * Creates a {@link Point} {@link Feature} from a Position.
25079
- *
25080
- * @name point
25081
- * @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)
25082
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25083
- * @param {Object} [options={}] Optional Parameters
25084
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25085
- * @param {string|number} [options.id] Identifier associated with the Feature
25086
- * @returns {Feature<Point>} a Point feature
25087
- * @example
25088
- * var point = turf.point([-75.343, 39.984]);
25089
- *
25090
- * //=point
25091
- */
25092
- function point(coordinates, properties, options) {
25093
- if (options === void 0) { options = {}; }
25094
- if (!coordinates) {
25095
- throw new Error("coordinates is required");
25096
- }
25097
- if (!Array.isArray(coordinates)) {
25098
- throw new Error("coordinates must be an Array");
25099
- }
25100
- if (coordinates.length < 2) {
25101
- throw new Error("coordinates must be at least 2 numbers long");
25102
- }
25103
- if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {
25104
- throw new Error("coordinates must contain numbers");
25105
- }
25106
- var geom = {
25107
- type: "Point",
25108
- coordinates: coordinates,
25109
- };
25110
- return feature(geom, properties, options);
25111
- }
25112
- /**
25113
- * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.
25114
- *
25115
- * @name points
25116
- * @param {Array<Array<number>>} coordinates an array of Points
25117
- * @param {Object} [properties={}] Translate these properties to each Feature
25118
- * @param {Object} [options={}] Optional Parameters
25119
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
25120
- * associated with the FeatureCollection
25121
- * @param {string|number} [options.id] Identifier associated with the FeatureCollection
25122
- * @returns {FeatureCollection<Point>} Point Feature
25123
- * @example
25124
- * var points = turf.points([
25125
- * [-75, 39],
25126
- * [-80, 45],
25127
- * [-78, 50]
25128
- * ]);
25129
- *
25130
- * //=points
25131
- */
25132
- function points(coordinates, properties, options) {
25133
- if (options === void 0) { options = {}; }
25134
- return featureCollection(coordinates.map(function (coords) {
25135
- return point(coords, properties);
25136
- }), options);
25137
- }
25138
- /**
25139
- * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.
25140
- *
25141
- * @name polygon
25142
- * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
25143
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25144
- * @param {Object} [options={}] Optional Parameters
25145
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25146
- * @param {string|number} [options.id] Identifier associated with the Feature
25147
- * @returns {Feature<Polygon>} Polygon Feature
25148
- * @example
25149
- * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });
25150
- *
25151
- * //=polygon
25152
- */
25153
- function polygon(coordinates, properties, options) {
25154
- if (options === void 0) { options = {}; }
25155
- for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
25156
- var ring = coordinates_1[_i];
25157
- if (ring.length < 4) {
25158
- throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
25159
- }
25160
- for (var j = 0; j < ring[ring.length - 1].length; j++) {
25161
- // Check if first point of Polygon contains two numbers
25162
- if (ring[ring.length - 1][j] !== ring[0][j]) {
25163
- throw new Error("First and last Position are not equivalent.");
25164
- }
25165
- }
25166
- }
25167
- var geom = {
25168
- type: "Polygon",
25169
- coordinates: coordinates,
25170
- };
25171
- return feature(geom, properties, options);
25172
- }
25173
- /**
25174
- * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.
25175
- *
25176
- * @name polygons
25177
- * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygon coordinates
25178
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25179
- * @param {Object} [options={}] Optional Parameters
25180
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25181
- * @param {string|number} [options.id] Identifier associated with the FeatureCollection
25182
- * @returns {FeatureCollection<Polygon>} Polygon FeatureCollection
25183
- * @example
25184
- * var polygons = turf.polygons([
25185
- * [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],
25186
- * [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],
25187
- * ]);
25188
- *
25189
- * //=polygons
25190
- */
25191
- function polygons(coordinates, properties, options) {
25192
- if (options === void 0) { options = {}; }
25193
- return featureCollection(coordinates.map(function (coords) {
25194
- return polygon(coords, properties);
25195
- }), options);
25196
- }
25197
- /**
25198
- * Creates a {@link LineString} {@link Feature} from an Array of Positions.
25199
- *
25200
- * @name lineString
25201
- * @param {Array<Array<number>>} coordinates an array of Positions
25202
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25203
- * @param {Object} [options={}] Optional Parameters
25204
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25205
- * @param {string|number} [options.id] Identifier associated with the Feature
25206
- * @returns {Feature<LineString>} LineString Feature
25207
- * @example
25208
- * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});
25209
- * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});
25210
- *
25211
- * //=linestring1
25212
- * //=linestring2
25213
- */
25214
- function lineString(coordinates, properties, options) {
25215
- if (options === void 0) { options = {}; }
25216
- if (coordinates.length < 2) {
25217
- throw new Error("coordinates must be an array of two or more positions");
25218
- }
25219
- var geom = {
25220
- type: "LineString",
25221
- coordinates: coordinates,
25222
- };
25223
- return feature(geom, properties, options);
25224
- }
25225
- /**
25226
- * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.
25227
- *
25228
- * @name lineStrings
25229
- * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
25230
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25231
- * @param {Object} [options={}] Optional Parameters
25232
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
25233
- * associated with the FeatureCollection
25234
- * @param {string|number} [options.id] Identifier associated with the FeatureCollection
25235
- * @returns {FeatureCollection<LineString>} LineString FeatureCollection
25236
- * @example
25237
- * var linestrings = turf.lineStrings([
25238
- * [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],
25239
- * [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]
25240
- * ]);
25241
- *
25242
- * //=linestrings
25243
- */
25244
- function lineStrings(coordinates, properties, options) {
25245
- if (options === void 0) { options = {}; }
25246
- return featureCollection(coordinates.map(function (coords) {
25247
- return lineString(coords, properties);
25248
- }), options);
25249
- }
25250
- /**
25251
- * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
25252
- *
25253
- * @name featureCollection
25254
- * @param {Feature[]} features input features
25255
- * @param {Object} [options={}] Optional Parameters
25256
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25257
- * @param {string|number} [options.id] Identifier associated with the Feature
25258
- * @returns {FeatureCollection} FeatureCollection of Features
25259
- * @example
25260
- * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});
25261
- * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});
25262
- * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});
25263
- *
25264
- * var collection = turf.featureCollection([
25265
- * locationA,
25266
- * locationB,
25267
- * locationC
25268
- * ]);
25269
- *
25270
- * //=collection
25271
- */
25272
- function featureCollection(features, options) {
25273
- if (options === void 0) { options = {}; }
25274
- var fc = { type: "FeatureCollection" };
25275
- if (options.id) {
25276
- fc.id = options.id;
25277
- }
25278
- if (options.bbox) {
25279
- fc.bbox = options.bbox;
25280
- }
25281
- fc.features = features;
25282
- return fc;
25283
- }
25284
- /**
25285
- * Creates a {@link Feature<MultiLineString>} based on a
25286
- * coordinate array. Properties can be added optionally.
25287
- *
25288
- * @name multiLineString
25289
- * @param {Array<Array<Array<number>>>} coordinates an array of LineStrings
25290
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25291
- * @param {Object} [options={}] Optional Parameters
25292
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25293
- * @param {string|number} [options.id] Identifier associated with the Feature
25294
- * @returns {Feature<MultiLineString>} a MultiLineString feature
25295
- * @throws {Error} if no coordinates are passed
25296
- * @example
25297
- * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
25298
- *
25299
- * //=multiLine
25300
- */
25301
- function multiLineString(coordinates, properties, options) {
25302
- if (options === void 0) { options = {}; }
25303
- var geom = {
25304
- type: "MultiLineString",
25305
- coordinates: coordinates,
25306
- };
25307
- return feature(geom, properties, options);
25308
- }
25309
- /**
25310
- * Creates a {@link Feature<MultiPoint>} based on a
25311
- * coordinate array. Properties can be added optionally.
25312
- *
25313
- * @name multiPoint
25314
- * @param {Array<Array<number>>} coordinates an array of Positions
25315
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25316
- * @param {Object} [options={}] Optional Parameters
25317
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25318
- * @param {string|number} [options.id] Identifier associated with the Feature
25319
- * @returns {Feature<MultiPoint>} a MultiPoint feature
25320
- * @throws {Error} if no coordinates are passed
25321
- * @example
25322
- * var multiPt = turf.multiPoint([[0,0],[10,10]]);
25323
- *
25324
- * //=multiPt
25325
- */
25326
- function multiPoint(coordinates, properties, options) {
25327
- if (options === void 0) { options = {}; }
25328
- var geom = {
25329
- type: "MultiPoint",
25330
- coordinates: coordinates,
25331
- };
25332
- return feature(geom, properties, options);
25333
- }
25334
- /**
25335
- * Creates a {@link Feature<MultiPolygon>} based on a
25336
- * coordinate array. Properties can be added optionally.
25337
- *
25338
- * @name multiPolygon
25339
- * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons
25340
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25341
- * @param {Object} [options={}] Optional Parameters
25342
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25343
- * @param {string|number} [options.id] Identifier associated with the Feature
25344
- * @returns {Feature<MultiPolygon>} a multipolygon feature
25345
- * @throws {Error} if no coordinates are passed
25346
- * @example
25347
- * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);
25348
- *
25349
- * //=multiPoly
25350
- *
25351
- */
25352
- function multiPolygon(coordinates, properties, options) {
25353
- if (options === void 0) { options = {}; }
25354
- var geom = {
25355
- type: "MultiPolygon",
25356
- coordinates: coordinates,
25357
- };
25358
- return feature(geom, properties, options);
25359
- }
25360
- /**
25361
- * Creates a {@link Feature<GeometryCollection>} based on a
25362
- * coordinate array. Properties can be added optionally.
25363
- *
25364
- * @name geometryCollection
25365
- * @param {Array<Geometry>} geometries an array of GeoJSON Geometries
25366
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
25367
- * @param {Object} [options={}] Optional Parameters
25368
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
25369
- * @param {string|number} [options.id] Identifier associated with the Feature
25370
- * @returns {Feature<GeometryCollection>} a GeoJSON GeometryCollection Feature
25371
- * @example
25372
- * var pt = turf.geometry("Point", [100, 0]);
25373
- * var line = turf.geometry("LineString", [[101, 0], [102, 1]]);
25374
- * var collection = turf.geometryCollection([pt, line]);
25375
- *
25376
- * // => collection
25377
- */
25378
- function geometryCollection(geometries, properties, options) {
25379
- if (options === void 0) { options = {}; }
25380
- var geom = {
25381
- type: "GeometryCollection",
25382
- geometries: geometries,
25383
- };
25384
- return feature(geom, properties, options);
25385
- }
25386
- /**
25387
- * Round number to precision
25388
- *
25389
- * @param {number} num Number
25390
- * @param {number} [precision=0] Precision
25391
- * @returns {number} rounded number
25392
- * @example
25393
- * turf.round(120.4321)
25394
- * //=120
25395
- *
25396
- * turf.round(120.4321, 2)
25397
- * //=120.43
25398
- */
25399
- function round(num, precision) {
25400
- if (precision === void 0) { precision = 0; }
25401
- if (precision && !(precision >= 0)) {
25402
- throw new Error("precision must be a positive number");
25403
- }
25404
- var multiplier = Math.pow(10, precision || 0);
25405
- return Math.round(num * multiplier) / multiplier;
25406
- }
25407
- /**
25408
- * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.
25409
- * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
25410
- *
25411
- * @name radiansToLength
25412
- * @param {number} radians in radians across the sphere
25413
- * @param {string} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
25414
- * meters, kilometres, kilometers.
25415
- * @returns {number} distance
25416
- */
25417
- function radiansToLength(radians, units) {
25418
- if (units === void 0) { units = "kilometers"; }
25419
- var factor = factors[units];
25420
- if (!factor) {
25421
- throw new Error(units + " units is invalid");
25422
- }
25423
- return radians * factor;
25424
- }
25425
- /**
25426
- * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians
25427
- * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
25428
- *
25429
- * @name lengthToRadians
25430
- * @param {number} distance in real units
25431
- * @param {string} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
25432
- * meters, kilometres, kilometers.
25433
- * @returns {number} radians
25434
- */
25435
- function lengthToRadians(distance, units) {
25436
- if (units === void 0) { units = "kilometers"; }
25437
- var factor = factors[units];
25438
- if (!factor) {
25439
- throw new Error(units + " units is invalid");
25440
- }
25441
- return distance / factor;
25442
- }
25443
- /**
25444
- * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees
25445
- * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet
25446
- *
25447
- * @name lengthToDegrees
25448
- * @param {number} distance in real units
25449
- * @param {string} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
25450
- * meters, kilometres, kilometers.
25451
- * @returns {number} degrees
25452
- */
25453
- function lengthToDegrees(distance, units) {
25454
- return radiansToDegrees(lengthToRadians(distance, units));
25455
- }
25456
- /**
25457
- * Converts any bearing angle from the north line direction (positive clockwise)
25458
- * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line
25459
- *
25460
- * @name bearingToAzimuth
25461
- * @param {number} bearing angle, between -180 and +180 degrees
25462
- * @returns {number} angle between 0 and 360 degrees
25463
- */
25464
- function bearingToAzimuth(bearing) {
25465
- var angle = bearing % 360;
25466
- if (angle < 0) {
25467
- angle += 360;
25468
- }
25469
- return angle;
25470
- }
25471
- /**
25472
- * Converts an angle in radians to degrees
25473
- *
25474
- * @name radiansToDegrees
25475
- * @param {number} radians angle in radians
25476
- * @returns {number} degrees between 0 and 360 degrees
25477
- */
25478
- function radiansToDegrees(radians) {
25479
- var degrees = radians % (2 * Math.PI);
25480
- return (degrees * 180) / Math.PI;
25481
- }
25482
- /**
25483
- * Converts an angle in degrees to radians
25484
- *
25485
- * @name degreesToRadians
25486
- * @param {number} degrees angle between 0 and 360 degrees
25487
- * @returns {number} angle in radians
25488
- */
25489
- function degreesToRadians(degrees) {
25490
- var radians = degrees % 360;
25491
- return (radians * Math.PI) / 180;
25492
- }
25493
- /**
25494
- * Converts a length to the requested unit.
25495
- * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
25496
- *
25497
- * @param {number} length to be converted
25498
- * @param {Units} [originalUnit="kilometers"] of the length
25499
- * @param {Units} [finalUnit="kilometers"] returned unit
25500
- * @returns {number} the converted length
25501
- */
25502
- function convertLength(length, originalUnit, finalUnit) {
25503
- if (originalUnit === void 0) { originalUnit = "kilometers"; }
25504
- if (finalUnit === void 0) { finalUnit = "kilometers"; }
25505
- if (!(length >= 0)) {
25506
- throw new Error("length must be a positive number");
25507
- }
25508
- return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
25509
- }
25510
- /**
25511
- * Converts a area to the requested unit.
25512
- * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares
25513
- * @param {number} area to be converted
25514
- * @param {Units} [originalUnit="meters"] of the distance
25515
- * @param {Units} [finalUnit="kilometers"] returned unit
25516
- * @returns {number} the converted area
25517
- */
25518
- function convertArea(area, originalUnit, finalUnit) {
25519
- if (originalUnit === void 0) { originalUnit = "meters"; }
25520
- if (finalUnit === void 0) { finalUnit = "kilometers"; }
25521
- if (!(area >= 0)) {
25522
- throw new Error("area must be a positive number");
25523
- }
25524
- var startFactor = areaFactors[originalUnit];
25525
- if (!startFactor) {
25526
- throw new Error("invalid original units");
25527
- }
25528
- var finalFactor = areaFactors[finalUnit];
25529
- if (!finalFactor) {
25530
- throw new Error("invalid final units");
25531
- }
25532
- return (area / startFactor) * finalFactor;
25533
- }
25534
- /**
25535
- * isNumber
25536
- *
25537
- * @param {*} num Number to validate
25538
- * @returns {boolean} true/false
25539
- * @example
25540
- * turf.isNumber(123)
25541
- * //=true
25542
- * turf.isNumber('foo')
25543
- * //=false
25544
- */
25545
- function isNumber(num) {
25546
- return !isNaN(num) && num !== null && !Array.isArray(num);
25547
- }
25548
- /**
25549
- * isObject
25550
- *
25551
- * @param {*} input variable to validate
25552
- * @returns {boolean} true/false
25553
- * @example
25554
- * turf.isObject({elevation: 10})
25555
- * //=true
25556
- * turf.isObject('foo')
25557
- * //=false
25558
- */
25559
- function isObject(input) {
25560
- return !!input && input.constructor === Object;
25561
- }
25562
- /**
25563
- * Validate BBox
25564
- *
25565
- * @private
25566
- * @param {Array<number>} bbox BBox to validate
25567
- * @returns {void}
25568
- * @throws Error if BBox is not valid
25569
- * @example
25570
- * validateBBox([-180, -40, 110, 50])
25571
- * //=OK
25572
- * validateBBox([-180, -40])
25573
- * //=Error
25574
- * validateBBox('Foo')
25575
- * //=Error
25576
- * validateBBox(5)
25577
- * //=Error
25578
- * validateBBox(null)
25579
- * //=Error
25580
- * validateBBox(undefined)
25581
- * //=Error
25582
- */
25583
- function validateBBox(bbox) {
25584
- if (!bbox) {
25585
- throw new Error("bbox is required");
25586
- }
25587
- if (!Array.isArray(bbox)) {
25588
- throw new Error("bbox must be an Array");
25589
- }
25590
- if (bbox.length !== 4 && bbox.length !== 6) {
25591
- throw new Error("bbox must be an Array of 4 or 6 numbers");
25592
- }
25593
- bbox.forEach(function (num) {
25594
- if (!isNumber(num)) {
25595
- throw new Error("bbox must only contain numbers");
25596
- }
25597
- });
25598
- }
25599
- /**
25600
- * Validate Id
25601
- *
25602
- * @private
25603
- * @param {string|number} id Id to validate
25604
- * @returns {void}
25605
- * @throws Error if Id is not valid
25606
- * @example
25607
- * validateId([-180, -40, 110, 50])
25608
- * //=Error
25609
- * validateId([-180, -40])
25610
- * //=Error
25611
- * validateId('Foo')
25612
- * //=OK
25613
- * validateId(5)
25614
- * //=OK
25615
- * validateId(null)
25616
- * //=Error
25617
- * validateId(undefined)
25618
- * //=Error
25619
- */
25620
- function validateId(id) {
25621
- if (!id) {
25622
- throw new Error("id is required");
25623
- }
25624
- if (["string", "number"].indexOf(typeof id) === -1) {
25625
- throw new Error("id must be a number or a string");
25626
- }
25627
- }
25628
-
25629
-
25630
- /***/ }),
25631
-
25632
- /***/ "../../node_modules/@turf/invariant/dist/es/index.js":
25633
- /*!**********************************************************************!*\
25634
- !*** /root/amplify-js/node_modules/@turf/invariant/dist/es/index.js ***!
25635
- \**********************************************************************/
25636
- /*! exports provided: getCoord, getCoords, containsNumber, geojsonType, featureOf, collectionOf, getGeom, getType */
25637
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
25638
-
25639
- "use strict";
25640
- __webpack_require__.r(__webpack_exports__);
25641
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCoord", function() { return getCoord; });
25642
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCoords", function() { return getCoords; });
25643
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "containsNumber", function() { return containsNumber; });
25644
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "geojsonType", function() { return geojsonType; });
25645
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "featureOf", function() { return featureOf; });
25646
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "collectionOf", function() { return collectionOf; });
25647
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGeom", function() { return getGeom; });
25648
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getType", function() { return getType; });
25649
- /* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ "../../node_modules/@turf/helpers/dist/es/index.js");
25650
-
25651
- /**
25652
- * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.
25653
- *
25654
- * @name getCoord
25655
- * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers
25656
- * @returns {Array<number>} coordinates
25657
- * @example
25658
- * var pt = turf.point([10, 10]);
25659
- *
25660
- * var coord = turf.getCoord(pt);
25661
- * //= [10, 10]
25662
- */
25663
- function getCoord(coord) {
25664
- if (!coord) {
25665
- throw new Error("coord is required");
25666
- }
25667
- if (!Array.isArray(coord)) {
25668
- if (coord.type === "Feature" &&
25669
- coord.geometry !== null &&
25670
- coord.geometry.type === "Point") {
25671
- return coord.geometry.coordinates;
25672
- }
25673
- if (coord.type === "Point") {
25674
- return coord.coordinates;
25675
- }
25676
- }
25677
- if (Array.isArray(coord) &&
25678
- coord.length >= 2 &&
25679
- !Array.isArray(coord[0]) &&
25680
- !Array.isArray(coord[1])) {
25681
- return coord;
25682
- }
25683
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
25684
- }
25685
- /**
25686
- * Unwrap coordinates from a Feature, Geometry Object or an Array
25687
- *
25688
- * @name getCoords
25689
- * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array
25690
- * @returns {Array<any>} coordinates
25691
- * @example
25692
- * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);
25693
- *
25694
- * var coords = turf.getCoords(poly);
25695
- * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]
25696
- */
25697
- function getCoords(coords) {
25698
- if (Array.isArray(coords)) {
25699
- return coords;
25700
- }
25701
- // Feature
25702
- if (coords.type === "Feature") {
25703
- if (coords.geometry !== null) {
25704
- return coords.geometry.coordinates;
25705
- }
25706
- }
25707
- else {
25708
- // Geometry
25709
- if (coords.coordinates) {
25710
- return coords.coordinates;
25711
- }
25712
- }
25713
- throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
25714
- }
25715
- /**
25716
- * Checks if coordinates contains a number
25717
- *
25718
- * @name containsNumber
25719
- * @param {Array<any>} coordinates GeoJSON Coordinates
25720
- * @returns {boolean} true if Array contains a number
25721
- */
25722
- function containsNumber(coordinates) {
25723
- if (coordinates.length > 1 &&
25724
- Object(_turf_helpers__WEBPACK_IMPORTED_MODULE_0__["isNumber"])(coordinates[0]) &&
25725
- Object(_turf_helpers__WEBPACK_IMPORTED_MODULE_0__["isNumber"])(coordinates[1])) {
25726
- return true;
25727
- }
25728
- if (Array.isArray(coordinates[0]) && coordinates[0].length) {
25729
- return containsNumber(coordinates[0]);
25730
- }
25731
- throw new Error("coordinates must only contain numbers");
25732
- }
25733
- /**
25734
- * Enforce expectations about types of GeoJSON objects for Turf.
25735
- *
25736
- * @name geojsonType
25737
- * @param {GeoJSON} value any GeoJSON object
25738
- * @param {string} type expected GeoJSON type
25739
- * @param {string} name name of calling function
25740
- * @throws {Error} if value is not the expected type.
25741
- */
25742
- function geojsonType(value, type, name) {
25743
- if (!type || !name) {
25744
- throw new Error("type and name required");
25745
- }
25746
- if (!value || value.type !== type) {
25747
- throw new Error("Invalid input to " +
25748
- name +
25749
- ": must be a " +
25750
- type +
25751
- ", given " +
25752
- value.type);
25753
- }
25754
- }
25755
- /**
25756
- * Enforce expectations about types of {@link Feature} inputs for Turf.
25757
- * Internally this uses {@link geojsonType} to judge geometry types.
25758
- *
25759
- * @name featureOf
25760
- * @param {Feature} feature a feature with an expected geometry type
25761
- * @param {string} type expected GeoJSON type
25762
- * @param {string} name name of calling function
25763
- * @throws {Error} error if value is not the expected type.
25764
- */
25765
- function featureOf(feature, type, name) {
25766
- if (!feature) {
25767
- throw new Error("No feature passed");
25768
- }
25769
- if (!name) {
25770
- throw new Error(".featureOf() requires a name");
25771
- }
25772
- if (!feature || feature.type !== "Feature" || !feature.geometry) {
25773
- throw new Error("Invalid input to " + name + ", Feature with geometry required");
25774
- }
25775
- if (!feature.geometry || feature.geometry.type !== type) {
25776
- throw new Error("Invalid input to " +
25777
- name +
25778
- ": must be a " +
25779
- type +
25780
- ", given " +
25781
- feature.geometry.type);
25782
- }
25783
- }
25784
- /**
25785
- * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.
25786
- * Internally this uses {@link geojsonType} to judge geometry types.
25787
- *
25788
- * @name collectionOf
25789
- * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged
25790
- * @param {string} type expected GeoJSON type
25791
- * @param {string} name name of calling function
25792
- * @throws {Error} if value is not the expected type.
25793
- */
25794
- function collectionOf(featureCollection, type, name) {
25795
- if (!featureCollection) {
25796
- throw new Error("No featureCollection passed");
25797
- }
25798
- if (!name) {
25799
- throw new Error(".collectionOf() requires a name");
25800
- }
25801
- if (!featureCollection || featureCollection.type !== "FeatureCollection") {
25802
- throw new Error("Invalid input to " + name + ", FeatureCollection required");
25803
- }
25804
- for (var _i = 0, _a = featureCollection.features; _i < _a.length; _i++) {
25805
- var feature = _a[_i];
25806
- if (!feature || feature.type !== "Feature" || !feature.geometry) {
25807
- throw new Error("Invalid input to " + name + ", Feature with geometry required");
25808
- }
25809
- if (!feature.geometry || feature.geometry.type !== type) {
25810
- throw new Error("Invalid input to " +
25811
- name +
25812
- ": must be a " +
25813
- type +
25814
- ", given " +
25815
- feature.geometry.type);
25816
- }
25817
- }
25818
- }
25819
- /**
25820
- * Get Geometry from Feature or Geometry Object
25821
- *
25822
- * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object
25823
- * @returns {Geometry|null} GeoJSON Geometry Object
25824
- * @throws {Error} if geojson is not a Feature or Geometry Object
25825
- * @example
25826
- * var point = {
25827
- * "type": "Feature",
25828
- * "properties": {},
25829
- * "geometry": {
25830
- * "type": "Point",
25831
- * "coordinates": [110, 40]
25832
- * }
25833
- * }
25834
- * var geom = turf.getGeom(point)
25835
- * //={"type": "Point", "coordinates": [110, 40]}
25836
- */
25837
- function getGeom(geojson) {
25838
- if (geojson.type === "Feature") {
25839
- return geojson.geometry;
25840
- }
25841
- return geojson;
25842
- }
25843
- /**
25844
- * Get GeoJSON object's type, Geometry type is prioritize.
25845
- *
25846
- * @param {GeoJSON} geojson GeoJSON object
25847
- * @param {string} [name="geojson"] name of the variable to display in error message (unused)
25848
- * @returns {string} GeoJSON type
25849
- * @example
25850
- * var point = {
25851
- * "type": "Feature",
25852
- * "properties": {},
25853
- * "geometry": {
25854
- * "type": "Point",
25855
- * "coordinates": [110, 40]
25856
- * }
25857
- * }
25858
- * var geom = turf.getType(point)
25859
- * //="Point"
25860
- */
25861
- function getType(geojson, _name) {
25862
- if (geojson.type === "FeatureCollection") {
25863
- return "FeatureCollection";
25864
- }
25865
- if (geojson.type === "GeometryCollection") {
25866
- return "GeometryCollection";
25867
- }
25868
- if (geojson.type === "Feature" && geojson.geometry !== null) {
25869
- return geojson.geometry.type;
25870
- }
25871
- return geojson.type;
25872
- }
25873
-
25874
-
25875
24846
  /***/ }),
25876
24847
 
25877
24848
  /***/ "../../node_modules/base64-js/index.js":
@@ -28585,7 +27556,6 @@ __webpack_require__.r(__webpack_exports__);
28585
27556
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
28586
27557
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
28587
27558
  /* harmony import */ var _Providers_AmazonLocationServiceProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Providers/AmazonLocationServiceProvider */ "./lib-esm/Providers/AmazonLocationServiceProvider.js");
28588
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ "./lib-esm/util.js");
28589
27559
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
28590
27560
  function adopt(value) {
28591
27561
  return value instanceof P ? value : new P(function (resolve) {
@@ -28728,33 +27698,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
28728
27698
  };
28729
27699
  }
28730
27700
  };
28731
-
28732
- var __read = undefined && undefined.__read || function (o, n) {
28733
- var m = typeof Symbol === "function" && o[Symbol.iterator];
28734
- if (!m) return o;
28735
- var i = m.call(o),
28736
- r,
28737
- ar = [],
28738
- e;
28739
-
28740
- try {
28741
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
28742
- ar.push(r.value);
28743
- }
28744
- } catch (error) {
28745
- e = {
28746
- error: error
28747
- };
28748
- } finally {
28749
- try {
28750
- if (r && !r.done && (m = i["return"])) m.call(i);
28751
- } finally {
28752
- if (e) throw e.error;
28753
- }
28754
- }
28755
-
28756
- return ar;
28757
- };
28758
27701
  /*
28759
27702
  * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
28760
27703
  *
@@ -28771,7 +27714,6 @@ var __read = undefined && undefined.__read || function (o, n) {
28771
27714
 
28772
27715
 
28773
27716
 
28774
-
28775
27717
  var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Geo');
28776
27718
  var DEFAULT_PROVIDER = 'AmazonLocationService';
28777
27719
 
@@ -28873,221 +27815,33 @@ function () {
28873
27815
 
28874
27816
  var prov = this.getPluggable(provider);
28875
27817
  return prov.getAvailableMaps();
28876
- };
28877
- /**
28878
- * Get the map resource set as default in amplify config
28879
- * @param {string} provider
28880
- * @returns - Map resource set as the default in amplify config
28881
- */
28882
-
28883
-
28884
- GeoClass.prototype.getDefaultMap = function (provider) {
28885
- if (provider === void 0) {
28886
- provider = DEFAULT_PROVIDER;
28887
- }
28888
-
28889
- var prov = this.getPluggable(provider);
28890
- return prov.getDefaultMap();
28891
- };
28892
- /**
28893
- * Search by text input with optional parameters
28894
- * @param {string} text - The text string that is to be searched for
28895
- * @param {SearchByTextOptions} options? - Optional parameters to the search
28896
- * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
28897
- */
28898
-
28899
-
28900
- GeoClass.prototype.searchByText = function (text, options) {
28901
- return __awaiter(this, void 0, void 0, function () {
28902
- var _a, providerName, prov, error_1;
28903
-
28904
- return __generator(this, function (_b) {
28905
- switch (_b.label) {
28906
- case 0:
28907
- _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
28908
- prov = this.getPluggable(providerName);
28909
- _b.label = 1;
28910
-
28911
- case 1:
28912
- _b.trys.push([1, 3,, 4]);
28913
-
28914
- return [4
28915
- /*yield*/
28916
- , prov.searchByText(text, options)];
28917
-
28918
- case 2:
28919
- return [2
28920
- /*return*/
28921
- , _b.sent()];
28922
-
28923
- case 3:
28924
- error_1 = _b.sent();
28925
- logger.debug(error_1);
28926
- throw error_1;
28927
-
28928
- case 4:
28929
- return [2
28930
- /*return*/
28931
- ];
28932
- }
28933
- });
28934
- });
28935
- };
28936
- /**
28937
- * Reverse geocoding search via a coordinate point on the map
28938
- * @param coordinates - Coordinates array for the search input
28939
- * @param options - Options parameters for the search
28940
- * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
28941
- */
28942
-
28943
-
28944
- GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
28945
- return __awaiter(this, void 0, void 0, function () {
28946
- var _a, providerName, prov, _b, lng, lat, error_2;
28947
-
28948
- return __generator(this, function (_c) {
28949
- switch (_c.label) {
28950
- case 0:
28951
- _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
28952
- prov = this.getPluggable(providerName);
28953
- _b = __read(coordinates, 2), lng = _b[0], lat = _b[1];
28954
- _c.label = 1;
28955
-
28956
- case 1:
28957
- _c.trys.push([1, 3,, 4]);
28958
-
28959
- Object(_util__WEBPACK_IMPORTED_MODULE_2__["validateCoordinates"])(lng, lat);
28960
- return [4
28961
- /*yield*/
28962
- , prov.searchByCoordinates(coordinates, options)];
28963
-
28964
- case 2:
28965
- return [2
28966
- /*return*/
28967
- , _c.sent()];
28968
-
28969
- case 3:
28970
- error_2 = _c.sent();
28971
- logger.debug(error_2);
28972
- throw error_2;
28973
-
28974
- case 4:
28975
- return [2
28976
- /*return*/
28977
- ];
28978
- }
28979
- });
28980
- });
28981
- };
28982
- /**
28983
- * Create geofences
28984
- * @param geofences - Single or array of geofence objects to create
28985
- * @param options? - Optional parameters for creating geofences
28986
- * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
28987
- * successes: list of geofences successfully created
28988
- * errors: list of geofences that failed to create
28989
- */
28990
-
28991
-
28992
- GeoClass.prototype.saveGeofences = function (geofences, options) {
28993
- return __awaiter(this, void 0, void 0, function () {
28994
- var _a, providerName, prov, geofenceInputArray, error_3;
28995
-
28996
- return __generator(this, function (_b) {
28997
- switch (_b.label) {
28998
- case 0:
28999
- _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
29000
- prov = this.getPluggable(providerName);
29001
-
29002
- if (!Array.isArray(geofences)) {
29003
- geofenceInputArray = [geofences];
29004
- } else {
29005
- geofenceInputArray = geofences;
29006
- }
29007
-
29008
- _b.label = 1;
29009
-
29010
- case 1:
29011
- _b.trys.push([1, 3,, 4]);
29012
-
29013
- return [4
29014
- /*yield*/
29015
- , prov.saveGeofences(geofenceInputArray, options)];
29016
-
29017
- case 2:
29018
- return [2
29019
- /*return*/
29020
- , _b.sent()];
29021
-
29022
- case 3:
29023
- error_3 = _b.sent();
29024
- logger.debug(error_3);
29025
- throw error_3;
29026
-
29027
- case 4:
29028
- return [2
29029
- /*return*/
29030
- ];
29031
- }
29032
- });
29033
- });
29034
- };
29035
- /**
29036
- * Get a single geofence by geofenceId
29037
- * @param geofenceId: GeofenceId - The string id of the geofence to get
29038
- * @param options?: GeofenceOptions - Optional parameters for getting a geofence
29039
- * @returns Promise<Geofence> - Promise that resolves to a geofence object
29040
- */
29041
-
29042
-
29043
- GeoClass.prototype.getGeofence = function (geofenceId, options) {
29044
- return __awaiter(this, void 0, void 0, function () {
29045
- var _a, providerName, prov, error_4;
29046
-
29047
- return __generator(this, function (_b) {
29048
- switch (_b.label) {
29049
- case 0:
29050
- _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
29051
- prov = this.getPluggable(providerName);
29052
- _b.label = 1;
29053
-
29054
- case 1:
29055
- _b.trys.push([1, 3,, 4]);
29056
-
29057
- return [4
29058
- /*yield*/
29059
- , prov.getGeofence(geofenceId, options)];
27818
+ };
27819
+ /**
27820
+ * Get the map resource set as default in amplify config
27821
+ * @param {string} provider
27822
+ * @returns - Map resource set as the default in amplify config
27823
+ */
29060
27824
 
29061
- case 2:
29062
- return [2
29063
- /*return*/
29064
- , _b.sent()];
29065
27825
 
29066
- case 3:
29067
- error_4 = _b.sent();
29068
- logger.debug(error_4);
29069
- throw error_4;
27826
+ GeoClass.prototype.getDefaultMap = function (provider) {
27827
+ if (provider === void 0) {
27828
+ provider = DEFAULT_PROVIDER;
27829
+ }
29070
27830
 
29071
- case 4:
29072
- return [2
29073
- /*return*/
29074
- ];
29075
- }
29076
- });
29077
- });
27831
+ var prov = this.getPluggable(provider);
27832
+ return prov.getDefaultMap();
29078
27833
  };
29079
27834
  /**
29080
- * List geofences
29081
- * @param options?: ListGeofenceOptions
29082
- * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
29083
- * entries: list of geofences - 100 geofences are listed per page
29084
- * nextToken: token for next page of geofences
27835
+ * Search by text input with optional parameters
27836
+ * @param {string} text - The text string that is to be searched for
27837
+ * @param {SearchByTextOptions} options? - Optional parameters to the search
27838
+ * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
29085
27839
  */
29086
27840
 
29087
27841
 
29088
- GeoClass.prototype.listGeofences = function (options) {
27842
+ GeoClass.prototype.searchByText = function (text, options) {
29089
27843
  return __awaiter(this, void 0, void 0, function () {
29090
- var _a, providerName, prov, error_5;
27844
+ var _a, providerName, prov, error_1;
29091
27845
 
29092
27846
  return __generator(this, function (_b) {
29093
27847
  switch (_b.label) {
@@ -29101,7 +27855,7 @@ function () {
29101
27855
 
29102
27856
  return [4
29103
27857
  /*yield*/
29104
- , prov.listGeofences(options)];
27858
+ , prov.searchByText(text, options)];
29105
27859
 
29106
27860
  case 2:
29107
27861
  return [2
@@ -29109,9 +27863,9 @@ function () {
29109
27863
  , _b.sent()];
29110
27864
 
29111
27865
  case 3:
29112
- error_5 = _b.sent();
29113
- logger.debug(error_5);
29114
- throw error_5;
27866
+ error_1 = _b.sent();
27867
+ logger.debug(error_1);
27868
+ throw error_1;
29115
27869
 
29116
27870
  case 4:
29117
27871
  return [2
@@ -29122,31 +27876,22 @@ function () {
29122
27876
  });
29123
27877
  };
29124
27878
  /**
29125
- * Delete geofences
29126
- * @param geofenceIds: string|string[]
29127
- * @param options?: GeofenceOptions
29128
- * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
29129
- * successes: list of geofences successfully deleted
29130
- * errors: list of geofences that failed to delete
27879
+ * Reverse geocoding search via a coordinate point on the map
27880
+ * @param coordinates - Coordinates array for the search input
27881
+ * @param options - Options parameters for the search
27882
+ * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
29131
27883
  */
29132
27884
 
29133
27885
 
29134
- GeoClass.prototype.deleteGeofences = function (geofenceIds, options) {
27886
+ GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
29135
27887
  return __awaiter(this, void 0, void 0, function () {
29136
- var _a, providerName, prov, geofenceIdsInputArray, error_6;
27888
+ var _a, providerName, prov, error_2;
29137
27889
 
29138
27890
  return __generator(this, function (_b) {
29139
27891
  switch (_b.label) {
29140
27892
  case 0:
29141
27893
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
29142
27894
  prov = this.getPluggable(providerName);
29143
-
29144
- if (!Array.isArray(geofenceIds)) {
29145
- geofenceIdsInputArray = [geofenceIds];
29146
- } else {
29147
- geofenceIdsInputArray = geofenceIds;
29148
- }
29149
-
29150
27895
  _b.label = 1;
29151
27896
 
29152
27897
  case 1:
@@ -29154,7 +27899,7 @@ function () {
29154
27899
 
29155
27900
  return [4
29156
27901
  /*yield*/
29157
- , prov.deleteGeofences(geofenceIdsInputArray, options)];
27902
+ , prov.searchByCoordinates(coordinates, options)];
29158
27903
 
29159
27904
  case 2:
29160
27905
  return [2
@@ -29162,9 +27907,9 @@ function () {
29162
27907
  , _b.sent()];
29163
27908
 
29164
27909
  case 3:
29165
- error_6 = _b.sent();
29166
- logger.debug(error_6);
29167
- throw error_6;
27910
+ error_2 = _b.sent();
27911
+ logger.debug(error_2);
27912
+ throw error_2;
29168
27913
 
29169
27914
  case 4:
29170
27915
  return [2
@@ -29200,7 +27945,6 @@ __webpack_require__.r(__webpack_exports__);
29200
27945
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
29201
27946
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
29202
27947
  /* harmony import */ var _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-sdk/client-location */ "../../node_modules/@aws-sdk/client-location/dist-es/index.js");
29203
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util */ "./lib-esm/util.js");
29204
27948
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
29205
27949
  function adopt(value) {
29206
27950
  return value instanceof P ? value : new P(function (resolve) {
@@ -29343,41 +28087,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
29343
28087
  };
29344
28088
  }
29345
28089
  };
29346
-
29347
- var __read = undefined && undefined.__read || function (o, n) {
29348
- var m = typeof Symbol === "function" && o[Symbol.iterator];
29349
- if (!m) return o;
29350
- var i = m.call(o),
29351
- r,
29352
- ar = [],
29353
- e;
29354
-
29355
- try {
29356
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
29357
- ar.push(r.value);
29358
- }
29359
- } catch (error) {
29360
- e = {
29361
- error: error
29362
- };
29363
- } finally {
29364
- try {
29365
- if (r && !r.done && (m = i["return"])) m.call(i);
29366
- } finally {
29367
- if (e) throw e.error;
29368
- }
29369
- }
29370
-
29371
- return ar;
29372
- };
29373
-
29374
- var __spread = undefined && undefined.__spread || function () {
29375
- for (var ar = [], i = 0; i < arguments.length; i++) {
29376
- ar = ar.concat(__read(arguments[i]));
29377
- }
29378
-
29379
- return ar;
29380
- };
29381
28090
  /*
29382
28091
  * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
29383
28092
  *
@@ -29395,7 +28104,6 @@ var __spread = undefined && undefined.__spread || function () {
29395
28104
 
29396
28105
 
29397
28106
 
29398
-
29399
28107
  var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('AmazonLocationServiceProvider');
29400
28108
 
29401
28109
  var AmazonLocationServiceProvider =
@@ -29535,317 +28243,15 @@ function () {
29535
28243
 
29536
28244
  if (options['searchAreaConstraints']) {
29537
28245
  locationServiceInput.FilterBBox = options['searchAreaConstraints'];
29538
- }
29539
- }
29540
-
29541
- client = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["LocationClient"]({
29542
- credentials: this._config.credentials,
29543
- region: this._config.region,
29544
- customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])()
29545
- });
29546
- command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["SearchPlaceIndexForTextCommand"](locationServiceInput);
29547
- _a.label = 2;
29548
-
29549
- case 2:
29550
- _a.trys.push([2, 4,, 5]);
29551
-
29552
- return [4
29553
- /*yield*/
29554
- , client.send(command)];
29555
-
29556
- case 3:
29557
- response = _a.sent();
29558
- return [3
29559
- /*break*/
29560
- , 5];
29561
-
29562
- case 4:
29563
- error_1 = _a.sent();
29564
- logger.debug(error_1);
29565
- throw error_1;
29566
-
29567
- case 5:
29568
- PascalResults = response.Results.map(function (result) {
29569
- return result.Place;
29570
- });
29571
- results = camelcase_keys__WEBPACK_IMPORTED_MODULE_0___default()(PascalResults, {
29572
- deep: true
29573
- });
29574
- return [2
29575
- /*return*/
29576
- , results];
29577
- }
29578
- });
29579
- });
29580
- };
29581
- /**
29582
- * Reverse geocoding search via a coordinate point on the map
29583
- * @param coordinates - Coordinates array for the search input
29584
- * @param options - Options parameters for the search
29585
- * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
29586
- */
29587
-
29588
-
29589
- AmazonLocationServiceProvider.prototype.searchByCoordinates = function (coordinates, options) {
29590
- return __awaiter(this, void 0, void 0, function () {
29591
- var credentialsOK, locationServiceInput, client, command, response, error_2, PascalResults, results;
29592
- return __generator(this, function (_a) {
29593
- switch (_a.label) {
29594
- case 0:
29595
- return [4
29596
- /*yield*/
29597
- , this._ensureCredentials()];
29598
-
29599
- case 1:
29600
- credentialsOK = _a.sent();
29601
-
29602
- if (!credentialsOK) {
29603
- throw new Error('No credentials');
29604
- }
29605
-
29606
- this._verifySearchIndex(options === null || options === void 0 ? void 0 : options.searchIndexName);
29607
-
29608
- locationServiceInput = {
29609
- Position: coordinates,
29610
- IndexName: this._config.search_indices["default"]
29611
- };
29612
-
29613
- if (options) {
29614
- if (options.searchIndexName) {
29615
- locationServiceInput.IndexName = options.searchIndexName;
29616
- }
29617
-
29618
- locationServiceInput.MaxResults = options.maxResults;
29619
- }
29620
-
29621
- client = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["LocationClient"]({
29622
- credentials: this._config.credentials,
29623
- region: this._config.region,
29624
- customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])()
29625
- });
29626
- command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["SearchPlaceIndexForPositionCommand"](locationServiceInput);
29627
- _a.label = 2;
29628
-
29629
- case 2:
29630
- _a.trys.push([2, 4,, 5]);
29631
-
29632
- return [4
29633
- /*yield*/
29634
- , client.send(command)];
29635
-
29636
- case 3:
29637
- response = _a.sent();
29638
- return [3
29639
- /*break*/
29640
- , 5];
29641
-
29642
- case 4:
29643
- error_2 = _a.sent();
29644
- logger.debug(error_2);
29645
- throw error_2;
29646
-
29647
- case 5:
29648
- PascalResults = response.Results.map(function (result) {
29649
- return result.Place;
29650
- });
29651
- results = camelcase_keys__WEBPACK_IMPORTED_MODULE_0___default()(PascalResults[0], {
29652
- deep: true
29653
- });
29654
- return [2
29655
- /*return*/
29656
- , results];
29657
- }
29658
- });
29659
- });
29660
- };
29661
- /**
29662
- * Create geofences inside of a geofence collection
29663
- * @param geofences - Array of geofence objects to create
29664
- * @param options? - Optional parameters for creating geofences
29665
- * @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
29666
- * successes: list of geofences successfully created
29667
- * errors: list of geofences that failed to create
29668
- */
29669
-
29670
-
29671
- AmazonLocationServiceProvider.prototype.saveGeofences = function (geofences, options) {
29672
- return __awaiter(this, void 0, void 0, function () {
29673
- var credentialsOK, PascalGeofences, results, geofenceBatches, apiLimit;
29674
-
29675
- var _this = this;
29676
-
29677
- return __generator(this, function (_a) {
29678
- switch (_a.label) {
29679
- case 0:
29680
- if (geofences.length < 1) {
29681
- throw new Error('Geofence input array is empty');
29682
- }
29683
-
29684
- return [4
29685
- /*yield*/
29686
- , this._ensureCredentials()];
29687
-
29688
- case 1:
29689
- credentialsOK = _a.sent();
29690
-
29691
- if (!credentialsOK) {
29692
- throw new Error('No credentials');
29693
- } // Verify geofence collection exists in aws-config.js
29694
-
29695
-
29696
- try {
29697
- this._verifyGeofenceCollections(options === null || options === void 0 ? void 0 : options.collectionName);
29698
- } catch (error) {
29699
- logger.debug(error);
29700
- throw error;
29701
- }
29702
-
29703
- Object(_util__WEBPACK_IMPORTED_MODULE_3__["validateGeofencesInput"])(geofences);
29704
- PascalGeofences = geofences.map(function (_a) {
29705
- var geofenceId = _a.geofenceId,
29706
- polygon = _a.geometry.polygon;
29707
- return {
29708
- GeofenceId: geofenceId,
29709
- Geometry: {
29710
- Polygon: polygon
29711
- }
29712
- };
29713
- });
29714
- results = {
29715
- successes: [],
29716
- errors: []
29717
- };
29718
- geofenceBatches = [];
29719
-
29720
- while (PascalGeofences.length > 0) {
29721
- apiLimit = 10;
29722
- geofenceBatches.push(PascalGeofences.splice(0, apiLimit));
29723
- }
29724
-
29725
- return [4
29726
- /*yield*/
29727
- , Promise.all(geofenceBatches.map(function (batch) {
29728
- return __awaiter(_this, void 0, void 0, function () {
29729
- var response, error_3;
29730
- return __generator(this, function (_a) {
29731
- switch (_a.label) {
29732
- case 0:
29733
- _a.trys.push([0, 2,, 3]);
29734
-
29735
- return [4
29736
- /*yield*/
29737
- , this._AmazonLocationServiceBatchPutGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections["default"])];
29738
-
29739
- case 1:
29740
- response = _a.sent();
29741
- return [3
29742
- /*break*/
29743
- , 3];
29744
-
29745
- case 2:
29746
- error_3 = _a.sent(); // If the API call fails, add the geofences to the errors array and move to next batch
29747
-
29748
- batch.forEach(function (geofence) {
29749
- results.errors.push({
29750
- geofenceId: geofence.GeofenceId,
29751
- error: {
29752
- code: 'APIConnectionError',
29753
- message: error_3.message
29754
- }
29755
- });
29756
- });
29757
- return [2
29758
- /*return*/
29759
- ];
29760
-
29761
- case 3:
29762
- // Push all successes to results
29763
- response.Successes.forEach(function (success) {
29764
- var GeofenceId = success.GeofenceId,
29765
- CreateTime = success.CreateTime,
29766
- UpdateTime = success.UpdateTime;
29767
- results.successes.push({
29768
- geofenceId: GeofenceId,
29769
- createTime: CreateTime,
29770
- updateTime: UpdateTime
29771
- });
29772
- }); // Push all errors to results
29773
-
29774
- response.Errors.forEach(function (error) {
29775
- var _a = error.Error,
29776
- Code = _a.Code,
29777
- Message = _a.Message,
29778
- GeofenceId = error.GeofenceId;
29779
- results.errors.push({
29780
- error: {
29781
- code: Code,
29782
- message: Message
29783
- },
29784
- geofenceId: GeofenceId
29785
- });
29786
- });
29787
- return [2
29788
- /*return*/
29789
- ];
29790
- }
29791
- });
29792
- });
29793
- }))];
29794
-
29795
- case 2:
29796
- _a.sent();
29797
-
29798
- return [2
29799
- /*return*/
29800
- , results];
29801
- }
29802
- });
29803
- });
29804
- };
29805
- /**
29806
- * Get geofence from a geofence collection
29807
- * @param geofenceId:string
29808
- * @param options?: Optional parameters for getGeofence
29809
- * @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
29810
- */
29811
-
29812
-
29813
- AmazonLocationServiceProvider.prototype.getGeofence = function (geofenceId, options) {
29814
- return __awaiter(this, void 0, void 0, function () {
29815
- var credentialsOK, client, commandInput, command, response, error_4, GeofenceId, CreateTime, UpdateTime, Status, Geometry, geofence;
29816
- return __generator(this, function (_a) {
29817
- switch (_a.label) {
29818
- case 0:
29819
- return [4
29820
- /*yield*/
29821
- , this._ensureCredentials()];
29822
-
29823
- case 1:
29824
- credentialsOK = _a.sent();
29825
-
29826
- if (!credentialsOK) {
29827
- throw new Error('No credentials');
29828
- } // Verify geofence collection exists in aws-config.js
29829
-
29830
-
29831
- try {
29832
- this._verifyGeofenceCollections(options === null || options === void 0 ? void 0 : options.collectionName);
29833
- } catch (error) {
29834
- logger.debug(error);
29835
- throw error;
28246
+ }
29836
28247
  }
29837
28248
 
29838
- Object(_util__WEBPACK_IMPORTED_MODULE_3__["validateGeofenceId"])(geofenceId);
29839
28249
  client = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["LocationClient"]({
29840
28250
  credentials: this._config.credentials,
29841
28251
  region: this._config.region,
29842
28252
  customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])()
29843
28253
  });
29844
- commandInput = {
29845
- GeofenceId: geofenceId,
29846
- CollectionName: (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections["default"]
29847
- };
29848
- command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["GetGeofenceCommand"](commandInput);
28254
+ command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["SearchPlaceIndexForTextCommand"](locationServiceInput);
29849
28255
  _a.label = 2;
29850
28256
 
29851
28257
  case 2:
@@ -29862,40 +28268,35 @@ function () {
29862
28268
  , 5];
29863
28269
 
29864
28270
  case 4:
29865
- error_4 = _a.sent();
29866
- logger.debug(error_4);
29867
- throw error_4;
28271
+ error_1 = _a.sent();
28272
+ logger.debug(error_1);
28273
+ throw error_1;
29868
28274
 
29869
28275
  case 5:
29870
- GeofenceId = response.GeofenceId, CreateTime = response.CreateTime, UpdateTime = response.UpdateTime, Status = response.Status, Geometry = response.Geometry;
29871
- geofence = {
29872
- createTime: CreateTime,
29873
- geofenceId: GeofenceId,
29874
- geometry: {
29875
- polygon: Geometry.Polygon
29876
- },
29877
- status: Status,
29878
- updateTime: UpdateTime
29879
- };
28276
+ PascalResults = response.Results.map(function (result) {
28277
+ return result.Place;
28278
+ });
28279
+ results = camelcase_keys__WEBPACK_IMPORTED_MODULE_0___default()(PascalResults, {
28280
+ deep: true
28281
+ });
29880
28282
  return [2
29881
28283
  /*return*/
29882
- , geofence];
28284
+ , results];
29883
28285
  }
29884
28286
  });
29885
28287
  });
29886
28288
  };
29887
28289
  /**
29888
- * List geofences from a geofence collection
29889
- * @param options?: ListGeofenceOptions
29890
- * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
29891
- * entries: list of geofences - 100 geofences are listed per page
29892
- * nextToken: token for next page of geofences
28290
+ * Reverse geocoding search via a coordinate point on the map
28291
+ * @param coordinates - Coordinates array for the search input
28292
+ * @param options - Options parameters for the search
28293
+ * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
29893
28294
  */
29894
28295
 
29895
28296
 
29896
- AmazonLocationServiceProvider.prototype.listGeofences = function (options) {
28297
+ AmazonLocationServiceProvider.prototype.searchByCoordinates = function (coordinates, options) {
29897
28298
  return __awaiter(this, void 0, void 0, function () {
29898
- var credentialsOK, client, listGeofencesInput, command, response, error_5, NextToken, Entries, results;
28299
+ var credentialsOK, locationServiceInput, client, command, response, error_2, PascalResults, results;
29899
28300
  return __generator(this, function (_a) {
29900
28301
  switch (_a.label) {
29901
28302
  case 0:
@@ -29908,14 +28309,21 @@ function () {
29908
28309
 
29909
28310
  if (!credentialsOK) {
29910
28311
  throw new Error('No credentials');
29911
- } // Verify geofence collection exists in aws-config.js
28312
+ }
29912
28313
 
28314
+ this._verifySearchIndex(options === null || options === void 0 ? void 0 : options.searchIndexName);
29913
28315
 
29914
- try {
29915
- this._verifyGeofenceCollections(options === null || options === void 0 ? void 0 : options.collectionName);
29916
- } catch (error) {
29917
- logger.debug(error);
29918
- throw error;
28316
+ locationServiceInput = {
28317
+ Position: coordinates,
28318
+ IndexName: this._config.search_indices["default"]
28319
+ };
28320
+
28321
+ if (options) {
28322
+ if (options.searchIndexName) {
28323
+ locationServiceInput.IndexName = options.searchIndexName;
28324
+ }
28325
+
28326
+ locationServiceInput.MaxResults = options.maxResults;
29919
28327
  }
29920
28328
 
29921
28329
  client = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["LocationClient"]({
@@ -29923,11 +28331,7 @@ function () {
29923
28331
  region: this._config.region,
29924
28332
  customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])()
29925
28333
  });
29926
- listGeofencesInput = {
29927
- NextToken: options === null || options === void 0 ? void 0 : options.nextToken,
29928
- CollectionName: (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections["default"]
29929
- };
29930
- command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["ListGeofencesCommand"](listGeofencesInput);
28334
+ command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["SearchPlaceIndexForPositionCommand"](locationServiceInput);
29931
28335
  _a.label = 2;
29932
28336
 
29933
28337
  case 2:
@@ -29944,158 +28348,17 @@ function () {
29944
28348
  , 5];
29945
28349
 
29946
28350
  case 4:
29947
- error_5 = _a.sent();
29948
- logger.debug(error_5);
29949
- throw error_5;
28351
+ error_2 = _a.sent();
28352
+ logger.debug(error_2);
28353
+ throw error_2;
29950
28354
 
29951
28355
  case 5:
29952
- NextToken = response.NextToken, Entries = response.Entries;
29953
- results = {
29954
- entries: Entries.map(function (_a) {
29955
- var GeofenceId = _a.GeofenceId,
29956
- CreateTime = _a.CreateTime,
29957
- UpdateTime = _a.UpdateTime,
29958
- Status = _a.Status,
29959
- Polygon = _a.Geometry.Polygon;
29960
- return {
29961
- geofenceId: GeofenceId,
29962
- createTime: CreateTime,
29963
- updateTime: UpdateTime,
29964
- status: Status,
29965
- geometry: {
29966
- polygon: Polygon
29967
- }
29968
- };
29969
- }),
29970
- nextToken: NextToken
29971
- };
29972
- return [2
29973
- /*return*/
29974
- , results];
29975
- }
29976
- });
29977
- });
29978
- };
29979
- /**
29980
- * Delete geofences from a geofence collection
29981
- * @param geofenceIds: string|string[]
29982
- * @param options?: GeofenceOptions
29983
- * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
29984
- * successes: list of geofences successfully deleted
29985
- * errors: list of geofences that failed to delete
29986
- */
29987
-
29988
-
29989
- AmazonLocationServiceProvider.prototype.deleteGeofences = function (geofenceIds, options) {
29990
- return __awaiter(this, void 0, void 0, function () {
29991
- var credentialsOK, badGeofenceIds, results, geofenceIdBatches, count;
29992
-
29993
- var _this = this;
29994
-
29995
- return __generator(this, function (_a) {
29996
- switch (_a.label) {
29997
- case 0:
29998
- if (geofenceIds.length < 1) {
29999
- throw new Error('GeofenceId input array is empty');
30000
- }
30001
-
30002
- return [4
30003
- /*yield*/
30004
- , this._ensureCredentials()];
30005
-
30006
- case 1:
30007
- credentialsOK = _a.sent();
30008
-
30009
- if (!credentialsOK) {
30010
- throw new Error('No credentials');
30011
- }
30012
-
30013
- this._verifyGeofenceCollections(options === null || options === void 0 ? void 0 : options.collectionName);
30014
-
30015
- badGeofenceIds = geofenceIds.filter(function (geofenceId) {
30016
- try {
30017
- Object(_util__WEBPACK_IMPORTED_MODULE_3__["validateGeofenceId"])(geofenceId);
30018
- } catch (error) {
30019
- return true;
30020
- }
28356
+ PascalResults = response.Results.map(function (result) {
28357
+ return result.Place;
28358
+ });
28359
+ results = camelcase_keys__WEBPACK_IMPORTED_MODULE_0___default()(PascalResults[0], {
28360
+ deep: true
30021
28361
  });
30022
-
30023
- if (badGeofenceIds.length > 0) {
30024
- throw new Error("Invalid geofence ids: " + badGeofenceIds.join(', '));
30025
- }
30026
-
30027
- results = {
30028
- successes: [],
30029
- errors: []
30030
- };
30031
- geofenceIdBatches = [];
30032
- count = 0;
30033
-
30034
- while (count < geofenceIds.length) {
30035
- geofenceIdBatches.push(geofenceIds.slice(count, count += 10));
30036
- }
30037
-
30038
- return [4
30039
- /*yield*/
30040
- , Promise.all(geofenceIdBatches.map(function (batch) {
30041
- return __awaiter(_this, void 0, void 0, function () {
30042
- var response, error_6, badGeofenceIds;
30043
-
30044
- var _a;
30045
-
30046
- return __generator(this, function (_b) {
30047
- switch (_b.label) {
30048
- case 0:
30049
- _b.trys.push([0, 2,, 3]);
30050
-
30051
- return [4
30052
- /*yield*/
30053
- , this._AmazonLocationServiceBatchDeleteGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections["default"])];
30054
-
30055
- case 1:
30056
- response = _b.sent();
30057
- return [3
30058
- /*break*/
30059
- , 3];
30060
-
30061
- case 2:
30062
- error_6 = _b.sent(); // If the API call fails, add the geofences to the errors array and move to next batch
30063
-
30064
- batch.forEach(function (geofenceId) {
30065
- var errorObject = {
30066
- geofenceId: geofenceId,
30067
- error: {
30068
- code: error_6.message,
30069
- message: error_6.message
30070
- }
30071
- };
30072
- results.errors.push(errorObject);
30073
- });
30074
- return [2
30075
- /*return*/
30076
- ];
30077
-
30078
- case 3:
30079
- badGeofenceIds = response.Errors.map(function (_a) {
30080
- var geofenceId = _a.geofenceId;
30081
- return geofenceId;
30082
- });
30083
-
30084
- (_a = results.successes).push.apply(_a, __spread(batch.filter(function (Id) {
30085
- return !badGeofenceIds.includes(Id);
30086
- })));
30087
-
30088
- return [2
30089
- /*return*/
30090
- ];
30091
- }
30092
- });
30093
- });
30094
- }))];
30095
-
30096
- case 2:
30097
- _a.sent();
30098
-
30099
28362
  return [2
30100
28363
  /*return*/
30101
28364
  , results];
@@ -30110,7 +28373,7 @@ function () {
30110
28373
 
30111
28374
  AmazonLocationServiceProvider.prototype._ensureCredentials = function () {
30112
28375
  return __awaiter(this, void 0, void 0, function () {
30113
- var credentials, cred, error_7;
28376
+ var credentials, cred, error_3;
30114
28377
  return __generator(this, function (_a) {
30115
28378
  switch (_a.label) {
30116
28379
  case 0:
@@ -30133,8 +28396,8 @@ function () {
30133
28396
  , true];
30134
28397
 
30135
28398
  case 2:
30136
- error_7 = _a.sent();
30137
- logger.debug('Ensure credentials error. Credentials are:', error_7);
28399
+ error_3 = _a.sent();
28400
+ logger.warn('Ensure credentials error. Credentials are:', error_3);
30138
28401
  return [2
30139
28402
  /*return*/
30140
28403
  , false];
@@ -30150,122 +28413,26 @@ function () {
30150
28413
 
30151
28414
  AmazonLocationServiceProvider.prototype._verifyMapResources = function () {
30152
28415
  if (!this._config.maps) {
30153
- var errorString = "No map resources found in amplify config, run 'amplify add geo' to create one and run `amplify push` after";
30154
- logger.debug(errorString);
28416
+ var errorString = "No map resources found in amplify config, run 'amplify add geo' to create them and run `amplify push` after";
28417
+ logger.warn(errorString);
30155
28418
  throw new Error(errorString);
30156
28419
  }
30157
28420
 
30158
28421
  if (!this._config.maps["default"]) {
30159
28422
  var errorString = "No default map resource found in amplify config, run 'amplify add geo' to create one and run `amplify push` after";
30160
- logger.debug(errorString);
28423
+ logger.warn(errorString);
30161
28424
  throw new Error(errorString);
30162
28425
  }
30163
28426
  };
30164
28427
 
30165
28428
  AmazonLocationServiceProvider.prototype._verifySearchIndex = function (optionalSearchIndex) {
30166
28429
  if ((!this._config.search_indices || !this._config.search_indices["default"]) && !optionalSearchIndex) {
30167
- var errorString = 'No Search Index found in amplify config, please run `amplify add geo` to create one and run `amplify push` after.';
30168
- logger.debug(errorString);
30169
- throw new Error(errorString);
30170
- }
30171
- };
30172
-
30173
- AmazonLocationServiceProvider.prototype._verifyGeofenceCollections = function (optionalGeofenceCollectionName) {
30174
- if ((!this._config.geofenceCollections || !this._config.geofenceCollections["default"]) && !optionalGeofenceCollectionName) {
30175
- var errorString = 'No Geofence Collections found, please run `amplify add geo` to create one and run `amplify push` after.';
30176
- logger.debug(errorString);
28430
+ var errorString = 'No Search Index found, please run `amplify add geo` to add one and run `amplify push` after.';
28431
+ logger.warn(errorString);
30177
28432
  throw new Error(errorString);
30178
28433
  }
30179
28434
  };
30180
28435
 
30181
- AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchPutGeofenceCall = function (PascalGeofences, collectionName) {
30182
- return __awaiter(this, void 0, void 0, function () {
30183
- var geofenceInput, client, command, response, error_8;
30184
- return __generator(this, function (_a) {
30185
- switch (_a.label) {
30186
- case 0:
30187
- geofenceInput = {
30188
- Entries: PascalGeofences,
30189
- CollectionName: collectionName || this._config.geofenceCollections["default"]
30190
- };
30191
- client = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["LocationClient"]({
30192
- credentials: this._config.credentials,
30193
- region: this._config.region,
30194
- customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])()
30195
- });
30196
- command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["BatchPutGeofenceCommand"](geofenceInput);
30197
- _a.label = 1;
30198
-
30199
- case 1:
30200
- _a.trys.push([1, 3,, 4]);
30201
-
30202
- return [4
30203
- /*yield*/
30204
- , client.send(command)];
30205
-
30206
- case 2:
30207
- response = _a.sent();
30208
- return [3
30209
- /*break*/
30210
- , 4];
30211
-
30212
- case 3:
30213
- error_8 = _a.sent();
30214
- throw error_8;
30215
-
30216
- case 4:
30217
- return [2
30218
- /*return*/
30219
- , response];
30220
- }
30221
- });
30222
- });
30223
- };
30224
-
30225
- AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchDeleteGeofenceCall = function (geofenceIds, collectionName) {
30226
- return __awaiter(this, void 0, void 0, function () {
30227
- var deleteGeofencesInput, client, command, response, error_9;
30228
- return __generator(this, function (_a) {
30229
- switch (_a.label) {
30230
- case 0:
30231
- deleteGeofencesInput = {
30232
- GeofenceIds: geofenceIds,
30233
- CollectionName: collectionName || this._config.geofenceCollections["default"]
30234
- };
30235
- client = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["LocationClient"]({
30236
- credentials: this._config.credentials,
30237
- region: this._config.region,
30238
- customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])()
30239
- });
30240
- command = new _aws_sdk_client_location__WEBPACK_IMPORTED_MODULE_2__["BatchDeleteGeofenceCommand"](deleteGeofencesInput);
30241
- _a.label = 1;
30242
-
30243
- case 1:
30244
- _a.trys.push([1, 3,, 4]);
30245
-
30246
- return [4
30247
- /*yield*/
30248
- , client.send(command)];
30249
-
30250
- case 2:
30251
- response = _a.sent();
30252
- return [3
30253
- /*break*/
30254
- , 4];
30255
-
30256
- case 3:
30257
- error_9 = _a.sent();
30258
- throw error_9;
30259
-
30260
- case 4:
30261
- return [2
30262
- /*return*/
30263
- , response];
30264
- }
30265
- });
30266
- });
30267
- };
30268
-
30269
28436
  AmazonLocationServiceProvider.CATEGORY = 'Geo';
30270
28437
  AmazonLocationServiceProvider.PROVIDER_NAME = 'AmazonLocationService';
30271
28438
  return AmazonLocationServiceProvider;
@@ -30289,197 +28456,6 @@ __webpack_require__.r(__webpack_exports__);
30289
28456
 
30290
28457
 
30291
28458
 
30292
- /***/ }),
30293
-
30294
- /***/ "./lib-esm/util.js":
30295
- /*!*************************!*\
30296
- !*** ./lib-esm/util.js ***!
30297
- \*************************/
30298
- /*! exports provided: validateCoordinates, validateGeofenceId, validateLinearRing, validatePolygon, validateGeofencesInput */
30299
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
30300
-
30301
- "use strict";
30302
- __webpack_require__.r(__webpack_exports__);
30303
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateCoordinates", function() { return validateCoordinates; });
30304
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateGeofenceId", function() { return validateGeofenceId; });
30305
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateLinearRing", function() { return validateLinearRing; });
30306
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validatePolygon", function() { return validatePolygon; });
30307
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateGeofencesInput", function() { return validateGeofencesInput; });
30308
- /* harmony import */ var _turf_boolean_clockwise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/boolean-clockwise */ "../../node_modules/@turf/boolean-clockwise/dist/es/index.js");
30309
- var __read = undefined && undefined.__read || function (o, n) {
30310
- var m = typeof Symbol === "function" && o[Symbol.iterator];
30311
- if (!m) return o;
30312
- var i = m.call(o),
30313
- r,
30314
- ar = [],
30315
- e;
30316
-
30317
- try {
30318
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
30319
- ar.push(r.value);
30320
- }
30321
- } catch (error) {
30322
- e = {
30323
- error: error
30324
- };
30325
- } finally {
30326
- try {
30327
- if (r && !r.done && (m = i["return"])) m.call(i);
30328
- } finally {
30329
- if (e) throw e.error;
30330
- }
30331
- }
30332
-
30333
- return ar;
30334
- };
30335
- /*
30336
- * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
30337
- *
30338
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
30339
- * the License. A copy of the License is located at
30340
- *
30341
- * http://aws.amazon.com/apache2.0/
30342
- *
30343
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
30344
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
30345
- * and limitations under the License.
30346
- */
30347
-
30348
-
30349
-
30350
- function validateCoordinates(lng, lat) {
30351
- if (!Number.isFinite(lng) || !Number.isFinite(lat)) {
30352
- throw new Error("Invalid coordinates: [" + lng + "," + lat + "]");
30353
- }
30354
-
30355
- if (lat < -90 || 90 < lat) {
30356
- throw new Error('Latitude must be between -90 and 90 degrees inclusive.');
30357
- } else if (lng < -180 || 180 < lng) {
30358
- throw new Error('Longitude must be between -180 and 180 degrees inclusive.');
30359
- }
30360
- }
30361
- function validateGeofenceId(geofenceId) {
30362
- var geofenceIdRegex = /^(?:[\x2D\.0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])+$/i; // Check if geofenceId is valid
30363
-
30364
- if (!geofenceIdRegex.test(geofenceId)) {
30365
- throw new Error("Invalid geofenceId: '" + geofenceId + "' - IDs can only contain alphanumeric characters, hyphens, underscores and periods.");
30366
- }
30367
- }
30368
- function validateLinearRing(linearRing, geofenceId) {
30369
- var errorPrefix = geofenceId ? geofenceId + ": " : ''; // Validate LinearRing size, must be at least 4 points
30370
-
30371
- if (linearRing.length < 4) {
30372
- throw new Error(errorPrefix + "LinearRing must contain 4 or more coordinates.");
30373
- } // Validate all coordinates are valid, error with which ones are bad
30374
-
30375
-
30376
- var badCoordinates = [];
30377
- linearRing.forEach(function (coordinates) {
30378
- try {
30379
- validateCoordinates(coordinates[0], coordinates[1]);
30380
- } catch (error) {
30381
- badCoordinates.push({
30382
- coordinates: coordinates,
30383
- error: error.message
30384
- });
30385
- }
30386
- });
30387
-
30388
- if (badCoordinates.length > 0) {
30389
- throw new Error(errorPrefix + "One or more of the coordinates in the Polygon LinearRing are not valid: " + JSON.stringify(badCoordinates));
30390
- } // Validate first and last coordinates are the same
30391
-
30392
-
30393
- var _a = __read(linearRing[0], 2),
30394
- lngA = _a[0],
30395
- latA = _a[1];
30396
-
30397
- var _b = __read(linearRing[linearRing.length - 1], 2),
30398
- lngB = _b[0],
30399
- latB = _b[1];
30400
-
30401
- if (lngA !== lngB || latA !== latB) {
30402
- throw new Error(errorPrefix + "LinearRing's first and last coordinates are not the same");
30403
- }
30404
-
30405
- if (Object(_turf_boolean_clockwise__WEBPACK_IMPORTED_MODULE_0__["default"])(linearRing)) {
30406
- throw new Error(errorPrefix + "LinearRing coordinates must be wound counterclockwise");
30407
- }
30408
- }
30409
- function validatePolygon(polygon, geofenceId) {
30410
- var errorPrefix = geofenceId ? geofenceId + ": " : '';
30411
-
30412
- if (!Array.isArray(polygon)) {
30413
- throw new Error(errorPrefix + "Polygon is of incorrect structure. It should be an array of LinearRings");
30414
- }
30415
-
30416
- if (polygon.length < 1) {
30417
- throw new Error(errorPrefix + "Polygon must have a single LinearRing array.");
30418
- }
30419
-
30420
- if (polygon.length > 1) {
30421
- throw new Error(errorPrefix + "Polygon must have a single LinearRing array. Note: We do not currently support polygons with holes, multipolygons, polygons that are wound clockwise, or that cross the antimeridian.");
30422
- }
30423
-
30424
- var verticesCount = polygon.reduce(function (prev, linearRing) {
30425
- return prev + linearRing.length;
30426
- }, 0);
30427
-
30428
- if (verticesCount > 1000) {
30429
- throw new Error(errorPrefix + "Polygon has more than the maximum 1000 vertices.");
30430
- }
30431
-
30432
- polygon.forEach(function (linearRing) {
30433
- validateLinearRing(linearRing, geofenceId);
30434
- });
30435
- }
30436
- function validateGeofencesInput(geofences) {
30437
- var geofenceIds = {};
30438
- geofences.forEach(function (geofence) {
30439
- // verify all required properties are present
30440
- // Validate geofenceId exists
30441
- if (!geofence.geofenceId) {
30442
- throw new Error("Geofence '" + geofence + "' is missing geofenceId");
30443
- }
30444
-
30445
- var geofenceId = geofence.geofenceId;
30446
- validateGeofenceId(geofenceId); // Validate geofenceId is unique
30447
-
30448
- if (geofenceIds[geofenceId]) {
30449
- throw new Error("Duplicate geofenceId: " + geofenceId);
30450
- } else {
30451
- geofenceIds[geofenceId] = true;
30452
- } // Validate geometry exists
30453
-
30454
-
30455
- if (!geofence.geometry) {
30456
- throw new Error("Geofence '" + geofenceId + "' is missing geometry");
30457
- }
30458
-
30459
- var geometry = geofence.geometry; // Validate polygon exists
30460
-
30461
- if (!geometry.polygon) {
30462
- throw new Error("Geofence '" + geofenceId + "' is missing geometry.polygon");
30463
- }
30464
-
30465
- var polygon = geometry.polygon; // Validate polygon length and structure
30466
-
30467
- try {
30468
- validatePolygon(polygon, geofenceId);
30469
- } catch (error) {
30470
- if (error.message.includes('Polygon has more than the maximum 1000 vertices.')) {
30471
- throw new Error("Geofence '" + geofenceId + "' has more than the maximum of 1000 vertices");
30472
- }
30473
- } // Validate LinearRing length, structure, and coordinates
30474
-
30475
-
30476
- var _a = __read(polygon, 1),
30477
- linearRing = _a[0];
30478
-
30479
- validateLinearRing(linearRing, geofenceId);
30480
- });
30481
- }
30482
-
30483
28459
  /***/ }),
30484
28460
 
30485
28461
  /***/ "@aws-amplify/core":