@tricoteuses/senat 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/ameli.d.ts +66 -0
- package/lib/src/ameli.js +1 -0
- package/lib/src/db_types/ameli.d.ts +1762 -0
- package/lib/src/db_types/ameli.js +1074 -0
- package/lib/src/db_types/debats.d.ts +380 -0
- package/lib/src/db_types/debats.js +266 -0
- package/lib/src/db_types/dosleg.d.ts +2954 -0
- package/lib/src/db_types/dosleg.js +2005 -0
- package/lib/src/db_types/questions.d.ts +699 -0
- package/lib/src/db_types/questions.js +493 -0
- package/lib/src/db_types/sens.d.ts +7843 -0
- package/lib/src/db_types/sens.js +4691 -0
- package/lib/src/debats.d.ts +38 -0
- package/lib/src/debats.js +1 -0
- package/lib/src/documents.d.ts +30 -0
- package/lib/src/documents.js +1 -0
- package/lib/src/dosleg.d.ts +142 -0
- package/lib/src/dosleg.js +193 -0
- package/lib/src/index.d.ts +41 -24
- package/lib/src/index.js +27 -6
- package/lib/src/kanel_types/ameli.d.ts +1762 -0
- package/lib/src/kanel_types/ameli.js +1074 -0
- package/lib/src/kanel_types/debats.d.ts +380 -0
- package/lib/src/kanel_types/debats.js +266 -0
- package/lib/src/kanel_types/dosleg.d.ts +2954 -0
- package/lib/src/kanel_types/dosleg.js +2005 -0
- package/lib/src/kanel_types/questions.d.ts +699 -0
- package/lib/src/kanel_types/questions.js +493 -0
- package/lib/src/kanel_types/sens.d.ts +7843 -0
- package/lib/src/kanel_types/sens.js +4691 -0
- package/lib/src/kysely/index.d.ts +216 -0
- package/lib/src/kysely/index.js +11 -0
- package/lib/src/kysely_types/ameli/Amd.d.ts +91 -0
- package/lib/src/kysely_types/ameli/Amd.js +3 -0
- package/lib/src/kysely_types/ameli/Amdsen.d.ts +24 -0
- package/lib/src/kysely_types/ameli/Amdsen.js +3 -0
- package/lib/src/kysely_types/ameli/Avicom.d.ts +14 -0
- package/lib/src/kysely_types/ameli/Avicom.js +3 -0
- package/lib/src/kysely_types/ameli/Avigvt.d.ts +14 -0
- package/lib/src/kysely_types/ameli/Avigvt.js +3 -0
- package/lib/src/kysely_types/ameli/Cab.d.ts +14 -0
- package/lib/src/kysely_types/ameli/Cab.js +3 -0
- package/lib/src/kysely_types/ameli/ComAmeli.d.ts +22 -0
- package/lib/src/kysely_types/ameli/ComAmeli.js +3 -0
- package/lib/src/kysely_types/ameli/Database.d.ts +3 -0
- package/lib/src/kysely_types/ameli/Database.js +3 -0
- package/lib/src/kysely_types/ameli/Ent.d.ts +14 -0
- package/lib/src/kysely_types/ameli/Ent.js +3 -0
- package/lib/src/kysely_types/ameli/Etatxt.d.ts +15 -0
- package/lib/src/kysely_types/ameli/Etatxt.js +3 -0
- package/lib/src/kysely_types/ameli/Fbu.d.ts +17 -0
- package/lib/src/kysely_types/ameli/Fbu.js +3 -0
- package/lib/src/kysely_types/ameli/GrppolAmeli.d.ts +20 -0
- package/lib/src/kysely_types/ameli/GrppolAmeli.js +3 -0
- package/lib/src/kysely_types/ameli/Gvt.d.ts +18 -0
- package/lib/src/kysely_types/ameli/Gvt.js +3 -0
- package/lib/src/kysely_types/ameli/Intora.d.ts +33 -0
- package/lib/src/kysely_types/ameli/Intora.js +3 -0
- package/lib/src/kysely_types/ameli/Irr.d.ts +21 -0
- package/lib/src/kysely_types/ameli/Irr.js +3 -0
- package/lib/src/kysely_types/ameli/LecAmeli.d.ts +14 -0
- package/lib/src/kysely_types/ameli/LecAmeli.js +3 -0
- package/lib/src/kysely_types/ameli/Mot.d.ts +20 -0
- package/lib/src/kysely_types/ameli/Mot.js +3 -0
- package/lib/src/kysely_types/ameli/Nat.d.ts +13 -0
- package/lib/src/kysely_types/ameli/Nat.js +3 -0
- package/lib/src/kysely_types/ameli/Orarol.d.ts +14 -0
- package/lib/src/kysely_types/ameli/Orarol.js +3 -0
- package/lib/src/kysely_types/ameli/Sai.d.ts +25 -0
- package/lib/src/kysely_types/ameli/Sai.js +3 -0
- package/lib/src/kysely_types/ameli/Saisen.d.ts +15 -0
- package/lib/src/kysely_types/ameli/Saisen.js +3 -0
- package/lib/src/kysely_types/ameli/Sea.d.ts +17 -0
- package/lib/src/kysely_types/ameli/Sea.js +3 -0
- package/lib/src/kysely_types/ameli/SenAmeli.d.ts +36 -0
- package/lib/src/kysely_types/ameli/SenAmeli.js +3 -0
- package/lib/src/kysely_types/ameli/SenatSchema.d.ts +60 -0
- package/lib/src/kysely_types/ameli/SenatSchema.js +3 -0
- package/lib/src/kysely_types/ameli/Ses.d.ts +17 -0
- package/lib/src/kysely_types/ameli/Ses.js +3 -0
- package/lib/src/kysely_types/ameli/Sor.d.ts +16 -0
- package/lib/src/kysely_types/ameli/Sor.js +3 -0
- package/lib/src/kysely_types/ameli/Sub.d.ts +44 -0
- package/lib/src/kysely_types/ameli/Sub.js +3 -0
- package/lib/src/kysely_types/ameli/TxtAmeli.d.ts +77 -0
- package/lib/src/kysely_types/ameli/TxtAmeli.js +3 -0
- package/lib/src/kysely_types/ameli/Typrect.d.ts +14 -0
- package/lib/src/kysely_types/ameli/Typrect.js +3 -0
- package/lib/src/kysely_types/ameli/Typses.d.ts +12 -0
- package/lib/src/kysely_types/ameli/Typses.js +3 -0
- package/lib/src/kysely_types/ameli/Typsub.d.ts +12 -0
- package/lib/src/kysely_types/ameli/Typsub.js +3 -0
- package/lib/src/kysely_types/ameli/WNivrec.d.ts +12 -0
- package/lib/src/kysely_types/ameli/WNivrec.js +3 -0
- package/lib/src/kysely_types/debats/Database.d.ts +3 -0
- package/lib/src/kysely_types/debats/Database.js +3 -0
- package/lib/src/kysely_types/debats/Debats.d.ts +25 -0
- package/lib/src/kysely_types/debats/Debats.js +3 -0
- package/lib/src/kysely_types/debats/Intdivers.d.ts +22 -0
- package/lib/src/kysely_types/debats/Intdivers.js +3 -0
- package/lib/src/kysely_types/debats/Intpjl.d.ts +22 -0
- package/lib/src/kysely_types/debats/Intpjl.js +3 -0
- package/lib/src/kysely_types/debats/Lecassdeb.d.ts +13 -0
- package/lib/src/kysely_types/debats/Lecassdeb.js +3 -0
- package/lib/src/kysely_types/debats/Secdis.d.ts +27 -0
- package/lib/src/kysely_types/debats/Secdis.js +3 -0
- package/lib/src/kysely_types/debats/Secdivers.d.ts +19 -0
- package/lib/src/kysely_types/debats/Secdivers.js +3 -0
- package/lib/src/kysely_types/debats/SenatSchema.d.ts +18 -0
- package/lib/src/kysely_types/debats/SenatSchema.js +3 -0
- package/lib/src/kysely_types/debats/Syndeb.d.ts +12 -0
- package/lib/src/kysely_types/debats/Syndeb.js +3 -0
- package/lib/src/kysely_types/debats/Typsec.d.ts +14 -0
- package/lib/src/kysely_types/debats/Typsec.js +3 -0
- package/lib/src/kysely_types/dosleg/Amescr.d.ts +13 -0
- package/lib/src/kysely_types/dosleg/Amescr.js +3 -0
- package/lib/src/kysely_types/dosleg/Ass.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Ass.js +3 -0
- package/lib/src/kysely_types/dosleg/Aud.d.ts +19 -0
- package/lib/src/kysely_types/dosleg/Aud.js +3 -0
- package/lib/src/kysely_types/dosleg/Auteur.d.ts +34 -0
- package/lib/src/kysely_types/dosleg/Auteur.js +3 -0
- package/lib/src/kysely_types/dosleg/Ble.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Ble.js +3 -0
- package/lib/src/kysely_types/dosleg/Catrap.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Catrap.js +3 -0
- package/lib/src/kysely_types/dosleg/Corscr.d.ts +17 -0
- package/lib/src/kysely_types/dosleg/Corscr.js +3 -0
- package/lib/src/kysely_types/dosleg/Database.d.ts +3 -0
- package/lib/src/kysely_types/dosleg/Database.js +3 -0
- package/lib/src/kysely_types/dosleg/DateSeance.d.ts +16 -0
- package/lib/src/kysely_types/dosleg/DateSeance.js +3 -0
- package/lib/src/kysely_types/dosleg/Deccoc.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Deccoc.js +3 -0
- package/lib/src/kysely_types/dosleg/Denrap.d.ts +26 -0
- package/lib/src/kysely_types/dosleg/Denrap.js +3 -0
- package/lib/src/kysely_types/dosleg/Doc.d.ts +33 -0
- package/lib/src/kysely_types/dosleg/Doc.js +3 -0
- package/lib/src/kysely_types/dosleg/Docatt.d.ts +16 -0
- package/lib/src/kysely_types/dosleg/Docatt.js +3 -0
- package/lib/src/kysely_types/dosleg/Docsea.d.ts +19 -0
- package/lib/src/kysely_types/dosleg/Docsea.js +3 -0
- package/lib/src/kysely_types/dosleg/Ecr.d.ts +26 -0
- package/lib/src/kysely_types/dosleg/Ecr.js +3 -0
- package/lib/src/kysely_types/dosleg/Etaloi.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Etaloi.js +3 -0
- package/lib/src/kysely_types/dosleg/Evtsea.d.ts +18 -0
- package/lib/src/kysely_types/dosleg/Evtsea.js +3 -0
- package/lib/src/kysely_types/dosleg/Forpub.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Forpub.js +3 -0
- package/lib/src/kysely_types/dosleg/Gen.d.ts +11 -0
- package/lib/src/kysely_types/dosleg/Gen.js +3 -0
- package/lib/src/kysely_types/dosleg/Lecass.d.ts +84 -0
- package/lib/src/kysely_types/dosleg/Lecass.js +3 -0
- package/lib/src/kysely_types/dosleg/Lecassrap.d.ts +15 -0
- package/lib/src/kysely_types/dosleg/Lecassrap.js +3 -0
- package/lib/src/kysely_types/dosleg/Lecture.d.ts +16 -0
- package/lib/src/kysely_types/dosleg/Lecture.js +3 -0
- package/lib/src/kysely_types/dosleg/Lnkrap.d.ts +16 -0
- package/lib/src/kysely_types/dosleg/Lnkrap.js +3 -0
- package/lib/src/kysely_types/dosleg/Loi.d.ts +93 -0
- package/lib/src/kysely_types/dosleg/Loi.js +3 -0
- package/lib/src/kysely_types/dosleg/Loithe.d.ts +13 -0
- package/lib/src/kysely_types/dosleg/Loithe.js +3 -0
- package/lib/src/kysely_types/dosleg/Natloi.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Natloi.js +3 -0
- package/lib/src/kysely_types/dosleg/Org.d.ts +48 -0
- package/lib/src/kysely_types/dosleg/Org.js +3 -0
- package/lib/src/kysely_types/dosleg/Orgnomhis.d.ts +28 -0
- package/lib/src/kysely_types/dosleg/Orgnomhis.js +3 -0
- package/lib/src/kysely_types/dosleg/Orippr.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Orippr.js +3 -0
- package/lib/src/kysely_types/dosleg/Oritxt.d.ts +25 -0
- package/lib/src/kysely_types/dosleg/Oritxt.js +3 -0
- package/lib/src/kysely_types/dosleg/Posvot.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Posvot.js +3 -0
- package/lib/src/kysely_types/dosleg/Qua.d.ts +16 -0
- package/lib/src/kysely_types/dosleg/Qua.js +3 -0
- package/lib/src/kysely_types/dosleg/Rap.d.ts +64 -0
- package/lib/src/kysely_types/dosleg/Rap.js +3 -0
- package/lib/src/kysely_types/dosleg/Raporg.d.ts +13 -0
- package/lib/src/kysely_types/dosleg/Raporg.js +3 -0
- package/lib/src/kysely_types/dosleg/Rapthe.d.ts +13 -0
- package/lib/src/kysely_types/dosleg/Rapthe.js +3 -0
- package/lib/src/kysely_types/dosleg/Rolsig.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Rolsig.js +3 -0
- package/lib/src/kysely_types/dosleg/Scr.d.ts +46 -0
- package/lib/src/kysely_types/dosleg/Scr.js +3 -0
- package/lib/src/kysely_types/dosleg/SenatSchema.d.ts +108 -0
- package/lib/src/kysely_types/dosleg/SenatSchema.js +3 -0
- package/lib/src/kysely_types/dosleg/Ses.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Ses.js +3 -0
- package/lib/src/kysely_types/dosleg/Stavot.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Stavot.js +3 -0
- package/lib/src/kysely_types/dosleg/Texte.d.ts +54 -0
- package/lib/src/kysely_types/dosleg/Texte.js +3 -0
- package/lib/src/kysely_types/dosleg/TexteAncien.d.ts +20 -0
- package/lib/src/kysely_types/dosleg/TexteAncien.js +3 -0
- package/lib/src/kysely_types/dosleg/The.d.ts +14 -0
- package/lib/src/kysely_types/dosleg/The.js +3 -0
- package/lib/src/kysely_types/dosleg/Titsen.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Titsen.js +3 -0
- package/lib/src/kysely_types/dosleg/Typatt.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Typatt.js +3 -0
- package/lib/src/kysely_types/dosleg/Typaut.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Typaut.js +3 -0
- package/lib/src/kysely_types/dosleg/Typdoc.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Typdoc.js +3 -0
- package/lib/src/kysely_types/dosleg/Typevtsea.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Typevtsea.js +3 -0
- package/lib/src/kysely_types/dosleg/Typlec.d.ts +14 -0
- package/lib/src/kysely_types/dosleg/Typlec.js +3 -0
- package/lib/src/kysely_types/dosleg/Typloi.d.ts +26 -0
- package/lib/src/kysely_types/dosleg/Typloi.js +3 -0
- package/lib/src/kysely_types/dosleg/Typorg.d.ts +20 -0
- package/lib/src/kysely_types/dosleg/Typorg.js +3 -0
- package/lib/src/kysely_types/dosleg/Typrap.d.ts +26 -0
- package/lib/src/kysely_types/dosleg/Typrap.js +3 -0
- package/lib/src/kysely_types/dosleg/Typtxt.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Typtxt.js +3 -0
- package/lib/src/kysely_types/dosleg/Typurl.d.ts +12 -0
- package/lib/src/kysely_types/dosleg/Typurl.js +3 -0
- package/lib/src/kysely_types/dosleg/Votsen.d.ts +25 -0
- package/lib/src/kysely_types/dosleg/Votsen.js +3 -0
- package/lib/src/kysely_types/questions/Database.d.ts +3 -0
- package/lib/src/kysely_types/questions/Database.js +3 -0
- package/lib/src/kysely_types/questions/Etatquestion.d.ts +14 -0
- package/lib/src/kysely_types/questions/Etatquestion.js +3 -0
- package/lib/src/kysely_types/questions/Legquestion.d.ts +18 -0
- package/lib/src/kysely_types/questions/Legquestion.js +3 -0
- package/lib/src/kysely_types/questions/Naturequestion.d.ts +15 -0
- package/lib/src/kysely_types/questions/Naturequestion.js +3 -0
- package/lib/src/kysely_types/questions/SenatSchema.d.ts +18 -0
- package/lib/src/kysely_types/questions/SenatSchema.js +3 -0
- package/lib/src/kysely_types/questions/Sortquestion.d.ts +14 -0
- package/lib/src/kysely_types/questions/Sortquestion.js +3 -0
- package/lib/src/kysely_types/questions/TamMinisteres.d.ts +28 -0
- package/lib/src/kysely_types/questions/TamMinisteres.js +3 -0
- package/lib/src/kysely_types/questions/TamQuestions.d.ts +124 -0
- package/lib/src/kysely_types/questions/TamQuestions.js +3 -0
- package/lib/src/kysely_types/questions/TamReponses.d.ts +32 -0
- package/lib/src/kysely_types/questions/TamReponses.js +3 -0
- package/lib/src/kysely_types/questions/The.d.ts +16 -0
- package/lib/src/kysely_types/questions/The.js +3 -0
- package/lib/src/kysely_types/sens/Activite.d.ts +34 -0
- package/lib/src/kysely_types/sens/Activite.js +3 -0
- package/lib/src/kysely_types/sens/ActiviteDelegation.d.ts +15 -0
- package/lib/src/kysely_types/sens/ActiviteDelegation.js +3 -0
- package/lib/src/kysely_types/sens/ActiviteLoi.d.ts +13 -0
- package/lib/src/kysely_types/sens/ActiviteLoi.js +3 -0
- package/lib/src/kysely_types/sens/ActiviteParticipant.d.ts +25 -0
- package/lib/src/kysely_types/sens/ActiviteParticipant.js +3 -0
- package/lib/src/kysely_types/sens/ActiviteSenateur.d.ts +21 -0
- package/lib/src/kysely_types/sens/ActiviteSenateur.js +3 -0
- package/lib/src/kysely_types/sens/ActivitesLiees.d.ts +10 -0
- package/lib/src/kysely_types/sens/ActivitesLiees.js +3 -0
- package/lib/src/kysely_types/sens/Actpro.d.ts +16 -0
- package/lib/src/kysely_types/sens/Actpro.js +3 -0
- package/lib/src/kysely_types/sens/Adresse.d.ts +39 -0
- package/lib/src/kysely_types/sens/Adresse.js +3 -0
- package/lib/src/kysely_types/sens/Asster.d.ts +18 -0
- package/lib/src/kysely_types/sens/Asster.js +3 -0
- package/lib/src/kysely_types/sens/Bur.d.ts +46 -0
- package/lib/src/kysely_types/sens/Bur.js +3 -0
- package/lib/src/kysely_types/sens/CategorieActivite.d.ts +13 -0
- package/lib/src/kysely_types/sens/CategorieActivite.js +3 -0
- package/lib/src/kysely_types/sens/Com.d.ts +48 -0
- package/lib/src/kysely_types/sens/Com.js +3 -0
- package/lib/src/kysely_types/sens/Csp.d.ts +22 -0
- package/lib/src/kysely_types/sens/Csp.js +3 -0
- package/lib/src/kysely_types/sens/Database.d.ts +3 -0
- package/lib/src/kysely_types/sens/Database.js +3 -0
- package/lib/src/kysely_types/sens/Delega.d.ts +46 -0
- package/lib/src/kysely_types/sens/Delega.js +3 -0
- package/lib/src/kysely_types/sens/Design.d.ts +33 -0
- package/lib/src/kysely_types/sens/Design.js +3 -0
- package/lib/src/kysely_types/sens/Designoep.d.ts +36 -0
- package/lib/src/kysely_types/sens/Designoep.js +3 -0
- package/lib/src/kysely_types/sens/Designorg.d.ts +39 -0
- package/lib/src/kysely_types/sens/Designorg.js +3 -0
- package/lib/src/kysely_types/sens/Dpt.d.ts +54 -0
- package/lib/src/kysely_types/sens/Dpt.js +3 -0
- package/lib/src/kysely_types/sens/Dptele.d.ts +35 -0
- package/lib/src/kysely_types/sens/Dptele.js +3 -0
- package/lib/src/kysely_types/sens/Dpttypman.d.ts +14 -0
- package/lib/src/kysely_types/sens/Dpttypman.js +3 -0
- package/lib/src/kysely_types/sens/Ele.d.ts +35 -0
- package/lib/src/kysely_types/sens/Ele.js +3 -0
- package/lib/src/kysely_types/sens/Elucan.d.ts +50 -0
- package/lib/src/kysely_types/sens/Elucan.js +3 -0
- package/lib/src/kysely_types/sens/Eludep.d.ts +49 -0
- package/lib/src/kysely_types/sens/Eludep.js +3 -0
- package/lib/src/kysely_types/sens/Eludiv.d.ts +47 -0
- package/lib/src/kysely_types/sens/Eludiv.js +3 -0
- package/lib/src/kysely_types/sens/Elueur.d.ts +47 -0
- package/lib/src/kysely_types/sens/Elueur.js +3 -0
- package/lib/src/kysely_types/sens/Elureg.d.ts +48 -0
- package/lib/src/kysely_types/sens/Elureg.js +3 -0
- package/lib/src/kysely_types/sens/Elusen.d.ts +52 -0
- package/lib/src/kysely_types/sens/Elusen.js +3 -0
- package/lib/src/kysely_types/sens/Eluter.d.ts +47 -0
- package/lib/src/kysely_types/sens/Eluter.js +3 -0
- package/lib/src/kysely_types/sens/Elutit.d.ts +38 -0
- package/lib/src/kysely_types/sens/Elutit.js +3 -0
- package/lib/src/kysely_types/sens/Eluvil.d.ts +48 -0
- package/lib/src/kysely_types/sens/Eluvil.js +3 -0
- package/lib/src/kysely_types/sens/Etadebman.d.ts +34 -0
- package/lib/src/kysely_types/sens/Etadebman.js +3 -0
- package/lib/src/kysely_types/sens/Etafinman.d.ts +34 -0
- package/lib/src/kysely_types/sens/Etafinman.js +3 -0
- package/lib/src/kysely_types/sens/Etasen.d.ts +34 -0
- package/lib/src/kysely_types/sens/Etasen.js +3 -0
- package/lib/src/kysely_types/sens/FonactParticipant.d.ts +16 -0
- package/lib/src/kysely_types/sens/FonactParticipant.js +3 -0
- package/lib/src/kysely_types/sens/Foncom.d.ts +40 -0
- package/lib/src/kysely_types/sens/Foncom.js +3 -0
- package/lib/src/kysely_types/sens/Fondelega.d.ts +40 -0
- package/lib/src/kysely_types/sens/Fondelega.js +3 -0
- package/lib/src/kysely_types/sens/Fongrppol.d.ts +40 -0
- package/lib/src/kysely_types/sens/Fongrppol.js +3 -0
- package/lib/src/kysely_types/sens/Fongrpsen.d.ts +27 -0
- package/lib/src/kysely_types/sens/Fongrpsen.js +3 -0
- package/lib/src/kysely_types/sens/Fonmemcom.d.ts +37 -0
- package/lib/src/kysely_types/sens/Fonmemcom.js +3 -0
- package/lib/src/kysely_types/sens/Fonmemdelega.d.ts +37 -0
- package/lib/src/kysely_types/sens/Fonmemdelega.js +3 -0
- package/lib/src/kysely_types/sens/Fonmemgrppol.d.ts +35 -0
- package/lib/src/kysely_types/sens/Fonmemgrppol.js +3 -0
- package/lib/src/kysely_types/sens/Fonmemgrpsen.d.ts +32 -0
- package/lib/src/kysely_types/sens/Fonmemgrpsen.js +3 -0
- package/lib/src/kysely_types/sens/Fonmemorg.d.ts +41 -0
- package/lib/src/kysely_types/sens/Fonmemorg.js +3 -0
- package/lib/src/kysely_types/sens/Fonorg.d.ts +40 -0
- package/lib/src/kysely_types/sens/Fonorg.js +3 -0
- package/lib/src/kysely_types/sens/Grppol.d.ts +46 -0
- package/lib/src/kysely_types/sens/Grppol.js +3 -0
- package/lib/src/kysely_types/sens/Grpsenami.d.ts +55 -0
- package/lib/src/kysely_types/sens/Grpsenami.js +3 -0
- package/lib/src/kysely_types/sens/Libcom.d.ts +36 -0
- package/lib/src/kysely_types/sens/Libcom.js +3 -0
- package/lib/src/kysely_types/sens/Libdelega.d.ts +34 -0
- package/lib/src/kysely_types/sens/Libdelega.js +3 -0
- package/lib/src/kysely_types/sens/Libgrppol.d.ts +36 -0
- package/lib/src/kysely_types/sens/Libgrppol.js +3 -0
- package/lib/src/kysely_types/sens/Libgrpsen.d.ts +28 -0
- package/lib/src/kysely_types/sens/Libgrpsen.js +3 -0
- package/lib/src/kysely_types/sens/Liborg.d.ts +34 -0
- package/lib/src/kysely_types/sens/Liborg.js +3 -0
- package/lib/src/kysely_types/sens/Mel.d.ts +19 -0
- package/lib/src/kysely_types/sens/Mel.js +3 -0
- package/lib/src/kysely_types/sens/Memcom.d.ts +37 -0
- package/lib/src/kysely_types/sens/Memcom.js +3 -0
- package/lib/src/kysely_types/sens/Memdelega.d.ts +38 -0
- package/lib/src/kysely_types/sens/Memdelega.js +3 -0
- package/lib/src/kysely_types/sens/Memextpar.d.ts +56 -0
- package/lib/src/kysely_types/sens/Memextpar.js +3 -0
- package/lib/src/kysely_types/sens/Memgrppol.d.ts +38 -0
- package/lib/src/kysely_types/sens/Memgrppol.js +3 -0
- package/lib/src/kysely_types/sens/Memgrpsen.d.ts +30 -0
- package/lib/src/kysely_types/sens/Memgrpsen.js +3 -0
- package/lib/src/kysely_types/sens/Memorg.d.ts +42 -0
- package/lib/src/kysely_types/sens/Memorg.js +3 -0
- package/lib/src/kysely_types/sens/Minind.d.ts +46 -0
- package/lib/src/kysely_types/sens/Minind.js +3 -0
- package/lib/src/kysely_types/sens/Mismin.d.ts +17 -0
- package/lib/src/kysely_types/sens/Mismin.js +3 -0
- package/lib/src/kysely_types/sens/Missen.d.ts +17 -0
- package/lib/src/kysely_types/sens/Missen.js +3 -0
- package/lib/src/kysely_types/sens/Moddes.d.ts +30 -0
- package/lib/src/kysely_types/sens/Moddes.js +3 -0
- package/lib/src/kysely_types/sens/Nation.d.ts +26 -0
- package/lib/src/kysely_types/sens/Nation.js +3 -0
- package/lib/src/kysely_types/sens/Nationgrpsen.d.ts +31 -0
- package/lib/src/kysely_types/sens/Nationgrpsen.js +3 -0
- package/lib/src/kysely_types/sens/Org.d.ts +46 -0
- package/lib/src/kysely_types/sens/Org.js +3 -0
- package/lib/src/kysely_types/sens/Orgext.d.ts +72 -0
- package/lib/src/kysely_types/sens/Orgext.js +3 -0
- package/lib/src/kysely_types/sens/Orgthe.d.ts +12 -0
- package/lib/src/kysely_types/sens/Orgthe.js +3 -0
- package/lib/src/kysely_types/sens/Pcs.d.ts +15 -0
- package/lib/src/kysely_types/sens/Pcs.js +3 -0
- package/lib/src/kysely_types/sens/Pcs24.d.ts +15 -0
- package/lib/src/kysely_types/sens/Pcs24.js +3 -0
- package/lib/src/kysely_types/sens/Pcs42.d.ts +15 -0
- package/lib/src/kysely_types/sens/Pcs42.js +3 -0
- package/lib/src/kysely_types/sens/Pcs8.d.ts +12 -0
- package/lib/src/kysely_types/sens/Pcs8.js +3 -0
- package/lib/src/kysely_types/sens/Pcscatpro.d.ts +15 -0
- package/lib/src/kysely_types/sens/Pcscatpro.js +3 -0
- package/lib/src/kysely_types/sens/Poicon.d.ts +20 -0
- package/lib/src/kysely_types/sens/Poicon.js +3 -0
- package/lib/src/kysely_types/sens/Qua.d.ts +30 -0
- package/lib/src/kysely_types/sens/Qua.js +3 -0
- package/lib/src/kysely_types/sens/Reg.d.ts +38 -0
- package/lib/src/kysely_types/sens/Reg.js +3 -0
- package/lib/src/kysely_types/sens/Sen.d.ts +66 -0
- package/lib/src/kysely_types/sens/Sen.js +3 -0
- package/lib/src/kysely_types/sens/SenatSchema.d.ts +198 -0
- package/lib/src/kysely_types/sens/SenatSchema.js +3 -0
- package/lib/src/kysely_types/sens/Senbur.d.ts +41 -0
- package/lib/src/kysely_types/sens/Senbur.js +3 -0
- package/lib/src/kysely_types/sens/Sennom.d.ts +32 -0
- package/lib/src/kysely_types/sens/Sennom.js +3 -0
- package/lib/src/kysely_types/sens/Senurl.d.ts +35 -0
- package/lib/src/kysely_types/sens/Senurl.js +3 -0
- package/lib/src/kysely_types/sens/Stajur.d.ts +19 -0
- package/lib/src/kysely_types/sens/Stajur.js +3 -0
- package/lib/src/kysely_types/sens/Telephone.d.ts +21 -0
- package/lib/src/kysely_types/sens/Telephone.js +3 -0
- package/lib/src/kysely_types/sens/Temval.d.ts +14 -0
- package/lib/src/kysely_types/sens/Temval.js +3 -0
- package/lib/src/kysely_types/sens/Territ.d.ts +25 -0
- package/lib/src/kysely_types/sens/Territ.js +3 -0
- package/lib/src/kysely_types/sens/Titele.d.ts +32 -0
- package/lib/src/kysely_types/sens/Titele.js +3 -0
- package/lib/src/kysely_types/sens/Typadr.d.ts +20 -0
- package/lib/src/kysely_types/sens/Typadr.js +3 -0
- package/lib/src/kysely_types/sens/Typapppol.d.ts +34 -0
- package/lib/src/kysely_types/sens/Typapppol.js +3 -0
- package/lib/src/kysely_types/sens/Typbister.d.ts +16 -0
- package/lib/src/kysely_types/sens/Typbister.js +3 -0
- package/lib/src/kysely_types/sens/TypeActivite.d.ts +11 -0
- package/lib/src/kysely_types/sens/TypeActivite.js +3 -0
- package/lib/src/kysely_types/sens/TypeActiviteParticipant.d.ts +10 -0
- package/lib/src/kysely_types/sens/TypeActiviteParticipant.js +3 -0
- package/lib/src/kysely_types/sens/TypeActiviteSenateur.d.ts +11 -0
- package/lib/src/kysely_types/sens/TypeActiviteSenateur.js +3 -0
- package/lib/src/kysely_types/sens/TypeCategorie.d.ts +11 -0
- package/lib/src/kysely_types/sens/TypeCategorie.js +3 -0
- package/lib/src/kysely_types/sens/Typele.d.ts +22 -0
- package/lib/src/kysely_types/sens/Typele.js +3 -0
- package/lib/src/kysely_types/sens/Typgrpsen.d.ts +23 -0
- package/lib/src/kysely_types/sens/Typgrpsen.js +3 -0
- package/lib/src/kysely_types/sens/Typman.d.ts +20 -0
- package/lib/src/kysely_types/sens/Typman.js +3 -0
- package/lib/src/kysely_types/sens/Typorg.d.ts +26 -0
- package/lib/src/kysely_types/sens/Typorg.js +3 -0
- package/lib/src/kysely_types/sens/Typurl.d.ts +31 -0
- package/lib/src/kysely_types/sens/Typurl.js +3 -0
- package/lib/src/kysely_types/sens/Typvoi.d.ts +16 -0
- package/lib/src/kysely_types/sens/Typvoi.js +3 -0
- package/lib/src/kysely_types/sens/Zongeo.d.ts +22 -0
- package/lib/src/kysely_types/sens/Zongeo.js +3 -0
- package/lib/src/loaders.d.ts +3 -3
- package/lib/src/loaders.js +1 -1
- package/lib/src/model/agenda.d.ts +1 -1
- package/lib/src/model/commission.d.ts +2 -2
- package/lib/src/model/seance.d.ts +1 -1
- package/lib/src/other_types/agenda.d.ts +45 -0
- package/lib/src/other_types/agenda.js +1 -0
- package/lib/src/other_types/compte_rendu.d.ts +83 -0
- package/lib/src/other_types/compte_rendu.js +1 -0
- package/lib/src/other_types/questions.d.ts +2 -0
- package/lib/src/other_types/questions.js +1 -0
- package/lib/src/other_types/sens.d.ts +8 -0
- package/lib/src/other_types/sens.js +1 -0
- package/lib/src/other_types/sessions.d.ts +6 -0
- package/lib/src/other_types/sessions.js +19 -0
- package/lib/src/other_types/texte.d.ts +72 -0
- package/lib/src/other_types/texte.js +15 -0
- package/lib/src/parsers/texte.d.ts +1 -1
- package/lib/src/parsers/texte.js +1 -1
- package/lib/src/questions.d.ts +53 -0
- package/lib/src/questions.js +1 -0
- package/lib/src/rich_types/agenda.d.ts +45 -0
- package/lib/src/rich_types/agenda.js +1 -0
- package/lib/src/rich_types/ameli.d.ts +70 -0
- package/lib/src/rich_types/ameli.js +1 -0
- package/lib/src/rich_types/compte_rendu.d.ts +83 -0
- package/lib/src/rich_types/compte_rendu.js +1 -0
- package/lib/src/rich_types/debats.d.ts +38 -0
- package/lib/src/rich_types/debats.js +1 -0
- package/lib/src/rich_types/dosleg.d.ts +212 -0
- package/lib/src/rich_types/dosleg.js +193 -0
- package/lib/src/rich_types/questions.d.ts +55 -0
- package/lib/src/rich_types/questions.js +1 -0
- package/lib/src/rich_types/sens.d.ts +104 -0
- package/lib/src/rich_types/sens.js +1 -0
- package/lib/src/rich_types/sessions.d.ts +6 -0
- package/lib/src/rich_types/sessions.js +19 -0
- package/lib/src/rich_types/texte.d.ts +72 -0
- package/lib/src/rich_types/texte.js +15 -0
- package/lib/src/schemas/config.d.ts +9 -0
- package/lib/src/schemas/config.js +10 -0
- package/lib/src/scripts/convert_data.js +6 -6
- package/lib/src/scripts/convert_xml_to_html.js +1 -1
- package/lib/src/scripts/datautil.d.ts +1 -1
- package/lib/src/scripts/retrieve_agenda.js +4 -4
- package/lib/src/scripts/retrieve_cr_commission.js +6 -6
- package/lib/src/scripts/retrieve_cr_seance.d.ts +1 -1
- package/lib/src/scripts/retrieve_cr_seance.js +4 -4
- package/lib/src/scripts/retrieve_documents.d.ts +1 -1
- package/lib/src/scripts/retrieve_documents.js +4 -4
- package/lib/src/scripts/retrieve_open_data.js +73 -9
- package/lib/src/scripts/retrieve_senateurs_photos.js +2 -2
- package/lib/src/scripts/retrieve_videos.js +3 -3
- package/lib/src/scripts/shared/incremental_import_sql.js +22 -7
- package/lib/src/scripts/shared/make_generate_zod_schemas.d.ts +20 -0
- package/lib/src/scripts/shared/make_generate_zod_schemas.js +300 -0
- package/lib/src/scripts/shared/prefixed_tables.d.ts +2 -1
- package/lib/src/scripts/shared/prefixed_tables.js +4 -3
- package/lib/src/scripts/shared/staging_import.d.ts +1 -1
- package/lib/src/scripts/validate_prefixed_tables.js +12 -11
- package/lib/src/scrutins.d.ts +47 -0
- package/lib/src/scrutins.js +1 -0
- package/lib/src/sens.d.ts +104 -0
- package/lib/src/sens.js +1 -0
- package/lib/src/server/agenda.d.ts +6 -0
- package/lib/src/server/agenda.js +148 -0
- package/lib/src/server/ameli.d.ts +2 -0
- package/lib/src/server/ameli.js +153 -0
- package/lib/src/server/commission.d.ts +19 -0
- package/lib/src/server/commission.js +269 -0
- package/lib/src/server/config.d.ts +43 -0
- package/lib/src/server/config.js +37 -0
- package/lib/src/server/conversion_textes.d.ts +11 -0
- package/lib/src/server/conversion_textes.js +320 -0
- package/lib/src/server/databases_postgres.d.ts +32 -0
- package/lib/src/server/databases_postgres.js +50 -0
- package/lib/src/server/datasets.d.ts +38 -0
- package/lib/src/server/datasets.js +247 -0
- package/lib/src/server/debats.d.ts +2 -0
- package/lib/src/server/debats.js +98 -0
- package/lib/src/server/documents.d.ts +3 -0
- package/lib/src/server/documents.js +132 -0
- package/lib/src/server/dosleg.d.ts +2 -0
- package/lib/src/server/dosleg.js +228 -0
- package/lib/src/server/git.d.ts +27 -0
- package/lib/src/server/git.js +251 -0
- package/lib/src/server/index.d.ts +18 -0
- package/lib/src/server/index.js +16 -0
- package/lib/src/server/loaders.d.ts +52 -0
- package/lib/src/server/loaders.js +260 -0
- package/lib/src/server/questions.d.ts +2 -0
- package/lib/src/server/questions.js +89 -0
- package/lib/src/server/scrutins.d.ts +2 -0
- package/lib/src/server/scrutins.js +114 -0
- package/lib/src/server/seance.d.ts +3 -0
- package/lib/src/server/seance.js +267 -0
- package/lib/src/server/sens.d.ts +9 -0
- package/lib/src/server/sens.js +353 -0
- package/lib/src/types/ameli.d.ts +1761 -4
- package/lib/src/types/ameli.js +1074 -1
- package/lib/src/types/debats.d.ts +380 -2
- package/lib/src/types/debats.js +266 -1
- package/lib/src/types/dosleg.d.ts +2953 -69
- package/lib/src/types/dosleg.js +2005 -1
- package/lib/src/types/questions.d.ts +699 -2
- package/lib/src/types/questions.js +493 -1
- package/lib/src/types/sens.d.ts +7842 -7
- package/lib/src/types/sens.js +4691 -1
- package/lib/src/util.d.ts +1 -0
- package/lib/src/util.js +15 -0
- package/lib/src/utils/cr_spliting.d.ts +1 -1
- package/lib/src/utils/cr_spliting.js +2 -2
- package/lib/src/utils/reunion_odj_building.d.ts +2 -2
- package/lib/src/utils/reunion_odj_building.js +2 -2
- package/lib/src/utils/reunion_parsing.d.ts +2 -2
- package/lib/src/utils/scoring.d.ts +1 -1
- package/lib/src/videos/match.d.ts +1 -1
- package/lib/src/videos/pipeline.d.ts +1 -1
- package/lib/src/videos/pipeline.js +1 -1
- package/lib/src/videos/search.d.ts +1 -1
- package/lib/tests/test_iter_load.test.js +1 -1
- package/lib/tests/validatePrefixedTables.test.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +11 -7
|
@@ -3,19 +3,20 @@ import { execFileSync } from "child_process";
|
|
|
3
3
|
import commandLineArgs from "command-line-args";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
5
|
import { formatWithPrettier, makePgTsGenerator, markAsGenerated, processDatabase } from "kanel";
|
|
6
|
-
import {
|
|
6
|
+
import { makeKyselyHook } from "kanel-kysely";
|
|
7
7
|
import path from "path";
|
|
8
8
|
import StreamZip from "node-stream-zip";
|
|
9
9
|
import readline from "readline";
|
|
10
10
|
import { pipeline, Readable } from "stream";
|
|
11
11
|
import { promisify } from "util";
|
|
12
12
|
import * as windows1252 from "windows-1252";
|
|
13
|
-
import config from "../config.js";
|
|
14
|
-
import { getChosenDatasets, getEnabledDatasets } from "../datasets.js";
|
|
13
|
+
import config from "../server/config.js";
|
|
14
|
+
import { getChosenDatasets, getEnabledDatasets } from "../server/datasets.js";
|
|
15
15
|
import { assertExistingDirectory, commonOptions } from "./shared/cli_helpers.js";
|
|
16
16
|
import { buildIncrementalDatasetImportSql, buildNormalizeStagingSchemaSql } from "./shared/incremental_import_sql.js";
|
|
17
|
-
import { buildGeneratedTableManifest, getGeneratedDefinitionPath, getGeneratedTableManifestPath, prefixedName,
|
|
17
|
+
import { buildGeneratedTableManifest, getGeneratedDefinitionPath, getGeneratedTableManifestPath, prefixedName, kanelTypesDir, kyselyTypesDir, senatSchemaName, stagingSchemaName, stripDatasetPrefix, } from "./shared/prefixed_tables.js";
|
|
18
18
|
import { buildEnsureSchemaVersionTableSql, buildIncrementSchemaVersionSql, buildSchemaStructureFingerprintQuery, } from "./shared/schema_version.js";
|
|
19
|
+
import { makeGenerateZodSchemas } from "./shared/make_generate_zod_schemas.js";
|
|
19
20
|
import { buildExportStagingMetadataStatementsQuery } from "./shared/staging_metadata_sql.js";
|
|
20
21
|
import { isCopyFromStdinLine, rewriteLineForStagingImport } from "./shared/staging_import.js";
|
|
21
22
|
const badWindows1252CharacterRegex = /[\u0080-\u009f]/g;
|
|
@@ -29,7 +30,7 @@ const optionsDefinitions = [
|
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
alias: "c",
|
|
32
|
-
help: "create TypeScript interfaces
|
|
33
|
+
help: "create TypeScript interfaces, Zod schemas, and Kysely types from database tables",
|
|
33
34
|
name: "schema",
|
|
34
35
|
type: Boolean,
|
|
35
36
|
},
|
|
@@ -379,11 +380,11 @@ function trimComment(comment) {
|
|
|
379
380
|
return trimmed ? trimmed : undefined;
|
|
380
381
|
}
|
|
381
382
|
async function generateRawTypes(dataset, runtime, prefixedTables) {
|
|
382
|
-
await fs.ensureDir(
|
|
383
|
+
await fs.ensureDir(kanelTypesDir);
|
|
383
384
|
const definitionFilePath = getGeneratedDefinitionPath(dataset.database);
|
|
384
385
|
const manifestFilePath = getGeneratedTableManifestPath(dataset.database);
|
|
385
386
|
const datasetPrefix = `${dataset.database}_`;
|
|
386
|
-
const datasetOutputPath = path.join(
|
|
387
|
+
const datasetOutputPath = path.join(kanelTypesDir, dataset.database);
|
|
387
388
|
const generateZodSchemas = makeGenerateZodSchemas({
|
|
388
389
|
castToSchema: true,
|
|
389
390
|
getZodIdentifierMetadata: (column, details) => ({
|
|
@@ -447,7 +448,7 @@ async function generateRawTypes(dataset, runtime, prefixedTables) {
|
|
|
447
448
|
preRenderHooks: [generateZodSchemas],
|
|
448
449
|
}),
|
|
449
450
|
],
|
|
450
|
-
outputPath:
|
|
451
|
+
outputPath: kanelTypesDir,
|
|
451
452
|
postRenderHooks: [markAsGenerated, formatWithPrettier],
|
|
452
453
|
schemaNames: [senatSchemaName],
|
|
453
454
|
typescriptConfig: {
|
|
@@ -459,6 +460,68 @@ async function generateRawTypes(dataset, runtime, prefixedTables) {
|
|
|
459
460
|
await fs.writeFile(definitionFilePath, generatedDefinition.replace(/\r\n/g, "\n"));
|
|
460
461
|
await fs.writeFile(manifestFilePath, buildGeneratedTableManifest(dataset.database, prefixedTables));
|
|
461
462
|
}
|
|
463
|
+
async function generateKyselyTypes(dataset, runtime) {
|
|
464
|
+
const datasetPrefix = `${dataset.database}_`;
|
|
465
|
+
const datasetOutputDir = path.join(kyselyTypesDir, dataset.database);
|
|
466
|
+
await fs.remove(datasetOutputDir);
|
|
467
|
+
await fs.ensureDir(datasetOutputDir);
|
|
468
|
+
await processDatabase({
|
|
469
|
+
connection: {
|
|
470
|
+
database: runtime.target.name,
|
|
471
|
+
host: runtime.target.host,
|
|
472
|
+
password: runtime.target.password,
|
|
473
|
+
port: runtime.target.port,
|
|
474
|
+
user: runtime.target.user,
|
|
475
|
+
},
|
|
476
|
+
filter: (pgType) => pgType.schemaName === senatSchemaName && pgType.name.startsWith(datasetPrefix),
|
|
477
|
+
generators: [
|
|
478
|
+
makePgTsGenerator({
|
|
479
|
+
filter: (pgType) => pgType.schemaName === senatSchemaName && pgType.name.startsWith(datasetPrefix),
|
|
480
|
+
generateIdentifierType: (column, details, builtinType) => {
|
|
481
|
+
const tableName = stripDatasetPrefix(details.name, dataset.database);
|
|
482
|
+
return {
|
|
483
|
+
...builtinType,
|
|
484
|
+
comment: undefined,
|
|
485
|
+
name: toIdentifierName(tableName, column.name),
|
|
486
|
+
typeDefinition: builtinType.typeDefinition.map((typeDefinition) => typeDefinition.replace(/ & \{ __flavor\?: '[^']+' \}/g, "").replace(/ & \{ __brand: '[^']+' \}/g, "")),
|
|
487
|
+
};
|
|
488
|
+
},
|
|
489
|
+
getMetadata: (details, generateFor, builtinMetadata) => {
|
|
490
|
+
const baseName = toPascalCase(stripDatasetPrefix(details.name, dataset.database));
|
|
491
|
+
const suffix = generateFor === "selector" || generateFor === undefined ? "" : toPascalCase(generateFor);
|
|
492
|
+
const tableComment = trimComment(details.comment);
|
|
493
|
+
return {
|
|
494
|
+
...builtinMetadata,
|
|
495
|
+
comment: tableComment ? [tableComment] : undefined,
|
|
496
|
+
exportAs: generateFor === "selector" ? "default" : "named",
|
|
497
|
+
name: `${baseName}${suffix}`,
|
|
498
|
+
path: path.join(datasetOutputDir, baseName),
|
|
499
|
+
};
|
|
500
|
+
},
|
|
501
|
+
getPropertyMetadata: (property, _details, _generateFor, builtinMetadata) => {
|
|
502
|
+
const comment = trimComment(property.comment);
|
|
503
|
+
return {
|
|
504
|
+
...builtinMetadata,
|
|
505
|
+
comment: comment ? [comment] : undefined,
|
|
506
|
+
};
|
|
507
|
+
},
|
|
508
|
+
preRenderHooks: [
|
|
509
|
+
makeKyselyHook({
|
|
510
|
+
databaseFilename: "Database",
|
|
511
|
+
includeSchemaNameInTableName: false,
|
|
512
|
+
}),
|
|
513
|
+
],
|
|
514
|
+
}),
|
|
515
|
+
],
|
|
516
|
+
outputPath: datasetOutputDir,
|
|
517
|
+
postRenderHooks: [markAsGenerated, formatWithPrettier],
|
|
518
|
+
schemaNames: [senatSchemaName],
|
|
519
|
+
typescriptConfig: {
|
|
520
|
+
enumStyle: "literal-union",
|
|
521
|
+
tsModuleFormat: "esm",
|
|
522
|
+
},
|
|
523
|
+
});
|
|
524
|
+
}
|
|
462
525
|
async function downloadFile(url, dest) {
|
|
463
526
|
const response = await fetch(url);
|
|
464
527
|
if (!response.ok) {
|
|
@@ -602,13 +665,14 @@ async function retrieveDataset(dataDir, dataset, options, runtime) {
|
|
|
602
665
|
}
|
|
603
666
|
}
|
|
604
667
|
if (options["schema"]) {
|
|
605
|
-
await fs.ensureDir(
|
|
668
|
+
await fs.ensureDir(kanelTypesDir);
|
|
606
669
|
if (!options["silent"]) {
|
|
607
670
|
console.log(`Creating TypeScript definitions from prefixed ${senatSchemaName} tables ` +
|
|
608
671
|
`for '${dataset.database}' in database '${runtime.target.name}'...`);
|
|
609
672
|
}
|
|
610
673
|
const prefixedTables = listPrefixedTables(dataset, dataDir, options, runtime);
|
|
611
674
|
await generateRawTypes(dataset, runtime, prefixedTables);
|
|
675
|
+
await generateKyselyTypes(dataset, runtime);
|
|
612
676
|
}
|
|
613
677
|
}
|
|
614
678
|
function buildRuntimeContext() {
|
|
@@ -6,8 +6,8 @@ import path from "path";
|
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
// import stream from "stream"
|
|
8
8
|
// import util from "util"
|
|
9
|
-
import * as git from "../git.js";
|
|
10
|
-
import { findActif as findActifSenateurs } from "../
|
|
9
|
+
import * as git from "../server/git.js";
|
|
10
|
+
import { findActif as findActifSenateurs } from "../server/sens.js";
|
|
11
11
|
import { slugify } from "../strings.js";
|
|
12
12
|
import { assertExistingDirectory, commonOptions } from "./shared/cli_helpers.js";
|
|
13
13
|
const optionsDefinitions = [
|
|
@@ -3,9 +3,9 @@ import commandLineArgs from "command-line-args";
|
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
import fsp from "fs/promises";
|
|
5
5
|
import path from "path";
|
|
6
|
-
import * as git from "../git.js";
|
|
7
|
-
import { AGENDA_FOLDER, iterLoadSenatAgendas } from "../loaders.js";
|
|
8
|
-
import { getSessionsFromStart, UNDEFINED_SESSION } from "../
|
|
6
|
+
import * as git from "../server/git.js";
|
|
7
|
+
import { AGENDA_FOLDER, iterLoadSenatAgendas } from "../server/loaders.js";
|
|
8
|
+
import { getSessionsFromStart, UNDEFINED_SESSION } from "../other_types/sessions.js";
|
|
9
9
|
import { assertExistingDirectory, commonOptions } from "./shared/cli_helpers.js";
|
|
10
10
|
import { getAgendaSegmentTimecodes, buildSenatVodMasterM3u8FromNvs } from "../utils/nvs-parsing.js";
|
|
11
11
|
import { epochToParisDateTime, isAmbiguousTimeOriginal, toTargetEpoch } from "../utils/date.js";
|
|
@@ -10,7 +10,8 @@ function buildConfiguredMergeKeysValues(datasetName, mergeKeys) {
|
|
|
10
10
|
.sort(([leftTable], [rightTable]) => leftTable.localeCompare(rightTable))
|
|
11
11
|
.map(([tableName, columns]) => {
|
|
12
12
|
const sqlColumns = columns.map((columnName) => `'${escapeSqlLiteral(columnName)}'`).join(", ");
|
|
13
|
-
return `SELECT '${escapeSqlLiteral(prefixedName(datasetName, tableName))}'
|
|
13
|
+
return (`SELECT '${escapeSqlLiteral(prefixedName(datasetName, tableName))}'` +
|
|
14
|
+
` AS tablename, ARRAY[${sqlColumns}]::text[] AS key_columns`);
|
|
14
15
|
})
|
|
15
16
|
.join("\nUNION ALL\n");
|
|
16
17
|
}
|
|
@@ -371,7 +372,10 @@ BEGIN
|
|
|
371
372
|
IF column_row.generated_kind = 's' THEN
|
|
372
373
|
column_definition :=
|
|
373
374
|
column_definition ||
|
|
374
|
-
' GENERATED ALWAYS AS (' ||
|
|
375
|
+
' GENERATED ALWAYS AS (' ||
|
|
376
|
+
replace(column_row.default_expression,
|
|
377
|
+
'${stagingSchema}.', '${senatSchemaName}.') ||
|
|
378
|
+
') STORED';
|
|
375
379
|
ELSIF column_row.identity_kind = 'a' THEN
|
|
376
380
|
column_definition := column_definition || ' GENERATED ALWAYS AS IDENTITY';
|
|
377
381
|
ELSIF column_row.identity_kind = 'd' THEN
|
|
@@ -599,8 +603,12 @@ BEGIN
|
|
|
599
603
|
AND columns.table_name = table_row.tablename;
|
|
600
604
|
|
|
601
605
|
SELECT
|
|
602
|
-
string_agg(
|
|
603
|
-
|
|
606
|
+
string_agg(
|
|
607
|
+
format('%1$I = s.%1$I', columns.column_name),
|
|
608
|
+
', ' ORDER BY columns.ordinal_position),
|
|
609
|
+
string_agg(
|
|
610
|
+
format('t.%1$I IS DISTINCT FROM s.%1$I', columns.column_name),
|
|
611
|
+
' OR ' ORDER BY columns.ordinal_position)
|
|
604
612
|
INTO update_assignments, change_condition
|
|
605
613
|
FROM information_schema.columns columns
|
|
606
614
|
WHERE columns.table_schema = '${escapedStagingSchema}'
|
|
@@ -636,8 +644,12 @@ BEGIN
|
|
|
636
644
|
END IF;
|
|
637
645
|
|
|
638
646
|
SELECT
|
|
639
|
-
'jsonb_build_array(' ||
|
|
640
|
-
|
|
647
|
+
'jsonb_build_array(' ||
|
|
648
|
+
string_agg(format('t.%I', columns.column_name),
|
|
649
|
+
', ' ORDER BY columns.ordinal_position) || ')',
|
|
650
|
+
'jsonb_build_array(' ||
|
|
651
|
+
string_agg(format('s.%I', columns.column_name),
|
|
652
|
+
', ' ORDER BY columns.ordinal_position) || ')'
|
|
641
653
|
INTO target_row_signature_expression, staging_row_signature_expression
|
|
642
654
|
FROM information_schema.columns columns
|
|
643
655
|
WHERE columns.table_schema = '${escapedStagingSchema}'
|
|
@@ -745,7 +757,10 @@ BEGIN
|
|
|
745
757
|
END IF;
|
|
746
758
|
|
|
747
759
|
EXECUTE format(
|
|
748
|
-
'INSERT INTO ${senatSchemaName}.%1$I (%2$s)
|
|
760
|
+
'INSERT INTO ${senatSchemaName}.%1$I (%2$s) ' ||
|
|
761
|
+
'SELECT %3$s FROM %4$I.%1$I s ' ||
|
|
762
|
+
'WHERE NOT EXISTS ' ||
|
|
763
|
+
'(SELECT 1 FROM ${senatSchemaName}.%1$I t WHERE %5$s)',
|
|
749
764
|
table_row.tablename,
|
|
750
765
|
column_list,
|
|
751
766
|
staging_column_list,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TableColumn, TableDetails } from "extract-pg-schema";
|
|
2
|
+
import { type Details, type Path, type PgTsGeneratorContext, type PgTsPreRenderHook, type TypeMap } from "kanel";
|
|
3
|
+
type GenerateFor = "selector" | "initializer" | "mutator" | undefined;
|
|
4
|
+
type ZodSchemaMetadata = {
|
|
5
|
+
comment?: string[];
|
|
6
|
+
name: string;
|
|
7
|
+
path: Path;
|
|
8
|
+
};
|
|
9
|
+
type ZodIdentifierMetadata = {
|
|
10
|
+
comment?: string[];
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
type GenerateZodSchemasConfig = {
|
|
14
|
+
castToSchema?: boolean;
|
|
15
|
+
getZodIdentifierMetadata?: (column: TableColumn, details: TableDetails, context: PgTsGeneratorContext) => ZodIdentifierMetadata;
|
|
16
|
+
getZodSchemaMetadata?: (details: Details, generateFor: GenerateFor, context: PgTsGeneratorContext) => ZodSchemaMetadata;
|
|
17
|
+
zodTypeMap?: TypeMap;
|
|
18
|
+
};
|
|
19
|
+
export declare function makeGenerateZodSchemas(config?: GenerateZodSchemasConfig): PgTsPreRenderHook;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { escapeName, resolveType, useKanelContext, } from "kanel";
|
|
2
|
+
import { defaultGetZodIdentifierMetadata, defaultGetZodSchemaMetadata, defaultZodTypeMap } from "kanel-zod";
|
|
3
|
+
const zImport = {
|
|
4
|
+
asName: undefined,
|
|
5
|
+
importAsType: false,
|
|
6
|
+
isAbsolute: true,
|
|
7
|
+
isDefault: false,
|
|
8
|
+
name: "z",
|
|
9
|
+
path: "zod",
|
|
10
|
+
};
|
|
11
|
+
function appendTsDeclaration(output, path, declaration) {
|
|
12
|
+
const file = output[path];
|
|
13
|
+
if (!file || file.fileType !== "typescript") {
|
|
14
|
+
throw new Error(`Path ${path} is not a typescript file`);
|
|
15
|
+
}
|
|
16
|
+
file.declarations.push(declaration);
|
|
17
|
+
}
|
|
18
|
+
function toMetaQualifier(comment) {
|
|
19
|
+
if (!comment || comment.length === 0) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const description = comment.join(" ").replace(/\n/g, " ");
|
|
23
|
+
return `meta({ description: ${JSON.stringify(description)} })`;
|
|
24
|
+
}
|
|
25
|
+
function generateProperties(details, generateFor, nonCompositeTypeImports, compositeTypeImports, identifierTypeImports, zodTypeMap, context) {
|
|
26
|
+
const properties = details.kind === "compositeType" ? [...details.attributes] : [...details.columns];
|
|
27
|
+
const sortedProperties = context.propertySortFunction ? properties.sort(context.propertySortFunction) : properties;
|
|
28
|
+
return sortedProperties.map((property) => {
|
|
29
|
+
const { comment, name, nullableOverride, optionalOverride, typeOverride } = context.getPropertyMetadata(property, details, generateFor);
|
|
30
|
+
const canBeOptional = property.isNullable || property.defaultValue || property.isIdentity;
|
|
31
|
+
const resolvedType = typeOverride ?? resolveType(property, details);
|
|
32
|
+
let zodType = "z.unknown()";
|
|
33
|
+
const typeImports = [];
|
|
34
|
+
if (typeof resolvedType !== "string" && `${details.schemaName}.${resolvedType.name}` in identifierTypeImports) {
|
|
35
|
+
const typeImport = identifierTypeImports[`${details.schemaName}.${resolvedType.name}`];
|
|
36
|
+
typeImports.push(typeImport);
|
|
37
|
+
zodType = typeImport.name;
|
|
38
|
+
}
|
|
39
|
+
else if (property.type.fullName in zodTypeMap) {
|
|
40
|
+
const mappedType = zodTypeMap[property.type.fullName];
|
|
41
|
+
if (typeof mappedType === "string") {
|
|
42
|
+
zodType = mappedType;
|
|
43
|
+
if ("dimensions" in property) {
|
|
44
|
+
for (let i = property.dimensions || 0; i > 0; i -= 1) {
|
|
45
|
+
zodType = `${zodType}.array()`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
zodType = mappedType.name;
|
|
51
|
+
typeImports.push(...mappedType.typeImports);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (property.type.fullName in nonCompositeTypeImports) {
|
|
55
|
+
const typeImport = nonCompositeTypeImports[property.type.fullName];
|
|
56
|
+
typeImports.push(typeImport);
|
|
57
|
+
zodType = typeImport.name;
|
|
58
|
+
}
|
|
59
|
+
else if (property.type.fullName in compositeTypeImports) {
|
|
60
|
+
const typeImport = compositeTypeImports[property.type.fullName];
|
|
61
|
+
typeImports.push(typeImport);
|
|
62
|
+
zodType = typeImport.name;
|
|
63
|
+
if (property.isArray) {
|
|
64
|
+
zodType = `${zodType}.array()`;
|
|
65
|
+
}
|
|
66
|
+
if (property.isNullable) {
|
|
67
|
+
zodType = `${zodType}.nullable()`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.error(`kanel-zod: Unknown type for ${name}.${property.name}: ${property.type.fullName}`);
|
|
72
|
+
}
|
|
73
|
+
let isOptional;
|
|
74
|
+
if (optionalOverride === undefined) {
|
|
75
|
+
switch (generateFor) {
|
|
76
|
+
case "selector":
|
|
77
|
+
isOptional = false;
|
|
78
|
+
break;
|
|
79
|
+
case "initializer":
|
|
80
|
+
isOptional = Boolean(canBeOptional);
|
|
81
|
+
break;
|
|
82
|
+
case "mutator":
|
|
83
|
+
isOptional = true;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
isOptional = optionalOverride;
|
|
89
|
+
}
|
|
90
|
+
const qualifiers = [];
|
|
91
|
+
if (isOptional) {
|
|
92
|
+
qualifiers.push("optional()");
|
|
93
|
+
}
|
|
94
|
+
if (nullableOverride ?? property.isNullable) {
|
|
95
|
+
qualifiers.push("nullable()");
|
|
96
|
+
}
|
|
97
|
+
const metaQualifier = toMetaQualifier(comment);
|
|
98
|
+
if (metaQualifier) {
|
|
99
|
+
qualifiers.push(metaQualifier);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
name,
|
|
103
|
+
typeImports,
|
|
104
|
+
value: qualifiers.length > 0 ? `${zodType}.${qualifiers.join(".")}` : zodType,
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function buildCompositeDeclaration(details, generateFor, nonCompositeTypeImports, compositeTypeImports, identifierTypeImports, getZodSchemaMetadata, zodTypeMap, castToSchema, context) {
|
|
109
|
+
const { comment, name } = getZodSchemaMetadata(details, generateFor, context);
|
|
110
|
+
const { name: typescriptTypeName } = context.getMetadata(details, generateFor);
|
|
111
|
+
const properties = generateProperties(details, generateFor, nonCompositeTypeImports, compositeTypeImports, identifierTypeImports, zodTypeMap, context);
|
|
112
|
+
const typeImports = [zImport];
|
|
113
|
+
const value = ["z.object({", ...properties.map((property) => ` ${escapeName(property.name)}: ${property.value},`)];
|
|
114
|
+
if (castToSchema) {
|
|
115
|
+
value.push(`}) as unknown as z.Schema<${typescriptTypeName}>`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
value.push("})");
|
|
119
|
+
}
|
|
120
|
+
properties.forEach((property) => {
|
|
121
|
+
typeImports.push(...property.typeImports);
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
comment,
|
|
125
|
+
declarationType: "constant",
|
|
126
|
+
exportAs: "named",
|
|
127
|
+
name,
|
|
128
|
+
type: undefined,
|
|
129
|
+
typeImports,
|
|
130
|
+
value,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function buildIdentifierDeclarations(details, getZodIdentifierMetadata, zodTypeMap, castToSchema, nonCompositeTypeImports, context) {
|
|
134
|
+
if (!context.generateIdentifierType) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const generateIdentifierType = context.generateIdentifierType;
|
|
138
|
+
return details.columns
|
|
139
|
+
.filter((column) => column.isPrimaryKey && !column.reference)
|
|
140
|
+
.map((column) => {
|
|
141
|
+
const typescriptDeclaration = generateIdentifierType(column, details);
|
|
142
|
+
const { comment, name } = getZodIdentifierMetadata(column, details, context);
|
|
143
|
+
let zodType = "z.unknown()";
|
|
144
|
+
const typeImports = [zImport];
|
|
145
|
+
if (column.type.fullName in zodTypeMap) {
|
|
146
|
+
const mappedType = zodTypeMap[column.type.fullName];
|
|
147
|
+
if (typeof mappedType === "string") {
|
|
148
|
+
zodType = mappedType;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
zodType = mappedType.name;
|
|
152
|
+
typeImports.push(...mappedType.typeImports);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else if (column.type.fullName in nonCompositeTypeImports) {
|
|
156
|
+
const typeImport = nonCompositeTypeImports[column.type.fullName];
|
|
157
|
+
zodType = typeImport.name;
|
|
158
|
+
typeImports.push(typeImport);
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
declaration: {
|
|
162
|
+
comment,
|
|
163
|
+
declarationType: "constant",
|
|
164
|
+
exportAs: "named",
|
|
165
|
+
name,
|
|
166
|
+
type: undefined,
|
|
167
|
+
typeImports,
|
|
168
|
+
value: castToSchema
|
|
169
|
+
? `${zodType} as unknown as z.Schema<${typescriptDeclaration.name}>`
|
|
170
|
+
: `${zodType}.transform(value => value as ${typescriptDeclaration.name})`,
|
|
171
|
+
},
|
|
172
|
+
name,
|
|
173
|
+
originalName: typescriptDeclaration.name,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
export function makeGenerateZodSchemas(config = {}) {
|
|
178
|
+
return async (outputAcc, context) => {
|
|
179
|
+
const kanelContext = useKanelContext();
|
|
180
|
+
const output = { ...outputAcc };
|
|
181
|
+
const getZodSchemaMetadata = config.getZodSchemaMetadata ?? defaultGetZodSchemaMetadata;
|
|
182
|
+
const getZodIdentifierMetadata = config.getZodIdentifierMetadata ?? defaultGetZodIdentifierMetadata;
|
|
183
|
+
const zodTypeMap = { ...defaultZodTypeMap, ...(config.zodTypeMap ?? {}) };
|
|
184
|
+
const castToSchema = config.castToSchema ?? true;
|
|
185
|
+
const nonCompositeTypeImports = {};
|
|
186
|
+
const identifierTypeImports = {};
|
|
187
|
+
const compositeTypeImports = {};
|
|
188
|
+
for (const schema of Object.values(kanelContext.schemas)) {
|
|
189
|
+
schema.enums?.forEach((enumDetails) => {
|
|
190
|
+
const { name, path } = getZodSchemaMetadata(enumDetails, undefined, context);
|
|
191
|
+
appendTsDeclaration(output, path, {
|
|
192
|
+
comment: [`Zod schema for ${enumDetails.name}`],
|
|
193
|
+
declarationType: "constant",
|
|
194
|
+
exportAs: "named",
|
|
195
|
+
name,
|
|
196
|
+
type: undefined,
|
|
197
|
+
typeImports: [zImport],
|
|
198
|
+
value: ["z.enum([", ...enumDetails.values.map((value) => ` '${value}',`), "])"],
|
|
199
|
+
});
|
|
200
|
+
nonCompositeTypeImports[`${enumDetails.schemaName}.${enumDetails.name}`] = {
|
|
201
|
+
asName: undefined,
|
|
202
|
+
importAsType: false,
|
|
203
|
+
isAbsolute: false,
|
|
204
|
+
isDefault: false,
|
|
205
|
+
name,
|
|
206
|
+
path,
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
schema.ranges?.forEach((rangeDetails) => {
|
|
210
|
+
const { name, path } = getZodSchemaMetadata(rangeDetails, undefined, context);
|
|
211
|
+
appendTsDeclaration(output, path, {
|
|
212
|
+
comment: [`Zod schema for ${rangeDetails.name}`],
|
|
213
|
+
declarationType: "constant",
|
|
214
|
+
exportAs: "named",
|
|
215
|
+
name,
|
|
216
|
+
type: undefined,
|
|
217
|
+
typeImports: [zImport],
|
|
218
|
+
value: "z.string()",
|
|
219
|
+
});
|
|
220
|
+
nonCompositeTypeImports[`${rangeDetails.schemaName}.${rangeDetails.name}`] = {
|
|
221
|
+
asName: undefined,
|
|
222
|
+
importAsType: false,
|
|
223
|
+
isAbsolute: false,
|
|
224
|
+
isDefault: false,
|
|
225
|
+
name,
|
|
226
|
+
path,
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
schema.domains?.forEach((domainDetails) => {
|
|
230
|
+
const { name, path } = getZodSchemaMetadata(domainDetails, undefined, context);
|
|
231
|
+
const domainType = zodTypeMap[domainDetails.innerType] ?? "z.unknown()";
|
|
232
|
+
appendTsDeclaration(output, path, {
|
|
233
|
+
comment: [`Zod schema for ${domainDetails.name}`],
|
|
234
|
+
declarationType: "constant",
|
|
235
|
+
exportAs: "named",
|
|
236
|
+
name,
|
|
237
|
+
type: undefined,
|
|
238
|
+
typeImports: [zImport, ...(typeof domainType === "string" ? [] : domainType.typeImports)],
|
|
239
|
+
value: typeof domainType === "string" ? domainType : domainType.name,
|
|
240
|
+
});
|
|
241
|
+
nonCompositeTypeImports[`${domainDetails.schemaName}.${domainDetails.name}`] = {
|
|
242
|
+
asName: undefined,
|
|
243
|
+
importAsType: false,
|
|
244
|
+
isAbsolute: false,
|
|
245
|
+
isDefault: false,
|
|
246
|
+
name,
|
|
247
|
+
path,
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
schema.tables?.forEach((tableDetails) => {
|
|
251
|
+
const { path } = getZodSchemaMetadata(tableDetails, undefined, context);
|
|
252
|
+
const declarations = buildIdentifierDeclarations(tableDetails, getZodIdentifierMetadata, zodTypeMap, castToSchema, nonCompositeTypeImports, context);
|
|
253
|
+
declarations.forEach(({ declaration, name, originalName }) => {
|
|
254
|
+
appendTsDeclaration(output, path, declaration);
|
|
255
|
+
identifierTypeImports[`${tableDetails.schemaName}.${originalName}`] = {
|
|
256
|
+
asName: undefined,
|
|
257
|
+
importAsType: false,
|
|
258
|
+
isAbsolute: false,
|
|
259
|
+
isDefault: false,
|
|
260
|
+
name,
|
|
261
|
+
path,
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
[
|
|
266
|
+
...(schema.tables ?? []),
|
|
267
|
+
...(schema.views ?? []),
|
|
268
|
+
...(schema.materializedViews ?? []),
|
|
269
|
+
...(schema.compositeTypes ?? []),
|
|
270
|
+
].forEach((compositeDetails) => {
|
|
271
|
+
const { name, path } = getZodSchemaMetadata(compositeDetails, undefined, context);
|
|
272
|
+
compositeTypeImports[`${compositeDetails.schemaName}.${compositeDetails.name}`] = {
|
|
273
|
+
asName: undefined,
|
|
274
|
+
importAsType: false,
|
|
275
|
+
isAbsolute: false,
|
|
276
|
+
isDefault: false,
|
|
277
|
+
name,
|
|
278
|
+
path,
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
for (const schema of Object.values(kanelContext.schemas)) {
|
|
283
|
+
;
|
|
284
|
+
[
|
|
285
|
+
...(schema.tables ?? []),
|
|
286
|
+
...(schema.views ?? []),
|
|
287
|
+
...(schema.materializedViews ?? []),
|
|
288
|
+
...(schema.compositeTypes ?? []),
|
|
289
|
+
].forEach((compositeDetails) => {
|
|
290
|
+
const { path } = getZodSchemaMetadata(compositeDetails, undefined, context);
|
|
291
|
+
appendTsDeclaration(output, path, buildCompositeDeclaration(compositeDetails, "selector", nonCompositeTypeImports, compositeTypeImports, identifierTypeImports, getZodSchemaMetadata, zodTypeMap, castToSchema, context));
|
|
292
|
+
if (compositeDetails.kind === "table") {
|
|
293
|
+
appendTsDeclaration(output, path, buildCompositeDeclaration(compositeDetails, "initializer", nonCompositeTypeImports, compositeTypeImports, identifierTypeImports, getZodSchemaMetadata, zodTypeMap, castToSchema, context));
|
|
294
|
+
appendTsDeclaration(output, path, buildCompositeDeclaration(compositeDetails, "mutator", nonCompositeTypeImports, compositeTypeImports, identifierTypeImports, getZodSchemaMetadata, zodTypeMap, castToSchema, context));
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
return output;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const senatSchemaName = "senat";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const kanelTypesDir: string;
|
|
3
|
+
export declare const kyselyTypesDir: string;
|
|
3
4
|
export declare function prefixedName(datasetName: string, relationName: string): string;
|
|
4
5
|
export declare function stagingSchemaName(datasetName: string): string;
|
|
5
6
|
export declare function escapeRegExp(text: string): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
export const senatSchemaName = "senat";
|
|
3
|
-
export const
|
|
3
|
+
export const kanelTypesDir = path.resolve("src", "kanel_types");
|
|
4
|
+
export const kyselyTypesDir = path.resolve("src", "kysely_types");
|
|
4
5
|
export function prefixedName(datasetName, relationName) {
|
|
5
6
|
return `${datasetName}_${relationName}`;
|
|
6
7
|
}
|
|
@@ -15,10 +16,10 @@ export function stripDatasetPrefix(relationName, datasetName) {
|
|
|
15
16
|
return relationName.startsWith(datasetPrefix) ? relationName.slice(datasetPrefix.length) : relationName;
|
|
16
17
|
}
|
|
17
18
|
export function getGeneratedDefinitionPath(datasetName) {
|
|
18
|
-
return path.join(
|
|
19
|
+
return path.join(kanelTypesDir, `${datasetName}.ts`);
|
|
19
20
|
}
|
|
20
21
|
export function getGeneratedTableManifestPath(datasetName) {
|
|
21
|
-
return path.join(
|
|
22
|
+
return path.join(kanelTypesDir, `${datasetName}.tables.json`);
|
|
22
23
|
}
|
|
23
24
|
export function buildGeneratedTableManifest(datasetName, prefixedTables) {
|
|
24
25
|
const manifest = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Dataset } from "../../datasets.js";
|
|
1
|
+
import type { Dataset } from "../../server/datasets.js";
|
|
2
2
|
export declare function isCopyFromStdinLine(line: string): boolean;
|
|
3
3
|
export declare function rewriteLineForStagingImport(line: string, dataset: Dataset, stagingSchema: string, inCopyData?: boolean): string;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import commandLineArgs from "command-line-args";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
-
import { sql } from "
|
|
4
|
-
import {
|
|
3
|
+
import { sql } from "kysely";
|
|
4
|
+
import { db } from "../server/databases_postgres.js";
|
|
5
|
+
import { getChosenDatasets, getEnabledDatasets } from "../server/datasets.js";
|
|
5
6
|
import { categoriesOption, silentOption } from "./shared/cli_helpers.js";
|
|
6
7
|
import { extractPrefixedTableNamesFromGeneratedManifest, getGeneratedTableManifestPath, senatSchemaName, } from "./shared/prefixed_tables.js";
|
|
7
8
|
const optionsDefinitions = [categoriesOption, silentOption];
|
|
8
9
|
const options = commandLineArgs(optionsDefinitions);
|
|
9
10
|
async function listPrefixedSenatTables(dataset) {
|
|
10
11
|
const prefix = `${dataset.database}_`;
|
|
11
|
-
const
|
|
12
|
-
select tablename
|
|
12
|
+
const result = await sql `
|
|
13
|
+
select tablename
|
|
13
14
|
from pg_tables
|
|
14
15
|
where schemaname = ${senatSchemaName}
|
|
15
16
|
and tablename like ${prefix + "%"}
|
|
16
17
|
order by tablename
|
|
17
|
-
|
|
18
|
-
return rows.map(({
|
|
18
|
+
`.execute(db);
|
|
19
|
+
return result.rows.map(({ tablename }) => tablename);
|
|
19
20
|
}
|
|
20
21
|
function getGeneratedDefinitionPath(dataset) {
|
|
21
22
|
return getGeneratedTableManifestPath(dataset.database);
|
|
@@ -26,14 +27,14 @@ function listExpectedPrefixedSenatTables(dataset) {
|
|
|
26
27
|
return extractPrefixedTableNamesFromGeneratedManifest(manifest, dataset.database);
|
|
27
28
|
}
|
|
28
29
|
async function listColumns(schema, relationName) {
|
|
29
|
-
const
|
|
30
|
+
const result = await sql `
|
|
30
31
|
select column_name
|
|
31
32
|
from information_schema.columns
|
|
32
33
|
where table_schema = ${schema}
|
|
33
34
|
and table_name = ${relationName}
|
|
34
35
|
order by ordinal_position
|
|
35
|
-
|
|
36
|
-
return rows.map(({ column_name }) => column_name);
|
|
36
|
+
`.execute(db);
|
|
37
|
+
return result.rows.map(({ column_name }) => column_name);
|
|
37
38
|
}
|
|
38
39
|
async function validateDataset(dataset) {
|
|
39
40
|
const issues = [];
|
|
@@ -86,7 +87,7 @@ async function validatePrefixedTables() {
|
|
|
86
87
|
console.error(`- ${issue}`);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
await
|
|
90
|
+
await db.destroy();
|
|
90
91
|
if (hasErrors) {
|
|
91
92
|
process.exit(1);
|
|
92
93
|
}
|
|
@@ -95,7 +96,7 @@ async function validatePrefixedTables() {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
validatePrefixedTables().catch(async (error) => {
|
|
98
|
-
await
|
|
99
|
+
await db.destroy();
|
|
99
100
|
console.error(error);
|
|
100
101
|
process.exit(1);
|
|
101
102
|
});
|