@codeclimbers/server 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +73 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/src/app.module.d.ts +4 -0
- package/dist/src/app.module.js +49 -0
- package/dist/src/app.module.js.map +1 -0
- package/dist/src/assets/startup.plist.d.ts +1 -0
- package/dist/src/assets/startup.plist.js +41 -0
- package/dist/src/assets/startup.plist.js.map +1 -0
- package/dist/src/common/infrastructure/http/controllers/health.controller.d.ts +5 -0
- package/dist/src/common/infrastructure/http/controllers/health.controller.js +29 -0
- package/dist/src/common/infrastructure/http/controllers/health.controller.js.map +1 -0
- package/dist/src/common/infrastructure/http/middleware/requestlogger.middleware.d.ts +5 -0
- package/dist/src/common/infrastructure/http/middleware/requestlogger.middleware.js +27 -0
- package/dist/src/common/infrastructure/http/middleware/requestlogger.middleware.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.js +44 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/sentry.d.ts +1 -0
- package/dist/src/sentry.js +13 -0
- package/dist/src/sentry.js.map +1 -0
- package/dist/src/v1/activities/activities.service.d.ts +21 -0
- package/dist/src/v1/activities/activities.service.js +174 -0
- package/dist/src/v1/activities/activities.service.js.map +1 -0
- package/dist/src/v1/activities/pulse.controller.d.ts +19 -0
- package/dist/src/v1/activities/pulse.controller.js +92 -0
- package/dist/src/v1/activities/pulse.controller.js.map +1 -0
- package/dist/src/v1/activities/wakatimeProxy.controller.d.ts +13 -0
- package/dist/src/v1/activities/wakatimeProxy.controller.js +64 -0
- package/dist/src/v1/activities/wakatimeProxy.controller.js.map +1 -0
- package/dist/src/v1/database/__tests__/knex.test.d.ts +1 -0
- package/dist/src/v1/database/__tests__/knex.test.js +18 -0
- package/dist/src/v1/database/__tests__/knex.test.js.map +1 -0
- package/dist/src/v1/database/__tests__/pulse.repo.test.d.ts +1 -0
- package/dist/src/v1/database/__tests__/pulse.repo.test.js +141 -0
- package/dist/src/v1/database/__tests__/pulse.repo.test.js.map +1 -0
- package/dist/src/v1/database/knex.d.ts +5 -0
- package/dist/src/v1/database/knex.js +87 -0
- package/dist/src/v1/database/knex.js.map +1 -0
- package/dist/src/v1/database/migrations.d.ts +1 -0
- package/dist/src/v1/database/migrations.js +16 -0
- package/dist/src/v1/database/migrations.js.map +1 -0
- package/dist/src/v1/database/pulse.repo.d.ts +17 -0
- package/dist/src/v1/database/pulse.repo.js +115 -0
- package/dist/src/v1/database/pulse.repo.js.map +1 -0
- package/dist/src/v1/database/queries/getCategoryTimeOverview.sql +6 -0
- package/dist/src/v1/database/queries/getLongestDayInRangeMinutes.sql +11 -0
- package/dist/src/v1/database/queries/getStatusBarDetails.sql +42 -0
- package/dist/src/v1/dtos/createWakatimePulse.dto.d.ts +19 -0
- package/dist/src/v1/dtos/createWakatimePulse.dto.js +97 -0
- package/dist/src/v1/dtos/createWakatimePulse.dto.js.map +1 -0
- package/dist/src/v1/dtos/getCategoryTimeOverview.dto.d.ts +4 -0
- package/dist/src/v1/dtos/getCategoryTimeOverview.dto.js +25 -0
- package/dist/src/v1/dtos/getCategoryTimeOverview.dto.js.map +1 -0
- package/dist/src/v1/dtos/getWeekOverview.dto.d.ts +3 -0
- package/dist/src/v1/dtos/getWeekOverview.dto.js +21 -0
- package/dist/src/v1/dtos/getWeekOverview.dto.js.map +1 -0
- package/dist/src/v1/startup/darwinStartup.service.d.ts +8 -0
- package/dist/src/v1/startup/darwinStartup.service.js +114 -0
- package/dist/src/v1/startup/darwinStartup.service.js.map +1 -0
- package/dist/src/v1/startup/linuxStartup.service.d.ts +8 -0
- package/dist/src/v1/startup/linuxStartup.service.js +104 -0
- package/dist/src/v1/startup/linuxStartup.service.js.map +1 -0
- package/dist/src/v1/startup/startup.controller.d.ts +8 -0
- package/dist/src/v1/startup/startup.controller.js +46 -0
- package/dist/src/v1/startup/startup.controller.js.map +1 -0
- package/dist/src/v1/startup/startup.util.d.ts +5 -0
- package/dist/src/v1/startup/startup.util.js +19 -0
- package/dist/src/v1/startup/startup.util.js.map +1 -0
- package/dist/src/v1/startup/startupService.factory.d.ts +9 -0
- package/dist/src/v1/startup/startupService.factory.js +41 -0
- package/dist/src/v1/startup/startupService.factory.js.map +1 -0
- package/dist/src/v1/startup/unsupportedStartup.service.d.ts +6 -0
- package/dist/src/v1/startup/unsupportedStartup.service.js +29 -0
- package/dist/src/v1/startup/unsupportedStartup.service.js.map +1 -0
- package/dist/src/v1/v1.module.d.ts +2 -0
- package/dist/src/v1/v1.module.js +41 -0
- package/dist/src/v1/v1.module.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/utils/__tests__/activites.util.test.d.ts +1 -0
- package/dist/utils/__tests__/activites.util.test.js +18 -0
- package/dist/utils/__tests__/activites.util.test.js.map +1 -0
- package/dist/utils/__tests__/helpers.util.test.d.ts +1 -0
- package/dist/utils/__tests__/helpers.util.test.js +120 -0
- package/dist/utils/__tests__/helpers.util.test.js.map +1 -0
- package/dist/utils/__tests__/wakatime.util.test.d.ts +1 -0
- package/dist/utils/__tests__/wakatime.util.test.js +210 -0
- package/dist/utils/__tests__/wakatime.util.test.js.map +1 -0
- package/dist/utils/activities.util.d.ts +15 -0
- package/dist/utils/activities.util.js +147 -0
- package/dist/utils/activities.util.js.map +1 -0
- package/dist/utils/allExceptions.filter.d.ts +7 -0
- package/dist/utils/allExceptions.filter.js +39 -0
- package/dist/utils/allExceptions.filter.js.map +1 -0
- package/dist/utils/codeClimberErrors.d.ts +16 -0
- package/dist/utils/codeClimberErrors.js +27 -0
- package/dist/utils/codeClimberErrors.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/environment.util.d.ts +1 -0
- package/dist/utils/environment.util.js +6 -0
- package/dist/utils/environment.util.js.map +1 -0
- package/dist/utils/helpers.util.d.ts +7 -0
- package/dist/utils/helpers.util.js +116 -0
- package/dist/utils/helpers.util.js.map +1 -0
- package/dist/utils/node.util.d.ts +7 -0
- package/dist/utils/node.util.js +26 -0
- package/dist/utils/node.util.js.map +1 -0
- package/dist/utils/sql.util.d.ts +1 -0
- package/dist/utils/sql.util.js +11 -0
- package/dist/utils/sql.util.js.map +1 -0
- package/dist/utils/sqlReader.util.d.ts +5 -0
- package/dist/utils/sqlReader.util.js +34 -0
- package/dist/utils/sqlReader.util.js.map +1 -0
- package/dist/utils/wakatime.util.d.ts +6 -0
- package/dist/utils/wakatime.util.js +63 -0
- package/dist/utils/wakatime.util.js.map +1 -0
- package/index.ts +5 -0
- package/jest.config.js +8 -0
- package/knexfile.js +14 -0
- package/nest-cli.json +15 -0
- package/package.json +77 -0
- package/src/app.module.ts +37 -0
- package/src/assets/startup.plist.ts +36 -0
- package/src/common/infrastructure/http/controllers/health.controller.ts +9 -0
- package/src/common/infrastructure/http/middleware/requestlogger.middleware.ts +22 -0
- package/src/main.ts +51 -0
- package/src/sentry.ts +14 -0
- package/src/types/activities.api.d.ts +18 -0
- package/src/types/time.api.d.ts +23 -0
- package/src/types/utils.d.ts +8 -0
- package/src/types/wakatimeProxy.api.d.ts +55 -0
- package/src/v1/activities/activities.service.ts +213 -0
- package/src/v1/activities/pulse.controller.ts +68 -0
- package/src/v1/activities/wakatimeProxy.controller.ts +33 -0
- package/src/v1/database/__tests__/knex.test.ts +18 -0
- package/src/v1/database/__tests__/pulse.repo.test.ts +209 -0
- package/src/v1/database/knex.ts +107 -0
- package/src/v1/database/migrations.ts +13 -0
- package/src/v1/database/models/pulse.d.ts +24 -0
- package/src/v1/database/pulse.repo.ts +132 -0
- package/src/v1/database/queries/getCategoryTimeOverview.sql +6 -0
- package/src/v1/database/queries/getLongestDayInRangeMinutes.sql +11 -0
- package/src/v1/database/queries/getStatusBarDetails.sql +42 -0
- package/src/v1/dtos/createWakatimePulse.dto.ts +66 -0
- package/src/v1/dtos/getCategoryTimeOverview.dto.ts +9 -0
- package/src/v1/dtos/getWeekOverview.dto.ts +6 -0
- package/src/v1/startup/darwinStartup.service.ts +114 -0
- package/src/v1/startup/linuxStartup.service.ts +101 -0
- package/src/v1/startup/startup.controller.ts +23 -0
- package/src/v1/startup/startup.util.ts +21 -0
- package/src/v1/startup/startupService.factory.ts +28 -0
- package/src/v1/startup/unsupportedStartup.service.ts +21 -0
- package/src/v1/v1.module.ts +28 -0
- package/test/app.e2e-spec.ts +24 -0
- package/test/jest-e2e.json +9 -0
- package/test/jest.globalSetup.js +15 -0
- package/test/jest.globalTeardown.js +8 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +22 -0
- package/utils/__tests__/activites.util.test.ts +18 -0
- package/utils/__tests__/helpers.util.test.ts +155 -0
- package/utils/__tests__/wakatime.util.test.ts +222 -0
- package/utils/activities.util.ts +193 -0
- package/utils/allExceptions.filter.ts +43 -0
- package/utils/codeClimberErrors.ts +32 -0
- package/utils/constants.ts +1 -0
- package/utils/environment.util.ts +1 -0
- package/utils/helpers.util.ts +131 -0
- package/utils/node.util.ts +29 -0
- package/utils/sql.util.ts +13 -0
- package/utils/sqlReader.util.ts +49 -0
- package/utils/wakatime.util.ts +78 -0
package/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
6
|
+
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
7
|
+
|
8
|
+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
9
|
+
<p align="center">
|
10
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
11
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
12
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
13
|
+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
14
|
+
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
15
|
+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
16
|
+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
17
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
18
|
+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
19
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
20
|
+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
21
|
+
</p>
|
22
|
+
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
|
23
|
+
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
|
24
|
+
|
25
|
+
## Description
|
26
|
+
|
27
|
+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ npm install
|
33
|
+
```
|
34
|
+
|
35
|
+
## Running the app
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# development
|
39
|
+
$ npm run start
|
40
|
+
|
41
|
+
# watch mode
|
42
|
+
$ npm run start:dev
|
43
|
+
|
44
|
+
# production mode
|
45
|
+
$ npm run start:prod
|
46
|
+
```
|
47
|
+
|
48
|
+
## Test
|
49
|
+
|
50
|
+
```bash
|
51
|
+
# unit tests
|
52
|
+
$ npm run test
|
53
|
+
|
54
|
+
# e2e tests
|
55
|
+
$ npm run test:e2e
|
56
|
+
|
57
|
+
# test coverage
|
58
|
+
$ npm run test:cov
|
59
|
+
```
|
60
|
+
|
61
|
+
## Support
|
62
|
+
|
63
|
+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
64
|
+
|
65
|
+
## Stay in touch
|
66
|
+
|
67
|
+
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
68
|
+
- Website - [https://nestjs.com](https://nestjs.com/)
|
69
|
+
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
70
|
+
|
71
|
+
## License
|
72
|
+
|
73
|
+
Nest is [MIT licensed](LICENSE).
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
+
exports.SERVER_CONSTANTS = void 0;
|
18
|
+
__exportStar(require("./src/main"), exports);
|
19
|
+
exports.SERVER_CONSTANTS = require("./utils/constants");
|
20
|
+
__exportStar(require("./utils/environment.util"), exports);
|
21
|
+
__exportStar(require("./src/v1/startup/startupService.factory"), exports);
|
22
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,6CAA0B;AAC1B,wDAAqD;AACrD,2DAAwC;AACxC,0EAAuD"}
|
@@ -0,0 +1,49 @@
|
|
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.AppModule = void 0;
|
10
|
+
const common_1 = require("@nestjs/common");
|
11
|
+
const v1_module_1 = require("./v1/v1.module");
|
12
|
+
const core_1 = require("@nestjs/core");
|
13
|
+
const allExceptions_filter_1 = require("../utils/allExceptions.filter");
|
14
|
+
const requestlogger_middleware_1 = require("./common/infrastructure/http/middleware/requestlogger.middleware");
|
15
|
+
const serve_static_1 = require("@nestjs/serve-static");
|
16
|
+
const knex_1 = require("./v1/database/knex");
|
17
|
+
const setup_1 = require("@sentry/nestjs/setup");
|
18
|
+
const node_util_1 = require("../utils/node.util");
|
19
|
+
let AppModule = class AppModule {
|
20
|
+
configure(consumer) {
|
21
|
+
consumer.apply(requestlogger_middleware_1.RequestLoggerMiddleware).forRoutes('*');
|
22
|
+
}
|
23
|
+
};
|
24
|
+
exports.AppModule = AppModule;
|
25
|
+
exports.AppModule = AppModule = __decorate([
|
26
|
+
(0, common_1.Module)({
|
27
|
+
imports: [
|
28
|
+
setup_1.SentryModule.forRoot(),
|
29
|
+
knex_1.DbModule,
|
30
|
+
v1_module_1.V1Module,
|
31
|
+
core_1.RouterModule.register([
|
32
|
+
{
|
33
|
+
path: '/api/v1',
|
34
|
+
module: v1_module_1.V1Module,
|
35
|
+
},
|
36
|
+
]),
|
37
|
+
serve_static_1.ServeStaticModule.forRoot({
|
38
|
+
rootPath: node_util_1.APP_DIST_PATH,
|
39
|
+
}),
|
40
|
+
],
|
41
|
+
providers: [
|
42
|
+
{
|
43
|
+
provide: core_1.APP_FILTER,
|
44
|
+
useClass: allExceptions_filter_1.AllExceptionsFilter,
|
45
|
+
},
|
46
|
+
],
|
47
|
+
})
|
48
|
+
], AppModule);
|
49
|
+
//# sourceMappingURL=app.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA2D;AAC3D,8CAAyC;AACzC,uCAAuD;AACvD,wEAAmE;AACnE,+GAA0G;AAC1G,uDAAwD;AACxD,6CAA6C;AAC7C,gDAAmD;AACnD,kDAAkD;AAwB3C,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,SAAS,CAAC,QAA4B;QACpC,QAAQ,CAAC,KAAK,CAAC,kDAAuB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACxD,CAAC;CACF,CAAA;AAJY,8BAAS;oBAAT,SAAS;IAtBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAY,CAAC,OAAO,EAAE;YACtB,eAAQ;YACR,oBAAQ;YACR,mBAAY,CAAC,QAAQ,CAAC;gBACpB;oBACE,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,oBAAQ;iBACjB;aACF,CAAC;YACF,gCAAiB,CAAC,OAAO,CAAC;gBACxB,QAAQ,EAAE,yBAAa;aACxB,CAAC;SACH;QACD,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,iBAAU;gBACnB,QAAQ,EAAE,0CAAmB;aAC9B;SACF;KACF,CAAC;GACW,SAAS,CAIrB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const plist: () => string;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.plist = void 0;
|
4
|
+
const node_util_1 = require("../../utils/node.util");
|
5
|
+
const path = require("node:path");
|
6
|
+
const plist = () => {
|
7
|
+
try {
|
8
|
+
const bashScriptPath = path.join(node_util_1.BIN_PATH, 'run.sh');
|
9
|
+
return `
|
10
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
11
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
12
|
+
<plist version="1.0">
|
13
|
+
<dict>
|
14
|
+
|
15
|
+
<key>Label</key>
|
16
|
+
<string>io.codeclimbers.plist</string>
|
17
|
+
|
18
|
+
<key>ProgramArguments</key>
|
19
|
+
<array>
|
20
|
+
<string>/bin/bash</string>
|
21
|
+
<string>${bashScriptPath}</string>
|
22
|
+
</array>
|
23
|
+
|
24
|
+
<key>KeepAlive</key>
|
25
|
+
<true/>
|
26
|
+
|
27
|
+
<key>StandardOutPath</key>
|
28
|
+
<string>${node_util_1.HOME_DIR}/.codeclimbers/log.out</string>
|
29
|
+
<key>StandardErrorPath</key>
|
30
|
+
<string>${node_util_1.HOME_DIR}/.codeclimbers/log.err</string>
|
31
|
+
|
32
|
+
</dict>
|
33
|
+
</plist>
|
34
|
+
`;
|
35
|
+
}
|
36
|
+
catch (error) {
|
37
|
+
console.error(`Error creating plist declaration: ${error.message}`);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
exports.plist = plist;
|
41
|
+
//# sourceMappingURL=startup.plist.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"startup.plist.js","sourceRoot":"","sources":["../../../src/assets/startup.plist.ts"],"names":[],"mappings":";;;AAAA,qDAA0D;AAC1D,kCAAiC;AAE1B,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAQ,EAAE,QAAQ,CAAC,CAAA;QACpD,OAAO;;;;;;;;;;;;oBAYS,cAAc;;;;;;;kBAOhB,oBAAQ;;kBAER,oBAAQ;;;;GAIvB,CAAA;IACD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IACrE,CAAC;AACH,CAAC,CAAA;AAhCY,QAAA,KAAK,SAgCjB"}
|
@@ -0,0 +1,29 @@
|
|
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.HealthController = void 0;
|
13
|
+
const common_1 = require("@nestjs/common");
|
14
|
+
let HealthController = class HealthController {
|
15
|
+
health() {
|
16
|
+
return { OK: true };
|
17
|
+
}
|
18
|
+
};
|
19
|
+
exports.HealthController = HealthController;
|
20
|
+
__decorate([
|
21
|
+
(0, common_1.Get)(),
|
22
|
+
__metadata("design:type", Function),
|
23
|
+
__metadata("design:paramtypes", []),
|
24
|
+
__metadata("design:returntype", Object)
|
25
|
+
], HealthController.prototype, "health", null);
|
26
|
+
exports.HealthController = HealthController = __decorate([
|
27
|
+
(0, common_1.Controller)('/health')
|
28
|
+
], HealthController);
|
29
|
+
//# sourceMappingURL=health.controller.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../../../../../src/common/infrastructure/http/controllers/health.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgD;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,MAAM;QACJ,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;IACrB,CAAC;CACF,CAAA;AALY,4CAAgB;AAE3B;IADC,IAAA,YAAG,GAAE;;;;8CAGL;2BAJU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,SAAS,CAAC;GACT,gBAAgB,CAK5B"}
|
@@ -0,0 +1,27 @@
|
|
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.RequestLoggerMiddleware = void 0;
|
10
|
+
const common_1 = require("@nestjs/common");
|
11
|
+
let RequestLoggerMiddleware = class RequestLoggerMiddleware {
|
12
|
+
use(request, response, next) {
|
13
|
+
const { ip, method, originalUrl: url } = request;
|
14
|
+
const userAgent = request.get('user-agent') || '';
|
15
|
+
response.on('close', () => {
|
16
|
+
const { statusCode } = response;
|
17
|
+
const contentLength = response.get('content-length');
|
18
|
+
common_1.Logger.log(`${method} ${url} ${statusCode} ${contentLength} - ${userAgent} ${ip}`, 'requestlogger.middleware');
|
19
|
+
});
|
20
|
+
next();
|
21
|
+
}
|
22
|
+
};
|
23
|
+
exports.RequestLoggerMiddleware = RequestLoggerMiddleware;
|
24
|
+
exports.RequestLoggerMiddleware = RequestLoggerMiddleware = __decorate([
|
25
|
+
(0, common_1.Injectable)()
|
26
|
+
], RequestLoggerMiddleware);
|
27
|
+
//# sourceMappingURL=requestlogger.middleware.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"requestlogger.middleware.js","sourceRoot":"","sources":["../../../../../../src/common/infrastructure/http/middleware/requestlogger.middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAmE;AAK5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,GAAG,CAAC,OAAgB,EAAE,QAAkB,EAAE,IAAkB;QAC1D,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,OAAO,CAAA;QAChD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;QAEjD,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACxB,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAA;YAC/B,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;YACpD,eAAM,CAAC,GAAG,CACR,GAAG,MAAM,IAAI,GAAG,IAAI,UAAU,IAAI,aAAa,MAAM,SAAS,IAAI,EAAE,EAAE,EACtE,0BAA0B,CAC3B,CAAA;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,EAAE,CAAA;IACR,CAAC;CACF,CAAA;AAhBY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;GACA,uBAAuB,CAgBnC"}
|
package/dist/src/main.js
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.bootstrap = bootstrap;
|
4
|
+
require("./sentry");
|
5
|
+
const core_1 = require("@nestjs/core");
|
6
|
+
const app_module_1 = require("./app.module");
|
7
|
+
const common_1 = require("@nestjs/common");
|
8
|
+
const environment_util_1 = require("../utils/environment.util");
|
9
|
+
const constants_1 = require("../utils/constants");
|
10
|
+
const wakatime_util_1 = require("../utils/wakatime.util");
|
11
|
+
const migrations_1 = require("./v1/database/migrations");
|
12
|
+
const updatedIniValues = {
|
13
|
+
api_key: 'eacb3beb-dad8-4fa1-b6ba-f89de8bf8f4a',
|
14
|
+
api_url: 'http://localhost:14400/api/v1/wakatime',
|
15
|
+
};
|
16
|
+
const shouldShowDebugLogs = process.env.DEBUG === '*' || process.env.NODE_ENV === 'development';
|
17
|
+
const traceEnvironment = () => {
|
18
|
+
common_1.Logger.log(`Running as: ${process.env.NODE_ENV}`, 'main.ts');
|
19
|
+
common_1.Logger.log(`process.env: ${JSON.stringify(process.env)}`, 'main.ts');
|
20
|
+
};
|
21
|
+
async function bootstrap() {
|
22
|
+
const port = process.env.CODECLIMBERS_SERVER_PORT || 14_400;
|
23
|
+
const app = await core_1.NestFactory.create(app_module_1.AppModule, {
|
24
|
+
logger: shouldShowDebugLogs
|
25
|
+
? ['log', 'debug', 'error', 'verbose', 'warn']
|
26
|
+
: ['error', 'warn'],
|
27
|
+
});
|
28
|
+
traceEnvironment();
|
29
|
+
app.enableCors();
|
30
|
+
app.useGlobalPipes(new common_1.ValidationPipe({
|
31
|
+
transform: true,
|
32
|
+
transformOptions: {
|
33
|
+
enableImplicitConversion: true,
|
34
|
+
},
|
35
|
+
}));
|
36
|
+
await (0, wakatime_util_1.updateSettings)(updatedIniValues);
|
37
|
+
await (0, migrations_1.startMigrations)();
|
38
|
+
await app.listen(port);
|
39
|
+
process.title = constants_1.PROCESS_NAME;
|
40
|
+
}
|
41
|
+
if (!(0, environment_util_1.isCli)()) {
|
42
|
+
bootstrap();
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=main.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";;AAuBA,8BAuBC;AA7CD,oBAAiB;AAEjB,uCAA0C;AAC1C,6CAAwC;AACxC,2CAAuD;AACvD,gEAAiD;AACjD,kDAAiD;AACjD,0DAAuD;AACvD,yDAA0D;AAE1D,MAAM,gBAAgB,GAA2B;IAC/C,OAAO,EAAE,sCAAsC;IAC/C,OAAO,EAAE,wCAAwC;CAClD,CAAA;AACD,MAAM,mBAAmB,GACvB,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAA;AAErE,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,eAAM,CAAC,GAAG,CAAC,eAAe,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAA;IAC5D,eAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;AACtE,CAAC,CAAA;AAEM,KAAK,UAAU,SAAS;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,MAAM,CAAA;IAC3D,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,EAAE;QAC9C,MAAM,EAAE,mBAAmB;YACzB,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;YAC9C,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC;KACtB,CAAC,CAAA;IACF,gBAAgB,EAAE,CAAA;IAElB,GAAG,CAAC,UAAU,EAAE,CAAA;IAChB,GAAG,CAAC,cAAc,CAChB,IAAI,uBAAc,CAAC;QACjB,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE;YAChB,wBAAwB,EAAE,IAAI;SAC/B;KACF,CAAC,CACH,CAAA;IAED,MAAM,IAAA,8BAAc,EAAC,gBAAgB,CAAC,CAAA;IACtC,MAAM,IAAA,4BAAe,GAAE,CAAA;IACvB,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACtB,OAAO,CAAC,KAAK,GAAG,wBAAY,CAAA;AAC9B,CAAC;AAED,IAAI,CAAC,IAAA,wBAAK,GAAE,EAAE,CAAC;IACb,SAAS,EAAE,CAAA;AACb,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const Sentry = require("@sentry/nestjs");
|
4
|
+
const profiling_node_1 = require("@sentry/profiling-node");
|
5
|
+
if (process.env.NODE_ENV === 'production') {
|
6
|
+
Sentry.init({
|
7
|
+
dsn: 'https://e885e4c5eeed09d6229c7d7bfdc8d762@o4507772937043968.ingest.us.sentry.io/4507772946022400',
|
8
|
+
integrations: [(0, profiling_node_1.nodeProfilingIntegration)()],
|
9
|
+
tracesSampleRate: 0.1,
|
10
|
+
profilesSampleRate: 0.1,
|
11
|
+
});
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=sentry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sentry.js","sourceRoot":"","sources":["../../src/sentry.ts"],"names":[],"mappings":";;AAAA,yCAAwC;AACxC,2DAAiE;AAEjE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,iGAAiG;QACtG,YAAY,EAAE,CAAC,IAAA,yCAAwB,GAAE,CAAC;QAE1C,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAA;AACJ,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { CreateWakatimePulseDto } from '../dtos/createWakatimePulse.dto';
|
2
|
+
import { PulseRepo } from '../database/pulse.repo';
|
3
|
+
export declare class ActivitiesService {
|
4
|
+
private readonly pulseRepo;
|
5
|
+
constructor(pulseRepo: PulseRepo);
|
6
|
+
getActivityStatusBar(): Promise<CodeClimbers.ActivitiesStatusBar>;
|
7
|
+
createPulse(pulseDto: CreateWakatimePulseDto): Promise<{
|
8
|
+
Responses: number[][];
|
9
|
+
}>;
|
10
|
+
createPulses(pulsesDto: CreateWakatimePulseDto[]): Promise<{
|
11
|
+
Responses: number[][];
|
12
|
+
}>;
|
13
|
+
getLatestPulses(): Promise<CodeClimbers.Pulse[] | undefined>;
|
14
|
+
getCategoryTimeOverview(startDate: string, endDate: string): Promise<CodeClimbers.TimeOverview[]>;
|
15
|
+
getWeekOverview(date: string): Promise<CodeClimbers.WeekOverview>;
|
16
|
+
getSources(): Promise<CodeClimbers.Source[]>;
|
17
|
+
generatePulsesCSV(): Promise<Buffer>;
|
18
|
+
private userAgent;
|
19
|
+
private mapDtoToPulse;
|
20
|
+
private convertPulsesToCSV;
|
21
|
+
}
|
@@ -0,0 +1,174 @@
|
|
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.ActivitiesService = void 0;
|
13
|
+
const common_1 = require("@nestjs/common");
|
14
|
+
const activities_util_1 = require("../../../utils/activities.util");
|
15
|
+
const pulse_repo_1 = require("../database/pulse.repo");
|
16
|
+
const os = require("node:os");
|
17
|
+
const dayjs = require("dayjs");
|
18
|
+
let ActivitiesService = class ActivitiesService {
|
19
|
+
constructor(pulseRepo) {
|
20
|
+
this.pulseRepo = pulseRepo;
|
21
|
+
this.pulseRepo = pulseRepo;
|
22
|
+
}
|
23
|
+
async getActivityStatusBar() {
|
24
|
+
const statusBarRaw = await this.pulseRepo.getStatusBarDetails();
|
25
|
+
return activities_util_1.default.mapStatusBarRawToDto(statusBarRaw);
|
26
|
+
}
|
27
|
+
async createPulse(pulseDto) {
|
28
|
+
const latestProject = await this.pulseRepo.getLatestProject();
|
29
|
+
const pulse = this.mapDtoToPulse(pulseDto, latestProject);
|
30
|
+
await this.pulseRepo.createPulse(pulse);
|
31
|
+
return activities_util_1.default.pulseSuccessResponse(1);
|
32
|
+
}
|
33
|
+
async createPulses(pulsesDto) {
|
34
|
+
const latestProject = await this.pulseRepo.getLatestProject();
|
35
|
+
const pulses = pulsesDto.map((dto) => this.mapDtoToPulse(dto, latestProject));
|
36
|
+
const uniquePulses = activities_util_1.default.filterUniqueByHash(pulses);
|
37
|
+
await this.pulseRepo.createPulses(uniquePulses);
|
38
|
+
return activities_util_1.default.pulseSuccessResponse(pulsesDto.length);
|
39
|
+
}
|
40
|
+
async getLatestPulses() {
|
41
|
+
return this.pulseRepo.getLatestPulses();
|
42
|
+
}
|
43
|
+
async getCategoryTimeOverview(startDate, endDate) {
|
44
|
+
return await this.pulseRepo.getCategoryTimeOverview(startDate, endDate);
|
45
|
+
}
|
46
|
+
async getWeekOverview(date) {
|
47
|
+
const currentDate = new Date(date);
|
48
|
+
const weekStart = new Date(new Date(currentDate).setDate(currentDate.getDate() - 7));
|
49
|
+
const tomorrow = new Date(new Date(date).setDate(currentDate.getDate() + 1));
|
50
|
+
const yesterday = new Date(new Date(date).setDate(currentDate.getDate() - 1));
|
51
|
+
const longestDayMinutes = await this.pulseRepo.getLongestDayInRangeMinutes(weekStart, currentDate);
|
52
|
+
const yesterdayMinutes = await this.pulseRepo.getRangeMinutes(yesterday, currentDate);
|
53
|
+
const todayMinutes = await this.pulseRepo.getRangeMinutes(currentDate, tomorrow);
|
54
|
+
const weekMinutes = await this.pulseRepo.getRangeMinutes(weekStart, currentDate);
|
55
|
+
return {
|
56
|
+
longestDayMinutes,
|
57
|
+
yesterdayMinutes,
|
58
|
+
todayMinutes,
|
59
|
+
weekMinutes,
|
60
|
+
};
|
61
|
+
}
|
62
|
+
async getSources() {
|
63
|
+
const userAgentsAndLastActive = await this.pulseRepo.getUniqueUserAgentsAndLastActive();
|
64
|
+
const sources = new Set();
|
65
|
+
userAgentsAndLastActive.forEach((userAgent) => {
|
66
|
+
const source = activities_util_1.default.getSourceFromUserAgent(userAgent.userAgent);
|
67
|
+
if (source) {
|
68
|
+
sources.add(source);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
return Array.from(sources).map((source) => {
|
72
|
+
const maxLastActive = userAgentsAndLastActive
|
73
|
+
.filter((userAgent) => {
|
74
|
+
return (source ===
|
75
|
+
activities_util_1.default.getSourceFromUserAgent(userAgent.userAgent));
|
76
|
+
})
|
77
|
+
.reduce((max, userAgent) => {
|
78
|
+
return new Date(userAgent.lastActive) > new Date(max)
|
79
|
+
? userAgent.lastActive
|
80
|
+
: max;
|
81
|
+
}, new Date(0).toISOString());
|
82
|
+
return { name: source, lastActive: maxLastActive };
|
83
|
+
});
|
84
|
+
}
|
85
|
+
async generatePulsesCSV() {
|
86
|
+
const pulses = await this.pulseRepo.getAllPulses();
|
87
|
+
const csvString = this.convertPulsesToCSV(pulses);
|
88
|
+
return Buffer.from(csvString, 'utf-8');
|
89
|
+
}
|
90
|
+
userAgent() {
|
91
|
+
const platform = os.platform();
|
92
|
+
const release = os.release();
|
93
|
+
const arch = os.arch();
|
94
|
+
const nodeVersion = process.version;
|
95
|
+
return `Node/${nodeVersion.slice(1)} (${platform}; ${arch}) OS/${release}`;
|
96
|
+
}
|
97
|
+
mapDtoToPulse(dto, latestProject) {
|
98
|
+
const project = (dto.project === '<<PROJECT>>' || !dto.project) && latestProject
|
99
|
+
? latestProject
|
100
|
+
: dto.project;
|
101
|
+
return {
|
102
|
+
userId: 'local',
|
103
|
+
project,
|
104
|
+
branch: dto.branch,
|
105
|
+
entity: dto.entity,
|
106
|
+
type: dto.type,
|
107
|
+
isWrite: dto.is_write || false,
|
108
|
+
editor: dto.editor || '',
|
109
|
+
language: dto.language || Intl.DateTimeFormat().resolvedOptions().locale,
|
110
|
+
operatingSystem: dto.operating_system || os.platform(),
|
111
|
+
machine: dto.machine || os.hostname(),
|
112
|
+
userAgent: dto.user_agent || this.userAgent(),
|
113
|
+
time: dayjs(dto.time * 1000).toISOString(),
|
114
|
+
hash: `${activities_util_1.default.calculatePulseHash(dto)}`,
|
115
|
+
origin: dto.origin || '',
|
116
|
+
originId: dto.origin_id || '',
|
117
|
+
category: dto.category || '',
|
118
|
+
createdAt: dayjs().toISOString(),
|
119
|
+
};
|
120
|
+
}
|
121
|
+
convertPulsesToCSV(pulses) {
|
122
|
+
const header = [
|
123
|
+
'ID',
|
124
|
+
'User ID',
|
125
|
+
'Entity',
|
126
|
+
'Type',
|
127
|
+
'Category',
|
128
|
+
'Project',
|
129
|
+
'Branch',
|
130
|
+
'Language',
|
131
|
+
'Is Write',
|
132
|
+
'Editor',
|
133
|
+
'Operating System',
|
134
|
+
'Machine',
|
135
|
+
'User Agent',
|
136
|
+
'Time',
|
137
|
+
'Hash',
|
138
|
+
'Origin',
|
139
|
+
'Origin ID',
|
140
|
+
'Created At',
|
141
|
+
'Description',
|
142
|
+
].join(',');
|
143
|
+
const rows = pulses.map((row) => [
|
144
|
+
row.id,
|
145
|
+
row.userId,
|
146
|
+
row.entity,
|
147
|
+
row.type,
|
148
|
+
row.category,
|
149
|
+
row.project,
|
150
|
+
row.branch,
|
151
|
+
row.language,
|
152
|
+
row.isWrite,
|
153
|
+
row.editor,
|
154
|
+
row.operatingSystem,
|
155
|
+
row.machine,
|
156
|
+
row.userAgent,
|
157
|
+
row.time,
|
158
|
+
row.hash,
|
159
|
+
row.origin,
|
160
|
+
row.originId,
|
161
|
+
row.createdAt,
|
162
|
+
row.description,
|
163
|
+
]
|
164
|
+
.map((value) => (value === null ? '' : value.toString()))
|
165
|
+
.join(','));
|
166
|
+
return [header, ...rows].join('\n');
|
167
|
+
}
|
168
|
+
};
|
169
|
+
exports.ActivitiesService = ActivitiesService;
|
170
|
+
exports.ActivitiesService = ActivitiesService = __decorate([
|
171
|
+
(0, common_1.Injectable)(),
|
172
|
+
__metadata("design:paramtypes", [pulse_repo_1.PulseRepo])
|
173
|
+
], ActivitiesService);
|
174
|
+
//# sourceMappingURL=activities.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"activities.service.js","sourceRoot":"","sources":["../../../../src/v1/activities/activities.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2C;AAE3C,oEAA2D;AAC3D,uDAAkD;AAClD,8BAA6B;AAC7B,+BAA8B;AAGvB,IAAM,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AI,CAAC,GAAG,CAAC,CACb,CAAA;QAED,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AA5MY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAE6B,sBAAS;GADtC,iBAAiB,CA4M7B"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { ActivitiesService } from './activities.service';
|
2
|
+
import { Response } from 'express';
|
3
|
+
import { GetCategoryTimeOverviewDto } from '../dtos/getCategoryTimeOverview.dto';
|
4
|
+
import { GetWeekOverviewDto } from '../dtos/getWeekOverview.dto';
|
5
|
+
export declare class PulseController {
|
6
|
+
private readonly activitiesService;
|
7
|
+
constructor(activitiesService: ActivitiesService);
|
8
|
+
latestPulses(): Promise<{
|
9
|
+
message: string;
|
10
|
+
data: CodeClimbers.Pulse[] | undefined;
|
11
|
+
}>;
|
12
|
+
getWeekOverview(dto: GetWeekOverviewDto): Promise<CodeClimbers.WeekOverviewDao>;
|
13
|
+
getCategoryTimeOverview(times: GetCategoryTimeOverviewDto): Promise<CodeClimbers.TimeOverviewDao>;
|
14
|
+
getSources(): Promise<Promise<{
|
15
|
+
message: string;
|
16
|
+
data: CodeClimbers.Source[] | [];
|
17
|
+
}>>;
|
18
|
+
exportPulses(response: Response): Promise<void>;
|
19
|
+
}
|