@red-hat-developer-hub/backstage-plugin-bulk-import-backend 6.2.0 → 6.4.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 (56) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +28 -0
  3. package/config.d.ts +9 -1
  4. package/dist/catalog/catalogHttpClient.cjs.js +3 -0
  5. package/dist/catalog/catalogHttpClient.cjs.js.map +1 -1
  6. package/dist/catalog/catalogInfoGenerator.cjs.js +1 -0
  7. package/dist/catalog/catalogInfoGenerator.cjs.js.map +1 -1
  8. package/dist/database/migration.cjs.js +20 -0
  9. package/dist/database/migration.cjs.js.map +1 -0
  10. package/dist/database/repositoryDao.cjs.js +117 -0
  11. package/dist/database/repositoryDao.cjs.js.map +1 -0
  12. package/dist/generated/openapidocument.cjs.js +366 -38
  13. package/dist/generated/openapidocument.cjs.js.map +1 -1
  14. package/dist/github/githubApiService.cjs.js +222 -95
  15. package/dist/github/githubApiService.cjs.js.map +1 -1
  16. package/dist/github/utils/orgUtils.cjs.js +2 -0
  17. package/dist/github/utils/orgUtils.cjs.js.map +1 -1
  18. package/dist/github/utils/prUtils.cjs.js +3 -0
  19. package/dist/github/utils/prUtils.cjs.js.map +1 -1
  20. package/dist/github/utils/repoUtils.cjs.js +1 -38
  21. package/dist/github/utils/repoUtils.cjs.js.map +1 -1
  22. package/dist/github/utils/utils.cjs.js +29 -18
  23. package/dist/github/utils/utils.cjs.js.map +1 -1
  24. package/dist/gitlab/GitlabAppManager.cjs.js +54 -0
  25. package/dist/gitlab/GitlabAppManager.cjs.js.map +1 -0
  26. package/dist/gitlab/gitlabApiService.cjs.js +660 -0
  27. package/dist/gitlab/gitlabApiService.cjs.js.map +1 -0
  28. package/dist/gitlab/utils/glUtils.cjs.js +15 -0
  29. package/dist/gitlab/utils/glUtils.cjs.js.map +1 -0
  30. package/dist/gitlab/utils/orgUtils.cjs.js +72 -0
  31. package/dist/gitlab/utils/orgUtils.cjs.js.map +1 -0
  32. package/dist/gitlab/utils/prUtils.cjs.js +73 -0
  33. package/dist/gitlab/utils/prUtils.cjs.js.map +1 -0
  34. package/dist/gitlab/utils/repoUtils.cjs.js +200 -0
  35. package/dist/gitlab/utils/repoUtils.cjs.js.map +1 -0
  36. package/dist/gitlab/utils/utils.cjs.js +131 -0
  37. package/dist/gitlab/utils/utils.cjs.js.map +1 -0
  38. package/dist/helpers/utils.cjs.js +58 -0
  39. package/dist/helpers/utils.cjs.js.map +1 -1
  40. package/dist/index.d.ts +2 -1
  41. package/dist/plugin.cjs.js +6 -3
  42. package/dist/plugin.cjs.js.map +1 -1
  43. package/dist/service/handlers/import/bulkImports.cjs.js +216 -34
  44. package/dist/service/handlers/import/bulkImports.cjs.js.map +1 -1
  45. package/dist/service/handlers/import/execute-template.cjs.js +264 -0
  46. package/dist/service/handlers/import/execute-template.cjs.js.map +1 -0
  47. package/dist/service/handlers/import/importStatus.cjs.js +5 -8
  48. package/dist/service/handlers/import/importStatus.cjs.js.map +1 -1
  49. package/dist/service/handlers/organization/organizations.cjs.js +2 -2
  50. package/dist/service/handlers/organization/organizations.cjs.js.map +1 -1
  51. package/dist/service/handlers/repository/repositories.cjs.js +5 -2
  52. package/dist/service/handlers/repository/repositories.cjs.js.map +1 -1
  53. package/dist/service/router.cjs.js +199 -34
  54. package/dist/service/router.cjs.js.map +1 -1
  55. package/migrations/20250808122501_migrations.js +53 -0
  56. package/package.json +17 -11
