@proconnect-gouv/proconnect.identite 11.0.0 → 13.0.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 (63) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/connectors/index.d.ts +0 -37
  3. package/dist/connectors/index.d.ts.map +1 -1
  4. package/dist/connectors/index.js +2 -4
  5. package/dist/managers/certification/process-certification-dirigeant.d.ts +28 -1
  6. package/dist/managers/certification/process-certification-dirigeant.d.ts.map +1 -1
  7. package/dist/managers/certification/process-certification-dirigeant.js +17 -5
  8. package/dist/managers/organization/get-organization-info.d.ts +21 -1
  9. package/dist/managers/organization/get-organization-info.d.ts.map +1 -1
  10. package/dist/managers/organization/get-organization-info.js +44 -41
  11. package/dist/managers/organization/index.d.ts +0 -1
  12. package/dist/managers/organization/index.d.ts.map +1 -1
  13. package/dist/managers/organization/index.js +0 -1
  14. package/dist/repositories/email-domain/index.d.ts +0 -3
  15. package/dist/repositories/email-domain/index.d.ts.map +1 -1
  16. package/dist/repositories/email-domain/index.js +0 -1
  17. package/dist/repositories/organization/index.d.ts +0 -1
  18. package/dist/repositories/organization/index.d.ts.map +1 -1
  19. package/dist/repositories/organization/index.js +0 -1
  20. package/dist/services/organization/get-member-ids-promoted-by-domain.d.ts +9 -0
  21. package/dist/services/organization/get-member-ids-promoted-by-domain.d.ts.map +1 -0
  22. package/dist/services/organization/get-member-ids-promoted-by-domain.js +11 -0
  23. package/dist/services/organization/index.d.ts +1 -0
  24. package/dist/services/organization/index.d.ts.map +1 -1
  25. package/dist/services/organization/index.js +1 -0
  26. package/package.json +1 -1
  27. package/src/connectors/index.ts +0 -5
  28. package/src/managers/certification/process-certification-dirigeant.test.ts +12 -1
  29. package/src/managers/certification/process-certification-dirigeant.ts +23 -4
  30. package/src/managers/organization/get-organization-info.test.ts +75 -4
  31. package/src/managers/organization/get-organization-info.test.ts.snapshot +104 -80
  32. package/src/managers/organization/get-organization-info.ts +63 -56
  33. package/src/managers/organization/index.ts +0 -1
  34. package/src/repositories/email-domain/index.ts +0 -3
  35. package/src/repositories/organization/index.ts +0 -1
  36. package/src/services/organization/get-member-ids-promoted-by-domain.test.ts +100 -0
  37. package/src/services/organization/get-member-ids-promoted-by-domain.ts +27 -0
  38. package/src/services/organization/index.ts +1 -0
  39. package/dist/managers/organization/mark-domain-as-verified.d.ts +0 -18
  40. package/dist/managers/organization/mark-domain-as-verified.d.ts.map +0 -1
  41. package/dist/managers/organization/mark-domain-as-verified.js +0 -64
  42. package/dist/managers/user/assign-user-verification-type-to-domain.d.ts +0 -3
  43. package/dist/managers/user/assign-user-verification-type-to-domain.d.ts.map +0 -1
  44. package/dist/managers/user/assign-user-verification-type-to-domain.js +0 -20
  45. package/dist/managers/user/index.d.ts +0 -2
  46. package/dist/managers/user/index.d.ts.map +0 -1
  47. package/dist/managers/user/index.js +0 -1
  48. package/dist/repositories/email-domain/delete-email-domains-by-verification-types.d.ts +0 -8
  49. package/dist/repositories/email-domain/delete-email-domains-by-verification-types.d.ts.map +0 -1
  50. package/dist/repositories/email-domain/delete-email-domains-by-verification-types.js +0 -19
  51. package/dist/repositories/organization/find-users-by-organization.d.ts +0 -34
  52. package/dist/repositories/organization/find-users-by-organization.d.ts.map +0 -1
  53. package/dist/repositories/organization/find-users-by-organization.js +0 -16
  54. package/src/managers/organization/mark-domain-as-verified.test.ts +0 -250
  55. package/src/managers/organization/mark-domain-as-verified.ts +0 -123
  56. package/src/managers/user/assign-user-verification-type-to-domain.test.ts +0 -105
  57. package/src/managers/user/assign-user-verification-type-to-domain.ts +0 -40
  58. package/src/managers/user/index.ts +0 -1
  59. package/src/repositories/email-domain/delete-email-domains-by-verification-types.test.ts +0 -49
  60. package/src/repositories/email-domain/delete-email-domains-by-verification-types.ts +0 -45
  61. package/src/repositories/organization/find-users-by-organization.test.ts +0 -51
  62. package/src/repositories/organization/find-users-by-organization.test.ts.snapshot +0 -35
  63. package/src/repositories/organization/find-users-by-organization.ts +0 -30
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @proconnect-gouv/proconnect.identite
2
2
 
