@aws-amplify/geo 2.3.3-unstable.b6987fc.0 → 2.3.4-unstable.bdaee91.0
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 +41 -3
- package/lib/Geo.js +230 -20
- package/lib/Geo.js.map +1 -1
- package/lib/Providers/AmazonLocationServiceProvider.d.ts +8 -15
- package/lib/Providers/AmazonLocationServiceProvider.js +20 -26
- package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
- package/lib/types/Provider.d.ts +8 -9
- package/lib-esm/Geo.d.ts +41 -3
- package/lib-esm/Geo.js +232 -22
- package/lib-esm/Geo.js.map +1 -1
- package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +8 -15
- package/lib-esm/Providers/AmazonLocationServiceProvider.js +20 -26
- package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
- package/lib-esm/types/Provider.d.ts +8 -9
- package/package.json +5 -6
- package/src/Geo.ts +203 -11
- package/src/Providers/AmazonLocationServiceProvider.ts +20 -39
- package/src/types/Provider.ts +8 -22
- package/internals/package.json +0 -8
- package/lib/internals/InternalGeo.d.ts +0 -119
- package/lib/internals/InternalGeo.js +0 -354
- package/lib/internals/InternalGeo.js.map +0 -1
- package/lib/internals/index.d.ts +0 -1
- package/lib/internals/index.js +0 -7
- package/lib/internals/index.js.map +0 -1
- package/lib/internals/utils.d.ts +0 -2
- package/lib/internals/utils.js +0 -10
- package/lib/internals/utils.js.map +0 -1
- package/lib-esm/internals/InternalGeo.d.ts +0 -119
- package/lib-esm/internals/InternalGeo.js +0 -352
- package/lib-esm/internals/InternalGeo.js.map +0 -1
- package/lib-esm/internals/index.d.ts +0 -1
- package/lib-esm/internals/index.js +0 -4
- package/lib-esm/internals/index.js.map +0 -1
- package/lib-esm/internals/utils.d.ts +0 -2
- package/lib-esm/internals/utils.js +0 -8
- package/lib-esm/internals/utils.js.map +0 -1
- package/src/internals/InternalGeo.ts +0 -393
- package/src/internals/index.ts +0 -3
- package/src/internals/utils.ts +0 -15
package/lib/Geo.d.ts
CHANGED
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
import { Place, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults, searchByPlaceIdOptions } from './types';
|
|
2
|
-
|
|
3
|
-
export declare class GeoClass extends InternalGeoClass {
|
|
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 {
|
|
4
3
|
static MODULE: string;
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
private _config;
|
|
8
|
+
private _pluggables;
|
|
9
|
+
constructor();
|
|
5
10
|
/**
|
|
6
11
|
* get the name of the module category
|
|
7
12
|
* @returns {string} name of the module category
|
|
8
13
|
*/
|
|
9
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;
|
|
10
48
|
/**
|
|
11
49
|
* Search by text input with optional parameters
|
|
12
50
|
* @param {string} text - The text string that is to be searched for
|
package/lib/Geo.js
CHANGED
|
@@ -4,11 +4,15 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
var core_1 = require("@aws-amplify/core");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
7
|
+
var AmazonLocationServiceProvider_1 = require("./Providers/AmazonLocationServiceProvider");
|
|
8
|
+
var util_1 = require("./util");
|
|
9
|
+
var logger = new core_1.ConsoleLogger('Geo');
|
|
10
|
+
var DEFAULT_PROVIDER = 'AmazonLocationService';
|
|
11
|
+
var GeoClass = /** @class */ (function () {
|
|
10
12
|
function GeoClass() {
|
|
11
|
-
|
|
13
|
+
this._config = {};
|
|
14
|
+
this._pluggables = [];
|
|
15
|
+
logger.debug('Geo Options', this._config);
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* get the name of the module category
|
|
@@ -17,6 +21,78 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
17
21
|
GeoClass.prototype.getModuleName = function () {
|
|
18
22
|
return GeoClass.MODULE;
|
|
19
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* add plugin into Geo category
|
|
26
|
+
* @param {Object} pluggable - an instance of the plugin
|
|
27
|
+
*/
|
|
28
|
+
GeoClass.prototype.addPluggable = function (pluggable) {
|
|
29
|
+
if (pluggable && pluggable.getCategory() === 'Geo') {
|
|
30
|
+
this._pluggables.push(pluggable);
|
|
31
|
+
var config = pluggable.configure(this._config[pluggable.getProviderName()]);
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Get the plugin object
|
|
37
|
+
* @param providerName - the name of the plugin
|
|
38
|
+
*/
|
|
39
|
+
GeoClass.prototype.getPluggable = function (providerName) {
|
|
40
|
+
var pluggable = this._pluggables.find(function (pluggable) { return pluggable.getProviderName() === providerName; });
|
|
41
|
+
if (pluggable === undefined) {
|
|
42
|
+
logger.debug('No plugin found with providerName', providerName);
|
|
43
|
+
throw new Error('No plugin found in Geo for the provider');
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
return pluggable;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Remove the plugin object
|
|
50
|
+
* @param providerName - the name of the plugin
|
|
51
|
+
*/
|
|
52
|
+
GeoClass.prototype.removePluggable = function (providerName) {
|
|
53
|
+
this._pluggables = this._pluggables.filter(function (pluggable) { return pluggable.getProviderName() !== providerName; });
|
|
54
|
+
return;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Configure Geo
|
|
58
|
+
* @param {Object} config - Configuration object for Geo
|
|
59
|
+
* @return {Object} - Current configuration
|
|
60
|
+
*/
|
|
61
|
+
GeoClass.prototype.configure = function (config) {
|
|
62
|
+
var _this = this;
|
|
63
|
+
logger.debug('configure Geo');
|
|
64
|
+
if (!config)
|
|
65
|
+
return this._config;
|
|
66
|
+
var amplifyConfig = core_1.parseAWSExports(config);
|
|
67
|
+
this._config = Object.assign({}, this._config, amplifyConfig.Geo, config);
|
|
68
|
+
this._pluggables.forEach(function (pluggable) {
|
|
69
|
+
pluggable.configure(_this._config[pluggable.getProviderName()]);
|
|
70
|
+
});
|
|
71
|
+
if (this._pluggables.length === 0) {
|
|
72
|
+
this.addPluggable(new AmazonLocationServiceProvider_1.AmazonLocationServiceProvider());
|
|
73
|
+
}
|
|
74
|
+
return this._config;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Get the map resources that are currently available through the provider
|
|
78
|
+
* @param {string} provider
|
|
79
|
+
* @returns - Array of available map resources
|
|
80
|
+
*/
|
|
81
|
+
GeoClass.prototype.getAvailableMaps = function (provider) {
|
|
82
|
+
if (provider === void 0) { provider = DEFAULT_PROVIDER; }
|
|
83
|
+
var prov = this.getPluggable(provider);
|
|
84
|
+
return prov.getAvailableMaps();
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Get the map resource set as default in amplify config
|
|
88
|
+
* @param {string} provider
|
|
89
|
+
* @returns - Map resource set as the default in amplify config
|
|
90
|
+
*/
|
|
91
|
+
GeoClass.prototype.getDefaultMap = function (provider) {
|
|
92
|
+
if (provider === void 0) { provider = DEFAULT_PROVIDER; }
|
|
93
|
+
var prov = this.getPluggable(provider);
|
|
94
|
+
return prov.getDefaultMap();
|
|
95
|
+
};
|
|
20
96
|
/**
|
|
21
97
|
* Search by text input with optional parameters
|
|
22
98
|
* @param {string} text - The text string that is to be searched for
|
|
@@ -25,8 +101,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
25
101
|
*/
|
|
26
102
|
GeoClass.prototype.searchByText = function (text, options) {
|
|
27
103
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
28
|
-
|
|
29
|
-
|
|
104
|
+
var _a, providerName, prov, error_1;
|
|
105
|
+
return tslib_1.__generator(this, function (_b) {
|
|
106
|
+
switch (_b.label) {
|
|
107
|
+
case 0:
|
|
108
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
109
|
+
prov = this.getPluggable(providerName);
|
|
110
|
+
_b.label = 1;
|
|
111
|
+
case 1:
|
|
112
|
+
_b.trys.push([1, 3, , 4]);
|
|
113
|
+
return [4 /*yield*/, prov.searchByText(text, options)];
|
|
114
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
115
|
+
case 3:
|
|
116
|
+
error_1 = _b.sent();
|
|
117
|
+
logger.debug(error_1);
|
|
118
|
+
throw error_1;
|
|
119
|
+
case 4: return [2 /*return*/];
|
|
120
|
+
}
|
|
30
121
|
});
|
|
31
122
|
});
|
|
32
123
|
};
|
|
@@ -38,8 +129,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
38
129
|
*/
|
|
39
130
|
GeoClass.prototype.searchForSuggestions = function (text, options) {
|
|
40
131
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
41
|
-
|
|
42
|
-
|
|
132
|
+
var _a, providerName, prov, error_2;
|
|
133
|
+
return tslib_1.__generator(this, function (_b) {
|
|
134
|
+
switch (_b.label) {
|
|
135
|
+
case 0:
|
|
136
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
137
|
+
prov = this.getPluggable(providerName);
|
|
138
|
+
_b.label = 1;
|
|
139
|
+
case 1:
|
|
140
|
+
_b.trys.push([1, 3, , 4]);
|
|
141
|
+
return [4 /*yield*/, prov.searchForSuggestions(text, options)];
|
|
142
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
143
|
+
case 3:
|
|
144
|
+
error_2 = _b.sent();
|
|
145
|
+
logger.debug(error_2);
|
|
146
|
+
throw error_2;
|
|
147
|
+
case 4: return [2 /*return*/];
|
|
148
|
+
}
|
|
43
149
|
});
|
|
44
150
|
});
|
|
45
151
|
};
|
|
@@ -51,8 +157,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
51
157
|
*/
|
|
52
158
|
GeoClass.prototype.searchByPlaceId = function (placeId, options) {
|
|
53
159
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
160
|
+
var providerName, prov, error_3;
|
|
54
161
|
return tslib_1.__generator(this, function (_a) {
|
|
55
|
-
|
|
162
|
+
switch (_a.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
providerName = DEFAULT_PROVIDER;
|
|
165
|
+
prov = this.getPluggable(providerName);
|
|
166
|
+
_a.label = 1;
|
|
167
|
+
case 1:
|
|
168
|
+
_a.trys.push([1, 3, , 4]);
|
|
169
|
+
return [4 /*yield*/, prov.searchByPlaceId(placeId, options)];
|
|
170
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
171
|
+
case 3:
|
|
172
|
+
error_3 = _a.sent();
|
|
173
|
+
logger.debug(error_3);
|
|
174
|
+
throw error_3;
|
|
175
|
+
case 4: return [2 /*return*/];
|
|
176
|
+
}
|
|
56
177
|
});
|
|
57
178
|
});
|
|
58
179
|
};
|
|
@@ -64,8 +185,25 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
64
185
|
*/
|
|
65
186
|
GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
|
|
66
187
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
67
|
-
|
|
68
|
-
|
|
188
|
+
var _a, providerName, prov, _b, lng, lat, error_4;
|
|
189
|
+
return tslib_1.__generator(this, function (_c) {
|
|
190
|
+
switch (_c.label) {
|
|
191
|
+
case 0:
|
|
192
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
193
|
+
prov = this.getPluggable(providerName);
|
|
194
|
+
_b = tslib_1.__read(coordinates, 2), lng = _b[0], lat = _b[1];
|
|
195
|
+
_c.label = 1;
|
|
196
|
+
case 1:
|
|
197
|
+
_c.trys.push([1, 3, , 4]);
|
|
198
|
+
util_1.validateCoordinates(lng, lat);
|
|
199
|
+
return [4 /*yield*/, prov.searchByCoordinates(coordinates, options)];
|
|
200
|
+
case 2: return [2 /*return*/, _c.sent()];
|
|
201
|
+
case 3:
|
|
202
|
+
error_4 = _c.sent();
|
|
203
|
+
logger.debug(error_4);
|
|
204
|
+
throw error_4;
|
|
205
|
+
case 4: return [2 /*return*/];
|
|
206
|
+
}
|
|
69
207
|
});
|
|
70
208
|
});
|
|
71
209
|
};
|
|
@@ -79,8 +217,29 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
79
217
|
*/
|
|
80
218
|
GeoClass.prototype.saveGeofences = function (geofences, options) {
|
|
81
219
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
82
|
-
|
|
83
|
-
|
|
220
|
+
var _a, providerName, prov, geofenceInputArray, error_5;
|
|
221
|
+
return tslib_1.__generator(this, function (_b) {
|
|
222
|
+
switch (_b.label) {
|
|
223
|
+
case 0:
|
|
224
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
225
|
+
prov = this.getPluggable(providerName);
|
|
226
|
+
if (!Array.isArray(geofences)) {
|
|
227
|
+
geofenceInputArray = [geofences];
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
geofenceInputArray = geofences;
|
|
231
|
+
}
|
|
232
|
+
_b.label = 1;
|
|
233
|
+
case 1:
|
|
234
|
+
_b.trys.push([1, 3, , 4]);
|
|
235
|
+
return [4 /*yield*/, prov.saveGeofences(geofenceInputArray, options)];
|
|
236
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
237
|
+
case 3:
|
|
238
|
+
error_5 = _b.sent();
|
|
239
|
+
logger.debug(error_5);
|
|
240
|
+
throw error_5;
|
|
241
|
+
case 4: return [2 /*return*/];
|
|
242
|
+
}
|
|
84
243
|
});
|
|
85
244
|
});
|
|
86
245
|
};
|
|
@@ -92,8 +251,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
92
251
|
*/
|
|
93
252
|
GeoClass.prototype.getGeofence = function (geofenceId, options) {
|
|
94
253
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
95
|
-
|
|
96
|
-
|
|
254
|
+
var _a, providerName, prov, error_6;
|
|
255
|
+
return tslib_1.__generator(this, function (_b) {
|
|
256
|
+
switch (_b.label) {
|
|
257
|
+
case 0:
|
|
258
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
259
|
+
prov = this.getPluggable(providerName);
|
|
260
|
+
_b.label = 1;
|
|
261
|
+
case 1:
|
|
262
|
+
_b.trys.push([1, 3, , 4]);
|
|
263
|
+
return [4 /*yield*/, prov.getGeofence(geofenceId, options)];
|
|
264
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
265
|
+
case 3:
|
|
266
|
+
error_6 = _b.sent();
|
|
267
|
+
logger.debug(error_6);
|
|
268
|
+
throw error_6;
|
|
269
|
+
case 4: return [2 /*return*/];
|
|
270
|
+
}
|
|
97
271
|
});
|
|
98
272
|
});
|
|
99
273
|
};
|
|
@@ -106,8 +280,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
106
280
|
*/
|
|
107
281
|
GeoClass.prototype.listGeofences = function (options) {
|
|
108
282
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
109
|
-
|
|
110
|
-
|
|
283
|
+
var _a, providerName, prov, error_7;
|
|
284
|
+
return tslib_1.__generator(this, function (_b) {
|
|
285
|
+
switch (_b.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
288
|
+
prov = this.getPluggable(providerName);
|
|
289
|
+
_b.label = 1;
|
|
290
|
+
case 1:
|
|
291
|
+
_b.trys.push([1, 3, , 4]);
|
|
292
|
+
return [4 /*yield*/, prov.listGeofences(options)];
|
|
293
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
294
|
+
case 3:
|
|
295
|
+
error_7 = _b.sent();
|
|
296
|
+
logger.debug(error_7);
|
|
297
|
+
throw error_7;
|
|
298
|
+
case 4: return [2 /*return*/];
|
|
299
|
+
}
|
|
111
300
|
});
|
|
112
301
|
});
|
|
113
302
|
};
|
|
@@ -121,14 +310,35 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
121
310
|
*/
|
|
122
311
|
GeoClass.prototype.deleteGeofences = function (geofenceIds, options) {
|
|
123
312
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
124
|
-
|
|
125
|
-
|
|
313
|
+
var _a, providerName, prov, geofenceIdsInputArray, error_8;
|
|
314
|
+
return tslib_1.__generator(this, function (_b) {
|
|
315
|
+
switch (_b.label) {
|
|
316
|
+
case 0:
|
|
317
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
318
|
+
prov = this.getPluggable(providerName);
|
|
319
|
+
if (!Array.isArray(geofenceIds)) {
|
|
320
|
+
geofenceIdsInputArray = [geofenceIds];
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
geofenceIdsInputArray = geofenceIds;
|
|
324
|
+
}
|
|
325
|
+
_b.label = 1;
|
|
326
|
+
case 1:
|
|
327
|
+
_b.trys.push([1, 3, , 4]);
|
|
328
|
+
return [4 /*yield*/, prov.deleteGeofences(geofenceIdsInputArray, options)];
|
|
329
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
330
|
+
case 3:
|
|
331
|
+
error_8 = _b.sent();
|
|
332
|
+
logger.debug(error_8);
|
|
333
|
+
throw error_8;
|
|
334
|
+
case 4: return [2 /*return*/];
|
|
335
|
+
}
|
|
126
336
|
});
|
|
127
337
|
});
|
|
128
338
|
};
|
|
129
339
|
GeoClass.MODULE = 'Geo';
|
|
130
340
|
return GeoClass;
|
|
131
|
-
}(
|
|
341
|
+
}());
|
|
132
342
|
exports.GeoClass = GeoClass;
|
|
133
343
|
exports.Geo = new GeoClass();
|
|
134
344
|
core_1.Amplify.register(exports.Geo);
|
package/lib/Geo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Geo.js","sourceRoot":"","sources":["../src/Geo.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"Geo.js","sourceRoot":"","sources":["../src/Geo.ts"],"names":[],"mappings":";;;AAAA,qEAAqE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;;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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CustomUserAgentDetails } from '@aws-amplify/core';
|
|
2
1
|
import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, SearchForSuggestionsResults, GeofenceId, GeofenceInput, AmazonLocationServiceGeofenceOptions, AmazonLocationServiceListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, AmazonLocationServiceGeofence, AmazonLocationServiceDeleteGeofencesResults, searchByPlaceIdOptions } from '../types';
|
|
3
2
|
export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
4
3
|
static CATEGORY: string;
|
|
@@ -42,64 +41,58 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
|
42
41
|
* Search by text input with optional parameters
|
|
43
42
|
* @param {string} text - The text string that is to be searched for
|
|
44
43
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
45
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
46
44
|
* @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
|
|
47
45
|
*/
|
|
48
|
-
searchByText(text: string, options?: SearchByTextOptions
|
|
46
|
+
searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
|
|
49
47
|
/**
|
|
50
48
|
* Search for suggestions based on the input text
|
|
51
49
|
* @param {string} text - The text string that is to be searched for
|
|
52
50
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
53
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
54
51
|
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
|
|
55
52
|
*/
|
|
56
|
-
searchForSuggestions(text: string, options?: SearchByTextOptions
|
|
53
|
+
searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<SearchForSuggestionsResults>;
|
|
57
54
|
private _verifyPlaceId;
|
|
58
|
-
searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions
|
|
55
|
+
searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place | undefined>;
|
|
59
56
|
/**
|
|
60
57
|
* Reverse geocoding search via a coordinate point on the map
|
|
61
58
|
* @param coordinates - Coordinates array for the search input
|
|
62
59
|
* @param options - Options parameters for the search
|
|
63
60
|
* @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
|
|
64
61
|
*/
|
|
65
|
-
searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions
|
|
62
|
+
searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
|
|
66
63
|
/**
|
|
67
64
|
* Create geofences inside of a geofence collection
|
|
68
65
|
* @param geofences - Array of geofence objects to create
|
|
69
66
|
* @param options? - Optional parameters for creating geofences
|
|
70
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
71
67
|
* @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
|
|
72
68
|
* successes: list of geofences successfully created
|
|
73
69
|
* errors: list of geofences that failed to create
|
|
74
70
|
*/
|
|
75
|
-
saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions
|
|
71
|
+
saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions): Promise<SaveGeofencesResults>;
|
|
76
72
|
/**
|
|
77
73
|
* Get geofence from a geofence collection
|
|
78
74
|
* @param geofenceId:string
|
|
79
75
|
* @param options?: Optional parameters for getGeofence
|
|
80
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
81
76
|
* @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
|
|
82
77
|
*/
|
|
83
|
-
getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions
|
|
78
|
+
getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceGeofence>;
|
|
84
79
|
/**
|
|
85
80
|
* List geofences from a geofence collection
|
|
86
81
|
* @param options?: ListGeofenceOptions
|
|
87
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
88
82
|
* @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
|
|
89
83
|
* entries: list of geofences - 100 geofences are listed per page
|
|
90
84
|
* nextToken: token for next page of geofences
|
|
91
85
|
*/
|
|
92
|
-
listGeofences(options?: AmazonLocationServiceListGeofenceOptions
|
|
86
|
+
listGeofences(options?: AmazonLocationServiceListGeofenceOptions): Promise<ListGeofenceResults>;
|
|
93
87
|
/**
|
|
94
88
|
* Delete geofences from a geofence collection
|
|
95
89
|
* @param geofenceIds: string|string[]
|
|
96
90
|
* @param options?: GeofenceOptions
|
|
97
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
98
91
|
* @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
|
|
99
92
|
* successes: list of geofences successfully deleted
|
|
100
93
|
* errors: list of geofences that failed to delete
|
|
101
94
|
*/
|
|
102
|
-
deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions
|
|
95
|
+
deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceDeleteGeofencesResults>;
|
|
103
96
|
/**
|
|
104
97
|
* @private
|
|
105
98
|
*/
|