@aws-amplify/geo 2.3.4-user-agent-backup.c6dfb36.0 → 2.3.4
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-esm/Geo.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { __awaiter,
|
|
1
|
+
import { __awaiter, __generator, __read } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { Amplify } from '@aws-amplify/core';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { Amplify, ConsoleLogger as Logger, parseAWSExports, } from '@aws-amplify/core';
|
|
5
|
+
import { AmazonLocationServiceProvider } from './Providers/AmazonLocationServiceProvider';
|
|
6
|
+
import { validateCoordinates } from './util';
|
|
7
|
+
var logger = new Logger('Geo');
|
|
8
|
+
var DEFAULT_PROVIDER = 'AmazonLocationService';
|
|
9
|
+
var GeoClass = /** @class */ (function () {
|
|
8
10
|
function GeoClass() {
|
|
9
|
-
|
|
11
|
+
this._config = {};
|
|
12
|
+
this._pluggables = [];
|
|
13
|
+
logger.debug('Geo Options', this._config);
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
12
16
|
* get the name of the module category
|
|
@@ -15,6 +19,78 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
15
19
|
GeoClass.prototype.getModuleName = function () {
|
|
16
20
|
return GeoClass.MODULE;
|
|
17
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* add plugin into Geo category
|
|
24
|
+
* @param {Object} pluggable - an instance of the plugin
|
|
25
|
+
*/
|
|
26
|
+
GeoClass.prototype.addPluggable = function (pluggable) {
|
|
27
|
+
if (pluggable && pluggable.getCategory() === 'Geo') {
|
|
28
|
+
this._pluggables.push(pluggable);
|
|
29
|
+
var config = pluggable.configure(this._config[pluggable.getProviderName()]);
|
|
30
|
+
return config;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Get the plugin object
|
|
35
|
+
* @param providerName - the name of the plugin
|
|
36
|
+
*/
|
|
37
|
+
GeoClass.prototype.getPluggable = function (providerName) {
|
|
38
|
+
var pluggable = this._pluggables.find(function (pluggable) { return pluggable.getProviderName() === providerName; });
|
|
39
|
+
if (pluggable === undefined) {
|
|
40
|
+
logger.debug('No plugin found with providerName', providerName);
|
|
41
|
+
throw new Error('No plugin found in Geo for the provider');
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
return pluggable;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Remove the plugin object
|
|
48
|
+
* @param providerName - the name of the plugin
|
|
49
|
+
*/
|
|
50
|
+
GeoClass.prototype.removePluggable = function (providerName) {
|
|
51
|
+
this._pluggables = this._pluggables.filter(function (pluggable) { return pluggable.getProviderName() !== providerName; });
|
|
52
|
+
return;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Configure Geo
|
|
56
|
+
* @param {Object} config - Configuration object for Geo
|
|
57
|
+
* @return {Object} - Current configuration
|
|
58
|
+
*/
|
|
59
|
+
GeoClass.prototype.configure = function (config) {
|
|
60
|
+
var _this = this;
|
|
61
|
+
logger.debug('configure Geo');
|
|
62
|
+
if (!config)
|
|
63
|
+
return this._config;
|
|
64
|
+
var amplifyConfig = parseAWSExports(config);
|
|
65
|
+
this._config = Object.assign({}, this._config, amplifyConfig.Geo, config);
|
|
66
|
+
this._pluggables.forEach(function (pluggable) {
|
|
67
|
+
pluggable.configure(_this._config[pluggable.getProviderName()]);
|
|
68
|
+
});
|
|
69
|
+
if (this._pluggables.length === 0) {
|
|
70
|
+
this.addPluggable(new AmazonLocationServiceProvider());
|
|
71
|
+
}
|
|
72
|
+
return this._config;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Get the map resources that are currently available through the provider
|
|
76
|
+
* @param {string} provider
|
|
77
|
+
* @returns - Array of available map resources
|
|
78
|
+
*/
|
|
79
|
+
GeoClass.prototype.getAvailableMaps = function (provider) {
|
|
80
|
+
if (provider === void 0) { provider = DEFAULT_PROVIDER; }
|
|
81
|
+
var prov = this.getPluggable(provider);
|
|
82
|
+
return prov.getAvailableMaps();
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Get the map resource set as default in amplify config
|
|
86
|
+
* @param {string} provider
|
|
87
|
+
* @returns - Map resource set as the default in amplify config
|
|
88
|
+
*/
|
|
89
|
+
GeoClass.prototype.getDefaultMap = function (provider) {
|
|
90
|
+
if (provider === void 0) { provider = DEFAULT_PROVIDER; }
|
|
91
|
+
var prov = this.getPluggable(provider);
|
|
92
|
+
return prov.getDefaultMap();
|
|
93
|
+
};
|
|
18
94
|
/**
|
|
19
95
|
* Search by text input with optional parameters
|
|
20
96
|
* @param {string} text - The text string that is to be searched for
|
|
@@ -23,8 +99,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
23
99
|
*/
|
|
24
100
|
GeoClass.prototype.searchByText = function (text, options) {
|
|
25
101
|
return __awaiter(this, void 0, void 0, function () {
|
|
26
|
-
|
|
27
|
-
|
|
102
|
+
var _a, providerName, prov, error_1;
|
|
103
|
+
return __generator(this, function (_b) {
|
|
104
|
+
switch (_b.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
107
|
+
prov = this.getPluggable(providerName);
|
|
108
|
+
_b.label = 1;
|
|
109
|
+
case 1:
|
|
110
|
+
_b.trys.push([1, 3, , 4]);
|
|
111
|
+
return [4 /*yield*/, prov.searchByText(text, options)];
|
|
112
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
113
|
+
case 3:
|
|
114
|
+
error_1 = _b.sent();
|
|
115
|
+
logger.debug(error_1);
|
|
116
|
+
throw error_1;
|
|
117
|
+
case 4: return [2 /*return*/];
|
|
118
|
+
}
|
|
28
119
|
});
|
|
29
120
|
});
|
|
30
121
|
};
|
|
@@ -36,8 +127,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
36
127
|
*/
|
|
37
128
|
GeoClass.prototype.searchForSuggestions = function (text, options) {
|
|
38
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
39
|
-
|
|
40
|
-
|
|
130
|
+
var _a, providerName, prov, error_2;
|
|
131
|
+
return __generator(this, function (_b) {
|
|
132
|
+
switch (_b.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
135
|
+
prov = this.getPluggable(providerName);
|
|
136
|
+
_b.label = 1;
|
|
137
|
+
case 1:
|
|
138
|
+
_b.trys.push([1, 3, , 4]);
|
|
139
|
+
return [4 /*yield*/, prov.searchForSuggestions(text, options)];
|
|
140
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
141
|
+
case 3:
|
|
142
|
+
error_2 = _b.sent();
|
|
143
|
+
logger.debug(error_2);
|
|
144
|
+
throw error_2;
|
|
145
|
+
case 4: return [2 /*return*/];
|
|
146
|
+
}
|
|
41
147
|
});
|
|
42
148
|
});
|
|
43
149
|
};
|
|
@@ -49,8 +155,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
49
155
|
*/
|
|
50
156
|
GeoClass.prototype.searchByPlaceId = function (placeId, options) {
|
|
51
157
|
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
+
var providerName, prov, error_3;
|
|
52
159
|
return __generator(this, function (_a) {
|
|
53
|
-
|
|
160
|
+
switch (_a.label) {
|
|
161
|
+
case 0:
|
|
162
|
+
providerName = DEFAULT_PROVIDER;
|
|
163
|
+
prov = this.getPluggable(providerName);
|
|
164
|
+
_a.label = 1;
|
|
165
|
+
case 1:
|
|
166
|
+
_a.trys.push([1, 3, , 4]);
|
|
167
|
+
return [4 /*yield*/, prov.searchByPlaceId(placeId, options)];
|
|
168
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
169
|
+
case 3:
|
|
170
|
+
error_3 = _a.sent();
|
|
171
|
+
logger.debug(error_3);
|
|
172
|
+
throw error_3;
|
|
173
|
+
case 4: return [2 /*return*/];
|
|
174
|
+
}
|
|
54
175
|
});
|
|
55
176
|
});
|
|
56
177
|
};
|
|
@@ -62,8 +183,25 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
62
183
|
*/
|
|
63
184
|
GeoClass.prototype.searchByCoordinates = function (coordinates, options) {
|
|
64
185
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
|
|
66
|
-
|
|
186
|
+
var _a, providerName, prov, _b, lng, lat, error_4;
|
|
187
|
+
return __generator(this, function (_c) {
|
|
188
|
+
switch (_c.label) {
|
|
189
|
+
case 0:
|
|
190
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
191
|
+
prov = this.getPluggable(providerName);
|
|
192
|
+
_b = __read(coordinates, 2), lng = _b[0], lat = _b[1];
|
|
193
|
+
_c.label = 1;
|
|
194
|
+
case 1:
|
|
195
|
+
_c.trys.push([1, 3, , 4]);
|
|
196
|
+
validateCoordinates(lng, lat);
|
|
197
|
+
return [4 /*yield*/, prov.searchByCoordinates(coordinates, options)];
|
|
198
|
+
case 2: return [2 /*return*/, _c.sent()];
|
|
199
|
+
case 3:
|
|
200
|
+
error_4 = _c.sent();
|
|
201
|
+
logger.debug(error_4);
|
|
202
|
+
throw error_4;
|
|
203
|
+
case 4: return [2 /*return*/];
|
|
204
|
+
}
|
|
67
205
|
});
|
|
68
206
|
});
|
|
69
207
|
};
|
|
@@ -77,8 +215,29 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
77
215
|
*/
|
|
78
216
|
GeoClass.prototype.saveGeofences = function (geofences, options) {
|
|
79
217
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
|
|
81
|
-
|
|
218
|
+
var _a, providerName, prov, geofenceInputArray, error_5;
|
|
219
|
+
return __generator(this, function (_b) {
|
|
220
|
+
switch (_b.label) {
|
|
221
|
+
case 0:
|
|
222
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
223
|
+
prov = this.getPluggable(providerName);
|
|
224
|
+
if (!Array.isArray(geofences)) {
|
|
225
|
+
geofenceInputArray = [geofences];
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
geofenceInputArray = geofences;
|
|
229
|
+
}
|
|
230
|
+
_b.label = 1;
|
|
231
|
+
case 1:
|
|
232
|
+
_b.trys.push([1, 3, , 4]);
|
|
233
|
+
return [4 /*yield*/, prov.saveGeofences(geofenceInputArray, options)];
|
|
234
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
235
|
+
case 3:
|
|
236
|
+
error_5 = _b.sent();
|
|
237
|
+
logger.debug(error_5);
|
|
238
|
+
throw error_5;
|
|
239
|
+
case 4: return [2 /*return*/];
|
|
240
|
+
}
|
|
82
241
|
});
|
|
83
242
|
});
|
|
84
243
|
};
|
|
@@ -90,8 +249,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
90
249
|
*/
|
|
91
250
|
GeoClass.prototype.getGeofence = function (geofenceId, options) {
|
|
92
251
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
|
|
94
|
-
|
|
252
|
+
var _a, providerName, prov, error_6;
|
|
253
|
+
return __generator(this, function (_b) {
|
|
254
|
+
switch (_b.label) {
|
|
255
|
+
case 0:
|
|
256
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
257
|
+
prov = this.getPluggable(providerName);
|
|
258
|
+
_b.label = 1;
|
|
259
|
+
case 1:
|
|
260
|
+
_b.trys.push([1, 3, , 4]);
|
|
261
|
+
return [4 /*yield*/, prov.getGeofence(geofenceId, options)];
|
|
262
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
263
|
+
case 3:
|
|
264
|
+
error_6 = _b.sent();
|
|
265
|
+
logger.debug(error_6);
|
|
266
|
+
throw error_6;
|
|
267
|
+
case 4: return [2 /*return*/];
|
|
268
|
+
}
|
|
95
269
|
});
|
|
96
270
|
});
|
|
97
271
|
};
|
|
@@ -104,8 +278,23 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
104
278
|
*/
|
|
105
279
|
GeoClass.prototype.listGeofences = function (options) {
|
|
106
280
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
|
|
108
|
-
|
|
281
|
+
var _a, providerName, prov, error_7;
|
|
282
|
+
return __generator(this, function (_b) {
|
|
283
|
+
switch (_b.label) {
|
|
284
|
+
case 0:
|
|
285
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
286
|
+
prov = this.getPluggable(providerName);
|
|
287
|
+
_b.label = 1;
|
|
288
|
+
case 1:
|
|
289
|
+
_b.trys.push([1, 3, , 4]);
|
|
290
|
+
return [4 /*yield*/, prov.listGeofences(options)];
|
|
291
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
292
|
+
case 3:
|
|
293
|
+
error_7 = _b.sent();
|
|
294
|
+
logger.debug(error_7);
|
|
295
|
+
throw error_7;
|
|
296
|
+
case 4: return [2 /*return*/];
|
|
297
|
+
}
|
|
109
298
|
});
|
|
110
299
|
});
|
|
111
300
|
};
|
|
@@ -119,14 +308,35 @@ var GeoClass = /** @class */ (function (_super) {
|
|
|
119
308
|
*/
|
|
120
309
|
GeoClass.prototype.deleteGeofences = function (geofenceIds, options) {
|
|
121
310
|
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
-
|
|
123
|
-
|
|
311
|
+
var _a, providerName, prov, geofenceIdsInputArray, error_8;
|
|
312
|
+
return __generator(this, function (_b) {
|
|
313
|
+
switch (_b.label) {
|
|
314
|
+
case 0:
|
|
315
|
+
_a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
|
|
316
|
+
prov = this.getPluggable(providerName);
|
|
317
|
+
if (!Array.isArray(geofenceIds)) {
|
|
318
|
+
geofenceIdsInputArray = [geofenceIds];
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
geofenceIdsInputArray = geofenceIds;
|
|
322
|
+
}
|
|
323
|
+
_b.label = 1;
|
|
324
|
+
case 1:
|
|
325
|
+
_b.trys.push([1, 3, , 4]);
|
|
326
|
+
return [4 /*yield*/, prov.deleteGeofences(geofenceIdsInputArray, options)];
|
|
327
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
328
|
+
case 3:
|
|
329
|
+
error_8 = _b.sent();
|
|
330
|
+
logger.debug(error_8);
|
|
331
|
+
throw error_8;
|
|
332
|
+
case 4: return [2 /*return*/];
|
|
333
|
+
}
|
|
124
334
|
});
|
|
125
335
|
});
|
|
126
336
|
};
|
|
127
337
|
GeoClass.MODULE = 'Geo';
|
|
128
338
|
return GeoClass;
|
|
129
|
-
}(
|
|
339
|
+
}());
|
|
130
340
|
export { GeoClass };
|
|
131
341
|
export var Geo = new GeoClass();
|
|
132
342
|
Amplify.register(Geo);
|
package/lib-esm/Geo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Geo.js","sourceRoot":"","sources":["../src/Geo.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"Geo.js","sourceRoot":"","sources":["../src/Geo.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EACN,OAAO,EACP,aAAa,IAAI,MAAM,EACvB,eAAe,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAE1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAqB7C,IAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AAEjC,IAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD;IAQC;QACC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC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ordinatesOptions, 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
|
*/
|
|
@@ -71,10 +71,9 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
71
71
|
* Search by text input with optional parameters
|
|
72
72
|
* @param {string} text - The text string that is to be searched for
|
|
73
73
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
74
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
75
74
|
* @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
|
|
76
75
|
*/
|
|
77
|
-
AmazonLocationServiceProvider.prototype.searchByText = function (text, options
|
|
76
|
+
AmazonLocationServiceProvider.prototype.searchByText = function (text, options) {
|
|
78
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
78
|
var credentialsOK, locationServiceInput, client, command, response, error_1, PascalResults, results;
|
|
80
79
|
return __generator(this, function (_a) {
|
|
@@ -99,7 +98,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
99
98
|
client = new LocationClient({
|
|
100
99
|
credentials: this._config.credentials,
|
|
101
100
|
region: this._config.region,
|
|
102
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
101
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
103
102
|
});
|
|
104
103
|
command = new SearchPlaceIndexForTextCommand(locationServiceInput);
|
|
105
104
|
_a.label = 2;
|
|
@@ -127,10 +126,9 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
127
126
|
* Search for suggestions based on the input text
|
|
128
127
|
* @param {string} text - The text string that is to be searched for
|
|
129
128
|
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
130
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
131
129
|
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
|
|
132
130
|
*/
|
|
133
|
-
AmazonLocationServiceProvider.prototype.searchForSuggestions = function (text, options
|
|
131
|
+
AmazonLocationServiceProvider.prototype.searchForSuggestions = function (text, options) {
|
|
134
132
|
return __awaiter(this, void 0, void 0, function () {
|
|
135
133
|
var credentialsOK, locationServiceInput, client, command, response, error_2, results;
|
|
136
134
|
return __generator(this, function (_a) {
|
|
@@ -155,7 +153,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
155
153
|
client = new LocationClient({
|
|
156
154
|
credentials: this._config.credentials,
|
|
157
155
|
region: this._config.region,
|
|
158
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
156
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
159
157
|
});
|
|
160
158
|
command = new SearchPlaceIndexForSuggestionsCommand(locationServiceInput);
|
|
161
159
|
_a.label = 2;
|
|
@@ -186,7 +184,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
186
184
|
throw new Error(errorString);
|
|
187
185
|
}
|
|
188
186
|
};
|
|
189
|
-
AmazonLocationServiceProvider.prototype.searchByPlaceId = function (placeId, options
|
|
187
|
+
AmazonLocationServiceProvider.prototype.searchByPlaceId = function (placeId, options) {
|
|
190
188
|
return __awaiter(this, void 0, void 0, function () {
|
|
191
189
|
var credentialsOK, client, searchByPlaceIdInput, command, response, error_3, place;
|
|
192
190
|
return __generator(this, function (_a) {
|
|
@@ -202,7 +200,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
202
200
|
client = new LocationClient({
|
|
203
201
|
credentials: this._config.credentials,
|
|
204
202
|
region: this._config.region,
|
|
205
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
203
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
206
204
|
});
|
|
207
205
|
searchByPlaceIdInput = {
|
|
208
206
|
PlaceId: placeId,
|
|
@@ -236,7 +234,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
236
234
|
* @param options - Options parameters for the search
|
|
237
235
|
* @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
|
|
238
236
|
*/
|
|
239
|
-
AmazonLocationServiceProvider.prototype.searchByCoordinates = function (coordinates, options
|
|
237
|
+
AmazonLocationServiceProvider.prototype.searchByCoordinates = function (coordinates, options) {
|
|
240
238
|
return __awaiter(this, void 0, void 0, function () {
|
|
241
239
|
var credentialsOK, locationServiceInput, client, command, response, error_4, PascalResults, results;
|
|
242
240
|
return __generator(this, function (_a) {
|
|
@@ -261,7 +259,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
261
259
|
client = new LocationClient({
|
|
262
260
|
credentials: this._config.credentials,
|
|
263
261
|
region: this._config.region,
|
|
264
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
262
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
265
263
|
});
|
|
266
264
|
command = new SearchPlaceIndexForPositionCommand(locationServiceInput);
|
|
267
265
|
_a.label = 2;
|
|
@@ -289,12 +287,11 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
289
287
|
* Create geofences inside of a geofence collection
|
|
290
288
|
* @param geofences - Array of geofence objects to create
|
|
291
289
|
* @param options? - Optional parameters for creating geofences
|
|
292
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
293
290
|
* @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
|
|
294
291
|
* successes: list of geofences successfully created
|
|
295
292
|
* errors: list of geofences that failed to create
|
|
296
293
|
*/
|
|
297
|
-
AmazonLocationServiceProvider.prototype.saveGeofences = function (geofences, options
|
|
294
|
+
AmazonLocationServiceProvider.prototype.saveGeofences = function (geofences, options) {
|
|
298
295
|
return __awaiter(this, void 0, void 0, function () {
|
|
299
296
|
var credentialsOK, PascalGeofences, results, geofenceBatches, apiLimit;
|
|
300
297
|
var _this = this;
|
|
@@ -343,7 +340,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
343
340
|
switch (_a.label) {
|
|
344
341
|
case 0:
|
|
345
342
|
_a.trys.push([0, 2, , 3]);
|
|
346
|
-
return [4 /*yield*/, this._AmazonLocationServiceBatchPutGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default
|
|
343
|
+
return [4 /*yield*/, this._AmazonLocationServiceBatchPutGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default)];
|
|
347
344
|
case 1:
|
|
348
345
|
response = _a.sent();
|
|
349
346
|
return [3 /*break*/, 3];
|
|
@@ -396,10 +393,9 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
396
393
|
* Get geofence from a geofence collection
|
|
397
394
|
* @param geofenceId:string
|
|
398
395
|
* @param options?: Optional parameters for getGeofence
|
|
399
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
400
396
|
* @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
|
|
401
397
|
*/
|
|
402
|
-
AmazonLocationServiceProvider.prototype.getGeofence = function (geofenceId, options
|
|
398
|
+
AmazonLocationServiceProvider.prototype.getGeofence = function (geofenceId, options) {
|
|
403
399
|
return __awaiter(this, void 0, void 0, function () {
|
|
404
400
|
var credentialsOK, client, commandInput, command, response, error_6, GeofenceId, CreateTime, UpdateTime, Status, Geometry, geofence;
|
|
405
401
|
return __generator(this, function (_a) {
|
|
@@ -422,7 +418,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
422
418
|
client = new LocationClient({
|
|
423
419
|
credentials: this._config.credentials,
|
|
424
420
|
region: this._config.region,
|
|
425
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
421
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
426
422
|
});
|
|
427
423
|
commandInput = {
|
|
428
424
|
GeofenceId: geofenceId,
|
|
@@ -459,12 +455,11 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
459
455
|
/**
|
|
460
456
|
* List geofences from a geofence collection
|
|
461
457
|
* @param options?: ListGeofenceOptions
|
|
462
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
463
458
|
* @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
|
|
464
459
|
* entries: list of geofences - 100 geofences are listed per page
|
|
465
460
|
* nextToken: token for next page of geofences
|
|
466
461
|
*/
|
|
467
|
-
AmazonLocationServiceProvider.prototype.listGeofences = function (options
|
|
462
|
+
AmazonLocationServiceProvider.prototype.listGeofences = function (options) {
|
|
468
463
|
return __awaiter(this, void 0, void 0, function () {
|
|
469
464
|
var credentialsOK, client, listGeofencesInput, command, response, error_7, NextToken, Entries, results;
|
|
470
465
|
return __generator(this, function (_a) {
|
|
@@ -486,7 +481,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
486
481
|
client = new LocationClient({
|
|
487
482
|
credentials: this._config.credentials,
|
|
488
483
|
region: this._config.region,
|
|
489
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
484
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
490
485
|
});
|
|
491
486
|
listGeofencesInput = {
|
|
492
487
|
NextToken: options === null || options === void 0 ? void 0 : options.nextToken,
|
|
@@ -530,12 +525,11 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
530
525
|
* Delete geofences from a geofence collection
|
|
531
526
|
* @param geofenceIds: string|string[]
|
|
532
527
|
* @param options?: GeofenceOptions
|
|
533
|
-
* @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
|
|
534
528
|
* @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
|
|
535
529
|
* successes: list of geofences successfully deleted
|
|
536
530
|
* errors: list of geofences that failed to delete
|
|
537
531
|
*/
|
|
538
|
-
AmazonLocationServiceProvider.prototype.deleteGeofences = function (geofenceIds, options
|
|
532
|
+
AmazonLocationServiceProvider.prototype.deleteGeofences = function (geofenceIds, options) {
|
|
539
533
|
return __awaiter(this, void 0, void 0, function () {
|
|
540
534
|
var credentialsOK, badGeofenceIds, results, geofenceIdBatches, count;
|
|
541
535
|
var _this = this;
|
|
@@ -579,7 +573,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
579
573
|
switch (_b.label) {
|
|
580
574
|
case 0:
|
|
581
575
|
_b.trys.push([0, 2, , 3]);
|
|
582
|
-
return [4 /*yield*/, this._AmazonLocationServiceBatchDeleteGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default
|
|
576
|
+
return [4 /*yield*/, this._AmazonLocationServiceBatchDeleteGeofenceCall(batch, (options === null || options === void 0 ? void 0 : options.collectionName) || this._config.geofenceCollections.default)];
|
|
583
577
|
case 1:
|
|
584
578
|
response = _b.sent();
|
|
585
579
|
return [3 /*break*/, 3];
|
|
@@ -671,7 +665,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
671
665
|
throw new Error(errorString);
|
|
672
666
|
}
|
|
673
667
|
};
|
|
674
|
-
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchPutGeofenceCall = function (PascalGeofences, collectionName
|
|
668
|
+
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchPutGeofenceCall = function (PascalGeofences, collectionName) {
|
|
675
669
|
return __awaiter(this, void 0, void 0, function () {
|
|
676
670
|
var geofenceInput, client, command, response, error_10;
|
|
677
671
|
return __generator(this, function (_a) {
|
|
@@ -684,7 +678,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
684
678
|
client = new LocationClient({
|
|
685
679
|
credentials: this._config.credentials,
|
|
686
680
|
region: this._config.region,
|
|
687
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
681
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
688
682
|
});
|
|
689
683
|
command = new BatchPutGeofenceCommand(geofenceInput);
|
|
690
684
|
_a.label = 1;
|
|
@@ -702,7 +696,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
702
696
|
});
|
|
703
697
|
});
|
|
704
698
|
};
|
|
705
|
-
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchDeleteGeofenceCall = function (geofenceIds, collectionName
|
|
699
|
+
AmazonLocationServiceProvider.prototype._AmazonLocationServiceBatchDeleteGeofenceCall = function (geofenceIds, collectionName) {
|
|
706
700
|
return __awaiter(this, void 0, void 0, function () {
|
|
707
701
|
var deleteGeofencesInput, client, command, response, error_11;
|
|
708
702
|
return __generator(this, function (_a) {
|
|
@@ -715,7 +709,7 @@ var AmazonLocationServiceProvider = /** @class */ (function () {
|
|
|
715
709
|
client = new LocationClient({
|
|
716
710
|
credentials: this._config.credentials,
|
|
717
711
|
region: this._config.region,
|
|
718
|
-
customUserAgent: getAmplifyUserAgentObject(
|
|
712
|
+
customUserAgent: getAmplifyUserAgentObject(),
|
|
719
713
|
});
|
|
720
714
|
command = new BatchDeleteGeofenceCommand(deleteGeofencesInput);
|
|
721
715
|
_a.label = 1;
|