@cosmicdrift/kumiko-samples 0.411.0 → 0.413.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 (182) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +13 -13
  3. package/packages/bundled-features/src/admin-shell/feature.ts +1 -1
  4. package/packages/bundled-features/src/agent-tools/agent-doc-lint.ts +64 -3
  5. package/packages/bundled-features/src/agent-tools/agent-manifest.ts +13 -130
  6. package/packages/bundled-features/src/agent-tools/api-docs/anchors.ts +60 -0
  7. package/packages/bundled-features/src/agent-tools/api-docs/check.ts +25 -0
  8. package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +140 -0
  9. package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +175 -0
  10. package/packages/bundled-features/src/agent-tools/api-docs/curl.ts +28 -0
  11. package/packages/bundled-features/src/agent-tools/api-docs/error-table.ts +45 -0
  12. package/packages/bundled-features/src/agent-tools/api-docs/examples.ts +43 -0
  13. package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +179 -0
  14. package/packages/bundled-features/src/agent-tools/api-docs/index-json.ts +29 -0
  15. package/packages/bundled-features/src/agent-tools/api-docs/index.ts +21 -0
  16. package/packages/bundled-features/src/agent-tools/api-docs/list-parameters.ts +38 -0
  17. package/packages/bundled-features/src/agent-tools/api-docs/markdown.ts +70 -0
  18. package/packages/bundled-features/src/agent-tools/api-docs/menu-path.ts +82 -0
  19. package/packages/bundled-features/src/agent-tools/api-docs/model.ts +83 -0
  20. package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +58 -0
  21. package/packages/bundled-features/src/agent-tools/api-docs/render-events.ts +76 -0
  22. package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +216 -0
  23. package/packages/bundled-features/src/agent-tools/api-docs/render-overview.ts +86 -0
  24. package/packages/bundled-features/src/agent-tools/api-docs/render-reference.ts +79 -0
  25. package/packages/bundled-features/src/agent-tools/api-docs/render-tokens.ts +136 -0
  26. package/packages/bundled-features/src/agent-tools/api-docs/schema-fields.ts +167 -0
  27. package/packages/bundled-features/src/agent-tools/api-docs/section-ids.ts +28 -0
  28. package/packages/bundled-features/src/agent-tools/api-docs/system-only.ts +11 -0
  29. package/packages/bundled-features/src/agent-tools/api-docs/texts/de.ts +166 -0
  30. package/packages/bundled-features/src/agent-tools/api-docs/texts/en.ts +159 -0
  31. package/packages/bundled-features/src/agent-tools/api-docs/texts/es.ts +162 -0
  32. package/packages/bundled-features/src/agent-tools/api-docs/texts/fr.ts +169 -0
  33. package/packages/bundled-features/src/agent-tools/api-docs/texts/index.ts +67 -0
  34. package/packages/bundled-features/src/agent-tools/api-docs/texts/it.ts +165 -0
  35. package/packages/bundled-features/src/agent-tools/api-docs/texts/types.ts +130 -0
  36. package/packages/bundled-features/src/agent-tools/api-docs/ui-writes.ts +81 -0
  37. package/packages/bundled-features/src/agent-tools/changes.json +24 -0
  38. package/packages/bundled-features/src/agent-tools/handler-schema.ts +45 -0
  39. package/packages/bundled-features/src/agent-tools/index.ts +24 -0
  40. package/packages/bundled-features/src/agent-tools/labels.ts +181 -0
  41. package/packages/bundled-features/src/auth-email-password/boot-rules.ts +9 -0
  42. package/packages/bundled-features/src/auth-email-password/feature.ts +6 -19
  43. package/packages/bundled-features/src/auth-email-password/validate-options.ts +20 -0
  44. package/packages/bundled-features/src/billing-foundation/boot-rules.ts +26 -0
  45. package/packages/bundled-features/src/billing-foundation/validate-options.ts +59 -46
  46. package/packages/bundled-features/src/cap-overview/boot-rules.ts +14 -0
  47. package/packages/bundled-features/src/cap-overview/feature.ts +12 -5
  48. package/packages/bundled-features/src/documents/boot-rules.ts +14 -0
  49. package/packages/bundled-features/src/documents/feature.ts +8 -4
  50. package/packages/bundled-features/src/file-derivatives/boot-rules.ts +9 -0
  51. package/packages/bundled-features/src/file-derivatives/feature.ts +6 -3
  52. package/packages/bundled-features/src/folders/boot-rules.ts +9 -0
  53. package/packages/bundled-features/src/folders/feature.ts +6 -3
  54. package/packages/bundled-features/src/helpdesk/boot-rules.ts +9 -0
  55. package/packages/bundled-features/src/{contact → helpdesk}/challenge.ts +2 -2
  56. package/packages/bundled-features/src/{contact → helpdesk}/changes.json +6 -0
  57. package/packages/bundled-features/src/{contact/client/contact-client-source.ts → helpdesk/client/helpdesk-client-source.ts} +4 -4
  58. package/packages/bundled-features/src/helpdesk/client/helpdesk-website-client.ts +29 -0
  59. package/packages/bundled-features/src/helpdesk/client/index.ts +9 -0
  60. package/packages/bundled-features/src/{contact → helpdesk}/entity.ts +35 -31
  61. package/packages/bundled-features/src/{contact → helpdesk}/feature.ts +56 -52
  62. package/packages/bundled-features/src/{contact → helpdesk}/handlers/attempts.ts +3 -3
  63. package/packages/bundled-features/src/{contact → helpdesk}/handlers/challenge.query.ts +10 -10
  64. package/packages/bundled-features/src/{contact → helpdesk}/handlers/forward-request.write.ts +25 -23
  65. package/packages/bundled-features/src/{contact → helpdesk}/handlers/mark-done.write.ts +11 -11
  66. package/packages/bundled-features/src/{contact → helpdesk}/handlers/notify-reporter-in-app.write.ts +14 -14
  67. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.query.ts +4 -4
  68. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.ts +2 -2
  69. package/packages/bundled-features/src/{contact → helpdesk}/handlers/replies.query.ts +6 -6
  70. package/packages/bundled-features/src/{contact → helpdesk}/handlers/reply.write.ts +30 -30
  71. package/packages/bundled-features/src/{contact → helpdesk}/handlers/report.write.ts +29 -29
  72. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-delivery.query.ts +40 -40
  73. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-detail.query.ts +15 -15
  74. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-list.query.ts +2 -2
  75. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-reply-mail.write.ts +24 -24
  76. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-test.write.ts +18 -14
  77. package/packages/bundled-features/src/{contact → helpdesk}/handlers/submit.write.ts +32 -31
  78. package/packages/bundled-features/src/{contact → helpdesk}/handlers/take-over-uploads.ts +5 -5
  79. package/packages/bundled-features/src/{contact → helpdesk}/i18n.ts +78 -75
  80. package/packages/bundled-features/src/helpdesk/index.ts +29 -0
  81. package/packages/bundled-features/src/{contact → helpdesk}/lib.ts +32 -28
  82. package/packages/bundled-features/src/{contact → helpdesk}/mail.ts +56 -56
  83. package/packages/bundled-features/src/{contact → helpdesk}/options.ts +18 -16
  84. package/packages/bundled-features/src/helpdesk/panels.ts +28 -0
  85. package/packages/bundled-features/src/{contact → helpdesk}/payloads.ts +33 -33
  86. package/packages/bundled-features/src/{contact → helpdesk}/screens.ts +104 -104
  87. package/packages/bundled-features/src/{contact → helpdesk}/subject.ts +3 -3
  88. package/packages/bundled-features/src/{contact → helpdesk}/user-data-hooks.ts +17 -17
  89. package/packages/bundled-features/src/helpdesk/web/constants.ts +160 -0
  90. package/packages/bundled-features/src/helpdesk/web/index.ts +29 -0
  91. package/packages/bundled-features/src/host-routing/boot-rules.ts +27 -0
  92. package/packages/bundled-features/src/host-routing/validate-options.ts +36 -27
  93. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +6 -0
  94. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +99 -71
  95. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +2 -2
  96. package/packages/bundled-features/src/jobs/boot-rules.ts +9 -0
  97. package/packages/bundled-features/src/jobs/feature.ts +9 -4
  98. package/packages/bundled-features/src/legal-pages/boot-rules.ts +19 -0
  99. package/packages/bundled-features/src/legal-pages/feature.ts +6 -3
  100. package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +11 -5
  101. package/packages/bundled-features/src/metrics/boot-rules.ts +15 -0
  102. package/packages/bundled-features/src/metrics/validate.ts +8 -2
  103. package/packages/bundled-features/src/notes-history/boot-rules.ts +9 -0
  104. package/packages/bundled-features/src/notes-history/feature.ts +6 -3
  105. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +9 -0
  106. package/packages/bundled-features/src/personal-access-tokens/changes.json +6 -0
  107. package/packages/bundled-features/src/personal-access-tokens/feature.ts +5 -2
  108. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +7 -2
  109. package/packages/bundled-features/src/personal-access-tokens/i18n.ts +6 -1
  110. package/packages/bundled-features/src/personal-access-tokens/index.ts +37 -2
  111. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -0
  112. package/packages/bundled-features/src/personal-access-tokens/screens.ts +9 -1
  113. package/packages/bundled-features/src/personal-access-tokens/web/constants.ts +1 -0
  114. package/packages/bundled-features/src/personal-access-tokens/web/scopes.ts +14 -0
  115. package/packages/bundled-features/src/presence/boot-rules.ts +9 -0
  116. package/packages/bundled-features/src/presence/options.ts +5 -1
  117. package/packages/bundled-features/src/readiness/boot-rules.ts +14 -0
  118. package/packages/bundled-features/src/readiness/probe-boot-check.ts +8 -6
  119. package/packages/bundled-features/src/shared/assert-no-where-rule-in-ownership-write.ts +6 -4
  120. package/packages/bundled-features/src/shared/boot-rules.ts +9 -0
  121. package/packages/bundled-features/src/subscription-mollie/boot-rules.ts +19 -0
  122. package/packages/bundled-features/src/subscription-mollie/feature.ts +18 -10
  123. package/packages/bundled-features/src/tags/boot-rules.ts +9 -0
  124. package/packages/bundled-features/src/tags/feature.ts +6 -3
  125. package/packages/bundled-features/src/template-resolver/boot-rules.ts +19 -0
  126. package/packages/bundled-features/src/template-resolver/feature.ts +14 -10
  127. package/packages/bundled-features/src/tenant/boot-rules.ts +9 -0
  128. package/packages/bundled-features/src/tenant/feature.ts +5 -3
  129. package/samples/apps/marketing-demo/README.md +1 -1
  130. package/samples/apps/marketing-demo/playwright.config.ts +1 -1
  131. package/samples/apps/marketing-demo/src/app/client.tsx +3 -3
  132. package/samples/apps/marketing-demo/src/app/seed-data.ts +1 -1
  133. package/samples/apps/marketing-demo/src/app/seed.ts +4 -4
  134. package/samples/apps/marketing-demo/src/app/server.ts +3 -3
  135. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/feature.ts +15 -12
  136. package/samples/apps/marketing-demo/src/features/ticketing/i18n.ts +100 -0
  137. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/ticket.ts +4 -4
  138. package/samples/apps/marketing-demo/src/features/ticketing/web/index.ts +7 -0
  139. package/samples/apps/use-all-bundled/feature-manifest.json +67 -67
  140. package/samples/apps/use-all-bundled/kumiko/migrations/0064_helpdesk-rename.rebuild.json +4 -0
  141. package/samples/apps/use-all-bundled/package.json +1 -1
  142. package/samples/apps/use-all-bundled/src/app/client.tsx +1 -1
  143. package/samples/apps/use-all-bundled/src/app/screens-feature.ts +10 -10
  144. package/samples/apps/use-all-bundled/src/run-config.ts +6 -6
  145. package/samples/recipes/api-docs/README.md +52 -0
  146. package/samples/recipes/api-docs/api-docs/de/events.md +62 -0
  147. package/samples/recipes/api-docs/api-docs/de/overview.md +100 -0
  148. package/samples/recipes/api-docs/api-docs/de/reference/tickets.md +305 -0
  149. package/samples/recipes/api-docs/api-docs/de/tokens.md +66 -0
  150. package/samples/recipes/api-docs/api-docs/en/events.md +62 -0
  151. package/samples/recipes/api-docs/api-docs/en/overview.md +100 -0
  152. package/samples/recipes/api-docs/api-docs/en/reference/tickets.md +305 -0
  153. package/samples/recipes/api-docs/api-docs/en/tokens.md +66 -0
  154. package/samples/recipes/api-docs/api-docs/index.json +371 -0
  155. package/samples/recipes/api-docs/api-docs/openapi.json +982 -0
  156. package/samples/recipes/api-docs/api-examples/ticket-close.json +21 -0
  157. package/samples/recipes/api-docs/api-examples/ticket-create.json +42 -0
  158. package/samples/recipes/api-docs/api-examples/ticket-detail.json +28 -0
  159. package/samples/recipes/api-docs/api-examples/ticket-list.json +31 -0
  160. package/samples/recipes/api-docs/api-examples/ticket-update.json +54 -0
  161. package/samples/recipes/api-docs/api-examples/webhooks/ticket-closed.json +8 -0
  162. package/samples/recipes/api-docs/api-examples/webhooks/ticket-created.json +10 -0
  163. package/samples/recipes/api-docs/kumiko.config.ts +33 -0
  164. package/samples/recipes/api-docs/package.json +14 -0
  165. package/samples/recipes/api-docs/src/feature.ts +218 -0
  166. package/samples/recipes/api-docs/tsconfig.json +22 -0
  167. package/samples/recipes/golden-path/src/feature.ts +1 -1
  168. package/samples/recipes/{contact → helpdesk}/README.md +16 -16
  169. package/samples/recipes/{contact → helpdesk}/package.json +2 -2
  170. package/samples/recipes/{contact → helpdesk}/src/feature.ts +6 -6
  171. package/packages/bundled-features/src/contact/client/contact-website-client.ts +0 -29
  172. package/packages/bundled-features/src/contact/client/index.ts +0 -9
  173. package/packages/bundled-features/src/contact/index.ts +0 -29
  174. package/packages/bundled-features/src/contact/panels.ts +0 -28
  175. package/packages/bundled-features/src/contact/web/constants.ts +0 -160
  176. package/packages/bundled-features/src/contact/web/index.ts +0 -29
  177. package/samples/apps/marketing-demo/src/features/helpdesk/i18n.ts +0 -100
  178. package/samples/apps/marketing-demo/src/features/helpdesk/web/index.ts +0 -7
  179. /package/packages/bundled-features/src/{contact → helpdesk}/handlers/access.ts +0 -0
  180. /package/packages/bundled-features/src/{contact → helpdesk}/pow.ts +0 -0
  181. /package/packages/bundled-features/src/{contact → helpdesk}/user-agent.ts +0 -0
  182. /package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/index.ts +0 -0
