@aws-amplify/geo 1.3.12-next.13 → 1.3.12-next.32

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 (39) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/lib/Geo.js +91 -86
  3. package/lib/Geo.js.map +1 -1
  4. package/lib/Providers/AmazonLocationServiceProvider.js +160 -125
  5. package/lib/Providers/AmazonLocationServiceProvider.js.map +1 -1
  6. package/lib/util.js +24 -23
  7. package/lib/util.js.map +1 -1
  8. package/lib-esm/Geo.d.ts +15 -1
  9. package/lib-esm/Geo.js +79 -74
  10. package/lib-esm/Geo.js.map +1 -1
  11. package/lib-esm/Providers/AmazonLocationServiceProvider.d.ts +10 -1
  12. package/lib-esm/Providers/AmazonLocationServiceProvider.js +138 -100
  13. package/lib-esm/Providers/AmazonLocationServiceProvider.js.map +1 -1
  14. package/lib-esm/types/Geo.d.ts +8 -0
  15. package/lib-esm/types/Provider.d.ts +3 -1
  16. package/lib-esm/util.d.ts +1 -0
  17. package/lib-esm/util.js +19 -16
  18. package/lib-esm/util.js.map +1 -1
  19. package/package.json +11 -5
  20. package/src/Geo.ts +45 -2
  21. package/src/Providers/AmazonLocationServiceProvider.ts +131 -21
  22. package/src/types/Geo.ts +12 -0
  23. package/src/types/Provider.ts +12 -0
  24. package/src/util.ts +23 -0
  25. package/build.js +0 -5
  26. package/dist/aws-amplify-geo.js +0 -29948
  27. package/dist/aws-amplify-geo.js.map +0 -1
  28. package/dist/aws-amplify-geo.min.js +0 -56
  29. package/dist/aws-amplify-geo.min.js.map +0 -1
  30. package/index.js +0 -7
  31. package/lib/Geo.d.ts +0 -96
  32. package/lib/Providers/AmazonLocationServiceProvider.d.ts +0 -96
  33. package/lib/index.d.ts +0 -2
  34. package/lib/types/AmazonLocationServiceProvider.d.ts +0 -24
  35. package/lib/types/Geo.d.ts +0 -106
  36. package/lib/types/Provider.d.ts +0 -14
  37. package/lib/types/index.d.ts +0 -3
  38. package/lib/util.d.ts +0 -6
  39. package/webpack.config.dev.js +0 -6
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./dist/aws-amplify-geo.min.js');
5
- } else {
6
- module.exports = require('./dist/aws-amplify-geo.js');
7
- }
package/lib/Geo.d.ts DELETED
@@ -1,96 +0,0 @@
1
- import { Place, GeoConfig, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, MapStyle, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults } from './types';
2
- export declare class GeoClass {
3
- static MODULE: string;
4
- /**
5
- * @private
6
- */
7
- private _config;
8
- private _pluggables;
9
- constructor();
10
- /**
11
- * get the name of the module category
12
- * @returns {string} name of the module category
13
- */
14
- 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
- /**
49
- * Search by text input with optional parameters
50
- * @param {string} text - The text string that is to be searched for
51
- * @param {SearchByTextOptions} options? - Optional parameters to the search
52
- * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
53
- */
54
- searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
55
- /**
56
- * Reverse geocoding search via a coordinate point on the map
57
- * @param coordinates - Coordinates array for the search input
58
- * @param options - Options parameters for the search
59
- * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
60
- */
61
- searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
62
- /**
63
- * Create geofences
64
- * @param geofences - Single or array of geofence objects to create
65
- * @param options? - Optional parameters for creating geofences
66
- * @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
67
- * successes: list of geofences successfully created
68
- * errors: list of geofences that failed to create
69
- */
70
- saveGeofences(geofences: GeofenceInput | GeofenceInput[], options?: GeofenceOptions): Promise<SaveGeofencesResults>;
71
- /**
72
- * Get a single geofence by geofenceId
73
- * @param geofenceId: GeofenceId - The string id of the geofence to get
74
- * @param options?: GeofenceOptions - Optional parameters for getting a geofence
75
- * @returns Promise<Geofence> - Promise that resolves to a geofence object
76
- */
77
- getGeofence(geofenceId: GeofenceId, options?: GeofenceOptions): Promise<Geofence>;
78
- /**
79
- * List geofences
80
- * @param options?: ListGeofenceOptions
81
- * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
82
- * entries: list of geofences - 100 geofences are listed per page
83
- * nextToken: token for next page of geofences
84
- */
85
- listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
86
- /**
87
- * Delete geofences
88
- * @param geofenceIds: string|string[]
89
- * @param options?: GeofenceOptions
90
- * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
91
- * successes: list of geofences successfully deleted
92
- * errors: list of geofences that failed to delete
93
- */
94
- deleteGeofences(geofenceIds: string | string[], options?: GeofenceOptions): Promise<DeleteGeofencesResults>;
95
- }
96
- export declare const Geo: GeoClass;
@@ -1,96 +0,0 @@
1
- import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, GeofenceId, GeofenceInput, AmazonLocationServiceGeofenceOptions, AmazonLocationServiceListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, AmazonLocationServiceGeofence, AmazonLocationServiceDeleteGeofencesResults } from '../types';
2
- export declare class AmazonLocationServiceProvider implements GeoProvider {
3
- static CATEGORY: string;
4
- static PROVIDER_NAME: string;
5
- /**
6
- * @private
7
- */
8
- private _config;
9
- /**
10
- * Initialize Geo with AWS configurations
11
- * @param {Object} config - Configuration object for Geo
12
- */
13
- constructor(config?: GeoConfig);
14
- /**
15
- * get the category of the plugin
16
- * @returns {string} name of the category
17
- */
18
- getCategory(): string;
19
- /**
20
- * get provider name of the plugin
21
- * @returns {string} name of the provider
22
- */
23
- getProviderName(): string;
24
- /**
25
- * Configure Geo part with aws configuration
26
- * @param {Object} config - Configuration of the Geo
27
- * @return {Object} - Current configuration
28
- */
29
- configure(config?: any): object;
30
- /**
31
- * Get the map resources that are currently available through the provider
32
- * @returns {AmazonLocationServiceMapStyle[]}- Array of available map resources
33
- */
34
- getAvailableMaps(): AmazonLocationServiceMapStyle[];
35
- /**
36
- * Get the map resource set as default in amplify config
37
- * @returns {AmazonLocationServiceMapStyle} - Map resource set as the default in amplify config
38
- */
39
- getDefaultMap(): AmazonLocationServiceMapStyle;
40
- /**
41
- * Search by text input with optional parameters
42
- * @param {string} text - The text string that is to be searched for
43
- * @param {SearchByTextOptions} options? - Optional parameters to the search
44
- * @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
45
- */
46
- searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
47
- /**
48
- * Reverse geocoding search via a coordinate point on the map
49
- * @param coordinates - Coordinates array for the search input
50
- * @param options - Options parameters for the search
51
- * @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
52
- */
53
- searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
54
- /**
55
- * Create geofences inside of a geofence collection
56
- * @param geofences - Array of geofence objects to create
57
- * @param options? - Optional parameters for creating geofences
58
- * @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
59
- * successes: list of geofences successfully created
60
- * errors: list of geofences that failed to create
61
- */
62
- saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions): Promise<SaveGeofencesResults>;
63
- /**
64
- * Get geofence from a geofence collection
65
- * @param geofenceId:string
66
- * @param options?: Optional parameters for getGeofence
67
- * @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
68
- */
69
- getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceGeofence>;
70
- /**
71
- * List geofences from a geofence collection
72
- * @param options?: ListGeofenceOptions
73
- * @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
74
- * entries: list of geofences - 100 geofences are listed per page
75
- * nextToken: token for next page of geofences
76
- */
77
- listGeofences(options?: AmazonLocationServiceListGeofenceOptions): Promise<ListGeofenceResults>;
78
- /**
79
- * Delete geofences from a geofence collection
80
- * @param geofenceIds: string|string[]
81
- * @param options?: GeofenceOptions
82
- * @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
83
- * successes: list of geofences successfully deleted
84
- * errors: list of geofences that failed to delete
85
- */
86
- deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceDeleteGeofencesResults>;
87
- /**
88
- * @private
89
- */
90
- private _ensureCredentials;
91
- private _verifyMapResources;
92
- private _verifySearchIndex;
93
- private _verifyGeofenceCollections;
94
- private _AmazonLocationServiceBatchPutGeofenceCall;
95
- private _AmazonLocationServiceBatchDeleteGeofenceCall;
96
- }
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { Geo } from './Geo';
2
- export * from './types';
@@ -1,24 +0,0 @@
1
- import { MapStyle, GeofenceOptions, ListGeofenceOptions, Geofence, DeleteGeofencesResults, GeofenceError } from './Geo';
2
- export interface AmazonLocationServiceMapStyle extends MapStyle {
3
- region: string;
4
- }
5
- export declare type AmazonLocationServiceGeofenceOptions = GeofenceOptions & {
6
- collectionName?: string;
7
- };
8
- export declare type AmazonLocationServiceGeofenceStatus = 'ACTIVE' | 'PENDING' | 'FAILED' | 'DELETED' | 'DELETING';
9
- export declare type AmazonLocationServiceGeofence = Omit<Geofence, 'status'> & {
10
- status: AmazonLocationServiceGeofenceStatus;
11
- };
12
- export declare type AmazonLocationServiceListGeofenceOptions = ListGeofenceOptions & {
13
- collectionName?: string;
14
- };
15
- export declare type AmazonLocationServiceBatchGeofenceErrorMessages = 'AccessDeniedException' | 'InternalServerException' | 'ResourceNotFoundException' | 'ThrottlingException' | 'ValidationException';
16
- export declare type AmazonLocationServiceBatchGeofenceError = Omit<GeofenceError, 'error'> & {
17
- error: {
18
- code: string;
19
- message: AmazonLocationServiceBatchGeofenceErrorMessages;
20
- };
21
- };
22
- export declare type AmazonLocationServiceDeleteGeofencesResults = Omit<DeleteGeofencesResults, 'errors'> & {
23
- errors: AmazonLocationServiceBatchGeofenceError[];
24
- };
@@ -1,106 +0,0 @@
1
- export interface GeoConfig {
2
- region?: string;
3
- AmazonLocationService?: {
4
- maps?: {
5
- items: {};
6
- default: string;
7
- };
8
- search_indices?: {
9
- items: string[];
10
- default: string;
11
- };
12
- geofenceCollections?: {
13
- items: string[];
14
- default: string;
15
- };
16
- };
17
- }
18
- export interface MapStyle {
19
- mapName: string;
20
- style: string;
21
- }
22
- export declare type Longitude = number;
23
- export declare type Latitude = number;
24
- export declare type Coordinates = [Longitude, Latitude];
25
- export declare type SWLongitude = Longitude;
26
- export declare type SWLatitude = Latitude;
27
- export declare type NELongitude = Longitude;
28
- export declare type NELatitude = Latitude;
29
- export declare type BoundingBox = [SWLongitude, SWLatitude, NELongitude, NELatitude];
30
- export interface SearchByTextOptionsBase {
31
- countries?: string[];
32
- maxResults?: number;
33
- searchIndexName?: string;
34
- providerName?: string;
35
- }
36
- export interface SearchByTextOptionsWithBiasPosition extends SearchByTextOptionsBase {
37
- biasPosition?: Coordinates;
38
- }
39
- export interface SearchByTextOptionsWithSearchAreaConstraints extends SearchByTextOptionsBase {
40
- searchAreaConstraints?: BoundingBox;
41
- }
42
- export declare type SearchByTextOptions = SearchByTextOptionsWithBiasPosition | SearchByTextOptionsWithSearchAreaConstraints;
43
- export declare type SearchByCoordinatesOptions = {
44
- maxResults?: number;
45
- searchIndexName?: string;
46
- providerName?: string;
47
- };
48
- export declare type PlaceGeometry = {
49
- point: Coordinates;
50
- };
51
- export interface Place {
52
- addressNumber?: string;
53
- country?: string;
54
- geometry: PlaceGeometry | undefined;
55
- label?: string;
56
- municipality?: string;
57
- neighborhood?: string;
58
- postalCode?: string;
59
- region?: string;
60
- street?: string;
61
- subRegion?: string;
62
- }
63
- export declare type LinearRing = Coordinates[];
64
- export declare type GeofencePolygon = LinearRing[];
65
- export declare type PolygonGeometry = {
66
- polygon: GeofencePolygon;
67
- };
68
- export declare type GeofenceId = string;
69
- export declare type GeofenceInput = {
70
- geofenceId: GeofenceId;
71
- geometry: PolygonGeometry;
72
- };
73
- export declare type GeofenceOptions = {
74
- providerName?: string;
75
- };
76
- export declare type GeofenceError = {
77
- error: {
78
- code: string;
79
- message: string;
80
- };
81
- geofenceId: GeofenceId;
82
- };
83
- declare type GeofenceBase = {
84
- geofenceId: GeofenceId;
85
- createTime?: Date;
86
- updateTime?: Date;
87
- };
88
- export declare type Geofence = GeofenceBase & {
89
- geometry: PolygonGeometry;
90
- };
91
- export declare type SaveGeofencesResults = {
92
- successes: GeofenceBase[];
93
- errors: GeofenceError[];
94
- };
95
- export declare type ListGeofenceOptions = GeofenceOptions & {
96
- nextToken?: string;
97
- };
98
- export declare type ListGeofenceResults = {
99
- entries: Geofence[];
100
- nextToken: string | undefined;
101
- };
102
- export declare type DeleteGeofencesResults = {
103
- successes: GeofenceId[];
104
- errors: GeofenceError[];
105
- };
106
- export {};
@@ -1,14 +0,0 @@
1
- import { SearchByTextOptions, SearchByCoordinatesOptions, Coordinates, Place, MapStyle, Geofence, GeofenceId, GeofenceInput, GeofenceOptions, ListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, DeleteGeofencesResults } from './Geo';
2
- export interface GeoProvider {
3
- getCategory(): string;
4
- getProviderName(): string;
5
- configure(config: object): object;
6
- getAvailableMaps(): MapStyle[];
7
- getDefaultMap(): MapStyle;
8
- searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
9
- searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
10
- saveGeofences(geofences: GeofenceInput[], options?: GeofenceOptions): Promise<SaveGeofencesResults>;
11
- getGeofence(geofenceId: GeofenceId, options?: ListGeofenceOptions): Promise<Geofence>;
12
- listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
13
- deleteGeofences(geofenceIds: string[], options?: GeofenceOptions): Promise<DeleteGeofencesResults>;
14
- }
@@ -1,3 +0,0 @@
1
- export * from './Geo';
2
- export * from './Provider';
3
- export * from './AmazonLocationServiceProvider';
package/lib/util.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Longitude, Latitude, GeofenceId, GeofenceInput, GeofencePolygon, LinearRing } from './types';
2
- export declare function validateCoordinates(lng: Longitude, lat: Latitude): void;
3
- export declare function validateGeofenceId(geofenceId: GeofenceId): void;
4
- export declare function validateLinearRing(linearRing: LinearRing, geofenceId?: GeofenceId): void;
5
- export declare function validatePolygon(polygon: GeofencePolygon, geofenceId?: GeofenceId): void;
6
- export declare function validateGeofencesInput(geofences: GeofenceInput[]): void;
@@ -1,6 +0,0 @@
1
- var config = require('./webpack.config.js');
2
-
3
- var entry = {
4
- 'aws-amplify-geo': './lib-esm/index.js',
5
- };
6
- module.exports = Object.assign(config, { entry, mode: 'development' });