@praxisui/core 10.0.0-rc.40 → 10.0.0-rc.41

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,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, InjectionToken, Injectable, inject, Inject, Optional, SkipSelf, makeEnvironmentProviders, signal, computed, APP_INITIALIZER, ErrorHandler, Injector, DestroyRef, ENVIRONMENT_INITIALIZER, isSignal, Input, Directive, input, booleanAttribute, ChangeDetectionStrategy, EventEmitter, Output, SecurityContext, ViewContainerRef, effect, untracked, SimpleChange, ElementRef, ChangeDetectorRef, afterEveryRender, contentChild, viewChild, HostBinding, output, afterNextRender, ViewChild, ViewEncapsulation, createEnvironmentInjector, EnvironmentInjector, reflectComponentType, HostListener, ViewChildren, forwardRef, TemplateRef, Renderer2 } from '@angular/core';
2
+ import { Component, InjectionToken, APP_INITIALIZER, inject, Injectable, assertInInjectionContext, Inject, Optional, SkipSelf, makeEnvironmentProviders, signal, computed, ErrorHandler, Injector, DestroyRef, ENVIRONMENT_INITIALIZER, isSignal, Input, Directive, input, booleanAttribute, ChangeDetectionStrategy, EventEmitter, Output, SecurityContext, ViewContainerRef, effect, untracked, SimpleChange, ElementRef, ChangeDetectorRef, afterEveryRender, contentChild, viewChild, HostBinding, output, afterNextRender, ViewChild, ViewEncapsulation, createEnvironmentInjector, EnvironmentInjector, reflectComponentType, HostListener, ViewChildren, forwardRef, TemplateRef, Renderer2 } from '@angular/core';
3
3
  import * as i1 from '@angular/common/http';
4
4
  import { HttpHeaders, HttpClient, HttpParams, HttpResponse, HttpContextToken, HttpErrorResponse, HTTP_INTERCEPTORS, withInterceptors } from '@angular/common/http';
5
- import { of, defer, throwError, from, EMPTY, BehaviorSubject, firstValueFrom, Subject, finalize as finalize$1, shareReplay as shareReplay$1, map as map$1, catchError as catchError$1, switchMap as switchMap$1, Observable, timer, forkJoin, isObservable, combineLatest, merge, Subscription, defaultIfEmpty, timeout as timeout$1 } from 'rxjs';
5
+ import { BehaviorSubject, firstValueFrom, of, defer, throwError, from, EMPTY, Subject, finalize as finalize$1, shareReplay as shareReplay$1, tap as tap$1, map as map$1, switchMap as switchMap$1, Observable, timer, catchError as catchError$1, forkJoin, isObservable, combineLatest, merge, Subscription, defaultIfEmpty, timeout as timeout$1 } from 'rxjs';
6
6
  import { switchMap, map, take, catchError, concatMap, tap, shareReplay, takeUntil, toArray, finalize, exhaustMap, filter, timeout } from 'rxjs/operators';
7
7
  import * as i1$3 from '@angular/common';
8
8
  import { Location, DOCUMENT, NgTemplateOutlet, CommonModule, NgComponentOutlet } from '@angular/common';
@@ -301,6 +301,378 @@ function composeHeadersWithVersion(entry, headerName = 'Api-Version') {
301
301
  return headers.keys().length ? headers : undefined;
302
302
  }
303
303
 
