@proconnect-gouv/proconnect.identite 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +0 -2
  3. package/dist/data/certification/categories-juridiques-sources.d.ts +8 -0
  4. package/dist/data/certification/categories-juridiques-sources.d.ts.map +1 -0
  5. package/dist/data/certification/categories-juridiques-sources.js +743 -0
  6. package/dist/data/certification/index.d.ts +1 -0
  7. package/dist/data/certification/index.d.ts.map +1 -1
  8. package/dist/data/certification/index.js +1 -0
  9. package/dist/errors/index.d.ts +0 -9
  10. package/dist/errors/index.d.ts.map +1 -1
  11. package/dist/errors/index.js +0 -18
  12. package/dist/managers/certification/certification-score.d.ts +11 -1
  13. package/dist/managers/certification/certification-score.d.ts.map +1 -1
  14. package/dist/managers/certification/certification-score.js +17 -8
  15. package/dist/managers/certification/index.d.ts +1 -1
  16. package/dist/managers/certification/index.d.ts.map +1 -1
  17. package/dist/managers/certification/index.js +1 -1
  18. package/dist/managers/certification/process-certification-dirigeant.d.ts +80 -0
  19. package/dist/managers/certification/process-certification-dirigeant.d.ts.map +1 -0
  20. package/dist/managers/certification/process-certification-dirigeant.js +121 -0
  21. package/dist/managers/organization/adapters/api_entreprise.d.ts +2 -1
  22. package/dist/managers/organization/adapters/api_entreprise.d.ts.map +1 -1
  23. package/dist/managers/organization/adapters/api_entreprise.js +3 -1
  24. package/dist/managers/organization/force-join-organization.d.ts +1 -1
  25. package/dist/managers/organization/force-join-organization.d.ts.map +1 -1
  26. package/dist/managers/organization/force-join-organization.js +3 -4
  27. package/dist/managers/user/assign-user-verification-type-to-domain.d.ts.map +1 -1
  28. package/dist/managers/user/assign-user-verification-type-to-domain.js +6 -6
  29. package/dist/repositories/organization/find-by-user-id.d.ts +1 -1
  30. package/dist/repositories/organization/get-users-by-organization.d.ts +1 -1
  31. package/dist/repositories/organization/link-user-to-organization.d.ts +1 -1
  32. package/dist/repositories/organization/upsert.d.ts.map +1 -1
  33. package/dist/repositories/organization/upsert.js +8 -3
  34. package/dist/repositories/user/update-user-organization-link.d.ts +1 -1
  35. package/dist/services/organization/index.d.ts +1 -0
  36. package/dist/services/organization/index.d.ts.map +1 -1
  37. package/dist/services/organization/index.js +1 -0
  38. package/dist/services/organization/is-entreprise-unipersonnelle.d.ts +3 -3
  39. package/dist/services/organization/is-entreprise-unipersonnelle.d.ts.map +1 -1
  40. package/dist/services/organization/is-entreprise-unipersonnelle.js +4 -4
  41. package/dist/services/organization/is-organization-covered-by-certification-dirigeant.d.ts +3 -0
  42. package/dist/services/organization/is-organization-covered-by-certification-dirigeant.d.ts.map +1 -0
  43. package/dist/services/organization/is-organization-covered-by-certification-dirigeant.js +2 -0
  44. package/dist/services/organization/is-public-service.d.ts.map +1 -1
  45. package/dist/services/organization/is-public-service.js +16 -6
  46. package/dist/services/organization/is-syndicat-communal.d.ts.map +1 -1
  47. package/dist/services/organization/is-syndicat-communal.js +1 -0
  48. package/dist/types/franceconnect.d.ts.map +1 -1
  49. package/dist/types/franceconnect.js +2 -2
  50. package/dist/types/{dirigeant.d.ts → identity-vector.d.ts} +2 -1
  51. package/dist/types/identity-vector.d.ts.map +1 -0
  52. package/dist/types/{dirigeant.js → identity-vector.js} +8 -0
  53. package/dist/types/index.d.ts +2 -1
  54. package/dist/types/index.d.ts.map +1 -1
  55. package/dist/types/index.js +2 -1
  56. package/dist/types/moderation.d.ts +37 -0
  57. package/dist/types/moderation.d.ts.map +1 -0
  58. package/dist/types/moderation.js +26 -0
  59. package/dist/types/organization-info.d.ts +2 -1
  60. package/dist/types/organization-info.d.ts.map +1 -1
  61. package/dist/types/organization-info.js +1 -0
  62. package/dist/types/organization.d.ts +1 -0
  63. package/dist/types/organization.d.ts.map +1 -1
  64. package/dist/types/user-organization-link.d.ts +32 -25
  65. package/dist/types/user-organization-link.d.ts.map +1 -1
  66. package/dist/types/user-organization-link.js +15 -8
  67. package/package.json +2 -2
  68. package/src/data/certification/categories-juridiques-sources.ts +811 -0
  69. package/src/data/certification/index.ts +1 -0
  70. package/src/errors/index.ts +0 -21
  71. package/src/managers/certification/certification-score.test.ts +69 -33
  72. package/src/managers/certification/certification-score.ts +20 -9
  73. package/src/managers/certification/index.ts +1 -1
  74. package/src/managers/certification/{is-organization-dirigeant.test.ts → process-certification-dirigeant.test.ts} +62 -64
  75. package/src/managers/certification/{is-organization-dirigeant.ts → process-certification-dirigeant.ts} +115 -74
  76. package/src/managers/organization/adapters/api_entreprise.test.ts.snapshot +4 -0
  77. package/src/managers/organization/adapters/api_entreprise.ts +3 -0
  78. package/src/managers/organization/force-join-organization.ts +3 -6
  79. package/src/managers/organization/get-organization-info.test.ts.snapshot +3 -0
  80. package/src/managers/organization/mark-domain-as-verified.test.ts +1 -1
  81. package/src/managers/user/assign-user-verification-type-to-domain.ts +6 -6
  82. package/src/repositories/organization/find-by-id.test.ts +1 -0
  83. package/src/repositories/organization/find-by-user-id.test.ts.snapshot +3 -0
  84. package/src/repositories/organization/get-by-id.test.ts +1 -0
  85. package/src/repositories/organization/link-user-to-organization.test.ts +3 -2
  86. package/src/repositories/organization/link-user-to-organization.test.ts.snapshot +2 -2
  87. package/src/repositories/organization/upsert.ts +8 -1
  88. package/src/repositories/organization/upset.test.ts +2 -0
  89. package/src/services/organization/index.ts +1 -0
  90. package/src/services/organization/is-entreprise-unipersonnelle.ts +5 -5
  91. package/src/services/organization/is-organization-covered-by-certification-dirigeant.test.ts +43 -0
  92. package/src/services/organization/is-organization-covered-by-certification-dirigeant.ts +9 -0
  93. package/src/services/organization/is-public-service.test.ts +1 -1
  94. package/src/services/organization/is-public-service.ts +20 -7
  95. package/src/services/organization/is-syndicat-communal.ts +1 -0
  96. package/src/types/franceconnect.ts +6 -7
  97. package/src/types/{dirigeant.ts → identity-vector.ts} +9 -0
  98. package/src/types/index.ts +2 -1
  99. package/src/types/moderation.ts +35 -0
  100. package/src/types/organization-info.ts +1 -0
  101. package/src/types/organization.ts +1 -0
  102. package/src/types/user-organization-link.ts +17 -11
  103. package/tsconfig.lib.tsbuildinfo +1 -1
  104. package/dist/managers/certification/is-organization-dirigeant.d.ts +0 -45
  105. package/dist/managers/certification/is-organization-dirigeant.d.ts.map +0 -1
  106. package/dist/managers/certification/is-organization-dirigeant.js +0 -97
  107. package/dist/types/dirigeant.d.ts.map +0 -1
