@backstage/plugin-notifications-common 0.0.4-next.0 → 0.0.5

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,19 @@
1
1
  # @backstage/plugin-notifications-common
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 4e4ef2b: Move notification processor filter parsing to common package
8
+ - Updated dependencies
9
+ - @backstage/config@1.2.0
10
+
11
+ ## 0.0.4
12
+
13
+ ### Patch Changes
14
+
15
+ - d44a20a: Added additional plugin metadata to `package.json`.
16
+
3
17
  ## 0.0.4-next.0
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,32 @@
1
+ import { notificationSeverities } from './constants.esm.js';
2
+
3
+ const getProcessorFiltersFromConfig = (config) => {
4
+ const filter = {};
5
+ const minSeverity = config.getOptionalString(
6
+ "filter.minSeverity"
7
+ );
8
+ if (minSeverity) {
9
+ if (notificationSeverities.includes(minSeverity)) {
10
+ filter.minSeverity = minSeverity;
11
+ } else {
12
+ throw new Error(`Invalid minSeverity: ${minSeverity}`);
13
+ }
14
+ }
15
+ const maxSeverity = config.getOptionalString(
16
+ "filter.maxSeverity"
17
+ );
18
+ if (maxSeverity) {
19
+ if (notificationSeverities.includes(maxSeverity)) {
20
+ filter.maxSeverity = maxSeverity;
21
+ } else {
22
+ throw new Error(`Invalid maxSeverity: ${maxSeverity}`);
23
+ }
24
+ }
25
+ filter.excludedTopics = config.getOptionalStringArray(
26
+ "filter.excludedTopics"
27
+ );
28
+ return filter;
29
+ };
30
+
31
+ export { getProcessorFiltersFromConfig };
32
+ //# sourceMappingURL=filters.esm.js.map
@@ -0,0 +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":";;AAoBa,MAAA,6BAAA,GAAgC,CAAC,MAAmB,KAAA;AAC/D,EAAA,MAAM,SAAuC,EAAC,CAAA;AAC9C,EAAA,MAAM,cAAc,MAAO,CAAA,iBAAA;AAAA,IACzB,oBAAA;AAAA,GACF,CAAA;AACA,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,sBAAA,CAAuB,QAAS,CAAA,WAAW,CAAG,EAAA;AAChD,MAAA,MAAA,CAAO,WAAc,GAAA,WAAA,CAAA;AAAA,KAChB,MAAA;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAwB,qBAAA,EAAA,WAAW,CAAE,CAAA,CAAA,CAAA;AAAA,KACvD;AAAA,GACF;AACA,EAAA,MAAM,cAAc,MAAO,CAAA,iBAAA;AAAA,IACzB,oBAAA;AAAA,GACF,CAAA;AACA,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,sBAAA,CAAuB,QAAS,CAAA,WAAW,CAAG,EAAA;AAChD,MAAA,MAAA,CAAO,WAAc,GAAA,WAAA,CAAA;AAAA,KAChB,MAAA;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAwB,qBAAA,EAAA,WAAW,CAAE,CAAA,CAAA,CAAA;AAAA,KACvD;AAAA,GACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAO,CAAA,sBAAA;AAAA,IAC7B,uBAAA;AAAA,GACF,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
package/dist/index.cjs.js CHANGED
@@ -7,5 +7,34 @@ const notificationSeverities = [
7
7
  "low"
8
8
  ];
9
9
 
10
+ const getProcessorFiltersFromConfig = (config) => {
11
+ const filter = {};
12
+ const minSeverity = config.getOptionalString(
13
+ "filter.minSeverity"
14
+ );
15
+ if (minSeverity) {
16
+ if (notificationSeverities.includes(minSeverity)) {
17
+ filter.minSeverity = minSeverity;
18
+ } else {
19
+ throw new Error(`Invalid minSeverity: ${minSeverity}`);
20
+ }
21
+ }
22
+ const maxSeverity = config.getOptionalString(
23
+ "filter.maxSeverity"
24
+ );
25
+ if (maxSeverity) {
26
+ if (notificationSeverities.includes(maxSeverity)) {
27
+ filter.maxSeverity = maxSeverity;
28
+ } else {
29
+ throw new Error(`Invalid maxSeverity: ${maxSeverity}`);
30
+ }
31
+ }
32
+ filter.excludedTopics = config.getOptionalStringArray(
33
+ "filter.excludedTopics"
34
+ );
35
+ return filter;
36
+ };
37
+
38
+ exports.getProcessorFiltersFromConfig = getProcessorFiltersFromConfig;
10
39
  exports.notificationSeverities = notificationSeverities;
