@teipublisher/pb-components 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
@@ -3,19 +3,21 @@ import { Registry } from "./registry.js";
3
3
  /**
4
4
  * Connector for the corporate archive of Georgfischer AG.
5
5
  */
6
- export class GF extends Registry {
6
+ export class Anton extends Registry {
7
7
 
8
8
  constructor(configElem) {
9
9
  super(configElem);
10
+ this._url = configElem.getAttribute('url') || `https://archives.georgfischer.com/api`;
10
11
  this._api = configElem.getAttribute('api');
11
12
  this._limit = configElem.getAttribute('limit') || 999999;
13
+ this._provider = configElem.getAttribute('provider') || configElem.getAttribute('connector')
12
14
  }
13
15
 
14
16
  async query(key) {
15
17
  const results = [];
16
18
 
17
19
  const register = this.getRegister();
18
- const url = `https://archives.georgfischer.com/api/${register}?search=${encodeURIComponent(key)}&perPage=${this._limit}`;
20
+ const url = `${this._url}/${register}?search=${encodeURIComponent(key)}&perPage=${this._limit}`;
19
21
  const label = this.getLabelField();
20
22
  return new Promise((resolve) => {
21
23
  fetch(url)
@@ -38,9 +40,9 @@ export class GF extends Registry {
38
40
  id: (this._prefix ? `${this._prefix}-${item.id}` : item.id),
39
41
  label: item[label],
40
42
  details: `${item.id}`,
41
- link: `https://archives.georgfischer.com/api/${register}/${item.id}`,
43
+ link: `${this._url}/${register}/${item.id}`,
42
44
  strings: [item[label]],
43
- provider: 'GF'
45
+ provider: this._provider
44
46
  };
45
47
  results.push(result);
46
48
  });
@@ -87,7 +89,7 @@ export class GF extends Registry {
87
89
  */
88
90
  async getRecord(key) {
89
91
  const id = key.replace(/^.*-([^-]+)$/, '$1');
90
- const url = `https://archives.georgfischer.com/api/${this.getRegister()}/${id}`;
92
+ const url = `${this._url}/${this.getRegister()}/${id}`;
91
93
  return fetch(url)
92
94
  .then(response => response.json())
93
95
  .then(json => {
@@ -3,7 +3,7 @@ import { GeoNames } from './geonames.js';
3
3
  import { Airtable } from './airtable.js';
4
4
  import { GND } from './gnd.js';
5
5
  import { KBGA } from './kbga.js';
6
- import { GF } from './gf.js';
6
+ import { Anton } from './anton.js';
7
7
  import { ReconciliationService } from './reconciliation.js';
8
8
  import { Custom } from './custom.js';
9
9
 
@@ -25,8 +25,9 @@ export function createConnectors(endpoint, root) {
25
25
  case 'KBGA':
26
26
  instance = new KBGA(configElem);
27
27
  break;
28
+ case 'Anton':
28
29
  case 'GF':
29
- instance = new GF(configElem);
30
+ instance = new Anton(configElem);
30
31
  break;
31
32
  case 'ReconciliationService':
32
33
  instance = new ReconciliationService(configElem);