@almadar/integrations 2.42.0 → 2.43.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.
@@ -1,4 +1,4 @@
1
- import { g as IntegrationParams, B as BaseIntegration, a as IntegrationConfig, h as IntegrationResult } from '../../BaseIntegration-D_iNTesu.js';
1
+ import { g as IntegrationParams, B as BaseIntegration, a as IntegrationConfig, h as IntegrationResult } from '../../BaseIntegration-Dgwn1ZR6.js';
2
2
  import '@almadar/core';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { B as BaseIntegration, a as IntegrationConfig, g as IntegrationParams, h as IntegrationResult, d as IntegrationFactory } from '../BaseIntegration-D_iNTesu.js';
1
+ import { B as BaseIntegration, a as IntegrationConfig, g as IntegrationParams, h as IntegrationResult, d as IntegrationFactory } from '../BaseIntegration-Dgwn1ZR6.js';
2
2
  import '@almadar/core';
3
3
 
4
4
  /**
@@ -403,6 +403,8 @@ var IntegrationFactory = class {
403
403
  constructor() {
404
404
  this.instances = /* @__PURE__ */ new Map();
405
405
  this.configs = /* @__PURE__ */ new Map();
406
+ /** Names whose app-wide instance was registered directly (mock infrastructure). */
407
+ this.registered = /* @__PURE__ */ new Set();
406
408
  }
407
409
  /**
408
410
  * Configure an integration (doesn't instantiate yet). A `principal` scopes
@@ -417,7 +419,8 @@ var IntegrationFactory = class {
417
419
  * back to the app-wide config when no per-principal config exists.
418
420
  */
419
421
  get(name, principal) {
420
- const key = instanceKey(name, principal);
422
+ const registered = this.registered.has(name) && !this.configs.has(instanceKey(name, principal));
423
+ const key = registered ? name : instanceKey(name, principal);
421
424
  const cached = this.instances.get(key);
422
425
  if (cached) {
423
426
  return cached;
@@ -461,6 +464,7 @@ var IntegrationFactory = class {
461
464
  * Register an integration instance directly (used by mock infrastructure)
462
465
  */
463
466
  registerInstance(name, instance, principal) {
467
+ if (principal === void 0) this.registered.add(name);
464
468
  this.instances.set(instanceKey(name, principal), instance);
465
469
  }
466
470
  /**
@@ -471,8 +475,10 @@ var IntegrationFactory = class {
471
475
  invalidate(name) {
472
476
  if (name === void 0) {
473
477
  this.instances.clear();
478
+ this.registered.clear();
474
479
  return;
475
480
  }
481
+ this.registered.delete(name);
476
482
  for (const key of this.instances.keys()) {
477
483
  if (key === name || key.startsWith(`${name}\0`)) {
478
484
  this.instances.delete(key);
@@ -484,6 +490,7 @@ var IntegrationFactory = class {
484
490
  */
485
491
  clear() {
486
492
  this.instances.clear();
493
+ this.registered.clear();
487
494
  }
488
495
  /**
489
496
  * Clear all instances and configs
@@ -491,6 +498,7 @@ var IntegrationFactory = class {
491
498
  reset() {
492
499
  this.instances.clear();
493
500
  this.configs.clear();
501
+ this.registered.clear();
494
502
  }
495
503
  };
496
504