@tricoteuses/senat 3.1.16 → 3.1.17
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.
|
@@ -44,7 +44,7 @@ export declare function loadSenatTexteContent(dataDir: string, session: number |
|
|
|
44
44
|
export declare function loadSenatCompteRenduContent(dataDir: string, session: number, debatId: string | number): {
|
|
45
45
|
item: CompteRendu | null;
|
|
46
46
|
};
|
|
47
|
-
export declare function iterLoadSenatAgendas(dataDir: string, session: number | undefined): Generator<IterItem<Reunion>>;
|
|
47
|
+
export declare function iterLoadSenatAgendas(dataDir: string, session: number | undefined, options?: {}): Generator<IterItem<Reunion>>;
|
|
48
48
|
export declare function iterLoadSenatCirconscriptions(dataDir: string, options?: {}): Generator<IterItem<CirconscriptionResult>>;
|
|
49
49
|
export declare function iterLoadSenatOrganismes(dataDir: string, options?: {}): Generator<IterItem<OrganismeResult>>;
|
|
50
50
|
export declare function iterLoadSenatSenateurs(dataDir: string, options?: {}): Generator<IterItem<SenateurResult>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fsex from "fs-extra";
|
|
2
1
|
import fs from "fs";
|
|
3
2
|
import path from "path";
|
|
4
3
|
import * as git from "./git.js";
|
|
@@ -207,30 +206,16 @@ export function loadSenatCompteRenduContent(dataDir, session, debatId) {
|
|
|
207
206
|
const json = fs.readFileSync(fullPath, { encoding: "utf8" });
|
|
208
207
|
return { item: JSON.parse(json) };
|
|
209
208
|
}
|
|
210
|
-
export function* iterLoadSenatAgendas(dataDir, session) {
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
return;
|
|
214
|
-
const files = (fs.readdirSync(baseDir) || []).filter((f) => f.startsWith("RUSN") && f.endsWith(".json")).sort();
|
|
215
|
-
for (const fileName of files) {
|
|
216
|
-
const filePath = path.join(baseDir, fileName);
|
|
217
|
-
let raw;
|
|
218
|
-
try {
|
|
219
|
-
raw = fsex.readJSONSync(filePath);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
continue; // JSON invalide
|
|
223
|
-
}
|
|
224
|
-
if (!raw || typeof raw !== "object")
|
|
225
|
-
continue;
|
|
226
|
-
const gr = raw;
|
|
209
|
+
export function* iterLoadSenatAgendas(dataDir, session, options = {}) {
|
|
210
|
+
for (const reunionItem of iterLoadSenatItems(dataDir, AGENDA_FOLDER, session, DATA_TRANSFORMED_FOLDER, options)) {
|
|
211
|
+
const gr = reunionItem.item;
|
|
227
212
|
if (!gr.uid || !gr.date || !gr.titre)
|
|
228
213
|
continue;
|
|
229
|
-
|
|
214
|
+
reunionItem.item = {
|
|
230
215
|
...gr,
|
|
231
216
|
events: Array.isArray(gr.events) ? gr.events : [],
|
|
232
217
|
};
|
|
233
|
-
yield
|
|
218
|
+
yield reunionItem;
|
|
234
219
|
}
|
|
235
220
|
}
|
|
236
221
|
export function* iterLoadSenatCirconscriptions(dataDir, options = {}) {
|