@vizzly/api-client 0.0.33 → 0.0.34
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/dist/models/Api.d.ts +1 -0
- package/dist/models/Api.js +11 -1
- package/package.json +1 -1
package/dist/models/Api.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export declare class Api {
|
|
|
6
6
|
protected auth: Authentication;
|
|
7
7
|
constructor(auth: Authentication, host: string, extraHeaders?: () => {});
|
|
8
8
|
execute<ResponseBody>(request: Request<any>): Promise<Response<ResponseBody>>;
|
|
9
|
+
originApp(): string;
|
|
9
10
|
getAuth(): Authentication;
|
|
10
11
|
}
|
package/dist/models/Api.js
CHANGED
|
@@ -31,7 +31,7 @@ class Api {
|
|
|
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', 'Vizzly-User-Agent': `${VizzlyApiClientLogger_1.VizzlyApiClientLogger.UserAgentProduct} (Using client ${(_a = require('../../package.json')) === null || _a === void 0 ? void 0 : _a.version})` }, authHeaders), customHeaders),
|
|
34
|
+
headers: Object.assign(Object.assign({ 'Content-Type': 'application/json', Accept: 'application/json', 'Vizzly-User-Agent': `${VizzlyApiClientLogger_1.VizzlyApiClientLogger.UserAgentProduct}${this.originApp()} (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,
|
|
@@ -47,6 +47,16 @@ class Api {
|
|
|
47
47
|
return { body: body, status: res.status, headers: res.headers };
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
originApp() {
|
|
51
|
+
const isServer = !(typeof window != 'undefined' && window.document);
|
|
52
|
+
if (isServer) {
|
|
53
|
+
const origin = process.env['VIZZLY_ORIGIN_APP'] || '';
|
|
54
|
+
if (origin == '')
|
|
55
|
+
return '';
|
|
56
|
+
return ` (${origin})`;
|
|
57
|
+
}
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
50
60
|
getAuth() {
|
|
51
61
|
return this.auth;
|
|
52
62
|
}
|