@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.
Files changed (40) hide show
  1. package/lib/config.js +4 -6
  2. package/lib/databases.js +34 -75
  3. package/lib/datasets.js +20 -28
  4. package/lib/index.js +4 -43
  5. package/lib/loaders.js +56 -74
  6. package/lib/model/ameli.js +8 -11
  7. package/lib/model/dosleg.js +47 -52
  8. package/lib/model/index.js +4 -13
  9. package/lib/model/questions.js +15 -18
  10. package/lib/model/sens.js +65 -71
  11. package/lib/model/texte.js +17 -25
  12. package/lib/model/util.js +13 -21
  13. package/lib/raw_types/ameli.js +1 -2
  14. package/lib/raw_types/debats.js +1 -2
  15. package/lib/raw_types/dosleg.js +1 -2
  16. package/lib/raw_types/questions.js +1 -2
  17. package/lib/raw_types/sens.js +1 -2
  18. package/lib/raw_types_schemats/ameli.js +1 -2
  19. package/lib/raw_types_schemats/debats.js +1 -2
  20. package/lib/raw_types_schemats/dosleg.js +1 -2
  21. package/lib/raw_types_schemats/questions.js +1 -2
  22. package/lib/raw_types_schemats/sens.js +1 -2
  23. package/lib/scripts/convert_data.js +78 -83
  24. package/lib/scripts/datautil.js +9 -13
  25. package/lib/scripts/parse_textes.js +23 -28
  26. package/lib/scripts/retrieve_documents.js +56 -61
  27. package/lib/scripts/retrieve_open_data.js +44 -49
  28. package/lib/scripts/retrieve_senateurs_photos.js +31 -36
  29. package/lib/scripts/shared/cli_helpers.js +9 -12
  30. package/lib/scripts/shared/util.js +7 -15
  31. package/lib/strings.js +4 -10
  32. package/lib/types/ameli.js +5 -8
  33. package/lib/types/debats.js +2 -5
  34. package/lib/types/dosleg.js +28 -31
  35. package/lib/types/questions.js +1 -2
  36. package/lib/types/sens.js +1 -2
  37. package/lib/types/sessions.js +2 -5
  38. package/lib/types/texte.js +2 -5
  39. package/lib/validators/config.js +4 -7
  40. package/package.json +2 -2
@@ -1,7 +1,4 @@
1
- "use strict";
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] = (0, core_1.validateNonEmptyTrimmedString)(data[key]);
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] = (0, core_1.validateChain)((0, core_1.validateOption)([core_1.validateString, core_1.validateStringToNumber], core_1.validateNumber), core_1.validateInteger, (0, core_1.validateTest)((value) => 0 <= value && value <= 65535, "Must be an integer between 0 and 65535"))(data[key]);
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.4",
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
- "./lib/loaders": {
33
+ "./loaders": {
34
34
  "import": "./lib/loaders.js",
35
35
  "types": "./lib/loaders.d.ts"
36
36
  },