@acorex/platform 21.0.0-next.3 → 21.0.0-next.5

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.
@@ -3,7 +3,7 @@ import * as i6 from '@acorex/core/translation';
3
3
  import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
4
4
  import * as i4$1 from '@acorex/platform/common';
5
5
  import { AXPSettingsService, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPRefreshEvent, AXPReloadEvent, AXPCommonSettings, AXPEntityQueryType, AXPCleanNestedFilters, AXPWorkflowNavigateAction, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER } from '@acorex/platform/common';
6
- import { AXPModuleProviderRegistry, AXP_MODULE_PROVIDER_LOADER, AXPModuleManifestRegistry, AXPDeviceService, AXPBroadcastEventService, resolveActionLook, AXPExpressionEvaluatorService, AXPDistributedEventListenerService, AXPPlatformScope, AXHighlightService, extractValue, setSmart, getChangedPaths, AXPSystemActionType } from '@acorex/platform/core';
6
+ import { AXPDeviceService, AXPBroadcastEventService, resolveActionLook, AXPExpressionEvaluatorService, AXPDistributedEventListenerService, AXPPlatformScope, AXHighlightService, extractValue, setSmart, getChangedPaths, AXPSystemActionType } from '@acorex/platform/core';
7
7
  import * as i0 from '@angular/core';
8
8
  import { InjectionToken, inject, Injector, runInInjectionContext, Injectable, input, viewChild, signal, ElementRef, ChangeDetectionStrategy, Component, ApplicationRef, EnvironmentInjector, createComponent, computed, effect, Input, afterNextRender, ViewEncapsulation, ChangeDetectorRef, viewChildren, linkedSignal, untracked, HostBinding, NgModule } from '@angular/core';
9
9
  import { Subject, takeUntil } from 'rxjs';
