@getodk/xpath 0.1.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/README.md +158 -0
- package/dist/.vite/manifest.json +21 -0
- package/dist/context/Context.d.ts +27 -0
- package/dist/context/EvaluationContext.d.ts +48 -0
- package/dist/evaluations/BooleanEvaluation.d.ts +12 -0
- package/dist/evaluations/DateTimeLikeEvaluation.d.ts +23 -0
- package/dist/evaluations/Evaluation.d.ts +18 -0
- package/dist/evaluations/EvaluationType.d.ts +7 -0
- package/dist/evaluations/LocationPathEvaluation.d.ts +113 -0
- package/dist/evaluations/NodeEvaluation.d.ts +22 -0
- package/dist/evaluations/NumberEvaluation.d.ts +12 -0
- package/dist/evaluations/StringEvaluation.d.ts +13 -0
- package/dist/evaluations/ValueEvaluation.d.ts +24 -0
- package/dist/evaluator/Evaluator.d.ts +41 -0
- package/dist/evaluator/NamespaceResolver.d.ts +48 -0
- package/dist/evaluator/expression/AbsoluteLocationPathExpressionEvaluator.d.ts +7 -0
- package/dist/evaluator/expression/BinaryExpressionEvaluator.d.ts +11 -0
- package/dist/evaluator/expression/BooleanBinaryExpressionEvaluator.d.ts +17 -0
- package/dist/evaluator/expression/ExpressionEvaluator.d.ts +8 -0
- package/dist/evaluator/expression/FilterPathExpressionEvaluator.d.ts +12 -0
- package/dist/evaluator/expression/FunctionCallExpressionEvaluator.d.ts +16 -0
- package/dist/evaluator/expression/LocationPathEvaluator.d.ts +23 -0
- package/dist/evaluator/expression/LocationPathExpressionEvaluator.d.ts +8 -0
- package/dist/evaluator/expression/NumberExpressionEvaluator.d.ts +10 -0
- package/dist/evaluator/expression/NumberLiteralExpressionEvaluator.d.ts +8 -0
- package/dist/evaluator/expression/NumericBinaryExpressionEvaluator.d.ts +12 -0
- package/dist/evaluator/expression/RelativeLocationPathExpressionEvaluator.d.ts +7 -0
- package/dist/evaluator/expression/StringExpressionEvaluator.d.ts +10 -0
- package/dist/evaluator/expression/StringLiteralExpressionEvaluator.d.ts +8 -0
- package/dist/evaluator/expression/UnaryExpressionEvaluator.d.ts +10 -0
- package/dist/evaluator/expression/UnionExpressionEvaluator.d.ts +11 -0
- package/dist/evaluator/expression/factory.d.ts +5 -0
- package/dist/evaluator/functions/BooleanFunction.d.ts +6 -0
- package/dist/evaluator/functions/FunctionAlias.d.ts +4 -0
- package/dist/evaluator/functions/FunctionImplementation.d.ts +39 -0
- package/dist/evaluator/functions/FunctionLibrary.d.ts +21 -0
- package/dist/evaluator/functions/FunctionLibraryCollection.d.ts +41 -0
- package/dist/evaluator/functions/NodeSetFunction.d.ts +7 -0
- package/dist/evaluator/functions/NumberFunction.d.ts +6 -0
- package/dist/evaluator/functions/StringFunction.d.ts +6 -0
- package/dist/evaluator/functions/TypedFunctionImplementation.d.ts +8 -0
- package/dist/evaluator/functions/index.d.ts +1 -0
- package/dist/evaluator/result/BaseResult.d.ts +34 -0
- package/dist/evaluator/result/BooleanResult.d.ts +12 -0
- package/dist/evaluator/result/NodeSetResult.d.ts +55 -0
- package/dist/evaluator/result/NumberResult.d.ts +12 -0
- package/dist/evaluator/result/PrimitiveResult.d.ts +12 -0
- package/dist/evaluator/result/ResultType.d.ts +13 -0
- package/dist/evaluator/result/StringResult.d.ts +12 -0
- package/dist/evaluator/result/index.d.ts +7 -0
- package/dist/evaluator/step/Step.d.ts +129 -0
- package/dist/expressionParser-1Kzq3bIy.js +2356 -0
- package/dist/expressionParser-1Kzq3bIy.js.map +1 -0
- package/dist/expressionParser.d.ts +2 -0
- package/dist/expressionParser.js +2 -0
- package/dist/expressionParser.js.map +1 -0
- package/dist/functions/_shared/number.d.ts +11 -0
- package/dist/functions/_shared/string.d.ts +3 -0
- package/dist/functions/enketo/index.d.ts +2 -0
- package/dist/functions/fn/boolean.d.ts +8 -0
- package/dist/functions/fn/index.d.ts +2 -0
- package/dist/functions/fn/node-set.d.ts +11 -0
- package/dist/functions/fn/number.d.ts +7 -0
- package/dist/functions/fn/string.d.ts +13 -0
- package/dist/functions/javarosa/index.d.ts +2 -0
- package/dist/functions/javarosa/string.d.ts +2 -0
- package/dist/functions/xforms/boolean.d.ts +6 -0
- package/dist/functions/xforms/datetime.d.ts +10 -0
- package/dist/functions/xforms/geo.d.ts +3 -0
- package/dist/functions/xforms/index.d.ts +2 -0
- package/dist/functions/xforms/node-set.d.ts +8 -0
- package/dist/functions/xforms/number.d.ts +29 -0
- package/dist/functions/xforms/select.d.ts +6 -0
- package/dist/functions/xforms/string.d.ts +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +31976 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/collections/sort.d.ts +1 -0
- package/dist/lib/datetime/coercion.d.ts +4 -0
- package/dist/lib/datetime/constants.d.ts +6 -0
- package/dist/lib/datetime/functions.d.ts +5 -0
- package/dist/lib/datetime/predicates.d.ts +5 -0
- package/dist/lib/dom/assertions.d.ts +4 -0
- package/dist/lib/dom/predicates.d.ts +11 -0
- package/dist/lib/dom/sort.d.ts +1 -0
- package/dist/lib/dom/traversal.d.ts +21 -0
- package/dist/lib/dom/types.d.ts +21 -0
- package/dist/lib/dom/xml.d.ts +1 -0
- package/dist/lib/iterators/Reiterable.d.ts +15 -0
- package/dist/lib/iterators/common.d.ts +17 -0
- package/dist/lib/iterators/index.d.ts +3 -0
- package/dist/lib/regex/escape.d.ts +1 -0
- package/dist/shared/constants.d.ts +13 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/interface.d.ts +33 -0
- package/dist/static/grammar/ExpressionParser.d.ts +27 -0
- package/dist/static/grammar/SyntaxLanguage.d.ts +5 -0
- package/dist/static/grammar/SyntaxNode.d.ts +144 -0
- package/dist/static/grammar/SyntaxTree.d.ts +6 -0
- package/dist/static/grammar/TreeSitterXPathParser.d.ts +38 -0
- package/dist/static/grammar/type-names.d.ts +89 -0
- package/dist/xforms/XFormsItextTranslations.d.ts +26 -0
- package/dist/xforms/XFormsXPathEvaluator.d.ts +18 -0
- package/package.json +76 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressionParser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EvaluationContext } from '../../context/EvaluationContext.ts';
|
|
2
|
+
import type { EvaluableArgument } from '../../evaluator/functions/FunctionImplementation.ts';
|
|
3
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
4
|
+
export declare const evaluateInt: (context: EvaluationContext, expression: EvaluableArgument) => number;
|
|
5
|
+
type MathAliasMethodName = 'abs' | 'acos' | 'asin' | 'atan' | 'ceil' | 'cos' | 'exp' | 'floor' | 'log' | 'log10' | 'round' | 'sin' | 'sqrt' | 'tan';
|
|
6
|
+
export declare const mathAlias: (method: MathAliasMethodName) => NumberFunction<number>;
|
|
7
|
+
type Math2AliasMethodName = 'atan2' | 'pow';
|
|
8
|
+
export declare const math2Alias: (method: Math2AliasMethodName) => NumberFunction<number>;
|
|
9
|
+
type MathNAliasMethodName = 'max' | 'min';
|
|
10
|
+
export declare const mathNAlias: (method: MathNAliasMethodName) => NumberFunction<number>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EvaluationContext } from '../../context/EvaluationContext.ts';
|
|
2
|
+
import type { EvaluableArgument } from '../../evaluator/functions/FunctionImplementation.ts';
|
|
3
|
+
export declare const toStrings: (context: EvaluationContext, expressions: readonly EvaluableArgument[]) => readonly string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BooleanFunction } from '../../evaluator/functions/BooleanFunction.ts';
|
|
2
|
+
declare const falseFn: BooleanFunction<number>;
|
|
3
|
+
export { falseFn as false };
|
|
4
|
+
declare const trueFn: BooleanFunction<number>;
|
|
5
|
+
export { trueFn as true };
|
|
6
|
+
export declare const boolean: BooleanFunction<number>;
|
|
7
|
+
export declare const lang: BooleanFunction<number>;
|
|
8
|
+
export declare const not: BooleanFunction<number>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeSetFunction } from '../../evaluator/functions/NodeSetFunction.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
import { StringFunction } from '../../evaluator/functions/StringFunction.ts';
|
|
4
|
+
export declare const count: NumberFunction<number>;
|
|
5
|
+
export declare const current: NodeSetFunction<number>;
|
|
6
|
+
export declare const id: NodeSetFunction<number>;
|
|
7
|
+
export declare const last: NumberFunction<number>;
|
|
8
|
+
export declare const localName: StringFunction<number>;
|
|
9
|
+
export declare const name: StringFunction<number>;
|
|
10
|
+
export declare const namespaceURI: StringFunction<number>;
|
|
11
|
+
export declare const position: NumberFunction<number>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FunctionAlias } from '../../evaluator/functions/FunctionAlias.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
export declare const ceiling: FunctionAlias<number>;
|
|
4
|
+
export declare const floor: NumberFunction<number>;
|
|
5
|
+
export declare const number: NumberFunction<number>;
|
|
6
|
+
export declare const round: NumberFunction<number>;
|
|
7
|
+
export declare const sum: NumberFunction<number>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BooleanFunction } from '../../evaluator/functions/BooleanFunction.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
import { StringFunction } from '../../evaluator/functions/StringFunction.ts';
|
|
4
|
+
export declare const concat: StringFunction<number>;
|
|
5
|
+
export declare const contains: BooleanFunction<number>;
|
|
6
|
+
export declare const normalizeSpace: StringFunction<number>;
|
|
7
|
+
export declare const startsWith: BooleanFunction<number>;
|
|
8
|
+
export declare const stringLength: NumberFunction<number>;
|
|
9
|
+
export declare const substringAfter: StringFunction<number>;
|
|
10
|
+
export declare const substringBefore: StringFunction<number>;
|
|
11
|
+
export declare const substring: StringFunction<number>;
|
|
12
|
+
export declare const string: StringFunction<number>;
|
|
13
|
+
export declare const translate: StringFunction<number>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BooleanFunction } from '../../evaluator/functions/BooleanFunction.ts';
|
|
2
|
+
import { FunctionImplementation } from '../../evaluator/functions/FunctionImplementation.ts';
|
|
3
|
+
export declare const booleanFromString: BooleanFunction<number>;
|
|
4
|
+
export declare const checklist: BooleanFunction<number>;
|
|
5
|
+
export declare const weightedChecklist: BooleanFunction<number>;
|
|
6
|
+
export declare const xfIf: FunctionImplementation<number>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionImplementation } from '../../evaluator/functions/FunctionImplementation.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
import { StringFunction } from '../../evaluator/functions/StringFunction.ts';
|
|
4
|
+
export declare const today: FunctionImplementation<number>;
|
|
5
|
+
export declare const xfNow: FunctionImplementation<number>;
|
|
6
|
+
export declare const formatDate: StringFunction<number>;
|
|
7
|
+
export declare const formatDateTime: StringFunction<number>;
|
|
8
|
+
export declare const date: FunctionImplementation<number>;
|
|
9
|
+
export declare const decimalDateTime: NumberFunction<number>;
|
|
10
|
+
export declare const decimalTime: NumberFunction<number>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NodeSetFunction } from '../../evaluator/functions/NodeSetFunction.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
import { StringFunction } from '../../evaluator/functions/StringFunction.ts';
|
|
4
|
+
export declare const countNonEmpty: NumberFunction<number>;
|
|
5
|
+
export declare const instance: NodeSetFunction<number>;
|
|
6
|
+
export declare const once: StringFunction<number>;
|
|
7
|
+
export declare const position: NumberFunction<number>;
|
|
8
|
+
export declare const randomize: NodeSetFunction<number>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FunctionImplementation } from '../../evaluator/functions/FunctionImplementation.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
export declare const abs: NumberFunction<number>;
|
|
4
|
+
export declare const acos: NumberFunction<number>;
|
|
5
|
+
export declare const asin: NumberFunction<number>;
|
|
6
|
+
export declare const atan: NumberFunction<number>;
|
|
7
|
+
export declare const atan2: NumberFunction<number>;
|
|
8
|
+
export declare const cos: NumberFunction<number>;
|
|
9
|
+
export declare const exp: NumberFunction<number>;
|
|
10
|
+
export declare const exp10: NumberFunction<number>;
|
|
11
|
+
export declare const int: NumberFunction<number>;
|
|
12
|
+
export declare const log: NumberFunction<number>;
|
|
13
|
+
export declare const log10: NumberFunction<number>;
|
|
14
|
+
export declare const max: NumberFunction<number>;
|
|
15
|
+
export declare const min: NumberFunction<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Overrides the standard XPath 1.0 (fn namespaced) `number` in an
|
|
18
|
+
* {@link XFormsXPathEvaluator}. This supports various date/datetime
|
|
19
|
+
* cases where values would otherwise be treated as string literals
|
|
20
|
+
* and fail to numerically compare as expected.
|
|
21
|
+
*/
|
|
22
|
+
export declare const number: FunctionImplementation<number>;
|
|
23
|
+
export declare const pi: NumberFunction<number>;
|
|
24
|
+
export declare const pow: NumberFunction<number>;
|
|
25
|
+
export declare const random: NumberFunction<number>;
|
|
26
|
+
export declare const round: NumberFunction<number>;
|
|
27
|
+
export declare const sin: NumberFunction<number>;
|
|
28
|
+
export declare const sqrt: NumberFunction<number>;
|
|
29
|
+
export declare const tan: NumberFunction<number>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BooleanFunction } from '../../evaluator/functions/BooleanFunction.ts';
|
|
2
|
+
import { NumberFunction } from '../../evaluator/functions/NumberFunction.ts';
|
|
3
|
+
import { StringFunction } from '../../evaluator/functions/StringFunction.ts';
|
|
4
|
+
export declare const countSelected: NumberFunction<number>;
|
|
5
|
+
export declare const selected: BooleanFunction<number>;
|
|
6
|
+
export declare const selectedAt: StringFunction<number>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BooleanFunction } from '../../evaluator/functions/BooleanFunction.ts';
|
|
2
|
+
import { StringFunction } from '../../evaluator/functions/StringFunction.ts';
|
|
3
|
+
export declare const coalesce: StringFunction<number>;
|
|
4
|
+
export declare const concat: StringFunction<number>;
|
|
5
|
+
export declare const digest: StringFunction<number>;
|
|
6
|
+
export declare const endsWith: BooleanFunction<number>;
|
|
7
|
+
export declare const join: StringFunction<number>;
|
|
8
|
+
export declare const regex: BooleanFunction<number>;
|
|
9
|
+
export declare const substr: StringFunction<number>;
|
|
10
|
+
export declare const uuid: StringFunction<number>;
|
package/dist/index.d.ts
ADDED