@tricoteuses/assemblee 2.3.1 → 2.4.1

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,4 @@
1
+ /**
2
+ * Node: Code taken from @tricoteuses/legifrance
3
+ */
4
+ export declare function romanNumeralFromNumber(num: number): string | undefined;
@@ -1,22 +1,6 @@
1
- type SubdivisionHeader = {
2
- texte: string;
3
- html: string;
4
- };
5
- type SubdivisionAlinea = {
6
- texte: string;
7
- html: string;
8
- };
9
- type Subdivision = {
10
- id: string;
11
- type: string;
12
- niveau: number;
13
- niveauRelatif: number;
14
- titres: SubdivisionHeader[];
15
- alineas: SubdivisionAlinea[];
16
- };
1
+ import { Subdivision } from '../types/dossiers_legislatifs';
17
2
  export declare function parseTexte(assembleeUrl: string, page: string): {
18
3
  error: null;
19
4
  subdivisions: Subdivision[];
20
5
  url: string;
21
6
  };
22
- export {};
package/lib/parsers.js CHANGED
@@ -6,7 +6,7 @@ import G0 from "js-yaml";
6
6
  import P from "node:assert";
7
7
  import qt from "node:path";
8
8
  import { parse as Yt } from "node-html-parser";
9
- import { d as Q0 } from "./amendements-DcffXOt8.js";
9
+ import { d as Q0 } from "./amendements-J6Sx61n8.js";
10
10
  import { C as W0 } from "./amendements-40Z7OJLT.js";
11
11
  var D;
