@tricoteuses/senat 1.1.2 → 1.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 (155) hide show
  1. package/README.md +53 -15
  2. package/lib/config.d.ts +1 -0
  3. package/lib/config.js +14 -45
  4. package/lib/databases.d.ts +9 -0
  5. package/lib/databases.js +90 -117
  6. package/lib/datasets.js +78 -83
  7. package/lib/index.d.ts +8 -7
  8. package/lib/index.js +42 -523
  9. package/lib/legislatures.json +38 -0
  10. package/lib/loaders.d.ts +64 -0
  11. package/lib/loaders.js +177 -0
  12. package/lib/model/ameli.d.ts +105 -4
  13. package/lib/model/ameli.js +88 -166
  14. package/lib/model/debats.d.ts +0 -4
  15. package/lib/model/debats.js +0 -122
  16. package/lib/model/dosleg.d.ts +227 -29
  17. package/lib/model/dosleg.js +205 -839
  18. package/lib/model/index.d.ts +4 -5
  19. package/lib/model/index.js +12 -47
  20. package/lib/model/questions.d.ts +88 -2
  21. package/lib/model/questions.js +75 -51
  22. package/lib/model/sens.d.ts +524 -2
  23. package/lib/model/sens.js +449 -56
  24. package/lib/model/texte.d.ts +7 -0
  25. package/lib/model/texte.js +251 -0
  26. package/lib/model/util.d.ts +7 -1
  27. package/lib/model/util.js +26 -59
  28. package/lib/raw_types/ameli.d.ts +912 -538
  29. package/lib/raw_types/ameli.js +3 -42
  30. package/lib/raw_types/debats.d.ts +204 -124
  31. package/lib/raw_types/debats.js +3 -21
  32. package/lib/raw_types/dosleg.d.ts +3533 -2024
  33. package/lib/raw_types/dosleg.js +3 -95
  34. package/lib/raw_types/questions.d.ts +404 -220
  35. package/lib/raw_types/questions.js +3 -21
  36. package/lib/raw_types/sens.d.ts +4391 -2706
  37. package/lib/raw_types/sens.js +3 -111
  38. package/lib/raw_types_schemats/ameli.d.ts +541 -0
  39. package/lib/raw_types_schemats/ameli.js +3 -0
  40. package/lib/raw_types_schemats/debats.d.ts +127 -0
  41. package/lib/raw_types_schemats/debats.js +3 -0
  42. package/lib/raw_types_schemats/dosleg.d.ts +2029 -0
  43. package/lib/raw_types_schemats/dosleg.js +3 -0
  44. package/lib/raw_types_schemats/questions.d.ts +233 -0
  45. package/lib/raw_types_schemats/questions.js +3 -0
  46. package/lib/raw_types_schemats/sens.d.ts +2709 -0
  47. package/lib/raw_types_schemats/sens.js +3 -0
  48. package/lib/scripts/convert_data.js +184 -275
  49. package/lib/scripts/datautil.d.ts +5 -0
  50. package/lib/scripts/datautil.js +21 -0
  51. package/lib/scripts/parse_textes.js +49 -0
  52. package/lib/scripts/retrieve_documents.js +255 -0
  53. package/lib/scripts/retrieve_open_data.js +211 -360
  54. package/lib/scripts/retrieve_senateurs_photos.js +144 -257
  55. package/lib/scripts/shared/cli_helpers.d.ts +44 -0
  56. package/lib/scripts/shared/cli_helpers.js +35 -0
  57. package/lib/scripts/shared/util.d.ts +3 -0
  58. package/lib/scripts/shared/util.js +36 -0
  59. package/lib/strings.js +20 -45
  60. package/lib/types/ameli.d.ts +2 -2
  61. package/lib/types/ameli.js +14 -25
  62. package/lib/types/debats.d.ts +2 -2
  63. package/lib/types/debats.js +3 -21
  64. package/lib/types/dosleg.d.ts +3 -3
  65. package/lib/types/dosleg.js +152 -119
  66. package/lib/types/questions.d.ts +2 -2
  67. package/lib/types/questions.js +1 -13
  68. package/lib/types/sens.d.ts +2 -4
  69. package/lib/types/sens.js +1 -16
  70. package/lib/types/sessions.d.ts +42 -0
  71. package/lib/types/sessions.js +46 -0
  72. package/lib/types/texte.d.ts +65 -0
  73. package/lib/types/texte.js +19 -0
  74. package/lib/validators/config.js +47 -111
  75. package/lib/validators/senat.js +1 -5
  76. package/package.json +35 -32
  77. package/lib/aggregates.d.ts +0 -54
  78. package/lib/aggregates.js +0 -1122
  79. package/lib/aggregates.mjs +0 -802
  80. package/lib/aggregates.ts +0 -947
  81. package/lib/config.mjs +0 -16
  82. package/lib/config.ts +0 -26
  83. package/lib/databases.mjs +0 -26
  84. package/lib/databases.ts +0 -32
  85. package/lib/datasets.mjs +0 -78
  86. package/lib/datasets.ts +0 -118
  87. package/lib/fields.d.ts +0 -10
  88. package/lib/fields.js +0 -68
  89. package/lib/fields.mjs +0 -22
  90. package/lib/fields.ts +0 -29
  91. package/lib/index.mjs +0 -7
  92. package/lib/index.ts +0 -63
  93. package/lib/inserters.d.ts +0 -102
  94. package/lib/inserters.js +0 -518
  95. package/lib/inserters.mjs +0 -376
  96. package/lib/inserters.ts +0 -545
  97. package/lib/model/ameli.mjs +0 -57
  98. package/lib/model/ameli.ts +0 -86
  99. package/lib/model/debats.mjs +0 -43
  100. package/lib/model/debats.ts +0 -68
  101. package/lib/model/dosleg.mjs +0 -337
  102. package/lib/model/dosleg.ts +0 -558
  103. package/lib/model/index.mjs +0 -5
  104. package/lib/model/index.ts +0 -11
  105. package/lib/model/questions.mjs +0 -8
  106. package/lib/model/questions.ts +0 -14
  107. package/lib/model/sens.mjs +0 -9
  108. package/lib/model/sens.ts +0 -18
  109. package/lib/model/util.mjs +0 -10
  110. package/lib/model/util.ts +0 -16
  111. package/lib/raw_types/ameli.mjs +0 -2
  112. package/lib/raw_types/ameli.ts +0 -601
  113. package/lib/raw_types/debats.mjs +0 -2
  114. package/lib/raw_types/debats.ts +0 -145
  115. package/lib/raw_types/dosleg.mjs +0 -2
  116. package/lib/raw_types/dosleg.ts +0 -2193
  117. package/lib/raw_types/questions.mjs +0 -2
  118. package/lib/raw_types/questions.ts +0 -249
  119. package/lib/raw_types/sens.mjs +0 -2
  120. package/lib/raw_types/sens.ts +0 -2907
  121. package/lib/scripts/convert_data.mjs +0 -146
  122. package/lib/scripts/convert_data.ts +0 -182
  123. package/lib/scripts/fix_db.js +0 -144
  124. package/lib/scripts/fix_db.mjs +0 -64
  125. package/lib/scripts/fix_db.ts +0 -75
  126. package/lib/scripts/images/transparent_150x192.jpg +0 -0
  127. package/lib/scripts/images/transparent_155x225.jpg +0 -0
  128. package/lib/scripts/retrieve_open_data.mjs +0 -218
  129. package/lib/scripts/retrieve_open_data.ts +0 -258
  130. package/lib/scripts/retrieve_senateurs_photos.mjs +0 -164
  131. package/lib/scripts/retrieve_senateurs_photos.ts +0 -200
  132. package/lib/scripts/retrieve_textes.js +0 -179
  133. package/lib/scripts/retrieve_textes.mjs +0 -77
  134. package/lib/scripts/retrieve_textes.ts +0 -95
  135. package/lib/strings.mjs +0 -18
  136. package/lib/strings.ts +0 -26
  137. package/lib/types/ameli.mjs +0 -13
  138. package/lib/types/ameli.ts +0 -21
  139. package/lib/types/debats.mjs +0 -2
  140. package/lib/types/debats.ts +0 -6
  141. package/lib/types/dosleg.mjs +0 -151
  142. package/lib/types/dosleg.ts +0 -284
  143. package/lib/types/questions.mjs +0 -1
  144. package/lib/types/questions.ts +0 -3
  145. package/lib/types/sens.mjs +0 -23
  146. package/lib/types/sens.ts +0 -36
  147. package/lib/typings/windows-1252.d.js +0 -2
  148. package/lib/typings/windows-1252.d.mjs +0 -2
  149. package/lib/typings/windows-1252.d.ts +0 -11
  150. package/lib/validators/config.mjs +0 -54
  151. package/lib/validators/config.ts +0 -79
  152. package/lib/validators/senat.mjs +0 -24
  153. package/lib/validators/senat.ts +0 -26
  154. /package/lib/scripts/{fix_db.d.ts → parse_textes.d.ts} +0 -0
  155. /package/lib/scripts/{retrieve_textes.d.ts → retrieve_documents.d.ts} +0 -0
