@tricoteuses/tisseuse 0.13.12 → 0.14.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.
Files changed (69) hide show
  1. package/README.md +10 -1
  2. package/dist/{html-DhGw-Yqr.js → html-BuWHzy52.js} +3171 -2933
  3. package/dist/index.js +65 -65
  4. package/dist/{resolver-DZS-DNp6.js → resolver-CLdkzY2R.js} +191 -155
  5. package/dist/server-f-legi.js +26 -17
  6. package/dist/server.js +1264 -564
  7. package/dist/src/lib/extractors/article_portions.d.ts +8 -0
  8. package/dist/src/lib/extractors/links.european.test.d.ts +1 -0
  9. package/dist/src/lib/extractors/portion_references.d.ts +10 -0
  10. package/dist/src/lib/extractors/portion_references.test.d.ts +1 -0
  11. package/dist/src/lib/extractors/quoted_text.d.ts +20 -0
  12. package/dist/src/lib/extractors/table_of_contents.d.ts +18 -8
  13. package/dist/src/lib/extractors/table_of_contents.test.d.ts +1 -0
  14. package/dist/src/lib/index.d.ts +4 -4
  15. package/dist/src/lib/legi/canutes_resolver_europe.test.d.ts +1 -0
  16. package/dist/src/lib/server/administrative_acts_autocompletion.d.ts +20 -0
  17. package/dist/src/lib/server/administrative_acts_autocompletion.test.d.ts +1 -0
  18. package/dist/src/lib/server/ameli_autocompletion.d.ts +17 -0
  19. package/dist/src/lib/server/ameli_autocompletion.test.d.ts +1 -0
  20. package/dist/src/lib/server/bofip_autocompletion.d.ts +22 -0
  21. package/dist/src/lib/server/bofip_autocompletion.test.d.ts +1 -0
  22. package/dist/src/lib/server/boss_autocompletion.d.ts +18 -0
  23. package/dist/src/lib/server/boss_autocompletion.test.d.ts +1 -0
  24. package/dist/src/lib/server/europe_autocompletion.d.ts +18 -0
  25. package/dist/src/lib/server/europe_autocompletion.test.d.ts +1 -0
  26. package/dist/src/lib/server/index.d.ts +2 -1
  27. package/dist/src/lib/server/international_treaties_autocompletion.d.ts +16 -0
  28. package/dist/src/lib/server/international_treaties_autocompletion.test.d.ts +1 -0
  29. package/dist/src/lib/server/local_acts_autocompletion.d.ts +20 -0
  30. package/dist/src/lib/server/local_acts_autocompletion.test.d.ts +1 -0
  31. package/dist/src/lib/server/parsed_amendments.d.ts +71 -0
  32. package/dist/src/lib/server/parsed_amendments.test.d.ts +1 -0
  33. package/dist/src/lib/server/parsed_bills.d.ts +6 -3
  34. package/dist/src/lib/server/raa_autocompletion.d.ts +20 -0
  35. package/dist/src/lib/server/raa_autocompletion.test.d.ts +1 -0
  36. package/dist/src/lib/server/sync_administrative_act_titles.d.ts +16 -0
  37. package/dist/src/lib/server/sync_administrative_act_titles.test.d.ts +1 -0
  38. package/dist/src/lib/server/sync_ameli_titles.d.ts +16 -0
  39. package/dist/src/lib/server/sync_boss_titles.d.ts +16 -0
  40. package/dist/src/lib/server/sync_europe_titles.d.ts +16 -0
  41. package/dist/src/lib/server/sync_international_treaty_titles.d.ts +16 -0
  42. package/dist/src/lib/server/sync_local_act_titles.d.ts +16 -0
  43. package/dist/src/lib/server/sync_local_act_titles.test.d.ts +1 -0
  44. package/dist/src/lib/server/sync_raa_titles.d.ts +16 -0
  45. package/dist/src/lib/server/typesense_blue_green.d.ts +15 -0
  46. package/dist/src/lib/server/typesense_blue_green.test.d.ts +1 -0
  47. package/dist/src/lib/server/typesense_index_lock.d.ts +9 -0
  48. package/dist/src/lib/server/typesense_index_lock.test.d.ts +1 -0
  49. package/dist/src/lib/text_parsers/action_citation_patterns.d.ts +2 -0
  50. package/dist/src/lib/text_parsers/action_citation_patterns.test.d.ts +1 -0
  51. package/dist/src/lib/text_parsers/action_occurrences.d.ts +3 -0
  52. package/dist/src/lib/text_parsers/action_occurrences.test.d.ts +1 -0
  53. package/dist/src/lib/text_parsers/action_position_cues.d.ts +12 -0
  54. package/dist/src/lib/text_parsers/action_position_cues.test.d.ts +1 -0
  55. package/dist/src/lib/text_parsers/action_target_scopes.d.ts +7 -0
  56. package/dist/src/lib/text_parsers/action_words.d.ts +10 -0
  57. package/dist/src/lib/text_parsers/amendment_action_directives.d.ts +17 -0
  58. package/dist/src/lib/text_parsers/articles.d.ts +17 -0
  59. package/dist/src/lib/text_parsers/citations.d.ts +4 -0
  60. package/dist/src/lib/text_parsers/numbers.d.ts +18 -15
  61. package/dist/src/lib/text_parsers/portions.d.ts +2 -2
  62. package/dist/src/lib/text_parsers/repeated_actions.d.ts +4 -0
  63. package/dist/src/lib/text_parsers/repeated_actions.test.d.ts +1 -0
  64. package/dist/src/lib/text_parsers/simplifiers.d.ts +1 -1
  65. package/dist/src/scripts/shared/assemblee_legislature.d.ts +2 -0
  66. package/dist/src/scripts/shared/assemblee_legislature.test.d.ts +1 -0
  67. package/dist/src/scripts/shared/checkpoint_cli_options.d.ts +4 -0
  68. package/dist/src/scripts/shared/checkpoint_cli_options.test.d.ts +1 -0
  69. package/package.json +1 -1
