@cosmicdrift/kumiko-framework 0.405.0 → 0.409.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 (214) hide show
  1. package/agents/api/framework-db.md +1 -0
  2. package/agents/api/framework-engine.md +18 -2
  3. package/agents/api/framework-ui-types.md +15 -0
  4. package/agents/api/renderer-web.md +156 -2
  5. package/agents/api/types.md +113 -71
  6. package/agents/api.md +4 -4
  7. package/agents/boot-rules.md +743 -0
  8. package/agents/examples/contact.md +167 -0
  9. package/agents/examples/delivery-notifications.md +34 -1
  10. package/agents/examples/lane-routing.md +13 -0
  11. package/agents/examples/record-detail-layout.md +13 -2
  12. package/agents/examples/search.md +65 -3
  13. package/agents/examples/secrets-demo.md +96 -2
  14. package/agents/examples/tenant-inactivity.md +138 -0
  15. package/agents/examples.md +2 -0
  16. package/agents/features-index.md +4 -0
  17. package/agents/features.md +24 -1
  18. package/agents/widgets.md +12 -1
  19. package/dist/api/export/export-rows.js +1 -0
  20. package/dist/compliance/index.d.ts +1 -1
  21. package/dist/db/event-store-executor-read-where.js +15 -5
  22. package/dist/db/index.d.ts +1 -1
  23. package/dist/db/index.js +1 -1
  24. package/dist/db/migrate-generator.js +3 -1
  25. package/dist/db/queries/event-consumer.js +11 -7
  26. package/dist/db/queries/event-store.d.ts +2 -1
  27. package/dist/db/queries/event-store.js +25 -6
  28. package/dist/db/queries/rls-boot-catalog.js +3 -1
  29. package/dist/db/queries/session-advisory-lock.d.ts +7 -0
  30. package/dist/db/queries/session-advisory-lock.js +23 -0
  31. package/dist/db/query.js +7 -10
  32. package/dist/db/row-level-security-connection.js +4 -2
  33. package/dist/engine/active-membership.js +1 -0
  34. package/dist/engine/boot-validator/access-declarations.js +57 -33
  35. package/dist/engine/boot-validator/action-wiring.js +8 -6
  36. package/dist/engine/boot-validator/agent-effect-rules.d.ts +12 -0
  37. package/dist/engine/boot-validator/agent-effect-rules.js +12 -0
  38. package/dist/engine/boot-validator/agent-effect.d.ts +2 -0
  39. package/dist/engine/boot-validator/agent-effect.js +20 -0
  40. package/dist/engine/boot-validator/boot-context.js +5 -1
  41. package/dist/engine/boot-validator/boot-environment-rules.d.ts +12 -0
  42. package/dist/engine/boot-validator/boot-environment-rules.js +12 -0
  43. package/dist/engine/boot-validator/boot-phases-app.js +5 -1
  44. package/dist/engine/boot-validator/boot-phases.js +3 -1
  45. package/dist/engine/boot-validator/boot-rules.d.ts +2619 -0
  46. package/dist/engine/boot-validator/boot-rules.js +58 -0
  47. package/dist/engine/boot-validator/bundled-lists-table.js +23 -9
  48. package/dist/engine/boot-validator/config-deps.js +71 -23
  49. package/dist/engine/boot-validator/config-edit-action-rules.d.ts +17 -0
  50. package/dist/engine/boot-validator/config-edit-action-rules.js +17 -0
  51. package/dist/engine/boot-validator/config-key-rules.d.ts +117 -0
  52. package/dist/engine/boot-validator/config-key-rules.js +117 -0
  53. package/dist/engine/boot-validator/custom-screen-write-qns.js +6 -2
  54. package/dist/engine/boot-validator/derived-sql-fields-rules.d.ts +77 -0
  55. package/dist/engine/boot-validator/derived-sql-fields-rules.js +77 -0
  56. package/dist/engine/boot-validator/derived-sql-fields.js +53 -17
  57. package/dist/engine/boot-validator/detail-screens.js +10 -4
  58. package/dist/engine/boot-validator/entity-declaration-rules.d.ts +92 -0
  59. package/dist/engine/boot-validator/entity-declaration-rules.js +92 -0
  60. package/dist/engine/boot-validator/entity-handler-access-rules.d.ts +102 -0
  61. package/dist/engine/boot-validator/entity-handler-access-rules.js +102 -0
  62. package/dist/engine/boot-validator/entity-handler.d.ts +0 -7
  63. package/dist/engine/boot-validator/entity-handler.js +259 -355
  64. package/dist/engine/boot-validator/entity-image-variants.d.ts +2 -0
  65. package/dist/engine/boot-validator/entity-image-variants.js +91 -0
  66. package/dist/engine/boot-validator/entity-list-aggregate-options.js +8 -2
  67. package/dist/engine/boot-validator/entity-reference-embedded-rules.d.ts +117 -0
  68. package/dist/engine/boot-validator/entity-reference-embedded-rules.js +117 -0
  69. package/dist/engine/boot-validator/entity-select-image-rules.d.ts +122 -0
  70. package/dist/engine/boot-validator/entity-select-image-rules.js +122 -0
  71. package/dist/engine/boot-validator/entity-select.d.ts +8 -0
  72. package/dist/engine/boot-validator/entity-select.js +197 -0
  73. package/dist/engine/boot-validator/entity-structure-rules.d.ts +107 -0
  74. package/dist/engine/boot-validator/entity-structure-rules.js +107 -0
  75. package/dist/engine/boot-validator/field-conditions-rules.d.ts +92 -0
  76. package/dist/engine/boot-validator/field-conditions-rules.js +92 -0
  77. package/dist/engine/boot-validator/field-conditions.js +67 -22
  78. package/dist/engine/boot-validator/form-derivations-rules.d.ts +77 -0
  79. package/dist/engine/boot-validator/form-derivations-rules.js +77 -0
  80. package/dist/engine/boot-validator/form-derivations.js +52 -18
  81. package/dist/engine/boot-validator/global-tenancy.js +13 -7
  82. package/dist/engine/boot-validator/handler-declaration-rules.d.ts +72 -0
  83. package/dist/engine/boot-validator/handler-declaration-rules.js +72 -0
  84. package/dist/engine/boot-validator/handler-field-references-rules.d.ts +22 -0
  85. package/dist/engine/boot-validator/handler-field-references-rules.js +22 -0
  86. package/dist/engine/boot-validator/handler-field-references.js +14 -6
  87. package/dist/engine/boot-validator/list-bulk-actions-rules.d.ts +42 -0
  88. package/dist/engine/boot-validator/list-bulk-actions-rules.js +42 -0
  89. package/dist/engine/boot-validator/list-bulk-actions.js +29 -11
  90. package/dist/engine/boot-validator/list-column-layout.js +22 -10
  91. package/dist/engine/boot-validator/list-query-rules.d.ts +107 -0
  92. package/dist/engine/boot-validator/list-query-rules.js +107 -0
  93. package/dist/engine/boot-validator/list-table-aggregate-options.js +43 -15
  94. package/dist/engine/boot-validator/list-table-aggregate-query.js +7 -3
  95. package/dist/engine/boot-validator/list-table-aggregate-rules.d.ts +82 -0
  96. package/dist/engine/boot-validator/list-table-aggregate-rules.js +82 -0
  97. package/dist/engine/boot-validator/list-table-export-options.js +19 -7
  98. package/dist/engine/boot-validator/list-table-options.js +33 -13
  99. package/dist/engine/boot-validator/list-table-reject-unknown-keys.js +6 -2
  100. package/dist/engine/boot-validator/list-table-rules.d.ts +132 -0
  101. package/dist/engine/boot-validator/list-table-rules.js +132 -0
  102. package/dist/engine/boot-validator/nav-rules.d.ts +42 -0
  103. package/dist/engine/boot-validator/nav-rules.js +42 -0
  104. package/dist/engine/boot-validator/nav.js +29 -15
  105. package/dist/engine/boot-validator/ownership-rules.d.ts +27 -0
  106. package/dist/engine/boot-validator/ownership-rules.js +27 -0
  107. package/dist/engine/boot-validator/ownership.js +28 -12
  108. package/dist/engine/boot-validator/parent-ref.js +32 -20
  109. package/dist/engine/boot-validator/projection-list-screens.js +76 -35
  110. package/dist/engine/boot-validator/query-output-columns.js +9 -3
  111. package/dist/engine/boot-validator/query-refs.js +20 -10
  112. package/dist/engine/boot-validator/query-rules.d.ts +37 -0
  113. package/dist/engine/boot-validator/query-rules.js +37 -0
  114. package/dist/engine/boot-validator/read-gate.js +14 -10
  115. package/dist/engine/boot-validator/record-owned.js +5 -1
  116. package/dist/engine/boot-validator/related-list-table-rules.js +17 -7
  117. package/dist/engine/boot-validator/screens-actions-rules.d.ts +185 -0
  118. package/dist/engine/boot-validator/screens-actions-rules.js +185 -0
  119. package/dist/engine/boot-validator/screens-actions.js +169 -93
  120. package/dist/engine/boot-validator/screens-dashboard-chart-rules.d.ts +87 -0
  121. package/dist/engine/boot-validator/screens-dashboard-chart-rules.js +87 -0
  122. package/dist/engine/boot-validator/screens-dashboard-rules.d.ts +227 -0
  123. package/dist/engine/boot-validator/screens-dashboard-rules.js +227 -0
  124. package/dist/engine/boot-validator/screens-dashboard.js +222 -85
  125. package/dist/engine/boot-validator/screens-forms-layout-rules.d.ts +122 -0
  126. package/dist/engine/boot-validator/screens-forms-layout-rules.js +122 -0
  127. package/dist/engine/boot-validator/screens-forms-rules.d.ts +152 -0
  128. package/dist/engine/boot-validator/screens-forms-rules.js +152 -0
  129. package/dist/engine/boot-validator/screens-forms.js +240 -112
  130. package/dist/engine/boot-validator/screens-kind-config-edit.js +72 -16
  131. package/dist/engine/boot-validator/screens-kind-entity-edit.js +15 -7
  132. package/dist/engine/boot-validator/screens-kind-entity-list.js +57 -32
  133. package/dist/engine/boot-validator/screens-kind-projection-detail-rules.d.ts +92 -0
  134. package/dist/engine/boot-validator/screens-kind-projection-detail-rules.js +92 -0
  135. package/dist/engine/boot-validator/screens-kind-projection-detail.js +85 -47
  136. package/dist/engine/boot-validator/screens-kind-rules.d.ts +137 -0
  137. package/dist/engine/boot-validator/screens-kind-rules.js +137 -0
  138. package/dist/engine/boot-validator/screens-kind-secret-mint.js +18 -8
  139. package/dist/engine/boot-validator/screens-kind-shared.js +40 -22
  140. package/dist/engine/boot-validator/screens-lists-rules.d.ts +82 -0
  141. package/dist/engine/boot-validator/screens-lists-rules.js +82 -0
  142. package/dist/engine/boot-validator/screens-lists.js +90 -45
  143. package/dist/engine/boot-validator/screens-rules.d.ts +57 -0
  144. package/dist/engine/boot-validator/screens-rules.js +57 -0
  145. package/dist/engine/boot-validator/screens.js +17 -12
  146. package/dist/engine/boot-validator/transaction-phases.js +12 -4
  147. package/dist/engine/boot-validator/transfer-graph.js +17 -11
  148. package/dist/engine/boot-validator/url-prefill-fields.js +9 -5
  149. package/dist/engine/boot-validator/workspaces.js +11 -5
  150. package/dist/engine/boot-validator/zod-shape.js +6 -2
  151. package/dist/engine/entity-handlers.d.ts +1 -0
  152. package/dist/engine/entity-handlers.js +3 -0
  153. package/dist/engine/entity-list-runtime-options.js +23 -29
  154. package/dist/engine/extensions/tenant-data.d.ts +3 -0
  155. package/dist/engine/extensions/tenant-resource.d.ts +1 -0
  156. package/dist/engine/factories.d.ts +1 -1
  157. package/dist/engine/factories.js +4 -3
  158. package/dist/engine/feature-config-events-jobs.js +7 -0
  159. package/dist/engine/index.d.ts +4 -2
  160. package/dist/engine/index.js +2 -0
  161. package/dist/engine/project-app-schema-for-roles.js +29 -14
  162. package/dist/engine/registry-facade.js +7 -8
  163. package/dist/engine/registry-validate.js +5 -1
  164. package/dist/engine/soft-delete-cleanup.d.ts +1 -0
  165. package/dist/engine/soft-delete-cleanup.js +5 -0
  166. package/dist/engine/steps/describe-workflow-step-error.js +1 -0
  167. package/dist/es-ops/operations-schema.d.ts +1 -1
  168. package/dist/event-store/ensure-dead-letter-table.d.ts +2 -0
  169. package/dist/event-store/ensure-dead-letter-table.js +10 -0
  170. package/dist/event-store/rebuild-dead-letter.js +2 -8
  171. package/dist/event-store/upcaster-dead-letter.js +2 -8
  172. package/dist/files/copy-pending-file-refs-to-tenant.d.ts +28 -0
  173. package/dist/files/copy-pending-file-refs-to-tenant.js +87 -0
  174. package/dist/files/file-routes.d.ts +1 -1
  175. package/dist/files/file-routes.js +21 -6
  176. package/dist/files/index.d.ts +2 -0
  177. package/dist/files/index.js +1 -0
  178. package/dist/i18n/required-surface-keys.js +1 -0
  179. package/dist/jobs/job-runner-helpers.js +1 -0
  180. package/dist/jobs/job-runner-schedulers.d.ts +2 -2
  181. package/dist/jobs/job-runner-schedulers.js +8 -4
  182. package/dist/jobs/job-runner.js +14 -16
  183. package/dist/logging/utils.js +30 -60
  184. package/dist/observability/metrics-handle.js +10 -21
  185. package/dist/pipeline/cascade-handler.js +7 -6
  186. package/dist/pipeline/dispatch-query.js +18 -5
  187. package/dist/pipeline/dispatch-shared.d.ts +1 -0
  188. package/dist/pipeline/dispatch-shared.js +3 -1
  189. package/dist/pipeline/dispatch-write.js +10 -12
  190. package/dist/pipeline/dispatcher.js +12 -14
  191. package/dist/pipeline/event-dispatcher-admin.js +9 -8
  192. package/dist/pipeline/event-dispatcher-delivery.d.ts +19 -1
  193. package/dist/pipeline/event-dispatcher-delivery.js +121 -29
  194. package/dist/pipeline/event-dispatcher.d.ts +5 -1
  195. package/dist/pipeline/event-dispatcher.js +28 -21
  196. package/dist/pipeline/handler-context-phase-denials.js +2 -0
  197. package/dist/pipeline/multi-stream-apply-context.js +12 -20
  198. package/dist/pipeline/system-hooks.d.ts +4 -1
  199. package/dist/pipeline/system-hooks.js +79 -6
  200. package/dist/pipeline/system-identity-switch.js +10 -7
  201. package/dist/search/build-search-snippet.d.ts +9 -0
  202. package/dist/search/build-search-snippet.js +40 -0
  203. package/dist/search/index.d.ts +1 -0
  204. package/dist/search/index.js +1 -0
  205. package/dist/search/meilisearch-adapter.d.ts +32 -0
  206. package/dist/search/meilisearch-adapter.js +153 -56
  207. package/dist/search/meilisearch-chunking.d.ts +21 -0
  208. package/dist/search/meilisearch-chunking.js +96 -0
  209. package/dist/search/reindex-entity.d.ts +1 -0
  210. package/dist/search/reindex-entity.js +97 -52
  211. package/dist/ui-types/index.d.ts +1 -1
  212. package/dist/upgrade-cli.js +3 -14
  213. package/package.json +3 -3
  214. package/src/changes.json +85 -0
@@ -1,15 +1,19 @@
1
1
  import { SELECT_OPTION_TONES } from "@cosmicdrift/kumiko-types/fields";
2
2
  import { isExtensionEditSection, isFieldsEditSection, isWriteFormEditSection, normalizeEditField, sectionFieldSpecs, } from "../screen-helpers.js";
3
+ import { bootRuleError } from "./boot-rule.js";
3
4
  import { assertWriteHandlerRegistered, resolveRowActionNavigateTarget, validateActionHasIcon, validatePrimaryActionTarget, } from "./screens-actions.js";
4
5
  import { rejectWriteOnlyFormField, validateFieldsXorGroups, validateFormSelectOptions, validateTabSections, } from "./screens-forms.js";
6
+ import { PROJECTION_DETAIL_RULES } from "./screens-kind-projection-detail-rules.js";
5
7
  import { assertExtensionSectionHasComponent, editSectionLabel, listActionContext, navigateActionFromLink, rejectEmptySections, rejectMissingQuery, validateRecordHeaderAction, validateRecordSectionActions, } from "./screens-kind-shared.js";
6
8
  import { assertRefTargetRegistered, validateListActionTargets, validateRelatedListSection, } from "./screens-lists.js";
7
9
  import { isSelectOptionTone } from "./select-option-tone.js";
8
10
  function validateProjectionDetailFlags(featureName, screenId, screen) {
9
11
  if (screen.singleton === true && screen.idParam !== undefined) {
10
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets both singleton: true ` +
11
- `and idParam — singleton means the server picks the row from the caller's context, so there ` +
12
- `is no row id to send under idParam. Remove idParam.`);
12
+ throw bootRuleError(PROJECTION_DETAIL_RULES.singletonWithIdParam, {
13
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets both singleton: true ` +
14
+ `and idParam — singleton means the server picks the row from the caller's context, so there ` +
15
+ `is no row id to send under idParam. Remove idParam.`,
16
+ });
13
17
  }
14
18
  // singleton has no row id in the path, but the auto-generated "Edit"
15
19
  // action (defaultEditAction in kumiko-screen.tsx) navigates
@@ -18,13 +22,17 @@ function validateProjectionDetailFlags(featureName, screenId, screen) {
18
22
  // instead of editing the singleton row. Reject rather than let that
19
23
  // win silently, same as the idParam check above.
20
24
  if (screen.singleton === true && screen.detailFor !== undefined) {
21
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets both singleton: true ` +
22
- `and detailFor — the auto-generated "Edit" action navigates using the path's row id, which a ` +
23
- `singleton screen never has. Remove detailFor, or declare an explicit "edit" action instead.`);
25
+ throw bootRuleError(PROJECTION_DETAIL_RULES.singletonWithDetailFor, {
26
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets both singleton: true ` +
27
+ `and detailFor — the auto-generated "Edit" action navigates using the path's row id, which a ` +
28
+ `singleton screen never has. Remove detailFor, or declare an explicit "edit" action instead.`,
29
+ });
24
30
  }
