@tricoteuses/assemblee 2.5.25 → 2.5.26

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/git.js CHANGED
@@ -117,9 +117,7 @@ function B(t, o, e = {}) {
117
117
  }
118
118
  return f;
119
119
  } catch {
120
- return console.error(
121
- `Error getting changed files since commit ${o}`
122
- ), /* @__PURE__ */ new Map();
120
+ return console.error(`Error getting changed files since commit ${o}`), /* @__PURE__ */ new Map();
123
121
  }
124
122
  }
125
123
  export {
package/lib/loaders.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnabledDatasets } from './datasets';
1
+ import { EnabledDatasets, Dataset } from './datasets';
2
2
  import { Acteur, Organe, Photo } from './types/acteurs_et_organes';
3
3
  import { Reunion } from './types/agendas';
4
4
  import { Amendement } from './types/amendements';
@@ -54,55 +54,55 @@ export interface Data {
54
54
  [uid: string]: CompteRendu;
55
55
  };
56
56
  }
57
- export declare function iterLoadAssembleeActeurs(dataDir: string, legislature: Legislature, options?: {}): Generator<{
57
+ export declare function iterLoadAssembleeActeurs(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
58
58
  acteur: Acteur;
59
59
  datasetLegislature: Legislature;
60
60
  filePath: string;
61
61
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
62
62
  }, void, unknown>;
63
- export declare function iterLoadAssembleeOrganes(dataDir: string, legislature: Legislature, options?: {}): Generator<{
63
+ export declare function iterLoadAssembleeOrganes(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
64
64
  organe: Organe;
65
65
  datasetLegislature: Legislature;
66
66
  filePath: string;
67
67
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
68
68
  }, void, unknown>;
69
- export declare function iterLoadAssembleeAmendements(dataDir: string, legislature: Legislature, options?: {}): Generator<{
69
+ export declare function iterLoadAssembleeAmendements(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
70
70
  amendement: Amendement;
71
71
  datasetLegislature: Legislature;
72
72
  filePath: string;
73
73
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
74
74
  }, void, unknown>;
75
- export declare function iterLoadAssembleeDocuments(dataDir: string, legislature: Legislature, options?: {}): Generator<{
75
+ export declare function iterLoadAssembleeDocuments(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
76
76
  document: Document;
77
77
  datasetLegislature: Legislature;
78
78
  filePath: string;
79
79
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
80
80
  }, void, unknown>;
81
- export declare function iterLoadAssembleeDossiersParlementaires(dataDir: string, legislature: Legislature, options?: {}): Generator<{
81
+ export declare function iterLoadAssembleeDossiersParlementaires(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
82
82
  dossierParlementaire: DossierParlementaire;
83
83
  datasetLegislature: Legislature;
84
84
  filePath: string;
85
85
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
86
86
  }, void, unknown>;
87
- export declare function iterLoadAssembleeReunions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
87
+ export declare function iterLoadAssembleeReunions(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
88
88
  reunion: Reunion;
89
89
  datasetLegislature: Legislature;
90
90
  filePath: string;
91
91
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
92
92
  }, void, unknown>;
93
- export declare function iterLoadAssembleeScrutins(dataDir: string, legislature: Legislature, options?: {}): Generator<{
93
+ export declare function iterLoadAssembleeScrutins(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
94
94
  scrutin: Scrutin;
95
95
  datasetLegislature: Legislature;
96
96
  filePath: string;
97
97
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
98
98
  }, void, unknown>;
99
- export declare function iterLoadAssembleeQuestions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
99
+ export declare function iterLoadAssembleeQuestions(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
100
100
  question: Question;
101
101
  datasetLegislature: Legislature;
102
102
  filePath: string;
103
103
  gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
104
104
  }, void, unknown>;
105
- export declare function iterLoadAssembleeComptesRendus(dataDir: string, legislature: Legislature, options?: {}): Generator<{
105
+ export declare function iterLoadAssembleeComptesRendus(dataDir: string, legislature: Legislature, options?: {}, customDatasets?: Dataset[]): Generator<{
106
106
  compteRendu: CompteRendu;
107
107
  datasetLegislature: Legislature;
108
108
  filePath: string;
package/lib/loaders.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import E from "node:assert";
2
- import m from "fs-extra";
2
+ import g from "fs-extra";
3
3
  import s from "node:path";
4
- import { a1 as F, a2 as P, L as g, a3 as W, a4 as M, a5 as J, a6 as w, a7 as T, a8 as Q, Y as Z, $ as G, a0 as H, X as K, Z as ee, _ as ne } from "./datasets-BCg11CdK.js";
4
+ import { a1 as F, a2 as P, L as j, a3 as W, a4 as M, a5 as J, a6 as w, a7 as T, a8 as Q, Y as Z, $ as G, a0 as H, X as K, Z as ee, _ as ne } from "./datasets-BCg11CdK.js";
5
5
  import "glob";
6
6
  import { getChangedFilesSinceCommit as V } from "./git.js";
7
7
  import { C as X } from "./amendements-40Z7OJLT.js";
8
8
  function* R(t, o = []) {
9
9
  const e = s.join(t, ...o);
10
- if (m.existsSync(e))
11
- for (const i of m.readdirSync(e)) {
10
+ if (g.existsSync(e))
11
+ for (const i of g.readdirSync(e)) {
12
12
  if (i[0] === ".")
13
13
  continue;
14
14
  const u = s.join(e, i), f = [...o, i];
15
- m.statSync(u).isDirectory() ? yield* R(t, f) : yield f;
15
+ g.statSync(u).isDirectory() ? yield* R(t, f) : yield f;
16
16
  }
17
17
  }
18
18
  const I = [
@@ -54,7 +54,7 @@ function oe(t) {
54
54
  o += I[e + 1], t -= I[e];
55
55
  return o;
56
56
  }
57
- function* B(t, o, e, i, u, f = "json", { log: l = !1, noValidation: h = !1, sinceCommits: y } = {}) {
57
+ function* B(t, o, e, i, u, f = "json", { log: d = !1, noValidation: l = !1, sinceCommits: y } = {}) {
58
58
  const A = /* @__PURE__ */ new Set();
59
59
  for (const S of e) {
60
60
  if (S.ignoreForWeb || !ie(o, S))
@@ -65,7 +65,7 @@ function* B(t, o, e, i, u, f = "json", { log: l = !1, noValidation: h = !1, sinc
65
65
  ), $ = y ? y[S.name] : void 0, x = $ ? V(L, $, {
66
66
  diffFilter: "AMR"
67
67
  }) : null;
68
- l && $ && (console.log(
68
+ d && $ && (console.log(
69
69
  `Filtering files changed since commit ${$} in ${L}`
70
70
  ), console.log(`Found ${x?.size || 0} changed files`));
71
71
  for (const b of R(L, u)) {
@@ -74,9 +74,9 @@ function* B(t, o, e, i, u, f = "json", { log: l = !1, noValidation: h = !1, sinc
74
74
  const D = s.join(L, ...b), n = s.join(...b), c = x?.get(n);
75
75
  if (x && !c)
76
76
  continue;
77
- l && console.log(`Loading file: ${D}…`);
78
- let a = m.readFileSync(D, { encoding: "utf8" });
79
- const p = h ? JSON.parse(a) : i(a);
77
+ d && console.log(`Loading file: ${D}…`);
78
+ let a = g.readFileSync(D, { encoding: "utf8" });
79
+ const p = l ? JSON.parse(a) : i(a);
80
80
  A.has(p.uid) || (A.add(p.uid), yield {
81
81
  datasetLegislature: S.legislature,
82
82
  filePath: D,
@@ -94,7 +94,7 @@ function* B(t, o, e, i, u, f = "json", { log: l = !1, noValidation: h = !1, sinc
94
94
  );
95
95
  for (const [C, D] of b.entries()) {
96
96
  const n = s.join(L, C);
97
- l && console.log(`Deleted file: ${n}`);
97
+ d && console.log(`Deleted file: ${n}`);
98
98
  const a = { uid: s.basename(C, `.${f}`) };
99
99
  yield {
100
100
  datasetLegislature: S.legislature,
@@ -109,212 +109,212 @@ function* B(t, o, e, i, u, f = "json", { log: l = !1, noValidation: h = !1, sinc
109
109
  }
110
110
  function ie(t, o) {
111
111
  const e = Array.isArray(t) ? t : t !== void 0 ? [t] : [];
112
- return t === void 0 || e.includes(0) || o.legislature === g.All ? !0 : e.includes(o.legislature);
112
+ return t === void 0 || e.includes(0) || o.legislature === j.All ? !0 : e.includes(o.legislature);
113
113
  }
114
- function* de(t, o, e = {}) {
114
+ function* de(t, o, e = {}, i) {
115
115
  for (const {
116
- datasetLegislature: i,
117
- item: u,
118
- filePath: f,
116
+ datasetLegislature: u,
117
+ item: f,
118
+ filePath: d,
119
119
  gitStatus: l
120
120
  } of B(
121
121
  t,
122
122
  o,
123
- F.acteursEtOrganes,
123
+ i ?? F.acteursEtOrganes,
124
124
  W.toActeur,
125
125
  ["acteurs"],
126
126
  "json",
127
127
  e
128
128
  ))
129
129
  yield {
130
- acteur: u,
131
- datasetLegislature: i,
132
- filePath: f,
130
+ acteur: f,
131
+ datasetLegislature: u,
132
+ filePath: d,
133
133
  ...l && { gitStatus: l }
134
134
  };
135
135
  }
136
- function* me(t, o, e = {}) {
136
+ function* me(t, o, e = {}, i) {
137
137
  for (const {
138
- item: i,
139
- datasetLegislature: u,
140
- filePath: f,
138
+ item: u,
139
+ datasetLegislature: f,
140
+ filePath: d,
141
141
  gitStatus: l
142
142
  } of B(
143
143
  t,
144
144
  o,
145
- F.acteursEtOrganes,
145
+ i ?? F.acteursEtOrganes,
146
146
  W.toOrgane,
147
147
  ["organes"],
148
148
  "json",
149
149
  e
150
150
  ))
151
151
  yield {
152
- organe: i,
153
- datasetLegislature: u,
154
- filePath: f,
152
+ organe: u,
153
+ datasetLegislature: f,
154
+ filePath: d,
155
155
  ...l && { gitStatus: l }
156
156
  };
157
157
  }
158
- function* ge(t, o, e = {}) {
158
+ function* ge(t, o, e = {}, i) {
159
159
  for (const {
160
- datasetLegislature: i,
161
- item: u,
162
- filePath: f,
160
+ datasetLegislature: u,
161
+ item: f,
162
+ filePath: d,
163
163
  gitStatus: l
164
164
  } of B(
165
165
  t,
166
166
  o,
167
- F.amendements,
167
+ i ?? F.amendements,
168
168
  X.toAmendement,
169
169
  [],
170
170
  "json",
171
171
  e
172
172
  ))
173
173
  yield {
174
- amendement: u,
175
- datasetLegislature: i,
176
- filePath: f,
174
+ amendement: f,
175
+ datasetLegislature: u,
176
+ filePath: d,
177
177
  ...l && { gitStatus: l }
178
178
  };
179
179
  }
180
- function* je(t, o, e = {}) {
180
+ function* je(t, o, e = {}, i) {
181
181
  for (const {
182
- item: i,
183
- datasetLegislature: u,
184
- filePath: f,
182
+ item: u,
183
+ datasetLegislature: f,
184
+ filePath: d,
185
185
  gitStatus: l
186
186
  } of B(
187
187
  t,
188
188
  o,
189
- F.dossiersLegislatifs,
189
+ i ?? F.dossiersLegislatifs,
190
190
  J.toDocument,
191
191
  ["documents"],
192
192
  "json",
193
193
  e
194
194
  ))
195
195
  yield {
196
- document: i,
197
- datasetLegislature: u,
198
- filePath: f,
196
+ document: u,
197
+ datasetLegislature: f,
198
+ filePath: d,
199
199
  ...l && { gitStatus: l }
200
200
  };
201
201
  }
202
- function* he(t, o, e = {}) {
202
+ function* he(t, o, e = {}, i) {
203
203
  for (const {
204
- item: i,
205
- datasetLegislature: u,
206
- filePath: f,
204
+ item: u,
205
+ datasetLegislature: f,
206
+ filePath: d,
207
207
  gitStatus: l
208
208
  } of B(
209
209
  t,
210
210
  o,
211
- F.dossiersLegislatifs,
211
+ i ?? F.dossiersLegislatifs,
212
212
  J.toDossierParlementaire,
213
213
  ["dossiers"],
214
214
  "json",
215
215
  e
216
216
  ))
217
217
  yield {
218
- dossierParlementaire: i,
219
- datasetLegislature: u,
220
- filePath: f,
218
+ dossierParlementaire: u,
219
+ datasetLegislature: f,
220
+ filePath: d,
221
221
  ...l && { gitStatus: l }
222
222
  };
223
223
  }
224
- function* pe(t, o, e = {}) {
224
+ function* pe(t, o, e = {}, i) {
225
225
  for (const {
226
- item: i,
227
- datasetLegislature: u,
228
- filePath: f,
226
+ item: u,
227
+ datasetLegislature: f,
228
+ filePath: d,
229
229
  gitStatus: l
230
230
  } of B(
231
231
  t,
232
232
  o,
233
- F.agendas,
233
+ i ?? F.agendas,
234
234
  M.toReunion,
235
235
  [],
236
236
  "json",
237
237
  e
238
238
  ))
239
239
  yield {
240
- reunion: i,
241
- datasetLegislature: u,
242
- filePath: f,
240
+ reunion: u,
241
+ datasetLegislature: f,
242
+ filePath: d,
243
243
  ...l && { gitStatus: l }
244
244
  };
245
245
  }
246
- function* ye(t, o, e = {}) {
246
+ function* ye(t, o, e = {}, i) {
247
247
  for (const {
248
- item: i,
249
- datasetLegislature: u,
250
- filePath: f,
248
+ item: u,
249
+ datasetLegislature: f,
250
+ filePath: d,
251
251
  gitStatus: l
252
252
  } of B(
253
253
  t,
254
254
  o,
255
- F.scrutins,
255
+ i ?? F.scrutins,
256
256
  w.toScrutin,
257
257
  [],
258
258
  "json",
259
259
  e
260
260
  ))
261
261
  yield {
262
- scrutin: i,
263
- datasetLegislature: u,
264
- filePath: f,
262
+ scrutin: u,
263
+ datasetLegislature: f,
264
+ filePath: d,
265
265
  ...l && { gitStatus: l }
266
266
  };
267
267
  }
268
- function* Fe(t, o, e = {}) {
268
+ function* Fe(t, o, e = {}, i) {
269
269
  for (const {
270
- item: i,
271
- datasetLegislature: u,
272
- filePath: f,
270
+ item: u,
271
+ datasetLegislature: f,
272
+ filePath: d,
273
273
  gitStatus: l
274
274
  } of B(
275
275
  t,
276
276
  o,
277
- F.questions,
277
+ i ?? F.questions,
278
278
  T.toQuestion,
279
279
  [],
280
280
  "json",
281
281
  e
282
282
  ))
283
283
  yield {
284
- question: i,
285
- datasetLegislature: u,
286
- filePath: f,
284
+ question: u,
285
+ datasetLegislature: f,
286
+ filePath: d,
287
287
  ...l && { gitStatus: l }
288
288
  };
289
289
  }
290
- function* Se(t, o, e = {}) {
290
+ function* Se(t, o, e = {}, i) {
291
291
  for (const {
292
- item: i,
293
- datasetLegislature: u,
294
- filePath: f,
292
+ item: u,
293
+ datasetLegislature: f,
294
+ filePath: d,
295
295
  gitStatus: l
296
296
  } of B(
297
297
  t,
298
298
  o,
299
- F.comptesRendusSeances,
299
+ i ?? F.comptesRendusSeances,
300
300
  Q.toCompteRendu,
301
301
  [],
302
302
  "xml",
303
303
  e
304
304
  ))
305
305
  yield {
306
- compteRendu: i,
307
- datasetLegislature: u,
308
- filePath: f,
306
+ compteRendu: u,
307
+ datasetLegislature: f,
308
+ filePath: d,
309
309
  ...l && { gitStatus: l }
310
310
  };
311
311
  }
312
312
  function* Ae(t, o, {} = {}) {
313
313
  const e = `Comptes_Rendus_Commissions_${oe(o)}_nettoye`, i = s.join(t, e);
314
- if (m.existsSync(i))
314
+ if (g.existsSync(i))
315
315
  for (const u of z(i))
316
316
  try {
317
- const f = m.readFileSync(u, "utf-8");
317
+ const f = g.readFileSync(u, "utf-8");
318
318
  yield {
319
319
  compteRendu: JSON.parse(f),
320
320
  datasetLegislature: o,
@@ -325,8 +325,8 @@ function* Ae(t, o, {} = {}) {
325
325
  }
326
326
  }
327
327
  function* z(t) {
328
- if (m.existsSync(t))
329
- for (const o of m.readdirSync(t, { withFileTypes: !0 })) {
328
+ if (g.existsSync(t))
329
+ for (const o of g.readdirSync(t, { withFileTypes: !0 })) {
330
330
  const e = s.join(t, o.name);
331
331
  o.isDirectory() ? yield* z(e) : o.isFile() && e.endsWith(".json") && (yield e);
332
332
  }
@@ -335,7 +335,7 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
335
335
  const u = {}, f = {};
336
336
  if (o & P.ActeursEtOrganes)
337
337
  for (const n of F.acteursEtOrganes) {
338
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
338
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
339
339
  continue;
340
340
  const c = s.join(
341
341
  t,
@@ -346,26 +346,26 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
346
346
  continue;
347
347
  const r = s.join(c, ...a);
348
348
  i && console.log(`Loading file: ${r}…`);
349
- const j = m.readFileSync(r, {
349
+ const h = g.readFileSync(r, {
350
350
  encoding: "utf8"
351
- }), d = W.toActeur(j);
352
- u[d.uid] === void 0 && (u[d.uid] = d);
351
+ }), m = W.toActeur(h);
352
+ u[m.uid] === void 0 && (u[m.uid] = m);
353
353
  }
354
354
  for (const a of R(c, ["organes"])) {
355
355
  if (!a[a.length - 1].endsWith(".json"))
356
356
  continue;
357
357
  const r = s.join(c, ...a);
358
358
  i && console.log(`Loading file: ${r}…`);
359
- const j = m.readFileSync(r, {
359
+ const h = g.readFileSync(r, {
360
360
  encoding: "utf8"
361
- }), d = W.toOrgane(j);
362
- f[d.uid] === void 0 && (f[d.uid] = d);
361
+ }), m = W.toOrgane(h);
362
+ f[m.uid] === void 0 && (f[m.uid] = m);
363
363
  }
364
364
  }
365
- const l = {}, h = {}, y = {};
365
+ const d = {}, l = {}, y = {};
366
366
  if (o & P.Agendas)
367
367
  for (const n of F.agendas) {
368
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
368
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
369
369
  continue;
370
370
  const c = s.join(
371
371
  t,
@@ -376,26 +376,26 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
376
376
  continue;
377
377
  const r = s.join(c, ...a);
378
378
  i && console.log(`Loading file: ${r}…`);
379
- const j = m.readFileSync(r, {
379
+ const h = g.readFileSync(r, {
380
380
  encoding: "utf8"
381
- }), d = M.toReunion(j);
382
- l[d.uid] === void 0 && (l[d.uid] = d);
383
- const v = d.timestampDebut.toISOString().split("T")[0];
384
- let O = h[v];
385
- O === void 0 && (O = h[v] = []), O.push(d);
386
- const _ = d.odj;
381
+ }), m = M.toReunion(h);
382
+ d[m.uid] === void 0 && (d[m.uid] = m);
383
+ const v = m.timestampDebut.toISOString().split("T")[0];
384
+ let O = l[v];
385
+ O === void 0 && (O = l[v] = []), O.push(m);
386
+ const _ = m.odj;
387
387
  if (_ !== void 0)
388
388
  for (const q of _.pointsOdj || [])
389
389
  for (const k of q.dossiersLegislatifsRefs || []) {
390
390
  let N = y[k];
391
- N === void 0 && (N = y[k] = []), N.push(d);
391
+ N === void 0 && (N = y[k] = []), N.push(m);
392
392
  }
393
393
  }
394
394
  }
395
395
  const A = {};
396
396
  if (o & P.Amendements)
397
397
  for (const n of F.amendements) {
398
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
398
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
399
399
  continue;
400
400
  const c = s.join(
401
401
  t,
@@ -406,16 +406,16 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
406
406
  continue;
407
407
  const r = s.join(c, ...a);
408
408
  i && console.log(`Loading file: ${r}…`);
409
- const j = m.readFileSync(r, {
409
+ const h = g.readFileSync(r, {
410
410
  encoding: "utf8"
411
- }), d = X.toAmendement(j);
412
- A[d.uid] === void 0 && (A[d.uid] = d);
411
+ }), m = X.toAmendement(h);
412
+ A[m.uid] === void 0 && (A[m.uid] = m);
413
413
  }
414
414
  }
415
415
  const S = {}, U = {}, L = {}, $ = {};
416
416
  if (o & P.DossiersLegislatifs)
417
417
  for (const n of F.dossiersLegislatifs) {
418
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
418
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
419
419
  continue;
420
420
  const c = s.join(
421
421
  t,
@@ -426,20 +426,20 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
426
426
  continue;
427
427
  const r = s.join(c, ...a);
428
428
  i && console.log(`Loading file: ${r}…`);
429
- const j = m.readFileSync(r, {
429
+ const h = g.readFileSync(r, {
430
430
  encoding: "utf8"
431
- }), d = J.toDocument(j);
432
- S[d.uid] === void 0 && (S[d.uid] = d);
431
+ }), m = J.toDocument(h);
432
+ S[m.uid] === void 0 && (S[m.uid] = m);
433
433
  }
434
434
  for (const a of R(c, ["dossiers"])) {
435
435
  if (!a[a.length - 1].endsWith(".json"))
436
436
  continue;
437
437
  const r = s.join(c, ...a);
438
438
  i && console.log(`Loading file: ${r}…`);
439
- const j = m.readFileSync(r, {
439
+ const h = g.readFileSync(r, {
440
440
  encoding: "utf8"
441
- }), d = J.toDossierParlementaire(j), v = d.titreDossier;
442
- v.senatChemin && U[v.senatChemin] === void 0 && (U[v.senatChemin] = d), v.titreChemin && L[v.titreChemin] === void 0 && (L[v.titreChemin] = d), $[d.uid] === void 0 && ($[d.uid] = d);
441
+ }), m = J.toDossierParlementaire(h), v = m.titreDossier;
442
+ v.senatChemin && U[v.senatChemin] === void 0 && (U[v.senatChemin] = m), v.titreChemin && L[v.titreChemin] === void 0 && (L[v.titreChemin] = m), $[m.uid] === void 0 && ($[m.uid] = m);
443
443
  }
444
444
  }
445
445
  let x = {};
@@ -448,12 +448,12 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
448
448
  const n = s.join(
449
449
  t,
450
450
  `photos_deputes_${// TODO: Handle Legislature.All.
451
- e === g.All ? g.DixSept : e}`,
451
+ e === j.All ? j.DixSept : e}`,
452
452
  "deputes.json"
453
453
  );
454
- if (m.existsSync(n)) {
454
+ if (g.existsSync(n)) {
455
455
  i && console.log(`Loading file: ${n}`);
456
- const c = m.readFileSync(n, { encoding: "utf8" });
456
+ const c = g.readFileSync(n, { encoding: "utf8" });
457
457
  Object.assign(x, JSON.parse(c));
458
458
  } else i && console.log(`Ignoring missing file: ${n}`);
459
459
  }
@@ -463,9 +463,9 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
463
463
  "photos_senateurs",
464
464
  "senateurs.json"
465
465
  );
466
- if (m.existsSync(n)) {
466
+ if (g.existsSync(n)) {
467
467
  i && console.log(`Loading file: ${n}`);
468
- const c = m.readFileSync(n, { encoding: "utf8" });
468
+ const c = g.readFileSync(n, { encoding: "utf8" });
469
469
  Object.assign(x, JSON.parse(c));
470
470
  } else i && console.log(`Ignoring missing file: ${n}`);
471
471
  }
@@ -473,7 +473,7 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
473
473
  const b = {};
474
474
  if (o & P.Scrutins)
475
475
  for (const n of F.scrutins) {
476
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
476
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
477
477
  continue;
478
478
  const c = s.join(
479
479
  t,
@@ -484,16 +484,16 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
484
484
  continue;
485
485
  const r = s.join(c, ...a);
486
486
  i && console.log(`Loading file: ${r}…`);
487
- const j = m.readFileSync(r, {
487
+ const h = g.readFileSync(r, {
488
488
  encoding: "utf8"
489
- }), d = w.toScrutin(j);
490
- b[d.uid] === void 0 && (b[d.uid] = d);
489
+ }), m = w.toScrutin(h);
490
+ b[m.uid] === void 0 && (b[m.uid] = m);
491
491
  }
492
492
  }
493
493
  const C = {};
494
494
  if (o & P.Questions)
495
495
  for (const n of F.questions) {
496
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
496
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
497
497
  continue;
498
498
  const c = s.join(
499
499
  t,
@@ -504,16 +504,16 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
504
504
  continue;
505
505
  const r = s.join(c, ...a);
506
506
  i && console.log(`Loading file: ${r}…`);
507
- const j = m.readFileSync(r, {
507
+ const h = g.readFileSync(r, {
508
508
  encoding: "utf8"
509
- }), d = T.toQuestion(j);
510
- C[d.uid] === void 0 && (C[d.uid] = d);
509
+ }), m = T.toQuestion(h);
510
+ C[m.uid] === void 0 && (C[m.uid] = m);
511
511
  }
512
512
  }
513
513
  const D = {};
514
514
  if (o & P.ComptesRendusSeances)
515
515
  for (const n of F.comptesRendusSeances) {
516
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
516
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
517
517
  continue;
518
518
  const c = s.join(
519
519
  t,
@@ -524,10 +524,10 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
524
524
  continue;
525
525
  const r = s.join(c, ...a);
526
526
  i && console.log(`Loading file: ${r}…`);
527
- const j = m.readFileSync(r, {
527
+ const h = g.readFileSync(r, {
528
528
  encoding: "utf8"
529
- }), d = Q.toCompteRendu(j);
530
- D[d.uid] === void 0 && (D[d.uid] = d);
529
+ }), m = Q.toCompteRendu(h);
530
+ D[m.uid] === void 0 && (D[m.uid] = m);
531
531
  }
532
532
  }
533
533
  return {
@@ -539,8 +539,8 @@ function Pe(t, o, e, { log: i = !1 } = {}) {
539
539
  dossierParlementaireByUid: $,
540
540
  organeByUid: f,
541
541
  photoByUid: x,
542
- reunionByUid: l,
543
- reunionsByDay: h,
542
+ reunionByUid: d,
543
+ reunionsByDay: l,
544
544
  reunionsByDossierUid: y,
545
545
  scrutinByUid: b,
546
546
  questionByUid: C,
@@ -551,35 +551,35 @@ function Le(t, o, e, { log: i = !1 } = {}) {
551
551
  const u = {}, f = {};
552
552
  if (o & P.ActeursEtOrganes)
553
553
  for (const n of F.acteursEtOrganes) {
554
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
554
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
555
555
  continue;
556
556
  const c = s.join(
557
557
  t,
558
558
  n.filename.replace(/\.json$/, "_nettoye.json")
559
559
  );
560
560
  i && console.log(`Loading file: ${c}`);
561
- const a = m.readFileSync(c, { encoding: "utf8" }), p = W.toActeursEtOrganes(a);
561
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = W.toActeursEtOrganes(a);
562
562
  for (const r of p.acteurs)
563
563
  u[r.uid] === void 0 && (u[r.uid] = r);
564
564
  for (const r of p.organes)
565
565
  f[r.uid] === void 0 && (f[r.uid] = r);
566
566
  }
567
- const l = {}, h = {}, y = {};
567
+ const d = {}, l = {}, y = {};
568
568
  if (o & P.Agendas)
569
569
  for (const n of F.agendas) {
570
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
570
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
571
571
  continue;
572
572
  const c = s.join(
573
573
  t,
574
574
  n.filename.replace(/\.json$/, "_nettoye.json")
575
575
  );
576
576
  i && console.log(`Loading file: ${c}`);
577
- const a = m.readFileSync(c, { encoding: "utf8" }), p = M.toAgendas(a);
577
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = M.toAgendas(a);
578
578
  for (const r of p.reunions) {
579
- l[r.uid] === void 0 && (l[r.uid] = r);
580
- const j = r.timestampDebut.toISOString().split("T")[0];
581
- let d = h[j];
582
- d === void 0 && (d = h[j] = []), d.push(r);
579
+ d[r.uid] === void 0 && (d[r.uid] = r);
580
+ const h = r.timestampDebut.toISOString().split("T")[0];
581
+ let m = l[h];
582
+ m === void 0 && (m = l[h] = []), m.push(r);
583
583
  const v = r.odj;
584
584
  if (v !== void 0)
585
585
  for (const O of v.pointsOdj || [])
@@ -592,34 +592,34 @@ function Le(t, o, e, { log: i = !1 } = {}) {
592
592
  const A = {};
593
593
  if (o & P.Amendements)
594
594
  for (const n of F.amendements) {
595
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
595
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
596
596
  continue;
597
597
  const c = s.join(
598
598
  t,
599
599
  n.filename.replace(/\.json$/, "_nettoye.json")
600
600
  );
601
601
  i && console.log(`Loading file: ${c}`);
602
- const a = m.readFileSync(c, { encoding: "utf8" }), p = X.toAmendements(a);
602
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = X.toAmendements(a);
603
603
  for (const r of p.textesLegislatifs)
604
- for (const j of r.amendements)
605
- A[j.uid] === void 0 && (A[j.uid] = j);
604
+ for (const h of r.amendements)
605
+ A[h.uid] === void 0 && (A[h.uid] = h);
606
606
  }
607
607
  const S = {}, U = {}, L = {}, $ = {};
608
608
  if (o & P.DossiersLegislatifs)
609
609
  for (const n of F.dossiersLegislatifs) {
610
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
610
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
611
611
  continue;
612
612
  const c = s.join(
613
613
  t,
614
614
  n.filename.replace(/\.json$/, "_nettoye.json")
615
615
  );
616
616
  i && console.log(`Loading file: ${c}`);
617
- const a = m.readFileSync(c, { encoding: "utf8" }), p = J.toDossiersLegislatifs(a);
617
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = J.toDossiersLegislatifs(a);
618
618
  for (const r of p.textesLegislatifs)
619
619
  S[r.uid] === void 0 && (S[r.uid] = r);
620
620
  for (const r of p.dossiersParlementaires) {
621
- const j = r.titreDossier;
622
- j.senatChemin && U[j.senatChemin] === void 0 && (U[j.senatChemin] = r), j.titreChemin && L[j.titreChemin] === void 0 && (L[j.titreChemin] = r), $[r.uid] === void 0 && ($[r.uid] = r);
621
+ const h = r.titreDossier;
622
+ h.senatChemin && U[h.senatChemin] === void 0 && (U[h.senatChemin] = r), h.titreChemin && L[h.titreChemin] === void 0 && (L[h.titreChemin] = r), $[r.uid] === void 0 && ($[r.uid] = r);
623
623
  }
624
624
  }
625
625
  const x = {};
@@ -629,12 +629,12 @@ function Le(t, o, e, { log: i = !1 } = {}) {
629
629
  const c = s.join(
630
630
  t,
631
631
  `photos_deputes_${// TODO: Handle Legislature.All.
632
- e === g.All ? g.DixSept : e}`,
632
+ e === j.All ? j.DixSept : e}`,
633
633
  "deputes.json"
634
634
  );
635
- if (m.existsSync(c)) {
635
+ if (g.existsSync(c)) {
636
636
  i && console.log(`Loading file: ${c}`);
637
- const a = m.readFileSync(c, { encoding: "utf8" });
637
+ const a = g.readFileSync(c, { encoding: "utf8" });
638
638
  Object.assign(n, JSON.parse(a));
639
639
  } else i && console.log(`Ignoring missing file: ${c}`);
640
640
  }
@@ -644,9 +644,9 @@ function Le(t, o, e, { log: i = !1 } = {}) {
644
644
  "photos_senateurs",
645
645
  "senateurs.json"
646
646
  );
647
- if (m.existsSync(c)) {
647
+ if (g.existsSync(c)) {
648
648
  i && console.log(`Loading file: ${c}`);
649
- const a = m.readFileSync(c, { encoding: "utf8" });
649
+ const a = g.readFileSync(c, { encoding: "utf8" });
650
650
  Object.assign(n, JSON.parse(a));
651
651
  } else i && console.log(`Ignoring missing file: ${c}`);
652
652
  }
@@ -654,42 +654,42 @@ function Le(t, o, e, { log: i = !1 } = {}) {
654
654
  const b = {};
655
655
  if (o & P.Scrutins)
656
656
  for (const n of F.scrutins) {
657
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
657
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
658
658
  continue;
659
659
  const c = s.join(
660
660
  t,
661
661
  n.filename.replace(/\.json$/, "_nettoye.json")
662
662
  );
663
663
  i && console.log(`Loading file: ${c}`);
664
- const a = m.readFileSync(c, { encoding: "utf8" }), p = w.toScrutins(a);
664
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = w.toScrutins(a);
665
665
  for (const r of p.scrutins)
666
666
  b[r.uid] === void 0 && (b[r.uid] = r);
667
667
  }
668
668
  const C = {};
669
669
  if (o & P.Questions)
670
670
  for (const n of F.questions) {
671
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
671
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
672
672
  continue;
673
673
  const c = s.join(
674
674
  t,
675
675
  n.filename.replace(/\.json$/, "_nettoye.json")
676
676
  );
677
677
  i && console.log(`Loading file: ${c}`);
678
- const a = m.readFileSync(c, { encoding: "utf8" }), p = T.toQuestions(a);
678
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = T.toQuestions(a);
679
679
  for (const r of p.questions)
680
680
  C[r.uid] === void 0 && (C[r.uid] = r);
681
681
  }
682
682
  const D = {};
683
683
  if (o & P.ComptesRendusSeances)
684
684
  for (const n of F.comptesRendusSeances) {
685
- if (n.ignoreForWeb || e !== g.All && n.legislature !== g.All && e !== n.legislature)
685
+ if (n.ignoreForWeb || e !== j.All && n.legislature !== j.All && e !== n.legislature)
686
686
  continue;
687
687
  const c = s.join(
688
688
  t,
689
689
  n.filename.replace(/\.json$/, "_nettoye.json")
690
690
  );
691
691
  i && console.log(`Loading file: ${c}`);
692
- const a = m.readFileSync(c, { encoding: "utf8" }), p = Q.toComptesRendus(a);
692
+ const a = g.readFileSync(c, { encoding: "utf8" }), p = Q.toComptesRendus(a);
693
693
  for (const r of p.comptesRendus)
694
694
  D[r.uid] === void 0 && (D[r.uid] = r);
695
695
  }
@@ -702,8 +702,8 @@ function Le(t, o, e, { log: i = !1 } = {}) {
702
702
  dossierParlementaireByUid: $,
703
703
  organeByUid: f,
704
704
  photoByUid: x,
705
- reunionByUid: l,
706
- reunionsByDay: h,
705
+ reunionByUid: d,
706
+ reunionsByDay: l,
707
707
  reunionsByDossierUid: y,
708
708
  scrutinByUid: b,
709
709
  questionByUid: C,
@@ -712,23 +712,23 @@ function Le(t, o, e, { log: i = !1 } = {}) {
712
712
  }
713
713
  function $e(t, o, e) {
714
714
  const i = s.join(t, "Documents"), u = te(i, o), f = s.join(u, "index.json");
715
- if (!m.pathExistsSync(f))
715
+ if (!g.pathExistsSync(f))
716
716
  return;
717
- const l = m.readJsonSync(f);
718
- for (const h of e)
719
- for (const { filename: y, url: A } of l[h] ?? [])
717
+ const d = g.readJsonSync(f);
718
+ for (const l of e)
719
+ for (const { filename: y, url: A } of d[l] ?? [])
720
720
  if (y !== void 0)
721
- return { format: h, path: s.join(u, y), url: A };
721
+ return { format: l, path: s.join(u, y), url: A };
722
722
  }
723
723
  function be(t, o, { log: e = !1 } = {}) {
724
724
  const i = s.join(
725
725
  t,
726
726
  `photos_deputes_${// TODO: Handle Legislature.All.
727
- o === g.All ? g.DixSept : o}`,
727
+ o === j.All ? j.DixSept : o}`,
728
728
  "deputes.json"
729
729
  );
730
730
  e && console.log(`Loading file: ${i}`);
731
- const u = m.readFileSync(i, { encoding: "utf8" });
731
+ const u = g.readFileSync(i, { encoding: "utf8" });
732
732
  return JSON.parse(u);
733
733
  }
734
734
  function De(t, { log: o = !1 } = {}) {
@@ -738,7 +738,7 @@ function De(t, { log: o = !1 } = {}) {
738
738
  "senateurs.json"
739
739
  );
740
740
  o && console.log(`Loading file: ${e}`);
741
- const i = m.readFileSync(e, { encoding: "utf8" });
741
+ const i = g.readFileSync(e, { encoding: "utf8" });
742
742
  return JSON.parse(i);
743
743
  }
744
744
  function te(t, o) {
@@ -751,20 +751,20 @@ function te(t, o) {
751
751
  const i = e.groups, u = s.join(
752
752
  t,
753
753
  i.documentType ?? i.documentType2
754
- ), f = s.join(u, i.chambre ?? i.chambre2), l = s.join(
754
+ ), f = s.join(u, i.chambre ?? i.chambre2), d = s.join(
755
755
  f,
756
756
  i.republique ?? i.republique2
757
- ), h = s.join(
758
- l,
757
+ ), l = s.join(
758
+ d,
759
759
  i.legislature ?? i.legislature2
760
760
  ), y = i.etat;
761
761
  if (y === void 0)
762
- return m.ensureDirSync(h), s.join(h, o);
763
- const A = s.join(h, y);
762
+ return g.ensureDirSync(l), s.join(l, o);
763
+ const A = s.join(l, y);
764
764
  let S = "000000" + (i.numero ?? i.numero2);
765
765
  S = S.substring(S.length - 6);
766
766
  const U = s.join(A, S.substring(0, 3));
767
- return m.ensureDirSync(U), s.join(U, o);
767
+ return g.ensureDirSync(U), s.join(U, o);
768
768
  }
769
769
  function Ue(t, o) {
770
770
  return Y(t, o, ee);
@@ -776,11 +776,11 @@ function ve(t, o) {
776
776
  null,
777
777
  `Unexpected structure for reunion UID: ${o}`
778
778
  );
779
- const i = s.join(t, e[1]), u = s.join(i, e[2]), f = s.join(u, e[3]), l = s.join(f, e[4]), h = s.join(l, e[5]);
779
+ const i = s.join(t, e[1]), u = s.join(i, e[2]), f = s.join(u, e[3]), d = s.join(f, e[4]), l = s.join(d, e[5]);
780
780
  let y = "000000000" + e[6];
781
781
  y = y.substring(y.length - 9);
782
- const A = s.join(h, y.substring(0, 3)), S = s.join(A, y.substring(3, 3));
783
- return m.ensureDirSync(S), s.join(S, o);
782
+ const A = s.join(l, y.substring(0, 3)), S = s.join(A, y.substring(3, 3));
783
+ return g.ensureDirSync(S), s.join(S, o);
784
784
  }
785
785
  function Ce(t, o) {
786
786
  const e = H.exec(o);
@@ -790,10 +790,10 @@ function Ce(t, o) {
790
790
  `Unexpected structure for scrutin UID: ${o}`
791
791
  );
792
792
  const i = s.join(t, e[1]), u = s.join(i, e[2]), f = s.join(u, e[3]);
793
- let l = "000000" + e[4];
794
- l = l.substring(l.length - 6);
795
- const h = s.join(f, l.substring(0, 3));
796
- return m.ensureDirSync(h), s.join(h, o);
793
+ let d = "000000" + e[4];
794
+ d = d.substring(d.length - 6);
795
+ const l = s.join(f, d.substring(0, 3));
796
+ return g.ensureDirSync(l), s.join(l, o);
797
797
  }
798
798
  function Re(t, o) {
799
799
  return Y(t, o, ne);
@@ -805,11 +805,11 @@ function xe(t, o) {
805
805
  null,
806
806
  `Unexpected structure for object with UID: ${o}`
807
807
  );
808
- const i = s.join(t, e[2]), u = s.join(i, e[3]), f = s.join(u, e[4]), l = s.join(f, e[5]);
809
- let h = "000000000" + e[7];
810
- h = h.substring(h.length - 9);
811
- const y = s.join(l, h.substring(0, 3)), A = s.join(y, h.substring(3, 3));
812
- return m.ensureDirSync(A), s.join(A, o);
808
+ const i = s.join(t, e[2]), u = s.join(i, e[3]), f = s.join(u, e[4]), d = s.join(f, e[5]);
809
+ let l = "000000000" + e[7];
810
+ l = l.substring(l.length - 9);
811
+ const y = s.join(d, l.substring(0, 3)), A = s.join(y, l.substring(3, 3));
812
+ return g.ensureDirSync(A), s.join(A, o);
813
813
  }
814
814
  function Y(t, o, e) {
815
815
  const i = e.exec(o);
@@ -819,10 +819,10 @@ function Y(t, o, e) {
819
819
  `Unexpected structure for object with UID: ${o}`
820
820
  );
821
821
  const u = s.join(t, i[1]), f = s.join(u, i[2]);
822
- let l = "000000" + i[3];
823
- l = l.substring(l.length - 6);
824
- const h = s.join(f, l.substring(0, 3));
825
- return m.ensureDirSync(h), s.join(h, o);
822
+ let d = "000000" + i[3];
823
+ d = d.substring(d.length - 6);
824
+ const l = s.join(f, d.substring(0, 3));
825
+ return g.ensureDirSync(l), s.join(l, o);
826
826
  }
827
827
  export {
828
828
  P as EnabledDatasets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/assemblee",
3
- "version": "2.5.25",
3
+ "version": "2.5.26",
4
4
  "description": "Retrieve, clean up & handle French Assemblée nationale's open data",
5
5
  "keywords": [
6
6
  "Assemblée nationale",