@getodk/xpath 0.4.0 → 0.5.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.
- package/dist/.vite/manifest.json +4 -4
- package/dist/adapter/interface/XPathDOMOptimizableOperations.d.ts +1 -1
- package/dist/adapter/interface/XPathTraversalAdapter.d.ts +4 -4
- package/dist/adapter/xpathDOMProvider.d.ts +1 -16
- package/dist/context/Context.d.ts +3 -3
- package/dist/context/EvaluationContext.d.ts +4 -4
- package/dist/evaluations/DateTimeLikeEvaluation.d.ts +1 -1
- package/dist/evaluations/Evaluation.d.ts +2 -2
- package/dist/evaluations/LocationPathEvaluation.d.ts +10 -13
- package/dist/evaluations/NodeEvaluation.d.ts +1 -1
- package/dist/evaluations/ValueEvaluation.d.ts +4 -3
- package/dist/evaluator/Evaluator.d.ts +2 -2
- package/dist/evaluator/expression/FilterPathExpressionEvaluator.d.ts +1 -1
- package/dist/evaluator/expression/LocationPathEvaluator.d.ts +1 -1
- package/dist/evaluator/expression/LocationPathExpressionEvaluator.d.ts +1 -1
- package/dist/evaluator/expression/UnionExpressionEvaluator.d.ts +1 -1
- package/dist/evaluator/functions/FunctionLibraryCollection.d.ts +1 -1
- package/dist/evaluator/functions/NodeSetFunction.d.ts +1 -1
- package/dist/evaluator/result/BaseResult.d.ts +1 -1
- package/dist/evaluator/result/NodeSetResult.d.ts +5 -9
- package/dist/{expressionParser-BYZuKGXg.js → expressionParser-BUM7qFCl.js} +3272 -3270
- package/dist/{expressionParser-BYZuKGXg.js.map → expressionParser-BUM7qFCl.js.map} +1 -1
- package/dist/expressionParser.js +1 -1
- package/dist/index.js +4486 -22683
- package/dist/index.js.map +1 -1
- package/dist/lib/collections/sort.d.ts +1 -1
- package/dist/lib/datetime/coercion.d.ts +3 -3
- package/dist/lib/datetime/functions.d.ts +3 -3
- package/package.json +11 -12
- package/dist/lib/datetime/constants.d.ts +0 -6
- package/dist/lib/iterators/Reiterable.d.ts +0 -15
- package/dist/lib/iterators/common.d.ts +0 -17
- package/dist/lib/iterators/index.d.ts +0 -3
package/dist/.vite/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_expressionParser-
|
|
3
|
-
"file": "expressionParser-
|
|
2
|
+
"_expressionParser-BUM7qFCl.js": {
|
|
3
|
+
"file": "expressionParser-BUM7qFCl.js",
|
|
4
4
|
"name": "expressionParser"
|
|
5
5
|
},
|
|
6
6
|
"src/expressionParser.ts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"src": "src/expressionParser.ts",
|
|
10
10
|
"isEntry": true,
|
|
11
11
|
"imports": [
|
|
12
|
-
"_expressionParser-
|
|
12
|
+
"_expressionParser-BUM7qFCl.js"
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
15
|
"src/index.ts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"src": "src/index.ts",
|
|
19
19
|
"isEntry": true,
|
|
20
20
|
"imports": [
|
|
21
|
-
"_expressionParser-
|
|
21
|
+
"_expressionParser-BUM7qFCl.js"
|
|
22
22
|
]
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -5,7 +5,7 @@ export interface XPathDOMOptimizableOperations<T extends XPathNode> {
|
|
|
5
5
|
readonly getQualifiedNamedAttributeValue: (node: AdapterElement<T>, namespaceURI: string | null, localName: string) => string | null;
|
|
6
6
|
readonly getLocalNamedAttributeValue: (node: AdapterElement<T>, localName: string) => string | null;
|
|
7
7
|
readonly hasLocalNamedAttribute: (node: AdapterElement<T>, localName: string) => boolean;
|
|
8
|
-
readonly getChildrenByLocalName: (node: AdapterParentNode<T>, localName: string) =>
|
|
8
|
+
readonly getChildrenByLocalName: (node: AdapterParentNode<T>, localName: string) => ReadonlyArray<AdapterElement<T>>;
|
|
9
9
|
readonly getFirstChildNode: (node: T) => AdapterChildNode<T> | null;
|
|
10
10
|
readonly getFirstChildElement: (node: T) => AdapterElement<T> | null;
|
|
11
11
|
readonly getLastChildNode: (node: T) => AdapterChildNode<T> | null;
|
|
@@ -12,11 +12,11 @@ export interface XPathTraversalAdapter<T extends XPathNode> {
|
|
|
12
12
|
* mandatory optimization of that otherwise implicit expectation.
|
|
13
13
|
*/
|
|
14
14
|
readonly getContainingDocument: (node: T) => AdapterDocument<T>;
|
|
15
|
-
readonly getNamespaceDeclarations: (node: T) =>
|
|
16
|
-
readonly getAttributes: (node: T) =>
|
|
15
|
+
readonly getNamespaceDeclarations: (node: T) => ReadonlyArray<AdapterNamespaceDeclaration<T>>;
|
|
16
|
+
readonly getAttributes: (node: T) => ReadonlyArray<AdapterAttribute<T>>;
|
|
17
17
|
readonly getParentNode: (node: T) => AdapterParentNode<T> | null;
|
|
18
|
-
readonly getChildNodes: (node: T) =>
|
|
19
|
-
readonly getChildElements: (node: T) =>
|
|
18
|
+
readonly getChildNodes: (node: T) => ReadonlyArray<AdapterChildNode<T>>;
|
|
19
|
+
readonly getChildElements: (node: T) => ReadonlyArray<AdapterElement<T>>;
|
|
20
20
|
readonly getPreviousSiblingNode: (node: T) => AdapterChildNode<T> | null;
|
|
21
21
|
readonly getPreviousSiblingElement: (node: T) => AdapterElement<T> | null;
|
|
22
22
|
readonly getNextSiblingNode: (node: T) => AdapterChildNode<T> | null;
|
|
@@ -26,21 +26,6 @@ interface NodeKindGuards<T extends XPathNode> {
|
|
|
26
26
|
readonly isParentNode: NodeKindPredicate<T, AdapterParentNode<T>>;
|
|
27
27
|
readonly isQualifiedNamedNode: NodeKindPredicate<T, AdapterQualifiedNamedNode<T>>;
|
|
28
28
|
}
|
|
29
|
-
type IterableNodeFilter<T extends XPathNode, U extends T> = (nodes: Iterable<T>) => Iterable<U>;
|
|
30
|
-
/**
|
|
31
|
-
* Provides frequently used operations, such as filtering and sorting, on
|
|
32
|
-
* {@link Iterable} sequences of an {@link XPathDOMAdapter}'s node
|
|
33
|
-
* representation.
|
|
34
|
-
*/
|
|
35
|
-
interface IterableOperations<T extends XPathNode> {
|
|
36
|
-
readonly filterAttributes: IterableNodeFilter<T, AdapterAttribute<T>>;
|
|
37
|
-
readonly filterQualifiedNamedNodes: IterableNodeFilter<T, AdapterQualifiedNamedNode<T>>;
|
|
38
|
-
readonly filterComments: IterableNodeFilter<T, AdapterComment<T>>;
|
|
39
|
-
readonly filterNamespaceDeclarations: IterableNodeFilter<T, AdapterNamespaceDeclaration<T>>;
|
|
40
|
-
readonly filterProcessingInstructions: IterableNodeFilter<T, AdapterProcessingInstruction<T>>;
|
|
41
|
-
readonly filterTextNodes: IterableNodeFilter<T, AdapterText<T>>;
|
|
42
|
-
readonly sortInDocumentOrder: (nodes: Iterable<T>) => readonly T[];
|
|
43
|
-
}
|
|
44
29
|
/**
|
|
45
30
|
* Omitting XPathDOMOptimizableOperations keys here allows them to be made
|
|
46
31
|
* non-optional, without then repeating the exact same properties and their
|
|
@@ -74,7 +59,7 @@ declare const DERIVED_DOM_PROVIDER: unique symbol;
|
|
|
74
59
|
interface DerivedDOMProvider {
|
|
75
60
|
readonly [DERIVED_DOM_PROVIDER]: true;
|
|
76
61
|
}
|
|
77
|
-
export interface XPathDOMProvider<T extends XPathNode> extends OmitOptionalOptimizableOperations<XPathDOMAdapter<T>>, NodeKindGuards<T>,
|
|
62
|
+
export interface XPathDOMProvider<T extends XPathNode> extends OmitOptionalOptimizableOperations<XPathDOMAdapter<T>>, NodeKindGuards<T>, XPathDOMOptimizableOperations<T>, DerivedDOMProvider {
|
|
78
63
|
}
|
|
79
64
|
export declare const xpathDOMProvider: <T extends XPathNode>(adapter: XPathDOMAdapter<T>) => XPathDOMProvider<T>;
|
|
80
65
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Temporal } from '
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
2
|
import { XPathNode } from '../adapter/interface/XPathDOMAdapter.ts';
|
|
3
3
|
import { AdapterDocument, AdapterParentNode } from '../adapter/interface/XPathNodeKindAdapter.ts';
|
|
4
4
|
import { XPathDOMProvider } from '../adapter/xpathDOMProvider.ts';
|
|
@@ -21,10 +21,10 @@ export interface Context<T extends XPathNode> {
|
|
|
21
21
|
readonly evaluationContextNode: T;
|
|
22
22
|
readonly contextDocument: AdapterDocument<T>;
|
|
23
23
|
readonly rootNode: AdapterParentNode<T>;
|
|
24
|
-
readonly contextNodes:
|
|
24
|
+
readonly contextNodes: ReadonlySet<T>;
|
|
25
25
|
contextPosition(): number;
|
|
26
26
|
contextSize(): number;
|
|
27
27
|
readonly functions: FunctionLibraryCollection;
|
|
28
28
|
readonly namespaceResolver: NamespaceResolver<T>;
|
|
29
|
-
readonly timeZone: Temporal.
|
|
29
|
+
readonly timeZone: Temporal.TimeZoneLike;
|
|
30
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Temporal } from '
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
2
|
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
3
3
|
import { AdapterDocument, AdapterParentNode } from '../adapter/interface/XPathNodeKindAdapter.ts';
|
|
4
4
|
import { XPathDOMProvider } from '../adapter/xpathDOMProvider.ts';
|
|
@@ -11,7 +11,7 @@ export interface EvaluationContextOptions<T extends XPathNode> {
|
|
|
11
11
|
readonly rootNode: AdapterParentNode<T> | null;
|
|
12
12
|
readonly functions: FunctionLibraryCollection;
|
|
13
13
|
readonly namespaceResolver: XPathNSResolver | null;
|
|
14
|
-
readonly timeZone: Temporal.
|
|
14
|
+
readonly timeZone: Temporal.TimeZoneLike;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* The context in which an XPath expression (**not** a sub-expression)
|
|
@@ -26,10 +26,10 @@ export declare class EvaluationContext<T extends XPathNode> implements Context<T
|
|
|
26
26
|
readonly evaluationContextNode: T;
|
|
27
27
|
readonly contextDocument: AdapterDocument<T>;
|
|
28
28
|
readonly rootNode: AdapterParentNode<T>;
|
|
29
|
-
readonly contextNodes:
|
|
29
|
+
readonly contextNodes: ReadonlySet<T>;
|
|
30
30
|
readonly functions: FunctionLibraryCollection;
|
|
31
31
|
readonly namespaceResolver: NamespaceResolver<T>;
|
|
32
|
-
readonly timeZone: Temporal.
|
|
32
|
+
readonly timeZone: Temporal.TimeZoneLike;
|
|
33
33
|
constructor(evaluator: Evaluator<T>, contextNode: T, options?: Partial<EvaluationContextOptions<T>>);
|
|
34
34
|
contextPosition(): number;
|
|
35
35
|
contextSize(): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Temporal } from '
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
2
|
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
3
3
|
import { LocationPathEvaluation } from './LocationPathEvaluation.ts';
|
|
4
4
|
import { ValueEvaluation } from './ValueEvaluation.ts';
|
|
@@ -5,7 +5,7 @@ export interface Evaluation<T extends XPathNode, Type extends EvaluationType = E
|
|
|
5
5
|
readonly context: LocationPathEvaluation<T>;
|
|
6
6
|
readonly type: Type;
|
|
7
7
|
first(): Evaluation<T, Type> | null;
|
|
8
|
-
values():
|
|
8
|
+
values(): ReadonlyArray<Evaluation<T, Type>>;
|
|
9
9
|
eq(operand: Evaluation<T>): boolean;
|
|
10
10
|
ne(operand: Evaluation<T>): boolean;
|
|
11
11
|
lt(operand: Evaluation<T>): boolean;
|
|
@@ -15,5 +15,5 @@ export interface Evaluation<T extends XPathNode, Type extends EvaluationType = E
|
|
|
15
15
|
toBoolean(): boolean;
|
|
16
16
|
toNumber(): number;
|
|
17
17
|
toString(): string;
|
|
18
|
-
readonly nodes: Type extends 'NODE' ?
|
|
18
|
+
readonly nodes: Type extends 'NODE' ? ReadonlySet<T> : null;
|
|
19
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Temporal } from '
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
2
|
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
3
3
|
import { AdapterDocument, AdapterParentNode } from '../adapter/interface/XPathNodeKindAdapter.ts';
|
|
4
4
|
import { XPathDOMProvider } from '../adapter/xpathDOMProvider.ts';
|
|
@@ -12,24 +12,24 @@ import { LocationPathExpressionEvaluator } from '../evaluator/expression/Locatio
|
|
|
12
12
|
import { FunctionLibraryCollection } from '../evaluator/functions/FunctionLibraryCollection.ts';
|
|
13
13
|
import { NodeSetFunction } from '../evaluator/functions/NodeSetFunction.ts';
|
|
14
14
|
import { AnyStep } from '../evaluator/step/Step.ts';
|
|
15
|
-
import { Reiterable } from '../lib/iterators/Reiterable.ts';
|
|
16
15
|
import { Evaluation } from './Evaluation.ts';
|
|
17
16
|
import { NodeEvaluation } from './NodeEvaluation.ts';
|
|
18
17
|
type LocationPathParentContext<T extends XPathNode> = EvaluationContext<T> | LocationPathEvaluation<T>;
|
|
19
18
|
type EvaluationComparator<T extends XPathNode> = (lhs: Evaluation<T>, rhs: Evaluation<T>) => boolean;
|
|
20
19
|
interface LocationPathEvaluationOptions {
|
|
21
20
|
readonly contextPosition?: number;
|
|
22
|
-
contextSize?:
|
|
21
|
+
readonly contextSize?: number;
|
|
23
22
|
}
|
|
24
23
|
type ArbitraryNodesTemporaryCallee = FilterPathExpressionEvaluator | LocationPathEvaluator | NodeSetFunction;
|
|
25
24
|
type AssertLocationPathEvaluationInstance = <T extends XPathNode>(context: EvaluationContext<T>, value: unknown, message?: string) => asserts value is LocationPathEvaluation<T>;
|
|
26
25
|
export declare class LocationPathEvaluation<T extends XPathNode> implements Evaluation<T, 'NODE'>, Context<T>, EvaluationContext<T>, Iterable<LocationPathEvaluation<T>> {
|
|
27
26
|
readonly parentContext: LocationPathParentContext<T>;
|
|
27
|
+
readonly contextNodes: ReadonlySet<T>;
|
|
28
28
|
protected static isInstance<T extends XPathNode>(context: Context<T>, value: unknown): value is LocationPathEvaluation<T>;
|
|
29
29
|
static readonly assertInstance: AssertLocationPathEvaluationInstance;
|
|
30
30
|
readonly domProvider: XPathDOMProvider<T>;
|
|
31
31
|
readonly type = "NODE";
|
|
32
|
-
protected readonly nodeEvaluations:
|
|
32
|
+
protected readonly nodeEvaluations: ReadonlyArray<NodeEvaluation<T>>;
|
|
33
33
|
readonly evaluator: Evaluator<T>;
|
|
34
34
|
readonly context: LocationPathEvaluation<T>;
|
|
35
35
|
/**
|
|
@@ -38,15 +38,12 @@ export declare class LocationPathEvaluation<T extends XPathNode> implements Eval
|
|
|
38
38
|
readonly evaluationContextNode: T;
|
|
39
39
|
readonly contextDocument: AdapterDocument<T>;
|
|
40
40
|
readonly rootNode: AdapterParentNode<T>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
get contextNodes(): IterableIterator<T>;
|
|
44
|
-
protected computedContextSize: number | null;
|
|
45
|
-
protected readonly optionsContextSize?: () => number;
|
|
41
|
+
readonly nodes: ReadonlySet<T>;
|
|
42
|
+
protected computedContextSize: number;
|
|
46
43
|
protected readonly initializedContextPosition: number;
|
|
47
44
|
readonly functions: FunctionLibraryCollection;
|
|
48
45
|
readonly namespaceResolver: NamespaceResolver<T>;
|
|
49
|
-
readonly timeZone: Temporal.
|
|
46
|
+
readonly timeZone: Temporal.TimeZoneLike;
|
|
50
47
|
/**
|
|
51
48
|
* TODO: this is a temporary accommodation for these cases which are presently
|
|
52
49
|
* not especially well designed:
|
|
@@ -57,14 +54,14 @@ export declare class LocationPathEvaluation<T extends XPathNode> implements Eval
|
|
|
57
54
|
* - Nodes filtered by predicate in {@link LocationPathExpression}. Such
|
|
58
55
|
* filtering almost certainly should be performed here, in {@link step}.
|
|
59
56
|
*/
|
|
60
|
-
static fromArbitraryNodes<T extends XPathNode>(currentContext: LocationPathParentContext<T>, nodes:
|
|
57
|
+
static fromArbitraryNodes<T extends XPathNode>(currentContext: LocationPathParentContext<T>, nodes: readonly T[], _temporaryCallee: ArbitraryNodesTemporaryCallee): LocationPathEvaluation<T>;
|
|
61
58
|
static fromCurrentContext<T extends XPathNode>(evaluationContext: EvaluationContext<T>): LocationPathEvaluation<T>;
|
|
62
59
|
static fromRoot<T extends XPathNode>(parentContext: LocationPathParentContext<T>): LocationPathEvaluation<T>;
|
|
63
|
-
protected constructor(parentContext: LocationPathParentContext<T>, contextNodes:
|
|
60
|
+
protected constructor(parentContext: LocationPathParentContext<T>, contextNodes: ReadonlySet<T>, options?: LocationPathEvaluationOptions);
|
|
64
61
|
[Symbol.iterator](): {
|
|
65
62
|
next: () => IteratorResult<LocationPathEvaluation<T>>;
|
|
66
63
|
};
|
|
67
|
-
values():
|
|
64
|
+
values(): ReadonlyArray<NodeEvaluation<T>>;
|
|
68
65
|
contextPosition(): number;
|
|
69
66
|
contextSize(): number;
|
|
70
67
|
currentContext<U extends XPathNode>(this: LocationPathEvaluation<U>): LocationPathEvaluation<U>;
|
|
@@ -11,7 +11,7 @@ export declare class NodeEvaluation<T extends XPathNode> extends ValueEvaluation
|
|
|
11
11
|
readonly context: LocationPathEvaluation<T>;
|
|
12
12
|
readonly value: T;
|
|
13
13
|
readonly type = "NODE";
|
|
14
|
-
readonly nodes:
|
|
14
|
+
readonly nodes: ReadonlySet<T>;
|
|
15
15
|
protected computedValues: NodeEvaluationComputedValues | null;
|
|
16
16
|
protected get booleanValue(): boolean;
|
|
17
17
|
protected get numberValue(): number;
|
|
@@ -3,16 +3,17 @@ import { Evaluation } from './Evaluation.ts';
|
|
|
3
3
|
import { EvaluationType, EvaluationTypes } from './EvaluationType.ts';
|
|
4
4
|
import { LocationPathEvaluation } from './LocationPathEvaluation.ts';
|
|
5
5
|
export declare abstract class ValueEvaluation<T extends XPathNode, Type extends EvaluationType> implements Evaluation<T, Type> {
|
|
6
|
+
protected readonly _values: readonly [this];
|
|
6
7
|
abstract readonly context: LocationPathEvaluation<T>;
|
|
7
8
|
abstract readonly type: Type;
|
|
8
9
|
abstract readonly value: EvaluationTypes<T>[Type];
|
|
9
|
-
abstract readonly nodes: Type extends 'NODE' ?
|
|
10
|
+
abstract readonly nodes: Type extends 'NODE' ? ReadonlySet<T> : null;
|
|
10
11
|
protected abstract readonly booleanValue: boolean;
|
|
11
12
|
protected abstract readonly numberValue: number;
|
|
12
13
|
protected abstract readonly stringValue: string;
|
|
13
|
-
[Symbol.iterator]():
|
|
14
|
+
[Symbol.iterator](): ArrayIterator<this>;
|
|
14
15
|
first(): this;
|
|
15
|
-
values():
|
|
16
|
+
values(): readonly this[];
|
|
16
17
|
toBoolean(): boolean;
|
|
17
18
|
toNumber(): number;
|
|
18
19
|
toString(): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Temporal } from '
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
2
|
import { UnwrapAdapterNode } from '../adapter/interface/XPathCustomUnwrappableNode.ts';
|
|
3
3
|
import { XPathDOMAdapter } from '../adapter/interface/XPathDOMAdapter.ts';
|
|
4
4
|
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
@@ -29,7 +29,7 @@ export declare class Evaluator<T extends XPathNode> {
|
|
|
29
29
|
readonly functions: FunctionLibraryCollection;
|
|
30
30
|
readonly parseOptions: ParseOptions;
|
|
31
31
|
readonly rootNode: AdapterParentNode<T> | null;
|
|
32
|
-
readonly timeZone: Temporal.
|
|
32
|
+
readonly timeZone: Temporal.TimeZoneLike;
|
|
33
33
|
constructor(options: EvaluatorOptions<T>);
|
|
34
34
|
/**
|
|
35
35
|
* @package - exposed for testing
|
|
@@ -9,5 +9,5 @@ export declare class FilterPathExpressionEvaluator extends LocationPathEvaluator
|
|
|
9
9
|
readonly filterExpression: LocationPathExpressionEvaluator;
|
|
10
10
|
readonly hasSteps: boolean;
|
|
11
11
|
constructor(syntaxNode: FilterPathExprNode);
|
|
12
|
-
evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>):
|
|
12
|
+
evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>): ReadonlySet<T>;
|
|
13
13
|
}
|
|
@@ -19,6 +19,6 @@ export declare class LocationPathEvaluator extends LocationPathExpressionEvaluat
|
|
|
19
19
|
protected isSelf: boolean;
|
|
20
20
|
protected steps: PathExprSteps;
|
|
21
21
|
constructor(syntaxNode: LocationPathNode, options: LocationPathExpressionOptions);
|
|
22
|
-
evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>):
|
|
22
|
+
evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>): ReadonlySet<T>;
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
@@ -4,6 +4,6 @@ import { Evaluation } from '../../evaluations/Evaluation.ts';
|
|
|
4
4
|
import { ExpressionEvaluator, ExpressionNode } from './ExpressionEvaluator.ts';
|
|
5
5
|
export declare abstract class LocationPathExpressionEvaluator implements ExpressionEvaluator {
|
|
6
6
|
abstract readonly syntaxNode: ExpressionNode;
|
|
7
|
-
abstract evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>):
|
|
7
|
+
abstract evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>): ReadonlySet<T>;
|
|
8
8
|
evaluate<T extends XPathNode>(context: EvaluationContext<T>): Evaluation<T, 'NODE'>;
|
|
9
9
|
}
|
|
@@ -8,5 +8,5 @@ export declare class UnionExpressionEvaluator extends LocationPathExpressionEval
|
|
|
8
8
|
readonly lhs: ExpressionEvaluator;
|
|
9
9
|
readonly rhs: ExpressionEvaluator;
|
|
10
10
|
constructor(syntaxNode: UnionExprNode);
|
|
11
|
-
evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>):
|
|
11
|
+
evaluateNodes<T extends XPathNode>(context: EvaluationContext<T>): ReadonlySet<T>;
|
|
12
12
|
}
|
|
@@ -35,7 +35,7 @@ export declare class FunctionLibraryCollection {
|
|
|
35
35
|
*/
|
|
36
36
|
protected readonly defaultFunctionLibraries: readonly FunctionLibrary[];
|
|
37
37
|
protected readonly namespacedFunctionLibraries: ReadonlyMap<string, FunctionLibrary>;
|
|
38
|
-
constructor(functionLibraries:
|
|
38
|
+
constructor(functionLibraries: readonly FunctionLibrary[], options?: FunctionLibraryCollectionOptions);
|
|
39
39
|
getDefaultImplementation(localName: string): FunctionImplementation | null;
|
|
40
40
|
getImplementation<T extends XPathNode>(context: Context<T>, name: FunctionNameLookup): FunctionImplementation | null;
|
|
41
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { XPathNode } from '../../adapter/interface/XPathNode.ts';
|
|
2
2
|
import { LocationPathEvaluation } from '../../evaluations/LocationPathEvaluation.ts';
|
|
3
3
|
import { EvaluableArgument, FunctionSignature, FunctionImplementation } from './FunctionImplementation.ts';
|
|
4
|
-
export type NodeSetFunctionCallable = <T extends XPathNode, Arguments extends readonly EvaluableArgument[]>(context: LocationPathEvaluation<T>, args: Arguments) =>
|
|
4
|
+
export type NodeSetFunctionCallable = <T extends XPathNode, Arguments extends readonly EvaluableArgument[]>(context: LocationPathEvaluation<T>, args: Arguments) => readonly T[];
|
|
5
5
|
export declare class NodeSetFunction extends FunctionImplementation {
|
|
6
6
|
constructor(localName: string, signature: FunctionSignature, call: NodeSetFunctionCallable);
|
|
7
7
|
}
|
|
@@ -24,7 +24,7 @@ export declare abstract class BaseResult<T extends XPathNode> implements XPathEv
|
|
|
24
24
|
readonly ORDERED_NODE_SNAPSHOT_TYPE: 7;
|
|
25
25
|
readonly ANY_UNORDERED_NODE_TYPE: 8;
|
|
26
26
|
readonly FIRST_ORDERED_NODE_TYPE: 9;
|
|
27
|
-
protected abstract readonly nodes:
|
|
27
|
+
protected abstract readonly nodes: ReadonlySet<T> | null;
|
|
28
28
|
abstract readonly resultType: XPathEvaluationResultType;
|
|
29
29
|
abstract readonly invalidIteratorState: boolean;
|
|
30
30
|
abstract readonly singleNodeValue: T | null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { XPathNode } from '../../adapter/interface/XPathNode.ts';
|
|
2
2
|
import { XPathDOMProvider } from '../../adapter/xpathDOMProvider.ts';
|
|
3
|
-
import { Reiterable } from '../../lib/iterators/index.ts';
|
|
4
3
|
import { NodeSetResultType, BaseResult } from './BaseResult.ts';
|
|
5
4
|
import { XPathEvaluationResult } from './XPathEvaluationResult.ts';
|
|
6
5
|
interface ComputedNodeSetResult {
|
|
@@ -10,8 +9,7 @@ interface ComputedNodeSetResult {
|
|
|
10
9
|
}
|
|
11
10
|
export declare abstract class NodeSetResult<T extends XPathNode> extends BaseResult<T> implements XPathEvaluationResult<T> {
|
|
12
11
|
protected readonly domProvider: XPathDOMProvider<T>;
|
|
13
|
-
protected readonly
|
|
14
|
-
protected readonly nodes: Iterable<T>;
|
|
12
|
+
protected readonly nodes: ReadonlySet<T>;
|
|
15
13
|
protected computedBooleanValue: boolean | null;
|
|
16
14
|
protected computedNumberValue: number | null;
|
|
17
15
|
protected computedStringValue: string | null;
|
|
@@ -20,7 +18,7 @@ export declare abstract class NodeSetResult<T extends XPathNode> extends BaseRes
|
|
|
20
18
|
get stringValue(): string;
|
|
21
19
|
protected computedSnapshotValue: readonly T[] | null;
|
|
22
20
|
abstract readonly resultType: NodeSetResultType;
|
|
23
|
-
constructor(domProvider: XPathDOMProvider<T>, value:
|
|
21
|
+
constructor(domProvider: XPathDOMProvider<T>, value: ReadonlySet<T>);
|
|
24
22
|
protected compute(): ComputedNodeSetResult;
|
|
25
23
|
}
|
|
26
24
|
export declare class NodeSetSnapshotResult<T extends XPathNode> extends NodeSetResult<T> implements XPathEvaluationResult<T> {
|
|
@@ -30,20 +28,18 @@ export declare class NodeSetSnapshotResult<T extends XPathNode> extends NodeSetR
|
|
|
30
28
|
readonly snapshotLength: number;
|
|
31
29
|
readonly invalidIteratorState: boolean;
|
|
32
30
|
readonly singleNodeValue: T | null;
|
|
33
|
-
constructor(domProvider: XPathDOMProvider<T>, resultType: NodeSetResultType, nodes:
|
|
31
|
+
constructor(domProvider: XPathDOMProvider<T>, resultType: NodeSetResultType, nodes: ReadonlySet<T>);
|
|
34
32
|
iterateNext(): T | null;
|
|
35
33
|
snapshotItem(index: number): T | null;
|
|
36
34
|
}
|
|
37
35
|
export declare class NodeSetIteratorResult<T extends XPathNode> extends NodeSetResult<T> implements XPathEvaluationResult<T> {
|
|
38
36
|
readonly resultType: NodeSetResultType;
|
|
39
|
-
protected activeIterator: IterableIterator<T
|
|
40
|
-
protected nodes: Reiterable<T>;
|
|
37
|
+
protected readonly activeIterator: IterableIterator<T>;
|
|
41
38
|
readonly invalidIteratorState: boolean;
|
|
42
39
|
protected computedSingleNodeValue: T | null | undefined;
|
|
43
40
|
get singleNodeValue(): T | null;
|
|
44
41
|
get snapshotLength(): number;
|
|
45
|
-
constructor(domProvider: XPathDOMProvider<T>, resultType: NodeSetResultType, nodes:
|
|
46
|
-
protected activateIterator(): IterableIterator<T>;
|
|
42
|
+
constructor(domProvider: XPathDOMProvider<T>, resultType: NodeSetResultType, nodes: ReadonlySet<T>);
|
|
47
43
|
iterateNext(): T | null;
|
|
48
44
|
snapshotItem(_index: number): T | null;
|
|
49
45
|
}
|