@aws-amplify/geo 1.3.24-unstable.4 → 1.3.25-unstable.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Geo.d.ts ADDED
@@ -0,0 +1,110 @@
1
+ import { Place, GeoConfig, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, MapStyle, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults, searchByPlaceIdOptions } from './types';
2
+ export declare class GeoClass {
3
+ static MODULE: string;
4
+ /**
5
+ * @private
6
+ */
7
+ private _config;
8
+ private _pluggables;
9
+ constructor();
10
+ /**
11
+ * get the name of the module category
12
+ * @returns {string} name of the module category
13
+ */
14
+ getModuleName(): string;
15
+ /**
16
+ * add plugin into Geo category
17
+ * @param {Object} pluggable - an instance of the plugin
18
+ */
19
+ addPluggable(pluggable: GeoProvider): object;
20
+ /**
21
+ * Get the plugin object
22
+ * @param providerName - the name of the plugin
23
+ */
24
+ getPluggable(providerName: string): GeoProvider;
25
+ /**
26
+ * Remove the plugin object
27
+ * @param providerName - the name of the plugin
28
+ */
29
+ removePluggable(providerName: string): void;
30
+ /**
31
+ * Configure Geo
32
+ * @param {Object} config - Configuration object for Geo
33
+ * @return {Object} - Current configuration
34
+ */
35
+ configure(config?: any): GeoConfig;
36
+ /**
37
+ * Get the map resources that are currently available through the provider
38
+ * @param {string} provider
39
+ * @returns - Array of available map resources
40
+ */
41
+ getAvailableMaps(provider?: string): MapStyle[];
42
+ /**
43
+ * Get the map resource set as default in amplify config
44
+ * @param {string} provider
45
+ * @returns - Map resource set as the default in amplify config
46
+ */
47
+ getDefaultMap(provider?: string): MapStyle;
48
+ /**
49
+ * Search by text input with optional parameters
50
+ * @param {string} text - The text string that is to be searched for
51
+ * @param {SearchByTextOptions} options? - Optional parameters to the search
52
+ * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
53
+ */
54
+ searchByText(text: string, options?: SearchByTextOptions): Promise<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<import("./types").SearchForSuggestionsResults>;
62
+ /**
63
+ * Search for location by unique ID
64
+ * @param {string} placeId - Unique ID of the location that is to be searched for
65
+ * @param {searchByPlaceIdOptions} options? - Optional parameters to the search
66
+ * @returns {Promise<Place>} - Resolves to a place with the given placeId
67
+ */
68
+ searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place>;
69
+ /**
70
+ * Reverse geocoding search via a coordinate point on the map
71
+ * @param coordinates - Coordinates array for the search input
72
+ * @param options - Options parameters for the search
73
+ * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
74
+ */
75
+ searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
76
+ /**
77
+ * Create geofences
78
+ * @param geofences - Single or array of geofence objects to create
79
+ * @param options? - Optional parameters for creating geofences
80
+ * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
81
+ * successes: list of geofences successfully created
82
+ * errors: list of geofences that failed to create
83
+ */
84
+ saveGeofences(geofences: GeofenceInput | GeofenceInput[], options?: GeofenceOptions): Promise<SaveGeofencesResults>;
85
+ /**
86
+ * Get a single geofence by geofenceId
87
+ * @param geofenceId: GeofenceId - The string id of the geofence to get
88
+ * @param options?: GeofenceOptions - Optional parameters for getting a geofence
89
+ * @returns Promise<Geofence> - Promise that resolves to a geofence object
90
+ */
91
+ getGeofence(geofenceId: GeofenceId, options?: GeofenceOptions): Promise<Geofence>;
92
+ /**
93
+ * List geofences
94
+ * @param options?: ListGeofenceOptions
95
+ * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
96
+ * entries: list of geofences - 100 geofences are listed per page
97
+ * nextToken: token for next page of geofences
98
+ */
99
+ listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
100
+ /**
101
+ * Delete geofences
102
+ * @param geofenceIds: string|string[]
103
+ * @param options?: GeofenceOptions
104
+ * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
105
+ * successes: list of geofences successfully deleted
106
+ * errors: list of geofences that failed to delete
107
+ */
108
+ deleteGeofences(geofenceIds: string | string[], options?: GeofenceOptions): Promise<DeleteGeofencesResults>;
109
+ }
110
+ export declare const Geo: GeoClass;
package/lib/Geo.js CHANGED
@@ -1,69 +1,8 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
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
- };
54
2
  Object.defineProperty(exports, "__esModule", { value: true });
55
- /*
56
- * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
57
- *
58
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
59
- * the License. A copy of the License is located at
60
- *
61
- * http://aws.amazon.com/apache2.0/
62
- *
63
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
64
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
65
- * and limitations under the License.
66
- */
3
+ var tslib_1 = require("tslib");
4
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ // SPDX-License-Identifier: Apache-2.0
67
6
  var core_1 = require("@aws-amplify/core");
68
7
  var AmazonLocationServiceProvider_1 = require("./Providers/AmazonLocationServiceProvider");
