@backstage/plugin-signals-node 0.0.1-next.1 → 0.0.1-next.3
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 +27 -0
- package/dist/index.cjs.js +3 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +11 -12
- package/package.json +11 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @backstage/plugin-signals-node
|
|
2
2
|
|
|
3
|
+
## 0.0.1-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8472188: Added or fixed the `repository` field in `package.json`.
|
|
8
|
+
- 1ab22c4: Allow defining signal type to publish and receive
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/backend-common@0.21.0-next.3
|
|
11
|
+
- @backstage/plugin-auth-node@0.4.4-next.3
|
|
12
|
+
- @backstage/backend-plugin-api@0.6.10-next.3
|
|
13
|
+
- @backstage/config@1.1.1
|
|
14
|
+
- @backstage/types@1.1.1
|
|
15
|
+
- @backstage/plugin-events-node@0.2.19-next.3
|
|
16
|
+
|
|
17
|
+
## 0.0.1-next.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 447d210: Fix disconnect loop on server start
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @backstage/backend-common@0.21.0-next.2
|
|
24
|
+
- @backstage/backend-plugin-api@0.6.10-next.2
|
|
25
|
+
- @backstage/plugin-auth-node@0.4.4-next.2
|
|
26
|
+
- @backstage/plugin-events-node@0.2.19-next.2
|
|
27
|
+
- @backstage/config@1.1.1
|
|
28
|
+
- @backstage/types@1.1.1
|
|
29
|
+
|
|
3
30
|
## 0.0.1-next.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -20,21 +20,14 @@ class DefaultSignalService {
|
|
|
20
20
|
return new DefaultSignalService(options);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Publishes a
|
|
24
|
-
* @param
|
|
25
|
-
* @param topic - message topic
|
|
26
|
-
* @param message - message to publish
|
|
23
|
+
* Publishes a signal to user refs to specific topic
|
|
24
|
+
* @param signal - Signal to publish
|
|
27
25
|
*/
|
|
28
26
|
async publish(signal) {
|
|
29
27
|
var _a;
|
|
30
|
-
const { recipients, channel, message } = signal;
|
|
31
28
|
await ((_a = this.eventBroker) == null ? void 0 : _a.publish({
|
|
32
29
|
topic: "signals",
|
|
33
|
-
eventPayload:
|
|
34
|
-
recipients,
|
|
35
|
-
message,
|
|
36
|
-
channel
|
|
37
|
-
}
|
|
30
|
+
eventPayload: signal
|
|
38
31
|
}));
|
|
39
32
|
}
|
|
40
33
|
}
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/DefaultSignalService.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 { EventBroker } from '@backstage/plugin-events-node';\nimport { SignalPayload, SignalServiceOptions } from './types';\nimport { SignalService } from './SignalService';\n\n/** @public */\nexport class DefaultSignalService implements SignalService {\n // TODO: Remove this to be optional when events-backend has eventBroker as service\n private eventBroker?: EventBroker;\n\n static create(options: SignalServiceOptions) {\n return new DefaultSignalService(options);\n }\n\n private constructor(options: SignalServiceOptions) {\n ({ eventBroker: this.eventBroker } = options);\n }\n\n /**\n * Publishes a
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/DefaultSignalService.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 { EventBroker } from '@backstage/plugin-events-node';\nimport { SignalPayload, SignalServiceOptions } from './types';\nimport { SignalService } from './SignalService';\nimport { JsonObject } from '@backstage/types';\n\n/** @public */\nexport class DefaultSignalService implements SignalService {\n // TODO: Remove this to be optional when events-backend has eventBroker as service\n private eventBroker?: EventBroker;\n\n static create(options: SignalServiceOptions) {\n return new DefaultSignalService(options);\n }\n\n private constructor(options: SignalServiceOptions) {\n ({ eventBroker: this.eventBroker } = 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.eventBroker?.publish({\n topic: 'signals',\n eventPayload: signal,\n });\n }\n}\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 { DefaultSignalService } from './DefaultSignalService';\nimport { SignalService } from './SignalService';\n\n/** @public */\nexport const signalService = createServiceRef<SignalService>({\n id: 'signals.service',\n scope: 'plugin',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n // TODO: EventBroker. It is optional for now but it's actually required so waiting for the new backend system\n // for the events-backend for this to work.\n },\n factory({}) {\n return DefaultSignalService.create({});\n },\n }),\n});\n"],"names":["createServiceRef","createServiceFactory"],"mappings":";;;;;;;;;;;;AAqBO,MAAM,oBAA8C,CAAA;AAAA,EAQjD,YAAY,OAA+B,EAAA;AANnD;AAAA,IAAQ,aAAA,CAAA,IAAA,EAAA,aAAA,CAAA,CAAA;AAON,IAAA,CAAC,EAAE,WAAA,EAAa,IAAK,CAAA,WAAA,EAAgB,GAAA,OAAA,EAAA;AAAA,GACvC;AAAA,EANA,OAAO,OAAO,OAA+B,EAAA;AAC3C,IAAO,OAAA,IAAI,qBAAqB,OAAO,CAAA,CAAA;AAAA,GACzC;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,QACJ,MACA,EAAA;AAvCJ,IAAA,IAAA,EAAA,CAAA;AAwCI,IAAM,OAAA,CAAA,EAAA,GAAA,IAAA,CAAK,WAAL,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkB,OAAQ,CAAA;AAAA,MAC9B,KAAO,EAAA,SAAA;AAAA,MACP,YAAc,EAAA,MAAA;AAAA,KAChB,CAAA,CAAA,CAAA;AAAA,GACF;AACF;;ACtBO,MAAM,gBAAgBA,iCAAgC,CAAA;AAAA,EAC3D,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;AAAA;AAAA,KAGN;AAAA,IACA,OAAA,CAAQ,EAAI,EAAA;AACV,MAAO,OAAA,oBAAA,CAAqB,MAAO,CAAA,EAAE,CAAA,CAAA;AAAA,KACvC;AAAA,GACD,CAAA;AACL,CAAC;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,19 +9,20 @@ type SignalServiceOptions = {
|
|
|
9
9
|
eventBroker?: EventBroker;
|
|
10
10
|
};
|
|
11
11
|
/** @public */
|
|
12
|
-
type SignalPayload = {
|
|
13
|
-
recipients: string[] | null;
|
|
12
|
+
type SignalPayload<TMessage extends JsonObject = JsonObject> = {
|
|
13
|
+
recipients: string[] | string | null;
|
|
14
14
|
channel: string;
|
|
15
|
-
message:
|
|
15
|
+
message: TMessage;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/** @public */
|
|
19
|
-
|
|
19
|
+
interface SignalService {
|
|
20
20
|
/**
|
|
21
|
-
* Publishes a
|
|
21
|
+
* Publishes a signal to user refs to specific topic
|
|
22
|
+
* @param signal - Signal to publish
|
|
22
23
|
*/
|
|
23
|
-
publish(signal: SignalPayload): Promise<void>;
|
|
24
|
-
}
|
|
24
|
+
publish<TMessage extends JsonObject = JsonObject>(signal: SignalPayload<TMessage>): Promise<void>;
|
|
25
|
+
}
|
|
25
26
|
|
|
26
27
|
/** @public */
|
|
27
28
|
declare const signalService: _backstage_backend_plugin_api.ServiceRef<SignalService, "plugin">;
|
|
@@ -32,12 +33,10 @@ declare class DefaultSignalService implements SignalService {
|
|
|
32
33
|
static create(options: SignalServiceOptions): DefaultSignalService;
|
|
33
34
|
private constructor();
|
|
34
35
|
/**
|
|
35
|
-
* Publishes a
|
|
36
|
-
* @param
|
|
37
|
-
* @param topic - message topic
|
|
38
|
-
* @param message - message to publish
|
|
36
|
+
* Publishes a signal to user refs to specific topic
|
|
37
|
+
* @param signal - Signal to publish
|
|
39
38
|
*/
|
|
40
|
-
publish(signal: SignalPayload): Promise<void>;
|
|
39
|
+
publish<TMessage extends JsonObject = JsonObject>(signal: SignalPayload<TMessage>): Promise<void>;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
export { DefaultSignalService, SignalPayload, SignalService, SignalServiceOptions, signalService };
|
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.0.1-next.
|
|
4
|
+
"version": "0.0.1-next.3",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"main": "dist/index.cjs.js",
|
|
11
11
|
"types": "dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/backstage/backstage",
|
|
16
|
+
"directory": "plugins/signals-node"
|
|
17
|
+
},
|
|
13
18
|
"backstage": {
|
|
14
19
|
"role": "node-library"
|
|
15
20
|
},
|
|
@@ -22,18 +27,18 @@
|
|
|
22
27
|
"postpack": "backstage-cli package postpack"
|
|
23
28
|
},
|
|
24
29
|
"devDependencies": {
|
|
25
|
-
"@backstage/cli": "^0.25.2-next.
|
|
30
|
+
"@backstage/cli": "^0.25.2-next.3",
|
|
26
31
|
"@types/express": "^4.17.21"
|
|
27
32
|
},
|
|
28
33
|
"files": [
|
|
29
34
|
"dist"
|
|
30
35
|
],
|
|
31
36
|
"dependencies": {
|
|
32
|
-
"@backstage/backend-common": "^0.21.0-next.
|
|
33
|
-
"@backstage/backend-plugin-api": "^0.6.10-next.
|
|
37
|
+
"@backstage/backend-common": "^0.21.0-next.3",
|
|
38
|
+
"@backstage/backend-plugin-api": "^0.6.10-next.3",
|
|
34
39
|
"@backstage/config": "^1.1.1",
|
|
35
|
-
"@backstage/plugin-auth-node": "^0.4.4-next.
|
|
36
|
-
"@backstage/plugin-events-node": "^0.2.19-next.
|
|
40
|
+
"@backstage/plugin-auth-node": "^0.4.4-next.3",
|
|
41
|
+
"@backstage/plugin-events-node": "^0.2.19-next.3",
|
|
37
42
|
"@backstage/types": "^1.1.1",
|
|
38
43
|
"express": "^4.17.1",
|
|
39
44
|
"uuid": "^8.0.0",
|