@@ -84,6 +84,9 @@ const OPENAPI = `
84
84
  },
85
85
  {
86
86
  "$ref": "#/components/parameters/searchQueryParam"
87
+ },
88
+ {
89
+ "$ref": "#/components/parameters/approvalToolParam"
87
90
  }
88
91
  ],
89
92
  "responses": {
@@ -159,6 +162,9 @@ const OPENAPI = `
159
162
  },
160
163
  {
161
164
  "$ref": "#/components/parameters/searchQueryParam"
165
+ },
166
+ {
167
+ "$ref": "#/components/parameters/approvalToolParam"
162
168
  }
163
169
  ],
164
170
  "responses": {
@@ -225,6 +231,9 @@ const OPENAPI = `
225
231
  },
226
232
  {
227
233
  "$ref": "#/components/parameters/searchQueryParam"
234
+ },
235
+ {
236
+ "$ref": "#/components/parameters/approvalToolParam"
228
237
  }
229
238
  ],
230
239
  "responses": {
@@ -297,6 +306,9 @@ const OPENAPI = `
297
306
  },
298
307
  {
299
308
  "$ref": "#/components/parameters/searchQueryParam"
309
+ },
310
+ {
311
+ "$ref": "#/components/parameters/approvalToolParam"
300
312
  }
301
313
  ],
