@echoxyz/sonar-core 0.14.0 → 0.14.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @echoxyz/sonar-core
2
2
 
3
+ ## 0.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7101949: All onUnauthorized to be passed into createClient
8
+
3
9
  ## 0.14.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -448,9 +448,14 @@ function createClient(options) {
448
448
  if (onTokenChange) {
449
449
  authSession.onTokenChange(onTokenChange);
450
450
  }
451
+ const onUnauthorized = () => {
452
+ var _a;
453
+ authSession.clear();
454
+ (_a = options == null ? void 0 : options.onUnauthorized) == null ? void 0 : _a.call(options);
455
+ };
451
456
  return new SonarClient({
452
457
  apiURL,
453
- opts: { auth: authSession, fetch, onUnauthorized: () => authSession.clear() }
458
+ opts: { auth: authSession, fetch, onUnauthorized }
454
459
  });
455
460
  }
456
461
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -265,6 +265,7 @@ type CreateClientOptions = {
265
265
  tokenKey?: string;
266
266
  onExpire?: () => void;
267
267
  onTokenChange?: (token?: string) => void;
268
+ onUnauthorized?: () => void;
268
269
  };
269
270
  declare function createClient(options?: CreateClientOptions): SonarClient;
270
271
 
package/dist/index.d.ts CHANGED
@@ -265,6 +265,7 @@ type CreateClientOptions = {
265
265
  tokenKey?: string;
266
266
  onExpire?: () => void;
267
267
  onTokenChange?: (token?: string) => void;
268
+ onUnauthorized?: () => void;
268
269
  };
269
270
  declare function createClient(options?: CreateClientOptions): SonarClient;
270
271
 
package/dist/index.js CHANGED
@@ -411,9 +411,14 @@ function createClient(options) {
411
411
  if (onTokenChange) {
412
412
  authSession.onTokenChange(onTokenChange);
413
413
  }
414
+ const onUnauthorized = () => {
415
+ var _a;
416
+ authSession.clear();
417
+ (_a = options == null ? void 0 : options.onUnauthorized) == null ? void 0 : _a.call(options);
418
+ };
414
419
  return new SonarClient({
415
420
  apiURL,
416
- opts: { auth: authSession, fetch, onUnauthorized: () => authSession.clear() }
421
+ opts: { auth: authSession, fetch, onUnauthorized }
417
422
  });
418
423
  }
419
424
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@echoxyz/sonar-core",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",