@backstage/plugin-events-backend-module-bitbucket-cloud 0.1.21 → 0.2.0-next.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.
- package/CHANGELOG.md +75 -5
- 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/{BitbucketCloudEventRouter-1cf134a1.cjs.js → BitbucketCloudEventRouter-b6db4ab2.cjs.js} +9 -3
- package/dist/cjs/BitbucketCloudEventRouter-b6db4ab2.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/BitbucketCloudEventRouter-1cf134a1.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,82 @@
|
|
|
1
1
|
# @backstage/plugin-events-backend-module-bitbucket-cloud
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.2.0-next.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
- eff3ca9: BREAKING CHANGE: Migrate `EventRouter` implementations from `EventBroker` to `EventsService`.
|
|
8
|
+
|
|
9
|
+
`EventRouter` uses the new `EventsService` instead of the `EventBroker` now,
|
|
10
|
+
causing a breaking change to its signature.
|
|
11
|
+
|
|
12
|
+
All of its extensions and implementations got adjusted accordingly.
|
|
13
|
+
(`SubTopicEventRouter`, `AzureDevOpsEventRouter`, `BitbucketCloudEventRouter`,
|
|
14
|
+
`GerritEventRouter`, `GithubEventRouter`, `GitlabEventRouter`)
|
|
15
|
+
|
|
16
|
+
Required adjustments were made to all backend modules for the new backend system,
|
|
17
|
+
now also making use of the `eventsServiceRef` instead of the `eventsExtensionPoint`.
|
|
18
|
+
|
|
19
|
+
**Migration:**
|
|
20
|
+
|
|
21
|
+
Example for implementations of `SubTopicEventRouter`:
|
|
22
|
+
|
|
23
|
+
```diff
|
|
24
|
+
import {
|
|
25
|
+
EventParams,
|
|
26
|
+
+ EventsService,
|
|
27
|
+
SubTopicEventRouter,
|
|
28
|
+
} from '@backstage/plugin-events-node';
|
|
29
|
+
|
|
30
|
+
export class GithubEventRouter extends SubTopicEventRouter {
|
|
31
|
+
- constructor() {
|
|
32
|
+
- super('github');
|
|
33
|
+
+ constructor(options: { events: EventsService }) {
|
|
34
|
+
+ super({
|
|
35
|
+
+ events: options.events,
|
|
36
|
+
+ topic: 'github',
|
|
37
|
+
+ });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
+ protected getSubscriberId(): string {
|
|
41
|
+
+ return 'GithubEventRouter';
|
|
42
|
+
+ }
|
|
43
|
+
+
|
|
44
|
+
// ...
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Example for a direct extension of `EventRouter`:
|
|
49
|
+
|
|
50
|
+
```diff
|
|
51
|
+
class MyEventRouter extends EventRouter {
|
|
52
|
+
- constructor(/* ... */) {
|
|
53
|
+
+ constructor(options: {
|
|
54
|
+
+ events: EventsService;
|
|
55
|
+
+ // ...
|
|
56
|
+
+ }) {
|
|
57
|
+
- super();
|
|
58
|
+
// ...
|
|
59
|
+
+ super({
|
|
60
|
+
+ events: options.events,
|
|
61
|
+
+ topics: topics,
|
|
62
|
+
+ });
|
|
63
|
+
}
|
|
64
|
+
+
|
|
65
|
+
+ protected getSubscriberId(): string {
|
|
66
|
+
+ return 'MyEventRouter';
|
|
67
|
+
+ }
|
|
68
|
+
-
|
|
69
|
+
- supportsEventTopics(): string[] {
|
|
70
|
+
- return this.topics;
|
|
71
|
+
- }
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies
|
|
78
|
+
- @backstage/plugin-events-node@0.3.0-next.0
|
|
79
|
+
- @backstage/backend-plugin-api@0.6.13-next.0
|
|
10
80
|
|
|
11
81
|
## 0.1.20
|
|
12
82
|
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# events-backend-module-bitbucket-cloud
|
|
2
2
|
|
|
3
|
-
Welcome to the `events-backend-module-bitbucket-cloud` backend
|
|
3
|
+
Welcome to the `events-backend-module-bitbucket-cloud` 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 `BitbucketCloudEventRouter`.
|
|
7
7
|
|
|
8
8
|
The event router will subscribe to the topic `bitbucketCloud`
|
|
9
9
|
and route the events to more concrete topics based on the value
|
|
@@ -22,32 +22,24 @@ Please find all possible webhook event types at the
|
|
|
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-bitbucket-cloud
|
|
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(
|
|
38
33
|
import('@backstage/plugin-events-backend-module-bitbucket-cloud/alpha'),
|
|
39
34
|
);
|
|
40
35
|
```
|
|
41
36
|
|
|
42
|
-
###
|
|
43
|
-
|
|
44
|
-
Add the event router to the `EventsBackend` instance in `packages/backend/src/plugins/events.ts`:
|
|
45
|
-
|
|
46
|
-
```diff
|
|
47
|
-
+const bitbucketCloudEventRouter = new BitbucketCloudEventRouter();
|
|
37
|
+
### Legacy Backend System
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
```ts
|
|
40
|
+
// packages/backend/src/plugins/events.ts
|
|
41
|
+
const eventRouter = new BitbucketCloudEventRouter({
|
|
42
|
+
events: env.events,
|
|
43
|
+
});
|
|
44
|
+
await eventRouter.subscribe();
|
|
53
45
|
```
|
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 BitbucketCloudEventRouter = require('./cjs/BitbucketCloudEventRouter-
|
|
8
|
-
require('@backstage/plugin-events-node');
|
|
6
|
+
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
7
|
+
var BitbucketCloudEventRouter = require('./cjs/BitbucketCloudEventRouter-b6db4ab2.cjs.js');
|
|
9
8
|
|
|
10
9
|
const eventsModuleBitbucketCloudEventRouter = backendPluginApi.createBackendModule({
|
|
11
10
|
pluginId: "events",
|
|
@@ -13,12 +12,13 @@ const eventsModuleBitbucketCloudEventRouter = backendPluginApi.createBackendModu
|
|
|
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 BitbucketCloudEventRouter.BitbucketCloudEventRouter(
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const eventRouter = new BitbucketCloudEventRouter.BitbucketCloudEventRouter({
|
|
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/eventsModuleBitbucketCloudEventRouter.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/eventsModuleBitbucketCloudEventRouter.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 { BitbucketCloudEventRouter } from '../router/BitbucketCloudEventRouter';\n\n/**\n * Module for the events-backend plugin, adding an event router for Bitbucket Cloud.\n *\n * Registers the `BitbucketCloudEventRouter`.\n *\n * @alpha\n */\nexport const eventsModuleBitbucketCloudEventRouter = createBackendModule({\n pluginId: 'events',\n moduleId: 'bitbucket-cloud-event-router',\n register(env) {\n env.registerInit({\n deps: {\n events: eventsServiceRef,\n },\n async init({ events }) {\n const eventRouter = new BitbucketCloudEventRouter({\n events,\n });\n await eventRouter.subscribe();\n },\n });\n },\n});\n"],"names":["createBackendModule","eventsServiceRef","BitbucketCloudEventRouter"],"mappings":";;;;;;;;AA2BO,MAAM,wCAAwCA,oCAAoB,CAAA;AAAA,EACvE,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,8BAAA;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,mDAA0B,CAAA;AAAA,UAChD,MAAA;AAAA,SACD,CAAA,CAAA;AACD,QAAA,MAAM,YAAY,SAAU,EAAA,CAAA;AAAA,OAC9B;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;"}
|
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
4
4
|
|
|
5
5
|
class BitbucketCloudEventRouter extends pluginEventsNode.SubTopicEventRouter {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({
|
|
8
|
+
events: options.events,
|
|
9
|
+
topic: "bitbucketCloud"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
getSubscriberId() {
|
|
13
|
+
return "BitbucketCloudEventRouter";
|
|
8
14
|
}
|
|
9
15
|
determineSubTopic(params) {
|
|
10
16
|
var _a;
|
|
@@ -13,4 +19,4 @@ class BitbucketCloudEventRouter extends pluginEventsNode.SubTopicEventRouter {
|
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
exports.BitbucketCloudEventRouter = BitbucketCloudEventRouter;
|
|
16
|
-
//# sourceMappingURL=BitbucketCloudEventRouter-
|
|
22
|
+
//# sourceMappingURL=BitbucketCloudEventRouter-b6db4ab2.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitbucketCloudEventRouter-b6db4ab2.cjs.js","sources":["../../src/router/BitbucketCloudEventRouter.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 `bitbucketCloud` topic\n * and publishes the events under the more concrete sub-topic\n * depending on the `x-event-key` provided.\n *\n * @public\n */\nexport class BitbucketCloudEventRouter extends SubTopicEventRouter {\n constructor(options: { events: EventsService }) {\n super({\n events: options.events,\n topic: 'bitbucketCloud',\n });\n }\n\n protected getSubscriberId(): string {\n return 'BitbucketCloudEventRouter';\n }\n\n protected determineSubTopic(params: EventParams): string | undefined {\n return params.metadata?.['x-event-key'] as string | undefined;\n }\n}\n"],"names":["SubTopicEventRouter"],"mappings":";;;;AA6BO,MAAM,kCAAkCA,oCAAoB,CAAA;AAAA,EACjE,YAAY,OAAoC,EAAA;AAC9C,IAAM,KAAA,CAAA;AAAA,MACJ,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,KAAO,EAAA,gBAAA;AAAA,KACR,CAAA,CAAA;AAAA,GACH;AAAA,EAEU,eAA0B,GAAA;AAClC,IAAO,OAAA,2BAAA,CAAA;AAAA,GACT;AAAA,EAEU,kBAAkB,MAAyC,EAAA;AAzCvE,IAAA,IAAA,EAAA,CAAA;AA0CI,IAAO,OAAA,CAAA,EAAA,GAAA,MAAA,CAAO,aAAP,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,aAAA,CAAA,CAAA;AAAA,GAC3B;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 BitbucketCloudEventRouter = require('./cjs/BitbucketCloudEventRouter-
|
|
5
|
+
var BitbucketCloudEventRouter = require('./cjs/BitbucketCloudEventRouter-b6db4ab2.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 `bitbucketCloud` topic
|
|
@@ -8,7 +8,10 @@ import { SubTopicEventRouter, EventParams } from '@backstage/plugin-events-node'
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
declare class BitbucketCloudEventRouter 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-bitbucket-cloud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-next.0",
|
|
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.13-next.0",
|
|
43
|
+
"@backstage/plugin-events-node": "^0.3.0-next.0"
|
|
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.3-next.0",
|
|
47
|
+
"@backstage/cli": "^0.25.3-next.0",
|
|
48
|
+
"@backstage/plugin-events-backend-test-utils": "^0.1.23-next.0"
|
|
50
49
|
},
|
|
51
50
|
"files": [
|
|
52
51
|
"dist",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitbucketCloudEventRouter-1cf134a1.cjs.js","sources":["../../src/router/BitbucketCloudEventRouter.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 `bitbucketCloud` topic\n * and publishes the events under the more concrete sub-topic\n * depending on the `x-event-key` provided.\n *\n * @public\n */\nexport class BitbucketCloudEventRouter extends SubTopicEventRouter {\n constructor() {\n super('bitbucketCloud');\n }\n\n protected determineSubTopic(params: EventParams): string | undefined {\n return params.metadata?.['x-event-key'] as string | undefined;\n }\n}\n"],"names":["SubTopicEventRouter"],"mappings":";;;;AA4BO,MAAM,kCAAkCA,oCAAoB,CAAA;AAAA,EACjE,WAAc,GAAA;AACZ,IAAA,KAAA,CAAM,gBAAgB,CAAA,CAAA;AAAA,GACxB;AAAA,EAEU,kBAAkB,MAAyC,EAAA;AAjCvE,IAAA,IAAA,EAAA,CAAA;AAkCI,IAAO,OAAA,CAAA,EAAA,GAAA,MAAA,CAAO,aAAP,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,aAAA,CAAA,CAAA;AAAA,GAC3B;AACF;;;;"}
|