@@ -1,558 +0,0 @@
1
- import {
2
- Ass, assFieldsToTrim,
3
- Aud, audFieldsToTrim,
4
- Auteur, auteurFieldsToTrim,
5
- DateSeance, dateSeanceFieldsToTrim,
6
- DecCoc, deccocFieldsToTrim,
7
- DenRap, denrapFieldsToTrim,
8
- DocAtt, docattFieldsToParseInt, docattFieldsToTrim,
9
- Ecr, ecrFieldsToTrim,
10
- EtaLoi, etaloiFieldsToTrim,
11
- LecAss, lecassFieldsToTrim,
12
- LecAssRap, lecassrapFieldsToTrim,
13
- Lecture, lectureFieldsToTrim,
14
- Loi, loiFieldsToTrim,
15
- Org, orgFieldsToTrim,
16
- OriTxt, oritxtFieldsToTrim,
17
- Qua, quaFieldsToTrim,
18
- Rap, rapFieldsToParseInt, rapFieldsToTrim,
19
- RapOrg, raporgFieldsToTrim,
20
- Scr, scrFieldsToTrim,
21
- Texte, texteFieldsToParseInt, texteFieldsToTrim,
22
- TypAtt, typattFieldsToTrim,
23
- TypLec, typlecFieldsToTrim,
24
- TypLoi, typloiFieldsToTrim,
25
- TypTxt, typtxtFieldsToTrim,
26
- TypUrl, typurlFieldsToTrim,
27
- } from '../types/dosleg'
28
- import { dbByName } from "../databases"
29
- import { parseIntFields, trimFieldsRight } from '../fields'
30
-
31
- export const getAsss = async (ids: string[]): Promise<Ass[]> => {
32
- if (ids.length === 0) {
33
- return []
34
- }
35
- return (
36
- await dbByName.dosleg.any(
37
- `
38
- SELECT *
39
- FROM ass
40
- WHERE codass IN ($<ids:list>)
41
- `,
42
- {
43
- ids,
44
- },
45
- )
46
- ).map((ass: Ass) => trimFieldsRight(assFieldsToTrim, ass))
47
- }
48
-
49
- export const getAudsFromLecassidts = async (ids: string[]): Promise<Aud[]> => {
50
- if (ids.length === 0) {
51
- return []
52
- }
53
- return (
54
- await dbByName.dosleg.any(
55
- `
56
- SELECT *
57
- FROM aud
58
- WHERE lecassidt IN ($<ids:list>)
59
- `,
60
- {
61
- ids,
62
- },
63
- )
64
- ).map((aud: Aud) => trimFieldsRight(audFieldsToTrim, aud))
65
- }
66
-
67
- export const getAuteurs = async (ids: string[]): Promise<Auteur[]> => {
68
- if (ids.length === 0) {
69
- return []
70
- }
71
- return (
72
- await dbByName.dosleg.any(
73
- `
74
- SELECT *
75
- FROM auteur
76
- WHERE autcod IN ($<ids:list>)
77
- `,
78
- {
79
- ids,
80
- },
81
- )
82
- ).map((auteur: Auteur) => trimFieldsRight(auteurFieldsToTrim, auteur))
83
- }
84
-
85
- export const getDatesSeancesFromLecassidts = async (
86
- ids: string[],
87
- ): Promise<DateSeance[]> => {
88
- if (ids.length === 0) {
89
- return []
90
- }
91
- return (
92
- await dbByName.dosleg.any(
93
- `
94
- SELECT *
95
- FROM date_seance
96
- WHERE lecidt IN ($<ids:list>)
97
- `,
98
- {
99
- ids,
100
- },
101
- )
102
- ).map((dateSeance: DateSeance) =>
103
- trimFieldsRight(dateSeanceFieldsToTrim, dateSeance),
104
- )
105
- }
106
-
107
- export const getDeccocs = async (ids: string[]): Promise<DecCoc[]> => {
108
- if (ids.length === 0) {
109
- return []
110
- }
111
- return (
112
- await dbByName.dosleg.any(
113
- `
114
- SELECT *
115
- FROM deccoc
116
- WHERE deccoccod IN ($<ids:list>)
117
- `,
118
- {
119
- ids,
120
- },
121
- )
122
- ).map((deccoc: DecCoc) => trimFieldsRight(deccocFieldsToTrim, deccoc))
123
- }
124
-
125
- export const getDenraps = async (ids: string[]): Promise<DenRap[]> => {
126
- if (ids.length === 0) {
127
- return []
128
- }
129
- return (
130
- await dbByName.dosleg.any(
131
- `
132
- SELECT *
133
- FROM denrap
134
- WHERE coddenrap IN ($<ids:list>)
135
- `,
136
- {
137
- ids,
138
- },
139
- )
140
- ).map((denrap: DenRap) => trimFieldsRight(denrapFieldsToTrim, denrap))
141
- }
142
-
143
- export const getDocattsFromRapcods = async (
144
- ids: string[],
145
- ): Promise<DocAtt[]> => {
146
- if (ids.length === 0) {
147
- return []
148
- }
149
- return (
150
- await dbByName.dosleg.any(
151
- `
152
- SELECT *
153
- FROM docatt
154
- WHERE rapcod IN($<ids:list>)
155
- `,
156
- {
157
- ids,
158
- },
159
- )
160
- ).map((docatt: DocAtt) =>
161
- parseIntFields(
162
- docattFieldsToParseInt,
163
- trimFieldsRight(docattFieldsToTrim, docatt),
164
- ),
165
- )
166
- }
167
-
168
- export const getEcrsFromRapcods = async (ids: string[]): Promise<Ecr[]> => {
169
- if (ids.length === 0) {
170
- return []
171
- }
172
- return (
173
- await dbByName.dosleg.any(
174
- `
175
- SELECT *
176
- FROM ecr
177
- WHERE rapcod IN($<ids:list>)
178
- `,
179
- {
180
- ids,
181
- },
182
- )
183
- ).map((ecr: Ecr) => trimFieldsRight(ecrFieldsToTrim, ecr))
184
- }
185
-
186
- export const getEcrsFromTexcods = async (ids: string[]): Promise<Ecr[]> => {
187
- if (ids.length === 0) {
188
- return []
189
- }
190
- return (
191
- await dbByName.dosleg.any(
192
- `
193
- SELECT *
194
- FROM ecr
195
- WHERE texcod IN($<ids:list>)
196
- `,
197
- {
198
- ids,
199
- },
200
- )
201
- ).map((ecr: Ecr) => trimFieldsRight(ecrFieldsToTrim, ecr))
202
- }
203
-
204
- export const getEtalois = async (ids: string[]): Promise<EtaLoi[]> => {
205
- if (ids.length === 0) {
206
- return []
207
- }
208
- return (
209
- await dbByName.dosleg.any(
210
- `
211
- SELECT *
212
- FROM etaloi
213
- WHERE etaloicod IN ($<ids:list>)
214
- `,
215
- {
216
- ids,
217
- },
218
- )
219
- ).map((etaloi: EtaLoi) => trimFieldsRight(etaloiFieldsToTrim, etaloi))
220
- }
221
-
222
- export const getLecasssFromLecidts = async (
223
- ids: string[],
224
- ): Promise<LecAss[]> => {
225
- if (ids.length === 0) {
226
- return []
227
- }
228
- return (
229
- await dbByName.dosleg.any(
230
- `
231
- SELECT *
232
- FROM lecass
233
- WHERE lecidt IN ($<ids:list>)
234
- `,
235
- {
236
- ids,
237
- },
238
- )
239
- ).map((lecass: LecAss) => trimFieldsRight(lecassFieldsToTrim, lecass))
240
- }
241
-
242
- export const getLecassrapsFromLecassidts = async (
243
- ids: string[],
244
- ): Promise<LecAssRap[]> => {
245
- if (ids.length === 0) {
246
- return []
247
- }
248
- return (
249
- await dbByName.dosleg.any(
250
- `
251
- SELECT *
252
- FROM lecassrap
253
- WHERE lecassidt IN ($<ids:list>)
254
- `,
255
- {
256
- ids,
257
- },
258
- )
259
- ).map((lecassrap: LecAssRap) =>
260
- trimFieldsRight(lecassrapFieldsToTrim, lecassrap),
261
- )
262
- }
263
-
264
- export const getLecturesFromLoicods = async (
265
- ids: string[],
266
- ): Promise<Lecture[]> => {
267
- if (ids.length === 0) {
268
- return []
269
- }
270
- return (
271
- await dbByName.dosleg.any(
272
- `
273
- SELECT *
274
- FROM lecture
275
- WHERE loicod IN ($<ids:list>)
276
- `,
277
- {
278
- ids,
279
- },
280
- )
281
- ).map((lecture: Lecture) => trimFieldsRight(lectureFieldsToTrim, lecture))
282
- }
283
-
284
- export const getLois = async (ids: string[]): Promise<Loi[]> => {
285
- if (ids.length === 0) {
286
- return []
287
- }
288
- return (
289
- await dbByName.dosleg.any(
290
- `
291
- SELECT *
292
- FROM loi
293
- WHERE loicod IN ($<ids:list>)
294
- `,
295
- {
296
- ids,
297
- },
298
- )
299
- ).map((loi: Loi) => trimFieldsRight(loiFieldsToTrim, loi))
300
- }
301
-
302
- export const getAllLois = async (): Promise<Loi[]> => {
303
- return (
304
- await dbByName.dosleg.any(
305
- `
306
- SELECT *
307
- FROM loi
308
- `
309
- )
310
- ).map((loi: Loi) => trimFieldsRight(loiFieldsToTrim, loi))
311
- }
312
-
313
- export const getOrgs = async (ids: string[]): Promise<Org[]> => {
314
- if (ids.length === 0) {
315
- return []
316
- }
317
- return (
318
- await dbByName.dosleg.any(
319
- `
320
- SELECT *
321
- FROM org
322
- WHERE orgcod IN ($<ids:list>)
323
- `,
324
- {
325
- ids,
326
- },
327
- )
328
- ).map((org: Org) => trimFieldsRight(orgFieldsToTrim, org))
329
- }
330
-
331
- export const getOrgsFromRapcods = async (ids: string[]): Promise<Org[]> => {
332
- if (ids.length === 0) {
333
- return []
334
- }
335
- return (
336
- await dbByName.dosleg.any(
337
- `
338
- SELECT *
339
- FROM org
340
- WHERE orgcod IN (
341
- SELECT orgcod
342
- FROM raporg
343
- WHERE rapcod IN ($<ids:list>)
344
- )
345
- `,
346
- {
347
- ids,
348
- },
349
- )
350
- ).map((org: Org) => trimFieldsRight(orgFieldsToTrim, org))
351
- }
352
-
353
- export const getRaporgsFromOrgcods = async (ids: string[]): Promise<RapOrg[]> => {
354
- if (ids.length === 0) {
355
- return []
356
- }
357
- return (
358
- await dbByName.dosleg.any(
359
- `
360
- SELECT *
361
- FROM raporg
362
- WHERE orgcod IN ($<ids:list>)
363
- `,
364
- {
365
- ids,
366
- },
367
- )
368
- ).map((raporg: RapOrg) => trimFieldsRight(raporgFieldsToTrim, raporg))
369
- }
370
-
371
- export const getOritxts = async (ids: string[]): Promise<OriTxt[]> => {
372
- if (ids.length === 0) {
373
- return []
374
- }
375
- return (
376
- await dbByName.dosleg.any(
377
- `
378
- SELECT *
379
- FROM oritxt
380
- WHERE oritxtcod IN ($<ids:list>)
381
- `,
382
- {
383
- ids,
384
- },
385
- )
386
- ).map((oritxt: OriTxt) => trimFieldsRight(oritxtFieldsToTrim, oritxt))
387
- }
388
-
389
- export const getQuas = async (ids: string[]): Promise<Qua[]> => {
390
- if (ids.length === 0) {
391
- return []
392
- }
393
- return (
394
- await dbByName.dosleg.any(
395
- `
396
- SELECT *
397
- FROM qua
398
- WHERE quacod IN ($<ids:list>)
399
- `,
400
- {
401
- ids,
402
- },
403
- )
404
- ).map((qua: Qua) => trimFieldsRight(quaFieldsToTrim, qua))
405
- }
406
-
407
- export const getRaps = async (ids: string[]): Promise<Rap[]> => {
408
- if (ids.length === 0) {
409
- return []
410
- }
411
- return (
412
- await dbByName.dosleg.any(
413
- `
414
- SELECT *
415
- FROM rap
416
- WHERE rapcod IN ($<ids:list>)
417
- `,
418
- {
419
- ids,
420
- },
421
- )
422
- ).map((rap: Rap) =>
423
- parseIntFields(rapFieldsToParseInt, trimFieldsRight(rapFieldsToTrim, rap)),
424
- )
425
- }
426
-
427
- export const getScrsFromCodes = async (ids: string[]): Promise<Scr[]> => {
428
- if (ids.length === 0) {
429
- return []
430
- }
431
- return (
432
- await dbByName.dosleg.any(
433
- `
434
- SELECT *
435
- FROM scr
436
- WHERE code IN ($<ids:list>)
437
- `,
438
- {
439
- ids,
440
- },
441
- )
442
- ).map((scr: Scr) => trimFieldsRight(scrFieldsToTrim, scr))
443
- }
444
-
445
- export const getTextesFromLecassidts = async (
446
- ids: string[],
447
- ): Promise<Texte[]> => {
448
- if (ids.length === 0) {
449
- return []
450
- }
451
- return (
452
- await dbByName.dosleg.any(
453
- `
454
- SELECT *
455
- FROM texte
456
- WHERE lecassidt IN ($<ids:list>)
457
- `,
458
- {
459
- ids,
460
- },
461
- )
462
- ).map((texte: Texte) =>
463
- parseIntFields(
464
- texteFieldsToParseInt,
465
- trimFieldsRight(texteFieldsToTrim, texte),
466
- ),
467
- )
468
- }
469
-
470
- export const getTypatts = async (ids: string[]): Promise<TypAtt[]> => {
471
- if (ids.length === 0) {
472
- return []
473
- }
474
- return (
475
- await dbByName.dosleg.any(
476
- `
477
- SELECT *
478
- FROM typatt
479
- WHERE typattcod IN ($<ids:list>)
480
- `,
481
- {
482
- ids,
483
- },
484
- )
485
- ).map((typatt: TypAtt) => trimFieldsRight(typattFieldsToTrim, typatt))
486
- }
487
-
488
- export const getTyplecs = async (ids: string[]): Promise<TypLec[]> => {
489
- if (ids.length === 0) {
490
- return []
491
- }
492
- return (
493
- await dbByName.dosleg.any(
494
- `
495
- SELECT *
496
- FROM typlec
497
- WHERE typleccod IN ($<ids:list>)
498
- `,
499
- {
500
- ids,
501
- },
502
- )
503
- ).map((typlec: TypLec) => trimFieldsRight(typlecFieldsToTrim, typlec))
504
- }
505
-
506
- export const getTyplois = async (ids: string[]): Promise<TypLoi[]> => {
507
- if (ids.length === 0) {
508
- return []
509
- }
510
- return (
511
- await dbByName.dosleg.any(
512
- `
513
- SELECT *
514
- FROM typloi
515
- WHERE typloicod IN ($<ids:list>)
516
- `,
517
- {
518
- ids,
519
- },
520
- )
521
- ).map((typloi: TypLoi) => trimFieldsRight(typloiFieldsToTrim, typloi))
522
- }
523
-
524
- export const getTyptxts = async (ids: string[]): Promise<TypTxt[]> => {
525
- if (ids.length === 0) {
526
- return []
527
- }
528
- return (
529
- await dbByName.dosleg.any(
530
- `
531
- SELECT *
532
- FROM typtxt
533
- WHERE typtxtcod IN ($<ids:list>)
534
- `,
535
- {
536
- ids,
537
- },
538
- )
539
- ).map((typtxt: TypTxt) => trimFieldsRight(typtxtFieldsToTrim, typtxt))
540
- }
541
-
542
- export const getTypurls = async (ids: string[]): Promise<TypUrl[]> => {
543
- if (ids.length === 0) {
544
- return []
545
- }
546
- return (
547
- await dbByName.dosleg.any(
548
- `
549
- SELECT *
550
- FROM typurl
551
- WHERE typurl IN ($<ids:list>)
552
- `,
553
- {
554
- ids,
555
- },
556
- )
557
- ).map((typurl: TypUrl) => trimFieldsRight(typurlFieldsToTrim, typurl))
558
- }
@@ -1,5 +0,0 @@
1
- export { getAllLois } from "./dosleg";
2
- export { getAllQuestions } from "./questions";
3
- export { getAllSens } from "./sens";
4
- export { allFollows, Aggregator } from "../aggregates";
5
- export { getTables } from "./util";
@@ -1,11 +0,0 @@
1
- export {
2
- getAllLois
3
- } from "./dosleg"
4
- export {
5
- getAllQuestions
6
- } from "./questions"
7
- export {
8
- getAllSens
9
- } from "./sens"
10
- export { allFollows, Aggregator } from "../aggregates"
11
- export { getTables } from "./util"
@@ -1,8 +0,0 @@
1
- import { dbByName } from '../databases';
2
- export const getAllQuestions = async () => {
3
- return (await dbByName.questions.any(`
4
- SELECT *
5
- FROM tam_questions
6
- `));
7
- // TODO parse and trim?
8
- };
@@ -1,14 +0,0 @@
1
- import { Question } from '../types/questions'
2
- import { dbByName } from '../databases'
3
-
4
- export const getAllQuestions = async (): Promise<Question[]> => {
5
- return (
6
- await dbByName.questions.any(
7
- `
8
- SELECT *
9
- FROM tam_questions
10
- `
11
- )
12
- )
13
- // TODO parse and trim?
14
- }
@@ -1,9 +0,0 @@
1
- import { senFieldsToParseInt, senFieldsToTrim, } from '../types/sens';
2
- import { dbByName } from "../databases";
3
- import { parseIntFields, trimFieldsRight } from '../fields';
4
- export const getAllSens = async () => {
5
- return (await dbByName.sens.any(`
6
- SELECT *
7
- FROM sen
8
- `)).map((sen) => parseIntFields(senFieldsToParseInt, trimFieldsRight(senFieldsToTrim, sen)));
9
- };
package/lib/model/sens.ts DELETED
@@ -1,18 +0,0 @@
1
- import {
2
- Sen, senFieldsToParseInt, senFieldsToTrim,
3
- } from '../types/sens'
4
- import { dbByName } from "../databases"
5
- import { parseIntFields, trimFieldsRight } from '../fields'
6
-
7
- export const getAllSens = async (): Promise<Sen[]> => {
8
- return (
9
- await dbByName.sens.any(
10
- `
11
- SELECT *
12
- FROM sen
13
- `
14
- )
15
- ).map((sen: Sen) =>
16
- parseIntFields(senFieldsToParseInt, trimFieldsRight(senFieldsToTrim, sen)),
17
- )
18
- }
@@ -1,10 +0,0 @@
1
- import { dbByName } from '../databases';
2
- export const getTables = async (dbName, schema = "public") => {
3
- return (await dbByName[dbName].map(`
4
- SELECT table_name
5
- FROM information_schema.tables
6
- WHERE table_schema = $<schema>
7
- `, {
8
- schema
9
- }, (row) => row.table_name));
10
- };
package/lib/model/util.ts DELETED
@@ -1,16 +0,0 @@
1
- import { dbByName } from '../databases'
2
-
3
- export const getTables = async (dbName: string, schema = "public"): Promise<string[]> => {
4
- return (
5
- await dbByName[dbName].map(
6
- `
7
- SELECT table_name
8
- FROM information_schema.tables
9
- WHERE table_schema = $<schema>
10
- `, {
11
- schema
12
- },
13
- (row: { table_name: string }) => row.table_name
14
- )
15
- )
16
- }
@@ -1,2 +0,0 @@
1
- /* tslint:disable */
2
- export {};