@proconnect-gouv/proconnect.identite 10.3.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.
- package/CHANGELOG.md +17 -0
- package/dist/connectors/index.d.ts +224 -8
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +6 -0
- package/dist/managers/certification/match-identity-to-dirigeant.d.ts +44 -0
- package/dist/managers/certification/match-identity-to-dirigeant.d.ts.map +1 -0
- package/dist/managers/certification/match-identity-to-dirigeant.js +32 -0
- package/dist/managers/certification/process-certification-dirigeant.d.ts.map +1 -1
- package/dist/managers/certification/process-certification-dirigeant.js +1 -29
- package/dist/managers/organization/mark-domain-as-verified.d.ts.map +1 -1
- package/dist/managers/organization/mark-domain-as-verified.js +2 -0
- package/dist/repositories/moderation/get-moderation-by-id.d.ts.map +1 -1
- package/dist/repositories/moderation/get-moderation-by-id.js +1 -1
- package/dist/repositories/organization/find-users-by-organization.d.ts +28 -2
- package/dist/repositories/organization/find-users-by-organization.d.ts.map +1 -1
- package/dist/repositories/organization/find-users-by-organization.js +3 -6
- package/dist/repositories/recovery-words/create.d.ts +6 -0
- package/dist/repositories/recovery-words/create.d.ts.map +1 -0
- package/dist/repositories/recovery-words/create.js +14 -0
- package/dist/repositories/recovery-words/delete-all-by-user-id.d.ts +3 -0
- package/dist/repositories/recovery-words/delete-all-by-user-id.d.ts.map +1 -0
- package/dist/repositories/recovery-words/delete-all-by-user-id.js +11 -0
- package/dist/repositories/recovery-words/find-by-user-id.d.ts +3 -0
- package/dist/repositories/recovery-words/find-by-user-id.d.ts.map +1 -0
- package/dist/repositories/recovery-words/find-by-user-id.js +12 -0
- package/dist/repositories/recovery-words/index.d.ts +4 -0
- package/dist/repositories/recovery-words/index.d.ts.map +1 -0
- package/dist/repositories/recovery-words/index.js +4 -0
- package/dist/repositories/user/create.d.ts +28 -2
- package/dist/repositories/user/create.d.ts.map +1 -1
- package/dist/repositories/user/find-by-email.d.ts +28 -2
- package/dist/repositories/user/find-by-email.d.ts.map +1 -1
- package/dist/repositories/user/find-by-id.d.ts +28 -2
- package/dist/repositories/user/find-by-id.d.ts.map +1 -1
- package/dist/repositories/user/find-by-magic-link-token.d.ts +28 -2
- package/dist/repositories/user/find-by-magic-link-token.d.ts.map +1 -1
- package/dist/repositories/user/find-by-reset-password-token.d.ts +28 -2
- package/dist/repositories/user/find-by-reset-password-token.d.ts.map +1 -1
- package/dist/repositories/user/get-by-id.d.ts +27 -1
- package/dist/repositories/user/get-by-id.d.ts.map +1 -1
- package/dist/repositories/user/update.d.ts +27 -1
- package/dist/repositories/user/update.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/recovery-words.d.ts +9 -0
- package/dist/types/recovery-words.d.ts.map +1 -0
- package/dist/types/recovery-words.js +1 -0
- package/dist/types/user.d.ts +29 -27
- package/dist/types/user.d.ts.map +1 -1
- package/dist/types/user.js +29 -1
- package/package.json +5 -5
- package/src/connectors/index.ts +10 -0
- package/src/managers/certification/match-identity-to-dirigeant.test.ts +62 -0
- package/src/managers/certification/match-identity-to-dirigeant.ts +40 -0
- package/src/managers/certification/process-certification-dirigeant.ts +1 -35
- package/src/managers/organization/mark-domain-as-verified.test.ts +174 -0
- package/src/managers/organization/mark-domain-as-verified.ts +2 -0
- package/src/repositories/moderation/get-moderation-by-id.test.ts +1 -1
- package/src/repositories/moderation/get-moderation-by-id.ts +1 -1
- package/src/repositories/organization/find-users-by-organization.ts +4 -12
- package/src/repositories/recovery-words/create.ts +28 -0
- package/src/repositories/recovery-words/delete-all-by-user-id.ts +20 -0
- package/src/repositories/recovery-words/find-by-user-id.ts +20 -0
- package/src/repositories/recovery-words/index.ts +5 -0
- package/src/types/index.ts +1 -0
- package/src/types/recovery-words.ts +9 -0
- package/src/types/user.ts +33 -27
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
import type { DatabaseContext
|
|
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<
|
|
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,
|
|
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
|
|
2
|
-
export declare function findByEmailFactory({ pg }: DatabaseContext): (email: string) => Promise<
|
|
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,
|
|
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
|
|
2
|
-
export declare function findByIdFactory({ pg }: DatabaseContext): (id: number) => Promise<
|
|
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,
|
|
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
|
|
2
|
-
export declare function findByMagicLinkTokenFactory({ pg }: DatabaseContext): (magic_link_token: string) => Promise<
|
|
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,
|
|
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
|
|
2
|
-
export declare function findByResetPasswordTokenFactory({ pg }: DatabaseContext): (reset_password_token: string) => Promise<
|
|
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,
|
|
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<
|
|
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
|
|
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<
|
|
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
|
|
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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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"}
|
package/dist/types/index.js
CHANGED
|
@@ -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 @@
|
|
|
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 {};
|
package/dist/types/user.d.ts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
package/dist/types/user.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAEA,
|
|
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"}
|
package/dist/types/user.js
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
1
|
//
|
|
2
|
-
|
|
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.
|
|
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,16 +44,16 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"leven": "^4.0.0",
|
|
47
|
-
"openid-client": "^6.
|
|
47
|
+
"openid-client": "^6.8.8",
|
|
48
48
|
"sql-template-tag": "^5.2.1",
|
|
49
49
|
"ts-pattern": "^5.7.0",
|
|
50
|
-
"zod": "^4.
|
|
50
|
+
"zod": "^4.6.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@electric-sql/pglite": "^0.3.12",
|
|
54
54
|
"@proconnect-gouv/proconnect.annuaire_entreprises": "^3.0.5",
|
|
55
55
|
"@proconnect-gouv/proconnect.api_entreprise": "^2.3.0",
|
|
56
|
-
"@proconnect-gouv/proconnect.core": "^1.
|
|
56
|
+
"@proconnect-gouv/proconnect.core": "^1.1.0",
|
|
57
57
|
"@proconnect-gouv/proconnect.devtools.typescript": "1.0.0",
|
|
58
58
|
"@proconnect-gouv/proconnect.insee": "^2.0.0",
|
|
59
59
|
"@proconnect-gouv/proconnect.registre_national_entreprises": "^4.1.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@proconnect-gouv/proconnect.annuaire_entreprises": "^3.0.5",
|
|
69
69
|
"@proconnect-gouv/proconnect.api_entreprise": "^2.3.0",
|
|
70
|
-
"@proconnect-gouv/proconnect.core": "^1.
|
|
70
|
+
"@proconnect-gouv/proconnect.core": "^1.1.0",
|
|
71
71
|
"@proconnect-gouv/proconnect.insee": "^2.0.0",
|
|
72
72
|
"@proconnect-gouv/proconnect.registre_national_entreprises": "^4.1.0"
|
|
73
73
|
},
|
package/src/connectors/index.ts
CHANGED
|
@@ -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,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import assert from "node:assert/strict";
|
|
4
|
+
import { describe, it } from "node:test";
|
|
5
|
+
import { match_identity_to_dirigeant } from "./match-identity-to-dirigeant.js";
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
const identity = {
|
|
10
|
+
birthcountry: null,
|
|
11
|
+
birthdate: new Date("1946-08-17"),
|
|
12
|
+
birthplace: "75001",
|
|
13
|
+
family_name: "Bernard",
|
|
14
|
+
gender: "male" as const,
|
|
15
|
+
given_name: "Stéphane",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe("match_identity_to_dirigeant", () => {
|
|
19
|
+
it("returns no_candidates for an empty dirigeants list", () => {
|
|
20
|
+
assert.deepEqual(match_identity_to_dirigeant(identity, []), {
|
|
21
|
+
kind: "no_candidates",
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("returns exact_match for a score of 5", () => {
|
|
26
|
+
const result = match_identity_to_dirigeant(identity, [identity]);
|
|
27
|
+
assert.equal(result.kind, "exact_match");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("returns close_match for a score of 4", () => {
|
|
31
|
+
const dirigeant = { ...identity, family_name: "DuMoulin" };
|
|
32
|
+
const result = match_identity_to_dirigeant(identity, [dirigeant]);
|
|
33
|
+
assert.equal(result.kind, "close_match");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("returns close_match for a score of 3", () => {
|
|
37
|
+
const dirigeant = {
|
|
38
|
+
...identity,
|
|
39
|
+
family_name: "DuMoulin",
|
|
40
|
+
given_name: "Robert",
|
|
41
|
+
};
|
|
42
|
+
const result = match_identity_to_dirigeant(identity, [dirigeant]);
|
|
43
|
+
assert.equal(result.kind, "close_match");
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("returns below_threshold for a score under 3", () => {
|
|
47
|
+
const dirigeant = {
|
|
48
|
+
...identity,
|
|
49
|
+
family_name: "DuMoulin",
|
|
50
|
+
given_name: "Robert",
|
|
51
|
+
gender: "female" as const,
|
|
52
|
+
};
|
|
53
|
+
const result = match_identity_to_dirigeant(identity, [dirigeant]);
|
|
54
|
+
assert.equal(result.kind, "below_threshold");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("picks the highest-scoring candidate among several", () => {
|
|
58
|
+
const weak = { ...identity, family_name: "DuMoulin", given_name: "Robert" };
|
|
59
|
+
const result = match_identity_to_dirigeant(identity, [weak, identity]);
|
|
60
|
+
assert.equal(result.kind, "exact_match");
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import type { IdentityVector } from "#src/types";
|
|
4
|
+
import { match } from "ts-pattern";
|
|
5
|
+
import { certificationScore } from "./certification-score.js";
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
export function match_identity_to_dirigeant(
|
|
10
|
+
identity: IdentityVector,
|
|
11
|
+
dirigeants: IdentityVector[],
|
|
12
|
+
) {
|
|
13
|
+
if (dirigeants.length === 0) return { kind: "no_candidates" as const };
|
|
14
|
+
|
|
15
|
+
const [closest] = dirigeants
|
|
16
|
+
.map((dirigeant) => ({
|
|
17
|
+
dirigeant,
|
|
18
|
+
matches: certificationScore(identity, dirigeant),
|
|
19
|
+
}))
|
|
20
|
+
.toSorted((a, b) => b.matches.size - a.matches.size); // Sort by score descending (higher is better)
|
|
21
|
+
|
|
22
|
+
// According to the specification, only score of 5 (perfect match) is certified
|
|
23
|
+
return match(closest.matches.size)
|
|
24
|
+
.with(5, () => ({
|
|
25
|
+
kind: "exact_match" as const,
|
|
26
|
+
closest,
|
|
27
|
+
}))
|
|
28
|
+
.with(4, () => ({
|
|
29
|
+
kind: "close_match" as const,
|
|
30
|
+
closest,
|
|
31
|
+
}))
|
|
32
|
+
.with(3, () => ({
|
|
33
|
+
kind: "close_match" as const,
|
|
34
|
+
closest,
|
|
35
|
+
}))
|
|
36
|
+
.otherwise(() => ({
|
|
37
|
+
kind: "below_threshold" as const,
|
|
38
|
+
closest,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
@@ -5,7 +5,6 @@ import { isOrganizationCoveredByCertificationDirigeant } from "#src/services/org
|
|
|
5
5
|
import {
|
|
6
6
|
NullIdentityVector,
|
|
7
7
|
type FranceConnectUserInfo,
|
|
8
|
-
type IdentityVector,
|
|
9
8
|
type Organization,
|
|
10
9
|
} from "#src/types";
|
|
11
10
|
import { match } from "ts-pattern";
|
|
@@ -14,7 +13,7 @@ import * as ApiEntreprise from "./adapters/api_entreprise.js";
|
|
|
14
13
|
import * as FranceConnect from "./adapters/franceconnect.js";
|
|
15
14
|
import * as INSEE from "./adapters/insee.js";
|
|
16
15
|
import * as RNE from "./adapters/rne.js";
|
|
17
|
-
import {
|
|
16
|
+
import { match_identity_to_dirigeant } from "./match-identity-to-dirigeant.js";
|
|
18
17
|
|
|
19
18
|
//
|
|
20
19
|
|
|
@@ -76,39 +75,6 @@ async function getMandatairesSociaux(
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
function match_identity_to_dirigeant(
|
|
80
|
-
identity: IdentityVector,
|
|
81
|
-
dirigeants: IdentityVector[],
|
|
82
|
-
) {
|
|
83
|
-
if (dirigeants.length === 0) return { kind: "no_candidates" as const };
|
|
84
|
-
|
|
85
|
-
const [closest] = dirigeants
|
|
86
|
-
.map((dirigeant) => ({
|
|
87
|
-
dirigeant,
|
|
88
|
-
matches: certificationScore(identity, dirigeant),
|
|
89
|
-
}))
|
|
90
|
-
.toSorted((a, b) => b.matches.size - a.matches.size); // Sort by score descending (higher is better)
|
|
91
|
-
|
|
92
|
-
// According to the specification, only score of 5 (perfect match) is certified
|
|
93
|
-
return match(closest.matches.size)
|
|
94
|
-
.with(5, () => ({
|
|
95
|
-
kind: "exact_match" as const,
|
|
96
|
-
closest,
|
|
97
|
-
}))
|
|
98
|
-
.with(4, () => ({
|
|
99
|
-
kind: "close_match" as const,
|
|
100
|
-
closest,
|
|
101
|
-
}))
|
|
102
|
-
.with(3, () => ({
|
|
103
|
-
kind: "close_match" as const,
|
|
104
|
-
closest,
|
|
105
|
-
}))
|
|
106
|
-
.otherwise(() => ({
|
|
107
|
-
kind: "below_threshold" as const,
|
|
108
|
-
closest,
|
|
109
|
-
}));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
78
|
export function processCertificationDirigeantFactory(context: Context) {
|
|
113
79
|
const {
|
|
114
80
|
client: { insee },
|