@praxisui/core 8.0.0-beta.71 → 8.0.0-beta.73

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.
@@ -4304,7 +4304,7 @@ class GenericCrudService {
4304
4304
  // Absolute HTTP/HTTPS URL
4305
4305
  let url = customUserEndpoint.replace(/\/+$/, '');
4306
4306
  if ((operation === 'getById' || operation === 'update' || operation === 'delete') && id !== undefined && id !== null) {
4307
- url += `/${id}`;
4307
+ url = this.resolveEntityEndpointTemplate(url, id);
4308
4308
  }
4309
4309
  return url;
4310
4310
  }
@@ -4314,7 +4314,7 @@ class GenericCrudService {
4314
4314
  let url = `${baseApiUrl}/${endpoint}`;
4315
4315
  url = url.replace(/\/+$/, '');
4316
4316
  if ((operation === 'getById' || operation === 'update' || operation === 'delete') && id !== undefined && id !== null) {
4317
- url += `/${id}`;
4317
+ url = this.resolveEntityEndpointTemplate(url, id);
4318
4318
  }
4319
4319
  return url;
4320
4320
  }
@@ -4364,6 +4364,13 @@ class GenericCrudService {
4364
4364
  throw new Error(`Unknown operation: ${operation}`);
4365
4365
  }
4366
4366
  }
4367
+ resolveEntityEndpointTemplate(url, id) {
4368
+ const encodedId = encodeURIComponent(String(id));
4369
+ if (url.includes('{id}') || /:id\b/.test(url)) {
4370
+ return url.replace(/\{id\}/g, encodedId).replace(/:id\b/g, encodedId);
4371
+ }
4372
+ return `${url}/${encodedId}`;
4373
+ }
4367
4374
  getResourceBaseUrl(options) {
4368
4375
  const url = this.getEndpointUrl('filter', undefined, options?.parentPath, options?.endpointKey);
4369
4376
  return url.replace(/\/filter$/, '');
@@ -11906,6 +11913,12 @@ class ResourceSurfaceOpenAdapterService {
11906
11913
  apiEndpointKey: options.endpointKey ?? null,
11907
11914
  apiUrlEntry: options.apiUrlEntry ?? (discoveryOptions ? this.discovery.resolveApiEntry(discoveryOptions) : null),
11908
11915
  };
11916
+ if (surface.scope === 'ITEM' && this.isReadableFormSurface(surface.kind)) {
11917
+ payload.widget.inputs['customEndpoints'] = {
11918
+ ...(payload.widget.inputs['customEndpoints'] || {}),
11919
+ getById: this.discovery.resolveHref(surface.path, discoveryOptions),
11920
+ };
11921
+ }
11909
11922
  if (this.isWritableFormSurface(surface.kind)) {
11910
11923
  payload.widget.inputs['submitMethod'] = surface.method.toLowerCase();
11911
11924
  payload.widget.inputs['submitUrl'] = resolvedSubmitUrl;
@@ -11957,6 +11970,9 @@ class ResourceSurfaceOpenAdapterService {
11957
11970
  isWritableFormSurface(kind) {
11958
11971
  return kind === 'FORM' || kind === 'PARTIAL_FORM';
11959
11972
  }
11973
+ isReadableFormSurface(kind) {
11974
+ return kind === 'VIEW' || kind === 'READ_PROJECTION';
11975
+ }
11960
11976
  buildIdBinding(idBindingPath) {
11961
11977
  return {
11962
11978
  from: idBindingPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisui/core",
3
- "version": "8.0.0-beta.71",
3
+ "version": "8.0.0-beta.73",
4
4
  "description": "Core library for Praxis UI Workspace: types, tokens, services and utilities shared across @praxisui/* packages.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
@@ -5048,6 +5048,7 @@ declare class GenericCrudService<T, ID extends string | number = string | number
5048
5048
  * @throws Error quando o ID é obrigatório mas não fornecido, ou quando o serviço não está configurado
5049
5049
  */
5050
5050
  private getEndpointUrl;
5051
+ private resolveEntityEndpointTemplate;
5051
5052
  private getResourceBaseUrl;
5052
5053
  /**
5053
5054
  * Resolve `/schemas/filtered` base URL honoring ApiUrlConfig (supports APIs on another origin).
@@ -8954,6 +8955,7 @@ declare class ResourceSurfaceOpenAdapterService {
8954
8955
  private resolveFormMode;
8955
8956
  private isCollectionView;
8956
8957
  private isWritableFormSurface;
8958
+ private isReadableFormSurface;
8957
8959
  private buildIdBinding;
8958
8960
  private clone;
8959
8961
  static ɵfac: i0.ɵɵFactoryDeclaration<ResourceSurfaceOpenAdapterService, never>;