@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.
- package/README.md +53 -15
- package/lib/config.d.ts +1 -0
- package/lib/config.js +14 -45
- package/lib/databases.d.ts +9 -0
- package/lib/databases.js +90 -117
- package/lib/datasets.js +78 -83
- package/lib/index.d.ts +8 -7
- package/lib/index.js +42 -523
- package/lib/legislatures.json +38 -0
- package/lib/loaders.d.ts +64 -0
- package/lib/loaders.js +177 -0
- package/lib/model/ameli.d.ts +105 -4
- package/lib/model/ameli.js +88 -166
- package/lib/model/debats.d.ts +0 -4
- package/lib/model/debats.js +0 -122
- package/lib/model/dosleg.d.ts +227 -29
- package/lib/model/dosleg.js +205 -839
- package/lib/model/index.d.ts +4 -5
- package/lib/model/index.js +12 -47
- package/lib/model/questions.d.ts +88 -2
- package/lib/model/questions.js +75 -51
- package/lib/model/sens.d.ts +524 -2
- package/lib/model/sens.js +449 -56
- package/lib/model/texte.d.ts +7 -0
- package/lib/model/texte.js +251 -0
- package/lib/model/util.d.ts +7 -1
- package/lib/model/util.js +26 -59
- package/lib/raw_types/ameli.d.ts +912 -538
- package/lib/raw_types/ameli.js +3 -42
- package/lib/raw_types/debats.d.ts +204 -124
- package/lib/raw_types/debats.js +3 -21
- package/lib/raw_types/dosleg.d.ts +3533 -2024
- package/lib/raw_types/dosleg.js +3 -95
- package/lib/raw_types/questions.d.ts +404 -220
- package/lib/raw_types/questions.js +3 -21
- package/lib/raw_types/sens.d.ts +4391 -2706
- package/lib/raw_types/sens.js +3 -111
- package/lib/raw_types_schemats/ameli.d.ts +541 -0
- package/lib/raw_types_schemats/ameli.js +3 -0
- package/lib/raw_types_schemats/debats.d.ts +127 -0
- package/lib/raw_types_schemats/debats.js +3 -0
- package/lib/raw_types_schemats/dosleg.d.ts +2029 -0
- package/lib/raw_types_schemats/dosleg.js +3 -0
- package/lib/raw_types_schemats/questions.d.ts +233 -0
- package/lib/raw_types_schemats/questions.js +3 -0
- package/lib/raw_types_schemats/sens.d.ts +2709 -0
- package/lib/raw_types_schemats/sens.js +3 -0
- package/lib/scripts/convert_data.js +184 -275
- package/lib/scripts/datautil.d.ts +5 -0
- package/lib/scripts/datautil.js +21 -0
- package/lib/scripts/parse_textes.js +49 -0
- package/lib/scripts/retrieve_documents.js +255 -0
- package/lib/scripts/retrieve_open_data.js +211 -360
- package/lib/scripts/retrieve_senateurs_photos.js +144 -257
- package/lib/scripts/shared/cli_helpers.d.ts +44 -0
- package/lib/scripts/shared/cli_helpers.js +35 -0
- package/lib/scripts/shared/util.d.ts +3 -0
- package/lib/scripts/shared/util.js +36 -0
- package/lib/strings.js +20 -45
- package/lib/types/ameli.d.ts +2 -2
- package/lib/types/ameli.js +14 -25
- package/lib/types/debats.d.ts +2 -2
- package/lib/types/debats.js +3 -21
- package/lib/types/dosleg.d.ts +3 -3
- package/lib/types/dosleg.js +152 -119
- package/lib/types/questions.d.ts +2 -2
- package/lib/types/questions.js +1 -13
- package/lib/types/sens.d.ts +2 -4
- package/lib/types/sens.js +1 -16
- package/lib/types/sessions.d.ts +42 -0
- package/lib/types/sessions.js +46 -0
- package/lib/types/texte.d.ts +65 -0
- package/lib/types/texte.js +19 -0
- package/lib/validators/config.js +47 -111
- package/lib/validators/senat.js +1 -5
- package/package.json +35 -32
- package/lib/aggregates.d.ts +0 -54
- package/lib/aggregates.js +0 -1122
- package/lib/aggregates.mjs +0 -802
- package/lib/aggregates.ts +0 -947
- package/lib/config.mjs +0 -16
- package/lib/config.ts +0 -26
- package/lib/databases.mjs +0 -26
- package/lib/databases.ts +0 -32
- package/lib/datasets.mjs +0 -78
- package/lib/datasets.ts +0 -118
- package/lib/fields.d.ts +0 -10
- package/lib/fields.js +0 -68
- package/lib/fields.mjs +0 -22
- package/lib/fields.ts +0 -29
- package/lib/index.mjs +0 -7
- package/lib/index.ts +0 -63
- package/lib/inserters.d.ts +0 -102
- package/lib/inserters.js +0 -518
- package/lib/inserters.mjs +0 -376
- package/lib/inserters.ts +0 -545
- package/lib/model/ameli.mjs +0 -57
- package/lib/model/ameli.ts +0 -86
- package/lib/model/debats.mjs +0 -43
- package/lib/model/debats.ts +0 -68
- package/lib/model/dosleg.mjs +0 -337
- package/lib/model/dosleg.ts +0 -558
- package/lib/model/index.mjs +0 -5
- package/lib/model/index.ts +0 -11
- package/lib/model/questions.mjs +0 -8
- package/lib/model/questions.ts +0 -14
- package/lib/model/sens.mjs +0 -9
- package/lib/model/sens.ts +0 -18
- package/lib/model/util.mjs +0 -10
- package/lib/model/util.ts +0 -16
- package/lib/raw_types/ameli.mjs +0 -2
- package/lib/raw_types/ameli.ts +0 -601
- package/lib/raw_types/debats.mjs +0 -2
- package/lib/raw_types/debats.ts +0 -145
- package/lib/raw_types/dosleg.mjs +0 -2
- package/lib/raw_types/dosleg.ts +0 -2193
- package/lib/raw_types/questions.mjs +0 -2
- package/lib/raw_types/questions.ts +0 -249
- package/lib/raw_types/sens.mjs +0 -2
- package/lib/raw_types/sens.ts +0 -2907
- package/lib/scripts/convert_data.mjs +0 -146
- package/lib/scripts/convert_data.ts +0 -182
- package/lib/scripts/fix_db.js +0 -144
- package/lib/scripts/fix_db.mjs +0 -64
- package/lib/scripts/fix_db.ts +0 -75
- package/lib/scripts/images/transparent_150x192.jpg +0 -0
- package/lib/scripts/images/transparent_155x225.jpg +0 -0
- package/lib/scripts/retrieve_open_data.mjs +0 -218
- package/lib/scripts/retrieve_open_data.ts +0 -258
- package/lib/scripts/retrieve_senateurs_photos.mjs +0 -164
- package/lib/scripts/retrieve_senateurs_photos.ts +0 -200
- package/lib/scripts/retrieve_textes.js +0 -179
- package/lib/scripts/retrieve_textes.mjs +0 -77
- package/lib/scripts/retrieve_textes.ts +0 -95
- package/lib/strings.mjs +0 -18
- package/lib/strings.ts +0 -26
- package/lib/types/ameli.mjs +0 -13
- package/lib/types/ameli.ts +0 -21
- package/lib/types/debats.mjs +0 -2
- package/lib/types/debats.ts +0 -6
- package/lib/types/dosleg.mjs +0 -151
- package/lib/types/dosleg.ts +0 -284
- package/lib/types/questions.mjs +0 -1
- package/lib/types/questions.ts +0 -3
- package/lib/types/sens.mjs +0 -23
- package/lib/types/sens.ts +0 -36
- package/lib/typings/windows-1252.d.js +0 -2
- package/lib/typings/windows-1252.d.mjs +0 -2
- package/lib/typings/windows-1252.d.ts +0 -11
- package/lib/validators/config.mjs +0 -54
- package/lib/validators/config.ts +0 -79
- package/lib/validators/senat.mjs +0 -24
- package/lib/validators/senat.ts +0 -26
- /package/lib/scripts/{fix_db.d.ts → parse_textes.d.ts} +0 -0
- /package/lib/scripts/{retrieve_textes.d.ts → retrieve_documents.d.ts} +0 -0
package/lib/model/dosleg.ts
DELETED
|
@@ -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
|
-
}
|
package/lib/model/index.mjs
DELETED
package/lib/model/index.ts
DELETED
package/lib/model/questions.mjs
DELETED
package/lib/model/questions.ts
DELETED
|
@@ -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
|
-
}
|
package/lib/model/sens.mjs
DELETED
|
@@ -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
|
-
}
|
package/lib/model/util.mjs
DELETED
|
@@ -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
|
-
}
|
package/lib/raw_types/ameli.mjs
DELETED