@selfhelp/shared 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +7 -1
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
- package/src/api/__tests__/endpoints.test.ts +23 -0
- package/src/api/endpoints.ts +7 -0
- package/src/types/api/__tests__/page-routing.test.ts +110 -0
- package/src/types/api/page.ts +7 -0
- package/src/types/pages.ts +27 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,19 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
9
9
|
|
|
10
10
|
This project follows semantic versioning.
|
|
11
11
|
|
|
12
|
+
## v1.18.0
|
|
13
|
+
|
|
14
|
+
**DB-driven public routing types (issue #30)** — additive contracts for the new
|
|
15
|
+
backend public-routing resolver. `IPageContent` (`src/types/pages.ts`) gains the
|
|
16
|
+
optional route metadata `route_params` (`Record<string, string>`),
|
|
17
|
+
`matched_url_pattern`, and `canonical_url`; a new `IResolvePageResponse`
|
|
18
|
+
(`src/types/api/page.ts`) types the `GET /cms-api/v1/pages/resolve` payload; and
|
|
19
|
+
`PAGES.RESOLVE` is added to the endpoint registry (`src/api/endpoints.ts`). The
|
|
20
|
+
resolved dynamic URL params surface to interpolation as `{{route.<snake_case>}}`.
|
|
21
|
+
|
|
22
|
+
All additions are optional/new, so `^1.x` consumers are unaffected. Pairs with
|
|
23
|
+
core `0.1.31`, frontend `0.1.57`, and mobile `0.1.31`.
|
|
24
|
+
|
|
12
25
|
## v1.17.1
|
|
13
26
|
|
|
14
27
|
**`IShowUserInputStyle.field_labels`** — adds the optional header map
|
package/dist/index.d.mts
CHANGED
|
@@ -74,8 +74,34 @@ interface IPageContent {
|
|
|
74
74
|
footer_position: number | null;
|
|
75
75
|
title?: string | null;
|
|
76
76
|
description?: string | null;
|
|
77
|
+
/**
|
|
78
|
+
* Snake_case route params extracted from the matched public URL pattern
|
|
79
|
+
* (e.g. `{ user_id: '42', token: 'abc' }` or `{ record_id: '7' }`). Present
|
|
80
|
+
* only when the page was resolved via `GET /pages/resolve`. Backend also
|
|
81
|
+
* exposes these to interpolation as `{{route.<name>}}`.
|
|
82
|
+
*/
|
|
83
|
+
route_params?: Record<string, string>;
|
|
84
|
+
/** The `page_routes` pattern that matched (e.g. `/reset/{user_id}/{token}`). Resolve responses only. */
|
|
85
|
+
matched_url_pattern?: string | null;
|
|
86
|
+
/** The canonical active route pattern for the page, for canonical-link generation. Resolve responses only. */
|
|
87
|
+
canonical_url?: string | null;
|
|
77
88
|
sections: IPageSectionWithFields[];
|
|
78
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* A public, parameterized route contract for a CMS page (issue #30). Mirrors a
|
|
92
|
+
* backend `page_routes` row. `path_pattern` uses Symfony route syntax
|
|
93
|
+
* (`/team/{record_id}`) and `requirements` maps each placeholder to a regex
|
|
94
|
+
* (`{ record_id: '\\d+' }`). Param names are snake_case and are NEVER remapped
|
|
95
|
+
* on export/import. Used by the admin page-routes editor and page export/import.
|
|
96
|
+
*/
|
|
97
|
+
interface IPageRoute {
|
|
98
|
+
id?: number;
|
|
99
|
+
path_pattern: string;
|
|
100
|
+
requirements?: Record<string, string> | null;
|
|
101
|
+
is_canonical: boolean;
|
|
102
|
+
is_active: boolean;
|
|
103
|
+
priority: number;
|
|
104
|
+
}
|
|
79
105
|
interface IPageFieldTranslation {
|
|
80
106
|
language_id: number;
|
|
81
107
|
language_code: string;
|
|
@@ -370,6 +396,14 @@ type IGetPageResponse = IBaseApiResponse<{
|
|
|
370
396
|
page: IPageContent;
|
|
371
397
|
}>;
|
|
372
398
|
type IGetPagesResponse = IBaseApiResponse<IPageItem[]>;
|
|
399
|
+
/**
|
|
400
|
+
* Response of `GET /cms-api/v1/pages/resolve?path=...` (issue #30). Identical
|
|
401
|
+
* envelope to {@link IGetPageResponse}; the resolved `page` additionally carries
|
|
402
|
+
* `route_params`, `matched_url_pattern`, and `canonical_url`.
|
|
403
|
+
*/
|
|
404
|
+
type IResolvePageResponse = IBaseApiResponse<{
|
|
405
|
+
page: IPageContent;
|
|
406
|
+
}>;
|
|
373
407
|
|
|
374
408
|
/**
|
|
375
409
|
* System maintenance / update contracts (SelfHelp Manager <-> CMS <-> admin UI).
|
|
@@ -1705,6 +1739,12 @@ declare const ENDPOINTS: {
|
|
|
1705
1739
|
readonly LIST_WITH_LANGUAGE: (languageId: number) => string;
|
|
1706
1740
|
readonly BY_KEYWORD: (keyword: string) => string;
|
|
1707
1741
|
readonly BY_ID: (pageId: number) => string;
|
|
1742
|
+
/**
|
|
1743
|
+
* DB-driven public path resolution (issue #30): maps a full public URL
|
|
1744
|
+
* path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
|
|
1745
|
+
* params. `path` is sent URL-encoded as a query parameter.
|
|
1746
|
+
*/
|
|
1747
|
+
readonly RESOLVE: (path: string) => string;
|
|
1708
1748
|
};
|
|
1709
1749
|
readonly LANGUAGES: "/cms-api/v1/languages";
|
|
1710
1750
|
readonly FORMS: {
|
|
@@ -2040,4 +2080,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
2040
2080
|
*/
|
|
2041
2081
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
2042
2082
|
|
|
2043
|
-
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewColorScheme, type TPreviewFrameSource, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, arePreviewPreferencesEqual, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, isPreviewBridgeMessage, parseInlineRich, parseSpacing, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
|
|
2083
|
+
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageRoute, type IPageSectionWithFields, type IPageSectionsData, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type IResolvePageResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewColorScheme, type TPreviewFrameSource, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, arePreviewPreferencesEqual, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, isPreviewBridgeMessage, parseInlineRich, parseSpacing, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,8 +74,34 @@ interface IPageContent {
|
|
|
74
74
|
footer_position: number | null;
|
|
75
75
|
title?: string | null;
|
|
76
76
|
description?: string | null;
|
|
77
|
+
/**
|
|
78
|
+
* Snake_case route params extracted from the matched public URL pattern
|
|
79
|
+
* (e.g. `{ user_id: '42', token: 'abc' }` or `{ record_id: '7' }`). Present
|
|
80
|
+
* only when the page was resolved via `GET /pages/resolve`. Backend also
|
|
81
|
+
* exposes these to interpolation as `{{route.<name>}}`.
|
|
82
|
+
*/
|
|
83
|
+
route_params?: Record<string, string>;
|
|
84
|
+
/** The `page_routes` pattern that matched (e.g. `/reset/{user_id}/{token}`). Resolve responses only. */
|
|
85
|
+
matched_url_pattern?: string | null;
|
|
86
|
+
/** The canonical active route pattern for the page, for canonical-link generation. Resolve responses only. */
|
|
87
|
+
canonical_url?: string | null;
|
|
77
88
|
sections: IPageSectionWithFields[];
|
|
78
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* A public, parameterized route contract for a CMS page (issue #30). Mirrors a
|
|
92
|
+
* backend `page_routes` row. `path_pattern` uses Symfony route syntax
|
|
93
|
+
* (`/team/{record_id}`) and `requirements` maps each placeholder to a regex
|
|
94
|
+
* (`{ record_id: '\\d+' }`). Param names are snake_case and are NEVER remapped
|
|
95
|
+
* on export/import. Used by the admin page-routes editor and page export/import.
|
|
96
|
+
*/
|
|
97
|
+
interface IPageRoute {
|
|
98
|
+
id?: number;
|
|
99
|
+
path_pattern: string;
|
|
100
|
+
requirements?: Record<string, string> | null;
|
|
101
|
+
is_canonical: boolean;
|
|
102
|
+
is_active: boolean;
|
|
103
|
+
priority: number;
|
|
104
|
+
}
|
|
79
105
|
interface IPageFieldTranslation {
|
|
80
106
|
language_id: number;
|
|
81
107
|
language_code: string;
|
|
@@ -370,6 +396,14 @@ type IGetPageResponse = IBaseApiResponse<{
|
|
|
370
396
|
page: IPageContent;
|
|
371
397
|
}>;
|
|
372
398
|
type IGetPagesResponse = IBaseApiResponse<IPageItem[]>;
|
|
399
|
+
/**
|
|
400
|
+
* Response of `GET /cms-api/v1/pages/resolve?path=...` (issue #30). Identical
|
|
401
|
+
* envelope to {@link IGetPageResponse}; the resolved `page` additionally carries
|
|
402
|
+
* `route_params`, `matched_url_pattern`, and `canonical_url`.
|
|
403
|
+
*/
|
|
404
|
+
type IResolvePageResponse = IBaseApiResponse<{
|
|
405
|
+
page: IPageContent;
|
|
406
|
+
}>;
|
|
373
407
|
|
|
374
408
|
/**
|
|
375
409
|
* System maintenance / update contracts (SelfHelp Manager <-> CMS <-> admin UI).
|
|
@@ -1705,6 +1739,12 @@ declare const ENDPOINTS: {
|
|
|
1705
1739
|
readonly LIST_WITH_LANGUAGE: (languageId: number) => string;
|
|
1706
1740
|
readonly BY_KEYWORD: (keyword: string) => string;
|
|
1707
1741
|
readonly BY_ID: (pageId: number) => string;
|
|
1742
|
+
/**
|
|
1743
|
+
* DB-driven public path resolution (issue #30): maps a full public URL
|
|
1744
|
+
* path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
|
|
1745
|
+
* params. `path` is sent URL-encoded as a query parameter.
|
|
1746
|
+
*/
|
|
1747
|
+
readonly RESOLVE: (path: string) => string;
|
|
1708
1748
|
};
|
|
1709
1749
|
readonly LANGUAGES: "/cms-api/v1/languages";
|
|
1710
1750
|
readonly FORMS: {
|
|
@@ -2040,4 +2080,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
2040
2080
|
*/
|
|
2041
2081
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
2042
2082
|
|
|
2043
|
-
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewColorScheme, type TPreviewFrameSource, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, arePreviewPreferencesEqual, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, isPreviewBridgeMessage, parseInlineRich, parseSpacing, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
|
|
2083
|
+
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageRoute, type IPageSectionWithFields, type IPageSectionsData, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type IResolvePageResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewColorScheme, type TPreviewFrameSource, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, arePreviewPreferencesEqual, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, isPreviewBridgeMessage, parseInlineRich, parseSpacing, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
|
package/dist/index.js
CHANGED
|
@@ -518,7 +518,13 @@ var ENDPOINTS = {
|
|
|
518
518
|
LIST: `${API_VERSION_PREFIX}/pages`,
|
|
519
519
|
LIST_WITH_LANGUAGE: (languageId) => `${API_VERSION_PREFIX}/pages/language/${languageId}`,
|
|
520
520
|
BY_KEYWORD: (keyword) => `${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
|
|
521
|
-
BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}
|
|
521
|
+
BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`,
|
|
522
|
+
/**
|
|
523
|
+
* DB-driven public path resolution (issue #30): maps a full public URL
|
|
524
|
+
* path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
|
|
525
|
+
* params. `path` is sent URL-encoded as a query parameter.
|
|
526
|
+
*/
|
|
527
|
+
RESOLVE: (path) => `${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`
|
|
522
528
|
},
|
|
523
529
|
LANGUAGES: `${API_VERSION_PREFIX}/languages`,
|
|
524
530
|
FORMS: {
|
package/dist/index.mjs
CHANGED
|
@@ -391,7 +391,13 @@ var ENDPOINTS = {
|
|
|
391
391
|
LIST: `${API_VERSION_PREFIX}/pages`,
|
|
392
392
|
LIST_WITH_LANGUAGE: (languageId) => `${API_VERSION_PREFIX}/pages/language/${languageId}`,
|
|
393
393
|
BY_KEYWORD: (keyword) => `${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
|
|
394
|
-
BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}
|
|
394
|
+
BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`,
|
|
395
|
+
/**
|
|
396
|
+
* DB-driven public path resolution (issue #30): maps a full public URL
|
|
397
|
+
* path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
|
|
398
|
+
* params. `path` is sent URL-encoded as a query parameter.
|
|
399
|
+
*/
|
|
400
|
+
RESOLVE: (path) => `${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`
|
|
395
401
|
},
|
|
396
402
|
LANGUAGES: `${API_VERSION_PREFIX}/languages`,
|
|
397
403
|
FORMS: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfhelp/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,3 +43,26 @@ describe('ENDPOINTS.AUTH password recovery', () => {
|
|
|
43
43
|
);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Contract coverage for the DB-driven public path resolver (issue #30). The web
|
|
49
|
+
* frontend SSR layer and the mobile app both build the resolve request from
|
|
50
|
+
* `ENDPOINTS.PAGES.RESOLVE`, so a wrong/missing path silently breaks every
|
|
51
|
+
* parameterized public URL (`/reset/{user_id}/{token}`, `/team/{record_id}`).
|
|
52
|
+
*/
|
|
53
|
+
describe('ENDPOINTS.PAGES.RESOLVE (DB-driven routing)', () => {
|
|
54
|
+
it('builds the resolve endpoint with the path as a URL-encoded query param', () => {
|
|
55
|
+
expect(ENDPOINTS.PAGES.RESOLVE('/team/7')).toBe(
|
|
56
|
+
`${API_VERSION_PREFIX}/pages/resolve?path=%2Fteam%2F7`,
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('encodes reset/validate token paths so slashes survive transport', () => {
|
|
61
|
+
expect(ENDPOINTS.PAGES.RESOLVE('/reset/42/abc.def~1')).toBe(
|
|
62
|
+
`${API_VERSION_PREFIX}/pages/resolve?path=%2Freset%2F42%2Fabc.def~1`,
|
|
63
|
+
);
|
|
64
|
+
expect(ENDPOINTS.PAGES.RESOLVE('/')).toBe(
|
|
65
|
+
`${API_VERSION_PREFIX}/pages/resolve?path=%2F`,
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
});
|
package/src/api/endpoints.ts
CHANGED
|
@@ -40,6 +40,13 @@ export const ENDPOINTS = {
|
|
|
40
40
|
BY_KEYWORD: (keyword: string): string =>
|
|
41
41
|
`${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
|
|
42
42
|
BY_ID: (pageId: number): string => `${API_VERSION_PREFIX}/pages/${pageId}`,
|
|
43
|
+
/**
|
|
44
|
+
* DB-driven public path resolution (issue #30): maps a full public URL
|
|
45
|
+
* path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
|
|
46
|
+
* params. `path` is sent URL-encoded as a query parameter.
|
|
47
|
+
*/
|
|
48
|
+
RESOLVE: (path: string): string =>
|
|
49
|
+
`${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`,
|
|
43
50
|
},
|
|
44
51
|
LANGUAGES: `${API_VERSION_PREFIX}/languages`,
|
|
45
52
|
FORMS: {
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, it } from 'vitest';
|
|
7
|
+
import type { IPageContent, IPageRoute } from '../../pages';
|
|
8
|
+
import type { IResolvePageResponse } from '../page';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Contract coverage for the DB-driven public routing types (issue #30). The web
|
|
12
|
+
* frontend auth styles and the mobile app read `page.route_params.user_id` /
|
|
13
|
+
* `.token` straight off the resolved page, so the route metadata MUST live on
|
|
14
|
+
* `IPageContent` with snake_case param keys. `IPageRoute` is the admin
|
|
15
|
+
* page-routes editor + export/import contract and must keep `path_pattern`
|
|
16
|
+
* placeholders verbatim.
|
|
17
|
+
*/
|
|
18
|
+
describe('IPageContent route metadata (resolve responses)', () => {
|
|
19
|
+
it('carries optional snake_case route_params + matched/canonical url', () => {
|
|
20
|
+
const page: IPageContent = {
|
|
21
|
+
id: 7,
|
|
22
|
+
keyword: 'reset-password',
|
|
23
|
+
url: '/reset',
|
|
24
|
+
parent_page_id: null,
|
|
25
|
+
is_headless: true,
|
|
26
|
+
nav_position: null,
|
|
27
|
+
footer_position: null,
|
|
28
|
+
route_params: { user_id: '42', token: 'abc.def~1' },
|
|
29
|
+
matched_url_pattern: '/reset/{user_id}/{token}',
|
|
30
|
+
canonical_url: '/reset',
|
|
31
|
+
sections: [],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
expect(page.route_params?.user_id).toBe('42');
|
|
35
|
+
expect(page.route_params?.token).toBe('abc.def~1');
|
|
36
|
+
expect(page.matched_url_pattern).toBe('/reset/{user_id}/{token}');
|
|
37
|
+
expect(page.canonical_url).toBe('/reset');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('treats route metadata as optional (a static page omits it)', () => {
|
|
41
|
+
const page: IPageContent = {
|
|
42
|
+
id: 1,
|
|
43
|
+
keyword: 'home',
|
|
44
|
+
url: '/',
|
|
45
|
+
parent_page_id: null,
|
|
46
|
+
is_headless: false,
|
|
47
|
+
nav_position: 1,
|
|
48
|
+
footer_position: null,
|
|
49
|
+
sections: [],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
expect(page.route_params).toBeUndefined();
|
|
53
|
+
expect(page.matched_url_pattern).toBeUndefined();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('wraps the resolved page in the standard envelope', () => {
|
|
57
|
+
const response: IResolvePageResponse = {
|
|
58
|
+
status: 200,
|
|
59
|
+
message: 'OK',
|
|
60
|
+
error: null,
|
|
61
|
+
logged_in: false,
|
|
62
|
+
meta: { version: 'v1', timestamp: '2026-06-30T00:00:00Z' },
|
|
63
|
+
data: {
|
|
64
|
+
page: {
|
|
65
|
+
id: 9,
|
|
66
|
+
keyword: 'team',
|
|
67
|
+
url: '/team/7',
|
|
68
|
+
parent_page_id: null,
|
|
69
|
+
is_headless: false,
|
|
70
|
+
nav_position: null,
|
|
71
|
+
footer_position: null,
|
|
72
|
+
route_params: { record_id: '7' },
|
|
73
|
+
sections: [],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
expect(response.data?.page.route_params?.record_id).toBe('7');
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('IPageRoute (admin editor + export/import contract)', () => {
|
|
83
|
+
it('models a parameterized canonical route with regex requirements', () => {
|
|
84
|
+
const route: IPageRoute = {
|
|
85
|
+
id: 12,
|
|
86
|
+
path_pattern: '/team/{record_id}',
|
|
87
|
+
requirements: { record_id: '\\d+' },
|
|
88
|
+
is_canonical: true,
|
|
89
|
+
is_active: true,
|
|
90
|
+
priority: 50,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Param names are NEVER remapped, so the placeholder must survive verbatim.
|
|
94
|
+
expect(route.path_pattern).toContain('{record_id}');
|
|
95
|
+
expect(route.requirements?.record_id).toBe('\\d+');
|
|
96
|
+
expect(route.is_canonical).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('allows a static route with no requirements', () => {
|
|
100
|
+
const route: IPageRoute = {
|
|
101
|
+
path_pattern: '/reset',
|
|
102
|
+
requirements: null,
|
|
103
|
+
is_canonical: true,
|
|
104
|
+
is_active: true,
|
|
105
|
+
priority: 100,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
expect(route.requirements).toBeNull();
|
|
109
|
+
});
|
|
110
|
+
});
|
package/src/types/api/page.ts
CHANGED
|
@@ -7,3 +7,10 @@ import type { IPageContent, IPageItem } from '../pages';
|
|
|
7
7
|
|
|
8
8
|
export type IGetPageResponse = IBaseApiResponse<{ page: IPageContent }>;
|
|
9
9
|
export type IGetPagesResponse = IBaseApiResponse<IPageItem[]>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Response of `GET /cms-api/v1/pages/resolve?path=...` (issue #30). Identical
|
|
13
|
+
* envelope to {@link IGetPageResponse}; the resolved `page` additionally carries
|
|
14
|
+
* `route_params`, `matched_url_pattern`, and `canonical_url`.
|
|
15
|
+
*/
|
|
16
|
+
export type IResolvePageResponse = IBaseApiResponse<{ page: IPageContent }>;
|
package/src/types/pages.ts
CHANGED
|
@@ -75,9 +75,36 @@ export interface IPageContent {
|
|
|
75
75
|
footer_position: number | null;
|
|
76
76
|
title?: string | null;
|
|
77
77
|
description?: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Snake_case route params extracted from the matched public URL pattern
|
|
80
|
+
* (e.g. `{ user_id: '42', token: 'abc' }` or `{ record_id: '7' }`). Present
|
|
81
|
+
* only when the page was resolved via `GET /pages/resolve`. Backend also
|
|
82
|
+
* exposes these to interpolation as `{{route.<name>}}`.
|
|
83
|
+
*/
|
|
84
|
+
route_params?: Record<string, string>;
|
|
85
|
+
/** The `page_routes` pattern that matched (e.g. `/reset/{user_id}/{token}`). Resolve responses only. */
|
|
86
|
+
matched_url_pattern?: string | null;
|
|
87
|
+
/** The canonical active route pattern for the page, for canonical-link generation. Resolve responses only. */
|
|
88
|
+
canonical_url?: string | null;
|
|
78
89
|
sections: IPageSectionWithFields[];
|
|
79
90
|
}
|
|
80
91
|
|
|
92
|
+
/**
|
|
93
|
+
* A public, parameterized route contract for a CMS page (issue #30). Mirrors a
|
|
94
|
+
* backend `page_routes` row. `path_pattern` uses Symfony route syntax
|
|
95
|
+
* (`/team/{record_id}`) and `requirements` maps each placeholder to a regex
|
|
96
|
+
* (`{ record_id: '\\d+' }`). Param names are snake_case and are NEVER remapped
|
|
97
|
+
* on export/import. Used by the admin page-routes editor and page export/import.
|
|
98
|
+
*/
|
|
99
|
+
export interface IPageRoute {
|
|
100
|
+
id?: number;
|
|
101
|
+
path_pattern: string;
|
|
102
|
+
requirements?: Record<string, string> | null;
|
|
103
|
+
is_canonical: boolean;
|
|
104
|
+
is_active: boolean;
|
|
105
|
+
priority: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
81
108
|
export interface IPageFieldTranslation {
|
|
82
109
|
language_id: number;
|
|
83
110
|
language_code: string;
|