Compare commits
No commits in common. "f8e2930ec1c98943e903a4144b7b2bd752d059b5" and "6e233991b446a47d6bbde86ad07a273361cc42a0" have entirely different histories.
f8e2930ec1
...
6e233991b4
5 changed files with 25 additions and 22 deletions
1
.npmrc
1
.npmrc
|
@ -1,2 +1 @@
|
|||
link-workspace-packages=true
|
||||
@jsr:registry=https://npm.jsr.io
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@std/async": "npm:@jsr/std__async@^1.0.12",
|
||||
"@zip.js/zip.js": "^2.7.52",
|
||||
"better-sqlite3": "^9.6.0",
|
||||
"chokidar": "^3.6.0",
|
||||
|
|
|
@ -3,7 +3,6 @@ import type { DocumentBody } from "dbtype";
|
|||
import { readZip } from "../util/zipwrap.ts";
|
||||
import { type ContentConstructOption, createDefaultClass, registerContentReferrer } from "./file.ts";
|
||||
import { TextWriter } from "@zip.js/zip.js";
|
||||
import { retry } from "@std/async"
|
||||
|
||||
type ComicType = "doujinshi" | "artist cg" | "manga" | "western";
|
||||
interface ComicDesc {
|
||||
|
@ -44,16 +43,8 @@ export class ComicReferrer extends createDefaultClass("comic") {
|
|||
.then(() => zip.handle.close());
|
||||
}
|
||||
|
||||
override async createDocumentBody(): Promise<DocumentBody> {
|
||||
await retry(async () => {
|
||||
await this.initDesc();
|
||||
}, {
|
||||
jitter: 0.5,
|
||||
maxAttempts: 5,
|
||||
minTimeout: 10,
|
||||
maxTimeout: 1000,
|
||||
multiplier: 2,
|
||||
});
|
||||
async createDocumentBody(): Promise<DocumentBody> {
|
||||
await this.initDesc();
|
||||
const basebody = await super.createDocumentBody();
|
||||
this.desc?.title;
|
||||
if (this.desc === undefined) {
|
||||
|
|
|
@ -12,6 +12,29 @@ export type {
|
|||
DBDocument
|
||||
};
|
||||
|
||||
export const MetaContentBody = {
|
||||
title: "string",
|
||||
content_type: "string",
|
||||
basepath: "string",
|
||||
filename: "string",
|
||||
content_hash: "string",
|
||||
additional: "object",
|
||||
tags: "string[]",
|
||||
};
|
||||
|
||||
export const isDocBody = (c: unknown): c is DocumentBody => {
|
||||
return check_type<DocumentBody>(c, MetaContentBody);
|
||||
};
|
||||
|
||||
export const isDoc = (c: unknown): c is Document => {
|
||||
if (typeof c !== "object" || c === null) return false;
|
||||
if ("id" in c && typeof c.id === "number") {
|
||||
const { id, ...rest } = c;
|
||||
return isDocBody(rest);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export interface DocumentAccessor {
|
||||
/**
|
||||
* rescan document
|
||||
|
|
9
pnpm-lock.yaml
generated
9
pnpm-lock.yaml
generated
|
@ -169,9 +169,6 @@ importers:
|
|||
|
||||
packages/server:
|
||||
dependencies:
|
||||
'@std/async':
|
||||
specifier: npm:@jsr/std__async@^1.0.12
|
||||
version: '@jsr/std__async@1.0.12'
|
||||
'@zip.js/zip.js':
|
||||
specifier: ^2.7.52
|
||||
version: 2.7.52
|
||||
|
@ -785,9 +782,6 @@ packages:
|
|||
'@jridgewell/trace-mapping@0.3.25':
|
||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
||||
|
||||
'@jsr/std__async@1.0.12':
|
||||
resolution: {integrity: sha512-NUaSOcwMetVeVkIqet2Ammy2A5YxG8ViFxryBbTaC4h7l/cgAkU59U3zF58ek4Y8HZ0Nx5De7qBptPfp62kcgw==, tarball: https://npm.jsr.io/~/11/@jsr/std__async/1.0.12.tgz}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
|
@ -2712,7 +2706,6 @@ packages:
|
|||
node-domexception@1.0.0:
|
||||
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
|
||||
engines: {node: '>=10.5.0'}
|
||||
deprecated: Use your platform's native DOMException instead
|
||||
|
||||
node-fetch@3.3.2:
|
||||
resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==}
|
||||
|
@ -3977,8 +3970,6 @@ snapshots:
|
|||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.0
|
||||
|
||||
'@jsr/std__async@1.0.12': {}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
|
|
Loading…
Add table
Reference in a new issue