@echoxyz/sonar-core 0.1.2 → 0.1.4
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +12 -6
- package/dist/index.js +12 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -173,15 +173,21 @@ var SonarClient = class {
|
|
|
173
173
|
fetchFn;
|
|
174
174
|
onUnauthorized;
|
|
175
175
|
constructor(args) {
|
|
176
|
-
var _a, _b
|
|
176
|
+
var _a, _b;
|
|
177
177
|
this.apiURL = args.apiURL;
|
|
178
178
|
this.auth = ((_a = args.opts) == null ? void 0 : _a.auth) ?? new AuthSession({ storage: createWebStorage() });
|
|
179
|
-
const fetchImpl = ((
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
const fetchImpl = (() => {
|
|
180
|
+
var _a2;
|
|
181
|
+
if ((_a2 = args.opts) == null ? void 0 : _a2.fetch) {
|
|
182
|
+
return args.opts.fetch;
|
|
183
|
+
}
|
|
184
|
+
if (typeof globalThis.fetch === "function") {
|
|
185
|
+
return globalThis.fetch.bind(globalThis);
|
|
186
|
+
}
|
|
187
|
+
throw new Error("No fetch implementation available");
|
|
188
|
+
})();
|
|
183
189
|
this.fetchFn = fetchImpl;
|
|
184
|
-
this.onUnauthorized = (
|
|
190
|
+
this.onUnauthorized = (_b = args.opts) == null ? void 0 : _b.onUnauthorized;
|
|
185
191
|
}
|
|
186
192
|
// Expose token management methods from the underlying AuthSession for convenience
|
|
187
193
|
setToken(token) {
|
package/dist/index.js
CHANGED
|
@@ -137,15 +137,21 @@ var SonarClient = class {
|
|
|
137
137
|
fetchFn;
|
|
138
138
|
onUnauthorized;
|
|
139
139
|
constructor(args) {
|
|
140
|
-
var _a, _b
|
|
140
|
+
var _a, _b;
|
|
141
141
|
this.apiURL = args.apiURL;
|
|
142
142
|
this.auth = ((_a = args.opts) == null ? void 0 : _a.auth) ?? new AuthSession({ storage: createWebStorage() });
|
|
143
|
-
const fetchImpl = ((
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const fetchImpl = (() => {
|
|
144
|
+
var _a2;
|
|
145
|
+
if ((_a2 = args.opts) == null ? void 0 : _a2.fetch) {
|
|
146
|
+
return args.opts.fetch;
|
|
147
|
+
}
|
|
148
|
+
if (typeof globalThis.fetch === "function") {
|
|
149
|
+
return globalThis.fetch.bind(globalThis);
|
|
150
|
+
}
|
|
151
|
+
throw new Error("No fetch implementation available");
|
|
152
|
+
})();
|
|
147
153
|
this.fetchFn = fetchImpl;
|
|
148
|
-
this.onUnauthorized = (
|
|
154
|
+
this.onUnauthorized = (_b = args.opts) == null ? void 0 : _b.onUnauthorized;
|
|
149
155
|
}
|
|
150
156
|
// Expose token management methods from the underlying AuthSession for convenience
|
|
151
157
|
setToken(token) {
|