@xhub-short/adapters 1.0.0-beta.24 → 1.0.0-beta.26

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.ts CHANGED
@@ -2109,6 +2109,10 @@ declare class HttpClient {
2109
2109
  * Get base URL (for sendBeacon which needs full URL)
2110
2110
  */
2111
2111
  getBaseUrl(): string;
2112
+ /**
2113
+ * Check if access token is available
2114
+ */
2115
+ hasAccessToken(): Promise<boolean>;
2112
2116
  private isRefreshing;
2113
2117
  private refreshPromise;
2114
2118
  constructor(config: HttpClientConfig);
package/dist/index.js CHANGED
@@ -2164,6 +2164,10 @@ var RESTAnalyticsAdapter = class {
2164
2164
  const events = [...this.queue];
2165
2165
  this.queue = [];
2166
2166
  try {
2167
+ const hasToken = await this.httpClient.hasAccessToken();
2168
+ if (!hasToken) {
2169
+ return;
2170
+ }
2167
2171
  const requestBody = await this.buildRequestBody(events);
2168
2172
  if (this.trySendBeacon(requestBody)) {
2169
2173
  return;
@@ -3351,6 +3355,17 @@ var HttpClient = class {
3351
3355
  getBaseUrl() {
3352
3356
  return this.config.baseUrl;
3353
3357
  }
3358
+ /**
3359
+ * Check if access token is available
3360
+ */
3361
+ async hasAccessToken() {
3362
+ try {
3363
+ const token = await this.config.auth.getAccessToken();
3364
+ return !!token;
3365
+ } catch {
3366
+ return false;
3367
+ }
3368
+ }
3354
3369
  /**
3355
3370
  * Make HTTP request with auth and retry
3356
3371
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xhub-short/adapters",
3
3
  "sideEffects": false,
4
- "version": "1.0.0-beta.24",
4
+ "version": "1.0.0-beta.26",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@xhub-short/contracts": "1.0.0-beta.24"
23
+ "@xhub-short/contracts": "1.0.0-beta.26"
24
24
  },
25
25
  "optionalDependencies": {
26
26
  "hls.js": "^1.5.0"
@@ -29,8 +29,8 @@
29
29
  "tsup": "^8.3.0",
30
30
  "typescript": "^5.7.0",
31
31
  "vitest": "^2.1.0",
32
- "@xhub-short/vitest-config": "0.1.0-beta.14",
33
- "@xhub-short/tsconfig": "0.1.0-beta.3"
32
+ "@xhub-short/tsconfig": "0.0.1-beta.2",
33
+ "@xhub-short/vitest-config": "0.1.0-beta.13"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup",