@backstage/plugin-events-backend-module-bitbucket-server 0.1.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 +13 -0
- package/README.md +36 -0
- package/dist/index.cjs.js +10 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/router/BitbucketServerEventRouter.cjs.js +21 -0
- package/dist/router/BitbucketServerEventRouter.cjs.js.map +1 -0
- package/dist/service/eventsModuleBitbucketServerEventRouter.cjs.js +26 -0
- package/dist/service/eventsModuleBitbucketServerEventRouter.cjs.js.map +1 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @backstage/plugin-events-backend-module-bitbucket-server
|
|
2
|
+
|
|
3
|
+
## 0.1.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7b3ed9b: Added the ability for the plugin to receive events coming from Bitbucket Server push webhooks. It then performs a delta mutation on the catalog.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/backend-plugin-api@1.2.1
|
|
13
|
+
- @backstage/plugin-events-node@0.4.9
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# events-backend-module-bitbucket-server
|
|
2
|
+
|
|
3
|
+
Welcome to the `events-backend-module-bitbucket-server` backend plugin!
|
|
4
|
+
|
|
5
|
+
This package is a module for the `events-backend` backend plugin
|
|
6
|
+
and extends the event system with an `BitbucketServerEventRouter`.
|
|
7
|
+
|
|
8
|
+
The event router will subscribe to the topic `bitbucketServer`
|
|
9
|
+
and route the events to more concrete topics based on the value
|
|
10
|
+
of the provided `x-event-key` metadata field.
|
|
11
|
+
|
|
12
|
+
Examples:
|
|
13
|
+
|
|
14
|
+
| x-event-key | topic |
|
|
15
|
+
| ------------------- | ----------------------------------- |
|
|
16
|
+
| `repo:refs_changed` | `bitbucketServer.repo:refs_changed` |
|
|
17
|
+
| `repo:modified` | `bitbucketServer.repo:modified` |
|
|
18
|
+
|
|
19
|
+
Please find all possible webhook event types at the
|
|
20
|
+
[official documentation](https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html).
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Install the [`events-backend` plugin](../events-backend/README.md).
|
|
25
|
+
|
|
26
|
+
Install this module:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# From your Backstage root directory
|
|
30
|
+
yarn add --cwd packages/backend @backstage/plugin-events-backend-module-bitbucket-server
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// packages/backend/src/index.ts
|
|
35
|
+
backend.add(import('@backstage/plugin-events-backend-module-bitbucket-server'));
|
|
36
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var eventsModuleBitbucketServerEventRouter = require('./service/eventsModuleBitbucketServerEventRouter.cjs.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.default = eventsModuleBitbucketServerEventRouter.eventsModuleBitbucketServerEventRouter;
|
|
10
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Module for the events-backend plugin, adding an event router for Bitbucket Server.
|
|
5
|
+
*
|
|
6
|
+
* Registers the `BitbucketServerEventRouter`.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
declare const eventsModuleBitbucketServerEventRouter: _backstage_backend_plugin_api.BackendFeature;
|
|
11
|
+
|
|
12
|
+
export { eventsModuleBitbucketServerEventRouter as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
4
|
+
|
|
5
|
+
class BitbucketServerEventRouter extends pluginEventsNode.SubTopicEventRouter {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({
|
|
8
|
+
events: options.events,
|
|
9
|
+
topic: "bitbucketServer"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
getSubscriberId() {
|
|
13
|
+
return "BitbucketServerEventRouter";
|
|
14
|
+
}
|
|
15
|
+
determineSubTopic(params) {
|
|
16
|
+
return params.metadata?.["x-event-key"];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.BitbucketServerEventRouter = BitbucketServerEventRouter;
|
|
21
|
+
//# sourceMappingURL=BitbucketServerEventRouter.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitbucketServerEventRouter.cjs.js","sources":["../../src/router/BitbucketServerEventRouter.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 `bitbucketServer` 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 BitbucketServerEventRouter extends SubTopicEventRouter {\n constructor(options: { events: EventsService }) {\n super({\n events: options.events,\n topic: 'bitbucketServer',\n });\n }\n\n protected getSubscriberId(): string {\n return 'BitbucketServerEventRouter';\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,mCAAmCA,oCAAoB,CAAA;AAAA,EAClE,YAAY,OAAoC,EAAA;AAC9C,IAAM,KAAA,CAAA;AAAA,MACJ,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,KAAO,EAAA;AAAA,KACR,CAAA;AAAA;AACH,EAEU,eAA0B,GAAA;AAClC,IAAO,OAAA,4BAAA;AAAA;AACT,EAEU,kBAAkB,MAAyC,EAAA;AACnE,IAAO,OAAA,MAAA,CAAO,WAAW,aAAa,CAAA;AAAA;AAE1C;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
|
+
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
5
|
+
var BitbucketServerEventRouter = require('../router/BitbucketServerEventRouter.cjs.js');
|
|
6
|
+
|
|
7
|
+
const eventsModuleBitbucketServerEventRouter = backendPluginApi.createBackendModule({
|
|
8
|
+
pluginId: "events",
|
|
9
|
+
moduleId: "bitbucket-server-event-router",
|
|
10
|
+
register(env) {
|
|
11
|
+
env.registerInit({
|
|
12
|
+
deps: {
|
|
13
|
+
events: pluginEventsNode.eventsServiceRef
|
|
14
|
+
},
|
|
15
|
+
async init({ events }) {
|
|
16
|
+
const eventRouter = new BitbucketServerEventRouter.BitbucketServerEventRouter({
|
|
17
|
+
events
|
|
18
|
+
});
|
|
19
|
+
await eventRouter.subscribe();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.eventsModuleBitbucketServerEventRouter = eventsModuleBitbucketServerEventRouter;
|
|
26
|
+
//# sourceMappingURL=eventsModuleBitbucketServerEventRouter.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventsModuleBitbucketServerEventRouter.cjs.js","sources":["../../src/service/eventsModuleBitbucketServerEventRouter.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 { BitbucketServerEventRouter } from '../router/BitbucketServerEventRouter';\n\n/**\n * Module for the events-backend plugin, adding an event router for Bitbucket Server.\n *\n * Registers the `BitbucketServerEventRouter`.\n *\n * @public\n */\nexport const eventsModuleBitbucketServerEventRouter = createBackendModule({\n pluginId: 'events',\n moduleId: 'bitbucket-server-event-router',\n register(env) {\n env.registerInit({\n deps: {\n events: eventsServiceRef,\n },\n async init({ events }) {\n const eventRouter = new BitbucketServerEventRouter({\n events,\n });\n await eventRouter.subscribe();\n },\n });\n },\n});\n"],"names":["createBackendModule","eventsServiceRef","BitbucketServerEventRouter"],"mappings":";;;;;;AA2BO,MAAM,yCAAyCA,oCAAoB,CAAA;AAAA,EACxE,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,+BAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAQ,EAAAC;AAAA,OACV;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAU,EAAA;AACrB,QAAM,MAAA,WAAA,GAAc,IAAIC,qDAA2B,CAAA;AAAA,UACjD;AAAA,SACD,CAAA;AACD,QAAA,MAAM,YAAY,SAAU,EAAA;AAAA;AAC9B,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage/plugin-events-backend-module-bitbucket-server",
|
|
3
|
+
"version": "0.1.0-next.0",
|
|
4
|
+
"backstage": {
|
|
5
|
+
"role": "backend-plugin-module",
|
|
6
|
+
"pluginId": "events",
|
|
7
|
+
"pluginPackage": "@backstage/plugin-events-backend",
|
|
8
|
+
"features": {
|
|
9
|
+
".": "@backstage/BackendFeature"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://backstage.io",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/backstage/backstage",
|
|
19
|
+
"directory": "plugins/events-backend-module-bitbucket-server"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"backstage": "@backstage/BackendFeature",
|
|
25
|
+
"require": "./dist/index.cjs.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.cjs.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.cjs.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "backstage-cli package build",
|
|
38
|
+
"clean": "backstage-cli package clean",
|
|
39
|
+
"lint": "backstage-cli package lint",
|
|
40
|
+
"prepack": "backstage-cli package prepack",
|
|
41
|
+
"postpack": "backstage-cli package postpack",
|
|
42
|
+
"start": "backstage-cli package start",
|
|
43
|
+
"test": "backstage-cli package test"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@backstage/backend-plugin-api": "1.2.1",
|
|
47
|
+
"@backstage/plugin-events-node": "0.4.9"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@backstage/backend-test-utils": "1.3.2-next.1",
|
|
51
|
+
"@backstage/cli": "0.32.0-next.1",
|
|
52
|
+
"@backstage/plugin-events-backend-test-utils": "0.1.42"
|
|
53
|
+
}
|
|
54
|
+
}
|