fiftyone.geolocation 4.4.45 → 4.4.47

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.
@@ -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
@@ -87,7 +87,7 @@ if (myResourceKey.substring(0, 2) === '!!') {
87
87
 
88
88
  let output = '';
89
89
 
90
- var data = flowData.location;
90
+ const data = flowData.location;
91
91
  console.log(data);
92
92
  // Print results of client side processing to the page.
93
93
  output += `<h2>Example</h2>
@@ -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 ({
@@ -54,8 +55,8 @@ class GeoLocationPipelineBuilder extends PipelineBuilder {
54
55
  // First we need the cloudRequestEngine
55
56
 
56
57
  const cloudRequestEngineOptions = {
57
- resourceKey: resourceKey,
58
- cloudRequestOrigin: cloudRequestOrigin
58
+ resourceKey,
59
+ cloudRequestOrigin
59
60
  };
60
61
  if (baseURL !== null) {
61
62
  cloudRequestEngineOptions.baseURL = baseURL;
@@ -65,7 +66,7 @@ class GeoLocationPipelineBuilder extends PipelineBuilder {
65
66
 
66
67
  // Then add the cloud geo-location engine
67
68
 
68
- this.flowElements.push(new GeoLocationCloud({ locationProvider: locationProvider }));
69
+ this.flowElements.push(new GeoLocationCloud({ locationProvider }));
69
70
  }
70
71
  }
71
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.geolocation",
3
- "version": "4.4.45",
3
+ "version": "4.4.47",
4
4
  "description": "Perform reverse geocoding using longitude and latitude to populate postal addresses",
5
5
  "keywords": [
6
6
  "51Degrees",
@@ -17,7 +17,8 @@
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>",
23
24
  "dependencies": {
@@ -31,14 +32,15 @@
31
32
  "eslint": "8.57.0",
32
33
  "eslint-config-standard": "^17.0.0",
33
34
  "eslint-plugin-import": "^2.26.0",
35
+ "eslint-plugin-jest": "^23.13.2",
34
36
  "eslint-plugin-jsdoc": "^38.1.6",
37
+ "eslint-plugin-n": "^15.0.0",
35
38
  "eslint-plugin-node": "^11.1.0",
36
39
  "eslint-plugin-promise": "^6.0.0",
37
- "eslint-plugin-jest": "^23.13.2",
38
- "eslint-plugin-n": "^15.0.0",
39
40
  "jest": "^27.5.1",
40
41
  "jest-expect-message": "^1.1.3",
41
- "jest-junit": "^9.0.0"
42
+ "jest-junit": "^9.0.0",
43
+ "typescript": "^5.4.5"
42
44
  },
43
45
  "license": "EUPL-1.2",
44
46
  "bugs": {
@@ -103,7 +103,7 @@ if (isAsync) {
103
103
  resourceKey: myResourceKey,
104
104
  locationProvider: 'fiftyonedegrees'
105
105
  }).build();
106
- var engine = pipeline.flowElements.location;
106
+ const engine = pipeline.flowElements.location;
107
107
 
108
108
  await testAvailableProperties(done, pipeline, engine);
109
109
  });
@@ -117,7 +117,7 @@ if (isAsync) {
117
117
  resourceKey: myResourceKey,
118
118
  locationProvider: 'fiftyonedegrees'
119
119
  }).build();
120
- var engine = pipeline.flowElements.location;
120
+ const engine = pipeline.flowElements.location;
121
121
 
122
122
  await testValueTypes(done, pipeline, engine);
123
123
  });
@@ -136,7 +136,7 @@ async function testAvailableProperties (done, pipeline, engine) {
136
136
 
137
137
  expectedProperties[engine.dataKey].forEach(key => {
138
138
  try {
139
- var apv = flowData[engine.dataKey][key];
139
+ const apv = flowData[engine.dataKey][key];
140
140
  if (apv === undefined) {
141
141
  done.fail(new Error(`Aspect property value for ${key} should not be undefined.`));
142
142
  }
@@ -168,9 +168,9 @@ async function testValueTypes (done, pipeline, engine) {
168
168
 
169
169
  Object.keys(engine.properties).forEach(key => {
170
170
  if (expectedProperties[engine.dataKey].includes(key)) {
171
- var property = engine.properties[key.toLowerCase()];
172
- var expectedType = property.type;
173
- var apv = flowData[engine.dataKey][key];
171
+ const property = engine.properties[key.toLowerCase()];
172
+ const expectedType = property.type;
173
+ const apv = flowData[engine.dataKey][key];
174
174
 
175
175
  expect(apv).not.toBeNull();
176
176
  expect(apv).toBeDefined();
@@ -185,8 +185,8 @@ async function testValueTypes (done, pipeline, engine) {
185
185
  expect.extend({
186
186
  // Method to validate a given value has the expected type.
187
187
  toBe51DType (received, name, fodType) {
188
- var valueType = typeof received;
189
- var valid = false;
188
+ const valueType = typeof received;
189
+ let valid = false;
190
190
 
191
191
  switch (fodType) {
192
192
  case 'Boolean':
@@ -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