@tricoteuses/senat 2.9.7 → 2.9.9

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.
@@ -1,11 +1,42 @@
1
- import { InferResult } from "kysely";
2
- export type DossierLegislatifResult = InferResult<typeof findAllQuery>[0];
3
- export type AuteurResult = InferResult<typeof findAuteursQuery>[0];
4
- declare const findAllQuery: import("kysely").SelectQueryBuilder<{
5
- ses: import("../raw_types/dosleg").Ses;
6
- qua: import("../raw_types/dosleg").Qua;
7
- lecture: import("../raw_types/dosleg").Lecture;
8
- loi: import("../raw_types/dosleg").Loi;
1
+ import { InferResult, SelectQueryBuilder } from "kysely";
2
+ declare const findAllDossiersQuery: SelectQueryBuilder<any, any, any>;
3
+ export declare function findAllDossiers(): AsyncIterableIterator<DossierLegislatifResult>;
4
+ export declare function findAllScrutins(): AsyncIterableIterator<{
5
+ numero: number;
6
+ votes: {
7
+ matricule_votant: string;
8
+ matricule_delegant: string | null;
9
+ position: string | null;
10
+ statut_votant: string | null;
11
+ titre_votant: string | null;
12
+ }[];
13
+ session: number;
14
+ date_scrutin: string;
15
+ date_scrutin_effective: string;
16
+ lecture_id: string | null;
17
+ intitule: string | null;
18
+ note: string | null;
19
+ nombre_majorite: number | null;
20
+ nombre_majorite_seance: number | null;
21
+ nombre_votants: number | null;
22
+ nombre_votants_seance: number | null;
23
+ nombre_suffrages: number | null;
24
+ nombre_suffrages_seance: number | null;
25
+ nombre_contre: number | null;
26
+ nombre_contre_seance: number | null;
27
+ nombre_pour: number | null;
28
+ nombre_pour_seance: number | null;
29
+ }>;
30
+ export declare function findSenatTexteUrls(sessions?: number[]): AsyncIterableIterator<{
31
+ session: number | null | undefined;
32
+ url: string;
33
+ hasExposeDesMotifs: boolean;
34
+ }>;
35
+ export declare function findSenatRapportUrls(sessions?: number[]): AsyncIterableIterator<{
36
+ url: string;
37
+ session: number | null | undefined;
38
+ }>;
39
+ declare const findAuteursQuery: SelectQueryBuilder<{
9
40
  amescr: import("../raw_types/dosleg").Amescr;
10
41
  ass: import("../raw_types/dosleg").Ass;
11
42
  aud: import("../raw_types/dosleg").Aud;
@@ -20,13 +51,15 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
20
51
  docatt: import("../raw_types/dosleg").Docatt;
21
52
  docsea: import("../raw_types/dosleg").Docsea;
22
53
  ecr: import("../raw_types/dosleg").Ecr;
23
- etaloi: import("kysely").Nullable<import("../raw_types/dosleg").Etaloi>;
54
+ etaloi: import("../raw_types/dosleg").Etaloi;
24
55
  evtsea: import("../raw_types/dosleg").Evtsea;
25
56
  forpub: import("../raw_types/dosleg").Forpub;
26
57
  gen: import("../raw_types/dosleg").Gen;
27
58
  lecass: import("../raw_types/dosleg").Lecass;
28
59
  lecassrap: import("../raw_types/dosleg").Lecassrap;
60
+ lecture: import("../raw_types/dosleg").Lecture;
29
61
  lnkrap: import("../raw_types/dosleg").Lnkrap;
62
+ loi: import("../raw_types/dosleg").Loi;
30
63
  loithe: import("../raw_types/dosleg").Loithe;
31
64
  natloi: import("../raw_types/dosleg").Natloi;
32
65
  org: import("../raw_types/dosleg").Org;
@@ -34,11 +67,13 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
34
67
  orippr: import("../raw_types/dosleg").Orippr;
35
68
  oritxt: import("../raw_types/dosleg").Oritxt;
36
69
  posvot: import("../raw_types/dosleg").Posvot;
70
+ qua: import("../raw_types/dosleg").Qua;
37
71
  rap: import("../raw_types/dosleg").Rap;
38
72
  raporg: import("../raw_types/dosleg").Raporg;
39
73
  rapthe: import("../raw_types/dosleg").Rapthe;
40
74
  rolsig: import("../raw_types/dosleg").Rolsig;
41
75
  scr: import("../raw_types/dosleg").Scr;
76
+ ses: import("../raw_types/dosleg").Ses;
42
77
  stavot: import("../raw_types/dosleg").Stavot;
43
78
  texte: import("../raw_types/dosleg").Texte;
44
79
  texte_ancien: import("../raw_types/dosleg").TexteAncien;
@@ -49,154 +84,13 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
49
84
  typdoc: import("../raw_types/dosleg").Typdoc;
50
85
  typevtsea: import("../raw_types/dosleg").Typevtsea;
51
86
  typlec: import("../raw_types/dosleg").Typlec;
52
- typloi: import("kysely").Nullable<import("../raw_types/dosleg").Typloi>;
87
+ typloi: import("../raw_types/dosleg").Typloi;
53
88
  typorg: import("../raw_types/dosleg").Typorg;
54
89
  typrap: import("../raw_types/dosleg").Typrap;
55
90
  typtxt: import("../raw_types/dosleg").Typtxt;
56
91
  typurl: import("../raw_types/dosleg").Typurl;
57
92
  votsen: import("../raw_types/dosleg").Votsen;
58
- }, "loi" | "etaloi" | "typloi", {
59
- url: string;
60
- signet: string;
61
- titre: string;
62
- titre_court: string;
63
- code_nature_dossier: string;
64
- libelle_type_dossier: string;
65
- etat_dossier: string;
66
- date_decision_CoC: string;
67
- date_saisine_CoC: string;
68
- date_promulgation: string;
69
- titre_JO: string;
70
- date_publication_JO: string;
71
- lectures: {
72
- type_lecture: string;
73
- libelle: string;
74
- ordre_lecture: string | null;
75
- lectures_assemblee: {
76
- assemblee: string;
77
- libelle_organisme: string | null;
78
- code_organisme: string | null;
79
- ordre_lecture_assemblee: string;
80
- session: string | null;
81
- textes: {
82
- url: string;
83
- numero: string | null;
84
- id: string | null;
85
- origine: string;
86
- type: string;
87
- date: string;
88
- session: string | null;
89
- auteurs: {
90
- prenom: string | null;
91
- nom_usuel: string;
92
- matricule: string | null;
93
- }[];
94
- }[];
95
- rapports: {
96
- url: string;
97
- id: string | null;
98
- type: string;
99
- date: string;
100
- session: string;
101
- auteurs: {
102
- prenom: string | null;
103
- nom_usuel: string;
104
- matricule: string | null;
105
- }[];
106
- numero: string | null;
107
- }[];
108
- dates_seances: {
109
- date: string;
110
- }[];
111
- }[];
112
- }[];
113
- themes: {
114
- libelle: string;
115
- }[];
116
- url_dossier_assemblee_nationale: string | null;
117
- num_decision_CoC: string | null;
118
- url_decision_CoC: string | null;
119
- condition_saisine_CoC: string | null;
120
- numero_loi: string | null;
121
- numero_JO: string | null;
122
- url_JO: string | null;
123
- }>;
124
- export declare function findAll(): AsyncIterableIterator<{
125
- url: string;
126
- signet: string;
127
- titre: string;
128
- titre_court: string;
129
- code_nature_dossier: string;
130
- libelle_type_dossier: string;
131
- etat_dossier: string;
132
- date_decision_CoC: string;
133
- date_saisine_CoC: string;
134
- date_promulgation: string;
135
- titre_JO: string;
136
- date_publication_JO: string;
137
- lectures: {
138
- type_lecture: string;
139
- libelle: string;
140
- ordre_lecture: string | null;
141
- lectures_assemblee: {
142
- assemblee: string;
143
- libelle_organisme: string | null;
144
- code_organisme: string | null;
145
- ordre_lecture_assemblee: string;
146
- session: string | null;
147
- textes: {
148
- url: string;
149
- numero: string | null;
150
- id: string | null;
151
- origine: string;
152
- type: string;
153
- date: string;
154
- session: string | null;
155
- auteurs: {
156
- prenom: string | null;
157
- nom_usuel: string;
158
- matricule: string | null;
159
- }[];
160
- }[];
161
- rapports: {
162
- url: string;
163
- id: string | null;
164
- type: string;
165
- date: string;
166
- session: string;
167
- auteurs: {
168
- prenom: string | null;
169
- nom_usuel: string;
170
- matricule: string | null;
171
- }[];
172
- numero: string | null;
173
- }[];
174
- dates_seances: {
175
- date: string;
176
- }[];
177
- }[];
178
- }[];
179
- themes: {
180
- libelle: string;
181
- }[];
182
- url_dossier_assemblee_nationale: string | null;
183
- num_decision_CoC: string | null;
184
- url_decision_CoC: string | null;
185
- condition_saisine_CoC: string | null;
186
- numero_loi: string | null;
187
- numero_JO: string | null;
188
- url_JO: string | null;
189
- }>;
190
- export declare function findSenatTexteUrls(sessions?: number[]): AsyncIterableIterator<{
191
- session: string | null | undefined;
192
- url: string;
193
- hasExposeDesMotifs: boolean;
194
- }>;
195
- export declare function findSenatRapportUrls(sessions?: number[]): AsyncIterableIterator<{
196
- url: string;
197
- session: string | null | undefined;
198
- }>;
199
- declare const findAuteursQuery: import("kysely").SelectQueryBuilder<import("../raw_types/dosleg").DB, "auteur", {
93
+ }, "auteur", {
200
94
  code: string;
201
95
  nom: string;
202
96
  prenom: string | null;
@@ -214,4 +108,6 @@ export declare function findAuteur(auteurCode: string): Promise<{
214
108
  prenom: string | null;
215
109
  matricule: string | null;
216
110
  } | undefined>;
111
+ export type DossierLegislatifResult = InferResult<typeof findAllDossiersQuery>[0];
112
+ export type AuteurResult = InferResult<typeof findAuteursQuery>[0];
217
113
  export {};
@@ -135,7 +135,47 @@ function themes(loiId) {
135
135
  "the.thelib as libelle",
136
136
  ]));
