@aehrc/ecl-core 1.6.2 → 1.8.0

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 (41) hide show
  1. package/README.md +207 -8
  2. package/dist/derive/compress-expression.d.ts +55 -0
  3. package/dist/derive/compress-expression.d.ts.map +1 -0
  4. package/dist/derive/cover-optimiser.d.ts +20 -0
  5. package/dist/derive/cover-optimiser.d.ts.map +1 -0
  6. package/dist/derive/critique.d.ts +42 -0
  7. package/dist/derive/critique.d.ts.map +1 -0
  8. package/dist/derive/derive-ecl.d.ts +278 -0
  9. package/dist/derive/derive-ecl.d.ts.map +1 -0
  10. package/dist/derive/greedy-grouping.d.ts +15 -0
  11. package/dist/derive/greedy-grouping.d.ts.map +1 -0
  12. package/dist/derive/hierarchy-clauses.d.ts +35 -0
  13. package/dist/derive/hierarchy-clauses.d.ts.map +1 -0
  14. package/dist/derive/refinements.d.ts +39 -0
  15. package/dist/derive/refinements.d.ts.map +1 -0
  16. package/dist/derive/set-queries.d.ts +58 -0
  17. package/dist/derive/set-queries.d.ts.map +1 -0
  18. package/dist/derive/taxonomy-graph.d.ts +38 -0
  19. package/dist/derive/taxonomy-graph.d.ts.map +1 -0
  20. package/dist/formatter/comments.d.ts +15 -0
  21. package/dist/formatter/comments.d.ts.map +1 -1
  22. package/dist/formatter/formatter.d.ts.map +1 -1
  23. package/dist/formatter/rules.d.ts +2 -0
  24. package/dist/formatter/rules.d.ts.map +1 -1
  25. package/dist/index.cjs +3569 -971
  26. package/dist/index.d.ts +11 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.mjs +3561 -972
  29. package/dist/minify/minify.d.ts +34 -0
  30. package/dist/minify/minify.d.ts.map +1 -0
  31. package/dist/parser/index.d.ts +14 -0
  32. package/dist/parser/index.d.ts.map +1 -1
  33. package/dist/refactoring/index.d.ts +2 -1
  34. package/dist/refactoring/index.d.ts.map +1 -1
  35. package/dist/refactoring/simplify-expression.d.ts +50 -0
  36. package/dist/refactoring/simplify-expression.d.ts.map +1 -1
  37. package/dist/terminology/fhir-service.d.ts +23 -1
  38. package/dist/terminology/fhir-service.d.ts.map +1 -1
  39. package/dist/terminology/types.d.ts +58 -0
  40. package/dist/terminology/types.d.ts.map +1 -1
  41. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive-ecl.d.ts","sourceRoot":"","sources":["../../src/derive/derive-ecl.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAe,mBAAmB,EAAmB,MAAM,sBAAsB,CAAC;AAE9F,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAuC,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGhG,OAAO,EAA6D,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAIjH,kGAAkG;AAClG;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5F,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mHAAmH;IACnH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+FAA+F;IAC/F,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OA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auses';
