@getodk/xforms-engine 0.7.0 → 0.9.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/InputNode.d.ts +4 -2
- package/dist/client/NoteNode.d.ts +4 -2
- package/dist/client/RootNode.d.ts +4 -4
- package/dist/client/UploadNode.d.ts +53 -0
- package/dist/client/attachments/InstanceAttachmentMeta.d.ts +8 -0
- package/dist/client/attachments/InstanceAttachmentsConfig.d.ts +8 -0
- package/dist/client/form/FormInstanceConfig.d.ts +2 -0
- package/dist/client/hierarchy.d.ts +4 -5
- package/dist/client/index.d.ts +5 -2
- package/dist/client/node-types.d.ts +2 -3
- package/dist/client/serialization/InstanceData.d.ts +7 -5
- package/dist/client/serialization/InstancePayloadOptions.d.ts +3 -2
- package/dist/error/UploadValueTypeError.d.ts +8 -0
- package/dist/index.js +16938 -29914
- package/dist/index.js.map +1 -1
- package/dist/instance/PrimaryInstance.d.ts +2 -3
- package/dist/instance/UploadControl.d.ts +58 -0
- package/dist/instance/attachments/InstanceAttachment.d.ts +42 -0
- package/dist/instance/attachments/InstanceAttachmentsState.d.ts +9 -0
- package/dist/instance/hierarchy.d.ts +6 -7
- package/dist/instance/internal-api/InstanceAttachmentContext.d.ts +19 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +2 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableInstance.d.ts +2 -0
- package/dist/integration/xpath/adapter/traversal.d.ts +2 -2
- package/dist/lib/codecs/DateValueCodec.d.ts +7 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +3 -2
- package/dist/lib/reactivity/createInstanceAttachment.d.ts +8 -0
- package/dist/lib/resource-helpers.d.ts +2 -0
- package/dist/parse/body/BodyDefinition.d.ts +2 -1
- package/dist/parse/body/control/UploadControlDefinition.d.ts +2 -0
- package/dist/parse/model/BindTypeDefinition.d.ts +2 -7
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +1 -1
- package/dist/solid.js +16935 -29912
- package/dist/solid.js.map +1 -1
- package/package.json +16 -14
- package/src/client/InputNode.ts +4 -0
- package/src/client/NoteNode.ts +4 -0
- package/src/client/RootNode.ts +8 -3
- package/src/client/UploadNode.ts +78 -0
- package/src/client/attachments/InstanceAttachmentMeta.ts +10 -0
- package/src/client/attachments/InstanceAttachmentsConfig.ts +13 -0
- package/src/client/form/FormInstanceConfig.ts +3 -0
- package/src/client/hierarchy.ts +5 -8
- package/src/client/index.ts +4 -2
- package/src/client/node-types.ts +2 -5
- package/src/client/serialization/InstanceData.ts +14 -6
- package/src/client/serialization/InstancePayloadOptions.ts +3 -2
- package/src/entrypoints/FormInstance.ts +3 -2
- package/src/error/UploadValueTypeError.ts +13 -0
- package/src/instance/PrimaryInstance.ts +4 -5
- package/src/instance/UploadControl.ts +184 -0
- package/src/instance/attachments/InstanceAttachment.ts +69 -0
- package/src/instance/attachments/InstanceAttachmentsState.ts +18 -0
- package/src/instance/children/buildChildren.ts +5 -8
- package/src/instance/hierarchy.ts +6 -9
- package/src/instance/input/InstanceAttachmentMap.ts +33 -21
- package/src/instance/internal-api/InstanceAttachmentContext.ts +20 -0
- package/src/instance/internal-api/InstanceConfig.ts +3 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableInstance.ts +2 -0
- package/src/integration/xpath/adapter/traversal.ts +4 -2
- package/src/lib/client-reactivity/instance-state/prepareInstancePayload.ts +72 -8
- package/src/lib/codecs/DateValueCodec.ts +94 -0
- package/src/lib/codecs/getSharedValueCodec.ts +5 -3
- package/src/lib/reactivity/createInstanceAttachment.ts +212 -0
- package/src/lib/resource-helpers.ts +33 -0
- package/src/parse/XFormDOM.ts +1 -3
- package/src/parse/body/BodyDefinition.ts +4 -0
- package/src/parse/body/control/UploadControlDefinition.ts +42 -0
- package/src/parse/model/BindDefinition.ts +1 -1
- package/src/parse/model/BindTypeDefinition.ts +68 -26
- package/src/parse/model/ModelBindMap.ts +0 -5
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.ts +1 -30
- package/src/parse/text/abstract/TextElementDefinition.ts +2 -2
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +0 -30
- package/dist/client/unsupported/UploadNode.d.ts +0 -9
- package/dist/instance/unsupported/UploadControl.d.ts +0 -34
- package/dist/lib/codecs/TempUnsupportedControlCodec.d.ts +0 -7
- package/src/client/unsupported/UnsupportedControlNode.ts +0 -36
- package/src/client/unsupported/UploadNode.ts +0 -14
- package/src/instance/unsupported/UploadControl.ts +0 -120
- package/src/lib/codecs/TempUnsupportedControlCodec.ts +0 -32
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { UnknownAppearanceDefinition } from '../../parse/body/appearance/unknownAppearanceParser.ts';
|
|
2
|
-
import type { UploadControlDefinition } from '../../parse/body/control/UploadControlDefinition.ts';
|
|
3
|
-
import type { LeafNodeDefinition } from '../../parse/model/LeafNodeDefinition.ts';
|
|
4
|
-
import type { BaseNode, BaseNodeState } from '../BaseNode.ts';
|
|
5
|
-
import type { RootNode } from '../RootNode.ts';
|
|
6
|
-
import type { GeneralParentNode } from '../hierarchy.ts';
|
|
7
|
-
import type { UnsupportedControlNodeType } from '../node-types.ts';
|
|
8
|
-
import type { LeafNodeValidationState } from '../validation.ts';
|
|
9
|
-
|
|
10
|
-
export interface UnsupportedControlNodeState extends BaseNodeState {
|
|
11
|
-
get children(): null;
|
|
12
|
-
get valueOptions(): unknown;
|
|
13
|
-
get value(): unknown;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// prettier-ignore
|
|
17
|
-
export type UnsupportedControlElementDefinition = UploadControlDefinition;
|
|
18
|
-
|
|
19
|
-
export interface UnsupportedControlDefinition extends LeafNodeDefinition {
|
|
20
|
-
readonly bodyElement: UnsupportedControlElementDefinition;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Stub node, for form controls pending further engine support.
|
|
25
|
-
*/
|
|
26
|
-
export interface UnsupportedControlNode extends BaseNode {
|
|
27
|
-
readonly nodeType: UnsupportedControlNodeType;
|
|
28
|
-
readonly appearances: UnknownAppearanceDefinition;
|
|
29
|
-
readonly definition: UnsupportedControlDefinition;
|
|
30
|
-
readonly root: RootNode;
|
|
31
|
-
readonly parent: GeneralParentNode;
|
|
32
|
-
readonly currentState: UnsupportedControlNodeState;
|
|
33
|
-
readonly validationState: LeafNodeValidationState;
|
|
34
|
-
|
|
35
|
-
setValue?(value: never): never;
|
|
36
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { UploadControlDefinition } from '../../parse/body/control/UploadControlDefinition.ts';
|
|
2
|
-
import type {
|
|
3
|
-
UnsupportedControlDefinition,
|
|
4
|
-
UnsupportedControlNode,
|
|
5
|
-
} from './UnsupportedControlNode.ts';
|
|
6
|
-
|
|
7
|
-
export interface UploadNodeDefinition extends UnsupportedControlDefinition {
|
|
8
|
-
readonly bodyElement: UploadControlDefinition;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface UploadNode extends UnsupportedControlNode {
|
|
12
|
-
readonly nodeType: 'upload';
|
|
13
|
-
readonly definition: UploadNodeDefinition;
|
|
14
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
-
import type { Accessor } from 'solid-js';
|
|
3
|
-
import type { TextRange } from '../../client/TextRange.ts';
|
|
4
|
-
import type { ValueType } from '../../client/ValueType.ts';
|
|
5
|
-
import type { UnsupportedControlNodeType } from '../../client/node-types.ts';
|
|
6
|
-
import type { UploadNode, UploadNodeDefinition } from '../../client/unsupported/UploadNode.ts';
|
|
7
|
-
import type { XFormsXPathElement } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
8
|
-
import type { StaticLeafElement } from '../../integration/xpath/static-dom/StaticElement.ts';
|
|
9
|
-
import type {
|
|
10
|
-
TempUnsupportedInputValue,
|
|
11
|
-
TempUnsupportedRuntimeValue,
|
|
12
|
-
} from '../../lib/codecs/TempUnsupportedControlCodec.ts';
|
|
13
|
-
import { TempUnsupportedControlCodec } from '../../lib/codecs/TempUnsupportedControlCodec.ts';
|
|
14
|
-
import type { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
|
|
15
|
-
import type { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
|
|
16
|
-
import type { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
17
|
-
import { createSharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
18
|
-
import { createFieldHint } from '../../lib/reactivity/text/createFieldHint.ts';
|
|
19
|
-
import { createNodeLabel } from '../../lib/reactivity/text/createNodeLabel.ts';
|
|
20
|
-
import type { UnknownAppearanceDefinition } from '../../parse/body/appearance/unknownAppearanceParser.ts';
|
|
21
|
-
import { ValueNode, type ValueNodeStateSpec } from '../abstract/ValueNode.ts';
|
|
22
|
-
import type { GeneralParentNode } from '../hierarchy.ts';
|
|
23
|
-
import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
24
|
-
import type { ValidationContext } from '../internal-api/ValidationContext.ts';
|
|
25
|
-
import type { ClientReactiveSerializableValueNode } from '../internal-api/serialization/ClientReactiveSerializableValueNode.ts';
|
|
26
|
-
|
|
27
|
-
interface UploadControlStateSpec extends ValueNodeStateSpec<TempUnsupportedRuntimeValue> {
|
|
28
|
-
readonly label: Accessor<TextRange<'label'> | null>;
|
|
29
|
-
readonly hint: Accessor<TextRange<'hint'> | null>;
|
|
30
|
-
readonly valueOptions: null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const codecs = {
|
|
34
|
-
string: new TempUnsupportedControlCodec('string'),
|
|
35
|
-
int: new TempUnsupportedControlCodec('int'),
|
|
36
|
-
decimal: new TempUnsupportedControlCodec('decimal'),
|
|
37
|
-
boolean: new TempUnsupportedControlCodec('boolean'),
|
|
38
|
-
date: new TempUnsupportedControlCodec('date'),
|
|
39
|
-
time: new TempUnsupportedControlCodec('time'),
|
|
40
|
-
dateTime: new TempUnsupportedControlCodec('dateTime'),
|
|
41
|
-
geopoint: new TempUnsupportedControlCodec('geopoint'),
|
|
42
|
-
geotrace: new TempUnsupportedControlCodec('geotrace'),
|
|
43
|
-
geoshape: new TempUnsupportedControlCodec('geoshape'),
|
|
44
|
-
binary: new TempUnsupportedControlCodec('binary'),
|
|
45
|
-
barcode: new TempUnsupportedControlCodec('barcode'),
|
|
46
|
-
intent: new TempUnsupportedControlCodec('intent'),
|
|
47
|
-
} as const;
|
|
48
|
-
|
|
49
|
-
class UnsupportedControlWriteError extends Error {
|
|
50
|
-
constructor(type: UnsupportedControlNodeType) {
|
|
51
|
-
super(`Cannot write state for node (type: ${type}) - not implemented`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export class UploadControl
|
|
56
|
-
extends ValueNode<
|
|
57
|
-
ValueType,
|
|
58
|
-
UploadNodeDefinition,
|
|
59
|
-
TempUnsupportedRuntimeValue,
|
|
60
|
-
TempUnsupportedInputValue
|
|
61
|
-
>
|
|
62
|
-
implements
|
|
63
|
-
UploadNode,
|
|
64
|
-
XFormsXPathElement,
|
|
65
|
-
EvaluationContext,
|
|
66
|
-
ValidationContext,
|
|
67
|
-
ClientReactiveSerializableValueNode
|
|
68
|
-
{
|
|
69
|
-
// XFormsXPathElement
|
|
70
|
-
override readonly [XPathNodeKindKey] = 'element';
|
|
71
|
-
|
|
72
|
-
// InstanceNode
|
|
73
|
-
protected readonly state: SharedNodeState<UploadControlStateSpec>;
|
|
74
|
-
protected readonly engineState: EngineState<UploadControlStateSpec>;
|
|
75
|
-
|
|
76
|
-
// UploadNode
|
|
77
|
-
readonly nodeType = 'upload';
|
|
78
|
-
readonly appearances: UnknownAppearanceDefinition;
|
|
79
|
-
readonly nodeOptions = null;
|
|
80
|
-
readonly currentState: CurrentState<UploadControlStateSpec>;
|
|
81
|
-
|
|
82
|
-
constructor(
|
|
83
|
-
parent: GeneralParentNode,
|
|
84
|
-
instanceNode: StaticLeafElement | null,
|
|
85
|
-
definition: UploadNodeDefinition
|
|
86
|
-
) {
|
|
87
|
-
const codec = codecs[definition.valueType];
|
|
88
|
-
|
|
89
|
-
super(parent, instanceNode, definition, codec);
|
|
90
|
-
|
|
91
|
-
this.appearances = definition.bodyElement.appearances;
|
|
92
|
-
|
|
93
|
-
const state = createSharedNodeState(
|
|
94
|
-
this.scope,
|
|
95
|
-
{
|
|
96
|
-
reference: this.contextReference,
|
|
97
|
-
readonly: this.isReadonly,
|
|
98
|
-
relevant: this.isRelevant,
|
|
99
|
-
required: this.isRequired,
|
|
100
|
-
|
|
101
|
-
label: createNodeLabel(this, definition),
|
|
102
|
-
hint: createFieldHint(this, definition),
|
|
103
|
-
children: null,
|
|
104
|
-
valueOptions: null,
|
|
105
|
-
value: this.valueState,
|
|
106
|
-
instanceValue: this.getInstanceValue,
|
|
107
|
-
},
|
|
108
|
-
this.instanceConfig
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
this.state = state;
|
|
112
|
-
this.engineState = state.engineState;
|
|
113
|
-
this.currentState = state.currentState;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// UnsupportedControlNode
|
|
117
|
-
setValue(_: never): never {
|
|
118
|
-
throw new UnsupportedControlWriteError(this.nodeType);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { identity } from '@getodk/common/lib/identity.ts';
|
|
2
|
-
import type { ValueType } from '../../client/ValueType.ts';
|
|
3
|
-
import { ValueCodec, type CodecDecoder, type CodecEncoder } from './ValueCodec.ts';
|
|
4
|
-
|
|
5
|
-
class TempUnsupportedControlEncodeError extends Error {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(`Cannot encode state: not implemented`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type TempUnsupportedRuntimeValue = unknown;
|
|
12
|
-
export type TempUnsupportedInputValue = unknown;
|
|
13
|
-
|
|
14
|
-
export class TempUnsupportedControlCodec<V extends ValueType> extends ValueCodec<
|
|
15
|
-
V,
|
|
16
|
-
TempUnsupportedRuntimeValue,
|
|
17
|
-
TempUnsupportedInputValue
|
|
18
|
-
> {
|
|
19
|
-
constructor(valueType: V) {
|
|
20
|
-
const encodeValue: CodecEncoder<TempUnsupportedRuntimeValue> = (input): string => {
|
|
21
|
-
if (typeof input === 'string') {
|
|
22
|
-
return input;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw new TempUnsupportedControlEncodeError();
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const decodeValue: CodecDecoder<TempUnsupportedInputValue> = identity;
|
|
29
|
-
|
|
30
|
-
super(valueType, encodeValue, decodeValue);
|
|
31
|
-
}
|
|
32
|
-
}
|