3
+ ## 13.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#2372](https://github.com/proconnect-gouv/proconnect-identite/pull/2372) [`a31ca3e`](https://github.com/proconnect-gouv/proconnect-identite/commit/a31ca3e90bcd2b874e754159d3597a720f7a62b0) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `markDomainAsVerifiedFactory` (`managers/organization`) et `assignUserVerificationTypeToDomainFactory` (`managers/user`), ainsi que les repositories qu'ils étaient seuls à utiliser (`email_domains.deleteEmailDomainsByVerificationTypes`, `organizations.findUsers`), sans appelant depuis que les deux applications passent par `markDomainAsVerified` du runtime.
8
+
9
+ ## 12.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#2362](https://github.com/proconnect-gouv/proconnect-identite/pull/2362) [`da31f6d`](https://github.com/proconnect-gouv/proconnect-identite/commit/da31f6d036c7569c0184962bb9bc6d14d12f04a1) Thanks [@douglasduteil](https://github.com/douglasduteil)! - `getOrganizationInfo` et `processCertificationDirigeant` renvoient leurs issues au lieu d'écrire dans la console ou de lever des erreurs.
14
+
15
+ Migration :
16
+ - `getOrganizationInfo` renvoie un `OrganizationInfoLookup` : faites un `match` sur `kind` au lieu d'attraper `InvalidSiretError`, `NotFoundError` ou `ApiEntrepriseConnectionError`.
17
+ - `found` : les données sont dans `organization_info` ; `rne.kind` vaut `enriched`, ou `failed` avec l'`exception` du registre national des entreprises.
18
+ - `invalid_siret` : le SIRET ou SIREN est mal formé ou refusé par entreprise.api.gouv.fr ; `exception` est une `InvalidSiretError` dont la `cause` porte le refus d'entreprise.api.gouv.fr.
19
+ - `not_diffusible` : l'établissement n'est pas diffusible.
20
+ - `api_entreprise_failed` : entreprise.api.gouv.fr a échoué, avec l'`exception`.
21
+ - `processCertificationDirigeant` ajoute `details.source_selection` (`SourceSelection`) : `preferred`, ou `fallback` avec l'`exception` du registre national des entreprises quand les mandataires viennent d'entreprise.api.gouv.fr.
22
+ - Les erreurs `InvalidSiretError`, `NotFoundError` et `ApiEntrepriseConnectionError` restent exportées.
23
+
24
+ ### Minor Changes
25
+
26
+ - [#2365](https://github.com/proconnect-gouv/proconnect-identite/pull/2365) [`e47d7dd`](https://github.com/proconnect-gouv/proconnect-identite/commit/e47d7dd69c76c7b8c8dc8094c8ec4ac574278e75) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Ajoute `getMemberIdsPromotedByDomain` dans `services/organization` : à partir d'un domaine et des membres d'une organisation, renvoie les identifiants des membres à promouvoir au rattachement `domain`.
27
+
3
28
  ## 11.0.0
4
29
 
5
30
  ### Major Changes
@@ -390,11 +390,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
390
390
  created_at: Date;
391
391
  updated_at: Date;
392
392
  }>;
