@selfhelp/shared 1.29.0 → 1.31.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/index.d.mts +35 -85
  3. package/dist/index.d.ts +35 -85
  4. package/dist/index.js +18 -5
  5. package/dist/index.mjs +15 -5
  6. package/dist/inlineFormat-Duu5VLMU.d.mts +73 -0
  7. package/dist/inlineFormat-Duu5VLMU.d.ts +73 -0
  8. package/dist/{manifest-BNnCN1Qo.d.mts → manifest-DWHD0PQA.d.mts} +168 -1
  9. package/dist/{manifest-BNnCN1Qo.d.ts → manifest-DWHD0PQA.d.ts} +168 -1
  10. package/dist/plugin-sdk/index.d.mts +260 -7
  11. package/dist/plugin-sdk/index.d.ts +260 -7
  12. package/dist/plugin-sdk/index.js +174 -2
  13. package/dist/plugin-sdk/index.mjs +171 -2
  14. package/dist/plugin-sdk/sync-map.d.mts +22 -0
  15. package/dist/plugin-sdk/sync-map.d.ts +22 -0
  16. package/dist/plugin-sdk/sync-map.js +58 -0
  17. package/dist/plugin-sdk/sync-map.mjs +33 -0
  18. package/dist/registry/index.d.mts +2 -2
  19. package/dist/registry/index.d.ts +2 -2
  20. package/dist/{styles.registry-DnIJqEzM.d.mts → styles.registry-B2cyNdo3.d.mts} +26 -1
  21. package/dist/{styles.registry-C2ACy7H0.d.ts → styles.registry-G_KUYGPv.d.ts} +26 -1
  22. package/dist/testing/index.d.mts +1 -1
  23. package/dist/testing/index.d.ts +1 -1
  24. package/package.json +3 -3
  25. package/src/content/__tests__/languageIndependent.test.ts +26 -0
  26. package/src/content/__tests__/languageIndependentLiteral.test.ts +62 -0
  27. package/src/content/formRecordPrefill.ts +9 -7
  28. package/src/content/index.ts +1 -0
  29. package/src/content/languageIndependent.ts +28 -0
  30. package/src/plugin-sdk/__tests__/define-sync.test.ts +106 -0
  31. package/src/plugin-sdk/__tests__/exports.test.ts +29 -0
  32. package/src/plugin-sdk/__tests__/host-services.test.ts +96 -6
  33. package/src/plugin-sdk/__tests__/sync-map.test.ts +48 -0
  34. package/src/plugin-sdk/__tests__/version.test.ts +9 -0
  35. package/src/plugin-sdk/host-services.ts +106 -0
  36. package/src/plugin-sdk/index.ts +31 -0
  37. package/src/plugin-sdk/manifest.ts +193 -0
  38. package/src/plugin-sdk/sync-map.ts +61 -0
  39. package/src/plugin-sdk/types.ts +142 -2
  40. package/src/plugin-sdk/version.ts +19 -2
  41. package/src/sync/__tests__/sync.test.ts +19 -0
  42. package/src/sync/sync.ts +3 -2
  43. package/src/sync/types.ts +9 -6
  44. package/src/types/api/form-lists.ts +16 -1
  45. package/src/types/api/forms.ts +10 -0
