@tricoteuses/senat 2.22.15 → 2.23.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 (328) hide show
  1. package/README.md +168 -0
  2. package/lib/aggregates.d.ts +52 -0
  3. package/lib/aggregates.js +930 -0
  4. package/lib/aggregates.mjs +713 -0
  5. package/lib/aggregates.ts +833 -0
  6. package/lib/config.d.ts +10 -0
  7. package/lib/config.js +16 -0
  8. package/lib/config.mjs +16 -0
  9. package/lib/config.ts +26 -0
  10. package/lib/databases.d.ts +2 -0
  11. package/lib/databases.js +26 -0
  12. package/lib/databases.mjs +57 -0
  13. package/lib/databases.ts +71 -0
  14. package/lib/datasets.d.ts +34 -0
  15. package/lib/datasets.js +233 -0
  16. package/lib/datasets.mjs +78 -0
  17. package/lib/datasets.ts +118 -0
  18. package/lib/fields.d.ts +10 -0
  19. package/lib/fields.js +68 -0
  20. package/lib/fields.mjs +22 -0
  21. package/lib/fields.ts +29 -0
  22. package/lib/git.d.ts +26 -0
  23. package/lib/git.js +167 -0
  24. package/lib/index.d.ts +13 -0
  25. package/lib/index.js +1 -0
  26. package/lib/index.mjs +7 -0
  27. package/lib/index.ts +64 -0
  28. package/lib/inserters.d.ts +98 -0
  29. package/lib/inserters.js +500 -0
  30. package/lib/inserters.mjs +360 -0
  31. package/lib/inserters.ts +521 -0
  32. package/lib/legislatures.json +38 -0
  33. package/lib/loaders.d.ts +58 -0
  34. package/lib/loaders.js +286 -0
  35. package/lib/loaders.mjs +158 -0
  36. package/lib/loaders.ts +271 -0
  37. package/lib/model/agenda.d.ts +6 -0
  38. package/lib/model/agenda.js +148 -0
  39. package/lib/model/ameli.d.ts +51 -0
  40. package/lib/model/ameli.js +149 -0
  41. package/lib/model/ameli.mjs +84 -0
  42. package/lib/model/ameli.ts +100 -0
  43. package/lib/model/commission.d.ts +18 -0
  44. package/lib/model/commission.js +269 -0
  45. package/lib/model/debats.d.ts +67 -0
  46. package/lib/model/debats.js +95 -0
  47. package/lib/model/debats.mjs +43 -0
  48. package/lib/model/debats.ts +68 -0
  49. package/lib/model/documents.d.ts +12 -0
  50. package/lib/model/documents.js +151 -0
  51. package/lib/model/dosleg.d.ts +7 -0
  52. package/lib/model/dosleg.js +326 -0
  53. package/lib/model/dosleg.mjs +196 -0
  54. package/lib/model/dosleg.ts +240 -0
  55. package/lib/model/index.d.ts +7 -0
  56. package/lib/model/index.js +7 -0
  57. package/lib/model/index.mjs +5 -0
  58. package/lib/model/index.ts +15 -0
  59. package/lib/model/questions.d.ts +45 -0
  60. package/lib/model/questions.js +89 -0
  61. package/lib/model/questions.mjs +71 -0
  62. package/lib/model/questions.ts +93 -0
  63. package/lib/model/scrutins.d.ts +13 -0
  64. package/lib/model/scrutins.js +114 -0
  65. package/lib/model/seance.d.ts +3 -0
  66. package/lib/model/seance.js +267 -0
  67. package/lib/model/sens.d.ts +146 -0
  68. package/lib/model/sens.js +454 -0
  69. package/lib/model/sens.mjs +415 -0
  70. package/lib/model/sens.ts +516 -0
  71. package/lib/model/texte.d.ts +7 -0
  72. package/lib/model/texte.js +256 -0
  73. package/lib/model/texte.mjs +208 -0
  74. package/lib/model/texte.ts +229 -0
  75. package/lib/model/util.d.ts +9 -0
  76. package/lib/model/util.js +38 -0
  77. package/lib/model/util.mjs +19 -0
  78. package/lib/model/util.ts +32 -0
  79. package/lib/parsers/texte.d.ts +7 -0
  80. package/lib/parsers/texte.js +228 -0
  81. package/lib/raw_types/ameli.d.ts +914 -0
  82. package/lib/raw_types/ameli.js +5 -0
  83. package/lib/raw_types/ameli.mjs +163 -0
  84. package/lib/raw_types/debats.d.ts +207 -0
  85. package/lib/raw_types/debats.js +5 -0
  86. package/lib/raw_types/debats.mjs +58 -0
  87. package/lib/raw_types/dosleg.d.ts +1619 -0
  88. package/lib/raw_types/dosleg.js +5 -0
  89. package/lib/raw_types/dosleg.mjs +438 -0
  90. package/lib/raw_types/questions.d.ts +419 -0
  91. package/lib/raw_types/questions.js +5 -0
  92. package/lib/raw_types/questions.mjs +11 -0
  93. package/lib/raw_types/senat.d.ts +11368 -0
  94. package/lib/raw_types/senat.js +5 -0
  95. package/lib/raw_types/sens.d.ts +8248 -0
  96. package/lib/raw_types/sens.js +5 -0
  97. package/lib/raw_types/sens.mjs +508 -0
  98. package/lib/raw_types_kysely/ameli.d.ts +915 -0
  99. package/lib/raw_types_kysely/ameli.js +7 -0
  100. package/lib/raw_types_kysely/ameli.mjs +5 -0
  101. package/lib/raw_types_kysely/ameli.ts +951 -0
  102. package/lib/raw_types_kysely/debats.d.ts +207 -0
  103. package/lib/raw_types_kysely/debats.js +7 -0
  104. package/lib/raw_types_kysely/debats.mjs +5 -0
  105. package/lib/raw_types_kysely/debats.ts +222 -0
  106. package/lib/raw_types_kysely/dosleg.d.ts +3532 -0
  107. package/lib/raw_types_kysely/dosleg.js +7 -0
  108. package/lib/raw_types_kysely/dosleg.mjs +5 -0
  109. package/lib/raw_types_kysely/dosleg.ts +3621 -0
  110. package/lib/raw_types_kysely/questions.d.ts +414 -0
  111. package/lib/raw_types_kysely/questions.js +7 -0
  112. package/lib/raw_types_kysely/questions.mjs +5 -0
  113. package/lib/raw_types_kysely/questions.ts +426 -0
  114. package/lib/raw_types_kysely/sens.d.ts +4394 -0
  115. package/lib/raw_types_kysely/sens.js +7 -0
  116. package/lib/raw_types_kysely/sens.mjs +5 -0
  117. package/lib/raw_types_kysely/sens.ts +4499 -0
  118. package/lib/raw_types_schemats/ameli.d.ts +539 -0
  119. package/lib/raw_types_schemats/ameli.js +2 -0
  120. package/lib/raw_types_schemats/ameli.mjs +2 -0
  121. package/lib/raw_types_schemats/ameli.ts +601 -0
  122. package/lib/raw_types_schemats/debats.d.ts +127 -0
  123. package/lib/raw_types_schemats/debats.js +2 -0
  124. package/lib/raw_types_schemats/debats.mjs +2 -0
  125. package/lib/raw_types_schemats/debats.ts +145 -0
  126. package/lib/raw_types_schemats/dosleg.d.ts +977 -0
  127. package/lib/raw_types_schemats/dosleg.js +2 -0
  128. package/lib/raw_types_schemats/dosleg.mjs +2 -0
  129. package/lib/raw_types_schemats/dosleg.ts +2193 -0
  130. package/lib/raw_types_schemats/questions.d.ts +235 -0
  131. package/lib/raw_types_schemats/questions.js +2 -0
  132. package/lib/raw_types_schemats/questions.mjs +2 -0
  133. package/lib/raw_types_schemats/questions.ts +249 -0
  134. package/lib/raw_types_schemats/sens.d.ts +6915 -0
  135. package/lib/raw_types_schemats/sens.js +2 -0
  136. package/lib/raw_types_schemats/sens.mjs +2 -0
  137. package/lib/raw_types_schemats/sens.ts +2907 -0
  138. package/lib/scripts/convert_data.d.ts +1 -0
  139. package/lib/scripts/convert_data.js +354 -0
  140. package/lib/scripts/convert_data.mjs +181 -0
  141. package/lib/scripts/convert_data.ts +243 -0
  142. package/lib/scripts/data-download.d.ts +1 -0
  143. package/lib/scripts/data-download.js +12 -0
  144. package/lib/scripts/datautil.d.ts +8 -0
  145. package/lib/scripts/datautil.js +34 -0
  146. package/lib/scripts/datautil.mjs +16 -0
  147. package/lib/scripts/datautil.ts +19 -0
  148. package/lib/scripts/images/transparent_150x192.jpg +0 -0
  149. package/lib/scripts/images/transparent_155x225.jpg +0 -0
  150. package/lib/scripts/parse_textes.d.ts +1 -0
  151. package/lib/scripts/parse_textes.js +44 -0
  152. package/lib/scripts/parse_textes.mjs +46 -0
  153. package/lib/scripts/parse_textes.ts +65 -0
  154. package/lib/scripts/retrieve_agenda.d.ts +1 -0
  155. package/lib/scripts/retrieve_agenda.js +132 -0
  156. package/lib/scripts/retrieve_cr_commission.d.ts +1 -0
  157. package/lib/scripts/retrieve_cr_commission.js +364 -0
  158. package/lib/scripts/retrieve_cr_seance.d.ts +6 -0
  159. package/lib/scripts/retrieve_cr_seance.js +347 -0
  160. package/lib/scripts/retrieve_documents.d.ts +3 -0
  161. package/lib/scripts/retrieve_documents.js +219 -0
  162. package/lib/scripts/retrieve_documents.mjs +249 -0
  163. package/lib/scripts/retrieve_documents.ts +298 -0
  164. package/lib/scripts/retrieve_open_data.d.ts +1 -0
  165. package/lib/scripts/retrieve_open_data.js +315 -0
  166. package/lib/scripts/retrieve_open_data.mjs +217 -0
  167. package/lib/scripts/retrieve_open_data.ts +268 -0
  168. package/lib/scripts/retrieve_senateurs_photos.d.ts +1 -0
  169. package/lib/scripts/retrieve_senateurs_photos.js +147 -0
  170. package/lib/scripts/retrieve_senateurs_photos.mjs +147 -0
  171. package/lib/scripts/retrieve_senateurs_photos.ts +177 -0
  172. package/lib/scripts/retrieve_videos.d.ts +1 -0
  173. package/lib/scripts/retrieve_videos.js +461 -0
  174. package/lib/scripts/shared/cli_helpers.d.ts +95 -0
  175. package/lib/scripts/shared/cli_helpers.js +91 -0
  176. package/lib/scripts/shared/cli_helpers.ts +36 -0
  177. package/lib/scripts/shared/util.d.ts +4 -0
  178. package/lib/scripts/shared/util.js +35 -0
  179. package/lib/scripts/shared/util.ts +33 -0
  180. package/lib/scripts/test_iter_load.d.ts +1 -0
  181. package/lib/scripts/test_iter_load.js +12 -0
  182. package/lib/src/config.d.ts +22 -0
  183. package/lib/src/config.js +17 -7
  184. package/lib/src/conversion_textes.js +5 -1
  185. package/lib/src/databases.d.ts +2 -1
  186. package/lib/src/databases_postgres.d.ts +4 -0
  187. package/lib/src/databases_postgres.js +23 -0
  188. package/lib/src/datasets.d.ts +4 -0
  189. package/lib/src/datasets.js +16 -2
  190. package/lib/src/git.d.ts +1 -0
  191. package/lib/src/git.js +45 -11
  192. package/lib/src/loaders.js +10 -4
  193. package/lib/src/model/agenda.js +2 -2
  194. package/lib/src/model/ameli.d.ts +64 -52
  195. package/lib/src/model/ameli.js +147 -145
  196. package/lib/src/model/ameli_postgres.d.ts +67 -0
  197. package/lib/src/model/ameli_postgres.js +150 -0
  198. package/lib/src/model/commission.d.ts +3 -2
  199. package/lib/src/model/commission.js +2 -2
  200. package/lib/src/model/debats.d.ts +38 -66
  201. package/lib/src/model/debats.js +110 -93
  202. package/lib/src/model/documents.d.ts +32 -12
  203. package/lib/src/model/documents.js +171 -130
  204. package/lib/src/model/dosleg.d.ts +142 -5
  205. package/lib/src/model/dosleg.js +298 -156
  206. package/lib/src/model/questions.d.ts +54 -45
  207. package/lib/src/model/questions.js +89 -87
  208. package/lib/src/model/scrutins.d.ts +48 -13
  209. package/lib/src/model/scrutins.js +118 -111
  210. package/lib/src/model/seance.js +3 -3
  211. package/lib/src/model/sens.d.ts +109 -179
  212. package/lib/src/model/sens.js +384 -484
  213. package/lib/src/model/util.d.ts +0 -8
  214. package/lib/src/model/util.js +0 -23
  215. package/lib/src/parsers/texte.js +7 -7
  216. package/lib/src/raw_types_schemats/ameli.d.ts +4 -2
  217. package/lib/src/raw_types_schemats/debats.d.ts +2 -2
  218. package/lib/src/raw_types_schemats/dosleg.d.ts +2 -2
  219. package/lib/src/raw_types_schemats/questions.d.ts +2 -2
  220. package/lib/src/raw_types_schemats/sens.d.ts +10 -4216
  221. package/lib/src/scripts/convert_data.js +7 -6
  222. package/lib/src/scripts/convert_xml_to_html.js +2 -2
  223. package/lib/src/scripts/data-download.js +3 -2
  224. package/lib/src/scripts/retrieve_agenda.js +21 -9
  225. package/lib/src/scripts/retrieve_cr_commission.js +17 -17
  226. package/lib/src/scripts/retrieve_cr_seance.d.ts +14 -1
  227. package/lib/src/scripts/retrieve_cr_seance.js +10 -11
  228. package/lib/src/scripts/retrieve_documents.d.ts +11 -2
  229. package/lib/src/scripts/retrieve_documents.js +25 -14
  230. package/lib/src/scripts/retrieve_open_data.js +400 -145
  231. package/lib/src/scripts/retrieve_senateurs_photos.js +25 -11
  232. package/lib/src/scripts/retrieve_videos.js +12 -11
  233. package/lib/src/scripts/shared/cli_helpers.d.ts +1 -6
  234. package/lib/src/scripts/shared/cli_helpers.js +9 -8
  235. package/lib/src/scripts/shared/incremental_import_sql.d.ts +2 -0
  236. package/lib/src/scripts/shared/incremental_import_sql.js +894 -0
  237. package/lib/src/scripts/shared/prefixed_tables.d.ts +7 -0
  238. package/lib/src/scripts/shared/prefixed_tables.js +30 -0
  239. package/lib/src/scripts/shared/schema_version.d.ts +3 -0
  240. package/lib/src/scripts/shared/schema_version.js +97 -0
  241. package/lib/src/scripts/shared/staging_import.d.ts +3 -0
  242. package/lib/src/scripts/shared/staging_import.js +80 -0
  243. package/lib/src/scripts/shared/staging_metadata_sql.d.ts +1 -0
  244. package/lib/src/scripts/shared/staging_metadata_sql.js +221 -0
  245. package/lib/src/scripts/validate_prefixed_tables.d.ts +1 -0
  246. package/lib/src/scripts/validate_prefixed_tables.js +102 -0
  247. package/lib/src/types/texte.d.ts +1 -1
  248. package/lib/src/utils/cr_spliting.d.ts +9 -6
  249. package/lib/src/utils/cr_spliting.js +6 -101
  250. package/lib/src/utils/reunion_odj_building.d.ts +7 -3
  251. package/lib/src/utils/reunion_parsing.d.ts +2 -1
  252. package/lib/src/utils/reunion_parsing.js +2 -2
  253. package/lib/src/videos/match.js +8 -5
  254. package/lib/src/videos/pipeline.d.ts +6 -2
  255. package/lib/src/videos/pipeline.js +21 -8
  256. package/lib/src/videos/search.js +6 -2
  257. package/lib/strings.d.ts +1 -0
  258. package/lib/strings.js +18 -0
  259. package/lib/strings.mjs +18 -0
  260. package/lib/strings.ts +26 -0
  261. package/lib/tests/incrementalImportSql.test.d.ts +1 -0
  262. package/lib/tests/incrementalImportSql.test.js +155 -0
  263. package/lib/tests/prefixedTables.test.d.ts +1 -0
  264. package/lib/tests/prefixedTables.test.js +29 -0
  265. package/lib/tests/schemaVersion.test.d.ts +1 -0
  266. package/lib/tests/schemaVersion.test.js +23 -0
  267. package/lib/tests/validatePrefixedTables.test.d.ts +1 -0
  268. package/lib/tests/validatePrefixedTables.test.js +14 -0
  269. package/lib/types/agenda.d.ts +44 -0
  270. package/lib/types/agenda.js +1 -0
  271. package/lib/types/ameli.d.ts +5 -0
  272. package/lib/types/ameli.js +1 -0
  273. package/lib/types/ameli.mjs +13 -0
  274. package/lib/types/ameli.ts +21 -0
  275. package/lib/types/compte_rendu.d.ts +83 -0
  276. package/lib/types/compte_rendu.js +1 -0
  277. package/lib/types/debats.d.ts +2 -0
  278. package/lib/types/debats.js +1 -0
  279. package/lib/types/debats.mjs +2 -0
  280. package/lib/types/debats.ts +6 -0
  281. package/lib/types/dosleg.d.ts +70 -0
  282. package/lib/types/dosleg.js +1 -0
  283. package/lib/types/dosleg.mjs +151 -0
  284. package/lib/types/dosleg.ts +284 -0
  285. package/lib/types/questions.d.ts +2 -0
  286. package/lib/types/questions.js +1 -0
  287. package/lib/types/questions.mjs +1 -0
  288. package/lib/types/questions.ts +3 -0
  289. package/lib/types/sens.d.ts +10 -0
  290. package/lib/types/sens.js +1 -0
  291. package/lib/types/sens.mjs +1 -0
  292. package/lib/types/sens.ts +12 -0
  293. package/lib/types/sessions.d.ts +5 -0
  294. package/lib/types/sessions.js +84 -0
  295. package/lib/types/sessions.mjs +43 -0
  296. package/lib/types/sessions.ts +42 -0
  297. package/lib/types/texte.d.ts +74 -0
  298. package/lib/types/texte.js +16 -0
  299. package/lib/types/texte.mjs +16 -0
  300. package/lib/types/texte.ts +76 -0
  301. package/lib/typings/windows-1252.d.js +2 -0
  302. package/lib/typings/windows-1252.d.mjs +2 -0
  303. package/lib/typings/windows-1252.d.ts +11 -0
  304. package/lib/utils/cr_spliting.d.ts +28 -0
  305. package/lib/utils/cr_spliting.js +265 -0
  306. package/lib/utils/date.d.ts +10 -0
  307. package/lib/utils/date.js +100 -0
  308. package/lib/utils/nvs-timecode.d.ts +7 -0
  309. package/lib/utils/nvs-timecode.js +79 -0
  310. package/lib/utils/reunion_grouping.d.ts +9 -0
  311. package/lib/utils/reunion_grouping.js +361 -0
  312. package/lib/utils/reunion_odj_building.d.ts +5 -0
  313. package/lib/utils/reunion_odj_building.js +154 -0
  314. package/lib/utils/reunion_parsing.d.ts +23 -0
  315. package/lib/utils/reunion_parsing.js +209 -0
  316. package/lib/utils/scoring.d.ts +14 -0
  317. package/lib/utils/scoring.js +147 -0
  318. package/lib/utils/string_cleaning.d.ts +7 -0
  319. package/lib/utils/string_cleaning.js +57 -0
  320. package/lib/validators/config.d.ts +9 -0
  321. package/lib/validators/config.js +10 -0
  322. package/lib/validators/config.mjs +54 -0
  323. package/lib/validators/config.ts +79 -0
  324. package/lib/validators/senat.d.ts +0 -0
  325. package/lib/validators/senat.js +28 -0
  326. package/lib/validators/senat.mjs +24 -0
  327. package/lib/validators/senat.ts +26 -0
  328. package/package.json +6 -10
