@venturialstd/gitlab 0.0.7 → 0.0.9
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/README.md +110 -110
- package/dist/client/gitlab.client.d.ts +4 -4
- package/dist/client/gitlab.client.d.ts.map +1 -1
- package/dist/client/gitlab.client.js +36 -71
- package/dist/client/gitlab.client.js.map +1 -1
- package/dist/constants/gitlab-merge-request.constant.d.ts +15 -0
- package/dist/constants/gitlab-merge-request.constant.d.ts.map +1 -0
- package/dist/constants/gitlab-merge-request.constant.js +20 -0
- package/dist/constants/gitlab-merge-request.constant.js.map +1 -0
- package/dist/constants/gitlab-webhook.constant.d.ts +14 -0
- package/dist/constants/gitlab-webhook.constant.d.ts.map +1 -0
- package/dist/constants/gitlab-webhook.constant.js +19 -0
- package/dist/constants/gitlab-webhook.constant.js.map +1 -0
- package/dist/controllers/webhooks/gitlab-webhook.controller.d.ts +11 -0
- package/dist/controllers/webhooks/gitlab-webhook.controller.d.ts.map +1 -0
- package/dist/controllers/webhooks/gitlab-webhook.controller.js +53 -0
- package/dist/controllers/webhooks/gitlab-webhook.controller.js.map +1 -0
- package/dist/dtos/gitlab-merge-request.dto.d.ts +23 -0
- package/dist/dtos/gitlab-merge-request.dto.d.ts.map +1 -0
- package/dist/dtos/gitlab-merge-request.dto.js +118 -0
- package/dist/dtos/gitlab-merge-request.dto.js.map +1 -0
- package/dist/gitlab.module.d.ts +2 -2
- package/dist/gitlab.module.d.ts.map +1 -1
- package/dist/gitlab.module.js +33 -69
- package/dist/gitlab.module.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/services/gitlab-project.service.d.ts.map +1 -1
- package/dist/services/gitlab-project.service.js +28 -63
- package/dist/services/gitlab-project.service.js.map +1 -1
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
# @venturialstd/gitlab
|
|
2
|
-
|
|
3
|
-
A lightweight **NestJS SDK for GitLab**, developed by **Venturial**, that allows you to interact with GitLab projects, merge requests, and repository files. Designed to be used by directly instantiating a client with custom configuration, without depending on a global module. Ideal for projects under the **Venturial organization**.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- Retrieve **open merge requests** for a GitLab project.
|
|
10
|
-
- Fetch **merge request diffs**.
|
|
11
|
-
- Get the contents of a **repository file**.
|
|
12
|
-
- Fully compatible with NestJS **HttpModule** and provider injection.
|
|
13
|
-
- No hard dependencies on a settings module—you provide the host and token dynamically.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @venturialstd/gitlab
|
|
21
|
-
# or
|
|
22
|
-
yarn add @venturialstd/gitlab
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Basic Usage
|
|
28
|
-
|
|
29
|
-
### 1. Provide settings dynamically
|
|
30
|
-
|
|
31
|
-
You can create a client anywhere in your project and pass the host and token:
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
import { Injectable } from "@nestjs/common";
|
|
35
|
-
import { GitlabClient, GitlabProjectService } from "@venturialstd/gitlab";
|
|
36
|
-
import { HttpService } from "@nestjs/axios";
|
|
37
|
-
|
|
38
|
-
@Injectable()
|
|
39
|
-
export class GitlabClientProvider {
|
|
40
|
-
private client: GitlabClient;
|
|
41
|
-
private projectService: GitlabProjectService;
|
|
42
|
-
|
|
43
|
-
constructor(private readonly httpService: HttpService) {}
|
|
44
|
-
|
|
45
|
-
private async getClient(host: string, token: string) {
|
|
46
|
-
if (!this.client) {
|
|
47
|
-
this.client = new GitlabClient(this.httpService, { host, token });
|
|
48
|
-
}
|
|
49
|
-
return this.client;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async getProjectService() {
|
|
53
|
-
if (!this.projectService)
|
|
54
|
-
this.projectService = new GitlabProjectService(await this.getClient());
|
|
55
|
-
return this.projectService;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
### 2. Using the client in your service
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
import { Injectable } from "@nestjs/common";
|
|
66
|
-
import { GitlabClientProvider } from "./gitlab-client.provider";
|
|
67
|
-
import { GitlabClient } from "@venturialstd/gitlab-sdk";
|
|
68
|
-
|
|
69
|
-
@Injectable()
|
|
70
|
-
export class HarveyGitlabService {
|
|
71
|
-
constructor(private readonly gitlabClientProvider: GitlabClientProvider) {}
|
|
72
|
-
|
|
73
|
-
async reviewMergeRequest(projectName: string) {
|
|
74
|
-
const gitlabProjectService =
|
|
75
|
-
await this.gitlabClientProvider.getProjectService();
|
|
76
|
-
|
|
77
|
-
const mergeRequests =
|
|
78
|
-
await gitlabProjectService.getMergeRequests(projectId);
|
|
79
|
-
|
|
80
|
-
return mergeRequests;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## API
|
|
88
|
-
|
|
89
|
-
### GitlabClient | GitlabProjectService
|
|
90
|
-
|
|
91
|
-
| Method | Parameters | Description |
|
|
92
|
-
| ------------------------------------------------------------ | ---------------------------------------------------- | -------------------------------------------- |
|
|
93
|
-
| `getMergeRequests(projectId: string)` | projectId | Returns a list of open merge requests |
|
|
94
|
-
| `getMergeRequestDiff(projectId: string, mrId: string)` | projectId, mrId | Returns the raw diff of a merge request |
|
|
95
|
-
| `getFile(projectId: string, filePath: string, ref?: string)` | projectId, filePath, optional ref (default `"main"`) | Returns the raw content of a repository file |
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Notes
|
|
100
|
-
|
|
101
|
-
- Requires `@nestjs/axios` and `rxjs` as peer dependencies.
|
|
102
|
-
- Works with both GitLab.com and self-hosted GitLab instances.
|
|
103
|
-
- Perfect for projects where settings are loaded dynamically or from a database.
|
|
104
|
-
- **Developed and maintained by Venturial for their internal and client projects.**
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## License
|
|
109
|
-
|
|
110
|
-
MIT
|
|
1
|
+
# @venturialstd/gitlab
|
|
2
|
+
|
|
3
|
+
A lightweight **NestJS SDK for GitLab**, developed by **Venturial**, that allows you to interact with GitLab projects, merge requests, and repository files. Designed to be used by directly instantiating a client with custom configuration, without depending on a global module. Ideal for projects under the **Venturial organization**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Retrieve **open merge requests** for a GitLab project.
|
|
10
|
+
- Fetch **merge request diffs**.
|
|
11
|
+
- Get the contents of a **repository file**.
|
|
12
|
+
- Fully compatible with NestJS **HttpModule** and provider injection.
|
|
13
|
+
- No hard dependencies on a settings module—you provide the host and token dynamically.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @venturialstd/gitlab
|
|
21
|
+
# or
|
|
22
|
+
yarn add @venturialstd/gitlab
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Basic Usage
|
|
28
|
+
|
|
29
|
+
### 1. Provide settings dynamically
|
|
30
|
+
|
|
31
|
+
You can create a client anywhere in your project and pass the host and token:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { Injectable } from "@nestjs/common";
|
|
35
|
+
import { GitlabClient, GitlabProjectService } from "@venturialstd/gitlab";
|
|
36
|
+
import { HttpService } from "@nestjs/axios";
|
|
37
|
+
|
|
38
|
+
@Injectable()
|
|
39
|
+
export class GitlabClientProvider {
|
|
40
|
+
private client: GitlabClient;
|
|
41
|
+
private projectService: GitlabProjectService;
|
|
42
|
+
|
|
43
|
+
constructor(private readonly httpService: HttpService) {}
|
|
44
|
+
|
|
45
|
+
private async getClient(host: string, token: string) {
|
|
46
|
+
if (!this.client) {
|
|
47
|
+
this.client = new GitlabClient(this.httpService, { host, token });
|
|
48
|
+
}
|
|
49
|
+
return this.client;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async getProjectService() {
|
|
53
|
+
if (!this.projectService)
|
|
54
|
+
this.projectService = new GitlabProjectService(await this.getClient());
|
|
55
|
+
return this.projectService;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### 2. Using the client in your service
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { Injectable } from "@nestjs/common";
|
|
66
|
+
import { GitlabClientProvider } from "./gitlab-client.provider";
|
|
67
|
+
import { GitlabClient } from "@venturialstd/gitlab-sdk";
|
|
68
|
+
|
|
69
|
+
@Injectable()
|
|
70
|
+
export class HarveyGitlabService {
|
|
71
|
+
constructor(private readonly gitlabClientProvider: GitlabClientProvider) {}
|
|
72
|
+
|
|
73
|
+
async reviewMergeRequest(projectName: string) {
|
|
74
|
+
const gitlabProjectService =
|
|
75
|
+
await this.gitlabClientProvider.getProjectService();
|
|
76
|
+
|
|
77
|
+
const mergeRequests =
|
|
78
|
+
await gitlabProjectService.getMergeRequests(projectId);
|
|
79
|
+
|
|
80
|
+
return mergeRequests;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## API
|
|
88
|
+
|
|
89
|
+
### GitlabClient | GitlabProjectService
|
|
90
|
+
|
|
91
|
+
| Method | Parameters | Description |
|
|
92
|
+
| ------------------------------------------------------------ | ---------------------------------------------------- | -------------------------------------------- |
|
|
93
|
+
| `getMergeRequests(projectId: string)` | projectId | Returns a list of open merge requests |
|
|
94
|
+
| `getMergeRequestDiff(projectId: string, mrId: string)` | projectId, mrId | Returns the raw diff of a merge request |
|
|
95
|
+
| `getFile(projectId: string, filePath: string, ref?: string)` | projectId, filePath, optional ref (default `"main"`) | Returns the raw content of a repository file |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
|
|
101
|
+
- Requires `@nestjs/axios` and `rxjs` as peer dependencies.
|
|
102
|
+
- Works with both GitLab.com and self-hosted GitLab instances.
|
|
103
|
+
- Perfect for projects where settings are loaded dynamically or from a database.
|
|
104
|
+
- **Developed and maintained by Venturial for their internal and client projects.**
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HttpService } from
|
|
2
|
-
import { GITLAB_CLIENT_METHOD } from
|
|
3
|
-
import { GitlabClientConfig } from
|
|
4
|
-
import { GitlabLogger } from
|
|
1
|
+
import { HttpService } from "@nestjs/axios";
|
|
2
|
+
import { GITLAB_CLIENT_METHOD } from "../constants/gitlab-client.constant";
|
|
3
|
+
import { GitlabClientConfig } from "../interfaces/gitlab-client-config.interface";
|
|
4
|
+
import { GitlabLogger } from "../interfaces/gitlab-logger.interface";
|
|
5
5
|
export declare class GitlabClient {
|
|
6
6
|
private readonly httpService;
|
|
7
7
|
private readonly config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.client.d.ts","sourceRoot":"","sources":["../../src/client/gitlab.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"gitlab.client.d.ts","sourceRoot":"","sources":["../../src/client/gitlab.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,qBACa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAFP,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,YAAY,YAAA;IAGlC,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM;CAoBxD"}
|
|
@@ -1,82 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
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;
|
|
28
7
|
};
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
10
|
};
|
|
36
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
12
|
exports.GitlabClient = void 0;
|
|
13
|
+
const axios_1 = require("@nestjs/axios");
|
|
38
14
|
const common_1 = require("@nestjs/common");
|
|
39
15
|
const rxjs_1 = require("rxjs");
|
|
40
|
-
let GitlabClient =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.config = config;
|
|
60
|
-
this.logger = logger;
|
|
16
|
+
let GitlabClient = class GitlabClient {
|
|
17
|
+
httpService;
|
|
18
|
+
config;
|
|
19
|
+
logger;
|
|
20
|
+
constructor(httpService, config, logger) {
|
|
21
|
+
this.httpService = httpService;
|
|
22
|
+
this.config = config;
|
|
23
|
+
this.logger = logger;
|
|
24
|
+
}
|
|
25
|
+
async request(method, url) {
|
|
26
|
+
const fullUrl = `${this.config.host}${url}`;
|
|
27
|
+
try {
|
|
28
|
+
const response = await (0, rxjs_1.firstValueFrom)(this.httpService.request({
|
|
29
|
+
method,
|
|
30
|
+
url: fullUrl,
|
|
31
|
+
headers: { "PRIVATE-TOKEN": this.config.token },
|
|
32
|
+
}));
|
|
33
|
+
this.logger?.log(`Response OK: ${method} ${fullUrl}`);
|
|
34
|
+
return response.data;
|
|
61
35
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const response = await (0, rxjs_1.firstValueFrom)(this.httpService.request({
|
|
66
|
-
method,
|
|
67
|
-
url: fullUrl,
|
|
68
|
-
headers: { 'PRIVATE-TOKEN': this.config.token },
|
|
69
|
-
}));
|
|
70
|
-
this.logger?.log(`Response OK: ${method} ${fullUrl}`);
|
|
71
|
-
return response.data;
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
this.logger?.error(`Error on request: ${method} ${fullUrl} - ${err}`);
|
|
75
|
-
throw err;
|
|
76
|
-
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
this.logger?.error(`Error on request: ${method} ${fullUrl} - ${err}`);
|
|
38
|
+
throw err;
|
|
77
39
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
})();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
81
42
|
exports.GitlabClient = GitlabClient;
|
|
43
|
+
exports.GitlabClient = GitlabClient = __decorate([
|
|
44
|
+
(0, common_1.Injectable)(),
|
|
45
|
+
__metadata("design:paramtypes", [axios_1.HttpService, Object, Object])
|
|
46
|
+
], GitlabClient);
|
|
82
47
|
//# sourceMappingURL=gitlab.client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.client.js","sourceRoot":"","sources":["../../src/client/gitlab.client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gitlab.client.js","sourceRoot":"","sources":["../../src/client/gitlab.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAA4C;AAC5C,+BAAsC;AAK/B,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEJ;IACA;IACA;IAHnB,YACmB,WAAwB,EACxB,MAA0B,EAC1B,MAAqB;QAFrB,gBAAW,GAAX,WAAW,CAAa;QACxB,WAAM,GAAN,MAAM,CAAoB;QAC1B,WAAM,GAAN,MAAM,CAAe;IACrC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,MAA4B,EAAE,GAAW;QACrD,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC;QAE5C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBACvB,MAAM;gBACN,GAAG,EAAE,OAAO;gBACZ,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;aAChD,CAAC,CACH,CAAC;YACF,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,EAAE,KAAK,CAChB,qBAAqB,MAAM,IAAI,OAAO,MAAM,GAAY,EAAE,CAC3D,CAAC;YACF,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAA;AA3BY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAGqB,mBAAW;GAFhC,YAAY,CA2BxB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum GITLAB_EVENT_EMITTER {
|
|
2
|
+
MERGE_REQUEST_RECEIVED = "merge-request.received",
|
|
3
|
+
MERGE_REQUEST_OPENED = "merge-request.opened",
|
|
4
|
+
MERGE_REQUEST_UPDATED = "merge-request.updated",
|
|
5
|
+
MERGE_REQUEST_MERGED = "merge-request.merged",
|
|
6
|
+
MERGE_REQUEST_APPROVED = "merge-request.approved"
|
|
7
|
+
}
|
|
8
|
+
export declare enum GITLAB_MERGE_REQUEST_ACTION {
|
|
9
|
+
OPEN = "open",
|
|
10
|
+
REOPEN = "reopen",
|
|
11
|
+
CLOSE = "close",
|
|
12
|
+
MERGE = "merge",
|
|
13
|
+
UPDATE = "update"
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=gitlab-merge-request.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-merge-request.constant.d.ts","sourceRoot":"","sources":["../../src/constants/gitlab-merge-request.constant.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,sBAAsB,2BAA2B;IACjD,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,sBAAsB,2BAA2B;CAClD;AAED,oBAAY,2BAA2B;IACrC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITLAB_MERGE_REQUEST_ACTION = exports.GITLAB_EVENT_EMITTER = void 0;
|
|
4
|
+
var GITLAB_EVENT_EMITTER;
|
|
5
|
+
(function (GITLAB_EVENT_EMITTER) {
|
|
6
|
+
GITLAB_EVENT_EMITTER["MERGE_REQUEST_RECEIVED"] = "merge-request.received";
|
|
7
|
+
GITLAB_EVENT_EMITTER["MERGE_REQUEST_OPENED"] = "merge-request.opened";
|
|
8
|
+
GITLAB_EVENT_EMITTER["MERGE_REQUEST_UPDATED"] = "merge-request.updated";
|
|
9
|
+
GITLAB_EVENT_EMITTER["MERGE_REQUEST_MERGED"] = "merge-request.merged";
|
|
10
|
+
GITLAB_EVENT_EMITTER["MERGE_REQUEST_APPROVED"] = "merge-request.approved";
|
|
11
|
+
})(GITLAB_EVENT_EMITTER || (exports.GITLAB_EVENT_EMITTER = GITLAB_EVENT_EMITTER = {}));
|
|
12
|
+
var GITLAB_MERGE_REQUEST_ACTION;
|
|
13
|
+
(function (GITLAB_MERGE_REQUEST_ACTION) {
|
|
14
|
+
GITLAB_MERGE_REQUEST_ACTION["OPEN"] = "open";
|
|
15
|
+
GITLAB_MERGE_REQUEST_ACTION["REOPEN"] = "reopen";
|
|
16
|
+
GITLAB_MERGE_REQUEST_ACTION["CLOSE"] = "close";
|
|
17
|
+
GITLAB_MERGE_REQUEST_ACTION["MERGE"] = "merge";
|
|
18
|
+
GITLAB_MERGE_REQUEST_ACTION["UPDATE"] = "update";
|
|
19
|
+
})(GITLAB_MERGE_REQUEST_ACTION || (exports.GITLAB_MERGE_REQUEST_ACTION = GITLAB_MERGE_REQUEST_ACTION = {}));
|
|
20
|
+
//# sourceMappingURL=gitlab-merge-request.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-merge-request.constant.js","sourceRoot":"","sources":["../../src/constants/gitlab-merge-request.constant.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,yEAAiD,CAAA;IACjD,qEAA6C,CAAA;IAC7C,uEAA+C,CAAA;IAC/C,qEAA6C,CAAA;IAC7C,yEAAiD,CAAA;AACnD,CAAC,EANW,oBAAoB,oCAApB,oBAAoB,QAM/B;AAED,IAAY,2BAMX;AAND,WAAY,2BAA2B;IACrC,4CAAa,CAAA;IACb,gDAAiB,CAAA;IACjB,8CAAe,CAAA;IACf,8CAAe,CAAA;IACf,gDAAiB,CAAA;AACnB,CAAC,EANW,2BAA2B,2CAA3B,2BAA2B,QAMtC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum GITLAB_WEBHOOK_EVENT {
|
|
2
|
+
MERGE_REQUEST = "Merge Request Hook",
|
|
3
|
+
PIPELINE = "Pipeline Hook",
|
|
4
|
+
PUSH = "Push Hook",
|
|
5
|
+
NOTE = "Note Hook"
|
|
6
|
+
}
|
|
7
|
+
export declare enum GITLAB_WEBHOOK_STATUS {
|
|
8
|
+
OK = "ok",
|
|
9
|
+
IGNORED = "ignored",
|
|
10
|
+
ERROR = "error",
|
|
11
|
+
INVALID = "invalid",
|
|
12
|
+
UNAUTHORIZED = "unauthorized"
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=gitlab-webhook.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-webhook.constant.d.ts","sourceRoot":"","sources":["../../src/constants/gitlab-webhook.constant.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,aAAa,uBAAuB;IACpC,QAAQ,kBAAkB;IAC1B,IAAI,cAAc;IAClB,IAAI,cAAc;CACnB;AAED,oBAAY,qBAAqB;IAC/B,EAAE,OAAO;IACT,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITLAB_WEBHOOK_STATUS = exports.GITLAB_WEBHOOK_EVENT = void 0;
|
|
4
|
+
var GITLAB_WEBHOOK_EVENT;
|
|
5
|
+
(function (GITLAB_WEBHOOK_EVENT) {
|
|
6
|
+
GITLAB_WEBHOOK_EVENT["MERGE_REQUEST"] = "Merge Request Hook";
|
|
7
|
+
GITLAB_WEBHOOK_EVENT["PIPELINE"] = "Pipeline Hook";
|
|
8
|
+
GITLAB_WEBHOOK_EVENT["PUSH"] = "Push Hook";
|
|
9
|
+
GITLAB_WEBHOOK_EVENT["NOTE"] = "Note Hook";
|
|
10
|
+
})(GITLAB_WEBHOOK_EVENT || (exports.GITLAB_WEBHOOK_EVENT = GITLAB_WEBHOOK_EVENT = {}));
|
|
11
|
+
var GITLAB_WEBHOOK_STATUS;
|
|
12
|
+
(function (GITLAB_WEBHOOK_STATUS) {
|
|
13
|
+
GITLAB_WEBHOOK_STATUS["OK"] = "ok";
|
|
14
|
+
GITLAB_WEBHOOK_STATUS["IGNORED"] = "ignored";
|
|
15
|
+
GITLAB_WEBHOOK_STATUS["ERROR"] = "error";
|
|
16
|
+
GITLAB_WEBHOOK_STATUS["INVALID"] = "invalid";
|
|
17
|
+
GITLAB_WEBHOOK_STATUS["UNAUTHORIZED"] = "unauthorized";
|
|
18
|
+
})(GITLAB_WEBHOOK_STATUS || (exports.GITLAB_WEBHOOK_STATUS = GITLAB_WEBHOOK_STATUS = {}));
|
|
19
|
+
//# sourceMappingURL=gitlab-webhook.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-webhook.constant.js","sourceRoot":"","sources":["../../src/constants/gitlab-webhook.constant.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,4DAAoC,CAAA;IACpC,kDAA0B,CAAA;IAC1B,0CAAkB,CAAA;IAClB,0CAAkB,CAAA;AACpB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAED,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,kCAAS,CAAA;IACT,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,4CAAmB,CAAA;IACnB,sDAA6B,CAAA;AAC/B,CAAC,EANW,qBAAqB,qCAArB,qBAAqB,QAMhC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EventEmitter2 } from "@nestjs/event-emitter";
|
|
2
|
+
import { GITLAB_WEBHOOK_STATUS } from "../../constants/gitlab-webhook.constant";
|
|
3
|
+
import { GitlabMergeRequestDto } from "../../dtos/gitlab-merge-request.dto";
|
|
4
|
+
export declare class GitlabWebhookController {
|
|
5
|
+
private readonly eventEmitter;
|
|
6
|
+
constructor(eventEmitter: EventEmitter2);
|
|
7
|
+
handleMergeRequest(event: string, payload: GitlabMergeRequestDto): {
|
|
8
|
+
status: GITLAB_WEBHOOK_STATUS;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=gitlab-webhook.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-webhook.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/webhooks/gitlab-webhook.controller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAEL,qBAAqB,EACtB,MAAM,yCAAyC,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,qBACa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,aAAa;IAIxD,kBAAkB,CACW,KAAK,EAAE,MAAM,EAChC,OAAO,EAAE,qBAAqB;;;CAoBzC"}
|
|
@@ -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
|
+
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.GitlabWebhookController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
18
|
+
const gitlab_webhook_constant_1 = require("../../constants/gitlab-webhook.constant");
|
|
19
|
+
const gitlab_merge_request_constant_1 = require("../../constants/gitlab-merge-request.constant");
|
|
20
|
+
const gitlab_merge_request_dto_1 = require("../../dtos/gitlab-merge-request.dto");
|
|
21
|
+
let GitlabWebhookController = class GitlabWebhookController {
|
|
22
|
+
eventEmitter;
|
|
23
|
+
constructor(eventEmitter) {
|
|
24
|
+
this.eventEmitter = eventEmitter;
|
|
25
|
+
}
|
|
26
|
+
handleMergeRequest(event, payload) {
|
|
27
|
+
if (event !== gitlab_webhook_constant_1.GITLAB_WEBHOOK_EVENT.MERGE_REQUEST)
|
|
28
|
+
return { status: gitlab_webhook_constant_1.GITLAB_WEBHOOK_STATUS.IGNORED };
|
|
29
|
+
const action = payload?.object_attributes?.action;
|
|
30
|
+
switch (action) {
|
|
31
|
+
case gitlab_merge_request_constant_1.GITLAB_MERGE_REQUEST_ACTION.OPEN:
|
|
32
|
+
this.eventEmitter.emit(gitlab_merge_request_constant_1.GITLAB_EVENT_EMITTER.MERGE_REQUEST_RECEIVED, payload, { async: true });
|
|
33
|
+
return { status: gitlab_webhook_constant_1.GITLAB_WEBHOOK_STATUS.OK };
|
|
34
|
+
default:
|
|
35
|
+
return { status: gitlab_webhook_constant_1.GITLAB_WEBHOOK_STATUS.IGNORED };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.GitlabWebhookController = GitlabWebhookController;
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, common_1.Post)(),
|
|
42
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
43
|
+
__param(0, (0, common_1.Headers)("x-gitlab-event")),
|
|
44
|
+
__param(1, (0, common_1.Body)()),
|
|
45
|
+
__metadata("design:type", Function),
|
|
46
|
+
__metadata("design:paramtypes", [String, gitlab_merge_request_dto_1.GitlabMergeRequestDto]),
|
|
47
|
+
__metadata("design:returntype", void 0)
|
|
48
|
+
], GitlabWebhookController.prototype, "handleMergeRequest", null);
|
|
49
|
+
exports.GitlabWebhookController = GitlabWebhookController = __decorate([
|
|
50
|
+
(0, common_1.Controller)("webhooks/gitlab"),
|
|
51
|
+
__metadata("design:paramtypes", [event_emitter_1.EventEmitter2])
|
|
52
|
+
], GitlabWebhookController);
|
|
53
|
+
//# sourceMappingURL=gitlab-webhook.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-webhook.controller.js","sourceRoot":"","sources":["../../../src/controllers/webhooks/gitlab-webhook.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,yDAAsD;AACtD,qFAGiD;AACjD,iGAGuD;AACvD,kFAA4E;AAGrE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACL;IAA7B,YAA6B,YAA2B;QAA3B,iBAAY,GAAZ,YAAY,CAAe;IAAG,CAAC;IAI5D,kBAAkB,CACW,KAAa,EAChC,OAA8B;QAEtC,IAAI,KAAK,KAAK,8CAAoB,CAAC,aAAa;YAC9C,OAAO,EAAE,MAAM,EAAE,+CAAqB,CAAC,OAAO,EAAE,CAAC;QAEnD,MAAM,MAAM,GAAG,OAAO,EAAE,iBAAiB,EAAE,MAAM,CAAC;QAElD,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,2DAA2B,CAAC,IAAI;gBACnC,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,oDAAoB,CAAC,sBAAsB,EAC3C,OAAO,EACP,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,+CAAqB,CAAC,EAAE,EAAE,CAAC;YAE9C;gBACE,OAAO,EAAE,MAAM,EAAE,+CAAqB,CAAC,OAAO,EAAE,CAAC;QACrD,CAAC;IACH,CAAC;CACF,CAAA;AA3BY,0DAAuB;AAKlC;IAFC,IAAA,aAAI,GAAE;IACN,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IAErB,WAAA,IAAA,gBAAO,EAAC,gBAAgB,CAAC,CAAA;IACzB,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAU,gDAAqB;;iEAmBvC;kCA1BU,uBAAuB;IADnC,IAAA,mBAAU,EAAC,iBAAiB,CAAC;qCAEe,6BAAa;GAD7C,uBAAuB,CA2BnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class GitlabProjectDto {
|
|
2
|
+
id?: number;
|
|
3
|
+
name?: string;
|
|
4
|
+
web_url?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class GitlabObjectAttributesDto {
|
|
7
|
+
id?: number;
|
|
8
|
+
iid?: number;
|
|
9
|
+
action?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
source_branch?: string;
|
|
12
|
+
target_branch?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
author_id?: number;
|
|
15
|
+
state?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class GitlabMergeRequestDto {
|
|
18
|
+
object_kind?: string;
|
|
19
|
+
event_type?: string;
|
|
20
|
+
project?: GitlabProjectDto;
|
|
21
|
+
object_attributes?: GitlabObjectAttributesDto;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=gitlab-merge-request.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-merge-request.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/gitlab-merge-request.dto.ts"],"names":[],"mappings":"AAQA,qBAAa,gBAAgB;IAE3B,EAAE,CAAC,EAAE,MAAM,CAAC;IAGZ,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,yBAAyB;IAGpC,EAAE,CAAC,EAAE,MAAM,CAAC;IAIZ,GAAG,CAAC,EAAE,MAAM,CAAC;IAIb,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,aAAa,CAAC,EAAE,MAAM,CAAC;IAIvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAIvB,GAAG,CAAC,EAAE,MAAM,CAAC;IAIb,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,qBAAqB;IAEhC,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,UAAU,CAAC,EAAE,MAAM,CAAC;IAKpB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAK3B,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;CAC/C"}
|
|
@@ -0,0 +1,118 @@
|
|
|
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.GitlabMergeRequestDto = exports.GitlabObjectAttributesDto = exports.GitlabProjectDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
class GitlabProjectDto {
|
|
16
|
+
id;
|
|
17
|
+
name;
|
|
18
|
+
web_url;
|
|
19
|
+
}
|
|
20
|
+
exports.GitlabProjectDto = GitlabProjectDto;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsNumber)(),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], GitlabProjectDto.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], GitlabProjectDto.prototype, "name", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.IsString)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], GitlabProjectDto.prototype, "web_url", void 0);
|
|
33
|
+
class GitlabObjectAttributesDto {
|
|
34
|
+
id;
|
|
35
|
+
iid;
|
|
36
|
+
action;
|
|
37
|
+
title;
|
|
38
|
+
source_branch;
|
|
39
|
+
target_branch;
|
|
40
|
+
url;
|
|
41
|
+
author_id;
|
|
42
|
+
state;
|
|
43
|
+
}
|
|
44
|
+
exports.GitlabObjectAttributesDto = GitlabObjectAttributesDto;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsNumber)(),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], GitlabObjectAttributesDto.prototype, "id", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsNumber)(),
|
|
52
|
+
(0, class_validator_1.IsOptional)(),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], GitlabObjectAttributesDto.prototype, "iid", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsString)(),
|
|
57
|
+
(0, class_validator_1.IsOptional)(),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], GitlabObjectAttributesDto.prototype, "action", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, class_validator_1.IsString)(),
|
|
62
|
+
(0, class_validator_1.IsOptional)(),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], GitlabObjectAttributesDto.prototype, "title", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, class_validator_1.IsString)(),
|
|
67
|
+
(0, class_validator_1.IsOptional)(),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], GitlabObjectAttributesDto.prototype, "source_branch", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, class_validator_1.IsString)(),
|
|
72
|
+
(0, class_validator_1.IsOptional)(),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], GitlabObjectAttributesDto.prototype, "target_branch", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, class_validator_1.IsString)(),
|
|
77
|
+
(0, class_validator_1.IsOptional)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], GitlabObjectAttributesDto.prototype, "url", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, class_validator_1.IsNumber)(),
|
|
82
|
+
(0, class_validator_1.IsOptional)(),
|
|
83
|
+
__metadata("design:type", Number)
|
|
84
|
+
], GitlabObjectAttributesDto.prototype, "author_id", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, class_validator_1.IsString)(),
|
|
87
|
+
(0, class_validator_1.IsOptional)(),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], GitlabObjectAttributesDto.prototype, "state", void 0);
|
|
90
|
+
class GitlabMergeRequestDto {
|
|
91
|
+
object_kind;
|
|
92
|
+
event_type;
|
|
93
|
+
project;
|
|
94
|
+
object_attributes;
|
|
95
|
+
}
|
|
96
|
+
exports.GitlabMergeRequestDto = GitlabMergeRequestDto;
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, class_validator_1.IsString)(),
|
|
99
|
+
__metadata("design:type", String)
|
|
100
|
+
], GitlabMergeRequestDto.prototype, "object_kind", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, class_validator_1.IsString)(),
|
|
103
|
+
(0, class_validator_1.IsOptional)(),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], GitlabMergeRequestDto.prototype, "event_type", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, class_validator_1.ValidateNested)(),
|
|
108
|
+
(0, class_validator_1.IsOptional)(),
|
|
109
|
+
(0, class_transformer_1.Type)(() => GitlabProjectDto),
|
|
110
|
+
__metadata("design:type", GitlabProjectDto)
|
|
111
|
+
], GitlabMergeRequestDto.prototype, "project", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, class_validator_1.ValidateNested)(),
|
|
114
|
+
(0, class_validator_1.IsOptional)(),
|
|
115
|
+
(0, class_transformer_1.Type)(() => GitlabObjectAttributesDto),
|
|
116
|
+
__metadata("design:type", GitlabObjectAttributesDto)
|
|
117
|
+
], GitlabMergeRequestDto.prototype, "object_attributes", void 0);
|
|
118
|
+
//# sourceMappingURL=gitlab-merge-request.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-merge-request.dto.js","sourceRoot":"","sources":["../../src/dtos/gitlab-merge-request.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAKyB;AACzB,yDAAyC;AAEzC,MAAa,gBAAgB;IAE3B,EAAE,CAAU;IAGZ,IAAI,CAAU;IAGd,OAAO,CAAU;CAClB;AATD,4CASC;AAPC;IADC,IAAA,0BAAQ,GAAE;;4CACC;AAGZ;IADC,IAAA,0BAAQ,GAAE;;8CACG;AAGd;IADC,IAAA,0BAAQ,GAAE;;iDACM;AAGnB,MAAa,yBAAyB;IAGpC,EAAE,CAAU;IAIZ,GAAG,CAAU;IAIb,MAAM,CAAU;IAIhB,KAAK,CAAU;IAIf,aAAa,CAAU;IAIvB,aAAa,CAAU;IAIvB,GAAG,CAAU;IAIb,SAAS,CAAU;IAInB,KAAK,CAAU;CAChB;AApCD,8DAoCC;AAjCC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;qDACD;AAIZ;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sDACA;AAIb;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yDACG;AAIhB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;wDACE;AAIf;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;gEACU;AAIvB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;gEACU;AAIvB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sDACA;AAIb;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;4DACM;AAInB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;wDACE;AAGjB,MAAa,qBAAqB;IAEhC,WAAW,CAAU;IAIrB,UAAU,CAAU;IAKpB,OAAO,CAAoB;IAK3B,iBAAiB,CAA6B;CAC/C;AAjBD,sDAiBC;AAfC;IADC,IAAA,0BAAQ,GAAE;;0DACU;AAIrB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yDACO;AAKpB;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC;8BACnB,gBAAgB;sDAAC;AAK3B;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC;8BAClB,yBAAyB;gEAAC"}
|
package/dist/gitlab.module.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DynamicModule } from
|
|
2
|
-
import { GitlabClientConfig } from
|
|
1
|
+
import { DynamicModule } from "@nestjs/common";
|
|
2
|
+
import { GitlabClientConfig } from "./interfaces/gitlab-client-config.interface";
|
|
3
3
|
export declare class GitlabModule {
|
|
4
4
|
static register(config: GitlabClientConfig): DynamicModule;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.module.d.ts","sourceRoot":"","sources":["../src/gitlab.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"gitlab.module.d.ts","sourceRoot":"","sources":["../src/gitlab.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAKjF,qBACa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,aAAa;CAqB3D"}
|
package/dist/gitlab.module.js
CHANGED
|
@@ -1,79 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
28
|
-
};
|
|
29
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
-
var useValue = arguments.length > 2;
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
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;
|
|
35
7
|
};
|
|
8
|
+
var GitlabModule_1;
|
|
36
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
10
|
exports.GitlabModule = void 0;
|
|
38
11
|
const axios_1 = require("@nestjs/axios");
|
|
39
12
|
const common_1 = require("@nestjs/common");
|
|
40
13
|
const gitlab_client_1 = require("./client/gitlab.client");
|
|
41
14
|
const gitlab_project_service_1 = require("./services/gitlab-project.service");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
provide: gitlab_client_1.GitlabClient,
|
|
67
|
-
useFactory: (http, cfg) => new gitlab_client_1.GitlabClient(http, cfg),
|
|
68
|
-
inject: [axios_1.HttpService, 'GITLAB_CLIENT_CONFIG'],
|
|
69
|
-
},
|
|
70
|
-
gitlab_project_service_1.GitlabProjectService,
|
|
71
|
-
],
|
|
72
|
-
exports: [gitlab_client_1.GitlabClient, gitlab_project_service_1.GitlabProjectService],
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return GitlabModule = _classThis;
|
|
77
|
-
})();
|
|
15
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
16
|
+
const gitlab_webhook_controller_1 = require("./controllers/webhooks/gitlab-webhook.controller");
|
|
17
|
+
let GitlabModule = GitlabModule_1 = class GitlabModule {
|
|
18
|
+
static register(config) {
|
|
19
|
+
return {
|
|
20
|
+
module: GitlabModule_1,
|
|
21
|
+
imports: [axios_1.HttpModule, event_emitter_1.EventEmitterModule.forRoot()],
|
|
22
|
+
controllers: [gitlab_webhook_controller_1.GitlabWebhookController],
|
|
23
|
+
providers: [
|
|
24
|
+
{
|
|
25
|
+
provide: "GITLAB_CLIENT_CONFIG",
|
|
26
|
+
useValue: config,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
provide: gitlab_client_1.GitlabClient,
|
|
30
|
+
useFactory: (http, cfg) => new gitlab_client_1.GitlabClient(http, cfg),
|
|
31
|
+
inject: [axios_1.HttpService, "GITLAB_CLIENT_CONFIG"],
|
|
32
|
+
},
|
|
33
|
+
gitlab_project_service_1.GitlabProjectService,
|
|
34
|
+
],
|
|
35
|
+
exports: [gitlab_client_1.GitlabClient, gitlab_project_service_1.GitlabProjectService],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
78
39
|
exports.GitlabModule = GitlabModule;
|
|
40
|
+
exports.GitlabModule = GitlabModule = GitlabModule_1 = __decorate([
|
|
41
|
+
(0, common_1.Module)({})
|
|
42
|
+
], GitlabModule);
|
|
79
43
|
//# sourceMappingURL=gitlab.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.module.js","sourceRoot":"","sources":["../src/gitlab.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gitlab.module.js","sourceRoot":"","sources":["../src/gitlab.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,yCAAwD;AACxD,2CAAuD;AACvD,0DAAsD;AAEtD,8EAAyE;AACzE,yDAA2D;AAC3D,gGAA2F;AAGpF,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,MAA0B;QACxC,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,OAAO,EAAE,CAAC,kBAAU,EAAE,kCAAkB,CAAC,OAAO,EAAE,CAAC;YACnD,WAAW,EAAE,CAAC,mDAAuB,CAAC;YACtC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,QAAQ,EAAE,MAAM;iBACjB;gBACD;oBACE,OAAO,EAAE,4BAAY;oBACrB,UAAU,EAAE,CAAC,IAAiB,EAAE,GAAuB,EAAE,EAAE,CACzD,IAAI,4BAAY,CAAC,IAAI,EAAE,GAAG,CAAC;oBAC7B,MAAM,EAAE,CAAC,mBAAW,EAAE,sBAAsB,CAAC;iBAC9C;gBACD,6CAAoB;aACrB;YACD,OAAO,EAAE,CAAC,4BAAY,EAAE,6CAAoB,CAAC;SAC9C,CAAC;IACJ,CAAC;CACF,CAAA;AAtBY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,YAAY,CAsBxB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./client/gitlab.client";
|
|
2
|
+
export * from "./gitlab.module";
|
|
3
|
+
export * from "./interfaces/gitlab-client-config.interface";
|
|
4
|
+
export * from "./services/gitlab-project.service";
|
|
5
|
+
export * from "./constants/gitlab-merge-request.constant";
|
|
6
|
+
export * from "./constants/gitlab-webhook.constant";
|
|
7
|
+
export * from "./dtos/gitlab-merge-request.dto";
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,4 +18,7 @@ __exportStar(require("./client/gitlab.client"), exports);
|
|
|
18
18
|
__exportStar(require("./gitlab.module"), exports);
|
|
19
19
|
__exportStar(require("./interfaces/gitlab-client-config.interface"), exports);
|
|
20
20
|
__exportStar(require("./services/gitlab-project.service"), exports);
|
|
21
|
+
__exportStar(require("./constants/gitlab-merge-request.constant"), exports);
|
|
22
|
+
__exportStar(require("./constants/gitlab-webhook.constant"), exports);
|
|
23
|
+
__exportStar(require("./dtos/gitlab-merge-request.dto"), exports);
|
|
21
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,kDAAgC;AAChC,8EAA4D;AAC5D,oEAAkD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,kDAAgC;AAChC,8EAA4D;AAC5D,oEAAkD;AAClD,4EAA0D;AAC1D,sEAAoD;AACpD,kEAAgD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab-project.service.d.ts","sourceRoot":"","sources":["../../src/services/gitlab-project.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gitlab-project.service.d.ts","sourceRoot":"","sources":["../../src/services/gitlab-project.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,qBACa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAEjD,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAOlE,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAO5E"}
|
|
@@ -1,72 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
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;
|
|
28
7
|
};
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
10
|
};
|
|
36
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
12
|
exports.GitlabProjectService = void 0;
|
|
38
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
+
const gitlab_client_1 = require("../client/gitlab.client");
|
|
39
15
|
const gitlab_client_constant_1 = require("../constants/gitlab-client.constant");
|
|
40
|
-
let GitlabProjectService =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.client = client;
|
|
57
|
-
}
|
|
58
|
-
getMergeRequests(projectId) {
|
|
59
|
-
return this.client.request(gitlab_client_constant_1.GITLAB_CLIENT_METHOD.GET, `/projects/${projectId}/merge_requests?state=opened`);
|
|
60
|
-
}
|
|
61
|
-
getMergeRequestDiff(projectId, mrId) {
|
|
62
|
-
return this.client.request(gitlab_client_constant_1.GITLAB_CLIENT_METHOD.GET, `/projects/${projectId}/merge_requests/${mrId}/raw_diffs`);
|
|
63
|
-
}
|
|
64
|
-
getFile(projectId, filePath, ref = "main") {
|
|
65
|
-
const encoded = encodeURIComponent(filePath);
|
|
66
|
-
return this.client.request(gitlab_client_constant_1.GITLAB_CLIENT_METHOD.GET, `/projects/${projectId}/repository/files/${encoded}/raw?ref=${ref}`);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return GitlabProjectService = _classThis;
|
|
70
|
-
})();
|
|
16
|
+
let GitlabProjectService = class GitlabProjectService {
|
|
17
|
+
client;
|
|
18
|
+
constructor(client) {
|
|
19
|
+
this.client = client;
|
|
20
|
+
}
|
|
21
|
+
getMergeRequests(projectId) {
|
|
22
|
+
return this.client.request(gitlab_client_constant_1.GITLAB_CLIENT_METHOD.GET, `/projects/${projectId}/merge_requests?state=opened`);
|
|
23
|
+
}
|
|
24
|
+
getMergeRequestDiff(projectId, mrId) {
|
|
25
|
+
return this.client.request(gitlab_client_constant_1.GITLAB_CLIENT_METHOD.GET, `/projects/${projectId}/merge_requests/${mrId}/raw_diffs`);
|
|
26
|
+
}
|
|
27
|
+
getFile(projectId, filePath, ref = "main") {
|
|
28
|
+
const encoded = encodeURIComponent(filePath);
|
|
29
|
+
return this.client.request(gitlab_client_constant_1.GITLAB_CLIENT_METHOD.GET, `/projects/${projectId}/repository/files/${encoded}/raw?ref=${ref}`);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
71
32
|
exports.GitlabProjectService = GitlabProjectService;
|
|
33
|
+
exports.GitlabProjectService = GitlabProjectService = __decorate([
|
|
34
|
+
(0, common_1.Injectable)(),
|
|
35
|
+
__metadata("design:paramtypes", [gitlab_client_1.GitlabClient])
|
|
36
|
+
], GitlabProjectService);
|
|
72
37
|
//# sourceMappingURL=gitlab-project.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab-project.service.js","sourceRoot":"","sources":["../../src/services/gitlab-project.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gitlab-project.service.js","sourceRoot":"","sources":["../../src/services/gitlab-project.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2DAAuD;AACvD,gFAA2E;AAIpE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACF;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,gBAAgB,CAAC,SAAiB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,8BAA8B,CACrD,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,SAAiB,EAAE,IAAY;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,mBAAmB,IAAI,YAAY,CAC1D,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,GAAG,GAAG,MAAM;QACvD,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,qBAAqB,OAAO,YAAY,GAAG,EAAE,CACpE,CAAC;IACJ,CAAC;CACF,CAAA;AAxBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAE0B,4BAAY;GADtC,oBAAoB,CAwBhC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venturialstd/gitlab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "GitLab API Venturial",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,5 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "^5.9.3"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@nestjs/common": "^11.0.11",
|
|
25
|
+
"@nestjs/core": "^11.0.5",
|
|
26
|
+
"@nestjs/axios": "^4.0.0",
|
|
27
|
+
"rxjs": "^7.8.1",
|
|
28
|
+
"@nestjs/event-emitter": "^3.0.1",
|
|
29
|
+
"class-transformer": "^0.5.1",
|
|
30
|
+
"class-validator": "^0.14.1"
|
|
21
31
|
}
|
|
22
32
|
}
|