@proconnect-gouv/proconnect.identite 14.0.0 → 16.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 +20 -0
- package/dist/connectors/index.d.ts +2 -7
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +3 -3
- 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/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 -0
- package/dist/repositories/authenticator/index.d.ts.map +1 -1
- package/dist/repositories/authenticator/index.js +1 -0
- 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/find-by-user-id.d.ts +0 -1
- package/dist/repositories/organization/find-by-user-id.d.ts.map +1 -1
- package/dist/repositories/organization/find-by-user-id.js +1 -2
- package/dist/repositories/organization/index.d.ts +0 -1
- package/dist/repositories/organization/index.d.ts.map +1 -1
- package/dist/repositories/organization/index.js +0 -1
- package/dist/repositories/user_organisation/find-user-organization.d.ts +0 -1
- package/dist/repositories/user_organisation/find-user-organization.d.ts.map +1 -1
- package/dist/repositories/user_organisation/find-user-organization.js +1 -2
- package/dist/repositories/user_organisation/get-user-organization.d.ts +0 -1
- package/dist/repositories/user_organisation/get-user-organization.d.ts.map +1 -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/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/dist/types/user-organization-link.d.ts +0 -2
- package/dist/types/user-organization-link.d.ts.map +1 -1
- package/dist/types/user-organization-link.js +0 -1
- package/package.json +1 -1
- package/src/connectors/index.ts +2 -2
- package/src/managers/certification/certification-score.test.ts +64 -1
- package/src/managers/certification/certification-score.ts +84 -50
- 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 -0
- 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/find-by-user-id.test.ts +5 -5
- package/src/repositories/organization/find-by-user-id.test.ts.snapshot +3 -6
- package/src/repositories/organization/find-by-user-id.ts +1 -2
- package/src/repositories/organization/index.ts +0 -1
- package/src/repositories/user_organisation/find-user-organization.ts +1 -2
- package/src/repositories/user_organisation/get-user-organization.test.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/authorization-request.ts +5 -1
- package/src/types/user-organization-link.ts +0 -1
- package/dist/repositories/organization/find-by-verified-email-domain.d.ts +0 -6
- package/dist/repositories/organization/find-by-verified-email-domain.d.ts.map +0 -1
- package/dist/repositories/organization/find-by-verified-email-domain.js +0 -21
- 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/organization/find-by-verified-email-domain.test.ts +0 -46
- package/src/repositories/organization/find-by-verified-email-domain.ts +0 -33
- 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,25 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.identite
|
|
2
2
|
|
|
3
|
+
## 16.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
- [#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
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#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.
|
|
14
|
+
|
|
15
|
+
## 15.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- [#2396](https://github.com/proconnect-gouv/proconnect-identite/pull/2396) [`33604f3`](https://github.com/proconnect-gouv/proconnect-identite/commit/33604f32fb4393ec60e413f0b7bace8e94ac22fc) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire `findByVerifiedEmailDomainFactory` (`repositories/organization`) et l'entrée `organizations.findByVerifiedEmailDomain` de `connectors` : les suggestions d'organisation lisent maintenant la base en Drizzle depuis l'application.
|
|
20
|
+
|
|
21
|
+
- [#2394](https://github.com/proconnect-gouv/proconnect-identite/pull/2394) [`c1167a1`](https://github.com/proconnect-gouv/proconnect-identite/commit/c1167a150b16060ca704059e98040414bbf7a009) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Retire le champ `has_been_greeted` de `BaseUserOrganizationLink` et des requêtes de `repositories/organization` et `repositories/user_organisation` : la colonne n'existe plus.
|
|
22
|
+
|
|
3
23
|
## 14.0.0
|
|
4
24
|
|
|
5
25
|
### Major Changes
|
|
@@ -368,6 +368,7 @@ 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
374
|
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>;
|
|
@@ -494,7 +495,7 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
494
495
|
};
|
|
495
496
|
oidc_clients: {
|
|
496
497
|
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>;
|
|
498
|
+
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
499
|
};
|
|
499
500
|
organizations: {
|
|
500
501
|
findById: (id: number) => Promise<import("../types/organization.js").Organization | undefined>;
|
|
@@ -503,10 +504,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
503
504
|
is_external: boolean;
|
|
504
505
|
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
506
|
verified_at: Date | null;
|
|
506
|
-
has_been_greeted: boolean;
|
|
507
|
-
})[]>;
|
|
508
|
-
findByVerifiedEmailDomain: (email_domain: string) => Promise<(import("../types/organization.js").Organization & {
|
|
509
|
-
member_count: number;
|
|
510
507
|
})[]>;
|
|
511
508
|
findPendingByUserId: (user_id: number) => Promise<(import("../types/organization.js").Organization & {
|
|
512
509
|
moderation_id: number;
|
|
@@ -530,7 +527,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
530
527
|
is_external: boolean;
|
|
531
528
|
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";
|
|
532
529
|
verified_at: Date | null;
|
|
533
|
-
has_been_greeted: boolean;
|
|
534
530
|
user_id: number;
|
|
535
531
|
organization_id: number;
|
|
536
532
|
created_at: Date;
|
|
@@ -540,7 +536,6 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
540
536
|
is_external: boolean;
|
|
541
537
|
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";
|
|
542
538
|
verified_at: Date | null;
|
|
543
|
-
has_been_greeted: boolean;
|
|
544
539
|
user_id: number;
|
|
545
540
|
organization_id: number;
|
|
546
541
|
created_at: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"AA2DA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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,12 +1,12 @@
|
|
|
1
1
|
//
|
|
2
|
-
import { createAuthenticatorFactory, deleteAuthenticatorFactory, findAuthenticatorFactory, findAuthenticatorsByUserIdFactory, updateAuthenticatorFactory, } from "#src/repositories/authenticator";
|
|
2
|
+
import { createAuthenticatorFactory, deleteAllAuthenticatorsByUserIdFactory, deleteAuthenticatorFactory, findAuthenticatorFactory, findAuthenticatorsByUserIdFactory, updateAuthenticatorFactory, } from "#src/repositories/authenticator";
|
|
3
3
|
import { findEmailInDeliverabilityWhiteListFactory } from "#src/repositories/email-deliverability-whitelist";
|
|
4
4
|
import { addDomainFactory, findEmailDomainsByOrganizationIdFactory, } from "#src/repositories/email-domain";
|
|
5
5
|
import { findFranceconnectUserinfoFactory } from "#src/repositories/franceconnect_userinfo";
|
|
6
6
|
import { 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,
|
|
9
|
+
import { findBySiretFactory, findByUserIdFactory, findOrganizationByIdFactory, findPendingByUserIdFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
|
|
10
10
|
import { createRecoveryWordsFactory, deleteRecoveryWordsByUserIdFactory, findRecoveryWordsByUserIdFactory, } from "#src/repositories/recovery-words";
|
|
11
11
|
import { createUserFactory, findByEmailFactory, findByMagicLinkTokenFactory, findByResetPasswordTokenFactory, findByIdFactory as findUserByIdFactory, getByIdFactory, updateUserFactory, } from "#src/repositories/user";
|
|
12
12
|
import { findUserOrganizationFactory, getUserOrganizationFactory, } from "#src/repositories/user_organisation";
|
|
@@ -23,6 +23,7 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
23
23
|
authenticators: {
|
|
24
24
|
create: createAuthenticatorFactory({ pg }),
|
|
25
25
|
delete: deleteAuthenticatorFactory({ pg }),
|
|
26
|
+
deleteAllByUserId: deleteAllAuthenticatorsByUserIdFactory({ pg }),
|
|
26
27
|
find: findAuthenticatorFactory({ pg }),
|
|
27
28
|
findByUserId: findAuthenticatorsByUserIdFactory({ pg }),
|
|
28
29
|
update: updateAuthenticatorFactory({ pg }),
|
|
@@ -55,7 +56,6 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
55
56
|
findById: findOrganizationByIdFactory({ pg }),
|
|
56
57
|
findBySiret: findBySiretFactory({ pg }),
|
|
57
58
|
findByUserId: findByUserIdFactory({ pg }),
|
|
58
|
-
findByVerifiedEmailDomain: findByVerifiedEmailDomainFactory({ pg }),
|
|
59
59
|
findPendingByUserId: findPendingByUserIdFactory({ pg }),
|
|
60
60
|
getById: getOrganizationByIdFactory({ pg }),
|
|
61
61
|
upsert: upsertFactory({ pg }),
|
|
@@ -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
|
}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/authenticator/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,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;AACpD,cAAc,2BAA2B,CAAC"}
|
|
@@ -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
|
};
|
|
@@ -3,7 +3,6 @@ export declare function findByUserIdFactory({ pg }: DatabaseContext): (userId: n
|
|
|
3
3
|
is_external: boolean;
|
|
4
4
|
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";
|
|
5
5
|
verified_at: Date | null;
|
|
6
|
-
has_been_greeted: boolean;
|
|
7
6
|
})[]>;
|
|
8
7
|
export type FindByUserIdHandler = ReturnType<typeof findByUserIdFactory>;
|
|
9
8
|
//# sourceMappingURL=find-by-user-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAC;AAKpB,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,QAAQ,MAAM
|
|
1
|
+
{"version":3,"file":"find-by-user-id.d.ts","sourceRoot":"","sources":["../../../src/repositories/organization/find-by-user-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAC;AAKpB,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,QAAQ,MAAM;;;;MAkBlD;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -6,8 +6,7 @@ export function findByUserIdFactory({ pg }) {
|
|
|
6
6
|
SELECT o.*,
|
|
7
7
|
uo.is_external,
|
|
8
8
|
uo.verification_type,
|
|
9
|
-
uo.verified_at
|
|
10
|
-
uo.has_been_greeted
|
|
9
|
+
uo.verified_at
|
|
11
10
|
FROM organizations o
|
|
12
11
|
INNER JOIN users_organizations uo ON uo.organization_id = o.id
|
|
13
12
|
WHERE uo.user_id = $1
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./find-by-siret.js";
|
|
2
2
|
export * from "./find-by-user-id.js";
|
|
3
|
-
export * from "./find-by-verified-email-domain.js";
|
|
4
3
|
export * from "./find-organization-by-id.js";
|
|
5
4
|
export * from "./find-pending-by-user-id.js";
|
|
6
5
|
export * from "./get-organization-by-id.js";
|
|
@@ -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,
|
|
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,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
export * from "./find-by-siret.js";
|
|
3
3
|
export * from "./find-by-user-id.js";
|
|
4
|
-
export * from "./find-by-verified-email-domain.js";
|
|
5
4
|
export * from "./find-organization-by-id.js";
|
|
6
5
|
export * from "./find-pending-by-user-id.js";
|
|
7
6
|
export * from "./get-organization-by-id.js";
|
|
@@ -3,7 +3,6 @@ export declare function findUserOrganizationFactory({ pg }: DatabaseContext): ({
|
|
|
3
3
|
is_external: boolean;
|
|
4
4
|
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";
|
|
5
5
|
verified_at: Date | null;
|
|
6
|
-
has_been_greeted: boolean;
|
|
7
6
|
user_id: number;
|
|
8
7
|
organization_id: number;
|
|
9
8
|
created_at: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/find-user-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EAEzB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,+BAGxC,wBAAwB
|
|
1
|
+
{"version":3,"file":"find-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/find-user-organization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EAEzB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,+BAGxC,wBAAwB;;;;;;;;eAkB5B"}
|
|
@@ -10,8 +10,7 @@ export function findUserOrganizationFactory({ pg }) {
|
|
|
10
10
|
created_at,
|
|
11
11
|
updated_at,
|
|
12
12
|
verification_type,
|
|
13
|
-
verified_at
|
|
14
|
-
has_been_greeted
|
|
13
|
+
verified_at
|
|
15
14
|
FROM users_organizations
|
|
16
15
|
WHERE organization_id = $1
|
|
17
16
|
AND user_id = $2`, [organization_id, user_id]);
|
|
@@ -3,7 +3,6 @@ export declare function getUserOrganizationFactory({ pg }: DatabaseContext): ({
|
|
|
3
3
|
is_external: boolean;
|
|
4
4
|
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";
|
|
5
5
|
verified_at: Date | null;
|
|
6
|
-
has_been_greeted: boolean;
|
|
7
6
|
user_id: number;
|
|
8
7
|
organization_id: number;
|
|
9
8
|
created_at: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/get-user-organization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAM5E,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtB,+BAGvC,wBAAwB
|
|
1
|
+
{"version":3,"file":"get-user-organization.d.ts","sourceRoot":"","sources":["../../../src/repositories/user_organisation/get-user-organization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAM5E,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IAEtB,+BAGvC,wBAAwB;;;;;;;;GAO5B"}
|
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./compute-service-public-info.js";
|
|
2
|
-
export * from "./get-
|
|
2
|
+
export * from "./get-membership-changes-by-domain-verification.js";
|
|
3
3
|
export * from "./is-domain-allowed-for-organization.js";
|
|
4
4
|
export * from "./is-entreprise-unipersonnelle.js";
|
|
5
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,kCAAkC,CAAC;AACjD,cAAc,oDAAoD,CAAC;AACnE,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yDAAyD,CAAC;AACxE,cAAc,oCAAoC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
export * from "./compute-service-public-info.js";
|
|
3
|
-
export * from "./get-
|
|
3
|
+
export * from "./get-membership-changes-by-domain-verification.js";
|
|
4
4
|
export * from "./is-domain-allowed-for-organization.js";
|
|
5
5
|
export * from "./is-entreprise-unipersonnelle.js";
|
|
6
6
|
export * from "./is-organization-covered-by-certification-dirigeant.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const AuthorizationRequestOutcomeEnum: z.ZodEnum<{
|
|
3
|
+
signed_out: "signed_out";
|
|
3
4
|
succeeded: "succeeded";
|
|
4
5
|
}>;
|
|
5
6
|
export type AuthorizationRequestOutcome = z.output<typeof AuthorizationRequestOutcomeEnum>;
|
|
@@ -11,6 +12,7 @@ export interface BaseAuthorizationRequest {
|
|
|
11
12
|
user_ip_address: string | null;
|
|
12
13
|
interaction_cid: string | null;
|
|
13
14
|
outcome: AuthorizationRequestOutcome | null;
|
|
15
|
+
sid: string | null;
|
|
14
16
|
}
|
|
15
17
|
export interface AuthorizationRequest extends BaseAuthorizationRequest {
|
|
16
18
|
id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-request.d.ts","sourceRoot":"","sources":["../../src/types/authorization-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,+BAA+B
|
|
1
|
+
{"version":3,"file":"authorization-request.d.ts","sourceRoot":"","sources":["../../src/types/authorization-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,+BAA+B;;;EAG1C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAChD,OAAO,+BAA+B,CACvC,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC5C,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -70,7 +70,6 @@ export declare const BaseUserOrganizationLinkSchema: z.ZodObject<{
|
|
|
70
70
|
no_verification_means_for_small_organization: "no_verification_means_for_small_organization";
|
|
71
71
|
}>;
|
|
72
72
|
verified_at: z.ZodUnion<[z.ZodDate, z.ZodLiteral<null>]>;
|
|
73
|
-
has_been_greeted: z.ZodBoolean;
|
|
74
73
|
}, z.core.$strip>;
|
|
75
74
|
export type BaseUserOrganizationLink = z.output<typeof BaseUserOrganizationLinkSchema>;
|
|
76
75
|
export declare const UserOrganizationLinkSchema: z.ZodObject<{
|
|
@@ -95,7 +94,6 @@ export declare const UserOrganizationLinkSchema: z.ZodObject<{
|
|
|
95
94
|
no_verification_means_for_small_organization: "no_verification_means_for_small_organization";
|
|
96
95
|
}>;
|
|
97
96
|
verified_at: z.ZodUnion<[z.ZodDate, z.ZodLiteral<null>]>;
|
|
98
|
-
has_been_greeted: z.ZodBoolean;
|
|
99
97
|
user_id: z.ZodNumber;
|
|
100
98
|
organization_id: z.ZodNumber;
|
|
101
99
|
created_at: z.ZodDate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-organization-link.d.ts","sourceRoot":"","sources":["../../src/types/user-organization-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,qCAAsC,CAAC;AAEpE,eAAO,MAAM,cAAc,6TAajB,CAAC;AAMX,eAAO,MAAM,mBAAmB,sCAAuC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;EAA8B,CAAC;AAE7D,eAAO,MAAM,kBAAkB,kXAIrB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;EAA6B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,kMAKvB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;EAA+B,CAAC;AAE/D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;EAGnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEjD,eAAO,MAAM,8BAA8B
|
|
1
|
+
{"version":3,"file":"user-organization-link.d.ts","sourceRoot":"","sources":["../../src/types/user-organization-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,qCAAsC,CAAC;AAEpE,eAAO,MAAM,cAAc,6TAajB,CAAC;AAMX,eAAO,MAAM,mBAAmB,sCAAuC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;EAA8B,CAAC;AAE7D,eAAO,MAAM,kBAAkB,kXAIrB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;EAA6B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,kMAKvB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;EAA+B,CAAC;AAE/D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;EAGnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEjD,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,8BAA8B,CACtC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOtC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;iBAU5C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAC/C,OAAO,gCAAgC,CACxC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -42,7 +42,6 @@ export const BaseUserOrganizationLinkSchema = z.object({
|
|
|
42
42
|
verification_type: LinkEnum,
|
|
43
43
|
// updated when verification_type is changed
|
|
44
44
|
verified_at: z.date().or(z.literal(null)),
|
|
45
|
-
has_been_greeted: z.boolean(),
|
|
46
45
|
});
|
|
47
46
|
export const UserOrganizationLinkSchema = BaseUserOrganizationLinkSchema.extend({
|
|
48
47
|
user_id: z.number(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proconnect-gouv/proconnect.identite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.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": {
|