@getodk/xpath 0.1.0 → 0.1.2

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 (87) hide show
  1. package/dist/.vite/manifest.json +7 -4
  2. package/dist/context/Context.d.ts +6 -5
  3. package/dist/context/EvaluationContext.d.ts +7 -6
  4. package/dist/evaluations/BooleanEvaluation.d.ts +2 -1
  5. package/dist/evaluations/DateTimeLikeEvaluation.d.ts +2 -1
  6. package/dist/evaluations/Evaluation.d.ts +3 -2
  7. package/dist/evaluations/LocationPathEvaluation.d.ts +14 -13
  8. package/dist/evaluations/NodeEvaluation.d.ts +2 -1
  9. package/dist/evaluations/NumberEvaluation.d.ts +2 -1
  10. package/dist/evaluations/StringEvaluation.d.ts +2 -1
  11. package/dist/evaluations/ValueEvaluation.d.ts +3 -2
  12. package/dist/evaluator/Evaluator.d.ts +6 -5
  13. package/dist/evaluator/NamespaceResolver.d.ts +3 -2
  14. package/dist/evaluator/expression/AbsoluteLocationPathExpressionEvaluator.d.ts +3 -2
  15. package/dist/evaluator/expression/BinaryExpressionEvaluator.d.ts +5 -4
  16. package/dist/evaluator/expression/BooleanBinaryExpressionEvaluator.d.ts +4 -3
  17. package/dist/evaluator/expression/ExpressionEvaluator.d.ts +4 -3
  18. package/dist/evaluator/expression/FilterPathExpressionEvaluator.d.ts +5 -4
  19. package/dist/evaluator/expression/FunctionCallExpressionEvaluator.d.ts +5 -4
  20. package/dist/evaluator/expression/LocationPathEvaluator.d.ts +5 -4
  21. package/dist/evaluator/expression/LocationPathExpressionEvaluator.d.ts +4 -3
  22. package/dist/evaluator/expression/NumberExpressionEvaluator.d.ts +3 -2
  23. package/dist/evaluator/expression/NumberLiteralExpressionEvaluator.d.ts +3 -2
  24. package/dist/evaluator/expression/NumericBinaryExpressionEvaluator.d.ts +3 -2
  25. package/dist/evaluator/expression/RelativeLocationPathExpressionEvaluator.d.ts +3 -2
  26. package/dist/evaluator/expression/StringExpressionEvaluator.d.ts +3 -2
  27. package/dist/evaluator/expression/StringLiteralExpressionEvaluator.d.ts +3 -2
  28. package/dist/evaluator/expression/UnaryExpressionEvaluator.d.ts +4 -3
  29. package/dist/evaluator/expression/UnionExpressionEvaluator.d.ts +4 -3
  30. package/dist/evaluator/expression/factory.d.ts +3 -2
  31. package/dist/evaluator/functions/BooleanFunction.d.ts +3 -3
  32. package/dist/evaluator/functions/FunctionAlias.d.ts +1 -0
  33. package/dist/evaluator/functions/FunctionImplementation.d.ts +5 -4
  34. package/dist/evaluator/functions/FunctionLibrary.d.ts +3 -2
  35. package/dist/evaluator/functions/FunctionLibraryCollection.d.ts +4 -3
  36. package/dist/evaluator/functions/NodeSetFunction.d.ts +2 -2
  37. package/dist/evaluator/functions/NumberFunction.d.ts +3 -3
  38. package/dist/evaluator/functions/StringFunction.d.ts +3 -3
  39. package/dist/evaluator/functions/TypedFunctionImplementation.d.ts +3 -3
  40. package/dist/evaluator/result/BooleanResult.d.ts +3 -2
  41. package/dist/evaluator/result/NodeSetResult.d.ts +3 -3
  42. package/dist/evaluator/result/NumberResult.d.ts +3 -2
  43. package/dist/evaluator/result/PrimitiveResult.d.ts +3 -3
  44. package/dist/evaluator/result/StringResult.d.ts +3 -2
  45. package/dist/evaluator/result/index.d.ts +3 -2
  46. package/dist/evaluator/step/Step.d.ts +2 -1
  47. package/dist/expressionParser-BbqMYp75.js +2116 -0
  48. package/dist/expressionParser-BbqMYp75.js.map +1 -0
  49. package/dist/expressionParser.d.ts +1 -0
  50. package/dist/expressionParser.js +1 -1
  51. package/dist/functions/_shared/number.d.ts +3 -2
  52. package/dist/functions/_shared/string.d.ts +3 -2
  53. package/dist/functions/enketo/index.d.ts +1 -0
  54. package/dist/functions/fn/boolean.d.ts +1 -0
  55. package/dist/functions/fn/index.d.ts +1 -0
  56. package/dist/functions/fn/node-set.d.ts +1 -0
  57. package/dist/functions/fn/number.d.ts +1 -0
  58. package/dist/functions/fn/string.d.ts +1 -0
  59. package/dist/functions/javarosa/index.d.ts +1 -0
  60. package/dist/functions/javarosa/string.d.ts +1 -0
  61. package/dist/functions/xforms/boolean.d.ts +1 -0
  62. package/dist/functions/xforms/datetime.d.ts +1 -0
  63. package/dist/functions/xforms/geo.d.ts +1 -0
  64. package/dist/functions/xforms/index.d.ts +1 -0
  65. package/dist/functions/xforms/node-set.d.ts +1 -0
  66. package/dist/functions/xforms/number.d.ts +1 -0
  67. package/dist/functions/xforms/select.d.ts +1 -0
  68. package/dist/functions/xforms/string.d.ts +1 -0
  69. package/dist/index.js +213 -105
  70. package/dist/index.js.map +1 -1
  71. package/dist/lib/datetime/coercion.d.ts +1 -0
  72. package/dist/lib/datetime/functions.d.ts +1 -0
  73. package/dist/lib/dom/assertions.d.ts +2 -1
  74. package/dist/lib/dom/predicates.d.ts +2 -1
  75. package/dist/lib/dom/traversal.d.ts +2 -1
  76. package/dist/lib/iterators/common.d.ts +1 -1
  77. package/dist/static/grammar/ExpressionParser.d.ts +5 -4
  78. package/dist/static/grammar/SyntaxLanguage.d.ts +2 -1
  79. package/dist/static/grammar/SyntaxNode.d.ts +2 -1
  80. package/dist/static/grammar/SyntaxTree.d.ts +3 -2
  81. package/dist/static/grammar/TreeSitterXPathParser.d.ts +2 -1
  82. package/dist/static/grammar/type-names.d.ts +2 -1
  83. package/dist/xforms/XFormsItextTranslations.d.ts +3 -2
  84. package/dist/xforms/XFormsXPathEvaluator.d.ts +3 -3
  85. package/package.json +14 -15
  86. package/dist/expressionParser-1Kzq3bIy.js +0 -2356
  87. package/dist/expressionParser-1Kzq3bIy.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
