@spacelr/sdk 0.8.1 → 0.9.0

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.d.mts CHANGED
@@ -1722,6 +1722,14 @@ interface SpacelrClient {
1722
1722
  onAuthLost(listener: (reason: AuthLostReason) => void): () => void;
1723
1723
  /** Subscribe to successful token refreshes. */
1724
1724
  onTokenRefreshed(listener: (tokens: StoredTokens) => void): () => void;
1725
+ /**
1726
+ * Returns a currently-valid access token for making your own authenticated
1727
+ * requests. Blocks on a refresh only when the stored token is already
1728
+ * expired; within the refresh buffer it returns the current token and
1729
+ * refreshes in the background. Returns null when there is no refreshable
1730
+ * session.
1731
+ */
1732
+ getAccessToken(): Promise<string | null>;
1725
1733
  /**
1726
1734
  * Subscribe to realtime socket connection-state changes. Fires on every
1727
1735
  * transition (dedup: identical consecutive states are skipped). Returns
package/dist/index.d.ts CHANGED
@@ -1722,6 +1722,14 @@ interface SpacelrClient {
1722
1722
  onAuthLost(listener: (reason: AuthLostReason) => void): () => void;
1723
1723
  /** Subscribe to successful token refreshes. */
1724
1724
  onTokenRefreshed(listener: (tokens: StoredTokens) => void): () => void;
1725
+ /**
1726
+ * Returns a currently-valid access token for making your own authenticated
1727
+ * requests. Blocks on a refresh only when the stored token is already
1728
+ * expired; within the refresh buffer it returns the current token and
1729
+ * refreshes in the background. Returns null when there is no refreshable
1730
+ * session.
1731
+ */
1732
+ getAccessToken(): Promise<string | null>;
1725
1733
  /**
1726
1734
  * Subscribe to realtime socket connection-state changes. Fires on every
1727
1735
  * transition (dedup: identical consecutive states are skipped). Returns
package/dist/index.js CHANGED
@@ -3099,6 +3099,9 @@ function createClient(config) {
3099
3099
  onTokenRefreshed(listener) {
3100
3100
  return tokenManager.onTokenRefreshed(listener);
3101
3101
  },
3102
+ getAccessToken() {
3103
+ return tokenManager.getAccessToken();
3104
+ },
3102
3105
  onConnectionStateChanged(listener) {
3103
3106
  return realtime.onConnectionStateChanged(listener);
3104
3107
  },