@tricoteuses/senat 2.9.7 → 2.9.9

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT!
3
3
  *
4
- * This file was automatically generated by schemats v.2.8.1
4
+ * This file was automatically generated by schemats v.2.9.8
5
5
  * $ schemats generate -c postgres://username:password@localhost:5433/ameli -t amd -t amdsen -t avicom -t avigvt -t cab -t com_ameli -t ent -t etatxt -t fbu -t grppol_ameli -t gvt -t intora -t irr -t lec_ameli -t mot -t nat -t orarol -t sai -t saisen -t sea -t sen_ameli -t ses -t sor -t sub -t txt_ameli -t typrect -t typses -t typsub -t w_nivrec -s public
6
6
  *
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT!
3
3
  *
4
- * This file was automatically generated by schemats v.2.8.1
4
+ * This file was automatically generated by schemats v.2.9.8
5
5
  * $ schemats generate -c postgres://username:password@localhost:5433/debats -t debats -t intdivers -t intpjl -t lecassdeb -t secdis -t secdivers -t syndeb -t typsec -s public
6
6
  *
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT!
3
3
  *
4
- * This file was automatically generated by schemats v.2.8.1
4
+ * This file was automatically generated by schemats v.2.9.8
5
5
  * $ schemats generate -c postgres://username:password@localhost:5433/dosleg -t amescr -t ass -t aud -t auteur -t ble -t catrap -t corscr -t date_seance -t deccoc -t denrap -t doc -t docatt -t docsea -t ecr -t etaloi -t evtsea -t forpub -t gen -t lecass -t lecassrap -t lecture -t lnkrap -t loi -t loithe -t natloi -t org -t orgnomhis -t orippr -t oritxt -t posvot -t qua -t rap -t raporg -t rapthe -t rolsig -t scr -t ses -t stavot -t texte -t texte_ancien -t the -t titsen -t typatt -t typaut -t typdoc -t typevtsea -t typlec -t typloi -t typorg -t typrap -t typtxt -t typurl -t votsen -s public
6
6
  *
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT!
3
3
  *
4
- * This file was automatically generated by schemats v.2.8.1
4
+ * This file was automatically generated by schemats v.2.9.8
5
5
  * $ schemats generate -c postgres://username:password@localhost:5433/questions -t etatquestion -t legquestion -t naturequestion -t sortquestion -t tam_ministeres -t tam_questions -t tam_reponses -t the -s questions
6
6
  *
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT!
3
3
  *
