cocoda-sdk 3.6.0 → 3.6.2

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.
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  addAllProviders: () => addAllProviders,
49
49
  cdk: () => cdk,
50
50
  errors: () => errors_exports,
51
+ providers: () => providers_exports,
51
52
  utils: () => utils_exports
52
53
  });
53
54
  module.exports = __toCommonJS(index_exports);
@@ -125,55 +126,13 @@ var InvalidProviderError = class extends CDKError {
125
126
 
126
127
  // src/lib/CocodaSDK.js
127
128
  var import_axios5 = __toESM(require("axios"), 1);
128
-
129
- // src/utils/lodash.js
130
- var import_get = __toESM(require("lodash/get.js"), 1);
131
- var import_set = __toESM(require("lodash/set.js"), 1);
132
- var import_uniq = __toESM(require("lodash/uniq.js"), 1);
133
- var import_intersection = __toESM(require("lodash/intersection.js"), 1);
134
- var import_union = __toESM(require("lodash/union.js"), 1);
135
- var import_forOwn = __toESM(require("lodash/forOwn.js"), 1);
136
- var import_isArray = __toESM(require("lodash/isArray.js"), 1);
137
- var import_isObject = __toESM(require("lodash/isObject.js"), 1);
138
- var import_isString = __toESM(require("lodash/isString.js"), 1);
139
- var import_isEmpty = __toESM(require("lodash/isEmpty.js"), 1);
140
- var import_isEqual = __toESM(require("lodash/isEqual.js"), 1);
141
- var import_merge = __toESM(require("lodash/merge.js"), 1);
142
- var import_last = __toESM(require("lodash/last.js"), 1);
143
- var import_omit = __toESM(require("lodash/omit.js"), 1);
144
- var import_concat = __toESM(require("lodash/concat.js"), 1);
145
-
146
- // src/lib/CocodaSDK.js
147
129
  var import_jskos_tools14 = __toESM(require("jskos-tools"), 1);
148
130
 
149
- // src/providers/index.js
150
- var providers_exports = {};
151
- __export(providers_exports, {
152
- BaseProvider: () => BaseProvider,
153
- ConceptApiProvider: () => ConceptApiProvider,
154
- LabelSearchSuggestionProvider: () => LabelSearchSuggestionProvider,
155
- LobidApiProvider: () => LobidApiProvider,
156
- LocApiProvider: () => LocApiProvider,
157
- LocalMappingsProvider: () => LocalMappingsProvider,
158
- MappingsApiProvider: () => MappingsApiProvider,
159
- ModApiProvider: () => ModApiProvider,
160
- MyCoReProvider: () => MyCoReProvider,
161
- NoTApiProvider: () => NoTApiProvider,
162
- OccurrencesApiProvider: () => OccurrencesApiProvider,
163
- OlsApiProvider: () => OlsApiProvider,
164
- ReconciliationApiProvider: () => ReconciliationApiProvider,
165
- SkohubProvider: () => SkohubProvider,
166
- SkosmosApiProvider: () => SkosmosApiProvider
167
- });
168
-
169
- // src/providers/base-provider.js
170
- var import_jskos_tools = __toESM(require("jskos-tools"), 1);
171
- var import_axios = __toESM(require("axios"), 1);
172
-
173
131
  // src/utils/index.js
174
132
  var utils_exports = {};
175
133
  __export(utils_exports, {
176
134
  concatUrl: () => concatUrl,
135
+ deepEqual: () => deepEqual,
177
136
  listOfCapabilities: () => listOfCapabilities,
178
137
  requestMethods: () => requestMethods,
179
138
  withCustomProps: () => withCustomProps
@@ -347,9 +306,53 @@ var listOfCapabilities = [
347
306
  "annotations",
348
307
  "occurrences"
349
308
  ];
309
+ var deepEqual = (a, b) => {
310
+ if (a === b) {
311
+ return true;
312
+ }
313
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
314
+ return false;
315
+ }
316
+ if (Object.keys(a).length === Object.keys(b).length) {
317
+ for (let key in a) {
318
+ if (!(key in b)) {
319
+ return false;
320
+ }
321
+ if (!deepEqual(a[key], b[key])) {
322
+ return false;
323
+ }
324
+ }
325
+ return true;
326
+ }
327
+ return false;
328
+ };
329
+
330
+ // src/providers/index.js
331
+ var providers_exports = {};
332
+ __export(providers_exports, {
333
+ BaseProvider: () => BaseProvider,
334
+ ConceptApiProvider: () => ConceptApiProvider,
335
+ LabelSearchSuggestionProvider: () => LabelSearchSuggestionProvider,
336
+ LobidApiProvider: () => LobidApiProvider,
337
+ LocApiProvider: () => LocApiProvider,
338
+ LocalMappingsProvider: () => LocalMappingsProvider,
339
+ MappingsApiProvider: () => MappingsApiProvider,
340
+ ModApiProvider: () => ModApiProvider,
341
+ MyCoReProvider: () => MyCoReProvider,
342
+ NoTApiProvider: () => NoTApiProvider,
343
+ OccurrencesApiProvider: () => OccurrencesApiProvider,
344
+ OlsApiProvider: () => OlsApiProvider,
345
+ ReconciliationApiProvider: () => ReconciliationApiProvider,
346
+ SkohubProvider: () => SkohubProvider,
347
+ SkosmosApiProvider: () => SkosmosApiProvider
348
+ });
350
349
 
351
350
  // src/providers/base-provider.js
351
+ var import_jskos_tools = __toESM(require("jskos-tools"), 1);
352
+ var import_axios = __toESM(require("axios"), 1);
353
+ var intersection = (arrays) => arrays.reduce((a, b) => a.filter((c) => b.includes(c)));
352
354
  var BaseProvider = class {
355
+ static providerName = "Base";
353
356
  /**
354
357
  * Provider constructor.
355
358
  *
@@ -395,16 +398,21 @@ var BaseProvider = class {
395
398
  annotations: registry.annotations,
396
399
  occurrences: registry.occurrences,
397
400
  reconcile: registry.reconcile,
398
- api: registry.api
401
+ api: registry.endpoint || registry.api
399
402
  };
400
403
  this._config = {};
401
404
  this.setRetryConfig();
402
405
  this.axios.interceptors.request.use((config = {}) => {
403
406
  if (!config._skipAdditionalParameters) {
404
- const language = import_uniq.default([].concat(import_get.default(config, "params.language", "").split(","), this.languages, this._defaultLanguages).filter((lang) => lang != "")).join(",");
405
- import_set.default(config, "params.language", language);
406
- if (this.has.auth && this._auth.bearerToken && !import_get.default(config, "headers.Authorization")) {
407
- import_set.default(config, "headers.Authorization", `Bearer ${this._auth.bearerToken}`);
407
+ config.params ||= {};
408
+ config.params.language = [
409
+ ...new Set(
410
+ [].concat((config.params.language ?? "").split(","), this.languages, this._defaultLanguages).filter(Boolean)
411
+ )
412
+ ].join(",");
413
+ if (this.has.auth && this._auth.bearerToken && !config?.headers?.Authorization) {
414
+ config.headers ||= {};
415
+ config.headers.Authorization = `Bearer ${this._auth.bearerToken}`;
408
416
  }
409
417
  }
410
418
  if (config.url?.startsWith("http:") && typeof window !== "undefined" && window.location.protocol == "https:") {
@@ -418,10 +426,8 @@ var BaseProvider = class {
418
426
  if (!url.endsWith("?")) {
419
427
  url += "?";
420
428
  }
421
- import_forOwn.default(config.params || {}, (value, key) => {
422
- url += `${key}=${encodeURIComponent(value)}&`;
423
- });
424
- if (import_isArray.default(data3) || import_isObject.default(data3)) {
429
+ url += new URLSearchParams(config.params || {}).toString();
430
+ if (typeof data3 === "object") {
425
431
  let totalCount = parseInt(headers["x-total-count"]);
426
432
  if (!isNaN(totalCount)) {
427
433
  data3._totalCount = totalCount;
@@ -430,9 +436,9 @@ var BaseProvider = class {
430
436
  }
431
437
  return data3;
432
438
  }, (error) => {
433
- const count = import_get.default(error, "config._retryCount", 0);
434
- const method = import_get.default(error, "config.method");
435
- const statusCode = import_get.default(error, "response.status");
439
+ const count = error.config?._retryCount ?? 0;
440
+ const method = error.config.method;
441
+ const statusCode = error.response?.status;
436
442
  if (this._retryConfig.methods.includes(method) && this._retryConfig.statusCodes.includes(statusCode) && count < this._retryConfig.count) {
437
443
  error.config._retryCount = count + 1;
438
444
  if (error.config.data) {
@@ -467,7 +473,7 @@ var BaseProvider = class {
467
473
  delete options._raw;
468
474
  return existingMethod(options);
469
475
  }
470
- const existingRequest = currentRequests.find((r) => r.method == method && import_isEqual.default(r.options, options));
476
+ const existingRequest = currentRequests.find((r) => r.method == method && deepEqual(r.options, options));
471
477
  if (existingRequest) {
472
478
  return existingRequest.promise;
473
479
  }
@@ -477,10 +483,8 @@ var BaseProvider = class {
477
483
  options.cancelToken = source.token;
478
484
  }
479
485
  const promise = this.init().then(() => existingMethod(options)).then((result) => {
480
- if (import_isArray.default(result) && result._totalCount === void 0) {
481
- result._totalCount = result.length;
482
- } else if (import_isObject.default(result) && result._totalCount === void 0) {
483
- result._totalCount = 1;
486
+ if (typeof result === "object" && result._totalCount === void 0) {
487
+ result._totalCount = Array.isArray(result) ? result.length : 1;
484
488
  }
485
489
  if (result && type && this[`adjust${type}`]) {
486
490
  result = this[`adjust${type}`](result);
@@ -514,9 +518,10 @@ var BaseProvider = class {
514
518
  return source.cancel(...args);
515
519
  };
516
520
  }
521
+ const { cancelToken, ...opts } = options;
517
522
  const request = {
518
523
  method,
519
- options: import_omit.default(options, ["cancelToken"]),
524
+ options: opts,
520
525
  promise
521
526
  };
522
527
  currentRequests.push(request);
@@ -560,21 +565,21 @@ var BaseProvider = class {
560
565
  this._init = (async () => {
561
566
  this._prepare();
562
567
  let status;
563
- if (import_isString.default(this._api.status)) {
568
+ if (typeof this._api.status === "string") {
564
569
  try {
565
570
  status = await this.axios({
566
571
  method: "get",
567
572
  url: this._api.status
568
573
  });
569
574
  } catch (error) {
570
- if (import_get.default(error, "response.status") === 404) {
575
+ if (error?.response?.status === 404) {
571
576
  this._api.status = null;
572
577
  }
573
578
  }
574
579
  } else {
575
580
  status = this._api.status;
576
581
  }
577
- if (import_isObject.default(status) && !import_isEmpty.default(status)) {
582
+ if (typeof status === "object" && Object.keys(status).length) {
578
583
  this._config = status.config || {};
579
584
  for (let key of Object.keys(this._api)) {
580
585
  if (this._api[key] === void 0) {
@@ -683,30 +688,30 @@ var BaseProvider = class {
683
688
  if (!this.has[type]) {
684
689
  return false;
685
690
  }
686
- const options = import_get.default(this._config, `${type}.${action}`);
691
+ const options = this._config?.[type]?.[action];
687
692
  if (!options) {
688
693
  return !!this.has[type][action];
689
694
  }
690
695
  if (options.auth && (!user || !this._auth.key)) {
691
696
  return false;
692
697
  }
693
- if (options.auth && this._auth.key != import_get.default(this._config, "auth.key")) {
698
+ if (options.auth && this._auth.key != this._config?.auth?.key) {
694
699
  return false;
695
700
  }
696
701
  const userUris = [user?.uri].concat(Object.values(user?.identities || {}).map((id) => id.uri)).filter(Boolean);
697
702
  if (options.auth && options.identities) {
698
- if (import_intersection.default(userUris, options.identities).length == 0) {
703
+ if (intersection(userUris, options.identities).length == 0) {
699
704
  return false;
700
705
  }
701
706
  }
702
707
  if (options.auth && options.identityProviders) {
703
708
  const providers2 = Object.keys(user?.identities || {});
704
- if (import_intersection.default(providers2, options.identityProviders).length == 0) {
709
+ if (intersection(providers2, options.identityProviders).length == 0) {
705
710
  return false;
706
711
  }
707
712
  }
708
713
  if (crossUser) {
709
- return options.crossUser === true || import_intersection.default(options.crossUser || [], userUris).length > 0;
714
+ return options.crossUser === true || intersection(options.crossUser || [], userUris).length > 0;
710
715
  }
711
716
  return !!this.has[type][action];
712
717
  }
@@ -720,7 +725,7 @@ var BaseProvider = class {
720
725
  if (!scheme) {
721
726
  return false;
722
727
  }
723
- let schemes = import_isArray.default(this.schemes) ? this.schemes : null;
728
+ let schemes = Array.isArray(this.schemes) ? this.schemes : null;
724
729
  if (schemes == null && !import_jskos_tools.default.isContainedIn(scheme, this.excludedSchemes || [])) {
725
730
  return true;
726
731
  }
@@ -794,12 +799,12 @@ var BaseProvider = class {
794
799
  for (let side of ["from", "to"]) {
795
800
  let sideScheme = `${side}Scheme`;
796
801
  if (!mapping[sideScheme]) {
797
- mapping[sideScheme] = import_get.default(import_jskos_tools.default.conceptsOfMapping(mapping, side), "[0].inScheme[0]", null);
802
+ mapping[sideScheme] = import_jskos_tools.default.conceptsOfMapping(mapping, side)?.[0]?.inScheme?.[0] ?? null;
798
803
  }
799
804
  }
800
805
  mapping._registry = this;
801
806
  if (!mapping.identifier) {
802
- let identifier = import_get.default(import_jskos_tools.default.addMappingIdentifiers(mapping), "identifier");
807
+ let identifier = import_jskos_tools.default.addMappingIdentifiers(mapping)?.identifier;
803
808
  if (identifier) {
804
809
  mapping.identifier = identifier;
805
810
  }
@@ -874,7 +879,6 @@ var BaseProvider = class {
874
879
  return resultItems;
875
880
  }
876
881
  };
877
- BaseProvider.providerName = "Base";
878
882
 
879
883
  // src/providers/local-mappings-provider.js
880
884
  var import_jskos_tools2 = __toESM(require("jskos-tools"), 1);
@@ -945,7 +949,7 @@ var LocalMappingsProvider = class extends BaseProvider {
945
949
  * @private
946
950
  */
947
951
  _getMappingsQueue() {
948
- let last2 = import_last.default(this.queue) || Promise.resolve();
952
+ let last = this.queue.slice(-1)[0] || Promise.resolve();
949
953
  return new Promise((resolve) => {
950
954
  function defer() {
951
955
  let res, rej;
@@ -962,7 +966,7 @@ var LocalMappingsProvider = class extends BaseProvider {
962
966
  promise.resolve();
963
967
  };
964
968
  this.queue.push(promise);
965
- last2.then(() => {
969
+ last.then(() => {
966
970
  return import_localforage.default.getItem(this.localStorageKey);
967
971
  }).then((mappings) => {
968
972
  resolve({ mappings, done });
@@ -994,25 +998,25 @@ var LocalMappingsProvider = class extends BaseProvider {
994
998
  async getMappings({ from, fromScheme, to, toScheme, creator, type, partOf, offset, limit, direction, mode, identifier, uri } = {}) {
995
999
  let params = {};
996
1000
  if (from) {
997
- params.from = import_isString.default(from) ? from : from.uri;
1001
+ params.from = typeof from === "string" ? from : from.uri;
998
1002
  }
999
1003
  if (fromScheme) {
1000
- params.fromScheme = import_isString.default(fromScheme) ? { uri: fromScheme } : fromScheme;
1004
+ params.fromScheme = typeof fromScheme === "string" ? { uri: fromScheme } : fromScheme;
1001
1005
  }
1002
1006
  if (to) {
1003
- params.to = import_isString.default(to) ? to : to.uri;
1007
+ params.to = typeof to === "string" ? to : to.uri;
1004
1008
  }
1005
1009
  if (toScheme) {
1006
- params.toScheme = import_isString.default(toScheme) ? { uri: toScheme } : toScheme;
1010
+ params.toScheme = typeof toScheme === "string" ? { uri: toScheme } : toScheme;
1007
1011
  }
1008
1012
  if (creator) {
1009
- params.creator = import_isString.default(creator) ? creator : import_jskos_tools2.default.prefLabel(creator);
1013
+ params.creator = typeof creator === "string" ? creator : import_jskos_tools2.default.prefLabel(creator);
1010
1014
  }
1011
1015
  if (type) {
1012
- params.type = import_isString.default(type) ? type : type.uri;
1016
+ params.type = typeof type === "string" ? type : type.uri;
1013
1017
  }
1014
1018
  if (partOf) {
1015
- params.partOf = import_isString.default(partOf) ? partOf : partOf.uri;
1019
+ params.partOf = typeof partOf === "string" ? partOf : partOf.uri;
1016
1020
  }
1017
1021
  if (offset) {
1018
1022
  params.offset = offset;
@@ -1306,27 +1310,27 @@ var MappingsApiProvider = class extends BaseProvider {
1306
1310
  }
1307
1311
  this.has.mappings = this._api.mappings ? {} : false;
1308
1312
  if (this.has.mappings) {
1309
- this.has.mappings.read = !!import_get.default(this._config, "mappings.read", true);
1310
- this.has.mappings.create = !!import_get.default(this._config, "mappings.create");
1311
- this.has.mappings.update = !!import_get.default(this._config, "mappings.update");
1312
- this.has.mappings.delete = !!import_get.default(this._config, "mappings.delete");
1313
- this.has.mappings.anonymous = !!import_get.default(this._config, "mappings.anonymous");
1313
+ this.has.mappings.read = !!(this._config?.mappings?.read ?? true);
1314
+ this.has.mappings.create = !!this._config?.mappings?.create;
1315
+ this.has.mappings.update = !!this._config?.mappings?.update;
1316
+ this.has.mappings.delete = !!this._config?.mappings?.delete;
1317
+ this.has.mappings.anonymous = !!this._config?.mappings?.anonymous;
1314
1318
  }
1315
1319
  this.has.concordances = this._api.concordances ? {} : false;
1316
1320
  if (this.has.concordances) {
1317
- this.has.concordances.read = !!import_get.default(this._config, "concordances.read");
1318
- this.has.concordances.create = !!import_get.default(this._config, "concordances.create");
1319
- this.has.concordances.update = !!import_get.default(this._config, "concordances.update");
1320
- this.has.concordances.delete = !!import_get.default(this._config, "concordances.delete");
1321
+ this.has.concordances.read = !!this._config?.concordances?.read;
1322
+ this.has.concordances.create = !!this._config?.concordances?.create;
1323
+ this.has.concordances.update = !!this._config?.concordances?.update;
1324
+ this.has.concordances.delete = !!this._config?.concordances?.delete;
1321
1325
  }
1322
1326
  this.has.annotations = this._api.annotations ? {} : false;
1323
1327
  if (this.has.annotations) {
1324
- this.has.annotations.read = !!import_get.default(this._config, "annotations.read");
1325
- this.has.annotations.create = !!import_get.default(this._config, "annotations.create");
1326
- this.has.annotations.update = !!import_get.default(this._config, "annotations.update");
1327
- this.has.annotations.delete = !!import_get.default(this._config, "annotations.delete");
1328
+ this.has.annotations.read = !!this._config?.annotations?.read;
1329
+ this.has.annotations.create = !!this._config?.annotations?.create;
1330
+ this.has.annotations.update = !!this._config?.annotations?.update;
1331
+ this.has.annotations.delete = !!this._config?.annotations?.delete;
1328
1332
  }
1329
- this.has.auth = import_get.default(this._config, "auth.key") != null;
1333
+ this.has.auth = this._config?.auth?.key != null;
1330
1334
  this._defaultParams = {
1331
1335
  properties: "annotations"
1332
1336
  };
@@ -1355,7 +1359,7 @@ var MappingsApiProvider = class extends BaseProvider {
1355
1359
  }
1356
1360
  });
1357
1361
  } catch (error) {
1358
- if (import_get.default(error, "response.status") == 404) {
1362
+ if (error?.response?.status == 404) {
1359
1363
  return null;
1360
1364
  }
1361
1365
  throw error;
@@ -1370,25 +1374,25 @@ var MappingsApiProvider = class extends BaseProvider {
1370
1374
  async getMappings({ from, fromScheme, to, toScheme, creator, type, partOf, offset, limit, direction, mode, identifier, cardinality, annotatedBy, annotatedFor, annotatedWith, sort, order, ...config }) {
1371
1375
  let params = {}, url = this._api.mappings;
1372
1376
  if (from) {
1373
- params.from = import_isString.default(from) ? from : from.uri;
1377
+ params.from = typeof from === "string" ? from : from.uri;
1374
1378
  }
1375
1379
  if (fromScheme) {
1376
- params.fromScheme = import_isString.default(fromScheme) ? fromScheme : fromScheme.uri;
1380
+ params.fromScheme = typeof fromScheme === "string" ? fromScheme : fromScheme.uri;
1377
1381
  }
1378
1382
  if (to) {
1379
- params.to = import_isString.default(to) ? to : to.uri;
1383
+ params.to = typeof to === "string" ? to : to.uri;
1380
1384
  }
1381
1385
  if (toScheme) {
1382
- params.toScheme = import_isString.default(toScheme) ? toScheme : toScheme.uri;
1386
+ params.toScheme = typeof toScheme === "string" ? toScheme : toScheme.uri;
1383
1387
  }
1384
1388
  if (creator) {
1385
- params.creator = import_isString.default(creator) ? creator : import_jskos_tools3.default.prefLabel(creator);
1389
+ params.creator = typeof creator === "string" ? creator : import_jskos_tools3.default.prefLabel(creator);
1386
1390
  }
1387
1391
  if (type) {
1388
- params.type = import_isString.default(type) ? type : type.uri;
1392
+ params.type = typeof type === "string" ? type : type.uri;
1389
1393
  }
1390
1394
  if (partOf) {
1391
- params.partOf = import_isString.default(partOf) ? partOf : partOf.uri;
1395
+ params.partOf = typeof partOf === "string" ? partOf : partOf.uri;
1392
1396
  }
1393
1397
  if (offset) {
1394
1398
  params.offset = offset;
@@ -1497,15 +1501,15 @@ var MappingsApiProvider = class extends BaseProvider {
1497
1501
  if (!mapping) {
1498
1502
  throw new InvalidOrMissingParameterError({ parameter: "mapping" });
1499
1503
  }
1500
- const uri = mapping.uri;
1501
- if (!uri || !uri.startsWith(this._api.mappings)) {
1504
+ if (!mapping.uri?.startsWith(this._api.mappings)) {
1502
1505
  throw new InvalidOrMissingParameterError({ parameter: "mapping", message: "URI doesn't seem to be part of this registry." });
1503
1506
  }
1507
+ const { uri, ...data3 } = mapping;
1504
1508
  return this.axios({
1505
1509
  ...config,
1506
1510
  method: "patch",
1507
1511
  url: uri,
1508
- data: import_omit.default(mapping, "uri"),
1512
+ data: data3,
1509
1513
  params: {
1510
1514
  ...this._defaultParams,
1511
1515
  ...config.params || {}
@@ -1543,7 +1547,8 @@ var MappingsApiProvider = class extends BaseProvider {
1543
1547
  */
1544
1548
  async getAnnotations({ target, ...config }) {
1545
1549
  if (target) {
1546
- import_set.default(config, "params.target", target);
1550
+ config.params ||= {};
1551
+ config.params.target = target;
1547
1552
  }
1548
1553
  return this.axios({
1549
1554
  ...config,
@@ -1695,15 +1700,15 @@ var MappingsApiProvider = class extends BaseProvider {
1695
1700
  if (!concordance) {
1696
1701
  throw new InvalidOrMissingParameterError({ parameter: "concordance" });
1697
1702
  }
1698
- const uri = concordance.uri;
1699
- if (!uri || !uri.startsWith(this._api.concordances)) {
1703
+ if (!concordance.uri?.startsWith(this._api.concordances)) {
1700
1704
  throw new InvalidOrMissingParameterError({ parameter: "concordance", message: "URI doesn't seem to be part of this registry." });
1701
1705
  }
1706
+ const { uri, ...data3 } = concordance;
1702
1707
  return this.axios({
1703
1708
  ...config,
1704
1709
  method: "patch",
1705
1710
  url: uri,
1706
- data: import_omit.default(concordance, "uri"),
1711
+ data: data3,
1707
1712
  params: {
1708
1713
  ...this._defaultParams,
1709
1714
  ...config.params || {}
@@ -1791,30 +1796,30 @@ var OccurrencesApiProvider = class extends BaseProvider {
1791
1796
  async getMappings(config) {
1792
1797
  const occurrences = await this.getOccurrences(config);
1793
1798
  const from = config.from;
1794
- const fromScheme = import_get.default(from, "inScheme[0]") || config.fromScheme;
1799
+ const fromScheme = from?.inScheme?.[0] || config.fromScheme;
1795
1800
  const to = config.to;
1796
- const toScheme = import_get.default(to, "inScheme[0]") || config.toScheme;
1801
+ const toScheme = to?.inScheme?.[0] || config.toScheme;
1797
1802
  const mappings = [];
1798
1803
  for (let occurrence of occurrences) {
1799
1804
  if (!occurrence) {
1800
1805
  continue;
1801
1806
  }
1802
1807
  let mapping = {};
1803
- mapping.from = import_get.default(occurrence, "memberSet[0]");
1808
+ mapping.from = occurrence?.memberSet?.[0];
1804
1809
  if (mapping.from) {
1805
1810
  mapping.from = { memberSet: [mapping.from] };
1806
1811
  } else {
1807
1812
  mapping.from = null;
1808
1813
  }
1809
- mapping.fromScheme = import_get.default(occurrence, "memberSet[0].inScheme[0]");
1810
- mapping.to = import_get.default(occurrence, "memberSet[1]");
1814
+ mapping.fromScheme = occurrence?.memberSet?.[0]?.inScheme?.[0];
1815
+ mapping.to = occurrence?.memberSet?.[1];
1811
1816
  if (mapping.to) {
1812
1817
  mapping.to = { memberSet: [mapping.to] };
1813
1818
  } else {
1814
1819
  mapping.to = { memberSet: [] };
1815
1820
  }
1816
- mapping.toScheme = import_get.default(occurrence, "memberSet[1].inScheme[0]");
1817
- if (from && import_jskos_tools4.default.compare(from, import_get.default(mapping, "to.memberSet[0]")) || to && import_jskos_tools4.default.compare(to, import_get.default(mapping, "from.memberSet[0]"))) {
1821
+ mapping.toScheme = occurrence?.memberSet?.[1]?.inScheme?.[0];
1822
+ if (from && import_jskos_tools4.default.compare(from, mapping?.to?.memberSet?.[0]) || to && import_jskos_tools4.default.compare(to, mapping?.from?.memberSet?.[0])) {
1818
1823
  [mapping.from, mapping.fromScheme, mapping.to, mapping.toScheme] = [mapping.to, mapping.toScheme, mapping.from, mapping.fromScheme];
1819
1824
  }
1820
1825
  if (!mapping.fromScheme && fromScheme) {
@@ -1844,7 +1849,7 @@ var OccurrencesApiProvider = class extends BaseProvider {
1844
1849
  let promises = [];
1845
1850
  concepts = (concepts || []).concat([from, to]).filter((c) => !!c);
1846
1851
  for (let concept of concepts) {
1847
- promises.push(this._occurrencesIsSupported(import_get.default(concept, "inScheme[0]")).then((supported) => {
1852
+ promises.push(this._occurrencesIsSupported(concept?.inScheme?.[0]).then((supported) => {
1848
1853
  if (supported && concept.uri) {
1849
1854
  return concept.uri;
1850
1855
  } else {
@@ -1869,7 +1874,7 @@ var OccurrencesApiProvider = class extends BaseProvider {
1869
1874
  }));
1870
1875
  }
1871
1876
  const results = await Promise.all(promises);
1872
- let occurrences = import_concat.default([], ...results);
1877
+ let occurrences = results.flat();
1873
1878
  let existingUris = [];
1874
1879
  let indexesToDelete = [];
1875
1880
  for (let i = 0; i < occurrences.length; i += 1) {
@@ -1900,9 +1905,7 @@ var OccurrencesApiProvider = class extends BaseProvider {
1900
1905
  * @param {Object} config passthrough of config parameter for axios request
1901
1906
  */
1902
1907
  async _getOccurrences(config) {
1903
- let resultsFromCache = this._cache.find((item) => {
1904
- return import_isEqual.default(item.config.params, config.params);
1905
- });
1908
+ let resultsFromCache = this._cache.find((item) => deepEqual(item.config.params, config.params));
1906
1909
  if (resultsFromCache) {
1907
1910
  return resultsFromCache.data;
1908
1911
  }
@@ -1983,7 +1986,7 @@ var ConceptApiProvider = class extends BaseProvider {
1983
1986
  this.has.types = !!this._api.types;
1984
1987
  this.has.suggest = !!this._api.suggest;
1985
1988
  this.has.search = !!this._api.search;
1986
- this.has.auth = import_get.default(this._config, "auth.key") != null;
1989
+ this.has.auth = this._config?.auth?.key;
1987
1990
  this._defaultParams = {
1988
1991
  // Default parameters mostly for DANTE
1989
1992
  properties: "+created,issued,modified,editorialNote,scopeNote,note,definition,mappings,location"
@@ -2114,13 +2117,10 @@ var ConceptApiProvider = class extends BaseProvider {
2114
2117
  if (!url) {
2115
2118
  throw new MissingApiUrlError();
2116
2119
  }
2117
- if (!concepts) {
2118
- throw new InvalidOrMissingParameterError({ parameter: "concepts" });
2119
- }
2120
2120
  if (!Array.isArray(concepts)) {
2121
- concepts = [concepts];
2121
+ concepts = concepts ? [concepts] : [];
2122
2122
  }
2123
- let uris = concepts.map((concept) => concept.uri).filter((uri) => uri != null);
2123
+ const uris = concepts.map((concept) => concept.uri).filter((uri) => uri != null);
2124
2124
  return this.axios({
2125
2125
  ...config,
2126
2126
  method: "get",
@@ -2128,7 +2128,7 @@ var ConceptApiProvider = class extends BaseProvider {
2128
2128
  params: {
2129
2129
  ...this._defaultParams,
2130
2130
  // ? What should the default limit be?
2131
- limit: 500,
2131
+ limit: 100,
2132
2132
  ...config.params || {},
2133
2133
  uri: uris.join("|")
2134
2134
  }
@@ -2324,7 +2324,8 @@ var ConceptApiProvider = class extends BaseProvider {
2324
2324
  }
2325
2325
  const schemeUri = scheme && await this._getSchemeUri(scheme);
2326
2326
  if (schemeUri) {
2327
- import_set.default(config, "params.uri", schemeUri);
2327
+ config.params ||= {};
2328
+ config.params.uri = schemeUri;
2328
2329
  }
2329
2330
  let types = await this.axios({
2330
2331
  ...config,
@@ -2365,13 +2366,13 @@ var ReconciliationApiProvider = class extends BaseProvider {
2365
2366
  */
2366
2367
  async getMappings({ from, to, mode, ...config }) {
2367
2368
  let schemes = [];
2368
- if (import_isArray.default(this.schemes)) {
2369
+ if (Array.isArray(this.schemes)) {
2369
2370
  schemes = this.schemes;
2370
2371
  }
2371
2372
  let swap;
2372
2373
  let concept;
2373
- let fromConceptScheme = import_get.default(from, "inScheme[0]");
2374
- let toConceptScheme = import_get.default(to, "inScheme[0]");
2374
+ let fromConceptScheme = from?.inScheme?.[0];
2375
+ let toConceptScheme = to?.inScheme?.[0];
2375
2376
  let fromScheme;
2376
2377
  let toScheme;
2377
2378
  if (!from || import_jskos_tools6.default.isContainedIn(fromConceptScheme, schemes)) {
@@ -2398,11 +2399,11 @@ var ReconciliationApiProvider = class extends BaseProvider {
2398
2399
  if (!language) {
2399
2400
  throw new InvalidOrMissingParameterError({ parameter: swap ? "to" : "from", message: "Missing language" });
2400
2401
  }
2401
- let altLabels = import_get.default(concept, `altLabel.${language}`, []);
2402
- if (import_isString.default(altLabels)) {
2402
+ let altLabels = concept?.altLabel?.[language] ?? [];
2403
+ if (typeof altLabels === "string") {
2403
2404
  altLabels = [altLabels];
2404
2405
  }
2405
- let prefLabel = import_get.default(concept, `prefLabel.${language}`);
2406
+ let prefLabel = concept?.prefLabel?.[language];
2406
2407
  let labels = altLabels.concat([prefLabel]);
2407
2408
  labels = [prefLabel];
2408
2409
  let { url, data: results } = await this._getReconciliationResults({ ...config, labels, language });
@@ -2420,7 +2421,7 @@ var ReconciliationApiProvider = class extends BaseProvider {
2420
2421
  }
2421
2422
  return a.id.length - b.id.length;
2422
2423
  });
2423
- let namespace = import_get.default(toScheme, "namespace", "");
2424
+ let namespace = toScheme?.namespace ?? "";
2424
2425
  let mappings = results.map((result) => ({
2425
2426
  fromScheme,
2426
2427
  from: { memberSet: [concept] },
@@ -2458,9 +2459,7 @@ var ReconciliationApiProvider = class extends BaseProvider {
2458
2459
  */
2459
2460
  async _getReconciliationResults({ labels, language, ...config }) {
2460
2461
  labels = labels.sort();
2461
- let resultsFromCache = this._cache.find((item) => {
2462
- return import_isEqual.default(item.labels, labels) && item.language == language;
2463
- });
2462
+ let resultsFromCache = this._cache.find((item) => deepEqual(item.labels, labels) && item.language == language);
2464
2463
  if (resultsFromCache) {
2465
2464
  return resultsFromCache;
2466
2465
  }
@@ -2477,7 +2476,8 @@ var ReconciliationApiProvider = class extends BaseProvider {
2477
2476
  url = url.replace("{language}", language);
2478
2477
  }
2479
2478
  const encodedData = `queries=${encodeURIComponent(JSON.stringify(queries))}`;
2480
- import_set.default(config, ["headers", "Content-Type"], "application/x-www-form-urlencoded");
2479
+ config.headers ||= {};
2480
+ config.headers["Content-Type"] = "application/x-www-form-urlencoded";
2481
2481
  let data3 = await this.axios({
2482
2482
  ...config,
2483
2483
  method: "post",
@@ -2521,7 +2521,7 @@ var LabelSearchSuggestionProvider = class extends BaseProvider {
2521
2521
  * @returns {boolean}
2522
2522
  */
2523
2523
  supportsScheme(scheme) {
2524
- return super.supportsScheme(scheme) && import_get.default(scheme, "_registry.has.search", false);
2524
+ return super.supportsScheme(scheme) && scheme?._registry?.has?.search;
2525
2525
  }
2526
2526
  /**
2527
2527
  * Returns a list of mappings.
@@ -2555,12 +2555,12 @@ var LabelSearchSuggestionProvider = class extends BaseProvider {
2555
2555
  toResult = toResult.filter((m) => !fromResult.find((n) => import_jskos_tools7.default.compareMappingMembers(m, n)));
2556
2556
  while (fromResult.length + toResult.length > limit) {
2557
2557
  if (toResult.length >= fromResult.length) {
2558
- toResult = toResult.slice(0, -1);
2558
+ toResult.pop();
2559
2559
  } else {
2560
- fromResult = fromResult.slice(0, -1);
2560
+ fromResult.pop();
2561
2561
  }
2562
2562
  }
2563
- return import_union.default(fromResult, toResult);
2563
+ return [...fromResult, ...toResult];
2564
2564
  }
2565
2565
  /**
2566
2566
  * Internal function to get mapping recommendations for a certain concept with sourceScheme and targetScheme.
@@ -2637,7 +2637,7 @@ var LabelSearchSuggestionProvider = class extends BaseProvider {
2637
2637
  if (resultsFromCache && resultsFromCache._limit >= limit) {
2638
2638
  return resultsFromCache;
2639
2639
  }
2640
- const registry = import_get.default(targetScheme, "_registry");
2640
+ const registry = targetScheme?._registry;
2641
2641
  if (!registry || registry.has.search === false) {
2642
2642
  return [];
2643
2643
  }
@@ -2706,7 +2706,7 @@ var SkosmosApiProvider = class extends BaseProvider {
2706
2706
  * @private
2707
2707
  */
2708
2708
  _getApiUrl(scheme, endpoint, params) {
2709
- const VOCID = scheme && scheme.VOCID || import_get.default(this.schemes.find((s) => import_jskos_tools8.default.compare(s, scheme)), "VOCID");
2709
+ const VOCID = scheme?.VOCID || this.schemes.find((s) => import_jskos_tools8.default.compare(s, scheme))?.VOCID;
2710
2710
  if (!VOCID) {
2711
2711
  throw new InvalidOrMissingParameterError({ parameter: "scheme", message: "Missing scheme or VOCID property on scheme" });
2712
2712
  }
@@ -2722,7 +2722,7 @@ var SkosmosApiProvider = class extends BaseProvider {
2722
2722
  * @private
2723
2723
  */
2724
2724
  _getDataUrl(concept, { addFormatParameter = true } = {}) {
2725
- const scheme = import_get.default(concept, "inScheme[0]");
2725
+ const scheme = concept?.inScheme?.[0];
2726
2726
  if (!concept || !concept.uri) {
2727
2727
  throw new InvalidOrMissingParameterError({ parameter: "concept", message: "Missing concept URI" });
2728
2728
  }
@@ -2777,29 +2777,33 @@ var SkosmosApiProvider = class extends BaseProvider {
2777
2777
  concept.inScheme = [scheme];
2778
2778
  }
2779
2779
  let prefLabel = skosmosConcept.matchedPrefLabel || skosmosConcept.prefLabel || skosmosConcept.label;
2780
- if (import_isString.default(prefLabel)) {
2781
- import_set.default(concept, `prefLabel.${language}`, prefLabel);
2780
+ if (typeof prefLabel === "string") {
2781
+ concept.prefLabel ||= {};
2782
+ concept.prefLabel[language] = prefLabel;
2782
2783
  } else {
2783
- if (prefLabel && !import_isArray.default(prefLabel)) {
2784
+ if (prefLabel && !Array.isArray(prefLabel)) {
2784
2785
  prefLabel = [prefLabel];
2785
2786
  }
2786
2787
  for (let label of prefLabel || []) {
2787
- import_set.default(concept, `prefLabel.${label.lang}`, label.value);
2788
+ concept.prefLabel ||= {};
2789
+ concept.prefLabel[label.lang] = label.value;
2788
2790
  }
2789
2791
  }
2790
2792
  let altLabel = skosmosConcept.altLabel;
2791
- if (import_isString.default(altLabel)) {
2792
- import_set.default(concept, `altLabel.${language}`, [altLabel]);
2793
+ if (typeof altLabel === "string") {
2794
+ concept.altLabel ||= {};
2795
+ concept.altLabel[language] = altLabel;
2793
2796
  } else {
2794
- if (altLabel && !import_isArray.default(altLabel)) {
2797
+ if (altLabel && !Array.isArray(altLabel)) {
2795
2798
  altLabel = [altLabel];
2796
2799
  }
2797
2800
  for (let label of altLabel || []) {
2798
- if (import_get.default(concept, `altLabel.${label.lang}`)) {
2801
+ if (concept?.altLabel?.[label.lang]) {
2799
2802
  concept.altLabel[label.lang].push(label.value);
2800
- concept.altLabel[label.lang] = import_uniq.default(concept.altLabel[label.lang]);
2803
+ concept.altLabel[label.lang] = [...new Set(concept.altLabel[label.lang])];
2801
2804
  } else {
2802
- import_set.default(concept, `altLabel.${label.lang}`, [label.value]);
2805
+ concept.altLabel ||= {};
2806
+ concept.altLabel[label.lang] = [label.value];
2803
2807
  }
2804
2808
  }
2805
2809
  }
@@ -2808,17 +2812,17 @@ var SkosmosApiProvider = class extends BaseProvider {
2808
2812
  concept.notation = [notation.value || notation];
2809
2813
  }
2810
2814
  if (skosmosConcept.broader) {
2811
- if (!import_isArray.default(skosmosConcept.broader)) {
2815
+ if (!Array.isArray(skosmosConcept.broader)) {
2812
2816
  skosmosConcept.broader = [skosmosConcept.broader];
2813
2817
  }
2814
- concept.broader = skosmosConcept.broader.map((concept2) => import_isString.default(concept2) ? { uri: concept2 } : concept2);
2818
+ concept.broader = skosmosConcept.broader.map((uri) => typeof uri === "string" ? { uri } : uri);
2815
2819
  }
2816
2820
  if (skosmosConcept.hasChildren === true) {
2817
2821
  concept.narrower = [null];
2818
2822
  } else if (skosmosConcept.hasChildren === false) {
2819
2823
  concept.narrower = [];
2820
2824
  }
2821
- if (skosmosConcept.type && !import_isArray.default(skosmosConcept.type)) {
2825
+ if (skosmosConcept.type && !Array.isArray(skosmosConcept.type)) {
2822
2826
  skosmosConcept.type = [skosmosConcept.type];
2823
2827
  }
2824
2828
  concept.type = concept.type || [];
@@ -2832,10 +2836,36 @@ var SkosmosApiProvider = class extends BaseProvider {
2832
2836
  }
2833
2837
  concept.type.push(type);
2834
2838
  }
2835
- concept.type = import_uniq.default(concept.type);
2839
+ concept.type = [...new Set(concept.type)];
2836
2840
  if (!concept.type.length) {
2837
2841
  concept.type = ["http://www.w3.org/2004/02/skos/core#Concept"];
2838
2842
  }
2843
+ const map = {
2844
+ "skos:definition": "definition",
2845
+ "skos:note": "note",
2846
+ "skos:scopeNote": "scopeNote",
2847
+ "skos:example": "example",
2848
+ "skos:historyNote": "historyNote",
2849
+ "skos:editorialNote": "editorialNote",
2850
+ "skos:changeNote": "changeNote"
2851
+ };
2852
+ for (let key in map) {
2853
+ if (skosmosConcept[key]) {
2854
+ const value = skosmosConcept[key];
2855
+ if (value.lang && value.value) {
2856
+ concept[map[key]] = {
2857
+ [value.lang]: value.value
2858
+ };
2859
+ } else if (Array.isArray(value)) {
2860
+ concept[map[key]] = {};
2861
+ for (let val of value) {
2862
+ if (val.lang && val.value) {
2863
+ concept[map[key]][val.lang] = val.value;
2864
+ }
2865
+ }
2866
+ }
2867
+ }
2868
+ }
2839
2869
  return concept;
2840
2870
  }
2841
2871
  /**
@@ -2856,7 +2886,8 @@ var SkosmosApiProvider = class extends BaseProvider {
2856
2886
  const resultScheme = data3.conceptschemes.find((s) => import_jskos_tools8.default.compare(s, scheme));
2857
2887
  const label = resultScheme && (resultScheme.prefLabel || resultScheme.label || resultScheme.title);
2858
2888
  if (label) {
2859
- import_set.default(scheme, `prefLabel.${this._language}`, label);
2889
+ scheme.prefLabel ||= {};
2890
+ scheme.prefLabel[this._language] = label;
2860
2891
  }
2861
2892
  schemes.push(scheme);
2862
2893
  this._approvedSchemes = this._approvedSchemes || [];
@@ -2882,7 +2913,8 @@ var SkosmosApiProvider = class extends BaseProvider {
2882
2913
  if (!schemeUri) {
2883
2914
  throw new InvalidOrMissingParameterError({ parameter: "scheme", message: "Missing or unsupported scheme or VOCID property on scheme" });
2884
2915
  }
2885
- import_set.default(config, "params.scheme", schemeUri);
2916
+ config.params ||= {};
2917
+ config.params.scheme = schemeUri;
2886
2918
  const response = await this.axios({
2887
2919
  ...config,
2888
2920
  method: "get",
@@ -2907,31 +2939,31 @@ var SkosmosApiProvider = class extends BaseProvider {
2907
2939
  * @returns {Object[]} array of JSKOS concept objects
2908
2940
  */
2909
2941
  async getConcepts({ concepts, ...config }) {
2910
- if (!import_isArray.default(concepts)) {
2942
+ if (!Array.isArray(concepts)) {
2911
2943
  concepts = [concepts];
2912
2944
  }
2913
2945
  concepts = concepts.map((c) => ({ uri: c.uri, inScheme: c.inScheme }));
2914
2946
  const newConcepts = [];
2915
2947
  for (let concept of concepts) {
2916
- const url = this._getDataUrl(concept, { addFormatParameter: false });
2948
+ if (!concept || !concept.uri) {
2949
+ throw new InvalidOrMissingParameterError({ parameter: "concept", message: "Missing concept URI" });
2950
+ }
2951
+ const params = { uri: concept.uri, format: "application/json" };
2952
+ const url = this._getApiUrl(concept?.inScheme?.[0], "/data", params);
2917
2953
  if (!url) {
2918
2954
  continue;
2919
2955
  }
2920
2956
  const result = await this.axios({
2921
2957
  ...config,
2922
2958
  method: "get",
2923
- url,
2924
- params: {
2925
- uri: concept.uri,
2926
- format: "application/json"
2927
- }
2959
+ url
2928
2960
  });
2929
- const resultConcept = result && result.graph && result.graph.find((c) => import_jskos_tools8.default.compare(c, concept));
2961
+ const resultConcept = result?.graph?.find((c) => import_jskos_tools8.default.compare(c, concept));
2930
2962
  if (resultConcept) {
2931
2963
  const newConcept = this._toJskosConcept(resultConcept, { concept, result });
2932
2964
  for (let type of ["broader", "narrower"]) {
2933
2965
  let relatives = resultConcept[type] || newConcept[type];
2934
- if (relatives && !import_isArray.default(relatives)) {
2966
+ if (relatives && !Array.isArray(relatives)) {
2935
2967
  relatives = [relatives];
2936
2968
  }
2937
2969
  if (!relatives) {
@@ -2958,7 +2990,8 @@ var SkosmosApiProvider = class extends BaseProvider {
2958
2990
  }
2959
2991
  const scheme = concept.inScheme[0];
2960
2992
  const url = this._getApiUrl(scheme, "/children");
2961
- import_set.default(config, "params.uri", concept.uri);
2993
+ config.params ||= {};
2994
+ config.params.uri = concept.uri;
2962
2995
  const response = await this.axios({
2963
2996
  ...config,
2964
2997
  method: "get",
@@ -2980,7 +3013,8 @@ var SkosmosApiProvider = class extends BaseProvider {
2980
3013
  }
2981
3014
  const scheme = concept.inScheme[0];
2982
3015
  const url = this._getApiUrl(scheme, "/broaderTransitive");
2983
- import_set.default(config, "params.uri", concept.uri);
3016
+ config.params ||= {};
3017
+ config.params.uri = concept.uri;
2984
3018
  const response = await this.axios({
2985
3019
  ...config,
2986
3020
  method: "get",
@@ -2990,10 +3024,10 @@ var SkosmosApiProvider = class extends BaseProvider {
2990
3024
  let uri = concept.uri;
2991
3025
  while (uri) {
2992
3026
  if (uri != concept.uri) {
2993
- const ancestor = import_get.default(response, `broaderTransitive["${uri}"]`);
3027
+ const ancestor = response?.broaderTransitive?.[uri];
2994
3028
  ancestors = ancestors.concat([ancestor]);
2995
3029
  }
2996
- uri = import_get.default(response, `broaderTransitive["${uri}"].broader[0]`);
3030
+ uri = response?.broaderTransitive?.[uri]?.broader?.[0];
2997
3031
  }
2998
3032
  const concepts = ancestors.map((c) => this._toJskosConcept(c, { scheme })).filter((c) => c.uri != concept.uri);
2999
3033
  return concepts;
@@ -3010,10 +3044,11 @@ var SkosmosApiProvider = class extends BaseProvider {
3010
3044
  */
3011
3045
  async search({ search, scheme, limit, types = [], ...config }) {
3012
3046
  const url = this._getApiUrl(scheme, "/search");
3013
- import_set.default(config, "params.query", `${search}*`);
3014
- import_set.default(config, "params.unique", 1);
3015
- import_set.default(config, "params.maxhits", limit || 100);
3016
- import_set.default(config, "params.type", types.join(" "));
3047
+ config.params ||= {};
3048
+ config.params.query = `${search}*`;
3049
+ config.params.unique = 1;
3050
+ config.params.maxhits = limit || 100;
3051
+ config.params.type = types.join(" ");
3017
3052
  const response = await this.axios({
3018
3053
  ...config,
3019
3054
  method: "get",
@@ -3037,7 +3072,7 @@ var SkosmosApiProvider = class extends BaseProvider {
3037
3072
  method: "get",
3038
3073
  url
3039
3074
  });
3040
- for (let type of response && response.types || []) {
3075
+ for (let type of response?.types || []) {
3041
3076
  if (type.uri == "http://www.w3.org/2004/02/skos/core#Concept") {
3042
3077
  continue;
3043
3078
  }
@@ -3356,7 +3391,7 @@ var SkohubProvider = class extends BaseProvider {
3356
3391
  throw new InvalidRequestError({ message: `Tried to load unsupported scheme (${scheme && scheme.uri})` });
3357
3392
  }
3358
3393
  const uri = schemeFromList.uri;
3359
- uris = import_uniq.default(uris.concat(import_jskos_tools10.default.getAllUris(schemeFromList)));
3394
+ uris = [...new Set(uris.concat(import_jskos_tools10.default.getAllUris(schemeFromList)))];
3360
3395
  let postfix = ".json";
3361
3396
  if (uri.endsWith("/")) {
3362
3397
  postfix = "index.json";
@@ -3437,7 +3472,7 @@ var SkohubProvider = class extends BaseProvider {
3437
3472
  return scheme.topConcepts || [];
3438
3473
  }
3439
3474
  async getConcepts({ concepts, ...config }) {
3440
- if (!import_isArray.default(concepts)) {
3475
+ if (!Array.isArray(concepts)) {
3441
3476
  concepts = [concepts];
3442
3477
  }
3443
3478
  return (await Promise.all(concepts.map(({ uri }) => this._loadConcept({ ...config, uri })))).filter(Boolean);
@@ -4370,7 +4405,7 @@ var OlsApiProvider = class extends BaseProvider {
4370
4405
  };
4371
4406
  constructor(config) {
4372
4407
  super(config);
4373
- this.endpoint = config.endpoint;
4408
+ this.endpoint = config.endpoint || config.uri;
4374
4409
  }
4375
4410
  /**
4376
4411
  * Used by `registryForScheme` (see src/lib/CocodaSDK.js) to determine a provider config for a concept schceme.
@@ -4449,7 +4484,7 @@ var OlsApiProvider = class extends BaseProvider {
4449
4484
  }
4450
4485
  if (term["http://www.w3.org/2000/01/rdf-schema#label"]) {
4451
4486
  concept.prefLabel = {};
4452
- concept.prefLabel[lan] = term["http://www.w3.org/2000/01/rdf-schema#label"];
4487
+ concept.prefLabel[lan] = term["http://www.w3.org/2000/01/rdf-schema#label"].value || term["http://www.w3.org/2000/01/rdf-schema#label"];
4453
4488
  }
4454
4489
  concept.type = [
4455
4490
  "http://www.w3.org/2004/02/skos/core#Concept",
@@ -4615,11 +4650,8 @@ var OlsApiProvider = class extends BaseProvider {
4615
4650
  async getTop({ scheme }) {
4616
4651
  const VOCID = await this._getSchemeVOCID(scheme);
4617
4652
  if (VOCID) {
4618
- let url = this._getApiUrl(["ontologies", VOCID, "classes"], { hasDirectParents: "false" });
4619
- let response = await this._request(url);
4620
- if (response?.elements) {
4621
- return Promise.all(response.elements.map((item) => this._termToJSKOS(item)));
4622
- }
4653
+ let response = await this._paginate(["ontologies", VOCID, "classes"], { hasDirectParents: "false" }, null);
4654
+ return Promise.all(response.map((item) => this._termToJSKOS(item)));
4623
4655
  }
4624
4656
  return [];
4625
4657
  }
@@ -4635,22 +4667,16 @@ var OlsApiProvider = class extends BaseProvider {
4635
4667
  async getNarrower({ concept }) {
4636
4668
  const { VOCID, iri } = await this._splitConcept(concept);
4637
4669
  if (VOCID && iri) {
4638
- let url = this._getApiUrl(["ontologies", VOCID, "classes", iri, "children"]);
4639
- let response = await this._request(url);
4640
- if (response?.elements) {
4641
- return Promise.all(response.elements.map((item) => this._termToJSKOS(item)));
4642
- }
4670
+ const items = await this._paginate(["ontologies", VOCID, "classes", iri, "children"], {}, 0);
4671
+ return Promise.all(items.map((item) => this._termToJSKOS(item)));
4643
4672
  }
4644
4673
  return [];
4645
4674
  }
4646
4675
  async getAncestors({ concept }) {
4647
4676
  const { VOCID, iri } = await this._splitConcept(concept);
4648
4677
  if (VOCID && iri) {
4649
- let url = this._getApiUrl(["ontologies", VOCID, "classes", iri, "ancestors"]);
4650
- let response = await this._request(url);
4651
- if (response?.elements) {
4652
- return Promise.all(response.elements.map((item) => this._termToJSKOS(item)));
4653
- }
4678
+ let response = await this._paginate(["ontologies", VOCID, "classes", iri, "ancestors"], {}, null);
4679
+ return Promise.all(response.map((item) => this._termToJSKOS(item)));
4654
4680
  }
4655
4681
  return [];
4656
4682
  }
@@ -4829,7 +4855,7 @@ var MyCoReProvider = class extends BaseProvider {
4829
4855
  return data2[this._scheme.uri].topConcepts.map(this._removeNarrower);
4830
4856
  }
4831
4857
  async getConcepts({ concepts, ...config }) {
4832
- if (!import_isArray.default(concepts)) {
4858
+ if (!Array.isArray(concepts)) {
4833
4859
  concepts = [concepts];
4834
4860
  }
4835
4861
  if (!this._scheme) {
@@ -5070,8 +5096,19 @@ NoTApiProvider.providerType = "http://bartoc.org/api-type/noterms";
5070
5096
  var providers = {
5071
5097
  [BaseProvider.providerName]: BaseProvider,
5072
5098
  init(registry) {
5073
- if (this[registry.provider]) {
5074
- return new this[registry.provider](registry);
5099
+ let name = registry.provider;
5100
+ if (registry.api) {
5101
+ Object.keys(this).find((p) => {
5102
+ if (providers[p].prototype instanceof BaseProvider && registry.api === providers[p].providerType) {
5103
+ registry = { ...registry };
5104
+ delete registry.api;
5105
+ name = p;
5106
+ return true;
5107
+ }
5108
+ });
5109
+ }
5110
+ if (this[name]) {
5111
+ return new this[name](registry);
5075
5112
  }
5076
5113
  throw new InvalidProviderError();
5077
5114
  },
@@ -5185,7 +5222,7 @@ var CocodaSDK = class _CocodaSDK {
5185
5222
  callback: (error, result, previousResult) => {
5186
5223
  if (error) {
5187
5224
  callback(error);
5188
- } else if (previousResult || !previousResult && buildInfo && !import_isEqual.default(result, buildInfo)) {
5225
+ } else if (previousResult || !previousResult && buildInfo && !deepEqual(result, buildInfo)) {
5189
5226
  callback(null, result, previousResult || buildInfo);
5190
5227
  }
5191
5228
  }
@@ -5276,7 +5313,7 @@ var CocodaSDK = class _CocodaSDK {
5276
5313
  };
5277
5314
  const handleResult = (result) => {
5278
5315
  const previousResult = repeat.result;
5279
- if (!import_isEqual.default(previousResult, result)) {
5316
+ if (!deepEqual(previousResult, result)) {
5280
5317
  repeat.result = result;
5281
5318
  repeat.error = null;
5282
5319
  callback(null, result, previousResult);
@@ -5356,7 +5393,7 @@ var CocodaSDK = class _CocodaSDK {
5356
5393
  if (prio != -1) {
5357
5394
  prio = this.config.registries.length - prio;
5358
5395
  }
5359
- otherPrio = this.config.registries.indexOf(import_get.default(otherScheme, "_registry"));
5396
+ otherPrio = this.config.registries.indexOf(otherScheme?._registry);
5360
5397
  if (otherPrio != -1) {
5361
5398
  otherPrio = this.config.registries.length - otherPrio;
5362
5399
  }
@@ -5376,7 +5413,8 @@ var CocodaSDK = class _CocodaSDK {
5376
5413
  if (otherSchemeIndex != -1) {
5377
5414
  schemes.splice(otherSchemeIndex, 1);
5378
5415
  }
5379
- scheme = import_jskos_tools14.default.merge(scheme, import_omit.default(otherScheme, ["concepts", "topConcepts"]), { mergeUris: true, skipPaths: ["_registry"] });
5416
+ const { concepts, topConcepts, ...fromOtherScheme } = otherScheme;
5417
+ scheme = import_jskos_tools14.default.merge(scheme, fromOtherScheme, { mergeUris: true, skipPaths: ["_registry"] });
5380
5418
  }
5381
5419
  scheme._registry = registry;
5382
5420
  schemes.push(scheme);
@@ -5384,7 +5422,8 @@ var CocodaSDK = class _CocodaSDK {
5384
5422
  const index = schemes.findIndex((s) => import_jskos_tools14.default.compare(s, scheme));
5385
5423
  if (index != -1) {
5386
5424
  const otherSchemeRegistry = schemes[index]._registry;
5387
- schemes[index] = import_jskos_tools14.default.merge(schemes[index], import_omit.default(scheme, ["concepts", "topConcepts"]), { mergeUris: true, skipPaths: ["_registry"] });
5425
+ const { concepts, topConcepts, ...fromScheme } = scheme;
5426
+ schemes[index] = import_jskos_tools14.default.merge(schemes[index], fromScheme, { mergeUris: true, skipPaths: ["_registry"] });
5388
5427
  schemes[index]._registry = otherSchemeRegistry;
5389
5428
  }
5390
5429
  }
@@ -5488,5 +5527,6 @@ function addAllProviders(_cdk) {
5488
5527
  addAllProviders,
5489
5528
  cdk,
5490
5529
  errors,
5530
+ providers,
5491
5531
  utils
5492
5532
  });