@aws-amplify/geo 2.1.4 → 2.1.5-v5-user-agent-for-ui.f058eee.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.
- package/internals/package.json +8 -0
- package/lib/Geo.d.ts +3 -41
- package/lib/Geo.js +20 -230
- package/lib/Geo.js.map +1 -1
- package/lib/Providers/AmazonLocationServiceProvider.d.ts +9 -8
- package/lib/Providers/AmazonLocationServiceProvider.js +20 -20
- package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
- package/lib/internals/InternalGeo.d.ts +119 -0
- package/lib/internals/InternalGeo.js +354 -0
- package/lib/internals/InternalGeo.js.map +1 -0
- package/lib/internals/index.d.ts +1 -0
- package/lib/internals/index.js +7 -0
- package/lib/internals/index.js.map +1 -0
- package/lib/internals/utils.d.ts +2 -0
- package/lib/internals/utils.js +10 -0
- package/lib/internals/utils.js.map +1 -0
- package/lib/types/Provider.d.ts +9 -8
- package/lib-esm/Geo.d.ts +3 -41
- package/lib-esm/Geo.js +22 -232
- package/lib-esm/Geo.js.map +1 -1
- package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +9 -8
- package/lib-esm/Providers/AmazonLocationServiceProvider.js +20 -20
- package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
- package/lib-esm/internals/InternalGeo.d.ts +119 -0
- package/lib-esm/internals/InternalGeo.js +352 -0
- package/lib-esm/internals/InternalGeo.js.map +1 -0
- package/lib-esm/internals/index.d.ts +1 -0
- package/lib-esm/internals/index.js +4 -0
- package/lib-esm/internals/index.js.map +1 -0
- package/lib-esm/internals/utils.d.ts +2 -0
- package/lib-esm/internals/utils.js +8 -0
- package/lib-esm/internals/utils.js.map +1 -0
- package/lib-esm/types/Provider.d.ts +9 -8
- package/package.json +6 -5
- package/src/Geo.ts +11 -203
- package/src/Providers/AmazonLocationServiceProvider.ts +33 -20
- package/src/internals/InternalGeo.ts +393 -0
- package/src/internals/index.ts +3 -0
- package/src/internals/utils.ts +15 -0
- package/src/types/Provider.ts +22 -8
package/lib/Geo.d.ts
CHANGED
|
@@ -1,50 +1,12 @@
|
|
|
1
|
-
import { Place,
|
|
2
|
-
|
|
1
|
+
import { Place, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults, searchByPlaceIdOptions } from './types';
|
|
2
|
+
import { InternalGeoClass } from './internals/InternalGeo';
|
|
3
|
+
export declare class GeoClass extends InternalGeoClass {
|
|
3
4
|
static MODULE: string;
|
|
4
|
-
/**
|
|
5
|
-
* @private
|
|
6
|
-
*/
|
|
7
|
-
private _config;
|
|
8
|
-
private _pluggables;
|
|
9
|
-
constructor();
|
|
10
5
|
/**
|
|
11
6
|
* get the name of the module category
|
|
12
7
|
* @returns {string} name of the module category
|
|
13
8
|
*/
|
|
14
9
|
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
10
|
/**
|
|
49
11
|
* Search by text input with optional parameters
|
|
50
12
|
* @param {string} text - The text string that is to be searched for
|
package/lib/Geo.js
CHANGED
|
@@ -4,15 +4,11 @@ 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
|
-
|
|
10
|
-
var DEFAULT_PROVIDER = 'AmazonLocationService';
|
|
11
|
-
var GeoClass = /** @class */ (function () {
|
|
7
|
+
var InternalGeo_1 = require("./internals/InternalGeo");
|
|
8
|
+
var GeoClass = /** @class */ (function (_super) {
|
|
9
|
+
tslib_1.__extends(GeoClass, _super);
|
|
12
10
|
function GeoClass() {
|
|
13
|
-
this
|
|
14
|
-
this._pluggables = [];
|
|
15
|
-
logger.debug('Geo Options', this._config);
|
|
11
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
16
12
|
}
|
|
17
13
|
/**
|
|
18
14
|
* get the name of the module category
|
|
@@ -21,78 +17,6 @@ var GeoClass = /** @class */ (function () {
|
|
|
21
17
|
GeoClass.prototype.getModuleName = function () {
|
|
22
18
|
return GeoClass.MODULE;
|
|
23
19
|
};
|
|
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
|
-
};
|
|
96
20
|
/**
|
|
97
21
|
* Search by text input with optional parameters
|
|
98
22
|
* @param {string} text - The text string that is to be searched for
|
|
@@ -101,23 +25,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
101
25
|
*/
|
|
102
26
|
GeoClass.prototype.searchByText = function (text, options) {
|
|
103
27
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
}
|
|
28
|
+
return tslib_1.__generator(this, function (_a) {
|
|
29
|
+
return [2 /*return*/, _super.prototype.searchByText.call(this, text, options)];
|
|
121
30
|
});
|
|
122
31
|
});
|
|
123
32
|
};
|
|
@@ -129,23 +38,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
129
38
|
*/
|
|
130
39
|
GeoClass.prototype.searchForSuggestions = function (text, options) {
|
|
131
40
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
}
|
|
41
|
+
return tslib_1.__generator(this, function (_a) {
|
|
42
|
+
return [2 /*return*/, _super.prototype.searchForSuggestions.call(this, text, options)];
|
|
149
43
|
});
|
|
150
44
|
});
|
|
151
45
|
};
|
|
@@ -157,23 +51,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
157
51
|
*/
|
|
158
52
|
GeoClass.prototype.searchByPlaceId = function (placeId, options) {
|
|
159
53
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
160
|
-
var providerName, prov, error_3;
|
|
161
54
|
return tslib_1.__generator(this, function (_a) {
|
|
162
|
-
|
|
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
|
-
}
|
|
55
|
+
return [2 /*return*/, _super.prototype.searchByPlaceId.call(this, placeId, options)];
|
|
177
56
|
});
|
|
178
57
|
});
|
|
179
58
|
};
|
|
@@ -185,25 +64,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
185
64
|
*/
|
|
186
65
|
GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
|
|
187
66
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
}
|
|
67
|
+
return tslib_1.__generator(this, function (_a) {
|
|
68
|
+
return [2 /*return*/, _super.prototype.searchByCoordinates.call(this, coordinates, options)];
|
|
207
69
|
});
|
|
208
70
|
});
|
|
209
71
|
};
|
|
@@ -217,29 +79,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
217
79
|
*/
|
|
218
80
|
GeoClass.prototype.saveGeofences = function (geofences, options) {
|
|
219
81
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
}
|
|
82
|
+
return tslib_1.__generator(this, function (_a) {
|
|
83
|
+
return [2 /*return*/, _super.prototype.saveGeofences.call(this, geofences, options)];
|
|
243
84
|
});
|
|
244
85
|
});
|
|
245
86
|
};
|
|
@@ -251,23 +92,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
251
92
|
*/
|
|
252
93
|
GeoClass.prototype.getGeofence = function (geofenceId, options) {
|
|
253
94
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
254
|
-
|
|
255
|
-
|
|
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
|
-
}
|
|
95
|
+
return tslib_1.__generator(this, function (_a) {
|
|
96
|
+
return [2 /*return*/, _super.prototype.getGeofence.call(this, geofenceId, options)];
|
|
271
97
|
});
|
|
272
98
|
});
|
|
273
99
|
};
|
|
@@ -280,23 +106,8 @@ var GeoClass = /** @class */ (function () {
|
|
|
280
106
|
*/
|
|
281
107
|
GeoClass.prototype.listGeofences = function (options) {
|
|
282
108
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
283
|
-
|
|
284
|
-
|
|
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
|
-
}
|
|
109
|
+
return tslib_1.__generator(this, function (_a) {
|
|
110
|
+
return [2 /*return*/, _super.prototype.listGeofences.call(this, options)];
|
|
300
111
|
});
|
|
301
112
|
});
|
|
302
113
|
};
|
|
@@ -310,35 +121,14 @@ var GeoClass = /** @class */ (function () {
|
|
|
310
121
|
*/
|
|
311
122
|
GeoClass.prototype.deleteGeofences = function (geofenceIds, options) {
|
|
312
123
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
}
|
|
124
|
+
return tslib_1.__generator(this, function (_a) {
|
|
125
|
+
return [2 /*return*/, _super.prototype.deleteGeofences.call(this, geofenceIds, options)];
|
|
336
126
|
});
|
|
337
127
|
});
|
|
338
128
|
};
|
|
339
129
|
GeoClass.MODULE = 'Geo';
|
|
340
130
|
return GeoClass;
|
|
341
|
-
}());
|
|
131
|
+
}(InternalGeo_1.InternalGeoClass));
|
|
342
132
|
exports.GeoClass = GeoClass;
|
|
343
133
|
exports.Geo = new GeoClass();
|
|
344
134
|
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;AACrE,sCAAsC;AACtC,0CAAqE;AAgBrE,uDAA2D;AAE3D;IAA8B,oCAAgB;IAA9C;;IAsHA,CAAC;IAnHA;;;OAGG;IACI,gCAAa,GAApB;QACC,OAAO,QAAQ,CAAC,MAAM,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACU,+BAAY,GAAzB,UACC,IAAY,EACZ,OAA6B;;;gBAE7B,sBAAO,iBAAM,YAAY,YAAC,IAAI,EAAE,OAAO,CAAC,EAAC;;;KACzC;IAED;;;;;OAKG;IACU,uCAAoB,GAAjC,UACC,IAAY,EACZ,OAA6B;;;gBAE7B,sBAAO,iBAAM,oBAAoB,YAAC,IAAI,EAAE,OAAO,CAAC,EAAC;;;KACjD;IAED;;;;;OAKG;IACU,kCAAe,GAA5B,UACC,OAAe,EACf,OAAgC;;;gBAEhC,sBAAO,iBAAM,eAAe,YAAC,OAAO,EAAE,OAAO,CAAC,EAAC;;;KAC/C;IAED;;;;;OAKG;IACU,sCAAmB,GAAhC,UACC,WAAwB,EACxB,OAAoC;;;gBAEpC,sBAAO,iBAAM,mBAAmB,YAAC,WAAW,EAAE,OAAO,CAAC,EAAC;;;KACvD;IAED;;;;;;;OAOG;IACU,gCAAa,GAA1B,UACC,SAA0C,EAC1C,OAAyB;;;gBAEzB,sBAAO,iBAAM,aAAa,YAAC,SAAS,EAAE,OAAO,CAAC,EAAC;;;KAC/C;IAED;;;;;OAKG;IACU,8BAAW,GAAxB,UACC,UAAsB,EACtB,OAAyB;;;gBAEzB,sBAAO,iBAAM,WAAW,YAAC,UAAU,EAAE,OAAO,CAAC,EAAC;;;KAC9C;IAED;;;;;;OAMG;IACU,gCAAa,GAA1B,UACC,OAA6B;;;gBAE7B,sBAAO,iBAAM,aAAa,YAAC,OAAO,CAAC,EAAC;;;KACpC;IAED;;;;;;;OAOG;IACU,kCAAe,GAA5B,UACC,WAA8B,EAC9B,OAAyB;;;gBAEzB,sBAAO,iBAAM,eAAe,YAAC,WAAW,EAAE,OAAO,CAAC,EAAC;;;KACnD;IApHM,eAAM,GAAG,KAAK,CAAC;IAqHvB,eAAC;CAAA,AAtHD,CAA8B,8BAAgB,GAsH7C;AAtHY,4BAAQ;AAwHR,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;AAClC,cAAO,CAAC,QAAQ,CAAC,WAAG,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CustomUserAgentDetails } from '@aws-amplify/core';
|
|
1
2
|
import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, SearchForSuggestionsResults, GeofenceId, GeofenceInput, AmazonLocationServiceGeofenceOptions, AmazonLocationServiceListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, AmazonLocationServiceGeofence, AmazonLocationServiceDeleteGeofencesResults, searchByPlaceIdOptions } from '../types';
|
|
2
3
|
export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
3
4
|
static CATEGORY: string;
|
|
@@ -43,23 +44,23 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
|
43
44
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
44
45
|
* @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
|
|
45
46
|
*/
|
|
46
|
-
searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
|
|
47
|
+
searchByText(text: string, options?: SearchByTextOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place[]>;
|
|
47
48
|
/**
|
|
48
49
|
* Search for suggestions based on the input text
|
|
49
50
|
* @param {string} text - The text string that is to be searched for
|
|
50
51
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
51
52
|
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
|
|
52
53
|
*/
|
|
53
|
-
searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<SearchForSuggestionsResults>;
|
|
54
|
+
searchForSuggestions(text: string, options?: SearchByTextOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<SearchForSuggestionsResults>;
|
|
54
55
|
private _verifyPlaceId;
|
|
55
|
-
searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place | undefined>;
|
|
56
|
+
searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place | undefined>;
|
|
56
57
|
/**
|
|
57
58
|
* Reverse geocoding search via a coordinate point on the map
|
|
58
59
|
* @param coordinates - Coordinates array for the search input
|
|
59
60
|
* @param options - Options parameters for the search
|
|
60
61
|
* @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
|
|
61
62
|
*/
|
|
62
|
-
searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
|
|
63
|
+
searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place>;
|
|
63
64
|
/**
|
|
64
65
|
* Create geofences inside of a geofence collection
|
|
65
66
|
* @param geofences - Array of geofence objects to create
|
|
@@ -68,14 +69,14 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
|
68
69
|
* successes: list of geofences successfully created
|
|
69
70
|
* errors: list of geofences that failed to create
|
|
70
71
|
*/
|
|
71
|
-
saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions): Promise<SaveGeofencesResults>;
|
|
72
|
+
saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<SaveGeofencesResults>;
|
|
72
73
|
/**
|
|
73
74
|
* Get geofence from a geofence collection
|
|
74
75
|
* @param geofenceId:string
|
|
75
76
|
* @param options?: Optional parameters for getGeofence
|
|
76
77
|
* @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
|
|
77
78
|
*/
|
|
78
|
-
getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceGeofence>;
|
|
79
|
+
getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<AmazonLocationServiceGeofence>;
|
|
79
80
|
/**
|
|
80
81
|
* List geofences from a geofence collection
|
|
81
82
|
* @param options?: ListGeofenceOptions
|
|
@@ -83,7 +84,7 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
|
83
84
|
* entries: list of geofences - 100 geofences are listed per page
|
|
84
85
|
* nextToken: token for next page of geofences
|
|
85
86
|
*/
|
|
86
|
-
listGeofences(options?: AmazonLocationServiceListGeofenceOptions): Promise<ListGeofenceResults>;
|
|
87
|
+
listGeofences(options?: AmazonLocationServiceListGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<ListGeofenceResults>;
|
|
87
88
|
/**
|
|
88
89
|
* Delete geofences from a geofence collection
|
|
89
90
|
* @param geofenceIds: string|string[]
|
|
@@ -92,7 +93,7 @@ export declare class AmazonLocationServiceProvider implements GeoProvider {
|
|
|
92
93
|
* successes: list of geofences successfully deleted
|
|
93
94
|
* errors: list of geofences that failed to delete
|
|
94
95
|
*/
|
|
95
|
-
deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceDeleteGeofencesResults>;
|
|
96
|
+
deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<AmazonLocationServiceDeleteGeofencesResults>;
|
|
96
97
|
/**
|
|
97
98
|
* @private
|
|
98
99
|
*/
|
|
@@ -75,7 +75,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
75
75
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
76
76
|
* @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
|
|
77
77
|
*/
|
|
78
|
-
AmazonLocationServiceProvider.prototype.searchByText = function (text, options) {
|
|
78
|
+
AmazonLocationServiceProvider.prototype.searchByText = function (text, options, customUserAgentDetails) {
|
|
79
79
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
80
80
|
var credentialsOK, locationServiceInput, client, command, response, error_1, PascalResults, results;
|
|
81
81
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -100,7 +100,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
100
100
|
client = new client_location_1.LocationClient({
|
|
101
101
|
credentials: this._config.credentials,
|
|
102
102
|
region: this._config.region,
|
|
103
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
103
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
104
104
|
});
|
|
105
105
|
command = new client_location_1.SearchPlaceIndexForTextCommand(locationServiceInput);
|
|
106
106
|
_a.label = 2;
|
|
@@ -130,7 +130,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
130
130
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
131
131
|
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
|
|
132
132
|
*/
|
|
133
|
-
AmazonLocationServiceProvider.prototype.searchForSuggestions = function (text, options) {
|
|
133
|
+
AmazonLocationServiceProvider.prototype.searchForSuggestions = function (text, options, customUserAgentDetails) {
|
|
134
134
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
135
135
|
var credentialsOK, locationServiceInput, client, command, response, error_2, results;
|
|
136
136
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -155,7 +155,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
155
155
|
client = new client_location_1.LocationClient({
|
|
156
156
|
credentials: this._config.credentials,
|
|
157
157
|
region: this._config.region,
|
|
158
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
158
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
159
159
|
});
|
|
160
160
|
command = new client_location_1.SearchPlaceIndexForSuggestionsCommand(locationServiceInput);
|
|
161
161
|
_a.label = 2;
|
|
@@ -186,7 +186,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
186
186
|
throw new Error(errorString);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
AmazonLocationServiceProvider.prototype.searchByPlaceId = function (placeId, options) {
|
|
189
|
+
AmazonLocationServiceProvider.prototype.searchByPlaceId = function (placeId, options, customUserAgentDetails) {
|
|
190
190
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
191
191
|
var credentialsOK, client, searchByPlaceIdInput, command, response, error_3, place;
|
|
192
192
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -202,7 +202,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
202
202
|
client = new client_location_1.LocationClient({
|
|
203
203
|
credentials: this._config.credentials,
|
|
204
204
|
region: this._config.region,
|
|
205
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
205
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
206
206
|
});
|
|
207
207
|
searchByPlaceIdInput = {
|
|
208
208
|
PlaceId: placeId,
|
|
@@ -236,7 +236,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
236
236
|
* @param options - Options parameters for the search
|
|
237
237
|
* @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
|
|
238
238
|
*/
|
|
239
|
-
AmazonLocationServiceProvider.prototype.searchByCoordinates = function (coordinates, options) {
|
|
239
|
+
AmazonLocationServiceProvider.prototype.searchByCoordinates = function (coordinates, options, customUserAgentDetails) {
|
|
240
240
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
241
241
|
var credentialsOK, locationServiceInput, client, command, response, error_4, PascalResults, results;
|
|
242
242
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -261,7 +261,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
261
261
|
client = new client_location_1.LocationClient({
|
|
262
262
|
credentials: this._config.credentials,
|
|
263
263
|
region: this._config.region,
|
|
264
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
264
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
265
265
|
});
|
|
266
266
|
command = new client_location_1.SearchPlaceIndexForPositionCommand(locationServiceInput);
|
|
267
267
|
_a.label = 2;
|
|
@@ -293,7 +293,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
293
293
|
* successes: list of geofences successfully created
|
|
294
294
|
* errors: list of geofences that failed to create
|
|
295
295
|
*/
|
|
296
|
-
AmazonLocationServiceProvider.prototype.saveGeofences = function (geofences, options) {
|
|
296
|
+
AmazonLocationServiceProvider.prototype.saveGeofences = function (geofences, options, customUserAgentDetails) {
|
|
297
297
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
298
298
|
var credentialsOK, PascalGeofences, results, geofenceBatches, apiLimit;
|
|
299
299
|
var _this = this;
|
|
@@ -342,7 +342,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
342
342
|
switch (_a.label) {
|
|
343
343
|
case 0:
|
|
344
344
|
_a.trys.push([0, 2, , 3]);
|
|
345
|
-
return [4 /*yield*/, this._AmazonLocationServiceBatchPutGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default)];
|
|
345
|
+
return [4 /*yield*/, this._AmazonLocationServiceBatchPutGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default, customUserAgentDetails)];
|
|
346
346
|
case 1:
|
|
347
347
|
response = _a.sent();
|
|
348
348
|
return [3 /*break*/, 3];
|
|
@@ -397,7 +397,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
397
397
|
* @param options?: Optional parameters for getGeofence
|
|
398
398
|
* @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
|
|
399
399
|
*/
|
|
400
|
-
AmazonLocationServiceProvider.prototype.getGeofence = function (geofenceId, options) {
|
|
400
|
+
AmazonLocationServiceProvider.prototype.getGeofence = function (geofenceId, options, customUserAgentDetails) {
|
|
401
401
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
402
402
|
var credentialsOK, client, commandInput, command, response, error_6, GeofenceId, CreateTime, UpdateTime, Status, Geometry, geofence;
|
|
403
403
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -420,7 +420,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
420
420
|
client = new client_location_1.LocationClient({
|
|
421
421
|
credentials: this._config.credentials,
|
|
422
422
|
region: this._config.region,
|
|
423
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
423
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
424
424
|
});
|
|
425
425
|
commandInput = {
|
|
426
426
|
GeofenceId: geofenceId,
|
|
@@ -461,7 +461,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
461
461
|
* entries: list of geofences - 100 geofences are listed per page
|
|
462
462
|
* nextToken: token for next page of geofences
|
|
463
463
|
*/
|
|
464
|
-
AmazonLocationServiceProvider.prototype.listGeofences = function (options) {
|
|
464
|
+
AmazonLocationServiceProvider.prototype.listGeofences = function (options, customUserAgentDetails) {
|
|
465
465
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
466
466
|
var credentialsOK, client, listGeofencesInput, command, response, error_7, NextToken, Entries, results;
|
|
467
467
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -483,7 +483,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
483
483
|
client = new client_location_1.LocationClient({
|
|
484
484
|
credentials: this._config.credentials,
|
|
485
485
|
region: this._config.region,
|
|
486
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
486
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
487
487
|
});
|
|
488
488
|
listGeofencesInput = {
|
|
489
489
|
NextToken: options === null || options === void 0 ? void 0 : options.nextToken,
|
|
@@ -531,7 +531,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
531
531
|
* successes: list of geofences successfully deleted
|
|
532
532
|
* errors: list of geofences that failed to delete
|
|
533
533
|
*/
|
|
534
|
-
AmazonLocationServiceProvider.prototype.deleteGeofences = function (geofenceIds, options) {
|
|
534
|
+
AmazonLocationServiceProvider.prototype.deleteGeofences = function (geofenceIds, options, customUserAgentDetails) {
|
|
535
535
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
536
536
|
var credentialsOK, badGeofenceIds, results, geofenceIdBatches, count;
|
|
537
537
|
var _this = this;
|
|
@@ -575,7 +575,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
575
575
|
switch (_b.label) {
|
|
576
576
|
case 0:
|
|
577
577
|
_b.trys.push([0, 2, , 3]);
|
|
578
|
-
return [4 /*yield*/, this._AmazonLocationServiceBatchDeleteGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default)];
|
|
578
|
+
return [4 /*yield*/, this._AmazonLocationServiceBatchDeleteGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default, customUserAgentDetails)];
|
|
579
579
|
case 1:
|
|
580
580
|
response = _b.sent();
|
|
581
581
|
return [3 /*break*/, 3];
|
|
@@ -667,7 +667,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
667
667
|
throw new Error(errorString);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchPutGeofenceCall = function (PascalGeofences, collectionName) {
|
|
670
|
+
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchPutGeofenceCall = function (PascalGeofences, collectionName, customUserAgentDetails) {
|
|
671
671
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
672
672
|
var geofenceInput, client, command, response, error_10;
|
|
673
673
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -680,7 +680,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
680
680
|
client = new client_location_1.LocationClient({
|
|
681
681
|
credentials: this._config.credentials,
|
|
682
682
|
region: this._config.region,
|
|
683
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
683
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
684
684
|
});
|
|
685
685
|
command = new client_location_1.BatchPutGeofenceCommand(geofenceInput);
|
|
686
686
|
_a.label = 1;
|
|
@@ -698,7 +698,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
698
698
|
});
|
|
699
699
|
});
|
|
700
700
|
};
|
|
701
|
-
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchDeleteGeofenceCall = function (geofenceIds, collectionName) {
|
|
701
|
+
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchDeleteGeofenceCall = function (geofenceIds, collectionName, customUserAgentDetails) {
|
|
702
702
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
703
703
|
var deleteGeofencesInput, client, command, response, error_11;
|
|
704
704
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -711,7 +711,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
711
711
|
client = new client_location_1.LocationClient({
|
|
712
712
|
credentials: this._config.credentials,
|
|
713
713
|
region: this._config.region,
|
|
714
|
-
customUserAgent: core_1.getAmplifyUserAgentObject(),
|
|
714
|
+
customUserAgent: core_1.getAmplifyUserAgentObject(customUserAgentDetails),
|
|
715
715
|
});
|
|
716
716
|
command = new client_location_1.BatchDeleteGeofenceCommand(deleteGeofencesInput);
|
|
717
717
|
_a.label = 1;
|