4
- * This file was automatically generated by schemats v.2.8.1
4
+ * This file was automatically generated by schemats v.2.9.8
5
5
  * $ schemats generate -c postgres://username:password@localhost:5433/sens -t acr -t activite -t activite_audit -t activite_delegation -t activite_delegation_audit -t activite_loi -t activite_loi_audit -t activite_obligatoire -t activite_participant -t activite_participant_audit -t activite_senateur -t activite_senateur_audit -t activite_senateur_params -t activite_senateur_params_audit -t activites_liees -t activites_liees_audit -t actpro -t adhgrpsen -t adr -t adresse -t adrsen -t app -t assparint -t asster -t autgrpsen -t autorisation_profil -t autorisations -t avis_nomination_art13 -t basdes -t bur -t bur3r -t bur4r -t cad -t candid -t candidat -t candtodelete -t categorie_activite -t catpro -t catpro2e -t catterrit -t cible_categorie_periode -t cirdep -t com -t con -t cotgip -t csp -t cspfam -t databasechangelog -t databasechangeloglock -t delega -t derogation -t derogation_audit -t derogation_senateur -t derogation_senateur_audit -t design -t designoep -t designorg -t discou -t div -t dpt -t dpt_seuil_presence -t dptele -t dptele_files -t dptele_processing -t dptele_processing_type -t dpttypman -t droits_acces -t droits_acces_audit -t droits_type_derogation -t ele -t eleloc -t elucan -t eludep -t eludiv -t elueur -t elueur_apf -t elumet -t elureg -t elusen -t elusen2e -t elusen3r -t elusen4r -t elusencommu -t elusenpair -t eluter -t elutit -t eluvil -t etadebman -t etadebman3r -t etadebman4r -t etafinman -t etafinman3r -t etafinman4r -t etaprr -t etarpm -t etasen -t ext2e_bio -t ext2e_csp -t ext2e_mandats -t ext2e_minist -t extsencom_identite -t extsencom_mandat -t fonact_participant -t foncandid -t foncom -t fondelega -t fongrppol -t fongrpsen -t fonmemcom -t fonmemdelega -t fonmemextpar -t fonmemgrppol -t fonmemgrpsen -t fonmemorg -t fonorg -t grppol -t grppol4r -t grpsenami -t grpsenamiadh -t grpsenamiadhreq -t grpsenamiadhreqeta -t grpsenamiunadh -t grpsim -t gvt -t insee_pays2008 -t jhi_authority -t jhi_user -t jhi_user_authority -t lanetr -t libcom -t libdelega -t libgrppol -t libgrpsen -t liborg -t lisdptele -t mel -t memcom -t memcomsea -t memdelega -t memextpar -t memgrppol -t memgrpsen -t memorg -t met -t minind -t minist -t mis -t misetafin -t mismin -t misrapeta -t missen -t moddes -t mode_acces_elusenpair -t nation -t nationgrpsen -t nivlan -t org -t orgext -t orgextpres -t orgthe -t pairie_elusenpair -t parpol -t parpolglo -t participa -t pcs -t pcs24 -t pcs42 -t pcs8 -t pcscatpro -t per -t per_sen -t perapp -t periode_presence -t perpolglo -t perrol -t pj_justificatif -t pj_justificatif_audit -t plaind -t plan_table -t plsql_profiler_runs -t plsql_profiler_units -t poicon -t posvot -t presences_scrutin_surcharge -t presencesrevisionentity -t profil_applicatif -t qua -t rap_the -t reg -t reladr -t requetes_profil -t reslis -t resultat -t reu -t revchanges -t rne_mandat -t rne_mandat_diff -t rne_sen -t rne_sen_diff -t rne_type_mandat -t rol -t sal -t scr -t scrusoldelega -t sea -t sec -t sec2e -t secexe -t sen -t senbur -t senbur3r -t senbur4r -t sennom -t senpj -t sensim -t sentablenom -t senurl -t seuil_presence -t sirpas_elusen -t sirpas_fonmemcom -t sirpas_fonmemdelega -t sirpas_fonmemgrppol -t sirpas_memcom -t sirpas_memdelega -t sirpas_memgrppol -t sirpas_mvt -t sirpas_mvtcm -t sirpas_mvttri -t sirpas_sen -t sirpas_senbur -t sirpas_trf -t srv -t stajur -t stavot -t suspensiontravaux -t suspensiontravaux_audit -t sysage -t syscognos -t sysevt -t sysvar -t sysvar_sendev -t sysvar_senprod -t tapsenrevchanges -t tapsenrevisionentity -t telephone -t temval -t tenpol -t territ -t testoracle -t titele -t titelerne -t titmin -t titnob -t tmpsd -t toutes -t turelu -t typadr -t typapppol -t typbister -t typcandid -t type_activite -t type_activite_participant -t type_activite_rol -t type_activite_senateur -t type_categorie -t type_derogation -t type_droit_acces -t type_pj_justificatif -t type_rne_diff -t type_type_derogation -t typele -t typgrpsen -t typman -t typmin -t typmoddes -t typorg -t typorgext -t typparpol -t typpoicon -t typprs -t typprssta -t typscr -t typtel -t typurl -t typvoi -t uploaded_file -t uploaded_file_type -t validation -t validation_defview_profil -t validation_profil -t vercand -t verres -t votes -t zongeo -s public
6
6
  *
7
7
  */
