@tricoteuses/senat 3.1.20 → 3.1.22

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 (363) hide show
  1. package/lib/add-js-extensions-v2.d.ts +1 -0
  2. package/lib/add-js-extensions-v2.js +23 -0
  3. package/lib/add-js-extensions.d.ts +1 -0
  4. package/lib/add-js-extensions.js +17 -0
  5. package/lib/aggregates.d.ts +52 -0
  6. package/lib/aggregates.js +930 -0
  7. package/lib/aggregates.mjs +713 -0
  8. package/lib/aggregates.ts +833 -0
  9. package/lib/config.d.ts +10 -0
  10. package/lib/config.js +16 -0
  11. package/lib/config.mjs +16 -0
  12. package/lib/config.ts +26 -0
  13. package/lib/databases.d.ts +2 -0
  14. package/lib/databases.js +26 -0
  15. package/lib/databases.mjs +57 -0
  16. package/lib/databases.ts +71 -0
  17. package/lib/datasets.d.ts +34 -0
  18. package/lib/datasets.js +233 -0
  19. package/lib/datasets.mjs +78 -0
  20. package/lib/datasets.ts +118 -0
  21. package/lib/fields.d.ts +10 -0
  22. package/lib/fields.js +68 -0
  23. package/lib/fields.mjs +22 -0
  24. package/lib/fields.ts +29 -0
  25. package/lib/git.d.ts +26 -0
  26. package/lib/git.js +167 -0
  27. package/lib/index.d.ts +13 -0
  28. package/lib/index.js +1 -0
  29. package/lib/index.mjs +7 -0
  30. package/lib/index.ts +64 -0
  31. package/lib/inserters.d.ts +98 -0
  32. package/lib/inserters.js +500 -0
  33. package/lib/inserters.mjs +360 -0
  34. package/lib/inserters.ts +521 -0
  35. package/lib/legislatures.json +38 -0
  36. package/lib/loaders.d.ts +58 -0
  37. package/lib/loaders.js +286 -0
  38. package/lib/loaders.mjs +158 -0
  39. package/lib/loaders.ts +271 -0
  40. package/lib/model/agenda.d.ts +6 -0
  41. package/lib/model/agenda.js +148 -0
  42. package/lib/model/ameli.d.ts +51 -0
  43. package/lib/model/ameli.js +149 -0
  44. package/lib/model/ameli.mjs +84 -0
  45. package/lib/model/ameli.ts +100 -0
  46. package/lib/model/commission.d.ts +18 -0
  47. package/lib/model/commission.js +269 -0
  48. package/lib/model/debats.d.ts +67 -0
  49. package/lib/model/debats.js +95 -0
  50. package/lib/model/debats.mjs +43 -0
  51. package/lib/model/debats.ts +68 -0
  52. package/lib/model/documents.d.ts +12 -0
  53. package/lib/model/documents.js +151 -0
  54. package/lib/model/dosleg.d.ts +7 -0
  55. package/lib/model/dosleg.js +326 -0
  56. package/lib/model/dosleg.mjs +196 -0
  57. package/lib/model/dosleg.ts +240 -0
  58. package/lib/model/index.d.ts +7 -0
  59. package/lib/model/index.js +7 -0
  60. package/lib/model/index.mjs +5 -0
  61. package/lib/model/index.ts +15 -0
  62. package/lib/model/questions.d.ts +45 -0
  63. package/lib/model/questions.js +89 -0
  64. package/lib/model/questions.mjs +71 -0
  65. package/lib/model/questions.ts +93 -0
  66. package/lib/model/scrutins.d.ts +13 -0
  67. package/lib/model/scrutins.js +114 -0
  68. package/lib/model/seance.d.ts +3 -0
  69. package/lib/model/seance.js +267 -0
  70. package/lib/model/sens.d.ts +146 -0
  71. package/lib/model/sens.js +454 -0
  72. package/lib/model/sens.mjs +415 -0
  73. package/lib/model/sens.ts +516 -0
  74. package/lib/model/texte.d.ts +7 -0
  75. package/lib/model/texte.js +256 -0
  76. package/lib/model/texte.mjs +208 -0
  77. package/lib/model/texte.ts +229 -0
  78. package/lib/model/util.d.ts +9 -0
  79. package/lib/model/util.js +38 -0
  80. package/lib/model/util.mjs +19 -0
  81. package/lib/model/util.ts +32 -0
  82. package/lib/parsers/texte.d.ts +7 -0
  83. package/lib/parsers/texte.js +228 -0
  84. package/lib/raw_types/ameli.d.ts +914 -0
  85. package/lib/raw_types/ameli.js +5 -0
  86. package/lib/raw_types/ameli.mjs +163 -0
  87. package/lib/raw_types/debats.d.ts +207 -0
  88. package/lib/raw_types/debats.js +5 -0
  89. package/lib/raw_types/debats.mjs +58 -0
  90. package/lib/raw_types/dosleg.d.ts +1619 -0
  91. package/lib/raw_types/dosleg.js +5 -0
  92. package/lib/raw_types/dosleg.mjs +438 -0
  93. package/lib/raw_types/questions.d.ts +419 -0
  94. package/lib/raw_types/questions.js +5 -0
  95. package/lib/raw_types/questions.mjs +11 -0
  96. package/lib/raw_types/senat.d.ts +11368 -0
  97. package/lib/raw_types/senat.js +5 -0
  98. package/lib/raw_types/sens.d.ts +8248 -0
  99. package/lib/raw_types/sens.js +5 -0
  100. package/lib/raw_types/sens.mjs +508 -0
  101. package/lib/raw_types_kysely/ameli.d.ts +915 -0
  102. package/lib/raw_types_kysely/ameli.js +7 -0
  103. package/lib/raw_types_kysely/ameli.mjs +5 -0
  104. package/lib/raw_types_kysely/ameli.ts +951 -0
  105. package/lib/raw_types_kysely/debats.d.ts +207 -0
  106. package/lib/raw_types_kysely/debats.js +7 -0
  107. package/lib/raw_types_kysely/debats.mjs +5 -0
  108. package/lib/raw_types_kysely/debats.ts +222 -0
  109. package/lib/raw_types_kysely/dosleg.d.ts +3532 -0
  110. package/lib/raw_types_kysely/dosleg.js +7 -0
  111. package/lib/raw_types_kysely/dosleg.mjs +5 -0
  112. package/lib/raw_types_kysely/dosleg.ts +3621 -0
  113. package/lib/raw_types_kysely/questions.d.ts +414 -0
  114. package/lib/raw_types_kysely/questions.js +7 -0
  115. package/lib/raw_types_kysely/questions.mjs +5 -0
  116. package/lib/raw_types_kysely/questions.ts +426 -0
  117. package/lib/raw_types_kysely/sens.d.ts +4394 -0
  118. package/lib/raw_types_kysely/sens.js +7 -0
  119. package/lib/raw_types_kysely/sens.mjs +5 -0
  120. package/lib/raw_types_kysely/sens.ts +4499 -0
  121. package/lib/raw_types_schemats/ameli.d.ts +539 -0
  122. package/lib/raw_types_schemats/ameli.js +2 -0
  123. package/lib/raw_types_schemats/ameli.mjs +2 -0
  124. package/lib/raw_types_schemats/ameli.ts +601 -0
  125. package/lib/raw_types_schemats/debats.d.ts +127 -0
  126. package/lib/raw_types_schemats/debats.js +2 -0
  127. package/lib/raw_types_schemats/debats.mjs +2 -0
  128. package/lib/raw_types_schemats/debats.ts +145 -0
  129. package/lib/raw_types_schemats/dosleg.d.ts +977 -0
  130. package/lib/raw_types_schemats/dosleg.js +2 -0
  131. package/lib/raw_types_schemats/dosleg.mjs +2 -0
  132. package/lib/raw_types_schemats/dosleg.ts +2193 -0
  133. package/lib/raw_types_schemats/questions.d.ts +235 -0
  134. package/lib/raw_types_schemats/questions.js +2 -0
  135. package/lib/raw_types_schemats/questions.mjs +2 -0
  136. package/lib/raw_types_schemats/questions.ts +249 -0
  137. package/lib/raw_types_schemats/sens.d.ts +6915 -0
  138. package/lib/raw_types_schemats/sens.js +2 -0
  139. package/lib/raw_types_schemats/sens.mjs +2 -0
  140. package/lib/raw_types_schemats/sens.ts +2907 -0
  141. package/lib/scripts/convert_data.d.ts +1 -0
  142. package/lib/scripts/convert_data.js +354 -0
  143. package/lib/scripts/convert_data.mjs +181 -0
  144. package/lib/scripts/convert_data.ts +243 -0
  145. package/lib/scripts/data-download.d.ts +1 -0
  146. package/lib/scripts/data-download.js +12 -0
  147. package/lib/scripts/datautil.d.ts +8 -0
  148. package/lib/scripts/datautil.js +34 -0
  149. package/lib/scripts/datautil.mjs +16 -0
  150. package/lib/scripts/datautil.ts +19 -0
  151. package/lib/scripts/images/transparent_150x192.jpg +0 -0
  152. package/lib/scripts/images/transparent_155x225.jpg +0 -0
  153. package/lib/scripts/parse_textes.d.ts +1 -0
  154. package/lib/scripts/parse_textes.js +44 -0
  155. package/lib/scripts/parse_textes.mjs +46 -0
  156. package/lib/scripts/parse_textes.ts +65 -0
  157. package/lib/scripts/retrieve_agenda.d.ts +1 -0
  158. package/lib/scripts/retrieve_agenda.js +132 -0
  159. package/lib/scripts/retrieve_cr_commission.d.ts +1 -0
  160. package/lib/scripts/retrieve_cr_commission.js +364 -0
  161. package/lib/scripts/retrieve_cr_seance.d.ts +6 -0
  162. package/lib/scripts/retrieve_cr_seance.js +347 -0
  163. package/lib/scripts/retrieve_documents.d.ts +3 -0
  164. package/lib/scripts/retrieve_documents.js +219 -0
  165. package/lib/scripts/retrieve_documents.mjs +249 -0
  166. package/lib/scripts/retrieve_documents.ts +298 -0
  167. package/lib/scripts/retrieve_open_data.d.ts +1 -0
  168. package/lib/scripts/retrieve_open_data.js +315 -0
  169. package/lib/scripts/retrieve_open_data.mjs +217 -0
  170. package/lib/scripts/retrieve_open_data.ts +268 -0
  171. package/lib/scripts/retrieve_senateurs_photos.d.ts +1 -0
  172. package/lib/scripts/retrieve_senateurs_photos.js +147 -0
  173. package/lib/scripts/retrieve_senateurs_photos.mjs +147 -0
  174. package/lib/scripts/retrieve_senateurs_photos.ts +177 -0
  175. package/lib/scripts/retrieve_videos.d.ts +1 -0
  176. package/lib/scripts/retrieve_videos.js +461 -0
  177. package/lib/scripts/shared/cli_helpers.d.ts +95 -0
  178. package/lib/scripts/shared/cli_helpers.js +91 -0
  179. package/lib/scripts/shared/cli_helpers.ts +36 -0
  180. package/lib/scripts/shared/util.d.ts +4 -0
  181. package/lib/scripts/shared/util.js +35 -0
  182. package/lib/scripts/shared/util.ts +33 -0
  183. package/lib/scripts/test_iter_load.d.ts +1 -0
  184. package/lib/scripts/test_iter_load.js +12 -0
  185. package/lib/src/ameli.d.ts +66 -0
  186. package/lib/src/ameli.js +1 -0
  187. package/lib/src/config.d.ts +22 -0
  188. package/lib/src/config.js +17 -7
  189. package/lib/src/conversion_textes.js +5 -1
  190. package/lib/src/databases.d.ts +2 -1
  191. package/lib/src/databases_postgres.d.ts +4 -0
  192. package/lib/src/databases_postgres.js +23 -0
  193. package/lib/src/datasets.d.ts +4 -0
  194. package/lib/src/datasets.js +16 -2
  195. package/lib/src/db_types/ameli.d.ts +1762 -0
  196. package/lib/src/db_types/ameli.js +1074 -0
  197. package/lib/src/db_types/debats.d.ts +380 -0
  198. package/lib/src/db_types/debats.js +266 -0
  199. package/lib/src/db_types/dosleg.d.ts +2954 -0
  200. package/lib/src/db_types/dosleg.js +2005 -0
  201. package/lib/src/db_types/questions.d.ts +699 -0
  202. package/lib/src/db_types/questions.js +493 -0
  203. package/lib/src/db_types/sens.d.ts +7843 -0
  204. package/lib/src/db_types/sens.js +4691 -0
  205. package/lib/src/debats.d.ts +38 -0
  206. package/lib/src/debats.js +1 -0
  207. package/lib/src/dosleg.d.ts +142 -0
  208. package/lib/src/dosleg.js +193 -0
  209. package/lib/src/git.d.ts +1 -0
  210. package/lib/src/git.js +45 -11
  211. package/lib/src/loaders.d.ts +12 -12
  212. package/lib/src/loaders.js +14 -8
  213. package/lib/src/model/agenda.d.ts +1 -1
  214. package/lib/src/model/agenda.js +3 -3
  215. package/lib/src/model/ameli.d.ts +64 -52
  216. package/lib/src/model/ameli.js +147 -145
  217. package/lib/src/model/ameli_postgres.d.ts +67 -0
  218. package/lib/src/model/ameli_postgres.js +150 -0
  219. package/lib/src/model/commission.d.ts +5 -4
  220. package/lib/src/model/commission.js +6 -6
  221. package/lib/src/model/debats.d.ts +38 -66
  222. package/lib/src/model/debats.js +110 -93
  223. package/lib/src/model/documents.d.ts +32 -12
  224. package/lib/src/model/documents.js +171 -130
  225. package/lib/src/model/dosleg.d.ts +142 -5
  226. package/lib/src/model/dosleg.js +298 -156
  227. package/lib/src/model/index.d.ts +7 -7
  228. package/lib/src/model/index.js +7 -7
  229. package/lib/src/model/questions.d.ts +54 -45
  230. package/lib/src/model/questions.js +89 -87
  231. package/lib/src/model/scrutins.d.ts +48 -13
  232. package/lib/src/model/scrutins.js +118 -111
  233. package/lib/src/model/seance.d.ts +1 -1
  234. package/lib/src/model/seance.js +7 -7
  235. package/lib/src/model/sens.d.ts +109 -179
  236. package/lib/src/model/sens.js +384 -484
  237. package/lib/src/model/util.d.ts +0 -8
  238. package/lib/src/model/util.js +0 -23
  239. package/lib/src/other_types/manifest.d.ts +11 -0
  240. package/lib/src/other_types/manifest.js +1 -0
  241. package/lib/src/other_types/questions.d.ts +2 -0
  242. package/lib/src/other_types/questions.js +1 -0
  243. package/lib/src/questions.d.ts +53 -0
  244. package/lib/src/questions.js +1 -0
  245. package/lib/src/raw_types/ameli.d.ts +1651 -803
  246. package/lib/src/raw_types/ameli.js +1074 -5
  247. package/lib/src/raw_types/debats.d.ts +353 -180
  248. package/lib/src/raw_types/debats.js +266 -5
  249. package/lib/src/raw_types/dosleg.d.ts +2862 -1527
  250. package/lib/src/raw_types/dosleg.js +2005 -5
  251. package/lib/src/raw_types/questions.d.ts +671 -395
  252. package/lib/src/raw_types/questions.js +493 -5
  253. package/lib/src/raw_types/sens.d.ts +7743 -8148
  254. package/lib/src/raw_types/sens.js +4691 -5
  255. package/lib/src/raw_types_schemats/ameli.d.ts +4 -2
  256. package/lib/src/raw_types_schemats/debats.d.ts +2 -2
  257. package/lib/src/raw_types_schemats/dosleg.d.ts +2 -2
  258. package/lib/src/raw_types_schemats/questions.d.ts +2 -2
  259. package/lib/src/raw_types_schemats/sens.d.ts +10 -4216
  260. package/lib/src/rich_types/agenda.d.ts +45 -0
  261. package/lib/src/rich_types/agenda.js +1 -0
  262. package/lib/src/rich_types/compte_rendu.d.ts +83 -0
  263. package/lib/src/rich_types/compte_rendu.js +1 -0
  264. package/lib/src/rich_types/dosleg.js +0 -7
  265. package/lib/src/rich_types/sessions.d.ts +6 -0
  266. package/lib/src/rich_types/sessions.js +19 -0
  267. package/lib/src/rich_types/texte.d.ts +72 -0
  268. package/lib/src/rich_types/texte.js +15 -0
  269. package/lib/src/scripts/convert_data.js +4 -5
  270. package/lib/src/scripts/retrieve_agenda.js +38 -4
  271. package/lib/src/scripts/retrieve_cr_commission.js +1 -1
  272. package/lib/src/scripts/retrieve_open_data.js +39 -0
  273. package/lib/src/scripts/retrieve_videos.js +1 -2
  274. package/lib/src/sens.d.ts +104 -0
  275. package/lib/src/sens.js +1 -0
  276. package/lib/src/server/ameli.js +0 -2
  277. package/lib/src/server/conversion_textes.js +1 -1
  278. package/lib/src/server/debats.js +0 -5
  279. package/lib/src/server/documents.js +0 -3
  280. package/lib/src/server/dosleg.js +0 -11
  281. package/lib/src/server/questions.js +0 -1
  282. package/lib/src/server/scrutins.js +0 -4
  283. package/lib/src/server/sens.js +0 -17
  284. package/lib/src/types/ameli.d.ts +1761 -4
  285. package/lib/src/types/ameli.js +1074 -1
  286. package/lib/src/types/debats.d.ts +380 -2
  287. package/lib/src/types/debats.js +266 -1
  288. package/lib/src/types/dosleg.d.ts +2953 -69
  289. package/lib/src/types/dosleg.js +2005 -1
  290. package/lib/src/types/questions.d.ts +699 -2
  291. package/lib/src/types/questions.js +493 -1
  292. package/lib/src/types/sens.d.ts +7842 -9
  293. package/lib/src/types/sens.js +4691 -1
  294. package/lib/src/types/texte.d.ts +2 -2
  295. package/lib/src/utils/manifest.d.ts +6 -0
  296. package/lib/src/utils/manifest.js +37 -0
  297. package/lib/src/utils/reunion_deletion.d.ts +2 -0
  298. package/lib/src/utils/reunion_deletion.js +27 -0
  299. package/lib/strings.d.ts +1 -0
  300. package/lib/strings.js +18 -0
  301. package/lib/strings.mjs +18 -0
  302. package/lib/strings.ts +26 -0
  303. package/lib/tsconfig.tsbuildinfo +1 -0
  304. package/lib/types/agenda.d.ts +44 -0
  305. package/lib/types/agenda.js +1 -0
  306. package/lib/types/ameli.d.ts +5 -0
  307. package/lib/types/ameli.js +1 -0
  308. package/lib/types/ameli.mjs +13 -0
  309. package/lib/types/ameli.ts +21 -0
  310. package/lib/types/compte_rendu.d.ts +83 -0
  311. package/lib/types/compte_rendu.js +1 -0
  312. package/lib/types/debats.d.ts +2 -0
  313. package/lib/types/debats.js +1 -0
  314. package/lib/types/debats.mjs +2 -0
  315. package/lib/types/debats.ts +6 -0
  316. package/lib/types/dosleg.d.ts +70 -0
  317. package/lib/types/dosleg.js +1 -0
  318. package/lib/types/dosleg.mjs +151 -0
  319. package/lib/types/dosleg.ts +284 -0
  320. package/lib/types/questions.d.ts +2 -0
  321. package/lib/types/questions.js +1 -0
  322. package/lib/types/questions.mjs +1 -0
  323. package/lib/types/questions.ts +3 -0
  324. package/lib/types/sens.d.ts +10 -0
  325. package/lib/types/sens.js +1 -0
  326. package/lib/types/sens.mjs +1 -0
  327. package/lib/types/sens.ts +12 -0
  328. package/lib/types/sessions.d.ts +5 -0
  329. package/lib/types/sessions.js +84 -0
  330. package/lib/types/sessions.mjs +43 -0
  331. package/lib/types/sessions.ts +42 -0
  332. package/lib/types/texte.d.ts +74 -0
  333. package/lib/types/texte.js +16 -0
  334. package/lib/types/texte.mjs +16 -0
  335. package/lib/types/texte.ts +76 -0
  336. package/lib/typings/windows-1252.d.js +2 -0
  337. package/lib/typings/windows-1252.d.mjs +2 -0
  338. package/lib/typings/windows-1252.d.ts +11 -0
  339. package/lib/utils/cr_spliting.d.ts +28 -0
  340. package/lib/utils/cr_spliting.js +265 -0
  341. package/lib/utils/date.d.ts +10 -0
  342. package/lib/utils/date.js +100 -0
  343. package/lib/utils/nvs-timecode.d.ts +7 -0
  344. package/lib/utils/nvs-timecode.js +79 -0
  345. package/lib/utils/reunion_grouping.d.ts +9 -0
  346. package/lib/utils/reunion_grouping.js +361 -0
  347. package/lib/utils/reunion_odj_building.d.ts +5 -0
  348. package/lib/utils/reunion_odj_building.js +154 -0
  349. package/lib/utils/reunion_parsing.d.ts +23 -0
  350. package/lib/utils/reunion_parsing.js +209 -0
  351. package/lib/utils/scoring.d.ts +14 -0
  352. package/lib/utils/scoring.js +147 -0
  353. package/lib/utils/string_cleaning.d.ts +7 -0
  354. package/lib/utils/string_cleaning.js +57 -0
  355. package/lib/validators/config.d.ts +9 -0
  356. package/lib/validators/config.js +10 -0
  357. package/lib/validators/config.mjs +54 -0
  358. package/lib/validators/config.ts +79 -0
  359. package/lib/validators/senat.d.ts +0 -0
  360. package/lib/validators/senat.js +28 -0
  361. package/lib/validators/senat.mjs +24 -0
  362. package/lib/validators/senat.ts +26 -0
  363. package/package.json +30 -28
