@proconnect-gouv/proconnect.identite 10.4.0 → 10.5.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/connectors/index.d.ts +224 -8
  3. package/dist/connectors/index.d.ts.map +1 -1
  4. package/dist/connectors/index.js +6 -0
  5. package/dist/repositories/organization/find-users-by-organization.d.ts +28 -2
  6. package/dist/repositories/organization/find-users-by-organization.d.ts.map +1 -1
  7. package/dist/repositories/recovery-words/create.d.ts +6 -0
  8. package/dist/repositories/recovery-words/create.d.ts.map +1 -0
  9. package/dist/repositories/recovery-words/create.js +14 -0
  10. package/dist/repositories/recovery-words/delete-all-by-user-id.d.ts +3 -0
  11. package/dist/repositories/recovery-words/delete-all-by-user-id.d.ts.map +1 -0
  12. package/dist/repositories/recovery-words/delete-all-by-user-id.js +11 -0
  13. package/dist/repositories/recovery-words/find-by-user-id.d.ts +3 -0
  14. package/dist/repositories/recovery-words/find-by-user-id.d.ts.map +1 -0
  15. package/dist/repositories/recovery-words/find-by-user-id.js +12 -0
  16. package/dist/repositories/recovery-words/index.d.ts +4 -0
  17. package/dist/repositories/recovery-words/index.d.ts.map +1 -0
  18. package/dist/repositories/recovery-words/index.js +4 -0
  19. package/dist/repositories/user/create.d.ts +28 -2
  20. package/dist/repositories/user/create.d.ts.map +1 -1
  21. package/dist/repositories/user/find-by-email.d.ts +28 -2
  22. package/dist/repositories/user/find-by-email.d.ts.map +1 -1
  23. package/dist/repositories/user/find-by-id.d.ts +28 -2
  24. package/dist/repositories/user/find-by-id.d.ts.map +1 -1
  25. package/dist/repositories/user/find-by-magic-link-token.d.ts +28 -2
  26. package/dist/repositories/user/find-by-magic-link-token.d.ts.map +1 -1
  27. package/dist/repositories/user/find-by-reset-password-token.d.ts +28 -2
  28. package/dist/repositories/user/find-by-reset-password-token.d.ts.map +1 -1
  29. package/dist/repositories/user/get-by-id.d.ts +27 -1
  30. package/dist/repositories/user/get-by-id.d.ts.map +1 -1
  31. package/dist/repositories/user/update.d.ts +27 -1
  32. package/dist/repositories/user/update.d.ts.map +1 -1
  33. package/dist/types/index.d.ts +1 -0
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/types/index.js +1 -0
  36. package/dist/types/recovery-words.d.ts +9 -0
  37. package/dist/types/recovery-words.d.ts.map +1 -0
  38. package/dist/types/recovery-words.js +1 -0
  39. package/dist/types/user.d.ts +29 -27
  40. package/dist/types/user.d.ts.map +1 -1
  41. package/dist/types/user.js +29 -1
  42. package/package.json +3 -3
  43. package/src/connectors/index.ts +10 -0
  44. package/src/repositories/recovery-words/create.ts +28 -0
  45. package/src/repositories/recovery-words/delete-all-by-user-id.ts +20 -0
  46. package/src/repositories/recovery-words/find-by-user-id.ts +20 -0
  47. package/src/repositories/recovery-words/index.ts +5 -0
  48. package/src/types/index.ts +1 -0
  49. package/src/types/recovery-words.ts +9 -0
  50. package/src/types/user.ts +33 -27
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @proconnect-gouv/proconnect.identite
2
2
 
3
+ ## 10.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2242](https://github.com/proconnect-gouv/proconnect-identite/pull/2242) [`31652e6`](https://github.com/proconnect-gouv/proconnect-identite/commit/31652e608dd645911f7cd5710fc5395c81bb8a5f) Thanks [@douglasduteil](https://github.com/douglasduteil)! - ajout du schéma zod UserSchema, le type User en est dérivé
8
+
3
9
  ## 10.4.0
4
10
 
5
11
  ### Minor Changes
@@ -536,7 +536,33 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
536
536
  findPendingByUserId: (user_id: number) => Promise<(import("../types/organization.js").Organization & {
537
537
  moderation_id: number;
538
538
  })[]>;
