@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
|
@@ -16,7 +16,9 @@ describe("builder tests", () => {
|
|
|
16
16
|
required: true,
|
|
17
17
|
default: null,
|
|
18
18
|
}),
|
|
19
|
-
})
|
|
19
|
+
})
|
|
20
|
+
.build({})
|
|
21
|
+
.then((a) => a.spec);
|
|
20
22
|
expect(bitcoinPropertiesBuilt).toMatchObject({
|
|
21
23
|
"peer-tor-address": {
|
|
22
24
|
type: "text",
|
|
@@ -38,66 +40,66 @@ describe("builder tests", () => {
|
|
|
38
40
|
});
|
|
39
41
|
describe("values", () => {
|
|
40
42
|
test("toggle", async () => {
|
|
41
|
-
const value = value_1.Value.toggle({
|
|
43
|
+
const value = await value_1.Value.toggle({
|
|
42
44
|
name: "Testing",
|
|
43
45
|
description: null,
|
|
44
46
|
warning: null,
|
|
45
47
|
default: false,
|
|
46
|
-
});
|
|
48
|
+
}).build({});
|
|
47
49
|
const validator = value.validator;
|
|
48
50
|
validator.unsafeCast(false);
|
|
49
51
|
(0, output_test_1.testOutput)()(null);
|
|
50
52
|
});
|
|
51
53
|
test("text", async () => {
|
|
52
|
-
const value = value_1.Value.text({
|
|
54
|
+
const value = await value_1.Value.text({
|
|
53
55
|
name: "Testing",
|
|
54
56
|
required: true,
|
|
55
57
|
default: null,
|
|
56
|
-
});
|
|
58
|
+
}).build({});
|
|
57
59
|
const validator = value.validator;
|
|
58
|
-
const rawIs =
|
|
60
|
+
const rawIs = value.spec;
|
|
59
61
|
validator.unsafeCast("test text");
|
|
60
62
|
expect(() => validator.unsafeCast(null)).toThrowError();
|
|
61
63
|
(0, output_test_1.testOutput)()(null);
|
|
62
64
|
});
|
|
63
65
|
test("text with default", async () => {
|
|
64
|
-
const value = value_1.Value.text({
|
|
66
|
+
const value = await value_1.Value.text({
|
|
65
67
|
name: "Testing",
|
|
66
68
|
required: true,
|
|
67
69
|
default: "this is a default value",
|
|
68
|
-
});
|
|
70
|
+
}).build({});
|
|
69
71
|
const validator = value.validator;
|
|
70
|
-
const rawIs =
|
|
72
|
+
const rawIs = value.spec;
|
|
71
73
|
validator.unsafeCast("test text");
|
|
72
74
|
expect(() => validator.unsafeCast(null)).toThrowError();
|
|
73
75
|
(0, output_test_1.testOutput)()(null);
|
|
74
76
|
});
|
|
75
77
|
test("optional text", async () => {
|
|
76
|
-
const value = value_1.Value.text({
|
|
78
|
+
const value = await value_1.Value.text({
|
|
77
79
|
name: "Testing",
|
|
78
80
|
required: false,
|
|
79
81
|
default: null,
|
|
80
|
-
});
|
|
82
|
+
}).build({});
|
|
81
83
|
const validator = value.validator;
|
|
82
|
-
const rawIs =
|
|
84
|
+
const rawIs = value.spec;
|
|
83
85
|
validator.unsafeCast("test text");
|
|
84
86
|
validator.unsafeCast(null);
|
|
85
87
|
(0, output_test_1.testOutput)()(null);
|
|
86
88
|
});
|
|
87
89
|
test("color", async () => {
|
|
88
|
-
const value = value_1.Value.color({
|
|
90
|
+
const value = await value_1.Value.color({
|
|
89
91
|
name: "Testing",
|
|
90
92
|
required: false,
|
|
91
93
|
default: null,
|
|
92
94
|
description: null,
|
|
93
95
|
warning: null,
|
|
94
|
-
});
|
|
96
|
+
}).build({});
|
|
95
97
|
const validator = value.validator;
|
|
96
98
|
validator.unsafeCast("#000000");
|
|
97
99
|
(0, output_test_1.testOutput)()(null);
|
|
98
100
|
});
|
|
99
101
|
test("datetime", async () => {
|
|
100
|
-
const value = value_1.Value.datetime({
|
|
102
|
+
const value = await value_1.Value.datetime({
|
|
101
103
|
name: "Testing",
|
|
102
104
|
required: true,
|
|
103
105
|
default: null,
|
|
@@ -106,13 +108,13 @@ describe("values", () => {
|
|
|
106
108
|
inputmode: "date",
|
|
107
109
|
min: null,
|
|
108
110
|
max: null,
|
|
109
|
-
});
|
|
111
|
+
}).build({});
|
|
110
112
|
const validator = value.validator;
|
|
111
113
|
validator.unsafeCast("2021-01-01");
|
|
112
114
|
(0, output_test_1.testOutput)()(null);
|
|
113
115
|
});
|
|
114
116
|
test("optional datetime", async () => {
|
|
115
|
-
const value = value_1.Value.datetime({
|
|
117
|
+
const value = await value_1.Value.datetime({
|
|
116
118
|
name: "Testing",
|
|
117
119
|
required: false,
|
|
118
120
|
default: null,
|
|
@@ -121,13 +123,13 @@ describe("values", () => {
|
|
|
121
123
|
inputmode: "date",
|
|
122
124
|
min: null,
|
|
123
125
|
max: null,
|
|
124
|
-
});
|
|
126
|
+
}).build({});
|
|
125
127
|
const validator = value.validator;
|
|
126
128
|
validator.unsafeCast("2021-01-01");
|
|
127
129
|
(0, output_test_1.testOutput)()(null);
|
|
128
130
|
});
|
|
129
131
|
test("textarea", async () => {
|
|
130
|
-
const value = value_1.Value.textarea({
|
|
132
|
+
const value = await value_1.Value.textarea({
|
|
131
133
|
name: "Testing",
|
|
132
134
|
required: false,
|
|
133
135
|
default: null,
|
|
@@ -136,13 +138,13 @@ describe("values", () => {
|
|
|
136
138
|
minLength: null,
|
|
137
139
|
maxLength: null,
|
|
138
140
|
placeholder: null,
|
|
139
|
-
});
|
|
141
|
+
}).build({});
|
|
140
142
|
const validator = value.validator;
|
|
141
143
|
validator.unsafeCast("test text");
|
|
142
144
|
(0, output_test_1.testOutput)()(null);
|
|
143
145
|
});
|
|
144
146
|
test("number", async () => {
|
|
145
|
-
const value = value_1.Value.number({
|
|
147
|
+
const value = await value_1.Value.number({
|
|
146
148
|
name: "Testing",
|
|
147
149
|
required: true,
|
|
148
150
|
default: null,
|
|
@@ -154,13 +156,13 @@ describe("values", () => {
|
|
|
154
156
|
step: null,
|
|
155
157
|
units: null,
|
|
156
158
|
placeholder: null,
|
|
157
|
-
});
|
|
159
|
+
}).build({});
|
|
158
160
|
const validator = value.validator;
|
|
159
161
|
validator.unsafeCast(2);
|
|
160
162
|
(0, output_test_1.testOutput)()(null);
|
|
161
163
|
});
|
|
162
164
|
test("optional number", async () => {
|
|
163
|
-
const value = value_1.Value.number({
|
|
165
|
+
const value = await value_1.Value.number({
|
|
164
166
|
name: "Testing",
|
|
165
167
|
required: false,
|
|
166
168
|
default: null,
|
|
@@ -172,13 +174,13 @@ describe("values", () => {
|
|
|
172
174
|
step: null,
|
|
173
175
|
units: null,
|
|
174
176
|
placeholder: null,
|
|
175
|
-
});
|
|
177
|
+
}).build({});
|
|
176
178
|
const validator = value.validator;
|
|
177
179
|
validator.unsafeCast(2);
|
|
178
180
|
(0, output_test_1.testOutput)()(null);
|
|
179
181
|
});
|
|
180
182
|
test("select", async () => {
|
|
181
|
-
const value = value_1.Value.select({
|
|
183
|
+
const value = await value_1.Value.select({
|
|
182
184
|
name: "Testing",
|
|
183
185
|
default: "a",
|
|
184
186
|
values: {
|
|
@@ -187,7 +189,7 @@ describe("values", () => {
|
|
|
187
189
|
},
|
|
188
190
|
description: null,
|
|
189
191
|
warning: null,
|
|
190
|
-
});
|
|
192
|
+
}).build({});
|
|
191
193
|
const validator = value.validator;
|
|
192
194
|
validator.unsafeCast("a");
|
|
193
195
|
validator.unsafeCast("b");
|
|
@@ -195,7 +197,7 @@ describe("values", () => {
|
|
|
195
197
|
(0, output_test_1.testOutput)()(null);
|
|
196
198
|
});
|
|
197
199
|
test("nullable select", async () => {
|
|
198
|
-
const value = value_1.Value.select({
|
|
200
|
+
const value = await value_1.Value.select({
|
|
199
201
|
name: "Testing",
|
|
200
202
|
default: "a",
|
|
201
203
|
values: {
|
|
@@ -204,14 +206,14 @@ describe("values", () => {
|
|
|
204
206
|
},
|
|
205
207
|
description: null,
|
|
206
208
|
warning: null,
|
|
207
|
-
});
|
|
209
|
+
}).build({});
|
|
208
210
|
const validator = value.validator;
|
|
209
211
|
validator.unsafeCast("a");
|
|
210
212
|
validator.unsafeCast("b");
|
|
211
213
|
(0, output_test_1.testOutput)()(null);
|
|
212
214
|
});
|
|
213
215
|
test("multiselect", async () => {
|
|
214
|
-
const value = value_1.Value.multiselect({
|
|
216
|
+
const value = await value_1.Value.multiselect({
|
|
215
217
|
name: "Testing",
|
|
216
218
|
values: {
|
|
217
219
|
a: "A",
|
|
@@ -222,7 +224,7 @@ describe("values", () => {
|
|
|
222
224
|
warning: null,
|
|
223
225
|
minLength: null,
|
|
224
226
|
maxLength: null,
|
|
225
|
-
});
|
|
227
|
+
}).build({});
|
|
226
228
|
const validator = value.validator;
|
|
227
229
|
validator.unsafeCast([]);
|
|
228
230
|
validator.unsafeCast(["a", "b"]);
|
|
@@ -231,7 +233,7 @@ describe("values", () => {
|
|
|
231
233
|
(0, output_test_1.testOutput)()(null);
|
|
232
234
|
});
|
|
233
235
|
test("object", async () => {
|
|
234
|
-
const value = value_1.Value.object({
|
|
236
|
+
const value = await value_1.Value.object({
|
|
235
237
|
name: "Testing",
|
|
236
238
|
description: null,
|
|
237
239
|
}, inputSpec_1.InputSpec.of({
|
|
@@ -241,30 +243,31 @@ describe("values", () => {
|
|
|
241
243
|
warning: null,
|
|
242
244
|
default: false,
|
|
243
245
|
}),
|
|
244
|
-
}));
|
|
246
|
+
})).build({});
|
|
245
247
|
const validator = value.validator;
|
|
246
248
|
validator.unsafeCast({ a: true });
|
|
247
249
|
(0, output_test_1.testOutput)()(null);
|
|
248
250
|
});
|
|
249
251
|
test("union", async () => {
|
|
250
|
-
const value = value_1.Value.union({
|
|
252
|
+
const value = await value_1.Value.union({
|
|
251
253
|
name: "Testing",
|
|
252
254
|
default: "a",
|
|
253
255
|
description: null,
|
|
254
256
|
warning: null,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
variants: variants_1.Variants.of({
|
|
258
|
+
a: {
|
|
259
|
+
name: "a",
|
|
260
|
+
spec: inputSpec_1.InputSpec.of({
|
|
261
|
+
b: value_1.Value.toggle({
|
|
262
|
+
name: "b",
|
|
263
|
+
description: null,
|
|
264
|
+
warning: null,
|
|
265
|
+
default: false,
|
|
266
|
+
}),
|
|
264
267
|
}),
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
}));
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
}).build({});
|
|
268
271
|
const validator = value.validator;
|
|
269
272
|
validator.unsafeCast({ selection: "a", value: { b: false } });
|
|
270
273
|
(0, output_test_1.testOutput)()(null);
|
|
@@ -276,17 +279,17 @@ describe("values", () => {
|
|
|
276
279
|
utils: "utils",
|
|
277
280
|
};
|
|
278
281
|
test("toggle", async () => {
|
|
279
|
-
const value = value_1.Value.dynamicToggle(async () => ({
|
|
282
|
+
const value = await value_1.Value.dynamicToggle(async () => ({
|
|
280
283
|
name: "Testing",
|
|
281
284
|
description: null,
|
|
282
285
|
warning: null,
|
|
283
286
|
default: false,
|
|
284
|
-
}));
|
|
287
|
+
})).build({});
|
|
285
288
|
const validator = value.validator;
|
|
286
289
|
validator.unsafeCast(false);
|
|
287
290
|
expect(() => validator.unsafeCast(null)).toThrowError();
|
|
288
291
|
(0, output_test_1.testOutput)()(null);
|
|
289
|
-
expect(
|
|
292
|
+
expect(value.spec).toMatchObject({
|
|
290
293
|
name: "Testing",
|
|
291
294
|
description: null,
|
|
292
295
|
warning: null,
|
|
@@ -294,68 +297,68 @@ describe("values", () => {
|
|
|
294
297
|
});
|
|
295
298
|
});
|
|
296
299
|
test("text", async () => {
|
|
297
|
-
const value = value_1.Value.dynamicText(async () => ({
|
|
300
|
+
const value = await value_1.Value.dynamicText(async () => ({
|
|
298
301
|
name: "Testing",
|
|
299
302
|
required: false,
|
|
300
303
|
default: null,
|
|
301
|
-
}));
|
|
304
|
+
})).build({});
|
|
302
305
|
const validator = value.validator;
|
|
303
|
-
const rawIs =
|
|
306
|
+
const rawIs = value.spec;
|
|
304
307
|
validator.unsafeCast("test text");
|
|
305
308
|
validator.unsafeCast(null);
|
|
306
309
|
(0, output_test_1.testOutput)()(null);
|
|
307
|
-
expect(
|
|
310
|
+
expect(value.spec).toMatchObject({
|
|
308
311
|
name: "Testing",
|
|
309
312
|
required: false,
|
|
310
313
|
default: null,
|
|
311
314
|
});
|
|
312
315
|
});
|
|
313
316
|
test("text with default", async () => {
|
|
314
|
-
const value = value_1.Value.dynamicText(async () => ({
|
|
317
|
+
const value = await value_1.Value.dynamicText(async () => ({
|
|
315
318
|
name: "Testing",
|
|
316
319
|
required: false,
|
|
317
320
|
default: "this is a default value",
|
|
318
|
-
}));
|
|
321
|
+
})).build({});
|
|
319
322
|
const validator = value.validator;
|
|
320
323
|
validator.unsafeCast("test text");
|
|
321
324
|
validator.unsafeCast(null);
|
|
322
325
|
(0, output_test_1.testOutput)()(null);
|
|
323
|
-
expect(
|
|
326
|
+
expect(value.spec).toMatchObject({
|
|
324
327
|
name: "Testing",
|
|
325
328
|
required: false,
|
|
326
329
|
default: "this is a default value",
|
|
327
330
|
});
|
|
328
331
|
});
|
|
329
332
|
test("optional text", async () => {
|
|
330
|
-
const value = value_1.Value.dynamicText(async () => ({
|
|
333
|
+
const value = await value_1.Value.dynamicText(async () => ({
|
|
331
334
|
name: "Testing",
|
|
332
335
|
required: false,
|
|
333
336
|
default: null,
|
|
334
|
-
}));
|
|
337
|
+
})).build({});
|
|
335
338
|
const validator = value.validator;
|
|
336
|
-
const rawIs =
|
|
339
|
+
const rawIs = value.spec;
|
|
337
340
|
validator.unsafeCast("test text");
|
|
338
341
|
validator.unsafeCast(null);
|
|
339
342
|
(0, output_test_1.testOutput)()(null);
|
|
340
|
-
expect(
|
|
343
|
+
expect(value.spec).toMatchObject({
|
|
341
344
|
name: "Testing",
|
|
342
345
|
required: false,
|
|
343
346
|
default: null,
|
|
344
347
|
});
|
|
345
348
|
});
|
|
346
349
|
test("color", async () => {
|
|
347
|
-
const value = value_1.Value.dynamicColor(async () => ({
|
|
350
|
+
const value = await value_1.Value.dynamicColor(async () => ({
|
|
348
351
|
name: "Testing",
|
|
349
352
|
required: false,
|
|
350
353
|
default: null,
|
|
351
354
|
description: null,
|
|
352
355
|
warning: null,
|
|
353
|
-
}));
|
|
356
|
+
})).build({});
|
|
354
357
|
const validator = value.validator;
|
|
355
358
|
validator.unsafeCast("#000000");
|
|
356
359
|
validator.unsafeCast(null);
|
|
357
360
|
(0, output_test_1.testOutput)()(null);
|
|
358
|
-
expect(
|
|
361
|
+
expect(value.spec).toMatchObject({
|
|
359
362
|
name: "Testing",
|
|
360
363
|
required: false,
|
|
361
364
|
default: null,
|
|
@@ -399,21 +402,21 @@ describe("values", () => {
|
|
|
399
402
|
},
|
|
400
403
|
}))
|
|
401
404
|
.build(true);
|
|
402
|
-
const value = value_1.Value.dynamicDatetime(async ({ effects }) => {
|
|
405
|
+
const value = await value_1.Value.dynamicDatetime(async ({ effects }) => {
|
|
403
406
|
return {
|
|
404
407
|
name: "Testing",
|
|
405
|
-
required:
|
|
408
|
+
required: false,
|
|
406
409
|
default: null,
|
|
407
410
|
inputmode: "date",
|
|
408
411
|
};
|
|
409
|
-
});
|
|
412
|
+
}).build({});
|
|
410
413
|
const validator = value.validator;
|
|
411
414
|
validator.unsafeCast("2021-01-01");
|
|
412
415
|
validator.unsafeCast(null);
|
|
413
416
|
(0, output_test_1.testOutput)()(null);
|
|
414
|
-
expect(
|
|
417
|
+
expect(value.spec).toMatchObject({
|
|
415
418
|
name: "Testing",
|
|
416
|
-
required:
|
|
419
|
+
required: false,
|
|
417
420
|
default: null,
|
|
418
421
|
description: null,
|
|
419
422
|
warning: null,
|
|
@@ -421,7 +424,7 @@ describe("values", () => {
|
|
|
421
424
|
});
|
|
422
425
|
});
|
|
423
426
|
test("textarea", async () => {
|
|
424
|
-
const value = value_1.Value.dynamicTextarea(async () => ({
|
|
427
|
+
const value = await value_1.Value.dynamicTextarea(async () => ({
|
|
425
428
|
name: "Testing",
|
|
426
429
|
required: false,
|
|
427
430
|
default: null,
|
|
@@ -430,19 +433,19 @@ describe("values", () => {
|
|
|
430
433
|
minLength: null,
|
|
431
434
|
maxLength: null,
|
|
432
435
|
placeholder: null,
|
|
433
|
-
}));
|
|
436
|
+
})).build({});
|
|
434
437
|
const validator = value.validator;
|
|
435
438
|
validator.unsafeCast("test text");
|
|
436
439
|
(0, output_test_1.testOutput)()(null);
|
|
437
|
-
expect(
|
|
440
|
+
expect(value.spec).toMatchObject({
|
|
438
441
|
name: "Testing",
|
|
439
442
|
required: false,
|
|
440
443
|
});
|
|
441
444
|
});
|
|
442
445
|
test("number", async () => {
|
|
443
|
-
const value = value_1.Value.dynamicNumber(() => ({
|
|
446
|
+
const value = await value_1.Value.dynamicNumber(() => ({
|
|
444
447
|
name: "Testing",
|
|
445
|
-
required:
|
|
448
|
+
required: false,
|
|
446
449
|
default: null,
|
|
447
450
|
integer: false,
|
|
448
451
|
description: null,
|
|
@@ -452,19 +455,19 @@ describe("values", () => {
|
|
|
452
455
|
step: null,
|
|
453
456
|
units: null,
|
|
454
457
|
placeholder: null,
|
|
455
|
-
}));
|
|
458
|
+
})).build({});
|
|
456
459
|
const validator = value.validator;
|
|
457
460
|
validator.unsafeCast(2);
|
|
458
461
|
validator.unsafeCast(null);
|
|
459
462
|
expect(() => validator.unsafeCast("null")).toThrowError();
|
|
460
463
|
(0, output_test_1.testOutput)()(null);
|
|
461
|
-
expect(
|
|
464
|
+
expect(value.spec).toMatchObject({
|
|
462
465
|
name: "Testing",
|
|
463
|
-
required:
|
|
466
|
+
required: false,
|
|
464
467
|
});
|
|
465
468
|
});
|
|
466
469
|
test("select", async () => {
|
|
467
|
-
const value = value_1.Value.dynamicSelect(() => ({
|
|
470
|
+
const value = await value_1.Value.dynamicSelect(() => ({
|
|
468
471
|
name: "Testing",
|
|
469
472
|
default: "a",
|
|
470
473
|
values: {
|
|
@@ -473,18 +476,17 @@ describe("values", () => {
|
|
|
473
476
|
},
|
|
474
477
|
description: null,
|
|
475
478
|
warning: null,
|
|
476
|
-
}));
|
|
479
|
+
})).build({});
|
|
477
480
|
const validator = value.validator;
|
|
478
481
|
validator.unsafeCast("a");
|
|
479
482
|
validator.unsafeCast("b");
|
|
480
|
-
validator.unsafeCast("c");
|
|
481
483
|
(0, output_test_1.testOutput)()(null);
|
|
482
|
-
expect(
|
|
484
|
+
expect(value.spec).toMatchObject({
|
|
483
485
|
name: "Testing",
|
|
484
486
|
});
|
|
485
487
|
});
|
|
486
488
|
test("multiselect", async () => {
|
|
487
|
-
const value = value_1.Value.dynamicMultiselect(() => ({
|
|
489
|
+
const value = await value_1.Value.dynamicMultiselect(() => ({
|
|
488
490
|
name: "Testing",
|
|
489
491
|
values: {
|
|
490
492
|
a: "A",
|
|
@@ -495,15 +497,14 @@ describe("values", () => {
|
|
|
495
497
|
warning: null,
|
|
496
498
|
minLength: null,
|
|
497
499
|
maxLength: null,
|
|
498
|
-
}));
|
|
500
|
+
})).build({});
|
|
499
501
|
const validator = value.validator;
|
|
500
502
|
validator.unsafeCast([]);
|
|
501
503
|
validator.unsafeCast(["a", "b"]);
|
|
502
|
-
validator.unsafeCast(["c"]);
|
|
503
504
|
expect(() => validator.unsafeCast([4])).toThrowError();
|
|
504
505
|
expect(() => validator.unsafeCast(null)).toThrowError();
|
|
505
506
|
(0, output_test_1.testOutput)()(null);
|
|
506
|
-
expect(
|
|
507
|
+
expect(value.spec).toMatchObject({
|
|
507
508
|
name: "Testing",
|
|
508
509
|
default: [],
|
|
509
510
|
});
|
|
@@ -511,40 +512,41 @@ describe("values", () => {
|
|
|
511
512
|
});
|
|
512
513
|
describe("filtering", () => {
|
|
513
514
|
test("union", async () => {
|
|
514
|
-
const value = value_1.Value.dynamicUnion(() => ({
|
|
515
|
+
const value = await value_1.Value.dynamicUnion(() => ({
|
|
515
516
|
name: "Testing",
|
|
516
517
|
default: "a",
|
|
517
518
|
description: null,
|
|
518
519
|
warning: null,
|
|
519
520
|
disabled: ["a", "c"],
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
521
|
+
variants: variants_1.Variants.of({
|
|
522
|
+
a: {
|
|
523
|
+
name: "a",
|
|
524
|
+
spec: inputSpec_1.InputSpec.of({
|
|
525
|
+
b: value_1.Value.toggle({
|
|
526
|
+
name: "b",
|
|
527
|
+
description: null,
|
|
528
|
+
warning: null,
|
|
529
|
+
default: false,
|
|
530
|
+
}),
|
|
529
531
|
}),
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
532
|
+
},
|
|
533
|
+
b: {
|
|
534
|
+
name: "b",
|
|
535
|
+
spec: inputSpec_1.InputSpec.of({
|
|
536
|
+
b: value_1.Value.toggle({
|
|
537
|
+
name: "b",
|
|
538
|
+
description: null,
|
|
539
|
+
warning: null,
|
|
540
|
+
default: false,
|
|
541
|
+
}),
|
|
540
542
|
}),
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
}));
|
|
543
|
+
},
|
|
544
|
+
}),
|
|
545
|
+
})).build({});
|
|
544
546
|
const validator = value.validator;
|
|
545
547
|
validator.unsafeCast({ selection: "a", value: { b: false } });
|
|
546
548
|
(0, output_test_1.testOutput)()(null);
|
|
547
|
-
const built =
|
|
549
|
+
const built = value.spec;
|
|
548
550
|
expect(built).toMatchObject({
|
|
549
551
|
name: "Testing",
|
|
550
552
|
variants: {
|
|
@@ -569,40 +571,41 @@ describe("values", () => {
|
|
|
569
571
|
});
|
|
570
572
|
});
|
|
571
573
|
test("dynamic union", async () => {
|
|
572
|
-
const value = value_1.Value.dynamicUnion(() => ({
|
|
574
|
+
const value = await value_1.Value.dynamicUnion(() => ({
|
|
573
575
|
disabled: ["a", "c"],
|
|
574
576
|
name: "Testing",
|
|
575
577
|
default: "b",
|
|
576
578
|
description: null,
|
|
577
579
|
warning: null,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
580
|
+
variants: variants_1.Variants.of({
|
|
581
|
+
a: {
|
|
582
|
+
name: "a",
|
|
583
|
+
spec: inputSpec_1.InputSpec.of({
|
|
584
|
+
b: value_1.Value.toggle({
|
|
585
|
+
name: "b",
|
|
586
|
+
description: null,
|
|
587
|
+
warning: null,
|
|
588
|
+
default: false,
|
|
589
|
+
}),
|
|
587
590
|
}),
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
591
|
+
},
|
|
592
|
+
b: {
|
|
593
|
+
name: "b",
|
|
594
|
+
spec: inputSpec_1.InputSpec.of({
|
|
595
|
+
b: value_1.Value.toggle({
|
|
596
|
+
name: "b",
|
|
597
|
+
description: null,
|
|
598
|
+
warning: null,
|
|
599
|
+
default: false,
|
|
600
|
+
}),
|
|
598
601
|
}),
|
|
599
|
-
}
|
|
600
|
-
},
|
|
601
|
-
}));
|
|
602
|
+
},
|
|
603
|
+
}),
|
|
604
|
+
})).build({});
|
|
602
605
|
const validator = value.validator;
|
|
603
606
|
validator.unsafeCast({ selection: "a", value: { b: false } });
|
|
604
607
|
(0, output_test_1.testOutput)()(null);
|
|
605
|
-
const built =
|
|
608
|
+
const built = value.spec;
|
|
606
609
|
expect(built).toMatchObject({
|
|
607
610
|
name: "Testing",
|
|
608
611
|
variants: {
|
|
@@ -628,7 +631,7 @@ describe("values", () => {
|
|
|
628
631
|
});
|
|
629
632
|
describe("Builder List", () => {
|
|
630
633
|
test("obj", async () => {
|
|
631
|
-
const value = value_1.Value.list(list_1.List.obj({
|
|
634
|
+
const value = await value_1.Value.list(list_1.List.obj({
|
|
632
635
|
name: "test",
|
|
633
636
|
}, {
|
|
634
637
|
spec: inputSpec_1.InputSpec.of({
|
|
@@ -639,33 +642,33 @@ describe("Builder List", () => {
|
|
|
639
642
|
default: false,
|
|
640
643
|
}),
|
|
641
644
|
}),
|
|
642
|
-
}));
|
|
645
|
+
})).build({});
|
|
643
646
|
const validator = value.validator;
|
|
644
647
|
validator.unsafeCast([{ test: true }]);
|
|
645
648
|
(0, output_test_1.testOutput)()(null);
|
|
646
649
|
});
|
|
647
650
|
test("text", async () => {
|
|
648
|
-
const value = value_1.Value.list(list_1.List.text({
|
|
651
|
+
const value = await value_1.Value.list(list_1.List.text({
|
|
649
652
|
name: "test",
|
|
650
653
|
}, {
|
|
651
654
|
patterns: [],
|
|
652
|
-
}));
|
|
655
|
+
})).build({});
|
|
653
656
|
const validator = value.validator;
|
|
654
657
|
validator.unsafeCast(["test", "text"]);
|
|
655
658
|
(0, output_test_1.testOutput)()(null);
|
|
656
659
|
});
|
|
657
660
|
describe("dynamic", () => {
|
|
658
661
|
test("text", async () => {
|
|
659
|
-
const value = value_1.Value.list(list_1.List.dynamicText(() => ({
|
|
662
|
+
const value = await value_1.Value.list(list_1.List.dynamicText(() => ({
|
|
660
663
|
name: "test",
|
|
661
664
|
spec: { patterns: [] },
|
|
662
|
-
})));
|
|
665
|
+
}))).build({});
|
|
663
666
|
const validator = value.validator;
|
|
664
667
|
validator.unsafeCast(["test", "text"]);
|
|
665
668
|
expect(() => validator.unsafeCast([3, 4])).toThrowError();
|
|
666
669
|
expect(() => validator.unsafeCast(null)).toThrowError();
|
|
667
670
|
(0, output_test_1.testOutput)()(null);
|
|
668
|
-
expect(
|
|
671
|
+
expect(value.spec).toMatchObject({
|
|
669
672
|
name: "test",
|
|
670
673
|
spec: { patterns: [] },
|
|
671
674
|
});
|
|
@@ -674,14 +677,14 @@ describe("Builder List", () => {
|
|
|
674
677
|
});
|
|
675
678
|
describe("Nested nullable values", () => {
|
|
676
679
|
test("Testing text", async () => {
|
|
677
|
-
const value = inputSpec_1.InputSpec.of({
|
|
680
|
+
const value = await inputSpec_1.InputSpec.of({
|
|
678
681
|
a: value_1.Value.text({
|
|
679
682
|
name: "Temp Name",
|
|
680
683
|
description: "If no name is provided, the name from inputSpec will be used",
|
|
681
684
|
required: false,
|
|
682
685
|
default: null,
|
|
683
686
|
}),
|
|
684
|
-
});
|
|
687
|
+
}).build({});
|
|
685
688
|
const validator = value.validator;
|
|
686
689
|
validator.unsafeCast({ a: null });
|
|
687
690
|
validator.unsafeCast({ a: "test" });
|
|
@@ -689,7 +692,7 @@ describe("Nested nullable values", () => {
|
|
|
689
692
|
(0, output_test_1.testOutput)()(null);
|
|
690
693
|
});
|
|
691
694
|
test("Testing number", async () => {
|
|
692
|
-
const value = inputSpec_1.InputSpec.of({
|
|
695
|
+
const value = await inputSpec_1.InputSpec.of({
|
|
693
696
|
a: value_1.Value.number({
|
|
694
697
|
name: "Temp Name",
|
|
695
698
|
description: "If no name is provided, the name from inputSpec will be used",
|
|
@@ -703,7 +706,7 @@ describe("Nested nullable values", () => {
|
|
|
703
706
|
step: null,
|
|
704
707
|
units: null,
|
|
705
708
|
}),
|
|
706
|
-
});
|
|
709
|
+
}).build({});
|
|
707
710
|
const validator = value.validator;
|
|
708
711
|
validator.unsafeCast({ a: null });
|
|
709
712
|
validator.unsafeCast({ a: 5 });
|
|
@@ -711,7 +714,7 @@ describe("Nested nullable values", () => {
|
|
|
711
714
|
(0, output_test_1.testOutput)()(null);
|
|
712
715
|
});
|
|
713
716
|
test("Testing color", async () => {
|
|
714
|
-
const value = inputSpec_1.InputSpec.of({
|
|
717
|
+
const value = await inputSpec_1.InputSpec.of({
|
|
715
718
|
a: value_1.Value.color({
|
|
716
719
|
name: "Temp Name",
|
|
717
720
|
description: "If no name is provided, the name from inputSpec will be used",
|
|
@@ -719,7 +722,7 @@ describe("Nested nullable values", () => {
|
|
|
719
722
|
default: null,
|
|
720
723
|
warning: null,
|
|
721
724
|
}),
|
|
722
|
-
});
|
|
725
|
+
}).build({});
|
|
723
726
|
const validator = value.validator;
|
|
724
727
|
validator.unsafeCast({ a: null });
|
|
725
728
|
validator.unsafeCast({ a: "5" });
|
|
@@ -727,7 +730,7 @@ describe("Nested nullable values", () => {
|
|
|
727
730
|
(0, output_test_1.testOutput)()(null);
|
|
728
731
|
});
|
|
729
732
|
test("Testing select", async () => {
|
|
730
|
-
const value = inputSpec_1.InputSpec.of({
|
|
733
|
+
const value = await inputSpec_1.InputSpec.of({
|
|
731
734
|
a: value_1.Value.select({
|
|
732
735
|
name: "Temp Name",
|
|
733
736
|
description: "If no name is provided, the name from inputSpec will be used",
|
|
@@ -737,7 +740,7 @@ describe("Nested nullable values", () => {
|
|
|
737
740
|
a: "A",
|
|
738
741
|
},
|
|
739
742
|
}),
|
|
740
|
-
});
|
|
743
|
+
}).build({});
|
|
741
744
|
const higher = await value_1.Value.select({
|
|
742
745
|
name: "Temp Name",
|
|
743
746
|
description: "If no name is provided, the name from inputSpec will be used",
|
|
@@ -753,7 +756,7 @@ describe("Nested nullable values", () => {
|
|
|
753
756
|
(0, output_test_1.testOutput)()(null);
|
|
754
757
|
});
|
|
755
758
|
test("Testing multiselect", async () => {
|
|
756
|
-
const value = inputSpec_1.InputSpec.of({
|
|
759
|
+
const value = await inputSpec_1.InputSpec.of({
|
|
757
760
|
a: value_1.Value.multiselect({
|
|
758
761
|
name: "Temp Name",
|
|
759
762
|
description: "If no name is provided, the name from inputSpec will be used",
|
|
@@ -765,7 +768,7 @@ describe("Nested nullable values", () => {
|
|
|
765
768
|
minLength: null,
|
|
766
769
|
maxLength: null,
|
|
767
770
|
}),
|
|
768
|
-
});
|
|
771
|
+
}).build({});
|
|
769
772
|
const validator = value.validator;
|
|
770
773
|
validator.unsafeCast({ a: [] });
|
|
771
774
|
validator.unsafeCast({ a: ["a"] });
|