@aws-amplify/geo 1.2.4 → 1.2.5-geo.18

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 +2024 -137
  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 +36 -10
  6. package/lib/Geo.js +140 -20
  7. package/lib/Geo.js.map +1 -1
  8. package/lib/Providers/AmazonLocationServiceProvider.d.ts +37 -8
  9. package/lib/Providers/AmazonLocationServiceProvider.js +405 -53
  10. package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
  11. package/lib/types/AmazonLocationServiceProvider.d.ts +21 -1
  12. package/lib/types/Geo.d.ts +49 -2
  13. package/lib/types/Provider.d.ts +5 -2
  14. package/lib/types/Provider.js +0 -12
  15. package/lib/types/Provider.js.map +1 -1
  16. package/lib/util.d.ts +6 -0
  17. package/lib/util.js +147 -0
  18. package/lib/util.js.map +1 -0
  19. package/lib-esm/Geo.d.ts +36 -10
  20. package/lib-esm/Geo.js +140 -20
  21. package/lib-esm/Geo.js.map +1 -1
  22. package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +37 -8
  23. package/lib-esm/Providers/AmazonLocationServiceProvider.js +406 -54
  24. package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
  25. package/lib-esm/types/AmazonLocationServiceProvider.d.ts +21 -1
  26. package/lib-esm/types/Geo.d.ts +49 -2
  27. package/lib-esm/types/Provider.d.ts +5 -2
  28. package/lib-esm/types/Provider.js +0 -12
  29. package/lib-esm/types/Provider.js.map +1 -1
  30. package/lib-esm/util.d.ts +6 -0
  31. package/lib-esm/util.js +137 -0
  32. package/lib-esm/util.js.map +1 -0
  33. package/package.json +6 -4
  34. package/src/Geo.ts +119 -20
  35. package/src/Providers/AmazonLocationServiceProvider.ts +422 -75
  36. package/src/types/AmazonLocationServiceProvider.ts +56 -1
  37. package/src/types/Geo.ts +73 -4
  38. package/src/types/Provider.ts +30 -6
  39. package/src/util.ts +180 -0
package/lib/Geo.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GeoConfig, Coordinates, SearchByTextOptions, SearchForSuggestionsResults, SearchByCoordinatesOptions, GeoProvider, MapStyle } from './types';
1
+ import { Place, GeoConfig, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, MapStyle, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults } from './types';
2
2
  export declare class GeoClass {
3
3
  static MODULE: string;
4
4
  /**
@@ -51,20 +51,46 @@ export declare class GeoClass {
51
51
  * @param {SearchByTextOptions} options? - Optional parameters to the search
52
52
  * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
53
53
  */
54
- searchByText(text: string, options?: SearchByTextOptions): Promise<import("./types").Place[]>;
55
- /**
56
- * Search for search term suggestions based on input text
57
- * @param {string} text - The text string that is to be search for
58
- * @param {SearchByTextOptions} options? - Optional parameters to the search
59
- * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
60
- */
61
- searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<SearchForSuggestionsResults>;
54
+ searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
62
55
  /**
63
56
  * Reverse geocoding search via a coordinate point on the map
64
57
  * @param coordinates - Coordinates array for the search input
65
58
  * @param options - Options parameters for the search
66
59
  * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
67
60
  */
68
- searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<import("./types").Place>;
61
+ searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
62
+ /**
63
+ * Create geofences
64
+ * @param geofences - Single or array of geofence objects to create
65
+ * @param options? - Optional parameters for creating geofences
66
+ * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
67
+ * successes: list of geofences successfully created
68
+ * errors: list of geofences that failed to create
69
+ */
70
+ saveGeofences(geofences: GeofenceInput | GeofenceInput[], options?: GeofenceOptions): Promise<SaveGeofencesResults>;
71
+ /**
72
+ * Get a single geofence by geofenceId
73
+ * @param geofenceId: GeofenceId - The string id of the geofence to get
74
+ * @param options?: GeofenceOptions - Optional parameters for getting a geofence
75
+ * @returns Promise<Geofence> - Promise that resolves to a geofence object
76
+ */
77
+ getGeofence(geofenceId: GeofenceId, options?: GeofenceOptions): Promise<Geofence>;
78
+ /**
79
+ * List geofences
80
+ * @param options?: ListGeofenceOptions
81
+ * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
82
+ * entries: list of geofences - 100 geofences are listed per page
83
+ * nextToken: token for next page of geofences
84
+ */
85
+ listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
86
+ /**
87
+ * Delete geofences
88
+ * @param geofenceIds: string|string[]
89
+ * @param options?: GeofenceOptions
90
+ * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
91
+ * successes: list of geofences successfully deleted
92
+ * errors: list of geofences that failed to delete
93
+ */
94
+ deleteGeofences(geofenceIds: string | string[], options?: GeofenceOptions): Promise<DeleteGeofencesResults>;
69
95
  }
