@tricoteuses/tisseuse 0.14.12 → 0.14.13
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.
- package/README.md +34 -5
- package/dist/{html-Bos7PYtS.js → html-D6-bRvBF.js} +5384 -5056
- package/dist/index.js +116 -116
- package/dist/{resolver-D5TCkLkD.js → resolver-CuP8arVX.js} +189 -131
- package/dist/server-f-legi.js +225 -105
- package/dist/server.js +883 -734
- package/dist/src/lib/extractors/action_directives.d.ts +33 -1
- package/dist/src/lib/extractors/links.d.ts +41 -1
- package/dist/src/lib/extractors/references.d.ts +12 -3
- package/dist/src/lib/f_legi/resolver.d.ts +4 -0
- package/dist/src/lib/legi/text_titles_infos.d.ts +3 -0
- package/dist/src/lib/text_parsers/parsers.d.ts +20 -1
- package/package.json +1 -1
|
@@ -134,8 +134,40 @@ export type ResolvedActionDirective = (ActionDirectiveCommon & {
|
|
|
134
134
|
* directives. TextAstActionDirective is the generic parser AST.
|
|
135
135
|
*/
|
|
136
136
|
export type ActionDirective = ResolvedActionDirective;
|
|
137
|
+
export type ActionDirectiveExtractionDiagnostics = {
|
|
138
|
+
applyApplicabilityDatesMs: number;
|
|
139
|
+
buildListItemTreeMs: number;
|
|
140
|
+
buildDirectivesMs: number;
|
|
141
|
+
canonicalizeMs: number;
|
|
142
|
+
collectApplicabilityScopesMs: number;
|
|
143
|
+
directiveCount: number;
|
|
144
|
+
extractReferencesMs: number;
|
|
145
|
+
fallbackReferencesMs: number;
|
|
146
|
+
filterReferencesMs: number;
|
|
147
|
+
findBaseReferenceMs: number;
|
|
148
|
+
listActionItemCount: number;
|
|
149
|
+
listActionIndexCacheHitCount: number;
|
|
150
|
+
listActionIndexCacheMissCount: number;
|
|
151
|
+
listBuildActionDirectiveMs: number;
|
|
152
|
+
listChildProcessingMs: number;
|
|
153
|
+
listExtractionMs: number;
|
|
154
|
+
listFindActionIndexMs: number;
|
|
155
|
+
listItemCount: number;
|
|
156
|
+
listPickLineReferenceMs: number;
|
|
157
|
+
listPickLocalReferenceMs: number;
|
|
158
|
+
listQuoteRangeCacheHitCount: number;
|
|
159
|
+
listQuoteRangeCacheMissCount: number;
|
|
160
|
+
listReferenceCacheHitCount: number;
|
|
161
|
+
listReferenceCacheMissCount: number;
|
|
162
|
+
prepareRangesMs: number;
|
|
163
|
+
processListItemNodesMs: number;
|
|
164
|
+
refineReferencesMs: number;
|
|
165
|
+
referenceCount: number;
|
|
166
|
+
simplifyMs: number;
|
|
167
|
+
};
|
|
168
|
+
export declare function createActionDirectiveExtractionDiagnostics(): ActionDirectiveExtractionDiagnostics;
|
|
137
169
|
export declare function extractActionDirectiveAstsFromText(text: string): TextAstActionDirective[];
|
|
138
|
-
export declare function resolveActionDirectivesFromText(text: string): ActionDirective[];
|
|
170
|
+
export declare function resolveActionDirectivesFromText(text: string, diagnostics?: ActionDirectiveExtractionDiagnostics): ActionDirective[];
|
|
139
171
|
/**
|
|
140
172
|
* @deprecated Use resolveActionDirectivesFromText.
|
|
141
173
|
*/
|
|
@@ -109,6 +109,43 @@ export interface TextLinksParserState {
|
|
|
109
109
|
sectionTaId?: string;
|
|
110
110
|
textId?: string;
|
|
111
111
|
}
|
|
112
|
+
type TextLinksResolverDiagnostics = {
|
|
113
|
+
alternativeTargetCandidateCount: number;
|
|
114
|
+
getActiveArticlesByTextAndNumCount: number;
|
|
115
|
+
getArticleHistoryInfoCount: number;
|
|
116
|
+
getDirectSectionChildrenCount: number;
|
|
117
|
+
getEuropeanTextUrlCount: number;
|
|
118
|
+
getUniqueActiveArticlesByNumCount: number;
|
|
119
|
+
uniqueFallbackCheckCount: number;
|
|
120
|
+
};
|
|
121
|
+
type TextLinksIterationDiagnostics = {
|
|
122
|
+
articleDefinitionLinkCount: number;
|
|
123
|
+
articleDirectLookupMs: number;
|
|
124
|
+
articleExplicitAlternativeLookupMs: number;
|
|
125
|
+
articleExternalLinkCount: number;
|
|
126
|
+
articleFiscalParentLookupMs: number;
|
|
127
|
+
articleHistoryLookupMs: number;
|
|
128
|
+
articleLatestVersionFilterMs: number;
|
|
129
|
+
articleLinkCount: number;
|
|
130
|
+
articleLinkMs: number;
|
|
131
|
+
articleDefaultTextLookupMs: number;
|
|
132
|
+
articleTypographyAlternativeLookupMs: number;
|
|
133
|
+
articleUniqueLookupMs: number;
|
|
134
|
+
citationReferenceCount: number;
|
|
135
|
+
citationReferenceMs: number;
|
|
136
|
+
divisionChildArticleMs: number;
|
|
137
|
+
divisionChildDivisionMs: number;
|
|
138
|
+
divisionDirectChildrenLookupMs: number;
|
|
139
|
+
divisionLinkCount: number;
|
|
140
|
+
divisionLinkMs: number;
|
|
141
|
+
europeanTextLinkCount: number;
|
|
142
|
+
europeanTextUrlMs: number;
|
|
143
|
+
ignoredReferenceCount: number;
|
|
144
|
+
textChildArticleMs: number;
|
|
145
|
+
textChildDivisionMs: number;
|
|
146
|
+
textLinkCount: number;
|
|
147
|
+
textLinkMs: number;
|
|
148
|
+
};
|
|
112
149
|
export declare function extractTextLinks({ canutesDb, context, date, legiResolver: providedLegiResolver, logIgnoredReferencesTypes, logPartialReferences, logReferences, state: inputState, transformation, }: {
|
|
113
150
|
canutesDb?: Sql;
|
|
114
151
|
context: TextParserContext;
|
|
@@ -125,7 +162,7 @@ export declare function extractTextLinks({ canutesDb, context, date, legiResolve
|
|
|
125
162
|
state?: TextLinksParserState;
|
|
126
163
|
transformation?: Transformation;
|
|
127
164
|
}): AsyncGenerator<DefinitionOrLink, void>;
|
|
128
|
-
export declare function iterReferenceLinks({ articleDefinitionByNumByTextId: articleDefinitionByNumByTextIdInput, legiResolver, context, date, logIgnoredReferencesTypes, logPartialReferences, originalPositionsFromTransformedIterator, reference, state: inputState, }: {
|
|
165
|
+
export declare function iterReferenceLinks({ articleDefinitionByNumByTextId: articleDefinitionByNumByTextIdInput, legiResolver, context, date, logIgnoredReferencesTypes, logPartialReferences, originalPositionsFromTransformedIterator, reference, iterationDiagnostics: inputIterationDiagnostics, resolverDiagnostics: inputResolverDiagnostics, state: inputState, }: {
|
|
129
166
|
articleDefinitionByNumByTextId?: Record<string, Record<string, ArticleDefinition>>;
|
|
130
167
|
legiResolver: LegiResolver;
|
|
131
168
|
context: TextParserContext;
|
|
@@ -134,6 +171,8 @@ export declare function iterReferenceLinks({ articleDefinitionByNumByTextId: art
|
|
|
134
171
|
logPartialReferences?: boolean;
|
|
135
172
|
originalPositionsFromTransformedIterator?: Generator<FragmentReverseTransformation, void, FragmentPosition | undefined>;
|
|
136
173
|
reference: TextAstReference;
|
|
174
|
+
iterationDiagnostics?: TextLinksIterationDiagnostics;
|
|
175
|
+
resolverDiagnostics?: TextLinksResolverDiagnostics;
|
|
137
176
|
/**
|
|
138
177
|
* When given, state is modified by this generator, so that the callers
|
|
139
178
|
* always has the latest state version (and can reuse it for the next article,
|
|
@@ -141,3 +180,4 @@ export declare function iterReferenceLinks({ articleDefinitionByNumByTextId: art
|
|
|
141
180
|
*/
|
|
142
181
|
state?: TextLinksParserState;
|
|
143
182
|
}): AsyncGenerator<DefinitionOrLink>;
|
|
183
|
+
export {};
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { TextAstCitation, TextAstReference } from '../text_parsers/ast.js';
|
|
2
|
-
import { TextParserContext } from '../text_parsers/parsers.js';
|
|
2
|
+
import { FastPathExtractDiagnostics, TextParserContext } from '../text_parsers/parsers.js';
|
|
3
3
|
import { Transformation } from '../text_parsers/transformers.js';
|
|
4
|
-
export
|
|
4
|
+
export type ExtractReferencesDiagnostics = {
|
|
5
|
+
citationCount: number;
|
|
6
|
+
fastPath: FastPathExtractDiagnostics;
|
|
7
|
+
};
|
|
8
|
+
export declare function extractCitationReferences(context: TextParserContext, citation: TextAstCitation, options?: {
|
|
9
|
+
diagnostics?: ExtractReferencesDiagnostics;
|
|
10
|
+
}): Generator<TextAstReference, void>;
|
|
5
11
|
export declare function extractReferences(context: TextParserContext, options?: {
|
|
12
|
+
diagnostics?: ExtractReferencesDiagnostics;
|
|
6
13
|
overlapWindowForCandidate?: (anchor: string) => number;
|
|
7
14
|
}): Generator<TextAstReference, void>;
|
|
8
|
-
export declare function extractReferencesWithOriginalTransformations(context: TextParserContext, transformation: Transformation
|
|
15
|
+
export declare function extractReferencesWithOriginalTransformations(context: TextParserContext, transformation: Transformation, options?: {
|
|
16
|
+
diagnostics?: ExtractReferencesDiagnostics;
|
|
17
|
+
}): Generator<TextAstReference, void>;
|
|
9
18
|
export declare const getExtractedReferences: (context: TextParserContext) => TextAstReference[];
|
|
10
19
|
export declare const getExtractedReferencesWithOriginalTransformations: (context: TextParserContext, transformation: Transformation) => TextAstReference[];
|
|
@@ -27,6 +27,10 @@ export declare class FlegiResolver extends LegiResolver {
|
|
|
27
27
|
}): Promise<FlegiSectionInfo[]>;
|
|
28
28
|
getTextIdFromSegmentId(segmentId: string): Promise<string | undefined>;
|
|
29
29
|
preloadTextTitlesInfos(options?: PreloadTextTitlesInfosOptions): Promise<void>;
|
|
30
|
+
private buildAndCacheTextTitlesInfos;
|
|
31
|
+
private getTextTitlesInfosParserCacheMeta;
|
|
32
|
+
private loadTextTitlesInfosParserCache;
|
|
33
|
+
private loadOrBuildTextTitlesInfosParserCache;
|
|
30
34
|
getUniqueActiveArticlesByNum({ date, num, }: {
|
|
31
35
|
date: string;
|
|
32
36
|
num: string | undefined;
|
|
@@ -14,6 +14,8 @@ export type TextTitlesInfos = {
|
|
|
14
14
|
textsCidsByNatureAndDate: Record<string, Record<string, string | string[]>>;
|
|
15
15
|
textsCidsByNatureAndNum: Record<string, Record<string, string | string[]>>;
|
|
16
16
|
};
|
|
17
|
+
export declare const textTitlesInfosParserCacheKey = "current";
|
|
18
|
+
export declare const textTitlesInfosParserCacheFormatVersion = 1;
|
|
17
19
|
export type BuildTextTitlesInfosProgress = {
|
|
18
20
|
count?: number;
|
|
19
21
|
phase: string;
|
|
@@ -21,6 +23,7 @@ export type BuildTextTitlesInfosProgress = {
|
|
|
21
23
|
export declare function buildAndInstallTextTitlesInfos(rows: TextTitlesInfoRow[], options?: {
|
|
22
24
|
onProgress?: (progress: BuildTextTitlesInfosProgress) => void;
|
|
23
25
|
}): Promise<void>;
|
|
26
|
+
export declare function installTextTitlesInfos(textTitlesInfos: TextTitlesInfos): void;
|
|
24
27
|
export declare function buildTextTitlesInfos(rows: TextTitlesInfoRow[], { onProgress, }?: {
|
|
25
28
|
onProgress?: (progress: BuildTextTitlesInfosProgress) => void;
|
|
26
29
|
}): Promise<TextTitlesInfos>;
|
|
@@ -6,12 +6,31 @@ export type TextAstConverter<T extends TextAst> = (ast: T, context: TextParserCo
|
|
|
6
6
|
export type TextParser<T extends TextAst = TextAst> = {
|
|
7
7
|
(context: TextParserContext): T | undefined;
|
|
8
8
|
extract?: (context: TextParserContext, options?: {
|
|
9
|
+
diagnostics?: FastPathExtractDiagnostics;
|
|
9
10
|
jumpExact?: boolean;
|
|
10
11
|
globalRegExpFlags?: string;
|
|
12
|
+
canStartAtOffset?: (input: string, offset: number) => boolean;
|
|
11
13
|
overlapWindow?: number;
|
|
12
|
-
overlapWindowForCandidate?: (anchor: string) => number;
|
|
14
|
+
overlapWindowForCandidate?: (anchor: string, candidate?: FastPathExtractCandidate) => number | undefined;
|
|
13
15
|
}) => Generator<T, void, undefined>;
|
|
14
16
|
};
|
|
17
|
+
export type FastPathExtractDiagnostics = {
|
|
18
|
+
anchorCounts: Record<string, number>;
|
|
19
|
+
candidateCount: number;
|
|
20
|
+
checkedOffsetCount: number;
|
|
21
|
+
failedCandidateCount: number;
|
|
22
|
+
matchedCount: number;
|
|
23
|
+
startOffsetSkippedCount: number;
|
|
24
|
+
overlapWindowOverrideCount: number;
|
|
25
|
+
overlapWindowReducedCandidateCount: number;
|
|
26
|
+
overlapWindowSavedOffsetCount: number;
|
|
27
|
+
parserAttemptCount: number;
|
|
28
|
+
};
|
|
29
|
+
export type FastPathExtractCandidate = {
|
|
30
|
+
index: number;
|
|
31
|
+
input: string;
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
15
34
|
export declare class TextParserContext {
|
|
16
35
|
input: string;
|
|
17
36
|
offset: number;
|