Improve format of liens in database

This commit is contained in:
Emmanuel 2024-05-12 23:36:27 +02:00
parent b846817fbb
commit b7504d1947
10 changed files with 146 additions and 106 deletions

194
package-lock.json generated
View file

@ -35,7 +35,7 @@
"autoprefixer": "^10.4.7", "autoprefixer": "^10.4.7",
"daisyui": "^4.4.22", "daisyui": "^4.4.22",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"eslint": "^8.16.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.28.0", "eslint-plugin-svelte": "^2.28.0",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",
@ -1173,22 +1173,22 @@
} }
}, },
"node_modules/@tricoteuses/assemblee/node_modules/glob": { "node_modules/@tricoteuses/assemblee/node_modules/glob": {
"version": "10.3.12", "version": "10.3.15",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.15.tgz",
"integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "integrity": "sha512-0c6RlJt1TICLyvJYIApxb8GsXoai0KUP7AxKKAtsYXdgJR1mGEUa7DgwShbdk1nly0PYoZj01xd4hzbq3fsjpw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"foreground-child": "^3.1.0", "foreground-child": "^3.1.0",
"jackspeak": "^2.3.6", "jackspeak": "^2.3.6",
"minimatch": "^9.0.1", "minimatch": "^9.0.1",
"minipass": "^7.0.4", "minipass": "^7.0.4",
"path-scurry": "^1.10.2" "path-scurry": "^1.11.0"
}, },
"bin": { "bin": {
"glob": "dist/esm/bin.mjs" "glob": "dist/esm/bin.mjs"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.18"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
@ -1382,6 +1382,58 @@
} }
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/type-utils": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz",
"integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "7.8.0",
"@typescript-eslint/utils": "7.8.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz",
"integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.15",
"@types/semver": "^7.5.8",
"@typescript-eslint/scope-manager": "7.8.0",
"@typescript-eslint/types": "7.8.0",
"@typescript-eslint/typescript-estree": "7.8.0",
"semver": "^7.6.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
}
},
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "7.8.0", "version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz",
@ -1427,33 +1479,6 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
} }
}, },
"node_modules/@typescript-eslint/type-utils": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz",
"integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "7.8.0",
"@typescript-eslint/utils": "7.8.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "7.8.0", "version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz",
@ -1495,31 +1520,6 @@
} }
} }
}, },
"node_modules/@typescript-eslint/utils": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz",
"integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.15",
"@types/semver": "^7.5.8",
"@typescript-eslint/scope-manager": "7.8.0",
"@typescript-eslint/types": "7.8.0",
"@typescript-eslint/typescript-estree": "7.8.0",
"semver": "^7.6.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
}
},
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "7.8.0", "version": "7.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz",
@ -1926,9 +1926,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001616", "version": "1.0.30001617",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001616.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz",
"integrity": "sha512-RHVYKov7IcdNjVHJFNY/78RdG4oGVjbayxv8u5IO74Wv7Hlq4PnJE6mo/OjFijjVFNy5ijnCt6H3IIo4t+wfEw==", "integrity": "sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -2515,9 +2515,9 @@
"dev": true "dev": true
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.759", "version": "1.4.763",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.759.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.763.tgz",
"integrity": "sha512-qZJc+zsuI+/5UjOSFnpkJBwwLMH1AZgyKqJ7LUNnRsB7v/cDjMu9DvXgp9kH6PTTZxjnPXGp2Uhurw+2Ll4Hjg==", "integrity": "sha512-k4J8NrtJ9QrvHLRo8Q18OncqBCB7tIUyqxRcJnlonQ0ioHKYB988GcDFF3ZePmnb8eHEopDs/wPHR/iGAFgoUQ==",
"dev": true "dev": true
}, },
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
@ -2725,9 +2725,9 @@
} }
}, },
"node_modules/eslint-plugin-svelte": { "node_modules/eslint-plugin-svelte": {
"version": "2.38.0", "version": "2.39.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.38.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.39.0.tgz",
"integrity": "sha512-IwwxhHzitx3dr0/xo0z4jjDlb2AAHBPKt+juMyKKGTLlKi1rZfA4qixMwnveU20/JTHyipM6keX4Vr7LZFYc9g==", "integrity": "sha512-FXktBLXsrxbA+6ZvJK2z/sQOrUKyzSg3fNWK5h0reSCjr2fjAsc9ai/s/JvSl4Hgvz3nYVtTIMwarZH5RcB7BA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
@ -2735,13 +2735,13 @@
"debug": "^4.3.4", "debug": "^4.3.4",
"eslint-compat-utils": "^0.5.0", "eslint-compat-utils": "^0.5.0",
"esutils": "^2.0.3", "esutils": "^2.0.3",
"known-css-properties": "^0.30.0", "known-css-properties": "^0.31.0",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"postcss-load-config": "^3.1.4", "postcss-load-config": "^3.1.4",
"postcss-safe-parser": "^6.0.0", "postcss-safe-parser": "^6.0.0",
"postcss-selector-parser": "^6.0.16", "postcss-selector-parser": "^6.0.16",
"semver": "^7.6.0", "semver": "^7.6.0",
"svelte-eslint-parser": ">=0.35.0 <1.0.0" "svelte-eslint-parser": ">=0.36.0 <1.0.0"
}, },
"engines": { "engines": {
"node": "^14.17.0 || >=16.0.0" "node": "^14.17.0 || >=16.0.0"
@ -3348,9 +3348,9 @@
} }
}, },
"node_modules/get-tsconfig": { "node_modules/get-tsconfig": {
"version": "4.7.4", "version": "4.7.5",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.4.tgz", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz",
"integrity": "sha512-ofbkKj+0pjXjhejr007J/fLf+sW+8H7K5GCm+msC8q3IpvgjobpyPqSRFemNyIMxklC0zeJpi7VDFna19FacvQ==", "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"resolve-pkg-maps": "^1.0.0" "resolve-pkg-maps": "^1.0.0"
@ -4154,9 +4154,9 @@
} }
}, },
"node_modules/known-css-properties": { "node_modules/known-css-properties": {
"version": "0.30.0", "version": "0.31.0",
"resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.30.0.tgz", "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.31.0.tgz",
"integrity": "sha512-VSWXYUnsPu9+WYKkfmJyLKtIvaRJi1kXUqVmBACORXZQxT5oZDsoZ2vQP+bQFDnWtpI/4eq3MLoRMjI2fnLzTQ==", "integrity": "sha512-sBPIUGTNF0czz0mwGGUoKKJC8Q7On1GPbCSFPfyEsfHb2DyBG0Y4QtV+EVWpINSaiGKZblDNuF5AezxSgOhesQ==",
"dev": true "dev": true
}, },
"node_modules/levn": { "node_modules/levn": {
@ -4359,9 +4359,9 @@
} }
}, },
"node_modules/minipass": { "node_modules/minipass": {
"version": "7.1.0", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.1.tgz",
"integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==", "integrity": "sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
@ -4797,16 +4797,16 @@
"dev": true "dev": true
}, },
"node_modules/path-scurry": { "node_modules/path-scurry": {
"version": "1.10.2", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"lru-cache": "^10.2.0", "lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.18"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
@ -5636,9 +5636,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.6.1", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
"integrity": "sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA==", "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
"dev": true, "dev": true,
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
@ -5963,22 +5963,22 @@
} }
}, },
"node_modules/sucrase/node_modules/glob": { "node_modules/sucrase/node_modules/glob": {
"version": "10.3.12", "version": "10.3.15",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.15.tgz",
"integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "integrity": "sha512-0c6RlJt1TICLyvJYIApxb8GsXoai0KUP7AxKKAtsYXdgJR1mGEUa7DgwShbdk1nly0PYoZj01xd4hzbq3fsjpw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"foreground-child": "^3.1.0", "foreground-child": "^3.1.0",
"jackspeak": "^2.3.6", "jackspeak": "^2.3.6",
"minimatch": "^9.0.1", "minimatch": "^9.0.1",
"minipass": "^7.0.4", "minipass": "^7.0.4",
"path-scurry": "^1.10.2" "path-scurry": "^1.11.0"
}, },
"bin": { "bin": {
"glob": "dist/esm/bin.mjs" "glob": "dist/esm/bin.mjs"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.18"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
@ -6056,9 +6056,9 @@
} }
}, },
"node_modules/svelte-eslint-parser": { "node_modules/svelte-eslint-parser": {
"version": "0.35.0", "version": "0.36.0",
"resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.35.0.tgz", "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.36.0.tgz",
"integrity": "sha512-CtbPseajW0gjwEvHiuzYJkPDjAcHz2FaHt540j6RVYrZgnE6xWkzUBodQ4I3nV+G5AS0Svt8K6aIA/CIU9xT2Q==", "integrity": "sha512-/6YmUSr0FAVxW8dXNdIMydBnddPMHzaHirAZ7RrT21XYdgGGZMh0LQG6CZsvAFS4r2Y4ItUuCQc8TQ3urB30mQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"eslint-scope": "^7.2.2", "eslint-scope": "^7.2.2",
@ -6074,7 +6074,7 @@
"url": "https://github.com/sponsors/ota-meshi" "url": "https://github.com/sponsors/ota-meshi"
}, },
"peerDependencies": { "peerDependencies": {
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.112" "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.115"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"svelte": { "svelte": {
@ -6432,9 +6432,9 @@
"dev": true "dev": true
}, },
"node_modules/tsx": { "node_modules/tsx": {
"version": "4.9.3", "version": "4.10.1",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.9.3.tgz", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.10.1.tgz",
"integrity": "sha512-czVbetlILiyJZI5zGlj2kw9vFiSeyra9liPD4nG+Thh4pKTi0AmMEQ8zdV/L2xbIVKrIqif4sUNrsMAOksx9Zg==", "integrity": "sha512-G+CcyTOopwhuI81FU+KpzGN5UBhHgGEDlGt8mHAXKxv8pDGr6WI7hI7aRjTRol5WzFVsSNuzl3ekCZ0eLIJlEQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"esbuild": "~0.20.2", "esbuild": "~0.20.2",

View file

@ -68,7 +68,7 @@
"autoprefixer": "^10.4.7", "autoprefixer": "^10.4.7",
"daisyui": "^4.4.22", "daisyui": "^4.4.22",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"eslint": "^8.16.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.28.0", "eslint-plugin-svelte": "^2.28.0",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",

View file

@ -49,6 +49,7 @@ export {
type JorfTextelrNature, type JorfTextelrNature,
type JorfTextelrOrigine, type JorfTextelrOrigine,
type JorfTexteVersion, type JorfTexteVersion,
type JorfTexteVersionLien,
type JorfTexteVersionLienNature, type JorfTexteVersionLienNature,
type JorfTexteVersionLienType, type JorfTexteVersionLienType,
type JorfTexteVersionNature, type JorfTexteVersionNature,
@ -80,6 +81,7 @@ export {
allLegiTexteVersionOrigines, allLegiTexteVersionOrigines,
type LegiArticle, type LegiArticle,
type LegiArticleEtat, type LegiArticleEtat,
type LegiArticleLien,
type LegiArticleLienArticleOrigine, type LegiArticleLienArticleOrigine,
type LegiArticleLienNature, type LegiArticleLienNature,
type LegiArticleLienType, type LegiArticleLienType,
@ -99,6 +101,7 @@ export {
type LegiTextelrOrigine, type LegiTextelrOrigine,
type LegiTexteVersion, type LegiTexteVersion,
type LegiTexteVersionEtat, type LegiTexteVersionEtat,
type LegiTexteVersionLien,
type LegiTexteVersionLienNature, type LegiTexteVersionLienNature,
type LegiTexteVersionLienType, type LegiTexteVersionLienType,
type LegiTexteVersionNature, type LegiTexteVersionNature,

View file

@ -338,7 +338,7 @@ export interface JorfTexteVersion {
export interface JorfTexteVersionLien { export interface JorfTexteVersionLien {
"#text"?: string "#text"?: string
"@cidtexte"?: string "@cidtexte"?: string // Present if and only if @id is present
"@datesignatexte"?: string "@datesignatexte"?: string
"@id"?: string "@id"?: string
"@naturetexte"?: JorfTexteVersionLienNature "@naturetexte"?: JorfTexteVersionLienNature

View file

@ -68,7 +68,7 @@ export type LegiArticleEtat = (typeof allLegiArticleEtats)[number]
export interface LegiArticleLien { export interface LegiArticleLien {
"#text"?: string "#text"?: string
"@cidtexte"?: string "@cidtexte"?: string // Present if and only if @id is present
"@datesignatexte"?: string "@datesignatexte"?: string
"@id"?: string "@id"?: string
"@naturetexte"?: LegiArticleLienNature "@naturetexte"?: LegiArticleLienNature
@ -320,7 +320,7 @@ export type LegiTexteVersionEtat = (typeof allLegiTexteVersionEtats)[number]
export interface LegiTexteVersionLien { export interface LegiTexteVersionLien {
"#text"?: string "#text"?: string
"@cidtexte"?: string "@cidtexte"?: string // Present if and only if @id is present
"@datesignatexte"?: string "@datesignatexte"?: string
"@id"?: string "@id"?: string
"@naturetexte"?: LegiTexteVersionLienNature "@naturetexte"?: LegiTexteVersionLienNature

View file

@ -5,6 +5,7 @@ export const allSens = ["cible", "source"] as const
export interface ArticleLienDb { export interface ArticleLienDb {
article_id: string article_id: string
cible: boolean cible: boolean
cidtexte: string | null
id: string id: string
typelien: string typelien: string
} }
@ -12,6 +13,7 @@ export interface ArticleLienDb {
export interface TexteVersionLienDb { export interface TexteVersionLienDb {
texte_version_id: string texte_version_id: string
cible: boolean cible: boolean
cidtexte: string | null
id: string id: string
typelien: string typelien: string
} }

View file

@ -1,11 +1,12 @@
import { import {
type Audit, auditEmptyToNull,
auditInteger, auditInteger,
auditRequire, auditRequire,
auditStringToNumber, auditStringToNumber,
auditTest, auditTest,
auditTrimString, auditTrimString,
cleanAudit, cleanAudit,
type Audit,
} from "@auditors/core" } from "@auditors/core"
export function auditConfig( export function auditConfig(
@ -48,6 +49,7 @@ export function auditConfig(
errors, errors,
remainingKeys, remainingKeys,
auditTrimString, auditTrimString,
auditEmptyToNull,
auditRequire, auditRequire,
) )
@ -77,6 +79,7 @@ export function auditDb(
errors, errors,
remainingKeys, remainingKeys,
auditTrimString, auditTrimString,
auditEmptyToNull,
auditRequire, auditRequire,
) )
} }

View file

@ -95,6 +95,15 @@ export async function configureDatabase() {
` `
} }
if (version.number < 10) {
await db`
DROP TABLE article_lien
`
await db`
DROP TABLE texte_version_lien
`
}
// Types // Types
// Tables // Tables
@ -122,6 +131,7 @@ export async function configureDatabase() {
CREATE TABLE IF NOT EXISTS article_lien ( CREATE TABLE IF NOT EXISTS article_lien (
article_id char(20) NOT NULL REFERENCES article(id) ON DELETE CASCADE, article_id char(20) NOT NULL REFERENCES article(id) ON DELETE CASCADE,
cible boolean, cible boolean,
cidtexte char(20),
id char(20) NOT NULL, id char(20) NOT NULL,
typelien text NOT NULL, typelien text NOT NULL,
PRIMARY KEY (article_id, cible, typelien, id) PRIMARY KEY (article_id, cible, typelien, id)
@ -196,6 +206,7 @@ export async function configureDatabase() {
CREATE TABLE IF NOT EXISTS texte_version_lien ( CREATE TABLE IF NOT EXISTS texte_version_lien (
texte_version_id char(20) NOT NULL REFERENCES texte_version(id) ON DELETE CASCADE, texte_version_id char(20) NOT NULL REFERENCES texte_version(id) ON DELETE CASCADE,
cible boolean, cible boolean,
cidtexte char(20),
id char(20) NOT NULL, id char(20) NOT NULL,
typelien text NOT NULL, typelien text NOT NULL,
PRIMARY KEY (texte_version_id, cible, typelien, id) PRIMARY KEY (texte_version_id, cible, typelien, id)
@ -303,7 +314,11 @@ export async function configureDatabase() {
// ` // `
await db` await db`
CREATE INDEX IF NOT EXISTS article_lien_reverse_key CREATE INDEX IF NOT EXISTS article_lien_cidtext_reverse_key
ON article_lien (cidtexte, cible, typelien)
`
await db`
CREATE INDEX IF NOT EXISTS article_lien_id_reverse_key
ON article_lien (id, cible, typelien) ON article_lien (id, cible, typelien)
` `
@ -323,7 +338,12 @@ export async function configureDatabase() {
` `
await db` await db`
CREATE INDEX IF NOT EXISTS texte_version_lien_reverse_key CREATE INDEX IF NOT EXISTS texte_version_lien_cidtext_reverse_key
ON texte_version_lien (cidtexte, cible, typelien)
`
await db`
CREATE INDEX IF NOT EXISTS texte_version_lien_id_reverse_key
ON texte_version_lien (id, cible, typelien) ON texte_version_lien (id, cible, typelien)
` `

View file

@ -23,7 +23,7 @@ export const db = postgres({
port: config.db.port, port: config.db.port,
user: config.db.user, user: config.db.user,
}) })
export const versionNumber = 9 export const versionNumber = 10
/// Check that assemblee database exists and is up to date. /// Check that assemblee database exists and is up to date.
export async function checkAssembleeDb(): Promise<void> { export async function checkAssembleeDb(): Promise<void> {

View file

@ -36,11 +36,12 @@ async function indexLiens(): Promise<void> {
await db< await db<
{ {
cible: boolean cible: boolean
cidtexte: string | null
id: string id: string
typelien: LegiArticleLienType typelien: LegiArticleLienType
}[] }[]
>` >`
SELECT id, cible, typelien SELECT cible, cidtexte, id, typelien
FROM article_lien FROM article_lien
WHERE article_id = ${id} WHERE article_id = ${id}
` `
@ -54,6 +55,7 @@ async function indexLiens(): Promise<void> {
existingLienByHash.delete( existingLienByHash.delete(
objectHash({ objectHash({
cible: lien["@sens"] === "cible", cible: lien["@sens"] === "cible",
cidtexte: lien["@cidtexte"] ?? null,
id: lien["@id"], id: lien["@id"],
typelien: lien["@typelien"], typelien: lien["@typelien"],
}), }),
@ -62,11 +64,13 @@ async function indexLiens(): Promise<void> {
INSERT INTO article_lien ( INSERT INTO article_lien (
article_id, article_id,
cible, cible,
cidtexte,
id, id,
typelien typelien
) VALUES ( ) VALUES (
${id}, ${id},
${lien["@sens"] === "cible"}, ${lien["@sens"] === "cible"},
${lien["@cidtexte"] ?? null},
${lien["@id"]}, ${lien["@id"]},
${lien["@typelien"]} ${lien["@typelien"]}
) )
@ -77,6 +81,7 @@ async function indexLiens(): Promise<void> {
for (const { for (const {
cible, cible,
cidtexte,
id: linkedId, id: linkedId,
typelien, typelien,
} of existingLienByHash.values()) { } of existingLienByHash.values()) {
@ -85,6 +90,7 @@ async function indexLiens(): Promise<void> {
WHERE WHERE
article_id = ${id} article_id = ${id}
AND cible = ${cible} AND cible = ${cible}
AND cidtexte = ${cidtexte}
AND id = ${linkedId} AND id = ${linkedId}
AND typelien = ${typelien} AND typelien = ${typelien}
` `
@ -114,6 +120,7 @@ async function indexLiens(): Promise<void> {
await db< await db<
{ {
cible: boolean cible: boolean
cidtexte: string | null
id: string id: string
typelien: JorfTexteVersionLienType | LegiTexteVersionLienType typelien: JorfTexteVersionLienType | LegiTexteVersionLienType
}[] }[]
@ -132,6 +139,7 @@ async function indexLiens(): Promise<void> {
existingLienByHash.delete( existingLienByHash.delete(
objectHash({ objectHash({
cible: lien["@sens"] === "cible", cible: lien["@sens"] === "cible",
cidtexte: lien["@cidtexte"] ?? null,
id: lien["@id"], id: lien["@id"],
typelien: lien["@typelien"], typelien: lien["@typelien"],
}), }),
@ -140,11 +148,13 @@ async function indexLiens(): Promise<void> {
INSERT INTO texte_version_lien ( INSERT INTO texte_version_lien (
texte_version_id, texte_version_id,
cible, cible,
cidtexte,
id, id,
typelien typelien
) VALUES ( ) VALUES (
${id}, ${id},
${lien["@sens"] === "cible"}, ${lien["@sens"] === "cible"},
${lien["@cidtexte"] ?? null},
${lien["@id"]}, ${lien["@id"]},
${lien["@typelien"]} ${lien["@typelien"]}
) )
@ -155,6 +165,7 @@ async function indexLiens(): Promise<void> {
for (const { for (const {
cible, cible,
cidtexte,
id: linkedId, id: linkedId,
typelien, typelien,
} of existingLienByHash.values()) { } of existingLienByHash.values()) {
@ -163,6 +174,7 @@ async function indexLiens(): Promise<void> {
WHERE WHERE
texte_version_id_id = ${id} texte_version_id_id = ${id}
AND cible = ${cible} AND cible = ${cible}
AND cidtexte = ${cidtexte}
AND id = ${linkedId} AND id = ${linkedId}
AND typelien = ${typelien} AND typelien = ${typelien}
` `