@backstage/plugin-catalog-backend-module-incremental-ingestion 0.1.2 → 0.2.0-next.1

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,16 +1,40 @@
1
1
  # @backstage/plugin-catalog-backend-module-incremental-ingestion
2
2
 
3
- ## 0.1.2
3
+ ## 0.2.0-next.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - b7e36660d5: Return `EventSubscriber` from `addIncrementalEntityProvider` to hook up to `EventsBackend`
7
8
  - Updated dependencies
8
- - @backstage/backend-common@0.18.1
9
- - @backstage/backend-test-utils@0.1.33
10
- - @backstage/backend-tasks@0.4.2
11
- - @backstage/plugin-catalog-backend@1.7.1
12
- - @backstage/plugin-catalog-node@1.3.2
13
- - @backstage/backend-plugin-api@0.3.1
9
+ - @backstage/plugin-catalog-backend@1.7.2-next.1
10
+ - @backstage/backend-common@0.18.2-next.1
11
+ - @backstage/backend-plugin-api@0.3.2-next.1
12
+ - @backstage/backend-tasks@0.4.3-next.1
13
+ - @backstage/backend-test-utils@0.1.34-next.1
14
+ - @backstage/catalog-model@1.1.6-next.0
15
+ - @backstage/config@1.0.6
16
+ - @backstage/errors@1.1.4
17
+ - @backstage/plugin-catalog-node@1.3.3-next.1
18
+ - @backstage/plugin-events-node@0.2.3-next.1
19
+ - @backstage/plugin-permission-common@0.7.3
20
+
21
+ ## 0.2.0-next.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 1ba120faa3: Added new mechanism to handle deltas in incremental providers
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+ - @backstage/catalog-model@1.1.6-next.0
31
+ - @backstage/backend-test-utils@0.1.34-next.0
32
+ - @backstage/backend-common@0.18.2-next.0
33
+ - @backstage/plugin-catalog-backend@1.7.2-next.0
34
+ - @backstage/plugin-catalog-node@1.3.3-next.0
35
+ - @backstage/backend-tasks@0.4.3-next.0
36
+ - @backstage/backend-plugin-api@0.3.2-next.0
37
+ - @backstage/plugin-events-node@0.2.3-next.0
14
38
 
15
39
  ## 0.1.1
16
40
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-incremental-ingestion",
3
- "version": "0.1.2",
3
+ "version": "0.2.0-next.1",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -11,6 +11,8 @@ import { CatalogBuilder } from '@backstage/plugin-catalog-backend';
11
11
  import type { Config } from '@backstage/config';
12
12
  import type { DeferredEntity } from '@backstage/plugin-catalog-backend';
13
13
  import type { DurationObjectUnits } from 'luxon';
14
+ import { EventParams } from '@backstage/plugin-events-node';
15
+ import { EventSubscriber } from '@backstage/plugin-events-node';
14
16
  import type { Logger } from 'winston';
15
17
  import type { PermissionEvaluator } from '@backstage/plugin-permission-common';
16
18
  import type { PluginDatabaseManager } from '@backstage/backend-common';
@@ -52,7 +54,7 @@ export declare class IncrementalCatalogBuilder {
52
54
  build(): Promise<{
53
55
  incrementalAdminRouter: Router;
54
56
  }>;
55
- addIncrementalEntityProvider<TCursor, TContext>(provider: IncrementalEntityProvider<TCursor, TContext>, options: IncrementalEntityProviderOptions): void;
57
+ addIncrementalEntityProvider<TCursor, TContext>(provider: IncrementalEntityProvider<TCursor, TContext>, options: IncrementalEntityProviderOptions): EventSubscriber;
56
58
  }
57
59
 
58
60
  /**
@@ -93,6 +95,35 @@ export declare interface IncrementalEntityProvider<TCursor, TContext> {
93
95
  * @param burst - a function which performs a series of iterations
94
96
  */
