@proconnect-gouv/proconnect.identite 1.1.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/data/certification/commune-code-conversion.d.ts +13 -0
  3. package/dist/data/certification/commune-code-conversion.d.ts.map +1 -0
  4. package/dist/data/certification/commune-code-conversion.js +5188 -0
  5. package/dist/data/certification/country-iso-to-cog.d.ts +12 -0
  6. package/dist/data/certification/country-iso-to-cog.d.ts.map +1 -0
  7. package/dist/data/certification/country-iso-to-cog.js +438 -0
  8. package/dist/data/certification/index.d.ts +3 -0
  9. package/dist/data/certification/index.d.ts.map +1 -0
  10. package/dist/data/certification/index.js +3 -0
  11. package/dist/{mappers/certification/index.d.ts → managers/certification/adapters/api_entreprise.d.ts} +2 -2
  12. package/dist/managers/certification/adapters/api_entreprise.d.ts.map +1 -0
  13. package/dist/managers/certification/adapters/api_entreprise.js +14 -0
  14. package/dist/managers/certification/adapters/franceconnect.d.ts +3 -0
  15. package/dist/managers/certification/adapters/franceconnect.d.ts.map +1 -0
  16. package/dist/managers/certification/adapters/franceconnect.js +15 -0
  17. package/dist/managers/certification/adapters/insee.d.ts +4 -0
  18. package/dist/managers/certification/adapters/insee.d.ts.map +1 -0
  19. package/dist/managers/certification/adapters/insee.js +29 -0
  20. package/dist/managers/certification/adapters/rne.d.ts +4 -0
  21. package/dist/managers/certification/adapters/rne.d.ts.map +1 -0
  22. package/dist/managers/certification/adapters/rne.js +45 -0
  23. package/dist/managers/certification/birthplace-conversion.d.ts +27 -0
  24. package/dist/managers/certification/birthplace-conversion.d.ts.map +1 -0
  25. package/dist/managers/certification/birthplace-conversion.js +45 -0
  26. package/dist/managers/certification/certification-score.d.ts +22 -0
  27. package/dist/managers/certification/certification-score.d.ts.map +1 -0
  28. package/dist/managers/certification/certification-score.js +72 -0
  29. package/dist/managers/certification/index.d.ts +1 -1
  30. package/dist/managers/certification/index.d.ts.map +1 -1
  31. package/dist/managers/certification/index.js +1 -1
  32. package/dist/managers/certification/is-organization-dirigeant.d.ts +38 -8
  33. package/dist/managers/certification/is-organization-dirigeant.d.ts.map +1 -1
  34. package/dist/managers/certification/is-organization-dirigeant.js +89 -52
  35. package/dist/managers/certification/normalize.d.ts +21 -0
  36. package/dist/managers/certification/normalize.d.ts.map +1 -0
  37. package/dist/managers/certification/normalize.js +64 -0
  38. package/dist/managers/franceconnect/openid-client.d.ts +1 -0
  39. package/dist/managers/franceconnect/openid-client.d.ts.map +1 -1
  40. package/dist/managers/organization/adapters/api_entreprise.d.ts +25 -0
  41. package/dist/managers/organization/adapters/api_entreprise.d.ts.map +1 -0
  42. package/dist/{mappers/organization/from-siret.js → managers/organization/adapters/api_entreprise.js} +25 -2
  43. package/dist/managers/organization/get-organization-info.d.ts.map +1 -1
  44. package/dist/managers/organization/get-organization-info.js +3 -3
  45. package/dist/repositories/organization/upsert.d.ts +1 -1
  46. package/dist/repositories/organization/upsert.d.ts.map +1 -1
  47. package/dist/repositories/organization/upsert.js +26 -1
  48. package/dist/repositories/user/get-franceconnect-user-info.d.ts +1 -0
  49. package/dist/repositories/user/get-franceconnect-user-info.d.ts.map +1 -1
  50. package/dist/repositories/user/upsert-franceconnect-userinfo.d.ts +1 -0
  51. package/dist/repositories/user/upsert-franceconnect-userinfo.d.ts.map +1 -1
  52. package/dist/services/organization/is-syndicat-communal.d.ts.map +1 -1
  53. package/dist/services/organization/is-syndicat-communal.js +2 -0
  54. package/dist/types/dirigeant.d.ts +5 -0
  55. package/dist/types/dirigeant.d.ts.map +1 -1
  56. package/dist/types/dirigeant.js +2 -0
  57. package/dist/types/franceconnect.d.ts +2 -0
  58. package/dist/types/franceconnect.d.ts.map +1 -1
  59. package/dist/types/franceconnect.js +1 -0
  60. package/dist/types/organization.d.ts +2 -2
  61. package/dist/types/organization.d.ts.map +1 -1
  62. package/package.json +6 -6
  63. package/src/data/certification/commune-code-conversion.ts +5189 -0
  64. package/src/data/certification/country-iso-to-cog.ts +439 -0
  65. package/src/data/certification/index.ts +4 -0
  66. package/src/managers/certification/adapters/api_entreprise.test.ts +68 -0
  67. package/src/managers/certification/adapters/api_entreprise.test.ts.snapshot +109 -0
  68. package/src/{mappers/certification/index.ts → managers/certification/adapters/api_entreprise.ts} +7 -4
  69. package/src/managers/certification/adapters/franceconnect.ts +21 -0
  70. package/src/managers/certification/adapters/insee.test.ts +18 -0
  71. package/src/managers/certification/adapters/insee.test.ts.snapshot +21 -0
  72. package/src/managers/certification/adapters/insee.ts +39 -0
  73. package/src/managers/certification/adapters/rne.test.ts +276 -0
  74. package/src/managers/certification/adapters/rne.ts +64 -0
  75. package/src/managers/certification/birthplace-conversion.test.ts +76 -0
  76. package/src/managers/certification/birthplace-conversion.ts +58 -0
  77. package/src/managers/certification/certification-score.test.ts +309 -0
  78. package/src/managers/certification/certification-score.ts +97 -0
  79. package/src/managers/certification/index.ts +1 -1
  80. package/src/managers/certification/is-organization-dirigeant.test.ts +139 -48
  81. package/src/managers/certification/is-organization-dirigeant.ts +132 -106
  82. package/src/managers/certification/normalize.test.ts +71 -0
  83. package/src/managers/certification/normalize.ts +72 -0
  84. package/src/managers/organization/adapters/api_entreprise.test.ts +31 -0
  85. package/src/{mappers/organization/from-siret.test.ts.snapshot → managers/organization/adapters/api_entreprise.test.ts.snapshot} +26 -3
  86. package/src/{mappers/organization/from-siret.ts → managers/organization/adapters/api_entreprise.ts} +53 -3
  87. package/src/managers/organization/get-organization-info.test.ts +1 -1
  88. package/src/managers/organization/get-organization-info.ts +3 -3
  89. package/src/repositories/organization/upsert.ts +69 -19
  90. package/src/repositories/user/get-franceconnect-user-info.test.ts +1 -0
  91. package/src/repositories/user/upsert-franceconnect-userinfo.test.ts +2 -0
  92. package/src/services/organization/is-syndicat-communal.ts +2 -0
  93. package/src/types/dirigeant.ts +3 -0
  94. package/src/types/franceconnect.ts +1 -0
  95. package/src/types/organization.ts +2 -2
  96. package/testing/seed/franceconnect/index.ts +12 -9
  97. package/testing/seed/organizations/index.ts +34 -0
  98. package/tsconfig.json +5 -2
  99. package/tsconfig.lib.tsbuildinfo +1 -1
  100. package/dist/managers/certification/distance.d.ts +0 -4
  101. package/dist/managers/certification/distance.d.ts.map +0 -1
  102. package/dist/managers/certification/distance.js +0 -16
  103. package/dist/mappers/certification/index.d.ts.map +0 -1
  104. package/dist/mappers/certification/index.js +0 -11
  105. package/dist/mappers/index.d.ts +0 -2
  106. package/dist/mappers/index.d.ts.map +0 -1
  107. package/dist/mappers/index.js +0 -2
  108. package/dist/mappers/organization/from-siret.d.ts +0 -5
  109. package/dist/mappers/organization/from-siret.d.ts.map +0 -1
  110. package/dist/mappers/organization/index.d.ts +0 -2
  111. package/dist/mappers/organization/index.d.ts.map +0 -1
  112. package/dist/mappers/organization/index.js +0 -2
  113. package/src/managers/certification/distance.test.ts +0 -109
  114. package/src/managers/certification/distance.ts +0 -41
  115. package/src/mappers/index.ts +0 -3
  116. package/src/mappers/organization/from-siret.test.ts +0 -26
  117. package/src/mappers/organization/index.ts +0 -3
  118. package/testing/seed/insee/index.ts +0 -22
  119. package/testing/seed/mandataires/index.ts +0 -32
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Country code conversion table from ISO 3166 (2 or 3-letter) to COG format (5-digit).
3
+ *
4
+ * Maps: ISO 3166 code → COG code (99XXX format)
5
+ *
6
+ * Example: IRL → 99136 (Ireland)
7
+ *
8
+ * This table should be updated annually from:
9
+ * https://www.insee.fr/fr/information/2560452
10
+ */
11
+ export declare const COUNTRY_ISO_TO_COG: Record<string, string>;
12
+ //# sourceMappingURL=country-iso-to-cog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-iso-to-cog.d.ts","sourceRoot":"","sources":["../../../src/data/certification/country-iso-to-cog.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0arD,CAAC"}
@@ -0,0 +1,438 @@
1
+ //
2
+ /**
3
+ * Country code conversion table from ISO 3166 (2 or 3-letter) to COG format (5-digit).
4
+ *
5
+ * Maps: ISO 3166 code → COG code (99XXX format)
6
+ *
7
+ * Example: IRL → 99136 (Ireland)
8
+ *
9
+ * This table should be updated annually from:
10
+ * https://www.insee.fr/fr/information/2560452
11
+ */
12
+ export const COUNTRY_ISO_TO_COG = {
13
+ FRA: "99100", // France,
14
+ DNK: "99101", // Danemark,
15
+ ISL: "99102", // Islande,
16
+ NOR: "99103", // Norvège,
17
+ SWE: "99104", // Suède,
18
+ FIN: "99105", // Finlande,
19
+ EST: "99106", // Estonie,
20
+ LVA: "99107", // Lettonie,
21
+ LTU: "99108", // Lituanie,
22
+ DEU: "99109", // Allemagne,
23
+ AUT: "99110", // Autriche,
24
+ BGR: "99111", // Bulgarie,
25
+ HUN: "99112", // Hongrie,
26
+ LIE: "99113", // Liechtenstein,
27
+ ROU: "99114", // Roumanie,
28
+ CZE: "99116", // Tchéquie,
29
+ SVK: "99117", // Slovaquie,
30
+ BIH: "99118", // Bosnie-Herzégovine,
31
+ HRV: "99119", // Croatie,
32
+ MNE: "99120", // Monténégro,
33
+ SRB: "99121", // Serbie,
34
+ POL: "99122", // Pologne,
35
+ RUS: "99123", // Russie,
36
+ ALB: "99125", // Albanie,
37
+ GRC: "99126", // Grèce,
38
+ ITA: "99127", // Italie,
39
+ SMR: "99128", // Saint-Marin,
40
+ VAT: "99129", // Vatican,
41
+ AND: "99130", // Andorre,
42
+ BEL: "99131", // Belgique,
43
+ GBR: "99132", // Royaume-Uni,
44
+ GIB: "99133", // Territoires britanniques en Méditerranée,
45
+ ESP: "99134", // Espagne,
46
+ NLD: "99135", // Pays-Bas,
47
+ IRL: "99136", // Irlande,
48
+ LUX: "99137", // Luxembourg,
49
+ MCO: "99138", // Monaco,
50
+ PRT: "99139", // Portugal,
51
+ CHE: "99140", // Suisse,
52
+ MLT: "99144", // Malte,
53
+ SVN: "99145", // Slovénie,
54
+ BLR: "99148", // Biélorussie,
55
+ MDA: "99151", // Moldavie,
56
+ UKR: "99155", // Ukraine,
57
+ MKD: "99156", // Macédoine du Nord,
58
+ FRO: "99158", // Féroé,
59
+ ALA: "99160", // Åland,
60
+ SAU: "99201", // Arabie saoudite,
61
+ IRQ: "99203", // Irak,
62
+ IRN: "99204", // Iran,
63
+ LBN: "99205", // Liban,
64
+ SYR: "99206", // Syrie,
65
+ ISR: "99207", // Israël,
66
+ TUR: "99208", // Turquie,
67
+ AFG: "99212", // Afghanistan,
68
+ PAK: "99213", // Pakistan,
69
+ BTN: "99214", // Bhoutan,
70
+ NPL: "99215", // Népal,
71
+ CHN: "99216", // Chine,
72
+ JPN: "99217", // Japon,
73
+ THA: "99219", // Thaïlande,
74
+ PHL: "99220", // Philippines,
75
+ JOR: "99222", // Jordanie,
76
+ IND: "99223", // Inde,
77
+ MMR: "99224", // Birmanie,
78
+ BRN: "99225", // Brunei,
79
+ SGP: "99226", // Singapour,
80
+ MYS: "99227", // Malaisie,
81
+ MDV: "99229", // Maldives,
82
+ HKG: "99230", // Hong Kong,
83
+ IDN: "99231", // Indonésie,
84
+ MAC: "99232", // Macao,
85
+ KHM: "99234", // Cambodge,
86
+ LKA: "99235", // Sri Lanka,
87
+ TWN: "99236", // Taïwan,
88
+ PRK: "99238", // Corée du Nord,
89
+ KOR: "99239", // Corée du Sud,
90
+ KWT: "99240", // Koweït,
91
+ LAO: "99241", // Laos,
92
+ MNG: "99242", // Mongolie,
93
+ VNM: "99243", // Vietnam,
94
+ BGD: "99246", // Bangladesh,
95
+ ARE: "99247", // Émirats arabes unis,
96
+ QAT: "99248", // Qatar,
97
+ BHR: "99249", // Bahreïn,
98
+ OMN: "99250", // Oman,
99
+ YEM: "99251", // Yémen,
100
+ ARM: "99252", // Arménie,
101
+ AZE: "99253", // Azerbaïdjan,
102
+ CYP: "99254", // Chypre,
103
+ GEO: "99255", // Géorgie,
104
+ KAZ: "99256", // Kazakhstan,
105
+ KGZ: "99257", // Kirghizstan,
106
+ UZB: "99258", // Ouzbékistan,
107
+ TJK: "99259", // Tadjikistan,
108
+ TKM: "99260", // Turkménistan,
109
+ PSE: "99261", // Palestine,
110
+ TLS: "99262", // Timor oriental,
111
+ EGY: "99301", // Égypte,
112
+ LBR: "99302", // Libéria,
113
+ ZAF: "99303", // Afrique du Sud,
114
+ GMB: "99304", // Gambie,
115
+ SHN: "99306", // Territoires britanniques de l’océan Atlantique,
116
+ IOT: "99308", // Territoire britannique de l’océan Indien,
117
+ TZA: "99309", // Tanzanie,
118
+ ZWE: "99310", // Zimbabwe,
119
+ NAM: "99311", // Namibie,
120
+ COD: "99312", // République démocratique du Congo,
121
+ GNQ: "99314", // Guinée équatoriale,
122
+ ETH: "99315", // Éthiopie,
123
+ LBY: "99316", // Libye,
124
+ ERI: "99317", // Érythrée,
125
+ SOM: "99318", // Somalie,
126
+ BDI: "99321", // Burundi,
127
+ CMR: "99322", // Cameroun,
128
+ CAF: "99323", // Centrafrique,
129
+ COG: "99324", // Congo,
130
+ CIV: "99326", // Côte d’Ivoire,
131
+ BEN: "99327", // Bénin,
132
+ GAB: "99328", // Gabon,
133
+ GHA: "99329", // Ghana,
134
+ GIN: "99330", // Guinée,
135
+ BFA: "99331", // Burkina,
136
+ KEN: "99332", // Kenya,
137
+ MDG: "99333", // Madagascar,
138
+ MWI: "99334", // Malawi,
139
+ MLI: "99335", // Mali,
140
+ MRT: "99336", // Mauritanie,
141
+ NER: "99337", // Niger,
142
+ NGA: "99338", // Nigéria,
143
+ UGA: "99339", // Ouganda,
144
+ RWA: "99340", // Rwanda,
145
+ SEN: "99341", // Sénégal,
146
+ SLE: "99342", // Sierra Leone,
147
+ SDN: "99343", // Soudan,
148
+ TCD: "99344", // Tchad,
149
+ TGO: "99345", // Togo,
150
+ ZMB: "99346", // Zambie,
151
+ BWA: "99347", // Botswana,
152
+ LSO: "99348", // Lesotho,
153
+ SSD: "99349", // Soudan du Sud,
154
+ MAR: "99350", // Maroc,
155
+ TUN: "99351", // Tunisie,
156
+ DZA: "99352", // Algérie,
157
+ ESH: "99389", // Sahara occidental,
158
+ MUS: "99390", // Maurice,
159
+ SWZ: "99391", // Swaziland,
160
+ GNB: "99392", // Guinée-Bissao,
161
+ MOZ: "99393", // Mozambique,
162
+ STP: "99394", // Sao Tomé-et-Principe,
163
+ AGO: "99395", // Angola,
164
+ CPV: "99396", // Cap-Vert,
165
+ COM: "99397", // Comores,
166
+ SYC: "99398", // Seychelles,
167
+ DJI: "99399", // Djibouti,
168
+ CAN: "99401", // Canada,
169
+ USA: "99404", // États-Unis,
170
+ MEX: "99405", // Mexique,
171
+ CRI: "99406", // Costa Rica,
172
+ CUB: "99407", // Cuba,
173
+ DOM: "99408", // République dominicaine,
174
+ GTM: "99409", // Guatémala,
175
+ HTI: "99410", // Haïti,
176
+ HND: "99411", // Honduras,
177
+ NIC: "99412", // Nicaragua,
178
+ PAN: "99413", // Panama,
179
+ SLV: "99414", // Salvador,
180
+ ARG: "99415", // Argentine,
181
+ BRA: "99416", // Brésil,
182
+ CHL: "99417", // Chili,
183
+ BOL: "99418", // Bolivie,
184
+ COL: "99419", // Colombie,
185
+ ECU: "99420", // Équateur,
186
+ PRY: "99421", // Paraguay,
187
+ PER: "99422", // Pérou,
188
+ URY: "99423", // Uruguay,
189
+ VEN: "99424", // Vénézuéla,
190
+ JAM: "99426", // Jamaïque,
191
+ GUY: "99428", // Guyana,
192
+ BLZ: "99429", // Bélize,
193
+ GRL: "99430", // Groenland,
194
+ ABW: "99431", // Aruba,
195
+ TTO: "99433", // Trinité-et-Tobago,
196
+ BRB: "99434", // Barbade,
197
+ GRD: "99435", // Grenade,
198
+ BHS: "99436", // Bahamas,
199
+ SUR: "99437", // Suriname,
200
+ DMA: "99438", // Dominique,
201
+ LCA: "99439", // Sainte-Lucie,
202
+ VCT: "99440", // Saint-Vincent-et-les-Grenadines,
203
+ ATG: "99441", // Antigua-et-Barbuda,
204
+ KNA: "99442", // Saint-Christophe-et-Niévès,
205
+ BES: "99443", // Bonaire, Saint-Eustache, Saba,
206
+ CUW: "99444", // Curaçao,
207
+ SXM: "99445", // Saint-Martin (partie néerlandaise),
208
+ AUS: "99501", // Australie,
209
+ NZL: "99502", // Nouvelle-Zélande,
210
+ PCN: "99503", // Pitcairn,
211
+ WSM: "99506", // Samoa,
212
+ NRU: "99507", // Nauru,
213
+ FJI: "99508", // Fidji,
214
+ TON: "99509", // Tonga,
215
+ PNG: "99510", // Papouasie-Nouvelle-Guinée,
216
+ TUV: "99511", // Tuvalu,
217
+ SLB: "99512", // Salomon,
218
+ KIR: "99513", // Kiribati,
219
+ VUT: "99514", // Vanuatu,
220
+ MHL: "99515", // Marshall,
221
+ FSM: "99516", // Micronésie,
222
+ PLW: "99517", // Palaos,
223
+ COK: "99520", // Cook,
224
+ NIU: "99521", // Niue,
225
+ ATA: "99699", // Antarctique
226
+ FR: "99100", // France,
227
+ DK: "99101", // Danemark,
228
+ IS: "99102", // Islande,
229
+ NO: "99103", // Norvège,
230
+ SE: "99104", // Suède,
231
+ FI: "99105", // Finlande,
232
+ EE: "99106", // Estonie,
233
+ LV: "99107", // Lettonie,
234
+ LT: "99108", // Lituanie,
235
+ DE: "99109", // Allemagne,
236
+ AT: "99110", // Autriche,
237
+ BG: "99111", // Bulgarie,
238
+ HU: "99112", // Hongrie,
239
+ LI: "99113", // Liechtenstein,
240
+ RO: "99114", // Roumanie,
241
+ CZ: "99116", // Tchéquie,
242
+ SK: "99117", // Slovaquie,
243
+ BA: "99118", // Bosnie-Herzégovine,
244
+ HR: "99119", // Croatie,
245
+ ME: "99120", // Monténégro,
246
+ RS: "99121", // Serbie,
247
+ PL: "99122", // Pologne,
248
+ RU: "99123", // Russie,
249
+ AL: "99125", // Albanie,
250
+ GR: "99126", // Grèce,
251
+ IT: "99127", // Italie,
252
+ SM: "99128", // Saint-Marin,
253
+ VA: "99129", // Vatican,
254
+ AD: "99130", // Andorre,
255
+ BE: "99131", // Belgique,
256
+ GB: "99132", // Royaume-Uni,
257
+ GI: "99133", // Territoires britanniques en Méditerranée,
258
+ ES: "99134", // Espagne,
259
+ NL: "99135", // Pays-Bas,
260
+ IE: "99136", // Irlande,
261
+ LU: "99137", // Luxembourg,
262
+ MC: "99138", // Monaco,
263
+ PT: "99139", // Portugal,
264
+ CH: "99140", // Suisse,
265
+ MT: "99144", // Malte,
266
+ SI: "99145", // Slovénie,
267
+ BY: "99148", // Biélorussie,
268
+ MD: "99151", // Moldavie,
269
+ UA: "99155", // Ukraine,
270
+ MK: "99156", // Macédoine du Nord,
271
+ FO: "99158", // Féroé,
272
+ AX: "99160", // Åland,
273
+ SA: "99201", // Arabie saoudite,
274
+ IQ: "99203", // Irak,
275
+ IR: "99204", // Iran,
276
+ LB: "99205", // Liban,
277
+ SY: "99206", // Syrie,
278
+ IL: "99207", // Israël,
279
+ TR: "99208", // Turquie,
280
+ AF: "99212", // Afghanistan,
281
+ PK: "99213", // Pakistan,
282
+ BT: "99214", // Bhoutan,
283
+ NP: "99215", // Népal,
284
+ CN: "99216", // Chine,
285
+ JP: "99217", // Japon,
286
+ TH: "99219", // Thaïlande,
287
+ PH: "99220", // Philippines,
288
+ JO: "99222", // Jordanie,
289
+ IN: "99223", // Inde,
290
+ MM: "99224", // Birmanie,
291
+ BN: "99225", // Brunei,
292
+ SG: "99226", // Singapour,
293
+ MY: "99227", // Malaisie,
294
+ MV: "99229", // Maldives,
295
+ HK: "99230", // Hong Kong,
296
+ ID: "99231", // Indonésie,
297
+ MO: "99232", // Macao,
298
+ KH: "99234", // Cambodge,
299
+ LK: "99235", // Sri Lanka,
300
+ TW: "99236", // Taïwan,
301
+ KP: "99238", // Corée du Nord,
302
+ KR: "99239", // Corée du Sud,
303
+ KW: "99240", // Koweït,
304
+ LA: "99241", // Laos,
305
+ MN: "99242", // Mongolie,
306
+ VN: "99243", // Vietnam,
307
+ BD: "99246", // Bangladesh,
308
+ AE: "99247", // Émirats arabes unis,
309
+ QA: "99248", // Qatar,
310
+ BH: "99249", // Bahreïn,
311
+ OM: "99250", // Oman,
312
+ YE: "99251", // Yémen,
313
+ AM: "99252", // Arménie,
314
+ AZ: "99253", // Azerbaïdjan,
315
+ CY: "99254", // Chypre,
316
+ GE: "99255", // Géorgie,
317
+ KZ: "99256", // Kazakhstan,
318
+ KG: "99257", // Kirghizstan,
319
+ UZ: "99258", // Ouzbékistan,
320
+ TJ: "99259", // Tadjikistan,
321
+ TM: "99260", // Turkménistan,
322
+ PS: "99261", // Palestine,
323
+ TL: "99262", // Timor oriental,
324
+ EG: "99301", // Égypte,
325
+ LR: "99302", // Libéria,
326
+ ZA: "99303", // Afrique du Sud,
327
+ GM: "99304", // Gambie,
328
+ SH: "99306", // Territoires britanniques de l’océan Atlantique,
329
+ IO: "99308", // Territoire britannique de l’océan Indien,
330
+ TZ: "99309", // Tanzanie,
331
+ ZW: "99310", // Zimbabwe,
332
+ CD: "99312", // République démocratique du Congo,
333
+ GQ: "99314", // Guinée équatoriale,
334
+ ET: "99315", // Éthiopie,
335
+ LY: "99316", // Libye,
336
+ ER: "99317", // Érythrée,
337
+ SO: "99318", // Somalie,
338
+ BI: "99321", // Burundi,
339
+ CM: "99322", // Cameroun,
340
+ CF: "99323", // Centrafrique,
341
+ CG: "99324", // Congo,
342
+ CI: "99326", // Côte d’Ivoire,
343
+ BJ: "99327", // Bénin,
344
+ GA: "99328", // Gabon,
345
+ GH: "99329", // Ghana,
346
+ GN: "99330", // Guinée,
347
+ BF: "99331", // Burkina,
348
+ KE: "99332", // Kenya,
349
+ MG: "99333", // Madagascar,
350
+ MW: "99334", // Malawi,
351
+ ML: "99335", // Mali,
352
+ MR: "99336", // Mauritanie,
353
+ NE: "99337", // Niger,
354
+ NG: "99338", // Nigéria,
355
+ UG: "99339", // Ouganda,
356
+ RW: "99340", // Rwanda,
357
+ SN: "99341", // Sénégal,
358
+ SL: "99342", // Sierra Leone,
359
+ SD: "99343", // Soudan,
360
+ TD: "99344", // Tchad,
361
+ TG: "99345", // Togo,
362
+ ZM: "99346", // Zambie,
363
+ BW: "99347", // Botswana,
364
+ LS: "99348", // Lesotho,
365
+ SS: "99349", // Soudan du Sud,
366
+ MA: "99350", // Maroc,
367
+ TN: "99351", // Tunisie,
368
+ DZ: "99352", // Algérie,
369
+ EH: "99389", // Sahara occidental,
370
+ MU: "99390", // Maurice,
371
+ SZ: "99391", // Swaziland,
372
+ GW: "99392", // Guinée-Bissao,
373
+ MZ: "99393", // Mozambique,
374
+ ST: "99394", // Sao Tomé-et-Principe,
375
+ AO: "99395", // Angola,
376
+ CV: "99396", // Cap-Vert,
377
+ KM: "99397", // Comores,
378
+ SC: "99398", // Seychelles,
379
+ DJ: "99399", // Djibouti,
380
+ CA: "99401", // Canada,
381
+ US: "99404", // États-Unis,
382
+ MX: "99405", // Mexique,
383
+ CR: "99406", // Costa Rica,
384
+ CU: "99407", // Cuba,
385
+ DO: "99408", // République dominicaine,
386
+ GT: "99409", // Guatémala,
387
+ HT: "99410", // Haïti,
388
+ HN: "99411", // Honduras,
389
+ NI: "99412", // Nicaragua,
390
+ PA: "99413", // Panama,
391
+ SV: "99414", // Salvador,
392
+ AR: "99415", // Argentine,
393
+ BR: "99416", // Brésil,
394
+ CL: "99417", // Chili,
395
+ BO: "99418", // Bolivie,
396
+ CO: "99419", // Colombie,
397
+ EC: "99420", // Équateur,
398
+ PY: "99421", // Paraguay,
399
+ PE: "99422", // Pérou,
400
+ UY: "99423", // Uruguay,
401
+ VE: "99424", // Vénézuéla,
402
+ JM: "99426", // Jamaïque,
403
+ GY: "99428", // Guyana,
404
+ BZ: "99429", // Bélize,
405
+ GL: "99430", // Groenland,
406
+ AW: "99431", // Aruba,
407
+ TT: "99433", // Trinité-et-Tobago,
408
+ BB: "99434", // Barbade,
409
+ GD: "99435", // Grenade,
410
+ BS: "99436", // Bahamas,
411
+ SR: "99437", // Suriname,
412
+ DM: "99438", // Dominique,
413
+ LC: "99439", // Sainte-Lucie,
414
+ VC: "99440", // Saint-Vincent-et-les-Grenadines,
415
+ AG: "99441", // Antigua-et-Barbuda,
416
+ KN: "99442", // Saint-Christophe-et-Niévès,
417
+ BQ: "99443", // Bonaire, Saint-Eustache, Saba,
418
+ CW: "99444", // Curaçao,
419
+ SX: "99445", // Saint-Martin (partie néerlandaise),
420
+ AU: "99501", // Australie,
421
+ NZ: "99502", // Nouvelle-Zélande,
422
+ PN: "99503", // Pitcairn,
423
+ WS: "99506", // Samoa,
424
+ NR: "99507", // Nauru,
425
+ FJ: "99508", // Fidji,
426
+ TO: "99509", // Tonga,
427
+ PG: "99510", // Papouasie-Nouvelle-Guinée,
428
+ TV: "99511", // Tuvalu,
429
+ SB: "99512", // Salomon,
430
+ KI: "99513", // Kiribati,
431
+ VU: "99514", // Vanuatu,
432
+ MH: "99515", // Marshall,
433
+ FM: "99516", // Micronésie,
434
+ PW: "99517", // Palaos,
435
+ CK: "99520", // Cook,
436
+ NU: "99521", // Niue,
437
+ AQ: "99699", // Antarctique
438
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./commune-code-conversion.js";
2
+ export * from "./country-iso-to-cog.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/certification/index.ts"],"names":[],"mappings":"AAEA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ //
2
+ export * from "./commune-code-conversion.js";
3
+ export * from "./country-iso-to-cog.js";
@@ -1,4 +1,4 @@
1
1
  import type { IdentityVector } from "#src/types";
