@tricoteuses/senat 1.0.1 → 1.1.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 (68) hide show
  1. package/README.md +4 -1
  2. package/lib/aggregates.d.ts +54 -0
  3. package/lib/aggregates.js +1122 -0
  4. package/lib/aggregates.mjs +802 -0
  5. package/lib/aggregates.ts +947 -0
  6. package/lib/datasets.d.ts +1 -0
  7. package/lib/datasets.js +9 -1
  8. package/lib/datasets.mjs +10 -0
  9. package/lib/datasets.ts +11 -0
  10. package/lib/index.d.ts +1 -0
  11. package/lib/index.js +14 -1
  12. package/lib/index.mjs +1 -0
  13. package/lib/index.ts +4 -0
  14. package/lib/inserters.d.ts +5 -1
  15. package/lib/inserters.js +22 -3
  16. package/lib/inserters.mjs +19 -3
  17. package/lib/inserters.ts +27 -2
  18. package/lib/model/ameli.d.ts +4 -0
  19. package/lib/model/ameli.js +167 -0
  20. package/lib/model/ameli.mjs +57 -0
  21. package/lib/model/ameli.ts +86 -0
  22. package/lib/model/debats.d.ts +4 -0
  23. package/lib/model/debats.js +123 -0
  24. package/lib/model/debats.mjs +43 -0
  25. package/lib/model/debats.ts +68 -0
  26. package/lib/model/dosleg.d.ts +29 -0
  27. package/lib/model/dosleg.js +840 -0
  28. package/lib/model/dosleg.mjs +337 -0
  29. package/lib/model/dosleg.ts +558 -0
  30. package/lib/model/index.d.ts +5 -0
  31. package/lib/model/index.js +48 -0
  32. package/lib/model/index.mjs +5 -0
  33. package/lib/model/index.ts +11 -0
  34. package/lib/model/questions.d.ts +2 -0
  35. package/lib/model/questions.js +52 -0
  36. package/lib/model/questions.mjs +8 -0
  37. package/lib/model/questions.ts +14 -0
  38. package/lib/model/sens.d.ts +2 -0
  39. package/lib/model/sens.js +57 -0
  40. package/lib/model/sens.mjs +9 -0
  41. package/lib/model/sens.ts +18 -0
  42. package/lib/model/util.d.ts +1 -0
  43. package/lib/model/util.js +60 -0
  44. package/lib/model/util.mjs +10 -0
  45. package/lib/model/util.ts +16 -0
  46. package/lib/raw_types/questions.d.ts +226 -2
  47. package/lib/raw_types/questions.js +18 -5
  48. package/lib/raw_types/questions.mjs +1 -8
  49. package/lib/raw_types/questions.ts +242 -2
  50. package/lib/scripts/convert_data.d.ts +1 -0
  51. package/lib/scripts/convert_data.js +284 -0
  52. package/lib/scripts/convert_data.mjs +146 -0
  53. package/lib/scripts/convert_data.ts +182 -0
  54. package/lib/scripts/fix_db.d.ts +1 -0
  55. package/lib/scripts/fix_db.js +144 -0
  56. package/lib/scripts/fix_db.mjs +64 -0
  57. package/lib/scripts/fix_db.ts +75 -0
  58. package/lib/scripts/retrieve_open_data.js +20 -15
  59. package/lib/scripts/retrieve_open_data.mjs +20 -17
  60. package/lib/scripts/retrieve_open_data.ts +26 -22
  61. package/lib/scripts/retrieve_textes.js +4 -2
  62. package/lib/scripts/retrieve_textes.mjs +3 -1
  63. package/lib/scripts/retrieve_textes.ts +6 -4
  64. package/lib/types/questions.d.ts +2 -0
  65. package/lib/types/questions.js +13 -1
  66. package/lib/types/questions.mjs +1 -1
  67. package/lib/types/questions.ts +3 -0
  68. package/package.json +1 -1
