@rosen-bridge/config 0.1.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.
Files changed (50) hide show
  1. package/.eslintignore +1 -0
  2. package/CHANGELOG.md +8 -0
  3. package/README.md +24 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +102 -0
  7. package/dist/config.d.ts +131 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +578 -0
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +2 -0
  13. package/dist/schema/Validators/fieldProperties.d.ts +29 -0
  14. package/dist/schema/Validators/fieldProperties.d.ts.map +1 -0
  15. package/dist/schema/Validators/fieldProperties.js +254 -0
  16. package/dist/schema/types/fields.d.ts +37 -0
  17. package/dist/schema/types/fields.d.ts.map +1 -0
  18. package/dist/schema/types/fields.js +2 -0
  19. package/dist/schema/types/validations.d.ts +46 -0
  20. package/dist/schema/types/validations.d.ts.map +1 -0
  21. package/dist/schema/types/validations.js +2 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -0
  23. package/dist/utils.d.ts +36 -0
  24. package/dist/utils.d.ts.map +1 -0
  25. package/dist/utils.js +59 -0
  26. package/dist/value/validators.d.ts +3 -0
  27. package/dist/value/validators.d.ts.map +1 -0
  28. package/dist/value/validators.js +188 -0
  29. package/lib/cli.ts +113 -0
  30. package/lib/config.ts +664 -0
  31. package/lib/index.ts +1 -0
  32. package/lib/schema/Validators/fieldProperties.ts +273 -0
  33. package/lib/schema/types/fields.ts +46 -0
  34. package/lib/schema/types/validations.ts +63 -0
  35. package/lib/utils.ts +68 -0
  36. package/lib/value/validators.ts +268 -0
  37. package/package.json +48 -0
  38. package/tests/.gitkeep +0 -0
  39. package/tests/config.spec.ts +895 -0
  40. package/tests/configEnvSetup.ts +34 -0
  41. package/tests/configTestData.ts +977 -0
  42. package/tests/configTestFiles/custom-environment-variables.json +5 -0
  43. package/tests/configTestFiles/default.json +12 -0
  44. package/tests/configTestFiles/local.json +5 -0
  45. package/tests/utils.spec.ts +117 -0
  46. package/tests/utilsTestData.ts +26 -0
  47. package/tsconfig.build.json +7 -0
  48. package/tsconfig.build.tsbuildinfo +1 -0
  49. package/tsconfig.json +7 -0
  50. package/vitest.config.ts +11 -0
