arky-sdk 0.3.17 → 0.3.19
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/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +11 -1
- package/dist/types.d.ts +11 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -81,15 +81,20 @@ function createHttpClient(cfg) {
|
|
|
81
81
|
"Content-Type": "application/json",
|
|
82
82
|
...options?.headers || {}
|
|
83
83
|
};
|
|
84
|
-
let { accessToken, expiresAt } = await cfg.getToken();
|
|
84
|
+
let { accessToken, expiresAt, provider } = await cfg.getToken();
|
|
85
85
|
const nowSec = Date.now() / 1e3;
|
|
86
86
|
if (expiresAt && nowSec > expiresAt) {
|
|
87
87
|
await ensureFreshToken();
|
|
88
88
|
const tokens = await cfg.getToken();
|
|
89
89
|
accessToken = tokens.accessToken;
|
|
90
|
+
provider = tokens.provider;
|
|
90
91
|
}
|
|
91
92
|
if (accessToken) {
|
|
92
|
-
|
|
93
|
+
if (provider === "API") {
|
|
94
|
+
headers["X-API-Key"] = accessToken;
|
|
95
|
+
} else {
|
|
96
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
99
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
95
100
|
const fetchOpts = { method, headers };
|
|
@@ -1512,7 +1517,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1512
1517
|
}
|
|
1513
1518
|
|
|
1514
1519
|
// src/index.ts
|
|
1515
|
-
var SDK_VERSION = "0.3.
|
|
1520
|
+
var SDK_VERSION = "0.3.18";
|
|
1516
1521
|
var SUPPORTED_FRAMEWORKS = [
|
|
1517
1522
|
"astro",
|
|
1518
1523
|
"react",
|