@backstage/plugin-notifications-common 0.2.0 → 0.2.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage/plugin-notifications-common
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e9eb400: Allow configuring included topics for email notifications.
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
@@ -27,6 +27,9 @@ const getProcessorFiltersFromConfig = (config) => {
27
27
  filter.excludedTopics = config.getOptionalStringArray(
28
28
  "filter.excludedTopics"
29
29
  );
30
+ filter.includedTopics = config.getOptionalStringArray(
31
+ "filter.includedTopics"
32
+ );
30
33
  return filter;
31
34
  };
32
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"filters.cjs.js","sources":["../src/filters.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 { Config } from '@backstage/config';\nimport { NotificationProcessorFilters, NotificationSeverity } from './types';\nimport { notificationSeverities } from './constants';\n\n/** @public */\nexport const getProcessorFiltersFromConfig = (config: Config) => {\n const filter: NotificationProcessorFilters = {};\n const minSeverity = config.getOptionalString(\n 'filter.minSeverity',\n ) as NotificationSeverity;\n if (minSeverity) {\n if (notificationSeverities.includes(minSeverity)) {\n filter.minSeverity = minSeverity;\n } else {\n throw new Error(`Invalid minSeverity: ${minSeverity}`);\n }\n }\n const maxSeverity = config.getOptionalString(\n 'filter.maxSeverity',\n ) as NotificationSeverity;\n if (maxSeverity) {\n if (notificationSeverities.includes(maxSeverity)) {\n filter.maxSeverity = maxSeverity;\n } else {\n throw new Error(`Invalid maxSeverity: ${maxSeverity}`);\n }\n }\n filter.excludedTopics = config.getOptionalStringArray(\n 'filter.excludedTopics',\n );\n return filter;\n};\n"],"names":["notificationSeverities"],"mappings":";;;;AAoBO,MAAM,6BAAA,GAAgC,CAAC,MAAA,KAAmB;AAC/D,EAAA,MAAM,SAAuC,EAAC;AAC9C,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAIA,gCAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAIA,gCAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAA,CAAO,sBAAA;AAAA,IAC7B;AAAA,GACF;AACA,EAAA,OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"filters.cjs.js","sources":["../src/filters.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 { Config } from '@backstage/config';\nimport { NotificationProcessorFilters, NotificationSeverity } from './types';\nimport { notificationSeverities } from './constants';\n\n/** @public */\nexport const getProcessorFiltersFromConfig = (config: Config) => {\n const filter: NotificationProcessorFilters = {};\n const minSeverity = config.getOptionalString(\n 'filter.minSeverity',\n ) as NotificationSeverity;\n if (minSeverity) {\n if (notificationSeverities.includes(minSeverity)) {\n filter.minSeverity = minSeverity;\n } else {\n throw new Error(`Invalid minSeverity: ${minSeverity}`);\n }\n }\n const maxSeverity = config.getOptionalString(\n 'filter.maxSeverity',\n ) as NotificationSeverity;\n if (maxSeverity) {\n if (notificationSeverities.includes(maxSeverity)) {\n filter.maxSeverity = maxSeverity;\n } else {\n throw new Error(`Invalid maxSeverity: ${maxSeverity}`);\n }\n }\n filter.excludedTopics = config.getOptionalStringArray(\n 'filter.excludedTopics',\n );\n filter.includedTopics = config.getOptionalStringArray(\n 'filter.includedTopics',\n );\n return filter;\n};\n"],"names":["notificationSeverities"],"mappings":";;;;AAoBO,MAAM,6BAAA,GAAgC,CAAC,MAAA,KAAmB;AAC/D,EAAA,MAAM,SAAuC,EAAC;AAC9C,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAIA,gCAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAIA,gCAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAA,CAAO,sBAAA;AAAA,IAC7B;AAAA,GACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAA,CAAO,sBAAA;AAAA,IAC7B;AAAA,GACF;AACA,EAAA,OAAO,MAAA;AACT;;;;"}
@@ -25,6 +25,9 @@ const getProcessorFiltersFromConfig = (config) => {
25
25
  filter.excludedTopics = config.getOptionalStringArray(
26
26
  "filter.excludedTopics"
27
27
  );
28
+ filter.includedTopics = config.getOptionalStringArray(
29
+ "filter.includedTopics"
30
+ );
28
31
  return filter;
29
32
  };
