@proconnect-gouv/proconnect.identite 1.2.0 → 1.3.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 +8 -0
- package/README.md +0 -2
- package/dist/data/certification/categories-juridiques-sources.d.ts +8 -0
- package/dist/data/certification/categories-juridiques-sources.d.ts.map +1 -0
- package/dist/data/certification/categories-juridiques-sources.js +743 -0
- package/dist/data/certification/index.d.ts +1 -0
- package/dist/data/certification/index.d.ts.map +1 -1
- package/dist/data/certification/index.js +1 -0
- package/dist/errors/index.d.ts +0 -9
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +0 -18
- package/dist/managers/certification/certification-score.d.ts +11 -1
- package/dist/managers/certification/certification-score.d.ts.map +1 -1
- package/dist/managers/certification/certification-score.js +17 -8
- package/dist/managers/certification/index.d.ts +1 -1
- package/dist/managers/certification/index.d.ts.map +1 -1
- package/dist/managers/certification/index.js +1 -1
- package/dist/managers/certification/process-certification-dirigeant.d.ts +80 -0
- package/dist/managers/certification/process-certification-dirigeant.d.ts.map +1 -0
- package/dist/managers/certification/process-certification-dirigeant.js +121 -0
- package/dist/managers/organization/adapters/api_entreprise.d.ts +2 -1
- package/dist/managers/organization/adapters/api_entreprise.d.ts.map +1 -1
- package/dist/managers/organization/adapters/api_entreprise.js +3 -1
- package/dist/managers/organization/force-join-organization.d.ts +1 -1
- package/dist/managers/organization/force-join-organization.d.ts.map +1 -1
- package/dist/managers/organization/force-join-organization.js +3 -4
- package/dist/managers/user/assign-user-verification-type-to-domain.d.ts.map +1 -1
- package/dist/managers/user/assign-user-verification-type-to-domain.js +6 -6
- package/dist/repositories/organization/find-by-user-id.d.ts +1 -1
- package/dist/repositories/organization/get-users-by-organization.d.ts +1 -1
- package/dist/repositories/organization/link-user-to-organization.d.ts +1 -1
- package/dist/repositories/organization/upsert.d.ts.map +1 -1
- package/dist/repositories/organization/upsert.js +8 -3
- package/dist/repositories/user/update-user-organization-link.d.ts +1 -1
- package/dist/services/organization/index.d.ts +1 -0
- package/dist/services/organization/index.d.ts.map +1 -1
- package/dist/services/organization/index.js +1 -0
- package/dist/services/organization/is-entreprise-unipersonnelle.d.ts +3 -3
- package/dist/services/organization/is-entreprise-unipersonnelle.d.ts.map +1 -1
- package/dist/services/organization/is-entreprise-unipersonnelle.js +4 -4
- package/dist/services/organization/is-organization-covered-by-certification-dirigeant.d.ts +3 -0
- package/dist/services/organization/is-organization-covered-by-certification-dirigeant.d.ts.map +1 -0
- package/dist/services/organization/is-organization-covered-by-certification-dirigeant.js +2 -0
- package/dist/services/organization/is-public-service.d.ts.map +1 -1
- package/dist/services/organization/is-public-service.js +16 -6
- package/dist/services/organization/is-syndicat-communal.d.ts.map +1 -1
- package/dist/services/organization/is-syndicat-communal.js +1 -0
- package/dist/types/franceconnect.d.ts.map +1 -1
- package/dist/types/franceconnect.js +2 -2
- package/dist/types/{dirigeant.d.ts → identity-vector.d.ts} +2 -1
- package/dist/types/identity-vector.d.ts.map +1 -0
- package/dist/types/{dirigeant.js → identity-vector.js} +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/organization-info.d.ts +2 -1
- package/dist/types/organization-info.d.ts.map +1 -1
- package/dist/types/organization-info.js +1 -0
- package/dist/types/organization.d.ts +1 -0
- package/dist/types/organization.d.ts.map +1 -1
- package/dist/types/user-organization-link.d.ts +31 -24
- package/dist/types/user-organization-link.d.ts.map +1 -1
- package/dist/types/user-organization-link.js +15 -8
- package/package.json +2 -2
- package/src/data/certification/categories-juridiques-sources.ts +811 -0
- package/src/data/certification/index.ts +1 -0
- package/src/errors/index.ts +0 -21
- package/src/managers/certification/certification-score.test.ts +69 -33
- package/src/managers/certification/certification-score.ts +20 -9
- package/src/managers/certification/index.ts +1 -1
- package/src/managers/certification/{is-organization-dirigeant.test.ts → process-certification-dirigeant.test.ts} +62 -64
- package/src/managers/certification/{is-organization-dirigeant.ts → process-certification-dirigeant.ts} +115 -74
- package/src/managers/organization/adapters/api_entreprise.test.ts.snapshot +4 -0
- package/src/managers/organization/adapters/api_entreprise.ts +3 -0
- package/src/managers/organization/force-join-organization.ts +3 -6
- package/src/managers/organization/get-organization-info.test.ts.snapshot +3 -0
- package/src/managers/organization/mark-domain-as-verified.test.ts +1 -1
- package/src/managers/user/assign-user-verification-type-to-domain.ts +6 -6
- package/src/repositories/organization/find-by-id.test.ts +1 -0
- package/src/repositories/organization/find-by-user-id.test.ts.snapshot +3 -0
- package/src/repositories/organization/get-by-id.test.ts +1 -0
- package/src/repositories/organization/link-user-to-organization.test.ts +3 -2
- package/src/repositories/organization/link-user-to-organization.test.ts.snapshot +2 -2
- package/src/repositories/organization/upsert.ts +8 -1
- package/src/repositories/organization/upset.test.ts +2 -0
- package/src/services/organization/index.ts +1 -0
- package/src/services/organization/is-entreprise-unipersonnelle.ts +5 -5
- package/src/services/organization/is-organization-covered-by-certification-dirigeant.test.ts +43 -0
- package/src/services/organization/is-organization-covered-by-certification-dirigeant.ts +9 -0
- package/src/services/organization/is-public-service.test.ts +1 -1
- package/src/services/organization/is-public-service.ts +20 -7
- package/src/services/organization/is-syndicat-communal.ts +1 -0
- package/src/types/franceconnect.ts +6 -7
- package/src/types/{dirigeant.ts → identity-vector.ts} +9 -0
- package/src/types/index.ts +1 -1
- package/src/types/organization-info.ts +1 -0
- package/src/types/organization.ts +1 -0
- package/src/types/user-organization-link.ts +17 -11
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/managers/certification/is-organization-dirigeant.d.ts +0 -45
- package/dist/managers/certification/is-organization-dirigeant.d.ts.map +0 -1
- package/dist/managers/certification/is-organization-dirigeant.js +0 -97
- package/dist/types/dirigeant.d.ts.map +0 -1
|
@@ -81,7 +81,7 @@ describe("isPublicService", () => {
|
|
|
81
81
|
|
|
82
82
|
it("should return true for whitelisted SIREN even with non-public nature juridique", () => {
|
|
83
83
|
const whitelisted_siren_org = {
|
|
84
|
-
siret: "
|
|
84
|
+
siret: "33465403500123",
|
|
85
85
|
cached_categorie_juridique: "5599", // Non-public nature juridique
|
|
86
86
|
cached_etat_administratif: "A",
|
|
87
87
|
} as Organization;
|
|
@@ -7,12 +7,17 @@ import {
|
|
|
7
7
|
} from "@proconnect-gouv/proconnect.annuaire_entreprises";
|
|
8
8
|
import type { Organization } from "@proconnect-gouv/proconnect.identite/types";
|
|
9
9
|
|
|
10
|
-
// inspired from https://github.com/annuaire-entreprises-data-gouv-fr/search-infra/blob/
|
|
10
|
+
// inspired from https://github.com/annuaire-entreprises-data-gouv-fr/search-infra/blob/4ec29b1ef3370e0f840bd55dd6d38a4811faf18d/workflows/data_pipelines/elasticsearch/data_enrichment.py#L169-L209
|
|
11
11
|
export const isPublicService = ({
|
|
12
12
|
cached_categorie_juridique,
|
|
13
13
|
cached_etat_administratif,
|
|
14
14
|
siret,
|
|
15
15
|
}: Organization): boolean => {
|
|
16
|
+
// Check if nature juridique is undefined/null
|
|
17
|
+
if (!cached_categorie_juridique) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
const siren = (siret || "").substring(0, 9);
|
|
17
22
|
|
|
18
23
|
// Entities in the blacklist are never considered public services
|
|
@@ -25,11 +30,19 @@ export const isPublicService = ({
|
|
|
25
30
|
return false;
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
// Check if entity is in whitelist
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
// Check if entity is in whitelist (takes priority)
|
|
34
|
+
if (SERVICE_PUBLIC_WHITELIST.includes(siren)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Legal nature codes starting with 4 or 7 are public services
|
|
39
|
+
if (
|
|
40
|
+
cached_categorie_juridique.startsWith("4") ||
|
|
41
|
+
cached_categorie_juridique.startsWith("7")
|
|
42
|
+
) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
// Check if entity has a specific public service legal nature code
|
|
47
|
+
return NATURE_JURIDIQUE_SERVICE_PUBLIC.includes(cached_categorie_juridique);
|
|
35
48
|
};
|
|
@@ -3,6 +3,7 @@ import type { Organization } from "#src/types";
|
|
|
3
3
|
const cat_jur = [
|
|
4
4
|
"Centre communal d'action sociale",
|
|
5
5
|
"Établissement public local social et médico-social",
|
|
6
|
+
"Groupement de coopération sanitaire à gestion publique",
|
|
6
7
|
"Syndicat intercommunal à vocation multiple (SIVOM)",
|
|
7
8
|
"Syndicat intercommunal à vocation unique (SIVU)",
|
|
8
9
|
"Syndicat mixte fermé",
|
|
@@ -26,13 +26,12 @@ export type FranceConnectUserInfoResponse = z.output<
|
|
|
26
26
|
//
|
|
27
27
|
|
|
28
28
|
export const FranceConnectUserInfoSchema =
|
|
29
|
-
FranceConnectUserInfoResponseSchema.
|
|
30
|
-
z.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
29
|
+
FranceConnectUserInfoResponseSchema.extend({
|
|
30
|
+
created_at: z.coerce.date(),
|
|
31
|
+
updated_at: z.coerce.date(),
|
|
32
|
+
user_id: z.number(),
|
|
33
|
+
});
|
|
34
|
+
|
|
36
35
|
export type FranceConnectUserInfo = z.output<
|
|
37
36
|
typeof FranceConnectUserInfoSchema
|
|
38
37
|
>;
|
|
@@ -14,3 +14,12 @@ export const IdentityVectorSchema = z.object({
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
export type IdentityVector = z.output<typeof IdentityVectorSchema>;
|
|
17
|
+
|
|
18
|
+
export const NullIdentityVector: IdentityVector = IdentityVectorSchema.parse({
|
|
19
|
+
birthcountry: null,
|
|
20
|
+
birthdate: null,
|
|
21
|
+
birthplace: null,
|
|
22
|
+
family_name: null,
|
|
23
|
+
gender: null,
|
|
24
|
+
given_name: null,
|
|
25
|
+
});
|
package/src/types/index.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
export * from "./claims.js";
|
|
4
4
|
export * from "./contexts.js";
|
|
5
|
-
export * from "./dirigeant.js";
|
|
6
5
|
export * from "./email-domain.js";
|
|
7
6
|
export * from "./franceconnect.js";
|
|
7
|
+
export * from "./identity-vector.js";
|
|
8
8
|
export * from "./organization-info.js";
|
|
9
9
|
export * from "./organization.js";
|
|
10
10
|
export * from "./user-organization-link.js";
|
|
@@ -26,5 +26,6 @@ export interface Organization {
|
|
|
26
26
|
cached_libelle_activite_principale: string | null;
|
|
27
27
|
cached_categorie_juridique: string | null;
|
|
28
28
|
cached_libelle_categorie_juridique: string | null;
|
|
29
|
+
cached_siege_social: boolean | null;
|
|
29
30
|
organization_info_fetched_at: Date | null;
|
|
30
31
|
}
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const WeakLinkTypes = [
|
|
4
4
|
"code_sent_to_official_contact_email",
|
|
5
5
|
"domain",
|
|
6
6
|
"imported_from_coop_mediation_numerique",
|
|
7
7
|
"imported_from_inclusion_connect",
|
|
8
8
|
"in_liste_dirigeants_rna",
|
|
9
9
|
"in_liste_dirigeants_rne",
|
|
10
|
-
"no_validation_means_available",
|
|
11
|
-
"no_verification_means_for_entreprise_unipersonnelle",
|
|
12
|
-
"no_verification_means_for_small_association",
|
|
13
10
|
"official_contact_email",
|
|
14
|
-
"organization_dirigeant",
|
|
15
11
|
"proof_received",
|
|
16
12
|
// Used in the sandbox environment to bypass the verification process
|
|
17
13
|
"bypassed",
|
|
18
|
-
]
|
|
14
|
+
] as const;
|
|
19
15
|
|
|
20
|
-
export
|
|
21
|
-
typeof UserOrganizationLinkVerificationTypeSchema
|
|
22
|
-
>;
|
|
16
|
+
export const StrongLinkTypes = ["organization_dirigeant"] as const;
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
export const VerifiedLinkTypes = [
|
|
19
|
+
...WeakLinkTypes,
|
|
20
|
+
...StrongLinkTypes,
|
|
21
|
+
] as const;
|
|
22
|
+
|
|
23
|
+
export const UnverifiedLinkTypes = [
|
|
24
|
+
"no_validation_means_available",
|
|
25
|
+
"no_verification_means_for_entreprise_unipersonnelle",
|
|
26
|
+
"no_verification_means_for_small_association",
|
|
27
|
+
"domain_not_verified_yet",
|
|
28
|
+
] as const;
|
|
29
|
+
|
|
30
|
+
export const LinkTypes = z.enum([...VerifiedLinkTypes, ...UnverifiedLinkTypes]);
|
|
25
31
|
|
|
26
32
|
export const BaseUserOrganizationLinkSchema = z.object({
|
|
27
33
|
is_external: z.boolean(),
|
|
28
|
-
verification_type:
|
|
34
|
+
verification_type: LinkTypes,
|
|
29
35
|
// updated when verification_type is changed
|
|
30
36
|
verified_at: z.date().or(z.literal(null)),
|
|
31
37
|
has_been_greeted: z.boolean(),
|