@tricoteuses/assemblee 2.4.1 → 2.4.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.
@@ -0,0 +1,33 @@
1
+ import c from "fs-extra";
2
+ import { glob as f } from "glob";
3
+ import r from "node:path";
4
+ function* l(i, o = []) {
5
+ const t = r.join(i, ...o);
6
+ if (c.existsSync(t))
7
+ for (const s of c.readdirSync(t)) {
8
+ if (s[0] === ".")
9
+ continue;
10
+ const e = r.join(t, s), n = [...o, s];
11
+ c.statSync(e).isDirectory() ? yield* l(i, n) : yield n;
12
+ }
13
+ }
14
+ class a {
15
+ constructor(o) {
16
+ this.message = o;
17
+ }
18
+ }
19
+ function g(i) {
20
+ let o = [];
21
+ function t(s) {
22
+ if (f.hasMagic(s)) {
23
+ const e = f.globSync(s, { cwd: process.cwd() });
24
+ e.length > 0 && (o = o.concat(e));
25
+ } else if (o.push(s), !c.existsSync(s))
26
+ throw new a(`${s} file does not exist`);
27
+ }
28
+ return i.forEach(t), o;
29
+ }
30
+ export {
31
+ g,
32
+ l as w
33
+ };
package/lib/git.js ADDED
@@ -0,0 +1,121 @@
1
+ import l from "fs-extra";
2
+ import { execSync as r } from "node:child_process";
3
+ import $ from "node:path";
4
+ import { g as p } from "./file_systems-CzTtoLWb.js";
5
+ const a = 50 * 1024 * 1024;
6
+ function v(e, c) {
7
+ r("git add .", {
8
+ cwd: e,
9
+ env: process.env,
10
+ encoding: "utf-8",
11
+ stdio: ["ignore", "ignore", "pipe"],
12
+ maxBuffer: a
13
+ });
14
+ try {
15
+ return r(`git commit -m "${c}" --quiet`, {
16
+ cwd: e,
17
+ env: process.env,
18
+ encoding: "utf-8",
19
+ stdio: ["ignore", "pipe", "pipe"]
20
+ }), !0;
21
+ } catch (t) {
22
+ if (t.stdout === null || !/nothing to commit/.test(t.stdout))
23
+ throw console.error(t.output), t;
24
+ return !1;
25
+ }
26
+ }
27
+ function E(e, c, t) {
28
+ let n = 0;
29
+ if (v(e, c))
30
+ for (const s of t || [])
31
+ try {
32
+ r(`git push ${s} master`, {
33
+ cwd: e,
34
+ env: process.env,
35
+ encoding: "utf-8",
36
+ stdio: ["ignore", "ignore", "pipe"]
37
+ });
38
+ } catch (i) {
39
+ console.error(i.output), n = i.status;
40
+ }
41
+ else
42
+ n = 10;
43
+ return n;
44
+ }
45
+ function P(e) {
46
+ return r("git reset --hard origin/master", {
47
+ cwd: e,
48
+ env: process.env,
49
+ encoding: "utf-8",
50
+ stdio: ["ignore", "ignore", "pipe"]
51
+ }), r("git pull --rebase", {
52
+ cwd: e,
53
+ env: process.env,
54
+ encoding: "utf-8",
55
+ stdio: ["ignore", "ignore", "pipe"]
56
+ }), !0;
57
+ }
58
+ function H(e, c, t) {
59
+ e !== void 0 && r(`git clone ${e}/${c}.git`, {
60
+ cwd: t,
61
+ env: process.env,
62
+ encoding: "utf-8",
63
+ stdio: ["ignore", "ignore", "pipe"]
64
+ });
65
+ }
66
+ function o(e, c, t) {
67
+ try {
68
+ t && console.log(`git -C ${e} ${c}`);
69
+ const n = r(`git ${c}`, {
70
+ cwd: e,
71
+ maxBuffer: a
72
+ }).toString().trim();
73
+ return t && console.log(n), n;
74
+ } catch (n) {
75
+ for (const s of ["stdout", "stderr"])
76
+ console.error(`${s}: ${n[s]}`);
77
+ throw n;
78
+ }
79
+ }
80
+ function d(e, c, t) {
81
+ try {
82
+ t && console.log(`git -C ${e} ${c}`);
83
+ const n = r(`git ${c}`, {
84
+ cwd: e,
85
+ stdio: ["ignore", "pipe", "pipe"],
86
+ maxBuffer: a
87
+ }).toString().trim();
88
+ return t && console.log(n), !0;
89
+ } catch (n) {
90
+ if (n.status != 0) return !1;
91
+ throw n;
92
+ }
93
+ }
94
+ function S(e, c, t) {
95
+ const n = o(e, "rev-parse --abbrev-ref HEAD"), s = "uid", i = process.cwd();
96
+ process.chdir(e);
97
+ for (const f of c) {
98
+ const u = `${f}/uid`;
99
+ l.ensureDirSync(u);
100
+ for (const g of p([`${f}/**/*.json`])) {
101
+ const h = $.basename(g);
102
+ l.renameSync(g, `${u}/${h}`);
103
+ }
104
+ }
105
+ process.chdir(i), d(e, `rev-parse remotes/origin/${s}`) ? (o(e, `branch --force ${s} origin/${s}`), o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset")) : d(e, `rev-parse refs/heads/${s}`) ? (o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset")) : (o(e, `branch --force ${s} master`), o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset"), o(e, "rm -r ."));
106
+ for (const f of c) {
107
+ const u = `${f}/uid`;
108
+ o(e, `add ${u}`);
109
+ }
110
+ let m = !1;
111
+ return d(e, "diff --quiet --cached") || (o(e, "commit -m 'Update'"), m = !0), o(e, `symbolic-ref HEAD refs/heads/${n}`), o(e, `reset ${t ? "" : "--hard"}`), m;
112
+ }
113
+ export {
114
+ H as clone,
115
+ v as commit,
116
+ E as commitAndPush,
117
+ P as resetAndPull,
118
+ o as run,
119
+ d as test,
120
+ S as uidBranchUpdate
121
+ };
package/lib/loaders.d.ts CHANGED
@@ -57,42 +57,52 @@ export interface Data {
57
57
  export declare function iterLoadAssembleeActeurs(dataDir: string, legislature: Legislature, options?: {}): Generator<{
58
58
  acteur: Acteur;
59
59
  datasetLegislature: Legislature;
60
+ filePath: string;
60
61
  }, void, unknown>;
61
62
  export declare function iterLoadAssembleeOrganes(dataDir: string, legislature: Legislature, options?: {}): Generator<{
62
63
  organe: Organe;
63
64
  datasetLegislature: Legislature;
65
+ filePath: string;
64
66
  }, void, unknown>;
65
67
  export declare function iterLoadAssembleeAmendements(dataDir: string, legislature: Legislature, options?: {}): Generator<{
66
68
  amendement: Amendement;
67
69
  datasetLegislature: Legislature;
70
+ filePath: string;
68
71
  }, void, unknown>;
69
72
  export declare function iterLoadAssembleeDocuments(dataDir: string, legislature: Legislature, options?: {}): Generator<{
70
73
  document: Document;
71
74
  datasetLegislature: Legislature;
75
+ filePath: string;
72
76
  }, void, unknown>;
73
77
  export declare function iterLoadAssembleeDossiersParlementaires(dataDir: string, legislature: Legislature, options?: {}): Generator<{
74
78
  dossierParlementaire: DossierParlementaire;
75
79
  datasetLegislature: Legislature;
80
+ filePath: string;
76
81
  }, void, unknown>;
77
82
  export declare function iterLoadAssembleeReunions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
78
83
  reunion: Reunion;
79
84
  datasetLegislature: Legislature;
85
+ filePath: string;
80
86
  }, void, unknown>;