@@ -0,0 +1,38 @@
1
+ export interface DebatAuteurRow {
2
+ code: string | null;
3
+ matricule: string | null;
4
+ nom: string | null;
5
+ prenom: string | null;
6
+ }
7
+ export interface DebatInterventionRow {
8
+ analyse: string | null;
9
+ auteur: DebatAuteurRow | null;
10
+ auteur_code: string;
11
+ fonction_intervenant: string | null;
12
+ id: string | null;
13
+ url: string | null;
14
+ }
15
+ export interface DebatSectionRow {
16
+ categorie: string | null;
17
+ id?: string | null;
18
+ interventions: DebatInterventionRow[];
19
+ lecture_id?: string | null;
20
+ libelle?: string | null;
21
+ numero?: string | null;
22
+ objet: string | null;
23
+ type: string | null;
24
+ url?: string | null;
25
+ }
26
+ export interface DebatLectureRow {
27
+ id: string;
28
+ }
29
+ export interface DebatResult {
30
+ date_seance: string | null;
31
+ etat_synchronisation: string | null;
32
+ id: string | null;
33
+ lectures: DebatLectureRow[];
34
+ numero: string | null;
35
+ sections: DebatSectionRow[];
36
+ sections_divers: DebatSectionRow[];
37
+ url: string | null;
38
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,142 @@
1
+ export interface DossierThemeRow {
2
+ libelle: string;
3
+ }
4
+ export type DossierAuteurRow = {
5
+ matricule: string | null;
6
+ nom_usuel: string;
7
+ ordre: string | null;
8
+ prenom: string | null;
9
+ qualite: string | null;
10
+ role: string | null;
11
+ };
12
+ export type DossierDocumentAnnexeRow = {
13
+ type_document: string;
14
+ url: string | null;
15
+ };
16
+ export type DossierTexte = {
17
+ auteurs?: DossierAuteurRow[] | null;
18
+ code_adoption?: string | null;
19
+ code_organisme?: string | null;
20
+ date?: string | null;
21
+ id?: string | null;
22
+ modification?: string | null;
23
+ numero?: number | string | null;
24
+ ordre_origine?: string | null;
25
+ origine?: string | null;
26
+ session?: number | null;
27
+ titre?: string | null;
28
+ type?: string | null;
29
+ url?: string | null;
30
+ };
31
+ export type DossierRapport = {
32
+ auteurs?: DossierAuteurRow[] | null;
33
+ code_organisme?: string | null;
34
+ date?: string | null;
35
+ documents_annexes?: DossierDocumentAnnexeRow[] | null;
36
+ id?: string | null;
37
+ numero?: number | string | null;
38
+ session?: number | null;
39
+ sous_titre?: string | null;
40
+ titre?: string | null;
41
+ type?: string | null;
42
+ url?: string | null;
43
+ };
44
+ export type DossierDateSeance = {
45
+ date?: string | null;
46
+ };
47
+ export type DossierLectureAssemblee = {
48
+ assemblee?: string | null;
49
+ code_organisme?: string | null;
50
+ date_publication_amendements_commission?: string | null;
51
+ date_publication_amendements_seance?: string | null;
52
+ dates_seances?: DossierDateSeance[] | null;
53
+ libelle_organisme?: string | null;
54
+ loi_intitule_modifie?: string | null;
55
+ numero_petite_loi?: number | null;
56
+ ordre_lecture_assemblee?: string | null;
57
+ origine_proposition?: string | null;
58
+ rapports?: DossierRapport[] | null;
59
+ session?: number | null;
60
+ textes?: DossierTexte[] | null;
61
+ url_cr_debats?: string | null;
62
+ url_petite_loi?: string | null;
63
+ };
64
+ export type DossierLecture = {
65
+ lectures_assemblee?: DossierLectureAssemblee[] | null;
66
+ libelle?: string | null;
67
+ ordre_lecture?: number | string | null;
68
+ type_lecture?: string | null;
69
+ };
70
+ export interface DossierLegislatifResult {
71
+ code: string | null;
72
+ code_dossier_an: string | null;
73
+ code_nature_dossier: string | null;
74
+ code_organisme_resolution: string | null;
75
+ condition_saisine_CoC: string | null;
76
+ date_decision_CoC: string | null;
77
+ date_opposition_procedure_acceleree: string | null;
78
+ date_procedure_acceleree: string | null;
79
+ date_publication_JO: string | null;
80
+ date_publication_JO_correctif_1: string | null;
81
+ date_publication_JO_correctif_2: string | null;
82
+ date_promulgation: string | null;
83
+ date_retrait_procedure_acceleree: string | null;
84
+ date_saisine_CoC: string | null;
85
+ etat_dossier: string | null;
86
+ lectures: DossierLecture[];
87
+ libelle_decision_CoC: string | null;
88
+ libelle_type_dossier: string | null;
89
+ mot_cle: string | null;
90
+ num_decision_CoC: string | null;
91
+ numero: string | null;
92
+ numero_JO: string | null;
93
+ numero_JO_correctif_1: string | null;
94
+ numero_JO_correctif_2: string | null;
95
+ signet: string;
96
+ signet_alternatif: string | null;
97
+ themes: DossierThemeRow[];
98
+ titre: string | null;
99
+ titre_JO: string;
100
+ titre_court: string | null;
101
+ titre_long: string | null;
102
+ titre_long_original: string | null;
103
+ urgence: string | null;
104
+ url: string;
105
+ url_JO: string | null;
106
+ url_JO_correctif_1: string | null;
107
+ url_JO_correctif_2: string | null;
108
+ url_decision_CoC: string | null;
109
+ url_dossier_assemblee_nationale: string | null;
110
+ url_dossier_CoC: string | null;
111
+ url_ordonnance: string | null;
112
+ url_presentation_articles: string | null;
113
+ }
114
+ export type DossierWithLectures = DossierLegislatifResult & {
115
+ actes_legislatifs?: ActeLegislatif[] | null;
116
+ lectures?: DossierLecture[] | null;
117
+ numero_JO?: string | number | null;
118
+ signet: string;
119
+ themes?: DossierThemeRow[] | null;
120
+ url_JO?: string | null;
121
+ url_decision_CoC?: string | null;
122
+ url_dossier_CoC?: string | null;
123
+ };
124
+ export type ActeLegislatif = {
125
+ adoption?: string;
126
+ chambre: "AN" | "SN";
127
+ code_acte: string;
128
+ code_organisme: string | null;
129
+ date: string;
130
+ date_publication_JO?: string | null;
131
+ id?: string | null;
132
+ libelle: string;
133
+ numero?: string | number | null;
134
+ numero_JO?: string | number | null;
135
+ session?: number | null;
136
+ signet_dossier: string;
137
+ texte_url?: string | null;
138
+ uid: string;
139
+ url_legifrance?: string | null;
140
+ };
141
+ export declare function getCodeActeLecture(codeNatureDossier: string, typeLecture: string, assemblee: string): string | null;
142
+ export declare function buildActesLegislatifs(dossier: DossierWithLectures): ActeLegislatif[];
@@ -0,0 +1,193 @@
1
+ export function getCodeActeLecture(codeNatureDossier, typeLecture, assemblee) {
2
+ const codeAssemblee = assemblee === "Sénat" ? "SN" : assemblee === "Assemblée nationale" ? "AN" : null;
3
+ if (typeLecture === "Commission mixte paritaire") {
4
+ return "CMP";
5
+ }
6
+ if (!codeAssemblee) {
7
+ return null;
8
+ }
9
+ if (["ppl", "pjl", "cvn"].includes(codeNatureDossier) && typeLecture === "Première lecture") {
10
+ return `${codeAssemblee}1`;
11
+ }
12
+ if (["ppl", "pjl", "cvn"].includes(codeNatureDossier) && typeLecture === "Deuxième lecture") {
13
+ return `${codeAssemblee}2`;
14
+ }
15
+ if (["ppl", "pjl", "cvn"].includes(codeNatureDossier) && typeLecture === "Troisième lecture") {
16
+ return `${codeAssemblee}3`;
17
+ }
18
+ if (["ppl", "pjl", "cvn"].includes(codeNatureDossier) && typeLecture === "Quatrième lecture") {
19
+ return `${codeAssemblee}4`;
20
+ }
21
+ if (["ppl", "pjl", "cvn"].includes(codeNatureDossier) && typeLecture === "Nouvelle lecture") {
22
+ return `${codeAssemblee}NLEC`;
23
+ }
24
+ if (["ppl", "pjl", "cvn"].includes(codeNatureDossier) && typeLecture === "Lecture définitive") {
25
+ return `${codeAssemblee}LDEF`;
26
+ }
27
+ if (["ppr"].includes(codeNatureDossier) && typeLecture === "Première lecture") {
28
+ return `${codeAssemblee}LUNI`;
29
+ }
30
+ return null;
31
+ }
32
+ function getDateSortValue(value) {
33
+ if (!value) {
34
+ return Number.POSITIVE_INFINITY;
35
+ }
36
+ const timestamp = new Date(value).getTime();
37
+ return Number.isNaN(timestamp) ? Number.POSITIVE_INFINITY : timestamp;
38
+ }
39
+ function compareByDate(left, right) {
40
+ return getDateSortValue(left.date) - getDateSortValue(right.date);
41
+ }
42
+ function getPhasePrefix(lecture, assemblee) {
43
+ if (assemblee !== "Sénat")
44
+ return null;
45
+ const typeLibelle = (lecture.type_lecture || "").toLowerCase();
46
+ if (typeLibelle.includes("cmp") || typeLibelle.includes("mixte"))
47
+ return "CMP";
48
+ if (typeLibelle.includes("nouvelle lecture"))
49
+ return "SNNLEC";
50
+ if (typeLibelle.includes("définitive"))
51
+ return "SNLDEF";
52
+ if (typeLibelle.includes("unique"))
53
+ return "SNLUNI";
54
+ if (lecture.ordre_lecture) {
55
+ return `SN${lecture.ordre_lecture}`;
56
+ }
57
+ if (typeLibelle.includes("première"))
58
+ return "SN1";
59
+ if (typeLibelle.includes("deuxième") || typeLibelle.includes("seconde"))
60
+ return "SN2";
61
+ return "SN1";
62
+ }
63
+ export function buildActesLegislatifs(dossier) {
64
+ const actes = [];
65
+ const loiSignet = dossier.signet;
66
+ const lectures = dossier.lectures ?? [];
67
+ for (const lecture of lectures) {
68
+ const lecturesAssemblee = lecture.lectures_assemblee ?? [];
69
+ for (const lecAss of lecturesAssemblee) {
70
+ if (lecAss.assemblee !== "Sénat")
71
+ continue;
72
+ const phasePrefix = getPhasePrefix(lecture, lecAss.assemblee);
73
+ if (!phasePrefix)
74
+ continue;
75
+ const textes = lecAss.textes ?? [];
76
+ const textesTries = [...textes].sort(compareByDate);
77
+ const depotTexte = textesTries.find((t) => (t.origine || "").toLowerCase().includes("déposé") ||
78
+ (t.origine || "").toLowerCase().includes("transmis") ||
79
+ t.ordre_origine === "0");
80
+ if (depotTexte && depotTexte.date) {
81
+ actes.push({
82
+ code_acte: `${phasePrefix}-DEPOT`,
83
+ date: depotTexte.date,
84
+ libelle: `Dépôt du texte n°${depotTexte.numero}`,
85
+ id: depotTexte.id,
86
+ numero: depotTexte.numero,
87
+ uid: `${loiSignet}-${phasePrefix}-DEPOT`,
88
+ session: lecAss.session,
89
+ chambre: "SN",
90
+ signet_dossier: loiSignet,
91
+ texte_url: depotTexte.url,
92
+ code_organisme: null,
93
+ });
94
+ }
95
+ const rapports = lecAss.rapports ?? [];
96
+ for (const rap of rapports) {
97
+ if (rap.date) {
98
+ actes.push({
99
+ code_acte: `${phasePrefix}-COM-FOND`,
100
+ date: rap.date,
101
+ libelle: `Rapport n°${rap.numero} de la commission`,
102
+ id: rap.id,
103
+ numero: rap.numero,
104
+ code_organisme: rap.code_organisme ?? null,
105
+ uid: `${loiSignet}-${phasePrefix}-COM`,
106
+ session: lecAss.session,
107
+ chambre: "SN",
108
+ signet_dossier: loiSignet,
109
+ texte_url: rap.url,
110
+ });
111
+ }
112
+ }
113
+ const datesSeances = lecAss.dates_seances ?? [];
114
+ if (datesSeances.length > 0) {
115
+ datesSeances.sort(compareByDate);
116
+ const premiereSeance = datesSeances[0];
117
+ if (premiereSeance && premiereSeance.date) {
118
+ actes.push({
119
+ code_acte: `${phasePrefix}-DEBATS-SEANCE`,
120
+ date: premiereSeance.date,
121
+ libelle: "Discussion en séance publique",
122
+ id: null,
123
+ uid: `${loiSignet}-${phasePrefix}-DEBATS-SEANCE`,
124
+ session: lecAss.session,
125
+ chambre: "SN",
126
+ signet_dossier: loiSignet,
127
+ code_organisme: null,
128
+ });
129
+ }
130
+ }
131
+ const texteFinal = [...textesTries].reverse().find((t) => {
132
+ const origine = (t.origine || "").toLowerCase();
133
+ return (origine.includes("adopté") ||
134
+ origine.includes("rejeté") ||
135
+ origine.includes("devenu résolution") ||
136
+ t.code_adoption === "O");
137
+ });
138
+ if (texteFinal && texteFinal.date) {
139
+ const origine = (texteFinal.origine || "").toLowerCase();
140
+ let libelleStatut = "Adopté";
141
+ if (origine.includes("rejeté")) {
142
+ libelleStatut = "Rejeté";
143
+ }
144
+ else if (origine.includes("devenue résolution")) {
145
+ libelleStatut = "Adopté";
146
+ }
147
+ actes.push({
148
+ code_acte: `${phasePrefix}-DEBATS-DEC`,
149
+ date: texteFinal.date,
150
+ libelle: `${libelleStatut === "Adopté" ? "Adoption" : "Rejet"} (Texte n°${texteFinal.numero})`,
151
+ id: texteFinal.id,
152
+ numero: texteFinal.numero,
153
+ adoption: libelleStatut,
154
+ uid: `${loiSignet}-DEC-${texteFinal.numero}`,
155
+ session: lecAss.session,
156
+ chambre: "SN",
157
+ signet_dossier: loiSignet,
158
+ texte_url: texteFinal.url,
159
+ code_organisme: null,
160
+ });
161
+ }
162
+ }
163
+ }
164
+ if (dossier.date_decision_CoC) {
165
+ actes.push({
166
+ code_acte: "CC",
167
+ date: dossier.date_decision_CoC,
168
+ libelle: "Décision du Conseil constitutionnel",
169
+ id: dossier.url_decision_CoC,
170
+ uid: `${loiSignet}-CC`,
171
+ chambre: "AN",
172
+ signet_dossier: loiSignet,
173
+ code_organisme: null,
174
+ texte_url: dossier.url_decision_CoC || dossier.url_dossier_CoC,
175
+ });
176
+ }
177
+ if (dossier.date_promulgation) {
178
+ actes.push({
179
+ code_acte: "PROM",
180
+ date: dossier.date_promulgation,
181
+ libelle: "Promulgation de la loi",
182
+ date_publication_JO: dossier.date_publication_JO,
183
+ numero_JO: dossier.numero_JO,
184
+ url_legifrance: dossier.url_JO,
185
+ id: dossier.url_JO,
186
+ uid: `${loiSignet}-PROM`,
187
+ chambre: "AN",
188
+ signet_dossier: loiSignet,
189
+ code_organisme: null,
190
+ });
191
+ }
192
+ return actes.sort(compareByDate);
193
+ }
package/lib/src/git.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export declare function initRepo(repositoryDir: string): void;
2
2
  export declare function commit(repositoryDir: string, message: string): boolean;
3
3
  export declare function commitAndPush(repositoryDir: string, message: string, remotes?: string[]): number;
4
+ export declare function pull(repositoryDir: string, remote?: string, branch?: string): boolean;
4
5
  export declare function resetAndPull(gitDir: string): boolean;
5
6
  export declare function clone(gitGroupUrl: string | undefined, gitName: string, workingDir: string): void;
6
7
  export declare function run(repositoryDir: string, args: string, verbose?: boolean): string;
package/lib/src/git.js CHANGED
@@ -5,6 +5,15 @@ const MAXBUFFER = 50 * 1024 * 1024;
5
5
  const GIT_LOCK_RETRY_DELAY_MS = 1000;
6
6
  const GIT_LOCK_RETRY_COUNT = 5;
7
7
  const GIT_LOCK_STALE_AFTER_MS = 2 * 60 * 1000;
8
+ function asExecSyncError(error) {
9
+ return error;
10
+ }
11
+ function outputToString(output) {
12
+ if (output == null) {
13
+ return "";
14
+ }
15
+ return Buffer.isBuffer(output) ? output.toString("utf-8") : output;
16
+ }
8
17
  function sleep(ms) {
9
18
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
10
19
  }
@@ -12,7 +21,7 @@ function getIndexLockPath(repositoryDir) {
12
21
  return path.join(repositoryDir, ".git", "index.lock");
13
22
  }
14
23
  function isIndexLockError(error) {
15
- const stderr = String(error?.stderr || "");
24
+ const stderr = error instanceof Error ? outputToString(asExecSyncError(error).stderr) : "";
16
25
  return /index\.lock': File exists\./.test(stderr);
17
26
  }
18
27
  function removeStaleIndexLock(repositoryDir) {
@@ -81,9 +90,9 @@ export function commit(repositoryDir, message) {
81
90
  });
82
91
  return true;
83
92
  }
