@venturialstd/gitlab 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.
Files changed (42) hide show
  1. package/README.md +114 -0
  2. package/dist/client/gitlab-copy.client.d.ts +10 -0
  3. package/dist/client/gitlab-copy.client.d.ts.map +1 -0
  4. package/dist/client/gitlab-copy.client.js +71 -0
  5. package/dist/client/gitlab-copy.client.js.map +1 -0
  6. package/dist/client/gitlab.client.d.ts +10 -0
  7. package/dist/client/gitlab.client.d.ts.map +1 -0
  8. package/dist/client/gitlab.client.js +71 -0
  9. package/dist/client/gitlab.client.js.map +1 -0
  10. package/dist/constants/gitlab-client.constant.d.ts +5 -0
  11. package/dist/constants/gitlab-client.constant.d.ts.map +1 -0
  12. package/dist/constants/gitlab-client.constant.js +9 -0
  13. package/dist/constants/gitlab-client.constant.js.map +1 -0
  14. package/dist/gitlab.client.d.ts +12 -0
  15. package/dist/gitlab.client.d.ts.map +1 -0
  16. package/dist/gitlab.client.js +88 -0
  17. package/dist/gitlab.client.js.map +1 -0
  18. package/dist/gitlab.module.d.ts +6 -0
  19. package/dist/gitlab.module.d.ts.map +1 -0
  20. package/dist/gitlab.module.js +79 -0
  21. package/dist/gitlab.module.js.map +1 -0
  22. package/dist/gitlab.service.d.ts +9 -0
  23. package/dist/gitlab.service.d.ts.map +1 -0
  24. package/dist/gitlab.service.js +70 -0
  25. package/dist/gitlab.service.js.map +1 -0
  26. package/dist/index.d.ts +5 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +21 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/interfaces/gitlab-client-config.interface.d.ts +5 -0
  31. package/dist/interfaces/gitlab-client-config.interface.d.ts.map +1 -0
  32. package/dist/interfaces/gitlab-client-config.interface.js +3 -0
  33. package/dist/interfaces/gitlab-client-config.interface.js.map +1 -0
  34. package/dist/services/gitlab-copy.service.d.ts +9 -0
  35. package/dist/services/gitlab-copy.service.d.ts.map +1 -0
  36. package/dist/services/gitlab-copy.service.js +72 -0
  37. package/dist/services/gitlab-copy.service.js.map +1 -0
  38. package/dist/services/gitlab-project.service.d.ts +9 -0
  39. package/dist/services/gitlab-project.service.d.ts.map +1 -0
  40. package/dist/services/gitlab-project.service.js +72 -0
  41. package/dist/services/gitlab-project.service.js.map +1 -0
  42. package/package.json +21 -0
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # @venturialstd/gitlab-sdk
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-sdk
21
+ # or
22
+ yarn add @venturialstd/gitlab-sdk
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 } from "@venturialstd/gitlab-sdk";
36
+ import { HttpService } from "@nestjs/axios";
37
+
38
+ @Injectable()
39
+ export class GitlabClientProvider {
40
+ private client: GitlabClient;
41
+
42
+ constructor(private readonly httpService: HttpService) {}
43
+
44
+ async getClient(host: string, token: string): Promise<GitlabClient> {
45
+ if (!this.client) {
46
+ this.client = new GitlabClient(this.httpService, { host, token });
47
+ }
48
+ return this.client;
49
+ }
50
+ }
51
+ ```
52
+
53
+ ---
54
+
55
+ ### 2. Using the client in your service
56
+
57
+ ```ts
58
+ import { Injectable } from "@nestjs/common";
59
+ import { GitlabClientProvider } from "./gitlab-client.provider";
60
+ import { GitlabClient } from "@venturialstd/gitlab-sdk";
61
+
62
+ @Injectable()
63
+ export class HarveyGitlabService {
64
+ constructor(private readonly gitlabClientProvider: GitlabClientProvider) {}
65
+
66
+ async reviewMergeRequest(projectName: string, host: string, token: string) {
67
+ const client: GitlabClient = await this.gitlabClientProvider.getClient(
68
+ host,
69
+ token
70
+ );
71
+
72
+ const mergeRequests = await client.getMergeRequests(projectName);
73
+ if (!mergeRequests || mergeRequests.length === 0)
74
+ return "No open merge requests";
75
+
76
+ const mrId = mergeRequests[0].iid;
77
+ const diff = await client.getMergeRequestDiff(projectName, mrId);
78
+ const fileContent = await client.getFile(projectName, "README.md");
79
+
80
+ return {
81
+ mergeRequest: mergeRequests[0],
82
+ diff,
83
+ fileContent,
84
+ };
85
+ }
86
+ }
87
+ ```
88
+
89
+ ---
90
+
91
+ ## API
92
+
93
+ ### GitlabClient
94
+
95
+ | Method | Parameters | Description |
96
+ | ------------------------------------------------------------ | ---------------------------------------------------------- | ----------------------------------------------------- |
97
+ | `getMergeRequests(projectId: string)` | `projectId` | Returns a list of open merge requests for the project |
98
+ | `getMergeRequestDiff(projectId: string, mrId: string)` | `projectId`, `mrId` | Returns the raw diff of a merge request |
99
+ | `getFile(projectId: string, filePath: string, ref?: string)` | `projectId`, `filePath`, optional `ref` (default `"main"`) | Returns the raw content of a repository file |
100
+
101
+ ---
102
+
103
+ ## Notes
104
+
105
+ - Requires `@nestjs/axios` and `rxjs` as peer dependencies.
106
+ - Works with both GitLab.com and self-hosted GitLab instances.
107
+ - Perfect for projects where settings are loaded dynamically or from a database.
108
+ - **Developed and maintained by Venturial for their internal and client projects.**
109
+
110
+ ---
111
+
112
+ ## License
113
+
114
+ MIT
@@ -0,0 +1,10 @@
1
+ import { HttpService } from "@nestjs/axios";
2
+ import { GitlabClientConfig } from "../interfaces/gitlab-client-config.interface";
3
+ import { GITLAB_CLIENT_METHOD } from "../constants/gitlab-client.constant";
4
+ export declare class GitlabClientCopy {
5
+ private readonly httpService;
6
+ private readonly config;
7
+ constructor(httpService: HttpService, config: GitlabClientConfig);
8
+ request(method: GITLAB_CLIENT_METHOD, url: string): Promise<any>;
9
+ }
10
+ //# sourceMappingURL=gitlab-copy.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-copy.client.d.ts","sourceRoot":"","sources":["../../src/client/gitlab-copy.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,qBACa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,kBAAkB;IAGvC,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM;CASxD"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabClientCopy = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const rxjs_1 = require("rxjs");
40
+ let GitlabClientCopy = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var GitlabClientCopy = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ GitlabClientCopy = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ httpService;
55
+ config;
56
+ constructor(httpService, config) {
57
+ this.httpService = httpService;
58
+ this.config = config;
59
+ }
60
+ async request(method, url) {
61
+ return (0, rxjs_1.firstValueFrom)(this.httpService.request({
62
+ method,
63
+ url: `${this.config.host}${url}`,
64
+ headers: { "PRIVATE-TOKEN": this.config.token },
65
+ })).then((res) => res.data);
66
+ }
67
+ };
68
+ return GitlabClientCopy = _classThis;
69
+ })();
70
+ exports.GitlabClientCopy = GitlabClientCopy;
71
+ //# sourceMappingURL=gitlab-copy.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-copy.client.js","sourceRoot":"","sources":["../../src/client/gitlab-copy.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,+BAAsC;IAIzB,gBAAgB;4BAD5B,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KAeC;;;YAfY,uDAAgB;;QAER,WAAW;QACX,MAAM;QAFzB,YACmB,WAAwB,EACxB,MAA0B;YAD1B,gBAAW,GAAX,WAAW,CAAa;YACxB,WAAM,GAAN,MAAM,CAAoB;QAC1C,CAAC;QAEJ,KAAK,CAAC,OAAO,CAAC,MAA4B,EAAE,GAAW;YACrD,OAAO,IAAA,qBAAc,EACnB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBACvB,MAAM;gBACN,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE;gBAChC,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;aAChD,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;;;;AAdU,4CAAgB"}
@@ -0,0 +1,10 @@
1
+ import { HttpService } from "@nestjs/axios";
2
+ import { GitlabClientConfig } from "../interfaces/gitlab-client-config.interface";
3
+ import { GITLAB_CLIENT_METHOD } from "../constants/gitlab-client.constant";
4
+ export declare class GitlabClient {
5
+ private readonly httpService;
6
+ private readonly config;
7
+ constructor(httpService: HttpService, config: GitlabClientConfig);
8
+ request(method: GITLAB_CLIENT_METHOD, url: string): Promise<any>;
9
+ }
10
+ //# sourceMappingURL=gitlab.client.d.ts.map
@@ -0,0 +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;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,qBACa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,kBAAkB;IAGvC,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM;CASxD"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabClient = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const rxjs_1 = require("rxjs");
40
+ let GitlabClient = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var GitlabClient = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ GitlabClient = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ httpService;
55
+ config;
56
+ constructor(httpService, config) {
57
+ this.httpService = httpService;
58
+ this.config = config;
59
+ }
60
+ async request(method, url) {
61
+ return (0, rxjs_1.firstValueFrom)(this.httpService.request({
62
+ method,
63
+ url: `${this.config.host}${url}`,
64
+ headers: { "PRIVATE-TOKEN": this.config.token },
65
+ })).then((res) => res.data);
66
+ }
67
+ };
68
+ return GitlabClient = _classThis;
69
+ })();
70
+ exports.GitlabClient = GitlabClient;
71
+ //# sourceMappingURL=gitlab.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab.client.js","sourceRoot":"","sources":["../../src/client/gitlab.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,+BAAsC;IAIzB,YAAY;4BADxB,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KAeC;;;YAfY,uDAAY;;QAEJ,WAAW;QACX,MAAM;QAFzB,YACmB,WAAwB,EACxB,MAA0B;YAD1B,gBAAW,GAAX,WAAW,CAAa;YACxB,WAAM,GAAN,MAAM,CAAoB;QAC1C,CAAC;QAEJ,KAAK,CAAC,OAAO,CAAC,MAA4B,EAAE,GAAW;YACrD,OAAO,IAAA,qBAAc,EACnB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBACvB,MAAM;gBACN,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE;gBAChC,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;aAChD,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;;;;AAdU,oCAAY"}
@@ -0,0 +1,5 @@
1
+ export declare enum GITLAB_CLIENT_METHOD {
2
+ GET = "GET",
3
+ POST = "POST"
4
+ }
5
+ //# sourceMappingURL=gitlab-client.constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-client.constant.d.ts","sourceRoot":"","sources":["../../src/constants/gitlab-client.constant.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,GAAG,QAAQ;IACX,IAAI,SAAS;CACd"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GITLAB_CLIENT_METHOD = void 0;
4
+ var GITLAB_CLIENT_METHOD;
5
+ (function (GITLAB_CLIENT_METHOD) {
6
+ GITLAB_CLIENT_METHOD["GET"] = "GET";
7
+ GITLAB_CLIENT_METHOD["POST"] = "POST";
8
+ })(GITLAB_CLIENT_METHOD || (exports.GITLAB_CLIENT_METHOD = GITLAB_CLIENT_METHOD = {}));
9
+ //# sourceMappingURL=gitlab-client.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-client.constant.js","sourceRoot":"","sources":["../../src/constants/gitlab-client.constant.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,mCAAW,CAAA;IACX,qCAAa,CAAA;AACf,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B"}
@@ -0,0 +1,12 @@
1
+ import { HttpService } from "@nestjs/axios";
2
+ import { GitlabClientConfig } from "./interfaces/gitlab-client-config.interface";
3
+ export declare class GitlabClient {
4
+ private readonly httpService;
5
+ private readonly config;
6
+ constructor(httpService: HttpService, config: GitlabClientConfig);
7
+ private get headers();
8
+ getMergeRequests(projectId: string): Promise<any>;
9
+ getMergeRequestDiff(projectId: string, mrId: string): Promise<any>;
10
+ getFile(projectId: string, filePath: string, ref?: string): Promise<any>;
11
+ }
12
+ //# sourceMappingURL=gitlab.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab.client.d.ts","sourceRoot":"","sources":["../src/gitlab.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEjF,qBACa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,kBAAkB;IAG7C,OAAO,KAAK,OAAO,GAIlB;IAEK,gBAAgB,CAAC,SAAS,EAAE,MAAM;IAQlC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAQnD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS;CAahE"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabClient = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const rxjs_1 = require("rxjs");
40
+ let GitlabClient = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var GitlabClient = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ GitlabClient = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ httpService;
55
+ config;
56
+ constructor(httpService, config) {
57
+ this.httpService = httpService;
58
+ this.config = config;
59
+ }
60
+ get headers() {
61
+ return {
62
+ "PRIVATE-TOKEN": this.config.token,
63
+ };
64
+ }
65
+ async getMergeRequests(projectId) {
66
+ const url = `${this.config.host}/projects/${projectId}/merge_requests?state=opened`;
67
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.get(url, { headers: this.headers }));
68
+ return data;
69
+ }
70
+ async getMergeRequestDiff(projectId, mrId) {
71
+ const url = `${this.config.host}/projects/${projectId}/merge_requests/${mrId}/raw_diffs`;
72
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.get(url, { headers: this.headers }));
73
+ return data;
74
+ }
75
+ async getFile(projectId, filePath, ref = "main") {
76
+ const encoded = encodeURIComponent(filePath);
77
+ const url = `${this.config.host}/projects/${projectId}/repository/files/${encoded}/raw?ref=${ref}`;
78
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.get(url, {
79
+ headers: this.headers,
80
+ responseType: "text",
81
+ }));
82
+ return data;
83
+ }
84
+ };
85
+ return GitlabClient = _classThis;
86
+ })();
87
+ exports.GitlabClient = GitlabClient;
88
+ //# sourceMappingURL=gitlab.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab.client.js","sourceRoot":"","sources":["../src/gitlab.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,+BAAsC;IAIzB,YAAY;4BADxB,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KAyCC;;;YAzCY,uDAAY;;QAEJ,WAAW;QACX,MAAM;QAFzB,YACmB,WAAwB,EACxB,MAA0B;YAD1B,gBAAW,GAAX,WAAW,CAAa;YACxB,WAAM,GAAN,MAAM,CAAoB;QAC1C,CAAC;QAEJ,IAAY,OAAO;YACjB,OAAO;gBACL,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;aACnC,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,gBAAgB,CAAC,SAAiB;YACtC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,aAAa,SAAS,8BAA8B,CAAC;YACpF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CACrD,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QAED,KAAK,CAAC,mBAAmB,CAAC,SAAiB,EAAE,IAAY;YACvD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,aAAa,SAAS,mBAAmB,IAAI,YAAY,CAAC;YACzF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CACrD,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,GAAG,GAAG,MAAM;YAC7D,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC7C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,aAAa,SAAS,qBAAqB,OAAO,YAAY,GAAG,EAAE,CAAC;YAEnG,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,YAAY,EAAE,MAAM;aACrB,CAAC,CACH,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC;;;;AAxCU,oCAAY"}
@@ -0,0 +1,6 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ import { GitlabClientConfig } from "./interfaces/gitlab-client-config.interface";
3
+ export declare class GitlabModule {
4
+ static register(config: GitlabClientConfig): DynamicModule;
5
+ }
6
+ //# sourceMappingURL=gitlab.module.d.ts.map
@@ -0,0 +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;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAIjF,qBACa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,aAAa;CAoB3D"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabModule = void 0;
38
+ const axios_1 = require("@nestjs/axios");
39
+ const common_1 = require("@nestjs/common");
40
+ const gitlab_client_1 = require("./client/gitlab.client");
41
+ const gitlab_project_service_1 = require("./services/gitlab-project.service");
42
+ let GitlabModule = (() => {
43
+ let _classDecorators = [(0, common_1.Module)({})];
44
+ let _classDescriptor;
45
+ let _classExtraInitializers = [];
46
+ let _classThis;
47
+ var GitlabModule = class {
48
+ static { _classThis = this; }
49
+ static {
50
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
51
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
52
+ GitlabModule = _classThis = _classDescriptor.value;
53
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
54
+ __runInitializers(_classThis, _classExtraInitializers);
55
+ }
56
+ static register(config) {
57
+ return {
58
+ module: GitlabModule,
59
+ imports: [axios_1.HttpModule],
60
+ providers: [
61
+ {
62
+ provide: "GITLAB_CLIENT_CONFIG",
63
+ useValue: config,
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
+ })();
78
+ exports.GitlabModule = GitlabModule;
79
+ //# sourceMappingURL=gitlab.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab.module.js","sourceRoot":"","sources":["../src/gitlab.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwD;AACxD,2CAAuD;AAEvD,0DAAsD;AACtD,8EAAyE;IAG5D,YAAY;4BADxB,IAAA,eAAM,EAAC,EAAE,CAAC;;;;;;;;YACX,6KAqBC;;;YArBY,uDAAY;;QACvB,MAAM,CAAC,QAAQ,CAAC,MAA0B;YACxC,OAAO;gBACL,MAAM,EAAE,YAAY;gBACpB,OAAO,EAAE,CAAC,kBAAU,CAAC;gBACrB,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,sBAAsB;wBAC/B,QAAQ,EAAE,MAAM;qBACjB;oBACD;wBACE,OAAO,EAAE,4BAAY;wBACrB,UAAU,EAAE,CAAC,IAAiB,EAAE,GAAuB,EAAE,EAAE,CACzD,IAAI,4BAAY,CAAC,IAAI,EAAE,GAAG,CAAC;wBAC7B,MAAM,EAAE,CAAC,mBAAW,EAAE,sBAAsB,CAAC;qBAC9C;oBACD,6CAAoB;iBACrB;gBACD,OAAO,EAAE,CAAC,4BAAY,EAAE,6CAAoB,CAAC;aAC9C,CAAC;QACJ,CAAC;;;;AApBU,oCAAY"}
@@ -0,0 +1,9 @@
1
+ import { GitlabClient } from "./gitlab.client";
2
+ export declare class GitlabService {
3
+ private readonly client;
4
+ constructor(client: GitlabClient);
5
+ getMergeRequests(projectId: string): Promise<any>;
6
+ getMergeRequestDiff(projectId: string, mrId: string): Promise<any>;
7
+ getFile(projectId: string, filePath: string, ref?: string): Promise<any>;
8
+ }
9
+ //# sourceMappingURL=gitlab.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab.service.d.ts","sourceRoot":"","sources":["../src/gitlab.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBACa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAEjD,gBAAgB,CAAC,SAAS,EAAE,MAAM;IAIlC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAInD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS;CAG1D"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabService = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ let GitlabService = (() => {
40
+ let _classDecorators = [(0, common_1.Injectable)()];
41
+ let _classDescriptor;
42
+ let _classExtraInitializers = [];
43
+ let _classThis;
44
+ var GitlabService = class {
45
+ static { _classThis = this; }
46
+ static {
47
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
48
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
49
+ GitlabService = _classThis = _classDescriptor.value;
50
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
51
+ __runInitializers(_classThis, _classExtraInitializers);
52
+ }
53
+ client;
54
+ constructor(client) {
55
+ this.client = client;
56
+ }
57
+ getMergeRequests(projectId) {
58
+ return this.client.getMergeRequests(projectId);
59
+ }
60
+ getMergeRequestDiff(projectId, mrId) {
61
+ return this.client.getMergeRequestDiff(projectId, mrId);
62
+ }
63
+ getFile(projectId, filePath, ref = "main") {
64
+ return this.client.getFile(projectId, filePath, ref);
65
+ }
66
+ };
67
+ return GitlabService = _classThis;
68
+ })();
69
+ exports.GitlabService = GitlabService;
70
+ //# sourceMappingURL=gitlab.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab.service.js","sourceRoot":"","sources":["../src/gitlab.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;IAI/B,aAAa;4BADzB,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KAcC;;;YAdY,uDAAa;;QACK,MAAM;QAAnC,YAA6B,MAAoB;YAApB,WAAM,GAAN,MAAM,CAAc;QAAG,CAAC;QAErD,gBAAgB,CAAC,SAAiB;YAChC,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;QAED,mBAAmB,CAAC,SAAiB,EAAE,IAAY;YACjD,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,GAAG,GAAG,MAAM;YACvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;;;;AAbU,sCAAa"}
@@ -0,0 +1,5 @@
1
+ export * from "./client/gitlab.client";
2
+ export * from "./gitlab.module";
3
+ export * from "./services/gitlab-project.service";
4
+ export * from "./interfaces/gitlab-client-config.interface";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,mCAAmC,CAAC;AAClD,cAAc,6CAA6C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/gitlab.client"), exports);
18
+ __exportStar(require("./gitlab.module"), exports);
19
+ __exportStar(require("./services/gitlab-project.service"), exports);
20
+ __exportStar(require("./interfaces/gitlab-client-config.interface"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,kDAAgC;AAChC,oEAAkD;AAClD,8EAA4D"}
@@ -0,0 +1,5 @@
1
+ export interface GitlabClientConfig {
2
+ host: string;
3
+ token: string;
4
+ }
5
+ //# sourceMappingURL=gitlab-client-config.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-client-config.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/gitlab-client-config.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=gitlab-client-config.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-client-config.interface.js","sourceRoot":"","sources":["../../src/interfaces/gitlab-client-config.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { GitlabClientCopy } from "../client/gitlab-copy.client";
2
+ export declare class GitlabCopyService {
3
+ private readonly client;
4
+ constructor(client: GitlabClientCopy);
5
+ getMergeRequests(projectId: string): Promise<any>;
6
+ getMergeRequestDiff(projectId: string, mrId: string): Promise<any>;
7
+ getFile(projectId: string, filePath: string, ref?: string): Promise<any>;
8
+ }
9
+ //# sourceMappingURL=gitlab-copy.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-copy.service.d.ts","sourceRoot":"","sources":["../../src/services/gitlab-copy.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,qBACa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,gBAAgB;IAErD,gBAAgB,CAAC,SAAS,EAAE,MAAM;IAOlC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAOnD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS;CAO1D"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabCopyService = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const gitlab_client_constant_1 = require("../constants/gitlab-client.constant");
40
+ let GitlabCopyService = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var GitlabCopyService = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ GitlabCopyService = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ client;
55
+ constructor(client) {
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 GitlabCopyService = _classThis;
70
+ })();
71
+ exports.GitlabCopyService = GitlabCopyService;
72
+ //# sourceMappingURL=gitlab-copy.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-copy.service.js","sourceRoot":"","sources":["../../src/services/gitlab-copy.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,gFAA2E;IAG9D,iBAAiB;4BAD7B,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KAwBC;;;YAxBY,uDAAiB;;QACC,MAAM;QAAnC,YAA6B,MAAwB;YAAxB,WAAM,GAAN,MAAM,CAAkB;QAAG,CAAC;QAEzD,gBAAgB,CAAC,SAAiB;YAChC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,8BAA8B,CACrD,CAAC;QACJ,CAAC;QAED,mBAAmB,CAAC,SAAiB,EAAE,IAAY;YACjD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,mBAAmB,IAAI,YAAY,CAC1D,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,GAAG,GAAG,MAAM;YACvD,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,qBAAqB,OAAO,YAAY,GAAG,EAAE,CACpE,CAAC;QACJ,CAAC;;;;AAvBU,8CAAiB"}
@@ -0,0 +1,9 @@
1
+ import { GitlabClient } from "../client/gitlab.client";
2
+ export declare class GitlabProjectService {
3
+ private readonly client;
4
+ constructor(client: GitlabClient);
5
+ getMergeRequests(projectId: string): Promise<any>;
6
+ getMergeRequestDiff(projectId: string, mrId: string): Promise<any>;
7
+ getFile(projectId: string, filePath: string, ref?: string): Promise<any>;
8
+ }
9
+ //# sourceMappingURL=gitlab-project.service.d.ts.map
@@ -0,0 +1 @@
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;AAGvD,qBACa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAEjD,gBAAgB,CAAC,SAAS,EAAE,MAAM;IAOlC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAOnD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS;CAO1D"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
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;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.GitlabProjectService = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const gitlab_client_constant_1 = require("../constants/gitlab-client.constant");
40
+ let GitlabProjectService = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var GitlabProjectService = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ GitlabProjectService = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ client;
55
+ constructor(client) {
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
+ })();
71
+ exports.GitlabProjectService = GitlabProjectService;
72
+ //# sourceMappingURL=gitlab-project.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-project.service.js","sourceRoot":"","sources":["../../src/services/gitlab-project.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,gFAA2E;IAG9D,oBAAoB;4BADhC,IAAA,mBAAU,GAAE;;;;;;;;YACb,6KAwBC;;;YAxBY,uDAAoB;;QACF,MAAM;QAAnC,YAA6B,MAAoB;YAApB,WAAM,GAAN,MAAM,CAAc;QAAG,CAAC;QAErD,gBAAgB,CAAC,SAAiB;YAChC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,8BAA8B,CACrD,CAAC;QACJ,CAAC;QAED,mBAAmB,CAAC,SAAiB,EAAE,IAAY;YACjD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,mBAAmB,IAAI,YAAY,CAC1D,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,GAAG,GAAG,MAAM;YACvD,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,6CAAoB,CAAC,GAAG,EACxB,aAAa,SAAS,qBAAqB,OAAO,YAAY,GAAG,EAAE,CACpE,CAAC;QACJ,CAAC;;;;AAvBU,oDAAoB"}
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@venturialstd/gitlab",
3
+ "version": "0.0.1",
4
+ "description": "GitLab API Venturial",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "commonjs",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.json",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.9.3"
20
+ }
21
+ }