2
+ import { TaxonomyGraph } from './taxonomy-graph';
3
+ export interface GreedyGrouping {
4
+ ecl: string;
5
+ includes: HierarchyClause[];
6
+ exclusions: HierarchyClause[];
7
+ }
8
+ /** A greedy grouping of the members, counted in `graph` (loaded with {@link refactorDescend}). */
9
+ export declare function greedyGrouping(graph: TaxonomyGraph, maxClauses: number): GreedyGrouping;
10
+ /**
11
+ * The discard rules that need no descendant counts: which concepts of `>> list`
12
+ * are worth loading descendants for, so ALL is counted only for those.
13
+ */
14
+ export declare function refactorDescend(id: string, graph: Pick<TaxonomyGraph, 'truePos' | 'children' | 'members'>): boolean;
15
+ //# sourceMappingURL=greedy-grouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greedy-grouping.d.ts","sourceRoot":"","sources":["../../src/derive/greedy-grouping.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAkC,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAqBD,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAYvF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,GAAG,OAAO,CAMnH"}
@@ -0,0 +1,35 @@
1
+ import { TaxonomyGraph } from './taxonomy-graph';
2
+ export interface HierarchyClause {
3
+ conceptId: string;
4
+ /** `=` is the concept alone, written without an operator. */
5
+ operator: '<<' | '<' | '=';
6
+ }
7
+ export interface ClauseForm {
8
+ includes: HierarchyClause[];
9
+ exclusions: HierarchyClause[];
10
+ }
11
+ /** The concepts a clause selects. Complete only when the graph has the clause's descendants. */
12
+ export declare function selection(c: HierarchyClause, g: TaxonomyGraph): string[];
13
+ /** What the form selects, or null when a clause needs descendants the graph did not load. */
14
+ export declare function evaluate(form: ClauseForm, g: TaxonomyGraph): Set<string> | null;
15
+ /** What the form adds to and misses of the members, and its clause count; null when it cannot be evaluated. */
16
+ export declare function localScore(form: ClauseForm, g: TaxonomyGraph): {
17
+ additions: number;
18
+ misses: number;
19
+ clauses: number;
20
+ } | null;
21
+ /**
22
+ * Drop clauses another clause already selects (`< x` with `= x` becomes
23
+ * `<< x`), then clauses everything they select is selected by the others,
24
+ * smallest first: `< y` is redundant when each of y's descendants falls under
25
+ * another clause, though y does not.
26
+ */
27
+ export declare function prune(includes: HierarchyClause[], g: TaxonomyGraph): HierarchyClause[];
28
+ /**
29
+ * Exact exclusions for `includes`: what they select outside the set. A concept
30
+ * with no member at or below it is outside `>> list`; the highest of them go
31
+ * as `<< y`. A non-member above a member goes alone, as `= x`.
32
+ */
33
+ export declare function exactExclusions(includes: HierarchyClause[], g: TaxonomyGraph): HierarchyClause[];
34
+ export declare function render(form: ClauseForm): string;
35
+ //# sourceMappingURL=hierarchy-clauses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchy-clauses.d.ts","sourceRoot":"","sources":["../../src/derive/hierarchy-clauses.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM,EAAE,CAIxE;AAYD,6FAA6F;AAC7F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAK/E;AAED,+GAA+G;AAC/G,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,CAAC,EAAE,aAAa,GACf;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQ/D;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,CAAC,EAAE,aAAa,GAAG,eAAe,EAAE,CAStF;AAuCD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,CAAC,EAAE,aAAa,GAAG,eAAe,EAAE,CAWhG;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAK/C"}
@@ -0,0 +1,39 @@
1
+ import { ITerminologyService } from '../terminology/types';
2
+ import { MemberSet, SetQueries } from './set-queries';
3
+ /** One part of a refinement: `[cardinality] attribute comparison value`. */
4
+ export interface RefinementClause {
5
+ attribute: string;
6
+ comparison: '=' | '>=' | '<=';
7
+ /** An ECL value: `<< 123`, `(…)`, `*`, or a concrete `#500` / `"text"`. */
8
+ value: string;
9
+ /** e.g. `[2..*]`. */
10
+ cardinality?: string;
11
+ }
12
+ /**
13
+ * Refinement candidates for the set, likeliest first. `roots` are the set's
14
+ * roots (all of them when `roots.total` fits); `givenFoci` come from the input
15
+ * or the caller, and the most specific concept above every member is added
16
+ * unless `fixedFocus` says the caller chose the focus.
17
+ */
18
+ export declare function refinementCandidates(members: MemberSet, roots: {
19
+ codes: string[];
20
+ total: number;
21
+ }, givenFoci: string[], fixedFocus: boolean, q: SetQueries, terminology: ITerminologyService, notes: string[]): Promise<{
22
+ focus: string;
23
+ clauses: RefinementClause[];
24
+ }[]>;
25
+ /** `focus : clause, clause …` */
26
+ export declare function refinementText(focus: string, clauses: RefinementClause[]): string;
27
+ /**
28
+ * Reference sets an ECL input is restricted to (`^ R : …`, `^ R AND …`): a
29
+ * natural focus for refinements, such as an AMT product level.
30
+ */
31
+ export declare function refsetFoci(ecl: string): string[];
32
+ /** A focus usable before `:`: a single clause or `^ id` as is, anything else bracketed. */
33
+ export declare function asFocus(ecl: string): string;
34
+ /**
35
+ * The most specific concepts that are, or are ancestors of, every one of
36
+ * `concepts`, in one query: X = `(>> c1) AND (>> c2) …`, then `X MINUS > X`.
37
+ */
38
+ export declare function lowestCommonAncestors(concepts: string[], q: SetQueries): Promise<string[]>;
39
+ //# sourceMappingURL=refinements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refinements.d.ts","sourceRoot":"","sources":["../../src/derive/refinements.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAwB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAML,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAEvB,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA4DD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EACzC,SAAS,EAAE,MAAM,EAAE,EACnB,UAAU,EAAE,OAAO,EACnB,CAAC,EAAE,UAAU,EACb,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,EAAE,CAAC,CA2C3D;AAED,iCAAiC;AACjC,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAEjF;AAqLD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBhD;AAED,2FAA2F;AAC3F,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG3C;AA4BD;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAMhG"}
@@ -0,0 +1,58 @@
1
+ import { EvaluationConcept, ITerminologyService, ValueSetClause, ValueSetCompose } from '../terminology/types';
2
+ export interface SetDifference {
3
+ count: number;
4
+ /** Up to `sampleSize` of the concepts, as the server returned them. */
5
+ sample: EvaluationConcept[];
6
+ }
7
+ export declare const SNOMED_ROOT = "138875005";
8
+ /** Concurrent set queries; see {@link SetQueries}. */
9
+ export declare const MAX_IN_FLIGHT = 8;
10
+ /** Numeric order for SCTIDs, so output does not depend on input or server order. */
11
+ export declare function byId(a: string, b: string): number;
12
+ export declare function compareText(a: string, b: string): number;
13
+ /** `x` alone, or `(x OR y …)` — safe as an operand anywhere. */
14
+ export declare function orGroup(terms: string[]): string;
15
+ /**
16
+ * `ecl` without display terms and comments, so candidates built from it can be
17
+ * given terms afresh and their concept references counted. Quoted strings
18
+ * (filter values) are kept as they are.
19
+ */
20
+ export declare function stripTermsAndComments(ecl: string): string;
21
+ export declare function countClauses(ecl: string): number;
22
+ export type ExpandCompose = NonNullable<ITerminologyService['expandCompose']>;
23
+ /** The set under study, as a compose clause and as an ECL operand. */
24
+ export interface MemberSet {
25
+ clause: ValueSetClause;
26
+ ecl: string;
27
+ size: number;
28
+ }
29
+ /**
30
+ * Set queries against the server. At most {@link MAX_IN_FLIGHT} run at once:
31
+ * many carry the whole member list, and the service may not queue them itself.
32
+ */
33
+ export declare class SetQueries {
34
+ private readonly expandCompose;
35
+ private inFlight;
36
+ private readonly waiting;
37
+ constructor(expandCompose: ExpandCompose);
38
+ private expand;
39
+ count(compose: ValueSetCompose): Promise<number>;
40
+ sample(compose: ValueSetCompose, count: number, activeOnly?: boolean): Promise<SetDifference>;
41
+ /** Up to `max` codes of the set, sorted, plus the set's exact total. */
42
+ codes(compose: ValueSetCompose, max: number, activeOnly?: boolean): Promise<{
43
+ codes: string[];
44
+ total: number;
45
+ }>;
46
+ /** Up to `max` concepts of the set with their terms, in the server's order, plus the set's exact total. */
47
+ concepts(compose: ValueSetCompose, max: number, activeOnly?: boolean): Promise<{
48
+ concepts: EvaluationConcept[];
49
+ total: number;
50
+ }>;
51
+ /**
52
+ * Every concept of the set with its direct parents, or why not: the set has
53
+ * more than `max` concepts, or the server does not return parents.
54
+ */
55
+ graph(compose: ValueSetCompose, max: number): Promise<Map<string, string[]> | 'too-large' | 'no-parents'>;
56
+ countEcl(ecl: string): Promise<number>;
57
+ }
58
+ //# sourceMappingURL=set-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-queries.d.ts","sourceRoot":"","sources":["../../src/derive/set-queries.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEpH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B;AAED,eAAO,MAAM,WAAW,cAAc,CAAC;AAGvC,sDAAsD;AACtD,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,oFAAoF;AACpF,wBA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EACX,UAAU,UAAO,GAChB,OAAO,CAAC;QAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAc5D;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,GAAG,YAAY,CAAC;IAc/G,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGvC"}
@@ -0,0 +1,38 @@
1
+ import { MemberSet, SetQueries } from './set-queries';
2
+ export interface TaxonomyGraph {
3
+ readonly members: ReadonlySet<string>;
4
+ /** True when only the `fallbackDescend` descendants were loaded (the others were too many). */
5
+ readonly partial: boolean;
6
+ /** True when the concept is a member or has a member below it (it is in `>> list`). */
7
+ aboveMember(id: string): boolean;
8
+ /** Direct children; complete for every concept in `>> list` and every concept below a loaded candidate. */
9
+ children(id: string): string[];
10
+ parents(id: string): string[];
11
+ /** `id` and everything below it; complete only when `hasDescendants(id)`. */
12
+ descendants(id: string): string[];
13
+ hasDescendants(id: string): boolean;
14
+ /** Members at or below `id`. */
15
+ truePos(id: string): number;
16
+ /** Members with no member ancestor, sorted byId. */
17
+ roots(): string[];
18
+ /** Concepts in `>> list` except the SNOMED root, sorted byId. */
19
+ ancestors(): string[];
20
+ }
21
+ /** What was too large to fetch, or `'parents'` when the server does not return them. */
22
+ export interface GraphUnavailable {
23
+ unavailable: string;
24
+ }
25
+ export interface TaxonomyGraphOptions {
26
+ /** Most concepts in any subgraph fetched. */
27
+ maxConcepts: number;
28
+ /** Picks which concepts of `>> list` get their descendants loaded. Roots with children always do. */
29
+ descend: (id: string, graph: Pick<TaxonomyGraph, 'truePos' | 'children' | 'members'>) => boolean;
30
+ /**
31
+ * When the descendants `descend` picks (with the roots) are more than
32
+ * `maxConcepts`, load only those this picks, without the roots, and mark the
33
+ * graph partial. Default: none, the graph is unavailable.
34
+ */
35
+ fallbackDescend?: TaxonomyGraphOptions['descend'];
36
+ }
37
+ export declare function loadTaxonomyGraph(members: MemberSet, q: SetQueries, options: TaxonomyGraphOptions): Promise<TaxonomyGraph | GraphUnavailable>;
38
+ //# sourceMappingURL=taxonomy-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taxonomy-graph.d.ts","sourceRoot":"","sources":["../../src/derive/taxonomy-graph.ts"],"names":[],"mappings":"AAYA,OAAO,EAA8B,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5F,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,uFAAuF;IACvF,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,gCAAgC;IAChC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,oDAAoD;IACpD,KAAK,IAAI,MAAM,EAAE,CAAC;IAClB,iEAAiE;IACjE,SAAS,IAAI,MAAM,EAAE,CAAC;CACvB;AAED,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,qGAAqG;IACrG,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,KAAK,OAAO,CAAC;IACjG;;;;OAIG;IACH,eAAe,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;CACnD;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,SAAS,EAClB,CAAC,EAAE,UAAU,EACb,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,GAAG,gBAAgB,CAAC,CAoB3C"}
@@ -6,6 +6,21 @@ export interface Comment {
6
6
  position: 'before' | 'inline' | 'between';
7
7
  trailingWhitespace?: string;
8
8
  }