@@ -0,0 +1,181 @@
1
+ import type { TranslationEntry, TranslationKeys } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { translationValueOtherText } from "@cosmicdrift/kumiko-framework/ui-types";
3
+
4
+ const FALLBACK_LOCALE = "en";
5
+
6
+ // localeCompare depends on the runtime locale and ICU punctuation rules; qualified
7
+ // names contain `:`, so compare by code point instead for deterministic ordering.
8
+ export function compareIds(a: string, b: string): number {
9
+ return a < b ? -1 : a > b ? 1 : 0;
10
+ }
11
+
12
+ /** Requested locale, then English, then the first remaining locale in code-point
13
+ * order; `undefined` when the entry has no text at all (the key is then omitted). */
14
+ export function pickLabel(
15
+ labels: Readonly<Record<string, string>>,
16
+ locale: string,
17
+ ): string | undefined {
18
+ const nonEmpty = (value: string | undefined): string | undefined =>
19
+ value !== undefined && value !== "" ? value : undefined;
20
+ const firstLocale = Object.keys(labels)
21
+ .sort(compareIds)
22
+ .find((key) => nonEmpty(labels[key]));
23
+ return (
24
+ nonEmpty(labels[locale]) ??
25
+ nonEmpty(labels[FALLBACK_LOCALE]) ??
26
+ (firstLocale !== undefined ? labels[firstLocale] : undefined)
27
+ );
28
+ }
29
+
30
+ /** The manifest surfaces one string per locale — a plural entry reads as its
31
+ * CLDR `other` form since the manifest has no `count` to select a category. */
32
+ export function entryAsLabels(entry: TranslationEntry): Readonly<Record<string, string>> {
33
+ return Object.fromEntries(
34
+ Object.entries(entry).map(([locale, value]) => [locale, translationValueOtherText(value)]),
35
+ );
36
+ }
37
+
38
+ const labelsIndexByTranslations = new WeakMap<TranslationKeys, Map<string, SuffixMatch>>();
39
+
40
+ type SuffixMatch = { readonly key: string; readonly labels: Readonly<Record<string, string>> };
41
+
42
+ /** Every tail starting at a key boundary (`:` or `.`, with and without the
43
+ * separator) maps to the first key that ends with it. */
44
+ function buildSuffixIndex(translations: TranslationKeys): Map<string, SuffixMatch> {
45
+ const index = new Map<string, SuffixMatch>();
46
+ for (const [key, entry] of Object.entries(translations)) {
47
+ const match: SuffixMatch = { key, labels: entryAsLabels(entry) };
48
+ const addTail = (start: number): void => {
49
+ const tail = key.slice(start);
50
+ if (!index.has(tail)) index.set(tail, match);
51
+ };
52
+ addTail(0);
53
+ for (let position = 0; position < key.length; position++) {
54
+ if (key[position] === ":" || key[position] === ".") {
55
+ addTail(position);
56
+ addTail(position + 1);
57
+ }
58
+ }
59
+ }
60
+ return index;
61
+ }
62
+
63
+ /** Translation keys carry a feature prefix the manifest can't reconstruct
64
+ * (`showcase:entity:item:field:title`), so match on the suffix instead. The
65
+ * suffix must start at a `:` or `.` boundary of the key. */
66
+ export function labelsForSuffix(
67
+ translations: TranslationKeys,
68
+ suffix: string,
69
+ ): Readonly<Record<string, string>> {
70
+ return suffixMatch(translations, suffix)?.labels ?? {};
71
+ }
72
+
73
+ function suffixMatch(translations: TranslationKeys, suffix: string): SuffixMatch | undefined {
74
+ let index = labelsIndexByTranslations.get(translations);
75
+ if (index === undefined) {
76
+ index = buildSuffixIndex(translations);
77
+ labelsIndexByTranslations.set(translations, index);
78
+ }
79
+ return index.get(suffix);
80
+ }
81
+
82
+ const LOCALE_PACKAGE_PREFIX = "locale-";
83
+
84
+ const localePackageKeysByTranslations = new WeakMap<TranslationKeys, Map<string, string[]>>();
85
+
86
+ /** Locale packages register their entries as `locale-<xx>:<key>`; map each `<key>` to
87
+ * the registered keys that carry it, in code-point order. */
88
+ function localePackageKeys(translations: TranslationKeys): Map<string, string[]> {
89
+ let index = localePackageKeysByTranslations.get(translations);
90
+ if (index === undefined) {
91
+ index = new Map<string, string[]>();
92
+ for (const key of Object.keys(translations).sort(compareIds)) {
93
+ if (!key.startsWith(LOCALE_PACKAGE_PREFIX)) continue;
94
+ const name = key.slice(key.indexOf(":") + 1);
95
+ index.set(name, [...(index.get(name) ?? []), key]);
96
+ }
97
+ localePackageKeysByTranslations.set(translations, index);
98
+ }
99
+ return index;
100
+ }
101
+
102
+ /** The labels of `fullKey` per locale, completed by locale packages that translate it
103
+ * under `locale-<xx>:<fullKey>` or, for `<feature>:<key>`, under `locale-<xx>:<key>`.
104
+ * The owner's text wins, then the locale packages in code-point order. */
105
+ export function localizedLabels(
106
+ translations: TranslationKeys,
107
+ fullKey: string,
108
+ ): Readonly<Record<string, string>> {
109
+ const plainKey = fullKey.includes(":") ? fullKey.slice(fullKey.indexOf(":") + 1) : undefined;
110
+ const packages = localePackageKeys(translations);
111
+ const keys = [
112
+ ...(translations[fullKey] === undefined ? [] : [fullKey]),
113
+ ...[
114
+ ...new Set([
115
+ ...(packages.get(fullKey) ?? []),
116
+ ...(plainKey ? (packages.get(plainKey) ?? []) : []),
117
+ ]),
118
+ ].sort(compareIds),
119
+ ];
120
+ const merged: Record<string, string> = {};
121
+ for (const key of keys) {
122
+ for (const [locale, label] of Object.entries(entryAsLabels(translations[key] ?? {}))) {
123
+ if (merged[locale] === undefined) merged[locale] = label;
124
+ }
125
+ }
126
+ return merged;
127
+ }
128
+
129
+ /** `labelsForSuffix` with the locale-package completion of `localizedLabels`: the owner
130
+ * key behind the suffix is preferred over a locale package key that ends the same way. */
131
+ export function localizedLabelsForSuffix(
132
+ translations: TranslationKeys,
133
+ suffix: string,
134
+ ): Readonly<Record<string, string>> {
135
+ const match = suffixMatch(translations, suffix);
136
+ if (match === undefined) return {};
137
+ const owner = Object.keys(translations).find(
138
+ (key) => !key.startsWith(LOCALE_PACKAGE_PREFIX) && key.endsWith(suffix),
139
+ );
140
+ return localizedLabels(translations, owner ?? match.key);
141
+ }
142
+
143
+ /** Entity field label per locale; `field` may be a dotted path, only its last segment names the field. */
144
+ export function entityFieldLabels(
145
+ translations: TranslationKeys,
146
+ entity: string,
147
+ field: string,
148
+ ): Readonly<Record<string, string>> {
149
+ return localizedLabelsForSuffix(
150
+ translations,
151
+ `:entity:${entity}:field:${field.slice(field.lastIndexOf(".") + 1)}`,
152
+ );
153
+ }
154
+
155
+ function lastSegmentOf(qualifiedId: string): string {
156
+ return qualifiedId.slice(qualifiedId.lastIndexOf(":") + 1);
157
+ }
158
+
159
+ /** Screen titles live under the qualified id or, for feature-local screens, under
160
+ * `screen:<shortId>.title`. */
161
+ export function screenTitleLabels(
162
+ translations: TranslationKeys,
163
+ screenId: string,
164
+ ): Readonly<Record<string, string>> {
165
+ return entryAsLabels(
166
+ translations[`${screenId}.title`] ??
167
+ translations[`screen:${lastSegmentOf(screenId)}.title`] ??
168
+ {},
169
+ );
170
+ }
171
+
172
+ /** `screenTitleLabels` completed by locale packages (see `localizedLabels`). */
173
+ export function localizedScreenTitleLabels(
174
+ translations: TranslationKeys,
175
+ screenId: string,
176
+ ): Readonly<Record<string, string>> {
177
+ const own = localizedLabels(translations, `${screenId}.title`);
178
+ return Object.keys(own).length > 0
179
+ ? own
180
+ : localizedLabels(translations, `screen:${lastSegmentOf(screenId)}.title`);
181
+ }
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const AUTH_EMAIL_PASSWORD_BOOT_RULES = {
4
+ hmacSecretTooShort: {
5
+ id: "auth-email-password/hmac-secret-too-short",
6
+ summary: "Each configured token hmacSecret is at least the minimum length.",
7
+ fix: "Pass an hmacSecret of at least the minimum length.",
8
+ },
9
+ } as const satisfies BootRuleTable;
@@ -37,7 +37,7 @@ import {
37
37
  INVITE_MAIL_VARIABLES,
38
38
  sendsMagicLinkMail,
39
39
  } from "./mail-notifications.ts";
