-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from getodk/features/engine/meta-instanceid
Engine support for [`orx:`]`instanceID` & [`jr:`]`preload="uid"`; vast improvements in support for XML/XPath namespace semantics
- Loading branch information
Showing
43 changed files
with
1,503 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
'@getodk/xforms-engine': minor | ||
--- | ||
|
||
- Compute `jr:preload="uid"` on form initialization. | ||
- Ensure submission XML incluces `instanceID` metadata. If not present in form definition, defaults to computing `jr:preload="uid"`. | ||
- Support for use of non-default (XForms) namespaces by primary instance elements, including: | ||
- Production of form-defined namespace declarations in submission XML; | ||
- Preservation of form-defined namespace prefix; | ||
- Use of namespace prefix in bind nodeset; | ||
- Use of namespace prefix in computed expressions. | ||
- Support for use of non-default namespaces by internal secondary instances. | ||
- Partial support for use of non-default namespaces by external XML secondary instances. (Namespaces may be resolved to engine-internal defaults.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/xforms-engine/src/error/UnknownPreloadAttributeValueNotice.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
type PreloadAttributeName = 'jr:preload' | 'jr:preloadParams'; | ||
|
||
/** | ||
* @todo This class is intentionally named to reflect the fact that it is not | ||
* intended to indefinitely block loading a form! Insofar as we currently throw | ||
* this error, the intent is to determine whether we have gaps in our support | ||
* for | ||
* {@link https://getodk.github.io/xforms-spec/#preload-attributes | preload attributes}. | ||
* | ||
* @todo Open question(s) for design around the broader error production story: | ||
* how should we design for conditions which are _optionally errors_ (e.g. | ||
* varying levels of strictness, use case-specific cases where certain kinds of | ||
* errors aren't failures)? In particular, how should we design for: | ||
* | ||
* - Categorization that allows selecting which error conditions are applied, at | ||
* what level of severity? | ||
* - Blocking progress on failure-level severity, proceeding on sub-failure | ||
* severity? | ||
* | ||
* Question applies to this case where we may want to error for unknown preload | ||
* attribute values in dev/test, but may not want to error under most (all?) | ||
* user-facing conditions. | ||
*/ | ||
export class UnknownPreloadAttributeValueNotice extends Error { | ||
constructor( | ||
attributeName: PreloadAttributeName, | ||
expectedValues: ReadonlyArray<string | null>, | ||
unknownValue: string | null | ||
) { | ||
const expected = expectedValues.map((value) => JSON.stringify(value)).join(', '); | ||
super( | ||
`Unknown ${attributeName} value. Expected one of ${expected}, got: ${JSON.stringify(unknownValue)}` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/xforms-engine/src/instance/internal-api/InstanceValueContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.