Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XPath support for external secondary instances #245

Merged
merged 95 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
9dc3233
xpath: eliminate redundant test entrypoint module
eyelidlessness Jul 27, 2024
280a204
Make mutability of LocationPathEvaluation nodes iterator private
eyelidlessness Jul 26, 2024
13f2dbe
Refactor: break axis node evaluation out from LocationPathEvaluation
eyelidlessness Jul 27, 2024
e0ae8c9
Refactor: iteration of context nodes outside axis evaluation
eyelidlessness Jul 27, 2024
dc9d775
Refactor: eliminate reliance on TreeWalker for node type filtering
eyelidlessness Jul 27, 2024
5b17246
Eliminate TreeWalker usage for child step
eyelidlessness Jul 27, 2024
9fc6331
Eliminate TreeWalker usage for descendant step
eyelidlessness Jul 27, 2024
6c0687e
Eliminate TreeWalker usage for following step
eyelidlessness Jul 27, 2024
806dbda
Eliminate TreeWalker usage for following-sibling step
eyelidlessness Jul 27, 2024
c46df6a
Eliminate TreeWalker usage for parent step
eyelidlessness Jul 27, 2024
5db8fc7
Eliminate TreeWalker usage for preceding step
eyelidlessness Jul 27, 2024
961fba2
Eliminate TreeWalker usage for preceding-sibling step
eyelidlessness Jul 27, 2024
25966b0
Eliminate remaining call to TreeWalker API
eyelidlessness Jul 27, 2024
bae6e31
Simplify XPath FunctionImplementation and related types
eyelidlessness Aug 3, 2024
ffe1b34
common: more consistent structure/type definitions of XML namespace c…
eyelidlessness Oct 21, 2024
91a2da6
scenario: TEMPORARILY relax error production checks in nuissance fail…
eyelidlessness Oct 21, 2024
46ad7f0
xpath: remove unused XML parsing lib module
eyelidlessness Oct 21, 2024
d662d6d
xpath: remove unused/unsupported dispose resource management protocol…
eyelidlessness Oct 21, 2024
59b22ca
xpath: consolidate and isolate most WHATWG DOM types and access
eyelidlessness Oct 23, 2024
42f08d2
xpath WHATWG DOM consolidation/isolation: NamespaceResolver & context…
eyelidlessness Oct 22, 2024
f7b96bd
xpath: internal, temporary dom abstraction placeholder module
eyelidlessness Oct 26, 2024
b16952f
BREAKING CHANGE: XFormsXPathEvaluator requires itext/secondary instan…
eyelidlessness Oct 26, 2024
ebde4e7
xpath: Introduce (temporary) DefaultXFormsXPathEvaluator, related…
eyelidlessness Oct 26, 2024
e67bdd3
Introduce XPathNode, XPathDOMAdapter (initial bare interface)
eyelidlessness Oct 24, 2024
2149402
XPathNode: introduce special `UnspecifiedNonXPathNodeKind` extension …
eyelidlessness Oct 24, 2024
86558b9
XPathDOMAdapter (module): export XPathNode types, XPathNodeKindKey value
eyelidlessness Oct 24, 2024
23067c0
Introduce XPathCustomUnwrappableNode for platform-/third-party adapte…
eyelidlessness Oct 24, 2024
443b00e
Introduce XPathDOMProvider, to derive _internal_ DOM operations from …
eyelidlessness Oct 24, 2024
96a117b
Introduce WHATNode: type representations of WHAT Working Group DOM ad…
eyelidlessness Oct 24, 2024
ec7cce1
Introduce whatDOMAdapter
eyelidlessness Oct 24, 2024
d0f367f
Define whatDOMAdapter, derived DOM provider, as defaults
eyelidlessness Oct 24, 2024
8f71eb4
TEMPORARY: `XPath*` node interfaces extend their `WHAT*` counterparts
eyelidlessness Oct 27, 2024
bc7c35e
!!!KEY CONCEPT!!! xpath DOM adapter/provider: node kind guards
eyelidlessness Oct 28, 2024
0548803
BREAKING CHANGE: required Evaluator `domAdapter` option + DefaultEval…
eyelidlessness Oct 28, 2024
2c5fc44
Most remaining XPathDOMAdapter sub-interfaces: names, traversal, values
eyelidlessness Oct 28, 2024
4b9561b
Migrate remaining temp DOM abstractions to XPathDOMAdapter/XPathDOMPr…
eyelidlessness Oct 28, 2024
15099a8
Remove temporary DOM abstraction module
eyelidlessness Oct 28, 2024
3ae4b48
Reintroduce WHAT implementations of optimizable operations …
eyelidlessness Oct 28, 2024
a4e80d3
xpath DOM adapter API: internal DOM provider access, generic all the …
eyelidlessness Oct 29, 2024
bb07f54
Migrate outstanding logic equivalent to `getContainingDocument`
eyelidlessness Oct 29, 2024
d5306dd
Migrate outstanding logic equivalent to `getNodeValue`
eyelidlessness Oct 29, 2024
b2c1ef8
Migrate outstanding logic equivalent to `getAttributes`
eyelidlessness Oct 30, 2024
8b83a24
XPathTraversalAdapter: add getNamespaceDeclarations, migrate usage
eyelidlessness Oct 30, 2024
6d2bb47
XPathNameAdapter: add resolveNamespaceURI, migrate usage
eyelidlessness Oct 30, 2024
d8f270a
XPathDOMProvider: derive predicates for XPath semantic node kinds, co…
eyelidlessness Oct 30, 2024
073f894
Migrate 1:1 usage of XPath semantic node kind predicates…
eyelidlessness Oct 30, 2024
510762b
XPathNameAdapter: getQualifiedName, getProcessingInstructionName APIs…
eyelidlessness Oct 30, 2024
1dfcd13
Fix edge case identified in previous commit…
eyelidlessness Oct 30, 2024
1f89d59
XPathTraversalAdapter: remaining sub-API expansion
eyelidlessness Oct 30, 2024
93e0ff0
Migrate 1:1 usage of `getChildNodes`…
eyelidlessness Oct 30, 2024
0cae3b9
Migrate 1:1 usage of sibling traversal methods
eyelidlessness Oct 30, 2024
d7f25cb
Migrate roughly equivalent use of getParentNode
eyelidlessness Oct 30, 2024
09a5f79
Remaining expansion of optimizable operations APIs, default implement…
eyelidlessness Oct 30, 2024
7c64617
Migrate 1:1 usage of reamining optimizable operations (1): getElement…
eyelidlessness Oct 30, 2024
8385e96
Migrate use of getQualifiedNamedAttributeValue, related use of getPar…
eyelidlessness Oct 30, 2024
cf85147
Migrate following/preceding Axes, usage of several traversal/optimiza…
eyelidlessness Oct 30, 2024
c95651d
Migrate remainder of WHAT DOM access in `position` implementation
eyelidlessness Oct 30, 2024
792a912
Migrate remainder of WHAT DOM usage by `indexed-repeat` to `isDescend…
eyelidlessness Oct 30, 2024
7023093
WHAT (default) adapter implementations of remaining optimizable opera…
eyelidlessness Oct 30, 2024
8463048
XPathDOMProvider: derived iterable operation methods
eyelidlessness Oct 30, 2024
31da868
Migrate all WHAT DOM document-order sorting logic to DOM provider imp…
eyelidlessness Oct 30, 2024
b330b0b
Migrate remainder of WHAT DOM access in LocationPathEvaluation
eyelidlessness Oct 30, 2024
e0020b8
Remove all remaining WHAT DOM access which isn’t encapsulated by what…
eyelidlessness Oct 30, 2024
93958e8
XPathDOMAdapter &co refactor: prologue
eyelidlessness Oct 30, 2024
1dfdf31
BEGIN BROKEN PROJECT STATE! Eliminate temporary `DefaultXFormsXPathEv…
eyelidlessness Oct 31, 2024
ff9c024
Use DefaultEvaluator in dependency analysis test
eyelidlessness Oct 31, 2024
00c3faf
engine: XFormDOM uses/encapsulates use of DefaultEvaluator
eyelidlessness Oct 31, 2024
2cfdb39
First step to integrating breaking changes in XFormsXPathEvaluator
eyelidlessness Oct 31, 2024
139777e
END BROKEN PROJECT STATE! Minimal integration of breaking XFormXPathE…
eyelidlessness Oct 31, 2024
e83bd1b
Prepare for minor engine/client API rev: RootNode.parent will be non-…
eyelidlessness Nov 1, 2024
d9f3f20
Minor engine internal refactor: formalize and encapsulate language st…
eyelidlessness Nov 2, 2024
02f8601
Minor engine internal refactor: every EvaluationContext is a Translat…
eyelidlessness Nov 2, 2024
e795a43
Tie up engine loose end: create initial reactive scope synchronously
eyelidlessness Nov 2, 2024
7a9001b
PrimaryInstance initializes translation state, implements EvaluationC…
eyelidlessness Nov 2, 2024
430c9dd
Move prepareSubmission up to PrimaryInstance
eyelidlessness Nov 2, 2024
2a44cd1
InstanceNode & DescendantNode are explicitly generic over `Parent`
eyelidlessness Nov 3, 2024
7baceed
PrimaryInstance extends InstanceNode, implements new PrimaryInstanceD…
eyelidlessness Nov 2, 2024
2172a1d
Root inherits DescendantNode
eyelidlessness Nov 3, 2024
0b67357
Engine XPath DOM adapter: Introduce XFormsXPathNode interfaces
eyelidlessness Nov 3, 2024
d44dfbd
Engine XPath DOM adapter: InstanceNodes implement XFormsXPathNode
eyelidlessness Nov 3, 2024
cc9ef51
Engine adapter (prerequisite): InstanceNode attached state, default e…
eyelidlessness Nov 4, 2024
63b8eef
Engine XPath DOM adapter: introduce StaticNode & concrete subclasses
eyelidlessness Nov 3, 2024
91c549b
Engine adapter: implement parsing WHAT WG DOM to StaticNode DOM repre…
eyelidlessness Nov 4, 2024
26161de
BEGIN BROKEN STATE! Parse StaticNode DOM itext translations, secondar…
eyelidlessness Nov 4, 2024
322c147
Engine adapter: implement XPathNodeKindAdapter sub-interface
eyelidlessness Nov 4, 2024
6d444db
Engine adapter: implement XPathValueAdapter sub-interface
eyelidlessness Nov 4, 2024
20a795d
Engine adapter: implement XPathTraversalAdapter sub-interface
eyelidlessness Nov 4, 2024
e56d8e3
Engine adapter (final for now): implement XPathNameAdapter sub-interface
eyelidlessness Nov 4, 2024
5a9b08e
END BROKEN PROJECT STATE! Integrate engineDOMAdapter
eyelidlessness Nov 4, 2024
23f84f3
SelectField: selected values are **filtered** from value state on ite…
eyelidlessness Nov 4, 2024
e6273b0
BaseRepeatRange, RepeatRangeControlled always use self as evaluation …
eyelidlessness Nov 4, 2024
afceea8
Eliminate SubscribableDependency engine-internal interface, implement…
eyelidlessness Nov 4, 2024
427318b
Remove most current parse-stage dependency analysis
eyelidlessness Nov 4, 2024
bb821f3
Update child-vaccination smoke test
eyelidlessness Nov 4, 2024
e636a9c
changeset
eyelidlessness Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/two-actors-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@getodk/xforms-engine': minor
'@getodk/xpath': minor
'@getodk/scenario': patch
'@getodk/common': patch
---

