@backstage/plugin-catalog-backend-module-incremental-ingestion 0.2.2-next.0 → 0.3.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @backstage/plugin-catalog-backend-module-incremental-ingestion
2
2
 
3
+ ## 0.3.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-tasks@0.5.0-next.2
9
+ - @backstage/backend-common@0.18.3-next.2
10
+ - @backstage/backend-plugin-api@0.4.1-next.2
11
+ - @backstage/plugin-catalog-backend@1.8.0-next.2
12
+ - @backstage/plugin-catalog-node@1.3.4-next.2
13
+ - @backstage/plugin-events-node@0.2.4-next.2
14
+ - @backstage/config@1.0.7-next.0
15
+
16
+ ## 0.3.0-next.1
17
+
18
+ ### Minor Changes
19
+
20
+ - a811bd246c4: Added endpoint to get a list of known incremental entity providers
21
+
22
+ ### Patch Changes
23
+
24
+ - 6e612b58577: Move `@backstage/backend-defaults` to `devDependencies`
25
+ - Updated dependencies
26
+ - @backstage/errors@1.1.5-next.0
27
+ - @backstage/backend-common@0.18.3-next.1
28
+ - @backstage/plugin-catalog-backend@1.8.0-next.1
29
+ - @backstage/plugin-permission-common@0.7.4-next.0
30
+ - @backstage/backend-plugin-api@0.4.1-next.1
31
+ - @backstage/backend-tasks@0.4.4-next.1
32
+ - @backstage/config@1.0.7-next.0
33
+ - @backstage/catalog-model@1.2.1-next.1
34
+ - @backstage/plugin-catalog-node@1.3.4-next.1
35
+ - @backstage/plugin-events-node@0.2.4-next.1
36
+
3
37
  ## 0.2.2-next.0
4
38
 
5
39
  ### Patch Changes
package/README.md CHANGED
@@ -102,6 +102,7 @@ If you want to manage your incremental entity providers via REST endpoints, the
102
102
  | Method | Path | Description |
103
103
  | ------ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
104
104
  | GET | `/incremental/health` | Checks the health of all incremental providers. Returns array of any unhealthy ones. |
105
+ | GET | `/incremental/providers` | Get a list of all known incremental entity providers |
105
106
  | GET | `/incremental/providers/:provider` | Checks the status of an incremental provider (resting, interstitial, etc). |
106
107
  | POST | `/incremental/providers/:provider/trigger` | Triggers a provider's next action immediately. E.g., if it's currently interstitial, it will trigger the next burst. |
107
108
  | POST | `/incremental/providers/:provider/start` | Stop the current ingestion cycle and start a new one immediately. |
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-incremental-ingestion",
3
- "version": "0.2.2-next.0",
3
+ "version": "0.3.0-next.2",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -819,10 +819,6 @@ class IncrementalIngestionEngine {
819
819
  }
820
820
  }
821
821
 
