@spotto/contract 1.0.70-alpha.12 → 1.0.70-alpha.13
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.
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { FormItem,
|
|
1
|
+
import { FormItem, FormSettings } from '../../shared';
|
|
2
2
|
/**
|
|
3
3
|
* Publishes a new version of the form. `{id}` is the version document the
|
|
4
4
|
* editor loaded — the server inserts exactly `that.version + 1` and returns
|
|
5
5
|
* 409 when the head has moved ("form changed — reload"). Version documents
|
|
6
6
|
* themselves are never mutated. Omitted fields carry over from the loaded
|
|
7
7
|
* version; `name` is immutable. A present `settings` replaces the loaded
|
|
8
|
-
* version's wholesale
|
|
8
|
+
* version's wholesale — publish `{}` to clear it.
|
|
9
9
|
*/
|
|
10
10
|
export interface UpdateFormRequest {
|
|
11
11
|
label?: string;
|
|
12
12
|
items?: FormItem[];
|
|
13
|
-
prefill?: FormPrefillRow[];
|
|
14
|
-
writeBack?: FormWriteBackRow[];
|
|
15
13
|
settings?: FormSettings;
|
|
16
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IEntityMeta } from '../../shared';
|
|
2
|
-
import { FormItem,
|
|
2
|
+
import { FormItem, FormSettings } from '../shared';
|
|
3
3
|
import { GetFormsQuery } from './query';
|
|
4
4
|
/** One immutable form version document. */
|
|
5
5
|
export interface GetFormResponse {
|
|
@@ -12,8 +12,6 @@ export interface GetFormResponse {
|
|
|
12
12
|
current: boolean;
|
|
13
13
|
archived: boolean;
|
|
14
14
|
items: FormItem[];
|
|
15
|
-
prefill: FormPrefillRow[];
|
|
16
|
-
writeBack: FormWriteBackRow[];
|
|
17
15
|
settings?: FormSettings;
|
|
18
16
|
createdBy: string;
|
|
19
17
|
meta?: IEntityMeta;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { FormItem,
|
|
1
|
+
import { FormItem, FormSettings } from '../shared';
|
|
2
2
|
/** Creates a new form as version 1 (current). */
|
|
3
3
|
export interface PostFormRequest {
|
|
4
4
|
/** Immutable handle; referenced by actions. */
|
|
5
5
|
name: string;
|
|
6
6
|
label: string;
|
|
7
7
|
items: FormItem[];
|
|
8
|
-
prefill?: FormPrefillRow[];
|
|
9
|
-
writeBack?: FormWriteBackRow[];
|
|
10
8
|
settings?: FormSettings;
|
|
11
9
|
}
|
package/dist/forms/shared.d.ts
CHANGED
|
@@ -21,12 +21,33 @@ export interface FormFieldItem {
|
|
|
21
21
|
expression?: string;
|
|
22
22
|
/** Required (and only allowed) when source is CONTEXT. */
|
|
23
23
|
from?: ReservedContextFieldName;
|
|
24
|
-
/** Must be present to submit — only bites while the item is
|
|
24
|
+
/** Must be present to submit — only bites while the item is active. */
|
|
25
25
|
required?: boolean;
|
|
26
|
-
/** Shown, not editable (e.g.
|
|
26
|
+
/** Shown, not editable (e.g. a read-in shown purely for context). */
|
|
27
27
|
readonly?: boolean;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Open-time expression seeding the initial value — the one read-in
|
|
30
|
+
* mechanism. Naming a target field reads it in, including the item's own
|
|
31
|
+
* name (the form value is still empty at open, so the target shows
|
|
32
|
+
* through). A CHECKBOXES item's default must be exactly a field name (a
|
|
33
|
+
* copy — expressions cannot produce a selection).
|
|
34
|
+
*/
|
|
29
35
|
default?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Push the item's value to the same-named target field at submit — the
|
|
38
|
+
* captured value for INPUT, the derived value for COMPUTED. Only bites
|
|
39
|
+
* while the item is active (`visibleWhen`); written as ordinary authored
|
|
40
|
+
* data (user-editable afterward) and triggers the standard recompute.
|
|
41
|
+
*/
|
|
42
|
+
writeBack?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Never displayed; the item still participates fully — seeded, computed,
|
|
45
|
+
* required, written back. `visibleWhen`, if any, still gates activity
|
|
46
|
+
* (which is how a write-back is made conditional).
|
|
47
|
+
*/
|
|
48
|
+
hidden?: boolean;
|
|
49
|
+
/** The activity gate: a failing item is not shown, not required, and not
|
|
50
|
+
* written back. */
|
|
30
51
|
visibleWhen?: string;
|
|
31
52
|
/** Per-form display overrides; identity still comes from the definition. */
|
|
32
53
|
label?: string;
|
|
@@ -84,8 +105,8 @@ export declare type FormItem = FormFieldItem | FormSectionItem | FormTextItem |
|
|
|
84
105
|
export declare type FormItemKind = FormItem['kind'];
|
|
85
106
|
/**
|
|
86
107
|
* Runner presentation options — how the form presents its chrome, not what
|
|
87
|
-
* it collects. Optional as a whole, and PATCH replaces it wholesale
|
|
88
|
-
*
|
|
108
|
+
* it collects. Optional as a whole, and PATCH replaces it wholesale, so an
|
|
109
|
+
* option can be cleared by publishing without it.
|
|
89
110
|
*/
|
|
90
111
|
export interface FormSettings {
|
|
91
112
|
/** Overrides the submit button text (e.g. "Confirm"). */
|
|
@@ -97,32 +118,10 @@ export interface FormSettings {
|
|
|
97
118
|
/**
|
|
98
119
|
* Content-only: completing the form records NOTHING (no submission, no
|
|
99
120
|
* event, no write-back) — the server rejects a submission against it.
|
|
100
|
-
* Save-time validation forbids
|
|
101
|
-
* required items. For a recorded acknowledgment, use a
|
|
102
|
-
* form with a signature block and a "Confirm"
|
|
121
|
+
* Save-time validation forbids `writeBack: true` items, capture blocks
|
|
122
|
+
* and required items. For a recorded acknowledgment, use a
|
|
123
|
+
* non-informational form with a signature block and a "Confirm"
|
|
124
|
+
* submitLabel instead.
|
|
103
125
|
*/
|
|
104
126
|
informational?: boolean;
|
|
105
127
|
}
|
|
106
|
-
/**
|
|
107
|
-
* A read-in row: on open, seed form field `to` from the target — either a
|
|
108
|
-
* copy of target field `from` or an `expression` over the target's effective
|
|
109
|
-
* values (exactly one of the two), optionally gated by `when`.
|
|
110
|
-
*/
|
|
111
|
-
export interface FormPrefillRow {
|
|
112
|
-
to: string;
|
|
113
|
-
from?: string;
|
|
114
|
-
expression?: string;
|
|
115
|
-
when?: string;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* A write-back row: on submit, set target field `to` — either a copy of
|
|
119
|
-
* captured form value `from` or an `expression` over the merged env (exactly
|
|
120
|
-
* one of the two), optionally gated by `when`. Written as ordinary authored
|
|
121
|
-
* data (user-editable afterward) and triggers the standard recompute.
|
|
122
|
-
*/
|
|
123
|
-
export interface FormWriteBackRow {
|
|
124
|
-
to: string;
|
|
125
|
-
from?: string;
|
|
126
|
-
expression?: string;
|
|
127
|
-
when?: string;
|
|
128
|
-
}
|
|
@@ -33,13 +33,13 @@ export interface ISubmissionAttachment {
|
|
|
33
33
|
* DATETIME as a Date, CHECKBOXES as the full option array.
|
|
34
34
|
*/
|
|
35
35
|
export declare type SubmissionWriteBackValue = string | number | boolean | string[];
|
|
36
|
-
/** One write-back
|
|
36
|
+
/** One write-back item's outcome — applied with values, or skipped with why. */
|
|
37
37
|
export interface ISubmissionWriteBackAudit {
|
|
38
38
|
to: string;
|
|
39
39
|
appliedValue?: SubmissionWriteBackValue;
|
|
40
40
|
/** The asset-level value the write replaced; absent when the field had none. */
|
|
41
41
|
previousValue?: SubmissionWriteBackValue;
|
|
42
|
-
/** Present on
|
|
42
|
+
/** Present on COMPUTED items — the formula that produced the value. */
|
|
43
43
|
expression?: string;
|
|
44
44
|
skipped?: true;
|
|
45
45
|
reason?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotto/contract",
|
|
3
3
|
"license": "ISC",
|
|
4
|
-
"version": "1.0.70-alpha.
|
|
4
|
+
"version": "1.0.70-alpha.13",
|
|
5
5
|
"description": "Spotto's API Contract type definitions",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"@types/geojson": "^7946.0.11",
|
|
19
19
|
"shx": "^0.3.4"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "ee164edbac29f51e60ef9c6046399a9e0ac4c316"
|
|
22
22
|
}
|