XPath support for evaluation of arbitrary DOM implementations (XPathDOMAdapter)
35 changes: 32 additions & 3 deletions packages/common/src/constants/xmlns.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,60 @@
// Native/common standards
export const XHTML_NAMESPACE_URI = 'http://www.w3.org/1999/xhtml';
export type XHTML_NAMESPACE_URI = typeof XHTML_NAMESPACE_URI;

export const HTML_NAMESPACE_URI = XHTML_NAMESPACE_URI;
export type HTML_NAMESPACE_URI = typeof HTML_NAMESPACE_URI;

export const XML_NAMESPACE_URI = 'http://www.w3.org/XML/1998/namespace';
export type XML_NAMESPACE_URI = typeof XML_NAMESPACE_URI;

export const XMLNS_NAMESPACE_URI = 'http://www.w3.org/2000/xmlns/';
export type XMLNS_NAMESPACE_URI = typeof XMLNS_NAMESPACE_URI;

export const FN_NAMESPACE_URI = 'http://www.w3.org/2005/xpath-functions';
export type FN_NAMESPACE_URI = typeof FN_NAMESPACE_URI;

// XForms/ODK
export const JAVAROSA_NAMESPACE_URI = 'http://openrosa.org/javarosa';
export type JAVAROSA_NAMESPACE_URI = typeof JAVAROSA_NAMESPACE_URI;

