@tricoteuses/senat 3.2.1 → 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.
Files changed (110) hide show
  1. package/LICENSE.md +32 -32
  2. package/README.md +326 -326
  3. package/lib/src/config.d.ts +43 -0
  4. package/lib/src/config.js +37 -0
  5. package/lib/src/conversion_textes.d.ts +11 -0
  6. package/lib/src/conversion_textes.js +320 -0
  7. package/lib/src/databases_postgres.d.ts +4 -0
  8. package/lib/src/databases_postgres.js +23 -0
  9. package/lib/src/datasets.d.ts +38 -0
  10. package/lib/src/datasets.js +247 -0
  11. package/lib/src/git.d.ts +27 -0
  12. package/lib/src/git.js +251 -0
  13. package/lib/src/index.d.ts +1 -1
  14. package/lib/src/loaders.d.ts +52 -0
  15. package/lib/src/loaders.js +260 -0
  16. package/lib/src/model/agenda.d.ts +6 -0
  17. package/lib/src/model/agenda.js +148 -0
  18. package/lib/src/model/ameli.d.ts +67 -0
  19. package/lib/src/model/ameli.js +150 -0
  20. package/lib/src/model/commission.d.ts +19 -0
  21. package/lib/src/model/commission.js +269 -0
  22. package/lib/src/model/debats.d.ts +39 -0
  23. package/lib/src/model/debats.js +112 -0
  24. package/lib/src/model/documents.d.ts +32 -0
  25. package/lib/src/model/documents.js +182 -0
  26. package/lib/src/model/dosleg.d.ts +144 -0
  27. package/lib/src/model/dosleg.js +468 -0
  28. package/lib/src/model/index.d.ts +7 -0
  29. package/lib/src/model/index.js +7 -0
  30. package/lib/src/model/questions.d.ts +54 -0
  31. package/lib/src/model/questions.js +91 -0
  32. package/lib/src/model/scrutins.d.ts +48 -0
  33. package/lib/src/model/scrutins.js +121 -0
  34. package/lib/src/model/seance.d.ts +3 -0
  35. package/lib/src/model/seance.js +267 -0
  36. package/lib/src/model/sens.d.ts +112 -0
  37. package/lib/src/model/sens.js +385 -0
  38. package/lib/src/model/util.d.ts +1 -0
  39. package/lib/src/model/util.js +15 -0
  40. package/lib/src/parsers/plf/amendement.d.ts +3 -0
  41. package/lib/src/parsers/plf/amendement.js +152 -0
  42. package/lib/src/raw_types/ameli.d.ts +1762 -0
  43. package/lib/src/raw_types/ameli.js +1074 -0
  44. package/lib/src/raw_types/debats.d.ts +380 -0
  45. package/lib/src/raw_types/debats.js +266 -0
  46. package/lib/src/raw_types/dosleg.d.ts +2954 -0
  47. package/lib/src/raw_types/dosleg.js +2005 -0
  48. package/lib/src/raw_types/questions.d.ts +699 -0
  49. package/lib/src/raw_types/questions.js +493 -0
  50. package/lib/src/raw_types/sens.d.ts +7843 -0
  51. package/lib/src/raw_types/sens.js +4691 -0
  52. package/lib/src/raw_types_schemats/ameli.d.ts +541 -0
  53. package/lib/src/raw_types_schemats/ameli.js +2 -0
  54. package/lib/src/raw_types_schemats/debats.d.ts +127 -0
  55. package/lib/src/raw_types_schemats/debats.js +2 -0
  56. package/lib/src/raw_types_schemats/dosleg.d.ts +977 -0
  57. package/lib/src/raw_types_schemats/dosleg.js +2 -0
  58. package/lib/src/raw_types_schemats/questions.d.ts +237 -0
  59. package/lib/src/raw_types_schemats/questions.js +2 -0
  60. package/lib/src/raw_types_schemats/sens.d.ts +2709 -0
  61. package/lib/src/raw_types_schemats/sens.js +2 -0
  62. package/lib/src/rich_types/ameli.d.ts +12 -0
  63. package/lib/src/scripts/debug_dosleg_query.d.ts +6 -0
  64. package/lib/src/scripts/debug_dosleg_query.js +50 -0
  65. package/lib/src/scripts/retrieve_open_data.js +2 -1
  66. package/lib/src/scripts/shared/incremental_import_sql.js +866 -866
  67. package/lib/src/scripts/shared/schema_version.js +85 -84
  68. package/lib/src/scripts/shared/staging_metadata_sql.js +214 -214
  69. package/lib/src/scripts/validate_prefixed_tables.js +12 -12
  70. package/lib/src/server/ameli.js +18 -11
  71. package/lib/src/server/conversion_textes.js +106 -106
  72. package/lib/src/server/datasets.js +1 -0
  73. package/lib/src/server/debats.js +10 -10
  74. package/lib/src/server/documents.js +22 -22
  75. package/lib/src/server/dosleg.js +33 -33
  76. package/lib/src/server/questions.js +10 -10
  77. package/lib/src/server/scrutins.js +3 -3
  78. package/lib/src/server/sens.js +19 -19
  79. package/lib/src/types/agenda.d.ts +45 -0
  80. package/lib/src/types/ameli.d.ts +5 -0
  81. package/lib/src/types/ameli.js +1 -0
  82. package/lib/src/types/compte_rendu.d.ts +83 -0
  83. package/lib/src/types/compte_rendu.js +1 -0
  84. package/lib/src/types/debats.d.ts +2 -0
  85. package/lib/src/types/debats.js +1 -0
  86. package/lib/src/types/dosleg.d.ts +70 -0
  87. package/lib/src/types/dosleg.js +1 -0
  88. package/lib/src/types/questions.d.ts +2 -0
  89. package/lib/src/types/questions.js +1 -0
  90. package/lib/src/types/sens.d.ts +8 -0
  91. package/lib/src/types/sens.js +1 -0
  92. package/lib/src/types/sessions.d.ts +6 -0
  93. package/lib/src/types/sessions.js +19 -0
  94. package/lib/src/types/texte.d.ts +72 -0
  95. package/lib/src/types/texte.js +15 -0
  96. package/lib/src/validators/config.d.ts +9 -0
  97. package/lib/src/validators/config.js +10 -0
  98. package/lib/src/videos/match.js +4 -4
  99. package/lib/tests/parsers/plf/amendement.test.d.ts +1 -0
  100. package/lib/tests/parsers/plf/amendement.test.js +153 -0
  101. package/lib/tests/parsers/plf/credits.test.js +72 -72
  102. package/lib/tests/parsers/plf/test_utils.js +13 -13
  103. package/lib/tests/parsers/texte.test_utils.js +22 -22
  104. package/package.json +123 -123
  105. package/lib/src/scripts/extract_plf_fixtures.d.ts +0 -1
  106. package/lib/src/scripts/extract_plf_fixtures.js +0 -101
  107. package/lib/tests/plf/credits.test.js +0 -458
  108. package/lib/tests/plf/test_utils.d.ts +0 -20
  109. package/lib/tests/plf/test_utils.js +0 -85
  110. /package/lib/{tests/plf/credits.test.d.ts → src/types/agenda.js} +0 -0
