@backstage/plugin-notifications-common 0.0.8 → 0.0.9
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 +16 -0
- package/dist/index.d.ts +25 -9
- package/dist/utils.cjs.js +9 -2
- package/dist/utils.cjs.js.map +1 -1
- package/dist/utils.esm.js +9 -2
- package/dist/utils.esm.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/plugin-notifications-common
|
|
2
2
|
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1fb5f06: Adds ability for user to turn on/off notifications for specific topics within an origin.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/config@1.3.2
|
|
10
|
+
|
|
11
|
+
## 0.0.9-next.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 1fb5f06: Adds ability for user to turn on/off notifications for specific topics within an origin.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/config@1.3.2
|
|
18
|
+
|
|
3
19
|
## 0.0.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -102,17 +102,33 @@ type NotificationProcessorFilters = {
|
|
|
102
102
|
maxSeverity?: NotificationSeverity;
|
|
103
103
|
excludedTopics?: string[];
|
|
104
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
type TopicSetting = {
|
|
109
|
+
id: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
type OriginSetting = {
|
|
116
|
+
id: string;
|
|
117
|
+
enabled: boolean;
|
|
118
|
+
topics?: TopicSetting[];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
type ChannelSetting = {
|
|
124
|
+
id: string;
|
|
125
|
+
origins: OriginSetting[];
|
|
126
|
+
};
|
|
105
127
|
/**
|
|
106
128
|
* @public
|
|
107
129
|
*/
|
|
108
130
|
type NotificationSettings = {
|
|
109
|
-
channels:
|
|
110
|
-
id: string;
|
|
111
|
-
origins: {
|
|
112
|
-
id: string;
|
|
113
|
-
enabled: boolean;
|
|
114
|
-
}[];
|
|
115
|
-
}[];
|
|
131
|
+
channels: ChannelSetting[];
|
|
116
132
|
};
|
|
117
133
|
|
|
118
134
|
/** Ordered list of severities used by the Notifications.
|
|
@@ -124,6 +140,6 @@ declare const notificationSeverities: NotificationSeverity[];
|
|
|
124
140
|
declare const getProcessorFiltersFromConfig: (config: Config) => NotificationProcessorFilters;
|
|
125
141
|
|
|
126
142
|
/** @public */
|
|
127
|
-
declare const isNotificationsEnabledFor: (settings: NotificationSettings, channelId: string, originId: string) => boolean;
|
|
143
|
+
declare const isNotificationsEnabledFor: (settings: NotificationSettings, channelId: string, originId: string, topicId: string | null) => boolean;
|
|
128
144
|
|
|
129
|
-
export { type NewNotificationSignal, type Notification, type NotificationPayload, type NotificationProcessorFilters, type NotificationReadSignal, type NotificationSettings, type NotificationSeverity, type NotificationSignal, type NotificationStatus, getProcessorFiltersFromConfig, isNotificationsEnabledFor, notificationSeverities };
|
|
145
|
+
export { type ChannelSetting, type NewNotificationSignal, type Notification, type NotificationPayload, type NotificationProcessorFilters, type NotificationReadSignal, type NotificationSettings, type NotificationSeverity, type NotificationSignal, type NotificationStatus, type OriginSetting, type TopicSetting, getProcessorFiltersFromConfig, isNotificationsEnabledFor, notificationSeverities };
|
package/dist/utils.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const isNotificationsEnabledFor = (settings, channelId, originId) => {
|
|
3
|
+
const isNotificationsEnabledFor = (settings, channelId, originId, topicId) => {
|
|
4
4
|
const channel = settings.channels.find((c) => c.id === channelId);
|
|
5
5
|
if (!channel) {
|
|
6
6
|
return true;
|
|
@@ -9,7 +9,14 @@ const isNotificationsEnabledFor = (settings, channelId, originId) => {
|
|
|
9
9
|
if (!origin) {
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
if (topicId === null) {
|
|
13
|
+
return origin.enabled;
|
|
14
|
+
}
|
|
15
|
+
const topic = origin.topics?.find((t) => t.id === topicId);
|
|
16
|
+
if (!topic) {
|
|
17
|
+
return origin.enabled;
|
|
18
|
+
}
|
|
19
|
+
return topic.enabled;
|
|
13
20
|
};
|
|
14
21
|
|
|
15
22
|
exports.isNotificationsEnabledFor = isNotificationsEnabledFor;
|
package/dist/utils.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs.js","sources":["../src/utils.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { NotificationSettings } from './types';\n\n/** @public */\nexport const isNotificationsEnabledFor = (\n settings: NotificationSettings,\n channelId: string,\n originId: string,\n) => {\n const channel = settings.channels.find(c => c.id === channelId);\n if (!channel) {\n return true;\n }\n\n const origin = channel.origins.find(o => o.id === originId);\n if (!origin) {\n return true;\n }\n return origin.enabled;\n};\n"],"names":[],"mappings":";;AAkBO,MAAM,yBAA4B,GAAA,CACvC,QACA,EAAA,SAAA,EACA,
|
|
1
|
+
{"version":3,"file":"utils.cjs.js","sources":["../src/utils.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { NotificationSettings } from './types';\n\n/** @public */\nexport const isNotificationsEnabledFor = (\n settings: NotificationSettings,\n channelId: string,\n originId: string,\n topicId: string | null,\n) => {\n const channel = settings.channels.find(c => c.id === channelId);\n if (!channel) {\n return true;\n }\n\n const origin = channel.origins.find(o => o.id === originId);\n if (!origin) {\n return true;\n }\n if (topicId === null) {\n return origin.enabled;\n }\n const topic = origin.topics?.find(t => t.id === topicId);\n if (!topic) {\n return origin.enabled;\n }\n return topic.enabled;\n};\n"],"names":[],"mappings":";;AAkBO,MAAM,yBAA4B,GAAA,CACvC,QACA,EAAA,SAAA,EACA,UACA,OACG,KAAA;AACH,EAAA,MAAM,UAAU,QAAS,CAAA,QAAA,CAAS,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,SAAS,CAAA;AAC9D,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,MAAM,SAAS,OAAQ,CAAA,OAAA,CAAQ,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,QAAQ,CAAA;AAC1D,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAO,OAAA,IAAA;AAAA;AAET,EAAA,IAAI,YAAY,IAAM,EAAA;AACpB,IAAA,OAAO,MAAO,CAAA,OAAA;AAAA;AAEhB,EAAA,MAAM,QAAQ,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,OAAO,CAAA;AACvD,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAA,OAAO,MAAO,CAAA,OAAA;AAAA;AAEhB,EAAA,OAAO,KAAM,CAAA,OAAA;AACf;;;;"}
|
package/dist/utils.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const isNotificationsEnabledFor = (settings, channelId, originId) => {
|
|
1
|
+
const isNotificationsEnabledFor = (settings, channelId, originId, topicId) => {
|
|
2
2
|
const channel = settings.channels.find((c) => c.id === channelId);
|
|
3
3
|
if (!channel) {
|
|
4
4
|
return true;
|
|
@@ -7,7 +7,14 @@ const isNotificationsEnabledFor = (settings, channelId, originId) => {
|
|
|
7
7
|
if (!origin) {
|
|
8
8
|
return true;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
if (topicId === null) {
|
|
11
|
+
return origin.enabled;
|
|
12
|
+
}
|
|
13
|
+
const topic = origin.topics?.find((t) => t.id === topicId);
|
|
14
|
+
if (!topic) {
|
|
15
|
+
return origin.enabled;
|
|
16
|
+
}
|
|
17
|
+
return topic.enabled;
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
export { isNotificationsEnabledFor };
|
package/dist/utils.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.esm.js","sources":["../src/utils.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { NotificationSettings } from './types';\n\n/** @public */\nexport const isNotificationsEnabledFor = (\n settings: NotificationSettings,\n channelId: string,\n originId: string,\n) => {\n const channel = settings.channels.find(c => c.id === channelId);\n if (!channel) {\n return true;\n }\n\n const origin = channel.origins.find(o => o.id === originId);\n if (!origin) {\n return true;\n }\n return origin.enabled;\n};\n"],"names":[],"mappings":"AAkBO,MAAM,yBAA4B,GAAA,CACvC,QACA,EAAA,SAAA,EACA,
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../src/utils.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { NotificationSettings } from './types';\n\n/** @public */\nexport const isNotificationsEnabledFor = (\n settings: NotificationSettings,\n channelId: string,\n originId: string,\n topicId: string | null,\n) => {\n const channel = settings.channels.find(c => c.id === channelId);\n if (!channel) {\n return true;\n }\n\n const origin = channel.origins.find(o => o.id === originId);\n if (!origin) {\n return true;\n }\n if (topicId === null) {\n return origin.enabled;\n }\n const topic = origin.topics?.find(t => t.id === topicId);\n if (!topic) {\n return origin.enabled;\n }\n return topic.enabled;\n};\n"],"names":[],"mappings":"AAkBO,MAAM,yBAA4B,GAAA,CACvC,QACA,EAAA,SAAA,EACA,UACA,OACG,KAAA;AACH,EAAA,MAAM,UAAU,QAAS,CAAA,QAAA,CAAS,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,SAAS,CAAA;AAC9D,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,OAAA,IAAA;AAAA;AAGT,EAAA,MAAM,SAAS,OAAQ,CAAA,OAAA,CAAQ,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,QAAQ,CAAA;AAC1D,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAO,OAAA,IAAA;AAAA;AAET,EAAA,IAAI,YAAY,IAAM,EAAA;AACpB,IAAA,OAAO,MAAO,CAAA,OAAA;AAAA;AAEhB,EAAA,MAAM,QAAQ,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,OAAO,OAAO,CAAA;AACvD,EAAA,IAAI,CAAC,KAAO,EAAA;AACV,IAAA,OAAO,MAAO,CAAA,OAAA;AAAA;AAEhB,EAAA,OAAO,KAAM,CAAA,OAAA;AACf;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-notifications-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Common functionalities for the notifications plugin",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "common-library",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@material-ui/icons": "^4.9.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@backstage/cli": "^0.
|
|
46
|
+
"@backstage/cli": "^0.33.0"
|
|
47
47
|
},
|
|
48
48
|
"typesVersions": {
|
|
49
49
|
"*": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"package.json": [
|
|
51
|
+
"package.json"
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
},
|