squarecommonblhelper 11.3.0 → 11.4.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.
@@ -98,7 +98,7 @@ declare class AuthenticationCommonBL {
98
98
  };
99
99
  log?: any;
100
100
  }>;
101
- sendResetPasswordEmailV0(username: string, logErrors?: boolean): Promise<{
101
+ sendResetPasswordEmailV0(username: string, redirectUrl?: string, logErrors?: boolean): Promise<{
102
102
  message: string | null;
103
103
  data: {
104
104
  expires_at: string;
@@ -113,7 +113,7 @@ declare class AuthenticationCommonBL {
113
113
  };
114
114
  log?: any;
115
115
  }>;
116
- sendVerificationEmailV0(accessToken: string, logErrors?: boolean): Promise<{
116
+ sendVerificationEmailV0(accessToken: string, redirectUrl?: string, logErrors?: boolean): Promise<{
117
117
  message: string | null;
118
118
  data: {
119
119
  expires_at: string;
@@ -144,5 +144,26 @@ declare class AuthenticationCommonBL {
144
144
  };
145
145
  log?: any;
146
146
  }>;
147
+ addSelfAuthProviderV0(accessToken: string, password: string, logErrors?: boolean): Promise<{
148
+ message: string | null;
149
+ data: {
150
+ main: string[];
151
+ };
152
+ log?: any;
153
+ }>;
154
+ addGoogleAuthProviderV0(accessToken: string, googleIdToken: string, logErrors?: boolean): Promise<{
155
+ message: string | null;
156
+ data: {
157
+ main: string[];
158
+ };
159
+ log?: any;
160
+ }>;
161
+ unlinkAuthProviderV0(accessToken: string, authProvider: string, logErrors?: boolean): Promise<{
162
+ message: string | null;
163
+ data: {
164
+ main: string[];
165
+ };
166
+ log?: any;
167
+ }>;
147
168
  }
148
169
  export { AuthenticationCommonBL };
@@ -1,5 +1,5 @@
1
1
  import { fetchFileData, fetchJSONData } from "squarecommons";
2
- import { DeleteUserV0ResponseZ, GenerateAccountBackupCodeV0ResponseZ, GetUserDetailsV0ResponseZ, GetUserRecoveryMethodsV0ResponseZ, LogoutAllV0ResponseZ, LogoutAppsV0ResponseZ, SendResetPasswordEmailV0ResponseZ, SendVerificationEmailV0ResponseZ, UpdateProfileDetailsV0ResponseZ, UpdateUsernameV0ResponseZ, UpdateUserProfilePhotoV0ResponseZ, UpdateUserRecoveryMethodsV0ResponseZ, ValidateEmailVerificationCodeV0ResponseZ, } from "./types/AuthenticationResponses.js";
2
+ import { DeleteUserV0ResponseZ, GenerateAccountBackupCodeV0ResponseZ, GetUserDetailsV0ResponseZ, GetUserRecoveryMethodsV0ResponseZ, LogoutAllV0ResponseZ, LogoutAppsV0ResponseZ, SendResetPasswordEmailV0ResponseZ, SendVerificationEmailV0ResponseZ, UpdateProfileDetailsV0ResponseZ, UpdateUsernameV0ResponseZ, UpdateUserProfilePhotoV0ResponseZ, UpdateUserRecoveryMethodsV0ResponseZ, ValidateEmailVerificationCodeV0ResponseZ, AddSelfAuthProviderV0ResponseZ, AddGoogleAuthProviderV0ResponseZ, UnlinkAuthProviderV0ResponseZ, } from "./types/AuthenticationResponses.js";
3
3
  class AuthenticationCommonBL {
4
4
  commonBLBaseURL;
5
5
  constructor(commonBLBaseURL = "http://localhost:10110") {
@@ -256,7 +256,7 @@ class AuthenticationCommonBL {
256
256
  throw error;
257
257
  }
258
258
  }
259
- async sendResetPasswordEmailV0(username, logErrors = true) {
259
+ async sendResetPasswordEmailV0(username, redirectUrl, logErrors = true) {
260
260
  try {
261
261
  const data = await fetchJSONData(
262
262
  // base url
@@ -268,7 +268,7 @@ class AuthenticationCommonBL {
268
268
  // headers
269
269
  undefined,
270
270
  // body
271
- { username: username },
271
+ { username: username, redirect_url: redirectUrl },
272
272
  // query params
273
273
  undefined,
274
274
  // credentials
@@ -315,7 +315,7 @@ class AuthenticationCommonBL {
315
315
  throw error;
316
316
  }
317
317
  }
318
- async sendVerificationEmailV0(accessToken, logErrors = true) {
318
+ async sendVerificationEmailV0(accessToken, redirectUrl, logErrors = true) {
319
319
  try {
320
320
  const data = await fetchJSONData(
321
321
  // base url
@@ -327,7 +327,7 @@ class AuthenticationCommonBL {
327
327
  // headers
328
328
  { access_token: accessToken },
329
329
  // body
330
- undefined,
330
+ { redirect_url: redirectUrl },
331
331
  // query params
332
332
  undefined,
333
333
  // credentials
@@ -390,5 +390,80 @@ class AuthenticationCommonBL {
390
390
  throw error;
391
391
  }
392
392
  }
393
+ async addSelfAuthProviderV0(accessToken, password, logErrors = true) {
394
+ try {
395
+ const data = await fetchJSONData(
396
+ // base url
397
+ this.commonBLBaseURL,
398
+ // endpoint
399
+ "add_self_auth_provider/v0",
400
+ // method
401
+ "POST",
402
+ // headers
403
+ { access_token: accessToken },
404
+ // body
405
+ { password: password },
406
+ // query params
407
+ undefined,
408
+ // credentials
409
+ undefined,
410
+ // logErrors
411
+ logErrors);
412
+ return AddSelfAuthProviderV0ResponseZ.parse(data);
413
+ }
414
+ catch (error) {
415
+ throw error;
416
+ }
417
+ }
418
+ async addGoogleAuthProviderV0(accessToken, googleIdToken, logErrors = true) {
419
+ try {
420
+ const data = await fetchJSONData(
421
+ // base url
422
+ this.commonBLBaseURL,
423
+ // endpoint
424
+ "add_google_auth_provider/v0",
425
+ // method
426
+ "POST",
427
+ // headers
428
+ { access_token: accessToken },
429
+ // body
430
+ { google_id_token: googleIdToken },
431
+ // query params
432
+ undefined,
433
+ // credentials
434
+ undefined,
435
+ // logErrors
436
+ logErrors);
437
+ return AddGoogleAuthProviderV0ResponseZ.parse(data);
438
+ }
439
+ catch (error) {
440
+ throw error;
441
+ }
442
+ }
443
+ async unlinkAuthProviderV0(accessToken, authProvider, logErrors = true) {
444
+ try {
445
+ const data = await fetchJSONData(
446
+ // base url
447
+ this.commonBLBaseURL,
448
+ // endpoint
449
+ "unlink_auth_provider/v0",
450
+ // method
451
+ "POST",
452
+ // headers
453
+ { access_token: accessToken },
454
+ // body
455
+ { auth_provider: authProvider },
456
+ // query params
457
+ undefined,
458
+ // credentials
459
+ undefined,
460
+ // logErrors
461
+ logErrors);
462
+ return UnlinkAuthProviderV0ResponseZ.parse(data);
463
+ }
464
+ catch (error) {
465
+ throw error;
466
+ }
467
+ }
393
468
  }
394
469
  export { AuthenticationCommonBL };
@@ -731,4 +731,82 @@ declare const UpdateUserProfilePhotoV0ResponseZ: z.ZodObject<z.objectUtil.extend
731
731
  log?: any;
732
732
  }>;
733
733
  type UpdateUserProfilePhotoV0Response = z.infer<typeof UpdateUserProfilePhotoV0ResponseZ>;
734
- export { UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, DeleteUserV0Response, DeleteUserV0ResponseZ, LogoutAllV0Response, LogoutAllV0ResponseZ, LogoutAppsV0Response, LogoutAppsV0ResponseZ, GenerateAccountBackupCodeV0Response, GenerateAccountBackupCodeV0ResponseZ, UpdateProfileDetailsV0ResponseZ, UpdateProfileDetailsV0Response, SendResetPasswordEmailV0ResponseZ, SendResetPasswordEmailV0Response, RecoveryMethodEnumZ, RecoveryMethodEnum, UpdateUserRecoveryMethodsV0ResponseZ, UpdateUserRecoveryMethodsV0Response, SendVerificationEmailV0ResponseZ, SendVerificationEmailV0Response, ValidateEmailVerificationCodeV0ResponseZ, ValidateEmailVerificationCodeV0Response, GetUserRecoveryMethodsV0ResponseZ, GetUserRecoveryMethodsV0Response, UpdateUserProfilePhotoV0ResponseZ, UpdateUserProfilePhotoV0Response, };
734
+ declare const AddSelfAuthProviderV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
735
+ data: z.ZodAny;
736
+ message: z.ZodNullable<z.ZodString>;
737
+ log: z.ZodAny;
738
+ }, {
739
+ data: z.ZodObject<{
740
+ main: z.ZodArray<z.ZodString, "many">;
741
+ }, "strict", z.ZodTypeAny, {
742
+ main: string[];
743
+ }, {
744
+ main: string[];
745
+ }>;
746
+ }>, "strict", z.ZodTypeAny, {
747
+ message: string | null;
748
+ data: {
749
+ main: string[];
750
+ };
751
+ log?: any;
752
+ }, {
753
+ message: string | null;
754
+ data: {
755
+ main: string[];
756
+ };
757
+ log?: any;
758
+ }>;
759
+ type AddSelfAuthProviderV0Response = z.infer<typeof AddSelfAuthProviderV0ResponseZ>;
760
+ declare const AddGoogleAuthProviderV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
761
+ data: z.ZodAny;
762
+ message: z.ZodNullable<z.ZodString>;
763
+ log: z.ZodAny;
764
+ }, {
765
+ data: z.ZodObject<{
766
+ main: z.ZodArray<z.ZodString, "many">;
767
+ }, "strict", z.ZodTypeAny, {
768
+ main: string[];
769
+ }, {
770
+ main: string[];
771
+ }>;
772
+ }>, "strict", z.ZodTypeAny, {
773
+ message: string | null;
774
+ data: {
775
+ main: string[];
776
+ };
777
+ log?: any;
778
+ }, {
779
+ message: string | null;
780
+ data: {
781
+ main: string[];
782
+ };
783
+ log?: any;
784
+ }>;
785
+ type AddGoogleAuthProviderV0Response = z.infer<typeof AddGoogleAuthProviderV0ResponseZ>;
786
+ declare const UnlinkAuthProviderV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
787
+ data: z.ZodAny;
788
+ message: z.ZodNullable<z.ZodString>;
789
+ log: z.ZodAny;
790
+ }, {
791
+ data: z.ZodObject<{
792
+ main: z.ZodArray<z.ZodString, "many">;
793
+ }, "strict", z.ZodTypeAny, {
794
+ main: string[];
795
+ }, {
796
+ main: string[];
797
+ }>;
798
+ }>, "strict", z.ZodTypeAny, {
799
+ message: string | null;
800
+ data: {
801
+ main: string[];
802
+ };
803
+ log?: any;
804
+ }, {
805
+ message: string | null;
806
+ data: {
807
+ main: string[];
808
+ };
809
+ log?: any;
810
+ }>;
811
+ type UnlinkAuthProviderV0Response = z.infer<typeof UnlinkAuthProviderV0ResponseZ>;
812
+ export { UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, DeleteUserV0Response, DeleteUserV0ResponseZ, LogoutAllV0Response, LogoutAllV0ResponseZ, LogoutAppsV0Response, LogoutAppsV0ResponseZ, GenerateAccountBackupCodeV0Response, GenerateAccountBackupCodeV0ResponseZ, UpdateProfileDetailsV0ResponseZ, UpdateProfileDetailsV0Response, SendResetPasswordEmailV0ResponseZ, SendResetPasswordEmailV0Response, RecoveryMethodEnumZ, RecoveryMethodEnum, UpdateUserRecoveryMethodsV0ResponseZ, UpdateUserRecoveryMethodsV0Response, SendVerificationEmailV0ResponseZ, SendVerificationEmailV0Response, ValidateEmailVerificationCodeV0ResponseZ, ValidateEmailVerificationCodeV0Response, GetUserRecoveryMethodsV0ResponseZ, GetUserRecoveryMethodsV0Response, UpdateUserProfilePhotoV0ResponseZ, UpdateUserProfilePhotoV0Response, AddSelfAuthProviderV0ResponseZ, AddSelfAuthProviderV0Response, AddGoogleAuthProviderV0ResponseZ, AddGoogleAuthProviderV0Response, UnlinkAuthProviderV0ResponseZ, UnlinkAuthProviderV0Response, };
@@ -121,4 +121,19 @@ const UpdateUserProfilePhotoV0ResponseZ = APIOutputZ.extend({
121
121
  main: z.string().nullable(),
122
122
  }),
123
123
  });
124
- export { UpdateUsernameV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0ResponseZ, LogoutAllV0ResponseZ, LogoutAppsV0ResponseZ, GenerateAccountBackupCodeV0ResponseZ, UpdateProfileDetailsV0ResponseZ, SendResetPasswordEmailV0ResponseZ, RecoveryMethodEnumZ, UpdateUserRecoveryMethodsV0ResponseZ, SendVerificationEmailV0ResponseZ, ValidateEmailVerificationCodeV0ResponseZ, GetUserRecoveryMethodsV0ResponseZ, UpdateUserProfilePhotoV0ResponseZ, };
124
+ const AddSelfAuthProviderV0ResponseZ = APIOutputZ.extend({
125
+ data: z.strictObject({
126
+ main: z.array(z.string()),
127
+ }),
128
+ });
129
+ const AddGoogleAuthProviderV0ResponseZ = APIOutputZ.extend({
130
+ data: z.strictObject({
131
+ main: z.array(z.string()),
132
+ }),
133
+ });
134
+ const UnlinkAuthProviderV0ResponseZ = APIOutputZ.extend({
135
+ data: z.strictObject({
136
+ main: z.array(z.string()),
137
+ }),
138
+ });
139
+ export { UpdateUsernameV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0ResponseZ, LogoutAllV0ResponseZ, LogoutAppsV0ResponseZ, GenerateAccountBackupCodeV0ResponseZ, UpdateProfileDetailsV0ResponseZ, SendResetPasswordEmailV0ResponseZ, RecoveryMethodEnumZ, UpdateUserRecoveryMethodsV0ResponseZ, SendVerificationEmailV0ResponseZ, ValidateEmailVerificationCodeV0ResponseZ, GetUserRecoveryMethodsV0ResponseZ, UpdateUserProfilePhotoV0ResponseZ, AddSelfAuthProviderV0ResponseZ, AddGoogleAuthProviderV0ResponseZ, UnlinkAuthProviderV0ResponseZ, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarecommonblhelper",
3
- "version": "11.3.0",
3
+ "version": "11.4.0",
4
4
  "description": "helper for common bl for my projects.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",