70
96
  export declare const Geo: GeoClass;
package/lib/Geo.js CHANGED
@@ -35,6 +35,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
38
54
  Object.defineProperty(exports, "__esModule", { value: true });
39
55
  /*
40
56
  * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -50,6 +66,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
66
  */
51
67
  var core_1 = require("@aws-amplify/core");
52
68
  var AmazonLocationServiceProvider_1 = require("./Providers/AmazonLocationServiceProvider");
69
+ var util_1 = require("./util");
53
70
  var logger = new core_1.ConsoleLogger('Geo');
54
71
  var DEFAULT_PROVIDER = 'AmazonLocationService';
55
72
  var GeoClass = /** @class */ (function () {
@@ -166,26 +183,28 @@ var GeoClass = /** @class */ (function () {
166
183
  });
167
184
  };
168
185
  /**
169
- * Search for search term suggestions based on input text
170
- * @param {string} text - The text string that is to be search for
171
- * @param {SearchByTextOptions} options? - Optional parameters to the search
172
- * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
186
+ * Reverse geocoding search via a coordinate point on the map
187
+ * @param coordinates - Coordinates array for the search input
188
+ * @param options - Options parameters for the search
189
+ * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
173
190
  */
174
- GeoClass.prototype.searchForSuggestions = function (text, options) {
191
+ GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
175
192
  return __awaiter(this, void 0, void 0, function () {
176
- var _a, providerName, prov, error_2;
177
- return __generator(this, function (_b) {
178
- switch (_b.label) {
193
+ var _a, providerName, prov, _b, lng, lat, error_2;
194
+ return __generator(this, function (_c) {
195
+ switch (_c.label) {
179
196
  case 0:
180
197
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
181
198
  prov = this.getPluggable(providerName);
182
- _b.label = 1;
199
+ _b = __read(coordinates, 2), lng = _b[0], lat = _b[1];
200
+ _c.label = 1;
183
201
  case 1:
184
- _b.trys.push([1, 3, , 4]);
185
- return [4 /*yield*/, prov.searchForSuggestions(text, options)];
186
- case 2: return [2 /*return*/, _b.sent()];
202
+ _c.trys.push([1, 3, , 4]);
203
+ util_1.validateCoordinates(lng, lat);
204
+ return [4 /*yield*/, prov.searchByCoordinates(coordinates, options)];
205
+ case 2: return [2 /*return*/, _c.sent()];
187
206
  case 3:
188
- error_2 = _b.sent();
207
+ error_2 = _c.sent();
189
208
  logger.debug(error_2);
190
209
  throw error_2;
191
210
  case 4: return [2 /*return*/];
@@ -194,23 +213,31 @@ var GeoClass = /** @class */ (function () {
194
213
  });
195
214
  };
196
215
  /**
197
- * Reverse geocoding search via a coordinate point on the map
198
- * @param coordinates - Coordinates array for the search input
199
- * @param options - Options parameters for the search
200
- * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
216
+ * Create geofences
217
+ * @param geofences - Single or array of geofence objects to create
218
+ * @param options? - Optional parameters for creating geofences
219
+ * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
220
+ * successes: list of geofences successfully created
221
+ * errors: list of geofences that failed to create
201
222
  */
202
- GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
223
+ GeoClass.prototype.saveGeofences = function (geofences, options) {
203
224
  return __awaiter(this, void 0, void 0, function () {
204
- var _a, providerName, prov, error_3;
225
+ var _a, providerName, prov, geofenceInputArray, error_3;
205
226
  return __generator(this, function (_b) {
206
227
  switch (_b.label) {
207
228
  case 0:
208
229
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
209
230
  prov = this.getPluggable(providerName);
231
+ if (!Array.isArray(geofences)) {
232
+ geofenceInputArray = [geofences];
233
+ }
234
+ else {
235
+ geofenceInputArray = geofences;
236
+ }
210
237
  _b.label = 1;
211
238
  case 1:
212
239
  _b.trys.push([1, 3, , 4]);
213
- return [4 /*yield*/, prov.searchByCoordinates(coordinates, options)];
240
+ return [4 /*yield*/, prov.saveGeofences(geofenceInputArray, options)];
214
241
  case 2: return [2 /*return*/, _b.sent()];
215
242
  case 3:
216
243
  error_3 = _b.sent();
@@ -221,6 +248,99 @@ var GeoClass = /** @class */ (function () {
221
248
  });
222
249
  });
223
250
  };
251
+ /**
252
+ * Get a single geofence by geofenceId
253
+ * @param geofenceId: GeofenceId - The string id of the geofence to get
254
+ * @param options?: GeofenceOptions - Optional parameters for getting a geofence
255
+ * @returns Promise<Geofence> - Promise that resolves to a geofence object
256
+ */
257
+ GeoClass.prototype.getGeofence = function (geofenceId, options) {
258
+ return __awaiter(this, void 0, void 0, function () {
259
+ var _a, providerName, prov, error_4;
260
+ return __generator(this, function (_b) {
261
+ switch (_b.label) {
262
+ case 0:
263
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
264
+ prov = this.getPluggable(providerName);
265
+ _b.label = 1;
266
+ case 1:
267
+ _b.trys.push([1, 3, , 4]);
268
+ return [4 /*yield*/, prov.getGeofence(geofenceId, options)];
269
+ case 2: return [2 /*return*/, _b.sent()];
270
+ case 3:
271
+ error_4 = _b.sent();
272
+ logger.debug(error_4);
273
+ throw error_4;
274
+ case 4: return [2 /*return*/];
275
+ }
276
+ });
277
+ });
278
+ };
279
+ /**
280
+ * List geofences
281
+ * @param options?: ListGeofenceOptions
282
+ * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
283
+ * entries: list of geofences - 100 geofences are listed per page
284
+ * nextToken: token for next page of geofences
285
+ */
286
+ GeoClass.prototype.listGeofences = function (options) {
287
+ return __awaiter(this, void 0, void 0, function () {
288
+ var _a, providerName, prov, error_5;
289
+ return __generator(this, function (_b) {
290
+ switch (_b.label) {
291
+ case 0:
292
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
293
+ prov = this.getPluggable(providerName);
294
+ _b.label = 1;
295
+ case 1:
296
+ _b.trys.push([1, 3, , 4]);
297
+ return [4 /*yield*/, prov.listGeofences(options)];
298
+ case 2: return [2 /*return*/, _b.sent()];
299
+ case 3:
300
+ error_5 = _b.sent();
301
+ logger.debug(error_5);
302
+ throw error_5;
303
+ case 4: return [2 /*return*/];
304
+ }
305
+ });
306
+ });
307
+ };
308
+ /**
309
+ * Delete geofences
310
+ * @param geofenceIds: string|string[]
311
+ * @param options?: GeofenceOptions
312
+ * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
313
+ * successes: list of geofences successfully deleted
314
+ * errors: list of geofences that failed to delete
315
+ */
316
+ GeoClass.prototype.deleteGeofences = function (geofenceIds, options) {
317
+ return __awaiter(this, void 0, void 0, function () {
318
+ var _a, providerName, prov, geofenceIdsInputArray, error_6;
319
+ return __generator(this, function (_b) {
320
+ switch (_b.label) {
321
+ case 0:
322
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
323
+ prov = this.getPluggable(providerName);
324
+ if (!Array.isArray(geofenceIds)) {
325
+ geofenceIdsInputArray = [geofenceIds];
326
+ }
327
+ else {
328
+ geofenceIdsInputArray = geofenceIds;
329
+ }
330
+ _b.label = 1;
331
+ case 1:
332
+ _b.trys.push([1, 3, , 4]);
333
+ return [4 /*yield*/, prov.deleteGeofences(geofenceIdsInputArray, options)];
334
+ case 2: return [2 /*return*/, _b.sent()];
335
+ case 3:
336
+ error_6 = _b.sent();
337
+ logger.debug(error_6);
338
+ throw error_6;
339
+ case 4: return [2 /*return*/];
340
+ }
341
+ });
342
+ });
343
+ };
224
344
  GeoClass.MODULE = 'Geo';
225
345
  return GeoClass;
226
346
  }());
package/lib/Geo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Geo.js","sourceRoot":"","sources":["../src/Geo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,0CAI2B;AAC3B,2FAA0F;AAY1F,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,KAAK,CAAC,CAAC;AAEjC,IAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD;IAQC;QACC,IAAI,CAAC,OAAO,GAAG,E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wBACpB,MAAM,OAAK,CAAC;;;;;KAEb;IAED;;;;;;;OAOG;IACU,kCAAe,GAA5B,UACC,WAA8B,EAC9B,OAAyB;;;;;;wBAEjB,KAAoC,CAAA,OAAO,IAAI,EAAE,CAAA,aAAlB,EAA/B,YAAY,mBAAG,gBAAgB,KAAA,CAAmB;wBACpD,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;wBAI7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;4BAChC,qBAAqB,GAAG,CAAC,WAAW,CAAC,CAAC;yBACtC;6BAAM;4BACN,qBAAqB,GAAG,WAAW,CAAC;yBACpC;;;;wBAIO,qBAAM,IAAI,CAAC,eAAe,CAAC,qBAAqB,EAAE,OAAO,CAAC,EAAA;4BAAjE,sBAAO,SAA0D,EAAC;;;wBAElE,MAAM,CAAC,KAAK,CAAC,OAAK,CAAC,CAAC;wBACpB,MAAM,OAAK,CAAC;;;;;KAEb;IA7PM,eAAM,GAAG,KAAK,CAAC;IA8PvB,eAAC;CAAA,AA/PD,IA+PC;AA/PY,4BAAQ;AAiQR,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;AAClC,cAAO,CAAC,QAAQ,CAAC,WAAG,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, SearchForSuggestionsResults } from '../types';
1
+ import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, GeofenceId, GeofenceInput, AmazonLocationServiceGeofenceOptions, AmazonLocationServiceListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, AmazonLocationServiceGeofence, AmazonLocationServiceDeleteGeofencesResults } from '../types';
2
2
  export declare class AmazonLocationServiceProvider implements GeoProvider {
3
3
  static CATEGORY: string;
4
4
  static PROVIDER_NAME: string;
@@ -44,13 +44,6 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
44
44
  * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
45
45
  */
46
46
  searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
47
- /**
48
- * Search for suggestions based on the input text
49
- * @param {string} text - The text string that is to be searched for
50
- * @param {SearchByTextOptions} options? - Optional parameters to the search
51
- * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
52
- */
53
- searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<SearchForSuggestionsResults>;
54
47
  /**
55
48
  * Reverse geocoding search via a coordinate point on the map
56
49
  * @param coordinates - Coordinates array for the search input
@@ -58,10 +51,46 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
58
51
  * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
59
52
  */
60
53
  searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
54
+ /**
55
+ * Create geofences inside of a geofence collection
56
+ * @param geofences - Array of geofence objects to create
57
+ * @param options? - Optional parameters for creating geofences
58
+ * @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
59
+ * successes: list of geofences successfully created
60
+ * errors: list of geofences that failed to create
61
+ */
62
+ saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions): Promise<SaveGeofencesResults>;
63
+ /**
64
+ * Get geofence from a geofence collection
65
+ * @param geofenceId:string
66
+ * @param options?: Optional parameters for getGeofence
67
+ * @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
68
+ */
69
+ getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceGeofence>;
70
+ /**
71
+ * List geofences from a geofence collection
72
+ * @param options?: ListGeofenceOptions
73
+ * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
74
+ * entries: list of geofences - 100 geofences are listed per page
75
+ * nextToken: token for next page of geofences
76
+ */
77
+ listGeofences(options?: AmazonLocationServiceListGeofenceOptions): Promise<ListGeofenceResults>;
78
+ /**
79
+ * Delete geofences from a geofence collection
80
+ * @param geofenceIds: string|string[]
81
+ * @param options?: GeofenceOptions
82
+ * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
83
+ * successes: list of geofences successfully deleted
84
+ * errors: list of geofences that failed to delete
85
+ */
86
+ deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceDeleteGeofencesResults>;
61
87
  /**
62
88
  * @private
63
89
  */
64
90
  private _ensureCredentials;
65
91
  private _verifyMapResources;
66
92
  private _verifySearchIndex;
93
+ private _verifyGeofenceCollections;
94
+ private _AmazonLocationServiceBatchPutGeofenceCall;
95
+ private _AmazonLocationServiceBatchDeleteGeofenceCall;
67
96
  }