302
314
  "responses": {
@@ -416,6 +428,223 @@ const OPENAPI = `
416
428
  }
417
429
  }
418
430
  },
431
+ "/task-imports": {
432
+ "get": {
433
+ "operationId": "findAllTaskImports",
434
+ "summary": "Fetch Import Jobs",
435
+ "security": [
436
+ {
437
+ "BearerAuth": []
438
+ }
439
+ ],
440
+ "tags": [
441
+ "Import"
442
+ ],
443
+ "parameters": [
444
+ {
445
+ "$ref": "#/components/parameters/apiVersionHeaderParam"
446
+ },
447
+ {
448
+ "$ref": "#/components/parameters/pagePerIntegrationQueryParamDeprecated"
449
+ },
450
+ {
451
+ "$ref": "#/components/parameters/sizePerIntegrationQueryParamDeprecated"
452
+ },
453
+ {
454
+ "$ref": "#/components/parameters/pageQueryParam"
455
+ },
456
+ {
457
+ "$ref": "#/components/parameters/sizeQueryParam"
458
+ },
459
+ {
460
+ "$ref": "#/components/parameters/sortOrderQueryParam"
461
+ },
462
+ {
463
+ "$ref": "#/components/parameters/sortColumnQueryParam"
464
+ },
465
+ {
466
+ "$ref": "#/components/parameters/searchQueryParam"
467
+ }
468
+ ],
469
+ "responses": {
470
+ "200": {
471
+ "description": "Import Job list was fetched successfully with no errors",
472
+ "content": {
473
+ "application/json": {
474
+ "schema": {
475
+ "oneOf": [
476
+ {
477
+ "type": "array",
478
+ "items": {
479
+ "$ref": "#/components/schemas/SourceImport"
480
+ }
481
+ },
482
+ {
483
+ "$ref": "#/components/schemas/ImportJobListV2"
484
+ }
485
+ ]
486
+ },
487
+ "examples": {
488
+ "twoImports": {
489
+ "$ref": "#/components/examples/twoImports"
490
+ },
491
+ "multipleImportJobsV2": {
492
+ "$ref": "#/components/examples/multipleImportJobsV2"
493
+ }
494
+ }
495
+ }
496
+ }
497
+ },
498
+ "500": {
499
+ "description": "Generic error when there are errors and no Import Job is returned",
500
+ "content": {
501
+ "application/json": {
502
+ "schema": {
503
+ "oneOf": [
504
+ {
505
+ "type": "string",
506
+ "description": "Generic error"
507
+ },
508
+ {
509
+ "$ref": "#/components/schemas/ImportJobListV2"
510
+ }
511
+ ]
512
+ },
513
+ "examples": {
514
+ "repositoryListErrors": {
515
+ "$ref": "#/components/examples/importJobListErrors"
516
+ }
517
+ }
518
+ }
519
+ }
520
+ }
521
+ }
522
+ },
523
+ "post": {
524
+ "operationId": "createTaskImportJobs",
525
+ "summary": "Execute a scaffolder template for a list of repositories",
526
+ "security": [
527
+ {
528
+ "BearerAuth": []
529
+ }
530
+ ],
531
+ "tags": [
532
+ "Import"
533
+ ],
534
+ "requestBody": {
535
+ "description": "The template to execute and the repositories to run it against.",
536
+ "required": true,
537
+ "content": {
538
+ "application/json": {
539
+ "schema": {
540
+ "type": "array",
541
+ "items": {
542
+ "$ref": "#/components/schemas/ImportRequest"
543
+ }
544
+ }
545
+ }
546
+ }
547
+ },
548
+ "responses": {
549
+ "202": {
550
+ "description": "Import Jobs request was submitted successfully to the API. Check the status in each item of the response body list to see their individual status.",
551
+ "content": {
552
+ "application/json": {
553
+ "schema": {
554
+ "type": "array",
555
+ "items": {
556
+ "$ref": "#/components/schemas/Import"
557
+ }
558
+ }
559
+ }
560
+ }
561
+ }
562
+ }
563
+ }
564
+ },
565
+ "/task-import/by-repo": {
566
+ "get": {
567
+ "operationId": "findTaskImportStatusByRepo",
568
+ "summary": "Get Import Status by repository",
569
+ "security": [
570
+ {
571
+ "BearerAuth": []
572
+ }
573
+ ],
574
+ "tags": [
575
+ "Import"
576
+ ],
577
+ "parameters": [
578
+ {
579
+ "in": "query",
580
+ "name": "repo",
581
+ "description": "the full URL to the repo",
582
+ "schema": {
583
+ "type": "string"
584
+ }
585
+ },
586
+ {
587
+ "in": "query",
588
+ "name": "defaultBranch",
589
+ "description": "the name of the default branch",
590
+ "schema": {
591
+ "type": "string",
592
+ "default": "main"
593
+ }
594
+ }
595
+ ],
596
+ "responses": {
597
+ "200": {
598
+ "description": "Import Job status was determined successfully with no errors",
599
+ "content": {
600
+ "application/json": {
601
+ "schema": {
602
+ "$ref": "#/components/schemas/Import"
603
+ },
604
+ "examples": {
605
+ "singleImportStatusForRepo": {
606
+ "$ref": "#/components/examples/singleImportStatusForRepo"
607
+ }
608
+ }
609
+ }
610
+ }
611
+ },
612
+ "500": {
613
+ "description": "Generic error"
614
+ }
615
+ }
616
+ },
617
+ "delete": {
618
+ "operationId": "deleteTaskImportByRepo",
619
+ "summary": "Delete stored scaffolder task records for a specific repository",
620
+ "security": [
621
+ {
622
+ "BearerAuth": []
623
+ }
624
+ ],
625
+ "tags": [
626
+ "Import"
627
+ ],
628
+ "parameters": [
629
+ {
630
+ "in": "query",
631
+ "name": "repo",
632
+ "description": "the full URL to the repo",
633
+ "schema": {
634
+ "type": "string"
635
+ }
636
+ }
637
+ ],
638
+ "responses": {
639
+ "204": {
640
+ "description": "Repository was deleted successfully with no errors"
641
+ },
642
+ "500": {
643
+ "description": "Generic error"
644
+ }
645
+ }
646
+ }
647
+ },
419
648
  "/import/by-repo": {
420
649
  "get": {
421
650
  "operationId": "findImportStatusByRepo",
@@ -445,6 +674,9 @@ const OPENAPI = `
445
674
  "type": "string",
446
675
  "default": "main"
447
676
  }
