@proconnect-gouv/proconnect.identite 15.0.0 → 17.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.
- package/CHANGELOG.md +30 -0
- package/dist/connectors/index.d.ts +2 -72
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +5 -14
- package/dist/managers/certification/certification-score.d.ts +16 -0
- package/dist/managers/certification/certification-score.d.ts.map +1 -1
- package/dist/managers/certification/certification-score.js +65 -41
- package/dist/managers/certification/process-certification-dirigeant.d.ts.map +1 -1
- package/dist/managers/organization/get-organization-info.d.ts.map +1 -1
- package/dist/repositories/authenticator/delete-all-authenticators-by-user-id.d.ts +3 -0
- package/dist/repositories/authenticator/delete-all-authenticators-by-user-id.d.ts.map +1 -0
- package/dist/repositories/authenticator/delete-all-authenticators-by-user-id.js +12 -0
- package/dist/repositories/authenticator/index.d.ts +1 -1
- package/dist/repositories/authenticator/index.d.ts.map +1 -1
- package/dist/repositories/authenticator/index.js +1 -1
- package/dist/repositories/moderation/index.d.ts +0 -2
- package/dist/repositories/moderation/index.d.ts.map +1 -1
- package/dist/repositories/moderation/index.js +0 -2
- package/dist/repositories/oidc-client/upsert-authorization-request.d.ts +1 -1
- package/dist/repositories/oidc-client/upsert-authorization-request.d.ts.map +1 -1
- package/dist/repositories/oidc-client/upsert-authorization-request.js +6 -4
- package/dist/repositories/organization/index.d.ts +0 -2
- package/dist/repositories/organization/index.d.ts.map +1 -1
- package/dist/repositories/organization/index.js +0 -2
- package/dist/repositories/user/index.d.ts +0 -1
- package/dist/repositories/user/index.d.ts.map +1 -1
- package/dist/repositories/user/index.js +0 -1
- package/dist/services/organization/get-membership-changes-by-domain-verification.d.ts +18 -0
- package/dist/services/organization/get-membership-changes-by-domain-verification.d.ts.map +1 -0
- package/dist/services/organization/get-membership-changes-by-domain-verification.js +21 -0
- package/dist/services/organization/index.d.ts +1 -1
- package/dist/services/organization/index.d.ts.map +1 -1
- package/dist/services/organization/index.js +1 -1
- package/dist/types/authenticator.d.ts.map +1 -1
- package/dist/types/authorization-request.d.ts +2 -0
- package/dist/types/authorization-request.d.ts.map +1 -1
- package/dist/types/authorization-request.js +4 -1
- package/package.json +2 -2
- package/src/connectors/index.ts +2 -17
- package/src/managers/certification/certification-score.test.ts +64 -1
- package/src/managers/certification/certification-score.ts +84 -50
- package/src/managers/certification/process-certification-dirigeant.ts +1 -2
- package/src/managers/organization/get-organization-info.ts +1 -2
- package/src/repositories/authenticator/delete-all-authenticators-by-user-id.test.ts +51 -0
- package/src/repositories/authenticator/delete-all-authenticators-by-user-id.ts +22 -0
- package/src/repositories/authenticator/index.ts +1 -1
- package/src/repositories/moderation/index.ts +0 -2
- package/src/repositories/oidc-client/upsert-authorization-request.test.ts +18 -5
- package/src/repositories/oidc-client/upsert-authorization-request.ts +6 -3
- package/src/repositories/organization/index.ts +0 -2
- package/src/repositories/user/index.ts +0 -1
- package/src/services/organization/get-membership-changes-by-domain-verification.test.ts +91 -0
- package/src/services/organization/get-membership-changes-by-domain-verification.ts +46 -0
- package/src/services/organization/index.ts +1 -1
- package/src/types/authenticator.ts +1 -7
- package/src/types/authorization-request.ts +5 -1
- package/testing/index.ts +2 -1
- package/dist/repositories/authenticator/update-authenticator.d.ts +0 -3
- package/dist/repositories/authenticator/update-authenticator.d.ts.map +0 -1
- package/dist/repositories/authenticator/update-authenticator.js +0 -13
- package/dist/repositories/email-deliverability-whitelist/find-email-in-deliverability-white-list.d.ts +0 -3
- package/dist/repositories/email-deliverability-whitelist/find-email-in-deliverability-white-list.d.ts.map +0 -1
- package/dist/repositories/email-deliverability-whitelist/find-email-in-deliverability-white-list.js +0 -15
- package/dist/repositories/email-deliverability-whitelist/index.d.ts +0 -2
- package/dist/repositories/email-deliverability-whitelist/index.d.ts.map +0 -1
- package/dist/repositories/email-deliverability-whitelist/index.js +0 -2
- package/dist/repositories/moderation/find-pending-moderation.d.ts +0 -20
- package/dist/repositories/moderation/find-pending-moderation.d.ts.map +0 -1
- package/dist/repositories/moderation/find-pending-moderation.js +0 -16
- package/dist/repositories/moderation/find-rejected-moderation.d.ts +0 -20
- package/dist/repositories/moderation/find-rejected-moderation.d.ts.map +0 -1
- package/dist/repositories/moderation/find-rejected-moderation.js +0 -17
- package/dist/repositories/organization/find-by-siret.d.ts +0 -3
- package/dist/repositories/organization/find-by-siret.d.ts.map +0 -1
- package/dist/repositories/organization/find-by-siret.js +0 -13
- package/dist/repositories/organization/find-pending-by-user-id.d.ts +0 -6
- package/dist/repositories/organization/find-pending-by-user-id.d.ts.map +0 -1
- package/dist/repositories/organization/find-pending-by-user-id.js +0 -18
- package/dist/repositories/user/find-by-reset-password-token.d.ts +0 -29
- package/dist/repositories/user/find-by-reset-password-token.d.ts.map +0 -1
- package/dist/repositories/user/find-by-reset-password-token.js +0 -12
- package/dist/services/organization/get-member-ids-promoted-by-domain.d.ts +0 -9
- package/dist/services/organization/get-member-ids-promoted-by-domain.d.ts.map +0 -1
- package/dist/services/organization/get-member-ids-promoted-by-domain.js +0 -11
- package/src/repositories/authenticator/update-authenticator.test.ts +0 -41
- package/src/repositories/authenticator/update-authenticator.ts +0 -29
- package/src/repositories/email-deliverability-whitelist/find-email-in-deliverability-white-list.test.ts +0 -45
- package/src/repositories/email-deliverability-whitelist/find-email-in-deliverability-white-list.ts +0 -24
- package/src/repositories/email-deliverability-whitelist/index.ts +0 -3
- package/src/repositories/moderation/find-pending-moderation.test.ts +0 -57
- package/src/repositories/moderation/find-pending-moderation.ts +0 -35
- package/src/repositories/moderation/find-rejected-moderation.test.ts +0 -57
- package/src/repositories/moderation/find-rejected-moderation.ts +0 -37
- package/src/repositories/organization/find-by-siret.test.ts +0 -35
- package/src/repositories/organization/find-by-siret.ts +0 -21
- package/src/repositories/organization/find-pending-by-user-id.test.ts +0 -51
- package/src/repositories/organization/find-pending-by-user-id.ts +0 -27
- package/src/repositories/user/find-by-reset-password-token.test.ts +0 -37
- package/src/repositories/user/find-by-reset-password-token.ts +0 -20
- package/src/services/organization/get-member-ids-promoted-by-domain.test.ts +0 -100
- package/src/services/organization/get-member-ids-promoted-by-domain.ts +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.identite
|
|
2
2
|
|
|
3
|
+
## 17.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2414](https://github.com/proconnect-gouv/proconnect-identite/pull/2414) [`1b8f27b`](https://github.com/proconnect-gouv/proconnect-identite/commit/1b8f27b1ebba511ae4fda064460e7f9d38d5fa88) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findEmailInDeliverabilityWhiteListFactory` (`repositories/email-deliverability-whitelist`) et l'entrée `email_deliverability_whitelist` de `connectors` : la vérification de délivrabilité lit maintenant la base en Drizzle depuis l'application.
|
|
8
|
+
|
|
9
|
+
- [#2416](https://github.com/proconnect-gouv/proconnect-identite/pull/2416) [`34cded0`](https://github.com/proconnect-gouv/proconnect-identite/commit/34cded02cb672ca85f29718379f2a7dd54175fc3) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findByResetPasswordTokenFactory` (`repositories/user`) et l'entrée `users.findByResetPasswordToken` de `connectors` : la réinitialisation de mot de passe lit maintenant la base en Drizzle depuis l'application.
|
|
10
|
+
|
|
11
|
+
- [#2419](https://github.com/proconnect-gouv/proconnect-identite/pull/2419) [`d60638e`](https://github.com/proconnect-gouv/proconnect-identite/commit/d60638e523dfd4018aa7b33367001c9181bad961) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findBySiretFactory` (`repositories/organization`) et l'entrée `organizations.findBySiret` de `connectors` : la garde de navigation lit maintenant la base en Drizzle depuis l'application.
|
|
12
|
+
|
|
13
|
+
- [#2420](https://github.com/proconnect-gouv/proconnect-identite/pull/2420) [`3e728cb`](https://github.com/proconnect-gouv/proconnect-identite/commit/3e728cb5acd3254e3fef5665f32ac57dd45e2291) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findPendingByUserIdFactory` (`repositories/organization`) et l'entrée `organizations.findPendingByUserId` de `connectors` : la page des organisations lit maintenant la base en Drizzle depuis l'application.
|
|
14
|
+
|
|
15
|
+
- [#2417](https://github.com/proconnect-gouv/proconnect-identite/pull/2417) [`678828a`](https://github.com/proconnect-gouv/proconnect-identite/commit/678828a72299c2b41f421aa048981c9fd6b73ad3) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findPendingModerationFactory` (`repositories/moderation`) et l'entrée `moderations.findPending` de `connectors` : la décision d'adhésion lit maintenant la base en Drizzle depuis l'application.
|
|
16
|
+
|
|
17
|
+
- [#2418](https://github.com/proconnect-gouv/proconnect-identite/pull/2418) [`8577ae3`](https://github.com/proconnect-gouv/proconnect-identite/commit/8577ae3f1fe900d0a242e04d97755a7b4c96fc7d) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findRejectedModerationFactory` (`repositories/moderation`) et l'entrée `moderations.findRejected` de `connectors` : la décision d'adhésion lit maintenant la base en Drizzle depuis l'application.
|
|
18
|
+
|
|
19
|
+
- [#2535](https://github.com/proconnect-gouv/proconnect-identite/pull/2535) [`83f822e`](https://github.com/proconnect-gouv/proconnect-identite/commit/83f822e5ff3f5b82071491b4baf16e36aab2cf81) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `updateAuthenticatorFactory` (`repositories/authenticator`), exposé aussi par `connectors` (`authenticators.update`). L'application identite met à jour le compteur d'une clé d'accès avec Drizzle.
|
|
20
|
+
|
|
21
|
+
## 16.0.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- [#2453](https://github.com/proconnect-gouv/proconnect-identite/pull/2453) [`918ab32`](https://github.com/proconnect-gouv/proconnect-identite/commit/918ab32555b01df0363e8d531b6c6a4331ef0970) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Remplace `getMemberIdsPromotedByDomain` (`services/organization`) par `getMembershipChangesByDomainVerification({ domain, members, verification_type })`, la règle unique de ce qu'un domaine validé ou refusé fait aux membres de l'organisation dont l'email est sur ce domaine. Pour un type validé, elle renvoie `{ kind: "domain_approved", promoted_members, verification_type }` avec les membres non vérifiés ou `domain_not_verified_yet` ; pour un type refusé, `{ kind: "domain_refused", removed_members, verification_type }` avec tous les membres du domaine, quel que soit leur rattachement.
|
|
26
|
+
|
|
27
|
+
- [#2429](https://github.com/proconnect-gouv/proconnect-identite/pull/2429) [`304e89d`](https://github.com/proconnect-gouv/proconnect-identite/commit/304e89d2169c5a112af5d1465799151ebf9a871a) Thanks [@douglasduteil](https://github.com/douglasduteil)! - AuthorizationRequestOutcomeEnum gagne la valeur signed_out : une ligne de users_oidc_clients avec outcome = 'signed_out' enregistre une déconnexion demandée par un service ; un match exhaustif sur l'enum doit traiter ce cas. Ajout de la colonne sid à users_oidc_clients (identifiant de session oidc-provider propre au service) : BaseAuthorizationRequest gagne sid obligatoire, et upsertAuthorizationRequest le conserve quand une écriture suivante de la même interaction n'en a pas
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- [#2445](https://github.com/proconnect-gouv/proconnect-identite/pull/2445) [`efdd64d`](https://github.com/proconnect-gouv/proconnect-identite/commit/efdd64d8c342b586c76ac4e6717323d4486bf16d) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Le runtime ajoute `certificationDirigeantActivities` (schémas zod des actions `certification_dirigeant.certified`, `.close_matched`, `.not_matched` et `.not_covered`) et `getCertificationDirigeantActivity`, qui transforme le résultat de `processCertificationDirigeant` en l'une de ces actions. `outcome` porte le registre consulté, la raison d'un échec et, pour une correspondance partielle seulement, `diff` : pour chaque critère discordant, la valeur FranceConnect et celle du registre, telles que reçues (`raw`) et telles que comparées (`compared`). Ces schémas ne font pas encore partie de `activityContextSchemas` : l'application qui les écrit les passe à `createIdentiteRuntime` comme ses propres actions, et un lecteur du journal les ajoute à ses schémas. identite exporte `compareCriteria`, d'où `certificationScore` tire désormais ses critères concordants.
|
|
32
|
+
|
|
3
33
|
## 15.0.0
|
|
4
34
|
|
|
5
35
|
### Major Changes
|
|
@@ -368,12 +368,9 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
368
368
|
authenticator: import("../types/authenticator.js").BaseAuthenticator;
|
|
369
369
|
}) => Promise<import("../types/authenticator.js").Authenticator>;
|
|
370
370
|
delete: (user_id: number, credential_id: string) => Promise<boolean>;
|
|
371
|
+
deleteAllByUserId: (user_id: number) => Promise<boolean>;
|
|
371
372
|
find: (user_id: number, serialized_credential_id: string) => Promise<import("../types/authenticator.js").Authenticator | undefined>;
|
|
372
373
|
findByUserId: (user_id: number) => Promise<import("../types/authenticator.js").Authenticator[]>;
|
|
373
|
-
update: (credential_id: import("../types/authenticator.js").Base64URLString, { counter, last_used_at, usage_count }: Partial<import("../types/authenticator.js").BaseAuthenticator>) => Promise<import("../types/authenticator.js").Authenticator>;
|
|
374
|
-
};
|
|
375
|
-
email_deliverability_whitelist: {
|
|
376
|
-
findEmailInDeliverabilityWhiteList: (email: string) => Promise<{} | undefined>;
|
|
377
374
|
};
|
|
378
375
|
email_domains: {
|
|
379
376
|
addDomain: ({ organization_id, domain, verification_type, }: {
|
|
@@ -417,42 +414,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
417
414
|
end_user_reason: string;
|
|
418
415
|
allow_editing: boolean;
|
|
419
416
|
} | undefined>;
|
|
420
|
-
findPending: ({ user_id, organization_id, type, }: {
|
|
421
|
-
user_id: number;
|
|
422
|
-
organization_id: number;
|
|
423
|
-
type: import("../types/moderation.js").ModerationType;
|
|
424
|
-
}) => Promise<{
|
|
425
|
-
id: number;
|
|
426
|
-
user_id: number;
|
|
427
|
-
organization_id: number;
|
|
428
|
-
ticket_id: string | null;
|
|
429
|
-
type: "non_verified_domain" | "organization_join_block";
|
|
430
|
-
created_at: Date;
|
|
431
|
-
moderated_at: Date | null;
|
|
432
|
-
comment: string | null;
|
|
433
|
-
moderated_by: string | null;
|
|
434
|
-
status: "accepted" | "pending" | "rejected" | "reopened" | "unknown";
|
|
435
|
-
end_user_reason: string;
|
|
436
|
-
allow_editing: boolean;
|
|
437
|
-
} | undefined>;
|
|
438
|
-
findRejected: ({ user_id, organization_id, type, }: {
|
|
439
|
-
user_id: number;
|
|
440
|
-
organization_id: number;
|
|
441
|
-
type: import("../types/moderation.js").ModerationType;
|
|
442
|
-
}) => Promise<{
|
|
443
|
-
id: number;
|
|
444
|
-
user_id: number;
|
|
445
|
-
organization_id: number;
|
|
446
|
-
ticket_id: string | null;
|
|
447
|
-
type: "non_verified_domain" | "organization_join_block";
|
|
448
|
-
created_at: Date;
|
|
449
|
-
moderated_at: Date | null;
|
|
450
|
-
comment: string | null;
|
|
451
|
-
moderated_by: string | null;
|
|
452
|
-
status: "accepted" | "pending" | "rejected" | "reopened" | "unknown";
|
|
453
|
-
end_user_reason: string;
|
|
454
|
-
allow_editing: boolean;
|
|
455
|
-
} | undefined>;
|
|
456
417
|
getById: (id: number) => Promise<import("../types/moderation.js").Moderation>;
|
|
457
418
|
reopen: ({ id, userEmail, cause, }: {
|
|
458
419
|
id: number;
|
|
@@ -494,19 +455,15 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
494
455
|
};
|
|
495
456
|
oidc_clients: {
|
|
496
457
|
findByClientId: (client_id: string) => Promise<import("../types/oidc-client.js").OidcClient | undefined>;
|
|
497
|
-
upsertAuthorizationRequest: ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, }: import("../types/authorization-request.js").BaseAuthorizationRequest) => Promise<import("../types/authorization-request.js").AuthorizationRequest>;
|
|
458
|
+
upsertAuthorizationRequest: ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, sid, }: import("../types/authorization-request.js").BaseAuthorizationRequest) => Promise<import("../types/authorization-request.js").AuthorizationRequest>;
|
|
498
459
|
};
|
|
499
460
|
organizations: {
|
|
500
461
|
findById: (id: number) => Promise<import("../types/organization.js").Organization | undefined>;
|
|
501
|
-
findBySiret: (siret: string) => Promise<import("../types/organization.js").Organization | undefined>;
|
|
502
462
|
findByUserId: (userId: number) => Promise<(import("../types/organization.js").Organization & {
|
|
503
463
|
is_external: boolean;
|
|
504
464
|
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";
|
|
505
465
|
verified_at: Date | null;
|
|
506
466
|
})[]>;
|
|
507
|
-
findPendingByUserId: (user_id: number) => Promise<(import("../types/organization.js").Organization & {
|
|
508
|
-
moderation_id: number;
|
|
509
|
-
})[]>;
|
|
510
467
|
getById: (id: number) => Promise<import("../types/organization.js").Organization>;
|
|
511
468
|
upsert: ({ siret, organizationInfo, }: {
|
|
512
469
|
siret: string;
|
|
@@ -653,33 +610,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
653
610
|
verify_email_sent_at: Date | null;
|
|
654
611
|
verify_email_token: string | null;
|
|
655
612
|
} | undefined>;
|
|
656
|
-
findByResetPasswordToken: (reset_password_token: string) => Promise<{
|
|
657
|
-
created_at: Date;
|
|
658
|
-
current_challenge: string | null;
|
|
659
|
-
email: string;
|
|
660
|
-
email_verified: boolean;
|
|
661
|
-
email_verified_at: Date | null;
|
|
662
|
-
encrypted_password: string | null;
|
|
663
|
-
encrypted_totp_key: string | null;
|
|
664
|
-
family_name: string | null;
|
|
665
|
-
force_2fa: boolean;
|
|
666
|
-
given_name: string | null;
|
|
667
|
-
id: number;
|
|
668
|
-
job: string | null;
|
|
669
|
-
last_sign_in_at: Date | null;
|
|
670
|
-
magic_link_sent_at: Date | null;
|
|
671
|
-
magic_link_token: string | null;
|
|
672
|
-
needs_inclusionconnect_onboarding_help: boolean;
|
|
673
|
-
needs_inclusionconnect_welcome_page: boolean;
|
|
674
|
-
phone_number: string | null;
|
|
675
|
-
reset_password_sent_at: Date | null;
|
|
676
|
-
reset_password_token: string | null;
|
|
677
|
-
sign_in_count: number;
|
|
678
|
-
totp_key_verified_at: Date | null;
|
|
679
|
-
updated_at: Date;
|
|
680
|
-
verify_email_sent_at: Date | null;
|
|
681
|
-
verify_email_token: string | null;
|
|
682
|
-
} | undefined>;
|
|
683
613
|
getById: (id: number) => Promise<{
|
|
684
614
|
created_at: Date;
|
|
685
615
|
current_challenge: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"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"}
|
package/dist/connectors/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
//
|
|
2
|
-
import { createAuthenticatorFactory, deleteAuthenticatorFactory, findAuthenticatorFactory, findAuthenticatorsByUserIdFactory,
|
|
3
|
-
import { findEmailInDeliverabilityWhiteListFactory } from "#src/repositories/email-deliverability-whitelist";
|
|
2
|
+
import { createAuthenticatorFactory, deleteAllAuthenticatorsByUserIdFactory, deleteAuthenticatorFactory, findAuthenticatorFactory, findAuthenticatorsByUserIdFactory, } from "#src/repositories/authenticator";
|
|
4
3
|
import { addDomainFactory, findEmailDomainsByOrganizationIdFactory, } from "#src/repositories/email-domain";
|
|
5
4
|
import { findFranceconnectUserinfoFactory } from "#src/repositories/franceconnect_userinfo";
|
|
6
|
-
import { deleteModerationFactory, findModerationByIdFactory,
|
|
5
|
+
import { deleteModerationFactory, findModerationByIdFactory, getModerationByIdFactory, reopenModerationFactory, } from "#src/repositories/moderation";
|
|
7
6
|
import { deleteOfficialContactEmailVerificationFactory, findOfficialContactEmailVerificationFactory, upsertOfficialContactEmailVerificationFactory, } from "#src/repositories/official-contact-email-verification";
|
|
8
7
|
import { findByClientIdFactory, upsertAuthorizationRequestFactory, } from "#src/repositories/oidc-client";
|
|
9
|
-
import {
|
|
8
|
+
import { findByUserIdFactory, findOrganizationByIdFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
|
|
10
9
|
import { createRecoveryWordsFactory, deleteRecoveryWordsByUserIdFactory, findRecoveryWordsByUserIdFactory, } from "#src/repositories/recovery-words";
|
|
11
|
-
import { createUserFactory, findByEmailFactory, findByMagicLinkTokenFactory,
|
|
10
|
+
import { createUserFactory, findByEmailFactory, findByMagicLinkTokenFactory, findByIdFactory as findUserByIdFactory, getByIdFactory, updateUserFactory, } from "#src/repositories/user";
|
|
12
11
|
import { findUserOrganizationFactory, getUserOrganizationFactory, } from "#src/repositories/user_organisation";
|
|
13
12
|
import {} from "pg";
|
|
14
13
|
//
|
|
@@ -23,12 +22,9 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
23
22
|
authenticators: {
|
|
24
23
|
create: createAuthenticatorFactory({ pg }),
|
|
25
24
|
delete: deleteAuthenticatorFactory({ pg }),
|
|
25
|
+
deleteAllByUserId: deleteAllAuthenticatorsByUserIdFactory({ pg }),
|
|
26
26
|
find: findAuthenticatorFactory({ pg }),
|
|
27
27
|
findByUserId: findAuthenticatorsByUserIdFactory({ pg }),
|
|
28
|
-
update: updateAuthenticatorFactory({ pg }),
|
|
29
|
-
},
|
|
30
|
-
email_deliverability_whitelist: {
|
|
31
|
-
findEmailInDeliverabilityWhiteList: findEmailInDeliverabilityWhiteListFactory({ pg }),
|
|
32
28
|
},
|
|
33
29
|
email_domains: {
|
|
34
30
|
addDomain: addDomainFactory({ pg }),
|
|
@@ -37,8 +33,6 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
37
33
|
moderations: {
|
|
38
34
|
delete: deleteModerationFactory({ pg }),
|
|
39
35
|
findById: findModerationByIdFactory({ pg }),
|
|
40
|
-
findPending: findPendingModerationFactory({ pg }),
|
|
41
|
-
findRejected: findRejectedModerationFactory({ pg }),
|
|
42
36
|
getById: getModerationByIdFactory({ pg }),
|
|
43
37
|
reopen: reopenModerationFactory({ pg }),
|
|
44
38
|
},
|
|
@@ -53,9 +47,7 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
53
47
|
},
|
|
54
48
|
organizations: {
|
|
55
49
|
findById: findOrganizationByIdFactory({ pg }),
|
|
56
|
-
findBySiret: findBySiretFactory({ pg }),
|
|
57
50
|
findByUserId: findByUserIdFactory({ pg }),
|
|
58
|
-
findPendingByUserId: findPendingByUserIdFactory({ pg }),
|
|
59
51
|
getById: getOrganizationByIdFactory({ pg }),
|
|
60
52
|
upsert: upsertFactory({ pg }),
|
|
61
53
|
},
|
|
@@ -73,7 +65,6 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
73
65
|
findByEmail: findByEmailFactory({ pg }),
|
|
74
66
|
findById: findUserByIdFactory({ pg }),
|
|
75
67
|
findByMagicLinkToken: findByMagicLinkTokenFactory({ pg }),
|
|
76
|
-
findByResetPasswordToken: findByResetPasswordTokenFactory({ pg }),
|
|
77
68
|
getById: getByIdFactory({ pg }),
|
|
78
69
|
update: updateUserFactory({ pg }),
|
|
79
70
|
},
|
|
@@ -29,4 +29,20 @@ export type MatchCriteria = z.output<typeof MatchCriteria>;
|
|
|
29
29
|
* @returns Score from 0 to 5
|
|
30
30
|
*/
|
|
31
31
|
export declare function certificationScore(identitePivot: IdentityVector, sourceDirigeant: IdentityVector): Set<"family_name" | "gender" | "birth_country" | "birth_date" | "birth_place" | "first_name">;
|
|
32
|
+
/**
|
|
33
|
+
* Compares each evaluated criterion and keeps, for both sides, the value as
|
|
34
|
+
* received (`raw`) and the value actually compared (`compared`).
|
|
35
|
+
*/
|
|
36
|
+
export declare function compareCriteria(identitePivot: IdentityVector, sourceDirigeant: IdentityVector): {
|
|
37
|
+
criterion: "family_name" | "gender" | "birth_country" | "birth_date" | "birth_place" | "first_name";
|
|
38
|
+
franceconnect: {
|
|
39
|
+
compared: string | null;
|
|
40
|
+
raw: string | null;
|
|
41
|
+
};
|
|
42
|
+
matched: boolean;
|
|
43
|
+
source: {
|
|
44
|
+
compared: string | null;
|
|
45
|
+
raw: string | null;
|
|
46
|
+
};
|
|
47
|
+
}[];
|
|
32
48
|
//# 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;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,
|
|
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,iGAOhC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,cAAc,EAC7B,eAAe,EAAE,cAAc;;;;;;;;;;;IA0DhC"}
|
|
@@ -31,51 +31,75 @@ export const MatchCriteria = z.enum([
|
|
|
31
31
|
* @returns Score from 0 to 5
|
|
32
32
|
*/
|
|
33
33
|
export function certificationScore(identitePivot, sourceDirigeant) {
|
|
34
|
-
|
|
34
|
+
return new Set(compareCriteria(identitePivot, sourceDirigeant)
|
|
35
|
+
.filter(({ matched }) => matched)
|
|
36
|
+
.map(({ criterion }) => criterion));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Compares each evaluated criterion and keeps, for both sides, the value as
|
|
40
|
+
* received (`raw`) and the value actually compared (`compared`).
|
|
41
|
+
*/
|
|
42
|
+
export function compareCriteria(identitePivot, sourceDirigeant) {
|
|
35
43
|
// 1. Family name match (after normalization)
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
44
|
+
const family_name = compare({
|
|
45
|
+
criterion: MatchCriteria.enum.family_name,
|
|
46
|
+
franceconnect: identitePivot.family_name,
|
|
47
|
+
match: bothPresentAndEqual,
|
|
48
|
+
normalize: normalizeText,
|
|
49
|
+
source: sourceDirigeant.family_name,
|
|
50
|
+
});
|
|
43
51
|
// 2. First name match (first name only, after normalization)
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
const first_name = compare({
|
|
53
|
+
criterion: MatchCriteria.enum.first_name,
|
|
54
|
+
franceconnect: identitePivot.given_name,
|
|
55
|
+
match: bothPresentAndEqual,
|
|
56
|
+
normalize: extractFirstName,
|
|
57
|
+
source: sourceDirigeant.given_name,
|
|
58
|
+
});
|
|
49
59
|
// 3. Gender match (match or absent in source)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
const gender = compare({
|
|
61
|
+
criterion: MatchCriteria.enum.gender,
|
|
62
|
+
franceconnect: identitePivot.gender,
|
|
63
|
+
match: (pivot, source) => !source || pivot === source,
|
|
64
|
+
source: sourceDirigeant.gender,
|
|
65
|
+
});
|
|
54
66
|
// 4. Birth date match (exact match)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
identitePivot.birthdate
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
const birth_date = compare({
|
|
68
|
+
criterion: MatchCriteria.enum.birth_date,
|
|
69
|
+
franceconnect: identitePivot.birthdate?.toISOString() ?? null,
|
|
70
|
+
match: bothPresentAndEqual,
|
|
71
|
+
source: sourceDirigeant.birthdate?.toISOString() ?? null,
|
|
72
|
+
});
|
|
60
73
|
// 5. Birth place match (different logic for French vs foreigners)
|
|
61
74
|
const isFrench = !identitePivot.birthcountry || identitePivot.birthcountry === "99100";
|
|
62
|
-
|
|
63
|
-
// For French:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const birth = isFrench
|
|
76
|
+
? // For French: commune code (with conversion), match if source has none
|
|
77
|
+
compare({
|
|
78
|
+
criterion: MatchCriteria.enum.birth_place,
|
|
79
|
+
franceconnect: identitePivot.birthplace,
|
|
80
|
+
match: (pivot, source) => !source || (!!pivot && pivot === source),
|
|
81
|
+
normalize: convertCommuneCode,
|
|
82
|
+
source: sourceDirigeant.birthplace,
|
|
83
|
+
})
|
|
84
|
+
: // For foreigners: country code (COG 99XXX), match if either side has none
|
|
85
|
+
compare({
|
|
86
|
+
criterion: MatchCriteria.enum.birth_country,
|
|
87
|
+
franceconnect: identitePivot.birthcountry,
|
|
88
|
+
match: (pivot, source) => pivot === null || source === null || pivot === source,
|
|
89
|
+
source: sourceDirigeant.birthcountry,
|
|
90
|
+
});
|
|
91
|
+
return [family_name, first_name, gender, birth_date, birth];
|
|
92
|
+
}
|
|
93
|
+
function bothPresentAndEqual(pivot, source) {
|
|
94
|
+
return !!pivot && !!source && pivot === source;
|
|
95
|
+
}
|
|
96
|
+
function compare({ criterion, franceconnect, match, normalize = (value) => value, source, }) {
|
|
97
|
+
const compared_franceconnect = normalize(franceconnect);
|
|
98
|
+
const compared_source = normalize(source);
|
|
99
|
+
return {
|
|
100
|
+
criterion,
|
|
101
|
+
franceconnect: { compared: compared_franceconnect, raw: franceconnect },
|
|
102
|
+
matched: match(compared_franceconnect, compared_source),
|
|
103
|
+
source: { compared: compared_source, raw: source },
|
|
104
|
+
};
|
|
81
105
|
}
|
|
@@ -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;AAID,MAAM,MAAM,eAAe,
|
|
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,GACzB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAqCnE,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,OAAO,IAMjE,cAAc,YAAY,EAC1B,wBAAwB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EhD"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GACvB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhE,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-all-authenticators-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/delete-all-authenticators-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,wBAAgB,sCAAsC,CAAC,EACrD,EAAE,GACH,EAAE,eAAe,IACsC,SAAS,MAAM,sBAWtE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
import {} from "pg";
|
|
3
|
+
//
|
|
4
|
+
export function deleteAllAuthenticatorsByUserIdFactory({ pg, }) {
|
|
5
|
+
return async function deleteAllAuthenticatorsByUserId(user_id) {
|
|
6
|
+
const { rowCount, affectedRows } = (await pg.query(`
|
|
7
|
+
DELETE FROM authenticators
|
|
8
|
+
WHERE user_id = $1
|
|
9
|
+
RETURNING *`, [user_id]));
|
|
10
|
+
return (affectedRows ?? rowCount ?? 0) > 0;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./create-authenticator.js";
|
|
2
|
+
export * from "./delete-all-authenticators-by-user-id.js";
|
|
2
3
|
export * from "./delete-authenticator.js";
|
|
3
4
|
export * from "./find-authenticator.js";
|
|
4
5
|
export * from "./find-authenticators-by-user-id.js";
|
|
5
|
-
export * from "./update-authenticator.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
export * from "./create-authenticator.js";
|
|
3
|
+
export * from "./delete-all-authenticators-by-user-id.js";
|
|
3
4
|
export * from "./delete-authenticator.js";
|
|
4
5
|
export * from "./find-authenticator.js";
|
|
5
6
|
export * from "./find-authenticators-by-user-id.js";
|
|
6
|
-
export * from "./update-authenticator.js";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from "./delete-moderation.js";
|
|
2
2
|
export * from "./find-moderation-by-id.js";
|
|
3
|
-
export * from "./find-pending-moderation.js";
|
|
4
|
-
export * from "./find-rejected-moderation.js";
|
|
5
3
|
export * from "./get-moderation-by-id.js";
|
|
6
4
|
export * from "./reopen-moderation.js";
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/moderation/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/moderation/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
//
|
|
2
2
|
export * from "./delete-moderation.js";
|
|
3
3
|
export * from "./find-moderation-by-id.js";
|
|
4
|
-
export * from "./find-pending-moderation.js";
|
|
5
|
-
export * from "./find-rejected-moderation.js";
|
|
6
4
|
export * from "./get-moderation-by-id.js";
|
|
7
5
|
export * from "./reopen-moderation.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AuthorizationRequest, BaseAuthorizationRequest, DatabaseContext } from "#src/types";
|
|
2
|
-
export declare function upsertAuthorizationRequestFactory({ pg }: DatabaseContext): ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, }: BaseAuthorizationRequest) => Promise<AuthorizationRequest>;
|
|
2
|
+
export declare function upsertAuthorizationRequestFactory({ pg }: DatabaseContext): ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, sid, }: BaseAuthorizationRequest) => Promise<AuthorizationRequest>;
|
|
3
3
|
//# sourceMappingURL=upsert-authorization-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert-authorization-request.d.ts","sourceRoot":"","sources":["../../../src/repositories/oidc-client/upsert-authorization-request.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EAChB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,
|
|
1
|
+
{"version":3,"file":"upsert-authorization-request.d.ts","sourceRoot":"","sources":["../../../src/repositories/oidc-client/upsert-authorization-request.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EAChB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,wGAS9C,wBAAwB,mCA+B5B"}
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
import {} from "pg";
|
|
3
3
|
//
|
|
4
4
|
export function upsertAuthorizationRequestFactory({ pg }) {
|
|
5
|
-
return async function upsertAuthorizationRequest({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, }) {
|
|
5
|
+
return async function upsertAuthorizationRequest({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, sid, }) {
|
|
6
6
|
const { rows } = await pg.query(`
|
|
7
7
|
INSERT INTO users_oidc_clients
|
|
8
|
-
(user_id, oidc_client_id, organization_id, sp_name, user_ip_address, created_at, updated_at, interaction_cid, outcome)
|
|
9
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
|
8
|
+
(user_id, oidc_client_id, organization_id, sp_name, user_ip_address, created_at, updated_at, interaction_cid, outcome, sid)
|
|
9
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
10
10
|
ON CONFLICT (interaction_cid) WHERE interaction_cid IS NOT NULL
|
|
11
11
|
DO UPDATE SET
|
|
12
12
|
organization_id = EXCLUDED.organization_id,
|
|
13
13
|
outcome = EXCLUDED.outcome,
|
|
14
|
+
sid = COALESCE(EXCLUDED.sid, users_oidc_clients.sid),
|
|
14
15
|
updated_at = EXCLUDED.updated_at,
|
|
15
16
|
user_id = EXCLUDED.user_id
|
|
16
|
-
RETURNING user_id, oidc_client_id, organization_id, sp_name, user_ip_address, created_at, updated_at, id, interaction_cid, outcome;
|
|
17
|
+
RETURNING user_id, oidc_client_id, organization_id, sp_name, user_ip_address, created_at, updated_at, id, interaction_cid, outcome, sid;
|
|
17
18
|
`, [
|
|
18
19
|
user_id,
|
|
19
20
|
oidc_client_id,
|
|
@@ -24,6 +25,7 @@ RETURNING user_id, oidc_client_id, organization_id, sp_name, user_ip_address, cr
|
|
|
24
25
|
new Date(),
|
|
25
26
|
interaction_cid,
|
|
26
27
|
outcome,
|
|
28
|
+
sid,
|
|
27
29
|
]);
|
|
28
30
|
return rows.shift();
|
|
29
31
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export * from "./find-by-siret.js";
|
|
2
1
|
export * from "./find-by-user-id.js";
|
|
3
2
|
export * from "./find-organization-by-id.js";
|
|
4
|
-
export * from "./find-pending-by-user-id.js";
|
|
5
3
|
export * from "./get-organization-by-id.js";
|
|
6
4
|
export * from "./upsert.js";
|
|
7
5
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC"}
|
|
@@ -2,7 +2,6 @@ export * from "./create.js";
|
|
|
2
2
|
export * from "./find-by-email.js";
|
|
3
3
|
export * from "./find-by-id.js";
|
|
4
4
|
export * from "./find-by-magic-link-token.js";
|
|
5
|
-
export * from "./find-by-reset-password-token.js";
|
|
6
5
|
export * from "./get-by-id.js";
|
|
7
6
|
export * from "./update.js";
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/user/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type EmailDomainNoPendingVerificationType } from "#src/types";
|
|
2
|
+
export declare function getMembershipChangesByDomainVerification<Member extends {
|
|
3
|
+
email: string;
|
|
4
|
+
verification_type: string;
|
|
5
|
+
}>({ domain, members, verification_type, }: {
|
|
6
|
+
domain: string;
|
|
7
|
+
members: ReadonlyArray<Member>;
|
|
8
|
+
verification_type: EmailDomainNoPendingVerificationType;
|
|
9
|
+
}): {
|
|
10
|
+
kind: "domain_approved";
|
|
11
|
+
promoted_members: Member[];
|
|
12
|
+
verification_type: "official_contact" | "trackdechets_postal_mail" | "verified" | "external";
|
|
13
|
+
} | {
|
|
14
|
+
kind: "domain_refused";
|
|
15
|
+
removed_members: Member[];
|
|
16
|
+
verification_type: "blacklisted" | "refused";
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=get-membership-changes-by-domain-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-membership-changes-by-domain-verification.d.ts","sourceRoot":"","sources":["../../../src/services/organization/get-membership-changes-by-domain-verification.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,oCAAoC,EAC1C,MAAM,YAAY,CAAC;AAMpB,wBAAgB,wCAAwC,CACtD,MAAM,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,EAC3D,EACA,MAAM,EACN,OAAO,EACP,iBAAiB,GAClB,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,iBAAiB,EAAE,oCAAoC,CAAC;CACzD;;;;;;;;EAqBA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
import { EmailDomainApprovedVerificationValues, EmailDomainRejectedVerificationValues, SuperWeakLinkEnum, UnverifiedLinkEnum, } from "#src/types";
|
|
3
|
+
import { getEmailDomain } from "@proconnect-gouv/proconnect.core/services/email";
|
|
4
|
+
import { match } from "ts-pattern";
|
|
5
|
+
//
|
|
6
|
+
export function getMembershipChangesByDomainVerification({ domain, members, verification_type, }) {
|
|
7
|
+
const domain_members = members.filter(({ email }) => getEmailDomain(email) === domain);
|
|
8
|
+
return match(verification_type)
|
|
9
|
+
.with(...EmailDomainApprovedVerificationValues, (verification_type) => ({
|
|
10
|
+
kind: "domain_approved",
|
|
11
|
+
promoted_members: domain_members.filter(({ verification_type }) => UnverifiedLinkEnum.safeParse(verification_type).success ||
|
|
12
|
+
SuperWeakLinkEnum.safeParse(verification_type).success),
|
|
13
|
+
verification_type,
|
|
14
|
+
}))
|
|
15
|
+
.with(...EmailDomainRejectedVerificationValues, (verification_type) => ({
|
|
16
|
+
kind: "domain_refused",
|
|
17
|
+
removed_members: domain_members,
|
|
18
|
+
verification_type,
|
|
19
|
+
}))
|
|
20
|
+
.exhaustive();
|
|
21
|
+
}
|