@vizzly/api-client 0.0.30 → 0.0.32

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.
@@ -24,20 +24,20 @@ class Api {
24
24
  }
25
25
  execute(request) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
- var _a;
27
+ var _a, _b;
28
28
  const authHeaders = this.auth.buildAuthHeaders(request.acceptedAuthParams);
29
29
  const customHeaders = Object.assign(Object.assign({}, (request.headers || {})), (this.extraHeaders() || {}));
30
30
  const path = `${this.host}${request.path}`;
31
31
  const timedFetch = Monitor_1.Monitor.timeRequest(request.method, path, isomorphic_fetch_1.default);
32
32
  const res = yield timedFetch(path, {
33
33
  method: request.method,
34
- headers: Object.assign(Object.assign({ 'Content-Type': 'application/json', Accept: 'application/json' }, authHeaders), customHeaders),
34
+ headers: Object.assign(Object.assign({ 'Content-Type': 'application/json', Accept: 'application/json', 'User-Agent': `${VizzlyApiClientLogger_1.VizzlyApiClientLogger.UserAgentProduct} (Using client ${(_a = require('../../package.json')) === null || _a === void 0 ? void 0 : _a.version})` }, authHeaders), customHeaders),
35
35
  redirect: 'follow',
36
36
  referrerPolicy: 'no-referrer',
37
37
  body: request.body ? JSON.stringify(request.body) : null,
38
38
  signal: request.abortSignal,
39
39
  });
40
- let body = ((_a = res.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('json')) ? yield res.json() : res.text();
40
+ let body = ((_b = res.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('json')) ? yield res.json() : res.text();
41
41
  const queryEngineRequestId = res.headers.get('vizzly-query-engine-request-id') || '-';
42
42
  const vizzlyApiRequestId = res.headers.get('x-request-id') || '-';
43
43
  if (res.status === 500) {
@@ -5,6 +5,7 @@ type LoggerBackend = {
5
5
  error: (...args: any) => void;
6
6
  };
7
7
  export declare class VizzlyApiClientLogger {
8
+ static UserAgentProduct: string;
8
9
  private static backend;
9
10
  static setBackend(backend: LoggerBackend): void;
10
11
  static debug(...args: any): void;
@@ -27,3 +27,4 @@ class VizzlyApiClientLogger {
27
27
  }
28
28
  }
29
29
  exports.VizzlyApiClientLogger = VizzlyApiClientLogger;
30
+ VizzlyApiClientLogger.UserAgentProduct = 'Vizzly-Api-Client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly/api-client",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "private": false,
5
5
  "license": "NONE",
6
6
  "source": "src/index.ts",
@@ -18,6 +18,7 @@
18
18
  "@vizzly/auth": "^0.2.8",
19
19
  "jest": "^29.6.0",
20
20
  "lodash": "^4.17.21",
21
+ "nock": "^13.5.4",
21
22
  "prettier": "^3.2.5",
22
23
  "ts-jest": "^29.1.1",
23
24
  "ts-loader": "^9.5.1",