@backstage/plugin-events-backend-test-utils 0.1.23-next.0 → 0.1.23
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 +10 -30
- package/README.md +3 -4
- package/dist/index.cjs.js +9 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -24
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,45 +1,25 @@
|
|
|
1
1
|
# @backstage/plugin-events-backend-test-utils
|
|
2
2
|
|
|
3
|
-
## 0.1.23
|
|
3
|
+
## 0.1.23
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
**Summary:**
|
|
10
|
-
|
|
11
|
-
- new:
|
|
12
|
-
`EventsService`, `eventsServiceRef`, `TestEventsService`
|
|
13
|
-
- deprecated:
|
|
14
|
-
`EventBroker`, `EventPublisher`, `EventSubscriber`, `DefaultEventBroker`, `EventsBackend`,
|
|
15
|
-
most parts of `EventsExtensionPoint` (alpha),
|
|
16
|
-
`TestEventBroker`, `TestEventPublisher`, `TestEventSubscriber`
|
|
17
|
-
|
|
18
|
-
Add the `eventsServiceRef` as dependency to your backend plugins
|
|
19
|
-
or backend plugin modules.
|
|
20
|
-
|
|
21
|
-
**Details:**
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/plugin-events-node@0.2.22
|
|
22
9
|
|
|
23
|
-
|
|
24
|
-
of the new backend system and does not respect the plugin isolation.
|
|
25
|
-
This made it not compatible anymore with the new backend system.
|
|
10
|
+
## 0.1.22
|
|
26
11
|
|
|
27
|
-
|
|
28
|
-
supporting less exposure of internal concerns as well.
|
|
12
|
+
### Patch Changes
|
|
29
13
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Instead, it is expected that the `EventsService` gets passed into publishers and subscribers,
|
|
33
|
-
and used internally. There is no need to expose anything of that at their own interfaces.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/plugin-events-node@0.2.21
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
(by other plugins or their modules) anyway.
|
|
17
|
+
## 0.1.21
|
|
37
18
|
|
|
38
|
-
|
|
39
|
-
Optionally, an instance can be passed as argument to allow mixed setups to operate alongside.
|
|
19
|
+
### Patch Changes
|
|
40
20
|
|
|
41
21
|
- Updated dependencies
|
|
42
|
-
- @backstage/plugin-events-node@0.
|
|
22
|
+
- @backstage/plugin-events-node@0.2.20
|
|
43
23
|
|
|
44
24
|
## 0.1.20
|
|
45
25
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# plugin-events-backend-test-utils
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
by [`events-node` package](../events-node/README.md): `TestEventsService`.
|
|
3
|
+
Houses implementations of plugin-events-node interfaces
|
|
4
|
+
which can be useful for test for events-backend and its modules.
|
package/dist/index.cjs.js
CHANGED
|
@@ -21,34 +21,34 @@ class TestEventBroker {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var __accessCheck
|
|
24
|
+
var __accessCheck = (obj, member, msg) => {
|
|
25
25
|
if (!member.has(obj))
|
|
26
26
|
throw TypeError("Cannot " + msg);
|
|
27
27
|
};
|
|
28
|
-
var __privateGet
|
|
29
|
-
__accessCheck
|
|
28
|
+
var __privateGet = (obj, member, getter) => {
|
|
29
|
+
__accessCheck(obj, member, "read from private field");
|
|
30
30
|
return getter ? getter.call(obj) : member.get(obj);
|
|
31
31
|
};
|
|
32
|
-
var __privateAdd
|
|
32
|
+
var __privateAdd = (obj, member, value) => {
|
|
33
33
|
if (member.has(obj))
|
|
34
34
|
throw TypeError("Cannot add the same private member more than once");
|
|
35
35
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
36
36
|
};
|
|
37
|
-
var __privateSet
|
|
38
|
-
__accessCheck
|
|
37
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
38
|
+
__accessCheck(obj, member, "write to private field");
|
|
39
39
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
40
40
|
return value;
|
|
41
41
|
};
|
|
42
42
|
var _eventBroker;
|
|
43
43
|
class TestEventPublisher {
|
|
44
44
|
constructor() {
|
|
45
|
-
__privateAdd
|
|
45
|
+
__privateAdd(this, _eventBroker, void 0);
|
|
46
46
|
}
|
|
47
47
|
async setEventBroker(eventBroker) {
|
|
48
|
-
__privateSet
|
|
48
|
+
__privateSet(this, _eventBroker, eventBroker);
|
|
49
49
|
}
|
|
50
50
|
get eventBroker() {
|
|
51
|
-
return __privateGet
|
|
51
|
+
return __privateGet(this, _eventBroker);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
_eventBroker = new WeakMap();
|
|
@@ -77,52 +77,7 @@ class TestEventSubscriber {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
var __accessCheck = (obj, member, msg) => {
|
|
81
|
-
if (!member.has(obj))
|
|
82
|
-
throw TypeError("Cannot " + msg);
|
|
83
|
-
};
|
|
84
|
-
var __privateGet = (obj, member, getter) => {
|
|
85
|
-
__accessCheck(obj, member, "read from private field");
|
|
86
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
87
|
-
};
|
|
88
|
-
var __privateAdd = (obj, member, value) => {
|
|
89
|
-
if (member.has(obj))
|
|
90
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
91
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
92
|
-
};
|
|
93
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
94
|
-
__accessCheck(obj, member, "write to private field");
|
|
95
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
96
|
-
return value;
|
|
97
|
-
};
|
|
98
|
-
var _published, _subscribed;
|
|
99
|
-
class TestEventsService {
|
|
100
|
-
constructor() {
|
|
101
|
-
__privateAdd(this, _published, []);
|
|
102
|
-
__privateAdd(this, _subscribed, []);
|
|
103
|
-
}
|
|
104
|
-
async publish(params) {
|
|
105
|
-
__privateGet(this, _published).push(params);
|
|
106
|
-
}
|
|
107
|
-
async subscribe(options) {
|
|
108
|
-
__privateGet(this, _subscribed).push(options);
|
|
109
|
-
}
|
|
110
|
-
get published() {
|
|
111
|
-
return __privateGet(this, _published);
|
|
112
|
-
}
|
|
113
|
-
get subscribed() {
|
|
114
|
-
return __privateGet(this, _subscribed);
|
|
115
|
-
}
|
|
116
|
-
reset() {
|
|
117
|
-
__privateSet(this, _published, []);
|
|
118
|
-
__privateSet(this, _subscribed, []);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
_published = new WeakMap();
|
|
122
|
-
_subscribed = new WeakMap();
|
|
123
|
-
|
|
124
80
|
exports.TestEventBroker = TestEventBroker;
|
|
125
81
|
exports.TestEventPublisher = TestEventPublisher;
|
|
126
82
|
exports.TestEventSubscriber = TestEventSubscriber;
|
|
127
|
-
exports.TestEventsService = TestEventsService;
|
|
128
83
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/testUtils/TestEventBroker.ts","../src/testUtils/TestEventPublisher.ts","../src/testUtils/TestEventSubscriber.ts"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/testUtils/TestEventBroker.ts","../src/testUtils/TestEventPublisher.ts","../src/testUtils/TestEventSubscriber.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {\n EventBroker,\n EventParams,\n EventSubscriber,\n} from '@backstage/plugin-events-node';\n\n/** @public */\nexport class TestEventBroker implements EventBroker {\n readonly published: EventParams[] = [];\n readonly subscribed: EventSubscriber[] = [];\n\n async publish(params: EventParams): Promise<void> {\n this.published.push(params);\n }\n\n subscribe(\n ...subscribers: Array<EventSubscriber | Array<EventSubscriber>>\n ): void {\n this.subscribed.push(...subscribers.flat());\n }\n}\n","/*\n * Copyright 2022 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 { EventBroker, EventPublisher } from '@backstage/plugin-events-node';\n\n/** @public */\nexport class TestEventPublisher implements EventPublisher {\n #eventBroker?: EventBroker;\n\n async setEventBroker(eventBroker: EventBroker): Promise<void> {\n this.#eventBroker = eventBroker;\n }\n\n get eventBroker() {\n return this.#eventBroker;\n }\n}\n","/*\n * Copyright 2022 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 { EventParams, EventSubscriber } from '@backstage/plugin-events-node';\n\n/** @public */\nexport class TestEventSubscriber implements EventSubscriber {\n readonly name: string;\n readonly topics: string[];\n\n readonly receivedEvents: Record<string, EventParams[]> = {};\n\n constructor(name: string, topics: string[]) {\n this.name = name;\n this.topics = topics;\n }\n\n supportsEventTopics(): string[] {\n return this.topics;\n }\n\n async onEvent(params: EventParams): Promise<void> {\n this.receivedEvents[params.topic] = this.receivedEvents[params.topic] ?? [];\n this.receivedEvents[params.topic].push(params);\n }\n}\n"],"names":["__publicField"],"mappings":";;;;;;;;;;AAuBO,MAAM,eAAuC,CAAA;AAAA,EAA7C,WAAA,GAAA;AACL,IAAAA,eAAA,CAAA,IAAA,EAAS,aAA2B,EAAC,CAAA,CAAA;AACrC,IAAAA,eAAA,CAAA,IAAA,EAAS,cAAgC,EAAC,CAAA,CAAA;AAAA,GAAA;AAAA,EAE1C,MAAM,QAAQ,MAAoC,EAAA;AAChD,IAAK,IAAA,CAAA,SAAA,CAAU,KAAK,MAAM,CAAA,CAAA;AAAA,GAC5B;AAAA,EAEA,aACK,WACG,EAAA;AACN,IAAA,IAAA,CAAK,UAAW,CAAA,IAAA,CAAK,GAAG,WAAA,CAAY,MAAM,CAAA,CAAA;AAAA,GAC5C;AACF;;;;;;;;;;;;;;;;;;;;ACpCA,IAAA,YAAA,CAAA;AAmBO,MAAM,kBAA6C,CAAA;AAAA,EAAnD,WAAA,GAAA;AACL,IAAA,YAAA,CAAA,IAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAAA,GAAA;AAAA,EAEA,MAAM,eAAe,WAAyC,EAAA;AAC5D,IAAA,YAAA,CAAA,IAAA,EAAK,YAAe,EAAA,WAAA,CAAA,CAAA;AAAA,GACtB;AAAA,EAEA,IAAI,WAAc,GAAA;AAChB,IAAA,OAAO,YAAK,CAAA,IAAA,EAAA,YAAA,CAAA,CAAA;AAAA,GACd;AACF,CAAA;AATE,YAAA,GAAA,IAAA,OAAA,EAAA;;;;;;;;ACDK,MAAM,mBAA+C,CAAA;AAAA,EAM1D,WAAA,CAAY,MAAc,MAAkB,EAAA;AAL5C,IAAS,aAAA,CAAA,IAAA,EAAA,MAAA,CAAA,CAAA;AACT,IAAS,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AAET,IAAA,aAAA,CAAA,IAAA,EAAS,kBAAgD,EAAC,CAAA,CAAA;AAGxD,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA,CAAA;AACZ,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AAAA,GAChB;AAAA,EAEA,mBAAgC,GAAA;AAC9B,IAAA,OAAO,IAAK,CAAA,MAAA,CAAA;AAAA,GACd;AAAA,EAEA,MAAM,QAAQ,MAAoC,EAAA;AAlCpD,IAAA,IAAA,EAAA,CAAA;AAmCI,IAAK,IAAA,CAAA,cAAA,CAAe,MAAO,CAAA,KAAK,CAAI,GAAA,CAAA,EAAA,GAAA,IAAA,CAAK,eAAe,MAAO,CAAA,KAAK,CAAhC,KAAA,IAAA,GAAA,EAAA,GAAqC,EAAC,CAAA;AAC1E,IAAA,IAAA,CAAK,cAAe,CAAA,MAAA,CAAO,KAAK,CAAA,CAAE,KAAK,MAAM,CAAA,CAAA;AAAA,GAC/C;AACF;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { EventBroker, EventParams, EventSubscriber, EventPublisher
|
|
1
|
+
import { EventBroker, EventParams, EventSubscriber, EventPublisher } from '@backstage/plugin-events-node';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
* @deprecated use `TestEventsService` instead
|
|
6
|
-
*/
|
|
3
|
+
/** @public */
|
|
7
4
|
declare class TestEventBroker implements EventBroker {
|
|
8
5
|
readonly published: EventParams[];
|
|
9
6
|
readonly subscribed: EventSubscriber[];
|
|
@@ -11,20 +8,14 @@ declare class TestEventBroker implements EventBroker {
|
|
|
11
8
|
subscribe(...subscribers: Array<EventSubscriber | Array<EventSubscriber>>): void;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
* @deprecated `EventPublisher` was replaced by `EventsService.publish`
|
|
17
|
-
*/
|
|
11
|
+
/** @public */
|
|
18
12
|
declare class TestEventPublisher implements EventPublisher {
|
|
19
13
|
#private;
|
|
20
14
|
setEventBroker(eventBroker: EventBroker): Promise<void>;
|
|
21
15
|
get eventBroker(): EventBroker | undefined;
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
* @deprecated `EventSubscriber` was replaced by `EventsService.subscribe`.
|
|
27
|
-
*/
|
|
18
|
+
/** @public */
|
|
28
19
|
declare class TestEventSubscriber implements EventSubscriber {
|
|
29
20
|
readonly name: string;
|
|
30
21
|
readonly topics: string[];
|
|
@@ -34,14 +25,4 @@ declare class TestEventSubscriber implements EventSubscriber {
|
|
|
34
25
|
onEvent(params: EventParams): Promise<void>;
|
|
35
26
|
}
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
declare class TestEventsService implements EventsService {
|
|
39
|
-
#private;
|
|
40
|
-
publish(params: EventParams): Promise<void>;
|
|
41
|
-
subscribe(options: EventsServiceSubscribeOptions): Promise<void>;
|
|
42
|
-
get published(): EventParams[];
|
|
43
|
-
get subscribed(): EventsServiceSubscribeOptions[];
|
|
44
|
-
reset(): void;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { TestEventBroker, TestEventPublisher, TestEventSubscriber, TestEventsService };
|
|
28
|
+
export { TestEventBroker, TestEventPublisher, TestEventSubscriber };
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-events-backend-test-utils",
|
|
3
|
-
"version": "0.1.23-next.0",
|
|
4
3
|
"description": "The plugin-events-backend-test-utils for @backstage/plugin-events-node",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
"version": "0.1.23",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public",
|
|
10
10
|
"main": "dist/index.cjs.js",
|
|
11
11
|
"types": "dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
+
"backstage": {
|
|
14
|
+
"role": "node-library"
|
|
15
|
+
},
|
|
13
16
|
"homepage": "https://backstage.io",
|
|
14
17
|
"repository": {
|
|
15
18
|
"type": "git",
|
|
16
19
|
"url": "https://github.com/backstage/backstage",
|
|
17
20
|
"directory": "plugins/events-backend-test-utils"
|
|
18
21
|
},
|
|
19
|
-
"license": "Apache-2.0",
|
|
20
|
-
"main": "dist/index.cjs.js",
|
|
21
|
-
"types": "dist/index.d.ts",
|
|
22
|
-
"files": [
|
|
23
|
-
"dist"
|
|
24
|
-
],
|
|
25
22
|
"scripts": {
|
|
23
|
+
"start": "backstage-cli package start",
|
|
26
24
|
"build": "backstage-cli package build",
|
|
27
|
-
"clean": "backstage-cli package clean",
|
|
28
25
|
"lint": "backstage-cli package lint",
|
|
26
|
+
"test": "backstage-cli package test",
|
|
27
|
+
"clean": "backstage-cli package clean",
|
|
29
28
|
"prepack": "backstage-cli package prepack",
|
|
30
|
-
"postpack": "backstage-cli package postpack"
|
|
31
|
-
"start": "backstage-cli package start",
|
|
32
|
-
"test": "backstage-cli package test"
|
|
29
|
+
"postpack": "backstage-cli package postpack"
|
|
33
30
|
},
|
|
34
31
|
"dependencies": {
|
|
35
|
-
"@backstage/plugin-events-node": "^0.
|
|
32
|
+
"@backstage/plugin-events-node": "^0.2.22"
|
|
36
33
|
},
|
|
37
34
|
"devDependencies": {
|
|
38
|
-
"@backstage/cli": "^0.25.
|
|
39
|
-
}
|
|
35
|
+
"@backstage/cli": "^0.25.2"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
]
|
|
40
40
|
}
|