393
- deleteEmailDomainsByVerificationTypes: ({ organization_id, domain, domain_verification_types, }: {
394
- organization_id: import("../types/email-domain.js").EmailDomain["organization_id"];
395
- domain_verification_types: import("../types/email-domain.js").EmailDomainVerificationType[];
396
- domain: import("../types/email-domain.js").EmailDomain["domain"];
397
- }) => Promise<import("pg").QueryResult<any>>;
398
393
  findEmailDomainsByOrganizationId: (organization_id: number) => Promise<{
399
394
  id: number;
400
395
  organization_id: number;
@@ -536,38 +531,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
536
531
  findPendingByUserId: (user_id: number) => Promise<(import("../types/organization.js").Organization & {
537
532
  moderation_id: number;
538
533
  })[]>;
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
- } & {
566
- is_external: boolean;
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";
568
- verified_at: Date | null;
569
- has_been_greeted: boolean;
570
- })[]>;
571
534
  getById: (id: number) => Promise<import("../types/organization.js").Organization>;
572
535
  upsert: ({ siret, organizationInfo, }: {
573
536
  siret: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"AAsEA,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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ByUserIdFactory, updateAuthenticatorFactory, } from "#src/repositories/authenticator";
3
3
  import { findEmailInDeliverabilityWhiteListFactory } from "#src/repositories/email-deliverability-whitelist";
4
- import { addDomainFactory, deleteEmailDomainsByVerificationTypesFactory, findEmailDomainsByOrganizationIdFactory, } from "#src/repositories/email-domain";
4
+ import { addDomainFactory, findEmailDomainsByOrganizationIdFactory, } from "#src/repositories/email-domain";
5
5
  import { deleteFranceconnectUserinfoFactory, findFranceconnectUserinfoFactory, upsertFranceconnectUserinfoFactory, } from "#src/repositories/franceconnect_userinfo";
6
6
  import { createModerationFactory, deleteModerationFactory, findModerationByIdFactory, findPendingModerationFactory, findRejectedModerationFactory, getModerationByIdFactory, reopenModerationFactory, } from "#src/repositories/moderation";
7
7
  import { deleteOfficialContactEmailVerificationFactory, findOfficialContactEmailVerificationFactory, upsertOfficialContactEmailVerificationFactory, } from "#src/repositories/official-contact-email-verification";
8
8
  import { findByClientIdFactory, upsertAuthorizationRequestFactory, } from "#src/repositories/oidc-client";
9
- import { findBySiretFactory, findByUserIdFactory, findByVerifiedEmailDomainFactory, findOrganizationByIdFactory, findPendingByUserIdFactory, findUsersByOrganizationFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
9
+ import { findBySiretFactory, findByUserIdFactory, findByVerifiedEmailDomainFactory, findOrganizationByIdFactory, findPendingByUserIdFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
10
10
  import { createRecoveryWordsFactory, deleteRecoveryWordsByUserIdFactory, findRecoveryWordsByUserIdFactory, } from "#src/repositories/recovery-words";
11
11
  import { createUserFactory, deleteUserFactory, findByEmailFactory, findByMagicLinkTokenFactory, findByResetPasswordTokenFactory, findByIdFactory as findUserByIdFactory, getByIdFactory, updateUserFactory, } from "#src/repositories/user";
12
12
  import { createUserOrganizationFactory, deleteUserOrganizationFactory, findUserOrganizationFactory, getUserOrganizationFactory, updateUserOrganizationFactory, } from "#src/repositories/user_organisation";
@@ -32,7 +32,6 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
32
32
  },
33
33
  email_domains: {
34
34
  addDomain: addDomainFactory({ pg }),
35
- deleteEmailDomainsByVerificationTypes: deleteEmailDomainsByVerificationTypesFactory({ pg }),
36
35
  findEmailDomainsByOrganizationId: findEmailDomainsByOrganizationIdFactory({ pg }),
37
36
  },
38
37
  moderations: {
@@ -59,7 +58,6 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
59
58
  findByUserId: findByUserIdFactory({ pg }),
60
59
  findByVerifiedEmailDomain: findByVerifiedEmailDomainFactory({ pg }),
61
60
  findPendingByUserId: findPendingByUserIdFactory({ pg }),
62
- findUsers: findUsersByOrganizationFactory({ pg }),
63
61
  getById: getOrganizationByIdFactory({ pg }),
64
62
  upsert: upsertFactory({ pg }),
65
63
  },
@@ -8,6 +8,12 @@ export declare const CertificationDirigeantDataSource: z.ZodEnum<{
8
8
  }>;
9
9
  export type CertificationDirigeantDataSource = z.infer<typeof CertificationDirigeantDataSource>;
10
10
  export declare function getCertificationDirigeantDataSourceLabels(dataSource: CertificationDirigeantDataSource): string;
11
+ export type SourceSelection = {
12
+ kind: "fallback";
13
+ exception: unknown;
14
+ } | {
15
+ kind: "preferred";
16
+ };
11
17
  export declare function processCertificationDirigeantFactory(context: Context): (organization: Organization, franceconnect_userinfo: FranceConnectUserInfo) => Promise<{
12
18
  details: {
13
19
  dirigeant: null;
@@ -21,13 +27,15 @@ export declare function processCertificationDirigeantFactory(context: Context):
21
27
  given_name: string | null;
22
28
  };
23
29
  source: null;
30
+ source_selection: {
31
+ kind: "preferred";
32
+ };
24
33
  };
25
34
  cause: "organisation_not_covered";
26
35
  ok: boolean;
27
36
  } | {
28
37
  details: {
29
38
  dirigeant: undefined;
30
- matches: Set<unknown>;
31
39
  identity: {
32
40
  birthcountry: string | null;
33
41
  birthdate: Date | null;
@@ -36,7 +44,17 @@ export declare function processCertificationDirigeantFactory(context: Context):
36
44
  gender: "male" | "female" | null;
37
45
  given_name: string | null;
38
46
  };
47
+ matches: Set<unknown>;
39
48
  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";
49
+ source_selection: {
50
+ kind: "preferred";
51
+ exception?: undefined;
52
+ } | {
53
+ exception: unknown;
54
+ kind: "fallback";
55
+ } | {
56
+ kind: "preferred";
57
+ };
40
58
  };
41
59
  cause: "no_candidates";
42
60
  ok: boolean;
@@ -60,6 +78,15 @@ export declare function processCertificationDirigeantFactory(context: Context):
60
78
  given_name: string | null;
61
79
  };
62
80
  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";
81
+ source_selection: {
82
+ kind: "preferred";
83
+ exception?: undefined;
84
+ } | {
85
+ exception: unknown;
86
+ kind: "fallback";
87
+ } | {
88
+ kind: "preferred";
89
+ };
63
90
  };
64
91
  cause: "exact_match" | "close_match" | "below_threshold";
65
92
  ok: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"process-certification-dirigeant.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/process-certification-dirigeant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,QAAQ,CAAC;AASvB,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;AAmCD,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,OAAO,IAMjE,cAAc,YAAY,EAC1B,wBAAwB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEhD"}
