@tricoteuses/tisseuse 0.21.1 → 0.21.2

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.
@@ -11,4 +11,6 @@ export { type LegiArticleInfo, LegiResolver, type LegiSectionInfo, type PreloadA
11
11
  export { buildAndInstallTextTitlesInfos, buildTextTitlesInfos, type BuildTextTitlesInfosProgress, type TextTitlesInfoRow, type TextTitlesInfos, } from '../legi/text_titles_infos.js';
12
12
  export { addPositionsToTableOfContentsFile, simplifiedHtmlBillFileToTableOfContentsFile, } from './tables_of_contents.js';
13
13
  export { createLegiResolver } from './legi/resolvers.js';
14
+ export { createJurisprudenceConsultation, type ConsultationDecision, type ConsultationJurisprudence, type IdentiteArticle, type IdentiteDecisionJade, } from './jurisprudence_consultation.js';
15
+ export { createJurisprudenceStore, initializeJurisprudenceStore, type PersistedJade, } from './jurisprudence_store.js';
14
16
  export { readTransformation, writeTransformation, } from './text_parsers/transformers.js';
@@ -0,0 +1,46 @@
1
+ import { TextTitlesInfos } from '../legi/text_titles_infos.js';
2
+ /** Identité d'une représentation JADE, distincte de l'identifiant documentaire. */
3
+ export interface DecisionSource {
4
+ dataset: "JADE";
5
+ path: string;
6
+ id: string;
7
+ revision: string;
8
+ publication: string;
9
+ dateDecision: string;
10
+ titre?: string;
11
+ texte: string;
12
+ }
13
+ export interface DecisionCitation {
14
+ mention: string;
15
+ position: {
16
+ start: number;
17
+ stop: number;
18
+ };
19
+ passage: string;
20
+ articleId: string | null;
21
+ candidats: string[];
22
+ /** La mention désigne un seul article et un seul code explicite. */
23
+ selectionPossible?: boolean;
24
+ redaction: "indéterminée";
25
+ origine: "indéterminée";
26
+ relation: "citation";
27
+ }
28
+ /**
29
+ * Première extraction conservatrice : seul un article avec code explicitement
30
+ * identifié peut être résolu. Le résolveur fournit une identité de disposition,
31
+ * pas une rédaction déterminée par date ; il ne reçoit jamais la date de décision.
32
+ * Les titres de codes doivent avoir été initialisés dans le parseur au préalable.
33
+ * Le texte fourni doit être la représentation adaptée aux droits de l'appelant.
34
+ */
35
+ export declare function extractDecisionCitations({ document, resolve, textTitlesInfos, }: {
36
+ document: DecisionSource;
37
+ textTitlesInfos?: TextTitlesInfos;
38
+ resolve: (reference: {
39
+ codeId: string;
40
+ numero: string;
41
+ }) => Promise<string[]>;
42
+ }): Promise<{
43
+ document: DecisionSource;
44
+ citations: DecisionCitation[];
45
+ perimetre: string;
46
+ }>;
@@ -0,0 +1,55 @@
1
+ import { default as postgres } from 'postgres';
2
+ import { DecisionCitation } from './jurisprudence_citations.js';
3
+ import { ArticleReferenceSelection } from './jurisprudence_jade.js';
4
+ /** Une représentation identifiée par son fonds et son chemin, pas seulement son id. */
5
+ export interface IdentiteDecisionJade {
6
+ dataset: "JADE";
7
+ path: string;
8
+ }
9
+ /** L'identifiant désigne un état précis du référentiel, pas une continuité. */
10
+ export interface IdentiteArticle {
11
+ articleId: string;
12
+ }
13
+ export interface ConsultationJurisprudence {
14
+ decision: {
15
+ dataset: "JADE";
16
+ path: string;
17
+ id: string;
18
+ revision: string;
19
+ titre: string;
20
+ titreNature: "source" | "référence";
21
+ publication: string;
22
+ dateDecision: string;
23
+ };
24
+ citations: DecisionCitation[];
25
+ couverture: {
26
+ perimetre: string;
27
+ traiteLe: string;
28
+ fraicheur: "non-verifiee";
29
+ };
30
+ referenceRevision: string;
31
+ selectionReference?: ArticleReferenceSelection;
32
+ selectionsReference?: ArticleReferenceSelection[];
33
+ }
34
+ export type ConsultationDecision = {
35
+ etat: "non-traite";
36
+ } | {
37
+ etat: "capture";
38
+ resultat: ConsultationJurisprudence;
39
+ };
40
+ /**
41
+ * Contrat serveur du pilote, sans autorisation ni activation publique implicite.
42
+ * L'appelant contrôle l'accès à la connexion et au schéma. La fraîcheur des
43
+ * captures n'est pas vérifiée. L'absence de citation ne prouve pas l'exhaustivité.
44
+ */
45
+ export declare function createJurisprudenceConsultation(sql: postgres.Sql, schema: string, options?: {
46
+ maxExtractionsArticle?: number;
47
+ }): Promise<{
48
+ parDecision(identite: IdentiteDecisionJade): Promise<ConsultationDecision>;
49
+ parArticle(identite: IdentiteArticle): Promise<{
50
+ resultats: ConsultationJurisprudence[];
51
+ resultatsPossibles: ConsultationJurisprudence[];
52
+ couverture: "inconnue";
53
+ fraicheur: "non-verifiee";
54
+ }>;
55
+ }>;
@@ -0,0 +1,57 @@
1
+ import { CanutesSql } from '../legi/canutes_sql.js';
2
+ import { TextTitlesInfos } from '../legi/text_titles_infos.js';
3
+ import { DecisionSource } from './jurisprudence_citations.js';
4
+ /** Données importées privées : ce contrat ne constitue pas une copie publique. */
5
+ export interface JadeInput {
6
+ dataset: string;
7
+ path: string;
8
+ id: string;
9
+ juridiction: string;
10
+ dateDec: string;
11
+ titre?: string | null;
12
+ data: unknown;
13
+ }
14
+ export declare class InvalidJadeSourceError extends Error {
15
+ }
16
+ export declare class StaleReferenceSelectionError extends Error {
17
+ }
18
+ export declare function adaptJadeDecision(input: JadeInput): DecisionSource;
19
+ /** Retourne tous les états candidats dans le référentiel observé, sans déduire
20
+ * ni continuité entre rédactions ni rédaction citée de la date de décision.
21
+ * L'appelant ne peut publier un résultat qu'après contrôle de fraîcheur. */
22
+ export declare function createHistoricalArticleResolver(sql: CanutesSql): ({ codeId, numero, }: {
23
+ codeId: string;
24
+ numero: string;
25
+ }) => Promise<string[]>;
26
+ export interface ArticleReferenceSelection {
27
+ dateReference: string;
28
+ articleId: string;
29
+ reference?: {
30
+ dataset: "JADE";
31
+ path: string;
32
+ revision: string;
33
+ position: {
34
+ start: number;
35
+ stop: number;
36
+ };
37
+ mention: string;
38
+ };
39
+ }
40
+ export type ArticleReferenceSelections = ArticleReferenceSelection | ArticleReferenceSelection[];
41
+ /** Capture cohérente, sans garantie de fraîcheur après ce snapshot. Ne pas
42
+ * utiliser ce résultat comme preuve persistée actuelle sans revalidation. */
43
+ export declare function extractJadeFromCanutesSnapshot(db: CanutesSql, path: string, selection?: ArticleReferenceSelections): Promise<{
44
+ selection?: ArticleReferenceSelections | undefined;
45
+ referenceRevision: string;
46
+ document: DecisionSource;
47
+ citations: import('./jurisprudence_citations.js').DecisionCitation[];
48
+ perimetre: string;
49
+ }>;
50
+ export declare function extractJadeDecisionCitations(input: JadeInput, resolve: (reference: {
51
+ codeId: string;
52
+ numero: string;
53
+ }) => Promise<string[]>, textTitlesInfos?: TextTitlesInfos): Promise<{
54
+ document: DecisionSource;
55
+ citations: import('./jurisprudence_citations.js').DecisionCitation[];
56
+ perimetre: string;
57
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { default as postgres } from 'postgres';
2
+ import { extractJadeFromCanutesSnapshot, ArticleReferenceSelections } from './jurisprudence_jade.js';
3
+ type Extraction = Awaited<ReturnType<typeof extractJadeFromCanutesSnapshot>>;
4
+ export type PersistedJade = Extraction & {
5
+ traiteLe: string;
6
+ };
7
+ /** Alimentation bornée à une représentation explicitement identifiée. La
8
+ * migration est une opération séparée : aucun schéma n'est créé ici. */
9
+ export declare function alimenterJurisprudence(sql: postgres.Sql, schema: string, input: {
10
+ dataset: string;
11
+ path: string;
12
+ selection?: ArticleReferenceSelections;
13
+ }): Promise<PersistedJade>;
14
+ /** Stockage de pilote : le schéma et ses droits sont administrés par l'appelant.
15
+ * Les lectures servent la capture sans vérifier sa fraîcheur. */
16
+ export declare function initializeJurisprudenceStore(sql: postgres.Sql, schema: string): Promise<void>;
17
+ export declare function createJurisprudenceStore(sql: postgres.Sql, schema: string, options?: {
18
+ maxExtractionsArticle?: number;
19
+ }): Promise<{
20
+ capture(path: string, selection?: ArticleReferenceSelections): Promise<PersistedJade>;
21
+ /** Sert la dernière capture, qui peut être périmée. */
22
+ consultDecision(path: string): Promise<{
23
+ etat: "non-traite";
24
+ } | {
25
+ etat: "capture";
26
+ resultat: PersistedJade;
27
+ }>;
28
+ /** Consultation bornée des captures, sans contrôle de fraîcheur. */
29
+ consultArticle(articleId: string): Promise<{
30
+ resultats: PersistedJade[];
31
+ resultatsPossibles: PersistedJade[];
32
+ }>;
33
+ byDecision(path: string): Promise<PersistedJade | null>;
34
+ byArticle(articleId: string): Promise<PersistedJade[]>;
35
+ }>;
36
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { TextAst, TextAstArticle, TextAstText, TextAstTextInfos, TextInfosByWordsTree } from './ast.js';
2
2
  import { FragmentPosition } from './fragments.js';
3
+ import { TextTitlesInfos } from '../legi/text_titles_infos.js';
3
4
  export type TextInfosConverter = (infos: TextAstTextInfos, context: TextParserContext) => TextAst | undefined;
4
5
  export type RegExpConverter = (match: RegExpExecArray, context: TextParserContext) => TextAst | undefined;
5
6
  export type TextAstConverter<T extends TextAst> = (ast: T, context: TextParserContext) => TextAst | undefined;
@@ -39,6 +40,8 @@ export declare class TextParserContext {
39
40
  length: number;
40
41
  usedInputs: TextTree | undefined;
41
42
  variables: Record<string, TextAst>;
43
+ /** Catalogue optionnel propre à cette analyse ; absent, utiliser le catalogue historique. */
44
+ textTitlesInfos?: TextTitlesInfos;
42
45
  constructor(input: string, offset?: number);
43
46
  position(): FragmentPosition;
44
47
  remaining(): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tricoteuses/tisseuse",
3
3
  "description": "Find links in/to French legislative documents",
4
- "version": "0.21.1",
4
+ "version": "0.21.2",
5
5
  "keywords": [
6
6
  "Assemblée nationale",
7
7
  "France",
@@ -59,6 +59,7 @@
59
59
  "associate:jorf:commissions": "tsx src/scripts/associate_jorf_textes_with_assemblee_commissions.ts",
60
60
  "associate:jorf:dossiers": "tsx src/scripts/associate_jorf_textes_with_dossiers_legislatifs_assemblee.ts",
61
61
  "audit:doctrinal-references": "tsx src/scripts/audit_doctrinal_references.ts",
62
+ "jurisprudence:pilote": "tsx src/scripts/alimenter_jurisprudence_pilote.ts",
62
63
  "audit:doctrinal-references:check": "tsx src/scripts/audit_doctrinal_references.ts --output /tmp/tisseuse-doctrinal-references-audit.json --baseline audits/doctrinal-references-baseline.json --fail-on-regression",
63
64
  "build": "vite build",
64
65
  "check": "tsc --noEmit",