@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.
@@ -13891,13 +13891,27 @@ var Granular = class _Granular {
13891
13891
  registerEnvironmentImporter(ontologyNameOrId, handler) {
13892
13892
  this.ontologyImporters.set(ontologyNameOrId, handler);
13893
13893
  if (ontologyNameOrId.startsWith("sbx_")) {
13894
- this.sandboxImporters.set(ontologyNameOrId, handler);
13894
+ this.sandboxImporters.set(ontologyNameOrId, {
13895
+ handler,
13896
+ sourceOntology: ontologyNameOrId
13897
+ });
13898
+ return;
13899
+ }
13900
+ for (const [sandboxId, importer] of this.sandboxImporters.entries()) {
13901
+ if (importer.sourceOntology === ontologyNameOrId) {
13902
+ this.sandboxImporters.set(sandboxId, {
13903
+ handler,
13904
+ sourceOntology: ontologyNameOrId
13905
+ });
13906
+ }
13895
13907
  }
13896
13908
  }
13897
13909
  clearEnvironmentImporter(ontologyNameOrId) {
13898
13910
  this.ontologyImporters.delete(ontologyNameOrId);
13899
- if (ontologyNameOrId.startsWith("sbx_")) {
13900
- this.sandboxImporters.delete(ontologyNameOrId);
13911
+ for (const [sandboxId, importer] of this.sandboxImporters.entries()) {
13912
+ if (importer.sourceOntology === ontologyNameOrId) {
13913
+ this.sandboxImporters.delete(sandboxId);
13914
+ }
13901
13915
  }
13902
13916
  }
13903
13917
  /**
@@ -14258,11 +14272,25 @@ var Granular = class _Granular {
14258
14272
  return this.connectSession({ sessionId, clientId: options?.clientId });
14259
14273
  }
14260
14274
  resolveEnvironmentImporter(requestedOntology, sandboxId) {
14261
- const resolved = this.sandboxImporters.get(sandboxId) || this.ontologyImporters.get(requestedOntology);
14262
- if (resolved && !this.sandboxImporters.has(sandboxId) && this.ontologyImporters.get(requestedOntology) === resolved) {
14263
- this.sandboxImporters.set(sandboxId, resolved);
14275
+ const sandboxImporter = this.sandboxImporters.get(sandboxId);
14276
+ if (sandboxImporter) {
14277
+ const sourceImporter = this.ontologyImporters.get(
14278
+ sandboxImporter.sourceOntology
14279
+ );
14280
+ if (sourceImporter === sandboxImporter.handler) {
14281
+ return sandboxImporter.handler;
14282
+ }
14283
+ this.sandboxImporters.delete(sandboxId);
14264
14284
  }
14265
- return resolved;
14285
+ const ontologyImporter = this.ontologyImporters.get(requestedOntology);
14286
+ if (!ontologyImporter) {
14287
+ return void 0;
14288
+ }
14289
+ this.sandboxImporters.set(sandboxId, {
14290
+ handler: ontologyImporter,
14291
+ sourceOntology: requestedOntology
14292
+ });
14293
+ return ontologyImporter;
14266
14294
  }
14267
14295
  async maybeRunEnvironmentImporter(resolved, environment) {
14268
14296
  if (!resolved.setupTriggerReason) {