@@ -0,0 +1,2 @@
1
+ /* tslint:disable */
2
+ export {};
@@ -11,6 +11,14 @@ export interface AmendementAuteurRow {
11
11
  qualite: string | null;
12
12
  rang: string | null;
13
13
  }
14
+ export interface LigneCreditPlf {
15
+ autorisation_engagement: string | null;
16
+ credit_paiement: string | null;
17
+ libelle: string;
18
+ }
19
+ export interface ProgrammePlf extends LigneCreditPlf {
20
+ lignes_credits?: LigneCreditPlf[];
21
+ }
14
22
  export interface AmendementResult {
15
23
  accepte_gouvernement: string | null;
16
24
  alinea: number | null;
@@ -32,6 +40,9 @@ export interface AmendementResult {
32
40
  intitule_texte: string | null;
33
41
  lecture: string | null;
34
42
  motion_libelle: string | null;
43
+ mission_plf_id: number | null;
44
+ mission_plf_libelle: string | null;
45
+ mission_plf_libelle_court: string | null;
35
46
  nature: string;
36
47
  nature_texte: string | null;
37
48
  nature_texte_libelle: string | null;
@@ -44,6 +55,7 @@ export interface AmendementResult {
44
55
  observations_additionnelles: string | null;
45
56
  ordre: number | null;
46
57
  parent_id: number | null;
58
+ programmes_plf: ProgrammePlf[];
47
59
  revision: string | null;
48
60
  session: string;
49
61
  session_libelle: string;
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Debug script to check the DosLeg query compilation
4
+ * Helps identify the "column undefined" error
5
+ */
6
+ export {};
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Debug script to check the DosLeg query compilation
4
+ * Helps identify the "column undefined" error
5
+ */
6
+ import { db } from "../server/databases_postgres.js";
7
+ import { jsonArrayFrom } from "kysely/helpers/postgres";
8
+ import { sql } from "kysely";
9
+ async function debugDoslegQuery() {
10
+ console.log("=== Debugging DosLeg Query ===\n");
11
+ try {
12
+ // Build the same query as findAllDossiers but capture SQL
13
+ const query = db
14
+ .withSchema("senat")
15
+ .selectFrom("dosleg_loi as loi")
16
+ .leftJoin("dosleg_typloi as typloi", "typloi.typloicod", "loi.typloicod")
17
+ .leftJoin("dosleg_etaloi as etaloi", "etaloi.etaloicod", "loi.etaloicod")
18
+ .leftJoin("dosleg_deccoc as deccoc", "deccoc.deccoccod", "loi.deccoccod")
19
+ .select((eb) => [
20
+ sql `rtrim(${eb.ref("loi.loicod")})`.as("code"),
21
+ "loi.numero as numero",
22
+ "loi.signet as signet",
23
+ ]);
24
+ const compiled = query.compile();
25
+ console.log("✓ Query compiled successfully (basic columns)\n");
26
+ console.log("SQL:", compiled.sql);
27
+ console.log("\n");
28
+ // Try with simple lectures first
29
+ const queryWithLectures = db
30
+ .withSchema("senat")
31
+ .selectFrom("dosleg_loi as loi")
32
+ .select((eb) => [
33
+ "loi.signet as signet",
34
+ jsonArrayFrom(eb.withSchema("senat").selectFrom("dosleg_lecture as lecture").select(["lecture.lecidt as id"])).as("lectures"),
35
+ ]);
36
+ const compiledWithLectures = queryWithLectures.compile();
37
+ console.log("✓ Query with simple lectures compiled successfully\n");
38
+ console.log("SQL:", compiledWithLectures.sql);
39
+ console.log("\n");
40
+ console.log("✅ Basic query structures seem valid");
41
+ console.log("\nThe issue is likely in one of the nested subqueries with cross-references.");
42
+ console.log("Try running findAllDossiers with the verbose flag to see exactly where it fails.");
43
+ }
44
+ catch (error) {
45
+ console.error("❌ Error during query compilation:");
46
+ console.error(error instanceof Error ? error.message : String(error));
47
+ process.exit(1);
48
+ }
49
+ }
50
+ debugDoslegQuery().catch(console.error);
@@ -273,7 +273,8 @@ function ensureForeignStagingServer(dataDir, options, runtime) {
273
273
  "OPTIONS (",
274
274
  `host '${escapeSqlLiteral(runtime.staging.host)}', `,
275
275
  `dbname '${escapeSqlLiteral(runtime.staging.name)}', `,
276
- `port '${escapeSqlLiteral(String(runtime.staging.port))}'`,
276
+ `port '${escapeSqlLiteral(String(runtime.staging.port))}', `,
277
+ "fetch_size '10000'",
277
278
  ")",
278
279
  ].join(""),
279
280
  ].join(" "), dataDir, options, runtime.target);