@proconnect-gouv/proconnect.identite 1.0.0 → 1.2.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 +22 -0
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/data/certification/commune-code-conversion.d.ts +13 -0
- package/dist/data/certification/commune-code-conversion.d.ts.map +1 -0
- package/dist/data/certification/commune-code-conversion.js +5188 -0
- package/dist/data/certification/country-iso-to-cog.d.ts +12 -0
- package/dist/data/certification/country-iso-to-cog.d.ts.map +1 -0
- package/dist/data/certification/country-iso-to-cog.js +438 -0
- package/dist/data/certification/index.d.ts +3 -0
- package/dist/data/certification/index.d.ts.map +1 -0
- package/dist/data/certification/index.js +3 -0
- package/dist/managers/certification/adapters/api_entreprise.d.ts +4 -0
- package/dist/managers/certification/adapters/api_entreprise.d.ts.map +1 -0
- package/dist/managers/certification/adapters/api_entreprise.js +14 -0
- package/dist/managers/certification/adapters/franceconnect.d.ts +3 -0
- package/dist/managers/certification/adapters/franceconnect.d.ts.map +1 -0
- package/dist/managers/certification/adapters/franceconnect.js +15 -0
- package/dist/managers/certification/adapters/insee.d.ts +4 -0
- package/dist/managers/certification/adapters/insee.d.ts.map +1 -0
- package/dist/managers/certification/adapters/insee.js +29 -0
- package/dist/managers/certification/adapters/rne.d.ts +4 -0
- package/dist/managers/certification/adapters/rne.d.ts.map +1 -0
- package/dist/managers/certification/adapters/rne.js +45 -0
- package/dist/managers/certification/birthplace-conversion.d.ts +27 -0
- package/dist/managers/certification/birthplace-conversion.d.ts.map +1 -0
- package/dist/managers/certification/birthplace-conversion.js +45 -0
- package/dist/managers/certification/certification-score.d.ts +22 -0
- package/dist/managers/certification/certification-score.d.ts.map +1 -0
- package/dist/managers/certification/certification-score.js +72 -0
- package/dist/managers/certification/index.d.ts +1 -1
- package/dist/managers/certification/index.d.ts.map +1 -1
- package/dist/managers/certification/index.js +1 -1
- package/dist/managers/certification/is-organization-dirigeant.d.ts +38 -8
- package/dist/managers/certification/is-organization-dirigeant.d.ts.map +1 -1
- package/dist/managers/certification/is-organization-dirigeant.js +89 -52
- package/dist/managers/certification/normalize.d.ts +21 -0
- package/dist/managers/certification/normalize.d.ts.map +1 -0
- package/dist/managers/certification/normalize.js +64 -0
- package/dist/managers/franceconnect/openid-client.d.ts +1 -0
- package/dist/managers/franceconnect/openid-client.d.ts.map +1 -1
- package/dist/managers/organization/adapters/api_entreprise.d.ts +25 -0
- package/dist/managers/organization/adapters/api_entreprise.d.ts.map +1 -0
- package/dist/{mappers/organization/from-siret.js → managers/organization/adapters/api_entreprise.js} +26 -3
- package/dist/managers/organization/get-organization-info.d.ts +2 -2
- package/dist/managers/organization/get-organization-info.d.ts.map +1 -1
- package/dist/managers/organization/get-organization-info.js +6 -6
- package/dist/repositories/organization/upsert.d.ts +1 -1
- package/dist/repositories/organization/upsert.d.ts.map +1 -1
- package/dist/repositories/organization/upsert.js +26 -1
- package/dist/repositories/user/get-franceconnect-user-info.d.ts +1 -0
- package/dist/repositories/user/get-franceconnect-user-info.d.ts.map +1 -1
- package/dist/repositories/user/upsert-franceconnect-userinfo.d.ts +1 -0
- package/dist/repositories/user/upsert-franceconnect-userinfo.d.ts.map +1 -1
- package/dist/services/organization/index.d.ts +2 -0
- package/dist/services/organization/index.d.ts.map +1 -1
- package/dist/services/organization/index.js +2 -0
- package/dist/services/organization/is-public-service.d.ts +3 -0
- package/dist/services/organization/is-public-service.d.ts.map +1 -0
- package/dist/services/organization/is-public-service.js +19 -0
- package/dist/services/organization/is-syndicat-communal.d.ts +3 -0
- package/dist/services/organization/is-syndicat-communal.d.ts.map +1 -0
- package/dist/services/organization/is-syndicat-communal.js +13 -0
- package/dist/types/dirigeant.d.ts +5 -0
- package/dist/types/dirigeant.d.ts.map +1 -1
- package/dist/types/dirigeant.js +2 -0
- package/dist/types/franceconnect.d.ts +2 -0
- package/dist/types/franceconnect.d.ts.map +1 -1
- package/dist/types/franceconnect.js +1 -0
- package/dist/types/organization.d.ts +3 -3
- package/dist/types/organization.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/data/certification/commune-code-conversion.ts +5189 -0
- package/src/data/certification/country-iso-to-cog.ts +439 -0
- package/src/data/certification/index.ts +4 -0
- package/src/managers/certification/adapters/api_entreprise.test.ts +68 -0
- package/src/managers/certification/adapters/api_entreprise.test.ts.snapshot +109 -0
- package/src/{mappers/certification/index.ts → managers/certification/adapters/api_entreprise.ts} +8 -5
- package/src/managers/certification/adapters/franceconnect.ts +21 -0
- package/src/managers/certification/adapters/insee.test.ts +18 -0
- package/src/managers/certification/adapters/insee.test.ts.snapshot +21 -0
- package/src/managers/certification/adapters/insee.ts +39 -0
- package/src/managers/certification/adapters/rne.test.ts +276 -0
- package/src/managers/certification/adapters/rne.ts +64 -0
- package/src/managers/certification/birthplace-conversion.test.ts +76 -0
- package/src/managers/certification/birthplace-conversion.ts +58 -0
- package/src/managers/certification/certification-score.test.ts +309 -0
- package/src/managers/certification/certification-score.ts +97 -0
- package/src/managers/certification/index.ts +1 -1
- package/src/managers/certification/is-organization-dirigeant.test.ts +144 -53
- package/src/managers/certification/is-organization-dirigeant.ts +132 -106
- package/src/managers/certification/normalize.test.ts +71 -0
- package/src/managers/certification/normalize.ts +72 -0
- package/src/managers/organization/adapters/api_entreprise.test.ts +31 -0
- package/src/{mappers/organization/from-siret.test.ts.snapshot → managers/organization/adapters/api_entreprise.test.ts.snapshot} +26 -3
- package/src/{mappers/organization/from-siret.ts → managers/organization/adapters/api_entreprise.ts} +55 -5
- package/src/managers/organization/get-organization-info.test.ts +2 -2
- package/src/managers/organization/get-organization-info.ts +10 -10
- package/src/repositories/organization/get-users-by-organization.test.ts.snapshot +1 -1
- package/src/repositories/organization/upsert.ts +69 -19
- package/src/repositories/user/find-by-email.test.ts +1 -1
- package/src/repositories/user/find-by-id.test.ts +1 -1
- package/src/repositories/user/get-by-id.test.ts +1 -1
- package/src/repositories/user/get-franceconnect-user-info.test.ts +1 -0
- package/src/repositories/user/upsert-franceconnect-userinfo.test.ts +2 -0
- package/src/services/organization/index.ts +2 -0
- package/src/services/organization/is-public-service.test.ts +99 -0
- package/src/services/organization/is-public-service.ts +35 -0
- package/src/services/organization/is-syndicat-communal.test.ts +31 -0
- package/src/services/organization/is-syndicat-communal.ts +18 -0
- package/src/types/dirigeant.ts +3 -0
- package/src/types/franceconnect.ts +1 -0
- package/src/types/organization-info.ts +1 -1
- package/src/types/organization.ts +3 -3
- package/testing/seed/franceconnect/index.ts +12 -9
- package/testing/seed/organizations/index.ts +108 -0
- package/tsconfig.json +6 -2
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/managers/certification/distance.d.ts +0 -4
- package/dist/managers/certification/distance.d.ts.map +0 -1
- package/dist/managers/certification/distance.js +0 -16
- package/dist/mappers/certification/index.d.ts +0 -4
- package/dist/mappers/certification/index.d.ts.map +0 -1
- package/dist/mappers/certification/index.js +0 -11
- package/dist/mappers/index.d.ts +0 -2
- package/dist/mappers/index.d.ts.map +0 -1
- package/dist/mappers/index.js +0 -2
- package/dist/mappers/organization/from-siret.d.ts +0 -5
- package/dist/mappers/organization/from-siret.d.ts.map +0 -1
- package/dist/mappers/organization/index.d.ts +0 -2
- package/dist/mappers/organization/index.d.ts.map +0 -1
- package/dist/mappers/organization/index.js +0 -2
- package/src/managers/certification/distance.test.ts +0 -109
- package/src/managers/certification/distance.ts +0 -41
- package/src/mappers/index.ts +0 -3
- package/src/mappers/organization/from-siret.test.ts +0 -26
- package/src/mappers/organization/index.ts +0 -3
- package/testing/seed/insee/index.ts +0 -22
- package/testing/seed/mandataires/index.ts +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.identite
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1577](https://github.com/proconnect-gouv/proconnect-identite/pull/1577) [`e2cc9d1`](https://github.com/proconnect-gouv/proconnect-identite/commit/e2cc9d1fec67acb4f6bf7bb437bf78da8f816c3f) Thanks [@arnaud-robin](https://github.com/arnaud-robin)! - 🧪 Mise a jour de l'algo de certification
|
|
8
|
+
|
|
9
|
+
## 1.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#1449](https://github.com/proconnect-gouv/proconnect-identite/pull/1449) [`a12697c`](https://github.com/proconnect-gouv/proconnect-identite/commit/a12697c3785aea1bb737afec8ce52111132ec807) Thanks [@douglasduteil](https://github.com/douglasduteil)! - ✨ Ajout de la fonction `isPublicService` pour identifier les services publics
|
|
14
|
+
|
|
15
|
+
Nouvelle fonction exportée permettant de déterminer si une organisation est un service public en fonction de sa nature juridique, son statut administratif et des listes de référence officielles.
|
|
16
|
+
|
|
17
|
+
Inspirée par https://github.com/annuaire-entreprises-data-gouv-fr/search-infra/blob/f1e56ac476b0b1730115f7b1f0667e8509ee5379/workflows/data_pipelines/elasticsearch/data_enrichment.py#L155-L189
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
import { isPublicService } from "@proconnect-gouv/proconnect.identite/services/organization";
|
|
21
|
+
|
|
22
|
+
isPublicService(my_oganization) =>> true/false
|
|
23
|
+
```
|
|
24
|
+
|
|
3
25
|
## 1.0.0
|
|
4
26
|
|
|
5
27
|
### Major Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Direction Interministérielle du Numérique - Gouvernement Français
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# 🔐 @proconnect-gouv/proconnect.identite
|
|
2
|
+
|
|
3
|
+
> Core identity management logic for ProConnect
|
|
4
|
+
|
|
5
|
+
## ⚙️ Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @proconnect-gouv/proconnect.identite
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 📖 Usage
|
|
12
|
+
|
|
13
|
+
### Managers
|
|
14
|
+
|
|
15
|
+
High-level business logic for certification, FranceConnect integration, organization, and user management.
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { isOrganizationDirigeant } from "@proconnect-gouv/proconnect.identite/managers/certification";
|
|
19
|
+
import { getOrganizationInfo } from "@proconnect-gouv/proconnect.identite/managers/organization";
|
|
20
|
+
import { assignUserVerificationTypeToDomain } from "@proconnect-gouv/proconnect.identite/managers/user";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Repositories
|
|
24
|
+
|
|
25
|
+
Data access layer for email domains, organizations, and users.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import {
|
|
29
|
+
findByEmail,
|
|
30
|
+
findById,
|
|
31
|
+
getByIdFactory,
|
|
32
|
+
} from "@proconnect-gouv/proconnect.identite/repositories/user";
|
|
33
|
+
import {
|
|
34
|
+
findByUserId,
|
|
35
|
+
linkUserToOrganization,
|
|
36
|
+
} from "@proconnect-gouv/proconnect.identite/repositories/organization";
|
|
37
|
+
import { addDomain } from "@proconnect-gouv/proconnect.identite/repositories/email-domain";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Services
|
|
41
|
+
|
|
42
|
+
Stateless business logic for organization validation and PostgreSQL utilities.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import {
|
|
46
|
+
isEntrepriseUnipersonnelle,
|
|
47
|
+
isPublicService,
|
|
48
|
+
} from "@proconnect-gouv/proconnect.identite/services/organization";
|
|
49
|
+
import { hashToPostgresParams } from "@proconnect-gouv/proconnect.identite/services/postgres";
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Mappers
|
|
53
|
+
|
|
54
|
+
Data transformation utilities for certification and organization data.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { fromSiret } from "@proconnect-gouv/proconnect.identite/mappers/organization";
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Types
|
|
61
|
+
|
|
62
|
+
TypeScript type definitions for users, organizations, claims, and more.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import type {
|
|
66
|
+
User,
|
|
67
|
+
Organization,
|
|
68
|
+
UserOrganizationLink,
|
|
69
|
+
EmailDomain,
|
|
70
|
+
FranceConnectUserInfo,
|
|
71
|
+
} from "@proconnect-gouv/proconnect.identite/types";
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Data
|
|
75
|
+
|
|
76
|
+
Raw data arrays for organization domain whitelists.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { domainsWhitelist } from "@proconnect-gouv/proconnect.identite/data/organization";
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Errors
|
|
83
|
+
|
|
84
|
+
Custom error types for identity management operations.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import {
|
|
88
|
+
InvalidCertificationError,
|
|
89
|
+
InvalidSiretError,
|
|
90
|
+
NotFoundError,
|
|
91
|
+
OrganizationNotActiveError,
|
|
92
|
+
OrganizationNotFoundError,
|
|
93
|
+
UserNotFoundError,
|
|
94
|
+
ModerationNotFoundError,
|
|
95
|
+
} from "@proconnect-gouv/proconnect.identite/errors";
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 📊 Available Exports
|
|
99
|
+
|
|
100
|
+
- **`/managers/certification`** - Organization certification and dirigeant validation
|
|
101
|
+
- **`/managers/franceconnect`** - FranceConnect OIDC client integration
|
|
102
|
+
- **`/managers/organization`** - Organization business logic
|
|
103
|
+
- **`/managers/user`** - User business logic
|
|
104
|
+
- **`/repositories/email-domain`** - Email domain data access
|
|
105
|
+
- **`/repositories/organization`** - Organization data access
|
|
106
|
+
- **`/repositories/user`** - User data access
|
|
107
|
+
- **`/services/organization`** - Organization validation utilities
|
|
108
|
+
- **`/services/postgres`** - PostgreSQL query utilities
|
|
109
|
+
- **`/mappers/certification`** - Certification data transformation
|
|
110
|
+
- **`/mappers/organization`** - Organization data transformation
|
|
111
|
+
- **`/types`** - TypeScript type definitions
|
|
112
|
+
- **`/data/organization`** - Organization reference data
|
|
113
|
+
- **`/errors`** - Custom error types
|
|
114
|
+
|
|
115
|
+
## 📖 License
|
|
116
|
+
|
|
117
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commune code conversion table for handling historical changes in geographic codes.
|
|
3
|
+
* Based on the Code Officiel Géographique from INSEE.
|
|
4
|
+
*
|
|
5
|
+
* Maps: CODE_ENTREE (old code) → CODE_SORTIE (new code)
|
|
6
|
+
*
|
|
7
|
+
* Example: 75050 (old Nanterre code) → 92050 (new code)
|
|
8
|
+
*
|
|
9
|
+
* This table should be updated annually from:
|
|
10
|
+
* https://www.insee.fr/fr/information/2560452
|
|
11
|
+
*/
|
|
12
|
+
export declare const COMMUNE_CODE_CONVERSION: Record<string, string>;
|
|
13
|
+
//# sourceMappingURL=commune-code-conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commune-code-conversion.d.ts","sourceRoot":"","sources":["../../../src/data/certification/commune-code-conversion.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAujK1D,CAAC"}
|