@backstage/plugin-signals-node 0.1.0-next.2 → 0.1.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 +37 -0
- package/README.md +3 -3
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @backstage/plugin-signals-node
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-common@0.21.5
|
|
9
|
+
- @backstage/plugin-auth-node@0.4.10
|
|
10
|
+
- @backstage/plugin-events-node@0.3.1
|
|
11
|
+
- @backstage/backend-plugin-api@0.6.15
|
|
12
|
+
- @backstage/config@1.2.0
|
|
13
|
+
- @backstage/types@1.1.1
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 6c1547a: **BREAKING** Type definition added to signal recipients
|
|
20
|
+
|
|
21
|
+
Update to use `{type: 'broadcast'}` instead `null` and `{type: 'user', entityRef: ''}`
|
|
22
|
+
instead string entity references
|
|
23
|
+
|
|
24
|
+
- daf85dc: BREAKING CHANGE: Migrates signals to use the `EventsService` and makes it mandatory
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 6d84ee6: Renamed `SignalService` to `SignalsService` and `signalService` to `signalServiceRef`
|
|
29
|
+
to follow the naming scheme of services and their references
|
|
30
|
+
- 0fb419b: Updated dependency `uuid` to `^9.0.0`.
|
|
31
|
+
Updated dependency `@types/uuid` to `^9.0.0`.
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
- @backstage/plugin-events-node@0.3.0
|
|
34
|
+
- @backstage/backend-common@0.21.4
|
|
35
|
+
- @backstage/plugin-auth-node@0.4.9
|
|
36
|
+
- @backstage/config@1.2.0
|
|
37
|
+
- @backstage/backend-plugin-api@0.6.14
|
|
38
|
+
- @backstage/types@1.1.1
|
|
39
|
+
|
|
3
40
|
## 0.1.0-next.2
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -91,13 +91,13 @@ To allow connections from the frontend, you should also install the `@backstage/
|
|
|
91
91
|
|
|
92
92
|
Once you have both of the backend plugins installed, you can utilize the signal service by calling the
|
|
93
93
|
`publish` method. This will publish the message to all subscribers in the frontend. To send message to
|
|
94
|
-
all subscribers, you can use `
|
|
94
|
+
all subscribers, you can use `broadcast` type:
|
|
95
95
|
|
|
96
96
|
```ts
|
|
97
97
|
// Periodic sending example
|
|
98
98
|
setInterval(async () => {
|
|
99
99
|
await signals.publish({
|
|
100
|
-
recipients:
|
|
100
|
+
recipients: { type: 'broadcast' },
|
|
101
101
|
channel: 'my_plugin',
|
|
102
102
|
message: {
|
|
103
103
|
message: 'hello world',
|
|
@@ -118,7 +118,7 @@ to work:
|
|
|
118
118
|
eventBroker.publish({
|
|
119
119
|
topic: 'signals',
|
|
120
120
|
eventPayload: {
|
|
121
|
-
recipients:
|
|
121
|
+
recipients: { type: 'user', entityRef: 'user:default/user1' },
|
|
122
122
|
message: {
|
|
123
123
|
message: 'hello world',
|
|
124
124
|
},
|
package/dist/index.cjs.js
CHANGED
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/DefaultSignalsService.ts","../src/lib.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 */\nimport { EventsService } from '@backstage/plugin-events-node';\nimport { SignalPayload, SignalsServiceOptions } from './types';\nimport { SignalsService } from './SignalsService';\nimport { JsonObject } from '@backstage/types';\n\n/** @public */\nexport class DefaultSignalsService implements SignalsService {\n private events: EventsService;\n\n static create(options: SignalsServiceOptions) {\n return new DefaultSignalsService(options);\n }\n\n private constructor(options: SignalsServiceOptions) {\n ({ events: this.events } = options);\n }\n\n /**\n * Publishes a signal to user refs to specific topic\n * @param signal - Signal to publish\n */\n async publish<TMessage extends JsonObject = JsonObject>(\n signal: SignalPayload<TMessage>,\n ) {\n await this.events.publish({\n topic: 'signals',\n eventPayload: signal,\n });\n }\n}\n\n/**\n * @public\n * @deprecated Use `DefaultSignalsService` instead\n */\nexport const DefaultSignalService = DefaultSignalsService;\n","/*\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 */\nimport {\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { DefaultSignalsService } from './DefaultSignalsService';\nimport { SignalsService } from './SignalsService';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\n\n/** @public */\nexport const signalsServiceRef = createServiceRef<SignalsService>({\n id: 'signals.service',\n scope: 'plugin',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n events: eventsServiceRef,\n },\n factory({ events }) {\n return DefaultSignalsService.create({ events });\n },\n }),\n});\n\n/**\n * @public\n * @deprecated Use `signalsServiceRef` instead\n */\nexport const signalService = signalsServiceRef;\n"],"names":["createServiceRef","createServiceFactory","eventsServiceRef"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/DefaultSignalsService.ts","../src/lib.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 */\nimport { EventsService } from '@backstage/plugin-events-node';\nimport { SignalPayload, SignalsServiceOptions } from './types';\nimport { SignalsService } from './SignalsService';\nimport { JsonObject } from '@backstage/types';\n\n/** @public */\nexport class DefaultSignalsService implements SignalsService {\n private events: EventsService;\n\n static create(options: SignalsServiceOptions) {\n return new DefaultSignalsService(options);\n }\n\n private constructor(options: SignalsServiceOptions) {\n ({ events: this.events } = options);\n }\n\n /**\n * Publishes a signal to user refs to specific topic\n * @param signal - Signal to publish\n */\n async publish<TMessage extends JsonObject = JsonObject>(\n signal: SignalPayload<TMessage>,\n ) {\n await this.events.publish({\n topic: 'signals',\n eventPayload: signal,\n });\n }\n}\n\n/**\n * @public\n * @deprecated Use `DefaultSignalsService` instead\n */\nexport const DefaultSignalService = DefaultSignalsService;\n","/*\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 */\nimport {\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { DefaultSignalsService } from './DefaultSignalsService';\nimport { SignalsService } from './SignalsService';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\n\n/** @public */\nexport const signalsServiceRef = createServiceRef<SignalsService>({\n id: 'signals.service',\n scope: 'plugin',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n events: eventsServiceRef,\n },\n factory({ events }) {\n return DefaultSignalsService.create({ events });\n },\n }),\n});\n\n/**\n * @public\n * @deprecated Use `signalsServiceRef` instead\n */\nexport const signalService = signalsServiceRef;\n"],"names":["createServiceRef","createServiceFactory","eventsServiceRef"],"mappings":";;;;;;;;;;;AAqBO,MAAM,qBAAgD,CAAA;AAAA,EAOnD,YAAY,OAAgC,EAAA;AANpD,IAAQ,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AAON,IAAA,CAAC,EAAE,MAAA,EAAQ,IAAK,CAAA,MAAA,EAAW,GAAA,OAAA,EAAA;AAAA,GAC7B;AAAA,EANA,OAAO,OAAO,OAAgC,EAAA;AAC5C,IAAO,OAAA,IAAI,sBAAsB,OAAO,CAAA,CAAA;AAAA,GAC1C;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,QACJ,MACA,EAAA;AACA,IAAM,MAAA,IAAA,CAAK,OAAO,OAAQ,CAAA;AAAA,MACxB,KAAO,EAAA,SAAA;AAAA,MACP,YAAc,EAAA,MAAA;AAAA,KACf,CAAA,CAAA;AAAA,GACH;AACF,CAAA;AAMO,MAAM,oBAAuB,GAAA;;AC1B7B,MAAM,oBAAoBA,iCAAiC,CAAA;AAAA,EAChE,EAAI,EAAA,iBAAA;AAAA,EACJ,KAAO,EAAA,QAAA;AAAA,EACP,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAqB,CAAA;AAAA,IACnB,OAAA;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAAC,iCAAA;AAAA,KACV;AAAA,IACA,OAAA,CAAQ,EAAE,MAAA,EAAU,EAAA;AAClB,MAAA,OAAO,qBAAsB,CAAA,MAAA,CAAO,EAAE,MAAA,EAAQ,CAAA,CAAA;AAAA,KAChD;AAAA,GACD,CAAA;AACL,CAAC,EAAA;AAMM,MAAM,aAAgB,GAAA;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,12 @@ type SignalsServiceOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
/** @public */
|
|
12
12
|
type SignalPayload<TMessage extends JsonObject = JsonObject> = {
|
|
13
|
-
recipients:
|
|
13
|
+
recipients: {
|
|
14
|
+
type: 'user';
|
|
15
|
+
entityRef: string | string[];
|
|
16
|
+
} | {
|
|
17
|
+
type: 'broadcast';
|
|
18
|
+
};
|
|
14
19
|
channel: string;
|
|
15
20
|
message: TMessage;
|
|
16
21
|
};
|
|
@@ -55,4 +60,4 @@ declare class DefaultSignalsService implements SignalsService {
|
|
|
55
60
|
*/
|
|
56
61
|
declare const DefaultSignalService: typeof DefaultSignalsService;
|
|
57
62
|
|
|
58
|
-
export { DefaultSignalService, DefaultSignalsService, SignalPayload, SignalService, SignalsService, SignalsServiceOptions, signalService, signalsServiceRef };
|
|
63
|
+
export { DefaultSignalService, DefaultSignalsService, type SignalPayload, type SignalService, type SignalsService, type SignalsServiceOptions, signalService, signalsServiceRef };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-signals-node",
|
|
3
3
|
"description": "Node.js library for the signals plugin",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"postpack": "backstage-cli package postpack"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@backstage/cli": "^0.
|
|
30
|
+
"@backstage/cli": "^0.26.1",
|
|
31
31
|
"@types/express": "^4.17.21"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/backend-common": "^0.21.
|
|
38
|
-
"@backstage/backend-plugin-api": "^0.6.
|
|
39
|
-
"@backstage/config": "^1.2.0
|
|
40
|
-
"@backstage/plugin-auth-node": "^0.4.
|
|
41
|
-
"@backstage/plugin-events-node": "^0.3.
|
|
37
|
+
"@backstage/backend-common": "^0.21.5",
|
|
38
|
+
"@backstage/backend-plugin-api": "^0.6.15",
|
|
39
|
+
"@backstage/config": "^1.2.0",
|
|
40
|
+
"@backstage/plugin-auth-node": "^0.4.10",
|
|
41
|
+
"@backstage/plugin-events-node": "^0.3.1",
|
|
42
42
|
"@backstage/types": "^1.1.1",
|
|
43
43
|
"express": "^4.17.1",
|
|
44
44
|
"uuid": "^9.0.0",
|