69
8
  var util_1 = require("./util");
@@ -124,7 +63,7 @@ var GeoClass = /** @class */ (function () {
124
63
  logger.debug('configure Geo');
125
64
  if (!config)
126
65
  return this._config;
127
- var amplifyConfig = core_1.parseMobileHubConfig(config);
66
+ var amplifyConfig = core_1.parseAWSExports(config);
128
67
  this._config = Object.assign({}, this._config, amplifyConfig.Geo, config);
129
68
  this._pluggables.forEach(function (pluggable) {
130
69
  pluggable.configure(_this._config[pluggable.getProviderName()]);
@@ -161,9 +100,9 @@ var GeoClass = /** @class */ (function () {
161
100
  * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
162
101
  */
163
102
  GeoClass.prototype.searchByText = function (text, options) {
164
- return __awaiter(this, void 0, void 0, function () {
103
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
165
104
  var _a, providerName, prov, error_1;
166
- return __generator(this, function (_b) {
105
+ return tslib_1.__generator(this, function (_b) {
167
106
  switch (_b.label) {
168
107
  case 0:
169
108
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
@@ -189,9 +128,9 @@ var GeoClass = /** @class */ (function () {
189
128
  * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
190
129
  */
191
130
  GeoClass.prototype.searchForSuggestions = function (text, options) {
192
- return __awaiter(this, void 0, void 0, function () {
131
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
193
132
  var _a, providerName, prov, error_2;
194
- return __generator(this, function (_b) {
133
+ return tslib_1.__generator(this, function (_b) {
195
134
  switch (_b.label) {
196
135
  case 0:
197
136
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
@@ -217,9 +156,9 @@ var GeoClass = /** @class */ (function () {
217
156
  * @returns {Promise<Place>} - Resolves to a place with the given placeId
218
157
  */
219
158
  GeoClass.prototype.searchByPlaceId = function (placeId, options) {
220
- return __awaiter(this, void 0, void 0, function () {
159
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
221
160
  var providerName, prov, error_3;
222
- return __generator(this, function (_a) {
161
+ return tslib_1.__generator(this, function (_a) {
223
162
  switch (_a.label) {
224
163
  case 0:
225
164
  providerName = DEFAULT_PROVIDER;
@@ -245,14 +184,14 @@ var GeoClass = /** @class */ (function () {
245
184
  * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
246
185
  */
247
186
  GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
248
- return __awaiter(this, void 0, void 0, function () {
187
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
249
188
  var _a, providerName, prov, _b, lng, lat, error_4;
250
- return __generator(this, function (_c) {
189
+ return tslib_1.__generator(this, function (_c) {
251
190
  switch (_c.label) {
252
191
  case 0:
253
192
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
254
193
  prov = this.getPluggable(providerName);
255
- _b = __read(coordinates, 2), lng = _b[0], lat = _b[1];
194
+ _b = tslib_1.__read(coordinates, 2), lng = _b[0], lat = _b[1];
256
195
  _c.label = 1;
257
196
  case 1:
258
197
  _c.trys.push([1, 3, , 4]);
@@ -277,9 +216,9 @@ var GeoClass = /** @class */ (function () {
277
216
  * errors: list of geofences that failed to create
278
217
  */
279
218
  GeoClass.prototype.saveGeofences = function (geofences, options) {
280
- return __awaiter(this, void 0, void 0, function () {
219
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
281
220
  var _a, providerName, prov, geofenceInputArray, error_5;
282
- return __generator(this, function (_b) {
221
+ return tslib_1.__generator(this, function (_b) {
283
222
  switch (_b.label) {
284
223
  case 0:
285
224
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
@@ -311,9 +250,9 @@ var GeoClass = /** @class */ (function () {
311
250
  * @returns Promise<Geofence> - Promise that resolves to a geofence object
312
251
  */
313
252
  GeoClass.prototype.getGeofence = function (geofenceId, options) {
314
- return __awaiter(this, void 0, void 0, function () {
253
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
315
254
  var _a, providerName, prov, error_6;
316
- return __generator(this, function (_b) {
255
+ return tslib_1.__generator(this, function (_b) {
317
256
  switch (_b.label) {
318
257
  case 0:
319
258
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
@@ -340,9 +279,9 @@ var GeoClass = /** @class */ (function () {
340
279
  * nextToken: token for next page of geofences
341
280
  */
342
281
  GeoClass.prototype.listGeofences = function (options) {
343
- return __awaiter(this, void 0, void 0, function () {
282
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
344
283
  var _a, providerName, prov, error_7;
345
- return __generator(this, function (_b) {
284
+ return tslib_1.__generator(this, function (_b) {
346
285
  switch (_b.label) {
347
286
  case 0:
348
287
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
@@ -370,9 +309,9 @@ var GeoClass = /** @class */ (function () {
370
309
  * errors: list of geofences that failed to delete
371
310
  */
372
311
  GeoClass.prototype.deleteGeofences = function (geofenceIds, options) {
373
- return __awaiter(this, void 0, void 0, function () {
312
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
374
313
  var _a, providerName, prov, geofenceIdsInputArray, error_8;
375
- return __generator(this, function (_b) {
314
+ return tslib_1.__generator(this, function (_b) {
376
315
  switch (_b.label) {
377
316
  case 0:
378
317
  _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
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;AAE1F,+BAA6C;AAqB7C,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,KAAK,CAAC,C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eAAe,CAAC,qBAAqB,EAAE,OAAO,CAAC,EAAA;4BAAjE,sBAAO,SAA0D,EAAC;;;wBAElE,MAAM,CAAC,KAAK,CAAC,OAAK,CAAC,CAAC;wBACpB,MAAM,OAAK,CAAC;;;;;KAEb;IAvSM,eAAM,GAAG,KAAK,CAAC;IAwSvB,eAAC;CAAA,AAzSD,IAySC;AAzSY,4BAAQ;AA2SR,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;AAClC,cAAO,CAAC,QAAQ,CAAC,WAAG,CAAC,CAAC"}
@@ -0,0 +1,105 @@
1
+ import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, SearchForSuggestionsResults, GeofenceId, GeofenceInput, AmazonLocationServiceGeofenceOptions, AmazonLocationServiceListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, AmazonLocationServiceGeofence, AmazonLocationServiceDeleteGeofencesResults, searchByPlaceIdOptions } from '../types';
2
+ export declare class AmazonLocationServiceProvider implements GeoProvider {
3
+ static CATEGORY: string;
4
+ static PROVIDER_NAME: string;
5
+ /**
6
+ * @private
7
+ */
8
+ private _config;
9
+ /**
10
+ * Initialize Geo with AWS configurations
11
+ * @param {Object} config - Configuration object for Geo
12
+ */
13
+ constructor(config?: GeoConfig);
14
+ /**
15
+ * get the category of the plugin
16
+ * @returns {string} name of the category
17
+ */
18
+ getCategory(): string;
19
+ /**
20
+ * get provider name of the plugin
21
+ * @returns {string} name of the provider
22
+ */
23
+ getProviderName(): string;
24
+ /**
25
+ * Configure Geo part with aws configuration
26
+ * @param {Object} config - Configuration of the Geo
27
+ * @return {Object} - Current configuration
28
+ */
29
+ configure(config?: any): object;
30
+ /**
31
+ * Get the map resources that are currently available through the provider
32
+ * @returns {AmazonLocationServiceMapStyle[]}- Array of available map resources
33
+ */
34
+ getAvailableMaps(): AmazonLocationServiceMapStyle[];
35
+ /**
36
+ * Get the map resource set as default in amplify config
37
+ * @returns {AmazonLocationServiceMapStyle} - Map resource set as the default in amplify config
38
+ */
39
+ getDefaultMap(): AmazonLocationServiceMapStyle;
40
+ /**
41
+ * Search by text input with optional parameters
42
+ * @param {string} text - The text string that is to be searched for
43
+ * @param {SearchByTextOptions} options? - Optional parameters to the search
44
+ * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
45
+ */
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
+ private _verifyPlaceId;
55
+ searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place | undefined>;
56
+ /**
57
+ * Reverse geocoding search via a coordinate point on the map
58
+ * @param coordinates - Coordinates array for the search input
59
+ * @param options - Options parameters for the search
60
+ * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
61
+ */
62
+ searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
63
+ /**
64
+ * Create geofences inside of a geofence collection
65
+ * @param geofences - Array of geofence objects to create
66
+ * @param options? - Optional parameters for creating geofences
67
+ * @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
68
+ * successes: list of geofences successfully created
69
+ * errors: list of geofences that failed to create
70
+ */
71
+ saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions): Promise<SaveGeofencesResults>;
72
+ /**
73
+ * Get geofence from a geofence collection
74
+ * @param geofenceId:string
75
+ * @param options?: Optional parameters for getGeofence
76
+ * @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
77
+ */
78
+ getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceGeofence>;
79
+ /**
80
+ * List geofences from a geofence collection
81
+ * @param options?: ListGeofenceOptions
82
+ * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
83
+ * entries: list of geofences - 100 geofences are listed per page
84
+ * nextToken: token for next page of geofences
85
+ */
86
+ listGeofences(options?: AmazonLocationServiceListGeofenceOptions): Promise<ListGeofenceResults>;
87
+ /**
88
+ * Delete geofences from a geofence collection
89
+ * @param geofenceIds: string|string[]
90
+ * @param options?: GeofenceOptions
91
+ * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
92
+ * successes: list of geofences successfully deleted
93
+ * errors: list of geofences that failed to delete
94
+ */
95
+ deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceDeleteGeofencesResults>;
96
+ /**
97
+ * @private
98
+ */
99
+ private _ensureCredentials;
100
+ private _verifyMapResources;
101
+ private _verifySearchIndex;
102
+ private _verifyGeofenceCollections;
103
+ private _AmazonLocationServiceBatchPutGeofenceCall;
104
+ private _AmazonLocationServiceBatchDeleteGeofenceCall;
105
+ }