@spotto/contract 1.0.70-alpha.11 → 1.0.70-alpha.12
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,14 +1,16 @@
|
|
|
1
|
-
import { FormItem, FormPrefillRow, FormWriteBackRow } from '../../shared';
|
|
1
|
+
import { FormItem, FormPrefillRow, FormSettings, FormWriteBackRow } 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
|
-
* version; `name` is immutable.
|
|
7
|
+
* version; `name` is immutable. A present `settings` replaces the loaded
|
|
8
|
+
* version's wholesale (like the arrays) — publish `{}` to clear it.
|
|
8
9
|
*/
|
|
9
10
|
export interface UpdateFormRequest {
|
|
10
11
|
label?: string;
|
|
11
12
|
items?: FormItem[];
|
|
12
13
|
prefill?: FormPrefillRow[];
|
|
13
14
|
writeBack?: FormWriteBackRow[];
|
|
15
|
+
settings?: FormSettings;
|
|
14
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IEntityMeta } from '../../shared';
|
|
2
|
-
import { FormItem, FormPrefillRow, FormWriteBackRow } from '../shared';
|
|
2
|
+
import { FormItem, FormPrefillRow, FormSettings, FormWriteBackRow } from '../shared';
|
|
3
3
|
import { GetFormsQuery } from './query';
|
|
4
4
|
/** One immutable form version document. */
|
|
5
5
|
export interface GetFormResponse {
|
|
@@ -14,6 +14,7 @@ export interface GetFormResponse {
|
|
|
14
14
|
items: FormItem[];
|
|
15
15
|
prefill: FormPrefillRow[];
|
|
16
16
|
writeBack: FormWriteBackRow[];
|
|
17
|
+
settings?: FormSettings;
|
|
17
18
|
createdBy: string;
|
|
18
19
|
meta?: IEntityMeta;
|
|
19
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormItem, FormPrefillRow, FormWriteBackRow } from '../shared';
|
|
1
|
+
import { FormItem, FormPrefillRow, FormSettings, FormWriteBackRow } from '../shared';
|
|
2
2
|
/** Creates a new form as version 1 (current). */
|
|
3
3
|
export interface PostFormRequest {
|
|
4
4
|
/** Immutable handle; referenced by actions. */
|
|
@@ -7,4 +7,5 @@ export interface PostFormRequest {
|
|
|
7
7
|
items: FormItem[];
|
|
8
8
|
prefill?: FormPrefillRow[];
|
|
9
9
|
writeBack?: FormWriteBackRow[];
|
|
10
|
+
settings?: FormSettings;
|
|
10
11
|
}
|
package/dist/forms/shared.d.ts
CHANGED
|
@@ -48,6 +48,27 @@ export interface FormImageItem {
|
|
|
48
48
|
export interface FormDividerItem {
|
|
49
49
|
kind: 'divider';
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* A hyperlink content block — opens `href` (validated http(s)-only at save,
|
|
53
|
+
* so a stored href is always safe to render as an anchor).
|
|
54
|
+
*/
|
|
55
|
+
export interface FormLinkItem {
|
|
56
|
+
kind: 'link';
|
|
57
|
+
href: string;
|
|
58
|
+
/** Display text; the href itself shows when omitted. */
|
|
59
|
+
label?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* An embedded YouTube video. The URL is stored as authored (watch, share,
|
|
63
|
+
* shorts or embed form — validated against the YouTube hosts at save) and
|
|
64
|
+
* the client derives the embed markup, so only allowlisted hosts ever reach
|
|
65
|
+
* an iframe.
|
|
66
|
+
*/
|
|
67
|
+
export interface FormVideoItem {
|
|
68
|
+
kind: 'video';
|
|
69
|
+
url: string;
|
|
70
|
+
caption?: string;
|
|
71
|
+
}
|
|
51
72
|
/**
|
|
52
73
|
* A signature/photo capture block. Produces an attachment reference on the
|
|
53
74
|
* submission (never a fieldValue), keyed by the block's `name`.
|
|
@@ -59,8 +80,29 @@ export interface FormCaptureItem {
|
|
|
59
80
|
label?: string;
|
|
60
81
|
help?: string;
|
|
61
82
|
}
|
|
62
|
-
export declare type FormItem = FormFieldItem | FormSectionItem | FormTextItem | FormImageItem | FormDividerItem | FormCaptureItem;
|
|
83
|
+
export declare type FormItem = FormFieldItem | FormSectionItem | FormTextItem | FormImageItem | FormDividerItem | FormLinkItem | FormVideoItem | FormCaptureItem;
|
|
63
84
|
export declare type FormItemKind = FormItem['kind'];
|
|
85
|
+
/**
|
|
86
|
+
* Runner presentation options — how the form presents its chrome, not what
|
|
87
|
+
* it collects. Optional as a whole, and PATCH replaces it wholesale (like
|
|
88
|
+
* the arrays), so an option can be cleared by publishing without it.
|
|
89
|
+
*/
|
|
90
|
+
export interface FormSettings {
|
|
91
|
+
/** Overrides the submit button text (e.g. "Confirm"). */
|
|
92
|
+
submitLabel?: string;
|
|
93
|
+
/** Show a cancel button that closes the form without submitting. */
|
|
94
|
+
showCancel?: boolean;
|
|
95
|
+
/** Cancel button text — only allowed alongside `showCancel`. */
|
|
96
|
+
cancelLabel?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Content-only: completing the form records NOTHING (no submission, no
|
|
99
|
+
* event, no write-back) — the server rejects a submission against it.
|
|
100
|
+
* Save-time validation forbids write-back rows, capture blocks and
|
|
101
|
+
* required items. For a recorded acknowledgment, use a non-informational
|
|
102
|
+
* form with a signature block and a "Confirm" submitLabel instead.
|
|
103
|
+
*/
|
|
104
|
+
informational?: boolean;
|
|
105
|
+
}
|
|
64
106
|
/**
|
|
65
107
|
* A read-in row: on open, seed form field `to` from the target — either a
|
|
66
108
|
* copy of target field `from` or an `expression` over the target's effective
|
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.12",
|
|
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": "609333e7153afaa63e907e108dfa0fd08df49246"
|
|
22
22
|
}
|