fiftyone.geolocation 4.4.41 → 4.4.43
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.
|
@@ -55,7 +55,9 @@ let localResourceKey;
|
|
|
55
55
|
try {
|
|
56
56
|
localResourceKey = resourceKey;
|
|
57
57
|
} catch (e) {
|
|
58
|
-
if (e instanceof ReferenceError) {
|
|
58
|
+
if (e instanceof ReferenceError) {
|
|
59
|
+
console.log(e);
|
|
60
|
+
}
|
|
59
61
|
}
|
|
60
62
|
// You need to create a resource key at https://configure.51degrees.com and
|
|
61
63
|
// paste it into the code, replacing !!YOUR_RESOURCE_KEY!!.
|
|
@@ -63,7 +63,6 @@ const configFile = fs.readFileSync((process.env.directory || __dirname) +
|
|
|
63
63
|
const config = JSON.parse(configFile);
|
|
64
64
|
let resourceKeySet = true;
|
|
65
65
|
let resourceKeySetFromFile = true;
|
|
66
|
-
|
|
67
66
|
// Check if a resource key has been set in the config file.
|
|
68
67
|
if (config.PipelineOptions.Elements[0].elementParameters.resourceKey
|
|
69
68
|
.startsWith('!!')) {
|
|
@@ -73,7 +72,9 @@ if (config.PipelineOptions.Elements[0].elementParameters.resourceKey
|
|
|
73
72
|
try {
|
|
74
73
|
myResourceKey = resourceKey;
|
|
75
74
|
} catch (e) {
|
|
76
|
-
if (e instanceof ReferenceError) {
|
|
75
|
+
if (e instanceof ReferenceError) {
|
|
76
|
+
console.log(e);
|
|
77
|
+
}
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
// If not, check the resource key environment variable.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
const fs = require('fs');
|
|
@@ -64,17 +64,19 @@ if (isAsync) {
|
|
|
64
64
|
test('cloud getting started', async (done) => {
|
|
65
65
|
setTimeout(done, 1000);
|
|
66
66
|
|
|
67
|
-
testExample({ file: (__dirname
|
|
67
|
+
testExample({ file: path.resolve(__dirname, 'gettingStarted.js') });
|
|
68
68
|
});
|
|
69
|
+
|
|
69
70
|
test('combining services', async (done) => {
|
|
70
71
|
setTimeout(done, 1000);
|
|
71
72
|
|
|
72
|
-
testExample({ file: (__dirname
|
|
73
|
+
testExample({ file: path.resolve(__dirname, 'combiningServices.js') });
|
|
73
74
|
});
|
|
75
|
+
|
|
74
76
|
test('configure from file', async (done) => {
|
|
75
77
|
setTimeout(done, 1000);
|
|
76
78
|
|
|
77
|
-
testExample({ file: (__dirname
|
|
79
|
+
testExample({ file: path.resolve(__dirname, 'configureFromFile.js') });
|
|
78
80
|
});
|
|
79
81
|
} else {
|
|
80
82
|
// Skip if async is not available (e.g node 6)
|
|
@@ -104,7 +104,9 @@ let localResourceKey;
|
|
|
104
104
|
try {
|
|
105
105
|
localResourceKey = resourceKey;
|
|
106
106
|
} catch (e) {
|
|
107
|
-
if (e instanceof ReferenceError) {
|
|
107
|
+
if (e instanceof ReferenceError) {
|
|
108
|
+
console.log(e);
|
|
109
|
+
}
|
|
108
110
|
}
|
|
109
111
|
// You need to create a resource key at https://configure.51degrees.com and
|
|
110
112
|
// paste it into the code, replacing !!YOUR_RESOURCE_KEY!!.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -100,16 +100,20 @@ if (myResourceKey.substring(0, 2) === '!!') {
|
|
|
100
100
|
</p>
|
|
101
101
|
<dl>
|
|
102
102
|
<dt><strong>Country</strong></dt>
|
|
103
|
-
<dv>` + (data && data.country && data.country.hasValue
|
|
103
|
+
<dv>` + (data && data.country && data.country.hasValue
|
|
104
|
+
? data.country.value
|
|
104
105
|
: ('Unknown (' + (data && data.country ? data.country.noValueMessage : 'no data') + ')')) + `</dv>
|
|
105
106
|
<dt><strong>State</strong></dt>
|
|
106
|
-
<dv>` + (data && data.state && data.state.hasValue
|
|
107
|
+
<dv>` + (data && data.state && data.state.hasValue
|
|
108
|
+
? data.state.value
|
|
107
109
|
: ('Unknown (' + (data && data.state ? data.state.noValueMessage : 'no data') + ')')) + `</dv>
|
|
108
110
|
<dt><strong>County</strong></dt>
|
|
109
|
-
<dv>` + (data && data.county && data.county.hasValue
|
|
111
|
+
<dv>` + (data && data.county && data.county.hasValue
|
|
112
|
+
? data.county.value
|
|
110
113
|
: ('Unknown (' + (data && data.county ? data.county.noValueMessage : 'no data') + ')')) + `</dv>
|
|
111
114
|
<dt><strong>Town/City</strong></dt>
|
|
112
|
-
<dv>` + (data && data.town && data.town.hasValue
|
|
115
|
+
<dv>` + (data && data.town && data.town.hasValue
|
|
116
|
+
? data.town.value
|
|
113
117
|
: ('Unknown (' + (data && data.town ? data.town.noValueMessage : 'no data') + ')')) + `</dv>
|
|
114
118
|
</dl>
|
|
115
119
|
<p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiftyone.geolocation",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.43",
|
|
4
4
|
"description": "Perform reverse geocoding using longitude and latitude to populate postal addresses",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"51Degrees",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"test": "tests"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"test": "jest --ci --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura"
|
|
19
|
+
"test": "jest --ci --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura",
|
|
20
|
+
"lint": "eslint . --ext .js"
|
|
20
21
|
},
|
|
21
22
|
"author": "51Degrees Engineering <engineering@51degrees.com>",
|
|
22
23
|
"dependencies": {
|
|
@@ -27,12 +28,14 @@
|
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/node": "^15.14.9",
|
|
30
|
-
"eslint": "
|
|
31
|
-
"eslint-config-standard": "^
|
|
32
|
-
"eslint-plugin-import": "^2.
|
|
31
|
+
"eslint": "8.57.0",
|
|
32
|
+
"eslint-config-standard": "^17.0.0",
|
|
33
|
+
"eslint-plugin-import": "^2.26.0",
|
|
34
|
+
"eslint-plugin-jsdoc": "^38.1.6",
|
|
33
35
|
"eslint-plugin-node": "^11.1.0",
|
|
34
|
-
"eslint-plugin-promise": "^
|
|
35
|
-
"eslint-plugin-
|
|
36
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
37
|
+
"eslint-plugin-jest": "^23.13.2",
|
|
38
|
+
"eslint-plugin-n": "^15.0.0",
|
|
36
39
|
"jest": "^27.5.1",
|
|
37
40
|
"jest-expect-message": "^1.1.3",
|
|
38
41
|
"jest-junit": "^9.0.0"
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const path = require('path');
|
|
24
|
+
|
|
25
|
+
const GeoLocation = require(path.resolve(__dirname, '..'));
|
|
25
26
|
const myResourceKey = process.env.RESOURCE_KEY || '!!YOUR_RESOURCE_KEY!!';
|
|
26
27
|
|
|
27
28
|
const TestLat = '51.4578261';
|