@depup/base44__sdk 0.8.42-depup.0 → 0.8.43-depup.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/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/base44__sdk
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@base44/sdk](https://www.npmjs.com/package/@base44/sdk) @ 0.8.42 |
17
- | Processed | 2026-08-16 |
16
+ | Original | [@base44/sdk](https://www.npmjs.com/package/@base44/sdk) @ 0.8.43 |
17
+ | Processed | 2026-08-18 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 3 |
20
20
 
package/changes.json CHANGED
@@ -13,6 +13,6 @@
13
13
  "to": "^14.0.1"
14
14
  }
15
15
  },
16
- "timestamp": "2026-08-16T16:05:23.532Z",
16
+ "timestamp": "2026-08-18T08:10:22.589Z",
17
17
  "totalUpdated": 3
18
18
  }
package/dist/client.js CHANGED
@@ -113,6 +113,7 @@ export function createClient(config) {
113
113
  const userAuthModule = createAuthModule(axiosClient, functionsAxiosClient, appId, {
114
114
  appBaseUrl: normalizedAppBaseUrl,
115
115
  serverUrl,
116
+ token,
116
117
  });
117
118
  // Apply the access token before any module that may issue authenticated
118
119
  // requests during construction (notably analytics, which fires an init
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { TrackEventParams, AnalyticsModuleOptions } from "./analytics.types";
3
- import type { AuthModule } from "./auth.types";
3
+ import type { InternalAuthModule } from "./auth.types";
4
4
  export declare const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
5
5
  export declare const ANALYTICS_INITIALIZATION_EVENT_NAME = "__initialization_event__";
6
6
  export declare const ANALYTICS_SESSION_DURATION_EVENT_NAME = "__session_duration_event__";
@@ -10,7 +10,7 @@ export interface AnalyticsModuleArgs {
10
10
  axiosClient: AxiosInstance;
11
11
  serverUrl: string;
12
12
  appId: string;
13
- userAuthModule: AuthModule;
13
+ userAuthModule: InternalAuthModule;
14
14
  }
15
15
  export declare const createAnalyticsModule: ({ axiosClient, serverUrl, appId, userAuthModule, }: AnalyticsModuleArgs) => {
16
16
  track: (params: TrackEventParams) => void;
@@ -247,6 +247,13 @@ export function resetAnalyticsSessionContext() {
247
247
  }
248
248
  async function getSessionContext(userAuthModule) {
249
249
  if (!analyticsSharedState.sessionContext) {
250
+ // With no token there is no identity to resolve: `me()` can only answer 401,
251
+ // which the browser logs to the console before any handler here sees it. On
252
+ // a public page that request is the sole reason an error appears, so skip
253
+ // it. This is not memoized — a visitor who logs in later must still resolve.
254
+ if (!userAuthModule.hasToken()) {
255
+ return { user_id: null, session_id: getAnalyticsSessionId() };
256
+ }
250
257
  if (!sessionContextPromise) {
251
258
  const sessionId = getAnalyticsSessionId();
252
259
  sessionContextPromise = userAuthModule
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { AuthModule, AuthModuleOptions } from "./auth.types";
2
+ import { AuthModuleOptions, InternalAuthModule } from "./auth.types";
3
3
  /**
4
4
  * Creates the auth module for the Base44 SDK.
5
5
  *
@@ -10,4 +10,4 @@ import { AuthModule, AuthModuleOptions } from "./auth.types";
10
10
  * @returns Auth module with authentication and user management methods
11
11
  * @internal
12
12
  */
13
- export declare function createAuthModule(axios: AxiosInstance, functionsAxiosClient: AxiosInstance, appId: string, options: AuthModuleOptions): AuthModule;
13
+ export declare function createAuthModule(axios: AxiosInstance, functionsAxiosClient: AxiosInstance, appId: string, options: AuthModuleOptions): InternalAuthModule;
@@ -78,7 +78,14 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
78
78
  const clearPendingMe = () => {
79
79
  pendingMe = null;
80
80
  };
81
+ // Tracked here rather than read off `axios.defaults` so the answer stays tied
82
+ // to the identity transitions below (`setToken`, `logout`) instead of to the
83
+ // header a caller may have set on the instance directly.
84
+ let hasAccessToken = Boolean(options.token);
81
85
  return {
86
+ hasToken() {
87
+ return hasAccessToken;
88
+ },
82
89
  // Get current user information
83
90
  async me() {
84
91
  const request = pendingMe !== null && pendingMe !== void 0 ? pendingMe : axios.get(`/apps/${appId}/entities/User/me`).finally(() => {
@@ -144,6 +151,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
144
151
  // flight would otherwise resolve into callers that run after the logout.
145
152
  clearPendingMe();
146
153
  resetAnalyticsSessionContext();
154
+ hasAccessToken = false;
147
155
  // Only do the rest if in a browser environment
148
156
  if (typeof window !== "undefined") {
149
157
  // Remove token from localStorage
@@ -172,6 +180,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
172
180
  // resolved for the previous one must not be handed to later callers.
173
181
  clearPendingMe();
174
182
  resetAnalyticsSessionContext();
183
+ hasAccessToken = true;
175
184
  // handle token change for axios clients
176
185
  axios.defaults.headers.common["Authorization"] = `Bearer ${token}`;
177
186
  functionsAxiosClient.defaults.headers.common["Authorization"] = `Bearer ${token}`;
@@ -92,6 +92,12 @@ export interface AuthModuleOptions {
92
92
  serverUrl: string;
93
93
  /** Base URL for the app (used for login redirects). */
94
94
  appBaseUrl: string;
95
+ /**
96
+ * Access token the client was constructed with, if any. Seeds the module's
97
+ * view of whether a session exists before {@link AuthModule.setToken} runs,
98
+ * which is how the server-side SDK reports a token it never sets explicitly.
99
+ */
100
+ token?: string;
95
101
  }
96
102
  /**
97
103
  * Authentication module for managing user authentication and authorization. The module automatically stores tokens in local storage when available and manages authorization headers for API requests.
@@ -515,3 +521,20 @@ export interface AuthModule {
515
521
  */
516
522
  changePassword(params: ChangePasswordParams): Promise<any>;
517
523
  }
524
+ /**
525
+ * The auth module as constructed internally, before it is narrowed to
526
+ * {@link AuthModule} on the public client. Not exported from the package
527
+ * index — SDK consumers see only {@link AuthModule}.
528
+ *
529
+ * @internal
530
+ */
531
+ export interface InternalAuthModule extends AuthModule {
532
+ /**
533
+ * Whether an access token is currently set on the client.
534
+ *
535
+ * Reports only the presence of a token, never its validity — an expired or
536
+ * revoked token still reads as `true`. Callers use this to skip requests that
537
+ * could not succeed without a session, not to decide that one is valid.
538
+ */
539
+ hasToken(): boolean;
540
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/base44__sdk",
3
- "version": "0.8.42-depup.0",
3
+ "version": "0.8.43-depup.0",
4
4
  "description": "JavaScript SDK for Base44 API (with updated dependencies)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -88,8 +88,8 @@
88
88
  },
89
89
  "depsUpdated": 3,
90
90
  "originalPackage": "@base44/sdk",
91
- "originalVersion": "0.8.42",
92
- "processedAt": "2026-08-16T16:05:37.525Z",
91
+ "originalVersion": "0.8.43",
92
+ "processedAt": "2026-08-18T08:10:35.872Z",
93
93
  "smokeTest": "passed"
94
94
  }
95
95
  }