25
31
  if (screen.recordTitleField !== undefined && screen.header !== undefined) {
26
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets both header and ` +
27
- `recordTitleField — header.title already names the record, so drop recordTitleField.`);
32
+ throw bootRuleError(PROJECTION_DETAIL_RULES.headerWithRecordTitleField, {
33
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets both header and ` +
34
+ `recordTitleField — header.title already names the record, so drop recordTitleField.`,
35
+ });
28
36
  }
29
37
  }
30
38
  function validateProjectionDetailTabs(featureName, screenId, screen) {
@@ -32,10 +40,12 @@ function validateProjectionDetailTabs(featureName, screenId, screen) {
32
40
  validateTabSections(featureName, screenId, "projectionDetail", screen.layout.sections);
33
41
  for (const section of screen.layout.sections) {
34
42
  if (isFieldsEditSection(section) && "groups" in section && section.actions !== undefined) {
35
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.id}" ` +
36
- `declares both groups and actions in tabs mode — actions has no single group's Card to sit ` +
37
- `in, and an extra title-less Card around the group cards would nest a Card inside a Card. ` +
38
- `Move the actions onto one group's title, or drop groups for a flat fields grid.`);
43
+ throw bootRuleError(PROJECTION_DETAIL_RULES.tabsSectionGroupsAndActions, {
44
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.id}" ` +
45
+ `declares both groups and actions in tabs mode — actions has no single group's Card to sit ` +
46
+ `in, and an extra title-less Card around the group cards would nest a Card inside a Card. ` +
47
+ `Move the actions onto one group's title, or drop groups for a flat fields grid.`,
48
+ });
39
49
  }
40
50
  }
41
51
  }
@@ -45,8 +55,10 @@ function validateProjectionDetailMetricNavigate(ctx, screenId, screen, field, na
45
55
  if (navigate.screen === undefined && navigate.entity === undefined) {
46
56
  if (navigate.tab !== undefined &&
47
57
  !screen.layout.sections.some((section) => section.id === navigate.tab)) {
48
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) metric "${field}" ` +
49
- `navigates to tab "${navigate.tab}", which is not a section id on this screen. Navigate to an existing section id or remove navigate.tab.`);
58
+ throw bootRuleError(PROJECTION_DETAIL_RULES.metricNavigateTabUnknown, {
59
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) metric "${field}" ` +
60
+ `navigates to tab "${navigate.tab}", which is not a section id on this screen. Navigate to an existing section id or remove navigate.tab.`,
61
+ });
50
62
  }
51
63
  }
52
64
  else {
@@ -58,9 +70,11 @@ function validateProjectionDetailMetricNavigate(ctx, screenId, screen, field, na
58
70
  }
59
71
  function validateProjectionDetailMetric(ctx, screenId, screen, metric) {
60
72
  if (typeof metric.label !== "string" || metric.label.length === 0) {
61
- throw new Error(`[Feature ${ctx.feature.name}] Screen "${screenId}" (projectionDetail) metric "${metric.field}" has ` +
62
- `no "label" — every metric needs an i18n label key, ` +
63
- `there is no fallback to the raw column name.`);
73
+ throw bootRuleError(PROJECTION_DETAIL_RULES.metricLabelMissing, {
74
+ message: `[Feature ${ctx.feature.name}] Screen "${screenId}" (projectionDetail) metric "${metric.field}" has ` +
75
+ `no "label" — every metric needs an i18n label key, ` +
76
+ `there is no fallback to the raw column name.`,
77
+ });
64
78
  }
65
79
  if (metric.navigate !== undefined) {
66
80
  validateProjectionDetailMetricNavigate(ctx, screenId, screen, metric.field, metric.navigate);
@@ -69,38 +83,48 @@ function validateProjectionDetailMetric(ctx, screenId, screen, metric) {
69
83
  function validateProjectionDetailStatusTones(featureName, screenId, screen) {
70
84
  for (const [statusValue, tone] of Object.entries(screen.header?.statusTones ?? {})) {
71
85
  if (!isSelectOptionTone(tone)) {
72
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) header.statusTones["${statusValue}"] ` +
73
- `is "${String(tone)}" — expected one of ${SELECT_OPTION_TONES.join(", ")}.`);
86
+ throw bootRuleError(PROJECTION_DETAIL_RULES.statusToneInvalid, {
87
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) header.statusTones["${statusValue}"] ` +
88
+ `is "${String(tone)}" — expected one of ${SELECT_OPTION_TONES.join(", ")}.`,
89
+ });
74
90
  }
75
91
  }
76
92
  }
77
93
  function validateProjectionDetailStatusFormat(featureName, screenId, screen) {
78
94
  const header = screen.header;
79
95
  if (header?.statusFormat !== undefined && header.status === undefined) {
80
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets header.statusFormat ` +
81
- `without header.status — there is no status badge to format. Set header.status or remove statusFormat.`);
96
+ throw bootRuleError(PROJECTION_DETAIL_RULES.statusFormatWithoutStatus, {
97
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets header.statusFormat ` +
98
+ `without header.status — there is no status badge to format. Set header.status or remove statusFormat.`,
99
+ });
82
100
  }
83
101
  }
