@codeclimbers/server 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/README.md +73 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.js +22 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/src/app.module.d.ts +4 -0
  6. package/dist/src/app.module.js +49 -0
  7. package/dist/src/app.module.js.map +1 -0
  8. package/dist/src/assets/startup.plist.d.ts +1 -0
  9. package/dist/src/assets/startup.plist.js +41 -0
  10. package/dist/src/assets/startup.plist.js.map +1 -0
  11. package/dist/src/common/infrastructure/http/controllers/health.controller.d.ts +5 -0
  12. package/dist/src/common/infrastructure/http/controllers/health.controller.js +29 -0
  13. package/dist/src/common/infrastructure/http/controllers/health.controller.js.map +1 -0
  14. package/dist/src/common/infrastructure/http/middleware/requestlogger.middleware.d.ts +5 -0
  15. package/dist/src/common/infrastructure/http/middleware/requestlogger.middleware.js +27 -0
  16. package/dist/src/common/infrastructure/http/middleware/requestlogger.middleware.js.map +1 -0
  17. package/dist/src/main.d.ts +2 -0
  18. package/dist/src/main.js +44 -0
  19. package/dist/src/main.js.map +1 -0
  20. package/dist/src/sentry.d.ts +1 -0
  21. package/dist/src/sentry.js +13 -0
  22. package/dist/src/sentry.js.map +1 -0
  23. package/dist/src/v1/activities/activities.service.d.ts +21 -0
  24. package/dist/src/v1/activities/activities.service.js +174 -0
  25. package/dist/src/v1/activities/activities.service.js.map +1 -0
  26. package/dist/src/v1/activities/pulse.controller.d.ts +19 -0
  27. package/dist/src/v1/activities/pulse.controller.js +92 -0
  28. package/dist/src/v1/activities/pulse.controller.js.map +1 -0
  29. package/dist/src/v1/activities/wakatimeProxy.controller.d.ts +13 -0
  30. package/dist/src/v1/activities/wakatimeProxy.controller.js +64 -0
  31. package/dist/src/v1/activities/wakatimeProxy.controller.js.map +1 -0
  32. package/dist/src/v1/database/__tests__/knex.test.d.ts +1 -0
  33. package/dist/src/v1/database/__tests__/knex.test.js +18 -0
  34. package/dist/src/v1/database/__tests__/knex.test.js.map +1 -0
  35. package/dist/src/v1/database/__tests__/pulse.repo.test.d.ts +1 -0
  36. package/dist/src/v1/database/__tests__/pulse.repo.test.js +141 -0
  37. package/dist/src/v1/database/__tests__/pulse.repo.test.js.map +1 -0
  38. package/dist/src/v1/database/knex.d.ts +5 -0
  39. package/dist/src/v1/database/knex.js +87 -0
  40. package/dist/src/v1/database/knex.js.map +1 -0
  41. package/dist/src/v1/database/migrations.d.ts +1 -0
  42. package/dist/src/v1/database/migrations.js +16 -0
  43. package/dist/src/v1/database/migrations.js.map +1 -0
  44. package/dist/src/v1/database/pulse.repo.d.ts +17 -0
  45. package/dist/src/v1/database/pulse.repo.js +115 -0
  46. package/dist/src/v1/database/pulse.repo.js.map +1 -0
  47. package/dist/src/v1/database/queries/getCategoryTimeOverview.sql +6 -0
  48. package/dist/src/v1/database/queries/getLongestDayInRangeMinutes.sql +11 -0
  49. package/dist/src/v1/database/queries/getStatusBarDetails.sql +42 -0
  50. package/dist/src/v1/dtos/createWakatimePulse.dto.d.ts +19 -0
  51. package/dist/src/v1/dtos/createWakatimePulse.dto.js +97 -0
  52. package/dist/src/v1/dtos/createWakatimePulse.dto.js.map +1 -0
  53. package/dist/src/v1/dtos/getCategoryTimeOverview.dto.d.ts +4 -0
  54. package/dist/src/v1/dtos/getCategoryTimeOverview.dto.js +25 -0
  55. package/dist/src/v1/dtos/getCategoryTimeOverview.dto.js.map +1 -0
  56. package/dist/src/v1/dtos/getWeekOverview.dto.d.ts +3 -0
  57. package/dist/src/v1/dtos/getWeekOverview.dto.js +21 -0
  58. package/dist/src/v1/dtos/getWeekOverview.dto.js.map +1 -0
  59. package/dist/src/v1/startup/darwinStartup.service.d.ts +8 -0
  60. package/dist/src/v1/startup/darwinStartup.service.js +114 -0
  61. package/dist/src/v1/startup/darwinStartup.service.js.map +1 -0
  62. package/dist/src/v1/startup/linuxStartup.service.d.ts +8 -0
  63. package/dist/src/v1/startup/linuxStartup.service.js +104 -0
  64. package/dist/src/v1/startup/linuxStartup.service.js.map +1 -0
  65. package/dist/src/v1/startup/startup.controller.d.ts +8 -0
  66. package/dist/src/v1/startup/startup.controller.js +46 -0
  67. package/dist/src/v1/startup/startup.controller.js.map +1 -0
  68. package/dist/src/v1/startup/startup.util.d.ts +5 -0
  69. package/dist/src/v1/startup/startup.util.js +19 -0
  70. package/dist/src/v1/startup/startup.util.js.map +1 -0
  71. package/dist/src/v1/startup/startupService.factory.d.ts +9 -0
  72. package/dist/src/v1/startup/startupService.factory.js +41 -0
  73. package/dist/src/v1/startup/startupService.factory.js.map +1 -0
  74. package/dist/src/v1/startup/unsupportedStartup.service.d.ts +6 -0
  75. package/dist/src/v1/startup/unsupportedStartup.service.js +29 -0
  76. package/dist/src/v1/startup/unsupportedStartup.service.js.map +1 -0
  77. package/dist/src/v1/v1.module.d.ts +2 -0
  78. package/dist/src/v1/v1.module.js +41 -0
  79. package/dist/src/v1/v1.module.js.map +1 -0
  80. package/dist/tsconfig.build.tsbuildinfo +1 -0
  81. package/dist/utils/__tests__/activites.util.test.d.ts +1 -0
  82. package/dist/utils/__tests__/activites.util.test.js +18 -0
  83. package/dist/utils/__tests__/activites.util.test.js.map +1 -0
  84. package/dist/utils/__tests__/helpers.util.test.d.ts +1 -0
  85. package/dist/utils/__tests__/helpers.util.test.js +120 -0
  86. package/dist/utils/__tests__/helpers.util.test.js.map +1 -0
  87. package/dist/utils/__tests__/wakatime.util.test.d.ts +1 -0
  88. package/dist/utils/__tests__/wakatime.util.test.js +210 -0
  89. package/dist/utils/__tests__/wakatime.util.test.js.map +1 -0
  90. package/dist/utils/activities.util.d.ts +15 -0
  91. package/dist/utils/activities.util.js +147 -0
  92. package/dist/utils/activities.util.js.map +1 -0
  93. package/dist/utils/allExceptions.filter.d.ts +7 -0
  94. package/dist/utils/allExceptions.filter.js +39 -0
  95. package/dist/utils/allExceptions.filter.js.map +1 -0
  96. package/dist/utils/codeClimberErrors.d.ts +16 -0
  97. package/dist/utils/codeClimberErrors.js +27 -0
  98. package/dist/utils/codeClimberErrors.js.map +1 -0
  99. package/dist/utils/constants.d.ts +1 -0
  100. package/dist/utils/constants.js +5 -0
  101. package/dist/utils/constants.js.map +1 -0
  102. package/dist/utils/environment.util.d.ts +1 -0
  103. package/dist/utils/environment.util.js +6 -0
  104. package/dist/utils/environment.util.js.map +1 -0
  105. package/dist/utils/helpers.util.d.ts +7 -0
  106. package/dist/utils/helpers.util.js +116 -0
  107. package/dist/utils/helpers.util.js.map +1 -0
  108. package/dist/utils/node.util.d.ts +7 -0
  109. package/dist/utils/node.util.js +26 -0
  110. package/dist/utils/node.util.js.map +1 -0
  111. package/dist/utils/sql.util.d.ts +1 -0
  112. package/dist/utils/sql.util.js +11 -0
  113. package/dist/utils/sql.util.js.map +1 -0
  114. package/dist/utils/sqlReader.util.d.ts +5 -0
  115. package/dist/utils/sqlReader.util.js +34 -0
  116. package/dist/utils/sqlReader.util.js.map +1 -0
  117. package/dist/utils/wakatime.util.d.ts +6 -0
  118. package/dist/utils/wakatime.util.js +63 -0
  119. package/dist/utils/wakatime.util.js.map +1 -0
  120. package/index.ts +5 -0
  121. package/jest.config.js +8 -0
  122. package/knexfile.js +14 -0
  123. package/nest-cli.json +15 -0
  124. package/package.json +77 -0
  125. package/src/app.module.ts +37 -0
  126. package/src/assets/startup.plist.ts +36 -0
  127. package/src/common/infrastructure/http/controllers/health.controller.ts +9 -0
  128. package/src/common/infrastructure/http/middleware/requestlogger.middleware.ts +22 -0
  129. package/src/main.ts +51 -0
  130. package/src/sentry.ts +14 -0
  131. package/src/types/activities.api.d.ts +18 -0
  132. package/src/types/time.api.d.ts +23 -0
  133. package/src/types/utils.d.ts +8 -0
  134. package/src/types/wakatimeProxy.api.d.ts +55 -0
  135. package/src/v1/activities/activities.service.ts +213 -0
  136. package/src/v1/activities/pulse.controller.ts +68 -0
  137. package/src/v1/activities/wakatimeProxy.controller.ts +33 -0
  138. package/src/v1/database/__tests__/knex.test.ts +18 -0
  139. package/src/v1/database/__tests__/pulse.repo.test.ts +209 -0
  140. package/src/v1/database/knex.ts +107 -0
  141. package/src/v1/database/migrations.ts +13 -0
  142. package/src/v1/database/models/pulse.d.ts +24 -0
  143. package/src/v1/database/pulse.repo.ts +132 -0
  144. package/src/v1/database/queries/getCategoryTimeOverview.sql +6 -0
  145. package/src/v1/database/queries/getLongestDayInRangeMinutes.sql +11 -0
  146. package/src/v1/database/queries/getStatusBarDetails.sql +42 -0
  147. package/src/v1/dtos/createWakatimePulse.dto.ts +66 -0
  148. package/src/v1/dtos/getCategoryTimeOverview.dto.ts +9 -0
  149. package/src/v1/dtos/getWeekOverview.dto.ts +6 -0
  150. package/src/v1/startup/darwinStartup.service.ts +114 -0
  151. package/src/v1/startup/linuxStartup.service.ts +101 -0
  152. package/src/v1/startup/startup.controller.ts +23 -0
  153. package/src/v1/startup/startup.util.ts +21 -0
  154. package/src/v1/startup/startupService.factory.ts +28 -0
  155. package/src/v1/startup/unsupportedStartup.service.ts +21 -0
  156. package/src/v1/v1.module.ts +28 -0
  157. package/test/app.e2e-spec.ts +24 -0
  158. package/test/jest-e2e.json +9 -0
  159. package/test/jest.globalSetup.js +15 -0
  160. package/test/jest.globalTeardown.js +8 -0
  161. package/tsconfig.build.json +4 -0
  162. package/tsconfig.json +22 -0
  163. package/utils/__tests__/activites.util.test.ts +18 -0
  164. package/utils/__tests__/helpers.util.test.ts +155 -0
  165. package/utils/__tests__/wakatime.util.test.ts +222 -0
  166. package/utils/activities.util.ts +193 -0
  167. package/utils/allExceptions.filter.ts +43 -0
  168. package/utils/codeClimberErrors.ts +32 -0
  169. package/utils/constants.ts +1 -0
  170. package/utils/environment.util.ts +1 -0
  171. package/utils/helpers.util.ts +131 -0
  172. package/utils/node.util.ts +29 -0
  173. package/utils/sql.util.ts +13 -0
  174. package/utils/sqlReader.util.ts +49 -0
  175. package/utils/wakatime.util.ts +78 -0
