Merge pull request #29598 from backstage/djam/events-backend
refactor: use default exports for gitlab and github event modules
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-events-backend-module-github': minor
|
||||
'@backstage/plugin-events-backend-module-gitlab': minor
|
||||
---
|
||||
|
||||
**BREAKING ALPHA**: Modules from `events-backend-module-github` and `events-backend-module-gitlab` are now exported as `default` instead of being a named export. In addition, they have been moved from `aplha` to `public`.
|
||||
@@ -18,16 +18,12 @@
|
||||
"license": "Apache-2.0",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./alpha": "./src/alpha.ts",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"alpha": [
|
||||
"src/alpha.ts"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
## API Report File for "@backstage/plugin-events-backend-module-github"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @alpha
|
||||
export const eventsModuleGithubEventRouter: BackendFeature;
|
||||
|
||||
// @alpha
|
||||
export const eventsModuleGithubWebhook: BackendFeature;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -3,6 +3,7 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import { EventParams } from '@backstage/plugin-events-node';
|
||||
import { EventsService } from '@backstage/plugin-events-node';
|
||||
@@ -14,6 +15,10 @@ export function createGithubSignatureValidator(
|
||||
config: Config,
|
||||
): RequestValidator;
|
||||
|
||||
// @public (undocumented)
|
||||
const _default: BackendFeature;
|
||||
export default _default;
|
||||
|
||||
// @public
|
||||
export class GithubEventRouter extends SubTopicEventRouter {
|
||||
constructor(options: { events: EventsService });
|
||||
@@ -22,4 +27,6 @@ export class GithubEventRouter extends SubTopicEventRouter {
|
||||
// (undocumented)
|
||||
protected getSubscriberId(): string;
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { eventsModuleGithubEventRouter } from './service/eventsModuleGithubEventRouter';
|
||||
export { eventsModuleGithubWebhook } from './service/eventsModuleGithubWebhook';
|
||||
@@ -20,6 +20,16 @@
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
import { createBackendFeatureLoader } from '@backstage/backend-plugin-api';
|
||||
|
||||
export default createBackendFeatureLoader({
|
||||
loader() {
|
||||
return [
|
||||
import('./service/eventsModuleGithubEventRouter'),
|
||||
import('./service/eventsModuleGithubWebhook'),
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
export { createGithubSignatureValidator } from './http/createGithubSignatureValidator';
|
||||
export { GithubEventRouter } from './router/GithubEventRouter';
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { createServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { startTestBackend } from '@backstage/backend-test-utils';
|
||||
import { TestEventsService } from '@backstage/plugin-events-backend-test-utils';
|
||||
import { eventsServiceRef } from '@backstage/plugin-events-node';
|
||||
import { eventsModuleGithubEventRouter } from './eventsModuleGithubEventRouter';
|
||||
import eventsModuleGithubEventRouter from './eventsModuleGithubEventRouter';
|
||||
|
||||
describe('eventsModuleGithubEventRouter', () => {
|
||||
it('should be correctly wired and set up', async () => {
|
||||
|
||||
@@ -23,9 +23,9 @@ import { GithubEventRouter } from '../router/GithubEventRouter';
|
||||
*
|
||||
* Registers the `GithubEventRouter`.
|
||||
*
|
||||
* @alpha
|
||||
* @public
|
||||
*/
|
||||
export const eventsModuleGithubEventRouter = createBackendModule({
|
||||
export default createBackendModule({
|
||||
pluginId: 'events',
|
||||
moduleId: 'github-event-router',
|
||||
register(env) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
RequestDetails,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { sign } from '@octokit/webhooks-methods';
|
||||
import { eventsModuleGithubWebhook } from './eventsModuleGithubWebhook';
|
||||
import eventsModuleGithubWebhook from './eventsModuleGithubWebhook';
|
||||
|
||||
describe('eventsModuleGithubWebhook', () => {
|
||||
const secret = 'valid-secret';
|
||||
|
||||
@@ -28,7 +28,7 @@ import { createGithubSignatureValidator } from '../http/createGithubSignatureVal
|
||||
*
|
||||
* @alpha
|
||||
*/
|
||||
export const eventsModuleGithubWebhook = createBackendModule({
|
||||
export default createBackendModule({
|
||||
pluginId: 'events',
|
||||
moduleId: 'github-webhook',
|
||||
register(env) {
|
||||
|
||||
@@ -18,16 +18,12 @@
|
||||
"license": "Apache-2.0",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./alpha": "./src/alpha.ts",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"alpha": [
|
||||
"src/alpha.ts"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
## API Report File for "@backstage/plugin-events-backend-module-gitlab"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @alpha
|
||||
export const eventsModuleGitlabEventRouter: BackendFeature;
|
||||
|
||||
// @alpha
|
||||
export const eventsModuleGitlabWebhook: BackendFeature;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -3,6 +3,7 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import { EventParams } from '@backstage/plugin-events-node';
|
||||
import { EventsService } from '@backstage/plugin-events-node';
|
||||
@@ -12,6 +13,10 @@ import { SubTopicEventRouter } from '@backstage/plugin-events-node';
|
||||
// @public
|
||||
export function createGitlabTokenValidator(config: Config): RequestValidator;
|
||||
|
||||
// @public (undocumented)
|
||||
const _default: BackendFeature;
|
||||
export default _default;
|
||||
|
||||
// @public
|
||||
export class GitlabEventRouter extends SubTopicEventRouter {
|
||||
constructor(options: { events: EventsService });
|
||||
@@ -20,4 +25,6 @@ export class GitlabEventRouter extends SubTopicEventRouter {
|
||||
// (undocumented)
|
||||
protected getSubscriberId(): string;
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { eventsModuleGitlabEventRouter } from './service/eventsModuleGitlabEventRouter';
|
||||
export { eventsModuleGitlabWebhook } from './service/eventsModuleGitlabWebhook';
|
||||
@@ -21,5 +21,16 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
import { createBackendFeatureLoader } from '@backstage/backend-plugin-api';
|
||||
|
||||
export default createBackendFeatureLoader({
|
||||
loader() {
|
||||
return [
|
||||
import('./service/eventsModuleGitlabEventRouter'),
|
||||
import('./service/eventsModuleGitlabWebhook'),
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
export { createGitlabTokenValidator } from './http/createGitlabTokenValidator';
|
||||
export { GitlabEventRouter } from './router/GitlabEventRouter';
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { createServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { startTestBackend } from '@backstage/backend-test-utils';
|
||||
import { TestEventsService } from '@backstage/plugin-events-backend-test-utils';
|
||||
import { eventsServiceRef } from '@backstage/plugin-events-node';
|
||||
import { eventsModuleGitlabEventRouter } from './eventsModuleGitlabEventRouter';
|
||||
import eventsModuleGitlabEventRouter from './eventsModuleGitlabEventRouter';
|
||||
|
||||
describe('eventsModuleGitlabEventRouter', () => {
|
||||
it('should be correctly wired and set up', async () => {
|
||||
|
||||
@@ -23,9 +23,9 @@ import { GitlabEventRouter } from '../router/GitlabEventRouter';
|
||||
*
|
||||
* Registers the `GitlabEventRouter`.
|
||||
*
|
||||
* @alpha
|
||||
* @public
|
||||
*/
|
||||
export const eventsModuleGitlabEventRouter = createBackendModule({
|
||||
export default createBackendModule({
|
||||
pluginId: 'events',
|
||||
moduleId: 'gitlab-event-router',
|
||||
register(env) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
HttpPostIngressOptions,
|
||||
RequestDetails,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { eventsModuleGitlabWebhook } from './eventsModuleGitlabWebhook';
|
||||
import eventsModuleGitlabWebhook from './eventsModuleGitlabWebhook';
|
||||
|
||||
describe('gitlabWebhookEventsModule', () => {
|
||||
const requestWithToken = (token?: string) => {
|
||||
|
||||
@@ -28,9 +28,9 @@ import { createGitlabTokenValidator } from '../http/createGitlabTokenValidator';
|
||||
*
|
||||
* Registers the `GitlabEventRouter`.
|
||||
*
|
||||
* @alpha
|
||||
* @public
|
||||
*/
|
||||
export const eventsModuleGitlabWebhook = createBackendModule({
|
||||
export default createBackendModule({
|
||||
pluginId: 'events',
|
||||
moduleId: 'gitlab-webhook',
|
||||
register(env) {
|
||||
|
||||
Reference in New Issue
Block a user