@veritree/services 2.16.0 → 2.18.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.
package/index.js CHANGED
@@ -28,6 +28,7 @@ import { Evidence } from './src/endpoints/evidence';
28
28
  import { Crumbs } from './src/endpoints/crumbs';
29
29
  import { Verifications } from './src/endpoints/verifications';
30
30
  import { ImagesAggregated } from './src/endpoints/images-aggregated';
31
+ import { ssoToken } from './src/endpoints/sso-token';
31
32
 
32
33
  export {
33
34
  BulkUploads,
@@ -59,5 +60,6 @@ export {
59
60
  Evidence,
60
61
  Crumbs,
61
62
  Verifications,
62
- ImagesAggregated
63
+ ImagesAggregated,
64
+ ssoToken
63
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,5 @@
1
+ import Api from "../helpers/api";
2
+
3
+ const resource = "sso-token";
4
+
5
+ export const ssoToken = new Api(resource);
package/src/utils/args.js CHANGED
@@ -20,7 +20,24 @@ export const createParamsStringFromArgs = (args) => {
20
20
  paramsString.push(arr);
21
21
  } else {
22
22
  if (value !== undefined) {
23
- paramsString.push(`${key}=${encodeURIComponent(value)}`);
23
+ /**
24
+ * as args is an object, we can't pass same keys
25
+ * and sometimes the api might need the keys
26
+ * to be equal (e.g box=1&box=2...). As a
27
+ * solution, we have this -x- to allow
28
+ * same keys to be passed. The args
29
+ * would look like:
30
+ *
31
+ * {
32
+ * 'box-x-1': 1
33
+ * 'box-x-2': 2
34
+ * }
35
+ *
36
+ * and would be translated as expected:
37
+ *
38
+ * box=1&box=2
39
+ */
40
+ paramsString.push(`${key.split('-x-')[0]}=${encodeURIComponent(value)}`);
24
41
  }
25
42
  }
26
43
  });