@@ -0,0 +1,11 @@
1
+ WITH get_total_minutes (time, total_minutes) AS (
2
+ SELECT time, count() as total_minutes
3
+ FROM activities_pulse
4
+ WHERE date(activities_pulse.time) BETWEEN :startDate AND :endDate
5
+ GROUP BY strftime('%s', time) / 60),
6
+ get_day_minutes (time, day_minutes) AS (
7
+ SELECT time, count() as day_minutes
8
+ FROM get_total_minutes
9
+ GROUP BY strftime('%Y-%m-%d', time))
10
+ SELECT max(day_minutes) as minutes
11
+ FROM get_day_minutes;
@@ -0,0 +1,42 @@
1
+ WITH heartbeats_with_diff AS (
2
+ SELECT
3
+ project,
4
+ language,
5
+ editor,
6
+ operating_system,
7
+ machine,
8
+ branch,
9
+ time,
10
+ MIN(
11
+ (JULIANDAY(time) - JULIANDAY(LAG(time) OVER w)) * 86400,
12
+ 120
13
+ ) AS diff
14
+ FROM
15
+ activities_pulse
16
+ WHERE
17
+ time >= :startOfDay
18
+ AND time < :endOfDay
19
+ WINDOW
20
+ w AS (ORDER BY time)
21
+ )
22
+ SELECT
23
+ project,
24
+ language,
25
+ editor,
26
+ operating_system,
27
+ machine,
28
+ branch,
29
+ ROUND(SUM(MAX(1, diff))) AS seconds,
30
+ MIN(time) AS min_heartbeat_time,
31
+ MAX(time) AS max_heartbeat_time
32
+ FROM
33
+ heartbeats_with_diff
34
+ WHERE
35
+ diff IS NOT NULL
36
+ GROUP BY
37
+ project,
38
+ language,
39
+ editor,
40
+ operating_system,
41
+ machine,
42
+ branch
@@ -0,0 +1,19 @@
1
+ export declare class CreateWakatimePulseDto {
2
+ userId?: string;
3
+ entity: string;
4
+ type: string;
5
+ category?: string;
6
+ project: string;
7
+ branch: string;
8
+ language?: string;
9
+ is_write?: boolean;
10
+ editor?: string;
11
+ operating_system?: string;
12
+ machine?: string;
13
+ user_agent?: string;
14
+ time: number | string;
15
+ hash?: string;
16
+ origin?: string;
17
+ origin_id?: string;
18
+ description?: string;
19
+ }
@@ -0,0 +1,97 @@
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.CreateWakatimePulseDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class CreateWakatimePulseDto {
15
+ }
16
+ exports.CreateWakatimePulseDto = CreateWakatimePulseDto;
17
+ __decorate([
18
+ (0, class_validator_1.IsOptional)(),
19
+ (0, class_validator_1.IsString)(),
20
+ __metadata("design:type", String)
21
+ ], CreateWakatimePulseDto.prototype, "userId", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsString)(),
24
+ __metadata("design:type", String)
25
+ ], CreateWakatimePulseDto.prototype, "entity", void 0);
26
+ __decorate([
27
+ (0, class_validator_1.IsString)(),
28
+ __metadata("design:type", String)
29
+ ], CreateWakatimePulseDto.prototype, "type", void 0);
30
+ __decorate([
31
+ (0, class_validator_1.IsOptional)(),
32
+ (0, class_validator_1.IsString)(),
33
+ __metadata("design:type", String)
34
+ ], CreateWakatimePulseDto.prototype, "category", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsString)(),
37
+ __metadata("design:type", String)
38
+ ], CreateWakatimePulseDto.prototype, "project", void 0);
39
+ __decorate([
40
+ (0, class_validator_1.IsString)(),
41
+ __metadata("design:type", String)
42
+ ], CreateWakatimePulseDto.prototype, "branch", void 0);
43
+ __decorate([
44
+ (0, class_validator_1.IsOptional)(),
45
+ (0, class_validator_1.IsString)(),
46
+ __metadata("design:type", String)
47
+ ], CreateWakatimePulseDto.prototype, "language", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsOptional)(),
50
+ (0, class_validator_1.IsBoolean)(),
51
+ __metadata("design:type", Boolean)
52
+ ], CreateWakatimePulseDto.prototype, "is_write", void 0);
53
+ __decorate([
54
+ (0, class_validator_1.IsOptional)(),
55
+ (0, class_validator_1.IsString)(),
56
+ __metadata("design:type", String)
57
+ ], CreateWakatimePulseDto.prototype, "editor", void 0);
58
+ __decorate([
59
+ (0, class_validator_1.IsOptional)(),
60
+ (0, class_validator_1.IsString)(),
61
+ __metadata("design:type", String)
62
+ ], CreateWakatimePulseDto.prototype, "operating_system", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsOptional)(),
65
+ (0, class_validator_1.IsString)(),
66
+ __metadata("design:type", String)
67
+ ], CreateWakatimePulseDto.prototype, "machine", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsOptional)(),
70
+ (0, class_validator_1.IsString)(),
71
+ __metadata("design:type", String)
72
+ ], CreateWakatimePulseDto.prototype, "user_agent", void 0);
73
+ __decorate([
74
+ (0, class_validator_1.IsNumber)(),
75
+ __metadata("design:type", Object)
76
+ ], CreateWakatimePulseDto.prototype, "time", void 0);
77
+ __decorate([
78
+ (0, class_validator_1.IsOptional)(),
79
+ (0, class_validator_1.IsString)(),
80
+ __metadata("design:type", String)
81
+ ], CreateWakatimePulseDto.prototype, "hash", void 0);
82
+ __decorate([
83
+ (0, class_validator_1.IsOptional)(),
84
+ (0, class_validator_1.IsString)(),
85
+ __metadata("design:type", String)
86
+ ], CreateWakatimePulseDto.prototype, "origin", void 0);
87
+ __decorate([
88
+ (0, class_validator_1.IsOptional)(),
89
+ (0, class_validator_1.IsString)(),
90
+ __metadata("design:type", String)
91
+ ], CreateWakatimePulseDto.prototype, "origin_id", void 0);
92
+ __decorate([
93
+ (0, class_validator_1.IsOptional)(),
94
+ (0, class_validator_1.IsString)(),
95
+ __metadata("design:type", String)
96
+ ], CreateWakatimePulseDto.prototype, "description", void 0);
97
+ //# sourceMappingURL=createWakatimePulse.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWakatimePulse.dto.js","sourceRoot":"","sources":["../../../../src/v1/dtos/createWakatimePulse.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2E;AAE3E,MAAa,sBAAsB;CA+DlC;AA/DD,wDA+DC;AA5DC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACI;AAGf;IADC,IAAA,0BAAQ,GAAE;;sDACG;AAGd;IADC,IAAA,0BAAQ,GAAE;;oDACC;AAIZ;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wDACM;AAGjB;IADC,IAAA,0BAAQ,GAAE;;uDACI;AAGf;IADC,IAAA,0BAAQ,GAAE;;sDACG;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wDACM;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;wDACM;AAIlB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACI;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;gEACc;AAIzB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uDACK;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;0DACQ;AAGnB;IADC,IAAA,0BAAQ,GAAE;;oDACU;AAIrB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oDACE;AAIb;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACI;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yDACO;AAIlB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2DACS"}
@@ -0,0 +1,4 @@
1
+ export declare class GetCategoryTimeOverviewDto {
2
+ startDate: string;
3
+ endDate: string;
4
+ }
@@ -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
+ 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.GetCategoryTimeOverviewDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class GetCategoryTimeOverviewDto {
15
+ }
16
+ exports.GetCategoryTimeOverviewDto = GetCategoryTimeOverviewDto;
17
+ __decorate([
18
+ (0, class_validator_1.IsDateString)(),
19
+ __metadata("design:type", String)
20
+ ], GetCategoryTimeOverviewDto.prototype, "startDate", void 0);
21
+ __decorate([
22
+ (0, class_validator_1.IsDateString)(),
23
+ __metadata("design:type", String)
24
+ ], GetCategoryTimeOverviewDto.prototype, "endDate", void 0);
25
+ //# sourceMappingURL=getCategoryTimeOverview.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCategoryTimeOverview.dto.js","sourceRoot":"","sources":["../../../../src/v1/dtos/getCategoryTimeOverview.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8C;AAE9C,MAAa,0BAA0B;CAMtC;AAND,gEAMC;AAJC;IADC,IAAA,8BAAY,GAAE;;6DACE;AAGjB;IADC,IAAA,8BAAY,GAAE;;2DACA"}
@@ -0,0 +1,3 @@
1
+ export declare class GetWeekOverviewDto {
2
+ date: string;
3
+ }
@@ -0,0 +1,21 @@
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.GetWeekOverviewDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class GetWeekOverviewDto {
15
+ }
16
+ exports.GetWeekOverviewDto = GetWeekOverviewDto;
17
+ __decorate([
18
+ (0, class_validator_1.IsDateString)(),
19
+ __metadata("design:type", String)
20
+ ], GetWeekOverviewDto.prototype, "date", void 0);
21
+ //# sourceMappingURL=getWeekOverview.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWeekOverview.dto.js","sourceRoot":"","sources":["../../../../src/v1/dtos/getWeekOverview.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8C;AAE9C,MAAa,kBAAkB;CAG9B;AAHD,gDAGC;AADC;IADC,IAAA,8BAAY,GAAE;;gDACH"}
@@ -0,0 +1,8 @@
1
+ export declare class DarwinStartupService implements CodeClimbers.StartupService {
2
+ private service;
3
+ constructor();
4
+ enableStartup(): Promise<void>;
5
+ disableStartup(): Promise<void>;
6
+ launchAndEnableStartup(): Promise<void>;
7
+ closeAndDisableStartup(): Promise<void>;
8
+ }
@@ -0,0 +1,114 @@
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.DarwinStartupService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const path = require("node:path");
15
+ const node_util_1 = require("../../../utils/node.util");
16
+ const startup_util_1 = require("./startup.util");
17
+ const { Service } = startup_util_1.default.getServiceLib();
18
+ let DarwinStartupService = class DarwinStartupService {
19
+ constructor() {
20
+ this.service = new Service({
21
+ name: 'CodeClimbers',
22
+ description: 'CodeClimbers service',
23
+ script: `${path.join(node_util_1.BIN_PATH, 'startup.js')}`,
24
+ logpath: node_util_1.CODE_CLIMBER_META_DIR,
25
+ env: [
26
+ {
27
+ name: 'NODE_ENV',
28
+ value: process.env.NODE_ENV || 'production',
29
+ },
30
+ {
31
+ name: 'CODE_CLIMBER_BIN_PATH',
32
+ value: node_util_1.BIN_PATH,
33
+ },
34
+ {
35
+ name: 'NODE_PATH',
36
+ value: (0, node_util_1.NODE_PATH)(),
37
+ },
38
+ {
39
+ name: 'DEBUG',
40
+ value: process.env.DEBUG,
41
+ },
42
+ ],
43
+ logOnAsUser: true,
44
+ runAsAgent: true,
45
+ wait: 5,
46
+ grow: 0,
47
+ maxRestarts: 10,
48
+ });
49
+ if (process.env.NODE_ENV === 'development' || process.env.DEBUG === '*') {
50
+ this.service.on('install', () => {
51
+ console.log(`${this.service.name} installed`);
52
+ });
53
+ this.service.on('alreadyinstalled', () => {
54
+ console.log(`${this.service.name} already installed`);
55
+ });
56
+ this.service.on('uninstall', () => {
57
+ console.log(`${this.service.name} uninstalled`);
58
+ });
59
+ this.service.on('start', () => {
60
+ console.log(`${this.service.name} started`);
61
+ });
62
+ this.service.on('stop', () => {
63
+ console.log(`${this.service.name} stopped`);
64
+ });
65
+ this.service.on('error', (error) => {
66
+ console.error(`${this.service.name} error:`, error);
67
+ });
68
+ }
69
+ }
70
+ async enableStartup() {
71
+ return new Promise((resolve, reject) => {
72
+ this.service.install();
73
+ this.service.on('install', () => {
74
+ resolve();
75
+ });
76
+ this.service.on('alreadyinstalled', () => {
77
+ resolve();
78
+ });
79
+ this.service.on('error', (error) => reject(error));
80
+ });
81
+ }
82
+ async disableStartup() {
83
+ return new Promise((resolve, reject) => {
84
+ this.service.uninstall();
85
+ this.service.on('uninstall', () => resolve());
86
+ this.service.on('error', (error) => reject(error));
87
+ });
88
+ }
89
+ async launchAndEnableStartup() {
90
+ await this.enableStartup();
91
+ return new Promise((resolve, reject) => {
92
+ this.service.start();
93
+ this.service.on('start', () => resolve());
94
+ this.service.on('error', (error) => reject(error));
95
+ });
96
+ }
97
+ async closeAndDisableStartup() {
98
+ return new Promise((resolve, reject) => {
99
+ this.service.stop();
100
+ this.service.on('stop', () => {
101
+ this.disableStartup()
102
+ .then(() => resolve())
103
+ .catch((error) => reject(error));
104
+ });
105
+ this.service.on('error', (error) => reject(error));
106
+ });
107
+ }
108
+ };
109
+ exports.DarwinStartupService = DarwinStartupService;
110
+ exports.DarwinStartupService = DarwinStartupService = __decorate([
111
+ (0, common_1.Injectable)(),
112
+ __metadata("design:paramtypes", [])
113
+ ], DarwinStartupService);
114
+ //# sourceMappingURL=darwinStartup.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"darwinStartup.service.js","sourceRoot":"","sources":["../../../../src/v1/startup/darwinStartup.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2C;A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AAG,EAAE,CAAC,OAAO,EAAE,CAAC;qBACrB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;YACpC,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAtGY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;;GACA,oBAAoB,CAsGhC"}
@@ -0,0 +1,8 @@
1
+ export declare class DarwinStartupService implements CodeClimbers.StartupService {
2
+ private service;
3
+ constructor();
4
+ enableStartup(): Promise<void>;
5
+ disableStartup(): Promise<void>;
6
+ launchAndEnableStartup(): Promise<void>;
7
+ closeAndDisableStartup(): Promise<void>;
8
+ }
@@ -0,0 +1,104 @@
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.DarwinStartupService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const path = require("node:path");
15
+ const node_util_1 = require("../../../utils/node.util");
16
+ const startup_util_1 = require("./startup.util");
17
+ const { Service } = startup_util_1.default.getServiceLib();
18
+ let DarwinStartupService = class DarwinStartupService {
19
+ constructor() {
20
+ this.service = new Service({
21
+ name: 'CodeClimbers',
22
+ description: 'CodeClimbers service',
23
+ script: `${path.join(node_util_1.BIN_PATH, 'startup.js')}`,
24
+ logpath: node_util_1.CODE_CLIMBER_META_DIR,
25
+ env: [
26
+ {
27
+ name: 'NODE_ENV',
28
+ value: 'production',
29
+ },
30
+ {
31
+ name: 'CODE_CLIMBER_BIN_PATH',
32
+ value: node_util_1.BIN_PATH,
33
+ },
34
+ ],
35
+ logOnAsUser: true,
36
+ runAsAgent: true,
37
+ wait: 5,
38
+ grow: 0,
39
+ maxRestarts: 10,
40
+ });
41
+ this.service.on('install', () => {
42
+ common_1.Logger.log(`${this.service.name.get} installed`);
43
+ });
44
+ this.service.on('alreadyinstalled', () => {
45
+ common_1.Logger.log(`${this.service.name} already installed`);
46
+ });
47
+ this.service.on('uninstall', () => {
48
+ common_1.Logger.log(`${this.service.name} uninstalled`);
49
+ });
50
+ this.service.on('start', () => {
51
+ common_1.Logger.log(`${this.service.name} started`);
52
+ });
53
+ this.service.on('stop', () => {
54
+ common_1.Logger.log(`${this.service.name} stopped`);
55
+ });
56
+ this.service.on('error', (error) => {
57
+ common_1.Logger.error(`${this.service.name} error:`, error);
58
+ });
59
+ }
60
+ async enableStartup() {
61
+ return new Promise((resolve, reject) => {
62
+ this.service.install();
63
+ this.service.on('install', () => {
64
+ resolve();
65
+ });
66
+ this.service.on('alreadyinstalled', () => {
67
+ resolve();
68
+ });
69
+ this.service.on('error', (error) => reject(error));
70
+ });
71
+ }
72
+ async disableStartup() {
73
+ return new Promise((resolve, reject) => {
74
+ this.service.uninstall();
75
+ this.service.on('uninstall', () => resolve());
76
+ this.service.on('error', (error) => reject(error));
77
+ });
78
+ }
79
+ async launchAndEnableStartup() {
80
+ await this.enableStartup();
81
+ return new Promise((resolve, reject) => {
82
+ this.service.start();
83
+ this.service.on('start', () => resolve());
84
+ this.service.on('error', (error) => reject(error));
85
+ });
86
+ }
87
+ async closeAndDisableStartup() {
88
+ return new Promise((resolve, reject) => {
89
+ this.service.stop();
90
+ this.service.on('stop', () => {
91
+ this.disableStartup()
92
+ .then(() => resolve())
93
+ .catch((error) => reject(error));
94
+ });
95
+ this.service.on('error', (error) => reject(error));
96
+ });
97
+ }
98
+ };
99
+ exports.DarwinStartupService = DarwinStartupService;
100
+ exports.DarwinStartupService = DarwinStartupService = __decorate([
101
+ (0, common_1.Injectable)(),
102
+ __metadata("design:paramtypes", [])
103
+ ], DarwinStartupService);
104
+ //# sourceMappingURL=linuxStartup.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linuxStartup.service.js","sourceRoot":"","sources":["../../../../src/v1/startup/linuxStartup.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmD;AAEnD,kCAAiC;AACjC,wDAA0E;AAC1E,iDAAwC;AACxC,MAAM,EAAE,OAAO,EAAE,GAAG,sBAAW,CAAC,aAAa,EAAE,CAAA;AAGxC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC;YACzB,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,sBAAsB;YACnC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAQ,EAAE,YAAY,CAAC,EAAE;YAC9C,OAAO,EAAE,iCAAqB;YAC9B,GAAG,EAAE;gBACH;oBACE,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,YAAY;iBACpB;gBACD;oBACE,IAAI,EAAE,uBAAuB;oBAC7B,KAAK,EAAE,oBAAQ;iBAChB;aACF;YACD,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,CAAC;YACP,WAAW,EAAE,EAAE;SAChB,CAAC,CAAA;QAEF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC9B,eAAM,CA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AE;YACrC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YACnB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;gBAC3B,IAAI,CAAC,cAAc,EAAE;qBAClB,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;qBACrB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;YACpC,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA5FY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;;GACA,oBAAoB,CA4FhC"}
@@ -0,0 +1,8 @@
1
+ import { StartupServiceFactory } from './startupService.factory';
2
+ export declare class StartupController {
3
+ private readonly startupServiceFactory;
4
+ private startupService;
5
+ constructor(startupServiceFactory: StartupServiceFactory);
6
+ enableStartup(): Promise<string>;
7
+ disableStartup(): Promise<string>;
8
+ }
@@ -0,0 +1,46 @@
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.StartupController = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const startupService_factory_1 = require("./startupService.factory");
15
+ let StartupController = class StartupController {
16
+ constructor(startupServiceFactory) {
17
+ this.startupServiceFactory = startupServiceFactory;
18
+ this.startupService = this.startupServiceFactory.getStartupService();
19
+ }
20
+ async enableStartup() {
21
+ await this.startupService.enableStartup();
22
+ return 'OK';
23
+ }
24
+ async disableStartup() {
25
+ await this.startupService.disableStartup();
26
+ return 'OK';
27
+ }
28
+ };
29
+ exports.StartupController = StartupController;
30
+ __decorate([
31
+ (0, common_1.Post)('/enable'),
32
+ __metadata("design:type", Function),
33
+ __metadata("design:paramtypes", []),
34
+ __metadata("design:returntype", Promise)
35
+ ], StartupController.prototype, "enableStartup", null);
36
+ __decorate([
37
+ (0, common_1.Post)('/disable'),
38
+ __metadata("design:type", Function),
39
+ __metadata("design:paramtypes", []),
40
+ __metadata("design:returntype", Promise)
41
+ ], StartupController.prototype, "disableStartup", null);
42
+ exports.StartupController = StartupController = __decorate([
43
+ (0, common_1.Controller)('/startup'),
44
+ __metadata("design:paramtypes", [startupService_factory_1.StartupServiceFactory])
45
+ ], StartupController);
46
+ //# sourceMappingURL=startup.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startup.controller.js","sourceRoot":"","sources":["../../../../src/v1/startup/startup.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,qEAAgE;AAGzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAG5B,YAA6B,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;QACvE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,CAAA;IACtE,CAAC;IAGK,AAAN,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAA;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,CAAA;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AAlBY,8CAAiB;AAQtB;IADL,IAAA,aAAI,EAAC,SAAS,CAAC;;;;sDAIf;AAGK;IADL,IAAA,aAAI,EAAC,UAAU,CAAC;;;;uDAIhB;4BAjBU,iBAAiB;IAD7B,IAAA,mBAAU,EAAC,UAAU,CAAC;qCAI+B,8CAAqB;GAH9D,iBAAiB,CAkB7B"}
@@ -0,0 +1,5 @@
1
+ declare function getServiceLib(): any;
2
+ declare const _default: {
3
+ getServiceLib: typeof getServiceLib;
4
+ };
5
+ export default _default;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function getServiceLib() {
4
+ const os = process.platform;
5
+ switch (os) {
6
+ case 'darwin':
7
+ return require('node-mac');
8
+ case 'linux':
9
+ return require('node-linux');
10
+ case 'win32':
11
+ return require('node-windows');
12
+ default:
13
+ throw new Error('Unsupported platform');
14
+ }
15
+ }
16
+ exports.default = {
17
+ getServiceLib,
18
+ };
19
+ //# sourceMappingURL=startup.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startup.util.js","sourceRoot":"","sources":["../../../../src/v1/startup/startup.util.ts"],"names":[],"mappings":";;AAIA,SAAS,aAAa;IACpB,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAA;IAC3B,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC,UAAU,CAAC,CAAA;QAC5B,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,YAAY,CAAC,CAAA;QAC9B,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,cAAc,CAAC,CAAA;QAChC;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC;AAED,kBAAe;IACb,aAAa;CACd,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { DarwinStartupService } from './darwinStartup.service';
2
+ import { UnsupportedStartupService } from './unsupportedStartup.service';
3
+ export declare class StartupServiceFactory {
4
+ private readonly darwinStartupService;
5
+ private readonly unsupportedStartupService;
6
+ constructor(darwinStartupService: DarwinStartupService, unsupportedStartupService: UnsupportedStartupService);
7
+ getStartupService(): CodeClimbers.StartupService;
8
+ static buildStartupService(): CodeClimbers.StartupService;
9
+ }
@@ -0,0 +1,41 @@
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 StartupServiceFactory_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.StartupServiceFactory = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const darwinStartup_service_1 = require("./darwinStartup.service");
16
+ const unsupportedStartup_service_1 = require("./unsupportedStartup.service");
17
+ let StartupServiceFactory = StartupServiceFactory_1 = class StartupServiceFactory {
18
+ constructor(darwinStartupService, unsupportedStartupService) {
19
+ this.darwinStartupService = darwinStartupService;
20
+ this.unsupportedStartupService = unsupportedStartupService;
21
+ }
22
+ getStartupService() {
23
+ const os = process.platform;
24
+ switch (os) {
25
+ case 'darwin':
26
+ return this.darwinStartupService;
27
+ default:
28
+ return this.unsupportedStartupService;
29
+ }
30
+ }
31
+ static buildStartupService() {
32
+ return new StartupServiceFactory_1(new darwinStartup_service_1.DarwinStartupService(), new unsupportedStartup_service_1.UnsupportedStartupService()).getStartupService();
33
+ }
34
+ };
35
+ exports.StartupServiceFactory = StartupServiceFactory;
36
+ exports.StartupServiceFactory = StartupServiceFactory = StartupServiceFactory_1 = __decorate([
37
+ (0, common_1.Injectable)(),
38
+ __metadata("design:paramtypes", [darwinStartup_service_1.DarwinStartupService,
39
+ unsupportedStartup_service_1.UnsupportedStartupService])
40
+ ], StartupServiceFactory);
41
+ //# sourceMappingURL=startupService.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startupService.factory.js","sourceRoot":"","sources":["../../../../src/v1/startup/startupService.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA2C;AAC3C,mEAA8D;AAC9D,6EAAwE;AAGjE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAChC,YACmB,oBAA0C,EAC1C,yBAAoD;QADpD,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,8BAAyB,GAAzB,yBAAyB,CAA2B;IACpE,CAAC;IAEJ,iBAAiB;QACf,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAA;QAC3B,QAAQ,EAAE,EAAE,CAAC;YACX,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,oBAAoB,CAAA;YAClC;gBACE,OAAO,IAAI,CAAC,yBAAyB,CAAA;QACzC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,mBAAmB;QACxB,OAAO,IAAI,uBAAqB,CAC9B,IAAI,4CAAoB,EAAE,EAC1B,IAAI,sDAAyB,EAAE,CAChC,CAAC,iBAAiB,EAAE,CAAA;IACvB,CAAC;CACF,CAAA;AAtBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAG8B,4CAAoB;QACf,sDAAyB;GAH5D,qBAAqB,CAsBjC"}