2
2
  import type { InfogreffeSirenMandatairesSociaux } from "@proconnect-gouv/proconnect.api_entreprise/types";
3
- export declare function fromInfogreffe(mandataire: InfogreffeSirenMandatairesSociaux): IdentityVector;
4
- //# sourceMappingURL=index.d.ts.map
3
+ export declare function toIdentityVector(mandataire: InfogreffeSirenMandatairesSociaux): IdentityVector;
4
+ //# sourceMappingURL=api_entreprise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api_entreprise.d.ts","sourceRoot":"","sources":["../../../../src/managers/certification/adapters/api_entreprise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC;AAK1G,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,iCAAiC,GAC5C,cAAc,CAYhB"}
@@ -0,0 +1,14 @@
1
+ import { convertCountryIsoToCog } from "../birthplace-conversion.js";
2
+ //
3
+ export function toIdentityVector(mandataire) {
4
+ const birthcountry = convertCountryIsoToCog(mandataire.code_pays_naissance);
5
+ const birthdate = new Date(mandataire.date_naissance_timestamp || NaN);
6
+ return {
7
+ birthcountry,
8
+ birthdate: isNaN(birthdate.getTime()) ? null : birthdate,
9
+ birthplace: null, // API Entreprise Infogreffe doesn't provide Insee code for birthplace
10
+ family_name: mandataire.nom ?? null,
11
+ gender: null, // API Entreprise Infogreffe doesn't provide gender
12
+ given_name: mandataire.prenom ?? null,
13
+ };
14
+ }
@@ -0,0 +1,3 @@
1
+ import type { FranceConnectUserInfo, IdentityVector } from "#src/types";
2
+ export declare function toIdentityVector(userInfo: FranceConnectUserInfo): IdentityVector;
3
+ //# sourceMappingURL=franceconnect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"franceconnect.d.ts","sourceRoot":"","sources":["../../../../src/managers/certification/adapters/franceconnect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKxE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,qBAAqB,GAC9B,cAAc,CAWhB"}
@@ -0,0 +1,15 @@
1
+ //
2
+ import { match } from "ts-pattern";
3
+ //
4
+ export function toIdentityVector(userInfo) {
5
+ return {
6
+ birthcountry: userInfo.birthcountry,
7
+ birthdate: userInfo.birthdate,
8
+ birthplace: userInfo.birthplace,
9
+ family_name: userInfo.family_name,
10
+ gender: match(userInfo.gender.toLowerCase())
11
+ .with("male", "female", (value) => value)
12
+ .otherwise(() => null),
13
+ given_name: userInfo.given_name,
14
+ };
15
+ }
@@ -0,0 +1,4 @@
1
+ import type { IdentityVector } from "#src/types";
2
+ import type { InseSirenUniteLegale } from "@proconnect-gouv/proconnect.insee/types";
3
+ export declare function toIdentityVector(uniteLegale: InseSirenUniteLegale): IdentityVector;
4
+ //# sourceMappingURL=insee.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insee.d.ts","sourceRoot":"","sources":["../../../../src/managers/certification/adapters/insee.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAKpF,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,oBAAoB,GAChC,cAAc,CA6BhB"}
@@ -0,0 +1,29 @@
1
+ import { formatBirthdate } from "@proconnect-gouv/proconnect.insee/formatters";
2
+ import { match } from "ts-pattern";
3
+ //
4
+ export function toIdentityVector(uniteLegale) {
5
+ let birthdate = null;
6
+ const nomUniteLegale = uniteLegale.periodesUniteLegale?.at(0)?.nomUniteLegale;
7
+ if (uniteLegale?.dateNaissanceUniteLegale) {
8
+ const parsedDate = formatBirthdate(String(uniteLegale.dateNaissanceUniteLegale));
9
+ birthdate = isNaN(parsedDate.getTime()) ? null : parsedDate;
10
+ }
11
+ return {
12
+ birthcountry: uniteLegale?.codePaysNaissanceUniteLegale ?? null,
13
+ birthdate,
14
+ birthplace: uniteLegale?.codeCommuneNaissanceUniteLegale ?? null,
15
+ family_name: nomUniteLegale ?? null,
16
+ gender: match(uniteLegale?.sexeUniteLegale)
17
+ .with("M", () => "male")
18
+ .with("F", () => "female")
19
+ .otherwise(() => null),
20
+ given_name: [
21
+ uniteLegale?.prenom1UniteLegale,
22
+ uniteLegale?.prenom2UniteLegale,
23
+ uniteLegale?.prenom3UniteLegale,
24
+ uniteLegale?.prenom4UniteLegale,
25
+ ]
26
+ .filter(Boolean)
27
+ .join(" "),
28
+ };
29
+ }
@@ -0,0 +1,4 @@
1
+ import type { IdentityVector } from "#src/types";
2
+ import type { FindPouvoirsBySirenHandler } from "@proconnect-gouv/proconnect.registre_national_entreprises/api";
3
+ export declare function toIdentityVector(pouvoir: NonNullable<Awaited<ReturnType<FindPouvoirsBySirenHandler>>[number]>): IdentityVector;
4
+ //# sourceMappingURL=rne.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rne.d.ts","sourceRoot":"","sources":["../../../../src/managers/certification/adapters/rne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAShH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAC5E,cAAc,CAmDhB"}
@@ -0,0 +1,45 @@
1
+ import { match } from "ts-pattern";
2
+ import { convertCountryIsoToCog, isValidBirthplaceFormat, } from "../birthplace-conversion.js";
3
+ //
4
+ export function toIdentityVector(pouvoir) {
5
+ const descriptionPersonne = pouvoir.individu?.descriptionPersonne;
6
+ const dateMatch = String(descriptionPersonne?.dateDeNaissance).match(/^(?<year>\d+)-(?<month>\d{2})-(?<day>\d{2})$/);
7
+ const { day, month, year } = dateMatch?.groups ?? {
8
+ day: NaN,
9
+ month: NaN,
10
+ year: NaN,
11
+ };
12
+ const date = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
13
+ const birthdate = isNaN(date.getTime()) ? null : date;
14
+ // For RNE:
15
+ // birthplace: Use codeInseeGeographique only if:
16
+ // - codePostalNaissance is present
17
+ // - codeInseeGeographique has valid format (5 digits or 2A/2B + 3 digits)
18
+ // - first 2 chars are not "99" (not a foreign country code)
19
+ let birthplace = null;
20
+ const codeInseeGeographique = descriptionPersonne?.codeInseeGeographique;
21
+ const codePostalNaissance = descriptionPersonne?.codePostalNaissance;
22
+ if (codePostalNaissance &&
23
+ codeInseeGeographique &&
24
+ isValidBirthplaceFormat(codeInseeGeographique) &&
25
+ !codeInseeGeographique.startsWith("99")) {
26
+ birthplace = codeInseeGeographique;
27
+ }
28
+ // birthcountry: Convert paysNaissance from ISO 3166 to COG format
29
+ let birthcountry = null;
30
+ const codePaysNaissance = descriptionPersonne?.codePaysNaissance;
31
+ if (codePaysNaissance) {
32
+ birthcountry = convertCountryIsoToCog(codePaysNaissance);
33
+ }
34
+ return {
35
+ birthcountry,
36
+ birthdate,
37
+ birthplace,
38
+ family_name: descriptionPersonne?.nom ?? null,
39
+ gender: match(descriptionPersonne?.genre)
40
+ .with("1", () => "male")
41
+ .with("2", () => "female")
42
+ .otherwise(() => null),
43
+ given_name: descriptionPersonne?.prenoms?.join(" ") ?? null,
44
+ };
45
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Converts a commune code to a canonical representation,
3
+ * ensuring consistency across historical and current versions.
4
+ * If the code is not in the conversion table, returns the original code.
5
+ *
6
+ * @param communeCode - The commune code to convert (format: XXXXX or 2AXXX or 2BXXX)
7
+ * @returns The converted code, or the original if no conversion is needed
8
+ */
9
+ export declare function convertCommuneCode(communeCode: string | null | undefined): string | null;
10
+ /**
11
+ * Converts an ISO 3166 country code (2 or 3-letter) to COG format (5-digit).
12
+ *
13
+ * @param iso3166Code - The ISO 3166 country code (e.g., "IRL", "FRA")
14
+ * @returns The COG code (e.g., "99136"), or null if not found
15
+ */
16
+ export declare function convertCountryIsoToCog(iso3166Code: string | null | undefined): string | null;
17
+ /**
18
+ * Validates if a birthplace code has the correct COG format.
19
+ * Valid formats:
20
+ * - 5 digits (e.g., "75001")
21
+ * - 2A or 2B + 3 digits (e.g., "2A001", "2B042" for Corsica)
22
+ *
23
+ * @param birthplaceCode - The birthplace code to validate
24
+ * @returns true if the format is valid, false otherwise
25
+ */
26
+ export declare function isValidBirthplaceFormat(birthplaceCode: string | null | undefined): boolean;
27
+ //# sourceMappingURL=birthplace-conversion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"birthplace-conversion.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/birthplace-conversion.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACrC,MAAM,GAAG,IAAI,CAMf;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACrC,MAAM,GAAG,IAAI,CAKf;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACxC,OAAO,CAMT"}