@selentar/analitoly 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/LICENSE +21 -0
- package/README.md +93 -0
- package/api/dist/dashboards/dash_1775220041958_v1r8io.json +829 -0
- package/api/dist/dashboards/dash_1775222037264_1rrsrd.json +309 -0
- package/api/dist/src/agent/agent.controller.d.ts +26 -0
- package/api/dist/src/agent/agent.controller.js +124 -0
- package/api/dist/src/agent/agent.controller.js.map +1 -0
- package/api/dist/src/agent/agent.module.d.ts +2 -0
- package/api/dist/src/agent/agent.module.js +23 -0
- package/api/dist/src/agent/agent.module.js.map +1 -0
- package/api/dist/src/agent/agent.service.d.ts +39 -0
- package/api/dist/src/agent/agent.service.js +389 -0
- package/api/dist/src/agent/agent.service.js.map +1 -0
- package/api/dist/src/agent/mcp-config.d.ts +9 -0
- package/api/dist/src/agent/mcp-config.js +51 -0
- package/api/dist/src/agent/mcp-config.js.map +1 -0
- package/api/dist/src/app.module.d.ts +2 -0
- package/api/dist/src/app.module.js +52 -0
- package/api/dist/src/app.module.js.map +1 -0
- package/api/dist/src/chart/chart.controller.d.ts +8 -0
- package/api/dist/src/chart/chart.controller.js +38 -0
- package/api/dist/src/chart/chart.controller.js.map +1 -0
- package/api/dist/src/chart/chart.module.d.ts +2 -0
- package/api/dist/src/chart/chart.module.js +24 -0
- package/api/dist/src/chart/chart.module.js.map +1 -0
- package/api/dist/src/chart/chart.service.d.ts +32 -0
- package/api/dist/src/chart/chart.service.js +106 -0
- package/api/dist/src/chart/chart.service.js.map +1 -0
- package/api/dist/src/chat/chat.controller.d.ts +14 -0
- package/api/dist/src/chat/chat.controller.js +73 -0
- package/api/dist/src/chat/chat.controller.js.map +1 -0
- package/api/dist/src/chat/chat.module.d.ts +2 -0
- package/api/dist/src/chat/chat.module.js +22 -0
- package/api/dist/src/chat/chat.module.js.map +1 -0
- package/api/dist/src/chat/chat.service.d.ts +25 -0
- package/api/dist/src/chat/chat.service.js +168 -0
- package/api/dist/src/chat/chat.service.js.map +1 -0
- package/api/dist/src/connection/connection.controller.d.ts +46 -0
- package/api/dist/src/connection/connection.controller.js +189 -0
- package/api/dist/src/connection/connection.controller.js.map +1 -0
- package/api/dist/src/connection/connection.model.d.ts +116 -0
- package/api/dist/src/connection/connection.model.js +23 -0
- package/api/dist/src/connection/connection.model.js.map +1 -0
- package/api/dist/src/connection/connection.module.d.ts +2 -0
- package/api/dist/src/connection/connection.module.js +31 -0
- package/api/dist/src/connection/connection.module.js.map +1 -0
- package/api/dist/src/connection/connection.repository.d.ts +16 -0
- package/api/dist/src/connection/connection.repository.js +195 -0
- package/api/dist/src/connection/connection.repository.js.map +1 -0
- package/api/dist/src/connection/connection.service.d.ts +50 -0
- package/api/dist/src/connection/connection.service.js +343 -0
- package/api/dist/src/connection/connection.service.js.map +1 -0
- package/api/dist/src/context/context.controller.d.ts +13 -0
- package/api/dist/src/context/context.controller.js +86 -0
- package/api/dist/src/context/context.controller.js.map +1 -0
- package/api/dist/src/context/context.module.d.ts +2 -0
- package/api/dist/src/context/context.module.js +39 -0
- package/api/dist/src/context/context.module.js.map +1 -0
- package/api/dist/src/context/context.service.d.ts +32 -0
- package/api/dist/src/context/context.service.js +177 -0
- package/api/dist/src/context/context.service.js.map +1 -0
- package/api/dist/src/dashboard/dashboard.controller.d.ts +21 -0
- package/api/dist/src/dashboard/dashboard.controller.js +109 -0
- package/api/dist/src/dashboard/dashboard.controller.js.map +1 -0
- package/api/dist/src/dashboard/dashboard.model.d.ts +15 -0
- package/api/dist/src/dashboard/dashboard.model.js +3 -0
- package/api/dist/src/dashboard/dashboard.model.js.map +1 -0
- package/api/dist/src/dashboard/dashboard.module.d.ts +2 -0
- package/api/dist/src/dashboard/dashboard.module.js +24 -0
- package/api/dist/src/dashboard/dashboard.module.js.map +1 -0
- package/api/dist/src/dashboard/dashboard.repository.d.ts +9 -0
- package/api/dist/src/dashboard/dashboard.repository.js +72 -0
- package/api/dist/src/dashboard/dashboard.repository.js.map +1 -0
- package/api/dist/src/dashboard/dashboard.service.d.ts +14 -0
- package/api/dist/src/dashboard/dashboard.service.js +87 -0
- package/api/dist/src/dashboard/dashboard.service.js.map +1 -0
- package/api/dist/src/datasource/connectors/connector.interface.d.ts +6 -0
- package/api/dist/src/datasource/connectors/connector.interface.js +3 -0
- package/api/dist/src/datasource/connectors/connector.interface.js.map +1 -0
- package/api/dist/src/datasource/connectors/mongo.connector.d.ts +30 -0
- package/api/dist/src/datasource/connectors/mongo.connector.js +167 -0
- package/api/dist/src/datasource/connectors/mongo.connector.js.map +1 -0
- package/api/dist/src/datasource/connectors/mongo.connector.test.d.ts +1 -0
- package/api/dist/src/datasource/connectors/mongo.connector.test.js +179 -0
- package/api/dist/src/datasource/connectors/mongo.connector.test.js.map +1 -0
- package/api/dist/src/datasource/connectors/postgres.connector.d.ts +50 -0
- package/api/dist/src/datasource/connectors/postgres.connector.js +213 -0
- package/api/dist/src/datasource/connectors/postgres.connector.js.map +1 -0
- package/api/dist/src/datasource/connectors/postgres.connector.test.d.ts +1 -0
- package/api/dist/src/datasource/connectors/postgres.connector.test.js +197 -0
- package/api/dist/src/datasource/connectors/postgres.connector.test.js.map +1 -0
- package/api/dist/src/datasource/datasource.controller.d.ts +16 -0
- package/api/dist/src/datasource/datasource.controller.js +79 -0
- package/api/dist/src/datasource/datasource.controller.js.map +1 -0
- package/api/dist/src/datasource/datasource.model.d.ts +26 -0
- package/api/dist/src/datasource/datasource.model.js +3 -0
- package/api/dist/src/datasource/datasource.model.js.map +1 -0
- package/api/dist/src/datasource/datasource.module.d.ts +2 -0
- package/api/dist/src/datasource/datasource.module.js +31 -0
- package/api/dist/src/datasource/datasource.module.js.map +1 -0
- package/api/dist/src/datasource/datasource.repository.d.ts +11 -0
- package/api/dist/src/datasource/datasource.repository.js +61 -0
- package/api/dist/src/datasource/datasource.repository.js.map +1 -0
- package/api/dist/src/datasource/datasource.service.d.ts +28 -0
- package/api/dist/src/datasource/datasource.service.js +95 -0
- package/api/dist/src/datasource/datasource.service.js.map +1 -0
- package/api/dist/src/example/example.controller.d.ts +10 -0
- package/api/dist/src/example/example.controller.js +43 -0
- package/api/dist/src/example/example.controller.js.map +1 -0
- package/api/dist/src/example/example.model.d.ts +6 -0
- package/api/dist/src/example/example.model.js +3 -0
- package/api/dist/src/example/example.model.js.map +1 -0
- package/api/dist/src/example/example.module.d.ts +2 -0
- package/api/dist/src/example/example.module.js +23 -0
- package/api/dist/src/example/example.module.js.map +1 -0
- package/api/dist/src/example/example.repository.d.ts +6 -0
- package/api/dist/src/example/example.repository.js +30 -0
- package/api/dist/src/example/example.repository.js.map +1 -0
- package/api/dist/src/example/example.service.d.ts +10 -0
- package/api/dist/src/example/example.service.js +31 -0
- package/api/dist/src/example/example.service.js.map +1 -0
- package/api/dist/src/integration/integration.controller.d.ts +15 -0
- package/api/dist/src/integration/integration.controller.js +69 -0
- package/api/dist/src/integration/integration.controller.js.map +1 -0
- package/api/dist/src/integration/integration.model.d.ts +17 -0
- package/api/dist/src/integration/integration.model.js +3 -0
- package/api/dist/src/integration/integration.model.js.map +1 -0
- package/api/dist/src/integration/integration.module.d.ts +2 -0
- package/api/dist/src/integration/integration.module.js +24 -0
- package/api/dist/src/integration/integration.module.js.map +1 -0
- package/api/dist/src/integration/integration.repository.d.ts +6 -0
- package/api/dist/src/integration/integration.repository.js +45 -0
- package/api/dist/src/integration/integration.repository.js.map +1 -0
- package/api/dist/src/integration/integration.service.d.ts +12 -0
- package/api/dist/src/integration/integration.service.js +78 -0
- package/api/dist/src/integration/integration.service.js.map +1 -0
- package/api/dist/src/main.d.ts +1 -0
- package/api/dist/src/main.js +19 -0
- package/api/dist/src/main.js.map +1 -0
- package/api/dist/src/mcp/grafana.mcp.d.ts +1 -0
- package/api/dist/src/mcp/grafana.mcp.js +95 -0
- package/api/dist/src/mcp/grafana.mcp.js.map +1 -0
- package/api/dist/src/mcp/graylog.mcp.d.ts +1 -0
- package/api/dist/src/mcp/graylog.mcp.js +241 -0
- package/api/dist/src/mcp/graylog.mcp.js.map +1 -0
- package/api/dist/src/mcp/mcp-server.d.ts +1 -0
- package/api/dist/src/mcp/mcp-server.js +336 -0
- package/api/dist/src/mcp/mcp-server.js.map +1 -0
- package/api/dist/src/paths.d.ts +8 -0
- package/api/dist/src/paths.js +50 -0
- package/api/dist/src/paths.js.map +1 -0
- package/api/dist/src/paths.test.d.ts +1 -0
- package/api/dist/src/paths.test.js +60 -0
- package/api/dist/src/paths.test.js.map +1 -0
- package/api/dist/src/project/project.controller.d.ts +44 -0
- package/api/dist/src/project/project.controller.js +79 -0
- package/api/dist/src/project/project.controller.js.map +1 -0
- package/api/dist/src/project/project.model.d.ts +19 -0
- package/api/dist/src/project/project.model.js +3 -0
- package/api/dist/src/project/project.model.js.map +1 -0
- package/api/dist/src/project/project.module.d.ts +2 -0
- package/api/dist/src/project/project.module.js +24 -0
- package/api/dist/src/project/project.module.js.map +1 -0
- package/api/dist/src/project/project.repository.d.ts +6 -0
- package/api/dist/src/project/project.repository.js +52 -0
- package/api/dist/src/project/project.repository.js.map +1 -0
- package/api/dist/src/project/project.service.d.ts +17 -0
- package/api/dist/src/project/project.service.js +163 -0
- package/api/dist/src/project/project.service.js.map +1 -0
- package/api/dist/tsconfig.tsbuildinfo +1 -0
- package/api/dist/vitest.config.d.ts +2 -0
- package/api/dist/vitest.config.js +10 -0
- package/api/dist/vitest.config.js.map +1 -0
- package/api/public/dist/Analitoly.png +0 -0
- package/api/public/dist/AnalitolyShort.png +0 -0
- package/api/public/dist/Gitlab.png +0 -0
- package/api/public/dist/Grafana.png +0 -0
- package/api/public/dist/Graylog.png +0 -0
- package/api/public/dist/Mongodb.png +0 -0
- package/api/public/dist/PostgreSQL.png +0 -0
- package/api/public/dist/assets/index-BPB3ckw4.js +222 -0
- package/api/public/dist/assets/index-CSAGa0SG.js +227 -0
- package/api/public/dist/index.html +12 -0
- package/bin/analitoly-mcp.js +18 -0
- package/bin/analitoly.js +38 -0
- package/package.json +54 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ConnectionController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const connection_service_1 = require("./connection.service");
|
|
18
|
+
let ConnectionController = class ConnectionController {
|
|
19
|
+
constructor(service) {
|
|
20
|
+
this.service = service;
|
|
21
|
+
}
|
|
22
|
+
getAll(includeDeleted) {
|
|
23
|
+
return this.service.getAll(includeDeleted === 'true');
|
|
24
|
+
}
|
|
25
|
+
exportConnections() {
|
|
26
|
+
return this.service.exportConnections();
|
|
27
|
+
}
|
|
28
|
+
getDashboard() {
|
|
29
|
+
return this.service.getDashboard();
|
|
30
|
+
}
|
|
31
|
+
saveDashboard(body) {
|
|
32
|
+
return this.service.saveDashboard(body.charts ?? []);
|
|
33
|
+
}
|
|
34
|
+
getByType(type) {
|
|
35
|
+
return this.service.getByType(type);
|
|
36
|
+
}
|
|
37
|
+
getById(id) {
|
|
38
|
+
return this.service.getById(id);
|
|
39
|
+
}
|
|
40
|
+
create(dto) {
|
|
41
|
+
return this.service.create(dto);
|
|
42
|
+
}
|
|
43
|
+
async testConfig(body) {
|
|
44
|
+
return this.service.testConnectionConfig(body.type, body.config);
|
|
45
|
+
}
|
|
46
|
+
importConnections(body) {
|
|
47
|
+
return this.service.importConnections(body);
|
|
48
|
+
}
|
|
49
|
+
update(id, dto) {
|
|
50
|
+
return this.service.update(id, dto);
|
|
51
|
+
}
|
|
52
|
+
delete(id) {
|
|
53
|
+
this.service.delete(id);
|
|
54
|
+
return { ok: true };
|
|
55
|
+
}
|
|
56
|
+
async testConnection(id) {
|
|
57
|
+
return this.service.testConnection(id);
|
|
58
|
+
}
|
|
59
|
+
async activate(id) {
|
|
60
|
+
return this.service.activate(id);
|
|
61
|
+
}
|
|
62
|
+
deactivate(id) {
|
|
63
|
+
return this.service.deactivate(id);
|
|
64
|
+
}
|
|
65
|
+
async connectProject(id) {
|
|
66
|
+
return this.service.connectProject(id);
|
|
67
|
+
}
|
|
68
|
+
async disconnectProject(id) {
|
|
69
|
+
await this.service.disconnectProject(id);
|
|
70
|
+
return { ok: true };
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.ConnectionController = ConnectionController;
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, common_1.Get)(),
|
|
76
|
+
__param(0, (0, common_1.Query)('includeDeleted')),
|
|
77
|
+
__metadata("design:type", Function),
|
|
78
|
+
__metadata("design:paramtypes", [String]),
|
|
79
|
+
__metadata("design:returntype", void 0)
|
|
80
|
+
], ConnectionController.prototype, "getAll", null);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, common_1.Get)('export'),
|
|
83
|
+
__metadata("design:type", Function),
|
|
84
|
+
__metadata("design:paramtypes", []),
|
|
85
|
+
__metadata("design:returntype", void 0)
|
|
86
|
+
], ConnectionController.prototype, "exportConnections", null);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, common_1.Get)('dashboard'),
|
|
89
|
+
__metadata("design:type", Function),
|
|
90
|
+
__metadata("design:paramtypes", []),
|
|
91
|
+
__metadata("design:returntype", void 0)
|
|
92
|
+
], ConnectionController.prototype, "getDashboard", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, common_1.Put)('dashboard'),
|
|
95
|
+
__param(0, (0, common_1.Body)()),
|
|
96
|
+
__metadata("design:type", Function),
|
|
97
|
+
__metadata("design:paramtypes", [Object]),
|
|
98
|
+
__metadata("design:returntype", void 0)
|
|
99
|
+
], ConnectionController.prototype, "saveDashboard", null);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, common_1.Get)('type/:type'),
|
|
102
|
+
__param(0, (0, common_1.Param)('type')),
|
|
103
|
+
__metadata("design:type", Function),
|
|
104
|
+
__metadata("design:paramtypes", [String]),
|
|
105
|
+
__metadata("design:returntype", void 0)
|
|
106
|
+
], ConnectionController.prototype, "getByType", null);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, common_1.Get)(':id'),
|
|
109
|
+
__param(0, (0, common_1.Param)('id')),
|
|
110
|
+
__metadata("design:type", Function),
|
|
111
|
+
__metadata("design:paramtypes", [String]),
|
|
112
|
+
__metadata("design:returntype", void 0)
|
|
113
|
+
], ConnectionController.prototype, "getById", null);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, common_1.Post)(),
|
|
116
|
+
__param(0, (0, common_1.Body)()),
|
|
117
|
+
__metadata("design:type", Function),
|
|
118
|
+
__metadata("design:paramtypes", [Object]),
|
|
119
|
+
__metadata("design:returntype", void 0)
|
|
120
|
+
], ConnectionController.prototype, "create", null);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, common_1.Post)('test'),
|
|
123
|
+
__param(0, (0, common_1.Body)()),
|
|
124
|
+
__metadata("design:type", Function),
|
|
125
|
+
__metadata("design:paramtypes", [Object]),
|
|
126
|
+
__metadata("design:returntype", Promise)
|
|
127
|
+
], ConnectionController.prototype, "testConfig", null);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, common_1.Post)('import'),
|
|
130
|
+
__param(0, (0, common_1.Body)()),
|
|
131
|
+
__metadata("design:type", Function),
|
|
132
|
+
__metadata("design:paramtypes", [Object]),
|
|
133
|
+
__metadata("design:returntype", void 0)
|
|
134
|
+
], ConnectionController.prototype, "importConnections", null);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, common_1.Patch)(':id'),
|
|
137
|
+
__param(0, (0, common_1.Param)('id')),
|
|
138
|
+
__param(1, (0, common_1.Body)()),
|
|
139
|
+
__metadata("design:type", Function),
|
|
140
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
141
|
+
__metadata("design:returntype", void 0)
|
|
142
|
+
], ConnectionController.prototype, "update", null);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, common_1.Delete)(':id'),
|
|
145
|
+
__param(0, (0, common_1.Param)('id')),
|
|
146
|
+
__metadata("design:type", Function),
|
|
147
|
+
__metadata("design:paramtypes", [String]),
|
|
148
|
+
__metadata("design:returntype", void 0)
|
|
149
|
+
], ConnectionController.prototype, "delete", null);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, common_1.Post)(':id/test'),
|
|
152
|
+
__param(0, (0, common_1.Param)('id')),
|
|
153
|
+
__metadata("design:type", Function),
|
|
154
|
+
__metadata("design:paramtypes", [String]),
|
|
155
|
+
__metadata("design:returntype", Promise)
|
|
156
|
+
], ConnectionController.prototype, "testConnection", null);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, common_1.Post)(':id/activate'),
|
|
159
|
+
__param(0, (0, common_1.Param)('id')),
|
|
160
|
+
__metadata("design:type", Function),
|
|
161
|
+
__metadata("design:paramtypes", [String]),
|
|
162
|
+
__metadata("design:returntype", Promise)
|
|
163
|
+
], ConnectionController.prototype, "activate", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, common_1.Post)(':id/deactivate'),
|
|
166
|
+
__param(0, (0, common_1.Param)('id')),
|
|
167
|
+
__metadata("design:type", Function),
|
|
168
|
+
__metadata("design:paramtypes", [String]),
|
|
169
|
+
__metadata("design:returntype", void 0)
|
|
170
|
+
], ConnectionController.prototype, "deactivate", null);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, common_1.Post)(':id/connect'),
|
|
173
|
+
__param(0, (0, common_1.Param)('id')),
|
|
174
|
+
__metadata("design:type", Function),
|
|
175
|
+
__metadata("design:paramtypes", [String]),
|
|
176
|
+
__metadata("design:returntype", Promise)
|
|
177
|
+
], ConnectionController.prototype, "connectProject", null);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, common_1.Post)(':id/disconnect'),
|
|
180
|
+
__param(0, (0, common_1.Param)('id')),
|
|
181
|
+
__metadata("design:type", Function),
|
|
182
|
+
__metadata("design:paramtypes", [String]),
|
|
183
|
+
__metadata("design:returntype", Promise)
|
|
184
|
+
], ConnectionController.prototype, "disconnectProject", null);
|
|
185
|
+
exports.ConnectionController = ConnectionController = __decorate([
|
|
186
|
+
(0, common_1.Controller)('connections'),
|
|
187
|
+
__metadata("design:paramtypes", [connection_service_1.ConnectionService])
|
|
188
|
+
], ConnectionController);
|
|
189
|
+
//# sourceMappingURL=connection.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.controller.js","sourceRoot":"","sources":["../../../src/connection/connection.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+F;AAC/F,6DAAyD;AAIlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAA6B,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAG3D,MAAM,CAA0B,cAAuB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,KAAK,MAAM,CAAC,CAAC;IACxD,CAAC;IAGD,iBAAiB;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,CAAC;IAGD,YAAY;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,E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AA,cAAK,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kDAEtC;AAGD;IADC,IAAA,eAAM,EAAC,KAAK,CAAC;IACN,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;kDAGlB;AAGK;IADL,IAAA,aAAI,EAAC,UAAU,CAAC;IACK,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;0DAEhC;AAGK;IADL,IAAA,aAAI,EAAC,cAAc,CAAC;IACL,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;oDAE1B;AAGD;IADC,IAAA,aAAI,EAAC,gBAAgB,CAAC;IACX,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;sDAEtB;AAGK;IADL,IAAA,aAAI,EAAC,aAAa,CAAC;IACE,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;0DAEhC;AAGK;IADL,IAAA,aAAI,EAAC,gBAAgB,CAAC;IACE,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;6DAGnC;+BAnFU,oBAAoB;IADhC,IAAA,mBAAU,EAAC,aAAa,CAAC;qCAEc,sCAAiB;GAD5C,oBAAoB,CAoFhC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export type ConnectionCategory = 'database' | 'analytics' | 'repository';
|
|
2
|
+
export type ConnectionType = 'postgresql' | 'mongodb' | 'graylog' | 'grafana' | 'local' | 'gitlab';
|
|
3
|
+
export interface PostgresqlConfig {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
database: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
schema?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MongodbConfig {
|
|
12
|
+
host: string;
|
|
13
|
+
port: number;
|
|
14
|
+
database: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
password?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GraylogConfig {
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
username: string;
|
|
21
|
+
password: string;
|
|
22
|
+
}
|
|
23
|
+
export interface GrafanaConfig {
|
|
24
|
+
url: string;
|
|
25
|
+
serviceAccountToken: string;
|
|
26
|
+
}
|
|
27
|
+
export interface LocalConfig {
|
|
28
|
+
path: string;
|
|
29
|
+
}
|
|
30
|
+
export interface GitlabConfig {
|
|
31
|
+
url: string;
|
|
32
|
+
token: string;
|
|
33
|
+
branch?: string;
|
|
34
|
+
}
|
|
35
|
+
export type ConnectionConfig = PostgresqlConfig | MongodbConfig | GraylogConfig | GrafanaConfig | LocalConfig | GitlabConfig;
|
|
36
|
+
export interface RepositoryState {
|
|
37
|
+
localPath: string;
|
|
38
|
+
status: 'cloning' | 'ready' | 'error';
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface Connection {
|
|
42
|
+
id: string;
|
|
43
|
+
category: ConnectionCategory;
|
|
44
|
+
type: ConnectionType;
|
|
45
|
+
name: string;
|
|
46
|
+
active: boolean;
|
|
47
|
+
deletedAt: string | null;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
config: ConnectionConfig;
|
|
51
|
+
state?: RepositoryState;
|
|
52
|
+
}
|
|
53
|
+
export interface ChartRebuildConfig {
|
|
54
|
+
datasourceType: 'postgresql' | 'mongodb';
|
|
55
|
+
connectionName?: string;
|
|
56
|
+
queryTemplate: string;
|
|
57
|
+
timeColumn: string;
|
|
58
|
+
timeFormat?: 'iso' | 'epoch_s' | 'epoch_ms';
|
|
59
|
+
echartsMapping: {
|
|
60
|
+
xField: string;
|
|
61
|
+
series: Array<{
|
|
62
|
+
yField: string;
|
|
63
|
+
name?: string;
|
|
64
|
+
type: string;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface DashboardChartConfig {
|
|
69
|
+
chartId: string;
|
|
70
|
+
title: string;
|
|
71
|
+
echartsOption: Record<string, unknown>;
|
|
72
|
+
description: string;
|
|
73
|
+
sourceQuery: string;
|
|
74
|
+
rebuildConfig?: ChartRebuildConfig;
|
|
75
|
+
}
|
|
76
|
+
export interface ConfigFile {
|
|
77
|
+
version: number;
|
|
78
|
+
connections: Connection[];
|
|
79
|
+
dashboard?: DashboardChartConfig[];
|
|
80
|
+
}
|
|
81
|
+
export interface CreateConnectionDto {
|
|
82
|
+
type: ConnectionType;
|
|
83
|
+
name: string;
|
|
84
|
+
config: ConnectionConfig;
|
|
85
|
+
active?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface UpdateConnectionDto {
|
|
88
|
+
name?: string;
|
|
89
|
+
config?: ConnectionConfig;
|
|
90
|
+
active?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface ExportableConnection {
|
|
93
|
+
type: ConnectionType;
|
|
94
|
+
name: string;
|
|
95
|
+
config: ConnectionConfig;
|
|
96
|
+
}
|
|
97
|
+
export interface ExportDashboardChart {
|
|
98
|
+
chartId: string;
|
|
99
|
+
title: string;
|
|
100
|
+
echartsOption: Record<string, unknown>;
|
|
101
|
+
description: string;
|
|
102
|
+
sourceQuery: string;
|
|
103
|
+
rebuildConfig?: ChartRebuildConfig;
|
|
104
|
+
}
|
|
105
|
+
export interface ExportFile {
|
|
106
|
+
version: number;
|
|
107
|
+
exportedAt: string;
|
|
108
|
+
connections: ExportableConnection[];
|
|
109
|
+
dashboard?: {
|
|
110
|
+
charts: ExportDashboardChart[];
|
|
111
|
+
};
|
|
112
|
+
context?: string;
|
|
113
|
+
}
|
|
114
|
+
export declare const CATEGORY_MAP: Record<ConnectionType, ConnectionCategory>;
|
|
115
|
+
export declare const SENSITIVE_FIELDS: Record<ConnectionType, string[]>;
|
|
116
|
+
export declare const CONNECTION_TYPES: ConnectionType[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONNECTION_TYPES = exports.SENSITIVE_FIELDS = exports.CATEGORY_MAP = void 0;
|
|
4
|
+
exports.CATEGORY_MAP = {
|
|
5
|
+
postgresql: 'database',
|
|
6
|
+
mongodb: 'database',
|
|
7
|
+
graylog: 'analytics',
|
|
8
|
+
grafana: 'analytics',
|
|
9
|
+
local: 'repository',
|
|
10
|
+
gitlab: 'repository',
|
|
11
|
+
};
|
|
12
|
+
exports.SENSITIVE_FIELDS = {
|
|
13
|
+
postgresql: ['password'],
|
|
14
|
+
mongodb: ['password'],
|
|
15
|
+
graylog: ['password'],
|
|
16
|
+
grafana: ['serviceAccountToken'],
|
|
17
|
+
local: [],
|
|
18
|
+
gitlab: ['token'],
|
|
19
|
+
};
|
|
20
|
+
exports.CONNECTION_TYPES = [
|
|
21
|
+
'postgresql', 'mongodb', 'graylog', 'grafana', 'local', 'gitlab',
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=connection.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.model.js","sourceRoot":"","sources":["../../../src/connection/connection.model.ts"],"names":[],"mappings":";;;AA8Ia,QAAA,YAAY,GAA+C;IACtE,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;CACrB,CAAC;AAEW,QAAA,gBAAgB,GAAqC;IAChE,UAAU,EAAE,CAAC,UAAU,CAAC;IACxB,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE,CAAC,qBAAqB,CAAC;IAChC,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,CAAC,OAAO,CAAC;CAClB,CAAC;AAEW,QAAA,gBAAgB,GAAqB;IAChD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ;CACjE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ConnectionModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const connection_controller_1 = require("./connection.controller");
|
|
12
|
+
const connection_service_1 = require("./connection.service");
|
|
13
|
+
const connection_repository_1 = require("./connection.repository");
|
|
14
|
+
const postgres_connector_1 = require("../datasource/connectors/postgres.connector");
|
|
15
|
+
const mongo_connector_1 = require("../datasource/connectors/mongo.connector");
|
|
16
|
+
let ConnectionModule = class ConnectionModule {
|
|
17
|
+
};
|
|
18
|
+
exports.ConnectionModule = ConnectionModule;
|
|
19
|
+
exports.ConnectionModule = ConnectionModule = __decorate([
|
|
20
|
+
(0, common_1.Module)({
|
|
21
|
+
controllers: [connection_controller_1.ConnectionController],
|
|
22
|
+
providers: [
|
|
23
|
+
connection_service_1.ConnectionService,
|
|
24
|
+
connection_repository_1.ConnectionRepository,
|
|
25
|
+
postgres_connector_1.PostgresConnector,
|
|
26
|
+
mongo_connector_1.MongoConnector,
|
|
27
|
+
],
|
|
28
|
+
exports: [connection_service_1.ConnectionService, connection_repository_1.ConnectionRepository],
|
|
29
|
+
})
|
|
30
|
+
], ConnectionModule);
|
|
31
|
+
//# sourceMappingURL=connection.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.module.js","sourceRoot":"","sources":["../../../src/connection/connection.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mEAA+D;AAC/D,6DAAyD;AACzD,mEAA+D;AAC/D,oFAAgF;AAChF,8EAA0E;AAWnE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,4CAAgB;2BAAhB,gBAAgB;IAV5B,IAAA,eAAM,EAAC;QACN,WAAW,EAAE,CAAC,4CAAoB,CAAC;QACnC,SAAS,EAAE;YACT,sCAAiB;YACjB,4CAAoB;YACpB,sCAAiB;YACjB,gCAAc;SACf;QACD,OAAO,EAAE,CAAC,sCAAiB,EAAE,4CAAoB,CAAC;KACnD,CAAC;GACW,gBAAgB,CAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Connection, ConnectionType, CreateConnectionDto, UpdateConnectionDto, DashboardChartConfig } from './connection.model';
|
|
2
|
+
export declare class ConnectionRepository {
|
|
3
|
+
private readFile;
|
|
4
|
+
private writeFile;
|
|
5
|
+
readAll(includeDeleted?: boolean): Connection[];
|
|
6
|
+
findById(id: string): Connection | undefined;
|
|
7
|
+
findByType(type: ConnectionType, includeDeleted?: boolean): Connection[];
|
|
8
|
+
findActive(type: ConnectionType): Connection | undefined;
|
|
9
|
+
create(dto: CreateConnectionDto): Connection;
|
|
10
|
+
update(id: string, dto: UpdateConnectionDto): Connection | undefined;
|
|
11
|
+
updateState(id: string, state: Connection['state']): Connection | undefined;
|
|
12
|
+
readDashboard(): DashboardChartConfig[];
|
|
13
|
+
writeDashboard(charts: DashboardChartConfig[]): void;
|
|
14
|
+
softDelete(id: string): Connection | undefined;
|
|
15
|
+
static migrateIfNeeded(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ConnectionRepository = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const crypto = require("crypto");
|
|
14
|
+
const connection_model_1 = require("./connection.model");
|
|
15
|
+
const paths_1 = require("../paths");
|
|
16
|
+
const DATA_DIR = (0, paths_1.dataDir)();
|
|
17
|
+
const FILE_PATH = (0, paths_1.configPath)();
|
|
18
|
+
const LEGACY_DATASOURCES = path.join(DATA_DIR, 'datasources.json');
|
|
19
|
+
const LEGACY_DATASOURCES_ROOT = path.join(process.cwd(), 'datasources.json');
|
|
20
|
+
const LEGACY_INTEGRATIONS = path.join(process.cwd(), 'integrations.json');
|
|
21
|
+
const LEGACY_PROJECT = path.join(DATA_DIR, 'project.json');
|
|
22
|
+
let ConnectionRepository = class ConnectionRepository {
|
|
23
|
+
readFile() {
|
|
24
|
+
if (!fs.existsSync(DATA_DIR))
|
|
25
|
+
fs.mkdirSync(DATA_DIR, { recursive: true });
|
|
26
|
+
if (!fs.existsSync(FILE_PATH))
|
|
27
|
+
return { version: 1, connections: [] };
|
|
28
|
+
return JSON.parse(fs.readFileSync(FILE_PATH, 'utf-8'));
|
|
29
|
+
}
|
|
30
|
+
writeFile(data) {
|
|
31
|
+
if (!fs.existsSync(DATA_DIR))
|
|
32
|
+
fs.mkdirSync(DATA_DIR, { recursive: true });
|
|
33
|
+
fs.writeFileSync(FILE_PATH, JSON.stringify(data, null, 2), 'utf-8');
|
|
34
|
+
}
|
|
35
|
+
readAll(includeDeleted = false) {
|
|
36
|
+
const data = this.readFile();
|
|
37
|
+
if (includeDeleted)
|
|
38
|
+
return data.connections;
|
|
39
|
+
return data.connections.filter((c) => !c.deletedAt);
|
|
40
|
+
}
|
|
41
|
+
findById(id) {
|
|
42
|
+
return this.readFile().connections.find((c) => c.id === id);
|
|
43
|
+
}
|
|
44
|
+
findByType(type, includeDeleted = false) {
|
|
45
|
+
return this.readAll(includeDeleted).filter((c) => c.type === type);
|
|
46
|
+
}
|
|
47
|
+
findActive(type) {
|
|
48
|
+
return this.readAll(false).find((c) => c.type === type && c.active);
|
|
49
|
+
}
|
|
50
|
+
create(dto) {
|
|
51
|
+
const data = this.readFile();
|
|
52
|
+
const now = new Date().toISOString();
|
|
53
|
+
const conn = {
|
|
54
|
+
id: crypto.randomUUID(),
|
|
55
|
+
category: connection_model_1.CATEGORY_MAP[dto.type],
|
|
56
|
+
type: dto.type,
|
|
57
|
+
name: dto.name,
|
|
58
|
+
active: dto.active ?? true,
|
|
59
|
+
deletedAt: null,
|
|
60
|
+
createdAt: now,
|
|
61
|
+
updatedAt: now,
|
|
62
|
+
config: dto.config,
|
|
63
|
+
};
|
|
64
|
+
data.connections.push(conn);
|
|
65
|
+
this.writeFile(data);
|
|
66
|
+
return conn;
|
|
67
|
+
}
|
|
68
|
+
update(id, dto) {
|
|
69
|
+
const data = this.readFile();
|
|
70
|
+
const idx = data.connections.findIndex((c) => c.id === id);
|
|
71
|
+
if (idx === -1)
|
|
72
|
+
return undefined;
|
|
73
|
+
const conn = data.connections[idx];
|
|
74
|
+
if (dto.name !== undefined)
|
|
75
|
+
conn.name = dto.name;
|
|
76
|
+
if (dto.config !== undefined)
|
|
77
|
+
conn.config = { ...conn.config, ...dto.config };
|
|
78
|
+
if (dto.active !== undefined)
|
|
79
|
+
conn.active = dto.active;
|
|
80
|
+
conn.updatedAt = new Date().toISOString();
|
|
81
|
+
data.connections[idx] = conn;
|
|
82
|
+
this.writeFile(data);
|
|
83
|
+
return conn;
|
|
84
|
+
}
|
|
85
|
+
updateState(id, state) {
|
|
86
|
+
const data = this.readFile();
|
|
87
|
+
const idx = data.connections.findIndex((c) => c.id === id);
|
|
88
|
+
if (idx === -1)
|
|
89
|
+
return undefined;
|
|
90
|
+
data.connections[idx].state = state;
|
|
91
|
+
data.connections[idx].updatedAt = new Date().toISOString();
|
|
92
|
+
this.writeFile(data);
|
|
93
|
+
return data.connections[idx];
|
|
94
|
+
}
|
|
95
|
+
readDashboard() {
|
|
96
|
+
return this.readFile().dashboard ?? [];
|
|
97
|
+
}
|
|
98
|
+
writeDashboard(charts) {
|
|
99
|
+
const data = this.readFile();
|
|
100
|
+
data.dashboard = charts;
|
|
101
|
+
this.writeFile(data);
|
|
102
|
+
}
|
|
103
|
+
softDelete(id) {
|
|
104
|
+
const data = this.readFile();
|
|
105
|
+
const idx = data.connections.findIndex((c) => c.id === id);
|
|
106
|
+
if (idx === -1)
|
|
107
|
+
return undefined;
|
|
108
|
+
const deleted = data.connections.splice(idx, 1)[0];
|
|
109
|
+
this.writeFile(data);
|
|
110
|
+
return deleted;
|
|
111
|
+
}
|
|
112
|
+
static migrateIfNeeded() {
|
|
113
|
+
if (!fs.existsSync(DATA_DIR))
|
|
114
|
+
fs.mkdirSync(DATA_DIR, { recursive: true });
|
|
115
|
+
if (fs.existsSync(FILE_PATH))
|
|
116
|
+
return;
|
|
117
|
+
console.log('[ConnectionRepository] Migrating legacy config files to config.json...');
|
|
118
|
+
const connections = [];
|
|
119
|
+
const now = new Date().toISOString();
|
|
120
|
+
const makeConn = (type, name, config, state) => ({
|
|
121
|
+
id: crypto.randomUUID(),
|
|
122
|
+
category: connection_model_1.CATEGORY_MAP[type],
|
|
123
|
+
type,
|
|
124
|
+
name,
|
|
125
|
+
active: true,
|
|
126
|
+
deletedAt: null,
|
|
127
|
+
createdAt: now,
|
|
128
|
+
updatedAt: now,
|
|
129
|
+
config,
|
|
130
|
+
...(state ? { state } : {}),
|
|
131
|
+
});
|
|
132
|
+
let dsPath = LEGACY_DATASOURCES;
|
|
133
|
+
if (!fs.existsSync(dsPath))
|
|
134
|
+
dsPath = LEGACY_DATASOURCES_ROOT;
|
|
135
|
+
if (fs.existsSync(dsPath)) {
|
|
136
|
+
try {
|
|
137
|
+
const data = JSON.parse(fs.readFileSync(dsPath, 'utf-8'));
|
|
138
|
+
if (data.postgresql) {
|
|
139
|
+
const { type: _, ...cfg } = data.postgresql;
|
|
140
|
+
connections.push(makeConn('postgresql', 'PostgreSQL', cfg));
|
|
141
|
+
}
|
|
142
|
+
if (data.mongodb) {
|
|
143
|
+
const { type: _, ...cfg } = data.mongodb;
|
|
144
|
+
connections.push(makeConn('mongodb', 'MongoDB', cfg));
|
|
145
|
+
}
|
|
146
|
+
console.log('[ConnectionRepository] Migrated datasources.json');
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
console.warn('[ConnectionRepository] Failed to migrate datasources.json:', e);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (fs.existsSync(LEGACY_INTEGRATIONS)) {
|
|
153
|
+
try {
|
|
154
|
+
const data = JSON.parse(fs.readFileSync(LEGACY_INTEGRATIONS, 'utf-8'));
|
|
155
|
+
if (data.graylog) {
|
|
156
|
+
const { type: _, ...cfg } = data.graylog;
|
|
157
|
+
connections.push(makeConn('graylog', 'Graylog', cfg));
|
|
158
|
+
}
|
|
159
|
+
if (data.grafana) {
|
|
160
|
+
const { type: _, ...cfg } = data.grafana;
|
|
161
|
+
connections.push(makeConn('grafana', 'Grafana', cfg));
|
|
162
|
+
}
|
|
163
|
+
console.log('[ConnectionRepository] Migrated integrations.json');
|
|
164
|
+
}
|
|
165
|
+
catch (e) {
|
|
166
|
+
console.warn('[ConnectionRepository] Failed to migrate integrations.json:', e);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (fs.existsSync(LEGACY_PROJECT)) {
|
|
170
|
+
try {
|
|
171
|
+
const data = JSON.parse(fs.readFileSync(LEGACY_PROJECT, 'utf-8'));
|
|
172
|
+
if (data.config) {
|
|
173
|
+
const projType = data.config.type;
|
|
174
|
+
const { type: _, ...cfg } = data.config;
|
|
175
|
+
const state = data.localPath
|
|
176
|
+
? { localPath: data.localPath, status: data.status || 'ready', error: data.error }
|
|
177
|
+
: undefined;
|
|
178
|
+
connections.push(makeConn(projType, projType === 'local' ? 'Local Project' : 'GitLab Project', cfg, state));
|
|
179
|
+
}
|
|
180
|
+
console.log('[ConnectionRepository] Migrated project.json');
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
console.warn('[ConnectionRepository] Failed to migrate project.json:', e);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const configFile = { version: 1, connections };
|
|
187
|
+
fs.writeFileSync(FILE_PATH, JSON.stringify(configFile, null, 2), 'utf-8');
|
|
188
|
+
console.log(`[ConnectionRepository] Migration complete: ${connections.length} connections`);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
exports.ConnectionRepository = ConnectionRepository;
|
|
192
|
+
exports.ConnectionRepository = ConnectionRepository = __decorate([
|
|
193
|
+
(0, common_1.Injectable)()
|
|
194
|
+
], ConnectionRepository);
|
|
195
|
+
//# sourceMappingURL=connection.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.repository.js","sourceRoot":"","sources":["../../../src/connection/connection.repository.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,yDAQ4B;AAE5B,oCAA+C;AAE/C,MAAM,QAAQ,GAAG,IAAA,eAAO,GAAE,CAAC;AAC3B,MAAM,SAAS,GAAG,IAAA,kBAAU,GAAE,CAAC;AAG/B,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACnE,MAAM,uBAAu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AA7KY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CA6KhC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ConnectionRepository } from './connection.repository';
|
|
2
|
+
import { PostgresConnector } from '../datasource/connectors/postgres.connector';
|
|
3
|
+
import { MongoConnector } from '../datasource/connectors/mongo.connector';
|
|
4
|
+
import { Connection, ConnectionType, CreateConnectionDto, UpdateConnectionDto, ExportFile, DashboardChartConfig } from './connection.model';
|
|
5
|
+
export declare class ConnectionService {
|
|
6
|
+
private readonly repository;
|
|
7
|
+
private readonly postgresConnector;
|
|
8
|
+
private readonly mongoConnector;
|
|
9
|
+
constructor(repository: ConnectionRepository, postgresConnector: PostgresConnector, mongoConnector: MongoConnector);
|
|
10
|
+
getAll(includeDeleted?: boolean): Connection[];
|
|
11
|
+
getById(id: string): Connection;
|
|
12
|
+
getByType(type: ConnectionType): Connection[];
|
|
13
|
+
getRawById(id: string): Connection;
|
|
14
|
+
getActiveForType(type: ConnectionType): Connection | undefined;
|
|
15
|
+
create(dto: CreateConnectionDto): Connection;
|
|
16
|
+
update(id: string, dto: UpdateConnectionDto): Connection;
|
|
17
|
+
delete(id: string): void;
|
|
18
|
+
activate(id: string): Promise<Connection>;
|
|
19
|
+
deactivate(id: string): Connection;
|
|
20
|
+
testConnection(id: string): Promise<{
|
|
21
|
+
connected: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
}>;
|
|
24
|
+
testConnectionConfig(type: ConnectionType, config: any): Promise<{
|
|
25
|
+
connected: boolean;
|
|
26
|
+
error?: string;
|
|
27
|
+
}>;
|
|
28
|
+
private testConfig;
|
|
29
|
+
private testGraylog;
|
|
30
|
+
private testGrafana;
|
|
31
|
+
private testLocal;
|
|
32
|
+
private testGitlab;
|
|
33
|
+
connectProject(id: string): Promise<Connection>;
|
|
34
|
+
disconnectProject(id: string): Promise<void>;
|
|
35
|
+
getDashboard(): {
|
|
36
|
+
charts: DashboardChartConfig[];
|
|
37
|
+
};
|
|
38
|
+
saveDashboard(charts: DashboardChartConfig[]): {
|
|
39
|
+
charts: DashboardChartConfig[];
|
|
40
|
+
};
|
|
41
|
+
exportConnections(): ExportFile;
|
|
42
|
+
importConnections(data: ExportFile): {
|
|
43
|
+
imported: number;
|
|
44
|
+
skipped: number;
|
|
45
|
+
dashboardImported?: boolean;
|
|
46
|
+
contextImported?: boolean;
|
|
47
|
+
};
|
|
48
|
+
private maskSecrets;
|
|
49
|
+
private validateType;
|
|
50
|
+
}
|