@insforge/sdk 1.0.8 → 1.1.0-dev.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 +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +3 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -227,16 +227,6 @@ declare class Auth {
|
|
|
227
227
|
data: GetPublicAuthConfigResponse | null;
|
|
228
228
|
error: InsForgeError | null;
|
|
229
229
|
}>;
|
|
230
|
-
/**
|
|
231
|
-
* Get the current user with full profile information
|
|
232
|
-
* Returns both auth info (id, email, role) and profile data (dynamic fields from users table)
|
|
233
|
-
*/
|
|
234
|
-
getCurrentUser(): Promise<{
|
|
235
|
-
data: {
|
|
236
|
-
user: UserSchema;
|
|
237
|
-
} | null;
|
|
238
|
-
error: any | null;
|
|
239
|
-
}>;
|
|
240
230
|
/**
|
|
241
231
|
* Get any user's profile by ID
|
|
242
232
|
* Returns profile information from the users table
|
package/dist/index.d.ts
CHANGED
|
@@ -227,16 +227,6 @@ declare class Auth {
|
|
|
227
227
|
data: GetPublicAuthConfigResponse | null;
|
|
228
228
|
error: InsForgeError | null;
|
|
229
229
|
}>;
|
|
230
|
-
/**
|
|
231
|
-
* Get the current user with full profile information
|
|
232
|
-
* Returns both auth info (id, email, role) and profile data (dynamic fields from users table)
|
|
233
|
-
*/
|
|
234
|
-
getCurrentUser(): Promise<{
|
|
235
|
-
data: {
|
|
236
|
-
user: UserSchema;
|
|
237
|
-
} | null;
|
|
238
|
-
error: any | null;
|
|
239
|
-
}>;
|
|
240
230
|
/**
|
|
241
231
|
* Get any user's profile by ID
|
|
242
232
|
* Returns profile information from the users table
|
package/dist/index.js
CHANGED
|
@@ -579,46 +579,6 @@ var Auth = class {
|
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
/**
|
|
583
|
-
* Get the current user with full profile information
|
|
584
|
-
* Returns both auth info (id, email, role) and profile data (dynamic fields from users table)
|
|
585
|
-
*/
|
|
586
|
-
async getCurrentUser() {
|
|
587
|
-
try {
|
|
588
|
-
const user = this.tokenManager.getUser();
|
|
589
|
-
if (user) {
|
|
590
|
-
return { data: { user }, error: null };
|
|
591
|
-
}
|
|
592
|
-
const accessToken = this.tokenManager.getAccessToken();
|
|
593
|
-
if (!accessToken) {
|
|
594
|
-
return { data: null, error: null };
|
|
595
|
-
}
|
|
596
|
-
this.http.setAuthToken(accessToken);
|
|
597
|
-
const authResponse = await this.http.get("/api/auth/sessions/current");
|
|
598
|
-
return {
|
|
599
|
-
data: {
|
|
600
|
-
user: authResponse.user
|
|
601
|
-
},
|
|
602
|
-
error: null
|
|
603
|
-
};
|
|
604
|
-
} catch (error) {
|
|
605
|
-
if (error instanceof InsForgeError && error.statusCode === 401) {
|
|
606
|
-
await this.signOut();
|
|
607
|
-
return { data: null, error: null };
|
|
608
|
-
}
|
|
609
|
-
if (error instanceof InsForgeError) {
|
|
610
|
-
return { data: null, error };
|
|
611
|
-
}
|
|
612
|
-
return {
|
|
613
|
-
data: null,
|
|
614
|
-
error: new InsForgeError(
|
|
615
|
-
"An unexpected error occurred while fetching user",
|
|
616
|
-
500,
|
|
617
|
-
"UNEXPECTED_ERROR"
|
|
618
|
-
)
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
582
|
/**
|
|
623
583
|
* Get any user's profile by ID
|
|
624
584
|
* Returns profile information from the users table
|
|
@@ -649,6 +609,9 @@ var Auth = class {
|
|
|
649
609
|
* Returns the stored JWT token and basic user info from local storage
|
|
650
610
|
*/
|
|
651
611
|
async getCurrentSession() {
|
|
612
|
+
if (isHostedAuthEnvironment()) {
|
|
613
|
+
return { data: { session: null }, error: null };
|
|
614
|
+
}
|
|
652
615
|
try {
|
|
653
616
|
const session = this.tokenManager.getSession();
|
|
654
617
|
if (session) {
|