40
- import { MIN_HMAC_SECRET_LENGTH } from "./web/constants.ts";
40
+ import { assertSignedTokenSecretsLongEnough } from "./validate-options.ts";
41
41
  import { AUTH_EMAIL_PASSWORD_MAIL_I18N } from "./web/mail-i18n.ts";
42
42
 
43
43
  /**
@@ -154,24 +154,11 @@ export type AuthEmailPasswordOptions = {
154
154
  export function createAuthEmailPasswordFeature(
155
155
  opts: AuthEmailPasswordOptions = {},
156
156
  ): FeatureWithEnvSchema<FeatureDefinition, typeof authEmailPasswordEnvSchema.shape> {
157
- // ≥32 chars, symmetric to the JWT_SECRET env check: a short HMAC secret
158
- // makes reset/verify tokens forgeable — that's account takeover, so the
159
- // factory fails fast instead of trusting the caller.
160
- if (opts.passwordReset && opts.passwordReset.hmacSecret.length < MIN_HMAC_SECRET_LENGTH) {
161
- throw new Error(
162
- `[auth-email-password] passwordReset.hmacSecret must be ≥${MIN_HMAC_SECRET_LENGTH} chars (HMAC-SHA256 token signing)`,
163
- );
164
- }
165
- if (opts.emailVerification && opts.emailVerification.hmacSecret.length < MIN_HMAC_SECRET_LENGTH) {
166
- throw new Error(
167
- `[auth-email-password] emailVerification.hmacSecret must be ≥${MIN_HMAC_SECRET_LENGTH} chars (HMAC-SHA256 token signing)`,
168
- );
169
- }
170
- if (opts.accountUnlock && opts.accountUnlock.hmacSecret.length < MIN_HMAC_SECRET_LENGTH) {
171
- throw new Error(
172
- `[auth-email-password] accountUnlock.hmacSecret must be ≥${MIN_HMAC_SECRET_LENGTH} chars (HMAC-SHA256 token signing)`,
173
- );
174
- }
157
+ assertSignedTokenSecretsLongEnough({
158
+ passwordReset: opts.passwordReset,
159
+ emailVerification: opts.emailVerification,
160
+ accountUnlock: opts.accountUnlock,
161
+ });
175
162
 
176
163
  const strictVerification =
177
164
  opts.emailVerification !== undefined && (opts.emailVerification.mode ?? "strict") === "strict";
@@ -0,0 +1,20 @@
1
+ import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { AUTH_EMAIL_PASSWORD_BOOT_RULES } from "./boot-rules.ts";
3
+ import { MIN_HMAC_SECRET_LENGTH } from "./web/constants.ts";
4
+
5
+ type SignedTokenFlowOptions = { readonly hmacSecret: string } | undefined;
6
+
7
+ // ≥32 chars, symmetric to the JWT_SECRET env check: a short HMAC secret
8
+ // makes reset/verify tokens forgeable — that's account takeover, so the
9
+ // factory fails fast instead of trusting the caller.
10
+ export function assertSignedTokenSecretsLongEnough(
11
+ signedTokenFlows: Readonly<Record<string, SignedTokenFlowOptions>>,
12
+ ): void {
13
+ for (const [optionName, flow] of Object.entries(signedTokenFlows)) {
14
+ if (flow && flow.hmacSecret.length < MIN_HMAC_SECRET_LENGTH) {
15
+ throw bootRuleError(AUTH_EMAIL_PASSWORD_BOOT_RULES.hmacSecretTooShort, {
16
+ message: `[auth-email-password] ${optionName}.hmacSecret must be ≥${MIN_HMAC_SECRET_LENGTH} chars (HMAC-SHA256 token signing)`,
17
+ });
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,26 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const BILLING_FOUNDATION_BOOT_RULES = {
4
+ consumerProtectionInvalid: {
5
+ id: "billing-foundation/consumer-protection-invalid",
6
+ summary:
7
+ "consumerProtection options carry non-empty texts, a valid operator email, a valid termination scope and valid legal links.",
8
+ fix: "Fix the consumerProtection option named in the error message.",
9
+ },
10
+ baseUrlInvalid: {
11
+ id: "billing-foundation/base-url-invalid",
12
+ summary: "baseUrl is a parseable absolute http or https URL.",
13
+ fix: "Pass an absolute http(s) URL as baseUrl.",
14
+ },
15
+ baseUrlRequired: {
16
+ id: "billing-foundation/base-url-required",
17
+ summary: "baseUrl is set whenever consumerProtection or a catalog is configured.",
18
+ fix: "Pass baseUrl, checkout redirect URLs are built from it.",
19
+ },
20
+ catalogInvalid: {
21
+ id: "billing-foundation/catalog-invalid",
22
+ summary:
23
+ "The catalog declares unique plans, root-relative paths, view roles and a valid contact card.",
24
+ fix: "Fix the catalog option named in the error message.",
25
+ },
26
+ } as const satisfies BootRuleTable;
@@ -1,3 +1,5 @@
1
+ import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { BILLING_FOUNDATION_BOOT_RULES } from "./boot-rules.ts";
1
3
  // Feature-definition-time validation for createBillingFoundationFeature's
2
4
  // options — split out of feature.ts to keep that file at registration-only
3
5
  // concerns (app-feature-structure guard's 300-line budget). Internal — not
@@ -37,9 +39,9 @@ function validateProviderTexts(cp: ConsumerProtectionOptions): void {
37
39
  if (text === undefined) continue;
38
40
  for (const locale of ["de", "en"] as const) {
39
41
  if (!text[locale]?.trim()) {
40
- throw new Error(
41
- `createBillingFoundationFeature: consumerProtection.providerTexts.${providerName}.${textName} needs a non-empty "${locale}" entry.`,
42
- );
42
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
43
+ message: `createBillingFoundationFeature: consumerProtection.providerTexts.${providerName}.${textName} needs a non-empty "${locale}" entry.`,
44
+ });
43
45
  }
44
46
  }
45
47
  }
@@ -48,30 +50,33 @@ function validateProviderTexts(cp: ConsumerProtectionOptions): void {
48
50
 
49
51
  function validateConsumerProtection(cp: ConsumerProtectionOptions): void {
50
52
  if (cp.termsTextBlock.trim() === "") {
51
- throw new Error("createBillingFoundationFeature: consumerProtection.termsTextBlock is empty.");
53
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
54
+ message: "createBillingFoundationFeature: consumerProtection.termsTextBlock is empty.",
55
+ });
52
56
  }
53
57
  for (const locale of ["de", "en"] as const) {
54
58
  if (!cp.vatNote[locale]?.trim()) {
55
- throw new Error(
56
- `createBillingFoundationFeature: consumerProtection.vatNote needs a non-empty "${locale}" entry.`,
57
- );
59
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
60
+ message: `createBillingFoundationFeature: consumerProtection.vatNote needs a non-empty "${locale}" entry.`,
61
+ });
58
62
  }
59
63
  }
60
64
  validateProviderTexts(cp);
61
65
  if (!z.email().safeParse(cp.operatorEmail).success) {
62
- throw new Error(
63
- `createBillingFoundationFeature: consumerProtection.operatorEmail "${cp.operatorEmail}" is not a valid email address.`,
64
- );
66
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
67
+ message: `createBillingFoundationFeature: consumerProtection.operatorEmail "${cp.operatorEmail}" is not a valid email address.`,
68
+ });
65
69
  }
66
70
  if (cp.oneOffItemLabel !== undefined && typeof cp.oneOffItemLabel !== "function") {
67
- throw new Error(
68
- "createBillingFoundationFeature: consumerProtection.oneOffItemLabel must be a function.",
69
- );
71
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
72
+ message:
73
+ "createBillingFoundationFeature: consumerProtection.oneOffItemLabel must be a function.",
74
+ });
70
75
  }
71
76
  if (cp.terminationScope !== undefined && !isTerminationScope(cp.terminationScope)) {
72
- throw new Error(
73
- `createBillingFoundationFeature: consumerProtection.terminationScope "${String(cp.terminationScope)}" must be one of ${TERMINATION_SCOPES.map((scope) => `"${scope}"`).join(", ")}.`,
74
- );
77
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
78
+ message: `createBillingFoundationFeature: consumerProtection.terminationScope "${String(cp.terminationScope)}" must be one of ${TERMINATION_SCOPES.map((scope) => `"${scope}"`).join(", ")}.`,
79
+ });
75
80
  }
76
81
  if (isLegalLinkSet(cp.legalLinks)) {
77
82
  validateLegalLinkSet(cp.legalLinks, "legalLinks");
@@ -86,9 +91,9 @@ function validatePerLocaleLegalLinks(
86
91
  for (const locale of CONSENT_LOCALES) {
87
92
  const set = legalLinks[locale];
88
93
  if (!set) {
89
- throw new Error(
90
- `createBillingFoundationFeature: consumerProtection.legalLinks needs a "${locale}" entry when given per locale.`,
91
- );
94
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
95
+ message: `createBillingFoundationFeature: consumerProtection.legalLinks needs a "${locale}" entry when given per locale.`,
96
+ });
92
97
  }
93
98
  validateLegalLinkSet(set, `legalLinks.${locale}`);
94
99
  }
@@ -99,9 +104,9 @@ function validateLegalLinkSet(set: LegalLinkSet, path: string): void {
99
104
  // skip: refund is optional
100
105
  if (key === "refund" && link === undefined) continue;
101
106
  if (typeof link !== "string" || !isRootRelativeOrHttpsUrl(link)) {
102
- throw new Error(
103
- `createBillingFoundationFeature: consumerProtection.${path}.${key} "${link}" must be a root-relative path ("/..." not "//") or an absolute https URL.`,
104
- );
107
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.consumerProtectionInvalid, {
108
+ message: `createBillingFoundationFeature: consumerProtection.${path}.${key} "${link}" must be a root-relative path ("/..." not "//") or an absolute https URL.`,
109
+ });
105
110
  }
106
111
  }
107
112
  }
@@ -109,13 +114,15 @@ function validateLegalLinkSet(set: LegalLinkSet, path: string): void {
109
114
  function validateContactCard(contact: BillingPlanContactCard): void {
110
115
  for (const key of ["labelKey", "actionLabelKey"] as const) {
111
116
  if (contact[key].trim() === "") {
112
- throw new Error(`createBillingFoundationFeature: catalog.contact.${key} must not be empty.`);
117
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.catalogInvalid, {
118
+ message: `createBillingFoundationFeature: catalog.contact.${key} must not be empty.`,
119
+ });
113
120
  }
114
121
  }
115
122
  if (!isContactCardHref(contact.href)) {
116
- throw new Error(
117
- `createBillingFoundationFeature: catalog.contact.href "${contact.href}" must be an absolute https: or mailto: URL.`,
118
- );
123
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.catalogInvalid, {
124
+ message: `createBillingFoundationFeature: catalog.contact.href "${contact.href}" must be an absolute https: or mailto: URL.`,
125
+ });
119
126
  }
120
127
  }
121
128
 
@@ -124,14 +131,14 @@ function validateBaseUrl(baseUrl: string): void {
124
131
  try {
125
132
  parsed = new URL(baseUrl);
126
133
  } catch {
127
- throw new Error(
128
- `createBillingFoundationFeature: baseUrl "${baseUrl}" is not a parseable absolute URL.`,
129
- );
134
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.baseUrlInvalid, {
135
+ message: `createBillingFoundationFeature: baseUrl "${baseUrl}" is not a parseable absolute URL.`,
136
+ });
130
137
  }
131
138
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
132
- throw new Error(
133
- `createBillingFoundationFeature: baseUrl "${baseUrl}" must use http or https (parsed protocol "${parsed.protocol}").`,
134
- );
139
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.baseUrlInvalid, {
140
+ message: `createBillingFoundationFeature: baseUrl "${baseUrl}" must use http or https (parsed protocol "${parsed.protocol}").`,
141
+ });
135
142
  }
136
143
  }
137
144
 
@@ -143,9 +150,10 @@ export function validateOptions(options: BillingFoundationOptions): void {
143
150
  if (options.baseUrl !== undefined) validateBaseUrl(options.baseUrl);
144
151
  if (options.consumerProtection) {
145
152
  if (options.baseUrl === undefined) {
146
- throw new Error(
147
- "createBillingFoundationFeature: consumerProtection requires baseUrl (checkout redirect URLs are built from it).",
148
- );
153
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.baseUrlRequired, {
154
+ message:
155
+ "createBillingFoundationFeature: consumerProtection requires baseUrl (checkout redirect URLs are built from it).",
156
+ });
149
157
  }
150
158
  validateConsumerProtection(options.consumerProtection);
151
159
  }
@@ -153,19 +161,22 @@ export function validateOptions(options: BillingFoundationOptions): void {
153
161
  // skip: no catalog configured, nothing more to validate.
154
162
  if (!catalog) return;
155
163
  if (options.baseUrl === undefined) {
156
- throw new Error(
157
- "createBillingFoundationFeature: catalog requires baseUrl (plan checkouts need it to build success/cancel/return URLs).",
158
- );
164
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.baseUrlRequired, {
165
+ message:
166
+ "createBillingFoundationFeature: catalog requires baseUrl (plan checkouts need it to build success/cancel/return URLs).",
167
+ });
159
168
  }
160
169
  if (catalog.plans.length === 0) {
161
- throw new Error("createBillingFoundationFeature: catalog.plans must not be empty.");
170
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.catalogInvalid, {
171
+ message: "createBillingFoundationFeature: catalog.plans must not be empty.",
172
+ });
162
173
  }
163
174
  const seen = new Set<string>();
164
175
  for (const tier of catalog.plans) {
165
176
  if (seen.has(tier)) {
166
- throw new Error(
167
- `createBillingFoundationFeature: catalog.plans has a duplicate tier "${tier}".`,
168
- );
177
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.catalogInvalid, {
178
+ message: `createBillingFoundationFeature: catalog.plans has a duplicate tier "${tier}".`,
179
+ });
169
180
  }
170
181
  seen.add(tier);
171
182
  }
@@ -175,13 +186,15 @@ export function validateOptions(options: BillingFoundationOptions): void {
175
186
  ["returnPath", catalog.returnPath],
176
187
  ] as const) {
177
188
  if (path !== undefined && !isRootRelativePath(path)) {
178
- throw new Error(
179
- `createBillingFoundationFeature: catalog.${key} "${path}" must start with "/" and not "//".`,
180
- );
189
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.catalogInvalid, {
190
+ message: `createBillingFoundationFeature: catalog.${key} "${path}" must start with "/" and not "//".`,
191
+ });
181
192
  }
182
193
  }
183
194
  if (catalog.viewRoles.length === 0) {
184
- throw new Error("createBillingFoundationFeature: catalog.viewRoles must not be empty.");
195
+ throw bootRuleError(BILLING_FOUNDATION_BOOT_RULES.catalogInvalid, {
196
+ message: "createBillingFoundationFeature: catalog.viewRoles must not be empty.",
197
+ });
185
198
  }
186
199
  if (catalog.contact !== undefined) validateContactCard(catalog.contact);
187
200
  }
@@ -0,0 +1,14 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const CAP_OVERVIEW_BOOT_RULES = {
4
+ emptyCaps: {
5
+ id: "cap-overview/empty-caps",
6
+ summary: "createCapOverviewFeature receives at least one cap.",
7
+ fix: "Pass a non-empty caps list.",
8
+ },
9
+ unknownListCap: {
10
+ id: "cap-overview/unknown-list-cap",
11
+ summary: "listCaps only references cap ids declared in caps.",
12
+ fix: "Use ids from caps in listCaps.",
13
+ },
14
+ } as const satisfies BootRuleTable;
@@ -15,8 +15,13 @@
15
15
  // - No nav wiring — a separate cut adds `r.nav(...)` entries.
16
16
  //
17
17
  // **Boot-Dependencies:** tenant, tier-engine, billing-foundation.
18
- import { defineFeature, type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
18
+ import {
19
+ bootRuleError,
20
+ defineFeature,
21
+ type FeatureDefinition,
22
+ } from "@cosmicdrift/kumiko-framework/engine";
19
23
  import { resolveCapUsageRoles } from "./access.ts";
24
+ import { CAP_OVERVIEW_BOOT_RULES } from "./boot-rules.ts";
20
25
  import { createCapsUsageQuery } from "./handlers/caps-usage.query.ts";
21
26
  import { createTenantCapsListQuery } from "./handlers/tenant-caps-list.query.ts";
22
27
  import { tenantOptionsQuery } from "./handlers/tenant-options.query.ts";
@@ -47,16 +52,18 @@ export type CreateCapOverviewOptions = {
47
52
 
48
53
  export function createCapOverviewFeature(opts: CreateCapOverviewOptions): FeatureDefinition {
49
54
  if (opts.caps.length === 0) {
50
- throw new Error("createCapOverviewFeature: `caps` must not be empty.");
55
+ throw bootRuleError(CAP_OVERVIEW_BOOT_RULES.emptyCaps, {
56
+ message: "createCapOverviewFeature: `caps` must not be empty.",
57
+ });
51
58
  }
52
59
  const usageRoles = resolveCapUsageRoles(opts.usageVisibleTo);
53
60
  const capIds = new Set(opts.caps.map((cap) => cap.id));
54
61
  const listCaps = opts.listCaps ?? opts.caps.slice(0, 3).map((cap) => cap.id);
55
62
  for (const id of listCaps) {
56
63
  if (!capIds.has(id)) {
57
- throw new Error(
58
- `createCapOverviewFeature: listCaps references unknown cap id "${id}" — known ids: ${[...capIds].join(", ")}`,
59
- );
64
+ throw bootRuleError(CAP_OVERVIEW_BOOT_RULES.unknownListCap, {
65
+ message: `createCapOverviewFeature: listCaps references unknown cap id "${id}" — known ids: ${[...capIds].join(", ")}`,
66
+ });
60
67
  }
61
68
  }
62
69
 
@@ -0,0 +1,14 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const DOCUMENTS_BOOT_RULES = {
4
+ negativeExpiringWithinDays: {
5
+ id: "documents/negative-expiring-within-days",
6
+ summary: "expiringWithinDays is not negative.",
7
+ fix: "Pass zero or a positive number.",
8
+ },
9
+ categoryLabelUnknownCategory: {
10
+ id: "documents/category-label-unknown-category",
11
+ summary: "categoryLabels only names categories listed in categories.",
12
+ fix: "Add the category to categories or drop its label.",
13
+ },
14
+ } as const satisfies BootRuleTable;
@@ -5,6 +5,7 @@
5
5
 
6
6
  import {
7
7
  type AccessRule,
8
+ bootRuleError,
8
9
  defineEntityCreateHandler,
9
10
  defineEntityDeleteHandler,
10
11
  defineEntityDetailHandler,
@@ -14,6 +15,7 @@ import {
14
15
  type EntityDefinition,
15
16
  type FeatureRegistrar,
16
17
  } from "@cosmicdrift/kumiko-framework/engine";
18
+ import { DOCUMENTS_BOOT_RULES } from "./boot-rules.ts";
17
19
  import { type DocumentCaptureRule, registerCapture, validateCaptureRules } from "./capture.ts";
18
20
  import {
19
21
  DEFAULT_ADMIN_ROLES,
@@ -213,13 +215,15 @@ function registerDocuments(
213
215
 
214
216
  export function createDocumentsFeature(opts: DocumentsFeatureOptions) {
215
217
  if (opts.expiringWithinDays !== undefined && opts.expiringWithinDays < 0) {
216
- throw new Error("createDocumentsFeature({ expiringWithinDays }) must not be negative.");
218
+ throw bootRuleError(DOCUMENTS_BOOT_RULES.negativeExpiringWithinDays, {
219
+ message: "createDocumentsFeature({ expiringWithinDays }) must not be negative.",
220
+ });
217
221
  }
218
222
  for (const category of Object.keys(opts.categoryLabels ?? {})) {
219
223
  if (!opts.categories.includes(category)) {
220
- throw new Error(
221
- `createDocumentsFeature({ categoryLabels }) names "${category}", which is not in categories.`,
222
- );
224
+ throw bootRuleError(DOCUMENTS_BOOT_RULES.categoryLabelUnknownCategory, {
225
+ message: `createDocumentsFeature({ categoryLabels }) names "${category}", which is not in categories.`,
226
+ });
223
227
  }
224
228
  }
225
229
  return defineFeature(DOCUMENTS_FEATURE_NAME, (r) => registerDocuments(r, opts));
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const FILE_DERIVATIVES_BOOT_RULES = {
4
+ publicTenantResolutionWithoutApexResolver: {
5
+ id: "file-derivatives/public-tenant-resolution-without-apex-resolver",
6
+ summary: "publicTenantResolution is only set together with resolveApexTenant.",
7
+ fix: "Pass resolveApexTenant or drop publicTenantResolution.",
8
+ },
9
+ } as const satisfies BootRuleTable;
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { cachedResponse, computeRevisionEtag } from "@cosmicdrift/kumiko-framework/api";
10
10
  import {
11
+ bootRuleError,
11
12
  defineFeature,
12
13
  EXT_DERIVATIVE_OVERLAY_RESOLVER,
13
14
  EXT_DERIVATIVE_PUBLIC_PREDICATE,
@@ -17,6 +18,7 @@ import {
17
18
  type TenantId,
18
19
  } from "@cosmicdrift/kumiko-framework/engine";
19
20
  import { RateLimitError } from "@cosmicdrift/kumiko-framework/errors";
21
+ import { FILE_DERIVATIVES_BOOT_RULES } from "./boot-rules.ts";
20
22
  import { PUBLIC_VARIANT_QN, publicVariantQuery } from "./handlers/public-variant.query.ts";
21
23
  import {
22
24
  PUBLIC_VARIANT_BY_FILE_REF_QN,
@@ -95,9 +97,10 @@ type PublicVariantQueryResult = {
95
97
  export function createFileDerivativesFeature(opts: FileDerivativesOptions = {}): FeatureDefinition {
96
98
  const basePath = opts.basePath ?? "/media";
97
99
  if (opts.publicTenantResolution !== undefined && !opts.resolveApexTenant) {
98
- throw new Error(
99
- "createFileDerivativesFeature: publicTenantResolution requires resolveApexTenant — it only changes which tenant a variant is read from, resolveApexTenant still gates the host.",
100
- );
100
+ throw bootRuleError(FILE_DERIVATIVES_BOOT_RULES.publicTenantResolutionWithoutApexResolver, {
101
+ message:
102
+ "createFileDerivativesFeature: publicTenantResolution requires resolveApexTenant — it only changes which tenant a variant is read from, resolveApexTenant still gates the host.",
103
+ });
101
104
  }
102
105
 
103
106
  return defineFeature(
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const FOLDERS_BOOT_RULES = {
4
+ emptyParentsAllowlist: {
5
+ id: "folders/empty-parents-allowlist",
6
+ summary: "The parents allowlist is omitted or non-empty.",
7
+ fix: "Omit parents or list at least one entity.",
8
+ },
9
+ } as const satisfies BootRuleTable;