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.6 to 0.0.7

built-frontend/static/js/main.9395996d.js

30

dist/gen.js

@@ -23,2 +23,3 @@ "use strict";

const logger_1 = require("./logger");
const constants_1 = require("./constants");
function walkPDFDFS(dir) {

@@ -134,2 +135,10 @@ if (!fs_1.default.existsSync(dir)) {

exports.getDocIDFromTexts = getDocIDFromTexts;
function getDocIDFromUrl(url) {
const regexpArxiv = new RegExp("https://arxiv[.]org/pdf/([0-9]{4}[.][0-9]{4,5})[.]pdf", "g");
const foundArxiv = [...url.matchAll(regexpArxiv)];
for (const f of foundArxiv) {
return { doi: null, isbn: null, arxiv: f[1], path: null };
}
return null;
}
function getDocIDManuallyWritten(pdf) {

@@ -220,3 +229,3 @@ const regexpDOI1 = new RegExp("(doi_10_[0-9]{4}_[0-9]{4,}([_-][0-9()-]{6,})?)", "g");

if (path_1.default.basename(pdf, ".pdf").endsWith("no_id") ||
pdf.includes("[jendeley no id]")) {
pdf.includes(constants_1.JENDELEY_NO_ID)) {
return {

@@ -272,3 +281,3 @@ doi: null,

exports.getDocIDFromTitle = getDocIDFromTitle;
function getDocID(pdf, papers_dir, is_book) {
function getDocID(pdf, papers_dir, is_book, download_url) {
return __awaiter(this, void 0, void 0, function* () {

@@ -280,2 +289,8 @@ const pdf_fullpath = path_1.default.join(papers_dir, pdf);

}
if (download_url != null) {
const docIDFromUrl = getDocIDFromUrl(download_url);
if (docIDFromUrl != null) {
return docIDFromUrl;
}
}
// Titles of chapters are sometimes confusing such as "Reference".

@@ -448,3 +463,3 @@ if (!is_book) {

exports.genDummyDB = genDummyDB;
function registerNonBookPDF(papers_dir, pdf, json_db, comments, tags, rename_using_title) {
function registerNonBookPDF(papers_dir, pdf, json_db, comments, tags, rename_using_title, download_url) {
return __awaiter(this, void 0, void 0, function* () {

@@ -459,3 +474,3 @@ logger_1.logger.info("papers_dir = " +

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

@@ -534,2 +549,5 @@ const t = yield getJson(docID, pdf);

}
if (p.includes(constants_1.JENDELEY_NO_TRACK)) {
continue;
}
logger_1.logger.info("Processing " + p);

@@ -543,3 +561,3 @@ let is_book = false;

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

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

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

@@ -560,0 +578,0 @@ }

43

dist/gen.test.js

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

const pdf = "DistributedLearning/[Jeffrey Dean] Large Scale Distributed Deep Networks [jendeley no id].pdf";
const docID = yield (0, gen_1.getDocID)(pdf, "/hoge/", false);
const docID = yield (0, gen_1.getDocID)(pdf, "/hoge/", false, null);
const t = yield (0, gen_1.getJson)(docID, pdf);

@@ -49,3 +49,3 @@ expect(t).toBeTruthy();

const pdf4 = "hoge_no_id.pdf";
const docID4 = yield (0, gen_1.getDocID)(pdf4, "/hoge/", false);
const docID4 = yield (0, gen_1.getDocID)(pdf4, "/hoge/", false, null);
expect(docID4).toStrictEqual({

@@ -58,5 +58,16 @@ arxiv: null,

}));
test("arXiv from URL", () => __awaiter(void 0, void 0, void 0, function* () {
const pdf = "hoge.pdf";
const url = "https://arxiv.org/pdf/2212.07677.pdf";
const docID = yield (0, gen_1.getDocID)(pdf, "/hoge/", false, url);
expect(docID).toStrictEqual({
arxiv: "2212.07677",
doi: null,
isbn: null,
path: null,
});
}));
test("ISBN from path", () => __awaiter(void 0, void 0, void 0, function* () {
const pdf5 = "hoge_isbn_9781467330763.pdf";
const docID5 = yield (0, gen_1.getDocID)(pdf5, "/hoge/", false);
const docID5 = yield (0, gen_1.getDocID)(pdf5, "/hoge/", false, null);
expect(docID5).toStrictEqual({

@@ -71,3 +82,3 @@ arxiv: null,

const pdf6 = "hoge_doi_10_1145_3290364.pdf";
const docID6 = yield (0, gen_1.getDocID)(pdf6, "/hoge/", false);
const docID6 = yield (0, gen_1.getDocID)(pdf6, "/hoge/", false, null);
expect(docID6).toStrictEqual({

@@ -80,3 +91,3 @@ arxiv: null,

const pdf7 = "A Dependently Typed Assembly Language_doi_10_1145_507635_507657.pdf";
const docID7 = yield (0, gen_1.getDocID)(pdf7, "/hoge/", false);
const docID7 = yield (0, gen_1.getDocID)(pdf7, "/hoge/", false, null);
expect(docID7).toStrictEqual({

@@ -91,3 +102,3 @@ arxiv: null,

const pdf2 = "DependentType/[EDWIN BRADY] Idris, a General Purpose Dependently Typed Programming Language- Design and Implementation_doi_10_1017_S095679681300018X.pdf";
const docID2 = yield (0, gen_1.getDocID)(pdf2, "/hoge/", false);
const docID2 = yield (0, gen_1.getDocID)(pdf2, "/hoge/", false, null);
expect(docID2).toStrictEqual({

@@ -100,3 +111,3 @@ arxiv: null,

const pdf4 = "MemoryModel/[Scott Owens, Susmit Sarkar, Peter Sewell] A Better x86 Memory Model x86-TSO_doi_10_1007_978-3-642-03359-9_27.pdf";
const docID4 = yield (0, gen_1.getDocID)(pdf4, "/hoge/", false);
const docID4 = yield (0, gen_1.getDocID)(pdf4, "/hoge/", false, null);
expect(docID4).toStrictEqual({

@@ -109,3 +120,3 @@ arxiv: null,

const pdf5 = "Riffle An Efficient Communication System with Strong Anonymity_doi_10_1515_popets-2016-0008.pdf";
const docID5 = yield (0, gen_1.getDocID)(pdf5, "/hoge/", false);
const docID5 = yield (0, gen_1.getDocID)(pdf5, "/hoge/", false, null);
expect(docID5).toStrictEqual({

@@ -118,3 +129,3 @@ arxiv: null,

const pdf7 = "[Peter Dybjer] Inductive families_doi_10_1007_BF01211308.pdf";
const docID7 = yield (0, gen_1.getDocID)(pdf7, "/hoge/", false);
const docID7 = yield (0, gen_1.getDocID)(pdf7, "/hoge/", false, null);
expect(docID7).toStrictEqual({

@@ -127,3 +138,3 @@ arxiv: null,

const pdf9 = "[Henk Barendregt] Lambda Calculus with Types_doi_10_1017_CBO9781139032636.pdf";
const docID9 = yield (0, gen_1.getDocID)(pdf9, "/hoge/", false);
const docID9 = yield (0, gen_1.getDocID)(pdf9, "/hoge/", false, null);
expect(docID9).toStrictEqual({

@@ -138,3 +149,3 @@ arxiv: null,

const pdf1 = "Call-by-name, call-by-value and the λ-calculus_doi_10_1016_0304-3975(75)90017-1.pdf";
const docID1 = yield (0, gen_1.getDocID)(pdf1, "/hoge/", false);
const docID1 = yield (0, gen_1.getDocID)(pdf1, "/hoge/", false, null);
expect(docID1).toStrictEqual({

@@ -147,3 +158,3 @@ arxiv: null,

const pdf3 = "Emerging-MPEG-Standards-for-Point-Cloud-Compression_doi_10_1109_JETCAS_2018_2885981.pdf";
const docID3 = yield (0, gen_1.getDocID)(pdf3, "/hoge/", false);
const docID3 = yield (0, gen_1.getDocID)(pdf3, "/hoge/", false, null);
expect(docID3).toStrictEqual({

@@ -156,3 +167,3 @@ arxiv: null,

const pdf10 = "[John C. Reynolds] Separation Logic A Logic for Shared Mutable Data Structures_doi_10_1109_LICS_2002_1029817.pdf";
const docID10 = yield (0, gen_1.getDocID)(pdf10, "/hoge/", false);
const docID10 = yield (0, gen_1.getDocID)(pdf10, "/hoge/", false, null);
expect(docID10).toStrictEqual({

@@ -167,3 +178,3 @@ arxiv: null,

const pdf6 = "MultistageProgramming/[Oleg Kiselyov] The Design and Implementation of BER MetaOCaml_doi_10_1007_978-3-319-07151-0_6.pdf";
const docID6 = yield (0, gen_1.getDocID)(pdf6, "/hoge/", false);
const docID6 = yield (0, gen_1.getDocID)(pdf6, "/hoge/", false, null);
expect(docID6).toStrictEqual({

@@ -176,3 +187,3 @@ arxiv: null,

const pdf11 = "[Paul Blain Levy] Call By Push Value_doi_10_1007_978-94-007-0954-6.pdf";
const docID11 = yield (0, gen_1.getDocID)(pdf11, "/hoge/", false);
const docID11 = yield (0, gen_1.getDocID)(pdf11, "/hoge/", false, null);
expect(docID11).toStrictEqual({

@@ -187,3 +198,3 @@ arxiv: null,

const pdf8 = "lonelyplanet-china-15-full-book.pdf";
const docID8 = yield (0, gen_1.getDocID)(pdf8, "/hoge/", false);
const docID8 = yield (0, gen_1.getDocID)(pdf8, "/hoge/", false, null);
expect(docID8).toStrictEqual({

@@ -190,0 +201,0 @@ arxiv: null,

@@ -26,2 +26,3 @@ "use strict";

const logger_1 = require("./logger");
const constants_1 = require("./constants");
function checkEntry(entry) {

@@ -169,3 +170,3 @@ console.assert(entry.title != null && entry.path != null, "id = ", entry.id, "entry = ", JSON.stringify(entry, null, 2));

app.get("/api/get_db", (request, response) => {
logger_1.logger.info("Get a get_db request", request.url);
logger_1.logger.info("Get a get_db request" + request.url);
const json = JSON.parse(fs_1.default.readFileSync(db_path).toString());

@@ -230,3 +231,3 @@ let db_response = [];

tags.push(date_tag);
json = yield (0, gen_1.registerNonBookPDF)(path_1.default.dirname(db_path), filename, json, req.comments, tags, true);
json = yield (0, gen_1.registerNonBookPDF)(path_1.default.dirname(db_path), filename, json, req.comments, tags, true, req.url);
fs_1.default.writeFileSync(db_path, JSON.stringify(json));

@@ -269,2 +270,35 @@ response.writeHead(200, {

});
app.delete("/api/delete_entry", jsonParser, (request, response) => {
logger_1.logger.info("Get a delete_entry request url = " + request.url);
const entry_o = request.body;
if (entry_o["id"] != undefined) {
const entry = entry_o;
let json = JSON.parse(fs_1.default.readFileSync(db_path).toString());
if (json[entry.id] != undefined &&
json[entry.id]["path"] != undefined) {
logger_1.logger.info("Delete " + json[entry.id]["path"]);
const old_filename = path_1.default.join(path_1.default.dirname(db_path), json[entry.id]["path"]);
const dir = path_1.default.dirname(old_filename);
const new_filename = path_1.default.join(dir, path_1.default.basename(old_filename, ".pdf") +
" " +
constants_1.JENDELEY_NO_TRACK +
".pdf");
logger_1.logger.info("Rename " + old_filename + " to " + new_filename);
fs_1.default.renameSync(old_filename, new_filename);
delete json[entry.id];
}
fs_1.default.writeFileSync(db_path, JSON.stringify(json));
}
else {
logger_1.logger.warn("Object from the client is not legitimated. entry_o = " +
JSON.stringify(entry_o));
}
response.writeHead(200, {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,PUT,POST,DELETE",
});
response.end();
logger_1.logger.info("Sent a response from delete_entry");
});
app.listen(port, () => {

@@ -271,0 +305,0 @@ logger_1.logger.info(`jendeley backend server is listening on port ${port}`);

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

},
"version": "0.0.6",
"version": "0.0.7",
"description": "",

@@ -16,5 +16,5 @@ "main": "index.js",

"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"test_scan_test_pdfs": "npm run build && node --require source-map-support/register dist/index.js scan --papers_dir test_pdfs",
"scan_test_pdfs": "npm run build && node --require source-map-support/register dist/index.js scan --papers_dir test_pdfs",
"profile_scan_test_pdfs": "npm run build && node --require source-map-support/register --prof dist/index.js scan --papers_dir test_pdfs",
"scan_test_pdfs_and_launch": "npm run build && node --require source-map-support/register dist/index.js scan --papers_dir test_pdfs && node --require source-map-support/register dist/index.js launch --db test_pdfs/db.json",
"scan_test_pdfs_and_launch": "npm run build && node --require source-map-support/register dist/index.js scan --papers_dir test_pdfs && node --require source-map-support/register dist/index.js launch --db test_pdfs/jendeley_db.json",
"fix:prettier": "prettier --write src",

@@ -27,3 +27,3 @@ "check:prettier": "prettier --check src"

},
"keywords": [],
"keywords": ["JSON", "paper", "PDF", "React"],
"author": "",

@@ -34,3 +34,3 @@ "license": "ISC",

},
"homepage": "https://github.com/akawashiro/jendeley/jendeley-backend#readme",
"homepage": "https://github.com/akawashiro/jendeley/tree/main/jendeley-backend#readme",
"devDependencies": {

@@ -44,3 +44,4 @@ "@types/base-64": "^1.0.0",

"typescript": "^4.9.3",
"prettier": "2.8.0"
"prettier": "2.8.0",
"jest": "^29.3.1"
},

@@ -55,3 +56,2 @@ "dependencies": {

"got": "^12.5.3",
"jest": "^29.3.1",
"pdf-parse": "^1.1.1",

@@ -58,0 +58,0 @@ "pino": "^8.7.0",

# jendeley
`jendeley` is a JSON-based paper organizing software.
- `jendeley` is JSON-based. You can see and edit your database easily.
- `jendeley` can work locally. Your important database is owned only by you. Not cloud.
- `jendeley` is working locally. Your important database is owned only by you. Not cloud.
- `jendeley` is browser based. You can run it anywhere node.js runs.

@@ -6,0 +6,0 @@

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