beatsaber-bot-core 0.2.0-rc.13 → 0.2.0-rc.14
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/dist/cjs/cmd/bind/bind-id-beatleader.js +1 -1
- package/dist/cjs/cmd/bind/bind-id-beatsaver.js +1 -1
- package/dist/cjs/cmd/bind/bind-scoresaber.js +1 -1
- package/dist/cjs/cmd/bind/index.js +4 -4
- package/dist/cjs/cmd/bsmap/id-search.js +2 -2
- package/dist/cjs/cmd/bsmap/key-search.js +1 -1
- package/dist/cjs/cmd/bsmap/latest.js +1 -1
- package/dist/cjs/cmd/deprecated/tmp.js +1 -1
- package/dist/cjs/cmd/index.js +11 -11
- package/dist/cjs/cmd/index.js.map +1 -1
- package/dist/cjs/cmd/rank.js +3 -3
- package/dist/cjs/cmd/score.js +5 -5
- package/dist/cjs/cmd/subscribe/beatleader.js +1 -1
- package/dist/cjs/cmd/subscribe/beatsaver.js +1 -1
- package/dist/cjs/cmd/subscribe/id-beatleader-score.js +1 -1
- package/dist/cjs/cmd/subscribe/id-beatsaver-mapper.js +1 -1
- package/dist/cjs/cmd/subscribe/index.js +5 -5
- package/dist/cjs/cmd/subscribe/subjoin.js +2 -2
- package/dist/cjs/cmd/subscribe/subleave.js +1 -1
- package/dist/cjs/cmd/subscribe/unsubscribe.js +2 -2
- package/dist/cjs/components/components/RankDifficulty.js +1 -1
- package/dist/cjs/components/components/bl-rank-score-item.js +3 -3
- package/dist/cjs/components/components/bl-score-item.js +1 -1
- package/dist/cjs/components/components/bl-score-item.js.map +1 -1
- package/dist/cjs/components/components/flag.js +1 -1
- package/dist/cjs/components/components/icons/RankIcon.js +2 -2
- package/dist/cjs/components/components/scoreItem.js +1 -1
- package/dist/cjs/components/components/scoreItem.js.map +1 -1
- package/dist/cjs/components/components/scoregraph.js +2 -2
- package/dist/cjs/components/components/ss-rank-score-item.js +3 -3
- package/dist/cjs/components/components/ss-score-item.js +1 -1
- package/dist/cjs/components/components/ss-score-item.js.map +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/pages/bl-player.js +5 -5
- package/dist/cjs/components/pages/bl-score-with-rank.js +6 -6
- package/dist/cjs/components/pages/bl-score.js +2 -2
- package/dist/cjs/components/pages/bs-map.js +3 -3
- package/dist/cjs/components/pages/index.js +4 -4
- package/dist/cjs/components/pages/ss-player.js +2 -2
- package/dist/cjs/components/utils/format.js +4 -4
- package/dist/cjs/components/utils/format.js.map +1 -1
- package/dist/cjs/config.js +39 -0
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/infra/index.js +3 -3
- package/dist/cjs/infra/index.js.map +1 -1
- package/dist/cjs/infra/s3/index.js +34 -3
- package/dist/cjs/infra/s3/index.js.map +1 -1
- package/dist/cjs/infra/support/fetch/index.js +13 -4
- package/dist/cjs/infra/support/fetch/index.js.map +1 -1
- package/dist/cjs/infra/support/fetch/ofetch.js +5 -12
- package/dist/cjs/infra/support/fetch/ofetch.js.map +1 -1
- package/dist/cjs/infra/support/render/index.js +48 -14
- package/dist/cjs/infra/support/render/index.js.map +1 -1
- package/dist/cjs/interface/cmd/builder.js +1 -1
- package/dist/cjs/schedules/index.js +3 -2
- package/dist/cjs/schedules/index.js.map +1 -1
- package/dist/cjs/service/api/base/aioclient.js +1 -1
- package/dist/cjs/service/api/base/blclient.js +1 -1
- package/dist/cjs/service/api/base/bsclient.js +2 -2
- package/dist/cjs/service/api/base/ssclient.js +2 -2
- package/dist/cjs/service/api/index.js +14 -5
- package/dist/cjs/service/api/index.js.map +1 -1
- package/dist/cjs/service/render/index.js +21 -8
- package/dist/cjs/service/render/index.js.map +1 -1
- package/dist/cjs/ws/beatsaver.js +1 -1
- package/dist/esm/cmd/bind/bind-id-beatleader.js +1 -1
- package/dist/esm/cmd/bind/bind-id-beatsaver.js +1 -1
- package/dist/esm/cmd/bind/bind-scoresaber.js +1 -1
- package/dist/esm/cmd/bind/index.js +5 -5
- package/dist/esm/cmd/bsmap/id-search.js +2 -2
- package/dist/esm/cmd/bsmap/key-search.js +1 -1
- package/dist/esm/cmd/bsmap/latest.js +1 -1
- package/dist/esm/cmd/deprecated/tmp.js +1 -1
- package/dist/esm/cmd/index.js +11 -11
- package/dist/esm/cmd/index.js.map +1 -1
- package/dist/esm/cmd/rank.js +3 -3
- package/dist/esm/cmd/score.js +5 -5
- package/dist/esm/cmd/subscribe/beatleader.js +1 -1
- package/dist/esm/cmd/subscribe/beatsaver.js +1 -1
- package/dist/esm/cmd/subscribe/id-beatleader-score.js +1 -1
- package/dist/esm/cmd/subscribe/id-beatsaver-mapper.js +1 -1
- package/dist/esm/cmd/subscribe/index.js +5 -5
- package/dist/esm/cmd/subscribe/subjoin.js +2 -2
- package/dist/esm/cmd/subscribe/subleave.js +1 -1
- package/dist/esm/cmd/subscribe/unsubscribe.js +2 -2
- package/dist/esm/components/components/RankDifficulty.js +1 -1
- package/dist/esm/components/components/bl-rank-score-item.js +2 -2
- package/dist/esm/components/components/bl-score-item.js +2 -2
- package/dist/esm/components/components/bl-score-item.js.map +1 -1
- package/dist/esm/components/components/icons/RankIcon.js +2 -2
- package/dist/esm/components/components/scoreItem.js +1 -1
- package/dist/esm/components/components/scoreItem.js.map +1 -1
- package/dist/esm/components/components/scoregraph.js +3 -3
- package/dist/esm/components/components/socre-badge.js +1 -1
- package/dist/esm/components/components/ss-rank-score-item.js +2 -2
- package/dist/esm/components/components/ss-score-item.js +2 -2
- package/dist/esm/components/components/ss-score-item.js.map +1 -1
- package/dist/esm/components/pages/bl-player.js +7 -7
- package/dist/esm/components/pages/bl-score-with-rank.js +6 -6
- package/dist/esm/components/pages/bl-score.js +3 -3
- package/dist/esm/components/pages/bs-map.js +5 -5
- package/dist/esm/components/pages/index.js +5 -5
- package/dist/esm/components/pages/ss-player.js +3 -3
- package/dist/esm/components/utils/bl/bsorReplayAcc.js +2 -2
- package/dist/esm/components/utils/format.js +3 -3
- package/dist/esm/components/utils/format.js.map +1 -1
- package/dist/esm/components/utils/index.js +2 -2
- package/dist/esm/config.js +31 -0
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/infra/i18n/index.js +2 -2
- package/dist/esm/infra/index.js +5 -5
- package/dist/esm/infra/index.js.map +1 -1
- package/dist/esm/infra/s3/index.js +31 -1
- package/dist/esm/infra/s3/index.js.map +1 -1
- package/dist/esm/infra/support/fetch/index.js +16 -7
- package/dist/esm/infra/support/fetch/index.js.map +1 -1
- package/dist/esm/infra/support/fetch/ofetch.js +4 -10
- package/dist/esm/infra/support/fetch/ofetch.js.map +1 -1
- package/dist/esm/infra/support/render/index.js +47 -13
- package/dist/esm/infra/support/render/index.js.map +1 -1
- package/dist/esm/interface/cmd/builder.js +1 -1
- package/dist/esm/interface/index.js +4 -4
- package/dist/esm/schedules/index.js +4 -3
- package/dist/esm/schedules/index.js.map +1 -1
- package/dist/esm/service/api/base/aioclient.js +1 -1
- package/dist/esm/service/api/base/blclient.js +1 -1
- package/dist/esm/service/api/base/bsclient.js +2 -2
- package/dist/esm/service/api/base/index.js +4 -4
- package/dist/esm/service/api/base/ssclient.js +2 -2
- package/dist/esm/service/api/index.js +16 -7
- package/dist/esm/service/api/index.js.map +1 -1
- package/dist/esm/service/api/interfaces/beatleader/index.js +5 -5
- package/dist/esm/service/api/interfaces/beatsaver/index.js +5 -5
- package/dist/esm/service/api/interfaces/scoresaber/index.js +3 -3
- package/dist/esm/service/index.js +2 -2
- package/dist/esm/service/render/index.js +22 -9
- package/dist/esm/service/render/index.js.map +1 -1
- package/dist/esm/ws/beatsaver.js +1 -1
- package/dist/esm/ws/index.js +3 -3
- package/dist/types/index.d.ts +205 -123
- package/package.json +17 -7
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/components/ss-score-item.tsx"],"sourcesContent":["import { BarChart, Key, Star, Wrench } from 'lucide-react'\nimport { diffConv, formatRelativeTimeByDay } from '../utils'\nimport React from 'react'\nimport { ScoreSaberItem } from '@/service/api/interfaces/scoresaber'\n\nconst getModifiers = (modifiers: string) => {\n return modifiers ? modifiers.split(',') : []\n}\nexport default function SsScoreItem({\n scoreItem,\n}: {\n scoreItem: ScoreSaberItem\n}) {\n return (\n <div className={'relative'}>\n <div\n className={\n 'rounded-lg flex bg-black/[.4] space-x-2 backdrop-blur-
|
1
|
+
{"version":3,"sources":["../../../../src/components/components/ss-score-item.tsx"],"sourcesContent":["import { BarChart, Key, Star, Wrench } from 'lucide-react'\nimport { diffConv, formatRelativeTimeByDay } from '../utils'\nimport React from 'react'\nimport { ScoreSaberItem } from '@/service/api/interfaces/scoresaber'\n\nconst getModifiers = (modifiers: string) => {\n return modifiers ? modifiers.split(',') : []\n}\nexport default function SsScoreItem({\n scoreItem,\n}: {\n scoreItem: ScoreSaberItem\n}) {\n return (\n <div className={'relative'}>\n <div\n className={\n 'rounded-lg flex bg-black/[.4] space-x-2 backdrop-blur-none overflow-hidden'\n }\n >\n <img\n loading={'eager'}\n src={scoreItem.leaderboard.coverImage}\n className={'rounded-md h-20 w-20'}\n />\n <div className={'flex flex-col space-y-1 py-0.5'}>\n <div\n className={\n 'font-semibold text-xs text-ellipsis overflow-hidden line-clamp-1 break-all'\n }\n >\n {scoreItem.leaderboard.songName}\n </div>\n <div\n className={\n 'text-xs flex items-center space-x-2 *:flex *:items-center *:space-x-1 '\n }\n >\n <div>\n <span>\n <BarChart className={'w-3 h-3'} />\n </span>\n <span>\n {diffConv(scoreItem.leaderboard.difficulty.difficultyRaw)}\n </span>\n </div>\n <div>\n <span>\n <Star className={'w-3 h-3'} />\n </span>\n <span>{scoreItem.leaderboard.stars} </span>\n </div>\n <div>\n <span>\n <Key className={'w-3 h-3'} />\n </span>\n <span>{scoreItem.mapId ?? 'unknown'}</span>\n </div>\n </div>\n <div className={'flex space-x-2 text-xs'}>\n <span>\n {(\n (scoreItem.score.baseScore / scoreItem.leaderboard.maxScore) *\n 100\n ).toFixed(2)}\n %\n </span>\n <span className={'text-orange-200'}>\n {scoreItem.score.pp.toFixed(1)}\n PP\n </span>\n <span className={'opacity-70'}>\n {formatRelativeTimeByDay(scoreItem.score.timeSet)}\n </span>\n </div>\n {getModifiers(scoreItem.score.modifiers).length > 0 && (\n <div className=\"text-xs flex flex-wrap space-x-2 items-center\">\n <Wrench className=\"h-3 w-3\" />\n {getModifiers(scoreItem.score.modifiers).map((modifier) => (\n <span key={modifier}>{modifier}</span>\n ))}\n </div>\n )}\n </div>\n </div>\n <div className=\"absolute right-1 bottom-1 text-white flex text-xs space-x-1 items-center\">\n {scoreItem.score.fullCombo && (\n <span className=\"from-blue-300 to-red-300 bg-gradient-to-r bg-clip-text text-transparent\">\n FC\n </span>\n )}\n </div>\n </div>\n )\n}\n"],"mappings":"AAoBQ,cAkBI,YAlBJ;AApBR,SAAS,UAAU,KAAK,MAAM,cAAc;AAC5C,SAAS,UAAU,+BAA+B;AAIlD,MAAM,eAAe,CAAC,cAAsB;AAC1C,SAAO,YAAY,UAAU,MAAM,GAAG,IAAI,CAAC;AAC7C;AACe,SAAR,YAA6B;AAAA,EAClC;AACF,GAEG;AAZH;AAaE,SACE,qBAAC,SAAI,WAAW,YACd;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WACE;AAAA,QAGF;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,SAAS;AAAA,cACT,KAAK,UAAU,YAAY;AAAA,cAC3B,WAAW;AAAA;AAAA,UACb;AAAA,UACA,qBAAC,SAAI,WAAW,kCACd;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,WACE;AAAA,gBAGD,oBAAU,YAAY;AAAA;AAAA,YACzB;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,WACE;AAAA,gBAGF;AAAA,uCAAC,SACC;AAAA,wCAAC,UACC,8BAAC,YAAS,WAAW,WAAW,GAClC;AAAA,oBACA,oBAAC,UACE,mBAAS,UAAU,YAAY,WAAW,aAAa,GAC1D;AAAA,qBACF;AAAA,kBACA,qBAAC,SACC;AAAA,wCAAC,UACC,8BAAC,QAAK,WAAW,WAAW,GAC9B;AAAA,oBACA,qBAAC,UAAM;AAAA,gCAAU,YAAY;AAAA,sBAAM;AAAA,uBAAC;AAAA,qBACtC;AAAA,kBACA,qBAAC,SACC;AAAA,wCAAC,UACC,8BAAC,OAAI,WAAW,WAAW,GAC7B;AAAA,oBACA,oBAAC,UAAM,0BAAU,UAAV,YAAmB,WAAU;AAAA,qBACtC;AAAA;AAAA;AAAA,YACF;AAAA,YACA,qBAAC,SAAI,WAAW,0BACd;AAAA,mCAAC,UAEI;AAAA,2BAAU,MAAM,YAAY,UAAU,YAAY,WACnD,KACA,QAAQ,CAAC;AAAA,gBAAE;AAAA,iBAEf;AAAA,cACA,qBAAC,UAAK,WAAW,mBACd;AAAA,0BAAU,MAAM,GAAG,QAAQ,CAAC;AAAA,gBAAE;AAAA,iBAEjC;AAAA,cACA,oBAAC,UAAK,WAAW,cACd,kCAAwB,UAAU,MAAM,OAAO,GAClD;AAAA,eACF;AAAA,YACC,aAAa,UAAU,MAAM,SAAS,EAAE,SAAS,KAChD,qBAAC,SAAI,WAAU,iDACb;AAAA,kCAAC,UAAO,WAAU,WAAU;AAAA,cAC3B,aAAa,UAAU,MAAM,SAAS,EAAE,IAAI,CAAC,aAC5C,oBAAC,UAAqB,sBAAX,QAAoB,CAChC;AAAA,eACH;AAAA,aAEJ;AAAA;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,SAAI,WAAU,4EACZ,oBAAU,MAAM,aACf,oBAAC,UAAK,WAAU,2EAA0E,gBAE1F,GAEJ;AAAA,KACF;AAEJ;","names":[]}
|
@@ -18,13 +18,13 @@ var __spreadValues = (a, b) => {
|
|
18
18
|
};
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
21
|
-
import getPart from "../utils/bl/getPart";
|
22
|
-
import ScoreBadge from "../components/socre-badge";
|
23
|
-
import SkillGraph from "../components/skill-graph";
|
24
|
-
import BeatLeaderItem from "../components/bl-score-item";
|
25
|
-
import Flags, { EarchIcon } from "../components/flag";
|
26
|
-
import { twJoin } from "../utils/tw-join";
|
27
|
-
import { getHeadsetForHMD } from "../utils/bl/blheadset";
|
21
|
+
import getPart from "../utils/bl/getPart.js";
|
22
|
+
import ScoreBadge from "../components/socre-badge.js";
|
23
|
+
import SkillGraph from "../components/skill-graph.js";
|
24
|
+
import BeatLeaderItem from "../components/bl-score-item.js";
|
25
|
+
import Flags, { EarchIcon } from "../components/flag.js";
|
26
|
+
import { twJoin } from "../utils/tw-join.js";
|
27
|
+
import { getHeadsetForHMD } from "../utils/bl/blheadset.js";
|
28
28
|
function BLPlayerPage({
|
29
29
|
beatleaderItems: items,
|
30
30
|
user,
|
@@ -27,15 +27,15 @@ import {
|
|
27
27
|
Calendar,
|
28
28
|
HeartPulse
|
29
29
|
} from "lucide-react";
|
30
|
-
import ScoreGraph from "../components/scoregraph";
|
30
|
+
import ScoreGraph from "../components/scoregraph.js";
|
31
31
|
import {
|
32
32
|
BlRankScoreItem,
|
33
33
|
ScoreItemSkeleton
|
34
|
-
} from "../../components/components/bl-rank-score-item";
|
35
|
-
import { RankDifficulty } from "../../components/components/RankDifficulty";
|
36
|
-
import { Avatar } from "../../components/components/base/avatar";
|
37
|
-
import { formatDuration, formatTime } from "../../components/utils";
|
38
|
-
import Progressbar from "../../components/components/progressbar";
|
34
|
+
} from "../../components/components/bl-rank-score-item.js";
|
35
|
+
import { RankDifficulty } from "../../components/components/RankDifficulty.js";
|
36
|
+
import { Avatar } from "../../components/components/base/avatar.js";
|
37
|
+
import { formatDuration, formatTime } from "../../components/utils/index.js";
|
38
|
+
import Progressbar from "../../components/components/progressbar.js";
|
39
39
|
function BLRankScore({
|
40
40
|
score,
|
41
41
|
aroundScores,
|
@@ -9,9 +9,9 @@ import {
|
|
9
9
|
ThumbsDown,
|
10
10
|
Calendar
|
11
11
|
} from "lucide-react";
|
12
|
-
import { diffConv, formatDuration, formatTime } from "../utils";
|
13
|
-
import Progressbar from "../components/progressbar";
|
14
|
-
import ScoreGraph from "../components/scoregraph";
|
12
|
+
import { diffConv, formatDuration, formatTime } from "../utils/index.js";
|
13
|
+
import Progressbar from "../components/progressbar.js";
|
14
|
+
import ScoreGraph from "../components/scoregraph.js";
|
15
15
|
function BLScore({
|
16
16
|
score,
|
17
17
|
bsMap,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
2
|
-
import RankIcon from "../components/icons/RankIcon";
|
2
|
+
import RankIcon from "../components/icons/RankIcon.js";
|
3
3
|
import {
|
4
4
|
Calendar,
|
5
5
|
Clock,
|
@@ -11,10 +11,10 @@ import {
|
|
11
11
|
ThumbsUp
|
12
12
|
} from "lucide-react";
|
13
13
|
import dayjs from "dayjs";
|
14
|
-
import { diffConv, formatNumber, formatTime, getTag } from "../utils";
|
15
|
-
import { getMods } from "../utils/getMods";
|
16
|
-
import Progressbar from "../components/progressbar";
|
17
|
-
import { CharacteristicIcon } from "../components/characteristic";
|
14
|
+
import { diffConv, formatNumber, formatTime, getTag } from "../utils/index.js";
|
15
|
+
import { getMods } from "../utils/getMods.js";
|
16
|
+
import Progressbar from "../components/progressbar.js";
|
17
|
+
import { CharacteristicIcon } from "../components/characteristic.js";
|
18
18
|
function BSMapShare({
|
19
19
|
bsMap,
|
20
20
|
bsMapQrUrl,
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
2
|
-
import BSMapShare from "./bs-map";
|
3
|
-
import SSPlayerPage from "./ss-player";
|
4
|
-
import BLPlayerPage from "./bl-player";
|
5
|
-
import { BLScore } from "./bl-score";
|
6
|
-
import BLRankScore from "../../components/pages/bl-score-with-rank";
|
2
|
+
import BSMapShare from "./bs-map.js";
|
3
|
+
import SSPlayerPage from "./ss-player.js";
|
4
|
+
import BLPlayerPage from "./bl-player.js";
|
5
|
+
import { BLScore } from "./bl-score.js";
|
6
|
+
import BLRankScore from "../../components/pages/bl-score-with-rank.js";
|
7
7
|
const getBSMapComp = (bsMap, bsMapQrUrl, previewQrUrl) => {
|
8
8
|
return /* @__PURE__ */ jsx(
|
9
9
|
BSMapShare,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
2
|
-
import Flags, { EarchIcon } from "../components/flag";
|
3
|
-
import { twJoin } from "../utils/tw-join";
|
4
|
-
import ScoreItem from "../components/ss-score-item";
|
2
|
+
import Flags, { EarchIcon } from "../components/flag.js";
|
3
|
+
import { twJoin } from "../utils/tw-join.js";
|
4
|
+
import ScoreItem from "../components/ss-score-item.js";
|
5
5
|
function SSPlayerPage({
|
6
6
|
leaderItems,
|
7
7
|
scoreUser,
|
@@ -29,8 +29,8 @@ var __objRest = (source, exclude) => {
|
|
29
29
|
}
|
30
30
|
return target;
|
31
31
|
};
|
32
|
-
import { NoteEventType } from "./bsorDecoder";
|
33
|
-
import { createDistanceWeightFunction } from "./beatleader";
|
32
|
+
import { NoteEventType } from "./bsorDecoder.js";
|
33
|
+
import { createDistanceWeightFunction } from "./beatleader.js";
|
34
34
|
const NoteScoringType = {
|
35
35
|
Ignore: -1,
|
36
36
|
NoScore: 0,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import dayjs from "dayjs";
|
2
|
-
import duration from "dayjs/plugin/duration";
|
3
|
-
import relativeTime from "dayjs/plugin/relativeTime";
|
4
|
-
import zh from "dayjs/locale/zh-cn";
|
2
|
+
import duration from "dayjs/plugin/duration.js";
|
3
|
+
import relativeTime from "dayjs/plugin/relativeTime.js";
|
4
|
+
import zh from "dayjs/locale/zh-cn.js";
|
5
5
|
dayjs.extend(duration);
|
6
6
|
dayjs.extend(relativeTime);
|
7
7
|
const formatDuration = (duration2) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/utils/format.ts"],"sourcesContent":["import dayjs from 'dayjs'\nimport duration from 'dayjs/plugin/duration'\nimport relativeTime from 'dayjs/plugin/relativeTime'\nimport zh from 'dayjs/locale/zh-cn'\ndayjs.extend(duration)\ndayjs.extend(relativeTime)\nexport const formatDuration = (duration: number) => {\n const d = dayjs.duration(duration, 'second')\n return d.format('m[m]s[s]')\n}\n\n// export const formatDuration = (duration: number) => {\n// return dayjs.duration(duration,'seconds').format('mm:ss')\n// }\n\nexport const formatTime = (time: string) => {\n return dayjs(time).locale(zh).fromNow()\n}\n\nexport function formatRelativeTimeByDay(time: string | number | Date) {\n let res = dayjs().diff(dayjs(time), 'd')\n let unit = 'd'\n if (res <= 0) {\n res = dayjs().diff(dayjs(time), 'h')\n unit = 'h'\n }\n if (res <= 0) {\n res = dayjs().diff(dayjs(time), 'm')\n unit = 'm'\n }\n return `${res}${unit}`\n}\n\nexport const formatNumber = (number: number) => {\n // 1.11w\n try {\n if (number > 10000) {\n return `${(number / 10000.0).toFixed(2)}w`\n }\n // 1.11k\n if (number > 1000) {\n return `${(number / 1000.0).toFixed(2)}k`\n }\n return number.toString()\n } catch (e) {\n return '0'\n }\n}\n\nexport function numberWithCommas(x: number) {\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n}\nexport const formatDate = (time: Date | undefined, template?: string) => {\n if (!time) return undefined\n return dayjs(time).format(template ?? 'YYYY-MM-DD')\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,kBAAkB;AACzB,OAAO,QAAQ;AACf,MAAM,OAAO,QAAQ;AACrB,MAAM,OAAO,YAAY;AAClB,MAAM,iBAAiB,CAACA,cAAqB;AAClD,QAAM,IAAI,MAAM,SAASA,WAAU,QAAQ;AAC3C,SAAO,EAAE,OAAO,UAAU;AAC5B;AAMO,MAAM,aAAa,CAAC,SAAiB;AAC1C,SAAO,MAAM,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ;AACxC;AAEO,SAAS,wBAAwB,MAA8B;AACpE,MAAI,MAAM,MAAM,EAAE,KAAK,MAAM,IAAI,GAAG,GAAG;AACvC,MAAI,OAAO;AACX,MAAI,OAAO,GAAG;AACZ,UAAM,MAAM,EAAE,KAAK,MAAM,IAAI,GAAG,GAAG;AACnC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,GAAG;AACZ,UAAM,MAAM,EAAE,KAAK,MAAM,IAAI,GAAG,GAAG;AACnC,WAAO;AAAA,EACT;AACA,SAAO,GAAG,GAAG,GAAG,IAAI;AACtB;AAEO,MAAM,eAAe,CAAC,WAAmB;AAE9C,MAAI;AACF,QAAI,SAAS,KAAO;AAClB,aAAO,IAAI,SAAS,KAAS,QAAQ,CAAC,CAAC;AAAA,IACzC;AAEA,QAAI,SAAS,KAAM;AACjB,aAAO,IAAI,SAAS,KAAQ,QAAQ,CAAC,CAAC;AAAA,IACxC;AACA,WAAO,OAAO,SAAS;AAAA,EACzB,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AACF;AAEO,SAAS,iBAAiB,GAAW;AAC1C,SAAO,EAAE,SAAS,EAAE,QAAQ,yBAAyB,GAAG;AAC1D;AACO,MAAM,aAAa,CAAC,MAAwB,aAAsB;AACvE,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,MAAM,IAAI,EAAE,OAAO,8BAAY,YAAY;AACpD;","names":["duration"]}
|
1
|
+
{"version":3,"sources":["../../../../src/components/utils/format.ts"],"sourcesContent":["import dayjs from 'dayjs'\nimport duration from 'dayjs/plugin/duration.js'\nimport relativeTime from 'dayjs/plugin/relativeTime.js'\nimport zh from 'dayjs/locale/zh-cn.js'\ndayjs.extend(duration)\ndayjs.extend(relativeTime)\nexport const formatDuration = (duration: number) => {\n const d = dayjs.duration(duration, 'second')\n return d.format('m[m]s[s]')\n}\n\n// export const formatDuration = (duration: number) => {\n// return dayjs.duration(duration,'seconds').format('mm:ss')\n// }\n\nexport const formatTime = (time: string) => {\n return dayjs(time).locale(zh).fromNow()\n}\n\nexport function formatRelativeTimeByDay(time: string | number | Date) {\n let res = dayjs().diff(dayjs(time), 'd')\n let unit = 'd'\n if (res <= 0) {\n res = dayjs().diff(dayjs(time), 'h')\n unit = 'h'\n }\n if (res <= 0) {\n res = dayjs().diff(dayjs(time), 'm')\n unit = 'm'\n }\n return `${res}${unit}`\n}\n\nexport const formatNumber = (number: number) => {\n // 1.11w\n try {\n if (number > 10000) {\n return `${(number / 10000.0).toFixed(2)}w`\n }\n // 1.11k\n if (number > 1000) {\n return `${(number / 1000.0).toFixed(2)}k`\n }\n return number.toString()\n } catch (e) {\n return '0'\n }\n}\n\nexport function numberWithCommas(x: number) {\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n}\nexport const formatDate = (time: Date | undefined, template?: string) => {\n if (!time) return undefined\n return dayjs(time).format(template ?? 'YYYY-MM-DD')\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,kBAAkB;AACzB,OAAO,QAAQ;AACf,MAAM,OAAO,QAAQ;AACrB,MAAM,OAAO,YAAY;AAClB,MAAM,iBAAiB,CAACA,cAAqB;AAClD,QAAM,IAAI,MAAM,SAASA,WAAU,QAAQ;AAC3C,SAAO,EAAE,OAAO,UAAU;AAC5B;AAMO,MAAM,aAAa,CAAC,SAAiB;AAC1C,SAAO,MAAM,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ;AACxC;AAEO,SAAS,wBAAwB,MAA8B;AACpE,MAAI,MAAM,MAAM,EAAE,KAAK,MAAM,IAAI,GAAG,GAAG;AACvC,MAAI,OAAO;AACX,MAAI,OAAO,GAAG;AACZ,UAAM,MAAM,EAAE,KAAK,MAAM,IAAI,GAAG,GAAG;AACnC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,GAAG;AACZ,UAAM,MAAM,EAAE,KAAK,MAAM,IAAI,GAAG,GAAG;AACnC,WAAO;AAAA,EACT;AACA,SAAO,GAAG,GAAG,GAAG,IAAI;AACtB;AAEO,MAAM,eAAe,CAAC,WAAmB;AAE9C,MAAI;AACF,QAAI,SAAS,KAAO;AAClB,aAAO,IAAI,SAAS,KAAS,QAAQ,CAAC,CAAC;AAAA,IACzC;AAEA,QAAI,SAAS,KAAM;AACjB,aAAO,IAAI,SAAS,KAAQ,QAAQ,CAAC,CAAC;AAAA,IACxC;AACA,WAAO,OAAO,SAAS;AAAA,EACzB,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AACF;AAEO,SAAS,iBAAiB,GAAW;AAC1C,SAAO,EAAE,SAAS,EAAE,QAAQ,yBAAyB,GAAG;AAC1D;AACO,MAAM,aAAa,CAAC,MAAwB,aAAsB;AACvE,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,MAAM,IAAI,EAAE,OAAO,8BAAY,YAAY;AACpD;","names":["duration"]}
|
package/dist/esm/config.js
CHANGED
@@ -1 +1,32 @@
|
|
1
|
+
import { renderSchema, s3ConfigSchema } from "./infra/index.js";
|
2
|
+
import { z } from "zod/v4";
|
3
|
+
const cronSchema = z.object({
|
4
|
+
enabled: z.boolean().optional().default(false),
|
5
|
+
cron: z.string().optional()
|
6
|
+
}).optional().default({ enabled: false });
|
7
|
+
const configSchema = z.object({
|
8
|
+
s3: s3ConfigSchema.default({ enabled: false }).optional(),
|
9
|
+
render: renderSchema,
|
10
|
+
beatsaver: z.object({
|
11
|
+
host: z.string().default("https://api.beatsaver.com").optional(),
|
12
|
+
wsURL: z.string().default("wss://ws.beatsaver.com/maps").optional(),
|
13
|
+
oauthClientId: z.string().optional(),
|
14
|
+
oauthClientSecret: z.string().optional()
|
15
|
+
}).default({
|
16
|
+
host: "https://api.beatsaver.com",
|
17
|
+
wsURL: "wss://ws.beatsaver.com/maps"
|
18
|
+
}).optional(),
|
19
|
+
beatleader: z.object({
|
20
|
+
oauthClientId: z.string().optional(),
|
21
|
+
oauthClientSecret: z.string().optional()
|
22
|
+
}).default({}).optional(),
|
23
|
+
cron: z.object({
|
24
|
+
temp: cronSchema
|
25
|
+
}).default({
|
26
|
+
temp: { enabled: false }
|
27
|
+
}).optional()
|
28
|
+
});
|
29
|
+
export {
|
30
|
+
configSchema
|
31
|
+
};
|
1
32
|
//# sourceMappingURL=config.js.map
|
package/dist/esm/config.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/config.ts"],"sourcesContent":["import { renderSchema, s3ConfigSchema } from '@/infra'\nimport {z} from 'zod/v4'\n\nconst cronSchema = z.object({\n enabled: z.boolean().optional().default(false),\n cron: z.string().optional(),\n}).optional().default({ enabled: false })\n\nexport const configSchema = z.object({\n s3: s3ConfigSchema.default({ enabled: false }).optional(),\n render: renderSchema,\n beatsaver: z.object({\n host: z.string().default('https://api.beatsaver.com').optional(),\n wsURL: z.string().default('wss://ws.beatsaver.com/maps').optional(),\n oauthClientId: z.string().optional(),\n oauthClientSecret: z.string().optional(),\n }).default({\n host: 'https://api.beatsaver.com',\n wsURL: 'wss://ws.beatsaver.com/maps',\n }).optional(),\n beatleader: z.object({\n oauthClientId: z.string().optional(),\n oauthClientSecret: z.string().optional(),\n }).default({}).optional(),\n cron: z.object({\n temp: cronSchema,\n }).default({\n temp: {enabled: false},\n }).optional()\n})\n\nexport type Config = z.infer<typeof configSchema>\n"],"mappings":"AAAA,SAAS,cAAc,sBAAsB;AAC7C,SAAQ,SAAQ;AAEhB,MAAM,aAAa,EAAE,OAAO;AAAA,EAC1B,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK;AAAA,EAC7C,MAAM,EAAE,OAAO,EAAE,SAAS;AAC5B,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,MAAM,CAAC;AAEjC,MAAM,eAAe,EAAE,OAAO;AAAA,EACnC,IAAI,eAAe,QAAQ,EAAE,SAAS,MAAM,CAAC,EAAE,SAAS;AAAA,EACxD,QAAQ;AAAA,EACR,WAAW,EAAE,OAAO;AAAA,IAClB,MAAM,EAAE,OAAO,EAAE,QAAQ,2BAA2B,EAAE,SAAS;AAAA,IAC/D,OAAO,EAAE,OAAO,EAAE,QAAQ,6BAA6B,EAAE,SAAS;AAAA,IAClE,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,IACnC,mBAAmB,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,CAAC,EAAE,QAAQ;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,EACT,CAAC,EAAE,SAAS;AAAA,EACZ,YAAY,EAAE,OAAO;AAAA,IACnB,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,IACnC,mBAAmB,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS;AAAA,EACxB,MAAM,EAAE,OAAO;AAAA,IACb,MAAM;AAAA,EACR,CAAC,EAAE,QAAQ;AAAA,IACT,MAAM,EAAC,SAAS,MAAK;AAAA,EACvB,CAAC,EAAE,SAAS;AACd,CAAC;","names":[]}
|
package/dist/esm/index.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import { botCommands } from "./cmd";
|
2
|
-
import { getScheduleTasks } from "./schedules";
|
3
|
-
export * from "./interface";
|
4
|
-
export * from "./schedules";
|
5
|
-
export * from "./config";
|
6
|
-
export * from "./cmd";
|
7
|
-
export * from "./ws";
|
8
|
-
export * from "./utils";
|
9
|
-
export * from "./service";
|
10
|
-
export * from "./infra";
|
1
|
+
import { botCommands } from "./cmd/index.js";
|
2
|
+
import { getScheduleTasks } from "./schedules/index.js";
|
3
|
+
export * from "./interface/index.js";
|
4
|
+
export * from "./schedules/index.js";
|
5
|
+
export * from "./config.js";
|
6
|
+
export * from "./cmd/index.js";
|
7
|
+
export * from "./ws/index.js";
|
8
|
+
export * from "./utils/index.js";
|
9
|
+
export * from "./service/index.js";
|
10
|
+
export * from "./infra/index.js";
|
11
11
|
const getBot = (config) => ({
|
12
12
|
commands: botCommands(),
|
13
13
|
schedule: getScheduleTasks(config)
|
package/dist/esm/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {botCommands} from \"./cmd\";\nimport {getScheduleTasks} from \"./schedules\";\nimport {Config} from \"./config\";\n\nexport * from './interface'\nexport * from './schedules'\nexport * from './config'\nexport * from './cmd'\nexport * from './ws'\nexport * from './utils'\nexport * from './service'\nexport * from './infra'\n\nexport const getBot = <T>(config: Config) => ({\n commands: botCommands<T>(),\n schedule: getScheduleTasks(config),\n})\n\n"],"mappings":"AAAA,SAAQ,mBAAkB;AAC1B,SAAQ,wBAAuB;AAG/B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEP,MAAM,SAAS,CAAI,YAAoB;AAAA,EAC5C,UAAU,YAAe;AAAA,EACzB,UAAU,iBAAiB,MAAM;AACnC;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {botCommands} from \"./cmd\";\nimport {getScheduleTasks} from \"./schedules\";\nimport type {Config} from \"./config\";\n\nexport * from './interface'\nexport * from './schedules'\nexport * from './config'\nexport * from './cmd'\nexport * from './ws'\nexport * from './utils'\nexport * from './service'\nexport * from './infra'\n\nexport const getBot = <T>(config: Config) => ({\n commands: botCommands<T>(),\n schedule: getScheduleTasks(config),\n})\n\n"],"mappings":"AAAA,SAAQ,mBAAkB;AAC1B,SAAQ,wBAAuB;AAG/B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEP,MAAM,SAAS,CAAI,YAAoB;AAAA,EAC5C,UAAU,YAAe;AAAA,EACzB,UAAU,iBAAiB,MAAM;AACnC;","names":[]}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
var __defProp = Object.defineProperty;
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4
|
-
import { interpolate } from "./parser";
|
5
|
-
import { interpolateString } from "./util";
|
4
|
+
import { interpolate } from "./parser.js";
|
5
|
+
import { interpolateString } from "./util.js";
|
6
6
|
class I18nService {
|
7
7
|
constructor(config) {
|
8
8
|
__publicField(this, "obj", {});
|
package/dist/esm/infra/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export * from "./support/render";
|
2
|
-
import { I18nService } from "./i18n";
|
3
|
-
import { S3Service,
|
1
|
+
export * from "./support/render/index.js";
|
2
|
+
import { I18nService } from "./i18n/index.js";
|
3
|
+
import { S3Service, s3ConfigSchema } from "./s3/index.js";
|
4
4
|
export {
|
5
5
|
I18nService,
|
6
|
-
|
7
|
-
|
6
|
+
S3Service,
|
7
|
+
s3ConfigSchema
|
8
8
|
};
|
9
9
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/index.ts"],"sourcesContent":["export * from './support/render'\nexport { I18nService } from './i18n'\nexport { S3Service, S3Config } from './s3'\n"],"mappings":"AAAA,cAAc;AACd,SAAS,mBAAmB;AAC5B,SAAS,
|
1
|
+
{"version":3,"sources":["../../../src/infra/index.ts"],"sourcesContent":["export * from './support/render'\nexport { I18nService } from './i18n'\nexport { S3Service, type S3Config, s3ConfigSchema } from './s3'\n"],"mappings":"AAAA,cAAc;AACd,SAAS,mBAAmB;AAC5B,SAAS,WAA0B,sBAAsB;","names":[]}
|
@@ -1,5 +1,19 @@
|
|
1
1
|
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
2
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
+
var __spreadValues = (a, b) => {
|
7
|
+
for (var prop in b || (b = {}))
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
10
|
+
if (__getOwnPropSymbols)
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
+
if (__propIsEnum.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
}
|
15
|
+
return a;
|
16
|
+
};
|
3
17
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4
18
|
var __async = (__this, __arguments, generator) => {
|
5
19
|
return new Promise((resolve, reject) => {
|
@@ -23,6 +37,20 @@ var __async = (__this, __arguments, generator) => {
|
|
23
37
|
};
|
24
38
|
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
|
25
39
|
import crypto from "crypto";
|
40
|
+
import { z } from "zod/v4";
|
41
|
+
const strictS3ConfigSchema = z.object({
|
42
|
+
s3AccessKey: z.string(),
|
43
|
+
s3SecretKey: z.string(),
|
44
|
+
endpoint: z.string(),
|
45
|
+
baseURL: z.string(),
|
46
|
+
bucketName: z.string(),
|
47
|
+
region: z.string().optional(),
|
48
|
+
keyPrefix: z.string().optional()
|
49
|
+
});
|
50
|
+
const s3ConfigSchema = z.discriminatedUnion("enabled", [
|
51
|
+
z.object(__spreadValues({ enabled: z.literal(true) }, strictS3ConfigSchema.shape)),
|
52
|
+
z.object({ enabled: z.literal(false) })
|
53
|
+
]);
|
26
54
|
class S3Service {
|
27
55
|
constructor(config) {
|
28
56
|
__publicField(this, "s3Client");
|
@@ -77,6 +105,8 @@ class S3Service {
|
|
77
105
|
}
|
78
106
|
}
|
79
107
|
export {
|
80
|
-
S3Service
|
108
|
+
S3Service,
|
109
|
+
s3ConfigSchema,
|
110
|
+
strictS3ConfigSchema
|
81
111
|
};
|
82
112
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/infra/s3/index.ts"],"sourcesContent":["import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'\nimport crypto from 'crypto'\n\nexport interface S3Config {\n s3AccessKey: string\n s3SecretKey: string\n endpoint: string\n region
|
1
|
+
{"version":3,"sources":["../../../../src/infra/s3/index.ts"],"sourcesContent":["import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'\nimport crypto from 'crypto'\nimport {z} from \"zod/v4\";\n\nexport interface S3Config {\n s3AccessKey: string\n s3SecretKey: string\n endpoint: string\n region?: string\n bucketName: string\n keyPrefix?: string\n baseURL: string\n}\n\n\n\nexport const strictS3ConfigSchema = z.object({\n s3AccessKey: z.string(),\n s3SecretKey: z.string(),\n endpoint: z.string(),\n baseURL: z.string(),\n bucketName: z.string(),\n region: z.string().optional(),\n keyPrefix: z.string().optional(),\n})\n\nexport const s3ConfigSchema = z.discriminatedUnion('enabled', [\n z.object({ enabled: z.literal(true), ...strictS3ConfigSchema.shape }),\n z.object({ enabled: z.literal(false),}),\n])\n\nexport class S3Service {\n private s3Client: S3Client\n private readonly bucket: string\n private readonly keyPrefix: string = ''\n private readonly baseURL: string = ''\n constructor(config: S3Config) {\n const s3 = new S3Client({\n region: config.region ?? 'auto',\n endpoint: config.endpoint,\n credentials: {\n accessKeyId: config.s3AccessKey,\n secretAccessKey: config.s3SecretKey,\n },\n })\n this.bucket = config.bucketName\n this.keyPrefix = config.keyPrefix\n this.baseURL = config.baseURL\n this.s3Client = s3\n }\n async uploadImgWithUrl(url: string, mimeType?: string): Promise<string> {\n const res = await fetch(url).then((it) => it.arrayBuffer())\n const buf = Buffer.from(res)\n // @ts-ignore\n const md5 = crypto.createHash('md5').update(buf).digest('hex')\n const key = this.keyPrefix ? `${this.keyPrefix}-${md5}` : md5\n const params = {\n Bucket: this.bucket,\n Key: key,\n Body: buf,\n ContentType: mimeType ?? 'image/png',\n }\n const command = new PutObjectCommand(params)\n const data = await this.s3Client.send(command)\n return `${this.baseURL}${key}`\n }\n async uploadImg(buffer: Buffer, mimeType?: string): Promise<string> {\n // md5 digest\n // @ts-ignore\n const md5 = crypto.createHash('md5').update(buffer).digest('hex')\n const key = this.keyPrefix ? `${this.keyPrefix}-${md5}` : md5\n const params = {\n Bucket: this.bucket,\n Key: key,\n Body: buffer,\n ContentType: mimeType ?? 'image/png',\n }\n const command = new PutObjectCommand(params)\n const data = await this.s3Client.send(command)\n return `${this.baseURL}${key}`\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,wBAAwB;AAC3C,OAAO,YAAY;AACnB,SAAQ,SAAQ;AAcT,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,aAAa,EAAE,OAAO;AAAA,EACtB,aAAa,EAAE,OAAO;AAAA,EACtB,UAAU,EAAE,OAAO;AAAA,EACnB,SAAS,EAAE,OAAO;AAAA,EAClB,YAAY,EAAE,OAAO;AAAA,EACrB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AAEM,MAAM,iBAAiB,EAAE,mBAAmB,WAAW;AAAA,EAC5D,EAAE,OAAO,iBAAE,SAAS,EAAE,QAAQ,IAAI,KAAM,qBAAqB,MAAO;AAAA,EACpE,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,KAAK,EAAE,CAAC;AACxC,CAAC;AAEM,MAAM,UAAU;AAAA,EAKrB,YAAY,QAAkB;AAJ9B,wBAAQ;AACR,wBAAiB;AACjB,wBAAiB,aAAoB;AACrC,wBAAiB,WAAkB;AAnCrC;AAqCI,UAAM,KAAK,IAAI,SAAS;AAAA,MACtB,SAAQ,YAAO,WAAP,YAAiB;AAAA,MACzB,UAAU,OAAO;AAAA,MACjB,aAAa;AAAA,QACX,aAAa,OAAO;AAAA,QACpB,iBAAiB,OAAO;AAAA,MAC1B;AAAA,IACF,CAAC;AACD,SAAK,SAAS,OAAO;AACrB,SAAK,YAAY,OAAO;AACxB,SAAK,UAAU,OAAO;AACtB,SAAK,WAAW;AAAA,EAClB;AAAA,EACM,iBAAiB,KAAa,UAAoC;AAAA;AACtE,YAAM,MAAM,MAAM,MAAM,GAAG,EAAE,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC;AAC1D,YAAM,MAAM,OAAO,KAAK,GAAG;AAE3B,YAAM,MAAM,OAAO,WAAW,KAAK,EAAE,OAAO,GAAG,EAAE,OAAO,KAAK;AAC7D,YAAM,MAAM,KAAK,YAAY,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK;AAC1D,YAAM,SAAS;AAAA,QACb,QAAQ,KAAK;AAAA,QACb,KAAK;AAAA,QACL,MAAM;AAAA,QACN,aAAa,8BAAY;AAAA,MAC3B;AACA,YAAM,UAAU,IAAI,iBAAiB,MAAM;AAC3C,YAAM,OAAO,MAAM,KAAK,SAAS,KAAK,OAAO;AAC7C,aAAO,GAAG,KAAK,OAAO,GAAG,GAAG;AAAA,IAC9B;AAAA;AAAA,EACM,UAAU,QAAgB,UAAoC;AAAA;AAGlE,YAAM,MAAM,OAAO,WAAW,KAAK,EAAE,OAAO,MAAM,EAAE,OAAO,KAAK;AAChE,YAAM,MAAM,KAAK,YAAY,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK;AAC1D,YAAM,SAAS;AAAA,QACb,QAAQ,KAAK;AAAA,QACb,KAAK;AAAA,QACL,MAAM;AAAA,QACN,aAAa,8BAAY;AAAA,MAC3B;AACA,YAAM,UAAU,IAAI,iBAAiB,MAAM;AAC3C,YAAM,OAAO,MAAM,KAAK,SAAS,KAAK,OAAO;AAC7C,aAAO,GAAG,KAAK,OAAO,GAAG,GAAG;AAAA,IAC9B;AAAA;AACF;","names":[]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { createFetch as c, Fetch } from "./ofetch";
|
2
|
-
import { NotFoundError } from "./error";
|
1
|
+
import { createFetch as c, Fetch } from "./ofetch.js";
|
2
|
+
import { NotFoundError } from "./error.js";
|
3
3
|
const rofetch = c({
|
4
4
|
defaults: {
|
5
5
|
retryStatusCodes: [400, 408, 409, 425, 429, 502, 503, 504],
|
@@ -7,25 +7,34 @@ const rofetch = c({
|
|
7
7
|
retryDelay: 400
|
8
8
|
}
|
9
9
|
});
|
10
|
-
const ofetch = new Fetch(
|
10
|
+
const ofetch = new Fetch();
|
11
11
|
const createFetch = (logger) => {
|
12
12
|
return ofetch.extend({
|
13
13
|
onRequest: (context) => {
|
14
14
|
logger.debug(`[fetch -->] ${context.options.baseURL}${context.request}`);
|
15
|
+
logger.debug(`[fetch -->] ${JSON.stringify(context.options, null, 2)}`);
|
15
16
|
},
|
16
17
|
onResponse: (context) => {
|
17
18
|
logger.debug(`[fetch <--] ${context.request} ${context.response.status}`);
|
19
|
+
switch (context.options.responseType) {
|
20
|
+
case "text":
|
21
|
+
logger.debug(`[fetch <--] ${context.response._data}`);
|
22
|
+
break;
|
23
|
+
case "json":
|
24
|
+
logger.debug(`[fetch -->] ${JSON.stringify(context.response._data, null, 2)}`);
|
25
|
+
break;
|
26
|
+
}
|
18
27
|
},
|
19
|
-
onResponseError
|
20
|
-
|
28
|
+
onResponseError({ request, response, options, error }) {
|
29
|
+
logger.debug(`response error ${response.statusText}`, error);
|
30
|
+
if (response.status === 404) {
|
21
31
|
throw new NotFoundError();
|
22
32
|
}
|
23
|
-
throw context.error;
|
24
33
|
},
|
25
34
|
ignoreResponseError: false
|
26
35
|
});
|
27
36
|
};
|
28
|
-
import { Fetch as Fetch2 } from "./ofetch";
|
37
|
+
import { Fetch as Fetch2 } from "./ofetch.js";
|
29
38
|
export {
|
30
39
|
Fetch2 as Fetch,
|
31
40
|
createFetch
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/infra/support/fetch/index.ts"],"sourcesContent":["import { createFetch as c, Fetch } from './ofetch'\nimport { Logger } from '@/interface'\nimport { NotFoundError } from './error'\n\nconst rofetch = c({\n defaults: {\n retryStatusCodes: [400, 408, 409, 425, 429, 502, 503, 504],\n retry: 2,\n retryDelay: 400,\n },\n})\n\nconst ofetch = new Fetch(
|
1
|
+
{"version":3,"sources":["../../../../../src/infra/support/fetch/index.ts"],"sourcesContent":["import { createFetch as c, Fetch } from './ofetch'\nimport { Logger } from '@/interface'\nimport { NotFoundError } from './error'\n\nconst rofetch = c({\n defaults: {\n retryStatusCodes: [400, 408, 409, 425, 429, 502, 503, 504],\n retry: 2,\n retryDelay: 400,\n },\n})\n\nconst ofetch = new Fetch()\n\nexport const createFetch = (logger: Logger) => {\n return ofetch.extend({\n onRequest: (context) => {\n logger.debug(`[fetch -->] ${context.options.baseURL}${context.request}`)\n logger.debug(`[fetch -->] ${JSON.stringify(context.options, null, 2)}`)\n },\n onResponse: (context) => {\n logger.debug(`[fetch <--] ${context.request} ${context.response.status}`)\n switch (context.options.responseType) {\n case 'text':\n logger.debug(`[fetch <--] ${context.response._data}`)\n break\n case \"json\":\n logger.debug(`[fetch -->] ${JSON.stringify(context.response._data, null, 2)}`)\n break\n }\n },\n onResponseError({ request, response, options, error }) {\n logger.debug(`response error ${response.statusText}`, error)\n if (response.status === 404) {\n throw new NotFoundError()\n }\n },\n ignoreResponseError: false,\n })\n}\n\nexport { Fetch } from './ofetch'\n"],"mappings":"AAAA,SAAS,eAAe,GAAG,aAAa;AAExC,SAAS,qBAAqB;AAE9B,MAAM,UAAU,EAAE;AAAA,EAChB,UAAU;AAAA,IACR,kBAAkB,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,IACzD,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AACF,CAAC;AAED,MAAM,SAAS,IAAI,MAAM;AAElB,MAAM,cAAc,CAAC,WAAmB;AAC7C,SAAO,OAAO,OAAO;AAAA,IACnB,WAAW,CAAC,YAAY;AACtB,aAAO,MAAM,eAAe,QAAQ,QAAQ,OAAO,GAAG,QAAQ,OAAO,EAAE;AACvE,aAAO,MAAM,eAAe,KAAK,UAAU,QAAQ,SAAS,MAAM,CAAC,CAAC,EAAE;AAAA,IACxE;AAAA,IACA,YAAY,CAAC,YAAY;AACvB,aAAO,MAAM,eAAe,QAAQ,OAAO,IAAI,QAAQ,SAAS,MAAM,EAAE;AACxE,cAAQ,QAAQ,QAAQ,cAAc;AAAA,QACpC,KAAK;AACH,iBAAO,MAAM,eAAe,QAAQ,SAAS,KAAK,EAAE;AACpD;AAAA,QACF,KAAK;AACH,iBAAO,MAAM,eAAe,KAAK,UAAU,QAAQ,SAAS,OAAO,MAAM,CAAC,CAAC,EAAE;AAC7E;AAAA,MACJ;AAAA,IACF;AAAA,IACA,gBAAgB,EAAE,SAAS,UAAU,SAAS,MAAM,GAAG;AACrD,aAAO,MAAM,kBAAkB,SAAS,UAAU,IAAI,KAAK;AAC3D,UAAI,SAAS,WAAW,KAAK;AAC3B,cAAM,IAAI,cAAc;AAAA,MAC1B;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,EACvB,CAAC;AACH;AAEA,SAAS,SAAAA,cAAa;","names":["Fetch"]}
|
@@ -39,19 +39,13 @@ var __async = (__this, __arguments, generator) => {
|
|
39
39
|
});
|
40
40
|
};
|
41
41
|
import { createFetch } from "ofetch";
|
42
|
-
import { NotFoundError } from "./error";
|
43
42
|
const rofetch = createFetch({
|
44
43
|
defaults: {
|
45
|
-
retryStatusCodes: [
|
46
|
-
retry:
|
44
|
+
retryStatusCodes: [408, 409, 425, 429, 500, 502, 503, 504],
|
45
|
+
retry: 2,
|
47
46
|
retryDelay: 800
|
48
47
|
}
|
49
48
|
}).create({
|
50
|
-
onResponseError({ request, response, options }) {
|
51
|
-
if (response.status === 404) {
|
52
|
-
throw new NotFoundError();
|
53
|
-
}
|
54
|
-
},
|
55
49
|
onRequestError({ request, error }) {
|
56
50
|
}
|
57
51
|
});
|
@@ -76,6 +70,7 @@ class Fetch {
|
|
76
70
|
body: f
|
77
71
|
});
|
78
72
|
}
|
73
|
+
console.debug();
|
79
74
|
const res = yield this.ofetchInstance(request, opt);
|
80
75
|
return res;
|
81
76
|
});
|
@@ -108,7 +103,6 @@ class Fetch {
|
|
108
103
|
import { createFetch as createFetch2 } from "ofetch";
|
109
104
|
export {
|
110
105
|
Fetch,
|
111
|
-
createFetch2 as createFetch
|
112
|
-
rofetch
|
106
|
+
createFetch2 as createFetch
|
113
107
|
};
|
114
108
|
//# sourceMappingURL=ofetch.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/infra/support/fetch/ofetch.ts"],"sourcesContent":["import { $Fetch, createFetch, FetchOptions, ResponseType } from 'ofetch'\
|
1
|
+
{"version":3,"sources":["../../../../../src/infra/support/fetch/ofetch.ts"],"sourcesContent":["import { $Fetch, createFetch, FetchOptions, ResponseType } from 'ofetch'\n\n\nconst rofetch = createFetch({\n defaults: {\n retryStatusCodes: [408, 409, 425, 429, 500, 502, 503, 504],\n retry: 2,\n retryDelay: 800,\n },\n}).create({\n\n onRequestError({ request, error }) {\n\n },\n})\n\nexport type ExtendFetchOptions<R extends ResponseType = ResponseType, T = any> = {\n form?: Record<string, any>\n} & FetchOptions<R, T>\n\nexport class Fetch {\n private options?: FetchOptions\n private ofetchInstance: $Fetch\n constructor(fetchInstance?: $Fetch, options?: FetchOptions) {\n this.options = options\n this.ofetchInstance = fetchInstance ?? rofetch\n }\n async fetch<T, R extends ResponseType>(request: string, options?: ExtendFetchOptions<R, T>) {\n let opt = {\n ...options,\n ...this.options\n } as ExtendFetchOptions<R, T>\n if(opt.form) {\n const form = new FormData()\n let f = opt.form\n Object.entries(form).forEach(([key, value]) => form.append(key, value))\n opt = {\n ...opt,\n headers: {\n ...opt.headers,\n 'Content-Type': 'multipart/form-data'\n },\n body: f\n }\n }\n console.debug()\n const res = await this.ofetchInstance<T, R>(request, opt)\n return res\n }\n get<T = any, R extends ResponseType = 'json'>(\n request: string,\n options?: ExtendFetchOptions<R>\n ) {\n return this.fetch<T, R>(request, { ...options, method: 'GET' })\n }\n post<T = any, R extends ResponseType = 'json'>(\n request: string,\n options?: ExtendFetchOptions<R>\n ) {\n return this.fetch<T, R>(request, { ...options, method: 'POST' })\n }\n put<T = any, R extends ResponseType = 'json'>(\n request: string,\n options?: ExtendFetchOptions<R>\n ) {\n return this.fetch(request, { ...options, method: 'PUT' })\n }\n patch<T = any, R extends ResponseType = 'json'>(\n request: string,\n options?: ExtendFetchOptions<R>\n ) {\n return this.fetch(request, { ...options, method: 'PATCH' })\n }\n delete<T = any, R extends ResponseType = 'json'>(\n request: string,\n options?: ExtendFetchOptions<R>\n ) {\n return this.fetch(request, { ...options, method: 'DELETE' })\n }\n head(request: string, options?: FetchOptions) {\n return this.fetch(request, { ...options, method: 'HEAD' })\n }\n\n extend(options: FetchOptions) {\n return new Fetch(this.ofetchInstance, { ...this.options, ...options })\n }\n baseUrl(url: string) {\n return this.extend({ baseURL: url })\n }\n}\n\nexport { createFetch } from 'ofetch'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAiB,mBAA+C;AAGhE,MAAM,UAAU,YAAY;AAAA,EAC1B,UAAU;AAAA,IACR,kBAAkB,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,IACzD,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AACF,CAAC,EAAE,OAAO;AAAA,EAER,eAAe,EAAE,SAAS,MAAM,GAAG;AAAA,EAEnC;AACF,CAAC;AAMM,MAAM,MAAM;AAAA,EAGjB,YAAY,eAAwB,SAAwB;AAF5D,wBAAQ;AACR,wBAAQ;AAEN,SAAK,UAAU;AACf,SAAK,iBAAiB,wCAAiB;AAAA,EACzC;AAAA,EACO,MAAiC,SAAiB,SAAoC;AAAA;AAC3F,UAAI,MAAM,kCACL,UACA,KAAK;AAEV,UAAG,IAAI,MAAM;AACX,cAAM,OAAO,IAAI,SAAS;AAC1B,YAAI,IAAI,IAAI;AACZ,eAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,KAAK,OAAO,KAAK,KAAK,CAAC;AACtE,cAAM,iCACD,MADC;AAAA,UAEJ,SAAS,iCACJ,IAAI,UADA;AAAA,YAEP,gBAAgB;AAAA,UAClB;AAAA,UACA,MAAM;AAAA,QACR;AAAA,MACF;AACA,cAAQ,MAAM;AACd,YAAM,MAAM,MAAM,KAAK,eAAqB,SAAS,GAAG;AACxD,aAAO;AAAA,IACT;AAAA;AAAA,EACA,IACE,SACA,SACA;AACA,WAAO,KAAK,MAAY,SAAS,iCAAK,UAAL,EAAc,QAAQ,MAAM,EAAC;AAAA,EAChE;AAAA,EACA,KACE,SACA,SACA;AACA,WAAO,KAAK,MAAY,SAAS,iCAAK,UAAL,EAAc,QAAQ,OAAO,EAAC;AAAA,EACjE;AAAA,EACA,IACE,SACA,SACA;AACA,WAAO,KAAK,MAAM,SAAS,iCAAK,UAAL,EAAc,QAAQ,MAAM,EAAC;AAAA,EAC1D;AAAA,EACA,MACE,SACA,SACA;AACA,WAAO,KAAK,MAAM,SAAS,iCAAK,UAAL,EAAc,QAAQ,QAAQ,EAAC;AAAA,EAC5D;AAAA,EACA,OACE,SACA,SACA;AACA,WAAO,KAAK,MAAM,SAAS,iCAAK,UAAL,EAAc,QAAQ,SAAS,EAAC;AAAA,EAC7D;AAAA,EACA,KAAK,SAAiB,SAAwB;AAC5C,WAAO,KAAK,MAAM,SAAS,iCAAK,UAAL,EAAc,QAAQ,OAAO,EAAC;AAAA,EAC3D;AAAA,EAEA,OAAO,SAAuB;AAC5B,WAAO,IAAI,MAAM,KAAK,gBAAgB,kCAAK,KAAK,UAAY,QAAS;AAAA,EACvE;AAAA,EACA,QAAQ,KAAa;AACnB,WAAO,KAAK,OAAO,EAAE,SAAS,IAAI,CAAC;AAAA,EACrC;AACF;AAEA,SAAS,eAAAA,oBAAmB;","names":["createFetch"]}
|
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
|
|
17
17
|
return a;
|
18
18
|
};
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
var __objRest = (source, exclude) => {
|
21
|
+
var target = {};
|
22
|
+
for (var prop in source)
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
24
|
+
target[prop] = source[prop];
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
28
|
+
target[prop] = source[prop];
|
29
|
+
}
|
30
|
+
return target;
|
31
|
+
};
|
20
32
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
21
33
|
var __async = (__this, __arguments, generator) => {
|
22
34
|
return new Promise((resolve, reject) => {
|
@@ -38,13 +50,31 @@ var __async = (__this, __arguments, generator) => {
|
|
38
50
|
step((generator = generator.apply(__this, __arguments)).next());
|
39
51
|
});
|
40
52
|
};
|
41
|
-
import { html2imgBuffer,
|
53
|
+
import { html2imgBuffer, url2imgBuffer } from "./puppeteer.js";
|
42
54
|
import { Puppeteer } from "puppeteer-core";
|
43
|
-
import {
|
55
|
+
import { createFetch } from "../../../infra/support/fetch/index.js";
|
56
|
+
import { z } from "zod/v4";
|
57
|
+
const common = z.object({
|
58
|
+
defaultWaitTimeout: z.number().optional(),
|
59
|
+
waitTimeout: z.number().optional()
|
60
|
+
});
|
61
|
+
const cfConfig = z.object({
|
62
|
+
cfAccountId: z.string().min(1, "Cloudflare account id is required"),
|
63
|
+
cfAPIKey: z.string().min(1, "Cloudflare API key is required")
|
64
|
+
});
|
65
|
+
const puppeteerConfig = z.object({
|
66
|
+
puppeteerURL: z.string().describe("remote puppeteer url, eg: wss://browserless/xxx, https://browserless/xxx").optional()
|
67
|
+
});
|
68
|
+
const strictRenderConfig = z.discriminatedUnion("mode", [
|
69
|
+
z.object(__spreadValues(__spreadValues({ mode: z.literal("cf") }, cfConfig.shape), common.shape)),
|
70
|
+
z.object(__spreadValues(__spreadValues({ mode: z.literal("puppeteer") }, puppeteerConfig.shape), common.shape)),
|
71
|
+
z.object(__spreadValues({ mode: z.literal("custom") }, common.shape))
|
72
|
+
]);
|
73
|
+
const renderSchema = strictRenderConfig.and(z.object(__spreadValues(__spreadValues(__spreadValues({}, cfConfig.shape), puppeteerConfig.shape), common.shape)).partial());
|
44
74
|
class CFBrowserRendering {
|
45
|
-
constructor(accountId, cfAPIKey) {
|
75
|
+
constructor(accountId, cfAPIKey, logger) {
|
46
76
|
__publicField(this, "f");
|
47
|
-
this.f =
|
77
|
+
this.f = createFetch(logger).baseUrl(`https://api.cloudflare.com/client/v4/accounts/${accountId}`).extend({
|
48
78
|
headers: {
|
49
79
|
Authorization: `Bearer ${cfAPIKey}`
|
50
80
|
}
|
@@ -55,7 +85,8 @@ class CFBrowserRendering {
|
|
55
85
|
responseType: "arrayBuffer",
|
56
86
|
body: __spreadProps(__spreadValues({
|
57
87
|
"screenshotOptions": {
|
58
|
-
quality: 90
|
88
|
+
quality: 90,
|
89
|
+
type: "webp"
|
59
90
|
}
|
60
91
|
}, body), {
|
61
92
|
"viewport": {
|
@@ -108,26 +139,29 @@ const RemoteBrowserGetter = (addr) => {
|
|
108
139
|
}
|
109
140
|
return () => p.connect(opt);
|
110
141
|
};
|
111
|
-
const getImageRender = (
|
142
|
+
const getImageRender = (config) => {
|
143
|
+
const _a = config, { logger, render, browserGetter } = _a, _cfg = __objRest(_a, ["logger", "render", "browserGetter"]);
|
144
|
+
const cfg = strictRenderConfig.parse(_cfg);
|
112
145
|
if (cfg.mode === "cf") {
|
113
|
-
return new CFBrowserRendering(cfg.cfAccountId, cfg.cfAPIKey);
|
146
|
+
return new CFBrowserRendering(cfg.cfAccountId, cfg.cfAPIKey, logger);
|
114
147
|
}
|
115
148
|
if (cfg.mode === "custom") {
|
116
|
-
if (!
|
117
|
-
return
|
149
|
+
if (!render) throw new Error("please provide custom img render");
|
150
|
+
return render;
|
118
151
|
}
|
119
152
|
if (cfg.puppeteerURL) {
|
120
153
|
return new PuppeteerRendering(RemoteBrowserGetter(cfg.puppeteerURL));
|
121
154
|
}
|
122
|
-
if (
|
123
|
-
return new PuppeteerRendering(
|
155
|
+
if (browserGetter) {
|
156
|
+
return new PuppeteerRendering(browserGetter);
|
124
157
|
}
|
158
|
+
return null;
|
125
159
|
};
|
126
160
|
export {
|
127
161
|
CFBrowserRendering,
|
128
|
-
RenderOptions as PuppeteerOptions,
|
129
162
|
PuppeteerRendering,
|
130
163
|
RemoteBrowserGetter,
|
131
|
-
getImageRender
|
164
|
+
getImageRender,
|
165
|
+
renderSchema
|
132
166
|
};
|
133
167
|
//# sourceMappingURL=index.js.map
|