12
12
  (function(e) {
@@ -10050,15 +10050,20 @@ function _1(e) {
10050
10050
  return [null, ""];
10051
10051
  }
10052
10052
  function p1(e) {
10053
+ const u = "ÀÂÄÇÉÈÊËÎÏÔÖÙÛÜŸ", t = new RegExp(`(?<=[a-z])([${u}])(?=[a-z])`, "gu");
10054
+ return e.replace(t, (a) => a.toLocaleLowerCase("fr-FR"));
10055
+ }
10056
+ function g1(e) {
10053
10057
  return e.replace(/<script[\w\W]+?<\/script>/gi, "").replace(/<!--[\w\W]*?-->/g, "").replace(/<head[\w\W]+?<\/head>/gi, "").replace(/<[^\/>][^>]*>\s*<\/[^>]+>/g, "");
10054
10058
  }
10055
10059
  function ot(e) {
10056
- return e?.replace(/\u00A0/g, " ").replace(/[\n\t]+/g, "").trim() || "";
10060
+ const u = e?.replace(/\u00A0/g, " ").replace(/[\n\t]+/g, "").trim() || "";
10061
+ return p1(u);
10057
10062
  }
10058
10063
  function $u(e) {
10059
10064
  return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\(nouveau\)/, "").replace(/\(Pour coordination\)/, "").replace(/\(Supprimés?\)/, "").replace(/ /g, " ").replace(/[\-,.…]/g, "").trim().replace(/ {1,}/g, "_").toUpperCase();
10060
10065
  }
10061
- const g1 = [
10066
+ const N1 = [
10062
10067
  /^– \d+ –/,
10063
10068
  /^- \d+ -/,
10064
10069
  /^Délibéré en séance publique/,
@@ -10067,13 +10072,13 @@ const g1 = [
10067
10072
  /^Le Président,$/,
10068
10073
  /^Signé/
10069
10074
  ];
10070
- function N1(e) {
10071
- return g1.some((u) => u.test(e));
10072
- }
10073
10075
  function I1(e) {
10074
- return e("p:not(table p), h4, table").toArray();
10076
+ return N1.some((u) => u.test(e));
10075
10077
  }
10076
10078
  function S1(e) {
10079
+ return e("p:not(table p), h4, table").toArray();
10080
+ }
10081
+ function x1(e) {
10077
10082
  if (e.is("table")) {
10078
10083
  let u = "";
10079
10084
  return e.find("tr").each((t, a) => {
@@ -10086,24 +10091,24 @@ function S1(e) {
10086
10091
  } else
10087
10092
  return ot(e.text());
10088
10093
  }
10089
- function v1(e, u) {
10090
- const t = p1(u), a = ct(t), s = I1(a).filter(
10094
+ function q1(e, u) {
10095
+ const t = g1(u), a = ct(t), s = S1(a).filter(
10091
10096
  (N) => ot(a(N).text()).length > 0
10092
10097
  ), n = [], i = [];
10093
10098
  let d = null, l = null, b = !1, T = [], p = [], g = !1;
10094
10099
  for (const N of s) {
10095
- const I = a(N), R = ot(I.prop("outerHTML") || ""), B = S1(I), G = $u(B), [V, W] = _1(G);
10100
+ const I = a(N), R = ot(I.prop("outerHTML") || ""), B = x1(I), G = $u(B), [V, W] = _1(G);
10096
10101
  if (!g)
10097
10102
  if (V !== null && V >= 0 && W !== "Annexe")
10098
10103
  g = !0;
10099
10104
  else
10100
10105
  continue;
10101
- if (!(!G || N1(B) || V !== null && V < 0))
10106
+ if (!(!G || I1(B) || V !== null && V < 0))
10102
10107
  if (V === null)
10103
10108
  T.length === 0 || b && p.length === 0 ? T.push({ texte: B, html: R }) : p.push({ texte: B, html: R }), b && T.length >= 2 && (b = !1);
10104
10109
  else {
10105
10110
  for (d = V, T.length > 0 && n.push({
10106
- id: `D_${$u(T[0]?.texte)}`,
10111
+ id: `D_${$u(T[0]?.texte ?? "")}`,
10107
10112
  type: l ?? "",
10108
10113
  niveau: d + 1,
10109
10114
  niveauRelatif: i.length,
@@ -10115,7 +10120,7 @@ function v1(e, u) {
10115
10120
  }
10116
10121
  }
10117
10122
  return T.length > 0 && n.push({
10118
- id: `D_${$u(T[0]?.texte)}`,
10123
+ id: `D_${$u(T[0]?.texte ?? "")}`,
10119
10124
  type: l ?? "",
10120
10125
  niveau: (d ?? 0) + 1,
10121
10126
  niveauRelatif: i.length,
@@ -10146,11 +10151,11 @@ function Na(e, u) {
10146
10151
  }
10147
10152
  return n;
10148
10153
  }
10149
- async function* q1(e, u, t, a, s, n = {}) {
10154
+ async function* Y1(e, u, t, a, s, n = {}) {
10150
10155
  for await (const [
10151
10156
  i,
10152
10157
  d
10153
- ] of x1(
10158
+ ] of C1(
10154
10159
  e,
10155
10160
  u,
10156
10161
  t,
@@ -10163,7 +10168,7 @@ async function* q1(e, u, t, a, s, n = {}) {
10163
10168
  W0.toAmendement(JSON.stringify(d))
10164
10169
  ];
10165
10170
  }
10166
- async function* x1(e, u, t, a, s, n = {}) {
10171
+ async function* C1(e, u, t, a, s, n = {}) {
10167
10172
  await Be.ensureDir(e), P.strictEqual(
10168
10173
  /[?&]date_depot=/.exec(u),
10169
10174
  null,
@@ -10362,7 +10367,7 @@ ${Mt}`;
10362
10367
  }
10363
10368
  }
10364
10369
  export {
10365
- q1 as iterRechercheAmendements,
10366
- x1 as iterRechercheRawAmendements,
10367
- v1 as parseTexte
10370
+ Y1 as iterRechercheAmendements,
10371
+ C1 as iterRechercheRawAmendements,
10372
+ q1 as parseTexte
10368
10373
  };
@@ -80,6 +80,9 @@
80
80
  "type": "string",
81
81
  "description": "Identifiant unique du {@link http://data.assemblee-nationale.fr/travaux-parlementaires/debats compte rendu } d'une séance publique. Uniquement si xsiType égal à 'seance_type'."
82
82
  },
83
+ "transcriptionRef": {
84
+ "type": "string"
85
+ },
83
86
  "identifiants": {
84
87
  "$ref": "#/definitions/Identifiants",
85
88
  "description": "Identifiant de la séance publique. Uniquement si xsiType égal à 'seance_type'."
@@ -2261,6 +2261,9 @@
2261
2261
  "type": "string",
2262
2262
  "description": "Identifiant unique du {@link http://data.assemblee-nationale.fr/travaux-parlementaires/debats compte rendu } d'une séance publique. Uniquement si xsiType égal à 'seance_type'."
2263
2263
  },
2264
+ "transcriptionRef": {
2265
+ "type": "string"
2266
+ },
2264
2267
  "identifiants": {
2265
2268
  "$ref": "#/definitions/Identifiants",
2266
2269
  "description": "Identifiant de la séance publique. Uniquement si xsiType égal à 'seance_type'."
@@ -1,2 +1 @@
1
- export declare function toRomanLegislature(num: number): string;
2
1
  export declare const writeIfChanged: (p: string, content: string) => Promise<void>;
@@ -57,6 +57,7 @@ export interface Reunion {
57
57
  * Identifiant unique du {@link http://data.assemblee-nationale.fr/travaux-parlementaires/debats | compte rendu} d'une séance publique. Uniquement si xsiType égal à 'seance_type'.
58
58
  */
59
59
  compteRenduRef?: string;
60
+ transcriptionRef?: string;
60
61
  /**
61
62
  * Identifiant de la séance publique. Uniquement si xsiType égal à 'seance_type'.
62
63
  */