export const ODK_NAMESPACE_URI = 'http://www.opendatakit.org/xforms';
export type ODK_NAMESPACE_URI = typeof ODK_NAMESPACE_URI;

export const OPENROSA_XFORMS_NAMESPACE_URI = 'http://openrosa.org/xforms';
export const XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';
export type OPENROSA_XFORMS_NAMESPACE_URI = typeof OPENROSA_XFORMS_NAMESPACE_URI;

export type JavaRosaNamespaceURI = typeof JAVAROSA_NAMESPACE_URI;
export type XFormsNamespaceURI = typeof XFORMS_NAMESPACE_URI;
export const XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';
export type XFORMS_NAMESPACE_URI = typeof XFORMS_NAMESPACE_URI;

// Enketo
export const ENKETO_NAMESPACE_URI = 'http://enketo.org/xforms';
export type ENKETO_NAMESPACE_URI = typeof ENKETO_NAMESPACE_URI;

// Default prefixes
export const HTML_PREFIX = 'h';
export type HTML_PREFIX = typeof HTML_PREFIX;

export const XML_PREFIX = 'xml';
export type XML_PREFIX = typeof XML_PREFIX;

export const XMLNS_PREFIX = 'xmlns';
export type XMLNS_PREFIX = typeof XMLNS_PREFIX;