+
2
3
  export declare const tryParseDateString: (value: string) => Date | null;
3
4
  export declare const dateTimeFromString: (timeZone: Temporal.TimeZone, value: string) => Temporal.ZonedDateTime | null;
4
5
  export declare const dateTimeFromNumber: (timeZone: Temporal.TimeZone, milliseconds: number) => Temporal.ZonedDateTime | null;
@@ -1,4 +1,5 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
+
2
3
  export declare const currentLocalDateTimeString: (timeZone: Temporal.TimeZone) => string;
3
4
  export declare const localDateTimeString: (dateTime: Temporal.ZonedDateTime) => string;
4
5
  export declare const localDateTimeOrDateString: (dateTime: Temporal.ZonedDateTime) => string;
@@ -1,4 +1,5 @@
1
- import type { ContextParentNode } from './types.ts';
1
+ import { ContextParentNode } from './types.ts';
2
+
2
3
  type AssertParentNode = (node: Node) => asserts node is ContextParentNode;
3
4
  export declare const assertParentNode: AssertParentNode;
4
5
  export {};
@@ -1,4 +1,5 @@
1
- import type { NamespaceAttribute } from './types';
1
+ import { NamespaceAttribute } from './types';
2
+
2
3
  export declare const isAttributeNode: (node: Node) => node is Attr;
