@backstage-community/plugin-kafka 0.3.35
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 +1696 -0
- package/README.md +119 -0
- package/config.d.ts +31 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.esm.js +296 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Kafka Plugin
|
|
2
|
+
|
|
3
|
+
<img src="./src/assets/screenshot-1.png">
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# From your Backstage root directory
|
|
11
|
+
yarn --cwd packages/app add @backstage-community/plugin-kafka
|
|
12
|
+
yarn --cwd packages/backend add @backstage-community/plugin-kafka-backend
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. Add the plugin backend:
|
|
16
|
+
|
|
17
|
+
In a new file named `kafka.ts` under `backend/src/plugins`:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import { createRouter } from '@backstage-community/plugin-kafka-backend';
|
|
21
|
+
import { Router } from 'express';
|
|
22
|
+
import { PluginEnvironment } from '../types';
|
|
23
|
+
|
|
24
|
+
export default async function createPlugin(
|
|
25
|
+
env: PluginEnvironment,
|
|
26
|
+
): Promise<Router> {
|
|
27
|
+
return await createRouter({
|
|
28
|
+
logger: env.logger,
|
|
29
|
+
config: env.config,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
And then add to `packages/backend/src/index.ts`:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// In packages/backend/src/index.ts
|
|
38
|
+
import kafka from './plugins/kafka';
|
|
39
|
+
// ...
|
|
40
|
+
async function main() {
|
|
41
|
+
// ...
|
|
42
|
+
const kafkaEnv = useHotMemoize(module, () => createEnv('kafka'));
|
|
43
|
+
// ...
|
|
44
|
+
apiRouter.use('/kafka', await kafka(kafkaEnv));
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. Add the plugin as a tab to your service entities:
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
// In packages/app/src/components/catalog/EntityPage.tsx
|
|
51
|
+
import { EntityKafkaContent } from '@backstage-community/plugin-kafka';
|
|
52
|
+
|
|
53
|
+
const serviceEntityPage = (
|
|
54
|
+
<EntityLayout>
|
|
55
|
+
{/* other tabs... */}
|
|
56
|
+
<EntityLayout.Route path="/kafka" title="Kafka">
|
|
57
|
+
<EntityKafkaContent />
|
|
58
|
+
</EntityLayout.Route>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
4. Add broker configs for the backend in your `app-config.yaml` (see
|
|
62
|
+
[kafka-backend](https://github.com/backstage/backstage/blob/master/plugins/kafka-backend/README.md)
|
|
63
|
+
for more options):
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
kafka:
|
|
67
|
+
clientId: backstage
|
|
68
|
+
clusters:
|
|
69
|
+
- name: cluster-name
|
|
70
|
+
brokers:
|
|
71
|
+
- localhost:9092
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
5. Add the `kafka.apache.org/consumer-groups` annotation to your services:
|
|
75
|
+
|
|
76
|
+
Can be a comma separated list.
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
apiVersion: backstage.io/v1alpha1
|
|
80
|
+
kind: Component
|
|
81
|
+
metadata:
|
|
82
|
+
# ...
|
|
83
|
+
annotations:
|
|
84
|
+
kafka.apache.org/consumer-groups: cluster-name/consumer-group-name
|
|
85
|
+
spec:
|
|
86
|
+
type: service
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
6. Configure dashboard urls:
|
|
90
|
+
|
|
91
|
+
You have two options.
|
|
92
|
+
Either configure it with an annotation called `kafka.apache.org/dashboard-urls`
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
apiVersion: backstage.io/v1alpha1
|
|
96
|
+
kind: Component
|
|
97
|
+
metadata:
|
|
98
|
+
# ...
|
|
99
|
+
annotations:
|
|
100
|
+
kafka.apache.org/dashboard-urls: cluster-name/consumer-group-name/dashboard-url
|
|
101
|
+
spec:
|
|
102
|
+
type: service
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
> The consumer-group-name is optional.
|
|
106
|
+
|
|
107
|
+
or with configs in `app-config.yaml`
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
kafka:
|
|
111
|
+
# ...
|
|
112
|
+
clusters:
|
|
113
|
+
- name: cluster-name
|
|
114
|
+
dashboardUrl: https://dashboard.com
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Features
|
|
118
|
+
|
|
119
|
+
- List topics offsets and consumer group offsets for configured services.
|
package/config.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 The Backstage Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export interface Config {
|
|
17
|
+
kafka?: {
|
|
18
|
+
clusters: Array<{
|
|
19
|
+
/**
|
|
20
|
+
* Cluster name
|
|
21
|
+
* @visibility frontend
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
/**
|
|
25
|
+
* Cluster dashboard url
|
|
26
|
+
* @visibility frontend
|
|
27
|
+
*/
|
|
28
|
+
dashboardUrl?: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
|
+
import { Entity } from '@backstage/catalog-model';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
declare const kafkaPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
9
|
+
entityContent: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
10
|
+
}, {}, {}>;
|
|
11
|
+
/** @public */
|
|
12
|
+
declare const EntityKafkaContent: () => react.JSX.Element;
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
declare const KAFKA_CONSUMER_GROUP_ANNOTATION = "kafka.apache.org/consumer-groups";
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
18
|
+
declare const isPluginApplicableToEntity: (entity: Entity) => boolean;
|
|
19
|
+
/** @public */
|
|
20
|
+
declare const Router: () => react__default.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { EntityKafkaContent, KAFKA_CONSUMER_GROUP_ANNOTATION, Router, isPluginApplicableToEntity as isKafkaAvailable, isPluginApplicableToEntity, kafkaPlugin, kafkaPlugin as plugin };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { createApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, configApiRef, createRoutableExtension, useApi, errorApiRef } from '@backstage/core-plugin-api';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { Routes, Route } from 'react-router-dom';
|
|
4
|
+
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
5
|
+
import Box from '@material-ui/core/Box';
|
|
6
|
+
import Grid from '@material-ui/core/Grid';
|
|
7
|
+
import Typography from '@material-ui/core/Typography';
|
|
8
|
+
import RetryIcon from '@material-ui/icons/Replay';
|
|
9
|
+
import useAsyncRetry from 'react-use/esm/useAsyncRetry';
|
|
10
|
+
import { Table, Link } from '@backstage/core-components';
|
|
11
|
+
|
|
12
|
+
var __defProp$1 = Object.defineProperty;
|
|
13
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __publicField$1 = (obj, key, value) => {
|
|
15
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16
|
+
return value;
|
|
17
|
+
};
|
|
18
|
+
class KafkaBackendClient {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
__publicField$1(this, "discoveryApi");
|
|
21
|
+
__publicField$1(this, "identityApi");
|
|
22
|
+
this.discoveryApi = options.discoveryApi;
|
|
23
|
+
this.identityApi = options.identityApi;
|
|
24
|
+
}
|
|
25
|
+
async internalGet(path) {
|
|
26
|
+
const url = `${await this.discoveryApi.getBaseUrl("kafka")}${path}`;
|
|
27
|
+
const { token: idToken } = await this.identityApi.getCredentials();
|
|
28
|
+
const response = await fetch(url, {
|
|
29
|
+
method: "GET",
|
|
30
|
+
headers: {
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
...idToken && { Authorization: `Bearer ${idToken}` }
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
const payload = await response.text();
|
|
37
|
+
const message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;
|
|
38
|
+
throw new Error(message);
|
|
39
|
+
}
|
|
40
|
+
return await response.json();
|
|
41
|
+
}
|
|
42
|
+
async getConsumerGroupOffsets(clusterId, consumerGroup) {
|
|
43
|
+
return await this.internalGet(
|
|
44
|
+
`/consumers/${clusterId}/${consumerGroup}/offsets`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const kafkaApiRef = createApiRef({
|
|
50
|
+
id: "plugin.kafka.service"
|
|
51
|
+
});
|
|
52
|
+
const kafkaDashboardApiRef = createApiRef({
|
|
53
|
+
id: "plugin.kafka.dashboard"
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const KAFKA_CONSUMER_GROUP_ANNOTATION = "kafka.apache.org/consumer-groups";
|
|
57
|
+
const KAFKA_DASHBOARD_URL = "kafka.apache.org/dashboard-urls";
|
|
58
|
+
|
|
59
|
+
var __defProp = Object.defineProperty;
|
|
60
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
61
|
+
var __publicField = (obj, key, value) => {
|
|
62
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
63
|
+
return value;
|
|
64
|
+
};
|
|
65
|
+
class KafkaDashboardClient {
|
|
66
|
+
constructor(options) {
|
|
67
|
+
__publicField(this, "configApi");
|
|
68
|
+
__publicField(this, "regexPattern", /^([a-z0-9._-]+)\/([a-z0-9._-]+)?\/?(https?.*)$/i);
|
|
69
|
+
this.configApi = options.configApi;
|
|
70
|
+
}
|
|
71
|
+
getDashboardUrl(clusterId, consumerGroup, entity) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const annotation = (_b = (_a = entity.metadata.annotations) == null ? void 0 : _a[KAFKA_DASHBOARD_URL]) != null ? _b : "";
|
|
74
|
+
const dashboardList = annotation.split(",").filter((value) => value !== void 0 && value !== "").map((value) => value.match(this.regexPattern)).filter(
|
|
75
|
+
(value) => value[1] === clusterId && (value[2] === void 0 || value[2] === consumerGroup)
|
|
76
|
+
).sort((a, b) => {
|
|
77
|
+
if (a[2] === b[2])
|
|
78
|
+
return 0;
|
|
79
|
+
if (a[2] !== void 0)
|
|
80
|
+
return -1;
|
|
81
|
+
return 1;
|
|
82
|
+
});
|
|
83
|
+
if (dashboardList.length > 0) {
|
|
84
|
+
return { url: dashboardList[0][3] };
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
url: this.configApi.getConfigArray("kafka.clusters").filter((value) => value.getString("name") === clusterId).map((value) => value.getOptionalString("dashboardUrl"))[0] || void 0
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const rootCatalogKafkaRouteRef = createRouteRef({
|
|
93
|
+
id: "kafka"
|
|
94
|
+
});
|
|
95
|
+
const kafkaPlugin = createPlugin({
|
|
96
|
+
id: "kafka",
|
|
97
|
+
apis: [
|
|
98
|
+
createApiFactory({
|
|
99
|
+
api: kafkaApiRef,
|
|
100
|
+
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
|
101
|
+
factory: ({ discoveryApi, identityApi }) => new KafkaBackendClient({ discoveryApi, identityApi })
|
|
102
|
+
}),
|
|
103
|
+
createApiFactory({
|
|
104
|
+
api: kafkaDashboardApiRef,
|
|
105
|
+
deps: { configApi: configApiRef },
|
|
106
|
+
factory: ({ configApi }) => new KafkaDashboardClient({ configApi })
|
|
107
|
+
})
|
|
108
|
+
],
|
|
109
|
+
routes: {
|
|
110
|
+
entityContent: rootCatalogKafkaRouteRef
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const EntityKafkaContent = kafkaPlugin.provide(
|
|
114
|
+
createRoutableExtension({
|
|
115
|
+
name: "EntityKafkaContent",
|
|
116
|
+
component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
|
|
117
|
+
mountPoint: rootCatalogKafkaRouteRef
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const useConsumerGroupsForEntity = () => {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
const { entity } = useEntity();
|
|
124
|
+
const annotation = (_b = (_a = entity.metadata.annotations) == null ? void 0 : _a[KAFKA_CONSUMER_GROUP_ANNOTATION]) != null ? _b : "";
|
|
125
|
+
return useMemo(() => {
|
|
126
|
+
return annotation.split(",").map((consumer) => {
|
|
127
|
+
const [clusterId, consumerGroup] = consumer.split("/");
|
|
128
|
+
if (!clusterId || !consumerGroup) {
|
|
129
|
+
throw new Error(
|
|
130
|
+
`Failed to parse kafka consumer group annotation: got "${annotation}"`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
clusterId: clusterId.trim(),
|
|
135
|
+
consumerGroup: consumerGroup.trim()
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}, [annotation]);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const useConsumerGroupsOffsetsForEntity = () => {
|
|
142
|
+
const consumers = useConsumerGroupsForEntity();
|
|
143
|
+
const { entity } = useEntity();
|
|
144
|
+
const api = useApi(kafkaApiRef);
|
|
145
|
+
const apiDashboard = useApi(kafkaDashboardApiRef);
|
|
146
|
+
const errorApi = useApi(errorApiRef);
|
|
147
|
+
const {
|
|
148
|
+
loading,
|
|
149
|
+
value: consumerGroupsTopics,
|
|
150
|
+
retry
|
|
151
|
+
} = useAsyncRetry(async () => {
|
|
152
|
+
try {
|
|
153
|
+
return await Promise.all(
|
|
154
|
+
consumers.map(async ({ clusterId, consumerGroup }) => {
|
|
155
|
+
const response = await api.getConsumerGroupOffsets(
|
|
156
|
+
clusterId,
|
|
157
|
+
consumerGroup
|
|
158
|
+
);
|
|
159
|
+
return {
|
|
160
|
+
clusterId,
|
|
161
|
+
dashboardUrl: apiDashboard.getDashboardUrl(
|
|
162
|
+
clusterId,
|
|
163
|
+
consumerGroup,
|
|
164
|
+
entity
|
|
165
|
+
).url,
|
|
166
|
+
consumerGroup,
|
|
167
|
+
topics: response.offsets
|
|
168
|
+
};
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
errorApi.post(e);
|
|
173
|
+
throw e;
|
|
174
|
+
}
|
|
175
|
+
}, [consumers, api, apiDashboard, errorApi, entity]);
|
|
176
|
+
return [
|
|
177
|
+
{
|
|
178
|
+
loading,
|
|
179
|
+
consumerGroupsTopics
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
retry
|
|
183
|
+
}
|
|
184
|
+
];
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const generatedColumns = [
|
|
188
|
+
{
|
|
189
|
+
title: "Topic",
|
|
190
|
+
field: "topic",
|
|
191
|
+
highlight: true,
|
|
192
|
+
render: (row) => {
|
|
193
|
+
var _a;
|
|
194
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = row.topic) != null ? _a : "");
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
title: "Partition",
|
|
199
|
+
field: "partitionId",
|
|
200
|
+
render: (row) => {
|
|
201
|
+
var _a;
|
|
202
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = row.partitionId) != null ? _a : "");
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
title: "Topic Offset",
|
|
207
|
+
field: "topicOffset",
|
|
208
|
+
render: (row) => {
|
|
209
|
+
var _a;
|
|
210
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = row.topicOffset) != null ? _a : "");
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
title: "Group Offset",
|
|
215
|
+
field: "groupOffset",
|
|
216
|
+
render: (row) => {
|
|
217
|
+
var _a;
|
|
218
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = row.groupOffset) != null ? _a : "");
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
title: "Lag",
|
|
223
|
+
field: "lag",
|
|
224
|
+
render: (row) => {
|
|
225
|
+
let lag = void 0;
|
|
226
|
+
if (row.topicOffset && row.groupOffset) {
|
|
227
|
+
lag = +row.topicOffset - +row.groupOffset;
|
|
228
|
+
}
|
|
229
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, lag != null ? lag : "");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
];
|
|
233
|
+
const ConsumerGroupOffsets = ({
|
|
234
|
+
loading,
|
|
235
|
+
topics,
|
|
236
|
+
clusterId,
|
|
237
|
+
dashboardUrl,
|
|
238
|
+
consumerGroup,
|
|
239
|
+
retry
|
|
240
|
+
}) => {
|
|
241
|
+
return /* @__PURE__ */ React.createElement(
|
|
242
|
+
Table,
|
|
243
|
+
{
|
|
244
|
+
isLoading: loading,
|
|
245
|
+
actions: [
|
|
246
|
+
{
|
|
247
|
+
icon: () => /* @__PURE__ */ React.createElement(RetryIcon, null),
|
|
248
|
+
tooltip: "Refresh Data",
|
|
249
|
+
isFreeAction: true,
|
|
250
|
+
onClick: () => retry()
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
data: topics != null ? topics : [],
|
|
254
|
+
title: /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, "Consumed Topics for ", consumerGroup, " (", dashboardUrl && /* @__PURE__ */ React.createElement(Link, { to: dashboardUrl }, clusterId) || clusterId, ")")),
|
|
255
|
+
columns: generatedColumns
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
const KafkaTopicsForConsumer = () => {
|
|
260
|
+
var _a;
|
|
261
|
+
const [tableProps, { retry }] = useConsumerGroupsOffsetsForEntity();
|
|
262
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, (_a = tableProps.consumerGroupsTopics) == null ? void 0 : _a.map((consumerGroup) => /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, key: consumerGroup.clusterId }, /* @__PURE__ */ React.createElement(
|
|
263
|
+
ConsumerGroupOffsets,
|
|
264
|
+
{
|
|
265
|
+
...consumerGroup,
|
|
266
|
+
loading: tableProps.loading,
|
|
267
|
+
retry
|
|
268
|
+
}
|
|
269
|
+
))));
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const isPluginApplicableToEntity = (entity) => {
|
|
273
|
+
var _a;
|
|
274
|
+
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[KAFKA_CONSUMER_GROUP_ANNOTATION]);
|
|
275
|
+
};
|
|
276
|
+
const Router = () => {
|
|
277
|
+
const { entity } = useEntity();
|
|
278
|
+
if (!isPluginApplicableToEntity(entity)) {
|
|
279
|
+
return /* @__PURE__ */ React.createElement(
|
|
280
|
+
MissingAnnotationEmptyState,
|
|
281
|
+
{
|
|
282
|
+
annotation: KAFKA_CONSUMER_GROUP_ANNOTATION
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(KafkaTopicsForConsumer, null) }));
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
var Router$1 = /*#__PURE__*/Object.freeze({
|
|
290
|
+
__proto__: null,
|
|
291
|
+
Router: Router,
|
|
292
|
+
isPluginApplicableToEntity: isPluginApplicableToEntity
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
export { EntityKafkaContent, KAFKA_CONSUMER_GROUP_ANNOTATION, Router, isPluginApplicableToEntity as isKafkaAvailable, isPluginApplicableToEntity, kafkaPlugin, kafkaPlugin as plugin };
|
|
296
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/api/KafkaBackendClient.ts","../src/api/types.ts","../src/constants.ts","../src/api/KafkaDashboardClient.ts","../src/plugin.ts","../src/components/ConsumerGroupOffsets/useConsumerGroupsForEntity.ts","../src/components/ConsumerGroupOffsets/useConsumerGroupsOffsetsForEntity.ts","../src/components/ConsumerGroupOffsets/ConsumerGroupOffsets.tsx","../src/Router.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { KafkaApi, ConsumerGroupOffsetsResponse } from './types';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\n\nexport class KafkaBackendClient implements KafkaApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n }\n\n private async internalGet(path: string): Promise<any> {\n const url = `${await this.discoveryApi.getBaseUrl('kafka')}${path}`;\n const { token: idToken } = await this.identityApi.getCredentials();\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n ...(idToken && { Authorization: `Bearer ${idToken}` }),\n },\n });\n\n if (!response.ok) {\n const payload = await response.text();\n const message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;\n throw new Error(message);\n }\n\n return await response.json();\n }\n\n async getConsumerGroupOffsets(\n clusterId: string,\n consumerGroup: string,\n ): Promise<ConsumerGroupOffsetsResponse> {\n return await this.internalGet(\n `/consumers/${clusterId}/${consumerGroup}/offsets`,\n );\n }\n}\n","/*\n * Copyright 2020 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 { createApiRef } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\n\nexport const kafkaApiRef = createApiRef<KafkaApi>({\n id: 'plugin.kafka.service',\n});\n\nexport const kafkaDashboardApiRef = createApiRef<KafkaDashboardApi>({\n id: 'plugin.kafka.dashboard',\n});\n\nexport type ConsumerGroupOffsetsResponse = {\n consumerId: string;\n offsets: {\n topic: string;\n partitionId: number;\n topicOffset: string;\n groupOffset: string;\n }[];\n};\n\nexport interface KafkaApi {\n getConsumerGroupOffsets(\n clusterId: string,\n consumerGroup: string,\n ): Promise<ConsumerGroupOffsetsResponse>;\n}\n\nexport interface KafkaDashboardApi {\n getDashboardUrl(\n clusterId: string,\n consumerGroup: string,\n entity: Entity,\n ): { url?: string };\n}\n","/*\n * Copyright 2020 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\n/** @public */\nexport const KAFKA_CONSUMER_GROUP_ANNOTATION =\n 'kafka.apache.org/consumer-groups';\n\nexport const KAFKA_DASHBOARD_URL = 'kafka.apache.org/dashboard-urls';\n","/*\n * Copyright 2020 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 { KafkaDashboardApi } from './types';\nimport { Entity } from '@backstage/catalog-model';\nimport { ConfigApi } from '@backstage/core-plugin-api';\nimport { KAFKA_DASHBOARD_URL } from '../constants';\n\nexport class KafkaDashboardClient implements KafkaDashboardApi {\n private readonly configApi: ConfigApi;\n private readonly regexPattern =\n /^([a-z0-9._-]+)\\/([a-z0-9._-]+)?\\/?(https?.*)$/i;\n\n constructor(options: { configApi: ConfigApi }) {\n this.configApi = options.configApi;\n }\n\n getDashboardUrl(\n clusterId: string,\n consumerGroup: string,\n entity: Entity,\n ): { url?: string } {\n const annotation = entity.metadata.annotations?.[KAFKA_DASHBOARD_URL] ?? '';\n\n const dashboardList = annotation\n .split(',')\n .filter(value => value !== undefined && value !== '')\n .map(value => value.match(this.regexPattern) as string[])\n .filter(\n value =>\n value[1] === clusterId &&\n (value[2] === undefined || value[2] === consumerGroup),\n )\n .sort((a, b) => {\n if (a[2] === b[2]) return 0;\n if (a[2] !== undefined) return -1;\n return 1;\n });\n\n if (dashboardList.length > 0) {\n return { url: dashboardList[0][3] };\n }\n\n return {\n url:\n this.configApi\n .getConfigArray('kafka.clusters')\n .filter(value => value.getString('name') === clusterId)\n .map(value => value.getOptionalString('dashboardUrl'))[0] ||\n undefined,\n };\n }\n}\n","/*\n * Copyright 2020 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 { KafkaBackendClient } from './api/KafkaBackendClient';\nimport { kafkaApiRef, kafkaDashboardApiRef } from './api/types';\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n createRouteRef,\n discoveryApiRef,\n identityApiRef,\n configApiRef,\n} from '@backstage/core-plugin-api';\nimport { KafkaDashboardClient } from './api/KafkaDashboardClient';\n\n/** @public */\nexport const rootCatalogKafkaRouteRef = createRouteRef({\n id: 'kafka',\n});\n\n/** @public */\nexport const kafkaPlugin = createPlugin({\n id: 'kafka',\n apis: [\n createApiFactory({\n api: kafkaApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new KafkaBackendClient({ discoveryApi, identityApi }),\n }),\n createApiFactory({\n api: kafkaDashboardApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => new KafkaDashboardClient({ configApi }),\n }),\n ],\n routes: {\n entityContent: rootCatalogKafkaRouteRef,\n },\n});\n\n/** @public */\nexport const EntityKafkaContent = kafkaPlugin.provide(\n createRoutableExtension({\n name: 'EntityKafkaContent',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootCatalogKafkaRouteRef,\n }),\n);\n","/*\n * Copyright 2020 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 { useEntity } from '@backstage/plugin-catalog-react';\nimport { useMemo } from 'react';\nimport { KAFKA_CONSUMER_GROUP_ANNOTATION } from '../../constants';\n\nexport const useConsumerGroupsForEntity = () => {\n const { entity } = useEntity();\n const annotation =\n entity.metadata.annotations?.[KAFKA_CONSUMER_GROUP_ANNOTATION] ?? '';\n\n return useMemo(() => {\n return annotation.split(',').map(consumer => {\n const [clusterId, consumerGroup] = consumer.split('/');\n\n if (!clusterId || !consumerGroup) {\n throw new Error(\n `Failed to parse kafka consumer group annotation: got \"${annotation}\"`,\n );\n }\n\n return {\n clusterId: clusterId.trim(),\n consumerGroup: consumerGroup.trim(),\n };\n });\n }, [annotation]);\n};\n","/*\n * Copyright 2020 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 useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { kafkaApiRef, kafkaDashboardApiRef } from '../../api/types';\nimport { useConsumerGroupsForEntity } from './useConsumerGroupsForEntity';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nexport const useConsumerGroupsOffsetsForEntity = () => {\n const consumers = useConsumerGroupsForEntity();\n const { entity } = useEntity();\n const api = useApi(kafkaApiRef);\n const apiDashboard = useApi(kafkaDashboardApiRef);\n const errorApi = useApi(errorApiRef);\n\n const {\n loading,\n value: consumerGroupsTopics,\n retry,\n } = useAsyncRetry(async () => {\n try {\n return await Promise.all(\n consumers.map(async ({ clusterId, consumerGroup }) => {\n const response = await api.getConsumerGroupOffsets(\n clusterId,\n consumerGroup,\n );\n return {\n clusterId,\n dashboardUrl: apiDashboard.getDashboardUrl(\n clusterId,\n consumerGroup,\n entity,\n ).url,\n consumerGroup,\n topics: response.offsets,\n };\n }),\n );\n } catch (e) {\n errorApi.post(e);\n throw e;\n }\n }, [consumers, api, apiDashboard, errorApi, entity]);\n\n return [\n {\n loading,\n consumerGroupsTopics,\n },\n {\n retry,\n },\n ] as const;\n};\n","/*\n * Copyright 2020 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 Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport RetryIcon from '@material-ui/icons/Replay';\nimport React from 'react';\nimport { useConsumerGroupsOffsetsForEntity } from './useConsumerGroupsOffsetsForEntity';\nimport { Table, TableColumn, Link } from '@backstage/core-components';\n\nexport type TopicPartitionInfo = {\n topic: string;\n partitionId: number;\n topicOffset: string;\n groupOffset: string;\n};\n\nconst generatedColumns: TableColumn[] = [\n {\n title: 'Topic',\n field: 'topic',\n highlight: true,\n render: (row: Partial<TopicPartitionInfo>) => {\n return <>{row.topic ?? ''}</>;\n },\n },\n {\n title: 'Partition',\n field: 'partitionId',\n render: (row: Partial<TopicPartitionInfo>) => {\n return <>{row.partitionId ?? ''}</>;\n },\n },\n {\n title: 'Topic Offset',\n field: 'topicOffset',\n render: (row: Partial<TopicPartitionInfo>) => {\n return <>{row.topicOffset ?? ''}</>;\n },\n },\n {\n title: 'Group Offset',\n field: 'groupOffset',\n render: (row: Partial<TopicPartitionInfo>) => {\n return <>{row.groupOffset ?? ''}</>;\n },\n },\n {\n title: 'Lag',\n field: 'lag',\n render: (row: Partial<TopicPartitionInfo>) => {\n let lag = undefined;\n if (row.topicOffset && row.groupOffset) {\n lag = +row.topicOffset - +row.groupOffset;\n }\n return <>{lag ?? ''}</>;\n },\n },\n];\n\ntype Props = {\n loading: boolean;\n retry: () => void;\n clusterId: string;\n dashboardUrl?: string;\n consumerGroup: string;\n topics?: TopicPartitionInfo[];\n};\n\nexport const ConsumerGroupOffsets = ({\n loading,\n topics,\n clusterId,\n dashboardUrl,\n consumerGroup,\n retry,\n}: Props) => {\n return (\n <Table\n isLoading={loading}\n actions={[\n {\n icon: () => <RetryIcon />,\n tooltip: 'Refresh Data',\n isFreeAction: true,\n onClick: () => retry(),\n },\n ]}\n data={topics ?? []}\n title={\n <Box display=\"flex\" alignItems=\"center\">\n <Typography variant=\"h6\">\n Consumed Topics for {consumerGroup} (\n {(dashboardUrl && <Link to={dashboardUrl}>{clusterId}</Link>) ||\n clusterId}\n )\n </Typography>\n </Box>\n }\n columns={generatedColumns}\n />\n );\n};\n\nexport const KafkaTopicsForConsumer = () => {\n const [tableProps, { retry }] = useConsumerGroupsOffsetsForEntity();\n return (\n <Grid container spacing={3}>\n {tableProps.consumerGroupsTopics?.map(consumerGroup => (\n <Grid item xs={12} key={consumerGroup.clusterId}>\n <ConsumerGroupOffsets\n {...consumerGroup}\n loading={tableProps.loading}\n retry={retry}\n />\n </Grid>\n ))}\n </Grid>\n );\n};\n","/*\n * Copyright 2020 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 { Entity } from '@backstage/catalog-model';\nimport React from 'react';\nimport { Route, Routes } from 'react-router-dom';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { KAFKA_CONSUMER_GROUP_ANNOTATION } from './constants';\nimport { KafkaTopicsForConsumer } from './components/ConsumerGroupOffsets/ConsumerGroupOffsets';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[KAFKA_CONSUMER_GROUP_ANNOTATION]);\n\n/** @public */\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (!isPluginApplicableToEntity(entity)) {\n return (\n <MissingAnnotationEmptyState\n annotation={KAFKA_CONSUMER_GROUP_ANNOTATION}\n />\n );\n }\n\n return (\n <Routes>\n <Route path=\"/\" element={<KafkaTopicsForConsumer />} />\n </Routes>\n );\n};\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BAAA,GAA6B,CAAC,MAAgB,KAAA;AA3B3D,EAAA,IAAA,EAAA,CAAA;AA4BE,EAAA,OAAA,OAAA,CAAA,CAAQ,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,WAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA8B,+BAAgC,CAAA,CAAA,CAAA;AAAA,EAAA;AAGjE,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAI,IAAA,CAAC,0BAA2B,CAAA,MAAM,CAAG,EAAA;AACvC,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,2BAAA;AAAA,MAAA;AAAA,QACC,UAAY,EAAA,+BAAA;AAAA,OAAA;AAAA,KACd,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,KAAI,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,sBAAuB,EAAA,IAAA,CAAA,EAAI,CACvD,CAAA,CAAA;AAEJ;;;;;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage-community/plugin-kafka",
|
|
3
|
+
"version": "0.3.35",
|
|
4
|
+
"description": "A Backstage plugin that integrates towards Kafka",
|
|
5
|
+
"backstage": {
|
|
6
|
+
"role": "frontend-plugin"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"main": "dist/index.esm.js",
|
|
11
|
+
"types": "dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://backstage.io",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/backstage/community-plugins",
|
|
17
|
+
"directory": "workspaces/kafka/plugins/kafka"
|
|
18
|
+
},
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"main": "dist/index.esm.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"config.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "backstage-cli package build",
|
|
29
|
+
"clean": "backstage-cli package clean",
|
|
30
|
+
"lint": "backstage-cli package lint",
|
|
31
|
+
"prepack": "backstage-cli package prepack",
|
|
32
|
+
"postpack": "backstage-cli package postpack",
|
|
33
|
+
"start": "backstage-cli package start",
|
|
34
|
+
"test": "backstage-cli package test"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@backstage/catalog-model": "^1.4.5",
|
|
38
|
+
"@backstage/core-components": "^0.14.4",
|
|
39
|
+
"@backstage/core-plugin-api": "^1.9.2",
|
|
40
|
+
"@backstage/plugin-catalog-react": "^1.11.3",
|
|
41
|
+
"@material-ui/core": "^4.12.2",
|
|
42
|
+
"@material-ui/icons": "^4.9.1",
|
|
43
|
+
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
44
|
+
"react-use": "^17.2.4"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@backstage/cli": "^0.26.3",
|
|
48
|
+
"@backstage/dev-utils": "^1.0.31",
|
|
49
|
+
"@backstage/test-utils": "^1.5.4",
|
|
50
|
+
"@testing-library/dom": "^10.0.0",
|
|
51
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
52
|
+
"@testing-library/react": "^15.0.0",
|
|
53
|
+
"@types/react-dom": "^18.2.19",
|
|
54
|
+
"canvas": "^2.11.2",
|
|
55
|
+
"jest-when": "^3.1.0",
|
|
56
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
57
|
+
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
58
|
+
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
62
|
+
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
63
|
+
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
64
|
+
},
|
|
65
|
+
"configSchema": "config.d.ts",
|
|
66
|
+
"module": "./dist/index.esm.js"
|
|
67
|
+
}
|