@getodk/xforms-engine 0.5.0 → 0.7.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 +1 -1
- package/dist/client/BaseNode.d.ts +8 -4
- package/dist/client/BaseValueNode.d.ts +8 -4
- package/dist/client/GroupNode.d.ts +1 -0
- package/dist/client/InputNode.d.ts +32 -3
- package/dist/client/ModelValueNode.d.ts +1 -0
- package/dist/client/NoteNode.d.ts +24 -7
- package/dist/client/RangeNode.d.ts +36 -0
- package/dist/client/RankNode.d.ts +46 -0
- package/dist/client/RootNode.d.ts +21 -14
- package/dist/client/SelectNode.d.ts +47 -25
- package/dist/client/SubtreeNode.d.ts +1 -0
- package/dist/client/TriggerNode.d.ts +10 -6
- package/dist/client/constants.d.ts +11 -12
- package/dist/client/form/CreateFormInstance.d.ts +14 -0
- package/dist/client/form/EditFormInstance.d.ts +62 -0
- package/dist/client/form/FormInstance.d.ts +104 -0
- package/dist/client/form/FormInstanceConfig.d.ts +17 -0
- package/dist/client/form/FormResource.d.ts +1 -0
- package/dist/client/form/LoadForm.d.ts +79 -0
- package/dist/client/form/LoadFormResult.d.ts +67 -0
- package/dist/client/form/RestoreFormInstance.d.ts +8 -0
- package/dist/client/hierarchy.d.ts +5 -5
- package/dist/client/index.d.ts +37 -11
- package/dist/client/node-types.d.ts +2 -2
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +3 -4
- package/dist/client/repeat/RepeatInstanceNode.d.ts +4 -5
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +2 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +2 -2
- package/dist/client/resources.d.ts +1 -1
- package/dist/client/serialization/InstanceData.d.ts +12 -0
- package/dist/client/serialization/InstanceFile.d.ts +6 -0
- package/dist/client/serialization/InstancePayload.d.ts +93 -0
- package/dist/client/serialization/InstancePayloadOptions.d.ts +23 -0
- package/dist/client/serialization/InstanceState.d.ts +12 -0
- package/dist/client/submission/{SubmissionDefinition.d.ts → SubmissionMeta.d.ts} +1 -1
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +1 -3
- package/dist/entrypoints/FormInstance.d.ts +20 -0
- package/dist/entrypoints/FormResult/BaseFormResult.d.ts +22 -0
- package/dist/entrypoints/FormResult/BaseInstantiableFormResult.d.ts +25 -0
- package/dist/entrypoints/FormResult/FormFailureResult.d.ts +17 -0
- package/dist/entrypoints/FormResult/FormSuccessResult.d.ts +15 -0
- package/dist/entrypoints/FormResult/FormWarningResult.d.ts +15 -0
- package/dist/entrypoints/createInstance.d.ts +9 -0
- package/dist/entrypoints/editInstance.d.ts +9 -0
- package/dist/entrypoints/index.d.ts +4 -0
- package/dist/entrypoints/loadForm.d.ts +4 -0
- package/dist/entrypoints/restoreInstance.d.ts +9 -0
- package/dist/error/LoadFormFailureError.d.ts +9 -0
- package/dist/error/MalformedInstanceDataError.d.ts +3 -0
- package/dist/error/RankMissingValueError.d.ts +3 -0
- package/dist/error/RankValueTypeError.d.ts +6 -0
- package/dist/error/SelectValueTypeError.d.ts +15 -0
- package/dist/error/TemplatedNodeAttributeSerializationError.d.ts +22 -0
- package/dist/error/XFormsSpecViolationError.d.ts +2 -0
- package/dist/index.d.ts +2 -34
- package/dist/index.js +7274 -5840
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +7 -5
- package/dist/instance/InputControl.d.ts +9 -6
- package/dist/instance/ModelValue.d.ts +7 -4
- package/dist/instance/Note.d.ts +14 -25
- package/dist/instance/PrimaryInstance.d.ts +36 -8
- package/dist/instance/RangeControl.d.ts +35 -0
- package/dist/instance/RankControl.d.ts +41 -0
- package/dist/instance/Root.d.ts +8 -9
- package/dist/instance/SelectControl.d.ts +67 -0
- package/dist/instance/Subtree.d.ts +7 -5
- package/dist/instance/TriggerControl.d.ts +10 -22
- package/dist/instance/abstract/DescendantNode.d.ts +11 -3
- package/dist/instance/abstract/InstanceNode.d.ts +10 -5
- package/dist/instance/abstract/ValueNode.d.ts +7 -6
- package/dist/instance/children/DescendantNodeInitOptions.d.ts +32 -0
- package/dist/instance/{children.d.ts → children/buildChildren.d.ts} +1 -1
- package/dist/instance/children/childrenInitOptions.d.ts +9 -0
- package/dist/instance/children/normalizeChildInitOptions.d.ts +2 -0
- package/dist/instance/hierarchy.d.ts +9 -9
- package/dist/instance/input/InitialInstanceState.d.ts +13 -0
- package/dist/instance/input/InstanceAttachmentMap.d.ts +19 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +2 -9
- package/dist/instance/internal-api/InstanceValueContext.d.ts +10 -1
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableInstance.d.ts +14 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.d.ts +32 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.d.ts +13 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableValueNode.d.ts +21 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +11 -8
- package/dist/instance/repeat/RepeatInstance.d.ts +11 -7
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +27 -3
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +4 -3
- package/dist/instance/resource.d.ts +5 -1
- package/dist/instance/unsupported/UploadControl.d.ts +32 -4
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +2 -2
- package/dist/integration/xpath/adapter/kind.d.ts +4 -10
- package/dist/integration/xpath/adapter/names.d.ts +1 -11
- package/dist/integration/xpath/adapter/traversal.d.ts +10 -9
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +10 -4
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +13 -11
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +25 -18
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +1 -1
- package/dist/integration/xpath/static-dom/StaticParentNode.d.ts +13 -0
- package/dist/integration/xpath/static-dom/staticNodeName.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createNodeRangeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createParentNodeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createPrimaryInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createRootInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.d.ts +6 -0
- package/dist/lib/client-reactivity/instance-state/createValueNodeInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/prepareInstancePayload.d.ts +8 -0
- package/dist/lib/codecs/Geopoint/Geopoint.d.ts +48 -0
- package/dist/lib/codecs/Geopoint/GeopointValueCodec.d.ts +5 -0
- package/dist/lib/codecs/NoteCodec.d.ts +8 -0
- package/dist/lib/codecs/RangeCodec.d.ts +8 -0
- package/dist/lib/codecs/TempUnsupportedControlCodec.d.ts +7 -0
- package/dist/lib/codecs/TriggerCodec.d.ts +7 -0
- package/dist/lib/codecs/ValueArrayCodec.d.ts +11 -0
- package/dist/lib/codecs/ValueCodec.d.ts +2 -2
- package/dist/lib/codecs/getNoteCodec.d.ts +3 -0
- package/dist/lib/codecs/getSelectCodec.d.ts +5 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +3 -2
- package/dist/lib/codecs/items/BaseItemCodec.d.ts +9 -0
- package/dist/lib/codecs/items/MultipleValueItemCodec.d.ts +14 -0
- package/dist/lib/codecs/items/SingleValueItemCodec.d.ts +24 -0
- package/dist/lib/dom/query.d.ts +1 -2
- package/dist/lib/names/NamespaceDeclaration.d.ts +45 -0
- package/dist/lib/names/NamespaceDeclarationMap.d.ts +137 -0
- package/dist/lib/names/NamespaceURL.d.ts +30 -0
- package/dist/lib/names/QualifiedName.d.ts +113 -0
- package/dist/lib/names/UnprefixedXFormsName.d.ts +4 -0
- package/dist/lib/number-parsers.d.ts +2 -0
- package/dist/lib/reactivity/createInstanceValueState.d.ts +2 -27
- package/dist/lib/reactivity/createItemCollection.d.ts +21 -0
- package/dist/lib/xml-serialization.d.ts +11 -2
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/body/BodyDefinition.d.ts +2 -2
- package/dist/parse/body/appearance/rangeAppearanceParser.d.ts +3 -0
- package/dist/parse/body/control/InputControlDefinition.d.ts +3 -0
- package/dist/parse/body/control/ItemDefinition.d.ts +14 -0
- package/dist/parse/body/control/ItemsetDefinition.d.ts +18 -0
- package/dist/parse/body/control/RangeControlDefinition.d.ts +31 -2
- package/dist/parse/body/control/RankControlDefinition.d.ts +7 -3
- package/dist/parse/body/control/{select/SelectDefinition.d.ts → SelectControlDefinition.d.ts} +9 -9
- package/dist/parse/expression/ItemsetNodesetExpression.d.ts +1 -1
- package/dist/parse/expression/ItemsetValueExpression.d.ts +1 -1
- package/dist/parse/model/BindDefinition.d.ts +3 -1
- package/dist/parse/model/BindPreloadDefinition.d.ts +42 -0
- package/dist/parse/model/DescendentNodeDefinition.d.ts +4 -13
- package/dist/parse/model/ItextTranslationsDefinition.d.ts +18 -0
- package/dist/parse/model/LeafNodeDefinition.d.ts +9 -7
- package/dist/parse/model/ModelDefinition.d.ts +9 -2
- package/dist/parse/model/NodeDefinition.d.ts +30 -45
- package/dist/parse/model/NoteNodeDefinition.d.ts +7 -5
- package/dist/parse/model/RangeNodeDefinition.d.ts +42 -0
- package/dist/parse/model/RepeatDefinition.d.ts +62 -0
- package/dist/parse/model/RootAttributeDefinition.d.ts +21 -0
- package/dist/parse/model/RootAttributeMap.d.ts +24 -0
- package/dist/parse/model/RootDefinition.d.ts +15 -14
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +15 -2
- package/dist/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/defineSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +1 -7
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/{FormSubmissionDefinition.d.ts → SubmissionDefinition.d.ts} +2 -2
- package/dist/parse/model/SubtreeDefinition.d.ts +9 -7
- package/dist/parse/model/nodeDefinitionMap.d.ts +5 -0
- package/dist/parse/shared/parseInstanceXML.d.ts +21 -0
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +4 -22
- package/dist/parse/text/ItemLabelDefinition.d.ts +1 -1
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +2 -2
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +1 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +1 -3
- package/dist/solid.js +7247 -5813
- package/dist/solid.js.map +1 -1
- package/package.json +15 -12
- package/src/client/BaseNode.ts +9 -4
- package/src/client/BaseValueNode.ts +8 -4
- package/src/client/GroupNode.ts +1 -0
- package/src/client/InputNode.ts +38 -2
- package/src/client/ModelValueNode.ts +1 -0
- package/src/client/NoteNode.ts +43 -7
- package/src/client/RangeNode.ts +51 -0
- package/src/client/RankNode.ts +54 -0
- package/src/client/RootNode.ts +30 -16
- package/src/client/SelectNode.ts +53 -26
- package/src/client/SubtreeNode.ts +1 -0
- package/src/client/TriggerNode.ts +12 -6
- package/src/client/constants.ts +12 -14
- package/src/client/form/CreateFormInstance.ts +19 -0
- package/src/client/form/EditFormInstance.ts +93 -0
- package/src/client/form/FormInstance.ts +114 -0
- package/src/client/form/FormInstanceConfig.ts +18 -0
- package/src/client/form/FormResource.ts +1 -0
- package/src/client/form/LoadForm.ts +92 -0
- package/src/client/form/LoadFormResult.ts +103 -0
- package/src/client/form/RestoreFormInstance.ts +14 -0
- package/src/client/hierarchy.ts +7 -8
- package/src/client/index.ts +47 -29
- package/src/client/node-types.ts +3 -5
- package/src/client/repeat/BaseRepeatRangeNode.ts +3 -4
- package/src/client/repeat/RepeatInstanceNode.ts +4 -8
- package/src/client/repeat/RepeatRangeControlledNode.ts +2 -2
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +2 -2
- package/src/client/resources.ts +2 -2
- package/src/client/serialization/InstanceData.ts +16 -0
- package/src/client/serialization/InstanceFile.ts +9 -0
- package/src/client/serialization/InstancePayload.ts +126 -0
- package/src/client/serialization/InstancePayloadOptions.ts +28 -0
- package/src/client/serialization/InstanceState.ts +14 -0
- package/src/client/submission/{SubmissionDefinition.ts → SubmissionMeta.ts} +1 -1
- package/src/client/unsupported/UnsupportedControlNode.ts +2 -6
- package/src/entrypoints/FormInstance.ts +55 -0
- package/src/entrypoints/FormResult/BaseFormResult.ts +40 -0
- package/src/entrypoints/FormResult/BaseInstantiableFormResult.ts +109 -0
- package/src/entrypoints/FormResult/FormFailureResult.ts +44 -0
- package/src/entrypoints/FormResult/FormSuccessResult.ts +25 -0
- package/src/entrypoints/FormResult/FormWarningResult.ts +25 -0
- package/src/entrypoints/createInstance.ts +23 -0
- package/src/entrypoints/editInstance.ts +24 -0
- package/src/entrypoints/index.ts +4 -0
- package/src/entrypoints/loadForm.ts +154 -0
- package/src/entrypoints/restoreInstance.ts +27 -0
- package/src/error/LoadFormFailureError.ts +114 -0
- package/src/error/MalformedInstanceDataError.ts +3 -0
- package/src/error/RankMissingValueError.ts +5 -0
- package/src/error/RankValueTypeError.ts +13 -0
- package/src/error/SelectValueTypeError.ts +22 -0
- package/src/error/TemplatedNodeAttributeSerializationError.ts +24 -0
- package/src/error/XFormsSpecViolationError.ts +1 -0
- package/src/index.ts +2 -56
- package/src/instance/Group.ts +17 -15
- package/src/instance/InputControl.ts +58 -12
- package/src/instance/ModelValue.ts +19 -11
- package/src/instance/Note.ts +40 -64
- package/src/instance/PrimaryInstance.ts +70 -31
- package/src/instance/RangeControl.ts +119 -0
- package/src/instance/RankControl.ts +208 -0
- package/src/instance/Root.ts +21 -31
- package/src/instance/SelectControl.ts +228 -0
- package/src/instance/Subtree.ts +17 -15
- package/src/instance/TriggerControl.ts +50 -80
- package/src/instance/abstract/DescendantNode.ts +13 -8
- package/src/instance/abstract/InstanceNode.ts +19 -7
- package/src/instance/abstract/ValueNode.ts +14 -15
- package/src/instance/children/DescendantNodeInitOptions.ts +35 -0
- package/src/instance/children/buildChildren.ts +206 -0
- package/src/instance/children/childrenInitOptions.ts +117 -0
- package/src/instance/children/normalizeChildInitOptions.ts +332 -0
- package/src/instance/hierarchy.ts +21 -16
- package/src/instance/input/InitialInstanceState.ts +108 -0
- package/src/instance/input/InstanceAttachmentMap.ts +142 -0
- package/src/instance/internal-api/InstanceConfig.ts +3 -10
- package/src/instance/internal-api/InstanceValueContext.ts +11 -1
- package/src/instance/internal-api/serialization/ClientReactiveSerializableInstance.ts +20 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.ts +43 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableParentNode.ts +26 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts +24 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableValueNode.ts +28 -0
- package/src/instance/repeat/BaseRepeatRange.ts +21 -24
- package/src/instance/repeat/RepeatInstance.ts +27 -19
- package/src/instance/repeat/RepeatRangeControlled.ts +90 -17
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +10 -9
- package/src/instance/resource.ts +18 -2
- package/src/instance/unsupported/UploadControl.ts +116 -5
- package/src/integration/xpath/EngineXPathEvaluator.ts +2 -2
- package/src/integration/xpath/adapter/kind.ts +1 -28
- package/src/integration/xpath/adapter/names.ts +66 -17
- package/src/integration/xpath/adapter/traversal.ts +12 -11
- package/src/integration/xpath/static-dom/StaticAttribute.ts +16 -7
- package/src/integration/xpath/static-dom/StaticDocument.ts +17 -18
- package/src/integration/xpath/static-dom/StaticElement.ts +211 -52
- package/src/integration/xpath/static-dom/StaticNode.ts +1 -1
- package/src/integration/xpath/static-dom/StaticParentNode.ts +22 -0
- package/src/integration/xpath/static-dom/staticNodeName.ts +20 -0
- package/src/lib/client-reactivity/instance-state/createNodeRangeInstanceState.ts +17 -0
- package/src/lib/client-reactivity/instance-state/createParentNodeInstanceState.ts +22 -0
- package/src/lib/client-reactivity/instance-state/createPrimaryInstanceState.ts +12 -0
- package/src/lib/client-reactivity/instance-state/createRootInstanceState.ts +19 -0
- package/src/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts +31 -0
- package/src/lib/client-reactivity/instance-state/createValueNodeInstanceState.ts +21 -0
- package/src/lib/client-reactivity/instance-state/prepareInstancePayload.ts +173 -0
- package/src/lib/codecs/Geopoint/Geopoint.ts +150 -0
- package/src/lib/codecs/Geopoint/GeopointValueCodec.ts +20 -0
- package/src/lib/codecs/NoteCodec.ts +32 -0
- package/src/lib/codecs/RangeCodec.ts +65 -0
- package/src/lib/codecs/TempUnsupportedControlCodec.ts +32 -0
- package/src/lib/codecs/TriggerCodec.ts +64 -0
- package/src/lib/codecs/ValueArrayCodec.ts +42 -0
- package/src/lib/codecs/ValueCodec.ts +2 -2
- package/src/lib/codecs/getNoteCodec.ts +27 -0
- package/src/lib/codecs/getSelectCodec.ts +27 -0
- package/src/lib/codecs/getSharedValueCodec.ts +5 -3
- package/src/lib/codecs/items/BaseItemCodec.ts +20 -0
- package/src/lib/codecs/items/MultipleValueItemCodec.ts +28 -0
- package/src/lib/codecs/items/SingleValueItemCodec.ts +67 -0
- package/src/lib/dom/query.ts +1 -2
- package/src/lib/names/NamespaceDeclaration.ts +106 -0
- package/src/lib/names/NamespaceDeclarationMap.ts +228 -0
- package/src/lib/names/NamespaceURL.ts +44 -0
- package/src/lib/names/QualifiedName.ts +170 -0
- package/src/lib/names/UnprefixedXFormsName.ts +12 -0
- package/src/lib/number-parsers.ts +25 -0
- package/src/lib/reactivity/createInstanceValueState.ts +69 -43
- package/src/lib/reactivity/{createSelectItems.ts → createItemCollection.ts} +41 -36
- package/src/lib/xml-serialization.ts +76 -9
- package/src/parse/XFormDOM.ts +141 -21
- package/src/parse/XFormDefinition.ts +1 -4
- package/src/parse/body/BodyDefinition.ts +4 -4
- package/src/parse/body/appearance/rangeAppearanceParser.ts +11 -0
- package/src/parse/body/control/InputControlDefinition.ts +9 -0
- package/src/parse/body/control/{select/ItemDefinition.ts → ItemDefinition.ts} +8 -6
- package/src/parse/body/control/{select/ItemsetDefinition.ts → ItemsetDefinition.ts} +11 -9
- package/src/parse/body/control/RangeControlDefinition.ts +91 -6
- package/src/parse/body/control/RankControlDefinition.ts +25 -7
- package/src/parse/body/control/{select/SelectDefinition.ts → SelectControlDefinition.ts} +9 -9
- package/src/parse/expression/ItemsetNodesetExpression.ts +1 -1
- package/src/parse/expression/ItemsetValueExpression.ts +1 -1
- package/src/parse/model/BindDefinition.ts +4 -0
- package/src/parse/model/BindPreloadDefinition.ts +100 -0
- package/src/parse/model/DescendentNodeDefinition.ts +7 -25
- package/src/parse/model/ItextTranslationsDefinition.ts +79 -0
- package/src/parse/model/LeafNodeDefinition.ts +13 -8
- package/src/parse/model/ModelDefinition.ts +36 -3
- package/src/parse/model/NodeDefinition.ts +38 -85
- package/src/parse/model/NoteNodeDefinition.ts +12 -10
- package/src/parse/model/RangeNodeDefinition.ts +119 -0
- package/src/parse/model/RepeatDefinition.ts +382 -0
- package/src/parse/model/RootAttributeDefinition.ts +44 -0
- package/src/parse/model/RootAttributeMap.ts +49 -0
- package/src/parse/model/RootDefinition.ts +42 -43
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +23 -2
- package/src/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.ts +14 -0
- package/src/parse/model/SecondaryInstance/defineSecondaryInstance.ts +32 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +3 -24
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +33 -86
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +64 -136
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +9 -7
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +1 -1
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +7 -7
- package/src/parse/model/{FormSubmissionDefinition.ts → SubmissionDefinition.ts} +2 -2
- package/src/parse/model/SubtreeDefinition.ts +15 -16
- package/src/parse/model/nodeDefinitionMap.ts +34 -0
- package/src/parse/shared/parseInstanceXML.ts +79 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +46 -131
- package/src/parse/text/ItemLabelDefinition.ts +1 -1
- package/src/parse/text/ItemsetLabelDefinition.ts +2 -2
- package/src/parse/text/abstract/TextElementDefinition.ts +1 -1
- package/src/parse/xpath/semantic-analysis.ts +4 -3
- package/dist/client/EngineConfig.d.ts +0 -79
- package/dist/client/submission/SubmissionData.d.ts +0 -7
- package/dist/client/submission/SubmissionInstanceFile.d.ts +0 -6
- package/dist/client/submission/SubmissionOptions.d.ts +0 -23
- package/dist/client/submission/SubmissionResult.d.ts +0 -91
- package/dist/client/submission/SubmissionState.d.ts +0 -12
- package/dist/client/unsupported/RangeNode.d.ts +0 -9
- package/dist/client/unsupported/RankNode.d.ts +0 -9
- package/dist/instance/SelectField.d.ts +0 -58
- package/dist/instance/abstract/UnsupportedControl.d.ts +0 -53
- package/dist/instance/index.d.ts +0 -8
- package/dist/instance/internal-api/ValueContext.d.ts +0 -23
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +0 -14
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +0 -31
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +0 -18
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +0 -17
- package/dist/instance/unsupported/RangeControl.d.ts +0 -6
- package/dist/instance/unsupported/RankControl.d.ts +0 -6
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +0 -17
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +0 -8
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -16
- package/dist/lib/reactivity/createValueState.d.ts +0 -40
- package/dist/parse/body/control/select/ItemDefinition.d.ts +0 -13
- package/dist/parse/body/control/select/ItemsetDefinition.d.ts +0 -17
- package/dist/parse/body/control/select/ItemsetNodesetContext.d.ts +0 -9
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +0 -4
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +0 -8
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +0 -8
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +0 -14
- package/dist/parse/model/RepeatRangeDefinition.d.ts +0 -29
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +0 -28
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +0 -4
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +0 -7
- package/src/client/EngineConfig.ts +0 -84
- package/src/client/submission/SubmissionData.ts +0 -12
- package/src/client/submission/SubmissionInstanceFile.ts +0 -9
- package/src/client/submission/SubmissionOptions.ts +0 -28
- package/src/client/submission/SubmissionResult.ts +0 -124
- package/src/client/submission/SubmissionState.ts +0 -14
- package/src/client/unsupported/RangeNode.ts +0 -14
- package/src/client/unsupported/RankNode.ts +0 -14
- package/src/instance/SelectField.ts +0 -263
- package/src/instance/abstract/UnsupportedControl.ts +0 -174
- package/src/instance/children.ts +0 -158
- package/src/instance/index.ts +0 -55
- package/src/instance/internal-api/ValueContext.ts +0 -28
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +0 -20
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +0 -42
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +0 -25
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +0 -23
- package/src/instance/unsupported/RangeControl.ts +0 -9
- package/src/instance/unsupported/RankControl.ts +0 -9
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +0 -45
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +0 -12
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +0 -20
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +0 -17
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +0 -22
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +0 -21
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +0 -172
- package/src/lib/reactivity/createValueState.ts +0 -200
- package/src/parse/body/control/select/ItemsetNodesetContext.ts +0 -21
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +0 -4
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +0 -41
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +0 -31
- package/src/parse/model/RepeatInstanceDefinition.ts +0 -34
- package/src/parse/model/RepeatRangeDefinition.ts +0 -94
- package/src/parse/model/RepeatTemplateDefinition.ts +0 -145
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +0 -4
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +0 -12
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Implementation of the [ODK XForms specification](https://getodk.github.io/xforms-spec/)'s data model and computation logic. This package does not handle presentation or user interaction. Those aspects of forms are meant to be handled by a client. Presently, those clients are:
|
|
4
4
|
|
|
5
5
|
- [`@getodk/web-forms`](../web-forms)
|
|
6
|
-
- [`@getodk/
|
|
6
|
+
- [`@getodk/scenario`](../scenario)
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import { NodeAppearances } from './NodeAppearances.ts';
|
|
|
3
3
|
import { TextRange } from './TextRange.ts';
|
|
4
4
|
import { FormNodeID } from './identity.ts';
|
|
5
5
|
import { InstanceNodeType } from './node-types.ts';
|
|
6
|
-
import {
|
|
6
|
+
import { InstanceState } from './serialization/InstanceState.ts';
|
|
7
7
|
import { NodeValidationState } from './validation.ts';
|
|
8
8
|
export interface BaseNodeState {
|
|
9
9
|
/**
|
|
@@ -133,6 +133,10 @@ export interface BaseNode {
|
|
|
133
133
|
* @see {@link TokenListParser} for details.
|
|
134
134
|
*/
|
|
135
135
|
readonly appearances: NodeAppearances<any> | null;
|
|
136
|
+
/**
|
|
137
|
+
* A node can have options that determine its behavior.
|
|
138
|
+
*/
|
|
139
|
+
readonly nodeOptions: object | null;
|
|
136
140
|
/**
|
|
137
141
|
* Each node has a definition which specifies aspects of the node defined in
|
|
138
142
|
* the form. These aspects include (but are not limited to) the node's data
|
|
@@ -207,14 +211,14 @@ export interface BaseNode {
|
|
|
207
211
|
*/
|
|
208
212
|
readonly validationState: NodeValidationState;
|
|
209
213
|
/**
|
|
210
|
-
* Represents the current
|
|
214
|
+
* Represents the current instance state of the node.
|
|
211
215
|
*
|
|
212
|
-
* @see {@link
|
|
216
|
+
* @see {@link InstanceState.instanceXML} for additional detail.
|
|
213
217
|
*
|
|
214
218
|
* @todo Consider whether this can (should) be merged with
|
|
215
219
|
* {@link currentState}, while providing the same client-reactivity
|
|
216
220
|
* guarantees. (The challenge there is in defining client-reactive state which
|
|
217
221
|
* self-referentially derives state from its own definition.)
|
|
218
222
|
*/
|
|
219
|
-
readonly
|
|
223
|
+
readonly instanceState: InstanceState;
|
|
220
224
|
}
|
|
@@ -2,23 +2,26 @@ import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
|
2
2
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
3
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
4
4
|
import { LeafNodeType } from './node-types.ts';
|
|
5
|
+
import { InstanceState } from './serialization/InstanceState.ts';
|
|
5
6
|
import { LeafNodeValidationState } from './validation.ts';
|
|
6
7
|
import { ValueType } from './ValueType.ts';
|
|
7
8
|
export interface BaseValueNodeState<Value> extends BaseNodeState {
|
|
8
9
|
get children(): null;
|
|
9
|
-
get valueOptions():
|
|
10
|
+
get valueOptions(): unknown;
|
|
10
11
|
get value(): Value;
|
|
11
12
|
/**
|
|
12
13
|
* Reflects the serialized string representation of a {@link BaseValueNode}'s
|
|
13
14
|
* {@link value} state. This representation allows access to the node's value
|
|
14
15
|
* _as primary instance state_. In other words, this is the value which:
|
|
15
16
|
*
|
|
16
|
-
* - would be serialized as a text node in
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* - would be serialized as a text node in {@link InstanceState.instanceXML}
|
|
18
|
+
* (note: this value is **NOT** escaped for XML serialization, as it is
|
|
19
|
+
* there)
|
|
19
20
|
*
|
|
20
21
|
* - is used when the node's value is referenced in any of a form's XPath
|
|
21
22
|
* expressions
|
|
23
|
+
*
|
|
24
|
+
* @todo Consider moving into {@link InstanceState}
|
|
22
25
|
*/
|
|
23
26
|
get instanceValue(): string;
|
|
24
27
|
}
|
|
@@ -29,4 +32,5 @@ export interface BaseValueNode<V extends ValueType = ValueType, Value = string>
|
|
|
29
32
|
readonly parent: GeneralParentNode;
|
|
30
33
|
readonly currentState: BaseValueNodeState<Value>;
|
|
31
34
|
readonly validationState: LeafNodeValidationState;
|
|
35
|
+
readonly instanceState: InstanceState;
|
|
32
36
|
}
|
|
@@ -21,6 +21,7 @@ export type GroupNodeAppearances = NodeAppearances<GroupDefinition>;
|
|
|
21
21
|
export interface GroupNode extends BaseNode {
|
|
22
22
|
readonly nodeType: 'group';
|
|
23
23
|
readonly appearances: GroupNodeAppearances;
|
|
24
|
+
readonly nodeOptions: null;
|
|
24
25
|
readonly definition: GroupDefinition;
|
|
25
26
|
readonly root: RootNode;
|
|
26
27
|
readonly parent: GeneralParentNode;
|
|
@@ -24,15 +24,39 @@ export interface InputDefinition<V extends ValueType = ValueType> extends LeafNo
|
|
|
24
24
|
readonly bodyElement: InputControlDefinition;
|
|
25
25
|
}
|
|
26
26
|
export type InputNodeAppearances = NodeAppearances<InputDefinition>;
|
|
27
|
+
interface StringInputNodeOptions {
|
|
28
|
+
readonly rows: number | null;
|
|
29
|
+
}
|
|
30
|
+
interface GeoInputNodeOptions {
|
|
31
|
+
readonly accuracyThreshold: number | null;
|
|
32
|
+
readonly unacceptableAccuracyThreshold: number | null;
|
|
33
|
+
}
|
|
34
|
+
interface InputNodeOptionsByValueType {
|
|
35
|
+
readonly string: StringInputNodeOptions;
|
|
36
|
+
readonly int: null;
|
|
37
|
+
readonly boolean: null;
|
|
38
|
+
readonly decimal: null;
|
|
39
|
+
readonly date: null;
|
|
40
|
+
readonly time: null;
|
|
41
|
+
readonly dateTime: null;
|
|
42
|
+
readonly geopoint: GeoInputNodeOptions;
|
|
43
|
+
readonly geotrace: GeoInputNodeOptions;
|
|
44
|
+
readonly geoshape: GeoInputNodeOptions;
|
|
45
|
+
readonly binary: null;
|
|
46
|
+
readonly barcode: null;
|
|
47
|
+
readonly intent: null;
|
|
48
|
+
}
|
|
49
|
+
export type InputNodeOptions<V extends ValueType> = InputNodeOptionsByValueType[V];
|
|
27
50
|
/**
|
|
28
51
|
* A node corresponding to form field defined as an
|
|
29
52
|
* {@link https://getodk.github.io/xforms-spec/#body-elements | XForms `<input>`},
|
|
30
|
-
* which a user-facing client would likely present for a user to fill
|
|
53
|
+
* which a user-facing client would likely present for a user to fill.
|
|
31
54
|
*/
|
|
32
55
|
export interface InputNode<V extends ValueType = ValueType> extends BaseValueNode<V, InputValue<V>> {
|
|
33
56
|
readonly nodeType: 'input';
|
|
34
57
|
readonly valueType: V;
|
|
35
58
|
readonly appearances: InputNodeAppearances;
|
|
59
|
+
readonly nodeOptions: InputNodeOptions<V>;
|
|
36
60
|
readonly definition: InputDefinition<V>;
|
|
37
61
|
readonly root: RootNode;
|
|
38
62
|
readonly parent: GeneralParentNode;
|
|
@@ -43,11 +67,16 @@ export interface InputNode<V extends ValueType = ValueType> extends BaseValueNod
|
|
|
43
67
|
*/
|
|
44
68
|
setValue(value: InputNodeInputValue<V>): RootNode;
|
|
45
69
|
}
|
|
70
|
+
export type StringInputValue = InputValue<'string'>;
|
|
71
|
+
export type IntInputValue = InputValue<'int'>;
|
|
72
|
+
export type DecimalInputValue = InputValue<'decimal'>;
|
|
73
|
+
export type GeopointInputValue = InputValue<'geopoint'>;
|
|
46
74
|
export type StringInputNode = InputNode<'string'>;
|
|
47
75
|
export type IntInputNode = InputNode<'int'>;
|
|
48
76
|
export type DecimalInputNode = InputNode<'decimal'>;
|
|
49
|
-
type
|
|
77
|
+
export type GeopointInputNode = InputNode<'geopoint'>;
|
|
78
|
+
type SupportedInputValueType = 'string' | 'int' | 'decimal' | 'geopoint';
|
|
50
79
|
type TemporaryStringValueType = Exclude<ValueType, SupportedInputValueType>;
|
|
51
80
|
export type TemporaryStringValueInputNode = InputNode<TemporaryStringValueType>;
|
|
52
|
-
export type AnyInputNode = StringInputNode | IntInputNode | DecimalInputNode | TemporaryStringValueInputNode;
|
|
81
|
+
export type AnyInputNode = StringInputNode | IntInputNode | DecimalInputNode | GeopointInputNode | TemporaryStringValueInputNode;
|
|
53
82
|
export {};
|
|
@@ -32,6 +32,7 @@ export interface ModelValueNode<V extends ValueType = ValueType> extends BaseVal
|
|
|
32
32
|
readonly nodeType: 'model-value';
|
|
33
33
|
readonly valueType: V;
|
|
34
34
|
readonly appearances: null;
|
|
35
|
+
readonly nodeOptions: null;
|
|
35
36
|
readonly definition: ModelValueDefinition<V>;
|
|
36
37
|
readonly root: RootNode;
|
|
37
38
|
readonly parent: GeneralParentNode;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { NoteRuntimeValue } from '../lib/codecs/NoteCodec.ts';
|
|
1
2
|
import { InputControlDefinition } from '../parse/body/control/InputControlDefinition.ts';
|
|
2
3
|
import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
|
-
import {
|
|
4
|
+
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
5
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
5
6
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
6
7
|
import { RootNode } from './RootNode.ts';
|
|
7
8
|
import { TextRange } from './TextRange.ts';
|
|
8
9
|
import { LeafNodeValidationState } from './validation.ts';
|
|
9
|
-
|
|
10
|
+
import { ValueType } from './ValueType.ts';
|
|
11
|
+
export type NoteValue<V extends ValueType> = NoteRuntimeValue<V>;
|
|
12
|
+
export interface NoteNodeState<V extends ValueType> extends BaseValueNodeState<NoteValue<V>> {
|
|
10
13
|
/**
|
|
11
14
|
* Note-specific specialization: a note will always have a non-null value in
|
|
12
15
|
* at least one of:
|
|
@@ -29,9 +32,9 @@ export interface NoteNodeState extends BaseNodeState {
|
|
|
29
32
|
/**
|
|
30
33
|
* Reflects the readonly value of a {@link NoteNode}, or `null` if blank.
|
|
31
34
|
*/
|
|
32
|
-
get value():
|
|
35
|
+
get value(): NoteValue<V>;
|
|
33
36
|
}
|
|
34
|
-
export interface NoteDefinition extends LeafNodeDefinition {
|
|
37
|
+
export interface NoteDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
35
38
|
readonly bodyElement: InputControlDefinition;
|
|
36
39
|
}
|
|
37
40
|
export type NoteNodeAppearances = NodeAppearances<NoteDefinition>;
|
|
@@ -41,12 +44,26 @@ export type NoteNodeAppearances = NodeAppearances<NoteDefinition>;
|
|
|
41
44
|
* - associated with an input, with at least one text element (label or hint)
|
|
42
45
|
* - guaranteed to be {@link NoteNodeState.readonly | readonly}
|
|
43
46
|
*/
|
|
44
|
-
export interface NoteNode extends
|
|
47
|
+
export interface NoteNode<V extends ValueType = ValueType> extends BaseValueNode<V, NoteValue<V>> {
|
|
45
48
|
readonly nodeType: 'note';
|
|
46
49
|
readonly appearances: NoteNodeAppearances;
|
|
47
|
-
readonly
|
|
50
|
+
readonly nodeOptions: null;
|
|
51
|
+
readonly definition: NoteDefinition<V>;
|
|
48
52
|
readonly root: RootNode;
|
|
49
53
|
readonly parent: GeneralParentNode;
|
|
50
|
-
readonly currentState: NoteNodeState
|
|
54
|
+
readonly currentState: NoteNodeState<V>;
|
|
51
55
|
readonly validationState: LeafNodeValidationState;
|
|
52
56
|
}
|
|
57
|
+
export type StringNoteValue = NoteValue<'string'>;
|
|
58
|
+
export type IntNoteValue = NoteValue<'int'>;
|
|
59
|
+
export type DecimalNoteValue = NoteValue<'decimal'>;
|
|
60
|
+
export type GeopointNoteValue = NoteValue<'geopoint'>;
|
|
61
|
+
export type StringNoteNode = NoteNode<'string'>;
|
|
62
|
+
export type IntNoteNode = NoteNode<'int'>;
|
|
63
|
+
export type DecimalNoteNode = NoteNode<'decimal'>;
|
|
64
|
+
export type GeopointNoteNode = NoteNode<'geopoint'>;
|
|
65
|
+
type SupportedNoteValueType = 'string' | 'int' | 'decimal' | 'geopoint';
|
|
66
|
+
type TemporaryStringValueType = Exclude<ValueType, SupportedNoteValueType>;
|
|
67
|
+
export type TemporaryStringValueNoteNode = NoteNode<TemporaryStringValueType>;
|
|
68
|
+
export type AnyNoteNode = StringNoteNode | IntNoteNode | DecimalNoteNode | GeopointNoteNode | TemporaryStringValueNoteNode;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RuntimeInputValue, RuntimeValue } from '../lib/codecs/getSharedValueCodec.ts';
|
|
2
|
+
import { RangeNodeDefinition, RangeValueType } from '../parse/model/RangeNodeDefinition.ts';
|
|
3
|
+
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
|
+
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
|
+
import { RootNode } from './RootNode.ts';
|
|
6
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
import { LeafNodeValidationState } from './validation.ts';
|
|
8
|
+
export type { RangeValueType };
|
|
9
|
+
export type RangeValue<V extends RangeValueType> = RuntimeValue<V>;
|
|
10
|
+
export type RangeInputValue<V extends RangeValueType> = RuntimeInputValue<V>;
|
|
11
|
+
export interface RangeNodeState<V extends RangeValueType> extends BaseValueNodeState<RangeValue<V>> {
|
|
12
|
+
get valueOptions(): null;
|
|
13
|
+
}
|
|
14
|
+
export type RangeNodeAppearances = NodeAppearances<RangeNodeDefinition>;
|
|
15
|
+
/**
|
|
16
|
+
* A node corresponding to form field defined as an
|
|
17
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | XForms `<range>`}.
|
|
18
|
+
*/
|
|
19
|
+
export interface RangeNode<V extends RangeValueType = RangeValueType> extends BaseValueNode<V, RangeValue<V>> {
|
|
20
|
+
readonly nodeType: 'range';
|
|
21
|
+
readonly valueType: V;
|
|
22
|
+
readonly appearances: RangeNodeAppearances;
|
|
23
|
+
readonly nodeOptions: null;
|
|
24
|
+
readonly definition: RangeNodeDefinition<V>;
|
|
25
|
+
readonly root: RootNode;
|
|
26
|
+
readonly parent: GeneralParentNode;
|
|
27
|
+
readonly currentState: RangeNodeState<V>;
|
|
28
|
+
readonly validationState: LeafNodeValidationState;
|
|
29
|
+
/**
|
|
30
|
+
* For use by a client to update the value of an {@link RangeNode}.
|
|
31
|
+
*/
|
|
32
|
+
setValue(value: RangeInputValue<V>): RootNode;
|
|
33
|
+
}
|
|
34
|
+
export type IntRangeNode = RangeNode<'int'>;
|
|
35
|
+
export type DecimalRangeNode = RangeNode<'decimal'>;
|
|
36
|
+
export type AnyRangeNode = IntRangeNode | DecimalRangeNode;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RankControlDefinition } from '../parse/body/control/RankControlDefinition.ts';
|
|
2
|
+
import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
|
+
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
|
+
import { RootNode } from './RootNode.ts';
|
|
5
|
+
import { TextRange } from './TextRange.ts';
|
|
6
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
import { LeafNodeValidationState } from './validation.ts';
|
|
8
|
+
import { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
9
|
+
import { ValueType } from './ValueType.ts';
|
|
10
|
+
export interface RankItem {
|
|
11
|
+
get label(): TextRange<'item-label'>;
|
|
12
|
+
get value(): string;
|
|
13
|
+
}
|
|
14
|
+
export type RankValueOptions = readonly RankItem[];
|
|
15
|
+
export interface RankNodeState extends BaseValueNodeState<readonly string[]> {
|
|
16
|
+
get valueOptions(): RankValueOptions;
|
|
17
|
+
/**
|
|
18
|
+
* An ordered collection of values from {@link RankItem}.
|
|
19
|
+
* The order of the items is important and must be preserved during processing.
|
|
20
|
+
*/
|
|
21
|
+
get value(): readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export interface RankDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
24
|
+
readonly bodyElement: RankControlDefinition;
|
|
25
|
+
}
|
|
26
|
+
export interface RankNode extends BaseValueNode<'string', readonly string[]> {
|
|
27
|
+
readonly nodeType: 'rank';
|
|
28
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
29
|
+
readonly nodeOptions: null;
|
|
30
|
+
readonly valueType: 'string';
|
|
31
|
+
readonly definition: RankDefinition<'string'>;
|
|
32
|
+
readonly root: RootNode;
|
|
33
|
+
readonly parent: GeneralParentNode;
|
|
34
|
+
readonly currentState: RankNodeState;
|
|
35
|
+
readonly validationState: LeafNodeValidationState;
|
|
36
|
+
/**
|
|
37
|
+
* Convenience API to get the {@link RankItem}'s label.
|
|
38
|
+
*/
|
|
39
|
+
getValueLabel(value: string): TextRange<'item-label'> | null;
|
|
40
|
+
/**
|
|
41
|
+
* Set the value which is an ordered collection of values from {@link RankItem}.
|
|
42
|
+
* Calling this setter replaces the currently value.
|
|
43
|
+
* If called with an empty array, the current is cleared.
|
|
44
|
+
*/
|
|
45
|
+
setValues(values: readonly string[]): RootNode;
|
|
46
|
+
}
|
|
@@ -3,8 +3,8 @@ import { RootDefinition } from '../parse/model/RootDefinition.ts';
|
|
|
3
3
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
4
|
import { ActiveLanguage, FormLanguage, FormLanguages } from './FormLanguage.ts';
|
|
5
5
|
import { GeneralChildNode } from './hierarchy.ts';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ChunkedInstancePayload, MonolithicInstancePayload } from './serialization/InstancePayload.ts';
|
|
7
|
+
import { InstancePayloadOptions } from './serialization/InstancePayloadOptions.ts';
|
|
8
8
|
import { AncestorNodeValidationState } from './validation.ts';
|
|
9
9
|
export interface RootNodeState extends BaseNodeState {
|
|
10
10
|
/**
|
|
@@ -24,6 +24,7 @@ export interface RootNode extends BaseNode {
|
|
|
24
24
|
* @todo this along with {@link classes} is... awkward.
|
|
25
25
|
*/
|
|
26
26
|
readonly appearances: null;
|
|
27
|
+
readonly nodeOptions: null;
|
|
27
28
|
/**
|
|
28
29
|
* @todo This is another odd deviation in {@link RootNode}. Unlike
|
|
29
30
|
* {@link languages}, it doesn't feel particularly **essential**. While it
|
|
@@ -49,31 +50,37 @@ export interface RootNode extends BaseNode {
|
|
|
49
50
|
readonly languages: FormLanguages;
|
|
50
51
|
setLanguage(language: FormLanguage): RootNode;
|
|
51
52
|
/**
|
|
52
|
-
* Prepares the current form instance state
|
|
53
|
+
* Prepares the current form instance state as an {@link InstancePayload}.
|
|
53
54
|
*
|
|
54
|
-
* A
|
|
55
|
-
*
|
|
56
|
-
* two purposes:
|
|
55
|
+
* A payload will be prepared even if the current form state includes
|
|
56
|
+
* `constraint` or `required` violations. This supports serveral purposes:
|
|
57
57
|
*
|
|
58
|
-
* - A client may effectively use this method as a part of its
|
|
59
|
-
*
|
|
58
|
+
* - A client may effectively use this method as a part of its "submit"
|
|
59
|
+
* workflow, and use any violations included in the {@link InstancePayload}
|
|
60
60
|
* to prompt users to address those violations.
|
|
61
61
|
*
|
|
62
|
-
* - A client may inspect the
|
|
62
|
+
* - A client may inspect the serialized instance state of a form at any time.
|
|
63
63
|
* Depending on the client and use case, this may be a convenience (e.g. for
|
|
64
64
|
* developers to inspect that form state at a current point in time); or it
|
|
65
65
|
* may provide necessary functionality (e.g. for test or tooling clients).
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* - A client may capture _incomplete_ instance state (e.g. for storage in
|
|
68
|
+
* client-side storage or similar persistance layer), to resume filling the
|
|
69
|
+
* instance at a later time.
|
|
70
|
+
*
|
|
71
|
+
* Note on asynchrony: preparing a {@link InstancePayload} is expected to be a
|
|
72
|
+
* fast operation. It may even be nearly instantaneous, or roughly
|
|
69
73
|
* proportionate to the size of the form itself. However, this method is
|
|
70
74
|
* designed to be asynchronous out of an abundance of caution, anticipating
|
|
71
75
|
* that some as-yet undeveloped operations on binary data (e.g. form
|
|
72
76
|
* attachments) may themselves impose asynchrony (i.e. by interfaces provided
|
|
73
77
|
* by the platform and/or external dependencies).
|
|
74
78
|
*
|
|
75
|
-
* A client may specify {@link
|
|
76
|
-
* {@link
|
|
79
|
+
* A client may specify {@link InstancePayloadOptions<'chunked'>}, in which
|
|
80
|
+
* case a {@link ChunkedInstancePayload} will be produced, with form
|
|
81
|
+
* attachments
|
|
77
82
|
*/
|
|
78
|
-
|
|
83
|
+
prepareInstancePayload(): Promise<MonolithicInstancePayload>;
|
|
84
|
+
prepareInstancePayload(options: InstancePayloadOptions<'monolithic'>): Promise<MonolithicInstancePayload>;
|
|
85
|
+
prepareInstancePayload(options: InstancePayloadOptions<'chunked'>): Promise<ChunkedInstancePayload>;
|
|
79
86
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnySelectControlDefinition, SelectType } from '../parse/body/control/SelectControlDefinition.ts';
|
|
2
2
|
import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
4
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
5
|
import { RootNode } from './RootNode.ts';
|
|
6
6
|
import { TextRange } from './TextRange.ts';
|
|
7
|
+
import { ValueType } from './ValueType.ts';
|
|
7
8
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
8
9
|
import { LeafNodeValidationState } from './validation.ts';
|
|
9
10
|
export interface SelectItem {
|
|
11
|
+
get label(): TextRange<'item-label'>;
|
|
10
12
|
get value(): string;
|
|
11
|
-
get label(): TextRange<'item-label'> | null;
|
|
12
13
|
}
|
|
13
|
-
export
|
|
14
|
+
export type SelectValueOptions = readonly SelectItem[];
|
|
15
|
+
export interface SelectNodeState extends BaseValueNodeState<readonly string[]> {
|
|
14
16
|
get children(): null;
|
|
15
|
-
/**
|
|
16
|
-
* @todo should {@link BaseNodeState} include this??
|
|
17
|
-
*/
|
|
18
17
|
get valueOptions(): readonly SelectItem[];
|
|
19
18
|
/**
|
|
20
19
|
* This value is treated as set-like by the engine, where each
|
|
@@ -28,38 +27,61 @@ export interface SelectNodeState extends BaseNodeState {
|
|
|
28
27
|
* Should a `SelectNodeState` have this `value` type, whereas a hypothetical
|
|
29
28
|
* `Select1NodeState` would have `get value(): SelectItem | null`?
|
|
30
29
|
*/
|
|
31
|
-
get value(): readonly
|
|
30
|
+
get value(): readonly string[];
|
|
32
31
|
}
|
|
33
|
-
export interface SelectDefinition extends LeafNodeDefinition {
|
|
34
|
-
readonly bodyElement:
|
|
32
|
+
export interface SelectDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
33
|
+
readonly bodyElement: AnySelectControlDefinition;
|
|
35
34
|
}
|
|
36
35
|
export type SelectNodeAppearances = NodeAppearances<SelectDefinition>;
|
|
37
|
-
export interface SelectNode extends
|
|
36
|
+
export interface SelectNode extends BaseValueNode<'string', readonly string[]> {
|
|
38
37
|
readonly nodeType: 'select';
|
|
38
|
+
readonly valueType: 'string';
|
|
39
|
+
readonly selectType: SelectType;
|
|
39
40
|
readonly appearances: SelectNodeAppearances;
|
|
40
|
-
readonly
|
|
41
|
+
readonly nodeOptions: null;
|
|
42
|
+
readonly definition: SelectDefinition<'string'>;
|
|
41
43
|
readonly root: RootNode;
|
|
42
44
|
readonly parent: GeneralParentNode;
|
|
43
45
|
readonly currentState: SelectNodeState;
|
|
44
46
|
readonly validationState: LeafNodeValidationState;
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
48
|
+
* Convenience API to get the {@link SelectItem} which is associated with
|
|
49
|
+
* {@link value}, if one is currently available—i.e. if it is present in
|
|
50
|
+
* {@link SelectNodeState.valueOptions}.
|
|
51
|
+
*/
|
|
52
|
+
getValueOption(value: string): SelectItem | null;
|
|
53
|
+
/**
|
|
54
|
+
* Convenience API to determine if {@link value} is currently selected—i.e. if
|
|
55
|
+
* it is one of the selected values in {@link SelectNodeState.value}.
|
|
56
|
+
*/
|
|
57
|
+
isSelected(value: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Selects a single {@link value}, as provided by a {@link SelectItem.value}.
|
|
60
|
+
* Calling this setter replaces the currently selected value(s, if any),
|
|
61
|
+
* where:
|
|
47
62
|
*
|
|
48
|
-
* -
|
|
49
|
-
*
|
|
50
|
-
* {@link SelectNodeState.value}.
|
|
51
|
-
* - For fields defined with an XForms `<select1>`, calling this method will
|
|
52
|
-
* replace the selection (if any).
|
|
63
|
+
* - if the provided value is `null`, the current selection is cleared; ELSE
|
|
64
|
+
* - the provided value is selected in place of any currently selected values.
|
|
53
65
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
66
|
+
* This setter is most useful for {@link SelectNode}s associated with an
|
|
67
|
+
* XForms
|
|
68
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | `<select1>`}
|
|
69
|
+
* control.
|
|
56
70
|
*/
|
|
57
|
-
|
|
71
|
+
selectValue(value: string | null): RootNode;
|
|
58
72
|
/**
|
|
59
|
-
*
|
|
60
|
-
* {@link
|
|
73
|
+
* Selects any number of {@link values}, as provided by any number of
|
|
74
|
+
* {@link SelectItem.value}s. Calling this setter replaces the currently
|
|
75
|
+
* selected value(s, if any). If called with an empty array, the current
|
|
76
|
+
* selection is cleared.
|
|
77
|
+
*
|
|
78
|
+
* This setter is most useful for {@link SelectNode}s associated with an
|
|
79
|
+
* XForms
|
|
80
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | `<select>`}
|
|
81
|
+
* control.
|
|
61
82
|
*
|
|
62
|
-
*
|
|
83
|
+
* This setter _may_ be used with a `<select1>` control, in which case the
|
|
84
|
+
* provided {@link values} should produce at most one value.
|
|
63
85
|
*/
|
|
64
|
-
|
|
86
|
+
selectValues(values: readonly string[]): RootNode;
|
|
65
87
|
}
|
|
@@ -47,6 +47,7 @@ export interface SubtreeDefinition extends BaseSubtreeDefinition {
|
|
|
47
47
|
export interface SubtreeNode extends BaseNode {
|
|
48
48
|
readonly nodeType: 'subtree';
|
|
49
49
|
readonly appearances: null;
|
|
50
|
+
readonly nodeOptions: null;
|
|
50
51
|
readonly definition: SubtreeDefinition;
|
|
51
52
|
readonly root: RootNode;
|
|
52
53
|
readonly parent: GeneralParentNode;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
+
import { TriggerRuntimeValue, TriggerValueType } from '../lib/codecs/TriggerCodec.ts';
|
|
1
2
|
import { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
2
3
|
import { TriggerControlDefinition } from '../parse/body/control/TriggerControlDefinition.ts';
|
|
3
4
|
import { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
4
|
-
import {
|
|
5
|
+
import { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
5
6
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
6
7
|
import { RootNode } from './RootNode.ts';
|
|
7
8
|
import { LeafNodeValidationState } from './validation.ts';
|
|
8
|
-
|
|
9
|
+
import { ValueType } from './ValueType.ts';
|
|
10
|
+
export type TriggerValue = TriggerRuntimeValue;
|
|
11
|
+
export interface TriggerNodeState extends BaseValueNodeState<TriggerValue> {
|
|
9
12
|
get children(): null;
|
|
10
13
|
get valueOptions(): null;
|
|
11
|
-
get value():
|
|
14
|
+
get value(): TriggerValue;
|
|
12
15
|
}
|
|
13
|
-
export interface TriggerNodeDefinition extends LeafNodeDefinition {
|
|
16
|
+
export interface TriggerNodeDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
14
17
|
readonly bodyElement: TriggerControlDefinition;
|
|
15
18
|
}
|
|
16
|
-
export interface TriggerNode extends
|
|
19
|
+
export interface TriggerNode extends BaseValueNode<TriggerValueType, TriggerValue> {
|
|
17
20
|
readonly nodeType: 'trigger';
|
|
18
|
-
readonly definition: TriggerNodeDefinition
|
|
21
|
+
readonly definition: TriggerNodeDefinition<TriggerValueType>;
|
|
19
22
|
readonly appearances: UnknownAppearanceDefinition;
|
|
23
|
+
readonly nodeOptions: null;
|
|
20
24
|
readonly root: RootNode;
|
|
21
25
|
readonly parent: GeneralParentNode;
|
|
22
26
|
readonly currentState: TriggerNodeState;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { ValidationTextRole } from './TextRange.ts';
|
|
2
2
|
export declare const MISSING_RESOURCE_BEHAVIOR: {
|
|
3
3
|
/**
|
|
4
|
-
* When this behavior is configured, {@link
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* When this behavior is configured, {@link LoadForm | loading a form} which
|
|
5
|
+
* references any **missing** resources will fail, producing an error to the
|
|
6
|
+
* calling client.
|
|
7
7
|
*
|
|
8
8
|
* @see {@link MissingResourceBehavior}
|
|
9
9
|
*/
|
|
10
10
|
readonly ERROR: "ERROR";
|
|
11
11
|
/**
|
|
12
|
-
* When this behavior is configured, {@link
|
|
13
|
-
*
|
|
14
|
-
* resources will succeed (producing a warning).
|
|
12
|
+
* When this behavior is configured, {@link LoadForm | loading a form} which
|
|
13
|
+
* references any **missing** resources will succeed (producing a warning).
|
|
15
14
|
*
|
|
16
15
|
* Such missing resources will be parsed as if they are blank, as appropriate
|
|
17
16
|
* for the resource's XForm semantic usage and/or format.
|
|
@@ -28,8 +27,8 @@ export type MissingResourceBehaviorError = typeof MISSING_RESOURCE_BEHAVIOR.ERRO
|
|
|
28
27
|
export type MissingResourceBehaviorBlank = typeof MISSING_RESOURCE_BEHAVIOR.BLANK;
|
|
29
28
|
export type MissingResourceBehaviorDefault = typeof MISSING_RESOURCE_BEHAVIOR.DEFAULT;
|
|
30
29
|
/**
|
|
31
|
-
* Specifies behavior for {@link
|
|
32
|
-
*
|
|
30
|
+
* Specifies behavior for {@link LoadForm | loading a form} which references any
|
|
31
|
+
* **missing** resources.
|
|
33
32
|
*
|
|
34
33
|
* Here the term "missing" is consistent with
|
|
35
34
|
* {@link https://www.rfc-editor.org/rfc/rfc9110#status.404 | HTTP 404 status}
|
|
@@ -51,8 +50,8 @@ export declare const VALIDATION_TEXT: {
|
|
|
51
50
|
};
|
|
52
51
|
type ValidationTextDefaults = typeof VALIDATION_TEXT;
|
|
53
52
|
export type ValidationTextDefault<Role extends ValidationTextRole> = ValidationTextDefaults[Role];
|
|
54
|
-
export declare const
|
|
55
|
-
export type
|
|
56
|
-
export declare const
|
|
57
|
-
export type
|
|
53
|
+
export declare const INSTANCE_FILE_NAME = "xml_submission_file";
|
|
54
|
+
export type INSTANCE_FILE_NAME = typeof INSTANCE_FILE_NAME;
|
|
55
|
+
export declare const INSTANCE_FILE_TYPE = "text/xml";
|
|
56
|
+
export type INSTANCE_FILE_TYPE = typeof INSTANCE_FILE_TYPE;
|
|
58
57
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormInstance, FormInstanceCreateMode } from './FormInstance.ts';
|
|
2
|
+
import { FormInstanceConfig } from './FormInstanceConfig.ts';
|
|
3
|
+
export type CreatedFormInstance = FormInstance<FormInstanceCreateMode>;
|
|
4
|
+
/**
|
|
5
|
+
* @todo This is fallible! Client-facing interfaces will need to account for
|
|
6
|
+
* this. We've begun addressing fallibility _at the interface level_ in
|
|
7
|
+
* {@link LoadForm} (with {@link LoadFormResult}). We'll eventually have a more
|
|
8
|
+
* general interface pattern for this, and we'll apply it here as well. The baby
|
|
9
|
+
* step approach in {@link LoadFormResult} is impractical here due to
|
|
10
|
+
* engine-internal designs, and revising that is currently out of scope. As
|
|
11
|
+
* such, explicit interface-level documentation of fallibility is deferred here,
|
|
12
|
+
* on {@link RootNode} itself, and into any of its sub-interfaces.
|
|
13
|
+
*/
|
|
14
|
+
export type CreateFormInstance = (config?: FormInstanceConfig) => CreatedFormInstance;
|