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

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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/geo",
3
- "version": "2.1.4-api-v6.25+6e3f5010b",
3
+ "version": "2.1.4-api-v6.29+98c172c32",
4
4
  "description": "Geo category for aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -43,10 +43,11 @@
43
43
  "files": [
44
44
  "lib",
45
45
  "lib-esm",
46
- "src"
46
+ "src",
47
+ "internals"
47
48
  ],
48
49
  "dependencies": {
49
- "@aws-amplify/core": "5.5.3-api-v6.25+6e3f5010b",
50
+ "@aws-amplify/core": "5.5.3-api-v6.29+98c172c32",
50
51
  "@aws-sdk/client-location": "3.186.3",
51
52
  "@turf/boolean-clockwise": "6.5.0",
52
53
  "camelcase-keys": "6.2.2",
@@ -57,7 +58,7 @@
57
58
  "name": "Geo (top-level class)",
58
59
  "path": "./lib-esm/index.js",
59
60
  "import": "{ Amplify, Geo }",
60
- "limit": "51.75 kB"
61
+ "limit": "52.1 kB"
61
62
  }
62
63
  ],
63
64
  "jest": {
@@ -113,5 +114,5 @@
113
114
  "lib-esm"
114
115
  ]
115
116
  },
116
- "gitHead": "6e3f5010b235d1b12d81e410ee5652365294a615"
117
+ "gitHead": "98c172c32bc793b99b31442ea2d84829baea6e3c"
117
118
  }