@@ -1,3 +1,4 @@
1
+ export * from "./categories-juridiques-sources.js";
1
2
  export * from "./commune-code-conversion.js";
2
3
  export * from "./country-iso-to-cog.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/certification/index.ts"],"names":[],"mappings":"AAEA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/certification/index.ts"],"names":[],"mappings":"AAEA,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  //
2
+ export * from "./categories-juridiques-sources.js";
2
3
  export * from "./commune-code-conversion.js";
3
4
  export * from "./country-iso-to-cog.js";
@@ -1,22 +1,13 @@
1
- export declare class InvalidCertificationError extends Error {
2
- constructor(message?: string, options?: ErrorOptions);
3
- }
4
1
  export declare class InvalidSiretError extends Error {
5
2
  constructor(message?: string, options?: ErrorOptions);
6
3
  }
7
4
  export declare class NotFoundError extends Error {
8
5
  constructor(message?: string, options?: ErrorOptions);
9
6
  }
10
- export declare class OrganizationNotActiveError extends Error {
11
- constructor(message?: string, options?: ErrorOptions);
12
- }
13
7
  export declare class OrganizationNotFoundError extends Error {
14
8
  constructor(message?: string, options?: ErrorOptions);
15
9
  }
16
10
  export declare class UserNotFoundError extends Error {
17
11
  constructor(message?: string, options?: ErrorOptions);
18
12
  }
19
- export declare class ModerationNotFoundError extends Error {
20
- constructor(message?: string, options?: ErrorOptions);
21
- }
22
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD"}
@@ -1,10 +1,4 @@
1
1
  //
