fiftyone.geolocation 4.4.46 → 4.4.48

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/README.md CHANGED
@@ -13,8 +13,8 @@ This repository contains the geo-location engines for the Node.js implementation
13
13
  The Pipeline engines are written in Node.js and target 6 and above.
14
14
 
15
15
  ## Packages
16
- - **geoLocationCloud** - A Node.js engine which retrieves geo-location results by consuming data from the 51Degrees cloud service.
17
- - **geoLocationPipelineBuilder** - Contains the geo-location engine builders.
16
+ - [**geoLocationCloud**](/geoLocationCloud.js) - A Node.js engine which retrieves geo-location results by consuming data from the 51Degrees cloud service.
17
+ - [**geoLocationPipelineBuilder**](/geoLocationPipelineBuilder.js) - Contains the geo-location engine builders.
18
18
 
19
19
  ## Installation
20
20
 
@@ -32,21 +32,25 @@ Examples can be found in the `examples/` folder. See below for a list of example
32
32
 
33
33
  |Example|Description|Implemtation|
34
34
  |-------|-----------|------------|
35
- |gettingStarted.js|This example uses geo-location to determine the country from a longitude and latitude.|Cloud|
36
- |combiningServices.js|This example uses geo-location alongside device detection to determine the country and device.|Cloud|
37
- |configureFromFile.js|This example shows how to configure pipeline with geo-location from a configuration file.|Cloud|
38
- |webIntegration.js|This example demonstrates how to get location information from the device that a user is using to access a website.|Cloud|
35
+ |[gettingStarted.js](/examples/gettingStarted.js)|This example uses geo-location to determine the country from a longitude and latitude.|Cloud|
36
+ |[combiningServices.js](/examples/combiningServices.js)|This example uses geo-location alongside device detection to determine the country and device.|Cloud|
37
+ |[configureFromFile.js](/examples/configureFromFile.js)|This example shows how to configure pipeline with geo-location from a configuration file.|Cloud|
38
+ |[webIntegration.js](/examples/webIntegration.js)|This example demonstrates how to get location information from the device that a user is using to access a website.|Cloud|
39
39
 
40
40
  ## Tests
41
41
 
42
42
  In this repository, there are tests for the examples.
43
43
  You will need to install jest to run them:
44
44
 
45
- `npm install jest --global`
45
+ ```
46
+ npm install jest --global
47
+ ```
46
48
 
47
49
  To run the tests, then call:
48
50
 
49
- `jest`
51
+ ```
52
+ jest
53
+ ```
50
54
 
51
55
  ## Project documentation
52
56
 
@@ -0,0 +1,8 @@
1
+ param (
2
+ [Parameter(Mandatory=$true)]
3
+ [string]$RepoName
4
+ )
5
+
6
+ ./node/generate-types.ps1 -RepoName $RepoName
7
+
8
+ exit $LASTEXITCODE
@@ -18,21 +18,27 @@
18
18
  * including the attribution notice(s) required under Article 5 of the EUPL
19
19
  * in the end user terms of the application under an appropriate heading,
20
20
  * such notice(s) shall fulfill the requirements of that article.
