@tricoteuses/senat 0.2.3 → 0.3.2

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 (43) hide show
  1. package/LICENSE.md +2 -2
  2. package/README.md +0 -169
  3. package/lib/index.d.ts +1 -0
  4. package/lib/index.js +111 -35
  5. package/lib/index.mjs +1 -0
  6. package/lib/inserters.js +97 -167
  7. package/lib/inserters.mjs +360 -0
  8. package/lib/raw_types/ameli.js +4 -2
  9. package/lib/raw_types/ameli.mjs +2 -0
  10. package/lib/raw_types/debats.js +4 -2
  11. package/lib/raw_types/debats.mjs +2 -0
  12. package/lib/raw_types/dosleg.js +3 -1
  13. package/lib/raw_types/dosleg.mjs +2 -0
  14. package/lib/raw_types/questions.js +1 -1
  15. package/{src/raw_types/questions.ts → lib/raw_types/questions.mjs} +1 -3
  16. package/lib/raw_types/sens.js +4 -2
  17. package/lib/raw_types/sens.mjs +2 -0
  18. package/lib/types/ameli.js +5 -1
  19. package/lib/types/ameli.mjs +1 -0
  20. package/lib/types/debats.js +3 -1
  21. package/lib/types/debats.mjs +1 -0
  22. package/lib/types/dosleg.js +3 -1
  23. package/lib/types/dosleg.mjs +1 -0
  24. package/lib/types/questions.js +1 -1
  25. package/lib/types/questions.mjs +1 -0
  26. package/lib/types/sens.js +3 -1
  27. package/lib/types/sens.mjs +1 -0
  28. package/package.json +26 -33
  29. package/.eslintrc.js +0 -24
  30. package/babel.config.js +0 -39
  31. package/prettier.config.js +0 -4
  32. package/src/index.ts +0 -30
  33. package/src/inserters.ts +0 -520
  34. package/src/raw_types/ameli.ts +0 -655
  35. package/src/raw_types/debats.ts +0 -161
  36. package/src/raw_types/dosleg.ts +0 -2351
  37. package/src/raw_types/sens.ts +0 -3101
  38. package/src/types/ameli.ts +0 -7
  39. package/src/types/debats.ts +0 -3
  40. package/src/types/dosleg.ts +0 -132
  41. package/src/types/questions.ts +0 -0
  42. package/src/types/sens.ts +0 -12
  43. package/tsconfig.json +0 -67