2
- export class InvalidCertificationError extends Error {
3
- constructor(message, options) {
4
- super(message, options);
5
- this.name = "InvalidCertificationError";
6
- }
7
- }
8
2
  export class InvalidSiretError extends Error {
9
3
  constructor(message, options) {
10
4
  super(message, options);
@@ -17,12 +11,6 @@ export class NotFoundError extends Error {
17
11
  this.name = "NotFoundError";
18
12
  }
19
13
  }
20
- export class OrganizationNotActiveError extends Error {
21
- constructor(message, options) {
22
- super(message, options);
23
- this.name = "OrganizationNotActiveError";
24
- }
25
- }
26
14
  export class OrganizationNotFoundError extends Error {
27
15
  constructor(message, options) {
28
16
  super(message, options);
@@ -35,9 +23,3 @@ export class UserNotFoundError extends Error {
35
23
  this.name = "UserNotFoundError";
36
24
  }
37
25
  }
38
- export class ModerationNotFoundError extends Error {
39
- constructor(message, options) {
40
- super(message, options);
41
- this.name = "ModerationNotFoundError";
42
- }
43
- }
@@ -1,4 +1,14 @@
1
1
  import type { IdentityVector } from "#src/types";
2
+ import z from "zod/v4";
3
+ export declare const MatchCriteria: z.ZodEnum<{
4
+ family_name: "family_name";
5
+ gender: "gender";
6
+ birth_country: "birth_country";
7
+ birth_date: "birth_date";
8
+ birth_place: "birth_place";
9
+ first_name: "first_name";
10
+ }>;
11
+ export type MatchCriteria = z.output<typeof MatchCriteria>;
2
12
  /**
3
13
  * Calculates a certification score between identity from FranceConnect (IdentitePivot)
4
14
  * and executive identity from business registries (SourceDirigeant).
@@ -18,5 +28,5 @@ import type { IdentityVector } from "#src/types";
18
28
  * @param sourceDirigeant - Executive identity from business registry
19
29
  * @returns Score from 0 to 5
20
30
  */
21
- export declare function certificationScore(identitePivot: IdentityVector, sourceDirigeant: IdentityVector): number;
31
+ export declare function certificationScore(identitePivot: IdentityVector, sourceDirigeant: IdentityVector): Set<"family_name" | "gender" | "birth_country" | "birth_date" | "birth_place" | "first_name">;
22
32
  //# sourceMappingURL=certification-score.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"certification-score.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/certification-score.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,cAAc,EAC7B,eAAe,EAAE,cAAc,GAC9B,MAAM,CAkER"}
1
+ {"version":3,"file":"certification-score.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/certification-score.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,CAAC,MAAM,QAAQ,CAAC;AAMvB,eAAO,MAAM,aAAa;;;;;;;EAOxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,cAAc,EAC7B,eAAe,EAAE,cAAc,iGAmEhC"}
@@ -1,7 +1,16 @@
1
1
  //
2
+ import z from "zod/v4";
2
3
  import { convertCommuneCode } from "./birthplace-conversion.js";
3
4
  import { extractFirstName, normalizeText } from "./normalize.js";
4
5
  //
6
+ export const MatchCriteria = z.enum([
7
+ "birth_country",
8
+ "birth_date",
9
+ "birth_place",
10
+ "family_name",
11
+ "first_name",
12
+ "gender",
13
+ ]);
5
14
  /**
6
15
  * Calculates a certification score between identity from FranceConnect (IdentitePivot)
7
16
  * and executive identity from business registries (SourceDirigeant).
@@ -22,31 +31,31 @@ import { extractFirstName, normalizeText } from "./normalize.js";
22
31
  * @returns Score from 0 to 5
23
32
  */
24
33
  export function certificationScore(identitePivot, sourceDirigeant) {
25
- let score = 0;
34
+ const matches = new Set();
26
35
  // 1. Family name match (after normalization)
27
36
  const normalizedFamilyNamePivot = normalizeText(identitePivot.family_name);
28
37
  const normalizedFamilyNameSource = normalizeText(sourceDirigeant.family_name);
29
38
  if (normalizedFamilyNamePivot &&
30
39
  normalizedFamilyNameSource &&
31
40
  normalizedFamilyNamePivot === normalizedFamilyNameSource) {
32
- score += 1;
41
+ matches.add(MatchCriteria.enum.family_name);
33
42
  }
34
43
  // 2. First name match (first name only, after normalization)
35
44
  const firstNamePivot = extractFirstName(identitePivot.given_name);
36
45
  const firstNameSource = extractFirstName(sourceDirigeant.given_name);
37
46
  if (firstNamePivot && firstNameSource && firstNamePivot === firstNameSource) {
38
- score += 1;
47
+ matches.add(MatchCriteria.enum.first_name);
39
48
  }
40
49
  // 3. Gender match (match or absent in source)
41
50
  if (!sourceDirigeant.gender ||
42
51
  identitePivot.gender === sourceDirigeant.gender) {
43
- score += 1;
52
+ matches.add(MatchCriteria.enum.gender);
44
53
  }
45
54
  // 4. Birth date match (exact match)
46
55
  if (identitePivot.birthdate &&
47
56
  sourceDirigeant.birthdate &&
48
57
  identitePivot.birthdate.getTime() === sourceDirigeant.birthdate.getTime()) {
49
- score += 1;
58
+ matches.add(MatchCriteria.enum.birth_date);
50
59
  }
51
60
  // 5. Birth place match (different logic for French vs foreigners)
52
61
  const isFrench = !identitePivot.birthcountry || identitePivot.birthcountry === "99100";
@@ -56,7 +65,7 @@ export function certificationScore(identitePivot, sourceDirigeant) {
56
65
  const communeSource = convertCommuneCode(sourceDirigeant.birthplace);
57
66
  // Match if equal or if source has no commune data
58
67
  if (!communeSource || (communePivot && communePivot === communeSource)) {
59
- score += 1;
68
+ matches.add(MatchCriteria.enum.birth_place);
60
69
  }
61
70
  }
62
71
  else {
@@ -65,8 +74,8 @@ export function certificationScore(identitePivot, sourceDirigeant) {
65
74
  if (identitePivot.birthcountry &&
66
75
  sourceDirigeant.birthcountry &&
67
76
  identitePivot.birthcountry === sourceDirigeant.birthcountry) {
68
- score += 1;
77
+ matches.add(MatchCriteria.enum.birth_country);
69
78
  }
70
79
  }
71
- return score;
80
+ return matches;
72
81
  }
@@ -1,3 +1,3 @@
1
1
  export * from "./certification-score.js";
2
- export * from "./is-organization-dirigeant.js";
2
+ export * from "./process-certification-dirigeant.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/index.ts"],"names":[],"mappings":"AAEA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/index.ts"],"names":[],"mappings":"AAEA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  //
2
2
  export * from "./certification-score.js";
3
- export * from "./is-organization-dirigeant.js";
3
+ export * from "./process-certification-dirigeant.js";
@@ -0,0 +1,80 @@
1
+ import { type FranceConnectUserInfo, type Organization } from "#src/types";
2
+ import type { ApiEntrepriseInfogreffeRepository } from "@proconnect-gouv/proconnect.api_entreprise/api";
3
+ import type { FindUniteLegaleBySirenHandler } from "@proconnect-gouv/proconnect.insee/api";
4
+ import type { FindPouvoirsBySirenHandler } from "@proconnect-gouv/proconnect.registre_national_entreprises/api";
5
+ import z from "zod/v4";
6
+ type ProcessCertificationDirigeantConfig = {
7
+ ApiEntrepriseInfogreffeRepository: Pick<ApiEntrepriseInfogreffeRepository, "findMandatairesSociauxBySiren">;
8
+ EQUALITY_THRESHOLD?: number;
9
+ InseeApiRepository: {
10
+ findBySiren: FindUniteLegaleBySirenHandler;
11
+ };
12
+ RegistreNationalEntreprisesApiRepository: {
13
+ findPouvoirsBySiren: FindPouvoirsBySirenHandler;
14
+ };
15
+ };
16
+ export declare const CertificationDirigeantDataSource: z.ZodEnum<{
17
+ "api.insee.fr/api-sirene/private": "api.insee.fr/api-sirene/private";
18
+ "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux": "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux";
19
+ "registre-national-entreprises.inpi.fr/api": "registre-national-entreprises.inpi.fr/api";
20
+ }>;
21
+ export type CertificationDirigeantDataSource = z.infer<typeof CertificationDirigeantDataSource>;
22
+ export declare function getCertificationDirigeantDataSourceLabels(dataSource: CertificationDirigeantDataSource): string;
23
+ export declare function processCertificationDirigeantFactory(config: ProcessCertificationDirigeantConfig): (organization: Organization, franceconnect_userinfo: FranceConnectUserInfo) => Promise<{
24
+ details: {
25
+ dirigeant: null;
26
+ matches: Set<unknown>;
27
+ identity: {
28
+ birthcountry: string | null;
29
+ birthdate: Date | null;
30
+ birthplace: string | null;
31
+ family_name: string | null;
32
+ gender: "male" | "female" | null;
33
+ given_name: string | null;
34
+ };
35
+ source: null;
36
+ };
37
+ cause: "organisation_not_covered";
38
+ ok: boolean;
39
+ } | {
40
+ details: {
41
+ dirigeant: undefined;
42
+ matches: Set<unknown>;
43
+ identity: {
44
+ birthcountry: string | null;
45
+ birthdate: Date | null;
46
+ birthplace: string | null;
47
+ family_name: string | null;
48
+ gender: "male" | "female" | null;
49
+ given_name: string | null;
50
+ };
51
+ source: "api.insee.fr/api-sirene/private" | "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux" | "registre-national-entreprises.inpi.fr/api";
52
+ };
53
+ cause: "no_candidates";
54
+ ok: boolean;
55
+ } | {
56
+ details: {
57
+ dirigeant: {
58
+ birthcountry: string | null;
59
+ birthdate: Date | null;
60
+ birthplace: string | null;
61
+ family_name: string | null;
62
+ gender: "male" | "female" | null;
63
+ given_name: string | null;
64
+ };
65
+ matches: Set<"family_name" | "gender" | "birth_country" | "birth_date" | "birth_place" | "first_name">;
66
+ identity: {
67
+ birthcountry: string | null;
68
+ birthdate: Date | null;
69
+ birthplace: string | null;
70
+ family_name: string | null;
71
+ gender: "male" | "female" | null;
72
+ given_name: string | null;
73
+ };
74
+ source: "api.insee.fr/api-sirene/private" | "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux" | "registre-national-entreprises.inpi.fr/api";
75
+ };
76
+ cause: "exact_match" | "close_match" | "below_threshold";
77
+ ok: boolean;
78
+ }>;
79
+ export {};
80
+ //# sourceMappingURL=process-certification-dirigeant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-certification-dirigeant.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/process-certification-dirigeant.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,qBAAqB,EAE1B,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AACxG,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAEhH,OAAO,CAAC,MAAM,QAAQ,CAAC;AASvB,KAAK,mCAAmC,GAAG;IACzC,iCAAiC,EAAE,IAAI,CACrC,iCAAiC,EACjC,+BAA+B,CAChC,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE;QAAE,WAAW,EAAE,6BAA6B,CAAA;KAAE,CAAC;IACnE,wCAAwC,EAAE;QACxC,mBAAmB,EAAE,0BAA0B,CAAC;KACjD,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;EAI3C,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,gCAAgC,CACxC,CAAC;AAWF,wBAAgB,yCAAyC,CACvD,UAAU,EAAE,gCAAgC,UAG7C;AA0ED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,mCAAmC,IAKzC,cAAc,YAAY,EAC1B,wBAAwB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEhD"}
@@ -0,0 +1,121 @@
1
+ //
2
+ import { isOrganizationCoveredByCertificationDirigeant } from "#src/services/organization";
3
+ import { NullIdentityVector, } from "#src/types";
4
+ import { match } from "ts-pattern";
5
+ import z from "zod/v4";
6
+ import * as ApiEntreprise from "./adapters/api_entreprise.js";
7
+ import * as FranceConnect from "./adapters/franceconnect.js";
8
+ import * as INSEE from "./adapters/insee.js";
9
+ import * as RNE from "./adapters/rne.js";
10
+ import { certificationScore } from "./certification-score.js";
11
+ export const CertificationDirigeantDataSource = z.enum([
12
+ "api.insee.fr/api-sirene/private",
13
+ "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux",
14
+ "registre-national-entreprises.inpi.fr/api",
15
+ ]);
16
+ const CERTIFICATION_DIRIGEANT_DATA_SOURCE_LABELS = {
17
+ "api.insee.fr/api-sirene/private": "Répertoire SIRENE de l'INSEE",
18
+ "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux": "Registre du commerce et des sociétés (RCS)",
19
+ "registre-national-entreprises.inpi.fr/api": "Registre National des Entreprises",
20
+ };
21
+ export function getCertificationDirigeantDataSourceLabels(dataSource) {
22
+ return CERTIFICATION_DIRIGEANT_DATA_SOURCE_LABELS[dataSource];
23
+ }
24
+ //
25
+ async function getMandatairesSociaux({ RegistreNationalEntreprisesApiRepository, ApiEntrepriseInfogreffeRepository, }, siren) {
26
+ try {
27
+ const pouvoirs = await RegistreNationalEntreprisesApiRepository.findPouvoirsBySiren(siren);
28
+ const dirigeants = pouvoirs.map(RNE.toIdentityVector);
29
+ return {
30
+ dirigeants,
31
+ source: CertificationDirigeantDataSource.enum["registre-national-entreprises.inpi.fr/api"],
32
+ };
33
+ }
34
+ catch (error) {
35
+ console.error(error);
36
+ const mandataires = await ApiEntrepriseInfogreffeRepository.findMandatairesSociauxBySiren(siren);
37
+ const dirigeants = mandataires.map(ApiEntreprise.toIdentityVector);
38
+ return {
39
+ dirigeants,
40
+ source: CertificationDirigeantDataSource.enum["entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux"],
41
+ };
42
+ }
43
+ }
44
+ function match_identity_to_dirigeant(identity, dirigeants) {
45
+ if (dirigeants.length === 0)
46
+ return { kind: "no_candidates" };
47
+ const [closest] = dirigeants
48
+ .map((dirigeant) => ({
49
+ dirigeant,
50
+ matches: certificationScore(identity, dirigeant),
51
+ }))
52
+ .toSorted((a, b) => b.matches.size - a.matches.size); // Sort by score descending (higher is better)
53
+ // According to the specification, only score of 5 (perfect match) is certified
54
+ return match(closest.matches.size)
55
+ .with(5, () => ({
56
+ kind: "exact_match",
57
+ closest,
58
+ }))
59
+ .with(4, () => ({
60
+ kind: "close_match",
61
+ closest,
62
+ }))
63
+ .with(3, () => ({
64
+ kind: "close_match",
65
+ closest,
66
+ }))
67
+ .otherwise(() => ({
68
+ kind: "below_threshold",
69
+ closest,
70
+ }));
71
+ }
72
+ export function processCertificationDirigeantFactory(config) {
73
+ const { InseeApiRepository } = config;
74
+ return async function processCertificationDirigeant(organization, franceconnect_userinfo) {
75
+ if (!isOrganizationCoveredByCertificationDirigeant(organization)) {
76
+ return {
77
+ details: {
78
+ dirigeant: null,
79
+ matches: new Set(),
80
+ identity: NullIdentityVector,
81
+ source: null,
82
+ },
83
+ cause: "organisation_not_covered",
84
+ ok: false,
85
+ };
86
+ }
87
+ const siren = organization.siret.substring(0, 9);
88
+ const identity = FranceConnect.toIdentityVector(franceconnect_userinfo);
89
+ const preferredDataSource = organization.cached_libelle_categorie_juridique ===
90
+ "Entrepreneur individuel"
91
+ ? CertificationDirigeantDataSource.enum["api.insee.fr/api-sirene/private"]
92
+ : CertificationDirigeantDataSource.enum["registre-national-entreprises.inpi.fr/api"];
93
+ const { dirigeants, source } = await match(preferredDataSource)
94
+ .with("api.insee.fr/api-sirene/private", async () => ({
95
+ dirigeants: await InseeApiRepository.findBySiren(siren)
96
+ .then(INSEE.toIdentityVector)
97
+ .then((vector) => [vector]),
98
+ source: CertificationDirigeantDataSource.enum["api.insee.fr/api-sirene/private"],
99
+ }))
100
+ .with("registre-national-entreprises.inpi.fr/api", () => getMandatairesSociaux(config, siren))
101
+ .exhaustive();
102
+ const result = match_identity_to_dirigeant(identity, dirigeants);
103
+ if (result.kind === "no_candidates") {
104
+ return {
105
+ details: { dirigeant: undefined, matches: new Set(), identity, source },
106
+ cause: result.kind,
107
+ ok: false,
108
+ };
109
+ }
110
+ return {
111
+ details: {
112
+ dirigeant: result.closest.dirigeant,
113
+ matches: result.closest.matches,
114
+ identity,
115
+ source,
116
+ },
117
+ cause: result.kind,
118
+ ok: result.kind === "exact_match",
119
+ };
120
+ };
121
+ }
@@ -17,9 +17,10 @@ export declare function toPartialOrganization(organization_info: OrganizationInf
17
17
  cached_libelle_tranche_effectif: string;
18
18
  cached_libelle: string;
19
19
  cached_nom_complet: string;
20
+ cached_siege_social: boolean;
20
21
  cached_statut_diffusion: "diffusible" | "partiellement_diffusible" | "non_diffusible";
21
22
  cached_tranche_effectifs_unite_legale: string | null;
22
- cached_tranche_effectifs: "NN" | "00" | "01" | "02" | "03" | "11" | "12" | "21" | "22" | "31" | "32" | "41" | "42" | "51" | "52" | "53" | null;
23
+ cached_tranche_effectifs: "11" | "12" | "21" | "22" | "31" | "32" | "41" | "42" | "51" | "52" | "53" | "NN" | "00" | "01" | "02" | "03" | null;
23
24
  siret: string;
24
25
  };
25
26
  //# sourceMappingURL=api_entreprise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api_entreprise.d.ts","sourceRoot":"","sources":["../../../../src/managers/organization/adapters/api_entreprise.ts"],"names":[],"mappings":"AAEA,OAAO,YAAY,CAAC;AACpB,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,kDAAkD,CAAC;AAKlH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,yCAAyC,GACnD,gBAAgB,CAyDlB;AAED,wBAAgB,qBAAqB,CAAC,iBAAiB,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;EA4CxE"}
1
+ {"version":3,"file":"api_entreprise.d.ts","sourceRoot":"","sources":["../../../../src/managers/organization/adapters/api_entreprise.ts"],"names":[],"mappings":"AAEA,OAAO,YAAY,CAAC;AACpB,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,kDAAkD,CAAC;AAKlH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,yCAAyC,GACnD,gBAAgB,CA0DlB;AAED,wBAAgB,qBAAqB,CAAC,iBAAiB,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;EA8CxE"}
@@ -43,6 +43,7 @@ export function toOrganizationInfo(siretData) {
43
43
  libelleCategorieJuridique: siretData.unite_legale.forme_juridique.libelle,
44
44
  libelleTrancheEffectif: libelleFromCodeEffectif(siretData.tranche_effectif_salarie.intitule, siretData.tranche_effectif_salarie.date_reference),
45
45
  nomComplet,
46
+ siegeSocial: siretData.siege_social,
46
47
  siret: siretData.siret,
47
48
  statutDiffusion: siretData.status_diffusion,
48
49
  trancheEffectifs,
@@ -50,7 +51,7 @@ export function toOrganizationInfo(siretData) {
50
51
  });
51
52
  }
