@aws-amplify/geo 2.1.4-api-v6.25 → 2.1.4-api-v6-models.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/internals/package.json +8 -0
  2. package/lib/Geo.d.ts +3 -41
  3. package/lib/Geo.js +20 -230
  4. package/lib/Geo.js.map +1 -1
  5. package/lib/Providers/AmazonLocationServiceProvider.d.ts +15 -8
  6. package/lib/Providers/AmazonLocationServiceProvider.js +26 -20
  7. package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
  8. package/lib/internals/InternalGeo.d.ts +119 -0
  9. package/lib/internals/InternalGeo.js +354 -0
  10. package/lib/internals/InternalGeo.js.map +1 -0
  11. package/lib/internals/index.d.ts +1 -0
  12. package/lib/internals/index.js +7 -0
  13. package/lib/internals/index.js.map +1 -0
  14. package/lib/internals/utils.d.ts +2 -0
  15. package/lib/internals/utils.js +10 -0
  16. package/lib/internals/utils.js.map +1 -0
  17. package/lib/types/Provider.d.ts +9 -8
  18. package/lib-esm/Geo.d.ts +3 -41
  19. package/lib-esm/Geo.js +22 -232
  20. package/lib-esm/Geo.js.map +1 -1
  21. package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +15 -8
  22. package/lib-esm/Providers/AmazonLocationServiceProvider.js +26 -20
  23. package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
  24. package/lib-esm/internals/InternalGeo.d.ts +119 -0
  25. package/lib-esm/internals/InternalGeo.js +352 -0
  26. package/lib-esm/internals/InternalGeo.js.map +1 -0
  27. package/lib-esm/internals/index.d.ts +1 -0
  28. package/lib-esm/internals/index.js +4 -0
  29. package/lib-esm/internals/index.js.map +1 -0
  30. package/lib-esm/internals/utils.d.ts +2 -0
  31. package/lib-esm/internals/utils.js +8 -0
  32. package/lib-esm/internals/utils.js.map +1 -0
  33. package/lib-esm/types/Provider.d.ts +9 -8
  34. package/package.json +6 -5
  35. package/src/Geo.ts +11 -203
  36. package/src/Providers/AmazonLocationServiceProvider.ts +39 -20
  37. package/src/internals/InternalGeo.ts +393 -0
  38. package/src/internals/index.ts +3 -0
  39. package/src/internals/utils.ts +15 -0
  40. package/src/types/Provider.ts +22 -8
@@ -0,0 +1,354 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ // SPDX-License-Identifier: Apache-2.0
6
+ var core_1 = require("@aws-amplify/core");
7
+ var AmazonLocationServiceProvider_1 = require("../Providers/AmazonLocationServiceProvider");
8
+ var util_1 = require("../util");
9
+ var utils_1 = require("./utils");
10
+ var logger = new core_1.ConsoleLogger('Geo');
11
+ var DEFAULT_PROVIDER = 'AmazonLocationService';
12
+ var InternalGeoClass = /** @class */ (function () {
13
+ function InternalGeoClass() {
14
+ this._config = {};
15
+ this._pluggables = [];
16
+ logger.debug('Geo Options', this._config);
17
+ }
18
+ /**
19
+ * get the name of the module category
20
+ * @returns {string} name of the module category
21
+ */
22
+ InternalGeoClass.prototype.getModuleName = function () {
23
+ return InternalGeoClass.MODULE;
24
+ };
25
+ /**
26
+ * add plugin into Geo category
27
+ * @param {Object} pluggable - an instance of the plugin
28
+ */
29
+ InternalGeoClass.prototype.addPluggable = function (pluggable) {
30
+ if (pluggable && pluggable.getCategory() === 'Geo') {
31
+ this._pluggables.push(pluggable);
32
+ var config = pluggable.configure(this._config[pluggable.getProviderName()]);
33
+ return config;
34
+ }
35
+ };
36
+ /**
37
+ * Get the plugin object
38
+ * @param providerName - the name of the plugin
39
+ */
40
+ InternalGeoClass.prototype.getPluggable = function (providerName) {
41
+ var pluggable = this._pluggables.find(function (pluggable) { return pluggable.getProviderName() === providerName; });
42
+ if (pluggable === undefined) {
43
+ logger.debug('No plugin found with providerName', providerName);
44
+ throw new Error('No plugin found in Geo for the provider');
45
+ }
46
+ else
47
+ return pluggable;
48
+ };
49
+ /**
50
+ * Remove the plugin object
51
+ * @param providerName - the name of the plugin
52
+ */
53
+ InternalGeoClass.prototype.removePluggable = function (providerName) {
54
+ this._pluggables = this._pluggables.filter(function (pluggable) { return pluggable.getProviderName() !== providerName; });
55
+ return;
56
+ };
57
+ /**
58
+ * Configure Geo
59
+ * @param {Object} config - Configuration object for Geo
60
+ * @return {Object} - Current configuration
61
+ */
62
+ InternalGeoClass.prototype.configure = function (config) {
63
+ var _this = this;
64
+ logger.debug('configure Geo');
65
+ if (!config)
66
+ return this._config;
67
+ var amplifyConfig = core_1.parseAWSExports(config);
68
+ this._config = Object.assign({}, this._config, amplifyConfig.Geo, config);
69
+ this._pluggables.forEach(function (pluggable) {
70
+ pluggable.configure(_this._config[pluggable.getProviderName()]);
71
+ });
72
+ if (this._pluggables.length === 0) {
73
+ this.addPluggable(new AmazonLocationServiceProvider_1.AmazonLocationServiceProvider());
74
+ }
75
+ return this._config;
76
+ };
77
+ /**
78
+ * Get the map resources that are currently available through the provider
79
+ * @param {string} provider
80
+ * @returns - Array of available map resources
81
+ */
82
+ InternalGeoClass.prototype.getAvailableMaps = function (provider) {
83
+ if (provider === void 0) { provider = DEFAULT_PROVIDER; }
84
+ var prov = this.getPluggable(provider);
85
+ return prov.getAvailableMaps();
86
+ };
87
+ /**
88
+ * Get the map resource set as default in amplify config
89
+ * @param {string} provider
90
+ * @returns - Map resource set as the default in amplify config
91
+ */
92
+ InternalGeoClass.prototype.getDefaultMap = function (provider) {
93
+ if (provider === void 0) { provider = DEFAULT_PROVIDER; }
94
+ var prov = this.getPluggable(provider);
95
+ return prov.getDefaultMap();
96
+ };
97
+ /**
98
+ * Search by text input with optional parameters
99
+ * @param {string} text - The text string that is to be searched for
100
+ * @param {SearchByTextOptions} options? - Optional parameters to the search
101
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
102
+ * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
103
+ */
104
+ InternalGeoClass.prototype.searchByText = function (text, options, customUserAgentDetails) {
105
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
106
+ var _a, providerName, prov, error_1;
107
+ return tslib_1.__generator(this, function (_b) {
108
+ switch (_b.label) {
109
+ case 0:
110
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
111
+ prov = this.getPluggable(providerName);
112
+ _b.label = 1;
113
+ case 1:
114
+ _b.trys.push([1, 3, , 4]);
115
+ return [4 /*yield*/, prov.searchByText(text, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.SearchByText, customUserAgentDetails))];
116
+ case 2: return [2 /*return*/, _b.sent()];
117
+ case 3:
118
+ error_1 = _b.sent();
119
+ logger.debug(error_1);
120
+ throw error_1;
121
+ case 4: return [2 /*return*/];
122
+ }
123
+ });
124
+ });
125
+ };
126
+ /**
127
+ * Search for search term suggestions based on input text
128
+ * @param {string} text - The text string that is to be search for
129
+ * @param {SearchByTextOptions} options? - Optional parameters to the search
130
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
131
+ * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
132
+ */
133
+ InternalGeoClass.prototype.searchForSuggestions = function (text, options, customUserAgentDetails) {
134
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
135
+ var _a, providerName, prov, error_2;
136
+ return tslib_1.__generator(this, function (_b) {
137
+ switch (_b.label) {
138
+ case 0:
139
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
140
+ prov = this.getPluggable(providerName);
141
+ _b.label = 1;
142
+ case 1:
143
+ _b.trys.push([1, 3, , 4]);
144
+ return [4 /*yield*/, prov.searchForSuggestions(text, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.SearchForSuggestions, customUserAgentDetails))];
145
+ case 2: return [2 /*return*/, _b.sent()];
146
+ case 3:
147
+ error_2 = _b.sent();
148
+ logger.debug(error_2);
149
+ throw error_2;
150
+ case 4: return [2 /*return*/];
151
+ }
152
+ });
153
+ });
154
+ };
155
+ /**
156
+ * Search for location by unique ID
157
+ * @param {string} placeId - Unique ID of the location that is to be searched for
158
+ * @param {searchByPlaceIdOptions} options? - Optional parameters to the search
159
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
160
+ * @returns {Promise<Place>} - Resolves to a place with the given placeId
161
+ */
162
+ InternalGeoClass.prototype.searchByPlaceId = function (placeId, options, customUserAgentDetails) {
163
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
164
+ var providerName, prov, error_3;
165
+ return tslib_1.__generator(this, function (_a) {
166
+ switch (_a.label) {
167
+ case 0:
168
+ providerName = DEFAULT_PROVIDER;
169
+ prov = this.getPluggable(providerName);
170
+ _a.label = 1;
171
+ case 1:
172
+ _a.trys.push([1, 3, , 4]);
173
+ return [4 /*yield*/, prov.searchByPlaceId(placeId, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.SearchByPlaceId, customUserAgentDetails))];
174
+ case 2: return [2 /*return*/, _a.sent()];
175
+ case 3:
176
+ error_3 = _a.sent();
177
+ logger.debug(error_3);
178
+ throw error_3;
179
+ case 4: return [2 /*return*/];
180
+ }
181
+ });
182
+ });
183
+ };
184
+ /**
185
+ * Reverse geocoding search via a coordinate point on the map
186
+ * @param coordinates - Coordinates array for the search input
187
+ * @param options - Options parameters for the search
188
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
189
+ * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
190
+ */
191
+ InternalGeoClass.prototype.searchByCoordinates = function (coordinates, options, customUserAgentDetails) {
192
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
193
+ var _a, providerName, prov, _b, lng, lat, error_4;
194
+ return tslib_1.__generator(this, function (_c) {
195
+ switch (_c.label) {
196
+ case 0:
197
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
198
+ prov = this.getPluggable(providerName);
199
+ _b = tslib_1.__read(coordinates, 2), lng = _b[0], lat = _b[1];
200
+ _c.label = 1;
201
+ case 1:
202
+ _c.trys.push([1, 3, , 4]);
203
+ util_1.validateCoordinates(lng, lat);
204
+ return [4 /*yield*/, prov.searchByCoordinates(coordinates, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.SearchByCoordinates))];
205
+ case 2: return [2 /*return*/, _c.sent()];
206
+ case 3:
207
+ error_4 = _c.sent();
208
+ logger.debug(error_4);
209
+ throw error_4;
210
+ case 4: return [2 /*return*/];
211
+ }
212
+ });
213
+ });
214
+ };
215
+ /**
216
+ * Create geofences
217
+ * @param geofences - Single or array of geofence objects to create
218
+ * @param options? - Optional parameters for creating geofences
219
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
220
+ * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
221
+ * successes: list of geofences successfully created
222
+ * errors: list of geofences that failed to create
223
+ */
224
+ InternalGeoClass.prototype.saveGeofences = function (geofences, options, customUserAgentDetails) {
225
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
226
+ var _a, providerName, prov, geofenceInputArray, error_5;
227
+ return tslib_1.__generator(this, function (_b) {
228
+ switch (_b.label) {
229
+ case 0:
230
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
231
+ prov = this.getPluggable(providerName);
232
+ if (!Array.isArray(geofences)) {
233
+ geofenceInputArray = [geofences];
234
+ }
235
+ else {
236
+ geofenceInputArray = geofences;
237
+ }
238
+ _b.label = 1;
239
+ case 1:
240
+ _b.trys.push([1, 3, , 4]);
241
+ return [4 /*yield*/, prov.saveGeofences(geofenceInputArray, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.SaveGeofences, customUserAgentDetails))];
242
+ case 2: return [2 /*return*/, _b.sent()];
243
+ case 3:
244
+ error_5 = _b.sent();
245
+ logger.debug(error_5);
246
+ throw error_5;
247
+ case 4: return [2 /*return*/];
248
+ }
249
+ });
250
+ });
251
+ };
252
+ /**
253
+ * Get a single geofence by geofenceId
254
+ * @param geofenceId: GeofenceId - The string id of the geofence to get
255
+ * @param options?: GeofenceOptions - Optional parameters for getting a geofence
256
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
257
+ * @returns Promise<Geofence> - Promise that resolves to a geofence object
258
+ */
259
+ InternalGeoClass.prototype.getGeofence = function (geofenceId, options, customUserAgentDetails) {
260
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
261
+ var _a, providerName, prov, error_6;
262
+ return tslib_1.__generator(this, function (_b) {
263
+ switch (_b.label) {
264
+ case 0:
265
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
266
+ prov = this.getPluggable(providerName);
267
+ _b.label = 1;
268
+ case 1:
269
+ _b.trys.push([1, 3, , 4]);
270
+ return [4 /*yield*/, prov.getGeofence(geofenceId, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.GetGeofence, customUserAgentDetails))];
271
+ case 2: return [2 /*return*/, _b.sent()];
272
+ case 3:
273
+ error_6 = _b.sent();
274
+ logger.debug(error_6);
275
+ throw error_6;
276
+ case 4: return [2 /*return*/];
277
+ }
278
+ });
279
+ });
280
+ };
281
+ /**
282
+ * List geofences
283
+ * @param options?: ListGeofenceOptions
284
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
285
+ * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
286
+ * entries: list of geofences - 100 geofences are listed per page
287
+ * nextToken: token for next page of geofences
288
+ */
289
+ InternalGeoClass.prototype.listGeofences = function (options, customUserAgentDetails) {
290
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
291
+ var _a, providerName, prov, error_7;
292
+ return tslib_1.__generator(this, function (_b) {
293
+ switch (_b.label) {
294
+ case 0:
295
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
296
+ prov = this.getPluggable(providerName);
297
+ _b.label = 1;
298
+ case 1:
299
+ _b.trys.push([1, 3, , 4]);
300
+ return [4 /*yield*/, prov.listGeofences(options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.ListGeofences, customUserAgentDetails))];
301
+ case 2: return [2 /*return*/, _b.sent()];
302
+ case 3:
303
+ error_7 = _b.sent();
304
+ logger.debug(error_7);
305
+ throw error_7;
306
+ case 4: return [2 /*return*/];
307
+ }
308
+ });
309
+ });
310
+ };
311
+ /**
312
+ * Delete geofences
313
+ * @param geofenceIds: string|string[]
314
+ * @param options?: GeofenceOptions
315
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
316
+ * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
317
+ * successes: list of geofences successfully deleted
318
+ * errors: list of geofences that failed to delete
319
+ */
320
+ InternalGeoClass.prototype.deleteGeofences = function (geofenceIds, options, customUserAgentDetails) {
321
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
322
+ var _a, providerName, prov, geofenceIdsInputArray, error_8;
323
+ return tslib_1.__generator(this, function (_b) {
324
+ switch (_b.label) {
325
+ case 0:
326
+ _a = (options || {}).providerName, providerName = _a === void 0 ? DEFAULT_PROVIDER : _a;
327
+ prov = this.getPluggable(providerName);
328
+ if (!Array.isArray(geofenceIds)) {
329
+ geofenceIdsInputArray = [geofenceIds];
330
+ }
331
+ else {
332
+ geofenceIdsInputArray = geofenceIds;
333
+ }
334
+ _b.label = 1;
335
+ case 1:
336
+ _b.trys.push([1, 3, , 4]);
337
+ return [4 /*yield*/, prov.deleteGeofences(geofenceIdsInputArray, options, utils_1.getGeoUserAgentDetails(core_1.GeoAction.DeleteGeofences, customUserAgentDetails))];
338
+ case 2: return [2 /*return*/, _b.sent()];
339
+ case 3:
340
+ error_8 = _b.sent();
341
+ logger.debug(error_8);
342
+ throw error_8;
343
+ case 4: return [2 /*return*/];
344
+ }
345
+ });
346
+ });
347
+ };
348
+ InternalGeoClass.MODULE = 'InternalGeo';
349
+ return InternalGeoClass;
350
+ }());
351
+ exports.InternalGeoClass = InternalGeoClass;
352
+ exports.InternalGeo = new InternalGeoClass();
353
+ core_1.Amplify.register(exports.InternalGeo);
354
+ //# sourceMappingURL=InternalGeo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalGeo.js","sourceRoot":"","sources":["../../src/internals/InternalGeo.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,0CAM2B;AAC3B,4FAA2F;AAE3F,gCAA8C;AAoB9C,iCAAiD;AAEjD,IAAM,MAAM,GAAG,IAAI,oBAAM,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,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACI,wCAAa,GAApB;QACC,OAAO,gBAAgB,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,uCAAY,GAAnB,UAAoB,SAAsB;QACzC,IAAI,SAAS,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;YACnD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACjC,IAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CACjC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,CACzC,CAAC;YAEF,OAAO,MAAM,CAAC;SACd;IACF,CAAC;IAED;;;OAGG;IACI,uCAAY,GAAnB,UAAoB,YAAoB;QACvC,IAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CACtC,UAAA,SAAS,IAAI,OAAA,SAAS,CAAC,eAAe,EAAE,KAAK,YAAY,EAA5C,CAA4C,CACzD,CAAC;QACF,IAAI,SAAS,KAAK,SAAS,EAAE;YAC5B,MAAM,CAA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,aAAa,EAAE,sBAAsB,CAAC,CACvE,EAAA;4BAHD,sBAAO,SAGN,EAAC;;;wBAEF,MAAM,CAAC,KAAK,CAAC,OAAK,CAAC,CAAC;wBACpB,MAAM,OAAK,CAAC;;;;;KAEb;IAED;;;;;;;;OAQG;IACU,0CAAe,GAA5B,UACC,WAA8B,EAC9B,OAAyB,EACzB,sBAA+C;;;;;;wBAEvC,KAAoC,CAAA,OAAO,IAAI,EAAE,CAAA,aAAlB,EAA/B,YAAY,mBAAG,gBAAgB,KAAA,CAAmB;wBACpD,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;wBAI7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;4BAChC,qBAAqB,GAAG,CAAC,WAAW,CAAC,CAAC;yBACtC;6BAAM;4BACN,qBAAqB,GAAG,WAAW,CAAC;yBACpC;;;;wBAIO,qBAAM,IAAI,CAAC,eAAe,CAChC,qBAAqB,EACrB,OAAO,EACP,8BAAsB,CACrB,gBAAS,CAAC,eAAe,EACzB,sBAAsB,CACtB,CACD,EAAA;4BAPD,sBAAO,SAON,EAAC;;;wBAEF,MAAM,CAAC,KAAK,CAAC,OAAK,CAAC,CAAC;wBACpB,MAAM,OAAK,CAAC;;;;;KAEb;IA/VM,uBAAM,GAAG,aAAa,CAAC;IAgW/B,uBAAC;CAAA,AAjWD,IAiWC;AAjWY,4CAAgB;AAmWhB,QAAA,WAAW,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAClD,cAAO,CAAC,QAAQ,CAAC,mBAAW,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export { InternalGeo } from './InternalGeo';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ var InternalGeo_1 = require("./InternalGeo");
6
+ exports.InternalGeo = InternalGeo_1.InternalGeo;
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,6CAA4C;AAAnC,oCAAA,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { CustomUserAgentDetails, GeoAction } from '@aws-amplify/core';
2
+ export declare const getGeoUserAgentDetails: (action: GeoAction, customUserAgentDetails?: CustomUserAgentDetails) => CustomUserAgentDetails;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ var tslib_1 = require("tslib");
6
+ var core_1 = require("@aws-amplify/core");
7
+ exports.getGeoUserAgentDetails = function (action, customUserAgentDetails) {
8
+ return tslib_1.__assign({ category: core_1.Category.Geo, action: action }, customUserAgentDetails);
9
+ };
10
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internals/utils.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,0CAAgF;AAEnE,QAAA,sBAAsB,GAAG,UACrC,MAAiB,EACjB,sBAA+C;IAE/C,0BACC,QAAQ,EAAE,eAAQ,CAAC,GAAG,EACtB,MAAM,QAAA,IACH,sBAAsB,EACxB;AACH,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { CustomUserAgentDetails } from '@aws-amplify/core';
1
2
  import { SearchByTextOptions, SearchByCoordinatesOptions, SearchForSuggestionsResults, Coordinates, Place, MapStyle, Geofence, GeofenceId, GeofenceInput, GeofenceOptions, ListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, DeleteGeofencesResults, searchByPlaceIdOptions } from './Geo';
