@rosen-bridge/config 0.4.0 → 1.0.0
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/CHANGELOG.md +6 -0
- package/dist/cli.js +1 -1
- package/dist/config.js +1 -1
- package/dist/schema/Validators/fieldProperties.d.ts +10 -10
- package/dist/schema/Validators/fieldProperties.d.ts.map +1 -1
- package/dist/schema/Validators/fieldProperties.js +21 -11
- package/dist/utils.js +1 -1
- package/dist/value/validators.d.ts.map +1 -1
- package/dist/value/validators.js +11 -6
- package/package.json +22 -12
- package/.eslintignore +0 -1
- package/lib/cli.ts +0 -113
- package/lib/config.ts +0 -733
- package/lib/index.ts +0 -1
- package/lib/schema/Validators/fieldProperties.ts +0 -365
- package/lib/schema/types/fields.ts +0 -54
- package/lib/schema/types/validations.ts +0 -63
- package/lib/utils.ts +0 -68
- package/lib/value/validators.ts +0 -273
- package/tests/.gitkeep +0 -0
- package/tests/config.spec.ts +0 -1363
- package/tests/configEnvSetup.ts +0 -34
- package/tests/configTestData.ts +0 -1735
- package/tests/configTestFiles/custom-environment-variables.json +0 -5
- package/tests/configTestFiles/default.json +0 -12
- package/tests/configTestFiles/local.json +0 -5
- package/tests/utils.spec.ts +0 -117
- package/tests/utilsTestData.ts +0 -26
- package/tsconfig.build.json +0 -8
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -8
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -18
package/tests/configTestData.ts
DELETED
|
@@ -1,1735 +0,0 @@
|
|
|
1
|
-
import { cloneDeep } from 'lodash-es';
|
|
2
|
-
export const apiSchemaDefaultValuePairSample = {
|
|
3
|
-
schema: {
|
|
4
|
-
apiType: {
|
|
5
|
-
type: 'string',
|
|
6
|
-
default: 'explorer',
|
|
7
|
-
description: 'type of api to use',
|
|
8
|
-
label: 'api type',
|
|
9
|
-
validations: [
|
|
10
|
-
{
|
|
11
|
-
required: true,
|
|
12
|
-
error: 'error message when value not validated',
|
|
13
|
-
},
|
|
14
|
-
{ choices: ['node', 'explorer'] },
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
servers: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
children: {
|
|
20
|
-
url: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
},
|
|
23
|
-
port: {
|
|
24
|
-
type: 'number',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
apis: {
|
|
29
|
-
type: 'object',
|
|
30
|
-
children: {
|
|
31
|
-
explorer: {
|
|
32
|
-
type: 'object',
|
|
33
|
-
children: {
|
|
34
|
-
url: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
default: 'example.com',
|
|
37
|
-
},
|
|
38
|
-
port: {
|
|
39
|
-
type: 'number',
|
|
40
|
-
default: 443,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
defaultVal: {
|
|
48
|
-
apiType: 'explorer',
|
|
49
|
-
apis: {
|
|
50
|
-
explorer: {
|
|
51
|
-
url: 'example.com',
|
|
52
|
-
port: 443,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const correctApiSchema = {
|
|
59
|
-
apiType: {
|
|
60
|
-
type: 'string',
|
|
61
|
-
default: 'explorer',
|
|
62
|
-
description: 'type of api to use',
|
|
63
|
-
label: 'api type',
|
|
64
|
-
validations: [
|
|
65
|
-
{ required: true, error: 'error message when value not validated' },
|
|
66
|
-
{ choices: ['node', 'explorer'] },
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
logs: {
|
|
70
|
-
type: 'array',
|
|
71
|
-
items: {
|
|
72
|
-
type: 'object',
|
|
73
|
-
children: {
|
|
74
|
-
type: {
|
|
75
|
-
type: 'string',
|
|
76
|
-
validations: [
|
|
77
|
-
{
|
|
78
|
-
required: true,
|
|
79
|
-
error: 'log type must be specified',
|
|
80
|
-
},
|
|
81
|
-
{ choices: ['file', 'console', 'loki'] },
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
maxSize: {
|
|
85
|
-
type: 'string',
|
|
86
|
-
validations: [
|
|
87
|
-
{
|
|
88
|
-
required: true,
|
|
89
|
-
error: 'maxSize for file log type must be specified',
|
|
90
|
-
when: { path: 'logs.type', value: 'file' },
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
maxFiles: {
|
|
95
|
-
type: 'string',
|
|
96
|
-
validations: [
|
|
97
|
-
{
|
|
98
|
-
required: true,
|
|
99
|
-
error: 'maxFiles for file log type must be specified',
|
|
100
|
-
when: { path: 'logs.type', value: 'file' },
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
path: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
validations: [
|
|
107
|
-
{
|
|
108
|
-
required: true,
|
|
109
|
-
error: 'path for file log type must be specified',
|
|
110
|
-
when: { path: 'logs.type', value: 'file' },
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
level: {
|
|
115
|
-
type: 'string',
|
|
116
|
-
validations: [
|
|
117
|
-
{
|
|
118
|
-
required: true,
|
|
119
|
-
error: 'log level must be specified',
|
|
120
|
-
when: { path: 'logs.type', value: 'file' },
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
servers: {
|
|
128
|
-
type: 'object',
|
|
129
|
-
children: {
|
|
130
|
-
url: {
|
|
131
|
-
type: 'string',
|
|
132
|
-
},
|
|
133
|
-
port: {
|
|
134
|
-
type: 'number',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
apis: {
|
|
139
|
-
type: 'object',
|
|
140
|
-
children: {
|
|
141
|
-
explorer: {
|
|
142
|
-
type: 'object',
|
|
143
|
-
children: {
|
|
144
|
-
url: {
|
|
145
|
-
type: 'string',
|
|
146
|
-
default: 'example.com',
|
|
147
|
-
},
|
|
148
|
-
port: {
|
|
149
|
-
type: 'number',
|
|
150
|
-
default: 443,
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
useTls: {
|
|
155
|
-
type: 'boolean',
|
|
156
|
-
default: false,
|
|
157
|
-
validations: [
|
|
158
|
-
{
|
|
159
|
-
required: true,
|
|
160
|
-
error: 'useTls must be specified',
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export const schemaWithIncorrectPortDefaultValueTypeSample = {
|
|
169
|
-
apiType: {
|
|
170
|
-
type: 'string',
|
|
171
|
-
default: 'explorer',
|
|
172
|
-
description: 'type of api to use',
|
|
173
|
-
label: 'api type',
|
|
174
|
-
validations: [
|
|
175
|
-
{ required: true, error: 'error message when value not validated' },
|
|
176
|
-
{ choices: ['node', 'explorer'] },
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
servers: {
|
|
180
|
-
type: 'object',
|
|
181
|
-
children: {
|
|
182
|
-
url: {
|
|
183
|
-
type: 'string',
|
|
184
|
-
},
|
|
185
|
-
port: {
|
|
186
|
-
type: 'number',
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
apis: {
|
|
191
|
-
type: 'object',
|
|
192
|
-
children: {
|
|
193
|
-
explorer: {
|
|
194
|
-
type: 'object',
|
|
195
|
-
children: {
|
|
196
|
-
url: {
|
|
197
|
-
type: 'string',
|
|
198
|
-
default: 'example.com',
|
|
199
|
-
},
|
|
200
|
-
port: {
|
|
201
|
-
type: 'number',
|
|
202
|
-
default: '443',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const arrayTypeSchemaWithoutItems = {
|
|
211
|
-
logs: {
|
|
212
|
-
type: 'array',
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const objectTypeSchemaWithoutChildren = {
|
|
217
|
-
api: {
|
|
218
|
-
type: 'object',
|
|
219
|
-
},
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export const apiSchemaConfigPair = {
|
|
223
|
-
schema: {
|
|
224
|
-
apiType: {
|
|
225
|
-
type: 'string',
|
|
226
|
-
default: 'explorer',
|
|
227
|
-
description: 'type of api to use',
|
|
228
|
-
label: 'api type',
|
|
229
|
-
validations: [
|
|
230
|
-
{
|
|
231
|
-
required: true,
|
|
232
|
-
error: 'error message when value not validated',
|
|
233
|
-
},
|
|
234
|
-
{ choices: ['node', 'explorer'] },
|
|
235
|
-
],
|
|
236
|
-
},
|
|
237
|
-
logs: {
|
|
238
|
-
type: 'array',
|
|
239
|
-
items: {
|
|
240
|
-
type: 'object',
|
|
241
|
-
children: {
|
|
242
|
-
type: {
|
|
243
|
-
type: 'string',
|
|
244
|
-
validations: [
|
|
245
|
-
{
|
|
246
|
-
required: true,
|
|
247
|
-
error: 'log type must be specified',
|
|
248
|
-
},
|
|
249
|
-
{ choices: ['file', 'console', 'loki'] },
|
|
250
|
-
],
|
|
251
|
-
},
|
|
252
|
-
maxSize: {
|
|
253
|
-
type: 'string',
|
|
254
|
-
validations: [
|
|
255
|
-
{
|
|
256
|
-
required: true,
|
|
257
|
-
error: 'maxSize for file log type must be specified',
|
|
258
|
-
when: { path: 'logs.type', value: 'file' },
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
},
|
|
262
|
-
maxFiles: {
|
|
263
|
-
type: 'string',
|
|
264
|
-
validations: [
|
|
265
|
-
{
|
|
266
|
-
required: true,
|
|
267
|
-
error: 'maxFiles for file log type must be specified',
|
|
268
|
-
when: { path: 'logs.type', value: 'file' },
|
|
269
|
-
},
|
|
270
|
-
],
|
|
271
|
-
},
|
|
272
|
-
path: {
|
|
273
|
-
type: 'string',
|
|
274
|
-
validations: [
|
|
275
|
-
{
|
|
276
|
-
required: true,
|
|
277
|
-
error: 'path for file log type must be specified',
|
|
278
|
-
when: { path: 'logs.type', value: 'file' },
|
|
279
|
-
},
|
|
280
|
-
],
|
|
281
|
-
},
|
|
282
|
-
level: {
|
|
283
|
-
type: 'string',
|
|
284
|
-
validations: [
|
|
285
|
-
{
|
|
286
|
-
required: true,
|
|
287
|
-
error: 'log level must be specified',
|
|
288
|
-
when: { path: 'logs.type', value: 'file' },
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
servers: {
|
|
296
|
-
type: 'object',
|
|
297
|
-
children: {
|
|
298
|
-
url: {
|
|
299
|
-
type: 'string',
|
|
300
|
-
validations: [
|
|
301
|
-
{
|
|
302
|
-
required: true,
|
|
303
|
-
},
|
|
304
|
-
{ regex: 'node[1-9]*.mydomain.(com|net)' },
|
|
305
|
-
],
|
|
306
|
-
},
|
|
307
|
-
port: {
|
|
308
|
-
type: 'number',
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
apis: {
|
|
313
|
-
type: 'object',
|
|
314
|
-
children: {
|
|
315
|
-
explorer: {
|
|
316
|
-
type: 'object',
|
|
317
|
-
children: {
|
|
318
|
-
url: {
|
|
319
|
-
type: 'string',
|
|
320
|
-
default: 'example.com',
|
|
321
|
-
},
|
|
322
|
-
port: {
|
|
323
|
-
type: 'number',
|
|
324
|
-
default: 443,
|
|
325
|
-
validations: [{ gt: 500 }],
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
config: {
|
|
333
|
-
apiType: 'explorer',
|
|
334
|
-
logs: [
|
|
335
|
-
{
|
|
336
|
-
type: 'file',
|
|
337
|
-
maxSize: '20m',
|
|
338
|
-
maxFiles: '14d',
|
|
339
|
-
path: './logs/',
|
|
340
|
-
level: 'info',
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
type: 'loki',
|
|
344
|
-
level: 'debug',
|
|
345
|
-
},
|
|
346
|
-
],
|
|
347
|
-
servers: {
|
|
348
|
-
url: 'node256.mydomain.net',
|
|
349
|
-
},
|
|
350
|
-
apis: {
|
|
351
|
-
explorer: {
|
|
352
|
-
url: 'example.com',
|
|
353
|
-
port: 501,
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
export const apiSchemaConfigPairWrongChoice = {
|
|
360
|
-
schema: {
|
|
361
|
-
apiType: {
|
|
362
|
-
type: 'string',
|
|
363
|
-
default: 'explorer',
|
|
364
|
-
description: 'type of api to use',
|
|
365
|
-
label: 'api type',
|
|
366
|
-
validations: [
|
|
367
|
-
{
|
|
368
|
-
required: true,
|
|
369
|
-
error: 'error message when value not validated',
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
choices: ['node', 'explorer'],
|
|
373
|
-
error: 'you did not use one of the valid options',
|
|
374
|
-
},
|
|
375
|
-
],
|
|
376
|
-
},
|
|
377
|
-
},
|
|
378
|
-
config: {
|
|
379
|
-
apiType: 'scanner',
|
|
380
|
-
},
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
export const arraySchemaConfigPairWrongValueType = {
|
|
384
|
-
schema: {
|
|
385
|
-
logs: {
|
|
386
|
-
type: 'array',
|
|
387
|
-
items: {
|
|
388
|
-
type: 'object',
|
|
389
|
-
children: {
|
|
390
|
-
type: {
|
|
391
|
-
type: 'string',
|
|
392
|
-
},
|
|
393
|
-
maxSize: {
|
|
394
|
-
type: 'string',
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
config: {
|
|
401
|
-
logs: {
|
|
402
|
-
type: 'loki',
|
|
403
|
-
maxSize: '12m',
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
export const apiSchemaConfigPairWrongRegex = {
|
|
409
|
-
schema: {
|
|
410
|
-
servers: {
|
|
411
|
-
type: 'object',
|
|
412
|
-
children: {
|
|
413
|
-
url: {
|
|
414
|
-
type: 'string',
|
|
415
|
-
validations: [{ regex: 'node[1-9]*.mydomain.(com|net)' }],
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
|
-
},
|
|
420
|
-
config: {
|
|
421
|
-
servers: {
|
|
422
|
-
url: 'node2506.mydomain.com',
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
export const apiSchemaConfigPairWrongRequired = {
|
|
428
|
-
schema: {
|
|
429
|
-
servers: {
|
|
430
|
-
type: 'object',
|
|
431
|
-
children: {
|
|
432
|
-
url: {
|
|
433
|
-
type: 'string',
|
|
434
|
-
validations: [
|
|
435
|
-
{
|
|
436
|
-
required: true,
|
|
437
|
-
},
|
|
438
|
-
],
|
|
439
|
-
},
|
|
440
|
-
},
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
config: {},
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
export const apiSchemaConfigPairWrongPortType = {
|
|
447
|
-
schema: {
|
|
448
|
-
apis: {
|
|
449
|
-
type: 'object',
|
|
450
|
-
children: {
|
|
451
|
-
explorer: {
|
|
452
|
-
type: 'object',
|
|
453
|
-
children: {
|
|
454
|
-
port: {
|
|
455
|
-
type: 'number',
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
},
|
|
459
|
-
},
|
|
460
|
-
},
|
|
461
|
-
},
|
|
462
|
-
config: {
|
|
463
|
-
apis: {
|
|
464
|
-
explorer: {
|
|
465
|
-
port: 'abc',
|
|
466
|
-
},
|
|
467
|
-
},
|
|
468
|
-
},
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
export const baseSchemaConfigPairComparison = {
|
|
472
|
-
schema: {
|
|
473
|
-
apis: {
|
|
474
|
-
type: 'object',
|
|
475
|
-
children: {
|
|
476
|
-
explorer: {
|
|
477
|
-
type: 'object',
|
|
478
|
-
children: {
|
|
479
|
-
port: {
|
|
480
|
-
type: 'number',
|
|
481
|
-
validations: [] as any[],
|
|
482
|
-
},
|
|
483
|
-
},
|
|
484
|
-
},
|
|
485
|
-
},
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
config: {
|
|
489
|
-
apis: {
|
|
490
|
-
explorer: {
|
|
491
|
-
port: 443,
|
|
492
|
-
},
|
|
493
|
-
},
|
|
494
|
-
},
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
export const apiSchemaConfigPairWrongGreater = cloneDeep(
|
|
498
|
-
baseSchemaConfigPairComparison
|
|
499
|
-
);
|
|
500
|
-
apiSchemaConfigPairWrongGreater.schema.apis.children.explorer.children.port.validations.push(
|
|
501
|
-
{ gt: 500 }
|
|
502
|
-
);
|
|
503
|
-
apiSchemaConfigPairWrongGreater.config.apis.explorer.port = 443;
|
|
504
|
-
|
|
505
|
-
export const apiSchemaConfigPairWrongLess = cloneDeep(
|
|
506
|
-
baseSchemaConfigPairComparison
|
|
507
|
-
);
|
|
508
|
-
apiSchemaConfigPairWrongLess.schema.apis.children.explorer.children.port.validations.push(
|
|
509
|
-
{ lt: 500 }
|
|
510
|
-
);
|
|
511
|
-
apiSchemaConfigPairWrongLess.config.apis.explorer.port = 700;
|
|
512
|
-
|
|
513
|
-
export const apiSchemaConfigPairWrongGreaterEqual = cloneDeep(
|
|
514
|
-
baseSchemaConfigPairComparison
|
|
515
|
-
);
|
|
516
|
-
apiSchemaConfigPairWrongGreaterEqual.schema.apis.children.explorer.children.port.validations.push(
|
|
517
|
-
{ gte: 500 }
|
|
518
|
-
);
|
|
519
|
-
apiSchemaConfigPairWrongGreaterEqual.config.apis.explorer.port = 443;
|
|
520
|
-
|
|
521
|
-
export const apiSchemaConfigPairWrongLessEqual = cloneDeep(
|
|
522
|
-
baseSchemaConfigPairComparison
|
|
523
|
-
);
|
|
524
|
-
apiSchemaConfigPairWrongLessEqual.schema.apis.children.explorer.children.port.validations.push(
|
|
525
|
-
{ lte: 500 }
|
|
526
|
-
);
|
|
527
|
-
apiSchemaConfigPairWrongLessEqual.config.apis.explorer.port = 600;
|
|
528
|
-
|
|
529
|
-
const baseSchemaConfigPairComparisonBigInt = {
|
|
530
|
-
schema: {
|
|
531
|
-
apis: {
|
|
532
|
-
type: 'object',
|
|
533
|
-
children: {
|
|
534
|
-
explorer: {
|
|
535
|
-
type: 'object',
|
|
536
|
-
children: {
|
|
537
|
-
port: {
|
|
538
|
-
type: 'bigint',
|
|
539
|
-
validations: [] as any[],
|
|
540
|
-
},
|
|
541
|
-
},
|
|
542
|
-
},
|
|
543
|
-
},
|
|
544
|
-
},
|
|
545
|
-
},
|
|
546
|
-
config: {
|
|
547
|
-
apis: {
|
|
548
|
-
explorer: {
|
|
549
|
-
port: 443n,
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
},
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
export const apiSchemaConfigPairWrongGreaterBigInt = cloneDeep(
|
|
556
|
-
baseSchemaConfigPairComparisonBigInt
|
|
557
|
-
);
|
|
558
|
-
apiSchemaConfigPairWrongGreaterBigInt.schema.apis.children.explorer.children.port.validations.push(
|
|
559
|
-
{ gt: 500n }
|
|
560
|
-
);
|
|
561
|
-
apiSchemaConfigPairWrongGreaterBigInt.config.apis.explorer.port = 400n;
|
|
562
|
-
|
|
563
|
-
export const apiSchemaConfigPairWrongGreaterEqualBigInt = cloneDeep(
|
|
564
|
-
baseSchemaConfigPairComparisonBigInt
|
|
565
|
-
);
|
|
566
|
-
apiSchemaConfigPairWrongGreaterEqualBigInt.schema.apis.children.explorer.children.port.validations.push(
|
|
567
|
-
{ gte: 500n }
|
|
568
|
-
);
|
|
569
|
-
apiSchemaConfigPairWrongGreaterEqualBigInt.config.apis.explorer.port = 400n;
|
|
570
|
-
|
|
571
|
-
export const apiSchemaConfigPairWrongLessBigInt = cloneDeep(
|
|
572
|
-
baseSchemaConfigPairComparisonBigInt
|
|
573
|
-
);
|
|
574
|
-
apiSchemaConfigPairWrongLessBigInt.schema.apis.children.explorer.children.port.validations.push(
|
|
575
|
-
{ lt: 500n }
|
|
576
|
-
);
|
|
577
|
-
apiSchemaConfigPairWrongLessBigInt.config.apis.explorer.port = 900n;
|
|
578
|
-
|
|
579
|
-
export const apiSchemaConfigPairWrongLessEqualBigInt = cloneDeep(
|
|
580
|
-
baseSchemaConfigPairComparisonBigInt
|
|
581
|
-
);
|
|
582
|
-
apiSchemaConfigPairWrongLessEqualBigInt.schema.apis.children.explorer.children.port.validations.push(
|
|
583
|
-
{ lte: 500n }
|
|
584
|
-
);
|
|
585
|
-
apiSchemaConfigPairWrongLessEqualBigInt.config.apis.explorer.port = 900n;
|
|
586
|
-
|
|
587
|
-
export const apiSchemaConfigPairWrongRequiredFalseWhen = {
|
|
588
|
-
schema: {
|
|
589
|
-
apiType: {
|
|
590
|
-
type: 'string',
|
|
591
|
-
validations: [
|
|
592
|
-
{
|
|
593
|
-
required: true,
|
|
594
|
-
error: 'error message when value not validated',
|
|
595
|
-
when: { path: 'apis.explorer.port', value: 8000 },
|
|
596
|
-
},
|
|
597
|
-
],
|
|
598
|
-
},
|
|
599
|
-
apis: {
|
|
600
|
-
type: 'object',
|
|
601
|
-
children: {
|
|
602
|
-
explorer: {
|
|
603
|
-
type: 'object',
|
|
604
|
-
children: {
|
|
605
|
-
port: {
|
|
606
|
-
type: 'number',
|
|
607
|
-
},
|
|
608
|
-
},
|
|
609
|
-
},
|
|
610
|
-
},
|
|
611
|
-
},
|
|
612
|
-
},
|
|
613
|
-
config: {
|
|
614
|
-
apiType: 'explorer',
|
|
615
|
-
apis: {
|
|
616
|
-
explorer: {
|
|
617
|
-
port: 501,
|
|
618
|
-
},
|
|
619
|
-
},
|
|
620
|
-
},
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
export const apiSchemaConfigPairWrongRegexFalseWhen = {
|
|
624
|
-
schema: {
|
|
625
|
-
servers: {
|
|
626
|
-
type: 'object',
|
|
627
|
-
children: {
|
|
628
|
-
url: {
|
|
629
|
-
type: 'string',
|
|
630
|
-
validations: [
|
|
631
|
-
{
|
|
632
|
-
regex: 'node[1-9]*.mydomain.(com|net)',
|
|
633
|
-
when: { path: 'apis.explorer.port', value: 8000 },
|
|
634
|
-
},
|
|
635
|
-
],
|
|
636
|
-
},
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
apis: {
|
|
640
|
-
type: 'object',
|
|
641
|
-
children: {
|
|
642
|
-
explorer: {
|
|
643
|
-
type: 'object',
|
|
644
|
-
children: {
|
|
645
|
-
port: {
|
|
646
|
-
type: 'number',
|
|
647
|
-
},
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
},
|
|
651
|
-
},
|
|
652
|
-
},
|
|
653
|
-
config: {
|
|
654
|
-
servers: {
|
|
655
|
-
url: 'node2506.mydomain.org',
|
|
656
|
-
},
|
|
657
|
-
apis: {
|
|
658
|
-
explorer: {
|
|
659
|
-
port: 501,
|
|
660
|
-
},
|
|
661
|
-
},
|
|
662
|
-
},
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
export const apiSchemaConfigPairWrongChoiceFalseWhen = {
|
|
666
|
-
schema: {
|
|
667
|
-
apiType: {
|
|
668
|
-
type: 'string',
|
|
669
|
-
validations: [
|
|
670
|
-
{
|
|
671
|
-
choices: ['node', 'explorer'],
|
|
672
|
-
when: { path: 'apis.explorer.port', value: 5000 },
|
|
673
|
-
},
|
|
674
|
-
],
|
|
675
|
-
},
|
|
676
|
-
apis: {
|
|
677
|
-
type: 'object',
|
|
678
|
-
children: {
|
|
679
|
-
explorer: {
|
|
680
|
-
type: 'object',
|
|
681
|
-
children: {
|
|
682
|
-
port: {
|
|
683
|
-
type: 'number',
|
|
684
|
-
},
|
|
685
|
-
},
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
},
|
|
689
|
-
},
|
|
690
|
-
config: {
|
|
691
|
-
apiType: 'scanner',
|
|
692
|
-
apis: {
|
|
693
|
-
explorer: {
|
|
694
|
-
port: 501,
|
|
695
|
-
},
|
|
696
|
-
},
|
|
697
|
-
},
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
export const apiSchemaConfigPairWrongBigIntGreaterFalseWhen = {
|
|
701
|
-
schema: {
|
|
702
|
-
apiType: {
|
|
703
|
-
type: 'string',
|
|
704
|
-
},
|
|
705
|
-
apis: {
|
|
706
|
-
type: 'object',
|
|
707
|
-
children: {
|
|
708
|
-
explorer: {
|
|
709
|
-
type: 'object',
|
|
710
|
-
children: {
|
|
711
|
-
port: {
|
|
712
|
-
type: 'bigint',
|
|
713
|
-
validations: [
|
|
714
|
-
{ gt: 500n, when: { path: 'apiType', value: 'explorer' } },
|
|
715
|
-
],
|
|
716
|
-
},
|
|
717
|
-
},
|
|
718
|
-
},
|
|
719
|
-
},
|
|
720
|
-
},
|
|
721
|
-
},
|
|
722
|
-
config: {
|
|
723
|
-
apiType: 'node',
|
|
724
|
-
apis: {
|
|
725
|
-
explorer: {
|
|
726
|
-
port: 443n,
|
|
727
|
-
},
|
|
728
|
-
},
|
|
729
|
-
},
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
export const apiSchemaConfigPairWrongBigIntGreaterEqualFalseWhen = {
|
|
733
|
-
schema: {
|
|
734
|
-
apiType: {
|
|
735
|
-
type: 'string',
|
|
736
|
-
},
|
|
737
|
-
apis: {
|
|
738
|
-
type: 'object',
|
|
739
|
-
children: {
|
|
740
|
-
explorer: {
|
|
741
|
-
type: 'object',
|
|
742
|
-
children: {
|
|
743
|
-
port: {
|
|
744
|
-
type: 'bigint',
|
|
745
|
-
validations: [
|
|
746
|
-
{ gte: 500n, when: { path: 'apiType', value: 'node' } },
|
|
747
|
-
],
|
|
748
|
-
},
|
|
749
|
-
},
|
|
750
|
-
},
|
|
751
|
-
},
|
|
752
|
-
},
|
|
753
|
-
},
|
|
754
|
-
config: {
|
|
755
|
-
apiType: 'explorer',
|
|
756
|
-
apis: {
|
|
757
|
-
explorer: {
|
|
758
|
-
port: 443n,
|
|
759
|
-
},
|
|
760
|
-
},
|
|
761
|
-
},
|
|
762
|
-
};
|
|
763
|
-
|
|
764
|
-
export const apiSchemaConfigPairWrongBigIntLessFalseWhen = {
|
|
765
|
-
schema: {
|
|
766
|
-
apiType: {
|
|
767
|
-
type: 'string',
|
|
768
|
-
},
|
|
769
|
-
apis: {
|
|
770
|
-
type: 'object',
|
|
771
|
-
children: {
|
|
772
|
-
explorer: {
|
|
773
|
-
type: 'object',
|
|
774
|
-
children: {
|
|
775
|
-
port: {
|
|
776
|
-
type: 'bigint',
|
|
777
|
-
validations: [
|
|
778
|
-
{ lt: 500n, when: { path: 'apiType', value: 'node' } },
|
|
779
|
-
],
|
|
780
|
-
},
|
|
781
|
-
},
|
|
782
|
-
},
|
|
783
|
-
},
|
|
784
|
-
},
|
|
785
|
-
},
|
|
786
|
-
config: {
|
|
787
|
-
apiType: 'explorer',
|
|
788
|
-
apis: {
|
|
789
|
-
explorer: {
|
|
790
|
-
port: 600n,
|
|
791
|
-
},
|
|
792
|
-
},
|
|
793
|
-
},
|
|
794
|
-
};
|
|
795
|
-
|
|
796
|
-
export const apiSchemaConfigPairWrongBigIntLessEqualFalseWhen = {
|
|
797
|
-
schema: {
|
|
798
|
-
apiType: {
|
|
799
|
-
type: 'string',
|
|
800
|
-
},
|
|
801
|
-
apis: {
|
|
802
|
-
type: 'object',
|
|
803
|
-
children: {
|
|
804
|
-
explorer: {
|
|
805
|
-
type: 'object',
|
|
806
|
-
children: {
|
|
807
|
-
port: {
|
|
808
|
-
type: 'bigint',
|
|
809
|
-
validations: [
|
|
810
|
-
{ lte: 500n, when: { path: 'apiType', value: 'node' } },
|
|
811
|
-
],
|
|
812
|
-
},
|
|
813
|
-
},
|
|
814
|
-
},
|
|
815
|
-
},
|
|
816
|
-
},
|
|
817
|
-
},
|
|
818
|
-
config: {
|
|
819
|
-
apiType: 'explorer',
|
|
820
|
-
apis: {
|
|
821
|
-
explorer: {
|
|
822
|
-
port: 600n,
|
|
823
|
-
},
|
|
824
|
-
},
|
|
825
|
-
},
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
export const apiSchemaConfigPairWrongGreaterFalseWhen = {
|
|
829
|
-
schema: {
|
|
830
|
-
apiType: {
|
|
831
|
-
type: 'string',
|
|
832
|
-
},
|
|
833
|
-
apis: {
|
|
834
|
-
type: 'object',
|
|
835
|
-
children: {
|
|
836
|
-
explorer: {
|
|
837
|
-
type: 'object',
|
|
838
|
-
children: {
|
|
839
|
-
port: {
|
|
840
|
-
type: 'number',
|
|
841
|
-
validations: [
|
|
842
|
-
{ gt: 500, when: { path: 'apiType', value: 'explorer' } },
|
|
843
|
-
],
|
|
844
|
-
},
|
|
845
|
-
},
|
|
846
|
-
},
|
|
847
|
-
},
|
|
848
|
-
},
|
|
849
|
-
},
|
|
850
|
-
config: {
|
|
851
|
-
apiType: 'node',
|
|
852
|
-
apis: {
|
|
853
|
-
explorer: {
|
|
854
|
-
port: 443,
|
|
855
|
-
},
|
|
856
|
-
},
|
|
857
|
-
},
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
export const apiSchemaConfigPairWrongGreaterEqualFalseWhen = {
|
|
861
|
-
schema: {
|
|
862
|
-
apiType: {
|
|
863
|
-
type: 'string',
|
|
864
|
-
},
|
|
865
|
-
apis: {
|
|
866
|
-
type: 'object',
|
|
867
|
-
children: {
|
|
868
|
-
explorer: {
|
|
869
|
-
type: 'object',
|
|
870
|
-
children: {
|
|
871
|
-
port: {
|
|
872
|
-
type: 'number',
|
|
873
|
-
validations: [
|
|
874
|
-
{ gte: 500, when: { path: 'apiType', value: 'node' } },
|
|
875
|
-
],
|
|
876
|
-
},
|
|
877
|
-
},
|
|
878
|
-
},
|
|
879
|
-
},
|
|
880
|
-
},
|
|
881
|
-
},
|
|
882
|
-
config: {
|
|
883
|
-
apiType: 'explorer',
|
|
884
|
-
apis: {
|
|
885
|
-
explorer: {
|
|
886
|
-
port: 443,
|
|
887
|
-
},
|
|
888
|
-
},
|
|
889
|
-
},
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
export const apiSchemaConfigPairWrongLessFalseWhen = {
|
|
893
|
-
schema: {
|
|
894
|
-
apiType: {
|
|
895
|
-
type: 'string',
|
|
896
|
-
},
|
|
897
|
-
apis: {
|
|
898
|
-
type: 'object',
|
|
899
|
-
children: {
|
|
900
|
-
explorer: {
|
|
901
|
-
type: 'object',
|
|
902
|
-
children: {
|
|
903
|
-
port: {
|
|
904
|
-
type: 'number',
|
|
905
|
-
validations: [
|
|
906
|
-
{ lt: 500, when: { path: 'apiType', value: 'node' } },
|
|
907
|
-
],
|
|
908
|
-
},
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
|
-
},
|
|
912
|
-
},
|
|
913
|
-
},
|
|
914
|
-
config: {
|
|
915
|
-
apiType: 'explorer',
|
|
916
|
-
apis: {
|
|
917
|
-
explorer: {
|
|
918
|
-
port: 600,
|
|
919
|
-
},
|
|
920
|
-
},
|
|
921
|
-
},
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
export const apiSchemaConfigPairWrongLessEqualFalseWhen = {
|
|
925
|
-
schema: {
|
|
926
|
-
apiType: {
|
|
927
|
-
type: 'string',
|
|
928
|
-
},
|
|
929
|
-
apis: {
|
|
930
|
-
type: 'object',
|
|
931
|
-
children: {
|
|
932
|
-
explorer: {
|
|
933
|
-
type: 'object',
|
|
934
|
-
children: {
|
|
935
|
-
port: {
|
|
936
|
-
type: 'number',
|
|
937
|
-
validations: [
|
|
938
|
-
{ lte: 500, when: { path: 'apiType', value: 'node' } },
|
|
939
|
-
],
|
|
940
|
-
},
|
|
941
|
-
},
|
|
942
|
-
},
|
|
943
|
-
},
|
|
944
|
-
},
|
|
945
|
-
},
|
|
946
|
-
config: {
|
|
947
|
-
apiType: 'explorer',
|
|
948
|
-
apis: {
|
|
949
|
-
explorer: {
|
|
950
|
-
port: 600,
|
|
951
|
-
},
|
|
952
|
-
},
|
|
953
|
-
},
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
export const apiSchemaConfigPairWithStringBigInt = {
|
|
957
|
-
schema: {
|
|
958
|
-
servers: {
|
|
959
|
-
type: 'object',
|
|
960
|
-
children: {
|
|
961
|
-
port: {
|
|
962
|
-
type: 'bigint',
|
|
963
|
-
default: '5372',
|
|
964
|
-
},
|
|
965
|
-
},
|
|
966
|
-
},
|
|
967
|
-
},
|
|
968
|
-
config: {
|
|
969
|
-
servers: {
|
|
970
|
-
port: '800',
|
|
971
|
-
},
|
|
972
|
-
},
|
|
973
|
-
};
|
|
974
|
-
|
|
975
|
-
export const apiSchemaConfigPairWithStringNumber = {
|
|
976
|
-
schema: {
|
|
977
|
-
servers: {
|
|
978
|
-
type: 'object',
|
|
979
|
-
children: {
|
|
980
|
-
port: {
|
|
981
|
-
type: 'number',
|
|
982
|
-
},
|
|
983
|
-
},
|
|
984
|
-
},
|
|
985
|
-
},
|
|
986
|
-
config: {
|
|
987
|
-
servers: {
|
|
988
|
-
port: '800',
|
|
989
|
-
},
|
|
990
|
-
},
|
|
991
|
-
};
|
|
992
|
-
|
|
993
|
-
export const schemaTypeScriptTypesPair = {
|
|
994
|
-
schema: {
|
|
995
|
-
apiType: {
|
|
996
|
-
type: 'string',
|
|
997
|
-
validations: [{ choices: ['node', 'explorer', 'superApi'] }],
|
|
998
|
-
},
|
|
999
|
-
logs: {
|
|
1000
|
-
type: 'array',
|
|
1001
|
-
items: {
|
|
1002
|
-
type: 'object',
|
|
1003
|
-
children: {
|
|
1004
|
-
type: {
|
|
1005
|
-
type: 'string',
|
|
1006
|
-
validations: [
|
|
1007
|
-
{
|
|
1008
|
-
required: true,
|
|
1009
|
-
},
|
|
1010
|
-
{ choices: ['file', 'console', 'loki'] },
|
|
1011
|
-
],
|
|
1012
|
-
},
|
|
1013
|
-
maxSize: {
|
|
1014
|
-
type: 'string',
|
|
1015
|
-
validations: [
|
|
1016
|
-
{
|
|
1017
|
-
required: true,
|
|
1018
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1019
|
-
},
|
|
1020
|
-
],
|
|
1021
|
-
},
|
|
1022
|
-
maxFiles: {
|
|
1023
|
-
type: 'string',
|
|
1024
|
-
validations: [
|
|
1025
|
-
{
|
|
1026
|
-
required: true,
|
|
1027
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1028
|
-
},
|
|
1029
|
-
],
|
|
1030
|
-
},
|
|
1031
|
-
path: {
|
|
1032
|
-
type: 'string',
|
|
1033
|
-
validations: [
|
|
1034
|
-
{
|
|
1035
|
-
required: true,
|
|
1036
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1037
|
-
},
|
|
1038
|
-
],
|
|
1039
|
-
},
|
|
1040
|
-
level: {
|
|
1041
|
-
type: 'string',
|
|
1042
|
-
validations: [
|
|
1043
|
-
{
|
|
1044
|
-
required: true,
|
|
1045
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1046
|
-
},
|
|
1047
|
-
],
|
|
1048
|
-
},
|
|
1049
|
-
},
|
|
1050
|
-
},
|
|
1051
|
-
},
|
|
1052
|
-
explorer: {
|
|
1053
|
-
type: 'object',
|
|
1054
|
-
children: {
|
|
1055
|
-
domain: {
|
|
1056
|
-
type: 'string',
|
|
1057
|
-
},
|
|
1058
|
-
path: {
|
|
1059
|
-
type: 'string',
|
|
1060
|
-
},
|
|
1061
|
-
},
|
|
1062
|
-
},
|
|
1063
|
-
server: {
|
|
1064
|
-
type: 'object',
|
|
1065
|
-
children: {
|
|
1066
|
-
url: {
|
|
1067
|
-
type: 'string',
|
|
1068
|
-
},
|
|
1069
|
-
port: {
|
|
1070
|
-
type: 'number',
|
|
1071
|
-
},
|
|
1072
|
-
},
|
|
1073
|
-
},
|
|
1074
|
-
apis: {
|
|
1075
|
-
type: 'object',
|
|
1076
|
-
children: {
|
|
1077
|
-
explorer: {
|
|
1078
|
-
type: 'object',
|
|
1079
|
-
children: {
|
|
1080
|
-
url: {
|
|
1081
|
-
type: 'string',
|
|
1082
|
-
},
|
|
1083
|
-
port: {
|
|
1084
|
-
type: 'number',
|
|
1085
|
-
},
|
|
1086
|
-
},
|
|
1087
|
-
},
|
|
1088
|
-
},
|
|
1089
|
-
},
|
|
1090
|
-
},
|
|
1091
|
-
types: `export interface Infrastructure {
|
|
1092
|
-
apis: Apis;
|
|
1093
|
-
server: Server;
|
|
1094
|
-
explorer: Explorer;
|
|
1095
|
-
logs: Logs[];
|
|
1096
|
-
apiType?: 'node' | 'explorer' | 'superApi';
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
export interface Logs {
|
|
1100
|
-
type: 'file' | 'console' | 'loki';
|
|
1101
|
-
maxSize?: string;
|
|
1102
|
-
maxFiles?: string;
|
|
1103
|
-
path?: string;
|
|
1104
|
-
level?: string;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
export interface Explorer {
|
|
1108
|
-
domain?: string;
|
|
1109
|
-
path?: string;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
export interface Server {
|
|
1113
|
-
url?: string;
|
|
1114
|
-
port?: number;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
export interface Apis {
|
|
1118
|
-
explorer: ApisExplorer;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
export interface ApisExplorer {
|
|
1122
|
-
url?: string;
|
|
1123
|
-
port?: number;
|
|
1124
|
-
}
|
|
1125
|
-
`,
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
export const schemaConfigCharPair = {
|
|
1129
|
-
schema: {
|
|
1130
|
-
apiType: {
|
|
1131
|
-
type: 'string',
|
|
1132
|
-
default: 'explorer',
|
|
1133
|
-
description: 'type of api to use',
|
|
1134
|
-
label: 'api type',
|
|
1135
|
-
validations: [
|
|
1136
|
-
{
|
|
1137
|
-
required: true,
|
|
1138
|
-
error: 'error message when value not validated',
|
|
1139
|
-
},
|
|
1140
|
-
{ choices: ['node', 'explorer'] },
|
|
1141
|
-
],
|
|
1142
|
-
},
|
|
1143
|
-
servers: {
|
|
1144
|
-
type: 'object',
|
|
1145
|
-
children: {
|
|
1146
|
-
url: {
|
|
1147
|
-
type: 'string',
|
|
1148
|
-
},
|
|
1149
|
-
port: {
|
|
1150
|
-
type: 'number',
|
|
1151
|
-
},
|
|
1152
|
-
},
|
|
1153
|
-
},
|
|
1154
|
-
apis: {
|
|
1155
|
-
type: 'object',
|
|
1156
|
-
children: {
|
|
1157
|
-
explorer: {
|
|
1158
|
-
type: 'object',
|
|
1159
|
-
children: {
|
|
1160
|
-
url: {
|
|
1161
|
-
type: 'string',
|
|
1162
|
-
default: 'example.com',
|
|
1163
|
-
},
|
|
1164
|
-
port: {
|
|
1165
|
-
type: 'number',
|
|
1166
|
-
default: 443,
|
|
1167
|
-
},
|
|
1168
|
-
},
|
|
1169
|
-
},
|
|
1170
|
-
},
|
|
1171
|
-
},
|
|
1172
|
-
},
|
|
1173
|
-
characteristic: {
|
|
1174
|
-
apiType: {
|
|
1175
|
-
label: 'api type',
|
|
1176
|
-
description: 'type of api to use',
|
|
1177
|
-
default: 'explorer',
|
|
1178
|
-
value: null,
|
|
1179
|
-
override: null,
|
|
1180
|
-
},
|
|
1181
|
-
servers: {
|
|
1182
|
-
url: {
|
|
1183
|
-
label: null,
|
|
1184
|
-
description: null,
|
|
1185
|
-
default: null,
|
|
1186
|
-
value: null,
|
|
1187
|
-
override: 'some-url.org',
|
|
1188
|
-
},
|
|
1189
|
-
port: {
|
|
1190
|
-
label: null,
|
|
1191
|
-
description: null,
|
|
1192
|
-
default: 500,
|
|
1193
|
-
value: 777,
|
|
1194
|
-
override: null,
|
|
1195
|
-
},
|
|
1196
|
-
},
|
|
1197
|
-
apis: {
|
|
1198
|
-
explorer: {
|
|
1199
|
-
url: {
|
|
1200
|
-
label: null,
|
|
1201
|
-
description: null,
|
|
1202
|
-
default: 'example.com',
|
|
1203
|
-
value: null,
|
|
1204
|
-
override: null,
|
|
1205
|
-
},
|
|
1206
|
-
port: {
|
|
1207
|
-
label: null,
|
|
1208
|
-
description: null,
|
|
1209
|
-
default: 443,
|
|
1210
|
-
value: null,
|
|
1211
|
-
override: null,
|
|
1212
|
-
},
|
|
1213
|
-
},
|
|
1214
|
-
},
|
|
1215
|
-
},
|
|
1216
|
-
};
|
|
1217
|
-
|
|
1218
|
-
// logs array schema with item-level defaults and array default elements
|
|
1219
|
-
export const logsArraySchemaDefaultsPair = {
|
|
1220
|
-
schema: {
|
|
1221
|
-
logs: {
|
|
1222
|
-
type: 'array',
|
|
1223
|
-
items: {
|
|
1224
|
-
type: 'object',
|
|
1225
|
-
children: {
|
|
1226
|
-
type: {
|
|
1227
|
-
type: 'string',
|
|
1228
|
-
validations: [
|
|
1229
|
-
{
|
|
1230
|
-
required: true,
|
|
1231
|
-
error: 'log type must be specified',
|
|
1232
|
-
},
|
|
1233
|
-
{ choices: ['file', 'console', 'loki'] },
|
|
1234
|
-
],
|
|
1235
|
-
},
|
|
1236
|
-
maxSize: {
|
|
1237
|
-
type: 'string',
|
|
1238
|
-
validations: [
|
|
1239
|
-
{
|
|
1240
|
-
required: true,
|
|
1241
|
-
error: 'maxSize for file log type must be specified',
|
|
1242
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1243
|
-
},
|
|
1244
|
-
],
|
|
1245
|
-
},
|
|
1246
|
-
maxFiles: {
|
|
1247
|
-
type: 'string',
|
|
1248
|
-
validations: [
|
|
1249
|
-
{
|
|
1250
|
-
required: true,
|
|
1251
|
-
error: 'maxFiles for file log type must be specified',
|
|
1252
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1253
|
-
},
|
|
1254
|
-
],
|
|
1255
|
-
},
|
|
1256
|
-
path: {
|
|
1257
|
-
type: 'string',
|
|
1258
|
-
default: '/var/log/app.log',
|
|
1259
|
-
validations: [
|
|
1260
|
-
{
|
|
1261
|
-
required: true,
|
|
1262
|
-
error: 'path for file log type must be specified',
|
|
1263
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1264
|
-
},
|
|
1265
|
-
],
|
|
1266
|
-
},
|
|
1267
|
-
level: {
|
|
1268
|
-
type: 'string',
|
|
1269
|
-
default: 'info',
|
|
1270
|
-
validations: [
|
|
1271
|
-
{
|
|
1272
|
-
required: true,
|
|
1273
|
-
error: 'log level must be specified',
|
|
1274
|
-
when: { path: 'logs.type', value: 'file' },
|
|
1275
|
-
},
|
|
1276
|
-
],
|
|
1277
|
-
},
|
|
1278
|
-
},
|
|
1279
|
-
},
|
|
1280
|
-
default: [{ type: 'file', level: 'debug' }, { type: 'console' }],
|
|
1281
|
-
},
|
|
1282
|
-
},
|
|
1283
|
-
defaultVal: {
|
|
1284
|
-
logs: [
|
|
1285
|
-
{ type: 'file', level: 'debug', path: '/var/log/app.log' },
|
|
1286
|
-
{ type: 'console', level: 'info', path: '/var/log/app.log' },
|
|
1287
|
-
],
|
|
1288
|
-
},
|
|
1289
|
-
};
|
|
1290
|
-
|
|
1291
|
-
// empty array defaults for primitive types
|
|
1292
|
-
export const emptyArrayDefaultsPair = {
|
|
1293
|
-
schema: {
|
|
1294
|
-
emptyStringArray: {
|
|
1295
|
-
type: 'array' as const,
|
|
1296
|
-
default: [],
|
|
1297
|
-
items: { type: 'string' as const },
|
|
1298
|
-
},
|
|
1299
|
-
emptyNumberArray: {
|
|
1300
|
-
type: 'array' as const,
|
|
1301
|
-
default: [],
|
|
1302
|
-
items: { type: 'number' as const },
|
|
1303
|
-
},
|
|
1304
|
-
},
|
|
1305
|
-
defaultVal: {
|
|
1306
|
-
emptyStringArray: [],
|
|
1307
|
-
emptyNumberArray: [],
|
|
1308
|
-
},
|
|
1309
|
-
};
|
|
1310
|
-
|
|
1311
|
-
// schema including an array without default to be excluded from defaults result
|
|
1312
|
-
export const arrayWithoutDefaultPair = {
|
|
1313
|
-
schema: {
|
|
1314
|
-
withDefault: {
|
|
1315
|
-
type: 'string' as const,
|
|
1316
|
-
default: 'test',
|
|
1317
|
-
},
|
|
1318
|
-
arrayWithoutDefault: {
|
|
1319
|
-
type: 'array' as const,
|
|
1320
|
-
items: { type: 'string' as const },
|
|
1321
|
-
},
|
|
1322
|
-
},
|
|
1323
|
-
defaultVal: {
|
|
1324
|
-
withDefault: 'test',
|
|
1325
|
-
},
|
|
1326
|
-
};
|
|
1327
|
-
|
|
1328
|
-
// logs array with invalid defaults (choices violation, missing required) plus expected generated defaults
|
|
1329
|
-
export const invalidLogsArrayDefaultsPair = {
|
|
1330
|
-
schema: {
|
|
1331
|
-
logs: {
|
|
1332
|
-
type: 'array',
|
|
1333
|
-
items: {
|
|
1334
|
-
type: 'object',
|
|
1335
|
-
children: {
|
|
1336
|
-
type: {
|
|
1337
|
-
type: 'string',
|
|
1338
|
-
validations: [
|
|
1339
|
-
{ required: true, error: 'log type must be specified' },
|
|
1340
|
-
{ choices: ['file', 'console', 'loki'] },
|
|
1341
|
-
],
|
|
1342
|
-
},
|
|
1343
|
-
path: { type: 'string', default: '/var/log/app.log' },
|
|
1344
|
-
level: { type: 'string', default: 'info' },
|
|
1345
|
-
},
|
|
1346
|
-
},
|
|
1347
|
-
default: [{ type: 'unknown' as any }, { level: 'debug' }],
|
|
1348
|
-
},
|
|
1349
|
-
},
|
|
1350
|
-
defaultVal: {
|
|
1351
|
-
logs: [
|
|
1352
|
-
{ type: 'unknown', path: '/var/log/app.log', level: 'info' },
|
|
1353
|
-
{ level: 'debug', path: '/var/log/app.log' },
|
|
1354
|
-
],
|
|
1355
|
-
},
|
|
1356
|
-
};
|
|
1357
|
-
|
|
1358
|
-
// logs array with unknown key inside defaults, plus expected generated defaults
|
|
1359
|
-
export const unknownKeyLogsArrayDefaultsPair = {
|
|
1360
|
-
schema: {
|
|
1361
|
-
logs: {
|
|
1362
|
-
type: 'array',
|
|
1363
|
-
items: {
|
|
1364
|
-
type: 'object',
|
|
1365
|
-
children: {
|
|
1366
|
-
path: { type: 'string', default: '/var/log/app.log' },
|
|
1367
|
-
level: { type: 'string', default: 'info' },
|
|
1368
|
-
},
|
|
1369
|
-
},
|
|
1370
|
-
default: [{ pathsskddkfjd: '/tmp/weird' } as any],
|
|
1371
|
-
},
|
|
1372
|
-
},
|
|
1373
|
-
defaultVal: {
|
|
1374
|
-
logs: [
|
|
1375
|
-
{ path: '/var/log/app.log', level: 'info', pathsskddkfjd: '/tmp/weird' },
|
|
1376
|
-
],
|
|
1377
|
-
},
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
|
-
// Schemas for duplicate key/type generation tests
|
|
1381
|
-
export const duplicateChildKeysSchema = {
|
|
1382
|
-
schema: {
|
|
1383
|
-
user: {
|
|
1384
|
-
type: 'object',
|
|
1385
|
-
children: {
|
|
1386
|
-
database: {
|
|
1387
|
-
type: 'object',
|
|
1388
|
-
children: {
|
|
1389
|
-
host: { type: 'string' },
|
|
1390
|
-
port: { type: 'number' },
|
|
1391
|
-
},
|
|
1392
|
-
},
|
|
1393
|
-
},
|
|
1394
|
-
},
|
|
1395
|
-
apis: {
|
|
1396
|
-
type: 'object',
|
|
1397
|
-
children: {
|
|
1398
|
-
explorer: {
|
|
1399
|
-
type: 'object',
|
|
1400
|
-
children: {
|
|
1401
|
-
url: { type: 'string' },
|
|
1402
|
-
port: { type: 'number' },
|
|
1403
|
-
},
|
|
1404
|
-
},
|
|
1405
|
-
},
|
|
1406
|
-
},
|
|
1407
|
-
},
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
export const identicalStructurePathsSchema = {
|
|
1411
|
-
schema: {
|
|
1412
|
-
primary: {
|
|
1413
|
-
type: 'object',
|
|
1414
|
-
children: {
|
|
1415
|
-
connection: {
|
|
1416
|
-
type: 'object',
|
|
1417
|
-
children: {
|
|
1418
|
-
host: { type: 'string' },
|
|
1419
|
-
port: { type: 'number' },
|
|
1420
|
-
ssl: { type: 'boolean' },
|
|
1421
|
-
},
|
|
1422
|
-
},
|
|
1423
|
-
},
|
|
1424
|
-
},
|
|
1425
|
-
backup: {
|
|
1426
|
-
type: 'object',
|
|
1427
|
-
children: {
|
|
1428
|
-
connection: {
|
|
1429
|
-
type: 'object',
|
|
1430
|
-
children: {
|
|
1431
|
-
host: { type: 'string' },
|
|
1432
|
-
port: { type: 'number' },
|
|
1433
|
-
ssl: { type: 'boolean' },
|
|
1434
|
-
},
|
|
1435
|
-
},
|
|
1436
|
-
},
|
|
1437
|
-
},
|
|
1438
|
-
},
|
|
1439
|
-
};
|
|
1440
|
-
|
|
1441
|
-
export const arrayItemsAtRootSchema = {
|
|
1442
|
-
schema: {
|
|
1443
|
-
logs: {
|
|
1444
|
-
type: 'array',
|
|
1445
|
-
items: {
|
|
1446
|
-
type: 'object',
|
|
1447
|
-
children: {
|
|
1448
|
-
message: { type: 'string' },
|
|
1449
|
-
level: { type: 'string' },
|
|
1450
|
-
},
|
|
1451
|
-
},
|
|
1452
|
-
},
|
|
1453
|
-
},
|
|
1454
|
-
};
|
|
1455
|
-
|
|
1456
|
-
// Nested defaults: array of objects where an item key is itself a nested array
|
|
1457
|
-
export const nestedArrayInArrayDefaultsPair = {
|
|
1458
|
-
schema: {
|
|
1459
|
-
logs: {
|
|
1460
|
-
type: 'array',
|
|
1461
|
-
items: {
|
|
1462
|
-
type: 'object',
|
|
1463
|
-
children: {
|
|
1464
|
-
name: { type: 'string', default: 'file' },
|
|
1465
|
-
tags: {
|
|
1466
|
-
type: 'array',
|
|
1467
|
-
items: { type: 'string' },
|
|
1468
|
-
default: ['t1', 't2'],
|
|
1469
|
-
},
|
|
1470
|
-
labels: {
|
|
1471
|
-
type: 'array',
|
|
1472
|
-
items: { type: 'string' },
|
|
1473
|
-
default: ['L1'],
|
|
1474
|
-
},
|
|
1475
|
-
},
|
|
1476
|
-
},
|
|
1477
|
-
default: [{}, { tags: ['custom'], labels: [] }],
|
|
1478
|
-
},
|
|
1479
|
-
},
|
|
1480
|
-
defaultVal: {
|
|
1481
|
-
logs: [
|
|
1482
|
-
{ name: 'file', tags: ['t1', 't2'], labels: ['L1'] },
|
|
1483
|
-
{ name: 'file', tags: ['custom'], labels: [] },
|
|
1484
|
-
],
|
|
1485
|
-
},
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
// Schema for invalid defaults used with generateDefault({ validate: true })
|
|
1489
|
-
export const invalidDefaultsValidateOptionSchema = {
|
|
1490
|
-
schema: {
|
|
1491
|
-
logs: {
|
|
1492
|
-
type: 'array',
|
|
1493
|
-
items: {
|
|
1494
|
-
type: 'object',
|
|
1495
|
-
children: {
|
|
1496
|
-
type: {
|
|
1497
|
-
type: 'string',
|
|
1498
|
-
validations: [
|
|
1499
|
-
{ required: true },
|
|
1500
|
-
{ choices: ['file', 'console', 'loki'] },
|
|
1501
|
-
],
|
|
1502
|
-
},
|
|
1503
|
-
level: { type: 'string', default: 'info' },
|
|
1504
|
-
},
|
|
1505
|
-
},
|
|
1506
|
-
default: [{ type: 'unknown' as any }, { level: 'debug' }],
|
|
1507
|
-
},
|
|
1508
|
-
},
|
|
1509
|
-
};
|
|
1510
|
-
|
|
1511
|
-
// Schema for required field without default
|
|
1512
|
-
export const requiredWithoutDefaultSchema = {
|
|
1513
|
-
schema: {
|
|
1514
|
-
service: {
|
|
1515
|
-
type: 'object',
|
|
1516
|
-
children: {
|
|
1517
|
-
apiKey: {
|
|
1518
|
-
type: 'string',
|
|
1519
|
-
validations: [{ required: true }],
|
|
1520
|
-
},
|
|
1521
|
-
},
|
|
1522
|
-
},
|
|
1523
|
-
},
|
|
1524
|
-
};
|
|
1525
|
-
|
|
1526
|
-
// Default-shape validation fixtures
|
|
1527
|
-
export const arrayPrimitiveDefaultsValid = {
|
|
1528
|
-
schema: {
|
|
1529
|
-
ports: {
|
|
1530
|
-
type: 'array',
|
|
1531
|
-
items: { type: 'number' },
|
|
1532
|
-
default: [80, 443],
|
|
1533
|
-
},
|
|
1534
|
-
},
|
|
1535
|
-
};
|
|
1536
|
-
|
|
1537
|
-
export const arrayPrimitiveDefaultsInvalid = {
|
|
1538
|
-
schema: {
|
|
1539
|
-
ports: {
|
|
1540
|
-
type: 'array',
|
|
1541
|
-
items: { type: 'number' },
|
|
1542
|
-
// invalid: contains a string
|
|
1543
|
-
default: [80, '443' as any],
|
|
1544
|
-
},
|
|
1545
|
-
},
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1548
|
-
export const arrayObjectDefaultsInvalidChildType = {
|
|
1549
|
-
schema: {
|
|
1550
|
-
services: {
|
|
1551
|
-
type: 'array',
|
|
1552
|
-
items: {
|
|
1553
|
-
type: 'object',
|
|
1554
|
-
children: {
|
|
1555
|
-
enabled: { type: 'boolean' },
|
|
1556
|
-
path: { type: 'string' },
|
|
1557
|
-
},
|
|
1558
|
-
},
|
|
1559
|
-
// invalid: enabled should be boolean
|
|
1560
|
-
default: [{ enabled: 'true' as any, path: '/var' }],
|
|
1561
|
-
},
|
|
1562
|
-
},
|
|
1563
|
-
};
|
|
1564
|
-
|
|
1565
|
-
export const nestedArrayDefaultsInvalid = {
|
|
1566
|
-
schema: {
|
|
1567
|
-
logs: {
|
|
1568
|
-
type: 'array',
|
|
1569
|
-
items: {
|
|
1570
|
-
type: 'object',
|
|
1571
|
-
children: {
|
|
1572
|
-
name: { type: 'string' },
|
|
1573
|
-
tags: { type: 'array', items: { type: 'string' } },
|
|
1574
|
-
},
|
|
1575
|
-
},
|
|
1576
|
-
// invalid: tags contains a number
|
|
1577
|
-
default: [{ name: 'file', tags: ['ok', 1 as any] }],
|
|
1578
|
-
},
|
|
1579
|
-
},
|
|
1580
|
-
};
|
|
1581
|
-
|
|
1582
|
-
export const nestedArrayDefaultsValid = {
|
|
1583
|
-
schema: {
|
|
1584
|
-
logs: {
|
|
1585
|
-
type: 'array',
|
|
1586
|
-
items: {
|
|
1587
|
-
type: 'object',
|
|
1588
|
-
children: {
|
|
1589
|
-
name: { type: 'string' },
|
|
1590
|
-
tags: { type: 'array', items: { type: 'string' } },
|
|
1591
|
-
},
|
|
1592
|
-
},
|
|
1593
|
-
default: [{ name: 'file', tags: ['ok', 'x'] }],
|
|
1594
|
-
},
|
|
1595
|
-
},
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
// Nested array of objects inside array of objects (valid)
|
|
1599
|
-
export const nestedArrayOfObjectsDefaultsValid = {
|
|
1600
|
-
schema: {
|
|
1601
|
-
services: {
|
|
1602
|
-
type: 'array',
|
|
1603
|
-
items: {
|
|
1604
|
-
type: 'object',
|
|
1605
|
-
children: {
|
|
1606
|
-
name: { type: 'string' },
|
|
1607
|
-
handlers: {
|
|
1608
|
-
type: 'array',
|
|
1609
|
-
items: {
|
|
1610
|
-
type: 'object',
|
|
1611
|
-
children: {
|
|
1612
|
-
type: { type: 'string' },
|
|
1613
|
-
retries: { type: 'number' },
|
|
1614
|
-
},
|
|
1615
|
-
},
|
|
1616
|
-
default: [{ type: 'file', retries: 3 }],
|
|
1617
|
-
},
|
|
1618
|
-
},
|
|
1619
|
-
},
|
|
1620
|
-
default: [
|
|
1621
|
-
{ name: 'api' },
|
|
1622
|
-
{ name: 'worker', handlers: [{ type: 'console', retries: 1 }] },
|
|
1623
|
-
],
|
|
1624
|
-
},
|
|
1625
|
-
},
|
|
1626
|
-
defaultVal: {
|
|
1627
|
-
services: [
|
|
1628
|
-
{ name: 'api', handlers: [{ type: 'file', retries: 3 }] },
|
|
1629
|
-
{ name: 'worker', handlers: [{ type: 'console', retries: 1 }] },
|
|
1630
|
-
],
|
|
1631
|
-
},
|
|
1632
|
-
};
|
|
1633
|
-
|
|
1634
|
-
// Nested array of objects inside array of objects (invalid inner element shape)
|
|
1635
|
-
export const nestedArrayOfObjectsDefaultsInvalid = {
|
|
1636
|
-
schema: {
|
|
1637
|
-
services: {
|
|
1638
|
-
type: 'array',
|
|
1639
|
-
items: {
|
|
1640
|
-
type: 'object',
|
|
1641
|
-
children: {
|
|
1642
|
-
name: { type: 'string' },
|
|
1643
|
-
handlers: {
|
|
1644
|
-
type: 'array',
|
|
1645
|
-
items: {
|
|
1646
|
-
type: 'object',
|
|
1647
|
-
children: {
|
|
1648
|
-
type: { type: 'string' },
|
|
1649
|
-
retries: { type: 'number' },
|
|
1650
|
-
},
|
|
1651
|
-
},
|
|
1652
|
-
// invalid: retries should be number, unknown key also invalid
|
|
1653
|
-
default: [
|
|
1654
|
-
{ type: 'file', retries: 'three' as any, extra: true as any },
|
|
1655
|
-
],
|
|
1656
|
-
},
|
|
1657
|
-
},
|
|
1658
|
-
},
|
|
1659
|
-
default: [{ name: 'api' }],
|
|
1660
|
-
},
|
|
1661
|
-
},
|
|
1662
|
-
};
|
|
1663
|
-
|
|
1664
|
-
// Wrong choice default at primitive level
|
|
1665
|
-
export const wrongChoiceDefaultSchema = {
|
|
1666
|
-
schema: {
|
|
1667
|
-
mode: {
|
|
1668
|
-
type: 'string',
|
|
1669
|
-
default: 'good',
|
|
1670
|
-
validations: [{ choices: ['hello', 'bye'] }],
|
|
1671
|
-
},
|
|
1672
|
-
},
|
|
1673
|
-
};
|
|
1674
|
-
|
|
1675
|
-
// Wrong choice default nested in array of objects
|
|
1676
|
-
export const nestedWrongChoiceDefaultSchema = {
|
|
1677
|
-
schema: {
|
|
1678
|
-
logs: {
|
|
1679
|
-
type: 'array',
|
|
1680
|
-
items: {
|
|
1681
|
-
type: 'object',
|
|
1682
|
-
children: {
|
|
1683
|
-
type: {
|
|
1684
|
-
type: 'string',
|
|
1685
|
-
default: 'unknown',
|
|
1686
|
-
validations: [{ choices: ['file', 'console', 'loki'] }],
|
|
1687
|
-
},
|
|
1688
|
-
level: { type: 'string', default: 'info' },
|
|
1689
|
-
},
|
|
1690
|
-
},
|
|
1691
|
-
default: [{}],
|
|
1692
|
-
},
|
|
1693
|
-
},
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
export const arraySchemaDefaultValuePairSample = {
|
|
1697
|
-
schema: {
|
|
1698
|
-
stringArray: {
|
|
1699
|
-
type: 'array',
|
|
1700
|
-
default: ['item1', 'item2', 'item3'],
|
|
1701
|
-
description: 'array of strings',
|
|
1702
|
-
items: {
|
|
1703
|
-
type: 'string',
|
|
1704
|
-
},
|
|
1705
|
-
},
|
|
1706
|
-
numberArray: {
|
|
1707
|
-
type: 'array',
|
|
1708
|
-
default: [1, 2, 3, 42],
|
|
1709
|
-
description: 'array of numbers',
|
|
1710
|
-
items: {
|
|
1711
|
-
type: 'number',
|
|
1712
|
-
},
|
|
1713
|
-
},
|
|
1714
|
-
emptyArray: {
|
|
1715
|
-
type: 'array',
|
|
1716
|
-
default: [],
|
|
1717
|
-
description: 'empty array',
|
|
1718
|
-
items: {
|
|
1719
|
-
type: 'string',
|
|
1720
|
-
},
|
|
1721
|
-
},
|
|
1722
|
-
noDefaultArray: {
|
|
1723
|
-
type: 'array',
|
|
1724
|
-
description: 'array without default',
|
|
1725
|
-
items: {
|
|
1726
|
-
type: 'boolean',
|
|
1727
|
-
},
|
|
1728
|
-
},
|
|
1729
|
-
},
|
|
1730
|
-
defaultVal: {
|
|
1731
|
-
stringArray: ['item1', 'item2', 'item3'],
|
|
1732
|
-
numberArray: [1, 2, 3, 42],
|
|
1733
|
-
emptyArray: [],
|
|
1734
|
-
},
|
|
1735
|
-
};
|