@getodk/xpath 0.2.0 → 0.3.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/WHAT/WHATNode.d.ts +30 -0
- package/dist/adapter/WHAT/kind.d.ts +11 -0
- package/dist/adapter/WHAT/names.d.ts +6 -0
- package/dist/adapter/WHAT/optimizations.d.ts +37 -0
- package/dist/adapter/WHAT/platform.d.ts +6 -0
- package/dist/adapter/WHAT/traversal.d.ts +14 -0
- package/dist/adapter/WHAT/values.d.ts +2 -0
- package/dist/adapter/WHAT/whatDOMAdapter.d.ts +5 -0
- package/dist/adapter/defaults.d.ts +26 -0
- package/dist/adapter/interface/XPathCustomUnwrappableNode.d.ts +55 -0
- package/dist/adapter/interface/XPathDOMAdapter.d.ts +16 -0
- package/dist/adapter/interface/XPathDOMOptimizableOperations.d.ts +13 -0
- package/dist/adapter/interface/XPathNameAdapter.d.ts +23 -0
- package/dist/adapter/interface/XPathNode.d.ts +164 -0
- package/dist/adapter/interface/XPathNodeKindAdapter.d.ts +15 -0
- package/dist/adapter/interface/XPathTraversalAdapter.d.ts +38 -0
- package/dist/adapter/interface/XPathValueAdapter.d.ts +9 -0
- package/dist/adapter/xpathDOMProvider.d.ts +80 -0
- package/dist/context/Context.d.ts +12 -10
- package/dist/context/EvaluationContext.d.ts +18 -29
- package/dist/error/IncompatibleRuntimeEnvironmentError.d.ts +2 -0
- package/dist/evaluations/BooleanEvaluation.d.ts +4 -4
- package/dist/evaluations/DateTimeLikeEvaluation.d.ts +4 -4
- package/dist/evaluations/Evaluation.d.ts +12 -12
- package/dist/evaluations/EvaluationType.d.ts +5 -3
- package/dist/evaluations/LocationPathEvaluation.d.ts +44 -68
- package/dist/evaluations/NodeEvaluation.d.ts +6 -6
- package/dist/evaluations/NumberEvaluation.d.ts +4 -4
- package/dist/evaluations/StringEvaluation.d.ts +4 -4
- package/dist/evaluations/ValueEvaluation.d.ts +11 -11
- package/dist/evaluator/DefaultEvaluator.d.ts +16 -0
- package/dist/evaluator/Evaluator.d.ts +32 -26
- package/dist/evaluator/NamespaceResolver.d.ts +16 -10
- package/dist/evaluator/expression/AbsoluteLocationPathExpressionEvaluator.d.ts +0 -1
- package/dist/evaluator/expression/BinaryExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/BooleanBinaryExpressionEvaluator.d.ts +5 -5
- package/dist/evaluator/expression/ExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/FilterPathExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/FunctionCallExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/LocationPathEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/LocationPathExpressionEvaluator.d.ts +3 -3
- package/dist/evaluator/expression/NumberExpressionEvaluator.d.ts +3 -3
- package/dist/evaluator/expression/NumberLiteralExpressionEvaluator.d.ts +0 -1
- package/dist/evaluator/expression/NumericBinaryExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/RelativeLocationPathExpressionEvaluator.d.ts +0 -1
- package/dist/evaluator/expression/StringExpressionEvaluator.d.ts +3 -3
- package/dist/evaluator/expression/StringLiteralExpressionEvaluator.d.ts +0 -1
- package/dist/evaluator/expression/UnaryExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/UnionExpressionEvaluator.d.ts +2 -2
- package/dist/evaluator/expression/factory.d.ts +0 -1
- package/dist/evaluator/functions/BooleanFunction.d.ts +2 -3
- package/dist/evaluator/functions/FunctionAlias.d.ts +2 -3
- package/dist/evaluator/functions/FunctionImplementation.d.ts +14 -14
- package/dist/evaluator/functions/FunctionLibrary.d.ts +6 -6
- package/dist/evaluator/functions/FunctionLibraryCollection.d.ts +3 -3
- package/dist/evaluator/functions/NodeSetFunction.d.ts +4 -4
- package/dist/evaluator/functions/NumberFunction.d.ts +2 -3
- package/dist/evaluator/functions/StringFunction.d.ts +2 -3
- package/dist/evaluator/functions/TypedFunctionImplementation.d.ts +5 -4
- package/dist/evaluator/result/BaseResult.d.ts +13 -9
- package/dist/evaluator/result/BooleanResult.d.ts +5 -6
- package/dist/evaluator/result/NodeSetResult.d.ts +28 -33
- package/dist/evaluator/result/NumberResult.d.ts +5 -6
- package/dist/evaluator/result/PrimitiveResult.d.ts +7 -8
- package/dist/evaluator/result/StringResult.d.ts +5 -6
- package/dist/evaluator/result/XPathEvaluationResult.d.ts +61 -0
- package/dist/evaluator/result/toXPathEvaluationResult.d.ts +5 -0
- package/dist/evaluator/step/Step.d.ts +1 -2
- package/dist/expressionParser-DpqfmhIO.js +3479 -0
- package/dist/expressionParser-DpqfmhIO.js.map +1 -0
- package/dist/expressionParser.d.ts +0 -1
- package/dist/expressionParser.js +1 -1
- package/dist/functions/_shared/number.d.ts +5 -5
- package/dist/functions/_shared/string.d.ts +2 -2
- package/dist/functions/enketo/index.d.ts +0 -1
- package/dist/functions/fn/boolean.d.ts +5 -6
- package/dist/functions/fn/index.d.ts +0 -1
- package/dist/functions/fn/node-set.d.ts +8 -9
- package/dist/functions/fn/number.d.ts +5 -6
- package/dist/functions/fn/string.d.ts +10 -11
- package/dist/functions/javarosa/index.d.ts +0 -1
- package/dist/functions/javarosa/string.d.ts +8 -2
- package/dist/functions/xforms/boolean.d.ts +4 -5
- package/dist/functions/xforms/datetime.d.ts +7 -8
- package/dist/functions/xforms/geo.d.ts +2 -3
- package/dist/functions/xforms/index.d.ts +0 -1
- package/dist/functions/xforms/node-set.d.ts +16 -7
- package/dist/functions/xforms/number.d.ts +21 -22
- package/dist/functions/xforms/select.d.ts +3 -4
- package/dist/functions/xforms/string.d.ts +8 -9
- package/dist/index.d.ts +44 -1
- package/dist/index.js +1575 -1151
- package/dist/index.js.map +1 -1
- package/dist/lib/datetime/coercion.d.ts +0 -1
- package/dist/lib/datetime/functions.d.ts +0 -1
- package/dist/static/grammar/ExpressionParser.d.ts +0 -1
- package/dist/static/grammar/SyntaxLanguage.d.ts +0 -1
- package/dist/static/grammar/SyntaxNode.d.ts +0 -1
- package/dist/static/grammar/SyntaxTree.d.ts +0 -1
- package/dist/static/grammar/TreeSitterXPathParser.d.ts +0 -1
- package/dist/static/grammar/type-names.d.ts +0 -1
- package/dist/xforms/XFormsElementRepresentation.d.ts +15 -0
- package/dist/xforms/XFormsItextTranslations.d.ts +75 -24
- package/dist/xforms/XFormsSecondaryInstances.d.ts +4 -0
- package/dist/xforms/XFormsXPathEvaluator.d.ts +35 -15
- package/package.json +14 -12
- package/dist/evaluator/result/ResultType.d.ts +0 -13
- package/dist/evaluator/result/index.d.ts +0 -8
- package/dist/expressionParser-BRkDdCO9.js +0 -2127
- package/dist/expressionParser-BRkDdCO9.js.map +0 -1
- package/dist/lib/dom/assertions.d.ts +0 -5
- package/dist/lib/dom/predicates.d.ts +0 -12
- package/dist/lib/dom/sort.d.ts +0 -1
- package/dist/lib/dom/traversal.d.ts +0 -22
- package/dist/lib/dom/types.d.ts +0 -21
- package/dist/lib/dom/xml.d.ts +0 -1
- package/dist/shared/constants.d.ts +0 -13
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/interface.d.ts +0 -33
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
-
|
|
3
2
|
export declare const tryParseDateString: (value: string) => Date | null;
|
|
4
3
|
export declare const dateTimeFromString: (timeZone: Temporal.TimeZone, value: string) => Temporal.ZonedDateTime | null;
|
|
5
4
|
export declare const dateTimeFromNumber: (timeZone: Temporal.TimeZone, milliseconds: number) => Temporal.ZonedDateTime | null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
-
|
|
3
2
|
export declare const currentLocalDateTimeString: (timeZone: Temporal.TimeZone) => string;
|
|
4
3
|
export declare const localDateTimeString: (dateTime: Temporal.ZonedDateTime) => string;
|
|
5
4
|
export declare const localDateTimeOrDateString: (dateTime: Temporal.ZonedDateTime) => string;
|
|
@@ -3,7 +3,6 @@ import { SyntaxLanguageTypeName, SyntaxLanguage as TreeSitterLanguage } from './
|
|
|
3
3
|
import { XPathNode } from './SyntaxNode.ts';
|
|
4
4
|
import { SyntaxTree as TreeSitterTree } from './SyntaxTree.ts';
|
|
5
5
|
import { TreeSitterXPathParser, WebAssemblyResourceSpecifiers } from './TreeSitterXPathParser.ts';
|
|
6
|
-
|
|
7
6
|
declare class SyntaxLanguage implements TreeSitterLanguage {
|
|
8
7
|
readonly types: readonly SyntaxLanguageTypeName[];
|
|
9
8
|
constructor(tsLanguage: TreeSitterLanguage);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AbbreviatedAbsoluteLocationPathType, AbbreviatedAxisTestType, AbbreviatedStepType, AbsoluteLocationPathType, AbsoluteRootLocationPathType, AdditionExprType, AndExprType, AnyBinaryExprType, AnySyntaxType, AnyUnaryExprType, ArgumentType, AxisNameType, AxisTestType, DivisionExprType, EqExprType, ExprType, FilterExprType, FilterPathExprType, FunctionCallType, FunctionNameType, GteExprType, GtExprType, LiteralType, LocalPartType, LteExprType, LtExprType, ModuloExprType, MultiplicationExprType, NeExprType, NodeTestType, NodeTypeTestType, NumberType, OrExprType, ParentType, PredicateType, PrefixedNameType, PrefixedWildcardNameTestType, PrefixType, ProcessingInstructionNameTestType, RelativeLocationPathType, RelativeStepSyntaxLiteral, SelfType, StepType, SubtractionExprType, UnionExprType, UnprefixedNameType, UnprefixedWildcardNameTestType, VariableReferenceType, XPathType } from './type-names.ts';
|
|
2
|
-
|
|
3
2
|
export interface SyntaxNode<Type extends AnySyntaxType, Children extends readonly UnknownSyntaxNode[], Text extends string = string> {
|
|
4
3
|
readonly type: Type;
|
|
5
4
|
readonly childCount: Children['length'];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
2
|
+
import { AdapterElement } from '../adapter/interface/XPathNodeKindAdapter.ts';
|
|
3
|
+
export declare const XFORMS_LOCAL_NAME: unique symbol;
|
|
4
|
+
export type XFORMS_LOCAL_NAME = typeof XFORMS_LOCAL_NAME;
|
|
5
|
+
export declare const XFORMS_KNOWN_ATTRIBUTE: unique symbol;
|
|
6
|
+
export type XFORMS_KNOWN_ATTRIBUTE = typeof XFORMS_KNOWN_ATTRIBUTE;
|
|
7
|
+
export type XFormsElementRepresentation<T extends XPathNode, LocalName extends string, KnownAttribute extends string = never> = AdapterElement<T> & {
|
|
8
|
+
readonly [XFORMS_LOCAL_NAME]: LocalName;
|
|
9
|
+
} & ([
|
|
10
|
+
KnownAttribute
|
|
11
|
+
] extends [string] ? {
|
|
12
|
+
readonly [XFORMS_KNOWN_ATTRIBUTE]: KnownAttribute;
|
|
13
|
+
} : {
|
|
14
|
+
readonly [XFORMS_KNOWN_ATTRIBUTE]?: string;
|
|
15
|
+
});
|
|
@@ -1,27 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { UpsertableWeakMap } from '../../../common/src/lib/collections/UpsertableWeakMap.ts';
|
|
2
|
+
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
3
|
+
import { XPathDOMProvider } from '../adapter/xpathDOMProvider.ts';
|
|
4
|
+
import { XFormsElementRepresentation } from './XFormsElementRepresentation.ts';
|
|
5
|
+
type XFormsItextTextID = string;
|
|
6
|
+
type XFormsItextTranslationTextElement<T extends XPathNode> = XFormsElementRepresentation<T, 'text'>;
|
|
7
|
+
export type XFormsItextTranslationElement<T extends XPathNode> = XFormsElementRepresentation<T, 'translation', 'lang'>;
|
|
8
|
+
type XFormsItextTextMap<T extends XPathNode> = ReadonlyMap<XFormsItextTextID, XFormsItextTranslationTextElement<T>>;
|
|
9
|
+
type XFormsItextTranslationsCache<T extends XPathNode> = UpsertableWeakMap<XFormsItextTranslationElement<T>, XFormsItextTextMap<T>>;
|
|
10
|
+
export type XFormsItextTranslationLanguage = string;
|
|
11
|
+
export type XFormsItextTranslationMap<T extends XPathNode> = ReadonlyMap<XFormsItextTranslationLanguage, XFormsItextTranslationElement<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Public interface to an {@link XFormsXPathEvaluator}'s ODK XForms
|
|
14
|
+
* {@link https://getodk.github.io/xforms-spec/#languages | active language state}.
|
|
15
|
+
*/
|
|
16
|
+
export interface XFormsItextTranslationsState {
|
|
17
|
+
getLanguages(): readonly XFormsItextTranslationLanguage[];
|
|
18
|
+
getActiveLanguage(): XFormsItextTranslationLanguage | null;
|
|
19
|
+
setActiveLanguage(language: XFormsItextTranslationLanguage | null): XFormsItextTranslationLanguage | null;
|
|
5
20
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @package
|
|
23
|
+
*
|
|
24
|
+
* This is an internal implementation/API providing support for {@link itext}.
|
|
25
|
+
*
|
|
26
|
+
* As specified by
|
|
27
|
+
* {@link https://getodk.github.io/xforms-spec/#fn:jr:itext | ODK XForms `jr:itext`},
|
|
28
|
+
* the function depends on implicit "active language" state. The corresponding
|
|
29
|
+
* {@link XFormsItextTranslationsState} **public interface** exposes access to get
|
|
30
|
+
* and set that state for `@getodk/xpath` consumers.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link XFormsItextTranslationsState} for the corresponding public interface.
|
|
33
|
+
*/
|
|
34
|
+
export declare class XFormsItextTranslations<T extends XPathNode> implements XFormsItextTranslationsState {
|
|
35
|
+
readonly domProvider: XPathDOMProvider<T>;
|
|
36
|
+
readonly translationElementMap: XFormsItextTranslationMap<T>;
|
|
37
|
+
protected readonly defaultLanguage: XFormsItextTranslationLanguage | null;
|
|
38
|
+
protected readonly languages: readonly XFormsItextTranslationLanguage[];
|
|
39
|
+
protected activeLanguage: XFormsItextTranslationLanguage | null;
|
|
40
|
+
readonly translationsCache: XFormsItextTranslationsCache<T>;
|
|
41
|
+
constructor(domProvider: XPathDOMProvider<T>, translationElementMap: XFormsItextTranslationMap<T>);
|
|
42
|
+
private getTranslationMetadata;
|
|
43
|
+
private getTranslationTextElement;
|
|
44
|
+
/**
|
|
45
|
+
* @package
|
|
46
|
+
*
|
|
47
|
+
* Here, "default" is meant as more precise language than "regular" as
|
|
48
|
+
* {@link https://getodk.github.io/xforms-spec/#languages | specified by ODK XForms}. In other words, this is equivalent to the following hypothetical XPath pseudo-code (whitespace added to improve structural clarity):
|
|
49
|
+
*
|
|
50
|
+
* ```xpath
|
|
51
|
+
* string(
|
|
52
|
+
* imaginary:itext-translation(
|
|
53
|
+
* xpath3-fn:environment-variable('activeLanguage')
|
|
54
|
+
* )
|
|
55
|
+
* /text[@id = $itextID]
|
|
56
|
+
* /value[not(@form)]
|
|
57
|
+
* )
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Or alternately:
|
|
61
|
+
*
|
|
62
|
+
* ```xpath
|
|
63
|
+
* string(
|
|
64
|
+
* imaginary:itext-root()
|
|
65
|
+
* /translation[@lang = xpath3-fn:environment-variable('activeLanguage')]
|
|
66
|
+
* /text[@id = $itextID]
|
|
67
|
+
* /value[not(@form)]
|
|
68
|
+
* )
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @todo The above really feels like it adds some helpful clarity to how `jr:itext()` is designed to work, and the kinds of structures, state and input involved. Since there's already some discomfort around that API as specified, it's worth considering
|
|
72
|
+
*/
|
|
73
|
+
getDefaultTranslationText(itextID: string): string;
|
|
74
|
+
getLanguages(): readonly XFormsItextTranslationLanguage[];
|
|
75
|
+
getActiveLanguage(): XFormsItextTranslationLanguage | null;
|
|
76
|
+
setActiveLanguage(language: XFormsItextTranslationLanguage | null): XFormsItextTranslationLanguage | null;
|
|
26
77
|
}
|
|
27
78
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
2
|
+
import { XFormsElementRepresentation } from './XFormsElementRepresentation.ts';
|
|
3
|
+
export type XFormsSecondaryInstanceElement<T extends XPathNode> = XFormsElementRepresentation<T, 'instance', 'id'>;
|
|
4
|
+
export type XFormsSecondaryInstanceMap<T extends XPathNode> = ReadonlyMap<string, XFormsSecondaryInstanceElement<T>>;
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
+
import { UnwrapAdapterNode } from '../adapter/interface/XPathCustomUnwrappableNode.ts';
|
|
2
|
+
import { XPathNode } from '../adapter/interface/XPathNode.ts';
|
|
3
|
+
import { AdapterParentNode } from '../adapter/interface/XPathNodeKindAdapter.ts';
|
|
4
|
+
import { EvaluationContext } from '../context/EvaluationContext.ts';
|
|
1
5
|
import { EvaluatorOptions, Evaluator } from '../evaluator/Evaluator.ts';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import { XFormsItextTranslationLanguage, XFormsItextTranslationMap, XFormsItextTranslationsState } from './XFormsItextTranslations.ts';
|
|
7
|
+
import { XFormsSecondaryInstanceElement, XFormsSecondaryInstanceMap } from './XFormsSecondaryInstances.ts';
|
|
8
|
+
/**
|
|
9
|
+
* @todo We accept an arbitrary parent node specifically for legacy WHATWG DOM
|
|
10
|
+
* integration, which we will no longer be using _except in test_. We should
|
|
11
|
+
* consider narrowing this type to {@link AdapterDocument} for any other usage.
|
|
12
|
+
*/
|
|
13
|
+
export type XFormsXPathRootNode<T extends XPathNode> = AdapterParentNode<T> | UnwrapAdapterNode<AdapterParentNode<T>>;
|
|
14
|
+
export interface XFormsXPathEvaluatorOptions<T extends XPathNode> extends EvaluatorOptions<T> {
|
|
15
|
+
readonly rootNode: XFormsXPathRootNode<T>;
|
|
16
|
+
readonly itextTranslationsByLanguage: XFormsItextTranslationMap<T>;
|
|
17
|
+
readonly secondaryInstancesById: XFormsSecondaryInstanceMap<T>;
|
|
7
18
|
}
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
export declare class XFormsXPathEvaluator<T extends XPathNode> extends Evaluator<T> implements XFormsItextTranslationsState {
|
|
20
|
+
static getSecondaryInstance<T extends XPathNode>(context: EvaluationContext<T>, id: string): XFormsSecondaryInstanceElement<T> | null;
|
|
21
|
+
static getDefaultTranslationText<T extends XPathNode>(context: EvaluationContext<T>, itextID: string): string;
|
|
22
|
+
readonly rootNode: AdapterParentNode<T>;
|
|
23
|
+
/**
|
|
24
|
+
* @package
|
|
25
|
+
* @see {@link InternalXFormsXPathEvaluator}
|
|
26
|
+
*/
|
|
27
|
+
protected readonly itextTranslations: XFormsItextTranslationsState;
|
|
28
|
+
/**
|
|
29
|
+
* @package
|
|
30
|
+
* @see {@link InternalXFormsXPathEvaluator}
|
|
31
|
+
*/
|
|
32
|
+
protected readonly secondaryInstancesById: XFormsSecondaryInstanceMap<T>;
|
|
33
|
+
constructor(options: XFormsXPathEvaluatorOptions<T>);
|
|
34
|
+
getLanguages(): readonly XFormsItextTranslationLanguage[];
|
|
35
|
+
getActiveLanguage(): XFormsItextTranslationLanguage | null;
|
|
36
|
+
setActiveLanguage(language: XFormsItextTranslationLanguage | null): XFormsItextTranslationLanguage | null;
|
|
37
|
+
getSecondaryInstance(id: string): XFormsSecondaryInstanceElement<T> | undefined;
|
|
10
38
|
}
|
|
11
|
-
export declare class XFormsXPathEvaluator extends Evaluator {
|
|
12
|
-
readonly rootNode: AnyParentNode;
|
|
13
|
-
readonly rootNodeDocument: XMLDocument;
|
|
14
|
-
readonly modelElement: ModelElement | null;
|
|
15
|
-
readonly translations: XFormsItextTranslations;
|
|
16
|
-
constructor(options: XFormsXPathEvaluatorOptions);
|
|
17
|
-
}
|
|
18
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getodk/xpath",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "XPath implementation for ODK Web Forms",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"README.md"
|
|
32
32
|
],
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": "^18.20.4 || ^20.
|
|
34
|
+
"node": "^18.20.4 || ^20.17.0 || ^22.9.0",
|
|
35
35
|
"yarn": "1.22.22"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
@@ -49,27 +49,29 @@
|
|
|
49
49
|
"test-watch:chromium": "BROWSER_NAME=chromium vitest",
|
|
50
50
|
"test-watch:firefox": "BROWSER_NAME=firefox vitest",
|
|
51
51
|
"test-watch:webkit": "BROWSER_NAME=webkit vitest",
|
|
52
|
-
"test:types": "
|
|
52
|
+
"test:types": "npm-run-all -nl test:types:*",
|
|
53
|
+
"test:types:main": "tsc --project ./tsconfig.json --emitDeclarationOnly false --noEmit",
|
|
54
|
+
"test:types:test": "tsc --project ./test/tsconfig.json --emitDeclarationOnly false --noEmit"
|
|
53
55
|
},
|
|
54
56
|
"dependencies": {
|
|
57
|
+
"@getodk/common": "0.5.0",
|
|
55
58
|
"@js-temporal/polyfill": "^0.4.4",
|
|
56
|
-
"@getodk/common": "0.3.0",
|
|
57
59
|
"crypto-js": "^4.2.0",
|
|
58
60
|
"itertools-ts": "^1.27.1"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "^7.
|
|
63
|
+
"@babel/core": "^7.25.2",
|
|
62
64
|
"@getodk/tree-sitter-xpath": "0.1.2",
|
|
63
|
-
"@playwright/test": "^1.
|
|
65
|
+
"@playwright/test": "^1.47.2",
|
|
64
66
|
"@types/crypto-js": "^4.2.2",
|
|
65
|
-
"@vitest/browser": "^2.
|
|
67
|
+
"@vitest/browser": "^2.1.1",
|
|
66
68
|
"babel-plugin-transform-jsbi-to-bigint": "^1.4.0",
|
|
67
|
-
"jsdom": "^
|
|
68
|
-
"vite": "^5.
|
|
69
|
+
"jsdom": "^25.0.1",
|
|
70
|
+
"vite": "^5.4.8",
|
|
69
71
|
"vite-plugin-babel": "^1.2.0",
|
|
70
|
-
"vite-plugin-dts": "^
|
|
72
|
+
"vite-plugin-dts": "^4.2.2",
|
|
71
73
|
"vite-plugin-no-bundle": "^4.0.0",
|
|
72
|
-
"vitest": "^2.
|
|
73
|
-
"web-tree-sitter": "0.
|
|
74
|
+
"vitest": "^2.1.1",
|
|
75
|
+
"web-tree-sitter": "0.23.0"
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const ResultTypes: {
|
|
2
|
-
readonly BOOLEAN_TYPE: 3;
|
|
3
|
-
readonly NUMBER_TYPE: 1;
|
|
4
|
-
readonly STRING_TYPE: 2;
|
|
5
|
-
readonly UNORDERED_NODE_ITERATOR_TYPE: 4;
|
|
6
|
-
readonly ORDERED_NODE_ITERATOR_TYPE: 5;
|
|
7
|
-
readonly UNORDERED_NODE_SNAPSHOT_TYPE: 6;
|
|
8
|
-
readonly ORDERED_NODE_SNAPSHOT_TYPE: 7;
|
|
9
|
-
readonly ANY_UNORDERED_NODE_TYPE: 8;
|
|
10
|
-
readonly FIRST_ORDERED_NODE_TYPE: 9;
|
|
11
|
-
};
|
|
12
|
-
export type ResultTypes = typeof ResultTypes;
|
|
13
|
-
export type ResultType = ResultTypes[keyof ResultTypes];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Evaluation } from '../../evaluations/Evaluation.ts';
|
|
2
|
-
import { XPathResultType } from '../../shared/index.ts';
|
|
3
|
-
import { BooleanResult } from './BooleanResult';
|
|
4
|
-
import { NodeSetIteratorResult, NodeSetSnapshotResult } from './NodeSetResult';
|
|
5
|
-
import { NumberResult } from './NumberResult';
|
|
6
|
-
import { StringResult } from './StringResult';
|
|
7
|
-
|
|
8
|
-
export declare const toXPathResult: (resultType: XPathResultType, evaluation: Evaluation) => BooleanResult | NodeSetSnapshotResult | NodeSetIteratorResult | NumberResult | StringResult;
|