@backstage/plugin-events-backend-module-azure 0.1.23 → 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 +78 -16
- package/README.md +12 -20
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +7 -7
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/cjs/{AzureDevOpsEventRouter-0c5cf09d.cjs.js → AzureDevOpsEventRouter-d0832ee6.cjs.js} +9 -3
- package/dist/cjs/AzureDevOpsEventRouter-d0832ee6.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +5 -2
- package/package.json +6 -7
- package/dist/cjs/AzureDevOpsEventRouter-0c5cf09d.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,90 @@
|
|
|
1
1
|
# @backstage/plugin-events-backend-module-azure
|
|
2
2
|
|
|
3
|
-
## 0.1
|
|
3
|
+
## 0.2.0-next.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Updated dependencies
|
|
8
|
-
- @backstage/backend-plugin-api@0.6.
|
|
9
|
-
- @backstage/plugin-events-node@0.
|
|
8
|
+
- @backstage/backend-plugin-api@0.6.14-next.1
|
|
9
|
+
- @backstage/plugin-events-node@0.3.0-next.1
|
|
10
10
|
|
|
11
|
-
## 0.
|
|
11
|
+
## 0.2.0-next.0
|
|
12
12
|
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
- Updated dependencies
|
|
16
|
-
- @backstage/backend-plugin-api@0.6.12
|
|
17
|
-
- @backstage/plugin-events-node@0.2.21
|
|
18
|
-
|
|
19
|
-
## 0.1.21
|
|
20
|
-
|
|
21
|
-
### Patch Changes
|
|
13
|
+
### Minor Changes
|
|
22
14
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
- eff3ca9: BREAKING CHANGE: Migrate `EventRouter` implementations from `EventBroker` to `EventsService`.
|
|
16
|
+
|
|
17
|
+
`EventRouter` uses the new `EventsService` instead of the `EventBroker` now,
|
|
18
|
+
causing a breaking change to its signature.
|
|
19
|
+
|
|
20
|
+
All of its extensions and implementations got adjusted accordingly.
|
|
21
|
+
(`SubTopicEventRouter`, `AzureDevOpsEventRouter`, `BitbucketCloudEventRouter`,
|
|
22
|
+
`GerritEventRouter`, `GithubEventRouter`, `GitlabEventRouter`)
|
|
23
|
+
|
|
24
|
+
Required adjustments were made to all backend modules for the new backend system,
|
|
25
|
+
now also making use of the `eventsServiceRef` instead of the `eventsExtensionPoint`.
|
|
26
|
+
|
|
27
|
+
**Migration:**
|
|
28
|
+
|
|
29
|
+
Example for implementations of `SubTopicEventRouter`:
|
|
30
|
+
|
|
31
|
+
```diff
|
|
32
|
+
import {
|
|
33
|
+
EventParams,
|
|
34
|
+
+ EventsService,
|
|
35
|
+
SubTopicEventRouter,
|
|
36
|
+
} from '@backstage/plugin-events-node';
|
|
37
|
+
|
|
38
|
+
export class GithubEventRouter extends SubTopicEventRouter {
|
|
39
|
+
- constructor() {
|
|
40
|
+
- super('github');
|
|
41
|
+
+ constructor(options: { events: EventsService }) {
|
|
42
|
+
+ super({
|
|
43
|
+
+ events: options.events,
|
|
44
|
+
+ topic: 'github',
|
|
45
|
+
+ });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
+ protected getSubscriberId(): string {
|
|
49
|
+
+ return 'GithubEventRouter';
|
|
50
|
+
+ }
|
|
51
|
+
+
|
|
52
|
+
// ...
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Example for a direct extension of `EventRouter`:
|
|
57
|
+
|
|
58
|
+
```diff
|
|
59
|
+
class MyEventRouter extends EventRouter {
|
|
60
|
+
- constructor(/* ... */) {
|
|
61
|
+
+ constructor(options: {
|
|
62
|
+
+ events: EventsService;
|
|
63
|
+
+ // ...
|
|
64
|
+
+ }) {
|
|
65
|
+
- super();
|
|
66
|
+
// ...
|
|
67
|
+
+ super({
|
|
68
|
+
+ events: options.events,
|
|
69
|
+
+ topics: topics,
|
|
70
|
+
+ });
|
|
71
|
+
}
|
|
72
|
+
+
|
|
73
|
+
+ protected getSubscriberId(): string {
|
|
74
|
+
+ return 'MyEventRouter';
|
|
75
|
+
+ }
|
|
76
|
+
-
|
|
77
|
+
- supportsEventTopics(): string[] {
|
|
78
|
+
- return this.topics;
|
|
79
|
+
- }
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Updated dependencies
|
|
86
|
+
- @backstage/plugin-events-node@0.3.0-next.0
|
|
87
|
+
- @backstage/backend-plugin-api@0.6.13-next.0
|
|
26
88
|
|
|
27
89
|
## 0.1.20
|
|
28
90
|
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# events-backend-module-azure
|
|
2
2
|
|
|
3
|
-
Welcome to the `events-backend-module-azure` backend
|
|
3
|
+
Welcome to the `events-backend-module-azure` backend module!
|
|
4
4
|
|
|
5
|
-
This
|
|
6
|
-
and extends
|
|
5
|
+
This package is a module for the `events-backend` backend plugin
|
|
6
|
+
and extends the event system with an `AzureDevOpsEventRouter`.
|
|
7
7
|
|
|
8
8
|
The event router will subscribe to the topic `azureDevOps`
|
|
9
9
|
and route the events to more concrete topics based on the value
|
|
@@ -22,30 +22,22 @@ and [webhooks](https://learn.microsoft.com/en-us/azure/devops/service-hooks/serv
|
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
25
|
-
Install the [`events-backend` plugin](../events-backend/README.md).
|
|
26
|
-
|
|
27
|
-
Install this module:
|
|
28
|
-
|
|
29
25
|
```bash
|
|
30
26
|
# From your Backstage root directory
|
|
31
27
|
yarn --cwd packages/backend add @backstage/plugin-events-backend-module-azure
|
|
32
28
|
```
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```ts title="packages/backend/src/index.ts"
|
|
30
|
+
```ts
|
|
31
|
+
// packages/backend/src/index.ts
|
|
37
32
|
backend.add(import('@backstage/plugin-events-backend-module-azure/alpha'));
|
|
38
33
|
```
|
|
39
34
|
|
|
40
|
-
###
|
|
41
|
-
|
|
42
|
-
Add the event router to the `EventsBackend` instance in `packages/backend/src/plugins/events.ts`:
|
|
43
|
-
|
|
44
|
-
```diff
|
|
45
|
-
+const azureEventRouter = new AzureDevOpsEventRouter();
|
|
35
|
+
### Legacy Backend System
|
|
46
36
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
```ts
|
|
38
|
+
// packages/backend/src/plugins/events.ts
|
|
39
|
+
const eventRouter = new AzureDevOpsEventRouter({
|
|
40
|
+
events: env.events,
|
|
41
|
+
});
|
|
42
|
+
await eventRouter.subscribe();
|
|
51
43
|
```
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
-
var
|
|
7
|
-
var AzureDevOpsEventRouter = require('./cjs/AzureDevOpsEventRouter-
|
|
8
|
-
require('@backstage/plugin-events-node');
|
|
6
|
+
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
7
|
+
var AzureDevOpsEventRouter = require('./cjs/AzureDevOpsEventRouter-d0832ee6.cjs.js');
|
|
9
8
|
|
|
10
9
|
const eventsModuleAzureDevOpsEventRouter = backendPluginApi.createBackendModule({
|
|
11
10
|
pluginId: "events",
|
|
@@ -13,12 +12,13 @@ const eventsModuleAzureDevOpsEventRouter = backendPluginApi.createBackendModule(
|
|
|
13
12
|
register(env) {
|
|
14
13
|
env.registerInit({
|
|
15
14
|
deps: {
|
|
16
|
-
events:
|
|
15
|
+
events: pluginEventsNode.eventsServiceRef
|
|
17
16
|
},
|
|
18
17
|
async init({ events }) {
|
|
19
|
-
const eventRouter = new AzureDevOpsEventRouter.AzureDevOpsEventRouter(
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const eventRouter = new AzureDevOpsEventRouter.AzureDevOpsEventRouter({
|
|
19
|
+
events
|
|
20
|
+
});
|
|
21
|
+
await eventRouter.subscribe();
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
}
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/service/eventsModuleAzureDevOpsEventRouter.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport {
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/service/eventsModuleAzureDevOpsEventRouter.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport { AzureDevOpsEventRouter } from '../router/AzureDevOpsEventRouter';\n\n/**\n * Module for the events-backend plugin, adding an event router for Azure DevOps.\n *\n * Registers the `AzureDevOpsEventRouter`.\n *\n * @alpha\n */\nexport const eventsModuleAzureDevOpsEventRouter = createBackendModule({\n pluginId: 'events',\n moduleId: 'azure-dev-ops-event-router',\n register(env) {\n env.registerInit({\n deps: {\n events: eventsServiceRef,\n },\n async init({ events }) {\n const eventRouter = new AzureDevOpsEventRouter({\n events,\n });\n await eventRouter.subscribe();\n },\n });\n },\n});\n"],"names":["createBackendModule","eventsServiceRef","AzureDevOpsEventRouter"],"mappings":";;;;;;;;AA2BO,MAAM,qCAAqCA,oCAAoB,CAAA;AAAA,EACpE,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,4BAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAQ,EAAAC,iCAAA;AAAA,OACV;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAU,EAAA;AACrB,QAAM,MAAA,WAAA,GAAc,IAAIC,6CAAuB,CAAA;AAAA,UAC7C,MAAA;AAAA,SACD,CAAA,CAAA;AACD,QAAA,MAAM,YAAY,SAAU,EAAA,CAAA;AAAA,OAC9B;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;"}
|
package/dist/cjs/{AzureDevOpsEventRouter-0c5cf09d.cjs.js → AzureDevOpsEventRouter-d0832ee6.cjs.js}
RENAMED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
4
4
|
|
|
5
5
|
class AzureDevOpsEventRouter extends pluginEventsNode.SubTopicEventRouter {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({
|
|
8
|
+
events: options.events,
|
|
9
|
+
topic: "azureDevOps"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
getSubscriberId() {
|
|
13
|
+
return "AzureDevOpsEventRouter";
|
|
8
14
|
}
|
|
9
15
|
determineSubTopic(params) {
|
|
10
16
|
if ("eventType" in params.eventPayload) {
|
|
@@ -16,4 +22,4 @@ class AzureDevOpsEventRouter extends pluginEventsNode.SubTopicEventRouter {
|
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
exports.AzureDevOpsEventRouter = AzureDevOpsEventRouter;
|
|
19
|
-
//# sourceMappingURL=AzureDevOpsEventRouter-
|
|
25
|
+
//# sourceMappingURL=AzureDevOpsEventRouter-d0832ee6.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AzureDevOpsEventRouter-d0832ee6.cjs.js","sources":["../../src/router/AzureDevOpsEventRouter.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n EventParams,\n EventsService,\n SubTopicEventRouter,\n} from '@backstage/plugin-events-node';\n\n/**\n * Subscribes to the generic `azureDevOps` topic\n * and publishes the events under the more concrete sub-topic\n * depending on the `$.eventType` provided.\n *\n * @public\n */\nexport class AzureDevOpsEventRouter extends SubTopicEventRouter {\n constructor(options: { events: EventsService }) {\n super({\n events: options.events,\n topic: 'azureDevOps',\n });\n }\n\n protected getSubscriberId(): string {\n return 'AzureDevOpsEventRouter';\n }\n\n protected determineSubTopic(params: EventParams): string | undefined {\n if ('eventType' in (params.eventPayload as object)) {\n const payload = params.eventPayload as { eventType: string };\n return payload.eventType;\n }\n\n return undefined;\n }\n}\n"],"names":["SubTopicEventRouter"],"mappings":";;;;AA6BO,MAAM,+BAA+BA,oCAAoB,CAAA;AAAA,EAC9D,YAAY,OAAoC,EAAA;AAC9C,IAAM,KAAA,CAAA;AAAA,MACJ,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,KAAO,EAAA,aAAA;AAAA,KACR,CAAA,CAAA;AAAA,GACH;AAAA,EAEU,eAA0B,GAAA;AAClC,IAAO,OAAA,wBAAA,CAAA;AAAA,GACT;AAAA,EAEU,kBAAkB,MAAyC,EAAA;AACnE,IAAI,IAAA,WAAA,IAAgB,OAAO,YAAyB,EAAA;AAClD,MAAA,MAAM,UAAU,MAAO,CAAA,YAAA,CAAA;AACvB,MAAA,OAAO,OAAQ,CAAA,SAAA,CAAA;AAAA,KACjB;AAEA,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var AzureDevOpsEventRouter = require('./cjs/AzureDevOpsEventRouter-
|
|
5
|
+
var AzureDevOpsEventRouter = require('./cjs/AzureDevOpsEventRouter-d0832ee6.cjs.js');
|
|
6
6
|
require('@backstage/plugin-events-node');
|
|
7
7
|
|
|
8
8
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SubTopicEventRouter, EventParams } from '@backstage/plugin-events-node';
|
|
1
|
+
import { SubTopicEventRouter, EventsService, EventParams } from '@backstage/plugin-events-node';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Subscribes to the generic `azureDevOps` topic
|
|
@@ -8,7 +8,10 @@ import { SubTopicEventRouter, EventParams } from '@backstage/plugin-events-node'
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
declare class AzureDevOpsEventRouter extends SubTopicEventRouter {
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(options: {
|
|
12
|
+
events: EventsService;
|
|
13
|
+
});
|
|
14
|
+
protected getSubscriberId(): string;
|
|
12
15
|
protected determineSubTopic(params: EventParams): string | undefined;
|
|
13
16
|
}
|
|
14
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-events-backend-module-azure",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.0-next.1",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,14 +39,13 @@
|
|
|
39
39
|
"postpack": "backstage-cli package postpack"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@backstage/backend-plugin-api": "^0.6.
|
|
43
|
-
"@backstage/plugin-events-node": "^0.
|
|
44
|
-
"winston": "^3.2.1"
|
|
42
|
+
"@backstage/backend-plugin-api": "^0.6.14-next.1",
|
|
43
|
+
"@backstage/plugin-events-node": "^0.3.0-next.1"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@backstage/backend-test-utils": "^0.3.
|
|
48
|
-
"@backstage/cli": "^0.25.
|
|
49
|
-
"@backstage/plugin-events-backend-test-utils": "^0.1.
|
|
46
|
+
"@backstage/backend-test-utils": "^0.3.4-next.1",
|
|
47
|
+
"@backstage/cli": "^0.25.3-next.1",
|
|
48
|
+
"@backstage/plugin-events-backend-test-utils": "^0.1.24-next.1"
|
|
50
49
|
},
|
|
51
50
|
"files": [
|
|
52
51
|
"dist",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureDevOpsEventRouter-0c5cf09d.cjs.js","sources":["../../src/router/AzureDevOpsEventRouter.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n EventParams,\n SubTopicEventRouter,\n} from '@backstage/plugin-events-node';\n\n/**\n * Subscribes to the generic `azureDevOps` topic\n * and publishes the events under the more concrete sub-topic\n * depending on the `$.eventType` provided.\n *\n * @public\n */\nexport class AzureDevOpsEventRouter extends SubTopicEventRouter {\n constructor() {\n super('azureDevOps');\n }\n\n protected determineSubTopic(params: EventParams): string | undefined {\n if ('eventType' in (params.eventPayload as object)) {\n const payload = params.eventPayload as { eventType: string };\n return payload.eventType;\n }\n\n return undefined;\n }\n}\n"],"names":["SubTopicEventRouter"],"mappings":";;;;AA4BO,MAAM,+BAA+BA,oCAAoB,CAAA;AAAA,EAC9D,WAAc,GAAA;AACZ,IAAA,KAAA,CAAM,aAAa,CAAA,CAAA;AAAA,GACrB;AAAA,EAEU,kBAAkB,MAAyC,EAAA;AACnE,IAAI,IAAA,WAAA,IAAgB,OAAO,YAAyB,EAAA;AAClD,MAAA,MAAM,UAAU,MAAO,CAAA,YAAA,CAAA;AACvB,MAAA,OAAO,OAAQ,CAAA,SAAA,CAAA;AAAA,KACjB;AAEA,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACF;;;;"}
|