@selfhelp/shared 1.25.0 → 1.28.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/dist/index.d.ts CHANGED
@@ -7,6 +7,113 @@ export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, FULL_RADI
7
7
  export { TAnyStyleName, TPluginStyleImplMap, TStyleImplMap, getRegistryEntry, getRegistryEntryAny, getStylePlacement, getStylePlatforms, getStylePluginId, isKnownStyleName, isRegisteredStyleName, isStyleAllowedOnPage, isStylePlacementAllowed, isStyleSupportedOnPlatform, setToStylePlatform, stylePlatformToSet } from './registry/index.js';
8
8
  export { sharedTailwindExtend, sharedTailwindPreset } from './theme/tailwind.js';
9
9
 
10
+ /**
11
+ * Live-sync contract (task `2026-11-20-live-sync-and-edit-lock`, contracts C1 to C9).
12
+ *
13
+ * The backend publishes a `changed` Mercure event that carries names and ids
14
+ * only, never content. Clients match the tags against the `sync.depends_on`
15
+ * list the server put into each page payload and refetch what matches. The
16
+ * server decides who gets a message; a client never decides who may see a
17
+ * change.
18
+ */
19
+ /** Mercure event name of a change message (C1). */
20
+ declare const SYNC_EVENT_NAME: "changed";
21
+ /** Highest change-message version this package understands (C1). Clients ignore a higher `v`. */
22
+ declare const SYNC_MESSAGE_VERSION: 1;
23
+ /**
24
+ * Tags a change message may carry (C1). A client ignores tags it does not know.
25
+ *
26
+ * | Tag | Meaning |
27
+ * | --- | --- |
28
+ * | `acl` | Access of this audience changed (re-bootstrap the stream, refetch user data) |
29
+ * | `navigation` | A menu or the visible page set changed |
30
+ * | `global_values` | Global values changed |
31
+ * | `page:<id>` | The published page changed |
32
+ * | `page_draft:<id>` | The draft of the page changed (editors) |
33
+ * | `page_lock:<id>` | The edit lock of the page changed (editors) |
34
+ * | `table:<id>` | A record of the data table changed |
35
+ * | `section:<id>` | A section was saved in the admin |
36
+ * | `asset:<id>` | An asset changed |
37
+ */
38
+ type TSyncTag = 'acl' | 'navigation' | 'global_values' | `page:${number}` | `page_draft:${number}` | `page_lock:${number}` | `table:${number}` | `section:${number}` | `asset:${number}`;
39
+ /** Mirror of the backend tag pattern (C1). Anchored, so the whole tag must match. */
40
+ declare const SYNC_TAG_PATTERN: RegExp;
41
+ /** Data of one `changed` event (C1). */
42
+ interface ISyncChangeMessage {
43
+ /** Message version. Always 1 for this package. */
44
+ v: typeof SYNC_MESSAGE_VERSION;
45
+ /** Unique, non-empty list of known tags. */
46
+ tags: TSyncTag[];
47
+ }
48
+ /**
49
+ * The `sync` block of every page payload, published and draft (C6).
50
+ *
51
+ * `depends_on` lists `page:<id>` (`page_draft:<id>` for a draft), `table:<id>`
52
+ * for every data table the page reads, and `global_values`. `valid_until` is
53
+ * the earliest moment (UTC, ISO 8601) the result can change because time
54
+ * passes, or `null`. The client refetches once at `valid_until` plus a random
55
+ * delay while the page is open.
56
+ */
57
+ interface ISyncBlock {
58
+ depends_on: string[];
59
+ valid_until: string | null;
60
+ }
61
+ /**
62
+ * Data of `GET /auth/events` (C4). For a guest `topic`, `impersonationTopic`
63
+ * and `systemUpdateTopic` are `null` and `syncTopics` is the public topic only.
64
+ * The token covers exactly the listed topics (plus plugin topics).
65
+ */
66
+ interface IAuthEventsBootstrap {
67
+ hubUrl: string;
68
+ topic: string | null;
69
+ impersonationTopic: string | null;
70
+ systemUpdateTopic: string | null;
71
+ /** Sync topics to subscribe to: `[user, each group, each role, public]`, or `[public]` for a guest. */
72
+ syncTopics: string[];
73
+ pluginTopics: string[];
74
+ /** `null` when `transport=cookie` was requested. */
75
+ token: string | null;
76
+ expiresIn: number;
77
+ }
78
+ /** Error codes of the page draft version and lock checks (C8, C9). */
79
+ declare const PAGE_VERSION_REQUIRED_ERROR: "page_version_required";
80
+ declare const STALE_PAGE_VERSION_ERROR: "stale_page_version";
81
+ declare const PAGE_LOCKED_ERROR: "page_locked";
82
+ /**
83
+ * Draft version of a page (C8). `GET /admin/pages/{page_id}` returns it in its
84
+ * data (and in the `X-Page-Version` header); admin page types extend this so
85
+ * the editor can send it back with every draft write.
86
+ */
87
+ interface IPageDraftVersioned {
88
+ /** Integer from 1; raised by one on every successful draft write. */
89
+ draft_version: number;
90
+ }
91
+ /** Data of `409 stale_page_version` (C8). */
92
+ interface IStalePageVersionData {
93
+ page_id: number;
94
+ current_version: number;
95
+ }
96
+ /** Holder of a page edit lock (C9). */
97
+ interface IPageLockHolder {
98
+ id: number;
99
+ name: string;
100
+ }
101
+ /**
102
+ * Status of a page edit lock (C9). Per caller (`mine`) and never cached.
103
+ * `holder`, `expires_at` and `idle_expires_at` are `null` when `held` is false.
104
+ * The data of `409 page_locked` is this object.
105
+ */
106
+ interface IPageLockStatus {
107
+ page_id: number;
108
+ held: boolean;
109
+ mine: boolean;
110
+ holder: IPageLockHolder | null;
111
+ /** The lease ends here unless renewed (120 s after the last renewal). */
112
+ expires_at: string | null;
113
+ /** The lock ends here unless the holder writes (15 minutes after the last draft write). */
114
+ idle_expires_at: string | null;
115
+ }
116
+
10
117
  /**
11
118
  * Comprehensive page type system, single source of truth for both apps.
12
119
  */