81
87
  export declare function iterLoadAssembleeScrutins(dataDir: string, legislature: Legislature, options?: {}): Generator<{
82
88
  scrutin: Scrutin;
83
89
  datasetLegislature: Legislature;
90
+ filePath: string;
84
91
  }, void, unknown>;
85
92
  export declare function iterLoadAssembleeQuestions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
86
93
  question: Question;
87
94
  datasetLegislature: Legislature;
95
+ filePath: string;
88
96
  }, void, unknown>;
89
97
  export declare function iterLoadAssembleeComptesRendus(dataDir: string, legislature: Legislature, options?: {}): Generator<{
90
98
  compteRendu: CompteRendu;
91
99
  datasetLegislature: Legislature;
100
+ filePath: string;
92
101
  }, void, unknown>;
93
102
  export declare function iterLoadAssembleeComptesRendusCommissions(dataDir: string, legislature: Legislature): Generator<{
94
103
  compteRendu: CompteRendu;
95
104
  datasetLegislature: Legislature;
105
+ filePath: string;
96
106
  }, void, unknown>;
97
107
  export declare function loadAssembleeData(dataDir: string, enabledDatasets: EnabledDatasets, legislature: Legislature, { log }?: {
98
108
  log?: boolean | undefined;
package/lib/loaders.js CHANGED
@@ -3,14 +3,14 @@ import i from "fs-extra";
3
3
  import n from "node:path";
4
4
  import "node:crypto";
5
5
  import { L as a, a1 as R, a2 as Z, a3 as q, a4 as B, a5 as J, a6 as N, Y as H, $ as Y, a0 as G, X as K, Z as ee, _ as te } from "./uids-DaRrTkI-.js";
6
- import "glob";
7
- import { C as k } from "./amendements-40Z7OJLT.js";
6
+ import { w as L } from "./file_systems-CzTtoLWb.js";
7
+ import { C as w } from "./amendements-40Z7OJLT.js";
8
8
  var v = /* @__PURE__ */ ((s) => (s[s.None = 0] = "None", s[s.ActeursEtOrganes = 1] = "ActeursEtOrganes", s[s.Agendas = 2] = "Agendas", s[s.Amendements = 4] = "Amendements", s[s.DossiersLegislatifs = 8] = "DossiersLegislatifs", s[s.Photos = 16] = "Photos", s[s.Scrutins = 32] = "Scrutins", s[s.Questions = 64] = "Questions", s[s.ComptesRendusSeances = 128] = "ComptesRendusSeances", s[s.All = 255] = "All", s))(v || {});
9
9
  function y(s, t) {
10
10
  const e = n.join(t, s.filename);
11
11
  i.existsSync(e) && i.removeSync(e), i.existsSync(n.join(t, "json")) ? i.moveSync(n.join(t, "json"), e) : i.mkdirSync(e);
12
12
  }
13
- const h = {
13
+ const S = {
14
14
  acteursEtOrganes: [
15
15
  {
16
16
  // AMO10 (XVII)
@@ -688,18 +688,7 @@ const h = {
688
688
  url: "https://data.assemblee-nationale.fr/static/openData/repository/16/vp/syceronbrut/syseron.xml.zip"
689
689
  }
690
690
  ]
691
- };
692
- function* L(s, t = []) {
693
- const e = n.join(s, ...t);
694
- if (i.existsSync(e))
695
- for (const o of i.readdirSync(e)) {
696
- if (o[0] === ".")
697
- continue;
698
- const d = n.join(e, o), g = [...t, o];
699
- i.statSync(d).isDirectory() ? yield* L(s, g) : yield g;
700
- }
701
- }
702
- const W = [
691
+ }, W = [
703
692
  1e3,
704
693
  "M",
705
694
  900,
@@ -738,23 +727,27 @@ function se(s) {
738
727
  t += W[e + 1], s -= W[e];
739
728
  return t;
740
729
  }
741
- function* x(s, t, e, o, d, g = "json", { noValidation: _ = !1, log: p = !1 } = {}) {
730
+ function* P(s, t, e, r, d, f = "json", { noValidation: _ = !1, log: g = !1 } = {}) {
742
731
  const j = /* @__PURE__ */ new Set();
743
732
  for (const A of e) {
744
733
  if (A.ignoreForWeb || !ne(t, A))
745
734
  continue;
746
- const F = new RegExp(`\\.${g}$`), I = n.join(
735
+ const F = new RegExp(`\\.${f}$`), I = n.join(
747
736
  s,
748
737
  A.filename.replace(F, "_nettoye")
749
738
  );
750
- for (const X of L(I, d)) {
751
- if (!X[X.length - 1].endsWith(".json"))
739
+ for (const D of L(I, d)) {
740
+ if (!D[D.length - 1].endsWith(".json"))
752
741
  continue;
753
- const O = n.join(I, ...X);
754
- p && console.log(`Loading file: ${O}…`);
755
- let D = i.readFileSync(O, { encoding: "utf8" });
756
- const V = _ ? JSON.parse(D) : o(D);
757
- j.has(V.uid) || (j.add(V.uid), yield { item: V, datasetLegislature: A.legislature }, D = null);
742
+ const x = n.join(I, ...D);
743
+ g && console.log(`Loading file: ${x}…`);
744
+ let X = i.readFileSync(x, { encoding: "utf8" });
745
+ const V = _ ? JSON.parse(X) : r(X);
746
+ j.has(V.uid) || (j.add(V.uid), yield {
747
+ datasetLegislature: A.legislature,
748
+ filePath: x,
749
+ item: V
750
+ }, X = null);
758
751
  }
759
752
  }
760
753
  j.clear();
@@ -765,151 +758,161 @@ function ne(s, t) {
765
758
  }
766
759
  function* me(s, t, e = {}) {
767
760
  for (const {
768
- item: o,
769
- datasetLegislature: d
770
- } of x(
761
+ datasetLegislature: r,
762
+ item: d,
763
+ filePath: f
764
+ } of P(
771
765
  s,
772
766
  t,
773
- h.acteursEtOrganes,
767
+ S.acteursEtOrganes,
774
768
  R.toActeur,
775
769
  ["acteurs"],
776
770
  "json",
777
771
  e
778
772
  ))
779
- yield { acteur: o, datasetLegislature: d };
773
+ yield { acteur: d, datasetLegislature: r, filePath: f };
780
774
  }
781
775
  function* fe(s, t, e = {}) {
782
776
  for (const {
783
- item: o,
784
- datasetLegislature: d
785
- } of x(
777
+ item: r,
778
+ datasetLegislature: d,
779
+ filePath: f
780
+ } of P(
786
781
  s,
787
782
  t,
788
- h.acteursEtOrganes,
783
+ S.acteursEtOrganes,
789
784
  R.toOrgane,
790
785
  ["organes"],
791
786
  "json",
792
787
  e
793
788
  ))
794
- yield { organe: o, datasetLegislature: d };
789
+ yield { organe: r, datasetLegislature: d, filePath: f };
795
790
  }
796
791
  function* pe(s, t, e = {}) {
797
792
  for (const {
798
- item: o,
799
- datasetLegislature: d
800
- } of x(
793
+ datasetLegislature: r,
794
+ item: d,
795
+ filePath: f
796
+ } of P(
801
797
  s,
802
798
  t,
803
- h.amendements,
804
- k.toAmendement,
799
+ S.amendements,
800
+ w.toAmendement,
805
801
  [],
806
802
  "json",
807
803
  e
808
804
  ))
809
- yield { amendement: o, datasetLegislature: d };
805
+ yield { amendement: d, datasetLegislature: r, filePath: f };
810
806
  }
811
807
  function* ge(s, t, e = {}) {
812
808
  for (const {
813
- item: o,
814
- datasetLegislature: d
815
- } of x(
809
+ item: r,
810
+ datasetLegislature: d,
811
+ filePath: f
812
+ } of P(
816
813
  s,
817
814
  t,
818
- h.dossiersLegislatifs,
815
+ S.dossiersLegislatifs,
819
816
  q.toDocument,
820
817
  ["documents"],
821
818
  "json",
822
819
  e
823
820
  ))
824
- yield { document: o, datasetLegislature: d };
821
+ yield { document: r, datasetLegislature: d, filePath: f };
825
822
  }
826
823
  function* _e(s, t, e = {}) {
827
824
  for (const {
828
- item: o,
829
- datasetLegislature: d
830
- } of x(
825
+ item: r,
826
+ datasetLegislature: d,
827
+ filePath: f
828
+ } of P(
831
829
  s,
832
830
  t,
833
- h.dossiersLegislatifs,
831
+ S.dossiersLegislatifs,
834
832
  q.toDossierParlementaire,
835
833
  ["dossiers"],
836
834
  "json",
837
835
  e
838
836
  ))
839
- yield { dossierParlementaire: o, datasetLegislature: d };
837
+ yield { dossierParlementaire: r, datasetLegislature: d, filePath: f };
840
838
  }
841
839
  function* je(s, t, e = {}) {
842
840
  for (const {
843
- item: o,
844
- datasetLegislature: d
845
- } of x(
841
+ item: r,
842
+ datasetLegislature: d,
843
+ filePath: f
844
+ } of P(
846
845
  s,
847
846
  t,
848
- h.agendas,
847
+ S.agendas,
849
848
  Z.toReunion,
850
849
  [],
851
850
  "json",
852
851
  e
853
852
  ))
854
- yield { reunion: o, datasetLegislature: d };
853
+ yield { reunion: r, datasetLegislature: d, filePath: f };
855
854
  }
856
855
  function* ye(s, t, e = {}) {
857
856
  for (const {
858
- item: o,
859
- datasetLegislature: d
860
- } of x(
857
+ item: r,
858
+ datasetLegislature: d,
859
+ filePath: f
860
+ } of P(
861
861
  s,
862
862
  t,
863
- h.scrutins,
863
+ S.scrutins,
864
864
  B.toScrutin,
865
865
  [],
866
866
  "json",
867
867
  e
868
868
  ))
869
- yield { scrutin: o, datasetLegislature: d };
869
+ yield { scrutin: r, datasetLegislature: d, filePath: f };
870
870
  }
871
- function* Se(s, t, e = {}) {
871
+ function* he(s, t, e = {}) {
872
872
  for (const {
873
- item: o,
874
- datasetLegislature: d
875
- } of x(
873
+ item: r,
874
+ datasetLegislature: d,
875
+ filePath: f
876
+ } of P(
876
877
  s,
877
878
  t,
878
- h.questions,
879
+ S.questions,
879
880
  J.toQuestion,
880
881
  [],
881
882
  "json",
882
883
  e
883
884
  ))
884
- yield { question: o, datasetLegislature: d };
885
+ yield { question: r, datasetLegislature: d, filePath: f };
885
886
  }
886
- function* he(s, t, e = {}) {
887
+ function* Se(s, t, e = {}) {
887
888
  for (const {
888
- item: o,
889
- datasetLegislature: d
890
- } of x(
889
+ item: r,
890
+ datasetLegislature: d,
891
+ filePath: f
892
+ } of P(
891
893
  s,
892
894
  t,
893
- h.comptesRendusSeances,
895
+ S.comptesRendusSeances,
894
896
  N.toCompteRendu,
895
897
  [],
896
898
  "xml",
897
899
  e
898
900
  ))
899
- yield { compteRendu: o, datasetLegislature: d };
901
+ yield { compteRendu: r, datasetLegislature: d, filePath: f };
900
902
  }
901
903
  function* Ae(s, t) {
902
- const e = `Comptes_Rendus_Commissions_${se(t)}_nettoye`, o = n.join(s, e);
903
- if (i.existsSync(o))
904
- for (const d of T(o))
904
+ const e = `Comptes_Rendus_Commissions_${se(t)}_nettoye`, r = n.join(s, e);
905
+ if (i.existsSync(r))
906
+ for (const d of T(r))
905
907
  try {
906
- const g = i.readFileSync(d, "utf-8");
908
+ const f = i.readFileSync(d, "utf-8");
907
909
  yield {
908
- compteRendu: JSON.parse(g),
909
- datasetLegislature: t
910
+ compteRendu: JSON.parse(f),
911
+ datasetLegislature: t,
912
+ filePath: d
910
913
  };
911
- } catch (g) {
912
- console.warn(`Erreur lors de la lecture du fichier ${d} :`, g);
914
+ } catch (f) {
915
+ console.warn(`Erreur lors de la lecture du fichier ${d} :`, f);
913
916
  }
914
917
  }
915
918
  function* T(s) {
@@ -919,203 +922,203 @@ function* T(s) {
919
922
  t.isDirectory() ? yield* T(e) : t.isFile() && e.endsWith(".json") && (yield e);
920
923
  }
921
924
  }
922
- function Fe(s, t, e, { log: o = !1 } = {}) {
923
- const d = {}, g = {};
925
+ function Fe(s, t, e, { log: r = !1 } = {}) {
926
+ const d = {}, f = {};
924
927
  if (t & v.ActeursEtOrganes)
925
- for (const r of h.acteursEtOrganes) {
926
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
928
+ for (const o of S.acteursEtOrganes) {
929
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
927
930
  continue;
928
931
  const u = n.join(
929
932
  s,
930
- r.filename.replace(/\.json$/, "_nettoye")
933
+ o.filename.replace(/\.json$/, "_nettoye")
931
934
  );
932
935
  for (const c of L(u, ["acteurs"])) {
933
936
  if (!c[c.length - 1].endsWith(".json"))
934
937
  continue;
935
938
  const l = n.join(u, ...c);
936
- o && console.log(`Loading file: ${l}…`);
937
- const f = i.readFileSync(l, {
939
+ r && console.log(`Loading file: ${l}…`);
940
+ const p = i.readFileSync(l, {
938
941
  encoding: "utf8"
939
- }), m = R.toActeur(f);
942
+ }), m = R.toActeur(p);
940
943
  d[m.uid] === void 0 && (d[m.uid] = m);
941
944
  }
942
945
  for (const c of L(u, ["organes"])) {
943
946
  if (!c[c.length - 1].endsWith(".json"))
944
947
  continue;
945
948
  const l = n.join(u, ...c);
946
- o && console.log(`Loading file: ${l}…`);
947
- const f = i.readFileSync(l, {
949
+ r && console.log(`Loading file: ${l}…`);
950
+ const p = i.readFileSync(l, {
948
951
  encoding: "utf8"
949
- }), m = R.toOrgane(f);
950
- g[m.uid] === void 0 && (g[m.uid] = m);
952
+ }), m = R.toOrgane(p);
953
+ f[m.uid] === void 0 && (f[m.uid] = m);
951
954
  }
952
955
  }
953
- const _ = {}, p = {}, j = {};
956
+ const _ = {}, g = {}, j = {};
954
957
  if (t & v.Agendas)
955
- for (const r of h.agendas) {
956
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
958
+ for (const o of S.agendas) {
959
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
957
960
  continue;
958
961
  const u = n.join(
959
962
  s,
960
- r.filename.replace(/\.json$/, "_nettoye")
963
+ o.filename.replace(/\.json$/, "_nettoye")
961
964
  );
962
965
  for (const c of L(u)) {
963
966
  if (!c[c.length - 1].endsWith(".json"))
964
967
  continue;
965
968
  const l = n.join(u, ...c);
966
- o && console.log(`Loading file: ${l}…`);
967
- const f = i.readFileSync(l, {
969
+ r && console.log(`Loading file: ${l}…`);
970
+ const p = i.readFileSync(l, {
968
971
  encoding: "utf8"
969
- }), m = Z.toReunion(f);
972
+ }), m = Z.toReunion(p);
970
973
  _[m.uid] === void 0 && (_[m.uid] = m);
971
974
  const b = m.timestampDebut.toISOString().split("T")[0];
972
- let P = p[b];
973
- P === void 0 && (P = p[b] = []), P.push(m);
975
+ let $ = g[b];
976
+ $ === void 0 && ($ = g[b] = []), $.push(m);
974
977
  const U = m.odj;
975
978
  if (U !== void 0)
976
979
  for (const C of U.pointsOdj || [])
977
- for (const w of C.dossiersLegislatifsRefs || []) {
978
- let M = j[w];
979
- M === void 0 && (M = j[w] = []), M.push(m);
980
+ for (const k of C.dossiersLegislatifsRefs || []) {
981
+ let M = j[k];
982
+ M === void 0 && (M = j[k] = []), M.push(m);
980
983
  }
981
984
  }
982
985
  }
983
986
  const A = {};
984
987
  if (t & v.Amendements)
985
- for (const r of h.amendements) {
986
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
988
+ for (const o of S.amendements) {
989
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
987
990
  continue;
988
991
  const u = n.join(
989
992
  s,
990
- r.filename.replace(/\.json$/, "_nettoye")
993
+ o.filename.replace(/\.json$/, "_nettoye")
991
994
  );
992
995
  for (const c of L(u)) {
993
996
  if (!c[c.length - 1].endsWith(".json"))
994
997
  continue;
995
998
  const l = n.join(u, ...c);
996
- o && console.log(`Loading file: ${l}…`);
997
- const f = i.readFileSync(l, {
999
+ r && console.log(`Loading file: ${l}…`);
1000
+ const p = i.readFileSync(l, {
998
1001
  encoding: "utf8"
999
- }), m = k.toAmendement(f);
1002
+ }), m = w.toAmendement(p);
1000
1003
  A[m.uid] === void 0 && (A[m.uid] = m);
1001
1004
  }
1002
1005
  }
1003
- const F = {}, I = {}, X = {}, z = {};
1006
+ const F = {}, I = {}, D = {}, z = {};
1004
1007
  if (t & v.DossiersLegislatifs)
1005
- for (const r of h.dossiersLegislatifs) {
1006
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1008
+ for (const o of S.dossiersLegislatifs) {
1009
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1007
1010
  continue;
1008
1011
  const u = n.join(
1009
1012
  s,
1010
- r.filename.replace(/\.json$/, "_nettoye")
1013
+ o.filename.replace(/\.json$/, "_nettoye")
1011
1014
  );
1012
1015
  for (const c of L(u, ["documents"])) {
1013
1016
  if (!c[c.length - 1].endsWith(".json"))
1014
1017
  continue;
1015
1018
  const l = n.join(u, ...c);
1016
- o && console.log(`Loading file: ${l}…`);
1017
- const f = i.readFileSync(l, {
1019
+ r && console.log(`Loading file: ${l}…`);
1020
+ const p = i.readFileSync(l, {
1018
1021
  encoding: "utf8"
1019
- }), m = q.toDocument(f);
1022
+ }), m = q.toDocument(p);
1020
1023
  F[m.uid] === void 0 && (F[m.uid] = m);
1021
1024
  }
1022
1025
  for (const c of L(u, ["dossiers"])) {
1023
1026
  if (!c[c.length - 1].endsWith(".json"))
1024
1027
  continue;
1025
1028
  const l = n.join(u, ...c);
1026
- o && console.log(`Loading file: ${l}…`);
1027
- const f = i.readFileSync(l, {
1029
+ r && console.log(`Loading file: ${l}…`);
1030
+ const p = i.readFileSync(l, {
1028
1031
  encoding: "utf8"
1029
- }), m = q.toDossierParlementaire(f), b = m.titreDossier;
1030
- b.senatChemin && I[b.senatChemin] === void 0 && (I[b.senatChemin] = m), b.titreChemin && X[b.titreChemin] === void 0 && (X[b.titreChemin] = m), z[m.uid] === void 0 && (z[m.uid] = m);
1032
+ }), m = q.toDossierParlementaire(p), b = m.titreDossier;
1033
+ b.senatChemin && I[b.senatChemin] === void 0 && (I[b.senatChemin] = m), b.titreChemin && D[b.titreChemin] === void 0 && (D[b.titreChemin] = m), z[m.uid] === void 0 && (z[m.uid] = m);
1031
1034
  }
1032
1035
  }
1033
- let O = {};
1036
+ let x = {};
1034
1037
  if (t & v.Photos) {
1035
1038
  {
1036
- const r = n.join(
1039
+ const o = n.join(
1037
1040
  s,
1038
1041
  `photos_deputes_${// TODO: Handle Legislature.All.
1039
1042
  e === a.All ? a.DixSept : e}`,
1040
1043
  "deputes.json"
1041
1044
  );
1042
- if (i.existsSync(r)) {
1043
- o && console.log(`Loading file: ${r}`);
1044
- const u = i.readFileSync(r, { encoding: "utf8" });
1045
- Object.assign(O, JSON.parse(u));
1046
- } else o && console.log(`Ignoring missing file: ${r}`);
1045
+ if (i.existsSync(o)) {
1046
+ r && console.log(`Loading file: ${o}`);
1047
+ const u = i.readFileSync(o, { encoding: "utf8" });
1048
+ Object.assign(x, JSON.parse(u));
1049
+ } else r && console.log(`Ignoring missing file: ${o}`);
1047
1050
  }
1048
1051
  {
1049
- const r = n.join(
1052
+ const o = n.join(
1050
1053
  s,
1051
1054
  "photos_senateurs",
1052
1055
  "senateurs.json"
1053
1056
  );
1054
- if (i.existsSync(r)) {
1055
- o && console.log(`Loading file: ${r}`);
1056
- const u = i.readFileSync(r, { encoding: "utf8" });
1057
- Object.assign(O, JSON.parse(u));
1058
- } else o && console.log(`Ignoring missing file: ${r}`);
1057
+ if (i.existsSync(o)) {
1058
+ r && console.log(`Loading file: ${o}`);
1059
+ const u = i.readFileSync(o, { encoding: "utf8" });
1060
+ Object.assign(x, JSON.parse(u));
1061
+ } else r && console.log(`Ignoring missing file: ${o}`);
1059
1062
  }
1060
1063
  }
1061
- const D = {};
1064
+ const X = {};
1062
1065
  if (t & v.Scrutins)
1063
- for (const r of h.scrutins) {
1064
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1066
+ for (const o of S.scrutins) {
1067
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1065
1068
  continue;
1066
1069
  const u = n.join(
1067
1070
  s,
1068
- r.filename.replace(/\.json$/, "_nettoye")
1071
+ o.filename.replace(/\.json$/, "_nettoye")
1069
1072
  );
1070
1073
  for (const c of L(u)) {
1071
1074
  if (!c[c.length - 1].endsWith(".json"))
1072
1075
  continue;
1073
1076
  const l = n.join(u, ...c);
1074
- o && console.log(`Loading file: ${l}…`);
1075
- const f = i.readFileSync(l, {
1077
+ r && console.log(`Loading file: ${l}…`);
1078
+ const p = i.readFileSync(l, {
1076
1079
  encoding: "utf8"
1077
- }), m = B.toScrutin(f);
1078
- D[m.uid] === void 0 && (D[m.uid] = m);
1080
+ }), m = B.toScrutin(p);
1081
+ X[m.uid] === void 0 && (X[m.uid] = m);
1079
1082
  }
1080
1083
  }
1081
1084
  const V = {};
1082
1085
  if (t & v.Questions)
1083
- for (const r of h.questions) {
1084
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1086
+ for (const o of S.questions) {
1087
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1085
1088
  continue;
1086
1089
  const u = n.join(
1087
1090
  s,
1088
- r.filename.replace(/\.json$/, "_nettoye")
1091
+ o.filename.replace(/\.json$/, "_nettoye")
1089
1092
  );
1090
1093
  for (const c of L(u)) {
1091
1094
  if (!c[c.length - 1].endsWith(".json"))
1092
1095
  continue;
1093
1096
  const l = n.join(u, ...c);
1094
- o && console.log(`Loading file: ${l}…`);
1095
- const f = i.readFileSync(l, {
1097
+ r && console.log(`Loading file: ${l}…`);
1098
+ const p = i.readFileSync(l, {
1096
1099
  encoding: "utf8"
1097
- }), m = J.toQuestion(f);
1100
+ }), m = J.toQuestion(p);
1098
1101
  V[m.uid] === void 0 && (V[m.uid] = m);
1099
1102
  }
1100
1103
  }
1101
- const $ = {};
1104
+ const O = {};
1102
1105
  if (t & v.ComptesRendusSeances)
1103
- for (const r of h.comptesRendusSeances) {
1104
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1106
+ for (const o of S.comptesRendusSeances) {
1107
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1105
1108
  continue;
1106
1109
  const u = n.join(
1107
1110
  s,
1108
- r.filename.replace(/\.json$/, "_nettoye")
1111
+ o.filename.replace(/\.json$/, "_nettoye")
1109
1112
  );
1110
1113
  for (const c of L(u)) {
1111
1114
  if (!c[c.length - 1].endsWith(".json"))
1112
1115
  continue;
1113
1116
  const l = n.join(u, ...c);
1114
- o && console.log(`Loading file: ${l}…`);
1115
- const f = i.readFileSync(l, {
1117
+ r && console.log(`Loading file: ${l}…`);
1118
+ const p = i.readFileSync(l, {
1116
1119
  encoding: "utf8"
1117
- }), m = N.toCompteRendu(f);
1118
- $[m.uid] === void 0 && ($[m.uid] = m);
1120
+ }), m = N.toCompteRendu(p);
1121
+ O[m.uid] === void 0 && (O[m.uid] = m);
1119
1122
  }
1120
1123
  }
1121
1124
  return {
@@ -1123,55 +1126,55 @@ function Fe(s, t, e, { log: o = !1 } = {}) {
1123
1126
  amendementByUid: A,
1124
1127
  documentByUid: F,
1125
1128
  dossierParlementaireBySenatChemin: I,
1126
- dossierParlementaireByTitreChemin: X,
1129
+ dossierParlementaireByTitreChemin: D,
1127
1130
  dossierParlementaireByUid: z,
1128
- organeByUid: g,
1129
- photoByUid: O,
1131
+ organeByUid: f,
1132
+ photoByUid: x,
1130
1133
  reunionByUid: _,
1131
- reunionsByDay: p,
1134
+ reunionsByDay: g,
1132
1135
  reunionsByDossierUid: j,
1133
- scrutinByUid: D,
1136
+ scrutinByUid: X,
1134
1137
  questionByUid: V,
1135
- compteRenduByUid: $
1138
+ compteRenduByUid: O
1136
1139
  };
1137
1140
  }
1138
- function ve(s, t, e, { log: o = !1 } = {}) {
1139
- const d = {}, g = {};
1141
+ function ve(s, t, e, { log: r = !1 } = {}) {
1142
+ const d = {}, f = {};
1140
1143
  if (t & v.ActeursEtOrganes)
1141
- for (const r of h.acteursEtOrganes) {
1142
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1144
+ for (const o of S.acteursEtOrganes) {
1145
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1143
1146
  continue;
1144
1147
  const u = n.join(
1145
1148
  s,
1146
- r.filename.replace(/\.json$/, "_nettoye.json")
1149
+ o.filename.replace(/\.json$/, "_nettoye.json")
1147
1150
  );
1148
- o && console.log(`Loading file: ${u}`);
1149
- const c = i.readFileSync(u, { encoding: "utf8" }), S = R.toActeursEtOrganes(c);
1150
- for (const l of S.acteurs)
1151
+ r && console.log(`Loading file: ${u}`);
1152
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = R.toActeursEtOrganes(c);
1153
+ for (const l of h.acteurs)
1151
1154
  d[l.uid] === void 0 && (d[l.uid] = l);
1152
- for (const l of S.organes)
1153
- g[l.uid] === void 0 && (g[l.uid] = l);
1155
+ for (const l of h.organes)
1156
+ f[l.uid] === void 0 && (f[l.uid] = l);
1154
1157
  }
1155
- const _ = {}, p = {}, j = {};
1158
+ const _ = {}, g = {}, j = {};
1156
1159
  if (t & v.Agendas)
1157
- for (const r of h.agendas) {
1158
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1160
+ for (const o of S.agendas) {
1161
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1159
1162
  continue;
1160
1163
  const u = n.join(
1161
1164
  s,
1162
- r.filename.replace(/\.json$/, "_nettoye.json")
1165
+ o.filename.replace(/\.json$/, "_nettoye.json")
1163
1166
  );
1164
- o && console.log(`Loading file: ${u}`);
1165
- const c = i.readFileSync(u, { encoding: "utf8" }), S = Z.toAgendas(c);
1166
- for (const l of S.reunions) {
1167
+ r && console.log(`Loading file: ${u}`);
1168
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = Z.toAgendas(c);
1169
+ for (const l of h.reunions) {
1167
1170
  _[l.uid] === void 0 && (_[l.uid] = l);
1168
- const f = l.timestampDebut.toISOString().split("T")[0];
1169
- let m = p[f];
1170
- m === void 0 && (m = p[f] = []), m.push(l);
1171
+ const p = l.timestampDebut.toISOString().split("T")[0];
1172
+ let m = g[p];
1173
+ m === void 0 && (m = g[p] = []), m.push(l);
1171
1174
  const b = l.odj;
1172
1175
  if (b !== void 0)
1173
- for (const P of b.pointsOdj || [])
1174
- for (const U of P.dossiersLegislatifsRefs || []) {
1176
+ for (const $ of b.pointsOdj || [])
1177
+ for (const U of $.dossiersLegislatifsRefs || []) {
1175
1178
  let C = j[U];
1176
1179
  C === void 0 && (C = j[U] = []), C.push(l);
1177
1180
  }
@@ -1179,40 +1182,40 @@ function ve(s, t, e, { log: o = !1 } = {}) {
1179
1182
  }
1180
1183
  const A = {};
1181
1184
  if (t & v.Amendements)
1182
- for (const r of h.amendements) {
1183
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1185
+ for (const o of S.amendements) {
1186
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1184
1187
  continue;
1185
1188
  const u = n.join(
1186
1189
  s,
1187
- r.filename.replace(/\.json$/, "_nettoye.json")
1190
+ o.filename.replace(/\.json$/, "_nettoye.json")
1188
1191
  );
1189
- o && console.log(`Loading file: ${u}`);
1190
- const c = i.readFileSync(u, { encoding: "utf8" }), S = k.toAmendements(c);
1191
- for (const l of S.textesLegislatifs)
1192
- for (const f of l.amendements)
1193
- A[f.uid] === void 0 && (A[f.uid] = f);
1192
+ r && console.log(`Loading file: ${u}`);
1193
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = w.toAmendements(c);
1194
+ for (const l of h.textesLegislatifs)
1195
+ for (const p of l.amendements)
1196
+ A[p.uid] === void 0 && (A[p.uid] = p);
1194
1197
  }
1195
- const F = {}, I = {}, X = {}, z = {};
1198
+ const F = {}, I = {}, D = {}, z = {};
1196
1199
  if (t & v.DossiersLegislatifs)
1197
- for (const r of h.dossiersLegislatifs) {
1198
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1200
+ for (const o of S.dossiersLegislatifs) {
1201
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1199
1202
  continue;
1200
1203
  const u = n.join(
1201
1204
  s,
1202
- r.filename.replace(/\.json$/, "_nettoye.json")
1205
+ o.filename.replace(/\.json$/, "_nettoye.json")
1203
1206
  );
1204
- o && console.log(`Loading file: ${u}`);
1205
- const c = i.readFileSync(u, { encoding: "utf8" }), S = q.toDossiersLegislatifs(c);
1206
- for (const l of S.textesLegislatifs)
1207
+ r && console.log(`Loading file: ${u}`);
1208
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = q.toDossiersLegislatifs(c);
1209
+ for (const l of h.textesLegislatifs)
1207
1210
  F[l.uid] === void 0 && (F[l.uid] = l);
1208
- for (const l of S.dossiersParlementaires) {
1209
- const f = l.titreDossier;
1210
- f.senatChemin && I[f.senatChemin] === void 0 && (I[f.senatChemin] = l), f.titreChemin && X[f.titreChemin] === void 0 && (X[f.titreChemin] = l), z[l.uid] === void 0 && (z[l.uid] = l);
1211
+ for (const l of h.dossiersParlementaires) {
1212
+ const p = l.titreDossier;
1213
+ p.senatChemin && I[p.senatChemin] === void 0 && (I[p.senatChemin] = l), p.titreChemin && D[p.titreChemin] === void 0 && (D[p.titreChemin] = l), z[l.uid] === void 0 && (z[l.uid] = l);
1211
1214
  }
1212
1215
  }
1213
- const O = {};
1216
+ const x = {};
1214
1217
  if (t & v.Photos) {
1215
- const r = {};
1218
+ const o = {};
1216
1219
  {
1217
1220
  const u = n.join(
1218
1221
  s,
@@ -1221,10 +1224,10 @@ function ve(s, t, e, { log: o = !1 } = {}) {
1221
1224
  "deputes.json"
1222
1225
  );
1223
1226
  if (i.existsSync(u)) {
1224
- o && console.log(`Loading file: ${u}`);
1227
+ r && console.log(`Loading file: ${u}`);
1225
1228
  const c = i.readFileSync(u, { encoding: "utf8" });
1226
- Object.assign(r, JSON.parse(c));
1227
- } else o && console.log(`Ignoring missing file: ${u}`);
1229
+ Object.assign(o, JSON.parse(c));
1230
+ } else r && console.log(`Ignoring missing file: ${u}`);
1228
1231
  }
1229
1232
  {
1230
1233
  const u = n.join(
@@ -1233,101 +1236,101 @@ function ve(s, t, e, { log: o = !1 } = {}) {
1233
1236
  "senateurs.json"
1234
1237
  );
1235
1238
  if (i.existsSync(u)) {
1236
- o && console.log(`Loading file: ${u}`);
1239
+ r && console.log(`Loading file: ${u}`);
1237
1240
  const c = i.readFileSync(u, { encoding: "utf8" });
1238
- Object.assign(r, JSON.parse(c));
1239
- } else o && console.log(`Ignoring missing file: ${u}`);
1241
+ Object.assign(o, JSON.parse(c));
1242
+ } else r && console.log(`Ignoring missing file: ${u}`);
1240
1243
  }
1241
1244
  }
1242
- const D = {};
1245
+ const X = {};
1243
1246
  if (t & v.Scrutins)
1244
- for (const r of h.scrutins) {
1245
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1247
+ for (const o of S.scrutins) {
1248
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1246
1249
  continue;
1247
1250
  const u = n.join(
1248
1251
  s,
1249
- r.filename.replace(/\.json$/, "_nettoye.json")
1252
+ o.filename.replace(/\.json$/, "_nettoye.json")
1250
1253
  );
1251
- o && console.log(`Loading file: ${u}`);
1252
- const c = i.readFileSync(u, { encoding: "utf8" }), S = B.toScrutins(c);
1253
- for (const l of S.scrutins)
1254
- D[l.uid] === void 0 && (D[l.uid] = l);
1254
+ r && console.log(`Loading file: ${u}`);
1255
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = B.toScrutins(c);
1256
+ for (const l of h.scrutins)
1257
+ X[l.uid] === void 0 && (X[l.uid] = l);
1255
1258
  }
1256
1259
  const V = {};
1257
1260
  if (t & v.Questions)
1258
- for (const r of h.questions) {
1259
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1261
+ for (const o of S.questions) {
1262
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1260
1263
  continue;
1261
1264
  const u = n.join(
1262
1265
  s,
1263
- r.filename.replace(/\.json$/, "_nettoye.json")
1266
+ o.filename.replace(/\.json$/, "_nettoye.json")
1264
1267
  );
1265
- o && console.log(`Loading file: ${u}`);
1266
- const c = i.readFileSync(u, { encoding: "utf8" }), S = J.toQuestions(c);
1267
- for (const l of S.questions)
1268
+ r && console.log(`Loading file: ${u}`);
1269
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = J.toQuestions(c);
1270
+ for (const l of h.questions)
1268
1271
  V[l.uid] === void 0 && (V[l.uid] = l);
1269
1272
  }
1270
- const $ = {};
1273
+ const O = {};
1271
1274
  if (t & v.ComptesRendusSeances)
1272
- for (const r of h.comptesRendusSeances) {
1273
- if (r.ignoreForWeb || e !== a.All && r.legislature !== a.All && e !== r.legislature)
1275
+ for (const o of S.comptesRendusSeances) {
1276
+ if (o.ignoreForWeb || e !== a.All && o.legislature !== a.All && e !== o.legislature)
1274
1277
  continue;
1275
1278
  const u = n.join(
1276
1279
  s,
1277
- r.filename.replace(/\.json$/, "_nettoye.json")
1280
+ o.filename.replace(/\.json$/, "_nettoye.json")
1278
1281
  );
1279
- o && console.log(`Loading file: ${u}`);
1280
- const c = i.readFileSync(u, { encoding: "utf8" }), S = N.toComptesRendus(c);
1281
- for (const l of S.comptesRendus)
1282
- $[l.uid] === void 0 && ($[l.uid] = l);
1282
+ r && console.log(`Loading file: ${u}`);
1283
+ const c = i.readFileSync(u, { encoding: "utf8" }), h = N.toComptesRendus(c);
1284
+ for (const l of h.comptesRendus)
1285
+ O[l.uid] === void 0 && (O[l.uid] = l);
1283
1286
  }
1284
1287
  return {
1285
1288
  acteurByUid: d,
1286
1289
  amendementByUid: A,
1287
1290
  documentByUid: F,
1288
1291
  dossierParlementaireBySenatChemin: I,
1289
- dossierParlementaireByTitreChemin: X,
1292
+ dossierParlementaireByTitreChemin: D,
1290
1293
  dossierParlementaireByUid: z,
1291
- organeByUid: g,
1292
- photoByUid: O,
1294
+ organeByUid: f,
1295
+ photoByUid: x,
1293
1296
  reunionByUid: _,
1294
- reunionsByDay: p,
1297
+ reunionsByDay: g,
1295
1298
  reunionsByDossierUid: j,
1296
- scrutinByUid: D,
1299
+ scrutinByUid: X,
1297
1300
  questionByUid: V,
1298
- compteRenduByUid: $
1301
+ compteRenduByUid: O
1299
1302
  };
1300
1303
  }
1301
1304
  function Ie(s, t, e) {
1302
- const o = n.join(s, "Documents"), d = ie(o, t), g = n.join(d, "index.json");
1303
- if (!i.pathExistsSync(g))
1305
+ const r = n.join(s, "Documents"), d = ie(r, t), f = n.join(d, "index.json");
1306
+ if (!i.pathExistsSync(f))
1304
1307
  return;
1305
- const _ = i.readJsonSync(g);
1306
- for (const p of e)
1307
- for (const { filename: j, url: A } of _[p] ?? [])
1308
+ const _ = i.readJsonSync(f);
1309
+ for (const g of e)
1310
+ for (const { filename: j, url: A } of _[g] ?? [])
1308
1311
  if (j !== void 0)
1309
- return { format: p, path: n.join(d, j), url: A };
1312
+ return { format: g, path: n.join(d, j), url: A };
1310
1313
  }
1311
1314
  function be(s, t, { log: e = !1 } = {}) {
1312
- const o = n.join(
1315
+ const r = n.join(
1313
1316
  s,
1314
1317
  `photos_deputes_${// TODO: Handle Legislature.All.
1315
1318
  t === a.All ? a.DixSept : t}`,
1316
1319
  "deputes.json"
1317
1320
  );
1318
- e && console.log(`Loading file: ${o}`);
1319
- const d = i.readFileSync(o, { encoding: "utf8" });
1321
+ e && console.log(`Loading file: ${r}`);
1322
+ const d = i.readFileSync(r, { encoding: "utf8" });
1320
1323
  return JSON.parse(d);
1321
1324
  }
1322
- function Xe(s, { log: t = !1 } = {}) {
1325
+ function De(s, { log: t = !1 } = {}) {
1323
1326
  const e = n.join(
1324
1327
  s,
1325
1328
  "photos_senateurs",
1326
1329
  "senateurs.json"
1327
1330
  );
1328
1331
  t && console.log(`Loading file: ${e}`);
1329
- const o = i.readFileSync(e, { encoding: "utf8" });
1330
- return JSON.parse(o);
1332
+ const r = i.readFileSync(e, { encoding: "utf8" });
1333
+ return JSON.parse(r);
1331
1334
  }
1332
1335
  function ie(s, t) {
1333
1336
  const e = t.match(H);
@@ -1336,25 +1339,25 @@ function ie(s, t) {
1336
1339
  null,
1337
1340
  `Unexpected structure for document UID: ${t}`
1338
1341
  );
1339
- const o = e.groups, d = n.join(
1342
+ const r = e.groups, d = n.join(
1340
1343
  s,
1341
- o.documentType ?? o.documentType2
1342
- ), g = n.join(d, o.chambre ?? o.chambre2), _ = n.join(
1343
- g,
1344
- o.republique ?? o.republique2
1345
- ), p = n.join(
1344
+ r.documentType ?? r.documentType2
1345
+ ), f = n.join(d, r.chambre ?? r.chambre2), _ = n.join(
1346
+ f,
1347
+ r.republique ?? r.republique2
1348
+ ), g = n.join(
1346
1349
  _,
1347
- o.legislature ?? o.legislature2
1348
- ), j = o.etat;
1350
+ r.legislature ?? r.legislature2
1351
+ ), j = r.etat;
1349
1352
  if (j === void 0)
1350
- return i.ensureDirSync(p), n.join(p, t);
1351
- const A = n.join(p, j);
1352
- let F = "000000" + (o.numero ?? o.numero2);
1353
+ return i.ensureDirSync(g), n.join(g, t);
1354
+ const A = n.join(g, j);
1355
+ let F = "000000" + (r.numero ?? r.numero2);
1353
1356
  F = F.substring(F.length - 6);
1354
1357
  const I = n.join(A, F.substring(0, 3));
1355
1358
  return i.ensureDirSync(I), n.join(I, t);
1356
1359
  }
1357
- function De(s, t) {
1360
+ function Xe(s, t) {
1358
1361
  return E(s, t, ee);
1359
1362
  }
1360
1363
  function Ve(s, t) {
@@ -1364,10 +1367,10 @@ function Ve(s, t) {
1364
1367
  null,
1365
1368
  `Unexpected structure for reunion UID: ${t}`
1366
1369
  );
1367
- const o = n.join(s, e[1]), d = n.join(o, e[2]), g = n.join(d, e[3]), _ = n.join(g, e[4]), p = n.join(_, e[5]);
1370
+ const r = n.join(s, e[1]), d = n.join(r, e[2]), f = n.join(d, e[3]), _ = n.join(f, e[4]), g = n.join(_, e[5]);
1368
1371
  let j = "000000000" + e[6];
1369
1372
  j = j.substring(j.length - 9);
1370
- const A = n.join(p, j.substring(0, 3)), F = n.join(A, j.substring(3, 3));
1373
+ const A = n.join(g, j.substring(0, 3)), F = n.join(A, j.substring(3, 3));
1371
1374
  return i.ensureDirSync(F), n.join(F, t);
1372
1375
  }
1373
1376
  function Le(s, t) {
@@ -1377,61 +1380,61 @@ function Le(s, t) {
1377
1380
  null,
1378
1381
  `Unexpected structure for scrutin UID: ${t}`
1379
1382
  );
1380
- const o = n.join(s, e[1]), d = n.join(o, e[2]), g = n.join(d, e[3]);
1383
+ const r = n.join(s, e[1]), d = n.join(r, e[2]), f = n.join(d, e[3]);
1381
1384
  let _ = "000000" + e[4];
1382
1385
  _ = _.substring(_.length - 6);
1383
- const p = n.join(g, _.substring(0, 3));
1384
- return i.ensureDirSync(p), n.join(p, t);
1386
+ const g = n.join(f, _.substring(0, 3));
1387
+ return i.ensureDirSync(g), n.join(g, t);
1385
1388
  }
1386
1389
  function xe(s, t) {
1387
1390
  return E(s, t, te);
1388
1391
  }
1389
- function ze(s, t) {
1392
+ function Pe(s, t) {
1390
1393
  const e = K.exec(t);
1391
1394
  Q.notStrictEqual(
1392
1395
  e,
1393
1396
  null,
1394
1397
  `Unexpected structure for object with UID: ${t}`
1395
1398
  );
1396
- const o = n.join(s, e[2]), d = n.join(o, e[3]), g = n.join(d, e[4]), _ = n.join(g, e[5]);
1397
- let p = "000000000" + e[7];
1398
- p = p.substring(p.length - 9);
1399
- const j = n.join(_, p.substring(0, 3)), A = n.join(j, p.substring(3, 3));
1399
+ const r = n.join(s, e[2]), d = n.join(r, e[3]), f = n.join(d, e[4]), _ = n.join(f, e[5]);
1400
+ let g = "000000000" + e[7];
1401
+ g = g.substring(g.length - 9);
1402
+ const j = n.join(_, g.substring(0, 3)), A = n.join(j, g.substring(3, 3));
1400
1403
  return i.ensureDirSync(A), n.join(A, t);
1401
1404
  }
1402
1405
  function E(s, t, e) {
1403
- const o = e.exec(t);
1406
+ const r = e.exec(t);
1404
1407
  Q.notStrictEqual(
1405
- o,
1408
+ r,
1406
1409
  null,
1407
1410
  `Unexpected structure for object with UID: ${t}`
1408
1411
  );
1409
- const d = n.join(s, o[1]), g = n.join(d, o[2]);
1410
- let _ = "000000" + o[3];
1412
+ const d = n.join(s, r[1]), f = n.join(d, r[2]);
1413
+ let _ = "000000" + r[3];
1411
1414
  _ = _.substring(_.length - 6);
1412
- const p = n.join(g, _.substring(0, 3));
1413
- return i.ensureDirSync(p), n.join(p, t);
1415
+ const g = n.join(f, _.substring(0, 3));
1416
+ return i.ensureDirSync(g), n.join(g, t);
1414
1417
  }
1415
1418
  export {
1416
1419
  v as EnabledDatasets,
1417
1420
  me as iterLoadAssembleeActeurs,
1418
1421
  pe as iterLoadAssembleeAmendements,
1419
- he as iterLoadAssembleeComptesRendus,
1422
+ Se as iterLoadAssembleeComptesRendus,
1420
1423
  Ae as iterLoadAssembleeComptesRendusCommissions,
1421
1424
  ge as iterLoadAssembleeDocuments,
1422
1425
  _e as iterLoadAssembleeDossiersParlementaires,
1423
1426
  fe as iterLoadAssembleeOrganes,
1424
- Se as iterLoadAssembleeQuestions,
1427
+ he as iterLoadAssembleeQuestions,
1425
1428
  je as iterLoadAssembleeReunions,
1426
1429
  ye as iterLoadAssembleeScrutins,
1427
1430
  Fe as loadAssembleeData,
1428
1431
  ve as loadAssembleeDataFromBigFiles,
1429
1432
  Ie as loadAssembleeDocumentFile,
1430
1433
  be as loadAssembleePhotosDeputes,
1431
- Xe as loadAssembleePhotosSenateurs,
1432
- ze as pathFromCompteRenduUid,
1434
+ De as loadAssembleePhotosSenateurs,
1435
+ Pe as pathFromCompteRenduUid,
1433
1436
  ie as pathFromDocumentUid,
1434
- De as pathFromDossierParlementaireUid,
1437
+ Xe as pathFromDossierParlementaireUid,
1435
1438
  xe as pathFromQuestionUid,
1436
1439
  Ve as pathFromReunionUid,
1437
1440
  Le as pathFromScrutinUid,
@@ -7,6 +7,7 @@ type CommonOptions = {
7
7
  parseDocuments?: boolean;
8
8
  fullCompteRenduCommissions?: boolean;
9
9
  };
10
- export declare function downloadAndParse(document: Document, documentsDir: string, options: any): Promise<void>;
10
+ export declare function downloadAndParse(document: Document, datasetDir: string, options: any): Promise<void>;
11
11
  export declare function downloadAndParseVideosAndCR(reunion: Reunion, datasetCleanDir: string, options: CommonOptions): Promise<void>;
12
+ export declare function parseDocument(document: Document, documentPath: string, options: any): Promise<void>;
12
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/assemblee",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Retrieve, clean up & handle French Assemblée nationale's open data",
5
5
  "keywords": [
6
6
  "Assemblée nationale",
@@ -40,6 +40,11 @@
40
40
  "import": "./lib/cleaners.js",
41
41
  "types": "./lib/cleaners/index.d.ts"
42
42
  },
43
+ "./git": {
44
+ "typedoc": "./src/git.ts",
45
+ "import": "./lib/git.js",
46
+ "types": "./lib/git.d.ts"
47
+ },
43
48
  "./loaders": {
44
49
  "typedoc": "./src/loaders.ts",
45
50
  "import": "./lib/loaders.js",