@selfhelp/shared 1.23.0 → 1.24.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 +107 -0
- package/dist/index.d.mts +300 -100
- package/dist/index.d.ts +300 -100
- package/dist/index.js +519 -3
- package/dist/index.mjs +495 -3
- package/dist/plugin-sdk/index.d.mts +1 -1
- package/dist/plugin-sdk/index.d.ts +1 -1
- package/dist/plugin-sdk/index.js +3 -1
- package/dist/plugin-sdk/index.mjs +3 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +3 -1
- package/dist/registry/index.mjs +3 -1
- package/dist/{styles.registry-BBd9T2Ox.d.ts → styles.registry-BKWoDg7q.d.ts} +701 -2
- package/dist/{styles.registry-IjDTff8P.d.mts → styles.registry-aopb3vsI.d.mts} +701 -2
- package/package.json +1 -1
- package/src/api/__tests__/endpoints.test.ts +45 -0
- package/src/api/__tests__/formListErrors.test.ts +143 -0
- package/src/api/endpoints.ts +41 -0
- package/src/api/formListErrors.ts +134 -0
- package/src/api/index.ts +1 -0
- package/src/content/__tests__/formListState.test.ts +448 -0
- package/src/content/__tests__/formRecordPrefill.test.ts +120 -0
- package/src/content/formListState.ts +559 -0
- package/src/content/formRecordPrefill.ts +108 -5
- package/src/content/index.ts +1 -0
- package/src/registry/__tests__/platform.test.ts +15 -6
- package/src/registry/styles.registry.ts +2 -0
- package/src/types/api/__tests__/formWrites.test.ts +84 -0
- package/src/types/api/form-lists.ts +469 -0
- package/src/types/api/forms.ts +149 -4
- package/src/types/api/index.ts +1 -0
- package/src/types/styles/composite.ts +13 -0
- package/src/types/styles/forms.ts +84 -0
- package/src/types/styles/unknown.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,113 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
10
10
|
This project follows semantic versioning.
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
## v1.24.0
|
|
14
|
+
|
|
15
|
+
- **Form list URL mode `history`.** `TFormListMode` and `FORM_LIST_MODES` include
|
|
16
|
+
`history` so `?key.mode=history` opens a record on the history tab (with
|
|
17
|
+
`showHistory: false` refused as `history_disabled`).
|
|
18
|
+
|
|
19
|
+
Entry lists with a form and read-only data views (pairs with core `0.1.44`,
|
|
20
|
+
frontend `0.1.71`, mobile `0.1.35`). New styles, DTOs, endpoint helpers and URL
|
|
21
|
+
helpers; three existing DTOs gain the record `version`. The server decides and
|
|
22
|
+
the clients draw: nothing here lets a client evaluate access, conditions,
|
|
23
|
+
filters or quick-action assignments.
|
|
24
|
+
|
|
25
|
+
**CMS app media and publish (F165–F166):** column format `image`; file/image cells
|
|
26
|
+
are `{ files: [{ index, name, mime?, size?, url }] }` (section-scoped URLs);
|
|
27
|
+
prefill keeps that shape (`asFilesCell`); `IFormFileFieldOp` for keep/remove/
|
|
28
|
+
replace; `ENDPOINTS.LISTS.CURRENT_FILE` and `ENDPOINTS.ADMIN_DATA_HISTORY.*`;
|
|
29
|
+
historical files may carry `url`; admin history response aliases;
|
|
30
|
+
`IEntryRecordStyle.fixed_filter`; schema-parity covers the five admin history
|
|
31
|
+
contracts.
|
|
32
|
+
|
|
33
|
+
- **Styles.** `'entry-form-list'` (forms, can have children: its inline form)
|
|
34
|
+
and `'data-view'` (forms, can have children: the layout of one record, see
|
|
35
|
+
below) are in `BASE_STYLE_REGISTRY`; the core catalog is now 93 styles.
|
|
36
|
+
`IEntryFormListStyle`, `IDataViewStyle` and the shared base `IFormListBaseStyle`
|
|
37
|
+
(configuration fields, `list_state`, `list_error`) join `TStyle`. A renderer map
|
|
38
|
+
keyed by every `TStyle` (web and mobile) must add both styles.
|
|
39
|
+
- **Data view row templates.** `TFormListLayout` is `'table' | 'cards' | 'custom'`.
|
|
40
|
+
With `custom` the sections placed inside a `data-view` are the template of ONE
|
|
41
|
+
record: the server renders them per record into `IFormListRow.sections`
|
|
42
|
+
(`TStyle[]`, tokens, translations and conditions already resolved) and the page
|
|
43
|
+
carries no children for the view. `IFormListInfo` gains `row_css` (the classes of
|
|
44
|
+
the element that holds the records, web only) and `has_template` (a `custom`
|
|
45
|
+
layout without sections is drawn as cards); `IDataViewStyle` gains `list_row_css`.
|
|
46
|
+
Clients render `sections` like any other sections and evaluate nothing.
|
|
47
|
+
- **List DTOs** (`src/types/api/form-lists.ts`, exported from the package root):
|
|
48
|
+
`IFormListState` (list, columns, controls, served state, capabilities, rows,
|
|
49
|
+
pagination, selected record), `IFormListError`, the quick-action, history,
|
|
50
|
+
version, comparison and restore requests/responses, and the two error payloads
|
|
51
|
+
`IFormStaleVersionData` (409 `stale_version`: nothing written, keep the draft)
|
|
52
|
+
and `IFormListRestoreBlockedData` (422 `restore_blocked`).
|
|
53
|
+
- **Endpoints.** `ENDPOINTS.LISTS` builds the state, quick-action, history,
|
|
54
|
+
version, comparison, restore and historical-file routes. A list has no create,
|
|
55
|
+
update or delete route of its own: writes keep using `ENDPOINTS.FORMS`.
|
|
56
|
+
- **URL helpers** (`src/content/formListState.ts`), the same grammar the server
|
|
57
|
+
parses (`<key>.page`, `.q`, `.sort`, `.f.<id>`, `.record`, `.mode`):
|
|
58
|
+
`parseFormListQuery` (strict, mirrors the backend parser rule for rule),
|
|
59
|
+
`encodeFormListQuery`, `formListQueryString` (keeps every foreign parameter),
|
|
60
|
+
`applyFormListUrlChange`, `nextSortOnHeaderClick`, `pickFormListQuery` (the raw
|
|
61
|
+
pairs a client forwards to `/pages/by-keyword` and `/pages/resolve`) and
|
|
62
|
+
`formListCacheKey` (API base, account or guest, language, platform, page,
|
|
63
|
+
section, the declared route of the page and the normalized list parameters;
|
|
64
|
+
the last part is always the list's own state).
|
|
65
|
+
- **Route of a page in a list state request.** A record template can read
|
|
66
|
+
`{{route.record_id}}` of a page with a route, so the state of a list depends on the
|
|
67
|
+
route. `formListRouteQuery(page.route_params)` returns the `route[<name>]=<value>`
|
|
68
|
+
pairs of `GET /lists/{id}/state` (sorted, percent-encoded, at most
|
|
69
|
+
`FORM_LIST_MAX_ROUTE_PARAMS`, values up to `FORM_LIST_MAX_ROUTE_VALUE_LENGTH`
|
|
70
|
+
characters; `''` for a page without a route), and `IFormListCacheScope.route` puts
|
|
71
|
+
the route into the cache key, so `/team/3` and `/team/4` never share a list state.
|
|
72
|
+
The server does not believe the parameters: it checks them against the routes of the
|
|
73
|
+
page (`400 route_mismatch` / `invalid_route`).
|
|
74
|
+
- **Form DTOs.** `IFormSubmitData.version` and `IFormUpdateData.version` are now
|
|
75
|
+
required (the backend always sends the record version); `IFormDeleteResponse.data`
|
|
76
|
+
is `IFormDeleteData` (`record_id` and `version`, the old `success` and `message`
|
|
77
|
+
stay as optional legacy keys). Code that builds submit/update results itself
|
|
78
|
+
(tests, mocks) must add `version`.
|
|
79
|
+
- **Strict record versions.** `IFormUpdateRequest.expected_version` and
|
|
80
|
+
`IFormDeleteRequest.expected_version` are **required**, like
|
|
81
|
+
`IFormListQuickActionRequest.expected_version` (and the `expected_version` of a
|
|
82
|
+
real restore): core `0.1.44` refuses an interactive update, delete, quick action
|
|
83
|
+
or restore that names no record version, or one that is not a whole number of at
|
|
84
|
+
least 1, with 400 `expected_version_required` / `invalid_expected_version`
|
|
85
|
+
before anything is stored, uploaded or scheduled. The request schemas keep the
|
|
86
|
+
field optional only so the refusal can carry its reason. Code that builds these
|
|
87
|
+
requests itself (clients, tests, mocks, plugins) must send the version it last
|
|
88
|
+
received.
|
|
89
|
+
- **Where the classic record styles read the version.** The page says it, next to the
|
|
90
|
+
record (core `0.1.44` builds it with the page): `IFormRecordPrefill.version`
|
|
91
|
+
(`parseFormRecordPrefill` reads `_version` from the prefilled rows of a
|
|
92
|
+
`form-record` / `entry-record-form`; `_version` is skipped in
|
|
93
|
+
`FORM_RECORD_PREFILL_SKIP_FIELDS`, so it never becomes a form field and is never
|
|
94
|
+
written back), `IEntryTableEntry._version` (rows that offer edit or delete) and
|
|
95
|
+
`IEntryRecordDeleteStyle.record_version` (digits, next to `record_id`). Read a
|
|
96
|
+
version with `asRecordVersion` (a whole number of at least 1, a number or digits);
|
|
97
|
+
an absent one means the page offered none.
|
|
98
|
+
- **The page version a request acts on.** `IFormEffectiveContext` (`preview?:
|
|
99
|
+
boolean`) is part of every write request (`IFormSubmitRequest`,
|
|
100
|
+
`IFormUpdateRequest`, `IFormDeleteRequest`, `IFormListQuickActionRequest`,
|
|
101
|
+
`IFormListRestoreRequest`) and of the history and comparison queries. Send it
|
|
102
|
+
exactly when the person looks at the draft of the page; without it the
|
|
103
|
+
published version decides, also for a signed-in person. The client never
|
|
104
|
+
decides what is allowed: the server judges the request by the same inputs,
|
|
105
|
+
conditions, list properties and quick actions as the page it served.
|
|
106
|
+
- **Refusals.** `IFormInvalidData`, `IFormInputError` and `TFormInputRule` describe
|
|
107
|
+
the 422 `invalid_form_data` answer (a value breaks the rules of the CURRENT
|
|
108
|
+
form; the whole write is refused, nothing is stored, uploaded or scheduled);
|
|
109
|
+
`getFormInvalidData(error)` reads it. `TFormWriteRefusalReason` lists the
|
|
110
|
+
`data.reason` values of the other write refusals (400, 401, 403, 404, 409): a
|
|
111
|
+
client branches on the reason, never on the message.
|
|
112
|
+
- `scripts/check-schema-parity.mjs` checks 25 more backend contracts (51 in all):
|
|
113
|
+
every list shape, the list error, the delete result and the new requests.
|
|
114
|
+
- **Fix.** `FORM_RECORD_PREFILL_SKIP_FIELDS` now also skips `id_action_trigger_types`,
|
|
115
|
+
the spelling the data store and the list engine use (only the old
|
|
116
|
+
`id_actionTriggerTypes` was skipped). A client that sends the prefilled record
|
|
117
|
+
back as the form data (the mobile app) wrote the trigger type into the form
|
|
118
|
+
and the server refused the save ("not allowed in form data").
|
|
119
|
+
|
|
13
120
|
## v1.23.0
|
|
14
121
|
|
|
15
122
|
Additive "about the platform" contract (pairs with core `0.1.43`, frontend
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TStyleName, j as IContentField, k as
|
|
2
|
-
export { B as BASE_STYLE_REGISTRY,
|
|
1
|
+
import { T as TStyleName, j as IContentField, k as IBaseApiResponse, l as IAboutItem, m as TMobileButtonFeedback, n as TMobileFieldVariant, o as TMobileSelectPresentation, p as IFormInvalidData, q as IFormListRestoreBlockedData, r as IFormStaleVersionData, s as IFormListFilesCell, t as TFormListMode, u as IFormListSort } from './styles.registry-aopb3vsI.mjs';
|
|
2
|
+
export { B as BASE_STYLE_REGISTRY, v as IAccordionItemStyle, w as IAccordionStyle, x as IActionIconStyle, y as IAdminDataRecordCompareResponse, z as IAdminDataRecordHistoryResponse, A as IAdminDataRecordRestoreRequest, C as IAdminDataRecordRestoreResponse, D as IAdminDataRecordVersionResponse, E as IAlertStyle, F as IApiError, G as IApiMeta, H as IAspectRatioStyle, J as IAudioStyle, K as IAvatarStyle, L as IBackgroundImageStyle, M as IBadgeStyle, N as IBaseStyle, O as IBlockquoteStyle, P as IBoxStyle, Q as IButtonStyle, R as ICardSegmentStyle, U as ICardStyle, V as ICarouselStyle, W as ICenterStyle, X as ICheckboxStyle, Y as IChipStyle, Z as ICodeStyle, $ as IColorInputStyle, a0 as IColorPickerStyle, a1 as IComboboxStyle, a2 as IContainerStyle, a3 as IDataContainerStyle, a4 as IDataViewStyle, a5 as IDatePickerStyle, a6 as IDividerStyle, a7 as IEntryFormListStyle, a8 as IEntryListStyle, a9 as IEntryRecordDeleteStyle, aa as IEntryRecordFormStyle, ab as IEntryRecordStyle, ac as IEntryTableEntry, ad as IEntryTableStyle, ae as IFieldsetStyle, af as IFigureStyle, ag as IFileInputStyle, ah as IFlexStyle, ai as IFormDeleteData, aj as IFormDeleteRequest, ak as IFormDeleteResponse, al as IFormEffectiveContext, am as IFormFileFieldOp, an as IFormInputError, ao as IFormListActor, ap as IFormListBaseStyle, aq as IFormListCapabilities, ar as IFormListColumn, as as IFormListCompareData, at as IFormListCompareQuery, au as IFormListCompareResponse, av as IFormListControl, aw as IFormListControlOption, ax as IFormListError, ay as IFormListFileChange, az as IFormListFileValue, aA as IFormListHistoricalFile, aB as IFormListHistoryData, aC as IFormListHistoryQuery, aD as IFormListHistoryResponse, aE as IFormListInfo, aF as IFormListPagination, aG as IFormListQuickActionData, aH as IFormListQuickActionInfo, aI as IFormListQuickActionRequest, aJ as IFormListQuickActionResponse, aK as IFormListRecordAccess, aL as IFormListRestoreBlocker, aM as IFormListRestoreChange, aN as IFormListRestorePreview, aO as IFormListRestoreRequest, aP as IFormListRestoreResponse, aQ as IFormListRestoreResult, aR as IFormListRevision, aS as IFormListRow, aT as IFormListSelected, aU as IFormListServedState, aV as IFormListState, aW as IFormListStateField, aX as IFormListStateResponse, aY as IFormListValueChange, aZ as IFormListVersionData, a_ as IFormListVersionResponse, a$ as IFormLogStyle, b0 as IFormRecordStyle, b1 as IFormResultLegacyFields, b2 as IFormStyle, b3 as IFormSubmitData, b4 as IFormSubmitRequest, b5 as IFormSubmitResponse, b6 as IFormUpdateData, b7 as IFormUpdateRequest, b8 as IFormUpdateResponse, b9 as IGridColumnStyle, ba as IGridStyle, bb as IGroupStyle, bc as IHighlightStyle, bd as IHtmlTagStyle, be as IImageStyle, bf as IIndicatorStyle, bg as IInputStyle, bh as IKbdStyle, bi as ILinkStyle, bj as IListItemStyle, bk as IListStyle, bl as ILoginStyle, bm as ILoopStyle, bn as IMeta, bo as IMissingStyle, bp as INoAccessStyle, bq as INotFoundStyle, br as INotificationStyle, bs as INumberInputStyle, bt as IPaperStyle, bu as IPlatformAbout, a as IPluginStyleRegistryEntry, bv as IProfileStyle, bw as IProgressRootStyle, bx as IProgressSectionStyle, by as IProgressStyle, bz as IRadioStyle, bA as IRangeSliderStyle, bB as IRatingStyle, bC as IRefContainerStyle, bD as IRegisterStyle, bE as IResetPasswordStyle, bF as IRichTextEditorStyle, bG as IScrollAreaStyle, bH as ISegmentedControlStyle, bI as ISelectStyle, bJ as ISimpleGridStyle, bK as ISliderStyle, bL as ISpaceStyle, bM as ISpoilerStyle, bN as IStackStyle, I as IStyleRegistryEntry, bO as IStyleWithSpacing, bP as ISwitchStyle, bQ as ITabStyle, bR as ITabsStyle, bS as ITextInputStyle, bT as ITextStyle, bU as ITextareaStyle, bV as IThemeIconStyle, bW as ITimelineItemStyle, bX as ITimelineStyle, bY as ITitleStyle, bZ as ITwoFactorAuthStyle, b_ as ITypographyStyle, b$ as IUnknownStyle, c0 as IValidateStyle, c1 as IVersionStyle, c2 as IVideoStyle, S as STYLE_REGISTRY, c as TConcretePlatform, c3 as TDataRevisionOperation, c4 as TDataRevisionSource, c5 as TFormConflictData, c6 as TFormInputRule, c7 as TFormListCellValue, c8 as TFormListChange, c9 as TFormListColumnFormat, ca as TFormListControlType, cb as TFormListErrorReason, cc as TFormListLabels, cd as TFormListLayout, ce as TFormListOpenMode, cf as TFormListPresentation, cg as TFormListRestoreBlockerReason, ch as TFormListRestoreData, ci as TFormListSortDirection, cj as TFormListStyleName, ck as TFormListTextMatch, cl as TFormWriteRefusalReason, cm as TMantineAccordionChevronPosition, cn as TMantineAccordionDisableChevronRotation, co as TMantineAccordionLoop, cp as TMantineAccordionMultiple, cq as TMantineAnchorUnderline, cr as TMantineBorder, cs as TMantineCardPadding, ct as TMantineCardShadow, cu as TMantineCols, cv as TMantineDividerVariant, cw as TMantineGap, cx as TMantineGridOffset, cy as TMantineGridOrder, cz as TMantineHeight, cA as TMantineIconSize, cB as TMantineImageFit, cC as TMantineLineClamp, cD as TMantineListCenter, cE as TMantineListStyleType, cF as TMantineListType, cG as TMantineListWithPadding, cH as TMantinePaperShadow, cI as TMantineProgressTransition, cJ as TMantineScrollAreaSize, cK as TMantineScrollAreaType, cL as TMantineTextAlign, cM as TMantineTextDecoration, cN as TMantineTextFontStyle, cO as TMantineTextFontWeight, cP as TMantineTextInherit, cQ as TMantineTextInputVariant, cR as TMantineTextSpan, cS as TMantineTextTransform, cT as TMantineTextTruncate, cU as TMantineTextVariant, cV as TMantineTextareaAutosize, cW as TMantineTextareaResize, cX as TMantineTextareaVariant, cY as TMantineTimelineAlign, cZ as TMantineTitleLineClamp, c_ as TMantineTitleTextWrap, c$ as TMantineTranslatable, d0 as TMantineUseInputWrapper, d1 as TMantineWidth, d2 as TSharedBorder, d3 as TSharedCols, d4 as TSharedDimension, d5 as TSharedDividerLabelPosition, d6 as TSharedDividerVariant, d7 as TSharedLabelPosition, d8 as TStyle, b as TStylePlacement, d as TStylePlatform, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from './styles.registry-aopb3vsI.mjs';
|
|
3
3
|
export { v as TMantineAccordionVariant, y as TMantineActionIconLoading, d as TMantineAlign, z as TMantineAllowNextClicks, A as TMantineAllowStepClick, B as TMantineAspectRatio, C as TMantineAutoContrast, r as TMantineAvatarVariant, q as TMantineBadgeVariant, D as TMantineBlock, E as TMantineCenterInline, F as TMantineChecked, G as TMantineChipChecked, H as TMantineChipMultiple, s as TMantineChipVariant, I as TMantineClampBehavior, J as TMantineCodeBlock, T as TMantineColor, K as TMantineColorFormat, L as TMantineColorInputSwatches, M as TMantineColorPickerSwatches, N as TMantineColorPickerSwatchesPerRow, O as TMantineCompact, P as TMantineContainerFluid, e as TMantineDirection, Q as TMantineDisabled, n as TMantineFieldsetVariant, R as TMantineFileAccept, S as TMantineFileInputMultiple, U as TMantineFluid, V as TMantineFullWidth, i as TMantineGridGrow, g as TMantineGridOverflow, h as TMantineGridSpan, W as TMantineGroupGrow, X as TMantineGroupWrap, Y as TMantineGrow, Z as TMantineHighlight, t as TMantineIndicatorPosition, _ as TMantineInline, $ as TMantineIsLink, c as TMantineJustify, a0 as TMantineKbdSize, a1 as TMantineLoading, a2 as TMantineMultiple, a3 as TMantineNotificationWithCloseButton, a4 as TMantineNumberInputDecimalScale, a5 as TMantineOpenInNewTab, j as TMantineOrientation, a6 as TMantineProcessing, a as TMantineRadius, a7 as TMantineRangeSliderMarks, a8 as TMantineRatingCount, a9 as TMantineRatingFractions, aa as TMantineRatingReadonly, ab as TMantineReadonly, m as TMantineSize, ac as TMantineSpaceHorizontal, ad as TMantineSpacing, o as TMantineSpoilerMaxHeight, ae as TMantineSwatches, af as TMantineTabDisabled, w as TMantineTabsVariant, u as TMantineThemeIconVariant, x as TMantineTimelineLineVariant, l as TMantineTitleOrder, ag as TMantineUseMantineStyle, p as TMantineVariant, ah as TMantineWithCloseButton, ai as TMantineWithIcon, f as TMantineWrap, k as TSharedRadius, b as TSharedSize } from './common-qaDIAYS3.mjs';
|
|
4
4
|
import { ReactNode, ComponentType } from 'react';
|
|
5
5
|
import { THeroUiButtonVariant, THeroUiSize } from './theme/index.mjs';
|
|
@@ -321,33 +321,6 @@ interface ICmsAppDetail extends ICmsAppSummary {
|
|
|
321
321
|
/** Canonical CMS app detail contract. */
|
|
322
322
|
type ICmsApp = ICmsAppDetail;
|
|
323
323
|
|
|
324
|
-
/**
|
|
325
|
-
* Common API envelope returned by the Symfony backend's ApiResponseFormatter.
|
|
326
|
-
*/
|
|
327
|
-
interface IApiMeta {
|
|
328
|
-
version: string;
|
|
329
|
-
timestamp: string;
|
|
330
|
-
}
|
|
331
|
-
type IMeta = IApiMeta;
|
|
332
|
-
interface IBaseApiResponse<TData> {
|
|
333
|
-
status: number;
|
|
334
|
-
message: string;
|
|
335
|
-
error: null | string;
|
|
336
|
-
error_type?: string;
|
|
337
|
-
logged_in: boolean;
|
|
338
|
-
meta: IApiMeta;
|
|
339
|
-
data: TData;
|
|
340
|
-
}
|
|
341
|
-
interface IApiError {
|
|
342
|
-
status: number;
|
|
343
|
-
message: string;
|
|
344
|
-
error: string;
|
|
345
|
-
error_type?: string;
|
|
346
|
-
logged_in?: boolean;
|
|
347
|
-
meta?: IApiMeta;
|
|
348
|
-
data?: unknown;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
324
|
interface ILoginRequest {
|
|
352
325
|
email: string;
|
|
353
326
|
password: string;
|
|
@@ -407,74 +380,6 @@ type IResetPasswordResponse = IBaseApiResponse<{
|
|
|
407
380
|
reset: boolean;
|
|
408
381
|
}>;
|
|
409
382
|
|
|
410
|
-
interface IFormSubmitRequest {
|
|
411
|
-
section_id: number;
|
|
412
|
-
page_id?: number;
|
|
413
|
-
record_id?: number;
|
|
414
|
-
form_data: Record<string, unknown>;
|
|
415
|
-
}
|
|
416
|
-
interface IFormUpdateRequest {
|
|
417
|
-
section_id: number;
|
|
418
|
-
page_id?: number;
|
|
419
|
-
record_id?: number;
|
|
420
|
-
form_data: Record<string, unknown>;
|
|
421
|
-
update_based_on?: Record<string, unknown>;
|
|
422
|
-
}
|
|
423
|
-
interface IFormDeleteRequest {
|
|
424
|
-
record_id: number;
|
|
425
|
-
page_id?: number;
|
|
426
|
-
section_id: number;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Legacy/aspirational form-result fields.
|
|
430
|
-
*
|
|
431
|
-
* @deprecated The current backend `form_submitted` / `form_updated` responses
|
|
432
|
-
* do NOT include these. `FormController` returns only the structured fields on
|
|
433
|
-
* {@link IFormSubmitData} / {@link IFormUpdateData}, and both JSON schemas
|
|
434
|
-
* declare `additionalProperties: false`. Frontend code that reads
|
|
435
|
-
* `data.success` / `data.message` (e.g. `useFormSubmission.ts`) is reading
|
|
436
|
-
* values the backend never sends. Kept OPTIONAL so consumers keep compiling
|
|
437
|
-
* during migration; drop them once no consumer references them.
|
|
438
|
-
*/
|
|
439
|
-
interface IFormResultLegacyFields {
|
|
440
|
-
/** @deprecated Not returned by the current backend form endpoints. */
|
|
441
|
-
success?: boolean;
|
|
442
|
-
/** @deprecated Not returned by the current backend form endpoints. */
|
|
443
|
-
redirect_url?: string;
|
|
444
|
-
/** @deprecated Not returned by the current backend form endpoints. */
|
|
445
|
-
message?: string;
|
|
446
|
-
/** @deprecated Not returned by the current backend form endpoints. */
|
|
447
|
-
field_errors?: Record<string, string>;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Data returned by a successful POST form submit. Mirrors the backend contract
|
|
451
|
-
* `config/schemas/api/v1/responses/frontend/form_submitted.json`.
|
|
452
|
-
*/
|
|
453
|
-
interface IFormSubmitData extends IFormResultLegacyFields {
|
|
454
|
-
record_id: number;
|
|
455
|
-
section_id: number;
|
|
456
|
-
page_id: number;
|
|
457
|
-
submitted_at: string;
|
|
458
|
-
user_authenticated: boolean;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Data returned by a successful PUT form update. Mirrors the backend contract
|
|
462
|
-
* `config/schemas/api/v1/responses/frontend/form_updated.json` (note: the
|
|
463
|
-
* update response carries `updated_at`, not `submitted_at`/`user_authenticated`).
|
|
464
|
-
*/
|
|
465
|
-
interface IFormUpdateData extends IFormResultLegacyFields {
|
|
466
|
-
record_id: number;
|
|
467
|
-
section_id: number;
|
|
468
|
-
page_id: number;
|
|
469
|
-
updated_at: string;
|
|
470
|
-
}
|
|
471
|
-
type IFormSubmitResponse = IBaseApiResponse<IFormSubmitData>;
|
|
472
|
-
type IFormUpdateResponse = IBaseApiResponse<IFormUpdateData>;
|
|
473
|
-
type IFormDeleteResponse = IBaseApiResponse<{
|
|
474
|
-
success: boolean;
|
|
475
|
-
message?: string;
|
|
476
|
-
}>;
|
|
477
|
-
|
|
478
383
|
interface ILanguageItem extends ILanguagePreference {
|
|
479
384
|
is_default?: boolean;
|
|
480
385
|
}
|
|
@@ -1870,6 +1775,35 @@ declare const ENDPOINTS: {
|
|
|
1870
1775
|
readonly UPDATE: "/cms-api/v1/forms/update";
|
|
1871
1776
|
readonly DELETE: "/cms-api/v1/forms/delete";
|
|
1872
1777
|
};
|
|
1778
|
+
/**
|
|
1779
|
+
* `entry-form-list` / `data-view` lists. A list never has its own create,
|
|
1780
|
+
* update or delete route: writes go through {@link ENDPOINTS.FORMS}. The
|
|
1781
|
+
* first paint reads `list_state` from the page payload; these routes serve
|
|
1782
|
+
* the interactions after it. Path segments are numeric ids, except the
|
|
1783
|
+
* action id and the field key, which are encoded.
|
|
1784
|
+
*/
|
|
1785
|
+
readonly LISTS: {
|
|
1786
|
+
readonly STATE: (sectionId: number) => string;
|
|
1787
|
+
readonly QUICK_ACTION: (sectionId: number, recordId: number, actionId: string) => string;
|
|
1788
|
+
readonly HISTORY: (sectionId: number, recordId: number) => string;
|
|
1789
|
+
readonly VERSION: (sectionId: number, recordId: number, version: number) => string;
|
|
1790
|
+
readonly COMPARE: (sectionId: number, recordId: number) => string;
|
|
1791
|
+
readonly RESTORE: (sectionId: number, recordId: number) => string;
|
|
1792
|
+
readonly VERSION_FILE: (sectionId: number, recordId: number, version: number, fieldKey: string) => string;
|
|
1793
|
+
/** Current file of a record shown by a list / data-view / entry-record (F165). */
|
|
1794
|
+
readonly CURRENT_FILE: (sectionId: number, recordId: number, fieldKey: string) => string;
|
|
1795
|
+
};
|
|
1796
|
+
/**
|
|
1797
|
+
* Admin data-browser record history (contract 6). Route permission
|
|
1798
|
+
* `admin.data.read`; the controller also requires table UPDATE.
|
|
1799
|
+
*/
|
|
1800
|
+
readonly ADMIN_DATA_HISTORY: {
|
|
1801
|
+
readonly HISTORY: (tableName: string, recordId: number) => string;
|
|
1802
|
+
readonly VERSION: (tableName: string, recordId: number, version: number) => string;
|
|
1803
|
+
readonly COMPARE: (tableName: string, recordId: number) => string;
|
|
1804
|
+
readonly RESTORE: (tableName: string, recordId: number) => string;
|
|
1805
|
+
readonly VERSION_FILE: (tableName: string, recordId: number, version: number, fieldKey: string) => string;
|
|
1806
|
+
};
|
|
1873
1807
|
};
|
|
1874
1808
|
/** Header set the backend reads to switch page-access mode + condition platform var. */
|
|
1875
1809
|
declare const HEADER_CLIENT_TYPE = "X-Client-Type";
|
|
@@ -1878,6 +1812,52 @@ declare const CLIENT_TYPE_MOBILE = "mobile";
|
|
|
1878
1812
|
declare const CLIENT_TYPE_MOBILE_AND_WEB = "mobile_and_web";
|
|
1879
1813
|
type TClientType = typeof CLIENT_TYPE_WEB | typeof CLIENT_TYPE_MOBILE | typeof CLIENT_TYPE_MOBILE_AND_WEB;
|
|
1880
1814
|
|
|
1815
|
+
/**
|
|
1816
|
+
* Structured refusals of the entry-list workflow, read the same way by the web
|
|
1817
|
+
* and mobile clients. Every refusal travels in the normal error envelope
|
|
1818
|
+
* (`error.response.status`, `error.response.data.data`) with a stable
|
|
1819
|
+
* `data.reason`; clients branch on the reason, never on the message text.
|
|
1820
|
+
*
|
|
1821
|
+
* - `409 stale_version`: the record changed since the client read it. Nothing was
|
|
1822
|
+
* written. Keep the draft, offer reload, comparison and re-apply.
|
|
1823
|
+
* - `422 restore_blocked`: an earlier version cannot be written back whole today.
|
|
1824
|
+
* Nothing was applied; the blockers say which fields and why.
|
|
1825
|
+
* - `422 invalid_form_data`: a value breaks the rules of the CURRENT form (a save,
|
|
1826
|
+
* the candidate state of a quick action, or a restore). The whole write was
|
|
1827
|
+
* refused: keep the draft and the chosen files and show the errors
|
|
1828
|
+
* ({@link getFormInvalidData}).
|
|
1829
|
+
* - any other list refusal (`invalid_list_parameter`, `unknown_list_parameter`,
|
|
1830
|
+
* `duplicate_list_parameter`, `operation_disabled`, `history_disabled`,
|
|
1831
|
+
* `login_required`, `expected_version_required`, ...): {@link getFormListFailure};
|
|
1832
|
+
* `parameter` names the URL parameter a client may drop before it retries. The
|
|
1833
|
+
* reasons a write can answer with are listed in `TFormWriteRefusalReason`
|
|
1834
|
+
* (`types/api/forms.ts`); a client never repairs them by guessing, it fixes the
|
|
1835
|
+
* request (the version it sends, the inputs it names).
|
|
1836
|
+
*/
|
|
1837
|
+
|
|
1838
|
+
/** What a failed list request says, independent of the status it came with. */
|
|
1839
|
+
interface IFormListFailure {
|
|
1840
|
+
status: number;
|
|
1841
|
+
/** Stable machine-readable cause (`data.reason`). */
|
|
1842
|
+
reason: string;
|
|
1843
|
+
/** The URL parameter that caused it, when the server names one. */
|
|
1844
|
+
parameter: string | null;
|
|
1845
|
+
/** The server's message, for logs; never branch on it. */
|
|
1846
|
+
message: string | null;
|
|
1847
|
+
}
|
|
1848
|
+
/** The 409 of a stale save, delete, quick action or restore, else `null`. */
|
|
1849
|
+
declare function getFormStaleVersion(error: unknown): IFormStaleVersionData | null;
|
|
1850
|
+
/** The 422 of a restore that cannot be applied whole, else `null`. */
|
|
1851
|
+
declare function getFormListRestoreBlocked(error: unknown): IFormListRestoreBlockedData | null;
|
|
1852
|
+
/**
|
|
1853
|
+
* The 422 of a write whose values break the rules of the CURRENT form, else
|
|
1854
|
+
* `null`. Entries without the four documented text keys are dropped; when none is
|
|
1855
|
+
* left the helper answers `null` and the caller falls back to {@link getFormListFailure}.
|
|
1856
|
+
*/
|
|
1857
|
+
declare function getFormInvalidData(error: unknown): IFormInvalidData | null;
|
|
1858
|
+
/** Any refusal that carries a `data.reason`, else `null` (a network error, a bare 500). */
|
|
1859
|
+
declare function getFormListFailure(error: unknown): IFormListFailure | null;
|
|
1860
|
+
|
|
1881
1861
|
/** Inputs accepted by `GET /pages/resolve`. */
|
|
1882
1862
|
interface IPagesResolveParams {
|
|
1883
1863
|
/** Public URL path, e.g. `/team/7`, `/reset/42/abc`, `/`. */
|
|
@@ -2266,17 +2246,36 @@ declare function serializeFieldsMapLabels(labels: Record<string, string>): strin
|
|
|
2266
2246
|
* cannot drift between clients. The backend owns which row is present
|
|
2267
2247
|
* (`load_record_from`); this helper only reshapes that payload.
|
|
2268
2248
|
*/
|
|
2249
|
+
|
|
2269
2250
|
/** Per-language value for a translatable form field. */
|
|
2270
2251
|
interface IFormRecordPrefillTranslatedValue {
|
|
2271
2252
|
language_id: number;
|
|
2272
2253
|
value: string;
|
|
2273
2254
|
}
|
|
2274
|
-
|
|
2255
|
+
/**
|
|
2256
|
+
* A file-input prefill value (contract 4): current files with server-built URLs,
|
|
2257
|
+
* never a storage key. Same shape as a list `file`/`image` cell.
|
|
2258
|
+
*/
|
|
2259
|
+
type TFormRecordPrefillFileValue = IFormListFilesCell;
|
|
2260
|
+
type TFormRecordPrefillFieldValue = string | IFormRecordPrefillTranslatedValue[] | TFormRecordPrefillFileValue;
|
|
2275
2261
|
interface IFormRecordPrefill {
|
|
2276
2262
|
recordId: number | null;
|
|
2277
2263
|
values: Record<string, TFormRecordPrefillFieldValue>;
|
|
2264
|
+
/**
|
|
2265
|
+
* The version the record had when the page was built (`_version` of its rows). Send it back
|
|
2266
|
+
* as `expected_version` when saving or deleting the record: the server refuses a save
|
|
2267
|
+
* without it (400) and a save based on an old one (409, the draft stays). Absent when the page
|
|
2268
|
+
* offered none (a new record, or a server that does not name it).
|
|
2269
|
+
*/
|
|
2270
|
+
version?: number;
|
|
2278
2271
|
}
|
|
2279
|
-
/**
|
|
2272
|
+
/**
|
|
2273
|
+
* Metadata fields that are never form inputs. The trigger type is skipped under
|
|
2274
|
+
* both spellings: `id_action_trigger_types` is the column the data store (and the
|
|
2275
|
+
* list engine) returns, `id_actionTriggerTypes` the name older payloads used. A
|
|
2276
|
+
* form that wrote it back would be refused ("not allowed in form data"). `_version`
|
|
2277
|
+
* is the record's version, read into {@link IFormRecordPrefill.version}.
|
|
2278
|
+
*/
|
|
2280
2279
|
declare const FORM_RECORD_PREFILL_SKIP_FIELDS: ReadonlySet<string>;
|
|
2281
2280
|
interface IFormRecordPrefillChild {
|
|
2282
2281
|
name?: {
|
|
@@ -2290,6 +2289,8 @@ interface IFormRecordPrefillSection {
|
|
|
2290
2289
|
section_data?: unknown;
|
|
2291
2290
|
children?: IFormRecordPrefillChild[] | null;
|
|
2292
2291
|
}
|
|
2292
|
+
/** Narrow a prefill cell to `{ files: [...] }` when the server sent contract-4 file metadata. */
|
|
2293
|
+
declare function asFilesCell(value: unknown): TFormRecordPrefillFileValue | null;
|
|
2293
2294
|
/**
|
|
2294
2295
|
* Parse hydrated `section_data` rows into `{ recordId, values }`.
|
|
2295
2296
|
*
|
|
@@ -2300,6 +2301,8 @@ interface IFormRecordPrefillSection {
|
|
|
2300
2301
|
* - Non-translatable fields prefer language id `1`, else the first seen value.
|
|
2301
2302
|
*/
|
|
2302
2303
|
declare function parseFormRecordPrefill(section: IFormRecordPrefillSection): IFormRecordPrefill;
|
|
2304
|
+
/** A record version as the page offers it: a whole number of at least 1, as a number or as digits. */
|
|
2305
|
+
declare function asRecordVersion(value: unknown): number | null;
|
|
2303
2306
|
/**
|
|
2304
2307
|
* Flatten rich prefill values to plain strings for clients that do not keep
|
|
2305
2308
|
* per-language arrays (mobile). Prefers `languageId` when present, else the
|
|
@@ -2307,6 +2310,203 @@ declare function parseFormRecordPrefill(section: IFormRecordPrefillSection): IFo
|
|
|
2307
2310
|
*/
|
|
2308
2311
|
declare function flattenFormRecordPrefillValues(values: Record<string, TFormRecordPrefillFieldValue>, languageId?: number | null): Record<string, string>;
|
|
2309
2312
|
|
|
2313
|
+
/**
|
|
2314
|
+
* The URL grammar of a list (`entry-form-list` / `data-view`), shared by the web
|
|
2315
|
+
* frontend and the mobile app so a link, a bookmark and a cache key mean the same
|
|
2316
|
+
* thing on both and on the server.
|
|
2317
|
+
*
|
|
2318
|
+
* <key>.page=2 <key>.q=anna <key>.sort=title:asc,entry_date:desc
|
|
2319
|
+
* <key>.f.<id>=value <key>.record=17 <key>.mode=view|edit|create
|
|
2320
|
+
*
|
|
2321
|
+
* The parser mirrors the backend `FormListUrlStateParser` rule for rule: it is
|
|
2322
|
+
* strict, so a parameter in the list's namespace that is unknown, repeated,
|
|
2323
|
+
* written as an array or malformed is refused instead of silently ignored. The
|
|
2324
|
+
* server is the authority (it knows the list's sortable columns, controls and
|
|
2325
|
+
* operations); pass them as {@link IFormListUrlRules} to refuse early what it
|
|
2326
|
+
* would refuse. Parameters outside the namespace (the page, the language, other
|
|
2327
|
+
* lists, anything unrelated) are never touched and always survive a change of
|
|
2328
|
+
* list state.
|
|
2329
|
+
*
|
|
2330
|
+
* The state names choices only. It never carries a table, a column filter, an
|
|
2331
|
+
* operation or a permission, and no draft form value or credential belongs in a
|
|
2332
|
+
* URL.
|
|
2333
|
+
*/
|
|
2334
|
+
|
|
2335
|
+
declare const FORM_LIST_MODES: readonly TFormListMode[];
|
|
2336
|
+
/** The largest page number a URL may name. */
|
|
2337
|
+
declare const FORM_LIST_MAX_PAGE = 1000000;
|
|
2338
|
+
/** A parameter value is at most this many bytes (UTF-8). */
|
|
2339
|
+
declare const FORM_LIST_MAX_VALUE_BYTES = 1000;
|
|
2340
|
+
declare const FORM_LIST_SEARCH_MIN_LENGTH = 2;
|
|
2341
|
+
declare const FORM_LIST_SEARCH_MAX_LENGTH = 100;
|
|
2342
|
+
declare const FORM_LIST_MAX_SORTS = 3;
|
|
2343
|
+
/** How many route parameters a list state request carries at most (the server refuses more). */
|
|
2344
|
+
declare const FORM_LIST_MAX_ROUTE_PARAMS = 8;
|
|
2345
|
+
/** The longest value of a route parameter the server accepts. */
|
|
2346
|
+
declare const FORM_LIST_MAX_ROUTE_VALUE_LENGTH = 255;
|
|
2347
|
+
/** What a visitor changed in a list, as it travels in the page URL. */
|
|
2348
|
+
interface IFormListUrlState {
|
|
2349
|
+
/** 1-based. A page past the end is served as the last page. */
|
|
2350
|
+
page: number;
|
|
2351
|
+
/** The visitor's search text, trimmed; null = no search. */
|
|
2352
|
+
q: string | null;
|
|
2353
|
+
/** The visitor's sort keys; empty = the list's own default order. */
|
|
2354
|
+
sort: IFormListSort[];
|
|
2355
|
+
/** Control id to the control's raw value (a control without a value is absent). */
|
|
2356
|
+
filters: Record<string, string>;
|
|
2357
|
+
/** The record that is open. */
|
|
2358
|
+
record: number | null;
|
|
2359
|
+
/** `view`, `edit` or `create`; null = the list only. */
|
|
2360
|
+
mode: TFormListMode | null;
|
|
2361
|
+
}
|
|
2362
|
+
/**
|
|
2363
|
+
* What the list offers, to refuse early what the server would refuse. Every
|
|
2364
|
+
* rule is optional: without it only the grammar is checked.
|
|
2365
|
+
*/
|
|
2366
|
+
interface IFormListUrlRules {
|
|
2367
|
+
/** Fields the list can be sorted by (columns marked sortable, `entry_date`). */
|
|
2368
|
+
sortable?: readonly string[];
|
|
2369
|
+
/** Ids of the list's controls. */
|
|
2370
|
+
controls?: readonly string[];
|
|
2371
|
+
/** Default true. False on a list that does not allow new entries (and for a guest on an own-entries list). */
|
|
2372
|
+
allowCreate?: boolean;
|
|
2373
|
+
/** Default true. False on a list that does not allow editing, and on a data view. */
|
|
2374
|
+
allowUpdate?: boolean;
|
|
2375
|
+
/** Default true. False when `show_history` is off (or on a data view). */
|
|
2376
|
+
showHistory?: boolean;
|
|
2377
|
+
}
|
|
2378
|
+
type TFormListUrlErrorReason = 'invalid_list_parameter' | 'unknown_list_parameter' | 'duplicate_list_parameter' | 'operation_disabled' | 'history_disabled';
|
|
2379
|
+
/** Why a URL cannot be a list state. `parameter` names the parameter a client may drop and retry. */
|
|
2380
|
+
interface IFormListUrlError {
|
|
2381
|
+
/** 400 for a malformed or unknown parameter, 403 for a mode the list does not offer. */
|
|
2382
|
+
status: 400 | 403;
|
|
2383
|
+
reason: TFormListUrlErrorReason;
|
|
2384
|
+
parameter: string;
|
|
2385
|
+
message: string;
|
|
2386
|
+
}
|
|
2387
|
+
type TFormListUrlParse = {
|
|
2388
|
+
ok: true;
|
|
2389
|
+
state: IFormListUrlState;
|
|
2390
|
+
} | {
|
|
2391
|
+
ok: false;
|
|
2392
|
+
error: IFormListUrlError;
|
|
2393
|
+
};
|
|
2394
|
+
/** A change of the list state a visitor can make; see {@link applyFormListUrlChange}. */
|
|
2395
|
+
type TFormListUrlChange = {
|
|
2396
|
+
type: 'page';
|
|
2397
|
+
page: number;
|
|
2398
|
+
} | {
|
|
2399
|
+
type: 'search';
|
|
2400
|
+
q: string | null;
|
|
2401
|
+
} | {
|
|
2402
|
+
type: 'sort';
|
|
2403
|
+
sort: readonly IFormListSort[];
|
|
2404
|
+
} | {
|
|
2405
|
+
type: 'filter';
|
|
2406
|
+
id: string;
|
|
2407
|
+
value: string | null;
|
|
2408
|
+
} | {
|
|
2409
|
+
type: 'reset';
|
|
2410
|
+
} | {
|
|
2411
|
+
type: 'open';
|
|
2412
|
+
record: number;
|
|
2413
|
+
mode?: 'view' | 'edit' | 'history';
|
|
2414
|
+
} | {
|
|
2415
|
+
type: 'create';
|
|
2416
|
+
} | {
|
|
2417
|
+
type: 'close';
|
|
2418
|
+
};
|
|
2419
|
+
declare function emptyFormListUrlState(): IFormListUrlState;
|
|
2420
|
+
/** True when `name` is a parameter of the list called `key` (`<key>.` namespace). */
|
|
2421
|
+
declare function isFormListParam(name: string, key: string): boolean;
|
|
2422
|
+
/**
|
|
2423
|
+
* Parse the raw query string of a page URL into the state of the list `key`.
|
|
2424
|
+
*
|
|
2425
|
+
* The raw string is read, not a decoded parameter array: PHP (and many routers)
|
|
2426
|
+
* rewrite the dot of `news.q` to `news_q`, which would destroy the namespace.
|
|
2427
|
+
*/
|
|
2428
|
+
declare function parseFormListQuery(query: string | URLSearchParams, key: string, rules?: IFormListUrlRules): TFormListUrlParse;
|
|
2429
|
+
/**
|
|
2430
|
+
* The state as URL parameters, in the order the server echoes them (`page` only
|
|
2431
|
+
* above 1, then `q`, `sort`, the filters, `record`, `mode`). Empty state, no
|
|
2432
|
+
* parameters.
|
|
2433
|
+
*/
|
|
2434
|
+
declare function encodeFormListQuery(key: string, state: IFormListUrlState): Record<string, string>;
|
|
2435
|
+
/**
|
|
2436
|
+
* The query string (no leading `?`) of a link that shows `state` of the list
|
|
2437
|
+
* `key` on the page whose current query string is `base`.
|
|
2438
|
+
*
|
|
2439
|
+
* Every parameter outside the list's namespace is kept exactly as it was, in
|
|
2440
|
+
* its place; the list's own parameters are replaced by the encoding of `state`
|
|
2441
|
+
* and appended last. Opening a record, paging or searching never drops the
|
|
2442
|
+
* language, a preview flag, another list's state or a campaign parameter.
|
|
2443
|
+
*/
|
|
2444
|
+
declare function formListQueryString(base: string | URLSearchParams, key: string, state: IFormListUrlState): string;
|
|
2445
|
+
/**
|
|
2446
|
+
* The next state after a visitor's change. Pure; the URL is then rebuilt with
|
|
2447
|
+
* {@link formListQueryString}.
|
|
2448
|
+
*
|
|
2449
|
+
* Narrowing the list (search, sort, filter, reset) goes back to page 1, because
|
|
2450
|
+
* the old page number may no longer exist. The open record is left alone: the
|
|
2451
|
+
* server reads it inside the list's dataset and never inside the visitor's
|
|
2452
|
+
* filters, so a link to a record keeps working after the visitor narrows the
|
|
2453
|
+
* list. Open, create and close change the record and mode and keep the rest.
|
|
2454
|
+
*/
|
|
2455
|
+
declare function applyFormListUrlChange(state: IFormListUrlState, change: TFormListUrlChange): IFormListUrlState;
|
|
2456
|
+
/**
|
|
2457
|
+
* The sort a click on a column header asks for: none -> ascending -> descending
|
|
2458
|
+
* -> none, one key at a time. A click on another column starts that column
|
|
2459
|
+
* ascending and drops the others.
|
|
2460
|
+
*/
|
|
2461
|
+
declare function nextSortOnHeaderClick(current: readonly IFormListSort[], field: string): IFormListSort[];
|
|
2462
|
+
/**
|
|
2463
|
+
* The raw `name=value` pairs of a page URL that can belong to a list: those whose
|
|
2464
|
+
* name starts with a list key and a dot. Forward exactly these, unchanged, to
|
|
2465
|
+
* `GET /pages/by-keyword/{keyword}` and `GET /pages/resolve` so the server can
|
|
2466
|
+
* render the lists of the page. The client does not know the page's list keys
|
|
2467
|
+
* before it asks, and the server only reads the namespaces of lists that exist.
|
|
2468
|
+
*/
|
|
2469
|
+
declare function pickFormListQuery(query: string | URLSearchParams): string;
|
|
2470
|
+
/**
|
|
2471
|
+
* The route parameters of a page as the list state request names them: `route[record_id]=3`.
|
|
2472
|
+
*
|
|
2473
|
+
* A page with a route (`/team/{record_id}`) draws the layout of a record with `{{route.record_id}}`, so the
|
|
2474
|
+
* state of a list depends on the route as well as on the page. The client repeats the declared parameters
|
|
2475
|
+
* of the page it shows (`page.route_params`); the server does not believe them, it checks them against the
|
|
2476
|
+
* routes of that page. Names and values are percent-encoded, sorted by name, and a parameter that cannot be a
|
|
2477
|
+
* route parameter (a name that is not a placeholder name, an empty value, a value that is too long, or one
|
|
2478
|
+
* beyond {@link FORM_LIST_MAX_ROUTE_PARAMS}) is left out. Returns `''` for a page without route parameters.
|
|
2479
|
+
*/
|
|
2480
|
+
declare function formListRouteQuery(route: Readonly<Record<string, string | undefined>> | null | undefined): string;
|
|
2481
|
+
/** What a list's cached state depends on. Log out and a server switch clear every list cache. */
|
|
2482
|
+
interface IFormListCacheScope {
|
|
2483
|
+
/** The API base URL of the server the account belongs to. */
|
|
2484
|
+
apiBase: string;
|
|
2485
|
+
/** The signed-in account's id; null for a guest. */
|
|
2486
|
+
account: string | number | null;
|
|
2487
|
+
languageId: number;
|
|
2488
|
+
platform: 'web' | 'mobile';
|
|
2489
|
+
pageId: number;
|
|
2490
|
+
sectionId: number;
|
|
2491
|
+
/** The list's key in the URL. */
|
|
2492
|
+
key: string;
|
|
2493
|
+
/**
|
|
2494
|
+
* The declared route parameters of the page (`page.route_params`). The layout of a record can read them, so
|
|
2495
|
+
* the same page and section with another route is another list state.
|
|
2496
|
+
*/
|
|
2497
|
+
route?: Readonly<Record<string, string | undefined>> | null;
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* A stable client cache key for one list in one state: API base, account (or
|
|
2501
|
+
* guest), language, platform, page, section, the declared route of the page and
|
|
2502
|
+
* the normalized `<key>.*` parameters (sorted, decoded, so two spellings of
|
|
2503
|
+
* one state share an entry). The last part is always the list's own state; every
|
|
2504
|
+
* part before it identifies the list itself.
|
|
2505
|
+
* Never reuse a key across accounts: the same URL shows different records to
|
|
2506
|
+
* different people.
|
|
2507
|
+
*/
|
|
2508
|
+
declare function formListCacheKey(scope: IFormListCacheScope, query: string | URLSearchParams): readonly (string | number)[];
|
|
2509
|
+
|
|
2310
2510
|
/**
|
|
2311
2511
|
* Global web header presentation presets (menu-builder `web_header` menu).
|
|
2312
2512
|
*/
|
|
@@ -2838,4 +3038,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
2838
3038
|
*/
|
|
2839
3039
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
2840
3040
|
|
|
2841
|
-
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,
|
|
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 };
|