package/src/Geo.ts CHANGED
@@ -1,22 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import {
4
- Amplify,
5
- ConsoleLogger as Logger,
6
- parseAWSExports,
7
- } from '@aws-amplify/core';
8
- import { AmazonLocationServiceProvider } from './Providers/AmazonLocationServiceProvider';
9
-
10
- import { validateCoordinates } from './util';
11
-
3
+ import { Amplify, ConsoleLogger as Logger } from '@aws-amplify/core';
12
4
  import {
13
5
  Place,
14
- GeoConfig,
15
6
  Coordinates,
16
7
  SearchByTextOptions,
17
8
  SearchByCoordinatesOptions,
18
- GeoProvider,
19
- MapStyle,
20
9
  GeofenceId,
21
10
  GeofenceInput,
22
11
  GeofenceOptions,
@@ -27,23 +16,10 @@ import {
27
16
  DeleteGeofencesResults,
28
17
  searchByPlaceIdOptions,
29
18
  } from './types';
19
+ import { InternalGeoClass } from './internals/InternalGeo';
30
20
 
31
- const logger = new Logger('Geo');
32
-
33
- const DEFAULT_PROVIDER = 'AmazonLocationService';
34
- export class GeoClass {
21
+ export class GeoClass extends InternalGeoClass {
35
22
  static MODULE = 'Geo';
36
- /**
37
- * @private
38
- */
39
- private _config: GeoConfig;
40
- private _pluggables: GeoProvider[];
41
-
42
- constructor() {
43
- this._config = {};
44
- this._pluggables = [];
45
- logger.debug('Geo Options', this._config);
46
- }
47
23
 
48
24
  /**
49
25
  * get the name of the module category
@@ -53,91 +29,6 @@ export class GeoClass {
53
29
  return GeoClass.MODULE;
54
30
  }
55
31
 
56
- /**
57
- * add plugin into Geo category
58
- * @param {Object} pluggable - an instance of the plugin
59
- */
60
- public addPluggable(pluggable: GeoProvider) {
61
- if (pluggable && pluggable.getCategory() === 'Geo') {
62
- this._pluggables.push(pluggable);
63
- const config = pluggable.configure(
64
- this._config[pluggable.getProviderName()]
65
- );
66
-
67
- return config;
68
- }
69
- }
70
-
71
- /**
72
- * Get the plugin object
73
- * @param providerName - the name of the plugin
74
- */
75
- public getPluggable(providerName: string) {
76
- const pluggable = this._pluggables.find(
77
- pluggable => pluggable.getProviderName() === providerName
78
- );
79
- if (pluggable === undefined) {
80
- logger.debug('No plugin found with providerName', providerName);
81
- throw new Error('No plugin found in Geo for the provider');
82
- } else return pluggable;
83
- }
84
-
85
- /**
86
- * Remove the plugin object
87
- * @param providerName - the name of the plugin
88
- */
89
- public removePluggable(providerName: string) {
90
- this._pluggables = this._pluggables.filter(
91
- pluggable => pluggable.getProviderName() !== providerName
92
- );
93
- return;
94
- }
95
-
96
- /**
97
- * Configure Geo
98
- * @param {Object} config - Configuration object for Geo
99
- * @return {Object} - Current configuration
100
- */
101
- configure(config?) {
102
- logger.debug('configure Geo');
103
-
104
- if (!config) return this._config;
105
-
106
- const amplifyConfig = parseAWSExports(config);
107
- this._config = Object.assign({}, this._config, amplifyConfig.Geo, config);
108
-
109
- this._pluggables.forEach(pluggable => {
110
- pluggable.configure(this._config[pluggable.getProviderName()]);
111
- });
112
-
113
- if (this._pluggables.length === 0) {
114
- this.addPluggable(new AmazonLocationServiceProvider());
115
- }
116
- return this._config;
117
- }
118
-
119
- /**
120
- * Get the map resources that are currently available through the provider
121
- * @param {string} provider
122
- * @returns - Array of available map resources
123
- */
124
- public getAvailableMaps(provider = DEFAULT_PROVIDER): MapStyle[] {
125
- const prov = this.getPluggable(provider);
126
-
127
- return prov.getAvailableMaps();
128
- }
129
-
130
- /**
131
- * Get the map resource set as default in amplify config
132
- * @param {string} provider
133
- * @returns - Map resource set as the default in amplify config
134
- */
135
- public getDefaultMap(provider = DEFAULT_PROVIDER): MapStyle {
136
- const prov = this.getPluggable(provider);
137
-
138
- return prov.getDefaultMap();
139
- }
140
-
141
32
  /**
142
33
  * Search by text input with optional parameters
143
34
  * @param {string} text - The text string that is to be searched for
@@ -148,15 +39,7 @@ export class GeoClass {
148
39
  text: string,
149
40
  options?: SearchByTextOptions
150
41
  ): Promise<Place[]> {
151
- const { providerName = DEFAULT_PROVIDER } = options || {};
152
- const prov = this.getPluggable(providerName);
153
-
154
- try {
155
- return await prov.searchByText(text, options);
156
- } catch (error) {
157
- logger.debug(error);
158
- throw error;
159
- }
42
+ return super.searchByText(text, options);
160
43
  }
161
44
 
162
45
  /**
@@ -169,15 +52,7 @@ export class GeoClass {
169
52
  text: string,
170
53
  options?: SearchByTextOptions
171
54
  ) {
172
- const { providerName = DEFAULT_PROVIDER } = options || {};
173
- const prov = this.getPluggable(providerName);
174
-
175
- try {
176
- return await prov.searchForSuggestions(text, options);
177
- } catch (error) {
178
- logger.debug(error);
179
- throw error;
180
- }
55
+ return super.searchForSuggestions(text, options);
181
56
  }
182
57
 
183
58
  /**
@@ -190,15 +65,7 @@ export class GeoClass {
190
65
  placeId: string,
191
66
  options?: searchByPlaceIdOptions
192
67
  ) {
193
- const providerName = DEFAULT_PROVIDER;
194
- const prov = this.getPluggable(providerName);
195
-
196
- try {
197
- return await prov.searchByPlaceId(placeId, options);
198
- } catch (error) {
199
- logger.debug(error);
200
- throw error;
201
- }
68
+ return super.searchByPlaceId(placeId, options);
202
69
  }
203
70
 
204
71
  /**
@@ -211,17 +78,7 @@ export class GeoClass {
211
78
  coordinates: Coordinates,
212
79
  options?: SearchByCoordinatesOptions
213
80
  ): Promise<Place> {
214
- const { providerName = DEFAULT_PROVIDER } = options || {};
215
- const prov = this.getPluggable(providerName);
216
-
217
- const [lng, lat] = coordinates;
218
- try {
219
- validateCoordinates(lng, lat);
220
- return await prov.searchByCoordinates(coordinates, options);
221
- } catch (error) {
222
- logger.debug(error);
223
- throw error;
224
- }
81
+ return super.searchByCoordinates(coordinates, options);
225
82
  }
226
83
 
227
84
  /**
@@ -236,23 +93,7 @@ export class GeoClass {
236
93
  geofences: GeofenceInput | GeofenceInput[],
237
94
  options?: GeofenceOptions
238
95
  ): Promise<SaveGeofencesResults> {
239
- const { providerName = DEFAULT_PROVIDER } = options || {};
240
- const prov = this.getPluggable(providerName);
241
-
242
- // If single geofence input, make it an array for batch call
243
- let geofenceInputArray;
244
- if (!Array.isArray(geofences)) {
245
- geofenceInputArray = [geofences];
246
- } else {
247
- geofenceInputArray = geofences;
248
- }
249
-
250
- try {
251
- return await prov.saveGeofences(geofenceInputArray, options);
252
- } catch (error) {
253
- logger.debug(error);
254
- throw error;
255
- }
96
+ return super.saveGeofences(geofences, options);
256
97
  }
257
98
 
258
99
  /**
@@ -265,15 +106,7 @@ export class GeoClass {
265
106
  geofenceId: GeofenceId,
266
107
  options?: GeofenceOptions
267
108
  ): Promise<Geofence> {
268
- const { providerName = DEFAULT_PROVIDER } = options || {};
269
- const prov = this.getPluggable(providerName);
270
-
271
- try {
272
- return await prov.getGeofence(geofenceId, options);
273
- } catch (error) {
274
- logger.debug(error);
275
- throw error;
276
- }
109
+ return super.getGeofence(geofenceId, options);
277
110
  }
278
111
 
279
112
  /**
@@ -286,15 +119,7 @@ export class GeoClass {
286
119
  public async listGeofences(
287
120
  options?: ListGeofenceOptions
288
121
  ): Promise<ListGeofenceResults> {
289
- const { providerName = DEFAULT_PROVIDER } = options || {};
290
- const prov = this.getPluggable(providerName);
291
-
292
- try {
293
- return await prov.listGeofences(options);
294
- } catch (error) {
295
- logger.debug(error);
296
- throw error;
297
- }
122
+ return super.listGeofences(options);
298
123
  }
299
124
 
300
125
  /**
@@ -309,24 +134,7 @@ export class GeoClass {
309
134
  geofenceIds: string | string[],
310
135
  options?: GeofenceOptions
311
136
  ): Promise<DeleteGeofencesResults> {
312
- const { providerName = DEFAULT_PROVIDER } = options || {};
313
- const prov = this.getPluggable(providerName);
314
-
315
- // If single geofence input, make it an array for batch call
316
- let geofenceIdsInputArray;
317
- if (!Array.isArray(geofenceIds)) {
318
- geofenceIdsInputArray = [geofenceIds];
319
- } else {
320
- geofenceIdsInputArray = geofenceIds;
321
- }
322
-
323
- // Delete geofences
324
- try {
325
- return await prov.deleteGeofences(geofenceIdsInputArray, options);
326
- } catch (error) {
327
- logger.debug(error);
328
- throw error;
329
- }
137
+ return super.deleteGeofences(geofenceIds, options);
330
138
  }
331
139
  }
332
140
 
@@ -6,6 +6,7 @@ import {
6
6
  ConsoleLogger as Logger,
7
7
  Credentials,
8
8
  getAmplifyUserAgentObject,
9
+ CustomUserAgentDetails,
9
10
  } from '@aws-amplify/core';
10
11
  import {
11
12
  Place as PlaceResult,
@@ -147,11 +148,13 @@ export class AmazonLocationServiceProvider implements GeoProvider {
147
148
  * Search by text input with optional parameters
148
149
  * @param {string} text - The text string that is to be searched for
149
150
  * @param {SearchByTextOptions} options? - Optional parameters to the search
151
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
150
152
  * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
151
153
  */
152
154
  public async searchByText(
153
155
  text: string,
154
- options?: SearchByTextOptions
156
+ options?: SearchByTextOptions,
157
+ customUserAgentDetails?: CustomUserAgentDetails
155
158
  ): Promise<Place[]> {
156
159
  const credentialsOK = await this._ensureCredentials();
157
160
  if (!credentialsOK) {
@@ -181,7 +184,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
181
184
  const client = new LocationClient({
182
185
  credentials: this._config.credentials,
183
186
  region: this._config.region,
184
- customUserAgent: getAmplifyUserAgentObject(),
187
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
185
188
  });
186
189
  const command = new SearchPlaceIndexForTextCommand(locationServiceInput);
187
190
 
@@ -212,12 +215,14 @@ export class AmazonLocationServiceProvider implements GeoProvider {
212
215
  * Search for suggestions based on the input text
213
216
  * @param {string} text - The text string that is to be searched for
214
217
  * @param {SearchByTextOptions} options? - Optional parameters to the search
218
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
215
219
  * @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
216
220
  */
217
221
 
218
222
  public async searchForSuggestions(
219
223
  text: string,
220
- options?: SearchByTextOptions
224
+ options?: SearchByTextOptions,
225
+ customUserAgentDetails?: CustomUserAgentDetails
221
226
  ): Promise<SearchForSuggestionsResults> {
222
227
  const credentialsOK = await this._ensureCredentials();
223
228
  if (!credentialsOK) {
@@ -247,7 +252,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
247
252
  const client = new LocationClient({
248
253
  credentials: this._config.credentials,
249
254
  region: this._config.region,
250
- customUserAgent: getAmplifyUserAgentObject(),
255
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
251
256
  });
252
257
  const command = new SearchPlaceIndexForSuggestionsCommand(
253
258
  locationServiceInput
@@ -282,7 +287,8 @@ export class AmazonLocationServiceProvider implements GeoProvider {
282
287
 
283
288
  public async searchByPlaceId(
284
289
  placeId: string,
285
- options?: searchByPlaceIdOptions
290
+ options?: searchByPlaceIdOptions,
291
+ customUserAgentDetails?: CustomUserAgentDetails
286
292
  ): Promise<Place | undefined> {
287
293
  const credentialsOK = await this._ensureCredentials();
288
294
  if (!credentialsOK) {
@@ -295,7 +301,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
295
301
  const client = new LocationClient({
296
302
  credentials: this._config.credentials,
297
303
  region: this._config.region,
298
- customUserAgent: getAmplifyUserAgentObject(),
304
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
299
305
  });
300
306
 
301
307
  const searchByPlaceIdInput: GetPlaceCommandInput = {
@@ -329,7 +335,8 @@ export class AmazonLocationServiceProvider implements GeoProvider {
329
335
  */
330
336
  public async searchByCoordinates(
331
337
  coordinates: Coordinates,
332
- options?: SearchByCoordinatesOptions
338
+ options?: SearchByCoordinatesOptions,
339
+ customUserAgentDetails?: CustomUserAgentDetails
333
340
  ): Promise<Place> {
334
341
  const credentialsOK = await this._ensureCredentials();
335
342
  if (!credentialsOK) {
@@ -353,7 +360,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
353
360
  const client = new LocationClient({
354
361
  credentials: this._config.credentials,
355
362
  region: this._config.region,
356
- customUserAgent: getAmplifyUserAgentObject(),
363
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
357
364
  });
358
365
  const command = new SearchPlaceIndexForPositionCommand(
359
366
  locationServiceInput
@@ -384,13 +391,15 @@ export class AmazonLocationServiceProvider implements GeoProvider {
384
391
  * Create geofences inside of a geofence collection
385
392
  * @param geofences - Array of geofence objects to create
386
393
  * @param options? - Optional parameters for creating geofences
394
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
387
395
  * @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
388
396
  * successes: list of geofences successfully created
389
397
  * errors: list of geofences that failed to create
390
398
  */
391
399
  public async saveGeofences(
392
400
  geofences: GeofenceInput[],
393
- options?: AmazonLocationServiceGeofenceOptions
401
+ options?: AmazonLocationServiceGeofenceOptions,
402
+ customUserAgentDetails?: CustomUserAgentDetails
394
403
  ): Promise<SaveGeofencesResults> {
395
404
  if (geofences.length < 1) {
396
405
  throw new Error('Geofence input array is empty');
@@ -442,7 +451,8 @@ export class AmazonLocationServiceProvider implements GeoProvider {
442
451
  try {
443
452
  response = await this._AmazonLocationServiceBatchPutGeofenceCall(
444
453
  batch,
445
- options?.collectionName || this._config.geofenceCollections.default
454
+ options?.collectionName || this._config.geofenceCollections.default,
455
+ customUserAgentDetails
446
456
  );
447
457
  } catch (error) {
448
458
  // If the API call fails, add the geofences to the errors array and move to next batch
@@ -492,11 +502,13 @@ export class AmazonLocationServiceProvider implements GeoProvider {
492
502
  * Get geofence from a geofence collection
493
503
  * @param geofenceId:string
494
504
  * @param options?: Optional parameters for getGeofence
505
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
495
506
  * @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
496
507
  */
497
508
  public async getGeofence(
498
509
  geofenceId: GeofenceId,
499
- options?: AmazonLocationServiceGeofenceOptions
510
+ options?: AmazonLocationServiceGeofenceOptions,
511
+ customUserAgentDetails?: CustomUserAgentDetails
500
512
  ): Promise<AmazonLocationServiceGeofence> {
501
513
  const credentialsOK = await this._ensureCredentials();
502
514
  if (!credentialsOK) {
@@ -517,7 +529,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
517
529
  const client = new LocationClient({
518
530
  credentials: this._config.credentials,
519
531
  region: this._config.region,
520
- customUserAgent: getAmplifyUserAgentObject(),
532
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
521
533
  });
522
534
 
523
535
  // Create Amazon Location Service command
@@ -555,12 +567,14 @@ export class AmazonLocationServiceProvider implements GeoProvider {
555
567
  /**
556
568
  * List geofences from a geofence collection
557
569
  * @param options?: ListGeofenceOptions
570
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
558
571
  * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
559
572
  * entries: list of geofences - 100 geofences are listed per page
560
573
  * nextToken: token for next page of geofences
561
574
  */
562
575
  public async listGeofences(
563
- options?: AmazonLocationServiceListGeofenceOptions
576
+ options?: AmazonLocationServiceListGeofenceOptions,
577
+ customUserAgentDetails?: CustomUserAgentDetails
564
578
  ): Promise<ListGeofenceResults> {
565
579
  const credentialsOK = await this._ensureCredentials();
566
580
  if (!credentialsOK) {
@@ -579,7 +593,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
579
593
  const client = new LocationClient({
580
594
  credentials: this._config.credentials,
581
595
  region: this._config.region,
582
- customUserAgent: getAmplifyUserAgentObject(),
596
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
583
597
  });
584
598
 
585
599
  // Create Amazon Location Service input
@@ -636,13 +650,15 @@ export class AmazonLocationServiceProvider implements GeoProvider {
636
650
  * Delete geofences from a geofence collection
637
651
  * @param geofenceIds: string|string[]
638
652
  * @param options?: GeofenceOptions
653
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
639
654
  * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
640
655
  * successes: list of geofences successfully deleted
641
656
  * errors: list of geofences that failed to delete
642
657
  */
643
658
  public async deleteGeofences(
644
659
  geofenceIds: string[],
645
- options?: AmazonLocationServiceGeofenceOptions
660
+ options?: AmazonLocationServiceGeofenceOptions,
661
+ customUserAgentDetails?: CustomUserAgentDetails
646
662
  ): Promise<AmazonLocationServiceDeleteGeofencesResults> {
647
663
  if (geofenceIds.length < 1) {
648
664
  throw new Error('GeofenceId input array is empty');
@@ -685,7 +701,8 @@ export class AmazonLocationServiceProvider implements GeoProvider {
685
701
  try {
686
702
  response = await this._AmazonLocationServiceBatchDeleteGeofenceCall(
687
703
  batch,
688
- options?.collectionName || this._config.geofenceCollections.default
704
+ options?.collectionName || this._config.geofenceCollections.default,
705
+ customUserAgentDetails
689
706
  );
690
707
  } catch (error) {
691
708
  // If the API call fails, add the geofences to the errors array and move to next batch
@@ -772,7 +789,8 @@ export class AmazonLocationServiceProvider implements GeoProvider {
772
789
 
773
790
  private async _AmazonLocationServiceBatchPutGeofenceCall(
774
791
  PascalGeofences: BatchPutGeofenceRequestEntry[],
775
- collectionName?: string
792
+ collectionName?: string,
793
+ customUserAgentDetails?: CustomUserAgentDetails
776
794
  ) {
777
795
  // Create the BatchPutGeofence input
778
796
  const geofenceInput: BatchPutGeofenceCommandInput = {
@@ -784,7 +802,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
784
802
  const client = new LocationClient({
785
803
  credentials: this._config.credentials,
786
804
  region: this._config.region,
787
- customUserAgent: getAmplifyUserAgentObject(),
805
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
788
806
  });
789
807
  const command = new BatchPutGeofenceCommand(geofenceInput);
790
808
 
@@ -799,7 +817,8 @@ export class AmazonLocationServiceProvider implements GeoProvider {
799
817
 
800
818
  private async _AmazonLocationServiceBatchDeleteGeofenceCall(
801
819
  geofenceIds: string[],
802
- collectionName?: string
820
+ collectionName?: string,
821
+ customUserAgentDetails?: CustomUserAgentDetails
803
822
  ): Promise<BatchDeleteGeofenceCommandOutput> {
804
823
  // Create the BatchDeleteGeofence input
805
824
  const deleteGeofencesInput: BatchDeleteGeofenceCommandInput = {
@@ -811,7 +830,7 @@ export class AmazonLocationServiceProvider implements GeoProvider {
811
830
  const client = new LocationClient({
812
831
  credentials: this._config.credentials,
813
832
  region: this._config.region,
814
- customUserAgent: getAmplifyUserAgentObject(),
833
+ customUserAgent: getAmplifyUserAgentObject(customUserAgentDetails),
815
834
  });
816
835
  const command = new BatchDeleteGeofenceCommand(deleteGeofencesInput);
817
836