@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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Awaitable, Thunk } from '../../../../common/types/helpers.d.ts';
|
|
2
|
+
import { FetchResourceResponse } from '../resources.ts';
|
|
3
|
+
import { InstanceAttachmentFileName, InstanceData } from '../serialization/InstanceData.ts';
|
|
4
|
+
import { FormInstance, FormInstanceEditMode } from './FormInstance.ts';
|
|
5
|
+
import { FormInstanceConfig } from './FormInstanceConfig.ts';
|
|
6
|
+
import { RestoreFormInstanceInput } from './RestoreFormInstance.ts';
|
|
7
|
+
export type ResolvableFormInstanceInputType = 'FORM_INSTANCE_INPUT_RESOLVABLE';
|
|
8
|
+
export type ResolvedFormInstanceInputType = 'FORM_INSTANCE_INPUT_RESOLVED';
|
|
9
|
+
export type EditFormInstanceInputType = ResolvableFormInstanceInputType | ResolvedFormInstanceInputType;
|
|
10
|
+
export type ResolvedFormInstance = Blob | FetchResourceResponse | File | string;
|
|
11
|
+
export type ResolvableFormInstance = Thunk<Awaitable<ResolvedFormInstance>>;
|
|
12
|
+
export type ResolveFormInstanceResource = Thunk<Promise<FetchResourceResponse>>;
|
|
13
|
+
export type ResolvableInstanceAttachmentsMap = ReadonlyMap<InstanceAttachmentFileName, ResolveFormInstanceResource>;
|
|
14
|
+
interface BaseEditFormInstanceInput {
|
|
15
|
+
readonly inputType: EditFormInstanceInputType;
|
|
16
|
+
readonly data?: readonly [InstanceData, ...InstanceData[]];
|
|
17
|
+
readonly resolveInstance?: ResolvableFormInstance;
|
|
18
|
+
readonly attachments?: ResolvableInstanceAttachmentsMap;
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvableFormInstanceInput extends BaseEditFormInstanceInput {
|
|
21
|
+
readonly inputType: ResolvableFormInstanceInputType;
|
|
22
|
+
readonly resolveInstance: ResolvableFormInstance;
|
|
23
|
+
readonly attachments: ResolvableInstanceAttachmentsMap;
|
|
24
|
+
readonly data?: never;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @todo This is included as a strawman for discussiong: "should we accept input
|
|
28
|
+
* to {@link EditFormInstance} in the same shape as input to
|
|
29
|
+
* {@link RestoreFormInstance}?".
|
|
30
|
+
*
|
|
31
|
+
* Pros:
|
|
32
|
+
*
|
|
33
|
+
* - More consistency between the two entrypoint APIs, which are pretty similar
|
|
34
|
+
* _conceptually_.
|
|
35
|
+
* - ?
|
|
36
|
+
*
|
|
37
|
+
* Cons:
|
|
38
|
+
*
|
|
39
|
+
* - Less consistency between this entrypoint API and {@link LoadForm}, which is
|
|
40
|
+
* also responsible for loading arbitrary attachments (presumably over a
|
|
41
|
+
* network), which...
|
|
42
|
+
* - ... all but rules out flexibility to optimize loading large resources (i.e.
|
|
43
|
+
* streaming video/audio)
|
|
44
|
+
*
|
|
45
|
+
* Alternative:
|
|
46
|
+
*
|
|
47
|
+
* - Increase consistency across the board by inverting the relationship between
|
|
48
|
+
* edit/restore: {@link RestoreFormInstanceInput} could be the place where we
|
|
49
|
+
* accept a union of resolved | resolvable input, and clients which might
|
|
50
|
+
* benefit from this consistency could consolidate on the resolvable case
|
|
51
|
+
* without sacrificing resource loading optimizations)
|
|
52
|
+
*/
|
|
53
|
+
export interface ResolvedFormInstanceInput extends BaseEditFormInstanceInput, RestoreFormInstanceInput {
|
|
54
|
+
readonly inputType: ResolvedFormInstanceInputType;
|
|
55
|
+
readonly data: readonly [InstanceData, ...InstanceData[]];
|
|
56
|
+
readonly resolveInstance?: never;
|
|
57
|
+
readonly attachments?: never;
|
|
58
|
+
}
|
|
59
|
+
export type EditFormInstanceInput = ResolvableFormInstanceInput | ResolvedFormInstanceInput;
|
|
60
|
+
export type EditedFormInstance = FormInstance<FormInstanceEditMode>;
|
|
61
|
+
export type EditFormInstance = (input: EditFormInstanceInput, config?: FormInstanceConfig) => Promise<EditedFormInstance>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { RootNode } from '../RootNode.ts';
|
|
2
|
+
import { InstantiableLoadFormResult } from './LoadFormResult.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Represents an instance which is newly created from a form definition.
|
|
5
|
+
*
|
|
6
|
+
* A newly created instance is populated with default values and state defined
|
|
7
|
+
* by the form.
|
|
8
|
+
*
|
|
9
|
+
* Computations are performed on initialization as specified by
|
|
10
|
+
* {@link https://getodk.github.io/xforms-spec/ | ODK XForms}, as the instance's
|
|
11
|
+
* {@link https://getodk.github.io/xforms-spec/#event:odk-instance-first-load | first load}.
|
|
12
|
+
*/
|
|
13
|
+
export type FormInstanceCreateMode = 'create';
|
|
14
|
+
/**
|
|
15
|
+
* Represents an instance restored from previously filled state, as represented
|
|
16
|
+
* in an {@link InstancePayload}. Clients may serialize and persist an instance
|
|
17
|
+
* payload as appropriate for their use cases, and can restore the instance with
|
|
18
|
+
* a partial instance payload structure, defined by the
|
|
19
|
+
* {@link RestoreFormInstanceInput} interface.
|
|
20
|
+
*
|
|
21
|
+
* A restored instance is populated by the engine with the answers as they had
|
|
22
|
+
* been filled at the time the {@link InstancePayload}
|
|
23
|
+
* ({@link RestoreFormInstanceInput}) was created.
|
|
24
|
+
*
|
|
25
|
+
* Computations are performed on initialization as specified by
|
|
26
|
+
* {@link https://getodk.github.io/xforms-spec/#event:odk-instance-load | ODK XForms},
|
|
27
|
+
* as a
|
|
28
|
+
* {@link https://getodk.github.io/xforms-spec/#event:odk-instance-load | subsequent load}
|
|
29
|
+
* (i.e. **NOT** "first load", as is the case with newly
|
|
30
|
+
* {@link FormInstanceCreateMode | created} instances}) of the instance.
|
|
31
|
+
*/
|
|
32
|
+
export type FormInstanceRestoreMode = 'restore';
|
|
33
|
+
/**
|
|
34
|
+
* Represents an instance which:
|
|
35
|
+
*
|
|
36
|
+
* - was previously serialized
|
|
37
|
+
* - was **submitted**, often referred to as a "submission" (noun)
|
|
38
|
+
* - is being initialized to produce an edited instance of that "submission"
|
|
39
|
+
*
|
|
40
|
+
* An edited instance may be populated from one or more network-accessible
|
|
41
|
+
* resources—its serialized instance XML, and any _instance attachments_—which
|
|
42
|
+
* are resolved in a manner similar to that of a form definition and its _form
|
|
43
|
+
* attachments_.
|
|
44
|
+
*
|
|
45
|
+
* Once resolved, an edited instance is restored from its previously filled
|
|
46
|
+
* state _as it was submitted_, consistent with
|
|
47
|
+
* {@link FormInstanceRestoreMode | restoring an instance}, with the following
|
|
48
|
+
* exceptions:
|
|
49
|
+
*
|
|
50
|
+
* - If the form or instance does not define an explicit
|
|
51
|
+
* {@link https://getodk.github.io/xforms-spec/#metadata | `deprecatedID` metadata element},
|
|
52
|
+
* one will be created.
|
|
53
|
+
*
|
|
54
|
+
* - If the instance has an `instanceID` metadata element, that element's value
|
|
55
|
+
* will be assigned to the instance's `deprecatedID`.
|
|
56
|
+
*
|
|
57
|
+
* - If applicable, a new instance id will be assigned:
|
|
58
|
+
*
|
|
59
|
+
* - If the instance has an `instanceID` metadata element, and the form
|
|
60
|
+
* explicitly defines a
|
|
61
|
+
* {@link https://getodk.github.io/xforms-spec/#preload-attributes | `uid` preload attribute}
|
|
62
|
+
* for its model binding, a new instance id value will be assigned to that
|
|
63
|
+
* element _as if it were the
|
|
64
|
+
* {@link https://getodk.github.io/xforms-spec/#event:odk-instance-first-load | instance's first load}_.
|
|
65
|
+
*
|
|
66
|
+
* - **Consistent with {@link FormInstanceCreateMode | instance creation}:**
|
|
67
|
+
* if the form **DOES NOT** define an `instanceID` element or model
|
|
68
|
+
* binding, the `uid` preload behavior described above is **implied** as
|
|
69
|
+
* the form's default behavior for that metadata; in which case whether
|
|
70
|
+
* the instance defines an `instanceID` element explicitly or not, it will
|
|
71
|
+
* be treated as if it had, behaving as described in the point above.
|
|
72
|
+
*
|
|
73
|
+
* **NOTE:** the behavior for an instance's `instanceID` metadata element and a
|
|
74
|
+
* form's `uid` preload attribute describe a special case, applying only to that
|
|
75
|
+
* specific preload attribute. In other words, when initializing instance state
|
|
76
|
+
* for editing:
|
|
77
|
+
*
|
|
78
|
+
* - The `odk-instance-first-load` event itself will **NOT** be triggered
|
|
79
|
+
* - Preload attributes _other than `uid`_ will **NOT** be recomputed
|
|
80
|
+
*
|
|
81
|
+
* **NOTE:** while the `uid` preload attribute is discussed above in terms of
|
|
82
|
+
* the `instanceID` meta element, its behavior is not applied specially to any
|
|
83
|
+
* particular node, regardless of
|
|
84
|
+
* {@link FormInstanceInitializationMode | initialization mode}.
|
|
85
|
+
*/
|
|
86
|
+
export type FormInstanceEditMode = 'edit';
|
|
87
|
+
export type FormInstanceInitializationMode = FormInstanceCreateMode | FormInstanceEditMode | FormInstanceRestoreMode;
|
|
88
|
+
/**
|
|
89
|
+
* @todo this could hypothetically convey warnings and/or errors, just as
|
|
90
|
+
* {@link LoadFormResult} does. This has been deferred because:
|
|
91
|
+
*
|
|
92
|
+
* - We really want a more thoughtful design for Result types
|
|
93
|
+
* - The `try`/`catch` approach to capturing all errors takes a huge performance
|
|
94
|
+
* hit, which we should not incur if we have a more thoughtful design coming
|
|
95
|
+
* eventually. It would be too easy to forget about, indefinitely!
|
|
96
|
+
*/
|
|
97
|
+
export interface FormInstance<Mode extends FormInstanceInitializationMode> {
|
|
98
|
+
readonly formResult: InstantiableLoadFormResult;
|
|
99
|
+
readonly mode: Mode;
|
|
100
|
+
readonly root: RootNode;
|
|
101
|
+
}
|
|
102
|
+
export type AnyFormInstance = {
|
|
103
|
+
[Mode in FormInstanceInitializationMode]: FormInstance<Mode>;
|
|
104
|
+
}[FormInstanceInitializationMode];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OpaqueReactiveObjectFactory } from '../OpaqueReactiveObjectFactory.ts';
|
|
2
|
+
export interface FormInstanceConfig {
|
|
3
|
+
/**
|
|
4
|
+
* A client may specify a generic function for constructing stateful objects.
|
|
5
|
+
* The only hard requirement of this function is that it accepts an **object**
|
|
6
|
+
* and returns an object of the same shape. The engine will use this function
|
|
7
|
+
* to initialize client-facing state, and will mutate properties of the object
|
|
8
|
+
* when their corresponding state is changed.
|
|
9
|
+
*
|
|
10
|
+
* A client may use this function to provide its own implementation of
|
|
11
|
+
* reactivity with semantics like those described above. The mechanism of
|
|
12
|
+
* reactivity, if any, is at the discretion of the client. It is expected that
|
|
13
|
+
* clients providing this function will use a reactive subscribe-on-read
|
|
14
|
+
* mechanism to handle state updates conveyed by the engine.
|
|
15
|
+
*/
|
|
16
|
+
readonly stateFactory?: OpaqueReactiveObjectFactory;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FormResource = Blob | File | URL | string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { MissingResourceBehavior } from '../constants.ts';
|
|
2
|
+
import { FetchFormAttachment, FetchResource } from '../resources.ts';
|
|
3
|
+
import { FormResource } from './FormResource.ts';
|
|
4
|
+
import { LoadFormResult } from './LoadFormResult.ts';
|
|
5
|
+
/**
|
|
6
|
+
* @see {@link LoadForm}
|
|
7
|
+
*/
|
|
8
|
+
export interface FormLoadPromise<T> extends PromiseLike<T> {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Any fetch-like {@link LoadFormOptions | form loading options} which are not
|
|
12
|
+
* provided will default to the global {@link fetch} function, if one is
|
|
13
|
+
* available in the calling environment. If a global {@link fetch} function is
|
|
14
|
+
* _is not available_, and if the associated form loading option is required for
|
|
15
|
+
* the provided {@link FormResource} to be loaded, a
|
|
16
|
+
* {@link LoadFormFailureResult} will be produced.
|
|
17
|
+
*/
|
|
18
|
+
export type GlobalFetchDefault = typeof fetch;
|
|
19
|
+
export interface LoadFormOptions {
|
|
20
|
+
/**
|
|
21
|
+
* A client may specify an arbitrary {@link fetch}-like function for
|
|
22
|
+
* retrieving an XML XForm form definition.
|
|
23
|
+
*
|
|
24
|
+
* Calls to {@link loadForm | load a form} from a form definition provided as
|
|
25
|
+
* either a raw XML string or {@link Blob} data containing an XML string, this
|
|
26
|
+
* option will be ignored.
|
|
27
|
+
*
|
|
28
|
+
* Calls to load a form by {@link URL} will consult this option, if defined.
|
|
29
|
+
*
|
|
30
|
+
* If this option is omitted, loading a form by URL will use the
|
|
31
|
+
* {@link GlobalFetchDefault | global fetch function} by default.
|
|
32
|
+
*/
|
|
33
|
+
readonly fetchFormDefinition?: FetchResource;
|
|
34
|
+
/**
|
|
35
|
+
* A client may specify an arbitrary {@link fetch}-like function to retrieve a
|
|
36
|
+
* form's attachments, i.e. any `jr:` URL referenced by the form (as specified
|
|
37
|
+
* by {@link https://getodk.github.io/xforms-spec/ | ODK XForms}).
|
|
38
|
+
*
|
|
39
|
+
* As part of {@link loadForm | loading a form}, once the form definition
|
|
40
|
+
* itself is resolved, this option (if provided) will be consulted to load any
|
|
41
|
+
* form attachments referenced by the form definition.
|
|
42
|
+
*
|
|
43
|
+
* If this option is omitted, the engine will attempt to load form attachments
|
|
44
|
+
* by calling the {@link GlobalFetchDefault | global fetch function} with each
|
|
45
|
+
* attachment's `jr:` URL. This default behavior will typically result in
|
|
46
|
+
* failure to load form attachments—and in most cases this will in most cases
|
|
47
|
+
* cause {@link loadForm | loading a form} to produce a
|
|
48
|
+
* {@link LoadFormFailureResult}, with the following exception:
|
|
49
|
+
*
|
|
50
|
+
* Clients implementing a
|
|
51
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API | Service Worker}
|
|
52
|
+
* (e.g. supporting offline functionality, or any other use case for
|
|
53
|
+
* intercepting network requests) may opt for the convenience of handling
|
|
54
|
+
* network requests _for form attachments' `jr:` URLs_ along with any other
|
|
55
|
+
* network interception logic. Client implementors should be warned, however,
|
|
56
|
+
* that such `jr:` URLs are not namespaced or otherwise scoped to a particular
|
|
57
|
+
* form definition! Such a client would therefore inherently need to
|
|
58
|
+
* coordinate state between the Service Worker and the main thread (or
|
|
59
|
+
* whatever other realm calls {@link loadForm}).
|
|
60
|
+
*
|
|
61
|
+
* @todo We can almost certainly address the scoping caveat! We'll probably
|
|
62
|
+
* want to design for that as part of offline support.
|
|
63
|
+
*/
|
|
64
|
+
readonly fetchFormAttachment?: FetchFormAttachment;
|
|
65
|
+
/**
|
|
66
|
+
* @see {@link MissingResourceBehavior}
|
|
67
|
+
* @see {@link MissingResourceBehaviorDefault}
|
|
68
|
+
*
|
|
69
|
+
* @default MissingResourceBehaviorDefault
|
|
70
|
+
*/
|
|
71
|
+
readonly missingResourceBehavior?: MissingResourceBehavior;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Note: loading a form produce a {@link Promise} which **will never reject**.
|
|
75
|
+
* Rather than rejecting, any errors encountered in the process of loading a
|
|
76
|
+
* form will be **resolved**, in a
|
|
77
|
+
* {@link LoadFormFailureResult.error | FormLoadFailureResult error}.
|
|
78
|
+
*/
|
|
79
|
+
export type LoadForm = (formResource: FormResource, options?: LoadFormOptions) => FormLoadPromise<LoadFormResult>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { UnknownObject } from '../../../../common/src/lib/type-assertions/assertUnknownObject.ts';
|
|
2
|
+
import { AnyFunction } from '../../../../common/types/helpers.js';
|
|
3
|
+
import { LoadFormFailureError } from '../../error/LoadFormFailureError.ts';
|
|
4
|
+
import { CreateFormInstance } from './CreateFormInstance.ts';
|
|
5
|
+
import { EditFormInstance } from './EditFormInstance.ts';
|
|
6
|
+
import { RestoreFormInstance } from './RestoreFormInstance.ts';
|
|
7
|
+
export type { LoadFormFailureError };
|
|
8
|
+
export type FormResultStatus = 'success' | 'warning' | 'failure';
|
|
9
|
+
/**
|
|
10
|
+
* @todo Pending design and modeling of warning cases.
|
|
11
|
+
*/
|
|
12
|
+
export type LoadFormWarnings = UnknownObject;
|
|
13
|
+
type FailedLoadFormResultMethodParameters<T extends AnyFunction> = readonly never[] & (Parameters<T> extends {
|
|
14
|
+
readonly length: infer Length extends number;
|
|
15
|
+
} ? {
|
|
16
|
+
readonly length: Length;
|
|
17
|
+
} : never);
|
|
18
|
+
export type FailedLoadFormResultMethod<T extends AnyFunction> = (...args: FailedLoadFormResultMethodParameters<T>) => never;
|
|
19
|
+
export type FallibleLoadFormResultMethod<T extends AnyFunction> = T | FailedLoadFormResultMethod<T>;
|
|
20
|
+
interface BaseLoadFormResult {
|
|
21
|
+
readonly status: FormResultStatus;
|
|
22
|
+
readonly warnings: LoadFormWarnings | null;
|
|
23
|
+
readonly error: LoadFormFailureError | null;
|
|
24
|
+
readonly createInstance: FallibleLoadFormResultMethod<CreateFormInstance>;
|
|
25
|
+
readonly editInstance: FallibleLoadFormResultMethod<EditFormInstance>;
|
|
26
|
+
readonly restoreInstance: FallibleLoadFormResultMethod<RestoreFormInstance>;
|
|
27
|
+
}
|
|
28
|
+
export interface LoadFormSuccessResult extends BaseLoadFormResult {
|
|
29
|
+
readonly status: 'success';
|
|
30
|
+
readonly warnings: null;
|
|
31
|
+
readonly error: null;
|
|
32
|
+
readonly createInstance: CreateFormInstance;
|
|
33
|
+
readonly editInstance: EditFormInstance;
|
|
34
|
+
readonly restoreInstance: RestoreFormInstance;
|
|
35
|
+
}
|
|
36
|
+
export interface LoadFormWarningResult extends BaseLoadFormResult {
|
|
37
|
+
readonly status: 'warning';
|
|
38
|
+
readonly warnings: LoadFormWarnings;
|
|
39
|
+
readonly error: null;
|
|
40
|
+
readonly createInstance: CreateFormInstance;
|
|
41
|
+
readonly editInstance: EditFormInstance;
|
|
42
|
+
readonly restoreInstance: RestoreFormInstance;
|
|
43
|
+
}
|
|
44
|
+
export interface LoadFormFailureResult extends BaseLoadFormResult {
|
|
45
|
+
readonly status: 'failure';
|
|
46
|
+
readonly warnings: LoadFormWarnings | null;
|
|
47
|
+
readonly error: LoadFormFailureError;
|
|
48
|
+
/**
|
|
49
|
+
* @example A temporary demo integration was built during development of this
|
|
50
|
+
* interface.
|
|
51
|
+
*
|
|
52
|
+
* @see
|
|
53
|
+
* {@link https://github.com/getodk/web-forms/pull/345/commits/9ef36355d89dd1450d3a87c3a55506bb9b0fc414}
|
|
54
|
+
*/
|
|
55
|
+
readonly createInstance: FailedLoadFormResultMethod<CreateFormInstance>;
|
|
56
|
+
readonly editInstance: FailedLoadFormResultMethod<EditFormInstance>;
|
|
57
|
+
/**
|
|
58
|
+
* @example A temporary demo integration was built during development of this
|
|
59
|
+
* interface.
|
|
60
|
+
*
|
|
61
|
+
* @see
|
|
62
|
+
* {@link https://github.com/getodk/web-forms/pull/345/commits/9ef36355d89dd1450d3a87c3a55506bb9b0fc414}
|
|
63
|
+
*/
|
|
64
|
+
readonly restoreInstance: FailedLoadFormResultMethod<RestoreFormInstance>;
|
|
65
|
+
}
|
|
66
|
+
export type InstantiableLoadFormResult = LoadFormSuccessResult | LoadFormWarningResult;
|
|
67
|
+
export type LoadFormResult = InstantiableLoadFormResult | LoadFormFailureResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InstanceData } from '../serialization/InstanceData.ts';
|
|
2
|
+
import { FormInstance, FormInstanceRestoreMode } from './FormInstance.ts';
|
|
3
|
+
import { FormInstanceConfig } from './FormInstanceConfig.ts';
|
|
4
|
+
export interface RestoreFormInstanceInput {
|
|
5
|
+
readonly data: readonly [InstanceData, ...InstanceData[]];
|
|
6
|
+
}
|
|
7
|
+
export type RestoredFormInstance = FormInstance<FormInstanceRestoreMode>;
|
|
8
|
+
export type RestoreFormInstance = (input: RestoreFormInstanceInput, config?: FormInstanceConfig) => Promise<RestoredFormInstance>;
|
|
@@ -2,7 +2,8 @@ import { ExpandUnion } from '../../../common/types/helpers.d.ts';
|
|
|
2
2
|
import { GroupNode } from './GroupNode.ts';
|
|
3
3
|
import { AnyInputNode } from './InputNode.ts';
|
|
4
4
|
import { AnyModelValueNode } from './ModelValueNode.ts';
|
|
5
|
-
import {
|
|
5
|
+
import { AnyNoteNode } from './NoteNode.ts';
|
|
6
|
+
import { AnyRangeNode } from './RangeNode.ts';
|
|
6
7
|
import { RepeatInstanceNode } from './repeat/RepeatInstanceNode.ts';
|
|
7
8
|
import { RepeatRangeControlledNode } from './repeat/RepeatRangeControlledNode.ts';
|
|
8
9
|
import { RepeatRangeUncontrolledNode } from './repeat/RepeatRangeUncontrolledNode.ts';
|
|
@@ -10,11 +11,10 @@ import { RootNode } from './RootNode.ts';
|
|
|
10
11
|
import { SelectNode } from './SelectNode.ts';
|
|
11
12
|
import { SubtreeNode } from './SubtreeNode.ts';
|
|
12
13
|
import { TriggerNode } from './TriggerNode.ts';
|
|
13
|
-
import {
|
|
14
|
-
import { RankNode } from './unsupported/RankNode.ts';
|
|
14
|
+
import { RankNode } from './RankNode.ts';
|
|
15
15
|
import { UploadNode } from './unsupported/UploadNode.ts';
|
|
16
|
-
export type AnyUnsupportedControlNode =
|
|
17
|
-
export type AnyControlNode = AnyInputNode |
|
|
16
|
+
export type AnyUnsupportedControlNode = UploadNode;
|
|
17
|
+
export type AnyControlNode = AnyInputNode | AnyNoteNode | AnyRangeNode | RankNode | SelectNode | TriggerNode;
|
|
18
18
|
export type AnyLeafNode = AnyControlNode | AnyModelValueNode | AnyUnsupportedControlNode;
|
|
19
19
|
export type RepeatRangeNode = RepeatRangeControlledNode | RepeatRangeUncontrolledNode;
|
|
20
20
|
/**
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
export type
|
|
1
|
+
export type * from './constants.ts';
|
|
2
|
+
export * as constants from './constants.ts';
|
|
3
|
+
export type * from './form/CreateFormInstance.ts';
|
|
4
|
+
export type * from './form/EditFormInstance.ts';
|
|
5
|
+
export type * from './form/FormInstance.ts';
|
|
6
|
+
export type * from './form/FormInstanceConfig.ts';
|
|
7
|
+
export type * from './form/FormResource.ts';
|
|
8
|
+
export type * from './form/LoadForm.ts';
|
|
9
|
+
export type * from './form/LoadFormResult.ts';
|
|
10
|
+
export type * from './form/RestoreFormInstance.ts';
|
|
11
|
+
export type * from './FormLanguage.ts';
|
|
12
|
+
export type * from './GroupNode.ts';
|
|
13
|
+
export type { AnyChildNode, AnyControlNode, AnyLeafNode, AnyNode, AnyParentNode, AnyUnsupportedControlNode, GeneralChildNode, GeneralParentNode, RepeatRangeNode, } from './hierarchy.ts';
|
|
14
|
+
export type * from './InputNode.ts';
|
|
15
|
+
export type * from './ModelValueNode.ts';
|
|
16
|
+
export type * from './NoteNode.ts';
|
|
17
|
+
export type * from './OpaqueReactiveObjectFactory.ts';
|
|
18
|
+
export type * from './RangeNode.ts';
|
|
19
|
+
export type * from './RankNode.ts';
|
|
20
|
+
export type * from './repeat/RepeatInstanceNode.ts';
|
|
21
|
+
export type * from './repeat/RepeatRangeControlledNode.ts';
|
|
22
|
+
export type * from './repeat/RepeatRangeUncontrolledNode.ts';
|
|
23
|
+
export type * from './resources.ts';
|
|
24
|
+
export type * from './RootNode.ts';
|
|
25
|
+
export type * from './SelectNode.ts';
|
|
26
|
+
export type * from './serialization/InstanceData.ts';
|
|
27
|
+
export type * from './serialization/InstanceFile.ts';
|
|
28
|
+
export type * from './serialization/InstancePayload.ts';
|
|
29
|
+
export type * from './serialization/InstancePayloadOptions.ts';
|
|
30
|
+
export type * from './serialization/InstanceState.ts';
|
|
31
|
+
export type * from './submission/SubmissionMeta.ts';
|
|
32
|
+
export type * from './SubtreeNode.ts';
|
|
33
|
+
export type * from './TextRange.ts';
|
|
34
|
+
export type * from './TriggerNode.ts';
|
|
35
|
+
export type * from './unsupported/UploadNode.ts';
|
|
36
|
+
export type * from './validation.ts';
|
|
37
|
+
export type * from './ValueType.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type UnsupportedControlNodeType = '
|
|
1
|
+
export type UnsupportedControlNodeType = 'upload';
|
|
2
2
|
export type RepeatRangeNodeType = 'repeat-range:controlled' | 'repeat-range:uncontrolled';
|
|
3
|
-
export type LeafNodeType = 'model-value' | 'note' | 'select' | 'input' | 'trigger' | UnsupportedControlNodeType;
|
|
3
|
+
export type LeafNodeType = 'model-value' | 'note' | 'select' | 'input' | 'trigger' | 'range' | 'rank' | UnsupportedControlNodeType;
|
|
4
4
|
export type InstanceNodeType = 'root' | RepeatRangeNodeType | 'repeat-instance' | 'group' | 'subtree' | LeafNodeType | UnsupportedControlNodeType;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AnyRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
2
1
|
import { BaseNode, BaseNodeState } from '../BaseNode.ts';
|
|
3
2
|
import { NodeAppearances } from '../NodeAppearances.ts';
|
|
4
3
|
import { RootNode } from '../RootNode.ts';
|
|
@@ -6,7 +5,7 @@ import { TextRange } from '../TextRange.ts';
|
|
|
6
5
|
import { GeneralParentNode } from '../hierarchy.ts';
|
|
7
6
|
import { RepeatRangeNodeType } from '../node-types.ts';
|
|
8
7
|
import { AncestorNodeValidationState } from '../validation.ts';
|
|
9
|
-
import { RepeatInstanceNode } from './RepeatInstanceNode.ts';
|
|
8
|
+
import { AnyRepeatDefinition, RepeatInstanceNode } from './RepeatInstanceNode.ts';
|
|
10
9
|
export interface BaseRepeatRangeNodeState extends BaseNodeState {
|
|
11
10
|
get hint(): null;
|
|
12
11
|
get label(): TextRange<'label'> | null;
|
|
@@ -22,7 +21,7 @@ export interface BaseRepeatRangeNodeState extends BaseNodeState {
|
|
|
22
21
|
get valueOptions(): null;
|
|
23
22
|
get value(): null;
|
|
24
23
|
}
|
|
25
|
-
export type RepeatRangeNodeAppearances = NodeAppearances<
|
|
24
|
+
export type RepeatRangeNodeAppearances = NodeAppearances<AnyRepeatDefinition>;
|
|
26
25
|
/**
|
|
27
26
|
* Represents a contiguous set of zero or more {@link RepeatInstanceNode}s
|
|
28
27
|
* (accessed by its
|
|
@@ -90,7 +89,7 @@ export type RepeatRangeNodeAppearances = NodeAppearances<AnyRepeatRangeDefinitio
|
|
|
90
89
|
export interface BaseRepeatRangeNode extends BaseNode {
|
|
91
90
|
readonly nodeType: RepeatRangeNodeType;
|
|
92
91
|
readonly appearances: RepeatRangeNodeAppearances;
|
|
93
|
-
readonly definition:
|
|
92
|
+
readonly definition: AnyRepeatDefinition;
|
|
94
93
|
readonly root: RootNode;
|
|
95
94
|
readonly parent: GeneralParentNode;
|
|
96
95
|
readonly currentState: BaseRepeatRangeNodeState;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RepeatTemplateDefinition } from '../../parse/model/RepeatTemplateDefinition.ts';
|
|
1
|
+
import { AnyRepeatDefinition } from '../../parse/model/RepeatDefinition.ts';
|
|
3
2
|
import { BaseNode, BaseNodeState } from '../BaseNode.ts';
|
|
4
3
|
import { GeneralChildNode, RepeatRangeNode } from '../hierarchy.ts';
|
|
5
4
|
import { NodeAppearances } from '../NodeAppearances.ts';
|
|
@@ -11,12 +10,12 @@ export interface RepeatInstanceNodeState extends BaseNodeState {
|
|
|
11
10
|
get valueOptions(): null;
|
|
12
11
|
get value(): null;
|
|
13
12
|
}
|
|
14
|
-
export type
|
|
15
|
-
export type RepeatInstanceNodeAppearances = NodeAppearances<
|
|
13
|
+
export type { AnyRepeatDefinition };
|
|
14
|
+
export type RepeatInstanceNodeAppearances = NodeAppearances<AnyRepeatDefinition>;
|
|
16
15
|
export interface RepeatInstanceNode extends BaseNode {
|
|
17
16
|
readonly nodeType: 'repeat-instance';
|
|
18
17
|
readonly appearances: RepeatInstanceNodeAppearances;
|
|
19
|
-
readonly definition:
|
|
18
|
+
readonly definition: AnyRepeatDefinition;
|
|
20
19
|
readonly root: RootNode;
|
|
21
20
|
/**
|
|
22
21
|
* A repeat instance may only be a child of a {@link RepeatRangeNode}.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ControlledRepeatDefinition } from '../../parse/model/RepeatDefinition.ts';
|
|
2
2
|
import { BaseRepeatRangeNode, BaseRepeatRangeNodeState } from './BaseRepeatRangeNode.ts';
|
|
3
3
|
/**
|
|
4
4
|
* {@inheritDoc BaseRepeatRangeNodeState}
|
|
@@ -14,5 +14,5 @@ export interface RepeatRangeControlledState extends BaseRepeatRangeNodeState {
|
|
|
14
14
|
*/
|
|
15
15
|
export interface RepeatRangeControlledNode extends BaseRepeatRangeNode {
|
|
16
16
|
readonly nodeType: 'repeat-range:controlled';
|
|
17
|
-
readonly definition:
|
|
17
|
+
readonly definition: ControlledRepeatDefinition;
|
|
18
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UncontrolledRepeatDefinition } from '../../parse/model/RepeatDefinition.ts';
|
|
2
2
|
import { RootNode } from '../RootNode.ts';
|
|
3
3
|
import { BaseRepeatRangeNode, BaseRepeatRangeNodeState } from './BaseRepeatRangeNode.ts';
|
|
4
4
|
/**
|
|
@@ -13,7 +13,7 @@ export interface RepeatRangeUncontrolledState extends BaseRepeatRangeNodeState {
|
|
|
13
13
|
*/
|
|
14
14
|
export interface RepeatRangeUncontrolledNode extends BaseRepeatRangeNode {
|
|
15
15
|
readonly nodeType: 'repeat-range:uncontrolled';
|
|
16
|
-
readonly definition:
|
|
16
|
+
readonly definition: UncontrolledRepeatDefinition;
|
|
17
17
|
addInstances(afterIndex?: number, count?: number): RootNode;
|
|
18
18
|
removeInstances(startIndex: number, count?: number): RootNode;
|
|
19
19
|
}
|
|
@@ -65,7 +65,7 @@ export interface FetchResourceResponseHeaders {
|
|
|
65
65
|
*
|
|
66
66
|
* Furthermore, if the engine intends to read {@link body} (or its indirect
|
|
67
67
|
* {@link blob} or {@link text} consumers), it will do so in the course of a
|
|
68
|
-
* client's call to {@link
|
|
68
|
+
* client's call to {@link loadForm}, and before the
|
|
69
69
|
* {@link Promise<PrimaryInstance>} returned by that call is resolved.
|
|
70
70
|
*/
|
|
71
71
|
export interface FetchResourceResponse {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { INSTANCE_FILE_NAME, InstanceFile } from './InstanceFile.ts';
|
|
2
|
+
export type InstanceAttachmentFileName = string;
|
|
3
|
+
export interface InstanceData extends FormData {
|
|
4
|
+
get(name: INSTANCE_FILE_NAME): InstanceFile;
|
|
5
|
+
/**
|
|
6
|
+
* @todo Can we guarantee (both in static types and at runtime) that
|
|
7
|
+
* {@link InstanceData} only contains files?
|
|
8
|
+
*/
|
|
9
|
+
get(name: InstanceAttachmentFileName): FormDataEntryValue | null;
|
|
10
|
+
has(name: INSTANCE_FILE_NAME): true;
|
|
11
|
+
has(name: InstanceAttachmentFileName): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { SubmissionMeta } from '../submission/SubmissionMeta.ts';
|
|
2
|
+
import { DescendantNodeViolationReference } from '../validation.ts';
|
|
3
|
+
import { InstanceData } from './InstanceData.ts';
|
|
4
|
+
import { InstancePayloadType } from './InstancePayloadOptions.ts';
|
|
5
|
+
export type InstancePayloadStatus = 'pending' | 'max-size-exceeded' | 'ready';
|
|
6
|
+
type InstancePayloadData<PayloadType extends InstancePayloadType> = {
|
|
7
|
+
chunked: readonly [InstanceData, ...InstanceData[]];
|
|
8
|
+
monolithic: readonly [InstanceData];
|
|
9
|
+
}[PayloadType];
|
|
10
|
+
/**
|
|
11
|
+
* Provides detail about an individual instance attachment {@link File}s which
|
|
12
|
+
* exceeds the client-specified {@link maxSize} for a
|
|
13
|
+
* {@link ChunkedInstancePayload | chunked instance payload}. Clients may use
|
|
14
|
+
* 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 when
|
|
18
|
+
* serializing an instance payload; and then (b) treating a maximum size
|
|
19
|
+
* violation as another kind of node-level violation. This would go beyond the
|
|
20
|
+
* kinds of validation specified by ODK XForms, but it would make a lot of
|
|
21
|
+
* _conceptual sense_.
|
|
22
|
+
*
|
|
23
|
+
* It would almost certainly be helpful to alert users to violations as the
|
|
24
|
+
* occur, rather than only at instance payload serialization time (where they
|
|
25
|
+
* have likely already moved on). This is something clients can do without
|
|
26
|
+
* engine support, but it would likely promote good usability patterns if the
|
|
27
|
+
* engine makes it an obvious and uniform option at the main engine/client
|
|
28
|
+
* entrypoint.
|
|
29
|
+
*
|
|
30
|
+
* @todo If we consider the above, we'd want to reframe _this interface_ to
|
|
31
|
+
* match the shape of other {@link AnyViolation | violations} (adding it as a
|
|
32
|
+
* member of that union). We'd also likely eliminate
|
|
33
|
+
* {@link MaxSizeExceededResult} in the process, since
|
|
34
|
+
* {@link PendingInstancePayload} would then cover the case.
|
|
35
|
+
*/
|
|
36
|
+
interface MaxSizeViolation {
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the index of
|
|
39
|
+
* {@link InstancePayloadData<'chunked'> | chunked instance payload data}
|
|
40
|
+
* where an instance attachment {@link File} exceeds the client-specified
|
|
41
|
+
* {@link maxSize}.
|
|
42
|
+
*/
|
|
43
|
+
readonly dataIndex: number;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies the name of the file which exceeds the client-specified
|
|
46
|
+
* {@link maxSize}. This name can also be used as a key to access the
|
|
47
|
+
* violating {@link File}/instance attachment, in the {@link InstanceData} at
|
|
48
|
+
* the specified {@link dataIndex}.
|
|
49
|
+
*/
|
|
50
|
+
readonly fileName: string;
|
|
51
|
+
/**
|
|
52
|
+
* Reflects the client-specified maximum size for each chunk of a
|
|
53
|
+
* {@link ChunkedInstancePayload | chunked instance payload}.
|
|
54
|
+
*/
|
|
55
|
+
readonly maxSize: number;
|
|
56
|
+
/**
|
|
57
|
+
* Details the actual size of the violating {@link File}/instance attachment.
|
|
58
|
+
* Along with {@link maxSize}. Clients may use the delta between this value
|
|
59
|
+
* and {@link maxSize} to provide detailed guidance to users.
|
|
60
|
+
*/
|
|
61
|
+
readonly actualSize: number;
|
|
62
|
+
}
|
|
63
|
+
type InstancePayloadViolation = DescendantNodeViolationReference | MaxSizeViolation;
|
|
64
|
+
interface BaseInstancePayload<PayloadType extends InstancePayloadType> {
|
|
65
|
+
readonly payloadType: PayloadType;
|
|
66
|
+
readonly status: InstancePayloadStatus;
|
|
67
|
+
readonly submissionMeta: SubmissionMeta;
|
|
68
|
+
get violations(): readonly InstancePayloadViolation[] | null;
|
|
69
|
+
/**
|
|
70
|
+
* Instance attachment data may be chunked according to the
|
|
71
|
+
* {@link InstancePayloadOptions.maxSize | maxSize instance payload option}
|
|
72
|
+
*/
|
|
73
|
+
readonly data: InstancePayloadData<PayloadType>;
|
|
74
|
+
}
|
|
75
|
+
interface PendingInstancePayload<PayloadType extends InstancePayloadType> extends BaseInstancePayload<PayloadType> {
|
|
76
|
+
readonly status: 'pending';
|
|
77
|
+
get violations(): readonly DescendantNodeViolationReference[];
|
|
78
|
+
}
|
|
79
|
+
interface MaxSizeExceededResult extends BaseInstancePayload<'chunked'> {
|
|
80
|
+
readonly status: 'max-size-exceeded';
|
|
81
|
+
get violations(): readonly MaxSizeViolation[];
|
|
82
|
+
}
|
|
83
|
+
interface ReadyInstancePayload<PayloadType extends InstancePayloadType> extends BaseInstancePayload<PayloadType> {
|
|
84
|
+
readonly status: 'ready';
|
|
85
|
+
get violations(): null;
|
|
86
|
+
}
|
|
87
|
+
export type ChunkedInstancePayload = MaxSizeExceededResult | PendingInstancePayload<'chunked'> | ReadyInstancePayload<'chunked'>;
|
|
88
|
+
export type MonolithicInstancePayload = PendingInstancePayload<'monolithic'> | ReadyInstancePayload<'monolithic'>;
|
|
89
|
+
export type InstancePayload<PayloadType extends InstancePayloadType> = {
|
|
90
|
+
chunked: ChunkedInstancePayload;
|
|
91
|
+
monolithic: MonolithicInstancePayload;
|
|
92
|
+
}[PayloadType];
|
|
93
|
+
export {};
|