@@ -0,0 +1,713 @@
1
+ import { getDebats, getDebatsFromLecassidts, getLecAssDebsFromDatseas, } from "./model/debats";
2
+ export const allFollows = [
3
+ "aud.org",
4
+ "auteur.qua",
5
+ "dateSeance.debat",
6
+ "dateSeance.scrs",
7
+ "docatt.rec",
8
+ "docatt.typatt",
9
+ "ecr.aut",
10
+ "lecass.ass",
11
+ "lecass.auds",
12
+ "lecass.datesSeances",
13
+ "lecass.debats",
14
+ "lecass.lecassraps",
15
+ "lecass.org",
16
+ "lecass.textes",
17
+ "lecassrap.rap",
18
+ "lecture.lecasss",
19
+ "lecture.typlec",
20
+ "loi.deccoc",
21
+ "loi.etaloi",
22
+ "loi.lectures",
23
+ "loi.typloi",
24
+ "rap.denrap",
25
+ "rap.docatts",
26
+ "rap.ecrs",
27
+ "rap.orgs",
28
+ "texte.ecrs",
29
+ "texte.org",
30
+ "texte.oritxt",
31
+ "texte.txtAmeli",
32
+ "texte.typtxt",
33
+ "texte.typurl",
34
+ "txtAmeli.subs",
35
+ ];
36
+ export class Aggregator {
37
+ follow;
38
+ objectByIdByTableName = {};
39
+ requestedIdsByTableName = {};
40
+ visitedIdsByTableName = {};
41
+ constructor(follow) {
42
+ this.follow = follow;
43
+ }
44
+ addAss(ass) {
45
+ let objectById = this.objectByIdByTableName.ass;
46
+ if (objectById === undefined) {
47
+ objectById = this.objectByIdByTableName.ass = {};
48
+ }
49
+ objectById[ass.codass] = ass;
50
+ }
51
+ addAud(aud) {
52
+ let objectById = this.objectByIdByTableName.aud;
53
+ if (objectById === undefined) {
54
+ objectById = this.objectByIdByTableName.aud = {};
55
+ }
56
+ objectById[aud.audcle] = aud;
57
+ if (aud.orgcod !== null && this.follow.has("aud.org")) {
58
+ this.request("org", aud.orgcod);
59
+ }
60
+ }
61
+ addAuteur(auteur) {
62
+ let objectById = this.objectByIdByTableName.auteur;
63
+ if (objectById === undefined) {
64
+ objectById = this.objectByIdByTableName.auteur = {};
65
+ }
66
+ objectById[auteur.autcod] = auteur;
67
+ if (this.follow.has("auteur.qua")) {
68
+ this.request("qua", auteur.quacod);
69
+ }
70
+ // TODO
71
+ }
72
+ addDateSeance(dateSeance) {
73
+ let objectById = this.objectByIdByTableName.date_seance;
74
+ if (objectById === undefined) {
75
+ objectById = this.objectByIdByTableName.date_seance = {};
76
+ }
77
+ objectById[dateSeance.code] = dateSeance;
78
+ if (dateSeance.date_s !== null && this.follow.has("dateSeance.debat")) {
79
+ this.request("debats", dateSeance.date_s.toISOString());
80
+ }
81
+ if (this.follow.has("dateSeance.scrs")) {
82
+ this.request("scr_by_code", dateSeance.code.toString());
83
+ }
84
+ }
85
+ addDebat(debat) {
86
+ let objectById = this.objectByIdByTableName.debats;
87
+ if (objectById === undefined) {
88
+ objectById = this.objectByIdByTableName.debats = {};
89
+ }
90
+ objectById[debat.datsea.toISOString()] = debat;
91
+ }
92
+ addDeccoc(deccoc) {
93
+ let objectById = this.objectByIdByTableName.deccoc;
94
+ if (objectById === undefined) {
95
+ objectById = this.objectByIdByTableName.deccoc = {};
96
+ }
97
+ objectById[deccoc.deccoccod] = deccoc;
98
+ }
99
+ addDenrap(denrap) {
100
+ let objectById = this.objectByIdByTableName.denrap;
101
+ if (objectById === undefined) {
102
+ objectById = this.objectByIdByTableName.denrap = {};
103
+ }
104
+ objectById[denrap.coddenrap] = denrap;
105
+ }
106
+ addDocatt(docatt) {
107
+ let objectById = this.objectByIdByTableName.docatt;
108
+ if (objectById === undefined) {
109
+ objectById = this.objectByIdByTableName.docatt = {};
110
+ }
111
+ objectById[docatt.docattcle] = docatt;
112
+ if (this.follow.has("docatt.rap")) {
113
+ this.request("rap", docatt.rapcod.toString());
114
+ }
115
+ if (this.follow.has("docatt.typatt")) {
116
+ this.request("typatt", docatt.rapcod.toString());
117
+ }
118
+ }
119
+ addEcr(ecr) {
120
+ let objectById = this.objectByIdByTableName.ecr;
121
+ if (objectById === undefined) {
122
+ objectById = this.objectByIdByTableName.ecr = {};
123
+ }
124
+ objectById[ecr.ecrnum] = ecr;
125
+ if (ecr.autcod !== null && this.follow.has("ecr.aut")) {
126
+ this.request("auteur", ecr.autcod);
127
+ }
128
+ }
129
+ addEtaloi(etaloi) {
130
+ let objectById = this.objectByIdByTableName.etaloi;
131
+ if (objectById === undefined) {
132
+ objectById = this.objectByIdByTableName.etaloi = {};
133
+ }
134
+ objectById[etaloi.etaloicod] = etaloi;
135
+ }
136
+ addLecass(lecass) {
137
+ let objectById = this.objectByIdByTableName.lecass;
138
+ if (objectById === undefined) {
139
+ objectById = this.objectByIdByTableName.lecass = {};
140
+ }
141
+ objectById[lecass.lecassidt] = lecass;
142
+ if (this.follow.has("lecass.ass")) {
143
+ this.request("ass", lecass.codass);
144
+ }
145
+ if (lecass.orgcod !== null && this.follow.has("lecass.org")) {
146
+ this.request("org", lecass.orgcod);
147
+ }
148
+ if (this.follow.has("lecass.auds")) {
149
+ this.request("aud_by_lecassidt", lecass.lecassidt);
150
+ }
151
+ if (this.follow.has("lecass.datesSeances")) {
152
+ this.request("date_seance_by_lecassidt", lecass.lecassidt);
153
+ }
154
+ if (this.follow.has("lecass.debats")) {
155
+ this.request("debat_by_lecassidt", lecass.lecassidt);
156
+ }
157
+ if (this.follow.has("lecass.lecassraps")) {
158
+ this.request("lecassrap_by_lecassidt", lecass.lecassidt);
159
+ }
160
+ if (this.follow.has("lecass.textes")) {
161
+ this.request("texte_by_lecassidt", lecass.lecassidt);
162
+ }
163
+ }
164
+ addLecassrap(lecassrap) {
165
+ let objectById = this.objectByIdByTableName.lecassrap;
166
+ if (objectById === undefined) {
167
+ objectById = this.objectByIdByTableName.lecassrap = {};
168
+ }
169
+ objectById[`${lecassrap.lecassidt} ${lecassrap.rapcod}`] = lecassrap;
170
+ if (this.follow.has("lecassrap.rap")) {
171
+ this.request("rap", lecassrap.rapcod.toString());
172
+ }
173
+ }
174
+ addLecture(lecture) {
175
+ let objectById = this.objectByIdByTableName.lecture;
176
+ if (objectById === undefined) {
177
+ objectById = this.objectByIdByTableName.lecture = {};
178
+ }
179
+ objectById[lecture.lecidt] = lecture;
180
+ if (this.follow.has("lecture.typlec")) {
181
+ this.request("typlec", lecture.typleccod);
182
+ }
183
+ if (this.follow.has("lecture.lecasss")) {
184
+ this.request("lecasss_by_lecidt", lecture.lecidt);
185
+ }
186
+ }
187
+ addLoi(loi) {
188
+ let objectById = this.objectByIdByTableName.loi;
189
+ if (objectById === undefined) {
190
+ objectById = this.objectByIdByTableName.loi = {};
191
+ }
192
+ objectById[loi.loicod] = loi;
193
+ if (this.follow.has("loi.typloi")) {
194
+ this.request("typloi", loi.typloicod);
195
+ }
196
+ if (this.follow.has("loi.etaloi") && loi.etaloicod !== null) {
197
+ this.request("etaloi", loi.etaloicod);
198
+ }
199
+ if (this.follow.has("loi.deccoc") && loi.deccoccod !== null) {
200
+ this.request("deccoc", loi.deccoccod);
201
+ }
202
+ if (this.follow.has("loi.lectures")) {
203
+ this.request("lectures_by_loicod", loi.loicod);
204
+ }
205
+ }
206
+ addOrg(org) {
207
+ let objectById = this.objectByIdByTableName.org;
208
+ if (objectById === undefined) {
209
+ objectById = this.objectByIdByTableName.org = {};
210
+ }
211
+ objectById[org.orgcod] = org;
212
+ // TODO
213
+ }
214
+ addOritxt(oritxt) {
215
+ let objectById = this.objectByIdByTableName.oritxt;
216
+ if (objectById === undefined) {
217
+ objectById = this.objectByIdByTableName.oritxt = {};
218
+ }
219
+ objectById[oritxt.oritxtcod] = oritxt;
220
+ // TODO
221
+ }
222
+ addQua(qua) {
223
+ let objectById = this.objectByIdByTableName.qua;
224
+ if (objectById === undefined) {
225
+ objectById = this.objectByIdByTableName.qua = {};
226
+ }
227
+ objectById[qua.quacod] = qua;
228
+ }
229
+ addQuestion(question) {
230
+ let objectById = this.objectByIdByTableName.tam_questions;
231
+ if (objectById === undefined) {
232
+ objectById = this.objectByIdByTableName.tam_questions = {};
233
+ }
234
+ objectById[question.id] = question;
235
+ }
236
+ addRap(rap) {
237
+ let objectById = this.objectByIdByTableName.rap;
238
+ if (objectById === undefined) {
239
+ objectById = this.objectByIdByTableName.rap = {};
240
+ }
241
+ objectById[rap.rapcod.toString()] = rap;
242
+ if (this.follow.has("rap.denrap")) {
243
+ this.request("denrap", rap.coddenrap);
244
+ }
245
+ if (this.follow.has("rap.docatts")) {
246
+ this.request("docatt_by_rapcod", rap.rapcod.toString());
247
+ }
248
+ if (this.follow.has("rap.ecrs")) {
249
+ this.request("ecr_by_rapcod", rap.rapcod.toString());
250
+ }
251
+ if (this.follow.has("rap.orgs")) {
252
+ this.request("org_by_rapcod", rap.rapcod.toString());
253
+ }
254
+ // TODO
255
+ }
256
+ addScr(scr) {
257
+ let objectById = this.objectByIdByTableName.scr;
258
+ if (objectById === undefined) {
259
+ objectById = this.objectByIdByTableName.scr = {};
260
+ }
261
+ objectById[`${scr.sesann} ${scr.scrnum}`] = scr;
262
+ // TODO
263
+ }
264
+ addSes(ses) {
265
+ let objectById = this.objectByIdByTableName.ses;
266
+ if (objectById === undefined) {
267
+ objectById = this.objectByIdByTableName.ses = {};
268
+ }
269
+ objectById[ses.id] = ses;
270
+ }
271
+ addSub(sub) {
272
+ let objectById = this.objectByIdByTableName.sub;
273
+ if (objectById === undefined) {
274
+ objectById = this.objectByIdByTableName.sub = {};
275
+ }
276
+ objectById[sub.id] = sub;
277
+ // TODO
278
+ }
279
+ addTexte(texte) {
280
+ let objectById = this.objectByIdByTableName.texte;
281
+ if (objectById === undefined) {
282
+ objectById = this.objectByIdByTableName.texte = {};
283
+ }
284
+ objectById[texte.texcod] = texte;
285
+ if (this.follow.has("texte.ecrs")) {
286
+ this.request("ecr_by_texcod", texte.texcod.toString());
287
+ }
288
+ if (texte.orgcod !== null && this.follow.has("texte.org")) {
289
+ this.request("org", texte.orgcod);
290
+ }
291
+ if (texte.oritxtcod !== null && this.follow.has("texte.oritxt")) {
292
+ this.request("oritxt", texte.oritxtcod);
293
+ }
294
+ if (texte.sesann !== null &&
295
+ texte.texnum !== null &&
296
+ this.follow.has("texte.txtAmeli")) {
297
+ this.request("ses_by_ann", texte.sesann.toString());
298
+ this.request("txt_ameli_by_sesann_num", `${texte.sesann} ${texte.texnum}`);
299
+ }
300
+ if (texte.typtxtcod !== null && this.follow.has("texte.typtxt")) {
301
+ this.request("typtxt", texte.typtxtcod);
302
+ }
303
+ if (texte.typurl !== null && this.follow.has("texte.typurl")) {
304
+ this.request("typurl", texte.typurl);
305
+ }
306
+ }
307
+ addTxtAmeli(txtAmeli) {
308
+ let objectById = this.objectByIdByTableName.txt_ameli;
309
+ if (objectById === undefined) {
310
+ objectById = this.objectByIdByTableName.txt_ameli = {};
311
+ }
312
+ objectById[txtAmeli.id] = txtAmeli;
313
+ if (this.follow.has("txtAmeli.subs")) {
314
+ this.request("sub_by_txtid", txtAmeli.id.toString());
315
+ }
316
+ // TODO
317
+ }
318
+ addTypatt(typatt) {
319
+ let objectById = this.objectByIdByTableName.typatt;
320
+ if (objectById === undefined) {
321
+ objectById = this.objectByIdByTableName.typatt = {};
322
+ }
323
+ objectById[typatt.typattcod] = typatt;
324
+ }
325
+ addTyplec(typlec) {
326
+ let objectById = this.objectByIdByTableName.typlec;
327
+ if (objectById === undefined) {
328
+ objectById = this.objectByIdByTableName.typlec = {};
329
+ }
330
+ objectById[typlec.typleccod] = typlec;
331
+ }
332
+ addTyploi(typloi) {
333
+ let objectById = this.objectByIdByTableName.typloi;
334
+ if (objectById === undefined) {
335
+ objectById = this.objectByIdByTableName.typloi = {};
336
+ }
337
+ objectById[typloi.typloicod] = typloi;
338
+ // TODO
339
+ }
340
+ addTyptxt(typtxt) {
341
+ let objectById = this.objectByIdByTableName.typtxt;
342
+ if (objectById === undefined) {
343
+ objectById = this.objectByIdByTableName.typtxt = {};
344
+ }
345
+ objectById[typtxt.typtxtcod] = typtxt;
346
+ }
347
+ addTypurl(typurl) {
348
+ let objectById = this.objectByIdByTableName.typurl;
349
+ if (objectById === undefined) {
350
+ objectById = this.objectByIdByTableName.typurl = {};
351
+ }
352
+ objectById[typurl.typurl] = typurl;
353
+ }
354
+ async getAll() {
355
+ while (Object.keys(this.requestedIdsByTableName).length > 0) {
356
+ for (const [tableName, requestedIdsSet] of Object.entries(this.requestedIdsByTableName)) {
357
+ const requestedIds = [...requestedIdsSet];
358
+ delete this.requestedIdsByTableName[tableName];
359
+ switch (tableName) {
360
+ case "ass": {
361
+ break;
362
+ }
363
+ case "aud_by_lecassidt": {
364
+ break;
365
+ }
366
+ case "auteur": {
367
+ break;
368
+ }
369
+ case "date_seance_by_lecassidt": {
370
+ break;
371
+ }
372
+ case "debat_by_lecassidt": {
373
+ (await getDebatsFromLecassidts(requestedIds)).map(this.addDebat.bind(this));
374
+ break;
375
+ }
376
+ case "debats": {
377
+ (await getDebats(requestedIds)).map(this.addDebat.bind(this));
378
+ break;
379
+ }
380
+ case "deccoc": {
381
+ break;
382
+ }
383
+ case "denrap": {
384
+ break;
385
+ }
386
+ case "docatt_by_rapcod": {
387
+ break;
388
+ }
389
+ case "ecr_by_rapcod": {
390
+ break;
391
+ }
392
+ case "ecr_by_texcod": {
393
+ break;
394
+ }
395
+ case "etaloi": {
396
+ break;
397
+ }
398
+ case "lecasss_by_lecidt": {
399
+ break;
400
+ }
401
+ case "lecassrap_by_lecassidt": {
402
+ break;
403
+ }
404
+ case "lectures_by_loicod": {
405
+ break;
406
+ }
407
+ case "loi": {
408
+ break;
409
+ }
410
+ case "org": {
411
+ break;
412
+ }
413
+ case "org_by_rapcod": {
414
+ break;
415
+ }
416
+ case "oritxt": {
417
+ break;
418
+ }
419
+ case "qua": {
420
+ break;
421
+ }
422
+ case "rap": {
423
+ break;
424
+ }
425
+ case "scr_by_code": {
426
+ break;
427
+ }
428
+ case "texte_by_lecassidt": {
429
+ break;
430
+ }
431
+ case "typatt": {
432
+ break;
433
+ }
434
+ case "typlec": {
435
+ break;
436
+ }
437
+ case "typloi": {
438
+ break;
439
+ }
440
+ case "typtxt": {
441
+ break;
442
+ }
443
+ case "typurl": {
444
+ break;
445
+ }
446
+ default:
447
+ throw new Error(`Unhandled table: ${tableName}`);
448
+ }
449
+ const visitedIds = this.visitedIdsByTableName[tableName];
450
+ this.visitedIdsByTableName[tableName] =
451
+ visitedIds === undefined
452
+ ? new Set(requestedIds)
453
+ : new Set([...visitedIds, ...requestedIds]);
454
+ }
455
+ }
456
+ // Add "1 to many" and other computed references.
457
+ if (this.follow.has("dateSeance.scrs")) {
458
+ const scrById = this.objectByIdByTableName.scr;
459
+ const dateSeanceByCode = this.objectByIdByTableName.date_seance;
460
+ if (scrById !== undefined && dateSeanceByCode !== undefined) {
461
+ for (const scr of Object.values(scrById)) {
462
+ const scrCode = scr.code;
463
+ if (scrCode === null) {
464
+ continue;
465
+ }
466
+ const dateSeance = dateSeanceByCode[scrCode];
467
+ if (dateSeance !== undefined) {
468
+ let scrids = dateSeance.scrids;
469
+ if (scrids === undefined) {
470
+ scrids = dateSeance.scrids = [];
471
+ }
472
+ scrids.push(`${scr.sesann} ${scr.scrnum}`);
473
+ }
474
+ }
475
+ }
476
+ }
477
+ if (this.follow.has("lecass.auds")) {
478
+ const audByAudcle = this.objectByIdByTableName.aud;
479
+ const lecassByLecassidt = this.objectByIdByTableName.lecass;
480
+ if (audByAudcle !== undefined && lecassByLecassidt !== undefined) {
481
+ for (const aud of Object.values(audByAudcle)) {
482
+ const lecass = lecassByLecassidt[aud.lecassidt];
483
+ if (lecass !== undefined) {
484
+ let audcles = lecass.audcles;
485
+ if (audcles === undefined) {
486
+ audcles = lecass.audcles = [];
487
+ }
488
+ audcles.push(aud.audcle);
489
+ }
490
+ }
491
+ }
492
+ }
493
+ if (this.follow.has("lecass.datesSeances")) {
494
+ const dateSeanceByCode = this.objectByIdByTableName.date_seance;
495
+ const lecassByLecassidt = this.objectByIdByTableName.lecass;
496
+ if (dateSeanceByCode !== undefined && lecassByLecassidt !== undefined) {
497
+ for (const dateSeance of Object.values(dateSeanceByCode)) {
498
+ const lecassidt = dateSeance.lecidt;
499
+ if (lecassidt === null) {
500
+ continue;
501
+ }
502
+ const lecass = lecassByLecassidt[lecassidt];
503
+ if (lecass !== undefined) {
504
+ let datesSeancesCodes = lecass.datesSeancesCodes;
505
+ if (datesSeancesCodes === undefined) {
506
+ datesSeancesCodes = lecass.datesSeancesCodes = [];
507
+ }
508
+ datesSeancesCodes.push(dateSeance.code);
509
+ }
510
+ }
511
+ }
512
+ }
513
+ if (this.follow.has("lecass.debats")) {
514
+ const debatById = this.objectByIdByTableName.debats;
515
+ const lecassByLecassidt = this.objectByIdByTableName.lecass;
516
+ if (debatById !== undefined && lecassByLecassidt !== undefined) {
517
+ const lecassdebs = await getLecAssDebsFromDatseas(Object.keys(debatById));
518
+ for (const lecassdeb of lecassdebs) {
519
+ const lecass = lecassByLecassidt[lecassdeb.lecassidt];
520
+ if (lecass !== undefined) {
521
+ let debatdatseas = lecass.debatdatseas;
522
+ if (debatdatseas === undefined) {
523
+ debatdatseas = lecass.debatdatseas = [];
524
+ }
525
+ debatdatseas.push(lecassdeb.datsea);
526
+ }
527
+ }
528
+ }
529
+ }
530
+ if (this.follow.has("lecass.lecassraps")) {
531
+ const lecassrapById = this.objectByIdByTableName.lecassrap;
532
+ const lecassByLecassidt = this.objectByIdByTableName.lecass;
533
+ if (lecassrapById !== undefined && lecassByLecassidt !== undefined) {
534
+ for (const lecassrap of Object.values(lecassrapById)) {
535
+ const lecass = lecassByLecassidt[lecassrap.lecassidt];
536
+ if (lecass !== undefined) {
537
+ let lecassrapids = lecass.lecassrapids;
538
+ if (lecassrapids === undefined) {
539
+ lecassrapids = lecass.lecassrapids = [];
540
+ }
541
+ lecassrapids.push(`${lecassrap.lecassidt} ${lecassrap.rapcod}`);
542
+ }
543
+ }
544
+ }
545
+ }
546
+ if (this.follow.has("lecass.textes")) {
547
+ const texteByTexcod = this.objectByIdByTableName.texte;
548
+ const lecassByLecassidt = this.objectByIdByTableName.lecass;
549
+ if (texteByTexcod !== undefined && lecassByLecassidt !== undefined) {
550
+ for (const texte of Object.values(texteByTexcod)) {
551
+ const lecass = lecassByLecassidt[texte.lecassidt];
552
+ if (lecass !== undefined) {
553
+ let texcods = lecass.texcods;
554
+ if (texcods === undefined) {
555
+ texcods = lecass.texcods = [];
556
+ }
557
+ texcods.push(texte.texcod);
558
+ }
559
+ }
560
+ }
561
+ }
562
+ if (this.follow.has("lecture.lecasss")) {
563
+ const lecassByLecassidt = this.objectByIdByTableName.lecass;
564
+ const lectureByLecidt = this.objectByIdByTableName.lecture;
565
+ if (lecassByLecassidt !== undefined && lectureByLecidt !== undefined) {
566
+ for (const lecass of Object.values(lecassByLecassidt)) {
567
+ const lecture = lectureByLecidt[lecass.lecidt];
568
+ if (lecture !== undefined) {
569
+ let lecassidts = lecture.lecassidts;
570
+ if (lecassidts === undefined) {
571
+ lecassidts = lecture.lecassidts = [];
572
+ }
573
+ lecassidts.push(lecass.lecassidt);
574
+ }
575
+ }
576
+ }
577
+ }
578
+ if (this.follow.has("loi.lectures")) {
579
+ const lectureByLecidt = this.objectByIdByTableName.lecture;
580
+ const loiByLoicod = this.objectByIdByTableName.loi;
581
+ if (lectureByLecidt !== undefined && loiByLoicod !== undefined) {
582
+ for (const lecture of Object.values(lectureByLecidt)) {
583
+ const loi = loiByLoicod[lecture.loicod];
584
+ if (loi !== undefined) {
585
+ let lecidts = loi.lecidts;
586
+ if (lecidts === undefined) {
587
+ lecidts = loi.lecidts = [];
588
+ }
589
+ lecidts.push(lecture.lecidt);
590
+ }
591
+ }
592
+ }
593
+ }
594
+ if (this.follow.has("rap.docatts")) {
595
+ const docattByDocattcle = this.objectByIdByTableName.docatt;
596
+ const rapById = this.objectByIdByTableName.rap;
597
+ if (docattByDocattcle !== undefined && rapById !== undefined) {
598
+ for (const docatt of Object.values(docattByDocattcle)) {
599
+ const rapcod = docatt.rapcod;
600
+ if (rapcod === null) {
601
+ continue;
602
+ }
603
+ const rap = rapById[rapcod];
604
+ if (rap !== undefined) {
605
+ let docattcles = rap.docattcles;
606
+ if (docattcles === undefined) {
607
+ docattcles = rap.docattcles = [];
608
+ }
609
+ docattcles.push(docatt.docattcle);
610
+ }
611
+ }
612
+ }
613
+ }
614
+ if (this.follow.has("rap.ecrs")) {
615
+ const ecrByEcrnum = this.objectByIdByTableName.ecr;
616
+ const rapById = this.objectByIdByTableName.rap;
617
+ if (ecrByEcrnum !== undefined && rapById !== undefined) {
618
+ for (const ecr of Object.values(ecrByEcrnum)) {
619
+ const rapcod = ecr.rapcod;
620
+ if (rapcod === null) {
621
+ continue;
622
+ }
623
+ const rap = rapById[rapcod];
624
+ if (rap !== undefined) {
625
+ let ecrnums = rap.ecrnums;
626
+ if (ecrnums === undefined) {
627
+ ecrnums = rap.ecrnums = [];
628
+ }
629
+ ecrnums.push(ecr.ecrnum);
630
+ }
631
+ }
632
+ }
633
+ }
634
+ if (this.follow.has("rap.orgs")) {
635
+ const orgByOrgcod = this.objectByIdByTableName.org;
636
+ const rapById = this.objectByIdByTableName.rap;
637
+ if (orgByOrgcod !== undefined && rapById !== undefined) {
638
+ }
639
+ }
640
+ if (this.follow.has("texte.ecrs")) {
641
+ const ecrByEcrnum = this.objectByIdByTableName.ecr;
642
+ const texteById = this.objectByIdByTableName.texte;
643
+ if (ecrByEcrnum !== undefined && texteById !== undefined) {
644
+ for (const ecr of Object.values(ecrByEcrnum)) {
645
+ const texcod = ecr.texcod;
646
+ if (texcod === null) {
647
+ continue;
648
+ }
649
+ const texte = texteById[texcod];
650
+ if (texte !== undefined) {
651
+ let ecrnums = texte.ecrnums;
652
+ if (ecrnums === undefined) {
653
+ ecrnums = texte.ecrnums = [];
654
+ }
655
+ ecrnums.push(ecr.ecrnum);
656
+ }
657
+ }
658
+ }
659
+ }
660
+ if (this.follow.has("texte.txtAmeli")) {
661
+ const sesById = this.objectByIdByTableName.ses;
662
+ const texteById = this.objectByIdByTableName.texte;
663
+ const txtAmeliById = this.objectByIdByTableName.txt_ameli;
664
+ if (sesById !== undefined &&
665
+ texteById !== undefined &&
666
+ txtAmeliById !== undefined) {
667
+ for (const txtAmeli of Object.values(txtAmeliById)) {
668
+ const sesinsid = txtAmeli.sesinsid;
669
+ const num = parseInt(txtAmeli.num);
670
+ if (sesinsid !== null) {
671
+ const sesins = sesById[sesinsid];
672
+ if (sesins !== undefined) {
673
+ for (const texte of Object.values(texteById)) {
674
+ if (texte.sesann === sesins.ann && texte.texnum === num) {
675
+ texte.txtAmeliId = txtAmeli.id;
676
+ }
677
+ }
678
+ }
679
+ }
680
+ }
681
+ }
682
+ }
683
+ if (this.follow.has("txtAmeli.subs")) {
684
+ const subById = this.objectByIdByTableName.sub;
685
+ const txtAmeliById = this.objectByIdByTableName.txt_ameli;
686
+ if (subById !== undefined && txtAmeliById !== undefined) {
687
+ for (const sub of Object.values(subById)) {
688
+ const txtAmeli = txtAmeliById[sub.txtid];
689
+ if (txtAmeli !== undefined) {
690
+ let subids = txtAmeli.subids;
691
+ if (subids === undefined) {
692
+ subids = txtAmeli.subids = [];
693
+ }
694
+ subids.push(sub.id);
695
+ }
696
+ }
697
+ }
698
+ }
699
+ }
700
+ request(tableName, id) {
701
+ const visitedIds = this.visitedIdsByTableName[tableName];
702
+ if (visitedIds === undefined || !visitedIds.has(id)) {
703
+ let requestedIds = this.requestedIdsByTableName[tableName];
704
+ if (requestedIds === undefined) {
705
+ requestedIds = this.requestedIdsByTableName[tableName] = new Set();
706
+ }
707
+ requestedIds.add(id);
708
+ }
709
+ }
710
+ toJson() {
711
+ return this.objectByIdByTableName;
712
+ }
713
+ }