30
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"filters.esm.js","sources":["../src/filters.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 { Config } from '@backstage/config';\nimport { NotificationProcessorFilters, NotificationSeverity } from './types';\nimport { notificationSeverities } from './constants';\n\n/** @public */\nexport const getProcessorFiltersFromConfig = (config: Config) => {\n const filter: NotificationProcessorFilters = {};\n const minSeverity = config.getOptionalString(\n 'filter.minSeverity',\n ) as NotificationSeverity;\n if (minSeverity) {\n if (notificationSeverities.includes(minSeverity)) {\n filter.minSeverity = minSeverity;\n } else {\n throw new Error(`Invalid minSeverity: ${minSeverity}`);\n }\n }\n const maxSeverity = config.getOptionalString(\n 'filter.maxSeverity',\n ) as NotificationSeverity;\n if (maxSeverity) {\n if (notificationSeverities.includes(maxSeverity)) {\n filter.maxSeverity = maxSeverity;\n } else {\n throw new Error(`Invalid maxSeverity: ${maxSeverity}`);\n }\n }\n filter.excludedTopics = config.getOptionalStringArray(\n 'filter.excludedTopics',\n );\n return filter;\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,6BAAA,GAAgC,CAAC,MAAA,KAAmB;AAC/D,EAAA,MAAM,SAAuC,EAAC;AAC9C,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,sBAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,sBAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAA,CAAO,sBAAA;AAAA,IAC7B;AAAA,GACF;AACA,EAAA,OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"filters.esm.js","sources":["../src/filters.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 { Config } from '@backstage/config';\nimport { NotificationProcessorFilters, NotificationSeverity } from './types';\nimport { notificationSeverities } from './constants';\n\n/** @public */\nexport const getProcessorFiltersFromConfig = (config: Config) => {\n const filter: NotificationProcessorFilters = {};\n const minSeverity = config.getOptionalString(\n 'filter.minSeverity',\n ) as NotificationSeverity;\n if (minSeverity) {\n if (notificationSeverities.includes(minSeverity)) {\n filter.minSeverity = minSeverity;\n } else {\n throw new Error(`Invalid minSeverity: ${minSeverity}`);\n }\n }\n const maxSeverity = config.getOptionalString(\n 'filter.maxSeverity',\n ) as NotificationSeverity;\n if (maxSeverity) {\n if (notificationSeverities.includes(maxSeverity)) {\n filter.maxSeverity = maxSeverity;\n } else {\n throw new Error(`Invalid maxSeverity: ${maxSeverity}`);\n }\n }\n filter.excludedTopics = config.getOptionalStringArray(\n 'filter.excludedTopics',\n );\n filter.includedTopics = config.getOptionalStringArray(\n 'filter.includedTopics',\n );\n return filter;\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,6BAAA,GAAgC,CAAC,MAAA,KAAmB;AAC/D,EAAA,MAAM,SAAuC,EAAC;AAC9C,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,sBAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAM,cAAc,MAAA,CAAO,iBAAA;AAAA,IACzB;AAAA,GACF;AACA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,IAAI,sBAAA,CAAuB,QAAA,CAAS,WAAW,CAAA,EAAG;AAChD,MAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AAAA,IACvB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,WAAW,CAAA,CAAE,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAA,CAAO,sBAAA;AAAA,IAC7B;AAAA,GACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAA,CAAO,sBAAA;AAAA,IAC7B;AAAA,GACF;AACA,EAAA,OAAO,MAAA;AACT;;;;"}
package/dist/index.d.ts CHANGED
@@ -108,6 +108,7 @@ type NotificationProcessorFilters = {
108
108
  minSeverity?: NotificationSeverity;
109
109
  maxSeverity?: NotificationSeverity;
110
110
  excludedTopics?: string[];
111
+ includedTopics?: string[];
111
112
  };
112
113
  /**
113
114
  * @public
@@ -179,4 +180,5 @@ declare const getProcessorFiltersFromConfig: (config: Config) => NotificationPro
179
180
  /** @public */
180
181
  declare const isNotificationsEnabledFor: (settings: NotificationSettings, channelId: string, originId: string, topicId: string | null) => boolean;
181
182
 
182
- 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 };
183
+ export { getProcessorFiltersFromConfig, isNotificationsEnabledFor, notificationSeverities };
184
+ export type { ChannelSetting, NewNotificationSignal, Notification, NotificationPayload, NotificationProcessorFilters, NotificationReadSignal, NotificationSettings, NotificationSeverity, NotificationSignal, NotificationStatus, OriginSetting, TopicSetting };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications-common",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Common functionalities for the notifications plugin",
5
5
  "backstage": {
6
6
  "role": "common-library",
@@ -44,7 +44,7 @@
44
44
  "@material-ui/icons": "^4.9.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@backstage/cli": "^0.34.5"
47
+ "@backstage/cli": "^0.35.4"
48
48
  },
49
49
  "typesVersions": {
50
50
  "*": {