677
+ },
678
+ {
679
+ "$ref": "#/components/parameters/approvalToolParam"
448
680
  }
449
681
  ],
450
682
  "responses": {
@@ -496,6 +728,9 @@ const OPENAPI = `
496
728
  "type": "string",
497
729
  "default": "main"
498
730
  }
731
+ },
732
+ {
733
+ "$ref": "#/components/parameters/approvalToolParam"
499
734
  }
500
735
  ],
501
736
  "responses": {
@@ -617,6 +852,15 @@ const OPENAPI = `
617
852
  "type": "integer",
618
853
  "default": 20
619
854
  }
855
+ },
856
+ "approvalToolParam": {
857
+ "in": "query",
858
+ "name": "approvalTool",
859
+ "description": "the approvalTool to use",
860
+ "schema": {
861
+ "type": "string",
862
+ "default": "GIT"
863
+ }
620
864
  }
621
865
  },
622
866
  "schemas": {
@@ -727,7 +971,14 @@ const OPENAPI = `
727
971
  "description": "organization which the repository is part of"
728
972
  },
729
973
  "importStatus": {
730
- "$ref": "#/components/schemas/ImportStatus"
974
+ "oneOf": [
975
+ {
976
+ "$ref": "#/components/schemas/ImportStatus"
977
+ },
978
+ {
979
+ "$ref": "#/components/schemas/TaskImportStatus"
980
+ }
981
+ ]
731
982
  },
732
983
  "defaultBranch": {
733
984
  "type": "string",
@@ -749,7 +1000,22 @@ const OPENAPI = `
749
1000
  "type": "string",
750
1001
  "enum": [
751
1002
  "GIT",
752
- "SERVICENOW"
1003
+ "SERVICENOW",
1004
+ "GITLAB"
1005
+ ]
1006
+ },
1007
+ "TaskImportStatus": {
1008
+ "type": "string",
1009
+ "nullable": true,
1010
+ "description": "Import Job status",
1011
+ "enum": [
1012
+ "TASK_CANCELLED",
1013
+ "TASK_COMPLETED",
1014
+ "TASK_FAILED",
1015
+ "TASK_OPEN",
1016
+ "TASK_PROCESSING",
1017
+ "TASK_SKIPPED",
1018
+ "TASK_FETCH_FAILED"
753
1019
  ]
754
1020
  },
755
1021
  "ImportStatus": {
@@ -798,7 +1064,33 @@ const OPENAPI = `
798
1064
  "type": "string"
799
1065
  },
800
1066
  "status": {
801
- "$ref": "#/components/schemas/ImportStatus"
1067
+ "oneOf": [
1068
+ {
1069
+ "$ref": "#/components/schemas/ImportStatus"
1070
+ },
1071
+ {
1072
+ "$ref": "#/components/schemas/TaskImportStatus"
1073
+ }
1074
+ ]
1075
+ },
1076
+ "task": {
1077
+ "type": "object",
1078
+ "properties": {
1079
+ "taskId": {
1080
+ "type": "string"
1081
+ }
1082
+ }
1083
+ },
1084
+ "tasks": {
1085
+ "type": "array",
1086
+ "items": {
1087
+ "type": "object",
1088
+ "properties": {
1089
+ "taskId": {
1090
+ "type": "string"
1091
+ }
1092
+ }
1093
+ }
802
1094
  },
803
1095
  "catalogEntityName": {
804
1096
  "type": "string",
@@ -820,39 +1112,59 @@ const OPENAPI = `
820
1112
  "repository": {
821
1113
  "$ref": "#/components/schemas/Repository"
822
1114
  },
1115
+ "gitlab": {
1116
+ "type": "object",
1117
+ "description": "GitLab details. Applicable if approvalTool is gitlab.",
1118
+ "properties": {
1119
+ "pullRequest": {
1120
+ "$ref": "#/components/schemas/PullRequest"
1121
+ }
1122
+ }
1123
+ },
823
1124
  "github": {
824
1125
  "type": "object",
825
1126
  "description": "GitHub details. Applicable if approvalTool is git.",
826
1127
  "properties": {
827
1128
  "pullRequest": {
828
- "type": "object",
829
- "properties": {
830
- "url": {
831
- "type": "string",
832
- "description": "URL of the Pull Request"
833
- },
834
- "number": {
835
- "type": "number",
836
- "description": "Pull Request number"
837
- },
838
- "title": {
839
- "type": "string",
840
- "description": "title of the Pull Request"
841
- },
842
- "body": {
843
- "type": "string",
844
- "description": "body of the Pull Request"
845
- },
846
- "catalogInfoContent": {
847
- "type": "string",
848
- "description": "content of the catalog-info.yaml as fetched from the Pull Request."
849
- }
850
- }
1129
+ "$ref": "#/components/schemas/PullRequest"
851
1130
  }
852
1131
  }
853
1132
  }
854
1133
  }
