@start9labs/start-sdk 0.4.0-beta.50 → 0.4.0-beta.52
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/base/lib/Effects.d.ts +4 -0
- package/base/lib/actions/input/builder/inputSpec.d.ts +129 -8
- package/base/lib/actions/input/builder/inputSpec.js +223 -13
- package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
- package/base/lib/actions/input/builder/inputSpecTools.d.ts +3 -3
- package/base/lib/actions/input/builder/list.d.ts +24 -3
- package/base/lib/actions/input/builder/list.js +26 -5
- package/base/lib/actions/input/builder/list.js.map +1 -1
- package/base/lib/actions/input/builder/value.d.ts +70 -16
- package/base/lib/actions/input/builder/value.js +89 -34
- package/base/lib/actions/input/builder/value.js.map +1 -1
- package/base/lib/actions/input/builder/variants.d.ts +14 -3
- package/base/lib/actions/input/builder/variants.js +22 -7
- package/base/lib/actions/input/builder/variants.js.map +1 -1
- package/base/lib/actions/input/inputSpecConstants.d.ts +203 -5
- package/base/lib/actions/input/inputSpecConstants.js +118 -38
- package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
- package/base/lib/actions/input/inputSpecTypes.d.ts +99 -0
- package/base/lib/actions/input/inputSpecTypes.js +6 -1
- package/base/lib/actions/input/inputSpecTypes.js.map +1 -1
- package/base/lib/actions/setupActions.d.ts +6 -3
- package/base/lib/actions/setupActions.js +7 -4
- package/base/lib/actions/setupActions.js.map +1 -1
- package/base/lib/exver/index.d.ts +233 -2
- package/base/lib/exver/index.js +197 -3
- package/base/lib/exver/index.js.map +1 -1
- package/base/lib/index.d.ts +23 -1
- package/base/lib/index.js +4 -2
- package/base/lib/index.js.map +1 -1
- package/base/lib/inits/setupInit.d.ts +17 -0
- package/base/lib/inits/setupInit.js +7 -0
- package/base/lib/inits/setupInit.js.map +1 -1
- package/base/lib/inits/setupUninit.d.ts +12 -0
- package/base/lib/inits/setupUninit.js +7 -0
- package/base/lib/inits/setupUninit.js.map +1 -1
- package/base/lib/interfaces/Host.js +2 -4
- package/base/lib/interfaces/Host.js.map +1 -1
- package/base/lib/osBindings/GetOutboundGatewayParams.d.ts +4 -0
- package/base/lib/osBindings/GetOutboundGatewayParams.js +3 -0
- package/base/lib/osBindings/GetOutboundGatewayParams.js.map +1 -0
- package/base/lib/osBindings/ServerHostname.d.ts +1 -0
- package/base/lib/osBindings/ServerHostname.js +4 -0
- package/base/lib/osBindings/ServerHostname.js.map +1 -0
- package/base/lib/osBindings/ServerInfo.d.ts +1 -0
- package/base/lib/osBindings/SetServerHostnameParams.d.ts +4 -0
- package/base/lib/osBindings/SetServerHostnameParams.js +4 -0
- package/base/lib/osBindings/SetServerHostnameParams.js.map +1 -0
- package/base/lib/osBindings/SetupExecuteParams.d.ts +3 -1
- package/base/lib/osBindings/SmtpSecurity.d.ts +1 -0
- package/base/lib/osBindings/SmtpSecurity.js +4 -0
- package/base/lib/osBindings/SmtpSecurity.js.map +1 -0
- package/base/lib/osBindings/SmtpValue.d.ts +4 -2
- package/base/lib/osBindings/SmtpValue.js +0 -1
- package/base/lib/osBindings/SmtpValue.js.map +1 -1
- package/base/lib/osBindings/StartOsRecoveryInfo.d.ts +2 -2
- package/base/lib/osBindings/TestSmtpParams.d.ts +4 -2
- package/base/lib/osBindings/TestSmtpParams.js +0 -1
- package/base/lib/osBindings/TestSmtpParams.js.map +1 -1
- package/base/lib/osBindings/index.d.ts +4 -1
- package/base/lib/s9pk/index.d.ts +66 -0
- package/base/lib/s9pk/index.js +70 -1
- package/base/lib/s9pk/index.js.map +1 -1
- package/base/lib/types.d.ts +68 -2
- package/base/lib/types.js +14 -0
- package/base/lib/types.js.map +1 -1
- package/base/lib/util/GetOutboundGateway.d.ts +30 -0
- package/base/lib/util/GetOutboundGateway.js +90 -0
- package/base/lib/util/GetOutboundGateway.js.map +1 -0
- package/base/lib/util/asError.d.ts +8 -0
- package/base/lib/util/asError.js +8 -0
- package/base/lib/util/asError.js.map +1 -1
- package/base/lib/util/deepEqual.d.ts +15 -0
- package/base/lib/util/deepEqual.js +16 -2
- package/base/lib/util/deepEqual.js.map +1 -1
- package/base/lib/util/deepMerge.d.ts +18 -0
- package/base/lib/util/deepMerge.js +18 -0
- package/base/lib/util/deepMerge.js.map +1 -1
- package/base/lib/util/getDefaultString.d.ts +8 -0
- package/base/lib/util/getDefaultString.js +8 -0
- package/base/lib/util/getDefaultString.js.map +1 -1
- package/base/lib/util/graph.d.ts +57 -0
- package/base/lib/util/graph.js +47 -0
- package/base/lib/util/graph.js.map +1 -1
- package/base/lib/util/inMs.d.ts +15 -0
- package/base/lib/util/inMs.js +15 -0
- package/base/lib/util/inMs.js.map +1 -1
- package/base/lib/util/index.d.ts +1 -0
- package/base/lib/util/index.js +3 -1
- package/base/lib/util/index.js.map +1 -1
- package/base/lib/util/ip.d.ts +81 -0
- package/base/lib/util/ip.js +81 -0
- package/base/lib/util/ip.js.map +1 -1
- package/base/lib/util/once.d.ts +13 -0
- package/base/lib/util/once.js +13 -0
- package/base/lib/util/once.js.map +1 -1
- package/base/lib/util/patterns.d.ts +11 -0
- package/base/lib/util/patterns.js +11 -0
- package/base/lib/util/patterns.js.map +1 -1
- package/base/lib/util/regexes.d.ts +38 -0
- package/base/lib/util/regexes.js +38 -0
- package/base/lib/util/regexes.js.map +1 -1
- package/base/lib/util/splitCommand.d.ts +14 -0
- package/base/lib/util/splitCommand.js +15 -2
- package/base/lib/util/splitCommand.js.map +1 -1
- package/base/lib/util/stringFromStdErrOut.d.ts +7 -0
- package/base/lib/util/stringFromStdErrOut.js +7 -0
- package/base/lib/util/stringFromStdErrOut.js.map +1 -1
- package/base/lib/util/typeHelpers.d.ts +35 -0
- package/base/lib/util/typeHelpers.js +7 -0
- package/base/lib/util/typeHelpers.js.map +1 -1
- package/package/lib/StartSdk.d.ts +330 -3
- package/package/lib/StartSdk.js +143 -1
- package/package/lib/StartSdk.js.map +1 -1
- package/package/lib/backup/Backups.d.ts +71 -0
- package/package/lib/backup/Backups.js +69 -0
- package/package/lib/backup/Backups.js.map +1 -1
- package/package/lib/backup/setupBackups.d.ts +14 -0
- package/package/lib/backup/setupBackups.js +9 -0
- package/package/lib/backup/setupBackups.js.map +1 -1
- package/package/lib/health/HealthCheck.d.ts +16 -0
- package/package/lib/health/HealthCheck.js +16 -2
- package/package/lib/health/HealthCheck.js.map +1 -1
- package/package/lib/health/checkFns/HealthCheckResult.d.ts +6 -0
- package/package/lib/health/checkFns/index.d.ts +8 -0
- package/package/lib/health/checkFns/index.js +8 -0
- package/package/lib/health/checkFns/index.js.map +1 -1
- package/package/lib/index.d.ts +2 -2
- package/package/lib/index.js +2 -2
- package/package/lib/index.js.map +1 -1
- package/package/lib/mainFn/CommandController.d.ts +29 -0
- package/package/lib/mainFn/CommandController.js +29 -0
- package/package/lib/mainFn/CommandController.js.map +1 -1
- package/package/lib/mainFn/Daemon.d.ts +38 -2
- package/package/lib/mainFn/Daemon.js +38 -2
- package/package/lib/mainFn/Daemon.js.map +1 -1
- package/package/lib/mainFn/Daemons.d.ts +31 -0
- package/package/lib/mainFn/Daemons.js +13 -0
- package/package/lib/mainFn/Daemons.js.map +1 -1
- package/package/lib/mainFn/Mounts.d.ts +38 -0
- package/package/lib/mainFn/Mounts.js +38 -0
- package/package/lib/mainFn/Mounts.js.map +1 -1
- package/package/lib/mainFn/index.d.ts +1 -0
- package/package/lib/mainFn/index.js +1 -0
- package/package/lib/mainFn/index.js.map +1 -1
- package/package/lib/manifest/setupManifest.d.ts +9 -0
- package/package/lib/manifest/setupManifest.js +9 -0
- package/package/lib/manifest/setupManifest.js.map +1 -1
- package/package/lib/test/output.d.ts +2 -2
- package/package/lib/test/output.js +418 -329
- package/package/lib/test/output.js.map +1 -1
- package/package/lib/test/output.sdk.d.ts +193 -2
- package/package/lib/util/SubContainer.d.ts +46 -0
- package/package/lib/util/SubContainer.js +10 -0
- package/package/lib/util/SubContainer.js.map +1 -1
- package/package/lib/util/fileHelper.d.ts +43 -10
- package/package/lib/util/fileHelper.js +13 -11
- package/package/lib/util/fileHelper.js.map +1 -1
- package/package/lib/version/VersionGraph.d.ts +64 -13
- package/package/lib/version/VersionGraph.js +64 -18
- package/package/lib/version/VersionGraph.js.map +1 -1
- package/package/lib/version/VersionInfo.d.ts +17 -0
- package/package/lib/version/VersionInfo.js +12 -0
- package/package/lib/version/VersionInfo.js.map +1 -1
- package/package/package.json +9 -8
- package/package.json +9 -8
|
@@ -1,47 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record mapping field keys to their {@link ValueSpec} definitions.
|
|
3
|
+
* This is the root shape of a dynamic form specification — it defines the complete set
|
|
4
|
+
* of configurable fields for a service or action.
|
|
5
|
+
*/
|
|
1
6
|
export type InputSpec = Record<string, ValueSpec>;
|
|
7
|
+
/**
|
|
8
|
+
* The discriminator for all supported form field types.
|
|
9
|
+
*/
|
|
2
10
|
export type ValueType = 'text' | 'textarea' | 'number' | 'color' | 'datetime' | 'toggle' | 'select' | 'multiselect' | 'list' | 'object' | 'file' | 'union' | 'hidden';
|
|
11
|
+
/** Union of all concrete form field spec types. Discriminate on the `type` field. */
|
|
3
12
|
export type ValueSpec = ValueSpecOf<ValueType>;
|
|
4
13
|
/** core spec types. These types provide the metadata for performing validations */
|
|
5
14
|
export type ValueSpecOf<T extends ValueType> = T extends "text" ? ValueSpecText : T extends "textarea" ? ValueSpecTextarea : T extends "number" ? ValueSpecNumber : T extends "color" ? ValueSpecColor : T extends "datetime" ? ValueSpecDatetime : T extends "toggle" ? ValueSpecToggle : T extends "select" ? ValueSpecSelect : T extends "multiselect" ? ValueSpecMultiselect : T extends "list" ? ValueSpecList : T extends "object" ? ValueSpecObject : T extends "file" ? ValueSpecFile : T extends "union" ? ValueSpecUnion : T extends "hidden" ? ValueSpecHidden : never;
|
|
15
|
+
/** Spec for a single-line text input field. */
|
|
6
16
|
export type ValueSpecText = {
|
|
17
|
+
/** Display label for the field. */
|
|
7
18
|
name: string;
|
|
19
|
+
/** Optional help text displayed below the field. */
|
|
8
20
|
description: string | null;
|
|
21
|
+
/** Optional warning message displayed to the user. */
|
|
9
22
|
warning: string | null;
|
|
10
23
|
type: 'text';
|
|
24
|
+
/** Regex patterns used to validate the input value. */
|
|
11
25
|
patterns: Pattern[];
|
|
26
|
+
/** Minimum character length, or `null` for no minimum. */
|
|
12
27
|
minLength: number | null;
|
|
28
|
+
/** Maximum character length, or `null` for no maximum. */
|
|
13
29
|
maxLength: number | null;
|
|
30
|
+
/** Whether the field should obscure input (e.g. for passwords). */
|
|
14
31
|
masked: boolean;
|
|
32
|
+
/** HTML input mode hint for mobile keyboards. */
|
|
15
33
|
inputmode: 'text' | 'email' | 'tel' | 'url';
|
|
34
|
+
/** Placeholder text shown when the field is empty. */
|
|
16
35
|
placeholder: string | null;
|
|
36
|
+
/** Whether the field must have a value. */
|
|
17
37
|
required: boolean;
|
|
38
|
+
/** Default value, which may be a literal string or a {@link RandomString} generation spec. */
|
|
18
39
|
default: DefaultString | null;
|
|
40
|
+
/** `false` if editable, or a string message explaining why the field is disabled. */
|
|
19
41
|
disabled: false | string;
|
|
42
|
+
/** If set, provides a "generate" button that fills the field with a random string matching this spec. */
|
|
20
43
|
generate: null | RandomString;
|
|
44
|
+
/** Whether the field value cannot be changed after initial configuration. */
|
|
21
45
|
immutable: boolean;
|
|
22
46
|
};
|
|
47
|
+
/** Spec for a multi-line textarea input field. */
|
|
23
48
|
export type ValueSpecTextarea = {
|
|
24
49
|
name: string;
|
|
25
50
|
description: string | null;
|
|
26
51
|
warning: string | null;
|
|
27
52
|
type: 'textarea';
|
|
53
|
+
/** Regex patterns used to validate the input value. */
|
|
28
54
|
patterns: Pattern[];
|
|
29
55
|
placeholder: string | null;
|
|
30
56
|
minLength: number | null;
|
|
31
57
|
maxLength: number | null;
|
|
58
|
+
/** Minimum number of visible rows. */
|
|
32
59
|
minRows: number;
|
|
60
|
+
/** Maximum number of visible rows before scrolling. */
|
|
33
61
|
maxRows: number;
|
|
34
62
|
required: boolean;
|
|
35
63
|
default: string | null;
|
|
36
64
|
disabled: false | string;
|
|
37
65
|
immutable: boolean;
|
|
38
66
|
};
|
|
67
|
+
/** Spec for a numeric input field. */
|
|
39
68
|
export type ValueSpecNumber = {
|
|
40
69
|
type: 'number';
|
|
70
|
+
/** Minimum allowed value, or `null` for unbounded. */
|
|
41
71
|
min: number | null;
|
|
72
|
+
/** Maximum allowed value, or `null` for unbounded. */
|
|
42
73
|
max: number | null;
|
|
74
|
+
/** Whether only whole numbers are accepted. */
|
|
43
75
|
integer: boolean;
|
|
76
|
+
/** Step increment for the input spinner, or `null` for any precision. */
|
|
44
77
|
step: number | null;
|
|
78
|
+
/** Display label for the unit (e.g. `"MB"`, `"seconds"`), shown next to the field. */
|
|
45
79
|
units: string | null;
|
|
46
80
|
placeholder: string | null;
|
|
47
81
|
name: string;
|
|
@@ -52,51 +86,67 @@ export type ValueSpecNumber = {
|
|
|
52
86
|
disabled: false | string;
|
|
53
87
|
immutable: boolean;
|
|
54
88
|
};
|
|
89
|
+
/** Spec for a browser-native color picker field. */
|
|
55
90
|
export type ValueSpecColor = {
|
|
56
91
|
name: string;
|
|
57
92
|
description: string | null;
|
|
58
93
|
warning: string | null;
|
|
59
94
|
type: 'color';
|
|
60
95
|
required: boolean;
|
|
96
|
+
/** Default hex color string (e.g. `"#ff0000"`), or `null`. */
|
|
61
97
|
default: string | null;
|
|
62
98
|
disabled: false | string;
|
|
63
99
|
immutable: boolean;
|
|
64
100
|
};
|
|
101
|
+
/** Spec for a date, time, or datetime input field. */
|
|
65
102
|
export type ValueSpecDatetime = {
|
|
66
103
|
name: string;
|
|
67
104
|
description: string | null;
|
|
68
105
|
warning: string | null;
|
|
69
106
|
type: 'datetime';
|
|
70
107
|
required: boolean;
|
|
108
|
+
/** Controls which kind of picker is displayed. */
|
|
71
109
|
inputmode: 'date' | 'time' | 'datetime-local';
|
|
110
|
+
/** Minimum selectable date/time as an ISO string, or `null`. */
|
|
72
111
|
min: string | null;
|
|
112
|
+
/** Maximum selectable date/time as an ISO string, or `null`. */
|
|
73
113
|
max: string | null;
|
|
74
114
|
default: string | null;
|
|
75
115
|
disabled: false | string;
|
|
76
116
|
immutable: boolean;
|
|
77
117
|
};
|
|
118
|
+
/** Spec for a single-select field displayed as radio buttons in a modal. */
|
|
78
119
|
export type ValueSpecSelect = {
|
|
120
|
+
/** Map of option keys to display labels. */
|
|
79
121
|
values: Record<string, string>;
|
|
80
122
|
name: string;
|
|
81
123
|
description: string | null;
|
|
82
124
|
warning: string | null;
|
|
83
125
|
type: 'select';
|
|
84
126
|
default: string | null;
|
|
127
|
+
/** `false` if all enabled, a string disabling the whole field, or an array of disabled option keys. */
|
|
85
128
|
disabled: false | string | string[];
|
|
86
129
|
immutable: boolean;
|
|
87
130
|
};
|
|
131
|
+
/** Spec for a multi-select field displayed as checkboxes in a modal. */
|
|
88
132
|
export type ValueSpecMultiselect = {
|
|
133
|
+
/** Map of option keys to display labels. */
|
|
89
134
|
values: Record<string, string>;
|
|
90
135
|
name: string;
|
|
91
136
|
description: string | null;
|
|
92
137
|
warning: string | null;
|
|
93
138
|
type: 'multiselect';
|
|
139
|
+
/** Minimum number of selections required, or `null`. */
|
|
94
140
|
minLength: number | null;
|
|
141
|
+
/** Maximum number of selections allowed, or `null`. */
|
|
95
142
|
maxLength: number | null;
|
|
143
|
+
/** `false` if all enabled, a string disabling the whole field, or an array of disabled option keys. */
|
|
96
144
|
disabled: false | string | string[];
|
|
145
|
+
/** Array of option keys selected by default. */
|
|
97
146
|
default: string[];
|
|
98
147
|
immutable: boolean;
|
|
99
148
|
};
|
|
149
|
+
/** Spec for a boolean toggle (on/off switch). */
|
|
100
150
|
export type ValueSpecToggle = {
|
|
101
151
|
name: string;
|
|
102
152
|
description: string | null;
|
|
@@ -106,55 +156,83 @@ export type ValueSpecToggle = {
|
|
|
106
156
|
disabled: false | string;
|
|
107
157
|
immutable: boolean;
|
|
108
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* Spec for a discriminated union field — displays a dropdown for variant selection,
|
|
161
|
+
* and each variant can have its own nested sub-form.
|
|
162
|
+
*/
|
|
109
163
|
export type ValueSpecUnion = {
|
|
110
164
|
name: string;
|
|
111
165
|
description: string | null;
|
|
112
166
|
warning: string | null;
|
|
113
167
|
type: 'union';
|
|
168
|
+
/** Map of variant keys to their display name and nested form spec. */
|
|
114
169
|
variants: Record<string, {
|
|
170
|
+
/** Display name for this variant in the dropdown. */
|
|
115
171
|
name: string;
|
|
172
|
+
/** Nested form spec shown when this variant is selected. */
|
|
116
173
|
spec: InputSpec;
|
|
117
174
|
}>;
|
|
175
|
+
/** `false` if all enabled, a string disabling the whole field, or an array of disabled variant keys. */
|
|
118
176
|
disabled: false | string | string[];
|
|
119
177
|
default: string | null;
|
|
120
178
|
immutable: boolean;
|
|
121
179
|
};
|
|
180
|
+
/** Spec for a file upload input field. */
|
|
122
181
|
export type ValueSpecFile = {
|
|
123
182
|
name: string;
|
|
124
183
|
description: string | null;
|
|
125
184
|
warning: string | null;
|
|
126
185
|
type: 'file';
|
|
186
|
+
/** Allowed file extensions (e.g. `[".pem", ".crt"]`). */
|
|
127
187
|
extensions: string[];
|
|
128
188
|
required: boolean;
|
|
129
189
|
};
|
|
190
|
+
/** Spec for a collapsible grouping of nested fields (a "sub-form"). */
|
|
130
191
|
export type ValueSpecObject = {
|
|
131
192
|
name: string;
|
|
132
193
|
description: string | null;
|
|
133
194
|
warning: string | null;
|
|
134
195
|
type: 'object';
|
|
196
|
+
/** The nested form spec containing this object's fields. */
|
|
135
197
|
spec: InputSpec;
|
|
136
198
|
};
|
|
199
|
+
/** Spec for a hidden field — not displayed to the user but included in the form data. */
|
|
137
200
|
export type ValueSpecHidden = {
|
|
138
201
|
type: 'hidden';
|
|
139
202
|
};
|
|
203
|
+
/** The two supported list item types. */
|
|
140
204
|
export type ListValueSpecType = 'text' | 'object';
|
|
205
|
+
/** Maps a {@link ListValueSpecType} to its concrete list item spec. */
|
|
141
206
|
export type ListValueSpecOf<T extends ListValueSpecType> = T extends "text" ? ListValueSpecText : T extends "object" ? ListValueSpecObject : never;
|
|
207
|
+
/** A list field spec — union of text-list and object-list variants. */
|
|
142
208
|
export type ValueSpecList = ValueSpecListOf<ListValueSpecType>;
|
|
209
|
+
/**
|
|
210
|
+
* Spec for a list field — an interface to add, remove, and edit items in an ordered collection.
|
|
211
|
+
* The `spec` field determines whether list items are text strings or structured objects.
|
|
212
|
+
*/
|
|
143
213
|
export type ValueSpecListOf<T extends ListValueSpecType> = {
|
|
144
214
|
name: string;
|
|
145
215
|
description: string | null;
|
|
146
216
|
warning: string | null;
|
|
147
217
|
type: 'list';
|
|
218
|
+
/** The item spec — determines whether this is a list of text values or objects. */
|
|
148
219
|
spec: ListValueSpecOf<T>;
|
|
220
|
+
/** Minimum number of items, or `null` for no minimum. */
|
|
149
221
|
minLength: number | null;
|
|
222
|
+
/** Maximum number of items, or `null` for no maximum. */
|
|
150
223
|
maxLength: number | null;
|
|
151
224
|
disabled: false | string;
|
|
225
|
+
/** Default list items to populate on creation. */
|
|
152
226
|
default: string[] | DefaultString[] | Record<string, unknown>[] | readonly string[] | readonly DefaultString[] | readonly Record<string, unknown>[];
|
|
153
227
|
};
|
|
228
|
+
/** A regex validation pattern with a human-readable description of what it enforces. */
|
|
154
229
|
export type Pattern = {
|
|
230
|
+
/** The regex pattern string (without delimiters). */
|
|
155
231
|
regex: string;
|
|
232
|
+
/** A user-facing explanation shown when validation fails (e.g. `"Must be a valid email"`). */
|
|
156
233
|
description: string;
|
|
157
234
|
};
|
|
235
|
+
/** Spec for text items within a list field. */
|
|
158
236
|
export type ListValueSpecText = {
|
|
159
237
|
type: 'text';
|
|
160
238
|
patterns: Pattern[];
|
|
@@ -165,22 +243,43 @@ export type ListValueSpecText = {
|
|
|
165
243
|
inputmode: 'text' | 'email' | 'tel' | 'url';
|
|
166
244
|
placeholder: string | null;
|
|
167
245
|
};
|
|
246
|
+
/** Spec for object items within a list field. */
|
|
168
247
|
export type ListValueSpecObject = {
|
|
169
248
|
type: 'object';
|
|
249
|
+
/** The form spec for each object item. */
|
|
170
250
|
spec: InputSpec;
|
|
251
|
+
/** Defines how uniqueness is determined among list items. */
|
|
171
252
|
uniqueBy: UniqueBy;
|
|
253
|
+
/** An expression used to generate the display string for each item in the list summary (e.g. a key path). */
|
|
172
254
|
displayAs: string | null;
|
|
173
255
|
};
|
|
256
|
+
/**
|
|
257
|
+
* Describes how list items determine uniqueness.
|
|
258
|
+
* - `null`: no uniqueness constraint
|
|
259
|
+
* - `string`: unique by a specific field key
|
|
260
|
+
* - `{ any: UniqueBy[] }`: unique if any of the sub-constraints match
|
|
261
|
+
* - `{ all: UniqueBy[] }`: unique if all sub-constraints match together
|
|
262
|
+
*/
|
|
174
263
|
export type UniqueBy = null | string | {
|
|
175
264
|
any: readonly UniqueBy[] | UniqueBy[];
|
|
176
265
|
} | {
|
|
177
266
|
all: readonly UniqueBy[] | UniqueBy[];
|
|
178
267
|
};
|
|
268
|
+
/** A default value that is either a literal string or a {@link RandomString} generation spec. */
|
|
179
269
|
export type DefaultString = string | RandomString;
|
|
270
|
+
/** Spec for generating a random string — used for default passwords, API keys, etc. */
|
|
180
271
|
export type RandomString = {
|
|
272
|
+
/** The character set to draw from (e.g. `"a-zA-Z0-9"`). */
|
|
181
273
|
charset: string;
|
|
274
|
+
/** The length of the generated string. */
|
|
182
275
|
len: number;
|
|
183
276
|
};
|
|
277
|
+
/**
|
|
278
|
+
* Type guard that narrows a {@link ValueSpec} to a {@link ValueSpecListOf} of a specific item type.
|
|
279
|
+
*
|
|
280
|
+
* @param t - The value spec to check
|
|
281
|
+
* @param s - The list item type to narrow to (`"text"` or `"object"`)
|
|
282
|
+
*/
|
|
184
283
|
export declare function isValueSpecListOf<S extends ListValueSpecType>(t: ValueSpec, s: S): t is ValueSpecListOf<S> & {
|
|
185
284
|
spec: ListValueSpecOf<S>;
|
|
186
285
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isValueSpecListOf = isValueSpecListOf;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Type guard that narrows a {@link ValueSpec} to a {@link ValueSpecListOf} of a specific item type.
|
|
6
|
+
*
|
|
7
|
+
* @param t - The value spec to check
|
|
8
|
+
* @param s - The list item type to narrow to (`"text"` or `"object"`)
|
|
9
|
+
*/
|
|
5
10
|
function isValueSpecListOf(t, s) {
|
|
6
11
|
return 'spec' in t && t.spec.type === s;
|
|
7
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSpecTypes.js","sourceRoot":"","sources":["../../../../../base/lib/actions/input/inputSpecTypes.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"inputSpecTypes.js","sourceRoot":"","sources":["../../../../../base/lib/actions/input/inputSpecTypes.ts"],"names":[],"mappings":";;AAoVA,8CAKC;AAXD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,CAAY,EACZ,CAAI;IAEJ,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -13,9 +13,9 @@ export type GetInput<A extends Record<string, any>> = (options: {
|
|
|
13
13
|
effects: T.Effects;
|
|
14
14
|
prefill: T.DeepPartial<A> | null;
|
|
15
15
|
}) => Promise<null | void | undefined | T.DeepPartial<A>>;
|
|
16
|
-
export type MaybeFn<T
|
|
16
|
+
export type MaybeFn<T, Opts = {
|
|
17
17
|
effects: T.Effects;
|
|
18
|
-
}) => Promise<T>);
|
|
18
|
+
}> = T | ((options: Opts) => Promise<T>);
|
|
19
19
|
export interface ActionInfo<Id extends T.ActionId, Type extends Record<string, any>> {
|
|
20
20
|
readonly id: Id;
|
|
21
21
|
readonly _INPUT: Type;
|
|
@@ -29,7 +29,10 @@ export declare class Action<Id extends T.ActionId, Type extends Record<string, a
|
|
|
29
29
|
readonly _INPUT: Type;
|
|
30
30
|
private prevInputSpec;
|
|
31
31
|
private constructor();
|
|
32
|
-
static withInput<Id extends T.ActionId, InputSpecType extends InputSpec<Record<string, any>>>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, 'hasInput'>>, inputSpec:
|
|
32
|
+
static withInput<Id extends T.ActionId, InputSpecType extends InputSpec<Record<string, any>>>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, 'hasInput'>>, inputSpec: MaybeFn<InputSpecType, {
|
|
33
|
+
effects: T.Effects;
|
|
34
|
+
prefill: unknown | null;
|
|
35
|
+
}>, getInput: GetInput<ExtractInputSpecType<InputSpecType>>, run: Run<ExtractInputSpecType<InputSpecType>>): Action<Id, ExtractInputSpecType<InputSpecType>>;
|
|
33
36
|
static withoutInput<Id extends T.ActionId>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, 'hasInput'>>, run: Run<{}>): Action<Id, {}>;
|
|
34
37
|
exportMetadata(options: {
|
|
35
38
|
effects: T.Effects;
|
|
@@ -48,9 +48,12 @@ class Action {
|
|
|
48
48
|
async getInput(options) {
|
|
49
49
|
let spec = {};
|
|
50
50
|
if (this.inputSpec) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const inputSpec = await callMaybeFn(this.inputSpec, options);
|
|
52
|
+
const built = await inputSpec?.build(options);
|
|
53
|
+
if (built) {
|
|
54
|
+
this.prevInputSpec[options.effects.eventId] = built;
|
|
55
|
+
spec = built.spec;
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
return {
|
|
56
59
|
eventId: options.effects.eventId,
|
|
@@ -65,7 +68,7 @@ class Action {
|
|
|
65
68
|
if (!prevInputSpec) {
|
|
66
69
|
throw new Error(`getActionInput has not been called for EventID ${options.effects.eventId}`);
|
|
67
70
|
}
|
|
68
|
-
options.input = prevInputSpec.validator.
|
|
71
|
+
options.input = prevInputSpec.validator.parse(options.input);
|
|
69
72
|
spec = prevInputSpec.spec;
|
|
70
73
|
}
|
|
71
74
|
return ((await this.runFn({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupActions.js","sourceRoot":"","sources":["../../../../base/lib/actions/setupActions.ts"],"names":[],"mappings":";;;AAGA,kCAA8B;
|
|
1
|
+
{"version":3,"file":"setupActions.js","sourceRoot":"","sources":["../../../../base/lib/actions/setupActions.ts"],"names":[],"mappings":";;;AAGA,kCAA8B;AAkB9B,SAAS,WAAW,CAClB,OAAyB,EACzB,OAAa;IAEb,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAA;IACzB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;AACH,CAAC;AACD,SAAS,UAAU,CACjB,OAAmB,EACnB,GAAoB;IAEpB,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACvD,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,CAAC;AACH,CAAC;AAUD,MAAa,MAAM;IAQjB,YACW,EAAM,EACE,UAAqC,EACrC,SAMhB,EACgB,UAA0B,EAC1B,KAAgB;QAVxB,OAAE,GAAF,EAAE,CAAI;QACE,eAAU,GAAV,UAAU,CAA2B;QACrC,cAAS,GAAT,SAAS,CAMzB;QACgB,eAAU,GAAV,UAAU,CAAgB;QAC1B,UAAK,GAAL,KAAK,CAAW;QAhB1B,WAAM,GAAS,IAAmB,CAAA;QACnC,kBAAa,GAGjB,EAAE,CAAA;IAaH,CAAC;IACJ,MAAM,CAAC,SAAS,CAId,EAAM,EACN,QAAqD,EACrD,SAMC,EACD,QAAuD,EACvD,GAA6C;QAE7C,OAAO,IAAI,MAAM,CACf,EAAE,EACF,UAAU,CAAC,Q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