304
+ const PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS = new InjectionToken('PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS');
305
+ const PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY = new InjectionToken('PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY');
306
+ function providePraxisEnterpriseRuntimeContext(options = {}) {
307
+ const normalized = {
308
+ ...options,
309
+ includeGlobalFetchHeaders: options.includeGlobalFetchHeaders ?? true,
310
+ blocking: options.blocking ?? false,
311
+ errorPolicy: options.errorPolicy ?? 'ignore',
312
+ };
313
+ return [
314
+ { provide: PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS, useValue: normalized },
315
+ {
316
+ provide: PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY,
317
+ useFactory: (service) => () => service.ready().then(() => undefined),
318
+ deps: [EnterpriseRuntimeContextService],
319
+ },
320
+ {
321
+ provide: APP_INITIALIZER,
322
+ multi: true,
323
+ useFactory: (ready) => () => normalized.blocking ? ready() : undefined,
324
+ deps: [PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY],
325
+ },
326
+ ];
327
+ }
328
+
329
+ const CONTEXT_HEADERS = new Set([
330
+ 'x-tenant-id', 'x-tenant', 'x-user-id', 'x-env', 'x-updated-by',
331
+ 'x-praxis-profile-id', 'x-praxis-context-version',
332
+ ]);
333
+ const EXPERIENCE_HEADERS = new Set(['accept-language', 'x-timezone', 'x-praxis-module-key']);
334
+ /** A response for an older selection must never be presented as confirmed. */
335
+ class EnterpriseRuntimeContextObsoleteError extends Error {
336
+ constructor() {
337
+ super('Runtime context changed before the operation was confirmed.');
338
+ this.name = 'EnterpriseRuntimeContextObsoleteError';
339
+ }
340
+ }
341
+ class EnterpriseRuntimeContextService {
342
+ http = inject(HttpClient);
343
+ apiUrl = inject(API_URL, { optional: true });
344
+ options = inject(PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS, {
345
+ optional: true,
346
+ });
347
+ contextSubject = new BehaviorSubject(null);
348
+ loadPromise = null;
349
+ contextRevision = 0;
350
+ contextChanges$ = this.contextSubject.asObservable();
351
+ get snapshot() {
352
+ return this.contextSubject.value;
353
+ }
354
+ get effectiveContext() {
355
+ const context = this.snapshot;
356
+ return context?.state === 'ready' ? context.effectiveContext : null;
357
+ }
358
+ ready() {
359
+ if (this.contextSubject.value) {
360
+ return Promise.resolve(this.contextSubject.value);
361
+ }
362
+ if (this.loadPromise) {
363
+ return this.loadPromise;
364
+ }
365
+ const revision = this.contextRevision;
366
+ let currentLoad;
367
+ currentLoad = this.load(revision)
368
+ .catch((error) => {
369
+ if ((this.options?.errorPolicy ?? 'ignore') === 'fail') {
370
+ throw error;
371
+ }
372
+ return null;
373
+ })
374
+ .finally(() => {
375
+ if (this.loadPromise === currentLoad)
376
+ this.loadPromise = null;
377
+ });
378
+ this.loadPromise = currentLoad;
379
+ return currentLoad;
380
+ }
381
+ refresh() {
382
+ const revision = this.invalidateContext();
383
+ let currentLoad;
384
+ currentLoad = this.load(revision).catch((error) => {
385
+ if ((this.options?.errorPolicy ?? 'ignore') === 'fail') {
386
+ throw error;
387
+ }
388
+ return null;
389
+ }).finally(() => {
390
+ if (this.loadPromise === currentLoad)
391
+ this.loadPromise = null;
392
+ });
393
+ this.loadPromise = currentLoad;
394
+ return currentLoad;
395
+ }
396
+ invalidate() {
397
+ this.invalidateContext();
398
+ }
399
+ /** Independent host tenant discovery; it never selects the runtime context. */
400
+ tenants() {
401
+ return this.getRuntimeSurface('tenants');
402
+ }
403
+ choices(options = {}) {
404
+ const pageSize = options.pageSize ?? 50;
405
+ if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100) {
406
+ return Promise.reject(new RangeError('pageSize must be an integer between 1 and 100.'));
407
+ }
408
+ let params = new HttpParams().set('pageSize', pageSize);
409
+ if (options.cursor !== undefined)
410
+ params = params.set('cursor', options.cursor);
411
+ return firstValueFrom(this.http.get(this.endpoint('choices'), {
412
+ headers: this.requestHeaders({ includeSnapshot: true }), params,
413
+ }));
414
+ }
415
+ /** Read one authorized navigation page for the currently confirmed context. */
416
+ async navigation(options = {}) {
417
+ const { parentRef, cursor, pageSize = 50 } = options;
418
+ if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100) {
419
+ throw new RangeError('pageSize must be an integer between 1 and 100.');
420
+ }
421
+ if (parentRef !== undefined && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(parentRef)) {
422
+ throw new RangeError('parentRef must be a canonical group UUID.');
423
+ }
424
+ if (cursor !== undefined && (typeof cursor !== 'string' || cursor.length === 0 || cursor.length > 4096)) {
425
+ throw new RangeError('cursor must be a non-empty opaque string of at most 4096 characters.');
426
+ }
427
+ // Capture before ready(): a context load or switch may itself become obsolete.
428
+ const revision = this.contextRevision;
429
+ let expectedContextVersion = null;
430
+ try {
431
+ const context = await this.ready();
432
+ if (revision !== this.contextRevision)
433
+ throw new EnterpriseRuntimeContextObsoleteError();
434
+ const contextVersion = context?.state === 'ready' ? context.effectiveContext?.contextVersion : null;
435
+ if (!contextVersion?.trim())
436
+ throw new Error('Runtime context is not confirmed.');
437
+ expectedContextVersion = contextVersion;
438
+ if (this.effectiveContext?.contextVersion !== contextVersion)
439
+ throw new EnterpriseRuntimeContextObsoleteError();
440
+ let params = new HttpParams().set('pageSize', pageSize);
441
+ if (parentRef !== undefined)
442
+ params = params.set('parentRef', parentRef);
443
+ if (cursor !== undefined)
444
+ params = params.set('cursor', cursor);
445
+ const headers = this.requestHeaders({ includeSnapshot: true });
446
+ if (revision !== this.contextRevision || this.effectiveContext?.contextVersion !== contextVersion) {
447
+ throw new EnterpriseRuntimeContextObsoleteError();
448
+ }
449
+ const response = await firstValueFrom(this.http.get(this.endpoint('navigation'), {
450
+ headers, params,
451
+ }));
452
+ if (revision !== this.contextRevision || this.effectiveContext?.contextVersion !== contextVersion) {
453
+ throw new EnterpriseRuntimeContextObsoleteError();
454
+ }
455
+ if (response.contextVersion !== contextVersion) {
456
+ throw new EnterpriseRuntimeContextObsoleteError();
457
+ }
458
+ return response;
459
+ }
460
+ catch (error) {
461
+ if (revision !== this.contextRevision || (expectedContextVersion !== null && this.effectiveContext?.contextVersion !== expectedContextVersion)) {
462
+ throw new EnterpriseRuntimeContextObsoleteError();
463
+ }
464
+ throw error;
465
+ }
466
+ }
467
+ securityEvents() {
468
+ return this.getRuntimeSurface('securityEvents');
469
+ }
470
+ switchContext(command) {
471
+ const revision = this.invalidateContext();
472
+ const operation = firstValueFrom(this.http.put(this.endpoint('context'), command, { headers: this.requestHeaders() })).then((response) => {
473
+ if (revision !== this.contextRevision)
474
+ throw new EnterpriseRuntimeContextObsoleteError();
475
+ const context = this.normalizeContext(response);
476
+ this.contextSubject.next(context);
477
+ return context;
478
+ });
479
+ let currentSwitch;
480
+ currentSwitch = operation.finally(() => {
481
+ if (this.loadPromise === currentSwitch)
482
+ this.loadPromise = null;
483
+ });
484
+ this.loadPromise = currentSwitch;
485
+ return currentSwitch;
486
+ }
487
+ headers(fallback) {
488
+ return {
489
+ ...this.withoutContextHeaders(this.normalizeHeaders(fallback ?? {}), true),
490
+ ...this.normalizeHeaders(this.headersFromSnapshot(this.contextSubject.value)),
491
+ };
492
+ }
493
+ /** Preserve host authentication headers while removing unconfirmed contextual claims. */
494
+ effectiveRequestHeaders(fallback) {
495
+ const bootstrap = this.withoutContextHeaders(this.normalizeHeaders({
496
+ ...(this.options?.includeGlobalFetchHeaders ?? true ? this.globalFetchHeaders() : {}),
497
+ ...(this.options?.headersFactory?.() ?? {}),
498
+ ...(fallback ?? {}),
499
+ }), true);
500
+ const merged = { ...bootstrap, ...this.headersFromSnapshot(this.contextSubject.value) };
501
+ const result = {};
502
+ for (const [name, value] of Object.entries(merged)) {
503
+ if (typeof value === 'string' && value.trim())
504
+ result[name] = value;
505
+ }
506
+ return result;
507
+ }
508
+ /**
509
+ * Applies the confirmed runtime snapshot to an existing request header set.
510
+ * Contextual names are removed case-insensitively first, so nullable snapshot
511
+ * fields cannot leave bootstrap or caller identity behind. Unrelated headers,
512
+ * including repeated values, remain untouched.
513
+ */
514
+ applyHeaders(headers) {
515
+ if (!this.effectiveContext) {
516
+ return headers;
517
+ }
518
+ let next = headers;
519
+ for (const name of headers.keys()) {
520
+ if (this.isContextualHeader(name)) {
521
+ next = next.delete(name);
522
+ }
523
+ }
524
+ for (const [name, value] of Object.entries(this.headersFromSnapshot(this.contextSubject.value))) {
525
+ if (typeof value === 'string') {
526
+ next = next.set(name, value);
527
+ }
528
+ }
529
+ return next;
530
+ }
531
+ invalidateContext() {
532
+ this.contextRevision += 1;
533
+ this.loadPromise = null;
534
+ this.contextSubject.next(null);
535
+ return this.contextRevision;
536
+ }
537
+ async load(revision) {
538
+ const response = await firstValueFrom(this.http.get(this.endpoint('context'), {
539
+ headers: this.requestHeaders(),
540
+ }));
541
+ if (revision !== this.contextRevision)
542
+ return null;
543
+ const context = this.normalizeContext(response);
544
+ this.contextSubject.next(context ?? null);
545
+ return context ?? null;
546
+ }
547
+ normalizeContext(context) {
548
+ if (context.state !== 'ready' || !context.effectiveContext) {
549
+ return context;
550
+ }
551
+ const effective = context.effectiveContext;
552
+ return {
553
+ ...context,
554
+ effectiveContext: {
555
+ ...effective,
556
+ activeOrganizationId: effective.activeOrganizationId ?? null,
557
+ capabilities: Array.isArray(effective.capabilities) ? effective.capabilities : [],
558
+ authorities: Array.isArray(effective.authorities) ? effective.authorities : [],
559
+ },
560
+ };
561
+ }
562
+ async getRuntimeSurface(surface) {
563
+ return firstValueFrom(this.http.get(this.endpoint(surface), {
564
+ headers: this.requestHeaders({ includeSnapshot: true }),
565
+ }));
566
+ }
567
+ endpoint(surface) {
568
+ const configured = this.configuredEndpoint(surface);
569
+ if (configured) {
570
+ return configured;
571
+ }
572
+ return `${this.runtimeRoot()}/${this.surfacePath(surface)}`;
573
+ }
574
+ configuredEndpoint(surface) {
575
+ const configured = surface === 'context'
576
+ ? (this.options?.endpoints?.context ?? this.options?.endpoint)
577
+ : this.options?.endpoints?.[surface];
578
+ const normalized = configured?.trim().replace(/\/+$/, '');
579
+ return normalized || null;
580
+ }
581
+ runtimeRoot() {
582
+ const configuredContext = this.configuredEndpoint('context');
583
+ if (configuredContext?.endsWith('/context')) {
584
+ return configuredContext.slice(0, -'/context'.length);
585
+ }
586
+ const defaultEntry = this.apiUrl?.['default'];
587
+ const base = defaultEntry ? buildApiUrl(defaultEntry) : '';
588
+ return base ? `${base}/praxis/runtime` : '/api/praxis/runtime';
589
+ }
590
+ surfacePath(surface) {
591
+ switch (surface) {
592
+ case 'context':
593
+ return 'context';
594
+ case 'tenants':
595
+ return 'tenants';
596
+ case 'choices':
597
+ return 'context/choices';
598
+ case 'navigation':
599
+ return 'navigation';
600
+ case 'securityEvents':
601
+ return 'security-events';
602
+ }
603
+ }
604
+ requestHeaders(options = {}) {
605
+ const bootstrap = this.withoutContextHeaders(this.normalizeHeaders({
606
+ ...(this.options?.includeGlobalFetchHeaders ?? true ? this.globalFetchHeaders() : {}),
607
+ ...(this.options?.headersFactory?.() ?? {}),
608
+ }), options.includeSnapshot ?? false);
609
+ const merged = {
610
+ ...bootstrap,
611
+ ...(options.includeSnapshot ? this.headersFromSnapshot(this.contextSubject.value) : {}),
612
+ };
613
+ let headers = new HttpHeaders();
614
+ for (const [key, value] of Object.entries(merged)) {
615
+ if (value) {
616
+ headers = headers.set(key, value);
617
+ }
618
+ }
619
+ return headers;
620
+ }
621
+ globalFetchHeaders() {
622
+ try {
623
+ const factory = globalThis.PAX_FETCH_HEADERS;
624
+ return factory?.() ?? {};
625
+ }
626
+ catch {
627
+ return {};
628
+ }
629
+ }
630
+ headersFromSnapshot(context) {
631
+ if (context?.state !== 'ready' || !context.effectiveContext) {
632
+ return {};
633
+ }
634
+ const effective = context.effectiveContext;
635
+ return {
636
+ 'X-Praxis-Context-Version': effective.contextVersion,
637
+ 'X-Tenant-ID': effective.activeTenant?.tenantId,
638
+ 'X-User-ID': context.user?.userId,
639
+ 'X-Env': effective.environment ?? undefined,
640
+ 'Accept-Language': effective.locale ?? undefined,
641
+ 'X-Timezone': effective.timezone ?? undefined,
642
+ 'X-Praxis-Profile-ID': effective.activeProfileId ?? undefined,
643
+ 'X-Praxis-Module-Key': effective.activeModuleKey ?? undefined,
644
+ };
645
+ }
646
+ withoutContextHeaders(headers, includeExperience) {
647
+ return Object.fromEntries(Object.entries(headers).filter(([key]) => !CONTEXT_HEADERS.has(key.toLowerCase())
648
+ && (!includeExperience || !EXPERIENCE_HEADERS.has(key.toLowerCase()))));
649
+ }
650
+ isContextualHeader(name) {
651
+ const normalized = name.toLowerCase();
652
+ return CONTEXT_HEADERS.has(normalized) || EXPERIENCE_HEADERS.has(normalized);
653
+ }
654
+ normalizeHeaders(headers) {
655
+ const normalized = {};
656
+ for (const [key, value] of Object.entries(headers)) {
657
+ if (typeof value !== 'string') {
658
+ continue;
659
+ }
660
+ const trimmed = value.trim();
661
+ if (!trimmed) {
662
+ continue;
663
+ }
664
+ normalized[key] = trimmed;
665
+ }
666
+ return normalized;
667
+ }
668
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: EnterpriseRuntimeContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
669
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: EnterpriseRuntimeContextService, providedIn: 'root' });
670
+ }
671
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: EnterpriseRuntimeContextService, decorators: [{
672
+ type: Injectable,
673
+ args: [{ providedIn: 'root' }]
674
+ }] });
675
+
304
676
  function normalizePath(p) {
305
677
  if (!p)
306
678
  return '';
@@ -344,6 +716,41 @@ function fnv1a32Base36(value) {
344
716
  return hash.toString(36).padStart(7, '0');
345
717
  }
346
718
 
719
+ /** Internal representation key; never replaces the public semantic schemaId. */
720
+ function buildSchemaRequestKey(schemaId, url, context) {
721
+ let resolvedUrl = url;
722
+ try {
723
+ const origin = globalThis.location?.origin;
724
+ if (url)
725
+ resolvedUrl = new URL(url, origin).toString();
726
+ }
727
+ catch {
728
+ // Relative URLs remain relative in non-browser callers without an origin.
729
+ }
730
+ return JSON.stringify([schemaId, resolvedUrl, context.tenant ?? null, context.locale ?? null]);
731
+ }
732
+
733
+ /** Private, bounded page-lifetime identities: credentials never enter persistent keys. */
734
+ const contextIds = new Map();
735
+ const session = globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
736
+ let sequence = 0;
737
+ function scopeSchemaRequestKey(key, headers) {
738
+ const extra = headers.map(([name, values]) => [name.toLowerCase(), [...values]])
739
+ .filter(([name]) => !['accept', 'if-none-match', 'x-tenant', 'accept-language', 'cache-control', 'pragma'].includes(name))
740
+ .sort(([a], [b]) => a.localeCompare(b));
741
+ if (!extra.length)
742
+ return key;
743
+ const fingerprint = JSON.stringify(extra);
744
+ let id = contextIds.get(fingerprint);
745
+ if (!id) {
746
+ id = `${session}:${++sequence}`;
747
+ if (contextIds.size >= 100)
748
+ contextIds.delete(contextIds.keys().next().value);
749
+ contextIds.set(fingerprint, id);
750
+ }
751
+ return JSON.stringify([key, id]);
752
+ }
753
+
347
754
  function hash(input) {
348
755
  let h = 0;
349
756
  for (let i = 0; i < input.length; i++)
@@ -826,16 +1233,20 @@ function normalizeResourceIdentityContract(value) {
826
1233
  return null;
827
1234
  const keyField = normalizeText$3(value['keyField']);
828
1235
  const titleField = normalizeText$3(value['titleField']);
1236
+ const subtitleField = normalizeText$3(value['subtitleField']);
1237
+ const avatarField = normalizeText$3(value['avatarField']);
829
1238
  const displayLabelField = normalizeText$3(value['displayLabelField']);
830
1239
  const metadataFields = normalizeStringList(value['metadataFields']);
831
1240
  const invalidFields = normalizeStringList(value['invalidFields']);
832
1241
  const message = normalizeText$3(value['message']);
833
1242
  const diagnostics = normalizeResourceIdentityDiagnostics(value['diagnostics']);
834
- if (!keyField && !titleField && !displayLabelField)
1243
+ if (!keyField && !titleField && !subtitleField && !avatarField && !displayLabelField)
835
1244
  return null;
836
1245
  return {
837
1246
  ...(keyField ? { keyField } : {}),
838
1247
  ...(titleField ? { titleField } : {}),
1248
+ ...(subtitleField ? { subtitleField } : {}),
1249
+ ...(avatarField ? { avatarField } : {}),
839
1250
  ...(metadataFields.length ? { metadataFields } : {}),
840
1251
  ...(displayLabelField ? { displayLabelField } : {}),
841
1252
  valid: value['valid'] !== false,
@@ -923,6 +1334,8 @@ function materializeResourceIdentity(contract, record, fields = []) {
923
1334
  const identity = {
924
1335
  key: part(contract.keyField),
925
1336
  title: part(contract.titleField),
1337
+ subtitle: part(contract.subtitleField),
1338
+ avatar: part(contract.avatarField),
926
1339
  metadata: (contract.metadataFields ?? [])
927
1340
  .map((fieldName) => part(fieldName))
928
1341
  .filter((value) => !!value),
@@ -934,7 +1347,12 @@ function materializeResourceIdentity(contract, record, fields = []) {
934
1347
  ? { diagnostics: contract.diagnostics.map((diagnostic) => ({ ...diagnostic })) }
935
1348
  : {}),
936
1349
  };
937
- return identity.key || identity.title || identity.metadata.length || identity.displayLabel
1350
+ return identity.key ||
1351
+ identity.title ||
1352
+ identity.subtitle ||
1353
+ identity.avatar ||
1354
+ identity.metadata.length ||
1355
+ identity.displayLabel
938
1356
  ? identity
939
1357
  : null;
940
1358
  }
@@ -2191,6 +2609,18 @@ function validateResourceQuickViewBinding(value) {
2191
2609
  diagnostics.push('Quick View recordOpen cannot declare "popover" presentation.');
2192
2610
  }
2193
2611
  }
2612
+ let previewSurfaceId;
2613
+ const rawPreviewSurfaceId = record['previewSurfaceId'];
2614
+ if (rawPreviewSurfaceId !== undefined && rawPreviewSurfaceId !== null) {
2615
+ if (typeof rawPreviewSurfaceId === 'string' &&
2616
+ rawPreviewSurfaceId.trim().length > 0 &&
2617
+ rawPreviewSurfaceId.trim().length <= 200) {
2618
+ previewSurfaceId = rawPreviewSurfaceId.trim();
2619
+ }
2620
+ else {
2621
+ diagnostics.push('Quick View previewSurfaceId must be a non-empty string up to 200 characters.');
2622
+ }
2623
+ }
2194
2624
  let detailPresentation;
2195
2625
  const rawDetailPresentation = record['detailPresentation'];
2196
2626
  if (rawDetailPresentation !== undefined && rawDetailPresentation !== null) {
@@ -2257,6 +2687,7 @@ function validateResourceQuickViewBinding(value) {
2257
2687
  valid: true,
2258
2688
  binding: {
2259
2689
  recordOpen: normalizedRecordOpen,
2690
+ ...(previewSurfaceId ? { previewSurfaceId } : {}),
2260
2691
  ...(normalizedContentRef ? { contentRef: normalizedContentRef } : {}),
2261
2692
  ...(detailPresentation ? { detailPresentation } : {}),
2262
2693
  },
@@ -2266,6 +2697,176 @@ function validateResourceQuickViewBinding(value) {
2266
2697
  function normalizeResourceQuickViewBinding(value) {
2267
2698
  return validateResourceQuickViewBinding(value).binding;
2268
2699
  }
2700
+ /**
2701
+ * Resolve ou sintetiza de forma determinística o `ResourceQuickViewBinding` de um campo
2702
+ * (`FieldDefinition` ou `FieldMetadata`), priorizando:
2703
+ * 1. `field.quickView` explícito;
2704
+ * 2. `field.presentation.interactions.quickView` explícito;
2705
+ * 3. síntese automática a partir de `field.resourceReference` ou `field.optionSource.detail`.
2706
+ *
2707
+ * Protege contra colisão de `valueField`/`optionSource.valuePropertyPath` (`'id'` da opção)
2708
+ * com o identificador da própria entidade pai quando o campo de origem possui outro nome
2709
+ * (ex.: `cargoId`, `fornecedorId`).
2710
+ */
2711
+ function resolveFieldQuickViewBinding(candidate) {
2712
+ if (!candidate || typeof candidate !== 'object') {
2713
+ return null;
2714
+ }
2715
+ const explicitQuickView = normalizeResourceQuickViewBinding(candidate.quickView);
2716
+ if (explicitQuickView) {
2717
+ return explicitQuickView;
2718
+ }
2719
+ const presentationQuickView = normalizeResourceQuickViewBinding(candidate.presentation?.interactions?.quickView);
2720
+ if (presentationQuickView) {
2721
+ return presentationQuickView;
2722
+ }
2723
+ const fieldName = typeof candidate.name === 'string' ? candidate.name.trim() : '';
2724
+ const rawValueField = typeof candidate.valueField === 'string' ? candidate.valueField.trim() : '';
2725
+ const optionValueProperty = typeof candidate.optionSource?.valuePropertyPath === 'string' &&
2726
+ candidate.optionSource.valuePropertyPath.trim().length > 0
2727
+ ? candidate.optionSource.valuePropertyPath.trim()
2728
+ : 'id';
2729
+ // Quando o campo possui optionSource e seu nome não é 'id', um valueField igual a
2730
+ // optionValueProperty (tipicamente 'id') refere-se à chave do OptionDTO e não ao
2731
+ // campo irmão no registro pai.
2732
+ const effectiveSiblingValueField = rawValueField &&
2733
+ (!candidate.optionSource ||
2734
+ fieldName === optionValueProperty ||
2735
+ rawValueField !== optionValueProperty)
2736
+ ? rawValueField
2737
+ : '';
2738
+ const refCandidate = candidate.resourceReference?.resourceKey
2739
+ ? {
2740
+ resourceKey: candidate.resourceReference.resourceKey,
2741
+ sourceIdentityField: (typeof candidate.resourceReference.valueField === 'string'
2742
+ ? candidate.resourceReference.valueField.trim()
2743
+ : '') ||
2744
+ effectiveSiblingValueField ||
2745
+ fieldName,
2746
+ surfaceId: candidate.resourceReference.surfaceId || 'detail',
2747
+ previewSurfaceId: candidate.resourceReference.previewSurfaceId,
2748
+ detailPresentation: candidate.resourceReference.detailPresentation === 'drawer' ||
2749
+ candidate.resourceReference.detailPresentation === 'modal'
2750
+ ? candidate.resourceReference.detailPresentation
2751
+ : undefined,
2752
+ }
2753
+ : candidate.optionSource?.detail?.resourceKey
2754
+ ? {
2755
+ resourceKey: candidate.optionSource.detail.resourceKey,
2756
+ sourceIdentityField: effectiveSiblingValueField || fieldName,
2757
+ surfaceId: candidate.optionSource.detail.surfaceId || 'detail',
2758
+ previewSurfaceId: candidate.optionSource.detail.previewSurfaceId,
2759
+ detailPresentation: candidate.optionSource.detail.presentation === 'drawer' ||
2760
+ candidate.optionSource.detail.presentation === 'modal'
2761
+ ? candidate.optionSource.detail.presentation
2762
+ : undefined,
2763
+ }
2764
+ : undefined;
2765
+ if (!refCandidate || !refCandidate.sourceIdentityField) {
2766
+ return null;
2767
+ }
2768
+ return normalizeResourceQuickViewBinding({
2769
+ recordOpen: {
2770
+ sourceIdentityField: refCandidate.sourceIdentityField,
2771
+ target: {
2772
+ resourceKey: refCandidate.resourceKey,
2773
+ surfaceId: refCandidate.surfaceId || 'detail',
2774
+ },
2775
+ },
2776
+ ...(refCandidate.previewSurfaceId
2777
+ ? { previewSurfaceId: refCandidate.previewSurfaceId }
2778
+ : {}),
2779
+ ...(refCandidate.detailPresentation
2780
+ ? { detailPresentation: refCandidate.detailPresentation }
2781
+ : {}),
2782
+ });
2783
+ }
2784
+ /**
2785
+ * Reconcilia o `ResourceQuickViewBinding` entre a definição base do servidor e uma
2786
+ * customização local persistida:
2787
+ * - Um `local` indefinido, nulo ou inválido nunca apaga o binding canônico do servidor (`base`).
2788
+ * - Quando o campo possui binding canônico do servidor (`base`), `base.recordOpen`
2789
+ * (recurso de destino, `surfaceId` e `sourceIdentityField`) permanece autoritativo
2790
+ * do servidor, permitindo que o `local` customize apenas preferências visuais de UX
2791
+ * (`trigger`, `previewSurfaceId`, `detailPresentation`).
2792
+ */
2793
+ function reconcileFieldQuickViewBinding(base, local) {
2794
+ const normalizedBase = normalizeResourceQuickViewBinding(base);
2795
+ const normalizedLocal = normalizeResourceQuickViewBinding(local);
2796
+ if (normalizedBase && normalizedLocal) {
2797
+ return {
2798
+ ...normalizedBase,
2799
+ ...normalizedLocal,
2800
+ recordOpen: normalizedBase.recordOpen,
2801
+ };
2802
+ }
2803
+ return normalizedLocal ?? normalizedBase ?? undefined;
2804
+ }
2805
+ function readQuickViewFieldOrPath(target, path) {
2806
+ if (Object.prototype.hasOwnProperty.call(target, path)) {
2807
+ return target[path];
2808
+ }
2809
+ if (!path.includes('.')) {
2810
+ return undefined;
2811
+ }
2812
+ return path.split('.').reduce((acc, segment) => {
2813
+ if (!acc || typeof acc !== 'object' || Array.isArray(acc)) {
2814
+ return undefined;
2815
+ }
2816
+ return Object.prototype.hasOwnProperty.call(acc, segment)
2817
+ ? acc[segment]
2818
+ : undefined;
2819
+ }, target);
2820
+ }
2821
+ /**
2822
+ * Resolve de forma determinística o alvo (`resourceKey`, `surfaceId`, `previewSurfaceId`, `identity`)
2823
+ * a partir de um `ResourceQuickViewBinding` e de um registro candidato (`sourceRecord`).
2824
+ */
2825
+ function resolveResourceQuickViewTarget(binding, sourceRecord) {
2826
+ const normalized = normalizeResourceQuickViewBinding(binding);
2827
+ if (!normalized ||
2828
+ !sourceRecord ||
2829
+ typeof sourceRecord !== 'object' ||
2830
+ Array.isArray(sourceRecord)) {
2831
+ return null;
2832
+ }
2833
+ const record = sourceRecord;
2834
+ const sourceField = normalized.recordOpen.sourceIdentityField;
2835
+ let candidate = readQuickViewFieldOrPath(record, sourceField);
2836
+ if (candidate === undefined) {
2837
+ for (const envelopeKey of ['row', 'item', 'values']) {
2838
+ const nested = record[envelopeKey];
2839
+ if (nested && typeof nested === 'object' && !Array.isArray(nested)) {
2840
+ candidate = readQuickViewFieldOrPath(nested, sourceField);
2841
+ if (candidate !== undefined) {
2842
+ break;
2843
+ }
2844
+ }
2845
+ }
2846
+ }
2847
+ if (candidate && typeof candidate === 'object' && !Array.isArray(candidate)) {
2848
+ const candidateObj = candidate;
2849
+ candidate =
2850
+ candidateObj['id'] ?? candidateObj['value'] ?? candidateObj['key'];
2851
+ }
2852
+ if (typeof candidate === 'number' && Number.isFinite(candidate)) {
2853
+ return {
2854
+ resourceKey: normalized.recordOpen.target.resourceKey,
2855
+ surfaceId: normalized.recordOpen.target.surfaceId,
2856
+ previewSurfaceId: normalized.previewSurfaceId || normalized.recordOpen.target.surfaceId,
2857
+ identity: candidate,
2858
+ };
2859
+ }
2860
+ if (typeof candidate === 'string' && candidate.trim().length > 0) {
2861
+ return {
2862
+ resourceKey: normalized.recordOpen.target.resourceKey,
2863
+ surfaceId: normalized.recordOpen.target.surfaceId,
2864
+ previewSurfaceId: normalized.previewSurfaceId || normalized.recordOpen.target.surfaceId,
2865
+ identity: candidate.trim(),
2866
+ };
2867
+ }
2868
+ return null;
2869
+ }
2269
2870
  /**
2270
2871
  * Verifica se a âncora efêmera de runtime permanece conectada e visível na viewport.
2271
2872
  */
@@ -2485,6 +3086,103 @@ function normalizeInteractions(value) {
2485
3086
  };
2486
3087
  }
2487
3088
 
3089
+ /** Converts UI tokens only under declared scalar items; invalid input is never dropped or partially converted. */
3090
+ function normalizeScalarArrayValue(value, items) {
3091
+ if (items.enum !== undefined && !isScalarEnum(items.enum))
3092
+ return { valid: false, invalidIndices: [-1] };
3093
+ if (value == null)
3094
+ return { valid: true, value };
3095
+ if (!Array.isArray(value))
3096
+ return { valid: false, invalidIndices: [-1] };
3097
+ const converted = [];
3098
+ const invalidIndices = [];
3099
+ for (let index = 0; index < value.length; index += 1) {
3100
+ const item = normalizeItem(value[index], items);
3101
+ if (item === undefined || items.enum && !items.enum.some(candidate => candidate === item))
3102
+ invalidIndices.push(index);
3103
+ else
3104
+ converted.push(item);
3105
+ }
3106
+ return invalidIndices.length ? { valid: false, invalidIndices } : { valid: true, value: converted };
3107
+ }
3108
+ function normalizeItem(value, items) {
3109
+ if (value == null)
3110
+ return undefined;
3111
+ if (items.type === 'boolean') {
3112
+ if (typeof value === 'boolean')
3113
+ return value;
3114
+ return value === 'true' ? true : value === 'false' ? false : undefined;
3115
+ }
3116
+ if (items.type === 'integer' || items.type === 'number') {
3117
+ const number = typeof value === 'number' ? value : typeof value === 'string' &&
3118
+ /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(value) ? Number(value) : NaN;
3119
+ if (!Number.isFinite(number) || items.type === 'integer' && !Number.isSafeInteger(number))
3120
+ return undefined;
3121
+ return number;
3122
+ }
3123
+ if (items.type !== 'string')
3124
+ return undefined;
3125
+ if (items.format === 'date') {
3126
+ if (value instanceof Date) {
3127
+ if (Number.isNaN(value.getTime()))
3128
+ return undefined;
3129
+ const date = `${String(value.getFullYear()).padStart(4, '0')}-${String(value.getMonth() + 1).padStart(2, '0')}-${String(value.getDate()).padStart(2, '0')}`;
3130
+ return isIsoDate(date) ? date : undefined;
3131
+ }
3132
+ return typeof value === 'string' && isIsoDate(value) ? value : undefined;
3133
+ }
3134
+ if (items.format === 'date-time') {
3135
+ if (value instanceof Date)
3136
+ return Number.isNaN(value.getTime()) ? undefined : value.toISOString();
3137
+ return typeof value === 'string' && isIsoDateTime(value) ? value : undefined;
3138
+ }
3139
+ return typeof value === 'string' ? value : undefined;
3140
+ }
3141
+ function isIsoDate(value) {
3142
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
3143
+ if (!match)
3144
+ return false;
3145
+ const year = Number(match[1]), month = Number(match[2]), day = Number(match[3]);
3146
+ const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
3147
+ const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
3148
+ return month >= 1 && month <= 12 && day >= 1 && day <= days[month - 1];
3149
+ }
3150
+ function isIsoDateTime(value) {
3151
+ const match = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(?:Z|([+-])(\d{2}):(\d{2}))?$/.exec(value);
3152
+ if (!match || !isIsoDate(match[1]))
3153
+ return false;
3154
+ if (Number(match[2]) > 23 || Number(match[3]) > 59 || Number(match[4] ?? 0) > 59)
3155
+ return false;
3156
+ const offsetHours = Number(match[7] ?? 0), offsetMinutes = Number(match[8] ?? 0);
3157
+ return offsetHours <= 18 && offsetMinutes <= 59 && (offsetHours !== 18 || offsetMinutes === 0);
3158
+ }
3159
+ /** Internal admission of the scalar subset already published in JSON Schema items. */
3160
+ function normalizeScalarItemsSchema(value) {
3161
+ if (!value || typeof value !== 'object' || Array.isArray(value))
3162
+ return undefined;
3163
+ const record = value;
3164
+ if (typeof record['type'] !== 'string' || !['string', 'integer', 'number', 'boolean'].includes(record['type']))
3165
+ return undefined;
3166
+ const result = { type: record['type'] };
3167
+ if (typeof record['format'] === 'string')
3168
+ result.format = record['format'];
3169
+ if (record['enum'] !== undefined) {
3170
+ if (!isScalarEnum(record['enum']))
3171
+ throw new TypeError('Scalar items enum must contain JSON scalar values.');
3172
+ result.enum = [...record['enum']];
3173
+ }
3174
+ return result;
3175
+ }
3176
+ function isScalarEnum(value) {
3177
+ return Array.isArray(value) && value.length > 0 && value.every(item => item === null || typeof item === 'string' || typeof item === 'boolean' || typeof item === 'number' && Number.isFinite(item));
3178
+ }
3179
+
3180
+ // Mirrors the backend custom-field key policy. Ordinary static field names are
3181
+ // outside this boundary; custom keys must be safe across all runtime consumers.
3182
+ const RESERVED_CUSTOM_FIELD_KEYS = new Set([
3183
+ 'constructor', 'prototype', 'hasOwnProperty', 'isPrototypeOf',
3184
+ 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf',
3185
+ ]);
2488
3186
  const VALUE_PRESENTATION_TYPES = new Set([
2489
3187
  'string',
2490
3188
  'number',
@@ -2863,9 +3561,15 @@ class SchemaNormalizationKernel {
2863
3561
  if (value.kind !== undefined) {
2864
3562
  detail.kind = String(value.kind);
2865
3563
  }
3564
+ if (value.resourceKey !== undefined && String(value.resourceKey).trim().length > 0) {
3565
+ detail.resourceKey = String(value.resourceKey).trim();
3566
+ }
2866
3567
  if (value.surfaceId !== undefined) {
2867
3568
  detail.surfaceId = String(value.surfaceId);
2868
3569
  }
3570
+ if (value.previewSurfaceId !== undefined && String(value.previewSurfaceId).trim().length > 0) {
3571
+ detail.previewSurfaceId = String(value.previewSurfaceId).trim();
3572
+ }
2869
3573
  if (value.presentation !== undefined) {
2870
3574
  detail.presentation = String(value.presentation);
2871
3575
  }
@@ -2890,6 +3594,11 @@ class SchemaNormalizationKernel {
2890
3594
  'resultLayout',
2891
3595
  'primaryPropertyPath',
2892
3596
  'avatarPropertyPath',
3597
+ 'detailActionLabel',
3598
+ 'quickViewActionLabel',
3599
+ 'copyCodeActionLabel',
3600
+ 'copyIdActionLabel',
3601
+ 'createActionLabel',
2893
3602
  ];
2894
3603
  stringKeys.forEach((key) => {
2895
3604
  if (value[key] !== undefined) {
@@ -2927,6 +3636,10 @@ class SchemaNormalizationKernel {
2927
3636
  if (value.maxVisibleBadges !== undefined && !Number.isNaN(Number(value.maxVisibleBadges))) {
2928
3637
  display.maxVisibleBadges = Number(value.maxVisibleBadges);
2929
3638
  }
3639
+ const actions = this.parseLookupActions(value.actions);
3640
+ if (actions) {
3641
+ display.actions = actions;
3642
+ }
2930
3643
  return Object.keys(display).length ? display : undefined;
2931
3644
  }
2932
3645
  parseLookupDisplayField(value) {
@@ -2941,6 +3654,28 @@ class SchemaNormalizationKernel {
2941
3654
  });
2942
3655
  return Object.keys(field).length ? field : undefined;
2943
3656
  }
3657
+ parseLookupActions(value) {
3658
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
3659
+ return undefined;
3660
+ }
3661
+ const actions = {};
3662
+ if (value.showDetail !== undefined) {
3663
+ actions.showDetail = this.parseBoolean(value.showDetail);
3664
+ }
3665
+ if (value.showQuickView !== undefined) {
3666
+ actions.showQuickView = this.parseBoolean(value.showQuickView);
3667
+ }
3668
+ if (value.showCopyCode !== undefined) {
3669
+ actions.showCopyCode = this.parseBoolean(value.showCopyCode);
3670
+ }
3671
+ if (value.showCopyId !== undefined) {
3672
+ actions.showCopyId = this.parseBoolean(value.showCopyId);
3673
+ }
3674
+ if (value.showCreate !== undefined) {
3675
+ actions.showCreate = this.parseBoolean(value.showCreate);
3676
+ }
3677
+ return Object.keys(actions).length ? actions : undefined;
3678
+ }
2944
3679
  parseLookupCreate(value) {
2945
3680
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
2946
3681
  return undefined;
@@ -3396,6 +4131,34 @@ class SchemaNormalizationKernel {
3396
4131
  const normalized = String(value ?? '').trim();
3397
4132
  return OPTION_SOURCE_INVALID_SORT_POLICIES.has(normalized) ? normalized : undefined;
3398
4133
  }
4134
+ parseResourceReference(value) {
4135
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
4136
+ return undefined;
4137
+ }
4138
+ const raw = value;
4139
+ const resourceKey = String(raw['resourceKey'] ?? '').trim();
4140
+ if (!resourceKey) {
4141
+ return undefined;
4142
+ }
4143
+ const ref = { resourceKey };
4144
+ const valueField = String(raw['valueField'] ?? '').trim();
4145
+ if (valueField) {
4146
+ ref.valueField = valueField;
4147
+ }
4148
+ const surfaceId = String(raw['surfaceId'] ?? '').trim();
4149
+ if (surfaceId) {
4150
+ ref.surfaceId = surfaceId;
4151
+ }
4152
+ const previewSurfaceId = String(raw['previewSurfaceId'] ?? '').trim();
4153
+ if (previewSurfaceId) {
4154
+ ref.previewSurfaceId = previewSurfaceId;
4155
+ }
4156
+ const detailPresentation = String(raw['detailPresentation'] ?? '').trim();
4157
+ if (detailPresentation === 'drawer' || detailPresentation === 'modal') {
4158
+ ref.detailPresentation = detailPresentation;
4159
+ }
4160
+ return ref;
4161
+ }
3399
4162
  parseLookupOpenDetailMode(value) {
3400
4163
  const normalized = String(value ?? '').trim();
3401
4164
  return LOOKUP_OPEN_DETAIL_MODES.has(normalized) ? normalized : undefined;
@@ -3708,16 +4471,62 @@ class SchemaNormalizationKernel {
3708
4471
  !Array.isArray(prop['x-ui'])
3709
4472
  ? prop['x-ui']
3710
4473
  : undefined;
4474
+ const hasChildProperties = prop?.properties &&
4475
+ typeof prop.properties === 'object' &&
4476
+ !Array.isArray(prop.properties);
4477
+ const isCustomFieldsContainer = ui?.customFieldsContainer === true ||
4478
+ (name === 'customFields' && prop?.type === 'object' && hasChildProperties);
4479
+ if (isCustomFieldsContainer) {
4480
+ if (hasChildProperties) {
4481
+ for (const key of Object.keys(prop.properties)) {
4482
+ if (RESERVED_CUSTOM_FIELD_KEYS.has(key)) {
4483
+ throw new Error(`Unsupported custom field key "${name}.${key}". Publish a key admitted by the canonical backend custom-field policy.`);
4484
+ }
4485
+ }
4486
+ const parentAccess = normalizeFieldAccessMetadata(ui?.fieldAccess);
4487
+ for (const childField of this.normalizeSchemaWithRoot(prop, rootSchema)) {
4488
+ const originalKey = childField.name;
4489
+ if (parentAccess && childField.fieldAccess &&
4490
+ !this.haveEquivalentFieldAccess(parentAccess, childField.fieldAccess)) {
4491
+ throw new Error(`Conflicting fieldAccess on custom-field container "${name}" and child "${originalKey}". Publish the effective access policy on each leaf field.`);
4492
+ }
4493
+ fields.push({
4494
+ ...childField,
4495
+ name: `${name}.${originalKey}`,
4496
+ customField: true,
4497
+ customFieldKey: childField.customFieldKey ?? originalKey,
4498
+ customFieldScope: childField.customFieldScope ?? 'tenant',
4499
+ ...(ui?.disabled !== undefined && this.parseBoolean(ui.disabled) ? { disabled: true } : {}),
4500
+ ...(ui?.readOnly !== undefined && this.parseBoolean(ui.readOnly) ? { readOnly: true } : {}),
4501
+ ...(ui?.formHidden !== undefined && this.parseBoolean(ui.formHidden) ? { formHidden: true } : {}),
4502
+ ...(parentAccess && !childField.fieldAccess ? { fieldAccess: normalizeFieldAccessMetadata(parentAccess) } : {}),
4503
+ });
4504
+ }
4505
+ }
4506
+ // The container is wire structure, never an independent field control.
4507
+ continue;
4508
+ }
3711
4509
  // Skip properties without x-ui metadata
3712
4510
  if (!ui || Object.keys(ui).length === 0) {
3713
4511
  continue;
3714
4512
  }
3715
4513
  const field = { name };
4514
+ if (ui.customField !== undefined) {
4515
+ field.customField = this.parseBoolean(ui.customField);
4516
+ }
4517
+ if (ui.customFieldKey != null) {
4518
+ field.customFieldKey = String(ui.customFieldKey);
4519
+ }
4520
+ if (ui.customFieldScope != null) {
4521
+ field.customFieldScope = String(ui.customFieldScope);
4522
+ }
3716
4523
  // -------------------------------------------------------------------
3717
4524
  // Basic information
3718
4525
  // -------------------------------------------------------------------
3719
4526
  field.label = ui.label ?? prop.title ?? name;
3720
4527
  field.type = this.resolveFieldType(prop, ui);
4528
+ if (field.type === 'array')
4529
+ field.items = normalizeScalarItemsSchema(prop?.items);
3721
4530
  const numericFormat = this.resolveNumericFormatToken(prop, ui, field.type);
3722
4531
  if (numericFormat) {
3723
4532
  field.numericFormat = numericFormat;
@@ -3844,6 +4653,18 @@ class SchemaNormalizationKernel {
3844
4653
  if (ui.formHidden !== undefined) {
3845
4654
  field.formHidden = this.parseBoolean(ui.formHidden);
3846
4655
  }
4656
+ if (ui.quickViewVisible !== undefined) {
4657
+ const quickViewVisible = this.parseOptionalBoolean(ui.quickViewVisible);
4658
+ if (quickViewVisible !== undefined) {
4659
+ field.quickViewVisible = quickViewVisible;
4660
+ }
4661
+ }
4662
+ if (ui.quickViewOrder !== undefined) {
4663
+ const quickViewOrder = this.parseOptionalFiniteNumber(ui.quickViewOrder);
4664
+ if (quickViewOrder !== undefined) {
4665
+ field.quickViewOrder = quickViewOrder;
4666
+ }
4667
+ }
3847
4668
  if (ui.width !== undefined) {
3848
4669
  field.width = ui.width;
3849
4670
  }
@@ -3968,6 +4789,24 @@ class SchemaNormalizationKernel {
3968
4789
  if (ui.filterField !== undefined) {
3969
4790
  field.filterField = ui.filterField;
3970
4791
  }
4792
+ if (ui.resourceReference !== undefined) {
4793
+ const resourceReference = this.parseResourceReference(ui.resourceReference);
4794
+ if (resourceReference) {
4795
+ field.resourceReference = resourceReference;
4796
+ }
4797
+ }
4798
+ if (ui.quickView !== undefined) {
4799
+ const explicitQuickView = normalizeResourceQuickViewBinding(ui.quickView);
4800
+ if (explicitQuickView) {
4801
+ field.quickView = explicitQuickView;
4802
+ }
4803
+ }
4804
+ if (!field.quickView) {
4805
+ const synthesized = resolveFieldQuickViewBinding(field);
4806
+ if (synthesized) {
4807
+ field.quickView = synthesized;
4808
+ }
4809
+ }
3971
4810
  if (ui.multiple !== undefined) {
3972
4811
  field.multiple = this.parseBoolean(ui.multiple);
3973
4812
  }
@@ -3992,6 +4831,12 @@ class SchemaNormalizationKernel {
3992
4831
  field.detailActionLabel = detailActionLabel;
3993
4832
  }
3994
4833
  }
4834
+ if (ui.quickViewActionLabel !== undefined) {
4835
+ const quickViewActionLabel = String(ui.quickViewActionLabel).trim();
4836
+ if (quickViewActionLabel) {
4837
+ field.quickViewActionLabel = quickViewActionLabel;
4838
+ }
4839
+ }
3995
4840
  if (ui.copyCodeActionLabel !== undefined) {
3996
4841
  const copyCodeActionLabel = String(ui.copyCodeActionLabel).trim();
3997
4842
  if (copyCodeActionLabel) {
@@ -4015,6 +4860,9 @@ class SchemaNormalizationKernel {
4015
4860
  if (ui.actions.showDetail !== undefined) {
4016
4861
  actions.showDetail = this.parseBoolean(ui.actions.showDetail);
4017
4862
  }
4863
+ if (ui.actions.showQuickView !== undefined) {
4864
+ actions.showQuickView = this.parseBoolean(ui.actions.showQuickView);
4865
+ }
4018
4866
  if (ui.actions.showCopyCode !== undefined) {
4019
4867
  actions.showCopyCode = this.parseBoolean(ui.actions.showCopyCode);
4020
4868
  }
@@ -4295,6 +5143,13 @@ class SchemaNormalizationKernel {
4295
5143
  });
4296
5144
  return fields;
4297
5145
  }
5146
+ haveEquivalentFieldAccess(left, right) {
5147
+ const identity = (access) => JSON.stringify([
5148
+ [...(access.visibleForAuthorities ?? [])].sort(),
5149
+ [...(access.editableForAuthorities ?? [])].sort(),
5150
+ ]);
5151
+ return identity(left) === identity(right);
5152
+ }
4298
5153
  resolveFieldType(prop, ui) {
4299
5154
  if (ui?.type !== undefined && ui?.type !== null && String(ui.type).trim() !== '') {
4300
5155
  return String(ui.type);
@@ -4302,6 +5157,10 @@ class SchemaNormalizationKernel {
4302
5157
  if (String(ui?.controlType ?? '').trim() === 'array') {
4303
5158
  return 'array';
4304
5159
  }
5160
+ if (Array.isArray(prop?.type)) {
5161
+ const types = [...new Set(prop.type.filter((type) => typeof type === 'string' && type !== 'null'))];
5162
+ return types.length === 1 ? types[0] : undefined;
5163
+ }
4305
5164
  if (prop?.type) {
4306
5165
  return String(prop.type);
4307
5166
  }
@@ -5368,6 +6227,15 @@ class GenericCrudService {
5368
6227
  http;
5369
6228
  schemaNormalizer;
5370
6229
  globalConfig;
6230
+ enterpriseRuntimeContext = (() => {
6231
+ try {
6232
+ assertInInjectionContext(GenericCrudService);
6233
+ }
6234
+ catch {
6235
+ return null;
6236
+ } // Direct construction remains supported outside Angular DI.
6237
+ return inject(EnterpriseRuntimeContextService, { optional: true });
6238
+ })();
5371
6239
  static ERROR_MESSAGES = {
5372
6240
  emptyResourcePath: 'O caminho do recurso não pode ser vazio.',
5373
6241
  emptyId: 'O ID não pode ser nulo ou vazio.',
@@ -5382,13 +6250,13 @@ class GenericCrudService {
5382
6250
  currentEndpointKey = ApiEndpoint.Default;
5383
6251
  currentApiUrlEntry = null;
5384
6252
  resourcePath;
5385
- // Nova propriedade para armazenar a URL do schema
5386
- _schemaUrl = null;
5387
6253
  configured = false;
5388
6254
  // Cache para schemas de filtro (compartilha observáveis para chamadas simultâneas)
5389
6255
  _filterSchemaCache = new Map();
5390
6256
  _rangeFilterFieldHints = new Set();
5391
6257
  _filterSchemaLoaded = false;
6258
+ schemaRuntimeContext = '';
6259
+ schemaRuntimeEpoch = 0;
5392
6260
  _schemaCache;
5393
6261
  schemaCacheReady;
5394
6262
  // Último metadata de recurso derivado do schema carregado (ex.: idField)
@@ -5501,14 +6369,8 @@ class GenericCrudService {
5501
6369
  this.resourcePath = resource;
5502
6370
  this.apiUrl = nextApiUrl;
5503
6371
  this.configured = true;
5504
- this._filterSchemaLoaded = false;
5505
- this._rangeFilterFieldHints.clear();
5506
- this._lastSchemaInfo = {};
5507
- this._lastResourceMeta = {};
5508
- this._lastResourceCapabilityDigest = null;
5509
- this._lastResourceIdentity = null;
5510
- this._lastResourceIdentityDiagnostics = [];
5511
- this._lastResourceQuickFilters = null;
6372
+ this.schemaRuntimeContext = '';
6373
+ this.refreshSchemaRuntimeContext();
5512
6374
  this._resourceEtags.clear();
5513
6375
  debugCrudService('[CRUD:Service] configure', {
5514
6376
  resourcePath, baseApiUrl: this.baseApiUrl,
@@ -5535,6 +6397,8 @@ class GenericCrudService {
5535
6397
  */
5536
6398
  configureEndpoints(customEndpoints) {
5537
6399
  this.endpoints = { ...this.endpoints, ...customEndpoints };
6400
+ this.schemaRuntimeContext = '';
6401
+ this.refreshSchemaRuntimeContext();
5538
6402
  }
5539
6403
  /**
5540
6404
  * Fluxo de schemas (grid e filtro)
@@ -5573,15 +6437,15 @@ class GenericCrudService {
5573
6437
  */
5574
6438
  getSchema(options) {
5575
6439
  this.ensureConfigured();
6440
+ const schemaResourcePath = this.resourcePath;
5576
6441
  const entry = this.resolveEndpointEntry(options?.endpointKey);
5577
6442
  const url = this.getEndpointUrl('schema', undefined, options?.parentPath, options?.endpointKey);
5578
- // Armazena a URL para referência posterior
5579
- this._schemaUrl = url;
6443
+ const schemaEpoch = this.schemaRequestEpoch(url, options?.endpointKey);
5580
6444
  debugCrudService('[CRUD:Service] getSchema:url', { url });
5581
6445
  // Derivar path para o /schemas/filtered do grid (response schema).
5582
6446
  // Plataformas corporativas devem usar a superfície de busca/listagem governada,
5583
6447
  // não endpoints irrestritos de coleção como /all.
5584
- const schemaPathBase = this.schemaUrl().replace(/\/schemas$/, '');
6448
+ const schemaPathBase = this.schemaPathname(url).replace(/\/schemas$/, '');
5585
6449
  const path = `${schemaPathBase}/filter`;
5586
6450
  const operation = 'post';
5587
6451
  const schemaType = 'response';
@@ -5621,20 +6485,17 @@ class GenericCrudService {
5621
6485
  locale,
5622
6486
  apiOrigin,
5623
6487
  });
5624
- const headersBase = composeHeadersWithVersion(entry);
6488
+ const headersBase = this.captureSchemaHeaders(entry, tenant, locale);
6489
+ const cacheKey = this.schemaRepresentationKey(schemaId, `${filteredUrl}?${httpParams.toString()}`, headersBase);
5625
6490
  const shouldUseDirectSchemaEndpoint = GenericCrudService.unavailableFilteredSchemaUrls.has(filteredUrl);
5626
6491
  if (shouldUseDirectSchemaEndpoint) {
5627
- return this.fetchDirectSchema(url, schemaId, apiOrigin, entry, locale, tenant, options?.httpContext);
6492
+ return this.fetchDirectSchema(url, schemaId, apiOrigin, headersBase, options?.httpContext, schemaEpoch, schemaResourcePath);
5628
6493
  }
5629
- return from(this.ensureSchemaCacheReady()).pipe(concatMap(() => from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
6494
+ return from(this.ensureSchemaCacheReady()).pipe(concatMap(() => from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
5630
6495
  let headers = (headersBase instanceof HttpHeaders ? headersBase : new HttpHeaders(headersBase));
5631
6496
  if (cached?.schemaHash) {
5632
6497
  headers = headers.set('If-None-Match', `"${cached.schemaHash}"`);
5633
6498
  }
5634
- if (locale)
5635
- headers = headers.set('Accept-Language', locale);
5636
- if (tenant)
5637
- headers = headers.set('X-Tenant', tenant);
5638
6499
  debugCrudService('[CRUD:Service] getSchema (filtered fallback):request', {
5639
6500
  filteredUrl,
5640
6501
  path,
@@ -5650,27 +6511,23 @@ class GenericCrudService {
5650
6511
  });
5651
6512
  }), concatMap((resp) => {
5652
6513
  if (resp.status === 304) {
5653
- return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
6514
+ return from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
5654
6515
  if (cached?.schema) {
5655
6516
  // Extrai idField de x-ui.resource, se presente no schema em cache
5656
6517
  try {
5657
- this.updateLastResourceMetadataFromSchema(cached.schema);
6518
+ this.updateLastResourceMetadataFromSchema(cached.schema, schemaEpoch);
5658
6519
  }
5659
6520
  catch { }
5660
6521
  // Atualiza última info de schema a partir do cache
5661
6522
  try {
5662
6523
  const cachedHash = cached.schemaHash || '';
5663
- this._lastSchemaInfo = { schemaId, schemaHash: cachedHash };
6524
+ this.rememberSchemaInfo(schemaEpoch, schemaId, cachedHash);
5664
6525
  }
5665
6526
  catch { }
5666
6527
  return of(this.schemaNormalizer.normalizeSchema(cached.schema));
5667
6528
  }
5668
- const headers = composeHeadersWithVersion(entry);
6529
+ const headers = headersBase;
5669
6530
  let h = (headers instanceof HttpHeaders ? headers : new HttpHeaders(headers));
5670
- if (locale)
5671
- h = h.set('Accept-Language', locale);
5672
- if (tenant)
5673
- h = h.set('X-Tenant', tenant);
5674
6531
  // Force a fresh response to avoid intermediary caches when refetching
5675
6532
  try {
5676
6533
  h = h.set('Cache-Control', 'no-cache, no-store, max-age=0').set('Pragma', 'no-cache');
@@ -5690,12 +6547,14 @@ class GenericCrudService {
5690
6547
  name: 'Grid/Response Schema',
5691
6548
  createdAt: now,
5692
6549
  updatedAt: now,
5693
- resourcePath: this.resourcePath,
6550
+ resourcePath: schemaResourcePath,
5694
6551
  schemaId,
5695
6552
  apiOrigin,
5696
6553
  },
5697
6554
  };
5698
- this._schemaCache.set(schemaId, entry);
6555
+ this._schemaCache.set(cacheKey, entry);
6556
+ this.rememberSchemaInfo(schemaEpoch, schemaId, '');
6557
+ this.updateLastResourceMetadataFromSchema(fresh, schemaEpoch);
5699
6558
  }), map((fresh) => this.schemaNormalizer.normalizeSchema(fresh)), catchError(this.handleError));
5700
6559
  }));
5701
6560
  }
@@ -5709,45 +6568,42 @@ class GenericCrudService {
5709
6568
  idFieldFromBody = body?.['x-ui']?.resource?.idField;
5710
6569
  }
5711
6570
  catch { }
5712
- this._schemaCache.set(schemaId, { schema: body, schemaHash, meta: {
6571
+ this._schemaCache.set(cacheKey, { schema: body, schemaHash, meta: {
5713
6572
  version: '2.0.0', name: 'Grid/Response Schema', createdAt: nowIso, updatedAt: nowIso,
5714
- resourcePath: this.resourcePath, idField: idFieldFromBody, schemaId, apiOrigin,
6573
+ resourcePath: schemaResourcePath, idField: idFieldFromBody, schemaId, apiOrigin,
5715
6574
  } });
5716
- this._lastSchemaInfo = { schemaId, schemaHash };
5717
- this.updateLastResourceMetadataFromSchema(body);
6575
+ this.rememberSchemaInfo(schemaEpoch, schemaId, schemaHash);
6576
+ this.updateLastResourceMetadataFromSchema(body, schemaEpoch);
5718
6577
  return of(this.schemaNormalizer.normalizeSchema(body));
5719
6578
  }),
5720
- // Angular HttpClient treats 304 as error; also handle status 0 (CORS/network) by reusing cache
6579
+ // Only a server-confirmed 304 can reuse a stored representation.
5721
6580
  catchError((err) => {
5722
6581
  if (err?.status === 404) {
5723
6582
  if (this.shouldRememberFilteredSchemaEndpointUnavailable(err)) {
5724
6583
  GenericCrudService.unavailableFilteredSchemaUrls.add(filteredUrl);
5725
6584
  }
5726
- return this.fetchDirectSchema(url, schemaId, apiOrigin, entry, locale, tenant, options?.httpContext);
6585
+ return this.fetchDirectSchema(url, schemaId, apiOrigin, headersBase, options?.httpContext, schemaEpoch, schemaResourcePath);
5727
6586
  }
5728
- if (err?.status === 304 || err?.status === 0) {
5729
- return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
6587
+ if (err?.status === 304) {
6588
+ return from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
5730
6589
  if (cached?.schema) {
5731
6590
  try {
5732
- this.updateLastResourceMetadataFromSchema(cached.schema);
6591
+ this.updateLastResourceMetadataFromSchema(cached.schema, schemaEpoch);
6592
+ this.rememberSchemaInfo(schemaEpoch, schemaId, cached.schemaHash || '');
5733
6593
  }
5734
6594
  catch { }
5735
6595
  return of(this.schemaNormalizer.normalizeSchema(cached.schema));
5736
6596
  }
5737
6597
  // Refetch without If-None-Match if cache is missing
5738
- const baseHeaders = composeHeadersWithVersion(entry);
6598
+ const baseHeaders = headersBase;
5739
6599
  let h = (baseHeaders instanceof HttpHeaders ? baseHeaders : new HttpHeaders(baseHeaders));
5740
- if (locale)
5741
- h = h.set('Accept-Language', locale);
5742
- if (tenant)
5743
- h = h.set('X-Tenant', tenant);
5744
6600
  // Force a fresh response to avoid intermediary caches when refetching
5745
6601
  try {
5746
6602
  h = h.set('Cache-Control', 'no-cache, no-store, max-age=0').set('Pragma', 'no-cache');
5747
6603
  }
5748
6604
  catch { }
5749
6605
  return this.http
5750
- .get(filteredUrl, { params: httpParams, headers: h })
6606
+ .get(filteredUrl, { params: httpParams, headers: h, context: options?.httpContext })
5751
6607
  .pipe(tap((fresh) => {
5752
6608
  const now = new Date().toISOString();
5753
6609
  const entry = {
@@ -5758,25 +6614,87 @@ class GenericCrudService {
5758
6614
  name: 'Grid/Response Schema',
5759
6615
  createdAt: now,
5760
6616
  updatedAt: now,
5761
- resourcePath: this.resourcePath,
6617
+ resourcePath: schemaResourcePath,
5762
6618
  schemaId,
5763
6619
  apiOrigin,
5764
6620
  },
5765
6621
  };
5766
- this._schemaCache.set(schemaId, entry);
5767
- this._lastSchemaInfo = { schemaId, schemaHash: '' };
6622
+ this._schemaCache.set(cacheKey, entry);
6623
+ this.rememberSchemaInfo(schemaEpoch, schemaId, '');
5768
6624
  }), tap((fresh) => {
5769
6625
  try {
5770
- this.updateLastResourceMetadataFromSchema(fresh);
6626
+ this.updateLastResourceMetadataFromSchema(fresh, schemaEpoch);
5771
6627
  }
5772
6628
  catch { }
5773
6629
  }), map((fresh) => this.schemaNormalizer.normalizeSchema(fresh)), catchError(this.handleError));
5774
6630
  }));
5775
6631
  }
5776
6632
  return this.handleError(err);
5777
- }))), shareReplay(1));
6633
+ }))), shareReplay({ bufferSize: 1, refCount: true }));
6634
+ }
6635
+ captureSchemaHeaders(entry, tenant, locale) {
6636
+ if (this.enterpriseRuntimeContext?.snapshot && !this.enterpriseRuntimeContext.effectiveContext) {
6637
+ throw new Error('A confirmed enterprise context is required for schema requests.');
6638
+ }
6639
+ const composed = composeHeadersWithVersion(entry) ?? new HttpHeaders();
6640
+ const values = {};
6641
+ for (const key of composed.keys())
6642
+ values[key.toLowerCase()] = [...(composed.getAll(key) ?? [])];
6643
+ if (tenant)
6644
+ values['x-tenant'] = [tenant];
6645
+ if (locale)
6646
+ values['accept-language'] = [locale];
6647
+ const confirmed = this.enterpriseRuntimeContext?.applyHeaders(new HttpHeaders(values));
6648
+ if (confirmed) {
6649
+ for (const key of Object.keys(values))
6650
+ delete values[key];
6651
+ for (const key of confirmed.keys())
6652
+ values[key.toLowerCase()] = [...(confirmed.getAll(key) ?? [])];
6653
+ }
6654
+ if (values['x-tenant'] && values['x-tenant-id'] && values['x-tenant'][0] !== values['x-tenant-id'][0]) {
6655
+ throw new Error('Conflicting tenant headers for schema request.');
6656
+ }
6657
+ delete values['if-none-match'];
6658
+ return new HttpHeaders(values);
6659
+ }
6660
+ schemaRepresentationKey(schemaId, url, headers) {
6661
+ const key = buildSchemaRequestKey(schemaId, url, {
6662
+ tenant: headers.get('X-Tenant') ?? headers.get('X-Tenant-ID') ?? undefined,
6663
+ locale: headers.get('Accept-Language') ?? undefined,
6664
+ });
6665
+ return scopeSchemaRequestKey(key, headers.keys().map(name => [name, headers.getAll(name) ?? []]));
6666
+ }
6667
+ /** Reset derived UI metadata when the declared service context changes. */
6668
+ refreshSchemaRuntimeContext() {
6669
+ const context = JSON.stringify([
6670
+ this.apiUrl, this.currentEndpointKey, this.globalConfig.getTenant?.() ?? null,
6671
+ typeof navigator !== 'undefined' ? navigator.language : null,
6672
+ this.enterpriseRuntimeContext?.snapshot?.state ?? null,
6673
+ this.configured && (!this.enterpriseRuntimeContext?.snapshot || this.enterpriseRuntimeContext.effectiveContext) ? this.schemaRepresentationKey('runtime', this.apiUrl, this.captureSchemaHeaders(this.resolveEndpointEntry())) : null,
6674
+ ]);
6675
+ if (context !== this.schemaRuntimeContext) {
6676
+ this.schemaRuntimeContext = context;
6677
+ this.schemaRuntimeEpoch += 1;
6678
+ this._filterSchemaCache.clear();
6679
+ this._filterSchemaLoaded = false;
6680
+ this._rangeFilterFieldHints.clear();
6681
+ this._lastSchemaInfo = {};
6682
+ this._lastResourceMeta = {};
6683
+ this._lastResourceCapabilityDigest = null;
6684
+ this._lastResourceIdentity = null;
6685
+ this._lastResourceIdentityDiagnostics = [];
6686
+ this._lastResourceQuickFilters = null;
6687
+ }
6688
+ return this.schemaRuntimeEpoch;
5778
6689
  }
5779
- updateLastResourceMetadataFromSchema(schema) {
6690
+ rememberSchemaInfo(epoch, schemaId, schemaHash) {
6691
+ if (epoch === this.refreshSchemaRuntimeContext()) {
6692
+ this._lastSchemaInfo = { schemaId, schemaHash };
6693
+ }
6694
+ }
6695
+ updateLastResourceMetadataFromSchema(schema, epoch) {
6696
+ if (epoch !== this.refreshSchemaRuntimeContext())
6697
+ return;
5780
6698
  const resource = schema?.['x-ui']?.resource;
5781
6699
  const idField = typeof resource?.idField === 'string' ? resource.idField.trim() : undefined;
5782
6700
  const identityResolution = resolveResourceIdentityContract({
@@ -5789,10 +6707,11 @@ class GenericCrudService {
5789
6707
  this._lastResourceIdentity = identityResolution.contract;
5790
6708
  this._lastResourceIdentityDiagnostics = identityResolution.diagnostics;
5791
6709
  this._lastResourceMeta = {
5792
- idField: idField || this._lastResourceMeta.idField,
6710
+ idField,
5793
6711
  resourcePath: this.resourcePath,
5794
6712
  };
5795
6713
  const canonicalOperations = this.normalizeCanonicalCapabilities(resource?.capabilities);
6714
+ this._lastResourceCapabilityDigest = null;
5796
6715
  if (canonicalOperations) {
5797
6716
  this._lastResourceCapabilityDigest = {
5798
6717
  source: 'schema-x-ui-resource',
@@ -5845,17 +6764,14 @@ class GenericCrudService {
5845
6764
  // resource operation was not present in the catalog. Do not poison later resources.
5846
6765
  return !hasFilteredPathMiss && !message.includes('path or operation was not found');
5847
6766
  }
5848
- fetchDirectSchema(url, schemaId, apiOrigin, entry, locale, tenant, httpContext) {
5849
- return from(this.ensureSchemaCacheReady()).pipe(concatMap(() => from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
5850
- const baseHeaders = composeHeadersWithVersion(entry);
6767
+ fetchDirectSchema(url, schemaId, apiOrigin, headersBase, httpContext, schemaEpoch, schemaResourcePath) {
6768
+ const cacheKey = this.schemaRepresentationKey(schemaId, url, headersBase);
6769
+ return from(this.ensureSchemaCacheReady()).pipe(concatMap(() => from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
6770
+ const baseHeaders = headersBase;
5851
6771
  let headers = (baseHeaders instanceof HttpHeaders ? baseHeaders : new HttpHeaders(baseHeaders));
5852
6772
  if (cached?.schemaHash) {
5853
6773
  headers = headers.set('If-None-Match', `"${cached.schemaHash}"`);
5854
6774
  }
5855
- if (locale)
5856
- headers = headers.set('Accept-Language', locale);
5857
- if (tenant)
5858
- headers = headers.set('X-Tenant', tenant);
5859
6775
  return this.http.get(url, {
5860
6776
  headers,
5861
6777
  observe: 'response',
@@ -5877,26 +6793,26 @@ class GenericCrudService {
5877
6793
  name: 'Grid/Response Schema',
5878
6794
  createdAt: now,
5879
6795
  updatedAt: now,
5880
- resourcePath: this.resourcePath,
6796
+ resourcePath: schemaResourcePath,
5881
6797
  schemaId,
5882
6798
  apiOrigin,
5883
6799
  },
5884
6800
  };
5885
- this._schemaCache.set(schemaId, entryToCache);
5886
- this._lastSchemaInfo = { schemaId, schemaHash };
6801
+ this._schemaCache.set(cacheKey, entryToCache);
6802
+ this.rememberSchemaInfo(schemaEpoch, schemaId, schemaHash);
5887
6803
  try {
5888
- this.updateLastResourceMetadataFromSchema(body);
6804
+ this.updateLastResourceMetadataFromSchema(body, schemaEpoch);
5889
6805
  }
5890
6806
  catch { }
5891
6807
  return of(this.schemaNormalizer.normalizeSchema(body));
5892
6808
  }), catchError((err) => {
5893
- if ((err?.status === 304 || err?.status === 0) && cached?.schema) {
6809
+ if ((err?.status === 304) && cached?.schema) {
5894
6810
  try {
5895
- this.updateLastResourceMetadataFromSchema(cached.schema);
6811
+ this.updateLastResourceMetadataFromSchema(cached.schema, schemaEpoch);
5896
6812
  }
5897
6813
  catch { }
5898
6814
  const cachedHash = cached.schemaHash || '';
5899
- this._lastSchemaInfo = { schemaId, schemaHash: cachedHash };
6815
+ this.rememberSchemaInfo(schemaEpoch, schemaId, cachedHash);
5900
6816
  return of(this.schemaNormalizer.normalizeSchema(cached.schema));
5901
6817
  }
5902
6818
  return this.handleError(err);
@@ -5905,10 +6821,12 @@ class GenericCrudService {
5905
6821
  }
5906
6822
  /** Retorna o campo identificador do recurso (ex.: 'id', 'codigo'), quando derivado do schema. */
5907
6823
  getResourceIdField() {
6824
+ this.refreshSchemaRuntimeContext();
5908
6825
  const key = (this._lastResourceMeta?.idField || '').trim();
5909
6826
  return key || undefined;
5910
6827
  }
5911
6828
  getResourceCapabilityDigest() {
6829
+ this.refreshSchemaRuntimeContext();
5912
6830
  return this._lastResourceCapabilityDigest
5913
6831
  ? {
5914
6832
  ...this._lastResourceCapabilityDigest,
@@ -5918,6 +6836,7 @@ class GenericCrudService {
5918
6836
  }
5919
6837
  /** Returns explicit identity or the diagnostic key-only x-ui.resource.idField fallback. */
5920
6838
  getResourceIdentity() {
6839
+ this.refreshSchemaRuntimeContext();
5921
6840
  return this._lastResourceIdentity
5922
6841
  ? {
5923
6842
  ...this._lastResourceIdentity,
@@ -5940,6 +6859,7 @@ class GenericCrudService {
5940
6859
  }
5941
6860
  /** Returns structured diagnostics produced while resolving record identity. */
5942
6861
  getResourceIdentityDiagnostics() {
6862
+ this.refreshSchemaRuntimeContext();
5943
6863
  return this._lastResourceIdentityDiagnostics.map((diagnostic) => ({
5944
6864
  ...diagnostic,
5945
6865
  invalidFields: diagnostic.invalidFields
@@ -5949,50 +6869,40 @@ class GenericCrudService {
5949
6869
  }
5950
6870
  /** Retorna os filtros rápidos canônicos descobertos no schema x-ui.resource.quickFilters. */
5951
6871
  getResourceQuickFilters() {
6872
+ this.refreshSchemaRuntimeContext();
5952
6873
  return this._lastResourceQuickFilters ? [...this._lastResourceQuickFilters] : null;
5953
6874
  }
5954
- /** Retorna o último schemaId e hash conhecidos após getSchema()/getFilteredSchema(). */
6875
+ /** Last schema evidence for the configured resource; per-call overrides do not replace it. */
5955
6876
  getLastSchemaInfo() {
6877
+ this.refreshSchemaRuntimeContext();
5956
6878
  return { ...this._lastSchemaInfo };
5957
6879
  }
5958
- /**
5959
- * Retorna a URL do último schema solicitado, preservando apenas o pathname.
5960
- *
5961
- * Detalhes:
5962
- * - Se getSchema() já foi chamado, reutiliza a URL armazenada.
5963
- * - Caso contrário, reconstrói a URL de schema e extrai apenas o caminho (ex.: "/api/usuarios/schemas").
5964
- * - Esse caminho é usado para derivar o path do /schemas/filtered (grid/filtro) mantendo prefixos/contextPath.
5965
- */
6880
+ /** Schema path of the configured resource. Per-call overrides never change this scope. */
5966
6881
  schemaUrl() {
5967
6882
  this.ensureConfigured();
5968
- let url;
5969
- // Se já temos a URL do schema armazenada, usá-la
5970
- if (this._schemaUrl) {
5971
- url = this._schemaUrl;
5972
- }
5973
- else {
5974
- try {
5975
- // Tentar construir a URL mesmo que getSchema() não tenha sido chamado
5976
- url = this.getEndpointUrl('schema');
5977
- }
5978
- catch (error) {
5979
- // Se o serviço não estiver configurado, retornar string vazia
5980
- return '';
5981
- }
5982
- }
5983
- try {
5984
- const urlObj = new URL(url);
5985
- const pathname = urlObj.pathname;
5986
- debugCrudService('[CRUD:Service] schemaUrl:pathname', {
5987
- pathname, from: url,
5988
- });
5989
- return pathname;
5990
- }
5991
- catch (error) {
5992
- const cleaned = url.replace(/^(https?:\/\/)?[^\/]+(\/|$)/, '/');
5993
- debugCrudService('[CRUD:Service] schemaUrl:cleaned', { cleaned, from: url });
5994
- return cleaned;
5995
- }
6883
+ return this.schemaPathname(this.getEndpointUrl('schema'));
6884
+ }
6885
+ schemaPathname(url) {
6886
+ return new URL(url, 'http://praxis.local').pathname;
6887
+ }
6888
+ /**
6889
+ * Derived getters belong to configure(), just like create/update/table identity.
6890
+ * A one-off endpoint/parent query returns its own fields but cannot publish metadata
6891
+ * into that configured resource. A negative epoch never owns the derived state.
6892
+ */
6893
+ schemaRequestEpoch(schemaUrl, endpointKey) {
6894
+ const epoch = this.refreshSchemaRuntimeContext();
6895
+ return (endpointKey ?? this.currentEndpointKey) === this.currentEndpointKey
6896
+ && schemaUrl === this.getEndpointUrl('schema') ? epoch : -1;
6897
+ }
6898
+ filteredSchemaRequestEpoch(path, endpointKey) {
6899
+ const epoch = this.refreshSchemaRuntimeContext();
6900
+ const configuredPath = this.schemaUrl().replace(/\/schemas$/, '');
6901
+ const sameEndpoint = (endpointKey ?? this.currentEndpointKey) === this.currentEndpointKey
6902
+ && buildApiUrl(this.resolveEndpointEntry(endpointKey))
6903
+ === buildApiUrl(this.resolveEndpointEntry());
6904
+ return sameEndpoint && (path === configuredPath || path === `${configuredPath}/filter`)
6905
+ ? epoch : -1;
5996
6906
  }
5997
6907
  /**
5998
6908
  * Obtém um schema filtrado diretamente do endpoint `/schemas/filtered`.
@@ -6005,8 +6915,10 @@ class GenericCrudService {
6005
6915
  */
6006
6916
  getFilteredSchema(params) {
6007
6917
  this.ensureConfigured();
6918
+ const schemaResourcePath = this.resourcePath;
6008
6919
  let httpParams = new HttpParams();
6009
- const path = params.path ?? this.schemaUrl().replace(/\/schemas$/, '');
6920
+ const path = params.path ?? this.schemaPathname(this.getEndpointUrl('schema', undefined, undefined, params.endpointKey)).replace(/\/schemas$/, '');
6921
+ const schemaEpoch = this.filteredSchemaRequestEpoch(path, params.endpointKey);
6010
6922
  httpParams = httpParams.set('path', path);
6011
6923
  if (params.document) {
6012
6924
  httpParams = httpParams.set('document', params.document);
@@ -6042,9 +6954,9 @@ class GenericCrudService {
6042
6954
  const tenant = this.globalConfig.getTenant();
6043
6955
  const locale = (typeof navigator !== 'undefined' && navigator.language) ? navigator.language : undefined;
6044
6956
  const schemaId = buildSchemaId({ path, operation, schemaType: schemaTypeParam, includeInternalSchemas: includeInternal, idField: params.idField, readOnly: params.readOnly, tenant, locale, apiOrigin: origin });
6045
- // Prepare headers with If-None-Match when cached
6046
- const headersBase = composeHeadersWithVersion(entry);
6047
- return from(this.ensureSchemaCacheReady()).pipe(concatMap(() => from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
6957
+ const headersBase = this.captureSchemaHeaders(entry, tenant, locale);
6958
+ const cacheKey = this.schemaRepresentationKey(schemaId, `${url}?${httpParams.toString()}`, headersBase);
6959
+ return from(this.ensureSchemaCacheReady()).pipe(concatMap(() => from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
6048
6960
  let headers = headersBase;
6049
6961
  if (cached?.schemaHash) {
6050
6962
  headers = (headersBase instanceof HttpHeaders ? headersBase : new HttpHeaders(headersBase)).set('If-None-Match', `"${cached.schemaHash}"`);
@@ -6052,10 +6964,6 @@ class GenericCrudService {
6052
6964
  else {
6053
6965
  headers = (headersBase instanceof HttpHeaders ? headersBase : new HttpHeaders(headersBase));
6054
6966
  }
6055
- if (locale)
6056
- headers = headers.set('Accept-Language', locale);
6057
- if (tenant)
6058
- headers = headers.set('X-Tenant', tenant);
6059
6967
  debugCrudService('[CRUD:Service] getFilteredSchema:request', { url, params: { path, operation, schemaType: schemaTypeParam, includeInternalSchemas: includeInternal, idField: params.idField, readOnly: params.readOnly }, hasCached: !!cached });
6060
6968
  return this.http.get(url, {
6061
6969
  params: httpParams,
@@ -6065,22 +6973,20 @@ class GenericCrudService {
6065
6973
  });
6066
6974
  }), concatMap((resp) => {
6067
6975
  if (resp.status === 304) {
6068
- return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
6976
+ return from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
6069
6977
  if (cached?.schema) {
6070
6978
  try {
6071
6979
  const cachedHash = cached.schemaHash || '';
6072
- this._lastSchemaInfo = { schemaId, schemaHash: cachedHash };
6980
+ this.rememberSchemaInfo(schemaEpoch, schemaId, cachedHash);
6981
+ if (schemaTypeParam === 'response')
6982
+ this.updateLastResourceMetadataFromSchema(cached.schema, schemaEpoch);
6073
6983
  }
6074
6984
  catch { }
6075
6985
  return of(this.schemaNormalizer.normalizeSchema(cached.schema));
6076
6986
  }
6077
6987
  // Fallback: refetch without If-None-Match (com tenant/locale)
6078
- const headers = composeHeadersWithVersion(entry);
6988
+ const headers = headersBase;
6079
6989
  let h = (headers instanceof HttpHeaders ? headers : new HttpHeaders(headers));
6080
- if (locale)
6081
- h = h.set('Accept-Language', locale);
6082
- if (tenant)
6083
- h = h.set('X-Tenant', tenant);
6084
6990
  // Force a fresh response to avoid intermediary caches when refetching
6085
6991
  try {
6086
6992
  h = h.set('Cache-Control', 'no-cache, no-store, max-age=0').set('Pragma', 'no-cache');
@@ -6100,12 +7006,15 @@ class GenericCrudService {
6100
7006
  name: (schemaTypeParam === 'request' ? 'Filter/Request Schema' : 'Schema'),
6101
7007
  createdAt: now,
6102
7008
  updatedAt: now,
6103
- resourcePath: this.resourcePath,
7009
+ resourcePath: schemaResourcePath,
6104
7010
  schemaId,
6105
7011
  apiOrigin: origin,
6106
7012
  },
6107
7013
  };
6108
- this._schemaCache.set(schemaId, entry);
7014
+ this._schemaCache.set(cacheKey, entry);
7015
+ this.rememberSchemaInfo(schemaEpoch, schemaId, '');
7016
+ if (schemaTypeParam === 'response')
7017
+ this.updateLastResourceMetadataFromSchema(fresh, schemaEpoch);
6109
7018
  }), map((fresh) => this.schemaNormalizer.normalizeSchema(fresh)), catchError(this.handleError));
6110
7019
  }));
6111
7020
  }
@@ -6119,34 +7028,31 @@ class GenericCrudService {
6119
7028
  idFieldFromBody2 = body?.['x-ui']?.resource?.idField;
6120
7029
  }
6121
7030
  catch { }
6122
- const entryToCache = { schema: body, schemaHash, meta: { version: '2.0.0', name: (schemaTypeParam === 'request' ? 'Filter/Request Schema' : 'Schema'), createdAt: nowIso2, updatedAt: nowIso2, resourcePath: this.resourcePath, idField: idFieldFromBody2, schemaId, apiOrigin: origin } };
6123
- this._schemaCache.set(schemaId, entryToCache);
7031
+ const entryToCache = { schema: body, schemaHash, meta: { version: '2.0.0', name: (schemaTypeParam === 'request' ? 'Filter/Request Schema' : 'Schema'), createdAt: nowIso2, updatedAt: nowIso2, resourcePath: schemaResourcePath, idField: idFieldFromBody2, schemaId, apiOrigin: origin } };
7032
+ this._schemaCache.set(cacheKey, entryToCache);
7033
+ this.rememberSchemaInfo(schemaEpoch, schemaId, schemaHash);
6124
7034
  if (schemaTypeParam === 'response') {
6125
- this.updateLastResourceMetadataFromSchema(body);
7035
+ this.updateLastResourceMetadataFromSchema(body, schemaEpoch);
6126
7036
  }
6127
7037
  return of(this.schemaNormalizer.normalizeSchema(body));
6128
7038
  }),
6129
- // Angular HttpClient may surface 304 as error; also handle status 0 (CORS/network) by reusing cache
7039
+ // Only a server-confirmed 304 can reuse a stored representation.
6130
7040
  catchError((err) => {
6131
- if (err?.status === 304 || err?.status === 0) {
6132
- return from(this._schemaCache.get(schemaId)).pipe(concatMap((cached) => {
7041
+ if (err?.status === 304) {
7042
+ return from(this._schemaCache.get(cacheKey)).pipe(concatMap((cached) => {
6133
7043
  if (cached?.schema) {
6134
7044
  try {
6135
7045
  const cachedHash = cached.schemaHash || '';
6136
- this._lastSchemaInfo = { schemaId, schemaHash: cachedHash };
7046
+ this.rememberSchemaInfo(schemaEpoch, schemaId, cachedHash);
6137
7047
  if (schemaTypeParam === 'response') {
6138
- this.updateLastResourceMetadataFromSchema(cached.schema);
7048
+ this.updateLastResourceMetadataFromSchema(cached.schema, schemaEpoch);
6139
7049
  }
6140
7050
  }
6141
7051
  catch { }
6142
7052
  return of(this.schemaNormalizer.normalizeSchema(cached.schema));
6143
7053
  }
6144
- const headers = composeHeadersWithVersion(entry);
7054
+ const headers = headersBase;
6145
7055
  let h = (headers instanceof HttpHeaders ? headers : new HttpHeaders(headers));
6146
- if (locale)
6147
- h = h.set('Accept-Language', locale);
6148
- if (tenant)
6149
- h = h.set('X-Tenant', tenant);
6150
7056
  // Force a fresh response to avoid intermediary caches when refetching
6151
7057
  try {
6152
7058
  h = h.set('Cache-Control', 'no-cache, no-store, max-age=0').set('Pragma', 'no-cache');
@@ -6158,16 +7064,17 @@ class GenericCrudService {
6158
7064
  context: params.httpContext,
6159
7065
  }).pipe(tap((fresh) => {
6160
7066
  const now = new Date().toISOString();
6161
- const entry = { schema: fresh, schemaHash: '', meta: { version: '2.0.0', name: (schemaTypeParam === 'request' ? 'Filter/Request Schema' : 'Schema'), createdAt: now, updatedAt: now, resourcePath: this.resourcePath, schemaId, apiOrigin: origin } };
6162
- this._schemaCache.set(schemaId, entry);
7067
+ const entry = { schema: fresh, schemaHash: '', meta: { version: '2.0.0', name: (schemaTypeParam === 'request' ? 'Filter/Request Schema' : 'Schema'), createdAt: now, updatedAt: now, resourcePath: schemaResourcePath, schemaId, apiOrigin: origin } };
7068
+ this._schemaCache.set(cacheKey, entry);
7069
+ this.rememberSchemaInfo(schemaEpoch, schemaId, '');
6163
7070
  if (schemaTypeParam === 'response') {
6164
- this.updateLastResourceMetadataFromSchema(fresh);
7071
+ this.updateLastResourceMetadataFromSchema(fresh, schemaEpoch);
6165
7072
  }
6166
7073
  }), map((fresh) => this.schemaNormalizer.normalizeSchema(fresh)), catchError(this.handleError));
6167
7074
  }));
6168
7075
  }
6169
7076
  return this.handleError(err);
6170
- }))), shareReplay(1));
7077
+ }))), shareReplay({ bufferSize: 1, refCount: true }));
6171
7078
  }
6172
7079
  /**
6173
7080
  * Retorna todos os registros do recurso.
@@ -6285,7 +7192,7 @@ class GenericCrudService {
6285
7192
  if (!isHttpResponse) {
6286
7193
  return response;
6287
7194
  }
6288
- const idField = this._lastResourceMeta.idField || 'id';
7195
+ const idField = this.getResourceIdField() || 'id';
6289
7196
  const createdId = response.body?.data?.[idField] ??
6290
7197
  response.body?.data?.id;
6291
7198
  if (createdId !== undefined && createdId !== null) {
@@ -6734,7 +7641,7 @@ class GenericCrudService {
6734
7641
  * Fluxo:
6735
7642
  * - Deriva o path a partir de schemaUrl() e garante o sufixo "/filter"
6736
7643
  * - Chama getFilteredSchema com operation='post' e schemaType='request'
6737
- * - Usa cache por chave (endpointKey|path|post|request|includeInternal) para compartilhamento entre assinantes
7644
+ * - Compartilha assinantes pelo endpoint e contexto completo da representação de schema
6738
7645
  */
6739
7646
  getFilterSchema(options) {
6740
7647
  this.ensureConfigured();
@@ -6743,7 +7650,7 @@ class GenericCrudService {
6743
7650
  // Não reconfigura o serviço, apenas usa a chave como parte da cacheKey
6744
7651
  }
6745
7652
  // Deriva path base do schema preservando prefixos
6746
- const basePath = (this.schemaUrl() || '')
7653
+ const basePath = this.schemaPathname(this.getEndpointUrl('schema', undefined, undefined, options?.endpointKey))
6747
7654
  .replace(/\/+$/, '')
6748
7655
  .replace(/\/schemas$/, '');
6749
7656
  const requestedPath = options?.path;
@@ -6760,10 +7667,18 @@ class GenericCrudService {
6760
7667
  if (!/\/filter$/.test(path)) {
6761
7668
  path = `${path.replace(/\/+$/, '')}/filter`;
6762
7669
  }
7670
+ const schemaEpoch = this.filteredSchemaRequestEpoch(path, options?.endpointKey);
6763
7671
  const includeInternal = !!options?.includeInternalSchemas;
6764
7672
  const cacheEnabled = options?.cache !== false;
6765
7673
  const endpointKey = options?.endpointKey ?? this.currentEndpointKey;
6766
- const cacheKey = `${endpointKey}|${path}|post|request|${includeInternal ? '1' : '0'}`;
7674
+ const filteredUrl = this.getSchemasFilteredBaseUrl(endpointKey);
7675
+ const tenant = this.globalConfig.getTenant();
7676
+ const locale = typeof navigator !== 'undefined' ? navigator.language : undefined;
7677
+ const schemaParams = new HttpParams().set('path', path).set('operation', 'post').set('schemaType', 'request');
7678
+ const requestParams = includeInternal ? schemaParams.set('includeInternalSchemas', 'true') : schemaParams;
7679
+ const schemaId = buildSchemaId({ path, operation: 'post', schemaType: 'request', includeInternalSchemas: includeInternal });
7680
+ const capturedHeaders = this.captureSchemaHeaders(this.resolveEndpointEntry(endpointKey), tenant, locale);
7681
+ const cacheKey = `${endpointKey}|${this.schemaRepresentationKey(schemaId, `${filteredUrl}?${requestParams.toString()}`, capturedHeaders)}`;
6767
7682
  debugCrudService('[CRUD:Service] getFilterSchema:derived', {
6768
7683
  path, includeInternal, cacheEnabled, cacheKey,
6769
7684
  });
@@ -6781,12 +7696,19 @@ class GenericCrudService {
6781
7696
  endpointKey,
6782
7697
  ...(includeInternal ? { includeInternalSchemas: true } : {}),
6783
7698
  };
6784
- const request$ = this.getFilteredSchema(schemaRequest).pipe(tap((fields) => this.updateRangeFieldHints(fields)), shareReplay(1), catchError((err) => {
6785
- if (cacheEnabled) {
7699
+ const releaseRequest = () => {
7700
+ if (cacheEnabled && this._filterSchemaCache.get(cacheKey) === request$) {
6786
7701
  this._filterSchemaCache.delete(cacheKey);
6787
7702
  }
6788
- return throwError(() => err);
6789
- }));
7703
+ };
7704
+ const request$ = this.getFilteredSchema(schemaRequest).pipe(tap({ next: (fields) => {
7705
+ releaseRequest();
7706
+ if (schemaEpoch === this.refreshSchemaRuntimeContext())
7707
+ this.updateRangeFieldHints(fields);
7708
+ }, error: releaseRequest, complete: releaseRequest }),
7709
+ // Share only work in flight. A later initialization must revalidate the
7710
+ // representation instead of replaying an indefinitely completed schema.
7711
+ finalize(releaseRequest), shareReplay({ bufferSize: 1, refCount: true }));
6790
7712
  if (cacheEnabled) {
6791
7713
  this._filterSchemaCache.set(cacheKey, request$);
6792
7714
  }
@@ -7199,6 +8121,7 @@ class GenericCrudService {
7199
8121
  }
7200
8122
  }
7201
8123
  hasRangeFieldMetadata(fieldPath) {
8124
+ this.refreshSchemaRuntimeContext();
7202
8125
  const normalized = String(fieldPath || '').trim().toLowerCase();
7203
8126
  if (!normalized)
7204
8127
  return false;
@@ -8111,8 +9034,7 @@ function applyLocalCustomizations$2(baseCol, localCol) {
8111
9034
  result.headerStyle = localCol.headerStyle ?? baseCol.headerStyle;
8112
9035
  result.cssClass = localCol.cssClass ?? baseCol.cssClass;
8113
9036
  result.headerCssClass = localCol.headerCssClass ?? baseCol.headerCssClass;
8114
- const resolvedQuickView = normalizeResourceQuickViewBinding(localCol.quickView) ??
8115
- normalizeResourceQuickViewBinding(baseCol.quickView);
9037
+ const resolvedQuickView = reconcileFieldQuickViewBinding(baseCol.quickView, localCol.quickView);
8116
9038
  if (resolvedQuickView) {
8117
9039
  result.quickView = resolvedQuickView;
8118
9040
  }
@@ -8369,8 +9291,7 @@ function humanizeSchemaEnumValue(value) {
8369
9291
  .join(' ');
8370
9292
  }
8371
9293
  function resolveQuickViewFromFieldDefinition(def) {
8372
- return (normalizeResourceQuickViewBinding(def.quickView) ??
8373
- normalizeResourceQuickViewBinding(def.presentation?.interactions?.quickView) ??
9294
+ return (resolveFieldQuickViewBinding(def) ??
8374
9295
  normalizeResourceQuickViewBinding(def['extraProperties'] && typeof def['extraProperties'] === 'object' ? def['extraProperties']['quickView'] : undefined) ??
8375
9296
  undefined);
8376
9297
  }
@@ -13357,6 +14278,8 @@ function mapFieldDefinitionToMetadata(field) {
13357
14278
  }
13358
14279
  metadata.array = arrayConfig;
13359
14280
  }
14281
+ if (field.items)
14282
+ metadata.items = { ...field.items, ...(field.items.enum ? { enum: [...field.items.enum] } : {}) };
13360
14283
  if (field.collectionValidation) {
13361
14284
  metadata.collectionValidation = { ...field.collectionValidation };
13362
14285
  metadata.array = {
@@ -13365,6 +14288,9 @@ function mapFieldDefinitionToMetadata(field) {
13365
14288
  };
13366
14289
  }
13367
14290
  const simpleProps = [
14291
+ 'customField',
14292
+ 'customFieldKey',
14293
+ 'customFieldScope',
13368
14294
  'order',
13369
14295
  'group',
13370
14296
  'description',
@@ -13404,10 +14330,15 @@ function mapFieldDefinitionToMetadata(field) {
13404
14330
  'filterField',
13405
14331
  'dialog',
13406
14332
  'detailActionLabel',
14333
+ 'quickViewActionLabel',
13407
14334
  'copyCodeActionLabel',
13408
14335
  'copyIdActionLabel',
13409
14336
  'createActionLabel',
13410
14337
  'actions',
14338
+ 'quickViewVisible',
14339
+ 'quickViewOrder',
14340
+ 'resourceReference',
14341
+ 'quickView',
13411
14342
  'prefixIconColor',
13412
14343
  'suffixIconColor',
13413
14344
  'chipLeadingIcon',
@@ -13633,6 +14564,17 @@ function mapFieldDefinitionToMetadata(field) {
13633
14564
  if (normalizedOptionSource) {
13634
14565
  metadata.optionSource = normalizedOptionSource;
13635
14566
  }
14567
+ const resolvedQuickView = resolveFieldQuickViewBinding({
14568
+ name: field.name,
14569
+ valueField: field.valueField,
14570
+ quickView: metadata.quickView ?? field.quickView,
14571
+ presentation: metadata.presentation ?? field.presentation,
14572
+ resourceReference: metadata.resourceReference ?? field.resourceReference,
14573
+ optionSource: normalizedOptionSource ?? field.optionSource,
14574
+ });
14575
+ if (resolvedQuickView) {
14576
+ metadata.quickView = resolvedQuickView;
14577
+ }
13636
14578
  const explicitDependencyFields = field.dependencyFields;
13637
14579
  if (explicitDependencyFields !== undefined) {
13638
14580
  metadata.dependencyFields = Array.isArray(explicitDependencyFields)
@@ -13771,8 +14713,14 @@ function mapFieldDefinitionToMetadata(field) {
13771
14713
  if (field.clearButton !== undefined) {
13772
14714
  metadata.clearButton = field.clearButton;
13773
14715
  }
13774
- if (field.options) {
13775
- const mapped = field.options.map((opt) => {
14716
+ const enumOptions = field.options === undefined && !field.optionSource &&
14717
+ Array.isArray(field.enumValues) && field.enumValues.every((value) => value === null || ['string', 'number', 'boolean'].includes(typeof value))
14718
+ ? field.enumValues
14719
+ : undefined;
14720
+ if (Array.isArray(field.enumValues))
14721
+ metadata.enumValues = [...field.enumValues];
14722
+ if (field.options || enumOptions) {
14723
+ const mapped = (field.options ?? enumOptions ?? []).map((opt) => {
13776
14724
  if (opt !== null && typeof opt === 'object') {
13777
14725
  const { key, value, text, label, ...rest } = opt;
13778
14726
  const resolvedValue = key !== undefined ? key : value;
@@ -14622,10 +15570,7 @@ class DynamicFormService {
14622
15570
  */
14623
15571
  buildSchemaCacheKey(params) {
14624
15572
  const schemaId = buildSchemaId(params);
14625
- const prefix = params.baseUrl ? `${params.baseUrl}::` : '';
14626
- const tenantPart = params.tenant ? `::tenant:${params.tenant}` : '';
14627
- const localePart = params.locale ? `::locale:${params.locale}` : '';
14628
- return `${prefix}${schemaId}${tenantPart}${localePart}`;
15573
+ return buildSchemaRequestKey(schemaId, params.baseUrl ?? '', params);
14629
15574
  }
14630
15575
  /**
14631
15576
  * Obtém um esquema compilado em cache L1 em memória, respeitando o TTL de expiração.
@@ -14780,6 +15725,21 @@ class DynamicFormService {
14780
15725
  */
14781
15726
  getUiSpecificValidators(meta) {
14782
15727
  const v = [];
15728
+ if (meta.items) {
15729
+ v.push(control => {
15730
+ const result = normalizeScalarArrayValue(control.value, meta.items);
15731
+ return result.valid ? null : { scalarItems: { invalidIndices: result.invalidIndices } };
15732
+ });
15733
+ }
15734
+ const enumValues = meta.enumValues;
15735
+ if (Array.isArray(enumValues)) {
15736
+ const required = meta.required === true || meta.validators?.required === true;
15737
+ v.push(control => {
15738
+ if (control.value == null || !required && control.value === '')
15739
+ return null;
15740
+ return enumValues.some((candidate) => candidate === control.value) ? null : { enum: true };
15741
+ });
15742
+ }
14783
15743
  if (meta.controlType === FieldControlType.DATE_PICKER) {
14784
15744
  const md = meta;
14785
15745
  const min = md.minDate
@@ -17210,6 +18170,24 @@ class ResourceDiscoveryService {
17210
18170
  schemaNormalizer = inject(SchemaNormalizerService);
17211
18171
  apiUrlConfig = inject(API_URL, { optional: true });
17212
18172
  i18n = inject(PraxisI18nService, { optional: true });
18173
+ globalConfig = (() => {
18174
+ try {
18175
+ assertInInjectionContext(ResourceDiscoveryService);
18176
+ }
18177
+ catch {
18178
+ return null;
18179
+ }
18180
+ return inject(GlobalConfigService, { optional: true });
18181
+ })();
18182
+ runtimeContext = (() => {
18183
+ try {
18184
+ assertInInjectionContext(ResourceDiscoveryService);
18185
+ }
18186
+ catch {
18187
+ return null;
18188
+ }
18189
+ return inject(EnterpriseRuntimeContextService, { optional: true });
18190
+ })();
17213
18191
  surfaceCatalogInFlightByHref = new Map();
17214
18192
  schemaCatalogInFlightByUrl = new Map();
17215
18193
  schemaFieldsInFlightByUrl = new Map();
@@ -17298,19 +18276,20 @@ class ResourceDiscoveryService {
17298
18276
  const url = this.resolveHref('/schemas/catalog', options);
17299
18277
  const params = this.toSchemaCatalogParams(query);
17300
18278
  const serializedParams = params.toString();
17301
- const cacheKey = serializedParams ? `${url}?${serializedParams}` : url;
18279
+ const headers = this.captureSchemaHeaders(options, url);
18280
+ const cacheKey = this.schemaRequestKey(serializedParams ? `${url}?${serializedParams}` : url, headers);
17302
18281
  const existing = this.schemaCatalogInFlightByUrl.get(cacheKey);
17303
18282
  if (existing) {
17304
18283
  return existing;
17305
18284
  }
17306
18285
  let request;
17307
- request = this.http
17308
- .get(url, { params })
17309
- .pipe(finalize$1(() => {
17310
- if (this.schemaCatalogInFlightByUrl.get(cacheKey) === request) {
18286
+ const release = () => {
18287
+ if (this.schemaCatalogInFlightByUrl.get(cacheKey) === request)
17311
18288
  this.schemaCatalogInFlightByUrl.delete(cacheKey);
17312
- }
17313
- }), shareReplay$1({ bufferSize: 1, refCount: true }));
18289
+ };
18290
+ request = this.http
18291
+ .get(url, { params, headers })
18292
+ .pipe(tap$1({ next: release, error: release, complete: release }), finalize$1(release), shareReplay$1({ bufferSize: 1, refCount: true }));
17314
18293
  this.schemaCatalogInFlightByUrl.set(cacheKey, request);
17315
18294
  return request;
17316
18295
  }
@@ -17857,7 +18836,10 @@ class ResourceDiscoveryService {
17857
18836
  return this.http.get(this.resolveHref(href, options));
17858
18837
  }
17859
18838
  getSchemaByUrl(schemaUrl, options) {
17860
- return this.fetchJson(schemaUrl, options);
18839
+ if (!this.http)
18840
+ return throwError(() => new Error('ResourceDiscoveryService requires HttpClient for structural schemas.'));
18841
+ const url = this.resolveHref(schemaUrl, options);
18842
+ return this.http.get(url, { headers: this.captureSchemaHeaders(options, url) });
17861
18843
  }
17862
18844
  getSchemaFieldsByUrl(schemaUrl, options) {
17863
18845
  const normalizedUrl = String(schemaUrl ?? '').trim();
@@ -17865,33 +18847,67 @@ class ResourceDiscoveryService {
17865
18847
  return of([]);
17866
18848
  }
17867
18849
  const resolvedUrl = this.resolveHref(normalizedUrl, options);
17868
- const cacheKey = `${options?.endpointKey ?? 'default'}::${this.resolveApiBaseUrl(options)}::${resolvedUrl}`;
18850
+ const headers = this.captureSchemaHeaders(options, resolvedUrl);
18851
+ const cacheKey = this.schemaRequestKey(resolvedUrl, headers);
17869
18852
  const existing = this.schemaFieldsInFlightByUrl.get(cacheKey);
17870
18853
  if (existing) {
17871
18854
  return existing;
17872
18855
  }
17873
18856
  let request$;
17874
- request$ = this.getSchemaByUrl(normalizedUrl, options).pipe(map$1((schema) => this.schemaNormalizer.normalizeSchema(schema)), catchError$1((err) => {
17875
- if (this.schemaFieldsInFlightByUrl.get(cacheKey) === request$) {
18857
+ const release = () => {
18858
+ if (this.schemaFieldsInFlightByUrl.get(cacheKey) === request$)
17876
18859
  this.schemaFieldsInFlightByUrl.delete(cacheKey);
17877
- }
17878
- return throwError(() => err);
17879
- }), shareReplay$1({ bufferSize: 1, refCount: false }));
18860
+ };
18861
+ if (!this.http)
18862
+ return throwError(() => new Error('ResourceDiscoveryService requires HttpClient for structural schemas.'));
18863
+ request$ = this.http.get(resolvedUrl, { headers }).pipe(map$1((schema) => {
18864
+ if (!schema || typeof schema !== 'object' || Array.isArray(schema) ||
18865
+ ('properties' in schema && (!schema.properties || typeof schema.properties !== 'object' || Array.isArray(schema.properties)))) {
18866
+ throw new Error('Invalid structural schema representation.');
18867
+ }
18868
+ return this.schemaNormalizer.normalizeSchema(schema);
18869
+ }), tap$1({ next: release, error: release, complete: release }), finalize$1(release), shareReplay$1({ bufferSize: 1, refCount: true }));
17880
18870
  this.schemaFieldsInFlightByUrl.set(cacheKey, request$);
17881
18871
  return request$;
17882
18872
  }
18873
+ captureSchemaHeaders(options, destination) {
18874
+ const snapshot = this.runtimeContext?.snapshot;
18875
+ if (snapshot && snapshot.state !== 'ready')
18876
+ throw new Error('A confirmed runtime context is required to load structural schemas.');
18877
+ // API credentials belong only to the configured/trusted origins. Absolute
18878
+ // external references keep their existing anonymous transport behavior.
18879
+ if (destination && this.isAbsoluteHttpUrl(destination) &&
18880
+ new URL(destination).origin !== this.resolveApiOrigin(options) &&
18881
+ !this.isTrustedOrigin(new URL(destination).origin, options))
18882
+ return new HttpHeaders();
18883
+ let headers = composeHeadersWithVersion(this.resolveApiEntry(options)) ?? new HttpHeaders();
18884
+ const effective = this.runtimeContext?.effectiveContext;
18885
+ if (effective)
18886
+ headers = this.runtimeContext.applyHeaders(headers);
18887
+ const tenants = [effective ? effective.activeTenant.tenantId : this.globalConfig?.getTenant(), ...(headers.getAll('X-Tenant') ?? []),
18888
+ ...(headers.getAll('X-Tenant-ID') ?? [])].map(value => String(value ?? '').trim()).filter(Boolean);
18889
+ if (new Set(tenants).size > 1)
18890
+ throw new Error('Conflicting declared schema tenant headers.');
18891
+ if (tenants.length)
18892
+ headers = headers.set('X-Tenant', tenants[0]);
18893
+ const locale = headers.get('Accept-Language') || (typeof navigator !== 'undefined' ? navigator.language : undefined);
18894
+ if (locale)
18895
+ headers = headers.set('Accept-Language', locale);
18896
+ return headers;
18897
+ }
18898
+ schemaRequestKey(url, headers) {
18899
+ const key = buildSchemaRequestKey('', url, {
18900
+ tenant: headers.get('X-Tenant') ?? undefined, locale: headers.get('Accept-Language') ?? undefined,
18901
+ });
18902
+ return scopeSchemaRequestKey(key, headers.keys().map(name => [name, headers.getAll(name) ?? []]));
18903
+ }
17883
18904
  /**
17884
18905
  * Resolve os campos do schema de resposta (`response`) de um recurso de catálogo a partir
17885
18906
  * do seu `resourcePath` ou `resourceKey`.
17886
18907
  *
17887
- * Estratégia zero-friction:
17888
- * 1. Se o endpoint no `/schemas/catalog` publicar `schemaLinks.response`, busca e normaliza
17889
- * o schema completo via `getSchemaFieldsByUrl` (com fallback para `responseFields` do catálogo).
17890
- * 2. Caso contrário, projeta `FieldDefinition[]` diretamente do resumo `responseSchema.fields`
17891
- * já carregado em `/schemas/catalog` sem round-trip extra.
17892
- * 3. Se o recurso não constar no grupo default de `/schemas/catalog` (ex.: host multi-grupo)
17893
- * ou não trouxer links/campos no catálogo, consulta diretamente `/schemas/filtered` para
17894
- * `POST {resourcePath}/filter` (`schemaType=response`).
18908
+ * O catálogo localiza a URL estrutural; seu resumo de campos não substitui uma
18909
+ * representação atual. Segue schemaLinks.response ou a superfície estrutural
18910
+ * convencional já suportada. Schema vazio é autoritativo; erros são propagados.
17895
18911
  */
17896
18912
  getResourceSchemaFields(resourcePath, options) {
17897
18913
  const raw = String(resourcePath ?? '').trim();
@@ -17907,33 +18923,26 @@ class ResourceDiscoveryService {
17907
18923
  if (!matched) {
17908
18924
  const fallbackUrl = this.buildFallbackFilteredResponseSchemaUrl(raw);
17909
18925
  if (fallbackUrl && this.http) {
17910
- return this.getSchemaFieldsByUrl(fallbackUrl, options).pipe(catchError$1(() => of([])));
18926
+ return this.getSchemaFieldsByUrl(fallbackUrl, options);
17911
18927
  }
17912
- return of([]);
18928
+ return throwError(() => new Error('A structural response schema URL is required.'));
17913
18929
  }
17914
- const fallbackFields = this.projectCatalogFieldsToFieldDefinitions(matched.responseFields ?? []);
17915
18930
  const targetSchemaUrl = matched.responseSchemaUrl ||
17916
- (fallbackFields.length === 0
17917
- ? this.buildFallbackFilteredResponseSchemaUrl(matched.value)
17918
- : null);
18931
+ this.buildFallbackFilteredResponseSchemaUrl(matched.value);
17919
18932
  if (targetSchemaUrl && this.http) {
17920
- return this.getSchemaFieldsByUrl(targetSchemaUrl, options).pipe(map$1((fields) => (fields.length > 0 ? fields : fallbackFields)), catchError$1(() => of(fallbackFields)));
18933
+ return this.getSchemaFieldsByUrl(targetSchemaUrl, options);
17921
18934
  }
17922
- return of(fallbackFields);
17923
- }), catchError$1(() => of([])));
18935
+ return throwError(() => new Error('A structural response schema URL is required.'));
18936
+ }));
17924
18937
  }
17925
18938
  /**
17926
18939
  * Resolve os campos do schema de filtro (`request` de `POST {resourcePath}/filter`) de um
17927
18940
  * recurso de catálogo a partir do seu `resourcePath` ou `resourceKey`.
17928
18941
  *
17929
- * Estratégia zero-friction:
17930
- * 1. Se o endpoint de filtro no `/schemas/catalog` publicar `schemaLinks.request`, busca e normaliza
17931
- * o schema completo via `getSchemaFieldsByUrl` (com fallback para `filterFields` do catálogo).
17932
- * 2. Caso contrário, projeta `FieldDefinition[]` diretamente do resumo `requestSchema.fields`
17933
- * já carregado em `/schemas/catalog` sem round-trip extra.
17934
- * 3. Se o recurso não constar no grupo default de `/schemas/catalog` ou não trouxer links/campos
17935
- * no catálogo (e não declarar explicitamente `capabilities.filter === false`), consulta diretamente
17936
- * `/schemas/filtered` para `POST {resourcePath}/filter` (`schemaType=request`).
18942
+ * O catálogo localiza schemaLinks.request ou a superfície estrutural convencional
18943
+ * já suportada. filterFields é documental, não fallback de autorização ou schema.
18944
+ * Schema vazio é autoritativo; erros são propagados. capabilities.filter=false
18945
+ * continua declarando explicitamente a ausência de filtros.
17937
18946
  */
17938
18947
  getResourceFilterSchemaFields(resourcePath, options) {
17939
18948
  const raw = String(resourcePath ?? '').trim();
@@ -17949,21 +18958,20 @@ class ResourceDiscoveryService {
17949
18958
  if (!matched) {
17950
18959
  const fallbackUrl = this.buildFallbackFilteredRequestSchemaUrl(raw);
17951
18960
  if (fallbackUrl && this.http) {
17952
- return this.getSchemaFieldsByUrl(fallbackUrl, options).pipe(catchError$1(() => of([])));
18961
+ return this.getSchemaFieldsByUrl(fallbackUrl, options);
17953
18962
  }
17954
- return of([]);
18963
+ return throwError(() => new Error('A structural request filter schema URL is required.'));
17955
18964
  }
17956
- const fallbackFields = this.projectCatalogFieldsToFieldDefinitions(matched.filterFields ?? []);
17957
18965
  const supportsFilter = matched.capabilities?.filter !== false;
18966
+ if (!supportsFilter)
18967
+ return of([]);
17958
18968
  const targetSchemaUrl = matched.filterSchemaUrl ||
17959
- (fallbackFields.length === 0 && supportsFilter
17960
- ? this.buildFallbackFilteredRequestSchemaUrl(matched.value)
17961
- : null);
18969
+ this.buildFallbackFilteredRequestSchemaUrl(matched.value);
17962
18970
  if (targetSchemaUrl && this.http) {
17963
- return this.getSchemaFieldsByUrl(targetSchemaUrl, options).pipe(map$1((fields) => (fields.length > 0 ? fields : fallbackFields)), catchError$1(() => of(fallbackFields)));
18971
+ return this.getSchemaFieldsByUrl(targetSchemaUrl, options);
17964
18972
  }
17965
- return of(fallbackFields);
17966
- }), catchError$1(() => of([])));
18973
+ return throwError(() => new Error('A structural request filter schema URL is required.'));
18974
+ }));
17967
18975
  }
17968
18976
  static REST_API_ENVELOPE_FIELDS = new Set([
17969
18977
  'status',
@@ -18136,36 +19144,6 @@ class ResourceDiscoveryService {
18136
19144
  const filterPath = `${basePath}/filter`;
18137
19145
  return `/schemas/filtered?path=${encodeURIComponent(filterPath)}&operation=post&schemaType=${schemaType}`;
18138
19146
  }
18139
- projectCatalogFieldsToFieldDefinitions(catalogFields) {
18140
- if (this.isPureRestApiEnvelopeFields(catalogFields)) {
18141
- return [];
18142
- }
18143
- return catalogFields
18144
- .filter((field) => !!field && typeof field.name === 'string' && field.name.trim().length > 0)
18145
- .map((field) => {
18146
- const name = field.name.trim();
18147
- const label = String(field.label ?? '').trim() || name;
18148
- const type = String(field.type ?? field.controlType ?? 'string').trim() || 'string';
18149
- const enumValues = Array.isArray(field.enumValues)
18150
- ? field.enumValues
18151
- .map((val) => String(val ?? '').trim())
18152
- .filter((val) => val.length > 0)
18153
- : [];
18154
- return {
18155
- name,
18156
- label,
18157
- type,
18158
- controlType: String(field.controlType ?? '').trim() || undefined,
18159
- description: String(field.description ?? '').trim() || undefined,
18160
- ...(typeof field.required === 'boolean' ? { required: field.required } : {}),
18161
- ...(enumValues.length > 0
18162
- ? {
18163
- options: enumValues.map((val) => ({ key: val, value: val })),
18164
- }
18165
- : {}),
18166
- };
18167
- });
18168
- }
18169
19147
  resolveHref(href, options) {
18170
19148
  const normalizedHref = String(href || '').trim();
18171
19149
  if (!normalizedHref) {
@@ -20056,10 +21034,14 @@ class ResourceSurfaceOpenAdapterService {
20056
21034
  apiEndpointKey: options.endpointKey ?? null,
20057
21035
  apiUrlEntry: options.apiUrlEntry ?? resolvedApiEntry,
20058
21036
  });
20059
- if (resolution.state !== 'ready' || !resolution.payload) {
21037
+ if (resolution.state === 'ready' && resolution.payload) {
21038
+ return resolution.payload;
21039
+ }
21040
+ const isObjectReadProjectionWithoutChildCollection = surface.responseCardinality === 'OBJECT' &&
21041
+ resolution.reason === 'related-resource-read-operation-not-published';
21042
+ if (!isObjectReadProjectionWithoutChildCollection) {
20060
21043
  throw new Error(`ResourceSurfaceOpenAdapterService could not materialize related surface "${surface.id}": ${resolution.reason || resolution.state}.`);
20061
21044
  }
20062
- return resolution.payload;
20063
21045
  }
20064
21046
  const resolvedSchemaUrl = this.discovery.resolveHref(surface.schemaUrl, discoveryOptions);
20065
21047
  const resolvedSubmitUrl = this.isWritableFormSurface(surface.kind)
@@ -20088,6 +21070,7 @@ class ResourceSurfaceOpenAdapterService {
20088
21070
  title: surface.title,
20089
21071
  description: surface.description ?? null,
20090
21072
  intent: surface.intent ?? null,
21073
+ icon: surface.icon ?? null,
20091
21074
  operationId: surface.operationId,
20092
21075
  path: surface.path,
20093
21076
  method: surface.method,
@@ -20162,6 +21145,9 @@ class ResourceSurfaceOpenAdapterService {
20162
21145
  return this.clone(preset.payload);
20163
21146
  }
20164
21147
  resolveDefaultIcon(surface) {
21148
+ if (typeof surface.icon === 'string' && surface.icon.trim().length > 0) {
21149
+ return surface.icon.trim();
21150
+ }
20165
21151
  if (surface.relatedResource) {
20166
21152
  return 'dataset_linked';
20167
21153
  }
@@ -20334,6 +21320,7 @@ class ResourceRecordOpenService {
20334
21320
  identityContract: identityResolution.contract,
20335
21321
  identityDiagnostics: identityResolution.diagnostics,
20336
21322
  identity,
21323
+ contextualSurfaces: bundle.contextualCatalog.surfaces,
20337
21324
  };
20338
21325
  }));
20339
21326
  }), catchError$1((error) => throwError(() => this.normalizeFailure(error))));
@@ -20538,6 +21525,14 @@ class ResourceRecordOpenService {
20538
21525
  }
20539
21526
  let current = target;
20540
21527
  for (const segment of segments) {
21528
+ if (Array.isArray(current)) {
21529
+ const index = Number(segment);
21530
+ if (!Number.isInteger(index) || index < 0 || index >= current.length) {
21531
+ return { found: false, value: undefined };
21532
+ }
21533
+ current = current[index];
21534
+ continue;
21535
+ }
20541
21536
  const currentRecord = this.record(current);
20542
21537
  if (!currentRecord ||
20543
21538
  !Object.prototype.hasOwnProperty.call(currentRecord, segment)) {
@@ -20611,378 +21606,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
20611
21606
  args: [{ providedIn: 'any' }]
20612
21607
  }] });
20613
21608
 
20614
- const PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS = new InjectionToken('PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS');
20615
- const PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY = new InjectionToken('PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY');
20616
- function providePraxisEnterpriseRuntimeContext(options = {}) {
20617
- const normalized = {
20618
- ...options,
20619
- includeGlobalFetchHeaders: options.includeGlobalFetchHeaders ?? true,
20620
- blocking: options.blocking ?? false,
20621
- errorPolicy: options.errorPolicy ?? 'ignore',
20622
- };
20623
- return [
20624
- { provide: PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS, useValue: normalized },
20625
- {
20626
- provide: PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY,
20627
- useFactory: (service) => () => service.ready().then(() => undefined),
20628
- deps: [EnterpriseRuntimeContextService],
20629
- },
20630
- {
20631
- provide: APP_INITIALIZER,
20632
- multi: true,
20633
- useFactory: (ready) => () => normalized.blocking ? ready() : undefined,
20634
- deps: [PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY],
20635
- },
20636
- ];
20637
- }
20638
-
20639
- const CONTEXT_HEADERS = new Set([
20640
- 'x-tenant-id', 'x-tenant', 'x-user-id', 'x-env', 'x-updated-by',
20641
- 'x-praxis-profile-id', 'x-praxis-context-version',
20642
- ]);
20643
- const EXPERIENCE_HEADERS = new Set(['accept-language', 'x-timezone', 'x-praxis-module-key']);
20644
- /** A response for an older selection must never be presented as confirmed. */
20645
- class EnterpriseRuntimeContextObsoleteError extends Error {
20646
- constructor() {
20647
- super('Runtime context changed before the operation was confirmed.');
20648
- this.name = 'EnterpriseRuntimeContextObsoleteError';
20649
- }
20650
- }
20651
- class EnterpriseRuntimeContextService {
20652
- http = inject(HttpClient);
20653
- apiUrl = inject(API_URL, { optional: true });
20654
- options = inject(PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS, {
20655
- optional: true,
20656
- });
20657
- contextSubject = new BehaviorSubject(null);
20658
- loadPromise = null;
20659
- contextRevision = 0;
20660
- contextChanges$ = this.contextSubject.asObservable();
20661
- get snapshot() {
20662
- return this.contextSubject.value;
20663
- }
20664
- get effectiveContext() {
20665
- const context = this.snapshot;
20666
- return context?.state === 'ready' ? context.effectiveContext : null;
20667
- }
20668
- ready() {
20669
- if (this.contextSubject.value) {
20670
- return Promise.resolve(this.contextSubject.value);
20671
- }
20672
- if (this.loadPromise) {
20673
- return this.loadPromise;
20674
- }
20675
- const revision = this.contextRevision;
20676
- let currentLoad;
20677
- currentLoad = this.load(revision)
20678
- .catch((error) => {
20679
- if ((this.options?.errorPolicy ?? 'ignore') === 'fail') {
20680
- throw error;
20681
- }
20682
- return null;
20683
- })
20684
- .finally(() => {
20685
- if (this.loadPromise === currentLoad)
20686
- this.loadPromise = null;
20687
- });
20688
- this.loadPromise = currentLoad;
20689
- return currentLoad;
20690
- }
20691
- refresh() {
20692
- const revision = this.invalidateContext();
20693
- let currentLoad;
20694
- currentLoad = this.load(revision).catch((error) => {
20695
- if ((this.options?.errorPolicy ?? 'ignore') === 'fail') {
20696
- throw error;
20697
- }
20698
- return null;
20699
- }).finally(() => {
20700
- if (this.loadPromise === currentLoad)
20701
- this.loadPromise = null;
20702
- });
20703
- this.loadPromise = currentLoad;
20704
- return currentLoad;
20705
- }
20706
- invalidate() {
20707
- this.invalidateContext();
20708
- }
20709
- /** Independent host tenant discovery; it never selects the runtime context. */
20710
- tenants() {
20711
- return this.getRuntimeSurface('tenants');
20712
- }
20713
- choices(options = {}) {
20714
- const pageSize = options.pageSize ?? 50;
20715
- if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100) {
20716
- return Promise.reject(new RangeError('pageSize must be an integer between 1 and 100.'));
20717
- }
20718
- let params = new HttpParams().set('pageSize', pageSize);
20719
- if (options.cursor !== undefined)
20720
- params = params.set('cursor', options.cursor);
20721
- return firstValueFrom(this.http.get(this.endpoint('choices'), {
20722
- headers: this.requestHeaders({ includeSnapshot: true }), params,
20723
- }));
20724
- }
20725
- /** Read one authorized navigation page for the currently confirmed context. */
20726
- async navigation(options = {}) {
20727
- const { parentRef, cursor, pageSize = 50 } = options;
20728
- if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100) {
20729
- throw new RangeError('pageSize must be an integer between 1 and 100.');
20730
- }
20731
- if (parentRef !== undefined && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(parentRef)) {
20732
- throw new RangeError('parentRef must be a canonical group UUID.');
20733
- }
20734
- if (cursor !== undefined && (typeof cursor !== 'string' || cursor.length === 0 || cursor.length > 4096)) {
20735
- throw new RangeError('cursor must be a non-empty opaque string of at most 4096 characters.');
20736
- }
20737
- // Capture before ready(): a context load or switch may itself become obsolete.
20738
- const revision = this.contextRevision;
20739
- let expectedContextVersion = null;
20740
- try {
20741
- const context = await this.ready();
20742
- if (revision !== this.contextRevision)
20743
- throw new EnterpriseRuntimeContextObsoleteError();
20744
- const contextVersion = context?.state === 'ready' ? context.effectiveContext?.contextVersion : null;
20745
- if (!contextVersion?.trim())
20746
- throw new Error('Runtime context is not confirmed.');
20747
- expectedContextVersion = contextVersion;
20748
- if (this.effectiveContext?.contextVersion !== contextVersion)
20749
- throw new EnterpriseRuntimeContextObsoleteError();
20750
- let params = new HttpParams().set('pageSize', pageSize);
20751
- if (parentRef !== undefined)
20752
- params = params.set('parentRef', parentRef);
20753
- if (cursor !== undefined)
20754
- params = params.set('cursor', cursor);
20755
- const headers = this.requestHeaders({ includeSnapshot: true });
20756
- if (revision !== this.contextRevision || this.effectiveContext?.contextVersion !== contextVersion) {
20757
- throw new EnterpriseRuntimeContextObsoleteError();
20758
- }
20759
- const response = await firstValueFrom(this.http.get(this.endpoint('navigation'), {
20760
- headers, params,
20761
- }));
20762
- if (revision !== this.contextRevision || this.effectiveContext?.contextVersion !== contextVersion) {
20763
- throw new EnterpriseRuntimeContextObsoleteError();
20764
- }
20765
- if (response.contextVersion !== contextVersion) {
20766
- throw new EnterpriseRuntimeContextObsoleteError();
20767
- }
20768
- return response;
20769
- }
20770
- catch (error) {
20771
- if (revision !== this.contextRevision || (expectedContextVersion !== null && this.effectiveContext?.contextVersion !== expectedContextVersion)) {
20772
- throw new EnterpriseRuntimeContextObsoleteError();
20773
- }
20774
- throw error;
20775
- }
20776
- }
20777
- securityEvents() {
20778
- return this.getRuntimeSurface('securityEvents');
20779
- }
20780
- switchContext(command) {
20781
- const revision = this.invalidateContext();
20782
- const operation = firstValueFrom(this.http.put(this.endpoint('context'), command, { headers: this.requestHeaders() })).then((response) => {
20783
- if (revision !== this.contextRevision)
20784
- throw new EnterpriseRuntimeContextObsoleteError();
20785
- const context = this.normalizeContext(response);
20786
- this.contextSubject.next(context);
20787
- return context;
20788
- });
20789
- let currentSwitch;
20790
- currentSwitch = operation.finally(() => {
20791
- if (this.loadPromise === currentSwitch)
20792
- this.loadPromise = null;
20793
- });
20794
- this.loadPromise = currentSwitch;
20795
- return currentSwitch;
20796
- }
20797
- headers(fallback) {
20798
- return {
20799
- ...this.withoutContextHeaders(this.normalizeHeaders(fallback ?? {}), true),
20800
- ...this.normalizeHeaders(this.headersFromSnapshot(this.contextSubject.value)),
20801
- };
20802
- }
20803
- /** Preserve host authentication headers while removing unconfirmed contextual claims. */
20804
- effectiveRequestHeaders(fallback) {
20805
- const bootstrap = this.withoutContextHeaders(this.normalizeHeaders({
20806
- ...(this.options?.includeGlobalFetchHeaders ?? true ? this.globalFetchHeaders() : {}),
20807
- ...(this.options?.headersFactory?.() ?? {}),
20808
- ...(fallback ?? {}),
20809
- }), true);
20810
- const merged = { ...bootstrap, ...this.headersFromSnapshot(this.contextSubject.value) };
20811
- const result = {};
20812
- for (const [name, value] of Object.entries(merged)) {
20813
- if (typeof value === 'string' && value.trim())
20814
- result[name] = value;
20815
- }
20816
- return result;
20817
- }
20818
- /**
20819
- * Applies the confirmed runtime snapshot to an existing request header set.
20820
- * Contextual names are removed case-insensitively first, so nullable snapshot
20821
- * fields cannot leave bootstrap or caller identity behind. Unrelated headers,
20822
- * including repeated values, remain untouched.
20823
- */
20824
- applyHeaders(headers) {
20825
- if (!this.effectiveContext) {
20826
- return headers;
20827
- }
20828
- let next = headers;
20829
- for (const name of headers.keys()) {
20830
- if (this.isContextualHeader(name)) {
20831
- next = next.delete(name);
20832
- }
20833
- }
20834
- for (const [name, value] of Object.entries(this.headersFromSnapshot(this.contextSubject.value))) {
20835
- if (typeof value === 'string') {
20836
- next = next.set(name, value);
20837
- }
20838
- }
20839
- return next;
20840
- }
20841
- invalidateContext() {
20842
- this.contextRevision += 1;
20843
- this.loadPromise = null;
20844
- this.contextSubject.next(null);
20845
- return this.contextRevision;
20846
- }
20847
- async load(revision) {
20848
- const response = await firstValueFrom(this.http.get(this.endpoint('context'), {
20849
- headers: this.requestHeaders(),
20850
- }));
20851
- if (revision !== this.contextRevision)
20852
- return null;
20853
- const context = this.normalizeContext(response);
20854
- this.contextSubject.next(context ?? null);
20855
- return context ?? null;
20856
- }
20857
- normalizeContext(context) {
20858
- if (context.state !== 'ready' || !context.effectiveContext) {
20859
- return context;
20860
- }
20861
- const effective = context.effectiveContext;
20862
- return {
20863
- ...context,
20864
- effectiveContext: {
20865
- ...effective,
20866
- activeOrganizationId: effective.activeOrganizationId ?? null,
20867
- capabilities: Array.isArray(effective.capabilities) ? effective.capabilities : [],
20868
- authorities: Array.isArray(effective.authorities) ? effective.authorities : [],
20869
- },
20870
- };
20871
- }
20872
- async getRuntimeSurface(surface) {
20873
- return firstValueFrom(this.http.get(this.endpoint(surface), {
20874
- headers: this.requestHeaders({ includeSnapshot: true }),
20875
- }));
20876
- }
20877
- endpoint(surface) {
20878
- const configured = this.configuredEndpoint(surface);
20879
- if (configured) {
20880
- return configured;
20881
- }
20882
- return `${this.runtimeRoot()}/${this.surfacePath(surface)}`;
20883
- }
20884
- configuredEndpoint(surface) {
20885
- const configured = surface === 'context'
20886
- ? (this.options?.endpoints?.context ?? this.options?.endpoint)
20887
- : this.options?.endpoints?.[surface];
20888
- const normalized = configured?.trim().replace(/\/+$/, '');
20889
- return normalized || null;
20890
- }
20891
- runtimeRoot() {
20892
- const configuredContext = this.configuredEndpoint('context');
20893
- if (configuredContext?.endsWith('/context')) {
20894
- return configuredContext.slice(0, -'/context'.length);
20895
- }
20896
- const defaultEntry = this.apiUrl?.['default'];
20897
- const base = defaultEntry ? buildApiUrl(defaultEntry) : '';
20898
- return base ? `${base}/praxis/runtime` : '/api/praxis/runtime';
20899
- }
20900
- surfacePath(surface) {
20901
- switch (surface) {
20902
- case 'context':
20903
- return 'context';
20904
- case 'tenants':
20905
- return 'tenants';
20906
- case 'choices':
20907
- return 'context/choices';
20908
- case 'navigation':
20909
- return 'navigation';
20910
- case 'securityEvents':
20911
- return 'security-events';
20912
- }
20913
- }
20914
- requestHeaders(options = {}) {
20915
- const bootstrap = this.withoutContextHeaders(this.normalizeHeaders({
20916
- ...(this.options?.includeGlobalFetchHeaders ?? true ? this.globalFetchHeaders() : {}),
20917
- ...(this.options?.headersFactory?.() ?? {}),
20918
- }), options.includeSnapshot ?? false);
20919
- const merged = {
20920
- ...bootstrap,
20921
- ...(options.includeSnapshot ? this.headersFromSnapshot(this.contextSubject.value) : {}),
20922
- };
20923
- let headers = new HttpHeaders();
20924
- for (const [key, value] of Object.entries(merged)) {
20925
- if (value) {
20926
- headers = headers.set(key, value);
20927
- }
20928
- }
20929
- return headers;
20930
- }
20931
- globalFetchHeaders() {
20932
- try {
20933
- const factory = globalThis.PAX_FETCH_HEADERS;
20934
- return factory?.() ?? {};
20935
- }
20936
- catch {
20937
- return {};
20938
- }
20939
- }
20940
- headersFromSnapshot(context) {
20941
- if (context?.state !== 'ready' || !context.effectiveContext) {
20942
- return {};
20943
- }
20944
- const effective = context.effectiveContext;
20945
- return {
20946
- 'X-Praxis-Context-Version': effective.contextVersion,
20947
- 'X-Tenant-ID': effective.activeTenant?.tenantId,
20948
- 'X-User-ID': context.user?.userId,
20949
- 'X-Env': effective.environment ?? undefined,
20950
- 'Accept-Language': effective.locale ?? undefined,
20951
- 'X-Timezone': effective.timezone ?? undefined,
20952
- 'X-Praxis-Profile-ID': effective.activeProfileId ?? undefined,
20953
- 'X-Praxis-Module-Key': effective.activeModuleKey ?? undefined,
20954
- };
20955
- }
20956
- withoutContextHeaders(headers, includeExperience) {
20957
- return Object.fromEntries(Object.entries(headers).filter(([key]) => !CONTEXT_HEADERS.has(key.toLowerCase())
20958
- && (!includeExperience || !EXPERIENCE_HEADERS.has(key.toLowerCase()))));
20959
- }
20960
- isContextualHeader(name) {
20961
- const normalized = name.toLowerCase();
20962
- return CONTEXT_HEADERS.has(normalized) || EXPERIENCE_HEADERS.has(normalized);
20963
- }
20964
- normalizeHeaders(headers) {
20965
- const normalized = {};
20966
- for (const [key, value] of Object.entries(headers)) {
20967
- if (typeof value !== 'string') {
20968
- continue;
20969
- }
20970
- const trimmed = value.trim();
20971
- if (!trimmed) {
20972
- continue;
20973
- }
20974
- normalized[key] = trimmed;
20975
- }
20976
- return normalized;
20977
- }
20978
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: EnterpriseRuntimeContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
20979
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: EnterpriseRuntimeContextService, providedIn: 'root' });
20980
- }
20981
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: EnterpriseRuntimeContextService, decorators: [{
20982
- type: Injectable,
20983
- args: [{ providedIn: 'root' }]
20984
- }] });
20985
-
20986
21609
  const LOGGER_LEVEL_PRIORITY = {
20987
21610
  error: 0,
20988
21611
  warn: 1,
@@ -22094,12 +22717,10 @@ const DEFAULT_HOVER_CLOSE_DELAY_MS = 140;
22094
22717
  class ResourceQuickViewService {
22095
22718
  _recordOpenService;
22096
22719
  _discovery;
22720
+ _globalActions;
22097
22721
  runtimeContext = inject(EnterpriseRuntimeContextService, {
22098
22722
  optional: true,
22099
22723
  });
22100
- globalActions = inject(GlobalActionService, {
22101
- optional: true,
22102
- });
22103
22724
  presenter = inject(PRAXIS_QUICK_VIEW_PRESENTER, {
22104
22725
  optional: true,
22105
22726
  });
@@ -22118,6 +22739,12 @@ class ResourceQuickViewService {
22118
22739
  this._discovery ??= this.injector.get(ResourceDiscoveryService);
22119
22740
  return this._discovery;
22120
22741
  }
22742
+ get globalActions() {
22743
+ if (this._globalActions === undefined) {
22744
+ this._globalActions = this.injector.get(GlobalActionService, null);
22745
+ }
22746
+ return this._globalActions;
22747
+ }
22121
22748
  stateSubject = new BehaviorSubject('idle');
22122
22749
  resolutionSubject = new BehaviorSubject(null);
22123
22750
  inFlightByCompositeKey = new Map();
@@ -22129,6 +22756,7 @@ class ResourceQuickViewService {
22129
22756
  activeSession = null;
22130
22757
  activeSessionSubs = [];
22131
22758
  activeRequest = null;
22759
+ presentedRequest = null;
22132
22760
  pendingOpenTimer = null;
22133
22761
  pendingCloseTimer = null;
22134
22762
  pointerInsideCard = false;
@@ -22209,15 +22837,30 @@ class ResourceQuickViewService {
22209
22837
  notifyTriggerLeave(anchor) {
22210
22838
  if (anchor) {
22211
22839
  this.clearSuppressionForAnchor(anchor);
22840
+ if (this.activeRequest?.anchor &&
22841
+ !this.isSameTriggerAnchor(anchor, this.activeRequest.anchor)) {
22842
+ return;
22843
+ }
22212
22844
  }
22213
22845
  else if (this.activeRequest?.anchor) {
22214
22846
  this.clearSuppressionForAnchor(this.activeRequest.anchor);
22215
22847
  }
22216
22848
  if (this.stateSubject.value === 'pending-delay') {
22849
+ const closeDelayMs = (this.presentedRequest ?? this.activeRequest)?.hoverCloseDelayMs ??
22850
+ DEFAULT_HOVER_CLOSE_DELAY_MS;
22217
22851
  this.cancelPendingOpenTimer();
22218
22852
  this.activeGeneration += 1;
22219
- this.activeRequest = null;
22220
- this.stateSubject.next('idle');
22853
+ if (this.activeSession) {
22854
+ this.activeRequest = this.presentedRequest;
22855
+ this.stateSubject.next(this.resolutionSubject.value?.state ?? 'ready');
22856
+ if (!this.pointerInsideCard) {
22857
+ this.scheduleHoverClose(closeDelayMs);
22858
+ }
22859
+ }
22860
+ else {
22861
+ this.activeRequest = null;
22862
+ this.stateSubject.next('idle');
22863
+ }
22221
22864
  return;
22222
22865
  }
22223
22866
  if (this.activeSession &&
@@ -22226,6 +22869,12 @@ class ResourceQuickViewService {
22226
22869
  this.scheduleHoverClose(this.activeRequest.hoverCloseDelayMs ?? DEFAULT_HOVER_CLOSE_DELAY_MS);
22227
22870
  }
22228
22871
  }
22872
+ isSameTriggerAnchor(a, b) {
22873
+ if (a.kind === 'element' && b.kind === 'element') {
22874
+ return a.element === b.element;
22875
+ }
22876
+ return resolveQuickViewAnchorKey(a) === resolveQuickViewAnchorKey(b);
22877
+ }
22229
22878
  /**
22230
22879
  * Limpa a supressão de reabertura por `Escape` para uma âncora quando uma nova intenção começa.
22231
22880
  */
@@ -22244,7 +22893,7 @@ class ResourceQuickViewService {
22244
22893
  this.cancelPendingOpenTimer();
22245
22894
  this.clearCloseTimer();
22246
22895
  this.pointerInsideCard = false;
22247
- const priorRequest = this.activeRequest;
22896
+ const priorRequest = this.presentedRequest ?? this.activeRequest;
22248
22897
  const generationAtDismiss = this.activeGeneration;
22249
22898
  const durationMs = this.activeOpenStartedAt > 0
22250
22899
  ? Math.max(0, Date.now() - this.activeOpenStartedAt)
@@ -22261,6 +22910,7 @@ class ResourceQuickViewService {
22261
22910
  this.teardownSessionSubscriptions();
22262
22911
  this.activeSession = null;
22263
22912
  this.activeRequest = null;
22913
+ this.presentedRequest = null;
22264
22914
  this.resolutionSubject.next(null);
22265
22915
  this.stateSubject.next('dismissed');
22266
22916
  if (priorRequest) {
@@ -22307,13 +22957,15 @@ class ResourceQuickViewService {
22307
22957
  */
22308
22958
  async openDetailFromActivePreview() {
22309
22959
  const resolution = this.resolutionSubject.value;
22310
- const request = this.activeRequest;
22960
+ const request = this.presentedRequest ?? this.activeRequest;
22311
22961
  if (!resolution ||
22312
22962
  !request ||
22313
22963
  resolution.state !== 'ready' ||
22314
22964
  !resolution.ctaAvailable) {
22315
22965
  return false;
22316
22966
  }
22967
+ this.cancelPendingOpenTimer();
22968
+ this.clearCloseTimer();
22317
22969
  const generationAtClick = this.activeGeneration;
22318
22970
  const epochAtClick = this.contextEpoch;
22319
22971
  const focusOrigin = this.resolveFocusOrigin(request.anchor);
@@ -22331,11 +22983,7 @@ class ResourceQuickViewService {
22331
22983
  epochAtClick !== this.contextEpoch) {
22332
22984
  return false;
22333
22985
  }
22334
- this.dismiss('cta');
22335
- if (!this.globalActions) {
22336
- return false;
22337
- }
22338
- const result = await this.globalActions.executeRef({ actionId: 'surface.open', payload: revalidated.payload }, {
22986
+ const actionContext = {
22339
22987
  sourceId: request.sourceId ?? 'praxis-quick-view',
22340
22988
  output: 'quickViewOpenDetail',
22341
22989
  payload: revalidated.payload,
@@ -22348,7 +22996,17 @@ class ResourceQuickViewService {
22348
22996
  resourceId: resolution.resourceId,
22349
22997
  surfaceId: resolution.surfaceId,
22350
22998
  },
22351
- });
22999
+ };
23000
+ const readiness = typeof this.globalActions?.getReadiness === 'function'
23001
+ ? this.globalActions.getReadiness('surface.open', actionContext)
23002
+ : null;
23003
+ if (!this.globalActions || (readiness && !readiness.ready)) {
23004
+ const degraded = this.buildFailureResolution(resolution.binding, resolution.resourceId, 'SURFACE_UNAVAILABLE', this.translate('quickView.ctaUnavailable', 'O serviço de ações globais não está configurado para abrir o detalhe.'));
23005
+ this.applyResolution(degraded, request, generationAtClick);
23006
+ return false;
23007
+ }
23008
+ this.dismiss('cta');
23009
+ const result = await this.globalActions.executeRef({ actionId: 'surface.open', payload: revalidated.payload }, actionContext);
22352
23010
  return result ? result.success !== false : true;
22353
23011
  }
22354
23012
  catch (error) {
@@ -22459,13 +23117,36 @@ class ResourceQuickViewService {
22459
23117
  : {}),
22460
23118
  [binding.recordOpen.sourceIdentityField]: resourceId,
22461
23119
  };
22462
- let inFlightPromise;
22463
- inFlightPromise = firstValueFrom(this.recordOpenService.resolveReadProjection(binding.recordOpen, sourceRecord, {
23120
+ const effectivePreviewSurfaceId = binding.previewSurfaceId || binding.recordOpen.target.surfaceId;
23121
+ const hasDistinctPreviewSurface = effectivePreviewSurfaceId !== binding.recordOpen.target.surfaceId;
23122
+ const projectionRef = !hasDistinctPreviewSurface
23123
+ ? binding.recordOpen
23124
+ : {
23125
+ sourceIdentityField: binding.recordOpen.sourceIdentityField,
23126
+ target: {
23127
+ resourceKey: binding.recordOpen.target.resourceKey,
23128
+ surfaceId: effectivePreviewSurfaceId,
23129
+ },
23130
+ };
23131
+ const projectionOptions = {
22464
23132
  endpointKey: request.endpointKey,
22465
23133
  apiUrlEntry: request.apiUrlEntry,
22466
23134
  presentation: binding.detailPresentation,
22467
23135
  queryContext: request.queryContext,
22468
- })).finally(() => {
23136
+ };
23137
+ let inFlightPromise;
23138
+ inFlightPromise = firstValueFrom(this.recordOpenService.resolveReadProjection(projectionRef, sourceRecord, projectionOptions))
23139
+ .catch((error) => {
23140
+ if (hasDistinctPreviewSurface &&
23141
+ error instanceof ResourceRecordOpenError &&
23142
+ (error.code === 'TARGET_SURFACE_UNAVAILABLE' ||
23143
+ error.code === 'CONTEXTUAL_SURFACE_UNAVAILABLE' ||
23144
+ error.code === 'PROJECTION_READ_FAILED')) {
23145
+ return firstValueFrom(this.recordOpenService.resolveReadProjection(binding.recordOpen, sourceRecord, projectionOptions));
23146
+ }
23147
+ throw error;
23148
+ })
23149
+ .finally(() => {
22469
23150
  if (this.inFlightByCompositeKey.get(compositeKey) === inFlightPromise) {
22470
23151
  this.inFlightByCompositeKey.delete(compositeKey);
22471
23152
  }
@@ -22475,11 +23156,17 @@ class ResourceQuickViewService {
22475
23156
  }
22476
23157
  buildReadyOrEmptyResolution(binding, projection) {
22477
23158
  const sanitizedRecord = this.filterRecordByVisibleSchemaFields(projection.record, projection.fields, binding.recordOpen.sourceIdentityField);
22478
- const summaryItems = this.buildSummaryItems(projection.identity, sanitizedRecord, projection.fields);
22479
- const hasIdentityContent = Boolean(projection.identity?.title?.value ||
22480
- projection.identity?.displayLabel ||
22481
- projection.identity?.key?.value ||
23159
+ const sanitizedIdentity = this.sanitizeIdentity(projection.identity, sanitizedRecord, projection.fields);
23160
+ const summaryItems = this.buildSummaryItems(sanitizedIdentity, sanitizedRecord, projection.fields);
23161
+ const hasIdentityContent = Boolean(sanitizedIdentity?.title?.value ||
23162
+ sanitizedIdentity?.displayLabel ||
23163
+ sanitizedIdentity?.key?.value ||
22482
23164
  summaryItems.length > 0);
23165
+ const resolvedIcon = this.extractResourceIcon(projection);
23166
+ const identitySubtitle = String(sanitizedIdentity?.subtitle?.value ?? '').trim() || null;
23167
+ const emptyFallbackSubtitle = identitySubtitle || (projection.surface.description ?? null);
23168
+ const resolvedAvatarUrl = this.sanitizeAvatarUrl(sanitizedIdentity?.avatar?.value);
23169
+ const ctaAvailable = this.resolveTargetCtaAvailability(binding, projection);
22483
23170
  if (!hasIdentityContent && !binding.contentRef) {
22484
23171
  return {
22485
23172
  state: 'empty',
@@ -22489,20 +23176,22 @@ class ResourceQuickViewService {
22489
23176
  surfaceId: binding.recordOpen.target.surfaceId,
22490
23177
  resourceId: projection.resourceId,
22491
23178
  title: projection.surface.title || binding.recordOpen.target.resourceKey,
22492
- subtitle: projection.surface.description ?? null,
23179
+ subtitle: emptyFallbackSubtitle,
23180
+ ...(resolvedAvatarUrl ? { avatarUrl: resolvedAvatarUrl } : {}),
23181
+ icon: resolvedIcon,
22493
23182
  surface: projection.surface,
22494
23183
  record: sanitizedRecord,
22495
23184
  fields: projection.fields,
22496
- identity: projection.identity,
23185
+ identity: sanitizedIdentity,
22497
23186
  summaryItems: [],
22498
- ctaAvailable: Boolean(projection.surface.availability?.allowed),
23187
+ ctaAvailable,
22499
23188
  ctaLabel: this.translate('quickView.openDetail', 'Abrir detalhe'),
22500
23189
  failureCode: 'IDENTITY_UNRESOLVED',
22501
23190
  failureReason: this.translate('quickView.emptySummary', 'Nenhum atributo resumido está disponível para este registro.'),
22502
23191
  };
22503
23192
  }
22504
- const resolvedTitle = String(projection.identity?.title?.value ??
22505
- projection.identity?.displayLabel ??
23193
+ const resolvedTitle = String(sanitizedIdentity?.title?.value ??
23194
+ sanitizedIdentity?.displayLabel ??
22506
23195
  projection.surface.title ??
22507
23196
  binding.recordOpen.target.resourceKey).trim() || binding.recordOpen.target.resourceKey;
22508
23197
  return {
@@ -22513,16 +23202,159 @@ class ResourceQuickViewService {
22513
23202
  surfaceId: binding.recordOpen.target.surfaceId,
22514
23203
  resourceId: projection.resourceId,
22515
23204
  title: resolvedTitle,
22516
- subtitle: projection.surface.description ?? null,
23205
+ subtitle: identitySubtitle,
23206
+ ...(resolvedAvatarUrl ? { avatarUrl: resolvedAvatarUrl } : {}),
23207
+ icon: resolvedIcon,
22517
23208
  surface: projection.surface,
22518
23209
  record: sanitizedRecord,
22519
23210
  fields: projection.fields,
22520
- identity: projection.identity,
23211
+ identity: sanitizedIdentity,
22521
23212
  summaryItems,
22522
- ctaAvailable: Boolean(projection.surface.availability?.allowed),
23213
+ ctaAvailable,
22523
23214
  ctaLabel: this.translate('quickView.openDetail', 'Abrir detalhe'),
22524
23215
  };
22525
23216
  }
23217
+ /**
23218
+ * Sanitiza `MaterializedResourceIdentity` contra os campos visíveis (`!field.hidden`) e
23219
+ * as políticas de acesso (`evaluateFieldAccess`) do schema filtrado da surface, garantindo
23220
+ * que `title`, `subtitle`, `avatar`, `key`, `metadata` e `displayLabel` nunca vazem dados
23221
+ * ocultos ou restritos por LGPD/governança no cabeçalho ou no contexto de rich-content.
23222
+ */
23223
+ sanitizeIdentity(identity, sanitizedRecord, fields) {
23224
+ if (!identity) {
23225
+ return null;
23226
+ }
23227
+ if (!Array.isArray(fields) || fields.length === 0) {
23228
+ return identity;
23229
+ }
23230
+ const fieldMap = new Map(fields.map((field) => [field.name, field]));
23231
+ const activeAuthorities = this.resolveActiveAuthorities();
23232
+ const isFieldHidden = (fieldName) => {
23233
+ const fieldDef = fieldMap.get(fieldName);
23234
+ if (fieldDef?.hidden) {
23235
+ return true;
23236
+ }
23237
+ return !Object.prototype.hasOwnProperty.call(sanitizedRecord, fieldName);
23238
+ };
23239
+ const isFieldRestricted = (fieldName) => {
23240
+ const fieldDef = fieldMap.get(fieldName);
23241
+ if (!fieldDef?.fieldAccess) {
23242
+ return false;
23243
+ }
23244
+ const access = evaluateFieldAccess(fieldDef, {
23245
+ authorities: activeAuthorities,
23246
+ });
23247
+ return access.evaluated && !access.visible;
23248
+ };
23249
+ const sanitizePart = (part, options) => {
23250
+ if (!part?.field) {
23251
+ return undefined;
23252
+ }
23253
+ if (isFieldHidden(part.field)) {
23254
+ return undefined;
23255
+ }
23256
+ if (isFieldRestricted(part.field)) {
23257
+ if (options?.omitWhenRestricted) {
23258
+ return undefined;
23259
+ }
23260
+ return {
23261
+ ...part,
23262
+ value: sanitizedRecord[part.field] ?? '••••••',
23263
+ };
23264
+ }
23265
+ return {
23266
+ ...part,
23267
+ value: sanitizedRecord[part.field] ?? part.value,
23268
+ };
23269
+ };
23270
+ const key = sanitizePart(identity.key);
23271
+ const title = sanitizePart(identity.title);
23272
+ const subtitle = sanitizePart(identity.subtitle);
23273
+ const avatar = sanitizePart(identity.avatar, { omitWhenRestricted: true });
23274
+ const metadata = (identity.metadata ?? [])
23275
+ .map((part) => sanitizePart(part))
23276
+ .filter((part) => Boolean(part));
23277
+ let displayLabel = identity.displayLabel;
23278
+ if (identity.title?.field &&
23279
+ (isFieldHidden(identity.title.field) ||
23280
+ isFieldRestricted(identity.title.field))) {
23281
+ displayLabel =
23282
+ title?.value !== undefined && title?.value !== null
23283
+ ? String(title.value)
23284
+ : key?.value !== undefined && key?.value !== null
23285
+ ? String(key.value)
23286
+ : undefined;
23287
+ }
23288
+ const sanitized = {
23289
+ metadata,
23290
+ ...(identity.source ? { source: identity.source } : {}),
23291
+ ...(identity.diagnostics ? { diagnostics: identity.diagnostics } : {}),
23292
+ };
23293
+ if (key)
23294
+ sanitized.key = key;
23295
+ if (title)
23296
+ sanitized.title = title;
23297
+ if (subtitle)
23298
+ sanitized.subtitle = subtitle;
23299
+ if (avatar)
23300
+ sanitized.avatar = avatar;
23301
+ if (displayLabel)
23302
+ sanitized.displayLabel = displayLabel;
23303
+ return sanitized;
23304
+ }
23305
+ resolveTargetCtaAvailability(binding, projection) {
23306
+ const targetSurfaceId = binding.recordOpen.target.surfaceId;
23307
+ if (binding.previewSurfaceId &&
23308
+ binding.previewSurfaceId !== targetSurfaceId &&
23309
+ Array.isArray(projection.contextualSurfaces)) {
23310
+ const targetSurface = projection.contextualSurfaces.find((surface) => surface.id === targetSurfaceId &&
23311
+ (!surface.scope || surface.scope === 'ITEM'));
23312
+ if (!targetSurface) {
23313
+ return false;
23314
+ }
23315
+ return Boolean(targetSurface.availability?.allowed);
23316
+ }
23317
+ return Boolean(projection.surface.availability?.allowed);
23318
+ }
23319
+ sanitizeAvatarUrl(rawValue) {
23320
+ if (typeof rawValue !== 'string') {
23321
+ return null;
23322
+ }
23323
+ const candidate = rawValue.trim();
23324
+ if (!candidate) {
23325
+ return null;
23326
+ }
23327
+ if (candidate.startsWith('https://') ||
23328
+ candidate.startsWith('http://') ||
23329
+ (candidate.startsWith('/') && !candidate.startsWith('//'))) {
23330
+ return candidate;
23331
+ }
23332
+ return null;
23333
+ }
23334
+ extractResourceIcon(projection) {
23335
+ const rawXUi = projection.rawSchema &&
23336
+ typeof projection.rawSchema['x-ui'] === 'object' &&
23337
+ !Array.isArray(projection.rawSchema['x-ui'])
23338
+ ? projection.rawSchema['x-ui']
23339
+ : null;
23340
+ const rawResource = rawXUi &&
23341
+ typeof rawXUi['resource'] === 'object' &&
23342
+ !Array.isArray(rawXUi['resource'])
23343
+ ? rawXUi['resource']
23344
+ : null;
23345
+ const candidates = [
23346
+ projection.surface?.icon,
23347
+ rawResource?.['icon'],
23348
+ rawXUi?.['icon'],
23349
+ projection.payload?.icon,
23350
+ ];
23351
+ for (const candidate of candidates) {
23352
+ if (typeof candidate === 'string' && candidate.trim().length > 0) {
23353
+ return candidate.trim();
23354
+ }
23355
+ }
23356
+ return null;
23357
+ }
22526
23358
  /**
22527
23359
  * Filtra o objeto de leitura contra os campos visíveis (`!field.hidden`) declarados no
22528
23360
  * schema filtrado da surface, evitando que propriedades brutas omitidas ou ocultas
@@ -22536,9 +23368,19 @@ class ResourceQuickViewService {
22536
23368
  return { ...record };
22537
23369
  }
22538
23370
  const allowedFieldNames = new Set();
23371
+ const restrictedUnmaskedFields = new Set();
23372
+ const activeAuthorities = this.resolveActiveAuthorities();
22539
23373
  for (const field of fields) {
22540
23374
  if (field?.name && !field.hidden) {
22541
23375
  allowedFieldNames.add(field.name);
23376
+ if (field.fieldAccess) {
23377
+ const access = evaluateFieldAccess(field, {
23378
+ authorities: activeAuthorities,
23379
+ });
23380
+ if (access.evaluated && !access.visible) {
23381
+ restrictedUnmaskedFields.add(field.name);
23382
+ }
23383
+ }
22542
23384
  }
22543
23385
  }
22544
23386
  if (sourceIdentityField) {
@@ -22547,12 +23389,20 @@ class ResourceQuickViewService {
22547
23389
  const sanitized = {};
22548
23390
  for (const [key, value] of Object.entries(record)) {
22549
23391
  if (allowedFieldNames.has(key)) {
22550
- sanitized[key] = value;
23392
+ if (restrictedUnmaskedFields.has(key) &&
23393
+ value !== null &&
23394
+ value !== undefined &&
23395
+ !this.isMaskedValueToken(String(value))) {
23396
+ sanitized[key] = '••••••';
23397
+ }
23398
+ else {
23399
+ sanitized[key] = value;
23400
+ }
22551
23401
  }
22552
23402
  }
22553
23403
  return sanitized;
22554
23404
  }
22555
- buildSummaryItems(identity, _record, fields) {
23405
+ buildSummaryItems(identity, record, fields) {
22556
23406
  const fieldMap = new Map(fields.map((field) => [field.name, field]));
22557
23407
  const items = [];
22558
23408
  const seenFields = new Set();
@@ -22562,6 +23412,12 @@ class ResourceQuickViewService {
22562
23412
  if (identity?.title?.field) {
22563
23413
  seenFields.add(identity.title.field);
22564
23414
  }
23415
+ if (identity?.subtitle?.field) {
23416
+ seenFields.add(identity.subtitle.field);
23417
+ }
23418
+ if (identity?.avatar?.field) {
23419
+ seenFields.add(identity.avatar.field);
23420
+ }
22565
23421
  for (const metaPart of identity?.metadata ?? []) {
22566
23422
  if (seenFields.has(metaPart.field)) {
22567
23423
  continue;
@@ -22571,21 +23427,87 @@ class ResourceQuickViewService {
22571
23427
  continue;
22572
23428
  }
22573
23429
  seenFields.add(metaPart.field);
22574
- items.push({
22575
- field: metaPart.field,
22576
- label: metaPart.label || fieldDef?.label || metaPart.field,
22577
- value: metaPart.value,
22578
- formattedValue: this.formatSummaryValue(metaPart.value, fieldDef),
22579
- presentation: metaPart.presentation ?? fieldDef?.presentation,
22580
- copyable: true,
22581
- });
23430
+ items.push(this.createSummaryItem(metaPart.field, metaPart.label || fieldDef?.label || metaPart.field, metaPart.value, fieldDef, metaPart.presentation ?? fieldDef?.presentation));
23431
+ }
23432
+ const curatedFields = fields
23433
+ .filter((field) => field?.name &&
23434
+ field.quickViewVisible === true &&
23435
+ !field.hidden &&
23436
+ !seenFields.has(field.name))
23437
+ .sort((a, b) => {
23438
+ const orderA = a.quickViewOrder && a.quickViewOrder > 0
23439
+ ? a.quickViewOrder
23440
+ : (a.order ?? Number.MAX_SAFE_INTEGER);
23441
+ const orderB = b.quickViewOrder && b.quickViewOrder > 0
23442
+ ? b.quickViewOrder
23443
+ : (b.order ?? Number.MAX_SAFE_INTEGER);
23444
+ return orderA - orderB;
23445
+ });
23446
+ for (const fieldDef of curatedFields) {
23447
+ const rawValue = record[fieldDef.name];
23448
+ if (rawValue === null ||
23449
+ rawValue === undefined ||
23450
+ String(rawValue).trim().length === 0) {
23451
+ continue;
23452
+ }
23453
+ seenFields.add(fieldDef.name);
23454
+ items.push(this.createSummaryItem(fieldDef.name, fieldDef.label || fieldDef.name, rawValue, fieldDef, fieldDef.presentation));
22582
23455
  }
22583
23456
  return items;
22584
23457
  }
23458
+ createSummaryItem(field, label, rawValue, fieldDef, presentation) {
23459
+ const activeAuthorities = this.resolveActiveAuthorities();
23460
+ const access = fieldDef?.fieldAccess
23461
+ ? evaluateFieldAccess(fieldDef, { authorities: activeAuthorities })
23462
+ : { evaluated: false, visible: true, editable: true };
23463
+ const deniedByAuthority = access.evaluated && !access.visible;
23464
+ const rawFormatted = this.formatSummaryValue(rawValue, fieldDef);
23465
+ const hasMaskedToken = this.isMaskedValueToken(String(rawValue ?? '')) ||
23466
+ this.isMaskedValueToken(rawFormatted);
23467
+ const isMasked = deniedByAuthority || hasMaskedToken;
23468
+ const formattedValue = deniedByAuthority && !hasMaskedToken ? '••••••' : rawFormatted;
23469
+ const maskReason = isMasked
23470
+ ? fieldDef?.fieldAccess?.reason ||
23471
+ access.reason ||
23472
+ this.translate('quickView.maskedFieldReason', 'Dado protegido por política de governança / LGPD')
23473
+ : undefined;
23474
+ return {
23475
+ field,
23476
+ label,
23477
+ value: deniedByAuthority && !hasMaskedToken ? '••••••' : rawValue,
23478
+ formattedValue,
23479
+ presentation,
23480
+ copyable: !isMasked,
23481
+ ...(isMasked ? { masked: true } : {}),
23482
+ ...(maskReason ? { maskReason } : {}),
23483
+ };
23484
+ }
23485
+ isMaskedValueToken(text) {
23486
+ const candidate = text.trim();
23487
+ if (!candidate) {
23488
+ return false;
23489
+ }
23490
+ return (/\*{2,}|•{2,}|■{2,}|█{2,}/.test(candidate) ||
23491
+ /^\[?\s*(MASKED|REDACTED|PROTEGIDO|OCULTO|ANONIMIZADO)\s*\]?$/i.test(candidate));
23492
+ }
23493
+ resolveActiveAuthorities() {
23494
+ const snapshot = this.runtimeContext?.snapshot;
23495
+ if (snapshot?.state === 'ready' && snapshot.effectiveContext) {
23496
+ return snapshot.effectiveContext.authorities ?? [];
23497
+ }
23498
+ return null;
23499
+ }
22585
23500
  formatSummaryValue(rawValue, fieldDef) {
22586
23501
  if (rawValue === null || rawValue === undefined) {
22587
23502
  return '';
22588
23503
  }
23504
+ if (Array.isArray(rawValue)) {
23505
+ const formattedElements = rawValue
23506
+ .filter((item) => item !== null && item !== undefined)
23507
+ .map((item) => this.formatSummaryValue(item, fieldDef).trim())
23508
+ .filter((text) => text.length > 0);
23509
+ return formattedElements.join(', ');
23510
+ }
22589
23511
  const presentation = fieldDef?.presentation;
22590
23512
  if (typeof rawValue === 'boolean') {
22591
23513
  const boolLabel = rawValue
@@ -22594,15 +23516,99 @@ class ResourceQuickViewService {
22594
23516
  if (boolLabel) {
22595
23517
  return boolLabel;
22596
23518
  }
23519
+ return rawValue
23520
+ ? this.translate('quickView.booleanTrue', 'Sim')
23521
+ : this.translate('quickView.booleanFalse', 'Não');
22597
23522
  }
22598
23523
  const rawKey = String(rawValue);
22599
23524
  const matchedOption = fieldDef?.options?.find((opt) => String(opt.key ?? opt.value) === rawKey);
22600
- const mapped = matchedOption
22601
- ? String(matchedOption.label ?? matchedOption.value ?? rawKey)
22602
- : presentation?.label || rawKey;
23525
+ if (matchedOption) {
23526
+ const mappedOpt = String(matchedOption.label ?? matchedOption.value ?? rawKey);
23527
+ const prefix = presentation?.prefix ?? '';
23528
+ const suffix = presentation?.suffix ?? '';
23529
+ return `${prefix}${mappedOpt}${suffix}`;
23530
+ }
23531
+ if (presentation?.label) {
23532
+ const prefix = presentation.prefix ?? '';
23533
+ const suffix = presentation.suffix ?? '';
23534
+ return `${prefix}${presentation.label}${suffix}`;
23535
+ }
23536
+ const isCurrencyField = fieldDef?.numericFormat ===
23537
+ 'currency' ||
23538
+ fieldDef?.controlType === 'currency' ||
23539
+ fieldDef?.valuePresentation?.type === 'currency';
23540
+ if (typeof rawValue === 'number' &&
23541
+ Number.isFinite(rawValue) &&
23542
+ isCurrencyField &&
23543
+ !presentation?.prefix) {
23544
+ const rawField = (fieldDef ?? {});
23545
+ const currencyConfig = fieldDef?.valuePresentation?.currency &&
23546
+ typeof fieldDef.valuePresentation.currency === 'object'
23547
+ ? fieldDef.valuePresentation.currency
23548
+ : undefined;
23549
+ const locale = String(rawField['locale'] ??
23550
+ currencyConfig?.['locale'] ??
23551
+ this.runtimeContext?.effectiveContext?.locale ??
23552
+ this.i18n?.getLocale?.() ??
23553
+ 'pt-BR').trim() || 'pt-BR';
23554
+ const currency = String(rawField['currency'] ??
23555
+ rawField['currencyCode'] ??
23556
+ currencyConfig?.['currencyCode'] ??
23557
+ currencyConfig?.['currency'] ??
23558
+ 'BRL').trim() || 'BRL';
23559
+ try {
23560
+ return new Intl.NumberFormat(locale, {
23561
+ style: 'currency',
23562
+ currency,
23563
+ }).format(rawValue);
23564
+ }
23565
+ catch { }
23566
+ }
23567
+ if (typeof rawValue === 'string') {
23568
+ const isoDateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(rawKey);
23569
+ if (isoDateMatch) {
23570
+ return `${isoDateMatch[3]}/${isoDateMatch[2]}/${isoDateMatch[1]}`;
23571
+ }
23572
+ const rawField = (fieldDef ?? {});
23573
+ const configuredTimeZone = String(rawField['timeZone'] ??
23574
+ rawField['timezone'] ??
23575
+ this.runtimeContext?.effectiveContext?.timezone ??
23576
+ '').trim();
23577
+ const hasExplicitOffset = /(?:Z|[+-]\d{2}:?\d{2})$/i.test(rawKey);
23578
+ if (configuredTimeZone && hasExplicitOffset) {
23579
+ const parsedDate = new Date(rawKey);
23580
+ if (!Number.isNaN(parsedDate.getTime())) {
23581
+ try {
23582
+ const parts = new Intl.DateTimeFormat('en-GB', {
23583
+ timeZone: configuredTimeZone,
23584
+ year: 'numeric',
23585
+ month: '2-digit',
23586
+ day: '2-digit',
23587
+ hour: '2-digit',
23588
+ minute: '2-digit',
23589
+ hour12: false,
23590
+ }).formatToParts(parsedDate);
23591
+ const partMap = new Map(parts.map((p) => [p.type, p.value]));
23592
+ const day = partMap.get('day');
23593
+ const month = partMap.get('month');
23594
+ const year = partMap.get('year');
23595
+ const hour = partMap.get('hour');
23596
+ const minute = partMap.get('minute');
23597
+ if (day && month && year && hour && minute) {
23598
+ return `${day}/${month}/${year} ${hour === '24' ? '00' : hour}:${minute}`;
23599
+ }
23600
+ }
23601
+ catch { }
23602
+ }
23603
+ }
23604
+ const isoDateTimeMatch = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(rawKey);
23605
+ if (isoDateTimeMatch) {
23606
+ return `${isoDateTimeMatch[3]}/${isoDateTimeMatch[2]}/${isoDateTimeMatch[1]} ${isoDateTimeMatch[4]}:${isoDateTimeMatch[5]}`;
23607
+ }
23608
+ }
22603
23609
  const prefix = presentation?.prefix ?? '';
22604
23610
  const suffix = presentation?.suffix ?? '';
22605
- return `${prefix}${mapped}${suffix}`;
23611
+ return `${prefix}${rawKey}${suffix}`;
22606
23612
  }
22607
23613
  applyResolution(resolution, request, generation) {
22608
23614
  if (generation !== this.activeGeneration) {
@@ -22613,11 +23619,15 @@ class ResourceQuickViewService {
22613
23619
  if (!this.presenter) {
22614
23620
  return;
22615
23621
  }
22616
- if (this.activeSession) {
23622
+ if (this.activeSession &&
23623
+ this.presentedRequest &&
23624
+ this.isSameTriggerAnchor(this.presentedRequest.anchor, request.anchor)) {
23625
+ this.presentedRequest = request;
22617
23626
  this.activeSession.update(resolution);
22618
23627
  return;
22619
23628
  }
22620
23629
  this.teardownSessionSubscriptions();
23630
+ this.presentedRequest = request;
22621
23631
  const session = this.presenter.present({
22622
23632
  anchor: request.anchor,
22623
23633
  trigger: request.trigger,
@@ -22639,12 +23649,14 @@ class ResourceQuickViewService {
22639
23649
  this.clearCloseTimer();
22640
23650
  }), session.pointerLeftCard$.subscribe(() => {
22641
23651
  this.pointerInsideCard = false;
22642
- if (this.activeRequest?.trigger === 'hover') {
22643
- this.scheduleHoverClose(this.activeRequest.hoverCloseDelayMs ?? DEFAULT_HOVER_CLOSE_DELAY_MS);
23652
+ const currentReq = this.presentedRequest ?? this.activeRequest;
23653
+ if (currentReq?.trigger === 'hover') {
23654
+ this.scheduleHoverClose(currentReq.hoverCloseDelayMs ?? DEFAULT_HOVER_CLOSE_DELAY_MS);
22644
23655
  }
22645
23656
  }), session.closed$.subscribe((reason) => {
22646
23657
  if (this.activeSession === session) {
22647
23658
  this.activeSession = null;
23659
+ this.presentedRequest = null;
22648
23660
  this.teardownSessionSubscriptions();
22649
23661
  if (this.stateSubject.value !== 'dismissed') {
22650
23662
  this.dismiss(reason);
@@ -22779,9 +23791,16 @@ class ResourceQuickViewService {
22779
23791
  }
22780
23792
  let current = target;
22781
23793
  for (const segment of segments) {
23794
+ if (Array.isArray(current)) {
23795
+ const index = Number(segment);
23796
+ if (!Number.isInteger(index) || index < 0 || index >= current.length) {
23797
+ return { found: false, value: undefined };
23798
+ }
23799
+ current = current[index];
23800
+ continue;
23801
+ }
22782
23802
  if (!current ||
22783
23803
  typeof current !== 'object' ||
22784
- Array.isArray(current) ||
22785
23804
  !Object.prototype.hasOwnProperty.call(current, segment)) {
22786
23805
  return { found: false, value: undefined };
22787
23806
  }
@@ -22803,13 +23822,14 @@ class ResourceQuickViewService {
22803
23822
  const presetKey = binding.contentRef
22804
23823
  ? `${binding.contentRef.namespace}:${binding.contentRef.presetId}@${binding.contentRef.version}`
22805
23824
  : 'default-identity';
23825
+ const effectivePreviewSurfaceId = binding.previewSurfaceId || binding.recordOpen.target.surfaceId;
22806
23826
  return [
22807
23827
  `epoch:${this.contextEpoch}`,
22808
23828
  `api:${request.endpointKey ?? 'default'}:${apiSignature}`,
22809
23829
  `ctx:${contextSignature}`,
22810
23830
  `loc:${locale}`,
22811
23831
  `res:${binding.recordOpen.target.resourceKey}`,
22812
- `surf:${binding.recordOpen.target.surfaceId}`,
23832
+ `surf:${effectivePreviewSurfaceId}`,
22813
23833
  `id:${typeof resourceId}:${String(resourceId)}`,
22814
23834
  `q:${queryHash}`,
22815
23835
  `preset:${presetKey}`,
@@ -22818,7 +23838,9 @@ class ResourceQuickViewService {
22818
23838
  buildSuppressionTriggerKey(request) {
22819
23839
  const anchorKey = resolveQuickViewAnchorKey(request.anchor);
22820
23840
  const resourceKey = request.binding?.recordOpen?.target?.resourceKey ?? '';
22821
- const surfaceId = request.binding?.recordOpen?.target?.surfaceId ?? '';
23841
+ const surfaceId = request.binding?.previewSurfaceId ||
23842
+ request.binding?.recordOpen?.target?.surfaceId ||
23843
+ '';
22822
23844
  const sourceField = request.binding?.recordOpen?.sourceIdentityField ?? '';
22823
23845
  const recordId = this.extractExactSourceId(request.sourceRecord, sourceField);
22824
23846
  if (!anchorKey || !resourceKey || !surfaceId || recordId === null) {
@@ -22832,12 +23854,18 @@ class ResourceQuickViewService {
22832
23854
  return 'unconfirmed';
22833
23855
  }
22834
23856
  const eff = snapshot.effectiveContext;
23857
+ const authorities = Array.isArray(eff.authorities)
23858
+ ? [...eff.authorities].sort().join(',')
23859
+ : '';
22835
23860
  return [
22836
23861
  eff.contextVersion ?? '',
22837
23862
  eff.activeTenant?.tenantId ?? '',
23863
+ eff.activeOrganizationId ?? '',
22838
23864
  snapshot.user?.userId ?? '',
22839
23865
  eff.activeProfileId ?? '',
22840
23866
  eff.locale ?? '',
23867
+ eff.timezone ?? '',
23868
+ authorities,
22841
23869
  ].join('|');
22842
23870
  }
22843
23871
  invalidateContextEpoch() {
@@ -26208,29 +27236,34 @@ async function parseJsonResponseOrEmpty(res, context = 'response') {
26208
27236
  throw e;
26209
27237
  }
26210
27238
  }
26211
- async function fetchWithETag(params) {
26212
- const headers = { Accept: 'application/json' };
26213
- if (params.schemaHash)
26214
- headers['If-None-Match'] = `"${params.schemaHash}"`;
26215
- if (params.tenant)
26216
- headers['X-Tenant'] = params.tenant;
26217
- if (params.locale)
26218
- headers['Accept-Language'] = params.locale;
26219
- // Allow host apps to provide additional headers (e.g., Authorization) without coupling
26220
- try {
26221
- const extra = globalThis?.PAX_FETCH_HEADERS?.();
26222
- if (extra && typeof extra === 'object') {
26223
- for (const [k, v] of Object.entries(extra)) {
26224
- const key = String(k);
26225
- const val = Array.isArray(v) ? String(v[0]) : String(v);
26226
- if (val && !headers[key])
26227
- headers[key] = val;
26228
- }
27239
+ /** Capture host context before any cache/transport await. Not part of the root API. */
27240
+ function captureSchemaFetchHeaders(params) {
27241
+ const headers = { accept: 'application/json' };
27242
+ const extra = globalThis.PAX_FETCH_HEADERS?.();
27243
+ if (extra && typeof extra === 'object') {
27244
+ for (const [key, value] of Object.entries(extra)) {
27245
+ const normalized = Array.isArray(value) ? String(value[0] ?? '') : String(value ?? '');
27246
+ if (normalized)
27247
+ headers[key.toLowerCase()] = normalized;
26229
27248
  }
26230
27249
  }
26231
- catch {
26232
- // ignore header hook errors
27250
+ headers['accept'] = 'application/json';
27251
+ // Declared context wins case-insensitively. Tenant aliases must not contradict it.
27252
+ if (params.tenant)
27253
+ headers['x-tenant'] = params.tenant;
27254
+ if (params.locale)
27255
+ headers['accept-language'] = params.locale;
27256
+ if (headers['x-tenant'] && headers['x-tenant-id'] && headers['x-tenant'] !== headers['x-tenant-id']) {
27257
+ throw new Error('Conflicting tenant headers for schema request.');
26233
27258
  }
27259
+ delete headers['if-none-match'];
27260
+ return Object.freeze(headers);
27261
+ }
27262
+ /** Internal transport entry point for retries bound to one captured context. */
27263
+ async function fetchSchemaWithCapturedHeaders(params, capturedHeaders) {
27264
+ const headers = { ...capturedHeaders };
27265
+ if (params.schemaHash)
27266
+ headers['If-None-Match'] = `"${params.schemaHash}"`;
26234
27267
  const res = await fetch(params.url, {
26235
27268
  headers,
26236
27269
  cache: 'no-cache',
@@ -26242,7 +27275,7 @@ async function fetchWithETag(params) {
26242
27275
  if (!res.ok) {
26243
27276
  const raw = await res.text().catch(() => '');
26244
27277
  const bodyHint = raw?.trim() ? `: ${raw.trim().slice(0, 240)}` : '';
26245
- throw new Error(`fetchWithETag failed (${res.status} ${res.statusText || 'HTTP error'})${bodyHint}`);
27278
+ throw Object.assign(new Error(`fetchWithETag failed (${res.status} ${res.statusText || 'HTTP error'})${bodyHint}`), { status: res.status });
26246
27279
  }
26247
27280
  const etag = res.headers.get('ETag') || '';
26248
27281
  const newHash = etag.replace(/^W\//, '').replace(/^\"|\"$/g, '');
@@ -26321,14 +27354,21 @@ class SchemaMetadataClient {
26321
27354
  if (params.readOnly !== undefined) {
26322
27355
  u.searchParams.set('readOnly', String(params.readOnly));
26323
27356
  }
26324
- let request = this.inFlight.get(schemaId);
27357
+ // schemaId remains the backend's semantic identity. Transport/cache entries
27358
+ // also bind the actual URL and declared representation context.
27359
+ const capturedHeaders = captureSchemaFetchHeaders(params);
27360
+ const requestKey = scopeSchemaRequestKey(buildSchemaRequestKey(schemaId, u.toString(), {
27361
+ tenant: capturedHeaders['x-tenant'] ?? capturedHeaders['x-tenant-id'],
27362
+ locale: capturedHeaders['accept-language'],
27363
+ }), Object.entries(capturedHeaders).map(([name, value]) => [name, [value]]));
27364
+ let request = this.inFlight.get(requestKey);
26325
27365
  if (!request || request.controller.signal.aborted) {
26326
- request = this.startRequest(schemaId, u.toString(), params);
26327
- this.inFlight.set(schemaId, request);
27366
+ request = this.startRequest(requestKey, u.toString(), { ...params }, capturedHeaders);
27367
+ this.inFlight.set(requestKey, request);
26328
27368
  }
26329
27369
  return this.subscribe(request, params.signal);
26330
27370
  }
26331
- startRequest(schemaId, url, params) {
27371
+ startRequest(requestKey, url, params, capturedHeaders) {
26332
27372
  const controller = new AbortController();
26333
27373
  const request = {
26334
27374
  controller, consumers: 0, settled: false, promise: Promise.resolve({ schema: {}, schemaHash: '' }),
@@ -26342,15 +27382,15 @@ class SchemaMetadataClient {
26342
27382
  timer = setTimeout(() => controller.abort(new DOMException('Schema request deadline exceeded.', 'TimeoutError')), this.requestTimeoutMs);
26343
27383
  }
26344
27384
  // Observe late resolution/rejection even when the transport ignores AbortSignal.
26345
- this.readSchema(schemaId, url, params, controller.signal).then(resolve, reject);
27385
+ this.readSchema(requestKey, url, params, controller.signal, capturedHeaders).then(resolve, reject);
26346
27386
  });
26347
27387
  request.promise = bounded.finally(() => {
26348
27388
  request.settled = true;
26349
27389
  controller.signal.removeEventListener('abort', onAbort);
26350
27390
  if (timer !== undefined)
26351
27391
  clearTimeout(timer);
26352
- if (this.inFlight.get(schemaId) === request)
26353
- this.inFlight.delete(schemaId);
27392
+ if (this.inFlight.get(requestKey) === request)
27393
+ this.inFlight.delete(requestKey);
26354
27394
  });
26355
27395
  return request;
26356
27396
  }
@@ -26375,17 +27415,17 @@ class SchemaMetadataClient {
26375
27415
  onAbort();
26376
27416
  });
26377
27417
  }
26378
- async readSchema(schemaId, url, params, signal) {
26379
- const cached = await this.cache.get(schemaId);
27418
+ async readSchema(requestKey, url, params, signal, capturedHeaders) {
27419
+ const cached = await this.cache.get(requestKey);
26380
27420
  signal.throwIfAborted();
26381
27421
  const request = { url, tenant: params.tenant, locale: params.locale, signal };
26382
- let response = await fetchWithETag({ ...request, schemaHash: cached?.schemaHash });
27422
+ let response = await fetchSchemaWithCapturedHeaders({ ...request, schemaHash: cached?.schemaHash }, capturedHeaders);
26383
27423
  signal.throwIfAborted();
26384
27424
  if (response.status === 304) {
26385
27425
  if (cached)
26386
27426
  return cached;
26387
27427
  // Preserve credentials, tenant, locale and host headers when retrying without an ETag.
26388
- response = await fetchWithETag(request);
27428
+ response = await fetchSchemaWithCapturedHeaders(request, capturedHeaders);
26389
27429
  signal.throwIfAborted();
26390
27430
  if (response.status === 304)
26391
27431
  throw new Error('SchemaMetadataClient received 304 without a cached schema.');
@@ -26393,7 +27433,7 @@ class SchemaMetadataClient {
26393
27433
  const entry = { schema: response.schema, schemaHash: response.schemaHash };
26394
27434
  // A response arriving after timeout/cancellation must never start a cache write.
26395
27435
  signal.throwIfAborted();
26396
- await this.cache.set(schemaId, entry);
27436
+ await this.cache.set(requestKey, entry);
26397
27437
  signal.throwIfAborted();
26398
27438
  return entry;
26399
27439
  }
@@ -28587,6 +29627,14 @@ function normalizeFieldConstraints(meta) {
28587
29627
  delete v.pattern;
28588
29628
  out.validators = v;
28589
29629
  }
29630
+ // Synthesize or normalize Quick View binding before normalizeSelectLike deletes valueField
29631
+ const resolvedQuickView = resolveFieldQuickViewBinding(out);
29632
+ if (resolvedQuickView) {
29633
+ out.quickView = resolvedQuickView;
29634
+ }
29635
+ else if (out.quickView !== undefined) {
29636
+ delete out.quickView;
29637
+ }
28590
29638
  return out;
28591
29639
  }
28592
29640
  /** Normalize an array of FieldMetadata objects */
@@ -28724,7 +29772,13 @@ function normalizeSelectLike(meta) {
28724
29772
  }
28725
29773
 
28726
29774
  const SERVER_OWNED_FIELD_SEMANTIC_KEYS = [
29775
+ 'items',
29776
+ 'enumValues',
29777
+ 'customField',
29778
+ 'customFieldKey',
29779
+ 'customFieldScope',
28727
29780
  'disabled',
29781
+ 'formHidden',
28728
29782
  'readOnly',
28729
29783
  // normalizeFieldConstraints publishes this spelling to runtime consumers.
28730
29784
  'readonly',
@@ -28745,6 +29799,9 @@ const SERVER_OWNED_FIELD_SEMANTIC_KEYS = [
28745
29799
  'iconClass',
28746
29800
  'iconStyle',
28747
29801
  'iconFontSize',
29802
+ 'resourceReference',
29803
+ 'quickViewVisible',
29804
+ 'quickViewOrder',
28748
29805
  ];
28749
29806
  function applyServerOwnedFieldSemantics(merged, serverField) {
28750
29807
  const next = { ...merged };
@@ -28760,6 +29817,200 @@ function applyServerOwnedFieldSemantics(merged, serverField) {
28760
29817
  return next;
28761
29818
  }
28762
29819
 
29820
+ /** Current custom-field children own their container shape, including collisions with saved local controls. */
29821
+ function materializeCustomFieldsLayout(config, serverFields) {
29822
+ const serverNames = new Set(serverFields.map(field => field.name));
29823
+ const replacements = new Map();
29824
+ for (const field of config.fieldMetadata ?? []) {
29825
+ if (serverNames.has(field.name))
29826
+ continue;
29827
+ const children = serverFields
29828
+ .filter(child => child.customField === true && child.name.includes('.') &&
29829
+ child.name.slice(0, child.name.lastIndexOf('.')) === field.name)
29830
+ .map(child => child.name);
29831
+ if (children.length)
29832
+ replacements.set(field.name, children);
29833
+ }
29834
+ if (!replacements.size)
29835
+ return config;
29836
+ // Keep an explicitly placed child in its existing position. Only missing
29837
+ // references are inserted where the old container used to be rendered.
29838
+ const placed = new Set();
29839
+ const itemIds = new Set();
29840
+ for (const section of config.sections ?? []) {
29841
+ for (const row of section.rows ?? []) {
29842
+ for (const column of row.columns ?? []) {
29843
+ for (const item of column.items ?? [])
29844
+ itemIds.add(item.id);
29845
+ for (const name of getFormColumnFieldNames(column)) {
29846
+ if (!replacements.has(name))
29847
+ placed.add(name);
29848
+ }
29849
+ }
29850
+ }
29851
+ }
29852
+ const replaceName = (name) => {
29853
+ const children = replacements.get(name);
29854
+ if (!children)
29855
+ return [name];
29856
+ return children.filter(child => {
29857
+ if (placed.has(child))
29858
+ return false;
29859
+ placed.add(child);
29860
+ return true;
29861
+ });
29862
+ };
29863
+ const createItem = (name, index) => {
29864
+ const item = createFieldLayoutItem(name, index);
29865
+ const baseId = item.id;
29866
+ for (let suffix = 2; itemIds.has(item.id); suffix += 1)
29867
+ item.id = `${baseId}-${suffix}`;
29868
+ itemIds.add(item.id);
29869
+ return item;
29870
+ };
29871
+ return {
29872
+ ...config,
29873
+ fieldMetadata: config.fieldMetadata?.filter(field => !replacements.has(field.name)),
29874
+ sections: config.sections?.map(section => ({
29875
+ ...section,
29876
+ rows: (section.rows ?? []).map(row => ({
29877
+ ...row,
29878
+ columns: (row.columns ?? []).map(column => {
29879
+ if (Array.isArray(column.items)) {
29880
+ const items = column.items.flatMap((item) => {
29881
+ if (item.kind !== 'field' || !replacements.has(item.fieldName))
29882
+ return [item];
29883
+ return replaceName(item.fieldName).map(createItem);
29884
+ });
29885
+ return { ...column, items, fields: getFormLayoutFieldNames(items) };
29886
+ }
29887
+ return { ...column, fields: getFormColumnFieldNames(column).flatMap(replaceName) };
29888
+ }),
29889
+ })),
29890
+ })),
29891
+ };
29892
+ }
29893
+
29894
+ function buildBaseFormField(def) {
29895
+ const meta = mapFieldDefinitionsToMetadata([def])[0];
29896
+ return meta;
29897
+ }
29898
+ function applyLocalCustomizations$1(base, local) {
29899
+ const typeChanged = (base.controlType || '') !== (local.controlType || '');
29900
+ const serverBackedLocal = stripLocalServerOwnedSemantics(local);
29901
+ const localValidators = { ...local.validators };
29902
+ // A retired schema requirement cannot return through the legacy validator
29903
+ // spelling when the current backend field is optional.
29904
+ delete localValidators.required;
29905
+ // Server authority on identity/core props
29906
+ const authoritative = {
29907
+ name: base.name,
29908
+ type: base.type,
29909
+ controlType: base.controlType,
29910
+ dataType: base.dataType,
29911
+ required: base.required,
29912
+ endpoint: base.endpoint,
29913
+ resourcePath: base.resourcePath,
29914
+ optionSource: base.optionSource,
29915
+ optionLabelKey: base.optionLabelKey,
29916
+ optionValueKey: base.optionValueKey,
29917
+ // Validators: server overrides conflicting keys; keep local extras
29918
+ validators: {
29919
+ ...localValidators,
29920
+ ...base?.validators,
29921
+ },
29922
+ };
29923
+ // Local customizations to preserve (order/layout/visibility/UI hints/masks/placeholders)
29924
+ const preserved = {
29925
+ placeholder: local.placeholder ?? base.placeholder,
29926
+ mask: (typeChanged ? undefined : local.mask) ?? base.mask,
29927
+ format: (typeChanged ? undefined : local.format) ?? base.format,
29928
+ width: local.width ?? base.width,
29929
+ isFlex: local.isFlex ?? base.isFlex,
29930
+ visibleIn: local.visibleIn ?? base.visibleIn,
29931
+ formHidden: mergeServerVisibilityFlag(base.formHidden),
29932
+ tableHidden: mergeServerVisibilityFlag(base.tableHidden),
29933
+ filterHidden: mergeServerVisibilityFlag(base.filterHidden),
29934
+ materialDesign: {
29935
+ ...local.materialDesign,
29936
+ ...base.materialDesign,
29937
+ },
29938
+ // Static option lists can be local UI customization. Remote option source
29939
+ // semantics are owned by the server schema for server-backed fields.
29940
+ options: local.options !== undefined
29941
+ ? local.options
29942
+ : base.options,
29943
+ queryParams: serverBackedLocal.queryParams !== undefined
29944
+ ? serverBackedLocal.queryParams
29945
+ : base.queryParams,
29946
+ };
29947
+ const resolvedQuickView = reconcileFieldQuickViewBinding(base.quickView, serverBackedLocal.quickView);
29948
+ const merged = {
29949
+ ...base,
29950
+ ...serverBackedLocal,
29951
+ ...authoritative,
29952
+ ...preserved,
29953
+ };
29954
+ if (resolvedQuickView) {
29955
+ merged.quickView = resolvedQuickView;
29956
+ }
29957
+ else {
29958
+ delete merged.quickView;
29959
+ }
29960
+ return applyServerOwnedFieldSemantics(merged, base);
29961
+ }
29962
+ function mergeServerVisibilityFlag(serverValue) {
29963
+ return serverValue === true ? true : undefined;
29964
+ }
29965
+ function stripLocalSubmitSemantics(field) {
29966
+ const { source, transient, submitPolicy, ...rest } = field;
29967
+ void source;
29968
+ void transient;
29969
+ void submitPolicy;
29970
+ return rest;
29971
+ }
29972
+ function stripLocalServerOwnedSemantics(field) {
29973
+ const { defaultValue, ...rest } = stripLocalSubmitSemantics(field);
29974
+ void defaultValue;
29975
+ return rest;
29976
+ }
29977
+ function isLocalField(field) {
29978
+ return field.source === 'local';
29979
+ }
29980
+ function reconcileFormConfig(layout, serverDefs) {
29981
+ const serverMetas = mapFieldDefinitionsToMetadata(serverDefs);
29982
+ const materializedLayout = materializeCustomFieldsLayout(layout, serverMetas);
29983
+ const localMetas = (materializedLayout.fieldMetadata || []);
29984
+ const serverByName = new Map(serverMetas.map((m) => [m.name, m]));
29985
+ const localByName = new Map(localMetas.map((m) => [m.name, m]));
29986
+ const merged = [];
29987
+ // Merge overlapping
29988
+ for (const [name, serverField] of serverByName) {
29989
+ const localField = localByName.get(name);
29990
+ if (localField) {
29991
+ merged.push(applyLocalCustomizations$1(serverField, localField));
29992
+ }
29993
+ else {
29994
+ merged.push(serverField);
29995
+ }
29996
+ }
29997
+ // Orphans: preserve explicit local fields; hide legacy schema fields that no
29998
+ // longer exist on the server. Retain their authored metadata/layout, but do
29999
+ // not submit or validate an invisible control outside the current schema.
30000
+ for (const [name, localField] of localByName) {
30001
+ if (!serverByName.has(name)) {
30002
+ merged.push(isLocalField(localField)
30003
+ ? localField
30004
+ : { ...localField, formHidden: true, disabled: true, submitPolicy: 'omit' });
30005
+ }
30006
+ }
30007
+ // Preserve layout (sections/rows/columns) order, only affect fieldMetadata
30008
+ return {
30009
+ ...materializedLayout,
30010
+ fieldMetadata: merged,
30011
+ };
30012
+ }
30013
+
28763
30014
  function withFormConfigSections(config) {
28764
30015
  return {
28765
30016
  ...config,
@@ -28891,32 +30142,25 @@ function getReferencedFieldMetadata(config, allFieldMetadata) {
28891
30142
  function isLocalFieldMetadata(field) {
28892
30143
  return field.source === 'local';
28893
30144
  }
28894
- function stripLocalSubmitSemantics$1(field) {
28895
- const { source, transient, submitPolicy, ...rest } = field;
28896
- void source;
28897
- void transient;
28898
- void submitPolicy;
28899
- return rest;
28900
- }
28901
- function stripLocalServerOwnedSemantics$1(field) {
28902
- const { defaultValue, ...rest } = stripLocalSubmitSemantics$1(field);
28903
- void defaultValue;
28904
- return rest;
28905
- }
28906
30145
  /**
28907
30146
  * Synchronizes local config with server metadata
28908
30147
  * Detects additions, removals, and modifications
28909
30148
  */
28910
30149
  function syncWithServerMetadata(localConfig, serverMetadata) {
28911
30150
  // Normalize both sides to a canonical structure to avoid alias drift
28912
- const localFields = normalizeFormMetadata(localConfig.fieldMetadata || []);
28913
30151
  const serverFields = normalizeFormMetadata(serverMetadata || []);
30152
+ const originalLocalFields = normalizeFormMetadata(localConfig.fieldMetadata || []);
30153
+ const materializedLocalConfig = materializeCustomFieldsLayout(localConfig, serverFields);
30154
+ const localFields = materializedLocalConfig === localConfig
30155
+ ? originalLocalFields
30156
+ : normalizeFormMetadata(materializedLocalConfig.fieldMetadata || []);
28914
30157
  const localFieldsMap = new Map(localFields.map((f) => [f.name, f]));
28915
30158
  const serverFieldsMap = new Map(serverFields.map((f) => [f.name, f]));
28916
30159
  // Detect additions/removals
28917
30160
  const addedFields = serverFields.filter((f) => !localFieldsMap.has(f.name));
28918
- const removedFields = localFields
28919
- .filter((f) => !serverFieldsMap.has(f.name) && !isLocalFieldMetadata(f))
30161
+ const removedFields = originalLocalFields
30162
+ .filter((f) => !serverFieldsMap.has(f.name) &&
30163
+ (!isLocalFieldMetadata(f) || !localFieldsMap.has(f.name)))
28920
30164
  .map((f) => f.name);
28921
30165
  // Merge overlapping fields: prefer server as base, preserve local customizations
28922
30166
  const mergedOverlapping = [];
@@ -28925,26 +30169,12 @@ function syncWithServerMetadata(localConfig, serverMetadata) {
28925
30169
  const serverField = serverFieldsMap.get(localField.name);
28926
30170
  if (!serverField)
28927
30171
  return; // handled later
28928
- // Deep-ish merge with special handling for validators/options
28929
30172
  const base = { ...serverField };
28930
- const loc = { ...stripLocalServerOwnedSemantics$1(localField) };
28931
- const mergedValidators = { ...serverField.validators, ...localField.validators };
28932
- // Options/nodes family: keep local options if provided, else server
28933
- const pick = (k) => (loc[k] !== undefined ? loc[k] : base[k]);
28934
- const merged = {
28935
- ...base,
28936
- ...loc,
28937
- validators: mergedValidators,
28938
- selectOptions: pick('selectOptions'),
28939
- listOptions: pick('listOptions'),
28940
- transferOptions: pick('transferOptions'),
28941
- radioOptions: pick('radioOptions'),
28942
- toggleOptions: pick('toggleOptions'),
28943
- nodes: pick('nodes'),
28944
- };
28945
- mergedOverlapping.push(applyServerOwnedFieldSemantics(merged, serverField));
30173
+ const loc = { ...localField };
30174
+ mergedOverlapping.push(applyLocalCustomizations$1(serverField, localField));
28946
30175
  // Track simple modifications for diagnostics
28947
- ['label', 'required', 'maxLength', 'minLength', 'dataType', 'controlType'].forEach((prop) => {
30176
+ ['label', 'required', 'maxLength', 'minLength', 'dataType', 'controlType',
30177
+ 'customField', 'customFieldKey', 'customFieldScope'].forEach((prop) => {
28948
30178
  if (loc[prop] !== base[prop]) {
28949
30179
  modifiedFields.push({
28950
30180
  fieldName: localField.name,
@@ -28954,25 +30184,40 @@ function syncWithServerMetadata(localConfig, serverMetadata) {
28954
30184
  });
28955
30185
  }
28956
30186
  });
30187
+ for (const property of ['items', 'enumValues']) {
30188
+ const identity = (field) => property === 'items'
30189
+ ? field.items ? JSON.stringify([field.items.type, field.items.format, field.items.enum]) : undefined
30190
+ : JSON.stringify(field.enumValues);
30191
+ if (identity(localField) !== identity(serverField)) {
30192
+ modifiedFields.push({ fieldName: localField.name, property,
30193
+ localValue: localField[property], serverValue: serverField[property] });
30194
+ }
30195
+ }
28957
30196
  });
28958
30197
  // Build merged metadata list: overlapping (merged) + server-only + local-only
28959
30198
  const mergedNames = new Set(mergedOverlapping.map((f) => f.name));
28960
30199
  const mergedFieldMetadata = [
28961
30200
  ...mergedOverlapping,
28962
30201
  ...serverFields.filter((f) => !mergedNames.has(f.name) && !localFieldsMap.has(f.name)),
28963
- ...localFields.filter((f) => !serverFieldsMap.has(f.name)),
30202
+ ...localFields.filter((f) => !serverFieldsMap.has(f.name)).map(field => isLocalFieldMetadata(field) ? field : {
30203
+ ...field, formHidden: true, disabled: true, submitPolicy: 'omit',
30204
+ }),
28964
30205
  ];
28965
30206
  // Update sections to include new server-only fields, if layout exists
28966
- const updatedSections = [...(localConfig.sections || [])];
28967
- if (addedFields.length > 0 && updatedSections.length > 0) {
28968
- const lastSection = updatedSections[updatedSections.length - 1];
30207
+ const updatedSections = [...(materializedLocalConfig.sections || [])];
30208
+ const referencedNames = new Set(updatedSections.flatMap(section => (section.rows ?? []).flatMap(row => (row.columns ?? []).flatMap(getFormColumnFieldNames))));
30209
+ const unplacedAddedFields = addedFields.filter(field => !referencedNames.has(field.name));
30210
+ if (unplacedAddedFields.length > 0 && updatedSections.length > 0) {
30211
+ const sectionIndex = updatedSections.length - 1;
30212
+ const lastSection = { ...updatedSections[sectionIndex], rows: [...(updatedSections[sectionIndex].rows || [])] };
30213
+ updatedSections[sectionIndex] = lastSection;
28969
30214
  if (!lastSection.rows || lastSection.rows.length === 0) {
28970
30215
  lastSection.rows = [{ columns: [] }];
28971
30216
  }
28972
- const lastRow = lastSection.rows[lastSection.rows.length - 1];
28973
- if (!lastRow.columns)
28974
- lastRow.columns = [];
28975
- addedFields.forEach((field) => {
30217
+ const rowIndex = lastSection.rows.length - 1;
30218
+ const lastRow = { ...lastSection.rows[rowIndex], columns: [...(lastSection.rows[rowIndex].columns || [])] };
30219
+ lastSection.rows[rowIndex] = lastRow;
30220
+ unplacedAddedFields.forEach((field) => {
28976
30221
  lastRow.columns.push({ fields: [field.name] });
28977
30222
  });
28978
30223
  }
@@ -28986,7 +30231,7 @@ function syncWithServerMetadata(localConfig, serverMetadata) {
28986
30231
  conflicts: [],
28987
30232
  };
28988
30233
  const updatedConfig = {
28989
- ...localConfig,
30234
+ ...materializedLocalConfig,
28990
30235
  sections: updatedSections,
28991
30236
  fieldMetadata: mergedFieldMetadata,
28992
30237
  metadata: {
@@ -32165,6 +33410,7 @@ const QUICK_VIEW_EMPLOYEE_SCHEMA_FIXTURE = {
32165
33410
  resource: {
32166
33411
  idField: 'id',
32167
33412
  idFieldValid: true,
33413
+ icon: 'badge',
32168
33414
  identity: {
32169
33415
  keyField: 'registrationCode',
32170
33416
  titleField: 'fullName',
@@ -41901,6 +43147,8 @@ const MATERIALIZATION_METADATA_INPUTS = [
41901
43147
  'schemaEvidenceSource',
41902
43148
  'schemaEvidenceUrl',
41903
43149
  'schemaUrl',
43150
+ 'actionId',
43151
+ 'operationId',
41904
43152
  'kpis',
41905
43153
  'context',
41906
43154
  ];
@@ -48616,7 +49864,7 @@ class CompositionRuntimeEngine {
48616
49864
  this.haltedByLinkId = null;
48617
49865
  this.definition = definition;
48618
49866
  const generatedAt = this.now();
48619
- const stateSnapshot = this.materializeDerivedState(definition.state.primaryValues, definition);
49867
+ const stateSnapshot = this.materializeDerivedState(definition.state.primaryValues, definition, definition.state.transientValues);
48620
49868
  const semanticDiagnostics = this.validateComposition(definition);
48621
49869
  const bootstrapDiagnostics = uniqueDiagnosticsById([
48622
49870
  ...semanticDiagnostics,
@@ -52351,7 +53599,7 @@ class DynamicWidgetPageComponent {
52351
53599
  if (resetNonPersistentPaths.length > 0) {
52352
53600
  this.clearMountedSourceSelectionsForNonPersistentState([previousPageDefinition, this.pageDefinition], resetNonPersistentPaths);
52353
53601
  }
52354
- const bootstrapSnapshot = this.bootstrapCompositionAdapter(this.pageDefinition);
53602
+ const bootstrapSnapshot = this.bootstrapCompositionAdapter(this.pageDefinition, shouldPreserveEphemeralState);
52355
53603
  const rawWidgets = this.pageDefinition?.widgets || [];
52356
53604
  let widgets = this.applyEditShellActions(rawWidgets);
52357
53605
  widgets = this.applyBootstrapCompositionHydration(widgets, bootstrapSnapshot, this.pageRuntime);
@@ -52706,14 +53954,57 @@ class DynamicWidgetPageComponent {
52706
53954
  const normalized = this.dataSourceRuntime.normalizeDataSources(dataSources);
52707
53955
  return normalized.length > 0 ? JSON.stringify(normalized) : null;
52708
53956
  }
52709
- bootstrapCompositionAdapter(page) {
53957
+ bootstrapCompositionAdapter(page, preserveEphemeralTransient = false) {
52710
53958
  if (!page) {
52711
53959
  this.compositionDefinition = undefined;
52712
53960
  return undefined;
52713
53961
  }
53962
+ const preservedTransient = preserveEphemeralTransient
53963
+ ? this.collectPreservedTransientCompositionValues(page)
53964
+ : undefined;
52714
53965
  this.compositionDefinition = this.compositionFactory.create(page);
53966
+ if (preservedTransient && Object.keys(preservedTransient).length > 0) {
53967
+ this.compositionDefinition = {
53968
+ ...this.compositionDefinition,
53969
+ state: {
53970
+ ...this.compositionDefinition.state,
53971
+ transientValues: preservedTransient,
53972
+ },
53973
+ };
53974
+ }
52715
53975
  return this.compositionRuntime.bootstrap(this.compositionDefinition);
52716
53976
  }
53977
+ collectPreservedTransientCompositionValues(incomingPage) {
53978
+ const liveTransient = this.compositionRuntime.getSnapshot()?.state?.transientValues;
53979
+ if (!liveTransient ||
53980
+ typeof liveTransient !== 'object' ||
53981
+ Object.keys(liveTransient).length === 0) {
53982
+ return undefined;
53983
+ }
53984
+ const incomingWidgets = new Set((incomingPage.widgets || []).map((widget) => widget.key));
53985
+ const incomingLinks = incomingPage.composition?.links || [];
53986
+ let preserved = {};
53987
+ let preservedAny = false;
53988
+ for (const link of incomingLinks) {
53989
+ if (link.from?.kind !== 'component-port' ||
53990
+ link.to?.kind !== 'state' ||
53991
+ (link.to.ref?.layer ?? 'values') !== 'transient') {
53992
+ continue;
53993
+ }
53994
+ const writerKey = link.from.ref?.widget;
53995
+ const targetPath = String(link.to.ref?.path || '').trim();
53996
+ if (!writerKey || !targetPath || !incomingWidgets.has(writerKey)) {
53997
+ continue;
53998
+ }
53999
+ const liveValue = this.conn.extractByPath(liveTransient, targetPath);
54000
+ if (liveValue === undefined) {
54001
+ continue;
54002
+ }
54003
+ preserved = this.conn.setValueAtPath(preserved, targetPath, this.cloneStateValues(liveValue));
54004
+ preservedAny = true;
54005
+ }
54006
+ return preservedAny ? preserved : undefined;
54007
+ }
52717
54008
  applyEditShellActions(widgets) {
52718
54009
  return this.cloneWidgets(widgets);
52719
54010
  }
@@ -55740,8 +57031,10 @@ class DynamicWidgetPageComponent {
55740
57031
  const effectiveRuntime = runtime ?? this.buildStateRuntime(next.state, next.context);
55741
57032
  const normalized = { ...next, state: effectiveRuntime.state };
55742
57033
  const normalizedWidgets = this.applyEditShellActions(normalized.widgets || []);
57034
+ const shouldPreserveTransient = !this.isHydrating &&
57035
+ this.samePageContextIdentity(this.pageDefinition, normalized);
55743
57036
  const bootstrapSnapshot = syncCompositionAdapter
55744
- ? this.bootstrapCompositionAdapter(normalized)
57037
+ ? this.bootstrapCompositionAdapter(normalized, shouldPreserveTransient)
55745
57038
  : undefined;
55746
57039
  const stateBoundWidgets = skipStateWidgetProjection
55747
57040
  ? normalizedWidgets
@@ -64456,111 +65749,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
64456
65749
  type: Input
64457
65750
  }] } });
64458
65751
 
64459
- function buildBaseFormField(def) {
64460
- const meta = mapFieldDefinitionsToMetadata([def])[0];
64461
- return meta;
64462
- }
64463
- function applyLocalCustomizations$1(base, local) {
64464
- const typeChanged = (base.controlType || '') !== (local.controlType || '');
64465
- const serverBackedLocal = stripLocalServerOwnedSemantics(local);
64466
- // Server authority on identity/core props
64467
- const authoritative = {
64468
- name: base.name,
64469
- type: base.type,
64470
- controlType: base.controlType,
64471
- required: base.required,
64472
- endpoint: base.endpoint,
64473
- resourcePath: base.resourcePath,
64474
- optionSource: base.optionSource,
64475
- optionLabelKey: base.optionLabelKey,
64476
- optionValueKey: base.optionValueKey,
64477
- // Validators: server overrides conflicting keys; keep local extras
64478
- validators: {
64479
- ...local?.validators,
64480
- ...base?.validators,
64481
- },
64482
- };
64483
- // Local customizations to preserve (order/layout/visibility/UI hints/masks/placeholders)
64484
- const preserved = {
64485
- placeholder: local.placeholder ?? base.placeholder,
64486
- mask: (typeChanged ? undefined : local.mask) ?? base.mask,
64487
- format: (typeChanged ? undefined : local.format) ?? base.format,
64488
- width: local.width ?? base.width,
64489
- isFlex: local.isFlex ?? base.isFlex,
64490
- visibleIn: local.visibleIn ?? base.visibleIn,
64491
- formHidden: mergeServerVisibilityFlag(base.formHidden),
64492
- tableHidden: mergeServerVisibilityFlag(base.tableHidden),
64493
- filterHidden: mergeServerVisibilityFlag(base.filterHidden),
64494
- materialDesign: {
64495
- ...local.materialDesign,
64496
- ...base.materialDesign,
64497
- },
64498
- // Static option lists can be local UI customization. Remote option source
64499
- // semantics are owned by the server schema for server-backed fields.
64500
- options: local.options !== undefined
64501
- ? local.options
64502
- : base.options,
64503
- queryParams: serverBackedLocal.queryParams !== undefined
64504
- ? serverBackedLocal.queryParams
64505
- : base.queryParams,
64506
- };
64507
- const merged = {
64508
- ...base,
64509
- ...serverBackedLocal,
64510
- ...authoritative,
64511
- ...preserved,
64512
- };
64513
- return applyServerOwnedFieldSemantics(merged, base);
64514
- }
64515
- function mergeServerVisibilityFlag(serverValue) {
64516
- return serverValue === true ? true : undefined;
64517
- }
64518
- function stripLocalSubmitSemantics(field) {
64519
- const { source, transient, submitPolicy, ...rest } = field;
64520
- void source;
64521
- void transient;
64522
- void submitPolicy;
64523
- return rest;
64524
- }
64525
- function stripLocalServerOwnedSemantics(field) {
64526
- const { defaultValue, ...rest } = stripLocalSubmitSemantics(field);
64527
- void defaultValue;
64528
- return rest;
64529
- }
64530
- function isLocalField(field) {
64531
- return field.source === 'local';
64532
- }
64533
- function reconcileFormConfig(layout, serverDefs) {
64534
- const serverMetas = mapFieldDefinitionsToMetadata(serverDefs);
64535
- const localMetas = (layout.fieldMetadata || []);
64536
- const serverByName = new Map(serverMetas.map((m) => [m.name, m]));
64537
- const localByName = new Map(localMetas.map((m) => [m.name, m]));
64538
- const merged = [];
64539
- // Merge overlapping
64540
- for (const [name, serverField] of serverByName) {
64541
- const localField = localByName.get(name);
64542
- if (localField) {
64543
- merged.push(applyLocalCustomizations$1(serverField, localField));
64544
- }
64545
- else {
64546
- merged.push(serverField);
64547
- }
64548
- }
64549
- // Orphans: preserve explicit local fields; hide legacy schema fields that no
64550
- // longer exist on the server. Retain their authored metadata/layout, but do
64551
- // not submit or validate an invisible control outside the current schema.
64552
- for (const [name, localField] of localByName) {
64553
- if (!serverByName.has(name)) {
64554
- merged.push(isLocalField(localField)
64555
- ? localField
64556
- : { ...localField, formHidden: true, disabled: true, submitPolicy: 'omit' });
64557
- }
64558
- }
64559
- // Preserve layout (sections/rows/columns) order, only affect fieldMetadata
64560
- return {
64561
- ...layout,
64562
- fieldMetadata: merged,
64563
- };
65752
+ /** Reads one schema representation using an immutable snapshot of the host headers. */
65753
+ async function fetchWithETag(params) {
65754
+ return fetchSchemaWithCapturedHeaders(params, captureSchemaFetchHeaders(params));
64564
65755
  }
64565
65756
 
64566
65757
  function buildBaseFilterField(def) {
@@ -64573,7 +65764,8 @@ function applyLocalCustomizations(base, local) {
64573
65764
  }
64574
65765
  function reconcileFilterConfig(layout, serverDefs) {
64575
65766
  const serverMetas = mapFieldDefinitionsToMetadata(serverDefs);
64576
- const localMetas = (layout.fieldMetadata || []);
65767
+ const materializedLayout = materializeCustomFieldsLayout(layout, serverMetas);
65768
+ const localMetas = (materializedLayout.fieldMetadata || []);
64577
65769
  const serverByName = new Map(serverMetas.map((m) => [m.name, m]));
64578
65770
  const localByName = new Map(localMetas.map((m) => [m.name, m]));
64579
65771
  const merged = [];
@@ -64581,22 +65773,23 @@ function reconcileFilterConfig(layout, serverDefs) {
64581
65773
  for (const [name, serverField] of serverByName) {
64582
65774
  const localField = localByName.get(name);
64583
65775
  if (localField) {
64584
- const base = buildBaseFilterField(serverField);
64585
- merged.push(applyLocalCustomizations(base, localField));
65776
+ merged.push(applyLocalCustomizations(serverField, localField));
64586
65777
  }
64587
65778
  else {
64588
- merged.push(buildBaseFilterField(serverField));
65779
+ merged.push(serverField);
64589
65780
  }
64590
65781
  }
64591
- // Orphans: keep but hide in filter context
65782
+ // Preserve explicit local filters. Removed schema fields cannot validate or
65783
+ // enter search payloads, even when their saved values are restored locally.
64592
65784
  for (const [name, localField] of localByName) {
64593
65785
  if (!serverByName.has(name)) {
64594
- const hidden = { ...localField, filterHidden: true };
64595
- merged.push(hidden);
65786
+ merged.push(localField.source === 'local' ? localField : {
65787
+ ...localField, filterHidden: true, disabled: true, submitPolicy: 'omit',
65788
+ });
64596
65789
  }
64597
65790
  }
64598
65791
  return {
64599
- ...layout,
65792
+ ...materializedLayout,
64600
65793
  fieldMetadata: merged,
64601
65794
  };
64602
65795
  }
@@ -65118,6 +66311,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
65118
66311
  class PraxisQuickViewTriggerDirective {
65119
66312
  elementRef = inject(ElementRef);
65120
66313
  quickViewService = inject(ResourceQuickViewService);
66314
+ lastResolvedTargetSignature = null;
65121
66315
  binding = null;
65122
66316
  praxisQuickViewRecord = null;
65123
66317
  praxisQuickViewTriggerMode = 'hover-and-click';
@@ -65231,12 +66425,30 @@ class PraxisQuickViewTriggerDirective {
65231
66425
  }
65232
66426
  }
65233
66427
  }
66428
+ ngOnChanges(_changes) {
66429
+ const nextSignature = this.computeResolvedTargetSignature();
66430
+ if (this.lastResolvedTargetSignature !== null &&
66431
+ this.lastResolvedTargetSignature !== nextSignature) {
66432
+ const el = this.elementRef?.nativeElement;
66433
+ if (el) {
66434
+ this.quickViewService.dismissIfAnchoredTo(el, 'anchor-invalid');
66435
+ }
66436
+ }
66437
+ this.lastResolvedTargetSignature = nextSignature;
66438
+ }
65234
66439
  ngOnDestroy() {
65235
66440
  const el = this.elementRef?.nativeElement;
65236
66441
  if (el) {
65237
66442
  this.quickViewService.dismissIfAnchoredTo(el, 'anchor-invalid');
65238
66443
  }
65239
66444
  }
66445
+ computeResolvedTargetSignature() {
66446
+ const resolved = resolveResourceQuickViewTarget(this.binding, this.praxisQuickViewRecord);
66447
+ if (!resolved) {
66448
+ return null;
66449
+ }
66450
+ return `${resolved.resourceKey}::${resolved.surfaceId}::${resolved.previewSurfaceId}::${String(resolved.identity)}`;
66451
+ }
65240
66452
  buildAnchor() {
65241
66453
  const el = this.elementRef.nativeElement;
65242
66454
  const anchorKey = this.praxisQuickViewAnchorId?.trim() || undefined;
@@ -65306,7 +66518,7 @@ class PraxisQuickViewTriggerDirective {
65306
66518
  return false;
65307
66519
  }
65308
66520
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PraxisQuickViewTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
65309
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.14", type: PraxisQuickViewTriggerDirective, isStandalone: true, selector: "[praxisQuickView]", inputs: { binding: ["praxisQuickView", "binding"], praxisQuickViewRecord: "praxisQuickViewRecord", praxisQuickViewTriggerMode: "praxisQuickViewTriggerMode", praxisQuickViewAnchorId: "praxisQuickViewAnchorId", praxisQuickViewSourceId: "praxisQuickViewSourceId", praxisQuickViewEndpointKey: "praxisQuickViewEndpointKey", praxisQuickViewApiUrlEntry: "praxisQuickViewApiUrlEntry", praxisQuickViewQueryContext: "praxisQuickViewQueryContext", praxisQuickViewHoverOpenDelayMs: "praxisQuickViewHoverOpenDelayMs", praxisQuickViewHoverCloseDelayMs: "praxisQuickViewHoverCloseDelayMs", praxisQuickViewStopPropagation: "praxisQuickViewStopPropagation" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick($event)", "keydown": "onKeydown($event)" }, properties: { "class.praxis-quick-view-trigger": "isQuickViewConfigured", "attr.data-praxis-quick-view-trigger": "isQuickViewConfigured ? triggerMode : null", "attr.aria-haspopup": "shouldExposeDialogPopupAttr ? \"dialog\" : null", "attr.role": "shouldExposeInteractiveRole ? \"button\" : null", "attr.tabindex": "shouldExposeInteractiveTabIndex ? \"0\" : null" } }, exportAs: ["praxisQuickView"], ngImport: i0 });
66521
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.14", type: PraxisQuickViewTriggerDirective, isStandalone: true, selector: "[praxisQuickView]", inputs: { binding: ["praxisQuickView", "binding"], praxisQuickViewRecord: "praxisQuickViewRecord", praxisQuickViewTriggerMode: "praxisQuickViewTriggerMode", praxisQuickViewAnchorId: "praxisQuickViewAnchorId", praxisQuickViewSourceId: "praxisQuickViewSourceId", praxisQuickViewEndpointKey: "praxisQuickViewEndpointKey", praxisQuickViewApiUrlEntry: "praxisQuickViewApiUrlEntry", praxisQuickViewQueryContext: "praxisQuickViewQueryContext", praxisQuickViewHoverOpenDelayMs: "praxisQuickViewHoverOpenDelayMs", praxisQuickViewHoverCloseDelayMs: "praxisQuickViewHoverCloseDelayMs", praxisQuickViewStopPropagation: "praxisQuickViewStopPropagation" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick($event)", "keydown": "onKeydown($event)" }, properties: { "class.praxis-quick-view-trigger": "isQuickViewConfigured", "attr.data-praxis-quick-view-trigger": "isQuickViewConfigured ? triggerMode : null", "attr.aria-haspopup": "shouldExposeDialogPopupAttr ? \"dialog\" : null", "attr.role": "shouldExposeInteractiveRole ? \"button\" : null", "attr.tabindex": "shouldExposeInteractiveTabIndex ? \"0\" : null" } }, exportAs: ["praxisQuickView"], usesOnChanges: true, ngImport: i0 });
65310
66522
  }
65311
66523
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PraxisQuickViewTriggerDirective, decorators: [{
65312
66524
  type: Directive,
@@ -67175,4 +68387,4 @@ function materializeGovernedPagePreview(value, pageId, adapters, baseContext = {
67175
68387
  * Generated bundle index. Do not edit.
67176
68388
  */
67177
68389
 
67178
- export { API_CONFIG_STORAGE_OPTIONS, API_URL, ASYNC_CONFIG_STORAGE, AllowedFileTypes, AnalyticsPresentationResolver, AnalyticsSchemaContractService, AnalyticsStatsRequestBuilderService, ApiConfigStorage, ApiEndpoint, BUILTIN_PAGE_LAYOUT_PRESETS, BUILTIN_PAGE_THEME_PRESETS, BUILTIN_SHELL_PRESETS, BUILTIN_WIDGET_SHELL_PRESETS, BulkOperationClientService, BulkSyncSession, BulkSyncStateService, COMPONENT_METADATA_REGISTRY_I18N_CONFIG, COMPONENT_METADATA_REGISTRY_I18N_NAMESPACE, CONFIG_STORAGE, CONNECTION_STORAGE, ComponentAuthoringManifestProjectionError, ComponentKeyService, ComponentMetadataRegistry, ComponentRuntimeProfileService, CompositionRuntimeFacade, CompositionValidatorService, ConsoleLoggerSink, CrudOperationResolutionService, DEFAULT_DYNAMIC_FORM_SCHEMA_CACHE_MAX_ENTRIES, DEFAULT_DYNAMIC_FORM_SCHEMA_CACHE_TTL_MS, DEFAULT_FIELD_SELECTOR_CONTROL_TYPE_MAP, DEFAULT_JSON_LOGIC_OPERATORS, DEFAULT_SCHEMA_REQUEST_TIMEOUT_MS, DEFAULT_TABLE_CONFIG, DOMAIN_CATALOG_COMPONENT_CONTEXT_PACK, DOMAIN_CATALOG_CONTEXT_HINT_SCHEMA_VERSION, DYNAMIC_PAGE_AI_CAPABILITIES, DYNAMIC_PAGE_COMPONENT_CONTEXT_PACK, DYNAMIC_PAGE_CONFIG_EDITOR, DYNAMIC_PAGE_SHELL_EDITOR, DefaultLoadingRenderer, DeferredAsyncConfigStorage, DomainCatalogService, DomainKnowledgeService, DomainRuleService, DynamicFormService, DynamicWidgetLoaderDirective, DynamicWidgetPageComponent, EDITORIAL_ALLOWED_CONTENT_FORMATS, EDITORIAL_COMPLIANCE_PRESETS, EDITORIAL_EXTERNAL_LINK_REL, EDITORIAL_FORM_TEMPLATE_CATALOG, EDITORIAL_HTML_ENABLED, EDITORIAL_MARKDOWN_IMAGES_ENABLED, EDITORIAL_SOLUTION_CATALOG, EDITORIAL_SOLUTION_PRESETS, EDITORIAL_THEME_PRESETS, EDITORIAL_WIDGET_CONVENTION_INPUTS, EDITORIAL_WIDGET_TAG, EFFECTIVE_UI_LAYOUT_COMPOSITION_SCHEMA_VERSION, EMPLOYEE_ONBOARDING_EDITORIAL_SOLUTION, EMPLOYEE_ONBOARDING_EDITORIAL_TEMPLATE, EMPLOYEE_ONBOARDING_GUIDED_EDITORIAL_SOLUTION, EMPLOYEE_ONBOARDING_GUIDED_EDITORIAL_TEMPLATE, EVENT_REGISTRATION_EDITORIAL_SOLUTION, EVENT_REGISTRATION_EDITORIAL_TEMPLATE, EffectiveUiLayoutContractError, EffectiveUiLayoutHttpError, EffectiveUiLayoutService, EmptyStateCardComponent, EnterpriseRuntimeContextObsoleteError, EnterpriseRuntimeContextService, ErrorMessageService, FIELD_METADATA_CAPABILITIES, FIELD_SELECTOR_REGISTRY_BASE, FIELD_SELECTOR_REGISTRY_DISABLE_DEFAULTS, FIELD_SELECTOR_REGISTRY_OVERRIDES, FORM_HOOKS, FORM_HOOKS_PRESETS, FORM_HOOKS_WHITELIST, FORM_HOOK_RESOLVERS, FieldControlType, FieldDataType, FieldSelectorRegistry, FormHooksRegistry, GLOBAL_ACTION_CATALOG, GLOBAL_ACTION_HANDLERS, GLOBAL_ACTION_UI_SCHEMAS, GLOBAL_ANALYTICS_SERVICE, GLOBAL_API_CLIENT, GLOBAL_CONFIG, GLOBAL_DIALOG_SERVICE, GLOBAL_ROUTE_GUARD_RESOLVER, GLOBAL_SURFACE_SERVICE, GLOBAL_TOAST_SERVICE, GOVERNED_COLOR_PALETTE_OPTIONS, GOVERNED_PAGE_DEFAULT_ALLOWED_ICONS, GenericCrudService, GlobalActionService, GlobalConfigService, GovernedColorPaletteService, INLINE_FILTER_ALIAS_TOKENS, INLINE_FILTER_CONTROL_TYPES, INLINE_FILTER_CONTROL_TYPE_SET, INLINE_FILTER_CONTROL_TYPE_VALUES, INLINE_FILTER_TOKEN_TO_BASE_CONTROL_TYPE, INLINE_FILTER_TOKEN_TO_CONTROL_TYPE, IconPickerService, IconPosition, IconSize, LOGGER_LEVEL_BY_ENV, LOGGER_LEVEL_PRIORITY, LoadingOrchestrator, LocalConnectionStorage, LocalStorageAsyncAdapter, LocalStorageCacheAdapter, LocalStorageConfigService, LoggerService, LoggerThrottleTracker, LoggerWarnOnceTracker, MemoryCacheAdapter, NestedPortCatalogService, NestedWidgetConfigAccessor, NumericFormat, OVERLAY_DECIDER_DEBUG, OVERLAY_DECISION_MATRIX, ObservabilityDashboardService, OverlayDeciderService, PRAXIS_ACTION_CONTROL_DEFAULTS, PRAXIS_ACTION_CONTROL_VARS, PRAXIS_COLLECTION_EXPORT_HTTP_OPTIONS, PRAXIS_COLLECTION_EXPORT_PROVIDER, PRAXIS_COLLECTION_SEARCH_DEFAULTS, PRAXIS_COLLECTION_SEARCH_VARS, PRAXIS_CORPORATE_SENSITIVE_KEYS, PRAXIS_DEFAULT_EXPORT_SECURITY_POLICY, PRAXIS_DEFAULT_OBSERVABILITY_ALERT_RULES, PRAXIS_DYNAMIC_PAGE_COMPONENT_METADATA, PRAXIS_EFFECTIVE_UI_LAYOUT_OPTIONS, PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS, PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY, PRAXIS_EXPORT_FORMULA_PREFIXES, PRAXIS_EXPORT_SECURITY_POLICY, PRAXIS_FOOTER_LINKS_METADATA, PRAXIS_GLOBAL_ACTION_CATALOG, PRAXIS_GLOBAL_CONFIG_BOOTSTRAP_OPTIONS, PRAXIS_GLOBAL_CONFIG_BOOTSTRAP_READY, PRAXIS_GLOBAL_CONFIG_TENANT_RESOLVER, PRAXIS_HERO_BANNER_METADATA, PRAXIS_I18N_CONFIG, PRAXIS_I18N_TRANSLATOR, PRAXIS_JSON_LOGIC_OPERATORS, PRAXIS_LAYER_SCALE_DEFAULTS, PRAXIS_LAYER_SCALE_VARS, PRAXIS_LEGAL_NOTICE_METADATA, PRAXIS_LOADING_CTX, PRAXIS_LOADING_RENDERER, PRAXIS_LOGGER_CONFIG, PRAXIS_LOGGER_SINKS, PRAXIS_OBSERVABILITY_DASHBOARD_OPTIONS, PRAXIS_QUERY_FILTER_EXPRESSION_SCHEMA_VERSION, PRAXIS_QUICK_VIEW_BODY_RENDERER, PRAXIS_QUICK_VIEW_PRESENTER, PRAXIS_RELATED_RESOURCE_OUTLET_AUTHORING_MANIFEST, PRAXIS_RELATED_RESOURCE_OUTLET_COMPONENT_METADATA, PRAXIS_RELATED_RESOURCE_OUTLET_PORTS, PRAXIS_RICH_TEXT_BLOCK_METADATA, PRAXIS_TABLE_DETAIL_INLINE_NODE_RESOLVERS, PRAXIS_TABLE_DETAIL_INLINE_RENDERERS, PRAXIS_TABLE_DETAIL_RESOURCE_RESOLVER, PRAXIS_TELEMETRY_TRANSPORT, PRAXIS_THEME_SURFACE_DEFAULTS, PRAXIS_THEME_SURFACE_VARS, PRAXIS_USER_CONTEXT_SUMMARY_METADATA, PRIVACY_CONSENT_EDITORIAL_SOLUTION, PRIVACY_CONSENT_EDITORIAL_TEMPLATE, PraxisAppShellComponent, PraxisBulkClientService, PraxisCollectionExportService, PraxisCore, PraxisCustomizationModeService, PraxisFooterLinksComponent, PraxisGlobalErrorHandler, PraxisHeroBannerComponent, PraxisHttpCollectionExportProvider, PraxisI18nService, PraxisIconButtonComponent, PraxisIconDirective, PraxisIconPickerComponent, PraxisJsonLogicError, PraxisJsonLogicService, PraxisKeepAliveTabDirective, PraxisLayerScaleStyleService, PraxisLegalNoticeComponent, PraxisLoadingInterceptor, PraxisQuickViewTriggerDirective, PraxisRelatedResourceOutletComponent, PraxisRelatedResourceOutletConfigEditorComponent, PraxisResourceIdentityComponent, PraxisRichTextBlockComponent, PraxisRuntimeComponentObservationRegistryService, PraxisSurfaceHostComponent, PraxisUserContextSummaryComponent, PraxisWidgetEventBus, QUICK_VIEW_EMPLOYEE_BINDING_FIXTURE, QUICK_VIEW_EMPLOYEE_RECORD_FIXTURE, QUICK_VIEW_EMPLOYEE_SCHEMA_FIXTURE, QUICK_VIEW_EMPLOYEE_SURFACES_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_BINDING_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_RECORD_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_SCHEMA_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_SURFACES_FIXTURE, RESOURCE_DISCOVERY_I18N_CONFIG, RESOURCE_DISCOVERY_I18N_NAMESPACE, RULE_PROPERTY_SCHEMA, RelatedResourceSurfaceResolverService, RemoteConfigStorage, ResourceActionOpenAdapterService, ResourceDiscoveryService, ResourceQuickConnectComponent, ResourceQuickViewService, ResourceRecordOpenError, ResourceRecordOpenService, ResourceSurfaceOpenAdapterService, SCHEMA_METADATA_CLIENT_OPTIONS, SCHEMA_VIEWER_CONTEXT, SETTINGS_EDITOR_SECTIONS_HOSTED, SETTINGS_PANEL_BRIDGE, SETTINGS_PANEL_DATA, STEPPER_CONFIG_EDITOR, SURFACE_DRAWER_BRIDGE, SURFACE_DRAWER_CONTENT_DATA, SURFACE_DRAWER_REF, SURFACE_NAVIGATION_I18N_CONFIG, SURFACE_NAVIGATION_I18N_NAMESPACE, SURFACE_OPEN_I18N_CONFIG, SURFACE_OPEN_I18N_NAMESPACE, SURFACE_OPEN_PRESETS, SafeExpressionEvaluator, SchemaMetadataClient, SchemaNormalizerService, SchemaViewerComponent, SettingsSectionTabsComponent, SurfaceBindingRuntimeService, SurfaceNavigationError, SurfaceOpenActionEditorComponent, SurfaceOpenMaterializerService, SurfaceOutletRegistryService, TABLE_CONFIG_EDITOR, TableConfigService, TelemetryLoggerSink, TelemetryService, UiLayoutLifecycleContractError, UiLayoutLifecycleHttpError, UiLayoutLifecycleService, ValidationPattern, WidgetPageCompositionFactory, WidgetPageDataSourceRuntimeService, WidgetPageStateRuntimeService, WidgetShellComponent, applyDeclarativeValuePipe, applyLocalCustomizations$2 as applyLocalCustomizations, applyLocalCustomizations$1 as applyLocalFormCustomizations, assertPraxisCollectionExportArtifact, assertPraxisRuntimeComponentObservationSerializable, buildAngularValidators, buildApiUrl, buildBaseColumnFromDef, buildBaseFormField, buildFormConfigFromEditorialTemplate, buildGovernedPageTarget, buildHeaders, buildPageKey, buildPraxisActionControlCss, buildPraxisCollectionSearchCss, buildPraxisEffectDistinctKey, buildPraxisLayerScaleCss, buildPraxisThemeSurfaceCss, buildPublishedPageIdentity, buildSchemaId, buildSchemaIdStorageKeySegment, buildValidatorsFromValidatorOptions, calibrateFieldMetadataFromSemantics, canOrganizeFormLayoutBySemantics, cancelIfCpfInvalidHook, canonicalJsonSha256, canonicalJsonStringify, clampRange, classifyEntityLookupResult, cloneBoundedUiLayoutJsonDocument, clonePraxisRuntimeComponentObservation, cloneTableConfig, cloneUiLayoutJsonDocument, cnpjAlphaValidator, collapseWhitespace, composeHeadersWithVersion, conditionalAsyncValidator, containsEphemeralQuickViewRuntimeValue, convertFormLayoutToConfig, copyPageAuthoringDocument, createCorporateLoggerConfig, createCorporateObservabilityOptions, createCpfCnpjValidator, createDefaultFormConfig, createDefaultTableConfig, createDynamicRecord, createEmptyFormConfig, createEmptyNavigationGroupsAuthoringDocument, createEmptyRichContentDocument, createFieldLayoutItem, createPersistedPage, customAsyncValidatorFn, customValidatorFn, debounceAsyncValidator, decodeNavigationGroupsAuthoringDocument, decodePageAuthoringDocument, deepMerge, derivePageChildRuntimeId, domainKnowledgeTimelineToRichContentDocument, domainRuleTimelineToRichContentDocument, encodeNavigationGroupsAuthoringDocument, encodePageAuthoringDocument, ensureIds, ensureNoConflictsHookFactory, ensurePageIds, escapePraxisExportCell, evaluateFieldAccess, extractNormalizedError, extractRecordId, fetchWithETag, fileTypeValidator, fillUndefined, findBuiltinWidgetShellPreset, formIdentityIssues, generateBulkIdempotencyKey, generateId, getDefaultFormHints, getEditorialCompliancePresetById, getEditorialFormTemplateById, getEditorialFormTemplateCatalog, getEditorialSolutionById, getEditorialSolutionCatalog, getEditorialSolutionPresetById, getEditorialThemePresetById, getEssentialConfig, getFieldMetadataCapabilities, getFormColumnFieldNames, getFormLayoutFieldNames, getGlobalActionCatalog, getGlobalActionPayloadActualType, getGlobalActionPayloadTypeIssue, getGlobalActionProviderEvidence, getGlobalActionUiSchema, getMissingGlobalActionPayloadKeys, getPraxisTableCellVisualizationConstraint, getPraxisTableCellVisualizationGuidance, getReferencedFieldMetadata, getRequiredGlobalActionPayloadKeys, getTextTransformer, getWidgetShellActionIdError, hasMeaningfulGlobalActionPayloadValue, hasPraxisCollectionExportArtifact, hasSemanticFieldCalibrationDiff, humanizeCatalogFieldName, inferDomainSemanticHexColor, inferDomainSemanticIcon, inferDomainSemanticTone, inferSemanticFieldControlType, inferSemanticFieldGroup, inferSemanticFieldWidth, interpolatePraxisTranslation, isAllowedEditorialContentFormat, isAllowedEditorialHref, isBulkExecutionTerminal, isCssTextTransform, isDomainRuleSnapshotProblemResponse, isDynamicDataRecord, isEditorialComponentMeta, isEntityLookupMultiplePayloadMode, isEntityLookupPayloadMode, isEntityLookupPayloadModeCompatible, isEntityLookupResultSelectable, isEntityLookupSinglePayloadMode, isFormLayoutItem, isGlobalActionProviderOperational, isGlobalActionRef, isGovernedPageUuid, isInlineFilterControlType, isLookupDialogSize, isLookupFilterFieldType, isLookupFilterOperator, isPraxisI18nMessageDescriptor, isPraxisPresentationVisualizationTableSafe, isPraxisRuntimeGlobalActionEffect, isProgrammaticDateRangePreset, isRangeValidForFilter, isRequiredGlobalActionParamPayloadMissing, isRequiredGlobalActionPayloadMissing, isResourceQuickViewAnchorValid, isStaticDateRangePreset, isSurfaceNavigationError, isTableConfigV2, isUnresolvedTemplateToken, isValidFormConfig, isValidTableConfig, legacyCnpjValidator, legacyCpfValidator, logOnErrorHook, mapCatalogFieldsToMetadata, mapFieldDefinitionToMetadata, mapFieldDefinitionsToMetadata, markGlobalActionProviderOperational, matchFieldValidator, materializeFormLayoutFromMetadata, materializeGovernedPagePreview, materializeGovernedPaletteColors, materializeGovernedPaletteEntries, materializeResourceIdentity, maxFileSizeValidator, mergeFieldMetadata, mergePraxisI18nConfigs, mergeTableConfigs, migrateFormLayoutRule, migrateLegacyCompositionLink, migrateLegacyCompositionLinks, minWordsValidator, nestedPortPathIdentity, normalizeCardMediaAspectRatio, normalizeColumnRendererQuickView, normalizeControlTypeKey, normalizeControlTypeToken, normalizeEditorialLink, normalizeEnd, normalizeFieldAccessMetadata, normalizeFieldConstraints, normalizeFieldPresentation, normalizeFormConfig, normalizeFormLayoutItems, normalizeFormMetadata, normalizeGlobalActionRef$1 as normalizeGlobalActionRef, normalizeLayoutPolicy, normalizeLookupFilterRequest, normalizePath, normalizePraxisDataQueryContext, normalizePraxisEffectPolicy, normalizePraxisIconLigature, normalizePraxisPresentationVisualization, normalizePraxisQueryFilterExpression, normalizePraxisQueryFilterNode, normalizeReactiveDeterminations, normalizeResourceAvailabilityReasonCode, normalizeResourceIdentityContract, normalizeResourceQuickViewBinding, normalizeResourceRecordOpenReference, normalizeStart, normalizeSurfaceOperationContext, normalizeUnknownError, normalizeWidgetEventPath, notifySuccessHook, organizeFormLayoutBySemantics, parseJsonResponseOrEmpty, praxisLoadingInterceptorFn, prefillFromContextHook, prepareCanvasArrangement, projectComponentAuthoringManifest, projectGroupedCommandPartialRows, provideDefaultFormHooks, provideFieldSelectorRegistryBase, provideFieldSelectorRegistryOverride, provideFieldSelectorRegistryRuntime, provideFormHookPresets, provideFormHooks, provideGlobalActionCatalog, provideGlobalActionHandler, provideGlobalConfig, provideGlobalConfigReady, provideGlobalConfigSeed, provideGlobalConfigTenant, provideHookResolvers, provideHookWhitelist, provideOverlayDecisionMatrix, providePraxisAnalyticsGlobalActions, providePraxisCollectionExportProvider, providePraxisDynamicPageMetadata, providePraxisEnterpriseRuntimeContext, providePraxisFooterLinksMetadata, providePraxisGlobalActionCatalog, providePraxisGlobalActions, providePraxisGlobalConfigBootstrap, providePraxisHeroBannerMetadata, providePraxisHttpCollectionExportProvider, providePraxisHttpLoading, providePraxisI18n, providePraxisI18nConfig, providePraxisI18nTranslator, providePraxisIconDefaults, providePraxisJsonLogicOperator, providePraxisJsonLogicOperatorOverride, providePraxisLegalNoticeMetadata, providePraxisLoadingDefaults, providePraxisLogging, providePraxisRelatedResourceOutletMetadata, providePraxisRichTextBlockMetadata, providePraxisTelemetry, providePraxisToastGlobalActions, providePraxisUserContextSummaryMetadata, provideRemoteGlobalConfig, readPraxisExportValue, readStrongResourceEtag, reconcileFilterConfig, reconcileFormConfig, reconcileTableConfig, registerPraxisRuntimeComponentObservation, removeDiacritics, renderPraxisPresentationVisualizationHtml, reportTelemetryHookFactory, requiredCheckedValidator, requiredPresenceValidator, resolveBuiltinPresets, resolveBuiltinWidgetShellAppearance, resolveColumnTypeFromFieldDefinition, resolveControlTypeAlias, resolveDataField, resolveDateRangeShortcutPreset, resolveDateRangeShortcutPresets, resolveDefaultValuePresentationFormat, resolveEntityLookupPayloadMode, resolveFieldPresentation, resolveGroupedCommandPartialRowSpans, resolveHidden, resolveInlineFilterControlType, resolveInlineFilterControlTypeToBaseControlType, resolveLoggerConfig, resolveObservabilityOptions, resolveOffset, resolveOrder, resolvePraxisCollectionExportItems, resolvePraxisExportFields, resolvePraxisExportScope, resolvePraxisFilterCriteria, resolvePraxisI18nDocument, resolvePraxisMicroVisualizationTone, resolveQuickViewAnchorKey, resolveResourceAvailabilityReasonKey, resolveResourceIdentityContract, resolveSpan, resolveTextMaskFormat, resolveTextMaskFormatFromFieldDefinition, resolveValuePresentation, resolveValuePresentationLocale, resolveWidgetPageLayoutPreset, samePageSourceReference, serializeEntityLookupValueForPayload, serializeOptionSourceFilterRequest, serializePraxisCollectionToCsv, serializePraxisCollectionToExcel, serializePraxisCollectionToJson, slugify, staticDateRangePresetToPreset, stripMasksHook, supportsConfigDocuments, supportsImplicitValuePresentation, syncWithServerMetadata, textSha256, toCamel, toCapitalize, toKebab, toPascal, toSentenceCase, toSnake, toTitleCase, translateResourceAvailabilityReason, translateResourceDiscoveryText, translateSurfaceNavigationRejected, translateSurfaceOpenFailed, translateUnavailableWorkflowMessage, trim, uiLayoutJsonIdentity, uniqueAsyncValidator, upsertNavigationGroupEntry, upsertPageNavigationBinding, urlValidator, validateCanvasArrangement, validateGlobalActionRef, validateGlobalActionRefs, validatePageAuthoringDocument, validatePageSourceReference, validateResourceQuickViewBinding, validateRuntimeNavigationMenuNodes, withFormConfigSections, withMessage, withPraxisHttpLoading };
68390
+ export { API_CONFIG_STORAGE_OPTIONS, API_URL, ASYNC_CONFIG_STORAGE, AllowedFileTypes, AnalyticsPresentationResolver, AnalyticsSchemaContractService, AnalyticsStatsRequestBuilderService, ApiConfigStorage, ApiEndpoint, BUILTIN_PAGE_LAYOUT_PRESETS, BUILTIN_PAGE_THEME_PRESETS, BUILTIN_SHELL_PRESETS, BUILTIN_WIDGET_SHELL_PRESETS, BulkOperationClientService, BulkSyncSession, BulkSyncStateService, COMPONENT_METADATA_REGISTRY_I18N_CONFIG, COMPONENT_METADATA_REGISTRY_I18N_NAMESPACE, CONFIG_STORAGE, CONNECTION_STORAGE, ComponentAuthoringManifestProjectionError, ComponentKeyService, ComponentMetadataRegistry, ComponentRuntimeProfileService, CompositionRuntimeFacade, CompositionValidatorService, ConsoleLoggerSink, CrudOperationResolutionService, DEFAULT_DYNAMIC_FORM_SCHEMA_CACHE_MAX_ENTRIES, DEFAULT_DYNAMIC_FORM_SCHEMA_CACHE_TTL_MS, DEFAULT_FIELD_SELECTOR_CONTROL_TYPE_MAP, DEFAULT_JSON_LOGIC_OPERATORS, DEFAULT_SCHEMA_REQUEST_TIMEOUT_MS, DEFAULT_TABLE_CONFIG, DOMAIN_CATALOG_COMPONENT_CONTEXT_PACK, DOMAIN_CATALOG_CONTEXT_HINT_SCHEMA_VERSION, DYNAMIC_PAGE_AI_CAPABILITIES, DYNAMIC_PAGE_COMPONENT_CONTEXT_PACK, DYNAMIC_PAGE_CONFIG_EDITOR, DYNAMIC_PAGE_SHELL_EDITOR, DefaultLoadingRenderer, DeferredAsyncConfigStorage, DomainCatalogService, DomainKnowledgeService, DomainRuleService, DynamicFormService, DynamicWidgetLoaderDirective, DynamicWidgetPageComponent, EDITORIAL_ALLOWED_CONTENT_FORMATS, EDITORIAL_COMPLIANCE_PRESETS, EDITORIAL_EXTERNAL_LINK_REL, EDITORIAL_FORM_TEMPLATE_CATALOG, EDITORIAL_HTML_ENABLED, EDITORIAL_MARKDOWN_IMAGES_ENABLED, EDITORIAL_SOLUTION_CATALOG, EDITORIAL_SOLUTION_PRESETS, EDITORIAL_THEME_PRESETS, EDITORIAL_WIDGET_CONVENTION_INPUTS, EDITORIAL_WIDGET_TAG, EFFECTIVE_UI_LAYOUT_COMPOSITION_SCHEMA_VERSION, EMPLOYEE_ONBOARDING_EDITORIAL_SOLUTION, EMPLOYEE_ONBOARDING_EDITORIAL_TEMPLATE, EMPLOYEE_ONBOARDING_GUIDED_EDITORIAL_SOLUTION, EMPLOYEE_ONBOARDING_GUIDED_EDITORIAL_TEMPLATE, EVENT_REGISTRATION_EDITORIAL_SOLUTION, EVENT_REGISTRATION_EDITORIAL_TEMPLATE, EffectiveUiLayoutContractError, EffectiveUiLayoutHttpError, EffectiveUiLayoutService, EmptyStateCardComponent, EnterpriseRuntimeContextObsoleteError, EnterpriseRuntimeContextService, ErrorMessageService, FIELD_METADATA_CAPABILITIES, FIELD_SELECTOR_REGISTRY_BASE, FIELD_SELECTOR_REGISTRY_DISABLE_DEFAULTS, FIELD_SELECTOR_REGISTRY_OVERRIDES, FORM_HOOKS, FORM_HOOKS_PRESETS, FORM_HOOKS_WHITELIST, FORM_HOOK_RESOLVERS, FieldControlType, FieldDataType, FieldSelectorRegistry, FormHooksRegistry, GLOBAL_ACTION_CATALOG, GLOBAL_ACTION_HANDLERS, GLOBAL_ACTION_UI_SCHEMAS, GLOBAL_ANALYTICS_SERVICE, GLOBAL_API_CLIENT, GLOBAL_CONFIG, GLOBAL_DIALOG_SERVICE, GLOBAL_ROUTE_GUARD_RESOLVER, GLOBAL_SURFACE_SERVICE, GLOBAL_TOAST_SERVICE, GOVERNED_COLOR_PALETTE_OPTIONS, GOVERNED_PAGE_DEFAULT_ALLOWED_ICONS, GenericCrudService, GlobalActionService, GlobalConfigService, GovernedColorPaletteService, INLINE_FILTER_ALIAS_TOKENS, INLINE_FILTER_CONTROL_TYPES, INLINE_FILTER_CONTROL_TYPE_SET, INLINE_FILTER_CONTROL_TYPE_VALUES, INLINE_FILTER_TOKEN_TO_BASE_CONTROL_TYPE, INLINE_FILTER_TOKEN_TO_CONTROL_TYPE, IconPickerService, IconPosition, IconSize, LOGGER_LEVEL_BY_ENV, LOGGER_LEVEL_PRIORITY, LoadingOrchestrator, LocalConnectionStorage, LocalStorageAsyncAdapter, LocalStorageCacheAdapter, LocalStorageConfigService, LoggerService, LoggerThrottleTracker, LoggerWarnOnceTracker, MemoryCacheAdapter, NestedPortCatalogService, NestedWidgetConfigAccessor, NumericFormat, OVERLAY_DECIDER_DEBUG, OVERLAY_DECISION_MATRIX, ObservabilityDashboardService, OverlayDeciderService, PRAXIS_ACTION_CONTROL_DEFAULTS, PRAXIS_ACTION_CONTROL_VARS, PRAXIS_COLLECTION_EXPORT_HTTP_OPTIONS, PRAXIS_COLLECTION_EXPORT_PROVIDER, PRAXIS_COLLECTION_SEARCH_DEFAULTS, PRAXIS_COLLECTION_SEARCH_VARS, PRAXIS_CORPORATE_SENSITIVE_KEYS, PRAXIS_DEFAULT_EXPORT_SECURITY_POLICY, PRAXIS_DEFAULT_OBSERVABILITY_ALERT_RULES, PRAXIS_DYNAMIC_PAGE_COMPONENT_METADATA, PRAXIS_EFFECTIVE_UI_LAYOUT_OPTIONS, PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_OPTIONS, PRAXIS_ENTERPRISE_RUNTIME_CONTEXT_READY, PRAXIS_EXPORT_FORMULA_PREFIXES, PRAXIS_EXPORT_SECURITY_POLICY, PRAXIS_FOOTER_LINKS_METADATA, PRAXIS_GLOBAL_ACTION_CATALOG, PRAXIS_GLOBAL_CONFIG_BOOTSTRAP_OPTIONS, PRAXIS_GLOBAL_CONFIG_BOOTSTRAP_READY, PRAXIS_GLOBAL_CONFIG_TENANT_RESOLVER, PRAXIS_HERO_BANNER_METADATA, PRAXIS_I18N_CONFIG, PRAXIS_I18N_TRANSLATOR, PRAXIS_JSON_LOGIC_OPERATORS, PRAXIS_LAYER_SCALE_DEFAULTS, PRAXIS_LAYER_SCALE_VARS, PRAXIS_LEGAL_NOTICE_METADATA, PRAXIS_LOADING_CTX, PRAXIS_LOADING_RENDERER, PRAXIS_LOGGER_CONFIG, PRAXIS_LOGGER_SINKS, PRAXIS_OBSERVABILITY_DASHBOARD_OPTIONS, PRAXIS_QUERY_FILTER_EXPRESSION_SCHEMA_VERSION, PRAXIS_QUICK_VIEW_BODY_RENDERER, PRAXIS_QUICK_VIEW_PRESENTER, PRAXIS_RELATED_RESOURCE_OUTLET_AUTHORING_MANIFEST, PRAXIS_RELATED_RESOURCE_OUTLET_COMPONENT_METADATA, PRAXIS_RELATED_RESOURCE_OUTLET_PORTS, PRAXIS_RICH_TEXT_BLOCK_METADATA, PRAXIS_TABLE_DETAIL_INLINE_NODE_RESOLVERS, PRAXIS_TABLE_DETAIL_INLINE_RENDERERS, PRAXIS_TABLE_DETAIL_RESOURCE_RESOLVER, PRAXIS_TELEMETRY_TRANSPORT, PRAXIS_THEME_SURFACE_DEFAULTS, PRAXIS_THEME_SURFACE_VARS, PRAXIS_USER_CONTEXT_SUMMARY_METADATA, PRIVACY_CONSENT_EDITORIAL_SOLUTION, PRIVACY_CONSENT_EDITORIAL_TEMPLATE, PraxisAppShellComponent, PraxisBulkClientService, PraxisCollectionExportService, PraxisCore, PraxisCustomizationModeService, PraxisFooterLinksComponent, PraxisGlobalErrorHandler, PraxisHeroBannerComponent, PraxisHttpCollectionExportProvider, PraxisI18nService, PraxisIconButtonComponent, PraxisIconDirective, PraxisIconPickerComponent, PraxisJsonLogicError, PraxisJsonLogicService, PraxisKeepAliveTabDirective, PraxisLayerScaleStyleService, PraxisLegalNoticeComponent, PraxisLoadingInterceptor, PraxisQuickViewTriggerDirective, PraxisRelatedResourceOutletComponent, PraxisRelatedResourceOutletConfigEditorComponent, PraxisResourceIdentityComponent, PraxisRichTextBlockComponent, PraxisRuntimeComponentObservationRegistryService, PraxisSurfaceHostComponent, PraxisUserContextSummaryComponent, PraxisWidgetEventBus, QUICK_VIEW_EMPLOYEE_BINDING_FIXTURE, QUICK_VIEW_EMPLOYEE_RECORD_FIXTURE, QUICK_VIEW_EMPLOYEE_SCHEMA_FIXTURE, QUICK_VIEW_EMPLOYEE_SURFACES_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_BINDING_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_RECORD_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_SCHEMA_FIXTURE, QUICK_VIEW_SERVICE_COMPONENT_SURFACES_FIXTURE, RESOURCE_DISCOVERY_I18N_CONFIG, RESOURCE_DISCOVERY_I18N_NAMESPACE, RULE_PROPERTY_SCHEMA, RelatedResourceSurfaceResolverService, RemoteConfigStorage, ResourceActionOpenAdapterService, ResourceDiscoveryService, ResourceQuickConnectComponent, ResourceQuickViewService, ResourceRecordOpenError, ResourceRecordOpenService, ResourceSurfaceOpenAdapterService, SCHEMA_METADATA_CLIENT_OPTIONS, SCHEMA_VIEWER_CONTEXT, SETTINGS_EDITOR_SECTIONS_HOSTED, SETTINGS_PANEL_BRIDGE, SETTINGS_PANEL_DATA, STEPPER_CONFIG_EDITOR, SURFACE_DRAWER_BRIDGE, SURFACE_DRAWER_CONTENT_DATA, SURFACE_DRAWER_REF, SURFACE_NAVIGATION_I18N_CONFIG, SURFACE_NAVIGATION_I18N_NAMESPACE, SURFACE_OPEN_I18N_CONFIG, SURFACE_OPEN_I18N_NAMESPACE, SURFACE_OPEN_PRESETS, SafeExpressionEvaluator, SchemaMetadataClient, SchemaNormalizerService, SchemaViewerComponent, SettingsSectionTabsComponent, SurfaceBindingRuntimeService, SurfaceNavigationError, SurfaceOpenActionEditorComponent, SurfaceOpenMaterializerService, SurfaceOutletRegistryService, TABLE_CONFIG_EDITOR, TableConfigService, TelemetryLoggerSink, TelemetryService, UiLayoutLifecycleContractError, UiLayoutLifecycleHttpError, UiLayoutLifecycleService, ValidationPattern, WidgetPageCompositionFactory, WidgetPageDataSourceRuntimeService, WidgetPageStateRuntimeService, WidgetShellComponent, applyDeclarativeValuePipe, applyLocalCustomizations$2 as applyLocalCustomizations, applyLocalCustomizations$1 as applyLocalFormCustomizations, assertPraxisCollectionExportArtifact, assertPraxisRuntimeComponentObservationSerializable, buildAngularValidators, buildApiUrl, buildBaseColumnFromDef, buildBaseFormField, buildFormConfigFromEditorialTemplate, buildGovernedPageTarget, buildHeaders, buildPageKey, buildPraxisActionControlCss, buildPraxisCollectionSearchCss, buildPraxisEffectDistinctKey, buildPraxisLayerScaleCss, buildPraxisThemeSurfaceCss, buildPublishedPageIdentity, buildSchemaId, buildSchemaIdStorageKeySegment, buildValidatorsFromValidatorOptions, calibrateFieldMetadataFromSemantics, canOrganizeFormLayoutBySemantics, cancelIfCpfInvalidHook, canonicalJsonSha256, canonicalJsonStringify, clampRange, classifyEntityLookupResult, cloneBoundedUiLayoutJsonDocument, clonePraxisRuntimeComponentObservation, cloneTableConfig, cloneUiLayoutJsonDocument, cnpjAlphaValidator, collapseWhitespace, composeHeadersWithVersion, conditionalAsyncValidator, containsEphemeralQuickViewRuntimeValue, convertFormLayoutToConfig, copyPageAuthoringDocument, createCorporateLoggerConfig, createCorporateObservabilityOptions, createCpfCnpjValidator, createDefaultFormConfig, createDefaultTableConfig, createDynamicRecord, createEmptyFormConfig, createEmptyNavigationGroupsAuthoringDocument, createEmptyRichContentDocument, createFieldLayoutItem, createPersistedPage, customAsyncValidatorFn, customValidatorFn, debounceAsyncValidator, decodeNavigationGroupsAuthoringDocument, decodePageAuthoringDocument, deepMerge, derivePageChildRuntimeId, domainKnowledgeTimelineToRichContentDocument, domainRuleTimelineToRichContentDocument, encodeNavigationGroupsAuthoringDocument, encodePageAuthoringDocument, ensureIds, ensureNoConflictsHookFactory, ensurePageIds, escapePraxisExportCell, evaluateFieldAccess, extractNormalizedError, extractRecordId, fetchWithETag, fileTypeValidator, fillUndefined, findBuiltinWidgetShellPreset, formIdentityIssues, generateBulkIdempotencyKey, generateId, getDefaultFormHints, getEditorialCompliancePresetById, getEditorialFormTemplateById, getEditorialFormTemplateCatalog, getEditorialSolutionById, getEditorialSolutionCatalog, getEditorialSolutionPresetById, getEditorialThemePresetById, getEssentialConfig, getFieldMetadataCapabilities, getFormColumnFieldNames, getFormLayoutFieldNames, getGlobalActionCatalog, getGlobalActionPayloadActualType, getGlobalActionPayloadTypeIssue, getGlobalActionProviderEvidence, getGlobalActionUiSchema, getMissingGlobalActionPayloadKeys, getPraxisTableCellVisualizationConstraint, getPraxisTableCellVisualizationGuidance, getReferencedFieldMetadata, getRequiredGlobalActionPayloadKeys, getTextTransformer, getWidgetShellActionIdError, hasMeaningfulGlobalActionPayloadValue, hasPraxisCollectionExportArtifact, hasSemanticFieldCalibrationDiff, humanizeCatalogFieldName, inferDomainSemanticHexColor, inferDomainSemanticIcon, inferDomainSemanticTone, inferSemanticFieldControlType, inferSemanticFieldGroup, inferSemanticFieldWidth, interpolatePraxisTranslation, isAllowedEditorialContentFormat, isAllowedEditorialHref, isBulkExecutionTerminal, isCssTextTransform, isDomainRuleSnapshotProblemResponse, isDynamicDataRecord, isEditorialComponentMeta, isEntityLookupMultiplePayloadMode, isEntityLookupPayloadMode, isEntityLookupPayloadModeCompatible, isEntityLookupResultSelectable, isEntityLookupSinglePayloadMode, isFormLayoutItem, isGlobalActionProviderOperational, isGlobalActionRef, isGovernedPageUuid, isInlineFilterControlType, isLookupDialogSize, isLookupFilterFieldType, isLookupFilterOperator, isPraxisI18nMessageDescriptor, isPraxisPresentationVisualizationTableSafe, isPraxisRuntimeGlobalActionEffect, isProgrammaticDateRangePreset, isRangeValidForFilter, isRequiredGlobalActionParamPayloadMissing, isRequiredGlobalActionPayloadMissing, isResourceQuickViewAnchorValid, isStaticDateRangePreset, isSurfaceNavigationError, isTableConfigV2, isUnresolvedTemplateToken, isValidFormConfig, isValidTableConfig, legacyCnpjValidator, legacyCpfValidator, logOnErrorHook, mapCatalogFieldsToMetadata, mapFieldDefinitionToMetadata, mapFieldDefinitionsToMetadata, markGlobalActionProviderOperational, matchFieldValidator, materializeFormLayoutFromMetadata, materializeGovernedPagePreview, materializeGovernedPaletteColors, materializeGovernedPaletteEntries, materializeResourceIdentity, maxFileSizeValidator, mergeFieldMetadata, mergePraxisI18nConfigs, mergeTableConfigs, migrateFormLayoutRule, migrateLegacyCompositionLink, migrateLegacyCompositionLinks, minWordsValidator, nestedPortPathIdentity, normalizeCardMediaAspectRatio, normalizeColumnRendererQuickView, normalizeControlTypeKey, normalizeControlTypeToken, normalizeEditorialLink, normalizeEnd, normalizeFieldAccessMetadata, normalizeFieldConstraints, normalizeFieldPresentation, normalizeFormConfig, normalizeFormLayoutItems, normalizeFormMetadata, normalizeGlobalActionRef$1 as normalizeGlobalActionRef, normalizeLayoutPolicy, normalizeLookupFilterRequest, normalizePath, normalizePraxisDataQueryContext, normalizePraxisEffectPolicy, normalizePraxisIconLigature, normalizePraxisPresentationVisualization, normalizePraxisQueryFilterExpression, normalizePraxisQueryFilterNode, normalizeReactiveDeterminations, normalizeResourceAvailabilityReasonCode, normalizeResourceIdentityContract, normalizeResourceQuickViewBinding, normalizeResourceRecordOpenReference, normalizeScalarArrayValue, normalizeStart, normalizeSurfaceOperationContext, normalizeUnknownError, normalizeWidgetEventPath, notifySuccessHook, organizeFormLayoutBySemantics, parseJsonResponseOrEmpty, praxisLoadingInterceptorFn, prefillFromContextHook, prepareCanvasArrangement, projectComponentAuthoringManifest, projectGroupedCommandPartialRows, provideDefaultFormHooks, provideFieldSelectorRegistryBase, provideFieldSelectorRegistryOverride, provideFieldSelectorRegistryRuntime, provideFormHookPresets, provideFormHooks, provideGlobalActionCatalog, provideGlobalActionHandler, provideGlobalConfig, provideGlobalConfigReady, provideGlobalConfigSeed, provideGlobalConfigTenant, provideHookResolvers, provideHookWhitelist, provideOverlayDecisionMatrix, providePraxisAnalyticsGlobalActions, providePraxisCollectionExportProvider, providePraxisDynamicPageMetadata, providePraxisEnterpriseRuntimeContext, providePraxisFooterLinksMetadata, providePraxisGlobalActionCatalog, providePraxisGlobalActions, providePraxisGlobalConfigBootstrap, providePraxisHeroBannerMetadata, providePraxisHttpCollectionExportProvider, providePraxisHttpLoading, providePraxisI18n, providePraxisI18nConfig, providePraxisI18nTranslator, providePraxisIconDefaults, providePraxisJsonLogicOperator, providePraxisJsonLogicOperatorOverride, providePraxisLegalNoticeMetadata, providePraxisLoadingDefaults, providePraxisLogging, providePraxisRelatedResourceOutletMetadata, providePraxisRichTextBlockMetadata, providePraxisTelemetry, providePraxisToastGlobalActions, providePraxisUserContextSummaryMetadata, provideRemoteGlobalConfig, readPraxisExportValue, readStrongResourceEtag, reconcileFieldQuickViewBinding, reconcileFilterConfig, reconcileFormConfig, reconcileTableConfig, registerPraxisRuntimeComponentObservation, removeDiacritics, renderPraxisPresentationVisualizationHtml, reportTelemetryHookFactory, requiredCheckedValidator, requiredPresenceValidator, resolveBuiltinPresets, resolveBuiltinWidgetShellAppearance, resolveColumnTypeFromFieldDefinition, resolveControlTypeAlias, resolveDataField, resolveDateRangeShortcutPreset, resolveDateRangeShortcutPresets, resolveDefaultValuePresentationFormat, resolveEntityLookupPayloadMode, resolveFieldPresentation, resolveFieldQuickViewBinding, resolveGroupedCommandPartialRowSpans, resolveHidden, resolveInlineFilterControlType, resolveInlineFilterControlTypeToBaseControlType, resolveLoggerConfig, resolveObservabilityOptions, resolveOffset, resolveOrder, resolvePraxisCollectionExportItems, resolvePraxisExportFields, resolvePraxisExportScope, resolvePraxisFilterCriteria, resolvePraxisI18nDocument, resolvePraxisMicroVisualizationTone, resolveQuickViewAnchorKey, resolveResourceAvailabilityReasonKey, resolveResourceIdentityContract, resolveResourceQuickViewTarget, resolveSpan, resolveTextMaskFormat, resolveTextMaskFormatFromFieldDefinition, resolveValuePresentation, resolveValuePresentationLocale, resolveWidgetPageLayoutPreset, samePageSourceReference, serializeEntityLookupValueForPayload, serializeOptionSourceFilterRequest, serializePraxisCollectionToCsv, serializePraxisCollectionToExcel, serializePraxisCollectionToJson, slugify, staticDateRangePresetToPreset, stripMasksHook, supportsConfigDocuments, supportsImplicitValuePresentation, syncWithServerMetadata, textSha256, toCamel, toCapitalize, toKebab, toPascal, toSentenceCase, toSnake, toTitleCase, translateResourceAvailabilityReason, translateResourceDiscoveryText, translateSurfaceNavigationRejected, translateSurfaceOpenFailed, translateUnavailableWorkflowMessage, trim, uiLayoutJsonIdentity, uniqueAsyncValidator, upsertNavigationGroupEntry, upsertPageNavigationBinding, urlValidator, validateCanvasArrangement, validateGlobalActionRef, validateGlobalActionRefs, validatePageAuthoringDocument, validatePageSourceReference, validateResourceQuickViewBinding, validateRuntimeNavigationMenuNodes, withFormConfigSections, withMessage, withPraxisHttpLoading };