package/src/inserters.ts DELETED
@@ -1,520 +0,0 @@
1
- import { TxtAmeli } from "./types/ameli"
2
- import { Debat } from "./types/debats"
3
- import {
4
- Ass,
5
- Aud,
6
- Auteur,
7
- DateSeance,
8
- DecCoc,
9
- DenRap,
10
- DocAtt,
11
- Ecr,
12
- EtaLoi,
13
- LecAss,
14
- LecAssRap,
15
- Lecture,
16
- Loi,
17
- Org,
18
- OriTxt,
19
- Qua,
20
- Rap,
21
- Scr,
22
- Texte,
23
- TypAtt,
24
- TypLec,
25
- TypLoi,
26
- TypTxt,
27
- TypUrl,
28
- } from "./types/dosleg"
29
-
30
- export interface OutputData {
31
- readonly ass?: { [id: string]: Ass }
32
- readonly aud?: { [id: string]: Aud }
33
- readonly auteur?: { [id: string]: Auteur }
34
- readonly date_seance?: { [id: string]: DateSeance }
35
- readonly debats?: { [id: string]: Debat }
36
- readonly deccoc?: { [id: string]: DecCoc }
37
- readonly denrap?: { [id: string]: DenRap }
38
- readonly docatt?: { [id: string]: DocAtt }
39
- readonly ecr?: { [id: string]: Ecr }
40
- readonly etaloi?: { [id: string]: EtaLoi }
41
- readonly lecass?: { [id: string]: LecAss }
42
- readonly lecassrap?: { [id: string]: LecAssRap }
43
- readonly lecture?: { [id: string]: Lecture }
44
- readonly loi?: { [id: string]: Loi }
45
- readonly org?: { [id: string]: Org }
46
- readonly oritxt?: { [id: string]: OriTxt }
47
- readonly qua?: { [id: string]: Qua }
48
- readonly rap?: { [id: string]: Rap }
49
- readonly scr?: { [id: string]: Scr }
50
- readonly texte?: { [id: string]: Texte }
51
- readonly typatt?: { [id: string]: TypAtt }
52
- readonly typlec?: { [id: string]: TypLec }
53
- readonly typloi?: { [id: string]: TypLoi }
54
- readonly typtxt?: { [id: string]: TypTxt }
55
- readonly typurl?: { [id: string]: TypUrl }
56
- readonly txt_ameli?: { [id: string]: TxtAmeli }
57
- }
58
-
59
- type VisitedIdsByTableName = { [tableName: string]: Set<number | string> }
60
-
61
- export function insertAudReferences(
62
- aud: Aud,
63
- data: OutputData,
64
- visitedIdsByTableName: VisitedIdsByTableName,
65
- ) {
66
- let visitedIds = visitedIdsByTableName.aud
67
- if (visitedIds === undefined) {
68
- visitedIds = visitedIdsByTableName.aud = new Set()
69
- }
70
- if (!visitedIds.has(aud.audcle)) {
71
- visitedIds.add(aud.audcle)
72
-
73
- if (aud.orgcod !== null && data.org !== undefined) {
74
- const org = data.org[aud.orgcod]
75
- if (org !== undefined) {
76
- aud.org = org
77
- // insertOrgReferences(org, data, visitedIdsByTableName)
78
- }
79
- }
80
-
81
- // TODO
82
- }
83
-
84
- return aud
85
- }
86
-
87
- export function insertAuteurReferences(
88
- auteur: Auteur,
89
- data: OutputData,
90
- visitedIdsByTableName: VisitedIdsByTableName,
91
- ) {
92
- let visitedIds = visitedIdsByTableName.auteur
93
- if (visitedIds === undefined) {
94
- visitedIds = visitedIdsByTableName.auteur = new Set()
95
- }
96
- if (!visitedIds.has(auteur.autcod)) {
97
- visitedIds.add(auteur.autcod)
98
-
99
- if (data.qua !== undefined) {
100
- const qua = data.qua[auteur.quacod]
101
- if (qua !== undefined) {
102
- auteur.qua = qua
103
- // insertQuaReferences(qua, data, visitedIdsByTableName)
104
- }
105
- }
106
-
107
- // TODO
108
- }
109
-
110
- return auteur
111
- }
112
-
113
- export function insertDateSeanceReferences(
114
- dateSeance: DateSeance,
115
- data: OutputData,
116
- visitedIdsByTableName: VisitedIdsByTableName,
117
- ) {
118
- let visitedIds = visitedIdsByTableName.date_seance
119
- if (visitedIds === undefined) {
120
- visitedIds = visitedIdsByTableName.date_seance = new Set()
121
- }
122
- if (!visitedIds.has(dateSeance.code)) {
123
- visitedIds.add(dateSeance.code)
124
-
125
- if (dateSeance.date_s !== null && data.debats !== undefined) {
126
- const dateString =
127
- dateSeance.date_s instanceof Date
128
- ? dateSeance.date_s.toISOString()
129
- : dateSeance.date_s
130
- const debat = data.debats[dateString]
131
- if (debat !== undefined) {
132
- dateSeance.debat = debat
133
- // insertDebatReferences(debat, data, visitedIdsByTableName)
134
- }
135
- }
136
-
137
- dateSeance.scrs = []
138
- if (dateSeance.scrids !== undefined && data.scr !== undefined) {
139
- for (const scrid of dateSeance.scrids) {
140
- const scr = data.scr[scrid]
141
- if (scr !== undefined) {
142
- dateSeance.scrs.push(scr)
143
- // insertScrReferences(scr, data, visitedIdsByTableName)
144
- }
145
- }
146
- }
147
- }
148
-
149
- return dateSeance
150
- }
151
-
152
- export function insertDocAttReferences(
153
- docatt: DocAtt,
154
- data: OutputData,
155
- visitedIdsByTableName: VisitedIdsByTableName,
156
- ) {
157
- let visitedIds = visitedIdsByTableName.docatt
158
- if (visitedIds === undefined) {
159
- visitedIds = visitedIdsByTableName.docatt = new Set()
160
- }
161
- if (!visitedIds.has(docatt.docattcle)) {
162
- visitedIds.add(docatt.docattcle)
163
-
164
- if (docatt.rapcod !== null && data.rap !== undefined) {
165
- const rap = data.rap[docatt.rapcod]
166
- if (rap !== undefined) {
167
- docatt.rap = rap
168
- insertRapReferences(rap, data, visitedIdsByTableName)
169
- }
170
- }
171
-
172
- if (docatt.typattcod !== null && data.typatt !== undefined) {
173
- const typatt = data.typatt[docatt.typattcod]
174
- if (typatt !== undefined) {
175
- docatt.typatt = typatt
176
- // insertTypAttReferences(typatt, data, visitedIdsByTableName)
177
- }
178
- }
179
- }
180
-
181
- return docatt
182
- }
183
-
184
- export function insertEcrReferences(
185
- ecr: Ecr,
186
- data: OutputData,
187
- visitedIdsByTableName: VisitedIdsByTableName,
188
- ) {
189
- let visitedIds = visitedIdsByTableName.ecr
190
- if (visitedIds === undefined) {
191
- visitedIds = visitedIdsByTableName.ecr = new Set()
192
- }
193
- if (!visitedIds.has(ecr.ecrnum)) {
194
- visitedIds.add(ecr.ecrnum)
195
-
196
- if (ecr.autcod !== null && data.auteur !== undefined) {
197
- const aut = data.auteur[ecr.autcod]
198
- if (aut !== undefined) {
199
- ecr.aut = aut
200
- insertAuteurReferences(aut, data, visitedIdsByTableName)
201
- }
202
- }
203
-
204
- // TODO
205
- }
206
-
207
- return ecr
208
- }
209
-
210
- export function insertLecassrapReferences(
211
- lecassrap: LecAssRap,
212
- data: OutputData,
213
- visitedIdsByTableName: VisitedIdsByTableName,
214
- ) {
215
- let visitedIds = visitedIdsByTableName.lecassrap
216
- if (visitedIds === undefined) {
217
- visitedIds = visitedIdsByTableName.lecassrap = new Set()
218
- }
219
- const lecasrapid = `${lecassrap.lecassidt} ${lecassrap.rapcod}`
220
- if (!visitedIds.has(lecasrapid)) {
221
- visitedIds.add(lecasrapid)
222
-
223
- if (lecassrap.rapcod !== null && data.rap !== undefined) {
224
- const rap = data.rap[lecassrap.rapcod]
225
- if (rap !== undefined) {
226
- lecassrap.rap = rap
227
- insertRapReferences(rap, data, visitedIdsByTableName)
228
- }
229
- }
230
- }
231
-
232
- return lecassrap
233
- }
234
-
235
- export function insertLecassReferences(
236
- lecass: LecAss,
237
- data: OutputData,
238
- visitedIdsByTableName: VisitedIdsByTableName,
239
- ) {
240
- let visitedIds = visitedIdsByTableName.lecass
241
- if (visitedIds === undefined) {
242
- visitedIds = visitedIdsByTableName.lecass = new Set()
243
- }
244
- if (!visitedIds.has(lecass.lecassidt)) {
245
- visitedIds.add(lecass.lecassidt)
246
-
247
- if (lecass.codass !== null && data.ass !== undefined) {
248
- const ass = data.ass[lecass.codass]
249
- if (ass !== undefined) {
250
- lecass.ass = ass
251
- // insertAssReferences(ass, data, visitedIdsByTableName)
252
- }
253
- }
254
-
255
- if (lecass.orgcod !== null && data.org !== undefined) {
256
- const org = data.org[lecass.orgcod]
257
- if (org !== undefined) {
258
- lecass.org = org
259
- // insertOrgReferences(org, data, visitedIdsByTableName)
260
- }
261
- }
262
-
263
- lecass.auds = []
264
- if (lecass.audcles !== undefined && data.aud !== undefined) {
265
- for (const audcle of lecass.audcles) {
266
- const aud = data.aud[audcle]
267
- if (aud !== undefined) {
268
- lecass.auds.push(aud)
269
- insertAudReferences(aud, data, visitedIdsByTableName)
270
- }
271
- }
272
- }
273
-
274
- lecass.datesSeances = []
275
- if (lecass.datesSeancesCodes !== undefined && data.date_seance !== undefined) {
276
- for (const dateSeanceCode of lecass.datesSeancesCodes) {
277
- const dateSeance = data.date_seance[dateSeanceCode]
278
- if (dateSeance !== undefined) {
279
- lecass.datesSeances.push(dateSeance)
280
- insertDateSeanceReferences(dateSeance, data, visitedIdsByTableName)
281
- }
282
- }
283
- }
284
-
285
- lecass.lecassraps = []
286
- if (lecass.lecassrapids !== undefined && data.lecassrap !== undefined) {
287
- for (const lecassrapid of lecass.lecassrapids) {
288
- const lecassrap = data.lecassrap[lecassrapid]
289
- if (lecassrap !== undefined) {
290
- lecass.lecassraps.push(lecassrap)
291
- insertLecassrapReferences(lecassrap, data, visitedIdsByTableName)
292
- }
293
- }
294
- }
295
-
296
- lecass.textes = []
297
- if (lecass.texcods !== undefined && data.texte !== undefined) {
298
- for (const texcod of lecass.texcods) {
299
- const texte = data.texte[texcod]
300
- if (texte !== undefined) {
301
- lecass.textes.push(texte)
302
- insertTexteReferences(texte, data, visitedIdsByTableName)
303
- }
304
- }
305
- }
306
- }
307
-
308
- return lecass
309
- }
310
-
311
- export function insertLectureReferences(
312
- lecture: Lecture,
313
- data: OutputData,
314
- visitedIdsByTableName: VisitedIdsByTableName,
315
- ) {
316
- let visitedIds = visitedIdsByTableName.lecture
317
- if (visitedIds === undefined) {
318
- visitedIds = visitedIdsByTableName.lecture = new Set()
319
- }
320
- if (!visitedIds.has(lecture.lecidt)) {
321
- visitedIds.add(lecture.lecidt)
322
-
323
- if (lecture.typleccod !== null && data.typlec !== undefined) {
324
- const typlec = data.typlec[lecture.typleccod]
325
- if (typlec !== undefined) {
326
- lecture.typlec = typlec
327
- // insertTyplecReferences(typlec, data, visitedIdsByTableName)
328
- }
329
- }
330
-
331
- lecture.lecasss = []
332
- if (lecture.lecassidts !== undefined && data.lecass !== undefined) {
333
- for (const lecassidt of lecture.lecassidts) {
334
- const lecass = data.lecass[lecassidt]
335
- if (lecass !== undefined) {
336
- lecture.lecasss.push(lecass)
337
- insertLecassReferences(lecass, data, visitedIdsByTableName)
338
- }
339
- }
340
- }
341
- }
342
-
343
- return lecture
344
- }
345
-
346
- export function insertLoiReferences(
347
- loi: Loi,
348
- data: OutputData,
349
- visitedIdsByTableName: VisitedIdsByTableName,
350
- ) {
351
- let visitedIds = visitedIdsByTableName.loi
352
- if (visitedIds === undefined) {
353
- visitedIds = visitedIdsByTableName.loi = new Set()
354
- }
355
- if (!visitedIds.has(loi.loicod)) {
356
- visitedIds.add(loi.loicod)
357
-
358
- if (loi.typloicod !== null && data.typloi !== undefined) {
359
- const typloi = data.typloi[loi.typloicod]
360
- if (typloi !== undefined) {
361
- loi.typloi = typloi
362
- // insertTyploiReferences(typloi, data, visitedIdsByTableName)
363
- }
364
- }
365
-
366
- if (loi.etaloicod !== null && data.etaloi !== undefined) {
367
- const etaloi = data.etaloi[loi.etaloicod]
368
- if (etaloi !== undefined) {
369
- loi.etaloi = etaloi
370
- // insertEtaloiReferences(etaloi, data, visitedIdsByTableName)
371
- }
372
- }
373
-
374
- if (loi.deccoccod !== null && data.deccoc !== undefined) {
375
- const deccoc = data.deccoc[loi.deccoccod]
376
- if (deccoc !== undefined) {
377
- loi.deccoc = deccoc
378
- // insertDeccocReferences(deccoc, data, visitedIdsByTableName)
379
- }
380
- }
381
-
382
- loi.lectures = []
383
- if (loi.lecidts !== undefined && data.lecture !== undefined) {
384
- for (const lecidt of loi.lecidts) {
385
- const lecture = data.lecture[lecidt]
386
- if (lecture !== undefined) {
387
- loi.lectures.push(lecture)
388
- insertLectureReferences(lecture, data, visitedIdsByTableName)
389
- }
390
- }
391
- }
392
- }
393
-
394
- return loi
395
- }
396
-
397
- export function insertRapReferences(
398
- rap: Rap,
399
- data: OutputData,
400
- visitedIdsByTableName: VisitedIdsByTableName,
401
- ) {
402
- let visitedIds = visitedIdsByTableName.rap
403
- if (visitedIds === undefined) {
404
- visitedIds = visitedIdsByTableName.rap = new Set()
405
- }
406
- if (!visitedIds.has(rap.rapcod)) {
407
- visitedIds.add(rap.rapcod)
408
-
409
- if (rap.coddenrap !== null && data.denrap !== undefined) {
410
- const denrap = data.denrap[rap.coddenrap]
411
- if (denrap !== undefined) {
412
- rap.denrap = denrap
413
- // insertDenrapReferences(denrap, data, visitedIdsByTableName)
414
- }
415
- }
416
-
417
- rap.docatts = []
418
- if (rap.docattcles !== undefined && data.docatt !== undefined) {
419
- for (const docattcle of rap.docattcles) {
420
- const docatt = data.docatt[docattcle]
421
- if (docatt !== undefined) {
422
- rap.docatts.push(docatt)
423
- insertDocAttReferences(docatt, data, visitedIdsByTableName)
424
- }
425
- }
426
- }
427
-
428
- rap.ecrs = []
429
- if (rap.ecrnums !== undefined && data.ecr !== undefined) {
430
- for (const ecrnum of rap.ecrnums) {
431
- const ecr = data.ecr[ecrnum]
432
- if (ecr !== undefined) {
433
- rap.ecrs.push(ecr)
434
- insertEcrReferences(ecr, data, visitedIdsByTableName)
435
- }
436
- }
437
- }
438
-
439
- rap.orgs = []
440
- if (rap.orgcods !== undefined && data.org !== undefined) {
441
- for (const orgcod of rap.orgcods) {
442
- const org = data.org[orgcod]
443
- if (org !== undefined) {
444
- rap.orgs.push(org)
445
- // insertOrgReferences(org, data, visitedIdsByTableName)
446
- }
447
- }
448
- }
449
- }
450
-
451
- return rap
452
- }
453
-
454
- export function insertTexteReferences(
455
- texte: Texte,
456
- data: OutputData,
457
- visitedIdsByTableName: VisitedIdsByTableName,
458
- ) {
459
- let visitedIds = visitedIdsByTableName.texte
460
- if (visitedIds === undefined) {
461
- visitedIds = visitedIdsByTableName.texte = new Set()
462
- }
463
- if (!visitedIds.has(texte.texcod)) {
464
- visitedIds.add(texte.texcod)
465
-
466
- texte.ecrs = []
467
- if (texte.ecrnums !== undefined && data.ecr !== undefined) {
468
- for (const ecrnum of texte.ecrnums) {
469
- const ecr = data.ecr[ecrnum]
470
- if (ecr !== undefined) {
471
- texte.ecrs.push(ecr)
472
- insertEcrReferences(ecr, data, visitedIdsByTableName)
473
- }
474
- }
475
- }
476
-
477
- if (texte.orgcod !== null && data.org !== undefined) {
478
- const org = data.org[texte.orgcod]
479
- if (org !== undefined) {
480
- texte.org = org
481
- // insertOrgReferences(org, data, visitedIdsByTableName)
482
- }
483
- }
484
-
485
- if (texte.oritxtcod !== null && data.oritxt !== undefined) {
486
- const oritxt = data.oritxt[texte.oritxtcod]
487
- if (oritxt !== undefined) {
488
- texte.oritxt = oritxt
489
- // insertOritxtReferences(oritxt, data, visitedIdsByTableName)
490
- }
491
- }
492
-
493
- if (texte.txtAmeliId !== undefined && data.txt_ameli !== undefined) {
494
- const txtAmeli = data.txt_ameli[texte.txtAmeliId]
495
- if (txtAmeli !== undefined) {
496
- texte.txtAmeli = txtAmeli
497
- }
498
- }
499
-
500
- if (texte.typtxtcod !== null && data.typtxt !== undefined) {
501
- const typtxt = data.typtxt[texte.typtxtcod]
502
- if (typtxt !== undefined) {
503
- texte.typtxt = typtxt
504
- // insertTyptxtReferences(typtxt, data, visitedIdsByTableName)
505
- }
506
- }
507
-
508
- if (texte.typurl !== null && data.typurl !== undefined) {
509
- const typurl = data.typurl[texte.typurl]
510
- if (typurl !== undefined) {
511
- texte.libtypurl = typurl.libtypurl
512
- // insertTypurlReferences(typurl, data, visitedIdsByTableName)
513
- }
514
- }
515
-
516
- // TODO
517
- }
518
-
519
- return texte
520
- }