1
+ {"version":3,"file":"process-certification-dirigeant.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/process-certification-dirigeant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,QAAQ,CAAC;AASvB,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;AAID,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAqC1B,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,OAAO,IAMjE,cAAc,YAAY,EAC1B,wBAAwB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EhD"}
@@ -22,7 +22,6 @@ const CERTIFICATION_DIRIGEANT_DATA_SOURCE_LABELS = {
22
22
  export function getCertificationDirigeantDataSourceLabels(dataSource) {
23
23
  return CERTIFICATION_DIRIGEANT_DATA_SOURCE_LABELS[dataSource];
24
24
  }
25
- //
26
25
  async function getMandatairesSociaux({ client: { api_entreprise, rne } }, siren) {
27
26
  try {
28
27
  const pouvoirs = await rne.findPouvoirsBySiren(siren);
@@ -30,15 +29,19 @@ async function getMandatairesSociaux({ client: { api_entreprise, rne } }, siren)
30
29
  return {
31
30
  dirigeants,
32
31
  source: CertificationDirigeantDataSource.enum["registre-national-entreprises.inpi.fr/api"],
32
+ source_selection: { kind: "preferred" },
33
33
  };
34
34
  }
35
- catch (error) {
36
- console.error(error);
35
+ catch (exception) {
37
36
  const mandataires = await api_entreprise.findMandatairesSociauxBySiren(siren);
38
37
  const dirigeants = mandataires.map(ApiEntreprise.toIdentityVector);
39
38
  return {
40
39
  dirigeants,
41
40
  source: CertificationDirigeantDataSource.enum["entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux"],
41
+ source_selection: {
42
+ exception,
43
+ kind: "fallback",
44
+ },
42
45
  };
43
46
  }
44
47
  }
@@ -52,6 +55,7 @@ export function processCertificationDirigeantFactory(context) {
52
55
  matches: new Set(),
53
56
  identity: NullIdentityVector,
54
57
  source: null,
58
+ source_selection: { kind: "preferred" },
55
59
  },
56
60
  cause: "organisation_not_covered",
57
61
  ok: false,
@@ -63,20 +67,27 @@ export function processCertificationDirigeantFactory(context) {
63
67
  "Entrepreneur individuel"
64
68
  ? CertificationDirigeantDataSource.enum["api.insee.fr/api-sirene/private"]
65
69
  : CertificationDirigeantDataSource.enum["registre-national-entreprises.inpi.fr/api"];
66
- const { dirigeants, source } = await match(preferredDataSource)
70
+ const { dirigeants, source, source_selection } = await match(preferredDataSource)
67
71
  .with("api.insee.fr/api-sirene/private", async () => ({
68
72
  dirigeants: await insee
69
73
  .findBySiren(siren)
70
74
  .then(INSEE.toIdentityVector)
71
75
  .then((vector) => [vector]),
72
76
  source: CertificationDirigeantDataSource.enum["api.insee.fr/api-sirene/private"],
77
+ source_selection: { kind: "preferred" },
73
78
  }))
74
79
  .with("registre-national-entreprises.inpi.fr/api", () => getMandatairesSociaux(context, siren))
75
80
  .exhaustive();
76
81
  const result = match_identity_to_dirigeant(identity, dirigeants);
77
82
  if (result.kind === "no_candidates") {
78
83
  return {
79
- details: { dirigeant: undefined, matches: new Set(), identity, source },
84
+ details: {
85
+ dirigeant: undefined,
86
+ identity,
87
+ matches: new Set(),
88
+ source,
89
+ source_selection,
90
+ },
80
91
  cause: result.kind,
81
92
  ok: false,
82
93
  };
@@ -87,6 +98,7 @@ export function processCertificationDirigeantFactory(context) {
87
98
  matches: result.closest.matches,
88
99
  identity,
89
100
  source,
101
+ source_selection,
90
102
  },
91
103
  cause: result.kind,
92
104
  ok: result.kind === "exact_match",
@@ -1,6 +1,26 @@
1
+ import { InvalidSiretError } from "#src/errors";
1
2
  import { type OrganizationInfo } from "#src/types";
2
3
  import type { ApiEntrepriseClient } from "@proconnect-gouv/proconnect.api_entreprise/api";
3
4
  import type { ApiRegistreNationalEntreprisesClient } from "@proconnect-gouv/proconnect.registre_national_entreprises/api";
4
- export declare function getOrganizationInfoFactory(apiEntrepriseClient: ApiEntrepriseClient, apiRneClient: ApiRegistreNationalEntreprisesClient): (siretOrSiren: string) => Promise<OrganizationInfo>;
5
+ export type RneEnrichment = {
6
+ kind: "enriched";
7
+ } | {
8
+ kind: "failed";
9
+ exception: unknown;
10
+ };
11
+ export type OrganizationInfoLookup = {
12
+ kind: "api_entreprise_failed";
13
+ exception: unknown;
14
+ } | {
15
+ kind: "found";
16
+ organization_info: OrganizationInfo;
17
+ rne: RneEnrichment;
18
+ } | {
19
+ kind: "invalid_siret";
20
+ exception: InvalidSiretError;
21
+ } | {
22
+ kind: "not_diffusible";
23
+ };
24
+ export declare function getOrganizationInfoFactory(apiEntrepriseClient: ApiEntrepriseClient, apiRneClient: ApiRegistreNationalEntreprisesClient): (siretOrSiren: string) => Promise<OrganizationInfoLookup>;
5
25
  export type GetOrganizationInfoHandler = ReturnType<typeof getOrganizationInfoFactory>;
6
26
  //# sourceMappingURL=get-organization-info.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-organization-info.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/get-organization-info.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AAM1H,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,oCAAoC,IAGhD,cAAc,MAAM,KACnB,OAAO,CAAC,gBAAgB,CAAC,CAyD7B;AAED,MAAM,MAAM,0BAA0B,GAAG,UAAU,CACjD,OAAO,0BAA0B,CAClC,CAAC"}
1
+ {"version":3,"file":"get-organization-info.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/get-organization-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AAM1H,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,aAAa,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,SAAS,EAAE,iBAAiB,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAE/B,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,oCAAoC,IAShD,cAAc,MAAM,KACnB,OAAO,CAAC,sBAAsB,CAAC,CAoDnC;AAED,MAAM,MAAM,0BAA0B,GAAG,UAAU,CACjD,OAAO,0BAA0B,CAClC,CAAC"}
@@ -1,53 +1,56 @@
1
1
  //
2
- import { InvalidSiretError, NotFoundError } from "#src/errors";
2
+ import { InvalidSiretError } from "#src/errors";
3
3
  import {} from "#src/types";
4
- import { ApiEntrepriseConnectionError, ApiEntrepriseInvalidSiret, } from "@proconnect-gouv/proconnect.api_entreprise/types";
4
+ import { ApiEntrepriseInvalidSiret, } from "@proconnect-gouv/proconnect.api_entreprise/types";
5
5
  import * as ApiEntreprise from "./adapters/api_entreprise.js";
6
6
  import * as ApiRne from "./adapters/rne.js";
7
- //
8
7
  export function getOrganizationInfoFactory(apiEntrepriseClient, apiRneClient) {
8
+ async function findApiEntrepriseData(siretOrSiren) {
9
+ if (/^\d{14}$/.test(siretOrSiren))
10
+ return apiEntrepriseClient.findBySiret(siretOrSiren);
11
+ return apiEntrepriseClient.findBySiren(siretOrSiren);
12
+ }
9
13
  return async function getOrganizationInfo(siretOrSiren) {
10
- let organizationInfo;
11
- try {
12
- let apiEntrepriseOrganizationInfo;
13
- let apiRneOrganizationInfo;
14
- if (siretOrSiren.match(/^\d{14}$/)) {
15
- apiEntrepriseOrganizationInfo =
16
- ApiEntreprise.toApiEntrepriseOrganizationInfo(await apiEntrepriseClient.findBySiret(siretOrSiren));
17
- }
18
- else if (siretOrSiren.match(/^\d{9}$/)) {
19
- apiEntrepriseOrganizationInfo =
20
- ApiEntreprise.toApiEntrepriseOrganizationInfo(await apiEntrepriseClient.findBySiren(siretOrSiren));
21
- }
22
- else {
23
- throw new InvalidSiretError();
24
- }
25
- const { statutDiffusion } = apiEntrepriseOrganizationInfo;
26
- if (statutDiffusion === "non_diffusible") {
27
- throw new NotFoundError();
28
- }
29
- organizationInfo = {
30
- ...apiEntrepriseOrganizationInfo,
31
- denominationUsuelleEtablissementPrincipal: null,
14
+ if (!/^(\d{9}|\d{14})$/.test(siretOrSiren))
15
+ return {
16
+ exception: new InvalidSiretError("siret or siren must be 9 or 14 digits"),
17
+ kind: "invalid_siret",
32
18
  };
33
- const siren = siretOrSiren.length === 14 ? siretOrSiren.slice(0, 9) : siretOrSiren;
34
- try {
35
- const apiRneData = await apiRneClient.findCompanyBySiren(siren);
36
- apiRneOrganizationInfo = ApiRne.toApiRneOrganizationInfo(apiRneData);
37
- organizationInfo = {
38
- ...organizationInfo,
39
- ...apiRneOrganizationInfo,
19
+ let apiEntrepriseData;
20
+ try {
21
+ apiEntrepriseData = await findApiEntrepriseData(siretOrSiren);
22
+ }
23
+ catch (exception) {
24
+ if (ApiEntrepriseInvalidSiret.isInvalidSiret(exception))
25
+ return {
26
+ exception: new InvalidSiretError("rejected by entreprise.api.gouv.fr", { cause: exception }),
27
+ kind: "invalid_siret",
40
28
  };
41
- }
42
- catch (error) {
43
- console.error(`RNE data will be undefined for this organization (${siren}); an error occurred while fetching it`, error);
44
- }
45
- return organizationInfo;
29
+ return { exception, kind: "api_entreprise_failed" };
46
30
  }
47
- catch (e) {
48
- if (ApiEntrepriseInvalidSiret.isInvalidSiret(e))
49
- throw new InvalidSiretError();
50
- throw new ApiEntrepriseConnectionError("unknown error while fetching entreprise.api.gouv.fr", { cause: e });
31
+ if (apiEntrepriseData.status_diffusion === "non_diffusible")
32
+ return { kind: "not_diffusible" };
33
+ const organizationInfo = {
34
+ ...ApiEntreprise.toApiEntrepriseOrganizationInfo(apiEntrepriseData),
35
+ denominationUsuelleEtablissementPrincipal: null,
36
+ };
37
+ try {
38
+ const apiRneData = await apiRneClient.findCompanyBySiren(siretOrSiren.slice(0, 9));
39
+ return {
40
+ kind: "found",
41
+ organization_info: {
42
+ ...organizationInfo,
43
+ ...ApiRne.toApiRneOrganizationInfo(apiRneData),
44
+ },
45
+ rne: { kind: "enriched" },
46
+ };
47
+ }
48
+ catch (exception) {
49
+ return {
50
+ kind: "found",
51
+ organization_info: organizationInfo,
52
+ rne: { exception, kind: "failed" },
53
+ };
51
54
  }
52
55
  };
53
56
  }
@@ -1,4 +1,3 @@
1
1
  export * from "./adapters/index.js";
2
2
  export * from "./get-organization-info.js";
3
- export * from "./mark-domain-as-verified.js";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
@@ -1,4 +1,3 @@
1
1
  //
2
2
  export * from "./adapters/index.js";
3
3
  export * from "./get-organization-info.js";
4
- export * from "./mark-domain-as-verified.js";
@@ -1,12 +1,9 @@
1
1
  export * from "./add-domain.js";
2
- export * from "./delete-email-domains-by-verification-types.js";
3
2
  export * from "./find-email-domains-by-organization-id.js";
4
3
  import type { AddDomainHandler } from "./add-domain.js";
5
- import type { DeleteEmailDomainsByVerificationTypesHandler } from "./delete-email-domains-by-verification-types.js";
6
4
  import type { FindEmailDomainsByOrganizationIdHandler } from "./find-email-domains-by-organization-id.js";
7
5
  export type EmailDomainRepository = {
8
6
  addDomain: AddDomainHandler;
9
- deleteEmailDomainsByVerificationTypes: DeleteEmailDomainsByVerificationTypesHandler;
10
7
  findEmailDomainsByOrganizationId: FindEmailDomainsByOrganizationIdHandler;
11
8
  };
12
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/email-domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,iDAAiD,CAAC;AACpH,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,4CAA4C,CAAC;AAE1G,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,qCAAqC,EAAE,4CAA4C,CAAC;IACpF,gCAAgC,EAAE,uCAAuC,CAAC;CAC3E,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/email-domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,4CAA4C,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,4CAA4C,CAAC;AAE1G,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,gCAAgC,EAAE,uCAAuC,CAAC;CAC3E,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from "./add-domain.js";
2
- export * from "./delete-email-domains-by-verification-types.js";
3
2
  export * from "./find-email-domains-by-organization-id.js";
@@ -3,7 +3,6 @@ export * from "./find-by-user-id.js";
3
3
  export * from "./find-by-verified-email-domain.js";
4
4
  export * from "./find-organization-by-id.js";
5
5
  export * from "./find-pending-by-user-id.js";
6
- export * from "./find-users-by-organization.js";
7
6
  export * from "./get-organization-by-id.js";
8
7
  export * from "./upsert.js";
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC"}
@@ -4,6 +4,5 @@ export * from "./find-by-user-id.js";
4
4
  export * from "./find-by-verified-email-domain.js";
5
5
  export * from "./find-organization-by-id.js";
6
6
  export * from "./find-pending-by-user-id.js";
7
- export * from "./find-users-by-organization.js";
8
7
  export * from "./get-organization-by-id.js";
9
8
  export * from "./upsert.js";
@@ -0,0 +1,9 @@
1
+ export declare function getMemberIdsPromotedByDomain({ domain, members, }: {
2
+ domain: string;
3
+ members: ReadonlyArray<{
4
+ email: string;
5
+ id: number;
6
+ verification_type: string;
7
+ }>;
8
+ }): number[];
9
+ //# sourceMappingURL=get-member-ids-promoted-by-domain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-member-ids-promoted-by-domain.d.ts","sourceRoot":"","sources":["../../../src/services/organization/get-member-ids-promoted-by-domain.ts"],"names":[],"mappings":"AAOA,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;CACJ,YASA"}
@@ -0,0 +1,11 @@
1
+ //
2
+ import { SuperWeakLinkEnum, UnverifiedLinkEnum } from "#src/types";
3
+ import { getEmailDomain } from "@proconnect-gouv/proconnect.core/services/email";
4
+ //
5
+ export function getMemberIdsPromotedByDomain({ domain, members, }) {
6
+ return members
7
+ .filter(({ email, verification_type }) => getEmailDomain(email) === domain &&
8
+ (UnverifiedLinkEnum.safeParse(verification_type).success ||
9
+ SuperWeakLinkEnum.safeParse(verification_type).success))
10
+ .map(({ id }) => id);
11
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./compute-service-public-info.js";
2
+ export * from "./get-member-ids-promoted-by-domain.js";
2
3
  export * from "./is-domain-allowed-for-organization.js";
3
4
  export * from "./is-entreprise-unipersonnelle.js";
4
5
  export * from "./is-organization-covered-by-certification-dirigeant.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yDAAyD,CAAC;AACxE,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yDAAyD,CAAC;AACxE,cAAc,oCAAoC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  //
2
2
  export * from "./compute-service-public-info.js";
3
+ export * from "./get-member-ids-promoted-by-domain.js";
3
4
  export * from "./is-domain-allowed-for-organization.js";
4
5
  export * from "./is-entreprise-unipersonnelle.js";
5
6
  export * from "./is-organization-covered-by-certification-dirigeant.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proconnect-gouv/proconnect.identite",
3
- "version": "11.0.0",
3
+ "version": "13.0.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": {
@@ -10,7 +10,6 @@ import {
10
10
  import { findEmailInDeliverabilityWhiteListFactory } from "#src/repositories/email-deliverability-whitelist";
11
11
  import {
12
12
  addDomainFactory,
13
- deleteEmailDomainsByVerificationTypesFactory,
14
13
  findEmailDomainsByOrganizationIdFactory,
15
14
  } from "#src/repositories/email-domain";
16
15
  import {
@@ -42,7 +41,6 @@ import {
42
41
  findByVerifiedEmailDomainFactory,
43
42
  findOrganizationByIdFactory,
44
43
  findPendingByUserIdFactory,
45
- findUsersByOrganizationFactory,
46
44
  getOrganizationByIdFactory,
47
45
  upsertFactory,
48
46
  } from "#src/repositories/organization";
@@ -106,8 +104,6 @@ export function createContext({
106
104
  },
107
105
  email_domains: {
108
106
  addDomain: addDomainFactory({ pg }),
109
- deleteEmailDomainsByVerificationTypes:
110
- deleteEmailDomainsByVerificationTypesFactory({ pg }),
111
107
  findEmailDomainsByOrganizationId:
112
108
  findEmailDomainsByOrganizationIdFactory({ pg }),
113
109
  },
@@ -135,7 +131,6 @@ export function createContext({
135
131
  findByUserId: findByUserIdFactory({ pg }),
136
132
  findByVerifiedEmailDomain: findByVerifiedEmailDomainFactory({ pg }),
137
133
  findPendingByUserId: findPendingByUserIdFactory({ pg }),
138
- findUsers: findUsersByOrganizationFactory({ pg }),
139
134
  getById: getOrganizationByIdFactory({ pg }),
140
135
  upsert: upsertFactory({ pg }),
141
136
  },