21
- * ********************************************************************* */
22
-
23
- const CloudEngine = require('fiftyone.pipeline.cloudrequestengine').CloudEngine;
24
-
25
- class GeoLocationCloud extends CloudEngine {
26
- constructor ({ locationProvider }) {
27
- super(...arguments);
28
- if (locationProvider === 'fiftyonedegrees') {
29
- this.dataKey = 'location';
30
- } else if (locationProvider === 'digitalelement') {
31
- this.dataKey = 'location_digitalelement';
32
- } else {
33
- throw "The location provider '" + locationProvider + "' was not recognized.";
34
- }
35
- }
36
- }
37
-
38
- module.exports = GeoLocationCloud;
21
+ * ********************************************************************* */
22
+
23
+ const CloudEngine = require('fiftyone.pipeline.cloudrequestengine').CloudEngine;
24
+
25
+ class GeoLocationCloud extends CloudEngine {
26
+ /**
27
+ * Constructor for GeoLocationCloud
28
+ *
29
+ * @param {object} options the options for GeoLocationCloud
30
+ * @param {string} options.locationProvider name of location provider
31
+ */
32
+ constructor ({ locationProvider }) {
33
+ super(...arguments);
34
+ if (locationProvider === 'fiftyonedegrees') {
35
+ this.dataKey = 'location';
36
+ } else if (locationProvider === 'digitalelement') {
37
+ this.dataKey = 'location_digitalelement';
38
+ } else {
39
+ throw "The location provider '" + locationProvider + "' was not recognized.";
40
+ }
41
+ }
42
+ }
43
+
44
+ module.exports = GeoLocationCloud;
@@ -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 GeoLocationCloud = require('./geoLocationCloud');
@@ -34,6 +34,7 @@ class GeoLocationPipelineBuilder extends PipelineBuilder {
34
34
  * @param {String} options.locationProvider // the provider to request data from. Either "fiftyonedegrees" or "digitalelement".
35
35
  * @param {string} options.cloudRequestOrigin The value to set the
36
36
  * Origin header to when making requests to the cloud service
37
+ * @param {string} options.baseURL base URL for cloud request
37
38
  *
38
39
  */
39
40
  constructor ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.geolocation",
3
- "version": "4.4.46",
3
+ "version": "4.4.48",
4
4
  "description": "Perform reverse geocoding using longitude and latitude to populate postal addresses",
5
5
  "keywords": [
6
6
  "51Degrees",
@@ -17,9 +17,14 @@
17
17
  },
18
18
  "scripts": {
19
19
  "test": "jest --ci --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura",
20
- "lint": "eslint . --ext .js"
20
+ "lint": "eslint . --ext .js",
21
+ "tsc": "tsc -b --force"
21
22
  },
22
23
  "author": "51Degrees Engineering <engineering@51degrees.com>",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/51Degrees/location-node"
27
+ },
23
28
  "dependencies": {
24
29
  "fiftyone.pipeline.cloudrequestengine": "4.4.x",
25
30
  "fiftyone.pipeline.core": "4.4.x",
@@ -31,14 +36,15 @@
31
36
  "eslint": "8.57.0",
32
37
  "eslint-config-standard": "^17.0.0",
33
38
  "eslint-plugin-import": "^2.26.0",
39
+ "eslint-plugin-jest": "^23.13.2",
34
40
  "eslint-plugin-jsdoc": "^38.1.6",
41
+ "eslint-plugin-n": "^15.0.0",
35
42
  "eslint-plugin-node": "^11.1.0",
36
43
  "eslint-plugin-promise": "^6.0.0",
37
- "eslint-plugin-jest": "^23.13.2",
38
- "eslint-plugin-n": "^15.0.0",
39
44
  "jest": "^27.5.1",
40
45
  "jest-expect-message": "^1.1.3",
41
- "jest-junit": "^9.0.0"
46
+ "jest-junit": "^9.0.0",
47
+ "typescript": "^5.4.5"
42
48
  },
43
49
  "license": "EUPL-1.2",
44
50
  "bugs": {
@@ -1,7 +1,13 @@
1
1
  export = GeoLocationCloud;
2
- declare const GeoLocationCloud_base: typeof import("fiftyone.pipeline.cloudrequestengine/types/cloudEngine");
3
- declare class GeoLocationCloud extends GeoLocationCloud_base {
2
+ declare class GeoLocationCloud {
3
+ /**
4
+ * Constructor for GeoLocationCloud
5
+ *
6
+ * @param {object} options the options for GeoLocationCloud
7
+ * @param {string} options.locationProvider name of location provider
8
+ */
4
9
  constructor({ locationProvider }: {
5
- locationProvider: any;
10
+ locationProvider: string;
6
11
  }, ...args: any[]);
12
+ dataKey: string;
7
13
  }
@@ -7,11 +7,16 @@ declare class GeoLocationPipelineBuilder extends GeoLocationPipelineBuilder_base
7
7
  * @param {Boolean} options.shareUsage // include share usage element?
8
8
  * @param {String} options.resourceKey // resourceKey for cloud
9
9
  * @param {String} options.locationProvider // the provider to request data from. Either "fiftyonedegrees" or "digitalelement".
10
+ * @param {string} options.cloudRequestOrigin The value to set the
11
+ * Origin header to when making requests to the cloud service
12
+ * @param {string} options.baseURL base URL for cloud request
10
13
  *
11
14
  */
12
- constructor({ shareUsage, resourceKey, locationProvider, baseURL }: {
15
+ constructor({ shareUsage, resourceKey, locationProvider, baseURL, cloudRequestOrigin }: {
13
16
  shareUsage: boolean;
14
17
  resourceKey: string;
15
18
  locationProvider: string;
19
+ cloudRequestOrigin: string;
20
+ baseURL: string;
16
21
  }, ...args: any[]);
17
22
  }
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const GeoLocationCloud: typeof import("./geoLocationCloud");
2
- export const GeoLocationPipelineBuilder: typeof import("./geoLocationPipelineBuilder");
1
+ export let GeoLocationCloud: typeof import("./geoLocationCloud");
2
+ export let GeoLocationPipelineBuilder: typeof import("./geoLocationPipelineBuilder");
File without changes