52
53
  export function toPartialOrganization(organization_info) {
53
- const { activitePrincipale: cached_activite_principale, adresse: cached_adresse, categorieJuridique: cached_categorie_juridique, codeOfficielGeographique: cached_code_officiel_geographique, codePostal: cached_code_postal, enseigne: cached_enseigne, estActive: cached_est_active, estDiffusible: cached_est_diffusible, etatAdministratif: cached_etat_administratif, libelle: cached_libelle, libelleActivitePrincipale: cached_libelle_activite_principale, libelleCategorieJuridique: cached_libelle_categorie_juridique, libelleTrancheEffectif: cached_libelle_tranche_effectif, nomComplet: cached_nom_complet, siret, statutDiffusion: cached_statut_diffusion, trancheEffectifs: cached_tranche_effectifs, trancheEffectifsUniteLegale: cached_tranche_effectifs_unite_legale, } = organization_info;
54
+ const { activitePrincipale: cached_activite_principale, adresse: cached_adresse, categorieJuridique: cached_categorie_juridique, codeOfficielGeographique: cached_code_officiel_geographique, codePostal: cached_code_postal, enseigne: cached_enseigne, estActive: cached_est_active, estDiffusible: cached_est_diffusible, etatAdministratif: cached_etat_administratif, libelle: cached_libelle, libelleActivitePrincipale: cached_libelle_activite_principale, libelleCategorieJuridique: cached_libelle_categorie_juridique, libelleTrancheEffectif: cached_libelle_tranche_effectif, nomComplet: cached_nom_complet, siegeSocial: cached_siege_social, siret, statutDiffusion: cached_statut_diffusion, trancheEffectifs: cached_tranche_effectifs, trancheEffectifsUniteLegale: cached_tranche_effectifs_unite_legale, } = organization_info;
54
55
  return {
55
56
  cached_activite_principale,
56
57
  cached_adresse,
@@ -66,6 +67,7 @@ export function toPartialOrganization(organization_info) {
66
67
  cached_libelle_tranche_effectif,
67
68
  cached_libelle,
68
69
  cached_nom_complet,
70
+ cached_siege_social,
69
71
  cached_statut_diffusion,
70
72
  cached_tranche_effectifs_unite_legale,
71
73
  cached_tranche_effectifs,
@@ -13,7 +13,7 @@ export declare function forceJoinOrganizationFactory({ findEmailDomainsByOrganiz
13
13
  is_external?: boolean;
14
14
  }) => Promise<{
15
15
  is_external: boolean;
16
- verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "official_contact_email" | "organization_dirigeant" | "proof_received" | "bypassed" | null;
16
+ verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "proof_received" | "bypassed" | "organization_dirigeant" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "domain_not_verified_yet";
17
17
  verified_at: Date | null;
18
18
  has_been_greeted: boolean;
19
19
  needs_official_contact_email_verification: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"force-join-organization.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/force-join-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,KAAK,EACV,cAAc,IAAI,0BAA0B,EAC5C,6BAA6B,EAC9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQnF,KAAK,mBAAmB,GAAG;IACzB,gCAAgC,EAAE,uCAAuC,CAAC;IAC1E,OAAO,EAAE,0BAA0B,CAAC;IACpC,WAAW,EAAE,kBAAkB,CAAC;IAChC,sBAAsB,EAAE,6BAA6B,CAAC;CACvD,CAAC;AAIF,wBAAgB,4BAA4B,CAAC,EAC3C,gCAAgC,EAChC,OAAO,EACP,WAAW,EACX,sBAAsB,GACvB,EAAE,mBAAmB,IACwB,4CAIzC;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;;;;;;;;;;;;GA+CF;AAED,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,4BAA4B,CACpC,CAAC"}
1
+ {"version":3,"file":"force-join-organization.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/force-join-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,KAAK,EACV,cAAc,IAAI,0BAA0B,EAC5C,6BAA6B,EAC9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAOnF,KAAK,mBAAmB,GAAG;IACzB,gCAAgC,EAAE,uCAAuC,CAAC;IAC1E,OAAO,EAAE,0BAA0B,CAAC;IACpC,WAAW,EAAE,kBAAkB,CAAC;IAChC,sBAAsB,EAAE,6BAA6B,CAAC;CACvD,CAAC;AAIF,wBAAgB,4BAA4B,CAAC,EAC3C,gCAAgC,EAChC,OAAO,EACP,WAAW,EACX,sBAAsB,GACvB,EAAE,mBAAmB,IACwB,4CAIzC;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;;;;;;;;;;;;GA6CF;AAED,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,4BAA4B,CACpC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  //
2
+ import { LinkTypes } from "#src/types";
2
3
  import { getEmailDomain } from "@proconnect-gouv/proconnect.core/services/email";
3
4
  import { match } from "ts-pattern";
4
- import { UserOrganizationLinkVerificationTypeSchema } from "../../types/index.js";
5
5
  //
6
6
  export function forceJoinOrganizationFactory({ findEmailDomainsByOrganizationId, getById, getUserById, linkUserToOrganization, }) {
7
7
  return async function forceJoinOrganization({ organization_id, user_id, is_external = false, }) {
@@ -18,9 +18,8 @@ export function forceJoinOrganizationFactory({ findEmailDomainsByOrganizationId,
18
18
  return acc;
19
19
  }
20
20
  return match(verification_type)
21
- .with("verified", "trackdechets_postal_mail", "external", "official_contact", () => UserOrganizationLinkVerificationTypeSchema.enum.domain)
22
- .with(null, "blacklisted", "refused", () => UserOrganizationLinkVerificationTypeSchema.enum
23
- .no_validation_means_available)
21
+ .with("verified", "trackdechets_postal_mail", "external", "official_contact", () => LinkTypes.enum.domain)
22
+ .with(null, "blacklisted", "refused", () => LinkTypes.enum.no_validation_means_available)
24
23
  .exhaustive();
25
24
  }, "no_validation_means_available");
26
25
  return await linkUserToOrganization({
@@ -1 +1 @@
1
- {"version":3,"file":"assign-user-verification-type-to-domain.d.ts","sourceRoot":"","sources":["../../../src/managers/user/assign-user-verification-type-to-domain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAKhF,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,6BAA6B,CAAC;IACxC,0BAA0B,EAAE,iCAAiC,CAAC;CAC/D,CAAC;AAEF,wBAAgB,yCAAyC,CAAC,EACxD,QAAQ,EACR,0BAA0B,GAC3B,EAAE,mBAAmB,IAElB,iBAAiB,MAAM,EACvB,QAAQ,MAAM,mBA0BjB;AAED,MAAM,MAAM,gDAAgD,GAAG,UAAU,CACvE,OAAO,yCAAyC,CACjD,CAAC"}
1
+ {"version":3,"file":"assign-user-verification-type-to-domain.d.ts","sourceRoot":"","sources":["../../../src/managers/user/assign-user-verification-type-to-domain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAOhF,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,6BAA6B,CAAC;IACxC,0BAA0B,EAAE,iCAAiC,CAAC;CAC/D,CAAC;AAEF,wBAAgB,yCAAyC,CAAC,EACxD,QAAQ,EACR,0BAA0B,GAC3B,EAAE,mBAAmB,IAElB,iBAAiB,MAAM,EACvB,QAAQ,MAAM,mBAwBjB;AAED,MAAM,MAAM,gDAAgD,GAAG,UAAU,CACvE,OAAO,yCAAyC,CACjD,CAAC"}
@@ -1,18 +1,18 @@
1
1
  //
2
+ import { LinkTypes, UnverifiedLinkTypes } from "#src/types";
2
3
  import { getEmailDomain } from "@proconnect-gouv/proconnect.core/services/email";
4
+ import { match } from "ts-pattern";
3
5
  export function assignUserVerificationTypeToDomainFactory({ getUsers, updateUserOrganizationLink, }) {
4
6
  return async function assignUserVerificationTypeToDomain(organization_id, domain) {
5
7
  const usersInOrganization = await getUsers(organization_id);
6
8
  await Promise.all(usersInOrganization.map(({ id, email, verification_type: link_verification_type }) => {
7
9
  const userDomain = getEmailDomain(email);
8
10
  if (userDomain === domain &&
9
- [
10
- null,
11
- "no_verification_means_available",
12
- "no_verification_means_for_entreprise_unipersonnelle",
13
- ].includes(link_verification_type)) {
11
+ match(link_verification_type)
12
+ .with(...UnverifiedLinkTypes, () => true)
13
+ .otherwise(() => false)) {
14
14
  return updateUserOrganizationLink(organization_id, id, {
15
- verification_type: "domain",
15
+ verification_type: LinkTypes.enum.domain,
16
16
  });
17
17
  }
18
18
  return null;
@@ -1,7 +1,7 @@
1
1
  import type { DatabaseContext, Organization } from "#src/types";
2
2
  export declare function findByUserIdFactory({ pg }: DatabaseContext): (userId: number) => Promise<(Organization & {
3
3
  is_external: boolean;
4
- verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "official_contact_email" | "organization_dirigeant" | "proof_received" | "bypassed" | null;
4
+ verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "proof_received" | "bypassed" | "organization_dirigeant" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "domain_not_verified_yet";
5
5
  verified_at: Date | null;
6
6
  has_been_greeted: boolean;
7
7
  needs_official_contact_email_verification: boolean;
@@ -1,7 +1,7 @@
1
1
  import type { DatabaseContext, User } from "#src/types";
2
2
  export declare function getUsersByOrganizationFactory({ pg }: DatabaseContext): (organization_id: number, additionalWhereClause?: string, additionalParams?: any[]) => Promise<(User & {
3
3
  is_external: boolean;
4
- verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "official_contact_email" | "organization_dirigeant" | "proof_received" | "bypassed" | null;
4
+ verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "proof_received" | "bypassed" | "organization_dirigeant" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "domain_not_verified_yet";
5
5
  verified_at: Date | null;
6
6
  has_been_greeted: boolean;
7
7
  needs_official_contact_email_verification: boolean;
@@ -1,7 +1,7 @@
1
1
  import type { DatabaseContext, InsertUserOrganizationLink } from "#src/types";
2
2
  export declare function linkUserToOrganizationFactory({ pg }: DatabaseContext): ({ is_external, needs_official_contact_email_verification, organization_id, user_id, verification_type, }: InsertUserOrganizationLink) => Promise<{
3
3
  is_external: boolean;
4
- verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "official_contact_email" | "organization_dirigeant" | "proof_received" | "bypassed" | null;
4
+ verification_type: "code_sent_to_official_contact_email" | "domain" | "imported_from_coop_mediation_numerique" | "imported_from_inclusion_connect" | "in_liste_dirigeants_rna" | "in_liste_dirigeants_rne" | "official_contact_email" | "proof_received" | "bypassed" | "organization_dirigeant" | "no_validation_means_available" | "no_verification_means_for_entreprise_unipersonnelle" | "no_verification_means_for_small_association" | "domain_not_verified_yet";
5
5
  verified_at: Date | null;
6
6
  has_been_greeted: boolean;
7
7
  needs_official_contact_email_verification: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,8BAG1B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,2BA2HF;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,8BAG1B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,2BAgIF;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}