9
+ /** A comment in the text, from {@link commentSpans}. */
10
+ export interface CommentSpan {
11
+ start: number;
12
+ end: number;
13
+ content: string;
14
+ type: 'block' | 'line';
15
+ }
16
+ /**
17
+ * The comments in `text`, in order, from one left-to-right scan: whichever
18
+ * starts first wins, so a comment marker inside a display term or quoted
19
+ * string (`|see http://x|`, `"a /* b *\/"`) is text, and a block marker inside
20
+ * a line comment is part of that comment. The formatter splits expressions at
21
+ * the `/* ECL-END *\/` comments found here, and only here.
22
+ */
23
+ export declare function commentSpans(text: string): CommentSpan[];
9
24
  export declare function extractComments(text: string): {
10
25
  comments: Comment[];
11
26
  textWithoutComments: string;
@@ -1 +1 @@
1
- {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/formatter/comments.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAmKlG;AAID,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAuFzG"}
1
+ {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/formatter/comments.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAexD;AAID,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CA6HlG;AAID,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAuFzG"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/formatter/formatter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAoa9C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAiD/E"}
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/formatter/formatter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AA2c9C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAiD/E"}
@@ -3,6 +3,8 @@ export declare function getIndentString(level: number, options: FormattingOption
3
3
  export declare function formatLogicalOperator(operator: string, _options: FormattingOptions): string;
4
4
  export declare function formatRefinementColon(operator: string): string;
5
5
  export declare function formatRefinementEquals(operator: string): string;
6
+ /** A display term's text with newlines, tabs and runs of spaces collapsed to single spaces. */
7
+ export declare function collapseTermWhitespace(term: string): string;
6
8
  export declare function normalizeTerm(term: string): string;
7
9
  export declare function shouldBreakLine(currentLength: number, options: FormattingOptions): boolean;
8
10
  //# sourceMappingURL=rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/formatter/rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAGjF;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAM3F;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAK1F"}
1
+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