mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Merge branch 'main' into dev-tank-search
This commit is contained in:
commit
1d65dc755f
19 files changed
+110
-6453
No files matched your search
@@ -16,52 +16,34 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
|
||||
- name: Add fixed sharp
|
||||
run: yarn add [email protected] --ignore-engines
|
||||
run: bun install
|
||||
|
||||
- name: Setup DepotDownloader
|
||||
run: yarn setup:depotdownloader
|
||||
run: bun scripts/setupDepotDownloader.ts
|
||||
|
||||
- name: Run DepotDownloader
|
||||
run: ./temp/depotDownloader/DepotDownloader.exe -app 444200 -username ${{ secrets.DEPOT_DOWNLOADER_USERNAME }} -password "${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}"
|
||||
run: ./temp/depotDownloader/DepotDownloader.exe -os windows -app 444200 -username ${{ secrets.DEPOT_DOWNLOADER_USERNAME }} -password "${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}"
|
||||
|
||||
- name: Apply patches
|
||||
run: |
|
||||
$env:GH_TOKEN = "${{ secrets.GH_TOKEN }}"
|
||||
$env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}"
|
||||
$env:DATABASE_URL = "${{ secrets.DATABASE_URL }}"
|
||||
$env:GH_TOKEN = "${{ secrets.GH_TOKEN }}"
|
||||
$env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}"
|
||||
$env:DATABASE_URL = "${{ secrets.DATABASE_URL }}"
|
||||
$env:WOTB_DLC_CDN = "${{ secrets.WOTB_DLC_CDN }}"
|
||||
yarn setup:patches --depot
|
||||
bun scripts/applyPatches.ts --depot
|
||||
|
||||
- name: Build assets
|
||||
run: |
|
||||
$env:GH_TOKEN = "${{ secrets.GH_TOKEN }}"
|
||||
$env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}"
|
||||
$env:DATABASE_URL = "${{ secrets.DATABASE_URL }}"
|
||||
$env:VIDEOS_SHEET = "${{ secrets.VIDEOS_SHEET }}"
|
||||
$env:GH_TOKEN = "${{ secrets.GH_TOKEN }}"
|
||||
$env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}"
|
||||
$env:DATABASE_URL = "${{ secrets.DATABASE_URL }}"
|
||||
$env:VIDEOS_SHEET = "${{ secrets.VIDEOS_SHEET }}"
|
||||
$env:GOOGLE_APPLICATION_CREDENTIALS = "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
|
||||
yarn build:assets --all-targets --depot ${{ github.ref == 'refs/heads/main' && '--production' || '' }}
|
||||
bun scripts/buildAssets/index.ts --all-targets --depot --production
|
||||
@@ -17,44 +17,23 @@ jobs:
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Build docs
|
||||
run: yarn build:docs
|
||||
run: bun build:docs
|
||||
|
||||
- name: Configure pages
|
||||
uses: actions/configure-pages@v2
|
||||
|
||||
- name: Upload pages artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
- uses: actions/configure-pages@v2
|
||||
- uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
path: dist/docs
|
||||
|
||||
- name: Deploy
|
||||
id: deployment
|
||||
- id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
|
||||
- name: Archive build
|
||||
uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: docs/.vitepress/dist
|
||||
@@ -9,26 +9,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Generate leaderboard
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=asia --target=midnight --production
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=asia --target=midnight --production
|
||||
@@ -9,26 +9,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Generate leaderboard
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=eu --target=midnight --production
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=eu --target=midnight --production
|
||||
@@ -9,26 +9,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Generate all leaderboards
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=na,asia,eu --target=latest --production
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=na,asia,eu --target=latest --production
|
||||
@@ -9,26 +9,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Generate leaderboard
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=na --target=midnight --production
|
||||
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=na --target=midnight --production
|
||||
@@ -12,32 +12,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Build Prisma
|
||||
run: yarn prisma generate
|
||||
run: bun prisma generate
|
||||
|
||||
- name: Build
|
||||
run: yarn build:bot --production
|
||||
run: bun build:bot --production
|
||||
|
||||
- name: Archive build
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
name: CI Build Docs
|
||||
|
||||
on: push
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
|
||||
- name: Build
|
||||
run: yarn build:docs
|
||||
|
||||
- name: Archive build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: dist/docs
|
||||
@@ -12,29 +12,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Yarn
|
||||
run: npm install --location=global yarn
|
||||
|
||||
- name: Use node_modules cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
run: bun install
|
||||
|
||||
- name: Build
|
||||
run: yarn build:website
|
||||
run: bun build:website
|
||||
|
||||
- name: Archive build
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -15,3 +15,4 @@ BlitzKit is a one man band **TrèsAbhi** but I am far from solo.
|
||||
| Tankopedia pre-release testing | [OPTML], Aeson, \_34, Droodles |
|
||||
| Website advertisement platform | Aeson, Droodles |
|
||||
| Compare pre-release testing | [OPTML], Droodles |
|
||||
| Redacted | GonnaHetzMe |
|
||||
+6
-12
@@ -7,29 +7,22 @@
|
||||
"scripts": {
|
||||
"build:averages": "bun scripts/averages",
|
||||
"build:db": "prisma generate",
|
||||
"build:bot": "vite-node --script scripts/build --production",
|
||||
"build:website": "yarn build:db && yarn build:sitemap && next build",
|
||||
"build:sitemap": "vite-node --script scripts/sitemap",
|
||||
"build:bot": "bun scripts/build.ts --production",
|
||||
"build:website": "bun build:db && bun build:sitemap && next build",
|
||||
"build:sitemap": "bun scripts/sitemap.ts",
|
||||
"build:docs": "vitepress build docs",
|
||||
"build:ratingleaderboard": "vite-node --script scripts/buildRatingLeaderboard",
|
||||
"build:assets": "vite-node --max_old_space_size=16384 --script scripts/buildAssets/index",
|
||||
"test": "vite-node --script scripts/test",
|
||||
"test2": "vite-node --script scripts/test2",
|
||||
"build:ratingleaderboard": "bun --script scripts/buildRatingLeaderboard.ts",
|
||||
"dev:bot": "vite-node --script scripts/build && yarn start:bot",
|
||||
"dev:docs": "vitepress dev docs",
|
||||
"dev:website": "next dev",
|
||||
"start:bot": "node --enable-source-maps dist/bot/index.cjs",
|
||||
"start:website": "next start",
|
||||
"host:docs": "vitepress preview docs",
|
||||
"publish:ratingleaderboard": "vite-node --script scripts/buildRatingLeaderboard --publish",
|
||||
"setup:patches": "vite-node --script scripts/applyPatches",
|
||||
"lint": "npx tsc",
|
||||
"lint:website": "next lint",
|
||||
"format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"",
|
||||
"lint:version": "vite-node --script scripts/checkVersionMissMatch",
|
||||
"knip": "knip",
|
||||
"update": "yarn upgrade --latest",
|
||||
"setup:depotdownloader": "vite-node --script scripts/setupDepotDownloader",
|
||||
"tunnel": "cloudflared tunnel --url http://localhost:3000",
|
||||
"discoverids": "scripts/discoverIds.ts"
|
||||
},
|
||||
@@ -49,6 +42,7 @@
|
||||
"@vanilla-extract/css": "^1.13.0",
|
||||
"adm-zip": "^0.5.12",
|
||||
"bepaint": "^0.1.0-beta.3",
|
||||
"csv-parse": "^5.5.6",
|
||||
"decompress": "^4.2.1",
|
||||
"discord.js": "^14.13.0",
|
||||
"dotenv": "^16.3.1",
|
||||
@@ -87,6 +81,7 @@
|
||||
"devDependencies": {
|
||||
"@total-typescript/ts-reset": "^0.5.1",
|
||||
"@types/adm-zip": "^0.5.5",
|
||||
"@types/bun": "^1.1.5",
|
||||
"@types/decompress": "^4.2.7",
|
||||
"@types/escape-html": "^1.0.2",
|
||||
"@types/express": "^4.17.18",
|
||||
@@ -105,7 +100,6 @@
|
||||
"crc": "^4.3.2",
|
||||
"fast-xml-parser": "^4.3.2",
|
||||
"knip": "^3.4.0",
|
||||
"lz4": "^0.6.5",
|
||||
"prettier": "^3.0.3",
|
||||
"prisma": "^5.4.1",
|
||||
"typescript": "^5.4.5"
|
||||
|
||||
@@ -17,7 +17,10 @@ export async function boosterIcons(production: boolean) {
|
||||
|
||||
await Promise.all(
|
||||
boosterFiles.map(async (file) => {
|
||||
const name = file.match(/booster_(.+).txt.dvpl/)![1];
|
||||
const name = file.match(/booster_(.+).txt.dvpl/)?.[1];
|
||||
|
||||
if (name === undefined) return;
|
||||
|
||||
const sizes = (
|
||||
await readStringDVPL(`${DATA}/${POI.boosterIcons}/${file}`)
|
||||
)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { readdir } from 'fs/promises';
|
||||
import packageJSON from '../package.json';
|
||||
|
||||
const { version } = packageJSON;
|
||||
const changelogs = await readdir('docs/changelogs');
|
||||
const hasVersion = changelogs.includes(`${version}.md`);
|
||||
|
||||
if (hasVersion) {
|
||||
console.log(`Version ${version} found in changelogs`);
|
||||
} else {
|
||||
throw new Error(`Version ${version} not found in changelogs`);
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import { crc32 } from 'crc';
|
||||
import { decodeBlock } from 'lz4';
|
||||
import { decompressBlock } from 'lz4js';
|
||||
|
||||
/**
|
||||
* Thanks Maddoxkkm! Modernized heavily.
|
||||
*
|
||||
* Thanks Maddoxkkm! Modified heavily to be modern.
|
||||
* https://github.com/Maddoxkkm/dvpl_converter/
|
||||
*/
|
||||
export function readDVPL(buffer: Buffer) {
|
||||
@@ -30,6 +29,7 @@ export function readDVPL(buffer: Buffer) {
|
||||
if (crc32(targetBlock) !== footerData.crc32) {
|
||||
throw new TypeError('DVPL CRC32 mismatch');
|
||||
}
|
||||
|
||||
if (footerData.type === 0) {
|
||||
if (!(footerData.oSize === footerData.cSize && footerData.type === 0)) {
|
||||
throw new RangeError('DVPL type and size mismatch');
|
||||
@@ -37,14 +37,23 @@ export function readDVPL(buffer: Buffer) {
|
||||
|
||||
return targetBlock;
|
||||
} else if (footerData.type === 1 || footerData.type === 2) {
|
||||
const deDVPLBlock = Buffer.alloc(footerData.oSize);
|
||||
const DecompressedBlockSize = decodeBlock(targetBlock, deDVPLBlock);
|
||||
const source = new Uint8Array(targetBlock);
|
||||
const destination = new Uint8Array(footerData.oSize);
|
||||
const decompressedSize = decompressBlock(
|
||||
source,
|
||||
destination,
|
||||
0,
|
||||
source.length,
|
||||
0,
|
||||
);
|
||||
|
||||
if (DecompressedBlockSize !== footerData.oSize) {
|
||||
throw new RangeError('Decompressed DVPL size mismatch');
|
||||
if (decompressedSize !== footerData.oSize) {
|
||||
throw new RangeError(
|
||||
`Decompressed DVPL size mismatch (${decompressedSize} vs ${footerData.oSize})`,
|
||||
);
|
||||
}
|
||||
|
||||
return deDVPLBlock;
|
||||
return Buffer.from(destination);
|
||||
} else {
|
||||
throw new SyntaxError('Unknown DVPL format');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { crc32 } from 'crc';
|
||||
import { encodeBlockHC } from 'lz4';
|
||||
import { compressBlock } from 'lz4js';
|
||||
|
||||
/**
|
||||
* Thanks Maddoxkkm! Modernized heavily.
|
||||
@@ -7,8 +7,16 @@ import { encodeBlockHC } from 'lz4';
|
||||
* https://github.com/Maddoxkkm/dvpl_converter/
|
||||
*/
|
||||
export function writeDVPL(buffer: Buffer) {
|
||||
let output = Buffer.alloc(buffer.length);
|
||||
const compressedBlockSize = encodeBlockHC(buffer, output);
|
||||
const source = new Uint8Array(buffer);
|
||||
const destination = new Uint8Array(buffer.length);
|
||||
const compressedBlockSize = compressBlock(
|
||||
source,
|
||||
destination,
|
||||
0,
|
||||
source.length,
|
||||
0,
|
||||
);
|
||||
let output = Buffer.from(destination);
|
||||
|
||||
if (compressedBlockSize === 0 || compressedBlockSize >= buffer.length) {
|
||||
const footerBuffer = toDVPLFooter(
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
export async function patientFetchJSON<Type extends object>(
|
||||
url: string,
|
||||
timeout = 1000,
|
||||
options?: Partial<{ cache: 'no-store' }>,
|
||||
) {
|
||||
let patientJSON: Type;
|
||||
|
||||
while (patientJSON! === undefined) {
|
||||
try {
|
||||
patientJSON = (await fetch(url, options).then((response) =>
|
||||
response.json(),
|
||||
)) as Type;
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`Failed to fetch ${url} as JSON; retrying in ${timeout}ms...`,
|
||||
error,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, timeout));
|
||||
}
|
||||
}
|
||||
|
||||
return patientJSON;
|
||||
}
|
||||
Submodule submodules/blitzkit-closed updated: d02367e173...c1d631764f.
Reference in new issue
Block a user