@tricoteuses/senat 2.8.1 → 2.8.5

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