@tricoteuses/assemblee 1.10.5 → 2.0.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.
- package/README.md +8 -1
- package/lib/amendements-CN7bRFdP.js +259 -0
- package/lib/amendements-CN7bRFdP.js.map +1 -0
- package/lib/amendements-Cg1lyCBp.js +735 -0
- package/lib/amendements-Cg1lyCBp.js.map +1 -0
- package/lib/api.d.ts +1 -0
- package/lib/api.d.ts.map +1 -0
- package/lib/cleaners/actes_legislatifs.d.ts +1 -0
- package/lib/cleaners/actes_legislatifs.d.ts.map +1 -0
- package/lib/cleaners/acteurs.d.ts +1 -0
- package/lib/cleaners/acteurs.d.ts.map +1 -0
- package/lib/cleaners/amendements.d.ts +1 -0
- package/lib/cleaners/amendements.d.ts.map +1 -0
- package/lib/cleaners/debats.d.ts +1 -0
- package/lib/cleaners/debats.d.ts.map +1 -0
- package/lib/cleaners/documents.d.ts +1 -0
- package/lib/cleaners/documents.d.ts.map +1 -0
- package/lib/cleaners/dossiers_legislatifs.d.ts +1 -0
- package/lib/cleaners/dossiers_legislatifs.d.ts.map +1 -0
- package/lib/cleaners/index.d.ts +10 -9
- package/lib/cleaners/index.d.ts.map +1 -0
- package/lib/cleaners/organes.d.ts +1 -0
- package/lib/cleaners/organes.d.ts.map +1 -0
- package/lib/cleaners/questions.d.ts +1 -0
- package/lib/cleaners/questions.d.ts.map +1 -0
- package/lib/cleaners/reunions.d.ts +1 -0
- package/lib/cleaners/reunions.d.ts.map +1 -0
- package/lib/cleaners/scrutins.d.ts +1 -0
- package/lib/cleaners/scrutins.d.ts.map +1 -0
- package/lib/cleaners/xml.d.ts +1 -0
- package/lib/cleaners/xml.d.ts.map +1 -0
- package/lib/cleaners.js +1138 -0
- package/lib/cleaners.js.map +1 -0
- package/lib/datasets.d.ts +4 -3
- package/lib/datasets.d.ts.map +1 -0
- package/lib/dates.d.ts +1 -0
- package/lib/dates.d.ts.map +1 -0
- package/lib/debats-BwZYgzXe.js +3978 -0
- package/lib/debats-BwZYgzXe.js.map +1 -0
- package/lib/dossiers_legislatifs.d.ts +3 -2
- package/lib/dossiers_legislatifs.d.ts.map +1 -0
- package/lib/file_systems.d.ts +1 -0
- package/lib/file_systems.d.ts.map +1 -0
- package/lib/git.d.ts +1 -0
- package/lib/git.d.ts.map +1 -0
- package/lib/index.d.ts +18 -22
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1916 -285
- package/lib/index.js.map +1 -0
- package/lib/inserters.d.ts +6 -5
- package/lib/inserters.d.ts.map +1 -0
- package/lib/loaders.d.ts +13 -12
- package/lib/loaders.d.ts.map +1 -0
- package/lib/loaders.js +812 -1516
- package/lib/loaders.js.map +1 -0
- package/lib/logger.d.ts +1 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/organes.d.ts +2 -1
- package/lib/organes.d.ts.map +1 -0
- package/lib/parse-CzW8NHW5.js +2850 -0
- package/lib/parse-CzW8NHW5.js.map +1 -0
- package/lib/parsers/index.d.ts +3 -3
- package/lib/parsers/index.d.ts.map +1 -0
- package/lib/parsers/plf.d.ts +2 -0
- package/lib/parsers/plf.d.ts.map +1 -0
- package/lib/parsers/recherche_amendements.d.ts +3 -2
- package/lib/parsers/recherche_amendements.d.ts.map +1 -0
- package/lib/parsers/textes_lois.d.ts +2 -23
- package/lib/parsers/textes_lois.d.ts.map +1 -0
- package/lib/parsers.js +393 -0
- package/lib/parsers.js.map +1 -0
- package/lib/raw_types/acteurs_et_organes.d.ts +1 -0
- package/lib/raw_types/acteurs_et_organes.d.ts.map +1 -0
- package/lib/raw_types/agendas.d.ts +1 -0
- package/lib/raw_types/agendas.d.ts.map +1 -0
- package/lib/raw_types/amendements.d.ts +1 -0
- package/lib/raw_types/amendements.d.ts.map +1 -0
- package/lib/raw_types/debats.d.ts +3 -2
- package/lib/raw_types/debats.d.ts.map +1 -0
- package/lib/raw_types/dossiers_legislatifs.d.ts +2 -1
- package/lib/raw_types/dossiers_legislatifs.d.ts.map +1 -0
- package/lib/raw_types/questions.d.ts +1 -0
- package/lib/raw_types/questions.d.ts.map +1 -0
- package/lib/raw_types/scrutins.d.ts +1 -0
- package/lib/raw_types/scrutins.d.ts.map +1 -0
- package/lib/schemas/acteurs_et_organes.d.json +982 -0
- package/lib/schemas/acteurs_et_organes.json +1166 -0
- package/lib/schemas/agendas.d.json +1561 -0
- package/lib/schemas/agendas.json +1745 -0
- package/lib/schemas/amendements.d.json +1901 -0
- package/lib/schemas/amendements.json +2085 -0
- package/lib/schemas/debats.d.json +623 -0
- package/lib/schemas/debats.json +842 -0
- package/lib/schemas/dossiers_legislatifs.d.json +3690 -0
- package/lib/schemas/dossiers_legislatifs.json +3874 -0
- package/lib/schemas/legislatures.d.json +17 -0
- package/lib/schemas/legislatures.json +17 -0
- package/lib/schemas/questions.d.json +520 -0
- package/lib/schemas/questions.json +704 -0
- package/lib/schemas/scrutins.d.json +517 -0
- package/lib/schemas/scrutins.json +701 -0
- package/lib/scripts/add_links_to_documents.d.ts +2 -0
- package/lib/scripts/add_links_to_documents.d.ts.map +1 -0
- package/lib/scripts/clean_reorganized_data.d.ts +1 -0
- package/lib/scripts/clean_reorganized_data.d.ts.map +1 -0
- package/lib/scripts/copy-schemas.d.ts +2 -0
- package/lib/scripts/copy-schemas.d.ts.map +1 -0
- package/lib/scripts/diff_amendements.d.ts +1 -0
- package/lib/scripts/diff_amendements.d.ts.map +1 -0
- package/lib/scripts/document_dossiers_legislatifs.d.ts +1 -0
- package/lib/scripts/document_dossiers_legislatifs.d.ts.map +1 -0
- package/lib/scripts/generate-json-schemas.d.ts +2 -0
- package/lib/scripts/generate-json-schemas.d.ts.map +1 -0
- package/lib/scripts/get_today_reunions.d.ts +1 -0
- package/lib/scripts/get_today_reunions.d.ts.map +1 -0
- package/lib/scripts/merge_scrutins.d.ts +1 -0
- package/lib/scripts/merge_scrutins.d.ts.map +1 -0
- package/lib/scripts/process_open_dataset.d.ts +1 -0
- package/lib/scripts/process_open_dataset.d.ts.map +1 -0
- package/lib/scripts/raw_types_from_amendements.d.ts +1 -0
- package/lib/scripts/raw_types_from_amendements.d.ts.map +1 -0
- package/lib/scripts/reorganize_data.d.ts +1 -0
- package/lib/scripts/reorganize_data.d.ts.map +1 -0
- package/lib/scripts/retrieve_deputes_photos.d.ts +2 -1
- package/lib/scripts/retrieve_deputes_photos.d.ts.map +1 -0
- package/lib/scripts/retrieve_documents.d.ts +1 -0
- package/lib/scripts/retrieve_documents.d.ts.map +1 -0
- package/lib/scripts/retrieve_open_data.d.ts +1 -0
- package/lib/scripts/retrieve_open_data.d.ts.map +1 -0
- package/lib/scripts/retrieve_pending_amendments.d.ts +1 -0
- package/lib/scripts/retrieve_pending_amendments.d.ts.map +1 -0
- package/lib/scripts/retrieve_senateurs_photos.d.ts +1 -0
- package/lib/scripts/retrieve_senateurs_photos.d.ts.map +1 -0
- package/lib/scripts/shared/cli_helpers.d.ts +1 -0
- package/lib/scripts/shared/cli_helpers.d.ts.map +1 -0
- package/lib/scripts/test_iter_load.d.ts +1 -0
- package/lib/scripts/test_iter_load.d.ts.map +1 -0
- package/lib/scripts/test_load.d.ts +1 -0
- package/lib/scripts/test_load.d.ts.map +1 -0
- package/lib/scripts/test_load_big_files.d.ts +1 -0
- package/lib/scripts/test_load_big_files.d.ts.map +1 -0
- package/lib/scripts/validate_json.d.ts +1 -0
- package/lib/scripts/validate_json.d.ts.map +1 -0
- package/lib/shared_types/codes_actes.d.ts +1 -0
- package/lib/shared_types/codes_actes.d.ts.map +1 -0
- package/lib/strings.d.ts +1 -0
- package/lib/strings.d.ts.map +1 -0
- package/lib/types/acteurs_et_organes.d.ts +341 -0
- package/lib/types/acteurs_et_organes.d.ts.map +1 -0
- package/lib/types/agendas.d.ts +237 -10
- package/lib/types/agendas.d.ts.map +1 -0
- package/lib/types/amendements.d.ts +277 -1
- package/lib/types/amendements.d.ts.map +1 -0
- package/lib/types/debats.d.ts +53 -2
- package/lib/types/debats.d.ts.map +1 -0
- package/lib/types/dossiers_legislatifs.d.ts +404 -9
- package/lib/types/dossiers_legislatifs.d.ts.map +1 -0
- package/lib/types/legislatures.d.ts +1 -0
- package/lib/types/legislatures.d.ts.map +1 -0
- package/lib/types/questions.d.ts +100 -2
- package/lib/types/questions.d.ts.map +1 -0
- package/lib/types/scrutins.d.ts +102 -0
- package/lib/types/scrutins.d.ts.map +1 -0
- package/lib/urls.d.ts +3 -2
- package/lib/urls.d.ts.map +1 -0
- package/package.json +31 -95
- package/lib/api.js +0 -52
- package/lib/api.mjs +0 -45
- package/lib/bugs/acteur-00010/plugin.test.d.ts +0 -1
- package/lib/bugs/acteur-00010/plugin.test.js +0 -90
- package/lib/bugs/acteur-00010/plugin.test.mjs +0 -33
- package/lib/bugs/acteur-00010.d.ts +0 -7
- package/lib/bugs/acteur-00010.js +0 -116
- package/lib/bugs/acteur-00010.mjs +0 -26
- package/lib/bugs/agenda-00002/plugin.test.d.ts +0 -1
- package/lib/bugs/agenda-00002/plugin.test.js +0 -124
- package/lib/bugs/agenda-00002/plugin.test.mjs +0 -50
- package/lib/bugs/agenda-00002.d.ts +0 -15
- package/lib/bugs/agenda-00002.js +0 -406
- package/lib/bugs/agenda-00002.mjs +0 -172
- package/lib/bugs/agenda-00008/plugin.test.d.ts +0 -1
- package/lib/bugs/agenda-00008/plugin.test.js +0 -92
- package/lib/bugs/agenda-00008/plugin.test.mjs +0 -31
- package/lib/bugs/agenda-00008.d.ts +0 -7
- package/lib/bugs/agenda-00008.js +0 -123
- package/lib/bugs/agenda-00008.mjs +0 -26
- package/lib/bugs/agenda-00011/plugin.test.d.ts +0 -1
- package/lib/bugs/agenda-00011/plugin.test.js +0 -263
- package/lib/bugs/agenda-00011/plugin.test.mjs +0 -152
- package/lib/bugs/agenda-00011.d.ts +0 -16
- package/lib/bugs/agenda-00011.js +0 -333
- package/lib/bugs/agenda-00011.mjs +0 -125
- package/lib/bugs.d.ts +0 -21
- package/lib/bugs.js +0 -452
- package/lib/bugs.mjs +0 -70
- package/lib/cleaners/actes_legislatifs.js +0 -315
- package/lib/cleaners/actes_legislatifs.mjs +0 -253
- package/lib/cleaners/acteurs.js +0 -265
- package/lib/cleaners/acteurs.mjs +0 -180
- package/lib/cleaners/amendements.js +0 -294
- package/lib/cleaners/amendements.mjs +0 -227
- package/lib/cleaners/debats.js +0 -12
- package/lib/cleaners/debats.mjs +0 -5
- package/lib/cleaners/documents.js +0 -205
- package/lib/cleaners/documents.mjs +0 -133
- package/lib/cleaners/dossiers_legislatifs.js +0 -131
- package/lib/cleaners/dossiers_legislatifs.mjs +0 -70
- package/lib/cleaners/index.js +0 -70
- package/lib/cleaners/index.mjs +0 -10
- package/lib/cleaners/organes.js +0 -65
- package/lib/cleaners/organes.mjs +0 -48
- package/lib/cleaners/questions.js +0 -12
- package/lib/cleaners/questions.mjs +0 -5
- package/lib/cleaners/reunions.js +0 -312
- package/lib/cleaners/reunions.mjs +0 -255
- package/lib/cleaners/scrutins.js +0 -340
- package/lib/cleaners/scrutins.mjs +0 -221
- package/lib/cleaners/xml.js +0 -74
- package/lib/cleaners/xml.mjs +0 -59
- package/lib/datasets.js +0 -837
- package/lib/datasets.mjs +0 -755
- package/lib/dates.js +0 -124
- package/lib/dates.mjs +0 -100
- package/lib/dossiers_legislatifs.js +0 -346
- package/lib/dossiers_legislatifs.mjs +0 -208
- package/lib/file_systems.js +0 -162
- package/lib/file_systems.mjs +0 -62
- package/lib/git.js +0 -223
- package/lib/git.mjs +0 -151
- package/lib/index.mjs +0 -17
- package/lib/inserters.js +0 -521
- package/lib/inserters.mjs +0 -337
- package/lib/loaders.mjs +0 -886
- package/lib/logger.js +0 -35
- package/lib/logger.mjs +0 -26
- package/lib/organes.js +0 -22
- package/lib/organes.mjs +0 -15
- package/lib/parsers/documents.d.ts +0 -62
- package/lib/parsers/documents.js +0 -453
- package/lib/parsers/documents.mjs +0 -370
- package/lib/parsers/index.js +0 -40
- package/lib/parsers/index.mjs +0 -4
- package/lib/parsers/recherche_amendements.js +0 -403
- package/lib/parsers/recherche_amendements.mjs +0 -167
- package/lib/parsers/textes_lois.js +0 -307
- package/lib/parsers/textes_lois.mjs +0 -264
- package/lib/raw_types/acteurs_et_organes.js +0 -1215
- package/lib/raw_types/acteurs_et_organes.mjs +0 -1148
- package/lib/raw_types/agendas.js +0 -777
- package/lib/raw_types/agendas.mjs +0 -724
- package/lib/raw_types/amendements.js +0 -1052
- package/lib/raw_types/amendements.mjs +0 -993
- package/lib/raw_types/debats.js +0 -630
- package/lib/raw_types/debats.mjs +0 -573
- package/lib/raw_types/dossiers_legislatifs.js +0 -1529
- package/lib/raw_types/dossiers_legislatifs.mjs +0 -1471
- package/lib/raw_types/questions.js +0 -469
- package/lib/raw_types/questions.mjs +0 -416
- package/lib/raw_types/scrutins.js +0 -651
- package/lib/raw_types/scrutins.mjs +0 -598
- package/lib/schemas/acteur/Acteur.json +0 -56
- package/lib/schemas/acteur/AdresseElectronique.json +0 -52
- package/lib/schemas/acteur/AdressePostale.json +0 -75
- package/lib/schemas/acteur/Civ.json +0 -14
- package/lib/schemas/acteur/Collaborateur.json +0 -29
- package/lib/schemas/acteur/EtatCivil.json +0 -51
- package/lib/schemas/acteur/Ident.json +0 -40
- package/lib/schemas/acteur/Lieu.json +0 -66
- package/lib/schemas/acteur/Mandat.json +0 -192
- package/lib/schemas/acteur/Profession.json +0 -46
- package/lib/schemas/agenda/Agenda.json +0 -318
- package/lib/schemas/agenda/CycleDeVie.json +0 -45
- package/lib/schemas/agenda/PointOdj.json +0 -82
- package/lib/schemas/amendement/Amendement.json +0 -246
- package/lib/schemas/amendement/Diff.json +0 -25
- package/lib/schemas/amendement/DispositifAmdtCredit.json +0 -85
- package/lib/schemas/amendement/Identifiant.json +0 -62
- package/lib/schemas/amendement/PointeurFragmentTexte.json +0 -127
- package/lib/schemas/amendement/Representation.json +0 -67
- package/lib/schemas/amendement/Total.json +0 -26
- package/lib/schemas/converted_from_type/acteurs_et_organes.json +0 -666
- package/lib/schemas/converted_from_type/agendas.json +0 -1100
- package/lib/schemas/converted_from_type/amendements.json +0 -3191
- package/lib/schemas/converted_from_type/debats.json +0 -682
- package/lib/schemas/converted_from_type/deputes.json +0 -26
- package/lib/schemas/converted_from_type/dossiers_legislatifs.json +0 -2918
- package/lib/schemas/converted_from_type/legislatures.json +0 -16
- package/lib/schemas/converted_from_type/questions.json +0 -328
- package/lib/schemas/converted_from_type/scrutins.json +0 -393
- package/lib/schemas/debat/Contenu.json +0 -75
- package/lib/schemas/debat/Debat.json +0 -40
- package/lib/schemas/debat/Metadonnees.json +0 -75
- package/lib/schemas/debat/Orateur.json +0 -60
- package/lib/schemas/debat/Point.json +0 -169
- package/lib/schemas/debat/Sommaire.json +0 -71
- package/lib/schemas/debat/SommaireElement.json +0 -108
- package/lib/schemas/debat/Texte.json +0 -34
- package/lib/schemas/document/CodeLibelle.json +0 -25
- package/lib/schemas/document/Document.json +0 -385
- package/lib/schemas/document/Indexation.json +0 -38
- package/lib/schemas/dossier/ActeLegislatif.json +0 -211
- package/lib/schemas/dossier/ActeLegislatifBase.json +0 -62
- package/lib/schemas/dossier/Agenda.json +0 -23
- package/lib/schemas/dossier/ConseilConstitutionnel.json +0 -35
- package/lib/schemas/dossier/Decision.json +0 -25
- package/lib/schemas/dossier/Dossier.json +0 -124
- package/lib/schemas/dossier/EtudeImpact.json +0 -29
- package/lib/schemas/dossier/EtudePlf.json +0 -105
- package/lib/schemas/dossier/Europe.json +0 -42
- package/lib/schemas/dossier/FamCodeLibelle.json +0 -25
- package/lib/schemas/dossier/InfoJO.json +0 -23
- package/lib/schemas/dossier/Initiateur.json +0 -36
- package/lib/schemas/dossier/Motion.json +0 -27
- package/lib/schemas/dossier/Promulgation.json +0 -62
- package/lib/schemas/dossier/Rapporteur.json +0 -36
- package/lib/schemas/dossier/Texte.json +0 -47
- package/lib/schemas/organe/CodeTypeOrgane.json +0 -43
- package/lib/schemas/organe/Organe.json +0 -136
- package/lib/schemas/organe/ViMoDe.json +0 -28
- package/lib/schemas/question/Auteur.json +0 -58
- package/lib/schemas/question/Cloture.json +0 -28
- package/lib/schemas/question/InfoJO.json +0 -40
- package/lib/schemas/question/MinAttribElement.json +0 -30
- package/lib/schemas/question/Question.json +0 -172
- package/lib/schemas/question/Renouvellement.json +0 -17
- package/lib/schemas/question/Signalement.json +0 -21
- package/lib/schemas/question/Texte.json +0 -24
- package/lib/schemas/scrutin/DecompteVoix.json +0 -35
- package/lib/schemas/scrutin/Dysfonctionnement.json +0 -50
- package/lib/schemas/scrutin/MiseAuPoint.json +0 -53
- package/lib/schemas/scrutin/OrganeVotant.json +0 -88
- package/lib/schemas/scrutin/Scrutin.json +0 -187
- package/lib/schemas/scrutin/Votant.json +0 -37
- package/lib/scripts/bugs_helper.d.ts +0 -13
- package/lib/scripts/bugs_helper.js +0 -595
- package/lib/scripts/bugs_helper.mjs +0 -251
- package/lib/scripts/clean_reorganized_data.js +0 -613
- package/lib/scripts/clean_reorganized_data.mjs +0 -276
- package/lib/scripts/diff_amendements.js +0 -249
- package/lib/scripts/diff_amendements.mjs +0 -202
- package/lib/scripts/document_dossiers_legislatifs.js +0 -655
- package/lib/scripts/document_dossiers_legislatifs.mjs +0 -414
- package/lib/scripts/get_today_reunions.js +0 -37
- package/lib/scripts/get_today_reunions.mjs +0 -31
- package/lib/scripts/merge_scrutins.js +0 -97
- package/lib/scripts/merge_scrutins.mjs +0 -47
- package/lib/scripts/parse_textes_lois.d.ts +0 -1
- package/lib/scripts/parse_textes_lois.js +0 -171
- package/lib/scripts/parse_textes_lois.mjs +0 -140
- package/lib/scripts/process_open_dataset.js +0 -301
- package/lib/scripts/process_open_dataset.mjs +0 -134
- package/lib/scripts/raw_types_from_amendements.js +0 -135
- package/lib/scripts/raw_types_from_amendements.mjs +0 -134
- package/lib/scripts/reorganize_data.js +0 -805
- package/lib/scripts/reorganize_data.mjs +0 -517
- package/lib/scripts/retrieve_deputes_photos.js +0 -310
- package/lib/scripts/retrieve_deputes_photos.mjs +0 -158
- package/lib/scripts/retrieve_documents.js +0 -547
- package/lib/scripts/retrieve_documents.mjs +0 -242
- package/lib/scripts/retrieve_open_data.js +0 -107
- package/lib/scripts/retrieve_open_data.mjs +0 -26
- package/lib/scripts/retrieve_pending_amendments.js +0 -206
- package/lib/scripts/retrieve_pending_amendments.mjs +0 -57
- package/lib/scripts/retrieve_senateurs_photos.js +0 -234
- package/lib/scripts/retrieve_senateurs_photos.mjs +0 -116
- package/lib/scripts/retrieve_textes_lois.d.ts +0 -1
- package/lib/scripts/retrieve_textes_lois.js +0 -240
- package/lib/scripts/retrieve_textes_lois.mjs +0 -85
- package/lib/scripts/shared/cli_helpers.js +0 -89
- package/lib/scripts/shared/cli_helpers.mjs +0 -81
- package/lib/scripts/test_iter_load.js +0 -155
- package/lib/scripts/test_iter_load.mjs +0 -72
- package/lib/scripts/test_load.js +0 -26
- package/lib/scripts/test_load.mjs +0 -16
- package/lib/scripts/test_load_big_files.js +0 -26
- package/lib/scripts/test_load_big_files.mjs +0 -16
- package/lib/scripts/validate_json.js +0 -353
- package/lib/scripts/validate_json.mjs +0 -184
- package/lib/shared_types/codes_actes.js +0 -231
- package/lib/shared_types/codes_actes.mjs +0 -224
- package/lib/strings.js +0 -16
- package/lib/strings.mjs +0 -7
- package/lib/types/acteurs_et_organes.js +0 -965
- package/lib/types/acteurs_et_organes.mjs +0 -906
- package/lib/types/agendas.js +0 -628
- package/lib/types/agendas.mjs +0 -575
- package/lib/types/amendements.js +0 -899
- package/lib/types/amendements.mjs +0 -842
- package/lib/types/debats.js +0 -619
- package/lib/types/debats.mjs +0 -562
- package/lib/types/dossiers_legislatifs.js +0 -1188
- package/lib/types/dossiers_legislatifs.mjs +0 -1130
- package/lib/types/legislatures.js +0 -17
- package/lib/types/legislatures.mjs +0 -10
- package/lib/types/questions.js +0 -454
- package/lib/types/questions.mjs +0 -401
- package/lib/types/scrutins.js +0 -556
- package/lib/types/scrutins.mjs +0 -503
- package/lib/urls.js +0 -325
- package/lib/urls.mjs +0 -258
package/lib/index.js
CHANGED
|
@@ -1,339 +1,1970 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { c as constructFrom, t as toDate, g as getTimezoneOffsetInMilliseconds, m as millisecondsInDay, a as addLeadingZeros, b as getISOWeek, d as getWeek, e as getISOWeekYear, f as getWeekYear, h as getDefaultOptions, i as enUS, l as longFormatters, j as isProtectedWeekYearToken, k as isProtectedDayOfYearToken, w as warnOrThrowProtectedError, n as millisecondsInHour, o as millisecondsInMinute, p as parse, q as fr } from "./parse-CzW8NHW5.js";
|
|
2
|
+
import { C as CodeTypeOrgane } from "./debats-BwZYgzXe.js";
|
|
3
|
+
import { a, E, L, d, e, T, b, c } from "./debats-BwZYgzXe.js";
|
|
4
|
+
import assert from "node:assert";
|
|
5
|
+
import fs from "fs-extra";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import "glob";
|
|
8
|
+
import { C, A, E as E2, S, T as T2 } from "./amendements-Cg1lyCBp.js";
|
|
9
|
+
var Facet;
|
|
10
|
+
(function(Facet2) {
|
|
11
|
+
Facet2["Amendements"] = "amendements";
|
|
12
|
+
})(Facet || (Facet = {}));
|
|
13
|
+
const allFacets = Object.values(Facet);
|
|
14
|
+
var Follow;
|
|
15
|
+
(function(Follow2) {
|
|
16
|
+
Follow2["Acte_organe"] = "acte.organe";
|
|
17
|
+
Follow2["Acte_provenance"] = "acte.provenance";
|
|
18
|
+
Follow2["Acte_rapporteurs_acteur"] = "acte.rapporteurs.acteur";
|
|
19
|
+
Follow2["Acte_reunion"] = "acte.reunion";
|
|
20
|
+
Follow2["Acte_texteAdopte"] = "acte.texteAdopte";
|
|
21
|
+
Follow2["Acte_texteAssocie"] = "acte.texteAssocie";
|
|
22
|
+
Follow2["Acte_textesAssocies_texteAssocie"] = "acte.textesAssocies.texteAssocie";
|
|
23
|
+
Follow2["Acte_votes"] = "acte.votes";
|
|
24
|
+
Follow2["Acteur_mandats_organes"] = "acteur.mandats.organes";
|
|
25
|
+
Follow2["Amendement_signataires_auteur_acteur"] = "amendement.signataires.auteur.acteur";
|
|
26
|
+
Follow2["Amendement_signataires_auteur_auteurRapporteurOrgane"] = "amendement.signataires.auteur.auteurRapporteurOrgane";
|
|
27
|
+
Follow2["Amendement_signataires_auteur_gouvernement"] = "amendement.signataires.auteur.gouvernement";
|
|
28
|
+
Follow2["Amendement_signataires_auteur_groupePolitique"] = "amendement.signataires.auteur.groupePolitique";
|
|
29
|
+
Follow2["Amendement_signataires_cosignataires"] = "amendement.signataires.cosignataires";
|
|
30
|
+
Follow2["Amendement_texteLegislatif"] = "amendement.texteLegislatif";
|
|
31
|
+
Follow2["Document_auteurs_acteur_acteur"] = "document.auteurs.acteur.acteur";
|
|
32
|
+
Follow2["Document_auteurs_organe"] = "document.auteurs.organe";
|
|
33
|
+
Follow2["Document_dossier"] = "document.dossier";
|
|
34
|
+
Follow2["Dossier_initiateur_acteurs_acteur"] = "dossier.initiateur.acteurs.acteur";
|
|
35
|
+
Follow2["Dossier_initiateur_organe"] = "dossier.initiateur.organe";
|
|
36
|
+
Follow2["Organe_organeParent"] = "organe.organeParent";
|
|
37
|
+
Follow2["Organe_organePrecedent"] = "organe.organePrecedent";
|
|
38
|
+
Follow2["Reunion_demandeurs_acteurs_acteur"] = "reunion.demandeurs.acteurs.acteur";
|
|
39
|
+
Follow2["Reunion_demandeurs_organe_organe"] = "reunion.demandeurs.organe.organe";
|
|
40
|
+
Follow2["Reunion_organeReuni"] = "reunion.organeReuni";
|
|
41
|
+
Follow2["Reunion_participants_participantsInternes_acteur"] = "reunion.participants.participantsInternes.acteur";
|
|
42
|
+
Follow2["Scrutin_miseAuPoint"] = "scrutin.miseAuPoint";
|
|
43
|
+
Follow2["Scrutin_organe"] = "scrutin.organe";
|
|
44
|
+
Follow2["Scrutin_ventilationVotes_groupes_organe"] = "scrutin.ventilationVotes.groupes.organe";
|
|
45
|
+
})(Follow || (Follow = {}));
|
|
46
|
+
const allFollows = Object.values(Follow);
|
|
47
|
+
function normalizeDates(context, ...dates) {
|
|
48
|
+
const normalize = constructFrom.bind(
|
|
49
|
+
null,
|
|
50
|
+
dates.find((date) => typeof date === "object")
|
|
51
|
+
);
|
|
52
|
+
return dates.map(normalize);
|
|
53
|
+
}
|
|
54
|
+
function startOfDay(date, options) {
|
|
55
|
+
const _date = toDate(date, options?.in);
|
|
56
|
+
_date.setHours(0, 0, 0, 0);
|
|
57
|
+
return _date;
|
|
58
|
+
}
|
|
59
|
+
function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
60
|
+
const [laterDate_, earlierDate_] = normalizeDates(
|
|
61
|
+
options?.in,
|
|
62
|
+
laterDate,
|
|
63
|
+
earlierDate
|
|
64
|
+
);
|
|
65
|
+
const laterStartOfDay = startOfDay(laterDate_);
|
|
66
|
+
const earlierStartOfDay = startOfDay(earlierDate_);
|
|
67
|
+
const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
|
|
68
|
+
const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
|
69
|
+
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
70
|
+
}
|
|
71
|
+
function startOfYear(date, options) {
|
|
72
|
+
const date_ = toDate(date, options?.in);
|
|
73
|
+
date_.setFullYear(date_.getFullYear(), 0, 1);
|
|
74
|
+
date_.setHours(0, 0, 0, 0);
|
|
75
|
+
return date_;
|
|
76
|
+
}
|
|
77
|
+
function getDayOfYear(date, options) {
|
|
78
|
+
const _date = toDate(date, options?.in);
|
|
79
|
+
const diff = differenceInCalendarDays(_date, startOfYear(_date));
|
|
80
|
+
const dayOfYear = diff + 1;
|
|
81
|
+
return dayOfYear;
|
|
82
|
+
}
|
|
83
|
+
const lightFormatters = {
|
|
84
|
+
// Year
|
|
85
|
+
y(date, token) {
|
|
86
|
+
const signedYear = date.getFullYear();
|
|
87
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
88
|
+
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
89
|
+
},
|
|
90
|
+
// Month
|
|
91
|
+
M(date, token) {
|
|
92
|
+
const month = date.getMonth();
|
|
93
|
+
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
94
|
+
},
|
|
95
|
+
// Day of the month
|
|
96
|
+
d(date, token) {
|
|
97
|
+
return addLeadingZeros(date.getDate(), token.length);
|
|
98
|
+
},
|
|
99
|
+
// AM or PM
|
|
100
|
+
a(date, token) {
|
|
101
|
+
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
102
|
+
switch (token) {
|
|
103
|
+
case "a":
|
|
104
|
+
case "aa":
|
|
105
|
+
return dayPeriodEnumValue.toUpperCase();
|
|
106
|
+
case "aaa":
|
|
107
|
+
return dayPeriodEnumValue;
|
|
108
|
+
case "aaaaa":
|
|
109
|
+
return dayPeriodEnumValue[0];
|
|
110
|
+
case "aaaa":
|
|
111
|
+
default:
|
|
112
|
+
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
// Hour [1-12]
|
|
116
|
+
h(date, token) {
|
|
117
|
+
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
118
|
+
},
|
|
119
|
+
// Hour [0-23]
|
|
120
|
+
H(date, token) {
|
|
121
|
+
return addLeadingZeros(date.getHours(), token.length);
|
|
122
|
+
},
|
|
123
|
+
// Minute
|
|
124
|
+
m(date, token) {
|
|
125
|
+
return addLeadingZeros(date.getMinutes(), token.length);
|
|
126
|
+
},
|
|
127
|
+
// Second
|
|
128
|
+
s(date, token) {
|
|
129
|
+
return addLeadingZeros(date.getSeconds(), token.length);
|
|
130
|
+
},
|
|
131
|
+
// Fraction of second
|
|
132
|
+
S(date, token) {
|
|
133
|
+
const numberOfDigits = token.length;
|
|
134
|
+
const milliseconds = date.getMilliseconds();
|
|
135
|
+
const fractionalSeconds = Math.trunc(
|
|
136
|
+
milliseconds * Math.pow(10, numberOfDigits - 3)
|
|
137
|
+
);
|
|
138
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
|
11
139
|
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
140
|
+
};
|
|
141
|
+
const dayPeriodEnum = {
|
|
142
|
+
midnight: "midnight",
|
|
143
|
+
noon: "noon",
|
|
144
|
+
morning: "morning",
|
|
145
|
+
afternoon: "afternoon",
|
|
146
|
+
evening: "evening",
|
|
147
|
+
night: "night"
|
|
148
|
+
};
|
|
149
|
+
const formatters = {
|
|
150
|
+
// Era
|
|
151
|
+
G: function(date, token, localize) {
|
|
152
|
+
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
153
|
+
switch (token) {
|
|
154
|
+
// AD, BC
|
|
155
|
+
case "G":
|
|
156
|
+
case "GG":
|
|
157
|
+
case "GGG":
|
|
158
|
+
return localize.era(era, { width: "abbreviated" });
|
|
159
|
+
// A, B
|
|
160
|
+
case "GGGGG":
|
|
161
|
+
return localize.era(era, { width: "narrow" });
|
|
162
|
+
// Anno Domini, Before Christ
|
|
163
|
+
case "GGGG":
|
|
164
|
+
default:
|
|
165
|
+
return localize.era(era, { width: "wide" });
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
// Year
|
|
169
|
+
y: function(date, token, localize) {
|
|
170
|
+
if (token === "yo") {
|
|
171
|
+
const signedYear = date.getFullYear();
|
|
172
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
173
|
+
return localize.ordinalNumber(year, { unit: "year" });
|
|
174
|
+
}
|
|
175
|
+
return lightFormatters.y(date, token);
|
|
176
|
+
},
|
|
177
|
+
// Local week-numbering year
|
|
178
|
+
Y: function(date, token, localize, options) {
|
|
179
|
+
const signedWeekYear = getWeekYear(date, options);
|
|
180
|
+
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
181
|
+
if (token === "YY") {
|
|
182
|
+
const twoDigitYear = weekYear % 100;
|
|
183
|
+
return addLeadingZeros(twoDigitYear, 2);
|
|
184
|
+
}
|
|
185
|
+
if (token === "Yo") {
|
|
186
|
+
return localize.ordinalNumber(weekYear, { unit: "year" });
|
|
187
|
+
}
|
|
188
|
+
return addLeadingZeros(weekYear, token.length);
|
|
189
|
+
},
|
|
190
|
+
// ISO week-numbering year
|
|
191
|
+
R: function(date, token) {
|
|
192
|
+
const isoWeekYear = getISOWeekYear(date);
|
|
193
|
+
return addLeadingZeros(isoWeekYear, token.length);
|
|
194
|
+
},
|
|
195
|
+
// Extended year. This is a single number designating the year of this calendar system.
|
|
196
|
+
// The main difference between `y` and `u` localizers are B.C. years:
|
|
197
|
+
// | Year | `y` | `u` |
|
|
198
|
+
// |------|-----|-----|
|
|
199
|
+
// | AC 1 | 1 | 1 |
|
|
200
|
+
// | BC 1 | 1 | 0 |
|
|
201
|
+
// | BC 2 | 2 | -1 |
|
|
202
|
+
// Also `yy` always returns the last two digits of a year,
|
|
203
|
+
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
204
|
+
u: function(date, token) {
|
|
205
|
+
const year = date.getFullYear();
|
|
206
|
+
return addLeadingZeros(year, token.length);
|
|
207
|
+
},
|
|
208
|
+
// Quarter
|
|
209
|
+
Q: function(date, token, localize) {
|
|
210
|
+
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
211
|
+
switch (token) {
|
|
212
|
+
// 1, 2, 3, 4
|
|
213
|
+
case "Q":
|
|
214
|
+
return String(quarter);
|
|
215
|
+
// 01, 02, 03, 04
|
|
216
|
+
case "QQ":
|
|
217
|
+
return addLeadingZeros(quarter, 2);
|
|
218
|
+
// 1st, 2nd, 3rd, 4th
|
|
219
|
+
case "Qo":
|
|
220
|
+
return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
221
|
+
// Q1, Q2, Q3, Q4
|
|
222
|
+
case "QQQ":
|
|
223
|
+
return localize.quarter(quarter, {
|
|
224
|
+
width: "abbreviated",
|
|
225
|
+
context: "formatting"
|
|
226
|
+
});
|
|
227
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
228
|
+
case "QQQQQ":
|
|
229
|
+
return localize.quarter(quarter, {
|
|
230
|
+
width: "narrow",
|
|
231
|
+
context: "formatting"
|
|
232
|
+
});
|
|
233
|
+
// 1st quarter, 2nd quarter, ...
|
|
234
|
+
case "QQQQ":
|
|
235
|
+
default:
|
|
236
|
+
return localize.quarter(quarter, {
|
|
237
|
+
width: "wide",
|
|
238
|
+
context: "formatting"
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
// Stand-alone quarter
|
|
243
|
+
q: function(date, token, localize) {
|
|
244
|
+
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
245
|
+
switch (token) {
|
|
246
|
+
// 1, 2, 3, 4
|
|
247
|
+
case "q":
|
|
248
|
+
return String(quarter);
|
|
249
|
+
// 01, 02, 03, 04
|
|
250
|
+
case "qq":
|
|
251
|
+
return addLeadingZeros(quarter, 2);
|
|
252
|
+
// 1st, 2nd, 3rd, 4th
|
|
253
|
+
case "qo":
|
|
254
|
+
return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
255
|
+
// Q1, Q2, Q3, Q4
|
|
256
|
+
case "qqq":
|
|
257
|
+
return localize.quarter(quarter, {
|
|
258
|
+
width: "abbreviated",
|
|
259
|
+
context: "standalone"
|
|
260
|
+
});
|
|
261
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
262
|
+
case "qqqqq":
|
|
263
|
+
return localize.quarter(quarter, {
|
|
264
|
+
width: "narrow",
|
|
265
|
+
context: "standalone"
|
|
266
|
+
});
|
|
267
|
+
// 1st quarter, 2nd quarter, ...
|
|
268
|
+
case "qqqq":
|
|
269
|
+
default:
|
|
270
|
+
return localize.quarter(quarter, {
|
|
271
|
+
width: "wide",
|
|
272
|
+
context: "standalone"
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
// Month
|
|
277
|
+
M: function(date, token, localize) {
|
|
278
|
+
const month = date.getMonth();
|
|
279
|
+
switch (token) {
|
|
280
|
+
case "M":
|
|
281
|
+
case "MM":
|
|
282
|
+
return lightFormatters.M(date, token);
|
|
283
|
+
// 1st, 2nd, ..., 12th
|
|
284
|
+
case "Mo":
|
|
285
|
+
return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
286
|
+
// Jan, Feb, ..., Dec
|
|
287
|
+
case "MMM":
|
|
288
|
+
return localize.month(month, {
|
|
289
|
+
width: "abbreviated",
|
|
290
|
+
context: "formatting"
|
|
291
|
+
});
|
|
292
|
+
// J, F, ..., D
|
|
293
|
+
case "MMMMM":
|
|
294
|
+
return localize.month(month, {
|
|
295
|
+
width: "narrow",
|
|
296
|
+
context: "formatting"
|
|
297
|
+
});
|
|
298
|
+
// January, February, ..., December
|
|
299
|
+
case "MMMM":
|
|
300
|
+
default:
|
|
301
|
+
return localize.month(month, { width: "wide", context: "formatting" });
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
// Stand-alone month
|
|
305
|
+
L: function(date, token, localize) {
|
|
306
|
+
const month = date.getMonth();
|
|
307
|
+
switch (token) {
|
|
308
|
+
// 1, 2, ..., 12
|
|
309
|
+
case "L":
|
|
310
|
+
return String(month + 1);
|
|
311
|
+
// 01, 02, ..., 12
|
|
312
|
+
case "LL":
|
|
313
|
+
return addLeadingZeros(month + 1, 2);
|
|
314
|
+
// 1st, 2nd, ..., 12th
|
|
315
|
+
case "Lo":
|
|
316
|
+
return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
317
|
+
// Jan, Feb, ..., Dec
|
|
318
|
+
case "LLL":
|
|
319
|
+
return localize.month(month, {
|
|
320
|
+
width: "abbreviated",
|
|
321
|
+
context: "standalone"
|
|
322
|
+
});
|
|
323
|
+
// J, F, ..., D
|
|
324
|
+
case "LLLLL":
|
|
325
|
+
return localize.month(month, {
|
|
326
|
+
width: "narrow",
|
|
327
|
+
context: "standalone"
|
|
328
|
+
});
|
|
329
|
+
// January, February, ..., December
|
|
330
|
+
case "LLLL":
|
|
331
|
+
default:
|
|
332
|
+
return localize.month(month, { width: "wide", context: "standalone" });
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
// Local week of year
|
|
336
|
+
w: function(date, token, localize, options) {
|
|
337
|
+
const week = getWeek(date, options);
|
|
338
|
+
if (token === "wo") {
|
|
339
|
+
return localize.ordinalNumber(week, { unit: "week" });
|
|
340
|
+
}
|
|
341
|
+
return addLeadingZeros(week, token.length);
|
|
342
|
+
},
|
|
343
|
+
// ISO week of year
|
|
344
|
+
I: function(date, token, localize) {
|
|
345
|
+
const isoWeek = getISOWeek(date);
|
|
346
|
+
if (token === "Io") {
|
|
347
|
+
return localize.ordinalNumber(isoWeek, { unit: "week" });
|
|
348
|
+
}
|
|
349
|
+
return addLeadingZeros(isoWeek, token.length);
|
|
350
|
+
},
|
|
351
|
+
// Day of the month
|
|
352
|
+
d: function(date, token, localize) {
|
|
353
|
+
if (token === "do") {
|
|
354
|
+
return localize.ordinalNumber(date.getDate(), { unit: "date" });
|
|
355
|
+
}
|
|
356
|
+
return lightFormatters.d(date, token);
|
|
357
|
+
},
|
|
358
|
+
// Day of year
|
|
359
|
+
D: function(date, token, localize) {
|
|
360
|
+
const dayOfYear = getDayOfYear(date);
|
|
361
|
+
if (token === "Do") {
|
|
362
|
+
return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
363
|
+
}
|
|
364
|
+
return addLeadingZeros(dayOfYear, token.length);
|
|
365
|
+
},
|
|
366
|
+
// Day of week
|
|
367
|
+
E: function(date, token, localize) {
|
|
368
|
+
const dayOfWeek = date.getDay();
|
|
369
|
+
switch (token) {
|
|
370
|
+
// Tue
|
|
371
|
+
case "E":
|
|
372
|
+
case "EE":
|
|
373
|
+
case "EEE":
|
|
374
|
+
return localize.day(dayOfWeek, {
|
|
375
|
+
width: "abbreviated",
|
|
376
|
+
context: "formatting"
|
|
377
|
+
});
|
|
378
|
+
// T
|
|
379
|
+
case "EEEEE":
|
|
380
|
+
return localize.day(dayOfWeek, {
|
|
381
|
+
width: "narrow",
|
|
382
|
+
context: "formatting"
|
|
383
|
+
});
|
|
384
|
+
// Tu
|
|
385
|
+
case "EEEEEE":
|
|
386
|
+
return localize.day(dayOfWeek, {
|
|
387
|
+
width: "short",
|
|
388
|
+
context: "formatting"
|
|
389
|
+
});
|
|
390
|
+
// Tuesday
|
|
391
|
+
case "EEEE":
|
|
392
|
+
default:
|
|
393
|
+
return localize.day(dayOfWeek, {
|
|
394
|
+
width: "wide",
|
|
395
|
+
context: "formatting"
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
// Local day of week
|
|
400
|
+
e: function(date, token, localize, options) {
|
|
401
|
+
const dayOfWeek = date.getDay();
|
|
402
|
+
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
403
|
+
switch (token) {
|
|
404
|
+
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
405
|
+
case "e":
|
|
406
|
+
return String(localDayOfWeek);
|
|
407
|
+
// Padded numerical value
|
|
408
|
+
case "ee":
|
|
409
|
+
return addLeadingZeros(localDayOfWeek, 2);
|
|
410
|
+
// 1st, 2nd, ..., 7th
|
|
411
|
+
case "eo":
|
|
412
|
+
return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
413
|
+
case "eee":
|
|
414
|
+
return localize.day(dayOfWeek, {
|
|
415
|
+
width: "abbreviated",
|
|
416
|
+
context: "formatting"
|
|
417
|
+
});
|
|
418
|
+
// T
|
|
419
|
+
case "eeeee":
|
|
420
|
+
return localize.day(dayOfWeek, {
|
|
421
|
+
width: "narrow",
|
|
422
|
+
context: "formatting"
|
|
423
|
+
});
|
|
424
|
+
// Tu
|
|
425
|
+
case "eeeeee":
|
|
426
|
+
return localize.day(dayOfWeek, {
|
|
427
|
+
width: "short",
|
|
428
|
+
context: "formatting"
|
|
429
|
+
});
|
|
430
|
+
// Tuesday
|
|
431
|
+
case "eeee":
|
|
432
|
+
default:
|
|
433
|
+
return localize.day(dayOfWeek, {
|
|
434
|
+
width: "wide",
|
|
435
|
+
context: "formatting"
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
// Stand-alone local day of week
|
|
440
|
+
c: function(date, token, localize, options) {
|
|
441
|
+
const dayOfWeek = date.getDay();
|
|
442
|
+
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
443
|
+
switch (token) {
|
|
444
|
+
// Numerical value (same as in `e`)
|
|
445
|
+
case "c":
|
|
446
|
+
return String(localDayOfWeek);
|
|
447
|
+
// Padded numerical value
|
|
448
|
+
case "cc":
|
|
449
|
+
return addLeadingZeros(localDayOfWeek, token.length);
|
|
450
|
+
// 1st, 2nd, ..., 7th
|
|
451
|
+
case "co":
|
|
452
|
+
return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
453
|
+
case "ccc":
|
|
454
|
+
return localize.day(dayOfWeek, {
|
|
455
|
+
width: "abbreviated",
|
|
456
|
+
context: "standalone"
|
|
457
|
+
});
|
|
458
|
+
// T
|
|
459
|
+
case "ccccc":
|
|
460
|
+
return localize.day(dayOfWeek, {
|
|
461
|
+
width: "narrow",
|
|
462
|
+
context: "standalone"
|
|
463
|
+
});
|
|
464
|
+
// Tu
|
|
465
|
+
case "cccccc":
|
|
466
|
+
return localize.day(dayOfWeek, {
|
|
467
|
+
width: "short",
|
|
468
|
+
context: "standalone"
|
|
469
|
+
});
|
|
470
|
+
// Tuesday
|
|
471
|
+
case "cccc":
|
|
472
|
+
default:
|
|
473
|
+
return localize.day(dayOfWeek, {
|
|
474
|
+
width: "wide",
|
|
475
|
+
context: "standalone"
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
// ISO day of week
|
|
480
|
+
i: function(date, token, localize) {
|
|
481
|
+
const dayOfWeek = date.getDay();
|
|
482
|
+
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
483
|
+
switch (token) {
|
|
484
|
+
// 2
|
|
485
|
+
case "i":
|
|
486
|
+
return String(isoDayOfWeek);
|
|
487
|
+
// 02
|
|
488
|
+
case "ii":
|
|
489
|
+
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
490
|
+
// 2nd
|
|
491
|
+
case "io":
|
|
492
|
+
return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
493
|
+
// Tue
|
|
494
|
+
case "iii":
|
|
495
|
+
return localize.day(dayOfWeek, {
|
|
496
|
+
width: "abbreviated",
|
|
497
|
+
context: "formatting"
|
|
498
|
+
});
|
|
499
|
+
// T
|
|
500
|
+
case "iiiii":
|
|
501
|
+
return localize.day(dayOfWeek, {
|
|
502
|
+
width: "narrow",
|
|
503
|
+
context: "formatting"
|
|
504
|
+
});
|
|
505
|
+
// Tu
|
|
506
|
+
case "iiiiii":
|
|
507
|
+
return localize.day(dayOfWeek, {
|
|
508
|
+
width: "short",
|
|
509
|
+
context: "formatting"
|
|
510
|
+
});
|
|
511
|
+
// Tuesday
|
|
512
|
+
case "iiii":
|
|
513
|
+
default:
|
|
514
|
+
return localize.day(dayOfWeek, {
|
|
515
|
+
width: "wide",
|
|
516
|
+
context: "formatting"
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
// AM or PM
|
|
521
|
+
a: function(date, token, localize) {
|
|
522
|
+
const hours = date.getHours();
|
|
523
|
+
const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
524
|
+
switch (token) {
|
|
525
|
+
case "a":
|
|
526
|
+
case "aa":
|
|
527
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
528
|
+
width: "abbreviated",
|
|
529
|
+
context: "formatting"
|
|
530
|
+
});
|
|
531
|
+
case "aaa":
|
|
532
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
533
|
+
width: "abbreviated",
|
|
534
|
+
context: "formatting"
|
|
535
|
+
}).toLowerCase();
|
|
536
|
+
case "aaaaa":
|
|
537
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
538
|
+
width: "narrow",
|
|
539
|
+
context: "formatting"
|
|
540
|
+
});
|
|
541
|
+
case "aaaa":
|
|
542
|
+
default:
|
|
543
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
544
|
+
width: "wide",
|
|
545
|
+
context: "formatting"
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
// AM, PM, midnight, noon
|
|
550
|
+
b: function(date, token, localize) {
|
|
551
|
+
const hours = date.getHours();
|
|
552
|
+
let dayPeriodEnumValue;
|
|
553
|
+
if (hours === 12) {
|
|
554
|
+
dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
555
|
+
} else if (hours === 0) {
|
|
556
|
+
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
557
|
+
} else {
|
|
558
|
+
dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
559
|
+
}
|
|
560
|
+
switch (token) {
|
|
561
|
+
case "b":
|
|
562
|
+
case "bb":
|
|
563
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
564
|
+
width: "abbreviated",
|
|
565
|
+
context: "formatting"
|
|
566
|
+
});
|
|
567
|
+
case "bbb":
|
|
568
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
569
|
+
width: "abbreviated",
|
|
570
|
+
context: "formatting"
|
|
571
|
+
}).toLowerCase();
|
|
572
|
+
case "bbbbb":
|
|
573
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
574
|
+
width: "narrow",
|
|
575
|
+
context: "formatting"
|
|
576
|
+
});
|
|
577
|
+
case "bbbb":
|
|
578
|
+
default:
|
|
579
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
580
|
+
width: "wide",
|
|
581
|
+
context: "formatting"
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
// in the morning, in the afternoon, in the evening, at night
|
|
586
|
+
B: function(date, token, localize) {
|
|
587
|
+
const hours = date.getHours();
|
|
588
|
+
let dayPeriodEnumValue;
|
|
589
|
+
if (hours >= 17) {
|
|
590
|
+
dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
591
|
+
} else if (hours >= 12) {
|
|
592
|
+
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
593
|
+
} else if (hours >= 4) {
|
|
594
|
+
dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
595
|
+
} else {
|
|
596
|
+
dayPeriodEnumValue = dayPeriodEnum.night;
|
|
597
|
+
}
|
|
598
|
+
switch (token) {
|
|
599
|
+
case "B":
|
|
600
|
+
case "BB":
|
|
601
|
+
case "BBB":
|
|
602
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
603
|
+
width: "abbreviated",
|
|
604
|
+
context: "formatting"
|
|
605
|
+
});
|
|
606
|
+
case "BBBBB":
|
|
607
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
608
|
+
width: "narrow",
|
|
609
|
+
context: "formatting"
|
|
610
|
+
});
|
|
611
|
+
case "BBBB":
|
|
612
|
+
default:
|
|
613
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
614
|
+
width: "wide",
|
|
615
|
+
context: "formatting"
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
// Hour [1-12]
|
|
620
|
+
h: function(date, token, localize) {
|
|
621
|
+
if (token === "ho") {
|
|
622
|
+
let hours = date.getHours() % 12;
|
|
623
|
+
if (hours === 0) hours = 12;
|
|
624
|
+
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
625
|
+
}
|
|
626
|
+
return lightFormatters.h(date, token);
|
|
627
|
+
},
|
|
628
|
+
// Hour [0-23]
|
|
629
|
+
H: function(date, token, localize) {
|
|
630
|
+
if (token === "Ho") {
|
|
631
|
+
return localize.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
632
|
+
}
|
|
633
|
+
return lightFormatters.H(date, token);
|
|
634
|
+
},
|
|
635
|
+
// Hour [0-11]
|
|
636
|
+
K: function(date, token, localize) {
|
|
637
|
+
const hours = date.getHours() % 12;
|
|
638
|
+
if (token === "Ko") {
|
|
639
|
+
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
640
|
+
}
|
|
641
|
+
return addLeadingZeros(hours, token.length);
|
|
642
|
+
},
|
|
643
|
+
// Hour [1-24]
|
|
644
|
+
k: function(date, token, localize) {
|
|
645
|
+
let hours = date.getHours();
|
|
646
|
+
if (hours === 0) hours = 24;
|
|
647
|
+
if (token === "ko") {
|
|
648
|
+
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
649
|
+
}
|
|
650
|
+
return addLeadingZeros(hours, token.length);
|
|
651
|
+
},
|
|
652
|
+
// Minute
|
|
653
|
+
m: function(date, token, localize) {
|
|
654
|
+
if (token === "mo") {
|
|
655
|
+
return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
656
|
+
}
|
|
657
|
+
return lightFormatters.m(date, token);
|
|
658
|
+
},
|
|
659
|
+
// Second
|
|
660
|
+
s: function(date, token, localize) {
|
|
661
|
+
if (token === "so") {
|
|
662
|
+
return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
663
|
+
}
|
|
664
|
+
return lightFormatters.s(date, token);
|
|
665
|
+
},
|
|
666
|
+
// Fraction of second
|
|
667
|
+
S: function(date, token) {
|
|
668
|
+
return lightFormatters.S(date, token);
|
|
669
|
+
},
|
|
670
|
+
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
671
|
+
X: function(date, token, _localize) {
|
|
672
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
673
|
+
if (timezoneOffset === 0) {
|
|
674
|
+
return "Z";
|
|
675
|
+
}
|
|
676
|
+
switch (token) {
|
|
677
|
+
// Hours and optional minutes
|
|
678
|
+
case "X":
|
|
679
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
680
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
681
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
682
|
+
// so this token always has the same output as `XX`
|
|
683
|
+
case "XXXX":
|
|
684
|
+
case "XX":
|
|
685
|
+
return formatTimezone(timezoneOffset);
|
|
686
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
687
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
688
|
+
// so this token always has the same output as `XXX`
|
|
689
|
+
case "XXXXX":
|
|
690
|
+
case "XXX":
|
|
691
|
+
// Hours and minutes with `:` delimiter
|
|
692
|
+
default:
|
|
693
|
+
return formatTimezone(timezoneOffset, ":");
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
697
|
+
x: function(date, token, _localize) {
|
|
698
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
699
|
+
switch (token) {
|
|
700
|
+
// Hours and optional minutes
|
|
701
|
+
case "x":
|
|
702
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
703
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
704
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
705
|
+
// so this token always has the same output as `xx`
|
|
706
|
+
case "xxxx":
|
|
707
|
+
case "xx":
|
|
708
|
+
return formatTimezone(timezoneOffset);
|
|
709
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
710
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
711
|
+
// so this token always has the same output as `xxx`
|
|
712
|
+
case "xxxxx":
|
|
713
|
+
case "xxx":
|
|
714
|
+
// Hours and minutes with `:` delimiter
|
|
715
|
+
default:
|
|
716
|
+
return formatTimezone(timezoneOffset, ":");
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
// Timezone (GMT)
|
|
720
|
+
O: function(date, token, _localize) {
|
|
721
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
722
|
+
switch (token) {
|
|
723
|
+
// Short
|
|
724
|
+
case "O":
|
|
725
|
+
case "OO":
|
|
726
|
+
case "OOO":
|
|
727
|
+
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
728
|
+
// Long
|
|
729
|
+
case "OOOO":
|
|
730
|
+
default:
|
|
731
|
+
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
// Timezone (specific non-location)
|
|
735
|
+
z: function(date, token, _localize) {
|
|
736
|
+
const timezoneOffset = date.getTimezoneOffset();
|
|
737
|
+
switch (token) {
|
|
738
|
+
// Short
|
|
739
|
+
case "z":
|
|
740
|
+
case "zz":
|
|
741
|
+
case "zzz":
|
|
742
|
+
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
743
|
+
// Long
|
|
744
|
+
case "zzzz":
|
|
745
|
+
default:
|
|
746
|
+
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
// Seconds timestamp
|
|
750
|
+
t: function(date, token, _localize) {
|
|
751
|
+
const timestamp = Math.trunc(+date / 1e3);
|
|
752
|
+
return addLeadingZeros(timestamp, token.length);
|
|
753
|
+
},
|
|
754
|
+
// Milliseconds timestamp
|
|
755
|
+
T: function(date, token, _localize) {
|
|
756
|
+
return addLeadingZeros(+date, token.length);
|
|
17
757
|
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
758
|
+
};
|
|
759
|
+
function formatTimezoneShort(offset, delimiter = "") {
|
|
760
|
+
const sign = offset > 0 ? "-" : "+";
|
|
761
|
+
const absOffset = Math.abs(offset);
|
|
762
|
+
const hours = Math.trunc(absOffset / 60);
|
|
763
|
+
const minutes = absOffset % 60;
|
|
764
|
+
if (minutes === 0) {
|
|
765
|
+
return sign + String(hours);
|
|
23
766
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
767
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
768
|
+
}
|
|
769
|
+
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
770
|
+
if (offset % 60 === 0) {
|
|
771
|
+
const sign = offset > 0 ? "-" : "+";
|
|
772
|
+
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
29
773
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
774
|
+
return formatTimezone(offset, delimiter);
|
|
775
|
+
}
|
|
776
|
+
function formatTimezone(offset, delimiter = "") {
|
|
777
|
+
const sign = offset > 0 ? "-" : "+";
|
|
778
|
+
const absOffset = Math.abs(offset);
|
|
779
|
+
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
780
|
+
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
781
|
+
return sign + hours + delimiter + minutes;
|
|
782
|
+
}
|
|
783
|
+
function isDate(value) {
|
|
784
|
+
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
785
|
+
}
|
|
786
|
+
function isValid(date) {
|
|
787
|
+
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
788
|
+
}
|
|
789
|
+
const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
790
|
+
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
791
|
+
const escapedStringRegExp = /^'([^]*?)'?$/;
|
|
792
|
+
const doubleQuoteRegExp = /''/g;
|
|
793
|
+
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
794
|
+
function format(date, formatStr, options) {
|
|
795
|
+
const defaultOptions = getDefaultOptions();
|
|
796
|
+
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
797
|
+
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
798
|
+
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
799
|
+
const originalDate = toDate(date, options?.in);
|
|
800
|
+
if (!isValid(originalDate)) {
|
|
801
|
+
throw new RangeError("Invalid time value");
|
|
35
802
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
803
|
+
let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
804
|
+
const firstCharacter = substring[0];
|
|
805
|
+
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
806
|
+
const longFormatter = longFormatters[firstCharacter];
|
|
807
|
+
return longFormatter(substring, locale.formatLong);
|
|
808
|
+
}
|
|
809
|
+
return substring;
|
|
810
|
+
}).join("").match(formattingTokensRegExp).map((substring) => {
|
|
811
|
+
if (substring === "''") {
|
|
812
|
+
return { isToken: false, value: "'" };
|
|
813
|
+
}
|
|
814
|
+
const firstCharacter = substring[0];
|
|
815
|
+
if (firstCharacter === "'") {
|
|
816
|
+
return { isToken: false, value: cleanEscapedString(substring) };
|
|
817
|
+
}
|
|
818
|
+
if (formatters[firstCharacter]) {
|
|
819
|
+
return { isToken: true, value: substring };
|
|
820
|
+
}
|
|
821
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
822
|
+
throw new RangeError(
|
|
823
|
+
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
return { isToken: false, value: substring };
|
|
827
|
+
});
|
|
828
|
+
if (locale.localize.preprocessor) {
|
|
829
|
+
parts = locale.localize.preprocessor(originalDate, parts);
|
|
41
830
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
831
|
+
const formatterOptions = {
|
|
832
|
+
firstWeekContainsDate,
|
|
833
|
+
weekStartsOn,
|
|
834
|
+
locale
|
|
835
|
+
};
|
|
836
|
+
return parts.map((part) => {
|
|
837
|
+
if (!part.isToken) return part.value;
|
|
838
|
+
const token = part.value;
|
|
839
|
+
if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
|
|
840
|
+
warnOrThrowProtectedError(token, formatStr, String(date));
|
|
841
|
+
}
|
|
842
|
+
const formatter = formatters[token[0]];
|
|
843
|
+
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
844
|
+
}).join("");
|
|
845
|
+
}
|
|
846
|
+
function cleanEscapedString(input) {
|
|
847
|
+
const matched = input.match(escapedStringRegExp);
|
|
848
|
+
if (!matched) {
|
|
849
|
+
return input;
|
|
47
850
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
851
|
+
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
852
|
+
}
|
|
853
|
+
function parseISO(argument, options) {
|
|
854
|
+
const invalidDate = () => constructFrom(options?.in, NaN);
|
|
855
|
+
const additionalDigits = 2;
|
|
856
|
+
const dateStrings = splitDateString(argument);
|
|
857
|
+
let date;
|
|
858
|
+
if (dateStrings.date) {
|
|
859
|
+
const parseYearResult = parseYear(dateStrings.date, additionalDigits);
|
|
860
|
+
date = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
|
53
861
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
862
|
+
if (!date || isNaN(+date)) return invalidDate();
|
|
863
|
+
const timestamp = +date;
|
|
864
|
+
let time = 0;
|
|
865
|
+
let offset;
|
|
866
|
+
if (dateStrings.time) {
|
|
867
|
+
time = parseTime(dateStrings.time);
|
|
868
|
+
if (isNaN(time)) return invalidDate();
|
|
59
869
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
870
|
+
if (dateStrings.timezone) {
|
|
871
|
+
offset = parseTimezone(dateStrings.timezone);
|
|
872
|
+
if (isNaN(offset)) return invalidDate();
|
|
873
|
+
} else {
|
|
874
|
+
const tmpDate = new Date(timestamp + time);
|
|
875
|
+
const result = toDate(0, options?.in);
|
|
876
|
+
result.setFullYear(
|
|
877
|
+
tmpDate.getUTCFullYear(),
|
|
878
|
+
tmpDate.getUTCMonth(),
|
|
879
|
+
tmpDate.getUTCDate()
|
|
880
|
+
);
|
|
881
|
+
result.setHours(
|
|
882
|
+
tmpDate.getUTCHours(),
|
|
883
|
+
tmpDate.getUTCMinutes(),
|
|
884
|
+
tmpDate.getUTCSeconds(),
|
|
885
|
+
tmpDate.getUTCMilliseconds()
|
|
886
|
+
);
|
|
887
|
+
return result;
|
|
65
888
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
889
|
+
return toDate(timestamp + time + offset, options?.in);
|
|
890
|
+
}
|
|
891
|
+
const patterns = {
|
|
892
|
+
dateTimeDelimiter: /[T ]/,
|
|
893
|
+
timeZoneDelimiter: /[Z ]/i,
|
|
894
|
+
timezone: /([Z+-].*)$/
|
|
895
|
+
};
|
|
896
|
+
const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
|
897
|
+
const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
|
898
|
+
const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
899
|
+
function splitDateString(dateString) {
|
|
900
|
+
const dateStrings = {};
|
|
901
|
+
const array = dateString.split(patterns.dateTimeDelimiter);
|
|
902
|
+
let timeString;
|
|
903
|
+
if (array.length > 2) {
|
|
904
|
+
return dateStrings;
|
|
71
905
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
906
|
+
if (/:/.test(array[0])) {
|
|
907
|
+
timeString = array[0];
|
|
908
|
+
} else {
|
|
909
|
+
dateStrings.date = array[0];
|
|
910
|
+
timeString = array[1];
|
|
911
|
+
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
|
|
912
|
+
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
|
|
913
|
+
timeString = dateString.substr(
|
|
914
|
+
dateStrings.date.length,
|
|
915
|
+
dateString.length
|
|
916
|
+
);
|
|
917
|
+
}
|
|
77
918
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
919
|
+
if (timeString) {
|
|
920
|
+
const token = patterns.timezone.exec(timeString);
|
|
921
|
+
if (token) {
|
|
922
|
+
dateStrings.time = timeString.replace(token[1], "");
|
|
923
|
+
dateStrings.timezone = token[1];
|
|
924
|
+
} else {
|
|
925
|
+
dateStrings.time = timeString;
|
|
926
|
+
}
|
|
83
927
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
928
|
+
return dateStrings;
|
|
929
|
+
}
|
|
930
|
+
function parseYear(dateString, additionalDigits) {
|
|
931
|
+
const regex = new RegExp(
|
|
932
|
+
"^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
|
|
933
|
+
);
|
|
934
|
+
const captures = dateString.match(regex);
|
|
935
|
+
if (!captures) return { year: NaN, restDateString: "" };
|
|
936
|
+
const year = captures[1] ? parseInt(captures[1]) : null;
|
|
937
|
+
const century = captures[2] ? parseInt(captures[2]) : null;
|
|
938
|
+
return {
|
|
939
|
+
year: century === null ? year : century * 100,
|
|
940
|
+
restDateString: dateString.slice((captures[1] || captures[2]).length)
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
function parseDate(dateString, year) {
|
|
944
|
+
if (year === null) return /* @__PURE__ */ new Date(NaN);
|
|
945
|
+
const captures = dateString.match(dateRegex);
|
|
946
|
+
if (!captures) return /* @__PURE__ */ new Date(NaN);
|
|
947
|
+
const isWeekDate = !!captures[4];
|
|
948
|
+
const dayOfYear = parseDateUnit(captures[1]);
|
|
949
|
+
const month = parseDateUnit(captures[2]) - 1;
|
|
950
|
+
const day = parseDateUnit(captures[3]);
|
|
951
|
+
const week = parseDateUnit(captures[4]);
|
|
952
|
+
const dayOfWeek = parseDateUnit(captures[5]) - 1;
|
|
953
|
+
if (isWeekDate) {
|
|
954
|
+
if (!validateWeekDate(year, week, dayOfWeek)) {
|
|
955
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
956
|
+
}
|
|
957
|
+
return dayOfISOWeekYear(year, week, dayOfWeek);
|
|
958
|
+
} else {
|
|
959
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
960
|
+
if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
|
|
961
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
962
|
+
}
|
|
963
|
+
date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
|
|
964
|
+
return date;
|
|
89
965
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
966
|
+
}
|
|
967
|
+
function parseDateUnit(value) {
|
|
968
|
+
return value ? parseInt(value) : 1;
|
|
969
|
+
}
|
|
970
|
+
function parseTime(timeString) {
|
|
971
|
+
const captures = timeString.match(timeRegex);
|
|
972
|
+
if (!captures) return NaN;
|
|
973
|
+
const hours = parseTimeUnit(captures[1]);
|
|
974
|
+
const minutes = parseTimeUnit(captures[2]);
|
|
975
|
+
const seconds = parseTimeUnit(captures[3]);
|
|
976
|
+
if (!validateTime(hours, minutes, seconds)) {
|
|
977
|
+
return NaN;
|
|
95
978
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
979
|
+
return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
|
|
980
|
+
}
|
|
981
|
+
function parseTimeUnit(value) {
|
|
982
|
+
return value && parseFloat(value.replace(",", ".")) || 0;
|
|
983
|
+
}
|
|
984
|
+
function parseTimezone(timezoneString) {
|
|
985
|
+
if (timezoneString === "Z") return 0;
|
|
986
|
+
const captures = timezoneString.match(timezoneRegex);
|
|
987
|
+
if (!captures) return 0;
|
|
988
|
+
const sign = captures[1] === "+" ? -1 : 1;
|
|
989
|
+
const hours = parseInt(captures[2]);
|
|
990
|
+
const minutes = captures[3] && parseInt(captures[3]) || 0;
|
|
991
|
+
if (!validateTimezone(hours, minutes)) {
|
|
992
|
+
return NaN;
|
|
101
993
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
994
|
+
return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
|
|
995
|
+
}
|
|
996
|
+
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
|
997
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
998
|
+
date.setUTCFullYear(isoWeekYear, 0, 4);
|
|
999
|
+
const fourthOfJanuaryDay = date.getUTCDay() || 7;
|
|
1000
|
+
const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
|
|
1001
|
+
date.setUTCDate(date.getUTCDate() + diff);
|
|
1002
|
+
return date;
|
|
1003
|
+
}
|
|
1004
|
+
const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
1005
|
+
function isLeapYearIndex(year) {
|
|
1006
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
1007
|
+
}
|
|
1008
|
+
function validateDate(year, month, date) {
|
|
1009
|
+
return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
|
|
1010
|
+
}
|
|
1011
|
+
function validateDayOfYearDate(year, dayOfYear) {
|
|
1012
|
+
return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
|
|
1013
|
+
}
|
|
1014
|
+
function validateWeekDate(_year, week, day) {
|
|
1015
|
+
return week >= 1 && week <= 53 && day >= 0 && day <= 6;
|
|
1016
|
+
}
|
|
1017
|
+
function validateTime(hours, minutes, seconds) {
|
|
1018
|
+
if (hours === 24) {
|
|
1019
|
+
return minutes === 0 && seconds === 0;
|
|
107
1020
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1021
|
+
return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
|
|
1022
|
+
}
|
|
1023
|
+
function validateTimezone(_hours, minutes) {
|
|
1024
|
+
return minutes >= 0 && minutes <= 59;
|
|
1025
|
+
}
|
|
1026
|
+
const existingDateToJson = Date.prototype.toJSON;
|
|
1027
|
+
const patchedDateToJson = function() {
|
|
1028
|
+
try {
|
|
1029
|
+
const hours = this.getHours();
|
|
1030
|
+
const minutes = this.getMinutes();
|
|
1031
|
+
const seconds = this.getSeconds();
|
|
1032
|
+
const milliseconds = this.getMilliseconds();
|
|
1033
|
+
const timezoneOffsetInHours = -(this.getTimezoneOffset() / 60);
|
|
1034
|
+
if (timezoneOffsetInHours === 0.15 && hours === 0 && minutes === 9 && seconds === 21 || hours - timezoneOffsetInHours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) {
|
|
1035
|
+
return this.toISOString().split("T")[0];
|
|
1036
|
+
}
|
|
1037
|
+
const correctedDate = new Date(this.getFullYear(), this.getMonth(), this.getDate(), hours, minutes, seconds, milliseconds);
|
|
1038
|
+
correctedDate.setHours(this.getHours() + timezoneOffsetInHours);
|
|
1039
|
+
const iso = correctedDate.toISOString().replace(/(\.0+)?Z$/, "");
|
|
1040
|
+
const sign = timezoneOffsetInHours >= 0 ? "+" : "-";
|
|
1041
|
+
const leadingZero = Math.abs(timezoneOffsetInHours) < 10 ? "0" : "";
|
|
1042
|
+
return iso + sign + leadingZero + Math.abs(timezoneOffsetInHours).toString().split(".")[0] + ":00";
|
|
1043
|
+
} catch (e2) {
|
|
1044
|
+
Date.prototype.toJSON = existingDateToJson;
|
|
1045
|
+
const jsonDate = this.toJSON();
|
|
1046
|
+
Date.prototype.toJSON = patchedDateToJson;
|
|
1047
|
+
return jsonDate;
|
|
113
1048
|
}
|
|
1049
|
+
};
|
|
1050
|
+
const frenchDateFormat = new Intl.DateTimeFormat("fr-FR", {
|
|
1051
|
+
day: "numeric",
|
|
1052
|
+
month: "long",
|
|
1053
|
+
weekday: "long",
|
|
1054
|
+
year: "numeric"
|
|
114
1055
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return _api.allFacets;
|
|
119
|
-
}
|
|
1056
|
+
const frenchDateSameYearShortFormat = new Intl.DateTimeFormat("fr-FR", {
|
|
1057
|
+
day: "numeric",
|
|
1058
|
+
month: "short"
|
|
120
1059
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return _api.allFollows;
|
|
125
|
-
}
|
|
1060
|
+
const frenchTimeFormat = new Intl.DateTimeFormat("fr-FR", {
|
|
1061
|
+
hour: "numeric",
|
|
1062
|
+
minute: "2-digit"
|
|
126
1063
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return _strings.capitalizeFirstLetter;
|
|
1064
|
+
function dateFromNullableDateOrIsoString(date, defaultValue) {
|
|
1065
|
+
if (date instanceof Date) {
|
|
1066
|
+
return date;
|
|
131
1067
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
enumerable: true,
|
|
135
|
-
get: function get() {
|
|
136
|
-
return _dossiers_legislatifs.commissionFondUidFromDossier;
|
|
1068
|
+
if (typeof date === "string") {
|
|
1069
|
+
return parseISO(date);
|
|
137
1070
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
1071
|
+
return defaultValue;
|
|
1072
|
+
}
|
|
1073
|
+
function dateFromYearMonthDayTimezoneString(dateString) {
|
|
1074
|
+
return parse(dateString, "yyyy-MM-ddXXX", /* @__PURE__ */ new Date());
|
|
1075
|
+
}
|
|
1076
|
+
function displayDateFromLocalIsoString(dateString) {
|
|
1077
|
+
const date = parseISO(dateString);
|
|
1078
|
+
dateString = format(date, "EEEE d LLLL yyyy H'h'mm", { locale: fr });
|
|
1079
|
+
if (dateString.endsWith(" 0h00")) {
|
|
1080
|
+
dateString = dateString.substring(0, dateString.length - 5);
|
|
143
1081
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
1082
|
+
return dateString;
|
|
1083
|
+
}
|
|
1084
|
+
function formatRelativeFrenchTime(date, now) {
|
|
1085
|
+
if (date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate()) {
|
|
1086
|
+
return frenchTimeFormat.format(date);
|
|
149
1087
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
1088
|
+
return frenchDateSameYearShortFormat.format(date);
|
|
1089
|
+
}
|
|
1090
|
+
function frenchDateWithoutDayOfWeekFromDateOrString(dateOrString) {
|
|
1091
|
+
const date = dateOrString instanceof Date ? dateOrString : parseISO(dateOrString);
|
|
1092
|
+
let dateString = format(date, "d LLLL yyyy H'h'mm", { locale: fr });
|
|
1093
|
+
if (dateString.endsWith(" 0h00")) {
|
|
1094
|
+
dateString = dateString.substring(0, dateString.length - 5);
|
|
155
1095
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
1096
|
+
return dateString;
|
|
1097
|
+
}
|
|
1098
|
+
function frenchTimeFromDateOrString(dateOrString) {
|
|
1099
|
+
const date = dateOrString instanceof Date ? dateOrString : parseISO(dateOrString);
|
|
1100
|
+
return format(date, "H'h'mm", { locale: fr });
|
|
1101
|
+
}
|
|
1102
|
+
function localIso8601StringFromDate(date) {
|
|
1103
|
+
return new Date(date.getTime() - date.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
|
|
1104
|
+
}
|
|
1105
|
+
function capitalizeFirstLetter(string) {
|
|
1106
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
1107
|
+
}
|
|
1108
|
+
function uncapitalizeFirstLetter(string) {
|
|
1109
|
+
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
1110
|
+
}
|
|
1111
|
+
var FinalStatus;
|
|
1112
|
+
(function(FinalStatus2) {
|
|
1113
|
+
FinalStatus2["Failure"] = "FAILURE";
|
|
1114
|
+
FinalStatus2["Success"] = "SUCCESS";
|
|
1115
|
+
})(FinalStatus || (FinalStatus = {}));
|
|
1116
|
+
var StatusOnly;
|
|
1117
|
+
(function(StatusOnly2) {
|
|
1118
|
+
StatusOnly2["Failure"] = "FAILURE";
|
|
1119
|
+
StatusOnly2["InProgress"] = "IN_PROGRESS";
|
|
1120
|
+
StatusOnly2["Success"] = "SUCCESS";
|
|
1121
|
+
})(StatusOnly || (StatusOnly = {}));
|
|
1122
|
+
function commissionFondUidFromDossier(dossier) {
|
|
1123
|
+
if (dossier.actesLegislatifs !== void 0) {
|
|
1124
|
+
for (const acte of walkActes(dossier.actesLegislatifs)) {
|
|
1125
|
+
if (acte.codeActe.match(/^AN.*-COM-FOND-SAISIE$/) !== null && acte.organeRef !== void 0 && acte.organeRef !== "PO211494") {
|
|
1126
|
+
return acte.organeRef;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
161
1129
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
1130
|
+
return void 0;
|
|
1131
|
+
}
|
|
1132
|
+
function statusFromCodierLibelle(libelle) {
|
|
1133
|
+
switch (libelle) {
|
|
1134
|
+
case "Accord":
|
|
1135
|
+
case "adopté":
|
|
1136
|
+
case "adopté, dans les conditions prévues à l'article 45, alinéa 3, de la Constitution":
|
|
1137
|
+
case "adoptée":
|
|
1138
|
+
case "adopté sans modification":
|
|
1139
|
+
case "adoptée sans modification":
|
|
1140
|
+
case "Conforme":
|
|
1141
|
+
case "considérée comme définitive en application de l'article 151-7 du Règlement":
|
|
1142
|
+
case "considérée comme définitive en application de l'article 151-9 du Règlement":
|
|
1143
|
+
case "Motion adopté(e)":
|
|
1144
|
+
return StatusOnly.Success;
|
|
1145
|
+
case "Désaccord":
|
|
1146
|
+
case "Motion rejeté(e)":
|
|
1147
|
+
case "rejeté":
|
|
1148
|
+
case "rejetée":
|
|
1149
|
+
return StatusOnly.Failure;
|
|
1150
|
+
case "adopté avec modifications":
|
|
1151
|
+
case "adoptée avec modifications":
|
|
1152
|
+
case "De droit (article 61 alinéa 1 de la Constitution)":
|
|
1153
|
+
case "modifié":
|
|
1154
|
+
case "modifiée":
|
|
1155
|
+
case "Motion de censure 49-2":
|
|
1156
|
+
case "Partiellement conforme":
|
|
1157
|
+
return StatusOnly.InProgress;
|
|
1158
|
+
case "Soixante députés au moins":
|
|
1159
|
+
case "Soixante sénateurs au moins":
|
|
1160
|
+
return CodeTypeOrgane.Constitu;
|
|
1161
|
+
default:
|
|
1162
|
+
return StatusOnly.InProgress;
|
|
167
1163
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
1164
|
+
}
|
|
1165
|
+
function stateFromActePath(dossier, actePath) {
|
|
1166
|
+
const leafActe = actePath[actePath.length - 1];
|
|
1167
|
+
let libelle = null;
|
|
1168
|
+
switch (leafActe.xsiType) {
|
|
1169
|
+
case "Adoption_Europe_Type":
|
|
1170
|
+
libelle = leafActe.statutAdoption.libelle;
|
|
1171
|
+
return {
|
|
1172
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1173
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1174
|
+
};
|
|
1175
|
+
case "ConclusionEtapeCC_Type":
|
|
1176
|
+
libelle = leafActe.statutConclusion.libelle;
|
|
1177
|
+
return {
|
|
1178
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1179
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1180
|
+
};
|
|
1181
|
+
case "Decision_Type": {
|
|
1182
|
+
libelle = leafActe.statutConclusion.libelle;
|
|
1183
|
+
let currentStatus = statusFromCodierLibelle(libelle);
|
|
1184
|
+
let finalStatus = void 0;
|
|
1185
|
+
switch (dossier.procedureParlementaire.code) {
|
|
1186
|
+
case "PROCEDURE_PARLEMENTAIRE_2":
|
|
1187
|
+
if (["rejeté", "rejetée"].includes(libelle) && dossier.actesLegislatifs !== void 0 && dossier.actesLegislatifs.length === 1) {
|
|
1188
|
+
finalStatus = FinalStatus.Failure;
|
|
1189
|
+
}
|
|
1190
|
+
break;
|
|
1191
|
+
case "PROCEDURE_PARLEMENTAIRE_8":
|
|
1192
|
+
// Résolution
|
|
1193
|
+
case "PROCEDURE_PARLEMENTAIRE_22":
|
|
1194
|
+
if (currentStatus === StatusOnly.Success) {
|
|
1195
|
+
finalStatus = FinalStatus.Success;
|
|
1196
|
+
} else if (currentStatus === StatusOnly.Failure) {
|
|
1197
|
+
finalStatus = FinalStatus.Failure;
|
|
1198
|
+
}
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
return {
|
|
1202
|
+
currentStatus,
|
|
1203
|
+
finalStatus,
|
|
1204
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
case "DecisionMotionCensure_Type":
|
|
1208
|
+
libelle = leafActe.decision.libelle;
|
|
1209
|
+
return {
|
|
1210
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1211
|
+
finalStatus: (
|
|
1212
|
+
// Not sure for other cases => To improve.
|
|
1213
|
+
// Engagement de la responsabilité gouvernementale
|
|
1214
|
+
dossier.procedureParlementaire.code === "PROCEDURE_PARLEMENTAIRE_13" && libelle === "Motion rejeté(e)" ? FinalStatus.Failure : FinalStatus.Success
|
|
1215
|
+
),
|
|
1216
|
+
// TODO: Not sure of this `true` value
|
|
1217
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1218
|
+
};
|
|
1219
|
+
case "DecisionRecevabiliteBureau_Type":
|
|
1220
|
+
libelle = leafActe.decision.libelle;
|
|
1221
|
+
return {
|
|
1222
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1223
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1224
|
+
};
|
|
1225
|
+
case "DeclarationGouvernement_Type":
|
|
1226
|
+
libelle = leafActe.typeDeclaration.libelle;
|
|
1227
|
+
return {
|
|
1228
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1229
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1230
|
+
};
|
|
1231
|
+
case "DepotMotionCensure_Type":
|
|
1232
|
+
libelle = leafActe.typeMotionCensure.libelle;
|
|
1233
|
+
return {
|
|
1234
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1235
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1236
|
+
};
|
|
1237
|
+
case "DepotRapport_Type":
|
|
1238
|
+
if ([
|
|
1239
|
+
"DossierCommissionEnquete_Type",
|
|
1240
|
+
"DossierMissionControle_Type",
|
|
1241
|
+
"DossierMissionInformation_Type"
|
|
1242
|
+
].includes(dossier.xsiType)) {
|
|
1243
|
+
return {
|
|
1244
|
+
currentStatus: actePath[0].organe.codeType,
|
|
1245
|
+
finalStatus: FinalStatus.Success,
|
|
1246
|
+
label: "rapport déposé"
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
return null;
|
|
1250
|
+
case "MotionProcedure_Type":
|
|
1251
|
+
libelle = leafActe.typeMotion.libelle;
|
|
1252
|
+
return {
|
|
1253
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1254
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1255
|
+
};
|
|
1256
|
+
case "Promulgation_Type":
|
|
1257
|
+
return {
|
|
1258
|
+
currentStatus: StatusOnly.Success,
|
|
1259
|
+
finalStatus: FinalStatus.Success,
|
|
1260
|
+
label: "promulgué"
|
|
1261
|
+
};
|
|
1262
|
+
case "RetraitInitiative_Type":
|
|
1263
|
+
return {
|
|
1264
|
+
currentStatus: StatusOnly.Failure,
|
|
1265
|
+
finalStatus: FinalStatus.Failure,
|
|
1266
|
+
label: "retiré"
|
|
1267
|
+
};
|
|
1268
|
+
case "SaisineConseilConstit_Type":
|
|
1269
|
+
libelle = leafActe.casSaisine.libelle;
|
|
1270
|
+
return {
|
|
1271
|
+
currentStatus: statusFromCodierLibelle(libelle),
|
|
1272
|
+
label: uncapitalizeFirstLetter(libelle)
|
|
1273
|
+
};
|
|
1274
|
+
default:
|
|
1275
|
+
return null;
|
|
173
1276
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1277
|
+
}
|
|
1278
|
+
function stateFromActes(dossier, actePath, actes) {
|
|
1279
|
+
if (actes !== void 0) {
|
|
1280
|
+
for (const acte of [...actes].reverse()) {
|
|
1281
|
+
const status = acte.actesLegislatifs ? stateFromActes(dossier, [...actePath, acte], acte.actesLegislatifs) : stateFromActePath(dossier, [...actePath, acte]);
|
|
1282
|
+
if (status !== null) {
|
|
1283
|
+
return status;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
179
1286
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1287
|
+
return null;
|
|
1288
|
+
}
|
|
1289
|
+
function stateFromDossier(dossier) {
|
|
1290
|
+
const status = stateFromActes(dossier, [], dossier.actesLegislatifs);
|
|
1291
|
+
if (status !== null) {
|
|
1292
|
+
return status;
|
|
185
1293
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
1294
|
+
return {
|
|
1295
|
+
currentStatus: StatusOnly.InProgress,
|
|
1296
|
+
label: "en cours"
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
function* walkActes(actes) {
|
|
1300
|
+
for (const acte of actes) {
|
|
1301
|
+
yield acte;
|
|
1302
|
+
if (acte.actesLegislatifs !== void 0) {
|
|
1303
|
+
yield* walkActes(acte.actesLegislatifs);
|
|
1304
|
+
}
|
|
191
1305
|
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
1306
|
+
}
|
|
1307
|
+
function* walkDocumentAndDivisions(documentOrDivision) {
|
|
1308
|
+
yield documentOrDivision;
|
|
1309
|
+
for (const division of documentOrDivision.divisions ?? []) {
|
|
1310
|
+
yield* walkDocumentAndDivisions(division);
|
|
197
1311
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
1312
|
+
}
|
|
1313
|
+
function insertActeLegislatifReferences(acte, data, visitedUids) {
|
|
1314
|
+
if (!visitedUids.has(acte.uid)) {
|
|
1315
|
+
visitedUids.add(acte.uid);
|
|
1316
|
+
if (data.documentByUid !== void 0 && acte.depotInitialLectureDefinitiveRef !== void 0) {
|
|
1317
|
+
const document = data.documentByUid[acte.depotInitialLectureDefinitiveRef];
|
|
1318
|
+
if (document !== void 0) {
|
|
1319
|
+
acte.depotInitialLectureDefinitive = document;
|
|
1320
|
+
insertDocumentReferences(document, data, visitedUids);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
if (data.organeByUid !== void 0 && acte.organeRef !== void 0) {
|
|
1324
|
+
const organe = data.organeByUid[acte.organeRef];
|
|
1325
|
+
if (organe !== void 0) {
|
|
1326
|
+
acte.organe = organe;
|
|
1327
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
if (data.organeByUid !== void 0 && acte.provenanceRef !== void 0) {
|
|
1331
|
+
const organe = data.organeByUid[acte.provenanceRef];
|
|
1332
|
+
if (organe !== void 0) {
|
|
1333
|
+
acte.provenance = organe;
|
|
1334
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
if (data.acteurByUid !== void 0 && acte.rapporteurs !== void 0) {
|
|
1338
|
+
for (const rapporteur of acte.rapporteurs) {
|
|
1339
|
+
const acteur = data.acteurByUid[rapporteur.acteurRef];
|
|
1340
|
+
if (acteur !== void 0) {
|
|
1341
|
+
rapporteur.acteur = acteur;
|
|
1342
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
if (data.reunionByUid !== void 0 && acte.reunionRef !== void 0) {
|
|
1347
|
+
const reunion = data.reunionByUid[acte.reunionRef];
|
|
1348
|
+
if (reunion !== void 0) {
|
|
1349
|
+
acte.reunion = reunion;
|
|
1350
|
+
insertReunionReferences(reunion, data, visitedUids);
|
|
1351
|
+
if (acte.odjRef !== void 0) {
|
|
1352
|
+
const odj = reunion.odj;
|
|
1353
|
+
if (odj !== void 0 && odj.pointsOdj !== void 0) {
|
|
1354
|
+
for (const pointOdj of odj.pointsOdj) {
|
|
1355
|
+
if (pointOdj.uid === acte.odjRef) {
|
|
1356
|
+
acte.odj = pointOdj;
|
|
1357
|
+
break;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
if (data.documentByUid !== void 0 && acte.texteAdopteRef !== void 0) {
|
|
1365
|
+
const document = data.documentByUid[acte.texteAdopteRef];
|
|
1366
|
+
if (document !== void 0) {
|
|
1367
|
+
acte.texteAdopte = document;
|
|
1368
|
+
insertDocumentReferences(document, data, visitedUids);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
if (data.documentByUid !== void 0 && acte.texteAssocieRef !== void 0) {
|
|
1372
|
+
const document = data.documentByUid[acte.texteAssocieRef];
|
|
1373
|
+
if (document !== void 0) {
|
|
1374
|
+
acte.texteAssocie = document;
|
|
1375
|
+
insertDocumentReferences(document, data, visitedUids);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
if (data.documentByUid !== void 0 && acte.textesAssocies !== void 0) {
|
|
1379
|
+
for (const texteAssocie of acte.textesAssocies) {
|
|
1380
|
+
const document = data.documentByUid[texteAssocie.texteAssocieRef];
|
|
1381
|
+
if (document !== void 0) {
|
|
1382
|
+
texteAssocie.texteAssocie = document;
|
|
1383
|
+
insertDocumentReferences(document, data, visitedUids);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
if (data.scrutinByUid !== void 0 && acte.voteRefs !== void 0) {
|
|
1388
|
+
const scrutins = [];
|
|
1389
|
+
for (const voteRef of acte.voteRefs) {
|
|
1390
|
+
const scrutin = data.scrutinByUid[voteRef];
|
|
1391
|
+
if (scrutin !== void 0) {
|
|
1392
|
+
scrutins.push(scrutin);
|
|
1393
|
+
insertScrutinReferences(scrutin, data, visitedUids);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
acte.votes = scrutins;
|
|
1397
|
+
}
|
|
1398
|
+
for (const childActe of acte.actesLegislatifs || []) {
|
|
1399
|
+
insertActeLegislatifReferences(childActe, data, visitedUids);
|
|
1400
|
+
}
|
|
203
1401
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
1402
|
+
return acte;
|
|
1403
|
+
}
|
|
1404
|
+
function insertActeurReferences(acteur, data, visitedUids) {
|
|
1405
|
+
if (!visitedUids.has(acteur.uid)) {
|
|
1406
|
+
visitedUids.add(acteur.uid);
|
|
1407
|
+
if (data.organeByUid !== void 0) {
|
|
1408
|
+
for (const mandat of acteur.mandats || []) {
|
|
1409
|
+
const organes = [];
|
|
1410
|
+
for (const organeRef of mandat.organesRefs) {
|
|
1411
|
+
const organe = data.organeByUid[organeRef];
|
|
1412
|
+
if (organe !== void 0) {
|
|
1413
|
+
organes.push(organe);
|
|
1414
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
mandat.organes = organes;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
209
1420
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
1421
|
+
return acteur;
|
|
1422
|
+
}
|
|
1423
|
+
function insertAmendementReferences(amendement, data, visitedUids) {
|
|
1424
|
+
if (!visitedUids.has(amendement.uid)) {
|
|
1425
|
+
visitedUids.add(amendement.uid);
|
|
1426
|
+
const signataires = amendement.signataires;
|
|
1427
|
+
const auteur = signataires.auteur;
|
|
1428
|
+
if (data.acteurByUid !== void 0 && auteur.acteurRef !== void 0) {
|
|
1429
|
+
const acteur = data.acteurByUid[auteur.acteurRef];
|
|
1430
|
+
if (acteur !== void 0) {
|
|
1431
|
+
auteur.acteur = acteur;
|
|
1432
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
if (data.organeByUid !== void 0 && auteur.auteurRapporteurOrganeRef !== void 0) {
|
|
1436
|
+
const auteurRapporteurOrgane = data.organeByUid[auteur.auteurRapporteurOrganeRef];
|
|
1437
|
+
if (auteurRapporteurOrgane !== void 0) {
|
|
1438
|
+
auteur.auteurRapporteurOrgane = auteurRapporteurOrgane;
|
|
1439
|
+
insertOrganeReferences(auteurRapporteurOrgane, data, visitedUids);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
if (data.organeByUid !== void 0 && auteur.gouvernementRef !== void 0) {
|
|
1443
|
+
const gouvernement = data.organeByUid[auteur.gouvernementRef];
|
|
1444
|
+
if (gouvernement !== void 0) {
|
|
1445
|
+
auteur.gouvernement = gouvernement;
|
|
1446
|
+
insertOrganeReferences(gouvernement, data, visitedUids);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
if (data.organeByUid !== void 0 && auteur.groupePolitiqueRef !== void 0) {
|
|
1450
|
+
const organe = data.organeByUid[auteur.groupePolitiqueRef];
|
|
1451
|
+
if (organe !== void 0) {
|
|
1452
|
+
auteur.groupePolitique = organe;
|
|
1453
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
if (data.acteurByUid !== void 0) {
|
|
1457
|
+
const cosignatairesRefs = signataires.cosignatairesRefs;
|
|
1458
|
+
if (cosignatairesRefs !== void 0) {
|
|
1459
|
+
const cosignataires = [];
|
|
1460
|
+
for (const cosignataireRef of signataires.cosignatairesRefs || []) {
|
|
1461
|
+
const cosignataire = data.acteurByUid[cosignataireRef];
|
|
1462
|
+
if (cosignataire !== void 0) {
|
|
1463
|
+
cosignataires.push(cosignataire);
|
|
1464
|
+
insertActeurReferences(cosignataire, data, visitedUids);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
signataires.cosignataires = cosignataires;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
215
1470
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
1471
|
+
return amendement;
|
|
1472
|
+
}
|
|
1473
|
+
function insertDivisionReferences(division, data, visitedUids) {
|
|
1474
|
+
for (const auteur of division.auteurs) {
|
|
1475
|
+
const acteurSummary = auteur.acteur;
|
|
1476
|
+
if (data.acteurByUid !== void 0 && acteurSummary !== void 0) {
|
|
1477
|
+
const acteur = data.acteurByUid[acteurSummary.acteurRef];
|
|
1478
|
+
if (acteur !== void 0) {
|
|
1479
|
+
acteurSummary.acteur = acteur;
|
|
1480
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
if (data.organeByUid !== void 0 && auteur.organeRef !== void 0) {
|
|
1484
|
+
const organe = data.organeByUid[auteur.organeRef];
|
|
1485
|
+
if (organe !== void 0) {
|
|
1486
|
+
auteur.organe = organe;
|
|
1487
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
221
1490
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
1491
|
+
if (data.dossierByUid !== void 0) {
|
|
1492
|
+
const dossier = data.dossierByUid[division.dossierRef];
|
|
1493
|
+
if (dossier !== void 0) {
|
|
1494
|
+
division.dossier = dossier;
|
|
1495
|
+
insertDossierReferences(dossier, data, visitedUids);
|
|
1496
|
+
}
|
|
227
1497
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
enumerable: true,
|
|
231
|
-
get: function get() {
|
|
232
|
-
return _inserters.insertReunionReferences;
|
|
1498
|
+
for (const childDivision of division.divisions || []) {
|
|
1499
|
+
insertDivisionReferences(childDivision, data, visitedUids);
|
|
233
1500
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
1501
|
+
return division;
|
|
1502
|
+
}
|
|
1503
|
+
function insertDocumentReferences(document, data, visitedUids) {
|
|
1504
|
+
if (!visitedUids.has(document.uid)) {
|
|
1505
|
+
visitedUids.add(document.uid);
|
|
1506
|
+
for (const auteur of document.auteurs) {
|
|
1507
|
+
const acteurSummary = auteur.acteur;
|
|
1508
|
+
if (data.acteurByUid !== void 0 && acteurSummary !== void 0) {
|
|
1509
|
+
const acteur = data.acteurByUid[acteurSummary.acteurRef];
|
|
1510
|
+
if (acteur !== void 0) {
|
|
1511
|
+
acteurSummary.acteur = acteur;
|
|
1512
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
if (data.organeByUid !== void 0 && auteur.organeRef !== void 0) {
|
|
1516
|
+
const organe = data.organeByUid[auteur.organeRef];
|
|
1517
|
+
if (organe !== void 0) {
|
|
1518
|
+
auteur.organe = organe;
|
|
1519
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (data.dossierByUid !== void 0) {
|
|
1524
|
+
const dossier = data.dossierByUid[document.dossierRef];
|
|
1525
|
+
if (dossier !== void 0) {
|
|
1526
|
+
document.dossier = dossier;
|
|
1527
|
+
insertDossierReferences(dossier, data, visitedUids);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
for (const division of document.divisions || []) {
|
|
1531
|
+
insertDivisionReferences(division, data, visitedUids);
|
|
1532
|
+
}
|
|
239
1533
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
1534
|
+
return document;
|
|
1535
|
+
}
|
|
1536
|
+
function insertDossierReferences(dossier, data, visitedUids) {
|
|
1537
|
+
if (!visitedUids.has(dossier.uid)) {
|
|
1538
|
+
visitedUids.add(dossier.uid);
|
|
1539
|
+
for (const acte of dossier.actesLegislatifs ?? []) {
|
|
1540
|
+
insertActeLegislatifReferences(acte, data, visitedUids);
|
|
1541
|
+
}
|
|
1542
|
+
const initiateur = dossier.initiateur;
|
|
1543
|
+
if (initiateur !== void 0) {
|
|
1544
|
+
if (data.acteurByUid !== void 0) {
|
|
1545
|
+
for (const acteurSummary of initiateur.acteurs || []) {
|
|
1546
|
+
const acteur = data.acteurByUid[acteurSummary.acteurRef];
|
|
1547
|
+
if (acteur !== void 0) {
|
|
1548
|
+
acteurSummary.acteur = acteur;
|
|
1549
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1550
|
+
}
|
|
1551
|
+
if (acteur !== void 0 && acteurSummary.mandatRef !== void 0) {
|
|
1552
|
+
for (const mandat of acteur.mandats || []) {
|
|
1553
|
+
if (mandat.uid === acteurSummary.mandatRef) {
|
|
1554
|
+
acteurSummary.mandat = mandat;
|
|
1555
|
+
break;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
if (data.organeByUid !== void 0 && initiateur.organeRef !== void 0) {
|
|
1562
|
+
const organe = data.organeByUid[initiateur.organeRef];
|
|
1563
|
+
if (organe !== void 0) {
|
|
1564
|
+
initiateur.organe = organe;
|
|
1565
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
245
1569
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
1570
|
+
return dossier;
|
|
1571
|
+
}
|
|
1572
|
+
function insertOrganeReferences(organe, data, visitedUids) {
|
|
1573
|
+
if (!visitedUids.has(organe.uid)) {
|
|
1574
|
+
visitedUids.add(organe.uid);
|
|
1575
|
+
if (data.organeByUid !== void 0 && organe.organeParentRef !== void 0) {
|
|
1576
|
+
const organeParent = data.organeByUid[organe.organeParentRef];
|
|
1577
|
+
if (organeParent !== void 0) {
|
|
1578
|
+
organe.organeParent = organeParent;
|
|
1579
|
+
insertOrganeReferences(organeParent, data, visitedUids);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
if (data.organeByUid !== void 0 && organe.organePrecedentRef !== void 0) {
|
|
1583
|
+
const organePrecedent = data.organeByUid[organe.organePrecedentRef];
|
|
1584
|
+
if (organePrecedent !== void 0) {
|
|
1585
|
+
organe.organePrecedent = organePrecedent;
|
|
1586
|
+
insertOrganeReferences(organePrecedent, data, visitedUids);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
251
1589
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
1590
|
+
return organe;
|
|
1591
|
+
}
|
|
1592
|
+
function insertReunionReferences(reunion, data, visitedUids) {
|
|
1593
|
+
if (!visitedUids.has(reunion.uid)) {
|
|
1594
|
+
visitedUids.add(reunion.uid);
|
|
1595
|
+
const demandeurs = reunion.demandeurs;
|
|
1596
|
+
if (demandeurs !== void 0) {
|
|
1597
|
+
if (data.acteurByUid !== void 0) {
|
|
1598
|
+
for (const acteurSummary of demandeurs.acteurs || []) {
|
|
1599
|
+
const acteur = data.acteurByUid[acteurSummary.acteurRef];
|
|
1600
|
+
if (acteur !== void 0) {
|
|
1601
|
+
acteurSummary.acteur = acteur;
|
|
1602
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
if (data.organeByUid !== void 0) {
|
|
1607
|
+
const organeSummary = demandeurs.organe;
|
|
1608
|
+
if (organeSummary !== void 0) {
|
|
1609
|
+
const organe = data.organeByUid[organeSummary.organeRef];
|
|
1610
|
+
if (organe !== void 0) {
|
|
1611
|
+
organeSummary.organe = organe;
|
|
1612
|
+
insertOrganeReferences(organe, data, visitedUids);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
if (data.organeByUid !== void 0 && reunion.organeReuniRef !== void 0) {
|
|
1618
|
+
const organeReuni = data.organeByUid[reunion.organeReuniRef];
|
|
1619
|
+
if (organeReuni !== void 0) {
|
|
1620
|
+
reunion.organeReuni = organeReuni;
|
|
1621
|
+
insertOrganeReferences(organeReuni, data, visitedUids);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
if (data.acteurByUid !== void 0) {
|
|
1625
|
+
const participants = reunion.participants;
|
|
1626
|
+
if (participants !== void 0) {
|
|
1627
|
+
for (const participantInterne of participants.participantsInternes || []) {
|
|
1628
|
+
const acteur = data.acteurByUid[participantInterne.acteurRef];
|
|
1629
|
+
if (acteur !== void 0) {
|
|
1630
|
+
participantInterne.acteur = acteur;
|
|
1631
|
+
insertActeurReferences(acteur, data, visitedUids);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
257
1636
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
1637
|
+
return reunion;
|
|
1638
|
+
}
|
|
1639
|
+
function insertScrutinReferences(scrutin, _data, visitedUids) {
|
|
1640
|
+
if (!visitedUids.has(scrutin.uid)) {
|
|
1641
|
+
visitedUids.add(scrutin.uid);
|
|
263
1642
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
1643
|
+
return scrutin;
|
|
1644
|
+
}
|
|
1645
|
+
const documentUidRegex = /^((?<documentType>ACIN|ALCN|AVCE|AVIS|DECL|ETDI|LETT|MESS|MION|PION|PNRE|PRJL|RAPP|RINF|RION)(?<chambre>AN|CG|SN)(?<republique>R\d+)[LS](?<legislature>\d+)(?<etat>B|BTA|BTC|TAP)(?<numero>\d+)(-.*)?)|((?<documentType2>MION)(?<chambre2>AN|SN)(?<republique2>R\d+)[LS](?<legislature2>\d+)-N(?<numero2>\d+))$/;
|
|
1646
|
+
function pathFromDocumentUid(documentsDir, uid) {
|
|
1647
|
+
const match = uid.match(documentUidRegex);
|
|
1648
|
+
assert.notStrictEqual(match, null, `Unexpected structure for document UID: ${uid}`);
|
|
1649
|
+
const groups = match.groups;
|
|
1650
|
+
const documentType = path.join(documentsDir, groups.documentType ?? groups.documentType2);
|
|
1651
|
+
const chambreDir = path.join(documentType, groups.chambre ?? groups.chambre2);
|
|
1652
|
+
const republiqueDir = path.join(chambreDir, groups.republique ?? groups.republique2);
|
|
1653
|
+
const legislatureDir = path.join(republiqueDir, groups.legislature ?? groups.legislature2);
|
|
1654
|
+
const etat = groups.etat;
|
|
1655
|
+
if (etat === void 0) {
|
|
1656
|
+
fs.ensureDirSync(legislatureDir);
|
|
1657
|
+
return path.join(legislatureDir, uid);
|
|
269
1658
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
1659
|
+
const etatDir = path.join(legislatureDir, etat);
|
|
1660
|
+
let numero = "000000" + (groups.numero ?? groups.numero2);
|
|
1661
|
+
numero = numero.substring(numero.length - 6);
|
|
1662
|
+
const numeroMilliersDir = path.join(etatDir, numero.substring(0, 3));
|
|
1663
|
+
fs.ensureDirSync(numeroMilliersDir);
|
|
1664
|
+
return path.join(numeroMilliersDir, uid);
|
|
1665
|
+
}
|
|
1666
|
+
function shortNameFromOrgane(organe) {
|
|
1667
|
+
if (organe === null || organe === void 0) {
|
|
1668
|
+
return "Organe inconnu";
|
|
275
1669
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
1670
|
+
switch (organe.codeType) {
|
|
1671
|
+
case CodeTypeOrgane.Cmp:
|
|
1672
|
+
return "Commission mixte paritaire";
|
|
1673
|
+
case CodeTypeOrgane.Gouvernement:
|
|
1674
|
+
return organe.libelle;
|
|
1675
|
+
default:
|
|
1676
|
+
return organe.libelleAbrege;
|
|
281
1677
|
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
1678
|
+
}
|
|
1679
|
+
var DocumentUrlFormat;
|
|
1680
|
+
(function(DocumentUrlFormat2) {
|
|
1681
|
+
DocumentUrlFormat2["Html"] = "html";
|
|
1682
|
+
DocumentUrlFormat2["Pdf"] = "pdf";
|
|
1683
|
+
DocumentUrlFormat2["RawHtml"] = "raw-html";
|
|
1684
|
+
})(DocumentUrlFormat || (DocumentUrlFormat = {}));
|
|
1685
|
+
const documentUrlFragmentsByType = {
|
|
1686
|
+
ACIN: {
|
|
1687
|
+
directory: "projets",
|
|
1688
|
+
prefix: "pl",
|
|
1689
|
+
suffix: "-ai"
|
|
1690
|
+
},
|
|
1691
|
+
AVCEPRJLOI: {
|
|
1692
|
+
directory: "projets",
|
|
1693
|
+
prefix: "pl",
|
|
1694
|
+
suffix: "-ace"
|
|
1695
|
+
},
|
|
1696
|
+
AVCELETTRE: {
|
|
1697
|
+
directory: "projets",
|
|
1698
|
+
prefix: "pl",
|
|
1699
|
+
suffix: "-ace"
|
|
1700
|
+
},
|
|
1701
|
+
AVCEPIONLOI: {
|
|
1702
|
+
directory: "propositions",
|
|
1703
|
+
prefix: "pion",
|
|
1704
|
+
suffix: "-ace"
|
|
1705
|
+
},
|
|
1706
|
+
AVIS: {
|
|
1707
|
+
directory: "rapports",
|
|
1708
|
+
prefix: "r",
|
|
1709
|
+
suffix: ""
|
|
1710
|
+
},
|
|
1711
|
+
ETDI: {
|
|
1712
|
+
directory: "projets",
|
|
1713
|
+
prefix: "pl",
|
|
1714
|
+
suffix: "-ei"
|
|
1715
|
+
},
|
|
1716
|
+
LETT: {
|
|
1717
|
+
directory: "projets",
|
|
1718
|
+
prefix: "pl",
|
|
1719
|
+
suffix: "-l"
|
|
1720
|
+
},
|
|
1721
|
+
PION: {
|
|
1722
|
+
directory: "propositions",
|
|
1723
|
+
prefix: "pion",
|
|
1724
|
+
suffix: ""
|
|
1725
|
+
},
|
|
1726
|
+
PNRE: {
|
|
1727
|
+
directory: "propositions",
|
|
1728
|
+
prefix: "pion",
|
|
1729
|
+
suffix: ""
|
|
1730
|
+
},
|
|
1731
|
+
PNREAPPART341: {
|
|
1732
|
+
directory: "propositions",
|
|
1733
|
+
prefix: "pion",
|
|
1734
|
+
suffix: ""
|
|
1735
|
+
},
|
|
1736
|
+
PNRECOMENQ: {
|
|
1737
|
+
directory: "propositions",
|
|
1738
|
+
prefix: "pion",
|
|
1739
|
+
suffix: ""
|
|
1740
|
+
},
|
|
1741
|
+
PNREMODREGLTAN: {
|
|
1742
|
+
directory: "propositions",
|
|
1743
|
+
prefix: "pion",
|
|
1744
|
+
suffix: ""
|
|
1745
|
+
},
|
|
1746
|
+
PNRETVXINSTITEUROP: {
|
|
1747
|
+
directory: "europe/resolutions",
|
|
1748
|
+
prefix: "ppe",
|
|
1749
|
+
suffix: ""
|
|
1750
|
+
},
|
|
1751
|
+
PRJL: {
|
|
1752
|
+
directory: "projets",
|
|
1753
|
+
prefix: "pl",
|
|
1754
|
+
suffix: ""
|
|
1755
|
+
},
|
|
1756
|
+
RAPP: {
|
|
1757
|
+
directory: "rapports",
|
|
1758
|
+
prefix: "r",
|
|
1759
|
+
suffix: ""
|
|
1760
|
+
},
|
|
1761
|
+
RINF: {
|
|
1762
|
+
directory: "rap-info",
|
|
1763
|
+
prefix: "i",
|
|
1764
|
+
suffix: ""
|
|
1765
|
+
},
|
|
1766
|
+
RION: {
|
|
1767
|
+
directory: "",
|
|
1768
|
+
prefix: "",
|
|
1769
|
+
suffix: ""
|
|
1770
|
+
},
|
|
1771
|
+
TADO: {
|
|
1772
|
+
directory: "ta",
|
|
1773
|
+
prefix: "ta",
|
|
1774
|
+
suffix: ""
|
|
1775
|
+
},
|
|
1776
|
+
TCOM: {
|
|
1777
|
+
directory: "ta-commission",
|
|
1778
|
+
prefix: "r",
|
|
1779
|
+
suffix: "-a0"
|
|
1780
|
+
},
|
|
1781
|
+
TCOMCOMENQ: {
|
|
1782
|
+
directory: "ta-commission",
|
|
1783
|
+
prefix: "r",
|
|
1784
|
+
suffix: "-a0"
|
|
1785
|
+
},
|
|
1786
|
+
TCOMMODREGLTAN: {
|
|
1787
|
+
directory: "ta-commission",
|
|
1788
|
+
prefix: "r",
|
|
1789
|
+
suffix: "-a0"
|
|
1790
|
+
},
|
|
1791
|
+
TCOMTVXINSTITEUROP: {
|
|
1792
|
+
directory: "ta-commission",
|
|
1793
|
+
prefix: "r",
|
|
1794
|
+
suffix: "-a0"
|
|
287
1795
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
1796
|
+
};
|
|
1797
|
+
function extensionFromDocumentUrlFormat(format2) {
|
|
1798
|
+
switch (format2) {
|
|
1799
|
+
case DocumentUrlFormat.Html:
|
|
1800
|
+
return ".asp";
|
|
1801
|
+
case DocumentUrlFormat.Pdf:
|
|
1802
|
+
return ".pdf";
|
|
1803
|
+
case DocumentUrlFormat.RawHtml:
|
|
1804
|
+
return ".asp";
|
|
293
1805
|
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
1806
|
+
}
|
|
1807
|
+
function* iterDocumentOrDivisionUrls(documentOrDivision, format2 = void 0) {
|
|
1808
|
+
if (format2 === void 0 || format2 === DocumentUrlFormat.RawHtml) {
|
|
1809
|
+
yield {
|
|
1810
|
+
format: DocumentUrlFormat.RawHtml,
|
|
1811
|
+
type: "dyn-opendata",
|
|
1812
|
+
url: `https://www.assemblee-nationale.fr/dyn/opendata/${documentOrDivision.uid}.html`
|
|
1813
|
+
};
|
|
1814
|
+
yield {
|
|
1815
|
+
format: DocumentUrlFormat.RawHtml,
|
|
1816
|
+
type: "dyn-docs",
|
|
1817
|
+
url: `https://www.assemblee-nationale.fr/dyn/docs/${documentOrDivision.uid}.raw`
|
|
1818
|
+
};
|
|
1819
|
+
const urlInfos = urlInfosFromDocumentOrDivision(documentOrDivision, DocumentUrlFormat.RawHtml);
|
|
1820
|
+
if (urlInfos !== null) {
|
|
1821
|
+
yield {
|
|
1822
|
+
format: DocumentUrlFormat.RawHtml,
|
|
1823
|
+
type: urlInfos.directory.replaceAll("/", "-"),
|
|
1824
|
+
url: urlInfos.url
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
299
1827
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
1828
|
+
if (format2 === void 0 || format2 === DocumentUrlFormat.Html) {
|
|
1829
|
+
const urlInfos = urlInfosFromDocumentOrDivision(documentOrDivision, DocumentUrlFormat.Html);
|
|
1830
|
+
if (urlInfos !== null) {
|
|
1831
|
+
yield {
|
|
1832
|
+
format: DocumentUrlFormat.Html,
|
|
1833
|
+
type: urlInfos.directory.replaceAll("/", "-"),
|
|
1834
|
+
url: urlInfos.url
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
305
1837
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
1838
|
+
if (format2 === void 0 || format2 === DocumentUrlFormat.Pdf) {
|
|
1839
|
+
yield {
|
|
1840
|
+
format: DocumentUrlFormat.RawHtml,
|
|
1841
|
+
type: "dyn-opendata",
|
|
1842
|
+
url: `https://www.assemblee-nationale.fr/dyn/opendata/${documentOrDivision.uid}.html`
|
|
1843
|
+
};
|
|
1844
|
+
yield {
|
|
1845
|
+
format: DocumentUrlFormat.Pdf,
|
|
1846
|
+
type: "dyn-docs",
|
|
1847
|
+
url: `https://www.assemblee-nationale.fr/dyn/docs/${documentOrDivision.uid}.pdf`
|
|
1848
|
+
};
|
|
1849
|
+
const urlInfos = urlInfosFromDocumentOrDivision(documentOrDivision, DocumentUrlFormat.Pdf);
|
|
1850
|
+
if (urlInfos !== null) {
|
|
1851
|
+
yield {
|
|
1852
|
+
format: DocumentUrlFormat.Pdf,
|
|
1853
|
+
type: urlInfos.directory.replaceAll("/", "-"),
|
|
1854
|
+
url: urlInfos.url
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
311
1857
|
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
1858
|
+
}
|
|
1859
|
+
function urlFromDocument(documentOrDivision, format2) {
|
|
1860
|
+
const urlInfos = urlInfosFromDocumentOrDivision(documentOrDivision, format2);
|
|
1861
|
+
return urlInfos === null ? null : urlInfos.url;
|
|
1862
|
+
}
|
|
1863
|
+
function urlFromScrutin(scrutin) {
|
|
1864
|
+
const match = /^VTANR([0-9]+)L([0-9]+)V([0-9]+)$/.exec(scrutin.uid);
|
|
1865
|
+
if (match === null) {
|
|
1866
|
+
console.log(`Unable to generate URL from scrutin with unexpected UID: "${scrutin.uid}"`);
|
|
1867
|
+
return null;
|
|
317
1868
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
1869
|
+
const legislature = match[2];
|
|
1870
|
+
const numero = match[3];
|
|
1871
|
+
return `http://www2.assemblee-nationale.fr/scrutins/detail/(legislature)/${legislature}/(num)/${numero}`;
|
|
1872
|
+
}
|
|
1873
|
+
function urlInfosFromDocumentOrDivision(documentOrDivision, format2) {
|
|
1874
|
+
const extension = extensionFromDocumentUrlFormat(format2);
|
|
1875
|
+
const match = /^(.{4})([ANS]*)(R[0-9])([LS]*)([0-9]*)([BTACP]*)(.*)$/.exec(documentOrDivision.uid);
|
|
1876
|
+
if (match === null) {
|
|
1877
|
+
console.log(`Unable to generate URL from document or division with unexpected UID: "${documentOrDivision.uid}"`);
|
|
1878
|
+
return null;
|
|
323
1879
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
1880
|
+
const chambre = match[2];
|
|
1881
|
+
if (chambre === "SN") {
|
|
1882
|
+
console.log(`Unable to generate URL for document or division in Sénat. UID: "${documentOrDivision.uid}"`);
|
|
1883
|
+
return null;
|
|
1884
|
+
}
|
|
1885
|
+
const legislature = match[5];
|
|
1886
|
+
let number = match[7];
|
|
1887
|
+
if (format2 === DocumentUrlFormat.RawHtml) {
|
|
1888
|
+
return {
|
|
1889
|
+
directory: "textes",
|
|
1890
|
+
url: `https://www.assemblee-nationale.fr/${legislature}/textes/${number}${extension}`
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
let documentType = {
|
|
1894
|
+
BTC: "TCOM",
|
|
1895
|
+
BTA: "TADO",
|
|
1896
|
+
TAP: "TADO"
|
|
1897
|
+
}[match[6]] || match[1];
|
|
1898
|
+
if (documentOrDivision.classification !== void 0 && documentOrDivision.classification.sousType !== void 0 && documentOrDivision.classification.sousType.code === "COMPA") {
|
|
1899
|
+
number = number.replace(/-COMPA/, "-aCOMPA");
|
|
1900
|
+
}
|
|
1901
|
+
if (documentType == "AVCE") {
|
|
1902
|
+
documentType = `AVCE${documentOrDivision.classification.famille?.classe.code}`;
|
|
1903
|
+
}
|
|
1904
|
+
const fragments = documentUrlFragmentsByType[documentType];
|
|
1905
|
+
if (fragments === void 0) {
|
|
1906
|
+
console.log(`Unable to generate URL from document or division of UID "${documentOrDivision.uid}" and type "${documentType}"`);
|
|
1907
|
+
return null;
|
|
1908
|
+
}
|
|
1909
|
+
const directory = format2 === DocumentUrlFormat.Pdf ? `pdf/${fragments.directory}` : fragments.directory;
|
|
1910
|
+
return {
|
|
1911
|
+
directory,
|
|
1912
|
+
url: `https://www.assemblee-nationale.fr/${legislature}/${directory}/${fragments.prefix}${number}${fragments.suffix}${extension}`
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
export {
|
|
1916
|
+
C as AmendementsConvert,
|
|
1917
|
+
A as AvantAApres,
|
|
1918
|
+
a as CodeActe,
|
|
1919
|
+
CodeTypeOrgane,
|
|
1920
|
+
DocumentUrlFormat,
|
|
1921
|
+
E2 as EtatAmendementLibelle,
|
|
1922
|
+
E as EtatCycleDeVie,
|
|
1923
|
+
Facet,
|
|
1924
|
+
Follow,
|
|
1925
|
+
L as Legislature,
|
|
1926
|
+
S as SortAmendement,
|
|
1927
|
+
StatusOnly,
|
|
1928
|
+
d as TypeActeLegislatif,
|
|
1929
|
+
T2 as TypeAuteur,
|
|
1930
|
+
e as TypeDocument,
|
|
1931
|
+
T as TypeMandat,
|
|
1932
|
+
b as TypeOrgane,
|
|
1933
|
+
c as TypeReunion,
|
|
1934
|
+
allFacets,
|
|
1935
|
+
allFollows,
|
|
1936
|
+
capitalizeFirstLetter,
|
|
1937
|
+
commissionFondUidFromDossier,
|
|
1938
|
+
dateFromNullableDateOrIsoString,
|
|
1939
|
+
dateFromYearMonthDayTimezoneString,
|
|
1940
|
+
displayDateFromLocalIsoString,
|
|
1941
|
+
existingDateToJson,
|
|
1942
|
+
formatRelativeFrenchTime,
|
|
1943
|
+
frenchDateFormat,
|
|
1944
|
+
frenchDateSameYearShortFormat,
|
|
1945
|
+
frenchDateWithoutDayOfWeekFromDateOrString,
|
|
1946
|
+
frenchTimeFormat,
|
|
1947
|
+
frenchTimeFromDateOrString,
|
|
1948
|
+
insertActeurReferences,
|
|
1949
|
+
insertAmendementReferences,
|
|
1950
|
+
insertDocumentReferences,
|
|
1951
|
+
insertDossierReferences,
|
|
1952
|
+
insertOrganeReferences,
|
|
1953
|
+
insertReunionReferences,
|
|
1954
|
+
insertScrutinReferences,
|
|
1955
|
+
iterDocumentOrDivisionUrls,
|
|
1956
|
+
localIso8601StringFromDate,
|
|
1957
|
+
patchedDateToJson,
|
|
1958
|
+
pathFromDocumentUid,
|
|
1959
|
+
shortNameFromOrgane,
|
|
1960
|
+
stateFromActePath,
|
|
1961
|
+
stateFromActes,
|
|
1962
|
+
stateFromDossier,
|
|
1963
|
+
statusFromCodierLibelle,
|
|
1964
|
+
uncapitalizeFirstLetter,
|
|
1965
|
+
urlFromDocument,
|
|
1966
|
+
urlFromScrutin,
|
|
1967
|
+
walkActes,
|
|
1968
|
+
walkDocumentAndDivisions
|
|
1969
|
+
};
|
|
1970
|
+
//# sourceMappingURL=index.js.map
|