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