@aurtic/cli 1.0.3 → 2.0.4

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 (57) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +20 -0
  3. package/dist/app.controller.d.ts +6 -0
  4. package/dist/app.controller.js +35 -0
  5. package/dist/app.controller.js.map +1 -0
  6. package/dist/app.module.d.ts +2 -0
  7. package/dist/app.module.js +40 -0
  8. package/dist/app.module.js.map +1 -0
  9. package/dist/app.service.d.ts +3 -0
  10. package/dist/app.service.js +20 -0
  11. package/dist/app.service.js.map +1 -0
  12. package/dist/authentication/authentication.command.d.ts +9 -0
  13. package/dist/authentication/authentication.command.js +60 -0
  14. package/dist/authentication/authentication.command.js.map +1 -0
  15. package/dist/authentication/authentication.module.d.ts +2 -0
  16. package/dist/authentication/authentication.module.js +24 -0
  17. package/dist/authentication/authentication.module.js.map +1 -0
  18. package/dist/authentication/authentication.service.d.ts +10 -0
  19. package/dist/authentication/authentication.service.js +69 -0
  20. package/dist/authentication/authentication.service.js.map +1 -0
  21. package/dist/builds/builds.command.d.ts +12 -0
  22. package/dist/builds/builds.command.js +116 -0
  23. package/dist/builds/builds.command.js.map +1 -0
  24. package/dist/builds/builds.module.d.ts +2 -0
  25. package/dist/builds/builds.module.js +25 -0
  26. package/dist/builds/builds.module.js.map +1 -0
  27. package/dist/builds/builds.service.d.ts +17 -0
  28. package/dist/builds/builds.service.js +156 -0
  29. package/dist/builds/builds.service.js.map +1 -0
  30. package/dist/builds/builds.zip.service.d.ts +3 -0
  31. package/dist/builds/builds.zip.service.js +73 -0
  32. package/dist/builds/builds.zip.service.js.map +1 -0
  33. package/dist/github/github.module.d.ts +2 -0
  34. package/dist/github/github.module.js +21 -0
  35. package/dist/github/github.module.js.map +1 -0
  36. package/dist/github/github.service.d.ts +3 -0
  37. package/dist/github/github.service.js +25 -0
  38. package/dist/github/github.service.js.map +1 -0
  39. package/dist/main.js +10 -0
  40. package/dist/main.js.map +1 -0
  41. package/dist/tsconfig.build.tsbuildinfo +1 -0
  42. package/package.json +73 -24
  43. package/README +0 -29
  44. package/dist/api.d.ts +0 -14
  45. package/dist/api.js +0 -148
  46. package/dist/cli.js +0 -281
  47. package/dist/entities/Project.d.ts +0 -39
  48. package/dist/entities/Project.js +0 -124
  49. package/dist/entities/ProjectContainer.d.ts +0 -227
  50. package/dist/entities/ProjectContainer.js +0 -465
  51. package/dist/entities/Server.d.ts +0 -45
  52. package/dist/entities/Server.js +0 -114
  53. package/dist/entities/Team.d.ts +0 -49
  54. package/dist/entities/Team.js +0 -149
  55. package/dist/tsconfig.tsbuildinfo +0 -1
  56. package/tsconfig.json +0 -24
  57. /package/dist/{cli.d.ts → main.d.ts} +0 -0
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023, Foxiko Cloud, Inc d.b.a. Aurtic
1
+ Copyright 2025, Foxiko Cloud, Inc d.b.a. Aurtic
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # How to Use the CLI
2
+
3
+ ## Usage
4
+ ```
5
+ npm install --save @aurtic/cli
6
+ ```
7
+
8
+ ## Upgrade from v1
9
+ ```
10
+ npm install --save @aurtic/cli@2
11
+ ```
12
+
13
+
14
+ ## CLI Commands
15
+
16
+ - `npx @aurtic/cli login <username> [--password <password>]`
17
+ Authenticates the user and returns an access token.
18
+
19
+ - `npx @aurtic/cli build <serviceId> [--password <password>]`
20
+ Builds in the current directory
@@ -0,0 +1,6 @@
1
+ import { AppService } from './app.service';
2
+ export declare class AppController {
3
+ private readonly appService;
4
+ constructor(appService: AppService);
5
+ getHello(): string;
6
+ }
@@ -0,0 +1,35 @@
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.AppController = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const app_service_1 = require("./app.service");
15
+ let AppController = class AppController {
16
+ appService;
17
+ constructor(appService) {
18
+ this.appService = appService;
19
+ }
20
+ getHello() {
21
+ return this.appService.getHello();
22
+ }
23
+ };
24
+ exports.AppController = AppController;
25
+ __decorate([
26
+ (0, common_1.Get)(),
27
+ __metadata("design:type", Function),
28
+ __metadata("design:paramtypes", []),
29
+ __metadata("design:returntype", String)
30
+ ], AppController.prototype, "getHello", null);
31
+ exports.AppController = AppController = __decorate([
32
+ (0, common_1.Controller)(),
33
+ __metadata("design:paramtypes", [app_service_1.AppService])
34
+ ], AppController);
35
+ //# sourceMappingURL=app.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACK;IAA7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGvD,QAAQ;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAPY,sCAAa;AAIxB;IADC,IAAA,YAAG,GAAE;;;;6CAGL;wBANU,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE8B,wBAAU;GADxC,aAAa,CAOzB"}
@@ -0,0 +1,2 @@
1
+ export declare class AppModule {
2
+ }
@@ -0,0 +1,40 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AppModule = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const app_controller_1 = require("./app.controller");
15
+ const app_service_1 = require("./app.service");
16
+ const builds_module_1 = require("./builds/builds.module");
17
+ const config_1 = require("@nestjs/config");
18
+ const authentication_module_1 = require("./authentication/authentication.module");
19
+ const github_module_1 = require("./github/github.module");
20
+ const node_path_1 = __importDefault(require("node:path"));
21
+ const dirname = node_path_1.default.join(__dirname, '../.env');
22
+ console.log(dirname);
23
+ let AppModule = class AppModule {
24
+ };
25
+ exports.AppModule = AppModule;
26
+ exports.AppModule = AppModule = __decorate([
27
+ (0, common_1.Module)({
28
+ imports: [
29
+ config_1.ConfigModule.forRoot({
30
+ envFilePath: dirname,
31
+ }),
32
+ builds_module_1.BuildsModule,
33
+ authentication_module_1.AuthenticationModule,
34
+ github_module_1.GithubModule,
35
+ ],
36
+ controllers: [app_controller_1.AppController],
37
+ providers: [app_service_1.AppService],
38
+ })
39
+ ], AppModule);
40
+ //# sourceMappingURL=app.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,0DAAsD;AACtD,2CAA8C;AAC9C,kFAA8E;AAC9E,0DAAsD;AACtD,0DAA6B;AAE7B,MAAM,OAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAChD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAcd,IAAM,SAAS,GAAf,MAAM,SAAS;CAAI,CAAA;AAAb,8BAAS;oBAAT,SAAS;IAZrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC;gBACnB,WAAW,EAAE,OAAO;aACrB,CAAC;YACF,4BAAY;YACZ,4CAAoB;YACpB,4BAAY;SACb;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,CAAC;KACxB,CAAC;GACW,SAAS,CAAI"}
@@ -0,0 +1,3 @@
1
+ export declare class AppService {
2
+ getHello(): string;
3
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AppService = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ let AppService = class AppService {
12
+ getHello() {
13
+ return 'Hello World!';
14
+ }
15
+ };
16
+ exports.AppService = AppService;
17
+ exports.AppService = AppService = __decorate([
18
+ (0, common_1.Injectable)()
19
+ ], AppService);
20
+ //# sourceMappingURL=app.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.service.js","sourceRoot":"","sources":["../src/app.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAGrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,QAAQ;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAItB"}
@@ -0,0 +1,9 @@
1
+ import { CommandRunner, InquirerService } from 'nest-commander';
2
+ import { AuthenticationService } from './authentication.service';
3
+ export declare class AuthenticationCommand extends CommandRunner {
4
+ private readonly inquirerService;
5
+ private readonly authenticationService;
6
+ constructor(inquirerService: InquirerService, authenticationService: AuthenticationService);
7
+ parsePassword(val: string): string;
8
+ run(passedParams: string[], options: Record<string, any>): Promise<void>;
9
+ }
@@ -0,0 +1,60 @@
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.AuthenticationCommand = void 0;
13
+ const nest_commander_1 = require("nest-commander");
14
+ const authentication_service_1 = require("./authentication.service");
15
+ let AuthenticationCommand = class AuthenticationCommand extends nest_commander_1.CommandRunner {
16
+ inquirerService;
17
+ authenticationService;
18
+ constructor(inquirerService, authenticationService) {
19
+ super();
20
+ this.inquirerService = inquirerService;
21
+ this.authenticationService = authenticationService;
22
+ }
23
+ parsePassword(val) {
24
+ return val;
25
+ }
26
+ async run(passedParams, options) {
27
+ const username = passedParams[0];
28
+ let password = options.password;
29
+ if (!password) {
30
+ const result = await this.inquirerService.inquirer.prompt({
31
+ type: 'password',
32
+ message: 'Enter your password: ',
33
+ name: 'password',
34
+ });
35
+ password = result.password;
36
+ }
37
+ const accessToken = await this.authenticationService.getAccessTokenByUsernameAndPassword(username, password);
38
+ console.log(accessToken);
39
+ }
40
+ };
41
+ exports.AuthenticationCommand = AuthenticationCommand;
42
+ __decorate([
43
+ (0, nest_commander_1.Option)({
44
+ flags: '-p, --password [string]',
45
+ description: 'Password',
46
+ }),
47
+ __metadata("design:type", Function),
48
+ __metadata("design:paramtypes", [String]),
49
+ __metadata("design:returntype", String)
50
+ ], AuthenticationCommand.prototype, "parsePassword", null);
51
+ exports.AuthenticationCommand = AuthenticationCommand = __decorate([
52
+ (0, nest_commander_1.Command)({
53
+ name: 'login',
54
+ arguments: '<username>',
55
+ description: 'Login using username and password credentials'
56
+ }),
57
+ __metadata("design:paramtypes", [nest_commander_1.InquirerService,
58
+ authentication_service_1.AuthenticationService])
59
+ ], AuthenticationCommand);
60
+ //# sourceMappingURL=authentication.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.command.js","sourceRoot":"","sources":["../../src/authentication/authentication.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiF;AACjF,qEAAiE;AAO1D,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,8BAAa;IAE/B;IACA;IAFrB,YACqB,eAAgC,EAChC,qBAA4C;QAE7D,KAAK,EAAE,CAAC;QAHS,oBAAe,GAAf,eAAe,CAAiB;QAChC,0BAAqB,GAArB,qBAAqB,CAAuB;IAGjE,CAAC;IAMD,aAAa,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC;IACf,CAAC;IAGD,KAAK,CAAC,GAAG,CAAC,YAAsB,EAAE,OAA4B;QAC1D,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAEhC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACtD,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,uBAAuB;gBAChC,IAAI,EAAE,UAAU;aACnB,CAAC,CAAC;YACH,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC/B,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,mCAAmC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE7G,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;CACJ,CAAA;AAlCY,sDAAqB;AAY9B;IAJC,IAAA,uBAAM,EAAC;QACJ,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,UAAU;KAC1B,CAAC;;;;0DAGD;gCAdQ,qBAAqB;IALjC,IAAA,wBAAO,EAAC;QACL,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,YAAY;QACvB,WAAW,EAAE,+CAA+C;KAC/D,CAAC;qCAGwC,gCAAe;QACT,8CAAqB;GAHxD,qBAAqB,CAkCjC"}
@@ -0,0 +1,2 @@
1
+ export declare class AuthenticationModule {
2
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AuthenticationModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const authentication_service_1 = require("./authentication.service");
12
+ const config_1 = require("@nestjs/config");
13
+ const authentication_command_1 = require("./authentication.command");
14
+ let AuthenticationModule = class AuthenticationModule {
15
+ };
16
+ exports.AuthenticationModule = AuthenticationModule;
17
+ exports.AuthenticationModule = AuthenticationModule = __decorate([
18
+ (0, common_1.Module)({
19
+ imports: [config_1.ConfigModule],
20
+ providers: [authentication_service_1.AuthenticationService, authentication_command_1.AuthenticationCommand],
21
+ exports: [authentication_service_1.AuthenticationService],
22
+ })
23
+ ], AuthenticationModule);
24
+ //# sourceMappingURL=authentication.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.module.js","sourceRoot":"","sources":["../../src/authentication/authentication.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qEAAiE;AACjE,2CAA8C;AAC9C,qEAAiE;AAO1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,CAAC;QACvB,SAAS,EAAE,CAAC,8CAAqB,EAAE,8CAAqB,CAAC;QACzD,OAAO,EAAE,CAAC,8CAAqB,CAAC;KACjC,CAAC;GACW,oBAAoB,CAAG"}
@@ -0,0 +1,10 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { ConfigService } from '@nestjs/config';
3
+ export declare class AuthenticationService implements OnModuleInit {
4
+ private readonly configService;
5
+ constructor(configService: ConfigService);
6
+ onModuleInit(): Promise<void>;
7
+ getConfigFilePath(): string;
8
+ getAccessTokenByUsernameAndPassword(username: string, password: string): Promise<string>;
9
+ getAccessToken(): Promise<string>;
10
+ }
@@ -0,0 +1,69 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AuthenticationService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const config_1 = require("@nestjs/config");
18
+ const node_os_1 = __importDefault(require("node:os"));
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const node_fs_1 = __importDefault(require("node:fs"));
21
+ let AuthenticationService = class AuthenticationService {
22
+ configService;
23
+ constructor(configService) {
24
+ this.configService = configService;
25
+ }
26
+ async onModuleInit() {
27
+ await config_1.ConfigModule.envVariablesLoaded;
28
+ const configFilePath = this.getConfigFilePath();
29
+ if (!node_fs_1.default.existsSync(configFilePath)) {
30
+ return;
31
+ }
32
+ const configFileContent = node_fs_1.default.readFileSync(configFilePath, 'utf8');
33
+ const configFile = JSON.parse(configFileContent);
34
+ this.configService.set('ACCESS_TOKEN', configFile.access_token);
35
+ }
36
+ getConfigFilePath() {
37
+ return node_path_1.default.join(node_os_1.default.homedir(), '/.aurtic-cli-v2-config.yaml');
38
+ }
39
+ async getAccessTokenByUsernameAndPassword(username, password) {
40
+ const response = await fetch(`${this.configService.get('API_URI')}/v1/oauth/token`, {
41
+ method: 'POST',
42
+ body: new URLSearchParams({
43
+ username: username,
44
+ password: password,
45
+ grant_type: 'password',
46
+ }),
47
+ headers: {
48
+ 'Content-Type': 'application/x-www-form-urlencoded',
49
+ },
50
+ });
51
+ const data = await response.json();
52
+ if (!response.ok) {
53
+ throw new Error(data.message);
54
+ }
55
+ const accessToken = data.access_token;
56
+ const configFilePath = this.getConfigFilePath();
57
+ node_fs_1.default.writeFileSync(configFilePath, JSON.stringify(data, null, 2));
58
+ return accessToken;
59
+ }
60
+ async getAccessToken() {
61
+ return this.configService.getOrThrow('ACCESS_TOKEN');
62
+ }
63
+ };
64
+ exports.AuthenticationService = AuthenticationService;
65
+ exports.AuthenticationService = AuthenticationService = __decorate([
66
+ (0, common_1.Injectable)(),
67
+ __metadata("design:paramtypes", [config_1.ConfigService])
68
+ ], AuthenticationService);
69
+ //# sourceMappingURL=authentication.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../src/authentication/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA6D;AAC7D,sDAAyB;AACzB,0DAA6B;AAC7B,sDAAyB;AAGlB,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACD;IAA7B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAI,CAAC;IAE9D,KAAK,CAAC,YAAY;QACd,MAAM,qBAAY,CAAC,kBAAkB,CAAC;QAEtC,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAChD,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;QACD,MAAM,iBAAiB,GAAG,iBAAE,CAAC,YAAY,CAAC,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ACJ,CAAA;AAhDY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAEmC,sBAAa;GADhD,qBAAqB,CAgDjC"}
@@ -0,0 +1,12 @@
1
+ import { CommandRunner } from 'nest-commander';
2
+ import { BuildsService } from './builds.service';
3
+ export declare class BuildsCommand extends CommandRunner {
4
+ private readonly buildsService;
5
+ constructor(buildsService: BuildsService);
6
+ parseName(val: string | undefined): string | undefined;
7
+ parseDockerfile(val: string): string;
8
+ parsePath(val: string): string;
9
+ parseIsLocal(val: string): boolean;
10
+ parseFollow(val: string): boolean;
11
+ run(passedParams: string[], options: Record<string, any>): Promise<void>;
12
+ }
@@ -0,0 +1,116 @@
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.BuildsCommand = void 0;
13
+ const nest_commander_1 = require("nest-commander");
14
+ const builds_service_1 = require("./builds.service");
15
+ let BuildsCommand = class BuildsCommand extends nest_commander_1.CommandRunner {
16
+ buildsService;
17
+ constructor(buildsService) {
18
+ super();
19
+ this.buildsService = buildsService;
20
+ }
21
+ parseName(val) {
22
+ return val?.trim() || undefined;
23
+ }
24
+ parseDockerfile(val) {
25
+ return val;
26
+ }
27
+ parsePath(val) {
28
+ return val;
29
+ }
30
+ parseIsLocal(val) {
31
+ const value = JSON.parse(val);
32
+ if (typeof value !== 'boolean') {
33
+ throw new Error('Invalid boolean value');
34
+ }
35
+ return value;
36
+ }
37
+ parseFollow(val) {
38
+ const value = JSON.parse(val);
39
+ if (typeof value !== 'boolean') {
40
+ throw new Error('Invalid boolean value');
41
+ }
42
+ return value;
43
+ }
44
+ async run(passedParams, options) {
45
+ const serviceId = passedParams[0];
46
+ if (options.local) {
47
+ throw new Error('Local builds are not supported yet');
48
+ }
49
+ else {
50
+ const build = await this.buildsService.buildStreaming(serviceId, options);
51
+ if (options.follow) {
52
+ await this.buildsService.followBuild(serviceId, build.id);
53
+ }
54
+ }
55
+ }
56
+ };
57
+ exports.BuildsCommand = BuildsCommand;
58
+ __decorate([
59
+ (0, nest_commander_1.Option)({
60
+ flags: '-n, --name [string]',
61
+ description: 'Build name',
62
+ required: false,
63
+ }),
64
+ __metadata("design:type", Function),
65
+ __metadata("design:paramtypes", [Object]),
66
+ __metadata("design:returntype", Object)
67
+ ], BuildsCommand.prototype, "parseName", null);
68
+ __decorate([
69
+ (0, nest_commander_1.Option)({
70
+ flags: '-d, --dockerfile [string]',
71
+ description: 'Dockerfile path',
72
+ defaultValue: './Dockerfile',
73
+ }),
74
+ __metadata("design:type", Function),
75
+ __metadata("design:paramtypes", [String]),
76
+ __metadata("design:returntype", String)
77
+ ], BuildsCommand.prototype, "parseDockerfile", null);
78
+ __decorate([
79
+ (0, nest_commander_1.Option)({
80
+ flags: '-p, --path [string]',
81
+ description: 'Local build path',
82
+ defaultValue: './',
83
+ }),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [String]),
86
+ __metadata("design:returntype", String)
87
+ ], BuildsCommand.prototype, "parsePath", null);
88
+ __decorate([
89
+ (0, nest_commander_1.Option)({
90
+ flags: '-l, --local [boolean]',
91
+ description: 'Build locally or remotely',
92
+ defaultValue: false,
93
+ }),
94
+ __metadata("design:type", Function),
95
+ __metadata("design:paramtypes", [String]),
96
+ __metadata("design:returntype", Boolean)
97
+ ], BuildsCommand.prototype, "parseIsLocal", null);
98
+ __decorate([
99
+ (0, nest_commander_1.Option)({
100
+ flags: '-f, --follow [boolean]',
101
+ description: 'Follow the build logs and await the result',
102
+ defaultValue: false,
103
+ }),
104
+ __metadata("design:type", Function),
105
+ __metadata("design:paramtypes", [String]),
106
+ __metadata("design:returntype", Boolean)
107
+ ], BuildsCommand.prototype, "parseFollow", null);
108
+ exports.BuildsCommand = BuildsCommand = __decorate([
109
+ (0, nest_commander_1.Command)({
110
+ name: 'build',
111
+ arguments: '<serviceId>',
112
+ description: 'A parameter parser example'
113
+ }),
114
+ __metadata("design:paramtypes", [builds_service_1.BuildsService])
115
+ ], BuildsCommand);
116
+ //# sourceMappingURL=builds.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builds.command.js","sourceRoot":"","sources":["../../src/builds/builds.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAgE;AAChE,qDAAiD;AAO1C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,8BAAa;IACf;IAA7B,YAA6B,aAA4B;QACrD,KAAK,EAAE,CAAC;QADiB,kBAAa,GAAb,aAAa,CAAe;IAEzD,CAAC;IAOD,SAAS,CAAC,GAAuB;QAC7B,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACpC,CAAC;IAOD,eAAe,CAAC,GAAW;QACvB,OAAO,GAAG,CAAC;IACf,CAAC;IAOD,SAAS,CAAC,GAAW;QACjB,OAAO,GAAG,CAAC;IACf,CAAC;IAOD,YAAY,CAAC,GAAW;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAOD,WAAW,CAAC,GAAW;QACnB,MAAM,KAAK,GAAG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OD;AAOD;IALC,IAAA,uBAAM,EAAC;QACJ,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,4CAA4C;QACzD,YAAY,EAAE,KAAK;KACtB,CAAC;;;;gDAOD;wBAxDQ,aAAa;IALzB,IAAA,wBAAO,EAAC;QACL,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,aAAa;QACxB,WAAW,EAAE,4BAA4B;KAC5C,CAAC;qCAE8C,8BAAa;GADhD,aAAa,CAsEzB"}
@@ -0,0 +1,2 @@
1
+ export declare class BuildsModule {
2
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BuildsModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const builds_service_1 = require("./builds.service");
12
+ const builds_command_1 = require("./builds.command");
13
+ const builds_zip_service_1 = require("./builds.zip.service");
14
+ const config_1 = require("@nestjs/config");
15
+ const authentication_module_1 = require("../authentication/authentication.module");
16
+ let BuildsModule = class BuildsModule {
17
+ };
18
+ exports.BuildsModule = BuildsModule;
19
+ exports.BuildsModule = BuildsModule = __decorate([
20
+ (0, common_1.Module)({
21
+ imports: [config_1.ConfigModule, authentication_module_1.AuthenticationModule],
22
+ providers: [builds_service_1.BuildsService, builds_zip_service_1.BuildsZipService, builds_command_1.BuildsCommand]
23
+ })
24
+ ], BuildsModule);
25
+ //# sourceMappingURL=builds.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builds.module.js","sourceRoot":"","sources":["../../src/builds/builds.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,qDAAiD;AACjD,6DAAwD;AACxD,2CAA8C;AAC9C,mFAA+E;AAMxE,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAI,CAAA;AAAhB,oCAAY;uBAAZ,YAAY;IAJxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,EAAE,4CAAoB,CAAC;QAC7C,SAAS,EAAE,CAAC,8BAAa,EAAE,qCAAgB,EAAE,8BAAa,CAAC;KAC5D,CAAC;GACW,YAAY,CAAI"}
@@ -0,0 +1,17 @@
1
+ import { OnApplicationBootstrap } from '@nestjs/common';
2
+ import { ConfigService } from '@nestjs/config';
3
+ import { BuildsZipService } from './builds.zip.service';
4
+ import { AuthenticationService } from '../authentication/authentication.service';
5
+ export declare class BuildsService implements OnApplicationBootstrap {
6
+ private readonly configService;
7
+ private readonly buildsZipService;
8
+ private readonly authenticationService;
9
+ onApplicationBootstrap(): Promise<void>;
10
+ constructor(configService: ConfigService, buildsZipService: BuildsZipService, authenticationService: AuthenticationService);
11
+ followBuild(serviceId: string, buildId: string): Promise<void>;
12
+ buildStreaming(serviceId: string, opts: {
13
+ dockerfile?: string;
14
+ path?: string;
15
+ name?: string;
16
+ }): Promise<any>;
17
+ }