-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kurt King <[email protected]>
- Loading branch information
Showing
10 changed files
with
211 additions
and
2 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
workspaces/announcements/plugins/announcements-common/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
5 changes: 5 additions & 0 deletions
5
workspaces/announcements/plugins/announcements-common/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @backstage-community/plugin-announcements-common | ||
|
||
Welcome to the common package for the announcements plugin! | ||
|
||
_This plugin was created through the Backstage CLI_ |
45 changes: 45 additions & 0 deletions
45
workspaces/announcements/plugins/announcements-common/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "@backstage-community/plugin-announcements-common", | ||
"description": "Common functionalities for the announcements plugin", | ||
"version": "0.1.0", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/backstage/community-plugins", | ||
"directory": "workspaces/announcements/plugins/announcements-common" | ||
}, | ||
"backstage": { | ||
"role": "common-library", | ||
"pluginId": "announcements", | ||
"pluginPackages": [ | ||
"@backstage-community/plugin-announcements-common" | ||
] | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "backstage-cli package build", | ||
"lint": "backstage-cli package lint", | ||
"test": "backstage-cli package test", | ||
"clean": "backstage-cli package clean", | ||
"prepack": "backstage-cli package prepack", | ||
"postpack": "backstage-cli package postpack" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.29.0" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@backstage/plugin-permission-common": "^0.8.2" | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
workspaces/announcements/plugins/announcements-common/src/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2024 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 const EVENTS_TOPIC_ANNOUNCEMENTS = 'announcements'; | ||
|
||
export const EVENTS_ACTION_CREATE_ANNOUNCEMENT = 'create_announcement'; | ||
export const EVENTS_ACTION_UPDATE_ANNOUNCEMENT = 'update_announcement'; | ||
export const EVENTS_ACTION_DELETE_ANNOUNCEMENT = 'delete_announcement'; | ||
|
||
export const EVENTS_ACTION_CREATE_CATEGORY = 'create_category'; | ||
export const EVENTS_ACTION_DELETE_CATEGORY = 'delete_category'; | ||
|
||
export const SIGNALS_CHANNEL_ANNOUNCEMENTS = 'announcements:new'; |
25 changes: 25 additions & 0 deletions
25
workspaces/announcements/plugins/announcements-common/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2024 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. | ||
*/ | ||
|
||
/** | ||
* Common functionalities for the announcements plugin. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
|
||
export * from './constants'; | ||
export * from './permissions'; | ||
export * from './types'; |
37 changes: 37 additions & 0 deletions
37
workspaces/announcements/plugins/announcements-common/src/permissions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2024 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. | ||
*/ | ||
import { createPermission } from '@backstage/plugin-permission-common'; | ||
|
||
export const announcementCreatePermission = createPermission({ | ||
name: 'announcement.entity.create', | ||
attributes: { action: 'create' }, | ||
}); | ||
|
||
export const announcementDeletePermission = createPermission({ | ||
name: 'announcement.entity.delete', | ||
attributes: { action: 'delete' }, | ||
}); | ||
|
||
export const announcementUpdatePermission = createPermission({ | ||
name: 'announcement.entity.update', | ||
attributes: { action: 'update' }, | ||
}); | ||
|
||
export const announcementEntityPermissions = { | ||
announcementCreatePermission, | ||
announcementDeletePermission, | ||
announcementUpdatePermission, | ||
}; |
16 changes: 16 additions & 0 deletions
16
workspaces/announcements/plugins/announcements-common/src/setupTests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright 2024 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 {}; |
47 changes: 47 additions & 0 deletions
47
workspaces/announcements/plugins/announcements-common/src/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2024 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 type Category = { | ||
slug: string; | ||
title: string; | ||
}; | ||
|
||
export type Announcement = { | ||
id: string; | ||
category?: Category; | ||
publisher: string; | ||
title: string; | ||
excerpt: string; | ||
body: string; | ||
created_at: string; | ||
active: boolean; | ||
}; | ||
|
||
export type AnnouncementsList = { | ||
count: number; | ||
results: Announcement[]; | ||
}; | ||
|
||
export type AnnouncementsFilters = { | ||
max?: number; | ||
offset?: number; | ||
category?: string; | ||
page?: number; | ||
active?: boolean; | ||
}; | ||
|
||
export type AnnouncementSignal = { | ||
data: Announcement; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters