@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.
Files changed (40) hide show
  1. package/lib/Geo.d.ts +41 -3
  2. package/lib/Geo.js +230 -20
  3. package/lib/Geo.js.map +1 -1
  4. package/lib/Providers/AmazonLocationServiceProvider.d.ts +8 -15
  5. package/lib/Providers/AmazonLocationServiceProvider.js +20 -26
  6. package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
  7. package/lib/types/Provider.d.ts +8 -9
  8. package/lib-esm/Geo.d.ts +41 -3
  9. package/lib-esm/Geo.js +232 -22
  10. package/lib-esm/Geo.js.map +1 -1
  11. package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +8 -15
  12. package/lib-esm/Providers/AmazonLocationServiceProvider.js +20 -26
  13. package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
  14. package/lib-esm/types/Provider.d.ts +8 -9
  15. package/package.json +5 -6
  16. package/src/Geo.ts +203 -11
  17. package/src/Providers/AmazonLocationServiceProvider.ts +20 -39
  18. package/src/types/Provider.ts +8 -22
  19. package/internals/package.json +0 -8
  20. package/lib/internals/InternalGeo.d.ts +0 -119
  21. package/lib/internals/InternalGeo.js +0 -354
  22. package/lib/internals/InternalGeo.js.map +0 -1
  23. package/lib/internals/index.d.ts +0 -1
  24. package/lib/internals/index.js +0 -7
  25. package/lib/internals/index.js.map +0 -1
  26. package/lib/internals/utils.d.ts +0 -2
  27. package/lib/internals/utils.js +0 -10
  28. package/lib/internals/utils.js.map +0 -1
  29. package/lib-esm/internals/InternalGeo.d.ts +0 -119
  30. package/lib-esm/internals/InternalGeo.js +0 -352
  31. package/lib-esm/internals/InternalGeo.js.map +0 -1
  32. package/lib-esm/internals/index.d.ts +0 -1
  33. package/lib-esm/internals/index.js +0 -4
  34. package/lib-esm/internals/index.js.map +0 -1
  35. package/lib-esm/internals/utils.d.ts +0 -2
  36. package/lib-esm/internals/utils.js +0 -8
  37. package/lib-esm/internals/utils.js.map +0 -1
  38. package/src/internals/InternalGeo.ts +0 -393
  39. package/src/internals/index.ts +0 -3
  40. package/src/internals/utils.ts +0 -15
@@ -1,6 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { CustomUserAgentDetails } from '@aws-amplify/core';
4
3
  import {
5
4
  SearchByTextOptions,
6
5
  SearchByCoordinatesOptions,
@@ -36,55 +35,42 @@ export interface GeoProvider {
36
35
  getDefaultMap(): MapStyle;
37
36
 
38
37
  // search by a text string and return a list of places
39
- searchByText(
40
- text: string,
41
- options?: SearchByTextOptions,
42
- customUserAgentDetails?: CustomUserAgentDetails
43
- ): Promise<Place[]>;
38
+ searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
44
39
 
45
40
  // search by coordinates and return a matching place
46
41
  searchByCoordinates(
47
42
  coordinates: Coordinates,
48
- options?: SearchByCoordinatesOptions,
49
- customUserAgentDetails?: CustomUserAgentDetails
43
+ options?: SearchByCoordinatesOptions
50
44
  ): Promise<Place>;
51
45
 
52
46
  searchForSuggestions(
53
47
  text: string,
54
- options?: SearchByTextOptions,
55
- customUserAgentDetails?: CustomUserAgentDetails
48
+ options?: SearchByTextOptions
56
49
  ): Promise<SearchForSuggestionsResults>;
57
50
 
58
51
  searchByPlaceId(
59
52
  placeId: string,
60
- options?: searchByPlaceIdOptions,
61
- customUserAgentDetails?: CustomUserAgentDetails
53
+ options?: searchByPlaceIdOptions
62
54
  ): Promise<Place | undefined>;
63
55
 
64
56
  // create geofences
65
57
  saveGeofences(
66
58
  geofences: GeofenceInput[],
67
- options?: GeofenceOptions,
68
- customUserAgentDetails?: CustomUserAgentDetails
59
+ options?: GeofenceOptions
69
60
  ): Promise<SaveGeofencesResults>;
70
61
 
71
62
  // get a single geofence
72
63
  getGeofence(
73
64
  geofenceId: GeofenceId,
74
- options?: ListGeofenceOptions,
75
- customUserAgentDetails?: CustomUserAgentDetails
65
+ options?: ListGeofenceOptions
76
66
  ): Promise<Geofence>;
77
67
 
78
68
  // list all geofences
79
- listGeofences(
80
- options?: ListGeofenceOptions,
81
- customUserAgentDetails?: CustomUserAgentDetails
82
- ): Promise<ListGeofenceResults>;
69
+ listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
83
70
 
84
71
  // Delete geofences
85
72
  deleteGeofences(
86
73
  geofenceIds: string[],
87
- options?: GeofenceOptions,
88
- customUserAgentDetails?: CustomUserAgentDetails
74
+ options?: GeofenceOptions
89
75
  ): Promise<DeleteGeofencesResults>;
90
76
  }
@@ -1,8 +0,0 @@
1
- {
2
- "name": "@aws-amplify/geo/internals",
3
- "types": "../lib-esm/internals/index.d.ts",
4
- "main": "../lib/internals/index.js",
5
- "module": "../lib-esm/internals/index.js",
6
- "react-native": "../lib-esm/internals/index.js",
7
- "sideEffects": false
8
- }
@@ -1,119 +0,0 @@
1
- import { CustomUserAgentDetails } from '@aws-amplify/core';
2
- import { Place, GeoConfig, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, MapStyle, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults, searchByPlaceIdOptions } from '../types';
3
- export declare class InternalGeoClass {
4
- static MODULE: string;
5
- /**
6
- * @private
7
- */
8
- private _config;
9
- private _pluggables;
10
- constructor();
11
- /**
12
- * get the name of the module category
13
- * @returns {string} name of the module category
14
- */
15
- getModuleName(): string;
16
- /**
17
- * add plugin into Geo category
18
- * @param {Object} pluggable - an instance of the plugin
19
- */
20
- addPluggable(pluggable: GeoProvider): object;
21
- /**
22
- * Get the plugin object
23
- * @param providerName - the name of the plugin
24
- */
25
- getPluggable(providerName: string): GeoProvider;
26
- /**
27
- * Remove the plugin object
28
- * @param providerName - the name of the plugin
29
- */
30
- removePluggable(providerName: string): void;
31
- /**
32
- * Configure Geo
33
- * @param {Object} config - Configuration object for Geo
34
- * @return {Object} - Current configuration
35
- */
36
- configure(config?: any): GeoConfig;
37
- /**
38
- * Get the map resources that are currently available through the provider
39
- * @param {string} provider
40
- * @returns - Array of available map resources
41
- */
42
- getAvailableMaps(provider?: string): MapStyle[];
43
- /**
44
- * Get the map resource set as default in amplify config
45
- * @param {string} provider
46
- * @returns - Map resource set as the default in amplify config
47
- */
48
- getDefaultMap(provider?: string): MapStyle;
49
- /**
50
- * Search by text input with optional parameters
51
- * @param {string} text - The text string that is to be searched for
52
- * @param {SearchByTextOptions} options? - Optional parameters to the search
53
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
54
- * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
55
- */
56
- searchByText(text: string, options?: SearchByTextOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place[]>;
57
- /**
58
- * Search for search term suggestions based on input text
59
- * @param {string} text - The text string that is to be search for
60
- * @param {SearchByTextOptions} options? - Optional parameters to the search
61
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
62
- * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
63
- */
64
- searchForSuggestions(text: string, options?: SearchByTextOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<import("../types").SearchForSuggestionsResults>;
65
- /**
66
- * Search for location by unique ID
67
- * @param {string} placeId - Unique ID of the location that is to be searched for
68
- * @param {searchByPlaceIdOptions} options? - Optional parameters to the search
69
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
70
- * @returns {Promise<Place>} - Resolves to a place with the given placeId
71
- */
72
- searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place>;
73
- /**
74
- * Reverse geocoding search via a coordinate point on the map
75
- * @param coordinates - Coordinates array for the search input
76
- * @param options - Options parameters for the search
77
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
78
- * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
79
- */
80
- searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Place>;
81
- /**
82
- * Create geofences
83
- * @param geofences - Single or array of geofence objects to create
84
- * @param options? - Optional parameters for creating geofences
85
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
86
- * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
87
- * successes: list of geofences successfully created
88
- * errors: list of geofences that failed to create
89
- */
90
- saveGeofences(geofences: GeofenceInput | GeofenceInput[], options?: GeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<SaveGeofencesResults>;
91
- /**
92
- * Get a single geofence by geofenceId
93
- * @param geofenceId: GeofenceId - The string id of the geofence to get
94
- * @param options?: GeofenceOptions - Optional parameters for getting a geofence
95
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
96
- * @returns Promise<Geofence> - Promise that resolves to a geofence object
97
- */
98
- getGeofence(geofenceId: GeofenceId, options?: GeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<Geofence>;
99
- /**
100
- * List geofences
101
- * @param options?: ListGeofenceOptions
102
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
103
- * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
104
- * entries: list of geofences - 100 geofences are listed per page
105
- * nextToken: token for next page of geofences
106
- */
107
- listGeofences(options?: ListGeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<ListGeofenceResults>;
108
- /**
109
- * Delete geofences
110
- * @param geofenceIds: string|string[]
111
- * @param options?: GeofenceOptions
112
- * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
113
- * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
114
- * successes: list of geofences successfully deleted
115
- * errors: list of geofences that failed to delete
116
- */
117
- deleteGeofences(geofenceIds: string | string[], options?: GeofenceOptions, customUserAgentDetails?: CustomUserAgentDetails): Promise<DeleteGeofencesResults>;
118
- }
119
- export declare const InternalGeo: InternalGeoClass;
@@ -1,354 +0,0 @@
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
@@ -1 +0,0 @@
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,EAA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AW,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"}
@@ -1 +0,0 @@
1
- export { InternalGeo } from './InternalGeo';
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,6CAA4C;AAAnC,oCAAA,WAAW,CAAA"}
@@ -1,2 +0,0 @@
1
- import { CustomUserAgentDetails, GeoAction } from '@aws-amplify/core';
2
- export declare const getGeoUserAgentDetails: (action: GeoAction, customUserAgentDetails?: CustomUserAgentDetails) => CustomUserAgentDetails;
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}