84
102
  function validateProjectionDetailSubtitleParts(ctx, screenId, subtitleHref, parts) {
85
103
  const featureName = ctx.feature.name;
86
104
  if (subtitleHref !== undefined) {
87
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets header.subtitleHref ` +
88
- `together with a multi-part header.subtitle — subtitleHref only works with the string form. Use a single-field subtitle or remove subtitleHref.`);
105
+ throw bootRuleError(PROJECTION_DETAIL_RULES.subtitleHrefWithMultiPart, {
106
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) sets header.subtitleHref ` +
107
+ `together with a multi-part header.subtitle — subtitleHref only works with the string form. Use a single-field subtitle or remove subtitleHref.`,
108
+ });
89
109
  }
90
110
  const seenPartFields = new Set();
91
111
  for (const part of parts) {
92
112
  const partField = typeof part === "string" ? part : part.field;
93
113
  if (seenPartFields.has(partField)) {
94
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) header.subtitle ` +
95
- `lists field "${partField}" twice. List each field once.`);
114
+ throw bootRuleError(PROJECTION_DETAIL_RULES.subtitlePartDuplicate, {
115
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) header.subtitle ` +
116
+ `lists field "${partField}" twice. List each field once.`,
117
+ });
96
118
  }
97
119
  seenPartFields.add(partField);
98
120
  const navigate = typeof part === "string" ? undefined : part.navigate;
99
121
  if (navigate === undefined)
100
122
  continue;
101
123
  if (navigate.screen === undefined && navigate.entity === undefined) {
102
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) header.subtitle part ` +
103
- `"${partField}" navigates with neither "screen" nor "entity" — a tab-only navigate has no link target.`);
124
+ throw bootRuleError(PROJECTION_DETAIL_RULES.subtitlePartNavigateTargetMissing, {
125
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) header.subtitle part ` +
126
+ `"${partField}" navigates with neither "screen" nor "entity" — a tab-only navigate has no link target.`,
127
+ });
104
128
  }
105
129
  resolveRowActionNavigateTarget(featureName, screenId, "projectionDetail", "subtitle part", navigateActionFromLink(partField, navigate), ctx.allScreenQns, ctx.navTargetShortIds, ctx.screensByShortId, ctx.detailForScreens);
106
130
  }
@@ -118,10 +142,12 @@ function validateProjectionDetailExtensionSection(featureName, screenId, section
118
142
  // (e.g. notes-history NotesSection, via their own dispatcher
119
143
  // writes) are fine.
120
144
  if (section.contributesToFormSubmit === true) {
121
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) extension section ` +
122
- `"${section.title}" sets contributesToFormSubmit: true, but projectionDetail has no ` +
123
- `form submit to contribute to (read-only screen). Omit contributesToFormSubmit and ` +
124
- `persist through the extension's own dispatcher writes instead.`);
145
+ throw bootRuleError(PROJECTION_DETAIL_RULES.extensionContributesToFormSubmit, {
146
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) extension section ` +
147
+ `"${section.title}" sets contributesToFormSubmit: true, but projectionDetail has no ` +
148
+ `form submit to contribute to (read-only screen). Omit contributesToFormSubmit and ` +
149
+ `persist through the extension's own dispatcher writes instead.`,
150
+ });
125
151
  }
126
152
  assertExtensionSectionHasComponent(featureName, screenId, "projectionDetail", section);
127
153
  // The host-derived entity name on projectionDetail is an internal
@@ -129,16 +155,20 @@ function validateProjectionDetailExtensionSection(featureName, screenId, section
129
155
  // persisting extension needs the real domain entity name declared
130
156
  // explicitly, or it silently reads/writes against the wrong type.
131
157
  if (section.entityName === undefined || section.entityName.trim().length === 0) {
132
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) extension section ` +
133
- `"${section.title}" has no entityName — projectionDetail has no real entity, so the ` +
134
- `extension must declare entityName explicitly (the domain entity it persists against).`);
158
+ throw bootRuleError(PROJECTION_DETAIL_RULES.extensionEntityNameMissing, {
159
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) extension section ` +
160
+ `"${section.title}" has no entityName — projectionDetail has no real entity, so the ` +
161
+ `extension must declare entityName explicitly (the domain entity it persists against).`,
162
+ });
135
163
  }
136
164
  }
