@da4h/sandbox-core 0.0.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/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/controllers/code-editor.controller.d.ts +10 -0
- package/dist/controllers/code-editor.controller.js +84 -0
- package/dist/controllers/code-editor.controller.js.map +1 -0
- package/dist/controllers/dependencies.controller.d.ts +15 -0
- package/dist/controllers/dependencies.controller.js +107 -0
- package/dist/controllers/dependencies.controller.js.map +1 -0
- package/dist/controllers/deploy.controller.d.ts +9 -0
- package/dist/controllers/deploy.controller.js +53 -0
- package/dist/controllers/deploy.controller.js.map +1 -0
- package/dist/controllers/external-libs.controller.d.ts +23 -0
- package/dist/controllers/external-libs.controller.js +83 -0
- package/dist/controllers/external-libs.controller.js.map +1 -0
- package/dist/controllers/git.controller.d.ts +21 -0
- package/dist/controllers/git.controller.js +121 -0
- package/dist/controllers/git.controller.js.map +1 -0
- package/dist/controllers/repositories.controller.d.ts +23 -0
- package/dist/controllers/repositories.controller.js +83 -0
- package/dist/controllers/repositories.controller.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces.d.ts +79 -0
- package/dist/interfaces.js +3 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/sandbox.module.d.ts +5 -0
- package/dist/sandbox.module.js +108 -0
- package/dist/sandbox.module.js.map +1 -0
- package/dist/services/code-editor.service.d.ts +19 -0
- package/dist/services/code-editor.service.js +233 -0
- package/dist/services/code-editor.service.js.map +1 -0
- package/dist/services/dependencies.service.d.ts +29 -0
- package/dist/services/dependencies.service.js +230 -0
- package/dist/services/dependencies.service.js.map +1 -0
- package/dist/services/deploy.service.d.ts +20 -0
- package/dist/services/deploy.service.js +314 -0
- package/dist/services/deploy.service.js.map +1 -0
- package/dist/services/external-libs.service.d.ts +1 -0
- package/dist/services/external-libs.service.js +18 -0
- package/dist/services/external-libs.service.js.map +1 -0
- package/dist/services/git.service.d.ts +35 -0
- package/dist/services/git.service.js +279 -0
- package/dist/services/git.service.js.map +1 -0
- package/dist/services/repositories.service.d.ts +35 -0
- package/dist/services/repositories.service.js +239 -0
- package/dist/services/repositories.service.js.map +1 -0
- package/dist/services/vm-runner.service.d.ts +18 -0
- package/dist/services/vm-runner.service.js +288 -0
- package/dist/services/vm-runner.service.js.map +1 -0
- package/dist/timer-registry.d.ts +28 -0
- package/dist/timer-registry.js +131 -0
- package/dist/timer-registry.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SANDBOX_OPTIONS = "SANDBOX_OPTIONS";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Response } from 'express';
|
|
2
|
+
import { CodeEditorService } from '../services/code-editor.service';
|
|
3
|
+
import type { SandboxModuleOptions } from '../interfaces';
|
|
4
|
+
export declare class CodeEditorController {
|
|
5
|
+
private readonly service;
|
|
6
|
+
private readonly options;
|
|
7
|
+
constructor(service: CodeEditorService, options: SandboxModuleOptions);
|
|
8
|
+
getProject(res: Response): void;
|
|
9
|
+
syncProject(body: any, res: Response): Response<any, Record<string, any>> | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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.CodeEditorController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const code_editor_service_1 = require("../services/code-editor.service");
|
|
18
|
+
const constants_1 = require("../constants");
|
|
19
|
+
let CodeEditorController = class CodeEditorController {
|
|
20
|
+
service;
|
|
21
|
+
options;
|
|
22
|
+
constructor(service, options) {
|
|
23
|
+
this.service = service;
|
|
24
|
+
this.options = options;
|
|
25
|
+
}
|
|
26
|
+
getProject(res) {
|
|
27
|
+
try {
|
|
28
|
+
const builtin = [];
|
|
29
|
+
if (this.options.builtinModels) {
|
|
30
|
+
for (const [folderName, codeRoot] of Object.entries(this.options.builtinModels)) {
|
|
31
|
+
builtin.push({ path: folderName, type: 'folder' });
|
|
32
|
+
const tempService = new code_editor_service_1.CodeEditorService(this.options, codeRoot);
|
|
33
|
+
const files = tempService.getProjectFlat();
|
|
34
|
+
for (const file of files) {
|
|
35
|
+
builtin.push({ ...file, path: `${folderName}/${file.path}` });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const user = this.service.getProjectFlat();
|
|
40
|
+
res.json({ builtin, user });
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('getProject error:', error);
|
|
44
|
+
res.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({ error: error.message });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
syncProject(body, res) {
|
|
48
|
+
if (!Array.isArray(body)) {
|
|
49
|
+
return res.status(common_1.HttpStatus.BAD_REQUEST).json({ error: 'Body must be an array of files.' });
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
this.service.syncProjectFlat(body);
|
|
53
|
+
res.json({ success: true });
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const msg = error.message;
|
|
57
|
+
const status = msg.startsWith('Access denied') ? common_1.HttpStatus.FORBIDDEN : common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
58
|
+
res.status(status).json({ error: msg });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.CodeEditorController = CodeEditorController;
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, common_1.Get)('project'),
|
|
65
|
+
__param(0, (0, common_1.Res)()),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [Object]),
|
|
68
|
+
__metadata("design:returntype", void 0)
|
|
69
|
+
], CodeEditorController.prototype, "getProject", null);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, common_1.Post)('project'),
|
|
72
|
+
__param(0, (0, common_1.Body)()),
|
|
73
|
+
__param(1, (0, common_1.Res)()),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
76
|
+
__metadata("design:returntype", void 0)
|
|
77
|
+
], CodeEditorController.prototype, "syncProject", null);
|
|
78
|
+
exports.CodeEditorController = CodeEditorController = __decorate([
|
|
79
|
+
(0, common_1.Controller)('code-editor'),
|
|
80
|
+
__param(0, (0, common_1.Inject)('CODE_EDITOR_SERVICE')),
|
|
81
|
+
__param(1, (0, common_1.Inject)(constants_1.SANDBOX_OPTIONS)),
|
|
82
|
+
__metadata("design:paramtypes", [code_editor_service_1.CodeEditorService, Object])
|
|
83
|
+
], CodeEditorController);
|
|
84
|
+
//# sourceMappingURL=code-editor.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-editor.controller.js","sourceRoot":"","sources":["../../src/controllers/code-editor.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0G;AAE1G,yEAAoE;AACpE,4CAA+C;AAIxC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAEmB;IACN;IAF5C,YACkD,OAA0B,EAChC,OAA6B;QADvB,YAAO,GAAP,OAAO,CAAmB;QAChC,YAAO,GAAP,OAAO,CAAsB;IACtE,CAAC;IAGJ,UAAU,CAAQ,GAAa;QAC7B,IAAI,CAAC;YACH,MAAM,OAAO,GAAgB,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC/B,KAAK,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;oBAEhF,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;oBACnD,MAAM,WAAW,GAAG,IAAI,uCAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAClE,MAAM,KAAK,GAAG,WAAW,CAAC,cAAc,EAAE,CAAC;oBAC3C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,GAAG,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAChE,CAAC;gBACH,CAAC;YACH,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAA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AA,IAAA,YAAG,GAAE,CAAA;;;;uDAYpC;+BA1CU,oBAAoB;IADhC,IAAA,mBAAU,EAAC,aAAa,CAAC;IAGrB,WAAA,IAAA,eAAM,EAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,eAAM,EAAC,2BAAe,CAAC,CAAA;qCADiC,uCAAiB;GAFjE,oBAAoB,CA2ChC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Response } from 'express';
|
|
2
|
+
import { DependenciesService } from '../services/dependencies.service';
|
|
3
|
+
export declare class DependenciesController {
|
|
4
|
+
private readonly dependenciesService;
|
|
5
|
+
constructor(dependenciesService: DependenciesService);
|
|
6
|
+
listDependencies(repository: string, externalLib: string, res: Response): void;
|
|
7
|
+
searchDependencies(q: string, res: Response): Promise<void>;
|
|
8
|
+
installDependency(body: {
|
|
9
|
+
name: string;
|
|
10
|
+
repository?: string;
|
|
11
|
+
externalLib?: string;
|
|
12
|
+
}, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
|
|
13
|
+
uninstallDependency(name: string, repository: string, externalLib: string, res: Response): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export { DependenciesController as PackagesController };
|
|
@@ -0,0 +1,107 @@
|
|
|
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.PackagesController = exports.DependenciesController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const dependencies_service_1 = require("../services/dependencies.service");
|
|
18
|
+
let DependenciesController = class DependenciesController {
|
|
19
|
+
dependenciesService;
|
|
20
|
+
constructor(dependenciesService) {
|
|
21
|
+
this.dependenciesService = dependenciesService;
|
|
22
|
+
}
|
|
23
|
+
listDependencies(repository, externalLib, res) {
|
|
24
|
+
try {
|
|
25
|
+
const target = repository || externalLib;
|
|
26
|
+
const dependencies = this.dependenciesService.listDependencies(target);
|
|
27
|
+
res.json(dependencies);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
res.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({ error: e.message });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async searchDependencies(q, res) {
|
|
34
|
+
try {
|
|
35
|
+
const results = await this.dependenciesService.searchDependency(q);
|
|
36
|
+
res.json(results);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
res.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({ error: e.message });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async installDependency(body, res) {
|
|
43
|
+
if (!body.name) {
|
|
44
|
+
return res.status(common_1.HttpStatus.BAD_REQUEST).json({ error: 'Dependency name is required' });
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const target = body.repository || body.externalLib;
|
|
48
|
+
const output = await this.dependenciesService.installDependency(body.name, target);
|
|
49
|
+
res.json({ ok: true, output });
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
res.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({ error: typeof e === 'string' ? e : e.message });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async uninstallDependency(name, repository, externalLib, res) {
|
|
56
|
+
try {
|
|
57
|
+
const target = repository || externalLib;
|
|
58
|
+
const output = await this.dependenciesService.uninstallDependency(name, target);
|
|
59
|
+
res.json({ ok: true, output });
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
res.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({ error: typeof e === 'string' ? e : e.message });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.DependenciesController = DependenciesController;
|
|
67
|
+
exports.PackagesController = DependenciesController;
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, common_1.Get)(),
|
|
70
|
+
__param(0, (0, common_1.Query)('repository')),
|
|
71
|
+
__param(1, (0, common_1.Query)('externalLib')),
|
|
72
|
+
__param(2, (0, common_1.Res)()),
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
75
|
+
__metadata("design:returntype", void 0)
|
|
76
|
+
], DependenciesController.prototype, "listDependencies", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, common_1.Get)('search'),
|
|
79
|
+
__param(0, (0, common_1.Query)('q')),
|
|
80
|
+
__param(1, (0, common_1.Res)()),
|
|
81
|
+
__metadata("design:type", Function),
|
|
82
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
83
|
+
__metadata("design:returntype", Promise)
|
|
84
|
+
], DependenciesController.prototype, "searchDependencies", null);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, common_1.Post)(),
|
|
87
|
+
__param(0, (0, common_1.Body)()),
|
|
88
|
+
__param(1, (0, common_1.Res)()),
|
|
89
|
+
__metadata("design:type", Function),
|
|
90
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
91
|
+
__metadata("design:returntype", Promise)
|
|
92
|
+
], DependenciesController.prototype, "installDependency", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, common_1.Delete)(':name'),
|
|
95
|
+
__param(0, (0, common_1.Param)('name')),
|
|
96
|
+
__param(1, (0, common_1.Query)('repository')),
|
|
97
|
+
__param(2, (0, common_1.Query)('externalLib')),
|
|
98
|
+
__param(3, (0, common_1.Res)()),
|
|
99
|
+
__metadata("design:type", Function),
|
|
100
|
+
__metadata("design:paramtypes", [String, String, String, Object]),
|
|
101
|
+
__metadata("design:returntype", Promise)
|
|
102
|
+
], DependenciesController.prototype, "uninstallDependency", null);
|
|
103
|
+
exports.PackagesController = exports.DependenciesController = DependenciesController = __decorate([
|
|
104
|
+
(0, common_1.Controller)('dependencies'),
|
|
105
|
+
__metadata("design:paramtypes", [dependencies_service_1.DependenciesService])
|
|
106
|
+
], DependenciesController);
|
|
107
|
+
//# sourceMappingURL=dependencies.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.controller.js","sourceRoot":"","sources":["../../src/controllers/dependencies.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoG;AAEpG,2EAAuE;AAGhE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACJ;IAA7B,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAAG,CAAC;IAGzE,gBAAgB,CACO,UAAkB,EACjB,WAAmB,EAClC,GAAa;QAEpB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,UAAU,IAAI,WAAW,CAAC;YACzC,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACvE,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,GAAG,CAAC,MAAM,CAAC,mBAAU,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,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AAK,EAAC,aAAa,CAAC,CAAA;IACpB,WAAA,IAAA,YAAG,GAAE,CAAA;;;;iEASP;8DA3DU,sBAAsB;IADlC,IAAA,mBAAU,EAAC,cAAc,CAAC;qCAEyB,0CAAmB;GAD1D,sBAAsB,CA4DlC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeployService } from '../services/deploy.service';
|
|
2
|
+
import type { DeployResult, DeployStatus } from '../interfaces';
|
|
3
|
+
export declare class DeployController {
|
|
4
|
+
private readonly deployService;
|
|
5
|
+
constructor(deployService: DeployService);
|
|
6
|
+
deploy(): Promise<DeployResult>;
|
|
7
|
+
getStatus(): Promise<DeployStatus>;
|
|
8
|
+
rollback(): Promise<DeployResult>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DeployController = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const deploy_service_1 = require("../services/deploy.service");
|
|
15
|
+
let DeployController = class DeployController {
|
|
16
|
+
deployService;
|
|
17
|
+
constructor(deployService) {
|
|
18
|
+
this.deployService = deployService;
|
|
19
|
+
}
|
|
20
|
+
async deploy() {
|
|
21
|
+
return await this.deployService.deploy();
|
|
22
|
+
}
|
|
23
|
+
async getStatus() {
|
|
24
|
+
return await this.deployService.getStatus();
|
|
25
|
+
}
|
|
26
|
+
async rollback() {
|
|
27
|
+
return await this.deployService.rollback();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.DeployController = DeployController;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, common_1.Post)(),
|
|
33
|
+
__metadata("design:type", Function),
|
|
34
|
+
__metadata("design:paramtypes", []),
|
|
35
|
+
__metadata("design:returntype", Promise)
|
|
36
|
+
], DeployController.prototype, "deploy", null);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, common_1.Get)('status'),
|
|
39
|
+
__metadata("design:type", Function),
|
|
40
|
+
__metadata("design:paramtypes", []),
|
|
41
|
+
__metadata("design:returntype", Promise)
|
|
42
|
+
], DeployController.prototype, "getStatus", null);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, common_1.Post)('rollback'),
|
|
45
|
+
__metadata("design:type", Function),
|
|
46
|
+
__metadata("design:paramtypes", []),
|
|
47
|
+
__metadata("design:returntype", Promise)
|
|
48
|
+
], DeployController.prototype, "rollback", null);
|
|
49
|
+
exports.DeployController = DeployController = __decorate([
|
|
50
|
+
(0, common_1.Controller)('deploy'),
|
|
51
|
+
__metadata("design:paramtypes", [deploy_service_1.DeployService])
|
|
52
|
+
], DeployController);
|
|
53
|
+
//# sourceMappingURL=deploy.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.controller.js","sourceRoot":"","sources":["../../src/controllers/deploy.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAuD;AACvD,+DAA2D;AAIpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACE;IAA7B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAGvD,AAAN,KAAK,CAAC,MAAM;QACV,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC3C,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS;QACb,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;IAC9C,CAAC;IAGK,AAAN,KAAK,CAAC,QAAQ;QACZ,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;CACF,CAAA;AAjBY,4CAAgB;AAIrB;IADL,IAAA,aAAI,GAAE;;;;8CAGN;AAGK;IADL,IAAA,YAAG,EAAC,QAAQ,CAAC;;;;iDAGb;AAGK;IADL,IAAA,aAAI,EAAC,UAAU,CAAC;;;;gDAGhB;2BAhBU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAEyB,8BAAa;GAD9C,gBAAgB,CAiB5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RepositoriesService, RepositoryStatus } from '../services/repositories.service';
|
|
2
|
+
export declare class ExternalLibsController {
|
|
3
|
+
private readonly repositoriesService;
|
|
4
|
+
constructor(repositoriesService: RepositoriesService);
|
|
5
|
+
getStatus(): Promise<RepositoryStatus[]>;
|
|
6
|
+
addLib(body: {
|
|
7
|
+
name: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
removeLib(name: string): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
pullLib(name: string): Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
commitLib(name: string, body: {
|
|
19
|
+
message: string;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.ExternalLibsController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const repositories_service_1 = require("../services/repositories.service");
|
|
18
|
+
let ExternalLibsController = class ExternalLibsController {
|
|
19
|
+
repositoriesService;
|
|
20
|
+
constructor(repositoriesService) {
|
|
21
|
+
this.repositoriesService = repositoriesService;
|
|
22
|
+
}
|
|
23
|
+
async getStatus() {
|
|
24
|
+
return await this.repositoriesService.getRepositoriesStatus();
|
|
25
|
+
}
|
|
26
|
+
async addLib(body) {
|
|
27
|
+
await this.repositoriesService.addRepository(body.name, body.url);
|
|
28
|
+
return { success: true };
|
|
29
|
+
}
|
|
30
|
+
async removeLib(name) {
|
|
31
|
+
await this.repositoriesService.removeRepository(name);
|
|
32
|
+
return { success: true };
|
|
33
|
+
}
|
|
34
|
+
async pullLib(name) {
|
|
35
|
+
await this.repositoriesService.pull(name);
|
|
36
|
+
return { success: true };
|
|
37
|
+
}
|
|
38
|
+
async commitLib(name, body) {
|
|
39
|
+
await this.repositoriesService.commitAndPush(name, body.message || 'Auto commit from TsFlow Editor');
|
|
40
|
+
return { success: true };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.ExternalLibsController = ExternalLibsController;
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, common_1.Get)(),
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", []),
|
|
48
|
+
__metadata("design:returntype", Promise)
|
|
49
|
+
], ExternalLibsController.prototype, "getStatus", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, common_1.Post)(),
|
|
52
|
+
__param(0, (0, common_1.Body)()),
|
|
53
|
+
__metadata("design:type", Function),
|
|
54
|
+
__metadata("design:paramtypes", [Object]),
|
|
55
|
+
__metadata("design:returntype", Promise)
|
|
56
|
+
], ExternalLibsController.prototype, "addLib", null);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, common_1.Delete)(':name'),
|
|
59
|
+
__param(0, (0, common_1.Param)('name')),
|
|
60
|
+
__metadata("design:type", Function),
|
|
61
|
+
__metadata("design:paramtypes", [String]),
|
|
62
|
+
__metadata("design:returntype", Promise)
|
|
63
|
+
], ExternalLibsController.prototype, "removeLib", null);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, common_1.Post)(':name/pull'),
|
|
66
|
+
__param(0, (0, common_1.Param)('name')),
|
|
67
|
+
__metadata("design:type", Function),
|
|
68
|
+
__metadata("design:paramtypes", [String]),
|
|
69
|
+
__metadata("design:returntype", Promise)
|
|
70
|
+
], ExternalLibsController.prototype, "pullLib", null);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, common_1.Post)(':name/commit'),
|
|
73
|
+
__param(0, (0, common_1.Param)('name')),
|
|
74
|
+
__param(1, (0, common_1.Body)()),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], ExternalLibsController.prototype, "commitLib", null);
|
|
79
|
+
exports.ExternalLibsController = ExternalLibsController = __decorate([
|
|
80
|
+
(0, common_1.Controller)('external-libs'),
|
|
81
|
+
__metadata("design:paramtypes", [repositories_service_1.RepositoriesService])
|
|
82
|
+
], ExternalLibsController);
|
|
83
|
+
//# sourceMappingURL=external-libs.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-libs.controller.js","sourceRoot":"","sources":["../../src/controllers/external-libs.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4E;AAC5E,2EAAyF;AAGlF,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACJ;IAA7B,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAAG,CAAC;IAGnE,AAAN,KAAK,CAAC,SAAS;QACb,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,CAAC;IAChE,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAmC;QACtD,MAAM,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAClE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CAAgB,IAAY;QACzC,MAAM,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO,CAAgB,IAAY;QACvC,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CAAgB,IAAY,EAAU,IAAyB;QAC5E,MAAM,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,gCAAgC,CAAC,CAAC;QACrG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAA;AA/BY,wDAAsB;AAI3B;IADL,IAAA,YAAG,GAAE;;;;uDAGL;AAGK;IADL,IAAA,aAAI,GAAE;IACO,WAAA,IAAA,aAAI,GAAE,CAAA;;;;oDAGnB;AAGK;IADL,IAAA,eAAM,EAAC,OAAO,CAAC;IACC,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;uDAG7B;AAGK;IADL,IAAA,aAAI,EAAC,YAAY,CAAC;IACJ,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;qDAG3B;AAGK;IADL,IAAA,aAAI,EAAC,cAAc,CAAC;IACJ,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;IAAgB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;uDAGnD;iCA9BU,sBAAsB;IADlC,IAAA,mBAAU,EAAC,eAAe,CAAC;qCAEwB,0CAAmB;GAD1D,sBAAsB,CA+BlC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GitService } from '../services/git.service';
|
|
2
|
+
export declare class GitController {
|
|
3
|
+
private readonly gitService;
|
|
4
|
+
constructor(gitService: GitService);
|
|
5
|
+
getHistory(target: string): Promise<import("../services/git.service").GitCommit[]>;
|
|
6
|
+
getStatus(target: string): Promise<import("../services/git.service").GitFileChange[]>;
|
|
7
|
+
getCommitFiles(target: string, commit: string): Promise<import("../services/git.service").GitFileChange[]>;
|
|
8
|
+
getFileContent(target: string, file: string, commit: string): Promise<{
|
|
9
|
+
content: string;
|
|
10
|
+
}>;
|
|
11
|
+
getNumstat(target: string): Promise<Record<string, import("../services/git.service").GitNumstat>>;
|
|
12
|
+
commit(target: string, message: string): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
pull(target: string, force: boolean): Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
checkoutLocal(target: string, file?: string): Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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.GitController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const git_service_1 = require("../services/git.service");
|
|
18
|
+
let GitController = class GitController {
|
|
19
|
+
gitService;
|
|
20
|
+
constructor(gitService) {
|
|
21
|
+
this.gitService = gitService;
|
|
22
|
+
}
|
|
23
|
+
async getHistory(target) {
|
|
24
|
+
return this.gitService.getHistory(target);
|
|
25
|
+
}
|
|
26
|
+
async getStatus(target) {
|
|
27
|
+
return this.gitService.getStatus(target);
|
|
28
|
+
}
|
|
29
|
+
async getCommitFiles(target, commit) {
|
|
30
|
+
return this.gitService.getCommitFiles(target, commit);
|
|
31
|
+
}
|
|
32
|
+
async getFileContent(target, file, commit) {
|
|
33
|
+
const content = await this.gitService.getFileContent(target, file, commit);
|
|
34
|
+
return { content };
|
|
35
|
+
}
|
|
36
|
+
async getNumstat(target) {
|
|
37
|
+
return this.gitService.getNumstat(target);
|
|
38
|
+
}
|
|
39
|
+
async commit(target, message) {
|
|
40
|
+
if (!message)
|
|
41
|
+
throw new common_1.BadRequestException('Message is required');
|
|
42
|
+
await this.gitService.commitChanges(target, message);
|
|
43
|
+
return { success: true };
|
|
44
|
+
}
|
|
45
|
+
async pull(target, force) {
|
|
46
|
+
await this.gitService.pull(target, !!force);
|
|
47
|
+
return { success: true };
|
|
48
|
+
}
|
|
49
|
+
async checkoutLocal(target, file) {
|
|
50
|
+
await this.gitService.checkoutLocal(target, file);
|
|
51
|
+
return { success: true };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.GitController = GitController;
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, common_1.Get)('history'),
|
|
57
|
+
__param(0, (0, common_1.Query)('target')),
|
|
58
|
+
__metadata("design:type", Function),
|
|
59
|
+
__metadata("design:paramtypes", [String]),
|
|
60
|
+
__metadata("design:returntype", Promise)
|
|
61
|
+
], GitController.prototype, "getHistory", null);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, common_1.Get)('status'),
|
|
64
|
+
__param(0, (0, common_1.Query)('target')),
|
|
65
|
+
__metadata("design:type", Function),
|
|
66
|
+
__metadata("design:paramtypes", [String]),
|
|
67
|
+
__metadata("design:returntype", Promise)
|
|
68
|
+
], GitController.prototype, "getStatus", null);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, common_1.Get)('commit-files'),
|
|
71
|
+
__param(0, (0, common_1.Query)('target')),
|
|
72
|
+
__param(1, (0, common_1.Query)('commit')),
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", [String, String]),
|
|
75
|
+
__metadata("design:returntype", Promise)
|
|
76
|
+
], GitController.prototype, "getCommitFiles", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, common_1.Get)('file-content'),
|
|
79
|
+
__param(0, (0, common_1.Query)('target')),
|
|
80
|
+
__param(1, (0, common_1.Query)('file')),
|
|
81
|
+
__param(2, (0, common_1.Query)('commit')),
|
|
82
|
+
__metadata("design:type", Function),
|
|
83
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
84
|
+
__metadata("design:returntype", Promise)
|
|
85
|
+
], GitController.prototype, "getFileContent", null);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, common_1.Get)('numstat'),
|
|
88
|
+
__param(0, (0, common_1.Query)('target')),
|
|
89
|
+
__metadata("design:type", Function),
|
|
90
|
+
__metadata("design:paramtypes", [String]),
|
|
91
|
+
__metadata("design:returntype", Promise)
|
|
92
|
+
], GitController.prototype, "getNumstat", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, common_1.Post)('commit'),
|
|
95
|
+
__param(0, (0, common_1.Body)('target')),
|
|
96
|
+
__param(1, (0, common_1.Body)('message')),
|
|
97
|
+
__metadata("design:type", Function),
|
|
98
|
+
__metadata("design:paramtypes", [String, String]),
|
|
99
|
+
__metadata("design:returntype", Promise)
|
|
100
|
+
], GitController.prototype, "commit", null);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, common_1.Post)('pull'),
|
|
103
|
+
__param(0, (0, common_1.Body)('target')),
|
|
104
|
+
__param(1, (0, common_1.Body)('force')),
|
|
105
|
+
__metadata("design:type", Function),
|
|
106
|
+
__metadata("design:paramtypes", [String, Boolean]),
|
|
107
|
+
__metadata("design:returntype", Promise)
|
|
108
|
+
], GitController.prototype, "pull", null);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, common_1.Post)('checkout'),
|
|
111
|
+
__param(0, (0, common_1.Body)('target')),
|
|
112
|
+
__param(1, (0, common_1.Body)('file')),
|
|
113
|
+
__metadata("design:type", Function),
|
|
114
|
+
__metadata("design:paramtypes", [String, String]),
|
|
115
|
+
__metadata("design:returntype", Promise)
|
|
116
|
+
], GitController.prototype, "checkoutLocal", null);
|
|
117
|
+
exports.GitController = GitController = __decorate([
|
|
118
|
+
(0, common_1.Controller)('git'),
|
|
119
|
+
__metadata("design:paramtypes", [git_service_1.GitService])
|
|
120
|
+
], GitController);
|
|
121
|
+
//# sourceMappingURL=git.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.controller.js","sourceRoot":"","sources":["../../src/controllers/git.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyF;AACzF,yDAAqD;AAG9C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACK;IAA7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGjD,AAAN,KAAK,CAAC,UAAU,CAAkB,MAAc;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CAAkB,MAAc;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CAAkB,MAAc,EAAmB,MAAc;QACnF,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CAAkB,MAAc,EAAiB,IAAY,EAAmB,MAAc;QAChH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3E,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CAAkB,MAAc;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAGK,AAAN,KAAK,CA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;mDAGlG;AAGK;IADL,IAAA,YAAG,EAAC,SAAS,CAAC;IACG,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;;;;+CAEhC;AAGK;IADL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACD,WAAA,IAAA,aAAI,EAAC,QAAQ,CAAC,CAAA;IAAkB,WAAA,IAAA,aAAI,EAAC,SAAS,CAAC,CAAA;;;;2CAI5D;AAGK;IADL,IAAA,aAAI,EAAC,MAAM,CAAC;IACD,WAAA,IAAA,aAAI,EAAC,QAAQ,CAAC,CAAA;IAAkB,WAAA,IAAA,aAAI,EAAC,OAAO,CAAC,CAAA;;;;yCAGxD;AAGK;IADL,IAAA,aAAI,EAAC,UAAU,CAAC;IACI,WAAA,IAAA,aAAI,EAAC,QAAQ,CAAC,CAAA;IAAkB,WAAA,IAAA,aAAI,EAAC,MAAM,CAAC,CAAA;;;;kDAGhE;wBA9CU,aAAa;IADzB,IAAA,mBAAU,EAAC,KAAK,CAAC;qCAEyB,wBAAU;GADxC,aAAa,CA+CzB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RepositoriesService, RepositoryStatus } from '../services/repositories.service';
|
|
2
|
+
export declare class RepositoriesController {
|
|
3
|
+
private readonly repositoriesService;
|
|
4
|
+
constructor(repositoriesService: RepositoriesService);
|
|
5
|
+
getStatus(): Promise<RepositoryStatus[]>;
|
|
6
|
+
addRepo(body: {
|
|
7
|
+
name: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
removeRepo(name: string): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
pullRepo(name: string): Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
commitRepo(name: string, body: {
|
|
19
|
+
message: string;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
}
|