@cosmicdrift/kumiko-framework 0.406.0 → 0.410.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/AGENTS.md +4 -2
- package/agents/api/framework-db.md +1 -0
- package/agents/api/framework-engine.md +17 -2
- package/agents/api/framework-ui-types.md +15 -0
- package/agents/api/renderer-web.md +156 -2
- package/agents/api/types.md +113 -71
- package/agents/api.md +4 -4
- package/agents/boot-rules.md +744 -0
- package/agents/examples/anonymous-access.md +23 -1
- package/agents/examples/contact.md +173 -0
- package/agents/examples/delivery-notifications.md +34 -1
- package/agents/examples/record-detail-layout.md +13 -2
- package/agents/examples/search.md +65 -3
- package/agents/examples/secrets-demo.md +96 -2
- package/agents/examples/tenant-inactivity.md +138 -0
- package/agents/examples.md +2 -0
- package/agents/features-index.md +4 -0
- package/agents/features.md +25 -1
- package/agents/widgets.md +12 -1
- package/dist/api/export/export-rows.js +1 -0
- package/dist/compliance/index.d.ts +1 -1
- package/dist/db/event-store-executor-read-where.js +15 -5
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/migrate-generator.js +3 -1
- package/dist/db/queries/event-consumer.js +11 -7
- package/dist/db/queries/event-store.d.ts +2 -1
- package/dist/db/queries/event-store.js +25 -6
- package/dist/db/queries/rls-boot-catalog.js +3 -1
- package/dist/db/queries/session-advisory-lock.d.ts +7 -0
- package/dist/db/queries/session-advisory-lock.js +23 -0
- package/dist/db/query.js +7 -10
- package/dist/db/row-level-security-connection.js +4 -2
- package/dist/engine/access.js +5 -1
- package/dist/engine/active-membership.js +1 -0
- package/dist/engine/boot-validator/access-declarations.js +76 -33
- package/dist/engine/boot-validator/action-wiring.js +8 -6
- package/dist/engine/boot-validator/agent-effect-rules.d.ts +12 -0
- package/dist/engine/boot-validator/agent-effect-rules.js +12 -0
- package/dist/engine/boot-validator/agent-effect.d.ts +2 -0
- package/dist/engine/boot-validator/agent-effect.js +20 -0
- package/dist/engine/boot-validator/boot-context.js +5 -1
- package/dist/engine/boot-validator/boot-environment-rules.d.ts +12 -0
- package/dist/engine/boot-validator/boot-environment-rules.js +12 -0
- package/dist/engine/boot-validator/boot-phases-app.js +5 -1
- package/dist/engine/boot-validator/boot-phases.js +3 -1
- package/dist/engine/boot-validator/boot-rules.d.ts +2624 -0
- package/dist/engine/boot-validator/boot-rules.js +58 -0
- package/dist/engine/boot-validator/bundled-lists-table.js +23 -9
- package/dist/engine/boot-validator/config-deps.js +71 -23
- package/dist/engine/boot-validator/config-edit-action-rules.d.ts +17 -0
- package/dist/engine/boot-validator/config-edit-action-rules.js +17 -0
- package/dist/engine/boot-validator/config-key-rules.d.ts +117 -0
- package/dist/engine/boot-validator/config-key-rules.js +117 -0
- package/dist/engine/boot-validator/custom-screen-write-qns.js +6 -2
- package/dist/engine/boot-validator/derived-sql-fields-rules.d.ts +77 -0
- package/dist/engine/boot-validator/derived-sql-fields-rules.js +77 -0
- package/dist/engine/boot-validator/derived-sql-fields.js +53 -17
- package/dist/engine/boot-validator/detail-screens.js +10 -4
- package/dist/engine/boot-validator/entity-declaration-rules.d.ts +92 -0
- package/dist/engine/boot-validator/entity-declaration-rules.js +92 -0
- package/dist/engine/boot-validator/entity-handler-access-rules.d.ts +102 -0
- package/dist/engine/boot-validator/entity-handler-access-rules.js +102 -0
- package/dist/engine/boot-validator/entity-handler.d.ts +0 -7
- package/dist/engine/boot-validator/entity-handler.js +259 -355
- package/dist/engine/boot-validator/entity-image-variants.d.ts +2 -0
- package/dist/engine/boot-validator/entity-image-variants.js +91 -0
- package/dist/engine/boot-validator/entity-list-aggregate-options.js +8 -2
- package/dist/engine/boot-validator/entity-reference-embedded-rules.d.ts +117 -0
- package/dist/engine/boot-validator/entity-reference-embedded-rules.js +117 -0
- package/dist/engine/boot-validator/entity-select-image-rules.d.ts +122 -0
- package/dist/engine/boot-validator/entity-select-image-rules.js +122 -0
- package/dist/engine/boot-validator/entity-select.d.ts +8 -0
- package/dist/engine/boot-validator/entity-select.js +197 -0
- package/dist/engine/boot-validator/entity-structure-rules.d.ts +107 -0
- package/dist/engine/boot-validator/entity-structure-rules.js +107 -0
- package/dist/engine/boot-validator/field-conditions-rules.d.ts +92 -0
- package/dist/engine/boot-validator/field-conditions-rules.js +92 -0
- package/dist/engine/boot-validator/field-conditions.js +67 -22
- package/dist/engine/boot-validator/form-derivations-rules.d.ts +77 -0
- package/dist/engine/boot-validator/form-derivations-rules.js +77 -0
- package/dist/engine/boot-validator/form-derivations.js +52 -18
- package/dist/engine/boot-validator/global-tenancy.js +13 -7
- package/dist/engine/boot-validator/handler-declaration-rules.d.ts +77 -0
- package/dist/engine/boot-validator/handler-declaration-rules.js +77 -0
- package/dist/engine/boot-validator/handler-field-references-rules.d.ts +22 -0
- package/dist/engine/boot-validator/handler-field-references-rules.js +22 -0
- package/dist/engine/boot-validator/handler-field-references.js +14 -6
- package/dist/engine/boot-validator/list-bulk-actions-rules.d.ts +42 -0
- package/dist/engine/boot-validator/list-bulk-actions-rules.js +42 -0
- package/dist/engine/boot-validator/list-bulk-actions.js +29 -11
- package/dist/engine/boot-validator/list-column-layout.js +22 -10
- package/dist/engine/boot-validator/list-query-rules.d.ts +107 -0
- package/dist/engine/boot-validator/list-query-rules.js +107 -0
- package/dist/engine/boot-validator/list-table-aggregate-options.js +43 -15
- package/dist/engine/boot-validator/list-table-aggregate-query.js +7 -3
- package/dist/engine/boot-validator/list-table-aggregate-rules.d.ts +82 -0
- package/dist/engine/boot-validator/list-table-aggregate-rules.js +82 -0
- package/dist/engine/boot-validator/list-table-export-options.js +19 -7
- package/dist/engine/boot-validator/list-table-options.js +33 -13
- package/dist/engine/boot-validator/list-table-reject-unknown-keys.js +6 -2
- package/dist/engine/boot-validator/list-table-rules.d.ts +132 -0
- package/dist/engine/boot-validator/list-table-rules.js +132 -0
- package/dist/engine/boot-validator/nav-rules.d.ts +42 -0
- package/dist/engine/boot-validator/nav-rules.js +42 -0
- package/dist/engine/boot-validator/nav.js +33 -17
- package/dist/engine/boot-validator/ownership-rules.d.ts +27 -0
- package/dist/engine/boot-validator/ownership-rules.js +27 -0
- package/dist/engine/boot-validator/ownership.js +28 -12
- package/dist/engine/boot-validator/parent-ref.js +32 -20
- package/dist/engine/boot-validator/projection-list-screens.js +76 -35
- package/dist/engine/boot-validator/query-output-columns.js +9 -3
- package/dist/engine/boot-validator/query-refs.js +20 -10
- package/dist/engine/boot-validator/query-rules.d.ts +37 -0
- package/dist/engine/boot-validator/query-rules.js +37 -0
- package/dist/engine/boot-validator/read-gate.js +14 -10
- package/dist/engine/boot-validator/record-owned.js +5 -1
- package/dist/engine/boot-validator/related-list-table-rules.js +17 -7
- package/dist/engine/boot-validator/screens-actions-rules.d.ts +185 -0
- package/dist/engine/boot-validator/screens-actions-rules.js +185 -0
- package/dist/engine/boot-validator/screens-actions.js +169 -93
- package/dist/engine/boot-validator/screens-dashboard-chart-rules.d.ts +87 -0
- package/dist/engine/boot-validator/screens-dashboard-chart-rules.js +87 -0
- package/dist/engine/boot-validator/screens-dashboard-rules.d.ts +227 -0
- package/dist/engine/boot-validator/screens-dashboard-rules.js +227 -0
- package/dist/engine/boot-validator/screens-dashboard.js +222 -85
- package/dist/engine/boot-validator/screens-forms-layout-rules.d.ts +122 -0
- package/dist/engine/boot-validator/screens-forms-layout-rules.js +122 -0
- package/dist/engine/boot-validator/screens-forms-rules.d.ts +152 -0
- package/dist/engine/boot-validator/screens-forms-rules.js +152 -0
- package/dist/engine/boot-validator/screens-forms.js +240 -112
- package/dist/engine/boot-validator/screens-kind-config-edit.js +72 -16
- package/dist/engine/boot-validator/screens-kind-entity-edit.js +15 -7
- package/dist/engine/boot-validator/screens-kind-entity-list.js +57 -32
- package/dist/engine/boot-validator/screens-kind-projection-detail-rules.d.ts +92 -0
- package/dist/engine/boot-validator/screens-kind-projection-detail-rules.js +92 -0
- package/dist/engine/boot-validator/screens-kind-projection-detail.js +85 -47
- package/dist/engine/boot-validator/screens-kind-rules.d.ts +137 -0
- package/dist/engine/boot-validator/screens-kind-rules.js +137 -0
- package/dist/engine/boot-validator/screens-kind-secret-mint.js +18 -8
- package/dist/engine/boot-validator/screens-kind-shared.js +40 -22
- package/dist/engine/boot-validator/screens-lists-rules.d.ts +82 -0
- package/dist/engine/boot-validator/screens-lists-rules.js +82 -0
- package/dist/engine/boot-validator/screens-lists.js +90 -45
- package/dist/engine/boot-validator/screens-rules.d.ts +57 -0
- package/dist/engine/boot-validator/screens-rules.js +57 -0
- package/dist/engine/boot-validator/screens.js +17 -12
- package/dist/engine/boot-validator/transaction-phases.js +12 -4
- package/dist/engine/boot-validator/transfer-graph.js +17 -11
- package/dist/engine/boot-validator/url-prefill-fields.js +9 -5
- package/dist/engine/boot-validator/workspaces.js +11 -5
- package/dist/engine/boot-validator/zod-shape.js +6 -2
- package/dist/engine/entity-handlers.d.ts +1 -0
- package/dist/engine/entity-handlers.js +3 -0
- package/dist/engine/entity-list-runtime-options.js +23 -29
- package/dist/engine/extensions/tenant-data.d.ts +3 -0
- package/dist/engine/factories.d.ts +1 -1
- package/dist/engine/factories.js +4 -3
- package/dist/engine/index.d.ts +4 -2
- package/dist/engine/index.js +2 -0
- package/dist/engine/project-app-schema-for-roles.js +29 -14
- package/dist/engine/registry-facade.js +7 -8
- package/dist/engine/registry-validate.js +5 -1
- package/dist/engine/soft-delete-cleanup.d.ts +1 -0
- package/dist/engine/soft-delete-cleanup.js +5 -0
- package/dist/engine/steps/describe-workflow-step-error.js +1 -0
- package/dist/es-ops/operations-schema.d.ts +1 -1
- package/dist/event-store/ensure-dead-letter-table.d.ts +2 -0
- package/dist/event-store/ensure-dead-letter-table.js +10 -0
- package/dist/event-store/rebuild-dead-letter.js +2 -8
- package/dist/event-store/upcaster-dead-letter.js +2 -8
- package/dist/files/copy-pending-file-refs-to-tenant.d.ts +28 -0
- package/dist/files/copy-pending-file-refs-to-tenant.js +87 -0
- package/dist/files/file-routes.d.ts +1 -1
- package/dist/files/file-routes.js +21 -6
- package/dist/files/index.d.ts +2 -0
- package/dist/files/index.js +1 -0
- package/dist/i18n/required-surface-keys.js +1 -0
- package/dist/jobs/job-runner-helpers.js +1 -0
- package/dist/jobs/job-runner.js +7 -12
- package/dist/logging/utils.js +30 -60
- package/dist/observability/metrics-handle.js +10 -21
- package/dist/pipeline/cascade-handler.js +7 -6
- package/dist/pipeline/dispatch-query.js +18 -5
- package/dist/pipeline/dispatch-shared.d.ts +1 -0
- package/dist/pipeline/dispatch-shared.js +3 -1
- package/dist/pipeline/dispatch-write.js +10 -12
- package/dist/pipeline/dispatcher.js +12 -14
- package/dist/pipeline/event-dispatcher-admin.js +9 -8
- package/dist/pipeline/event-dispatcher-delivery.d.ts +19 -1
- package/dist/pipeline/event-dispatcher-delivery.js +121 -29
- package/dist/pipeline/event-dispatcher.d.ts +5 -1
- package/dist/pipeline/event-dispatcher.js +28 -21
- package/dist/pipeline/handler-context-phase-denials.js +2 -0
- package/dist/pipeline/multi-stream-apply-context.js +12 -20
- package/dist/pipeline/system-hooks.d.ts +4 -1
- package/dist/pipeline/system-hooks.js +79 -6
- package/dist/pipeline/system-identity-switch.js +10 -7
- package/dist/search/build-search-snippet.d.ts +9 -0
- package/dist/search/build-search-snippet.js +40 -0
- package/dist/search/index.d.ts +1 -0
- package/dist/search/index.js +1 -0
- package/dist/search/meilisearch-adapter.d.ts +32 -0
- package/dist/search/meilisearch-adapter.js +153 -56
- package/dist/search/meilisearch-chunking.d.ts +21 -0
- package/dist/search/meilisearch-chunking.js +96 -0
- package/dist/search/reindex-entity.d.ts +1 -0
- package/dist/search/reindex-entity.js +97 -52
- package/dist/ui-types/index.d.ts +1 -1
- package/dist/upgrade-cli.js +3 -14
- package/package.json +3 -3
- package/src/changes.json +79 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { bootRuleError } from "./boot-rule.js";
|
|
2
|
+
import { FORM_LAYOUT_RULES } from "./screens-forms-layout-rules.js";
|
|
3
|
+
import { SCREEN_KIND_RULES } from "./screens-kind-rules.js";
|
|
4
4
|
import { qualifyEntityName } from "../qualified-name.js";
|
|
5
5
|
import { isWriteFormEditSection } from "../screen-helpers.js";
|
|
6
6
|
import { isRowClickAction, validateActionHasIcon, validateNavigateActionTab, validateRecordActionRedirect, } from "./screens-actions.js";
|
|
@@ -44,20 +44,26 @@ export function resolveScreenEntity(ctx, screenId, entityName) {
|
|
|
44
44
|
const hint = crossFeature
|
|
45
45
|
? ` Entity "${entityName}" is owned by feature "${crossFeature}" — cross-feature screen ownership is not supported.`
|
|
46
46
|
: "";
|
|
47
|
-
throw
|
|
48
|
-
`
|
|
47
|
+
throw bootRuleError(SCREEN_KIND_RULES.entityNotDeclared, {
|
|
48
|
+
message: `[Feature ${ctx.feature.name}] Screen "${screenId}" references entity "${entityName}" ` +
|
|
49
|
+
`which is not declared in this feature (known: ${known}).${hint}`,
|
|
50
|
+
});
|
|
49
51
|
}
|
|
50
52
|
export function rejectMissingQuery(featureName, screenId, kind, query) {
|
|
51
53
|
if (!query || typeof query !== "string") {
|
|
52
|
-
throw
|
|
54
|
+
throw bootRuleError(SCREEN_KIND_RULES.queryEmpty, {
|
|
55
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) has empty or non-string query. Set query to a registered query name.`,
|
|
56
|
+
});
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
// An empty column list would render a blank table: almost always an
|
|
56
60
|
// in-progress screen the author forgot to fill in.
|
|
57
61
|
export function rejectEmptyColumns(featureName, screenId, kind, columnCount) {
|
|
58
62
|
if (columnCount === 0) {
|
|
59
|
-
throw
|
|
60
|
-
`
|
|
63
|
+
throw bootRuleError(SCREEN_KIND_RULES.columnsEmpty, {
|
|
64
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) has an empty columns list — ` +
|
|
65
|
+
`declare at least one column.`,
|
|
66
|
+
});
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
export function validateListColumnRendering(ctx, screenId, kind, column) {
|
|
@@ -70,35 +76,45 @@ export function validateListColumnRendering(ctx, screenId, kind, column) {
|
|
|
70
76
|
}
|
|
71
77
|
export function rejectNonArrayInFilter(featureName, screenId, kind, filter) {
|
|
72
78
|
if (filter.op === "in" && !Array.isArray(filter.value)) {
|
|
73
|
-
throw
|
|
74
|
-
`
|
|
79
|
+
throw bootRuleError(SCREEN_KIND_RULES.filterInNeedsArray, {
|
|
80
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) filter.op "in" requires ` +
|
|
81
|
+
`filter.value to be a readonly array. Pass an array as filter.value.`,
|
|
82
|
+
});
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
// A layout with zero sections renders as nothing: reject at boot so the
|
|
78
86
|
// author sees it before the blank form surprises them.
|
|
79
87
|
export function rejectEmptySections(featureName, screenId, kind, sectionCount) {
|
|
80
88
|
if (sectionCount === 0) {
|
|
81
|
-
throw
|
|
82
|
-
`
|
|
89
|
+
throw bootRuleError(FORM_LAYOUT_RULES.sectionsEmpty, {
|
|
90
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) has an empty sections list — ` +
|
|
91
|
+
`declare at least one section.`,
|
|
92
|
+
});
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
export function assertExtensionSectionHasComponent(featureName, screenId, kind, section) {
|
|
86
96
|
if (section.component?.react === undefined && section.component?.native === undefined) {
|
|
87
|
-
throw
|
|
88
|
-
`"${
|
|
97
|
+
throw bootRuleError(FORM_LAYOUT_RULES.extensionSectionNoComponent, {
|
|
98
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) extension section ` +
|
|
99
|
+
`"${section.title}" has no component — declare a react/native component marker.`,
|
|
100
|
+
});
|
|
89
101
|
}
|
|
90
102
|
}
|
|
91
103
|
// relatedList and writeForm sections exist on projectionDetail only; what
|
|
92
104
|
// remains afterwards is a plain fields/groups section.
|
|
93
105
|
export function rejectProjectionDetailOnlySection(featureName, screenId, kind, section) {
|
|
94
106
|
if (section.kind === "relatedList") {
|
|
95
|
-
throw
|
|
96
|
-
`"${
|
|
97
|
-
|
|
107
|
+
throw bootRuleError(FORM_LAYOUT_RULES.relatedListSectionUnsupported, {
|
|
108
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) relatedList section ` +
|
|
109
|
+
`"${section.title}" is not supported — relatedList is a projectionDetail-only ` +
|
|
110
|
+
`primitive (fw#2166). Move the section to a projectionDetail screen or remove it.`,
|
|
111
|
+
});
|
|
98
112
|
}
|
|
99
113
|
if (isWriteFormEditSection(section)) {
|
|
100
|
-
throw
|
|
101
|
-
`"${
|
|
114
|
+
throw bootRuleError(FORM_LAYOUT_RULES.writeFormSectionUnsupported, {
|
|
115
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${kind}) writeForm section ` +
|
|
116
|
+
`"${section.title}" is not supported — writeForm is a projectionDetail-only primitive. Move the section to a projectionDetail screen or remove it.`,
|
|
117
|
+
});
|
|
102
118
|
}
|
|
103
119
|
}
|
|
104
120
|
export function editSectionLabel(section) {
|
|
@@ -123,9 +139,11 @@ export function validateRecordHeaderAction(ctx, screenId, kind, screenEntity, ac
|
|
|
123
139
|
const featureName = ctx.feature.name;
|
|
124
140
|
validateRecordActionRedirect(ctx.feature, screenId, kind, action, ctx);
|
|
125
141
|
if (isRowClickAction(action)) {
|
|
126
|
-
throw
|
|
127
|
-
`
|
|
128
|
-
|
|
142
|
+
throw bootRuleError(SCREEN_KIND_RULES.headerActionRowClick, {
|
|
143
|
+
message: `[Feature ${featureName}] Screen "${qualifyEntityName(featureName, "screen", screenId)}" ` +
|
|
144
|
+
`(${kind}) action "${action.id}" sets rowClick: true — there is no row to ` +
|
|
145
|
+
`click on ${NO_ROW_SUBJECT[kind]}. Remove rowClick.`,
|
|
146
|
+
});
|
|
129
147
|
}
|
|
130
148
|
validateRowActionTarget(listActionContext(ctx, screenId, kind, screenEntity, `Screen "${screenId}" (${kind})`), "action", "rowAction", action);
|
|
131
149
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const LIST_SCREEN_RULES: {
|
|
2
|
+
readonly listScreenIdUnresolved: {
|
|
3
|
+
readonly id: "list/screen-id-unresolved";
|
|
4
|
+
readonly summary: "listScreenId names a mounted screen.";
|
|
5
|
+
readonly fix: "Fix the listScreenId or mount the list screen.";
|
|
6
|
+
};
|
|
7
|
+
readonly screenNoNavEntry: {
|
|
8
|
+
readonly id: "list/screen-unreachable";
|
|
9
|
+
readonly summary: "A screen without a nav entry has a resolvable list, or is marked dormant.";
|
|
10
|
+
readonly fix: "Declare listScreenId, add a standalone r.nav() pointing at it, or set dormant: true.";
|
|
11
|
+
};
|
|
12
|
+
readonly relatedReadOnlyWithRowInteraction: {
|
|
13
|
+
readonly id: "list/related-read-only-with-row-interaction";
|
|
14
|
+
readonly summary: "A readOnly relatedList section declares no rowClick or rowActions.";
|
|
15
|
+
readonly fix: "Remove readOnly or the row interaction.";
|
|
16
|
+
};
|
|
17
|
+
readonly relatedRowClickNoDetail: {
|
|
18
|
+
readonly id: "list/related-row-click-no-detail";
|
|
19
|
+
readonly summary: "A relatedList rowClick entity target has a screen declaring detailFor for it.";
|
|
20
|
+
readonly fix: "Add detailFor to the screen that shows the entity.";
|
|
21
|
+
};
|
|
22
|
+
readonly emptyStateActionParams: {
|
|
23
|
+
readonly id: "list/empty-state-action-params";
|
|
24
|
+
readonly summary: "Empty-state actions set no params, because an empty list has no row to read them from.";
|
|
25
|
+
readonly fix: "Remove the params.";
|
|
26
|
+
};
|
|
27
|
+
readonly relatedToolbarVisibleWhen: {
|
|
28
|
+
readonly id: "list/related-toolbar-visible-when";
|
|
29
|
+
readonly summary: "relatedList toolbarActions use visible instead of visibleWhen.";
|
|
30
|
+
readonly fix: "Use visible, a condition on the enclosing record.";
|
|
31
|
+
};
|
|
32
|
+
readonly columnSortableInert: {
|
|
33
|
+
readonly id: "list/column-sortable-inert";
|
|
34
|
+
readonly summary: "A column only sets sortable where the screen type honors it.";
|
|
35
|
+
readonly fix: "Remove sortable from the column.";
|
|
36
|
+
};
|
|
37
|
+
readonly columnRendererReactNotObject: {
|
|
38
|
+
readonly id: "list/column-renderer-react-not-object";
|
|
39
|
+
readonly summary: "A column renderer's react branch is an object.";
|
|
40
|
+
readonly fix: 'Use { react: { __component: "Name" } }.';
|
|
41
|
+
};
|
|
42
|
+
readonly columnRendererComponentInvalid: {
|
|
43
|
+
readonly id: "list/column-renderer-component-invalid";
|
|
44
|
+
readonly summary: "A column renderer's react.__component is a non-empty string.";
|
|
45
|
+
readonly fix: "Set react.__component to the name of a client columnRenderers entry.";
|
|
46
|
+
};
|
|
47
|
+
readonly enumOptionTonesInvalid: {
|
|
48
|
+
readonly id: "list/enum-option-tones-invalid";
|
|
49
|
+
readonly summary: "enumOption column tones are known select option tones.";
|
|
50
|
+
readonly fix: "Use only the allowed tones (SELECT_OPTION_TONES).";
|
|
51
|
+
};
|
|
52
|
+
readonly refTargetFeatureNotMounted: {
|
|
53
|
+
readonly id: "list/ref-target-feature-not-mounted";
|
|
54
|
+
readonly summary: "An entity reference target belongs to a mounted feature.";
|
|
55
|
+
readonly fix: "Mount the feature and declare it in r.requires({ features }).";
|
|
56
|
+
};
|
|
57
|
+
readonly refTargetEntityUnknown: {
|
|
58
|
+
readonly id: "list/ref-target-entity-unknown";
|
|
59
|
+
readonly summary: "An entity reference target resolves to a registered entity.";
|
|
60
|
+
readonly fix: "Name an entity the target feature registers.";
|
|
61
|
+
};
|
|
62
|
+
readonly facetDuplicate: {
|
|
63
|
+
readonly id: "list/facet-duplicate";
|
|
64
|
+
readonly summary: "Each facet field is declared once.";
|
|
65
|
+
readonly fix: "Declare each facet field once.";
|
|
66
|
+
};
|
|
67
|
+
readonly facetUnknownColumn: {
|
|
68
|
+
readonly id: "list/facet-unknown-column";
|
|
69
|
+
readonly summary: "A non-reference facet names a declared column.";
|
|
70
|
+
readonly fix: "Name a declared column or add the column.";
|
|
71
|
+
};
|
|
72
|
+
readonly facetSelectNoOptions: {
|
|
73
|
+
readonly id: "list/facet-select-no-options";
|
|
74
|
+
readonly summary: "A select facet declares at least one option.";
|
|
75
|
+
readonly fix: "Declare at least one option.";
|
|
76
|
+
};
|
|
77
|
+
readonly facetQueryUnregistered: {
|
|
78
|
+
readonly id: "list/facet-query-unregistered";
|
|
79
|
+
readonly summary: "A reference facet loads its options from a registered query handler.";
|
|
80
|
+
readonly fix: "Register the entity's list handler (defineEntityListHandler).";
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const LIST_SCREEN_RULES = {
|
|
2
|
+
listScreenIdUnresolved: {
|
|
3
|
+
id: "list/screen-id-unresolved",
|
|
4
|
+
summary: "listScreenId names a mounted screen.",
|
|
5
|
+
fix: "Fix the listScreenId or mount the list screen.",
|
|
6
|
+
},
|
|
7
|
+
screenNoNavEntry: {
|
|
8
|
+
id: "list/screen-unreachable",
|
|
9
|
+
summary: "A screen without a nav entry has a resolvable list, or is marked dormant.",
|
|
10
|
+
fix: "Declare listScreenId, add a standalone r.nav() pointing at it, or set dormant: true.",
|
|
11
|
+
},
|
|
12
|
+
relatedReadOnlyWithRowInteraction: {
|
|
13
|
+
id: "list/related-read-only-with-row-interaction",
|
|
14
|
+
summary: "A readOnly relatedList section declares no rowClick or rowActions.",
|
|
15
|
+
fix: "Remove readOnly or the row interaction.",
|
|
16
|
+
},
|
|
17
|
+
relatedRowClickNoDetail: {
|
|
18
|
+
id: "list/related-row-click-no-detail",
|
|
19
|
+
summary: "A relatedList rowClick entity target has a screen declaring detailFor for it.",
|
|
20
|
+
fix: "Add detailFor to the screen that shows the entity.",
|
|
21
|
+
},
|
|
22
|
+
emptyStateActionParams: {
|
|
23
|
+
id: "list/empty-state-action-params",
|
|
24
|
+
summary: "Empty-state actions set no params, because an empty list has no row to read them from.",
|
|
25
|
+
fix: "Remove the params.",
|
|
26
|
+
},
|
|
27
|
+
relatedToolbarVisibleWhen: {
|
|
28
|
+
id: "list/related-toolbar-visible-when",
|
|
29
|
+
summary: "relatedList toolbarActions use visible instead of visibleWhen.",
|
|
30
|
+
fix: "Use visible, a condition on the enclosing record.",
|
|
31
|
+
},
|
|
32
|
+
columnSortableInert: {
|
|
33
|
+
id: "list/column-sortable-inert",
|
|
34
|
+
summary: "A column only sets sortable where the screen type honors it.",
|
|
35
|
+
fix: "Remove sortable from the column.",
|
|
36
|
+
},
|
|
37
|
+
columnRendererReactNotObject: {
|
|
38
|
+
id: "list/column-renderer-react-not-object",
|
|
39
|
+
summary: "A column renderer's react branch is an object.",
|
|
40
|
+
fix: 'Use { react: { __component: "Name" } }.',
|
|
41
|
+
},
|
|
42
|
+
columnRendererComponentInvalid: {
|
|
43
|
+
id: "list/column-renderer-component-invalid",
|
|
44
|
+
summary: "A column renderer's react.__component is a non-empty string.",
|
|
45
|
+
fix: "Set react.__component to the name of a client columnRenderers entry.",
|
|
46
|
+
},
|
|
47
|
+
enumOptionTonesInvalid: {
|
|
48
|
+
id: "list/enum-option-tones-invalid",
|
|
49
|
+
summary: "enumOption column tones are known select option tones.",
|
|
50
|
+
fix: "Use only the allowed tones (SELECT_OPTION_TONES).",
|
|
51
|
+
},
|
|
52
|
+
refTargetFeatureNotMounted: {
|
|
53
|
+
id: "list/ref-target-feature-not-mounted",
|
|
54
|
+
summary: "An entity reference target belongs to a mounted feature.",
|
|
55
|
+
fix: "Mount the feature and declare it in r.requires({ features }).",
|
|
56
|
+
},
|
|
57
|
+
refTargetEntityUnknown: {
|
|
58
|
+
id: "list/ref-target-entity-unknown",
|
|
59
|
+
summary: "An entity reference target resolves to a registered entity.",
|
|
60
|
+
fix: "Name an entity the target feature registers.",
|
|
61
|
+
},
|
|
62
|
+
facetDuplicate: {
|
|
63
|
+
id: "list/facet-duplicate",
|
|
64
|
+
summary: "Each facet field is declared once.",
|
|
65
|
+
fix: "Declare each facet field once.",
|
|
66
|
+
},
|
|
67
|
+
facetUnknownColumn: {
|
|
68
|
+
id: "list/facet-unknown-column",
|
|
69
|
+
summary: "A non-reference facet names a declared column.",
|
|
70
|
+
fix: "Name a declared column or add the column.",
|
|
71
|
+
},
|
|
72
|
+
facetSelectNoOptions: {
|
|
73
|
+
id: "list/facet-select-no-options",
|
|
74
|
+
summary: "A select facet declares at least one option.",
|
|
75
|
+
fix: "Declare at least one option.",
|
|
76
|
+
},
|
|
77
|
+
facetQueryUnregistered: {
|
|
78
|
+
id: "list/facet-query-unregistered",
|
|
79
|
+
summary: "A reference facet loads its options from a registered query handler.",
|
|
80
|
+
fix: "Register the entity's list handler (defineEntityListHandler).",
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -4,10 +4,15 @@ import { REFERENCE_LOOKUP_SOURCES } from "../../ui-types/list-row-meta.js";
|
|
|
4
4
|
import { parseRefTarget } from "../parse-ref-target.js";
|
|
5
5
|
import { qualifyEntityName } from "../qualified-name.js";
|
|
6
6
|
import { explicitListScreenId, normalizeListColumn, resolveNavParentScreen, } from "../screen-helpers.js";
|
|
7
|
+
import { bootRuleError } from "./boot-rule.js";
|
|
8
|
+
import { ENTITY_LIST_RULES } from "./entity-list-screens-rules.js";
|
|
7
9
|
import { validateListBulkActions } from "./list-bulk-actions.js";
|
|
8
10
|
import { validateListTableOptions } from "./list-table-options.js";
|
|
9
11
|
import { validateRelatedListGroupingRules } from "./related-list-table-rules.js";
|
|
10
12
|
import { assertWriteHandlerRegistered, isRowClickAction, rejectRedirectOnListRowAction, resolveRowActionNavigateTarget, validateClientActionName, validateDrawerTargetAction, validateRowActionNavigateParams, } from "./screens-actions.js";
|
|
13
|
+
import { SCREEN_ACTION_RULES } from "./screens-actions-rules.js";
|
|
14
|
+
import { SCREEN_KIND_RULES } from "./screens-kind-rules.js";
|
|
15
|
+
import { LIST_SCREEN_RULES } from "./screens-lists-rules.js";
|
|
11
16
|
import { isSelectOptionTone } from "./select-option-tone.js";
|
|
12
17
|
// validateScreenHasNavArea runs once per screen; the index is built once per
|
|
13
18
|
// featureMap (immutable during boot) instead of re-scanning every feature each call.
|
|
@@ -45,8 +50,10 @@ export function validateExplicitListScreenExists(featureName, screenId, screen,
|
|
|
45
50
|
// skip: the explicit listScreenId resolves to a mounted screen
|
|
46
51
|
if (screensByShortId.has(shortId))
|
|
47
52
|
return;
|
|
48
|
-
throw
|
|
49
|
-
`
|
|
53
|
+
throw bootRuleError(LIST_SCREEN_RULES.listScreenIdUnresolved, {
|
|
54
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${screen.type}) listScreenId "${listScreenId}" ` +
|
|
55
|
+
`matches no mounted screen — fix the id or mount the list screen.`,
|
|
56
|
+
});
|
|
50
57
|
}
|
|
51
58
|
// Every screen must resolve nav via `nav`, `r.nav()`, a parent list, or
|
|
52
59
|
// `dormant: true`. Skipped when the composed set has no nav entries at all.
|
|
@@ -69,10 +76,12 @@ export function validateScreenHasNavArea(feature, screenId, screen, featureMap)
|
|
|
69
76
|
// skip: resolves to a parent list via listScreenId/rowAction-target/same-entity.
|
|
70
77
|
if (resolveNavParentScreen(allScreens, screen, (s) => s.id) !== undefined)
|
|
71
78
|
return;
|
|
72
|
-
throw
|
|
73
|
-
`
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
throw bootRuleError(LIST_SCREEN_RULES.screenNoNavEntry, {
|
|
80
|
+
message: `[Feature ${feature.name}] Screen "${targetQn}" has no nav entry and no resolvable list — ` +
|
|
81
|
+
`declare listScreenId (or a rowAction/toolbarAction navigate target from a list screen), add ` +
|
|
82
|
+
`a standalone r.nav() pointing at it, or set dormant: true if it's intentionally reachable ` +
|
|
83
|
+
`only via a direct link/redirect or a consuming app's own r.nav().`,
|
|
84
|
+
});
|
|
76
85
|
}
|
|
77
86
|
// Shared by projectionDetail relatedList sections and entityList.expandableRow:
|
|
78
87
|
// both render a relatedList whose rows come from an arbitrary query.
|
|
@@ -88,13 +97,17 @@ function assertReadOnlyHasNoRowInteraction(args) {
|
|
|
88
97
|
const { section } = args;
|
|
89
98
|
const interactive = section.rowClick !== undefined || (section.rowActions?.length ?? 0) > 0;
|
|
90
99
|
if (section.readOnly === true && interactive) {
|
|
91
|
-
throw
|
|
100
|
+
throw bootRuleError(LIST_SCREEN_RULES.relatedReadOnlyWithRowInteraction, {
|
|
101
|
+
message: `[Feature ${args.featureName}] ${args.where} is readOnly but declares rowClick/rowActions. Remove readOnly or the row interaction.`,
|
|
102
|
+
});
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
105
|
export function validateRelatedListSection(args) {
|
|
95
106
|
const { featureName, featureMap, where, section } = args;
|
|
96
107
|
if (!section.query || typeof section.query !== "string") {
|
|
97
|
-
throw
|
|
108
|
+
throw bootRuleError(SCREEN_KIND_RULES.queryEmpty, {
|
|
109
|
+
message: `[Feature ${featureName}] ${where} has empty or non-string query. Set query to a registered query name.`,
|
|
110
|
+
});
|
|
98
111
|
}
|
|
99
112
|
assertReadOnlyHasNoRowInteraction(args);
|
|
100
113
|
if (section.entity !== undefined) {
|
|
@@ -111,9 +124,11 @@ export function validateRelatedListSection(args) {
|
|
|
111
124
|
const targetEntity = section.rowClick.entity;
|
|
112
125
|
const hasDetailScreen = [...featureMap.values()].some((f) => Object.values(f.screens).some((s) => s.detailFor === targetEntity));
|
|
113
126
|
if (!hasDetailScreen) {
|
|
114
|
-
throw
|
|
115
|
-
`
|
|
116
|
-
|
|
127
|
+
throw bootRuleError(LIST_SCREEN_RULES.relatedRowClickNoDetail, {
|
|
128
|
+
message: `[Feature ${featureName}] ${where} ` +
|
|
129
|
+
`rowClick targets entity "${targetEntity}", but no screen declares ` +
|
|
130
|
+
`detailFor: "${targetEntity}". Add detailFor: "${targetEntity}" to the screen that shows it.`,
|
|
131
|
+
});
|
|
117
132
|
}
|
|
118
133
|
}
|
|
119
134
|
validateRelatedListTableAndBulk(args);
|
|
@@ -130,8 +145,10 @@ export function validateRelatedListSection(args) {
|
|
|
130
145
|
function rejectEmptyStateActionParams(ctx, actionLabel, action) {
|
|
131
146
|
const params = action.kind === "navigate" || action.kind === "drawer" ? action.params : undefined;
|
|
132
147
|
if (params !== undefined) {
|
|
133
|
-
throw
|
|
134
|
-
`
|
|
148
|
+
throw bootRuleError(LIST_SCREEN_RULES.emptyStateActionParams, {
|
|
149
|
+
message: `[Feature ${ctx.featureName}] ${ctx.where} ${actionLabel} "${action.id}" sets params — an empty list ` +
|
|
150
|
+
`has no row to read them from, so they would resolve against an empty record. Remove the params.`,
|
|
151
|
+
});
|
|
135
152
|
}
|
|
136
153
|
}
|
|
137
154
|
// Target checks shared by list/related-list rowActions and emptyState.action:
|
|
@@ -185,9 +202,11 @@ function validateRelatedListRowActions(args, rowActions) {
|
|
|
185
202
|
const rowClickActionCount = rowActions.filter(isRowClickAction).length;
|
|
186
203
|
const legacyRowClickCount = section.rowClick !== undefined ? 1 : 0;
|
|
187
204
|
if (rowClickActionCount + legacyRowClickCount > 1) {
|
|
188
|
-
throw
|
|
189
|
-
`
|
|
190
|
-
|
|
205
|
+
throw bootRuleError(SCREEN_ACTION_RULES.rowClickAtMostOne, {
|
|
206
|
+
message: `[Feature ${featureName}] ${where} ` +
|
|
207
|
+
`has both a rowClick and ${rowClickActionCount} rowActions marked ` +
|
|
208
|
+
`rowClick:true — at most one may fire on a row-body click.`,
|
|
209
|
+
});
|
|
191
210
|
}
|
|
192
211
|
}
|
|
193
212
|
function validateRelatedListDefaultSort(args, defaultSort) {
|
|
@@ -195,13 +214,17 @@ function validateRelatedListDefaultSort(args, defaultSort) {
|
|
|
195
214
|
const sortField = defaultSort.field;
|
|
196
215
|
const col = section.columns.find((c) => normalizeListColumn(c).field === sortField);
|
|
197
216
|
if (col === undefined) {
|
|
198
|
-
throw
|
|
199
|
-
`
|
|
217
|
+
throw bootRuleError(ENTITY_LIST_RULES.defaultSortNotListed, {
|
|
218
|
+
message: `[Feature ${featureName}] ${where} ` +
|
|
219
|
+
`defaultSort.field "${sortField}" is not a listed column. Use a listed column as defaultSort.field.`,
|
|
220
|
+
});
|
|
200
221
|
}
|
|
201
222
|
if (normalizeListColumn(col).sortable !== true) {
|
|
202
|
-
throw
|
|
203
|
-
`
|
|
204
|
-
|
|
223
|
+
throw bootRuleError(ENTITY_LIST_RULES.defaultSortNotSortable, {
|
|
224
|
+
message: `[Feature ${featureName}] ${where} ` +
|
|
225
|
+
`defaultSort.field "${sortField}" is not sortable. Set sortable: true on ` +
|
|
226
|
+
`the column or pick another field.`,
|
|
227
|
+
});
|
|
205
228
|
}
|
|
206
229
|
}
|
|
207
230
|
// Only drawer-kind and navigate actions that set tab are validated here;
|
|
@@ -210,7 +233,9 @@ function validateRelatedListToolbarActions(args, toolbarActions) {
|
|
|
210
233
|
const { featureName, screenId, screenType, screens, allScreenQns, navTargetShortIds, screensByShortId, detailForScreens, } = args;
|
|
211
234
|
for (const action of toolbarActions) {
|
|
212
235
|
if (action.visibleWhen !== undefined) {
|
|
213
|
-
throw
|
|
236
|
+
throw bootRuleError(LIST_SCREEN_RULES.relatedToolbarVisibleWhen, {
|
|
237
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${screenType}) relatedList toolbarAction "${action.id}" sets visibleWhen, which only list-screen toolbars support. Use visible (a condition on the enclosing record) instead.`,
|
|
238
|
+
});
|
|
214
239
|
}
|
|
215
240
|
if (action.kind === "drawer") {
|
|
216
241
|
validateDrawerTargetAction(featureName, screenId, screenType, "toolbarAction", action, screens);
|
|
@@ -231,8 +256,10 @@ export function rejectInertColumnSortable(featureName, screenId, screenType, col
|
|
|
231
256
|
const source = screenType === "entityList"
|
|
232
257
|
? "set sortable: true on the entity field instead"
|
|
233
258
|
: "sorting is derived from the query's Zod schema; only sortable: false is honored";
|
|
234
|
-
throw
|
|
235
|
-
`
|
|
259
|
+
throw bootRuleError(LIST_SCREEN_RULES.columnSortableInert, {
|
|
260
|
+
message: `[Feature ${featureName}] Screen "${screenId}" (${screenType}) column "${column.field}" sets sortable — ` +
|
|
261
|
+
`it is ignored here; ${source}. Remove sortable from this column.`,
|
|
262
|
+
});
|
|
236
263
|
}
|
|
237
264
|
// Form check for ListColumn renderers in the PlatformComponent form
|
|
238
265
|
// (`{ react: { __component: "Name" } }`). The server does not know the
|
|
@@ -255,8 +282,10 @@ export function validateColumnRendererForm(featureName, screenId, column) {
|
|
|
255
282
|
if (react === undefined || react === null)
|
|
256
283
|
return;
|
|
257
284
|
if (typeof react !== "object") {
|
|
258
|
-
throw
|
|
259
|
-
`
|
|
285
|
+
throw bootRuleError(LIST_SCREEN_RULES.columnRendererReactNotObject, {
|
|
286
|
+
message: `[Feature ${featureName}] Screen "${screenId}" column "${column.field}" has a renderer with ` +
|
|
287
|
+
`a non-object \`react\` branch — expected \`{ react: { __component: "Name" } }\`.`,
|
|
288
|
+
});
|
|
260
289
|
}
|
|
261
290
|
// @cast-boundary schema-walk — feature-config react-branch introspection
|
|
262
291
|
const component = react.__component;
|
|
@@ -265,9 +294,11 @@ export function validateColumnRendererForm(featureName, screenId, column) {
|
|
|
265
294
|
if (component === undefined)
|
|
266
295
|
return;
|
|
267
296
|
if (typeof component !== "string" || component.length === 0) {
|
|
268
|
-
throw
|
|
269
|
-
|
|
270
|
-
|
|
297
|
+
throw bootRuleError(LIST_SCREEN_RULES.columnRendererComponentInvalid, {
|
|
298
|
+
message: `[Feature ${featureName}] Screen "${screenId}" column "${column.field}" has a renderer with ` +
|
|
299
|
+
`\`react.__component\` = ${JSON.stringify(component)} — expected a non-empty string identifying ` +
|
|
300
|
+
`a client-side columnRenderers entry.`,
|
|
301
|
+
});
|
|
271
302
|
}
|
|
272
303
|
}
|
|
273
304
|
// A typo'd tone would silently fall back to the neutral pill.
|
|
@@ -286,8 +317,10 @@ export function validateEnumOptionTones(prefix, column) {
|
|
|
286
317
|
.filter((tone) => !isSelectOptionTone(tone))
|
|
287
318
|
.map(String);
|
|
288
319
|
if (invalid.length > 0) {
|
|
289
|
-
throw
|
|
290
|
-
|
|
320
|
+
throw bootRuleError(LIST_SCREEN_RULES.enumOptionTonesInvalid, {
|
|
321
|
+
message: `${prefix} column "${column.field}" has enumOption tones ${invalid.join(", ")} — ` +
|
|
322
|
+
`expected one of ${SELECT_OPTION_TONES.join(", ")}.`,
|
|
323
|
+
});
|
|
291
324
|
}
|
|
292
325
|
}
|
|
293
326
|
// Shared entity-target resolution for reference facets, refEntity columns
|
|
@@ -296,15 +329,19 @@ export function assertRefTargetRegistered(prefix, subject, refTarget, currentFea
|
|
|
296
329
|
const target = parseRefTarget(refTarget, currentFeatureName);
|
|
297
330
|
const targetFeature = featureMap.get(target.featureName);
|
|
298
331
|
if (targetFeature === undefined) {
|
|
299
|
-
throw
|
|
300
|
-
|
|
332
|
+
throw bootRuleError(LIST_SCREEN_RULES.refTargetFeatureNotMounted, {
|
|
333
|
+
message: `${prefix} ${subject} targets entity "${refTarget}", but feature "${target.featureName}" is not ` +
|
|
334
|
+
`mounted — mount it and declare r.requires({ features: ["${target.featureName}"] }).`,
|
|
335
|
+
});
|
|
301
336
|
}
|
|
302
337
|
if (targetFeature.entities?.[target.entityName] === undefined) {
|
|
303
|
-
throw
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
.
|
|
307
|
-
|
|
338
|
+
throw bootRuleError(LIST_SCREEN_RULES.refTargetEntityUnknown, {
|
|
339
|
+
message: `${prefix} ${subject} targets entity "${refTarget}", which does not resolve to a ` +
|
|
340
|
+
`registered entity. Known entities in feature "${target.featureName}": ` +
|
|
341
|
+
`${Object.keys(targetFeature.entities ?? {})
|
|
342
|
+
.sort()
|
|
343
|
+
.join(", ") || "(none)"}.`,
|
|
344
|
+
});
|
|
308
345
|
}
|
|
309
346
|
}
|
|
310
347
|
// Facets — unlike filter, a field inventory IS available here: the
|
|
@@ -329,16 +366,22 @@ export function validateListFacets(prefix, facets, columns, currentFeatureName,
|
|
|
329
366
|
const seenFacetFields = new Set();
|
|
330
367
|
for (const facet of facets) {
|
|
331
368
|
if (seenFacetFields.has(facet.field)) {
|
|
332
|
-
throw
|
|
369
|
+
throw bootRuleError(LIST_SCREEN_RULES.facetDuplicate, {
|
|
370
|
+
message: `${prefix} declares facet "${facet.field}" more than once. Declare each facet field once.`,
|
|
371
|
+
});
|
|
333
372
|
}
|
|
334
373
|
seenFacetFields.add(facet.field);
|
|
335
374
|
if (facet.type !== "reference" && !columnFieldNames.has(facet.field)) {
|
|
336
|
-
throw
|
|
337
|
-
|
|
375
|
+
throw bootRuleError(LIST_SCREEN_RULES.facetUnknownColumn, {
|
|
376
|
+
message: `${prefix} facet references field "${facet.field}" which is not a declared column. ` +
|
|
377
|
+
`Known columns: ${[...columnFieldNames].sort().join(", ")}`,
|
|
378
|
+
});
|
|
338
379
|
}
|
|
339
380
|
if (facet.type === "select" && facet.options.length === 0) {
|
|
340
|
-
throw
|
|
341
|
-
|
|
381
|
+
throw bootRuleError(LIST_SCREEN_RULES.facetSelectNoOptions, {
|
|
382
|
+
message: `${prefix} facet "${facet.field}" (type "select") has an empty options list — ` +
|
|
383
|
+
`declare at least one option.`,
|
|
384
|
+
});
|
|
342
385
|
}
|
|
343
386
|
if (facet.type === "reference") {
|
|
344
387
|
assertRefTargetRegistered(prefix, `facet "${facet.field}" (type "reference")`, facet.entity, currentFeatureName, featureMap);
|
|
@@ -362,6 +405,8 @@ function assertReferenceListHandlerRegistered(prefix, subject, refTarget, curren
|
|
|
362
405
|
return;
|
|
363
406
|
}
|
|
364
407
|
}
|
|
365
|
-
throw
|
|
366
|
-
|
|
408
|
+
throw bootRuleError(LIST_SCREEN_RULES.facetQueryUnregistered, {
|
|
409
|
+
message: `${prefix} ${subject} loads its options from query "${expectedQn}", which is not a registered ` +
|
|
410
|
+
`query handler — register the entity's list handler (defineEntityListHandler) or the facet renders an empty dropdown.`,
|
|
411
|
+
});
|
|
367
412
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const SCREEN_RULES: {
|
|
2
|
+
readonly customNoComponent: {
|
|
3
|
+
readonly id: "screen/custom-no-component";
|
|
4
|
+
readonly summary: "A custom screen renderer declares a react or native component.";
|
|
5
|
+
readonly fix: "Set react or native on the renderer.";
|
|
6
|
+
};
|
|
7
|
+
readonly unknownType: {
|
|
8
|
+
readonly id: "screen/unknown-type";
|
|
9
|
+
readonly summary: "A screen has a known type.";
|
|
10
|
+
readonly fix: "Use a supported screen type.";
|
|
11
|
+
};
|
|
12
|
+
readonly urlPrefillFieldsSet: {
|
|
13
|
+
readonly id: "screen/url-prefill-fields-set";
|
|
14
|
+
readonly summary: "Screens do not set urlPrefillFields; buildAppSchema derives it.";
|
|
15
|
+
readonly fix: "Declare params on the navigating action instead.";
|
|
16
|
+
};
|
|
17
|
+
readonly submitPrefilledUnsupported: {
|
|
18
|
+
readonly id: "screen/submit-prefilled-unsupported";
|
|
19
|
+
readonly summary: "Only actionForm and secretMint screens set submitPrefilled.";
|
|
20
|
+
readonly fix: "Remove submitPrefilled.";
|
|
21
|
+
};
|
|
22
|
+
readonly submitPrefilledHiddenRequired: {
|
|
23
|
+
readonly id: "screen/submit-prefilled-hidden-required";
|
|
24
|
+
readonly summary: "With submitPrefilled, a hidden required field is passed in by a navigate action's params.";
|
|
25
|
+
readonly fix: "Add the field to the params of a navigate action targeting the screen, make it visible, or drop required.";
|
|
26
|
+
};
|
|
27
|
+
readonly customWriteQnUnregistered: {
|
|
28
|
+
readonly id: "screen/custom-write-qn-unregistered";
|
|
29
|
+
readonly summary: "Every dispatcher.write QN in app source names a registered write handler.";
|
|
30
|
+
readonly fix: "Check the spelling against registered write handlers (<feature>:write:<handler>).";
|
|
31
|
+
};
|
|
32
|
+
readonly detailForDuplicate: {
|
|
33
|
+
readonly id: "screen/detail-for-duplicate";
|
|
34
|
+
readonly summary: "At most one screen declares detailFor for an entity.";
|
|
35
|
+
readonly fix: "Keep detailFor on one screen per entity.";
|
|
36
|
+
};
|
|
37
|
+
readonly detailForUnknownEntity: {
|
|
38
|
+
readonly id: "screen/detail-for-unknown-entity";
|
|
39
|
+
readonly summary: "detailFor names an entity a feature registers.";
|
|
40
|
+
readonly fix: "Set detailFor to a registered entity name or remove it.";
|
|
41
|
+
};
|
|
42
|
+
readonly actionFieldFunction: {
|
|
43
|
+
readonly id: "screen/action-field-function";
|
|
44
|
+
readonly summary: "Action payload, params, entityId and visible are declarative values, not functions.";
|
|
45
|
+
readonly fix: "Use the declarative DSL ({ pick }, { map }, field name, { field, eq }).";
|
|
46
|
+
};
|
|
47
|
+
readonly editFieldConditionFunction: {
|
|
48
|
+
readonly id: "screen/edit-field-condition-function";
|
|
49
|
+
readonly summary: "Edit field visible, readOnly and required are FieldConditions, not functions.";
|
|
50
|
+
readonly fix: "Use a FieldCondition (boolean or { field, eq/ne/in/notIn }).";
|
|
51
|
+
};
|
|
52
|
+
readonly rendererFunction: {
|
|
53
|
+
readonly id: "screen/renderer-function";
|
|
54
|
+
readonly summary: "Field and column renderers are FormatSpecs, not functions.";
|
|
55
|
+
readonly fix: 'Use a FormatSpec ({ format: "..." }).';
|
|
56
|
+
};
|
|
57
|
+
};
|