@@ -65,10 +65,18 @@ export type ArticlePortionMatch = {
65
65
  pathStart: ArticlePortionNode[];
66
66
  pathEnd: ArticlePortionNode[];
67
67
  };
68
+ export type ArticleSubdivisionMarker = {
69
+ index?: number;
70
+ level: number;
71
+ prefix: string;
72
+ restText: string;
73
+ token: string;
74
+ };
68
75
  export declare const ITEM_PREFIX_RE: RegExp;
69
76
  export declare const BARE_ITEM_PREFIX_RE: RegExp;
70
77
  export declare function isRomanNumeral(token: string): boolean;
71
78
  export declare function isArticlePortionStructuralStart(text: string): boolean;
79
+ export declare function parseArticleSubdivisionMarker(text: string): ArticleSubdivisionMarker | undefined;
72
80
  export declare function buildArticlePortionTreeFromHtml(html: string): ArticlePortionArticle;
73
81
  export declare function extractPortionSelectors(reference: TextAstReference): PortionSelector[];
74
82
  export declare function resolvePortionSelector(article: ArticlePortionArticle, selector: PortionSelector): ArticlePortionMatch | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { TextAstReference } from '../text_parsers/ast.js';
2
+ export declare function shiftReferencePositions(reference: TextAstReference, offset: number): void;
3
+ export declare function extractPortionReferenceFromPrefix(prefix: string, prefixOffset: number): TextAstReference | null;
4
+ export declare function getReferencePortionSpecificity(reference: TextAstReference): number;
5
+ export declare function getReferencePortionSelectorCount(reference: TextAstReference): number;
6
+ export declare function preferMoreCompletePortionReference(left: TextAstReference | null, right: TextAstReference | null): TextAstReference | null;
7
+ export declare function extractBestPortionReference(references: TextAstReference[]): TextAstReference | null;
8
+ export declare function buildPortionReferenceFromText(text: string, { actionIndex }?: {
9
+ actionIndex?: number;
10
+ }): TextAstReference | null;
@@ -0,0 +1,20 @@
1
+ import { FragmentPosition } from '../text_parsers/fragments.js';
2
+ export type QuotedTextInfo = {
3
+ text: string;
4
+ start: number;
5
+ end: number;
6
+ };
7
+ export type QuoteRange = {
8
+ start: number;
9
+ end: number;
10
+ };
11
+ export declare function normalizeQuotedText(text: string): string;
12
+ export declare function extractQuotedTextInfos(text: string): QuotedTextInfo[];
13
+ export declare function stripQuotedTextSegments(text: string, quotedInfos: Pick<QuotedTextInfo, "start" | "end">[]): string;
14
+ export declare function getQuoteRanges(text: string): QuoteRange[];
15
+ export declare function isInsideRanges(position: FragmentPosition | undefined, ranges: Array<{
16
+ start: number;
17
+ end: number;
18
+ }>): boolean;
19
+ export declare function isInsideQuoteRanges(position: FragmentPosition | undefined, quoteRanges: QuoteRange[]): boolean;
20
+ export declare function replaceQuotedTextWithSpaces(text: string): string;
@@ -3,9 +3,9 @@ import { FragmentPosition, FragmentReverseTransformation } from '../text_parsers
3
3
  import { TextParserContext } from '../text_parsers/parsers.js';
4
4
  import { Transformation } from '../text_parsers/transformers.js';