822
- const PROVIDER_CLEANUP = "/incremental/cleanup";
823
- const PROVIDER_HEALTH = "/incremental/health";
824
- const PROVIDER_BASE_PATH = "/incremental/providers/:provider";
825
-
826
822
  class IncrementalProviderRouter {
827
823
  constructor(manager, logger) {
828
824
  this.manager = manager;
@@ -831,7 +827,7 @@ class IncrementalProviderRouter {
831
827
  async createRouter() {
832
828
  const router = Router__default["default"]();
833
829
  router.use(express__default["default"].json());
834
- router.get(PROVIDER_HEALTH, async (_, res) => {
830
+ router.get("/incremental/health", async (_, res) => {
835
831
  const records = await this.manager.healthcheck();
836
832
  const providers = records.map((record) => record.provider_name);
837
833
  const duplicates = [
@@ -843,11 +839,11 @@ class IncrementalProviderRouter {
843
839
  res.json({ healthy: true });
844
840
  }
845
841
  });
846
- router.post(PROVIDER_CLEANUP, async (_, res) => {
842
+ router.post("/incremental/cleanup", async (_, res) => {
847
843
  const result = await this.manager.cleanupProviders();
848
844
  res.json(result);
849
845
  });
850
- router.get(PROVIDER_BASE_PATH, async (req, res) => {
846
+ router.get("/incremental/providers/:provider", async (req, res) => {
851
847
  const { provider } = req.params;
852
848
  const record = await this.manager.getCurrentIngestionRecord(provider);
853
849
  if (record) {
@@ -880,32 +876,35 @@ class IncrementalProviderRouter {
880
876
  }
881
877
  }
882
878
  });
883
- router.post(`${PROVIDER_BASE_PATH}/trigger`, async (req, res) => {
884
- const { provider } = req.params;
885
- const record = await this.manager.getCurrentIngestionRecord(provider);
886
- if (record) {
887
- await this.manager.triggerNextProviderAction(provider);
888
- res.json({
889
- success: true,
890
- message: `${provider}: Next action triggered.`
891
- });
892
- } else {
893
- const providers = await this.manager.listProviders();
894
- if (providers.includes(provider)) {
895
- this.logger.debug(`${provider} - Ingestion record found`);
879
+ router.post(
880
+ `/incremental/providers/:provider/trigger`,
881
+ async (req, res) => {
882
+ const { provider } = req.params;
883
+ const record = await this.manager.getCurrentIngestionRecord(provider);
884
+ if (record) {
885
+ await this.manager.triggerNextProviderAction(provider);
896
886
  res.json({
897
887
  success: true,
898
- message: "Unable to trigger next action (provider is restarting)"
888
+ message: `${provider}: Next action triggered.`
899
889
  });
900
890
  } else {
901
- res.status(404).json({
902
- success: false,
903
- message: `Provider '${provider}' not found`
904
- });
891
+ const providers = await this.manager.listProviders();
892
+ if (providers.includes(provider)) {
893
+ this.logger.debug(`${provider} - Ingestion record found`);
894
+ res.json({
895
+ success: true,
896
+ message: "Unable to trigger next action (provider is restarting)"
897
+ });
898
+ } else {
899
+ res.status(404).json({
900
+ success: false,
901
+ message: `Provider '${provider}' not found`
902
+ });
903
+ }
905
904
  }
906
905
  }
907
- });
908
- router.post(`${PROVIDER_BASE_PATH}/start`, async (req, res) => {
906
+ );
907
+ router.post(`/incremental/providers/:provider/start`, async (req, res) => {
909
908
  const { provider } = req.params;
910
909
  const record = await this.manager.getCurrentIngestionRecord(provider);
911
910
  if (record) {
@@ -935,7 +934,14 @@ class IncrementalProviderRouter {
935
934
  }
936
935
  }
937
936
  });
938
- router.post(`${PROVIDER_BASE_PATH}/cancel`, async (req, res) => {
937
+ router.get(`/incremental/providers`, async (_req, res) => {
938
+ const providers = await this.manager.listProviders();
939
+ res.json({
940
+ success: true,
941
+ providers
942
+ });
943
+ });
944
+ router.post(`/incremental/providers/:provider/cancel`, async (req, res) => {
939
945
  const { provider } = req.params;
940
946
  const record = await this.manager.getCurrentIngestionRecord(provider);
941
947
  if (record) {
@@ -967,12 +973,12 @@ class IncrementalProviderRouter {
967
973
  }
968
974
  }
969
975
  });
970
- router.delete(PROVIDER_BASE_PATH, async (req, res) => {
976
+ router.delete("/incremental/providers/:provider", async (req, res) => {
971
977
  const { provider } = req.params;
972
978
  const result = await this.manager.purgeAndResetProvider(provider);
973
979
  res.json(result);
974
980
  });
975
- router.get(`${PROVIDER_BASE_PATH}/marks`, async (req, res) => {
981
+ router.get(`/incremental/providers/:provider/marks`, async (req, res) => {
976
982
  const { provider } = req.params;
977
983
  const record = await this.manager.getCurrentIngestionRecord(provider);
978
984
  if (record) {
@@ -999,15 +1005,18 @@ class IncrementalProviderRouter {
999
1005
  }
1000
1006
  }
1001
1007
  });
1002
- router.delete(`${PROVIDER_BASE_PATH}/marks`, async (req, res) => {
1003
- const { provider } = req.params;
1004
- const deletions = await this.manager.clearFinishedIngestions(provider);
1005
- res.json({
1006
- success: true,
1007
- message: `Expired marks for provider '${provider}' removed.`,
1008
- deletions
1009
- });
1010
- });
1008
+ router.delete(
1009
+ `/incremental/providers/:provider/marks`,
1010
+ async (req, res) => {
1011
+ const { provider } = req.params;
1012
+ const deletions = await this.manager.clearFinishedIngestions(provider);
1013
+ res.json({
1014
+ success: true,
1015
+ message: `Expired marks for provider '${provider}' removed.`,
1016
+ deletions
1017
+ });
1018
+ }
1019
+ );
1011
1020
  router.use(backendCommon.errorHandler());
1012
1021
  return router;
1013
1022
  }