2
3
  export interface GeoProvider {
3
4
  getCategory(): string;
@@ -5,12 +6,12 @@ export interface GeoProvider {
5
6
  configure(config: object): object;
6
7
  getAvailableMaps(): MapStyle[];
7
8
  getDefaultMap(): MapStyle;
8
- searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
9
- searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
10
- searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<SearchForSuggestionsResults>;
11
- searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place | undefined>;
12
- saveGeofences(geofences: GeofenceInput[], options?: GeofenceOptions): Promise<SaveGeofencesResults>;
13
- getGeofence(geofenceId: GeofenceId, options?: ListGeofenceOptions): Promise<Geofence>;
14
- listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
15
- deleteGeofences(geofenceIds: string[], options?: GeofenceOptions): Promise<DeleteGeofencesResults>;
9
+ searchByText(text: string, options?: SearchByTextOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place[]>;
10
+ searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place>;
11
+ searchForSuggestions(text: string, options?: SearchByTextOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<SearchForSuggestionsResults>;
12
+ searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place | undefined>;
13
+ saveGeofences(geofences: GeofenceInput[], options?: GeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<SaveGeofencesResults>;
14
+ getGeofence(geofenceId: GeofenceId, options?: ListGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Geofence>;
15
+ listGeofences(options?: ListGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<ListGeofenceResults>;
16
+ deleteGeofences(geofenceIds: string[], options?: GeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<DeleteGeofencesResults>;
16
17
  }
package/lib-esm/Geo.d.ts CHANGED
@@ -1,50 +1,12 @@
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 {
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