@@ -3,8 +3,8 @@ import commandLineArgs from "command-line-args";
3
3
  import fs from "fs-extra";
4
4
  import path from "path";
5
5
  import { datasets, EnabledDatasets, getEnabledDatasets } from "../datasets";
6
- import { DATA_ORIGINAL_FOLDER, DOCUMENT_METADATA_FILE, DOSLEG_DOSSIERS_FOLDER, RAPPORT_FOLDER, SENS_CIRCONSCRIPTIONS_FOLDER, SENS_ORGANISMES_FOLDER, SENS_SENATEURS_FOLDER, TEXTE_FOLDER, } from "../loaders";
7
- import { findAllAmendements, findAllCirconscriptions, findAllDebats, findAllLois, findAllOrganismes, findAllQuestions, findAllSens, findAuteurs, findSenatRapportUrls, findSenatTexteUrls, } from "../model";
6
+ import { DATA_ORIGINAL_FOLDER, DOCUMENT_METADATA_FILE, DOSLEG_DOSSIERS_FOLDER, SCRUTINS_FOLDER, RAPPORT_FOLDER, SENS_CIRCONSCRIPTIONS_FOLDER, SENS_ORGANISMES_FOLDER, SENS_SENATEURS_FOLDER, TEXTE_FOLDER, } from "../loaders";
7
+ import { findAllAmendements, findAllCirconscriptions, findAllDebats, findAllDossiers, findAllScrutins, findAllOrganismes, findAllQuestions, findAllSens, findAuteurs, findSenatRapportUrls, findSenatTexteUrls, } from "../model";
8
8
  import { UNDEFINED_SESSION } from "../types/sessions";
9
9
  import { getSessionFromDate, getSessionFromSignet } from "./datautil";
10
10
  import { commonOptions } from "./shared/cli_helpers";
@@ -28,6 +28,7 @@ async function convertData() {
28
28
  }
29
29
  if (enabledDatasets & EnabledDatasets.DosLeg) {
30
30
  await convertDatasetDosLeg(dataDir);
31
+ await convertDatasetScrutins(dataDir);
31
32
  }
