@granular-software/sdk 0.4.35 → 0.4.36

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.
@@ -13866,13 +13866,27 @@ var Granular = class _Granular {
13866
13866
  registerEnvironmentImporter(ontologyNameOrId, handler) {
13867
13867
  this.ontologyImporters.set(ontologyNameOrId, handler);
13868
13868
  if (ontologyNameOrId.startsWith("sbx_")) {
13869
- this.sandboxImporters.set(ontologyNameOrId, handler);
13869
+ this.sandboxImporters.set(ontologyNameOrId, {
13870
+ handler,
13871
+ sourceOntology: ontologyNameOrId
13872
+ });
13873
+ return;
13874
+ }
13875
+ for (const [sandboxId, importer] of this.sandboxImporters.entries()) {
13876
+ if (importer.sourceOntology === ontologyNameOrId) {
13877
+ this.sandboxImporters.set(sandboxId, {
13878
+ handler,
13879
+ sourceOntology: ontologyNameOrId
13880
+ });
13881
+ }
13870
13882
  }
13871
13883
  }
13872
13884
  clearEnvironmentImporter(ontologyNameOrId) {
13873
13885
  this.ontologyImporters.delete(ontologyNameOrId);
13874
- if (ontologyNameOrId.startsWith("sbx_")) {
13875
- this.sandboxImporters.delete(ontologyNameOrId);
13886
+ for (const [sandboxId, importer] of this.sandboxImporters.entries()) {
13887
+ if (importer.sourceOntology === ontologyNameOrId) {
13888
+ this.sandboxImporters.delete(sandboxId);
13889
+ }
13876
13890
  }
13877
13891
  }
13878
13892
  /**
@@ -14233,11 +14247,25 @@ var Granular = class _Granular {
14233
14247
  return this.connectSession({ sessionId, clientId: options?.clientId });
14234
14248
  }
14235
14249
  resolveEnvironmentImporter(requestedOntology, sandboxId) {
14236
- const resolved = this.sandboxImporters.get(sandboxId) || this.ontologyImporters.get(requestedOntology);
14237
- if (resolved && !this.sandboxImporters.has(sandboxId) && this.ontologyImporters.get(requestedOntology) === resolved) {
14238
- this.sandboxImporters.set(sandboxId, resolved);
14250
+ const sandboxImporter = this.sandboxImporters.get(sandboxId);
14251
+ if (sandboxImporter) {
14252
+ const sourceImporter = this.ontologyImporters.get(
14253
+ sandboxImporter.sourceOntology
14254
+ );
14255
+ if (sourceImporter === sandboxImporter.handler) {
14256
+ return sandboxImporter.handler;
14257
+ }
14258
+ this.sandboxImporters.delete(sandboxId);
14239
14259
  }
14240
- return resolved;
14260
+ const ontologyImporter = this.ontologyImporters.get(requestedOntology);
14261
+ if (!ontologyImporter) {
14262
+ return void 0;
14263
+ }
14264
+ this.sandboxImporters.set(sandboxId, {
14265
+ handler: ontologyImporter,
14266
+ sourceOntology: requestedOntology
14267
+ });
14268
+ return ontologyImporter;
14241
14269
  }
14242
14270
  async maybeRunEnvironmentImporter(resolved, environment) {
14243
14271
  if (!resolved.setupTriggerReason) {