@tricoteuses/tisseuse 0.12.10 → 0.13.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.
Files changed (32) hide show
  1. package/README.md +46 -0
  2. package/dist/index.js +143 -1397
  3. package/dist/server.js +2739 -158
  4. package/dist/src/lib/extractors/action_directives.d.ts +84 -22
  5. package/dist/src/lib/extractors/article_portions.d.ts +15 -1
  6. package/dist/src/lib/extractors/references.d.ts +3 -1
  7. package/dist/src/lib/extractors/table_of_contents.d.ts +2 -0
  8. package/dist/src/lib/f_legi/extractors/links.d.ts +134 -0
  9. package/dist/src/lib/f_legi/linkers/html.d.ts +51 -0
  10. package/dist/src/lib/f_legi/resolver.d.ts +54 -0
  11. package/dist/src/lib/index.d.ts +4 -3
  12. package/dist/src/lib/legi/canutes_resolver.d.ts +33 -0
  13. package/dist/src/lib/legi/resolver.d.ts +48 -0
  14. package/dist/src/lib/server/databases/index.d.ts +1 -1
  15. package/dist/src/lib/server/f_legi/databases/index.d.ts +2 -0
  16. package/dist/src/lib/server/f_legi/linkers/html.d.ts +20 -0
  17. package/dist/src/lib/server/index.d.ts +3 -0
  18. package/dist/src/lib/server/legi/resolvers.d.ts +10 -0
  19. package/dist/src/lib/server/parsed_bills.d.ts +105 -0
  20. package/dist/src/lib/server/parsed_bills.test.d.ts +1 -0
  21. package/dist/src/lib/test/text_titles_infos.d.ts +1 -0
  22. package/dist/src/lib/text_parsers/action_directives.d.ts +3 -0
  23. package/dist/src/lib/text_parsers/action_directives.test.d.ts +1 -0
  24. package/dist/src/lib/text_parsers/ast.d.ts +53 -1
  25. package/dist/src/lib/text_parsers/parsers.d.ts +2 -0
  26. package/dist/src/lib/text_parsers/texts.d.ts +1 -0
  27. package/dist/src/lib/timings.d.ts +19 -0
  28. package/dist/src/scripts/f_legi/add_links_to_html_document.d.ts +0 -0
  29. package/dist/src/scripts/parse_akoma_ntoso_bill_raw.d.ts +1 -0
  30. package/dist/src/scripts/parse_assemblee_bill_raw.d.ts +1 -0
  31. package/dist/{html-DAKCS7I8.js → textes-8dVwaLo9.js} +5161 -3078
  32. package/package.json +1 -1
package/README.md CHANGED
@@ -38,3 +38,49 @@ Create a `.env` file to set configuration variables (you can use `example.env` a
38
38
  ```sh
39
39
  npm run configure
40
40
  ```
41
+
42
+ ## Legal reference resolver
43
+
44
+ Tisseuse resolves legal references through a `LegiResolver`. The default
45
+ resolver is `canutes`, which uses the configured Canutes database and a generated
46
+ `text_titles_infos.json` file.
47
+
48
+ There are two supported resolver paths for tests and scripts:
49
+
50
+ - `f_legi`: uses the flat f_legi database and does not need a generated
51
+ `text_titles_infos.json` file.
52
+ - `canutes`: uses the Canutes database and requires generating
53
+ `src/lib/text_parsers/text_titles_infos.json` before running tests that parse
54
+ or resolve French text titles.
55
+
56
+ Use `f_legi` explicitly when you want to run against the flat f_legi database:
57
+
58
+ ```sh
59
+ TISSEUSE_LEGI_RESOLVER=f_legi npm test
60
+ npx tsx src/scripts/parse_assemblee_bill_raw.ts bill.html.raw --resolver f_legi
61
+ ```
62
+
63
+ For the default Canutes resolver, generate the text title index first, then run
64
+ the tests:
65
+
66
+ ```sh
67
+ npx tsx src/scripts/extract_texts_titles_infos.ts
68
+ npm test
69
+ ```
70
+
71
+ This creates `src/lib/text_parsers/text_titles_infos.json`. It is generated from
72
+ the Canutes database, is listed in `.gitignore`, and must never be committed.
73
+
74
+ If you need to keep the generated file outside the working tree, pass it through
75
+ `TISSEUSE_TEXT_TITLES_INFOS_PATH` or script options instead:
76
+
77
+ ```sh
78
+ TISSEUSE_TEXT_TITLES_INFOS_PATH=/path/to/text_titles_infos.json npm test
79
+ npx tsx src/scripts/parse_akoma_ntoso_bill_raw.ts bill.akn.xml.raw --text-titles-infos /path/to/text_titles_infos.json
80
+ ```
81
+
82
+ If no path is supplied, the Canutes resolver first tries
83
+ `src/lib/text_parsers/text_titles_infos.json` from the current working tree, then
84
+ the same generated file in the local tisseuse package source tree. That file is
85
+ generated data and is not loaded through Vitest global setup; tests that need it
86
+ preload it explicitly through the selected resolver.