@vouchfor/sdk 1.1.21 → 1.1.22

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.
@@ -15,8 +15,8 @@ class IntegrationService extends BaseIntegrationService {
15
15
 
16
16
  authenticate({ applicationId, entityId, mappingId }) {
17
17
  if (applicationId) {
18
- const entity = entityId ? `/${entityId}` : '';
19
- return this._request({ path: `applications/${applicationId}/entity` + entity });
18
+ const path = entityId ? `/${entityId}` : '';
19
+ return this._request({ path: `applications/${applicationId}/entity` + path });
20
20
  } else if (entityId) {
21
21
  return this._request({ path: `entities/${entityId}` });
22
22
  } else if (mappingId) {
@@ -21,8 +21,12 @@ class VouchService extends BaseRestService {
21
21
  });
22
22
  }
23
23
 
24
- get(id, apiKey) {
25
- return this._request({ apiKey, path: `${id}` });
24
+ get(id, apiKey, media = false) {
25
+ const query = media ? '?media=true' : ''
26
+ return this._request({
27
+ apiKey,
28
+ path: `${id}`+ query
29
+ });
26
30
  }
27
31
 
28
32
  counts(id, apiKey) {
@@ -24,8 +24,7 @@ function logHttpResponse({ req, res, body, result, logger }) {
24
24
  const { protocol, method, host, _header: header } = req._currentRequest;
25
25
  const get = req.type === 'GET';
26
26
  const type = res.headers['content-type'] ?? 'application/json';
27
- const json = type.indexOf('application/json') !== -1;
28
- const data = (json && body ? JSON.stringify(body) : body || '') + '\n';
27
+ const data = (typeof body === 'object' ? JSON.stringify(body) : body || '') + '\n';
29
28
  const request = header + (get ? '' : data);
30
29
  const { httpVersion, statusCode, statusMessage } = res;
31
30
  const headers = [];
@@ -51,8 +50,7 @@ function logHttpError({ req, err, body, logger }) {
51
50
  const res = { headers: parseHttpHeaders(header) };
52
51
  const get = req.type === 'GET';
53
52
  const type = res.headers['content-type'] ?? 'application/json';
54
- const json = type.indexOf('application/json') !== -1;
55
- const data = (json && body ? JSON.stringify(body) : body || '') + '\n';
53
+ const data = (typeof body === 'object' ? JSON.stringify(body) : body || '') + '\n';
56
54
  const request = header + (get ? '' : data);
57
55
  const error = err + `\r\n`;
58
56
  logger.info(`${(protocol + ' ' + method).toUpperCase()} request to host: ${host}\n`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/sdk",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Vouch API SDK",
5
5
  "main": "lib/index.js",
6
6
  "repository": {