539
- findUsers: (organization_id: number) => Promise<(import("../types/user.js").User & {
539
+ findUsers: (organization_id: number) => Promise<({
540
+ created_at: Date;
541
+ current_challenge: string | null;
542
+ email: string;
543
+ email_verified: boolean;
544
+ email_verified_at: Date | null;
545
+ encrypted_password: string | null;
546
+ encrypted_totp_key: string | null;
547
+ family_name: string | null;
548
+ force_2fa: boolean;
549
+ given_name: string | null;
550
+ id: number;
551
+ job: string | null;
552
+ last_sign_in_at: Date | null;
553
+ magic_link_sent_at: Date | null;
554
+ magic_link_token: string | null;
555
+ needs_inclusionconnect_onboarding_help: boolean;
556
+ needs_inclusionconnect_welcome_page: boolean;
557
+ phone_number: string | null;
558
+ reset_password_sent_at: Date | null;
559
+ reset_password_token: string | null;
560
+ sign_in_count: number;
561
+ totp_key_verified_at: Date | null;
562
+ updated_at: Date;
563
+ verify_email_sent_at: Date | null;
564
+ verify_email_token: string | null;
565
+ } & {
540
566
  is_external: boolean;
541
567
  verification_type: "domain" | "organization_dirigeant" | "code_sent_to_official_contact_email" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "ordre_professionnel_domain" | "proof_received" | "verified_by_coop_mediation_numerique" | "bypassed" | "domain_not_verified_yet" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "no_verification_means_for_small_organization";
542
568
  verified_at: Date | null;
@@ -548,6 +574,14 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
548
574
  organizationInfo: import("../types/organization-info.js").OrganizationInfo;
549
575
  }) => Promise<import("../types/organization.js").Organization>;
550
576
  };
577
+ recovery_words: {
578
+ create: ({ user_id, hashed_words, }: {
579
+ user_id: number;
580
+ hashed_words: string;
581
+ }) => Promise<import("../types/recovery-words.js").RecoveryWords>;
582
+ deleteByUserId: (user_id: number) => Promise<boolean>;
583
+ findByUserId: (user_id: number) => Promise<import("../types/recovery-words.js").RecoveryWords | undefined>;
584
+ };
551
585
  users_organizations: {
552
586
  create: ({ is_external, organization_id, user_id, verification_type, }: import("../types/user-organization-link.js").InsertUserOrganizationLink) => Promise<{
553
587
  is_external: boolean;
@@ -595,14 +629,196 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
595
629
  create: ({ email, encrypted_password, }: {
596
630
  email: string;
597
631
  encrypted_password?: string | null;
598
- }) => Promise<import("../types/user.js").User>;
632
+ }) => Promise<{
633
+ created_at: Date;
634
+ current_challenge: string | null;
635
+ email: string;
636
+ email_verified: boolean;
637
+ email_verified_at: Date | null;
638
+ encrypted_password: string | null;
639
+ encrypted_totp_key: string | null;
640
+ family_name: string | null;
641
+ force_2fa: boolean;
642
+ given_name: string | null;
643
+ id: number;
644
+ job: string | null;
645
+ last_sign_in_at: Date | null;
646
+ magic_link_sent_at: Date | null;
647
+ magic_link_token: string | null;
648
+ needs_inclusionconnect_onboarding_help: boolean;
649
+ needs_inclusionconnect_welcome_page: boolean;
650
+ phone_number: string | null;
651
+ reset_password_sent_at: Date | null;
652
+ reset_password_token: string | null;
653
+ sign_in_count: number;
654
+ totp_key_verified_at: Date | null;
655
+ updated_at: Date;
656
+ verify_email_sent_at: Date | null;
657
+ verify_email_token: string | null;
658
+ }>;
599
659
  delete: (id: number) => Promise<boolean>;
600
- findByEmail: (email: string) => Promise<import("../types/user.js").User | undefined>;
601
- findById: (id: number) => Promise<import("../types/user.js").User | undefined>;
602
- findByMagicLinkToken: (magic_link_token: string) => Promise<import("../types/user.js").User | undefined>;
603
- findByResetPasswordToken: (reset_password_token: string) => Promise<import("../types/user.js").User | undefined>;
604
- getById: (id: number) => Promise<import("../types/user.js").User>;
605
- update: (id: number, fieldsToUpdate: Partial<import("../types/user.js").User>) => Promise<import("../types/user.js").User>;
660
+ findByEmail: (email: string) => Promise<{
661
+ created_at: Date;
662
+ current_challenge: string | null;
663
+ email: string;
664
+ email_verified: boolean;
665
+ email_verified_at: Date | null;
666
+ encrypted_password: string | null;
667
+ encrypted_totp_key: string | null;
668
+ family_name: string | null;
669
+ force_2fa: boolean;
670
+ given_name: string | null;
671
+ id: number;
672
+ job: string | null;
673
+ last_sign_in_at: Date | null;
674
+ magic_link_sent_at: Date | null;
675
+ magic_link_token: string | null;
676
+ needs_inclusionconnect_onboarding_help: boolean;
677
+ needs_inclusionconnect_welcome_page: boolean;
678
+ phone_number: string | null;
679
+ reset_password_sent_at: Date | null;
680
+ reset_password_token: string | null;
681
+ sign_in_count: number;
682
+ totp_key_verified_at: Date | null;
683
+ updated_at: Date;
684
+ verify_email_sent_at: Date | null;
685
+ verify_email_token: string | null;
686
+ } | undefined>;
687
+ findById: (id: number) => Promise<{
688
+ created_at: Date;
689
+ current_challenge: string | null;
690
+ email: string;
691
+ email_verified: boolean;
692
+ email_verified_at: Date | null;
693
+ encrypted_password: string | null;
694
+ encrypted_totp_key: string | null;
695
+ family_name: string | null;
696
+ force_2fa: boolean;
697
+ given_name: string | null;
698
+ id: number;
699
+ job: string | null;
700
+ last_sign_in_at: Date | null;
701
+ magic_link_sent_at: Date | null;
702
+ magic_link_token: string | null;
703
+ needs_inclusionconnect_onboarding_help: boolean;
704
+ needs_inclusionconnect_welcome_page: boolean;
705
+ phone_number: string | null;
706
+ reset_password_sent_at: Date | null;
707
+ reset_password_token: string | null;
708
+ sign_in_count: number;
709
+ totp_key_verified_at: Date | null;
710
+ updated_at: Date;
711
+ verify_email_sent_at: Date | null;
712
+ verify_email_token: string | null;
713
+ } | undefined>;
714
+ findByMagicLinkToken: (magic_link_token: string) => Promise<{
715
+ created_at: Date;
716
+ current_challenge: string | null;
717
+ email: string;
718
+ email_verified: boolean;
719
+ email_verified_at: Date | null;
720
+ encrypted_password: string | null;
721
+ encrypted_totp_key: string | null;
722
+ family_name: string | null;
723
+ force_2fa: boolean;
724
+ given_name: string | null;
725
+ id: number;
726
+ job: string | null;
727
+ last_sign_in_at: Date | null;
728
+ magic_link_sent_at: Date | null;
729
+ magic_link_token: string | null;
730
+ needs_inclusionconnect_onboarding_help: boolean;
731
+ needs_inclusionconnect_welcome_page: boolean;
732
+ phone_number: string | null;
733
+ reset_password_sent_at: Date | null;
734
+ reset_password_token: string | null;
735
+ sign_in_count: number;
736
+ totp_key_verified_at: Date | null;
737
+ updated_at: Date;
738
+ verify_email_sent_at: Date | null;
739
+ verify_email_token: string | null;
740
+ } | undefined>;
741
+ findByResetPasswordToken: (reset_password_token: string) => Promise<{
742
+ created_at: Date;
743
+ current_challenge: string | null;
744
+ email: string;
745
+ email_verified: boolean;
746
+ email_verified_at: Date | null;
747
+ encrypted_password: string | null;
748
+ encrypted_totp_key: string | null;
749
+ family_name: string | null;
750
+ force_2fa: boolean;
751
+ given_name: string | null;
752
+ id: number;
753
+ job: string | null;
754
+ last_sign_in_at: Date | null;
755
+ magic_link_sent_at: Date | null;
756
+ magic_link_token: string | null;
757
+ needs_inclusionconnect_onboarding_help: boolean;
758
+ needs_inclusionconnect_welcome_page: boolean;
759
+ phone_number: string | null;
760
+ reset_password_sent_at: Date | null;
761
+ reset_password_token: string | null;
762
+ sign_in_count: number;
763
+ totp_key_verified_at: Date | null;
764
+ updated_at: Date;
765
+ verify_email_sent_at: Date | null;
766
+ verify_email_token: string | null;
767
+ } | undefined>;
768
+ getById: (id: number) => Promise<{
769
+ created_at: Date;
770
+ current_challenge: string | null;
771
+ email: string;
772
+ email_verified: boolean;
773
+ email_verified_at: Date | null;
774
+ encrypted_password: string | null;
775
+ encrypted_totp_key: string | null;
776
+ family_name: string | null;
777
+ force_2fa: boolean;
778
+ given_name: string | null;
779
+ id: number;
780
+ job: string | null;
781
+ last_sign_in_at: Date | null;
782
+ magic_link_sent_at: Date | null;
783
+ magic_link_token: string | null;
784
+ needs_inclusionconnect_onboarding_help: boolean;
785
+ needs_inclusionconnect_welcome_page: boolean;
786
+ phone_number: string | null;
787
+ reset_password_sent_at: Date | null;
788
+ reset_password_token: string | null;
789
+ sign_in_count: number;
790
+ totp_key_verified_at: Date | null;
791
+ updated_at: Date;
792
+ verify_email_sent_at: Date | null;
793
+ verify_email_token: string | null;
794
+ }>;
795
+ update: (id: number, fieldsToUpdate: Partial<import("../types/user.js").User>) => Promise<{
796
+ created_at: Date;
797
+ current_challenge: string | null;
798
+ email: string;
799
+ email_verified: boolean;
800
+ email_verified_at: Date | null;
801
+ encrypted_password: string | null;
802
+ encrypted_totp_key: string | null;
803
+ family_name: string | null;
804
+ force_2fa: boolean;
805
+ given_name: string | null;
806
+ id: number;
807
+ job: string | null;
808
+ last_sign_in_at: Date | null;
809
+ magic_link_sent_at: Date | null;
810
+ magic_link_token: string | null;
811
+ needs_inclusionconnect_onboarding_help: boolean;
812
+ needs_inclusionconnect_welcome_page: boolean;
813
+ phone_number: string | null;
814
+ reset_password_sent_at: Date | null;
815
+ reset_password_token: string | null;
816
+ sign_in_count: number;
817
+ totp_key_verified_at: Date | null;
818
+ updated_at: Date;
819
+ verify_email_sent_at: Date | null;
820
+ verify_email_token: string | null;
821
+ }>;
606
822
  };
