@backstage/plugin-notifications-node 0.2.20 → 0.2.21-next.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,25 @@
1
1
  # @backstage/plugin-notifications-node
2
2
 
3
+ ## 0.2.21-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-plugin-api@1.5.0-next.1
9
+ - @backstage/plugin-signals-node@0.1.26-next.1
10
+
11
+ ## 0.2.21-next.0
12
+
13
+ ### Patch Changes
14
+
15
+ - 05f60e1: Refactored constructor parameter properties to explicit property declarations for compatibility with TypeScript's `erasableSyntaxOnly` setting. This internal refactoring maintains all existing functionality while ensuring TypeScript compilation compatibility.
16
+ - Updated dependencies
17
+ - @backstage/catalog-model@1.7.6-next.0
18
+ - @backstage/backend-plugin-api@1.4.5-next.0
19
+ - @backstage/catalog-client@1.12.1-next.0
20
+ - @backstage/plugin-notifications-common@0.1.2-next.0
21
+ - @backstage/plugin-signals-node@0.1.26-next.0
22
+
3
23
  ## 0.2.20
4
24
 
5
25
  ### Patch Changes
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  class DefaultNotificationService {
4
+ discovery;
5
+ auth;
4
6
  constructor(discovery, auth) {
5
7
  this.discovery = discovery;
6
8
  this.auth = auth;
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultNotificationService.cjs.js","sources":["../../src/service/DefaultNotificationService.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\n\nimport { NotificationService } from './NotificationService';\nimport { AuthService, DiscoveryService } from '@backstage/backend-plugin-api';\nimport { NotificationPayload } from '@backstage/plugin-notifications-common';\n\n/** @public */\nexport type NotificationServiceOptions = {\n auth: AuthService;\n discovery: DiscoveryService;\n};\n\n/** @public */\nexport type NotificationRecipients =\n | {\n type: 'entity';\n /**\n * Entity references to send the notifications to\n */\n entityRef: string | string[];\n /**\n * Optional entity reference(s) to filter out of the resolved recipients.\n * Usually the currently logged-in user for preventing sending notification\n * of user action to him/herself.\n */\n excludeEntityRef?: string | string[];\n }\n | { type: 'broadcast' };\n\n/** @public */\nexport type NotificationSendOptions = {\n recipients: NotificationRecipients;\n payload: NotificationPayload;\n};\n\n/** @public */\nexport class DefaultNotificationService implements NotificationService {\n private constructor(\n private readonly discovery: DiscoveryService,\n private readonly auth: AuthService,\n ) {}\n\n static create(\n options: NotificationServiceOptions,\n ): DefaultNotificationService {\n return new DefaultNotificationService(options.discovery, options.auth);\n }\n\n async send(notification: NotificationSendOptions): Promise<void> {\n try {\n const baseUrl = await this.discovery.getBaseUrl('notifications');\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'notifications',\n });\n\n const response = await fetch(baseUrl, {\n method: 'POST',\n body: JSON.stringify(notification),\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (!response.ok) {\n throw new Error(`Request failed with status ${response.status}`);\n }\n } catch (error) {\n // TODO: Should not throw in optimal case, see BEP\n throw new Error(`Failed to send notifications: ${error}`);\n }\n }\n}\n"],"names":[],"mappings":";;AAkDO,MAAM,0BAAA,CAA0D;AAAA,EAC7D,WAAA,CACW,WACA,IAAA,EACjB;AAFiB,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA;AACA,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAChB;AAAA,EAEH,OAAO,OACL,OAAA,EAC4B;AAC5B,IAAA,OAAO,IAAI,0BAAA,CAA2B,OAAA,CAAQ,SAAA,EAAW,QAAQ,IAAI,CAAA;AAAA,EACvE;AAAA,EAEA,MAAM,KAAK,YAAA,EAAsD;AAC/D,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,SAAA,CAAU,WAAW,eAAe,CAAA;AAC/D,MAAA,MAAM,EAAE,KAAA,EAAM,GAAI,MAAM,IAAA,CAAK,KAAK,qBAAA,CAAsB;AAAA,QACtD,UAAA,EAAY,MAAM,IAAA,CAAK,IAAA,CAAK,wBAAA,EAAyB;AAAA,QACrD,cAAA,EAAgB;AAAA,OACjB,CAAA;AAED,MAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,OAAA,EAAS;AAAA,QACpC,MAAA,EAAQ,MAAA;AAAA,QACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,YAAY,CAAA;AAAA,QACjC,OAAA,EAAS;AAAA,UACP,cAAA,EAAgB,kBAAA;AAAA,UAChB,MAAA,EAAQ,kBAAA;AAAA,UACR,aAAA,EAAe,UAAU,KAAK,CAAA;AAAA;AAChC,OACD,CAAA;AAED,MAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,QAAA,MAAM,IAAI,KAAA,CAAM,CAAA,2BAAA,EAA8B,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA;AAAA,MACjE;AAAA,IACF,SAAS,KAAA,EAAO;AAEd,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,8BAAA,EAAiC,KAAK,CAAA,CAAE,CAAA;AAAA,IAC1D;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"DefaultNotificationService.cjs.js","sources":["../../src/service/DefaultNotificationService.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\n\nimport { NotificationService } from './NotificationService';\nimport { AuthService, DiscoveryService } from '@backstage/backend-plugin-api';\nimport { NotificationPayload } from '@backstage/plugin-notifications-common';\n\n/** @public */\nexport type NotificationServiceOptions = {\n auth: AuthService;\n discovery: DiscoveryService;\n};\n\n/** @public */\nexport type NotificationRecipients =\n | {\n type: 'entity';\n /**\n * Entity references to send the notifications to\n */\n entityRef: string | string[];\n /**\n * Optional entity reference(s) to filter out of the resolved recipients.\n * Usually the currently logged-in user for preventing sending notification\n * of user action to him/herself.\n */\n excludeEntityRef?: string | string[];\n }\n | { type: 'broadcast' };\n\n/** @public */\nexport type NotificationSendOptions = {\n recipients: NotificationRecipients;\n payload: NotificationPayload;\n};\n\n/** @public */\nexport class DefaultNotificationService implements NotificationService {\n private readonly discovery: DiscoveryService;\n private readonly auth: AuthService;\n\n private constructor(discovery: DiscoveryService, auth: AuthService) {\n this.discovery = discovery;\n this.auth = auth;\n }\n\n static create(\n options: NotificationServiceOptions,\n ): DefaultNotificationService {\n return new DefaultNotificationService(options.discovery, options.auth);\n }\n\n async send(notification: NotificationSendOptions): Promise<void> {\n try {\n const baseUrl = await this.discovery.getBaseUrl('notifications');\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'notifications',\n });\n\n const response = await fetch(baseUrl, {\n method: 'POST',\n body: JSON.stringify(notification),\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (!response.ok) {\n throw new Error(`Request failed with status ${response.status}`);\n }\n } catch (error) {\n // TODO: Should not throw in optimal case, see BEP\n throw new Error(`Failed to send notifications: ${error}`);\n }\n }\n}\n"],"names":[],"mappings":";;AAkDO,MAAM,0BA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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications-node",
3
- "version": "0.2.20",
3
+ "version": "0.2.21-next.1",
4
4
  "description": "Node.js library for the notifications plugin",
5
5
  "backstage": {
6
6
  "role": "node-library",
@@ -37,18 +37,18 @@
37
37
  "test": "backstage-cli package test"
38
38
  },
39
39
  "dependencies": {
40
- "@backstage/backend-plugin-api": "^1.4.4",
41
- "@backstage/catalog-client": "^1.12.0",
42
- "@backstage/catalog-model": "^1.7.5",
43
- "@backstage/plugin-notifications-common": "^0.1.1",
44
- "@backstage/plugin-signals-node": "^0.1.25",
40
+ "@backstage/backend-plugin-api": "1.5.0-next.1",
41
+ "@backstage/catalog-client": "1.12.1-next.0",
42
+ "@backstage/catalog-model": "1.7.6-next.0",
43
+ "@backstage/plugin-notifications-common": "0.1.2-next.0",
44
+ "@backstage/plugin-signals-node": "0.1.26-next.1",
45
45
  "knex": "^3.0.0",
46
46
  "uuid": "^11.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@backstage/backend-test-utils": "^1.9.1",
50
- "@backstage/cli": "^0.34.4",
51
- "@backstage/test-utils": "^1.7.12",
49
+ "@backstage/backend-test-utils": "1.10.0-next.1",
50
+ "@backstage/cli": "0.34.5-next.1",
51
+ "@backstage/test-utils": "1.7.13-next.0",
52
52
  "msw": "^1.0.0"
53
53
  },
54
54
  "typesVersions": {