@start9labs/start-sdk 0.4.0-beta.30 → 0.4.0-beta.32
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/actions/index.d.ts +1 -2
- package/base/lib/actions/input/builder/inputSpec.d.ts +11 -6
- package/base/lib/actions/input/builder/inputSpec.js +9 -7
- package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
- package/base/lib/actions/input/builder/list.d.ts +12 -8
- package/base/lib/actions/input/builder/list.js +19 -13
- package/base/lib/actions/input/builder/list.js.map +1 -1
- package/base/lib/actions/input/builder/value.d.ts +72 -42
- package/base/lib/actions/input/builder/value.js +237 -151
- package/base/lib/actions/input/builder/value.js.map +1 -1
- package/base/lib/actions/input/builder/variants.d.ts +22 -4
- package/base/lib/actions/input/builder/variants.js +25 -7
- package/base/lib/actions/input/builder/variants.js.map +1 -1
- package/base/lib/actions/input/inputSpecConstants.d.ts +22 -14
- package/base/lib/actions/input/inputSpecConstants.js +16 -14
- package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
- package/base/lib/actions/setupActions.d.ts +12 -11
- package/base/lib/actions/setupActions.js +12 -3
- package/base/lib/actions/setupActions.js.map +1 -1
- package/base/lib/osBindings/Progress.d.ts +2 -0
- package/base/lib/osBindings/Progress.js +0 -1
- package/base/lib/osBindings/Progress.js.map +1 -1
- package/base/lib/osBindings/ProgressUnits.d.ts +1 -0
- package/base/lib/osBindings/ProgressUnits.js +4 -0
- package/base/lib/osBindings/ProgressUnits.js.map +1 -0
- package/base/lib/osBindings/Proxies.d.ts +4 -0
- package/base/lib/osBindings/Proxies.js +3 -0
- package/base/lib/osBindings/Proxies.js.map +1 -0
- package/base/lib/osBindings/ProxyInfo.d.ts +4 -0
- package/base/lib/osBindings/ProxyInfo.js +4 -0
- package/base/lib/osBindings/ProxyInfo.js.map +1 -0
- package/base/lib/osBindings/index.d.ts +1 -0
- package/package/lib/StartSdk.d.ts +23 -11
- package/package/lib/StartSdk.js +2 -2
- package/package/lib/StartSdk.js.map +1 -1
- package/package/lib/test/inputSpecBuilder.test.js +151 -148
- package/package/lib/test/inputSpecBuilder.test.js.map +1 -1
- package/package/lib/test/output.d.ts +13 -6
- package/package/lib/test/output.js +41 -40
- package/package/lib/test/output.js.map +1 -1
- package/package/lib/test/output.sdk.d.ts +22 -9
- package/package/lib/test/output.test.js +12 -8
- package/package/lib/test/output.test.js.map +1 -1
- package/package/lib/version/VersionGraph.js +9 -2
- package/package/lib/version/VersionGraph.js.map +1 -1
- package/package/lib/version/VersionInfo.d.ts +8 -3
- package/package/lib/version/VersionInfo.js.map +1 -1
- package/package/package.json +1 -1
- package/package/scripts/oldSpecToBuilder.js +5 -4
- package/package/scripts/oldSpecToBuilder.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as T from "../types";
|
|
2
2
|
import * as IST from "../actions/input/inputSpecTypes";
|
|
3
3
|
import { Action, ActionInfo } from "./setupActions";
|
|
4
|
-
import { ExtractInputSpecType } from "./input/builder/inputSpec";
|
|
5
4
|
export type RunActionInput<Input> = Input | ((prev?: {
|
|
6
5
|
spec: IST.InputSpec;
|
|
7
6
|
value: Input | null;
|
|
@@ -11,7 +10,7 @@ export declare const runAction: <Input extends Record<string, unknown>>(options:
|
|
|
11
10
|
actionId: T.ActionId;
|
|
12
11
|
input?: RunActionInput<Input>;
|
|
13
12
|
}) => Promise<T.ActionResult | null>;
|
|
14
|
-
type GetActionInputType<A extends ActionInfo<T.ActionId, any>> = A extends Action<T.ActionId, infer I> ?
|
|
13
|
+
type GetActionInputType<A extends ActionInfo<T.ActionId, any>> = A extends Action<T.ActionId, infer I> ? I : never;
|
|
15
14
|
type TaskBase = {
|
|
16
15
|
reason?: string;
|
|
17
16
|
replayId?: string;
|
|
@@ -7,8 +7,8 @@ export type LazyBuildOptions = {
|
|
|
7
7
|
effects: Effects;
|
|
8
8
|
};
|
|
9
9
|
export type LazyBuild<ExpectedOut> = (options: LazyBuildOptions) => Promise<ExpectedOut> | ExpectedOut;
|
|
10
|
-
export type ExtractInputSpecType<A extends
|
|
11
|
-
export type
|
|
10
|
+
export type ExtractInputSpecType<A extends InputSpec<Record<string, any>, any>> = A extends InputSpec<infer B, any> ? B : never;
|
|
11
|
+
export type ExtractInputSpecStaticValidatedAs<A extends InputSpec<any, Record<string, any>>> = A extends InputSpec<any, infer B> ? B : never;
|
|
12
12
|
export type InputSpecOf<A extends Record<string, any>> = {
|
|
13
13
|
[K in keyof A]: Value<A[K]>;
|
|
14
14
|
};
|
|
@@ -69,12 +69,17 @@ export const addNodesSpec = InputSpec.of({ hostname: hostname, port: port });
|
|
|
69
69
|
|
|
70
70
|
```
|
|
71
71
|
*/
|
|
72
|
-
export declare class InputSpec<Type extends Record<string, any
|
|
72
|
+
export declare class InputSpec<Type extends StaticValidatedAs, StaticValidatedAs extends Record<string, any> = Type> {
|
|
73
73
|
private readonly spec;
|
|
74
|
-
validator: Parser<unknown,
|
|
74
|
+
readonly validator: Parser<unknown, StaticValidatedAs>;
|
|
75
75
|
private constructor();
|
|
76
76
|
_TYPE: Type;
|
|
77
77
|
_PARTIAL: DeepPartial<Type>;
|
|
78
|
-
build(options: LazyBuildOptions): Promise<{
|
|
79
|
-
|
|
78
|
+
build(options: LazyBuildOptions): Promise<{
|
|
79
|
+
spec: {
|
|
80
|
+
[K in keyof Type]: ValueSpec;
|
|
81
|
+
};
|
|
82
|
+
validator: Parser<unknown, Type>;
|
|
83
|
+
}>;
|
|
84
|
+
static of<Spec extends Record<string, Value<any, any>>>(spec: Spec): InputSpec<{ [K in keyof Spec]: Spec[K] extends Value<infer T extends any, any> ? T : never; }, { [K_1 in keyof Spec]: Spec[K_1] extends Value<any, infer T_1> ? T_1 : never; }>;
|
|
80
85
|
}
|
|
@@ -67,17 +67,19 @@ class InputSpec {
|
|
|
67
67
|
}
|
|
68
68
|
async build(options) {
|
|
69
69
|
const answer = {};
|
|
70
|
+
const validator = {};
|
|
70
71
|
for (const k in this.spec) {
|
|
71
|
-
|
|
72
|
+
const built = await this.spec[k].build(options);
|
|
73
|
+
answer[k] = built.spec;
|
|
74
|
+
validator[k] = built.validator;
|
|
72
75
|
}
|
|
73
|
-
return
|
|
76
|
+
return {
|
|
77
|
+
spec: answer,
|
|
78
|
+
validator: (0, ts_matches_1.object)(validator),
|
|
79
|
+
};
|
|
74
80
|
}
|
|
75
81
|
static of(spec) {
|
|
76
|
-
const
|
|
77
|
-
for (const key in spec) {
|
|
78
|
-
validatorObj[key] = spec[key].validator;
|
|
79
|
-
}
|
|
80
|
-
const validator = (0, ts_matches_1.object)(validatorObj);
|
|
82
|
+
const validator = (0, ts_matches_1.object)(Object.fromEntries(Object.entries(spec).map(([k, v]) => [k, v.validator])));
|
|
81
83
|
return new InputSpec(spec, validator);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSpec.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/inputSpec.ts"],"names":[],"mappings":";;;AAIA,2CAA2C;
|
|
1
|
+
{"version":3,"file":"inputSpec.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/inputSpec.ts"],"names":[],"mappings":";;;AAIA,2CAA2C;AA4B3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,SAAS;IAIpB,YACmB,IAEhB,EACe,SAA6C;QAH5C,SAAI,GAAJ,IAAI,CAEpB;QACe,cAAS,GAAT,SAAS,CAAoC;QAExD,UAAK,GAAS,IAAmB,CAAA;QACjC,aAAQ,GAAsB,IAAgC,CAAA;IAFlE,CAAC;IAGJ,KAAK,CAAC,KAAK,CAAC,OAAyB;QAMnC,MAAM,MAAM,GAAG,EAEd,CAAA;QACD,MAAM,SAAS,GAAG,EAEjB,CAAA;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAc,CAAC,CAAA;YACtD,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAA;YACtB,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;QAChC,CAAC;QACD,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,IAAA,mBAAM,EAAC,SAAS,CAAQ;SACpC,CAAA;IACH,CAAC;IAED,MAAM,CAAC,EAAE,CAA+C,IAAU;QAChE,MAAM,SAAS,GAAG,IAAA,mBAAM,EACtB,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CACvD,CACF,CAAA;QACD,OAAO,IAAI,SAAS,CAOlB,IAAI,EAAE,SAAgB,CAAC,CAAA;IAC3B,CAAC;CACF;AAlDD,8BAkDC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { InputSpec, LazyBuild } from "./inputSpec";
|
|
2
2
|
import { ListValueSpecText, Pattern, RandomString, UniqueBy, ValueSpecList } from "../inputSpecTypes";
|
|
3
3
|
import { Parser } from "ts-matches";
|
|
4
|
-
export declare class List<Type> {
|
|
5
|
-
build: LazyBuild<
|
|
6
|
-
|
|
4
|
+
export declare class List<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
|
5
|
+
build: LazyBuild<{
|
|
6
|
+
spec: ValueSpecList;
|
|
7
|
+
validator: Parser<unknown, Type>;
|
|
8
|
+
}>;
|
|
9
|
+
readonly validator: Parser<unknown, StaticValidatedAs>;
|
|
7
10
|
private constructor();
|
|
11
|
+
readonly _TYPE: Type;
|
|
8
12
|
static text(a: {
|
|
9
13
|
name: string;
|
|
10
14
|
description?: string | null;
|
|
@@ -44,7 +48,7 @@ export declare class List<Type> {
|
|
|
44
48
|
* @description Displays a button that will generate a random string according to the provided charset and len attributes.
|
|
45
49
|
*/
|
|
46
50
|
generate?: null | RandomString;
|
|
47
|
-
}): List<string[]>;
|
|
51
|
+
}): List<string[], string[]>;
|
|
48
52
|
static dynamicText(getA: LazyBuild<{
|
|
49
53
|
name: string;
|
|
50
54
|
description?: string | null;
|
|
@@ -62,8 +66,8 @@ export declare class List<Type> {
|
|
|
62
66
|
patterns?: Pattern[];
|
|
63
67
|
inputmode?: ListValueSpecText["inputmode"];
|
|
64
68
|
};
|
|
65
|
-
}>): List<string[]>;
|
|
66
|
-
static obj<Type extends Record<string, any>>(a: {
|
|
69
|
+
}>): List<string[], string[]>;
|
|
70
|
+
static obj<Type extends StaticValidatedAs, StaticValidatedAs extends Record<string, any>>(a: {
|
|
67
71
|
name: string;
|
|
68
72
|
description?: string | null;
|
|
69
73
|
warning?: string | null;
|
|
@@ -71,8 +75,8 @@ export declare class List<Type> {
|
|
|
71
75
|
minLength?: number | null;
|
|
72
76
|
maxLength?: number | null;
|
|
73
77
|
}, aSpec: {
|
|
74
|
-
spec: InputSpec<Type>;
|
|
78
|
+
spec: InputSpec<Type, StaticValidatedAs>;
|
|
75
79
|
displayAs?: null | string;
|
|
76
80
|
uniqueBy?: null | UniqueBy;
|
|
77
|
-
}): List<Type[]>;
|
|
81
|
+
}): List<Type[], StaticValidatedAs[]>;
|
|
78
82
|
}
|
|
@@ -6,8 +6,10 @@ class List {
|
|
|
6
6
|
constructor(build, validator) {
|
|
7
7
|
this.build = build;
|
|
8
8
|
this.validator = validator;
|
|
9
|
+
this._TYPE = null;
|
|
9
10
|
}
|
|
10
11
|
static text(a, aSpec) {
|
|
12
|
+
const validator = (0, ts_matches_1.arrayOf)(ts_matches_1.string);
|
|
11
13
|
return new List(() => {
|
|
12
14
|
const spec = {
|
|
13
15
|
type: "text",
|
|
@@ -31,10 +33,11 @@ class List {
|
|
|
31
33
|
...a,
|
|
32
34
|
spec,
|
|
33
35
|
};
|
|
34
|
-
return built;
|
|
35
|
-
},
|
|
36
|
+
return { spec: built, validator };
|
|
37
|
+
}, validator);
|
|
36
38
|
}
|
|
37
39
|
static dynamicText(getA) {
|
|
40
|
+
const validator = (0, ts_matches_1.arrayOf)(ts_matches_1.string);
|
|
38
41
|
return new List(async (options) => {
|
|
39
42
|
const { spec: aSpec, ...a } = await getA(options);
|
|
40
43
|
const spec = {
|
|
@@ -59,19 +62,19 @@ class List {
|
|
|
59
62
|
...a,
|
|
60
63
|
spec,
|
|
61
64
|
};
|
|
62
|
-
return built;
|
|
63
|
-
},
|
|
65
|
+
return { spec: built, validator };
|
|
66
|
+
}, validator);
|
|
64
67
|
}
|
|
65
68
|
static obj(a, aSpec) {
|
|
66
69
|
return new List(async (options) => {
|
|
67
70
|
const { spec: previousSpecSpec, ...restSpec } = aSpec;
|
|
68
|
-
const
|
|
71
|
+
const built = await previousSpecSpec.build(options);
|
|
69
72
|
const spec = {
|
|
70
73
|
type: "object",
|
|
71
74
|
displayAs: null,
|
|
72
75
|
uniqueBy: null,
|
|
73
76
|
...restSpec,
|
|
74
|
-
spec:
|
|
77
|
+
spec: built.spec,
|
|
75
78
|
};
|
|
76
79
|
const value = {
|
|
77
80
|
spec,
|
|
@@ -79,13 +82,16 @@ class List {
|
|
|
79
82
|
...a,
|
|
80
83
|
};
|
|
81
84
|
return {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
spec: {
|
|
86
|
+
description: null,
|
|
87
|
+
warning: null,
|
|
88
|
+
minLength: null,
|
|
89
|
+
maxLength: null,
|
|
90
|
+
type: "list",
|
|
91
|
+
disabled: false,
|
|
92
|
+
...value,
|
|
93
|
+
},
|
|
94
|
+
validator: (0, ts_matches_1.arrayOf)(built.validator),
|
|
89
95
|
};
|
|
90
96
|
}, (0, ts_matches_1.arrayOf)(aSpec.spec.validator));
|
|
91
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/list.ts"],"names":[],"mappings":";;;AASA,2CAAoD;AAEpD,MAAa,IAAI;IACf,YACS,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/list.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { InputSpec, LazyBuild } from "./inputSpec";
|
|
2
2
|
import { List } from "./list";
|
|
3
|
-
import { Variants } from "./variants";
|
|
3
|
+
import { UnionRes, UnionResStaticValidatedAs, Variants } from "./variants";
|
|
4
4
|
import { Pattern, RandomString, ValueSpec, ValueSpecDatetime, ValueSpecText } from "../inputSpecTypes";
|
|
5
5
|
import { DefaultString } from "../inputSpecTypes";
|
|
6
6
|
import { Parser } from "ts-matches";
|
|
7
7
|
import { DeepPartial } from "../../../types";
|
|
8
8
|
type AsRequired<T, Required extends boolean> = Required extends true ? T : T | null;
|
|
9
|
-
export declare class Value<Type> {
|
|
10
|
-
build: LazyBuild<
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export declare class Value<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
|
10
|
+
build: LazyBuild<{
|
|
11
|
+
spec: ValueSpec;
|
|
12
|
+
validator: Parser<unknown, Type>;
|
|
13
|
+
}>;
|
|
14
|
+
readonly validator: Parser<unknown, StaticValidatedAs>;
|
|
15
|
+
protected constructor(build: LazyBuild<{
|
|
16
|
+
spec: ValueSpec;
|
|
17
|
+
validator: Parser<unknown, Type>;
|
|
18
|
+
}>, validator: Parser<unknown, StaticValidatedAs>);
|
|
13
19
|
_TYPE: Type;
|
|
14
20
|
_PARTIAL: DeepPartial<Type>;
|
|
15
21
|
/**
|
|
@@ -39,14 +45,14 @@ export declare class Value<Type> {
|
|
|
39
45
|
* @default false
|
|
40
46
|
*/
|
|
41
47
|
immutable?: boolean;
|
|
42
|
-
}): Value<boolean>;
|
|
48
|
+
}): Value<boolean, boolean>;
|
|
43
49
|
static dynamicToggle(a: LazyBuild<{
|
|
44
50
|
name: string;
|
|
45
51
|
description?: string | null;
|
|
46
52
|
warning?: string | null;
|
|
47
53
|
default: boolean;
|
|
48
54
|
disabled?: false | string;
|
|
49
|
-
}>): Value<boolean>;
|
|
55
|
+
}>): Value<boolean, boolean>;
|
|
50
56
|
/**
|
|
51
57
|
* @description Displays a text input field
|
|
52
58
|
* @example
|
|
@@ -121,13 +127,13 @@ export declare class Value<Type> {
|
|
|
121
127
|
* @description Displays a button that will generate a random string according to the provided charset and len attributes.
|
|
122
128
|
*/
|
|
123
129
|
generate?: RandomString | null;
|
|
124
|
-
}): Value<AsRequired<string, Required>>;
|
|
125
|
-
static dynamicText(getA: LazyBuild<{
|
|
130
|
+
}): Value<AsRequired<string, Required>, AsRequired<string, Required>>;
|
|
131
|
+
static dynamicText<Required extends boolean>(getA: LazyBuild<{
|
|
126
132
|
name: string;
|
|
127
133
|
description?: string | null;
|
|
128
134
|
warning?: string | null;
|
|
129
135
|
default: DefaultString | null;
|
|
130
|
-
required:
|
|
136
|
+
required: Required;
|
|
131
137
|
masked?: boolean;
|
|
132
138
|
placeholder?: string | null;
|
|
133
139
|
minLength?: number | null;
|
|
@@ -136,7 +142,7 @@ export declare class Value<Type> {
|
|
|
136
142
|
inputmode?: ValueSpecText["inputmode"];
|
|
137
143
|
disabled?: string | false;
|
|
138
144
|
generate?: null | RandomString;
|
|
139
|
-
}>): Value<string | null>;
|
|
145
|
+
}>): Value<AsRequired<string, Required>, string | null>;
|
|
140
146
|
/**
|
|
141
147
|
* @description Displays a large textarea field for long form entry.
|
|
142
148
|
* @example
|
|
@@ -172,18 +178,18 @@ export declare class Value<Type> {
|
|
|
172
178
|
* @default false
|
|
173
179
|
*/
|
|
174
180
|
immutable?: boolean;
|
|
175
|
-
}): Value<AsRequired<string, Required>>;
|
|
176
|
-
static dynamicTextarea(getA: LazyBuild<{
|
|
181
|
+
}): Value<AsRequired<string, Required>, AsRequired<string, Required>>;
|
|
182
|
+
static dynamicTextarea<Required extends boolean>(getA: LazyBuild<{
|
|
177
183
|
name: string;
|
|
178
184
|
description?: string | null;
|
|
179
185
|
warning?: string | null;
|
|
180
186
|
default: string | null;
|
|
181
|
-
required:
|
|
187
|
+
required: Required;
|
|
182
188
|
minLength?: number | null;
|
|
183
189
|
maxLength?: number | null;
|
|
184
190
|
placeholder?: string | null;
|
|
185
191
|
disabled?: false | string;
|
|
186
|
-
}>): Value<string | null>;
|
|
192
|
+
}>): Value<AsRequired<string, Required>, string | null>;
|
|
187
193
|
/**
|
|
188
194
|
* @description Displays a number input field
|
|
189
195
|
* @example
|
|
@@ -241,13 +247,13 @@ export declare class Value<Type> {
|
|
|
241
247
|
* @default false
|
|
242
248
|
*/
|
|
243
249
|
immutable?: boolean;
|
|
244
|
-
}): Value<AsRequired<number, Required>>;
|
|
245
|
-
static dynamicNumber(getA: LazyBuild<{
|
|
250
|
+
}): Value<AsRequired<number, Required>, AsRequired<number, Required>>;
|
|
251
|
+
static dynamicNumber<Required extends boolean>(getA: LazyBuild<{
|
|
246
252
|
name: string;
|
|
247
253
|
description?: string | null;
|
|
248
254
|
warning?: string | null;
|
|
249
255
|
default: number | null;
|
|
250
|
-
required:
|
|
256
|
+
required: Required;
|
|
251
257
|
min?: number | null;
|
|
252
258
|
max?: number | null;
|
|
253
259
|
step?: number | null;
|
|
@@ -255,7 +261,7 @@ export declare class Value<Type> {
|
|
|
255
261
|
units?: string | null;
|
|
256
262
|
placeholder?: string | null;
|
|
257
263
|
disabled?: false | string;
|
|
258
|
-
}>): Value<number | null>;
|
|
264
|
+
}>): Value<AsRequired<number, Required>, number | null>;
|
|
259
265
|
/**
|
|
260
266
|
* @description Displays a browser-native color selector.
|
|
261
267
|
* @example
|
|
@@ -291,15 +297,15 @@ export declare class Value<Type> {
|
|
|
291
297
|
* @default false
|
|
292
298
|
*/
|
|
293
299
|
immutable?: boolean;
|
|
294
|
-
}): Value<AsRequired<string, Required>>;
|
|
295
|
-
static dynamicColor(getA: LazyBuild<{
|
|
300
|
+
}): Value<AsRequired<string, Required>, AsRequired<string, Required>>;
|
|
301
|
+
static dynamicColor<Required extends boolean>(getA: LazyBuild<{
|
|
296
302
|
name: string;
|
|
297
303
|
description?: string | null;
|
|
298
304
|
warning?: string | null;
|
|
299
305
|
default: string | null;
|
|
300
|
-
required:
|
|
306
|
+
required: Required;
|
|
301
307
|
disabled?: false | string;
|
|
302
|
-
}>): Value<string | null>;
|
|
308
|
+
}>): Value<AsRequired<string, Required>, string | null>;
|
|
303
309
|
/**
|
|
304
310
|
* @description Displays a browser-native date/time selector.
|
|
305
311
|
* @example
|
|
@@ -345,18 +351,18 @@ export declare class Value<Type> {
|
|
|
345
351
|
* @default false
|
|
346
352
|
*/
|
|
347
353
|
immutable?: boolean;
|
|
348
|
-
}): Value<AsRequired<string, Required>>;
|
|
349
|
-
static dynamicDatetime(getA: LazyBuild<{
|
|
354
|
+
}): Value<AsRequired<string, Required>, AsRequired<string, Required>>;
|
|
355
|
+
static dynamicDatetime<Required extends boolean>(getA: LazyBuild<{
|
|
350
356
|
name: string;
|
|
351
357
|
description?: string | null;
|
|
352
358
|
warning?: string | null;
|
|
353
359
|
default: string | null;
|
|
354
|
-
required:
|
|
360
|
+
required: Required;
|
|
355
361
|
inputmode?: ValueSpecDatetime["inputmode"];
|
|
356
362
|
min?: string | null;
|
|
357
363
|
max?: string | null;
|
|
358
364
|
disabled?: false | string;
|
|
359
|
-
}>): Value<string | null>;
|
|
365
|
+
}>): Value<AsRequired<string, Required>, string | null>;
|
|
360
366
|
/**
|
|
361
367
|
* @description Displays a select modal with radio buttons, allowing for a single selection.
|
|
362
368
|
* @example
|
|
@@ -407,15 +413,15 @@ export declare class Value<Type> {
|
|
|
407
413
|
* @default false
|
|
408
414
|
*/
|
|
409
415
|
immutable?: boolean;
|
|
410
|
-
}): Value<keyof Values & string>;
|
|
411
|
-
static dynamicSelect(getA: LazyBuild<{
|
|
416
|
+
}): Value<keyof Values & string, keyof Values & string>;
|
|
417
|
+
static dynamicSelect<Values extends Record<string, string>>(getA: LazyBuild<{
|
|
412
418
|
name: string;
|
|
413
419
|
description?: string | null;
|
|
414
420
|
warning?: string | null;
|
|
415
421
|
default: string;
|
|
416
|
-
values:
|
|
422
|
+
values: Values;
|
|
417
423
|
disabled?: false | string | string[];
|
|
418
|
-
}>): Value<string>;
|
|
424
|
+
}>): Value<keyof Values & string, string>;
|
|
419
425
|
/**
|
|
420
426
|
* @description Displays a select modal with checkboxes, allowing for multiple selections.
|
|
421
427
|
* @example
|
|
@@ -467,17 +473,17 @@ export declare class Value<Type> {
|
|
|
467
473
|
* @default false
|
|
468
474
|
*/
|
|
469
475
|
immutable?: boolean;
|
|
470
|
-
}): Value<(keyof Values)[]>;
|
|
471
|
-
static dynamicMultiselect(getA: LazyBuild<{
|
|
476
|
+
}): Value<(keyof Values & string)[], (keyof Values & string)[]>;
|
|
477
|
+
static dynamicMultiselect<Values extends Record<string, string>>(getA: LazyBuild<{
|
|
472
478
|
name: string;
|
|
473
479
|
description?: string | null;
|
|
474
480
|
warning?: string | null;
|
|
475
481
|
default: string[];
|
|
476
|
-
values:
|
|
482
|
+
values: Values;
|
|
477
483
|
minLength?: number | null;
|
|
478
484
|
maxLength?: number | null;
|
|
479
485
|
disabled?: false | string | string[];
|
|
480
|
-
}>): Value<string[]>;
|
|
486
|
+
}>): Value<(keyof Values & string)[], string[]>;
|
|
481
487
|
/**
|
|
482
488
|
* @description Display a collapsable grouping of additional fields, a "sub form". The second value is the inputSpec spec for the sub form.
|
|
483
489
|
* @example
|
|
@@ -495,10 +501,10 @@ export declare class Value<Type> {
|
|
|
495
501
|
),
|
|
496
502
|
* ```
|
|
497
503
|
*/
|
|
498
|
-
static object<Type extends Record<string, any>>(a: {
|
|
504
|
+
static object<Type extends StaticValidatedAs, StaticValidatedAs extends Record<string, any>>(a: {
|
|
499
505
|
name: string;
|
|
500
506
|
description?: string | null;
|
|
501
|
-
}, spec: InputSpec<Type>): Value<Type>;
|
|
507
|
+
}, spec: InputSpec<Type, StaticValidatedAs>): Value<Type, StaticValidatedAs>;
|
|
502
508
|
/**
|
|
503
509
|
* @description Displays a dropdown, allowing for a single selection. Depending on the selection, a different object ("sub form") is presented.
|
|
504
510
|
* @example
|
|
@@ -538,6 +544,7 @@ export declare class Value<Type> {
|
|
|
538
544
|
description?: string | null;
|
|
539
545
|
/** Presents a warning prompt before permitting the value to change. */
|
|
540
546
|
warning?: string | null;
|
|
547
|
+
variants: Variants<VariantValues>;
|
|
541
548
|
/**
|
|
542
549
|
* @description Provide a default value from the list of variants.
|
|
543
550
|
* @type { string }
|
|
@@ -549,7 +556,7 @@ export declare class Value<Type> {
|
|
|
549
556
|
* @default false
|
|
550
557
|
*/
|
|
551
558
|
immutable?: boolean;
|
|
552
|
-
}
|
|
559
|
+
}): Value<UnionRes<VariantValues, keyof VariantValues & string>, UnionResStaticValidatedAs<VariantValues, keyof VariantValues & string>>;
|
|
553
560
|
static dynamicUnion<VariantValues extends {
|
|
554
561
|
[K in string]: {
|
|
555
562
|
name: string;
|
|
@@ -559,9 +566,23 @@ export declare class Value<Type> {
|
|
|
559
566
|
name: string;
|
|
560
567
|
description?: string | null;
|
|
561
568
|
warning?: string | null;
|
|
569
|
+
variants: Variants<VariantValues>;
|
|
562
570
|
default: keyof VariantValues & string;
|
|
563
571
|
disabled: string[] | false | string;
|
|
564
|
-
}
|
|
572
|
+
}>): Value<UnionRes<VariantValues>, unknown>;
|
|
573
|
+
static dynamicUnion<VariantValues extends StaticVariantValues, StaticVariantValues extends {
|
|
574
|
+
[K in string]: {
|
|
575
|
+
name: string;
|
|
576
|
+
spec: InputSpec<any, any>;
|
|
577
|
+
};
|
|
578
|
+
}>(getA: LazyBuild<{
|
|
579
|
+
name: string;
|
|
580
|
+
description?: string | null;
|
|
581
|
+
warning?: string | null;
|
|
582
|
+
variants: Variants<VariantValues>;
|
|
583
|
+
default: keyof VariantValues & string;
|
|
584
|
+
disabled: string[] | false | string;
|
|
585
|
+
}>, validator: Parser<unknown, UnionResStaticValidatedAs<StaticVariantValues>>): Value<UnionRes<VariantValues>, UnionResStaticValidatedAs<StaticVariantValues>>;
|
|
565
586
|
/**
|
|
566
587
|
* @description Presents an interface to add/remove/edit items in a list.
|
|
567
588
|
* @example
|
|
@@ -625,7 +646,16 @@ export declare class Value<Type> {
|
|
|
625
646
|
),
|
|
626
647
|
* ```
|
|
627
648
|
*/
|
|
628
|
-
static list<Type>(a: List<Type>): Value<Type>;
|
|
649
|
+
static list<Type>(a: List<Type>): Value<Type, Type>;
|
|
650
|
+
/**
|
|
651
|
+
* @description Provides a way to define a hidden field with a static value. Useful for tracking
|
|
652
|
+
* @example
|
|
653
|
+
* ```
|
|
654
|
+
hiddenExample: Value.hidden(),
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
static hidden<T>(): Value<T, unknown>;
|
|
658
|
+
static hidden<T>(parser: Parser<unknown, T>): Value<T>;
|
|
629
659
|
/**
|
|
630
660
|
* @description Provides a way to define a hidden field with a static value. Useful for tracking
|
|
631
661
|
* @example
|
|
@@ -633,7 +663,7 @@ export declare class Value<Type> {
|
|
|
633
663
|
hiddenExample: Value.hidden(),
|
|
634
664
|
* ```
|
|
635
665
|
*/
|
|
636
|
-
static
|
|
637
|
-
map<U>(fn: (value:
|
|
666
|
+
static dynamicHidden<T>(getParser: LazyBuild<Parser<unknown, T>>): Value<T, unknown>;
|
|
667
|
+
map<U>(fn: (value: StaticValidatedAs) => U): Value<U>;
|
|
638
668
|
}
|
|
639
669
|
export {};
|