11
40
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/constants.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 { NotificationSeverity } from './types';\n\n/** Ordered list of severities used by the Notifications.\n *\n * @public */\nexport const notificationSeverities: NotificationSeverity[] = [\n 'critical',\n 'high',\n 'normal',\n 'low',\n];\n"],"names":[],"mappings":";;AAoBO,MAAM,sBAAiD,GAAA;AAAA,EAC5D,UAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/constants.ts","../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 { NotificationSeverity } from './types';\n\n/** Ordered list of severities used by the Notifications.\n *\n * @public */\nexport const notificationSeverities: NotificationSeverity[] = [\n 'critical',\n 'high',\n 'normal',\n 'low',\n];\n","/*\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,sBAAiD,GAAA;AAAA,EAC5D,UAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AACF;;ACLa,MAAA,6BAAA,GAAgC,CAAC,MAAmB,KAAA;AAC/D,EAAA,MAAM,SAAuC,EAAC,CAAA;AAC9C,EAAA,MAAM,cAAc,MAAO,CAAA,iBAAA;AAAA,IACzB,oBAAA;AAAA,GACF,CAAA;AACA,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,sBAAA,CAAuB,QAAS,CAAA,WAAW,CAAG,EAAA;AAChD,MAAA,MAAA,CAAO,WAAc,GAAA,WAAA,CAAA;AAAA,KAChB,MAAA;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAwB,qBAAA,EAAA,WAAW,CAAE,CAAA,CAAA,CAAA;AAAA,KACvD;AAAA,GACF;AACA,EAAA,MAAM,cAAc,MAAO,CAAA,iBAAA;AAAA,IACzB,oBAAA;AAAA,GACF,CAAA;AACA,EAAA,IAAI,WAAa,EAAA;AACf,IAAI,IAAA,sBAAA,CAAuB,QAAS,CAAA,WAAW,CAAG,EAAA;AAChD,MAAA,MAAA,CAAO,WAAc,GAAA,WAAA,CAAA;AAAA,KAChB,MAAA;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAwB,qBAAA,EAAA,WAAW,CAAE,CAAA,CAAA,CAAA;AAAA,KACvD;AAAA,GACF;AACA,EAAA,MAAA,CAAO,iBAAiB,MAAO,CAAA,sBAAA;AAAA,IAC7B,uBAAA;AAAA,GACF,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Config } from '@backstage/config';
2
+
1
3
  /** @public */
2
4
  type NotificationSeverity = 'critical' | 'high' | 'normal' | 'low';
3
5
  /** @public */
@@ -92,10 +94,21 @@ type NotificationReadSignal = {
92
94
  };
93
95
  /** @public */
94
96
  type NotificationSignal = NewNotificationSignal | NotificationReadSignal;
97
+ /**
98
+ * @public
99
+ */
100
+ type NotificationProcessorFilters = {
101
+ minSeverity?: NotificationSeverity;
102
+ maxSeverity?: NotificationSeverity;
103
+ excludedTopics?: string[];
104
+ };
95
105
 
96
106
  /** Ordered list of severities used by the Notifications.
97
107
  *
98
108
  * @public */
99
109
  declare const notificationSeverities: NotificationSeverity[];
100
110
 
101
- export { type NewNotificationSignal, type Notification, type NotificationPayload, type NotificationReadSignal, type NotificationSeverity, type NotificationSignal, type NotificationStatus, notificationSeverities };
111
+ /** @public */
112
+ declare const getProcessorFiltersFromConfig: (config: Config) => NotificationProcessorFilters;
113
+
114
+ export { type NewNotificationSignal, type Notification, type NotificationPayload, type NotificationProcessorFilters, type NotificationReadSignal, type NotificationSeverity, type NotificationSignal, type NotificationStatus, getProcessorFiltersFromConfig, notificationSeverities };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { notificationSeverities } from './constants.esm.js';
2
+ export { getProcessorFiltersFromConfig } from './filters.esm.js';
2
3
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications-common",
3
- "version": "0.0.4-next.0",
3
+ "version": "0.0.5",
4
4
  "description": "Common functionalities for the notifications plugin",
5
5
  "backstage": {
6
6
  "role": "common-library",
@@ -39,10 +39,11 @@
39
39
  "test": "backstage-cli package test"
40
40
  },
41
41
  "dependencies": {
42
+ "@backstage/config": "^1.2.0",
42
43
  "@material-ui/icons": "^4.9.1"
43
44
  },
44
45
  "devDependencies": {
45
- "@backstage/cli": "^0.26.7-next.3"
46
+ "@backstage/cli": "^0.26.11"
46
47
  },
47
48
  "module": "dist/index.esm.js"
48
49
  }