@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,68 @@
1
+ import {
2
+ Debat, debatsFieldsToTrim,
3
+ LecAssDeb, lecassdebFieldsToTrim,
4
+ } from '../types/debats'
5
+ import { dbByName } from "../databases"
6
+ import { trimFieldsRight } from '../fields'
7
+
8
+ export const getDebats = async (ids: string[]): Promise<Debat[]> => {
9
+ if (ids.length === 0) {
10
+ return []
11
+ }
12
+ return (
13
+ await dbByName.debats.any(
14
+ `
15
+ SELECT *
16
+ FROM debats
17
+ WHERE datsea IN ($<ids:list>)
18
+ `,
19
+ {
20
+ ids,
21
+ },
22
+ )
23
+ ).map((debat: Debat) => trimFieldsRight(debatsFieldsToTrim, debat))
24
+ }
25
+
26
+ export const getDebatsFromLecassidts = async (
27
+ ids: string[],
28
+ ): Promise<Debat[]> => {
29
+ if (ids.length === 0) {
30
+ return []
31
+ }
32
+ return (
33
+ await dbByName.debats.any(
34
+ `
35
+ SELECT *
36
+ FROM debats
37
+ WHERE datsea IN (
38
+ SELECT datsea
39
+ FROM lecassdeb
40
+ WHERE lecassidt IN ($<ids:list>)
41
+ )
42
+ `,
43
+ {
44
+ ids,
45
+ },
46
+ )
47
+ ).map((debat: Debat) => trimFieldsRight(debatsFieldsToTrim, debat))
48
+ }
49
+
50
+ export const getLecAssDebsFromDatseas = async (
51
+ ids: string[],
52
+ ): Promise<LecAssDeb[]> => {
53
+ if (ids.length === 0) {
54
+ return []
55
+ }
56
+ return (
57
+ await dbByName.debats.any(
58
+ `
59
+ SELECT *
60
+ FROM lecassdeb
61
+ WHERE datsea IN ($<ids:list>)
62
+ `,
63
+ {
64
+ ids,
65
+ },
66
+ )
67
+ ).map((lecassdeb: LecAssDeb) => trimFieldsRight(lecassdebFieldsToTrim, lecassdeb))
68
+ }
@@ -0,0 +1,29 @@
1
+ import { Ass, Aud, Auteur, DateSeance, DecCoc, DenRap, DocAtt, Ecr, EtaLoi, LecAss, LecAssRap, Lecture, Loi, Org, OriTxt, Qua, Rap, RapOrg, Scr, Texte, TypAtt, TypLec, TypLoi, TypTxt, TypUrl } from '../types/dosleg';
2
+ export declare const getAsss: (ids: string[]) => Promise<Ass[]>;
3
+ export declare const getAudsFromLecassidts: (ids: string[]) => Promise<Aud[]>;
4
+ export declare const getAuteurs: (ids: string[]) => Promise<Auteur[]>;
5
+ export declare const getDatesSeancesFromLecassidts: (ids: string[]) => Promise<DateSeance[]>;
6
+ export declare const getDeccocs: (ids: string[]) => Promise<DecCoc[]>;
7
+ export declare const getDenraps: (ids: string[]) => Promise<DenRap[]>;
8
+ export declare const getDocattsFromRapcods: (ids: string[]) => Promise<DocAtt[]>;
9
+ export declare const getEcrsFromRapcods: (ids: string[]) => Promise<Ecr[]>;
10
+ export declare const getEcrsFromTexcods: (ids: string[]) => Promise<Ecr[]>;
11
+ export declare const getEtalois: (ids: string[]) => Promise<EtaLoi[]>;
12
+ export declare const getLecasssFromLecidts: (ids: string[]) => Promise<LecAss[]>;
13
+ export declare const getLecassrapsFromLecassidts: (ids: string[]) => Promise<LecAssRap[]>;
14
+ export declare const getLecturesFromLoicods: (ids: string[]) => Promise<Lecture[]>;
15
+ export declare const getLois: (ids: string[]) => Promise<Loi[]>;
16
+ export declare const getAllLois: () => Promise<Loi[]>;
17
+ export declare const getOrgs: (ids: string[]) => Promise<Org[]>;
18
+ export declare const getOrgsFromRapcods: (ids: string[]) => Promise<Org[]>;
19
+ export declare const getRaporgsFromOrgcods: (ids: string[]) => Promise<RapOrg[]>;
20
+ export declare const getOritxts: (ids: string[]) => Promise<OriTxt[]>;
21
+ export declare const getQuas: (ids: string[]) => Promise<Qua[]>;
22
+ export declare const getRaps: (ids: string[]) => Promise<Rap[]>;
23
+ export declare const getScrsFromCodes: (ids: string[]) => Promise<Scr[]>;
24
+ export declare const getTextesFromLecassidts: (ids: string[]) => Promise<Texte[]>;
25
+ export declare const getTypatts: (ids: string[]) => Promise<TypAtt[]>;
26
+ export declare const getTyplecs: (ids: string[]) => Promise<TypLec[]>;
27
+ export declare const getTyplois: (ids: string[]) => Promise<TypLoi[]>;
28
+ export declare const getTyptxts: (ids: string[]) => Promise<TypTxt[]>;
29
+ export declare const getTypurls: (ids: string[]) => Promise<TypUrl[]>;