Skip to content

Commit 34cf38c

Browse files
committed
chore: release v3.1.7
1 parent 038ea9f commit 34cf38c

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed

fulltext-attach-plugin/bootstrap.js

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var FulltextAttachEndpoint;
22
var OpenCodeWriteEndpoint;
33
var PluginVersionEndpoint;
4-
var PLUGIN_VERSION = "3.1.4";
4+
var PLUGIN_VERSION = "3.1.7";
55
var FULLTEXT_ATTACH_PATH = "/fulltext-attach";
66
var LOCAL_WRITE_PATH = "/opencode-zotero-write";
77
var VERSION_PATH = "/opencode-zotero-plugin-version";
@@ -14,6 +14,7 @@ var TESTED_ZOTERO_VERSION = "8.0.1";
1414
var PLUGIN_CAPABILITIES = [
1515
"fulltext_attach",
1616
"local_write",
17+
"create_item",
1718
"version_probe",
1819
];
1920

@@ -617,6 +618,49 @@ async function handleMergeItems(data) {
617618
});
618619
}
619620

621+
async function handleCreateItem(data) {
622+
let itemType = requireNonEmptyString(data.item_type, "item_type");
623+
let fields = data.fields ? requireObject(data.fields, "fields") : {};
624+
let tags = data.tags ? normalizeStringList(data.tags, "tags") : [];
625+
let collectionKeys = data.collection_keys
626+
? normalizeStringList(data.collection_keys, "collection_keys")
627+
: [];
628+
629+
for (let collectionKey of collectionKeys) {
630+
await getUserCollectionOrThrow(collectionKey);
631+
}
632+
633+
let item = new Zotero.Item(itemType);
634+
item.libraryID = userLibraryID();
635+
636+
let json = item.toJSON();
637+
Object.assign(json, fields);
638+
item.fromJSON(json);
639+
640+
if (tags.length) {
641+
item.setTags(tags);
642+
}
643+
if (collectionKeys.length) {
644+
item.setCollections(collectionKeys);
645+
}
646+
647+
await item.saveTx();
648+
649+
return successResult(
650+
"create_item",
651+
{
652+
item_type: itemType,
653+
field_names: Object.keys(fields).sort(),
654+
tag_count: tags.length,
655+
collection_count: collectionKeys.length,
656+
},
657+
{
658+
item_key: item.key,
659+
item_id: item.id,
660+
}
661+
);
662+
}
663+
620664
async function runOpenCodeWrite(data) {
621665
let operation = requireNonEmptyString(data.operation, "operation");
622666
switch (operation) {
@@ -660,6 +704,8 @@ async function runOpenCodeWrite(data) {
660704
return handleCopyItem(data);
661705
case "merge_items":
662706
return handleMergeItems(data);
707+
case "create_item":
708+
return handleCreateItem(data);
663709
default:
664710
throw new Error("Unsupported operation: " + operation);
665711
}

fulltext-attach-plugin/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
},
1717
"manifest_version": 2,
1818
"name": "Fulltext Attachment API",
19-
"version": "3.1.6"
19+
"version": "3.1.7"
2020
}

fulltext-attach-plugin/updates.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"strict_min_version": "7.0"
1010
}
1111
},
12-
"update_hash": "sha256:3d85981cbd907430870c0107d3566c7636f4ce048d8bd107bb280fc241c319b3",
13-
"update_link": "https://github.com/dzackgarza/zotero-attachment-plugin/releases/download/v3.1.6/fulltext-attach-plugin-3.1.6.xpi",
14-
"version": "3.1.6"
12+
"update_hash": "sha256:ae9414cf43f8da4c277a5d3a428b07cd35fb8196e597a7d9762c36f352a958d8",
13+
"update_link": "https://github.com/dzackgarza/zotero-attachment-plugin/releases/download/v3.1.7/fulltext-attach-plugin-3.1.7.xpi",
14+
"version": "3.1.7"
1515
}
1616
]
1717
}

fulltext-attach-plugin/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
"""Canonical release metadata for the Zotero attachment plugin."""
33

4-
VERSION = "3.1.6"
4+
VERSION = "3.1.7"
55

66
REPO_OWNER = "dzackgarza"
77
REPO_NAME = "zotero-attachment-plugin"

0 commit comments

Comments
 (0)