cocoda-sdk 3.0.2 → 3.0.3

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.
@@ -177,7 +177,7 @@ class CocodaSDK {
177
177
  if (registry.has.schemes !== false) {
178
178
  let promise = registry.getSchemes(config).then((results) => {
179
179
  for (let scheme of results) {
180
- const currentSchemeRegistry = scheme._registry;
180
+ scheme._registry = registry;
181
181
  scheme.__DETAILSLOADED__ = 1;
182
182
  scheme.type = scheme.type || ["http://www.w3.org/2004/02/skos/core#ConceptScheme"];
183
183
  let otherScheme = schemes.find((s) => jskos.compare(s, scheme)), prio, otherPrio, override = false;
@@ -208,7 +208,7 @@ class CocodaSDK {
208
208
  }
209
209
  scheme = jskos.merge(scheme, _.omit(otherScheme, ["concepts", "topConcepts"]), { mergeUris: true, skipPaths: ["_registry"] });
210
210
  }
211
- scheme._registry = currentSchemeRegistry;
211
+ scheme._registry = registry;
212
212
  schemes.push(scheme);
213
213
  } else {
214
214
  const index = schemes.findIndex((s) => jskos.compare(s, scheme));
@@ -226,6 +226,16 @@ class CocodaSDK {
226
226
  }
227
227
  }
228
228
  await Promise.all(promises);
229
+ schemes.forEach((scheme) => {
230
+ const previousRegistry = scheme._registry;
231
+ delete scheme._registry;
232
+ const newRegistry = this.registryForScheme(scheme);
233
+ if (!newRegistry || newRegistry._api.api === previousRegistry._api.api) {
234
+ scheme._registry = previousRegistry;
235
+ } else {
236
+ scheme._registry = newRegistry;
237
+ }
238
+ });
229
239
  return jskos.sortSchemes(schemes.filter(Boolean));
230
240
  }
231
241
  registryForScheme(scheme) {
@@ -315,7 +315,7 @@ class BaseProvider {
315
315
  }
316
316
  const previousRegistry = scheme._registry;
317
317
  scheme._registry = this.cdk && this.cdk.registryForScheme(scheme);
318
- if (!scheme._registry || previousRegistry === scheme._registry) {
318
+ if (!scheme._registry || previousRegistry === scheme._registry || scheme._registry._api.api === this._api.api) {
319
319
  scheme._registry = previousRegistry || this;
320
320
  } else {
321
321
  ["concepts", "topConcepts"].forEach((key) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cocoda-sdk",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "SDK for Cocoda",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.js",