export const FN_PREFIX = 'fn';
export type FN_PREFIX = typeof FN_PREFIX;

export const JAVAROSA_PREFIX = 'jr';
export type JAVAROSA_PREFIX = typeof JAVAROSA_PREFIX;

export const ODK_PREFIX = 'odk';
export type ODK_PREFIX = typeof ODK_PREFIX;

export const OPENROSA_XFORMS_PREFIX = 'orx';
export type OPENROSA_XFORMS_PREFIX = typeof OPENROSA_XFORMS_PREFIX;

export const XFORMS_PREFIX = 'xf';
export type XFORMS_PREFIX = typeof XFORMS_PREFIX;

export const ENKETO_PREFIX = 'enk';
export type ENKETO_PREFIX = typeof ENKETO_PREFIX;
5 changes: 0 additions & 5 deletions packages/common/types/collections/IterableReadonlyTuple.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/scenario/test/actions-events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ describe('Actions/Events', () => {
// expectedException.expectMessage("An action was registered for unsupported events: odk-inftance-first-load, my-fake-event");

const init = async () => {
return Scenario.init('invalid-events.xml');
await Scenario.init('invalid-events.xml');
};

await expect(init).rejects.toThrowError(
Expand Down
4 changes: 2 additions & 2 deletions packages/scenario/test/form-definition-validity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ describe('TriggerableDagTest.java', () => {
* Same notes as previous (then surprising) failure of cycle detecction.
* At least we have a pattern!
*/
it.fails('should fail', async () => {
it('should fail', async () => {
// exceptionRule.expect(XFormParseException.class);
// exceptionRule.expectMessage("Cycle detected in form's relevant and calculation logic!");

Expand Down Expand Up @@ -645,7 +645,7 @@ describe('TriggerableDagTest.java', () => {
* Same notes as previous (then surprising) failure of cycle detecction.
* At least we have a pattern!
*/
it.fails('should fail', async () => {
it('should fail', async () => {
// exceptionRule.expect(XFormParseException.class);
// exceptionRule.expectMessage("Cycle detected in form's relevant and calculation logic!");

Expand Down
2 changes: 1 addition & 1 deletion packages/scenario/test/secondary-instances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ describe('Secondary instances', () => {
configureReferenceManagerCorrectly();

const init = async () => {
return Scenario.init(
await Scenario.init(
'Some form',
html(
head(
Expand Down
Loading
Loading