Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@a_kawashiro/jendeley

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@a_kawashiro/jendeley - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

built-frontend/static/js/main.b2a2a92b.js

44

dist/docid.js

@@ -209,3 +209,3 @@ "use strict";

exports.getDocIDManuallyWritten = getDocIDManuallyWritten;
function getTitleFromPDF(pdf, papers_dir) {
function getTitleFromPDF(pdf, papersDir) {
return __awaiter(this, void 0, void 0, function* () {

@@ -215,6 +215,6 @@ const pdfExtract = new pdf_js_extract_1.PDFExtract();

const data = yield pdfExtract
.extract(path_1.default.join(papers_dir, pdf), options)
.extract(path_1.default.join(papersDir, pdf), options)
.catch(() => {
logger_1.logger.warn("Failed to extract data using pdfExtract from " +
path_1.default.join(papers_dir, pdf));
path_1.default.join(papersDir, pdf));
return {};

@@ -226,3 +226,3 @@ });

const title = data["meta"]["metadata"]["dc:title"];
logger_1.logger.info("getTitleFromPDF(" + pdf + ", " + papers_dir + ") = " + title);
logger_1.logger.info("getTitleFromPDF(" + pdf + ", " + papersDir + ") = " + title);
return title;

@@ -234,7 +234,7 @@ }

const title = data["meta"]["info"]["Title"];
logger_1.logger.info("getTitleFromPDF(" + pdf + ", " + papers_dir + ") = " + title);
logger_1.logger.info("getTitleFromPDF(" + pdf + ", " + papersDir + ") = " + title);
return title;
}
else {
logger_1.logger.info("getTitleFromPDF(" + pdf + ", " + papers_dir + ") = null");
logger_1.logger.info("getTitleFromPDF(" + pdf + ", " + papersDir + ") = null");
return null;

@@ -244,10 +244,10 @@ }

}
function getDocIDFromTitle(pdf, papers_dir) {
function getDocIDFromTitle(pdf, papersDir) {
return __awaiter(this, void 0, void 0, function* () {
let titles = [];
const title_from_pdf = yield getTitleFromPDF(pdf, papers_dir);
if (title_from_pdf != null &&
path_1.default.extname(title_from_pdf) != ".dvi" &&
path_1.default.extname(title_from_pdf) != ".pdf") {
titles.push(title_from_pdf);
const titleFromPdf = yield getTitleFromPDF(pdf, papersDir);
if (titleFromPdf != null &&
path_1.default.extname(titleFromPdf) != ".dvi" &&
path_1.default.extname(titleFromPdf) != ".pdf") {
titles.push(titleFromPdf);
}

@@ -280,3 +280,3 @@ let { got } = yield import("got");

exports.getDocIDFromTitle = getDocIDFromTitle;
function is_valid_docID(docID) {
function isValidDocID(docID) {
if (docID.arxiv != null ||

@@ -290,5 +290,5 @@ docID.doi != null ||

}
function getDocID(pdf, papers_dir, is_book, download_url) {
function getDocID(pdf, papersDir, isBook, downloadUrl) {
return __awaiter(this, void 0, void 0, function* () {
const pdf_fullpath = path_1.default.join(papers_dir, pdf);
const pdf_fullpath = path_1.default.join(papersDir, pdf);
// Handle docIDs embedded in filenames.

@@ -300,4 +300,4 @@ const manuallyWrittenDocID = getDocIDManuallyWritten(pdf);

// Download link gives you additional information
if (download_url != null) {
const docIDFromUrl = getDocIDFromUrl(download_url);
if (downloadUrl != null) {
const docIDFromUrl = getDocIDFromUrl(downloadUrl);
if (docIDFromUrl != null) {

@@ -307,6 +307,6 @@ return docIDFromUrl;

}
// Try to get information using filename as title. Skip if `is_book` because
// Try to get information using filename as title. Skip if `isBook` because
// titles of chapters are sometimes confusing such as "Reference".
if (!is_book) {
const docIDFromTitle = yield getDocIDFromTitle(pdf, papers_dir);
if (!isBook) {
const docIDFromTitle = yield getDocIDFromTitle(pdf, papersDir);
if (docIDFromTitle != null) {

@@ -333,3 +333,3 @@ return docIDFromTitle;

logger_1.logger.info("getDocIDFromTexts(texts) = " + JSON.stringify(id));
if (is_book) {
if (isBook) {
id.doi = null;

@@ -339,3 +339,3 @@ id.arxiv = null;

}
if (is_book || is_valid_docID(id)) {
if (isBook || isValidDocID(id)) {
return id;

@@ -342,0 +342,0 @@ }

@@ -44,8 +44,8 @@ "use strict";

}
// All paths returned from walkPDF are relative path from papers_dir.
function walkPDF(papers_dir) {
// All paths returned from walkPDF are relative path from papersDir.
function walkPDF(papersDir) {
let r = [];
const pdfs = walkPDFDFS(papers_dir);
const pdfs = walkPDFDFS(papersDir);
for (const pd of pdfs) {
r.push(pd.replace(papers_dir, ""));
r.push(pd.replace(papersDir, ""));
}

@@ -256,6 +256,6 @@ return r;

exports.registerWeb = registerWeb;
function registerNonBookPDF(papers_dir, pdf, json_db, user_specified_title, comments, tags, rename_using_title, download_url) {
function registerNonBookPDF(papersDir, pdf, json_db, user_specified_title, comments, tags, rename_using_title, download_url) {
return __awaiter(this, void 0, void 0, function* () {
logger_1.logger.info("papers_dir = " +
papers_dir +
logger_1.logger.info("papersDir = " +
papersDir +
" pdf = " +

@@ -267,3 +267,3 @@ pdf +

comments);
const docID = yield (0, docid_1.getDocID)(pdf, papers_dir, false, download_url);
const docID = yield (0, docid_1.getDocID)(pdf, papersDir, false, download_url);
logger_1.logger.info("docID = " + JSON.stringify(docID));

@@ -302,7 +302,7 @@ if (docID.arxiv == null &&

json["path"] = new_filename;
if (fs_1.default.existsSync(path_1.default.join(papers_dir, new_filename))) {
if (fs_1.default.existsSync(path_1.default.join(papersDir, new_filename))) {
logger_1.logger.warn(new_filename + " already exists. Skip registration.");
return json_db;
}
fs_1.default.renameSync(path_1.default.join(papers_dir, old_fileneme), path_1.default.join(papers_dir, new_filename));
fs_1.default.renameSync(path_1.default.join(papersDir, old_fileneme), path_1.default.join(papersDir, new_filename));
logger_1.logger.info("Rename " + old_fileneme + " to " + new_filename);

@@ -319,3 +319,3 @@ }

exports.registerNonBookPDF = registerNonBookPDF;
function genDB(papers_dir, book_dirs_str, db_name) {
function genDB(papersDir, book_dirs_str, db_name) {
return __awaiter(this, void 0, void 0, function* () {

@@ -328,13 +328,13 @@ let book_dirs = book_dirs_str == "" ? [] : book_dirs_str.split(",");

}
if (book_dirs[i].startsWith(papers_dir)) {
book_dirs[i] = book_dirs[i].replace(papers_dir, "");
if (book_dirs[i].startsWith(papersDir)) {
book_dirs[i] = book_dirs[i].replace(papersDir, "");
}
}
if (!fs_1.default.existsSync(papers_dir)) {
logger_1.logger.warn("papers_dir:", papers_dir + " is not exist.");
if (!fs_1.default.existsSync(papersDir)) {
logger_1.logger.warn("papersDir:", papersDir + " is not exist.");
return;
}
for (const bd of book_dirs) {
if (!fs_1.default.existsSync(path_1.default.join(papers_dir, bd))) {
logger_1.logger.warn("bd:", path_1.default.join(papers_dir, bd) + " is not exist.");
if (!fs_1.default.existsSync(path_1.default.join(papersDir, bd))) {
logger_1.logger.warn("bd:", path_1.default.join(papersDir, bd) + " is not exist.");
return;

@@ -346,4 +346,4 @@ }

let exsting_pdfs = [];
if (fs_1.default.existsSync(path_1.default.join(papers_dir, db_name))) {
json_db = JSON.parse(fs_1.default.readFileSync(path_1.default.join(papers_dir, db_name)).toString());
if (fs_1.default.existsSync(path_1.default.join(papersDir, db_name))) {
json_db = JSON.parse(fs_1.default.readFileSync(path_1.default.join(papersDir, db_name)).toString());
for (const id of Object.keys(json_db)) {

@@ -353,3 +353,3 @@ exsting_pdfs.push(json_db[id]["path"]);

}
let pdfs = walkPDF(papers_dir);
let pdfs = walkPDF(papersDir);
pdfs.sort();

@@ -369,3 +369,3 @@ pdfs = pdfs.filter((p) => !p.includes(constants_1.JENDELEY_NO_TRACK));

is_book = true;
const docID = yield (0, docid_1.getDocID)(p, papers_dir, true, null);
const docID = yield (0, docid_1.getDocID)(p, papersDir, true, null);
const t = yield getJson(docID, p);

@@ -383,3 +383,3 @@ if (t != null && t[0]["id_type"] == "isbn") {

if (!is_book) {
json_db = yield registerNonBookPDF(papers_dir, p, json_db, null, "", [], false, null);
json_db = yield registerNonBookPDF(papersDir, p, json_db, null, "", [], false, null);
}

@@ -447,6 +447,6 @@ }

'"' +
path_1.default.join(papers_dir, nr) +
path_1.default.join(papersDir, nr) +
'"' +
' "' +
path_1.default.join(papers_dir, nr) +
path_1.default.join(papersDir, nr) +
'"\n';

@@ -457,4 +457,4 @@ }

try {
const db_path = path_1.default.join(papers_dir, db_name);
fs_1.default.writeFileSync(db_path, JSON.stringify(json_db));
const dbPath = path_1.default.join(papersDir, db_name);
fs_1.default.writeFileSync(dbPath, JSON.stringify(json_db));
}

@@ -461,0 +461,0 @@ catch (err) {

@@ -114,2 +114,13 @@ "use strict";

}));
test("DOI from path", () => __awaiter(void 0, void 0, void 0, function* () {
const pdf = "Everything Old is New Again Binary Security of WebAssembly [jendeley doi 10_5555_3489212_3489225].pdf";
const docID = yield (0, docid_1.getDocID)(pdf, "/hoge/", false, null);
expect(docID).toStrictEqual({
arxiv: null,
doi: "10.5555/3489212.3489225",
isbn: null,
path: null,
url: null,
});
}));
test("Complicated doi from path", () => __awaiter(void 0, void 0, void 0, function* () {

@@ -116,0 +127,0 @@ const pdf2 = "DependentType/[EDWIN BRADY] Idris, a General Purpose Dependently Typed Programming Language- Design and Implementation [jendeley doi 10_1017_S095679681300018X].pdf";

@@ -19,3 +19,3 @@ #!/usr/bin/env node

const program = new commander_1.Command();
program.name("jendeley").version("0.0.12", "-v, --version");
program.name("jendeley").version("0.0.15", "-v, --version");
program

@@ -22,0 +22,0 @@ .command("scan")

@@ -24,4 +24,4 @@ "use strict";

const api_1 = require("./api");
function startServer(db_path, no_browser, port) {
if (fs_1.default.existsSync(db_path)) {
function startServer(dbPath, noBrowser, port) {
if (fs_1.default.existsSync(dbPath)) {
const app = (0, express_1.default)();

@@ -35,19 +35,19 @@ app.use((0, cors_1.default)());

app.get("/api/get_db", (request, response) => {
(0, api_1.getDB)(request, response, db_path);
(0, api_1.getDB)(request, response, dbPath);
});
app.get("/api/get_pdf", (request, response) => {
(0, api_1.getPdf)(request, response, db_path);
(0, api_1.getPdf)(request, response, dbPath);
});
let jsonParser = body_parser_1.default.json();
app.put("/api/add_pdf_from_url", jsonParser, (httpRequest, response) => __awaiter(this, void 0, void 0, function* () {
(0, api_1.addPdfFromUrl)(httpRequest, response, db_path);
(0, api_1.addPdfFromUrl)(httpRequest, response, dbPath);
}));
app.put("/api/add_web_from_url", jsonParser, (httpRequest, response) => __awaiter(this, void 0, void 0, function* () {
(0, api_1.addWebFromUrl)(httpRequest, response, db_path);
(0, api_1.addWebFromUrl)(httpRequest, response, dbPath);
}));
app.put("/api/update_entry", jsonParser, (request, response) => {
(0, api_1.updateEntry)(request, response, db_path);
(0, api_1.updateEntry)(request, response, dbPath);
});
app.delete("/api/delete_entry", jsonParser, (request, response) => {
(0, api_1.deleteEntry)(request, response, db_path);
(0, api_1.deleteEntry)(request, response, dbPath);
});

@@ -57,3 +57,3 @@ app.listen(port, () => {

logger_1.logger.info(`Open http://localhost:${port} with your browser`);
if (!no_browser) {
if (!noBrowser) {
(0, open_1.default)(`http://localhost:${port}`);

@@ -64,3 +64,3 @@ }

else {
logger_1.logger.error(db_path + " is not exist.");
logger_1.logger.error(dbPath + " is not exist.");
}

@@ -67,0 +67,0 @@ }

@@ -6,3 +6,3 @@ {

},
"version": "0.0.14",
"version": "0.0.15",
"description": "",

@@ -9,0 +9,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc