Skip to content

Commit afa23a7

Browse files
author
Markus Hunsalz
committed
added typeName config param
1 parent 02cc0bc commit afa23a7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ class WikidataSource {
2727

2828
if (!this.options.url) {
2929
throw new Error(
30-
`Missing url endpoint. Please provide a valid url endpoint.`
30+
`Missing 'url' endpoint. Please provide a valid url endpoint.`
3131
);
3232
}
3333

3434
if (!this.options.sparql) {
3535
throw new Error(
36-
`Missing sparql query. Please provide a valid sparql query.`
36+
`Missing 'sparql' query. Please provide a valid sparql query.`
37+
);
38+
}
39+
40+
if (!this.options.typeName) {
41+
throw new Error(
42+
`Missing 'typeName' label. Please provide a type name label.`
3743
);
3844
}
3945

@@ -72,7 +78,9 @@ class WikidataSource {
7278
async fetchWikidata(actions) {
7379
this.info("Fetching Wikidata ...");
7480
const queryDispatcher = new SPARQLQueryDispatcher(this.options.url);
75-
const collection = actions.addCollection({ typeName: "Record" });
81+
const collection = actions.addCollection({
82+
typeName: this.options.typeName
83+
});
7684
const downloads = [];
7785
const dir = process.cwd() + this.options.baseDir;
7886
// query Wikidata and process items

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.0.6",
2+
"version": "0.0.7",
33
"name": "gridsome-source-wikidata",
44
"description": "Wikidata source for Gridsome",
55
"homepage": "https://github.com/hunsalz/gridsome-source-wikidata",

0 commit comments

Comments
 (0)