@@ -0,0 +1,337 @@
1
+ import { assFieldsToTrim, audFieldsToTrim, auteurFieldsToTrim, dateSeanceFieldsToTrim, deccocFieldsToTrim, denrapFieldsToTrim, docattFieldsToParseInt, docattFieldsToTrim, ecrFieldsToTrim, etaloiFieldsToTrim, lecassFieldsToTrim, lecassrapFieldsToTrim, lectureFieldsToTrim, loiFieldsToTrim, orgFieldsToTrim, oritxtFieldsToTrim, quaFieldsToTrim, rapFieldsToParseInt, rapFieldsToTrim, raporgFieldsToTrim, scrFieldsToTrim, texteFieldsToParseInt, texteFieldsToTrim, typattFieldsToTrim, typlecFieldsToTrim, typloiFieldsToTrim, typtxtFieldsToTrim, typurlFieldsToTrim, } from '../types/dosleg';
2
+ import { dbByName } from "../databases";
3
+ import { parseIntFields, trimFieldsRight } from '../fields';
4
+ export const getAsss = async (ids) => {
5
+ if (ids.length === 0) {
6
+ return [];
7
+ }
8
+ return (await dbByName.dosleg.any(`
9
+ SELECT *
10
+ FROM ass
11
+ WHERE codass IN ($<ids:list>)
12
+ `, {
13
+ ids,
14
+ })).map((ass) => trimFieldsRight(assFieldsToTrim, ass));
15
+ };
16
+ export const getAudsFromLecassidts = async (ids) => {
17
+ if (ids.length === 0) {
18
+ return [];
19
+ }
20
+ return (await dbByName.dosleg.any(`
21
+ SELECT *
22
+ FROM aud
23
+ WHERE lecassidt IN ($<ids:list>)
24
+ `, {
25
+ ids,
26
+ })).map((aud) => trimFieldsRight(audFieldsToTrim, aud));
27
+ };
28
+ export const getAuteurs = async (ids) => {
29
+ if (ids.length === 0) {
30
+ return [];
31
+ }
32
+ return (await dbByName.dosleg.any(`
33
+ SELECT *
34
+ FROM auteur
35
+ WHERE autcod IN ($<ids:list>)
36
+ `, {
37
+ ids,
38
+ })).map((auteur) => trimFieldsRight(auteurFieldsToTrim, auteur));
39
+ };
40
+ export const getDatesSeancesFromLecassidts = async (ids) => {
41
+ if (ids.length === 0) {
42
+ return [];
43
+ }
44
+ return (await dbByName.dosleg.any(`
45
+ SELECT *
46
+ FROM date_seance
47
+ WHERE lecidt IN ($<ids:list>)
48
+ `, {
49
+ ids,
50
+ })).map((dateSeance) => trimFieldsRight(dateSeanceFieldsToTrim, dateSeance));
51
+ };
52
+ export const getDeccocs = async (ids) => {
53
+ if (ids.length === 0) {
54
+ return [];
55
+ }
56
+ return (await dbByName.dosleg.any(`
57
+ SELECT *
58
+ FROM deccoc
59
+ WHERE deccoccod IN ($<ids:list>)
60
+ `, {
61
+ ids,
62
+ })).map((deccoc) => trimFieldsRight(deccocFieldsToTrim, deccoc));
63
+ };
64
+ export const getDenraps = async (ids) => {
65
+ if (ids.length === 0) {
66
+ return [];
67
+ }
68
+ return (await dbByName.dosleg.any(`
69
+ SELECT *
70
+ FROM denrap
71
+ WHERE coddenrap IN ($<ids:list>)
72
+ `, {
73
+ ids,
74
+ })).map((denrap) => trimFieldsRight(denrapFieldsToTrim, denrap));
75
+ };
76
+ export const getDocattsFromRapcods = async (ids) => {
77
+ if (ids.length === 0) {
78
+ return [];
79
+ }
80
+ return (await dbByName.dosleg.any(`
81
+ SELECT *
82
+ FROM docatt
83
+ WHERE rapcod IN($<ids:list>)
84
+ `, {
85
+ ids,
86
+ })).map((docatt) => parseIntFields(docattFieldsToParseInt, trimFieldsRight(docattFieldsToTrim, docatt)));
87
+ };
88
+ export const getEcrsFromRapcods = async (ids) => {
89
+ if (ids.length === 0) {
90
+ return [];
91
+ }
92
+ return (await dbByName.dosleg.any(`
93
+ SELECT *
94
+ FROM ecr
95
+ WHERE rapcod IN($<ids:list>)
96
+ `, {
97
+ ids,
98
+ })).map((ecr) => trimFieldsRight(ecrFieldsToTrim, ecr));
99
+ };
100
+ export const getEcrsFromTexcods = async (ids) => {
101
+ if (ids.length === 0) {
102
+ return [];
103
+ }
104
+ return (await dbByName.dosleg.any(`
105
+ SELECT *
106
+ FROM ecr
107
+ WHERE texcod IN($<ids:list>)
108
+ `, {
109
+ ids,
110
+ })).map((ecr) => trimFieldsRight(ecrFieldsToTrim, ecr));
111
+ };
112
+ export const getEtalois = async (ids) => {
113
+ if (ids.length === 0) {
114
+ return [];
115
+ }
116
+ return (await dbByName.dosleg.any(`
117
+ SELECT *
118
+ FROM etaloi
119
+ WHERE etaloicod IN ($<ids:list>)
120
+ `, {
121
+ ids,
122
+ })).map((etaloi) => trimFieldsRight(etaloiFieldsToTrim, etaloi));
123
+ };
124
+ export const getLecasssFromLecidts = async (ids) => {
125
+ if (ids.length === 0) {
126
+ return [];
127
+ }
128
+ return (await dbByName.dosleg.any(`
129
+ SELECT *
130
+ FROM lecass
131
+ WHERE lecidt IN ($<ids:list>)
132
+ `, {
133
+ ids,
134
+ })).map((lecass) => trimFieldsRight(lecassFieldsToTrim, lecass));
135
+ };
136
+ export const getLecassrapsFromLecassidts = async (ids) => {
137
+ if (ids.length === 0) {
138
+ return [];
139
+ }
140
+ return (await dbByName.dosleg.any(`
141
+ SELECT *
142
+ FROM lecassrap
143
+ WHERE lecassidt IN ($<ids:list>)
144
+ `, {
145
+ ids,
146
+ })).map((lecassrap) => trimFieldsRight(lecassrapFieldsToTrim, lecassrap));
147
+ };
148
+ export const getLecturesFromLoicods = async (ids) => {
149
+ if (ids.length === 0) {
150
+ return [];
151
+ }
152
+ return (await dbByName.dosleg.any(`
153
+ SELECT *
154
+ FROM lecture
155
+ WHERE loicod IN ($<ids:list>)
156
+ `, {
157
+ ids,
158
+ })).map((lecture) => trimFieldsRight(lectureFieldsToTrim, lecture));
159
+ };
160
+ export const getLois = async (ids) => {
161
+ if (ids.length === 0) {
162
+ return [];
163
+ }
164
+ return (await dbByName.dosleg.any(`
165
+ SELECT *
166
+ FROM loi
167
+ WHERE loicod IN ($<ids:list>)
168
+ `, {
169
+ ids,
170
+ })).map((loi) => trimFieldsRight(loiFieldsToTrim, loi));
171
+ };
172
+ export const getAllLois = async () => {
173
+ return (await dbByName.dosleg.any(`
174
+ SELECT *
175
+ FROM loi
176
+ `)).map((loi) => trimFieldsRight(loiFieldsToTrim, loi));
177
+ };
178
+ export const getOrgs = async (ids) => {
179
+ if (ids.length === 0) {
180
+ return [];
181
+ }
182
+ return (await dbByName.dosleg.any(`
183
+ SELECT *
184
+ FROM org
185
+ WHERE orgcod IN ($<ids:list>)
186
+ `, {
187
+ ids,
188
+ })).map((org) => trimFieldsRight(orgFieldsToTrim, org));
189
+ };
190
+ export const getOrgsFromRapcods = async (ids) => {
191
+ if (ids.length === 0) {
192
+ return [];
193
+ }
194
+ return (await dbByName.dosleg.any(`
195
+ SELECT *
196
+ FROM org
197
+ WHERE orgcod IN (
198
+ SELECT orgcod
199
+ FROM raporg
200
+ WHERE rapcod IN ($<ids:list>)
201
+ )
202
+ `, {
203
+ ids,
204
+ })).map((org) => trimFieldsRight(orgFieldsToTrim, org));
205
+ };
206
+ export const getRaporgsFromOrgcods = async (ids) => {
207
+ if (ids.length === 0) {
208
+ return [];
209
+ }
210
+ return (await dbByName.dosleg.any(`
211
+ SELECT *
212
+ FROM raporg
213
+ WHERE orgcod IN ($<ids:list>)
214
+ `, {
215
+ ids,
216
+ })).map((raporg) => trimFieldsRight(raporgFieldsToTrim, raporg));
217
+ };
218
+ export const getOritxts = async (ids) => {
219
+ if (ids.length === 0) {
220
+ return [];
221
+ }
222
+ return (await dbByName.dosleg.any(`
223
+ SELECT *
224
+ FROM oritxt
225
+ WHERE oritxtcod IN ($<ids:list>)
226
+ `, {
227
+ ids,
228
+ })).map((oritxt) => trimFieldsRight(oritxtFieldsToTrim, oritxt));
229
+ };
230
+ export const getQuas = async (ids) => {
231
+ if (ids.length === 0) {
232
+ return [];
233
+ }
234
+ return (await dbByName.dosleg.any(`
235
+ SELECT *
236
+ FROM qua
237
+ WHERE quacod IN ($<ids:list>)
238
+ `, {
239
+ ids,
240
+ })).map((qua) => trimFieldsRight(quaFieldsToTrim, qua));
241
+ };
242
+ export const getRaps = async (ids) => {
243
+ if (ids.length === 0) {
244
+ return [];
245
+ }
246
+ return (await dbByName.dosleg.any(`
247
+ SELECT *
248
+ FROM rap
249
+ WHERE rapcod IN ($<ids:list>)
250
+ `, {
251
+ ids,
252
+ })).map((rap) => parseIntFields(rapFieldsToParseInt, trimFieldsRight(rapFieldsToTrim, rap)));
253
+ };
254
+ export const getScrsFromCodes = async (ids) => {
255
+ if (ids.length === 0) {
256
+ return [];
257
+ }
258
+ return (await dbByName.dosleg.any(`
259
+ SELECT *
260
+ FROM scr
261
+ WHERE code IN ($<ids:list>)
262
+ `, {
263
+ ids,
264
+ })).map((scr) => trimFieldsRight(scrFieldsToTrim, scr));
265
+ };
266
+ export const getTextesFromLecassidts = async (ids) => {
267
+ if (ids.length === 0) {
268
+ return [];
269
+ }
270
+ return (await dbByName.dosleg.any(`
271
+ SELECT *
272
+ FROM texte
273
+ WHERE lecassidt IN ($<ids:list>)
274
+ `, {
275
+ ids,
276
+ })).map((texte) => parseIntFields(texteFieldsToParseInt, trimFieldsRight(texteFieldsToTrim, texte)));
277
+ };
278
+ export const getTypatts = async (ids) => {
279
+ if (ids.length === 0) {
280
+ return [];
281
+ }
282
+ return (await dbByName.dosleg.any(`
283
+ SELECT *
284
+ FROM typatt
285
+ WHERE typattcod IN ($<ids:list>)
286
+ `, {
287
+ ids,
288
+ })).map((typatt) => trimFieldsRight(typattFieldsToTrim, typatt));
289
+ };
290
+ export const getTyplecs = async (ids) => {
291
+ if (ids.length === 0) {
292
+ return [];
293
+ }
294
+ return (await dbByName.dosleg.any(`
295
+ SELECT *
296
+ FROM typlec
297
+ WHERE typleccod IN ($<ids:list>)
298
+ `, {
299
+ ids,
300
+ })).map((typlec) => trimFieldsRight(typlecFieldsToTrim, typlec));
301
+ };
302
+ export const getTyplois = async (ids) => {
303
+ if (ids.length === 0) {
304
+ return [];
305
+ }
306
+ return (await dbByName.dosleg.any(`
307
+ SELECT *
308
+ FROM typloi
309
+ WHERE typloicod IN ($<ids:list>)
310
+ `, {
311
+ ids,
312
+ })).map((typloi) => trimFieldsRight(typloiFieldsToTrim, typloi));
313
+ };
314
+ export const getTyptxts = async (ids) => {
315
+ if (ids.length === 0) {
316
+ return [];
317
+ }
318
+ return (await dbByName.dosleg.any(`
319
+ SELECT *
320
+ FROM typtxt
321
+ WHERE typtxtcod IN ($<ids:list>)
322
+ `, {
323
+ ids,
324
+ })).map((typtxt) => trimFieldsRight(typtxtFieldsToTrim, typtxt));
325
+ };
326
+ export const getTypurls = async (ids) => {
327
+ if (ids.length === 0) {
328
+ return [];
329
+ }
330
+ return (await dbByName.dosleg.any(`
331
+ SELECT *
332
+ FROM typurl
333
+ WHERE typurl IN ($<ids:list>)
334
+ `, {
335
+ ids,
336
+ })).map((typurl) => trimFieldsRight(typurlFieldsToTrim, typurl));
337
+ };