@tricoteuses/senat 1.3.4 → 1.3.5
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/config.js +4 -6
- package/lib/databases.js +34 -75
- package/lib/datasets.js +20 -28
- package/lib/index.js +4 -43
- package/lib/loaders.js +56 -74
- package/lib/model/ameli.js +8 -11
- package/lib/model/dosleg.js +47 -52
- package/lib/model/index.js +4 -13
- package/lib/model/questions.js +15 -18
- package/lib/model/sens.js +65 -71
- package/lib/model/texte.js +17 -25
- package/lib/model/util.js +13 -21
- package/lib/raw_types/ameli.js +1 -2
- package/lib/raw_types/debats.js +1 -2
- package/lib/raw_types/dosleg.js +1 -2
- package/lib/raw_types/questions.js +1 -2
- package/lib/raw_types/sens.js +1 -2
- package/lib/raw_types_schemats/ameli.js +1 -2
- package/lib/raw_types_schemats/debats.js +1 -2
- package/lib/raw_types_schemats/dosleg.js +1 -2
- package/lib/raw_types_schemats/questions.js +1 -2
- package/lib/raw_types_schemats/sens.js +1 -2
- package/lib/scripts/convert_data.js +78 -83
- package/lib/scripts/datautil.js +9 -13
- package/lib/scripts/parse_textes.js +23 -28
- package/lib/scripts/retrieve_documents.js +56 -61
- package/lib/scripts/retrieve_open_data.js +44 -49
- package/lib/scripts/retrieve_senateurs_photos.js +31 -36
- package/lib/scripts/shared/cli_helpers.js +9 -12
- package/lib/scripts/shared/util.js +7 -15
- package/lib/strings.js +4 -10
- package/lib/types/ameli.js +5 -8
- package/lib/types/debats.js +2 -5
- package/lib/types/dosleg.js +28 -31
- package/lib/types/questions.js +1 -2
- package/lib/types/sens.js +1 -2
- package/lib/types/sessions.js +2 -5
- package/lib/types/texte.js +2 -5
- package/lib/validators/config.js +4 -7
- package/package.json +2 -2
package/lib/validators/config.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateConfig = validateConfig;
|
|
4
|
-
const core_1 = require("@biryani/core");
|
|
1
|
+
import { validateChain, validateInteger, validateNonEmptyTrimmedString, validateNumber, validateOption, validateString, validateStringToNumber, validateTest, } from "@biryani/core";
|
|
5
2
|
function validateDb(data) {
|
|
6
3
|
if (data === null || data === undefined) {
|
|
7
4
|
return [data, "Missing value"];
|
|
@@ -14,7 +11,7 @@ function validateDb(data) {
|
|
|
14
11
|
const remainingKeys = new Set(Object.keys(data));
|
|
15
12
|
for (const key of ["host", "password", "user"]) {
|
|
16
13
|
remainingKeys.delete(key);
|
|
17
|
-
const [value, error] =
|
|
14
|
+
const [value, error] = validateNonEmptyTrimmedString(data[key]);
|
|
18
15
|
data[key] = value;
|
|
19
16
|
if (error !== null) {
|
|
20
17
|
errors[key] = error;
|
|
@@ -23,7 +20,7 @@ function validateDb(data) {
|
|
|
23
20
|
{
|
|
24
21
|
const key = "port";
|
|
25
22
|
remainingKeys.delete(key);
|
|
26
|
-
const [value, error] =
|
|
23
|
+
const [value, error] = validateChain(validateOption([validateString, validateStringToNumber], validateNumber), validateInteger, validateTest((value) => 0 <= value && value <= 65535, "Must be an integer between 0 and 65535"))(data[key]);
|
|
27
24
|
data[key] = value;
|
|
28
25
|
if (error !== null) {
|
|
29
26
|
errors[key] = error;
|
|
@@ -34,7 +31,7 @@ function validateDb(data) {
|
|
|
34
31
|
}
|
|
35
32
|
return [data, Object.keys(errors).length === 0 ? null : errors];
|
|
36
33
|
}
|
|
37
|
-
function validateConfig(data) {
|
|
34
|
+
export function validateConfig(data) {
|
|
38
35
|
if (data === null || data === undefined) {
|
|
39
36
|
return [data, "Missing value"];
|
|
40
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tricoteuses/senat",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Handle French Sénat's open data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"France",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"import": "./lib/index.js",
|
|
31
31
|
"types": "./lib/index.d.ts"
|
|
32
32
|
},
|
|
33
|
-
"./
|
|
33
|
+
"./loaders": {
|
|
34
34
|
"import": "./lib/loaders.js",
|
|
35
35
|
"types": "./lib/loaders.d.ts"
|
|
36
36
|
},
|