95
97
  around(burst: (context: TContext) => Promise<void>): Promise<void>;
98
+ /**
99
+ * If set, the IncrementalEntityProvider will receive and respond to
100
+ * events.
101
+ *
102
+ * This system acts as a wrapper for the Backstage events bus, and
103
+ * requires the events backend to function. It does not provide its
104
+ * own events backend. See {@link https://github.com/backstage/backstage/tree/master/plugins/events-backend}.
105
+ */
106
+ eventHandler?: {
107
+ /**
108
+ * This method accepts an incoming event for the provider, and
109
+ * optionally maps the payload to an object containing a delta
110
+ * mutation.
111
+ *
112
+ * If a valid delta is returned by this method, it will be ingested
113
+ * automatically by the provider.
114
+ */
115
+ onEvent: (params: EventParams) => undefined | {
116
+ added: DeferredEntity[];
117
+ removed: {
118
+ entityRef: string;
119
+ }[];
120
+ };
121
+ /**
122
+ * This method returns an array of topics for the IncrementalEntityProvider
123
+ * to respond to.
124
+ */
125
+ supportsEventTopics: () => string[];
126
+ };
96
127
  }
97
128
 
98
129
  /** @public */
@@ -11,6 +11,8 @@ import { CatalogBuilder } from '@backstage/plugin-catalog-backend';
11
11
  import type { Config } from '@backstage/config';
12
12
  import type { DeferredEntity } from '@backstage/plugin-catalog-backend';
13
13
  import type { DurationObjectUnits } from 'luxon';
14
+ import { EventParams } from '@backstage/plugin-events-node';
15
+ import { EventSubscriber } from '@backstage/plugin-events-node';
14
16
  import type { Logger } from 'winston';
15
17
  import type { PermissionEvaluator } from '@backstage/plugin-permission-common';
16
18
  import type { PluginDatabaseManager } from '@backstage/backend-common';
@@ -52,7 +54,7 @@ export declare class IncrementalCatalogBuilder {
52
54
  build(): Promise<{
53
55
  incrementalAdminRouter: Router;
54
56
  }>;
55
- addIncrementalEntityProvider<TCursor, TContext>(provider: IncrementalEntityProvider<TCursor, TContext>, options: IncrementalEntityProviderOptions): void;
57
+ addIncrementalEntityProvider<TCursor, TContext>(provider: IncrementalEntityProvider<TCursor, TContext>, options: IncrementalEntityProviderOptions): EventSubscriber;
56
58
  }
57
59
 
58
60
  /**
@@ -93,6 +95,35 @@ export declare interface IncrementalEntityProvider<TCursor, TContext> {
93
95
  * @param burst - a function which performs a series of iterations
94
96
  */
95
97
  around(burst: (context: TContext) => Promise<void>): Promise<void>;
98
+ /**
99
+ * If set, the IncrementalEntityProvider will receive and respond to
100
+ * events.
101
+ *
102
+ * This system acts as a wrapper for the Backstage events bus, and
103
+ * requires the events backend to function. It does not provide its
104
+ * own events backend. See {@link https://github.com/backstage/backstage/tree/master/plugins/events-backend}.
105
+ */
106
+ eventHandler?: {
107
+ /**
108
+ * This method accepts an incoming event for the provider, and
109
+ * optionally maps the payload to an object containing a delta
110
+ * mutation.
111
+ *
112
+ * If a valid delta is returned by this method, it will be ingested
113
+ * automatically by the provider.
114
+ */
115
+ onEvent: (params: EventParams) => undefined | {
116
+ added: DeferredEntity[];
117
+ removed: {
118
+ entityRef: string;
119
+ }[];
120
+ };
121
+ /**
122
+ * This method returns an array of topics for the IncrementalEntityProvider
123
+ * to respond to.
124
+ */
125
+ supportsEventTopics: () => string[];
126
+ };
96
127
  }
97
128
 
98
129
  /** @public */