855
1134
  },
1135
+ "PullRequest": {
1136
+ "type": "object",
1137
+ "properties": {
1138
+ "url": {
1139
+ "type": "string",
1140
+ "description": "URL of the Pull Request"
1141
+ },
1142
+ "number": {
1143
+ "type": "number",
1144
+ "description": "Pull Request number"
1145
+ },
1146
+ "title": {
1147
+ "type": "string",
1148
+ "description": "title of the Pull Request"
1149
+ },
1150
+ "body": {
1151
+ "type": "string",
1152
+ "description": "body of the Pull Request"
1153
+ },
1154
+ "catalogInfoContent": {
1155
+ "type": "string",
1156
+ "description": "content of the catalog-info.yaml as fetched from the Pull Request."
1157
+ },
1158
+ "status": {
1159
+ "type": "string",
1160
+ "enum": [
1161
+ "WAIT_PR_APPROVAL",
1162
+ "PR_MERGED",
1163
+ "PR_ERROR"
1164
+ ]
1165
+ }
1166
+ }
1167
+ },
856
1168
  "SourceImport": {
857
1169
  "title": "Import Job with source it originates from",
858
1170
  "allOf": [
@@ -926,27 +1238,43 @@ const OPENAPI = `
926
1238
  "type": "string",
927
1239
  "description": "content of the catalog-info.yaml to include in the import Pull Request."
928
1240
  },
1241
+ "gitlab": {
1242
+ "type": "object",
1243
+ "description": "GitLab details. Applicable if approvalTool is gitlab.",
1244
+ "properties": {
1245
+ "pullRequest": {
1246
+ "$ref": "#/components/schemas/PullRequest"
1247
+ }
1248
+ }
1249
+ },
929
1250
  "github": {
930
1251
  "type": "object",
931
1252
  "description": "GitHub details. Applicable if approvalTool is git.",
932
1253
  "properties": {
933
1254
  "pullRequest": {
934
- "type": "object",
935
- "description": "Pull Request details. Applicable if approvalTool is git.",
936
- "properties": {
937
- "title": {
938
- "type": "string",
939
- "description": "title of the Pull Request"
940
- },
941
- "body": {
942
- "type": "string",
943
- "description": "body of the Pull Request"
944
- }
945
- }
1255
+ "$ref": "#/components/schemas/PullRequest"
946
1256
  }
947
1257
  }
948
1258
  }
949
1259
  }
1260
+ },
1261
+ "ScaffolderTask": {
1262
+ "title": "Scaffolder Task",
1263
+ "type": "object",
1264
+ "properties": {
1265
+ "taskId": {
1266
+ "type": "string"
1267
+ },
1268
+ "repositoryId": {
1269
+ "type": "number"
1270
+ },
1271
+ "locations": {
1272
+ "type": "array",
1273
+ "items": {
1274
+ "type": "string"
1275
+ }
1276
+ }
1277
+ }
950
1278
  }
951
1279
  },
952
1280
  "securitySchemes": {