@tricoteuses/tisseuse 0.13.8 → 0.13.9
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/README.md +23 -35
- package/dist/{textes-BIJjrNwg.js → html-DhGw-Yqr.js} +3875 -5243
- package/dist/index.js +280 -147
- package/dist/resolver-DZS-DNp6.js +1848 -0
- package/dist/server-f-legi.js +532 -0
- package/dist/server.js +530 -2161
- package/dist/src/lib/extractors/links.d.ts +6 -4
- package/dist/src/lib/f_legi/resolver.d.ts +5 -7
- package/dist/src/lib/index.d.ts +2 -0
- package/dist/src/lib/legi/canutes_resolver.d.ts +5 -6
- package/dist/src/lib/legi/resolver.d.ts +15 -12
- package/dist/src/lib/legi/resolver.test.d.ts +1 -0
- package/dist/src/lib/legi/text_titles_infos.d.ts +26 -0
- package/dist/src/lib/linkers/html.d.ts +15 -4
- package/dist/src/lib/linkers/markdown.d.ts +4 -2
- package/dist/src/lib/server/f_legi/index.d.ts +1 -0
- package/dist/src/lib/server/index.d.ts +2 -1
- package/dist/src/lib/server/legi/resolvers.d.ts +2 -7
- package/dist/src/lib/server/linkers/html.d.ts +4 -2
- package/dist/src/scripts/enrich_senat_documents.d.ts +1 -0
- package/package.json +7 -1
- package/dist/src/lib/f_legi/extractors/links.d.ts +0 -134
- package/dist/src/lib/f_legi/linkers/html.d.ts +0 -51
- package/dist/src/lib/server/f_legi/databases/index.d.ts +0 -2
- package/dist/src/lib/server/f_legi/linkers/html.d.ts +0 -20
- package/dist/src/scripts/f_legi/add_links_to_html_document.d.ts +0 -0
- /package/dist/src/{scripts/extract_texts_titles_infos.d.ts → lib/f_legi/resolver.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -133,46 +133,34 @@ Les documents sans URL, externes au Sénat, sans Akoma Ntoso ou en échec de par
|
|
|
133
133
|
|
|
134
134
|
## Legal reference resolver
|
|
135
135
|
|
|
136
|
-
Tisseuse resolves legal references through
|
|
137
|
-
|
|
138
|
-
`
|
|
136
|
+
Tisseuse resolves legal references through the Canutes-backed `LegiResolver`.
|
|
137
|
+
`LegiResolver` is exported as an abstract class from both
|
|
138
|
+
`@tricoteuses/tisseuse` and `@tricoteuses/tisseuse/server`, so applications can
|
|
139
|
+
provide another storage-backed implementation. At process startup, the Canutes
|
|
140
|
+
resolver reads the title metadata it needs directly from
|
|
141
|
+
`legifrance.texte_version` and builds the parser indexes in memory. Concurrent
|
|
142
|
+
callers share the same preload operation, and the resulting indexes remain fixed
|
|
143
|
+
for the lifetime of the process.
|
|
139
144
|
|
|
140
|
-
|
|
145
|
+
No generated title index belongs in the source tree. Tests that resolve the full
|
|
146
|
+
Légifrance title corpus need access to the configured Canutes database and call
|
|
147
|
+
the same preload operation as production code.
|
|
141
148
|
|
|
142
|
-
|
|
143
|
-
`text_titles_infos.json` file.
|
|
144
|
-
- `canutes`: uses the Canutes database and requires generating
|
|
145
|
-
`src/lib/text_parsers/text_titles_infos.json` before running tests that parse
|
|
146
|
-
or resolve French text titles.
|
|
149
|
+
### `f_legi` server adapter
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
Applications backed by a `f_legi` database can import the optional server-only
|
|
152
|
+
adapter from the same package:
|
|
149
153
|
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
npx tsx src/scripts/parse_assemblee_bill_raw.ts bill.html.raw --resolver f_legi
|
|
153
|
-
```
|
|
154
|
+
```ts
|
|
155
|
+
import { FlegiResolver } from "@tricoteuses/tisseuse/server/f-legi"
|
|
154
156
|
|
|
155
|
-
|
|
156
|
-
the tests:
|
|
157
|
-
|
|
158
|
-
```sh
|
|
159
|
-
npx tsx src/scripts/extract_texts_titles_infos.ts
|
|
160
|
-
npm test
|
|
157
|
+
const resolver = new FlegiResolver(sql)
|
|
161
158
|
```
|
|
162
159
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
If you need to keep the generated file outside the working tree, pass it through
|
|
167
|
-
`TISSEUSE_TEXT_TITLES_INFOS_PATH` or script options instead:
|
|
168
|
-
|
|
169
|
-
```sh
|
|
170
|
-
TISSEUSE_TEXT_TITLES_INFOS_PATH=/path/to/text_titles_infos.json npm test
|
|
171
|
-
npx tsx src/scripts/parse_akoma_ntoso_bill_raw.ts bill.akn.xml.raw --text-titles-infos /path/to/text_titles_infos.json
|
|
172
|
-
```
|
|
160
|
+
The caller owns the PostgreSQL client and its lifecycle. Importing the adapter
|
|
161
|
+
does not open a connection, read environment variables, or preload title data.
|
|
162
|
+
The generic Tisseuse entry points do not load this adapter.
|
|
173
163
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
generated data and is not loaded through Vitest global setup; tests that need it
|
|
178
|
-
preload it explicitly through the selected resolver.
|
|
164
|
+
External adapters can extend the public `LegiResolver` class. The public package
|
|
165
|
+
also exports the resolver option types and `buildAndInstallTextTitlesInfos`, so
|
|
166
|
+
an adapter does not need deep imports into Tisseuse.
|