@teambit/api-server 1.0.375 → 1.0.377

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,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.harmony/api-server@1.0.375" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.harmony/api-server@1.0.377" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -25,7 +25,7 @@
25
25
  "__schema": "ClassSchema",
26
26
  "location": {
27
27
  "filePath": "api-server.main.runtime.ts",
28
- "line": 31,
28
+ "line": 32,
29
29
  "character": 1
30
30
  },
31
31
  "signature": "class ApiServerMain",
@@ -35,7 +35,7 @@
35
35
  "__schema": "ConstructorSchema",
36
36
  "location": {
37
37
  "filePath": "api-server.main.runtime.ts",
38
- "line": 32,
38
+ "line": 33,
39
39
  "character": 3
40
40
  },
41
41
  "signature": "constructor ApiServerMain(workspace: Workspace, logger: Logger, express: ExpressMain, watcher: WatcherMain, installer: InstallMain, importer: ImporterMain): ApiServerMain",
@@ -45,7 +45,7 @@
45
45
  "__schema": "ParameterSchema",
46
46
  "location": {
47
47
  "filePath": "api-server.main.runtime.ts",
48
- "line": 33,
48
+ "line": 34,
49
49
  "character": 5
50
50
  },
51
51
  "name": "workspace",
@@ -53,7 +53,7 @@
53
53
  "__schema": "TypeRefSchema",
54
54
  "location": {
55
55
  "filePath": "api-server.main.runtime.ts",
56
- "line": 33,
56
+ "line": 34,
57
57
  "character": 24
58
58
  },
59
59
  "name": "Workspace"
@@ -65,7 +65,7 @@
65
65
  "__schema": "ParameterSchema",
66
66
  "location": {
67
67
  "filePath": "api-server.main.runtime.ts",
68
- "line": 34,
68
+ "line": 35,
69
69
  "character": 5
70
70
  },
71
71
  "name": "logger",
@@ -73,7 +73,7 @@
73
73
  "__schema": "TypeRefSchema",
74
74
  "location": {
75
75
  "filePath": "api-server.main.runtime.ts",
76
- "line": 34,
76
+ "line": 35,
77
77
  "character": 21
78
78
  },
79
79
  "name": "Logger"
@@ -85,7 +85,7 @@
85
85
  "__schema": "ParameterSchema",
86
86
  "location": {
87
87
  "filePath": "api-server.main.runtime.ts",
88
- "line": 35,
88
+ "line": 36,
89
89
  "character": 5
90
90
  },
91
91
  "name": "express",
@@ -93,7 +93,7 @@
93
93
  "__schema": "TypeRefSchema",
94
94
  "location": {
95
95
  "filePath": "api-server.main.runtime.ts",
96
- "line": 35,
96
+ "line": 36,
97
97
  "character": 22
98
98
  },
99
99
  "name": "ExpressMain"
@@ -105,7 +105,7 @@
105
105
  "__schema": "ParameterSchema",
106
106
  "location": {
107
107
  "filePath": "api-server.main.runtime.ts",
108
- "line": 36,
108
+ "line": 37,
109
109
  "character": 5
110
110
  },
111
111
  "name": "watcher",
@@ -113,7 +113,7 @@
113
113
  "__schema": "TypeRefSchema",
114
114
  "location": {
115
115
  "filePath": "api-server.main.runtime.ts",
116
- "line": 36,
116
+ "line": 37,
117
117
  "character": 22
118
118
  },
119
119
  "name": "WatcherMain"
@@ -125,7 +125,7 @@
125
125
  "__schema": "ParameterSchema",
126
126
  "location": {
127
127
  "filePath": "api-server.main.runtime.ts",
128
- "line": 37,
128
+ "line": 38,
129
129
  "character": 5
130
130
  },
131
131
  "name": "installer",
@@ -133,7 +133,7 @@
133
133
  "__schema": "TypeRefSchema",
134
134
  "location": {
135
135
  "filePath": "api-server.main.runtime.ts",
136
- "line": 37,
136
+ "line": 38,
137
137
  "character": 24
138
138
  },
139
139
  "name": "InstallMain"
@@ -145,7 +145,7 @@
145
145
  "__schema": "ParameterSchema",
146
146
  "location": {
147
147
  "filePath": "api-server.main.runtime.ts",
148
- "line": 38,
148
+ "line": 39,
149
149
  "character": 5
150
150
  },
151
151
  "name": "importer",
@@ -153,7 +153,7 @@
153
153
  "__schema": "TypeRefSchema",
154
154
  "location": {
155
155
  "filePath": "api-server.main.runtime.ts",
156
- "line": 38,
156
+ "line": 39,
157
157
  "character": 23
158
158
  },
159
159
  "name": "ImporterMain"
@@ -166,7 +166,7 @@
166
166
  "__schema": "ThisTypeSchema",
167
167
  "location": {
168
168
  "filePath": "api-server.main.runtime.ts",
169
- "line": 31,
169
+ "line": 32,
170
170
  "character": 1
171
171
  },
172
172
  "name": "ApiServerMain"
@@ -177,7 +177,7 @@
177
177
  "__schema": "FunctionLikeSchema",
178
178
  "location": {
179
179
  "filePath": "api-server.main.runtime.ts",
180
- "line": 41,
180
+ "line": 42,
181
181
  "character": 3
182
182
  },
183
183
  "signature": "(method) ApiServerMain.runApiServer(options: {\n port: number;\n compile: boolean;\n}): Promise<unknown>",
@@ -187,7 +187,7 @@
187
187
  "__schema": "ParameterSchema",
188
188
  "location": {
189
189
  "filePath": "api-server.main.runtime.ts",
190
- "line": 41,
190
+ "line": 42,
191
191
  "character": 22
192
192
  },
193
193
  "name": "options",
@@ -195,7 +195,7 @@
195
195
  "__schema": "TypeLiteralSchema",
196
196
  "location": {
197
197
  "filePath": "api-server.main.runtime.ts",
198
- "line": 41,
198
+ "line": 42,
199
199
  "character": 31
200
200
  },
