sass-cms-template-common 0.0.13 → 0.0.15
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.
- package/dist/index.d.ts +395 -28
- package/dist/index.js +1802 -1372
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +112 -0
- package/dist/server.js +2 -2
- package/dist/{services-DS4p6Tpl.js → services-BQ1IbdWe.js} +234 -88
- package/dist/services-BQ1IbdWe.js.map +1 -0
- package/package.json +1 -1
- package/dist/services-DS4p6Tpl.js.map +0 -1
package/dist/server.d.ts
CHANGED
|
@@ -326,6 +326,22 @@ export declare interface CkeditorPrompt {
|
|
|
326
326
|
[key: string]: unknown;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
export declare interface ClassifiedNetworkError {
|
|
330
|
+
errorCode: NetworkErrorCode;
|
|
331
|
+
/** Si conviene reintentar la petición. */
|
|
332
|
+
retryable: boolean;
|
|
333
|
+
/** Mensaje crudo del error original (para el detalle copiable del toast). */
|
|
334
|
+
error: string;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Clasifica una excepción (error de axios en el servidor, o `TypeError:
|
|
339
|
+
* Failed to fetch` del navegador al invocar un server action) como error de
|
|
340
|
+
* red/servidor. Devuelve `null` si NO es un error de red (p. ej. un 4xx o una
|
|
341
|
+
* excepción de lógica): el caller lo trata entonces como error de negocio.
|
|
342
|
+
*/
|
|
343
|
+
export declare function classifyNetworkError(error: unknown): ClassifiedNetworkError | null;
|
|
344
|
+
|
|
329
345
|
/**
|
|
330
346
|
* Servicios HTTP del módulo `audios` del CMS (solo endpoints JSON POST).
|
|
331
347
|
*
|
|
@@ -731,6 +747,44 @@ export declare class CmsImagesServices {
|
|
|
731
747
|
getImageComparation: (image: ImageComparationPair) => Promise<ImageComparationResponse>;
|
|
732
748
|
}
|
|
733
749
|
|
|
750
|
+
/**
|
|
751
|
+
* Singleton que conecta el interceptor de axios con el provider de red. El
|
|
752
|
+
* provider llama `register` al montar y `unregister` al desmontar; el
|
|
753
|
+
* interceptor usa los métodos (con fallback seguro si no hay provider).
|
|
754
|
+
*/
|
|
755
|
+
export declare const cmsNetworkBridge: {
|
|
756
|
+
register(next: CmsNetworkBridgeHandlers): void;
|
|
757
|
+
unregister(): void;
|
|
758
|
+
/** `true` si hay un `CmsNetworkProvider` montado escuchando. */
|
|
759
|
+
readonly isRegistered: boolean;
|
|
760
|
+
reportOffline(): void;
|
|
761
|
+
waitForOnline(): Promise<void>;
|
|
762
|
+
verifyConnectivity(): Promise<boolean>;
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Puente entre el interceptor de axios (un módulo, sin React) y el
|
|
767
|
+
* `CmsNetworkProvider` (React). Replica el rol del `NetworkService` que se
|
|
768
|
+
* inyecta en el `NetworkInterceptor` del Angular legacy: el interceptor no
|
|
769
|
+
* puede usar hooks, así que el provider registra aquí sus funciones y el
|
|
770
|
+
* interceptor las consume.
|
|
771
|
+
*
|
|
772
|
+
* Módulo **server-safe** (sin React, sin `'use client'`): así lo puede importar
|
|
773
|
+
* el `lib/http/axios.ts` del gestor —que corre tanto en cliente como en
|
|
774
|
+
* servidor— sin arrastrar componentes cliente. En el servidor el bridge queda
|
|
775
|
+
* sin registrar (no hay provider) y `resumeAxiosOnNetworkError` re-lanza el
|
|
776
|
+
* error para que lo maneje el server action (`toCmsError`).
|
|
777
|
+
*/
|
|
778
|
+
/** Funciones que el `CmsNetworkProvider` registra para el interceptor. */
|
|
779
|
+
export declare interface CmsNetworkBridgeHandlers {
|
|
780
|
+
/** Marca la conexión como offline de inmediato (dispara el toast). */
|
|
781
|
+
reportOffline: () => void;
|
|
782
|
+
/** Resuelve cuando la conexión vuelve (confirmada por el ping/eventos). */
|
|
783
|
+
waitForOnline: () => Promise<void>;
|
|
784
|
+
/** Confirma por ping si hay internet real. `true` = online. */
|
|
785
|
+
verifyConnectivity: () => Promise<boolean>;
|
|
786
|
+
}
|
|
787
|
+
|
|
734
788
|
/**
|
|
735
789
|
* Servicios HTTP del módulo `news` del CMS (core + publish, unpublish, pin,
|
|
736
790
|
* massive, freshness, views y analytics).
|
|
@@ -2130,6 +2184,14 @@ export declare function getCommonError(errorCode: string | number | Array<string
|
|
|
2130
2184
|
|
|
2131
2185
|
export declare function getDefaultPublicationSlug(sites: SiteSection[]): string;
|
|
2132
2186
|
|
|
2187
|
+
/**
|
|
2188
|
+
* Si un resultado ya devuelto por un server action es un envelope de error con
|
|
2189
|
+
* un código de red (`{ status: 'error', errorCode: 'net.*' }`), devuelve ese
|
|
2190
|
+
* código; si no, `null`. Permite reintentar cuando el fallo de red se detectó
|
|
2191
|
+
* en el servidor (Next→OpenCms) y viajó como `CmsResponse`.
|
|
2192
|
+
*/
|
|
2193
|
+
export declare function getNetworkErrorCodeFromResult(result: unknown): NetworkErrorCode | null;
|
|
2194
|
+
|
|
2133
2195
|
/**
|
|
2134
2196
|
* Hora actual del sitio (equivalente al `getFormattedRedactionTimeUTC` del CMS
|
|
2135
2197
|
* Angular): "ahora" formateado en la zona de redacción de la publicación.
|
|
@@ -2517,6 +2579,12 @@ declare interface ISitesServices {
|
|
|
2517
2579
|
authentication: Authentication;
|
|
2518
2580
|
}
|
|
2519
2581
|
|
|
2582
|
+
/** `true` si el código dado es uno de los códigos internos de red. */
|
|
2583
|
+
export declare function isNetworkErrorCode(code: string | null | undefined): boolean;
|
|
2584
|
+
|
|
2585
|
+
/** `true` si un código de red debe reintentarse. */
|
|
2586
|
+
export declare function isRetryableNetworkCode(code: string | null | undefined): boolean;
|
|
2587
|
+
|
|
2520
2588
|
declare interface ITagsServices {
|
|
2521
2589
|
axiosApi: AxiosInstance;
|
|
2522
2590
|
authentication: Authentication;
|
|
@@ -2590,8 +2658,28 @@ export declare type NavLinkItem = {
|
|
|
2590
2658
|
accent?: 'ai';
|
|
2591
2659
|
/** Si el href apunta al admin legacy (JSP/Angular), se prefija con `legacyBaseUrl`. */
|
|
2592
2660
|
legacy?: boolean;
|
|
2661
|
+
/**
|
|
2662
|
+
* Si la ruta del Angular master exige el id de publicación al final
|
|
2663
|
+
* (p. ej. `/admin/tags/:idPub`, `/admin/planning/:idPub`), se le agrega
|
|
2664
|
+
* `selectedPublicationId`. Solo aplica junto con `legacy`.
|
|
2665
|
+
*/
|
|
2666
|
+
appendPublicationId?: boolean;
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
/** Códigos internos de error de red/servidor (no son del CMS). */
|
|
2670
|
+
export declare const NETWORK_ERROR_CODES: {
|
|
2671
|
+
/** Sin conexión a internet (no se pudo alcanzar el servidor). */
|
|
2672
|
+
readonly offline: "net.offline";
|
|
2673
|
+
/** La petición excedió el timeout. */
|
|
2674
|
+
readonly timeout: "net.timeout";
|
|
2675
|
+
/** El backend no responde (502/503/504). */
|
|
2676
|
+
readonly unavailable: "net.unavailable";
|
|
2677
|
+
/** Error interno del servidor (5xx genérico). */
|
|
2678
|
+
readonly server: "net.server";
|
|
2593
2679
|
};
|
|
2594
2680
|
|
|
2681
|
+
export declare type NetworkErrorCode = (typeof NETWORK_ERROR_CODES)[keyof typeof NETWORK_ERROR_CODES];
|
|
2682
|
+
|
|
2595
2683
|
/** Cuerpo de la respuesta de POST /news/edit/adminNewsConfiguration. */
|
|
2596
2684
|
export declare interface NewsAdminConfigurationResponse extends CmsResponse {
|
|
2597
2685
|
[key: string]: unknown;
|
|
@@ -4172,6 +4260,30 @@ export declare interface RecipesPublishCheckResponse extends CmsResponse {
|
|
|
4172
4260
|
/** Devuelve la severidad de toast para un código de error (`warning`/`error`). */
|
|
4173
4261
|
export declare function resolveErrorSeverity(errorCode: string | number | Array<string | number> | null | undefined): CmsErrorSeverity;
|
|
4174
4262
|
|
|
4263
|
+
/**
|
|
4264
|
+
* Da resiliencia de red a una petición de axios, replicando el
|
|
4265
|
+
* `NetworkInterceptor` del Angular legacy. Pensado para el `onRejected` del
|
|
4266
|
+
* interceptor de respuesta de axios del gestor:
|
|
4267
|
+
*
|
|
4268
|
+
* ```ts
|
|
4269
|
+
* api.interceptors.response.use(
|
|
4270
|
+
* (r) => r,
|
|
4271
|
+
* (error) => resumeAxiosOnNetworkError(error, (config) => api.request(config)),
|
|
4272
|
+
* );
|
|
4273
|
+
* ```
|
|
4274
|
+
*
|
|
4275
|
+
* - **En el servidor, o no es error de red, o no hay provider montado** →
|
|
4276
|
+
* re-lanza el error (lo maneja el caller / `toCmsError`).
|
|
4277
|
+
* - **Sin internet** (el navegador reporta offline, o el ping confirma que no
|
|
4278
|
+
* hay salida real, p. ej. `ERR_NAME_NOT_RESOLVED`): muestra "sin conexión"
|
|
4279
|
+
* (vía el provider), arranca el ping y, al volver la conexión, **reintenta**
|
|
4280
|
+
* la petición (retoma el servicio).
|
|
4281
|
+
* - **Con internet** (el caído era el backend: 5xx/timeout): re-lanza sin
|
|
4282
|
+
* reintentar, para no repetir a ciegas un POST. Ese caso lo cubre
|
|
4283
|
+
* `useResilientAction`/`toCmsError` en las mutaciones envueltas.
|
|
4284
|
+
*/
|
|
4285
|
+
export declare function resumeAxiosOnNetworkError<T = unknown>(error: unknown, reAttempt: (config: unknown) => Promise<T>): Promise<T>;
|
|
4286
|
+
|
|
4175
4287
|
/** Sección de una publicación del CMS (forma devuelta por get/exist). */
|
|
4176
4288
|
export declare interface Section {
|
|
4177
4289
|
id?: number;
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, I as s, J as c, K as l, L as u, M as d, N as f, O as p, P as m, Q as h, R as g, S as _, T as v, V as y, X as b, Y as x, Z as S, _ as C, a as w,
|
|
2
|
-
export { i as CmsAudiosServices, t as CmsAuthLoginServices, o as CmsAuthServices, a as CmsCategoriesServices, v as CmsCkeditorServices, r as CmsCommentsServices,
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, I as s, J as c, K as l, L as u, M as d, N as f, O as p, P as m, Q as h, R as g, S as _, T as v, V as y, X as b, Y as x, Z as S, _ as C, a as w, at as T, b as E, c as D, ct as O, d as k, et as A, f as j, g as M, h as N, i as P, it as F, j as I, k as L, l as R, lt as z, m as B, n as V, nt as H, o as U, ot as W, p as G, q as K, r as q, rt as J, s as Y, st as X, t as Z, tt as Q, u as $, ut as ee, v as te, w as ne, x as re, y as ie, z as ae } from "./services-BQ1IbdWe.js";
|
|
2
|
+
export { i as CmsAudiosServices, t as CmsAuthLoginServices, o as CmsAuthServices, a as CmsCategoriesServices, v as CmsCkeditorServices, r as CmsCommentsServices, Z as CmsCommonServices, _ as CmsContributionsServices, ne as CmsCopilotServices, m as CmsDashboardServices, ie as CmsEventsServices, te as CmsFileExplorerServices, C as CmsGeneralServices, M as CmsImagesServices, N as CmsNewsServices, B as CmsNotificationServices, G as CmsPeopleServices, j as CmsPlanningServices, k as CmsPollsServices, p as CmsPreviewServices, E as CmsProductivityPlanServices, f as CmsProfileServices, d as CmsPublicationsServices, $ as CmsRecipesServices, re as CmsSectionsServices, I as CmsSitesServices, V as CmsTagsServices, q as CmsTranscribeServices, P as CmsTriviasServices, L as CmsUploadServices, R as CmsUsersServices, w as CmsVideosServices, U as CmsVodsServices, Y as CmsWorkpaperServices, D as CmsZonesServices, A as NETWORK_ERROR_CODES, Q as classifyNetworkError, h as cmsNetworkBridge, ee as commonErrorsEn, z as commonErrorsEs, O as commonErrorsPt, s as filterModulesByPermissions, l as findPublicationBySlug, K as findPublicationLabel, g as formatSiteDateTime, c as getAllPublications, T as getCommonError, x as getDefaultPublicationSlug, H as getNetworkErrorCodeFromResult, ae as getSiteNow, u as hasModulePermission, J as isNetworkErrorCode, F as isRetryableNetworkCode, W as normalizeErrorCode, n as parseGmtOffsetMinutes, b as parsePublicationSlug, X as resolveErrorSeverity, e as resumeAxiosOnNetworkError, y as toSiteWallClock, S as toTestId };
|