3
4
  export declare const isNamespaceAttribute: (attr: Attr) => attr is NamespaceAttribute;
4
5
  export declare const isNamespaceNode: (node: Node) => node is NamespaceAttribute;
@@ -1,4 +1,5 @@
1
- import type { ContextDocument, ContextNode, ContextParentNode } from './types.ts';
1
+ import { ContextDocument, ContextNode, ContextParentNode } from './types.ts';
2
+
2
3
  export declare const getDocument: (node: Node) => Document;
3
4
  export declare const getRootNode: (node: ContextNode) => ContextParentNode;
4
5
  export declare const TreeWalkerFilter: {
@@ -13,5 +13,5 @@ type FilterIterable<Guard extends GuardIterated<any, any>> = MapIterable<Unguard
13
13
  export declare const filter: <Guard extends GuardIterated<any, any>>(guard: Guard) => FilterIterable<Guard>;
14
14
  export declare const distinct: <T>(iterable: Iterable<T>) => Generator<T, void, unknown>;
15
15
  type TeeResult<T> = [IterableIterator<T>, IterableIterator<T>];
16
- export declare const tee: <T>(input: Iterable<T> | Iterator<T, any, undefined>) => TeeResult<T>;
16
+ export declare const tee: <T>(input: Iterable<T> | Iterator<T>) => TeeResult<T>;
17
17
  export {};
@@ -1,8 +1,9 @@
1
1
  import { UpsertableMap } from '../../../../common/src/lib/collections/UpsertableMap.ts';
2
- import type { SyntaxLanguageTypeName, SyntaxLanguage as TreeSitterLanguage } from './SyntaxLanguage.ts';
3
- import type { XPathNode } from './SyntaxNode.ts';
4
- import { type SyntaxTree as TreeSitterTree } from './SyntaxTree.ts';
5
- import { TreeSitterXPathParser, type WebAssemblyResourceSpecifiers } from './TreeSitterXPathParser.ts';
2
+ import { SyntaxLanguageTypeName, SyntaxLanguage as TreeSitterLanguage } from './SyntaxLanguage.ts';
3
+ import { XPathNode } from './SyntaxNode.ts';
4
+ import { SyntaxTree as TreeSitterTree } from './SyntaxTree.ts';
5
+ import { TreeSitterXPathParser, WebAssemblyResourceSpecifiers } from './TreeSitterXPathParser.ts';
6
+
6
7
  declare class SyntaxLanguage implements TreeSitterLanguage {
7
8
  readonly types: readonly SyntaxLanguageTypeName[];
8
9
  constructor(tsLanguage: TreeSitterLanguage);
@@ -1,4 +1,5 @@
1
- import type { AnySyntaxType } from './type-names.ts';
1
+ import { AnySyntaxType } from './type-names.ts';
2
+
2
3
  export type SyntaxLanguageTypeName = AnySyntaxType | undefined;
3
4
  export interface SyntaxLanguage {
4
5
  readonly types: readonly SyntaxLanguageTypeName[];
@@ -1,4 +1,5 @@
1
- import type { 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';
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
+
2
3
  export interface SyntaxNode<Type extends AnySyntaxType, Children extends readonly UnknownSyntaxNode[], Text extends string = string> {
3
4
  readonly type: Type;
4
5
  readonly childCount: Children['length'];
@@ -1,5 +1,6 @@
1
- import type { SyntaxLanguage } from './SyntaxLanguage.ts';
2
- import type { XPathNode } from './SyntaxNode.ts';
1
+ import { SyntaxLanguage } from './SyntaxLanguage.ts';
2
+ import { XPathNode } from './SyntaxNode.ts';
3
+
3
4
  export interface SyntaxTree {
4
5
  readonly language: SyntaxLanguage;
5
6
  readonly rootNode: XPathNode;
@@ -1,4 +1,5 @@
1
- import WebTreeSitter from 'web-tree-sitter';
1
+ import { default as WebTreeSitter } from 'web-tree-sitter';
2
+
2
3
  type ParserConstructor = typeof WebTreeSitter;
3
4
  type Parser = InstanceType<ParserConstructor>;
4
5
  declare let Parser: ParserConstructor;
@@ -1,4 +1,5 @@
1
- import type { SyntaxType, UnnamedType } from '@getodk/tree-sitter-xpath';
1
+ import { SyntaxType, UnnamedType } from '@getodk/tree-sitter-xpath';
2
+
2
3
  /**
3
4
  * The root node of any parsed XPath expression's syntax tree.
4
5
  *
@@ -1,5 +1,6 @@
1
- import type { KnownAttributeLocalNamedElement, LocalNamedElement } from '../../../common/types/dom.ts';
2
- import type { ModelElement, XFormsXPathEvaluator } from './XFormsXPathEvaluator.ts';
1
+ import { KnownAttributeLocalNamedElement, LocalNamedElement } from '../../../common/types/dom.ts';
2
+ import { ModelElement, XFormsXPathEvaluator } from './XFormsXPathEvaluator.ts';
3
+
3
4
  export interface ItextRootElement extends LocalNamedElement<'itext'> {
4
5
  }
5
6
  export declare const getItextRoot: (modelElement: ModelElement) => ItextRootElement | null;
@@ -1,7 +1,7 @@
1
- import type { EvaluatorOptions } from '../evaluator/Evaluator.ts';
2
- import { Evaluator } from '../evaluator/Evaluator.ts';
3
- import type { AnyParentNode } from '../lib/dom/types.ts';
1
+ import { EvaluatorOptions, Evaluator } from '../evaluator/Evaluator.ts';
2
+ import { AnyParentNode } from '../lib/dom/types.ts';
4
3
  import { XFormsItextTranslations } from './XFormsItextTranslations.ts';
4
+
5
5
  export interface ModelElement extends Element {
6
6
  readonly localName: 'model';
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getodk/xpath",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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.19.1 || ^20.11.1",
34
+ "node": "^18.20.3 || ^20.13.1 || ^22.2.0",
35
35
  "yarn": "1.22.19"
36
36
  },
37
37
  "scripts": {
@@ -53,24 +53,23 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@js-temporal/polyfill": "^0.4.4",
56
- "@getodk/common": "0.1.0",
57
- "crypto-js": "^4.1.1",
56
+ "@getodk/common": "0.2.0",
57
+ "crypto-js": "^4.2.0",
58
58
  "itertools-ts": "^1.23.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/core": "^7.24.0",
62
- "@getodk/tree-sitter-xpath": "0.1.0",
63
- "@playwright/test": "^1.42.1",
64
- "@types/crypto-js": "^4.1.2",
65
- "@vitest/browser": "^1.3.1",
61
+ "@babel/core": "^7.24.6",
62
+ "@getodk/tree-sitter-xpath": "0.1.1",
63
+ "@playwright/test": "^1.44.1",
64
+ "@types/crypto-js": "^4.2.2",
65
+ "@vitest/browser": "^1.6.0",
66
66
  "babel-plugin-transform-jsbi-to-bigint": "^1.4.0",
67
67
  "jsdom": "^24.0.0",
68
- "vite": "^5.1.5",
68
+ "vite": "^5.2.11",
69
69
  "vite-plugin-babel": "^1.2.0",
70
- "vite-plugin-dts": "^3.7.3",
71
- "vite-plugin-no-bundle": "^3.0.0",
72
- "vitest": "^1.3.1",
73
- "vitest-github-actions-reporter": "^0.11.1",
74
- "web-tree-sitter": "0.21.0"
70
+ "vite-plugin-dts": "^3.9.1",
71
+ "vite-plugin-no-bundle": "^4.0.0",
72
+ "vitest": "^1.6.0",
73
+ "web-tree-sitter": "0.22.6"
75
74
  }
76
75
  }