@tricoteuses/assemblee 3.2.0 → 3.2.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/lib/{amendements-DaB_5WaI.js → amendements-Aa0U8Egw.js} +1 -1
- package/lib/{amendements-D3Jr9MQa.js → amendements-DHZKmvto.js} +532 -532
- package/lib/cleaners/reunions.d.ts +1 -1
- package/lib/cleaners.js +116 -116
- package/lib/index.d.ts +7 -7
- package/lib/index.js +17 -17
- package/lib/loaders-DUazQFWL.js +854 -0
- package/lib/loaders.js +2 -2
- package/lib/parsers.js +30 -30
- package/lib/schemas/clean/questions.d.ts +2 -2
- package/lib/scrutins-B7gvdRyt.js +2053 -0
- package/package.json +1 -1
- package/lib/loaders-CY8EGNSM.js +0 -1325
- package/lib/questions-CsNQoayp.js +0 -1581
package/lib/loaders.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as e,
|
|
2
|
-
export {
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, x, y as S } from "./loaders-DUazQFWL.js";
|
|
2
|
+
export { e as EnabledDatasets, v as datasets, p as iterLoadAssembleeActeurs, g as iterLoadAssembleeAmendements, u as iterLoadAssembleeComptesRendus, r as iterLoadAssembleeDocuments, m as iterLoadAssembleeDossiersParlementaires, _ as iterLoadAssembleeOrganes, a as iterLoadAssembleeQuestions, d as iterLoadAssembleeReunions, y as iterLoadAssembleeScrutins, o as loadAssembleeData, s as loadAssembleeDataFromBigFiles, h as loadAssembleeDocumentFile, f as loadAssembleePhotosDeputes, l as loadAssembleePhotosSenateurs, c as pathFromCompteRenduUid, n as pathFromDocumentUid, b as pathFromDossierParlementaireUid, S as pathFromQuestionUid, i as pathFromReunionUid, x as pathFromScrutinUid, t as walkDir };
|
package/lib/parsers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as a } from "./amendements-
|
|
1
|
+
import { _t as e, gt as t, ht as n, r, vt as i } from "./amendements-DHZKmvto.js";
|
|
2
|
+
import { t as a } from "./amendements-Aa0U8Egw.js";
|
|
3
3
|
import o from "node:assert";
|
|
4
4
|
import s from "fs-extra";
|
|
5
5
|
import c from "node:path";
|
|
@@ -8407,23 +8407,23 @@ function Hu(e, t) {
|
|
|
8407
8407
|
}
|
|
8408
8408
|
//#endregion
|
|
8409
8409
|
//#region node_modules/date-fns/formatISO.js
|
|
8410
|
-
function Uu(
|
|
8411
|
-
let
|
|
8412
|
-
if (isNaN(+
|
|
8413
|
-
let a =
|
|
8410
|
+
function Uu(t, n) {
|
|
8411
|
+
let r = i(t, n?.in);
|
|
8412
|
+
if (isNaN(+r)) throw RangeError("Invalid time value");
|
|
8413
|
+
let a = n?.format ?? "extended", o = n?.representation ?? "complete", s = "", c = "", l = a === "extended" ? "-" : "", u = a === "extended" ? ":" : "";
|
|
8414
8414
|
if (o !== "time") {
|
|
8415
|
-
let
|
|
8416
|
-
s = `${
|
|
8415
|
+
let t = e(r.getDate(), 2), n = e(r.getMonth() + 1, 2);
|
|
8416
|
+
s = `${e(r.getFullYear(), 4)}${l}${n}${l}${t}`;
|
|
8417
8417
|
}
|
|
8418
8418
|
if (o !== "date") {
|
|
8419
|
-
let
|
|
8420
|
-
if (
|
|
8421
|
-
let n = Math.abs(
|
|
8422
|
-
c = `${
|
|
8419
|
+
let t = r.getTimezoneOffset();
|
|
8420
|
+
if (t !== 0) {
|
|
8421
|
+
let n = Math.abs(t), r = e(Math.trunc(n / 60), 2), i = e(n % 60, 2);
|
|
8422
|
+
c = `${t < 0 ? "+" : "-"}${r}:${i}`;
|
|
8423
8423
|
} else c = "Z";
|
|
8424
|
-
let n =
|
|
8424
|
+
let n = e(r.getHours(), 2), i = e(r.getMinutes(), 2), a = e(r.getSeconds(), 2), o = s === "" ? "" : "T", l = [
|
|
8425
8425
|
n,
|
|
8426
|
-
|
|
8426
|
+
i,
|
|
8427
8427
|
a
|
|
8428
8428
|
].join(u);
|
|
8429
8429
|
s = `${s}${o}${l}${c}`;
|
|
@@ -8432,16 +8432,16 @@ function Uu(e, r) {
|
|
|
8432
8432
|
}
|
|
8433
8433
|
//#endregion
|
|
8434
8434
|
//#region src/parsers/recherche_amendements.ts
|
|
8435
|
-
async function* Wu(e, t, n,
|
|
8436
|
-
for await (let [c, l] of Gu(e, t, n,
|
|
8435
|
+
async function* Wu(e, t, n, i, o, s = {}) {
|
|
8436
|
+
for await (let [c, l] of Gu(e, t, n, i, o, s)) a(l), yield [c, r.toAmendement(JSON.stringify(l))];
|
|
8437
8437
|
}
|
|
8438
|
-
async function* Gu(
|
|
8439
|
-
await s.ensureDir(
|
|
8438
|
+
async function* Gu(e, r, i, a, p, m = {}) {
|
|
8439
|
+
await s.ensureDir(e), o.strictEqual(/[?&]date_depot=/.exec(r), null, `URL ${r} already contains a deposit date`), o.strictEqual(/[?&]order=/.exec(r), null, `URL ${r} already contains a sort order`), o.strictEqual(/[?&]page=/.exec(r), null, `URL ${r} already contains a page number`), i && o.notStrictEqual(/[?&]etat=/.exec(r), null, `In incremental mode, URL ${r} must contain an "etat" query parameter`), r += (r.includes("?") ? "&" : "?") + "order=date_depot,desc&page=1", a != null && o.notStrictEqual(/\d{4}-\d{2}-\d{2}/.exec(a), null, `Invalid format for minimum date: ${a}`);
|
|
8440
8440
|
let ee = 0;
|
|
8441
8441
|
iterSearchPages: for (;;) {
|
|
8442
|
-
m.verbose && console.log(`Fetching amendements search page at ${
|
|
8443
|
-
let h = await fetch(
|
|
8444
|
-
o(h.ok, `Retrieval of search page at ${
|
|
8442
|
+
m.verbose && console.log(`Fetching amendements search page at ${r}…`);
|
|
8443
|
+
let h = await fetch(r);
|
|
8444
|
+
o(h.ok, `Retrieval of search page at ${r} failed with error: ${h.status} ${h.statusText}`);
|
|
8445
8445
|
let g = f(await h.text());
|
|
8446
8446
|
if (g.querySelector("div.no-result") !== null) break;
|
|
8447
8447
|
let _ = g.querySelector("div.mirror-card-subtitle");
|
|
@@ -8470,25 +8470,25 @@ async function* Gu(t, n, i, a, p, m = {}) {
|
|
|
8470
8470
|
o.notStrictEqual(ie.length, 0);
|
|
8471
8471
|
for (let l of ie) {
|
|
8472
8472
|
if (ee++, a != null || p != null) {
|
|
8473
|
-
let
|
|
8474
|
-
if (o.strictEqual(
|
|
8475
|
-
let
|
|
8476
|
-
if (Uu(
|
|
8473
|
+
let e = l.querySelectorAll("td");
|
|
8474
|
+
if (o.strictEqual(e.length, 11, `Unexpected number of columns in amendment row: ${l.outerHTML}`), a != null) {
|
|
8475
|
+
let r = e[10];
|
|
8476
|
+
if (Uu(n(r.text, "d MMMM y", /* @__PURE__ */ new Date(), { locale: t }), { representation: "date" }) < a) break iterSearchPages;
|
|
8477
8477
|
}
|
|
8478
8478
|
if (p != null) {
|
|
8479
|
-
let
|
|
8480
|
-
if (
|
|
8479
|
+
let r = e[7];
|
|
8480
|
+
if (r.text && Uu(n(r.text, "d MMMM y", /* @__PURE__ */ new Date(), { locale: t }), { representation: "date" }) < p) continue;
|
|
8481
8481
|
}
|
|
8482
8482
|
}
|
|
8483
8483
|
let h = l.getAttribute("data-href");
|
|
8484
8484
|
o.notStrictEqual(h, void 0);
|
|
8485
8485
|
let g = h.split("/");
|
|
8486
8486
|
o.strictEqual(g[0], "", `Unexpected URL path for amendement: ${h}`), o.strictEqual(g[1], "dyn", `Unexpected URL path for amendement: ${h}`);
|
|
8487
|
-
let _ = c.join(
|
|
8487
|
+
let _ = c.join(e, ...g.slice(2)) + ".html";
|
|
8488
8488
|
await s.ensureDir(c.dirname(_));
|
|
8489
8489
|
let v = await s.pathExists(_) ? await s.readFile(_, "utf8") : null, ne = l.outerHTML, re = `---\n${d.dump({
|
|
8490
8490
|
position: te - ee,
|
|
8491
|
-
search:
|
|
8491
|
+
search: r.replace(/&page=[\d]+/, "")
|
|
8492
8492
|
}, { sortKeys: !0 })}---\n\n${ne}`;
|
|
8493
8493
|
if (re === v) {
|
|
8494
8494
|
if (i) break iterSearchPages;
|
|
@@ -8519,7 +8519,7 @@ async function* Gu(t, n, i, a, p, m = {}) {
|
|
|
8519
8519
|
let ae = g.querySelector("div.an-pagination--item > i.an-icons-chevron-right ~ a");
|
|
8520
8520
|
if (ae === null) break;
|
|
8521
8521
|
let oe = ae.getAttribute("href");
|
|
8522
|
-
o.notStrictEqual(oe, void 0),
|
|
8522
|
+
o.notStrictEqual(oe, void 0), r = new URL(oe, "https://www.assemblee-nationale.fr/").toString();
|
|
8523
8523
|
}
|
|
8524
8524
|
}
|
|
8525
8525
|
//#endregion
|
|
@@ -269,7 +269,7 @@ export type RenouvellementClean = z.infer<typeof RenouvellementCleanSchema>;
|
|
|
269
269
|
* Renouvellements (renewals) - clean version
|
|
270
270
|
* Note: Array unwrapped from wrapper object by cleaner
|
|
271
271
|
*/
|
|
272
|
-
export declare const
|
|
272
|
+
export declare const RenouvellementCleansSchema: z.ZodObject<{
|
|
273
273
|
renouvellement: z.ZodArray<z.ZodObject<{
|
|
274
274
|
infoJO: z.ZodObject<{
|
|
275
275
|
typeJO: z.ZodOptional<z.ZodEnum<{
|
|
@@ -285,7 +285,7 @@ export declare const RenouvellementCleanssSchema: z.ZodObject<{
|
|
|
285
285
|
}, z.core.$strip>;
|
|
286
286
|
}, z.core.$strip>>;
|
|
287
287
|
}, z.core.$strip>;
|
|
288
|
-
export type RenouvellementCleans = z.infer<typeof
|
|
288
|
+
export type RenouvellementCleans = z.infer<typeof RenouvellementCleansSchema>;
|
|
289
289
|
/**
|
|
290
290
|
* Question.
|
|
291
291
|
*
|