137
137
  }
138
- const findAllQuery = dbDosleg
138
+ function votes(scrutinNum) {
139
+ return jsonArrayFrom(dbDosleg
140
+ .selectFrom("votsen")
141
+ .leftJoin("titsen", "titsen.titsencod", "votsen.titsencod")
142
+ .leftJoin("stavot", "stavot.stavotidt", "votsen.stavotidt")
143
+ .leftJoin("posvot", "posvot.posvotcod", "votsen.posvotcod")
144
+ .where("votsen.scrnum", "=", scrutinNum)
145
+ .select([
146
+ "votsen.senmat as matricule_votant",
147
+ "votsen.senmatdel as matricule_delegant",
148
+ "posvot.posvotlib as position",
149
+ "stavot.stavotlib as statut_votant",
150
+ "titsen.titsenlib as titre_votant",
151
+ ]));
152
+ }
153
+ const findAllScrutinsQuery = dbDosleg
154
+ .selectFrom("scr")
155
+ .leftJoin("date_seance", "scr.code", "date_seance.code")
156
+ .leftJoin("lecture", "date_seance.lecidt", "lecture.lecidt")
157
+ .select(({ eb, ref, val }) => [
158
+ "scr.sesann as session",
159
+ "scr.scrnum as numero",
160
+ "date_seance.lecidt as lecture_id",
161
+ toDateString(ref("scr.scrdat")).as("date_scrutin"),
162
+ toDateString(ref("scr.scrdateff")).as("date_scrutin_effective"),
163
+ "scr.scrint as intitule",
164
+ "scr.scrbaspag as note",
165
+ "scr.scrmaj as nombre_majorite",
166
+ "scr.scrmajsea as nombre_majorite_seance",
167
+ "scr.scrvot as nombre_votants",
168
+ "scr.scrvotsea as nombre_votants_seance",
169
+ "scr.scrsuf as nombre_suffrages",
170
+ "scr.scrsufsea as nombre_suffrages_seance",
171
+ "scr.scrcon as nombre_contre",
172
+ "scr.scrconsea as nombre_contre_seance",
173
+ "scr.scrpou as nombre_pour",
174
+ "scr.scrpousea as nombre_pour_seance",
175
+ votes(ref("scr.scrnum")).as("votes"),
176
+ ])
177
+ .$narrowType();
178
+ const findAllDossiersQuery = dbDosleg
139
179
  .selectFrom("loi")
