@getodk/xforms-engine 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/BaseNode.d.ts +15 -5
- package/dist/client/BaseValueNode.d.ts +32 -0
- package/dist/client/EngineConfig.d.ts +49 -49
- package/dist/client/GroupNode.d.ts +2 -3
- package/dist/client/InputNode.d.ts +53 -0
- package/dist/client/ModelValueNode.d.ts +13 -9
- package/dist/client/NodeAppearances.d.ts +1 -2
- package/dist/client/NoteNode.d.ts +3 -4
- package/dist/client/RootNode.d.ts +36 -10
- package/dist/client/SelectNode.d.ts +4 -5
- package/dist/client/SubtreeNode.d.ts +1 -2
- package/dist/client/TextRange.d.ts +3 -4
- package/dist/client/TriggerNode.d.ts +25 -0
- package/dist/client/ValueType.d.ts +3 -0
- package/dist/client/constants.d.ts +50 -1
- package/dist/client/hierarchy.d.ts +9 -5
- package/dist/client/identity.d.ts +14 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client/node-types.d.ts +3 -1
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +1 -2
- package/dist/client/repeat/RepeatInstanceNode.d.ts +2 -3
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +1 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +1 -2
- package/dist/client/resources.d.ts +93 -0
- package/dist/client/submission/SubmissionData.d.ts +7 -0
- package/dist/client/submission/SubmissionDefinition.d.ts +14 -0
- package/dist/client/submission/SubmissionInstanceFile.d.ts +6 -0
- package/dist/client/submission/SubmissionOptions.d.ts +23 -0
- package/dist/client/submission/SubmissionResult.d.ts +91 -0
- package/dist/client/submission/SubmissionState.d.ts +12 -0
- package/dist/client/unsupported/RangeNode.d.ts +9 -0
- package/dist/client/unsupported/RankNode.d.ts +9 -0
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +32 -0
- package/dist/client/unsupported/UploadNode.d.ts +9 -0
- package/dist/client/validation.d.ts +2 -3
- package/dist/error/ErrorProductionDesignPendingError.d.ts +7 -0
- package/dist/error/ValueTypeInvariantError.d.ts +17 -0
- package/dist/error/XPathFunctionalityError.d.ts +14 -0
- package/dist/error/XPathFunctionalityNotSupportedError.d.ts +7 -0
- package/dist/error/XPathFunctionalityPendingError.d.ts +7 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.js +8559 -4700
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +9 -5
- package/dist/instance/InputControl.d.ts +36 -0
- package/dist/instance/ModelValue.d.ts +16 -27
- package/dist/instance/Note.d.ts +11 -5
- package/dist/instance/PrimaryInstance.d.ts +84 -0
- package/dist/instance/Root.d.ts +31 -28
- package/dist/instance/SelectField.d.ts +13 -6
- package/dist/instance/Subtree.d.ts +10 -6
- package/dist/instance/TriggerControl.d.ts +47 -0
- package/dist/instance/abstract/DescendantNode.d.ts +33 -26
- package/dist/instance/abstract/InstanceNode.d.ts +50 -31
- package/dist/instance/abstract/UnsupportedControl.d.ts +53 -0
- package/dist/instance/abstract/ValueNode.d.ts +48 -0
- package/dist/instance/children.d.ts +0 -1
- package/dist/instance/hierarchy.d.ts +13 -8
- package/dist/instance/identity.d.ts +2 -7
- package/dist/instance/index.d.ts +0 -1
- package/dist/instance/internal-api/EvaluationContext.d.ts +53 -13
- package/dist/instance/internal-api/InstanceConfig.d.ts +8 -3
- package/dist/instance/internal-api/InstanceValueContext.d.ts +20 -0
- package/dist/instance/internal-api/PrimaryInstanceDocument.d.ts +36 -0
- package/dist/instance/internal-api/TranslationContext.d.ts +3 -3
- package/dist/instance/internal-api/ValidationContext.d.ts +12 -6
- package/dist/instance/internal-api/ValueContext.d.ts +5 -5
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +14 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +31 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +17 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +40 -85
- package/dist/instance/repeat/RepeatInstance.d.ts +11 -30
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +3 -4
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +3 -4
- package/dist/instance/resource.d.ts +1 -2
- package/dist/instance/text/TextChunk.d.ts +0 -1
- package/dist/instance/text/TextRange.d.ts +1 -2
- package/dist/instance/unsupported/RangeControl.d.ts +6 -0
- package/dist/instance/unsupported/RankControl.d.ts +6 -0
- package/dist/instance/unsupported/UploadControl.d.ts +6 -0
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +14 -0
- package/dist/integration/xpath/adapter/XFormsXPathNode.d.ts +71 -0
- package/dist/integration/xpath/adapter/engineDOMAdapter.d.ts +5 -0
- package/dist/integration/xpath/adapter/kind.d.ts +32 -0
- package/dist/integration/xpath/adapter/names.d.ts +16 -0
- package/dist/integration/xpath/adapter/traversal.d.ts +25 -0
- package/dist/integration/xpath/adapter/values.d.ts +2 -0
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +19 -0
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +16 -0
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +40 -0
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +17 -0
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +33 -0
- package/dist/integration/xpath/static-dom/StaticText.d.ts +16 -0
- package/dist/lib/TokenListParser.d.ts +3 -3
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +4 -0
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +4 -0
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +8 -0
- package/dist/lib/codecs/DecimalValueCodec.d.ts +6 -0
- package/dist/lib/codecs/IntValueCodec.d.ts +6 -0
- package/dist/lib/codecs/StringValueCodec.d.ts +4 -0
- package/dist/lib/codecs/ValueCodec.d.ts +30 -0
- package/dist/lib/codecs/ValueTypePlaceholderCodec.d.ts +12 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +47 -0
- package/dist/lib/dom/query.d.ts +4 -2
- package/dist/lib/reactivity/createChildrenState.d.ts +7 -6
- package/dist/lib/reactivity/createComputedExpression.d.ts +19 -7
- package/dist/lib/reactivity/createInstanceValueState.d.ts +40 -0
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +2 -3
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -1
- package/dist/lib/reactivity/createTranslationState.d.ts +19 -0
- package/dist/lib/reactivity/createValueState.d.ts +6 -11
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +4 -5
- package/dist/lib/reactivity/node-state/createClientState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createCurrentState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createEngineState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/representations.d.ts +0 -1
- package/dist/lib/reactivity/scope.d.ts +0 -1
- package/dist/lib/reactivity/text/createFieldHint.d.ts +1 -2
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +1 -2
- package/dist/lib/reactivity/text/createNoteText.d.ts +1 -2
- package/dist/lib/reactivity/text/createTextRange.d.ts +0 -1
- package/dist/lib/reactivity/types.d.ts +0 -1
- package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +0 -1
- package/dist/lib/reactivity/validation/createValidation.d.ts +0 -1
- package/dist/lib/xml-serialization.d.ts +41 -0
- package/dist/parse/XFormDOM.d.ts +42 -0
- package/dist/{XFormDefinition.d.ts → parse/XFormDefinition.d.ts} +3 -5
- package/dist/parse/attachments/FormAttachmentResource.d.ts +27 -0
- package/dist/{body → parse/body}/BodyDefinition.d.ts +16 -11
- package/dist/{body → parse/body}/BodyElementDefinition.d.ts +7 -7
- package/dist/{body → parse/body}/RepeatElementDefinition.d.ts +3 -4
- package/dist/{body → parse/body}/UnsupportedBodyElementDefinition.d.ts +0 -1
- package/dist/parse/body/appearance/inputAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/appearance/selectAppearanceParser.d.ts +1 -2
- package/dist/{body → parse/body}/appearance/structureElementAppearanceParser.d.ts +1 -2
- package/dist/parse/body/appearance/unknownAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/control/ControlDefinition.d.ts +3 -4
- package/dist/{body/control/InputDefinition.d.ts → parse/body/control/InputControlDefinition.d.ts} +2 -3
- package/dist/parse/body/control/RangeControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/RankControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/TriggerControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/UploadControlDefinition.d.ts +11 -0
- package/dist/{body → parse/body}/control/select/ItemDefinition.d.ts +2 -3
- package/dist/{body → parse/body}/control/select/ItemsetDefinition.d.ts +4 -5
- package/dist/{body → parse/body}/control/select/ItemsetNodesetContext.d.ts +1 -4
- package/dist/{body → parse/body}/control/select/SelectDefinition.d.ts +3 -12
- package/dist/{body → parse/body}/group/BaseGroupDefinition.d.ts +3 -5
- package/dist/{body → parse/body}/group/LogicalGroupDefinition.d.ts +0 -1
- package/dist/{body → parse/body}/group/PresentationGroupDefinition.d.ts +1 -2
- package/dist/{body → parse/body}/group/StructuralGroupDefinition.d.ts +0 -1
- package/dist/{model/BindComputation.d.ts → parse/expression/BindComputationExpression.d.ts} +5 -6
- package/dist/{body/control/select → parse/expression}/ItemsetNodesetExpression.d.ts +2 -3
- package/dist/{body/control/select → parse/expression}/ItemsetValueExpression.d.ts +2 -3
- package/dist/parse/expression/RepeatCountControlExpression.d.ts +2 -3
- package/dist/parse/expression/TextLiteralExpression.d.ts +9 -0
- package/dist/parse/expression/TextOutputExpression.d.ts +7 -0
- package/dist/parse/expression/TextReferenceExpression.d.ts +7 -0
- package/dist/parse/expression/TextTranslationExpression.d.ts +8 -0
- package/dist/parse/expression/abstract/DependencyContext.d.ts +7 -0
- package/dist/{expression → parse/expression/abstract}/DependentExpression.d.ts +4 -6
- package/dist/parse/expression/abstract/TextChunkExpression.d.ts +17 -0
- package/dist/parse/model/BindDefinition.d.ts +38 -0
- package/dist/parse/model/BindTypeDefinition.d.ts +20 -0
- package/dist/{model → parse/model}/DescendentNodeDefinition.d.ts +0 -2
- package/dist/parse/model/FormSubmissionDefinition.d.ts +8 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +4 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +8 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +8 -0
- package/dist/{model → parse/model}/LeafNodeDefinition.d.ts +4 -3
- package/dist/{model → parse/model}/ModelBindMap.d.ts +1 -2
- package/dist/{model → parse/model}/ModelDefinition.d.ts +3 -2
- package/dist/{model → parse/model}/NodeDefinition.d.ts +0 -2
- package/dist/parse/{NoteNodeDefinition.d.ts → model/NoteNodeDefinition.d.ts} +12 -13
- package/dist/{model → parse/model}/RepeatInstanceDefinition.d.ts +1 -2
- package/dist/{model → parse/model}/RepeatRangeDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RepeatTemplateDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RootDefinition.d.ts +5 -5
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +4 -0
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +7 -0
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +13 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +14 -0
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +22 -0
- package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.d.ts +23 -0
- package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.d.ts +9 -0
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +7 -0
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +13 -0
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +12 -0
- package/dist/{model → parse/model}/SubtreeDefinition.d.ts +1 -2
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +24 -0
- package/dist/parse/text/HintDefinition.d.ts +2 -3
- package/dist/parse/text/ItemLabelDefinition.d.ts +2 -3
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +3 -4
- package/dist/parse/text/LabelDefinition.d.ts +5 -6
- package/dist/parse/text/MessageDefinition.d.ts +4 -5
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +8 -9
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +4 -7
- package/dist/parse/xpath/path-resolution.d.ts +0 -1
- package/dist/parse/xpath/predicate-analysis.d.ts +0 -1
- package/dist/parse/xpath/reference-parsing.d.ts +0 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +5 -1
- package/dist/parse/xpath/syntax-traversal.d.ts +0 -1
- package/dist/solid.js +8398 -4543
- package/dist/solid.js.map +1 -1
- package/package.json +14 -12
- package/src/client/BaseNode.ts +17 -7
- package/src/client/BaseValueNode.ts +35 -0
- package/src/client/EngineConfig.ts +52 -51
- package/src/client/GroupNode.ts +2 -2
- package/src/client/InputNode.ts +77 -0
- package/src/client/ModelValueNode.ts +31 -8
- package/src/client/NodeAppearances.ts +1 -1
- package/src/client/NoteNode.ts +3 -3
- package/src/client/RootNode.ts +39 -9
- package/src/client/SelectNode.ts +5 -5
- package/src/client/SubtreeNode.ts +1 -1
- package/src/client/TextRange.ts +4 -5
- package/src/client/TriggerNode.ts +29 -0
- package/src/client/ValueType.ts +4 -0
- package/src/client/constants.ts +67 -0
- package/src/client/hierarchy.ts +16 -4
- package/src/client/identity.ts +16 -0
- package/src/client/node-types.ts +19 -5
- package/src/client/repeat/BaseRepeatRangeNode.ts +1 -1
- package/src/client/repeat/RepeatInstanceNode.ts +2 -2
- package/src/client/repeat/RepeatRangeControlledNode.ts +1 -1
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +1 -1
- package/src/client/resources.ts +118 -0
- package/src/client/submission/SubmissionData.ts +12 -0
- package/src/client/submission/SubmissionDefinition.ts +16 -0
- package/src/client/submission/SubmissionInstanceFile.ts +9 -0
- package/src/client/submission/SubmissionOptions.ts +28 -0
- package/src/client/submission/SubmissionResult.ts +124 -0
- package/src/client/submission/SubmissionState.ts +14 -0
- package/src/client/unsupported/RangeNode.ts +14 -0
- package/src/client/unsupported/RankNode.ts +14 -0
- package/src/client/unsupported/UnsupportedControlNode.ts +40 -0
- package/src/client/unsupported/UploadNode.ts +14 -0
- package/src/client/validation.ts +2 -2
- package/src/error/ErrorProductionDesignPendingError.ts +6 -0
- package/src/error/ValueTypeInvariantError.ts +22 -0
- package/src/error/XPathFunctionalityError.ts +26 -0
- package/src/error/XPathFunctionalityNotSupportedError.ts +18 -0
- package/src/error/XPathFunctionalityPendingError.ts +18 -0
- package/src/index.ts +16 -2
- package/src/instance/Group.ts +17 -5
- package/src/instance/InputControl.ts +119 -0
- package/src/instance/ModelValue.ts +47 -54
- package/src/instance/Note.ts +26 -10
- package/src/instance/PrimaryInstance.ts +244 -0
- package/src/instance/Root.ts +64 -132
- package/src/instance/SelectField.ts +62 -25
- package/src/instance/Subtree.ts +19 -7
- package/src/instance/{StringField.ts → TriggerControl.ts} +61 -30
- package/src/instance/abstract/DescendantNode.ts +92 -47
- package/src/instance/abstract/InstanceNode.ts +104 -98
- package/src/instance/abstract/UnsupportedControl.ts +174 -0
- package/src/instance/abstract/ValueNode.ts +127 -0
- package/src/instance/children.ts +83 -14
- package/src/instance/hierarchy.ts +36 -14
- package/src/instance/identity.ts +3 -9
- package/src/instance/index.ts +26 -8
- package/src/instance/internal-api/EvaluationContext.ts +61 -14
- package/src/instance/internal-api/InstanceConfig.ts +9 -2
- package/src/instance/internal-api/InstanceValueContext.ts +24 -0
- package/src/instance/internal-api/PrimaryInstanceDocument.ts +53 -0
- package/src/instance/internal-api/TranslationContext.ts +3 -2
- package/src/instance/internal-api/ValidationContext.ts +13 -5
- package/src/instance/internal-api/ValueContext.ts +5 -4
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +20 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +42 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +25 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +23 -0
- package/src/instance/repeat/BaseRepeatRange.ts +51 -132
- package/src/instance/repeat/RepeatInstance.ts +20 -46
- package/src/instance/repeat/RepeatRangeControlled.ts +6 -6
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +3 -5
- package/src/instance/resource.ts +1 -1
- package/src/instance/text/TextChunk.ts +1 -1
- package/src/instance/unsupported/RangeControl.ts +9 -0
- package/src/instance/unsupported/RankControl.ts +9 -0
- package/src/instance/unsupported/UploadControl.ts +9 -0
- package/src/integration/xpath/EngineXPathEvaluator.ts +22 -0
- package/src/integration/xpath/adapter/XFormsXPathNode.ts +126 -0
- package/src/integration/xpath/adapter/engineDOMAdapter.ts +57 -0
- package/src/integration/xpath/adapter/kind.ts +114 -0
- package/src/integration/xpath/adapter/names.ts +99 -0
- package/src/integration/xpath/adapter/traversal.ts +228 -0
- package/src/integration/xpath/adapter/values.ts +5 -0
- package/src/integration/xpath/static-dom/StaticAttribute.ts +33 -0
- package/src/integration/xpath/static-dom/StaticDocument.ts +38 -0
- package/src/integration/xpath/static-dom/StaticElement.ts +106 -0
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +45 -0
- package/src/integration/xpath/static-dom/StaticNode.ts +68 -0
- package/src/integration/xpath/static-dom/StaticText.ts +28 -0
- package/src/lib/TokenListParser.ts +11 -7
- package/src/lib/client-reactivity/README.md +0 -0
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +12 -0
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +20 -0
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +17 -0
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +22 -0
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +21 -0
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +172 -0
- package/src/lib/codecs/DecimalValueCodec.ts +46 -0
- package/src/lib/codecs/IntValueCodec.ts +100 -0
- package/src/lib/codecs/StringValueCodec.ts +11 -0
- package/src/lib/codecs/ValueCodec.ts +106 -0
- package/src/lib/codecs/ValueTypePlaceholderCodec.ts +19 -0
- package/src/lib/codecs/getSharedValueCodec.ts +77 -0
- package/src/lib/dom/query.ts +8 -1
- package/src/lib/reactivity/createChildrenState.ts +8 -6
- package/src/lib/reactivity/createComputedExpression.ts +59 -36
- package/src/lib/reactivity/createInstanceValueState.ts +166 -0
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +12 -7
- package/src/lib/reactivity/createSelectItems.ts +23 -23
- package/src/lib/reactivity/createTranslationState.ts +61 -0
- package/src/lib/reactivity/createValueState.ts +64 -122
- package/src/lib/reactivity/materializeCurrentStateChildren.ts +7 -7
- package/src/lib/reactivity/node-state/createSpecifiedState.ts +1 -1
- package/src/lib/reactivity/text/createFieldHint.ts +1 -1
- package/src/lib/reactivity/text/createNodeLabel.ts +1 -1
- package/src/lib/reactivity/text/createNoteText.ts +1 -1
- package/src/lib/reactivity/text/createTextRange.ts +8 -7
- package/src/lib/reactivity/validation/createAggregatedViolations.ts +9 -4
- package/src/lib/reactivity/validation/createValidation.ts +2 -3
- package/src/lib/xml-serialization.ts +96 -0
- package/src/{XFormDOM.ts → parse/XFormDOM.ts} +110 -75
- package/src/{XFormDefinition.ts → parse/XFormDefinition.ts} +3 -8
- package/src/parse/attachments/FormAttachmentResource.ts +40 -0
- package/src/{body → parse/body}/BodyDefinition.ts +46 -29
- package/src/{body → parse/body}/BodyElementDefinition.ts +12 -6
- package/src/{body → parse/body}/RepeatElementDefinition.ts +7 -5
- package/src/{body → parse/body}/appearance/inputAppearanceParser.ts +2 -2
- package/src/{body → parse/body}/appearance/selectAppearanceParser.ts +1 -1
- package/src/{body → parse/body}/appearance/structureElementAppearanceParser.ts +1 -1
- package/src/parse/body/appearance/unknownAppearanceParser.ts +5 -0
- package/src/{body → parse/body}/control/ControlDefinition.ts +4 -4
- package/src/{body/control/InputDefinition.ts → parse/body/control/InputControlDefinition.ts} +3 -5
- package/src/parse/body/control/RangeControlDefinition.ts +26 -0
- package/src/parse/body/control/RankControlDefinition.ts +27 -0
- package/src/parse/body/control/TriggerControlDefinition.ts +26 -0
- package/src/parse/body/control/UploadControlDefinition.ts +26 -0
- package/src/{body → parse/body}/control/select/ItemDefinition.ts +2 -2
- package/src/{body → parse/body}/control/select/ItemsetDefinition.ts +5 -5
- package/src/{body → parse/body}/control/select/ItemsetNodesetContext.ts +1 -6
- package/src/{body → parse/body}/control/select/SelectDefinition.ts +3 -11
- package/src/{body → parse/body}/group/BaseGroupDefinition.ts +11 -22
- package/src/{body → parse/body}/group/PresentationGroupDefinition.ts +1 -1
- package/src/{model/BindComputation.ts → parse/expression/BindComputationExpression.ts} +8 -8
- package/src/{body/control/select → parse/expression}/ItemsetNodesetExpression.ts +2 -2
- package/src/{body/control/select → parse/expression}/ItemsetValueExpression.ts +2 -2
- package/src/parse/expression/RepeatCountControlExpression.ts +2 -2
- package/src/parse/expression/TextLiteralExpression.ts +19 -0
- package/src/parse/{text/OutputChunkDefinition.ts → expression/TextOutputExpression.ts} +4 -4
- package/src/parse/{text/ReferenceChunkDefinition.ts → expression/TextReferenceExpression.ts} +4 -4
- package/src/parse/{text/TranslationChunkDefinition.ts → expression/TextTranslationExpression.ts} +4 -4
- package/src/{expression → parse/expression/abstract}/DependencyContext.ts +0 -26
- package/src/{expression → parse/expression/abstract}/DependentExpression.ts +5 -16
- package/src/parse/expression/abstract/TextChunkExpression.ts +38 -0
- package/src/parse/model/BindDefinition.ts +104 -0
- package/src/parse/model/BindTypeDefinition.ts +175 -0
- package/src/{model → parse/model}/DescendentNodeDefinition.ts +0 -6
- package/src/parse/model/FormSubmissionDefinition.ts +44 -0
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +4 -0
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +41 -0
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +31 -0
- package/src/{model → parse/model}/LeafNodeDefinition.ts +4 -1
- package/src/{model → parse/model}/ModelBindMap.ts +6 -8
- package/src/parse/model/ModelDefinition.ts +24 -0
- package/src/{model → parse/model}/NodeDefinition.ts +0 -3
- package/src/parse/{NoteNodeDefinition.ts → model/NoteNodeDefinition.ts} +12 -12
- package/src/{model → parse/model}/RepeatRangeDefinition.ts +1 -1
- package/src/{model → parse/model}/RootDefinition.ts +4 -3
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +4 -0
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +12 -0
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +102 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +40 -0
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +288 -0
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.ts +222 -0
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.ts +22 -0
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +414 -0
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +19 -0
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +29 -0
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +32 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +149 -0
- package/src/parse/text/HintDefinition.ts +2 -2
- package/src/parse/text/ItemLabelDefinition.ts +2 -2
- package/src/parse/text/ItemsetLabelDefinition.ts +7 -7
- package/src/parse/text/LabelDefinition.ts +5 -5
- package/src/parse/text/MessageDefinition.ts +7 -7
- package/src/parse/text/abstract/TextElementDefinition.ts +14 -14
- package/src/parse/text/abstract/TextRangeDefinition.ts +4 -10
- package/src/parse/xpath/semantic-analysis.ts +29 -0
- package/dist/XFormDOM.d.ts +0 -32
- package/dist/XFormDataType.d.ts +0 -27
- package/dist/body/appearance/inputAppearanceParser.d.ts +0 -4
- package/dist/client/StringNode.d.ts +0 -47
- package/dist/expression/DependencyContext.d.ts +0 -13
- package/dist/instance/StringField.d.ts +0 -45
- package/dist/instance/internal-api/SubscribableDependency.d.ts +0 -60
- package/dist/model/BindDefinition.d.ts +0 -34
- package/dist/parse/text/OutputChunkDefinition.d.ts +0 -8
- package/dist/parse/text/ReferenceChunkDefinition.d.ts +0 -8
- package/dist/parse/text/StaticTextChunkDefinition.d.ts +0 -10
- package/dist/parse/text/TranslationChunkDefinition.d.ts +0 -9
- package/dist/parse/text/abstract/TextChunkDefinition.d.ts +0 -18
- package/src/XFormDataType.ts +0 -64
- package/src/client/StringNode.ts +0 -52
- package/src/instance/internal-api/SubscribableDependency.ts +0 -61
- package/src/model/BindDefinition.ts +0 -106
- package/src/model/ModelDefinition.ts +0 -19
- package/src/parse/TODO.md +0 -3
- package/src/parse/text/StaticTextChunkDefinition.ts +0 -19
- package/src/parse/text/abstract/TextChunkDefinition.ts +0 -38
- /package/dist/{model → parse/model}/BindElement.d.ts +0 -0
- /package/src/{body → parse/body}/UnsupportedBodyElementDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/LogicalGroupDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/StructuralGroupDefinition.ts +0 -0
- /package/src/{model → parse/model}/BindElement.ts +0 -0
- /package/src/{model → parse/model}/RepeatInstanceDefinition.ts +0 -0
- /package/src/{model → parse/model}/RepeatTemplateDefinition.ts +0 -0
- /package/src/{model → parse/model}/SubtreeDefinition.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
|
|
1
|
+
import { AnyRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
2
2
|
import { BaseNode, BaseNodeState } from '../BaseNode.ts';
|
|
3
3
|
import { NodeAppearances } from '../NodeAppearances.ts';
|
|
4
4
|
import { RootNode } from '../RootNode.ts';
|
|
@@ -7,7 +7,6 @@ import { GeneralParentNode } from '../hierarchy.ts';
|
|
|
7
7
|
import { RepeatRangeNodeType } from '../node-types.ts';
|
|
8
8
|
import { AncestorNodeValidationState } from '../validation.ts';
|
|
9
9
|
import { RepeatInstanceNode } from './RepeatInstanceNode.ts';
|
|
10
|
-
|
|
11
10
|
export interface BaseRepeatRangeNodeState extends BaseNodeState {
|
|
12
11
|
get hint(): null;
|
|
13
12
|
get label(): TextRange<'label'> | null;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { RepeatInstanceDefinition } from '../../model/RepeatInstanceDefinition.ts';
|
|
2
|
-
import { RepeatTemplateDefinition } from '../../model/RepeatTemplateDefinition.ts';
|
|
1
|
+
import { RepeatInstanceDefinition } from '../../parse/model/RepeatInstanceDefinition.ts';
|
|
2
|
+
import { RepeatTemplateDefinition } from '../../parse/model/RepeatTemplateDefinition.ts';
|
|
3
3
|
import { BaseNode, BaseNodeState } from '../BaseNode.ts';
|
|
4
4
|
import { GeneralChildNode, RepeatRangeNode } from '../hierarchy.ts';
|
|
5
5
|
import { NodeAppearances } from '../NodeAppearances.ts';
|
|
6
6
|
import { RootNode } from '../RootNode.ts';
|
|
7
7
|
import { AncestorNodeValidationState } from '../validation.ts';
|
|
8
|
-
|
|
9
8
|
export interface RepeatInstanceNodeState extends BaseNodeState {
|
|
10
9
|
get hint(): null;
|
|
11
10
|
get children(): readonly GeneralChildNode[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ControlledRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
|
|
1
|
+
import { ControlledRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
2
2
|
import { BaseRepeatRangeNode, BaseRepeatRangeNodeState } from './BaseRepeatRangeNode.ts';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* {@inheritDoc BaseRepeatRangeNodeState}
|
|
6
5
|
* @see {@link BaseRepeatRangeNodeState}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { UncontrolledRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
|
|
1
|
+
import { UncontrolledRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
2
2
|
import { RootNode } from '../RootNode.ts';
|
|
3
3
|
import { BaseRepeatRangeNode, BaseRepeatRangeNodeState } from './BaseRepeatRangeNode.ts';
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* {@inheritDoc BaseRepeatRangeNodeState}
|
|
7
6
|
* @see {@link BaseRepeatRangeNodeState}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { JRResourceURL } from '../../../common/src/jr-resources/JRResourceURL.ts';
|
|
2
|
+
interface FetchResourceHeadersIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
|
3
|
+
[Symbol.iterator](): FetchResourceHeadersIterator<T>;
|
|
4
|
+
}
|
|
5
|
+
type FetchResourceHeadersForEachCallbackFn = (value: string, key: string, parent: FetchResourceResponseHeaders) => void;
|
|
6
|
+
/**
|
|
7
|
+
* A read-only strict subset of the web standard {@link Headers}.
|
|
8
|
+
*
|
|
9
|
+
* Note that the engine may make the following assumptions about
|
|
10
|
+
* {@link FetchResourceResponse.headers}:
|
|
11
|
+
*
|
|
12
|
+
* - If {@link FetchResourceResponse} is an instance of {@link Response}, it
|
|
13
|
+
* will be assumed its {@link FetchResourceResponse.headers | headers object}
|
|
14
|
+
* _is present_, and that it is an instance of {@link Headers}. In other
|
|
15
|
+
* words: for the purposes of resource resolution, we explicitly expect that
|
|
16
|
+
* clients using APIs provided by the runtime platform (or polyfills thereof)
|
|
17
|
+
* will not monkey-patch properties of values produced by those APIs.
|
|
18
|
+
*
|
|
19
|
+
* - If the object is an instance of {@link Headers} (whether by inference as a
|
|
20
|
+
* property of {@link Response}, or by a direct instance type check), the
|
|
21
|
+
* engine will assume it is safe to treat header names as case insensitive for
|
|
22
|
+
* any lookups it may perform. In other words: we explicitly expect that
|
|
23
|
+
* clients _providing access_ to APIs rovided by the runtime platform (or
|
|
24
|
+
* polyfills thereof) will not alter the guarantees of those APIs.
|
|
25
|
+
*
|
|
26
|
+
* - If the object is not an instance of {@link Headers}, it will be treated as
|
|
27
|
+
* a {@link ReadonlyMap<string, string>}. In other words: we explicitly expect
|
|
28
|
+
* that clients, when providing a bespoke implementation of
|
|
29
|
+
* {@link FetchResourceResponse} and its constituent parts, will likely
|
|
30
|
+
* implement them partially (and in the case of
|
|
31
|
+
* {@link FetchResourceResponse.headers}, with the nearest common idiom
|
|
32
|
+
* available). In this case, we will favor a best effort at correctness,
|
|
33
|
+
* generally at some expense of performance.
|
|
34
|
+
*/
|
|
35
|
+
export interface FetchResourceResponseHeaders {
|
|
36
|
+
[Symbol.iterator](): FetchResourceHeadersIterator<[string, string]>;
|
|
37
|
+
entries(): FetchResourceHeadersIterator<[string, string]>;
|
|
38
|
+
keys(): FetchResourceHeadersIterator<string>;
|
|
39
|
+
values(): FetchResourceHeadersIterator<string>;
|
|
40
|
+
get(name: string): string | null;
|
|
41
|
+
has(name: string): boolean;
|
|
42
|
+
forEach(callbackfn: FetchResourceHeadersForEachCallbackFn): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This is a strict subset of the web standard {@link Response}. Clients are
|
|
46
|
+
* encouraged to use the global {@link Response} constructor (as provided by the
|
|
47
|
+
* runtime platform, or by a global runtime polyfill), but may also provide a
|
|
48
|
+
* bespoke implementation if it suits their needs.
|
|
49
|
+
*
|
|
50
|
+
* Since we cannot assume a client's implementation will always be an instance
|
|
51
|
+
* of {@link Response}, we make some assumptions about its {@link headers}
|
|
52
|
+
* object (if available, as detailed on {@link FetchResourceResponseHeaders}).
|
|
53
|
+
*
|
|
54
|
+
* For other properties, we make the following assumptions (all of which are
|
|
55
|
+
* assumptions we would make about a platform-provided/polyfilled
|
|
56
|
+
* {@link Response}, but are explicitly stated for the benefit of confidence in
|
|
57
|
+
* client implementations):
|
|
58
|
+
*
|
|
59
|
+
* - If we read {@link body} directly, we will assume it is consumed on first
|
|
60
|
+
* read, and will not read it again.
|
|
61
|
+
*
|
|
62
|
+
* - We assume that {@link blob} and {@link text} indirectly consume
|
|
63
|
+
* {@link body} on first read as well, and will only ever read one of each of
|
|
64
|
+
* these properties, and only ever once.
|
|
65
|
+
*
|
|
66
|
+
* Furthermore, if the engine intends to read {@link body} (or its indirect
|
|
67
|
+
* {@link blob} or {@link text} consumers), it will do so in the course of a
|
|
68
|
+
* client's call to {@link initializeForm}, and before the
|
|
69
|
+
* {@link Promise<PrimaryInstance>} returned by that call is resolved.
|
|
70
|
+
*/
|
|
71
|
+
export interface FetchResourceResponse {
|
|
72
|
+
readonly ok?: boolean;
|
|
73
|
+
readonly status?: number;
|
|
74
|
+
readonly body?: ReadableStream<Uint8Array> | null;
|
|
75
|
+
readonly bodyUsed?: boolean;
|
|
76
|
+
readonly headers?: FetchResourceResponseHeaders;
|
|
77
|
+
readonly blob: () => Promise<Blob>;
|
|
78
|
+
readonly text: () => Promise<string>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* This is a strict subset of the web standard `fetch` interface. It implicitly
|
|
82
|
+
* assumes that the engine itself will only ever perform `GET`-like network/IO
|
|
83
|
+
* requests. It also provides no further request-like semantics to the engine.
|
|
84
|
+
*
|
|
85
|
+
* This is presumed sufficient for now, but notably doesn't expose any notion of
|
|
86
|
+
* content negotiation (e.g. the ability for the engine to include `Accept`
|
|
87
|
+
* headers in resource requests issued to a client's {@link FetchResource}
|
|
88
|
+
* implementation).
|
|
89
|
+
*/
|
|
90
|
+
export type FetchResource<Resource extends URL = URL> = (resource: Resource) => Promise<FetchResourceResponse>;
|
|
91
|
+
export type FormAttachmentURL = JRResourceURL;
|
|
92
|
+
export type FetchFormAttachment = FetchResource<FormAttachmentURL>;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SubmissionInstanceFile, SubmissionInstanceFileName } from './SubmissionInstanceFile.ts';
|
|
2
|
+
export interface SubmissionData extends FormData {
|
|
3
|
+
get(name: SubmissionInstanceFileName): SubmissionInstanceFile;
|
|
4
|
+
get(name: string): FormDataEntryValue | null;
|
|
5
|
+
has(name: SubmissionInstanceFileName): true;
|
|
6
|
+
has(name: string): boolean;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SubmissionDefinition {
|
|
2
|
+
/**
|
|
3
|
+
* @see {@link https://getodk.github.io/xforms-spec/#submission-attributes | `action` submission attribute}
|
|
4
|
+
*/
|
|
5
|
+
readonly submissionAction: URL | null;
|
|
6
|
+
/**
|
|
7
|
+
* @see {@link https://getodk.github.io/xforms-spec/#submission-attributes | `method` submission attribute}
|
|
8
|
+
*/
|
|
9
|
+
readonly submissionMethod: 'post';
|
|
10
|
+
/**
|
|
11
|
+
* @see {@link https://getodk.github.io/xforms-spec/#submission-attributes | `base64RsaPublicKey` submission attribute}
|
|
12
|
+
*/
|
|
13
|
+
readonly encryptionKey: string | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SubmissionInstanceFileName, SubmissionInstanceFileType } from '../constants.ts';
|
|
2
|
+
export type { SubmissionInstanceFileName, SubmissionInstanceFileType };
|
|
3
|
+
export interface SubmissionInstanceFile extends File {
|
|
4
|
+
readonly name: SubmissionInstanceFileName;
|
|
5
|
+
readonly type: SubmissionInstanceFileType;
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SubmissionChunkedType = 'chunked' | 'monolithic';
|
|
2
|
+
interface BaseSubmissionOptions<ChunkedType extends SubmissionChunkedType> {
|
|
3
|
+
readonly chunked?: ChunkedType | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* As described in the
|
|
6
|
+
* {@link https://docs.getodk.org/openrosa-form-submission/#extended-transmission-considerations | OpenRosa Form Submission API},
|
|
7
|
+
* clients may obtain this value from an OpenRosa server's
|
|
8
|
+
* `X-OpenRosa-Accept-Content-Length` header.
|
|
9
|
+
*/
|
|
10
|
+
readonly maxSize?: number;
|
|
11
|
+
}
|
|
12
|
+
interface ChunkedSubmissionOptions extends BaseSubmissionOptions<'chunked'> {
|
|
13
|
+
readonly maxSize: number;
|
|
14
|
+
}
|
|
15
|
+
interface MonolithicSubmissionOptions extends BaseSubmissionOptions<'monolithic'> {
|
|
16
|
+
readonly chunked?: 'monolithic' | undefined;
|
|
17
|
+
readonly maxSize?: never;
|
|
18
|
+
}
|
|
19
|
+
export type SubmissionOptions<ChunkedType extends SubmissionChunkedType = 'monolithic'> = {
|
|
20
|
+
chunked: ChunkedSubmissionOptions;
|
|
21
|
+
monolithic: MonolithicSubmissionOptions;
|
|
22
|
+
}[ChunkedType];
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DescendantNodeViolationReference } from '../validation.ts';
|
|
2
|
+
import { SubmissionData } from './SubmissionData.ts';
|
|
3
|
+
import { SubmissionDefinition } from './SubmissionDefinition.ts';
|
|
4
|
+
import { SubmissionChunkedType } from './SubmissionOptions.ts';
|
|
5
|
+
export type SubmissionResultStatus = 'pending' | 'max-size-exceeded' | 'ready';
|
|
6
|
+
type SubmissionResultData<ChunkedType extends SubmissionChunkedType> = {
|
|
7
|
+
chunked: readonly [SubmissionData, ...SubmissionData[]];
|
|
8
|
+
monolithic: SubmissionData;
|
|
9
|
+
}[ChunkedType];
|
|
10
|
+
/**
|
|
11
|
+
* Provides detail about an individual submission attachment {@link File}s which
|
|
12
|
+
* exceeds the client-specified {@link maxSize} for a
|
|
13
|
+
* {@link SubmissionResult<'chunked'> | chunked submission result}. Clients may
|
|
14
|
+
* use this value to provide guidance to users.
|
|
15
|
+
*
|
|
16
|
+
* @todo We may want to consider (a) making {@link maxSize} a configuration the
|
|
17
|
+
* client can provide when initializing a form instance, rather than only on
|
|
18
|
+
* submission; and then (b) treating a maximum size violation as another kind of
|
|
19
|
+
* node-level violation. This would go beyond the kinds of validation specified
|
|
20
|
+
* by ODK XForms, but it would make a lot of _conceptual sense_.
|
|
21
|
+
*
|
|
22
|
+
* It would almost certainly be helpful to alert users to violations as the
|
|
23
|
+
* occur, rather than only at submission time (where they have likely already
|
|
24
|
+
* moved on). This is something clients can do without engine support, but it
|
|
25
|
+
* would likely promote good usability patterns if the engine makes it an
|
|
26
|
+
* obvious and uniform option at the main engine/client entrypoint.
|
|
27
|
+
*
|
|
28
|
+
* @todo If we consider the above, we'd want to reframe _this interface_ to
|
|
29
|
+
* match the shape of other {@link AnyViolation | violations} (adding it as a
|
|
30
|
+
* member of that union). We'd also likely eliminate
|
|
31
|
+
* {@link MaxSizeExceededResult} in the process, since
|
|
32
|
+
* {@link PendingSubmissionResult} would then cover the case.
|
|
33
|
+
*/
|
|
34
|
+
interface MaxSizeViolation {
|
|
35
|
+
/**
|
|
36
|
+
* Specifies the index of
|
|
37
|
+
* {@link SubmissionResultData<'chunked'> | chunked submission data} where a
|
|
38
|
+
* submission attachment {@link File} exceeds the client-specified
|
|
39
|
+
* {@link maxSize}.
|
|
40
|
+
*/
|
|
41
|
+
readonly dataIndex: number;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies the name of the file which exceeds the client-specified
|
|
44
|
+
* {@link maxSize}. This name can also be used as a key to access the
|
|
45
|
+
* violating {@link File}/submission attachment, in the {@link SubmissionData}
|
|
46
|
+
* at the specified {@link dataIndex}.
|
|
47
|
+
*/
|
|
48
|
+
readonly fileName: string;
|
|
49
|
+
/**
|
|
50
|
+
* Reflects the client-specified maximum size for each chunk of a
|
|
51
|
+
* {@link SubmissionResult<'chunked'> | chunked submission result}.
|
|
52
|
+
*/
|
|
53
|
+
readonly maxSize: number;
|
|
54
|
+
/**
|
|
55
|
+
* Details the actual size of the violating {@link File}/submission
|
|
56
|
+
* attachment. Along with {@link maxSize}. Clients may use the delta between
|
|
57
|
+
* this value and {@link maxSize} to provide detailed guidance to users.
|
|
58
|
+
*/
|
|
59
|
+
readonly actualSize: number;
|
|
60
|
+
}
|
|
61
|
+
type SubmissionResultViolation = DescendantNodeViolationReference | MaxSizeViolation;
|
|
62
|
+
interface BaseSubmissionResult<ChunkedType extends SubmissionChunkedType> {
|
|
63
|
+
readonly status: SubmissionResultStatus;
|
|
64
|
+
readonly definition: SubmissionDefinition;
|
|
65
|
+
get violations(): readonly SubmissionResultViolation[] | null;
|
|
66
|
+
/**
|
|
67
|
+
* Submission data may be chunked according to the
|
|
68
|
+
* {@link SubmissionOptions.maxSize | maxSize submission option}
|
|
69
|
+
*/
|
|
70
|
+
readonly data: SubmissionResultData<ChunkedType>;
|
|
71
|
+
}
|
|
72
|
+
interface PendingSubmissionResult<ChunkedType extends SubmissionChunkedType> extends BaseSubmissionResult<ChunkedType> {
|
|
73
|
+
readonly status: 'pending';
|
|
74
|
+
get violations(): readonly DescendantNodeViolationReference[];
|
|
75
|
+
}
|
|
76
|
+
interface MaxSizeExceededResult extends BaseSubmissionResult<'chunked'> {
|
|
77
|
+
readonly status: 'max-size-exceeded';
|
|
78
|
+
get violations(): readonly MaxSizeViolation[];
|
|
79
|
+
}
|
|
80
|
+
interface ReadySubmissionResult<ChunkedType extends SubmissionChunkedType> extends BaseSubmissionResult<ChunkedType> {
|
|
81
|
+
readonly status: 'ready';
|
|
82
|
+
get violations(): null;
|
|
83
|
+
}
|
|
84
|
+
type CommonSubmissionResult<ChunkedType extends SubmissionChunkedType> = PendingSubmissionResult<ChunkedType> | ReadySubmissionResult<ChunkedType>;
|
|
85
|
+
export type ChunkedSubmissionResult = CommonSubmissionResult<'chunked'> | MaxSizeExceededResult;
|
|
86
|
+
export type MonolithicSubmissionResult = CommonSubmissionResult<'monolithic'>;
|
|
87
|
+
export type SubmissionResult<ChunkedType extends SubmissionChunkedType> = {
|
|
88
|
+
chunked: ChunkedSubmissionResult;
|
|
89
|
+
monolithic: MonolithicSubmissionResult;
|
|
90
|
+
}[ChunkedType];
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SubmissionState {
|
|
2
|
+
/**
|
|
3
|
+
* Represents the serialized XML state of a given node, as it will be prepared
|
|
4
|
+
* for submission. The value produced in {@link RootNode.submissionState} is
|
|
5
|
+
* the same serialization which will be produced for the complete submission.
|
|
6
|
+
*
|
|
7
|
+
* @todo Note that this particular aspect of the design doesn't yet address
|
|
8
|
+
* production of unique file names. As such, this may change as we introduce
|
|
9
|
+
* affected data types (and their supporting nodes).
|
|
10
|
+
*/
|
|
11
|
+
get submissionXML(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RangeControlDefinition } from '../../parse/body/control/RangeControlDefinition.ts';
|
|
2
|
+
import { UnsupportedControlDefinition, UnsupportedControlNode } from './UnsupportedControlNode.ts';
|
|
3
|
+
export interface RangeNodeDefinition extends UnsupportedControlDefinition {
|
|
4
|
+
readonly bodyElement: RangeControlDefinition;
|
|
5
|
+
}
|
|
6
|
+
export interface RangeNode extends UnsupportedControlNode {
|
|
7
|
+
readonly nodeType: 'range';
|
|
8
|
+
readonly definition: RangeNodeDefinition;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RankControlDefinition } from '../../parse/body/control/RankControlDefinition.ts';
|
|
2
|
+
import { UnsupportedControlDefinition, UnsupportedControlNode } from './UnsupportedControlNode.ts';
|
|
3
|
+
export interface RankNodeDefinition extends UnsupportedControlDefinition {
|
|
4
|
+
readonly bodyElement: RankControlDefinition;
|
|
5
|
+
}
|
|
6
|
+
export interface RankNode extends UnsupportedControlNode {
|
|
7
|
+
readonly nodeType: 'rank';
|
|
8
|
+
readonly definition: RankNodeDefinition;
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UnknownAppearanceDefinition } from '../../parse/body/appearance/unknownAppearanceParser.ts';
|
|
2
|
+
import { RangeControlDefinition } from '../../parse/body/control/RangeControlDefinition.ts';
|
|
3
|
+
import { RankControlDefinition } from '../../parse/body/control/RankControlDefinition.ts';
|
|
4
|
+
import { UploadControlDefinition } from '../../parse/body/control/UploadControlDefinition.ts';
|
|
5
|
+
import { LeafNodeDefinition } from '../../parse/model/LeafNodeDefinition.ts';
|
|
6
|
+
import { BaseNode, BaseNodeState } from '../BaseNode.ts';
|
|
7
|
+
import { RootNode } from '../RootNode.ts';
|
|
8
|
+
import { GeneralParentNode } from '../hierarchy.ts';
|
|
9
|
+
import { UnsupportedControlNodeType } from '../node-types.ts';
|
|
10
|
+
import { LeafNodeValidationState } from '../validation.ts';
|
|
11
|
+
export interface UnsupportedControlNodeState extends BaseNodeState {
|
|
12
|
+
get children(): null;
|
|
13
|
+
get valueOptions(): unknown;
|
|
14
|
+
get value(): unknown;
|
|
15
|
+
}
|
|
16
|
+
export type UnsupportedControlElementDefinition = RangeControlDefinition | RankControlDefinition | UploadControlDefinition;
|
|
17
|
+
export interface UnsupportedControlDefinition extends LeafNodeDefinition {
|
|
18
|
+
readonly bodyElement: UnsupportedControlElementDefinition;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Stub node, for form controls pending further engine support.
|
|
22
|
+
*/
|
|
23
|
+
export interface UnsupportedControlNode extends BaseNode {
|
|
24
|
+
readonly nodeType: UnsupportedControlNodeType;
|
|
25
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
26
|
+
readonly definition: UnsupportedControlDefinition;
|
|
27
|
+
readonly root: RootNode;
|
|
28
|
+
readonly parent: GeneralParentNode;
|
|
29
|
+
readonly currentState: UnsupportedControlNodeState;
|
|
30
|
+
readonly validationState: LeafNodeValidationState;
|
|
31
|
+
setValue?(value: never): never;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UploadControlDefinition } from '../../parse/body/control/UploadControlDefinition.ts';
|
|
2
|
+
import { UnsupportedControlDefinition, UnsupportedControlNode } from './UnsupportedControlNode.ts';
|
|
3
|
+
export interface UploadNodeDefinition extends UnsupportedControlDefinition {
|
|
4
|
+
readonly bodyElement: UploadControlDefinition;
|
|
5
|
+
}
|
|
6
|
+
export interface UploadNode extends UnsupportedControlNode {
|
|
7
|
+
readonly nodeType: 'upload';
|
|
8
|
+
readonly definition: UploadNodeDefinition;
|
|
9
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormNodeID } from './identity.ts';
|
|
2
2
|
import { TextRange } from './TextRange.ts';
|
|
3
|
-
|
|
4
3
|
interface BaseValidity {
|
|
5
4
|
/**
|
|
6
5
|
* Specifies the unambiguous validity state for each validity condition of a
|
|
@@ -145,7 +144,7 @@ export interface LeafNodeValidationState {
|
|
|
145
144
|
* each property will be directly computed from the affected node.
|
|
146
145
|
*/
|
|
147
146
|
export interface DescendantNodeViolationReference {
|
|
148
|
-
readonly nodeId:
|
|
147
|
+
readonly nodeId: FormNodeID;
|
|
149
148
|
get reference(): string;
|
|
150
149
|
get violation(): AnyViolation;
|
|
151
150
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporary representation of newly introduced error conditions which we may
|
|
3
|
+
* produce to clients (and beyond). Intentionally a stub pending a more concrete
|
|
4
|
+
* design and implementation of our approach to producing Result types.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ErrorProductionDesignPendingError extends Error {
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValueType } from '../client/ValueType.ts';
|
|
2
|
+
import { ErrorProductionDesignPendingError } from './ErrorProductionDesignPendingError.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Temporary(?) representation of error conditions arising from violation of
|
|
5
|
+
* invariants specific to {@link valueType}.
|
|
6
|
+
*
|
|
7
|
+
* @todo The intent of this distinct subclass of
|
|
8
|
+
* {@link ErrorProductionDesignPendingError} is to call out cases where we may
|
|
9
|
+
* want to represent such errors to clients as **validation errors** in the
|
|
10
|
+
* future. We identified this as probably desirable in the initial work on `int`
|
|
11
|
+
* and `decimal` value types, but held off on that aspect of implementation to
|
|
12
|
+
* tame scope.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ValueTypeInvariantError extends ErrorProductionDesignPendingError {
|
|
15
|
+
readonly valueType: ValueType;
|
|
16
|
+
constructor(valueType: ValueType, message: string);
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyFunction, ExpandUnion } from '../../../common/types/helpers.js';
|
|
2
|
+
import { XPathDOMAdapter, XPathNode } from '@getodk/xpath';
|
|
3
|
+
/**
|
|
4
|
+
* @todo this is general enough to go in `@getodk/common`. Holding off until
|
|
5
|
+
* it's clear we actually benefit from this particular type gymnastic.
|
|
6
|
+
*/
|
|
7
|
+
type MethodNameOf<T> = {
|
|
8
|
+
[K in keyof T]: T[K] extends AnyFunction ? K : never;
|
|
9
|
+
}[keyof T];
|
|
10
|
+
export type XPathFunctionalityErrorCategory = ExpandUnion<MethodNameOf<XPathDOMAdapter<XPathNode>> | 'processing-instruction'>;
|
|
11
|
+
export declare abstract class XPathFunctionalityError extends Error {
|
|
12
|
+
constructor(functionalityMessagePrefix: string, category: XPathFunctionalityErrorCategory);
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { XPathFunctionalityErrorCategory, XPathFunctionalityError } from './XPathFunctionalityError.ts';
|
|
2
|
+
type XPathFunctionalityNotSupportedStub = () => never;
|
|
3
|
+
export declare class XPathFunctionalityNotSupportedError extends XPathFunctionalityError {
|
|
4
|
+
static createStubImplementation(category: XPathFunctionalityErrorCategory): XPathFunctionalityNotSupportedStub;
|
|
5
|
+
private constructor();
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { XPathFunctionalityErrorCategory, XPathFunctionalityError } from './XPathFunctionalityError.ts';
|
|
2
|
+
type XPathFunctionalityPendingStub = () => never;
|
|
3
|
+
export declare class XPathFunctionalityPendingError extends XPathFunctionalityError {
|
|
4
|
+
static createStubImplementation(category: XPathFunctionalityErrorCategory): XPathFunctionalityPendingStub;
|
|
5
|
+
private constructor();
|
|
6
|
+
}
|
|
7
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import { InitializeForm } from './index.ts';
|
|
2
|
-
|
|
3
2
|
export declare const initializeForm: InitializeForm;
|
|
3
|
+
export type * from './client/constants.ts';
|
|
4
4
|
export * as constants from './client/constants.ts';
|
|
5
5
|
export type * from './client/EngineConfig.ts';
|
|
6
6
|
export type * from './client/FormLanguage.ts';
|
|
7
7
|
export type * from './client/GroupNode.ts';
|
|
8
|
-
export type { AnyChildNode, AnyControlNode, AnyLeafNode, AnyNode, AnyParentNode, GeneralChildNode, GeneralParentNode, RepeatRangeNode, } from './client/hierarchy.ts';
|
|
8
|
+
export type { AnyChildNode, AnyControlNode, AnyLeafNode, AnyNode, AnyParentNode, AnyUnsupportedControlNode, GeneralChildNode, GeneralParentNode, RepeatRangeNode, } from './client/hierarchy.ts';
|
|
9
9
|
export type * from './client/index.ts';
|
|
10
|
+
export type * from './client/InputNode.ts';
|
|
10
11
|
export type * from './client/ModelValueNode.ts';
|
|
11
12
|
export type * from './client/NoteNode.ts';
|
|
12
13
|
export type * from './client/OpaqueReactiveObjectFactory.ts';
|
|
13
14
|
export type * from './client/repeat/RepeatInstanceNode.ts';
|
|
14
15
|
export type * from './client/repeat/RepeatRangeControlledNode.ts';
|
|
15
16
|
export type * from './client/repeat/RepeatRangeUncontrolledNode.ts';
|
|
17
|
+
export type * from './client/resources.ts';
|
|
16
18
|
export type * from './client/RootNode.ts';
|
|
17
19
|
export type * from './client/SelectNode.ts';
|
|
18
|
-
export type * from './client/
|
|
20
|
+
export type * from './client/submission/SubmissionData.ts';
|
|
21
|
+
export type * from './client/submission/SubmissionDefinition.ts';
|
|
22
|
+
export type * from './client/submission/SubmissionInstanceFile.ts';
|
|
23
|
+
export type * from './client/submission/SubmissionOptions.ts';
|
|
24
|
+
export type * from './client/submission/SubmissionResult.ts';
|
|
25
|
+
export type * from './client/submission/SubmissionState.ts';
|
|
19
26
|
export type * from './client/SubtreeNode.ts';
|
|
20
27
|
export type * from './client/TextRange.ts';
|
|
28
|
+
export type * from './client/TriggerNode.ts';
|
|
29
|
+
export type * from './client/unsupported/RangeNode.ts';
|
|
30
|
+
export type * from './client/unsupported/RankNode.ts';
|
|
31
|
+
export type * from './client/unsupported/UploadNode.ts';
|
|
21
32
|
export type * from './client/validation.ts';
|
|
22
|
-
export type
|
|
33
|
+
export type * from './client/ValueType.ts';
|
|
34
|
+
export type { AnySelectDefinition, SelectDefinition, } from './parse/body/control/select/SelectDefinition.ts';
|