607
823
  franceconnect_userinfo: {
608
824
  delete: (user_id: number) => Promise<import("pg").QueryResult<any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"AAiEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AAC1H,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,CAAC;AAI/B,wBAAgB,aAAa,CAAC,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,wCAAwC,EACxC,EAAE,GACH,EAAE;IACD,qBAAqB,EAAE,mBAAmB,CAAC;IAC3C,gBAAgB,EAAE,cAAc,CAAC;IACjC,wCAAwC,EAAE,oCAAoC,CAAC;IAC/E,EAAE,EAAE,IAAI,CAAC;CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC;yDAAuE,CAAC;iEACZ,CAAC;6DACF,CAAC;;;;;;wCAWzC,CAAC;kDACA,CAAC;wDACgB,CAAC;iDACrC,CAAC;;;;;kCAQE,CAAC;;qBAEgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAnFF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCADjB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8JP;AACD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -7,6 +7,7 @@ import { createModerationFactory, deleteModerationFactory, findModerationByIdFac
7
7
  import { deleteOfficialContactEmailVerificationFactory, findOfficialContactEmailVerificationFactory, upsertOfficialContactEmailVerificationFactory, } from "#src/repositories/official-contact-email-verification";
8
8
  import { addConnectionFactory, findByClientIdFactory, } from "#src/repositories/oidc-client";
9
9
  import { findBySiretFactory, findByUserIdFactory, findByVerifiedEmailDomainFactory, findOrganizationByIdFactory, findPendingByUserIdFactory, findUsersByOrganizationFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
10
+ import { createRecoveryWordsFactory, deleteRecoveryWordsByUserIdFactory, findRecoveryWordsByUserIdFactory, } from "#src/repositories/recovery-words";
10
11
  import { createUserFactory, deleteUserFactory, findByEmailFactory, findByMagicLinkTokenFactory, findByResetPasswordTokenFactory, findByIdFactory as findUserByIdFactory, getByIdFactory, updateUserFactory, } from "#src/repositories/user";
11
12
  import { createUserOrganizationFactory, deleteUserOrganizationFactory, findUserOrganizationFactory, getUserOrganizationFactory, updateUserOrganizationFactory, } from "#src/repositories/user_organisation";
12
13
  import {} from "pg";
@@ -62,6 +63,11 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
62
63
  getById: getOrganizationByIdFactory({ pg }),
63
64
  upsert: upsertFactory({ pg }),
64
65
  },
66
+ recovery_words: {
67
+ create: createRecoveryWordsFactory({ pg }),
68
+ deleteByUserId: deleteRecoveryWordsByUserIdFactory({ pg }),
69
+ findByUserId: findRecoveryWordsByUserIdFactory({ pg }),
70
+ },
65
71
  users_organizations: {
66
72
  create: createUserOrganizationFactory({ pg }),
67
73
  delete: deleteUserOrganizationFactory({ pg }),
@@ -1,5 +1,31 @@
1
- import type { DatabaseContext, User } from "#src/types";
2
- export declare function findUsersByOrganizationFactory({ pg }: DatabaseContext): (organization_id: number) => Promise<(User & {
1
+ import type { DatabaseContext } from "#src/types";
2
+ export declare function findUsersByOrganizationFactory({ pg }: DatabaseContext): (organization_id: number) => Promise<({
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ } & {
3
29
  is_external: boolean;
4
30
  verification_type: "domain" | "organization_dirigeant" | "code_sent_to_official_contact_email" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "ordre_professionnel_domain" | "proof_received" | "verified_by_coop_mediation_numerique" | "bypassed" | "domain_not_verified_yet" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "no_verification_means_for_small_organization";
5
31
  verified_at: Date | null;
@@ -1 +1 @@
1
- {"version":3,"file":"find-users-by-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-users-by-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,IAAI,EACL,MAAM,YAAY,CAAC;AAKpB,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,iBAAiB,MAAM;;;;;MAiBtE"}
1
+ {"version":3,"file":"find-users-by-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-users-by-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiBtE"}
@@ -0,0 +1,6 @@
1
+ import type { DatabaseContext, RecoveryWords } from "#src/types";
2
+ export declare function createRecoveryWordsFactory({ pg }: DatabaseContext): ({ user_id, hashed_words, }: {
3
+ user_id: number;
4
+ hashed_words: string;
5
+ }) => Promise<RecoveryWords>;
6
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/repositories/recovery-words/create.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKjE,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,4BAGvC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,4BAaF"}
@@ -0,0 +1,14 @@
1
+ //
2
+ import {} from "pg";
3
+ //
4
+ export function createRecoveryWordsFactory({ pg }) {
5
+ return async function createRecoveryWords({ user_id, hashed_words, }) {
6
+ const { rows } = await pg.query(`
7
+ INSERT INTO recovery_words
8
+ (user_id, hashed_words)
9
+ VALUES
10
+ ($1, $2)
11
+ RETURNING *;`, [user_id, hashed_words]);
12
+ return rows.shift();
13
+ };
14
+ }
@@ -0,0 +1,3 @@
1
+ import type { DatabaseContext } from "#src/types";
2
+ export declare function deleteRecoveryWordsByUserIdFactory({ pg }: DatabaseContext): (user_id: number) => Promise<boolean>;
3
+ //# sourceMappingURL=delete-all-by-user-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-all-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/recovery-words/delete-all-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,wBAAgB,kCAAkC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,SAAS,MAAM,sBAWlE"}
@@ -0,0 +1,11 @@
1
+ //
2
+ //
3
+ export function deleteRecoveryWordsByUserIdFactory({ pg }) {
4
+ return async function deleteRecoveryWordsByUserId(user_id) {
5
+ const { rowCount, affectedRows } = (await pg.query(`
6
+ DELETE FROM recovery_words
7
+ WHERE user_id = $1
8
+ RETURNING *`, [user_id]));
9
+ return (affectedRows ?? rowCount ?? 0) > 0;
10
+ };
11
+ }
@@ -0,0 +1,3 @@
1
+ import type { DatabaseContext, RecoveryWords } from "#src/types";
2
+ export declare function findRecoveryWordsByUserIdFactory({ pg }: DatabaseContext): (user_id: number) => Promise<RecoveryWords | undefined>;
3
+ //# sourceMappingURL=find-by-user-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/recovery-words/find-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKjE,wBAAgB,gCAAgC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,SAAS,MAAM,wCAWhE"}
@@ -0,0 +1,12 @@
1
+ //
2
+ import {} from "pg";
3
+ //
4
+ export function findRecoveryWordsByUserIdFactory({ pg }) {
5
+ return async function findRecoveryWordsByUserId(user_id) {
6
+ const { rows } = await pg.query(`
7
+ SELECT *
8
+ FROM recovery_words
9
+ WHERE user_id = $1;`, [user_id]);
10
+ return rows.shift();
11
+ };
12
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./create.js";
2
+ export * from "./delete-all-by-user-id.js";
3
+ export * from "./find-by-user-id.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/recovery-words/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ //
2
+ export * from "./create.js";
3
+ export * from "./delete-all-by-user-id.js";
4
+ export * from "./find-by-user-id.js";
@@ -1,7 +1,33 @@
1
- import type { DatabaseContext, User } from "#src/types";
1
+ import type { DatabaseContext } from "#src/types";
2
2
  export declare function createUserFactory({ pg }: DatabaseContext): ({ email, encrypted_password, }: {
3
3
  email: string;
4
4
  encrypted_password?: string | null;
5
- }) => Promise<User>;
5
+ }) => Promise<{
6
+ created_at: Date;
7
+ current_challenge: string | null;
8
+ email: string;
9
+ email_verified: boolean;
10
+ email_verified_at: Date | null;
11
+ encrypted_password: string | null;
12
+ encrypted_totp_key: string | null;
13
+ family_name: string | null;
14
+ force_2fa: boolean;
15
+ given_name: string | null;
16
+ id: number;
17
+ job: string | null;
18
+ last_sign_in_at: Date | null;
19
+ magic_link_sent_at: Date | null;
20
+ magic_link_token: string | null;
21
+ needs_inclusionconnect_onboarding_help: boolean;
22
+ needs_inclusionconnect_welcome_page: boolean;
23
+ phone_number: string | null;
24
+ reset_password_sent_at: Date | null;
25
+ reset_password_token: string | null;
26
+ sign_in_count: number;
27
+ totp_key_verified_at: Date | null;
28
+ updated_at: Date;
29
+ verify_email_sent_at: Date | null;
30
+ verify_email_token: string | null;
31
+ }>;
6
32
  export type CreateUserHandler = ReturnType<typeof createUserFactory>;
7
33
  //# sourceMappingURL=create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/create.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,gCAG9B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,mBA0BF;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/create.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,YAAY,CAAC;AAKxD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,gCAG9B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BF;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,4 +1,30 @@
1
- import type { DatabaseContext, User } from "#src/types";
2
- export declare function findByEmailFactory({ pg }: DatabaseContext): (email: string) => Promise<User | undefined>;
1
+ import type { DatabaseContext } from "#src/types";
2
+ export declare function findByEmailFactory({ pg }: DatabaseContext): (email: string) => Promise<{
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ } | undefined>;
3
29
  export type FindByEmailHandler = ReturnType<typeof findByEmailFactory>;
4
30
  //# sourceMappingURL=find-by-email.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-by-email.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-email.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,OAAO,MAAM,+BAWhD;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"find-by-email.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-email.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,YAAY,CAAC;AAKxD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;eAWhD;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1,4 +1,30 @@
1
- import type { DatabaseContext, User } from "#src/types";
2
- export declare function findByIdFactory({ pg }: DatabaseContext): (id: number) => Promise<User | undefined>;
1
+ import type { DatabaseContext } from "#src/types";
2
+ export declare function findByIdFactory({ pg }: DatabaseContext): (id: number) => Promise<{
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ } | undefined>;
3
29
  export type FindByIdHandler = ReturnType<typeof findByIdFactory>;
4
30
  //# sourceMappingURL=find-by-id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-by-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,IAAI,MAAM,+BAY1C;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"find-by-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,YAAY,CAAC;AAKxD,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,IAAI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;eAY1C;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,3 +1,29 @@
1
- import type { DatabaseContext, User } from "#src/types";
2
- export declare function findByMagicLinkTokenFactory({ pg }: DatabaseContext): (magic_link_token: string) => Promise<User | undefined>;
1
+ import type { DatabaseContext } from "#src/types";
2
+ export declare function findByMagicLinkTokenFactory({ pg }: DatabaseContext): (magic_link_token: string) => Promise<{
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ } | undefined>;
3
29
  //# sourceMappingURL=find-by-magic-link-token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-by-magic-link-token.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-magic-link-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,kBAAkB,MAAM,+BAWpE"}
1
+ {"version":3,"file":"find-by-magic-link-token.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-magic-link-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,YAAY,CAAC;AAKxD,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,kBAAkB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;eAWpE"}
@@ -1,3 +1,29 @@
1
- import type { DatabaseContext, User } from "#src/types";
2
- export declare function findByResetPasswordTokenFactory({ pg }: DatabaseContext): (reset_password_token: string) => Promise<User | undefined>;
1
+ import type { DatabaseContext } from "#src/types";
2
+ export declare function findByResetPasswordTokenFactory({ pg }: DatabaseContext): (reset_password_token: string) => Promise<{
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ } | undefined>;
3
29
  //# sourceMappingURL=find-by-reset-password-token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-by-reset-password-token.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-reset-password-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,+BAA+B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,sBAAsB,MAAM,+BAW5E"}
1
+ {"version":3,"file":"find-by-reset-password-token.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/find-by-reset-password-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,YAAY,CAAC;AAKxD,wBAAgB,+BAA+B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,sBAAsB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;eAW5E"}
@@ -1,4 +1,30 @@
1
1
  import type { DatabaseContext } from "#src/types";
2
- export declare function getByIdFactory({ pg }: DatabaseContext): (id: number) => Promise<import("#src/types").User>;
2
+ export declare function getByIdFactory({ pg }: DatabaseContext): (id: number) => Promise<{
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ }>;
3
29
  export type GetByIdHandler = ReturnType<typeof getByIdFactory>;
4
30
  //# sourceMappingURL=get-by-id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-by-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/get-by-id.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMlD,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtB,IAAI,MAAM,wCAOzC;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"get-by-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/get-by-id.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMlD,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtB,IAAI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;GAOzC;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -1,4 +1,30 @@
1
1
  import type { DatabaseContext, User } from "#src/types";
2
- export declare function updateUserFactory({ pg }: DatabaseContext): (id: number, fieldsToUpdate: Partial<User>) => Promise<User>;
2
+ export declare function updateUserFactory({ pg }: DatabaseContext): (id: number, fieldsToUpdate: Partial<User>) => Promise<{
3
+ created_at: Date;
4
+ current_challenge: string | null;
5
+ email: string;
6
+ email_verified: boolean;
7
+ email_verified_at: Date | null;
8
+ encrypted_password: string | null;
9
+ encrypted_totp_key: string | null;
10
+ family_name: string | null;
11
+ force_2fa: boolean;
12
+ given_name: string | null;
13
+ id: number;
14
+ job: string | null;
15
+ last_sign_in_at: Date | null;
16
+ magic_link_sent_at: Date | null;
17
+ magic_link_token: string | null;
18
+ needs_inclusionconnect_onboarding_help: boolean;
19
+ needs_inclusionconnect_welcome_page: boolean;
20
+ phone_number: string | null;
21
+ reset_password_sent_at: Date | null;
22
+ reset_password_token: string | null;
23
+ sign_in_count: number;
24
+ totp_key_verified_at: Date | null;
25
+ updated_at: Date;
26
+ verify_email_sent_at: Date | null;
27
+ verify_email_token: string | null;
28
+ }>;
3
29
  export type UpdateUserHandler = ReturnType<typeof updateUserFactory>;
4
30
  //# sourceMappingURL=update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/update.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,IAAI,MAAM,EAAE,gBAAgB,OAAO,CAAC,IAAI,CAAC,mBAsB3E;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/update.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKxD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,IAAI,MAAM,EAAE,gBAAgB,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;GAsB3E;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -10,6 +10,7 @@ export * from "./official-contact-email-verification.js";
10
10
  export * from "./oidc-client.js";
11
11
  export * from "./organization-info.js";
12
12
  export * from "./organization.js";
13
+ export * from "./recovery-words.js";
13
14
  export * from "./user-organization-link.js";
14
15
  export * from "./user.js";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0CAA0C,CAAC;AACzD,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0CAA0C,CAAC;AACzD,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC"}
@@ -11,5 +11,6 @@ export * from "./official-contact-email-verification.js";
11
11
  export * from "./oidc-client.js";
12
12
  export * from "./organization-info.js";
13
13
  export * from "./organization.js";
14
+ export * from "./recovery-words.js";
14
15
  export * from "./user-organization-link.js";
15
16
  export * from "./user.js";
@@ -0,0 +1,9 @@
1
+ export interface BaseRecoveryWords {
2
+ hashed_words: string;
3
+ }
4
+ export interface RecoveryWords extends BaseRecoveryWords {
5
+ id: number;
6
+ user_id: number;
7
+ created_at: Date;
8
+ }
9
+ //# sourceMappingURL=recovery-words.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-words.d.ts","sourceRoot":"","sources":["../../src/types/recovery-words.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,28 +1,30 @@
1
- export interface User {
2
- created_at: Date;
3
- current_challenge: string | null;
4
- email_verified_at: Date | null;
5
- email_verified: boolean;
6
- email: string;
7
- encrypted_password: string | null;
8
- encrypted_totp_key: string | null;
9
- family_name: string | null;
10
- force_2fa: boolean;
11
- given_name: string | null;
12
- id: number;
13
- job: string | null;
14
- last_sign_in_at: Date | null;
15
- magic_link_sent_at: Date | null;
16
- magic_link_token: string | null;
17
- needs_inclusionconnect_onboarding_help: boolean;
18
- needs_inclusionconnect_welcome_page: boolean;
19
- phone_number: string | null;
20
- reset_password_sent_at: Date | null;
21
- reset_password_token: string | null;
22
- sign_in_count: number;
23
- totp_key_verified_at: Date | null;
24
- updated_at: Date;
25
- verify_email_sent_at: Date | null;
26
- verify_email_token: string | null;
27
- }
1
+ import { z } from "zod";
2
+ export declare const UserSchema: z.ZodObject<{
3
+ created_at: z.ZodDate;
4
+ current_challenge: z.ZodNullable<z.ZodString>;
5
+ email: z.ZodString;
6
+ email_verified: z.ZodBoolean;
7
+ email_verified_at: z.ZodNullable<z.ZodDate>;
8
+ encrypted_password: z.ZodNullable<z.ZodString>;
9
+ encrypted_totp_key: z.ZodNullable<z.ZodString>;
10
+ family_name: z.ZodNullable<z.ZodString>;
11
+ force_2fa: z.ZodBoolean;
12
+ given_name: z.ZodNullable<z.ZodString>;
13
+ id: z.ZodNumber;
14
+ job: z.ZodNullable<z.ZodString>;
15
+ last_sign_in_at: z.ZodNullable<z.ZodDate>;
16
+ magic_link_sent_at: z.ZodNullable<z.ZodDate>;
17
+ magic_link_token: z.ZodNullable<z.ZodString>;
18
+ needs_inclusionconnect_onboarding_help: z.ZodBoolean;
19
+ needs_inclusionconnect_welcome_page: z.ZodBoolean;
20
+ phone_number: z.ZodNullable<z.ZodString>;
21
+ reset_password_sent_at: z.ZodNullable<z.ZodDate>;
22
+ reset_password_token: z.ZodNullable<z.ZodString>;
23
+ sign_in_count: z.ZodNumber;
24
+ totp_key_verified_at: z.ZodNullable<z.ZodDate>;
25
+ updated_at: z.ZodDate;
26
+ verify_email_sent_at: z.ZodNullable<z.ZodDate>;
27
+ verify_email_token: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export type User = z.output<typeof UserSchema>;
28
30
  //# sourceMappingURL=user.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,IAAI,CAAC;IACjB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,iBAAiB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,sCAAsC,EAAE,OAAO,CAAC;IAChD,mCAAmC,EAAE,OAAO,CAAC;IAC7C,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,sBAAsB,EAAE,IAAI,GAAG,IAAI,CAAC;IACpC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,IAAI,CAAC;IACjB,oBAAoB,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC"}
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -1,2 +1,30 @@
1
1
  //
2
- export {};
2
+ import { z } from "zod";
3
+ //
4
+ export const UserSchema = z.object({
5
+ created_at: z.date(),
6
+ current_challenge: z.string().nullable(),
7
+ email: z.string(),
8
+ email_verified: z.boolean(),
9
+ email_verified_at: z.date().nullable(),
10
+ encrypted_password: z.string().nullable(),
11
+ encrypted_totp_key: z.string().nullable(),
12
+ family_name: z.string().nullable(),
13
+ force_2fa: z.boolean(),
14
+ given_name: z.string().nullable(),
15
+ id: z.number(),
16
+ job: z.string().nullable(),
17
+ last_sign_in_at: z.date().nullable(),
18
+ magic_link_sent_at: z.date().nullable(),
19
+ magic_link_token: z.string().nullable(),
20
+ needs_inclusionconnect_onboarding_help: z.boolean(),
21
+ needs_inclusionconnect_welcome_page: z.boolean(),
22
+ phone_number: z.string().nullable(),
23
+ reset_password_sent_at: z.date().nullable(),
24
+ reset_password_token: z.string().nullable(),
25
+ sign_in_count: z.number(),
26
+ totp_key_verified_at: z.date().nullable(),
27
+ updated_at: z.date(),
28
+ verify_email_sent_at: z.date().nullable(),
29
+ verify_email_token: z.string().nullable(),
30
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proconnect-gouv/proconnect.identite",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "homepage": "https://github.com/proconnect-gouv/proconnect-identite/tree/main/packages/identite#readme",
5
5
  "bugs": "https://github.com/proconnect-gouv/proconnect-identite/issues",
6
6
  "repository": {
@@ -44,10 +44,10 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "leven": "^4.0.0",
47
- "openid-client": "^6.6.4",
47
+ "openid-client": "^6.8.8",
48
48
  "sql-template-tag": "^5.2.1",
49
49
  "ts-pattern": "^5.7.0",
50
- "zod": "^4.3.5"
50
+ "zod": "^4.6.7"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@electric-sql/pglite": "^0.3.12",
@@ -46,6 +46,11 @@ import {
46
46
  getOrganizationByIdFactory,
47
47
  upsertFactory,
48
48
  } from "#src/repositories/organization";
49
+ import {
50
+ createRecoveryWordsFactory,
51
+ deleteRecoveryWordsByUserIdFactory,
52
+ findRecoveryWordsByUserIdFactory,
53
+ } from "#src/repositories/recovery-words";
49
54
  import {
50
55
  createUserFactory,
51
56
  deleteUserFactory,
@@ -134,6 +139,11 @@ export function createContext({
134
139
  getById: getOrganizationByIdFactory({ pg }),
135
140
  upsert: upsertFactory({ pg }),
136
141
  },
142
+ recovery_words: {
143
+ create: createRecoveryWordsFactory({ pg }),
144
+ deleteByUserId: deleteRecoveryWordsByUserIdFactory({ pg }),
145
+ findByUserId: findRecoveryWordsByUserIdFactory({ pg }),
146
+ },
137
147
  users_organizations: {
138
148
  create: createUserOrganizationFactory({ pg }),
139
149
  delete: deleteUserOrganizationFactory({ pg }),
@@ -0,0 +1,28 @@
1
+ //
2
+
3
+ import type { DatabaseContext, RecoveryWords } from "#src/types";
4
+ import { type QueryResult } from "pg";
5
+
6
+ //
7
+
8
+ export function createRecoveryWordsFactory({ pg }: DatabaseContext) {
9
+ return async function createRecoveryWords({
10
+ user_id,
11
+ hashed_words,
12
+ }: {
13
+ user_id: number;
14
+ hashed_words: string;
15
+ }) {
16
+ const { rows }: QueryResult<RecoveryWords> = await pg.query(
17
+ `
18
+ INSERT INTO recovery_words
19
+ (user_id, hashed_words)
20
+ VALUES
21
+ ($1, $2)
22
+ RETURNING *;`,
23
+ [user_id, hashed_words],
24
+ );
25
+
26
+ return rows.shift()!;
27
+ };
28
+ }
@@ -0,0 +1,20 @@
1
+ //
2
+
3
+ import type { DatabaseContext } from "#src/types";
4
+ import type { QueryResult } from "pg";
5
+
6
+ //
7
+
8
+ export function deleteRecoveryWordsByUserIdFactory({ pg }: DatabaseContext) {
9
+ return async function deleteRecoveryWordsByUserId(user_id: number) {
10
+ const { rowCount, affectedRows } = (await pg.query(
11
+ `
12
+ DELETE FROM recovery_words
13
+ WHERE user_id = $1
14
+ RETURNING *`,
15
+
16
+ [user_id],
17
+ )) as QueryResult & { affectedRows?: number };
18
+ return (affectedRows ?? rowCount ?? 0) > 0;
19
+ };
20
+ }
@@ -0,0 +1,20 @@
1
+ //
2
+
3
+ import type { DatabaseContext, RecoveryWords } from "#src/types";
4
+ import { type QueryResult } from "pg";
5
+
6
+ //
7
+
8
+ export function findRecoveryWordsByUserIdFactory({ pg }: DatabaseContext) {
9
+ return async function findRecoveryWordsByUserId(user_id: number) {
10
+ const { rows }: QueryResult<RecoveryWords> = await pg.query(
11
+ `
12
+ SELECT *
13
+ FROM recovery_words
14
+ WHERE user_id = $1;`,
15
+ [user_id],
16
+ );
17
+
18
+ return rows.shift();
19
+ };
20
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+
3
+ export * from "./create.js";
4
+ export * from "./delete-all-by-user-id.js";
5
+ export * from "./find-by-user-id.js";
@@ -12,5 +12,6 @@ export * from "./official-contact-email-verification.js";
12
12
  export * from "./oidc-client.js";
13
13
  export * from "./organization-info.js";
14
14
  export * from "./organization.js";
15
+ export * from "./recovery-words.js";
15
16
  export * from "./user-organization-link.js";
16
17
  export * from "./user.js";
@@ -0,0 +1,9 @@
1
+ export interface BaseRecoveryWords {
2
+ hashed_words: string;
3
+ }
4
+
5
+ export interface RecoveryWords extends BaseRecoveryWords {
6
+ id: number;
7
+ user_id: number;
8
+ created_at: Date;
9
+ }
package/src/types/user.ts CHANGED
@@ -1,29 +1,35 @@
1
1
  //
2
2
 
3
- export interface User {
4
- created_at: Date;
5
- current_challenge: string | null;
6
- email_verified_at: Date | null;
7
- email_verified: boolean;
8
- email: string;
9
- encrypted_password: string | null;
10
- encrypted_totp_key: string | null;
11
- family_name: string | null;
12
- force_2fa: boolean;
13
- given_name: string | null;
14
- id: number;
15
- job: string | null;
16
- last_sign_in_at: Date | null;
17
- magic_link_sent_at: Date | null;
18
- magic_link_token: string | null;
19
- needs_inclusionconnect_onboarding_help: boolean;
20
- needs_inclusionconnect_welcome_page: boolean;
21
- phone_number: string | null;
22
- reset_password_sent_at: Date | null;
23
- reset_password_token: string | null;
24
- sign_in_count: number;
25
- totp_key_verified_at: Date | null;
26
- updated_at: Date;
27
- verify_email_sent_at: Date | null;
28
- verify_email_token: string | null;
29
- }
3
+ import { z } from "zod";
4
+
5
+ //
6
+
7
+ export const UserSchema = z.object({
8
+ created_at: z.date(),
9
+ current_challenge: z.string().nullable(),
10
+ email: z.string(),
11
+ email_verified: z.boolean(),
12
+ email_verified_at: z.date().nullable(),
13
+ encrypted_password: z.string().nullable(),
14
+ encrypted_totp_key: z.string().nullable(),
15
+ family_name: z.string().nullable(),
16
+ force_2fa: z.boolean(),
17
+ given_name: z.string().nullable(),
18
+ id: z.number(),
19
+ job: z.string().nullable(),
20
+ last_sign_in_at: z.date().nullable(),
21
+ magic_link_sent_at: z.date().nullable(),
22
+ magic_link_token: z.string().nullable(),
23
+ needs_inclusionconnect_onboarding_help: z.boolean(),
24
+ needs_inclusionconnect_welcome_page: z.boolean(),
25
+ phone_number: z.string().nullable(),
26
+ reset_password_sent_at: z.date().nullable(),
27
+ reset_password_token: z.string().nullable(),
28
+ sign_in_count: z.number(),
29
+ totp_key_verified_at: z.date().nullable(),
30
+ updated_at: z.date(),
31
+ verify_email_sent_at: z.date().nullable(),
32
+ verify_email_token: z.string().nullable(),
33
+ });
34
+
35
+ export type User = z.output<typeof UserSchema>;