@venturialstd/github 0.0.3 → 0.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.
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { HttpService } from '@nestjs/axios';
|
|
1
2
|
import { SettingsService } from '@venturialstd/core';
|
|
2
3
|
export declare class GithubOAuthService {
|
|
3
4
|
private readonly settings;
|
|
4
|
-
|
|
5
|
+
private readonly httpService;
|
|
6
|
+
constructor(settings: SettingsService, httpService: HttpService);
|
|
5
7
|
exchangeCode(code: string): Promise<any>;
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=github-oauth.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-oauth.service.d.ts","sourceRoot":"","sources":["../../src/services/github-oauth.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-oauth.service.d.ts","sourceRoot":"","sources":["../../src/services/github-oauth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD,qBACa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,WAAW;IAGrC,YAAY,CAAC,IAAI,EAAE,MAAM;CAsBhC"}
|
|
@@ -8,26 +8,26 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.GithubOAuthService = void 0;
|
|
13
|
+
const axios_1 = require("@nestjs/axios");
|
|
16
14
|
const common_1 = require("@nestjs/common");
|
|
17
15
|
const core_1 = require("@venturialstd/core");
|
|
18
|
-
const
|
|
16
|
+
const rxjs_1 = require("rxjs");
|
|
19
17
|
const github_settings_constants_1 = require("../constants/github.settings.constants");
|
|
20
18
|
let GithubOAuthService = class GithubOAuthService {
|
|
21
19
|
settings;
|
|
22
|
-
|
|
20
|
+
httpService;
|
|
21
|
+
constructor(settings, httpService) {
|
|
23
22
|
this.settings = settings;
|
|
23
|
+
this.httpService = httpService;
|
|
24
24
|
}
|
|
25
25
|
async exchangeCode(code) {
|
|
26
26
|
const secret = await this.settings.get(github_settings_constants_1.GITHUB_SETTING_KEYS.GENERAL_CLIENT_SECRET);
|
|
27
27
|
const client_id = await this.settings.get(github_settings_constants_1.GITHUB_SETTING_KEYS.GENERAL_CLIENT_ID);
|
|
28
28
|
const url = await this.settings.get(github_settings_constants_1.GITHUB_SETTING_KEYS.GENERAL_URL);
|
|
29
29
|
const github_host = await this.settings.get(github_settings_constants_1.GITHUB_SETTING_KEYS.GENERAL_GITHUB_HOST);
|
|
30
|
-
const response = await
|
|
30
|
+
const response = await (0, rxjs_1.firstValueFrom)(this.httpService.post(`${github_host}/login/oauth/access_token`, null, {
|
|
31
31
|
params: {
|
|
32
32
|
client_id: client_id,
|
|
33
33
|
client_secret: secret,
|
|
@@ -37,13 +37,14 @@ let GithubOAuthService = class GithubOAuthService {
|
|
|
37
37
|
headers: {
|
|
38
38
|
Accept: 'application/json',
|
|
39
39
|
},
|
|
40
|
-
});
|
|
40
|
+
}));
|
|
41
41
|
return response.data;
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
exports.GithubOAuthService = GithubOAuthService;
|
|
45
45
|
exports.GithubOAuthService = GithubOAuthService = __decorate([
|
|
46
46
|
(0, common_1.Injectable)(),
|
|
47
|
-
__metadata("design:paramtypes", [core_1.SettingsService
|
|
47
|
+
__metadata("design:paramtypes", [core_1.SettingsService,
|
|
48
|
+
axios_1.HttpService])
|
|
48
49
|
], GithubOAuthService);
|
|
49
50
|
//# sourceMappingURL=github-oauth.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-oauth.service.js","sourceRoot":"","sources":["../../src/services/github-oauth.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-oauth.service.js","sourceRoot":"","sources":["../../src/services/github-oauth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAA4C;AAC5C,6CAAqD;AACrD,+BAAsC;AAEtC,sFAA6E;AAGtE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAEV;IACA;IAFnB,YACmB,QAAyB,EACzB,WAAwB;QADxB,aAAQ,GAAR,QAAQ,CAAiB;QACzB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,+CAAmB,CAAC,qBAAqB,CAAC,CAAC;QAClF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,+CAAmB,CAAC,iBAAiB,CAAC,CAAC;QACjF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,+CAAmB,CAAC,WAAW,CAAC,CAAC;QACrE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,+CAAmB,CAAC,mBAAmB,CAAC,CAAC;QAErF,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,2BAA2B,EAAE,IAAI,EAAE;YACrE,MAAM,EAAE;gBACN,SAAS,EAAE,SAAS;gBACpB,aAAa,EAAE,MAAM;gBACrB,IAAI;gBACJ,YAAY,EAAE,GAAG;aAClB;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CACH,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF,CAAA;AA5BY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;qCAGkB,sBAAe;QACZ,mBAAW;GAHhC,kBAAkB,CA4B9B"}
|