@aws-amplify/geo 3.0.1-unstable.cfbde4c.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{lib → dist/cjs}/Geo.js +3 -1
- package/dist/cjs/Geo.js.map +1 -0
- package/{lib → dist/cjs}/index.js +3 -1
- package/dist/cjs/index.js.map +1 -0
- package/{lib → dist/cjs}/providers/location-service/AmazonLocationServiceProvider.js +3 -1
- package/dist/cjs/providers/location-service/AmazonLocationServiceProvider.js.map +1 -0
- package/dist/cjs/types/AmazonLocationServiceProvider.js +4 -0
- package/dist/cjs/types/AmazonLocationServiceProvider.js.map +1 -0
- package/{lib → dist/cjs}/types/Geo.js +3 -1
- package/dist/cjs/types/Geo.js.map +1 -0
- package/{lib → dist/cjs}/types/Provider.js +3 -1
- package/dist/cjs/types/Provider.js.map +1 -0
- package/{lib → dist/cjs}/types/index.js +3 -1
- package/dist/cjs/types/index.js.map +1 -0
- package/{lib → dist/cjs}/util.js +3 -1
- package/dist/cjs/util.js.map +1 -0
- package/{lib-esm/Geo.js → dist/esm/Geo.mjs} +8 -5
- package/dist/esm/Geo.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/{lib-esm/providers/location-service/AmazonLocationServiceProvider.js → dist/esm/providers/location-service/AmazonLocationServiceProvider.mjs} +8 -5
- package/dist/esm/providers/location-service/AmazonLocationServiceProvider.mjs.map +1 -0
- package/dist/esm/types/AmazonLocationServiceProvider.mjs +2 -0
- package/dist/esm/types/AmazonLocationServiceProvider.mjs.map +1 -0
- package/dist/esm/types/Geo.mjs +2 -0
- package/dist/esm/types/Geo.mjs.map +1 -0
- package/dist/esm/types/Provider.mjs +2 -0
- package/dist/esm/types/Provider.mjs.map +1 -0
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/{lib-esm/util.js → dist/esm/util.mjs} +14 -10
- package/dist/esm/util.mjs.map +1 -0
- package/location-service/package.json +8 -0
- package/package.json +143 -129
- package/lib/Geo.d.ts +0 -104
- package/lib/index.d.ts +0 -2
- package/lib/providers/location-service/AmazonLocationServiceProvider.d.ts +0 -101
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/AmazonLocationServiceProvider.d.ts +0 -24
- package/lib/types/AmazonLocationServiceProvider.js +0 -2
- package/lib/types/Geo.d.ts +0 -97
- package/lib/types/Provider.d.ts +0 -15
- package/lib/types/index.d.ts +0 -3
- package/lib/util.d.ts +0 -11
- package/lib-esm/index.js +0 -4
- package/lib-esm/tsconfig.tsbuildinfo +0 -1
- package/lib-esm/types/AmazonLocationServiceProvider.js +0 -1
- package/lib-esm/types/Geo.js +0 -1
- package/lib-esm/types/Provider.js +0 -1
- package/lib-esm/types/index.js +0 -5
- /package/{lib-esm → dist/esm}/Geo.d.ts +0 -0
- /package/{lib-esm → dist/esm}/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/providers/location-service/AmazonLocationServiceProvider.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/AmazonLocationServiceProvider.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/Geo.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/Provider.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/util.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.mjs","sources":["../../src/util.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport booleanClockwise from '@turf/boolean-clockwise';\nimport { Category, getAmplifyUserAgent, getAmplifyUserAgentObject, } from '@aws-amplify/core/internals/utils';\nexport function validateCoordinates(lng, lat) {\n if (!Number.isFinite(lng) || !Number.isFinite(lat)) {\n throw new Error(`Invalid coordinates: [${lng},${lat}]`);\n }\n if (lat < -90 || 90 < lat) {\n throw new Error('Latitude must be between -90 and 90 degrees inclusive.');\n }\n else if (lng < -180 || 180 < lng) {\n throw new Error('Longitude must be between -180 and 180 degrees inclusive.');\n }\n}\nexport function validateGeofenceId(geofenceId) {\n const geofenceIdRegex = /^[-._\\p{L}\\p{N}]+$/iu;\n // Check if geofenceId is valid\n if (!geofenceIdRegex.test(geofenceId)) {\n throw new Error(`Invalid geofenceId: '${geofenceId}' - IDs can only contain alphanumeric characters, hyphens, underscores and periods.`);\n }\n}\nexport function validateLinearRing(linearRing, geofenceId) {\n const errorPrefix = geofenceId ? `${geofenceId}: ` : '';\n // Validate LinearRing size, must be at least 4 points\n if (linearRing.length < 4) {\n throw new Error(`${errorPrefix}LinearRing must contain 4 or more coordinates.`);\n }\n // Validate all coordinates are valid, error with which ones are bad\n const badCoordinates = [];\n linearRing.forEach(coordinates => {\n try {\n validateCoordinates(coordinates[0], coordinates[1]);\n }\n catch (error) {\n badCoordinates.push({ coordinates, error: error.message });\n }\n });\n if (badCoordinates.length > 0) {\n throw new Error(`${errorPrefix}One or more of the coordinates in the Polygon LinearRing are not valid: ${JSON.stringify(badCoordinates)}`);\n }\n // Validate first and last coordinates are the same\n const [lngA, latA] = linearRing[0];\n const [lngB, latB] = linearRing[linearRing.length - 1];\n if (lngA !== lngB || latA !== latB) {\n throw new Error(`${errorPrefix}LinearRing's first and last coordinates are not the same`);\n }\n if (booleanClockwise(linearRing)) {\n throw new Error(`${errorPrefix}LinearRing coordinates must be wound counterclockwise`);\n }\n}\nexport function validatePolygon(polygon, geofenceId) {\n const errorPrefix = geofenceId ? `${geofenceId}: ` : '';\n if (!Array.isArray(polygon)) {\n throw new Error(`${errorPrefix}Polygon is of incorrect structure. It should be an array of LinearRings`);\n }\n if (polygon.length < 1) {\n throw new Error(`${errorPrefix}Polygon must have a single LinearRing array.`);\n }\n if (polygon.length > 1) {\n throw new Error(`${errorPrefix}Polygon must have a single LinearRing array. Note: We do not currently support polygons with holes, multipolygons, polygons that are wound clockwise, or that cross the antimeridian.`);\n }\n const verticesCount = polygon.reduce((prev, linearRing) => prev + linearRing.length, 0);\n if (verticesCount > 1000) {\n throw new Error(`${errorPrefix}Polygon has more than the maximum 1000 vertices.`);\n }\n polygon.forEach(linearRing => {\n validateLinearRing(linearRing, geofenceId);\n });\n}\nexport function validateGeofencesInput(geofences) {\n const geofenceIds = {};\n geofences.forEach((geofence) => {\n // verify all required properties are present\n // Validate geofenceId exists\n if (!geofence.geofenceId) {\n throw new Error(`Geofence '${geofence}' is missing geofenceId`);\n }\n const { geofenceId } = geofence;\n validateGeofenceId(geofenceId);\n // Validate geofenceId is unique\n if (geofenceIds[geofenceId]) {\n throw new Error(`Duplicate geofenceId: ${geofenceId}`);\n }\n else {\n geofenceIds[geofenceId] = true;\n }\n // Validate geometry exists\n if (!geofence.geometry) {\n throw new Error(`Geofence '${geofenceId}' is missing geometry`);\n }\n const { geometry } = geofence;\n // Validate polygon exists\n if (!geometry.polygon) {\n throw new Error(`Geofence '${geofenceId}' is missing geometry.polygon`);\n }\n const { polygon } = geometry;\n // Validate polygon length and structure\n try {\n validatePolygon(polygon, geofenceId);\n }\n catch (error) {\n if (error.message.includes('Polygon has more than the maximum 1000 vertices.')) {\n throw new Error(`Geofence '${geofenceId}' has more than the maximum of 1000 vertices`);\n }\n }\n // Validate LinearRing length, structure, and coordinates\n const [linearRing] = polygon;\n validateLinearRing(linearRing, geofenceId);\n });\n}\nexport function mapSearchOptions(options, locationServiceInput) {\n const locationServiceModifiedInput = { ...locationServiceInput };\n locationServiceModifiedInput.FilterCountries = options.countries;\n locationServiceModifiedInput.MaxResults = options.maxResults;\n if (options.searchIndexName) {\n locationServiceModifiedInput.IndexName = options.searchIndexName;\n }\n if (options['biasPosition'] && options['searchAreaConstraints']) {\n throw new Error('BiasPosition and SearchAreaConstraints are mutually exclusive, please remove one or the other from the options object');\n }\n if (options['biasPosition']) {\n locationServiceModifiedInput.BiasPosition = options['biasPosition'];\n }\n if (options['searchAreaConstraints']) {\n locationServiceModifiedInput.FilterBBox = options['searchAreaConstraints'];\n }\n return locationServiceModifiedInput;\n}\nexport function getGeoUserAgent(action) {\n return getAmplifyUserAgentObject({\n category: Category.Geo,\n action,\n });\n}\nexport function getGeoUserAgentString(action) {\n return getAmplifyUserAgent({\n category: Category.Geo,\n action,\n });\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE;AAC9C,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AACxD,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,KAAK;AACL,IAAI,IAAI,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,EAAE;AAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;AAClF,KAAK;AACL,SAAS,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,EAAE;AACtC,QAAQ,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;AACrF,KAAK;AACL,CAAC;AACM,SAAS,kBAAkB,CAAC,UAAU,EAAE;AAC/C,IAAI,MAAM,eAAe,GAAG,sBAAsB,CAAC;AACnD;AACA,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;AAC3C,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,qBAAqB,EAAE,UAAU,CAAC,mFAAmF,CAAC,CAAC,CAAC;AACjJ,KAAK;AACL,CAAC;AACM,SAAS,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE;AAC3D,IAAI,MAAM,WAAW,GAAG,UAAU,GAAG,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;AAC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AE,QAAQ,CAAC,GAAG;AAC9B,QAAQ,MAAM;AACd,KAAK,CAAC,CAAC;AACP;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-amplify/geo/location-service",
|
|
3
|
+
"main": "../dist/cjs/providers/location-service/AmazonLocationServiceProvider.js",
|
|
4
|
+
"browser": "../dist/esm/providers/location-service/AmazonLocationServiceProvider.mjs",
|
|
5
|
+
"module": "../dist/esm/providers/location-service/AmazonLocationServiceProvider.mjs",
|
|
6
|
+
"react-native": "../src/providers/location-service/AmazonLocationServiceProvider.ts",
|
|
7
|
+
"typings": "../dist/esm/providers/location-service/AmazonLocationServiceProvider.d.ts"
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,131 +1,145 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
2
|
+
"name": "@aws-amplify/geo",
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "Geo category for aws-amplify",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
|
+
"typings": "./dist/esm/index.d.ts",
|
|
8
|
+
"react-native": "./src/index.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"./dist/cjs/geo/geo.js",
|
|
14
|
+
"./dist/esm/geo/geo.mjs"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "yarn run lint && jest -w 1 --coverage",
|
|
18
|
+
"test:size": "size-limit",
|
|
19
|
+
"build-with-test": "npm test && npm run build",
|
|
20
|
+
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
|
|
21
|
+
"build:esm-cjs": "rollup -c rollup.config.mjs",
|
|
22
|
+
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
|
|
23
|
+
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
|
|
24
|
+
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
|
|
25
|
+
"clean": "npm run clean:size && rimraf dist lib lib-esm",
|
|
26
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
27
|
+
"format": "echo \"Not implemented\"",
|
|
28
|
+
"lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
|
|
29
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 84.00"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/esm/index.d.ts",
|
|
34
|
+
"import": "./dist/esm/index.mjs",
|
|
35
|
+
"require": "./dist/cjs/index.js",
|
|
36
|
+
"react-native": "./src/index.ts"
|
|
37
|
+
},
|
|
38
|
+
"./location-service": {
|
|
39
|
+
"types": "./dist/esm/providers/location-service/AmazonLocationServiceProvider.d.ts",
|
|
40
|
+
"import": "./dist/esm/providers/location-service/AmazonLocationServiceProvider.mjs",
|
|
41
|
+
"require": "./dist/cjs/providers/location-service/AmazonLocationServiceProvider.js",
|
|
42
|
+
"react-native": "./src/providers/location-service/AmazonLocationServiceProvider.ts"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"typesVersions": {
|
|
47
|
+
">=4.2": {
|
|
48
|
+
"location-service": [
|
|
49
|
+
"./dist/esm/providers/location-service/AmazonLocationServiceProvider.d.ts"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/aws-amplify/amplify-js.git"
|
|
56
|
+
},
|
|
57
|
+
"author": "Amazon Web Services",
|
|
58
|
+
"license": "Apache-2.0",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/aws/aws-amplify/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://aws-amplify.github.io/",
|
|
63
|
+
"files": [
|
|
64
|
+
"dist/cjs",
|
|
65
|
+
"dist/esm",
|
|
66
|
+
"location-service",
|
|
67
|
+
"src"
|
|
68
|
+
],
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@aws-sdk/client-location": "3.398.0",
|
|
71
|
+
"@turf/boolean-clockwise": "6.5.0",
|
|
72
|
+
"camelcase-keys": "6.2.2",
|
|
73
|
+
"tslib": "^2.5.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@aws-amplify/core": "^6.0.0"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@aws-amplify/core": "6.0.1",
|
|
80
|
+
"@rollup/plugin-typescript": "11.1.5",
|
|
81
|
+
"rollup": "3.29.4",
|
|
82
|
+
"typescript": "5.0.2"
|
|
83
|
+
},
|
|
84
|
+
"size-limit": [
|
|
85
|
+
{
|
|
86
|
+
"name": "Geo (top-level class)",
|
|
87
|
+
"path": "./dist/esm/index.mjs",
|
|
88
|
+
"import": "{ Amplify, Geo }",
|
|
89
|
+
"limit": "43.9 kB"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"jest": {
|
|
93
|
+
"globals": {
|
|
94
|
+
"ts-jest": {
|
|
95
|
+
"diagnostics": true,
|
|
96
|
+
"tsConfig": {
|
|
97
|
+
"lib": [
|
|
98
|
+
"es5",
|
|
99
|
+
"es2015",
|
|
100
|
+
"dom",
|
|
101
|
+
"esnext.asynciterable",
|
|
102
|
+
"es2019.object"
|
|
103
|
+
],
|
|
104
|
+
"allowJs": true,
|
|
105
|
+
"noEmitOnError": false,
|
|
106
|
+
"esModuleInterop": true,
|
|
107
|
+
"downlevelIteration": true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"transform": {
|
|
112
|
+
"^.+\\.(js|jsx|ts|tsx)$": "ts-jest"
|
|
113
|
+
},
|
|
114
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
|
|
115
|
+
"testPathIgnorePatterns": [
|
|
116
|
+
"__tests__/model.ts",
|
|
117
|
+
"__tests__/schema.ts",
|
|
118
|
+
"__tests__/helpers.ts",
|
|
119
|
+
"__tests__/testData.ts",
|
|
120
|
+
"__tests__/testUtils.ts"
|
|
121
|
+
],
|
|
122
|
+
"moduleFileExtensions": [
|
|
123
|
+
"ts",
|
|
124
|
+
"tsx",
|
|
125
|
+
"js",
|
|
126
|
+
"json",
|
|
127
|
+
"jsx"
|
|
128
|
+
],
|
|
129
|
+
"testEnvironment": "jsdom",
|
|
130
|
+
"testURL": "http://localhost/",
|
|
131
|
+
"coverageThreshold": {
|
|
132
|
+
"global": {
|
|
133
|
+
"branches": 0,
|
|
134
|
+
"functions": 0,
|
|
135
|
+
"lines": 0,
|
|
136
|
+
"statements": 0
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"coveragePathIgnorePatterns": [
|
|
140
|
+
"node_modules",
|
|
141
|
+
"dist"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"gitHead": "f1408db3f570c4a18ada40cecbe7e68a0b31f1fe"
|
|
131
145
|
}
|
package/lib/Geo.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Place, Coordinates, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, MapStyle, GeofenceId, GeofenceInput, GeofenceOptions, SaveGeofencesResults, Geofence, ListGeofenceOptions, ListGeofenceResults, DeleteGeofencesResults, searchByPlaceIdOptions } 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): void;
|
|
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
|
-
* Get the map resources that are currently available through the provider
|
|
32
|
-
* @param {string} provider
|
|
33
|
-
* @returns - Array of available map resources
|
|
34
|
-
*/
|
|
35
|
-
getAvailableMaps(provider?: string): MapStyle[];
|
|
36
|
-
/**
|
|
37
|
-
* Get the map resource set as default in amplify config
|
|
38
|
-
* @param {string} provider
|
|
39
|
-
* @returns - Map resource set as the default in amplify config
|
|
40
|
-
*/
|
|
41
|
-
getDefaultMap(provider?: string): MapStyle;
|
|
42
|
-
/**
|
|
43
|
-
* Search by text input with optional parameters
|
|
44
|
-
* @param {string} text - The text string that is to be searched for
|
|
45
|
-
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
46
|
-
* @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
|
|
47
|
-
*/
|
|
48
|
-
searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
|
|
49
|
-
/**
|
|
50
|
-
* Search for search term suggestions based on input text
|
|
51
|
-
* @param {string} text - The text string that is to be search for
|
|
52
|
-
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
53
|
-
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
|
|
54
|
-
*/
|
|
55
|
-
searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<import("./types").SearchForSuggestionsResults>;
|
|
56
|
-
/**
|
|
57
|
-
* Search for location by unique ID
|
|
58
|
-
* @param {string} placeId - Unique ID of the location that is to be searched for
|
|
59
|
-
* @param {searchByPlaceIdOptions} options? - Optional parameters to the search
|
|
60
|
-
* @returns {Promise<Place>} - Resolves to a place with the given placeId
|
|
61
|
-
*/
|
|
62
|
-
searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place | undefined>;
|
|
63
|
-
/**
|
|
64
|
-
* Reverse geocoding search via a coordinate point on the map
|
|
65
|
-
* @param coordinates - Coordinates array for the search input
|
|
66
|
-
* @param options - Options parameters for the search
|
|
67
|
-
* @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
|
|
68
|
-
*/
|
|
69
|
-
searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
|
|
70
|
-
/**
|
|
71
|
-
* Create geofences
|
|
72
|
-
* @param geofences - Single or array of geofence objects to create
|
|
73
|
-
* @param options? - Optional parameters for creating geofences
|
|
74
|
-
* @returns {Promise<SaveGeofencesResults>} - Promise that resolves to an object with:
|
|
75
|
-
* successes: list of geofences successfully created
|
|
76
|
-
* errors: list of geofences that failed to create
|
|
77
|
-
*/
|
|
78
|
-
saveGeofences(geofences: GeofenceInput | GeofenceInput[], options?: GeofenceOptions): Promise<SaveGeofencesResults>;
|
|
79
|
-
/**
|
|
80
|
-
* Get a single geofence by geofenceId
|
|
81
|
-
* @param geofenceId: GeofenceId - The string id of the geofence to get
|
|
82
|
-
* @param options?: GeofenceOptions - Optional parameters for getting a geofence
|
|
83
|
-
* @returns Promise<Geofence> - Promise that resolves to a geofence object
|
|
84
|
-
*/
|
|
85
|
-
getGeofence(geofenceId: GeofenceId, options?: GeofenceOptions): Promise<Geofence>;
|
|
86
|
-
/**
|
|
87
|
-
* List geofences
|
|
88
|
-
* @param options?: ListGeofenceOptions
|
|
89
|
-
* @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
|
|
90
|
-
* entries: list of geofences - 100 geofences are listed per page
|
|
91
|
-
* nextToken: token for next page of geofences
|
|
92
|
-
*/
|
|
93
|
-
listGeofences(options?: ListGeofenceOptions): Promise<ListGeofenceResults>;
|
|
94
|
-
/**
|
|
95
|
-
* Delete geofences
|
|
96
|
-
* @param geofenceIds: string|string[]
|
|
97
|
-
* @param options?: GeofenceOptions
|
|
98
|
-
* @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
|
|
99
|
-
* successes: list of geofences successfully deleted
|
|
100
|
-
* errors: list of geofences that failed to delete
|
|
101
|
-
*/
|
|
102
|
-
deleteGeofences(geofenceIds: string | string[], options?: GeofenceOptions): Promise<DeleteGeofencesResults>;
|
|
103
|
-
}
|
|
104
|
-
export declare const Geo: GeoClass;
|
package/lib/index.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { GeoConfig, SearchByTextOptions, SearchByCoordinatesOptions, GeoProvider, Place, AmazonLocationServiceMapStyle, Coordinates, SearchForSuggestionsResults, GeofenceId, GeofenceInput, AmazonLocationServiceGeofenceOptions, AmazonLocationServiceListGeofenceOptions, ListGeofenceResults, SaveGeofencesResults, AmazonLocationServiceGeofence, AmazonLocationServiceDeleteGeofencesResults, searchByPlaceIdOptions } 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
|
-
private _credentials;
|
|
10
|
-
/**
|
|
11
|
-
* Initialize Geo with AWS configurations
|
|
12
|
-
* @param {Object} config - Configuration object for Geo
|
|
13
|
-
*/
|
|
14
|
-
constructor(config?: GeoConfig);
|
|
15
|
-
/**
|
|
16
|
-
* get the category of the plugin
|
|
17
|
-
* @returns {string} name of the category
|
|
18
|
-
*/
|
|
19
|
-
getCategory(): string;
|
|
20
|
-
/**
|
|
21
|
-
* get provider name of the plugin
|
|
22
|
-
* @returns {string} name of the provider
|
|
23
|
-
*/
|
|
24
|
-
getProviderName(): string;
|
|
25
|
-
/**
|
|
26
|
-
* Get the map resources that are currently available through the provider
|
|
27
|
-
* @returns {AmazonLocationServiceMapStyle[]}- Array of available map resources
|
|
28
|
-
*/
|
|
29
|
-
getAvailableMaps(): AmazonLocationServiceMapStyle[];
|
|
30
|
-
/**
|
|
31
|
-
* Get the map resource set as default in amplify config
|
|
32
|
-
* @returns {AmazonLocationServiceMapStyle} - Map resource set as the default in amplify config
|
|
33
|
-
*/
|
|
34
|
-
getDefaultMap(): AmazonLocationServiceMapStyle;
|
|
35
|
-
/**
|
|
36
|
-
* Search by text input with optional parameters
|
|
37
|
-
* @param {string} text - The text string that is to be searched for
|
|
38
|
-
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
39
|
-
* @returns {Promise<Place[]>} - Promise resolves to a list of Places that match search parameters
|
|
40
|
-
*/
|
|
41
|
-
searchByText(text: string, options?: SearchByTextOptions): Promise<Place[]>;
|
|
42
|
-
/**
|
|
43
|
-
* Search for suggestions based on the input text
|
|
44
|
-
* @param {string} text - The text string that is to be searched for
|
|
45
|
-
* @param {SearchByTextOptions} options? - Optional parameters to the search
|
|
46
|
-
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
|
|
47
|
-
*/
|
|
48
|
-
searchForSuggestions(text: string, options?: SearchByTextOptions): Promise<SearchForSuggestionsResults>;
|
|
49
|
-
private _verifyPlaceId;
|
|
50
|
-
searchByPlaceId(placeId: string, options?: searchByPlaceIdOptions): Promise<Place | undefined>;
|
|
51
|
-
/**
|
|
52
|
-
* Reverse geocoding search via a coordinate point on the map
|
|
53
|
-
* @param coordinates - Coordinates array for the search input
|
|
54
|
-
* @param options - Options parameters for the search
|
|
55
|
-
* @returns {Promise<Place>} - Promise that resolves to a place matching search coordinates
|
|
56
|
-
*/
|
|
57
|
-
searchByCoordinates(coordinates: Coordinates, options?: SearchByCoordinatesOptions): Promise<Place>;
|
|
58
|
-
/**
|
|
59
|
-
* Create geofences inside of a geofence collection
|
|
60
|
-
* @param geofences - Array of geofence objects to create
|
|
61
|
-
* @param options? - Optional parameters for creating geofences
|
|
62
|
-
* @returns {Promise<AmazonLocationServiceSaveGeofencesResults>} - Promise that resolves to an object with:
|
|
63
|
-
* successes: list of geofences successfully created
|
|
64
|
-
* errors: list of geofences that failed to create
|
|
65
|
-
*/
|
|
66
|
-
saveGeofences(geofences: GeofenceInput[], options?: AmazonLocationServiceGeofenceOptions): Promise<SaveGeofencesResults>;
|
|
67
|
-
/**
|
|
68
|
-
* Get geofence from a geofence collection
|
|
69
|
-
* @param geofenceId:string
|
|
70
|
-
* @param options?: Optional parameters for getGeofence
|
|
71
|
-
* @returns {Promise<AmazonLocationServiceGeofence>} - Promise that resolves to a geofence object
|
|
72
|
-
*/
|
|
73
|
-
getGeofence(geofenceId: GeofenceId, options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceGeofence>;
|
|
74
|
-
/**
|
|
75
|
-
* List geofences from a geofence collection
|
|
76
|
-
* @param options?: ListGeofenceOptions
|
|
77
|
-
* @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
|
|
78
|
-
* entries: list of geofences - 100 geofences are listed per page
|
|
79
|
-
* nextToken: token for next page of geofences
|
|
80
|
-
*/
|
|
81
|
-
listGeofences(options?: AmazonLocationServiceListGeofenceOptions): Promise<ListGeofenceResults>;
|
|
82
|
-
/**
|
|
83
|
-
* Delete geofences from a geofence collection
|
|
84
|
-
* @param geofenceIds: string|string[]
|
|
85
|
-
* @param options?: GeofenceOptions
|
|
86
|
-
* @returns {Promise<DeleteGeofencesResults>} - Promise that resolves to an object with:
|
|
87
|
-
* successes: list of geofences successfully deleted
|
|
88
|
-
* errors: list of geofences that failed to delete
|
|
89
|
-
*/
|
|
90
|
-
deleteGeofences(geofenceIds: string[], options?: AmazonLocationServiceGeofenceOptions): Promise<AmazonLocationServiceDeleteGeofencesResults>;
|
|
91
|
-
/**
|
|
92
|
-
* @private
|
|
93
|
-
*/
|
|
94
|
-
private _ensureCredentials;
|
|
95
|
-
private _refreshConfig;
|
|
96
|
-
private _verifyMapResources;
|
|
97
|
-
private _verifySearchIndex;
|
|
98
|
-
private _verifyGeofenceCollections;
|
|
99
|
-
private _AmazonLocationServiceBatchPutGeofenceCall;
|
|
100
|
-
private _AmazonLocationServiceBatchDeleteGeofenceCall;
|
|
101
|
-
}
|