201
201
  "members": [
@@ -203,7 +203,7 @@
203
203
  "__schema": "VariableLikeSchema",
204
204
  "location": {
205
205
  "filePath": "api-server.main.runtime.ts",
206
- "line": 41,
206
+ "line": 42,
207
207
  "character": 33
208
208
  },
209
209
  "signature": "(property) port: number",
@@ -212,7 +212,7 @@
212
212
  "__schema": "KeywordTypeSchema",
213
213
  "location": {
214
214
  "filePath": "api-server.main.runtime.ts",
215
- "line": 41,
215
+ "line": 42,
216
216
  "character": 39
217
217
  },
218
218
  "name": "number"
@@ -223,7 +223,7 @@
223
223
  "__schema": "VariableLikeSchema",
224
224
  "location": {
225
225
  "filePath": "api-server.main.runtime.ts",
226
- "line": 41,
226
+ "line": 42,
227
227
  "character": 47
228
228
  },
229
229
  "signature": "(property) compile: boolean",
@@ -232,7 +232,7 @@
232
232
  "__schema": "KeywordTypeSchema",
233
233
  "location": {
234
234
  "filePath": "api-server.main.runtime.ts",
235
- "line": 41,
235
+ "line": 42,
236
236
  "character": 56
237
237
  },
238
238
  "name": "boolean"
@@ -249,7 +249,7 @@
249
249
  "__schema": "InferenceTypeSchema",
250
250
  "location": {
251
251
  "filePath": "api-server.main.runtime.ts",
252
- "line": 41,
252
+ "line": 42,
253
253
  "character": 3
254
254
  },
255
255
  "type": "Promise<unknown>"
@@ -262,7 +262,7 @@
262
262
  "__schema": "FunctionLikeSchema",
263
263
  "location": {
264
264
  "filePath": "api-server.main.runtime.ts",
265
- "line": 138,
265
+ "line": 139,
266
266
  "character": 3
267
267
  },
268
268
  "signature": "(method) ApiServerMain.writeUsedPort(port: number): void",
@@ -272,7 +272,7 @@
272
272
  "__schema": "ParameterSchema",
273
273
  "location": {
274
274
  "filePath": "api-server.main.runtime.ts",
275
- "line": 138,
275
+ "line": 139,
276
276
  "character": 17
277
277
  },
278
278
  "name": "port",
@@ -280,7 +280,7 @@
280
280
  "__schema": "KeywordTypeSchema",
281
281
  "location": {
282
282
  "filePath": "api-server.main.runtime.ts",
283
- "line": 138,
283
+ "line": 139,
284
284
  "character": 23
285
285
  },
286
286
  "name": "number"
@@ -293,7 +293,7 @@
293
293
  "__schema": "InferenceTypeSchema",
294
294
  "location": {
295
295
  "filePath": "api-server.main.runtime.ts",
296
- "line": 138,
296
+ "line": 139,
297
297
  "character": 3
298
298
  },
299
299
  "type": "void"
@@ -304,7 +304,30 @@
304
304
  "__schema": "FunctionLikeSchema",
305
305
  "location": {
306
306
  "filePath": "api-server.main.runtime.ts",
307
- "line": 143,
307
+ "line": 144,
308
+ "character": 3
309
+ },
310
+ "signature": "(method) ApiServerMain.getRandomPort(): Promise<number>",
311
+ "name": "getRandomPort",
312
+ "params": [],
313
+ "returnType": {
314
+ "__schema": "InferenceTypeSchema",
315
+ "location": {
316
+ "filePath": "api-server.main.runtime.ts",
317
+ "line": 144,
318
+ "character": 3
319
+ },
320
+ "type": "Promise<number>"
321
+ },
322
+ "modifiers": [
323
+ "async"
324
+ ]
325
+ },
326
+ {
327
+ "__schema": "FunctionLikeSchema",
328
+ "location": {
329
+ "filePath": "api-server.main.runtime.ts",
330
+ "line": 152,
308
331
  "character": 3
309
332
  },
310
333
  "signature": "(method) ApiServerMain.getExistingUsedPort(): Promise<number | undefined>",
@@ -314,7 +337,7 @@
314
337
  "__schema": "TypeRefSchema",
315
338
  "location": {
316
339
  "filePath": "api-server.main.runtime.ts",
317
- "line": 143,
340
+ "line": 152,
318
341
  "character": 32
319
342
  },
320
343
  "name": "Promise",
@@ -323,7 +346,7 @@
323
346
  "__schema": "TypeUnionSchema",
324
347
  "location": {
325
348
  "filePath": "api-server.main.runtime.ts",
326
- "line": 143,
349
+ "line": 152,
327
350
  "character": 40
328
351
  },
329
352
  "types": [
@@ -331,7 +354,7 @@
331
354
  "__schema": "KeywordTypeSchema",
332
355
  "location": {
333
356
  "filePath": "api-server.main.runtime.ts",
334
- "line": 143,
357
+ "line": 152,
335
358
  "character": 40
336
359
  },
337
360
  "name": "number"
@@ -340,7 +363,7 @@
340
363
  "__schema": "KeywordTypeSchema",
341
364
  "location": {
342
365
  "filePath": "api-server.main.runtime.ts",
343
- "line": 143,
366
+ "line": 152,
344
367
  "character": 49
345
368
  },
346
369
  "name": "undefined"
@@ -357,7 +380,7 @@
357
380
  "__schema": "VariableLikeSchema",
358
381
  "location": {
359
382
  "filePath": "api-server.main.runtime.ts",
360
- "line": 160,
383
+ "line": 169,
361
384
  "character": 3
362
385
  },
363
386
  "signature": "(property) ApiServerMain.dependencies: Aspect[]",
@@ -366,7 +389,7 @@
366
389
  "__schema": "InferenceTypeSchema",
367
390
  "location": {
368
391
  "filePath": "api-server.main.runtime.ts",
369
- "line": 160,
392
+ "line": 169,
370
393
  "character": 3
371
394
  },
372
395
  "type": "Aspect[]"
@@ -378,7 +401,7 @@
378
401
  "__schema": "VariableLikeSchema",
379
402
  "location": {
380
403
  "filePath": "api-server.main.runtime.ts",
381
- "line": 178,
404
+ "line": 187,
382
405
  "character": 3
383
406
  },
384
407
  "signature": "(property) ApiServerMain.runtime: RuntimeDefinition",
@@ -387,7 +410,7 @@
387
410
  "__schema": "InferenceTypeSchema",
388
411
  "location": {
389
412
  "filePath": "api-server.main.runtime.ts",
390
- "line": 178,
413
+ "line": 187,
391
414
  "character": 3
392
415
  },
393
416
  "type": "RuntimeDefinition"
@@ -399,7 +422,7 @@
399
422
  "__schema": "FunctionLikeSchema",
400
423
  "location": {
401
424
  "filePath": "api-server.main.runtime.ts",
402
- "line": 179,
425
+ "line": 188,
403
426
  "character": 3
404
427
  },
405
428
  "signature": "(method) ApiServerMain.provider([cli, workspace, loggerMain, express, watcher, snapping, lanes, installer, exporter, checkout, componentLog, importer, componentCompare, generator, remove, config,]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ExpressMain,\n WatcherMain,\n SnappingMain,\n LanesMain,\n InstallMain,\n ExportMain,\n CheckoutMain,\n ComponentLogMain,\n ImporterMain,\n ComponentCompareMain,\n GeneratorMain,\n RemoveMain,\n ConfigMain\n]): Promise<ApiServerMain>",
@@ -409,7 +432,7 @@
409
432
  "__schema": "ParameterSchema",
410
433
  "location": {
411
434
  "filePath": "api-server.main.runtime.ts",
412
- "line": 179,
435
+ "line": 188,
413
436
  "character": 25
414
437
  },
415
438
  "name": "[ cli, workspace, loggerMain, express, watcher, snapping, lanes, installer, exporter, checkout, componentLog, importer, componentCompare, generator, remove, config ]",
@@ -417,7 +440,7 @@
417
440
  "__schema": "TupleTypeSchema",
418
441
  "location": {
419
442
  "filePath": "api-server.main.runtime.ts",
420
- "line": 196,
443
+ "line": 205,
421
444
  "character": 6
422
445
  },
423
446
  "elements": [
@@ -425,7 +448,7 @@
425
448
  "__schema": "TypeRefSchema",
426
449
  "location": {
427
450
  "filePath": "api-server.main.runtime.ts",
428
- "line": 197,
451
+ "line": 206,
429
452
  "character": 5
430
453
  },
431
454
  "name": "CLIMain"
@@ -434,7 +457,7 @@
434
457
  "__schema": "TypeRefSchema",
435
458
  "location": {
436
459
  "filePath": "api-server.main.runtime.ts",
437
- "line": 198,
460
+ "line": 207,
438
461
  "character": 5
439
462
  },
440
463
  "name": "Workspace"
@@ -443,7 +466,7 @@
443
466
  "__schema": "TypeRefSchema",
444
467
  "location": {
445
468
  "filePath": "api-server.main.runtime.ts",
446
- "line": 199,
469
+ "line": 208,
447
470
  "character": 5
448
471
  },
449
472
  "name": "LoggerMain"
@@ -452,7 +475,7 @@
452
475
  "__schema": "TypeRefSchema",
453
476
  "location": {
454
477
  "filePath": "api-server.main.runtime.ts",
455
- "line": 200,
478
+ "line": 209,
456
479
  "character": 5
457
480
  },
458
481
  "name": "ExpressMain"
@@ -461,7 +484,7 @@
461
484
  "__schema": "TypeRefSchema",
462
485
  "location": {
463
486
  "filePath": "api-server.main.runtime.ts",
464
- "line": 201,
487
+ "line": 210,
465
488
  "character": 5
466
489
  },
467
490
  "name": "WatcherMain"
@@ -470,7 +493,7 @@
470
493
  "__schema": "TypeRefSchema",
471
494
  "location": {
472
495
  "filePath": "api-server.main.runtime.ts",
473
- "line": 202,
496
+ "line": 211,
474
497
  "character": 5
475
498
  },
476
499
  "name": "SnappingMain"
@@ -479,7 +502,7 @@
479
502
  "__schema": "TypeRefSchema",
480
503
  "location": {
481
504
  "filePath": "api-server.main.runtime.ts",
482
- "line": 203,
505
+ "line": 212,
483
506
  "character": 5
484
507
  },
485
508
  "name": "LanesMain"
@@ -488,7 +511,7 @@
488
511
  "__schema": "TypeRefSchema",
489
512
  "location": {
490
513
  "filePath": "api-server.main.runtime.ts",
491
- "line": 204,
514
+ "line": 213,
492
515
  "character": 5
493
516
  },
494
517
  "name": "InstallMain"
@@ -497,7 +520,7 @@
497
520
  "__schema": "TypeRefSchema",
498
521
  "location": {
499
522
  "filePath": "api-server.main.runtime.ts",
500
- "line": 205,
523
+ "line": 214,
501
524
  "character": 5
502
525
  },
503
526
  "name": "ExportMain"
@@ -506,7 +529,7 @@
506
529
  "__schema": "TypeRefSchema",
507
530
  "location": {
508
531
  "filePath": "api-server.main.runtime.ts",
509
- "line": 206,
532
+ "line": 215,
510
533
  "character": 5
511
534
  },
512
535
  "name": "CheckoutMain"
@@ -515,7 +538,7 @@
515
538
  "__schema": "TypeRefSchema",
516
539
  "location": {
517
540
  "filePath": "api-server.main.runtime.ts",
518
- "line": 207,
541
+ "line": 216,
519
542
  "character": 5
520
543
  },
521
544
  "name": "ComponentLogMain"
@@ -524,7 +547,7 @@
524
547
  "__schema": "TypeRefSchema",
525
548
  "location": {
526
549
  "filePath": "api-server.main.runtime.ts",
527
- "line": 208,
550
+ "line": 217,
528
551
  "character": 5
529
552
  },
530
553
  "name": "ImporterMain"
@@ -533,7 +556,7 @@
533
556
  "__schema": "TypeRefSchema",
534
557
  "location": {
535
558
  "filePath": "api-server.main.runtime.ts",
536
- "line": 209,
559
+ "line": 218,
537
560
  "character": 5
538
561
  },
539
562
  "name": "ComponentCompareMain"
@@ -542,7 +565,7 @@
542
565
  "__schema": "TypeRefSchema",
543
566
  "location": {
544
567
  "filePath": "api-server.main.runtime.ts",
545
- "line": 210,
568
+ "line": 219,
546
569
  "character": 5
547
570
  },
548
571
  "name": "GeneratorMain"
@@ -551,7 +574,7 @@
551
574
  "__schema": "TypeRefSchema",
552
575
  "location": {
553
576
  "filePath": "api-server.main.runtime.ts",
554
- "line": 211,
577
+ "line": 220,
555
578
  "character": 5
556
579
  },
557
580
  "name": "RemoveMain"
@@ -560,7 +583,7 @@
560
583
  "__schema": "TypeRefSchema",
561
584
  "location": {
562
585
  "filePath": "api-server.main.runtime.ts",
563
- "line": 212,
586
+ "line": 221,
564
587
  "character": 5
565
588
  },
566
589
  "name": "ConfigMain"
@@ -575,7 +598,7 @@
575
598
  "__schema": "InferenceTypeSchema",
576
599
  "location": {
577
600
  "filePath": "api-server.main.runtime.ts",
578
- "line": 179,
601
+ "line": 188,
579
602
  "character": 3
580
603
  },
581
604
  "type": "Promise<ApiServerMain>"
@@ -651,7 +674,7 @@
651
674
  "__schema": "ClassSchema",
652
675
  "location": {
653
676
  "filePath": "api-server.main.runtime.ts",
654
- "line": 31,
677
+ "line": 32,
655
678
  "character": 1
656
679
  },
657
680
  "signature": "class ApiServerMain",
@@ -661,7 +684,7 @@
661
684
  "__schema": "ConstructorSchema",
662
685
  "location": {
663
686
  "filePath": "api-server.main.runtime.ts",
664
- "line": 32,
687
+ "line": 33,
665
688
  "character": 3
666
689
  },
667
690
  "signature": "constructor ApiServerMain(workspace: Workspace, logger: Logger, express: ExpressMain, watcher: WatcherMain, installer: InstallMain, importer: ImporterMain): ApiServerMain",
@@ -671,7 +694,7 @@
671
694
  "__schema": "ParameterSchema",
672
695
  "location": {
673
696
  "filePath": "api-server.main.runtime.ts",
674
- "line": 33,
697
+ "line": 34,
675
698
  "character": 5
676
699
  },
677
700
  "name": "workspace",
@@ -679,7 +702,7 @@
679
702
  "__schema": "TypeRefSchema",
680
703
  "location": {
681
704
  "filePath": "api-server.main.runtime.ts",
682
- "line": 33,
705
+ "line": 34,
683
706
  "character": 24
684
707
  },
685
708
  "name": "Workspace"
@@ -691,7 +714,7 @@
691
714
  "__schema": "ParameterSchema",
692
715
  "location": {
693
716
  "filePath": "api-server.main.runtime.ts",
694
- "line": 34,
717
+ "line": 35,
695
718
  "character": 5
696
719
  },
697
720
  "name": "logger",
@@ -699,7 +722,7 @@
699
722
  "__schema": "TypeRefSchema",
700
723
  "location": {
701
724
  "filePath": "api-server.main.runtime.ts",
702
- "line": 34,
725
+ "line": 35,
703
726
  "character": 21
704
727
  },
705
728
  "name": "Logger"
@@ -711,7 +734,7 @@
711
734
  "__schema": "ParameterSchema",
712
735
  "location": {
713
736
  "filePath": "api-server.main.runtime.ts",
714
- "line": 35,
737
+ "line": 36,
715
738
  "character": 5
716
739
  },
717
740
  "name": "express",
@@ -719,7 +742,7 @@
719
742
  "__schema": "TypeRefSchema",
720
743
  "location": {
721
744
  "filePath": "api-server.main.runtime.ts",
722
- "line": 35,
745
+ "line": 36,
723
746
  "character": 22
724
747
  },
725
748
  "name": "ExpressMain"
@@ -731,7 +754,7 @@
731
754
  "__schema": "ParameterSchema",
732
755
  "location": {
733
756
  "filePath": "api-server.main.runtime.ts",
734
- "line": 36,
757
+ "line": 37,
735
758
  "character": 5
736
759
  },
737
760
  "name": "watcher",
@@ -739,7 +762,7 @@
739
762
  "__schema": "TypeRefSchema",
740
763
  "location": {
741
764
  "filePath": "api-server.main.runtime.ts",
742
- "line": 36,
765
+ "line": 37,
743
766
  "character": 22
744
767
  },
745
768
  "name": "WatcherMain"
@@ -751,7 +774,7 @@
751
774
  "__schema": "ParameterSchema",
752
775
  "location": {
753
776
  "filePath": "api-server.main.runtime.ts",
754
- "line": 37,
777
+ "line": 38,
755
778
  "character": 5
756
779
  },
757
780
  "name": "installer",
@@ -759,7 +782,7 @@
759
782
  "__schema": "TypeRefSchema",
760
783
  "location": {
761
784
  "filePath": "api-server.main.runtime.ts",
762
- "line": 37,
785
+ "line": 38,
763
786
  "character": 24
764
787
  },
765
788
  "name": "InstallMain"
@@ -771,7 +794,7 @@
771
794
  "__schema": "ParameterSchema",
772
795
  "location": {
773
796
  "filePath": "api-server.main.runtime.ts",
774
- "line": 38,
797
+ "line": 39,
775
798
  "character": 5
776
799
  },
777
800
  "name": "importer",
@@ -779,7 +802,7 @@
779
802
  "__schema": "TypeRefSchema",
780
803
  "location": {
781
804
  "filePath": "api-server.main.runtime.ts",
782
- "line": 38,
805
+ "line": 39,
783
806
  "character": 23
784
807
  },
785
808
  "name": "ImporterMain"
@@ -792,7 +815,7 @@
792
815
  "__schema": "ThisTypeSchema",
793
816
  "location": {
794
817
  "filePath": "api-server.main.runtime.ts",
795
- "line": 31,
818
+ "line": 32,
796
819
  "character": 1
797
820
  },
798
821
  "name": "ApiServerMain"
@@ -803,7 +826,7 @@
803
826
  "__schema": "FunctionLikeSchema",
804
827
  "location": {
805
828
  "filePath": "api-server.main.runtime.ts",
806
- "line": 41,
829
+ "line": 42,
807
830
  "character": 3
808
831
  },
809
832
  "signature": "(method) ApiServerMain.runApiServer(options: {\n port: number;\n compile: boolean;\n}): Promise<unknown>",
@@ -813,7 +836,7 @@
813
836
  "__schema": "ParameterSchema",
814
837
  "location": {
815
838
  "filePath": "api-server.main.runtime.ts",
816
- "line": 41,
839
+ "line": 42,
817
840
  "character": 22
818
841
  },
819
842
  "name": "options",
@@ -821,7 +844,7 @@
821
844
  "__schema": "TypeLiteralSchema",
822
845
  "location": {
823
846
  "filePath": "api-server.main.runtime.ts",
824
- "line": 41,
847
+ "line": 42,
825
848
  "character": 31
826
849
  },
827
850
  "members": [
@@ -829,7 +852,7 @@
829
852
  "__schema": "VariableLikeSchema",
830
853
  "location": {
831
854
  "filePath": "api-server.main.runtime.ts",
832
- "line": 41,
855
+ "line": 42,
833
856
  "character": 33
834
857
  },
835
858
  "signature": "(property) port: number",
@@ -838,7 +861,7 @@
838
861
  "__schema": "KeywordTypeSchema",
839
862
  "location": {
840
863
  "filePath": "api-server.main.runtime.ts",
841
- "line": 41,
864
+ "line": 42,
842
865
  "character": 39
843
866
  },
844
867
  "name": "number"
@@ -849,7 +872,7 @@
849
872
  "__schema": "VariableLikeSchema",
850
873
  "location": {
851
874
  "filePath": "api-server.main.runtime.ts",
852
- "line": 41,
875
+ "line": 42,
853
876
  "character": 47
854
877
  },
855
878
  "signature": "(property) compile: boolean",
@@ -858,7 +881,7 @@
858
881
  "__schema": "KeywordTypeSchema",
859
882
  "location": {
860
883
  "filePath": "api-server.main.runtime.ts",
861
- "line": 41,
884
+ "line": 42,
862
885
  "character": 56
863
886
  },
864
887
  "name": "boolean"
@@ -875,7 +898,7 @@
875
898
  "__schema": "InferenceTypeSchema",
876
899
  "location": {
877
900
  "filePath": "api-server.main.runtime.ts",
878
- "line": 41,
901
+ "line": 42,
879
902
  "character": 3
880
903
  },
881
904
  "type": "Promise<unknown>"
@@ -888,7 +911,7 @@
888
911
  "__schema": "FunctionLikeSchema",
889
912
  "location": {
890
913
  "filePath": "api-server.main.runtime.ts",
891
- "line": 138,
914
+ "line": 139,
892
915
  "character": 3
893
916
  },
894
917
  "signature": "(method) ApiServerMain.writeUsedPort(port: number): void",
@@ -898,7 +921,7 @@
898
921
  "__schema": "ParameterSchema",
899
922
  "location": {
900
923
  "filePath": "api-server.main.runtime.ts",
901
- "line": 138,
924
+ "line": 139,
902
925
  "character": 17
903
926
  },
904
927
  "name": "port",
@@ -906,7 +929,7 @@
906
929
  "__schema": "KeywordTypeSchema",
907
930
  "location": {
908
931
  "filePath": "api-server.main.runtime.ts",
909
- "line": 138,
932
+ "line": 139,
910
933
  "character": 23
911
934
  },
912
935
  "name": "number"
@@ -919,7 +942,7 @@
919
942
  "__schema": "InferenceTypeSchema",
920
943
  "location": {
921
944
  "filePath": "api-server.main.runtime.ts",
922
- "line": 138,
945
+ "line": 139,
923
946
  "character": 3
924
947
  },
925
948
  "type": "void"
@@ -930,7 +953,30 @@
930
953
  "__schema": "FunctionLikeSchema",
931
954
  "location": {
932
955
  "filePath": "api-server.main.runtime.ts",
933
- "line": 143,
956
+ "line": 144,
957
+ "character": 3
958
+ },
959
+ "signature": "(method) ApiServerMain.getRandomPort(): Promise<number>",
960
+ "name": "getRandomPort",
961
+ "params": [],
962
+ "returnType": {
963
+ "__schema": "InferenceTypeSchema",
964
+ "location": {
965
+ "filePath": "api-server.main.runtime.ts",
966
+ "line": 144,
967
+ "character": 3
968
+ },
969
+ "type": "Promise<number>"
970
+ },
971
+ "modifiers": [
972
+ "async"
973
+ ]
974
+ },
975
+ {
976
+ "__schema": "FunctionLikeSchema",
977
+ "location": {
978
+ "filePath": "api-server.main.runtime.ts",
979
+ "line": 152,
934
980
  "character": 3
935
981
  },
936
982
  "signature": "(method) ApiServerMain.getExistingUsedPort(): Promise<number | undefined>",
@@ -940,7 +986,7 @@
940
986
  "__schema": "TypeRefSchema",
941
987
  "location": {
942
988
  "filePath": "api-server.main.runtime.ts",
943
- "line": 143,
989
+ "line": 152,
944
990
  "character": 32
945
991
  },
946
992
  "name": "Promise",
@@ -949,7 +995,7 @@
949
995
  "__schema": "TypeUnionSchema",
950
996
  "location": {
951
997
  "filePath": "api-server.main.runtime.ts",
952
- "line": 143,
998
+ "line": 152,
953
999
  "character": 40
954
1000
  },
955
1001
  "types": [
@@ -957,7 +1003,7 @@
957
1003
  "__schema": "KeywordTypeSchema",
958
1004
  "location": {
959
1005
  "filePath": "api-server.main.runtime.ts",
960
- "line": 143,
1006
+ "line": 152,
961
1007
  "character": 40
962
1008
  },
963
1009
  "name": "number"
@@ -966,7 +1012,7 @@
966
1012
  "__schema": "KeywordTypeSchema",
967
1013
  "location": {
968
1014
  "filePath": "api-server.main.runtime.ts",
969
- "line": 143,
1015
+ "line": 152,
970
1016
  "character": 49
971
1017
  },
972
1018
  "name": "undefined"
@@ -983,7 +1029,7 @@
983
1029
  "__schema": "VariableLikeSchema",
984
1030
  "location": {
985
1031
  "filePath": "api-server.main.runtime.ts",
986
- "line": 160,
1032
+ "line": 169,
987
1033
  "character": 3
988
1034
  },
989
1035
  "signature": "(property) ApiServerMain.dependencies: Aspect[]",
@@ -992,7 +1038,7 @@
992
1038
  "__schema": "InferenceTypeSchema",
993
1039
  "location": {
994
1040
  "filePath": "api-server.main.runtime.ts",
995
- "line": 160,
1041
+ "line": 169,
996
1042
  "character": 3
997
1043
  },
998
1044
  "type": "Aspect[]"
@@ -1004,7 +1050,7 @@
1004
1050
  "__schema": "VariableLikeSchema",
1005
1051
  "location": {
1006
1052
  "filePath": "api-server.main.runtime.ts",
1007
- "line": 178,
1053
+ "line": 187,
1008
1054
  "character": 3
1009
1055
  },
1010
1056
  "signature": "(property) ApiServerMain.runtime: RuntimeDefinition",
@@ -1013,7 +1059,7 @@
1013
1059
  "__schema": "InferenceTypeSchema",
1014
1060
  "location": {
1015
1061
  "filePath": "api-server.main.runtime.ts",
1016
- "line": 178,
1062
+ "line": 187,
1017
1063
  "character": 3
1018
1064
  },
1019
1065
  "type": "RuntimeDefinition"
@@ -1025,7 +1071,7 @@
1025
1071
  "__schema": "FunctionLikeSchema",
1026
1072
  "location": {
1027
1073
  "filePath": "api-server.main.runtime.ts",
1028
- "line": 179,
1074
+ "line": 188,
1029
1075
  "character": 3
1030
1076
  },
1031
1077
  "signature": "(method) ApiServerMain.provider([cli, workspace, loggerMain, express, watcher, snapping, lanes, installer, exporter, checkout, componentLog, importer, componentCompare, generator, remove, config,]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ExpressMain,\n WatcherMain,\n SnappingMain,\n LanesMain,\n InstallMain,\n ExportMain,\n CheckoutMain,\n ComponentLogMain,\n ImporterMain,\n ComponentCompareMain,\n GeneratorMain,\n RemoveMain,\n ConfigMain\n]): Promise<ApiServerMain>",
@@ -1035,7 +1081,7 @@
1035
1081
  "__schema": "ParameterSchema",
1036
1082
  "location": {
1037
1083
  "filePath": "api-server.main.runtime.ts",
1038
- "line": 179,
1084
+ "line": 188,
1039
1085
  "character": 25
1040
1086
  },
1041
1087
  "name": "[ cli, workspace, loggerMain, express, watcher, snapping, lanes, installer, exporter, checkout, componentLog, importer, componentCompare, generator, remove, config ]",
@@ -1043,7 +1089,7 @@
1043
1089
  "__schema": "TupleTypeSchema",
1044
1090
  "location": {
1045
1091
  "filePath": "api-server.main.runtime.ts",
1046
- "line": 196,
1092
+ "line": 205,
1047
1093
  "character": 6
1048
1094
  },
1049
1095
  "elements": [
@@ -1051,7 +1097,7 @@
1051
1097
  "__schema": "TypeRefSchema",
1052
1098
  "location": {
1053
1099
  "filePath": "api-server.main.runtime.ts",
1054
- "line": 197,
1100
+ "line": 206,
1055
1101
  "character": 5
1056
1102
  },
1057
1103
  "name": "CLIMain"
@@ -1060,7 +1106,7 @@
1060
1106
  "__schema": "TypeRefSchema",
1061
1107
  "location": {
1062
1108
  "filePath": "api-server.main.runtime.ts",
1063
- "line": 198,
1109
+ "line": 207,
1064
1110
  "character": 5
1065
1111
  },
1066
1112
  "name": "Workspace"
@@ -1069,7 +1115,7 @@
1069
1115
  "__schema": "TypeRefSchema",
1070
1116
  "location": {
1071
1117
  "filePath": "api-server.main.runtime.ts",
1072
- "line": 199,
1118
+ "line": 208,
1073
1119
  "character": 5
1074
1120
  },
1075
1121
  "name": "LoggerMain"
@@ -1078,7 +1124,7 @@
1078
1124
  "__schema": "TypeRefSchema",
1079
1125
  "location": {
1080
1126
  "filePath": "api-server.main.runtime.ts",
1081
- "line": 200,
1127
+ "line": 209,
1082
1128
  "character": 5
1083
1129
  },
1084
1130
  "name": "ExpressMain"
@@ -1087,7 +1133,7 @@
1087
1133
  "__schema": "TypeRefSchema",
1088
1134
  "location": {
1089
1135
  "filePath": "api-server.main.runtime.ts",
1090
- "line": 201,
1136
+ "line": 210,
1091
1137
  "character": 5
1092
1138
  },
1093
1139
  "name": "WatcherMain"
@@ -1096,7 +1142,7 @@
1096
1142
  "__schema": "TypeRefSchema",
1097
1143
  "location": {
1098
1144
  "filePath": "api-server.main.runtime.ts",
1099
- "line": 202,
1145
+ "line": 211,
1100
1146
  "character": 5
1101
1147
  },
1102
1148
  "name": "SnappingMain"
@@ -1105,7 +1151,7 @@
1105
1151
  "__schema": "TypeRefSchema",
1106
1152
  "location": {
1107
1153
  "filePath": "api-server.main.runtime.ts",
1108
- "line": 203,
1154
+ "line": 212,
1109
1155
  "character": 5
1110
1156
  },
1111
1157
  "name": "LanesMain"
@@ -1114,7 +1160,7 @@
1114
1160
  "__schema": "TypeRefSchema",
1115
1161
  "location": {
1116
1162
  "filePath": "api-server.main.runtime.ts",
1117
- "line": 204,
1163
+ "line": 213,
1118
1164
  "character": 5
1119
1165
  },
1120
1166
  "name": "InstallMain"
@@ -1123,7 +1169,7 @@
1123
1169
  "__schema": "TypeRefSchema",
1124
1170
  "location": {
1125
1171
  "filePath": "api-server.main.runtime.ts",
1126
- "line": 205,
1172
+ "line": 214,
1127
1173
  "character": 5
1128
1174
  },
1129
1175
  "name": "ExportMain"
@@ -1132,7 +1178,7 @@
1132
1178
  "__schema": "TypeRefSchema",
1133
1179
  "location": {
1134
1180
  "filePath": "api-server.main.runtime.ts",
1135
- "line": 206,
1181
+ "line": 215,
1136
1182
  "character": 5
1137
1183
  },
1138
1184
  "name": "CheckoutMain"
@@ -1141,7 +1187,7 @@
1141
1187
  "__schema": "TypeRefSchema",
1142
1188
  "location": {
1143
1189
  "filePath": "api-server.main.runtime.ts",
1144
- "line": 207,
1190
+ "line": 216,
1145
1191
  "character": 5
1146
1192
  },
1147
1193
  "name": "ComponentLogMain"
@@ -1150,7 +1196,7 @@
1150
1196
  "__schema": "TypeRefSchema",
1151
1197
  "location": {
1152
1198
  "filePath": "api-server.main.runtime.ts",
1153
- "line": 208,
1199
+ "line": 217,
1154
1200
  "character": 5
1155
1201
  },
1156
1202
  "name": "ImporterMain"
@@ -1159,7 +1205,7 @@
1159
1205
  "__schema": "TypeRefSchema",
1160
1206
  "location": {
1161
1207
  "filePath": "api-server.main.runtime.ts",
1162
- "line": 209,
1208
+ "line": 218,
1163
1209
  "character": 5
1164
1210
  },
1165
1211
  "name": "ComponentCompareMain"
@@ -1168,7 +1214,7 @@
1168
1214
  "__schema": "TypeRefSchema",
1169
1215
  "location": {
1170
1216
  "filePath": "api-server.main.runtime.ts",
1171
- "line": 210,
1217
+ "line": 219,
1172
1218
  "character": 5
1173
1219
  },
1174
1220
  "name": "GeneratorMain"
@@ -1177,7 +1223,7 @@
1177
1223
  "__schema": "TypeRefSchema",
1178
1224
  "location": {
1179
1225
  "filePath": "api-server.main.runtime.ts",
1180
- "line": 211,
1226
+ "line": 220,
1181
1227
  "character": 5
1182
1228
  },
1183
1229
  "name": "RemoveMain"
@@ -1186,7 +1232,7 @@
1186
1232
  "__schema": "TypeRefSchema",
1187
1233
  "location": {
1188
1234
  "filePath": "api-server.main.runtime.ts",
1189
- "line": 212,
1235
+ "line": 221,
1190
1236
  "character": 5
1191
1237
  },
1192
1238
  "name": "ConfigMain"
@@ -1201,7 +1247,7 @@
1201
1247
  "__schema": "InferenceTypeSchema",
1202
1248
  "location": {
1203
1249
  "filePath": "api-server.main.runtime.ts",
1204
- "line": 179,
1250
+ "line": 188,
1205
1251
  "character": 3
1206
1252
  },
1207
1253
  "type": "Promise<ApiServerMain>"
@@ -1219,7 +1265,7 @@
1219
1265
  "__schema": "UnImplementedSchema",
1220
1266
  "location": {
1221
1267
  "filePath": "api-server.main.runtime.ts",
1222
- "line": 246,
1268
+ "line": 255,
1223
1269
  "character": 16
1224
1270
  },
1225
1271
  "name": "ApiServerMain",
@@ -1231,7 +1277,7 @@
1231
1277
  "__schema": "UnImplementedSchema",
1232
1278
  "location": {
1233
1279
  "filePath": "api-server.main.runtime.ts",
1234
- "line": 244,
1280
+ "line": 253,
1235
1281
  "character": 1
1236
1282
  },
1237
1283
  "name": "ApiServerAspect.addRuntime(ApiServerMain);",
@@ -1280,7 +1326,7 @@
1280
1326
  "componentId": {
1281
1327
  "scope": "teambit.harmony",
1282
1328
  "name": "api-server",
1283
- "version": "1.0.375"
1329
+ "version": "1.0.377"
1284
1330
  },
1285
1331
  "taggedModuleExports": []
1286
1332
  }
@@ -27,6 +27,7 @@ export declare class ApiServerMain {
27
27
  compile: boolean;
28
28
  }): Promise<unknown>;
29
29
  writeUsedPort(port: number): void;
30
+ getRandomPort(): Promise<number>;
30
31
  getExistingUsedPort(): Promise<number | undefined>;
31
32
  private getServerPortFilePath;
32
33
  static dependencies: import("@teambit/harmony").Aspect[];
@@ -11,6 +11,13 @@ function _cli() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _toolboxNetwork() {
15
+ const data = require("@teambit/toolbox.network.get-port");
16
+ _toolboxNetwork = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _fsExtra() {
15
22
  const data = _interopRequireDefault(require("fs-extra"));
16
23
  _fsExtra = function () {
@@ -247,7 +254,7 @@ class ApiServerMain {
247
254
  // don't throw an error, we don't want to break the "run" process
248
255
  this.logger.error('watcher found an error', err);
249
256
  });
250
- const port = options.port || 3000;
257
+ const port = options.port || (await this.getRandomPort());
251
258
  const app = this.express.createApp();
252
259
  app.use(
253
260
  // @ts-ignore todo: it's not clear what's the issue.
@@ -290,6 +297,13 @@ class ApiServerMain {
290
297
  const filePath = this.getServerPortFilePath();
291
298
  _fsExtra().default.writeFileSync(filePath, port.toString());
292
299
  }
300
+ async getRandomPort() {
301
+ const startingPort = 3593; // some arbitrary number shy away from the standard 3000
302
+ // get random number in the range of [startingPort, 55500].
303
+ const randomNumber = Math.floor(Math.random() * (55500 - startingPort + 1) + startingPort);
304
+ const port = await _toolboxNetwork().Port.getPort(randomNumber, 65500);
305
+ return port;
306
+ }
293
307
  async getExistingUsedPort() {
294
308
  const filePath = this.getServerPortFilePath();
295
309
  try {
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_fsExtra","_interopRequireDefault","_express","_logger","_lanes","_remove","_snapping","_generator","_componentCompare","_componentLog","_watcher","_config","_export","_checkout","_install","_importer","_workspace","_harmonyModules","_cors","_httpProxyMiddleware","_apiServer","_cli2","_server","_ide","_apiForIde","_sseEvents","_path","_cliRaw","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ApiServerMain","constructor","workspace","logger","express","watcher","installer","importer","runApiServer","options","Error","process","cwd","registerOnComponentChange","component","files","removedFiles","sendEventsToClients","id","toStringWithoutVersion","registerOnBitmapChange","lastModifiedTimestamp","bitMap","getLastModifiedBitmapThroughBit","secondsPassedSinceLastModified","Date","now","debug","importCurrentObjects","registerOnWorkspaceConfigChange","registerPostInstall","watch","preCompile","compile","catch","err","error","port","app","createApp","use","cors","origin","callback","credentials","createProxyMiddleware","target","changeOrigin","on","req","res","writeHead","end","proxyReq","fixRequestBody","server","listen","Promise","resolve","reject","consoleSuccess","writeUsedPort","filePath","getServerPortFilePath","fs","writeFileSync","toString","getExistingUsedPort","fileContent","readFile","parseInt","code","undefined","join","scope","path","provider","cli","loggerMain","snapping","lanes","exporter","checkout","componentLog","componentCompare","generator","remove","config","createLogger","ApiServerAspect","apiServer","register","ServerCmd","apiForIDE","APIForIDE","cliRoute","CLIRoute","cliRawRoute","CLIRawRoute","ideRoute","IDERoute","sseEventsRoute","SSEEventsRoute","exports","CLIAspect","WorkspaceAspect","LoggerAspect","ExpressAspect","WatcherAspect","SnappingAspect","LanesAspect","InstallAspect","ExportAspect","CheckoutAspect","ComponentLogAspect","ImporterAspect","ComponentCompareAspect","GeneratorAspect","RemoveAspect","ConfigAspect","MainRuntime","addRuntime","_default"],"sources":["api-server.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport fs from 'fs-extra';\nimport { ExpressAspect, ExpressMain } from '@teambit/express';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { LanesAspect, LanesMain } from '@teambit/lanes';\nimport { RemoveAspect, RemoveMain } from '@teambit/remove';\nimport { SnappingAspect, SnappingMain } from '@teambit/snapping';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { ComponentCompareAspect, ComponentCompareMain } from '@teambit/component-compare';\nimport { ComponentLogAspect, ComponentLogMain } from '@teambit/component-log';\nimport { WatcherAspect, WatcherMain } from '@teambit/watcher';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport { ExportAspect, ExportMain } from '@teambit/export';\nimport { CheckoutAspect, CheckoutMain } from '@teambit/checkout';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { Component } from '@teambit/component';\nimport { WorkspaceAspect, Workspace } from '@teambit/workspace';\nimport { sendEventsToClients } from '@teambit/harmony.modules.send-server-sent-events';\nimport cors from 'cors';\nimport { createProxyMiddleware, fixRequestBody } from 'http-proxy-middleware';\nimport { ApiServerAspect } from './api-server.aspect';\nimport { CLIRoute } from './cli.route';\nimport { ServerCmd } from './server.cmd';\nimport { IDERoute } from './ide.route';\nimport { APIForIDE } from './api-for-ide';\nimport { SSEEventsRoute } from './sse-events.route';\nimport { join } from 'path';\nimport { CLIRawRoute } from './cli-raw.route';\n\nexport class ApiServerMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private express: ExpressMain,\n private watcher: WatcherMain,\n private installer: InstallMain,\n private importer: ImporterMain\n ) {}\n\n async runApiServer(options: { port: number; compile: boolean }) {\n if (!this.workspace) {\n throw new Error(`unable to run bit-server, the current directory ${process.cwd()} is not a workspace`);\n }\n\n this.workspace.registerOnComponentChange(\n async (\n component: Component,\n files: string[], // os absolute paths\n removedFiles?: string[] // os absolute paths\n ) => {\n sendEventsToClients('onComponentChange', {\n id: component.id.toStringWithoutVersion(),\n files,\n removedFiles,\n });\n }\n );\n\n this.workspace.registerOnBitmapChange(async () => {\n const lastModifiedTimestamp = await this.workspace.bitMap.getLastModifiedBitmapThroughBit();\n const secondsPassedSinceLastModified = lastModifiedTimestamp && (Date.now() - lastModifiedTimestamp) / 1000;\n if (secondsPassedSinceLastModified && secondsPassedSinceLastModified > 1) {\n // changes by bit were done more than a second ago, so probably this .bitmap change was done by \"git pull\"\n this.logger.debug(\n `running import because we assume the .bitmap file has changed due to \"git pull\", last time it was modified by bit was ${secondsPassedSinceLastModified} seconds ago`\n );\n await this.importer.importCurrentObjects();\n }\n sendEventsToClients('onBitmapChange', {});\n });\n\n this.workspace.registerOnWorkspaceConfigChange(async () => {\n sendEventsToClients('onWorkspaceConfigChange', {});\n });\n\n this.installer.registerPostInstall(async () => {\n sendEventsToClients('onPostInstall', {});\n });\n\n this.watcher\n .watch({\n preCompile: false,\n compile: options.compile,\n })\n .catch((err) => {\n // don't throw an error, we don't want to break the \"run\" process\n this.logger.error('watcher found an error', err);\n });\n\n const port = options.port || 3000;\n\n const app = this.express.createApp();\n\n app.use(\n // @ts-ignore todo: it's not clear what's the issue.\n cors({\n origin(origin, callback) {\n callback(null, true);\n },\n credentials: true,\n })\n );\n app.use(\n '/api/cloud-graphql',\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n createProxyMiddleware({\n target: 'https://api.main.lanes.bit.cloud/graphql',\n changeOrigin: true,\n on: {\n error: (err, req, res) => {\n this.logger.error('graphql cloud proxy error', err);\n // @ts-ignore\n res.writeHead(500, {\n 'Content-Type': 'text/plain',\n });\n res.end('Something went wrong with the proxy server of bit cloud graphql');\n },\n proxyReq: fixRequestBody,\n },\n })\n );\n\n const server = await app.listen(port);\n\n return new Promise((resolve, reject) => {\n server.on('error', (err) => {\n reject(err);\n });\n server.on('listening', () => {\n this.logger.consoleSuccess(`Bit Server is listening on port ${port}`);\n this.writeUsedPort(port);\n resolve(port);\n });\n });\n }\n\n writeUsedPort(port: number) {\n const filePath = this.getServerPortFilePath();\n fs.writeFileSync(filePath, port.toString());\n }\n\n async getExistingUsedPort(): Promise<number | undefined> {\n const filePath = this.getServerPortFilePath();\n try {\n const fileContent = await fs.readFile(filePath, 'utf8');\n return parseInt(fileContent, 10);\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n return undefined;\n }\n throw err;\n }\n }\n\n private getServerPortFilePath() {\n return join(this.workspace.scope.path, 'server-port.txt');\n }\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n LoggerAspect,\n ExpressAspect,\n WatcherAspect,\n SnappingAspect,\n LanesAspect,\n InstallAspect,\n ExportAspect,\n CheckoutAspect,\n ComponentLogAspect,\n ImporterAspect,\n ComponentCompareAspect,\n GeneratorAspect,\n RemoveAspect,\n ConfigAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n loggerMain,\n express,\n watcher,\n snapping,\n lanes,\n installer,\n exporter,\n checkout,\n componentLog,\n importer,\n componentCompare,\n generator,\n remove,\n config,\n ]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ExpressMain,\n WatcherMain,\n SnappingMain,\n LanesMain,\n InstallMain,\n ExportMain,\n CheckoutMain,\n ComponentLogMain,\n ImporterMain,\n ComponentCompareMain,\n GeneratorMain,\n RemoveMain,\n ConfigMain\n ]) {\n const logger = loggerMain.createLogger(ApiServerAspect.id);\n const apiServer = new ApiServerMain(workspace, logger, express, watcher, installer, importer);\n cli.register(new ServerCmd(apiServer));\n\n const apiForIDE = new APIForIDE(\n workspace,\n snapping,\n lanes,\n installer,\n exporter,\n checkout,\n componentLog,\n componentCompare,\n generator,\n remove,\n config\n );\n const cliRoute = new CLIRoute(logger, cli, apiForIDE);\n const cliRawRoute = new CLIRawRoute(logger, cli, apiForIDE);\n const ideRoute = new IDERoute(logger, apiForIDE);\n const sseEventsRoute = new SSEEventsRoute(logger, cli);\n // register only when the workspace is available. don't register this on a remote-scope, for security reasons.\n if (workspace) {\n express.register([cliRoute, cliRawRoute, ideRoute, sseEventsRoute]);\n }\n\n return apiServer;\n }\n}\n\nApiServerAspect.addRuntime(ApiServerMain);\n\nexport default ApiServerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;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AACnG,MAAM,EAAE0E,GAAG,CAAC;IACtD;IACA,IAAI3E,SAAS,EAAE;MACbE,OAAO,CAACuF,QAAQ,CAAC,CAACI,QAAQ,EAAEE,WAAW,EAAEE,QAAQ,EAAEE,cAAc,CAAC,CAAC;IACrE;IAEA,OAAOX,SAAS;EAClB;AACF;AAACa,OAAA,CAAAvG,aAAA,GAAAA,aAAA;AAAAlB,eAAA,CAnNYkB,aAAa,kBAiIF,CACpBwG,gBAAS,EACTC,4BAAe,EACfC,sBAAY,EACZC,wBAAa,EACbC,wBAAa,EACbC,0BAAc,EACdC,oBAAW,EACXC,wBAAa,EACbC,sBAAY,EACZC,0BAAc,EACdC,kCAAkB,EAClBC,0BAAc,EACdC,0CAAsB,EACtBC,4BAAe,EACfC,sBAAY,EACZC,sBAAY,CACb;AAAAzI,eAAA,CAlJUkB,aAAa,aAmJPwH,kBAAW;AAkE9B/B,4BAAe,CAACgC,UAAU,CAACzH,aAAa,CAAC;AAAC,IAAA0H,QAAA,GAAAnB,OAAA,CAAA1H,OAAA,GAE3BmB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_toolboxNetwork","_fsExtra","_interopRequireDefault","_express","_logger","_lanes","_remove","_snapping","_generator","_componentCompare","_componentLog","_watcher","_config","_export","_checkout","_install","_importer","_workspace","_harmonyModules","_cors","_httpProxyMiddleware","_apiServer","_cli2","_server","_ide","_apiForIde","_sseEvents","_path","_cliRaw","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ApiServerMain","constructor","workspace","logger","express","watcher","installer","importer","runApiServer","options","Error","process","cwd","registerOnComponentChange","component","files","removedFiles","sendEventsToClients","id","toStringWithoutVersion","registerOnBitmapChange","lastModifiedTimestamp","bitMap","getLastModifiedBitmapThroughBit","secondsPassedSinceLastModified","Date","now","debug","importCurrentObjects","registerOnWorkspaceConfigChange","registerPostInstall","watch","preCompile","compile","catch","err","error","port","getRandomPort","app","createApp","use","cors","origin","callback","credentials","createProxyMiddleware","target","changeOrigin","on","req","res","writeHead","end","proxyReq","fixRequestBody","server","listen","Promise","resolve","reject","consoleSuccess","writeUsedPort","filePath","getServerPortFilePath","fs","writeFileSync","toString","startingPort","randomNumber","Math","floor","random","Port","getPort","getExistingUsedPort","fileContent","readFile","parseInt","code","undefined","join","scope","path","provider","cli","loggerMain","snapping","lanes","exporter","checkout","componentLog","componentCompare","generator","remove","config","createLogger","ApiServerAspect","apiServer","register","ServerCmd","apiForIDE","APIForIDE","cliRoute","CLIRoute","cliRawRoute","CLIRawRoute","ideRoute","IDERoute","sseEventsRoute","SSEEventsRoute","exports","CLIAspect","WorkspaceAspect","LoggerAspect","ExpressAspect","WatcherAspect","SnappingAspect","LanesAspect","InstallAspect","ExportAspect","CheckoutAspect","ComponentLogAspect","ImporterAspect","ComponentCompareAspect","GeneratorAspect","RemoveAspect","ConfigAspect","MainRuntime","addRuntime","_default"],"sources":["api-server.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport fs from 'fs-extra';\nimport { ExpressAspect, ExpressMain } from '@teambit/express';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { LanesAspect, LanesMain } from '@teambit/lanes';\nimport { RemoveAspect, RemoveMain } from '@teambit/remove';\nimport { SnappingAspect, SnappingMain } from '@teambit/snapping';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { ComponentCompareAspect, ComponentCompareMain } from '@teambit/component-compare';\nimport { ComponentLogAspect, ComponentLogMain } from '@teambit/component-log';\nimport { WatcherAspect, WatcherMain } from '@teambit/watcher';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport { ExportAspect, ExportMain } from '@teambit/export';\nimport { CheckoutAspect, CheckoutMain } from '@teambit/checkout';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { Component } from '@teambit/component';\nimport { WorkspaceAspect, Workspace } from '@teambit/workspace';\nimport { sendEventsToClients } from '@teambit/harmony.modules.send-server-sent-events';\nimport cors from 'cors';\nimport { createProxyMiddleware, fixRequestBody } from 'http-proxy-middleware';\nimport { ApiServerAspect } from './api-server.aspect';\nimport { CLIRoute } from './cli.route';\nimport { ServerCmd } from './server.cmd';\nimport { IDERoute } from './ide.route';\nimport { APIForIDE } from './api-for-ide';\nimport { SSEEventsRoute } from './sse-events.route';\nimport { join } from 'path';\nimport { CLIRawRoute } from './cli-raw.route';\n\nexport class ApiServerMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private express: ExpressMain,\n private watcher: WatcherMain,\n private installer: InstallMain,\n private importer: ImporterMain\n ) {}\n\n async runApiServer(options: { port: number; compile: boolean }) {\n if (!this.workspace) {\n throw new Error(`unable to run bit-server, the current directory ${process.cwd()} is not a workspace`);\n }\n\n this.workspace.registerOnComponentChange(\n async (\n component: Component,\n files: string[], // os absolute paths\n removedFiles?: string[] // os absolute paths\n ) => {\n sendEventsToClients('onComponentChange', {\n id: component.id.toStringWithoutVersion(),\n files,\n removedFiles,\n });\n }\n );\n\n this.workspace.registerOnBitmapChange(async () => {\n const lastModifiedTimestamp = await this.workspace.bitMap.getLastModifiedBitmapThroughBit();\n const secondsPassedSinceLastModified = lastModifiedTimestamp && (Date.now() - lastModifiedTimestamp) / 1000;\n if (secondsPassedSinceLastModified && secondsPassedSinceLastModified > 1) {\n // changes by bit were done more than a second ago, so probably this .bitmap change was done by \"git pull\"\n this.logger.debug(\n `running import because we assume the .bitmap file has changed due to \"git pull\", last time it was modified by bit was ${secondsPassedSinceLastModified} seconds ago`\n );\n await this.importer.importCurrentObjects();\n }\n sendEventsToClients('onBitmapChange', {});\n });\n\n this.workspace.registerOnWorkspaceConfigChange(async () => {\n sendEventsToClients('onWorkspaceConfigChange', {});\n });\n\n this.installer.registerPostInstall(async () => {\n sendEventsToClients('onPostInstall', {});\n });\n\n this.watcher\n .watch({\n preCompile: false,\n compile: options.compile,\n })\n .catch((err) => {\n // don't throw an error, we don't want to break the \"run\" process\n this.logger.error('watcher found an error', err);\n });\n\n const port = options.port || (await this.getRandomPort());\n\n const app = this.express.createApp();\n\n app.use(\n // @ts-ignore todo: it's not clear what's the issue.\n cors({\n origin(origin, callback) {\n callback(null, true);\n },\n credentials: true,\n })\n );\n app.use(\n '/api/cloud-graphql',\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n createProxyMiddleware({\n target: 'https://api.main.lanes.bit.cloud/graphql',\n changeOrigin: true,\n on: {\n error: (err, req, res) => {\n this.logger.error('graphql cloud proxy error', err);\n // @ts-ignore\n res.writeHead(500, {\n 'Content-Type': 'text/plain',\n });\n res.end('Something went wrong with the proxy server of bit cloud graphql');\n },\n proxyReq: fixRequestBody,\n },\n })\n );\n\n const server = await app.listen(port);\n\n return new Promise((resolve, reject) => {\n server.on('error', (err) => {\n reject(err);\n });\n server.on('listening', () => {\n this.logger.consoleSuccess(`Bit Server is listening on port ${port}`);\n this.writeUsedPort(port);\n resolve(port);\n });\n });\n }\n\n writeUsedPort(port: number) {\n const filePath = this.getServerPortFilePath();\n fs.writeFileSync(filePath, port.toString());\n }\n\n async getRandomPort() {\n const startingPort = 3593; // some arbitrary number shy away from the standard 3000\n // get random number in the range of [startingPort, 55500].\n const randomNumber = Math.floor(Math.random() * (55500 - startingPort + 1) + startingPort);\n const port = await Port.getPort(randomNumber, 65500);\n return port;\n }\n\n async getExistingUsedPort(): Promise<number | undefined> {\n const filePath = this.getServerPortFilePath();\n try {\n const fileContent = await fs.readFile(filePath, 'utf8');\n return parseInt(fileContent, 10);\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n return undefined;\n }\n throw err;\n }\n }\n\n private getServerPortFilePath() {\n return join(this.workspace.scope.path, 'server-port.txt');\n }\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n LoggerAspect,\n ExpressAspect,\n WatcherAspect,\n SnappingAspect,\n LanesAspect,\n InstallAspect,\n ExportAspect,\n CheckoutAspect,\n ComponentLogAspect,\n ImporterAspect,\n ComponentCompareAspect,\n GeneratorAspect,\n RemoveAspect,\n ConfigAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n loggerMain,\n express,\n watcher,\n snapping,\n lanes,\n installer,\n exporter,\n checkout,\n componentLog,\n importer,\n componentCompare,\n generator,\n remove,\n config,\n ]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ExpressMain,\n WatcherMain,\n SnappingMain,\n LanesMain,\n InstallMain,\n ExportMain,\n CheckoutMain,\n ComponentLogMain,\n ImporterMain,\n ComponentCompareMain,\n GeneratorMain,\n RemoveMain,\n ConfigMain\n ]) {\n const logger = loggerMain.createLogger(ApiServerAspect.id);\n const apiServer = new ApiServerMain(workspace, logger, express, watcher, installer, importer);\n cli.register(new ServerCmd(apiServer));\n\n const apiForIDE = new APIForIDE(\n workspace,\n snapping,\n lanes,\n installer,\n exporter,\n checkout,\n componentLog,\n componentCompare,\n generator,\n remove,\n config\n );\n const cliRoute = new CLIRoute(logger, cli, apiForIDE);\n const cliRawRoute = new CLIRawRoute(logger, cli, apiForIDE);\n const ideRoute = new IDERoute(logger, apiForIDE);\n const sseEventsRoute = new SSEEventsRoute(logger, cli);\n // register only when the workspace is available. don't register this on a remote-scope, for security reasons.\n if (workspace) {\n express.register([cliRoute, cliRawRoute, ideRoute, sseEventsRoute]);\n }\n\n return apiServer;\n }\n}\n\nApiServerAspect.addRuntime(ApiServerMain);\n\nexport default ApiServerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAA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AAlB,eAAA,CA3NYkB,aAAa,kBAyIF,CACpBgH,gBAAS,EACTC,4BAAe,EACfC,sBAAY,EACZC,wBAAa,EACbC,wBAAa,EACbC,0BAAc,EACdC,oBAAW,EACXC,wBAAa,EACbC,sBAAY,EACZC,0BAAc,EACdC,kCAAkB,EAClBC,0BAAc,EACdC,0CAAsB,EACtBC,4BAAe,EACfC,sBAAY,EACZC,sBAAY,CACb;AAAAjJ,eAAA,CA1JUkB,aAAa,aA2JPgI,kBAAW;AAkE9B/B,4BAAe,CAACgC,UAAU,CAACjI,aAAa,CAAC;AAAC,IAAAkI,QAAA,GAAAnB,OAAA,CAAAlI,OAAA,GAE3BmB,aAAa","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/api-server",
3
- "version": "1.0.375",
3
+ "version": "1.0.377",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/api-server",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "api-server",
9
- "version": "1.0.375"
9
+ "version": "1.0.377"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
@@ -18,26 +18,27 @@
18
18
  "pretty-time": "1.1.0",
19
19
  "@teambit/lane-id": "0.0.311",
20
20
  "@teambit/harmony": "0.4.6",
21
- "@teambit/checkout": "1.0.375",
22
- "@teambit/component-compare": "1.0.375",
23
- "@teambit/component-log": "1.0.375",
24
- "@teambit/config": "0.0.1126",
25
- "@teambit/export": "1.0.375",
26
- "@teambit/generator": "1.0.376",
27
- "@teambit/install": "1.0.375",
28
- "@teambit/lanes": "1.0.375",
21
+ "@teambit/checkout": "1.0.377",
22
+ "@teambit/component-compare": "1.0.377",
23
+ "@teambit/component-log": "1.0.377",
24
+ "@teambit/config": "0.0.1128",
25
+ "@teambit/export": "1.0.377",
26
+ "@teambit/generator": "1.0.378",
27
+ "@teambit/install": "1.0.377",
28
+ "@teambit/lanes": "1.0.377",
29
29
  "@teambit/legacy.utils": "0.0.4",
30
- "@teambit/merging": "1.0.375",
31
- "@teambit/remove": "1.0.375",
32
- "@teambit/snapping": "1.0.375",
33
- "@teambit/workspace": "1.0.375",
34
- "@teambit/cli": "0.0.952",
35
- "@teambit/component": "1.0.375",
36
- "@teambit/express": "0.0.1051",
30
+ "@teambit/merging": "1.0.377",
31
+ "@teambit/remove": "1.0.377",
32
+ "@teambit/snapping": "1.0.377",
33
+ "@teambit/workspace": "1.0.377",
34
+ "@teambit/cli": "0.0.954",
35
+ "@teambit/component": "1.0.377",
36
+ "@teambit/express": "0.0.1053",
37
37
  "@teambit/harmony.modules.send-server-sent-events": "0.0.2",
38
- "@teambit/importer": "1.0.375",
39
- "@teambit/logger": "0.0.1045",
40
- "@teambit/watcher": "1.0.375",
38
+ "@teambit/importer": "1.0.377",
39
+ "@teambit/logger": "0.0.1047",
40
+ "@teambit/toolbox.network.get-port": "1.0.6",
41
+ "@teambit/watcher": "1.0.377",
41
42
  "@teambit/harmony.modules.feature-toggle": "0.0.5"
42
43
  },
43
44
  "devDependencies": {