Giter Club home page Giter Club logo

zotero-sync-bookends's People

Contributors

cboulanger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zotero-sync-bookends's Issues

TypeError

Hi, I have set my environment variables and when I run npm test as instructed, I receive the following result:

> @cboulanger/[email protected] test
> tsc && npx ts-node test.ts

TypeError: Cannot read properties of undefined (reading '30')
    at Sync.login (/Users/josh/Documents/GitHub/zotero-sync-bookends/node_modules/@retorquere/zotero-sync/index.js:32:38)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /Users/josh/Documents/GitHub/zotero-sync-bookends/test.ts:41:5

Can you help me troubleshoot this?

Also, I had bookends-api working on my previous versions of Zotero and Bookends. Is it possible that that still works with updated versions if I can't get this working?

Errors: 'e' is of type 'unknown' & Type 'unknown' is not assignable to type 'string | null'

Hi, I'm almost done with my dissertation! Thanks for your help over the years. Do you have a patreon or paypal so I can send a little appreciation your way?

I'm trying to get zotero-sync-bookends up and running again on my M1 mac after a while. I don't know what happened to my previous setup because the api key and bookends db name were both at default in my local repo. Anyways...starting over.

What I've done so far

reading through the readme and following instructions**

  • add path to ENV variable so that zotero-sync-bookends can find node library
    • cd ../usr/bin/
    • export PATH=/Users/josh/node_modules:PATH
    • export PATH=/Users/josh/Documents/Bookends:$PATH // not sure if this is necessary but I can't see how else it knows how to find the bookends db

created a new key in Zotero portal online

The following links are accessible:

edited lines 29 and 30 in /Users/josh/node_modules/@cboulanger/zotero-sync-bookends/test.ts

  • zotero_api_key = "loremipsum";
  • bookends_db_name = "2022-09-21 bookends db";

install node packages

  • cd /Users/josh/node_modules/@cboulanger/zotero-sync-bookends
  • npm install

run!

  • npm test

Errors

I get 6 errors from /src/index.ts.

> @cboulanger/[email protected] test
> tsc && npx ts-node test.ts

src/index.ts:105:7 - error TS18046: 'e' is of type 'unknown'.

105       e.lastJxaCmd = cmd;
          ~

src/index.ts:162:11 - error TS18046: 'e' is of type 'unknown'.

162       if (e.message.includes("-1728")) {
              ~

src/index.ts:313:11 - error TS18046: 'e' is of type 'unknown'.

313       if (e.message.includes("-1728")) {
              ~

src/index.ts:329:11 - error TS18046: 'e' is of type 'unknown'.

329       if (e.message.includes("-1728")) {
              ~

src/index.ts:378:17 - error TS18046: 'e' is of type 'unknown'.

378             if (e.message.includes("-1712")) {
                    ~

src/index.ts:380:15 - error TS2322: Type 'unknown' is not assignable to type 'string | null'.

380               error = e;
                  ~~~~~


Found 6 errors in the same file, starting at: src/index.ts:105

Index.ts

Here's the section of index.ts that I think it's referencing in the error:

const citekey = this.generateCitekey(item);
switch (item.itemType) {
case "attachment":
case "note":
break;
default: {
let tries = 0;
let error: null | string = null;
while(tries++ < this.maxTries) {
try {
const storedData = await this.getPublicationByCitekey(citekey)
const data = this.zoteroToBookends(item, citekey);
if (storedData) {
const changedProperties = Object.keys(data).filter( key => data[key] !== storedData[key]);
if (changedProperties.length) {
// update if item has changed
const changedData: {[key: string]: string} = {};
changedProperties.forEach(key => changedData[key] = data[key]);
this.logVerbose(`Updating item '${data.title}', properties ${Object.keys(changedData).join(",")}`);
await this.updatePublication(Number(storedData.id), changedData);
}
} else {
this.logVerbose(`Adding item '${data.title}' ...`);
await this.addPublication(data);
}
// success!
error = null;
break; // break while-loop
} catch (e) {
if (e.message.includes("-1712")) {
// timeout, try again
error = e;
continue;
}
// try to save metadata, including last index, ignoring any errors
try {
await this.saveMetadata();
} catch (e) {}
throw e;
}
}
if (error) {
throw error;
}
this.lastIndex++;
// save metadata every 10 items so that this doesn't slow things down too much
if (this.lastIndex % 10 === 0) {
await this.saveMetadata();
}
}

Bookend TO Zotero one-way Sync?

As I understand it, you are doing a one-way zotero > bookends sync. Is it practical to do this the other way round, treat bookends as the "upstream" database, and mirror those changes to a zotero one? The use case is that I prefer to search/add/build references in bookends, but want to share them with others. Syncing to a zotero mirror would solve this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.