@itentialopensource/adapter-utils 4.44.7 → 4.45.0

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.
@@ -428,7 +428,8 @@ class AdapterPropertyUtil {
428
428
  filter: {
429
429
  id: this.myid,
430
430
  entity: entityName
431
- }
431
+ },
432
+ entity: entityName
432
433
  };
433
434
 
434
435
  // call to get the adapter schema from the database
@@ -19,6 +19,7 @@ let basepathGl = null;
19
19
  let globalRequestGl = null;
20
20
  let returnRawGl = false;
21
21
  let encodePath = true;
22
+ let encodeUri = true;
22
23
 
23
24
  // INTERNAL FUNCTIONS
24
25
  /*
@@ -677,7 +678,23 @@ function buildRequestPath(entity, action, entitySchema, reqPath, uriPathVars, ur
677
678
  addquery = entitySchema.querykey;
678
679
  }
679
680
  if (systemQuery !== null) {
680
- addquery += querystring.stringify(systemQuery);
681
+ // if we are encoding - use querystring since it does it all!
682
+ if (encodeUri === true) {
683
+ addquery += querystring.stringify(systemQuery);
684
+ } else {
685
+ // if not encoding we need to build
686
+ const qkeys = Object.keys(systemQuery);
687
+
688
+ // add each query parameter and its value
689
+ for (let k = 0; k < qkeys.length; k += 1) {
690
+ // need to add separator for everything after the first one
691
+ if (k > 0) {
692
+ addquery += '&';
693
+ }
694
+ // adds key=value
695
+ addquery += `${qkeys[k]}=${systemQuery[qkeys[k]]}`;
696
+ }
697
+ }
681
698
  }
682
699
  }
683
700
 
@@ -897,7 +914,7 @@ function buildPayload(entity, action, entitySchema, payload) {
897
914
  }
898
915
  }
899
916
  } else {
900
- log.warn(`${origin}: Payload and Gloabl Payload can not be merged!`);
917
+ log.warn(`${origin}: Payload and Global Payload can not be merged!`);
901
918
  }
902
919
  }
903
920
 
@@ -988,6 +1005,8 @@ class RestHandler {
988
1005
  this.globalRequest = null;
989
1006
  this.encode = properties.encode_pathvars;
990
1007
  encodePath = this.encode;
1008
+ this.encodeQ = properties.encode_queryvars;
1009
+ encodeUri = this.encodeQ;
991
1010
 
992
1011
  // only need to set returnRaw if the property is true - defaults to false
993
1012
  if (properties.request && properties.request.return_raw) {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.44.7",
3
+ "version": "4.45.0",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "preinstall": "node utils/setup.js",
7
7
  "lint": "eslint . --ext .json --ext .js",
8
8
  "lint:errors": "eslint --quiet . --ext .json --ext .js",
9
- "test:unit": "mocha test/unit/lib/requestHandlerTest.js --LOG=error && mocha test/unit/lib/restHandlerTest.js --LOG=error && mocha test/unit/lib/propertyUtilTest.js --LOG=error && mocha test/unit/lib/translatorUtilTest.js --LOG=error && mocha test/unit/lib/dbUtilTest.js --LOG=error",
9
+ "test:unit": "mocha test/unit/lib/requestHandlerTest.js --LOG=error && mocha test/unit/lib/restHandlerTest.js --LOG=error && mocha test/unit/lib/propertyUtilTest.js --LOG=error && mocha test/unit/lib/translatorUtilTest.js --LOG=error && mocha test/unit/lib/dbUtilTest.js --LOG=debug",
10
10
  "test:integration": "mocha test/integration/lib/requestHandlerTest.js --LOG=error && mocha test/integration/lib/restHandlerTest.js --LOG=error",
11
11
  "test:cover": "nyc --reporter html --reporter text mocha --recursive --reporter dot test/*",
12
12
  "test": "npm run test:unit && npm run test:integration",
13
- "deploy": "npm publish --registry=http://registry.npmjs.org --access=public",
13
+ "deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
14
14
  "build": "npm run deploy"
15
15
  },
16
16
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "eslint-plugin-json": "^3.0.0",
52
52
  "mocha": "^9.0.1",
53
53
  "nyc": "^15.1.0",
54
- "strip-ansi": "^7.0.0",
54
+ "strip-ansi": "^7.0.1",
55
55
  "strip-ansi-cli": "^3.0.1",
56
56
  "testdouble": "^3.16.1",
57
57
  "winston": "^3.3.3"
@@ -51,6 +51,11 @@
51
51
  "description": "When true the path variables are encoded in the url",
52
52
  "default": true
53
53
  },
54
+ "encode_queryvars": {
55
+ "type": "boolean",
56
+ "description": "When true the query variables are encoded in the url",
57
+ "default": true
58
+ },
54
59
  "save_metric": {
55
60
  "type": [
56
61
  "boolean",