@tricoteuses/tisseuse 0.1.4 → 0.1.5

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,12 +1,14 @@
1
1
  export { formatLongDate } from './dates.js';
2
+ export { jsonReplacer } from './json.js';
2
3
  export { iterCardinalNumeralFormsFromNumber, iterLatinMultiplicativeAdverbsFromNumber, iterOrdinalNumeralFormsFromNumber, numberFromRomanNumeral, ordinalNumeralFromNumber, romanNumeralFromNumber, } from './numbers.js';
3
4
  export { action } from './text_parsers/actions.js';
4
5
  export { article, articles, definitionArticle, designationArticle, listeArticles, nomArticle, nomSpecialArticle, } from './text_parsers/articles.js';
5
- export { compoundReferencesSeparators, divisionTypes, europeanLawNatures, frenchLawNatures, internationalLawNatures, isTextAstAtomicReference, isTextAstDivision, isTextAstPortion, lawNatures, localizationAdverbs, portionTypes, type CompoundReferencesSeparator, type DivisionType, type EuropeanLawNature, type FrenchLawNature, type InternationalLawNature, type LawNature, type LocalizationAdverb, type PortionType, type TextAst, type TextAstAction, 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 TextAstNumber, type TextAstParentChild, type TextAstPortion, type TextAstPosition, type TextAstReference, type TextAstReferenceAndAction, type TextAstText, type TextAstTextIdentification, type TextAstTextInfos, type TextInfosByWordsTree, } from './text_parsers/ast.js';
6
+ export { compoundReferencesSeparators, divisionTypes, europeanLawNatures, frenchLawNatures, internationalLawNatures, isTextAstAtomicReference, isTextAstDivision, isTextAstPortion, lawNatures, localizationAdverbs, portionTypes, type CompoundReferencesSeparator, type DivisionType, type EuropeanLawNature, type FrenchLawNature, type InternationalLawNature, type LawNature, type LocalizationAdverb, type PortionType, type TextAst, type TextAstAction, 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 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';
6
7
  export { citation, citationLigne, citationSimple, } from './text_parsers/citations.js';
7
8
  export { date, duDate } from './text_parsers/dates.js';
8
9
  export { definitionDivision, designationDivision, division, divisions, natureDivisionSingulier, numeroDivision, } from './text_parsers/divisions.js';
9
- export { addChildLeftToLastChild, createEnumerationOrBoundedInterval, createParentChildTreeFromReferences, iterAtomicFirstParentReferences, iterAtomicOrParentChildReferences, iterAtomicReferences, iterIncludedReferences, } from './text_parsers/helpers.js';
10
+ export { addChildLeftToLastChild, createEnumerationOrBoundedInterval, createParentChildTreeFromReferences, iterAtomicFirstParentReferences, iterAtomicReferences, iterIncludedReferences, } from './text_parsers/helpers.js';
11
+ export { getReferences, iterCitationReferences, iterReferences, } from './text_parsers/index.js';
10
12
  export { adjectifNumeralOrdinalCourt, adverbeMultiplicatifLatin, nombreAsTextAstNumber, nombreCardinal, nombreRomainCardinal, nombreRomainOrdinal, nombreRomainOu0iAsTextAstNumber, } from './text_parsers/numbers.js';
11
13
  export { alternatives, chain, convert, optional, parseText, regExp, repeat, TextParserContext, variable, wordsTree, } from './text_parsers/parsers.js';
12
14
  export { auPortion, auxPortions, numeroPortion, portions, unePortion, } from './text_parsers/portions.js';
@@ -15,7 +17,6 @@ export { ditPluriel, ditSingulier, introPluriel, introSingulier, liaisonPluriel,
15
17
  export { reference, uniteBasePreciseeSingulier, uniteBaseSingulier, } from './text_parsers/references.js';
16
18
  export { adverbeRelatif, espaceAdverbeRelatif, relatifPlurielPrepose, relatifSingulierPrepose, } from './text_parsers/relative_locations.js';
17
19
  export { convertHtmlElementsToText, decodeNamedHtmlEntities, decodeNumericHtmlEntities, replacePattern, replacePatterns, simplifyHtml, simplifyText, simplifyUnicodeCharacters, } from './text_parsers/simplifiers.js';
18
- export { identificationTexteEuropeen, natureTexteFrancais, numeroEtOuDateTexteFrancais, numeroTexteEuropeen, numeroTexteFrancais, optionalEspaceDuTerritoire, texte, texteEuropeen, texteFrancais, texteInternational, } from './text_parsers/texts.js';
20
+ export { definitionTexteFrancais, identificationTexteEuropeen, natureTexteFrancais, numeroEtOuDateTexteFrancais, numeroTexteEuropeen, numeroTexteFrancais, optionalEspaceDuTerritoire, texte, texteEuropeen, texteFrancais, texteInternational, } from './text_parsers/texts.js';
19
21
  export { chainTransformers, iterOriginalMergedPositionsFromTransformed, originalMergedPositionsFromTransformed, originalSplitPositionsFromTransformed, type FragmentReverseTransformation, type SourceMapSegment, type Transformation, type TransformationLeaf, type TransformationNode, type Transformer, type TransformerLeaf, type TransformerNode, } from './text_parsers/transformers.js';
20
22
  export { espace, lettreAsciiMinuscule, nonLettre, numero, virguleOuEspace, } from './text_parsers/typography.js';
21
- export { escapeHtml } from './strings.js';
@@ -0,0 +1,6 @@
1
+ export type JsonValue = boolean | JsonValue[] | null | number | string | {
2
+ [key: string]: JsonValue;
3
+ };
4
+ export declare const jsonReplacer: (_key: number | string, value: JsonValue) => string | number | boolean | JsonValue[] | {
5
+ [key: string]: JsonValue;
6
+ } | null;
@@ -1,18 +1,15 @@
1
1
  export interface Config {
2
- assembleeDb: {
3
- host: string;
4
- port: number;
5
- database: string;
6
- user: string;
7
- password: string;
8
- };
9
- legiDb: {
10
- host: string;
11
- port: number;
12
- database: string;
13
- user: string;
14
- password: string;
15
- };
2
+ assembleeDb: DatabaseConfig;
3
+ legiAnomaliesDb: DatabaseConfig;
4
+ legiDb: DatabaseConfig;
5
+ tisseuseDb: DatabaseConfig;
6
+ }
7
+ export interface DatabaseConfig {
8
+ host: string;
9
+ port: number;
10
+ database: string;
11
+ user: string;
12
+ password: string;
16
13
  }
17
14
  declare const config: Config;
18
15
  export default config;
@@ -4,7 +4,25 @@ export interface Version {
4
4
  }
5
5
  export declare const assembleeDb: postgres.Sql<{}>;
6
6
  export declare const assembleeVersionNumber = 7;
7
+ export declare const legiAnomaliesDb: postgres.Sql<{}>;
8
+ export declare const legiAnomaliesVersionNumber = 1;
7
9
  export declare const legiDb: postgres.Sql<{}>;
8
- export declare const versionNumber = 16;
10
+ export declare const legiVersionNumber = 16;
11
+ export declare const tisseuseDb: postgres.Sql<{}>;
12
+ export declare const tisseuseVersionNumber = 1;
13
+ /**
14
+ * Check that assemblee database exists and is up to date.
15
+ */
9
16
  export declare function checkAssembleeDb(): Promise<void>;
10
- export declare function checkDb(): Promise<void>;
17
+ /**
18
+ * Check that legi_anomalies database exists and is up to date.
19
+ */
20
+ export declare function checkLegiAnomaliesDb(): Promise<void>;
21
+ /**
22
+ * Check that legi database exists and is up to date.
23
+ */
24
+ export declare function checkLegiDb(): Promise<void>;
25
+ /**
26
+ * Check that Tisseuse database exists and is up to date.
27
+ */
28
+ export declare function checktisseuseDb(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function configureTisseuseDatabase(): Promise<void>;
@@ -1,42 +1,5 @@
1
- import { TextAstArticle, TextAstDivision, TextAstPosition, TextAstText } from '../text_parsers/ast.js';
2
1
  import { TextParserContext } from '../text_parsers/parsers.js';
3
- import { TextPosition } from '../text_parsers/positions.js';
4
- export type DefinitionOrLink = ArticleDefinition | ArticleLink | DivisionLink | TextLink;
5
- export interface ArticleDefinition {
6
- article: TextAstArticle;
7
- /**
8
- * Same value as article.position, added for homogeneity
9
- */
10
- position: TextPosition;
11
- textId: string;
12
- type: "article_definition";
13
- }
14
- export interface ArticleExternalLink {
15
- article: TextAstArticle;
16
- articleId: string;
17
- position: TextPosition;
18
- type: "external_article";
19
- }
20
- export interface ArticleInternalLink {
21
- article: TextAstArticle;
22
- definition: ArticleDefinition;
23
- position: TextPosition;
24
- type: "internal_article";
25
- }
26
- export type ArticleLink = ArticleExternalLink | ArticleInternalLink;
27
- export interface DivisionExternalLink {
28
- division: TextAstDivision;
29
- position: TextPosition;
30
- sectionTaId: string;
31
- type: "external_division";
32
- }
33
- export type DivisionLink = DivisionExternalLink;
34
- export interface TextExternalLink {
35
- position: TextPosition;
36
- text: TextAstText & TextAstPosition;
37
- type: "external_text";
38
- }
39
- export type TextLink = TextExternalLink;
2
+ import { DefinitionOrLink } from '../text_parsers/text_links.js';
40
3
  export declare function iterTextLinks(context: TextParserContext, { date, defaultTextId, logIgnoredReferencesTypes, logPartialReferences, logReferences, }: {
41
4
  date: string;
42
5
  defaultTextId?: string;
@@ -11,6 +11,7 @@ export type TextAst = boolean | null | number | string | TextAstAction | TextAst
11
11
  export interface TextAstAction {
12
12
  action: "CREATION" | "CREATION_OU_MODIFICATION" | "MODIFICATION" | "SUPPRESSION";
13
13
  actionInContent?: boolean;
14
+ originalCitations?: TextAstCitation[];
14
15
  }
15
16
  export type TextAstArticle = {
16
17
  definition?: boolean;
@@ -57,6 +58,7 @@ export type TextAstExclusion = {
57
58
  } & TextAstPosition;
58
59
  export interface TextAstTextIdentification {
59
60
  date?: string;
61
+ dateCalendrierRepublicain?: string;
60
62
  /**
61
63
  * For the texts found in the Légifrance datasets, this is
62
64
  * Légifrance NUM of the text (for example the number of the law).
@@ -101,7 +103,6 @@ export type TextAstText = {
101
103
  * Légifrance CID of the text.
102
104
  */
103
105
  cid?: string;
104
- date?: string;
105
106
  nature: LawNature;
106
107
  legislation?: "international" | "UE";
107
108
  ofTheSaid?: boolean;
@@ -111,12 +112,16 @@ export type TextAstText = {
111
112
  * input.
112
113
  */
113
114
  title?: string;
115
+ titleRest?: string;
114
116
  type: "texte";
115
- } & TextAstLocalization;
117
+ } & TextAstTextIdentification & TextAstLocalization;
116
118
  export interface TextAstTextInfos {
117
119
  cid: string | string[];
118
120
  }
119
- export type TextInfosByWordsTree = TextAstTextInfos & {
121
+ export type TextInfosByWordsTree = TextAstTextInfos | TextInfosByWordsTreeNode;
122
+ export type TextInfosByWordsTreeNode = {
123
+ cid?: string | string[];
124
+ } & {
120
125
  [word: string]: TextInfosByWordsTree;
121
126
  };
122
127
  export declare const compoundReferencesSeparators: readonly [",", "à", "et", "ou", "sauf"];
@@ -1,6 +1,10 @@
1
1
  export declare const annee: import('./parsers.js').TextParser;
2
+ export declare const anneeCalendrierRepublicain: import('./parsers.js').TextParser;
2
3
  export declare const jour: import('./parsers.js').TextParser;
4
+ export declare const jourCalendrierRepublicain: import('./parsers.js').TextParser;
3
5
  export declare const mois: import('./parsers.js').TextParser;
6
+ export declare const moisCalendrierRepublicain: import('./parsers.js').TextParser;
4
7
  export declare const date: import('./parsers.js').TextParser;
8
+ export declare const dateCalendrierRepublicain: import('./parsers.js').TextParser;
5
9
  export declare const duDate: import('./parsers.js').TextParser;
6
10
  export declare const espaceDuDate: import('./parsers.js').TextParser;
@@ -6,8 +6,7 @@ export declare const natureDivisionPluriel: import('./parsers.js').TextParser;
6
6
  export declare const nomDivision: import('./parsers.js').TextParser;
7
7
  export declare const numeroDivision: import('./parsers.js').TextParser;
8
8
  /**
9
- * Déclaration d'un article
10
- * Exemple : « Art. L. 322‑66. - blablabla… en début de ligne
9
+ * Déclaration d'une division
11
10
  */
12
11
  export declare const definitionDivision: import('./parsers.js').TextParser;
13
12
  export declare const designationDivision: import('./parsers.js').TextParser;
@@ -4,7 +4,8 @@ export declare const addChildLeftToLastChild: (reference: TextAstReference, chil
4
4
  export declare const createEnumerationOrBoundedInterval: (reference: TextAstReference, remaining: Array<[CompoundReferencesSeparator, TextAstReference]>, position: TextPosition) => TextAstReference;
5
5
  export declare const createEnumerationOrBoundedInterval1: (reference: TextAstReference, remaining: Array<[CompoundReferencesSeparator, TextAstReference]>, position: TextPosition, remainingIndex: number) => TextAstReference;
6
6
  export declare const createParentChildTreeFromReferences: (child: TextAstReference, ancestors: TextAstAtomicReference[], position: TextPosition) => TextAstReference;
7
+ export declare const getHighestAtomicType: (type1: TextAstAtomicReference["type"], type2: TextAstAtomicReference["type"]) => TextAstAtomicReference["type"];
8
+ export declare const getReferenceHighestAtomicType: (reference: TextAstReference) => TextAstAtomicReference["type"];
7
9
  export declare function iterAtomicFirstParentReferences<T extends TextAstAtomicReference | TextAstParentChild>(reference: TextAstReference): Generator<T, void>;
8
- export declare function iterAtomicOrParentChildReferences(reference: TextAstReference): Generator<TextAstAtomicReference | TextAstParentChild, void>;
9
10
  export declare function iterAtomicReferences(reference: TextAstReference): Generator<TextAstAtomicReference, void>;
10
11
  export declare function iterIncludedReferences(reference: TextAstReference): Generator<TextAstReference, void>;
@@ -1,4 +1,5 @@
1
- import { TextAstReference } from './ast.js';
1
+ import { TextAstCitation, TextAstReference } from './ast.js';
2
2
  import { TextParserContext } from './parsers.js';
3
+ export declare function iterCitationReferences(context: TextParserContext, citation: TextAstCitation): Generator<TextAstReference, void>;
3
4
  export declare function iterReferences(context: TextParserContext): Generator<TextAstReference, void>;
4
5
  export declare const getReferences: (context: TextParserContext) => TextAstReference[];
@@ -0,0 +1,50 @@
1
+ import { TextAstArticle, TextAstDivision, TextAstPosition, TextAstReference, TextAstText } from './ast.js';
2
+ import { TextPosition } from './positions.js';
3
+ export type DefinitionOrLink = ArticleDefinition | ArticleLink | DivisionLink | TextLink;
4
+ export interface ArticleDefinition {
5
+ article: TextAstArticle;
6
+ /**
7
+ * Same value as article.position, added for homogeneity
8
+ */
9
+ position: TextPosition;
10
+ reference: TextAstReference;
11
+ textId: string;
12
+ type: "article_definition";
13
+ }
14
+ export interface ArticleExternalLink {
15
+ article: TextAstArticle;
16
+ articleId?: string;
17
+ position: TextPosition;
18
+ reference: TextAstReference;
19
+ type: "external_article";
20
+ }
21
+ export interface ArticleInternalLink {
22
+ article: TextAstArticle;
23
+ definition: ArticleDefinition;
24
+ position: TextPosition;
25
+ reference: TextAstReference;
26
+ type: "internal_article";
27
+ }
28
+ export type ArticleLink = ArticleExternalLink | ArticleInternalLink;
29
+ export interface DivisionExternalLink {
30
+ division: TextAstDivision;
31
+ position: TextPosition;
32
+ reference: TextAstReference;
33
+ sectionTaId?: string;
34
+ type: "external_division";
35
+ }
36
+ export type DivisionLink = DivisionExternalLink;
37
+ export interface ExtractedLinkDb {
38
+ field_name: string;
39
+ index: number;
40
+ link: ArticleExternalLink | DivisionExternalLink | TextExternalLink;
41
+ source_id: string;
42
+ target_id: string | null;
43
+ }
44
+ export interface TextExternalLink {
45
+ position: TextPosition;
46
+ reference: TextAstReference;
47
+ text: TextAstText & TextAstPosition;
48
+ type: "external_text";
49
+ }
50
+ export type TextLink = TextExternalLink;