package/dist/index.js CHANGED
@@ -65,6 +65,8 @@ __export(index_exports, {
65
65
  HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
66
66
  HEADER_PAGE_VERSION: () => HEADER_PAGE_VERSION,
67
67
  HEADER_PAGE_VIEW: () => HEADER_PAGE_VIEW,
68
+ LANGUAGE_INDEPENDENT_ID: () => LANGUAGE_INDEPENDENT_ID,
69
+ LANGUAGE_INDEPENDENT_LOCALE: () => LANGUAGE_INDEPENDENT_LOCALE,
68
70
  LINE_HEIGHT: () => LINE_HEIGHT,
69
71
  LITERAL_CLASSES: () => LITERAL_CLASSES,
70
72
  LOCK_IDLE_ENDED_ERROR: () => LOCK_IDLE_ENDED_ERROR,
@@ -158,6 +160,7 @@ __export(index_exports, {
158
160
  isDoubleWebHeaderPreset: () => isDoubleWebHeaderPreset,
159
161
  isFormListParam: () => isFormListParam,
160
162
  isKnownStyleName: () => isKnownStyleName,
163
+ isLanguageIndependent: () => isLanguageIndependent,
161
164
  isMenuItemActiveOnMobile: () => isMenuItemActiveOnMobile,
162
165
  isMenuItemActiveOnWeb: () => isMenuItemActiveOnWeb,
163
166
  isMobileIconName: () => isMobileIconName,
@@ -2039,6 +2042,13 @@ function serializeFieldsMapLabels(labels) {
2039
2042
  return JSON.stringify(clean);
2040
2043
  }
2041
2044
 
2045
+ // src/content/languageIndependent.ts
2046
+ var LANGUAGE_INDEPENDENT_ID = 1;
2047
+ var LANGUAGE_INDEPENDENT_LOCALE = "all";
2048
+ function isLanguageIndependent(languageId) {
2049
+ return languageId === LANGUAGE_INDEPENDENT_ID;
2050
+ }
2051
+
2042
2052
  // src/content/formRecordPrefill.ts
2043
2053
  var FORM_RECORD_PREFILL_SKIP_FIELDS = /* @__PURE__ */ new Set([
2044
2054
  "record_id",
@@ -2133,7 +2143,7 @@ function parseFormRecordPrefill(section) {
2133
2143
  }
2134
2144
  const filesCell = asFilesCell(fieldValue);
2135
2145
  if (filesCell !== null) {
2136
- if (languageId === 1 || !recordGroups[recordId][fieldName]) {
2146
+ if (isLanguageIndependent(languageId) || !recordGroups[recordId][fieldName]) {
2137
2147
  recordGroups[recordId][fieldName] = filesCell;
2138
2148
  }
2139
2149
  continue;
@@ -2144,7 +2154,7 @@ function parseFormRecordPrefill(section) {
2144
2154
  }
2145
2155
  const translatable = isTranslatableChild(section.children, fieldName);
2146
2156
  if (translatable) {
2147
- if (languageId === 1) {
2157
+ if (isLanguageIndependent(languageId)) {
2148
2158
  if (!recordGroups[recordId][fieldName]) {
2149
2159
  recordGroups[recordId][fieldName] = value;
2150
2160
  }
@@ -2165,7 +2175,7 @@ function parseFormRecordPrefill(section) {
2165
2175
  }
2166
2176
  }
2167
2177
  }
2168
- } else if (languageId === 1 || !recordGroups[recordId][fieldName]) {
2178
+ } else if (isLanguageIndependent(languageId) || !recordGroups[recordId][fieldName]) {
2169
2179
  recordGroups[recordId][fieldName] = value;
2170
2180
  }
2171
2181
  }
@@ -2202,7 +2212,7 @@ function flattenFormRecordPrefillValues(values, languageId) {
2202
2212
  continue;
2203
2213
  }
2204
2214
  }
2205
- const nonIndependent = value.find((entry) => entry.language_id !== 1);
2215
+ const nonIndependent = value.find((entry) => !isLanguageIndependent(entry.language_id));
2206
2216
  out[key] = (nonIndependent ?? value[0]).value;
2207
2217
  }
2208
2218
  return out;
@@ -3288,7 +3298,7 @@ function expandedIdsForActiveTrail(items, pathname, platform) {
3288
3298
  // src/sync/types.ts
3289
3299
  var SYNC_EVENT_NAME = "changed";
3290
3300
  var SYNC_MESSAGE_VERSION = 1;
3291
- var SYNC_TAG_PATTERN = /^(acl|navigation|global_values|page:\d+|page_draft:\d+|page_lock:\d+|table:\d+|section:\d+|asset:\d+)$/;
3301
+ var SYNC_TAG_PATTERN = /^(acl|navigation|global_values|page:\d+|page_draft:\d+|page_lock:\d+|table:\d+|section:\d+|asset:\d+|res:[a-z][a-z0-9_]{1,63}:\d+)$/;
3292
3302
  var PAGE_VERSION_REQUIRED_ERROR = "page_version_required";
3293
3303
  var STALE_PAGE_VERSION_ERROR = "stale_page_version";
3294
3304
  var PAGE_LOCKED_ERROR = "page_locked";
@@ -3443,6 +3453,8 @@ function transformPagesData(pages) {
3443
3453
  HEADER_CLIENT_TYPE,
3444
3454
  HEADER_PAGE_VERSION,
3445
3455
  HEADER_PAGE_VIEW,
3456
+ LANGUAGE_INDEPENDENT_ID,
3457
+ LANGUAGE_INDEPENDENT_LOCALE,
3446
3458
  LINE_HEIGHT,
3447
3459
  LITERAL_CLASSES,
3448
3460
  LOCK_IDLE_ENDED_ERROR,
@@ -3536,6 +3548,7 @@ function transformPagesData(pages) {
3536
3548
  isDoubleWebHeaderPreset,
3537
3549
  isFormListParam,
3538
3550
  isKnownStyleName,
3551
+ isLanguageIndependent,
3539
3552
  isMenuItemActiveOnMobile,
3540
3553
  isMenuItemActiveOnWeb,
3541
3554
  isMobileIconName,
package/dist/index.mjs CHANGED
@@ -1778,6 +1778,13 @@ function serializeFieldsMapLabels(labels) {
1778
1778
  return JSON.stringify(clean);
1779
1779
  }
1780
1780
 
1781
+ // src/content/languageIndependent.ts
1782
+ var LANGUAGE_INDEPENDENT_ID = 1;
1783
+ var LANGUAGE_INDEPENDENT_LOCALE = "all";
1784
+ function isLanguageIndependent(languageId) {
1785
+ return languageId === LANGUAGE_INDEPENDENT_ID;
1786
+ }
1787
+
1781
1788
  // src/content/formRecordPrefill.ts
1782
1789
  var FORM_RECORD_PREFILL_SKIP_FIELDS = /* @__PURE__ */ new Set([
1783
1790
  "record_id",
@@ -1872,7 +1879,7 @@ function parseFormRecordPrefill(section) {
1872
1879
  }
1873
1880
  const filesCell = asFilesCell(fieldValue);
1874
1881
  if (filesCell !== null) {
1875
- if (languageId === 1 || !recordGroups[recordId][fieldName]) {
1882
+ if (isLanguageIndependent(languageId) || !recordGroups[recordId][fieldName]) {
1876
1883
  recordGroups[recordId][fieldName] = filesCell;
1877
1884
  }
1878
1885
  continue;
@@ -1883,7 +1890,7 @@ function parseFormRecordPrefill(section) {
1883
1890
  }
1884
1891
  const translatable = isTranslatableChild(section.children, fieldName);
1885
1892
  if (translatable) {
1886
- if (languageId === 1) {
1893
+ if (isLanguageIndependent(languageId)) {
1887
1894
  if (!recordGroups[recordId][fieldName]) {
1888
1895
  recordGroups[recordId][fieldName] = value;
1889
1896
  }
@@ -1904,7 +1911,7 @@ function parseFormRecordPrefill(section) {
1904
1911
  }
1905
1912
  }
1906
1913
  }
1907
- } else if (languageId === 1 || !recordGroups[recordId][fieldName]) {
1914
+ } else if (isLanguageIndependent(languageId) || !recordGroups[recordId][fieldName]) {
1908
1915
  recordGroups[recordId][fieldName] = value;
1909
1916
  }
1910
1917
  }
@@ -1941,7 +1948,7 @@ function flattenFormRecordPrefillValues(values, languageId) {
1941
1948
  continue;
1942
1949
  }
1943
1950
  }
1944
- const nonIndependent = value.find((entry) => entry.language_id !== 1);
1951
+ const nonIndependent = value.find((entry) => !isLanguageIndependent(entry.language_id));
1945
1952
  out[key] = (nonIndependent ?? value[0]).value;
1946
1953
  }
1947
1954
  return out;
@@ -3027,7 +3034,7 @@ function expandedIdsForActiveTrail(items, pathname, platform) {
3027
3034
  // src/sync/types.ts
3028
3035
  var SYNC_EVENT_NAME = "changed";
3029
3036
  var SYNC_MESSAGE_VERSION = 1;
3030
- var SYNC_TAG_PATTERN = /^(acl|navigation|global_values|page:\d+|page_draft:\d+|page_lock:\d+|table:\d+|section:\d+|asset:\d+)$/;
3037
+ var SYNC_TAG_PATTERN = /^(acl|navigation|global_values|page:\d+|page_draft:\d+|page_lock:\d+|table:\d+|section:\d+|asset:\d+|res:[a-z][a-z0-9_]{1,63}:\d+)$/;
3031
3038
  var PAGE_VERSION_REQUIRED_ERROR = "page_version_required";
3032
3039
  var STALE_PAGE_VERSION_ERROR = "stale_page_version";
3033
3040
  var PAGE_LOCKED_ERROR = "page_locked";
@@ -3181,6 +3188,8 @@ export {
3181
3188
  HEADER_CLIENT_TYPE,
3182
3189
  HEADER_PAGE_VERSION,
3183
3190
  HEADER_PAGE_VIEW,
3191
+ LANGUAGE_INDEPENDENT_ID,
3192
+ LANGUAGE_INDEPENDENT_LOCALE,
3184
3193
  LINE_HEIGHT,
3185
3194
  LITERAL_CLASSES,
3186
3195
  LOCK_IDLE_ENDED_ERROR,
@@ -3274,6 +3283,7 @@ export {
3274
3283
  isDoubleWebHeaderPreset,
3275
3284
  isFormListParam,
3276
3285
  isKnownStyleName,
3286
+ isLanguageIndependent,
3277
3287
  isMenuItemActiveOnMobile,
3278
3288
  isMenuItemActiveOnWeb,
3279
3289
  isMobileIconName,
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Cross-platform inline-formatting helpers for CMS content fields.
3
+ *
4
+ * ## Why
5
+ *
6
+ * CMS authors can apply lightweight inline formatting (Ctrl+B bold, Ctrl+I
7
+ * italic, Ctrl+U underline, links) to content fields whose field type allows it
8
+ * (`markdown-inline`). The editor stores that as a tiny HTML subset
9
+ * (`<strong>`/`<b>`, `<em>`/`<i>`, `<u>`, `<a>`), often wrapped in block tags
10
+ * (`<p>`, `<div>`) that markdown processing leaves behind.
11
+ *
12
+ * Web can render that subset as real inline HTML, but React Native `<Text>`
13
+ * cannot render HTML at all — so historically mobile (and several web leaf slots)
14
+ * stripped everything to plain text and the bold was lost. To carry the same
15
+ * formatting to BOTH platforms we parse the subset once, here, into a flat list
16
+ * of {@link IInlineNode} runs. Each platform then renders the runs natively:
17
+ *
18
+ * - web → a fragment of `<strong>/<em>/<u>/<a>` (see frontend `InlineRich`)
19
+ * - mobile → nested `<Text>` with `fontWeight`/`fontStyle`/`textDecorationLine`
20
+ * (see mobile `InlineText`)
21
+ *
22
+ * ## Scope (deliberately tiny + safe)
23
+ *
24
+ * Only the inline subset above survives. **Block** tags (`<p>`, `<div>`,
25
+ * `<h1>`…`<h6>`, `<ul>`/`<ol>`/`<li>`, `<blockquote>`, `<br>`) collapse to a
26
+ * single space — an inline text slot (a label, a paragraph run) cannot lay out
27
+ * block structure, and flattening matches the old strip behaviour. Any other tag
28
+ * is dropped while keeping its inner text. HTML entities are decoded.
29
+ *
30
+ * ## JSON-aware (HARD)
31
+ *
32
+ * Some content fields legitimately hold JSON (config blobs, table/segmented
33
+ * data). Those are read via `readField`, not these helpers, but as a safety net
34
+ * a value that parses as JSON is returned untouched so structured payloads are
35
+ * never mangled.
36
+ *
37
+ * This module is the canonical home the style docs refer to; the web
38
+ * `stripHtmlTags` and mobile `stripHtmlToText` local copies mirror
39
+ * {@link stripHtmlToText} and are folded into this once consumers adopt it.
40
+ */
41
+ /** A single run of text with the inline formatting that applies to it. */
42
+ interface IInlineNode {
43
+ text: string;
44
+ bold?: boolean;
45
+ italic?: boolean;
46
+ underline?: boolean;
47
+ /** Present when the run sits inside an `<a href>`; the resolved target. */
48
+ href?: string;
49
+ }
50
+ /**
51
+ * Parse a CMS content string into a flat list of inline-formatted runs,
52
+ * preserving only the safe inline subset. Block tags + `<br>` collapse to
53
+ * spaces; entities are decoded; a JSON payload is returned as one untouched run.
54
+ * Adjacent runs that share formatting are merged and outer whitespace trimmed.
55
+ */
56
+ declare function parseInlineRich(value: string | null | undefined): IInlineNode[];
57
+ /**
58
+ * Does this value carry any of the supported inline tags? Used by renderers to
59
+ * fast-path plain strings (and to skip JSON). Cheap: no full parse.
60
+ */
61
+ declare function hasInlineFormatting(value: string | null | undefined): boolean;
62
+ /**
63
+ * Strip a content string to readable plain text: drop every tag, decode common
64
+ * entities, collapse whitespace. Block tags + `<br>` become spaces so words do
65
+ * not run together. JSON payloads and tag-free strings are returned untouched
66
+ * (apart from entity decoding), so it is safe to call on any field.
67
+ *
68
+ * This is the canonical cross-platform helper (web `stripHtmlTags` / mobile
69
+ * `stripHtmlToText` mirror it).
70
+ */
71
+ declare function stripHtmlToText(value: string | null | undefined): string;
72
+
73
+ export { type IInlineNode as I, hasInlineFormatting as h, parseInlineRich as p, stripHtmlToText as s };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Cross-platform inline-formatting helpers for CMS content fields.
3
+ *
4
+ * ## Why
5
+ *
6
+ * CMS authors can apply lightweight inline formatting (Ctrl+B bold, Ctrl+I
7
+ * italic, Ctrl+U underline, links) to content fields whose field type allows it
8
+ * (`markdown-inline`). The editor stores that as a tiny HTML subset
9
+ * (`<strong>`/`<b>`, `<em>`/`<i>`, `<u>`, `<a>`), often wrapped in block tags
10
+ * (`<p>`, `<div>`) that markdown processing leaves behind.
11
+ *
12
+ * Web can render that subset as real inline HTML, but React Native `<Text>`
13
+ * cannot render HTML at all — so historically mobile (and several web leaf slots)
14
+ * stripped everything to plain text and the bold was lost. To carry the same
15
+ * formatting to BOTH platforms we parse the subset once, here, into a flat list
16
+ * of {@link IInlineNode} runs. Each platform then renders the runs natively:
17
+ *
18
+ * - web → a fragment of `<strong>/<em>/<u>/<a>` (see frontend `InlineRich`)
19
+ * - mobile → nested `<Text>` with `fontWeight`/`fontStyle`/`textDecorationLine`
20
+ * (see mobile `InlineText`)
21
+ *
22
+ * ## Scope (deliberately tiny + safe)
23
+ *
24
+ * Only the inline subset above survives. **Block** tags (`<p>`, `<div>`,
25
+ * `<h1>`…`<h6>`, `<ul>`/`<ol>`/`<li>`, `<blockquote>`, `<br>`) collapse to a
26
+ * single space — an inline text slot (a label, a paragraph run) cannot lay out
27
+ * block structure, and flattening matches the old strip behaviour. Any other tag
28
+ * is dropped while keeping its inner text. HTML entities are decoded.
29
+ *
30
+ * ## JSON-aware (HARD)
31
+ *
32
+ * Some content fields legitimately hold JSON (config blobs, table/segmented
33
+ * data). Those are read via `readField`, not these helpers, but as a safety net
34
+ * a value that parses as JSON is returned untouched so structured payloads are
35
+ * never mangled.
36
+ *
37
+ * This module is the canonical home the style docs refer to; the web
38
+ * `stripHtmlTags` and mobile `stripHtmlToText` local copies mirror
39
+ * {@link stripHtmlToText} and are folded into this once consumers adopt it.
40
+ */
41
+ /** A single run of text with the inline formatting that applies to it. */
42
+ interface IInlineNode {
43
+ text: string;
44
+ bold?: boolean;
45
+ italic?: boolean;
46
+ underline?: boolean;
47
+ /** Present when the run sits inside an `<a href>`; the resolved target. */
48
+ href?: string;
49
+ }
50
+ /**
51
+ * Parse a CMS content string into a flat list of inline-formatted runs,
52
+ * preserving only the safe inline subset. Block tags + `<br>` collapse to
53
+ * spaces; entities are decoded; a JSON payload is returned as one untouched run.
54
+ * Adjacent runs that share formatting are merged and outer whitespace trimmed.
55
+ */
56
+ declare function parseInlineRich(value: string | null | undefined): IInlineNode[];
57
+ /**
58
+ * Does this value carry any of the supported inline tags? Used by renderers to
59
+ * fast-path plain strings (and to skip JSON). Cheap: no full parse.
60
+ */
61
+ declare function hasInlineFormatting(value: string | null | undefined): boolean;
62
+ /**
63
+ * Strip a content string to readable plain text: drop every tag, decode common
64
+ * entities, collapse whitespace. Block tags + `<br>` become spaces so words do
65
+ * not run together. JSON payloads and tag-free strings are returned untouched
66
+ * (apart from entity decoding), so it is safe to call on any field.
67
+ *
68
+ * This is the canonical cross-platform helper (web `stripHtmlTags` / mobile
69
+ * `stripHtmlToText` mirror it).
70
+ */
71
+ declare function stripHtmlToText(value: string | null | undefined): string;
72
+
73
+ export { type IInlineNode as I, hasInlineFormatting as h, parseInlineRich as p, stripHtmlToText as s };
@@ -127,6 +127,16 @@ interface IPluginManifestPermission {
127
127
  /** Optional default role keys the permission is granted to. */
128
128
  defaultRoles?: string[];
129
129
  }
130
+ /** A field linked to a plugin style, with its editor metadata. */
131
+ interface IPluginManifestStyleField {
132
+ /** A field of the plugin (`fields`) or a core field such as `own_entries_only`. */
133
+ name: string;
134
+ title?: string;
135
+ help?: string;
136
+ default?: string | null;
137
+ hidden?: boolean;
138
+ disabled?: boolean;
139
+ }
130
140
  interface IPluginManifestStyle {
131
141
  /** Style name (used as `style_name` discriminator). */
132
142
  name: string;
@@ -134,6 +144,40 @@ interface IPluginManifestStyle {
134
144
  canHaveChildren: boolean;
135
145
  /** Optional capability requirement (e.g. `frontendStyles`). */
136
146
  capability?: IPluginManifestCapability;
147
+ /** Style group name; required when the installer creates the style. */
148
+ group?: string;
149
+ /** Earlier names of this style; the installer renames the row in place. */
150
+ renamedFrom?: string[];
151
+ /** When present, the installer makes the style's field links match this list. */
152
+ fields?: IPluginManifestStyleField[];
153
+ /**
154
+ * Field name → registered resource type of this plugin (`resourceTypes`
155
+ * lookup). The field must be declared for the style. Needs `pluginApiVersion`
156
+ * >= 0.2.0.
157
+ */
158
+ resourceFields?: Record<string, string>;
159
+ }
160
+ /** Style group written into `style_groups` by the host installer (rule 7.8). */
161
+ interface IPluginManifestStyleGroup {
162
+ name: string;
163
+ description?: string;
164
+ position?: number;
165
+ }
166
+ /** Field type (editor control) written into `field_types`; kebab-case name. */
167
+ interface IPluginManifestFieldType {
168
+ name: string;
169
+ position?: number;
170
+ }
171
+ /** Plugin-owned field written into `fields`; snake_case name. */
172
+ interface IPluginManifestField {
173
+ name: string;
174
+ /** A core field type or one declared under `fieldTypes`. */
175
+ type: string;
176
+ /** True for participant-facing content stored per language. */
177
+ translatable?: boolean;
178
+ config?: Record<string, unknown> | null;
179
+ /** Earlier names of this field; the installer renames the row in place. */
180
+ renamedFrom?: string[];
137
181
  }
138
182
  interface IPluginManifestAdminPage {
139
183
  /** Slug under `/admin/plugins-host/{pluginId}/`. */
@@ -161,12 +205,99 @@ interface IPluginManifestApiRoute {
161
205
  */
162
206
  public?: boolean;
163
207
  }
208
+ /**
209
+ * Inline JSON Schema for an action-plannable plugin job config. Allowed property
210
+ * types are `string`, `integer`, `number` and `boolean`; nesting is not allowed.
211
+ * `format: "variable-text"` marks a string that accepts `{{variables}}`.
212
+ */
213
+ interface IPluginManifestJobConfigSchema {
214
+ type: 'object';
215
+ properties?: Record<string, IPluginManifestJobConfigProperty>;
216
+ required?: string[];
217
+ additionalProperties?: boolean;
218
+ }
219
+ interface IPluginManifestJobConfigProperty {
220
+ type: 'string' | 'integer' | 'number' | 'boolean';
221
+ enum?: Array<string | number | boolean>;
222
+ minimum?: number;
223
+ maximum?: number;
224
+ maxLength?: number;
225
+ title?: string;
226
+ description?: string;
227
+ default?: string | number | boolean;
228
+ /** Marks a string that accepts `{{variables}}` when the action plans the job. */
229
+ format?: 'variable-text';
230
+ }
164
231
  interface IPluginManifestScheduledJob {
165
232
  /** Job type key. */
166
233
  type: string;
167
234
  description: string;
168
235
  /** Capability gate (always requires `scheduledJobs`). */
169
236
  capability: 'scheduledJobs';
237
+ /** Required when `actionPlannable` is true. Shown in the action builder. */
238
+ label?: string;
239
+ /** When true, editors may plan this job type in an action. Default false. */
240
+ actionPlannable?: boolean;
241
+ /** Inline JSON Schema for `plugin_config` when the job is planned from an action. */
242
+ configSchema?: IPluginManifestJobConfigSchema;
243
+ /** Config property → registered resource type of this plugin. */
244
+ resourceFields?: Record<string, string>;
245
+ /** Child-process timeout in seconds (10 to 900). Default 120. */
246
+ timeoutSeconds?: number;
247
+ }
248
+ /** Cache category declared by a plugin; stored as `<plugin id>.<name>`. */
249
+ interface IPluginManifestCacheCategory {
250
+ /** `^[a-z][a-z0-9_]{0,40}$`. */
251
+ name: string;
252
+ /** Lifetime in seconds (60 to 86400). */
253
+ ttlSeconds: number;
254
+ description?: string;
255
+ }
256
+ /** Instance setting declared by a plugin; stored by the host (C14). */
257
+ interface IPluginManifestSetting {
258
+ /** `^[a-z][a-z0-9_]{0,63}$`. */
259
+ key: string;
260
+ label: string;
261
+ type: 'string' | 'number' | 'boolean' | 'url';
262
+ /** Default false. Secrets are encrypted at rest and never returned clear. */
263
+ secret?: boolean;
264
+ /** Default false. */
265
+ required?: boolean;
266
+ /** Not allowed when `secret` is true. */
267
+ default?: string | number | boolean;
268
+ /** `^[A-Z][A-Z0-9_]{2,63}$`, unique across enabled plugins. */
269
+ envOverride?: string;
270
+ }
271
+ /** Rate limit declared by a plugin (C15). */
272
+ interface IPluginManifestRateLimit {
273
+ /** `^[a-z][a-z0-9_]{0,40}$`. */
274
+ name: string;
275
+ policy: 'sliding_window' | 'fixed_window';
276
+ /** 1 to 100000. */
277
+ limit: number;
278
+ /** Symfony rate-limiter interval string (e.g. `1 minute`). */
279
+ interval: string;
280
+ }
281
+ /** JSON Logic operation declared by a plugin (C16). */
282
+ interface IPluginManifestJsonLogicOperation {
283
+ /** `^[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$`; the namespace belongs to one plugin. */
284
+ name: string;
285
+ description: string;
286
+ }
287
+ /**
288
+ * After-commit domain events a plugin may listen to (C24). Must match the host
289
+ * event names exactly.
290
+ */
291
+ type TPluginDomainEventName = 'record.saved' | 'record.deleted' | 'user.created' | 'user.deleted' | 'page.published';
292
+ /** Recurring plugin job (C25). `type` must be one of the plugin's `scheduledJobs`. */
293
+ interface IPluginManifestRecurringJob {
294
+ /** `^[a-z][a-z0-9_]{0,40}$`. */
295
+ name: string;
296
+ /** One of this plugin's `scheduledJobs[].type`. */
297
+ type: string;
298
+ /** Five-field cron, UTC, at least 5 minutes apart. */
299
+ cron: string;
300
+ description: string;
170
301
  }
171
302
  interface IPluginManifestAsset {
172
303
  /** Source path within the plugin package. */
@@ -249,12 +380,48 @@ interface IPluginManifest {
249
380
  };
250
381
  /** Styles contributed to the registry. */
251
382
  styles?: IPluginManifestStyle[];
383
+ /** Style groups the host installer writes (rule 7.8). */
384
+ styleGroups?: IPluginManifestStyleGroup[];
385
+ /** Field types the host installer writes (rule 7.8). */
386
+ fieldTypes?: IPluginManifestFieldType[];
387
+ /** Plugin-owned fields the host installer writes (rule 7.8). */
388
+ fields?: IPluginManifestField[];
252
389
  /** Admin pages mounted under `/admin/plugins-host/{pluginId}/`. */
253
390
  adminPages?: IPluginManifestAdminPage[];
254
391
  /** Plugin-owned API routes. */
255
392
  apiRoutes?: IPluginManifestApiRoute[];
256
393
  /** Scheduled jobs. */
257
394
  scheduledJobs?: IPluginManifestScheduledJob[];
395
+ /**
396
+ * Cache categories the host registers for this plugin (C4). Needs
397
+ * `pluginApiVersion` >= 0.2.0.
398
+ */
399
+ cacheCategories?: IPluginManifestCacheCategory[];
400
+ /**
401
+ * Instance settings and secrets stored by the host (C14). Needs
402
+ * `pluginApiVersion` >= 0.2.0.
403
+ */
404
+ settings?: IPluginManifestSetting[];
405
+ /**
406
+ * Rate limits the host builds for this plugin (C15). Needs
407
+ * `pluginApiVersion` >= 0.2.0.
408
+ */
409
+ rateLimits?: IPluginManifestRateLimit[];
410
+ /**
411
+ * JSON Logic operations the host registers for conditions (C16). Needs
412
+ * `pluginApiVersion` >= 0.2.0.
413
+ */
414
+ jsonLogicOperations?: IPluginManifestJsonLogicOperation[];
415
+ /**
416
+ * After-commit domain events this plugin's listeners receive (C24). Needs
417
+ * `pluginApiVersion` >= 0.2.0.
418
+ */
419
+ listens?: TPluginDomainEventName[];
420
+ /**
421
+ * Recurring jobs the host keeps queued while the plugin is enabled (C25).
422
+ * Needs `pluginApiVersion` >= 0.2.0.
423
+ */
424
+ recurringJobs?: IPluginManifestRecurringJob[];
258
425
  /** Vendored assets. */
259
426
  assets?: IPluginManifestAsset[];
260
427
  /** Health-check declaration. */
@@ -263,4 +430,4 @@ interface IPluginManifest {
263
430
  labels?: Record<string, string>;
264
431
  }
265
432
 
266
- export type { IPluginManifest as I, IPluginManifestAdminPage as a, IPluginManifestApiRoute as b, IPluginManifestAsset as c, IPluginManifestCapability as d, IPluginManifestCompatibility as e, IPluginManifestConflict as f, IPluginManifestDataAccess as g, IPluginManifestDependency as h, IPluginManifestExternalHost as i, IPluginManifestFeatureFlag as j, IPluginManifestHealth as k, IPluginManifestLookupExtension as l, IPluginManifestMobile as m, IPluginManifestPermission as n, IPluginManifestRealtimeTopic as o, IPluginManifestScheduledJob as p, IPluginManifestSecurity as q, IPluginManifestStyle as r, IPluginManifestTrustLevel as s };
433
+ export type { IPluginManifestStyle as A, IPluginManifestStyleField as B, IPluginManifestStyleGroup as C, IPluginManifestTrustLevel as D, IPluginManifest as I, TPluginDomainEventName as T, IPluginManifestAdminPage as a, IPluginManifestApiRoute as b, IPluginManifestAsset as c, IPluginManifestCacheCategory as d, IPluginManifestCapability as e, IPluginManifestCompatibility as f, IPluginManifestConflict as g, IPluginManifestDataAccess as h, IPluginManifestDependency as i, IPluginManifestExternalHost as j, IPluginManifestFeatureFlag as k, IPluginManifestField as l, IPluginManifestFieldType as m, IPluginManifestHealth as n, IPluginManifestJobConfigProperty as o, IPluginManifestJobConfigSchema as p, IPluginManifestJsonLogicOperation as q, IPluginManifestLookupExtension as r, IPluginManifestMobile as s, IPluginManifestPermission as t, IPluginManifestRateLimit as u, IPluginManifestRealtimeTopic as v, IPluginManifestRecurringJob as w, IPluginManifestScheduledJob as x, IPluginManifestSecurity as y, IPluginManifestSetting as z };