@insforge/sdk 1.0.8 → 1.1.0-dev.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/dist/index.d.mts +13 -12
- package/dist/index.d.ts +13 -12
- package/dist/index.js +13 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -43
- 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
|
|
@@ -265,12 +255,23 @@ declare class Auth {
|
|
|
265
255
|
error: InsForgeError | null;
|
|
266
256
|
}>;
|
|
267
257
|
/**
|
|
268
|
-
*
|
|
258
|
+
* Resend email verification (code or link based on config)
|
|
269
259
|
*
|
|
270
|
-
*
|
|
260
|
+
* Resend email verification when the previous OTP has expired or was not received.
|
|
261
|
+
* Uses the method configured in auth settings (verifyEmailMethod).
|
|
271
262
|
* When method is 'code', sends a 6-digit numeric code. When method is 'link', sends a magic link.
|
|
272
263
|
* Prevents user enumeration by returning success even if email doesn't exist.
|
|
273
264
|
*/
|
|
265
|
+
resendVerificationEmail(request: SendVerificationEmailRequest): Promise<{
|
|
266
|
+
data: {
|
|
267
|
+
success: boolean;
|
|
268
|
+
message: string;
|
|
269
|
+
} | null;
|
|
270
|
+
error: InsForgeError | null;
|
|
271
|
+
}>;
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated Use `resendVerificationEmail` instead. This method will be removed in a future version.
|
|
274
|
+
*/
|
|
274
275
|
sendVerificationEmail(request: SendVerificationEmailRequest): Promise<{
|
|
275
276
|
data: {
|
|
276
277
|
success: boolean;
|
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
|
|
@@ -265,12 +255,23 @@ declare class Auth {
|
|
|
265
255
|
error: InsForgeError | null;
|
|
266
256
|
}>;
|
|
267
257
|
/**
|
|
268
|
-
*
|
|
258
|
+
* Resend email verification (code or link based on config)
|
|
269
259
|
*
|
|
270
|
-
*
|
|
260
|
+
* Resend email verification when the previous OTP has expired or was not received.
|
|
261
|
+
* Uses the method configured in auth settings (verifyEmailMethod).
|
|
271
262
|
* When method is 'code', sends a 6-digit numeric code. When method is 'link', sends a magic link.
|
|
272
263
|
* Prevents user enumeration by returning success even if email doesn't exist.
|
|
273
264
|
*/
|
|
265
|
+
resendVerificationEmail(request: SendVerificationEmailRequest): Promise<{
|
|
266
|
+
data: {
|
|
267
|
+
success: boolean;
|
|
268
|
+
message: string;
|
|
269
|
+
} | null;
|
|
270
|
+
error: InsForgeError | null;
|
|
271
|
+
}>;
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated Use `resendVerificationEmail` instead. This method will be removed in a future version.
|
|
274
|
+
*/
|
|
274
275
|
sendVerificationEmail(request: SendVerificationEmailRequest): Promise<{
|
|
275
276
|
data: {
|
|
276
277
|
success: boolean;
|
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) {
|
|
@@ -747,13 +710,14 @@ var Auth = class {
|
|
|
747
710
|
}
|
|
748
711
|
}
|
|
749
712
|
/**
|
|
750
|
-
*
|
|
713
|
+
* Resend email verification (code or link based on config)
|
|
751
714
|
*
|
|
752
|
-
*
|
|
715
|
+
* Resend email verification when the previous OTP has expired or was not received.
|
|
716
|
+
* Uses the method configured in auth settings (verifyEmailMethod).
|
|
753
717
|
* When method is 'code', sends a 6-digit numeric code. When method is 'link', sends a magic link.
|
|
754
718
|
* Prevents user enumeration by returning success even if email doesn't exist.
|
|
755
719
|
*/
|
|
756
|
-
async
|
|
720
|
+
async resendVerificationEmail(request) {
|
|
757
721
|
try {
|
|
758
722
|
const response = await this.http.post(
|
|
759
723
|
"/api/auth/email/send-verification",
|
|
@@ -777,6 +741,12 @@ var Auth = class {
|
|
|
777
741
|
};
|
|
778
742
|
}
|
|
779
743
|
}
|
|
744
|
+
/**
|
|
745
|
+
* @deprecated Use `resendVerificationEmail` instead. This method will be removed in a future version.
|
|
746
|
+
*/
|
|
747
|
+
async sendVerificationEmail(request) {
|
|
748
|
+
return this.resendVerificationEmail(request);
|
|
749
|
+
}
|
|
780
750
|
/**
|
|
781
751
|
* Send password reset (code or link based on config)
|
|
782
752
|
*
|