@tricoteuses/tisseuse 0.21.0 → 0.21.1

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.
@@ -1,4 +1,5 @@
1
1
  import { Sql } from 'postgres';
2
+ import { ReferenceParsingMode } from './references.js';
2
3
  import { LegiResolver } from '../legi/resolver.js';
3
4
  import { TextAstArticle, TextAstDivision, TextAstPosition, TextAstReference, TextAstText } from '../text_parsers/ast.js';
4
5
  import { FragmentPosition, FragmentReverseTransformation } from '../text_parsers/fragments.js';
@@ -146,7 +147,7 @@ type TextLinksIterationDiagnostics = {
146
147
  textLinkCount: number;
147
148
  textLinkMs: number;
148
149
  };
149
- export declare function extractTextLinks({ canutesDb, context, date, includeInternalArticleLinks, legiResolver: providedLegiResolver, logIgnoredReferencesTypes, logPartialReferences, logReferences, state: inputState, transformation, }: {
150
+ export declare function extractTextLinks({ canutesDb, context, date, includeInternalArticleLinks, legiResolver: providedLegiResolver, logIgnoredReferencesTypes, logPartialReferences, logReferences, parsingMode, state: inputState, transformation, }: {
150
151
  canutesDb?: Sql;
151
152
  context: TextParserContext;
152
153
  date: string;
@@ -155,6 +156,7 @@ export declare function extractTextLinks({ canutesDb, context, date, includeInte
155
156
  logIgnoredReferencesTypes?: boolean;
156
157
  logPartialReferences?: boolean;
157
158
  logReferences?: boolean;
159
+ parsingMode?: ReferenceParsingMode;
158
160
  /**
159
161
  * When given, state is modified by this generator, so that the callers
160
162
  * always has the latest state version (and can reuse it for the next article,
@@ -5,8 +5,12 @@ export type ExtractReferencesDiagnostics = {
5
5
  citationCount: number;
6
6
  fastPath: FastPathExtractDiagnostics;
7
7
  };
8
+ export declare const referenceParsingModes: readonly ["document", "references"];
9
+ export type ReferenceParsingMode = (typeof referenceParsingModes)[number];
8
10
  type ExtractReferencesOptions = {
9
11
  diagnostics?: ExtractReferencesDiagnostics;
12
+ /** Opt in to standalone references; document parsing remains the default. */
13
+ parsingMode?: ReferenceParsingMode;
10
14
  overlapWindowForCandidate?: (anchor: string) => number;
11
15
  /** Scoping metadata for flattened standalone quotations; never added to the AST. */
12
16
  onStandaloneCitationReference?: (reference: TextAstReference, citation: TextAstCitation) => void;
@@ -7,7 +7,7 @@ export { formatLongDate } from './dates.js';
7
7
  export { extractBillDefinitions } from './extractors/definitions.js';
8
8
  export { extractActionDirectivesFromHtml, extractActionDirectiveAstsFromText, extractActionDirectivesFromText, resolveActionDirectivesFromHtml, resolveActionDirectivesFromText, type ActionCitation, type ActionDirective, type ActionOperation, type ActionReplacement, type ActionTableTarget, type ResolvedActionDirective, } from './extractors/action_directives.js';
9
9
  export { extractTextLinks, iterReferenceLinks, type ArticleDefinition, type ArticleExternalLink, type ArticleInternalLink, type ArticleLink, type DefinitionOrLink, type DivisionExternalLink, type DivisionLink, type ExtractedLinkDb, type TextEuropeanLink, type TextExternalLink, type TextLink, type TextLinksParserState, } from './extractors/links.js';
10
- export { extractCitationReferences, extractReferences, extractReferencesWithOriginalTransformations, getExtractedReferences, getExtractedReferencesWithOriginalTransformations, } from './extractors/references.js';
10
+ export { extractCitationReferences, extractReferences, extractReferencesWithOriginalTransformations, getExtractedReferences, getExtractedReferencesWithOriginalTransformations, referenceParsingModes, type ReferenceParsingMode, } from './extractors/references.js';
11
11
  export { buildArticlePortionTreeFromHtml, extractPortionSelectors, getLegalPhraseTextBounds, getTableUnitNoteRanges, isArticlePortionStructuralStart, parseArticleSubdivisionMarker, resolvePortionSelector, type ArticlePortionArticle, type ArticlePortionDivision, type ArticlePortionItem, type ArticlePortionAlinea, type ArticlePortionPhrase, type ArticlePortionMatch, type ArticlePortionNode, type ArticleSubdivisionMarker, type PortionSelector, type PortionSelectorStep, } from './extractors/article_portions.js';
12
12
  export { addPositionsToTableOfContentsItems, getExtractedTableOfContentsFromTextBill, getTableOfContentsItems, walkTableOfContents, type TableOfContents, type TableOfContentsArticle, type TableOfContentsArticlePositioned, type TableOfContentsDivision, type TableOfContentsDivisionPositioned, type TableOfContentsItem, type TableOfContentsItemPositioned, type TableOfContentsPositioned, } from './extractors/table_of_contents.js';
13
13
  export { jsonReplacer } from './json.js';
@@ -1,11 +1,12 @@
1
1
  import { CanutesSql } from '../legi/canutes_sql.js';
2
2
  import { DefinitionOrLink, TextLinksParserState } from '../extractors/links.js';
3
+ import { ReferenceParsingMode } from '../extractors/references.js';
3
4
  import { LegiResolver } from '../legi/resolver.js';
4
5
  import { LinkType } from '../links.js';
5
6
  import { FragmentPosition } from '../text_parsers/fragments.js';
6
7
  import { TextParserContext } from '../text_parsers/parsers.js';
7
8
  import { Transformation } from '../text_parsers/transformers.js';
8
- export declare function addLinksToHtml({ canutesDb, excludedHtmlRanges, includeInternalArticleLinks, legiResolver: providedLegiResolver, date, html, linkBaseUrl, linkType, logIgnoredReferencesTypes, logPartialReferences, logReferences, onLink, previousContext, state, }: {
9
+ export declare function addLinksToHtml({ canutesDb, excludedHtmlRanges, includeInternalArticleLinks, legiResolver: providedLegiResolver, date, html, linkBaseUrl, linkType, logIgnoredReferencesTypes, logPartialReferences, logReferences, onLink, parsingMode, previousContext, state, }: {
9
10
  canutesDb?: CanutesSql;
10
11
  excludedHtmlRanges?: FragmentPosition[];
11
12
  includeInternalArticleLinks?: boolean;
@@ -18,6 +19,7 @@ export declare function addLinksToHtml({ canutesDb, excludedHtmlRanges, includeI
18
19
  logPartialReferences?: boolean;
19
20
  logReferences?: boolean;
20
21
  onLink?: (link: DefinitionOrLink, index: number) => Promise<boolean | void>;
22
+ parsingMode?: ReferenceParsingMode;
21
23
  previousContext?: TextParserContext;
22
24
  state?: TextLinksParserState;
23
25
  }): Promise<{
@@ -1,13 +1,15 @@
1
1
  import { CanutesSql } from '../legi/canutes_sql.js';
2
+ import { ReferenceParsingMode } from '../extractors/references.js';
2
3
  import { LegiResolver } from '../legi/resolver.js';
3
4
  import { LinkType } from '../links.js';
4
5
  import { TextParserContext } from '../text_parsers/parsers.js';
5
- export declare function addLinksToMarkdown({ canutesDb, legiResolver: providedLegiResolver, date, linkBaseUrl, linkType, previousContext, text, }: {
6
+ export declare function addLinksToMarkdown({ canutesDb, legiResolver: providedLegiResolver, date, linkBaseUrl, linkType, parsingMode, previousContext, text, }: {
6
7
  canutesDb?: CanutesSql;
7
8
  legiResolver?: LegiResolver;
8
9
  date: string;
9
10
  linkBaseUrl: string;
10
11
  linkType: LinkType;
12
+ parsingMode?: ReferenceParsingMode;
11
13
  previousContext?: TextParserContext;
12
14
  text: string;
13
15
  }): Promise<{
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Sql } from 'postgres';
2
+ export type CanutesRootCidIndexStatus = {
3
+ status: "missing" | "valid" | "invalid";
4
+ name: string | null;
5
+ };
6
+ /** SELECT-only; usable by readers, physical standbys and logical subscribers. */
7
+ export declare function inspectCanutesRootCidIndex(db: Sql): Promise<CanutesRootCidIndexStatus>;
8
+ /** Explicit administration only, outside transactions; never called by a reader/configure. */
9
+ export declare function ensureCanutesRootCidIndex(db: Sql, options?: {
10
+ repairInvalid?: boolean;
11
+ }): Promise<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.0",
4
+ "version": "0.21.1",
5
5
  "keywords": [
6
6
  "Assemblée nationale",
7
7
  "France",
@@ -66,6 +66,8 @@
66
66
  "configure:postgres:assemblee-triggers": "tsx src/scripts/configure_postgres_assemblee_document_triggers.ts",
67
67
  "configure:postgres:senat-triggers": "tsx src/scripts/configure_postgres_senat_document_triggers.ts",
68
68
  "configure:postgres:legi-resolver": "tsx src/scripts/configure_postgres_legi_resolver.ts",
69
+ "configure:postgres:legi-root-cid-index": "tsx src/scripts/configure_postgres_root_cid_index.ts",
70
+ "test:postgres:legi-root-cid-index": "vitest run src/lib/legi/canutes_root_cid_index.integration.test.ts",
69
71
  "warm:postgres:legi-titles": "tsx src/scripts/warm_canutes_text_titles_cache.ts",
70
72
  "test:postgres:legi-cache": "tsx src/scripts/test_canutes_titles_cache.ts",
71
73
  "profile:canutes-bill": "tsx src/scripts/profile_canutes_bill.ts",