140
180
  .leftJoin("typloi", "typloi.typloicod", "loi.typloicod")
141
181
  .leftJoin("etaloi", "etaloi.etaloicod", "loi.etaloicod")
@@ -169,16 +209,19 @@ const findAllQuery = dbDosleg
169
209
  themes(ref("loi.loicod")).as("themes"),
170
210
  ])
171
211
  .$narrowType();
172
- export function findAll() {
173
- return findAllQuery.stream();
212
+ export function findAllDossiers() {
213
+ return findAllDossiersQuery.stream();
214
+ }
215
+ export function findAllScrutins() {
216
+ return findAllScrutinsQuery.stream();
174
217
  }
175
218
  export function findSenatTexteUrls(sessions = []) {
176
- const sessionsStr = sessions.map(session => String(session));
219
+ const sessionsList = sessions.map(session => session);
177
220
  return dbDosleg
178
221
  .selectFrom("texte")
179
222
  .where("texurl", "is not", null)
180
223
  .where("typurl", "=", "I")
181
- .$if(sessions.length > 0, (qb) => qb.where("sesann", "in", sessionsStr))
224
+ .$if(sessionsList.length > 0, (qb) => qb.where("sesann", "in", sessionsList))
182
225
  .select(({ eb, ref }) => [
183
226
  "sesann as session",
184
227
  rtrim(ref("texurl")).as("url"),
@@ -194,12 +237,12 @@ export function findSenatTexteUrls(sessions = []) {
194
237
  .stream();
195
238
  }
196
239
  export function findSenatRapportUrls(sessions = []) {
197
- const sessionsStr = sessions.map(session => String(session));
240
+ const sessionsList = sessions.map(session => session);
198
241
  return dbDosleg
199
242
  .selectFrom("rap")
200
243
  .where("rapurl", "is not", null)
201
244
  .where("typurl", "=", "I")
202
- .$if(sessions.length > 0, (qb) => qb.where("sesann", "in", sessionsStr))
245
+ .$if(sessionsList.length > 0, (qb) => qb.where("sesann", "in", sessionsList))
203
246
  .select(({ ref }) => [
204
247
  "sesann as session",
205
248
  rtrim(ref("rapurl")).as("url"),
@@ -1,5 +1,5 @@
1
1
  export { findAll as findAllAmendements } from "./ameli";
2
2
  export { findAll as findAllDebats } from "./debats";
3
- export { findAll as findAllLois, findAuteur, findAuteurs, findSenatRapportUrls, findSenatTexteUrls, } from "./dosleg";
3
+ export { findAllDossiers, findAllScrutins, findAuteur, findAuteurs, findSenatRapportUrls, findSenatTexteUrls, } from "./dosleg";
4
4
  export { findAll as findAllQuestions } from "./questions";
5
5
  export { findAll as findAllSens, findAllCirconscriptions, findAllOrganismes, } from "./sens";
@@ -1,5 +1,5 @@
1
1
  export { findAll as findAllAmendements } from "./ameli";
2
2
  export { findAll as findAllDebats } from "./debats";
3
- export { findAll as findAllLois, findAuteur, findAuteurs, findSenatRapportUrls, findSenatTexteUrls, } from "./dosleg";
3
+ export { findAllDossiers, findAllScrutins, findAuteur, findAuteurs, findSenatRapportUrls, findSenatTexteUrls, } from "./dosleg";
4
4
  export { findAll as findAllQuestions } from "./questions";
5
5
  export { findAll as findAllSens, findAllCirconscriptions, findAllOrganismes, } from "./sens";
@@ -2,17 +2,17 @@ import { InferResult } from "kysely";
2
2
  export type QuestionResult = InferResult<typeof findAllQuery>[0];
3
3
  declare const findAllQuery: import("kysely").SelectQueryBuilder<{
4
4
  the: import("../raw_types/questions").The;
5
- tam_questions: import("../raw_types/questions").TamQuestions;
6
5
  etatquestion: import("kysely").Nullable<import("../raw_types/questions").Etatquestion>;
7
6
  legquestion: import("../raw_types/questions").Legquestion;
8
7
  naturequestion: import("kysely").Nullable<import("../raw_types/questions").Naturequestion>;
9
8
  sortquestion: import("kysely").Nullable<import("../raw_types/questions").Sortquestion>;
10
9
  tam_ministeres: import("kysely").Nullable<import("../raw_types/questions").TamMinisteres>;
10
+ tam_questions: import("../raw_types/questions").TamQuestions;
11
11
  tam_reponses: import("../raw_types/questions").TamReponses;
12
- }, "tam_questions" | "etatquestion" | "naturequestion" | "sortquestion" | "tam_ministeres", {
12
+ }, "etatquestion" | "naturequestion" | "sortquestion" | "tam_ministeres" | "tam_questions", {
13
13
  date_publication_JO: string;
14
- republique: string | null;
15
- legislature: string | null;
14
+ republique: number | null;
15
+ legislature: number | null;
16
16
  sort: string | null;
17
17
  nature: string | null;
18
18
  numero: string | null;
@@ -48,8 +48,8 @@ declare const findAllQuery: import("kysely").SelectQueryBuilder<{
48
48
  }>;
49
49
  export declare function findAll(): AsyncIterableIterator<{
50
50
  date_publication_JO: string;
51
- republique: string | null;
52
- legislature: string | null;
51
+ republique: number | null;
52
+ legislature: number | null;
53
53
  sort: string | null;
54
54
  nature: string | null;
55
55
  numero: string | null;