fiftyone.pipeline.cloudrequestengine 4.4.91 → 4.4.93

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.
@@ -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 util = require('util');
@@ -52,7 +52,7 @@ class CloudRequestEngine extends Engine {
52
52
  * made from a origin matching those allowed by the resource key.
53
53
  * For more detail, see the 'Request Headers' section in the
54
54
  * <a href="https://cloud.51degrees.com/api-docs/index.html">cloud documentation</a>.
55
- * @param options.requestClient
55
+ * @param {RequestClient} options.requestClient Set predefined RequestClient.
56
56
  */
57
57
  constructor (
58
58
  {
@@ -176,8 +176,7 @@ class CloudRequestEngine extends Engine {
176
176
  * However, transport level errors or other failures can result in
177
177
  * responses that are plain text. This function handles these cases.
178
178
  *
179
- * @param {string} response the response data to process
180
- * @param responseBody
179
+ * @param {string} responseBody the response data to process
181
180
  * @returns {Array} The error messages
182
181
  */
183
182
  getErrorMessages (responseBody) {
@@ -196,7 +195,8 @@ class CloudRequestEngine extends Engine {
196
195
  /**
197
196
  * Used to handle errors from http requests
198
197
  *
199
- * @param response
198
+ * @param {http.ServerResponse} response Responce to get errors from
199
+ * @returns {Array<CloudRequestError>} Array of CloudRequestError from response
200
200
  */
201
201
  getErrorsFromResponse (response) {
202
202
  let content = response;
@@ -370,7 +370,7 @@ class CloudRequestEngine extends Engine {
370
370
  * If there are evidence keys other than 'query.' that conflict then
371
371
  * this is unexpected so a warning will be logged.
372
372
  *
373
- * @param {FlowData} flowData
373
+ * @param {FlowData} flowData FlowData to get evidence from
374
374
  * @returns {Evidence} Evidence Dictionary
375
375
  */
376
376
  getContent (flowData) {
@@ -393,7 +393,7 @@ class CloudRequestEngine extends Engine {
393
393
  /**
394
394
  * Add query data to the evidence.
395
395
  *
396
- * @param flowData
396
+ * @param {FlowData} flowData FlowData for logging
397
397
  * @param {object} queryData The destination dictionary to add query data to.
398
398
  * @param {Evidence} allEvidence All evidence in the flow data. This is used to
399
399
  * report which evidence keys are conflicting.
@@ -449,6 +449,7 @@ class CloudRequestEngine extends Engine {
449
449
  *
450
450
  * @param {Evidence} evidence All evidence in the flow data.
451
451
  * @param {stirng} type Required evidence key prefix
452
+ * @returns {Evidence} Selected evidence
452
453
  */
453
454
  getSelectedEvidence (evidence, type) {
454
455
  let selectedEvidence = {};
@@ -483,7 +484,7 @@ class CloudRequestEngine extends Engine {
483
484
  *
484
485
  * @param {string} itemKey Key to check
485
486
  * @param {string} prefix The prefix to check for.
486
- * @returns True if the key has the prefix.
487
+ * @returns {boolean} True if the key has the prefix.
487
488
  */
488
489
  hasKeyPrefix (itemKey, prefix) {
489
490
  return itemKey.startsWith(prefix + '.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.pipeline.cloudrequestengine",
3
- "version": "4.4.91",
3
+ "version": "4.4.93",
4
4
  "description": "Cloud request engine for the 51Degrees Pipeline API",
5
5
  "keywords": [
6
6
  "51degrees",
package/requestClient.js CHANGED
@@ -28,7 +28,7 @@ class RequestClient {
28
28
  * @param {*} data The data to send in the body of the request
29
29
  * @param {*} origin The value to use for the Origin header when
30
30
  * making the request
31
- * @returns a Promise. The resolve function will be passed the content
31
+ * @returns {Promise} The resolve function will be passed the content
32
32
  * from the response and the reject function will be passed
33
33
  * an object with 3 properties:
34
34
  * headers = HTTP headers in the response
@@ -43,9 +43,8 @@ class RequestClient {
43
43
  } else {
44
44
  httpModule = require('http');
45
45
  }
46
-
46
+ let requestData = '';
47
47
  if (data) {
48
- var requestData = '';
49
48
  const keys = Object.keys(data);
50
49
  for (let i = 0; i < keys.length; i++) {
51
50
  requestData += encodeURIComponent(keys[i]) + '=' + encodeURIComponent(data[keys[i]]);
@@ -104,7 +103,7 @@ class RequestClient {
104
103
  * @param {*} url The url to send a request to
105
104
  * @param {*} origin The value to use for the Origin header when
106
105
  * making the request
107
- * @returns a Promise. The resolve function will be passed the content
106
+ * @returns {Promise} The resolve function will be passed the content
108
107
  * from the response and the reject function will be passed
109
108
  * an object with 3 properties:
110
109
  * headers = HTTP headers in the response
@@ -215,9 +215,10 @@ test('validate case when cloud unavailable', (done) => {
215
215
  });
216
216
 
217
217
  /**
218
+ * Check if Properties contains name
218
219
  *
219
- * @param properties
220
- * @param name
220
+ * @param {object} properties Object of properties
221
+ * @param {string} name Name of the property
221
222
  */
222
223
  function propertiesContainName (properties, name) {
223
224
  expect(properties[name.toLowerCase()]).not.toBeUndefined();