@@ -52,10 +159,8 @@ interface IPageAccessTypeInfo {
52
159
  interface IPageItem extends IBasePageInfo {
53
160
  id_users?: number;
54
161
  id_pages?: number;
162
+ /** Page ACL: members of a group with this right can see the page and use its forms. */
55
163
  acl_select?: 0 | 1;
56
- acl_insert?: 0 | 1;
57
- acl_update?: 0 | 1;
58
- acl_delete?: 0 | 1;
59
164
  id_page_types?: number;
60
165
  id_page_access_types?: number;
61
166
  title?: string | null;
@@ -126,6 +231,13 @@ interface IPageContent {
126
231
  matched_url_pattern?: string | null;
127
232
  /** The canonical active route pattern for the page, for canonical-link generation. Resolve responses only. */
128
233
  canonical_url?: string | null;
234
+ /**
235
+ * Live-sync block (C6): the tags this payload depends on and the moment it
236
+ * can change because time passes. Emitted by the backend on published and
237
+ * draft page payloads; optional here because the type is also used for
238
+ * payloads built elsewhere (preview, admin).
239
+ */
240
+ sync?: ISyncBlock;
129
241
  sections: IPageSectionWithFields[];
130
242
  }
131
243
  /**
@@ -197,6 +309,12 @@ interface IUserData {
197
309
  roles?: string[];
198
310
  groups?: string[];
199
311
  acl_version?: string | number | null;
312
+ /**
313
+ * Access stamp (live sync, C5): the same value the backend sends in the
314
+ * `X-Acl-Stamp` header of every response to this user. A client that sees
315
+ * a header value different from this one invalidates its user data.
316
+ */
317
+ acl_stamp?: string;
200
318
  }
201
319
  interface IJwtPayload {
202
320
  sub: number;
@@ -267,14 +385,15 @@ declare const PERMISSIONS: {
267
385
  readonly ADMIN_SCHEDULED_JOB_EXECUTE: "admin.scheduled_job.execute";
268
386
  readonly ADMIN_SCHEDULED_JOB_DELETE: "admin.scheduled_job.delete";
269
387
  readonly ADMIN_SCHEDULED_JOB_MANAGE: "admin.scheduled_job.manage";
388
+ readonly ADMIN_SECTION_READ: "admin.section.read";
270
389
  readonly ADMIN_SECTION_DELETE: "admin.section.delete";
271
- readonly ADMIN_SETTINGS: "admin.settings";
390
+ readonly ADMIN_LANGUAGE_READ: "admin.language.read";
391
+ readonly ADMIN_LANGUAGE_UPDATE: "admin.language.update";
272
392
  readonly ADMIN_CMS_PREFERENCES_READ: "admin.cms_preferences.read";
273
- readonly ADMIN_CMS_PREFERENCES_UPDATE: "admin.cms_preferences.update";
274
393
  readonly ADMIN_CACHE_READ: "admin.cache.read";
275
394
  readonly ADMIN_CACHE_CLEAR: "admin.cache.clear";
276
395
  readonly ADMIN_CACHE_MANAGE: "admin.cache.manage";
277
- readonly ADMIN_AUDIT_VIEW: "admin.audit.view";
396
+ readonly ADMIN_AUDIT_READ: "admin.audit.read";
278
397
  };
279
398
  type TPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
280
399
 
@@ -1804,7 +1923,23 @@ declare const ENDPOINTS: {
1804
1923
  readonly RESTORE: (tableName: string, recordId: number) => string;
1805
1924
  readonly VERSION_FILE: (tableName: string, recordId: number, version: number, fieldKey: string) => string;
1806
1925
  };
1926
+ /**
1927
+ * Page edit lock (live sync, C9). Route permission `admin.page.update` plus
1928
+ * the update grant on the page. `LOCK` serves three methods: GET (status),
1929
+ * POST (acquire or renew) and DELETE (release); `TAKE_OVER` is POST only.
1930
+ * Every route answers an `IPageLockStatus`.
1931
+ */
1932
+ readonly ADMIN_PAGE_LOCK: {
1933
+ readonly LOCK: (pageId: number) => string;
1934
+ readonly TAKE_OVER: (pageId: number) => string;
1935
+ };
1807
1936
  };
1937
+ /** Header on every response to a signed-in caller: the access stamp (live sync, C5). */
1938
+ declare const HEADER_ACL_STAMP = "X-Acl-Stamp";
1939
+ /** Request header `X-Page-View: 1`: the only page fetch per visit that counts as a view (C7, F135). */
1940
+ declare const HEADER_PAGE_VIEW = "X-Page-View";
1941
+ /** Draft-version header: sent with every page draft write, returned on page reads and writes (C8). */
1942
+ declare const HEADER_PAGE_VERSION = "X-Page-Version";
1808
1943
  /** Header set the backend reads to switch page-access mode + condition platform var. */
1809
1944
  declare const HEADER_CLIENT_TYPE = "X-Client-Type";
1810
1945
  declare const CLIENT_TYPE_WEB = "web";
@@ -2974,6 +3109,57 @@ declare function isMenuItemActiveOnMobile(item: INavigationMenuItem, pathname: s
2974
3109
  */
2975
3110
  declare function expandedIdsForActiveTrail(items: INavigationMenuItem[], pathname: string, platform: 'web' | 'mobile'): Set<number>;
2976
3111
 
3112
+ /**
3113
+ * Small, pure helpers both clients use to read a change message and match it
3114
+ * to what is on screen (contracts C1 and C6). They hold no state, touch no
3115
+ * network and never decide access: they only compare tags the server sent
3116
+ * with tags the server put into the page payload.
3117
+ */
3118
+
3119
+ /** Largest random delay before a refetch caused by a `changed` message (decision "instant"). */
3120
+ declare const SYNC_CHANGED_MAX_DELAY_MS = 300;
3121
+ /** Largest random delay before the one refetch at a page's `valid_until`. */
3122
+ declare const SYNC_VALID_UNTIL_MAX_DELAY_MS = 2000;
3123
+ /** Why a refetch is scheduled: a pushed change, or the page's own `valid_until`. */
3124
+ type TSyncRefetchKind = 'changed' | 'valid_until';
3125
+ /**
3126
+ * Validates the data of a `changed` event (C1).
3127
+ *
3128
+ * Returns `null` when the data is not an object, `v` is not
3129
+ * {@link SYNC_MESSAGE_VERSION} (a higher version is ignored by design), `tags`
3130
+ * is not a list, or no known tag is left. Unknown tags are dropped and
3131
+ * duplicates are removed, so `{ v: 1, tags: ['page:12', 'foo:1'] }` gives
3132
+ * `{ v: 1, tags: ['page:12'] }`. A message that carries only unknown tags
3133
+ * returns `null` because there is nothing a client could act on.
3134
+ */
3135
+ declare function parseSyncMessage(data: unknown): ISyncChangeMessage | null;
3136
+ /**
3137
+ * Same as {@link parseSyncMessage} for the raw `data` string of a server-sent
3138
+ * event. Invalid JSON returns `null`.
3139
+ */
3140
+ declare function parseSyncMessageJson(raw: string): ISyncChangeMessage | null;
3141
+ /**
3142
+ * True when a page payload's `sync.depends_on` names any of the message's tags (C6).
3143
+ *
3144
+ * Only tags that a page payload can list match here: `page:<id>`,
3145
+ * `page_draft:<id>`, `table:<id>` and `global_values`. The other tags are not
3146
+ * page dependencies and are handled by the client on their own:
3147
+ *
3148
+ * - `acl` and `navigation` affect every page the caller may see, so the client
3149
+ * invalidates all page queries and the navigation (it does not ask each page).
3150
+ * - `page_lock:<id>`, `section:<id>` and `asset:<id>` are editor-side tags;
3151
+ * the admin screens that show them refetch their own queries.
3152
+ *
3153
+ * A page without a `sync` block (older server, error payload) never matches.
3154
+ */
3155
+ declare function pageDependsOn(sync: ISyncBlock | null | undefined, tags: readonly string[]): boolean;
3156
+ /**
3157
+ * Random delay in milliseconds before a refetch: 0 to 300 for a `changed`
3158
+ * message, 0 to 2000 for `valid_until`. It spreads many clients over a short
3159
+ * time without making a change feel slow. `random` is injectable for tests.
3160
+ */
3161
+ declare function syncRefetchDelayMs(kind: TSyncRefetchKind, random?: () => number): number;
3162
+
2977
3163
  /**
2978
3164
  * Parse the unified `spacing` field. The CMS
2979
3165
  * stores this as a JSON string with optional keys for each side:
@@ -3023,9 +3209,6 @@ interface IRawPage {
3023
3209
  mobile_icon?: string | null;
3024
3210
  id_users?: number;
3025
3211
  acl_select?: 0 | 1;
3026
- acl_insert?: 0 | 1;
3027
- acl_update?: 0 | 1;
3028
- acl_delete?: 0 | 1;
3029
3212
  id_page_types?: number;
3030
3213
  id_page_access_types?: number;
3031
3214
  children?: IRawPage[];
@@ -3038,4 +3221,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
3038
3221
  */
3039
3222
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
3040
3223
 
3041
- 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, CMS_APP_PRIMARY_ROLES, CMS_APP_ROLES, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, DEFAULT_MOBILE_ICON, DEFAULT_RATE_LIMIT_MESSAGE, DEFAULT_WEB_FOOTER_PRESET, DEFAULT_WEB_HEADER_PRESET, type DatabaseMigrationMetadata, ENDPOINTS, FIELDS_MAP_STYLE_CONFIG, FORM_LIST_MAX_PAGE, FORM_LIST_MAX_ROUTE_PARAMS, FORM_LIST_MAX_ROUTE_VALUE_LENGTH, FORM_LIST_MAX_SORTS, FORM_LIST_MAX_VALUE_BYTES, FORM_LIST_MODES, FORM_LIST_SEARCH_MAX_LENGTH, FORM_LIST_SEARCH_MIN_LENGTH, FORM_RECORD_PREFILL_SKIP_FIELDS, type FrontendRelease, HEADER_CLIENT_TYPE, IAboutItem, type IAssetSource, IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IBranchNavContext, type IBranchNavSegment, type IBreadcrumbEntry, type IClassPattern, type IClassRemap, type ICmsApp, type ICmsAppAssignedPage, type ICmsAppDetail, type ICmsAppPage, type ICmsAppSummary, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IFieldsMapStyleConfig, type IForgotPasswordRequest, type IForgotPasswordResponse, IFormInvalidData, type IFormListCacheScope, type IFormListFailure, IFormListFilesCell, IFormListRestoreBlockedData, IFormListSort, type IFormListUrlError, type IFormListUrlRules, type IFormListUrlState, type IFormRecordPrefill, type IFormRecordPrefillChild, type IFormRecordPrefillSection, type IFormRecordPrefillTranslatedValue, IFormStaleVersionData, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IHeaderLayerSplit, 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 IMenuSearchHit, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileIconEntry, 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 INavigationBranding, type INavigationBundle, type INavigationBundleImportHints, type INavigationBundleItem, type INavigationBundleItemTranslation, type INavigationBundleMenu, type INavigationMenu, type INavigationMenuItem, type INavigationPayload, type INavigationResolvedPageRef, type INavigationSearchConfig, type INavigationStartupConfig, type IOptionCatalogEntry, type IOptionLabelMap, type IOptionStyleConfig, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageRoute, type IPageSectionWithFields, type IPageSectionsData, type IPagesResolveParams, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type IResolvePageResponse, type IResolvedOption, 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 IWebFooterPresetOption, type IWebHeaderPresetOption, 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_ICON_NAMES, MOBILE_ICON_SET, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, NAVIGATION_BRANDING_LOGO_HEIGHTS, NAVIGATION_BUNDLE_FORMAT, NAVIGATION_BUNDLE_VERSION, NAVIGATION_HEADER_LAYER_TOP, OPTION_STYLE_CONFIGS, 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, type TCmsAppRole, TFormListMode, type TFormListUrlChange, type TFormListUrlErrorReason, type TFormListUrlParse, type TFormRecordPrefillFieldValue, type TFormRecordPrefillFileValue, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, type TMobilePagePresentation, TMobileSelectPresentation, type TNavigationBrandingSize, type TNavigationBrandingVariant, type TNavigationBundleExportMode, type TNavigationChildrenNavMode, type TNavigationHeaderLayer, type TNavigationMenuItemType, type TNavigationMenuKey, type TNavigationMobileStartSource, type TNavigationSearchMode, type TNavigationStartMode, type TOptionStyleName, 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 TWebFooterPreset, type TWebHeaderPreset, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, WEB_FOOTER_PRESET_OPTIONS, WEB_FOOTER_PRESET_VALUES, WEB_HEADER_PRESET_OPTIONS, WEB_HEADER_PRESET_VALUES, type WorkerRelease, applyFormListUrlChange, arePreviewPreferencesEqual, asFilesCell, asRecordVersion, buildConditionContext, buildPagesResolvePath, buildPagesResolveQuery, buildPagesResolveUrl, buildPublicPathFromRoute, clampMenuItemsAtDepth, classifyClass, classifyClassString, collectPageIdsFromMenuItems, emptyFormListUrlState, encodeFormListQuery, evaluateCondition, expandedIdsForActiveTrail, findMenuItemByPageId, findNearestBottomTabMenuItemForPage, findPageRefInNavigationPayload, findRemap, flattenFooterItems, flattenFormRecordPrefillValues, flattenMenuItems, flattenNavigationMenuItems, footerColumnItems, footerGroupLinks, footerStandaloneItems, formListCacheKey, formListQueryString, formListRouteQuery, formatRateLimitMessage, getFormInvalidData, getFormListFailure, getFormListRestoreBlocked, getFormStaleVersion, getNavigationItemAriaLabel, getNavigationItemHref, getNavigationItemKeyword, getNavigationItemLabel, getNavigationItemMobileHref, getRateLimitRetryAfter, hasInlineFormatting, isBottomTabMenuItemActive, isDoubleWebHeaderPreset, isFormListParam, isMenuItemActiveOnMobile, isMenuItemActiveOnWeb, isMobileIconName, isNavigationBundleVersionSupported, isOnAnyMobileMenu, isOnAnyMobileMenuFromPayload, isPageInMenuTree, isPageInResolvedMenus, isPageOnAnyMenu, isPageOnMobileMenu, isPageOnWebMenu, isPreviewBridgeMessage, isWebFooterPreset, isWebHeaderPreset, matchesMobilePath, matchesWebPath, mergeHeaderLayers, nextSortOnHeaderClick, normalizePagesResolvePath, pageUrlToMobileRoute, parseFieldsMapCatalog, parseFieldsMapLabels, parseFormListQuery, parseFormRecordPrefill, parseInlineRich, parseOptionCatalog, parseOptionCodes, parseOptionLabels, parseSpacing, pickFormListQuery, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, resolveBranchNavGroup, resolveBrandingPresentation, resolveFieldsMapLabel, resolveHolderRedirectPath, resolveMenuMaxDepth, resolveMobileIcon, resolveMobilePagePresentation, resolveMobileSegmentGroup, resolveMobileStartupKeyword, resolveMobileStartupRoute, resolveOptionCodesLabels, resolveOptionLabel, resolveOptionValueLabels, resolveOptions, resolveWebBranchNavContext, resolveWebBranchNavGroup, resolveWebFooterPreset, resolveWebHeaderPreset, resolveWebStartupPath, searchMenuPagesInPayload, serializeFieldsMapCatalog, serializeFieldsMapLabels, spacingToClasses, splitHeaderLayers, stripHtmlToText, transformPageData, transformPagesData };
3224
+ 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, CMS_APP_PRIMARY_ROLES, CMS_APP_ROLES, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, DEFAULT_MOBILE_ICON, DEFAULT_RATE_LIMIT_MESSAGE, DEFAULT_WEB_FOOTER_PRESET, DEFAULT_WEB_HEADER_PRESET, type DatabaseMigrationMetadata, ENDPOINTS, FIELDS_MAP_STYLE_CONFIG, FORM_LIST_MAX_PAGE, FORM_LIST_MAX_ROUTE_PARAMS, FORM_LIST_MAX_ROUTE_VALUE_LENGTH, FORM_LIST_MAX_SORTS, FORM_LIST_MAX_VALUE_BYTES, FORM_LIST_MODES, FORM_LIST_SEARCH_MAX_LENGTH, FORM_LIST_SEARCH_MIN_LENGTH, FORM_RECORD_PREFILL_SKIP_FIELDS, type FrontendRelease, HEADER_ACL_STAMP, HEADER_CLIENT_TYPE, HEADER_PAGE_VERSION, HEADER_PAGE_VIEW, IAboutItem, type IAssetSource, type IAuthEventsBootstrap, IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IBranchNavContext, type IBranchNavSegment, type IBreadcrumbEntry, type IClassPattern, type IClassRemap, type ICmsApp, type ICmsAppAssignedPage, type ICmsAppDetail, type ICmsAppPage, type ICmsAppSummary, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IFieldsMapStyleConfig, type IForgotPasswordRequest, type IForgotPasswordResponse, IFormInvalidData, type IFormListCacheScope, type IFormListFailure, IFormListFilesCell, IFormListRestoreBlockedData, IFormListSort, type IFormListUrlError, type IFormListUrlRules, type IFormListUrlState, type IFormRecordPrefill, type IFormRecordPrefillChild, type IFormRecordPrefillSection, type IFormRecordPrefillTranslatedValue, IFormStaleVersionData, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IHeaderLayerSplit, 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 IMenuSearchHit, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileIconEntry, 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 INavigationBranding, type INavigationBundle, type INavigationBundleImportHints, type INavigationBundleItem, type INavigationBundleItemTranslation, type INavigationBundleMenu, type INavigationMenu, type INavigationMenuItem, type INavigationPayload, type INavigationResolvedPageRef, type INavigationSearchConfig, type INavigationStartupConfig, type IOptionCatalogEntry, type IOptionLabelMap, type IOptionStyleConfig, type IPageAccessTypeInfo, type IPageContent, type IPageDraftVersioned, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageLockHolder, type IPageLockStatus, type IPageRoute, type IPageSectionWithFields, type IPageSectionsData, type IPagesResolveParams, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type IResolvePageResponse, type IResolvedOption, type ISpacingValue, type IStalePageVersionData, type ISyncBlock, type ISyncChangeMessage, 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 IWebFooterPresetOption, type IWebHeaderPresetOption, 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_ICON_NAMES, MOBILE_ICON_SET, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, NAVIGATION_BRANDING_LOGO_HEIGHTS, NAVIGATION_BUNDLE_FORMAT, NAVIGATION_BUNDLE_VERSION, NAVIGATION_HEADER_LAYER_TOP, OPTION_STYLE_CONFIGS, PAGE_LOCKED_ERROR, PAGE_VERSION_REQUIRED_ERROR, 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, STALE_PAGE_VERSION_ERROR, SYNC_CHANGED_MAX_DELAY_MS, SYNC_EVENT_NAME, SYNC_MESSAGE_VERSION, SYNC_TAG_PATTERN, SYNC_VALID_UNTIL_MAX_DELAY_MS, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TCmsAppRole, TFormListMode, type TFormListUrlChange, type TFormListUrlErrorReason, type TFormListUrlParse, type TFormRecordPrefillFieldValue, type TFormRecordPrefillFileValue, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, type TMobilePagePresentation, TMobileSelectPresentation, type TNavigationBrandingSize, type TNavigationBrandingVariant, type TNavigationBundleExportMode, type TNavigationChildrenNavMode, type TNavigationHeaderLayer, type TNavigationMenuItemType, type TNavigationMenuKey, type TNavigationMobileStartSource, type TNavigationSearchMode, type TNavigationStartMode, type TOptionStyleName, type TPermission, type TPlatform, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewColorScheme, type TPreviewFrameSource, TStyleName, type TSyncRefetchKind, type TSyncTag, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TWebFooterPreset, type TWebHeaderPreset, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, WEB_FOOTER_PRESET_OPTIONS, WEB_FOOTER_PRESET_VALUES, WEB_HEADER_PRESET_OPTIONS, WEB_HEADER_PRESET_VALUES, type WorkerRelease, applyFormListUrlChange, arePreviewPreferencesEqual, asFilesCell, asRecordVersion, buildConditionContext, buildPagesResolvePath, buildPagesResolveQuery, buildPagesResolveUrl, buildPublicPathFromRoute, clampMenuItemsAtDepth, classifyClass, classifyClassString, collectPageIdsFromMenuItems, emptyFormListUrlState, encodeFormListQuery, evaluateCondition, expandedIdsForActiveTrail, findMenuItemByPageId, findNearestBottomTabMenuItemForPage, findPageRefInNavigationPayload, findRemap, flattenFooterItems, flattenFormRecordPrefillValues, flattenMenuItems, flattenNavigationMenuItems, footerColumnItems, footerGroupLinks, footerStandaloneItems, formListCacheKey, formListQueryString, formListRouteQuery, formatRateLimitMessage, getFormInvalidData, getFormListFailure, getFormListRestoreBlocked, getFormStaleVersion, getNavigationItemAriaLabel, getNavigationItemHref, getNavigationItemKeyword, getNavigationItemLabel, getNavigationItemMobileHref, getRateLimitRetryAfter, hasInlineFormatting, isBottomTabMenuItemActive, isDoubleWebHeaderPreset, isFormListParam, isMenuItemActiveOnMobile, isMenuItemActiveOnWeb, isMobileIconName, isNavigationBundleVersionSupported, isOnAnyMobileMenu, isOnAnyMobileMenuFromPayload, isPageInMenuTree, isPageInResolvedMenus, isPageOnAnyMenu, isPageOnMobileMenu, isPageOnWebMenu, isPreviewBridgeMessage, isWebFooterPreset, isWebHeaderPreset, matchesMobilePath, matchesWebPath, mergeHeaderLayers, nextSortOnHeaderClick, normalizePagesResolvePath, pageDependsOn, pageUrlToMobileRoute, parseFieldsMapCatalog, parseFieldsMapLabels, parseFormListQuery, parseFormRecordPrefill, parseInlineRich, parseOptionCatalog, parseOptionCodes, parseOptionLabels, parseSpacing, parseSyncMessage, parseSyncMessageJson, pickFormListQuery, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, resolveBranchNavGroup, resolveBrandingPresentation, resolveFieldsMapLabel, resolveHolderRedirectPath, resolveMenuMaxDepth, resolveMobileIcon, resolveMobilePagePresentation, resolveMobileSegmentGroup, resolveMobileStartupKeyword, resolveMobileStartupRoute, resolveOptionCodesLabels, resolveOptionLabel, resolveOptionValueLabels, resolveOptions, resolveWebBranchNavContext, resolveWebBranchNavGroup, resolveWebFooterPreset, resolveWebHeaderPreset, resolveWebStartupPath, searchMenuPagesInPayload, serializeFieldsMapCatalog, serializeFieldsMapLabels, spacingToClasses, splitHeaderLayers, stripHtmlToText, syncRefetchDelayMs, transformPageData, transformPagesData };
package/dist/index.js CHANGED
@@ -61,7 +61,10 @@ __export(index_exports, {
61
61
  FORM_RECORD_PREFILL_SKIP_FIELDS: () => FORM_RECORD_PREFILL_SKIP_FIELDS,
62
62
  FORM_SECTION_STYLE_NAMES: () => FORM_SECTION_STYLE_NAMES,
63
63
  FULL_RADIUS_PX: () => FULL_RADIUS_PX,
64
+ HEADER_ACL_STAMP: () => HEADER_ACL_STAMP,
64
65
  HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
66
+ HEADER_PAGE_VERSION: () => HEADER_PAGE_VERSION,
67
+ HEADER_PAGE_VIEW: () => HEADER_PAGE_VIEW,
65
68
  LINE_HEIGHT: () => LINE_HEIGHT,
66
69
  LITERAL_CLASSES: () => LITERAL_CLASSES,
67
70
  MOBILE_ICON_NAMES: () => MOBILE_ICON_NAMES,
@@ -72,6 +75,8 @@ __export(index_exports, {
72
75
  NAVIGATION_BUNDLE_VERSION: () => NAVIGATION_BUNDLE_VERSION,
73
76
  NAVIGATION_HEADER_LAYER_TOP: () => NAVIGATION_HEADER_LAYER_TOP,
74
77
  OPTION_STYLE_CONFIGS: () => OPTION_STYLE_CONFIGS,
78
+ PAGE_LOCKED_ERROR: () => PAGE_LOCKED_ERROR,
79
+ PAGE_VERSION_REQUIRED_ERROR: () => PAGE_VERSION_REQUIRED_ERROR,
75
80
  PERMISSIONS: () => PERMISSIONS,
76
81
  PREVIEW_BRIDGE_MESSAGE: () => PREVIEW_BRIDGE_MESSAGE,
77
82
  PREVIEW_PARENT_ORIGIN_PARAM: () => PREVIEW_PARENT_ORIGIN_PARAM,
@@ -82,7 +87,13 @@ __export(index_exports, {
82
87
  SPACING_PX: () => SPACING_PX,
83
88
  SPACING_TO_TAILWIND: () => SPACING_TO_TAILWIND,
84
89
  SPACING_VALUES: () => SPACING_VALUES,
90
+ STALE_PAGE_VERSION_ERROR: () => STALE_PAGE_VERSION_ERROR,
85
91
  STYLE_REGISTRY: () => STYLE_REGISTRY,
92
+ SYNC_CHANGED_MAX_DELAY_MS: () => SYNC_CHANGED_MAX_DELAY_MS,
93
+ SYNC_EVENT_NAME: () => SYNC_EVENT_NAME,
94
+ SYNC_MESSAGE_VERSION: () => SYNC_MESSAGE_VERSION,
95
+ SYNC_TAG_PATTERN: () => SYNC_TAG_PATTERN,
96
+ SYNC_VALID_UNTIL_MAX_DELAY_MS: () => SYNC_VALID_UNTIL_MAX_DELAY_MS,
86
97
  SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
87
98
  WEB_FOOTER_PRESET_OPTIONS: () => WEB_FOOTER_PRESET_OPTIONS,
88
99
  WEB_FOOTER_PRESET_VALUES: () => WEB_FOOTER_PRESET_VALUES,
@@ -180,6 +191,7 @@ __export(index_exports, {
180
191
  mergeHeaderLayers: () => mergeHeaderLayers,
181
192
  nextSortOnHeaderClick: () => nextSortOnHeaderClick,
182
193
  normalizePagesResolvePath: () => normalizePagesResolvePath,
194
+ pageDependsOn: () => pageDependsOn,
183
195
  pageUrlToMobileRoute: () => pageUrlToMobileRoute,
184
196
  parseDimensionToReactNative: () => parseDimensionToReactNative,
185
197
  parseDimensionToWeb: () => parseDimensionToWeb,
@@ -192,6 +204,8 @@ __export(index_exports, {
192
204
  parseOptionCodes: () => parseOptionCodes,
193
205
  parseOptionLabels: () => parseOptionLabels,
194
206
  parseSpacing: () => parseSpacing,
207
+ parseSyncMessage: () => parseSyncMessage,
208
+ parseSyncMessageJson: () => parseSyncMessageJson,
195
209
  pickFormListQuery: () => pickFormListQuery,
196
210
  previewKeywordFromPath: () => previewKeywordFromPath,
197
211
  radiusToPx: () => radiusToPx,
@@ -234,6 +248,7 @@ __export(index_exports, {
234
248
  splitHeaderLayers: () => splitHeaderLayers,
235
249
  stripHtmlToText: () => stripHtmlToText,
236
250
  stylePlatformToSet: () => stylePlatformToSet,
251
+ syncRefetchDelayMs: () => syncRefetchDelayMs,
237
252
  toHeroUiSemanticProps: () => toHeroUiSemanticProps,
238
253
  toMantineSemanticProps: () => toMantineSemanticProps,
239
254
  toReactNativeSemanticStyle: () => toReactNativeSemanticStyle,
@@ -288,14 +303,15 @@ var PERMISSIONS = {
288
303
  ADMIN_SCHEDULED_JOB_EXECUTE: "admin.scheduled_job.execute",
289
304
  ADMIN_SCHEDULED_JOB_DELETE: "admin.scheduled_job.delete",
290
305
  ADMIN_SCHEDULED_JOB_MANAGE: "admin.scheduled_job.manage",
306
+ ADMIN_SECTION_READ: "admin.section.read",
291
307
  ADMIN_SECTION_DELETE: "admin.section.delete",
292
- ADMIN_SETTINGS: "admin.settings",
308
+ ADMIN_LANGUAGE_READ: "admin.language.read",
309
+ ADMIN_LANGUAGE_UPDATE: "admin.language.update",
293
310
  ADMIN_CMS_PREFERENCES_READ: "admin.cms_preferences.read",
294
- ADMIN_CMS_PREFERENCES_UPDATE: "admin.cms_preferences.update",
295
311
  ADMIN_CACHE_READ: "admin.cache.read",
296
312
  ADMIN_CACHE_CLEAR: "admin.cache.clear",
297
313
  ADMIN_CACHE_MANAGE: "admin.cache.manage",
298
- ADMIN_AUDIT_VIEW: "admin.audit.view"
314
+ ADMIN_AUDIT_READ: "admin.audit.read"
299
315
  };
300
316
 
301
317
  // src/types/cms-app.ts
@@ -720,8 +736,21 @@ var ENDPOINTS = {
720
736
  COMPARE: (tableName, recordId) => `${API_VERSION_PREFIX}/admin/data/tables/${encodeURIComponent(tableName)}/records/${recordId}/compare`,
721
737
  RESTORE: (tableName, recordId) => `${API_VERSION_PREFIX}/admin/data/tables/${encodeURIComponent(tableName)}/records/${recordId}/restore`,
722
738
  VERSION_FILE: (tableName, recordId, version, fieldKey) => `${API_VERSION_PREFIX}/admin/data/tables/${encodeURIComponent(tableName)}/records/${recordId}/versions/${version}/files/${encodeURIComponent(fieldKey)}`
739
+ },
740
+ /**
741
+ * Page edit lock (live sync, C9). Route permission `admin.page.update` plus
742
+ * the update grant on the page. `LOCK` serves three methods: GET (status),
743
+ * POST (acquire or renew) and DELETE (release); `TAKE_OVER` is POST only.
744
+ * Every route answers an `IPageLockStatus`.
745
+ */
746
+ ADMIN_PAGE_LOCK: {
747
+ LOCK: (pageId) => `${API_VERSION_PREFIX}/admin/pages/${pageId}/lock`,
748
+ TAKE_OVER: (pageId) => `${API_VERSION_PREFIX}/admin/pages/${pageId}/lock/take-over`
723
749
  }
724
750
  };
751
+ var HEADER_ACL_STAMP = "X-Acl-Stamp";
752
+ var HEADER_PAGE_VIEW = "X-Page-View";
753
+ var HEADER_PAGE_VERSION = "X-Page-Version";
725
754
  var HEADER_CLIENT_TYPE = "X-Client-Type";
726
755
  var CLIENT_TYPE_WEB = "web";
727
756
  var CLIENT_TYPE_MOBILE = "mobile";
@@ -3254,6 +3283,52 @@ function expandedIdsForActiveTrail(items, pathname, platform) {
3254
3283
  return expanded;
3255
3284
  }
3256
3285
 
3286
+ // src/sync/types.ts
3287
+ var SYNC_EVENT_NAME = "changed";
3288
+ var SYNC_MESSAGE_VERSION = 1;
3289
+ var SYNC_TAG_PATTERN = /^(acl|navigation|global_values|page:\d+|page_draft:\d+|page_lock:\d+|table:\d+|section:\d+|asset:\d+)$/;
3290
+ var PAGE_VERSION_REQUIRED_ERROR = "page_version_required";
3291
+ var STALE_PAGE_VERSION_ERROR = "stale_page_version";
3292
+ var PAGE_LOCKED_ERROR = "page_locked";
3293
+
3294
+ // src/sync/sync.ts
3295
+ var SYNC_CHANGED_MAX_DELAY_MS = 300;
3296
+ var SYNC_VALID_UNTIL_MAX_DELAY_MS = 2e3;
3297
+ function isRecord(value) {
3298
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3299
+ }
3300
+ function parseSyncMessage(data) {
3301
+ if (!isRecord(data) || data.v !== SYNC_MESSAGE_VERSION || !Array.isArray(data.tags)) {
3302
+ return null;
3303
+ }
3304
+ const tags = [];
3305
+ for (const tag of data.tags) {
3306
+ if (typeof tag === "string" && SYNC_TAG_PATTERN.test(tag) && !tags.includes(tag)) {
3307
+ tags.push(tag);
3308
+ }
3309
+ }
3310
+ return tags.length === 0 ? null : { v: SYNC_MESSAGE_VERSION, tags };
3311
+ }
3312
+ function parseSyncMessageJson(raw) {
3313
+ try {
3314
+ return parseSyncMessage(JSON.parse(raw));
3315
+ } catch {
3316
+ return null;
3317
+ }
3318
+ }
3319
+ function pageDependsOn(sync, tags) {
3320
+ if (!sync || !Array.isArray(sync.depends_on) || sync.depends_on.length === 0) {
3321
+ return false;
3322
+ }
3323
+ return tags.some((tag) => sync.depends_on.includes(tag));
3324
+ }
3325
+ function syncRefetchDelayMs(kind, random = Math.random) {
3326
+ const max = kind === "changed" ? SYNC_CHANGED_MAX_DELAY_MS : SYNC_VALID_UNTIL_MAX_DELAY_MS;
3327
+ const r = random();
3328
+ const unit = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) : 0;
3329
+ return Math.min(max, Math.floor(unit * (max + 1)));
3330
+ }
3331
+
3257
3332
  // src/utils/spacing.ts
3258
3333
  var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
3259
3334
  function parseSpacing(raw) {
@@ -3310,9 +3385,6 @@ function transformPageData(apiPage) {
3310
3385
  id_users: apiPage.id_users,
3311
3386
  id_pages: apiPage.id_pages ?? id,
3312
3387
  acl_select: apiPage.acl_select,
3313
- acl_insert: apiPage.acl_insert,
3314
- acl_update: apiPage.acl_update,
3315
- acl_delete: apiPage.acl_delete,
3316
3388
  id_page_types: apiPage.id_page_types,
3317
3389
  id_page_access_types: apiPage.id_page_access_types
3318
3390
  };
@@ -3354,7 +3426,10 @@ function transformPagesData(pages) {
3354
3426
  FORM_RECORD_PREFILL_SKIP_FIELDS,
3355
3427
  FORM_SECTION_STYLE_NAMES,
3356
3428
  FULL_RADIUS_PX,
3429
+ HEADER_ACL_STAMP,
3357
3430
  HEADER_CLIENT_TYPE,
3431
+ HEADER_PAGE_VERSION,
3432
+ HEADER_PAGE_VIEW,
3358
3433
  LINE_HEIGHT,
3359
3434
  LITERAL_CLASSES,
3360
3435
  MOBILE_ICON_NAMES,
@@ -3365,6 +3440,8 @@ function transformPagesData(pages) {
3365
3440
  NAVIGATION_BUNDLE_VERSION,
3366
3441
  NAVIGATION_HEADER_LAYER_TOP,
3367
3442
  OPTION_STYLE_CONFIGS,
3443
+ PAGE_LOCKED_ERROR,
3444
+ PAGE_VERSION_REQUIRED_ERROR,
3368
3445
  PERMISSIONS,
3369
3446
  PREVIEW_BRIDGE_MESSAGE,
3370
3447
  PREVIEW_PARENT_ORIGIN_PARAM,
@@ -3375,7 +3452,13 @@ function transformPagesData(pages) {
3375
3452
  SPACING_PX,
3376
3453
  SPACING_TO_TAILWIND,
3377
3454
  SPACING_VALUES,
3455
+ STALE_PAGE_VERSION_ERROR,
3378
3456
  STYLE_REGISTRY,
3457
+ SYNC_CHANGED_MAX_DELAY_MS,
3458
+ SYNC_EVENT_NAME,
3459
+ SYNC_MESSAGE_VERSION,
3460
+ SYNC_TAG_PATTERN,
3461
+ SYNC_VALID_UNTIL_MAX_DELAY_MS,
3379
3462
  SYSTEM_ENDPOINTS,
3380
3463
  WEB_FOOTER_PRESET_OPTIONS,
3381
3464
  WEB_FOOTER_PRESET_VALUES,
@@ -3473,6 +3556,7 @@ function transformPagesData(pages) {
3473
3556
  mergeHeaderLayers,
3474
3557
  nextSortOnHeaderClick,
3475
3558
  normalizePagesResolvePath,
3559
+ pageDependsOn,
3476
3560
  pageUrlToMobileRoute,
3477
3561
  parseDimensionToReactNative,
3478
3562
  parseDimensionToWeb,
@@ -3485,6 +3569,8 @@ function transformPagesData(pages) {
3485
3569
  parseOptionCodes,
3486
3570
  parseOptionLabels,
3487
3571
  parseSpacing,
3572
+ parseSyncMessage,
3573
+ parseSyncMessageJson,
3488
3574
  pickFormListQuery,
3489
3575
  previewKeywordFromPath,
3490
3576
  radiusToPx,
@@ -3527,6 +3613,7 @@ function transformPagesData(pages) {
3527
3613
  splitHeaderLayers,
3528
3614
  stripHtmlToText,
3529
3615
  stylePlatformToSet,
3616
+ syncRefetchDelayMs,
3530
3617
  toHeroUiSemanticProps,
3531
3618
  toMantineSemanticProps,
3532
3619
  toReactNativeSemanticStyle,