@@ -0,0 +1,977 @@
1
+ import { cloneDeep } from 'lodash-es';
2
+
3
+ export const apiSchemaDefaultValuePairSample = {
4
+ schema: {
5
+ apiType: {
6
+ type: 'string',
7
+ default: 'explorer',
8
+ description: 'type of api to use',
9
+ label: 'api type',
10
+ validations: [
11
+ {
12
+ required: true,
13
+ error: 'error message when value not validated',
14
+ },
15
+ { choices: ['node', 'explorer'] },
16
+ ],
17
+ },
18
+ servers: {
19
+ type: 'object',
20
+ children: {
21
+ url: {
22
+ type: 'string',
23
+ },
24
+ port: {
25
+ type: 'number',
26
+ },
27
+ },
28
+ },
29
+ apis: {
30
+ type: 'object',
31
+ children: {
32
+ explorer: {
33
+ type: 'object',
34
+ children: {
35
+ url: {
36
+ type: 'string',
37
+ default: 'example.com',
38
+ },
39
+ port: {
40
+ type: 'number',
41
+ default: 443,
42
+ },
43
+ },
44
+ },
45
+ },
46
+ },
47
+ },
48
+ defaultVal: {
49
+ apiType: 'explorer',
50
+ apis: {
51
+ explorer: {
52
+ url: 'example.com',
53
+ port: 443,
54
+ },
55
+ },
56
+ },
57
+ };
58
+
59
+ export const correctApiSchema = {
60
+ apiType: {
61
+ type: 'string',
62
+ default: 'explorer',
63
+ description: 'type of api to use',
64
+ label: 'api type',
65
+ validations: [
66
+ { required: true, error: 'error message when value not validated' },
67
+ { choices: ['node', 'explorer'] },
68
+ ],
69
+ },
70
+ servers: {
71
+ type: 'object',
72
+ children: {
73
+ url: {
74
+ type: 'string',
75
+ },
76
+ port: {
77
+ type: 'number',
78
+ },
79
+ },
80
+ },
81
+ apis: {
82
+ type: 'object',
83
+ children: {
84
+ explorer: {
85
+ type: 'object',
86
+ children: {
87
+ url: {
88
+ type: 'string',
89
+ default: 'example.com',
90
+ },
91
+ port: {
92
+ type: 'number',
93
+ default: 443,
94
+ },
95
+ },
96
+ },
97
+ },
98
+ },
99
+ };
100
+
101
+ export const schemaWithIncorrectPortDefaultValueTypeSample = {
102
+ apiType: {
103
+ type: 'string',
104
+ default: 'explorer',
105
+ description: 'type of api to use',
106
+ label: 'api type',
107
+ validations: [
108
+ { required: true, error: 'error message when value not validated' },
109
+ { choices: ['node', 'explorer'] },
110
+ ],
111
+ },
112
+ servers: {
113
+ type: 'object',
114
+ children: {
115
+ url: {
116
+ type: 'string',
117
+ },
118
+ port: {
119
+ type: 'number',
120
+ },
121
+ },
122
+ },
123
+ apis: {
124
+ type: 'object',
125
+ children: {
126
+ explorer: {
127
+ type: 'object',
128
+ children: {
129
+ url: {
130
+ type: 'string',
131
+ default: 'example.com',
132
+ },
133
+ port: {
134
+ type: 'number',
135
+ default: '443',
136
+ },
137
+ },
138
+ },
139
+ },
140
+ },
141
+ };
142
+
143
+ export const apiSchemaConfigPair = {
144
+ schema: {
145
+ apiType: {
146
+ type: 'string',
147
+ default: 'explorer',
148
+ description: 'type of api to use',
149
+ label: 'api type',
150
+ validations: [
151
+ {
152
+ required: true,
153
+ error: 'error message when value not validated',
154
+ },
155
+ { choices: ['node', 'explorer'] },
156
+ ],
157
+ },
158
+ servers: {
159
+ type: 'object',
160
+ children: {
161
+ url: {
162
+ type: 'string',
163
+ validations: [
164
+ {
165
+ required: true,
166
+ },
167
+ { regex: 'node[1-9]*.mydomain.(com|net)' },
168
+ ],
169
+ },
170
+ port: {
171
+ type: 'number',
172
+ },
173
+ },
174
+ },
175
+ apis: {
176
+ type: 'object',
177
+ children: {
178
+ explorer: {
179
+ type: 'object',
180
+ children: {
181
+ url: {
182
+ type: 'string',
183
+ default: 'example.com',
184
+ },
185
+ port: {
186
+ type: 'number',
187
+ default: 443,
188
+ validations: [{ gt: 500 }],
189
+ },
190
+ },
191
+ },
192
+ },
193
+ },
194
+ },
195
+ config: {
196
+ apiType: 'explorer',
197
+ servers: {
198
+ url: 'node256.mydomain.net',
199
+ },
200
+ apis: {
201
+ explorer: {
202
+ url: 'example.com',
203
+ port: 501,
204
+ },
205
+ },
206
+ },
207
+ };
208
+
209
+ export const apiSchemaConfigPairWrongChoice = {
210
+ schema: {
211
+ apiType: {
212
+ type: 'string',
213
+ default: 'explorer',
214
+ description: 'type of api to use',
215
+ label: 'api type',
216
+ validations: [
217
+ {
218
+ required: true,
219
+ error: 'error message when value not validated',
220
+ },
221
+ {
222
+ choices: ['node', 'explorer'],
223
+ error: 'you did not use one of the valid options',
224
+ },
225
+ ],
226
+ },
227
+ },
228
+ config: {
229
+ apiType: 'scanner',
230
+ },
231
+ };
232
+
233
+ export const apiSchemaConfigPairWrongRegex = {
234
+ schema: {
235
+ servers: {
236
+ type: 'object',
237
+ children: {
238
+ url: {
239
+ type: 'string',
240
+ validations: [{ regex: 'node[1-9]*.mydomain.(com|net)' }],
241
+ },
242
+ },
243
+ },
244
+ },
245
+ config: {
246
+ servers: {
247
+ url: 'node2506.mydomain.com',
248
+ },
249
+ },
250
+ };
251
+
252
+ export const apiSchemaConfigPairWrongRequired = {
253
+ schema: {
254
+ servers: {
255
+ type: 'object',
256
+ children: {
257
+ url: {
258
+ type: 'string',
259
+ validations: [
260
+ {
261
+ required: true,
262
+ },
263
+ ],
264
+ },
265
+ },
266
+ },
267
+ },
268
+ config: {},
269
+ };
270
+
271
+ export const apiSchemaConfigPairWrongPortType = {
272
+ schema: {
273
+ apis: {
274
+ type: 'object',
275
+ children: {
276
+ explorer: {
277
+ type: 'object',
278
+ children: {
279
+ port: {
280
+ type: 'number',
281
+ },
282
+ },
283
+ },
284
+ },
285
+ },
286
+ },
287
+ config: {
288
+ apis: {
289
+ explorer: {
290
+ port: 'abc',
291
+ },
292
+ },
293
+ },
294
+ };
295
+
296
+ export const baseSchemaConfigPairComparison = {
297
+ schema: {
298
+ apis: {
299
+ type: 'object',
300
+ children: {
301
+ explorer: {
302
+ type: 'object',
303
+ children: {
304
+ port: {
305
+ type: 'number',
306
+ validations: [] as any[],
307
+ },
308
+ },
309
+ },
310
+ },
311
+ },
312
+ },
313
+ config: {
314
+ apis: {
315
+ explorer: {
316
+ port: 443,
317
+ },
318
+ },
319
+ },
320
+ };
321
+
322
+ export const apiSchemaConfigPairWrongGreater = cloneDeep(
323
+ baseSchemaConfigPairComparison
324
+ );
325
+ apiSchemaConfigPairWrongGreater.schema.apis.children.explorer.children.port.validations.push(
326
+ { gt: 500 }
327
+ );
328
+ apiSchemaConfigPairWrongGreater.config.apis.explorer.port = 443;
329
+
330
+ export const apiSchemaConfigPairWrongLess = cloneDeep(
331
+ baseSchemaConfigPairComparison
332
+ );
333
+ apiSchemaConfigPairWrongLess.schema.apis.children.explorer.children.port.validations.push(
334
+ { lt: 500 }
335
+ );
336
+ apiSchemaConfigPairWrongLess.config.apis.explorer.port = 700;
337
+
338
+ export const apiSchemaConfigPairWrongGreaterEqual = cloneDeep(
339
+ baseSchemaConfigPairComparison
340
+ );
341
+ apiSchemaConfigPairWrongGreaterEqual.schema.apis.children.explorer.children.port.validations.push(
342
+ { gte: 500 }
343
+ );
344
+ apiSchemaConfigPairWrongGreaterEqual.config.apis.explorer.port = 443;
345
+
346
+ export const apiSchemaConfigPairWrongLessEqual = cloneDeep(
347
+ baseSchemaConfigPairComparison
348
+ );
349
+ apiSchemaConfigPairWrongLessEqual.schema.apis.children.explorer.children.port.validations.push(
350
+ { lte: 500 }
351
+ );
352
+ apiSchemaConfigPairWrongLessEqual.config.apis.explorer.port = 600;
353
+
354
+ const baseSchemaConfigPairComparisonBigInt = {
355
+ schema: {
356
+ apis: {
357
+ type: 'object',
358
+ children: {
359
+ explorer: {
360
+ type: 'object',
361
+ children: {
362
+ port: {
363
+ type: 'bigint',
364
+ validations: [] as any[],
365
+ },
366
+ },
367
+ },
368
+ },
369
+ },
370
+ },
371
+ config: {
372
+ apis: {
373
+ explorer: {
374
+ port: 443n,
375
+ },
376
+ },
377
+ },
378
+ };
379
+
380
+ export const apiSchemaConfigPairWrongGreaterBigInt = cloneDeep(
381
+ baseSchemaConfigPairComparisonBigInt
382
+ );
383
+ apiSchemaConfigPairWrongGreaterBigInt.schema.apis.children.explorer.children.port.validations.push(
384
+ { gt: 500n }
385
+ );
386
+ apiSchemaConfigPairWrongGreaterBigInt.config.apis.explorer.port = 400n;
387
+
388
+ export const apiSchemaConfigPairWrongGreaterEqualBigInt = cloneDeep(
389
+ baseSchemaConfigPairComparisonBigInt
390
+ );
391
+ apiSchemaConfigPairWrongGreaterEqualBigInt.schema.apis.children.explorer.children.port.validations.push(
392
+ { gte: 500n }
393
+ );
394
+ apiSchemaConfigPairWrongGreaterEqualBigInt.config.apis.explorer.port = 400n;
395
+
396
+ export const apiSchemaConfigPairWrongLessBigInt = cloneDeep(
397
+ baseSchemaConfigPairComparisonBigInt
398
+ );
399
+ apiSchemaConfigPairWrongLessBigInt.schema.apis.children.explorer.children.port.validations.push(
400
+ { lt: 500n }
401
+ );
402
+ apiSchemaConfigPairWrongLessBigInt.config.apis.explorer.port = 900n;
403
+
404
+ export const apiSchemaConfigPairWrongLessEqualBigInt = cloneDeep(
405
+ baseSchemaConfigPairComparisonBigInt
406
+ );
407
+ apiSchemaConfigPairWrongLessEqualBigInt.schema.apis.children.explorer.children.port.validations.push(
408
+ { lte: 500n }
409
+ );
410
+ apiSchemaConfigPairWrongLessEqualBigInt.config.apis.explorer.port = 900n;
411
+
412
+ export const apiSchemaConfigPairWrongRequiredFalseWhen = {
413
+ schema: {
414
+ apiType: {
415
+ type: 'string',
416
+ validations: [
417
+ {
418
+ required: true,
419
+ error: 'error message when value not validated',
420
+ when: { path: 'apis.explorer.port', value: 8000 },
421
+ },
422
+ ],
423
+ },
424
+ apis: {
425
+ type: 'object',
426
+ children: {
427
+ explorer: {
428
+ type: 'object',
429
+ children: {
430
+ port: {
431
+ type: 'number',
432
+ },
433
+ },
434
+ },
435
+ },
436
+ },
437
+ },
438
+ config: {
439
+ apiType: 'explorer',
440
+ apis: {
441
+ explorer: {
442
+ port: 501,
443
+ },
444
+ },
445
+ },
446
+ };
447
+
448
+ export const apiSchemaConfigPairWrongRegexFalseWhen = {
449
+ schema: {
450
+ servers: {
451
+ type: 'object',
452
+ children: {
453
+ url: {
454
+ type: 'string',
455
+ validations: [
456
+ {
457
+ regex: 'node[1-9]*.mydomain.(com|net)',
458
+ when: { path: 'apis.explorer.port', value: 8000 },
459
+ },
460
+ ],
461
+ },
462
+ },
463
+ },
464
+ apis: {
465
+ type: 'object',
466
+ children: {
467
+ explorer: {
468
+ type: 'object',
469
+ children: {
470
+ port: {
471
+ type: 'number',
472
+ },
473
+ },
474
+ },
475
+ },
476
+ },
477
+ },
478
+ config: {
479
+ servers: {
480
+ url: 'node2506.mydomain.org',
481
+ },
482
+ apis: {
483
+ explorer: {
484
+ port: 501,
485
+ },
486
+ },
487
+ },
488
+ };
489
+
490
+ export const apiSchemaConfigPairWrongChoiceFalseWhen = {
491
+ schema: {
492
+ apiType: {
493
+ type: 'string',
494
+ validations: [
495
+ {
496
+ choices: ['node', 'explorer'],
497
+ when: { path: 'apis.explorer.port', value: 5000 },
498
+ },
499
+ ],
500
+ },
501
+ apis: {
502
+ type: 'object',
503
+ children: {
504
+ explorer: {
505
+ type: 'object',
506
+ children: {
507
+ port: {
508
+ type: 'number',
509
+ },
510
+ },
511
+ },
512
+ },
513
+ },
514
+ },
515
+ config: {
516
+ apiType: 'scanner',
517
+ apis: {
518
+ explorer: {
519
+ port: 501,
520
+ },
521
+ },
522
+ },
523
+ };
524
+
525
+ export const apiSchemaConfigPairWrongBigIntGreaterFalseWhen = {
526
+ schema: {
527
+ apiType: {
528
+ type: 'string',
529
+ },
530
+ apis: {
531
+ type: 'object',
532
+ children: {
533
+ explorer: {
534
+ type: 'object',
535
+ children: {
536
+ port: {
537
+ type: 'bigint',
538
+ validations: [
539
+ { gt: 500n, when: { path: 'apiType', value: 'explorer' } },
540
+ ],
541
+ },
542
+ },
543
+ },
544
+ },
545
+ },
546
+ },
547
+ config: {
548
+ apiType: 'node',
549
+ apis: {
550
+ explorer: {
551
+ port: 443n,
552
+ },
553
+ },
554
+ },
555
+ };
556
+
557
+ export const apiSchemaConfigPairWrongBigIntGreaterEqualFalseWhen = {
558
+ schema: {
559
+ apiType: {
560
+ type: 'string',
561
+ },
562
+ apis: {
563
+ type: 'object',
564
+ children: {
565
+ explorer: {
566
+ type: 'object',
567
+ children: {
568
+ port: {
569
+ type: 'bigint',
570
+ validations: [
571
+ { gte: 500n, when: { path: 'apiType', value: 'node' } },
572
+ ],
573
+ },
574
+ },
575
+ },
576
+ },
577
+ },
578
+ },
579
+ config: {
580
+ apiType: 'explorer',
581
+ apis: {
582
+ explorer: {
583
+ port: 443n,
584
+ },
585
+ },
586
+ },
587
+ };
588
+
589
+ export const apiSchemaConfigPairWrongBigIntLessFalseWhen = {
590
+ schema: {
591
+ apiType: {
592
+ type: 'string',
593
+ },
594
+ apis: {
595
+ type: 'object',
596
+ children: {
597
+ explorer: {
598
+ type: 'object',
599
+ children: {
600
+ port: {
601
+ type: 'bigint',
602
+ validations: [
603
+ { lt: 500n, when: { path: 'apiType', value: 'node' } },
604
+ ],
605
+ },
606
+ },
607
+ },
608
+ },
609
+ },
610
+ },
611
+ config: {
612
+ apiType: 'explorer',
613
+ apis: {
614
+ explorer: {
615
+ port: 600n,
616
+ },
617
+ },
618
+ },
619
+ };
620
+
621
+ export const apiSchemaConfigPairWrongBigIntLessEqualFalseWhen = {
622
+ schema: {
623
+ apiType: {
624
+ type: 'string',
625
+ },
626
+ apis: {
627
+ type: 'object',
628
+ children: {
629
+ explorer: {
630
+ type: 'object',
631
+ children: {
632
+ port: {
633
+ type: 'bigint',
634
+ validations: [
635
+ { lte: 500n, when: { path: 'apiType', value: 'node' } },
636
+ ],
637
+ },
638
+ },
639
+ },
640
+ },
641
+ },
642
+ },
643
+ config: {
644
+ apiType: 'explorer',
645
+ apis: {
646
+ explorer: {
647
+ port: 600n,
648
+ },
649
+ },
650
+ },
651
+ };
652
+
653
+ export const apiSchemaConfigPairWrongGreaterFalseWhen = {
654
+ schema: {
655
+ apiType: {
656
+ type: 'string',
657
+ },
658
+ apis: {
659
+ type: 'object',
660
+ children: {
661
+ explorer: {
662
+ type: 'object',
663
+ children: {
664
+ port: {
665
+ type: 'number',
666
+ validations: [
667
+ { gt: 500, when: { path: 'apiType', value: 'explorer' } },
668
+ ],
669
+ },
670
+ },
671
+ },
672
+ },
673
+ },
674
+ },
675
+ config: {
676
+ apiType: 'node',
677
+ apis: {
678
+ explorer: {
679
+ port: 443,
680
+ },
681
+ },
682
+ },
683
+ };
684
+
685
+ export const apiSchemaConfigPairWrongGreaterEqualFalseWhen = {
686
+ schema: {
687
+ apiType: {
688
+ type: 'string',
689
+ },
690
+ apis: {
691
+ type: 'object',
692
+ children: {
693
+ explorer: {
694
+ type: 'object',
695
+ children: {
696
+ port: {
697
+ type: 'number',
698
+ validations: [
699
+ { gte: 500, when: { path: 'apiType', value: 'node' } },
700
+ ],
701
+ },
702
+ },
703
+ },
704
+ },
705
+ },
706
+ },
707
+ config: {
708
+ apiType: 'explorer',
709
+ apis: {
710
+ explorer: {
711
+ port: 443,
712
+ },
713
+ },
714
+ },
715
+ };
716
+
717
+ export const apiSchemaConfigPairWrongLessFalseWhen = {
718
+ schema: {
719
+ apiType: {
720
+ type: 'string',
721
+ },
722
+ apis: {
723
+ type: 'object',
724
+ children: {
725
+ explorer: {
726
+ type: 'object',
727
+ children: {
728
+ port: {
729
+ type: 'number',
730
+ validations: [
731
+ { lt: 500, when: { path: 'apiType', value: 'node' } },
732
+ ],
733
+ },
734
+ },
735
+ },
736
+ },
737
+ },
738
+ },
739
+ config: {
740
+ apiType: 'explorer',
741
+ apis: {
742
+ explorer: {
743
+ port: 600,
744
+ },
745
+ },
746
+ },
747
+ };
748
+
749
+ export const apiSchemaConfigPairWrongLessEqualFalseWhen = {
750
+ schema: {
751
+ apiType: {
752
+ type: 'string',
753
+ },
754
+ apis: {
755
+ type: 'object',
756
+ children: {
757
+ explorer: {
758
+ type: 'object',
759
+ children: {
760
+ port: {
761
+ type: 'number',
762
+ validations: [
763
+ { lte: 500, when: { path: 'apiType', value: 'node' } },
764
+ ],
765
+ },
766
+ },
767
+ },
768
+ },
769
+ },
770
+ },
771
+ config: {
772
+ apiType: 'explorer',
773
+ apis: {
774
+ explorer: {
775
+ port: 600,
776
+ },
777
+ },
778
+ },
779
+ };
780
+
781
+ export const apiSchemaConfigPairWithStringBigInt = {
782
+ schema: {
783
+ servers: {
784
+ type: 'object',
785
+ children: {
786
+ port: {
787
+ type: 'bigint',
788
+ },
789
+ },
790
+ },
791
+ },
792
+ config: {
793
+ servers: {
794
+ port: '800',
795
+ },
796
+ },
797
+ };
798
+
799
+ export const apiSchemaConfigPairWithStringNumber = {
800
+ schema: {
801
+ servers: {
802
+ type: 'object',
803
+ children: {
804
+ port: {
805
+ type: 'number',
806
+ },
807
+ },
808
+ },
809
+ },
810
+ config: {
811
+ servers: {
812
+ port: '800',
813
+ },
814
+ },
815
+ };
816
+
817
+ export const schemaTypeScriptTypesPair = {
818
+ schema: {
819
+ apiType: {
820
+ type: 'string',
821
+ },
822
+ explorer: {
823
+ type: 'object',
824
+ children: {
825
+ domain: {
826
+ type: 'string',
827
+ },
828
+ path: {
829
+ type: 'string',
830
+ },
831
+ },
832
+ },
833
+ server: {
834
+ type: 'object',
835
+ children: {
836
+ url: {
837
+ type: 'string',
838
+ },
839
+ port: {
840
+ type: 'number',
841
+ },
842
+ },
843
+ },
844
+ apis: {
845
+ type: 'object',
846
+ children: {
847
+ explorer: {
848
+ type: 'object',
849
+ children: {
850
+ url: {
851
+ type: 'string',
852
+ },
853
+ port: {
854
+ type: 'number',
855
+ },
856
+ },
857
+ },
858
+ },
859
+ },
860
+ },
861
+ types: `interface Infrastructure {
862
+ apis: Apis;
863
+ server: Server;
864
+ explorer: Explorer1;
865
+ apiType: string;
866
+ }
867
+
868
+ interface Explorer1 {
869
+ domain: string;
870
+ path: string;
871
+ }
872
+
873
+ interface Server {
874
+ url: string;
875
+ port: number;
876
+ }
877
+
878
+ interface Apis {
879
+ explorer: Explorer;
880
+ }
881
+
882
+ interface Explorer {
883
+ url: string;
884
+ port: number;
885
+ }
886
+ `,
887
+ };
888
+
889
+ export const schemaConfigCharPair = {
890
+ schema: {
891
+ apiType: {
892
+ type: 'string',
893
+ default: 'explorer',
894
+ description: 'type of api to use',
895
+ label: 'api type',
896
+ validations: [
897
+ {
898
+ required: true,
899
+ error: 'error message when value not validated',
900
+ },
901
+ { choices: ['node', 'explorer'] },
902
+ ],
903
+ },
904
+ servers: {
905
+ type: 'object',
906
+ children: {
907
+ url: {
908
+ type: 'string',
909
+ },
910
+ port: {
911
+ type: 'number',
912
+ },
913
+ },
914
+ },
915
+ apis: {
916
+ type: 'object',
917
+ children: {
918
+ explorer: {
919
+ type: 'object',
920
+ children: {
921
+ url: {
922
+ type: 'string',
923
+ default: 'example.com',
924
+ },
925
+ port: {
926
+ type: 'number',
927
+ default: 443,
928
+ },
929
+ },
930
+ },
931
+ },
932
+ },
933
+ },
934
+ characteristic: {
935
+ apiType: {
936
+ label: 'api type',
937
+ description: 'type of api to use',
938
+ default: 'explorer',
939
+ value: null,
940
+ override: null,
941
+ },
942
+ servers: {
943
+ url: {
944
+ label: null,
945
+ description: null,
946
+ default: null,
947
+ value: null,
948
+ override: 'some-url.org',
949
+ },
950
+ port: {
951
+ label: null,
952
+ description: null,
953
+ default: 500,
954
+ value: 777,
955
+ override: null,
956
+ },
957
+ },
958
+ apis: {
959
+ explorer: {
960
+ url: {
961
+ label: null,
962
+ description: null,
963
+ default: 'example.com',
964
+ value: null,
965
+ override: null,
966
+ },
967
+ port: {
968
+ label: null,
969
+ description: null,
970
+ default: 443,
971
+ value: null,
972
+ override: null,
973
+ },
974
+ },
975
+ },
976
+ },
977
+ };