@@ -407,28 +407,37 @@ const AXP_ENTITY_DEFINITION_LOADER = new InjectionToken('AXP_ENTITY_DEFINITION_P
407
407
  class AXPEntityResolver {
408
408
  constructor() {
409
409
  this.providers = inject(AXP_ENTITY_DEFINITION_LOADER);
410
- this.providerRegistry = inject(AXPModuleProviderRegistry);
411
410
  }
412
411
  async get(moduleName, entityName) {
413
- // Load from DI tokens (backward compatibility)
412
+ // Load from DI tokens
414
413
  if (Array.isArray(this.providers)) {
415
414
  for (const loader of this.providers) {
416
- const entity = await loader.get(moduleName, entityName);
415
+ let resolvedLoader;
416
+ if (loader instanceof Promise) {
417
+ // If loader is a promise, resolve it
418
+ resolvedLoader = await loader;
419
+ }
420
+ else {
421
+ // If loader is a direct instance, use it directly
422
+ resolvedLoader = loader;
423
+ }
424
+ const entity = await resolvedLoader.get(moduleName, entityName);
417
425
  if (entity) {
418
426
  return entity;
419
427
  }
420
428
  }
421
429
  }
422
430
  else {
423
- const entity = await this.providers.get(moduleName, entityName);
424
- if (entity) {
425
- return entity;
431
+ let resolvedLoader;
432
+ if (this.providers instanceof Promise) {
433
+ // If loader is a promise, resolve it
434
+ resolvedLoader = await this.providers;
426
435
  }
427
- }
428
- // Load from registry (manifest-based, conditionally loaded)
429
- const registryProviders = this.providerRegistry.getEntityProviders();
430
- for (const loader of registryProviders) {
431
- const entity = await loader.get(moduleName, entityName);
436
+ else {
437
+ // If loader is a direct instance, use it directly
438
+ resolvedLoader = this.providers;
439
+ }
440
+ const entity = await resolvedLoader.get(moduleName, entityName);
432
441
  if (entity) {
433
442
  return entity;
434
443
  }
@@ -446,8 +455,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
446
455
  class AXPEntityDefinitionRegistryService {
447
456
  constructor() {
448
457
  this.middleware = inject(AXPEntityMiddleware);
449
- this.moduleProviderLoader = inject(AXP_MODULE_PROVIDER_LOADER, { optional: true });
450
- this.manifestRegistry = inject(AXPModuleManifestRegistry, { optional: true });
451
458
  this.onChanged = new Subject();
452
459
  // Stores AXPEntityConfig objects, keyed by a combination of module and entity name.
453
460
  this.entities = new Map();
@@ -547,8 +554,6 @@ class AXPEntityDefinitionRegistryService {
547
554
  const key = this.createEntityKey(moduleName, entityName);
548
555
  let config = this.entities.get(key) ?? null;
549
556
  if (!config) {
550
- // Wait for module provider to be loaded if module exists in manifest but provider isn't registered yet
551
- await this.waitForModuleProviderIfNeeded(moduleName);
552
557
  try {
553
558
  config = await this.entityResolver.get(moduleName, entityName);
554
559
  if (config) {
@@ -570,46 +575,6 @@ class AXPEntityDefinitionRegistryService {
570
575
  const key = this.createEntityKey(moduleName, entityName);
571
576
  return this.entities.has(key);
572
577
  }
573
- /**
574
- * Waits for module provider to be loaded if the module exists in manifest but provider isn't registered yet.
575
- * This handles race conditions where entity resolution happens before module providers finish loading.
576
- * Only waits for required modules or waits briefly for non-required modules (which may not be accessible to current user).
577
- */
578
- async waitForModuleProviderIfNeeded(moduleName) {
579
- if (!this.moduleProviderLoader || !this.manifestRegistry) {
580
- return;
581
- }
582
- try {
583
- await this.manifestRegistry.initialize();
584
- const manifest = this.manifestRegistry.get(moduleName);
585
- if (!manifest || this.moduleProviderLoader.isModuleRegistered(moduleName)) {
586
- return;
587
- }
588
- const isRequired = manifest.required === true;
589
- // Increase wait time for non-required modules to handle cases where providers are still loading
590
- // This prevents "Invalid entity name" errors during page refresh when entities are accessed
591
- // before module providers finish loading
592
- const maxRetries = isRequired ? 10 : 20; // Increased from 2 to 20 for non-required modules
593
- const retryDelay = isRequired ? 100 : 100; // Increased from 50ms to 100ms for consistency
594
- for (let attempt = 0; attempt < maxRetries; attempt++) {
595
- await new Promise((resolve) => setTimeout(resolve, retryDelay));
596
- if (this.moduleProviderLoader.isModuleRegistered(moduleName)) {
597
- return;
598
- }
599
- }
600
- // Warn for both required and non-required modules if provider still not registered
601
- // This helps debug race conditions during page refresh
602
- console.warn(`[AXPEntityDefinitionRegistryService] Module '${moduleName}' exists in manifest but provider not registered after ${maxRetries} retries (${maxRetries * retryDelay}ms). ` +
603
- `Entity resolution will proceed, but may fail if provider is not available.`);
604
- }
605
- catch (error) {
606
- // Only log for required modules to reduce noise
607
- const manifest = this.manifestRegistry?.get(moduleName);
608
- if (manifest?.required) {
609
- console.warn(`[AXPEntityDefinitionRegistryService] Error checking module provider status for '${moduleName}':`, error);
610
- }
611
- }
612
- }
613
578
  /**
614
579
  * Creates a unique key for an entity based on its module and name.
615
580
  *
@@ -1807,7 +1772,15 @@ class AXPDataSeederService {
1807
1772
  }
1808
1773
  async seed() {
1809
1774
  for (const loader of castArray(this.loaders)) {
1810
- await loader?.seed();
1775
+ if (!loader)
1776
+ continue;
1777
+ const seederName = loader.constructor?.name || 'UnknownSeeder';
1778
+ const startTime = performance.now();
1779
+ await loader.seed();
1780
+ const duration = performance.now() - startTime;
1781
+ if (duration > 3000) {
1782
+ console.warn(`[AXPDataSeeder] Seeder "${seederName}" took ${duration.toFixed(2)}ms (>3000ms threshold)`);
1783
+ }
1811
1784
  }
1812
1785
  }
1813
1786
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPDataSeederService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -2284,7 +2257,6 @@ class AXPEntityCreateViewElementViewModel {
2284
2257
  path: this.name(),
2285
2258
  name: this.name(),
2286
2259
  children: widget.children,
2287
- formula: widget.formula,
2288
2260
  triggers: widget.triggers,
2289
2261
  defaultValue: schema.defaultValue,
2290
2262
  valueTransforms: widget.valueTransforms,
@@ -3594,7 +3566,6 @@ class AXPEntityMasterUpdateElementViewModel {
3594
3566
  path: this.name(),
3595
3567
  name: this.name(),
3596
3568
  children: widget.children,
3597
- formula: widget.formula,
3598
3569
  triggers: widget.triggers,
3599
3570
  valueTransforms: widget.valueTransforms,
3600
3571
  options: merge(schema.interface?.options, {
@@ -3852,7 +3823,6 @@ class AXPEntityMasterSingleElementViewModel {
3852
3823
  mode: 'view',
3853
3824
  path: this.path(),
3854
3825
  children: widget.children,
3855
- formula: widget.formula,
3856
3826
  valueTransforms: widget.valueTransforms,
3857
3827
  options: merge(schema.interface?.options),
3858
3828
  };