5
5
  export interface TableOfContents {
6
- articles?: TableOfContentsArticle[];
7
- divisions?: TableOfContentsDivision[];
6
+ items: TableOfContentsItem[];
8
7
  }
8
+ export type TableOfContentsItem = TableOfContentsArticle | TableOfContentsDivision;
9
9
  export interface TableOfContentsArticle {
10
10
  id?: string;
11
11
  line: string;
@@ -16,22 +16,32 @@ export type TableOfContentsArticlePositioned = TableOfContentsArticle & {
16
16
  position: FragmentPosition;
17
17
  };
18
18
  export interface TableOfContentsDivision {
19
- articles?: TableOfContentsArticle[];
20
- divisions?: TableOfContentsDivision[];
21
19
  id?: string;
20
+ items: TableOfContentsItem[];
22
21
  line: string;
23
22
  type: DivisionType;
24
23
  }
25
24
  export type TableOfContentsDivisionPositioned = TableOfContentsDivision & {
26
- articles?: TableOfContentsArticlePositioned[];
27
- divisions?: TableOfContentsDivisionPositioned[];
25
+ items: TableOfContentsItemPositioned[];
28
26
  originalTransformation: FragmentReverseTransformation;
29
27
  position: FragmentPosition;
30
28
  };
29
+ export type TableOfContentsItemPositioned = TableOfContentsArticlePositioned | TableOfContentsDivisionPositioned;
31
30
  export interface TableOfContentsPositioned {
32
- articles?: TableOfContentsArticlePositioned[];
33
- divisions?: TableOfContentsDivisionPositioned[];
31
+ items: TableOfContentsItemPositioned[];
34
32
  }
33
+ /**
34
+ * Return ordered items while remaining compatible with table-of-contents JSON
35
+ * persisted before the `items` representation was introduced.
36
+ *
37
+ * The legacy representation stored articles and divisions separately, so its
38
+ * original interleaving cannot be reconstructed. Keeping its former display
39
+ * order (articles, then divisions) nevertheless lets existing rows remain
40
+ * readable until they are regenerated.
41
+ */
42
+ export declare function getTableOfContentsItems<TItem extends TableOfContentsItem = TableOfContentsItem>(tableOfContents: {
43
+ items: TItem[];
44
+ }): TItem[];
35
45
  export declare function addPositionsToTableOfContentsItems({ context, tableOfContents, transformation, }: {
36
46
  context: TextParserContext;
37
47
  tableOfContents: TableOfContents;
@@ -7,8 +7,8 @@ export { extractBillDefinitions } from './extractors/definitions.js';
7
7
  export { extractActionDirectivesFromHtml, extractActionDirectiveAstsFromText, extractActionDirectivesFromText, resolveActionDirectivesFromHtml, resolveActionDirectivesFromText, type ActionCitation, type ActionDirective, type ActionOperation, type ActionReplacement, type ActionTableTarget, type ResolvedActionDirective, } from './extractors/action_directives.js';
8
8
  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';
9
9
  export { extractCitationReferences, extractReferences, extractReferencesWithOriginalTransformations, getExtractedReferences, getExtractedReferencesWithOriginalTransformations, } from './extractors/references.js';
10
- export { buildArticlePortionTreeFromHtml, extractPortionSelectors, isArticlePortionStructuralStart, resolvePortionSelector, type ArticlePortionArticle, type ArticlePortionDivision, type ArticlePortionItem, type ArticlePortionAlinea, type ArticlePortionPhrase, type ArticlePortionMatch, type ArticlePortionNode, type PortionSelector, type PortionSelectorStep, } from './extractors/article_portions.js';
11
- export { addPositionsToTableOfContentsItems, getExtractedTableOfContentsFromTextBill, walkTableOfContents, type TableOfContents, type TableOfContentsArticle, type TableOfContentsArticlePositioned, type TableOfContentsDivision, type TableOfContentsDivisionPositioned, type TableOfContentsPositioned, } from './extractors/table_of_contents.js';
10
+ export { buildArticlePortionTreeFromHtml, extractPortionSelectors, 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';
11
+ 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';
12
12
  export { jsonReplacer } from './json.js';
13
13
  export { LegiResolver, type LegiArticleInfo, type LegiSectionInfo, type PreloadActiveArticlesByTextIdsOptions, type PreloadTextTitlesInfosOptions, type PreloadTextTitlesInfosProgress, } from './legi/resolver.js';
14
14
  export { buildAndInstallTextTitlesInfos, buildTextTitlesInfos, type BuildTextTitlesInfosProgress, type TextTitlesInfoRow, type TextTitlesInfos, } from './legi/text_titles_infos.js';
@@ -24,9 +24,9 @@ export { getOrLoadDocument, getOrLoadDocumentsByDossierParlementaireUid, getOrLo
24
24
  export { extendLoadedArticle, getOrLoadArticle, getOrLoadJo, getOrLoadSectionTa, getOrLoadSectionsTa, getOrLoadTextelr, getOrLoadTextekali, getOrLoadTexteslr, getOrLoadTextesVersions, getOrLoadTexteVersion, loadArticles, type ArticleExtension, type JorfArticleExtended, type KaliArticleExtended, type LegiArticleExtended, } from './loaders/legifrance.js';
25
25
  export { action } from './text_parsers/actions.js';
26
26
  export { actionDirective } from './text_parsers/action_directives.js';
27
- export { article, articles, definitionArticleDansCitation, definitionArticleDansProjetOuPropositionLoi, designationArticle, listeArticles, nomArticle, nomSpecialArticle, } from './text_parsers/articles.js';
27
+ export { article, articles, definitionArticleDansCitation, definitionArticleDansProjetOuPropositionLoi, designationArticle, extractArticleDefinitionsFromCitation, listeArticles, nomArticle, normalizeBillArticleNumber, parseArticleNumber, parseBillArticleLabel, type ArticleDefinitionInCitation, nomSpecialArticle, type BillArticleLabel, } from './text_parsers/articles.js';
28
28
  export { actionTargets, compoundReferencesSeparators, divisionTypes, europeanLawNatures, frenchLawNatures, internationalLawNatures, isTextAstAtomicReference, isTextAstDivision, isTextAstPortion, lawNatures, localizationAdverbs, portionTypes, type ActionTarget, type CompoundReferencesSeparator, type DivisionType, type EuropeanLawNature, type FrenchLawNature, type InternationalLawNature, type LawNature, type LocalizationAdverb, type PortionType, type TextAst, type TextAstAction, type TextAstActionDirective, type TextAstActionDirectiveOperation, type TextAstActionTargetScope, type TextAstApplicabilityClause, type TextAstArticle, type TextAstAtomicReference, type TextAstBoundedInterval, type TextAstCitation, type TextAstCompoundReference, type TextAstConseilConstitutionnelDecision, type TextAstCountedInterval, type TextAstDivision, type TextAstEnumeration, type TextAstExclusion, type TextAstIncompleteHeader, type TextAstLocalization, type TextAstModificationBlock, type TextAstModificationItem, type TextAstNumber, type TextAstParentChild, type TextAstPortion, type TextAstPosition, type TextAstReference, type TextAstReferenceAndAction, type TextAstText, type TextAstTextIdentification, type TextAstTextInfos, type TextInfosByWordsTree, type TextInfosByWordsTreeNode, } from './text_parsers/ast.js';
29
- export { citation, citationLigne, citationSimple, } from './text_parsers/citations.js';
29
+ export { citation, citationToText, citationLigne, citationSimple, } from './text_parsers/citations.js';
30
30
  export { date, duDate } from './text_parsers/dates.js';
31
31
  export { definitionDivision, designationDivision, division, divisions, natureDivisionSingulier, numeroDivision, } from './text_parsers/divisions.js';
32
32
  export type { FragmentPosition, FragmentReverseTransformation, } from './text_parsers/fragments.js';
@@ -0,0 +1,20 @@
1
+ export interface AdministrativeActTitle {
2
+ id: string;
3
+ family: string;
4
+ title: string;
5
+ type: string | null;
6
+ reference: string | null;
7
+ nor: string | null;
8
+ version_id: string;
9
+ published_on: string | null;
10
+ }
11
+ export declare function administrativeActAutocompleteDocument(row: AdministrativeActTitle): {
12
+ date_day?: number | undefined;
13
+ id: string;
14
+ uid: string;
15
+ text_id: string;
16
+ type: string;
17
+ badge: string;
18
+ autocompletion: string;
19
+ page_path: string;
20
+ };
@@ -0,0 +1,17 @@
1
+ export interface AmeliTitle {
2
+ id: string;
3
+ reference: string;
4
+ title: string;
5
+ version_id: string;
6
+ published_on: string | null;
7
+ }
8
+ export declare function ameliAutocompleteDocument(row: AmeliTitle): {
9
+ date_day?: number | undefined;
10
+ id: string;
11
+ uid: string;
12
+ text_id: string;
13
+ type: string;
14
+ badge: string;
15
+ autocompletion: string;
16
+ page_path: string;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ export declare function loadExistingBofipAutocompleteDocuments({ collectionRecreated, exportDocuments, }: {
2
+ collectionRecreated: boolean;
3
+ exportDocuments: () => Promise<string>;
4
+ }): Promise<Map<string, Record<string, unknown>>>;
5
+ export interface BofipTitle {
6
+ id: string;
7
+ document_legal_id: string;
8
+ kind: string;
9
+ title: string;
10
+ version_id: string;
11
+ publication_date: string | null;
12
+ }
13
+ export declare function bofipAutocompleteDocument(row: BofipTitle): {
14
+ date_day?: number | undefined;
15
+ id: string;
16
+ uid: string;
17
+ text_id: string;
18
+ type: string;
19
+ badge: string;
20
+ autocompletion: string;
21
+ page_path: string;
22
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ export interface BossTitle {
2
+ id: string;
3
+ kind: string;
4
+ title: string;
5
+ version_id: string;
6
+ effective_from: string | null;
7
+ number: string | null;
8
+ }
9
+ export declare function bossAutocompleteDocument(row: BossTitle): {
10
+ date_day?: number | undefined;
11
+ id: string;
12
+ uid: string;
13
+ text_id: string;
14
+ type: string;
15
+ badge: string;
16
+ autocompletion: string;
17
+ page_path: string;
18
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ export interface EuropeTitle {
2
+ celex_id: string;
3
+ document_date: string | null;
4
+ resource_types: string[];
5
+ title: string;
6
+ title_id: string | null;
7
+ version_id: string;
8
+ }
9
+ export declare function europeAutocompleteDocument(row: EuropeTitle): {
10
+ date_day?: number | undefined;
11
+ id: string;
12
+ uid: string;
13
+ text_id: string;
14
+ type: string;
15
+ badge: string;
16
+ autocompletion: string;
17
+ page_path: string;
18
+ };
@@ -1,11 +1,12 @@
1
1
  export { extractAssembleeAmendmentSearchItems, hashAssembleeAmendmentSearchItem, type AssembleeAmendmentSearchItem, type AssembleeAmendmentSearchItemKind, } from './assemblee_amendment_search.js';
2
2
  export { extractAssembleeExposesDesMotifs, hashAssembleeSearchItem, isoDateFromAssembleeDocument, parseAssembleeDocumentSearchContent, type AssembleeSearchItem, type AssembleeSearchItemKind, type ParsedAssembleeDocumentSearchContent, } from './assemblee_document_search.js';
3
3
  export { extractSenatAmendmentSearchItems, hashSenatAmendmentSearchItem, type SenatAmendmentSearchItem, type SenatAmendmentSearchItemKind, } from './senat_amendment_search.js';
4
+ export { parseAmendment, type ParsedAmendmentDiagnostic, type ParsedAmendmentDirective, type ParsedAmendmentDirectiveKind, type ParsedAmendmentDocument, type ParsedAmendmentFragment, type ParsedAmendmentSourceFormat, type ParsedAmendmentTarget, type ParsedAmendmentTargetPosition, type ParsedAmendmentTargetScope, type ParseAmendmentInput, } from './parsed_amendments.js';
4
5
  export { hashSenatSearchItem, parseSenatDocumentSearchContent, type SenatSearchItem, type SenatSearchItemKind, } from './senat_document_search.js';
5
6
  export { isAkomaNtosoXml, resolveSenatAkomaNtosoSource, type SenatAkomaNtosoSource, } from './senat_document_sources.js';
6
7
  export { simplifyWordHtml, simplifyWordHtmlToDocument, type SimplifyHtmlOptions, } from './html_simplifier.js';
7
8
  export { addLinksOrReferencesToHtmlFile } from './linkers/html.js';
8
- export { linkAkomaNtosoBillRaw, linkAssembleeBillRaw, parseAkomaNtosoBillRaw, parseAssembleeBillRaw, renderAkomaNtosoBillRaw, type LinkedBillDocument, type ParsedBillArticle, type ParsedBillBlock, type ParsedBillBlockKind, type ParsedBillDirective, type ParsedBillDocument, type ParsedBillLink, type ParsedBillSourceFormat, type ParsedBillToc, type ParseBillRawOptions, } from './parsed_bills.js';
9
+ export { linkAkomaNtosoBillRaw, linkAssembleeBillRaw, parseAkomaNtosoBillRaw, parseAssembleeBillRaw, renderAkomaNtosoBillRaw, type LinkedBillDocument, type ParsedBillArticle, type ParsedBillBlock, type ParsedBillBlockKind, type ParsedBillDiagnostic, type ParsedBillDirective, type ParsedBillDocument, type ParsedBillLink, type ParsedBillSourceFormat, type ParsedBillToc, type ParseBillRawOptions, } from './parsed_bills.js';
9
10
  export { type LegiArticleInfo, LegiResolver, type LegiSectionInfo, type PreloadActiveArticlesByTextIdsOptions, type PreloadTextTitlesInfosOptions, type PreloadTextTitlesInfosProgress, } from '../legi/resolver.js';
10
11
  export { buildAndInstallTextTitlesInfos, buildTextTitlesInfos, type BuildTextTitlesInfosProgress, type TextTitlesInfoRow, type TextTitlesInfos, } from '../legi/text_titles_infos.js';
11
12
  export { addPositionsToTableOfContentsFile, simplifiedHtmlBillFileToTableOfContentsFile, } from './tables_of_contents.js';
@@ -0,0 +1,16 @@
1
+ export interface InternationalTreatyTitle {
2
+ id: string;
3
+ title: string;
4
+ agreement_type: string | null;
5
+ signature_date: string | null;
6
+ }
7
+ export declare function internationalTreatyAutocompleteDocument(row: InternationalTreatyTitle): {
8
+ date_day?: number | undefined;
9
+ id: string;
10
+ uid: string;
11
+ text_id: string;
12
+ type: string;
13
+ badge: string;
14
+ autocompletion: string;
15
+ page_path: string;
16
+ };
@@ -0,0 +1,20 @@
1
+ export interface LocalActTitle {
2
+ id: string;
3
+ source_id: string;
4
+ publisher: string;
5
+ title: string;
6
+ nature: string | null;
7
+ reference: string | null;
8
+ version_id: string;
9
+ published_on: string | null;
10
+ }
11
+ export declare function localActAutocompleteDocument(row: LocalActTitle): {
12
+ date_day?: number | undefined;
13
+ id: string;
14
+ uid: string;
15
+ text_id: string;
16
+ type: string;
17
+ badge: string;
18
+ autocompletion: string;
19
+ page_path: string;
20
+ };
@@ -0,0 +1,71 @@
1
+ import { TextAstAmendmentActionTargetScope } from '../text_parsers/amendment_action_directives.js';
2
+ import { FragmentPosition, FragmentReverseTransformation } from '../text_parsers/fragments.js';
3
+ import { TextAstReference } from '../text_parsers/ast.js';
4
+ export type ParsedAmendmentSourceFormat = "assemblee-amendement" | "senat-ameli";
5
+ export type ParsedAmendmentTargetPosition = "before_article" | "on_article" | "after_article" | "unknown";
6
+ export type ParsedAmendmentTarget = {
7
+ articleLabel?: string | null;
8
+ targetPosition?: ParsedAmendmentTargetPosition;
9
+ alinea?: number | null;
10
+ alineas?: number[];
11
+ alineaLabel?: string | null;
12
+ subdivisionSourceId?: string | null;
13
+ subdivisionLabel?: string | null;
14
+ subpos?: number | null;
15
+ };
16
+ export type ParsedAmendmentDirectiveKind = "delete_article" | "delete_portion" | "insert_after" | "insert_before" | "insert_article_after" | "insert_article_before" | "replace" | "rewrite_portion";
17
+ export type ParsedAmendmentTargetScope = TextAstAmendmentActionTargetScope;
18
+ export type ParsedAmendmentDirective = {
19
+ kind: ParsedAmendmentDirectiveKind;
20
+ sourceOriginalTransformation?: FragmentReverseTransformation;
21
+ sourcePosition: FragmentPosition;
22
+ sourceText: string;
23
+ target: ParsedAmendmentTarget;
24
+ targetCitation?: ParsedAmendmentFragment;
25
+ targetText?: string;
26
+ targetOccurrence?: "last" | number;
27
+ targetReference?: TextAstReference;
28
+ targetScope?: ParsedAmendmentTargetScope;
29
+ insertCitation?: ParsedAmendmentFragment;
30
+ insertText?: string;
31
+ replacementCitation?: ParsedAmendmentFragment;
32
+ replacementText?: string;
33
+ };
34
+ export type ParsedAmendmentFragment = {
35
+ originalTransformation?: FragmentReverseTransformation;
36
+ position: FragmentPosition;
37
+ text: string;
38
+ };
39
+ export type ParsedAmendmentDiagnostic = {
40
+ code: string;
41
+ message: string;
42
+ sourceOriginalTransformation?: FragmentReverseTransformation;
43
+ sourcePosition?: FragmentPosition;
44
+ sourceText?: string;
45
+ };
46
+ export type ParsedAmendmentDocument = {
47
+ sourceFormat: ParsedAmendmentSourceFormat;
48
+ amendmentId: string;
49
+ amendmentNumber?: string | null;
50
+ dispositifOriginalTransformation?: FragmentReverseTransformation;
51
+ dispositifPosition?: FragmentPosition;
52
+ dispositifText: string | null;
53
+ directives: ParsedAmendmentDirective[];
54
+ diagnostics: ParsedAmendmentDiagnostic[];
55
+ };
56
+ export type ParseAmendmentInput = {
57
+ sourceFormat: ParsedAmendmentSourceFormat;
58
+ amendmentId: string | number;
59
+ amendmentNumber?: string | null;
60
+ sourceKind?: string | null;
61
+ targetArticleLabel?: string | null;
62
+ targetPosition?: ParsedAmendmentTargetPosition | null;
63
+ targetAlinea?: number | null;
64
+ targetAlineaLabel?: string | null;
65
+ targetSubdivisionSourceId?: string | null;
66
+ targetSubdivisionLabel?: string | null;
67
+ targetSubpos?: number | null;
68
+ dispositifHtml?: string | null;
69
+ dispositifText?: string | null;
70
+ };
71
+ export declare function parseAmendment(input: ParseAmendmentInput): ParsedAmendmentDocument;
@@ -0,0 +1 @@
1
+ export {};
@@ -6,6 +6,11 @@ import { LinkType } from '../links.js';
6
6
  export type ParsedBillSourceFormat = "assemblee-html" | "akoma-ntoso";
7
7
  export type ParsedBillBlockKind = "directive_candidate" | "context" | "noise";
8
8
  export type ParsedBillToc = TableOfContents;
9
+ export type ParsedBillDiagnostic = {
10
+ code: string;
11
+ message: string;
12
+ details?: unknown;
13
+ };
9
14
  export type ParsedBillBlock = {
10
15
  id: string;
11
16
  articleId: string;
@@ -41,8 +46,6 @@ export type ParsedBillDirective = {
41
46
  stop: number;
42
47
  };
43
48
  sourceContextBlockIds?: string[];
44
- sourceContextText?: string;
45
- sourceContextHtml?: string;
46
49
  sourceContextPosition?: {
47
50
  start: number;
48
51
  stop: number;
@@ -65,7 +68,6 @@ export type ParsedBillInternalArticleDefinition = ParsedBillInternalArticleTarge
65
68
  blockId?: string;
66
69
  html: string;
67
70
  parentTargetIds?: string[];
68
- sourceDirectiveId?: string;
69
71
  sourceBlockHtml?: string;
70
72
  sourceBlockText?: string;
71
73
  text: string;
@@ -98,6 +100,7 @@ export type ParsedBillDocument = {
98
100
  globalApplicabilityDate?: string;
99
101
  internalArticleDefinitions?: ParsedBillInternalArticleDefinition[];
100
102
  directives: ParsedBillDirective[];
103
+ diagnostics?: ParsedBillDiagnostic[];
101
104
  };
102
105
  export declare function parseAssembleeBillRaw(input: string, options: ParseBillRawOptions): Promise<ParsedBillDocument>;
103
106
  export declare function linkAssembleeBillRaw(input: string, options: ParseBillRawOptions): Promise<LinkedBillDocument>;
@@ -0,0 +1,20 @@
1
+ export interface RaaTitle {
2
+ act_id: string;
3
+ end_page: number;
4
+ published_on: string | null;
5
+ recueil_id: string;
6
+ source_id: string;
7
+ start_page: number;
8
+ title: string;
9
+ version_id: string;
10
+ }
11
+ export declare function raaAutocompleteDocument(row: RaaTitle): {
12
+ date_day?: number | undefined;
13
+ id: string;
14
+ uid: string;
15
+ text_id: string;
16
+ type: string;
17
+ badge: string;
18
+ autocompletion: string;
19
+ page_path: string;
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { administrativeActAutocompleteDocument } from './administrative_acts_autocompletion.js';
2
+ type AdministrativeActTitleDocument = ReturnType<typeof administrativeActAutocompleteDocument>;
3
+ export declare function syncAdministrativeActTitles({ documents, collectionRecreated, exportDocuments, importDocuments, deleteDocument, }: {
4
+ documents: AdministrativeActTitleDocument[];
5
+ collectionRecreated: boolean;
6
+ exportDocuments: () => Promise<string>;
7
+ importDocuments: (documents: AdministrativeActTitleDocument[]) => Promise<Array<{
8
+ success: boolean;
9
+ }>>;
10
+ deleteDocument: (id: string) => Promise<unknown>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ameliAutocompleteDocument } from './ameli_autocompletion.js';
2
+ type AmeliTitleDocument = ReturnType<typeof ameliAutocompleteDocument>;
3
+ export declare function syncAmeliTitles({ documents, collectionRecreated, exportDocuments, importDocuments, deleteDocument, }: {
4
+ documents: AmeliTitleDocument[];
5
+ collectionRecreated: boolean;
6
+ exportDocuments: () => Promise<string>;
7
+ importDocuments: (documents: AmeliTitleDocument[]) => Promise<Array<{
8
+ success: boolean;
9
+ }>>;
10
+ deleteDocument: (id: string) => Promise<unknown>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { bossAutocompleteDocument } from './boss_autocompletion.js';
2
+ type BossTitleDocument = ReturnType<typeof bossAutocompleteDocument>;
3
+ export declare function syncBossTitles({ documents, collectionRecreated, exportDocuments, importDocuments, deleteDocument, }: {
4
+ documents: BossTitleDocument[];
5
+ collectionRecreated: boolean;
6
+ exportDocuments: () => Promise<string>;
7
+ importDocuments: (documents: BossTitleDocument[]) => Promise<Array<{
8
+ success: boolean;
9
+ }>>;
10
+ deleteDocument: (id: string) => Promise<unknown>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { europeAutocompleteDocument } from './europe_autocompletion.js';
2
+ type EuropeTitleDocument = ReturnType<typeof europeAutocompleteDocument>;
3
+ export declare function syncEuropeTitles({ collectionRecreated, deleteDocument, documents, exportDocuments, importDocuments, }: {
4
+ collectionRecreated: boolean;
5
+ deleteDocument: (id: string) => Promise<unknown>;
6
+ documents: EuropeTitleDocument[];
7
+ exportDocuments: () => Promise<string>;
8
+ importDocuments: (documents: EuropeTitleDocument[]) => Promise<Array<{
9
+ success: boolean;
10
+ }>>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { internationalTreatyAutocompleteDocument } from './international_treaties_autocompletion.js';
2
+ type TreatyTitleDocument = ReturnType<typeof internationalTreatyAutocompleteDocument>;
3
+ export declare function syncInternationalTreatyTitles({ documents, collectionRecreated, exportDocuments, importDocuments, deleteDocument, }: {
4
+ documents: TreatyTitleDocument[];
5
+ collectionRecreated: boolean;
6
+ exportDocuments: () => Promise<string>;
7
+ importDocuments: (documents: TreatyTitleDocument[]) => Promise<Array<{
8
+ success: boolean;
9
+ }>>;
10
+ deleteDocument: (id: string) => Promise<unknown>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { localActAutocompleteDocument } from './local_acts_autocompletion.js';
2
+ type LocalActTitleDocument = ReturnType<typeof localActAutocompleteDocument>;
3
+ export declare function syncLocalActTitles({ documents, collectionRecreated, exportDocuments, importDocuments, deleteDocument, }: {
4
+ documents: LocalActTitleDocument[];
5
+ collectionRecreated: boolean;
6
+ exportDocuments: () => Promise<string>;
7
+ importDocuments: (documents: LocalActTitleDocument[]) => Promise<Array<{
8
+ success: boolean;
9
+ }>>;
10
+ deleteDocument: (id: string) => Promise<unknown>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { raaAutocompleteDocument } from './raa_autocompletion.js';
2
+ type Document = ReturnType<typeof raaAutocompleteDocument>;
3
+ export declare function syncRaaTitles({ documents, collectionRecreated, exportDocuments, importDocuments, deleteDocument, }: {
4
+ documents: Document[];
5
+ collectionRecreated: boolean;
6
+ exportDocuments: () => Promise<string>;
7
+ importDocuments: (documents: Document[]) => Promise<Array<{
8
+ success: boolean;
9
+ }>>;
10
+ deleteDocument: (id: string) => Promise<unknown>;
11
+ }): Promise<{
12
+ changed: number;
13
+ removed: number;
14
+ total: number;
15
+ }>;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ export declare const defaultLegalTextsAlias = "textes_juridiques_live";
2
+ export declare const defaultLegalTextsPhysicalPrefix = "textes_juridiques_v";
3
+ export declare function legalTextsAlias(environment?: NodeJS.ProcessEnv): string;
4
+ export declare function legalTextsPhysicalPrefix(environment?: NodeJS.ProcessEnv): string;
5
+ export declare function newLegalTextsPhysicalName({ date, prefix, suffix, }?: {
6
+ date?: Date;
7
+ prefix?: string;
8
+ suffix?: string;
9
+ }): string;
10
+ export declare function obsoleteLegalTextsCollections({ collections, current, prefix, previous, }: {
11
+ collections: string[];
12
+ current: string;
13
+ prefix?: string;
14
+ previous?: string;
15
+ }): string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Sql } from 'postgres';
2
+ /**
3
+ * Serialize Typesense writers across repositories through Canutes.
4
+ *
5
+ * A reserved PostgreSQL session owns the advisory lock. The heartbeat keeps
6
+ * roles with an idle-session timeout alive while the actual projection uses
7
+ * the regular pool and Typesense HTTP API.
8
+ */
9
+ export declare function withTypesenseIndexLock<T>(db: Pick<Sql, "reserve">, task: () => Promise<T>): Promise<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const citedTargetNamePattern: string;
2
+ export declare const citedReplacementNamePattern: string;