137
165
  function validateProjectionDetailRelatedList(ctx, screenId, screen, section) {
138
166
  if (screen.layout.mode === "wizard") {
139
- throw new Error(`[Feature ${ctx.feature.name}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
140
- `is kind "relatedList" in a wizard layout — a read-only list is not supported in a ` +
141
- `stepped form. Remove mode: "wizard" or drop the relatedList section.`);
167
+ throw bootRuleError(PROJECTION_DETAIL_RULES.wizardRelatedList, {
168
+ message: `[Feature ${ctx.feature.name}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
169
+ `is kind "relatedList" in a wizard layout — a read-only list is not supported in a ` +
170
+ `stepped form. Remove mode: "wizard" or drop the relatedList section.`,
171
+ });
142
172
  }
143
173
  validateRelatedListSection({
144
174
  featureName: ctx.feature.name,
@@ -158,12 +188,16 @@ function validateProjectionDetailRelatedList(ctx, screenId, screen, section) {
158
188
  function validateProjectionDetailWriteForm(ctx, screenId, screen, section) {
159
189
  const featureName = ctx.feature.name;
160
190
  if (Object.keys(section.fieldDefs).length === 0) {
161
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
162
- `(writeForm) has an empty fieldDefs map — declare at least one field type.`);
191
+ throw bootRuleError(PROJECTION_DETAIL_RULES.writeFormFieldDefsEmpty, {
192
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
193
+ `(writeForm) has an empty fieldDefs map — declare at least one field type.`,
194
+ });
163
195
  }
164
196
  if (section.fields.length === 0) {
165
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
166
- `(writeForm) has zero fields — drop the section or add fields to it.`);
197
+ throw bootRuleError(PROJECTION_DETAIL_RULES.writeFormFieldsEmpty, {
198
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
199
+ `(writeForm) has zero fields — drop the section or add fields to it.`,
200
+ });
167
201
  }
168
202
  // A ref to a fieldDef the form never renders would never resolve.
169
203
  const writeFormFieldNames = new Set(section.fields.map((f) => normalizeEditField(f).field));
@@ -174,15 +208,19 @@ function validateProjectionDetailWriteForm(ctx, screenId, screen, section) {
174
208
  for (const f of section.fields) {
175
209
  const fieldName = normalizeEditField(f).field;
176
210
  if (section.fieldDefs[fieldName] === undefined) {
177
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
178
- `(writeForm) field "${fieldName}" has no entry in fieldDefs — every rendered field needs ` +
179
- `a type declared there. Add the field to fieldDefs.`);
211
+ throw bootRuleError(PROJECTION_DETAIL_RULES.writeFormFieldWithoutDef, {
212
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
213
+ `(writeForm) field "${fieldName}" has no entry in fieldDefs — every rendered field needs ` +
214
+ `a type declared there. Add the field to fieldDefs.`,
215
+ });
180
216
  }
181
217
  }
182
218
  if (screen.layout.mode === "wizard") {
183
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
184
- `is kind "writeForm" in a wizard layout — a self-persisting form is not supported in a ` +
185
- `stepped form. Remove mode: "wizard" or drop the writeForm section.`);
219
+ throw bootRuleError(PROJECTION_DETAIL_RULES.wizardWriteForm, {
220
+ message: `[Feature ${featureName}] Screen "${screenId}" (projectionDetail) section "${section.title}" ` +
221
+ `is kind "writeForm" in a wizard layout — a self-persisting form is not supported in a ` +
222
+ `stepped form. Remove mode: "wizard" or drop the writeForm section.`,
223
+ });
186
224
  }
187
225
  assertWriteHandlerRegistered(featureName, `Screen "${screenId}" (projectionDetail) section "${section.title}" (writeForm)`, section.handler, ctx.allWriteHandlerQns);
188
226
  }
@@ -0,0 +1,137 @@
1
+ export declare const SCREEN_KIND_RULES: {
2
+ readonly unknownFieldReference: {
3
+ readonly id: "screen/unknown-field-reference";
4
+ readonly summary: "A column or layout field names a field that exists on the screen's entity.";
5
+ readonly fix: "Name a field of the entity.";
6
+ };
7
+ readonly entityNotDeclared: {
8
+ readonly id: "screen/entity-not-declared";
9
+ readonly summary: "A screen's entity is declared in its feature.";
10
+ readonly fix: "Declare the entity in this feature or fix the name.";
11
+ };
12
+ readonly queryEmpty: {
13
+ readonly id: "screen/query-empty";
14
+ readonly summary: "A screen or section query is a non-empty string.";
15
+ readonly fix: "Set query to a registered query name.";
16
+ };
17
+ readonly columnsEmpty: {
18
+ readonly id: "screen/columns-empty";
19
+ readonly summary: "A list screen declares at least one column.";
20
+ readonly fix: "Declare at least one column.";
21
+ };
22
+ readonly filterInNeedsArray: {
23
+ readonly id: "screen/filter-in-needs-array";
24
+ readonly summary: "A filter with op in has an array value.";
25
+ readonly fix: "Pass an array as filter.value.";
26
+ };
27
+ readonly headerActionRowClick: {
28
+ readonly id: "screen/header-action-row-click";
29
+ readonly summary: "Record header actions do not set rowClick, because a record screen has no row.";
30
+ readonly fix: "Remove rowClick.";
31
+ };
32
+ readonly defaultSortUnknownField: {
33
+ readonly id: "entity-list/default-sort-unknown-field";
34
+ readonly summary: "defaultSort.field is a field of the entity.";
35
+ readonly fix: "Name an existing entity field.";
36
+ };
37
+ readonly filterUnknownField: {
38
+ readonly id: "entity-list/filter-unknown-field";
39
+ readonly summary: "A screen filter names a field of the entity.";
40
+ readonly fix: "Name an existing entity field.";
41
+ };
42
+ readonly filterFieldNotAllowed: {
43
+ readonly id: "entity-list/filter-field-not-allowed";
44
+ readonly summary: "A screen filter does not target an encrypted, personal or secret field the list handler rejects.";
45
+ readonly fix: "Drop the filter or filter on another field; personal fields only allow op eq with find exact or fuzzy.";
46
+ };
47
+ readonly filterFieldNotFilterable: {
48
+ readonly id: "entity-list/filter-field-not-filterable";
49
+ readonly summary: "A screen filter targets a filterable field.";
50
+ readonly fix: "Set filterable: true on the field or pick another field.";
51
+ };
52
+ readonly filterOpNotAllowed: {
53
+ readonly id: "entity-list/filter-op-not-allowed";
54
+ readonly summary: "A screen filter uses an op allowed for the field type.";
55
+ readonly fix: "Use one of the allowed ops for the field.";
56
+ };
57
+ readonly crossFeatureEditNeedsEntityId: {
58
+ readonly id: "entity-list/cross-feature-edit-needs-entity-id";
59
+ readonly summary: "A rowAction navigating to a cross-feature entityEdit screen sets entityId.";
60
+ readonly fix: "Set entityId to the row field naming the target entity's id.";
61
+ };
62
+ readonly pageSizeInvalid: {
63
+ readonly id: "entity-list/page-size-invalid";
64
+ readonly summary: "pageSize is a positive integer.";
65
+ readonly fix: "Set pageSize to a positive integer.";
66
+ };
67
+ readonly createScreenUnresolved: {
68
+ readonly id: "entity-list/create-screen-unresolved";
69
+ readonly summary: "createScreen resolves to a registered screen in the same feature.";
70
+ readonly fix: "Point createScreen at a screen of this feature.";
71
+ };
72
+ readonly configEditFieldsEmpty: {
73
+ readonly id: "config-edit/fields-empty";
74
+ readonly summary: "A configEdit screen declares at least one field.";
75
+ readonly fix: "Declare at least one field.";
76
+ };
77
+ readonly configEditFieldTypeMissing: {
78
+ readonly id: "config-edit/field-type-missing";
79
+ readonly summary: "Every configEdit field declares a type.";
80
+ readonly fix: "Set type on the field.";
81
+ };
82
+ readonly configEditLayoutUnknownField: {
83
+ readonly id: "config-edit/layout-unknown-field";
84
+ readonly summary: "A configEdit layout names a declared field.";
85
+ readonly fix: "Name a declared field.";
86
+ };
87
+ readonly configEditFieldWithoutConfigKey: {
88
+ readonly id: "config-edit/field-without-config-key";
89
+ readonly summary: "Every configEdit field maps to a config key in configKeys.";
90
+ readonly fix: "Add the field to configKeys with a <feature>:config:<short> key.";
91
+ };
92
+ readonly configEditConfigKeyUnknown: {
93
+ readonly id: "config-edit/config-key-unknown";
94
+ readonly summary: "A configKeys entry names a config key declared in a feature.";
95
+ readonly fix: "Use an existing <feature>:config:<short> key.";
96
+ };
97
+ readonly configEditWriteOnlyNotEncrypted: {
98
+ readonly id: "config-edit/write-only-not-encrypted";
99
+ readonly summary: "A writeOnly configEdit field maps to an encrypted config key.";
100
+ readonly fix: 'Declare the key with encrypted: true or backing: "secrets".';
101
+ };
102
+ readonly configEditSecretKeyUnknownField: {
103
+ readonly id: "config-edit/secret-key-unknown-field";
104
+ readonly summary: "secretKeys names declared fields.";
105
+ readonly fix: "Name a declared field.";
106
+ };
107
+ readonly secretMintRevealFieldsEmpty: {
108
+ readonly id: "secret-mint/reveal-fields-empty";
109
+ readonly summary: "A secretMint screen reveals at least one field.";
110
+ readonly fix: "Declare at least one reveal field.";
111
+ };
112
+ readonly secretMintRevealFieldNameEmpty: {
113
+ readonly id: "secret-mint/reveal-field-name-empty";
114
+ readonly summary: "Every reveal.fields entry has a non-empty string field.";
115
+ readonly fix: "Set field to a non-empty string.";
116
+ };
117
+ readonly secretMintRevealFieldDuplicate: {
118
+ readonly id: "secret-mint/reveal-field-duplicate";
119
+ readonly summary: "Each reveal field appears once.";
120
+ readonly fix: "Remove the duplicate entry.";
121
+ };
122
+ readonly secretMintRevealFieldLabelEmpty: {
123
+ readonly id: "secret-mint/reveal-field-label-empty";
124
+ readonly summary: "Every reveal.fields entry has a non-empty string label.";
125
+ readonly fix: "Set label to a non-empty string.";
126
+ };
127
+ readonly entityEditRecordTitleFieldUnknown: {
128
+ readonly id: "entity-edit/record-title-field-unknown";
129
+ readonly summary: "recordTitleField is a field of the screen's entity.";
130
+ readonly fix: "Name an existing entity field.";
131
+ };
132
+ readonly entityEditReadOnlyFieldUnknown: {
133
+ readonly id: "entity-edit/read-only-field-unknown";
134
+ readonly summary: "The readOnly condition field is a field of the screen's entity.";
135
+ readonly fix: "Name an existing entity field.";
136
+ };
137
+ };
@@ -0,0 +1,137 @@
1
+ export const SCREEN_KIND_RULES = {
2
+ unknownFieldReference: {
3
+ id: "screen/unknown-field-reference",
4
+ summary: "A column or layout field names a field that exists on the screen's entity.",
5
+ fix: "Name a field of the entity.",
6
+ },
7
+ entityNotDeclared: {
8
+ id: "screen/entity-not-declared",
9
+ summary: "A screen's entity is declared in its feature.",
10
+ fix: "Declare the entity in this feature or fix the name.",
11
+ },
12
+ queryEmpty: {
13
+ id: "screen/query-empty",
14
+ summary: "A screen or section query is a non-empty string.",
15
+ fix: "Set query to a registered query name.",
16
+ },
17
+ columnsEmpty: {
18
+ id: "screen/columns-empty",
19
+ summary: "A list screen declares at least one column.",
20
+ fix: "Declare at least one column.",
21
+ },
22
+ filterInNeedsArray: {
23
+ id: "screen/filter-in-needs-array",
24
+ summary: "A filter with op in has an array value.",
25
+ fix: "Pass an array as filter.value.",
26
+ },
27
+ headerActionRowClick: {
28
+ id: "screen/header-action-row-click",
29
+ summary: "Record header actions do not set rowClick, because a record screen has no row.",
30
+ fix: "Remove rowClick.",
31
+ },
32
+ defaultSortUnknownField: {
33
+ id: "entity-list/default-sort-unknown-field",
34
+ summary: "defaultSort.field is a field of the entity.",
35
+ fix: "Name an existing entity field.",
36
+ },
37
+ filterUnknownField: {
38
+ id: "entity-list/filter-unknown-field",
39
+ summary: "A screen filter names a field of the entity.",
40
+ fix: "Name an existing entity field.",
41
+ },
42
+ filterFieldNotAllowed: {
43
+ id: "entity-list/filter-field-not-allowed",
44
+ summary: "A screen filter does not target an encrypted, personal or secret field the list handler rejects.",
45
+ fix: "Drop the filter or filter on another field; personal fields only allow op eq with find exact or fuzzy.",
46
+ },
47
+ filterFieldNotFilterable: {
48
+ id: "entity-list/filter-field-not-filterable",
49
+ summary: "A screen filter targets a filterable field.",
50
+ fix: "Set filterable: true on the field or pick another field.",
51
+ },
52
+ filterOpNotAllowed: {
53
+ id: "entity-list/filter-op-not-allowed",
54
+ summary: "A screen filter uses an op allowed for the field type.",
55
+ fix: "Use one of the allowed ops for the field.",
56
+ },
57
+ crossFeatureEditNeedsEntityId: {
58
+ id: "entity-list/cross-feature-edit-needs-entity-id",
59
+ summary: "A rowAction navigating to a cross-feature entityEdit screen sets entityId.",
60
+ fix: "Set entityId to the row field naming the target entity's id.",
61
+ },
62
+ pageSizeInvalid: {
63
+ id: "entity-list/page-size-invalid",
64
+ summary: "pageSize is a positive integer.",
65
+ fix: "Set pageSize to a positive integer.",
66
+ },
67
+ createScreenUnresolved: {
68
+ id: "entity-list/create-screen-unresolved",
69
+ summary: "createScreen resolves to a registered screen in the same feature.",
70
+ fix: "Point createScreen at a screen of this feature.",
71
+ },
72
+ configEditFieldsEmpty: {
73
+ id: "config-edit/fields-empty",
74
+ summary: "A configEdit screen declares at least one field.",
75
+ fix: "Declare at least one field.",
76
+ },
77
+ configEditFieldTypeMissing: {
78
+ id: "config-edit/field-type-missing",
79
+ summary: "Every configEdit field declares a type.",
80
+ fix: "Set type on the field.",
81
+ },
82
+ configEditLayoutUnknownField: {
83
+ id: "config-edit/layout-unknown-field",
84
+ summary: "A configEdit layout names a declared field.",
85
+ fix: "Name a declared field.",
86
+ },
87
+ configEditFieldWithoutConfigKey: {
88
+ id: "config-edit/field-without-config-key",
89
+ summary: "Every configEdit field maps to a config key in configKeys.",
90
+ fix: "Add the field to configKeys with a <feature>:config:<short> key.",
91
+ },
92
+ configEditConfigKeyUnknown: {
93
+ id: "config-edit/config-key-unknown",
94
+ summary: "A configKeys entry names a config key declared in a feature.",
95
+ fix: "Use an existing <feature>:config:<short> key.",
96
+ },
97
+ configEditWriteOnlyNotEncrypted: {
98
+ id: "config-edit/write-only-not-encrypted",
99
+ summary: "A writeOnly configEdit field maps to an encrypted config key.",
100
+ fix: 'Declare the key with encrypted: true or backing: "secrets".',
101
+ },
102
+ configEditSecretKeyUnknownField: {
103
+ id: "config-edit/secret-key-unknown-field",
104
+ summary: "secretKeys names declared fields.",
105
+ fix: "Name a declared field.",
106
+ },
107
+ secretMintRevealFieldsEmpty: {
108
+ id: "secret-mint/reveal-fields-empty",
109
+ summary: "A secretMint screen reveals at least one field.",
110
+ fix: "Declare at least one reveal field.",
111
+ },
112
+ secretMintRevealFieldNameEmpty: {
113
+ id: "secret-mint/reveal-field-name-empty",
114
+ summary: "Every reveal.fields entry has a non-empty string field.",
115
+ fix: "Set field to a non-empty string.",
116
+ },
117
+ secretMintRevealFieldDuplicate: {
118
+ id: "secret-mint/reveal-field-duplicate",
119
+ summary: "Each reveal field appears once.",
120
+ fix: "Remove the duplicate entry.",
121
+ },
122
+ secretMintRevealFieldLabelEmpty: {
123
+ id: "secret-mint/reveal-field-label-empty",
124
+ summary: "Every reveal.fields entry has a non-empty string label.",
125
+ fix: "Set label to a non-empty string.",
126
+ },
127
+ entityEditRecordTitleFieldUnknown: {
128
+ id: "entity-edit/record-title-field-unknown",
129
+ summary: "recordTitleField is a field of the screen's entity.",
130
+ fix: "Name an existing entity field.",
131
+ },
132
+ entityEditReadOnlyFieldUnknown: {
133
+ id: "entity-edit/read-only-field-unknown",
134
+ summary: "The readOnly condition field is a field of the screen's entity.",
135
+ fix: "Name an existing entity field.",
136
+ },
137
+ };
@@ -1,23 +1,33 @@
1
+ import { bootRuleError } from "./boot-rule.js";
1
2
  import { validateInlineFormScreen, validateSecretMintConfirm } from "./screens-forms.js";
3
+ import { SCREEN_KIND_RULES } from "./screens-kind-rules.js";
2
4
  function validateSecretMintRevealFields(featureName, screenId, screen) {
3
5
  if (screen.reveal.fields.length === 0) {
4
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (secretMint) has an empty reveal.fields ` +
5
- `list — declare at least one field to reveal.`);
6
+ throw bootRuleError(SCREEN_KIND_RULES.secretMintRevealFieldsEmpty, {
7
+ message: `[Feature ${featureName}] Screen "${screenId}" (secretMint) has an empty reveal.fields ` +
8
+ `list — declare at least one field to reveal.`,
9
+ });
6
10
  }
7
11
  const revealFieldNames = new Set();
8
12
  for (const revealField of screen.reveal.fields) {
9
13
  if (typeof revealField.field !== "string" || revealField.field.trim() === "") {
10
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (secretMint) has a reveal.fields entry ` +
11
- `with an empty or non-string "field". Set field to a non-empty string.`);
14
+ throw bootRuleError(SCREEN_KIND_RULES.secretMintRevealFieldNameEmpty, {
15
+ message: `[Feature ${featureName}] Screen "${screenId}" (secretMint) has a reveal.fields entry ` +
16
+ `with an empty or non-string "field". Set field to a non-empty string.`,
17
+ });
12
18
  }
13
19
  if (revealFieldNames.has(revealField.field)) {
14
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (secretMint) reveal.fields has a ` +
15
- `duplicate field "${revealField.field}" — each revealed field must be unique.`);
20
+ throw bootRuleError(SCREEN_KIND_RULES.secretMintRevealFieldDuplicate, {
21
+ message: `[Feature ${featureName}] Screen "${screenId}" (secretMint) reveal.fields has a ` +
22
+ `duplicate field "${revealField.field}" — each revealed field must be unique.`,
23
+ });
16
24
  }
17
25
  revealFieldNames.add(revealField.field);
18
26
  if (typeof revealField.label !== "string" || revealField.label.trim() === "") {
19
- throw new Error(`[Feature ${featureName}] Screen "${screenId}" (secretMint) reveal.fields entry ` +
20
- `"${revealField.field}" has an empty or non-string "label". Set label to a non-empty string.`);
27
+ throw bootRuleError(SCREEN_KIND_RULES.secretMintRevealFieldLabelEmpty, {
28
+ message: `[Feature ${featureName}] Screen "${screenId}" (secretMint) reveal.fields entry ` +
29
+ `"${revealField.field}" has an empty or non-string "label". Set label to a non-empty string.`,
30
+ });
21
31
  }
22
32
  }
23
33
  }