32
33
  if (enabledDatasets & EnabledDatasets.Questions) {
33
34
  await convertDatasetQuestions(dataDir);
@@ -105,22 +106,43 @@ async function convertDatasetDosLeg(dataDir) {
105
106
  const dossiersReorganizedDir = path.join(doslegReorganizedRootDir, DOSLEG_DOSSIERS_FOLDER);
106
107
  ensureAndClearDir(doslegReorganizedRootDir);
107
108
  ensureAndClearDir(dossiersReorganizedDir);
108
- for await (const loi of findAllLois()) {
109
+ for await (const loi of findAllDossiers()) {
109
110
  if (options["verbose"]) {
110
- console.log(`Converting ${loi.signet} file…`);
111
+ console.log(`Converting ${loi["signet"]} file…`);
111
112
  }
112
113
  let loiReorganizedDir = path.join(dossiersReorganizedDir, String(UNDEFINED_SESSION));
113
- const session = getSessionFromSignet(loi.signet) || UNDEFINED_SESSION;
114
+ const session = getSessionFromSignet(loi["signet"]) || UNDEFINED_SESSION;
114
115
  loiReorganizedDir = path.join(dossiersReorganizedDir, String(session));
115
116
  fs.ensureDirSync(loiReorganizedDir);
116
- const loiFileName = `${loi.signet}.json`;
117
- fs.writeJSONSync(path.join(loiReorganizedDir, loiFileName), loi, {
117
+ const scrutinFileName = `${loi["signet"]}.json`;
118
+ fs.writeJSONSync(path.join(loiReorganizedDir, scrutinFileName), loi, {
118
119
  spaces: 2,
119
120
  });
120
121
  }
121
122
  await convertTexteUrls(dataDir);
122
123
  await convertRapportUrls(dataDir);
123
124
  }
125
+ async function convertDatasetScrutins(dataDir) {
126
+ const dataset = datasets.dosleg;
127
+ if (!options["silent"]) {
128
+ console.log(`Converting database ${dataset.database} scrutins data into files…`);
129
+ }
130
+ const scrutinsReorganizedDir = path.join(dataDir, SCRUTINS_FOLDER);
131
+ ensureAndClearDir(scrutinsReorganizedDir);
132
+ for await (const scrutin of findAllScrutins()) {
133
+ if (options["verbose"]) {
134
+ console.log(`Converting ${scrutin.numero} file…`);
135
+ }
136
+ let scrutinReorganizedDir = path.join(scrutinsReorganizedDir, String(UNDEFINED_SESSION));
137
+ const session = scrutin.session || UNDEFINED_SESSION;
138
+ scrutinReorganizedDir = path.join(scrutinsReorganizedDir, String(session));
139
+ fs.ensureDirSync(scrutinReorganizedDir);
140
+ const scrutinFileName = `${scrutin.numero}.json`;
141
+ fs.writeJSONSync(path.join(scrutinReorganizedDir, scrutinFileName), scrutin, {
142
+ spaces: 2,
143
+ });
144
+ }
145
+ }
124
146
  async function convertDatasetQuestions(dataDir) {
125
147
  const dataset = datasets.questions;
126
148
  if (!options["silent"]) {
@@ -168,8 +168,7 @@ async function retrieveDataset(dataDir, dataset) {
168
168
  fs.writeFileSync(definitionFilePath, definitionRepaired);
169
169
  definitionsDir = path.resolve("src", "raw_types");
170
170
  definitionFilePath = path.join(definitionsDir, `${dataset.database}.ts`);
171
- execSync(`kysely-codegen --url ${dbConnectionString} --default-schema=${dataset.schema} --out-file=${definitionFilePath}`, {
172
- // cwd: dataDir,
171
+ execSync(`npx pg-to-ts generate -c '${dbConnectionString}' -s ${dataset.schema} -o ${definitionFilePath}`, {
173
172
  env: process.env,
174
173
  encoding: "utf-8",
175
174
  // stdio: ["ignore", "ignore", "pipe"],
package/package.json CHANGED
@@ -1,96 +1,97 @@
1
- {
2
- "name": "@tricoteuses/senat",
3
- "version": "2.9.7",
4
- "description": "Handle French Sénat's open data",
5
- "keywords": [
6
- "France",
7
- "open data",
8
- "Parliament",
9
- "Sénat"
10
- ],
11
- "author": "Emmanuel Raviart <emmanuel@raviart.com>",
12
- "bugs": {
13
- "url": "https://git.tricoteuses.fr/logiciels/tricoteuses-senat/issues"
14
- },
15
- "homepage": "https://tricoteuses.fr/",
16
- "license": "AGPL-3.0-or-later",
17
- "repository": {
18
- "type": "git",
19
- "url": "https://git.tricoteuses.fr/logiciels/tricoteuses-senat.git"
20
- },
21
- "type": "module",
22
- "engines": {
23
- "node": ">=22"
24
- },
25
- "files": [
26
- "lib"
27
- ],
28
- "exports": {
29
- ".": {
30
- "import": "./lib/index.js",
31
- "types": "./lib/index.d.ts"
32
- },
33
- "./loaders": {
34
- "import": "./lib/loaders.js",
35
- "types": "./lib/loaders.d.ts"
36
- },
37
- "./package.json": "./package.json"
38
- },
39
- "publishConfig": {
40
- "access": "public"
41
- },
42
- "scripts": {
43
- "build": "tsc",
44
- "build:types": "tsc --emitDeclarationOnly",
45
- "data:convert_data": "tsx src/scripts/convert_data.ts",
46
- "data:download": "tsx src/scripts/data-download.ts",
47
- "data:generate_schemas": "tsx src/scripts/retrieve_open_data.ts --schema",
48
- "data:retrieve_agenda": "cross-env TZ='Etc/UTC' tsx src/scripts/retrieve_agenda.ts",
49
- "data:retrieve_comptes_rendus": "tsx src/scripts/retrieve_comptes_rendus.ts",
50
- "data:retrieve_documents": "tsx src/scripts/retrieve_documents.ts",
51
- "data:retrieve_open_data": "tsx src/scripts/retrieve_open_data.ts --all",
52
- "data:retrieve_senateurs_photos": "tsx src/scripts/retrieve_senateurs_photos.ts --fetch",
53
- "data:retrieve_videos": "tsx src/scripts/retrieve_videos.ts",
54
- "data:parse_textes_lois": "tsx src/scripts/parse_textes.ts",
55
- "prepare": "npm run build",
56
- "prepublishOnly": "npm run build",
57
- "prettier": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
58
- "type-check": "tsc --noEmit",
59
- "type-check:watch": "npm run type-check -- --watch"
60
- },
61
- "dependencies": {
62
- "@biryani/core": "^0.2.1",
63
- "cheerio": "^1.1.2",
64
- "command-line-args": "^5.1.1",
65
- "dotenv": "^8.2.0",
66
- "fs-extra": "^9.1.0",
67
- "jsdom": "^26.0.0",
68
- "kysely": "^0.27.4",
69
- "luxon": "^3.5.0",
70
- "node-stream-zip": "^1.8.2",
71
- "pg": "^8.13.1",
72
- "pg-cursor": "^2.12.1",
73
- "slug": "^11.0.0",
74
- "tsx": "^4.19.4",
75
- "windows-1252": "^1.0.0"
76
- },
77
- "devDependencies": {
78
- "@typed-code/schemats": "^5.0.1",
79
- "@types/command-line-args": "^5.0.0",
80
- "@types/fs-extra": "^9.0.7",
81
- "@types/jsdom": "^21.1.7",
82
- "@types/luxon": "^3.4.2",
83
- "@types/node": "^20.17.6",
84
- "@types/pg": "^8.11.10",
85
- "@types/pg-cursor": "^2.7.2",
86
- "@types/slug": "^5.0.9",
87
- "@typescript-eslint/eslint-plugin": "^8.13.0",
88
- "@typescript-eslint/parser": "^8.13.0",
89
- "cross-env": "^10.0.0",
90
- "eslint": "^8.57.1",
91
- "kysely-codegen": "^0.18.0",
92
- "prettier": "^3.5.3",
93
- "tslib": "^2.1.0",
94
- "typescript": "^5.8.3"
95
- }
96
- }
1
+ {
2
+ "name": "@tricoteuses/senat",
3
+ "version": "2.9.9",
4
+ "description": "Handle French Sénat's open data",
5
+ "keywords": [
6
+ "France",
7
+ "open data",
8
+ "Parliament",
9
+ "Sénat"
10
+ ],
11
+ "author": "Emmanuel Raviart <emmanuel@raviart.com>",
12
+ "bugs": {
13
+ "url": "https://git.tricoteuses.fr/logiciels/tricoteuses-senat/issues"
14
+ },
15
+ "homepage": "https://tricoteuses.fr/",
16
+ "license": "AGPL-3.0-or-later",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://git.tricoteuses.fr/logiciels/tricoteuses-senat.git"
20
+ },
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=22"
24
+ },
25
+ "files": [
26
+ "lib"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "import": "./lib/index.js",
31
+ "types": "./lib/index.d.ts"
32
+ },
33
+ "./loaders": {
34
+ "import": "./lib/loaders.js",
35
+ "types": "./lib/loaders.d.ts"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "build:types": "tsc --emitDeclarationOnly",
45
+ "data:convert_data": "tsx src/scripts/convert_data.ts",
46
+ "data:download": "tsx src/scripts/data-download.ts",
47
+ "data:generate_schemas": "tsx src/scripts/retrieve_open_data.ts --schema",
48
+ "data:retrieve_agenda": "cross-env TZ='Etc/UTC' tsx src/scripts/retrieve_agenda.ts",
49
+ "data:retrieve_comptes_rendus": "tsx src/scripts/retrieve_comptes_rendus.ts",
50
+ "data:retrieve_documents": "tsx src/scripts/retrieve_documents.ts",
51
+ "data:retrieve_open_data": "tsx src/scripts/retrieve_open_data.ts --all",
52
+ "data:retrieve_senateurs_photos": "tsx src/scripts/retrieve_senateurs_photos.ts --fetch",
53
+ "data:retrieve_videos": "tsx src/scripts/retrieve_videos.ts",
54
+ "data:parse_textes_lois": "tsx src/scripts/parse_textes.ts",
55
+ "prepare": "npm run build",
56
+ "prepublishOnly": "npm run build",
57
+ "prettier": "prettier --write 'src/**/*.ts' 'tests/**/*.test.ts'",
58
+ "type-check": "tsc --noEmit",
59
+ "type-check:watch": "npm run type-check -- --watch"
60
+ },
61
+ "dependencies": {
62
+ "@biryani/core": "^0.2.1",
63
+ "cheerio": "^1.1.2",
64
+ "command-line-args": "^5.1.1",
65
+ "dotenv": "^8.2.0",
66
+ "fs-extra": "^9.1.0",
67
+ "jsdom": "^26.0.0",
68
+ "kysely": "^0.27.4",
69
+ "luxon": "^3.5.0",
70
+ "node-stream-zip": "^1.8.2",
71
+ "pg": "^8.13.1",
72
+ "pg-cursor": "^2.12.1",
73
+ "slug": "^11.0.0",
74
+ "tsx": "^4.19.4",
75
+ "windows-1252": "^1.0.0"
76
+ },
77
+ "devDependencies": {
78
+ "@typed-code/schemats": "^5.0.1",
79
+ "@types/cheerio": "^1.0.0",
80
+ "@types/command-line-args": "^5.0.0",
81
+ "@types/fs-extra": "^9.0.7",
82
+ "@types/jsdom": "^21.1.7",
83
+ "@types/luxon": "^3.4.2",
84
+ "@types/node": "^20.17.6",
85
+ "@types/pg": "^8.11.10",
86
+ "@types/pg-cursor": "^2.7.2",
87
+ "@types/slug": "^5.0.9",
88
+ "@typescript-eslint/eslint-plugin": "^8.13.0",
89
+ "@typescript-eslint/parser": "^8.13.0",
90
+ "cross-env": "^10.0.0",
91
+ "eslint": "^8.57.1",
92
+ "pg-to-ts": "^4.1.1",
93
+ "prettier": "^3.5.3",
94
+ "tslib": "^2.1.0",
95
+ "typescript": "^5.8.3"
96
+ }
97
+ }
File without changes
@@ -1,24 +0,0 @@
1
- "use strict";
2
- // import { validateNonEmptyTrimmedString } from "@biryani/core"
3
- // const acteurUidRegExp = /^PA\d+$/
4
- // const organeUidRegExp = /^PO\d+$/
5
- // export function validateSenateurUid(input: any): [any, any] {
6
- // const [value, error] = validateNonEmptyTrimmedString(input)
7
- // if (error !== null) {
8
- // return [value, error]
9
- // }
10
- // if (!acteurUidRegExp.test(value)) {
11
- // return [value, 'Invalid "acteur" unique ID']
12
- // }
13
- // return [value, null]
14
- // }
15
- // export function validateOrganeUid(input: any): [any, any] {
16
- // const [value, error] = validateNonEmptyTrimmedString(input)
17
- // if (error !== null) {
18
- // return [value, error]
19
- // }
20
- // if (!organeUidRegExp.test(value)) {
21
- // return [value, 'Invalid "organe" unique ID']
22
- // }
23
- // return [value, null]
24
- // }