84
- catch (childProcess) {
85
- if (childProcess.stdout === null ||
86
- !/nothing to commit|rien à valider/.test(childProcess.stdout)) {
93
+ catch (error) {
94
+ const childProcess = asExecSyncError(error);
95
+ if (childProcess.stdout === null || !/nothing to commit|rien à valider/.test(outputToString(childProcess.stdout))) {
87
96
  console.error(childProcess.output);
88
97
  throw childProcess;
89
98
  }
@@ -102,10 +111,11 @@ export function commitAndPush(repositoryDir, message, remotes) {
102
111
  stdio: ["ignore", "ignore", "pipe"],
103
112
  });
104
113
  }
105
- catch (childProcess) {
114
+ catch (error) {
115
+ const childProcess = asExecSyncError(error);
106
116
  // Don't stop when push fails.
107
117
  console.error(childProcess.output);
108
- exitCode = childProcess.status;
118
+ exitCode = childProcess.status ?? 1;
109
119
  }
110
120
  }
111
121
  }
@@ -115,6 +125,27 @@ export function commitAndPush(repositoryDir, message, remotes) {
115
125
  }
116
126
  return exitCode;
117
127
  }
128
+ export function pull(repositoryDir, remote = "origin", branch = "master") {
129
+ initRepo(repositoryDir);
130
+ const statusOutput = execSync("git status --porcelain", {
131
+ cwd: repositoryDir,
132
+ env: process.env,
133
+ encoding: "utf-8",
134
+ stdio: ["ignore", "pipe", "pipe"],
135
+ maxBuffer: MAXBUFFER,
136
+ }).trim();
137
+ if (statusOutput.length > 0) {
138
+ return false;
139
+ }
140
+ execSync(`git pull --rebase ${remote} ${branch}`, {
141
+ cwd: repositoryDir,
142
+ env: process.env,
143
+ encoding: "utf-8",
144
+ stdio: ["ignore", "ignore", "pipe"],
145
+ maxBuffer: MAXBUFFER,
146
+ });
147
+ return true;
148
+ }
118
149
  export function resetAndPull(gitDir) {
119
150
  execSync("git reset --hard origin/master", {
120
151
  cwd: gitDir,
@@ -154,9 +185,11 @@ export function run(repositoryDir, args, verbose) {
154
185
  console.log(output);
155
186
  return output;
156
187
  }
157
- catch (childProcess) {
158
- for (const output of ["stdout", "stderr"])
159
- console.error(`${output}: ${childProcess[output]}`);
188
+ catch (error) {
189
+ const childProcess = asExecSyncError(error);
190
+ for (const output of ["stdout", "stderr"]) {
191
+ console.error(`${output}: ${outputToString(childProcess[output])}`);
192
+ }
160
193
  throw childProcess;
161
194
  }
162
195
  }
@@ -175,8 +208,9 @@ export function test(repositoryDir, args, verbose) {
175
208
  console.log(output);
176
209
  return true;
177
210
  }
178
- catch (childProcess) {
179
- if (childProcess.status != 0)
211
+ catch (error) {
212
+ const childProcess = asExecSyncError(error);
213
+ if (childProcess.status !== 0)
180
214
  return false;
181
215
  throw childProcess;
182
216
  }
@@ -1,15 +1,15 @@
1
- import { AmendementResult } from "./model/ameli";
2
- import { DebatResult } from "./model/debats";
3
- import { DossierLegislatifResult } from "./model/dosleg";
4
- import { QuestionResult } from "./model/questions";
5
- import { ScrutinResult } from "./model/scrutins";
6
- import { CirconscriptionResult, OrganismeResult, SenateurResult } from "./model/sens";
7
- import { Reunion } from "./types/agenda";
8
- import { FlatTexte, DocumentMetadata } from "./types/texte";
9
- import { CompteRendu } from "./types/compte_rendu";
10
- import { DocumentResult } from "./model/documents";
11
- export { EnabledDatasets } from "./datasets";
12
- export type { DocumentResult } from "./model/documents";
1
+ import { AmendementResult } from "./model/ameli.js";
2
+ import { DebatResult } from "./model/debats.js";
3
+ import { DossierLegislatifResult } from "./model/dosleg.js";
4
+ import { QuestionResult } from "./model/questions.js";
5
+ import { ScrutinResult } from "./model/scrutins.js";
6
+ import { CirconscriptionResult, OrganismeResult, SenateurResult } from "./model/sens.js";
7
+ import { Reunion } from "./rich_types/agenda.js";
8
+ import { FlatTexte, DocumentMetadata } from "./rich_types/texte.js";
9
+ import { CompteRendu } from "./rich_types/compte_rendu.js";
10
+ import { DocumentResult } from "./model/documents.js";
11
+ export { EnabledDatasets } from "./datasets.js";
12
+ export type { DocumentResult } from "./model/documents.js";
13
13
  export declare const AGENDA_FOLDER = "agenda";
14
14
  export declare const COMPTES_RENDUS_FOLDER = "seances";
15
15
  export declare const COMMISSION_FOLDER = "commissions";
@@ -1,10 +1,10 @@
1
1
  import fsex from "fs-extra";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
- import * as git from "./git";
5
- import { datasets } from "./datasets";
6
- import { UNDEFINED_SESSION } from "./types/sessions";
7
- export { EnabledDatasets } from "./datasets";
4
+ import * as git from "./git.js";
5
+ import { datasets } from "./datasets.js";
6
+ import { UNDEFINED_SESSION } from "./rich_types/sessions.js";
7
+ export { EnabledDatasets } from "./datasets.js";
8
8
  export const AGENDA_FOLDER = "agenda";
9
9
  export const COMPTES_RENDUS_FOLDER = "seances";
10
10
  export const COMMISSION_FOLDER = "commissions";
@@ -69,7 +69,8 @@ function* iterLoadSenatItems(dataDir, dataName, legislatureOrSession, subDir, {
69
69
  const itemJson = fs.readFileSync(filePath, { encoding: "utf8" });
70
70
  item = JSON.parse(itemJson);
71
71
  }
72
- catch (err) {
72
+ catch (error) {
73
+ const err = error;
73
74
  console.warn(`[iterLoadSenatItems] skipped invalid JSON: ${filePath} (${err.message})`);
74
75
  continue;
75
76
  }
@@ -180,6 +181,9 @@ export function* iterLoadSenatTextes(dataDir, session, options = {}) {
180
181
  const texteItem = iterItem;
181
182
  const texte = texteItem.item;
182
183
  const texteId = texte["id"];
184
+ if (!texteId) {
185
+ continue;
186
+ }
183
187
  const { item: texteContent } = loadSenatTexteContent(dataDir, texte["session"], texteId);
184
188
  if (texteContent) {
185
189
  texteItem.item = { ...texteContent, ...texteItem.item };
@@ -222,9 +226,11 @@ export function* iterLoadSenatAgendas(dataDir, session) {
222
226
  const gr = raw;
223
227
  if (!gr.uid || !gr.date || !gr.titre)
224
228
  continue;
225
- if (!Array.isArray(gr.events))
226
- gr.events = [];
227
- yield { item: gr };
229
+ const reunion = {
230
+ ...gr,
231
+ events: Array.isArray(gr.events) ? gr.events : [],
232
+ };
233
+ yield { item: reunion };
228
234
  }
229
235
  }
230
236
  export function* iterLoadSenatCirconscriptions(dataDir, options = {}) {
@@ -1,4 +1,4 @@
1
- import { AgendaEvent } from "../types/agenda";
1
+ import { AgendaEvent } from "../rich_types/agenda.js";
2
2
  export declare function getStartAndEndTimes(timeStr: string | null | undefined, dateISO: string): {
3
3
  startTime: string | null;
4
4
  endTime: string | null;
@@ -1,7 +1,7 @@
1
1
  import { JSDOM } from "jsdom";
2
2
  import { DateTime } from "luxon";
3
3
  import path from "path";
4
- import { ID_DATE_FORMAT, STANDARD_DATE_FORMAT } from "../scripts/datautil";
4
+ import { ID_DATE_FORMAT, STANDARD_DATE_FORMAT } from "../scripts/datautil.js";
5
5
  const FR_TZ = "Europe/Paris";
6
6
  function eventIsSeance(eventElement) {
7
7
  return eventElement.classList.contains("evt-seance");
@@ -113,7 +113,7 @@ function transformAgenda(document, fileName) {
113
113
  const { startTime, endTime } = getStartAndEndTimes(timeOriginal, date);
114
114
  const titre = eventElement.querySelector(".titre")?.textContent?.trim() || "";
115
115
  const organe = eventElement.querySelector(".organe")?.textContent?.trim() || null;
116
- const objet = eventElement.querySelector(".objet")?.textContent?.trim()?.replace(/^- /, "") || null;
116
+ const objet = eventElement.querySelector(".objet")?.textContent?.trim()?.replace(/^- /, "") || null;
117
117
  const lieu = eventElement.querySelector(".lieu")?.textContent || null;
118
118
  const videoElement = eventElement.querySelector(".video");
119
119
  const urlDossierSenat = getUrlDossierSenat(eventElement.querySelectorAll(".lien a"));
@@ -142,7 +142,7 @@ export async function parseAgendaFromFile(htmlFilePath) {
142
142
  return transformAgenda(document, fileName);
143
143
  }
144
144
  catch (error) {
145
- console.error(`Could not parse texte with error ${error}`);
145
+ console.error(`Could not parse texte with error ${error.message}`);
146
146
  }
147
147
  return null;
148
148
  }