@echoxyz/sonar-core 0.1.3 → 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 +6 -0
- package/dist/index.cjs +12 -8
- package/dist/index.js +12 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -173,17 +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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
+
})();
|
|
185
189
|
this.fetchFn = fetchImpl;
|
|
186
|
-
this.onUnauthorized = (
|
|
190
|
+
this.onUnauthorized = (_b = args.opts) == null ? void 0 : _b.onUnauthorized;
|
|
187
191
|
}
|
|
188
192
|
// Expose token management methods from the underlying AuthSession for convenience
|
|
189
193
|
setToken(token) {
|
package/dist/index.js
CHANGED
|
@@ -137,17 +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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
+
})();
|
|
149
153
|
this.fetchFn = fetchImpl;
|
|
150
|
-
this.onUnauthorized = (
|
|
154
|
+
this.onUnauthorized = (_b = args.opts) == null ? void 0 : _b.onUnauthorized;
|
|
151
155
|
}
|
|
152
156
|
// Expose token management methods from the underlying AuthSession for convenience
|
|
153
157
|
setToken(token) {
|