beatsaber-bot-core 0.2.0-dev.6 → 0.2.0-dev.8
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/api/base/blRequset.js +7 -7
- package/lib/api/base/blRequset.js.map +1 -1
- package/lib/api/interfaces/beatsaver/ws.d.ts +8 -2
- package/lib/cmd/bind/bind-beatleader.js.map +1 -1
- package/lib/cmd/bind/bind-beatsaver.js.map +1 -1
- package/lib/cmd/bind/bind-id-beatleader.js.map +1 -1
- package/lib/cmd/bind/bind-scoresaber.js.map +1 -1
- package/lib/cmd/bind/index.d.ts +2 -2
- package/lib/cmd/bsmap/id-search.d.ts +1 -1
- package/lib/cmd/bsmap/id-search.js +1 -1
- package/lib/cmd/bsmap/id-search.js.map +1 -1
- package/lib/cmd/bsmap/key-search.d.ts +1 -1
- package/lib/cmd/bsmap/latest.d.ts +1 -1
- package/lib/cmd/builder.d.ts +2 -2
- package/lib/cmd/builder.js +20 -1
- package/lib/cmd/builder.js.map +1 -1
- package/lib/cmd/deprecated/cmp.d.ts +1 -1
- package/lib/cmd/deprecated/me.d.ts +2 -2
- package/lib/cmd/deprecated/tmp.d.ts +1 -1
- package/lib/cmd/deprecated/whois.d.ts +2 -2
- package/lib/cmd/help.d.ts +1 -1
- package/lib/cmd/rank.d.ts +2 -2
- package/lib/cmd/rank.js +4 -2
- package/lib/cmd/rank.js.map +1 -1
- package/lib/cmd/score.d.ts +2 -2
- package/lib/cmd/subscribe/index.d.ts +2 -2
- package/lib/cmd/subscribe/subjoin.d.ts +2 -2
- package/lib/cmd/subscribe/subleave.d.ts +2 -2
- package/lib/cmd/subscribe/unsubscribe.d.ts +2 -2
- package/lib/db/index.d.ts +0 -34
- package/lib/db/index.js +0 -2
- package/lib/errors/index.d.ts +25 -41
- package/lib/errors/index.js +54 -59
- package/lib/errors/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interface/bot.d.ts +1 -1
- package/lib/interface/{db.d.ts → db/index.d.ts} +2 -1
- package/lib/interface/db/index.js +18 -0
- package/lib/interface/db/index.js.map +1 -0
- package/lib/interface/db/models.d.ts +34 -0
- package/lib/interface/{db.js → db/models.js} +1 -1
- package/lib/interface/db/models.js.map +1 -0
- package/lib/interface/index.d.ts +0 -1
- package/lib/interface/index.js +0 -1
- package/lib/interface/index.js.map +1 -1
- package/lib/schedules/index.d.ts +3 -2
- package/lib/schedules/index.js +13 -16
- package/lib/schedules/index.js.map +1 -1
- package/lib/schedules/interface.d.ts +17 -0
- package/lib/schedules/interface.js +3 -0
- package/lib/schedules/interface.js.map +1 -0
- package/lib/schedules/oauthTokenRefreshTask.d.ts +2 -5
- package/lib/schedules/oauthTokenRefreshTask.js +9 -9
- package/lib/schedules/oauthTokenRefreshTask.js.map +1 -1
- package/lib/utils/cache.d.ts +2 -0
- package/lib/utils/cache.js +30 -0
- package/lib/utils/cache.js.map +1 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +77 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/ws/beatsaver.d.ts +6 -1
- package/lib/ws/beatsaver.js +28 -29
- package/lib/ws/beatsaver.js.map +1 -1
- package/package.json +2 -1
- package/lib/interface/db.js.map +0 -1
- package/lib/interface/tables.d.ts +0 -0
- package/lib/interface/tables.js +0 -1
- package/lib/interface/tables.js.map +0 -1
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +0 -25
- package/lib/utils.js.map +0 -1
package/lib/errors/index.js
CHANGED
@@ -1,112 +1,107 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SubscriptionNotExistError = exports.NoneSubscriptionExistError = exports.SubscriptionExistError = exports.SessionPromotionCancelError = exports.SessionPromotionTimeoutError = exports.ScoreSaberIDNotFoundError = exports.
|
4
|
-
class
|
3
|
+
exports.SubscriptionNotExistError = exports.NoneSubscriptionExistError = exports.SubscriptionExistError = exports.SessionPromotionCancelError = exports.SessionPromotionTimeoutError = exports.ScoreSaberIDNotFoundError = exports.MapIdNotFoundError = exports.InvalidMapIdError = exports.AccountBindingNotFoundError = exports.ScoreNotFoundError = exports.BizError = exports.UnexpectedError = void 0;
|
4
|
+
class UnexpectedError extends Error {
|
5
|
+
constructor() {
|
6
|
+
super('UnexpectedError');
|
7
|
+
}
|
8
|
+
}
|
9
|
+
exports.UnexpectedError = UnexpectedError;
|
10
|
+
class BizError extends Error {
|
5
11
|
id;
|
6
12
|
params;
|
7
|
-
|
8
|
-
|
13
|
+
}
|
14
|
+
exports.BizError = BizError;
|
15
|
+
class ScoreNotFoundError extends BizError {
|
16
|
+
constructor(params) {
|
17
|
+
super('ScoreNotFoundError');
|
9
18
|
this.name = 'ScoreNotFoundError';
|
10
19
|
this.id = 'commands.bsbot.me.score-not-found';
|
20
|
+
this.params = params;
|
11
21
|
}
|
12
22
|
}
|
13
23
|
exports.ScoreNotFoundError = ScoreNotFoundError;
|
14
|
-
class AccountBindingNotFoundError extends
|
15
|
-
|
16
|
-
|
17
|
-
constructor(message) {
|
18
|
-
super(message);
|
24
|
+
class AccountBindingNotFoundError extends BizError {
|
25
|
+
constructor(params) {
|
26
|
+
super('AccountBindingNotFoundError');
|
19
27
|
this.name = 'AccountBindingNotFoundError';
|
20
28
|
this.id = 'commands.bsbot.score.not-bind';
|
29
|
+
this.params = params;
|
21
30
|
}
|
22
31
|
}
|
23
32
|
exports.AccountBindingNotFoundError = AccountBindingNotFoundError;
|
24
|
-
class InvalidMapIdError extends
|
25
|
-
|
26
|
-
|
27
|
-
constructor(message) {
|
28
|
-
super(message);
|
33
|
+
class InvalidMapIdError extends BizError {
|
34
|
+
constructor(params) {
|
35
|
+
super('InvalidMapIdError');
|
29
36
|
this.name = 'InvalidMapIdError';
|
30
37
|
this.id = 'commands.bsbot.id.error-map-id';
|
38
|
+
this.params = params;
|
31
39
|
}
|
32
40
|
}
|
33
41
|
exports.InvalidMapIdError = InvalidMapIdError;
|
34
|
-
class MapIdNotFoundError extends
|
35
|
-
|
36
|
-
|
37
|
-
constructor(message) {
|
38
|
-
super(message);
|
42
|
+
class MapIdNotFoundError extends BizError {
|
43
|
+
constructor(params) {
|
44
|
+
super('MapIdNotFoundError');
|
39
45
|
this.name = 'MapIdNotFoundError';
|
40
46
|
this.id = 'commands.bsbot.id.not-found';
|
47
|
+
this.params = params;
|
41
48
|
}
|
42
49
|
}
|
43
50
|
exports.MapIdNotFoundError = MapIdNotFoundError;
|
44
|
-
class
|
45
|
-
|
46
|
-
|
47
|
-
constructor(message) {
|
48
|
-
super(message);
|
49
|
-
this.name = 'NetworkError';
|
50
|
-
this.id = 'commands.bsbot.id.not-found';
|
51
|
-
}
|
52
|
-
}
|
53
|
-
exports.NetworkError = NetworkError;
|
54
|
-
class ScoreSaberIDNotFoundError extends Error {
|
55
|
-
id;
|
56
|
-
params;
|
57
|
-
constructor(input) {
|
58
|
-
super();
|
51
|
+
class ScoreSaberIDNotFoundError extends BizError {
|
52
|
+
constructor(params) {
|
53
|
+
super('ScoreSaberIdNotFoundError');
|
59
54
|
this.name = 'ScoreSaberIdNotFoundError';
|
60
55
|
this.id = 'commands.bsbot.bind.not-found';
|
61
|
-
this.params =
|
56
|
+
this.params = params;
|
57
|
+
this.params = params;
|
62
58
|
}
|
63
59
|
}
|
64
60
|
exports.ScoreSaberIDNotFoundError = ScoreSaberIDNotFoundError;
|
65
|
-
class SessionPromotionTimeoutError extends
|
66
|
-
|
67
|
-
|
68
|
-
super();
|
61
|
+
class SessionPromotionTimeoutError extends BizError {
|
62
|
+
constructor(params) {
|
63
|
+
super('SessionPromotionTimeoutError');
|
69
64
|
this.name = 'SessionPromotionTimeoutError';
|
70
65
|
this.id = 'commands.bsbot.session-promotion-timeout';
|
66
|
+
this.params = params;
|
71
67
|
}
|
72
68
|
}
|
73
69
|
exports.SessionPromotionTimeoutError = SessionPromotionTimeoutError;
|
74
|
-
class SessionPromotionCancelError extends
|
75
|
-
|
76
|
-
|
77
|
-
super();
|
78
|
-
this.name =
|
70
|
+
class SessionPromotionCancelError extends BizError {
|
71
|
+
constructor(params) {
|
72
|
+
const name = 'SessionPromotionCancelError';
|
73
|
+
super(name);
|
74
|
+
this.name = name;
|
79
75
|
this.id = 'commands.bsbot.bind.cancel';
|
76
|
+
this.params = params;
|
80
77
|
}
|
81
78
|
}
|
82
79
|
exports.SessionPromotionCancelError = SessionPromotionCancelError;
|
83
|
-
class SubscriptionExistError extends
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
super(message);
|
80
|
+
class SubscriptionExistError extends BizError {
|
81
|
+
constructor(params) {
|
82
|
+
super('SubscriptionExistError');
|
83
|
+
this.params = params;
|
88
84
|
this.name = 'SubscriptionExistError';
|
89
85
|
this.id = 'commands.bsbot.subscribe.exist';
|
86
|
+
this.params = params;
|
90
87
|
}
|
91
88
|
}
|
92
89
|
exports.SubscriptionExistError = SubscriptionExistError;
|
93
|
-
class NoneSubscriptionExistError extends
|
94
|
-
|
95
|
-
|
96
|
-
constructor(message) {
|
97
|
-
super(message);
|
90
|
+
class NoneSubscriptionExistError extends BizError {
|
91
|
+
constructor(params) {
|
92
|
+
super('NoneSubscriptionExistError');
|
98
93
|
this.name = 'NoneSubscriptionExistError';
|
99
94
|
this.id = 'commands.bsbot.subscribe.info.none';
|
95
|
+
this.params = params;
|
100
96
|
}
|
101
97
|
}
|
102
98
|
exports.NoneSubscriptionExistError = NoneSubscriptionExistError;
|
103
|
-
class SubscriptionNotExistError extends
|
104
|
-
|
105
|
-
|
106
|
-
constructor(message) {
|
107
|
-
super(message);
|
99
|
+
class SubscriptionNotExistError extends BizError {
|
100
|
+
constructor(params) {
|
101
|
+
super('SubscriptionNotExistError');
|
108
102
|
this.name = 'SubscriptionNotExistError';
|
109
103
|
this.id = 'commands.bsbot.unsubscribe.nosub';
|
104
|
+
this.params = params;
|
110
105
|
}
|
111
106
|
}
|
112
107
|
exports.SubscriptionNotExistError = SubscriptionNotExistError;
|
package/lib/errors/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,MAAa,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;IACxC;QACE,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAC1B,CAAC;CACF;AAJD,0CAIC;AAED,MAAa,QAAS,SAAQ,KAAK;IACjC,EAAE,CAAQ;IACV,MAAM,CAAM;CACb;AAHD,4BAGC;AAED,MAAa,kBAAmB,SAAQ,QAAQ;IAC9C,YAAY,MAAY;QACtB,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,EAAE,GAAG,mCAAmC,CAAA;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAPD,gDAOC;AAED,MAAa,2BAA4B,SAAQ,QAAQ;IACvD,YAAY,MAAY;QACtB,KAAK,CAAC,6BAA6B,CAAC,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;QACzC,IAAI,CAAC,EAAE,GAAG,+BAA+B,CAAA;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAPD,kEAOC;AAED,MAAa,iBAAkB,SAAQ,QAAQ;IAC7C,YAAY,MAAY;QACtB,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;QAC/B,IAAI,CAAC,EAAE,GAAG,gCAAgC,CAAA;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAPD,8CAOC;AAED,MAAa,kBAAmB,SAAQ,QAAQ;IAC9C,YAAY,MAAY;QACtB,KAAK,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C,CAAA;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AARD,wDAQC;AACD,MAAa,0BAA2B,SAAQ,QAAQ;IACtD,YAAY,MAAY;QACtB,KAAK,CAAC,4BAA4B,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;QACxC,IAAI,CAAC,EAAE,GAAG,oCAAoC,CAAA;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAPD,gEAOC;AAED,MAAa,yBAA0B,SAAQ,QAAQ;IACrD,YAAY,MAAY;QACtB,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;QACvC,IAAI,CAAC,EAAE,GAAG,kCAAkC,CAAA;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAPD,8DAOC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -15,11 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./interface"), exports);
|
18
|
-
__exportStar(require("./db"), exports);
|
19
18
|
__exportStar(require("./api"), exports);
|
20
19
|
__exportStar(require("./schedules"), exports);
|
21
20
|
__exportStar(require("./config"), exports);
|
22
21
|
__exportStar(require("./i18n"), exports);
|
23
22
|
__exportStar(require("./cmd"), exports);
|
24
23
|
__exportStar(require("./ws"), exports);
|
24
|
+
__exportStar(require("./utils"), exports);
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,wCAAqB;AACrB,8CAA2B;AAC3B,2CAAwB;AACxB,yCAAsB;AACtB,wCAAqB;AACrB,uCAAoB;AACpB,0CAAuB"}
|
package/lib/interface/bot.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import { RelateAccount, RelateChannelInfo, Subscribe, SubscribeMember } from '
|
1
|
+
import { RelateAccount, RelateChannelInfo, Subscribe, SubscribeMember } from './models';
|
2
|
+
export * from './models';
|
2
3
|
export interface SubInfoRes {
|
3
4
|
subscribe: Subscribe;
|
4
5
|
memberCount: number;
|
@@ -0,0 +1,18 @@
|
|
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
|
+
__exportStar(require("./models"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interface/db/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAOA,2CAAwB"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
export interface RelateAccount {
|
2
|
+
id: number;
|
3
|
+
uid: number;
|
4
|
+
type: string;
|
5
|
+
platform: string;
|
6
|
+
platformUname: string;
|
7
|
+
platformUid: string;
|
8
|
+
platformScope: string;
|
9
|
+
accessToken: string;
|
10
|
+
refreshToken: string;
|
11
|
+
otherPlatformInfo: any;
|
12
|
+
lastModifiedAt: Date;
|
13
|
+
lastRefreshAt: Date;
|
14
|
+
status: string;
|
15
|
+
}
|
16
|
+
export interface SubscribeMember {
|
17
|
+
subscribeId: number;
|
18
|
+
memberUid: number;
|
19
|
+
subscribeData: any;
|
20
|
+
joinedAt: Date;
|
21
|
+
}
|
22
|
+
export interface Subscribe {
|
23
|
+
id: number;
|
24
|
+
gid: number;
|
25
|
+
type: string;
|
26
|
+
time: Date;
|
27
|
+
enable: boolean;
|
28
|
+
data: any;
|
29
|
+
}
|
30
|
+
export type RelateChannelInfo<CHANNEL> = {
|
31
|
+
id: number;
|
32
|
+
name: string;
|
33
|
+
type: 'user' | 'group' | string;
|
34
|
+
} & CHANNEL;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/interface/db/models.ts"],"names":[],"mappings":""}
|
package/lib/interface/index.d.ts
CHANGED
package/lib/interface/index.js
CHANGED
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
exports.ImgRenderMode = exports.Platform = void 0;
|
18
18
|
__exportStar(require("./db"), exports);
|
19
|
-
__exportStar(require("./db"), exports);
|
20
19
|
__exportStar(require("./logger"), exports);
|
21
20
|
__exportStar(require("./cmd"), exports);
|
22
21
|
__exportStar(require("./render"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAoB;AACpB,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAoB;AACpB,2CAAwB;AACxB,wCAAqB;AACrB,2CAAwB;AACxB,wCAAqB;AACrB,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,4BAAgB,CAAA;IAChB,6BAAiB,CAAA;AACnB,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,kCAAiB,CAAA;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"}
|
package/lib/schedules/index.d.ts
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { ScheduleTask } from '../schedules/interface';
|
2
|
+
import { Config } from '../config';
|
3
|
+
export declare const getScheduleTasks: (config: Config) => ScheduleTask[];
|
package/lib/schedules/index.js
CHANGED
@@ -1,19 +1,16 @@
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
|
18
|
-
|
3
|
+
exports.getScheduleTasks = void 0;
|
4
|
+
const oauthTokenRefreshTask_1 = require("./oauthTokenRefreshTask");
|
5
|
+
const oauthTokenRefreshTask = {
|
6
|
+
name: 'oauthTokenRefreshTask',
|
7
|
+
// config
|
8
|
+
cron: '',
|
9
|
+
executor: oauthTokenRefreshTask_1.tokenRefreshTask,
|
10
|
+
};
|
11
|
+
const getScheduleTasks = (config) => {
|
12
|
+
// oauthTokenRefreshTask
|
13
|
+
return [];
|
14
|
+
};
|
15
|
+
exports.getScheduleTasks = getScheduleTasks;
|
19
16
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schedules/index.ts"],"names":[],"mappings":";;;AAAA,mEAA0D;AAI1D,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,uBAAuB;IAC7B,SAAS;IACT,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE,wCAAgB;CAC3B,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,EAAE;IACjD,wBAAwB;IACxB,OAAO,EAAoB,CAAA;AAC7B,CAAC,CAAA;AAHY,QAAA,gBAAgB,oBAG5B"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Config } from '../config';
|
2
|
+
import { BotService, DB, Logger, Session } from '../interface';
|
3
|
+
import { RenderService } from '../img-render';
|
4
|
+
import { APIService } from '../api';
|
5
|
+
export type ScheduleTaskCtx<T> = {
|
6
|
+
config: Config;
|
7
|
+
db: DB<T>;
|
8
|
+
render: RenderService;
|
9
|
+
api: APIService;
|
10
|
+
logger: Logger;
|
11
|
+
botService: BotService<T, Session<T>>;
|
12
|
+
};
|
13
|
+
export type ScheduleTask = {
|
14
|
+
name: string;
|
15
|
+
cron: string;
|
16
|
+
executor: <T>(c: ScheduleTaskCtx<T>) => Promise<void>;
|
17
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/schedules/interface.ts"],"names":[],"mappings":""}
|
@@ -1,5 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import { RenderService } from '../img-render';
|
4
|
-
import { APIService } from '../api';
|
5
|
-
export declare const tokenRefreshTask: <T>(config: Config, db: DB<T>, render: RenderService, api: APIService, logger: Logger, botService: BotService<T, Session<T>>) => Promise<void>;
|
1
|
+
import { ScheduleTaskCtx } from './interface';
|
2
|
+
export declare const tokenRefreshTask: <T>(c: ScheduleTaskCtx<T>) => Promise<void>;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.tokenRefreshTask = void 0;
|
4
|
-
const tokenRefreshTask = async (
|
5
|
-
logger.info('start token refresh task');
|
4
|
+
const tokenRefreshTask = async (c) => {
|
5
|
+
c.logger.info('start token refresh task');
|
6
6
|
// getAllOauthToken
|
7
7
|
const accounts = [];
|
8
8
|
// await db.getAllOAuthTokenNeedRefresh()
|
@@ -11,12 +11,12 @@ const tokenRefreshTask = async (config, db, render, api, logger, botService) =>
|
|
11
11
|
// type: 'oauth',
|
12
12
|
// })
|
13
13
|
for (const account of accounts) {
|
14
|
-
logger.info(`try to refresh ${account.platform} ${account.platformUid}'s token`);
|
14
|
+
c.logger.info(`try to refresh ${account.platform} ${account.platformUid}'s token`);
|
15
15
|
const now = new Date();
|
16
16
|
if (account.platform === 'beatleader') {
|
17
|
-
const token = await api.BeatLeader.wrapperResult().refreshOAuthToken(account.refreshToken);
|
17
|
+
const token = await c.api.BeatLeader.wrapperResult().refreshOAuthToken(account.refreshToken);
|
18
18
|
if (!token.isSuccess()) {
|
19
|
-
logger.info(`failed to refresh ${account.platform} token, invalid this account, ${JSON.stringify(account)}`);
|
19
|
+
c.logger.info(`failed to refresh ${account.platform} token, invalid this account, ${JSON.stringify(account)}`);
|
20
20
|
account.valid = 'invalid';
|
21
21
|
account.lastModifiedAt = now;
|
22
22
|
// await ctx.database.upsert('BSRelateOAuthAccount', [account])
|
@@ -28,9 +28,9 @@ const tokenRefreshTask = async (config, db, render, api, logger, botService) =>
|
|
28
28
|
account.refreshToken = token.data.refresh_token;
|
29
29
|
}
|
30
30
|
else if (account.platform === 'beatsaver') {
|
31
|
-
const token = await api.BeatSaver.wrapperResult().refreshOAuthToken(account.refreshToken);
|
31
|
+
const token = await c.api.BeatSaver.wrapperResult().refreshOAuthToken(account.refreshToken);
|
32
32
|
if (!token.isSuccess()) {
|
33
|
-
logger.info(`failed to refresh ${account.platform} token, invalid this account, ${JSON.stringify(account)}`);
|
33
|
+
c.logger.info(`failed to refresh ${account.platform} token, invalid this account, ${JSON.stringify(account)}`);
|
34
34
|
account.valid = 'invalid';
|
35
35
|
account.lastModifiedAt = now;
|
36
36
|
// await ctx.database.upsert('BSRelateOAuthAccount', [account])
|
@@ -45,9 +45,9 @@ const tokenRefreshTask = async (config, db, render, api, logger, botService) =>
|
|
45
45
|
account.lastModifiedAt = now;
|
46
46
|
//
|
47
47
|
// await ctx.database.upsert('BSRelateOAuthAccount', [account])
|
48
|
-
logger.info(`refresh ${account.platform} token successfully ${account.platformUid}`);
|
48
|
+
c.logger.info(`refresh ${account.platform} token successfully ${account.platformUid}`);
|
49
49
|
}
|
50
|
-
logger.info(`token refresh task finished`);
|
50
|
+
c.logger.info(`token refresh task finished`);
|
51
51
|
};
|
52
52
|
exports.tokenRefreshTask = tokenRefreshTask;
|
53
53
|
//# sourceMappingURL=oauthTokenRefreshTask.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauthTokenRefreshTask.js","sourceRoot":"","sources":["../../src/schedules/oauthTokenRefreshTask.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"oauthTokenRefreshTask.js","sourceRoot":"","sources":["../../src/schedules/oauthTokenRefreshTask.ts"],"names":[],"mappings":";;;AAEO,MAAM,gBAAgB,GAAG,KAAK,EAAK,CAAqB,EAAE,EAAE;IACjE,C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ACrB,CAAA;YACD,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;gBACvB,CAAC,CAAC,MAAM,CAAC,IAAI,CACX,qBAAqB,OAAO,CAAC,QAAQ,iCAAiC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAChG,CAAA;gBACD,OAAO,CAAC,KAAK,GAAG,SAAS,CAAA;gBACzB,OAAO,CAAC,cAAc,GAAG,GAAG,CAAA;gBAC5B,+DAA+D;gBAC/D,sCAAsC;gBACtC,sFAAsF;gBACtF,SAAQ;YACV,CAAC;YACD,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAA;YAC7C,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAA;QACjD,CAAC;QACD,OAAO,CAAC,aAAa,GAAG,GAAG,CAAA;QAC3B,OAAO,CAAC,cAAc,GAAG,GAAG,CAAA;QAC5B,EAAE;QACF,+DAA+D;QAC/D,CAAC,CAAC,MAAM,CAAC,IAAI,CACX,WAAW,OAAO,CAAC,QAAQ,uBAAuB,OAAO,CAAC,WAAW,EAAE,CACxE,CAAA;IACH,CAAC;IACD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA;AAC9C,CAAC,CAAA;AA1DY,QAAA,gBAAgB,oBA0D5B"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.cache = void 0;
|
4
|
+
const lru_cache_1 = require("lru-cache");
|
5
|
+
const options = {
|
6
|
+
max: 500,
|
7
|
+
// for use with tracking overall storage size
|
8
|
+
maxSize: 5000,
|
9
|
+
// sizeCalculation: (value, key) => {
|
10
|
+
// return 1
|
11
|
+
// },
|
12
|
+
// for use when you need to clean up something when objects
|
13
|
+
// are evicted from the cache
|
14
|
+
// dispose: (value, key) => {},
|
15
|
+
// how long to live in ms
|
16
|
+
ttl: 1000 * 60 * 5,
|
17
|
+
// return stale items before removing from cache?
|
18
|
+
allowStale: false,
|
19
|
+
updateAgeOnGet: true,
|
20
|
+
updateAgeOnHas: true,
|
21
|
+
// // async method to use for cache.fetch(), for
|
22
|
+
// // stale-while-revalidate type of behavior
|
23
|
+
// fetchMethod: async (
|
24
|
+
// key,
|
25
|
+
// staleValue,
|
26
|
+
// { options, signal, context }
|
27
|
+
// ) => {},
|
28
|
+
};
|
29
|
+
exports.cache = new lru_cache_1.LRUCache(options);
|
30
|
+
//# sourceMappingURL=cache.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,GAAG;IAER,6CAA6C;IAC7C,OAAO,EAAE,IAAI;IACb,qCAAqC;IACrC,aAAa;IACb,KAAK;IAEL,2DAA2D;IAC3D,6BAA6B;IAC7B,+BAA+B;IAE/B,yBAAyB;IACzB,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC;IAElB,iDAAiD;IAEjD,UAAU,EAAE,KAAK;IAEjB,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,IAAI;IAEpB,gDAAgD;IAChD,6CAA6C;IAC7C,uBAAuB;IACvB,SAAS;IACT,gBAAgB;IAChB,iCAAiC;IACjC,WAAW;CACZ,CAAA;AAEY,QAAA,KAAK,GAAG,IAAI,oBAAQ,CAAC,OAAO,CAAC,CAAA"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export * from './cache';
|
2
|
+
export declare const fetchWithCache: <T>(...args: any[]) => Promise<T>;
|
3
|
+
export declare const handleWSEventWithCache: (fnThat: any, fn: any, ttl: any, eventParser: any, eventFilter: any, eventIdSelector: any) => (event: any) => Promise<void>;
|
4
|
+
export declare const sleep: (millsec?: number) => Promise<void>;
|
5
|
+
export declare const convertDiff: (diff: string | null) => any;
|
@@ -0,0 +1,77 @@
|
|
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.convertDiff = exports.sleep = exports.handleWSEventWithCache = exports.fetchWithCache = void 0;
|
18
|
+
const cache_1 = require("../utils/cache");
|
19
|
+
const lru_cache_1 = require("lru-cache");
|
20
|
+
__exportStar(require("./cache"), exports);
|
21
|
+
const fetchWithCache = async (...args) => {
|
22
|
+
const res = cache_1.cache.get(args);
|
23
|
+
if (res) {
|
24
|
+
return res;
|
25
|
+
}
|
26
|
+
const result = await fetch(args).then((res) => res.json());
|
27
|
+
cache_1.cache.set(args, result);
|
28
|
+
return result;
|
29
|
+
};
|
30
|
+
exports.fetchWithCache = fetchWithCache;
|
31
|
+
// export const fetch = async (...args) => {}
|
32
|
+
const handleWSEventWithCache = (fnThat, fn, ttl, eventParser, eventFilter, eventIdSelector) => {
|
33
|
+
const WSCache = new lru_cache_1.LRUCache({
|
34
|
+
max: 500,
|
35
|
+
size: 50,
|
36
|
+
sizeCalculation: (value, key) => 1,
|
37
|
+
// for use with tracking overall storage size
|
38
|
+
maxSize: 5000,
|
39
|
+
allowStale: false,
|
40
|
+
updateAgeOnGet: false,
|
41
|
+
noUpdateTTL: true,
|
42
|
+
ttl: ttl,
|
43
|
+
});
|
44
|
+
return async function (event) {
|
45
|
+
const data = eventParser(event);
|
46
|
+
const key = eventIdSelector(data);
|
47
|
+
if (eventFilter(data) || WSCache.get(key)) {
|
48
|
+
// console.log(`${key} hit cache, skip it, remainingTTL: `, WSCache.getRemainingTTL(key))
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
WSCache.set(key, true);
|
52
|
+
await fn.apply(fnThat, [data]);
|
53
|
+
};
|
54
|
+
};
|
55
|
+
exports.handleWSEventWithCache = handleWSEventWithCache;
|
56
|
+
const sleep = async (millsec = 5000) => {
|
57
|
+
await new Promise((resolve, reject) => {
|
58
|
+
setTimeout(resolve, millsec);
|
59
|
+
});
|
60
|
+
};
|
61
|
+
exports.sleep = sleep;
|
62
|
+
const diffMap = {
|
63
|
+
E: 'Easy',
|
64
|
+
N: 'Normal',
|
65
|
+
H: 'Hard',
|
66
|
+
EX: 'Expert',
|
67
|
+
EP: 'ExpertPlus',
|
68
|
+
'EX+': 'ExpertPlus',
|
69
|
+
};
|
70
|
+
const convertDiff = (diff) => {
|
71
|
+
if (!diff) {
|
72
|
+
return diff;
|
73
|
+
}
|
74
|
+
return diffMap[diff.toUpperCase()];
|
75
|
+
};
|
76
|
+
exports.convertDiff = convertDiff;
|
77
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAqC;AACrC,yCAAoC;AAEpC,0CAAuB;AAEhB,MAAM,cAAc,GAAG,KAAK,EAAK,GAAG,IAAI,EAAc,EAAE;IAC7D,MAAM,GAAG,GAAG,aAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,GAAQ,CAAA;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM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C,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAJY,QAAA,KAAK,SAIjB;AAED,MAAM,OAAO,GAAG;IACd,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,MAAM;IACT,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,YAAY;CACpB,CAAA;AAEM,MAAM,WAAW,GAAG,CAAC,IAAmB,EAAE,EAAE;IACjD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA;AALY,QAAA,WAAW,eAKvB"}
|
package/lib/ws/beatsaver.d.ts
CHANGED
@@ -3,6 +3,7 @@ import { Logger } from '../interface/logger';
|
|
3
3
|
import { RenderService } from '../img-render';
|
4
4
|
import { Config } from '../config';
|
5
5
|
import { DB } from '../interface/db';
|
6
|
+
import { BeatSaverWSEvent } from '../api/interfaces/beatsaver';
|
6
7
|
import { BotService, Session } from '../interface';
|
7
8
|
export declare class BeatSaverWSHandler<T> implements WSHandler {
|
8
9
|
private readonly logger;
|
@@ -14,5 +15,9 @@ export declare class BeatSaverWSHandler<T> implements WSHandler {
|
|
14
15
|
constructor(db: DB<T>, render: RenderService, logger: Logger, config: Config, botService: BotService<T, Session<T>>);
|
15
16
|
onOpen(): void;
|
16
17
|
onClose(): void;
|
17
|
-
|
18
|
+
eventParser(event: any): BeatSaverWSEvent;
|
19
|
+
eventFilter: (data: BeatSaverWSEvent) => boolean;
|
20
|
+
eventIdSelector: (data: BeatSaverWSEvent) => string;
|
21
|
+
BSWSHandler(data: BeatSaverWSEvent): Promise<void>;
|
22
|
+
onEvent: (event: any) => Promise<void>;
|
18
23
|
}
|