@rich-automation/lotto 2.0.0 → 2.0.2
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.
- package/lib/cjs/apis/dhlottery/getWinningNumbers.js +8 -6
- package/lib/cjs/constants/index.js +3 -1
- package/lib/cjs/constants/selectors.js +5 -4
- package/lib/cjs/constants/urls.js +2 -2
- package/lib/cjs/controllers/playwright/playwright.page.js +10 -0
- package/lib/cjs/controllers/puppeteer/puppeteer.page.js +15 -0
- package/lib/cjs/lottoService.js +31 -39
- package/lib/esm/apis/dhlottery/getWinningNumbers.js +8 -6
- package/lib/esm/constants/index.js +3 -1
- package/lib/esm/constants/selectors.js +5 -4
- package/lib/esm/constants/urls.js +2 -2
- package/lib/esm/controllers/playwright/playwright.page.js +10 -0
- package/lib/esm/controllers/puppeteer/puppeteer.page.js +15 -0
- package/lib/esm/lottoService.js +31 -39
- package/lib/typescript/apis/dhlottery/getWinningNumbers.d.ts +1 -1
- package/lib/typescript/constants/index.d.ts +2 -0
- package/lib/typescript/constants/selectors.d.ts +1 -0
- package/lib/typescript/controllers/playwright/playwright.page.d.ts +1 -0
- package/lib/typescript/controllers/puppeteer/puppeteer.page.d.ts +1 -0
- package/lib/typescript/types.d.ts +15 -8
- package/package.json +1 -1
|
@@ -15,16 +15,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.getWinningNumbers = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const lottoError_1 = __importDefault(require("../../lottoError"));
|
|
18
|
-
const getWinningNumbers = (
|
|
18
|
+
const getWinningNumbers = (round) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
var _a, _b;
|
|
19
20
|
let res;
|
|
20
21
|
try {
|
|
21
|
-
res = yield axios_1.default.get(`https://
|
|
22
|
+
res = yield axios_1.default.get(`https://dhlottery.co.kr/lt645/selectPstLt645Info.do?srchStrLtEpsd=${round}&srchEndLtEpsd=${round}`);
|
|
22
23
|
}
|
|
23
|
-
catch (
|
|
24
|
+
catch (_c) {
|
|
24
25
|
throw lottoError_1.default.NetworkError();
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const item = (_b = (_a = res.data.data) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b[0];
|
|
28
|
+
if (item) {
|
|
29
|
+
return toOrderedWinningNumbers(item);
|
|
28
30
|
}
|
|
29
31
|
else {
|
|
30
32
|
throw lottoError_1.default.InvalidRound();
|
|
@@ -32,5 +34,5 @@ const getWinningNumbers = (volume) => __awaiter(void 0, void 0, void 0, function
|
|
|
32
34
|
});
|
|
33
35
|
exports.getWinningNumbers = getWinningNumbers;
|
|
34
36
|
function toOrderedWinningNumbers(data) {
|
|
35
|
-
return [data.
|
|
37
|
+
return [data.tm1WnNo, data.tm2WnNo, data.tm3WnNo, data.tm4WnNo, data.tm5WnNo, data.tm6WnNo, data.bnsWnNo];
|
|
36
38
|
}
|
|
@@ -8,6 +8,8 @@ exports.CONST = {
|
|
|
8
8
|
BROWSER_DESTROY_SAFE_TIMEOUT: 1000,
|
|
9
9
|
BROWSER_PAGE_POPUP_WAIT: 1500,
|
|
10
10
|
BROWSER_PAGE_DIALOG_WAIT: 10000,
|
|
11
|
+
BROWSER_LOGIN_WAIT: 5000,
|
|
11
12
|
WEEK_TO_MILLISECOND: 604800000,
|
|
12
|
-
THOUSAND_ROUND_DATE: '2022-01-29T11:50:00Z'
|
|
13
|
+
THOUSAND_ROUND_DATE: '2022-01-29T11:50:00Z',
|
|
14
|
+
LOGIN_ERROR_MESSAGE: '아이디 또는 비밀번호가 일치하지 않습니다'
|
|
13
15
|
};
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SELECTORS = void 0;
|
|
4
4
|
exports.SELECTORS = {
|
|
5
|
-
ID_INPUT: '#
|
|
6
|
-
PWD_INPUT: '#
|
|
7
|
-
LOGIN_BUTTON: '#
|
|
5
|
+
ID_INPUT: '#inpUserId',
|
|
6
|
+
PWD_INPUT: '#inpUserPswdEncn',
|
|
7
|
+
LOGIN_BUTTON: '#btnLogin',
|
|
8
|
+
LOGIN_ERROR_POPUP: '.msgPop[role="alertdialog"]',
|
|
8
9
|
ENVIRONMENT_ALERT_CONFIRM: 'input[value="확인"][onclick="javascript:closepopupLayerAlert();"]',
|
|
9
10
|
PURCHASE_TYPE_RANDOM_BTN: 'a[href="#divWay2Buy1"]#num2',
|
|
10
11
|
PURCHASE_AMOUNT_SELECT: 'select#amoundApply',
|
|
11
12
|
PURCHASE_AMOUNT_CONFIRM_BTN: 'input[value="확인"]#btnSelectNum',
|
|
12
|
-
PURCHASE_BTN: '
|
|
13
|
+
PURCHASE_BTN: 'button#btnBuy',
|
|
13
14
|
PURCHASE_CONFIRM_BTN: 'input[value="확인"][onclick="javascript:closepopupLayerConfirm(true);"]',
|
|
14
15
|
PURCHASE_NUMBER_LIST: '#reportRow .nums'
|
|
15
16
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.URLS = void 0;
|
|
4
4
|
exports.URLS = {
|
|
5
|
-
MAIN: 'https://dhlottery.co.kr/
|
|
6
|
-
LOGIN: 'https://dhlottery.co.kr/
|
|
5
|
+
MAIN: 'https://dhlottery.co.kr/main',
|
|
6
|
+
LOGIN: 'https://dhlottery.co.kr/login',
|
|
7
7
|
LOTTO_645: 'https://ol.dhlottery.co.kr/olotto/game/game645.do',
|
|
8
8
|
CHECK_WINNING: 'https://dhlottery.co.kr/qr.do'
|
|
9
9
|
};
|
|
@@ -54,6 +54,16 @@ class PlaywrightPage {
|
|
|
54
54
|
querySelectorAll(selector, callback) {
|
|
55
55
|
return this.page.$$eval(selector, callback);
|
|
56
56
|
}
|
|
57
|
+
exists(selector, containsText) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
if (containsText) {
|
|
60
|
+
const count = yield this.page.locator(selector).filter({ hasText: containsText }).count();
|
|
61
|
+
return count > 0;
|
|
62
|
+
}
|
|
63
|
+
const count = yield this.page.locator(selector).count();
|
|
64
|
+
return count > 0;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
57
67
|
getCookies() {
|
|
58
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
69
|
const cookies = yield this.context.cookies();
|
|
@@ -53,6 +53,21 @@ class PuppeteerPage {
|
|
|
53
53
|
querySelectorAll(selector, callback) {
|
|
54
54
|
return this.page.$$eval(selector, callback);
|
|
55
55
|
}
|
|
56
|
+
exists(selector, containsText) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
if (containsText) {
|
|
59
|
+
const elements = yield this.page.$$(selector);
|
|
60
|
+
for (const el of elements) {
|
|
61
|
+
const text = yield el.evaluate(node => node.textContent);
|
|
62
|
+
if (text === null || text === void 0 ? void 0 : text.includes(containsText))
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
const element = yield this.page.$(selector);
|
|
68
|
+
return element !== null;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
56
71
|
getCookies() {
|
|
57
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
73
|
const cookies = yield this.page.cookies();
|
package/lib/cjs/lottoService.js
CHANGED
|
@@ -17,7 +17,6 @@ const lottoError_1 = __importDefault(require("./lottoError"));
|
|
|
17
17
|
const selectors_1 = require("./constants/selectors");
|
|
18
18
|
const factory_1 = require("./controllers/factory");
|
|
19
19
|
const urls_1 = require("./constants/urls");
|
|
20
|
-
const deferred_1 = require("./utils/deferred");
|
|
21
20
|
const constants_1 = require("./constants");
|
|
22
21
|
const lazyRun_1 = require("./utils/lazyRun");
|
|
23
22
|
const logger_1 = __importDefault(require("./logger"));
|
|
@@ -67,44 +66,37 @@ class LottoService {
|
|
|
67
66
|
if (this.browserController.configs.controller === 'api') {
|
|
68
67
|
throw lottoError_1.default.NotSupported('API mode does not support signIn.');
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// 로그인 시도
|
|
102
|
-
this.logger.debug('[signIn]', 'try login');
|
|
103
|
-
yield page.fill(selectors_1.SELECTORS.ID_INPUT, id);
|
|
104
|
-
yield page.fill(selectors_1.SELECTORS.PWD_INPUT, password);
|
|
105
|
-
yield page.click(selectors_1.SELECTORS.LOGIN_BUTTON);
|
|
106
|
-
}));
|
|
107
|
-
return p.promise;
|
|
69
|
+
// 페이지 이동
|
|
70
|
+
const page = yield this.browserController.focus(0);
|
|
71
|
+
this.logger.debug('[signIn]', 'goto', 'login page');
|
|
72
|
+
yield page.goto(urls_1.URLS.LOGIN);
|
|
73
|
+
this.logger.debug('[signIn]', 'page url', yield page.url());
|
|
74
|
+
// 로그인 시도
|
|
75
|
+
this.logger.debug('[signIn]', 'try login');
|
|
76
|
+
yield page.fill(selectors_1.SELECTORS.ID_INPUT, id);
|
|
77
|
+
yield page.fill(selectors_1.SELECTORS.PWD_INPUT, password);
|
|
78
|
+
yield page.click(selectors_1.SELECTORS.LOGIN_BUTTON);
|
|
79
|
+
// 결과 대기
|
|
80
|
+
yield page.wait(constants_1.CONST.BROWSER_LOGIN_WAIT);
|
|
81
|
+
// 결과 확인
|
|
82
|
+
const currentUrl = yield page.url();
|
|
83
|
+
// 성공: MAIN URL로 이동됨
|
|
84
|
+
if (currentUrl.includes(urls_1.URLS.MAIN)) {
|
|
85
|
+
this.logger.info('[signIn]', 'success');
|
|
86
|
+
this.context.authenticated = true;
|
|
87
|
+
this.logger.debug('[signIn]', 'clear popups');
|
|
88
|
+
yield page.wait(constants_1.CONST.BROWSER_PAGE_POPUP_WAIT);
|
|
89
|
+
yield this.browserController.cleanPages([0]);
|
|
90
|
+
return page.getCookies();
|
|
91
|
+
}
|
|
92
|
+
// 실패: 로그인 에러 팝업 확인
|
|
93
|
+
if (yield page.exists(selectors_1.SELECTORS.LOGIN_ERROR_POPUP, constants_1.CONST.LOGIN_ERROR_MESSAGE)) {
|
|
94
|
+
this.logger.info('[signIn]', 'failed', 'credentials incorrect');
|
|
95
|
+
throw lottoError_1.default.CredentialsIncorrect();
|
|
96
|
+
}
|
|
97
|
+
// 기타 실패
|
|
98
|
+
this.logger.info('[signIn]', 'failed', 'unknown');
|
|
99
|
+
throw lottoError_1.default.CredentialsIncorrect();
|
|
108
100
|
});
|
|
109
101
|
this.purchase = (amount = 5) => __awaiter(this, void 0, void 0, function* () {
|
|
110
102
|
if (this.browserController.configs.controller === 'api') {
|
|
@@ -9,21 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import axios from 'axios';
|
|
11
11
|
import LottoError from '../../lottoError';
|
|
12
|
-
export const getWinningNumbers = (
|
|
12
|
+
export const getWinningNumbers = (round) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
var _a, _b;
|
|
13
14
|
let res;
|
|
14
15
|
try {
|
|
15
|
-
res = yield axios.get(`https://
|
|
16
|
+
res = yield axios.get(`https://dhlottery.co.kr/lt645/selectPstLt645Info.do?srchStrLtEpsd=${round}&srchEndLtEpsd=${round}`);
|
|
16
17
|
}
|
|
17
|
-
catch (
|
|
18
|
+
catch (_c) {
|
|
18
19
|
throw LottoError.NetworkError();
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const item = (_b = (_a = res.data.data) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b[0];
|
|
22
|
+
if (item) {
|
|
23
|
+
return toOrderedWinningNumbers(item);
|
|
22
24
|
}
|
|
23
25
|
else {
|
|
24
26
|
throw LottoError.InvalidRound();
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
29
|
function toOrderedWinningNumbers(data) {
|
|
28
|
-
return [data.
|
|
30
|
+
return [data.tm1WnNo, data.tm2WnNo, data.tm3WnNo, data.tm4WnNo, data.tm5WnNo, data.tm6WnNo, data.bnsWnNo];
|
|
29
31
|
}
|
|
@@ -5,6 +5,8 @@ export const CONST = {
|
|
|
5
5
|
BROWSER_DESTROY_SAFE_TIMEOUT: 1000,
|
|
6
6
|
BROWSER_PAGE_POPUP_WAIT: 1500,
|
|
7
7
|
BROWSER_PAGE_DIALOG_WAIT: 10000,
|
|
8
|
+
BROWSER_LOGIN_WAIT: 5000,
|
|
8
9
|
WEEK_TO_MILLISECOND: 604800000,
|
|
9
|
-
THOUSAND_ROUND_DATE: '2022-01-29T11:50:00Z'
|
|
10
|
+
THOUSAND_ROUND_DATE: '2022-01-29T11:50:00Z',
|
|
11
|
+
LOGIN_ERROR_MESSAGE: '아이디 또는 비밀번호가 일치하지 않습니다'
|
|
10
12
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export const SELECTORS = {
|
|
2
|
-
ID_INPUT: '#
|
|
3
|
-
PWD_INPUT: '#
|
|
4
|
-
LOGIN_BUTTON: '#
|
|
2
|
+
ID_INPUT: '#inpUserId',
|
|
3
|
+
PWD_INPUT: '#inpUserPswdEncn',
|
|
4
|
+
LOGIN_BUTTON: '#btnLogin',
|
|
5
|
+
LOGIN_ERROR_POPUP: '.msgPop[role="alertdialog"]',
|
|
5
6
|
ENVIRONMENT_ALERT_CONFIRM: 'input[value="확인"][onclick="javascript:closepopupLayerAlert();"]',
|
|
6
7
|
PURCHASE_TYPE_RANDOM_BTN: 'a[href="#divWay2Buy1"]#num2',
|
|
7
8
|
PURCHASE_AMOUNT_SELECT: 'select#amoundApply',
|
|
8
9
|
PURCHASE_AMOUNT_CONFIRM_BTN: 'input[value="확인"]#btnSelectNum',
|
|
9
|
-
PURCHASE_BTN: '
|
|
10
|
+
PURCHASE_BTN: 'button#btnBuy',
|
|
10
11
|
PURCHASE_CONFIRM_BTN: 'input[value="확인"][onclick="javascript:closepopupLayerConfirm(true);"]',
|
|
11
12
|
PURCHASE_NUMBER_LIST: '#reportRow .nums'
|
|
12
13
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const URLS = {
|
|
2
|
-
MAIN: 'https://dhlottery.co.kr/
|
|
3
|
-
LOGIN: 'https://dhlottery.co.kr/
|
|
2
|
+
MAIN: 'https://dhlottery.co.kr/main',
|
|
3
|
+
LOGIN: 'https://dhlottery.co.kr/login',
|
|
4
4
|
LOTTO_645: 'https://ol.dhlottery.co.kr/olotto/game/game645.do',
|
|
5
5
|
CHECK_WINNING: 'https://dhlottery.co.kr/qr.do'
|
|
6
6
|
};
|
|
@@ -51,6 +51,16 @@ export class PlaywrightPage {
|
|
|
51
51
|
querySelectorAll(selector, callback) {
|
|
52
52
|
return this.page.$$eval(selector, callback);
|
|
53
53
|
}
|
|
54
|
+
exists(selector, containsText) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
if (containsText) {
|
|
57
|
+
const count = yield this.page.locator(selector).filter({ hasText: containsText }).count();
|
|
58
|
+
return count > 0;
|
|
59
|
+
}
|
|
60
|
+
const count = yield this.page.locator(selector).count();
|
|
61
|
+
return count > 0;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
54
64
|
getCookies() {
|
|
55
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
66
|
const cookies = yield this.context.cookies();
|
|
@@ -50,6 +50,21 @@ export class PuppeteerPage {
|
|
|
50
50
|
querySelectorAll(selector, callback) {
|
|
51
51
|
return this.page.$$eval(selector, callback);
|
|
52
52
|
}
|
|
53
|
+
exists(selector, containsText) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (containsText) {
|
|
56
|
+
const elements = yield this.page.$$(selector);
|
|
57
|
+
for (const el of elements) {
|
|
58
|
+
const text = yield el.evaluate(node => node.textContent);
|
|
59
|
+
if (text === null || text === void 0 ? void 0 : text.includes(containsText))
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const element = yield this.page.$(selector);
|
|
65
|
+
return element !== null;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
53
68
|
getCookies() {
|
|
54
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
70
|
const cookies = yield this.page.cookies();
|
package/lib/esm/lottoService.js
CHANGED
|
@@ -11,7 +11,6 @@ import LottoError from './lottoError';
|
|
|
11
11
|
import { SELECTORS } from './constants/selectors';
|
|
12
12
|
import { createBrowserController } from './controllers/factory';
|
|
13
13
|
import { URLS } from './constants/urls';
|
|
14
|
-
import { deferred } from './utils/deferred';
|
|
15
14
|
import { CONST } from './constants';
|
|
16
15
|
import { lazyRun } from './utils/lazyRun';
|
|
17
16
|
import Logger, {} from './logger';
|
|
@@ -61,44 +60,37 @@ export class LottoService {
|
|
|
61
60
|
if (this.browserController.configs.controller === 'api') {
|
|
62
61
|
throw LottoError.NotSupported('API mode does not support signIn.');
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// 로그인 시도
|
|
96
|
-
this.logger.debug('[signIn]', 'try login');
|
|
97
|
-
yield page.fill(SELECTORS.ID_INPUT, id);
|
|
98
|
-
yield page.fill(SELECTORS.PWD_INPUT, password);
|
|
99
|
-
yield page.click(SELECTORS.LOGIN_BUTTON);
|
|
100
|
-
}));
|
|
101
|
-
return p.promise;
|
|
63
|
+
// 페이지 이동
|
|
64
|
+
const page = yield this.browserController.focus(0);
|
|
65
|
+
this.logger.debug('[signIn]', 'goto', 'login page');
|
|
66
|
+
yield page.goto(URLS.LOGIN);
|
|
67
|
+
this.logger.debug('[signIn]', 'page url', yield page.url());
|
|
68
|
+
// 로그인 시도
|
|
69
|
+
this.logger.debug('[signIn]', 'try login');
|
|
70
|
+
yield page.fill(SELECTORS.ID_INPUT, id);
|
|
71
|
+
yield page.fill(SELECTORS.PWD_INPUT, password);
|
|
72
|
+
yield page.click(SELECTORS.LOGIN_BUTTON);
|
|
73
|
+
// 결과 대기
|
|
74
|
+
yield page.wait(CONST.BROWSER_LOGIN_WAIT);
|
|
75
|
+
// 결과 확인
|
|
76
|
+
const currentUrl = yield page.url();
|
|
77
|
+
// 성공: MAIN URL로 이동됨
|
|
78
|
+
if (currentUrl.includes(URLS.MAIN)) {
|
|
79
|
+
this.logger.info('[signIn]', 'success');
|
|
80
|
+
this.context.authenticated = true;
|
|
81
|
+
this.logger.debug('[signIn]', 'clear popups');
|
|
82
|
+
yield page.wait(CONST.BROWSER_PAGE_POPUP_WAIT);
|
|
83
|
+
yield this.browserController.cleanPages([0]);
|
|
84
|
+
return page.getCookies();
|
|
85
|
+
}
|
|
86
|
+
// 실패: 로그인 에러 팝업 확인
|
|
87
|
+
if (yield page.exists(SELECTORS.LOGIN_ERROR_POPUP, CONST.LOGIN_ERROR_MESSAGE)) {
|
|
88
|
+
this.logger.info('[signIn]', 'failed', 'credentials incorrect');
|
|
89
|
+
throw LottoError.CredentialsIncorrect();
|
|
90
|
+
}
|
|
91
|
+
// 기타 실패
|
|
92
|
+
this.logger.info('[signIn]', 'failed', 'unknown');
|
|
93
|
+
throw LottoError.CredentialsIncorrect();
|
|
102
94
|
});
|
|
103
95
|
this.purchase = (amount = 5) => __awaiter(this, void 0, void 0, function* () {
|
|
104
96
|
if (this.browserController.configs.controller === 'api') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getWinningNumbers: (
|
|
1
|
+
export declare const getWinningNumbers: (round: number) => Promise<number[]>;
|
|
@@ -5,6 +5,8 @@ export declare const CONST: {
|
|
|
5
5
|
BROWSER_DESTROY_SAFE_TIMEOUT: number;
|
|
6
6
|
BROWSER_PAGE_POPUP_WAIT: number;
|
|
7
7
|
BROWSER_PAGE_DIALOG_WAIT: number;
|
|
8
|
+
BROWSER_LOGIN_WAIT: number;
|
|
8
9
|
WEEK_TO_MILLISECOND: number;
|
|
9
10
|
THOUSAND_ROUND_DATE: string;
|
|
11
|
+
LOGIN_ERROR_MESSAGE: string;
|
|
10
12
|
};
|
|
@@ -13,6 +13,7 @@ export declare class PlaywrightPage implements BrowserPageInterface {
|
|
|
13
13
|
click(selector: string, domDirect?: boolean): Promise<void>;
|
|
14
14
|
select(selector: string, value: string): Promise<void>;
|
|
15
15
|
querySelectorAll<T>(selector: string, callback: (elems: FakeDOMElement[]) => T): Promise<T>;
|
|
16
|
+
exists(selector: string, containsText?: string): Promise<boolean>;
|
|
16
17
|
getCookies(): Promise<string>;
|
|
17
18
|
setCookies(cookies: StringifiedCookies): Promise<void>;
|
|
18
19
|
wait(param: 'idle' | 'load' | number): Promise<void>;
|
|
@@ -11,6 +11,7 @@ export declare class PuppeteerPage implements BrowserPageInterface {
|
|
|
11
11
|
click(selector: string, domDirect?: boolean): Promise<void>;
|
|
12
12
|
select(selector: string, value: string): Promise<void>;
|
|
13
13
|
querySelectorAll<T>(selector: string, callback: (elems: FakeDOMElement[]) => T): Promise<T>;
|
|
14
|
+
exists(selector: string, containsText?: string): Promise<boolean>;
|
|
14
15
|
getCookies(): Promise<string>;
|
|
15
16
|
setCookies(cookies: StringifiedCookies): Promise<void>;
|
|
16
17
|
wait(param: 'idle' | 'load' | number): Promise<void>;
|
|
@@ -37,6 +37,7 @@ export interface BrowserPageInterface {
|
|
|
37
37
|
click(selector: string, domDirect?: boolean): Promise<void>;
|
|
38
38
|
select(selector: string, value: string): Promise<void>;
|
|
39
39
|
querySelectorAll<T>(selector: string, callback: (elems: FakeDOMElement[]) => T): Promise<T>;
|
|
40
|
+
exists(selector: string, containsText?: string): Promise<boolean>;
|
|
40
41
|
wait(time: number): Promise<void>;
|
|
41
42
|
wait(type: 'load'): Promise<void>;
|
|
42
43
|
wait(type: 'idle'): Promise<void>;
|
|
@@ -53,14 +54,20 @@ export type BrowserPageEvents = 'response';
|
|
|
53
54
|
export type Unsubscribe = () => void;
|
|
54
55
|
export type StringifiedCookies = string;
|
|
55
56
|
export type GetWinningNumbersResponse = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
resultCode: string | null;
|
|
58
|
+
resultMessage: string | null;
|
|
59
|
+
data: {
|
|
60
|
+
list: Array<{
|
|
61
|
+
ltEpsd: number;
|
|
62
|
+
tm1WnNo: number;
|
|
63
|
+
tm2WnNo: number;
|
|
64
|
+
tm3WnNo: number;
|
|
65
|
+
tm4WnNo: number;
|
|
66
|
+
tm5WnNo: number;
|
|
67
|
+
tm6WnNo: number;
|
|
68
|
+
bnsWnNo: number;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
64
71
|
};
|
|
65
72
|
declare global {
|
|
66
73
|
namespace NodeJS {
|