mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-04-18 11:50:00 +08:00

* fix: fine allow redefining Function.prototype.toString * wip * wip * wip * wip * wip * wip * wip * fix: contentType encoding * wip * fix: error throwing * wip * fix * wip * fix * fix * fix: jsdom * wip * wip * fix: links summary uniqueness * wip * wip * robots-txt catch no robots.txt * deps: remove puppeteer-extra-plugin-stealth * fix: dont change waring type * fix: curl * fix: replace firebase-roundtrip-check with blackhole-detector * fix: black hole detection * sercher: black hole detecting * fix: no h2c for searcher * fix: bhd * fix: search and crawl conflict * fix: bhd * fix * fix: server script * canvas: fixed avif issue * logging: move some to debug * fix * fix: pptr declare ready only when page can be created without issues * fix: bhd * cd: cloud run deploy-health-check cannot complete pptr newPage * cd: fix * fix: curl body can be null * fix * fix * fix: major fix regarding TC pdfs * fix * fix * deps: fix civkit trie router issue * fix * boom: total restructure * cd: fix docker ctx * fix * fix: switch to h2c * cd: ensure http2
66 lines
1.3 KiB
TypeScript
66 lines
1.3 KiB
TypeScript
import { Also, Prop, parseJSONText } from 'civkit';
|
|
import { FirestoreRecord } from '../shared/lib/firestore';
|
|
import _ from 'lodash';
|
|
|
|
@Also({
|
|
dictOf: Object
|
|
})
|
|
export class PDFContent extends FirestoreRecord {
|
|
static override collectionName = 'pdfs';
|
|
|
|
override _id!: string;
|
|
|
|
@Prop({
|
|
required: true
|
|
})
|
|
src!: string;
|
|
|
|
@Prop({
|
|
required: true
|
|
})
|
|
urlDigest!: string;
|
|
|
|
@Prop()
|
|
meta?: { [k: string]: any; };
|
|
|
|
@Prop()
|
|
text?: string;
|
|
|
|
@Prop()
|
|
content?: string;
|
|
|
|
@Prop()
|
|
createdAt!: Date;
|
|
|
|
@Prop()
|
|
expireAt?: Date;
|
|
|
|
static patchedFields = [
|
|
'meta'
|
|
];
|
|
|
|
static override from(input: any) {
|
|
for (const field of this.patchedFields) {
|
|
if (typeof input[field] === 'string') {
|
|
input[field] = parseJSONText(input[field]);
|
|
}
|
|
}
|
|
|
|
return super.from(input) as PDFContent;
|
|
}
|
|
|
|
override degradeForFireStore() {
|
|
const copy: any = { ...this };
|
|
|
|
for (const field of (this.constructor as typeof PDFContent).patchedFields) {
|
|
if (typeof copy[field] === 'object') {
|
|
copy[field] = JSON.stringify(copy[field]) as any;
|
|
}
|
|
}
|
|
|
|
return copy;
|
|
}
|
|
|
|
[k: string]: any;
|
|
}
|