@tricoteuses/tisseuse 0.14.1 → 0.14.3

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.
@@ -52,6 +52,7 @@ export type ActionOperation = (ActionOperationTarget & {
52
52
  targetText: string;
53
53
  replacementText: string;
54
54
  replacement: ActionReplacement;
55
+ targetOccurrenceCount?: number;
55
56
  targetScope?: ActionTargetScope;
56
57
  tableTarget?: ActionTableTarget;
57
58
  }) | (ActionOperationTarget & {
@@ -59,6 +60,7 @@ export type ActionOperation = (ActionOperationTarget & {
59
60
  targetText: string;
60
61
  targetScope?: ActionTargetScope;
61
62
  occurrenceIndex?: number;
63
+ targetOccurrenceCount?: number;
62
64
  tableTarget?: ActionTableTarget;
63
65
  }) | (ActionOperationTarget & {
64
66
  kind: "delete_portion";
@@ -94,6 +96,7 @@ export type ResolvedActionDirective = (ActionDirectiveCommon & {
94
96
  targetText: string;
95
97
  replacementText: string;
96
98
  replacement: ActionReplacement;
99
+ targetOccurrenceCount?: number;
97
100
  targetScope?: ActionTargetScope;
98
101
  tableTarget?: ActionTableTarget;
99
102
  }) | (ActionDirectiveCommon & {
@@ -104,6 +107,7 @@ export type ResolvedActionDirective = (ActionDirectiveCommon & {
104
107
  targetText: string;
105
108
  targetScope?: ActionTargetScope;
106
109
  occurrenceIndex?: number;
110
+ targetOccurrenceCount?: number;
107
111
  tableTarget?: ActionTableTarget;
108
112
  }) | (ActionDirectiveCommon & {
109
113
  kind: "delete_portion";
@@ -0,0 +1 @@
1
+ export {};
@@ -28,9 +28,11 @@ export { article, articles, definitionArticleDansCitation, definitionArticleDans
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
29
  export { citation, citationToText, citationLigne, citationSimple, } from './text_parsers/citations.js';
30
30
  export { date, duDate } from './text_parsers/dates.js';
31
+ export { referenceDoctrinale, referenceDoctrinaleArticleAvantSource, referenceDoctrinaleArticlesAvantSource, referenceDoctrinaleSourceAvantArticle, } from './text_parsers/doctrinal_references.js';
31
32
  export { definitionDivision, designationDivision, division, divisions, natureDivisionSingulier, numeroDivision, } from './text_parsers/divisions.js';
32
33
  export type { FragmentPosition, FragmentReverseTransformation, } from './text_parsers/fragments.js';
33
34
  export { addChildLeftToLastChild, createEnumerationOrBoundedInterval, createParentChildTreeFromReferences, iterAtomicFirstParentReferences, iterAtomicReferences, iterIncludedReferences, } from './text_parsers/helpers.js';
35
+ export { texteFrancaisAbrege } from './text_parsers/legal_text_aliases.js';
34
36
  export { adjectifNumeralCardinal, adjectifNumeralOrdinalCourt, adverbeMultiplicatifLatin, nombreAsTextAstNumber, nombreCardinal, nombreRomainCardinal, nombreRomainOrdinal, nombreRomainOu0iAsTextAstNumber, } from './text_parsers/numbers.js';
35
37
  export { alternatives, chain, convert, optional, parseText, regExp, repeat, TextParserContext, variable, wordsTree, } from './text_parsers/parsers.js';
36
38
  export { auPortion, auxPortions, numeroPortion, portions, unePortion, } from './text_parsers/portions.js';
@@ -6,7 +6,7 @@ export { hashSenatSearchItem, parseSenatDocumentSearchContent, type SenatSearchI
6
6
  export { isAkomaNtosoXml, resolveSenatAkomaNtosoSource, type SenatAkomaNtosoSource, } from './senat_document_sources.js';
7
7
  export { simplifyWordHtml, simplifyWordHtmlToDocument, type SimplifyHtmlOptions, } from './html_simplifier.js';
8
8
  export { addLinksOrReferencesToHtmlFile } from './linkers/html.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
+ export { linkAkomaNtosoBillRaw, linkAssembleeBillRaw, parseAkomaNtosoBillRaw, parseAssembleeBillRaw, renderAkomaNtosoBillRaw, type LinkedBillDocument, type ParsedBillAnnotation, type ParsedBillAnnotationRange, type ParsedBillAnnotationSeverity, type ParsedBillArticle, type ParsedBillBlock, type ParsedBillBlockKind, type ParsedBillDiagnostic, type ParsedBillDirective, type ParsedBillDocument, type ParsedBillLink, type ParsedBillSourceFormat, type ParsedBillToc, type ParseBillRawOptions, } from './parsed_bills.js';
10
10
  export { type LegiArticleInfo, LegiResolver, type LegiSectionInfo, type PreloadActiveArticlesByTextIdsOptions, type PreloadTextTitlesInfosOptions, type PreloadTextTitlesInfosProgress, } from '../legi/resolver.js';
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';
@@ -11,6 +11,21 @@ export type ParsedBillDiagnostic = {
11
11
  message: string;
12
12
  details?: unknown;
13
13
  };
14
+ export type ParsedBillAnnotationSeverity = "warning";
15
+ export type ParsedBillAnnotationRange = {
16
+ blockId: string;
17
+ start: number;
18
+ stop: number;
19
+ text: string;
20
+ };
21
+ export type ParsedBillAnnotation = {
22
+ articleId: string;
23
+ code: string;
24
+ details?: unknown;
25
+ message: string;
26
+ ranges: ParsedBillAnnotationRange[];
27
+ severity: ParsedBillAnnotationSeverity;
28
+ };
14
29
  export type ParsedBillBlock = {
15
30
  id: string;
16
31
  articleId: string;
@@ -100,6 +115,7 @@ export type ParsedBillDocument = {
100
115
  globalApplicabilityDate?: string;
101
116
  internalArticleDefinitions?: ParsedBillInternalArticleDefinition[];
102
117
  directives: ParsedBillDirective[];
118
+ annotations?: ParsedBillAnnotation[];
103
119
  diagnostics?: ParsedBillDiagnostic[];
104
120
  };
105
121
  export declare function parseAssembleeBillRaw(input: string, options: ParseBillRawOptions): Promise<ParsedBillDocument>;
@@ -0,0 +1,10 @@
1
+ export declare function sharedLegalTextSectionSelection({ rebuild, jo, reunions, scrutins, }: {
2
+ rebuild: boolean;
3
+ jo: boolean;
4
+ reunions: boolean;
5
+ scrutins: boolean;
6
+ }): {
7
+ jo: boolean;
8
+ reunions: boolean;
9
+ scrutins: boolean;
10
+ };
@@ -0,0 +1,17 @@
1
+ type AssembleeLegalTextDocument = Record<string, unknown> & {
2
+ id: string;
3
+ type: "Assemblée document" | "Assemblée dossier";
4
+ };
5
+ export declare function syncAssembleeLegalTextDocuments({ documents, exportDocuments, importDocuments, deleteDocument, }: {
6
+ documents: AssembleeLegalTextDocument[];
7
+ exportDocuments: () => Promise<string>;
8
+ importDocuments: (documents: AssembleeLegalTextDocument[]) => Promise<Array<{
9
+ success: boolean;
10
+ }>>;
11
+ deleteDocument: (id: string) => Promise<unknown>;
12
+ }): Promise<{
13
+ changed: number;
14
+ removed: number;
15
+ total: number;
16
+ }>;
17
+ export {};
@@ -19,6 +19,7 @@ export interface TextAstAction {
19
19
  export type TextAstActionDirectiveOperation = {
20
20
  kind: "delete";
21
21
  occurrenceIndex?: number;
22
+ targetOccurrenceCount?: number;
22
23
  targetCitation: TextAstCitation;
23
24
  targetScope?: TextAstActionTargetScope;
24
25
  } | {
@@ -28,6 +29,7 @@ export type TextAstActionDirectiveOperation = {
28
29
  } | {
29
30
  kind: "replace";
30
31
  replacementCitation: TextAstCitation;
32
+ targetOccurrenceCount?: number;
31
33
  targetCitation: TextAstCitation;
32
34
  targetScope?: TextAstActionTargetScope;
33
35
  } | {
@@ -1,11 +1,11 @@
1
1
  import { TextAst, TextAstCitation } from './ast.js';
2
- import { TextParserContext } from './parsers.js';
2
+ import { TextParserContext, TextParser } from './parsers.js';
3
3
  import { TransformationLeaf } from './transformers.js';
4
4
  type TextAstPositionRange = TextAstCitation["position"];
5
5
  export declare function createTextAstCitation(contentPosition: TextAstPositionRange, position?: TextAstPositionRange): TextAstCitation;
6
- export declare const citationLigne: import('./parsers.js').TextParser<TextAst>;
7
- export declare const citationSimple: import('./parsers.js').TextParser<TextAst>;
8
- export declare const citation: import('./parsers.js').TextParser<TextAst>;
6
+ export declare const citationLigne: TextParser<TextAst>;
7
+ export declare const citationSimple: TextParser<TextAst>;
8
+ export declare const citation: TextParser<TextAst>;
9
9
  export declare function convertCitationToText(context: TextParserContext, citation: TextAstCitation): TransformationLeaf;
10
10
  export declare function citationToText(sourceText: string, citation: TextAstCitation): string;
11
11
  export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Doctrine often puts the abbreviated source before the article, contrary to
3
+ * parliamentary drafting conventions: "CGI, art. 39" or
4
+ * "CGI, ann. III, art. 38 quinquies".
5
+ *
6
+ * A trailing "et suiv." is intentionally left outside the reference. It does
7
+ * not provide a safe upper bound, but the first article can still be linked.
8
+ */
9
+ export declare const referenceDoctrinaleSourceAvantArticle: import('./parsers.js').TextParser<import('./ast.js').TextAst>;
10
+ /**
11
+ * BOSS and, less often, BOFiP omit "article" and sometimes the preposition
12
+ * before an acronym: "L. 131-6-4 CSS", "L. 243-7 du CSS" or "article 39 CGI".
13
+ */
14
+ export declare const referenceDoctrinaleArticleAvantSource: import('./parsers.js').TextParser<import('./ast.js').TextAst>;
15
+ /**
16
+ * Tables also share a trailing source between several prefixed articles:
17
+ * "L. 241-18 et L. 241-18-1 CSS". Each article remains distinct while the
18
+ * acronym supplies their common parent text.
19
+ */
20
+ export declare const referenceDoctrinaleArticlesAvantSource: import('./parsers.js').TextParser<import('./ast.js').TextAst>;
21
+ export declare const referenceDoctrinale: import('./parsers.js').TextParser<import('./ast.js').TextAst>;
@@ -0,0 +1,12 @@
1
+ import { TextAstPosition, TextAstText } from './ast.js';
2
+ import { TextParser } from './parsers.js';
3
+ export type LegalTextAliasInfo = {
4
+ cid: string;
5
+ nature: "CODE";
6
+ title: string;
7
+ };
8
+ export declare const legalTextAliasRegExpSource: string;
9
+ export declare const cgiAnnexInfoByRomanNumber: Record<string, LegalTextAliasInfo>;
10
+ export declare function legalTextInfoFromAlias(value: string): LegalTextAliasInfo | undefined;
11
+ export declare function legalTextFromAlias(value: string, position: TextAstPosition["position"]): (TextAstText & TextAstPosition) | undefined;
12
+ export declare const texteFrancaisAbrege: TextParser<import('./ast.js').TextAst>;
@@ -1,4 +1,5 @@
1
1
  import { TextParser } from './parsers.js';
2
2
  export declare const repeatedActionQualifier: TextParser<number>;
3
3
  export declare function findRepeatedActionCount(text: string): number | null;
4
+ export declare function findRepeatedTargetOccurrenceCount(text: string, position: number): number | null;
4
5
  export declare function stripRepeatedActionQualifiers(text: string): 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.14.1",
4
+ "version": "0.14.3",
5
5
  "keywords": [
6
6
  "Assemblée nationale",
7
7
  "France",