scavio 0.18.0 → 0.18.1
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/README.md +14 -10
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -129,12 +129,25 @@ function parseRetryAfter(header) {
|
|
|
129
129
|
var BASE_URL = "https://api.scavio.dev";
|
|
130
130
|
var DEFAULT_TIMEOUT = 3e4;
|
|
131
131
|
var DEFAULT_MAX_RETRIES = 2;
|
|
132
|
+
var SDK_VERSION = true ? "0.18.1" : "0.0.0";
|
|
133
|
+
var USER_AGENT = `scavio-js/${SDK_VERSION}`;
|
|
134
|
+
function isServerRuntime() {
|
|
135
|
+
const g = globalThis;
|
|
136
|
+
if (typeof g.window !== "undefined" && typeof g.document !== "undefined") {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
return typeof g.process?.versions?.node === "string";
|
|
140
|
+
}
|
|
132
141
|
function buildHeaders(apiKey) {
|
|
133
|
-
|
|
142
|
+
const headers = {
|
|
134
143
|
Authorization: `Bearer ${apiKey}`,
|
|
135
144
|
"Content-Type": "application/json",
|
|
136
145
|
"X-Client-Source": "scavio-js"
|
|
137
146
|
};
|
|
147
|
+
if (isServerRuntime()) {
|
|
148
|
+
headers["User-Agent"] = USER_AGENT;
|
|
149
|
+
}
|
|
150
|
+
return headers;
|
|
138
151
|
}
|
|
139
152
|
function stripUndefined(obj) {
|
|
140
153
|
const result = {};
|